@tinybigui/react 0.8.0 → 0.9.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 +10 -10
- package/dist/index.cjs +493 -437
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +172 -48
- package/dist/index.d.ts +172 -48
- package/dist/index.js +493 -437
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2665,205 +2665,132 @@ var TextField = forwardRef(
|
|
|
2665
2665
|
}
|
|
2666
2666
|
);
|
|
2667
2667
|
TextField.displayName = "TextField";
|
|
2668
|
-
var
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
[
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
"fill-transparent",
|
|
2770
|
-
"stroke-outline",
|
|
2771
|
-
// MD3: outline color for unchecked
|
|
2772
|
-
"stroke-4"
|
|
2773
|
-
// MD3: 2dp outline width
|
|
2774
|
-
],
|
|
2775
|
-
checked: [
|
|
2776
|
-
"fill-current",
|
|
2777
|
-
// Uses parent text color (primary or error)
|
|
2778
|
-
"stroke-none"
|
|
2779
|
-
],
|
|
2780
|
-
indeterminate: [
|
|
2781
|
-
"fill-current",
|
|
2782
|
-
// Uses parent text color (primary or error)
|
|
2783
|
-
"stroke-none"
|
|
2784
|
-
]
|
|
2785
|
-
},
|
|
2786
|
-
/**
|
|
2787
|
-
* Disabled state
|
|
2788
|
-
*/
|
|
2789
|
-
disabled: {
|
|
2790
|
-
true: ["fill-transparent", "stroke-current", "stroke-2"],
|
|
2791
|
-
false: ""
|
|
2792
|
-
}
|
|
2793
|
-
},
|
|
2794
|
-
compoundVariants: [
|
|
2795
|
-
// Disabled state overrides fill for checked/indeterminate
|
|
2796
|
-
{
|
|
2797
|
-
state: "checked",
|
|
2798
|
-
disabled: true,
|
|
2799
|
-
className: "fill-current stroke-none"
|
|
2800
|
-
},
|
|
2801
|
-
{
|
|
2802
|
-
state: "indeterminate",
|
|
2803
|
-
disabled: true,
|
|
2804
|
-
className: "fill-current stroke-none"
|
|
2805
|
-
}
|
|
2806
|
-
],
|
|
2807
|
-
defaultVariants: {
|
|
2808
|
-
state: "unchecked",
|
|
2809
|
-
disabled: false
|
|
2810
|
-
}
|
|
2811
|
-
}
|
|
2812
|
-
);
|
|
2813
|
-
var checkboxIconVariants = cva(
|
|
2814
|
-
[
|
|
2815
|
-
"fill-current",
|
|
2816
|
-
// Inherits color from parent
|
|
2817
|
-
"transition-all duration-200"
|
|
2818
|
-
],
|
|
2819
|
-
{
|
|
2820
|
-
variants: {
|
|
2821
|
-
/**
|
|
2822
|
-
* Icon type
|
|
2823
|
-
*/
|
|
2824
|
-
type: {
|
|
2825
|
-
check: "",
|
|
2826
|
-
// Checkmark icon
|
|
2827
|
-
dash: ""
|
|
2828
|
-
// Dash/minus icon
|
|
2829
|
-
}
|
|
2830
|
-
},
|
|
2831
|
-
defaultVariants: {
|
|
2832
|
-
type: "check"
|
|
2668
|
+
var checkboxRootVariants = cva([
|
|
2669
|
+
"relative inline-flex items-center cursor-pointer select-none",
|
|
2670
|
+
"data-[disabled]:cursor-not-allowed data-[disabled]:pointer-events-none",
|
|
2671
|
+
"data-[disabled]:opacity-38"
|
|
2672
|
+
]);
|
|
2673
|
+
var checkboxControlVariants = cva([
|
|
2674
|
+
"relative flex items-center justify-center flex-shrink-0",
|
|
2675
|
+
"w-10 h-10 rounded-full",
|
|
2676
|
+
"overflow-hidden"
|
|
2677
|
+
]);
|
|
2678
|
+
var checkboxStateLayerVariants = cva([
|
|
2679
|
+
"absolute inset-0 rounded-full pointer-events-none opacity-0",
|
|
2680
|
+
// Base state-layer color (unselected)
|
|
2681
|
+
"bg-on-surface",
|
|
2682
|
+
// Effects transition for opacity changes
|
|
2683
|
+
"transition-opacity duration-spring-standard-fast-effects ease-spring-standard-fast-effects",
|
|
2684
|
+
// Selected / indeterminate → primary color
|
|
2685
|
+
"group-data-[selected]/checkbox:bg-primary",
|
|
2686
|
+
"group-data-[indeterminate]/checkbox:bg-primary",
|
|
2687
|
+
// Invalid → error color (singly-chained)
|
|
2688
|
+
"group-data-[invalid]/checkbox:bg-error",
|
|
2689
|
+
// Invalid + selected → error wins (doubly-chained for specificity)
|
|
2690
|
+
"group-data-[invalid]/checkbox:group-data-[selected]/checkbox:bg-error",
|
|
2691
|
+
// Interaction opacities (MD3: hover 8%, focus-visible 10%, pressed 10%)
|
|
2692
|
+
"group-data-[hovered]/checkbox:opacity-8",
|
|
2693
|
+
"group-data-[focus-visible]/checkbox:opacity-10",
|
|
2694
|
+
"group-data-[pressed]/checkbox:opacity-10",
|
|
2695
|
+
// No state layer when disabled
|
|
2696
|
+
"group-data-[disabled]/checkbox:hidden"
|
|
2697
|
+
]);
|
|
2698
|
+
var checkboxFocusRingVariants = cva([
|
|
2699
|
+
"pointer-events-none absolute inset-0 rounded-full",
|
|
2700
|
+
"outline outline-2 outline-offset-0 outline-secondary",
|
|
2701
|
+
"transition-opacity duration-spring-standard-fast-effects ease-spring-standard-fast-effects",
|
|
2702
|
+
"opacity-0",
|
|
2703
|
+
"group-data-[focus-visible]/checkbox:opacity-100"
|
|
2704
|
+
]);
|
|
2705
|
+
var checkboxBoxVariants = cva([
|
|
2706
|
+
// Base geometry
|
|
2707
|
+
"relative flex items-center justify-center flex-shrink-0",
|
|
2708
|
+
"w-[18px] h-[18px] rounded-[2px] border-2",
|
|
2709
|
+
// Effects transition for color changes
|
|
2710
|
+
"transition-[background-color,border-color] duration-spring-standard-fast-effects ease-spring-standard-fast-effects",
|
|
2711
|
+
// ── Unselected base ───────────────────────────────────────────────────────
|
|
2712
|
+
"bg-transparent border-outline",
|
|
2713
|
+
// ── Selected ──────────────────────────────────────────────────────────────
|
|
2714
|
+
"group-data-[selected]/checkbox:bg-primary group-data-[selected]/checkbox:border-primary",
|
|
2715
|
+
// ── Indeterminate ─────────────────────────────────────────────────────────
|
|
2716
|
+
"group-data-[indeterminate]/checkbox:bg-primary group-data-[indeterminate]/checkbox:border-primary",
|
|
2717
|
+
// ── Invalid (unselected) — singly chained ─────────────────────────────────
|
|
2718
|
+
"group-data-[invalid]/checkbox:border-error",
|
|
2719
|
+
// ── Invalid + selected — doubly chained (higher specificity) ──────────────
|
|
2720
|
+
"group-data-[invalid]/checkbox:group-data-[selected]/checkbox:bg-error",
|
|
2721
|
+
"group-data-[invalid]/checkbox:group-data-[selected]/checkbox:border-error",
|
|
2722
|
+
// ── Invalid + indeterminate — doubly chained ───────────────────────────────
|
|
2723
|
+
"group-data-[invalid]/checkbox:group-data-[indeterminate]/checkbox:bg-error",
|
|
2724
|
+
"group-data-[invalid]/checkbox:group-data-[indeterminate]/checkbox:border-error",
|
|
2725
|
+
// ── Disabled (placed last — cascade wins over interaction colors) ──────────
|
|
2726
|
+
"group-data-[disabled]/checkbox:border-on-surface/38",
|
|
2727
|
+
"group-data-[disabled]/checkbox:bg-transparent",
|
|
2728
|
+
// ── Disabled + selected — doubly chained ──────────────────────────────────
|
|
2729
|
+
"group-data-[selected]/checkbox:group-data-[disabled]/checkbox:bg-on-surface/38",
|
|
2730
|
+
"group-data-[selected]/checkbox:group-data-[disabled]/checkbox:border-transparent",
|
|
2731
|
+
// ── Disabled + indeterminate — doubly chained ─────────────────────────────
|
|
2732
|
+
"group-data-[indeterminate]/checkbox:group-data-[disabled]/checkbox:bg-on-surface/38",
|
|
2733
|
+
"group-data-[indeterminate]/checkbox:group-data-[disabled]/checkbox:border-transparent"
|
|
2734
|
+
]);
|
|
2735
|
+
var checkboxIconVariants = cva([
|
|
2736
|
+
"absolute inset-0 flex items-center justify-center",
|
|
2737
|
+
// Spatial transition for icon appearing (scale)
|
|
2738
|
+
"transition-transform duration-spring-standard-fast-spatial ease-spring-standard-fast-spatial",
|
|
2739
|
+
// Base icon color
|
|
2740
|
+
"text-on-primary",
|
|
2741
|
+
// Invalid → on-error (doubly-chained for both selected and indeterminate)
|
|
2742
|
+
"group-data-[invalid]/checkbox:group-data-[selected]/checkbox:text-on-error",
|
|
2743
|
+
"group-data-[invalid]/checkbox:group-data-[indeterminate]/checkbox:text-on-error",
|
|
2744
|
+
// Disabled → surface (doubly-chained)
|
|
2745
|
+
"group-data-[selected]/checkbox:group-data-[disabled]/checkbox:text-surface",
|
|
2746
|
+
"group-data-[indeterminate]/checkbox:group-data-[disabled]/checkbox:text-surface"
|
|
2747
|
+
]);
|
|
2748
|
+
var checkboxLabelVariants = cva(["text-body-large text-on-surface select-none ml-4"]);
|
|
2749
|
+
function CheckboxCheckIcon() {
|
|
2750
|
+
return /* @__PURE__ */ jsx(
|
|
2751
|
+
"svg",
|
|
2752
|
+
{
|
|
2753
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2754
|
+
width: "18",
|
|
2755
|
+
height: "18",
|
|
2756
|
+
viewBox: "0 0 18 18",
|
|
2757
|
+
fill: "none",
|
|
2758
|
+
"aria-hidden": "true",
|
|
2759
|
+
children: /* @__PURE__ */ jsx(
|
|
2760
|
+
"path",
|
|
2761
|
+
{
|
|
2762
|
+
d: "M4.5 9L7.2 11.7L13.5 5.4",
|
|
2763
|
+
stroke: "currentColor",
|
|
2764
|
+
strokeWidth: "2",
|
|
2765
|
+
strokeLinecap: "square",
|
|
2766
|
+
strokeLinejoin: "miter"
|
|
2767
|
+
}
|
|
2768
|
+
)
|
|
2833
2769
|
}
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
"
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
false: ""
|
|
2848
|
-
}
|
|
2849
|
-
},
|
|
2850
|
-
defaultVariants: {
|
|
2851
|
-
disabled: false
|
|
2770
|
+
);
|
|
2771
|
+
}
|
|
2772
|
+
function CheckboxIndeterminateIcon() {
|
|
2773
|
+
return /* @__PURE__ */ jsx(
|
|
2774
|
+
"svg",
|
|
2775
|
+
{
|
|
2776
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2777
|
+
width: "18",
|
|
2778
|
+
height: "18",
|
|
2779
|
+
viewBox: "0 0 18 18",
|
|
2780
|
+
fill: "none",
|
|
2781
|
+
"aria-hidden": "true",
|
|
2782
|
+
children: /* @__PURE__ */ jsx("rect", { x: "4", y: "8", width: "10", height: "2", rx: "1", fill: "currentColor" })
|
|
2852
2783
|
}
|
|
2853
|
-
|
|
2854
|
-
|
|
2784
|
+
);
|
|
2785
|
+
}
|
|
2855
2786
|
var Checkbox = forwardRef(
|
|
2856
2787
|
({
|
|
2857
|
-
// Content props
|
|
2858
2788
|
children,
|
|
2859
|
-
// State props
|
|
2860
2789
|
isIndeterminate = false,
|
|
2861
2790
|
isInvalid = false,
|
|
2862
2791
|
disableRipple = false,
|
|
2863
2792
|
isDisabled = false,
|
|
2864
|
-
// Styling
|
|
2865
2793
|
className,
|
|
2866
|
-
// Other props
|
|
2867
2794
|
...props
|
|
2868
2795
|
}, forwardedRef) => {
|
|
2869
2796
|
const internalRef = useRef(null);
|
|
@@ -2876,17 +2803,17 @@ var Checkbox = forwardRef(
|
|
|
2876
2803
|
"data-testid": _dataTestId,
|
|
2877
2804
|
id: _htmlId,
|
|
2878
2805
|
title: _htmlTitle,
|
|
2879
|
-
...
|
|
2806
|
+
...ariaProps
|
|
2880
2807
|
} = props;
|
|
2881
|
-
const state = useToggleState(
|
|
2882
|
-
const { inputProps, labelProps } = useCheckbox(
|
|
2883
|
-
|
|
2808
|
+
const state = useToggleState(ariaProps);
|
|
2809
|
+
const { inputProps, labelProps, isPressed } = useCheckbox(
|
|
2810
|
+
ariaProps,
|
|
2884
2811
|
state,
|
|
2885
2812
|
ref
|
|
2886
2813
|
);
|
|
2887
2814
|
const { isFocusVisible, focusProps } = useFocusRing();
|
|
2815
|
+
const { isHovered, hoverProps } = useHover({ isDisabled });
|
|
2888
2816
|
const isSelected = state.isSelected;
|
|
2889
|
-
const visualState = isIndeterminate ? "indeterminate" : isSelected ? "checked" : "unchecked";
|
|
2890
2817
|
const { onMouseDown: handleRipple, ripples } = useRipple({
|
|
2891
2818
|
disabled: isDisabled || disableRipple
|
|
2892
2819
|
});
|
|
@@ -2896,8 +2823,8 @@ var Checkbox = forwardRef(
|
|
|
2896
2823
|
}
|
|
2897
2824
|
}, [isIndeterminate, ref]);
|
|
2898
2825
|
if (process.env.NODE_ENV === "development") {
|
|
2899
|
-
const
|
|
2900
|
-
if (!children && !
|
|
2826
|
+
const a = ariaProps;
|
|
2827
|
+
if (!children && !a["aria-label"] && !a["aria-labelledby"]) {
|
|
2901
2828
|
console.warn(
|
|
2902
2829
|
"[Checkbox] Checkbox should have a label (children) or aria-label for accessibility."
|
|
2903
2830
|
);
|
|
@@ -2906,105 +2833,40 @@ var Checkbox = forwardRef(
|
|
|
2906
2833
|
return /* @__PURE__ */ jsxs(
|
|
2907
2834
|
"label",
|
|
2908
2835
|
{
|
|
2909
|
-
...labelProps,
|
|
2910
|
-
className: cn(
|
|
2911
|
-
checkboxVariants({
|
|
2912
|
-
disabled: isDisabled
|
|
2913
|
-
}),
|
|
2914
|
-
className
|
|
2915
|
-
),
|
|
2836
|
+
...mergeProps$1(labelProps, hoverProps),
|
|
2837
|
+
className: cn(checkboxRootVariants(), "group/checkbox", className),
|
|
2916
2838
|
"data-testid": dataTestId,
|
|
2917
2839
|
title: htmlTitle,
|
|
2840
|
+
...getInteractionDataAttributes({
|
|
2841
|
+
isHovered,
|
|
2842
|
+
isFocusVisible,
|
|
2843
|
+
isPressed,
|
|
2844
|
+
isSelected,
|
|
2845
|
+
isDisabled,
|
|
2846
|
+
isInvalid,
|
|
2847
|
+
isIndeterminate,
|
|
2848
|
+
isReadOnly: ariaProps.isReadOnly ?? false
|
|
2849
|
+
}),
|
|
2918
2850
|
children: [
|
|
2919
2851
|
/* @__PURE__ */ jsx(VisuallyHidden, { children: /* @__PURE__ */ jsx("input", { ...mergeProps$1(inputProps, focusProps), ref, id: htmlId }) }),
|
|
2920
2852
|
/* @__PURE__ */ jsxs(
|
|
2921
2853
|
"div",
|
|
2922
2854
|
{
|
|
2923
2855
|
role: "presentation",
|
|
2924
|
-
className: cn(
|
|
2925
|
-
checkboxContainerVariants({
|
|
2926
|
-
state: visualState,
|
|
2927
|
-
isInvalid,
|
|
2928
|
-
disabled: isDisabled
|
|
2929
|
-
})
|
|
2930
|
-
),
|
|
2856
|
+
className: cn(checkboxControlVariants()),
|
|
2931
2857
|
onMouseDown: handleRipple,
|
|
2932
2858
|
children: [
|
|
2933
2859
|
ripples,
|
|
2934
|
-
/* @__PURE__ */
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
"aria-hidden": "true",
|
|
2941
|
-
className: "relative z-10",
|
|
2942
|
-
children: [
|
|
2943
|
-
/* @__PURE__ */ jsx(
|
|
2944
|
-
"rect",
|
|
2945
|
-
{
|
|
2946
|
-
x: "0",
|
|
2947
|
-
y: "0",
|
|
2948
|
-
width: "18",
|
|
2949
|
-
height: "18",
|
|
2950
|
-
rx: "2",
|
|
2951
|
-
ry: "2",
|
|
2952
|
-
className: cn(
|
|
2953
|
-
checkboxIconBoxVariants({
|
|
2954
|
-
state: visualState,
|
|
2955
|
-
disabled: isDisabled
|
|
2956
|
-
})
|
|
2957
|
-
)
|
|
2958
|
-
}
|
|
2959
|
-
),
|
|
2960
|
-
isSelected && !isIndeterminate && /* @__PURE__ */ jsx(
|
|
2961
|
-
"path",
|
|
2962
|
-
{
|
|
2963
|
-
d: "M14.1 4.5L6.3 12.3l-3.4-3.4L1.5 10.3l4.8 4.8 9.2-9.2z",
|
|
2964
|
-
className: cn(checkboxIconVariants({ type: "check" }), "fill-on-primary")
|
|
2965
|
-
}
|
|
2966
|
-
),
|
|
2967
|
-
isIndeterminate && /* @__PURE__ */ jsx(
|
|
2968
|
-
"rect",
|
|
2969
|
-
{
|
|
2970
|
-
x: "4",
|
|
2971
|
-
y: "8",
|
|
2972
|
-
width: "10",
|
|
2973
|
-
height: "2",
|
|
2974
|
-
className: cn(checkboxIconVariants({ type: "dash" }), "fill-on-primary")
|
|
2975
|
-
}
|
|
2976
|
-
),
|
|
2977
|
-
isFocusVisible && /* @__PURE__ */ jsx(
|
|
2978
|
-
"rect",
|
|
2979
|
-
{
|
|
2980
|
-
x: "-3",
|
|
2981
|
-
y: "-3",
|
|
2982
|
-
width: "24",
|
|
2983
|
-
height: "24",
|
|
2984
|
-
rx: "12",
|
|
2985
|
-
fill: "none",
|
|
2986
|
-
stroke: "currentColor",
|
|
2987
|
-
strokeWidth: "2",
|
|
2988
|
-
className: "animate-pulse"
|
|
2989
|
-
}
|
|
2990
|
-
)
|
|
2991
|
-
]
|
|
2992
|
-
}
|
|
2993
|
-
)
|
|
2860
|
+
/* @__PURE__ */ jsx("span", { className: cn(checkboxStateLayerVariants()), "aria-hidden": "true" }),
|
|
2861
|
+
/* @__PURE__ */ jsx("span", { className: cn(checkboxFocusRingVariants()), "aria-hidden": "true" }),
|
|
2862
|
+
/* @__PURE__ */ jsxs("div", { className: cn(checkboxBoxVariants()), "aria-hidden": "true", children: [
|
|
2863
|
+
isSelected && !isIndeterminate && /* @__PURE__ */ jsx("span", { className: cn(checkboxIconVariants()), children: /* @__PURE__ */ jsx(CheckboxCheckIcon, {}) }),
|
|
2864
|
+
isIndeterminate && /* @__PURE__ */ jsx("span", { className: cn(checkboxIconVariants()), children: /* @__PURE__ */ jsx(CheckboxIndeterminateIcon, {}) })
|
|
2865
|
+
] })
|
|
2994
2866
|
]
|
|
2995
2867
|
}
|
|
2996
2868
|
),
|
|
2997
|
-
children && /* @__PURE__ */ jsx(
|
|
2998
|
-
"span",
|
|
2999
|
-
{
|
|
3000
|
-
className: cn(
|
|
3001
|
-
checkboxLabelVariants({
|
|
3002
|
-
disabled: isDisabled
|
|
3003
|
-
})
|
|
3004
|
-
),
|
|
3005
|
-
children
|
|
3006
|
-
}
|
|
3007
|
-
)
|
|
2869
|
+
children && /* @__PURE__ */ jsx("span", { className: cn(checkboxLabelVariants()), children })
|
|
3008
2870
|
]
|
|
3009
2871
|
}
|
|
3010
2872
|
);
|
|
@@ -6601,18 +6463,43 @@ function SnackbarProvider({ children, maxVisible = 5 }) {
|
|
|
6601
6463
|
)
|
|
6602
6464
|
] });
|
|
6603
6465
|
}
|
|
6466
|
+
function stripAriaProps(handlers) {
|
|
6467
|
+
const {
|
|
6468
|
+
isDisabled: _isDisabled,
|
|
6469
|
+
onPress: _onPress,
|
|
6470
|
+
onPressStart: _onPressStart,
|
|
6471
|
+
onPressEnd: _onPressEnd,
|
|
6472
|
+
onPressChange: _onPressChange,
|
|
6473
|
+
onPressUp: _onPressUp,
|
|
6474
|
+
...html
|
|
6475
|
+
} = handlers;
|
|
6476
|
+
return html;
|
|
6477
|
+
}
|
|
6478
|
+
function buildPressCallbacks(onPressStart, onPressEnd) {
|
|
6479
|
+
return {
|
|
6480
|
+
...onPressStart !== void 0 && { onPressStart },
|
|
6481
|
+
...onPressEnd !== void 0 && { onPressEnd }
|
|
6482
|
+
};
|
|
6483
|
+
}
|
|
6604
6484
|
var AssistChipImpl = forwardRef(
|
|
6605
|
-
({ label, onPress, isDisabled, className, onMouseDown, children }, forwardedRef) => {
|
|
6485
|
+
({ label, onPress, isDisabled, className, onMouseDown, children, bodyPassthrough }, forwardedRef) => {
|
|
6606
6486
|
const internalRef = useRef(null);
|
|
6607
6487
|
const ref = forwardedRef ?? internalRef;
|
|
6608
6488
|
const { buttonProps } = useButton(
|
|
6609
6489
|
{
|
|
6610
6490
|
...onPress !== void 0 && { onPress },
|
|
6611
|
-
...isDisabled !== void 0 && { isDisabled }
|
|
6491
|
+
...isDisabled !== void 0 && { isDisabled },
|
|
6492
|
+
...buildPressCallbacks(bodyPassthrough?.onPressStart, bodyPassthrough?.onPressEnd)
|
|
6612
6493
|
},
|
|
6613
6494
|
ref
|
|
6614
6495
|
);
|
|
6615
|
-
const
|
|
6496
|
+
const htmlPassthrough = stripAriaProps(bodyPassthrough?.eventHandlers ?? {});
|
|
6497
|
+
const mergedProps = mergeProps(
|
|
6498
|
+
buttonProps,
|
|
6499
|
+
{ onMouseDown },
|
|
6500
|
+
bodyPassthrough?.dataAttributes ?? {},
|
|
6501
|
+
htmlPassthrough
|
|
6502
|
+
);
|
|
6616
6503
|
return /* @__PURE__ */ jsx("button", { ...mergedProps, type: "button", ref, className, children: children ?? label });
|
|
6617
6504
|
}
|
|
6618
6505
|
);
|
|
@@ -6626,7 +6513,8 @@ var FilterChipImpl = forwardRef(
|
|
|
6626
6513
|
isDisabled,
|
|
6627
6514
|
className,
|
|
6628
6515
|
onMouseDown,
|
|
6629
|
-
children
|
|
6516
|
+
children,
|
|
6517
|
+
bodyPassthrough
|
|
6630
6518
|
}, forwardedRef) => {
|
|
6631
6519
|
const internalRef = useRef(null);
|
|
6632
6520
|
const ref = forwardedRef ?? internalRef;
|
|
@@ -6634,11 +6522,18 @@ var FilterChipImpl = forwardRef(
|
|
|
6634
6522
|
...selected !== void 0 && { isSelected: selected },
|
|
6635
6523
|
...defaultSelected !== void 0 && { defaultSelected },
|
|
6636
6524
|
...onSelectionChange !== void 0 && { onChange: onSelectionChange },
|
|
6637
|
-
...isDisabled !== void 0 && { isDisabled }
|
|
6525
|
+
...isDisabled !== void 0 && { isDisabled },
|
|
6526
|
+
...buildPressCallbacks(bodyPassthrough?.onPressStart, bodyPassthrough?.onPressEnd)
|
|
6638
6527
|
};
|
|
6639
6528
|
const state = useToggleState(toggleProps);
|
|
6640
6529
|
const { buttonProps } = useToggleButton(toggleProps, state, ref);
|
|
6641
|
-
const
|
|
6530
|
+
const htmlPassthrough = stripAriaProps(bodyPassthrough?.eventHandlers ?? {});
|
|
6531
|
+
const mergedProps = mergeProps(
|
|
6532
|
+
buttonProps,
|
|
6533
|
+
{ onMouseDown },
|
|
6534
|
+
bodyPassthrough?.dataAttributes ?? {},
|
|
6535
|
+
htmlPassthrough
|
|
6536
|
+
);
|
|
6642
6537
|
return /* @__PURE__ */ jsx("button", { ...mergedProps, type: "button", ref, className, children: children ?? label });
|
|
6643
6538
|
}
|
|
6644
6539
|
);
|
|
@@ -6652,7 +6547,9 @@ var InputChipImpl = forwardRef(
|
|
|
6652
6547
|
onMouseDown,
|
|
6653
6548
|
removeIcon,
|
|
6654
6549
|
removeButtonClassName,
|
|
6655
|
-
children
|
|
6550
|
+
children,
|
|
6551
|
+
bodyPassthrough,
|
|
6552
|
+
removePassthrough
|
|
6656
6553
|
}, forwardedRef) => {
|
|
6657
6554
|
const chipRef = useRef(null);
|
|
6658
6555
|
const ref = forwardedRef ?? chipRef;
|
|
@@ -6660,7 +6557,8 @@ var InputChipImpl = forwardRef(
|
|
|
6660
6557
|
const { buttonProps: chipButtonProps } = useButton(
|
|
6661
6558
|
{
|
|
6662
6559
|
"aria-label": label,
|
|
6663
|
-
...isDisabled !== void 0 && { isDisabled }
|
|
6560
|
+
...isDisabled !== void 0 && { isDisabled },
|
|
6561
|
+
...buildPressCallbacks(bodyPassthrough?.onPressStart, bodyPassthrough?.onPressEnd)
|
|
6664
6562
|
},
|
|
6665
6563
|
ref
|
|
6666
6564
|
);
|
|
@@ -6668,7 +6566,8 @@ var InputChipImpl = forwardRef(
|
|
|
6668
6566
|
{
|
|
6669
6567
|
"aria-label": `Remove ${label}`,
|
|
6670
6568
|
onPress: () => onRemove?.(),
|
|
6671
|
-
...isDisabled !== void 0 && { isDisabled }
|
|
6569
|
+
...isDisabled !== void 0 && { isDisabled },
|
|
6570
|
+
...buildPressCallbacks(removePassthrough?.onPressStart, removePassthrough?.onPressEnd)
|
|
6672
6571
|
},
|
|
6673
6572
|
removeRef
|
|
6674
6573
|
);
|
|
@@ -6678,13 +6577,25 @@ var InputChipImpl = forwardRef(
|
|
|
6678
6577
|
onRemove?.();
|
|
6679
6578
|
}
|
|
6680
6579
|
};
|
|
6681
|
-
const
|
|
6580
|
+
const htmlBodyPassthrough = stripAriaProps(bodyPassthrough?.eventHandlers ?? {});
|
|
6581
|
+
const htmlRemovePassthrough = stripAriaProps(removePassthrough?.eventHandlers ?? {});
|
|
6582
|
+
const mergedChipProps = mergeProps(
|
|
6583
|
+
chipButtonProps,
|
|
6584
|
+
{ onKeyDown: handleKeyDown, onMouseDown },
|
|
6585
|
+
bodyPassthrough?.dataAttributes ?? {},
|
|
6586
|
+
htmlBodyPassthrough
|
|
6587
|
+
);
|
|
6588
|
+
const mergedRemoveProps = mergeProps(
|
|
6589
|
+
removeButtonProps,
|
|
6590
|
+
removePassthrough?.dataAttributes ?? {},
|
|
6591
|
+
htmlRemovePassthrough
|
|
6592
|
+
);
|
|
6682
6593
|
return /* @__PURE__ */ jsxs("span", { className, children: [
|
|
6683
6594
|
/* @__PURE__ */ jsx("button", { ...mergedChipProps, type: "button", ref, children: children ?? label }),
|
|
6684
6595
|
/* @__PURE__ */ jsx(
|
|
6685
6596
|
"button",
|
|
6686
6597
|
{
|
|
6687
|
-
...
|
|
6598
|
+
...mergedRemoveProps,
|
|
6688
6599
|
type: "button",
|
|
6689
6600
|
ref: removeRef,
|
|
6690
6601
|
className: removeButtonClassName,
|
|
@@ -6696,17 +6607,24 @@ var InputChipImpl = forwardRef(
|
|
|
6696
6607
|
);
|
|
6697
6608
|
InputChipImpl.displayName = "InputChipImpl";
|
|
6698
6609
|
var SuggestionChipImpl = forwardRef(
|
|
6699
|
-
({ label, onPress, isDisabled, className, onMouseDown, children }, forwardedRef) => {
|
|
6610
|
+
({ label, onPress, isDisabled, className, onMouseDown, children, bodyPassthrough }, forwardedRef) => {
|
|
6700
6611
|
const internalRef = useRef(null);
|
|
6701
6612
|
const ref = forwardedRef ?? internalRef;
|
|
6702
6613
|
const { buttonProps } = useButton(
|
|
6703
6614
|
{
|
|
6704
6615
|
...onPress !== void 0 && { onPress },
|
|
6705
|
-
...isDisabled !== void 0 && { isDisabled }
|
|
6616
|
+
...isDisabled !== void 0 && { isDisabled },
|
|
6617
|
+
...buildPressCallbacks(bodyPassthrough?.onPressStart, bodyPassthrough?.onPressEnd)
|
|
6706
6618
|
},
|
|
6707
6619
|
ref
|
|
6708
6620
|
);
|
|
6709
|
-
const
|
|
6621
|
+
const htmlPassthrough = stripAriaProps(bodyPassthrough?.eventHandlers ?? {});
|
|
6622
|
+
const mergedProps = mergeProps(
|
|
6623
|
+
buttonProps,
|
|
6624
|
+
{ onMouseDown },
|
|
6625
|
+
bodyPassthrough?.dataAttributes ?? {},
|
|
6626
|
+
htmlPassthrough
|
|
6627
|
+
);
|
|
6710
6628
|
return /* @__PURE__ */ jsx("button", { ...mergedProps, type: "button", ref, className, children: children ?? label });
|
|
6711
6629
|
}
|
|
6712
6630
|
);
|
|
@@ -6726,123 +6644,246 @@ var ChipHeadless = forwardRef((props, ref) => {
|
|
|
6726
6644
|
ChipHeadless.displayName = "ChipHeadless";
|
|
6727
6645
|
var chipVariants = cva(
|
|
6728
6646
|
[
|
|
6729
|
-
//
|
|
6730
|
-
"relative inline-flex items-center
|
|
6731
|
-
"
|
|
6732
|
-
|
|
6733
|
-
|
|
6647
|
+
// Layout + shape
|
|
6648
|
+
"relative inline-flex items-center justify-center",
|
|
6649
|
+
"h-8 rounded-sm cursor-pointer select-none",
|
|
6650
|
+
"text-label-large gap-2",
|
|
6651
|
+
// Base padding (no icons)
|
|
6652
|
+
"px-4",
|
|
6653
|
+
// Content-flag padding overrides (self-targeting)
|
|
6654
|
+
"data-[with-leading]:pl-2 data-[with-leading]:pr-4",
|
|
6655
|
+
"data-[with-trailing]:pr-2",
|
|
6656
|
+
// Effects transition (color/bg/shadow/border)
|
|
6657
|
+
"transition-[background-color,border-color,box-shadow,color]",
|
|
6658
|
+
"duration-spring-standard-fast-effects ease-spring-standard-fast-effects",
|
|
6659
|
+
// Disabled self-targeting
|
|
6660
|
+
"data-[disabled]:cursor-not-allowed data-[disabled]:pointer-events-none",
|
|
6661
|
+
"data-[disabled]:text-on-surface/38 data-[disabled]:border-on-surface/12",
|
|
6662
|
+
"data-[disabled]:bg-transparent data-[disabled]:shadow-none"
|
|
6734
6663
|
],
|
|
6735
6664
|
{
|
|
6736
6665
|
variants: {
|
|
6737
6666
|
/**
|
|
6738
|
-
* MD3 chip type — determines
|
|
6667
|
+
* MD3 chip type — determines base color tokens.
|
|
6739
6668
|
*/
|
|
6740
6669
|
chipType: {
|
|
6741
|
-
|
|
6742
|
-
|
|
6743
|
-
|
|
6744
|
-
|
|
6745
|
-
|
|
6746
|
-
|
|
6747
|
-
|
|
6748
|
-
|
|
6749
|
-
|
|
6670
|
+
/**
|
|
6671
|
+
* Assist — transparent + outline border; label on-surface; leading icon primary.
|
|
6672
|
+
* State layer color: on-surface.
|
|
6673
|
+
*/
|
|
6674
|
+
assist: ["bg-transparent border border-outline text-on-surface"],
|
|
6675
|
+
/**
|
|
6676
|
+
* Filter — transparent + outline border; label on-surface-variant.
|
|
6677
|
+
* Selected state via group-data selectors (no CVA variant key).
|
|
6678
|
+
* State layer color: on-surface-variant → on-secondary-container when selected.
|
|
6679
|
+
*/
|
|
6680
|
+
filter: [
|
|
6681
|
+
"bg-transparent border border-outline text-on-surface-variant",
|
|
6682
|
+
// Selected: secondary-container fill, no border, on-secondary-container label
|
|
6683
|
+
"group-data-[selected]/chip:bg-secondary-container",
|
|
6684
|
+
"group-data-[selected]/chip:border-0",
|
|
6685
|
+
"group-data-[selected]/chip:text-on-secondary-container",
|
|
6686
|
+
// Disabled + selected overrides (self-targeting, doubled to win over singly-chained selected)
|
|
6687
|
+
"data-[selected]:data-[disabled]:bg-on-surface/12",
|
|
6688
|
+
"data-[selected]:data-[disabled]:border-0"
|
|
6689
|
+
],
|
|
6690
|
+
/**
|
|
6691
|
+
* Input — transparent + outline-variant border; label/icons on-surface-variant.
|
|
6692
|
+
* State layer color: on-surface-variant.
|
|
6693
|
+
*/
|
|
6694
|
+
input: ["bg-transparent border border-outline-variant text-on-surface-variant"],
|
|
6695
|
+
/**
|
|
6696
|
+
* Suggestion — transparent + outline border; label on-surface-variant.
|
|
6697
|
+
* State layer color: on-surface-variant.
|
|
6698
|
+
*/
|
|
6699
|
+
suggestion: ["bg-transparent border border-outline text-on-surface-variant"]
|
|
6750
6700
|
},
|
|
6751
6701
|
/**
|
|
6752
|
-
* Surface style
|
|
6753
|
-
*
|
|
6702
|
+
* Surface style — elevated adds shadow and surface-container-low background.
|
|
6703
|
+
* All four chip types support elevated.
|
|
6704
|
+
* Note: "flat" and the deprecated "tonal" both resolve to the same base style
|
|
6705
|
+
* (transparent + border from chipType). The elevated compound variant overrides.
|
|
6754
6706
|
*/
|
|
6755
6707
|
surface: {
|
|
6756
|
-
|
|
6757
|
-
elevated: ""
|
|
6758
|
-
|
|
6759
|
-
|
|
6760
|
-
* Selected state — only meaningful for Filter chips.
|
|
6761
|
-
* Applied via compound variant.
|
|
6762
|
-
*/
|
|
6763
|
-
selected: {
|
|
6764
|
-
true: "",
|
|
6765
|
-
false: ""
|
|
6766
|
-
},
|
|
6767
|
-
/**
|
|
6768
|
-
* MD3 disabled state: content 38% opacity, border 12% opacity, no background.
|
|
6769
|
-
* Kept here only for `pointer-events-none`; color/bg overrides live in the
|
|
6770
|
-
* disabled compound variants at the bottom so they win over surface compounds.
|
|
6771
|
-
*/
|
|
6772
|
-
isDisabled: {
|
|
6773
|
-
true: "pointer-events-none",
|
|
6774
|
-
false: ""
|
|
6775
|
-
},
|
|
6776
|
-
/**
|
|
6777
|
-
* Adjusts leading padding when a leading icon is present.
|
|
6778
|
-
* Overrides the base `px-4` → `pl-3 pr-4`.
|
|
6779
|
-
*/
|
|
6780
|
-
hasLeadingIcon: {
|
|
6781
|
-
true: "pl-3 pr-4",
|
|
6782
|
-
false: ""
|
|
6783
|
-
},
|
|
6784
|
-
/**
|
|
6785
|
-
* Adjusts trailing padding for Input chips with a remove button.
|
|
6786
|
-
* Takes precedence over hasLeadingIcon via tailwind-merge: `pl-3 pr-3`.
|
|
6787
|
-
*/
|
|
6788
|
-
hasRemoveButton: {
|
|
6789
|
-
true: "pl-3 pr-3",
|
|
6790
|
-
false: ""
|
|
6708
|
+
flat: "",
|
|
6709
|
+
elevated: "",
|
|
6710
|
+
/** @deprecated Use `flat` instead. */
|
|
6711
|
+
tonal: ""
|
|
6791
6712
|
}
|
|
6792
6713
|
},
|
|
6793
6714
|
compoundVariants: [
|
|
6794
|
-
// ──
|
|
6715
|
+
// ── Elevated surface (all chip types) ─────────────────────────────────
|
|
6716
|
+
// Shared elevated base: surface-container-low fill, no border, level-1 elevation
|
|
6795
6717
|
{
|
|
6718
|
+
surface: "elevated",
|
|
6796
6719
|
chipType: "assist",
|
|
6797
|
-
|
|
6798
|
-
|
|
6720
|
+
className: [
|
|
6721
|
+
"bg-surface-container-low border-0 shadow-elevation-1",
|
|
6722
|
+
"data-[hovered]:shadow-elevation-2",
|
|
6723
|
+
"data-[focus-visible]:shadow-elevation-1",
|
|
6724
|
+
"data-[pressed]:data-[pressed]:shadow-elevation-1"
|
|
6725
|
+
]
|
|
6799
6726
|
},
|
|
6800
6727
|
{
|
|
6801
|
-
chipType: "assist",
|
|
6802
6728
|
surface: "elevated",
|
|
6729
|
+
chipType: "filter",
|
|
6803
6730
|
className: [
|
|
6804
|
-
"bg-surface-container-low
|
|
6805
|
-
"
|
|
6731
|
+
"bg-surface-container-low border-0 shadow-elevation-1",
|
|
6732
|
+
"data-[hovered]:shadow-elevation-2",
|
|
6733
|
+
"data-[focus-visible]:shadow-elevation-1",
|
|
6734
|
+
"data-[pressed]:data-[pressed]:shadow-elevation-1",
|
|
6735
|
+
// Selected overrides bg; elevation stays
|
|
6736
|
+
"group-data-[selected]/chip:bg-secondary-container"
|
|
6806
6737
|
]
|
|
6807
6738
|
},
|
|
6808
|
-
// ── Suggestion chip surfaces ───────────────────────────────────────────
|
|
6809
6739
|
{
|
|
6810
|
-
|
|
6811
|
-
|
|
6812
|
-
className:
|
|
6740
|
+
surface: "elevated",
|
|
6741
|
+
chipType: "input",
|
|
6742
|
+
className: [
|
|
6743
|
+
"bg-surface-container-low border-0 shadow-elevation-1",
|
|
6744
|
+
"data-[hovered]:shadow-elevation-2",
|
|
6745
|
+
"data-[focus-visible]:shadow-elevation-1",
|
|
6746
|
+
"data-[pressed]:data-[pressed]:shadow-elevation-1"
|
|
6747
|
+
]
|
|
6813
6748
|
},
|
|
6814
6749
|
{
|
|
6815
|
-
chipType: "suggestion",
|
|
6816
6750
|
surface: "elevated",
|
|
6751
|
+
chipType: "suggestion",
|
|
6817
6752
|
className: [
|
|
6818
|
-
"bg-surface-container-low
|
|
6819
|
-
"
|
|
6753
|
+
"bg-surface-container-low border-0 shadow-elevation-1",
|
|
6754
|
+
"data-[hovered]:shadow-elevation-2",
|
|
6755
|
+
"data-[focus-visible]:shadow-elevation-1",
|
|
6756
|
+
"data-[pressed]:data-[pressed]:shadow-elevation-1"
|
|
6820
6757
|
]
|
|
6821
6758
|
},
|
|
6822
|
-
//
|
|
6759
|
+
// Deprecated tonal maps to flat (same as no override)
|
|
6823
6760
|
{
|
|
6761
|
+
surface: "tonal",
|
|
6762
|
+
chipType: "assist",
|
|
6763
|
+
className: ""
|
|
6764
|
+
},
|
|
6765
|
+
{
|
|
6766
|
+
surface: "tonal",
|
|
6824
6767
|
chipType: "filter",
|
|
6825
|
-
|
|
6826
|
-
className: "bg-secondary-container text-on-secondary-container border-0"
|
|
6768
|
+
className: ""
|
|
6827
6769
|
},
|
|
6828
|
-
// ── Disabled overrides — placed last so they always win ────────────────
|
|
6829
|
-
// These must follow all surface/selection compound variants to ensure
|
|
6830
|
-
// tailwind-merge keeps the disabled classes over any surface classes.
|
|
6831
6770
|
{
|
|
6832
|
-
|
|
6833
|
-
|
|
6771
|
+
surface: "tonal",
|
|
6772
|
+
chipType: "input",
|
|
6773
|
+
className: ""
|
|
6774
|
+
},
|
|
6775
|
+
{
|
|
6776
|
+
surface: "tonal",
|
|
6777
|
+
chipType: "suggestion",
|
|
6778
|
+
className: ""
|
|
6834
6779
|
}
|
|
6835
6780
|
],
|
|
6836
6781
|
defaultVariants: {
|
|
6837
6782
|
chipType: "assist",
|
|
6838
|
-
surface: "
|
|
6839
|
-
selected: false,
|
|
6840
|
-
isDisabled: false,
|
|
6841
|
-
hasLeadingIcon: false,
|
|
6842
|
-
hasRemoveButton: false
|
|
6783
|
+
surface: "flat"
|
|
6843
6784
|
}
|
|
6844
6785
|
}
|
|
6845
6786
|
);
|
|
6787
|
+
var chipStateLayerVariants = cva(
|
|
6788
|
+
[
|
|
6789
|
+
"absolute inset-0 rounded-[inherit] overflow-hidden pointer-events-none opacity-0",
|
|
6790
|
+
"transition-opacity duration-spring-standard-fast-effects ease-spring-standard-fast-effects",
|
|
6791
|
+
// Hover: 8%
|
|
6792
|
+
"group-data-[hovered]/chip:opacity-8",
|
|
6793
|
+
// Focus: 10%
|
|
6794
|
+
"group-data-[focus-visible]/chip:opacity-10",
|
|
6795
|
+
// Pressed: 10%, doubled selector wins over hover
|
|
6796
|
+
"group-data-[pressed]/chip:group-data-[pressed]/chip:opacity-10",
|
|
6797
|
+
// No state layer when disabled
|
|
6798
|
+
"group-data-[disabled]/chip:hidden"
|
|
6799
|
+
],
|
|
6800
|
+
{
|
|
6801
|
+
variants: {
|
|
6802
|
+
chipType: {
|
|
6803
|
+
assist: "bg-on-surface",
|
|
6804
|
+
filter: [
|
|
6805
|
+
"bg-on-surface-variant",
|
|
6806
|
+
// Selected: switch to on-secondary-container color
|
|
6807
|
+
"group-data-[selected]/chip:bg-on-secondary-container"
|
|
6808
|
+
],
|
|
6809
|
+
input: "bg-on-surface-variant",
|
|
6810
|
+
suggestion: "bg-on-surface-variant"
|
|
6811
|
+
}
|
|
6812
|
+
},
|
|
6813
|
+
defaultVariants: { chipType: "assist" }
|
|
6814
|
+
}
|
|
6815
|
+
);
|
|
6816
|
+
var chipFocusRingVariants = cva([
|
|
6817
|
+
"pointer-events-none absolute inset-[-3px] rounded-sm",
|
|
6818
|
+
"outline outline-2 outline-offset-0 outline-secondary",
|
|
6819
|
+
"transition-opacity duration-spring-standard-fast-effects ease-spring-standard-fast-effects",
|
|
6820
|
+
"opacity-0",
|
|
6821
|
+
"group-data-[focus-visible]/chip:opacity-100"
|
|
6822
|
+
]);
|
|
6823
|
+
var chipLeadingIconVariants = cva(
|
|
6824
|
+
[
|
|
6825
|
+
"relative z-10 inline-flex shrink-0 items-center justify-center size-[18px]",
|
|
6826
|
+
"transition-colors duration-spring-standard-fast-effects ease-spring-standard-fast-effects",
|
|
6827
|
+
"group-data-[disabled]/chip:text-on-surface/38"
|
|
6828
|
+
],
|
|
6829
|
+
{
|
|
6830
|
+
variants: {
|
|
6831
|
+
chipType: {
|
|
6832
|
+
assist: "text-primary",
|
|
6833
|
+
filter: [
|
|
6834
|
+
"text-on-surface-variant",
|
|
6835
|
+
"group-data-[selected]/chip:text-on-secondary-container"
|
|
6836
|
+
],
|
|
6837
|
+
input: "text-on-surface-variant",
|
|
6838
|
+
suggestion: "text-on-surface-variant"
|
|
6839
|
+
}
|
|
6840
|
+
},
|
|
6841
|
+
defaultVariants: { chipType: "assist" }
|
|
6842
|
+
}
|
|
6843
|
+
);
|
|
6844
|
+
var chipTrailingIconVariants = cva([
|
|
6845
|
+
"relative z-10 inline-flex shrink-0 items-center justify-center size-[18px]",
|
|
6846
|
+
"text-on-surface-variant",
|
|
6847
|
+
"transition-colors duration-spring-standard-fast-effects ease-spring-standard-fast-effects",
|
|
6848
|
+
"group-data-[disabled]/chip:text-on-surface/38"
|
|
6849
|
+
]);
|
|
6850
|
+
var chipCheckmarkVariants = cva([
|
|
6851
|
+
"inline-flex overflow-hidden shrink-0",
|
|
6852
|
+
// Spatial spring for width (moves adjacent text — this is a spatial animation)
|
|
6853
|
+
"transition-[width] duration-spring-standard-fast-spatial ease-spring-standard-fast-spatial",
|
|
6854
|
+
// Collapsed state
|
|
6855
|
+
"w-0",
|
|
6856
|
+
// Expanded state when selected
|
|
6857
|
+
"group-data-[selected]/chip:w-[18px]"
|
|
6858
|
+
]);
|
|
6859
|
+
var chipCheckmarkIconVariants = cva([
|
|
6860
|
+
"inline-flex items-center justify-center size-[18px] shrink-0",
|
|
6861
|
+
"transition-opacity duration-spring-standard-fast-effects ease-spring-standard-fast-effects",
|
|
6862
|
+
"opacity-0",
|
|
6863
|
+
"group-data-[selected]/chip:opacity-100",
|
|
6864
|
+
// Color: on-secondary-container when selected; inherits on-surface-variant at rest (invisible)
|
|
6865
|
+
"text-on-secondary-container",
|
|
6866
|
+
"group-data-[disabled]/chip:text-on-surface/38"
|
|
6867
|
+
]);
|
|
6868
|
+
var chipLabelVariants = cva(["relative z-10 inline-flex items-center"]);
|
|
6869
|
+
var chipRemoveButtonVariants = cva([
|
|
6870
|
+
"relative z-10 inline-flex size-[18px] shrink-0 items-center justify-center",
|
|
6871
|
+
"rounded-full cursor-pointer",
|
|
6872
|
+
"text-on-surface-variant",
|
|
6873
|
+
"group/chip-remove",
|
|
6874
|
+
"transition-colors duration-spring-standard-fast-effects ease-spring-standard-fast-effects",
|
|
6875
|
+
"data-[disabled]:text-on-surface/38 data-[disabled]:cursor-not-allowed data-[disabled]:pointer-events-none"
|
|
6876
|
+
]);
|
|
6877
|
+
var chipRemoveStateLayerVariants = cva([
|
|
6878
|
+
// Slightly larger circle (32dp touch target centered on 18dp icon)
|
|
6879
|
+
"absolute inset-[-7px] rounded-full pointer-events-none opacity-0",
|
|
6880
|
+
"bg-on-surface-variant",
|
|
6881
|
+
"transition-opacity duration-spring-standard-fast-effects ease-spring-standard-fast-effects",
|
|
6882
|
+
"group-data-[hovered]/chip-remove:opacity-8",
|
|
6883
|
+
"group-data-[focus-visible]/chip-remove:opacity-10",
|
|
6884
|
+
"group-data-[pressed]/chip-remove:group-data-[pressed]/chip-remove:opacity-10",
|
|
6885
|
+
"group-data-[disabled]/chip-remove:hidden"
|
|
6886
|
+
]);
|
|
6846
6887
|
var CloseIcon2 = () => /* @__PURE__ */ jsx(
|
|
6847
6888
|
"svg",
|
|
6848
6889
|
{
|
|
@@ -6867,22 +6908,11 @@ var CheckIcon2 = () => /* @__PURE__ */ jsx(
|
|
|
6867
6908
|
children: /* @__PURE__ */ jsx("path", { d: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z" })
|
|
6868
6909
|
}
|
|
6869
6910
|
);
|
|
6870
|
-
var StateLayer = () => /* @__PURE__ */ jsx(
|
|
6871
|
-
"span",
|
|
6872
|
-
{
|
|
6873
|
-
"aria-hidden": "true",
|
|
6874
|
-
className: cn(
|
|
6875
|
-
"bg-on-surface pointer-events-none absolute inset-0 rounded-sm opacity-0",
|
|
6876
|
-
"duration-spring-standard-fast-effects ease-spring-standard-fast-effects transition-opacity",
|
|
6877
|
-
"group-focus-within:opacity-12 group-hover:opacity-8 group-active:opacity-12"
|
|
6878
|
-
)
|
|
6879
|
-
}
|
|
6880
|
-
);
|
|
6881
6911
|
var Chip = forwardRef(
|
|
6882
6912
|
({
|
|
6883
6913
|
type,
|
|
6884
6914
|
label,
|
|
6885
|
-
surface = "
|
|
6915
|
+
surface: surfaceProp = "flat",
|
|
6886
6916
|
selected,
|
|
6887
6917
|
defaultSelected,
|
|
6888
6918
|
onSelectionChange,
|
|
@@ -6893,6 +6923,17 @@ var Chip = forwardRef(
|
|
|
6893
6923
|
isDisabled = false,
|
|
6894
6924
|
className
|
|
6895
6925
|
}, ref) => {
|
|
6926
|
+
const surface = (() => {
|
|
6927
|
+
if (surfaceProp === "tonal") {
|
|
6928
|
+
if (process.env.NODE_ENV !== "production") {
|
|
6929
|
+
console.warn(
|
|
6930
|
+
'[Chip] surface="tonal" is deprecated. Use surface="flat" instead. "tonal" will be removed in a future minor version.'
|
|
6931
|
+
);
|
|
6932
|
+
}
|
|
6933
|
+
return "flat";
|
|
6934
|
+
}
|
|
6935
|
+
return surfaceProp;
|
|
6936
|
+
})();
|
|
6896
6937
|
const [localSelected, setLocalSelected] = useState(defaultSelected ?? false);
|
|
6897
6938
|
const isControlled = selected !== void 0;
|
|
6898
6939
|
const effectiveSelected = type === "filter" ? isControlled ? selected : localSelected : false;
|
|
@@ -6905,8 +6946,16 @@ var Chip = forwardRef(
|
|
|
6905
6946
|
},
|
|
6906
6947
|
[isControlled, onSelectionChange]
|
|
6907
6948
|
);
|
|
6949
|
+
const [isPressed, setIsPressed] = useState(false);
|
|
6950
|
+
const handlePressStart = useCallback(() => setIsPressed(true), []);
|
|
6951
|
+
const handlePressEnd = useCallback(() => setIsPressed(false), []);
|
|
6952
|
+
const { isHovered, hoverProps } = useHover({ isDisabled });
|
|
6953
|
+
const { isFocusVisible, focusProps } = useFocusRing();
|
|
6954
|
+
const [isRemovePressed, setIsRemovePressed] = useState(false);
|
|
6955
|
+
const { isHovered: isRemoveHovered, hoverProps: removeHoverProps } = useHover({ isDisabled });
|
|
6956
|
+
const { isFocusVisible: isRemoveFocusVisible, focusProps: removeFocusProps } = useFocusRing();
|
|
6908
6957
|
const { onMouseDown: handleRipple, ripples } = useRipple({ disabled: isDisabled });
|
|
6909
|
-
const hasLeadingIcon = Boolean(leadingIcon);
|
|
6958
|
+
const hasLeadingIcon = Boolean(leadingIcon) || type === "filter";
|
|
6910
6959
|
const [isRemoving, setIsRemoving] = useState(false);
|
|
6911
6960
|
const handleRemove = useCallback(() => {
|
|
6912
6961
|
setIsRemoving(true);
|
|
@@ -6916,35 +6965,38 @@ var Chip = forwardRef(
|
|
|
6916
6965
|
onRemove?.();
|
|
6917
6966
|
}
|
|
6918
6967
|
}, [isRemoving, onRemove]);
|
|
6919
|
-
const
|
|
6920
|
-
|
|
6921
|
-
|
|
6922
|
-
|
|
6923
|
-
|
|
6924
|
-
|
|
6925
|
-
|
|
6926
|
-
|
|
6927
|
-
}),
|
|
6928
|
-
className
|
|
6929
|
-
);
|
|
6968
|
+
const bodyDataAttrs = getInteractionDataAttributes({
|
|
6969
|
+
isHovered,
|
|
6970
|
+
isFocusVisible,
|
|
6971
|
+
isPressed,
|
|
6972
|
+
...type === "filter" && { isSelected: effectiveSelected },
|
|
6973
|
+
isDisabled
|
|
6974
|
+
});
|
|
6975
|
+
const rootClass = cn(chipVariants({ chipType: type, surface }), "group/chip", className);
|
|
6930
6976
|
if (type === "input") {
|
|
6977
|
+
const removeDataAttrs = getInteractionDataAttributes({
|
|
6978
|
+
isHovered: isRemoveHovered,
|
|
6979
|
+
isFocusVisible: isRemoveFocusVisible,
|
|
6980
|
+
isPressed: isRemovePressed,
|
|
6981
|
+
isDisabled
|
|
6982
|
+
});
|
|
6931
6983
|
return /* @__PURE__ */ jsxs(
|
|
6932
6984
|
"span",
|
|
6933
6985
|
{
|
|
6934
6986
|
className: cn(
|
|
6935
|
-
chipVariants({
|
|
6936
|
-
|
|
6937
|
-
isDisabled,
|
|
6938
|
-
hasLeadingIcon,
|
|
6939
|
-
hasRemoveButton: true
|
|
6940
|
-
}),
|
|
6987
|
+
chipVariants({ chipType: "input", surface }),
|
|
6988
|
+
"group/chip",
|
|
6941
6989
|
isRemoving && "animate-md-fade-out",
|
|
6942
6990
|
className
|
|
6943
6991
|
),
|
|
6992
|
+
...bodyDataAttrs,
|
|
6993
|
+
"data-with-leading": hasLeadingIcon ? "" : void 0,
|
|
6994
|
+
"data-with-trailing": "",
|
|
6944
6995
|
onAnimationEnd: handleAnimationEnd,
|
|
6945
6996
|
children: [
|
|
6946
6997
|
ripples,
|
|
6947
|
-
/* @__PURE__ */ jsx(
|
|
6998
|
+
/* @__PURE__ */ jsx("span", { className: cn(chipStateLayerVariants({ chipType: "input" })), "aria-hidden": "true" }),
|
|
6999
|
+
/* @__PURE__ */ jsx("span", { className: cn(chipFocusRingVariants()), "aria-hidden": "true" }),
|
|
6948
7000
|
/* @__PURE__ */ jsxs(
|
|
6949
7001
|
ChipHeadless,
|
|
6950
7002
|
{
|
|
@@ -6953,20 +7005,40 @@ var Chip = forwardRef(
|
|
|
6953
7005
|
isDisabled,
|
|
6954
7006
|
onRemove: handleRemove,
|
|
6955
7007
|
onMouseDown: handleRipple,
|
|
6956
|
-
|
|
6957
|
-
|
|
7008
|
+
removeButtonClassName: cn(chipRemoveButtonVariants()),
|
|
7009
|
+
removeIcon: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7010
|
+
/* @__PURE__ */ jsx(
|
|
7011
|
+
"span",
|
|
7012
|
+
{
|
|
7013
|
+
className: cn(chipRemoveStateLayerVariants()),
|
|
7014
|
+
"aria-hidden": "true",
|
|
7015
|
+
...{ "data-remove-state-layer": "" }
|
|
7016
|
+
}
|
|
7017
|
+
),
|
|
7018
|
+
/* @__PURE__ */ jsx(CloseIcon2, {})
|
|
7019
|
+
] }),
|
|
6958
7020
|
ref,
|
|
6959
7021
|
className: "contents",
|
|
7022
|
+
bodyPassthrough: {
|
|
7023
|
+
onPressStart: handlePressStart,
|
|
7024
|
+
onPressEnd: handlePressEnd
|
|
7025
|
+
},
|
|
7026
|
+
removePassthrough: {
|
|
7027
|
+
dataAttributes: removeDataAttrs,
|
|
7028
|
+
eventHandlers: mergeProps$1(removeHoverProps, removeFocusProps),
|
|
7029
|
+
onPressStart: () => setIsRemovePressed(true),
|
|
7030
|
+
onPressEnd: () => setIsRemovePressed(false)
|
|
7031
|
+
},
|
|
6960
7032
|
children: [
|
|
6961
7033
|
leadingIcon && /* @__PURE__ */ jsx(
|
|
6962
7034
|
"span",
|
|
6963
7035
|
{
|
|
6964
7036
|
"aria-hidden": "true",
|
|
6965
|
-
className:
|
|
7037
|
+
className: cn(chipLeadingIconVariants({ chipType: "input" })),
|
|
6966
7038
|
children: leadingIcon
|
|
6967
7039
|
}
|
|
6968
7040
|
),
|
|
6969
|
-
/* @__PURE__ */ jsx("span", { className:
|
|
7041
|
+
/* @__PURE__ */ jsx("span", { className: cn(chipLabelVariants()), children: label })
|
|
6970
7042
|
]
|
|
6971
7043
|
}
|
|
6972
7044
|
)
|
|
@@ -6987,37 +7059,21 @@ var Chip = forwardRef(
|
|
|
6987
7059
|
...type !== "filter" && onPress !== void 0 && { onPress },
|
|
6988
7060
|
isDisabled,
|
|
6989
7061
|
onMouseDown: handleRipple,
|
|
6990
|
-
className:
|
|
7062
|
+
className: cn(rootClass),
|
|
7063
|
+
bodyPassthrough: {
|
|
7064
|
+
dataAttributes: bodyDataAttrs,
|
|
7065
|
+
onPressStart: handlePressStart,
|
|
7066
|
+
onPressEnd: handlePressEnd,
|
|
7067
|
+
eventHandlers: mergeProps$1(hoverProps, focusProps)
|
|
7068
|
+
},
|
|
6991
7069
|
children: [
|
|
6992
7070
|
ripples,
|
|
6993
|
-
/* @__PURE__ */ jsx(
|
|
6994
|
-
|
|
6995
|
-
|
|
6996
|
-
|
|
6997
|
-
|
|
6998
|
-
|
|
6999
|
-
effectiveSelected ? "w-4.5 opacity-100" : "w-0 opacity-0"
|
|
7000
|
-
),
|
|
7001
|
-
children: /* @__PURE__ */ jsx(CheckIcon2, {})
|
|
7002
|
-
}
|
|
7003
|
-
),
|
|
7004
|
-
leadingIcon && /* @__PURE__ */ jsx(
|
|
7005
|
-
"span",
|
|
7006
|
-
{
|
|
7007
|
-
"aria-hidden": "true",
|
|
7008
|
-
className: "relative z-10 inline-flex size-4.5 shrink-0 items-center",
|
|
7009
|
-
children: leadingIcon
|
|
7010
|
-
}
|
|
7011
|
-
),
|
|
7012
|
-
/* @__PURE__ */ jsx("span", { className: "relative z-10", children: label }),
|
|
7013
|
-
trailingIcon && /* @__PURE__ */ jsx(
|
|
7014
|
-
"span",
|
|
7015
|
-
{
|
|
7016
|
-
"aria-hidden": "true",
|
|
7017
|
-
className: "relative z-10 inline-flex size-4.5 shrink-0 items-center",
|
|
7018
|
-
children: trailingIcon
|
|
7019
|
-
}
|
|
7020
|
-
)
|
|
7071
|
+
/* @__PURE__ */ jsx("span", { className: cn(chipStateLayerVariants({ chipType: type })), "aria-hidden": "true" }),
|
|
7072
|
+
/* @__PURE__ */ jsx("span", { className: cn(chipFocusRingVariants()), "aria-hidden": "true" }),
|
|
7073
|
+
type === "filter" && /* @__PURE__ */ jsx("span", { className: cn(chipCheckmarkVariants()), "aria-hidden": "true", children: /* @__PURE__ */ jsx("span", { className: cn(chipCheckmarkIconVariants()), children: /* @__PURE__ */ jsx(CheckIcon2, {}) }) }),
|
|
7074
|
+
leadingIcon && /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: cn(chipLeadingIconVariants({ chipType: type })), children: leadingIcon }),
|
|
7075
|
+
/* @__PURE__ */ jsx("span", { className: cn(chipLabelVariants()), children: label }),
|
|
7076
|
+
trailingIcon && /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: cn(chipTrailingIconVariants()), children: trailingIcon })
|
|
7021
7077
|
]
|
|
7022
7078
|
}
|
|
7023
7079
|
);
|