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