tfy-web-components 0.0.43 → 0.0.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/dist/{Button-CPJYHldw.js → Button-BdNaawKV.js} +2 -2
  2. package/dist/{Button-CPJYHldw.js.map → Button-BdNaawKV.js.map} +1 -1
  3. package/dist/{CompositeItem-DJWNsIwE.js → CompositeItem-EOSJycCk.js} +2 -2
  4. package/dist/{CompositeItem-DJWNsIwE.js.map → CompositeItem-EOSJycCk.js.map} +1 -1
  5. package/dist/{CompositeRoot-BlljDWkR.js → CompositeRoot-DnijP7Jm.js} +5 -5
  6. package/dist/{CompositeRoot-BlljDWkR.js.map → CompositeRoot-DnijP7Jm.js.map} +1 -1
  7. package/dist/{Input-Dcxu6SVO.js → Input-D0UuCXLs.js} +3 -3
  8. package/dist/{Input-Dcxu6SVO.js.map → Input-D0UuCXLs.js.map} +1 -1
  9. package/dist/{Modal-BUWlwJcN.js → Modal-BFnf68oS.js} +7 -7
  10. package/dist/{Modal-BUWlwJcN.js.map → Modal-BFnf68oS.js.map} +1 -1
  11. package/dist/{Popover-BqqXJnK1.js → Popover-B6z7exNd.js} +9 -9
  12. package/dist/{Popover-BqqXJnK1.js.map → Popover-B6z7exNd.js.map} +1 -1
  13. package/dist/PrehydrationScript--08s8Mfl.js +56 -0
  14. package/dist/PrehydrationScript--08s8Mfl.js.map +1 -0
  15. package/dist/{Tooltip-uQIVdskf.js → Tooltip-6R-t7wt1.js} +6 -5
  16. package/dist/{Tooltip-uQIVdskf.js.map → Tooltip-6R-t7wt1.js.map} +1 -1
  17. package/dist/components/atoms/Accordion.es.js +2 -2
  18. package/dist/components/atoms/Button.es.js +2 -2
  19. package/dist/components/atoms/ButtonGroup.es.js +1 -1
  20. package/dist/components/atoms/IconButton.es.js +2 -2
  21. package/dist/components/atoms/IconProvider.es.js +2 -1
  22. package/dist/components/atoms/IconProvider.es.js.map +1 -1
  23. package/dist/components/atoms/Modal.es.js +1 -1
  24. package/dist/components/atoms/OverflowButton.es.js +2 -2
  25. package/dist/components/atoms/Switch.es.js +4 -4
  26. package/dist/components/atoms/TabButton.d.ts +31 -6
  27. package/dist/components/atoms/TabButton.es.js +418 -50
  28. package/dist/components/atoms/TabButton.es.js.map +1 -1
  29. package/dist/components/atoms/Tooltip.es.js +1 -1
  30. package/dist/components/molecules/Alert.es.js +3 -3
  31. package/dist/components/molecules/CopyField.es.js +2 -2
  32. package/dist/components/molecules/CustomDrawer.es.js +1 -1
  33. package/dist/components/molecules/Dialog.es.js +1 -1
  34. package/dist/components/molecules/ImagesPreview.es.js +2 -2
  35. package/dist/components/molecules/Input.es.js +2 -2
  36. package/dist/components/molecules/Markdown.es.js +1 -1
  37. package/dist/components/molecules/SimpleCodeEditor.es.js +2 -2
  38. package/dist/components/molecules/ToggleButton.es.js +2 -2
  39. package/dist/components/molecules/TopBar.d.ts +47 -0
  40. package/dist/components/molecules/TopBar.es.js +164 -0
  41. package/dist/components/molecules/TopBar.es.js.map +1 -0
  42. package/dist/components/molecules/agent-chat.es.js +2 -2
  43. package/dist/components/theme/colors.es.js +1 -0
  44. package/dist/components/theme/colors.es.js.map +1 -1
  45. package/dist/{composite-C22yiNy1.js → composite-BDBV1Jsx.js} +2 -2
  46. package/dist/{composite-C22yiNy1.js.map → composite-BDBV1Jsx.js.map} +1 -1
  47. package/dist/{composite-BL4bbAWg.js → composite-rAI4IlWK.js} +2 -2
  48. package/dist/{composite-BL4bbAWg.js.map → composite-rAI4IlWK.js.map} +1 -1
  49. package/dist/{index-C-2yrwZl.js → index-B6xFUIBK.js} +3 -3
  50. package/dist/{index-C-2yrwZl.js.map → index-B6xFUIBK.js.map} +1 -1
  51. package/dist/index.d.ts +2 -0
  52. package/dist/index.es.js +5 -2
  53. package/dist/index.es.js.map +1 -1
  54. package/dist/new-components/atoms/Alert.d.ts +3 -1
  55. package/dist/new-components/atoms/Alert.es.js +18 -12
  56. package/dist/new-components/atoms/Alert.es.js.map +1 -1
  57. package/dist/new-components/atoms/Checkbox.es.js +4 -4
  58. package/dist/new-components/atoms/EmptyState.es.js +1 -1
  59. package/dist/new-components/atoms/Popover.es.js +2 -2
  60. package/dist/new-components/atoms/Radio.es.js +8 -8
  61. package/dist/new-components/atoms/SegmentedControl.es.js +4 -4
  62. package/dist/new-components/atoms/Slider.es.js +7 -52
  63. package/dist/new-components/atoms/Slider.es.js.map +1 -1
  64. package/dist/new-components/atoms/Toast.es.js +1 -1
  65. package/dist/new-components/atoms/Toggletip.d.ts +1 -1
  66. package/dist/new-components/atoms/Toggletip.es.js +2 -2
  67. package/dist/{shadowDom-BfewIqRj.js → shadowDom-CRvvf3qf.js} +2 -2
  68. package/dist/{shadowDom-BfewIqRj.js.map → shadowDom-CRvvf3qf.js.map} +1 -1
  69. package/dist/style.css +1 -1
  70. package/dist/tokens.css +21 -6
  71. package/dist/{useAriaLabelledBy-Lyj6n_TU.js → useAriaLabelledBy-C9SDiruE.js} +2 -2
  72. package/dist/{useAriaLabelledBy-Lyj6n_TU.js.map → useAriaLabelledBy-C9SDiruE.js.map} +1 -1
  73. package/dist/{useBaseUiId-CmLtG9DS.js → useBaseUiId-jtgiQp--.js} +24 -24
  74. package/dist/{useBaseUiId-CmLtG9DS.js.map → useBaseUiId-jtgiQp--.js.map} +1 -1
  75. package/dist/{useButton-D2BMuSfC.js → useButton-BalOc_EL.js} +2 -2
  76. package/dist/{useButton-D2BMuSfC.js.map → useButton-BalOc_EL.js.map} +1 -1
  77. package/dist/{useLabelableId-CcIE3RU0.js → useLabelableId-CQqNbBk1.js} +2 -2
  78. package/dist/{useLabelableId-CcIE3RU0.js.map → useLabelableId-CQqNbBk1.js.map} +1 -1
  79. package/dist/{useOpenInteractionType-CDFYOw2d.js → useOpenInteractionType-BnUZ2Eio.js} +6 -6
  80. package/dist/{useOpenInteractionType-CDFYOw2d.js.map → useOpenInteractionType-BnUZ2Eio.js.map} +1 -1
  81. package/dist/{usePopupHandleStore-CkW2IoED.js → usePopupHandleStore-DYUo-Fyk.js} +5 -5
  82. package/dist/{usePopupHandleStore-CkW2IoED.js.map → usePopupHandleStore-DYUo-Fyk.js.map} +1 -1
  83. package/package.json +1 -1
@@ -1,18 +1,38 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import IconProvider from "./IconProvider.es.js";
3
- import { D as DarkTooltip } from "../../Tooltip-uQIVdskf.js";
4
- import { c as classNames } from "../../classNames-B1XpQHle.js";
5
2
  import * as React from "react";
3
+ import { c as cva } from "../../index-DSVg79g-.js";
4
+ import Badge from "./Badge.es.js";
5
+ import IconProvider, { iconFrame } from "./IconProvider.es.js";
6
+ import { r as round, D as DarkTooltip } from "../../Tooltip-6R-t7wt1.js";
7
+ import { c as classNames } from "../../classNames-B1XpQHle.js";
6
8
  import { u as useControlled } from "../../useControlled-BSyYkg5C.js";
7
9
  import { f as formatErrorMessage, u as useIsoLayoutEffect, a as useStableCallback, b as useRenderElement, E as EMPTY_ARRAY } from "../../useIsoLayoutEffect-e9VA-ICd.js";
8
10
  import { C as CompositeList, u as useCompositeListItem } from "../../CompositeList-D4xmSZ5V.js";
9
- import { c as createChangeEventDetails, i as initial, m as missing, d as disabled, u as useBaseUiId, n as none } from "../../useBaseUiId-CmLtG9DS.js";
11
+ import { g as getComputedStyle, i as isHTMLElement, c as createChangeEventDetails, a as initial, m as missing, d as disabled, u as useBaseUiId, n as none, b as getWindow, e as useForcedRerendering, f as getParentNode, h as isLastTraversableNode } from "../../useBaseUiId-jtgiQp--.js";
10
12
  import { i as inertValue } from "../../inertValue-IJM5NA30.js";
11
13
  import { u as useTransitionStatus, a as useOpenChangeComplete, t as transitionStatusMapping } from "../../useTransitionStatus-C9gg_XJ-.js";
12
- import { u as useCompositeItem, A as ACTIVE_COMPOSITE_ITEM, C as CompositeRoot } from "../../CompositeRoot-BlljDWkR.js";
13
- import { o as ownerDocument } from "../../index-C-2yrwZl.js";
14
- import { u as useCompositeRootContext, a as useButton } from "../../useButton-D2BMuSfC.js";
15
- import { c as contains, a as activeElement } from "../../shadowDom-BfewIqRj.js";
14
+ import { u as useCompositeItem, A as ACTIVE_COMPOSITE_ITEM, C as CompositeRoot } from "../../CompositeRoot-DnijP7Jm.js";
15
+ import { P as PrehydrationScript, s as script } from "../../PrehydrationScript--08s8Mfl.js";
16
+ import { o as ownerDocument } from "../../index-B6xFUIBK.js";
17
+ import { u as useCompositeRootContext, a as useButton } from "../../useButton-BalOc_EL.js";
18
+ import { c as contains, a as activeElement } from "../../shadowDom-CRvvf3qf.js";
19
+ function getCssDimensions(element) {
20
+ const css = getComputedStyle(element);
21
+ let width = parseFloat(css.width) || 0;
22
+ let height = parseFloat(css.height) || 0;
23
+ const hasOffset = isHTMLElement(element);
24
+ const offsetWidth = hasOffset ? element.offsetWidth : width;
25
+ const offsetHeight = hasOffset ? element.offsetHeight : height;
26
+ const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
27
+ if (shouldFallback) {
28
+ width = offsetWidth;
29
+ height = offsetHeight;
30
+ }
31
+ return {
32
+ width,
33
+ height
34
+ };
35
+ }
16
36
  const TabsRootContext = /* @__PURE__ */ React.createContext(void 0);
17
37
  if (process.env.NODE_ENV !== "production") TabsRootContext.displayName = "TabsRootContext";
18
38
  function useTabsRootContext() {
@@ -251,10 +271,10 @@ function computeActivationDirection(oldValue, newValue, orientation, tabMap) {
251
271
  }
252
272
  return "none";
253
273
  }
254
- const TabsListContext = /* @__PURE__ */ React.createContext(void 0);
255
- if (process.env.NODE_ENV !== "production") TabsListContext.displayName = "TabsListContext";
256
- function useTabsListContext() {
257
- const context = React.useContext(TabsListContext);
274
+ const TabsListContext$1 = /* @__PURE__ */ React.createContext(void 0);
275
+ if (process.env.NODE_ENV !== "production") TabsListContext$1.displayName = "TabsListContext";
276
+ function useTabsListContext$1() {
277
+ const context = React.useContext(TabsListContext$1);
258
278
  if (context === void 0) {
259
279
  throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: TabsListContext is missing. TabsList parts must be placed within <Tabs.List>." : formatErrorMessage(65));
260
280
  }
@@ -282,7 +302,7 @@ const TabsTab = /* @__PURE__ */ React.forwardRef(function TabsTab2(componentProp
282
302
  activateOnFocus,
283
303
  registerTabResizeObserverElement,
284
304
  tabsListElement
285
- } = useTabsListContext();
305
+ } = useTabsListContext$1();
286
306
  const {
287
307
  highlightedIndex,
288
308
  onHighlightedIndexChange
@@ -403,6 +423,220 @@ const TabsTab = /* @__PURE__ */ React.forwardRef(function TabsTab2(componentProp
403
423
  return element;
404
424
  });
405
425
  if (process.env.NODE_ENV !== "production") TabsTab.displayName = "TabsTab";
426
+ function getElementTransform(element, computedStyle) {
427
+ const transform = (computedStyle ?? getWindow(element).getComputedStyle(element)).transform;
428
+ let translateX = 0;
429
+ let translateY = 0;
430
+ let scale = 1;
431
+ if (transform && transform !== "none") {
432
+ const matrix = transform.match(/matrix(?:3d)?\(([^)]+)\)/);
433
+ if (matrix) {
434
+ const values = matrix[1].split(", ").map(parseFloat);
435
+ if (values.length === 6) {
436
+ translateX = values[4];
437
+ translateY = values[5];
438
+ scale = Math.sqrt(values[0] * values[0] + values[1] * values[1]);
439
+ } else if (values.length === 16) {
440
+ translateX = values[12];
441
+ translateY = values[13];
442
+ scale = values[0];
443
+ }
444
+ }
445
+ }
446
+ return {
447
+ x: translateX,
448
+ y: translateY,
449
+ scale
450
+ };
451
+ }
452
+ const activeTabLeft = "--active-tab-left";
453
+ const activeTabRight = "--active-tab-right";
454
+ const activeTabTop = "--active-tab-top";
455
+ const activeTabBottom = "--active-tab-bottom";
456
+ const activeTabWidth = "--active-tab-width";
457
+ const activeTabHeight = "--active-tab-height";
458
+ var _PrehydrationScript;
459
+ const stateAttributesMapping$1 = {
460
+ ...tabsStateAttributesMapping,
461
+ activeTabPosition: () => null,
462
+ activeTabSize: () => null
463
+ };
464
+ const MAX_LAYOUT_ROUNDING_ERROR = 2;
465
+ const TabsIndicator = /* @__PURE__ */ React.forwardRef(function TabsIndicator2(componentProps, forwardedRef) {
466
+ const {
467
+ className,
468
+ render,
469
+ renderBeforeHydration = false,
470
+ style: styleProp,
471
+ ...elementProps
472
+ } = componentProps;
473
+ const {
474
+ getTabElementBySelectedValue,
475
+ orientation,
476
+ tabActivationDirection,
477
+ value
478
+ } = useTabsRootContext();
479
+ const {
480
+ tabsListElement,
481
+ registerIndicatorUpdateListener
482
+ } = useTabsListContext$1();
483
+ const rerender = useForcedRerendering();
484
+ React.useEffect(() => {
485
+ return registerIndicatorUpdateListener(rerender);
486
+ }, [registerIndicatorUpdateListener, rerender]);
487
+ let left = 0;
488
+ let right = 0;
489
+ let top = 0;
490
+ let bottom = 0;
491
+ let width = 0;
492
+ let height = 0;
493
+ let isTabSelected = false;
494
+ if (value != null && tabsListElement != null) {
495
+ const activeTab = getTabElementBySelectedValue(value);
496
+ if (activeTab != null) {
497
+ isTabSelected = true;
498
+ const {
499
+ width: computedWidth,
500
+ height: computedHeight
501
+ } = getCssDimensions(activeTab);
502
+ const {
503
+ width: tabListWidth,
504
+ height: tabListHeight
505
+ } = getCssDimensions(tabsListElement);
506
+ const tabRect = activeTab.getBoundingClientRect();
507
+ const tabsListRect = tabsListElement.getBoundingClientRect();
508
+ const scaleX = tabListWidth > 0 ? tabsListRect.width / tabListWidth : 1;
509
+ const scaleY = tabListHeight > 0 ? tabsListRect.height / tabListHeight : 1;
510
+ const layoutOffset = getLayoutOffset(activeTab, tabsListElement);
511
+ left = layoutOffset.left;
512
+ top = layoutOffset.top;
513
+ const rectLeft = (tabRect.left - tabsListRect.left) / scaleX + tabsListElement.scrollLeft - tabsListElement.clientLeft;
514
+ const rectTop = (tabRect.top - tabsListRect.top) / scaleY + tabsListElement.scrollTop - tabsListElement.clientTop;
515
+ const tabTranslation = getActiveTabTranslation(activeTab);
516
+ if (Math.abs(rectLeft - tabTranslation.x - left) <= MAX_LAYOUT_ROUNDING_ERROR && Math.abs(rectTop - tabTranslation.y - top) <= MAX_LAYOUT_ROUNDING_ERROR) {
517
+ left = rectLeft;
518
+ top = rectTop;
519
+ }
520
+ width = computedWidth;
521
+ height = computedHeight;
522
+ right = tabsListElement.scrollWidth - left - width;
523
+ bottom = tabsListElement.scrollHeight - top - height;
524
+ }
525
+ }
526
+ const activeTabPosition = isTabSelected ? {
527
+ left,
528
+ right,
529
+ top,
530
+ bottom
531
+ } : null;
532
+ const activeTabSize = isTabSelected ? {
533
+ width,
534
+ height
535
+ } : null;
536
+ const style = isTabSelected ? {
537
+ [activeTabLeft]: `${left}px`,
538
+ [activeTabRight]: `${right}px`,
539
+ [activeTabTop]: `${top}px`,
540
+ [activeTabBottom]: `${bottom}px`,
541
+ [activeTabWidth]: `${width}px`,
542
+ [activeTabHeight]: `${height}px`
543
+ } : void 0;
544
+ const displayIndicator = isTabSelected && width > 0 && height > 0;
545
+ const state = {
546
+ orientation,
547
+ activeTabPosition,
548
+ activeTabSize,
549
+ tabActivationDirection
550
+ };
551
+ const element = useRenderElement("span", componentProps, {
552
+ state,
553
+ ref: forwardedRef,
554
+ props: [{
555
+ role: "presentation",
556
+ style,
557
+ hidden: !displayIndicator
558
+ // do not display the indicator before the layout is settled
559
+ }, elementProps, {
560
+ suppressHydrationWarning: true
561
+ }],
562
+ stateAttributesMapping: stateAttributesMapping$1
563
+ });
564
+ if (value == null) {
565
+ return null;
566
+ }
567
+ return /* @__PURE__ */ jsxs(React.Fragment, {
568
+ children: [element, renderBeforeHydration && (_PrehydrationScript || (_PrehydrationScript = /* @__PURE__ */ jsx(PrehydrationScript, {
569
+ script
570
+ })))]
571
+ });
572
+ });
573
+ if (process.env.NODE_ENV !== "production") TabsIndicator.displayName = "TabsIndicator";
574
+ function getLayoutOffset(element, ancestor) {
575
+ const elementOffset = getCumulativeOffset(element);
576
+ const ancestorOffset = getCumulativeOffset(ancestor);
577
+ let left = elementOffset.left - ancestorOffset.left - ancestor.clientLeft;
578
+ let top = elementOffset.top - ancestorOffset.top - ancestor.clientTop;
579
+ let node = getParentNode(element);
580
+ while (isHTMLElement(node) && node !== ancestor && !isLastTraversableNode(node)) {
581
+ left -= node.scrollLeft;
582
+ top -= node.scrollTop;
583
+ node = getParentNode(node);
584
+ }
585
+ return {
586
+ left,
587
+ top
588
+ };
589
+ }
590
+ function getCumulativeOffset(element) {
591
+ let left = 0;
592
+ let top = 0;
593
+ let currentElement = element;
594
+ while (currentElement != null) {
595
+ left += currentElement.offsetLeft;
596
+ top += currentElement.offsetTop;
597
+ const offsetParent = currentElement.offsetParent;
598
+ if (offsetParent != null) {
599
+ left += offsetParent.clientLeft;
600
+ top += offsetParent.clientTop;
601
+ }
602
+ currentElement = offsetParent;
603
+ }
604
+ return {
605
+ left,
606
+ top
607
+ };
608
+ }
609
+ function getActiveTabTranslation(element) {
610
+ const computedStyle = getWindow(element).getComputedStyle(element);
611
+ const {
612
+ x,
613
+ y
614
+ } = getElementTransform(element, computedStyle);
615
+ let translateX = x;
616
+ let translateY = y;
617
+ const {
618
+ translate
619
+ } = computedStyle;
620
+ if (translate && translate !== "none") {
621
+ const parts = translate.split(" ");
622
+ translateX += resolveTranslateLength(parts[0], element.offsetWidth);
623
+ translateY += resolveTranslateLength(parts[1], element.offsetHeight);
624
+ }
625
+ return {
626
+ x: translateX,
627
+ y: translateY
628
+ };
629
+ }
630
+ function resolveTranslateLength(value, referenceSize) {
631
+ if (!value) {
632
+ return 0;
633
+ }
634
+ const numeric = parseFloat(value);
635
+ if (!Number.isFinite(numeric)) {
636
+ return 0;
637
+ }
638
+ return value.endsWith("%") ? numeric / 100 * referenceSize : numeric;
639
+ }
406
640
  const index = "data-index";
407
641
  const stateAttributesMapping = {
408
642
  ...tabsStateAttributesMapping,
@@ -551,7 +785,7 @@ const TabsList$1 = /* @__PURE__ */ React.forwardRef(function TabsList(componentP
551
785
  registerTabResizeObserverElement,
552
786
  tabsListElement
553
787
  }), [activateOnFocus, registerIndicatorUpdateListener, registerTabResizeObserverElement, tabsListElement]);
554
- return /* @__PURE__ */ jsx(TabsListContext.Provider, {
788
+ return /* @__PURE__ */ jsx(TabsListContext$1.Provider, {
555
789
  value: tabsListContextValue,
556
790
  children: /* @__PURE__ */ jsx(CompositeRoot, {
557
791
  render,
@@ -572,41 +806,172 @@ const TabsList$1 = /* @__PURE__ */ React.forwardRef(function TabsList(componentP
572
806
  });
573
807
  });
574
808
  if (process.env.NODE_ENV !== "production") TabsList$1.displayName = "TabsList";
809
+ const TabsListContext = React.createContext(null);
810
+ function useTabsListContext() {
811
+ return React.useContext(TabsListContext) ?? { variant: "line", size: "default" };
812
+ }
813
+ function formatCount(count) {
814
+ return count > 99 ? "99+" : String(count);
815
+ }
816
+ const tabsListVariants = cva("relative inline-flex items-stretch data-[orientation=vertical]:flex-col", {
817
+ variants: {
818
+ variant: {
819
+ line: 'gap-0 after:pointer-events-none after:absolute after:bg-border-subtle after:content-[""] data-[orientation=horizontal]:after:inset-x-0 data-[orientation=horizontal]:after:bottom-0 data-[orientation=horizontal]:after:h-px data-[orientation=vertical]:after:inset-y-0 data-[orientation=vertical]:after:left-0 data-[orientation=vertical]:after:w-px',
820
+ filled: 'gap-0 after:pointer-events-none after:absolute after:bg-border-subtle after:content-[""] data-[orientation=horizontal]:after:inset-x-0 data-[orientation=horizontal]:after:bottom-0 data-[orientation=horizontal]:after:h-px data-[orientation=vertical]:after:inset-y-0 data-[orientation=vertical]:after:left-0 data-[orientation=vertical]:after:w-px',
821
+ contained: "gap-0 [&>[data-slot=tabs-trigger]+[data-slot=tabs-trigger]]:-ml-px",
822
+ detached: "gap-space-2",
823
+ tinted: "gap-0"
824
+ },
825
+ size: {
826
+ lg: "",
827
+ default: "",
828
+ md: ""
829
+ }
830
+ },
831
+ defaultVariants: {
832
+ variant: "line",
833
+ size: "default"
834
+ }
835
+ });
836
+ const tabIndicatorPseudo = "after:pointer-events-none after:absolute after:bg-tabs-indicator-background-selected after:content-[''] after:opacity-0 data-active:after:opacity-100";
837
+ const tabsTriggerVariants = cva(
838
+ [
839
+ // Raise active/focused tabs above -ml-px neighbors (same pattern as ButtonGroup).
840
+ "group relative z-1 data-active:z-10 focus-visible:z-20 inline-flex shrink-0 items-center justify-center transition-colors",
841
+ "text-text-secondary not-data-active:hover:text-text-primary data-active:text-tabs-text-selected",
842
+ "not-data-active:hover:bg-tabs-background-hover",
843
+ "focus-ring focus-visible:outline-offset-[0.25rem]",
844
+ "data-disabled:pointer-events-none data-disabled:opacity-50"
845
+ ],
846
+ {
847
+ variants: {
848
+ variant: {
849
+ line: [
850
+ "rounded-t-sm data-[orientation=vertical]:w-40 data-[orientation=vertical]:justify-start data-[orientation=vertical]:rounded-t-none data-[orientation=vertical]:rounded-r-sm"
851
+ ],
852
+ filled: [
853
+ "rounded-t-sm data-[orientation=vertical]:w-40 data-[orientation=vertical]:justify-start data-[orientation=vertical]:rounded-t-none data-[orientation=vertical]:rounded-r-sm",
854
+ "data-active:bg-tabs-background-selected",
855
+ tabIndicatorPseudo,
856
+ "after:bottom-0 after:left-0 after:right-0 after:h-0.5",
857
+ "data-[orientation=vertical]:after:bottom-0 data-[orientation=vertical]:after:left-0 data-[orientation=vertical]:after:right-auto data-[orientation=vertical]:after:top-0 data-[orientation=vertical]:after:h-auto data-[orientation=vertical]:after:w-0.5"
858
+ ],
859
+ contained: [
860
+ "border border-border-subtle bg-tabs-contained-background",
861
+ "data-active:border-b-transparent data-active:bg-tabs-contained-background-selected",
862
+ tabIndicatorPseudo,
863
+ "after:bottom-0 after:-left-px after:-right-px after:h-0.5"
864
+ ],
865
+ detached: [
866
+ "rounded-t-md border border-border-subtle bg-tabs-contained-background",
867
+ "data-active:border-b-transparent data-active:bg-tabs-contained-background-selected",
868
+ tabIndicatorPseudo,
869
+ "after:bottom-0 after:-left-px after:-right-px after:h-0.5"
870
+ ],
871
+ tinted: [
872
+ "border-b border-border-subtle",
873
+ "data-active:border data-active:border-b-transparent data-active:border-border-subtle data-active:bg-tabs-background-selected",
874
+ tabIndicatorPseudo,
875
+ "after:bottom-0 after:-left-px after:-right-px after:h-0.5"
876
+ ]
877
+ },
878
+ size: {
879
+ lg: "h-8 gap-space-6 text-heading-sm",
880
+ default: "h-7 gap-space-6 text-label-md",
881
+ md: "h-6 gap-space-4 text-label-sm"
882
+ }
883
+ },
884
+ compoundVariants: [
885
+ { variant: "line", class: "px-space-12" },
886
+ { variant: "filled", class: "px-space-12" },
887
+ { variant: "contained", class: "px-space-12" },
888
+ { variant: "detached", class: "px-space-12" },
889
+ { variant: "tinted", class: "px-space-12" }
890
+ ],
891
+ defaultVariants: {
892
+ variant: "line",
893
+ size: "default"
894
+ }
895
+ }
896
+ );
575
897
  function Tabs(props) {
576
898
  return /* @__PURE__ */ jsx(TabsRoot, { "data-slot": "tabs", ...props });
577
899
  }
578
- function TabsList2({ className, ...props }) {
579
- return /* @__PURE__ */ jsx(
900
+ const tabsIndicatorClassName = classNames(
901
+ "pointer-events-none absolute z-10 bg-tabs-indicator-background-selected transition-[translate,width,height] duration-200 ease-in-out motion-reduce:transition-none",
902
+ "data-[orientation=horizontal]:bottom-0 data-[orientation=horizontal]:left-0 data-[orientation=horizontal]:h-[0.1875rem] data-[orientation=horizontal]:w-[var(--active-tab-width)] data-[orientation=horizontal]:translate-x-[var(--active-tab-left)] data-[orientation=horizontal]:rounded-pill",
903
+ "data-[orientation=vertical]:top-0 data-[orientation=vertical]:left-0 data-[orientation=vertical]:h-[var(--active-tab-height)] data-[orientation=vertical]:w-[0.1875rem] data-[orientation=vertical]:translate-y-[var(--active-tab-top)] data-[orientation=vertical]:rounded-pill"
904
+ );
905
+ function TabsList2({
906
+ className,
907
+ variant = "line",
908
+ size = "default",
909
+ activateOnFocus = true,
910
+ children,
911
+ ...props
912
+ }) {
913
+ const contextValue = React.useMemo(() => ({ variant, size }), [variant, size]);
914
+ return /* @__PURE__ */ jsx(TabsListContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxs(
580
915
  TabsList$1,
581
916
  {
582
917
  "data-slot": "tabs-list",
583
- className: classNames("inline-flex h-9 items-center gap-1 rounded-md bg-tabs-contained-background p-1", className),
584
- ...props
918
+ "data-variant": variant,
919
+ "data-size": size,
920
+ activateOnFocus,
921
+ className: classNames(tabsListVariants({ variant, size }), className),
922
+ ...props,
923
+ children: [
924
+ children,
925
+ variant === "line" ? /* @__PURE__ */ jsx(TabsIndicator, { "data-slot": "tabs-indicator", className: tabsIndicatorClassName }) : null
926
+ ]
585
927
  }
586
- );
928
+ ) });
587
929
  }
588
- function TabsTrigger({ className, ...props }) {
589
- return /* @__PURE__ */ jsx(
930
+ function TabsTrigger({
931
+ className,
932
+ icon,
933
+ count,
934
+ iconSize,
935
+ textClassName,
936
+ children,
937
+ "aria-label": ariaLabel,
938
+ ...props
939
+ }) {
940
+ const { variant, size } = useTabsListContext();
941
+ const countDisplay = count === void 0 ? null : formatCount(count);
942
+ const labelText = typeof children === "string" || typeof children === "number" ? String(children) : void 0;
943
+ const baseName = ariaLabel ?? labelText;
944
+ const resolvedAriaLabel = baseName != null && countDisplay != null ? `${baseName}, ${countDisplay}` : ariaLabel;
945
+ const iconKey = size === "md" ? "12" : "16";
946
+ const badgeSize = size === "lg" ? "md" : "sm";
947
+ return /* @__PURE__ */ jsxs(
590
948
  TabsTab,
591
949
  {
592
950
  "data-slot": "tabs-trigger",
593
- className: classNames(
594
- "inline-flex items-center justify-center rounded-sm px-3 py-1 text-label-sm text-text-secondary transition-colors hover:bg-tabs-background-hover focus-ring disabled:pointer-events-none disabled:opacity-50 data-active:bg-tabs-contained-background-selected data-active:text-tabs-text-selected",
595
- className
596
- ),
597
- ...props
951
+ "aria-label": resolvedAriaLabel,
952
+ className: classNames(tabsTriggerVariants({ variant, size }), className),
953
+ ...props,
954
+ children: [
955
+ icon ? /* @__PURE__ */ jsx(
956
+ "span",
957
+ {
958
+ "data-slot": "tabs-trigger-icon",
959
+ "aria-hidden": true,
960
+ className: classNames(
961
+ "inline-flex shrink-0 items-center justify-center text-icon-tertiary group-not-data-active:group-hover:text-icon-secondary group-data-active:text-icon-primary",
962
+ iconFrame[iconKey].frameClass
963
+ ),
964
+ children: /* @__PURE__ */ jsx(IconProvider, { icon, size: iconSize ?? iconFrame[iconKey].glyph })
965
+ }
966
+ ) : null,
967
+ children != null && children !== false ? /* @__PURE__ */ jsx("span", { "data-slot": "tabs-trigger-label", className: classNames(textClassName), children }) : null,
968
+ countDisplay != null ? /* @__PURE__ */ jsx(Badge, { "data-slot": "tabs-trigger-count", status: "neutral", size: badgeSize, label: countDisplay }) : null
969
+ ]
598
970
  }
599
971
  );
600
972
  }
601
973
  function TabsContent({ className, ...props }) {
602
- return /* @__PURE__ */ jsx(
603
- TabsPanel,
604
- {
605
- "data-slot": "tabs-content",
606
- className: classNames("mt-12 focus-ring outline-none", className),
607
- ...props
608
- }
609
- );
974
+ return /* @__PURE__ */ jsx(TabsPanel, { "data-slot": "tabs-content", className: classNames("focus-ring outline-none", className), ...props });
610
975
  }
611
976
  const TabButton = ({
612
977
  id,
@@ -615,42 +980,45 @@ const TabButton = ({
615
980
  tooltip,
616
981
  textClassName,
617
982
  iconSize,
618
- isActive,
983
+ isActive: _isActive,
619
984
  value,
620
985
  disabled: disabled2,
621
986
  className,
987
+ count,
988
+ showLabel = true,
989
+ "aria-label": ariaLabel,
622
990
  ...props
623
991
  }) => {
992
+ const labelText = typeof text === "string" ? text : void 0;
993
+ const resolvedAriaLabel = ariaLabel ?? (!showLabel ? labelText : void 0);
994
+ const resolvedTooltip = tooltip ?? (!showLabel ? labelText : void 0);
624
995
  const trigger = /* @__PURE__ */ jsx(
625
996
  TabsTrigger,
626
997
  {
627
998
  value: value ?? id,
628
999
  disabled: disabled2,
629
- className: classNames("max-w-[22.5rem] min-w-[5.625rem] px-4 py-3 capitalize", className),
1000
+ icon,
1001
+ iconSize,
1002
+ count,
1003
+ textClassName,
1004
+ "aria-label": resolvedAriaLabel,
1005
+ className,
630
1006
  ...props,
631
- children: /* @__PURE__ */ jsxs("span", { className: classNames("flex items-center gap-2", disabled2 && "opacity-50"), children: [
632
- icon && /* @__PURE__ */ jsx(
633
- IconProvider,
634
- {
635
- icon,
636
- className: classNames("fill-icon-brand text-icon-brand", isActive && "text-icon-brand"),
637
- size: iconSize || 1
638
- }
639
- ),
640
- /* @__PURE__ */ jsx("span", { className: classNames("text-base font-lab", textClassName), children: text })
641
- ] })
1007
+ children: showLabel ? text : null
642
1008
  }
643
1009
  );
644
- if (!tooltip) {
1010
+ if (!resolvedTooltip) {
645
1011
  return trigger;
646
1012
  }
647
- return /* @__PURE__ */ jsx(DarkTooltip, { title: tooltip, placement: "bottom", children: trigger });
1013
+ return /* @__PURE__ */ jsx(DarkTooltip, { title: resolvedTooltip, placement: "bottom", children: trigger });
648
1014
  };
649
1015
  export {
650
1016
  Tabs,
651
1017
  TabsContent,
652
1018
  TabsList2 as TabsList,
653
1019
  TabsTrigger,
654
- TabButton as default
1020
+ TabButton as default,
1021
+ tabsListVariants,
1022
+ tabsTriggerVariants
655
1023
  };
656
1024
  //# sourceMappingURL=TabButton.es.js.map