tfy-web-components 0.0.45 → 0.0.47
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.
- package/dist/{CompositeItem-GNejxLcK.js → CompositeItem-ClTKQQ4f.js} +2 -2
- package/dist/{CompositeItem-GNejxLcK.js.map → CompositeItem-ClTKQQ4f.js.map} +1 -1
- package/dist/{CompositeRoot-7_u1HqDT.js → CompositeRoot-CR4V84Em.js} +6 -6
- package/dist/{CompositeRoot-7_u1HqDT.js.map → CompositeRoot-CR4V84Em.js.map} +1 -1
- package/dist/{DropdownMenu-Crlf-J4E.js → DropdownMenu-B_tIHJUl.js} +14 -14
- package/dist/{DropdownMenu-Crlf-J4E.js.map → DropdownMenu-B_tIHJUl.js.map} +1 -1
- package/dist/{Modal-DaHG8mjy.js → Modal-CJj8wP0E.js} +7 -7
- package/dist/{Modal-DaHG8mjy.js.map → Modal-CJj8wP0E.js.map} +1 -1
- package/dist/{Popover-A8IyEt2w.js → Popover-DOpJ7QW-.js} +5 -5
- package/dist/{Popover-A8IyEt2w.js.map → Popover-DOpJ7QW-.js.map} +1 -1
- package/dist/{PopoverPopup-teGm7D5T.js → PopoverPopup-Dd6Z5rv7.js} +8 -8
- package/dist/{PopoverPopup-teGm7D5T.js.map → PopoverPopup-Dd6Z5rv7.js.map} +1 -1
- package/dist/{PrehydrationScript-B3u_PP2W.js → PrehydrationScript-BfRb7l5u.js} +2 -2
- package/dist/{PrehydrationScript-B3u_PP2W.js.map → PrehydrationScript-BfRb7l5u.js.map} +1 -1
- package/dist/{Select-BtX40h2K.js → Select-OlnvlAXg.js} +14 -14
- package/dist/{Select-BtX40h2K.js.map → Select-OlnvlAXg.js.map} +1 -1
- package/dist/components/atoms/Accordion.d.ts +11 -4
- package/dist/components/atoms/Accordion.es.js +108 -52
- package/dist/components/atoms/Accordion.es.js.map +1 -1
- package/dist/components/atoms/ButtonGroup.es.js +2 -0
- package/dist/components/atoms/ButtonGroup.es.js.map +1 -1
- package/dist/components/atoms/Combobox.es.js +12 -12
- package/dist/components/atoms/ContextMenu.es.js +6 -6
- package/dist/components/atoms/DropdownMenu.es.js +1 -1
- package/dist/components/atoms/Modal.es.js +1 -1
- package/dist/components/atoms/Popover.es.js +1 -1
- package/dist/components/atoms/Select.es.js +2 -2
- package/dist/components/atoms/Switch.es.js +4 -4
- package/dist/components/atoms/TabButton.d.ts +10 -7
- package/dist/components/atoms/TabButton.es.js +198 -49
- package/dist/components/atoms/TabButton.es.js.map +1 -1
- package/dist/components/atoms/Tooltip.es.js +7 -7
- package/dist/components/molecules/Alert.es.js +1 -1
- package/dist/components/molecules/CustomDrawer.es.js +1 -1
- package/dist/components/molecules/Dialog.es.js +1 -1
- package/dist/components/molecules/ImagesPreview.es.js +1 -1
- package/dist/components/molecules/Pagination.es.js +18 -23
- package/dist/components/molecules/Pagination.es.js.map +1 -1
- package/dist/{composite-IA--dSel.js → composite-CH__oBQH.js} +2 -2
- package/dist/{composite-IA--dSel.js.map → composite-CH__oBQH.js.map} +1 -1
- package/dist/{composite-DnShFmi7.js → composite-Dzn8P1fl.js} +11 -11
- package/dist/{composite-DnShFmi7.js.map → composite-Dzn8P1fl.js.map} +1 -1
- package/dist/{constants-BaUKmVF_.js → constants-BzjgA7aT.js} +2 -2
- package/dist/{constants-BaUKmVF_.js.map → constants-BzjgA7aT.js.map} +1 -1
- package/dist/{element-B1vbc-LG.js → element-BI1c88Lp.js} +3 -3
- package/dist/{element-B1vbc-LG.js.map → element-BI1c88Lp.js.map} +1 -1
- package/dist/index.es.js +3 -3
- package/dist/{isElementDisabled-lq1fKien.js → isElementDisabled-CcmHYLra.js} +2 -2
- package/dist/{isElementDisabled-lq1fKien.js.map → isElementDisabled-CcmHYLra.js.map} +1 -1
- package/dist/new-components/atoms/Checkbox.es.js +4 -4
- package/dist/new-components/atoms/Popover.es.js +2 -2
- package/dist/new-components/atoms/Radio.es.js +8 -8
- package/dist/new-components/atoms/SegmentedControl.es.js +4 -4
- package/dist/new-components/atoms/Slider.es.js +6 -6
- package/dist/new-components/atoms/Toast.d.ts +1 -2
- package/dist/new-components/atoms/Toast.es.js +70 -98
- package/dist/new-components/atoms/Toast.es.js.map +1 -1
- package/dist/new-components/atoms/Toggletip.es.js +2 -2
- package/dist/style.css +1 -1
- package/dist/theme.css +1 -2
- package/dist/tokens.css +5 -5
- package/dist/{useAriaLabelledBy-CP4wKTYs.js → useAriaLabelledBy-C_Zzl94S.js} +2 -2
- package/dist/{useAriaLabelledBy-CP4wKTYs.js.map → useAriaLabelledBy-C_Zzl94S.js.map} +1 -1
- package/dist/{useBaseUiId-CYT1vFMG.js → useBaseUiId-DCE1GVlg.js} +6 -6
- package/dist/{useBaseUiId-CYT1vFMG.js.map → useBaseUiId-DCE1GVlg.js.map} +1 -1
- package/dist/{useButton-BlHadUfM.js → useButton-CtXDdeoI.js} +2 -2
- package/dist/{useButton-BlHadUfM.js.map → useButton-CtXDdeoI.js.map} +1 -1
- package/dist/{useFocus-C__7iwl1.js → useFocus-BGyXJhul.js} +6 -6
- package/dist/{useFocus-C__7iwl1.js.map → useFocus-BGyXJhul.js.map} +1 -1
- package/dist/{usePopupHandleStore-C_Vw7xcw.js → usePopupHandleStore-9hGUXtn5.js} +30 -30
- package/dist/{usePopupHandleStore-C_Vw7xcw.js.map → usePopupHandleStore-9hGUXtn5.js.map} +1 -1
- package/dist/{usePositioner-BmYVsMO_.js → usePositioner-CAWMEP8L.js} +6 -6
- package/dist/{usePositioner-BmYVsMO_.js.map → usePositioner-CAWMEP8L.js.map} +1 -1
- package/dist/{useScrollLock-By-42HSc.js → useScrollLock-QpeWQmdB.js} +6 -6
- package/dist/{useScrollLock-By-42HSc.js.map → useScrollLock-QpeWQmdB.js.map} +1 -1
- package/dist/{useSetFieldFocused-CcdG6FNp.js → useSetFieldFocused-BO2Y66f_.js} +2 -2
- package/dist/{useSetFieldFocused-CcdG6FNp.js.map → useSetFieldFocused-BO2Y66f_.js.map} +1 -1
- package/dist/{useTriggerFocusGuards-CXAhW8P6.js → useTriggerFocusGuards-Ss68N7Fe.js} +5 -5
- package/dist/{useTriggerFocusGuards-CXAhW8P6.js.map → useTriggerFocusGuards-Ss68N7Fe.js.map} +1 -1
- package/dist/utilities.css +38 -0
- package/package.json +2 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
3
|
import "../../index-DSVg79g-.js";
|
|
4
|
-
import "../../DropdownMenu-
|
|
4
|
+
import "../../DropdownMenu-B_tIHJUl.js";
|
|
5
5
|
import "./IconProvider.es.js";
|
|
6
6
|
import "../../classNames-B1XpQHle.js";
|
|
7
|
-
import { S, a, b, c, d, e, A, f, h, y, s, g, z } from "../../Select-
|
|
7
|
+
import { S, a, b, c, d, e, A, f, h, y, s, g, z } from "../../Select-OlnvlAXg.js";
|
|
8
8
|
export {
|
|
9
9
|
S as Select,
|
|
10
10
|
a as SelectContent,
|
|
@@ -5,10 +5,10 @@ import * as React from "react";
|
|
|
5
5
|
import { u as useControlled } from "../../useControlled-DMDWXIzj.js";
|
|
6
6
|
import { f as formatErrorMessage, c as useMergedRefs, u as useIsoLayoutEffect, b as useRenderElement, d as EMPTY_OBJECT } from "../../useIsoLayoutEffect-D2lpsB9D.js";
|
|
7
7
|
import { v as visuallyHiddenInput, a as visuallyHidden } from "../../visuallyHidden-B6H2X3_Y.js";
|
|
8
|
-
import { u as useBaseUiId, c as createChangeEventDetails, n as none } from "../../useBaseUiId-
|
|
9
|
-
import { f as fieldValidityMapping, u as useFormContext, a as useFieldRootContext, b as useLabelableContext, c as useSetFieldFocused, d as useLabelableId, e as useRegisterFieldControl } from "../../useSetFieldFocused-
|
|
10
|
-
import { a as useButton, d as dispatchClickWithModifiers } from "../../useButton-
|
|
11
|
-
import { u as useAriaLabelledBy } from "../../useAriaLabelledBy-
|
|
8
|
+
import { u as useBaseUiId, c as createChangeEventDetails, n as none } from "../../useBaseUiId-DCE1GVlg.js";
|
|
9
|
+
import { f as fieldValidityMapping, u as useFormContext, a as useFieldRootContext, b as useLabelableContext, c as useSetFieldFocused, d as useLabelableId, e as useRegisterFieldControl } from "../../useSetFieldFocused-BO2Y66f_.js";
|
|
10
|
+
import { a as useButton, d as dispatchClickWithModifiers } from "../../useButton-CtXDdeoI.js";
|
|
11
|
+
import { u as useAriaLabelledBy } from "../../useAriaLabelledBy-C_Zzl94S.js";
|
|
12
12
|
import { u as useValueChanged } from "../../useValueChanged-BnlOop8k.js";
|
|
13
13
|
const SwitchRootContext = /* @__PURE__ */ React.createContext(void 0);
|
|
14
14
|
if (process.env.NODE_ENV !== "production") SwitchRootContext.displayName = "SwitchRootContext";
|
|
@@ -2,22 +2,25 @@ import * as React from 'react';
|
|
|
2
2
|
import { type VariantProps } from 'class-variance-authority';
|
|
3
3
|
import { Tabs as TabsPrimitive } from '@base-ui/react/tabs';
|
|
4
4
|
import { type IconProp } from './IconProvider';
|
|
5
|
-
export type TabsVariant = 'line' | 'filled' | 'contained' | 'detached' | 'tinted';
|
|
6
|
-
export type TabsSize = 'lg' | 'default'
|
|
5
|
+
export type TabsVariant = 'line' | 'filled' | 'contained' | 'detached' | 'tinted' | 'boxed';
|
|
6
|
+
export type TabsSize = 'lg' | 'default';
|
|
7
|
+
export type TabsWidth = 'hug' | 'fill';
|
|
7
8
|
declare const tabsListVariants: (props?: ({
|
|
8
|
-
variant?: "line" | "filled" | "tinted" | "contained" | "detached" | null | undefined;
|
|
9
|
-
size?: "default" | "lg" |
|
|
9
|
+
variant?: "line" | "filled" | "tinted" | "contained" | "detached" | "boxed" | null | undefined;
|
|
10
|
+
size?: "default" | "lg" | null | undefined;
|
|
11
|
+
width?: "fill" | "hug" | null | undefined;
|
|
10
12
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
11
13
|
declare const tabsTriggerVariants: (props?: ({
|
|
12
|
-
variant?: "line" | "filled" | "tinted" | "contained" | "detached" | null | undefined;
|
|
13
|
-
size?: "default" | "lg" |
|
|
14
|
+
variant?: "line" | "filled" | "tinted" | "contained" | "detached" | "boxed" | null | undefined;
|
|
15
|
+
size?: "default" | "lg" | null | undefined;
|
|
14
16
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
15
17
|
declare function Tabs(props: TabsPrimitive.Root.Props): React.JSX.Element;
|
|
16
18
|
type TabsListProps = TabsPrimitive.List.Props & VariantProps<typeof tabsListVariants> & {
|
|
17
19
|
variant?: TabsVariant;
|
|
18
20
|
size?: TabsSize;
|
|
21
|
+
width?: TabsWidth;
|
|
19
22
|
};
|
|
20
|
-
declare function TabsList({ className, variant, size, activateOnFocus, children, ...props }: TabsListProps): React.JSX.Element;
|
|
23
|
+
declare function TabsList({ className, variant, size, width, activateOnFocus, children, ...props }: TabsListProps): React.JSX.Element;
|
|
21
24
|
type TabsTriggerProps = TabsPrimitive.Tab.Props & {
|
|
22
25
|
icon?: IconProp;
|
|
23
26
|
count?: number;
|
|
@@ -2,22 +2,23 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { c as cva } from "../../index-DSVg79g-.js";
|
|
4
4
|
import Badge from "./Badge.es.js";
|
|
5
|
+
import IconButton from "./IconButton.es.js";
|
|
5
6
|
import IconProvider, { iconFrame } from "./IconProvider.es.js";
|
|
6
7
|
import { DarkTooltip } from "./Tooltip.es.js";
|
|
7
8
|
import { c as classNames } from "../../classNames-B1XpQHle.js";
|
|
8
9
|
import { u as useControlled } from "../../useControlled-DMDWXIzj.js";
|
|
9
10
|
import { f as formatErrorMessage, u as useIsoLayoutEffect, a as useStableCallback, b as useRenderElement, E as EMPTY_ARRAY } from "../../useIsoLayoutEffect-D2lpsB9D.js";
|
|
10
11
|
import { C as CompositeList, u as useCompositeListItem } from "../../useCompositeListItem-DlAKWsHE.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-
|
|
12
|
+
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-DCE1GVlg.js";
|
|
12
13
|
import { i as inertValue } from "../../inertValue-C1Ml1s55.js";
|
|
13
14
|
import { u as useTransitionStatus, a as useOpenChangeComplete, t as transitionStatusMapping } from "../../useTransitionStatus-CHrs3i5F.js";
|
|
14
|
-
import { A as ACTIVE_COMPOSITE_ITEM, C as CompositeRoot } from "../../CompositeRoot-
|
|
15
|
-
import { P as PrehydrationScript, s as script } from "../../PrehydrationScript-
|
|
16
|
-
import { r as round } from "../../composite-
|
|
17
|
-
import { o as ownerDocument } from "../../element-
|
|
18
|
-
import { u as useCompositeItem } from "../../isElementDisabled-
|
|
19
|
-
import { u as useCompositeRootContext, a as useButton } from "../../useButton-
|
|
20
|
-
import { c as contains, a as activeElement } from "../../constants-
|
|
15
|
+
import { A as ACTIVE_COMPOSITE_ITEM, C as CompositeRoot } from "../../CompositeRoot-CR4V84Em.js";
|
|
16
|
+
import { P as PrehydrationScript, s as script } from "../../PrehydrationScript-BfRb7l5u.js";
|
|
17
|
+
import { r as round } from "../../composite-Dzn8P1fl.js";
|
|
18
|
+
import { o as ownerDocument } from "../../element-BI1c88Lp.js";
|
|
19
|
+
import { u as useCompositeItem } from "../../isElementDisabled-CcmHYLra.js";
|
|
20
|
+
import { u as useCompositeRootContext, a as useButton } from "../../useButton-CtXDdeoI.js";
|
|
21
|
+
import { c as contains, a as activeElement } from "../../constants-BzjgA7aT.js";
|
|
21
22
|
function getCssDimensions(element) {
|
|
22
23
|
const css = getComputedStyle(element);
|
|
23
24
|
let width = parseFloat(css.width) || 0;
|
|
@@ -818,36 +819,41 @@ function formatCount(count) {
|
|
|
818
819
|
const tabsListVariants = cva("relative inline-flex items-stretch data-[orientation=vertical]:flex-col", {
|
|
819
820
|
variants: {
|
|
820
821
|
variant: {
|
|
821
|
-
|
|
822
|
-
|
|
822
|
+
// Real border (not ::after) so trigger hover fills cannot cover the baseline.
|
|
823
|
+
line: "gap-0 border-b border-border-subtle data-[orientation=vertical]:border-b-0 data-[orientation=vertical]:border-l",
|
|
824
|
+
filled: "gap-0 border-b border-border-subtle data-[orientation=vertical]:border-b-0 data-[orientation=vertical]:border-l",
|
|
823
825
|
contained: "gap-0 [&>[data-slot=tabs-trigger]+[data-slot=tabs-trigger]]:-ml-px",
|
|
824
826
|
detached: "gap-space-2",
|
|
825
|
-
tinted: "gap-0"
|
|
827
|
+
tinted: "gap-0",
|
|
828
|
+
boxed: 'gap-0 [&>[data-slot=tabs-trigger]+[data-slot=tabs-trigger]]:-ml-px after:pointer-events-none after:min-w-0 after:flex-1 after:self-stretch after:border-b after:border-border-subtle after:content-[""]'
|
|
826
829
|
},
|
|
827
830
|
size: {
|
|
828
831
|
lg: "",
|
|
829
|
-
default: ""
|
|
830
|
-
|
|
832
|
+
default: ""
|
|
833
|
+
},
|
|
834
|
+
width: {
|
|
835
|
+
hug: "",
|
|
836
|
+
fill: "flex min-w-full data-[orientation=horizontal]:w-max [&>[data-slot=tabs-trigger]]:flex-1"
|
|
831
837
|
}
|
|
832
838
|
},
|
|
833
839
|
defaultVariants: {
|
|
834
840
|
variant: "line",
|
|
835
|
-
size: "default"
|
|
841
|
+
size: "default",
|
|
842
|
+
width: "hug"
|
|
836
843
|
}
|
|
837
844
|
});
|
|
838
845
|
const tabIndicatorPseudo = "after:pointer-events-none after:absolute after:bg-tabs-indicator-background-selected after:content-[''] after:opacity-0 data-active:after:opacity-100";
|
|
839
846
|
const tabsTriggerVariants = cva(
|
|
840
847
|
[
|
|
841
|
-
|
|
842
|
-
"group relative z-1 data-active:z-10 focus-visible:z-20 inline-flex shrink-0 items-center justify-center transition-colors",
|
|
848
|
+
"group relative data-active:z-10 focus-visible:z-20 inline-flex shrink-0 cursor-pointer items-center justify-center transition-colors",
|
|
843
849
|
"text-text-secondary not-data-active:hover:text-text-primary data-active:text-tabs-text-selected",
|
|
844
|
-
"
|
|
845
|
-
"
|
|
846
|
-
"data-disabled:pointer-events-none data-disabled:opacity-50"
|
|
850
|
+
"focus-ring focus-visible:outline-offset-[-0.125rem]",
|
|
851
|
+
"data-disabled:pointer-events-none data-disabled:cursor-not-allowed data-disabled:opacity-50"
|
|
847
852
|
],
|
|
848
853
|
{
|
|
849
854
|
variants: {
|
|
850
855
|
variant: {
|
|
856
|
+
// Line / Filled: hover text only — hover fill covered the list baseline.
|
|
851
857
|
line: [
|
|
852
858
|
"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"
|
|
853
859
|
],
|
|
@@ -855,40 +861,106 @@ const tabsTriggerVariants = cva(
|
|
|
855
861
|
"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",
|
|
856
862
|
"data-active:bg-tabs-background-selected",
|
|
857
863
|
tabIndicatorPseudo,
|
|
858
|
-
|
|
859
|
-
"
|
|
864
|
+
// Overlap the list border so the selected bar replaces the baseline under this tab.
|
|
865
|
+
"after:-bottom-px after:left-0 after:right-0 after:h-0.5",
|
|
866
|
+
"data-[orientation=vertical]:after:bottom-0 data-[orientation=vertical]:after:-left-px 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"
|
|
860
867
|
],
|
|
861
868
|
contained: [
|
|
862
|
-
|
|
863
|
-
"
|
|
869
|
+
// z-1 raises tabs above -ml-px neighbors (same pattern as ButtonGroup).
|
|
870
|
+
"z-1 border border-border-subtle bg-tabs-contained-background not-data-active:hover:bg-tabs-background-hover",
|
|
871
|
+
// Figma selected: no bottom border — transparent still leaves a 1px hairline under the indicator.
|
|
872
|
+
"data-active:border-b-0 data-active:bg-tabs-contained-background-selected",
|
|
864
873
|
tabIndicatorPseudo,
|
|
865
874
|
"after:bottom-0 after:-left-px after:-right-px after:h-0.5"
|
|
866
875
|
],
|
|
867
876
|
detached: [
|
|
868
|
-
"rounded-t-md border border-border-subtle bg-tabs-contained-background",
|
|
869
|
-
"data-active:border-b-
|
|
877
|
+
"z-1 rounded-t-md border border-border-subtle bg-tabs-contained-background not-data-active:hover:bg-tabs-background-hover",
|
|
878
|
+
"data-active:border-b-0 data-active:bg-tabs-contained-background-selected",
|
|
870
879
|
tabIndicatorPseudo,
|
|
871
880
|
"after:bottom-0 after:-left-px after:-right-px after:h-0.5"
|
|
872
881
|
],
|
|
873
882
|
tinted: [
|
|
874
|
-
"border-b border-border-subtle",
|
|
875
|
-
"data-active:border data-active:border-b-
|
|
883
|
+
"z-1 border-b border-border-subtle not-data-active:hover:bg-tabs-background-hover",
|
|
884
|
+
"data-active:border data-active:border-b-0 data-active:border-border-subtle data-active:bg-tabs-background-selected",
|
|
876
885
|
tabIndicatorPseudo,
|
|
877
886
|
"after:bottom-0 after:-left-px after:-right-px after:h-0.5"
|
|
887
|
+
],
|
|
888
|
+
boxed: [
|
|
889
|
+
"z-1 border-x border-b border-border-subtle bg-tabs-contained-background not-data-active:hover:bg-tabs-background-hover",
|
|
890
|
+
"data-active:border-b-0 data-active:bg-tabs-contained-background-selected",
|
|
891
|
+
tabIndicatorPseudo,
|
|
892
|
+
"after:top-0 after:-left-px after:-right-px after:h-[0.1875rem]"
|
|
878
893
|
]
|
|
879
894
|
},
|
|
880
895
|
size: {
|
|
881
|
-
lg: "
|
|
882
|
-
default: "
|
|
883
|
-
md: "h-6 gap-space-4 text-label-sm"
|
|
896
|
+
lg: "",
|
|
897
|
+
default: ""
|
|
884
898
|
}
|
|
885
899
|
},
|
|
886
900
|
compoundVariants: [
|
|
887
|
-
|
|
888
|
-
{
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
901
|
+
// Line / Filled — horizontal
|
|
902
|
+
{
|
|
903
|
+
variant: "line",
|
|
904
|
+
size: "lg",
|
|
905
|
+
class: "h-12 gap-space-8 px-space-16 text-heading-sm data-[orientation=vertical]:h-10 data-[orientation=vertical]:gap-space-6 data-[orientation=vertical]:px-space-12"
|
|
906
|
+
},
|
|
907
|
+
{
|
|
908
|
+
variant: "line",
|
|
909
|
+
size: "default",
|
|
910
|
+
class: "h-10 gap-space-8 px-space-16 text-label-md data-[orientation=vertical]:h-8 data-[orientation=vertical]:gap-space-6 data-[orientation=vertical]:px-space-12"
|
|
911
|
+
},
|
|
912
|
+
{
|
|
913
|
+
variant: "filled",
|
|
914
|
+
size: "lg",
|
|
915
|
+
class: "h-12 gap-space-8 px-space-16 text-heading-sm data-[orientation=vertical]:h-10 data-[orientation=vertical]:gap-space-6 data-[orientation=vertical]:px-space-12"
|
|
916
|
+
},
|
|
917
|
+
{
|
|
918
|
+
variant: "filled",
|
|
919
|
+
size: "default",
|
|
920
|
+
class: "h-10 gap-space-8 px-space-16 text-label-md data-[orientation=vertical]:h-8 data-[orientation=vertical]:gap-space-6 data-[orientation=vertical]:px-space-12"
|
|
921
|
+
},
|
|
922
|
+
// Contained family — horizontal only
|
|
923
|
+
{
|
|
924
|
+
variant: "contained",
|
|
925
|
+
size: "lg",
|
|
926
|
+
class: "h-10 gap-space-8 px-space-16 text-heading-sm"
|
|
927
|
+
},
|
|
928
|
+
{
|
|
929
|
+
variant: "contained",
|
|
930
|
+
size: "default",
|
|
931
|
+
class: "h-8 gap-space-8 px-space-16 text-label-md"
|
|
932
|
+
},
|
|
933
|
+
{
|
|
934
|
+
variant: "detached",
|
|
935
|
+
size: "lg",
|
|
936
|
+
class: "h-10 gap-space-8 px-space-16 text-heading-sm"
|
|
937
|
+
},
|
|
938
|
+
{
|
|
939
|
+
variant: "detached",
|
|
940
|
+
size: "default",
|
|
941
|
+
class: "h-8 gap-space-8 px-space-16 text-label-md"
|
|
942
|
+
},
|
|
943
|
+
{
|
|
944
|
+
variant: "tinted",
|
|
945
|
+
size: "lg",
|
|
946
|
+
class: "h-10 gap-space-8 px-space-16 text-heading-sm"
|
|
947
|
+
},
|
|
948
|
+
{
|
|
949
|
+
variant: "tinted",
|
|
950
|
+
size: "default",
|
|
951
|
+
class: "h-8 gap-space-8 px-space-16 text-label-md"
|
|
952
|
+
},
|
|
953
|
+
// Boxed — lg only in Figma; same metrics at every size
|
|
954
|
+
{
|
|
955
|
+
variant: "boxed",
|
|
956
|
+
size: "lg",
|
|
957
|
+
class: "h-10 gap-space-8 px-space-16 text-label-md"
|
|
958
|
+
},
|
|
959
|
+
{
|
|
960
|
+
variant: "boxed",
|
|
961
|
+
size: "default",
|
|
962
|
+
class: "h-10 gap-space-8 px-space-16 text-label-md"
|
|
963
|
+
}
|
|
892
964
|
],
|
|
893
965
|
defaultVariants: {
|
|
894
966
|
variant: "line",
|
|
@@ -901,30 +973,108 @@ function Tabs(props) {
|
|
|
901
973
|
}
|
|
902
974
|
const tabsIndicatorClassName = classNames(
|
|
903
975
|
"pointer-events-none absolute z-10 bg-tabs-indicator-background-selected transition-[translate,width,height] duration-200 ease-in-out motion-reduce:transition-none",
|
|
904
|
-
|
|
905
|
-
"data-[orientation=
|
|
976
|
+
// -bottom-px / -left-px overlaps the list border so the selected indicator replaces the baseline.
|
|
977
|
+
"data-[orientation=horizontal]:-bottom-px 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",
|
|
978
|
+
"data-[orientation=vertical]:top-0 data-[orientation=vertical]:-left-px 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"
|
|
906
979
|
);
|
|
907
980
|
function TabsList2({
|
|
908
981
|
className,
|
|
909
982
|
variant = "line",
|
|
910
983
|
size = "default",
|
|
984
|
+
width = "hug",
|
|
911
985
|
activateOnFocus = true,
|
|
912
986
|
children,
|
|
913
987
|
...props
|
|
914
988
|
}) {
|
|
915
989
|
const contextValue = React.useMemo(() => ({ variant, size }), [variant, size]);
|
|
990
|
+
const viewportRef = React.useRef(null);
|
|
991
|
+
const [isOverflowing, setIsOverflowing] = React.useState(false);
|
|
992
|
+
const [canScrollPrev, setCanScrollPrev] = React.useState(false);
|
|
993
|
+
const [canScrollNext, setCanScrollNext] = React.useState(false);
|
|
994
|
+
const updateScrollState = React.useCallback(() => {
|
|
995
|
+
const viewport = viewportRef.current;
|
|
996
|
+
if (!viewport) return;
|
|
997
|
+
const { scrollLeft, scrollWidth, clientWidth } = viewport;
|
|
998
|
+
setIsOverflowing(scrollWidth > clientWidth + 1);
|
|
999
|
+
setCanScrollPrev(scrollLeft > 1);
|
|
1000
|
+
setCanScrollNext(scrollLeft + clientWidth < scrollWidth - 1);
|
|
1001
|
+
}, []);
|
|
1002
|
+
React.useEffect(() => {
|
|
1003
|
+
const viewport = viewportRef.current;
|
|
1004
|
+
if (!viewport) return;
|
|
1005
|
+
updateScrollState();
|
|
1006
|
+
viewport.addEventListener("scroll", updateScrollState, { passive: true });
|
|
1007
|
+
const observer = new ResizeObserver(updateScrollState);
|
|
1008
|
+
observer.observe(viewport);
|
|
1009
|
+
const list = viewport.firstElementChild;
|
|
1010
|
+
if (list) observer.observe(list);
|
|
1011
|
+
return () => {
|
|
1012
|
+
viewport.removeEventListener("scroll", updateScrollState);
|
|
1013
|
+
observer.disconnect();
|
|
1014
|
+
};
|
|
1015
|
+
}, [updateScrollState]);
|
|
1016
|
+
const scrollByHalf = (direction) => {
|
|
1017
|
+
const viewport = viewportRef.current;
|
|
1018
|
+
if (!viewport) return;
|
|
1019
|
+
viewport.scrollBy({ left: direction * (viewport.clientWidth / 2), behavior: "smooth" });
|
|
1020
|
+
};
|
|
916
1021
|
return /* @__PURE__ */ jsx(TabsListContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxs(
|
|
917
|
-
|
|
1022
|
+
"div",
|
|
918
1023
|
{
|
|
919
|
-
"data-slot": "tabs-
|
|
920
|
-
"
|
|
921
|
-
"data-size": size,
|
|
922
|
-
activateOnFocus,
|
|
923
|
-
className: classNames(tabsListVariants({ variant, size }), className),
|
|
924
|
-
...props,
|
|
1024
|
+
"data-slot": "tabs-scroll",
|
|
1025
|
+
className: classNames("inline-flex max-w-full items-center", width === "fill" && "flex w-full"),
|
|
925
1026
|
children: [
|
|
926
|
-
|
|
927
|
-
|
|
1027
|
+
isOverflowing ? /* @__PURE__ */ jsx(
|
|
1028
|
+
IconButton,
|
|
1029
|
+
{
|
|
1030
|
+
variant: "ghost",
|
|
1031
|
+
size: "md",
|
|
1032
|
+
icon: "chevron-left",
|
|
1033
|
+
"aria-label": "Previous tabs",
|
|
1034
|
+
tooltip: "Previous tabs",
|
|
1035
|
+
disabled: !canScrollPrev,
|
|
1036
|
+
onClick: () => scrollByHalf(-1)
|
|
1037
|
+
}
|
|
1038
|
+
) : null,
|
|
1039
|
+
/* @__PURE__ */ jsx(
|
|
1040
|
+
"div",
|
|
1041
|
+
{
|
|
1042
|
+
ref: viewportRef,
|
|
1043
|
+
"data-slot": "tabs-scroll-viewport",
|
|
1044
|
+
className: classNames(
|
|
1045
|
+
"min-w-0 overflow-x-auto [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
|
|
1046
|
+
width === "fill" && "flex-1"
|
|
1047
|
+
),
|
|
1048
|
+
children: /* @__PURE__ */ jsxs(
|
|
1049
|
+
TabsList$1,
|
|
1050
|
+
{
|
|
1051
|
+
"data-slot": "tabs-list",
|
|
1052
|
+
"data-variant": variant,
|
|
1053
|
+
"data-size": size,
|
|
1054
|
+
"data-width": width,
|
|
1055
|
+
activateOnFocus,
|
|
1056
|
+
className: classNames(tabsListVariants({ variant, size, width }), className),
|
|
1057
|
+
...props,
|
|
1058
|
+
children: [
|
|
1059
|
+
children,
|
|
1060
|
+
variant === "line" ? /* @__PURE__ */ jsx(TabsIndicator, { "data-slot": "tabs-indicator", className: tabsIndicatorClassName }) : null
|
|
1061
|
+
]
|
|
1062
|
+
}
|
|
1063
|
+
)
|
|
1064
|
+
}
|
|
1065
|
+
),
|
|
1066
|
+
isOverflowing ? /* @__PURE__ */ jsx(
|
|
1067
|
+
IconButton,
|
|
1068
|
+
{
|
|
1069
|
+
variant: "ghost",
|
|
1070
|
+
size: "md",
|
|
1071
|
+
icon: "chevron-right",
|
|
1072
|
+
"aria-label": "Next tabs",
|
|
1073
|
+
tooltip: "Next tabs",
|
|
1074
|
+
disabled: !canScrollNext,
|
|
1075
|
+
onClick: () => scrollByHalf(1)
|
|
1076
|
+
}
|
|
1077
|
+
) : null
|
|
928
1078
|
]
|
|
929
1079
|
}
|
|
930
1080
|
) });
|
|
@@ -944,7 +1094,6 @@ function TabsTrigger({
|
|
|
944
1094
|
const labelText = typeof children === "string" || typeof children === "number" ? String(children) : void 0;
|
|
945
1095
|
const baseName = ariaLabel ?? labelText;
|
|
946
1096
|
const resolvedAriaLabel = baseName != null && countDisplay != null ? `${baseName}, ${countDisplay}` : ariaLabel;
|
|
947
|
-
const iconKey = size === "md" ? "12" : "16";
|
|
948
1097
|
const badgeSize = size === "lg" ? "md" : "sm";
|
|
949
1098
|
return /* @__PURE__ */ jsxs(
|
|
950
1099
|
TabsTab,
|
|
@@ -961,9 +1110,9 @@ function TabsTrigger({
|
|
|
961
1110
|
"aria-hidden": true,
|
|
962
1111
|
className: classNames(
|
|
963
1112
|
"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",
|
|
964
|
-
iconFrame[
|
|
1113
|
+
iconFrame["16"].frameClass
|
|
965
1114
|
),
|
|
966
|
-
children: /* @__PURE__ */ jsx(IconProvider, { icon, size: iconSize ?? iconFrame[
|
|
1115
|
+
children: /* @__PURE__ */ jsx(IconProvider, { icon, size: iconSize ?? iconFrame["16"].glyph })
|
|
967
1116
|
}
|
|
968
1117
|
) : null,
|
|
969
1118
|
children != null && children !== false ? /* @__PURE__ */ jsx("span", { "data-slot": "tabs-trigger-label", className: classNames(textClassName), children }) : null,
|