@tinybigui/react 0.20.0 → 0.21.1
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 +488 -174
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +291 -113
- package/dist/index.d.ts +291 -113
- package/dist/index.js +481 -173
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8208,7 +8208,8 @@ function TooltipOverlayHeadless({
|
|
|
8208
8208
|
}
|
|
8209
8209
|
var TooltipAnimationContext = createContext({
|
|
8210
8210
|
isExiting: false,
|
|
8211
|
-
onAnimationEnd: () => void 0
|
|
8211
|
+
onAnimationEnd: () => void 0,
|
|
8212
|
+
reducedMotion: false
|
|
8212
8213
|
});
|
|
8213
8214
|
function useTooltipAnimation() {
|
|
8214
8215
|
return useContext(TooltipAnimationContext);
|
|
@@ -8218,46 +8219,60 @@ function TooltipTrigger({
|
|
|
8218
8219
|
delay = 300,
|
|
8219
8220
|
isDisabled
|
|
8220
8221
|
}) {
|
|
8222
|
+
const reducedMotion = useReducedMotion();
|
|
8221
8223
|
const [isMounted, setIsMounted] = useState(false);
|
|
8222
8224
|
const [isExiting, setIsExiting] = useState(false);
|
|
8223
8225
|
const isExitingRef = useRef(false);
|
|
8224
8226
|
const isPointerOverTooltipRef = useRef(false);
|
|
8225
8227
|
const pendingCloseRef = useRef(false);
|
|
8226
|
-
const
|
|
8227
|
-
if (open) {
|
|
8228
|
-
pendingCloseRef.current = false;
|
|
8229
|
-
isExitingRef.current = false;
|
|
8230
|
-
setIsMounted(true);
|
|
8231
|
-
setIsExiting(false);
|
|
8232
|
-
} else if (isPointerOverTooltipRef.current) {
|
|
8233
|
-
pendingCloseRef.current = true;
|
|
8234
|
-
} else if (!isExitingRef.current) {
|
|
8235
|
-
isExitingRef.current = true;
|
|
8236
|
-
setIsExiting(true);
|
|
8237
|
-
}
|
|
8238
|
-
}, []);
|
|
8239
|
-
const handleAnimationEnd = useCallback(() => {
|
|
8240
|
-
if (!isExitingRef.current) return;
|
|
8228
|
+
const unmountImmediately = useCallback(() => {
|
|
8241
8229
|
isExitingRef.current = false;
|
|
8242
8230
|
pendingCloseRef.current = false;
|
|
8243
8231
|
setIsMounted(false);
|
|
8244
8232
|
setIsExiting(false);
|
|
8245
8233
|
}, []);
|
|
8234
|
+
const handleOpenChange = useCallback(
|
|
8235
|
+
(open) => {
|
|
8236
|
+
if (open) {
|
|
8237
|
+
pendingCloseRef.current = false;
|
|
8238
|
+
isExitingRef.current = false;
|
|
8239
|
+
setIsMounted(true);
|
|
8240
|
+
setIsExiting(false);
|
|
8241
|
+
} else if (isPointerOverTooltipRef.current) {
|
|
8242
|
+
pendingCloseRef.current = true;
|
|
8243
|
+
} else if (reducedMotion) {
|
|
8244
|
+
unmountImmediately();
|
|
8245
|
+
} else if (!isExitingRef.current) {
|
|
8246
|
+
isExitingRef.current = true;
|
|
8247
|
+
setIsExiting(true);
|
|
8248
|
+
}
|
|
8249
|
+
},
|
|
8250
|
+
[reducedMotion, unmountImmediately]
|
|
8251
|
+
);
|
|
8252
|
+
const handleAnimationEnd = useCallback(() => {
|
|
8253
|
+
if (!isExitingRef.current) return;
|
|
8254
|
+
unmountImmediately();
|
|
8255
|
+
}, [unmountImmediately]);
|
|
8246
8256
|
const handleOverlayPointerEnter = useCallback(() => {
|
|
8247
8257
|
isPointerOverTooltipRef.current = true;
|
|
8248
8258
|
pendingCloseRef.current = false;
|
|
8249
8259
|
}, []);
|
|
8250
8260
|
const handleOverlayPointerLeave = useCallback(() => {
|
|
8251
8261
|
isPointerOverTooltipRef.current = false;
|
|
8252
|
-
if (pendingCloseRef.current
|
|
8262
|
+
if (pendingCloseRef.current) {
|
|
8253
8263
|
pendingCloseRef.current = false;
|
|
8254
|
-
|
|
8255
|
-
|
|
8264
|
+
if (reducedMotion) {
|
|
8265
|
+
unmountImmediately();
|
|
8266
|
+
} else if (!isExitingRef.current) {
|
|
8267
|
+
isExitingRef.current = true;
|
|
8268
|
+
setIsExiting(true);
|
|
8269
|
+
}
|
|
8256
8270
|
}
|
|
8257
|
-
}, []);
|
|
8271
|
+
}, [reducedMotion, unmountImmediately]);
|
|
8258
8272
|
const contextValue = {
|
|
8259
8273
|
isExiting,
|
|
8260
|
-
onAnimationEnd: handleAnimationEnd
|
|
8274
|
+
onAnimationEnd: handleAnimationEnd,
|
|
8275
|
+
reducedMotion
|
|
8261
8276
|
};
|
|
8262
8277
|
const [triggerChild, tooltipChild] = children;
|
|
8263
8278
|
const placement = isValidElement(tooltipChild) ? tooltipChild.props.placement ?? "top" : "top";
|
|
@@ -8286,51 +8301,69 @@ function TooltipTrigger({
|
|
|
8286
8301
|
) });
|
|
8287
8302
|
}
|
|
8288
8303
|
var tooltipVariants = cva(
|
|
8289
|
-
|
|
8304
|
+
[
|
|
8305
|
+
"z-50 inline-flex items-center w-fit",
|
|
8306
|
+
"min-h-6 rounded-xs px-2 py-1",
|
|
8307
|
+
"text-body-small bg-inverse-surface text-inverse-on-surface",
|
|
8308
|
+
"max-w-50"
|
|
8309
|
+
],
|
|
8290
8310
|
{
|
|
8291
8311
|
variants: {
|
|
8292
8312
|
/**
|
|
8293
|
-
*
|
|
8313
|
+
* Controls the enter/exit animation class.
|
|
8294
8314
|
* Managed by `TooltipTrigger`'s animation state machine.
|
|
8295
|
-
*
|
|
8315
|
+
* Set to `"none"` when `prefers-reduced-motion: reduce` is active.
|
|
8316
|
+
* @default "enter"
|
|
8296
8317
|
*/
|
|
8297
|
-
|
|
8298
|
-
|
|
8299
|
-
|
|
8318
|
+
animation: {
|
|
8319
|
+
enter: "animate-md-scale-in",
|
|
8320
|
+
exit: "animate-md-scale-out",
|
|
8321
|
+
none: ""
|
|
8300
8322
|
}
|
|
8301
8323
|
},
|
|
8302
8324
|
defaultVariants: {
|
|
8303
|
-
|
|
8325
|
+
animation: "enter"
|
|
8304
8326
|
}
|
|
8305
8327
|
}
|
|
8306
8328
|
);
|
|
8307
8329
|
var richTooltipVariants = cva(
|
|
8308
|
-
|
|
8330
|
+
[
|
|
8331
|
+
"z-50 flex flex-col w-fit",
|
|
8332
|
+
"min-h-6 rounded-md px-4 py-3",
|
|
8333
|
+
"bg-surface-container text-on-surface shadow-elevation-2",
|
|
8334
|
+
"max-w-80"
|
|
8335
|
+
],
|
|
8309
8336
|
{
|
|
8310
8337
|
variants: {
|
|
8311
8338
|
/**
|
|
8312
|
-
*
|
|
8339
|
+
* Controls the enter/exit animation class.
|
|
8313
8340
|
* Managed by `TooltipTrigger`'s animation state machine.
|
|
8314
|
-
*
|
|
8341
|
+
* Set to `"none"` when `prefers-reduced-motion: reduce` is active.
|
|
8342
|
+
* @default "enter"
|
|
8315
8343
|
*/
|
|
8316
|
-
|
|
8317
|
-
|
|
8318
|
-
|
|
8344
|
+
animation: {
|
|
8345
|
+
enter: "animate-md-scale-in",
|
|
8346
|
+
exit: "animate-md-scale-out",
|
|
8347
|
+
none: ""
|
|
8319
8348
|
}
|
|
8320
8349
|
},
|
|
8321
8350
|
defaultVariants: {
|
|
8322
|
-
|
|
8351
|
+
animation: "enter"
|
|
8323
8352
|
}
|
|
8324
8353
|
}
|
|
8325
8354
|
);
|
|
8355
|
+
var richTooltipTitleVariants = cva(["text-title-small text-on-surface-variant mb-1"]);
|
|
8356
|
+
var richTooltipSupportingTextVariants = cva(["text-body-medium text-on-surface-variant"]);
|
|
8357
|
+
var richTooltipActionsVariants = cva(["flex items-center justify-start mt-3 -ml-2"]);
|
|
8326
8358
|
var Tooltip = forwardRef(
|
|
8327
8359
|
({ children, className, placement: _placement }, ref) => {
|
|
8328
|
-
const { isExiting, onAnimationEnd } = useTooltipAnimation();
|
|
8360
|
+
const { isExiting, onAnimationEnd, reducedMotion } = useTooltipAnimation();
|
|
8361
|
+
const animation = reducedMotion ? "none" : isExiting ? "exit" : "enter";
|
|
8329
8362
|
return /* @__PURE__ */ jsx(
|
|
8330
8363
|
"div",
|
|
8331
8364
|
{
|
|
8332
8365
|
ref,
|
|
8333
|
-
className: cn(tooltipVariants({
|
|
8366
|
+
className: cn(tooltipVariants({ animation }), className),
|
|
8334
8367
|
onAnimationEnd,
|
|
8335
8368
|
children
|
|
8336
8369
|
}
|
|
@@ -8340,17 +8373,18 @@ var Tooltip = forwardRef(
|
|
|
8340
8373
|
Tooltip.displayName = "Tooltip";
|
|
8341
8374
|
var RichTooltip = forwardRef(
|
|
8342
8375
|
({ title, children, action, className, placement: _placement }, ref) => {
|
|
8343
|
-
const { isExiting, onAnimationEnd } = useTooltipAnimation();
|
|
8376
|
+
const { isExiting, onAnimationEnd, reducedMotion } = useTooltipAnimation();
|
|
8377
|
+
const animation = reducedMotion ? "none" : isExiting ? "exit" : "enter";
|
|
8344
8378
|
return /* @__PURE__ */ jsxs(
|
|
8345
8379
|
"div",
|
|
8346
8380
|
{
|
|
8347
8381
|
ref,
|
|
8348
|
-
className: cn(richTooltipVariants({
|
|
8382
|
+
className: cn(richTooltipVariants({ animation }), className),
|
|
8349
8383
|
onAnimationEnd,
|
|
8350
8384
|
children: [
|
|
8351
|
-
title && /* @__PURE__ */ jsx("p", { className:
|
|
8352
|
-
/* @__PURE__ */ jsx("p", { className:
|
|
8353
|
-
action
|
|
8385
|
+
title && /* @__PURE__ */ jsx("p", { className: richTooltipTitleVariants(), children: title }),
|
|
8386
|
+
/* @__PURE__ */ jsx("p", { className: richTooltipSupportingTextVariants(), children }),
|
|
8387
|
+
action && /* @__PURE__ */ jsx("div", { className: richTooltipActionsVariants(), children: action })
|
|
8354
8388
|
]
|
|
8355
8389
|
}
|
|
8356
8390
|
);
|
|
@@ -9627,105 +9661,354 @@ var Badge = forwardRef(
|
|
|
9627
9661
|
}
|
|
9628
9662
|
);
|
|
9629
9663
|
Badge.displayName = "Badge";
|
|
9630
|
-
var splitButtonContainerVariants = cva(
|
|
9631
|
-
|
|
9664
|
+
var splitButtonContainerVariants = cva([
|
|
9665
|
+
"relative inline-flex items-stretch",
|
|
9666
|
+
"gap-0.5"
|
|
9667
|
+
// MD3 2dp gap between segments
|
|
9668
|
+
]);
|
|
9669
|
+
var splitButtonLeadingVariants = cva(
|
|
9670
|
+
[
|
|
9671
|
+
// Layout
|
|
9672
|
+
"group/sb-leading relative inline-flex items-center justify-center",
|
|
9673
|
+
"cursor-pointer select-none",
|
|
9674
|
+
// Shape — asymmetric corners via CSS variable
|
|
9675
|
+
"rounded-tl-full rounded-bl-full",
|
|
9676
|
+
"rounded-tr-[var(--sb-inner-radius,var(--radius-xs))]",
|
|
9677
|
+
"rounded-br-[var(--sb-inner-radius,var(--radius-xs))]",
|
|
9678
|
+
// Inner-corner morph — xs/sm/md defaults; lg/xl override in size variants below.
|
|
9679
|
+
// Specificity ladder: rest (0,0,0) < hover (0,1,0) < focus (0,2,0) < pressed (0,3,0)
|
|
9680
|
+
"[--sb-inner-radius:var(--radius-xs)]",
|
|
9681
|
+
"data-[hovered]:[--sb-inner-radius:var(--radius-sm)]",
|
|
9682
|
+
"data-[focus-visible]:data-[focus-visible]:[--sb-inner-radius:var(--radius-sm)]",
|
|
9683
|
+
// Pressed morphs stronger than hover/focus — tripled selector → (0,3,0)
|
|
9684
|
+
"data-[pressed]:data-[pressed]:data-[pressed]:[--sb-inner-radius:var(--radius-lg)]",
|
|
9685
|
+
// Spatial transition for border-radius morphing
|
|
9686
|
+
"transition-[border-radius]",
|
|
9687
|
+
"duration-expressive-fast-spatial ease-expressive-fast-spatial",
|
|
9688
|
+
// Disabled — self-targeting
|
|
9689
|
+
"data-[disabled]:cursor-not-allowed data-[disabled]:pointer-events-none"
|
|
9690
|
+
],
|
|
9632
9691
|
{
|
|
9633
9692
|
variants: {
|
|
9693
|
+
/**
|
|
9694
|
+
* Visual variant — controls container color, text color, and elevation.
|
|
9695
|
+
* State layer color is handled in splitButtonStateLayerVariants.
|
|
9696
|
+
*/
|
|
9634
9697
|
variant: {
|
|
9635
|
-
|
|
9636
|
-
|
|
9637
|
-
|
|
9698
|
+
/**
|
|
9699
|
+
* Filled — highest emphasis.
|
|
9700
|
+
* container=primary, label=on-primary
|
|
9701
|
+
* Elevation: 0 base → 1 hover → 0 focus/pressed
|
|
9702
|
+
*/
|
|
9703
|
+
filled: [
|
|
9704
|
+
"bg-primary text-on-primary shadow-none",
|
|
9705
|
+
"group-data-[hovered]/sb-leading:shadow-elevation-1",
|
|
9706
|
+
"group-data-[focus-visible]/sb-leading:shadow-none",
|
|
9707
|
+
"group-data-[pressed]/sb-leading:group-data-[pressed]/sb-leading:shadow-none",
|
|
9708
|
+
// Disabled
|
|
9709
|
+
"data-[disabled]:bg-on-surface/12 data-[disabled]:text-on-surface/38 data-[disabled]:shadow-none"
|
|
9710
|
+
],
|
|
9711
|
+
/**
|
|
9712
|
+
* Tonal — secondary emphasis.
|
|
9713
|
+
* container=secondary-container, label=on-secondary-container
|
|
9714
|
+
* Elevation: 0 base → 1 hover → 0 focus/pressed
|
|
9715
|
+
*/
|
|
9716
|
+
tonal: [
|
|
9717
|
+
"bg-secondary-container text-on-secondary-container shadow-none",
|
|
9718
|
+
"group-data-[hovered]/sb-leading:shadow-elevation-1",
|
|
9719
|
+
"group-data-[focus-visible]/sb-leading:shadow-none",
|
|
9720
|
+
"group-data-[pressed]/sb-leading:group-data-[pressed]/sb-leading:shadow-none",
|
|
9721
|
+
// Disabled
|
|
9722
|
+
"data-[disabled]:bg-on-surface/12 data-[disabled]:text-on-surface/38 data-[disabled]:shadow-none"
|
|
9723
|
+
],
|
|
9724
|
+
/**
|
|
9725
|
+
* Outlined — medium emphasis. Transparent with border.
|
|
9726
|
+
* container=transparent, border=outline, label=primary
|
|
9727
|
+
* Elevation: always 0
|
|
9728
|
+
*/
|
|
9729
|
+
outlined: [
|
|
9730
|
+
"bg-transparent border border-outline text-primary",
|
|
9731
|
+
// Disabled
|
|
9732
|
+
"data-[disabled]:border-on-surface/12 data-[disabled]:text-on-surface/38"
|
|
9733
|
+
],
|
|
9734
|
+
/**
|
|
9735
|
+
* Elevated — uses surface-container-low with a level-1 shadow base.
|
|
9736
|
+
* container=surface-container-low, label=primary
|
|
9737
|
+
* Elevation: 1 base → 2 hover → 1 focus/pressed
|
|
9738
|
+
*/
|
|
9739
|
+
elevated: [
|
|
9740
|
+
"bg-surface-container-low text-primary shadow-elevation-1",
|
|
9741
|
+
"group-data-[hovered]/sb-leading:shadow-elevation-2",
|
|
9742
|
+
"group-data-[focus-visible]/sb-leading:shadow-elevation-1",
|
|
9743
|
+
"group-data-[pressed]/sb-leading:group-data-[pressed]/sb-leading:shadow-elevation-1",
|
|
9744
|
+
// Disabled
|
|
9745
|
+
"data-[disabled]:bg-on-surface/12 data-[disabled]:text-on-surface/38 data-[disabled]:shadow-none"
|
|
9746
|
+
]
|
|
9638
9747
|
},
|
|
9748
|
+
/**
|
|
9749
|
+
* Size — governs height, horizontal padding, typography, and inner-corner rest/morph values.
|
|
9750
|
+
* lg/xl need larger rest radii so their morph steps differ from xs/sm/md.
|
|
9751
|
+
*/
|
|
9639
9752
|
size: {
|
|
9640
|
-
|
|
9641
|
-
|
|
9642
|
-
|
|
9643
|
-
|
|
9644
|
-
|
|
9645
|
-
|
|
9646
|
-
|
|
9753
|
+
xs: "h-8 pl-4 pr-3 text-label-large",
|
|
9754
|
+
sm: "h-10 pl-6 pr-4 text-label-large",
|
|
9755
|
+
md: "h-14 pl-8 pr-6 text-title-medium",
|
|
9756
|
+
lg: [
|
|
9757
|
+
"h-24 pl-10 pr-8 text-headline-small",
|
|
9758
|
+
// lg rest=sm, hover/focus→lg, pressed→xl
|
|
9759
|
+
"[--sb-inner-radius:var(--radius-sm)]",
|
|
9760
|
+
"data-[hovered]:[--sb-inner-radius:var(--radius-lg)]",
|
|
9761
|
+
"data-[focus-visible]:data-[focus-visible]:[--sb-inner-radius:var(--radius-lg)]",
|
|
9762
|
+
"data-[pressed]:data-[pressed]:data-[pressed]:[--sb-inner-radius:var(--radius-xl)]"
|
|
9763
|
+
],
|
|
9764
|
+
xl: [
|
|
9765
|
+
"h-[8.5rem] pl-12 pr-10 text-headline-large",
|
|
9766
|
+
// xl rest=md, hover/focus→lg, pressed→xl
|
|
9767
|
+
"[--sb-inner-radius:var(--radius-md)]",
|
|
9768
|
+
"data-[hovered]:[--sb-inner-radius:var(--radius-lg)]",
|
|
9769
|
+
"data-[focus-visible]:data-[focus-visible]:[--sb-inner-radius:var(--radius-lg)]",
|
|
9770
|
+
"data-[pressed]:data-[pressed]:data-[pressed]:[--sb-inner-radius:var(--radius-xl)]"
|
|
9771
|
+
]
|
|
9647
9772
|
}
|
|
9648
9773
|
},
|
|
9649
9774
|
defaultVariants: {
|
|
9650
9775
|
variant: "filled",
|
|
9651
|
-
size: "
|
|
9652
|
-
isDisabled: false
|
|
9776
|
+
size: "sm"
|
|
9653
9777
|
}
|
|
9654
9778
|
}
|
|
9655
9779
|
);
|
|
9656
|
-
var
|
|
9780
|
+
var splitButtonTrailingVariants = cva(
|
|
9657
9781
|
[
|
|
9658
|
-
|
|
9659
|
-
"
|
|
9660
|
-
"
|
|
9782
|
+
// Layout — square so that selected (rounded-full on all corners) = perfect circle
|
|
9783
|
+
"group/sb-trailing relative inline-flex items-center justify-center shrink-0",
|
|
9784
|
+
"cursor-pointer select-none",
|
|
9785
|
+
// Shape — asymmetric corners, inner on the left side
|
|
9786
|
+
"rounded-tr-full rounded-br-full",
|
|
9787
|
+
"rounded-tl-[var(--sb-inner-radius,var(--radius-xs))]",
|
|
9788
|
+
"rounded-bl-[var(--sb-inner-radius,var(--radius-xs))]",
|
|
9789
|
+
// Inner-corner morph — xs/sm/md defaults; lg/xl override in size variants below.
|
|
9790
|
+
// Specificity ladder: rest (0,0,0) < hover (0,1,0) < focus (0,2,0) < pressed (0,3,0) < selected (0,4,0)
|
|
9791
|
+
"[--sb-inner-radius:var(--radius-xs)]",
|
|
9792
|
+
"data-[hovered]:[--sb-inner-radius:var(--radius-sm)]",
|
|
9793
|
+
"data-[focus-visible]:data-[focus-visible]:[--sb-inner-radius:var(--radius-sm)]",
|
|
9794
|
+
// Pressed morphs stronger than hover/focus — tripled → (0,3,0)
|
|
9795
|
+
"data-[pressed]:data-[pressed]:data-[pressed]:[--sb-inner-radius:var(--radius-lg)]",
|
|
9796
|
+
// Selected (menu open) → full circle; quadrupled → (0,4,0) always wins
|
|
9797
|
+
"data-[selected]:data-[selected]:data-[selected]:data-[selected]:[--sb-inner-radius:var(--radius-full)]",
|
|
9798
|
+
// Spatial transition for border-radius morphing
|
|
9799
|
+
"transition-[border-radius]",
|
|
9800
|
+
"duration-expressive-fast-spatial ease-expressive-fast-spatial",
|
|
9801
|
+
// Disabled — self-targeting
|
|
9802
|
+
"data-[disabled]:cursor-not-allowed data-[disabled]:pointer-events-none"
|
|
9661
9803
|
],
|
|
9662
9804
|
{
|
|
9663
9805
|
variants: {
|
|
9664
9806
|
variant: {
|
|
9665
|
-
filled:
|
|
9666
|
-
|
|
9667
|
-
|
|
9807
|
+
filled: [
|
|
9808
|
+
"bg-primary text-on-primary shadow-none",
|
|
9809
|
+
"group-data-[hovered]/sb-trailing:shadow-elevation-1",
|
|
9810
|
+
"group-data-[focus-visible]/sb-trailing:shadow-none",
|
|
9811
|
+
"group-data-[pressed]/sb-trailing:group-data-[pressed]/sb-trailing:shadow-none",
|
|
9812
|
+
"data-[disabled]:bg-on-surface/12 data-[disabled]:text-on-surface/38 data-[disabled]:shadow-none"
|
|
9813
|
+
],
|
|
9814
|
+
tonal: [
|
|
9815
|
+
"bg-secondary-container text-on-secondary-container shadow-none",
|
|
9816
|
+
"group-data-[hovered]/sb-trailing:shadow-elevation-1",
|
|
9817
|
+
"group-data-[focus-visible]/sb-trailing:shadow-none",
|
|
9818
|
+
"group-data-[pressed]/sb-trailing:group-data-[pressed]/sb-trailing:shadow-none",
|
|
9819
|
+
"data-[disabled]:bg-on-surface/12 data-[disabled]:text-on-surface/38 data-[disabled]:shadow-none"
|
|
9820
|
+
],
|
|
9821
|
+
outlined: [
|
|
9822
|
+
"bg-transparent border border-outline text-primary",
|
|
9823
|
+
"data-[disabled]:border-on-surface/12 data-[disabled]:text-on-surface/38"
|
|
9824
|
+
],
|
|
9825
|
+
elevated: [
|
|
9826
|
+
"bg-surface-container-low text-primary shadow-elevation-1",
|
|
9827
|
+
"group-data-[hovered]/sb-trailing:shadow-elevation-2",
|
|
9828
|
+
"group-data-[focus-visible]/sb-trailing:shadow-elevation-1",
|
|
9829
|
+
"group-data-[pressed]/sb-trailing:group-data-[pressed]/sb-trailing:shadow-elevation-1",
|
|
9830
|
+
"data-[disabled]:bg-on-surface/12 data-[disabled]:text-on-surface/38 data-[disabled]:shadow-none"
|
|
9831
|
+
]
|
|
9668
9832
|
},
|
|
9669
9833
|
size: {
|
|
9670
|
-
|
|
9671
|
-
|
|
9672
|
-
|
|
9834
|
+
// Square dimensions (width = height) so selected state = perfect circle.
|
|
9835
|
+
// Per-size inner-radius rest/morph values mirror the leading segment.
|
|
9836
|
+
xs: "h-8 w-8",
|
|
9837
|
+
sm: "h-10 w-10",
|
|
9838
|
+
md: "h-14 w-14",
|
|
9839
|
+
lg: [
|
|
9840
|
+
"h-24 w-24",
|
|
9841
|
+
// lg rest=sm, hover/focus→lg, pressed→xl; selected→full handled in base classes
|
|
9842
|
+
"[--sb-inner-radius:var(--radius-sm)]",
|
|
9843
|
+
"data-[hovered]:[--sb-inner-radius:var(--radius-lg)]",
|
|
9844
|
+
"data-[focus-visible]:data-[focus-visible]:[--sb-inner-radius:var(--radius-lg)]",
|
|
9845
|
+
"data-[pressed]:data-[pressed]:data-[pressed]:[--sb-inner-radius:var(--radius-xl)]"
|
|
9846
|
+
],
|
|
9847
|
+
xl: [
|
|
9848
|
+
"h-[8.5rem] w-[8.5rem]",
|
|
9849
|
+
// xl rest=md, hover/focus→lg, pressed→xl; selected→full handled in base classes
|
|
9850
|
+
"[--sb-inner-radius:var(--radius-md)]",
|
|
9851
|
+
"data-[hovered]:[--sb-inner-radius:var(--radius-lg)]",
|
|
9852
|
+
"data-[focus-visible]:data-[focus-visible]:[--sb-inner-radius:var(--radius-lg)]",
|
|
9853
|
+
"data-[pressed]:data-[pressed]:data-[pressed]:[--sb-inner-radius:var(--radius-xl)]"
|
|
9854
|
+
]
|
|
9673
9855
|
}
|
|
9674
9856
|
},
|
|
9675
9857
|
defaultVariants: {
|
|
9676
9858
|
variant: "filled",
|
|
9677
|
-
size: "
|
|
9859
|
+
size: "sm"
|
|
9678
9860
|
}
|
|
9679
9861
|
}
|
|
9680
9862
|
);
|
|
9681
|
-
var
|
|
9863
|
+
var splitButtonStateLayerVariants = cva(
|
|
9682
9864
|
[
|
|
9683
|
-
"
|
|
9684
|
-
"
|
|
9685
|
-
"focus-visible:outline-primary focus-visible:outline-2 focus-visible:outline-offset-2"
|
|
9865
|
+
"absolute inset-0 rounded-[inherit] overflow-hidden pointer-events-none opacity-0",
|
|
9866
|
+
"transition-opacity duration-spring-standard-fast-effects ease-spring-standard-fast-effects"
|
|
9686
9867
|
],
|
|
9687
9868
|
{
|
|
9688
9869
|
variants: {
|
|
9689
9870
|
variant: {
|
|
9690
|
-
filled: "
|
|
9691
|
-
tonal: "
|
|
9692
|
-
outlined: "
|
|
9871
|
+
filled: "bg-on-primary",
|
|
9872
|
+
tonal: "bg-on-secondary-container",
|
|
9873
|
+
outlined: "bg-primary",
|
|
9874
|
+
elevated: "bg-primary"
|
|
9693
9875
|
},
|
|
9694
|
-
|
|
9695
|
-
|
|
9696
|
-
|
|
9697
|
-
|
|
9876
|
+
/**
|
|
9877
|
+
* groupScope identifies which segment this state layer belongs to so it
|
|
9878
|
+
* reads from the correct group-data-[x]/<scope> selectors.
|
|
9879
|
+
*/
|
|
9880
|
+
groupScope: {
|
|
9881
|
+
leading: [
|
|
9882
|
+
"group-data-[hovered]/sb-leading:opacity-8",
|
|
9883
|
+
"group-data-[focus-visible]/sb-leading:opacity-10",
|
|
9884
|
+
"group-data-[pressed]/sb-leading:group-data-[pressed]/sb-leading:opacity-10",
|
|
9885
|
+
"group-data-[disabled]/sb-leading:hidden"
|
|
9886
|
+
],
|
|
9887
|
+
trailing: [
|
|
9888
|
+
"group-data-[hovered]/sb-trailing:opacity-8",
|
|
9889
|
+
"group-data-[focus-visible]/sb-trailing:opacity-10",
|
|
9890
|
+
"group-data-[pressed]/sb-trailing:group-data-[pressed]/sb-trailing:opacity-10",
|
|
9891
|
+
"group-data-[disabled]/sb-trailing:hidden"
|
|
9892
|
+
]
|
|
9698
9893
|
}
|
|
9699
9894
|
},
|
|
9700
9895
|
defaultVariants: {
|
|
9701
9896
|
variant: "filled",
|
|
9702
|
-
|
|
9897
|
+
groupScope: "leading"
|
|
9703
9898
|
}
|
|
9704
9899
|
}
|
|
9705
9900
|
);
|
|
9901
|
+
var splitButtonFocusRingVariants = cva(
|
|
9902
|
+
[
|
|
9903
|
+
"pointer-events-none absolute inset-[-3px]",
|
|
9904
|
+
"outline outline-2 outline-offset-0 outline-secondary",
|
|
9905
|
+
"transition-opacity duration-spring-standard-fast-effects ease-spring-standard-fast-effects",
|
|
9906
|
+
"opacity-0"
|
|
9907
|
+
],
|
|
9908
|
+
{
|
|
9909
|
+
variants: {
|
|
9910
|
+
/**
|
|
9911
|
+
* Corner shape must match the segment it wraps.
|
|
9912
|
+
* Leading: full-left, inner-right follows --sb-inner-radius.
|
|
9913
|
+
* Trailing: full-right, inner-left follows --sb-inner-radius.
|
|
9914
|
+
*/
|
|
9915
|
+
groupScope: {
|
|
9916
|
+
leading: [
|
|
9917
|
+
"rounded-tl-full rounded-bl-full",
|
|
9918
|
+
"rounded-tr-[calc(var(--sb-inner-radius,var(--radius-xs))+3px)]",
|
|
9919
|
+
"rounded-br-[calc(var(--sb-inner-radius,var(--radius-xs))+3px)]",
|
|
9920
|
+
"group-data-[focus-visible]/sb-leading:opacity-100"
|
|
9921
|
+
],
|
|
9922
|
+
trailing: [
|
|
9923
|
+
"rounded-tr-full rounded-br-full",
|
|
9924
|
+
"rounded-tl-[calc(var(--sb-inner-radius,var(--radius-xs))+3px)]",
|
|
9925
|
+
"rounded-bl-[calc(var(--sb-inner-radius,var(--radius-xs))+3px)]",
|
|
9926
|
+
"group-data-[focus-visible]/sb-trailing:opacity-100"
|
|
9927
|
+
]
|
|
9928
|
+
}
|
|
9929
|
+
},
|
|
9930
|
+
defaultVariants: { groupScope: "leading" }
|
|
9931
|
+
}
|
|
9932
|
+
);
|
|
9933
|
+
var splitButtonLabelVariants = cva(["relative z-10 inline-flex items-center"]);
|
|
9934
|
+
var splitButtonIconVariants = cva(
|
|
9935
|
+
[
|
|
9936
|
+
"relative z-10 inline-flex shrink-0 items-center justify-center",
|
|
9937
|
+
// Spatial spring motion for the optical-offset translate
|
|
9938
|
+
"transition-transform duration-spring-standard-fast-spatial ease-spring-standard-fast-spatial",
|
|
9939
|
+
// Reset offset when the trailing segment is in selected state (menu open)
|
|
9940
|
+
"group-data-[selected]/sb-trailing:translate-x-0"
|
|
9941
|
+
],
|
|
9942
|
+
{
|
|
9943
|
+
variants: {
|
|
9944
|
+
size: {
|
|
9945
|
+
// Include per-size icon dimension + unselected optical offset
|
|
9946
|
+
xs: ["size-5", "-translate-x-px"],
|
|
9947
|
+
sm: ["size-5", "-translate-x-px"],
|
|
9948
|
+
md: ["size-6", "-translate-x-0.5"],
|
|
9949
|
+
lg: ["size-8", "-translate-x-[3px]"],
|
|
9950
|
+
xl: ["size-10", "-translate-x-[6px]"]
|
|
9951
|
+
}
|
|
9952
|
+
},
|
|
9953
|
+
defaultVariants: { size: "sm" }
|
|
9954
|
+
}
|
|
9955
|
+
);
|
|
9956
|
+
var splitButtonMenuVariants = cva([
|
|
9957
|
+
"absolute top-full right-0 z-50 mt-1 min-w-40",
|
|
9958
|
+
"bg-surface-container rounded-md py-2",
|
|
9959
|
+
"shadow-elevation-2",
|
|
9960
|
+
"animate-md-scale-in"
|
|
9961
|
+
]);
|
|
9962
|
+
var splitButtonMenuItemVariants = cva(
|
|
9963
|
+
[
|
|
9964
|
+
"text-body-large text-on-surface cursor-pointer px-4 py-2",
|
|
9965
|
+
"hover:bg-on-surface/8",
|
|
9966
|
+
"focus:bg-on-surface/10 focus:outline-none"
|
|
9967
|
+
],
|
|
9968
|
+
{
|
|
9969
|
+
variants: {
|
|
9970
|
+
isDisabled: {
|
|
9971
|
+
true: "text-on-surface/38 pointer-events-none cursor-not-allowed",
|
|
9972
|
+
false: ""
|
|
9973
|
+
}
|
|
9974
|
+
},
|
|
9975
|
+
defaultVariants: { isDisabled: false }
|
|
9976
|
+
}
|
|
9977
|
+
);
|
|
9706
9978
|
var splitButtonVariants = {
|
|
9707
9979
|
container: splitButtonContainerVariants,
|
|
9708
|
-
|
|
9709
|
-
|
|
9980
|
+
leading: splitButtonLeadingVariants,
|
|
9981
|
+
trailing: splitButtonTrailingVariants,
|
|
9982
|
+
stateLayer: splitButtonStateLayerVariants,
|
|
9983
|
+
focusRing: splitButtonFocusRingVariants,
|
|
9984
|
+
label: splitButtonLabelVariants,
|
|
9985
|
+
icon: splitButtonIconVariants,
|
|
9986
|
+
menu: splitButtonMenuVariants,
|
|
9987
|
+
menuItem: splitButtonMenuItemVariants
|
|
9710
9988
|
};
|
|
9711
|
-
var ChevronIcon = ({
|
|
9989
|
+
var ChevronIcon = ({
|
|
9990
|
+
isOpen,
|
|
9991
|
+
reducedMotion
|
|
9992
|
+
}) => /* @__PURE__ */ jsx(
|
|
9712
9993
|
"svg",
|
|
9713
9994
|
{
|
|
9714
9995
|
"aria-hidden": "true",
|
|
9715
9996
|
"data-testid": "split-button-chevron",
|
|
9716
|
-
width: "18",
|
|
9717
|
-
height: "18",
|
|
9718
9997
|
viewBox: "0 0 24 24",
|
|
9719
9998
|
fill: "none",
|
|
9720
9999
|
xmlns: "http://www.w3.org/2000/svg",
|
|
9721
|
-
className: cn(
|
|
10000
|
+
className: cn(
|
|
10001
|
+
"size-full",
|
|
10002
|
+
!reducedMotion && "duration-expressive-fast-spatial ease-expressive-fast-spatial transition-transform",
|
|
10003
|
+
isOpen && "rotate-180"
|
|
10004
|
+
),
|
|
9722
10005
|
children: /* @__PURE__ */ jsx("path", { d: "M7 10l5 5 5-5H7z", fill: "currentColor" })
|
|
9723
10006
|
}
|
|
9724
10007
|
);
|
|
9725
10008
|
var SplitButton = forwardRef(
|
|
9726
10009
|
({
|
|
9727
10010
|
variant = "filled",
|
|
9728
|
-
size = "
|
|
10011
|
+
size = "sm",
|
|
9729
10012
|
primaryLabel,
|
|
9730
10013
|
onPrimaryAction,
|
|
9731
10014
|
items,
|
|
@@ -9733,32 +10016,73 @@ var SplitButton = forwardRef(
|
|
|
9733
10016
|
"aria-label": ariaLabel,
|
|
9734
10017
|
className
|
|
9735
10018
|
}, forwardedRef) => {
|
|
9736
|
-
const
|
|
9737
|
-
const
|
|
10019
|
+
const leadingRef = useRef(null);
|
|
10020
|
+
const trailingRef = useRef(null);
|
|
9738
10021
|
const menuRef = useRef(null);
|
|
10022
|
+
const reducedMotion = useReducedMotion();
|
|
9739
10023
|
const menuState = useMenuTriggerState({});
|
|
9740
|
-
const
|
|
10024
|
+
const [isLeadingPressed, setIsLeadingPressed] = useState(false);
|
|
10025
|
+
const handleLeadingPressStart = useCallback(() => setIsLeadingPressed(true), []);
|
|
10026
|
+
const handleLeadingPressEnd = useCallback(() => setIsLeadingPressed(false), []);
|
|
10027
|
+
const { isHovered: isLeadingHovered, hoverProps: leadingHoverProps } = useHover({
|
|
10028
|
+
isDisabled
|
|
10029
|
+
});
|
|
10030
|
+
const { isFocusVisible: isLeadingFocusVisible, focusProps: leadingFocusProps } = useFocusRing();
|
|
10031
|
+
const { buttonProps: leadingButtonProps } = useButton(
|
|
9741
10032
|
{
|
|
9742
10033
|
isDisabled,
|
|
9743
10034
|
onPress: onPrimaryAction,
|
|
10035
|
+
onPressStart: handleLeadingPressStart,
|
|
10036
|
+
onPressEnd: handleLeadingPressEnd,
|
|
9744
10037
|
elementType: "button"
|
|
9745
10038
|
},
|
|
9746
|
-
|
|
10039
|
+
leadingRef
|
|
9747
10040
|
);
|
|
9748
|
-
const
|
|
10041
|
+
const [isTrailingPressed, setIsTrailingPressed] = useState(false);
|
|
10042
|
+
const handleTrailingPressStart = useCallback(() => setIsTrailingPressed(true), []);
|
|
10043
|
+
const handleTrailingPressEnd = useCallback(() => setIsTrailingPressed(false), []);
|
|
10044
|
+
const { isHovered: isTrailingHovered, hoverProps: trailingHoverProps } = useHover({
|
|
10045
|
+
isDisabled
|
|
10046
|
+
});
|
|
10047
|
+
const { isFocusVisible: isTrailingFocusVisible, focusProps: trailingFocusProps } = useFocusRing();
|
|
10048
|
+
const handleTrailingPress = useCallback(() => {
|
|
9749
10049
|
if (menuState.isOpen) {
|
|
9750
10050
|
menuState.close();
|
|
9751
10051
|
} else {
|
|
9752
10052
|
menuState.open();
|
|
9753
10053
|
}
|
|
9754
10054
|
}, [menuState]);
|
|
9755
|
-
const { buttonProps:
|
|
10055
|
+
const { buttonProps: trailingButtonProps } = useButton(
|
|
9756
10056
|
{
|
|
9757
10057
|
isDisabled,
|
|
9758
|
-
onPress:
|
|
10058
|
+
onPress: handleTrailingPress,
|
|
10059
|
+
onPressStart: handleTrailingPressStart,
|
|
10060
|
+
onPressEnd: handleTrailingPressEnd,
|
|
9759
10061
|
elementType: "button"
|
|
9760
10062
|
},
|
|
9761
|
-
|
|
10063
|
+
trailingRef
|
|
10064
|
+
);
|
|
10065
|
+
const { onMouseDown: handleLeadingRipple, ripples: leadingRipples } = useRipple({
|
|
10066
|
+
disabled: isDisabled
|
|
10067
|
+
});
|
|
10068
|
+
const { onMouseDown: handleTrailingRipple, ripples: trailingRipples } = useRipple({
|
|
10069
|
+
disabled: isDisabled
|
|
10070
|
+
});
|
|
10071
|
+
const onLeadingMouseDown = useCallback(
|
|
10072
|
+
(e) => {
|
|
10073
|
+
const ariaHandler = leadingButtonProps.onMouseDown;
|
|
10074
|
+
ariaHandler?.(e);
|
|
10075
|
+
handleLeadingRipple(e);
|
|
10076
|
+
},
|
|
10077
|
+
[leadingButtonProps, handleLeadingRipple]
|
|
10078
|
+
);
|
|
10079
|
+
const onTrailingMouseDown = useCallback(
|
|
10080
|
+
(e) => {
|
|
10081
|
+
const ariaHandler = trailingButtonProps.onMouseDown;
|
|
10082
|
+
ariaHandler?.(e);
|
|
10083
|
+
handleTrailingRipple(e);
|
|
10084
|
+
},
|
|
10085
|
+
[trailingButtonProps, handleTrailingRipple]
|
|
9762
10086
|
);
|
|
9763
10087
|
const handleMenuItemSelect = useCallback(
|
|
9764
10088
|
(item) => {
|
|
@@ -9774,13 +10098,11 @@ var SplitButton = forwardRef(
|
|
|
9774
10098
|
const handleGlobalKeyDown = (e) => {
|
|
9775
10099
|
if (e.key === "Escape") {
|
|
9776
10100
|
menuState.close();
|
|
9777
|
-
|
|
10101
|
+
trailingRef.current?.focus();
|
|
9778
10102
|
}
|
|
9779
10103
|
};
|
|
9780
10104
|
document.addEventListener("keydown", handleGlobalKeyDown);
|
|
9781
|
-
return () =>
|
|
9782
|
-
document.removeEventListener("keydown", handleGlobalKeyDown);
|
|
9783
|
-
};
|
|
10105
|
+
return () => document.removeEventListener("keydown", handleGlobalKeyDown);
|
|
9784
10106
|
}, [menuState, menuState.isOpen]);
|
|
9785
10107
|
const handleMenuKeyDown = useCallback(
|
|
9786
10108
|
(e) => {
|
|
@@ -9813,7 +10135,7 @@ var SplitButton = forwardRef(
|
|
|
9813
10135
|
}
|
|
9814
10136
|
case "Escape": {
|
|
9815
10137
|
menuState.close();
|
|
9816
|
-
|
|
10138
|
+
trailingRef.current?.focus();
|
|
9817
10139
|
break;
|
|
9818
10140
|
}
|
|
9819
10141
|
}
|
|
@@ -9838,28 +10160,6 @@ var SplitButton = forwardRef(
|
|
|
9838
10160
|
},
|
|
9839
10161
|
[menuState]
|
|
9840
10162
|
);
|
|
9841
|
-
const { onMouseDown: handlePrimaryRipple, ripples: primaryRipples } = useRipple({
|
|
9842
|
-
disabled: isDisabled
|
|
9843
|
-
});
|
|
9844
|
-
const { onMouseDown: handleDropdownRipple, ripples: dropdownRipples } = useRipple({
|
|
9845
|
-
disabled: isDisabled
|
|
9846
|
-
});
|
|
9847
|
-
const onPrimaryMouseDown = useCallback(
|
|
9848
|
-
(e) => {
|
|
9849
|
-
const ariaHandler = primaryButtonProps.onMouseDown;
|
|
9850
|
-
ariaHandler?.(e);
|
|
9851
|
-
handlePrimaryRipple(e);
|
|
9852
|
-
},
|
|
9853
|
-
[primaryButtonProps, handlePrimaryRipple]
|
|
9854
|
-
);
|
|
9855
|
-
const onDropdownMouseDown = useCallback(
|
|
9856
|
-
(e) => {
|
|
9857
|
-
const ariaHandler = dropdownButtonProps.onMouseDown;
|
|
9858
|
-
ariaHandler?.(e);
|
|
9859
|
-
handleDropdownRipple(e);
|
|
9860
|
-
},
|
|
9861
|
-
[dropdownButtonProps, handleDropdownRipple]
|
|
9862
|
-
);
|
|
9863
10163
|
return /* @__PURE__ */ jsxs("div", { className: "relative inline-flex", children: [
|
|
9864
10164
|
/* @__PURE__ */ jsxs(
|
|
9865
10165
|
"div",
|
|
@@ -9867,63 +10167,81 @@ var SplitButton = forwardRef(
|
|
|
9867
10167
|
ref: forwardedRef,
|
|
9868
10168
|
role: "group",
|
|
9869
10169
|
"aria-label": ariaLabel ?? `${primaryLabel} split button`,
|
|
9870
|
-
className: cn(splitButtonContainerVariants(
|
|
10170
|
+
className: cn(splitButtonContainerVariants(), className),
|
|
9871
10171
|
children: [
|
|
9872
10172
|
/* @__PURE__ */ jsxs(
|
|
9873
10173
|
"button",
|
|
9874
10174
|
{
|
|
9875
|
-
...
|
|
9876
|
-
ref:
|
|
10175
|
+
...mergeProps$1(leadingButtonProps, leadingHoverProps, leadingFocusProps),
|
|
10176
|
+
ref: leadingRef,
|
|
9877
10177
|
type: "button",
|
|
9878
10178
|
tabIndex: isDisabled ? -1 : 0,
|
|
9879
|
-
onMouseDown:
|
|
9880
|
-
|
|
10179
|
+
onMouseDown: onLeadingMouseDown,
|
|
10180
|
+
...getInteractionDataAttributes({
|
|
10181
|
+
isHovered: isLeadingHovered,
|
|
10182
|
+
isFocusVisible: isLeadingFocusVisible,
|
|
10183
|
+
isPressed: isLeadingPressed,
|
|
10184
|
+
isDisabled
|
|
10185
|
+
}),
|
|
10186
|
+
className: splitButtonLeadingVariants({ variant, size }),
|
|
9881
10187
|
children: [
|
|
9882
10188
|
/* @__PURE__ */ jsx(
|
|
9883
10189
|
"span",
|
|
9884
10190
|
{
|
|
9885
10191
|
"data-testid": "primary-state-layer",
|
|
9886
10192
|
"aria-hidden": "true",
|
|
9887
|
-
className:
|
|
9888
|
-
|
|
9889
|
-
|
|
9890
|
-
|
|
9891
|
-
|
|
10193
|
+
className: splitButtonStateLayerVariants({ variant, groupScope: "leading" })
|
|
10194
|
+
}
|
|
10195
|
+
),
|
|
10196
|
+
leadingRipples,
|
|
10197
|
+
/* @__PURE__ */ jsx(
|
|
10198
|
+
"span",
|
|
10199
|
+
{
|
|
10200
|
+
"aria-hidden": "true",
|
|
10201
|
+
className: splitButtonFocusRingVariants({ groupScope: "leading" })
|
|
9892
10202
|
}
|
|
9893
10203
|
),
|
|
9894
|
-
|
|
9895
|
-
/* @__PURE__ */ jsx("span", { className: "relative z-10", children: primaryLabel })
|
|
10204
|
+
/* @__PURE__ */ jsx("span", { className: splitButtonLabelVariants(), children: primaryLabel })
|
|
9896
10205
|
]
|
|
9897
10206
|
}
|
|
9898
10207
|
),
|
|
9899
|
-
/* @__PURE__ */ jsx("span", { "data-testid": "split-button-divider", "aria-hidden": "true" }),
|
|
9900
10208
|
/* @__PURE__ */ jsxs(
|
|
9901
10209
|
"button",
|
|
9902
10210
|
{
|
|
9903
|
-
...
|
|
9904
|
-
ref:
|
|
10211
|
+
...mergeProps$1(trailingButtonProps, trailingHoverProps, trailingFocusProps),
|
|
10212
|
+
ref: trailingRef,
|
|
9905
10213
|
type: "button",
|
|
9906
10214
|
tabIndex: isDisabled ? -1 : 0,
|
|
9907
10215
|
"aria-haspopup": "menu",
|
|
9908
10216
|
"aria-expanded": menuState.isOpen,
|
|
9909
10217
|
"aria-label": `${primaryLabel} options, expand`,
|
|
9910
|
-
onMouseDown:
|
|
9911
|
-
|
|
10218
|
+
onMouseDown: onTrailingMouseDown,
|
|
10219
|
+
...getInteractionDataAttributes({
|
|
10220
|
+
isHovered: isTrailingHovered,
|
|
10221
|
+
isFocusVisible: isTrailingFocusVisible,
|
|
10222
|
+
isPressed: isTrailingPressed,
|
|
10223
|
+
isSelected: menuState.isOpen,
|
|
10224
|
+
isDisabled
|
|
10225
|
+
}),
|
|
10226
|
+
className: splitButtonTrailingVariants({ variant, size }),
|
|
9912
10227
|
children: [
|
|
9913
10228
|
/* @__PURE__ */ jsx(
|
|
9914
10229
|
"span",
|
|
9915
10230
|
{
|
|
9916
10231
|
"data-testid": "dropdown-state-layer",
|
|
9917
10232
|
"aria-hidden": "true",
|
|
9918
|
-
className:
|
|
9919
|
-
"pointer-events-none absolute inset-0 bg-current opacity-0",
|
|
9920
|
-
"duration-spring-standard-fast-effects ease-spring-standard-fast-effects transition-opacity",
|
|
9921
|
-
"group-hover/dropdown:opacity-8"
|
|
9922
|
-
)
|
|
10233
|
+
className: splitButtonStateLayerVariants({ variant, groupScope: "trailing" })
|
|
9923
10234
|
}
|
|
9924
10235
|
),
|
|
9925
|
-
|
|
9926
|
-
/* @__PURE__ */ jsx(
|
|
10236
|
+
trailingRipples,
|
|
10237
|
+
/* @__PURE__ */ jsx(
|
|
10238
|
+
"span",
|
|
10239
|
+
{
|
|
10240
|
+
"aria-hidden": "true",
|
|
10241
|
+
className: splitButtonFocusRingVariants({ groupScope: "trailing" })
|
|
10242
|
+
}
|
|
10243
|
+
),
|
|
10244
|
+
/* @__PURE__ */ jsx("span", { className: splitButtonIconVariants({ size }), children: /* @__PURE__ */ jsx(ChevronIcon, { isOpen: menuState.isOpen, reducedMotion }) })
|
|
9927
10245
|
]
|
|
9928
10246
|
}
|
|
9929
10247
|
)
|
|
@@ -9937,10 +10255,7 @@ var SplitButton = forwardRef(
|
|
|
9937
10255
|
role: "menu",
|
|
9938
10256
|
"aria-label": `${primaryLabel} options`,
|
|
9939
10257
|
onKeyDown: handleMenuKeyDown,
|
|
9940
|
-
className:
|
|
9941
|
-
"bg-surface-container absolute top-full right-0 z-50 mt-1 min-w-40 rounded-md py-2",
|
|
9942
|
-
"shadow-elevation-2"
|
|
9943
|
-
),
|
|
10258
|
+
className: splitButtonMenuVariants(),
|
|
9944
10259
|
children: items.map((item) => /* @__PURE__ */ jsx(
|
|
9945
10260
|
"li",
|
|
9946
10261
|
{
|
|
@@ -9949,11 +10264,7 @@ var SplitButton = forwardRef(
|
|
|
9949
10264
|
"aria-disabled": item.isDisabled ?? void 0,
|
|
9950
10265
|
onClick: () => handleMenuItemSelect(item),
|
|
9951
10266
|
onKeyDown: (e) => handleMenuItemKeyDown(e, item),
|
|
9952
|
-
className:
|
|
9953
|
-
"text-body-large text-on-surface cursor-pointer px-4 py-2",
|
|
9954
|
-
"hover:bg-on-surface/8",
|
|
9955
|
-
item.isDisabled && "text-on-surface/38 pointer-events-none"
|
|
9956
|
-
),
|
|
10267
|
+
className: splitButtonMenuItemVariants({ isDisabled: item.isDisabled ?? false }),
|
|
9957
10268
|
children: item.label
|
|
9958
10269
|
},
|
|
9959
10270
|
item.label
|
|
@@ -9973,32 +10284,32 @@ var SplitButtonHeadless = forwardRef(
|
|
|
9973
10284
|
"aria-label": ariaLabel,
|
|
9974
10285
|
className
|
|
9975
10286
|
}, forwardedRef) => {
|
|
9976
|
-
const
|
|
9977
|
-
const
|
|
10287
|
+
const leadingRef = useRef(null);
|
|
10288
|
+
const trailingRef = useRef(null);
|
|
9978
10289
|
const menuRef = useRef(null);
|
|
9979
10290
|
const menuState = useMenuTriggerState({});
|
|
9980
|
-
const { buttonProps:
|
|
10291
|
+
const { buttonProps: leadingButtonProps } = useButton(
|
|
9981
10292
|
{
|
|
9982
10293
|
isDisabled,
|
|
9983
10294
|
onPress: onPrimaryAction,
|
|
9984
10295
|
elementType: "button"
|
|
9985
10296
|
},
|
|
9986
|
-
|
|
10297
|
+
leadingRef
|
|
9987
10298
|
);
|
|
9988
|
-
const
|
|
10299
|
+
const handleTrailingPress = useCallback(() => {
|
|
9989
10300
|
if (menuState.isOpen) {
|
|
9990
10301
|
menuState.close();
|
|
9991
10302
|
} else {
|
|
9992
10303
|
menuState.open();
|
|
9993
10304
|
}
|
|
9994
10305
|
}, [menuState]);
|
|
9995
|
-
const { buttonProps:
|
|
10306
|
+
const { buttonProps: trailingButtonProps } = useButton(
|
|
9996
10307
|
{
|
|
9997
10308
|
isDisabled,
|
|
9998
|
-
onPress:
|
|
10309
|
+
onPress: handleTrailingPress,
|
|
9999
10310
|
elementType: "button"
|
|
10000
10311
|
},
|
|
10001
|
-
|
|
10312
|
+
trailingRef
|
|
10002
10313
|
);
|
|
10003
10314
|
const handleMenuItemSelect = useCallback(
|
|
10004
10315
|
(item) => {
|
|
@@ -10014,13 +10325,11 @@ var SplitButtonHeadless = forwardRef(
|
|
|
10014
10325
|
const handleGlobalKeyDown = (e) => {
|
|
10015
10326
|
if (e.key === "Escape") {
|
|
10016
10327
|
menuState.close();
|
|
10017
|
-
|
|
10328
|
+
trailingRef.current?.focus();
|
|
10018
10329
|
}
|
|
10019
10330
|
};
|
|
10020
10331
|
document.addEventListener("keydown", handleGlobalKeyDown);
|
|
10021
|
-
return () =>
|
|
10022
|
-
document.removeEventListener("keydown", handleGlobalKeyDown);
|
|
10023
|
-
};
|
|
10332
|
+
return () => document.removeEventListener("keydown", handleGlobalKeyDown);
|
|
10024
10333
|
}, [menuState, menuState.isOpen]);
|
|
10025
10334
|
const handleMenuKeyDown = useCallback(
|
|
10026
10335
|
(e) => {
|
|
@@ -10053,7 +10362,7 @@ var SplitButtonHeadless = forwardRef(
|
|
|
10053
10362
|
}
|
|
10054
10363
|
case "Escape": {
|
|
10055
10364
|
menuState.close();
|
|
10056
|
-
|
|
10365
|
+
trailingRef.current?.focus();
|
|
10057
10366
|
break;
|
|
10058
10367
|
}
|
|
10059
10368
|
}
|
|
@@ -10089,19 +10398,18 @@ var SplitButtonHeadless = forwardRef(
|
|
|
10089
10398
|
/* @__PURE__ */ jsx(
|
|
10090
10399
|
"button",
|
|
10091
10400
|
{
|
|
10092
|
-
...
|
|
10093
|
-
ref:
|
|
10401
|
+
...leadingButtonProps,
|
|
10402
|
+
ref: leadingRef,
|
|
10094
10403
|
type: "button",
|
|
10095
10404
|
tabIndex: isDisabled ? -1 : 0,
|
|
10096
10405
|
children: primaryLabel
|
|
10097
10406
|
}
|
|
10098
10407
|
),
|
|
10099
|
-
/* @__PURE__ */ jsx("span", { "aria-hidden": "true" }),
|
|
10100
10408
|
/* @__PURE__ */ jsx(
|
|
10101
10409
|
"button",
|
|
10102
10410
|
{
|
|
10103
|
-
...
|
|
10104
|
-
ref:
|
|
10411
|
+
...trailingButtonProps,
|
|
10412
|
+
ref: trailingRef,
|
|
10105
10413
|
type: "button",
|
|
10106
10414
|
tabIndex: isDisabled ? -1 : 0,
|
|
10107
10415
|
"aria-haspopup": "menu",
|
|
@@ -16142,6 +16450,6 @@ var DateField = forwardRef((props, forwardedRef) => {
|
|
|
16142
16450
|
});
|
|
16143
16451
|
DateField.displayName = "DateField";
|
|
16144
16452
|
|
|
16145
|
-
export { AppBar, AppBarHeadless, Badge, BadgeContent, BadgeHeadless, BottomSheet, BottomSheetContext, BottomSheetHandle, BottomSheetHeadless, Button, ButtonGroup, ButtonGroupContext, ButtonGroupHeadless, CalendarCore, Card, CardActions, CardContent, CardHeader, CardHeadless, CardMedia, Checkbox, Chip, ChipHeadless, ChipSet, DateField, DatePicker, DatePickerDocked, DatePickerModal, DatePickerModalInput, Dialog, DialogActions, DialogContent, DialogContext, DialogHeadless, DialogHeadline, Divider, DividerHeadless, Drawer, DrawerIconOnlyContext, DrawerItem, DrawerSection, FAB, FABHeadless, FABMenu, FABMenuContext, FABMenuHeadless, FABMenuItem, HeadlessDrawer, HeadlessDrawerItem, HeadlessMenu, HeadlessMenuDivider, HeadlessMenuItem, HeadlessMenuSection, HeadlessMenuTrigger, HeadlessNavigationBar, HeadlessNavigationBarItem, HeadlessTab, HeadlessTabList, HeadlessTabPanel, IconButton, IconButtonHeadless, List, ListHeadless, ListItem, ListItemHeadless, ListItemLeading, ListItemText, ListItemTrailing, Menu, MenuContext, MenuDivider, MenuItem, MenuSection, MenuTrigger, NavigationBar, NavigationBarItem, Progress, ProgressHeadless, Radio, RadioGroup, RadioGroupHeadless, RadioHeadless, RichTooltip, STATE_LAYER_OPACITY, Search, SearchBar, SearchBarHeadless, SearchView, SearchViewHeadless, Slider, SliderHeadless, Snackbar, SnackbarContext, SnackbarHeadless, SnackbarProvider, SplitButton, SplitButtonHeadless, StyledActionButton, StyledCalendarCell, StyledCalendarTitle, StyledNavButton, StyledWeekday, StyledYearItem, Switch, TYPOGRAPHY_ELEMENT_MAP, TYPOGRAPHY_USAGE, Tab, TabList, TabPanel, Tabs, TextField, TimePicker, TimePickerDial, TimePickerInput, Tooltip, TooltipOverlayHeadless, TooltipTrigger, TooltipTriggerHeadless, actionButtonFocusRingVariants, actionButtonStateLayerVariants, actionButtonVariants, actionRowVariants, applyStateLayer, badgeVariants2 as badgeVariants, bottomSheetAnimationVariants, bottomSheetHandlePillVariants, bottomSheetHandleWrapperVariants, bottomSheetScrimVariants, bottomSheetVariants, buttonGroupFocusRingVariants, buttonGroupRootVariants, buttonGroupVariants, calendarCellFocusRingVariants, calendarCellStateLayerVariants, calendarCellVariants, calendarDividerVariants, calendarHeaderVariants, calendarTitleIconVariants, calendarTitleStateLayerVariants, calendarTitleTextVariants, calendarTitleVariants, cardVariants, chipVariants, clockDialContainerVariants, clockDialNumberVariants, clockHandCenterVariants, clockHandHandleVariants, clockHandTrackVariants, cn, dateFieldVariants, dateInputErrorVariants, dateInputFieldGroupVariants, dateInputFieldVariants, dateInputLabelVariants, datePickerContainerVariants, dateSegmentPlaceholderVariants, dividerVariants, dockedFieldGroupVariants, dockedLabelVariants, dockedTriggerStateLayerVariants, dockedTriggerVariants, fabMenuItemFocusRingVariants, fabMenuItemIconVariants, fabMenuItemLabelVariants, fabMenuItemStateLayerVariants, fabMenuItemVariants, fabMenuListVariants, fabMenuVariants, generateMD3Theme, getColorValue, getConnectedRadiusClasses, getFontFamily, getMD3Color, getResponsiveTypography, getTypographyClassName, getTypographyForElement, getTypographyStyle, getTypographyToken, headlineVariants, hexToRgb, listItemVariants, listVariants, modalDialogVariants, modalHeaderVariants, modeToggleStateLayerVariants, modeToggleVariants, navButtonFocusRingVariants, navButtonStateLayerVariants, navButtonVariants, periodSelectorContainerVariants, periodSelectorItemVariants, popoverVariants, pxToRem, remToPx, rgbToHex, richTooltipVariants, scrimVariants2 as scrimVariants, searchBarAvatarVariants, searchBarFocusRingVariants, searchBarInputVariants, searchBarLeadingIconVariants, searchBarRootVariants, searchBarStateLayerVariants, searchBarTrailingActionVariants, searchBarTrailingActionsVariants, searchViewBackButtonVariants, searchViewClearButtonVariants, searchViewContentVariants, searchViewDividerVariants, searchViewHeaderVariants, searchViewInputVariants, searchViewTrailingActionVariants, searchViewTrailingActionsVariants, searchViewVariants, sliderActiveTrackVariants, sliderContainerVariants, sliderHandleStateLayerVariants, sliderHandleVariants, sliderInactiveTrackVariants, sliderTrackLayoutVariants, splitButtonContainerVariants,
|
|
16453
|
+
export { AppBar, AppBarHeadless, Badge, BadgeContent, BadgeHeadless, BottomSheet, BottomSheetContext, BottomSheetHandle, BottomSheetHeadless, Button, ButtonGroup, ButtonGroupContext, ButtonGroupHeadless, CalendarCore, Card, CardActions, CardContent, CardHeader, CardHeadless, CardMedia, Checkbox, Chip, ChipHeadless, ChipSet, DateField, DatePicker, DatePickerDocked, DatePickerModal, DatePickerModalInput, Dialog, DialogActions, DialogContent, DialogContext, DialogHeadless, DialogHeadline, Divider, DividerHeadless, Drawer, DrawerIconOnlyContext, DrawerItem, DrawerSection, FAB, FABHeadless, FABMenu, FABMenuContext, FABMenuHeadless, FABMenuItem, HeadlessDrawer, HeadlessDrawerItem, HeadlessMenu, HeadlessMenuDivider, HeadlessMenuItem, HeadlessMenuSection, HeadlessMenuTrigger, HeadlessNavigationBar, HeadlessNavigationBarItem, HeadlessTab, HeadlessTabList, HeadlessTabPanel, IconButton, IconButtonHeadless, List, ListHeadless, ListItem, ListItemHeadless, ListItemLeading, ListItemText, ListItemTrailing, Menu, MenuContext, MenuDivider, MenuItem, MenuSection, MenuTrigger, NavigationBar, NavigationBarItem, Progress, ProgressHeadless, Radio, RadioGroup, RadioGroupHeadless, RadioHeadless, RichTooltip, STATE_LAYER_OPACITY, Search, SearchBar, SearchBarHeadless, SearchView, SearchViewHeadless, Slider, SliderHeadless, Snackbar, SnackbarContext, SnackbarHeadless, SnackbarProvider, SplitButton, SplitButtonHeadless, StyledActionButton, StyledCalendarCell, StyledCalendarTitle, StyledNavButton, StyledWeekday, StyledYearItem, Switch, TYPOGRAPHY_ELEMENT_MAP, TYPOGRAPHY_USAGE, Tab, TabList, TabPanel, Tabs, TextField, TimePicker, TimePickerDial, TimePickerInput, Tooltip, TooltipOverlayHeadless, TooltipTrigger, TooltipTriggerHeadless, actionButtonFocusRingVariants, actionButtonStateLayerVariants, actionButtonVariants, actionRowVariants, applyStateLayer, badgeVariants2 as badgeVariants, bottomSheetAnimationVariants, bottomSheetHandlePillVariants, bottomSheetHandleWrapperVariants, bottomSheetScrimVariants, bottomSheetVariants, buttonGroupFocusRingVariants, buttonGroupRootVariants, buttonGroupVariants, calendarCellFocusRingVariants, calendarCellStateLayerVariants, calendarCellVariants, calendarDividerVariants, calendarHeaderVariants, calendarTitleIconVariants, calendarTitleStateLayerVariants, calendarTitleTextVariants, calendarTitleVariants, cardVariants, chipVariants, clockDialContainerVariants, clockDialNumberVariants, clockHandCenterVariants, clockHandHandleVariants, clockHandTrackVariants, cn, dateFieldVariants, dateInputErrorVariants, dateInputFieldGroupVariants, dateInputFieldVariants, dateInputLabelVariants, datePickerContainerVariants, dateSegmentPlaceholderVariants, dividerVariants, dockedFieldGroupVariants, dockedLabelVariants, dockedTriggerStateLayerVariants, dockedTriggerVariants, fabMenuItemFocusRingVariants, fabMenuItemIconVariants, fabMenuItemLabelVariants, fabMenuItemStateLayerVariants, fabMenuItemVariants, fabMenuListVariants, fabMenuVariants, generateMD3Theme, getColorValue, getConnectedRadiusClasses, getFontFamily, getMD3Color, getResponsiveTypography, getTypographyClassName, getTypographyForElement, getTypographyStyle, getTypographyToken, headlineVariants, hexToRgb, listItemVariants, listVariants, modalDialogVariants, modalHeaderVariants, modeToggleStateLayerVariants, modeToggleVariants, navButtonFocusRingVariants, navButtonStateLayerVariants, navButtonVariants, periodSelectorContainerVariants, periodSelectorItemVariants, popoverVariants, pxToRem, remToPx, rgbToHex, richTooltipVariants, scrimVariants2 as scrimVariants, searchBarAvatarVariants, searchBarFocusRingVariants, searchBarInputVariants, searchBarLeadingIconVariants, searchBarRootVariants, searchBarStateLayerVariants, searchBarTrailingActionVariants, searchBarTrailingActionsVariants, searchViewBackButtonVariants, searchViewClearButtonVariants, searchViewContentVariants, searchViewDividerVariants, searchViewHeaderVariants, searchViewInputVariants, searchViewTrailingActionVariants, searchViewTrailingActionsVariants, searchViewVariants, sliderActiveTrackVariants, sliderContainerVariants, sliderHandleStateLayerVariants, sliderHandleVariants, sliderInactiveTrackVariants, sliderTrackLayoutVariants, splitButtonContainerVariants, splitButtonFocusRingVariants, splitButtonIconVariants, splitButtonLabelVariants, splitButtonLeadingVariants, splitButtonMenuItemVariants, splitButtonMenuVariants, splitButtonStateLayerVariants, splitButtonTrailingVariants, splitButtonVariants, supportingTextVariants, timeInputFieldVariants, timePickerActionButtonVariants, timePickerActionRowVariants, timePickerContainerVariants, timePickerHeadlineVariants, timePickerModeToggleVariants, timeSelectorContainerVariants, timeSeparatorVariants, tooltipVariants, truncateText, useBottomSheetContext, useBottomSheetDrag, useButtonGroup, useDialogContext, useFABMenuContext, useMenuContext, useOptionalButtonGroup, useSnackbar, weekdayVariants, withOpacity, yearGridVariants, yearItemFocusRingVariants, yearItemStateLayerVariants, yearItemVariants };
|
|
16146
16454
|
//# sourceMappingURL=index.js.map
|
|
16147
16455
|
//# sourceMappingURL=index.js.map
|