@tinybigui/react 0.11.1 → 0.12.0
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/README.md +17 -17
- package/dist/index.cjs +214 -189
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +95 -64
- package/dist/index.d.ts +95 -64
- package/dist/index.js +214 -189
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3667,10 +3667,9 @@ var Tabs = forwardRef(
|
|
|
3667
3667
|
Tabs.displayName = "Tabs";
|
|
3668
3668
|
var tabListVariants = cva(
|
|
3669
3669
|
[
|
|
3670
|
-
// Base classes
|
|
3671
3670
|
"relative flex",
|
|
3672
3671
|
"bg-surface",
|
|
3673
|
-
//
|
|
3672
|
+
// MD3: 1dp bottom divider in outline-variant color
|
|
3674
3673
|
"border-b border-outline-variant"
|
|
3675
3674
|
],
|
|
3676
3675
|
{
|
|
@@ -3687,108 +3686,110 @@ var tabListVariants = cva(
|
|
|
3687
3686
|
);
|
|
3688
3687
|
var tabVariants = cva(
|
|
3689
3688
|
[
|
|
3690
|
-
//
|
|
3689
|
+
// Layout
|
|
3691
3690
|
"relative flex flex-col items-center justify-center",
|
|
3692
3691
|
"min-h-12 px-4",
|
|
3693
3692
|
"cursor-pointer select-none",
|
|
3693
|
+
// Clip state layer to tab boundary
|
|
3694
3694
|
"overflow-hidden",
|
|
3695
|
-
//
|
|
3696
|
-
"text-
|
|
3697
|
-
//
|
|
3698
|
-
"transition-colors duration-
|
|
3699
|
-
//
|
|
3695
|
+
// MD3 Title Small typography
|
|
3696
|
+
"text-title-small font-medium tracking-[0.1px]",
|
|
3697
|
+
// Effects transition for color changes (not spatial)
|
|
3698
|
+
"transition-colors duration-spring-standard-fast-effects ease-spring-standard-fast-effects",
|
|
3699
|
+
// Remove default button focus outline — handled via group-data-[focus-visible]/tab
|
|
3700
3700
|
"focus-visible:outline-none",
|
|
3701
|
-
//
|
|
3702
|
-
"
|
|
3703
|
-
|
|
3704
|
-
"
|
|
3705
|
-
"active:before:opacity-12",
|
|
3706
|
-
"focus-visible:before:opacity-12"
|
|
3701
|
+
// Disabled — self-targeting data-[x]: selectors (not group)
|
|
3702
|
+
"data-[disabled]:opacity-38 data-[disabled]:cursor-not-allowed data-[disabled]:pointer-events-none",
|
|
3703
|
+
// Icon+label stacked: 64dp height
|
|
3704
|
+
"data-[with-icon]:data-[with-label]:min-h-16"
|
|
3707
3705
|
],
|
|
3708
3706
|
{
|
|
3709
3707
|
variants: {
|
|
3710
3708
|
/**
|
|
3711
|
-
*
|
|
3709
|
+
* Design-time variant: affects active label/icon color and state-layer color.
|
|
3710
|
+
* primary: active → text-primary
|
|
3711
|
+
* secondary: active → text-on-surface
|
|
3712
3712
|
*/
|
|
3713
3713
|
variant: {
|
|
3714
|
-
primary:
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
disabled: {
|
|
3728
|
-
true: "opacity-38 cursor-not-allowed pointer-events-none",
|
|
3729
|
-
false: ""
|
|
3714
|
+
primary: [
|
|
3715
|
+
// Inactive: on-surface-variant (base)
|
|
3716
|
+
"text-on-surface-variant",
|
|
3717
|
+
// Active: text-primary
|
|
3718
|
+
"group-data-[selected]/tab:text-primary"
|
|
3719
|
+
// Disabled active: on-surface/38 inherits from opacity-38 on root
|
|
3720
|
+
],
|
|
3721
|
+
secondary: [
|
|
3722
|
+
// Inactive: on-surface-variant (base)
|
|
3723
|
+
"text-on-surface-variant",
|
|
3724
|
+
// Active: on-surface
|
|
3725
|
+
"group-data-[selected]/tab:text-on-surface"
|
|
3726
|
+
]
|
|
3730
3727
|
},
|
|
3731
3728
|
/**
|
|
3732
|
-
*
|
|
3729
|
+
* Design-time variant: affects flex sizing in the tab row.
|
|
3733
3730
|
*/
|
|
3734
3731
|
layout: {
|
|
3735
3732
|
fixed: "flex-1",
|
|
3736
3733
|
scrollable: "min-w-[90px] shrink-0"
|
|
3737
3734
|
}
|
|
3738
3735
|
},
|
|
3739
|
-
compoundVariants
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
variant: "primary",
|
|
3743
|
-
selected: true,
|
|
3744
|
-
disabled: false,
|
|
3745
|
-
className: "text-primary"
|
|
3746
|
-
},
|
|
3747
|
-
// Primary + unselected
|
|
3748
|
-
{
|
|
3749
|
-
variant: "primary",
|
|
3750
|
-
selected: false,
|
|
3751
|
-
disabled: false,
|
|
3752
|
-
className: "text-on-surface-variant"
|
|
3753
|
-
},
|
|
3754
|
-
// Secondary + selected
|
|
3755
|
-
{
|
|
3756
|
-
variant: "secondary",
|
|
3757
|
-
selected: true,
|
|
3758
|
-
disabled: false,
|
|
3759
|
-
className: "text-on-surface"
|
|
3760
|
-
},
|
|
3761
|
-
// Secondary + unselected
|
|
3762
|
-
{
|
|
3763
|
-
variant: "secondary",
|
|
3764
|
-
selected: false,
|
|
3765
|
-
disabled: false,
|
|
3766
|
-
className: "text-on-surface-variant"
|
|
3767
|
-
}
|
|
3768
|
-
],
|
|
3736
|
+
// compoundVariants intentionally empty — state combinations are handled
|
|
3737
|
+
// via group-data-[selected]/tab:group-data-[...]/tab: in state slot
|
|
3738
|
+
compoundVariants: [],
|
|
3769
3739
|
defaultVariants: {
|
|
3770
3740
|
variant: "primary",
|
|
3771
|
-
selected: false,
|
|
3772
|
-
disabled: false,
|
|
3773
3741
|
layout: "fixed"
|
|
3774
3742
|
}
|
|
3775
3743
|
}
|
|
3776
3744
|
);
|
|
3745
|
+
var tabStateLayerVariants = cva(
|
|
3746
|
+
[
|
|
3747
|
+
"absolute inset-0 pointer-events-none opacity-0",
|
|
3748
|
+
// Effects transition for opacity — no spatial overshoot
|
|
3749
|
+
"transition-opacity duration-spring-standard-fast-effects ease-spring-standard-fast-effects",
|
|
3750
|
+
// Hover: 8%
|
|
3751
|
+
"group-data-[hovered]/tab:opacity-8",
|
|
3752
|
+
// Focus: 10%
|
|
3753
|
+
"group-data-[focus-visible]/tab:opacity-10",
|
|
3754
|
+
// Pressed: 10%, doubled selector beats hover at equal cascade position
|
|
3755
|
+
"group-data-[pressed]/tab:group-data-[pressed]/tab:opacity-10",
|
|
3756
|
+
// No state layer when disabled
|
|
3757
|
+
"group-data-[disabled]/tab:hidden"
|
|
3758
|
+
],
|
|
3759
|
+
{
|
|
3760
|
+
variants: {
|
|
3761
|
+
variant: {
|
|
3762
|
+
primary: [
|
|
3763
|
+
// Inactive state-layer color
|
|
3764
|
+
"bg-on-surface",
|
|
3765
|
+
// Active state-layer color (higher cascade position wins over base bg-on-surface)
|
|
3766
|
+
"group-data-[selected]/tab:bg-primary"
|
|
3767
|
+
],
|
|
3768
|
+
secondary: [
|
|
3769
|
+
// Secondary: always on-surface
|
|
3770
|
+
"bg-on-surface"
|
|
3771
|
+
]
|
|
3772
|
+
}
|
|
3773
|
+
},
|
|
3774
|
+
defaultVariants: {
|
|
3775
|
+
variant: "primary"
|
|
3776
|
+
}
|
|
3777
|
+
}
|
|
3778
|
+
);
|
|
3777
3779
|
var tabIndicatorVariants = cva(
|
|
3778
3780
|
[
|
|
3779
|
-
// Base: absolutely positioned at bottom
|
|
3780
3781
|
"absolute bottom-0 left-0",
|
|
3781
3782
|
"pointer-events-none",
|
|
3782
|
-
//
|
|
3783
|
+
// Spatial spring — indicator position/width are spatial (not effects)
|
|
3783
3784
|
"transition-[left,width]",
|
|
3784
|
-
"duration-
|
|
3785
|
-
"ease-
|
|
3785
|
+
"duration-spring-standard-default-spatial",
|
|
3786
|
+
"ease-spring-standard-default-spatial"
|
|
3786
3787
|
],
|
|
3787
3788
|
{
|
|
3788
3789
|
variants: {
|
|
3789
3790
|
variant: {
|
|
3790
|
-
primary: ["h-[3px]", "bg-primary", "rounded-
|
|
3791
|
-
secondary: ["h-[2px]", "bg-
|
|
3791
|
+
primary: ["h-[3px]", "bg-primary", "rounded-tl-sm rounded-tr-sm"],
|
|
3792
|
+
secondary: ["h-[2px]", "bg-primary"]
|
|
3792
3793
|
}
|
|
3793
3794
|
},
|
|
3794
3795
|
defaultVariants: {
|
|
@@ -3796,20 +3797,28 @@ var tabIndicatorVariants = cva(
|
|
|
3796
3797
|
}
|
|
3797
3798
|
}
|
|
3798
3799
|
);
|
|
3799
|
-
var
|
|
3800
|
+
var tabIconVariants = cva(
|
|
3800
3801
|
[
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
"
|
|
3802
|
+
"relative inline-flex items-center justify-center",
|
|
3803
|
+
// MD3 tab icon size: 24dp
|
|
3804
|
+
"size-6",
|
|
3805
|
+
// Effects transition for color (inherited from parent, guard here too)
|
|
3806
|
+
"transition-colors duration-spring-standard-fast-effects ease-spring-standard-fast-effects"
|
|
3804
3807
|
],
|
|
3805
3808
|
{
|
|
3806
|
-
variants: {
|
|
3807
|
-
|
|
3809
|
+
variants: {
|
|
3810
|
+
hasLabel: {
|
|
3811
|
+
true: "mb-1",
|
|
3812
|
+
false: ""
|
|
3813
|
+
}
|
|
3814
|
+
},
|
|
3815
|
+
defaultVariants: {
|
|
3816
|
+
hasLabel: false
|
|
3817
|
+
}
|
|
3808
3818
|
}
|
|
3809
3819
|
);
|
|
3810
3820
|
var tabBadgeVariants = cva(
|
|
3811
3821
|
[
|
|
3812
|
-
// Base badge
|
|
3813
3822
|
"absolute",
|
|
3814
3823
|
"inline-flex items-center justify-center",
|
|
3815
3824
|
"bg-error text-on-error",
|
|
@@ -3819,7 +3828,7 @@ var tabBadgeVariants = cva(
|
|
|
3819
3828
|
{
|
|
3820
3829
|
variants: {
|
|
3821
3830
|
type: {
|
|
3822
|
-
dot: ["top-
|
|
3831
|
+
dot: ["top-0 right-0", "w-1.5 h-1.5", "rounded-full"],
|
|
3823
3832
|
count: ["-top-1 -right-1", "min-w-[16px] h-4", "px-1", "rounded-full", "text-[11px]"]
|
|
3824
3833
|
}
|
|
3825
3834
|
},
|
|
@@ -3828,20 +3837,10 @@ var tabBadgeVariants = cva(
|
|
|
3828
3837
|
}
|
|
3829
3838
|
}
|
|
3830
3839
|
);
|
|
3831
|
-
var
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
hasLabel: {
|
|
3836
|
-
true: "mb-1",
|
|
3837
|
-
false: ""
|
|
3838
|
-
}
|
|
3839
|
-
},
|
|
3840
|
-
defaultVariants: {
|
|
3841
|
-
hasLabel: false
|
|
3842
|
-
}
|
|
3843
|
-
}
|
|
3844
|
-
);
|
|
3840
|
+
var tabPanelVariants = cva([
|
|
3841
|
+
"outline-none",
|
|
3842
|
+
"focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2"
|
|
3843
|
+
]);
|
|
3845
3844
|
var TabList = forwardRef(
|
|
3846
3845
|
({ children, className }, forwardedRef) => {
|
|
3847
3846
|
const { state } = useHeadlessTabsContext("TabList");
|
|
@@ -3920,18 +3919,41 @@ var TabList = forwardRef(
|
|
|
3920
3919
|
const selectedTab = container.querySelector('[aria-selected="true"]');
|
|
3921
3920
|
if (!selectedTab) return;
|
|
3922
3921
|
const containerRect = container.getBoundingClientRect();
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3922
|
+
if (variant === "primary") {
|
|
3923
|
+
const contentEl = selectedTab.querySelector("[data-tab-content]");
|
|
3924
|
+
if (!contentEl) return;
|
|
3925
|
+
const contentRect = contentEl.getBoundingClientRect();
|
|
3926
|
+
const newLeft = contentRect.left - containerRect.left + container.scrollLeft;
|
|
3927
|
+
const newWidth = contentRect.width;
|
|
3928
|
+
setIndicatorStyle((prev) => {
|
|
3929
|
+
if (prev.left === newLeft && prev.width === newWidth) return prev;
|
|
3930
|
+
return { left: newLeft, width: newWidth };
|
|
3931
|
+
});
|
|
3932
|
+
} else {
|
|
3933
|
+
const tabRect = selectedTab.getBoundingClientRect();
|
|
3934
|
+
const newLeft = tabRect.left - containerRect.left + container.scrollLeft;
|
|
3935
|
+
const newWidth = tabRect.width;
|
|
3936
|
+
setIndicatorStyle((prev) => {
|
|
3937
|
+
if (prev.left === newLeft && prev.width === newWidth) return prev;
|
|
3938
|
+
return { left: newLeft, width: newWidth };
|
|
3939
|
+
});
|
|
3940
|
+
}
|
|
3930
3941
|
setIndicatorReady(true);
|
|
3931
|
-
}, [ref]);
|
|
3942
|
+
}, [ref, variant]);
|
|
3932
3943
|
useLayoutEffect(() => {
|
|
3933
3944
|
updateIndicator();
|
|
3934
3945
|
}, [state.selectedKey, updateIndicator]);
|
|
3946
|
+
useEffect(() => {
|
|
3947
|
+
const container = ref.current;
|
|
3948
|
+
if (!container || typeof ResizeObserver === "undefined") return;
|
|
3949
|
+
const observer = new ResizeObserver(() => {
|
|
3950
|
+
updateIndicator();
|
|
3951
|
+
});
|
|
3952
|
+
observer.observe(container);
|
|
3953
|
+
return () => {
|
|
3954
|
+
observer.disconnect();
|
|
3955
|
+
};
|
|
3956
|
+
}, [ref, updateIndicator]);
|
|
3935
3957
|
const mergedTabListProps = { ...tabListProps, onKeyDown: handleKeyDown };
|
|
3936
3958
|
return /* @__PURE__ */ jsxs("div", { ...mergedTabListProps, ref, className: cn(tabListVariants({ layout }), className), children: [
|
|
3937
3959
|
children,
|
|
@@ -3946,7 +3968,6 @@ var TabList = forwardRef(
|
|
|
3946
3968
|
!indicatorReady && "opacity-0"
|
|
3947
3969
|
),
|
|
3948
3970
|
style: {
|
|
3949
|
-
// Dynamic left/width values from DOM measurements
|
|
3950
3971
|
left: `${indicatorStyle.left}px`,
|
|
3951
3972
|
width: `${indicatorStyle.width}px`
|
|
3952
3973
|
}
|
|
@@ -3974,10 +3995,12 @@ var Tab = forwardRef(
|
|
|
3974
3995
|
const {
|
|
3975
3996
|
tabProps,
|
|
3976
3997
|
isSelected,
|
|
3977
|
-
isDisabled: ariaIsDisabled
|
|
3998
|
+
isDisabled: ariaIsDisabled,
|
|
3999
|
+
isPressed
|
|
3978
4000
|
} = useTab({ key: id, isDisabled }, state, ref);
|
|
3979
4001
|
const { isFocusVisible, focusProps } = useFocusRing();
|
|
3980
4002
|
const finalIsDisabled = isDisabled || ariaIsDisabled;
|
|
4003
|
+
const { isHovered, hoverProps } = useHover({ isDisabled: finalIsDisabled });
|
|
3981
4004
|
const { onMouseDown: handleRipple, ripples } = useRipple({
|
|
3982
4005
|
disabled: finalIsDisabled || disableRipple
|
|
3983
4006
|
});
|
|
@@ -3991,7 +4014,7 @@ var Tab = forwardRef(
|
|
|
3991
4014
|
state.selectionManager.setFocusedKey(id);
|
|
3992
4015
|
}
|
|
3993
4016
|
}, [state.selectionManager, id, finalIsDisabled]);
|
|
3994
|
-
const mergedProps = mergeProps(tabProps, focusProps, {
|
|
4017
|
+
const mergedProps = mergeProps(tabProps, focusProps, hoverProps, {
|
|
3995
4018
|
onMouseDown: disableRipple ? void 0 : handleRipple,
|
|
3996
4019
|
onClick: handleClick,
|
|
3997
4020
|
onFocus: handleFocus
|
|
@@ -4008,47 +4031,56 @@ var Tab = forwardRef(
|
|
|
4008
4031
|
type: "button",
|
|
4009
4032
|
"data-key": String(id),
|
|
4010
4033
|
tabIndex: finalIsDisabled ? -1 : isSelected ? 0 : -1,
|
|
4011
|
-
className: cn(
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
),
|
|
4034
|
+
className: cn(tabVariants({ variant, layout }), className),
|
|
4035
|
+
...getInteractionDataAttributes({
|
|
4036
|
+
isHovered,
|
|
4037
|
+
isFocusVisible,
|
|
4038
|
+
isPressed,
|
|
4039
|
+
isSelected,
|
|
4040
|
+
isDisabled: finalIsDisabled
|
|
4041
|
+
}),
|
|
4042
|
+
"data-with-icon": hasIcon ? "" : void 0,
|
|
4043
|
+
"data-with-label": hasLabel ? "" : void 0,
|
|
4022
4044
|
...htmlProps,
|
|
4023
4045
|
children: [
|
|
4024
4046
|
!disableRipple && ripples,
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
className:
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4047
|
+
/* @__PURE__ */ jsx("span", { className: cn(tabStateLayerVariants({ variant })), "aria-hidden": "true" }),
|
|
4048
|
+
/* @__PURE__ */ jsxs(
|
|
4049
|
+
"span",
|
|
4050
|
+
{
|
|
4051
|
+
"data-tab-content": true,
|
|
4052
|
+
className: "relative z-10 inline-flex flex-col items-center justify-center",
|
|
4053
|
+
children: [
|
|
4054
|
+
hasIcon && /* @__PURE__ */ jsxs("span", { className: cn(tabIconVariants({ hasLabel })), children: [
|
|
4055
|
+
icon,
|
|
4056
|
+
badgeDisplay && /* @__PURE__ */ jsx(
|
|
4057
|
+
"span",
|
|
4058
|
+
{
|
|
4059
|
+
"data-badge-type": isDotBadge ? "dot" : "count",
|
|
4060
|
+
"aria-hidden": "true",
|
|
4061
|
+
className: cn(tabBadgeVariants({ type: isDotBadge ? "dot" : "count" })),
|
|
4062
|
+
children: !isDotBadge && badgeDisplay
|
|
4063
|
+
}
|
|
4064
|
+
)
|
|
4065
|
+
] }),
|
|
4066
|
+
hasLabel && /* @__PURE__ */ jsxs("span", { className: "truncate", children: [
|
|
4067
|
+
label,
|
|
4068
|
+
!hasIcon && badgeDisplay && /* @__PURE__ */ jsx(
|
|
4069
|
+
"span",
|
|
4070
|
+
{
|
|
4071
|
+
"data-badge-type": isDotBadge ? "dot" : "count",
|
|
4072
|
+
"aria-hidden": "true",
|
|
4073
|
+
className: cn(
|
|
4074
|
+
"relative ml-1",
|
|
4075
|
+
tabBadgeVariants({ type: isDotBadge ? "dot" : "count" })
|
|
4076
|
+
),
|
|
4077
|
+
children: !isDotBadge && badgeDisplay
|
|
4078
|
+
}
|
|
4079
|
+
)
|
|
4080
|
+
] })
|
|
4081
|
+
]
|
|
4082
|
+
}
|
|
4083
|
+
)
|
|
4052
4084
|
]
|
|
4053
4085
|
}
|
|
4054
4086
|
);
|
|
@@ -4681,13 +4713,21 @@ var HeadlessDrawerItem = forwardRef(
|
|
|
4681
4713
|
);
|
|
4682
4714
|
HeadlessDrawerItem.displayName = "HeadlessDrawerItem";
|
|
4683
4715
|
var DividerHeadless = forwardRef(
|
|
4684
|
-
({ orientation = "horizontal", className }, ref) => {
|
|
4716
|
+
({ orientation = "horizontal", className, style }, ref) => {
|
|
4685
4717
|
const { separatorProps } = useSeparator({
|
|
4686
4718
|
orientation,
|
|
4687
4719
|
elementType: orientation === "vertical" ? "div" : "hr"
|
|
4688
4720
|
});
|
|
4689
4721
|
if (orientation === "vertical") {
|
|
4690
|
-
return /* @__PURE__ */ jsx(
|
|
4722
|
+
return /* @__PURE__ */ jsx(
|
|
4723
|
+
"div",
|
|
4724
|
+
{
|
|
4725
|
+
...separatorProps,
|
|
4726
|
+
ref,
|
|
4727
|
+
className,
|
|
4728
|
+
style
|
|
4729
|
+
}
|
|
4730
|
+
);
|
|
4691
4731
|
}
|
|
4692
4732
|
return /* @__PURE__ */ jsx(
|
|
4693
4733
|
"hr",
|
|
@@ -4695,32 +4735,46 @@ var DividerHeadless = forwardRef(
|
|
|
4695
4735
|
...separatorProps,
|
|
4696
4736
|
"aria-orientation": "horizontal",
|
|
4697
4737
|
ref,
|
|
4698
|
-
className
|
|
4738
|
+
className,
|
|
4739
|
+
style
|
|
4699
4740
|
}
|
|
4700
4741
|
);
|
|
4701
4742
|
}
|
|
4702
4743
|
);
|
|
4703
4744
|
DividerHeadless.displayName = "DividerHeadless";
|
|
4704
4745
|
var dividerVariants = cva(
|
|
4705
|
-
|
|
4706
|
-
|
|
4746
|
+
[
|
|
4747
|
+
// Zero border — color comes from background fill (matches md-web strategy)
|
|
4748
|
+
"shrink-0 border-0",
|
|
4749
|
+
// MD3 outline-variant color token
|
|
4750
|
+
"bg-outline-variant",
|
|
4751
|
+
// Default thickness — consumers override via the CSS custom property
|
|
4752
|
+
"[--md-divider-thickness:1px]"
|
|
4753
|
+
],
|
|
4707
4754
|
{
|
|
4708
4755
|
variants: {
|
|
4709
4756
|
/**
|
|
4710
4757
|
* Controls the axis of the visual rule.
|
|
4758
|
+
*
|
|
4759
|
+
* horizontal — stretches to full inline width; block size is --md-divider-thickness
|
|
4760
|
+
* vertical — self-stretches to the block axis of the flex/grid parent;
|
|
4761
|
+
* inline size is --md-divider-thickness
|
|
4711
4762
|
*/
|
|
4712
4763
|
orientation: {
|
|
4713
|
-
horizontal: "
|
|
4714
|
-
vertical: "
|
|
4764
|
+
horizontal: "w-full h-[var(--md-divider-thickness)]",
|
|
4765
|
+
vertical: "self-stretch h-auto w-[var(--md-divider-thickness)]"
|
|
4715
4766
|
},
|
|
4716
4767
|
/**
|
|
4717
|
-
* Inset —
|
|
4768
|
+
* Inset — logical inline offset per MD3 spec (16dp = 1rem = Tailwind spacing-4).
|
|
4769
|
+
*
|
|
4770
|
+
* Uses logical properties (ms-N / me-N) for correct behaviour under RTL
|
|
4771
|
+
* writing modes (Arabic, Hebrew, etc.).
|
|
4718
4772
|
*/
|
|
4719
4773
|
inset: {
|
|
4720
4774
|
none: "",
|
|
4721
|
-
start: "
|
|
4722
|
-
end: "
|
|
4723
|
-
both: "
|
|
4775
|
+
start: "ms-4",
|
|
4776
|
+
end: "me-4",
|
|
4777
|
+
both: "ms-4 me-4"
|
|
4724
4778
|
}
|
|
4725
4779
|
},
|
|
4726
4780
|
defaultVariants: {
|
|
@@ -4730,44 +4784,15 @@ var dividerVariants = cva(
|
|
|
4730
4784
|
}
|
|
4731
4785
|
);
|
|
4732
4786
|
var Divider = forwardRef(
|
|
4733
|
-
({ orientation = "horizontal", inset = "none",
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
"aria-label": label,
|
|
4741
|
-
className: cn("flex items-center gap-4", className),
|
|
4742
|
-
children: [
|
|
4743
|
-
/* @__PURE__ */ jsx(
|
|
4744
|
-
DividerHeadless,
|
|
4745
|
-
{
|
|
4746
|
-
orientation: "horizontal",
|
|
4747
|
-
className: cn(dividerVariants({ orientation: "horizontal", inset: "none" }), "flex-1")
|
|
4748
|
-
}
|
|
4749
|
-
),
|
|
4750
|
-
/* @__PURE__ */ jsx("span", { className: "text-on-surface-variant text-label-large whitespace-nowrap", children: label }),
|
|
4751
|
-
/* @__PURE__ */ jsx(
|
|
4752
|
-
DividerHeadless,
|
|
4753
|
-
{
|
|
4754
|
-
orientation: "horizontal",
|
|
4755
|
-
className: cn(dividerVariants({ orientation: "horizontal", inset: "none" }), "flex-1")
|
|
4756
|
-
}
|
|
4757
|
-
)
|
|
4758
|
-
]
|
|
4759
|
-
}
|
|
4760
|
-
);
|
|
4787
|
+
({ orientation = "horizontal", inset = "none", className, style }, ref) => /* @__PURE__ */ jsx(
|
|
4788
|
+
DividerHeadless,
|
|
4789
|
+
{
|
|
4790
|
+
ref,
|
|
4791
|
+
orientation,
|
|
4792
|
+
className: cn(dividerVariants({ orientation, inset }), className),
|
|
4793
|
+
...style !== void 0 && { style }
|
|
4761
4794
|
}
|
|
4762
|
-
|
|
4763
|
-
DividerHeadless,
|
|
4764
|
-
{
|
|
4765
|
-
ref,
|
|
4766
|
-
orientation,
|
|
4767
|
-
className: cn(dividerVariants({ orientation, inset }), className)
|
|
4768
|
-
}
|
|
4769
|
-
);
|
|
4770
|
-
}
|
|
4795
|
+
)
|
|
4771
4796
|
);
|
|
4772
4797
|
Divider.displayName = "Divider";
|
|
4773
4798
|
var drawerVariants = cva(
|