@bug-on/m3-expressive 1.3.0 → 1.3.2
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/CHANGELOG.md +15 -0
- package/README.md +88 -60
- package/dist/buttons.d.mts +3 -3
- package/dist/buttons.d.ts +3 -3
- package/dist/buttons.js +185 -40
- package/dist/buttons.js.map +1 -1
- package/dist/buttons.mjs +186 -41
- package/dist/buttons.mjs.map +1 -1
- package/dist/{core-CAU8g2HY.d.mts → core-D8FdHY6I.d.mts} +1 -1
- package/dist/{core-DRrLnsnJ.d.ts → core-DyEy8H9Z.d.ts} +1 -1
- package/dist/core.d.mts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.js +156 -25
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +157 -26
- package/dist/core.mjs.map +1 -1
- package/dist/feedback.d.mts +20 -0
- package/dist/feedback.d.ts +20 -0
- package/dist/feedback.js +157 -26
- package/dist/feedback.js.map +1 -1
- package/dist/feedback.mjs +158 -27
- package/dist/feedback.mjs.map +1 -1
- package/dist/forms.d.mts +4 -2
- package/dist/forms.d.ts +4 -2
- package/dist/forms.js +5065 -2980
- package/dist/forms.js.map +1 -1
- package/dist/forms.mjs +5064 -2982
- package/dist/forms.mjs.map +1 -1
- package/dist/{icon-button-USJo7AqO.d.mts → icon-button-CxyJv7UV.d.mts} +1 -1
- package/dist/{icon-button-CqdQBsRe.d.ts → icon-button-Di8VX6ou.d.ts} +1 -1
- package/dist/index.d.mts +12 -82
- package/dist/index.d.ts +12 -82
- package/dist/index.js +2875 -1226
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2723 -1086
- package/dist/index.mjs.map +1 -1
- package/dist/layout.d.mts +481 -33
- package/dist/layout.d.ts +481 -33
- package/dist/layout.js +1653 -243
- package/dist/layout.js.map +1 -1
- package/dist/layout.mjs +1626 -232
- package/dist/layout.mjs.map +1 -1
- package/dist/{md3-D0_Z7IXj.d.mts → md3-BQhRygSi.d.mts} +1 -1
- package/dist/{md3-D0_Z7IXj.d.ts → md3-BQhRygSi.d.ts} +1 -1
- package/dist/menu-types-rZNQFO7Y.d.mts +315 -0
- package/dist/menu-types-rZNQFO7Y.d.ts +315 -0
- package/dist/navigation.d.mts +5 -289
- package/dist/navigation.d.ts +5 -289
- package/dist/navigation.js +575 -271
- package/dist/navigation.js.map +1 -1
- package/dist/navigation.mjs +568 -265
- package/dist/navigation.mjs.map +1 -1
- package/dist/overlays.d.mts +2 -2
- package/dist/overlays.d.ts +2 -2
- package/dist/overlays.js +156 -25
- package/dist/overlays.js.map +1 -1
- package/dist/overlays.mjs +157 -26
- package/dist/overlays.mjs.map +1 -1
- package/dist/pickers.js +156 -25
- package/dist/pickers.js.map +1 -1
- package/dist/pickers.mjs +157 -26
- package/dist/pickers.mjs.map +1 -1
- package/dist/{side-sheet-modal-Dgjt739k.d.mts → side-sheet-modal-64FGhDxL.d.mts} +1 -1
- package/dist/{side-sheet-modal-DdEZR6Vl.d.ts → side-sheet-modal-Bd5Qqvp9.d.ts} +1 -1
- package/dist/{split-button-trailing-uncheckable-26qlZvKT.d.mts → split-button-trailing-uncheckable-CGzk7KcG.d.ts} +3 -1
- package/dist/{split-button-trailing-uncheckable-CXUVrH64.d.ts → split-button-trailing-uncheckable-gAz6OAIi.d.mts} +3 -1
- package/dist/{text-field-DWC7qOvp.d.ts → text-field-4OlT9o8s.d.mts} +206 -55
- package/dist/{text-field-DWC7qOvp.d.mts → text-field-DARNdj14.d.ts} +206 -55
- package/package.json +3 -3
package/dist/navigation.mjs
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { AnimatePresence, m, LazyMotion, domMax,
|
|
2
|
+
import { AnimatePresence, m, LazyMotion, domMax, useMotionValue, animate, useAnimationFrame, useReducedMotion, LayoutGroup, useScroll, useMotionValueEvent, useTransform } from 'motion/react';
|
|
3
3
|
import { clsx } from 'clsx';
|
|
4
4
|
import { twMerge } from 'tailwind-merge';
|
|
5
|
-
import {
|
|
6
|
-
import * as
|
|
5
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
6
|
+
import * as React38 from 'react';
|
|
7
7
|
import { useRef, useEffect, useState } from 'react';
|
|
8
8
|
import * as RxContextMenu from '@radix-ui/react-context-menu';
|
|
9
|
+
import * as RadixScrollArea from '@radix-ui/react-scroll-area';
|
|
9
10
|
import { cornerRadius } from '@bug-on/m3-tokens';
|
|
10
11
|
import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
|
|
11
12
|
import { Slot } from '@radix-ui/react-slot';
|
|
@@ -293,6 +294,127 @@ function AppBarItemButton({ item }) {
|
|
|
293
294
|
}
|
|
294
295
|
);
|
|
295
296
|
}
|
|
297
|
+
var ScrollArea = React38.forwardRef(
|
|
298
|
+
(_a, ref) => {
|
|
299
|
+
var _b = _a, {
|
|
300
|
+
className,
|
|
301
|
+
viewportClassName,
|
|
302
|
+
children,
|
|
303
|
+
type = "hover",
|
|
304
|
+
orientation = "vertical",
|
|
305
|
+
scrollHideDelay = 600,
|
|
306
|
+
viewportRef,
|
|
307
|
+
viewportProps
|
|
308
|
+
} = _b, props = __objRest(_b, [
|
|
309
|
+
"className",
|
|
310
|
+
"viewportClassName",
|
|
311
|
+
"children",
|
|
312
|
+
"type",
|
|
313
|
+
"orientation",
|
|
314
|
+
"scrollHideDelay",
|
|
315
|
+
"viewportRef",
|
|
316
|
+
"viewportProps"
|
|
317
|
+
]);
|
|
318
|
+
const [isTouchDevice, setIsTouchDevice] = React38.useState(false);
|
|
319
|
+
React38.useEffect(() => {
|
|
320
|
+
if (typeof window !== "undefined") {
|
|
321
|
+
setIsTouchDevice(
|
|
322
|
+
"ontouchstart" in window || navigator.maxTouchPoints > 0
|
|
323
|
+
);
|
|
324
|
+
}
|
|
325
|
+
}, []);
|
|
326
|
+
const resolvedType = React38.useMemo(() => {
|
|
327
|
+
if (type === "hover" && isTouchDevice) {
|
|
328
|
+
return "scroll";
|
|
329
|
+
}
|
|
330
|
+
return type;
|
|
331
|
+
}, [type, isTouchDevice]);
|
|
332
|
+
const radixType = resolvedType === "none" ? "always" : resolvedType;
|
|
333
|
+
return /* @__PURE__ */ jsxs(
|
|
334
|
+
RadixScrollArea.Root,
|
|
335
|
+
__spreadProps(__spreadValues({
|
|
336
|
+
ref,
|
|
337
|
+
type: radixType,
|
|
338
|
+
scrollHideDelay,
|
|
339
|
+
className: cn("relative overflow-hidden flex flex-col", className)
|
|
340
|
+
}, props), {
|
|
341
|
+
children: [
|
|
342
|
+
/* @__PURE__ */ jsx(
|
|
343
|
+
RadixScrollArea.Viewport,
|
|
344
|
+
__spreadProps(__spreadValues({
|
|
345
|
+
ref: viewportRef
|
|
346
|
+
}, viewportProps), {
|
|
347
|
+
className: cn(
|
|
348
|
+
"h-full w-full flex-1 min-h-0 min-w-0 rounded-[inherit]",
|
|
349
|
+
"outline-none focus-visible:ring-2 focus-visible:ring-m3-primary focus-visible:ring-offset-1",
|
|
350
|
+
viewportClassName,
|
|
351
|
+
viewportProps == null ? void 0 : viewportProps.className
|
|
352
|
+
),
|
|
353
|
+
children
|
|
354
|
+
})
|
|
355
|
+
),
|
|
356
|
+
(orientation === "vertical" || orientation === "both") && /* @__PURE__ */ jsx(
|
|
357
|
+
ScrollAreaScrollbar,
|
|
358
|
+
{
|
|
359
|
+
orientation: "vertical",
|
|
360
|
+
className: resolvedType === "none" ? "hidden" : void 0
|
|
361
|
+
}
|
|
362
|
+
),
|
|
363
|
+
(orientation === "horizontal" || orientation === "both") && /* @__PURE__ */ jsx(
|
|
364
|
+
ScrollAreaScrollbar,
|
|
365
|
+
{
|
|
366
|
+
orientation: "horizontal",
|
|
367
|
+
className: resolvedType === "none" ? "hidden" : void 0
|
|
368
|
+
}
|
|
369
|
+
),
|
|
370
|
+
/* @__PURE__ */ jsx(RadixScrollArea.Corner, { className: "bg-m3-surface-container" })
|
|
371
|
+
]
|
|
372
|
+
})
|
|
373
|
+
);
|
|
374
|
+
}
|
|
375
|
+
);
|
|
376
|
+
ScrollArea.displayName = "ScrollArea";
|
|
377
|
+
var ScrollAreaScrollbar = React38.forwardRef((_a, ref) => {
|
|
378
|
+
var _b = _a, { className, orientation = "vertical" } = _b, props = __objRest(_b, ["className", "orientation"]);
|
|
379
|
+
return /* @__PURE__ */ jsx(
|
|
380
|
+
RadixScrollArea.Scrollbar,
|
|
381
|
+
__spreadProps(__spreadValues({
|
|
382
|
+
ref,
|
|
383
|
+
orientation,
|
|
384
|
+
className: cn(
|
|
385
|
+
"flex touch-none select-none transition-all duration-300 ease-in-out",
|
|
386
|
+
"absolute z-50",
|
|
387
|
+
orientation === "vertical" && "right-0 top-0 bottom-0 w-2.5 border-l border-l-transparent p-px",
|
|
388
|
+
orientation === "horizontal" && "bottom-0 left-0 right-0 h-2.5 flex-col border-t border-t-transparent p-px",
|
|
389
|
+
"data-[state=hidden]:opacity-0 data-[state=visible]:opacity-100",
|
|
390
|
+
className
|
|
391
|
+
)
|
|
392
|
+
}, props), {
|
|
393
|
+
children: /* @__PURE__ */ jsx(
|
|
394
|
+
RadixScrollArea.Thumb,
|
|
395
|
+
{
|
|
396
|
+
className: cn(
|
|
397
|
+
"relative flex-1 rounded-full bg-m3-on-surface/25 transition-colors duration-200",
|
|
398
|
+
"hover:bg-m3-on-surface/40 active:bg-m3-on-surface/55",
|
|
399
|
+
"before:absolute before:left-1/2 before:top-1/2 before:min-h-11 before:min-w-11 before:-translate-x-1/2 before:-translate-y-1/2"
|
|
400
|
+
)
|
|
401
|
+
}
|
|
402
|
+
)
|
|
403
|
+
})
|
|
404
|
+
);
|
|
405
|
+
});
|
|
406
|
+
ScrollAreaScrollbar.displayName = RadixScrollArea.Scrollbar.displayName;
|
|
407
|
+
var ScrollAreaCorner = React38.forwardRef((_a, ref) => {
|
|
408
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
409
|
+
return /* @__PURE__ */ jsx(
|
|
410
|
+
RadixScrollArea.Corner,
|
|
411
|
+
__spreadValues({
|
|
412
|
+
ref,
|
|
413
|
+
className: cn("bg-m3-surface-container", className)
|
|
414
|
+
}, props)
|
|
415
|
+
);
|
|
416
|
+
});
|
|
417
|
+
ScrollAreaCorner.displayName = "ScrollAreaCorner";
|
|
296
418
|
|
|
297
419
|
// src/ui/menu/menu-animations.ts
|
|
298
420
|
var FAST_EFFECTS_TRANSITION = {
|
|
@@ -351,7 +473,7 @@ var SUBMENU_CONTAINER_VARIANTS = {
|
|
|
351
473
|
transition: FAST_EFFECTS_TRANSITION
|
|
352
474
|
}
|
|
353
475
|
};
|
|
354
|
-
var MenuContext =
|
|
476
|
+
var MenuContext = React38.createContext({
|
|
355
477
|
variant: "baseline",
|
|
356
478
|
colorVariant: "standard",
|
|
357
479
|
density: 0,
|
|
@@ -369,7 +491,7 @@ function MenuProvider({
|
|
|
369
491
|
onOpenChange,
|
|
370
492
|
children
|
|
371
493
|
}) {
|
|
372
|
-
const value =
|
|
494
|
+
const value = React38.useMemo(
|
|
373
495
|
() => ({
|
|
374
496
|
variant,
|
|
375
497
|
colorVariant,
|
|
@@ -383,8 +505,8 @@ function MenuProvider({
|
|
|
383
505
|
return /* @__PURE__ */ jsx(MenuContext.Provider, { value, children });
|
|
384
506
|
}
|
|
385
507
|
function useMenuContext() {
|
|
386
|
-
const ctx =
|
|
387
|
-
return
|
|
508
|
+
const ctx = React38.useContext(MenuContext);
|
|
509
|
+
return React38.useMemo(
|
|
388
510
|
() => Object.assign(ctx, {
|
|
389
511
|
get isStatic() {
|
|
390
512
|
return ctx.menuPrimitive === "static";
|
|
@@ -504,10 +626,10 @@ var VIBRANT_COLORS = {
|
|
|
504
626
|
var DIVIDER_PADDING = "mx-3 my-0.5";
|
|
505
627
|
var DIVIDER_COLOR = "bg-m3-outline-variant";
|
|
506
628
|
function flattenChildren(nodes) {
|
|
507
|
-
return
|
|
629
|
+
return React38.Children.toArray(nodes).reduce(
|
|
508
630
|
(acc, child) => {
|
|
509
|
-
if (!
|
|
510
|
-
if (child.type ===
|
|
631
|
+
if (!React38.isValidElement(child)) return acc;
|
|
632
|
+
if (child.type === React38.Fragment) {
|
|
511
633
|
return acc.concat(
|
|
512
634
|
flattenChildren(
|
|
513
635
|
child.props.children
|
|
@@ -525,7 +647,7 @@ function ContextMenu({
|
|
|
525
647
|
variant = "baseline",
|
|
526
648
|
colorVariant = "standard"
|
|
527
649
|
}) {
|
|
528
|
-
const [open, setOpen] =
|
|
650
|
+
const [open, setOpen] = React38.useState(false);
|
|
529
651
|
return /* @__PURE__ */ jsx(
|
|
530
652
|
MenuProvider,
|
|
531
653
|
{
|
|
@@ -539,24 +661,30 @@ function ContextMenu({
|
|
|
539
661
|
);
|
|
540
662
|
}
|
|
541
663
|
ContextMenu.displayName = "ContextMenu";
|
|
542
|
-
var ContextMenuTrigger =
|
|
664
|
+
var ContextMenuTrigger = React38.forwardRef((_a, ref) => {
|
|
543
665
|
var _b = _a, { children, asChild = true } = _b, props = __objRest(_b, ["children", "asChild"]);
|
|
544
666
|
return /* @__PURE__ */ jsx(RxContextMenu.Trigger, __spreadProps(__spreadValues({ ref, asChild }, props), { children }));
|
|
545
667
|
});
|
|
546
668
|
ContextMenuTrigger.displayName = "ContextMenuTrigger";
|
|
547
|
-
var ContextMenuContent =
|
|
669
|
+
var ContextMenuContent = React38.forwardRef(
|
|
548
670
|
(_a, ref) => {
|
|
549
671
|
var _b = _a, {
|
|
550
672
|
children,
|
|
551
673
|
hasOverflow = false,
|
|
552
674
|
colorVariant: propColorVariant,
|
|
553
675
|
separatorStyle = "gap",
|
|
676
|
+
maxHeight = "360px",
|
|
677
|
+
viewportRef,
|
|
678
|
+
onViewportRef,
|
|
554
679
|
className
|
|
555
680
|
} = _b, props = __objRest(_b, [
|
|
556
681
|
"children",
|
|
557
682
|
"hasOverflow",
|
|
558
683
|
"colorVariant",
|
|
559
684
|
"separatorStyle",
|
|
685
|
+
"maxHeight",
|
|
686
|
+
"viewportRef",
|
|
687
|
+
"onViewportRef",
|
|
560
688
|
"className"
|
|
561
689
|
]);
|
|
562
690
|
const {
|
|
@@ -567,7 +695,18 @@ var ContextMenuContent = React37.forwardRef(
|
|
|
567
695
|
const colorVariant = propColorVariant != null ? propColorVariant : contextColorVariant;
|
|
568
696
|
const colors = variant === "baseline" ? BASELINE_COLORS : colorVariant === "vibrant" ? VIBRANT_COLORS : STANDARD_COLORS;
|
|
569
697
|
const isExpressiveGap = variant === "expressive" && separatorStyle === "gap";
|
|
570
|
-
const
|
|
698
|
+
const setViewportNode = React38.useCallback(
|
|
699
|
+
(node) => {
|
|
700
|
+
if (typeof viewportRef === "function") {
|
|
701
|
+
viewportRef(node);
|
|
702
|
+
} else if (viewportRef && typeof viewportRef === "object") {
|
|
703
|
+
viewportRef.current = node;
|
|
704
|
+
}
|
|
705
|
+
onViewportRef == null ? void 0 : onViewportRef(node);
|
|
706
|
+
},
|
|
707
|
+
[viewportRef, onViewportRef]
|
|
708
|
+
);
|
|
709
|
+
const containerClassName = React38.useMemo(
|
|
571
710
|
() => variant === "expressive" ? cn(
|
|
572
711
|
"z-50 flex flex-col w-full",
|
|
573
712
|
MENU_MIN_WIDTH,
|
|
@@ -594,12 +733,12 @@ var ContextMenuContent = React37.forwardRef(
|
|
|
594
733
|
),
|
|
595
734
|
[variant, isExpressiveGap, hasOverflow, className, colors.containerBg]
|
|
596
735
|
);
|
|
597
|
-
const renderedChildren =
|
|
736
|
+
const renderedChildren = React38.useMemo(() => {
|
|
598
737
|
if (variant !== "expressive") return children;
|
|
599
738
|
const validChildren = flattenChildren(children);
|
|
600
739
|
const groupCount = validChildren.length;
|
|
601
740
|
const enhanced = validChildren.map(
|
|
602
|
-
(child, i) =>
|
|
741
|
+
(child, i) => React38.cloneElement(
|
|
603
742
|
child,
|
|
604
743
|
{ index: i, count: groupCount, isGapVariant: isExpressiveGap }
|
|
605
744
|
)
|
|
@@ -632,7 +771,15 @@ var ContextMenuContent = React37.forwardRef(
|
|
|
632
771
|
style: __spreadProps(__spreadValues({}, props.style), {
|
|
633
772
|
transformOrigin: "var(--radix-context-menu-content-transform-origin)"
|
|
634
773
|
}),
|
|
635
|
-
children: renderedChildren
|
|
774
|
+
children: hasOverflow || !maxHeight ? renderedChildren : /* @__PURE__ */ jsx(
|
|
775
|
+
ScrollArea,
|
|
776
|
+
{
|
|
777
|
+
style: { maxHeight },
|
|
778
|
+
className: "w-full flex-1 min-h-0",
|
|
779
|
+
viewportRef: setViewportNode,
|
|
780
|
+
children: renderedChildren
|
|
781
|
+
}
|
|
782
|
+
)
|
|
636
783
|
}
|
|
637
784
|
) })) }) });
|
|
638
785
|
}
|
|
@@ -660,12 +807,12 @@ function Menu(_a) {
|
|
|
660
807
|
]);
|
|
661
808
|
var _a2;
|
|
662
809
|
const resolvedVariant = (_a2 = variant != null ? variant : menuVariant) != null ? _a2 : "baseline";
|
|
663
|
-
const [internalOpen, setInternalOpen] =
|
|
810
|
+
const [internalOpen, setInternalOpen] = React38.useState(
|
|
664
811
|
() => defaultOpen != null ? defaultOpen : false
|
|
665
812
|
);
|
|
666
813
|
const isControlled = controlledOpen !== void 0;
|
|
667
814
|
const open = isControlled ? controlledOpen : internalOpen;
|
|
668
|
-
const handleOpenChange =
|
|
815
|
+
const handleOpenChange = React38.useCallback(
|
|
669
816
|
(next) => {
|
|
670
817
|
if (!isControlled) setInternalOpen(next);
|
|
671
818
|
controlledOnOpenChange == null ? void 0 : controlledOnOpenChange(next);
|
|
@@ -693,12 +840,12 @@ function Menu(_a) {
|
|
|
693
840
|
);
|
|
694
841
|
}
|
|
695
842
|
Menu.displayName = "Menu";
|
|
696
|
-
var MenuTrigger =
|
|
843
|
+
var MenuTrigger = React38.forwardRef((_a, ref) => {
|
|
697
844
|
var _b = _a, { children, asChild = true } = _b, props = __objRest(_b, ["children", "asChild"]);
|
|
698
845
|
return /* @__PURE__ */ jsx(DropdownMenu.Trigger, __spreadProps(__spreadValues({ ref, asChild }, props), { children }));
|
|
699
846
|
});
|
|
700
847
|
MenuTrigger.displayName = "MenuTrigger";
|
|
701
|
-
var MenuContent =
|
|
848
|
+
var MenuContent = React38.forwardRef(
|
|
702
849
|
(_a, ref) => {
|
|
703
850
|
var _b = _a, {
|
|
704
851
|
children,
|
|
@@ -709,6 +856,9 @@ var MenuContent = React37.forwardRef(
|
|
|
709
856
|
colorVariant: propColorVariant,
|
|
710
857
|
separatorStyle = "gap",
|
|
711
858
|
matchTriggerWidth = false,
|
|
859
|
+
maxHeight = "360px",
|
|
860
|
+
viewportRef,
|
|
861
|
+
onViewportRef,
|
|
712
862
|
className
|
|
713
863
|
} = _b, props = __objRest(_b, [
|
|
714
864
|
"children",
|
|
@@ -719,6 +869,9 @@ var MenuContent = React37.forwardRef(
|
|
|
719
869
|
"colorVariant",
|
|
720
870
|
"separatorStyle",
|
|
721
871
|
"matchTriggerWidth",
|
|
872
|
+
"maxHeight",
|
|
873
|
+
"viewportRef",
|
|
874
|
+
"onViewportRef",
|
|
722
875
|
"className"
|
|
723
876
|
]);
|
|
724
877
|
const {
|
|
@@ -729,7 +882,18 @@ var MenuContent = React37.forwardRef(
|
|
|
729
882
|
const colorVariant = propColorVariant != null ? propColorVariant : contextColorVariant;
|
|
730
883
|
const colors = variant === "baseline" ? BASELINE_COLORS : colorVariant === "vibrant" ? VIBRANT_COLORS : STANDARD_COLORS;
|
|
731
884
|
const isExpressiveGap = variant === "expressive" && separatorStyle === "gap";
|
|
732
|
-
const
|
|
885
|
+
const setViewportNode = React38.useCallback(
|
|
886
|
+
(node) => {
|
|
887
|
+
if (typeof viewportRef === "function") {
|
|
888
|
+
viewportRef(node);
|
|
889
|
+
} else if (viewportRef && typeof viewportRef === "object") {
|
|
890
|
+
viewportRef.current = node;
|
|
891
|
+
}
|
|
892
|
+
onViewportRef == null ? void 0 : onViewportRef(node);
|
|
893
|
+
},
|
|
894
|
+
[viewportRef, onViewportRef]
|
|
895
|
+
);
|
|
896
|
+
const containerClassName = React38.useMemo(() => {
|
|
733
897
|
const widthClass = matchTriggerWidth ? "w-[var(--radix-dropdown-menu-trigger-width)]" : cn(MENU_MIN_WIDTH, MENU_MAX_WIDTH);
|
|
734
898
|
return variant === "expressive" ? cn(
|
|
735
899
|
"z-50 flex flex-col",
|
|
@@ -762,7 +926,7 @@ var MenuContent = React37.forwardRef(
|
|
|
762
926
|
className,
|
|
763
927
|
colors.containerBg
|
|
764
928
|
]);
|
|
765
|
-
const renderedChildren =
|
|
929
|
+
const renderedChildren = React38.useMemo(() => {
|
|
766
930
|
if (variant !== "expressive") return children;
|
|
767
931
|
const validChildren = flattenChildren(children);
|
|
768
932
|
const groupCount = validChildren.length;
|
|
@@ -771,7 +935,7 @@ var MenuContent = React37.forwardRef(
|
|
|
771
935
|
if (typeof child.type === "string") return child;
|
|
772
936
|
const defaultItemPosition = groupCount === 1 ? "standalone" : i === 0 ? "leading" : i === groupCount - 1 ? "trailing" : "middle";
|
|
773
937
|
const itemPosition = (_a2 = child.props.itemPosition) != null ? _a2 : defaultItemPosition;
|
|
774
|
-
return
|
|
938
|
+
return React38.cloneElement(
|
|
775
939
|
child,
|
|
776
940
|
{
|
|
777
941
|
index: i,
|
|
@@ -821,7 +985,15 @@ var MenuContent = React37.forwardRef(
|
|
|
821
985
|
style: __spreadProps(__spreadValues({}, props.style), {
|
|
822
986
|
transformOrigin: "var(--radix-dropdown-menu-content-transform-origin)"
|
|
823
987
|
}),
|
|
824
|
-
children: renderedChildren
|
|
988
|
+
children: hasOverflow || !maxHeight ? renderedChildren : /* @__PURE__ */ jsx(
|
|
989
|
+
ScrollArea,
|
|
990
|
+
{
|
|
991
|
+
style: { maxHeight },
|
|
992
|
+
className: "w-full flex-1 min-h-0",
|
|
993
|
+
viewportRef: setViewportNode,
|
|
994
|
+
children: renderedChildren
|
|
995
|
+
}
|
|
996
|
+
)
|
|
825
997
|
}
|
|
826
998
|
)
|
|
827
999
|
})
|
|
@@ -829,7 +1001,7 @@ var MenuContent = React37.forwardRef(
|
|
|
829
1001
|
}
|
|
830
1002
|
);
|
|
831
1003
|
MenuContent.displayName = "MenuContent";
|
|
832
|
-
var MenuDivider =
|
|
1004
|
+
var MenuDivider = React38.forwardRef(
|
|
833
1005
|
(_a, ref) => {
|
|
834
1006
|
var _b = _a, { className, isGapVariant: _isGapVariant } = _b, props = __objRest(_b, ["className", "isGapVariant"]);
|
|
835
1007
|
const { menuVariant } = useMenuContext();
|
|
@@ -860,7 +1032,7 @@ function getGroupPosition(index, count) {
|
|
|
860
1032
|
function getGroupActiveShape(position) {
|
|
861
1033
|
return GROUP_SHAPES[`${position}Active`];
|
|
862
1034
|
}
|
|
863
|
-
var MenuGroup =
|
|
1035
|
+
var MenuGroup = React38.forwardRef(
|
|
864
1036
|
(_a, ref) => {
|
|
865
1037
|
var _b = _a, {
|
|
866
1038
|
children,
|
|
@@ -886,7 +1058,7 @@ var MenuGroup = React37.forwardRef(
|
|
|
886
1058
|
const colors = menuVariant === "baseline" ? BASELINE_COLORS : colorVariant === "vibrant" ? VIBRANT_COLORS : STANDARD_COLORS;
|
|
887
1059
|
const position = getGroupPosition(index, count);
|
|
888
1060
|
const currentShape = getGroupActiveShape(position);
|
|
889
|
-
const enhancedChildren =
|
|
1061
|
+
const enhancedChildren = React38.useMemo(() => {
|
|
890
1062
|
const valid = flattenChildren(children);
|
|
891
1063
|
const itemCount = valid.length;
|
|
892
1064
|
return valid.map((child, i) => {
|
|
@@ -894,7 +1066,7 @@ var MenuGroup = React37.forwardRef(
|
|
|
894
1066
|
if (typeof child.type === "string") return child;
|
|
895
1067
|
const defaultItemPosition = itemCount === 1 ? "standalone" : i === 0 ? "leading" : i === itemCount - 1 ? "trailing" : "middle";
|
|
896
1068
|
const itemPosition2 = (_a2 = child.props.itemPosition) != null ? _a2 : defaultItemPosition;
|
|
897
|
-
return
|
|
1069
|
+
return React38.cloneElement(child, {
|
|
898
1070
|
itemPosition: itemPosition2,
|
|
899
1071
|
colorVariant
|
|
900
1072
|
});
|
|
@@ -957,7 +1129,7 @@ var VARIANT_FONT = {
|
|
|
957
1129
|
rounded: "'Material Symbols Rounded'",
|
|
958
1130
|
sharp: "'Material Symbols Sharp'"
|
|
959
1131
|
};
|
|
960
|
-
var IconComponent =
|
|
1132
|
+
var IconComponent = React38.forwardRef(
|
|
961
1133
|
(_a, ref) => {
|
|
962
1134
|
var _b = _a, {
|
|
963
1135
|
name,
|
|
@@ -1023,14 +1195,14 @@ var IconComponent = React37.forwardRef(
|
|
|
1023
1195
|
}
|
|
1024
1196
|
);
|
|
1025
1197
|
IconComponent.displayName = "Icon";
|
|
1026
|
-
var Icon =
|
|
1198
|
+
var Icon = React38.memo(IconComponent);
|
|
1027
1199
|
function getItemShapeClass(position, selected, isStatic = false, menuVariant = "expressive") {
|
|
1028
1200
|
if (menuVariant === "baseline") return BASELINE_ITEM_SHAPE;
|
|
1029
1201
|
if (selected) return ITEM_SHAPE_CLASSES.selected;
|
|
1030
1202
|
if (isStatic && position === "standalone") return "rounded-[12px]";
|
|
1031
1203
|
return ITEM_SHAPE_CLASSES[position];
|
|
1032
1204
|
}
|
|
1033
|
-
var MenuItem =
|
|
1205
|
+
var MenuItem = React38.forwardRef(
|
|
1034
1206
|
(_a, ref) => {
|
|
1035
1207
|
var _b = _a, {
|
|
1036
1208
|
children,
|
|
@@ -1239,31 +1411,31 @@ function SubMenu({
|
|
|
1239
1411
|
}) {
|
|
1240
1412
|
const { colorVariant: contextColorVariant, menuPrimitive } = useMenuContext();
|
|
1241
1413
|
const colorVariant = propColorVariant != null ? propColorVariant : contextColorVariant;
|
|
1242
|
-
const [open, setOpen] =
|
|
1243
|
-
const openTimerRef =
|
|
1244
|
-
const closeTimerRef =
|
|
1414
|
+
const [open, setOpen] = React38.useState(false);
|
|
1415
|
+
const openTimerRef = React38.useRef(null);
|
|
1416
|
+
const closeTimerRef = React38.useRef(
|
|
1245
1417
|
null
|
|
1246
1418
|
);
|
|
1247
|
-
const clearTimers =
|
|
1419
|
+
const clearTimers = React38.useCallback(() => {
|
|
1248
1420
|
if (openTimerRef.current) clearTimeout(openTimerRef.current);
|
|
1249
1421
|
if (closeTimerRef.current) clearTimeout(closeTimerRef.current);
|
|
1250
1422
|
}, []);
|
|
1251
|
-
const handleTriggerPointerEnter =
|
|
1423
|
+
const handleTriggerPointerEnter = React38.useCallback(() => {
|
|
1252
1424
|
clearTimers();
|
|
1253
1425
|
openTimerRef.current = setTimeout(() => setOpen(true), hoverOpenDelay);
|
|
1254
1426
|
}, [hoverOpenDelay, clearTimers]);
|
|
1255
|
-
const handleTriggerPointerLeave =
|
|
1427
|
+
const handleTriggerPointerLeave = React38.useCallback(() => {
|
|
1256
1428
|
clearTimers();
|
|
1257
1429
|
closeTimerRef.current = setTimeout(() => setOpen(false), hoverCloseDelay);
|
|
1258
1430
|
}, [hoverCloseDelay, clearTimers]);
|
|
1259
|
-
const handleContentPointerEnter =
|
|
1431
|
+
const handleContentPointerEnter = React38.useCallback(() => {
|
|
1260
1432
|
clearTimers();
|
|
1261
1433
|
}, [clearTimers]);
|
|
1262
|
-
const handleContentPointerLeave =
|
|
1434
|
+
const handleContentPointerLeave = React38.useCallback(() => {
|
|
1263
1435
|
clearTimers();
|
|
1264
1436
|
closeTimerRef.current = setTimeout(() => setOpen(false), hoverCloseDelay);
|
|
1265
1437
|
}, [hoverCloseDelay, clearTimers]);
|
|
1266
|
-
|
|
1438
|
+
React38.useEffect(() => () => clearTimers(), [clearTimers]);
|
|
1267
1439
|
const Sub3 = menuPrimitive === "context" ? RxContextMenu.Sub : DropdownMenu.Sub;
|
|
1268
1440
|
const SubTrigger3 = menuPrimitive === "context" ? RxContextMenu.SubTrigger : DropdownMenu.SubTrigger;
|
|
1269
1441
|
const SubContent3 = menuPrimitive === "context" ? RxContextMenu.SubContent : DropdownMenu.SubContent;
|
|
@@ -1275,7 +1447,7 @@ function SubMenu({
|
|
|
1275
1447
|
className: "w-full outline-none",
|
|
1276
1448
|
onPointerEnter: handleTriggerPointerEnter,
|
|
1277
1449
|
onPointerLeave: handleTriggerPointerLeave,
|
|
1278
|
-
children:
|
|
1450
|
+
children: React38.isValidElement(trigger) ? React38.cloneElement(trigger, {
|
|
1279
1451
|
isSubTrigger: true,
|
|
1280
1452
|
// Auto-add chevron if missing
|
|
1281
1453
|
trailingIcon: trigger.props.trailingIcon || /* @__PURE__ */ jsx(Icon, { name: "chevron_right", size: 20 })
|
|
@@ -1352,7 +1524,7 @@ function SubMenuContent({
|
|
|
1352
1524
|
);
|
|
1353
1525
|
}
|
|
1354
1526
|
SubMenuContent.displayName = "SubMenuContent";
|
|
1355
|
-
var VerticalMenuDivider =
|
|
1527
|
+
var VerticalMenuDivider = React38.forwardRef((_a, ref) => {
|
|
1356
1528
|
var _b = _a, { className, index, count, isGapVariant } = _b, props = __objRest(_b, ["className", "index", "count", "isGapVariant"]);
|
|
1357
1529
|
return /* @__PURE__ */ jsx(
|
|
1358
1530
|
"hr",
|
|
@@ -1372,7 +1544,7 @@ var VerticalMenuDivider = React37.forwardRef((_a, ref) => {
|
|
|
1372
1544
|
});
|
|
1373
1545
|
VerticalMenuDivider.displayName = "VerticalMenuDivider";
|
|
1374
1546
|
var VerticalMenuGroup = MenuGroup;
|
|
1375
|
-
var VerticalMenuContent =
|
|
1547
|
+
var VerticalMenuContent = React38.forwardRef(
|
|
1376
1548
|
(_a, ref) => {
|
|
1377
1549
|
var _b = _a, {
|
|
1378
1550
|
children,
|
|
@@ -1388,7 +1560,7 @@ var VerticalMenuContent = React37.forwardRef(
|
|
|
1388
1560
|
const { colorVariant: contextColorVariant } = useMenuContext();
|
|
1389
1561
|
const colorVariant = propColorVariant != null ? propColorVariant : contextColorVariant;
|
|
1390
1562
|
const colors = colorVariant === "vibrant" ? VIBRANT_COLORS : STANDARD_COLORS;
|
|
1391
|
-
const renderedChildren =
|
|
1563
|
+
const renderedChildren = React38.useMemo(() => {
|
|
1392
1564
|
const valid = flattenChildren(children);
|
|
1393
1565
|
const groupCount = valid.length;
|
|
1394
1566
|
const enhanced = valid.map((child, i) => {
|
|
@@ -1396,7 +1568,7 @@ var VerticalMenuContent = React37.forwardRef(
|
|
|
1396
1568
|
if (typeof child.type === "string") return child;
|
|
1397
1569
|
const defaultItemPosition = groupCount === 1 ? "standalone" : i === 0 ? "leading" : i === groupCount - 1 ? "trailing" : "middle";
|
|
1398
1570
|
const itemPosition = (_a2 = child.props.itemPosition) != null ? _a2 : defaultItemPosition;
|
|
1399
|
-
return
|
|
1571
|
+
return React38.cloneElement(
|
|
1400
1572
|
child,
|
|
1401
1573
|
{
|
|
1402
1574
|
index: i,
|
|
@@ -1439,13 +1611,13 @@ var VerticalMenuContent = React37.forwardRef(
|
|
|
1439
1611
|
}
|
|
1440
1612
|
);
|
|
1441
1613
|
VerticalMenuContent.displayName = "VerticalMenuContent";
|
|
1442
|
-
var VerticalMenu =
|
|
1614
|
+
var VerticalMenu = React38.forwardRef((_a, ref) => {
|
|
1443
1615
|
var _b = _a, { children, colorVariant = "standard", className } = _b, props = __objRest(_b, ["children", "colorVariant", "className"]);
|
|
1444
|
-
const noop =
|
|
1616
|
+
const noop = React38.useCallback(() => {
|
|
1445
1617
|
}, []);
|
|
1446
1618
|
const colors = colorVariant === "vibrant" ? VIBRANT_COLORS : STANDARD_COLORS;
|
|
1447
|
-
const containerRef =
|
|
1448
|
-
const mergedRef =
|
|
1619
|
+
const containerRef = React38.useRef(null);
|
|
1620
|
+
const mergedRef = React38.useCallback(
|
|
1449
1621
|
(node) => {
|
|
1450
1622
|
containerRef.current = node;
|
|
1451
1623
|
if (typeof ref === "function") ref(node);
|
|
@@ -1454,7 +1626,7 @@ var VerticalMenu = React37.forwardRef((_a, ref) => {
|
|
|
1454
1626
|
},
|
|
1455
1627
|
[ref]
|
|
1456
1628
|
);
|
|
1457
|
-
const handleKeyDown =
|
|
1629
|
+
const handleKeyDown = React38.useCallback(
|
|
1458
1630
|
(e) => {
|
|
1459
1631
|
var _a2;
|
|
1460
1632
|
if (!containerRef.current) return;
|
|
@@ -1537,7 +1709,7 @@ var VerticalMenu = React37.forwardRef((_a, ref) => {
|
|
|
1537
1709
|
});
|
|
1538
1710
|
VerticalMenu.displayName = "VerticalMenu";
|
|
1539
1711
|
function detectSeparatorStyle(children) {
|
|
1540
|
-
const child =
|
|
1712
|
+
const child = React38.Children.toArray(children).find(React38.isValidElement);
|
|
1541
1713
|
if (child) {
|
|
1542
1714
|
const style = child.props.separatorStyle;
|
|
1543
1715
|
if (style) return style;
|
|
@@ -1618,11 +1790,11 @@ function AppBarColumn({
|
|
|
1618
1790
|
maxItemCount,
|
|
1619
1791
|
className
|
|
1620
1792
|
}) {
|
|
1621
|
-
const containerRef =
|
|
1622
|
-
const [visibleCount, setVisibleCount] =
|
|
1793
|
+
const containerRef = React38.useRef(null);
|
|
1794
|
+
const [visibleCount, setVisibleCount] = React38.useState(
|
|
1623
1795
|
maxItemCount != null ? maxItemCount : items.length
|
|
1624
1796
|
);
|
|
1625
|
-
|
|
1797
|
+
React38.useEffect(() => {
|
|
1626
1798
|
if (maxItemCount !== void 0) {
|
|
1627
1799
|
setVisibleCount(Math.min(maxItemCount, items.length));
|
|
1628
1800
|
return;
|
|
@@ -1670,11 +1842,11 @@ function AppBarColumn({
|
|
|
1670
1842
|
);
|
|
1671
1843
|
}
|
|
1672
1844
|
function AppBarRow({ items, maxItemCount, className }) {
|
|
1673
|
-
const containerRef =
|
|
1674
|
-
const [visibleCount, setVisibleCount] =
|
|
1845
|
+
const containerRef = React38.useRef(null);
|
|
1846
|
+
const [visibleCount, setVisibleCount] = React38.useState(
|
|
1675
1847
|
maxItemCount != null ? maxItemCount : items.length
|
|
1676
1848
|
);
|
|
1677
|
-
|
|
1849
|
+
React38.useEffect(() => {
|
|
1678
1850
|
if (maxItemCount !== void 0) {
|
|
1679
1851
|
setVisibleCount(Math.min(maxItemCount, items.length));
|
|
1680
1852
|
return;
|
|
@@ -1728,12 +1900,12 @@ function useAppBarScroll({
|
|
|
1728
1900
|
collapsedHeight = 64,
|
|
1729
1901
|
expandedHeight = 112
|
|
1730
1902
|
} = {}) {
|
|
1731
|
-
const [isScrolled, setIsScrolled] =
|
|
1732
|
-
const [collapsedFraction, setCollapsedFraction] =
|
|
1733
|
-
const [isHidden, setIsHidden] =
|
|
1734
|
-
const prevScrollYRef =
|
|
1903
|
+
const [isScrolled, setIsScrolled] = React38.useState(false);
|
|
1904
|
+
const [collapsedFraction, setCollapsedFraction] = React38.useState(0);
|
|
1905
|
+
const [isHidden, setIsHidden] = React38.useState(false);
|
|
1906
|
+
const prevScrollYRef = React38.useRef(0);
|
|
1735
1907
|
const hideThreshold = 64;
|
|
1736
|
-
|
|
1908
|
+
React38.useEffect(() => {
|
|
1737
1909
|
var _a;
|
|
1738
1910
|
const scrollDistance = expandedHeight - collapsedHeight;
|
|
1739
1911
|
const getScrollY = () => {
|
|
@@ -1868,7 +2040,7 @@ function useFlexibleAppBar({
|
|
|
1868
2040
|
expandedHeight
|
|
1869
2041
|
});
|
|
1870
2042
|
const scrollProgress = useMotionValue(0);
|
|
1871
|
-
|
|
2043
|
+
React38.useEffect(() => {
|
|
1872
2044
|
scrollProgress.set(
|
|
1873
2045
|
shouldReduceMotion ? collapsedFraction > 0.5 ? 1 : 0 : collapsedFraction
|
|
1874
2046
|
);
|
|
@@ -2246,7 +2418,7 @@ function SearchAppBar({
|
|
|
2246
2418
|
}) {
|
|
2247
2419
|
var _a, _b;
|
|
2248
2420
|
const shouldReduceMotion = useReducedMotion();
|
|
2249
|
-
const [isSearchOpen, setIsSearchOpen] =
|
|
2421
|
+
const [isSearchOpen, setIsSearchOpen] = React38.useState(false);
|
|
2250
2422
|
const { isScrolled } = useAppBarScroll({
|
|
2251
2423
|
scrollElement,
|
|
2252
2424
|
behavior: scrollBehavior === "exitUntilCollapsed" ? "pinned" : scrollBehavior
|
|
@@ -2387,8 +2559,8 @@ function SearchView({
|
|
|
2387
2559
|
className
|
|
2388
2560
|
}) {
|
|
2389
2561
|
const shouldReduceMotion = useReducedMotion();
|
|
2390
|
-
const inputRef =
|
|
2391
|
-
|
|
2562
|
+
const inputRef = React38.useRef(null);
|
|
2563
|
+
React38.useEffect(() => {
|
|
2392
2564
|
const timer = window.setTimeout(() => {
|
|
2393
2565
|
var _a;
|
|
2394
2566
|
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
@@ -2679,7 +2851,7 @@ function SmallAppBar({
|
|
|
2679
2851
|
"small-app-bar"
|
|
2680
2852
|
) });
|
|
2681
2853
|
}
|
|
2682
|
-
var RippleItem =
|
|
2854
|
+
var RippleItem = React38.memo(function RippleItem2({
|
|
2683
2855
|
ripple,
|
|
2684
2856
|
onDone
|
|
2685
2857
|
}) {
|
|
@@ -2723,8 +2895,8 @@ function Ripple({
|
|
|
2723
2895
|
}
|
|
2724
2896
|
function useRippleState(options = {}) {
|
|
2725
2897
|
const { disabled = false } = options;
|
|
2726
|
-
const [ripples, setRipples] =
|
|
2727
|
-
const onPointerDown =
|
|
2898
|
+
const [ripples, setRipples] = React38.useState([]);
|
|
2899
|
+
const onPointerDown = React38.useCallback(
|
|
2728
2900
|
(e) => {
|
|
2729
2901
|
if (disabled) return;
|
|
2730
2902
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
@@ -2741,7 +2913,7 @@ function useRippleState(options = {}) {
|
|
|
2741
2913
|
},
|
|
2742
2914
|
[disabled]
|
|
2743
2915
|
);
|
|
2744
|
-
const removeRipple =
|
|
2916
|
+
const removeRipple = React38.useCallback((id) => {
|
|
2745
2917
|
setRipples((prev) => prev.filter((r) => r.id !== id));
|
|
2746
2918
|
}, []);
|
|
2747
2919
|
return { ripples, onPointerDown, removeRipple };
|
|
@@ -4671,11 +4843,11 @@ function getNavigationShapeStyle(shape, width = 56, height = 56) {
|
|
|
4671
4843
|
function isSquareShape(shape) {
|
|
4672
4844
|
return Boolean(shape && shape !== "pill");
|
|
4673
4845
|
}
|
|
4674
|
-
var NavigationBarContext =
|
|
4846
|
+
var NavigationBarContext = React38.createContext({ variant: "flexible" });
|
|
4675
4847
|
function cloneIconWithFill(icon, selected) {
|
|
4676
|
-
if (!
|
|
4848
|
+
if (!React38.isValidElement(icon)) return icon;
|
|
4677
4849
|
if (icon.type === Icon) {
|
|
4678
|
-
return
|
|
4850
|
+
return React38.cloneElement(
|
|
4679
4851
|
icon,
|
|
4680
4852
|
{ fill: selected ? 1 : 0, animateFill: true }
|
|
4681
4853
|
);
|
|
@@ -4687,7 +4859,7 @@ function ActivePill({
|
|
|
4687
4859
|
width = 56,
|
|
4688
4860
|
height = 32
|
|
4689
4861
|
}) {
|
|
4690
|
-
const { activeIndicatorTransition } =
|
|
4862
|
+
const { activeIndicatorTransition } = React38.useContext(NavigationBarContext);
|
|
4691
4863
|
const shapeStyle = getNavigationShapeStyle(shape, width, height);
|
|
4692
4864
|
return /* @__PURE__ */ jsx(
|
|
4693
4865
|
m.div,
|
|
@@ -4759,7 +4931,7 @@ function IconContainer({ selected, badge, children }) {
|
|
|
4759
4931
|
}
|
|
4760
4932
|
);
|
|
4761
4933
|
}
|
|
4762
|
-
var NavigationBarItemComponent =
|
|
4934
|
+
var NavigationBarItemComponent = React38.forwardRef(
|
|
4763
4935
|
({
|
|
4764
4936
|
selected,
|
|
4765
4937
|
icon,
|
|
@@ -4783,7 +4955,7 @@ var NavigationBarItemComponent = React37.forwardRef(
|
|
|
4783
4955
|
labelVisibility: contextLabelVisibility,
|
|
4784
4956
|
shapeSize: contextShapeSize,
|
|
4785
4957
|
itemClassName: contextItemClassName
|
|
4786
|
-
} =
|
|
4958
|
+
} = React38.useContext(NavigationBarContext);
|
|
4787
4959
|
const activeShape = (_a = shapeProp != null ? shapeProp : contextShape) != null ? _a : "pill";
|
|
4788
4960
|
const isSquare = isSquareShape(activeShape);
|
|
4789
4961
|
const resolvedShapeSize = (_b = shapeSizeProp != null ? shapeSizeProp : contextShapeSize) != null ? _b : 56;
|
|
@@ -4797,7 +4969,7 @@ var NavigationBarItemComponent = React37.forwardRef(
|
|
|
4797
4969
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
4798
4970
|
disabled
|
|
4799
4971
|
});
|
|
4800
|
-
const handleClick =
|
|
4972
|
+
const handleClick = React38.useCallback(
|
|
4801
4973
|
(e) => {
|
|
4802
4974
|
if (disabled) {
|
|
4803
4975
|
e.preventDefault();
|
|
@@ -4824,7 +4996,7 @@ var NavigationBarItemComponent = React37.forwardRef(
|
|
|
4824
4996
|
const iconPillWidth = isSquare ? resolvedShapeSize : 56;
|
|
4825
4997
|
const iconPillHeight = isSquare ? resolvedShapeSize : 32;
|
|
4826
4998
|
if (asChild && children) {
|
|
4827
|
-
const child =
|
|
4999
|
+
const child = React38.Children.only(children);
|
|
4828
5000
|
const innerContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4829
5001
|
/* @__PURE__ */ jsxs(
|
|
4830
5002
|
"div",
|
|
@@ -4949,7 +5121,7 @@ var NavigationBarItemComponent = React37.forwardRef(
|
|
|
4949
5121
|
onClick: handleClick,
|
|
4950
5122
|
onPointerDown,
|
|
4951
5123
|
className: itemClassName,
|
|
4952
|
-
children:
|
|
5124
|
+
children: React38.cloneElement(child, { children: innerContent })
|
|
4953
5125
|
}
|
|
4954
5126
|
);
|
|
4955
5127
|
}
|
|
@@ -5083,7 +5255,7 @@ var NavigationBarItemComponent = React37.forwardRef(
|
|
|
5083
5255
|
}
|
|
5084
5256
|
);
|
|
5085
5257
|
NavigationBarItemComponent.displayName = "NavigationBarItem";
|
|
5086
|
-
var NavigationBarItem =
|
|
5258
|
+
var NavigationBarItem = React38.memo(NavigationBarItemComponent);
|
|
5087
5259
|
var navContainerVariants = cva(
|
|
5088
5260
|
"flex items-center justify-center select-none transition-transform duration-300 z-50",
|
|
5089
5261
|
{
|
|
@@ -5109,7 +5281,7 @@ var navContainerVariants = cva(
|
|
|
5109
5281
|
}
|
|
5110
5282
|
}
|
|
5111
5283
|
);
|
|
5112
|
-
var NavigationBarComponent =
|
|
5284
|
+
var NavigationBarComponent = React38.forwardRef(
|
|
5113
5285
|
({
|
|
5114
5286
|
variant = "flexible",
|
|
5115
5287
|
itemLayout,
|
|
@@ -5126,18 +5298,18 @@ var NavigationBarComponent = React37.forwardRef(
|
|
|
5126
5298
|
className,
|
|
5127
5299
|
style
|
|
5128
5300
|
}, ref) => {
|
|
5129
|
-
const [isVisible, setIsVisible] =
|
|
5130
|
-
const lastScrollY =
|
|
5301
|
+
const [isVisible, setIsVisible] = React38.useState(true);
|
|
5302
|
+
const lastScrollY = React38.useRef(
|
|
5131
5303
|
typeof window !== "undefined" ? window.scrollY : 0
|
|
5132
5304
|
);
|
|
5133
5305
|
const isSquare = isSquareShape(shape);
|
|
5134
5306
|
const effectiveShapeSize = shapeSize != null ? shapeSize : isSquare ? 56 : 32;
|
|
5135
|
-
const computedMinHeight =
|
|
5307
|
+
const computedMinHeight = React38.useMemo(() => {
|
|
5136
5308
|
const baseHeight = variant === "baseline" ? 80 : 64;
|
|
5137
5309
|
const requiredHeight = itemLayout === "horizontal" || labelVisibility === "unlabeled" ? effectiveShapeSize + 16 : effectiveShapeSize + 32;
|
|
5138
5310
|
return Math.max(baseHeight, requiredHeight);
|
|
5139
5311
|
}, [variant, itemLayout, labelVisibility, effectiveShapeSize]);
|
|
5140
|
-
|
|
5312
|
+
React38.useEffect(() => {
|
|
5141
5313
|
if (typeof window === "undefined" || !hideOnScroll) {
|
|
5142
5314
|
setIsVisible(true);
|
|
5143
5315
|
return;
|
|
@@ -5221,8 +5393,8 @@ var NavigationBarComponent = React37.forwardRef(
|
|
|
5221
5393
|
}
|
|
5222
5394
|
);
|
|
5223
5395
|
NavigationBarComponent.displayName = "NavigationBar";
|
|
5224
|
-
var NavigationBar =
|
|
5225
|
-
var NavigationRailContext =
|
|
5396
|
+
var NavigationBar = React38.memo(NavigationBarComponent);
|
|
5397
|
+
var NavigationRailContext = React38.createContext({
|
|
5226
5398
|
variant: "collapsed",
|
|
5227
5399
|
labelVisibility: "labeled",
|
|
5228
5400
|
activeIndicatorWidth: "hug"
|
|
@@ -5258,9 +5430,9 @@ var railContainerVariants = cva(
|
|
|
5258
5430
|
}
|
|
5259
5431
|
);
|
|
5260
5432
|
function cloneIconWithFill2(icon, selected) {
|
|
5261
|
-
if (!
|
|
5433
|
+
if (!React38.isValidElement(icon)) return icon;
|
|
5262
5434
|
if (icon.type === Icon) {
|
|
5263
|
-
return
|
|
5435
|
+
return React38.cloneElement(
|
|
5264
5436
|
icon,
|
|
5265
5437
|
{ fill: selected ? 1 : 0, animateFill: true }
|
|
5266
5438
|
);
|
|
@@ -5289,7 +5461,7 @@ function ActivePill2({
|
|
|
5289
5461
|
width = 56,
|
|
5290
5462
|
height = 32
|
|
5291
5463
|
}) {
|
|
5292
|
-
const { activeIndicatorTransition } =
|
|
5464
|
+
const { activeIndicatorTransition } = React38.useContext(NavigationRailContext);
|
|
5293
5465
|
const shapeStyle = getNavigationShapeStyle(shape, width, height);
|
|
5294
5466
|
return /* @__PURE__ */ jsx(
|
|
5295
5467
|
m.div,
|
|
@@ -5364,7 +5536,7 @@ function IconContainer2({ selected, badge, children }) {
|
|
|
5364
5536
|
}
|
|
5365
5537
|
);
|
|
5366
5538
|
}
|
|
5367
|
-
var NavigationRailItemComponent =
|
|
5539
|
+
var NavigationRailItemComponent = React38.forwardRef(
|
|
5368
5540
|
({
|
|
5369
5541
|
selected,
|
|
5370
5542
|
icon,
|
|
@@ -5387,7 +5559,7 @@ var NavigationRailItemComponent = React37.forwardRef(
|
|
|
5387
5559
|
shape: contextShape,
|
|
5388
5560
|
shapeSize: contextShapeSize,
|
|
5389
5561
|
activeIndicatorWidth: contextActiveIndicatorWidth
|
|
5390
|
-
} =
|
|
5562
|
+
} = React38.useContext(NavigationRailContext);
|
|
5391
5563
|
const activeShape = (_a = shapeProp != null ? shapeProp : contextShape) != null ? _a : "pill";
|
|
5392
5564
|
const isSquare = isSquareShape(activeShape);
|
|
5393
5565
|
const resolvedShapeSize = (_b = shapeSizeProp != null ? shapeSizeProp : contextShapeSize) != null ? _b : 56;
|
|
@@ -5397,12 +5569,12 @@ var NavigationRailItemComponent = React37.forwardRef(
|
|
|
5397
5569
|
const enableLayout = !isModal;
|
|
5398
5570
|
const isExpandedPill = isExpanded && !isSquare;
|
|
5399
5571
|
const expandedPillWidthClass = activeIndicatorWidth === "fill" ? "w-full" : "w-fit";
|
|
5400
|
-
const activePillId = `rail-pill-${
|
|
5572
|
+
const activePillId = `rail-pill-${React38.useId()}`;
|
|
5401
5573
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
5402
5574
|
disabled
|
|
5403
5575
|
});
|
|
5404
5576
|
const showLabel = isExpanded || labelVisibility === "labeled" || labelVisibility === "auto" && selected;
|
|
5405
|
-
const handleClick =
|
|
5577
|
+
const handleClick = React38.useCallback(
|
|
5406
5578
|
(e) => {
|
|
5407
5579
|
if (disabled) {
|
|
5408
5580
|
e.preventDefault();
|
|
@@ -5424,7 +5596,7 @@ var NavigationRailItemComponent = React37.forwardRef(
|
|
|
5424
5596
|
const iconPillWidth = isSquare ? resolvedShapeSize : 56;
|
|
5425
5597
|
const iconPillHeight = isSquare ? resolvedShapeSize : 32;
|
|
5426
5598
|
if (asChild && children) {
|
|
5427
|
-
const child =
|
|
5599
|
+
const child = React38.Children.only(children);
|
|
5428
5600
|
const innerContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5429
5601
|
/* @__PURE__ */ jsxs(
|
|
5430
5602
|
m.div,
|
|
@@ -5542,7 +5714,7 @@ var NavigationRailItemComponent = React37.forwardRef(
|
|
|
5542
5714
|
onPointerDown,
|
|
5543
5715
|
className: itemClassName,
|
|
5544
5716
|
tabIndex: -1,
|
|
5545
|
-
children:
|
|
5717
|
+
children: React38.cloneElement(child, { children: innerContent })
|
|
5546
5718
|
}
|
|
5547
5719
|
) });
|
|
5548
5720
|
}
|
|
@@ -5670,9 +5842,9 @@ var NavigationRailItemComponent = React37.forwardRef(
|
|
|
5670
5842
|
}
|
|
5671
5843
|
);
|
|
5672
5844
|
NavigationRailItemComponent.displayName = "NavigationRailItem";
|
|
5673
|
-
var NavigationRailItem =
|
|
5845
|
+
var NavigationRailItem = React38.memo(NavigationRailItemComponent);
|
|
5674
5846
|
function useRoving(navRef) {
|
|
5675
|
-
|
|
5847
|
+
React38.useEffect(() => {
|
|
5676
5848
|
if (!navRef.current) return;
|
|
5677
5849
|
const items = getMenuItems(navRef.current);
|
|
5678
5850
|
const selected = items.find(
|
|
@@ -5682,7 +5854,7 @@ function useRoving(navRef) {
|
|
|
5682
5854
|
const firstFocusable = selected != null ? selected : items[0];
|
|
5683
5855
|
if (firstFocusable) firstFocusable.tabIndex = 0;
|
|
5684
5856
|
}, [navRef]);
|
|
5685
|
-
return
|
|
5857
|
+
return React38.useCallback(
|
|
5686
5858
|
(e) => {
|
|
5687
5859
|
if (!navRef.current) return;
|
|
5688
5860
|
const items = getMenuItems(navRef.current);
|
|
@@ -5710,7 +5882,7 @@ function useRoving(navRef) {
|
|
|
5710
5882
|
[navRef]
|
|
5711
5883
|
);
|
|
5712
5884
|
}
|
|
5713
|
-
var NavigationRailComponent =
|
|
5885
|
+
var NavigationRailComponent = React38.forwardRef(
|
|
5714
5886
|
({
|
|
5715
5887
|
variant = "collapsed",
|
|
5716
5888
|
labelVisibility = "labeled",
|
|
@@ -5734,9 +5906,9 @@ var NavigationRailComponent = React37.forwardRef(
|
|
|
5734
5906
|
const isXr = variant === "xr";
|
|
5735
5907
|
const isSpatial = isXr && fabPlacement === "spatialized";
|
|
5736
5908
|
const applyAnimation = !isXr || !isSpatial;
|
|
5737
|
-
const navRef =
|
|
5909
|
+
const navRef = React38.useRef(null);
|
|
5738
5910
|
const handleKeyDown = useRoving(navRef);
|
|
5739
|
-
const setRefs =
|
|
5911
|
+
const setRefs = React38.useCallback(
|
|
5740
5912
|
(node) => {
|
|
5741
5913
|
navRef.current = node;
|
|
5742
5914
|
if (typeof ref === "function") ref(node);
|
|
@@ -5829,7 +6001,7 @@ var NavigationRailComponent = React37.forwardRef(
|
|
|
5829
6001
|
children: fab
|
|
5830
6002
|
}
|
|
5831
6003
|
),
|
|
5832
|
-
|
|
6004
|
+
React38.cloneElement(
|
|
5833
6005
|
navElement,
|
|
5834
6006
|
{
|
|
5835
6007
|
className: cn(navBaseClasses, "pointer-events-auto")
|
|
@@ -5874,7 +6046,7 @@ var NavigationRailComponent = React37.forwardRef(
|
|
|
5874
6046
|
}
|
|
5875
6047
|
);
|
|
5876
6048
|
NavigationRailComponent.displayName = "NavigationRail";
|
|
5877
|
-
var NavigationRail =
|
|
6049
|
+
var NavigationRail = React38.memo(NavigationRailComponent);
|
|
5878
6050
|
function useSearchKeyboard({
|
|
5879
6051
|
active,
|
|
5880
6052
|
onActiveChange,
|
|
@@ -5883,14 +6055,14 @@ function useSearchKeyboard({
|
|
|
5883
6055
|
itemCount,
|
|
5884
6056
|
onSelectSuggestion
|
|
5885
6057
|
}) {
|
|
5886
|
-
const [activeIndex, setActiveIndex] =
|
|
5887
|
-
const resetKeyRef =
|
|
6058
|
+
const [activeIndex, setActiveIndex] = React38.useState(-1);
|
|
6059
|
+
const resetKeyRef = React38.useRef(`${active}:${query}`);
|
|
5888
6060
|
const currentKey = `${active}:${query}`;
|
|
5889
6061
|
if (resetKeyRef.current !== currentKey) {
|
|
5890
6062
|
resetKeyRef.current = currentKey;
|
|
5891
6063
|
setActiveIndex(-1);
|
|
5892
6064
|
}
|
|
5893
|
-
const handleKeyDown =
|
|
6065
|
+
const handleKeyDown = React38.useCallback(
|
|
5894
6066
|
(e) => {
|
|
5895
6067
|
if (!active) return;
|
|
5896
6068
|
switch (e.key) {
|
|
@@ -5930,7 +6102,7 @@ function useSearchKeyboard({
|
|
|
5930
6102
|
query
|
|
5931
6103
|
]
|
|
5932
6104
|
);
|
|
5933
|
-
const resetActiveIndex =
|
|
6105
|
+
const resetActiveIndex = React38.useCallback(() => {
|
|
5934
6106
|
setActiveIndex(-1);
|
|
5935
6107
|
}, []);
|
|
5936
6108
|
return { activeIndex, handleKeyDown, resetActiveIndex };
|
|
@@ -5998,10 +6170,10 @@ function AnimatedPlaceholder({
|
|
|
5998
6170
|
className
|
|
5999
6171
|
}) {
|
|
6000
6172
|
const shouldReduceMotion = useReducedMotion();
|
|
6001
|
-
const containerRef =
|
|
6002
|
-
const spanRef =
|
|
6003
|
-
const [xOffset, setXOffset] =
|
|
6004
|
-
const recalculate =
|
|
6173
|
+
const containerRef = React38.useRef(null);
|
|
6174
|
+
const spanRef = React38.useRef(null);
|
|
6175
|
+
const [xOffset, setXOffset] = React38.useState(0);
|
|
6176
|
+
const recalculate = React38.useCallback(() => {
|
|
6005
6177
|
const container = containerRef.current;
|
|
6006
6178
|
const span = spanRef.current;
|
|
6007
6179
|
if (!container || !span || textAlign === "left") {
|
|
@@ -6016,10 +6188,10 @@ function AnimatedPlaceholder({
|
|
|
6016
6188
|
setXOffset(Math.max(0, containerWidth - textWidth));
|
|
6017
6189
|
}
|
|
6018
6190
|
}, [textAlign]);
|
|
6019
|
-
|
|
6191
|
+
React38.useLayoutEffect(() => {
|
|
6020
6192
|
recalculate();
|
|
6021
6193
|
}, [recalculate]);
|
|
6022
|
-
|
|
6194
|
+
React38.useEffect(() => {
|
|
6023
6195
|
const container = containerRef.current;
|
|
6024
6196
|
if (!container) return;
|
|
6025
6197
|
const observer = new ResizeObserver(recalculate);
|
|
@@ -6088,10 +6260,10 @@ function SearchBar({
|
|
|
6088
6260
|
activeIndex
|
|
6089
6261
|
}) {
|
|
6090
6262
|
const shouldReduceMotion = useReducedMotion();
|
|
6091
|
-
const inputRef =
|
|
6092
|
-
const prevActiveRef =
|
|
6093
|
-
const isRestoringFocusRef =
|
|
6094
|
-
|
|
6263
|
+
const inputRef = React38.useRef(null);
|
|
6264
|
+
const prevActiveRef = React38.useRef(active);
|
|
6265
|
+
const isRestoringFocusRef = React38.useRef(false);
|
|
6266
|
+
React38.useEffect(() => {
|
|
6095
6267
|
var _a;
|
|
6096
6268
|
let rafId;
|
|
6097
6269
|
if (prevActiveRef.current === true && active === false) {
|
|
@@ -6210,7 +6382,7 @@ function SearchBar({
|
|
|
6210
6382
|
) })
|
|
6211
6383
|
);
|
|
6212
6384
|
}
|
|
6213
|
-
var SearchContext =
|
|
6385
|
+
var SearchContext = React38.createContext(null);
|
|
6214
6386
|
function SearchProvider({
|
|
6215
6387
|
children,
|
|
6216
6388
|
value
|
|
@@ -6218,7 +6390,7 @@ function SearchProvider({
|
|
|
6218
6390
|
return /* @__PURE__ */ jsx(SearchContext.Provider, { value, children });
|
|
6219
6391
|
}
|
|
6220
6392
|
function useSearch() {
|
|
6221
|
-
const context =
|
|
6393
|
+
const context = React38.useContext(SearchContext);
|
|
6222
6394
|
if (!context) {
|
|
6223
6395
|
return { listboxId: "", activeIndex: -1 };
|
|
6224
6396
|
}
|
|
@@ -6245,7 +6417,7 @@ function useClickOutside(handler, enabled = true) {
|
|
|
6245
6417
|
return ref;
|
|
6246
6418
|
}
|
|
6247
6419
|
function useSearchViewFocus(inputRef, active) {
|
|
6248
|
-
|
|
6420
|
+
React38.useEffect(() => {
|
|
6249
6421
|
if (!active) return;
|
|
6250
6422
|
let raf2;
|
|
6251
6423
|
const raf1 = requestAnimationFrame(() => {
|
|
@@ -6305,11 +6477,11 @@ var ROTATE_KEY_SPLINES = [
|
|
|
6305
6477
|
var ROTATE_VALUES = "0 24 24; 154 24 24; 309 24 24; 463 24 24; 617 24 24; 771 24 24; 926 24 24; 1080 24 24";
|
|
6306
6478
|
var DETERMINATE_CIRCLE = "M24 7 C34.49 7 41 13.51 41 24 C41 34.49 34.49 41 24 41 C13.51 41 7 34.49 7 24 C7 13.51 13.51 7 24 7 Z";
|
|
6307
6479
|
var DETERMINATE_SOFT_BURST = "M20.9 10.4 21.4 9.5 21.9 8.7 22.5 7.8 23.2 7.2 24.2 7 25.1 7.4 25.7 8.1 26.2 9 26.8 9.8 27.3 10.6 28.1 11.2 29 11.3 30 11 30.9 10.6 31.8 10.3 32.8 9.9 33.7 10 34.5 10.6 34.9 11.5 34.8 12.5 34.8 13.5 34.7 14.5 34.7 15.5 35.2 16.3 36 16.8 37 17.1 37.9 17.3 38.9 17.5 39.8 17.9 40.4 18.7 40.5 19.7 40 20.5 39.4 21.3 38.7 22 38.1 22.8 37.6 23.7 37.7 24.6 38.3 25.5 38.9 26.2 39.6 27 40.2 27.7 40.5 28.7 40.3 29.6 39.5 30.3 38.6 30.6 37.6 30.8 36.7 31 35.7 31.3 35 31.9 34.6 32.8 34.7 33.8 34.8 34.8 34.9 35.8 34.8 36.8 34.3 37.6 33.4 38.1 32.4 38 31.5 37.6 30.6 37.2 29.7 36.9 28.7 36.6 27.8 36.9 27.1 37.6 26.6 38.5 26.1 39.3 25.5 40.2 24.8 40.8 23.8 41 22.9 40.6 22.3 39.9 21.8 39 21.2 38.2 20.7 37.4 19.9 36.8 19 36.7 18 37 17.1 37.4 16.2 37.7 15.2 38.1 14.3 38 13.5 37.4 13.1 36.5 13.2 35.5 13.2 34.5 13.3 33.5 13.3 32.5 12.8 31.7 12 31.2 11 31 10.1 30.7 9.1 30.5 8.2 30.1 7.6 29.3 7.5 28.3 8 27.5 8.7 26.7 9.3 26 9.9 25.2 10.4 24.3 10.3 23.4 9.7 22.5 9.1 21.8 8.4 21 7.8 20.3 7.5 19.3 7.7 18.4 8.5 17.7 9.4 17.4 10.4 17.2 11.3 17 12.3 16.7 13 16.1 13.4 15.2 13.3 14.2 13.2 13.2 13.1 12.2 13.2 11.2 13.7 10.4 14.6 9.9 15.6 10 16.5 10.4 17.4 10.8 18.3 11.1 19.3 11.4 20.2 11.1Z";
|
|
6308
|
-
var IndeterminateSvg =
|
|
6480
|
+
var IndeterminateSvg = React38.memo(function IndeterminateSvg2({
|
|
6309
6481
|
size
|
|
6310
6482
|
}) {
|
|
6311
|
-
const [ready, setReady] =
|
|
6312
|
-
|
|
6483
|
+
const [ready, setReady] = React38.useState(false);
|
|
6484
|
+
React38.useEffect(() => {
|
|
6313
6485
|
const raf = requestAnimationFrame(() => setReady(true));
|
|
6314
6486
|
return () => cancelAnimationFrame(raf);
|
|
6315
6487
|
}, []);
|
|
@@ -6354,7 +6526,7 @@ var IndeterminateSvg = React37.memo(function IndeterminateSvg2({
|
|
|
6354
6526
|
}
|
|
6355
6527
|
);
|
|
6356
6528
|
});
|
|
6357
|
-
var DeterminateSvg =
|
|
6529
|
+
var DeterminateSvg = React38.memo(function DeterminateSvg2({
|
|
6358
6530
|
size,
|
|
6359
6531
|
progress
|
|
6360
6532
|
}) {
|
|
@@ -6379,7 +6551,7 @@ var DeterminateSvg = React37.memo(function DeterminateSvg2({
|
|
|
6379
6551
|
}
|
|
6380
6552
|
);
|
|
6381
6553
|
});
|
|
6382
|
-
var LoadingIndicator =
|
|
6554
|
+
var LoadingIndicator = React38.forwardRef(
|
|
6383
6555
|
(_a, ref) => {
|
|
6384
6556
|
var _b = _a, {
|
|
6385
6557
|
variant = "uncontained",
|
|
@@ -6447,7 +6619,7 @@ LoadingIndicator.displayName = "LoadingIndicator";
|
|
|
6447
6619
|
function easeInOutCubic(x) {
|
|
6448
6620
|
return x < 0.5 ? 4 * x * x * x : 1 - (-2 * x + 2) ** 3 / 2;
|
|
6449
6621
|
}
|
|
6450
|
-
function generateWavyCircularPath(center, radius, amplitude, wavelength) {
|
|
6622
|
+
function generateWavyCircularPath(center, radius, amplitude, wavelength, phase = 0) {
|
|
6451
6623
|
const circumference = 2 * Math.PI * radius;
|
|
6452
6624
|
const numWaves = Math.max(
|
|
6453
6625
|
3,
|
|
@@ -6455,8 +6627,8 @@ function generateWavyCircularPath(center, radius, amplitude, wavelength) {
|
|
|
6455
6627
|
);
|
|
6456
6628
|
const steps = numWaves * 4;
|
|
6457
6629
|
const dt = 2 * Math.PI / steps;
|
|
6458
|
-
const rAt = (t) => radius + amplitude * Math.sin(numWaves * t);
|
|
6459
|
-
const drAt = (t) => amplitude * numWaves * Math.cos(numWaves * t);
|
|
6630
|
+
const rAt = (t) => radius + amplitude * Math.sin(numWaves * t + phase);
|
|
6631
|
+
const drAt = (t) => amplitude * numWaves * Math.cos(numWaves * t + phase);
|
|
6460
6632
|
const xAt = (t) => center + rAt(t) * Math.cos(t);
|
|
6461
6633
|
const yAt = (t) => center + rAt(t) * Math.sin(t);
|
|
6462
6634
|
const dxAt = (t) => drAt(t) * Math.cos(t) - rAt(t) * Math.sin(t);
|
|
@@ -6514,22 +6686,25 @@ var ADDITIONAL_ROTATION_EASE_DURATION = 500;
|
|
|
6514
6686
|
var DEFAULT_MIN_PROGRESS = 0.1;
|
|
6515
6687
|
var DEFAULT_MAX_PROGRESS = 0.8;
|
|
6516
6688
|
var PROGRESS_CYCLE_DURATION = 1500;
|
|
6517
|
-
var CircularProgress =
|
|
6689
|
+
var CircularProgress = React38.forwardRef(
|
|
6518
6690
|
(_a, ref) => {
|
|
6519
6691
|
var _b = _a, {
|
|
6520
6692
|
value,
|
|
6521
6693
|
size = 48,
|
|
6522
6694
|
trackHeight = 4,
|
|
6523
6695
|
shape = "flat",
|
|
6696
|
+
trackShape = "flat",
|
|
6524
6697
|
amplitude,
|
|
6525
6698
|
wavelength,
|
|
6526
6699
|
gapSize = 4,
|
|
6700
|
+
waveSpeed = 1,
|
|
6527
6701
|
crawlerSpeed = 1,
|
|
6528
6702
|
color,
|
|
6529
6703
|
trackColor,
|
|
6530
6704
|
showTrack = "auto",
|
|
6531
6705
|
minProgress = DEFAULT_MIN_PROGRESS,
|
|
6532
6706
|
maxProgress = DEFAULT_MAX_PROGRESS,
|
|
6707
|
+
determinateAnimation = "md3",
|
|
6533
6708
|
amplitudeRange,
|
|
6534
6709
|
className,
|
|
6535
6710
|
"aria-label": ariaLabel
|
|
@@ -6538,15 +6713,18 @@ var CircularProgress = React37.forwardRef(
|
|
|
6538
6713
|
"size",
|
|
6539
6714
|
"trackHeight",
|
|
6540
6715
|
"shape",
|
|
6716
|
+
"trackShape",
|
|
6541
6717
|
"amplitude",
|
|
6542
6718
|
"wavelength",
|
|
6543
6719
|
"gapSize",
|
|
6720
|
+
"waveSpeed",
|
|
6544
6721
|
"crawlerSpeed",
|
|
6545
6722
|
"color",
|
|
6546
6723
|
"trackColor",
|
|
6547
6724
|
"showTrack",
|
|
6548
6725
|
"minProgress",
|
|
6549
6726
|
"maxProgress",
|
|
6727
|
+
"determinateAnimation",
|
|
6550
6728
|
"amplitudeRange",
|
|
6551
6729
|
"className",
|
|
6552
6730
|
"aria-label"
|
|
@@ -6559,21 +6737,22 @@ var CircularProgress = React37.forwardRef(
|
|
|
6559
6737
|
const bgTrackColor = trackColor || "var(--md-sys-color-indicator-track)";
|
|
6560
6738
|
const isWavy = shape === "wavy";
|
|
6561
6739
|
const shouldShowIndeterminateTrack = showTrack === "auto" ? isWavy : showTrack;
|
|
6740
|
+
const shouldShowDeterminateTrack = showTrack === "auto" ? true : showTrack;
|
|
6562
6741
|
const BASELINE_SIZE = 48;
|
|
6563
6742
|
const scaleFactor = size / BASELINE_SIZE;
|
|
6564
|
-
const effectiveAmplitude =
|
|
6743
|
+
const effectiveAmplitude = React38.useMemo(
|
|
6565
6744
|
() => amplitude != null ? amplitude : 1.6 * scaleFactor,
|
|
6566
6745
|
[amplitude, scaleFactor]
|
|
6567
6746
|
);
|
|
6568
|
-
const effectiveWavelength =
|
|
6747
|
+
const effectiveWavelength = React38.useMemo(
|
|
6569
6748
|
() => wavelength != null ? wavelength : 15 * scaleFactor,
|
|
6570
6749
|
[wavelength, scaleFactor]
|
|
6571
6750
|
);
|
|
6572
|
-
const resolvedAmplitudeRange =
|
|
6751
|
+
const resolvedAmplitudeRange = React38.useMemo(
|
|
6573
6752
|
() => amplitudeRange != null ? amplitudeRange : [0, effectiveAmplitude],
|
|
6574
6753
|
[amplitudeRange, effectiveAmplitude]
|
|
6575
6754
|
);
|
|
6576
|
-
const wavyActivePath =
|
|
6755
|
+
const wavyActivePath = React38.useMemo(
|
|
6577
6756
|
() => isWavy ? generateWavyCircularPath(
|
|
6578
6757
|
center,
|
|
6579
6758
|
radius,
|
|
@@ -6582,8 +6761,8 @@ var CircularProgress = React37.forwardRef(
|
|
|
6582
6761
|
) : null,
|
|
6583
6762
|
[isWavy, center, radius, effectiveAmplitude, effectiveWavelength]
|
|
6584
6763
|
);
|
|
6585
|
-
const circumference =
|
|
6586
|
-
const gapForTrack =
|
|
6764
|
+
const circumference = React38.useMemo(() => 2 * Math.PI * radius, [radius]);
|
|
6765
|
+
const gapForTrack = React38.useMemo(
|
|
6587
6766
|
() => (gapSize + trackHeight) / circumference,
|
|
6588
6767
|
[gapSize, trackHeight, circumference]
|
|
6589
6768
|
);
|
|
@@ -6591,19 +6770,50 @@ var CircularProgress = React37.forwardRef(
|
|
|
6591
6770
|
const trackOffset = isDeterminate ? activeAngularFraction + gapForTrack : 0;
|
|
6592
6771
|
const trackLength = isDeterminate ? Math.max(1e-3, 1 - activeAngularFraction - 2 * gapForTrack) : 1;
|
|
6593
6772
|
const ActiveCircleElem = m.circle;
|
|
6594
|
-
const
|
|
6595
|
-
const
|
|
6596
|
-
const
|
|
6597
|
-
const
|
|
6598
|
-
const
|
|
6599
|
-
const
|
|
6600
|
-
const
|
|
6601
|
-
|
|
6773
|
+
const indeterminateSvgRef = React38.useRef(null);
|
|
6774
|
+
const indeterminateTrackRef = React38.useRef(null);
|
|
6775
|
+
const indeterminateActiveRef = React38.useRef(null);
|
|
6776
|
+
const indeterminateWavyTrackPathRef = React38.useRef(null);
|
|
6777
|
+
const indeterminateWavyActivePathRef = React38.useRef(null);
|
|
6778
|
+
const determinateWavyActivePathRef = React38.useRef(null);
|
|
6779
|
+
const determinateWavyTrackPathRef = React38.useRef(null);
|
|
6780
|
+
const cachedPathLengthRef = React38.useRef(0);
|
|
6781
|
+
const fractionMV = useMotionValue(isDeterminate ? clampedValue / 100 : 0);
|
|
6782
|
+
const amplitudeMV = useMotionValue(isWavy ? effectiveAmplitude : 0);
|
|
6783
|
+
React38.useEffect(() => {
|
|
6784
|
+
if (isDeterminate) {
|
|
6785
|
+
animate(fractionMV, clampedValue / 100, {
|
|
6786
|
+
duration: 0.4,
|
|
6787
|
+
ease: [0.2, 0, 0, 1]
|
|
6788
|
+
});
|
|
6789
|
+
}
|
|
6790
|
+
}, [clampedValue, isDeterminate, fractionMV]);
|
|
6791
|
+
React38.useEffect(() => {
|
|
6792
|
+
if (!isDeterminate || !isWavy) return;
|
|
6793
|
+
const fraction = clampedValue / 100;
|
|
6794
|
+
let targetAmp = effectiveAmplitude;
|
|
6795
|
+
if (determinateAnimation === "md3") {
|
|
6796
|
+
targetAmp = fraction <= 0.1 || fraction >= 0.95 ? 0 : effectiveAmplitude;
|
|
6797
|
+
}
|
|
6798
|
+
animate(amplitudeMV, targetAmp, {
|
|
6799
|
+
type: "spring",
|
|
6800
|
+
bounce: 0,
|
|
6801
|
+
duration: 0.5
|
|
6802
|
+
});
|
|
6803
|
+
}, [
|
|
6804
|
+
clampedValue,
|
|
6805
|
+
isDeterminate,
|
|
6806
|
+
isWavy,
|
|
6807
|
+
effectiveAmplitude,
|
|
6808
|
+
amplitudeMV,
|
|
6809
|
+
determinateAnimation
|
|
6810
|
+
]);
|
|
6811
|
+
React38.useLayoutEffect(() => {
|
|
6602
6812
|
if (!isWavy || !wavyActivePath) {
|
|
6603
6813
|
cachedPathLengthRef.current = circumference;
|
|
6604
6814
|
return;
|
|
6605
6815
|
}
|
|
6606
|
-
const el = indeterminateActiveRef.current;
|
|
6816
|
+
const el = indeterminateActiveRef.current || determinateWavyActivePathRef.current;
|
|
6607
6817
|
if (el && "getTotalLength" in el) {
|
|
6608
6818
|
try {
|
|
6609
6819
|
const len = el.getTotalLength();
|
|
@@ -6617,7 +6827,65 @@ var CircularProgress = React37.forwardRef(
|
|
|
6617
6827
|
cachedPathLengthRef.current = circumference;
|
|
6618
6828
|
}, [isWavy, circumference, wavyActivePath]);
|
|
6619
6829
|
useAnimationFrame((time) => {
|
|
6620
|
-
|
|
6830
|
+
const safeWaveSpeed = Math.max(0.1, waveSpeed);
|
|
6831
|
+
const wavePhase = time / 1e3 * safeWaveSpeed * 2 * Math.PI;
|
|
6832
|
+
if (isDeterminate) {
|
|
6833
|
+
if (isWavy) {
|
|
6834
|
+
const currentAmp = amplitudeMV.get();
|
|
6835
|
+
const dynamicPath = generateWavyCircularPath(
|
|
6836
|
+
center,
|
|
6837
|
+
radius,
|
|
6838
|
+
currentAmp,
|
|
6839
|
+
effectiveWavelength,
|
|
6840
|
+
wavePhase
|
|
6841
|
+
);
|
|
6842
|
+
if (determinateWavyActivePathRef.current) {
|
|
6843
|
+
determinateWavyActivePathRef.current.setAttribute("d", dynamicPath);
|
|
6844
|
+
}
|
|
6845
|
+
if (trackShape === "wavy" && determinateWavyTrackPathRef.current) {
|
|
6846
|
+
determinateWavyTrackPathRef.current.setAttribute("d", dynamicPath);
|
|
6847
|
+
}
|
|
6848
|
+
const pathEl = determinateWavyActivePathRef.current;
|
|
6849
|
+
let totalLen = cachedPathLengthRef.current || circumference;
|
|
6850
|
+
if (pathEl) {
|
|
6851
|
+
try {
|
|
6852
|
+
const len = pathEl.getTotalLength();
|
|
6853
|
+
if (len > 0) totalLen = len;
|
|
6854
|
+
} catch (e) {
|
|
6855
|
+
}
|
|
6856
|
+
}
|
|
6857
|
+
const activeFrac = Math.max(0, Math.min(1, fractionMV.get()));
|
|
6858
|
+
const activeLen = totalLen * activeFrac;
|
|
6859
|
+
if (determinateWavyActivePathRef.current) {
|
|
6860
|
+
determinateWavyActivePathRef.current.setAttribute(
|
|
6861
|
+
"stroke-dasharray",
|
|
6862
|
+
`${activeLen} ${totalLen}`
|
|
6863
|
+
);
|
|
6864
|
+
determinateWavyActivePathRef.current.setAttribute(
|
|
6865
|
+
"stroke-dashoffset",
|
|
6866
|
+
"0"
|
|
6867
|
+
);
|
|
6868
|
+
}
|
|
6869
|
+
if (shouldShowDeterminateTrack && trackShape === "wavy" && determinateWavyTrackPathRef.current) {
|
|
6870
|
+
const gapFrac = (gapSize + trackHeight) / totalLen;
|
|
6871
|
+
const trackStartFrac = activeFrac + gapFrac;
|
|
6872
|
+
const trackLen = Math.max(
|
|
6873
|
+
1e-3,
|
|
6874
|
+
totalLen * (1 - activeFrac - 2 * gapFrac)
|
|
6875
|
+
);
|
|
6876
|
+
const trackOff = -totalLen * trackStartFrac;
|
|
6877
|
+
determinateWavyTrackPathRef.current.setAttribute(
|
|
6878
|
+
"stroke-dasharray",
|
|
6879
|
+
`${trackLen} ${totalLen}`
|
|
6880
|
+
);
|
|
6881
|
+
determinateWavyTrackPathRef.current.setAttribute(
|
|
6882
|
+
"stroke-dashoffset",
|
|
6883
|
+
`${trackOff}`
|
|
6884
|
+
);
|
|
6885
|
+
}
|
|
6886
|
+
}
|
|
6887
|
+
return;
|
|
6888
|
+
}
|
|
6621
6889
|
const safeCrawlerSpeed = Math.max(0.1, crawlerSpeed);
|
|
6622
6890
|
const scaledTime = time * safeCrawlerSpeed;
|
|
6623
6891
|
const globalCycle = scaledTime % GLOBAL_ROTATION_DURATION;
|
|
@@ -6652,7 +6920,8 @@ var CircularProgress = React37.forwardRef(
|
|
|
6652
6920
|
center,
|
|
6653
6921
|
radius,
|
|
6654
6922
|
currentAmplitude,
|
|
6655
|
-
effectiveWavelength
|
|
6923
|
+
effectiveWavelength,
|
|
6924
|
+
wavePhase
|
|
6656
6925
|
);
|
|
6657
6926
|
if (indeterminateWavyActivePathRef.current) {
|
|
6658
6927
|
indeterminateWavyActivePathRef.current.setAttribute("d", dynamicPath);
|
|
@@ -6747,7 +7016,7 @@ var CircularProgress = React37.forwardRef(
|
|
|
6747
7016
|
style: { width: size, height: size }
|
|
6748
7017
|
}, restProps), {
|
|
6749
7018
|
children: /* @__PURE__ */ jsxs(LazyMotion, { features: domMax, strict: true, children: [
|
|
6750
|
-
/* @__PURE__ */
|
|
7019
|
+
/* @__PURE__ */ jsx(
|
|
6751
7020
|
"svg",
|
|
6752
7021
|
{
|
|
6753
7022
|
width: size,
|
|
@@ -6755,8 +7024,18 @@ var CircularProgress = React37.forwardRef(
|
|
|
6755
7024
|
viewBox: `0 0 ${size} ${size}`,
|
|
6756
7025
|
"aria-hidden": "true",
|
|
6757
7026
|
style: { transform: "rotate(-90deg)", overflow: "visible" },
|
|
6758
|
-
children: [
|
|
6759
|
-
|
|
7027
|
+
children: isDeterminate ? isWavy ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7028
|
+
shouldShowDeterminateTrack && (trackShape === "wavy" ? /* @__PURE__ */ jsx(
|
|
7029
|
+
"path",
|
|
7030
|
+
{
|
|
7031
|
+
ref: determinateWavyTrackPathRef,
|
|
7032
|
+
d: wavyActivePath != null ? wavyActivePath : "",
|
|
7033
|
+
fill: "none",
|
|
7034
|
+
stroke: bgTrackColor,
|
|
7035
|
+
strokeWidth: trackHeight,
|
|
7036
|
+
strokeLinecap: "round"
|
|
7037
|
+
}
|
|
7038
|
+
) : /* @__PURE__ */ jsx(
|
|
6760
7039
|
m.circle,
|
|
6761
7040
|
{
|
|
6762
7041
|
cx: center,
|
|
@@ -6765,28 +7044,52 @@ var CircularProgress = React37.forwardRef(
|
|
|
6765
7044
|
fill: "none",
|
|
6766
7045
|
stroke: bgTrackColor,
|
|
6767
7046
|
strokeWidth: trackHeight,
|
|
6768
|
-
initial: {
|
|
6769
|
-
|
|
7047
|
+
initial: {
|
|
7048
|
+
pathLength: trackLength,
|
|
7049
|
+
pathOffset: trackOffset
|
|
7050
|
+
},
|
|
7051
|
+
animate: {
|
|
7052
|
+
pathLength: trackLength,
|
|
7053
|
+
pathOffset: trackOffset
|
|
7054
|
+
},
|
|
6770
7055
|
transition: { duration: 0.4, ease: [0.2, 0, 0, 1] },
|
|
6771
7056
|
strokeLinecap: "round"
|
|
6772
7057
|
}
|
|
6773
|
-
)
|
|
6774
|
-
|
|
6775
|
-
|
|
7058
|
+
)),
|
|
7059
|
+
/* @__PURE__ */ jsx(
|
|
7060
|
+
"path",
|
|
6776
7061
|
{
|
|
7062
|
+
ref: determinateWavyActivePathRef,
|
|
6777
7063
|
d: wavyActivePath != null ? wavyActivePath : "",
|
|
6778
7064
|
fill: "none",
|
|
6779
7065
|
stroke: activeColor,
|
|
6780
7066
|
strokeWidth: trackHeight,
|
|
6781
|
-
strokeLinecap: "round"
|
|
6782
|
-
initial: { pathLength: 0 },
|
|
6783
|
-
animate: { pathLength: clampedValue / 100 },
|
|
6784
|
-
transition: {
|
|
6785
|
-
duration: 0.4,
|
|
6786
|
-
ease: [0.2, 0, 0, 1]
|
|
6787
|
-
}
|
|
7067
|
+
strokeLinecap: "round"
|
|
6788
7068
|
}
|
|
6789
|
-
)
|
|
7069
|
+
)
|
|
7070
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7071
|
+
/* @__PURE__ */ jsx(
|
|
7072
|
+
m.circle,
|
|
7073
|
+
{
|
|
7074
|
+
cx: center,
|
|
7075
|
+
cy: center,
|
|
7076
|
+
r: radius,
|
|
7077
|
+
fill: "none",
|
|
7078
|
+
stroke: bgTrackColor,
|
|
7079
|
+
strokeWidth: trackHeight,
|
|
7080
|
+
initial: {
|
|
7081
|
+
pathLength: trackLength,
|
|
7082
|
+
pathOffset: trackOffset
|
|
7083
|
+
},
|
|
7084
|
+
animate: {
|
|
7085
|
+
pathLength: trackLength,
|
|
7086
|
+
pathOffset: trackOffset
|
|
7087
|
+
},
|
|
7088
|
+
transition: { duration: 0.4, ease: [0.2, 0, 0, 1] },
|
|
7089
|
+
strokeLinecap: "round"
|
|
7090
|
+
}
|
|
7091
|
+
),
|
|
7092
|
+
/* @__PURE__ */ jsx(
|
|
6790
7093
|
ActiveCircleElem,
|
|
6791
7094
|
{
|
|
6792
7095
|
cx: center,
|
|
@@ -6803,8 +7106,8 @@ var CircularProgress = React37.forwardRef(
|
|
|
6803
7106
|
ease: [0.2, 0, 0, 1]
|
|
6804
7107
|
}
|
|
6805
7108
|
}
|
|
6806
|
-
)
|
|
6807
|
-
]
|
|
7109
|
+
)
|
|
7110
|
+
] }) : null
|
|
6808
7111
|
}
|
|
6809
7112
|
),
|
|
6810
7113
|
!isDeterminate && /* @__PURE__ */ jsx(
|
|
@@ -6882,9 +7185,9 @@ var CircularProgress = React37.forwardRef(
|
|
|
6882
7185
|
);
|
|
6883
7186
|
CircularProgress.displayName = "CircularProgress";
|
|
6884
7187
|
function useContainerWidth() {
|
|
6885
|
-
const [width, setWidth] =
|
|
6886
|
-
const observerRef =
|
|
6887
|
-
const ref =
|
|
7188
|
+
const [width, setWidth] = React38.useState(0);
|
|
7189
|
+
const observerRef = React38.useRef(null);
|
|
7190
|
+
const ref = React38.useCallback((node) => {
|
|
6888
7191
|
if (observerRef.current) {
|
|
6889
7192
|
observerRef.current.disconnect();
|
|
6890
7193
|
observerRef.current = null;
|
|
@@ -6898,7 +7201,7 @@ function useContainerWidth() {
|
|
|
6898
7201
|
observerRef.current = obs;
|
|
6899
7202
|
}
|
|
6900
7203
|
}, []);
|
|
6901
|
-
|
|
7204
|
+
React38.useEffect(() => {
|
|
6902
7205
|
return () => {
|
|
6903
7206
|
if (observerRef.current) {
|
|
6904
7207
|
observerRef.current.disconnect();
|
|
@@ -6908,7 +7211,7 @@ function useContainerWidth() {
|
|
|
6908
7211
|
return [ref, width];
|
|
6909
7212
|
}
|
|
6910
7213
|
function useMergedRef(...refs) {
|
|
6911
|
-
return
|
|
7214
|
+
return React38.useCallback(
|
|
6912
7215
|
(node) => {
|
|
6913
7216
|
for (const ref of refs) {
|
|
6914
7217
|
if (typeof ref === "function") {
|
|
@@ -6922,7 +7225,7 @@ function useMergedRef(...refs) {
|
|
|
6922
7225
|
[refs]
|
|
6923
7226
|
);
|
|
6924
7227
|
}
|
|
6925
|
-
var FlatLinearTrack =
|
|
7228
|
+
var FlatLinearTrack = React38.memo(function FlatLinearTrack2({
|
|
6926
7229
|
trackHeight,
|
|
6927
7230
|
activeColor,
|
|
6928
7231
|
trackColor,
|
|
@@ -6998,7 +7301,7 @@ var FlatLinearTrack = React37.memo(function FlatLinearTrack2({
|
|
|
6998
7301
|
}
|
|
6999
7302
|
);
|
|
7000
7303
|
});
|
|
7001
|
-
var WavyLinearTrack =
|
|
7304
|
+
var WavyLinearTrack = React38.memo(function WavyLinearTrack2({
|
|
7002
7305
|
trackHeight,
|
|
7003
7306
|
svgHeight,
|
|
7004
7307
|
amplitude,
|
|
@@ -7017,13 +7320,13 @@ var WavyLinearTrack = React37.memo(function WavyLinearTrack2({
|
|
|
7017
7320
|
}) {
|
|
7018
7321
|
const isDeterminate = typeof value === "number";
|
|
7019
7322
|
const clampedValue = isDeterminate ? Math.max(0, Math.min(100, value)) : 100;
|
|
7020
|
-
const titleId =
|
|
7323
|
+
const titleId = React38.useId();
|
|
7021
7324
|
const [containerRef, width] = useContainerWidth();
|
|
7022
|
-
const activePathRef =
|
|
7023
|
-
const trackPathRef =
|
|
7325
|
+
const activePathRef = React38.useRef(null);
|
|
7326
|
+
const trackPathRef = React38.useRef(null);
|
|
7024
7327
|
const amplitudeMV = useMotionValue(amplitude);
|
|
7025
7328
|
const fractionMV = useMotionValue(isDeterminate ? clampedValue / 100 : 1);
|
|
7026
|
-
|
|
7329
|
+
React38.useEffect(() => {
|
|
7027
7330
|
if (isDeterminate) {
|
|
7028
7331
|
const fraction = clampedValue / 100;
|
|
7029
7332
|
let targetAmp = amplitude;
|
|
@@ -7211,7 +7514,7 @@ var WavyLinearTrack = React37.memo(function WavyLinearTrack2({
|
|
|
7211
7514
|
}
|
|
7212
7515
|
);
|
|
7213
7516
|
});
|
|
7214
|
-
var LinearProgress =
|
|
7517
|
+
var LinearProgress = React38.forwardRef(
|
|
7215
7518
|
(_a, ref) => {
|
|
7216
7519
|
var _b = _a, {
|
|
7217
7520
|
value,
|
|
@@ -7252,10 +7555,10 @@ var LinearProgress = React37.forwardRef(
|
|
|
7252
7555
|
]);
|
|
7253
7556
|
const isDeterminate = value !== void 0;
|
|
7254
7557
|
const clampedValue = isDeterminate ? Math.min(100, Math.max(0, value)) : 0;
|
|
7255
|
-
const containerRef =
|
|
7558
|
+
const containerRef = React38.useRef(null);
|
|
7256
7559
|
const mergedRef = useMergedRef(ref, containerRef);
|
|
7257
|
-
const [isRtl, setIsRtl] =
|
|
7258
|
-
|
|
7560
|
+
const [isRtl, setIsRtl] = React38.useState(false);
|
|
7561
|
+
React38.useEffect(() => {
|
|
7259
7562
|
if (containerRef.current) {
|
|
7260
7563
|
const dir = getComputedStyle(containerRef.current).direction;
|
|
7261
7564
|
setIsRtl(dir === "rtl");
|
|
@@ -7263,16 +7566,16 @@ var LinearProgress = React37.forwardRef(
|
|
|
7263
7566
|
}, []);
|
|
7264
7567
|
const resolvedTrackShape = trackShape != null ? trackShape : shape;
|
|
7265
7568
|
const isWavy = shape === "wavy" || resolvedTrackShape === "wavy";
|
|
7266
|
-
const effectiveAmplitude =
|
|
7267
|
-
const svgHeight =
|
|
7569
|
+
const effectiveAmplitude = React38.useMemo(() => amplitude != null ? amplitude : 3, [amplitude]);
|
|
7570
|
+
const svgHeight = React38.useMemo(
|
|
7268
7571
|
() => isWavy ? trackHeight + effectiveAmplitude * 2 : trackHeight,
|
|
7269
7572
|
[isWavy, trackHeight, effectiveAmplitude]
|
|
7270
7573
|
);
|
|
7271
|
-
const shouldShowStop =
|
|
7574
|
+
const shouldShowStop = React38.useMemo(
|
|
7272
7575
|
() => isDeterminate && resolvedTrackShape === "flat" && showStopIndicator !== false,
|
|
7273
7576
|
[isDeterminate, resolvedTrackShape, showStopIndicator]
|
|
7274
7577
|
);
|
|
7275
|
-
const stopSize =
|
|
7578
|
+
const stopSize = React38.useMemo(
|
|
7276
7579
|
() => Math.max(2, trackHeight > 4 ? 4 : trackHeight / 2),
|
|
7277
7580
|
[trackHeight]
|
|
7278
7581
|
);
|
|
@@ -7347,7 +7650,7 @@ var LinearProgress = React37.forwardRef(
|
|
|
7347
7650
|
}
|
|
7348
7651
|
);
|
|
7349
7652
|
LinearProgress.displayName = "LinearProgress";
|
|
7350
|
-
var ProgressIndicator =
|
|
7653
|
+
var ProgressIndicator = React38.forwardRef((props, ref) => {
|
|
7351
7654
|
if (props.variant === "circular") {
|
|
7352
7655
|
return /* @__PURE__ */ jsx(CircularProgress, __spreadValues({ ref }, props));
|
|
7353
7656
|
}
|
|
@@ -7479,7 +7782,7 @@ function resolveDisabledBgClass(colorStyle) {
|
|
|
7479
7782
|
}
|
|
7480
7783
|
return "disabled:text-m3-on-surface/[0.38]";
|
|
7481
7784
|
}
|
|
7482
|
-
var IconButtonComponent =
|
|
7785
|
+
var IconButtonComponent = React38.forwardRef(
|
|
7483
7786
|
(_a, ref) => {
|
|
7484
7787
|
var _b = _a, {
|
|
7485
7788
|
className,
|
|
@@ -7521,18 +7824,18 @@ var IconButtonComponent = React37.forwardRef(
|
|
|
7521
7824
|
var _a2, _b2, _c, _d, _e;
|
|
7522
7825
|
const isToggle = variant === "toggle";
|
|
7523
7826
|
const isSelected = isToggle && !!selected;
|
|
7524
|
-
const resolvedColorClass =
|
|
7827
|
+
const resolvedColorClass = React38.useMemo(
|
|
7525
7828
|
() => isSelected ? colorStyles[colorStyle].selected : colorStyles[colorStyle].default,
|
|
7526
7829
|
[isSelected, colorStyle]
|
|
7527
7830
|
);
|
|
7528
|
-
const outlineWidthClass =
|
|
7831
|
+
const outlineWidthClass = React38.useMemo(
|
|
7529
7832
|
() => {
|
|
7530
7833
|
var _a3;
|
|
7531
7834
|
return colorStyle === "outlined" && !isSelected ? (_a3 = SIZE_OUTLINE_WIDTH[size]) != null ? _a3 : "border" : "";
|
|
7532
7835
|
},
|
|
7533
7836
|
[colorStyle, isSelected, size]
|
|
7534
7837
|
);
|
|
7535
|
-
const disabledBgClass =
|
|
7838
|
+
const disabledBgClass = React38.useMemo(
|
|
7536
7839
|
() => resolveDisabledBgClass(colorStyle),
|
|
7537
7840
|
[colorStyle]
|
|
7538
7841
|
);
|
|
@@ -7555,7 +7858,7 @@ var IconButtonComponent = React37.forwardRef(
|
|
|
7555
7858
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
7556
7859
|
disabled: loading
|
|
7557
7860
|
});
|
|
7558
|
-
const handleClick =
|
|
7861
|
+
const handleClick = React38.useCallback(
|
|
7559
7862
|
(e) => {
|
|
7560
7863
|
if (loading) {
|
|
7561
7864
|
e.preventDefault();
|
|
@@ -7565,7 +7868,7 @@ var IconButtonComponent = React37.forwardRef(
|
|
|
7565
7868
|
},
|
|
7566
7869
|
[loading, onClick]
|
|
7567
7870
|
);
|
|
7568
|
-
const handleKeyDown =
|
|
7871
|
+
const handleKeyDown = React38.useCallback(
|
|
7569
7872
|
(e) => {
|
|
7570
7873
|
if (loading) return;
|
|
7571
7874
|
if ((e.key === "Enter" || e.key === " ") && onClick) {
|
|
@@ -7621,7 +7924,7 @@ var IconButtonComponent = React37.forwardRef(
|
|
|
7621
7924
|
width: isCustomSize ? `${iconSize}px` : void 0,
|
|
7622
7925
|
height: isCustomSize ? `${iconSize}px` : void 0
|
|
7623
7926
|
},
|
|
7624
|
-
children: isSelected && selectedIcon ? selectedIcon : asChild ?
|
|
7927
|
+
children: isSelected && selectedIcon ? selectedIcon : asChild ? React38.Children.only(children).props.children : children
|
|
7625
7928
|
}),
|
|
7626
7929
|
isSelected && selectedIcon ? "selected-content" : "content"
|
|
7627
7930
|
) })
|
|
@@ -7638,7 +7941,7 @@ var IconButtonComponent = React37.forwardRef(
|
|
|
7638
7941
|
className
|
|
7639
7942
|
);
|
|
7640
7943
|
if (asChild) {
|
|
7641
|
-
const child =
|
|
7944
|
+
const child = React38.Children.only(children);
|
|
7642
7945
|
return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: /* @__PURE__ */ jsx(
|
|
7643
7946
|
Slot,
|
|
7644
7947
|
__spreadProps(__spreadValues({
|
|
@@ -7655,7 +7958,7 @@ var IconButtonComponent = React37.forwardRef(
|
|
|
7655
7958
|
}),
|
|
7656
7959
|
className: containerClassName
|
|
7657
7960
|
}, restProps), {
|
|
7658
|
-
children:
|
|
7961
|
+
children: React38.cloneElement(child, { children: innerContent })
|
|
7659
7962
|
})
|
|
7660
7963
|
) });
|
|
7661
7964
|
}
|
|
@@ -7683,7 +7986,7 @@ var IconButtonComponent = React37.forwardRef(
|
|
|
7683
7986
|
}
|
|
7684
7987
|
);
|
|
7685
7988
|
IconButtonComponent.displayName = "IconButton";
|
|
7686
|
-
var IconButton =
|
|
7989
|
+
var IconButton = React38.memo(IconButtonComponent);
|
|
7687
7990
|
function TrailingAction({
|
|
7688
7991
|
query,
|
|
7689
7992
|
trailingIcon,
|
|
@@ -7743,7 +8046,7 @@ function SearchViewDocked({
|
|
|
7743
8046
|
activeIndex
|
|
7744
8047
|
}) {
|
|
7745
8048
|
const shouldReduceMotion = useReducedMotion();
|
|
7746
|
-
const inputRef =
|
|
8049
|
+
const inputRef = React38.useRef(null);
|
|
7747
8050
|
useSearchViewFocus(inputRef, active);
|
|
7748
8051
|
const dropdownRef = useClickOutside(() => {
|
|
7749
8052
|
onActiveChange(false);
|
|
@@ -7889,10 +8192,10 @@ function SearchViewFullScreen({
|
|
|
7889
8192
|
activeIndex
|
|
7890
8193
|
}) {
|
|
7891
8194
|
const shouldReduceMotion = useReducedMotion();
|
|
7892
|
-
const inputRef =
|
|
8195
|
+
const inputRef = React38.useRef(null);
|
|
7893
8196
|
useSearchViewFocus(inputRef, active);
|
|
7894
|
-
const [mounted, setMounted] =
|
|
7895
|
-
|
|
8197
|
+
const [mounted, setMounted] = React38.useState(false);
|
|
8198
|
+
React38.useEffect(() => {
|
|
7896
8199
|
setMounted(true);
|
|
7897
8200
|
}, []);
|
|
7898
8201
|
const handleFormSubmit = (e) => {
|
|
@@ -8050,10 +8353,10 @@ function SearchComponent({
|
|
|
8050
8353
|
className,
|
|
8051
8354
|
viewClassName
|
|
8052
8355
|
}) {
|
|
8053
|
-
const generatedId =
|
|
8356
|
+
const generatedId = React38.useId();
|
|
8054
8357
|
const searchId = id != null ? id : generatedId;
|
|
8055
8358
|
const listboxId = `${searchId}-listbox`;
|
|
8056
|
-
const itemCount =
|
|
8359
|
+
const itemCount = React38.Children.count(children);
|
|
8057
8360
|
const { activeIndex, handleKeyDown } = useSearchKeyboard({
|
|
8058
8361
|
active,
|
|
8059
8362
|
onActiveChange,
|
|
@@ -8112,9 +8415,9 @@ function formatBadgeLabel(children, max) {
|
|
|
8112
8415
|
return "";
|
|
8113
8416
|
}
|
|
8114
8417
|
function detectBadgeHasContent(badge) {
|
|
8115
|
-
return
|
|
8418
|
+
return React38.isValidElement(badge) && badge.props.children != null;
|
|
8116
8419
|
}
|
|
8117
|
-
var BadgeImpl =
|
|
8420
|
+
var BadgeImpl = React38.forwardRef(
|
|
8118
8421
|
(_a, ref) => {
|
|
8119
8422
|
var _b = _a, {
|
|
8120
8423
|
children,
|
|
@@ -8151,7 +8454,7 @@ var BadgeImpl = React37.forwardRef(
|
|
|
8151
8454
|
exit: { scale: 0, opacity: 0 },
|
|
8152
8455
|
transition: springTransition,
|
|
8153
8456
|
className: cn(
|
|
8154
|
-
"rounded-full ring-[1.5px] ring-m3-surface",
|
|
8457
|
+
"rounded-full ring-[1.5px] ring-m3-surface shrink-0",
|
|
8155
8458
|
!containerColor && "bg-m3-error",
|
|
8156
8459
|
hasContent ? cn(
|
|
8157
8460
|
"inline-flex items-center justify-center",
|
|
@@ -8168,7 +8471,7 @@ var BadgeImpl = React37.forwardRef(
|
|
|
8168
8471
|
}
|
|
8169
8472
|
);
|
|
8170
8473
|
BadgeImpl.displayName = "Badge";
|
|
8171
|
-
|
|
8474
|
+
React38.memo(BadgeImpl);
|
|
8172
8475
|
function BadgedBox({
|
|
8173
8476
|
badge,
|
|
8174
8477
|
children,
|
|
@@ -8189,9 +8492,9 @@ function BadgedBox({
|
|
|
8189
8492
|
)
|
|
8190
8493
|
] });
|
|
8191
8494
|
}
|
|
8192
|
-
var TabsContext =
|
|
8495
|
+
var TabsContext = React38.createContext(null);
|
|
8193
8496
|
function useTabsContext() {
|
|
8194
|
-
const ctx =
|
|
8497
|
+
const ctx = React38.useContext(TabsContext);
|
|
8195
8498
|
if (!ctx) {
|
|
8196
8499
|
throw new Error(
|
|
8197
8500
|
"[MD3 Tabs] Component must be used within a <Tabs> root. Ensure <TabsList>, <Tab>, and <TabsContent> are descendants of <Tabs>."
|
|
@@ -8199,7 +8502,7 @@ function useTabsContext() {
|
|
|
8199
8502
|
}
|
|
8200
8503
|
return ctx;
|
|
8201
8504
|
}
|
|
8202
|
-
var TabsComponent =
|
|
8505
|
+
var TabsComponent = React38.forwardRef(
|
|
8203
8506
|
({
|
|
8204
8507
|
value: controlledValue,
|
|
8205
8508
|
defaultValue = "",
|
|
@@ -8208,35 +8511,35 @@ var TabsComponent = React37.forwardRef(
|
|
|
8208
8511
|
children,
|
|
8209
8512
|
className
|
|
8210
8513
|
}, ref) => {
|
|
8211
|
-
const [internalValue, setInternalValue] =
|
|
8514
|
+
const [internalValue, setInternalValue] = React38.useState(defaultValue);
|
|
8212
8515
|
const isControlled = controlledValue !== void 0;
|
|
8213
8516
|
const value = isControlled ? controlledValue : internalValue;
|
|
8214
|
-
const handleValueChange =
|
|
8517
|
+
const handleValueChange = React38.useCallback(
|
|
8215
8518
|
(newValue) => {
|
|
8216
8519
|
if (!isControlled) setInternalValue(newValue);
|
|
8217
8520
|
onValueChange == null ? void 0 : onValueChange(newValue);
|
|
8218
8521
|
},
|
|
8219
8522
|
[isControlled, onValueChange]
|
|
8220
8523
|
);
|
|
8221
|
-
const [focusedValue, setFocusedValue] =
|
|
8222
|
-
|
|
8524
|
+
const [focusedValue, setFocusedValue] = React38.useState(value);
|
|
8525
|
+
React38.useEffect(() => {
|
|
8223
8526
|
setFocusedValue(value);
|
|
8224
8527
|
}, [value]);
|
|
8225
|
-
const [tabValues, setTabValues] =
|
|
8226
|
-
const registerTab =
|
|
8528
|
+
const [tabValues, setTabValues] = React38.useState([]);
|
|
8529
|
+
const registerTab = React38.useCallback((tabValue) => {
|
|
8227
8530
|
setTabValues((prev) => {
|
|
8228
8531
|
if (prev.includes(tabValue)) return prev;
|
|
8229
8532
|
return [...prev, tabValue];
|
|
8230
8533
|
});
|
|
8231
8534
|
}, []);
|
|
8232
|
-
const unregisterTab =
|
|
8535
|
+
const unregisterTab = React38.useCallback((tabValue) => {
|
|
8233
8536
|
setTabValues((prev) => prev.filter((v) => v !== tabValue));
|
|
8234
8537
|
}, []);
|
|
8235
|
-
const hasAutoSelected =
|
|
8236
|
-
const [disabledValues, setDisabledValues] =
|
|
8538
|
+
const hasAutoSelected = React38.useRef(false);
|
|
8539
|
+
const [disabledValues, setDisabledValues] = React38.useState(
|
|
8237
8540
|
/* @__PURE__ */ new Set()
|
|
8238
8541
|
);
|
|
8239
|
-
const markTabDisabled =
|
|
8542
|
+
const markTabDisabled = React38.useCallback(
|
|
8240
8543
|
(tabValue, disabled) => {
|
|
8241
8544
|
setDisabledValues((prev) => {
|
|
8242
8545
|
const next = new Set(prev);
|
|
@@ -8250,7 +8553,7 @@ var TabsComponent = React37.forwardRef(
|
|
|
8250
8553
|
},
|
|
8251
8554
|
[]
|
|
8252
8555
|
);
|
|
8253
|
-
|
|
8556
|
+
React38.useEffect(() => {
|
|
8254
8557
|
if (isControlled || hasAutoSelected.current || tabValues.length === 0) {
|
|
8255
8558
|
return;
|
|
8256
8559
|
}
|
|
@@ -8265,9 +8568,9 @@ var TabsComponent = React37.forwardRef(
|
|
|
8265
8568
|
setFocusedValue(firstEnabled);
|
|
8266
8569
|
}
|
|
8267
8570
|
}, [tabValues, disabledValues, isControlled, value]);
|
|
8268
|
-
const id =
|
|
8571
|
+
const id = React38.useId();
|
|
8269
8572
|
const layoutGroupId = `tabs-${id}`;
|
|
8270
|
-
const contextValue =
|
|
8573
|
+
const contextValue = React38.useMemo(
|
|
8271
8574
|
() => ({
|
|
8272
8575
|
value,
|
|
8273
8576
|
onValueChange: handleValueChange,
|
|
@@ -8298,12 +8601,12 @@ var TabsComponent = React37.forwardRef(
|
|
|
8298
8601
|
}
|
|
8299
8602
|
);
|
|
8300
8603
|
TabsComponent.displayName = "Tabs";
|
|
8301
|
-
var Tabs =
|
|
8302
|
-
var TabsListContext =
|
|
8604
|
+
var Tabs = React38.memo(TabsComponent);
|
|
8605
|
+
var TabsListContext = React38.createContext(
|
|
8303
8606
|
null
|
|
8304
8607
|
);
|
|
8305
8608
|
function useTabsListContext() {
|
|
8306
|
-
const ctx =
|
|
8609
|
+
const ctx = React38.useContext(TabsListContext);
|
|
8307
8610
|
return ctx != null ? ctx : { variant: "primary", scrollable: false };
|
|
8308
8611
|
}
|
|
8309
8612
|
|
|
@@ -8387,7 +8690,7 @@ var TABS_CONTENT_TRANSITION = {
|
|
|
8387
8690
|
ease: "easeInOut"
|
|
8388
8691
|
};
|
|
8389
8692
|
var INDICATOR_MIN_WIDTH = 24;
|
|
8390
|
-
var TabComponent =
|
|
8693
|
+
var TabComponent = React38.forwardRef(
|
|
8391
8694
|
({
|
|
8392
8695
|
value,
|
|
8393
8696
|
icon,
|
|
@@ -8417,9 +8720,9 @@ var TabComponent = React37.forwardRef(
|
|
|
8417
8720
|
const isFocused = focusedValue === value;
|
|
8418
8721
|
const hasIcon = icon != null;
|
|
8419
8722
|
const isStackedIcon = hasIcon && !inlineIcon;
|
|
8420
|
-
const buttonRef =
|
|
8421
|
-
const isFirstMount =
|
|
8422
|
-
const mergedRef =
|
|
8723
|
+
const buttonRef = React38.useRef(null);
|
|
8724
|
+
const isFirstMount = React38.useRef(true);
|
|
8725
|
+
const mergedRef = React38.useCallback(
|
|
8423
8726
|
(node) => {
|
|
8424
8727
|
buttonRef.current = node;
|
|
8425
8728
|
if (typeof ref === "function") ref(node);
|
|
@@ -8427,15 +8730,15 @@ var TabComponent = React37.forwardRef(
|
|
|
8427
8730
|
},
|
|
8428
8731
|
[ref]
|
|
8429
8732
|
);
|
|
8430
|
-
|
|
8733
|
+
React38.useEffect(() => {
|
|
8431
8734
|
registerTab(value);
|
|
8432
8735
|
return () => unregisterTab(value);
|
|
8433
8736
|
}, [value, registerTab, unregisterTab]);
|
|
8434
|
-
|
|
8737
|
+
React38.useEffect(() => {
|
|
8435
8738
|
markTabDisabled(value, disabled);
|
|
8436
8739
|
return () => markTabDisabled(value, false);
|
|
8437
8740
|
}, [value, disabled, markTabDisabled]);
|
|
8438
|
-
const handleKeyDown =
|
|
8741
|
+
const handleKeyDown = React38.useCallback(
|
|
8439
8742
|
(e) => {
|
|
8440
8743
|
const isRtl = buttonRef.current ? getComputedStyle(buttonRef.current).direction === "rtl" : false;
|
|
8441
8744
|
const enabledValues = tabValues.filter((v) => !disabledValues.has(v));
|
|
@@ -8489,7 +8792,7 @@ var TabComponent = React37.forwardRef(
|
|
|
8489
8792
|
autoActivate
|
|
8490
8793
|
]
|
|
8491
8794
|
);
|
|
8492
|
-
|
|
8795
|
+
React38.useEffect(() => {
|
|
8493
8796
|
if (isFirstMount.current) {
|
|
8494
8797
|
isFirstMount.current = false;
|
|
8495
8798
|
return;
|
|
@@ -8498,7 +8801,7 @@ var TabComponent = React37.forwardRef(
|
|
|
8498
8801
|
buttonRef.current.focus({ preventScroll: true });
|
|
8499
8802
|
}
|
|
8500
8803
|
}, [isFocused]);
|
|
8501
|
-
|
|
8804
|
+
React38.useEffect(() => {
|
|
8502
8805
|
if (!isActive || !scrollable || !buttonRef.current) return;
|
|
8503
8806
|
const btn = buttonRef.current;
|
|
8504
8807
|
let container = btn.parentElement;
|
|
@@ -8635,8 +8938,8 @@ var TabComponent = React37.forwardRef(
|
|
|
8635
8938
|
}
|
|
8636
8939
|
);
|
|
8637
8940
|
TabComponent.displayName = "Tab";
|
|
8638
|
-
var Tab =
|
|
8639
|
-
var TabsContentComponent =
|
|
8941
|
+
var Tab = React38.memo(TabComponent);
|
|
8942
|
+
var TabsContentComponent = React38.forwardRef(
|
|
8640
8943
|
({ value, className, children }, ref) => {
|
|
8641
8944
|
var _a;
|
|
8642
8945
|
const { value: selectedValue, layoutGroupId } = useTabsContext();
|
|
@@ -8670,8 +8973,8 @@ var TabsContentComponent = React37.forwardRef(
|
|
|
8670
8973
|
}
|
|
8671
8974
|
);
|
|
8672
8975
|
TabsContentComponent.displayName = "TabsContent";
|
|
8673
|
-
var TabsContent =
|
|
8674
|
-
var TabsListComponent =
|
|
8976
|
+
var TabsContent = React38.memo(TabsContentComponent);
|
|
8977
|
+
var TabsListComponent = React38.forwardRef(
|
|
8675
8978
|
({
|
|
8676
8979
|
variant,
|
|
8677
8980
|
scrollable = false,
|
|
@@ -8682,12 +8985,12 @@ var TabsListComponent = React37.forwardRef(
|
|
|
8682
8985
|
}, ref) => {
|
|
8683
8986
|
const { layoutGroupId, value, setFocusedValue } = useTabsContext();
|
|
8684
8987
|
const listLayoutId = `${layoutGroupId}-list`;
|
|
8685
|
-
const listContextValue =
|
|
8988
|
+
const listContextValue = React38.useMemo(
|
|
8686
8989
|
() => ({ variant, scrollable }),
|
|
8687
8990
|
[variant, scrollable]
|
|
8688
8991
|
);
|
|
8689
8992
|
const bgColor = backgroundColor != null ? backgroundColor : "var(--md-sys-color-surface)";
|
|
8690
|
-
const handleBlur =
|
|
8993
|
+
const handleBlur = React38.useCallback(
|
|
8691
8994
|
(e) => {
|
|
8692
8995
|
const listEl = e.currentTarget;
|
|
8693
8996
|
if (listEl.contains(e.relatedTarget)) return;
|
|
@@ -8736,7 +9039,7 @@ var TabsListComponent = React37.forwardRef(
|
|
|
8736
9039
|
}
|
|
8737
9040
|
);
|
|
8738
9041
|
TabsListComponent.displayName = "TabsList";
|
|
8739
|
-
var TabsList =
|
|
9042
|
+
var TabsList = React38.memo(TabsListComponent);
|
|
8740
9043
|
|
|
8741
9044
|
// src/ui/toolbar/toolbar-colors.ts
|
|
8742
9045
|
var standardFloatingToolbarColors = {
|
|
@@ -8792,13 +9095,13 @@ function getToolbarColors(variant = "standard", customColors) {
|
|
|
8792
9095
|
return standardFloatingToolbarColors;
|
|
8793
9096
|
}
|
|
8794
9097
|
}
|
|
8795
|
-
var ToolbarContext =
|
|
9098
|
+
var ToolbarContext = React38.createContext(
|
|
8796
9099
|
null
|
|
8797
9100
|
);
|
|
8798
9101
|
function useToolbarContext() {
|
|
8799
|
-
return
|
|
9102
|
+
return React38.useContext(ToolbarContext);
|
|
8800
9103
|
}
|
|
8801
|
-
var BottomDockedToolbar =
|
|
9104
|
+
var BottomDockedToolbar = React38.forwardRef(
|
|
8802
9105
|
(_a, ref) => {
|
|
8803
9106
|
var _b = _a, {
|
|
8804
9107
|
variant = "standard",
|
|
@@ -8831,8 +9134,8 @@ var BottomDockedToolbar = React37.forwardRef(
|
|
|
8831
9134
|
const { scrollY } = useScroll(
|
|
8832
9135
|
scrollContainerRef ? { container: scrollContainerRef } : void 0
|
|
8833
9136
|
);
|
|
8834
|
-
const [isHidden, setIsHidden] =
|
|
8835
|
-
const lastScrollY =
|
|
9137
|
+
const [isHidden, setIsHidden] = React38.useState(false);
|
|
9138
|
+
const lastScrollY = React38.useRef(0);
|
|
8836
9139
|
useMotionValueEvent(scrollY, "change", (latest) => {
|
|
8837
9140
|
if (!hideOnScroll) return;
|
|
8838
9141
|
const diff = latest - lastScrollY.current;
|
|
@@ -8991,15 +9294,15 @@ function buildSlotVariants(xHidden, yHidden, isHorizontal) {
|
|
|
8991
9294
|
};
|
|
8992
9295
|
}
|
|
8993
9296
|
function applyItemClassName(nodes, itemClassName) {
|
|
8994
|
-
return
|
|
8995
|
-
if (!
|
|
9297
|
+
return React38.Children.map(nodes, (child) => {
|
|
9298
|
+
if (!React38.isValidElement(child)) return child;
|
|
8996
9299
|
const element = child;
|
|
8997
|
-
return
|
|
9300
|
+
return React38.cloneElement(element, {
|
|
8998
9301
|
className: cn(element.props.className, itemClassName)
|
|
8999
9302
|
});
|
|
9000
9303
|
});
|
|
9001
9304
|
}
|
|
9002
|
-
var FloatingToolbarBase =
|
|
9305
|
+
var FloatingToolbarBase = React38.forwardRef(
|
|
9003
9306
|
(_a, ref) => {
|
|
9004
9307
|
var _b = _a, {
|
|
9005
9308
|
expanded,
|
|
@@ -9171,11 +9474,11 @@ var FloatingToolbarBase = React37.forwardRef(
|
|
|
9171
9474
|
}
|
|
9172
9475
|
);
|
|
9173
9476
|
FloatingToolbarBase.displayName = "FloatingToolbarBase";
|
|
9174
|
-
var HorizontalFloatingToolbar =
|
|
9477
|
+
var HorizontalFloatingToolbar = React38.forwardRef((props, ref) => /* @__PURE__ */ jsx(FloatingToolbarBase, __spreadValues({ ref, orientation: "horizontal" }, props)));
|
|
9175
9478
|
HorizontalFloatingToolbar.displayName = "HorizontalFloatingToolbar";
|
|
9176
|
-
var VerticalFloatingToolbar =
|
|
9479
|
+
var VerticalFloatingToolbar = React38.forwardRef((props, ref) => /* @__PURE__ */ jsx(FloatingToolbarBase, __spreadValues({ ref, orientation: "vertical" }, props)));
|
|
9177
9480
|
VerticalFloatingToolbar.displayName = "VerticalFloatingToolbar";
|
|
9178
|
-
var FloatingToolbarWithFabBase =
|
|
9481
|
+
var FloatingToolbarWithFabBase = React38.forwardRef(
|
|
9179
9482
|
(_a, ref) => {
|
|
9180
9483
|
var _b = _a, {
|
|
9181
9484
|
expanded,
|
|
@@ -9303,9 +9606,9 @@ var FloatingToolbarWithFabBase = React37.forwardRef(
|
|
|
9303
9606
|
}
|
|
9304
9607
|
);
|
|
9305
9608
|
FloatingToolbarWithFabBase.displayName = "FloatingToolbarWithFabBase";
|
|
9306
|
-
var HorizontalFloatingToolbarWithFab =
|
|
9609
|
+
var HorizontalFloatingToolbarWithFab = React38.forwardRef((props, ref) => /* @__PURE__ */ jsx(FloatingToolbarWithFabBase, __spreadValues({ ref, orientation: "horizontal" }, props)));
|
|
9307
9610
|
HorizontalFloatingToolbarWithFab.displayName = "HorizontalFloatingToolbarWithFab";
|
|
9308
|
-
var VerticalFloatingToolbarWithFab =
|
|
9611
|
+
var VerticalFloatingToolbarWithFab = React38.forwardRef((props, ref) => /* @__PURE__ */ jsx(FloatingToolbarWithFabBase, __spreadValues({ ref, orientation: "vertical" }, props)));
|
|
9309
9612
|
VerticalFloatingToolbarWithFab.displayName = "VerticalFloatingToolbarWithFab";
|
|
9310
9613
|
var ToolbarDivider = ({
|
|
9311
9614
|
orientation: propsOrientation,
|
|
@@ -9341,7 +9644,7 @@ var VARIANT_TO_COLOR_STYLE = {
|
|
|
9341
9644
|
tonal: "tonal",
|
|
9342
9645
|
filled: "filled"
|
|
9343
9646
|
};
|
|
9344
|
-
var ToolbarIconButton =
|
|
9647
|
+
var ToolbarIconButton = React38.forwardRef(
|
|
9345
9648
|
(_a, ref) => {
|
|
9346
9649
|
var _b = _a, {
|
|
9347
9650
|
emphasis = "standard",
|
|
@@ -9513,7 +9816,7 @@ var MOTION_PROP_KEYS = [
|
|
|
9513
9816
|
"layoutId",
|
|
9514
9817
|
"onLayoutAnimationComplete"
|
|
9515
9818
|
];
|
|
9516
|
-
var ToolbarToggleButton =
|
|
9819
|
+
var ToolbarToggleButton = React38.forwardRef(
|
|
9517
9820
|
(_a, ref) => {
|
|
9518
9821
|
var _b = _a, {
|
|
9519
9822
|
emphasis = "standard",
|
|
@@ -9547,7 +9850,7 @@ var ToolbarToggleButton = React37.forwardRef(
|
|
|
9547
9850
|
"onPointerLeave"
|
|
9548
9851
|
]);
|
|
9549
9852
|
const context = useToolbarContext();
|
|
9550
|
-
const [isPressed, setIsPressed] =
|
|
9853
|
+
const [isPressed, setIsPressed] = React38.useState(false);
|
|
9551
9854
|
const {
|
|
9552
9855
|
ripples,
|
|
9553
9856
|
onPointerDown: handleRipplePointerDown,
|
|
@@ -9555,7 +9858,7 @@ var ToolbarToggleButton = React37.forwardRef(
|
|
|
9555
9858
|
} = useRippleState({
|
|
9556
9859
|
disabled: Boolean(disabled) || !ripple
|
|
9557
9860
|
});
|
|
9558
|
-
const handlePointerDown =
|
|
9861
|
+
const handlePointerDown = React38.useCallback(
|
|
9559
9862
|
(e) => {
|
|
9560
9863
|
setIsPressed(true);
|
|
9561
9864
|
if (!disabled && ripple) {
|
|
@@ -9565,14 +9868,14 @@ var ToolbarToggleButton = React37.forwardRef(
|
|
|
9565
9868
|
},
|
|
9566
9869
|
[disabled, ripple, handleRipplePointerDown, onPointerDownProp]
|
|
9567
9870
|
);
|
|
9568
|
-
const handlePointerUp =
|
|
9871
|
+
const handlePointerUp = React38.useCallback(
|
|
9569
9872
|
(e) => {
|
|
9570
9873
|
setIsPressed(false);
|
|
9571
9874
|
onPointerUpProp == null ? void 0 : onPointerUpProp(e);
|
|
9572
9875
|
},
|
|
9573
9876
|
[onPointerUpProp]
|
|
9574
9877
|
);
|
|
9575
|
-
const handlePointerLeave =
|
|
9878
|
+
const handlePointerLeave = React38.useCallback(
|
|
9576
9879
|
(e) => {
|
|
9577
9880
|
setIsPressed(false);
|
|
9578
9881
|
onPointerLeaveProp == null ? void 0 : onPointerLeaveProp(e);
|
|
@@ -9591,14 +9894,14 @@ var ToolbarToggleButton = React37.forwardRef(
|
|
|
9591
9894
|
context == null ? void 0 : context.itemClassName,
|
|
9592
9895
|
className
|
|
9593
9896
|
);
|
|
9594
|
-
const animateConfig =
|
|
9897
|
+
const animateConfig = React38.useMemo(
|
|
9595
9898
|
() => ({
|
|
9596
9899
|
scaleX: pressExpand && isPressed ? 1 + pressExpandRatio : 1,
|
|
9597
9900
|
borderRadius: isPressed ? ToolbarToggleButtonRadiusTokens.pressedRadius : ToolbarToggleButtonRadiusTokens.pillRadius
|
|
9598
9901
|
}),
|
|
9599
9902
|
[pressExpand, pressExpandRatio, isPressed]
|
|
9600
9903
|
);
|
|
9601
|
-
const transitionConfig =
|
|
9904
|
+
const transitionConfig = React38.useMemo(
|
|
9602
9905
|
() => ({
|
|
9603
9906
|
scaleX: FAST_SPATIAL_SPRING,
|
|
9604
9907
|
borderRadius: BUTTON_RADIUS_SPRING
|
|
@@ -9620,7 +9923,7 @@ var ToolbarToggleButton = React37.forwardRef(
|
|
|
9620
9923
|
children && (typeof children === "string" || typeof children === "number" ? /* @__PURE__ */ jsx("span", { children }) : children)
|
|
9621
9924
|
] });
|
|
9622
9925
|
if (asChild) {
|
|
9623
|
-
const child =
|
|
9926
|
+
const child = React38.Children.only(children);
|
|
9624
9927
|
const childContent = child.props.children;
|
|
9625
9928
|
const innerChildContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9626
9929
|
ripple && /* @__PURE__ */ jsx(
|
|
@@ -9659,7 +9962,7 @@ var ToolbarToggleButton = React37.forwardRef(
|
|
|
9659
9962
|
onPointerUp: handlePointerUp,
|
|
9660
9963
|
onPointerLeave: handlePointerLeave
|
|
9661
9964
|
}, strippedProps), {
|
|
9662
|
-
children:
|
|
9965
|
+
children: React38.cloneElement(child, { children: innerChildContent })
|
|
9663
9966
|
})
|
|
9664
9967
|
) });
|
|
9665
9968
|
}
|