@bug-on/m3-expressive 1.3.1 → 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 +9 -0
- package/README.md +88 -60
- package/dist/buttons.d.mts +3 -3
- package/dist/buttons.d.ts +3 -3
- 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/feedback.js +1 -1
- package/dist/feedback.js.map +1 -1
- package/dist/feedback.mjs +1 -1
- package/dist/feedback.mjs.map +1 -1
- package/dist/forms.d.mts +4 -3
- package/dist/forms.d.ts +4 -3
- package/dist/forms.js +5084 -2987
- package/dist/forms.js.map +1 -1
- package/dist/forms.mjs +5083 -2989
- 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 +2635 -1119
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2483 -979
- 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 +1499 -220
- package/dist/layout.js.map +1 -1
- package/dist/layout.mjs +1471 -208
- 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 +423 -250
- package/dist/navigation.js.map +1 -1
- package/dist/navigation.mjs +415 -243
- package/dist/navigation.mjs.map +1 -1
- package/dist/overlays.d.mts +2 -2
- package/dist/overlays.d.ts +2 -2
- 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-DTQJjzsB.d.ts → split-button-trailing-uncheckable-CGzk7KcG.d.ts} +1 -1
- package/dist/{split-button-trailing-uncheckable-CIVEYgjY.d.mts → split-button-trailing-uncheckable-gAz6OAIi.d.mts} +1 -1
- package/dist/{text-field-Ear3hCSq.d.mts → text-field-4OlT9o8s.d.mts} +155 -5
- package/dist/{text-field-CiOmDM_8.d.ts → text-field-DARNdj14.d.ts} +155 -5
- package/package.json +3 -3
package/dist/navigation.mjs
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
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",
|
|
@@ -6514,7 +6686,7 @@ 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,
|
|
@@ -6568,19 +6740,19 @@ var CircularProgress = React37.forwardRef(
|
|
|
6568
6740
|
const shouldShowDeterminateTrack = showTrack === "auto" ? true : showTrack;
|
|
6569
6741
|
const BASELINE_SIZE = 48;
|
|
6570
6742
|
const scaleFactor = size / BASELINE_SIZE;
|
|
6571
|
-
const effectiveAmplitude =
|
|
6743
|
+
const effectiveAmplitude = React38.useMemo(
|
|
6572
6744
|
() => amplitude != null ? amplitude : 1.6 * scaleFactor,
|
|
6573
6745
|
[amplitude, scaleFactor]
|
|
6574
6746
|
);
|
|
6575
|
-
const effectiveWavelength =
|
|
6747
|
+
const effectiveWavelength = React38.useMemo(
|
|
6576
6748
|
() => wavelength != null ? wavelength : 15 * scaleFactor,
|
|
6577
6749
|
[wavelength, scaleFactor]
|
|
6578
6750
|
);
|
|
6579
|
-
const resolvedAmplitudeRange =
|
|
6751
|
+
const resolvedAmplitudeRange = React38.useMemo(
|
|
6580
6752
|
() => amplitudeRange != null ? amplitudeRange : [0, effectiveAmplitude],
|
|
6581
6753
|
[amplitudeRange, effectiveAmplitude]
|
|
6582
6754
|
);
|
|
6583
|
-
const wavyActivePath =
|
|
6755
|
+
const wavyActivePath = React38.useMemo(
|
|
6584
6756
|
() => isWavy ? generateWavyCircularPath(
|
|
6585
6757
|
center,
|
|
6586
6758
|
radius,
|
|
@@ -6589,8 +6761,8 @@ var CircularProgress = React37.forwardRef(
|
|
|
6589
6761
|
) : null,
|
|
6590
6762
|
[isWavy, center, radius, effectiveAmplitude, effectiveWavelength]
|
|
6591
6763
|
);
|
|
6592
|
-
const circumference =
|
|
6593
|
-
const gapForTrack =
|
|
6764
|
+
const circumference = React38.useMemo(() => 2 * Math.PI * radius, [radius]);
|
|
6765
|
+
const gapForTrack = React38.useMemo(
|
|
6594
6766
|
() => (gapSize + trackHeight) / circumference,
|
|
6595
6767
|
[gapSize, trackHeight, circumference]
|
|
6596
6768
|
);
|
|
@@ -6598,17 +6770,17 @@ var CircularProgress = React37.forwardRef(
|
|
|
6598
6770
|
const trackOffset = isDeterminate ? activeAngularFraction + gapForTrack : 0;
|
|
6599
6771
|
const trackLength = isDeterminate ? Math.max(1e-3, 1 - activeAngularFraction - 2 * gapForTrack) : 1;
|
|
6600
6772
|
const ActiveCircleElem = m.circle;
|
|
6601
|
-
const indeterminateSvgRef =
|
|
6602
|
-
const indeterminateTrackRef =
|
|
6603
|
-
const indeterminateActiveRef =
|
|
6604
|
-
const indeterminateWavyTrackPathRef =
|
|
6605
|
-
const indeterminateWavyActivePathRef =
|
|
6606
|
-
const determinateWavyActivePathRef =
|
|
6607
|
-
const determinateWavyTrackPathRef =
|
|
6608
|
-
const cachedPathLengthRef =
|
|
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);
|
|
6609
6781
|
const fractionMV = useMotionValue(isDeterminate ? clampedValue / 100 : 0);
|
|
6610
6782
|
const amplitudeMV = useMotionValue(isWavy ? effectiveAmplitude : 0);
|
|
6611
|
-
|
|
6783
|
+
React38.useEffect(() => {
|
|
6612
6784
|
if (isDeterminate) {
|
|
6613
6785
|
animate(fractionMV, clampedValue / 100, {
|
|
6614
6786
|
duration: 0.4,
|
|
@@ -6616,7 +6788,7 @@ var CircularProgress = React37.forwardRef(
|
|
|
6616
6788
|
});
|
|
6617
6789
|
}
|
|
6618
6790
|
}, [clampedValue, isDeterminate, fractionMV]);
|
|
6619
|
-
|
|
6791
|
+
React38.useEffect(() => {
|
|
6620
6792
|
if (!isDeterminate || !isWavy) return;
|
|
6621
6793
|
const fraction = clampedValue / 100;
|
|
6622
6794
|
let targetAmp = effectiveAmplitude;
|
|
@@ -6636,7 +6808,7 @@ var CircularProgress = React37.forwardRef(
|
|
|
6636
6808
|
amplitudeMV,
|
|
6637
6809
|
determinateAnimation
|
|
6638
6810
|
]);
|
|
6639
|
-
|
|
6811
|
+
React38.useLayoutEffect(() => {
|
|
6640
6812
|
if (!isWavy || !wavyActivePath) {
|
|
6641
6813
|
cachedPathLengthRef.current = circumference;
|
|
6642
6814
|
return;
|
|
@@ -7013,9 +7185,9 @@ var CircularProgress = React37.forwardRef(
|
|
|
7013
7185
|
);
|
|
7014
7186
|
CircularProgress.displayName = "CircularProgress";
|
|
7015
7187
|
function useContainerWidth() {
|
|
7016
|
-
const [width, setWidth] =
|
|
7017
|
-
const observerRef =
|
|
7018
|
-
const ref =
|
|
7188
|
+
const [width, setWidth] = React38.useState(0);
|
|
7189
|
+
const observerRef = React38.useRef(null);
|
|
7190
|
+
const ref = React38.useCallback((node) => {
|
|
7019
7191
|
if (observerRef.current) {
|
|
7020
7192
|
observerRef.current.disconnect();
|
|
7021
7193
|
observerRef.current = null;
|
|
@@ -7029,7 +7201,7 @@ function useContainerWidth() {
|
|
|
7029
7201
|
observerRef.current = obs;
|
|
7030
7202
|
}
|
|
7031
7203
|
}, []);
|
|
7032
|
-
|
|
7204
|
+
React38.useEffect(() => {
|
|
7033
7205
|
return () => {
|
|
7034
7206
|
if (observerRef.current) {
|
|
7035
7207
|
observerRef.current.disconnect();
|
|
@@ -7039,7 +7211,7 @@ function useContainerWidth() {
|
|
|
7039
7211
|
return [ref, width];
|
|
7040
7212
|
}
|
|
7041
7213
|
function useMergedRef(...refs) {
|
|
7042
|
-
return
|
|
7214
|
+
return React38.useCallback(
|
|
7043
7215
|
(node) => {
|
|
7044
7216
|
for (const ref of refs) {
|
|
7045
7217
|
if (typeof ref === "function") {
|
|
@@ -7053,7 +7225,7 @@ function useMergedRef(...refs) {
|
|
|
7053
7225
|
[refs]
|
|
7054
7226
|
);
|
|
7055
7227
|
}
|
|
7056
|
-
var FlatLinearTrack =
|
|
7228
|
+
var FlatLinearTrack = React38.memo(function FlatLinearTrack2({
|
|
7057
7229
|
trackHeight,
|
|
7058
7230
|
activeColor,
|
|
7059
7231
|
trackColor,
|
|
@@ -7129,7 +7301,7 @@ var FlatLinearTrack = React37.memo(function FlatLinearTrack2({
|
|
|
7129
7301
|
}
|
|
7130
7302
|
);
|
|
7131
7303
|
});
|
|
7132
|
-
var WavyLinearTrack =
|
|
7304
|
+
var WavyLinearTrack = React38.memo(function WavyLinearTrack2({
|
|
7133
7305
|
trackHeight,
|
|
7134
7306
|
svgHeight,
|
|
7135
7307
|
amplitude,
|
|
@@ -7148,13 +7320,13 @@ var WavyLinearTrack = React37.memo(function WavyLinearTrack2({
|
|
|
7148
7320
|
}) {
|
|
7149
7321
|
const isDeterminate = typeof value === "number";
|
|
7150
7322
|
const clampedValue = isDeterminate ? Math.max(0, Math.min(100, value)) : 100;
|
|
7151
|
-
const titleId =
|
|
7323
|
+
const titleId = React38.useId();
|
|
7152
7324
|
const [containerRef, width] = useContainerWidth();
|
|
7153
|
-
const activePathRef =
|
|
7154
|
-
const trackPathRef =
|
|
7325
|
+
const activePathRef = React38.useRef(null);
|
|
7326
|
+
const trackPathRef = React38.useRef(null);
|
|
7155
7327
|
const amplitudeMV = useMotionValue(amplitude);
|
|
7156
7328
|
const fractionMV = useMotionValue(isDeterminate ? clampedValue / 100 : 1);
|
|
7157
|
-
|
|
7329
|
+
React38.useEffect(() => {
|
|
7158
7330
|
if (isDeterminate) {
|
|
7159
7331
|
const fraction = clampedValue / 100;
|
|
7160
7332
|
let targetAmp = amplitude;
|
|
@@ -7342,7 +7514,7 @@ var WavyLinearTrack = React37.memo(function WavyLinearTrack2({
|
|
|
7342
7514
|
}
|
|
7343
7515
|
);
|
|
7344
7516
|
});
|
|
7345
|
-
var LinearProgress =
|
|
7517
|
+
var LinearProgress = React38.forwardRef(
|
|
7346
7518
|
(_a, ref) => {
|
|
7347
7519
|
var _b = _a, {
|
|
7348
7520
|
value,
|
|
@@ -7383,10 +7555,10 @@ var LinearProgress = React37.forwardRef(
|
|
|
7383
7555
|
]);
|
|
7384
7556
|
const isDeterminate = value !== void 0;
|
|
7385
7557
|
const clampedValue = isDeterminate ? Math.min(100, Math.max(0, value)) : 0;
|
|
7386
|
-
const containerRef =
|
|
7558
|
+
const containerRef = React38.useRef(null);
|
|
7387
7559
|
const mergedRef = useMergedRef(ref, containerRef);
|
|
7388
|
-
const [isRtl, setIsRtl] =
|
|
7389
|
-
|
|
7560
|
+
const [isRtl, setIsRtl] = React38.useState(false);
|
|
7561
|
+
React38.useEffect(() => {
|
|
7390
7562
|
if (containerRef.current) {
|
|
7391
7563
|
const dir = getComputedStyle(containerRef.current).direction;
|
|
7392
7564
|
setIsRtl(dir === "rtl");
|
|
@@ -7394,16 +7566,16 @@ var LinearProgress = React37.forwardRef(
|
|
|
7394
7566
|
}, []);
|
|
7395
7567
|
const resolvedTrackShape = trackShape != null ? trackShape : shape;
|
|
7396
7568
|
const isWavy = shape === "wavy" || resolvedTrackShape === "wavy";
|
|
7397
|
-
const effectiveAmplitude =
|
|
7398
|
-
const svgHeight =
|
|
7569
|
+
const effectiveAmplitude = React38.useMemo(() => amplitude != null ? amplitude : 3, [amplitude]);
|
|
7570
|
+
const svgHeight = React38.useMemo(
|
|
7399
7571
|
() => isWavy ? trackHeight + effectiveAmplitude * 2 : trackHeight,
|
|
7400
7572
|
[isWavy, trackHeight, effectiveAmplitude]
|
|
7401
7573
|
);
|
|
7402
|
-
const shouldShowStop =
|
|
7574
|
+
const shouldShowStop = React38.useMemo(
|
|
7403
7575
|
() => isDeterminate && resolvedTrackShape === "flat" && showStopIndicator !== false,
|
|
7404
7576
|
[isDeterminate, resolvedTrackShape, showStopIndicator]
|
|
7405
7577
|
);
|
|
7406
|
-
const stopSize =
|
|
7578
|
+
const stopSize = React38.useMemo(
|
|
7407
7579
|
() => Math.max(2, trackHeight > 4 ? 4 : trackHeight / 2),
|
|
7408
7580
|
[trackHeight]
|
|
7409
7581
|
);
|
|
@@ -7478,7 +7650,7 @@ var LinearProgress = React37.forwardRef(
|
|
|
7478
7650
|
}
|
|
7479
7651
|
);
|
|
7480
7652
|
LinearProgress.displayName = "LinearProgress";
|
|
7481
|
-
var ProgressIndicator =
|
|
7653
|
+
var ProgressIndicator = React38.forwardRef((props, ref) => {
|
|
7482
7654
|
if (props.variant === "circular") {
|
|
7483
7655
|
return /* @__PURE__ */ jsx(CircularProgress, __spreadValues({ ref }, props));
|
|
7484
7656
|
}
|
|
@@ -7610,7 +7782,7 @@ function resolveDisabledBgClass(colorStyle) {
|
|
|
7610
7782
|
}
|
|
7611
7783
|
return "disabled:text-m3-on-surface/[0.38]";
|
|
7612
7784
|
}
|
|
7613
|
-
var IconButtonComponent =
|
|
7785
|
+
var IconButtonComponent = React38.forwardRef(
|
|
7614
7786
|
(_a, ref) => {
|
|
7615
7787
|
var _b = _a, {
|
|
7616
7788
|
className,
|
|
@@ -7652,18 +7824,18 @@ var IconButtonComponent = React37.forwardRef(
|
|
|
7652
7824
|
var _a2, _b2, _c, _d, _e;
|
|
7653
7825
|
const isToggle = variant === "toggle";
|
|
7654
7826
|
const isSelected = isToggle && !!selected;
|
|
7655
|
-
const resolvedColorClass =
|
|
7827
|
+
const resolvedColorClass = React38.useMemo(
|
|
7656
7828
|
() => isSelected ? colorStyles[colorStyle].selected : colorStyles[colorStyle].default,
|
|
7657
7829
|
[isSelected, colorStyle]
|
|
7658
7830
|
);
|
|
7659
|
-
const outlineWidthClass =
|
|
7831
|
+
const outlineWidthClass = React38.useMemo(
|
|
7660
7832
|
() => {
|
|
7661
7833
|
var _a3;
|
|
7662
7834
|
return colorStyle === "outlined" && !isSelected ? (_a3 = SIZE_OUTLINE_WIDTH[size]) != null ? _a3 : "border" : "";
|
|
7663
7835
|
},
|
|
7664
7836
|
[colorStyle, isSelected, size]
|
|
7665
7837
|
);
|
|
7666
|
-
const disabledBgClass =
|
|
7838
|
+
const disabledBgClass = React38.useMemo(
|
|
7667
7839
|
() => resolveDisabledBgClass(colorStyle),
|
|
7668
7840
|
[colorStyle]
|
|
7669
7841
|
);
|
|
@@ -7686,7 +7858,7 @@ var IconButtonComponent = React37.forwardRef(
|
|
|
7686
7858
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
7687
7859
|
disabled: loading
|
|
7688
7860
|
});
|
|
7689
|
-
const handleClick =
|
|
7861
|
+
const handleClick = React38.useCallback(
|
|
7690
7862
|
(e) => {
|
|
7691
7863
|
if (loading) {
|
|
7692
7864
|
e.preventDefault();
|
|
@@ -7696,7 +7868,7 @@ var IconButtonComponent = React37.forwardRef(
|
|
|
7696
7868
|
},
|
|
7697
7869
|
[loading, onClick]
|
|
7698
7870
|
);
|
|
7699
|
-
const handleKeyDown =
|
|
7871
|
+
const handleKeyDown = React38.useCallback(
|
|
7700
7872
|
(e) => {
|
|
7701
7873
|
if (loading) return;
|
|
7702
7874
|
if ((e.key === "Enter" || e.key === " ") && onClick) {
|
|
@@ -7752,7 +7924,7 @@ var IconButtonComponent = React37.forwardRef(
|
|
|
7752
7924
|
width: isCustomSize ? `${iconSize}px` : void 0,
|
|
7753
7925
|
height: isCustomSize ? `${iconSize}px` : void 0
|
|
7754
7926
|
},
|
|
7755
|
-
children: isSelected && selectedIcon ? selectedIcon : asChild ?
|
|
7927
|
+
children: isSelected && selectedIcon ? selectedIcon : asChild ? React38.Children.only(children).props.children : children
|
|
7756
7928
|
}),
|
|
7757
7929
|
isSelected && selectedIcon ? "selected-content" : "content"
|
|
7758
7930
|
) })
|
|
@@ -7769,7 +7941,7 @@ var IconButtonComponent = React37.forwardRef(
|
|
|
7769
7941
|
className
|
|
7770
7942
|
);
|
|
7771
7943
|
if (asChild) {
|
|
7772
|
-
const child =
|
|
7944
|
+
const child = React38.Children.only(children);
|
|
7773
7945
|
return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: /* @__PURE__ */ jsx(
|
|
7774
7946
|
Slot,
|
|
7775
7947
|
__spreadProps(__spreadValues({
|
|
@@ -7786,7 +7958,7 @@ var IconButtonComponent = React37.forwardRef(
|
|
|
7786
7958
|
}),
|
|
7787
7959
|
className: containerClassName
|
|
7788
7960
|
}, restProps), {
|
|
7789
|
-
children:
|
|
7961
|
+
children: React38.cloneElement(child, { children: innerContent })
|
|
7790
7962
|
})
|
|
7791
7963
|
) });
|
|
7792
7964
|
}
|
|
@@ -7814,7 +7986,7 @@ var IconButtonComponent = React37.forwardRef(
|
|
|
7814
7986
|
}
|
|
7815
7987
|
);
|
|
7816
7988
|
IconButtonComponent.displayName = "IconButton";
|
|
7817
|
-
var IconButton =
|
|
7989
|
+
var IconButton = React38.memo(IconButtonComponent);
|
|
7818
7990
|
function TrailingAction({
|
|
7819
7991
|
query,
|
|
7820
7992
|
trailingIcon,
|
|
@@ -7874,7 +8046,7 @@ function SearchViewDocked({
|
|
|
7874
8046
|
activeIndex
|
|
7875
8047
|
}) {
|
|
7876
8048
|
const shouldReduceMotion = useReducedMotion();
|
|
7877
|
-
const inputRef =
|
|
8049
|
+
const inputRef = React38.useRef(null);
|
|
7878
8050
|
useSearchViewFocus(inputRef, active);
|
|
7879
8051
|
const dropdownRef = useClickOutside(() => {
|
|
7880
8052
|
onActiveChange(false);
|
|
@@ -8020,10 +8192,10 @@ function SearchViewFullScreen({
|
|
|
8020
8192
|
activeIndex
|
|
8021
8193
|
}) {
|
|
8022
8194
|
const shouldReduceMotion = useReducedMotion();
|
|
8023
|
-
const inputRef =
|
|
8195
|
+
const inputRef = React38.useRef(null);
|
|
8024
8196
|
useSearchViewFocus(inputRef, active);
|
|
8025
|
-
const [mounted, setMounted] =
|
|
8026
|
-
|
|
8197
|
+
const [mounted, setMounted] = React38.useState(false);
|
|
8198
|
+
React38.useEffect(() => {
|
|
8027
8199
|
setMounted(true);
|
|
8028
8200
|
}, []);
|
|
8029
8201
|
const handleFormSubmit = (e) => {
|
|
@@ -8181,10 +8353,10 @@ function SearchComponent({
|
|
|
8181
8353
|
className,
|
|
8182
8354
|
viewClassName
|
|
8183
8355
|
}) {
|
|
8184
|
-
const generatedId =
|
|
8356
|
+
const generatedId = React38.useId();
|
|
8185
8357
|
const searchId = id != null ? id : generatedId;
|
|
8186
8358
|
const listboxId = `${searchId}-listbox`;
|
|
8187
|
-
const itemCount =
|
|
8359
|
+
const itemCount = React38.Children.count(children);
|
|
8188
8360
|
const { activeIndex, handleKeyDown } = useSearchKeyboard({
|
|
8189
8361
|
active,
|
|
8190
8362
|
onActiveChange,
|
|
@@ -8243,9 +8415,9 @@ function formatBadgeLabel(children, max) {
|
|
|
8243
8415
|
return "";
|
|
8244
8416
|
}
|
|
8245
8417
|
function detectBadgeHasContent(badge) {
|
|
8246
|
-
return
|
|
8418
|
+
return React38.isValidElement(badge) && badge.props.children != null;
|
|
8247
8419
|
}
|
|
8248
|
-
var BadgeImpl =
|
|
8420
|
+
var BadgeImpl = React38.forwardRef(
|
|
8249
8421
|
(_a, ref) => {
|
|
8250
8422
|
var _b = _a, {
|
|
8251
8423
|
children,
|
|
@@ -8282,7 +8454,7 @@ var BadgeImpl = React37.forwardRef(
|
|
|
8282
8454
|
exit: { scale: 0, opacity: 0 },
|
|
8283
8455
|
transition: springTransition,
|
|
8284
8456
|
className: cn(
|
|
8285
|
-
"rounded-full ring-[1.5px] ring-m3-surface",
|
|
8457
|
+
"rounded-full ring-[1.5px] ring-m3-surface shrink-0",
|
|
8286
8458
|
!containerColor && "bg-m3-error",
|
|
8287
8459
|
hasContent ? cn(
|
|
8288
8460
|
"inline-flex items-center justify-center",
|
|
@@ -8299,7 +8471,7 @@ var BadgeImpl = React37.forwardRef(
|
|
|
8299
8471
|
}
|
|
8300
8472
|
);
|
|
8301
8473
|
BadgeImpl.displayName = "Badge";
|
|
8302
|
-
|
|
8474
|
+
React38.memo(BadgeImpl);
|
|
8303
8475
|
function BadgedBox({
|
|
8304
8476
|
badge,
|
|
8305
8477
|
children,
|
|
@@ -8320,9 +8492,9 @@ function BadgedBox({
|
|
|
8320
8492
|
)
|
|
8321
8493
|
] });
|
|
8322
8494
|
}
|
|
8323
|
-
var TabsContext =
|
|
8495
|
+
var TabsContext = React38.createContext(null);
|
|
8324
8496
|
function useTabsContext() {
|
|
8325
|
-
const ctx =
|
|
8497
|
+
const ctx = React38.useContext(TabsContext);
|
|
8326
8498
|
if (!ctx) {
|
|
8327
8499
|
throw new Error(
|
|
8328
8500
|
"[MD3 Tabs] Component must be used within a <Tabs> root. Ensure <TabsList>, <Tab>, and <TabsContent> are descendants of <Tabs>."
|
|
@@ -8330,7 +8502,7 @@ function useTabsContext() {
|
|
|
8330
8502
|
}
|
|
8331
8503
|
return ctx;
|
|
8332
8504
|
}
|
|
8333
|
-
var TabsComponent =
|
|
8505
|
+
var TabsComponent = React38.forwardRef(
|
|
8334
8506
|
({
|
|
8335
8507
|
value: controlledValue,
|
|
8336
8508
|
defaultValue = "",
|
|
@@ -8339,35 +8511,35 @@ var TabsComponent = React37.forwardRef(
|
|
|
8339
8511
|
children,
|
|
8340
8512
|
className
|
|
8341
8513
|
}, ref) => {
|
|
8342
|
-
const [internalValue, setInternalValue] =
|
|
8514
|
+
const [internalValue, setInternalValue] = React38.useState(defaultValue);
|
|
8343
8515
|
const isControlled = controlledValue !== void 0;
|
|
8344
8516
|
const value = isControlled ? controlledValue : internalValue;
|
|
8345
|
-
const handleValueChange =
|
|
8517
|
+
const handleValueChange = React38.useCallback(
|
|
8346
8518
|
(newValue) => {
|
|
8347
8519
|
if (!isControlled) setInternalValue(newValue);
|
|
8348
8520
|
onValueChange == null ? void 0 : onValueChange(newValue);
|
|
8349
8521
|
},
|
|
8350
8522
|
[isControlled, onValueChange]
|
|
8351
8523
|
);
|
|
8352
|
-
const [focusedValue, setFocusedValue] =
|
|
8353
|
-
|
|
8524
|
+
const [focusedValue, setFocusedValue] = React38.useState(value);
|
|
8525
|
+
React38.useEffect(() => {
|
|
8354
8526
|
setFocusedValue(value);
|
|
8355
8527
|
}, [value]);
|
|
8356
|
-
const [tabValues, setTabValues] =
|
|
8357
|
-
const registerTab =
|
|
8528
|
+
const [tabValues, setTabValues] = React38.useState([]);
|
|
8529
|
+
const registerTab = React38.useCallback((tabValue) => {
|
|
8358
8530
|
setTabValues((prev) => {
|
|
8359
8531
|
if (prev.includes(tabValue)) return prev;
|
|
8360
8532
|
return [...prev, tabValue];
|
|
8361
8533
|
});
|
|
8362
8534
|
}, []);
|
|
8363
|
-
const unregisterTab =
|
|
8535
|
+
const unregisterTab = React38.useCallback((tabValue) => {
|
|
8364
8536
|
setTabValues((prev) => prev.filter((v) => v !== tabValue));
|
|
8365
8537
|
}, []);
|
|
8366
|
-
const hasAutoSelected =
|
|
8367
|
-
const [disabledValues, setDisabledValues] =
|
|
8538
|
+
const hasAutoSelected = React38.useRef(false);
|
|
8539
|
+
const [disabledValues, setDisabledValues] = React38.useState(
|
|
8368
8540
|
/* @__PURE__ */ new Set()
|
|
8369
8541
|
);
|
|
8370
|
-
const markTabDisabled =
|
|
8542
|
+
const markTabDisabled = React38.useCallback(
|
|
8371
8543
|
(tabValue, disabled) => {
|
|
8372
8544
|
setDisabledValues((prev) => {
|
|
8373
8545
|
const next = new Set(prev);
|
|
@@ -8381,7 +8553,7 @@ var TabsComponent = React37.forwardRef(
|
|
|
8381
8553
|
},
|
|
8382
8554
|
[]
|
|
8383
8555
|
);
|
|
8384
|
-
|
|
8556
|
+
React38.useEffect(() => {
|
|
8385
8557
|
if (isControlled || hasAutoSelected.current || tabValues.length === 0) {
|
|
8386
8558
|
return;
|
|
8387
8559
|
}
|
|
@@ -8396,9 +8568,9 @@ var TabsComponent = React37.forwardRef(
|
|
|
8396
8568
|
setFocusedValue(firstEnabled);
|
|
8397
8569
|
}
|
|
8398
8570
|
}, [tabValues, disabledValues, isControlled, value]);
|
|
8399
|
-
const id =
|
|
8571
|
+
const id = React38.useId();
|
|
8400
8572
|
const layoutGroupId = `tabs-${id}`;
|
|
8401
|
-
const contextValue =
|
|
8573
|
+
const contextValue = React38.useMemo(
|
|
8402
8574
|
() => ({
|
|
8403
8575
|
value,
|
|
8404
8576
|
onValueChange: handleValueChange,
|
|
@@ -8429,12 +8601,12 @@ var TabsComponent = React37.forwardRef(
|
|
|
8429
8601
|
}
|
|
8430
8602
|
);
|
|
8431
8603
|
TabsComponent.displayName = "Tabs";
|
|
8432
|
-
var Tabs =
|
|
8433
|
-
var TabsListContext =
|
|
8604
|
+
var Tabs = React38.memo(TabsComponent);
|
|
8605
|
+
var TabsListContext = React38.createContext(
|
|
8434
8606
|
null
|
|
8435
8607
|
);
|
|
8436
8608
|
function useTabsListContext() {
|
|
8437
|
-
const ctx =
|
|
8609
|
+
const ctx = React38.useContext(TabsListContext);
|
|
8438
8610
|
return ctx != null ? ctx : { variant: "primary", scrollable: false };
|
|
8439
8611
|
}
|
|
8440
8612
|
|
|
@@ -8518,7 +8690,7 @@ var TABS_CONTENT_TRANSITION = {
|
|
|
8518
8690
|
ease: "easeInOut"
|
|
8519
8691
|
};
|
|
8520
8692
|
var INDICATOR_MIN_WIDTH = 24;
|
|
8521
|
-
var TabComponent =
|
|
8693
|
+
var TabComponent = React38.forwardRef(
|
|
8522
8694
|
({
|
|
8523
8695
|
value,
|
|
8524
8696
|
icon,
|
|
@@ -8548,9 +8720,9 @@ var TabComponent = React37.forwardRef(
|
|
|
8548
8720
|
const isFocused = focusedValue === value;
|
|
8549
8721
|
const hasIcon = icon != null;
|
|
8550
8722
|
const isStackedIcon = hasIcon && !inlineIcon;
|
|
8551
|
-
const buttonRef =
|
|
8552
|
-
const isFirstMount =
|
|
8553
|
-
const mergedRef =
|
|
8723
|
+
const buttonRef = React38.useRef(null);
|
|
8724
|
+
const isFirstMount = React38.useRef(true);
|
|
8725
|
+
const mergedRef = React38.useCallback(
|
|
8554
8726
|
(node) => {
|
|
8555
8727
|
buttonRef.current = node;
|
|
8556
8728
|
if (typeof ref === "function") ref(node);
|
|
@@ -8558,15 +8730,15 @@ var TabComponent = React37.forwardRef(
|
|
|
8558
8730
|
},
|
|
8559
8731
|
[ref]
|
|
8560
8732
|
);
|
|
8561
|
-
|
|
8733
|
+
React38.useEffect(() => {
|
|
8562
8734
|
registerTab(value);
|
|
8563
8735
|
return () => unregisterTab(value);
|
|
8564
8736
|
}, [value, registerTab, unregisterTab]);
|
|
8565
|
-
|
|
8737
|
+
React38.useEffect(() => {
|
|
8566
8738
|
markTabDisabled(value, disabled);
|
|
8567
8739
|
return () => markTabDisabled(value, false);
|
|
8568
8740
|
}, [value, disabled, markTabDisabled]);
|
|
8569
|
-
const handleKeyDown =
|
|
8741
|
+
const handleKeyDown = React38.useCallback(
|
|
8570
8742
|
(e) => {
|
|
8571
8743
|
const isRtl = buttonRef.current ? getComputedStyle(buttonRef.current).direction === "rtl" : false;
|
|
8572
8744
|
const enabledValues = tabValues.filter((v) => !disabledValues.has(v));
|
|
@@ -8620,7 +8792,7 @@ var TabComponent = React37.forwardRef(
|
|
|
8620
8792
|
autoActivate
|
|
8621
8793
|
]
|
|
8622
8794
|
);
|
|
8623
|
-
|
|
8795
|
+
React38.useEffect(() => {
|
|
8624
8796
|
if (isFirstMount.current) {
|
|
8625
8797
|
isFirstMount.current = false;
|
|
8626
8798
|
return;
|
|
@@ -8629,7 +8801,7 @@ var TabComponent = React37.forwardRef(
|
|
|
8629
8801
|
buttonRef.current.focus({ preventScroll: true });
|
|
8630
8802
|
}
|
|
8631
8803
|
}, [isFocused]);
|
|
8632
|
-
|
|
8804
|
+
React38.useEffect(() => {
|
|
8633
8805
|
if (!isActive || !scrollable || !buttonRef.current) return;
|
|
8634
8806
|
const btn = buttonRef.current;
|
|
8635
8807
|
let container = btn.parentElement;
|
|
@@ -8766,8 +8938,8 @@ var TabComponent = React37.forwardRef(
|
|
|
8766
8938
|
}
|
|
8767
8939
|
);
|
|
8768
8940
|
TabComponent.displayName = "Tab";
|
|
8769
|
-
var Tab =
|
|
8770
|
-
var TabsContentComponent =
|
|
8941
|
+
var Tab = React38.memo(TabComponent);
|
|
8942
|
+
var TabsContentComponent = React38.forwardRef(
|
|
8771
8943
|
({ value, className, children }, ref) => {
|
|
8772
8944
|
var _a;
|
|
8773
8945
|
const { value: selectedValue, layoutGroupId } = useTabsContext();
|
|
@@ -8801,8 +8973,8 @@ var TabsContentComponent = React37.forwardRef(
|
|
|
8801
8973
|
}
|
|
8802
8974
|
);
|
|
8803
8975
|
TabsContentComponent.displayName = "TabsContent";
|
|
8804
|
-
var TabsContent =
|
|
8805
|
-
var TabsListComponent =
|
|
8976
|
+
var TabsContent = React38.memo(TabsContentComponent);
|
|
8977
|
+
var TabsListComponent = React38.forwardRef(
|
|
8806
8978
|
({
|
|
8807
8979
|
variant,
|
|
8808
8980
|
scrollable = false,
|
|
@@ -8813,12 +8985,12 @@ var TabsListComponent = React37.forwardRef(
|
|
|
8813
8985
|
}, ref) => {
|
|
8814
8986
|
const { layoutGroupId, value, setFocusedValue } = useTabsContext();
|
|
8815
8987
|
const listLayoutId = `${layoutGroupId}-list`;
|
|
8816
|
-
const listContextValue =
|
|
8988
|
+
const listContextValue = React38.useMemo(
|
|
8817
8989
|
() => ({ variant, scrollable }),
|
|
8818
8990
|
[variant, scrollable]
|
|
8819
8991
|
);
|
|
8820
8992
|
const bgColor = backgroundColor != null ? backgroundColor : "var(--md-sys-color-surface)";
|
|
8821
|
-
const handleBlur =
|
|
8993
|
+
const handleBlur = React38.useCallback(
|
|
8822
8994
|
(e) => {
|
|
8823
8995
|
const listEl = e.currentTarget;
|
|
8824
8996
|
if (listEl.contains(e.relatedTarget)) return;
|
|
@@ -8867,7 +9039,7 @@ var TabsListComponent = React37.forwardRef(
|
|
|
8867
9039
|
}
|
|
8868
9040
|
);
|
|
8869
9041
|
TabsListComponent.displayName = "TabsList";
|
|
8870
|
-
var TabsList =
|
|
9042
|
+
var TabsList = React38.memo(TabsListComponent);
|
|
8871
9043
|
|
|
8872
9044
|
// src/ui/toolbar/toolbar-colors.ts
|
|
8873
9045
|
var standardFloatingToolbarColors = {
|
|
@@ -8923,13 +9095,13 @@ function getToolbarColors(variant = "standard", customColors) {
|
|
|
8923
9095
|
return standardFloatingToolbarColors;
|
|
8924
9096
|
}
|
|
8925
9097
|
}
|
|
8926
|
-
var ToolbarContext =
|
|
9098
|
+
var ToolbarContext = React38.createContext(
|
|
8927
9099
|
null
|
|
8928
9100
|
);
|
|
8929
9101
|
function useToolbarContext() {
|
|
8930
|
-
return
|
|
9102
|
+
return React38.useContext(ToolbarContext);
|
|
8931
9103
|
}
|
|
8932
|
-
var BottomDockedToolbar =
|
|
9104
|
+
var BottomDockedToolbar = React38.forwardRef(
|
|
8933
9105
|
(_a, ref) => {
|
|
8934
9106
|
var _b = _a, {
|
|
8935
9107
|
variant = "standard",
|
|
@@ -8962,8 +9134,8 @@ var BottomDockedToolbar = React37.forwardRef(
|
|
|
8962
9134
|
const { scrollY } = useScroll(
|
|
8963
9135
|
scrollContainerRef ? { container: scrollContainerRef } : void 0
|
|
8964
9136
|
);
|
|
8965
|
-
const [isHidden, setIsHidden] =
|
|
8966
|
-
const lastScrollY =
|
|
9137
|
+
const [isHidden, setIsHidden] = React38.useState(false);
|
|
9138
|
+
const lastScrollY = React38.useRef(0);
|
|
8967
9139
|
useMotionValueEvent(scrollY, "change", (latest) => {
|
|
8968
9140
|
if (!hideOnScroll) return;
|
|
8969
9141
|
const diff = latest - lastScrollY.current;
|
|
@@ -9122,15 +9294,15 @@ function buildSlotVariants(xHidden, yHidden, isHorizontal) {
|
|
|
9122
9294
|
};
|
|
9123
9295
|
}
|
|
9124
9296
|
function applyItemClassName(nodes, itemClassName) {
|
|
9125
|
-
return
|
|
9126
|
-
if (!
|
|
9297
|
+
return React38.Children.map(nodes, (child) => {
|
|
9298
|
+
if (!React38.isValidElement(child)) return child;
|
|
9127
9299
|
const element = child;
|
|
9128
|
-
return
|
|
9300
|
+
return React38.cloneElement(element, {
|
|
9129
9301
|
className: cn(element.props.className, itemClassName)
|
|
9130
9302
|
});
|
|
9131
9303
|
});
|
|
9132
9304
|
}
|
|
9133
|
-
var FloatingToolbarBase =
|
|
9305
|
+
var FloatingToolbarBase = React38.forwardRef(
|
|
9134
9306
|
(_a, ref) => {
|
|
9135
9307
|
var _b = _a, {
|
|
9136
9308
|
expanded,
|
|
@@ -9302,11 +9474,11 @@ var FloatingToolbarBase = React37.forwardRef(
|
|
|
9302
9474
|
}
|
|
9303
9475
|
);
|
|
9304
9476
|
FloatingToolbarBase.displayName = "FloatingToolbarBase";
|
|
9305
|
-
var HorizontalFloatingToolbar =
|
|
9477
|
+
var HorizontalFloatingToolbar = React38.forwardRef((props, ref) => /* @__PURE__ */ jsx(FloatingToolbarBase, __spreadValues({ ref, orientation: "horizontal" }, props)));
|
|
9306
9478
|
HorizontalFloatingToolbar.displayName = "HorizontalFloatingToolbar";
|
|
9307
|
-
var VerticalFloatingToolbar =
|
|
9479
|
+
var VerticalFloatingToolbar = React38.forwardRef((props, ref) => /* @__PURE__ */ jsx(FloatingToolbarBase, __spreadValues({ ref, orientation: "vertical" }, props)));
|
|
9308
9480
|
VerticalFloatingToolbar.displayName = "VerticalFloatingToolbar";
|
|
9309
|
-
var FloatingToolbarWithFabBase =
|
|
9481
|
+
var FloatingToolbarWithFabBase = React38.forwardRef(
|
|
9310
9482
|
(_a, ref) => {
|
|
9311
9483
|
var _b = _a, {
|
|
9312
9484
|
expanded,
|
|
@@ -9434,9 +9606,9 @@ var FloatingToolbarWithFabBase = React37.forwardRef(
|
|
|
9434
9606
|
}
|
|
9435
9607
|
);
|
|
9436
9608
|
FloatingToolbarWithFabBase.displayName = "FloatingToolbarWithFabBase";
|
|
9437
|
-
var HorizontalFloatingToolbarWithFab =
|
|
9609
|
+
var HorizontalFloatingToolbarWithFab = React38.forwardRef((props, ref) => /* @__PURE__ */ jsx(FloatingToolbarWithFabBase, __spreadValues({ ref, orientation: "horizontal" }, props)));
|
|
9438
9610
|
HorizontalFloatingToolbarWithFab.displayName = "HorizontalFloatingToolbarWithFab";
|
|
9439
|
-
var VerticalFloatingToolbarWithFab =
|
|
9611
|
+
var VerticalFloatingToolbarWithFab = React38.forwardRef((props, ref) => /* @__PURE__ */ jsx(FloatingToolbarWithFabBase, __spreadValues({ ref, orientation: "vertical" }, props)));
|
|
9440
9612
|
VerticalFloatingToolbarWithFab.displayName = "VerticalFloatingToolbarWithFab";
|
|
9441
9613
|
var ToolbarDivider = ({
|
|
9442
9614
|
orientation: propsOrientation,
|
|
@@ -9472,7 +9644,7 @@ var VARIANT_TO_COLOR_STYLE = {
|
|
|
9472
9644
|
tonal: "tonal",
|
|
9473
9645
|
filled: "filled"
|
|
9474
9646
|
};
|
|
9475
|
-
var ToolbarIconButton =
|
|
9647
|
+
var ToolbarIconButton = React38.forwardRef(
|
|
9476
9648
|
(_a, ref) => {
|
|
9477
9649
|
var _b = _a, {
|
|
9478
9650
|
emphasis = "standard",
|
|
@@ -9644,7 +9816,7 @@ var MOTION_PROP_KEYS = [
|
|
|
9644
9816
|
"layoutId",
|
|
9645
9817
|
"onLayoutAnimationComplete"
|
|
9646
9818
|
];
|
|
9647
|
-
var ToolbarToggleButton =
|
|
9819
|
+
var ToolbarToggleButton = React38.forwardRef(
|
|
9648
9820
|
(_a, ref) => {
|
|
9649
9821
|
var _b = _a, {
|
|
9650
9822
|
emphasis = "standard",
|
|
@@ -9678,7 +9850,7 @@ var ToolbarToggleButton = React37.forwardRef(
|
|
|
9678
9850
|
"onPointerLeave"
|
|
9679
9851
|
]);
|
|
9680
9852
|
const context = useToolbarContext();
|
|
9681
|
-
const [isPressed, setIsPressed] =
|
|
9853
|
+
const [isPressed, setIsPressed] = React38.useState(false);
|
|
9682
9854
|
const {
|
|
9683
9855
|
ripples,
|
|
9684
9856
|
onPointerDown: handleRipplePointerDown,
|
|
@@ -9686,7 +9858,7 @@ var ToolbarToggleButton = React37.forwardRef(
|
|
|
9686
9858
|
} = useRippleState({
|
|
9687
9859
|
disabled: Boolean(disabled) || !ripple
|
|
9688
9860
|
});
|
|
9689
|
-
const handlePointerDown =
|
|
9861
|
+
const handlePointerDown = React38.useCallback(
|
|
9690
9862
|
(e) => {
|
|
9691
9863
|
setIsPressed(true);
|
|
9692
9864
|
if (!disabled && ripple) {
|
|
@@ -9696,14 +9868,14 @@ var ToolbarToggleButton = React37.forwardRef(
|
|
|
9696
9868
|
},
|
|
9697
9869
|
[disabled, ripple, handleRipplePointerDown, onPointerDownProp]
|
|
9698
9870
|
);
|
|
9699
|
-
const handlePointerUp =
|
|
9871
|
+
const handlePointerUp = React38.useCallback(
|
|
9700
9872
|
(e) => {
|
|
9701
9873
|
setIsPressed(false);
|
|
9702
9874
|
onPointerUpProp == null ? void 0 : onPointerUpProp(e);
|
|
9703
9875
|
},
|
|
9704
9876
|
[onPointerUpProp]
|
|
9705
9877
|
);
|
|
9706
|
-
const handlePointerLeave =
|
|
9878
|
+
const handlePointerLeave = React38.useCallback(
|
|
9707
9879
|
(e) => {
|
|
9708
9880
|
setIsPressed(false);
|
|
9709
9881
|
onPointerLeaveProp == null ? void 0 : onPointerLeaveProp(e);
|
|
@@ -9722,14 +9894,14 @@ var ToolbarToggleButton = React37.forwardRef(
|
|
|
9722
9894
|
context == null ? void 0 : context.itemClassName,
|
|
9723
9895
|
className
|
|
9724
9896
|
);
|
|
9725
|
-
const animateConfig =
|
|
9897
|
+
const animateConfig = React38.useMemo(
|
|
9726
9898
|
() => ({
|
|
9727
9899
|
scaleX: pressExpand && isPressed ? 1 + pressExpandRatio : 1,
|
|
9728
9900
|
borderRadius: isPressed ? ToolbarToggleButtonRadiusTokens.pressedRadius : ToolbarToggleButtonRadiusTokens.pillRadius
|
|
9729
9901
|
}),
|
|
9730
9902
|
[pressExpand, pressExpandRatio, isPressed]
|
|
9731
9903
|
);
|
|
9732
|
-
const transitionConfig =
|
|
9904
|
+
const transitionConfig = React38.useMemo(
|
|
9733
9905
|
() => ({
|
|
9734
9906
|
scaleX: FAST_SPATIAL_SPRING,
|
|
9735
9907
|
borderRadius: BUTTON_RADIUS_SPRING
|
|
@@ -9751,7 +9923,7 @@ var ToolbarToggleButton = React37.forwardRef(
|
|
|
9751
9923
|
children && (typeof children === "string" || typeof children === "number" ? /* @__PURE__ */ jsx("span", { children }) : children)
|
|
9752
9924
|
] });
|
|
9753
9925
|
if (asChild) {
|
|
9754
|
-
const child =
|
|
9926
|
+
const child = React38.Children.only(children);
|
|
9755
9927
|
const childContent = child.props.children;
|
|
9756
9928
|
const innerChildContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9757
9929
|
ripple && /* @__PURE__ */ jsx(
|
|
@@ -9790,7 +9962,7 @@ var ToolbarToggleButton = React37.forwardRef(
|
|
|
9790
9962
|
onPointerUp: handlePointerUp,
|
|
9791
9963
|
onPointerLeave: handlePointerLeave
|
|
9792
9964
|
}, strippedProps), {
|
|
9793
|
-
children:
|
|
9965
|
+
children: React38.cloneElement(child, { children: innerChildContent })
|
|
9794
9966
|
})
|
|
9795
9967
|
) });
|
|
9796
9968
|
}
|