@bug-on/m3-expressive 1.3.1 → 1.3.3
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 +113 -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/core.js +9 -7
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +9 -7
- package/dist/core.mjs.map +1 -1
- package/dist/feedback.d.mts +2 -1
- package/dist/feedback.d.ts +2 -1
- package/dist/feedback.js +11 -8
- package/dist/feedback.js.map +1 -1
- package/dist/feedback.mjs +11 -9
- 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 +13 -83
- package/dist/index.d.ts +13 -83
- package/dist/index.js +2843 -1210
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2692 -1072
- package/dist/index.mjs.map +1 -1
- package/dist/layout.d.mts +496 -37
- package/dist/layout.d.ts +496 -37
- package/dist/layout.js +1537 -238
- package/dist/layout.js.map +1 -1
- package/dist/layout.mjs +1509 -226
- 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 +28 -296
- package/dist/navigation.d.ts +28 -296
- package/dist/navigation.js +584 -288
- package/dist/navigation.js.map +1 -1
- package/dist/navigation.mjs +576 -282
- 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/llms-full.txt +255 -0
- package/llms.txt +102 -0
- package/package.json +10 -5
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 React39 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 = React39.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] = React39.useState(false);
|
|
319
|
+
React39.useEffect(() => {
|
|
320
|
+
if (typeof window !== "undefined") {
|
|
321
|
+
setIsTouchDevice(
|
|
322
|
+
"ontouchstart" in window || navigator.maxTouchPoints > 0
|
|
323
|
+
);
|
|
324
|
+
}
|
|
325
|
+
}, []);
|
|
326
|
+
const resolvedType = React39.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 = React39.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 = React39.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 = React39.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 = React39.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 = React39.useContext(MenuContext);
|
|
509
|
+
return React39.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 React39.Children.toArray(nodes).reduce(
|
|
508
630
|
(acc, child) => {
|
|
509
|
-
if (!
|
|
510
|
-
if (child.type ===
|
|
631
|
+
if (!React39.isValidElement(child)) return acc;
|
|
632
|
+
if (child.type === React39.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] = React39.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 = React39.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 = React39.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 = React39.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 = React39.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 = React39.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) => React39.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] = React39.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 = React39.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 = React39.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 = React39.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 = React39.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 = React39.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 = React39.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 React39.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 = React39.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 = React39.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 = React39.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 React39.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 = React39.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 = React39.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 = React39.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] = React39.useState(false);
|
|
1415
|
+
const openTimerRef = React39.useRef(null);
|
|
1416
|
+
const closeTimerRef = React39.useRef(
|
|
1245
1417
|
null
|
|
1246
1418
|
);
|
|
1247
|
-
const clearTimers =
|
|
1419
|
+
const clearTimers = React39.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 = React39.useCallback(() => {
|
|
1252
1424
|
clearTimers();
|
|
1253
1425
|
openTimerRef.current = setTimeout(() => setOpen(true), hoverOpenDelay);
|
|
1254
1426
|
}, [hoverOpenDelay, clearTimers]);
|
|
1255
|
-
const handleTriggerPointerLeave =
|
|
1427
|
+
const handleTriggerPointerLeave = React39.useCallback(() => {
|
|
1256
1428
|
clearTimers();
|
|
1257
1429
|
closeTimerRef.current = setTimeout(() => setOpen(false), hoverCloseDelay);
|
|
1258
1430
|
}, [hoverCloseDelay, clearTimers]);
|
|
1259
|
-
const handleContentPointerEnter =
|
|
1431
|
+
const handleContentPointerEnter = React39.useCallback(() => {
|
|
1260
1432
|
clearTimers();
|
|
1261
1433
|
}, [clearTimers]);
|
|
1262
|
-
const handleContentPointerLeave =
|
|
1434
|
+
const handleContentPointerLeave = React39.useCallback(() => {
|
|
1263
1435
|
clearTimers();
|
|
1264
1436
|
closeTimerRef.current = setTimeout(() => setOpen(false), hoverCloseDelay);
|
|
1265
1437
|
}, [hoverCloseDelay, clearTimers]);
|
|
1266
|
-
|
|
1438
|
+
React39.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: React39.isValidElement(trigger) ? React39.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 = React39.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 = React39.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 = React39.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 React39.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 = React39.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 = React39.useCallback(() => {
|
|
1445
1617
|
}, []);
|
|
1446
1618
|
const colors = colorVariant === "vibrant" ? VIBRANT_COLORS : STANDARD_COLORS;
|
|
1447
|
-
const containerRef =
|
|
1448
|
-
const mergedRef =
|
|
1619
|
+
const containerRef = React39.useRef(null);
|
|
1620
|
+
const mergedRef = React39.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 = React39.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 = React39.Children.toArray(children).find(React39.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 = React39.useRef(null);
|
|
1794
|
+
const [visibleCount, setVisibleCount] = React39.useState(
|
|
1623
1795
|
maxItemCount != null ? maxItemCount : items.length
|
|
1624
1796
|
);
|
|
1625
|
-
|
|
1797
|
+
React39.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 = React39.useRef(null);
|
|
1846
|
+
const [visibleCount, setVisibleCount] = React39.useState(
|
|
1675
1847
|
maxItemCount != null ? maxItemCount : items.length
|
|
1676
1848
|
);
|
|
1677
|
-
|
|
1849
|
+
React39.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] = React39.useState(false);
|
|
1904
|
+
const [collapsedFraction, setCollapsedFraction] = React39.useState(0);
|
|
1905
|
+
const [isHidden, setIsHidden] = React39.useState(false);
|
|
1906
|
+
const prevScrollYRef = React39.useRef(0);
|
|
1735
1907
|
const hideThreshold = 64;
|
|
1736
|
-
|
|
1908
|
+
React39.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
|
+
React39.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] = React39.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 = React39.useRef(null);
|
|
2563
|
+
React39.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 = React39.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] = React39.useState([]);
|
|
2899
|
+
const onPointerDown = React39.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 = React39.useCallback((id) => {
|
|
2745
2917
|
setRipples((prev) => prev.filter((r) => r.id !== id));
|
|
2746
2918
|
}, []);
|
|
2747
2919
|
return { ripples, onPointerDown, removeRipple };
|
|
@@ -3454,8 +3626,8 @@ var RoundedPolygon = class _RoundedPolygon {
|
|
|
3454
3626
|
);
|
|
3455
3627
|
const mid = c.pointOnCurve(0.5);
|
|
3456
3628
|
const md = distanceSquared(mid.x - this.centerX, mid.y - this.centerY);
|
|
3457
|
-
const
|
|
3458
|
-
if (
|
|
3629
|
+
const m33 = Math.max(ad, md);
|
|
3630
|
+
if (m33 > maxDistSq) maxDistSq = m33;
|
|
3459
3631
|
}
|
|
3460
3632
|
const d = Math.sqrt(maxDistSq);
|
|
3461
3633
|
return [
|
|
@@ -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 = React39.createContext({ variant: "flexible" });
|
|
4675
4847
|
function cloneIconWithFill(icon, selected) {
|
|
4676
|
-
if (!
|
|
4848
|
+
if (!React39.isValidElement(icon)) return icon;
|
|
4677
4849
|
if (icon.type === Icon) {
|
|
4678
|
-
return
|
|
4850
|
+
return React39.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 } = React39.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 = React39.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
|
+
} = React39.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 = React39.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 = React39.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: React39.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 = React39.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 = React39.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] = React39.useState(true);
|
|
5302
|
+
const lastScrollY = React39.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 = React39.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
|
+
React39.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 = React39.memo(NavigationBarComponent);
|
|
5397
|
+
var NavigationRailContext = React39.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 (!React39.isValidElement(icon)) return icon;
|
|
5262
5434
|
if (icon.type === Icon) {
|
|
5263
|
-
return
|
|
5435
|
+
return React39.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 } = React39.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 = React39.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
|
+
} = React39.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-${React39.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 = React39.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 = React39.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: React39.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 = React39.memo(NavigationRailItemComponent);
|
|
5674
5846
|
function useRoving(navRef) {
|
|
5675
|
-
|
|
5847
|
+
React39.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 React39.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 = React39.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 = React39.useRef(null);
|
|
5738
5910
|
const handleKeyDown = useRoving(navRef);
|
|
5739
|
-
const setRefs =
|
|
5911
|
+
const setRefs = React39.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
|
+
React39.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 = React39.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] = React39.useState(-1);
|
|
6059
|
+
const resetKeyRef = React39.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 = React39.useCallback(
|
|
5894
6066
|
(e) => {
|
|
5895
6067
|
if (!active) return;
|
|
5896
6068
|
switch (e.key) {
|
|
@@ -5930,11 +6102,39 @@ function useSearchKeyboard({
|
|
|
5930
6102
|
query
|
|
5931
6103
|
]
|
|
5932
6104
|
);
|
|
5933
|
-
const resetActiveIndex =
|
|
6105
|
+
const resetActiveIndex = React39.useCallback(() => {
|
|
5934
6106
|
setActiveIndex(-1);
|
|
5935
6107
|
}, []);
|
|
5936
6108
|
return { activeIndex, handleKeyDown, resetActiveIndex };
|
|
5937
6109
|
}
|
|
6110
|
+
var StateLayer = React39.forwardRef(
|
|
6111
|
+
(_a, ref) => {
|
|
6112
|
+
var _b = _a, { className, hovered, focused, pressed } = _b, props = __objRest(_b, ["className", "hovered", "focused", "pressed"]);
|
|
6113
|
+
let opacity = 0;
|
|
6114
|
+
if (pressed) {
|
|
6115
|
+
opacity = 0.12;
|
|
6116
|
+
} else if (focused) {
|
|
6117
|
+
opacity = 0.1;
|
|
6118
|
+
} else if (hovered) {
|
|
6119
|
+
opacity = 0.08;
|
|
6120
|
+
}
|
|
6121
|
+
return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: /* @__PURE__ */ jsx(
|
|
6122
|
+
m.div,
|
|
6123
|
+
__spreadValues({
|
|
6124
|
+
ref,
|
|
6125
|
+
className: cn(
|
|
6126
|
+
"absolute inset-0 bg-current pointer-events-none rounded-[inherit]",
|
|
6127
|
+
className
|
|
6128
|
+
),
|
|
6129
|
+
initial: false,
|
|
6130
|
+
animate: { opacity },
|
|
6131
|
+
transition: { duration: 0.2 },
|
|
6132
|
+
"aria-hidden": "true"
|
|
6133
|
+
}, props)
|
|
6134
|
+
) });
|
|
6135
|
+
}
|
|
6136
|
+
);
|
|
6137
|
+
StateLayer.displayName = "StateLayer";
|
|
5938
6138
|
|
|
5939
6139
|
// src/ui/search/search.tokens.ts
|
|
5940
6140
|
var SearchTokens = {
|
|
@@ -5973,7 +6173,12 @@ var SEARCH_COLORS = {
|
|
|
5973
6173
|
/** SearchViewTokens.DividerColor → outline */
|
|
5974
6174
|
divider: "var(--md-sys-color-outline)",
|
|
5975
6175
|
/** Focus indicator → secondary */
|
|
5976
|
-
focusIndicator: "var(--md-sys-color-secondary)"
|
|
6176
|
+
focusIndicator: "var(--md-sys-color-secondary)",
|
|
6177
|
+
/** State layer overlay for interactive hover/press */
|
|
6178
|
+
stateLayer: "var(--md-sys-color-on-surface)"
|
|
6179
|
+
};
|
|
6180
|
+
var SEARCH_ELEVATION = {
|
|
6181
|
+
level3: "elevation-3"
|
|
5977
6182
|
};
|
|
5978
6183
|
var SEARCH_TYPOGRAPHY = {
|
|
5979
6184
|
/** BodyLarge — used for input text and placeholder. */
|
|
@@ -5998,10 +6203,10 @@ function AnimatedPlaceholder({
|
|
|
5998
6203
|
className
|
|
5999
6204
|
}) {
|
|
6000
6205
|
const shouldReduceMotion = useReducedMotion();
|
|
6001
|
-
const containerRef =
|
|
6002
|
-
const spanRef =
|
|
6003
|
-
const [xOffset, setXOffset] =
|
|
6004
|
-
const recalculate =
|
|
6206
|
+
const containerRef = React39.useRef(null);
|
|
6207
|
+
const spanRef = React39.useRef(null);
|
|
6208
|
+
const [xOffset, setXOffset] = React39.useState(0);
|
|
6209
|
+
const recalculate = React39.useCallback(() => {
|
|
6005
6210
|
const container = containerRef.current;
|
|
6006
6211
|
const span = spanRef.current;
|
|
6007
6212
|
if (!container || !span || textAlign === "left") {
|
|
@@ -6016,10 +6221,10 @@ function AnimatedPlaceholder({
|
|
|
6016
6221
|
setXOffset(Math.max(0, containerWidth - textWidth));
|
|
6017
6222
|
}
|
|
6018
6223
|
}, [textAlign]);
|
|
6019
|
-
|
|
6224
|
+
React39.useLayoutEffect(() => {
|
|
6020
6225
|
recalculate();
|
|
6021
6226
|
}, [recalculate]);
|
|
6022
|
-
|
|
6227
|
+
React39.useEffect(() => {
|
|
6023
6228
|
const container = containerRef.current;
|
|
6024
6229
|
if (!container) return;
|
|
6025
6230
|
const observer = new ResizeObserver(recalculate);
|
|
@@ -6078,6 +6283,7 @@ function SearchBar({
|
|
|
6078
6283
|
onActiveChange,
|
|
6079
6284
|
leadingIcon,
|
|
6080
6285
|
trailingIcon,
|
|
6286
|
+
avatar,
|
|
6081
6287
|
placeholder = "Search",
|
|
6082
6288
|
textAlign = "left",
|
|
6083
6289
|
className,
|
|
@@ -6088,10 +6294,13 @@ function SearchBar({
|
|
|
6088
6294
|
activeIndex
|
|
6089
6295
|
}) {
|
|
6090
6296
|
const shouldReduceMotion = useReducedMotion();
|
|
6091
|
-
const inputRef =
|
|
6092
|
-
const prevActiveRef =
|
|
6093
|
-
const isRestoringFocusRef =
|
|
6094
|
-
|
|
6297
|
+
const inputRef = React39.useRef(null);
|
|
6298
|
+
const prevActiveRef = React39.useRef(active);
|
|
6299
|
+
const isRestoringFocusRef = React39.useRef(false);
|
|
6300
|
+
const [isHovered, setIsHovered] = React39.useState(false);
|
|
6301
|
+
const [isPressed, setIsPressed] = React39.useState(false);
|
|
6302
|
+
const [isFocused, setIsFocused] = React39.useState(false);
|
|
6303
|
+
React39.useEffect(() => {
|
|
6095
6304
|
var _a;
|
|
6096
6305
|
let rafId;
|
|
6097
6306
|
if (prevActiveRef.current === true && active === false) {
|
|
@@ -6107,10 +6316,14 @@ function SearchBar({
|
|
|
6107
6316
|
};
|
|
6108
6317
|
}, [active]);
|
|
6109
6318
|
const handleFocus = () => {
|
|
6319
|
+
setIsFocused(true);
|
|
6110
6320
|
if (!active && !isRestoringFocusRef.current) {
|
|
6111
6321
|
onActiveChange(true);
|
|
6112
6322
|
}
|
|
6113
6323
|
};
|
|
6324
|
+
const handleBlur = () => {
|
|
6325
|
+
setIsFocused(false);
|
|
6326
|
+
};
|
|
6114
6327
|
const handleFormSubmit = (e) => {
|
|
6115
6328
|
e.preventDefault();
|
|
6116
6329
|
onSearch(query);
|
|
@@ -6129,18 +6342,39 @@ function SearchBar({
|
|
|
6129
6342
|
layout: !shouldReduceMotion,
|
|
6130
6343
|
layoutId: shouldReduceMotion ? void 0 : searchId,
|
|
6131
6344
|
transition: shouldReduceMotion ? void 0 : SEARCH_BAR_EXPAND_SPRING,
|
|
6132
|
-
className: cn(
|
|
6345
|
+
className: cn(
|
|
6346
|
+
"relative group select-none",
|
|
6347
|
+
SEARCH_ELEVATION.level3,
|
|
6348
|
+
className
|
|
6349
|
+
),
|
|
6133
6350
|
style: { height: SearchTokens.heights.bar },
|
|
6134
6351
|
initial: shouldReduceMotion ? false : { opacity: 0, scale: 0.95 },
|
|
6135
6352
|
animate: { opacity: 1, scale: 1 },
|
|
6136
6353
|
exit: shouldReduceMotion ? {} : { opacity: 0, scale: 0.95, transition: SEARCH_BAR_EXIT_SPRING },
|
|
6354
|
+
onPointerEnter: () => setIsHovered(true),
|
|
6355
|
+
onPointerLeave: () => {
|
|
6356
|
+
setIsHovered(false);
|
|
6357
|
+
setIsPressed(false);
|
|
6358
|
+
},
|
|
6359
|
+
onPointerDown: () => setIsPressed(true),
|
|
6360
|
+
onPointerUp: () => setIsPressed(false),
|
|
6361
|
+
onPointerCancel: () => setIsPressed(false),
|
|
6137
6362
|
children: [
|
|
6138
6363
|
/* @__PURE__ */ jsx(
|
|
6139
6364
|
"div",
|
|
6140
6365
|
{
|
|
6141
|
-
className: "absolute inset-0 rounded-full",
|
|
6366
|
+
className: "absolute inset-0 rounded-full overflow-hidden",
|
|
6142
6367
|
style: { backgroundColor: SEARCH_COLORS.container },
|
|
6143
|
-
"aria-hidden": "true"
|
|
6368
|
+
"aria-hidden": "true",
|
|
6369
|
+
children: /* @__PURE__ */ jsx(
|
|
6370
|
+
StateLayer,
|
|
6371
|
+
{
|
|
6372
|
+
hovered: isHovered,
|
|
6373
|
+
focused: isFocused,
|
|
6374
|
+
pressed: isPressed,
|
|
6375
|
+
style: { color: SEARCH_COLORS.stateLayer }
|
|
6376
|
+
}
|
|
6377
|
+
)
|
|
6144
6378
|
}
|
|
6145
6379
|
),
|
|
6146
6380
|
/* @__PURE__ */ jsx(
|
|
@@ -6186,21 +6420,36 @@ function SearchBar({
|
|
|
6186
6420
|
),
|
|
6187
6421
|
style: { color: SEARCH_COLORS.inputText },
|
|
6188
6422
|
onFocus: handleFocus,
|
|
6423
|
+
onBlur: handleBlur,
|
|
6189
6424
|
onChange: (e) => onQueryChange(e.target.value),
|
|
6190
6425
|
onKeyDown
|
|
6191
6426
|
}
|
|
6192
6427
|
)
|
|
6193
6428
|
}
|
|
6194
6429
|
),
|
|
6195
|
-
trailingIcon && /* @__PURE__ */
|
|
6196
|
-
|
|
6197
|
-
|
|
6198
|
-
|
|
6199
|
-
|
|
6200
|
-
|
|
6201
|
-
|
|
6202
|
-
|
|
6203
|
-
|
|
6430
|
+
(trailingIcon || avatar) && /* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-center gap-2", children: [
|
|
6431
|
+
trailingIcon && /* @__PURE__ */ jsx(
|
|
6432
|
+
"span",
|
|
6433
|
+
{
|
|
6434
|
+
className: "flex shrink-0 items-center justify-center",
|
|
6435
|
+
style: { color: SEARCH_COLORS.trailingIcon },
|
|
6436
|
+
"aria-hidden": "true",
|
|
6437
|
+
children: trailingIcon
|
|
6438
|
+
}
|
|
6439
|
+
),
|
|
6440
|
+
avatar && /* @__PURE__ */ jsx(
|
|
6441
|
+
"span",
|
|
6442
|
+
{
|
|
6443
|
+
className: "flex shrink-0 items-center justify-center rounded-full overflow-hidden",
|
|
6444
|
+
style: {
|
|
6445
|
+
width: SearchTokens.avatarSize,
|
|
6446
|
+
height: SearchTokens.avatarSize
|
|
6447
|
+
},
|
|
6448
|
+
"aria-hidden": "true",
|
|
6449
|
+
children: avatar
|
|
6450
|
+
}
|
|
6451
|
+
)
|
|
6452
|
+
] })
|
|
6204
6453
|
] })
|
|
6205
6454
|
}
|
|
6206
6455
|
)
|
|
@@ -6210,7 +6459,7 @@ function SearchBar({
|
|
|
6210
6459
|
) })
|
|
6211
6460
|
);
|
|
6212
6461
|
}
|
|
6213
|
-
var SearchContext =
|
|
6462
|
+
var SearchContext = React39.createContext(null);
|
|
6214
6463
|
function SearchProvider({
|
|
6215
6464
|
children,
|
|
6216
6465
|
value
|
|
@@ -6218,7 +6467,7 @@ function SearchProvider({
|
|
|
6218
6467
|
return /* @__PURE__ */ jsx(SearchContext.Provider, { value, children });
|
|
6219
6468
|
}
|
|
6220
6469
|
function useSearch() {
|
|
6221
|
-
const context =
|
|
6470
|
+
const context = React39.useContext(SearchContext);
|
|
6222
6471
|
if (!context) {
|
|
6223
6472
|
return { listboxId: "", activeIndex: -1 };
|
|
6224
6473
|
}
|
|
@@ -6245,7 +6494,7 @@ function useClickOutside(handler, enabled = true) {
|
|
|
6245
6494
|
return ref;
|
|
6246
6495
|
}
|
|
6247
6496
|
function useSearchViewFocus(inputRef, active) {
|
|
6248
|
-
|
|
6497
|
+
React39.useEffect(() => {
|
|
6249
6498
|
if (!active) return;
|
|
6250
6499
|
let raf2;
|
|
6251
6500
|
const raf1 = requestAnimationFrame(() => {
|
|
@@ -6305,11 +6554,11 @@ var ROTATE_KEY_SPLINES = [
|
|
|
6305
6554
|
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
6555
|
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
6556
|
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 =
|
|
6557
|
+
var IndeterminateSvg = React39.memo(function IndeterminateSvg2({
|
|
6309
6558
|
size
|
|
6310
6559
|
}) {
|
|
6311
|
-
const [ready, setReady] =
|
|
6312
|
-
|
|
6560
|
+
const [ready, setReady] = React39.useState(false);
|
|
6561
|
+
React39.useEffect(() => {
|
|
6313
6562
|
const raf = requestAnimationFrame(() => setReady(true));
|
|
6314
6563
|
return () => cancelAnimationFrame(raf);
|
|
6315
6564
|
}, []);
|
|
@@ -6354,7 +6603,7 @@ var IndeterminateSvg = React37.memo(function IndeterminateSvg2({
|
|
|
6354
6603
|
}
|
|
6355
6604
|
);
|
|
6356
6605
|
});
|
|
6357
|
-
var DeterminateSvg =
|
|
6606
|
+
var DeterminateSvg = React39.memo(function DeterminateSvg2({
|
|
6358
6607
|
size,
|
|
6359
6608
|
progress
|
|
6360
6609
|
}) {
|
|
@@ -6379,7 +6628,7 @@ var DeterminateSvg = React37.memo(function DeterminateSvg2({
|
|
|
6379
6628
|
}
|
|
6380
6629
|
);
|
|
6381
6630
|
});
|
|
6382
|
-
var LoadingIndicator =
|
|
6631
|
+
var LoadingIndicator = React39.forwardRef(
|
|
6383
6632
|
(_a, ref) => {
|
|
6384
6633
|
var _b = _a, {
|
|
6385
6634
|
variant = "uncontained",
|
|
@@ -6514,7 +6763,7 @@ var ADDITIONAL_ROTATION_EASE_DURATION = 500;
|
|
|
6514
6763
|
var DEFAULT_MIN_PROGRESS = 0.1;
|
|
6515
6764
|
var DEFAULT_MAX_PROGRESS = 0.8;
|
|
6516
6765
|
var PROGRESS_CYCLE_DURATION = 1500;
|
|
6517
|
-
var CircularProgress =
|
|
6766
|
+
var CircularProgress = React39.forwardRef(
|
|
6518
6767
|
(_a, ref) => {
|
|
6519
6768
|
var _b = _a, {
|
|
6520
6769
|
value,
|
|
@@ -6568,19 +6817,19 @@ var CircularProgress = React37.forwardRef(
|
|
|
6568
6817
|
const shouldShowDeterminateTrack = showTrack === "auto" ? true : showTrack;
|
|
6569
6818
|
const BASELINE_SIZE = 48;
|
|
6570
6819
|
const scaleFactor = size / BASELINE_SIZE;
|
|
6571
|
-
const effectiveAmplitude =
|
|
6820
|
+
const effectiveAmplitude = React39.useMemo(
|
|
6572
6821
|
() => amplitude != null ? amplitude : 1.6 * scaleFactor,
|
|
6573
6822
|
[amplitude, scaleFactor]
|
|
6574
6823
|
);
|
|
6575
|
-
const effectiveWavelength =
|
|
6824
|
+
const effectiveWavelength = React39.useMemo(
|
|
6576
6825
|
() => wavelength != null ? wavelength : 15 * scaleFactor,
|
|
6577
6826
|
[wavelength, scaleFactor]
|
|
6578
6827
|
);
|
|
6579
|
-
const resolvedAmplitudeRange =
|
|
6828
|
+
const resolvedAmplitudeRange = React39.useMemo(
|
|
6580
6829
|
() => amplitudeRange != null ? amplitudeRange : [0, effectiveAmplitude],
|
|
6581
6830
|
[amplitudeRange, effectiveAmplitude]
|
|
6582
6831
|
);
|
|
6583
|
-
const wavyActivePath =
|
|
6832
|
+
const wavyActivePath = React39.useMemo(
|
|
6584
6833
|
() => isWavy ? generateWavyCircularPath(
|
|
6585
6834
|
center,
|
|
6586
6835
|
radius,
|
|
@@ -6589,8 +6838,8 @@ var CircularProgress = React37.forwardRef(
|
|
|
6589
6838
|
) : null,
|
|
6590
6839
|
[isWavy, center, radius, effectiveAmplitude, effectiveWavelength]
|
|
6591
6840
|
);
|
|
6592
|
-
const circumference =
|
|
6593
|
-
const gapForTrack =
|
|
6841
|
+
const circumference = React39.useMemo(() => 2 * Math.PI * radius, [radius]);
|
|
6842
|
+
const gapForTrack = React39.useMemo(
|
|
6594
6843
|
() => (gapSize + trackHeight) / circumference,
|
|
6595
6844
|
[gapSize, trackHeight, circumference]
|
|
6596
6845
|
);
|
|
@@ -6598,17 +6847,17 @@ var CircularProgress = React37.forwardRef(
|
|
|
6598
6847
|
const trackOffset = isDeterminate ? activeAngularFraction + gapForTrack : 0;
|
|
6599
6848
|
const trackLength = isDeterminate ? Math.max(1e-3, 1 - activeAngularFraction - 2 * gapForTrack) : 1;
|
|
6600
6849
|
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 =
|
|
6850
|
+
const indeterminateSvgRef = React39.useRef(null);
|
|
6851
|
+
const indeterminateTrackRef = React39.useRef(null);
|
|
6852
|
+
const indeterminateActiveRef = React39.useRef(null);
|
|
6853
|
+
const indeterminateWavyTrackPathRef = React39.useRef(null);
|
|
6854
|
+
const indeterminateWavyActivePathRef = React39.useRef(null);
|
|
6855
|
+
const determinateWavyActivePathRef = React39.useRef(null);
|
|
6856
|
+
const determinateWavyTrackPathRef = React39.useRef(null);
|
|
6857
|
+
const cachedPathLengthRef = React39.useRef(0);
|
|
6609
6858
|
const fractionMV = useMotionValue(isDeterminate ? clampedValue / 100 : 0);
|
|
6610
6859
|
const amplitudeMV = useMotionValue(isWavy ? effectiveAmplitude : 0);
|
|
6611
|
-
|
|
6860
|
+
React39.useEffect(() => {
|
|
6612
6861
|
if (isDeterminate) {
|
|
6613
6862
|
animate(fractionMV, clampedValue / 100, {
|
|
6614
6863
|
duration: 0.4,
|
|
@@ -6616,7 +6865,7 @@ var CircularProgress = React37.forwardRef(
|
|
|
6616
6865
|
});
|
|
6617
6866
|
}
|
|
6618
6867
|
}, [clampedValue, isDeterminate, fractionMV]);
|
|
6619
|
-
|
|
6868
|
+
React39.useEffect(() => {
|
|
6620
6869
|
if (!isDeterminate || !isWavy) return;
|
|
6621
6870
|
const fraction = clampedValue / 100;
|
|
6622
6871
|
let targetAmp = effectiveAmplitude;
|
|
@@ -6636,7 +6885,7 @@ var CircularProgress = React37.forwardRef(
|
|
|
6636
6885
|
amplitudeMV,
|
|
6637
6886
|
determinateAnimation
|
|
6638
6887
|
]);
|
|
6639
|
-
|
|
6888
|
+
React39.useLayoutEffect(() => {
|
|
6640
6889
|
if (!isWavy || !wavyActivePath) {
|
|
6641
6890
|
cachedPathLengthRef.current = circumference;
|
|
6642
6891
|
return;
|
|
@@ -7013,9 +7262,9 @@ var CircularProgress = React37.forwardRef(
|
|
|
7013
7262
|
);
|
|
7014
7263
|
CircularProgress.displayName = "CircularProgress";
|
|
7015
7264
|
function useContainerWidth() {
|
|
7016
|
-
const [width, setWidth] =
|
|
7017
|
-
const observerRef =
|
|
7018
|
-
const ref =
|
|
7265
|
+
const [width, setWidth] = React39.useState(0);
|
|
7266
|
+
const observerRef = React39.useRef(null);
|
|
7267
|
+
const ref = React39.useCallback((node) => {
|
|
7019
7268
|
if (observerRef.current) {
|
|
7020
7269
|
observerRef.current.disconnect();
|
|
7021
7270
|
observerRef.current = null;
|
|
@@ -7029,7 +7278,7 @@ function useContainerWidth() {
|
|
|
7029
7278
|
observerRef.current = obs;
|
|
7030
7279
|
}
|
|
7031
7280
|
}, []);
|
|
7032
|
-
|
|
7281
|
+
React39.useEffect(() => {
|
|
7033
7282
|
return () => {
|
|
7034
7283
|
if (observerRef.current) {
|
|
7035
7284
|
observerRef.current.disconnect();
|
|
@@ -7039,7 +7288,7 @@ function useContainerWidth() {
|
|
|
7039
7288
|
return [ref, width];
|
|
7040
7289
|
}
|
|
7041
7290
|
function useMergedRef(...refs) {
|
|
7042
|
-
return
|
|
7291
|
+
return React39.useCallback(
|
|
7043
7292
|
(node) => {
|
|
7044
7293
|
for (const ref of refs) {
|
|
7045
7294
|
if (typeof ref === "function") {
|
|
@@ -7053,7 +7302,7 @@ function useMergedRef(...refs) {
|
|
|
7053
7302
|
[refs]
|
|
7054
7303
|
);
|
|
7055
7304
|
}
|
|
7056
|
-
var FlatLinearTrack =
|
|
7305
|
+
var FlatLinearTrack = React39.memo(function FlatLinearTrack2({
|
|
7057
7306
|
trackHeight,
|
|
7058
7307
|
activeColor,
|
|
7059
7308
|
trackColor,
|
|
@@ -7129,7 +7378,7 @@ var FlatLinearTrack = React37.memo(function FlatLinearTrack2({
|
|
|
7129
7378
|
}
|
|
7130
7379
|
);
|
|
7131
7380
|
});
|
|
7132
|
-
var WavyLinearTrack =
|
|
7381
|
+
var WavyLinearTrack = React39.memo(function WavyLinearTrack2({
|
|
7133
7382
|
trackHeight,
|
|
7134
7383
|
svgHeight,
|
|
7135
7384
|
amplitude,
|
|
@@ -7148,13 +7397,13 @@ var WavyLinearTrack = React37.memo(function WavyLinearTrack2({
|
|
|
7148
7397
|
}) {
|
|
7149
7398
|
const isDeterminate = typeof value === "number";
|
|
7150
7399
|
const clampedValue = isDeterminate ? Math.max(0, Math.min(100, value)) : 100;
|
|
7151
|
-
const titleId =
|
|
7400
|
+
const titleId = React39.useId();
|
|
7152
7401
|
const [containerRef, width] = useContainerWidth();
|
|
7153
|
-
const activePathRef =
|
|
7154
|
-
const trackPathRef =
|
|
7402
|
+
const activePathRef = React39.useRef(null);
|
|
7403
|
+
const trackPathRef = React39.useRef(null);
|
|
7155
7404
|
const amplitudeMV = useMotionValue(amplitude);
|
|
7156
7405
|
const fractionMV = useMotionValue(isDeterminate ? clampedValue / 100 : 1);
|
|
7157
|
-
|
|
7406
|
+
React39.useEffect(() => {
|
|
7158
7407
|
if (isDeterminate) {
|
|
7159
7408
|
const fraction = clampedValue / 100;
|
|
7160
7409
|
let targetAmp = amplitude;
|
|
@@ -7342,7 +7591,7 @@ var WavyLinearTrack = React37.memo(function WavyLinearTrack2({
|
|
|
7342
7591
|
}
|
|
7343
7592
|
);
|
|
7344
7593
|
});
|
|
7345
|
-
var LinearProgress =
|
|
7594
|
+
var LinearProgress = React39.forwardRef(
|
|
7346
7595
|
(_a, ref) => {
|
|
7347
7596
|
var _b = _a, {
|
|
7348
7597
|
value,
|
|
@@ -7383,10 +7632,10 @@ var LinearProgress = React37.forwardRef(
|
|
|
7383
7632
|
]);
|
|
7384
7633
|
const isDeterminate = value !== void 0;
|
|
7385
7634
|
const clampedValue = isDeterminate ? Math.min(100, Math.max(0, value)) : 0;
|
|
7386
|
-
const containerRef =
|
|
7635
|
+
const containerRef = React39.useRef(null);
|
|
7387
7636
|
const mergedRef = useMergedRef(ref, containerRef);
|
|
7388
|
-
const [isRtl, setIsRtl] =
|
|
7389
|
-
|
|
7637
|
+
const [isRtl, setIsRtl] = React39.useState(false);
|
|
7638
|
+
React39.useEffect(() => {
|
|
7390
7639
|
if (containerRef.current) {
|
|
7391
7640
|
const dir = getComputedStyle(containerRef.current).direction;
|
|
7392
7641
|
setIsRtl(dir === "rtl");
|
|
@@ -7394,16 +7643,16 @@ var LinearProgress = React37.forwardRef(
|
|
|
7394
7643
|
}, []);
|
|
7395
7644
|
const resolvedTrackShape = trackShape != null ? trackShape : shape;
|
|
7396
7645
|
const isWavy = shape === "wavy" || resolvedTrackShape === "wavy";
|
|
7397
|
-
const effectiveAmplitude =
|
|
7398
|
-
const svgHeight =
|
|
7646
|
+
const effectiveAmplitude = React39.useMemo(() => amplitude != null ? amplitude : 3, [amplitude]);
|
|
7647
|
+
const svgHeight = React39.useMemo(
|
|
7399
7648
|
() => isWavy ? trackHeight + effectiveAmplitude * 2 : trackHeight,
|
|
7400
7649
|
[isWavy, trackHeight, effectiveAmplitude]
|
|
7401
7650
|
);
|
|
7402
|
-
const shouldShowStop =
|
|
7651
|
+
const shouldShowStop = React39.useMemo(
|
|
7403
7652
|
() => isDeterminate && resolvedTrackShape === "flat" && showStopIndicator !== false,
|
|
7404
7653
|
[isDeterminate, resolvedTrackShape, showStopIndicator]
|
|
7405
7654
|
);
|
|
7406
|
-
const stopSize =
|
|
7655
|
+
const stopSize = React39.useMemo(
|
|
7407
7656
|
() => Math.max(2, trackHeight > 4 ? 4 : trackHeight / 2),
|
|
7408
7657
|
[trackHeight]
|
|
7409
7658
|
);
|
|
@@ -7478,7 +7727,7 @@ var LinearProgress = React37.forwardRef(
|
|
|
7478
7727
|
}
|
|
7479
7728
|
);
|
|
7480
7729
|
LinearProgress.displayName = "LinearProgress";
|
|
7481
|
-
var ProgressIndicator =
|
|
7730
|
+
var ProgressIndicator = React39.forwardRef((props, ref) => {
|
|
7482
7731
|
if (props.variant === "circular") {
|
|
7483
7732
|
return /* @__PURE__ */ jsx(CircularProgress, __spreadValues({ ref }, props));
|
|
7484
7733
|
}
|
|
@@ -7610,7 +7859,7 @@ function resolveDisabledBgClass(colorStyle) {
|
|
|
7610
7859
|
}
|
|
7611
7860
|
return "disabled:text-m3-on-surface/[0.38]";
|
|
7612
7861
|
}
|
|
7613
|
-
var IconButtonComponent =
|
|
7862
|
+
var IconButtonComponent = React39.forwardRef(
|
|
7614
7863
|
(_a, ref) => {
|
|
7615
7864
|
var _b = _a, {
|
|
7616
7865
|
className,
|
|
@@ -7652,18 +7901,18 @@ var IconButtonComponent = React37.forwardRef(
|
|
|
7652
7901
|
var _a2, _b2, _c, _d, _e;
|
|
7653
7902
|
const isToggle = variant === "toggle";
|
|
7654
7903
|
const isSelected = isToggle && !!selected;
|
|
7655
|
-
const resolvedColorClass =
|
|
7904
|
+
const resolvedColorClass = React39.useMemo(
|
|
7656
7905
|
() => isSelected ? colorStyles[colorStyle].selected : colorStyles[colorStyle].default,
|
|
7657
7906
|
[isSelected, colorStyle]
|
|
7658
7907
|
);
|
|
7659
|
-
const outlineWidthClass =
|
|
7908
|
+
const outlineWidthClass = React39.useMemo(
|
|
7660
7909
|
() => {
|
|
7661
7910
|
var _a3;
|
|
7662
7911
|
return colorStyle === "outlined" && !isSelected ? (_a3 = SIZE_OUTLINE_WIDTH[size]) != null ? _a3 : "border" : "";
|
|
7663
7912
|
},
|
|
7664
7913
|
[colorStyle, isSelected, size]
|
|
7665
7914
|
);
|
|
7666
|
-
const disabledBgClass =
|
|
7915
|
+
const disabledBgClass = React39.useMemo(
|
|
7667
7916
|
() => resolveDisabledBgClass(colorStyle),
|
|
7668
7917
|
[colorStyle]
|
|
7669
7918
|
);
|
|
@@ -7686,7 +7935,7 @@ var IconButtonComponent = React37.forwardRef(
|
|
|
7686
7935
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
7687
7936
|
disabled: loading
|
|
7688
7937
|
});
|
|
7689
|
-
const handleClick =
|
|
7938
|
+
const handleClick = React39.useCallback(
|
|
7690
7939
|
(e) => {
|
|
7691
7940
|
if (loading) {
|
|
7692
7941
|
e.preventDefault();
|
|
@@ -7696,7 +7945,7 @@ var IconButtonComponent = React37.forwardRef(
|
|
|
7696
7945
|
},
|
|
7697
7946
|
[loading, onClick]
|
|
7698
7947
|
);
|
|
7699
|
-
const handleKeyDown =
|
|
7948
|
+
const handleKeyDown = React39.useCallback(
|
|
7700
7949
|
(e) => {
|
|
7701
7950
|
if (loading) return;
|
|
7702
7951
|
if ((e.key === "Enter" || e.key === " ") && onClick) {
|
|
@@ -7752,7 +8001,7 @@ var IconButtonComponent = React37.forwardRef(
|
|
|
7752
8001
|
width: isCustomSize ? `${iconSize}px` : void 0,
|
|
7753
8002
|
height: isCustomSize ? `${iconSize}px` : void 0
|
|
7754
8003
|
},
|
|
7755
|
-
children: isSelected && selectedIcon ? selectedIcon : asChild ?
|
|
8004
|
+
children: isSelected && selectedIcon ? selectedIcon : asChild ? React39.Children.only(children).props.children : children
|
|
7756
8005
|
}),
|
|
7757
8006
|
isSelected && selectedIcon ? "selected-content" : "content"
|
|
7758
8007
|
) })
|
|
@@ -7769,7 +8018,7 @@ var IconButtonComponent = React37.forwardRef(
|
|
|
7769
8018
|
className
|
|
7770
8019
|
);
|
|
7771
8020
|
if (asChild) {
|
|
7772
|
-
const child =
|
|
8021
|
+
const child = React39.Children.only(children);
|
|
7773
8022
|
return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: /* @__PURE__ */ jsx(
|
|
7774
8023
|
Slot,
|
|
7775
8024
|
__spreadProps(__spreadValues({
|
|
@@ -7786,7 +8035,7 @@ var IconButtonComponent = React37.forwardRef(
|
|
|
7786
8035
|
}),
|
|
7787
8036
|
className: containerClassName
|
|
7788
8037
|
}, restProps), {
|
|
7789
|
-
children:
|
|
8038
|
+
children: React39.cloneElement(child, { children: innerContent })
|
|
7790
8039
|
})
|
|
7791
8040
|
) });
|
|
7792
8041
|
}
|
|
@@ -7814,44 +8063,81 @@ var IconButtonComponent = React37.forwardRef(
|
|
|
7814
8063
|
}
|
|
7815
8064
|
);
|
|
7816
8065
|
IconButtonComponent.displayName = "IconButton";
|
|
7817
|
-
var IconButton =
|
|
8066
|
+
var IconButton = React39.memo(IconButtonComponent);
|
|
7818
8067
|
function TrailingAction({
|
|
7819
8068
|
query,
|
|
7820
8069
|
trailingIcon,
|
|
8070
|
+
avatar,
|
|
7821
8071
|
onClear
|
|
7822
8072
|
}) {
|
|
7823
|
-
|
|
7824
|
-
|
|
7825
|
-
|
|
8073
|
+
const shouldReduceMotion = useReducedMotion();
|
|
8074
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-center gap-2", children: [
|
|
8075
|
+
/* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", initial: false, children: query ? /* @__PURE__ */ jsx(
|
|
8076
|
+
m.div,
|
|
7826
8077
|
{
|
|
7827
|
-
|
|
7828
|
-
|
|
7829
|
-
|
|
7830
|
-
|
|
8078
|
+
initial: shouldReduceMotion ? false : { opacity: 0, scale: 0.8 },
|
|
8079
|
+
animate: { opacity: 1, scale: 1 },
|
|
8080
|
+
exit: shouldReduceMotion ? {} : { opacity: 0, scale: 0.8 },
|
|
8081
|
+
transition: { duration: 0.15 },
|
|
8082
|
+
className: "flex items-center justify-center",
|
|
7831
8083
|
children: /* @__PURE__ */ jsx(
|
|
7832
|
-
|
|
8084
|
+
IconButton,
|
|
7833
8085
|
{
|
|
7834
|
-
|
|
7835
|
-
style: {
|
|
7836
|
-
"aria-
|
|
7837
|
-
|
|
8086
|
+
size: "sm",
|
|
8087
|
+
style: { color: SEARCH_COLORS.trailingIcon },
|
|
8088
|
+
"aria-label": "Clear search",
|
|
8089
|
+
onClick: onClear,
|
|
8090
|
+
children: /* @__PURE__ */ jsx(
|
|
8091
|
+
"span",
|
|
8092
|
+
{
|
|
8093
|
+
className: "material-symbols-rounded select-none leading-none",
|
|
8094
|
+
style: { fontSize: 20 },
|
|
8095
|
+
"aria-hidden": "true",
|
|
8096
|
+
children: "close"
|
|
8097
|
+
}
|
|
8098
|
+
)
|
|
7838
8099
|
}
|
|
7839
8100
|
)
|
|
7840
|
-
}
|
|
7841
|
-
|
|
7842
|
-
|
|
7843
|
-
|
|
7844
|
-
return /* @__PURE__ */ jsx(
|
|
7845
|
-
"span",
|
|
8101
|
+
},
|
|
8102
|
+
"clear-action"
|
|
8103
|
+
) : trailingIcon && /* @__PURE__ */ jsx(
|
|
8104
|
+
m.span,
|
|
7846
8105
|
{
|
|
8106
|
+
initial: shouldReduceMotion ? false : { opacity: 0, scale: 0.8 },
|
|
8107
|
+
animate: { opacity: 1, scale: 1 },
|
|
8108
|
+
exit: shouldReduceMotion ? {} : { opacity: 0, scale: 0.8 },
|
|
8109
|
+
transition: { duration: 0.15 },
|
|
7847
8110
|
className: "flex shrink-0 items-center justify-center",
|
|
7848
8111
|
style: { color: SEARCH_COLORS.trailingIcon },
|
|
7849
8112
|
"aria-hidden": "true",
|
|
7850
8113
|
children: trailingIcon
|
|
8114
|
+
},
|
|
8115
|
+
"trailing-icon"
|
|
8116
|
+
) }),
|
|
8117
|
+
avatar && /* @__PURE__ */ jsx(
|
|
8118
|
+
"span",
|
|
8119
|
+
{
|
|
8120
|
+
className: "flex shrink-0 items-center justify-center rounded-full overflow-hidden",
|
|
8121
|
+
style: {
|
|
8122
|
+
width: SearchTokens.avatarSize,
|
|
8123
|
+
height: SearchTokens.avatarSize
|
|
8124
|
+
},
|
|
8125
|
+
"aria-hidden": "true",
|
|
8126
|
+
children: avatar
|
|
7851
8127
|
}
|
|
7852
|
-
)
|
|
7853
|
-
}
|
|
7854
|
-
|
|
8128
|
+
)
|
|
8129
|
+
] });
|
|
8130
|
+
}
|
|
8131
|
+
function DefaultSearchIcon2() {
|
|
8132
|
+
return /* @__PURE__ */ jsx(
|
|
8133
|
+
"span",
|
|
8134
|
+
{
|
|
8135
|
+
className: "material-symbols-rounded select-none leading-none",
|
|
8136
|
+
style: { fontSize: SearchTokens.iconSize },
|
|
8137
|
+
"aria-hidden": "true",
|
|
8138
|
+
children: "search"
|
|
8139
|
+
}
|
|
8140
|
+
);
|
|
7855
8141
|
}
|
|
7856
8142
|
function SearchViewDocked({
|
|
7857
8143
|
query,
|
|
@@ -7861,6 +8147,7 @@ function SearchViewDocked({
|
|
|
7861
8147
|
onActiveChange,
|
|
7862
8148
|
leadingIcon,
|
|
7863
8149
|
trailingIcon,
|
|
8150
|
+
avatar,
|
|
7864
8151
|
placeholder = "Search",
|
|
7865
8152
|
textAlign = "left",
|
|
7866
8153
|
styleType = "contained",
|
|
@@ -7874,7 +8161,7 @@ function SearchViewDocked({
|
|
|
7874
8161
|
activeIndex
|
|
7875
8162
|
}) {
|
|
7876
8163
|
const shouldReduceMotion = useReducedMotion();
|
|
7877
|
-
const inputRef =
|
|
8164
|
+
const inputRef = React39.useRef(null);
|
|
7878
8165
|
useSearchViewFocus(inputRef, active);
|
|
7879
8166
|
const dropdownRef = useClickOutside(() => {
|
|
7880
8167
|
onActiveChange(false);
|
|
@@ -7893,10 +8180,12 @@ function SearchViewDocked({
|
|
|
7893
8180
|
m.div,
|
|
7894
8181
|
{
|
|
7895
8182
|
ref: dropdownRef,
|
|
8183
|
+
layout: !shouldReduceMotion,
|
|
7896
8184
|
layoutId: shouldReduceMotion ? void 0 : searchId,
|
|
7897
8185
|
className: cn(
|
|
7898
8186
|
// DockedContainerShape = CornerExtraLarge = 28dp radius
|
|
7899
8187
|
"rounded-[28px] overflow-hidden",
|
|
8188
|
+
SEARCH_ELEVATION.level3,
|
|
7900
8189
|
viewClassName
|
|
7901
8190
|
),
|
|
7902
8191
|
style: { backgroundColor: SEARCH_COLORS.container },
|
|
@@ -7918,7 +8207,7 @@ function SearchViewDocked({
|
|
|
7918
8207
|
className: "flex shrink-0 items-center justify-center",
|
|
7919
8208
|
style: { color: SEARCH_COLORS.leadingIcon },
|
|
7920
8209
|
"aria-hidden": "true",
|
|
7921
|
-
children: leadingIcon
|
|
8210
|
+
children: leadingIcon != null ? leadingIcon : /* @__PURE__ */ jsx(DefaultSearchIcon2, {})
|
|
7922
8211
|
}
|
|
7923
8212
|
),
|
|
7924
8213
|
/* @__PURE__ */ jsx(
|
|
@@ -7959,6 +8248,7 @@ function SearchViewDocked({
|
|
|
7959
8248
|
{
|
|
7960
8249
|
query,
|
|
7961
8250
|
trailingIcon,
|
|
8251
|
+
avatar,
|
|
7962
8252
|
onClear: () => onQueryChange("")
|
|
7963
8253
|
}
|
|
7964
8254
|
)
|
|
@@ -7979,7 +8269,7 @@ function SearchViewDocked({
|
|
|
7979
8269
|
id: listboxId,
|
|
7980
8270
|
role: "listbox",
|
|
7981
8271
|
"aria-label": `${ariaLabel} results`,
|
|
7982
|
-
className: "min-h-
|
|
8272
|
+
className: "min-h-[120px]",
|
|
7983
8273
|
children
|
|
7984
8274
|
}
|
|
7985
8275
|
)
|
|
@@ -8008,6 +8298,7 @@ function SearchViewFullScreen({
|
|
|
8008
8298
|
onActiveChange,
|
|
8009
8299
|
leadingIcon,
|
|
8010
8300
|
trailingIcon,
|
|
8301
|
+
avatar,
|
|
8011
8302
|
placeholder = "Search",
|
|
8012
8303
|
textAlign = "left",
|
|
8013
8304
|
styleType = "contained",
|
|
@@ -8020,10 +8311,10 @@ function SearchViewFullScreen({
|
|
|
8020
8311
|
activeIndex
|
|
8021
8312
|
}) {
|
|
8022
8313
|
const shouldReduceMotion = useReducedMotion();
|
|
8023
|
-
const inputRef =
|
|
8314
|
+
const inputRef = React39.useRef(null);
|
|
8024
8315
|
useSearchViewFocus(inputRef, active);
|
|
8025
|
-
const [mounted, setMounted] =
|
|
8026
|
-
|
|
8316
|
+
const [mounted, setMounted] = React39.useState(false);
|
|
8317
|
+
React39.useEffect(() => {
|
|
8027
8318
|
setMounted(true);
|
|
8028
8319
|
}, []);
|
|
8029
8320
|
const handleFormSubmit = (e) => {
|
|
@@ -8122,6 +8413,7 @@ function SearchViewFullScreen({
|
|
|
8122
8413
|
{
|
|
8123
8414
|
query,
|
|
8124
8415
|
trailingIcon,
|
|
8416
|
+
avatar,
|
|
8125
8417
|
onClear: () => onQueryChange("")
|
|
8126
8418
|
}
|
|
8127
8419
|
)
|
|
@@ -8173,6 +8465,7 @@ function SearchComponent({
|
|
|
8173
8465
|
hasGap = false,
|
|
8174
8466
|
leadingIcon,
|
|
8175
8467
|
trailingIcon,
|
|
8468
|
+
avatar,
|
|
8176
8469
|
placeholder = "Search",
|
|
8177
8470
|
textAlign = "left",
|
|
8178
8471
|
children,
|
|
@@ -8181,10 +8474,10 @@ function SearchComponent({
|
|
|
8181
8474
|
className,
|
|
8182
8475
|
viewClassName
|
|
8183
8476
|
}) {
|
|
8184
|
-
const generatedId =
|
|
8477
|
+
const generatedId = React39.useId();
|
|
8185
8478
|
const searchId = id != null ? id : generatedId;
|
|
8186
8479
|
const listboxId = `${searchId}-listbox`;
|
|
8187
|
-
const itemCount =
|
|
8480
|
+
const itemCount = React39.Children.count(children);
|
|
8188
8481
|
const { activeIndex, handleKeyDown } = useSearchKeyboard({
|
|
8189
8482
|
active,
|
|
8190
8483
|
onActiveChange,
|
|
@@ -8200,6 +8493,7 @@ function SearchComponent({
|
|
|
8200
8493
|
onActiveChange,
|
|
8201
8494
|
leadingIcon,
|
|
8202
8495
|
trailingIcon,
|
|
8496
|
+
avatar,
|
|
8203
8497
|
placeholder,
|
|
8204
8498
|
textAlign,
|
|
8205
8499
|
"aria-label": ariaLabel,
|
|
@@ -8243,9 +8537,9 @@ function formatBadgeLabel(children, max) {
|
|
|
8243
8537
|
return "";
|
|
8244
8538
|
}
|
|
8245
8539
|
function detectBadgeHasContent(badge) {
|
|
8246
|
-
return
|
|
8540
|
+
return React39.isValidElement(badge) && badge.props.children != null;
|
|
8247
8541
|
}
|
|
8248
|
-
var BadgeImpl =
|
|
8542
|
+
var BadgeImpl = React39.forwardRef(
|
|
8249
8543
|
(_a, ref) => {
|
|
8250
8544
|
var _b = _a, {
|
|
8251
8545
|
children,
|
|
@@ -8282,7 +8576,7 @@ var BadgeImpl = React37.forwardRef(
|
|
|
8282
8576
|
exit: { scale: 0, opacity: 0 },
|
|
8283
8577
|
transition: springTransition,
|
|
8284
8578
|
className: cn(
|
|
8285
|
-
"rounded-full ring-[1.5px] ring-m3-surface",
|
|
8579
|
+
"rounded-full ring-[1.5px] ring-m3-surface shrink-0",
|
|
8286
8580
|
!containerColor && "bg-m3-error",
|
|
8287
8581
|
hasContent ? cn(
|
|
8288
8582
|
"inline-flex items-center justify-center",
|
|
@@ -8299,7 +8593,7 @@ var BadgeImpl = React37.forwardRef(
|
|
|
8299
8593
|
}
|
|
8300
8594
|
);
|
|
8301
8595
|
BadgeImpl.displayName = "Badge";
|
|
8302
|
-
|
|
8596
|
+
React39.memo(BadgeImpl);
|
|
8303
8597
|
function BadgedBox({
|
|
8304
8598
|
badge,
|
|
8305
8599
|
children,
|
|
@@ -8320,9 +8614,9 @@ function BadgedBox({
|
|
|
8320
8614
|
)
|
|
8321
8615
|
] });
|
|
8322
8616
|
}
|
|
8323
|
-
var TabsContext =
|
|
8617
|
+
var TabsContext = React39.createContext(null);
|
|
8324
8618
|
function useTabsContext() {
|
|
8325
|
-
const ctx =
|
|
8619
|
+
const ctx = React39.useContext(TabsContext);
|
|
8326
8620
|
if (!ctx) {
|
|
8327
8621
|
throw new Error(
|
|
8328
8622
|
"[MD3 Tabs] Component must be used within a <Tabs> root. Ensure <TabsList>, <Tab>, and <TabsContent> are descendants of <Tabs>."
|
|
@@ -8330,7 +8624,7 @@ function useTabsContext() {
|
|
|
8330
8624
|
}
|
|
8331
8625
|
return ctx;
|
|
8332
8626
|
}
|
|
8333
|
-
var TabsComponent =
|
|
8627
|
+
var TabsComponent = React39.forwardRef(
|
|
8334
8628
|
({
|
|
8335
8629
|
value: controlledValue,
|
|
8336
8630
|
defaultValue = "",
|
|
@@ -8339,35 +8633,35 @@ var TabsComponent = React37.forwardRef(
|
|
|
8339
8633
|
children,
|
|
8340
8634
|
className
|
|
8341
8635
|
}, ref) => {
|
|
8342
|
-
const [internalValue, setInternalValue] =
|
|
8636
|
+
const [internalValue, setInternalValue] = React39.useState(defaultValue);
|
|
8343
8637
|
const isControlled = controlledValue !== void 0;
|
|
8344
8638
|
const value = isControlled ? controlledValue : internalValue;
|
|
8345
|
-
const handleValueChange =
|
|
8639
|
+
const handleValueChange = React39.useCallback(
|
|
8346
8640
|
(newValue) => {
|
|
8347
8641
|
if (!isControlled) setInternalValue(newValue);
|
|
8348
8642
|
onValueChange == null ? void 0 : onValueChange(newValue);
|
|
8349
8643
|
},
|
|
8350
8644
|
[isControlled, onValueChange]
|
|
8351
8645
|
);
|
|
8352
|
-
const [focusedValue, setFocusedValue] =
|
|
8353
|
-
|
|
8646
|
+
const [focusedValue, setFocusedValue] = React39.useState(value);
|
|
8647
|
+
React39.useEffect(() => {
|
|
8354
8648
|
setFocusedValue(value);
|
|
8355
8649
|
}, [value]);
|
|
8356
|
-
const [tabValues, setTabValues] =
|
|
8357
|
-
const registerTab =
|
|
8650
|
+
const [tabValues, setTabValues] = React39.useState([]);
|
|
8651
|
+
const registerTab = React39.useCallback((tabValue) => {
|
|
8358
8652
|
setTabValues((prev) => {
|
|
8359
8653
|
if (prev.includes(tabValue)) return prev;
|
|
8360
8654
|
return [...prev, tabValue];
|
|
8361
8655
|
});
|
|
8362
8656
|
}, []);
|
|
8363
|
-
const unregisterTab =
|
|
8657
|
+
const unregisterTab = React39.useCallback((tabValue) => {
|
|
8364
8658
|
setTabValues((prev) => prev.filter((v) => v !== tabValue));
|
|
8365
8659
|
}, []);
|
|
8366
|
-
const hasAutoSelected =
|
|
8367
|
-
const [disabledValues, setDisabledValues] =
|
|
8660
|
+
const hasAutoSelected = React39.useRef(false);
|
|
8661
|
+
const [disabledValues, setDisabledValues] = React39.useState(
|
|
8368
8662
|
/* @__PURE__ */ new Set()
|
|
8369
8663
|
);
|
|
8370
|
-
const markTabDisabled =
|
|
8664
|
+
const markTabDisabled = React39.useCallback(
|
|
8371
8665
|
(tabValue, disabled) => {
|
|
8372
8666
|
setDisabledValues((prev) => {
|
|
8373
8667
|
const next = new Set(prev);
|
|
@@ -8381,7 +8675,7 @@ var TabsComponent = React37.forwardRef(
|
|
|
8381
8675
|
},
|
|
8382
8676
|
[]
|
|
8383
8677
|
);
|
|
8384
|
-
|
|
8678
|
+
React39.useEffect(() => {
|
|
8385
8679
|
if (isControlled || hasAutoSelected.current || tabValues.length === 0) {
|
|
8386
8680
|
return;
|
|
8387
8681
|
}
|
|
@@ -8396,9 +8690,9 @@ var TabsComponent = React37.forwardRef(
|
|
|
8396
8690
|
setFocusedValue(firstEnabled);
|
|
8397
8691
|
}
|
|
8398
8692
|
}, [tabValues, disabledValues, isControlled, value]);
|
|
8399
|
-
const id =
|
|
8693
|
+
const id = React39.useId();
|
|
8400
8694
|
const layoutGroupId = `tabs-${id}`;
|
|
8401
|
-
const contextValue =
|
|
8695
|
+
const contextValue = React39.useMemo(
|
|
8402
8696
|
() => ({
|
|
8403
8697
|
value,
|
|
8404
8698
|
onValueChange: handleValueChange,
|
|
@@ -8429,12 +8723,12 @@ var TabsComponent = React37.forwardRef(
|
|
|
8429
8723
|
}
|
|
8430
8724
|
);
|
|
8431
8725
|
TabsComponent.displayName = "Tabs";
|
|
8432
|
-
var Tabs =
|
|
8433
|
-
var TabsListContext =
|
|
8726
|
+
var Tabs = React39.memo(TabsComponent);
|
|
8727
|
+
var TabsListContext = React39.createContext(
|
|
8434
8728
|
null
|
|
8435
8729
|
);
|
|
8436
8730
|
function useTabsListContext() {
|
|
8437
|
-
const ctx =
|
|
8731
|
+
const ctx = React39.useContext(TabsListContext);
|
|
8438
8732
|
return ctx != null ? ctx : { variant: "primary", scrollable: false };
|
|
8439
8733
|
}
|
|
8440
8734
|
|
|
@@ -8518,7 +8812,7 @@ var TABS_CONTENT_TRANSITION = {
|
|
|
8518
8812
|
ease: "easeInOut"
|
|
8519
8813
|
};
|
|
8520
8814
|
var INDICATOR_MIN_WIDTH = 24;
|
|
8521
|
-
var TabComponent =
|
|
8815
|
+
var TabComponent = React39.forwardRef(
|
|
8522
8816
|
({
|
|
8523
8817
|
value,
|
|
8524
8818
|
icon,
|
|
@@ -8548,9 +8842,9 @@ var TabComponent = React37.forwardRef(
|
|
|
8548
8842
|
const isFocused = focusedValue === value;
|
|
8549
8843
|
const hasIcon = icon != null;
|
|
8550
8844
|
const isStackedIcon = hasIcon && !inlineIcon;
|
|
8551
|
-
const buttonRef =
|
|
8552
|
-
const isFirstMount =
|
|
8553
|
-
const mergedRef =
|
|
8845
|
+
const buttonRef = React39.useRef(null);
|
|
8846
|
+
const isFirstMount = React39.useRef(true);
|
|
8847
|
+
const mergedRef = React39.useCallback(
|
|
8554
8848
|
(node) => {
|
|
8555
8849
|
buttonRef.current = node;
|
|
8556
8850
|
if (typeof ref === "function") ref(node);
|
|
@@ -8558,15 +8852,15 @@ var TabComponent = React37.forwardRef(
|
|
|
8558
8852
|
},
|
|
8559
8853
|
[ref]
|
|
8560
8854
|
);
|
|
8561
|
-
|
|
8855
|
+
React39.useEffect(() => {
|
|
8562
8856
|
registerTab(value);
|
|
8563
8857
|
return () => unregisterTab(value);
|
|
8564
8858
|
}, [value, registerTab, unregisterTab]);
|
|
8565
|
-
|
|
8859
|
+
React39.useEffect(() => {
|
|
8566
8860
|
markTabDisabled(value, disabled);
|
|
8567
8861
|
return () => markTabDisabled(value, false);
|
|
8568
8862
|
}, [value, disabled, markTabDisabled]);
|
|
8569
|
-
const handleKeyDown =
|
|
8863
|
+
const handleKeyDown = React39.useCallback(
|
|
8570
8864
|
(e) => {
|
|
8571
8865
|
const isRtl = buttonRef.current ? getComputedStyle(buttonRef.current).direction === "rtl" : false;
|
|
8572
8866
|
const enabledValues = tabValues.filter((v) => !disabledValues.has(v));
|
|
@@ -8620,7 +8914,7 @@ var TabComponent = React37.forwardRef(
|
|
|
8620
8914
|
autoActivate
|
|
8621
8915
|
]
|
|
8622
8916
|
);
|
|
8623
|
-
|
|
8917
|
+
React39.useEffect(() => {
|
|
8624
8918
|
if (isFirstMount.current) {
|
|
8625
8919
|
isFirstMount.current = false;
|
|
8626
8920
|
return;
|
|
@@ -8629,7 +8923,7 @@ var TabComponent = React37.forwardRef(
|
|
|
8629
8923
|
buttonRef.current.focus({ preventScroll: true });
|
|
8630
8924
|
}
|
|
8631
8925
|
}, [isFocused]);
|
|
8632
|
-
|
|
8926
|
+
React39.useEffect(() => {
|
|
8633
8927
|
if (!isActive || !scrollable || !buttonRef.current) return;
|
|
8634
8928
|
const btn = buttonRef.current;
|
|
8635
8929
|
let container = btn.parentElement;
|
|
@@ -8766,8 +9060,8 @@ var TabComponent = React37.forwardRef(
|
|
|
8766
9060
|
}
|
|
8767
9061
|
);
|
|
8768
9062
|
TabComponent.displayName = "Tab";
|
|
8769
|
-
var Tab =
|
|
8770
|
-
var TabsContentComponent =
|
|
9063
|
+
var Tab = React39.memo(TabComponent);
|
|
9064
|
+
var TabsContentComponent = React39.forwardRef(
|
|
8771
9065
|
({ value, className, children }, ref) => {
|
|
8772
9066
|
var _a;
|
|
8773
9067
|
const { value: selectedValue, layoutGroupId } = useTabsContext();
|
|
@@ -8801,8 +9095,8 @@ var TabsContentComponent = React37.forwardRef(
|
|
|
8801
9095
|
}
|
|
8802
9096
|
);
|
|
8803
9097
|
TabsContentComponent.displayName = "TabsContent";
|
|
8804
|
-
var TabsContent =
|
|
8805
|
-
var TabsListComponent =
|
|
9098
|
+
var TabsContent = React39.memo(TabsContentComponent);
|
|
9099
|
+
var TabsListComponent = React39.forwardRef(
|
|
8806
9100
|
({
|
|
8807
9101
|
variant,
|
|
8808
9102
|
scrollable = false,
|
|
@@ -8813,12 +9107,12 @@ var TabsListComponent = React37.forwardRef(
|
|
|
8813
9107
|
}, ref) => {
|
|
8814
9108
|
const { layoutGroupId, value, setFocusedValue } = useTabsContext();
|
|
8815
9109
|
const listLayoutId = `${layoutGroupId}-list`;
|
|
8816
|
-
const listContextValue =
|
|
9110
|
+
const listContextValue = React39.useMemo(
|
|
8817
9111
|
() => ({ variant, scrollable }),
|
|
8818
9112
|
[variant, scrollable]
|
|
8819
9113
|
);
|
|
8820
9114
|
const bgColor = backgroundColor != null ? backgroundColor : "var(--md-sys-color-surface)";
|
|
8821
|
-
const handleBlur =
|
|
9115
|
+
const handleBlur = React39.useCallback(
|
|
8822
9116
|
(e) => {
|
|
8823
9117
|
const listEl = e.currentTarget;
|
|
8824
9118
|
if (listEl.contains(e.relatedTarget)) return;
|
|
@@ -8867,7 +9161,7 @@ var TabsListComponent = React37.forwardRef(
|
|
|
8867
9161
|
}
|
|
8868
9162
|
);
|
|
8869
9163
|
TabsListComponent.displayName = "TabsList";
|
|
8870
|
-
var TabsList =
|
|
9164
|
+
var TabsList = React39.memo(TabsListComponent);
|
|
8871
9165
|
|
|
8872
9166
|
// src/ui/toolbar/toolbar-colors.ts
|
|
8873
9167
|
var standardFloatingToolbarColors = {
|
|
@@ -8923,13 +9217,13 @@ function getToolbarColors(variant = "standard", customColors) {
|
|
|
8923
9217
|
return standardFloatingToolbarColors;
|
|
8924
9218
|
}
|
|
8925
9219
|
}
|
|
8926
|
-
var ToolbarContext =
|
|
9220
|
+
var ToolbarContext = React39.createContext(
|
|
8927
9221
|
null
|
|
8928
9222
|
);
|
|
8929
9223
|
function useToolbarContext() {
|
|
8930
|
-
return
|
|
9224
|
+
return React39.useContext(ToolbarContext);
|
|
8931
9225
|
}
|
|
8932
|
-
var BottomDockedToolbar =
|
|
9226
|
+
var BottomDockedToolbar = React39.forwardRef(
|
|
8933
9227
|
(_a, ref) => {
|
|
8934
9228
|
var _b = _a, {
|
|
8935
9229
|
variant = "standard",
|
|
@@ -8962,8 +9256,8 @@ var BottomDockedToolbar = React37.forwardRef(
|
|
|
8962
9256
|
const { scrollY } = useScroll(
|
|
8963
9257
|
scrollContainerRef ? { container: scrollContainerRef } : void 0
|
|
8964
9258
|
);
|
|
8965
|
-
const [isHidden, setIsHidden] =
|
|
8966
|
-
const lastScrollY =
|
|
9259
|
+
const [isHidden, setIsHidden] = React39.useState(false);
|
|
9260
|
+
const lastScrollY = React39.useRef(0);
|
|
8967
9261
|
useMotionValueEvent(scrollY, "change", (latest) => {
|
|
8968
9262
|
if (!hideOnScroll) return;
|
|
8969
9263
|
const diff = latest - lastScrollY.current;
|
|
@@ -9122,15 +9416,15 @@ function buildSlotVariants(xHidden, yHidden, isHorizontal) {
|
|
|
9122
9416
|
};
|
|
9123
9417
|
}
|
|
9124
9418
|
function applyItemClassName(nodes, itemClassName) {
|
|
9125
|
-
return
|
|
9126
|
-
if (!
|
|
9419
|
+
return React39.Children.map(nodes, (child) => {
|
|
9420
|
+
if (!React39.isValidElement(child)) return child;
|
|
9127
9421
|
const element = child;
|
|
9128
|
-
return
|
|
9422
|
+
return React39.cloneElement(element, {
|
|
9129
9423
|
className: cn(element.props.className, itemClassName)
|
|
9130
9424
|
});
|
|
9131
9425
|
});
|
|
9132
9426
|
}
|
|
9133
|
-
var FloatingToolbarBase =
|
|
9427
|
+
var FloatingToolbarBase = React39.forwardRef(
|
|
9134
9428
|
(_a, ref) => {
|
|
9135
9429
|
var _b = _a, {
|
|
9136
9430
|
expanded,
|
|
@@ -9302,11 +9596,11 @@ var FloatingToolbarBase = React37.forwardRef(
|
|
|
9302
9596
|
}
|
|
9303
9597
|
);
|
|
9304
9598
|
FloatingToolbarBase.displayName = "FloatingToolbarBase";
|
|
9305
|
-
var HorizontalFloatingToolbar =
|
|
9599
|
+
var HorizontalFloatingToolbar = React39.forwardRef((props, ref) => /* @__PURE__ */ jsx(FloatingToolbarBase, __spreadValues({ ref, orientation: "horizontal" }, props)));
|
|
9306
9600
|
HorizontalFloatingToolbar.displayName = "HorizontalFloatingToolbar";
|
|
9307
|
-
var VerticalFloatingToolbar =
|
|
9601
|
+
var VerticalFloatingToolbar = React39.forwardRef((props, ref) => /* @__PURE__ */ jsx(FloatingToolbarBase, __spreadValues({ ref, orientation: "vertical" }, props)));
|
|
9308
9602
|
VerticalFloatingToolbar.displayName = "VerticalFloatingToolbar";
|
|
9309
|
-
var FloatingToolbarWithFabBase =
|
|
9603
|
+
var FloatingToolbarWithFabBase = React39.forwardRef(
|
|
9310
9604
|
(_a, ref) => {
|
|
9311
9605
|
var _b = _a, {
|
|
9312
9606
|
expanded,
|
|
@@ -9434,9 +9728,9 @@ var FloatingToolbarWithFabBase = React37.forwardRef(
|
|
|
9434
9728
|
}
|
|
9435
9729
|
);
|
|
9436
9730
|
FloatingToolbarWithFabBase.displayName = "FloatingToolbarWithFabBase";
|
|
9437
|
-
var HorizontalFloatingToolbarWithFab =
|
|
9731
|
+
var HorizontalFloatingToolbarWithFab = React39.forwardRef((props, ref) => /* @__PURE__ */ jsx(FloatingToolbarWithFabBase, __spreadValues({ ref, orientation: "horizontal" }, props)));
|
|
9438
9732
|
HorizontalFloatingToolbarWithFab.displayName = "HorizontalFloatingToolbarWithFab";
|
|
9439
|
-
var VerticalFloatingToolbarWithFab =
|
|
9733
|
+
var VerticalFloatingToolbarWithFab = React39.forwardRef((props, ref) => /* @__PURE__ */ jsx(FloatingToolbarWithFabBase, __spreadValues({ ref, orientation: "vertical" }, props)));
|
|
9440
9734
|
VerticalFloatingToolbarWithFab.displayName = "VerticalFloatingToolbarWithFab";
|
|
9441
9735
|
var ToolbarDivider = ({
|
|
9442
9736
|
orientation: propsOrientation,
|
|
@@ -9472,7 +9766,7 @@ var VARIANT_TO_COLOR_STYLE = {
|
|
|
9472
9766
|
tonal: "tonal",
|
|
9473
9767
|
filled: "filled"
|
|
9474
9768
|
};
|
|
9475
|
-
var ToolbarIconButton =
|
|
9769
|
+
var ToolbarIconButton = React39.forwardRef(
|
|
9476
9770
|
(_a, ref) => {
|
|
9477
9771
|
var _b = _a, {
|
|
9478
9772
|
emphasis = "standard",
|
|
@@ -9644,7 +9938,7 @@ var MOTION_PROP_KEYS = [
|
|
|
9644
9938
|
"layoutId",
|
|
9645
9939
|
"onLayoutAnimationComplete"
|
|
9646
9940
|
];
|
|
9647
|
-
var ToolbarToggleButton =
|
|
9941
|
+
var ToolbarToggleButton = React39.forwardRef(
|
|
9648
9942
|
(_a, ref) => {
|
|
9649
9943
|
var _b = _a, {
|
|
9650
9944
|
emphasis = "standard",
|
|
@@ -9678,7 +9972,7 @@ var ToolbarToggleButton = React37.forwardRef(
|
|
|
9678
9972
|
"onPointerLeave"
|
|
9679
9973
|
]);
|
|
9680
9974
|
const context = useToolbarContext();
|
|
9681
|
-
const [isPressed, setIsPressed] =
|
|
9975
|
+
const [isPressed, setIsPressed] = React39.useState(false);
|
|
9682
9976
|
const {
|
|
9683
9977
|
ripples,
|
|
9684
9978
|
onPointerDown: handleRipplePointerDown,
|
|
@@ -9686,7 +9980,7 @@ var ToolbarToggleButton = React37.forwardRef(
|
|
|
9686
9980
|
} = useRippleState({
|
|
9687
9981
|
disabled: Boolean(disabled) || !ripple
|
|
9688
9982
|
});
|
|
9689
|
-
const handlePointerDown =
|
|
9983
|
+
const handlePointerDown = React39.useCallback(
|
|
9690
9984
|
(e) => {
|
|
9691
9985
|
setIsPressed(true);
|
|
9692
9986
|
if (!disabled && ripple) {
|
|
@@ -9696,14 +9990,14 @@ var ToolbarToggleButton = React37.forwardRef(
|
|
|
9696
9990
|
},
|
|
9697
9991
|
[disabled, ripple, handleRipplePointerDown, onPointerDownProp]
|
|
9698
9992
|
);
|
|
9699
|
-
const handlePointerUp =
|
|
9993
|
+
const handlePointerUp = React39.useCallback(
|
|
9700
9994
|
(e) => {
|
|
9701
9995
|
setIsPressed(false);
|
|
9702
9996
|
onPointerUpProp == null ? void 0 : onPointerUpProp(e);
|
|
9703
9997
|
},
|
|
9704
9998
|
[onPointerUpProp]
|
|
9705
9999
|
);
|
|
9706
|
-
const handlePointerLeave =
|
|
10000
|
+
const handlePointerLeave = React39.useCallback(
|
|
9707
10001
|
(e) => {
|
|
9708
10002
|
setIsPressed(false);
|
|
9709
10003
|
onPointerLeaveProp == null ? void 0 : onPointerLeaveProp(e);
|
|
@@ -9722,14 +10016,14 @@ var ToolbarToggleButton = React37.forwardRef(
|
|
|
9722
10016
|
context == null ? void 0 : context.itemClassName,
|
|
9723
10017
|
className
|
|
9724
10018
|
);
|
|
9725
|
-
const animateConfig =
|
|
10019
|
+
const animateConfig = React39.useMemo(
|
|
9726
10020
|
() => ({
|
|
9727
10021
|
scaleX: pressExpand && isPressed ? 1 + pressExpandRatio : 1,
|
|
9728
10022
|
borderRadius: isPressed ? ToolbarToggleButtonRadiusTokens.pressedRadius : ToolbarToggleButtonRadiusTokens.pillRadius
|
|
9729
10023
|
}),
|
|
9730
10024
|
[pressExpand, pressExpandRatio, isPressed]
|
|
9731
10025
|
);
|
|
9732
|
-
const transitionConfig =
|
|
10026
|
+
const transitionConfig = React39.useMemo(
|
|
9733
10027
|
() => ({
|
|
9734
10028
|
scaleX: FAST_SPATIAL_SPRING,
|
|
9735
10029
|
borderRadius: BUTTON_RADIUS_SPRING
|
|
@@ -9751,7 +10045,7 @@ var ToolbarToggleButton = React37.forwardRef(
|
|
|
9751
10045
|
children && (typeof children === "string" || typeof children === "number" ? /* @__PURE__ */ jsx("span", { children }) : children)
|
|
9752
10046
|
] });
|
|
9753
10047
|
if (asChild) {
|
|
9754
|
-
const child =
|
|
10048
|
+
const child = React39.Children.only(children);
|
|
9755
10049
|
const childContent = child.props.children;
|
|
9756
10050
|
const innerChildContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9757
10051
|
ripple && /* @__PURE__ */ jsx(
|
|
@@ -9790,7 +10084,7 @@ var ToolbarToggleButton = React37.forwardRef(
|
|
|
9790
10084
|
onPointerUp: handlePointerUp,
|
|
9791
10085
|
onPointerLeave: handlePointerLeave
|
|
9792
10086
|
}, strippedProps), {
|
|
9793
|
-
children:
|
|
10087
|
+
children: React39.cloneElement(child, { children: innerChildContent })
|
|
9794
10088
|
})
|
|
9795
10089
|
) });
|
|
9796
10090
|
}
|
|
@@ -9827,6 +10121,6 @@ var ToolbarToggleButton = React37.forwardRef(
|
|
|
9827
10121
|
);
|
|
9828
10122
|
ToolbarToggleButton.displayName = "ToolbarToggleButton";
|
|
9829
10123
|
|
|
9830
|
-
export { APP_BAR_BOTTOM_SPRING, APP_BAR_COLORS, APP_BAR_COLOR_TRANSITION, APP_BAR_ENTER_ALWAYS_SPRING, APP_BAR_TITLE_FADE, AppBarColumn, AppBarOverflowIndicator, AppBarRow, AppBarTokens, BottomAppBar, BottomDockedToolbar, CHECK_ICON_VARIANTS, ContextMenu, ContextMenuContent, ContextMenuTrigger, DIVIDER_COLOR, DIVIDER_PADDING, DockedToolbar, FAST_EFFECTS_TRANSITION, FAST_SPATIAL_SPRING, FadingBlurMask, GROUP_SHAPES, HorizontalFloatingToolbar, HorizontalFloatingToolbarWithFab, ITEM_SHAPE_CLASSES, LargeFlexibleAppBar, MENU_CHECK_ICON_SIZE, MENU_CONTAINER_VARIANTS, MENU_GROUP_GAP, MENU_ICON_SIZE, MENU_ITEM_MIN_HEIGHT, MENU_MAX_WIDTH, MENU_MIN_WIDTH, MediumFlexibleAppBar, Menu, MenuContent, MenuDivider, MenuGroup, MenuItem, MenuProvider, MenuTrigger, NavigationBar, NavigationBarComponent, NavigationBarItem, NavigationRail, NavigationRailItem, SEARCH_BAR_EXIT_SPRING, SEARCH_BAR_EXPAND_SPRING, SEARCH_COLORS, SEARCH_DOCKED_REVEAL_SPRING, SEARCH_FULLSCREEN_SPRING, SEARCH_TYPOGRAPHY, SEARCH_VIEW_SPRING, STANDARD_COLORS, SUBMENU_CONTAINER_VARIANTS, Search, SearchAppBar, SearchBar, SearchTokens, SearchView, SearchViewContainer, SearchViewDocked, SearchViewFullScreen, SmallAppBar, SubMenu, Tab, Tabs, TabsColors, TabsContent, TabsList, TabsTokens, ToolbarDivider, ToolbarDividerTokens, ToolbarIconButton, ToolbarIconButtonTokens, ToolbarToggleButton, ToolbarToggleButtonTokens, VIBRANT_COLORS, VerticalFloatingToolbar, VerticalFloatingToolbarWithFab, VerticalMenu, VerticalMenuContent, VerticalMenuDivider, VerticalMenuGroup, appBarTypography, getNavigationShapeStyle, getToolbarColors, isSquareShape, standardFloatingToolbarColors, surfaceContainerHighFloatingToolbarColors, surfaceContainerHighestFloatingToolbarColors, tertiaryContainerFloatingToolbarColors, useAppBarScroll, useFloatingToolbarScrollBehavior, useMenuContext, useSearch, useSearchKeyboard, vibrantFloatingToolbarColors, xrFloatingToolbarColors };
|
|
10124
|
+
export { APP_BAR_BOTTOM_SPRING, APP_BAR_COLORS, APP_BAR_COLOR_TRANSITION, APP_BAR_ENTER_ALWAYS_SPRING, APP_BAR_TITLE_FADE, AppBarColumn, AppBarOverflowIndicator, AppBarRow, AppBarTokens, BottomAppBar, BottomDockedToolbar, CHECK_ICON_VARIANTS, ContextMenu, ContextMenuContent, ContextMenuTrigger, DIVIDER_COLOR, DIVIDER_PADDING, DockedToolbar, FAST_EFFECTS_TRANSITION, FAST_SPATIAL_SPRING, FadingBlurMask, GROUP_SHAPES, HorizontalFloatingToolbar, HorizontalFloatingToolbarWithFab, ITEM_SHAPE_CLASSES, LargeFlexibleAppBar, MENU_CHECK_ICON_SIZE, MENU_CONTAINER_VARIANTS, MENU_GROUP_GAP, MENU_ICON_SIZE, MENU_ITEM_MIN_HEIGHT, MENU_MAX_WIDTH, MENU_MIN_WIDTH, MediumFlexibleAppBar, Menu, MenuContent, MenuDivider, MenuGroup, MenuItem, MenuProvider, MenuTrigger, NavigationBar, NavigationBarComponent, NavigationBarItem, NavigationRail, NavigationRailItem, SEARCH_BAR_EXIT_SPRING, SEARCH_BAR_EXPAND_SPRING, SEARCH_COLORS, SEARCH_DOCKED_REVEAL_SPRING, SEARCH_ELEVATION, SEARCH_FULLSCREEN_SPRING, SEARCH_TYPOGRAPHY, SEARCH_VIEW_SPRING, STANDARD_COLORS, SUBMENU_CONTAINER_VARIANTS, Search, SearchAppBar, SearchBar, SearchTokens, SearchView, SearchViewContainer, SearchViewDocked, SearchViewFullScreen, SmallAppBar, SubMenu, Tab, Tabs, TabsColors, TabsContent, TabsList, TabsTokens, ToolbarDivider, ToolbarDividerTokens, ToolbarIconButton, ToolbarIconButtonTokens, ToolbarToggleButton, ToolbarToggleButtonTokens, VIBRANT_COLORS, VerticalFloatingToolbar, VerticalFloatingToolbarWithFab, VerticalMenu, VerticalMenuContent, VerticalMenuDivider, VerticalMenuGroup, appBarTypography, getNavigationShapeStyle, getToolbarColors, isSquareShape, standardFloatingToolbarColors, surfaceContainerHighFloatingToolbarColors, surfaceContainerHighestFloatingToolbarColors, tertiaryContainerFloatingToolbarColors, useAppBarScroll, useFloatingToolbarScrollBehavior, useMenuContext, useSearch, useSearchKeyboard, vibrantFloatingToolbarColors, xrFloatingToolbarColors };
|
|
9831
10125
|
//# sourceMappingURL=navigation.mjs.map
|
|
9832
10126
|
//# sourceMappingURL=navigation.mjs.map
|