@bug-on/m3-expressive 1.2.4 → 1.2.6
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 +128 -41
- package/dist/buttons.d.mts +1 -1
- package/dist/buttons.d.ts +1 -1
- package/dist/buttons.js +59 -45
- package/dist/buttons.js.map +1 -1
- package/dist/buttons.mjs +59 -45
- package/dist/buttons.mjs.map +1 -1
- package/dist/core.js +54 -40
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +54 -40
- package/dist/core.mjs.map +1 -1
- package/dist/feedback.js +53 -39
- package/dist/feedback.js.map +1 -1
- package/dist/feedback.mjs +53 -39
- package/dist/feedback.mjs.map +1 -1
- package/dist/forms.d.mts +2 -2
- package/dist/forms.d.ts +2 -2
- package/dist/index.d.mts +77 -6
- package/dist/index.d.ts +77 -6
- package/dist/index.js +5607 -5429
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5506 -5329
- package/dist/index.mjs.map +1 -1
- package/dist/layout.js +60 -46
- package/dist/layout.js.map +1 -1
- package/dist/layout.mjs +60 -46
- package/dist/layout.mjs.map +1 -1
- package/dist/navigation.d.mts +27 -7
- package/dist/navigation.d.ts +27 -7
- package/dist/navigation.js +481 -474
- package/dist/navigation.js.map +1 -1
- package/dist/navigation.mjs +473 -466
- package/dist/navigation.mjs.map +1 -1
- package/dist/overlays.d.mts +2 -2
- package/dist/overlays.d.ts +2 -2
- package/dist/overlays.js +53 -39
- package/dist/overlays.js.map +1 -1
- package/dist/overlays.mjs +53 -39
- package/dist/overlays.mjs.map +1 -1
- package/dist/pickers.js +53 -39
- package/dist/pickers.js.map +1 -1
- package/dist/pickers.mjs +53 -39
- package/dist/pickers.mjs.map +1 -1
- package/dist/{side-sheet-modal-Bd5Qqvp9.d.ts → side-sheet-modal-DdEZR6Vl.d.ts} +1 -1
- package/dist/{side-sheet-modal-64FGhDxL.d.mts → side-sheet-modal-Dgjt739k.d.mts} +1 -1
- package/dist/{split-button-trailing-uncheckable-DtxrcLxH.d.ts → split-button-trailing-uncheckable--BhNTEJw.d.ts} +5 -5
- package/dist/{split-button-trailing-uncheckable-BTWfIN2k.d.mts → split-button-trailing-uncheckable-DPJL3bO6.d.mts} +5 -5
- package/dist/{text-field-T4Rg-9Bw.d.mts → text-field-DWC7qOvp.d.mts} +128 -128
- package/dist/{text-field-T4Rg-9Bw.d.ts → text-field-DWC7qOvp.d.ts} +128 -128
- package/package.json +3 -3
package/dist/navigation.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import * as
|
|
2
|
+
import * as React37 from 'react';
|
|
3
3
|
import { useRef, useEffect, useState } from 'react';
|
|
4
4
|
import { clsx } from 'clsx';
|
|
5
5
|
import { twMerge } from 'tailwind-merge';
|
|
@@ -305,9 +305,10 @@ var SUBMENU_CONTAINER_VARIANTS = {
|
|
|
305
305
|
transition: FAST_EFFECTS_TRANSITION
|
|
306
306
|
}
|
|
307
307
|
};
|
|
308
|
-
var MenuContext =
|
|
308
|
+
var MenuContext = React37.createContext({
|
|
309
309
|
variant: "baseline",
|
|
310
310
|
colorVariant: "standard",
|
|
311
|
+
density: 0,
|
|
311
312
|
menuPrimitive: "dropdown",
|
|
312
313
|
open: false,
|
|
313
314
|
onOpenChange: () => {
|
|
@@ -316,29 +317,46 @@ var MenuContext = React36.createContext({
|
|
|
316
317
|
function MenuProvider({
|
|
317
318
|
variant = "baseline",
|
|
318
319
|
colorVariant = "standard",
|
|
320
|
+
density = 0,
|
|
319
321
|
menuPrimitive = "dropdown",
|
|
320
322
|
open,
|
|
321
323
|
onOpenChange,
|
|
322
324
|
children
|
|
323
325
|
}) {
|
|
324
|
-
const value =
|
|
325
|
-
() => ({
|
|
326
|
-
|
|
326
|
+
const value = React37.useMemo(
|
|
327
|
+
() => ({
|
|
328
|
+
variant,
|
|
329
|
+
colorVariant,
|
|
330
|
+
density,
|
|
331
|
+
menuPrimitive,
|
|
332
|
+
open,
|
|
333
|
+
onOpenChange
|
|
334
|
+
}),
|
|
335
|
+
[variant, colorVariant, density, menuPrimitive, open, onOpenChange]
|
|
327
336
|
);
|
|
328
337
|
return /* @__PURE__ */ jsx(MenuContext.Provider, { value, children });
|
|
329
338
|
}
|
|
330
339
|
function useMenuContext() {
|
|
331
|
-
const ctx =
|
|
332
|
-
return
|
|
333
|
-
() =>
|
|
334
|
-
isStatic
|
|
335
|
-
|
|
340
|
+
const ctx = React37.useContext(MenuContext);
|
|
341
|
+
return React37.useMemo(
|
|
342
|
+
() => Object.assign(ctx, {
|
|
343
|
+
get isStatic() {
|
|
344
|
+
return ctx.menuPrimitive === "static";
|
|
345
|
+
},
|
|
346
|
+
get menuVariant() {
|
|
347
|
+
return ctx.variant;
|
|
348
|
+
}
|
|
336
349
|
}),
|
|
337
350
|
[ctx]
|
|
338
351
|
);
|
|
339
352
|
}
|
|
340
353
|
var MENU_BASELINE_ITEM_HORIZONTAL_PADDING = "px-3";
|
|
341
354
|
var MENU_ITEM_MIN_HEIGHT = "min-h-11";
|
|
355
|
+
var DENSITY_MIN_HEIGHT = {
|
|
356
|
+
0: "min-h-12",
|
|
357
|
+
"-2": "min-h-10",
|
|
358
|
+
"-4": "min-h-8"
|
|
359
|
+
};
|
|
342
360
|
var MENU_MIN_WIDTH = "min-w-28";
|
|
343
361
|
var MENU_MAX_WIDTH = "max-w-70";
|
|
344
362
|
var MENU_GROUP_GAP = "gap-0.5";
|
|
@@ -371,7 +389,7 @@ var ITEM_SHAPE_CLASSES = {
|
|
|
371
389
|
leading: "rounded-t-[12px] rounded-b-[4px]",
|
|
372
390
|
middle: "rounded-[4px]",
|
|
373
391
|
trailing: "rounded-t-[4px] rounded-b-[12px]",
|
|
374
|
-
standalone: "rounded-[
|
|
392
|
+
standalone: "rounded-[12px]",
|
|
375
393
|
selected: "rounded-[12px]"
|
|
376
394
|
};
|
|
377
395
|
var STANDARD_COLORS = {
|
|
@@ -388,9 +406,9 @@ var STANDARD_COLORS = {
|
|
|
388
406
|
/** Trailing icon color (StandardMenuTokens.ItemTrailingIconColor) */
|
|
389
407
|
trailingIconColor: "text-m3-on-surface-variant",
|
|
390
408
|
/** Hover state layer (OnSurface @ 8% opacity) */
|
|
391
|
-
hoverLayer: "hover:bg-m3-on-surface/8",
|
|
409
|
+
hoverLayer: "hover:bg-m3-on-surface/8 data-[highlighted]:bg-m3-on-surface/8",
|
|
392
410
|
/** Focus state layer (OnSurface @ 12% opacity) */
|
|
393
|
-
focusLayer: "focus:bg-m3-on-surface/12",
|
|
411
|
+
focusLayer: "focus:bg-m3-on-surface/12 data-[highlighted]:bg-m3-on-surface/8",
|
|
394
412
|
/** Selected item background (StandardMenuTokens.ItemSelectedContainerColor) */
|
|
395
413
|
selectedBg: "bg-m3-tertiary-container",
|
|
396
414
|
/** Selected item text (StandardMenuTokens.ItemSelectedLabelTextColor) */
|
|
@@ -406,8 +424,8 @@ var BASELINE_COLORS = {
|
|
|
406
424
|
iconColor: "text-m3-on-surface-variant",
|
|
407
425
|
supportingTextColor: "text-m3-on-surface-variant",
|
|
408
426
|
trailingIconColor: "text-m3-on-surface-variant",
|
|
409
|
-
hoverLayer: "hover:bg-m3-on-surface/8",
|
|
410
|
-
focusLayer: "focus:bg-m3-on-surface/12",
|
|
427
|
+
hoverLayer: "hover:bg-m3-on-surface/8 data-[highlighted]:bg-m3-on-surface/8",
|
|
428
|
+
focusLayer: "focus:bg-m3-on-surface/12 data-[highlighted]:bg-m3-on-surface/8",
|
|
411
429
|
selectedBg: "bg-m3-secondary-container",
|
|
412
430
|
selectedText: "text-m3-on-secondary-container",
|
|
413
431
|
selectedIcon: "text-m3-on-secondary-container"};
|
|
@@ -425,9 +443,9 @@ var VIBRANT_COLORS = {
|
|
|
425
443
|
/** Trailing icon color (VibrantMenuTokens.ItemTrailingIconColor) */
|
|
426
444
|
trailingIconColor: "text-m3-on-tertiary-container",
|
|
427
445
|
/** Hover state layer (OnTertiaryContainer @ 8% opacity) */
|
|
428
|
-
hoverLayer: "hover:bg-m3-on-tertiary-container/8",
|
|
446
|
+
hoverLayer: "hover:bg-m3-on-tertiary-container/8 data-[highlighted]:bg-m3-on-tertiary-container/8",
|
|
429
447
|
/** Focus state layer (OnTertiaryContainer @ 12% opacity) */
|
|
430
|
-
focusLayer: "focus:bg-m3-on-tertiary-container/12",
|
|
448
|
+
focusLayer: "focus:bg-m3-on-tertiary-container/12 data-[highlighted]:bg-m3-on-tertiary-container/8",
|
|
431
449
|
/** Selected item background (VibrantMenuTokens.ItemSelectedContainerColor = Tertiary) */
|
|
432
450
|
selectedBg: "bg-m3-tertiary",
|
|
433
451
|
/** Selected item text (VibrantMenuTokens.ItemSelectedLabelTextColor = OnTertiary) */
|
|
@@ -439,12 +457,29 @@ var VIBRANT_COLORS = {
|
|
|
439
457
|
};
|
|
440
458
|
var DIVIDER_PADDING = "mx-3 my-0.5";
|
|
441
459
|
var DIVIDER_COLOR = "bg-m3-outline-variant";
|
|
460
|
+
function flattenChildren(nodes) {
|
|
461
|
+
return React37.Children.toArray(nodes).reduce(
|
|
462
|
+
(acc, child) => {
|
|
463
|
+
if (!React37.isValidElement(child)) return acc;
|
|
464
|
+
if (child.type === React37.Fragment) {
|
|
465
|
+
return acc.concat(
|
|
466
|
+
flattenChildren(
|
|
467
|
+
child.props.children
|
|
468
|
+
)
|
|
469
|
+
);
|
|
470
|
+
}
|
|
471
|
+
acc.push(child);
|
|
472
|
+
return acc;
|
|
473
|
+
},
|
|
474
|
+
[]
|
|
475
|
+
);
|
|
476
|
+
}
|
|
442
477
|
function ContextMenu({
|
|
443
478
|
children,
|
|
444
479
|
variant = "baseline",
|
|
445
480
|
colorVariant = "standard"
|
|
446
481
|
}) {
|
|
447
|
-
const [open, setOpen] =
|
|
482
|
+
const [open, setOpen] = React37.useState(false);
|
|
448
483
|
return /* @__PURE__ */ jsx(
|
|
449
484
|
MenuProvider,
|
|
450
485
|
{
|
|
@@ -458,12 +493,12 @@ function ContextMenu({
|
|
|
458
493
|
);
|
|
459
494
|
}
|
|
460
495
|
ContextMenu.displayName = "ContextMenu";
|
|
461
|
-
var ContextMenuTrigger =
|
|
496
|
+
var ContextMenuTrigger = React37.forwardRef((_a, ref) => {
|
|
462
497
|
var _b = _a, { children, asChild = true } = _b, props = __objRest(_b, ["children", "asChild"]);
|
|
463
498
|
return /* @__PURE__ */ jsx(RxContextMenu.Trigger, __spreadProps(__spreadValues({ ref, asChild }, props), { children }));
|
|
464
499
|
});
|
|
465
500
|
ContextMenuTrigger.displayName = "ContextMenuTrigger";
|
|
466
|
-
var ContextMenuContent =
|
|
501
|
+
var ContextMenuContent = React37.forwardRef(
|
|
467
502
|
(_a, ref) => {
|
|
468
503
|
var _b = _a, {
|
|
469
504
|
children,
|
|
@@ -486,71 +521,51 @@ var ContextMenuContent = React36.forwardRef(
|
|
|
486
521
|
const colorVariant = propColorVariant != null ? propColorVariant : contextColorVariant;
|
|
487
522
|
const colors = variant === "baseline" ? BASELINE_COLORS : colorVariant === "vibrant" ? VIBRANT_COLORS : STANDARD_COLORS;
|
|
488
523
|
const isExpressiveGap = variant === "expressive" && separatorStyle === "gap";
|
|
489
|
-
const containerClassName =
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
524
|
+
const containerClassName = React37.useMemo(
|
|
525
|
+
() => variant === "expressive" ? cn(
|
|
526
|
+
"z-50 flex flex-col w-full",
|
|
527
|
+
MENU_MIN_WIDTH,
|
|
528
|
+
MENU_MAX_WIDTH,
|
|
529
|
+
isExpressiveGap ? MENU_GROUP_GAP : "",
|
|
530
|
+
isExpressiveGap ? "bg-transparent" : colors.containerBg,
|
|
531
|
+
isExpressiveGap ? "" : "rounded-2xl",
|
|
532
|
+
isExpressiveGap ? "" : "elevation-2",
|
|
533
|
+
hasOverflow || isExpressiveGap ? "overflow-visible" : "overflow-hidden",
|
|
534
|
+
"outline-none",
|
|
535
|
+
className
|
|
536
|
+
) : cn(
|
|
537
|
+
"z-50 flex flex-col",
|
|
538
|
+
MENU_MIN_WIDTH,
|
|
539
|
+
MENU_MAX_WIDTH,
|
|
540
|
+
MENU_POPUP_PADDING_Y,
|
|
541
|
+
MENU_GROUP_GAP,
|
|
542
|
+
colors.containerBg,
|
|
543
|
+
MENU_CONTAINER_SHAPE,
|
|
544
|
+
"elevation-2",
|
|
545
|
+
hasOverflow ? "overflow-visible" : "overflow-hidden",
|
|
546
|
+
"outline-none",
|
|
547
|
+
className
|
|
548
|
+
),
|
|
549
|
+
[variant, isExpressiveGap, hasOverflow, className, colors.containerBg]
|
|
512
550
|
);
|
|
513
|
-
const
|
|
514
|
-
|
|
515
|
-
(acc, child) => {
|
|
516
|
-
if (React36.isValidElement(child)) {
|
|
517
|
-
if (child.type === React36.Fragment) {
|
|
518
|
-
return acc.concat(
|
|
519
|
-
flattenChildren(
|
|
520
|
-
child.props.children
|
|
521
|
-
)
|
|
522
|
-
);
|
|
523
|
-
}
|
|
524
|
-
acc.push(child);
|
|
525
|
-
}
|
|
526
|
-
return acc;
|
|
527
|
-
},
|
|
528
|
-
[]
|
|
529
|
-
);
|
|
530
|
-
};
|
|
531
|
-
let renderedChildren = children;
|
|
532
|
-
if (variant === "expressive") {
|
|
551
|
+
const renderedChildren = React37.useMemo(() => {
|
|
552
|
+
if (variant !== "expressive") return children;
|
|
533
553
|
const validChildren = flattenChildren(children);
|
|
534
554
|
const groupCount = validChildren.length;
|
|
535
|
-
const
|
|
536
|
-
(child, i) =>
|
|
555
|
+
const enhanced = validChildren.map(
|
|
556
|
+
(child, i) => React37.cloneElement(
|
|
537
557
|
child,
|
|
538
|
-
{
|
|
539
|
-
index: i,
|
|
540
|
-
count: groupCount,
|
|
541
|
-
isGapVariant: isExpressiveGap
|
|
542
|
-
}
|
|
558
|
+
{ index: i, count: groupCount, isGapVariant: isExpressiveGap }
|
|
543
559
|
)
|
|
544
560
|
);
|
|
545
|
-
|
|
561
|
+
if (separatorStyle !== "divider") return enhanced;
|
|
562
|
+
return enhanced.reduce((acc, child, i) => {
|
|
546
563
|
if (i > 0) {
|
|
547
564
|
acc.push(
|
|
548
565
|
/* @__PURE__ */ jsx(
|
|
549
566
|
"hr",
|
|
550
567
|
{
|
|
551
|
-
className: cn(
|
|
552
|
-
"mx-3 my-0.5 h-px border-0 bg-m3-outline-variant"
|
|
553
|
-
)
|
|
568
|
+
className: cn("mx-3 my-0.5 h-px border-0 bg-m3-outline-variant")
|
|
554
569
|
},
|
|
555
570
|
`divider-${child.key || i}`
|
|
556
571
|
)
|
|
@@ -558,8 +573,8 @@ var ContextMenuContent = React36.forwardRef(
|
|
|
558
573
|
}
|
|
559
574
|
acc.push(child);
|
|
560
575
|
return acc;
|
|
561
|
-
}, [])
|
|
562
|
-
}
|
|
576
|
+
}, []);
|
|
577
|
+
}, [children, variant, isExpressiveGap, separatorStyle]);
|
|
563
578
|
return /* @__PURE__ */ jsx(AnimatePresence, { children: open && /* @__PURE__ */ jsx(RxContextMenu.Portal, { forceMount: true, children: /* @__PURE__ */ jsx(RxContextMenu.Content, __spreadProps(__spreadValues({ ref, asChild: true, forceMount: true }, props), { children: /* @__PURE__ */ jsx(
|
|
564
579
|
m.div,
|
|
565
580
|
{
|
|
@@ -583,6 +598,7 @@ function Menu(_a) {
|
|
|
583
598
|
variant,
|
|
584
599
|
menuVariant,
|
|
585
600
|
colorVariant = "standard",
|
|
601
|
+
density = 0,
|
|
586
602
|
open: controlledOpen,
|
|
587
603
|
onOpenChange: controlledOnOpenChange,
|
|
588
604
|
defaultOpen
|
|
@@ -591,18 +607,19 @@ function Menu(_a) {
|
|
|
591
607
|
"variant",
|
|
592
608
|
"menuVariant",
|
|
593
609
|
"colorVariant",
|
|
610
|
+
"density",
|
|
594
611
|
"open",
|
|
595
612
|
"onOpenChange",
|
|
596
613
|
"defaultOpen"
|
|
597
614
|
]);
|
|
598
615
|
var _a2;
|
|
599
616
|
const resolvedVariant = (_a2 = variant != null ? variant : menuVariant) != null ? _a2 : "baseline";
|
|
600
|
-
const [internalOpen, setInternalOpen] =
|
|
617
|
+
const [internalOpen, setInternalOpen] = React37.useState(
|
|
601
618
|
() => defaultOpen != null ? defaultOpen : false
|
|
602
619
|
);
|
|
603
620
|
const isControlled = controlledOpen !== void 0;
|
|
604
621
|
const open = isControlled ? controlledOpen : internalOpen;
|
|
605
|
-
const handleOpenChange =
|
|
622
|
+
const handleOpenChange = React37.useCallback(
|
|
606
623
|
(next) => {
|
|
607
624
|
if (!isControlled) setInternalOpen(next);
|
|
608
625
|
controlledOnOpenChange == null ? void 0 : controlledOnOpenChange(next);
|
|
@@ -614,6 +631,7 @@ function Menu(_a) {
|
|
|
614
631
|
{
|
|
615
632
|
variant: resolvedVariant,
|
|
616
633
|
colorVariant,
|
|
634
|
+
density,
|
|
617
635
|
open,
|
|
618
636
|
onOpenChange: handleOpenChange,
|
|
619
637
|
children: /* @__PURE__ */ jsx(
|
|
@@ -629,12 +647,12 @@ function Menu(_a) {
|
|
|
629
647
|
);
|
|
630
648
|
}
|
|
631
649
|
Menu.displayName = "Menu";
|
|
632
|
-
var MenuTrigger =
|
|
650
|
+
var MenuTrigger = React37.forwardRef((_a, ref) => {
|
|
633
651
|
var _b = _a, { children, asChild = true } = _b, props = __objRest(_b, ["children", "asChild"]);
|
|
634
652
|
return /* @__PURE__ */ jsx(DropdownMenu.Trigger, __spreadProps(__spreadValues({ ref, asChild }, props), { children }));
|
|
635
653
|
});
|
|
636
654
|
MenuTrigger.displayName = "MenuTrigger";
|
|
637
|
-
var MenuContent =
|
|
655
|
+
var MenuContent = React37.forwardRef(
|
|
638
656
|
(_a, ref) => {
|
|
639
657
|
var _b = _a, {
|
|
640
658
|
children,
|
|
@@ -644,6 +662,7 @@ var MenuContent = React36.forwardRef(
|
|
|
644
662
|
hasOverflow = false,
|
|
645
663
|
colorVariant: propColorVariant,
|
|
646
664
|
separatorStyle = "gap",
|
|
665
|
+
matchTriggerWidth = false,
|
|
647
666
|
className
|
|
648
667
|
} = _b, props = __objRest(_b, [
|
|
649
668
|
"children",
|
|
@@ -653,6 +672,7 @@ var MenuContent = React36.forwardRef(
|
|
|
653
672
|
"hasOverflow",
|
|
654
673
|
"colorVariant",
|
|
655
674
|
"separatorStyle",
|
|
675
|
+
"matchTriggerWidth",
|
|
656
676
|
"className"
|
|
657
677
|
]);
|
|
658
678
|
const {
|
|
@@ -663,68 +683,66 @@ var MenuContent = React36.forwardRef(
|
|
|
663
683
|
const colorVariant = propColorVariant != null ? propColorVariant : contextColorVariant;
|
|
664
684
|
const colors = variant === "baseline" ? BASELINE_COLORS : colorVariant === "vibrant" ? VIBRANT_COLORS : STANDARD_COLORS;
|
|
665
685
|
const isExpressiveGap = variant === "expressive" && separatorStyle === "gap";
|
|
666
|
-
const containerClassName =
|
|
667
|
-
"
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
const flattenChildren = (nodes) => {
|
|
691
|
-
return React36.Children.toArray(nodes).reduce(
|
|
692
|
-
(acc, child) => {
|
|
693
|
-
if (React36.isValidElement(child)) {
|
|
694
|
-
if (child.type === React36.Fragment) {
|
|
695
|
-
return acc.concat(
|
|
696
|
-
flattenChildren(
|
|
697
|
-
child.props.children
|
|
698
|
-
)
|
|
699
|
-
);
|
|
700
|
-
}
|
|
701
|
-
acc.push(child);
|
|
702
|
-
}
|
|
703
|
-
return acc;
|
|
704
|
-
},
|
|
705
|
-
[]
|
|
686
|
+
const containerClassName = React37.useMemo(() => {
|
|
687
|
+
const widthClass = matchTriggerWidth ? "w-[var(--radix-dropdown-menu-trigger-width)]" : cn(MENU_MIN_WIDTH, MENU_MAX_WIDTH);
|
|
688
|
+
return variant === "expressive" ? cn(
|
|
689
|
+
"z-50 flex flex-col",
|
|
690
|
+
widthClass,
|
|
691
|
+
isExpressiveGap ? MENU_GROUP_GAP : "",
|
|
692
|
+
isExpressiveGap ? "bg-transparent" : colors.containerBg,
|
|
693
|
+
isExpressiveGap ? "" : "p-1",
|
|
694
|
+
isExpressiveGap ? "" : "rounded-2xl",
|
|
695
|
+
isExpressiveGap ? "" : "elevation-2",
|
|
696
|
+
hasOverflow || isExpressiveGap ? "overflow-visible" : "overflow-hidden",
|
|
697
|
+
"outline-none",
|
|
698
|
+
className
|
|
699
|
+
) : cn(
|
|
700
|
+
"z-50 flex flex-col",
|
|
701
|
+
widthClass,
|
|
702
|
+
MENU_POPUP_PADDING_Y,
|
|
703
|
+
MENU_GROUP_GAP,
|
|
704
|
+
colors.containerBg,
|
|
705
|
+
MENU_CONTAINER_SHAPE,
|
|
706
|
+
"elevation-2",
|
|
707
|
+
hasOverflow ? "overflow-visible" : "overflow-hidden",
|
|
708
|
+
"outline-none",
|
|
709
|
+
className
|
|
706
710
|
);
|
|
707
|
-
}
|
|
708
|
-
|
|
709
|
-
|
|
711
|
+
}, [
|
|
712
|
+
variant,
|
|
713
|
+
isExpressiveGap,
|
|
714
|
+
hasOverflow,
|
|
715
|
+
matchTriggerWidth,
|
|
716
|
+
className,
|
|
717
|
+
colors.containerBg
|
|
718
|
+
]);
|
|
719
|
+
const renderedChildren = React37.useMemo(() => {
|
|
720
|
+
if (variant !== "expressive") return children;
|
|
710
721
|
const validChildren = flattenChildren(children);
|
|
711
722
|
const groupCount = validChildren.length;
|
|
712
|
-
const
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
723
|
+
const enhanced = validChildren.map((child, i) => {
|
|
724
|
+
var _a2;
|
|
725
|
+
if (typeof child.type === "string") return child;
|
|
726
|
+
const defaultItemPosition = groupCount === 1 ? "standalone" : i === 0 ? "leading" : i === groupCount - 1 ? "trailing" : "middle";
|
|
727
|
+
const itemPosition = (_a2 = child.props.itemPosition) != null ? _a2 : defaultItemPosition;
|
|
728
|
+
return React37.cloneElement(
|
|
729
|
+
child,
|
|
730
|
+
{
|
|
731
|
+
index: i,
|
|
732
|
+
count: groupCount,
|
|
733
|
+
itemPosition,
|
|
734
|
+
isGapVariant: isExpressiveGap
|
|
735
|
+
}
|
|
736
|
+
);
|
|
737
|
+
});
|
|
738
|
+
if (separatorStyle !== "divider") return enhanced;
|
|
739
|
+
return enhanced.reduce((acc, child, i) => {
|
|
720
740
|
if (i > 0) {
|
|
721
741
|
acc.push(
|
|
722
742
|
/* @__PURE__ */ jsx(
|
|
723
743
|
"hr",
|
|
724
744
|
{
|
|
725
|
-
className: cn(
|
|
726
|
-
"mx-3 my-0.5 h-px border-0 bg-m3-outline-variant"
|
|
727
|
-
)
|
|
745
|
+
className: cn("mx-3 my-0.5 h-px border-0 bg-m3-outline-variant")
|
|
728
746
|
},
|
|
729
747
|
`divider-${child.key || i}`
|
|
730
748
|
)
|
|
@@ -732,8 +750,8 @@ var MenuContent = React36.forwardRef(
|
|
|
732
750
|
}
|
|
733
751
|
acc.push(child);
|
|
734
752
|
return acc;
|
|
735
|
-
}, [])
|
|
736
|
-
}
|
|
753
|
+
}, []);
|
|
754
|
+
}, [children, variant, isExpressiveGap, separatorStyle]);
|
|
737
755
|
return /* @__PURE__ */ jsx(AnimatePresence, { children: open && /* @__PURE__ */ jsx(DropdownMenu.Portal, { forceMount: true, children: /* @__PURE__ */ jsx(
|
|
738
756
|
DropdownMenu.Content,
|
|
739
757
|
__spreadProps(__spreadValues({
|
|
@@ -765,9 +783,9 @@ var MenuContent = React36.forwardRef(
|
|
|
765
783
|
}
|
|
766
784
|
);
|
|
767
785
|
MenuContent.displayName = "MenuContent";
|
|
768
|
-
var MenuDivider =
|
|
786
|
+
var MenuDivider = React37.forwardRef(
|
|
769
787
|
(_a, ref) => {
|
|
770
|
-
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
788
|
+
var _b = _a, { className, isGapVariant: _isGapVariant } = _b, props = __objRest(_b, ["className", "isGapVariant"]);
|
|
771
789
|
const { menuVariant } = useMenuContext();
|
|
772
790
|
return /* @__PURE__ */ jsx(DropdownMenu.Separator, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
773
791
|
"hr",
|
|
@@ -796,7 +814,7 @@ function getGroupPosition(index, count) {
|
|
|
796
814
|
function getGroupActiveShape(position) {
|
|
797
815
|
return GROUP_SHAPES[`${position}Active`];
|
|
798
816
|
}
|
|
799
|
-
var MenuGroup =
|
|
817
|
+
var MenuGroup = React37.forwardRef(
|
|
800
818
|
(_a, ref) => {
|
|
801
819
|
var _b = _a, {
|
|
802
820
|
children,
|
|
@@ -817,46 +835,25 @@ var MenuGroup = React36.forwardRef(
|
|
|
817
835
|
"itemPosition",
|
|
818
836
|
"className"
|
|
819
837
|
]);
|
|
820
|
-
const {
|
|
821
|
-
menuVariant,
|
|
822
|
-
colorVariant: contextColorVariant,
|
|
823
|
-
isStatic
|
|
824
|
-
} = useMenuContext();
|
|
838
|
+
const { menuVariant, colorVariant: contextColorVariant } = useMenuContext();
|
|
825
839
|
const colorVariant = propColorVariant != null ? propColorVariant : contextColorVariant;
|
|
826
840
|
const colors = menuVariant === "baseline" ? BASELINE_COLORS : colorVariant === "vibrant" ? VIBRANT_COLORS : STANDARD_COLORS;
|
|
827
841
|
const position = getGroupPosition(index, count);
|
|
828
|
-
const
|
|
829
|
-
const
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
)
|
|
842
|
-
);
|
|
843
|
-
}
|
|
844
|
-
acc.push(child);
|
|
845
|
-
}
|
|
846
|
-
return acc;
|
|
847
|
-
},
|
|
848
|
-
[]
|
|
849
|
-
);
|
|
850
|
-
};
|
|
851
|
-
const validChildren = flattenChildren(children);
|
|
852
|
-
const itemCount = validChildren.length;
|
|
853
|
-
const enhancedChildren = validChildren.map((child, i) => {
|
|
854
|
-
const itemPosition2 = itemCount === 1 ? "standalone" : i === 0 ? "leading" : i === itemCount - 1 ? "trailing" : "middle";
|
|
855
|
-
return React36.cloneElement(child, {
|
|
856
|
-
itemPosition: itemPosition2,
|
|
857
|
-
colorVariant
|
|
842
|
+
const currentShape = getGroupActiveShape(position);
|
|
843
|
+
const enhancedChildren = React37.useMemo(() => {
|
|
844
|
+
const valid = flattenChildren(children);
|
|
845
|
+
const itemCount = valid.length;
|
|
846
|
+
return valid.map((child, i) => {
|
|
847
|
+
var _a2;
|
|
848
|
+
if (typeof child.type === "string") return child;
|
|
849
|
+
const defaultItemPosition = itemCount === 1 ? "standalone" : i === 0 ? "leading" : i === itemCount - 1 ? "trailing" : "middle";
|
|
850
|
+
const itemPosition2 = (_a2 = child.props.itemPosition) != null ? _a2 : defaultItemPosition;
|
|
851
|
+
return React37.cloneElement(child, {
|
|
852
|
+
itemPosition: itemPosition2,
|
|
853
|
+
colorVariant
|
|
854
|
+
});
|
|
858
855
|
});
|
|
859
|
-
});
|
|
856
|
+
}, [children, colorVariant]);
|
|
860
857
|
return /* @__PURE__ */ jsxs(
|
|
861
858
|
m.div,
|
|
862
859
|
__spreadProps(__spreadValues({
|
|
@@ -868,10 +865,8 @@ var MenuGroup = React36.forwardRef(
|
|
|
868
865
|
// In baseline variant, MenuGroup is transparent so it shouldn't clip.
|
|
869
866
|
// In expressive variant, it needs overflow-hidden to clip hover states to its morphing shape.
|
|
870
867
|
menuVariant === "baseline" ? "" : "overflow-hidden",
|
|
871
|
-
//
|
|
872
|
-
|
|
873
|
-
// Horizontal padding: 4dp for expressive menus (both static and popup), 0 for baseline
|
|
874
|
-
menuVariant === "expressive" ? "px-1" : "",
|
|
868
|
+
// Padding: uniform 4dp (p-1) for expressive menus (matches 12px inner item corners inside 16px outer corners)
|
|
869
|
+
menuVariant === "expressive" ? "p-1" : MENU_GROUP_PADDING_Y,
|
|
875
870
|
// Gap variant has floating segments, so each group manages its own shadow
|
|
876
871
|
isGapVariant ? "elevation-2" : "",
|
|
877
872
|
// Background based on color variant (transparent for baseline to avoid double-layering)
|
|
@@ -879,9 +874,7 @@ var MenuGroup = React36.forwardRef(
|
|
|
879
874
|
className
|
|
880
875
|
),
|
|
881
876
|
animate: { borderRadius: currentShape },
|
|
882
|
-
transition: FAST_SPATIAL_SPRING
|
|
883
|
-
onPointerEnter: handlePointerEnter,
|
|
884
|
-
onPointerLeave: handlePointerLeave
|
|
877
|
+
transition: FAST_SPATIAL_SPRING
|
|
885
878
|
}, rest), {
|
|
886
879
|
children: [
|
|
887
880
|
label && /* @__PURE__ */ jsx(
|
|
@@ -918,7 +911,7 @@ var VARIANT_FONT = {
|
|
|
918
911
|
rounded: "'Material Symbols Rounded'",
|
|
919
912
|
sharp: "'Material Symbols Sharp'"
|
|
920
913
|
};
|
|
921
|
-
var IconComponent =
|
|
914
|
+
var IconComponent = React37.forwardRef(
|
|
922
915
|
(_a, ref) => {
|
|
923
916
|
var _b = _a, {
|
|
924
917
|
name,
|
|
@@ -984,14 +977,14 @@ var IconComponent = React36.forwardRef(
|
|
|
984
977
|
}
|
|
985
978
|
);
|
|
986
979
|
IconComponent.displayName = "Icon";
|
|
987
|
-
var Icon =
|
|
980
|
+
var Icon = React37.memo(IconComponent);
|
|
988
981
|
function getItemShapeClass(position, selected, isStatic = false, menuVariant = "expressive") {
|
|
989
982
|
if (menuVariant === "baseline") return BASELINE_ITEM_SHAPE;
|
|
990
983
|
if (selected) return ITEM_SHAPE_CLASSES.selected;
|
|
991
984
|
if (isStatic && position === "standalone") return "rounded-[12px]";
|
|
992
985
|
return ITEM_SHAPE_CLASSES[position];
|
|
993
986
|
}
|
|
994
|
-
var MenuItem =
|
|
987
|
+
var MenuItem = React37.forwardRef(
|
|
995
988
|
(_a, ref) => {
|
|
996
989
|
var _b = _a, {
|
|
997
990
|
children,
|
|
@@ -1004,11 +997,13 @@ var MenuItem = React36.forwardRef(
|
|
|
1004
997
|
disabled = false,
|
|
1005
998
|
itemPosition = "standalone",
|
|
1006
999
|
colorVariant: propColorVariant,
|
|
1000
|
+
density: propDensity,
|
|
1007
1001
|
keepOpen = false,
|
|
1008
1002
|
className,
|
|
1009
1003
|
isSubTrigger,
|
|
1010
1004
|
value,
|
|
1011
|
-
role
|
|
1005
|
+
role,
|
|
1006
|
+
isGapVariant: _isGapVariant
|
|
1012
1007
|
} = _b, rest = __objRest(_b, [
|
|
1013
1008
|
"children",
|
|
1014
1009
|
"onClick",
|
|
@@ -1020,18 +1015,24 @@ var MenuItem = React36.forwardRef(
|
|
|
1020
1015
|
"disabled",
|
|
1021
1016
|
"itemPosition",
|
|
1022
1017
|
"colorVariant",
|
|
1018
|
+
"density",
|
|
1023
1019
|
"keepOpen",
|
|
1024
1020
|
"className",
|
|
1025
1021
|
"isSubTrigger",
|
|
1026
1022
|
"value",
|
|
1027
|
-
"role"
|
|
1023
|
+
"role",
|
|
1024
|
+
"isGapVariant"
|
|
1028
1025
|
]);
|
|
1026
|
+
var _a2;
|
|
1029
1027
|
const {
|
|
1030
1028
|
menuVariant,
|
|
1031
1029
|
colorVariant: contextColorVariant,
|
|
1030
|
+
density: contextDensity,
|
|
1032
1031
|
menuPrimitive
|
|
1033
1032
|
} = useMenuContext();
|
|
1034
1033
|
const colorVariant = propColorVariant != null ? propColorVariant : contextColorVariant;
|
|
1034
|
+
const density = (_a2 = propDensity != null ? propDensity : contextDensity) != null ? _a2 : 0;
|
|
1035
|
+
const minHeightClass = DENSITY_MIN_HEIGHT[density];
|
|
1035
1036
|
const colors = menuVariant === "baseline" ? BASELINE_COLORS : colorVariant === "vibrant" ? VIBRANT_COLORS : STANDARD_COLORS;
|
|
1036
1037
|
const isStaticMenu = menuPrimitive === "static";
|
|
1037
1038
|
const shapeClass = getItemShapeClass(
|
|
@@ -1073,12 +1074,11 @@ var MenuItem = React36.forwardRef(
|
|
|
1073
1074
|
className: cn(
|
|
1074
1075
|
// Layout
|
|
1075
1076
|
"relative flex w-full cursor-pointer select-none items-center outline-none",
|
|
1076
|
-
// Sizing: min-h 48dp,
|
|
1077
|
-
|
|
1077
|
+
// Sizing: min-h based on density (48dp, 40dp, 32dp), min-w 112dp
|
|
1078
|
+
minHeightClass,
|
|
1079
|
+
"min-w-28",
|
|
1078
1080
|
// Horizontal padding
|
|
1079
1081
|
menuVariant === "baseline" ? MENU_BASELINE_ITEM_HORIZONTAL_PADDING : "px-4",
|
|
1080
|
-
// Spacing between items
|
|
1081
|
-
isStaticMenu ? "my-0.5" : "",
|
|
1082
1082
|
// Shape morphing (position-based + selected override)
|
|
1083
1083
|
shapeClass,
|
|
1084
1084
|
// Animate border-radius AND background-color together (FastEffects: 150ms)
|
|
@@ -1090,7 +1090,7 @@ var MenuItem = React36.forwardRef(
|
|
|
1090
1090
|
!selected && colors.focusLayer,
|
|
1091
1091
|
// Focus visible ring (WCAG 2.4.11 — visible focus indicator)
|
|
1092
1092
|
// Uses ring-inset so the ring doesn't overflow the item bounds.
|
|
1093
|
-
"focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-m3-
|
|
1093
|
+
"focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-m3-secondary data-highlighted:ring-0",
|
|
1094
1094
|
// Disabled
|
|
1095
1095
|
disabled && "pointer-events-none opacity-[0.38]",
|
|
1096
1096
|
className
|
|
@@ -1193,31 +1193,31 @@ function SubMenu({
|
|
|
1193
1193
|
}) {
|
|
1194
1194
|
const { colorVariant: contextColorVariant, menuPrimitive } = useMenuContext();
|
|
1195
1195
|
const colorVariant = propColorVariant != null ? propColorVariant : contextColorVariant;
|
|
1196
|
-
const [open, setOpen] =
|
|
1197
|
-
const openTimerRef =
|
|
1198
|
-
const closeTimerRef =
|
|
1196
|
+
const [open, setOpen] = React37.useState(false);
|
|
1197
|
+
const openTimerRef = React37.useRef(null);
|
|
1198
|
+
const closeTimerRef = React37.useRef(
|
|
1199
1199
|
null
|
|
1200
1200
|
);
|
|
1201
|
-
const clearTimers =
|
|
1201
|
+
const clearTimers = React37.useCallback(() => {
|
|
1202
1202
|
if (openTimerRef.current) clearTimeout(openTimerRef.current);
|
|
1203
1203
|
if (closeTimerRef.current) clearTimeout(closeTimerRef.current);
|
|
1204
1204
|
}, []);
|
|
1205
|
-
const handleTriggerPointerEnter =
|
|
1205
|
+
const handleTriggerPointerEnter = React37.useCallback(() => {
|
|
1206
1206
|
clearTimers();
|
|
1207
1207
|
openTimerRef.current = setTimeout(() => setOpen(true), hoverOpenDelay);
|
|
1208
1208
|
}, [hoverOpenDelay, clearTimers]);
|
|
1209
|
-
const handleTriggerPointerLeave =
|
|
1209
|
+
const handleTriggerPointerLeave = React37.useCallback(() => {
|
|
1210
1210
|
clearTimers();
|
|
1211
1211
|
closeTimerRef.current = setTimeout(() => setOpen(false), hoverCloseDelay);
|
|
1212
1212
|
}, [hoverCloseDelay, clearTimers]);
|
|
1213
|
-
const handleContentPointerEnter =
|
|
1213
|
+
const handleContentPointerEnter = React37.useCallback(() => {
|
|
1214
1214
|
clearTimers();
|
|
1215
1215
|
}, [clearTimers]);
|
|
1216
|
-
const handleContentPointerLeave =
|
|
1216
|
+
const handleContentPointerLeave = React37.useCallback(() => {
|
|
1217
1217
|
clearTimers();
|
|
1218
1218
|
closeTimerRef.current = setTimeout(() => setOpen(false), hoverCloseDelay);
|
|
1219
1219
|
}, [hoverCloseDelay, clearTimers]);
|
|
1220
|
-
|
|
1220
|
+
React37.useEffect(() => () => clearTimers(), [clearTimers]);
|
|
1221
1221
|
const Sub3 = menuPrimitive === "context" ? RxContextMenu.Sub : DropdownMenu.Sub;
|
|
1222
1222
|
const SubTrigger3 = menuPrimitive === "context" ? RxContextMenu.SubTrigger : DropdownMenu.SubTrigger;
|
|
1223
1223
|
const SubContent3 = menuPrimitive === "context" ? RxContextMenu.SubContent : DropdownMenu.SubContent;
|
|
@@ -1229,7 +1229,7 @@ function SubMenu({
|
|
|
1229
1229
|
className: "w-full outline-none",
|
|
1230
1230
|
onPointerEnter: handleTriggerPointerEnter,
|
|
1231
1231
|
onPointerLeave: handleTriggerPointerLeave,
|
|
1232
|
-
children:
|
|
1232
|
+
children: React37.isValidElement(trigger) ? React37.cloneElement(trigger, {
|
|
1233
1233
|
isSubTrigger: true,
|
|
1234
1234
|
// Auto-add chevron if missing
|
|
1235
1235
|
trailingIcon: trigger.props.trailingIcon || /* @__PURE__ */ jsx(Icon, { name: "chevron_right", size: 20 })
|
|
@@ -1306,7 +1306,7 @@ function SubMenuContent({
|
|
|
1306
1306
|
);
|
|
1307
1307
|
}
|
|
1308
1308
|
SubMenuContent.displayName = "SubMenuContent";
|
|
1309
|
-
var VerticalMenuDivider =
|
|
1309
|
+
var VerticalMenuDivider = React37.forwardRef((_a, ref) => {
|
|
1310
1310
|
var _b = _a, { className, index, count, isGapVariant } = _b, props = __objRest(_b, ["className", "index", "count", "isGapVariant"]);
|
|
1311
1311
|
return /* @__PURE__ */ jsx(
|
|
1312
1312
|
"hr",
|
|
@@ -1326,7 +1326,7 @@ var VerticalMenuDivider = React36.forwardRef((_a, ref) => {
|
|
|
1326
1326
|
});
|
|
1327
1327
|
VerticalMenuDivider.displayName = "VerticalMenuDivider";
|
|
1328
1328
|
var VerticalMenuGroup = MenuGroup;
|
|
1329
|
-
var VerticalMenuContent =
|
|
1329
|
+
var VerticalMenuContent = React37.forwardRef(
|
|
1330
1330
|
(_a, ref) => {
|
|
1331
1331
|
var _b = _a, {
|
|
1332
1332
|
children,
|
|
@@ -1342,46 +1342,39 @@ var VerticalMenuContent = React36.forwardRef(
|
|
|
1342
1342
|
const { colorVariant: contextColorVariant } = useMenuContext();
|
|
1343
1343
|
const colorVariant = propColorVariant != null ? propColorVariant : contextColorVariant;
|
|
1344
1344
|
const colors = colorVariant === "vibrant" ? VIBRANT_COLORS : STANDARD_COLORS;
|
|
1345
|
-
const
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1345
|
+
const renderedChildren = React37.useMemo(() => {
|
|
1346
|
+
const valid = flattenChildren(children);
|
|
1347
|
+
const groupCount = valid.length;
|
|
1348
|
+
const enhanced = valid.map((child, i) => {
|
|
1349
|
+
var _a2;
|
|
1350
|
+
if (typeof child.type === "string") return child;
|
|
1351
|
+
const defaultItemPosition = groupCount === 1 ? "standalone" : i === 0 ? "leading" : i === groupCount - 1 ? "trailing" : "middle";
|
|
1352
|
+
const itemPosition = (_a2 = child.props.itemPosition) != null ? _a2 : defaultItemPosition;
|
|
1353
|
+
return React37.cloneElement(
|
|
1354
|
+
child,
|
|
1355
|
+
{
|
|
1356
|
+
index: i,
|
|
1357
|
+
count: groupCount,
|
|
1358
|
+
itemPosition,
|
|
1359
|
+
isGapVariant: separatorStyle === "gap"
|
|
1357
1360
|
}
|
|
1358
|
-
return acc;
|
|
1359
|
-
},
|
|
1360
|
-
[]
|
|
1361
|
-
);
|
|
1362
|
-
};
|
|
1363
|
-
const validChildren = flattenChildren(children);
|
|
1364
|
-
const groupCount = validChildren.length;
|
|
1365
|
-
const enhancedChildren = validChildren.map(
|
|
1366
|
-
(child, i) => React36.cloneElement(child, {
|
|
1367
|
-
index: i,
|
|
1368
|
-
count: groupCount,
|
|
1369
|
-
isGapVariant: separatorStyle === "gap"
|
|
1370
|
-
})
|
|
1371
|
-
);
|
|
1372
|
-
const renderedChildren = separatorStyle === "divider" ? enhancedChildren.reduce((acc, child, i) => {
|
|
1373
|
-
if (i > 0) {
|
|
1374
|
-
acc.push(
|
|
1375
|
-
/* @__PURE__ */ jsx(
|
|
1376
|
-
VerticalMenuDivider,
|
|
1377
|
-
{},
|
|
1378
|
-
`divider-${child.key || i}`
|
|
1379
|
-
)
|
|
1380
1361
|
);
|
|
1381
|
-
}
|
|
1382
|
-
|
|
1383
|
-
return acc
|
|
1384
|
-
|
|
1362
|
+
});
|
|
1363
|
+
if (separatorStyle !== "divider") return enhanced;
|
|
1364
|
+
return enhanced.reduce((acc, child, i) => {
|
|
1365
|
+
if (i > 0) {
|
|
1366
|
+
acc.push(
|
|
1367
|
+
/* @__PURE__ */ jsx(
|
|
1368
|
+
VerticalMenuDivider,
|
|
1369
|
+
{},
|
|
1370
|
+
`divider-${child.key || i}`
|
|
1371
|
+
)
|
|
1372
|
+
);
|
|
1373
|
+
}
|
|
1374
|
+
acc.push(child);
|
|
1375
|
+
return acc;
|
|
1376
|
+
}, []);
|
|
1377
|
+
}, [children, separatorStyle]);
|
|
1385
1378
|
return /* @__PURE__ */ jsx(
|
|
1386
1379
|
"div",
|
|
1387
1380
|
__spreadProps(__spreadValues({
|
|
@@ -1400,13 +1393,13 @@ var VerticalMenuContent = React36.forwardRef(
|
|
|
1400
1393
|
}
|
|
1401
1394
|
);
|
|
1402
1395
|
VerticalMenuContent.displayName = "VerticalMenuContent";
|
|
1403
|
-
var VerticalMenu =
|
|
1396
|
+
var VerticalMenu = React37.forwardRef((_a, ref) => {
|
|
1404
1397
|
var _b = _a, { children, colorVariant = "standard", className } = _b, props = __objRest(_b, ["children", "colorVariant", "className"]);
|
|
1405
|
-
const noop =
|
|
1398
|
+
const noop = React37.useCallback(() => {
|
|
1406
1399
|
}, []);
|
|
1407
1400
|
const colors = colorVariant === "vibrant" ? VIBRANT_COLORS : STANDARD_COLORS;
|
|
1408
|
-
const containerRef =
|
|
1409
|
-
const mergedRef =
|
|
1401
|
+
const containerRef = React37.useRef(null);
|
|
1402
|
+
const mergedRef = React37.useCallback(
|
|
1410
1403
|
(node) => {
|
|
1411
1404
|
containerRef.current = node;
|
|
1412
1405
|
if (typeof ref === "function") ref(node);
|
|
@@ -1415,7 +1408,7 @@ var VerticalMenu = React36.forwardRef((_a, ref) => {
|
|
|
1415
1408
|
},
|
|
1416
1409
|
[ref]
|
|
1417
1410
|
);
|
|
1418
|
-
const handleKeyDown =
|
|
1411
|
+
const handleKeyDown = React37.useCallback(
|
|
1419
1412
|
(e) => {
|
|
1420
1413
|
var _a2;
|
|
1421
1414
|
if (!containerRef.current) return;
|
|
@@ -1498,7 +1491,7 @@ var VerticalMenu = React36.forwardRef((_a, ref) => {
|
|
|
1498
1491
|
});
|
|
1499
1492
|
VerticalMenu.displayName = "VerticalMenu";
|
|
1500
1493
|
function detectSeparatorStyle(children) {
|
|
1501
|
-
const child =
|
|
1494
|
+
const child = React37.Children.toArray(children).find(React37.isValidElement);
|
|
1502
1495
|
if (child) {
|
|
1503
1496
|
const style = child.props.separatorStyle;
|
|
1504
1497
|
if (style) return style;
|
|
@@ -1579,11 +1572,11 @@ function AppBarColumn({
|
|
|
1579
1572
|
maxItemCount,
|
|
1580
1573
|
className
|
|
1581
1574
|
}) {
|
|
1582
|
-
const containerRef =
|
|
1583
|
-
const [visibleCount, setVisibleCount] =
|
|
1575
|
+
const containerRef = React37.useRef(null);
|
|
1576
|
+
const [visibleCount, setVisibleCount] = React37.useState(
|
|
1584
1577
|
maxItemCount != null ? maxItemCount : items.length
|
|
1585
1578
|
);
|
|
1586
|
-
|
|
1579
|
+
React37.useEffect(() => {
|
|
1587
1580
|
if (maxItemCount !== void 0) {
|
|
1588
1581
|
setVisibleCount(Math.min(maxItemCount, items.length));
|
|
1589
1582
|
return;
|
|
@@ -1631,11 +1624,11 @@ function AppBarColumn({
|
|
|
1631
1624
|
);
|
|
1632
1625
|
}
|
|
1633
1626
|
function AppBarRow({ items, maxItemCount, className }) {
|
|
1634
|
-
const containerRef =
|
|
1635
|
-
const [visibleCount, setVisibleCount] =
|
|
1627
|
+
const containerRef = React37.useRef(null);
|
|
1628
|
+
const [visibleCount, setVisibleCount] = React37.useState(
|
|
1636
1629
|
maxItemCount != null ? maxItemCount : items.length
|
|
1637
1630
|
);
|
|
1638
|
-
|
|
1631
|
+
React37.useEffect(() => {
|
|
1639
1632
|
if (maxItemCount !== void 0) {
|
|
1640
1633
|
setVisibleCount(Math.min(maxItemCount, items.length));
|
|
1641
1634
|
return;
|
|
@@ -1689,12 +1682,12 @@ function useAppBarScroll({
|
|
|
1689
1682
|
collapsedHeight = 64,
|
|
1690
1683
|
expandedHeight = 112
|
|
1691
1684
|
} = {}) {
|
|
1692
|
-
const [isScrolled, setIsScrolled] =
|
|
1693
|
-
const [collapsedFraction, setCollapsedFraction] =
|
|
1694
|
-
const [isHidden, setIsHidden] =
|
|
1695
|
-
const prevScrollYRef =
|
|
1685
|
+
const [isScrolled, setIsScrolled] = React37.useState(false);
|
|
1686
|
+
const [collapsedFraction, setCollapsedFraction] = React37.useState(0);
|
|
1687
|
+
const [isHidden, setIsHidden] = React37.useState(false);
|
|
1688
|
+
const prevScrollYRef = React37.useRef(0);
|
|
1696
1689
|
const hideThreshold = 64;
|
|
1697
|
-
|
|
1690
|
+
React37.useEffect(() => {
|
|
1698
1691
|
var _a;
|
|
1699
1692
|
const scrollDistance = expandedHeight - collapsedHeight;
|
|
1700
1693
|
const getScrollY = () => {
|
|
@@ -1815,7 +1808,7 @@ function useFlexibleAppBar({
|
|
|
1815
1808
|
expandedHeight
|
|
1816
1809
|
});
|
|
1817
1810
|
const scrollProgress = useMotionValue(0);
|
|
1818
|
-
|
|
1811
|
+
React37.useEffect(() => {
|
|
1819
1812
|
scrollProgress.set(
|
|
1820
1813
|
shouldReduceMotion ? collapsedFraction > 0.5 ? 1 : 0 : collapsedFraction
|
|
1821
1814
|
);
|
|
@@ -2156,7 +2149,7 @@ function SearchAppBar({
|
|
|
2156
2149
|
}) {
|
|
2157
2150
|
var _a, _b;
|
|
2158
2151
|
const shouldReduceMotion = useReducedMotion();
|
|
2159
|
-
const [isSearchOpen, setIsSearchOpen] =
|
|
2152
|
+
const [isSearchOpen, setIsSearchOpen] = React37.useState(false);
|
|
2160
2153
|
const { isScrolled } = useAppBarScroll({
|
|
2161
2154
|
scrollElement,
|
|
2162
2155
|
behavior: scrollBehavior === "exitUntilCollapsed" ? "pinned" : scrollBehavior
|
|
@@ -2270,8 +2263,8 @@ function SearchView({
|
|
|
2270
2263
|
className
|
|
2271
2264
|
}) {
|
|
2272
2265
|
const shouldReduceMotion = useReducedMotion();
|
|
2273
|
-
const inputRef =
|
|
2274
|
-
|
|
2266
|
+
const inputRef = React37.useRef(null);
|
|
2267
|
+
React37.useEffect(() => {
|
|
2275
2268
|
const timer = window.setTimeout(() => {
|
|
2276
2269
|
var _a;
|
|
2277
2270
|
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
@@ -2527,7 +2520,7 @@ function SmallAppBar({
|
|
|
2527
2520
|
"small-app-bar"
|
|
2528
2521
|
) });
|
|
2529
2522
|
}
|
|
2530
|
-
var RippleItem =
|
|
2523
|
+
var RippleItem = React37.memo(function RippleItem2({
|
|
2531
2524
|
ripple,
|
|
2532
2525
|
onDone
|
|
2533
2526
|
}) {
|
|
@@ -2571,8 +2564,8 @@ function Ripple({
|
|
|
2571
2564
|
}
|
|
2572
2565
|
function useRippleState(options = {}) {
|
|
2573
2566
|
const { disabled = false } = options;
|
|
2574
|
-
const [ripples, setRipples] =
|
|
2575
|
-
const onPointerDown =
|
|
2567
|
+
const [ripples, setRipples] = React37.useState([]);
|
|
2568
|
+
const onPointerDown = React37.useCallback(
|
|
2576
2569
|
(e) => {
|
|
2577
2570
|
if (disabled) return;
|
|
2578
2571
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
@@ -2589,7 +2582,7 @@ function useRippleState(options = {}) {
|
|
|
2589
2582
|
},
|
|
2590
2583
|
[disabled]
|
|
2591
2584
|
);
|
|
2592
|
-
const removeRipple =
|
|
2585
|
+
const removeRipple = React37.useCallback((id) => {
|
|
2593
2586
|
setRipples((prev) => prev.filter((r) => r.id !== id));
|
|
2594
2587
|
}, []);
|
|
2595
2588
|
return { ripples, onPointerDown, removeRipple };
|
|
@@ -4519,11 +4512,11 @@ function getNavigationShapeStyle(shape, width = 56, height = 56) {
|
|
|
4519
4512
|
function isSquareShape(shape) {
|
|
4520
4513
|
return Boolean(shape && shape !== "pill");
|
|
4521
4514
|
}
|
|
4522
|
-
var NavigationBarContext =
|
|
4515
|
+
var NavigationBarContext = React37.createContext({ variant: "flexible" });
|
|
4523
4516
|
function cloneIconWithFill(icon, selected) {
|
|
4524
|
-
if (!
|
|
4517
|
+
if (!React37.isValidElement(icon)) return icon;
|
|
4525
4518
|
if (icon.type === Icon) {
|
|
4526
|
-
return
|
|
4519
|
+
return React37.cloneElement(
|
|
4527
4520
|
icon,
|
|
4528
4521
|
{ fill: selected ? 1 : 0, animateFill: true }
|
|
4529
4522
|
);
|
|
@@ -4535,7 +4528,7 @@ function ActivePill({
|
|
|
4535
4528
|
width = 56,
|
|
4536
4529
|
height = 32
|
|
4537
4530
|
}) {
|
|
4538
|
-
const { activeIndicatorTransition } =
|
|
4531
|
+
const { activeIndicatorTransition } = React37.useContext(NavigationBarContext);
|
|
4539
4532
|
const shapeStyle = getNavigationShapeStyle(shape, width, height);
|
|
4540
4533
|
return /* @__PURE__ */ jsx(
|
|
4541
4534
|
m.div,
|
|
@@ -4607,7 +4600,7 @@ function IconContainer({ selected, badge, children }) {
|
|
|
4607
4600
|
}
|
|
4608
4601
|
);
|
|
4609
4602
|
}
|
|
4610
|
-
var NavigationBarItemComponent =
|
|
4603
|
+
var NavigationBarItemComponent = React37.forwardRef(
|
|
4611
4604
|
({
|
|
4612
4605
|
selected,
|
|
4613
4606
|
icon,
|
|
@@ -4631,7 +4624,7 @@ var NavigationBarItemComponent = React36.forwardRef(
|
|
|
4631
4624
|
labelVisibility: contextLabelVisibility,
|
|
4632
4625
|
shapeSize: contextShapeSize,
|
|
4633
4626
|
itemClassName: contextItemClassName
|
|
4634
|
-
} =
|
|
4627
|
+
} = React37.useContext(NavigationBarContext);
|
|
4635
4628
|
const activeShape = (_a = shapeProp != null ? shapeProp : contextShape) != null ? _a : "pill";
|
|
4636
4629
|
const isSquare = isSquareShape(activeShape);
|
|
4637
4630
|
const resolvedShapeSize = (_b = shapeSizeProp != null ? shapeSizeProp : contextShapeSize) != null ? _b : 56;
|
|
@@ -4645,7 +4638,7 @@ var NavigationBarItemComponent = React36.forwardRef(
|
|
|
4645
4638
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
4646
4639
|
disabled
|
|
4647
4640
|
});
|
|
4648
|
-
const handleClick =
|
|
4641
|
+
const handleClick = React37.useCallback(
|
|
4649
4642
|
(e) => {
|
|
4650
4643
|
if (disabled) {
|
|
4651
4644
|
e.preventDefault();
|
|
@@ -4672,7 +4665,7 @@ var NavigationBarItemComponent = React36.forwardRef(
|
|
|
4672
4665
|
const iconPillWidth = isSquare ? resolvedShapeSize : 56;
|
|
4673
4666
|
const iconPillHeight = isSquare ? resolvedShapeSize : 32;
|
|
4674
4667
|
if (asChild && children) {
|
|
4675
|
-
const child =
|
|
4668
|
+
const child = React37.Children.only(children);
|
|
4676
4669
|
const innerContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4677
4670
|
/* @__PURE__ */ jsxs(
|
|
4678
4671
|
"div",
|
|
@@ -4797,7 +4790,7 @@ var NavigationBarItemComponent = React36.forwardRef(
|
|
|
4797
4790
|
onClick: handleClick,
|
|
4798
4791
|
onPointerDown,
|
|
4799
4792
|
className: itemClassName,
|
|
4800
|
-
children:
|
|
4793
|
+
children: React37.cloneElement(child, { children: innerContent })
|
|
4801
4794
|
}
|
|
4802
4795
|
);
|
|
4803
4796
|
}
|
|
@@ -4931,7 +4924,7 @@ var NavigationBarItemComponent = React36.forwardRef(
|
|
|
4931
4924
|
}
|
|
4932
4925
|
);
|
|
4933
4926
|
NavigationBarItemComponent.displayName = "NavigationBarItem";
|
|
4934
|
-
var NavigationBarItem =
|
|
4927
|
+
var NavigationBarItem = React37.memo(NavigationBarItemComponent);
|
|
4935
4928
|
var navContainerVariants = cva(
|
|
4936
4929
|
"flex items-center justify-center select-none transition-transform duration-300 z-50",
|
|
4937
4930
|
{
|
|
@@ -4957,7 +4950,7 @@ var navContainerVariants = cva(
|
|
|
4957
4950
|
}
|
|
4958
4951
|
}
|
|
4959
4952
|
);
|
|
4960
|
-
var NavigationBarComponent =
|
|
4953
|
+
var NavigationBarComponent = React37.forwardRef(
|
|
4961
4954
|
({
|
|
4962
4955
|
variant = "flexible",
|
|
4963
4956
|
itemLayout,
|
|
@@ -4974,18 +4967,18 @@ var NavigationBarComponent = React36.forwardRef(
|
|
|
4974
4967
|
className,
|
|
4975
4968
|
style
|
|
4976
4969
|
}, ref) => {
|
|
4977
|
-
const [isVisible, setIsVisible] =
|
|
4978
|
-
const lastScrollY =
|
|
4970
|
+
const [isVisible, setIsVisible] = React37.useState(true);
|
|
4971
|
+
const lastScrollY = React37.useRef(
|
|
4979
4972
|
typeof window !== "undefined" ? window.scrollY : 0
|
|
4980
4973
|
);
|
|
4981
4974
|
const isSquare = isSquareShape(shape);
|
|
4982
4975
|
const effectiveShapeSize = shapeSize != null ? shapeSize : isSquare ? 56 : 32;
|
|
4983
|
-
const computedMinHeight =
|
|
4976
|
+
const computedMinHeight = React37.useMemo(() => {
|
|
4984
4977
|
const baseHeight = variant === "baseline" ? 80 : 64;
|
|
4985
4978
|
const requiredHeight = itemLayout === "horizontal" || labelVisibility === "unlabeled" ? effectiveShapeSize + 16 : effectiveShapeSize + 32;
|
|
4986
4979
|
return Math.max(baseHeight, requiredHeight);
|
|
4987
4980
|
}, [variant, itemLayout, labelVisibility, effectiveShapeSize]);
|
|
4988
|
-
|
|
4981
|
+
React37.useEffect(() => {
|
|
4989
4982
|
if (typeof window === "undefined" || !hideOnScroll) {
|
|
4990
4983
|
setIsVisible(true);
|
|
4991
4984
|
return;
|
|
@@ -5069,8 +5062,8 @@ var NavigationBarComponent = React36.forwardRef(
|
|
|
5069
5062
|
}
|
|
5070
5063
|
);
|
|
5071
5064
|
NavigationBarComponent.displayName = "NavigationBar";
|
|
5072
|
-
var NavigationBar =
|
|
5073
|
-
var NavigationRailContext =
|
|
5065
|
+
var NavigationBar = React37.memo(NavigationBarComponent);
|
|
5066
|
+
var NavigationRailContext = React37.createContext({
|
|
5074
5067
|
variant: "collapsed",
|
|
5075
5068
|
labelVisibility: "labeled",
|
|
5076
5069
|
activeIndicatorWidth: "hug"
|
|
@@ -5106,9 +5099,9 @@ var railContainerVariants = cva(
|
|
|
5106
5099
|
}
|
|
5107
5100
|
);
|
|
5108
5101
|
function cloneIconWithFill2(icon, selected) {
|
|
5109
|
-
if (!
|
|
5102
|
+
if (!React37.isValidElement(icon)) return icon;
|
|
5110
5103
|
if (icon.type === Icon) {
|
|
5111
|
-
return
|
|
5104
|
+
return React37.cloneElement(
|
|
5112
5105
|
icon,
|
|
5113
5106
|
{ fill: selected ? 1 : 0, animateFill: true }
|
|
5114
5107
|
);
|
|
@@ -5137,7 +5130,7 @@ function ActivePill2({
|
|
|
5137
5130
|
width = 56,
|
|
5138
5131
|
height = 32
|
|
5139
5132
|
}) {
|
|
5140
|
-
const { activeIndicatorTransition } =
|
|
5133
|
+
const { activeIndicatorTransition } = React37.useContext(NavigationRailContext);
|
|
5141
5134
|
const shapeStyle = getNavigationShapeStyle(shape, width, height);
|
|
5142
5135
|
return /* @__PURE__ */ jsx(
|
|
5143
5136
|
m.div,
|
|
@@ -5212,7 +5205,7 @@ function IconContainer2({ selected, badge, children }) {
|
|
|
5212
5205
|
}
|
|
5213
5206
|
);
|
|
5214
5207
|
}
|
|
5215
|
-
var NavigationRailItemComponent =
|
|
5208
|
+
var NavigationRailItemComponent = React37.forwardRef(
|
|
5216
5209
|
({
|
|
5217
5210
|
selected,
|
|
5218
5211
|
icon,
|
|
@@ -5235,7 +5228,7 @@ var NavigationRailItemComponent = React36.forwardRef(
|
|
|
5235
5228
|
shape: contextShape,
|
|
5236
5229
|
shapeSize: contextShapeSize,
|
|
5237
5230
|
activeIndicatorWidth: contextActiveIndicatorWidth
|
|
5238
|
-
} =
|
|
5231
|
+
} = React37.useContext(NavigationRailContext);
|
|
5239
5232
|
const activeShape = (_a = shapeProp != null ? shapeProp : contextShape) != null ? _a : "pill";
|
|
5240
5233
|
const isSquare = isSquareShape(activeShape);
|
|
5241
5234
|
const resolvedShapeSize = (_b = shapeSizeProp != null ? shapeSizeProp : contextShapeSize) != null ? _b : 56;
|
|
@@ -5245,12 +5238,12 @@ var NavigationRailItemComponent = React36.forwardRef(
|
|
|
5245
5238
|
const enableLayout = !isModal;
|
|
5246
5239
|
const isExpandedPill = isExpanded && !isSquare;
|
|
5247
5240
|
const expandedPillWidthClass = activeIndicatorWidth === "fill" ? "w-full" : "w-fit";
|
|
5248
|
-
const activePillId = `rail-pill-${
|
|
5241
|
+
const activePillId = `rail-pill-${React37.useId()}`;
|
|
5249
5242
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
5250
5243
|
disabled
|
|
5251
5244
|
});
|
|
5252
5245
|
const showLabel = isExpanded || labelVisibility === "labeled" || labelVisibility === "auto" && selected;
|
|
5253
|
-
const handleClick =
|
|
5246
|
+
const handleClick = React37.useCallback(
|
|
5254
5247
|
(e) => {
|
|
5255
5248
|
if (disabled) {
|
|
5256
5249
|
e.preventDefault();
|
|
@@ -5272,7 +5265,7 @@ var NavigationRailItemComponent = React36.forwardRef(
|
|
|
5272
5265
|
const iconPillWidth = isSquare ? resolvedShapeSize : 56;
|
|
5273
5266
|
const iconPillHeight = isSquare ? resolvedShapeSize : 32;
|
|
5274
5267
|
if (asChild && children) {
|
|
5275
|
-
const child =
|
|
5268
|
+
const child = React37.Children.only(children);
|
|
5276
5269
|
const innerContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5277
5270
|
/* @__PURE__ */ jsxs(
|
|
5278
5271
|
m.div,
|
|
@@ -5390,7 +5383,7 @@ var NavigationRailItemComponent = React36.forwardRef(
|
|
|
5390
5383
|
onPointerDown,
|
|
5391
5384
|
className: itemClassName,
|
|
5392
5385
|
tabIndex: -1,
|
|
5393
|
-
children:
|
|
5386
|
+
children: React37.cloneElement(child, { children: innerContent })
|
|
5394
5387
|
}
|
|
5395
5388
|
) });
|
|
5396
5389
|
}
|
|
@@ -5518,9 +5511,9 @@ var NavigationRailItemComponent = React36.forwardRef(
|
|
|
5518
5511
|
}
|
|
5519
5512
|
);
|
|
5520
5513
|
NavigationRailItemComponent.displayName = "NavigationRailItem";
|
|
5521
|
-
var NavigationRailItem =
|
|
5514
|
+
var NavigationRailItem = React37.memo(NavigationRailItemComponent);
|
|
5522
5515
|
function useRoving(navRef) {
|
|
5523
|
-
|
|
5516
|
+
React37.useEffect(() => {
|
|
5524
5517
|
if (!navRef.current) return;
|
|
5525
5518
|
const items = getMenuItems(navRef.current);
|
|
5526
5519
|
const selected = items.find(
|
|
@@ -5530,7 +5523,7 @@ function useRoving(navRef) {
|
|
|
5530
5523
|
const firstFocusable = selected != null ? selected : items[0];
|
|
5531
5524
|
if (firstFocusable) firstFocusable.tabIndex = 0;
|
|
5532
5525
|
}, [navRef]);
|
|
5533
|
-
return
|
|
5526
|
+
return React37.useCallback(
|
|
5534
5527
|
(e) => {
|
|
5535
5528
|
if (!navRef.current) return;
|
|
5536
5529
|
const items = getMenuItems(navRef.current);
|
|
@@ -5558,7 +5551,7 @@ function useRoving(navRef) {
|
|
|
5558
5551
|
[navRef]
|
|
5559
5552
|
);
|
|
5560
5553
|
}
|
|
5561
|
-
var NavigationRailComponent =
|
|
5554
|
+
var NavigationRailComponent = React37.forwardRef(
|
|
5562
5555
|
({
|
|
5563
5556
|
variant = "collapsed",
|
|
5564
5557
|
labelVisibility = "labeled",
|
|
@@ -5582,9 +5575,9 @@ var NavigationRailComponent = React36.forwardRef(
|
|
|
5582
5575
|
const isXr = variant === "xr";
|
|
5583
5576
|
const isSpatial = isXr && fabPlacement === "spatialized";
|
|
5584
5577
|
const applyAnimation = !isXr || !isSpatial;
|
|
5585
|
-
const navRef =
|
|
5578
|
+
const navRef = React37.useRef(null);
|
|
5586
5579
|
const handleKeyDown = useRoving(navRef);
|
|
5587
|
-
const setRefs =
|
|
5580
|
+
const setRefs = React37.useCallback(
|
|
5588
5581
|
(node) => {
|
|
5589
5582
|
navRef.current = node;
|
|
5590
5583
|
if (typeof ref === "function") ref(node);
|
|
@@ -5677,7 +5670,7 @@ var NavigationRailComponent = React36.forwardRef(
|
|
|
5677
5670
|
children: fab
|
|
5678
5671
|
}
|
|
5679
5672
|
),
|
|
5680
|
-
|
|
5673
|
+
React37.cloneElement(
|
|
5681
5674
|
navElement,
|
|
5682
5675
|
{
|
|
5683
5676
|
className: cn(navBaseClasses, "pointer-events-auto")
|
|
@@ -5722,7 +5715,7 @@ var NavigationRailComponent = React36.forwardRef(
|
|
|
5722
5715
|
}
|
|
5723
5716
|
);
|
|
5724
5717
|
NavigationRailComponent.displayName = "NavigationRail";
|
|
5725
|
-
var NavigationRail =
|
|
5718
|
+
var NavigationRail = React37.memo(NavigationRailComponent);
|
|
5726
5719
|
function useSearchKeyboard({
|
|
5727
5720
|
active,
|
|
5728
5721
|
onActiveChange,
|
|
@@ -5731,14 +5724,14 @@ function useSearchKeyboard({
|
|
|
5731
5724
|
itemCount,
|
|
5732
5725
|
onSelectSuggestion
|
|
5733
5726
|
}) {
|
|
5734
|
-
const [activeIndex, setActiveIndex] =
|
|
5735
|
-
const resetKeyRef =
|
|
5727
|
+
const [activeIndex, setActiveIndex] = React37.useState(-1);
|
|
5728
|
+
const resetKeyRef = React37.useRef(`${active}:${query}`);
|
|
5736
5729
|
const currentKey = `${active}:${query}`;
|
|
5737
5730
|
if (resetKeyRef.current !== currentKey) {
|
|
5738
5731
|
resetKeyRef.current = currentKey;
|
|
5739
5732
|
setActiveIndex(-1);
|
|
5740
5733
|
}
|
|
5741
|
-
const handleKeyDown =
|
|
5734
|
+
const handleKeyDown = React37.useCallback(
|
|
5742
5735
|
(e) => {
|
|
5743
5736
|
if (!active) return;
|
|
5744
5737
|
switch (e.key) {
|
|
@@ -5778,7 +5771,7 @@ function useSearchKeyboard({
|
|
|
5778
5771
|
query
|
|
5779
5772
|
]
|
|
5780
5773
|
);
|
|
5781
|
-
const resetActiveIndex =
|
|
5774
|
+
const resetActiveIndex = React37.useCallback(() => {
|
|
5782
5775
|
setActiveIndex(-1);
|
|
5783
5776
|
}, []);
|
|
5784
5777
|
return { activeIndex, handleKeyDown, resetActiveIndex };
|
|
@@ -5846,10 +5839,10 @@ function AnimatedPlaceholder({
|
|
|
5846
5839
|
className
|
|
5847
5840
|
}) {
|
|
5848
5841
|
const shouldReduceMotion = useReducedMotion();
|
|
5849
|
-
const containerRef =
|
|
5850
|
-
const spanRef =
|
|
5851
|
-
const [xOffset, setXOffset] =
|
|
5852
|
-
const recalculate =
|
|
5842
|
+
const containerRef = React37.useRef(null);
|
|
5843
|
+
const spanRef = React37.useRef(null);
|
|
5844
|
+
const [xOffset, setXOffset] = React37.useState(0);
|
|
5845
|
+
const recalculate = React37.useCallback(() => {
|
|
5853
5846
|
const container = containerRef.current;
|
|
5854
5847
|
const span = spanRef.current;
|
|
5855
5848
|
if (!container || !span || textAlign === "left") {
|
|
@@ -5864,10 +5857,10 @@ function AnimatedPlaceholder({
|
|
|
5864
5857
|
setXOffset(Math.max(0, containerWidth - textWidth));
|
|
5865
5858
|
}
|
|
5866
5859
|
}, [textAlign]);
|
|
5867
|
-
|
|
5860
|
+
React37.useLayoutEffect(() => {
|
|
5868
5861
|
recalculate();
|
|
5869
5862
|
}, [recalculate]);
|
|
5870
|
-
|
|
5863
|
+
React37.useEffect(() => {
|
|
5871
5864
|
const container = containerRef.current;
|
|
5872
5865
|
if (!container) return;
|
|
5873
5866
|
const observer = new ResizeObserver(recalculate);
|
|
@@ -5936,10 +5929,10 @@ function SearchBar({
|
|
|
5936
5929
|
activeIndex
|
|
5937
5930
|
}) {
|
|
5938
5931
|
const shouldReduceMotion = useReducedMotion();
|
|
5939
|
-
const inputRef =
|
|
5940
|
-
const prevActiveRef =
|
|
5941
|
-
const isRestoringFocusRef =
|
|
5942
|
-
|
|
5932
|
+
const inputRef = React37.useRef(null);
|
|
5933
|
+
const prevActiveRef = React37.useRef(active);
|
|
5934
|
+
const isRestoringFocusRef = React37.useRef(false);
|
|
5935
|
+
React37.useEffect(() => {
|
|
5943
5936
|
var _a;
|
|
5944
5937
|
let rafId;
|
|
5945
5938
|
if (prevActiveRef.current === true && active === false) {
|
|
@@ -6058,7 +6051,7 @@ function SearchBar({
|
|
|
6058
6051
|
) })
|
|
6059
6052
|
);
|
|
6060
6053
|
}
|
|
6061
|
-
var SearchContext =
|
|
6054
|
+
var SearchContext = React37.createContext(null);
|
|
6062
6055
|
function SearchProvider({
|
|
6063
6056
|
children,
|
|
6064
6057
|
value
|
|
@@ -6066,7 +6059,7 @@ function SearchProvider({
|
|
|
6066
6059
|
return /* @__PURE__ */ jsx(SearchContext.Provider, { value, children });
|
|
6067
6060
|
}
|
|
6068
6061
|
function useSearch() {
|
|
6069
|
-
const context =
|
|
6062
|
+
const context = React37.useContext(SearchContext);
|
|
6070
6063
|
if (!context) {
|
|
6071
6064
|
return { listboxId: "", activeIndex: -1 };
|
|
6072
6065
|
}
|
|
@@ -6093,7 +6086,7 @@ function useClickOutside(handler, enabled = true) {
|
|
|
6093
6086
|
return ref;
|
|
6094
6087
|
}
|
|
6095
6088
|
function useSearchViewFocus(inputRef, active) {
|
|
6096
|
-
|
|
6089
|
+
React37.useEffect(() => {
|
|
6097
6090
|
if (!active) return;
|
|
6098
6091
|
let raf2;
|
|
6099
6092
|
const raf1 = requestAnimationFrame(() => {
|
|
@@ -6153,11 +6146,11 @@ var ROTATE_KEY_SPLINES = [
|
|
|
6153
6146
|
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";
|
|
6154
6147
|
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";
|
|
6155
6148
|
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";
|
|
6156
|
-
var IndeterminateSvg =
|
|
6149
|
+
var IndeterminateSvg = React37.memo(function IndeterminateSvg2({
|
|
6157
6150
|
size
|
|
6158
6151
|
}) {
|
|
6159
|
-
const [ready, setReady] =
|
|
6160
|
-
|
|
6152
|
+
const [ready, setReady] = React37.useState(false);
|
|
6153
|
+
React37.useEffect(() => {
|
|
6161
6154
|
const raf = requestAnimationFrame(() => setReady(true));
|
|
6162
6155
|
return () => cancelAnimationFrame(raf);
|
|
6163
6156
|
}, []);
|
|
@@ -6202,7 +6195,7 @@ var IndeterminateSvg = React36.memo(function IndeterminateSvg2({
|
|
|
6202
6195
|
}
|
|
6203
6196
|
);
|
|
6204
6197
|
});
|
|
6205
|
-
var DeterminateSvg =
|
|
6198
|
+
var DeterminateSvg = React37.memo(function DeterminateSvg2({
|
|
6206
6199
|
size,
|
|
6207
6200
|
progress
|
|
6208
6201
|
}) {
|
|
@@ -6227,7 +6220,7 @@ var DeterminateSvg = React36.memo(function DeterminateSvg2({
|
|
|
6227
6220
|
}
|
|
6228
6221
|
);
|
|
6229
6222
|
});
|
|
6230
|
-
var LoadingIndicator =
|
|
6223
|
+
var LoadingIndicator = React37.forwardRef(
|
|
6231
6224
|
(_a, ref) => {
|
|
6232
6225
|
var _b = _a, {
|
|
6233
6226
|
variant = "uncontained",
|
|
@@ -6322,27 +6315,39 @@ function generateWavyCircularPath(center, radius, amplitude, wavelength) {
|
|
|
6322
6315
|
if (i === 0) d += `M ${xAt(t0).toFixed(2)} ${yAt(t0).toFixed(2)}`;
|
|
6323
6316
|
d += ` C ${cp1x.toFixed(2)} ${cp1y.toFixed(2)}, ${cp2x.toFixed(2)} ${cp2y.toFixed(2)}, ${xAt(t1).toFixed(2)} ${yAt(t1).toFixed(2)}`;
|
|
6324
6317
|
}
|
|
6325
|
-
d += " Z";
|
|
6326
6318
|
return d;
|
|
6327
6319
|
}
|
|
6328
6320
|
function getSinePath(startX, endX, phase, wl, amp) {
|
|
6329
6321
|
if (startX >= endX) return "";
|
|
6330
|
-
|
|
6331
|
-
|
|
6332
|
-
|
|
6333
|
-
|
|
6334
|
-
|
|
6335
|
-
|
|
6336
|
-
|
|
6337
|
-
|
|
6338
|
-
|
|
6339
|
-
|
|
6322
|
+
if (amp <= 0.01) {
|
|
6323
|
+
return `M ${startX.toFixed(2)} 0 L ${endX.toFixed(2)} 0`;
|
|
6324
|
+
}
|
|
6325
|
+
const safeWl = Math.max(1, wl);
|
|
6326
|
+
const k = 2 * Math.PI / safeWl;
|
|
6327
|
+
const phi = phase / safeWl * 2 * Math.PI;
|
|
6328
|
+
const yAt = (x) => amp * Math.sin(k * x + phi);
|
|
6329
|
+
const dyAt = (x) => amp * k * Math.cos(k * x + phi);
|
|
6330
|
+
const step = safeWl / 4;
|
|
6331
|
+
let d = `M ${startX.toFixed(2)} ${yAt(startX).toFixed(2)}`;
|
|
6332
|
+
let currentX = startX;
|
|
6333
|
+
while (currentX < endX) {
|
|
6334
|
+
const nextX = Math.min(endX, currentX + step);
|
|
6335
|
+
const dx = nextX - currentX;
|
|
6336
|
+
const scale = dx / 3;
|
|
6337
|
+
const y0 = yAt(currentX);
|
|
6338
|
+
const dy0 = dyAt(currentX);
|
|
6339
|
+
const y1 = yAt(nextX);
|
|
6340
|
+
const dy1 = dyAt(nextX);
|
|
6341
|
+
const cp1x = currentX + scale;
|
|
6342
|
+
const cp1y = y0 + scale * dy0;
|
|
6343
|
+
const cp2x = nextX - scale;
|
|
6344
|
+
const cp2y = y1 - scale * dy1;
|
|
6345
|
+
d += ` C ${cp1x.toFixed(2)} ${cp1y.toFixed(2)}, ${cp2x.toFixed(2)} ${cp2y.toFixed(2)}, ${nextX.toFixed(2)} ${y1.toFixed(2)}`;
|
|
6346
|
+
currentX = nextX;
|
|
6340
6347
|
}
|
|
6341
|
-
const yEnd = Math.sin((endX + phase) / wl * 2 * Math.PI) * amp;
|
|
6342
|
-
d += ` L ${endX.toFixed(2)} ${yEnd.toFixed(2)}`;
|
|
6343
6348
|
return d;
|
|
6344
6349
|
}
|
|
6345
|
-
var CircularProgress =
|
|
6350
|
+
var CircularProgress = React37.forwardRef(
|
|
6346
6351
|
(_a, ref) => {
|
|
6347
6352
|
var _b = _a, {
|
|
6348
6353
|
value,
|
|
@@ -6380,15 +6385,15 @@ var CircularProgress = React36.forwardRef(
|
|
|
6380
6385
|
const isWavy = shape === "wavy";
|
|
6381
6386
|
const BASELINE_SIZE = 48;
|
|
6382
6387
|
const scaleFactor = size / BASELINE_SIZE;
|
|
6383
|
-
const effectiveAmplitude =
|
|
6388
|
+
const effectiveAmplitude = React37.useMemo(
|
|
6384
6389
|
() => amplitude != null ? amplitude : 1.6 * scaleFactor,
|
|
6385
6390
|
[amplitude, scaleFactor]
|
|
6386
6391
|
);
|
|
6387
|
-
const effectiveWavelength =
|
|
6392
|
+
const effectiveWavelength = React37.useMemo(
|
|
6388
6393
|
() => wavelength != null ? wavelength : 15 * scaleFactor,
|
|
6389
6394
|
[wavelength, scaleFactor]
|
|
6390
6395
|
);
|
|
6391
|
-
const wavyActivePath =
|
|
6396
|
+
const wavyActivePath = React37.useMemo(
|
|
6392
6397
|
() => isWavy ? generateWavyCircularPath(
|
|
6393
6398
|
center,
|
|
6394
6399
|
radius,
|
|
@@ -6397,8 +6402,8 @@ var CircularProgress = React36.forwardRef(
|
|
|
6397
6402
|
) : null,
|
|
6398
6403
|
[isWavy, center, radius, effectiveAmplitude, effectiveWavelength]
|
|
6399
6404
|
);
|
|
6400
|
-
const circumference =
|
|
6401
|
-
const gapForTrack =
|
|
6405
|
+
const circumference = React37.useMemo(() => 2 * Math.PI * radius, [radius]);
|
|
6406
|
+
const gapForTrack = React37.useMemo(
|
|
6402
6407
|
() => (gapSize + trackHeight) / circumference,
|
|
6403
6408
|
[gapSize, trackHeight, circumference]
|
|
6404
6409
|
);
|
|
@@ -6494,16 +6499,13 @@ var CircularProgress = React36.forwardRef(
|
|
|
6494
6499
|
position: "absolute",
|
|
6495
6500
|
inset: 0,
|
|
6496
6501
|
overflow: "visible",
|
|
6497
|
-
rotate: "-90deg",
|
|
6498
6502
|
transformOrigin: "center"
|
|
6499
6503
|
},
|
|
6500
|
-
animate: { rotate: [
|
|
6504
|
+
animate: { rotate: [0, 360] },
|
|
6501
6505
|
transition: {
|
|
6502
|
-
|
|
6503
|
-
|
|
6504
|
-
|
|
6505
|
-
ease: "linear"
|
|
6506
|
-
}
|
|
6506
|
+
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
6507
|
+
repeat: Number.POSITIVE_INFINITY,
|
|
6508
|
+
ease: "linear"
|
|
6507
6509
|
},
|
|
6508
6510
|
children: [
|
|
6509
6511
|
/* @__PURE__ */ jsx(
|
|
@@ -6516,17 +6518,16 @@ var CircularProgress = React36.forwardRef(
|
|
|
6516
6518
|
stroke: bgTrackColor,
|
|
6517
6519
|
strokeWidth: trackHeight,
|
|
6518
6520
|
strokeLinecap: "round",
|
|
6519
|
-
style: { originX: "50%", originY: "50%" },
|
|
6520
6521
|
animate: {
|
|
6521
6522
|
pathLength: [
|
|
6522
|
-
Math.max(1e-3,
|
|
6523
|
-
Math.max(1e-3,
|
|
6524
|
-
Math.max(1e-3,
|
|
6523
|
+
Math.max(1e-3, 0.9 - 2 * gapForTrack),
|
|
6524
|
+
Math.max(1e-3, 0.25 - 2 * gapForTrack),
|
|
6525
|
+
Math.max(1e-3, 0.9 - 2 * gapForTrack)
|
|
6525
6526
|
],
|
|
6526
|
-
|
|
6527
|
-
|
|
6528
|
-
|
|
6529
|
-
|
|
6527
|
+
pathOffset: [
|
|
6528
|
+
0.1 + gapForTrack,
|
|
6529
|
+
0.75 + gapForTrack,
|
|
6530
|
+
0.1 + gapForTrack
|
|
6530
6531
|
]
|
|
6531
6532
|
},
|
|
6532
6533
|
transition: {
|
|
@@ -6544,10 +6545,9 @@ var CircularProgress = React36.forwardRef(
|
|
|
6544
6545
|
stroke: activeColor,
|
|
6545
6546
|
strokeWidth: trackHeight,
|
|
6546
6547
|
strokeLinecap: "round",
|
|
6547
|
-
style: { originX: "50%", originY: "50%" },
|
|
6548
6548
|
animate: {
|
|
6549
6549
|
pathLength: [0.1, 0.75, 0.1],
|
|
6550
|
-
|
|
6550
|
+
pathOffset: [0, 0.65, 1]
|
|
6551
6551
|
},
|
|
6552
6552
|
transition: {
|
|
6553
6553
|
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
@@ -6565,10 +6565,9 @@ var CircularProgress = React36.forwardRef(
|
|
|
6565
6565
|
stroke: activeColor,
|
|
6566
6566
|
strokeWidth: trackHeight,
|
|
6567
6567
|
strokeLinecap: "round",
|
|
6568
|
-
style: { originX: "50%", originY: "50%" },
|
|
6569
6568
|
animate: {
|
|
6570
6569
|
pathLength: [0.1, 0.75, 0.1],
|
|
6571
|
-
|
|
6570
|
+
pathOffset: [0, 0.65, 1]
|
|
6572
6571
|
},
|
|
6573
6572
|
transition: {
|
|
6574
6573
|
duration: 2 / Math.max(0.1, crawlerSpeed),
|
|
@@ -6587,9 +6586,9 @@ var CircularProgress = React36.forwardRef(
|
|
|
6587
6586
|
);
|
|
6588
6587
|
CircularProgress.displayName = "CircularProgress";
|
|
6589
6588
|
function useContainerWidth() {
|
|
6590
|
-
const [width, setWidth] =
|
|
6591
|
-
const observerRef =
|
|
6592
|
-
const ref =
|
|
6589
|
+
const [width, setWidth] = React37.useState(0);
|
|
6590
|
+
const observerRef = React37.useRef(null);
|
|
6591
|
+
const ref = React37.useCallback((node) => {
|
|
6593
6592
|
if (observerRef.current) {
|
|
6594
6593
|
observerRef.current.disconnect();
|
|
6595
6594
|
observerRef.current = null;
|
|
@@ -6603,7 +6602,7 @@ function useContainerWidth() {
|
|
|
6603
6602
|
observerRef.current = obs;
|
|
6604
6603
|
}
|
|
6605
6604
|
}, []);
|
|
6606
|
-
|
|
6605
|
+
React37.useEffect(() => {
|
|
6607
6606
|
return () => {
|
|
6608
6607
|
if (observerRef.current) {
|
|
6609
6608
|
observerRef.current.disconnect();
|
|
@@ -6613,7 +6612,7 @@ function useContainerWidth() {
|
|
|
6613
6612
|
return [ref, width];
|
|
6614
6613
|
}
|
|
6615
6614
|
function useMergedRef(...refs) {
|
|
6616
|
-
return
|
|
6615
|
+
return React37.useCallback(
|
|
6617
6616
|
(node) => {
|
|
6618
6617
|
for (const ref of refs) {
|
|
6619
6618
|
if (typeof ref === "function") {
|
|
@@ -6627,7 +6626,7 @@ function useMergedRef(...refs) {
|
|
|
6627
6626
|
[refs]
|
|
6628
6627
|
);
|
|
6629
6628
|
}
|
|
6630
|
-
var FlatLinearTrack =
|
|
6629
|
+
var FlatLinearTrack = React37.memo(function FlatLinearTrack2({
|
|
6631
6630
|
trackHeight,
|
|
6632
6631
|
activeColor,
|
|
6633
6632
|
trackColor,
|
|
@@ -6703,7 +6702,7 @@ var FlatLinearTrack = React36.memo(function FlatLinearTrack2({
|
|
|
6703
6702
|
}
|
|
6704
6703
|
);
|
|
6705
6704
|
});
|
|
6706
|
-
var WavyLinearTrack =
|
|
6705
|
+
var WavyLinearTrack = React37.memo(function WavyLinearTrack2({
|
|
6707
6706
|
trackHeight,
|
|
6708
6707
|
svgHeight,
|
|
6709
6708
|
amplitude,
|
|
@@ -6722,13 +6721,13 @@ var WavyLinearTrack = React36.memo(function WavyLinearTrack2({
|
|
|
6722
6721
|
}) {
|
|
6723
6722
|
const isDeterminate = typeof value === "number";
|
|
6724
6723
|
const clampedValue = isDeterminate ? Math.max(0, Math.min(100, value)) : 100;
|
|
6725
|
-
const titleId =
|
|
6724
|
+
const titleId = React37.useId();
|
|
6726
6725
|
const [containerRef, width] = useContainerWidth();
|
|
6727
|
-
const activePathRef =
|
|
6728
|
-
const trackPathRef =
|
|
6726
|
+
const activePathRef = React37.useRef(null);
|
|
6727
|
+
const trackPathRef = React37.useRef(null);
|
|
6729
6728
|
const amplitudeMV = useMotionValue(amplitude);
|
|
6730
6729
|
const fractionMV = useMotionValue(isDeterminate ? clampedValue / 100 : 1);
|
|
6731
|
-
|
|
6730
|
+
React37.useEffect(() => {
|
|
6732
6731
|
if (isDeterminate) {
|
|
6733
6732
|
const fraction = clampedValue / 100;
|
|
6734
6733
|
let targetAmp = amplitude;
|
|
@@ -6741,6 +6740,12 @@ var WavyLinearTrack = React36.memo(function WavyLinearTrack2({
|
|
|
6741
6740
|
duration: 0.5
|
|
6742
6741
|
});
|
|
6743
6742
|
animate(fractionMV, fraction, { duration: 0.4, ease: [0.2, 0, 0, 1] });
|
|
6743
|
+
} else {
|
|
6744
|
+
animate(amplitudeMV, amplitude, {
|
|
6745
|
+
type: "spring",
|
|
6746
|
+
bounce: 0,
|
|
6747
|
+
duration: 0.5
|
|
6748
|
+
});
|
|
6744
6749
|
}
|
|
6745
6750
|
}, [
|
|
6746
6751
|
clampedValue,
|
|
@@ -6754,10 +6759,10 @@ var WavyLinearTrack = React36.memo(function WavyLinearTrack2({
|
|
|
6754
6759
|
1,
|
|
6755
6760
|
isDeterminate ? wavelength : indeterminateWavelength
|
|
6756
6761
|
);
|
|
6757
|
-
const trackAmp = trackShape === "wavy" ? amplitude : 0;
|
|
6758
6762
|
useAnimationFrame((time) => {
|
|
6759
6763
|
if (width === 0) return;
|
|
6760
6764
|
const currentAmp = amplitudeMV.get();
|
|
6765
|
+
const trackAmp = trackShape === "wavy" ? amplitude : 0;
|
|
6761
6766
|
const phase = time / 1e3 * waveSpeed * activeWavelength;
|
|
6762
6767
|
const capWidth = trackHeight / 2;
|
|
6763
6768
|
let activePathD = "";
|
|
@@ -6858,7 +6863,7 @@ var WavyLinearTrack = React36.memo(function WavyLinearTrack2({
|
|
|
6858
6863
|
"div",
|
|
6859
6864
|
{
|
|
6860
6865
|
ref: containerRef,
|
|
6861
|
-
className: "relative w-full
|
|
6866
|
+
className: "relative w-full",
|
|
6862
6867
|
style: { height: svgHeight },
|
|
6863
6868
|
children: width > 0 && /* @__PURE__ */ jsxs(
|
|
6864
6869
|
"svg",
|
|
@@ -6899,7 +6904,7 @@ var WavyLinearTrack = React36.memo(function WavyLinearTrack2({
|
|
|
6899
6904
|
}
|
|
6900
6905
|
);
|
|
6901
6906
|
});
|
|
6902
|
-
var LinearProgress =
|
|
6907
|
+
var LinearProgress = React37.forwardRef(
|
|
6903
6908
|
(_a, ref) => {
|
|
6904
6909
|
var _b = _a, {
|
|
6905
6910
|
value,
|
|
@@ -6912,7 +6917,7 @@ var LinearProgress = React36.forwardRef(
|
|
|
6912
6917
|
waveSpeed = 1,
|
|
6913
6918
|
crawlerSpeed = 1,
|
|
6914
6919
|
determinateAnimation = "md3",
|
|
6915
|
-
indeterminateAnimation = "
|
|
6920
|
+
indeterminateAnimation = "md3",
|
|
6916
6921
|
gapSize = 4,
|
|
6917
6922
|
showStopIndicator = "auto",
|
|
6918
6923
|
color,
|
|
@@ -6940,33 +6945,35 @@ var LinearProgress = React36.forwardRef(
|
|
|
6940
6945
|
]);
|
|
6941
6946
|
const isDeterminate = value !== void 0;
|
|
6942
6947
|
const clampedValue = isDeterminate ? Math.min(100, Math.max(0, value)) : 0;
|
|
6943
|
-
const containerRef =
|
|
6948
|
+
const containerRef = React37.useRef(null);
|
|
6944
6949
|
const mergedRef = useMergedRef(ref, containerRef);
|
|
6945
|
-
const [isRtl, setIsRtl] =
|
|
6946
|
-
|
|
6950
|
+
const [isRtl, setIsRtl] = React37.useState(false);
|
|
6951
|
+
React37.useEffect(() => {
|
|
6947
6952
|
if (containerRef.current) {
|
|
6948
6953
|
const dir = getComputedStyle(containerRef.current).direction;
|
|
6949
6954
|
setIsRtl(dir === "rtl");
|
|
6950
6955
|
}
|
|
6951
6956
|
}, []);
|
|
6952
|
-
const isWavy = shape === "wavy";
|
|
6953
6957
|
const resolvedTrackShape = trackShape != null ? trackShape : shape;
|
|
6954
|
-
const
|
|
6955
|
-
const
|
|
6958
|
+
const isWavy = shape === "wavy" || resolvedTrackShape === "wavy";
|
|
6959
|
+
const effectiveAmplitude = React37.useMemo(() => amplitude != null ? amplitude : 3, [amplitude]);
|
|
6960
|
+
const svgHeight = React37.useMemo(
|
|
6956
6961
|
() => isWavy ? trackHeight + effectiveAmplitude * 2 : trackHeight,
|
|
6957
6962
|
[isWavy, trackHeight, effectiveAmplitude]
|
|
6958
6963
|
);
|
|
6959
|
-
const shouldShowStop =
|
|
6960
|
-
() => isDeterminate && resolvedTrackShape === "flat" &&
|
|
6964
|
+
const shouldShowStop = React37.useMemo(
|
|
6965
|
+
() => isDeterminate && resolvedTrackShape === "flat" && showStopIndicator !== false,
|
|
6961
6966
|
[isDeterminate, resolvedTrackShape, showStopIndicator]
|
|
6962
6967
|
);
|
|
6963
|
-
const stopSize =
|
|
6968
|
+
const stopSize = React37.useMemo(
|
|
6964
6969
|
() => Math.max(2, trackHeight > 4 ? 4 : trackHeight / 2),
|
|
6965
6970
|
[trackHeight]
|
|
6966
6971
|
);
|
|
6967
6972
|
const stopOffset = (trackHeight - stopSize) / 2;
|
|
6968
6973
|
const activeColor = color || "var(--md-sys-color-indicator-active)";
|
|
6969
6974
|
const bgTrackColor = trackColor || "var(--md-sys-color-indicator-track)";
|
|
6975
|
+
const useWavyTrack = isWavy || !isDeterminate;
|
|
6976
|
+
const trackAmp = isWavy ? effectiveAmplitude : 0;
|
|
6970
6977
|
return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: /* @__PURE__ */ jsxs(
|
|
6971
6978
|
"div",
|
|
6972
6979
|
__spreadProps(__spreadValues({
|
|
@@ -6983,12 +6990,12 @@ var LinearProgress = React36.forwardRef(
|
|
|
6983
6990
|
style: { height: svgHeight }
|
|
6984
6991
|
}, restProps), {
|
|
6985
6992
|
children: [
|
|
6986
|
-
|
|
6993
|
+
useWavyTrack ? /* @__PURE__ */ jsx(
|
|
6987
6994
|
WavyLinearTrack,
|
|
6988
6995
|
{
|
|
6989
6996
|
trackHeight,
|
|
6990
6997
|
svgHeight,
|
|
6991
|
-
amplitude:
|
|
6998
|
+
amplitude: trackAmp,
|
|
6992
6999
|
wavelength,
|
|
6993
7000
|
indeterminateWavelength,
|
|
6994
7001
|
activeColor,
|
|
@@ -7033,7 +7040,7 @@ var LinearProgress = React36.forwardRef(
|
|
|
7033
7040
|
}
|
|
7034
7041
|
);
|
|
7035
7042
|
LinearProgress.displayName = "LinearProgress";
|
|
7036
|
-
var ProgressIndicator =
|
|
7043
|
+
var ProgressIndicator = React37.forwardRef((props, ref) => {
|
|
7037
7044
|
if (props.variant === "circular") {
|
|
7038
7045
|
return /* @__PURE__ */ jsx(CircularProgress, __spreadValues({ ref }, props));
|
|
7039
7046
|
}
|
|
@@ -7165,7 +7172,7 @@ function resolveDisabledBgClass(colorStyle) {
|
|
|
7165
7172
|
}
|
|
7166
7173
|
return "disabled:text-m3-on-surface/[0.38]";
|
|
7167
7174
|
}
|
|
7168
|
-
var IconButtonComponent =
|
|
7175
|
+
var IconButtonComponent = React37.forwardRef(
|
|
7169
7176
|
(_a, ref) => {
|
|
7170
7177
|
var _b = _a, {
|
|
7171
7178
|
className,
|
|
@@ -7207,18 +7214,18 @@ var IconButtonComponent = React36.forwardRef(
|
|
|
7207
7214
|
var _a2, _b2, _c, _d, _e;
|
|
7208
7215
|
const isToggle = variant === "toggle";
|
|
7209
7216
|
const isSelected = isToggle && !!selected;
|
|
7210
|
-
const resolvedColorClass =
|
|
7217
|
+
const resolvedColorClass = React37.useMemo(
|
|
7211
7218
|
() => isSelected ? colorStyles[colorStyle].selected : colorStyles[colorStyle].default,
|
|
7212
7219
|
[isSelected, colorStyle]
|
|
7213
7220
|
);
|
|
7214
|
-
const outlineWidthClass =
|
|
7221
|
+
const outlineWidthClass = React37.useMemo(
|
|
7215
7222
|
() => {
|
|
7216
7223
|
var _a3;
|
|
7217
7224
|
return colorStyle === "outlined" && !isSelected ? (_a3 = SIZE_OUTLINE_WIDTH[size]) != null ? _a3 : "border" : "";
|
|
7218
7225
|
},
|
|
7219
7226
|
[colorStyle, isSelected, size]
|
|
7220
7227
|
);
|
|
7221
|
-
const disabledBgClass =
|
|
7228
|
+
const disabledBgClass = React37.useMemo(
|
|
7222
7229
|
() => resolveDisabledBgClass(colorStyle),
|
|
7223
7230
|
[colorStyle]
|
|
7224
7231
|
);
|
|
@@ -7241,7 +7248,7 @@ var IconButtonComponent = React36.forwardRef(
|
|
|
7241
7248
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
7242
7249
|
disabled: loading
|
|
7243
7250
|
});
|
|
7244
|
-
const handleClick =
|
|
7251
|
+
const handleClick = React37.useCallback(
|
|
7245
7252
|
(e) => {
|
|
7246
7253
|
if (loading) {
|
|
7247
7254
|
e.preventDefault();
|
|
@@ -7251,7 +7258,7 @@ var IconButtonComponent = React36.forwardRef(
|
|
|
7251
7258
|
},
|
|
7252
7259
|
[loading, onClick]
|
|
7253
7260
|
);
|
|
7254
|
-
const handleKeyDown =
|
|
7261
|
+
const handleKeyDown = React37.useCallback(
|
|
7255
7262
|
(e) => {
|
|
7256
7263
|
if (loading) return;
|
|
7257
7264
|
if ((e.key === "Enter" || e.key === " ") && onClick) {
|
|
@@ -7307,7 +7314,7 @@ var IconButtonComponent = React36.forwardRef(
|
|
|
7307
7314
|
width: isCustomSize ? `${iconSize}px` : void 0,
|
|
7308
7315
|
height: isCustomSize ? `${iconSize}px` : void 0
|
|
7309
7316
|
},
|
|
7310
|
-
children: isSelected && selectedIcon ? selectedIcon : asChild ?
|
|
7317
|
+
children: isSelected && selectedIcon ? selectedIcon : asChild ? React37.Children.only(children).props.children : children
|
|
7311
7318
|
}),
|
|
7312
7319
|
isSelected && selectedIcon ? "selected-content" : "content"
|
|
7313
7320
|
) })
|
|
@@ -7324,7 +7331,7 @@ var IconButtonComponent = React36.forwardRef(
|
|
|
7324
7331
|
className
|
|
7325
7332
|
);
|
|
7326
7333
|
if (asChild) {
|
|
7327
|
-
const child =
|
|
7334
|
+
const child = React37.Children.only(children);
|
|
7328
7335
|
return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: /* @__PURE__ */ jsx(
|
|
7329
7336
|
Slot,
|
|
7330
7337
|
__spreadProps(__spreadValues({
|
|
@@ -7341,7 +7348,7 @@ var IconButtonComponent = React36.forwardRef(
|
|
|
7341
7348
|
}),
|
|
7342
7349
|
className: containerClassName
|
|
7343
7350
|
}, restProps), {
|
|
7344
|
-
children:
|
|
7351
|
+
children: React37.cloneElement(child, { children: innerContent })
|
|
7345
7352
|
})
|
|
7346
7353
|
) });
|
|
7347
7354
|
}
|
|
@@ -7369,7 +7376,7 @@ var IconButtonComponent = React36.forwardRef(
|
|
|
7369
7376
|
}
|
|
7370
7377
|
);
|
|
7371
7378
|
IconButtonComponent.displayName = "IconButton";
|
|
7372
|
-
var IconButton =
|
|
7379
|
+
var IconButton = React37.memo(IconButtonComponent);
|
|
7373
7380
|
function TrailingAction({
|
|
7374
7381
|
query,
|
|
7375
7382
|
trailingIcon,
|
|
@@ -7429,7 +7436,7 @@ function SearchViewDocked({
|
|
|
7429
7436
|
activeIndex
|
|
7430
7437
|
}) {
|
|
7431
7438
|
const shouldReduceMotion = useReducedMotion();
|
|
7432
|
-
const inputRef =
|
|
7439
|
+
const inputRef = React37.useRef(null);
|
|
7433
7440
|
useSearchViewFocus(inputRef, active);
|
|
7434
7441
|
const dropdownRef = useClickOutside(() => {
|
|
7435
7442
|
onActiveChange(false);
|
|
@@ -7575,10 +7582,10 @@ function SearchViewFullScreen({
|
|
|
7575
7582
|
activeIndex
|
|
7576
7583
|
}) {
|
|
7577
7584
|
const shouldReduceMotion = useReducedMotion();
|
|
7578
|
-
const inputRef =
|
|
7585
|
+
const inputRef = React37.useRef(null);
|
|
7579
7586
|
useSearchViewFocus(inputRef, active);
|
|
7580
|
-
const [mounted, setMounted] =
|
|
7581
|
-
|
|
7587
|
+
const [mounted, setMounted] = React37.useState(false);
|
|
7588
|
+
React37.useEffect(() => {
|
|
7582
7589
|
setMounted(true);
|
|
7583
7590
|
}, []);
|
|
7584
7591
|
const handleFormSubmit = (e) => {
|
|
@@ -7736,10 +7743,10 @@ function SearchComponent({
|
|
|
7736
7743
|
className,
|
|
7737
7744
|
viewClassName
|
|
7738
7745
|
}) {
|
|
7739
|
-
const generatedId =
|
|
7746
|
+
const generatedId = React37.useId();
|
|
7740
7747
|
const searchId = id != null ? id : generatedId;
|
|
7741
7748
|
const listboxId = `${searchId}-listbox`;
|
|
7742
|
-
const itemCount =
|
|
7749
|
+
const itemCount = React37.Children.count(children);
|
|
7743
7750
|
const { activeIndex, handleKeyDown } = useSearchKeyboard({
|
|
7744
7751
|
active,
|
|
7745
7752
|
onActiveChange,
|
|
@@ -7798,9 +7805,9 @@ function formatBadgeLabel(children, max) {
|
|
|
7798
7805
|
return "";
|
|
7799
7806
|
}
|
|
7800
7807
|
function detectBadgeHasContent(badge) {
|
|
7801
|
-
return
|
|
7808
|
+
return React37.isValidElement(badge) && badge.props.children != null;
|
|
7802
7809
|
}
|
|
7803
|
-
var BadgeImpl =
|
|
7810
|
+
var BadgeImpl = React37.forwardRef(
|
|
7804
7811
|
(_a, ref) => {
|
|
7805
7812
|
var _b = _a, {
|
|
7806
7813
|
children,
|
|
@@ -7854,7 +7861,7 @@ var BadgeImpl = React36.forwardRef(
|
|
|
7854
7861
|
}
|
|
7855
7862
|
);
|
|
7856
7863
|
BadgeImpl.displayName = "Badge";
|
|
7857
|
-
|
|
7864
|
+
React37.memo(BadgeImpl);
|
|
7858
7865
|
function BadgedBox({
|
|
7859
7866
|
badge,
|
|
7860
7867
|
children,
|
|
@@ -7875,9 +7882,9 @@ function BadgedBox({
|
|
|
7875
7882
|
)
|
|
7876
7883
|
] });
|
|
7877
7884
|
}
|
|
7878
|
-
var TabsContext =
|
|
7885
|
+
var TabsContext = React37.createContext(null);
|
|
7879
7886
|
function useTabsContext() {
|
|
7880
|
-
const ctx =
|
|
7887
|
+
const ctx = React37.useContext(TabsContext);
|
|
7881
7888
|
if (!ctx) {
|
|
7882
7889
|
throw new Error(
|
|
7883
7890
|
"[MD3 Tabs] Component must be used within a <Tabs> root. Ensure <TabsList>, <Tab>, and <TabsContent> are descendants of <Tabs>."
|
|
@@ -7885,7 +7892,7 @@ function useTabsContext() {
|
|
|
7885
7892
|
}
|
|
7886
7893
|
return ctx;
|
|
7887
7894
|
}
|
|
7888
|
-
var TabsComponent =
|
|
7895
|
+
var TabsComponent = React37.forwardRef(
|
|
7889
7896
|
({
|
|
7890
7897
|
value: controlledValue,
|
|
7891
7898
|
defaultValue = "",
|
|
@@ -7894,35 +7901,35 @@ var TabsComponent = React36.forwardRef(
|
|
|
7894
7901
|
children,
|
|
7895
7902
|
className
|
|
7896
7903
|
}, ref) => {
|
|
7897
|
-
const [internalValue, setInternalValue] =
|
|
7904
|
+
const [internalValue, setInternalValue] = React37.useState(defaultValue);
|
|
7898
7905
|
const isControlled = controlledValue !== void 0;
|
|
7899
7906
|
const value = isControlled ? controlledValue : internalValue;
|
|
7900
|
-
const handleValueChange =
|
|
7907
|
+
const handleValueChange = React37.useCallback(
|
|
7901
7908
|
(newValue) => {
|
|
7902
7909
|
if (!isControlled) setInternalValue(newValue);
|
|
7903
7910
|
onValueChange == null ? void 0 : onValueChange(newValue);
|
|
7904
7911
|
},
|
|
7905
7912
|
[isControlled, onValueChange]
|
|
7906
7913
|
);
|
|
7907
|
-
const [focusedValue, setFocusedValue] =
|
|
7908
|
-
|
|
7914
|
+
const [focusedValue, setFocusedValue] = React37.useState(value);
|
|
7915
|
+
React37.useEffect(() => {
|
|
7909
7916
|
setFocusedValue(value);
|
|
7910
7917
|
}, [value]);
|
|
7911
|
-
const [tabValues, setTabValues] =
|
|
7912
|
-
const registerTab =
|
|
7918
|
+
const [tabValues, setTabValues] = React37.useState([]);
|
|
7919
|
+
const registerTab = React37.useCallback((tabValue) => {
|
|
7913
7920
|
setTabValues((prev) => {
|
|
7914
7921
|
if (prev.includes(tabValue)) return prev;
|
|
7915
7922
|
return [...prev, tabValue];
|
|
7916
7923
|
});
|
|
7917
7924
|
}, []);
|
|
7918
|
-
const unregisterTab =
|
|
7925
|
+
const unregisterTab = React37.useCallback((tabValue) => {
|
|
7919
7926
|
setTabValues((prev) => prev.filter((v) => v !== tabValue));
|
|
7920
7927
|
}, []);
|
|
7921
|
-
const hasAutoSelected =
|
|
7922
|
-
const [disabledValues, setDisabledValues] =
|
|
7928
|
+
const hasAutoSelected = React37.useRef(false);
|
|
7929
|
+
const [disabledValues, setDisabledValues] = React37.useState(
|
|
7923
7930
|
/* @__PURE__ */ new Set()
|
|
7924
7931
|
);
|
|
7925
|
-
const markTabDisabled =
|
|
7932
|
+
const markTabDisabled = React37.useCallback(
|
|
7926
7933
|
(tabValue, disabled) => {
|
|
7927
7934
|
setDisabledValues((prev) => {
|
|
7928
7935
|
const next = new Set(prev);
|
|
@@ -7936,7 +7943,7 @@ var TabsComponent = React36.forwardRef(
|
|
|
7936
7943
|
},
|
|
7937
7944
|
[]
|
|
7938
7945
|
);
|
|
7939
|
-
|
|
7946
|
+
React37.useEffect(() => {
|
|
7940
7947
|
if (isControlled || hasAutoSelected.current || tabValues.length === 0) {
|
|
7941
7948
|
return;
|
|
7942
7949
|
}
|
|
@@ -7951,9 +7958,9 @@ var TabsComponent = React36.forwardRef(
|
|
|
7951
7958
|
setFocusedValue(firstEnabled);
|
|
7952
7959
|
}
|
|
7953
7960
|
}, [tabValues, disabledValues, isControlled, value]);
|
|
7954
|
-
const id =
|
|
7961
|
+
const id = React37.useId();
|
|
7955
7962
|
const layoutGroupId = `tabs-${id}`;
|
|
7956
|
-
const contextValue =
|
|
7963
|
+
const contextValue = React37.useMemo(
|
|
7957
7964
|
() => ({
|
|
7958
7965
|
value,
|
|
7959
7966
|
onValueChange: handleValueChange,
|
|
@@ -7984,12 +7991,12 @@ var TabsComponent = React36.forwardRef(
|
|
|
7984
7991
|
}
|
|
7985
7992
|
);
|
|
7986
7993
|
TabsComponent.displayName = "Tabs";
|
|
7987
|
-
var Tabs =
|
|
7988
|
-
var TabsListContext =
|
|
7994
|
+
var Tabs = React37.memo(TabsComponent);
|
|
7995
|
+
var TabsListContext = React37.createContext(
|
|
7989
7996
|
null
|
|
7990
7997
|
);
|
|
7991
7998
|
function useTabsListContext() {
|
|
7992
|
-
const ctx =
|
|
7999
|
+
const ctx = React37.useContext(TabsListContext);
|
|
7993
8000
|
return ctx != null ? ctx : { variant: "primary", scrollable: false };
|
|
7994
8001
|
}
|
|
7995
8002
|
|
|
@@ -8073,7 +8080,7 @@ var TABS_CONTENT_TRANSITION = {
|
|
|
8073
8080
|
ease: "easeInOut"
|
|
8074
8081
|
};
|
|
8075
8082
|
var INDICATOR_MIN_WIDTH = 24;
|
|
8076
|
-
var TabComponent =
|
|
8083
|
+
var TabComponent = React37.forwardRef(
|
|
8077
8084
|
({
|
|
8078
8085
|
value,
|
|
8079
8086
|
icon,
|
|
@@ -8103,9 +8110,9 @@ var TabComponent = React36.forwardRef(
|
|
|
8103
8110
|
const isFocused = focusedValue === value;
|
|
8104
8111
|
const hasIcon = icon != null;
|
|
8105
8112
|
const isStackedIcon = hasIcon && !inlineIcon;
|
|
8106
|
-
const buttonRef =
|
|
8107
|
-
const isFirstMount =
|
|
8108
|
-
const mergedRef =
|
|
8113
|
+
const buttonRef = React37.useRef(null);
|
|
8114
|
+
const isFirstMount = React37.useRef(true);
|
|
8115
|
+
const mergedRef = React37.useCallback(
|
|
8109
8116
|
(node) => {
|
|
8110
8117
|
buttonRef.current = node;
|
|
8111
8118
|
if (typeof ref === "function") ref(node);
|
|
@@ -8113,15 +8120,15 @@ var TabComponent = React36.forwardRef(
|
|
|
8113
8120
|
},
|
|
8114
8121
|
[ref]
|
|
8115
8122
|
);
|
|
8116
|
-
|
|
8123
|
+
React37.useEffect(() => {
|
|
8117
8124
|
registerTab(value);
|
|
8118
8125
|
return () => unregisterTab(value);
|
|
8119
8126
|
}, [value, registerTab, unregisterTab]);
|
|
8120
|
-
|
|
8127
|
+
React37.useEffect(() => {
|
|
8121
8128
|
markTabDisabled(value, disabled);
|
|
8122
8129
|
return () => markTabDisabled(value, false);
|
|
8123
8130
|
}, [value, disabled, markTabDisabled]);
|
|
8124
|
-
const handleKeyDown =
|
|
8131
|
+
const handleKeyDown = React37.useCallback(
|
|
8125
8132
|
(e) => {
|
|
8126
8133
|
const isRtl = buttonRef.current ? getComputedStyle(buttonRef.current).direction === "rtl" : false;
|
|
8127
8134
|
const enabledValues = tabValues.filter((v) => !disabledValues.has(v));
|
|
@@ -8175,7 +8182,7 @@ var TabComponent = React36.forwardRef(
|
|
|
8175
8182
|
autoActivate
|
|
8176
8183
|
]
|
|
8177
8184
|
);
|
|
8178
|
-
|
|
8185
|
+
React37.useEffect(() => {
|
|
8179
8186
|
if (isFirstMount.current) {
|
|
8180
8187
|
isFirstMount.current = false;
|
|
8181
8188
|
return;
|
|
@@ -8184,7 +8191,7 @@ var TabComponent = React36.forwardRef(
|
|
|
8184
8191
|
buttonRef.current.focus({ preventScroll: true });
|
|
8185
8192
|
}
|
|
8186
8193
|
}, [isFocused]);
|
|
8187
|
-
|
|
8194
|
+
React37.useEffect(() => {
|
|
8188
8195
|
if (!isActive || !scrollable || !buttonRef.current) return;
|
|
8189
8196
|
const btn = buttonRef.current;
|
|
8190
8197
|
let container = btn.parentElement;
|
|
@@ -8321,8 +8328,8 @@ var TabComponent = React36.forwardRef(
|
|
|
8321
8328
|
}
|
|
8322
8329
|
);
|
|
8323
8330
|
TabComponent.displayName = "Tab";
|
|
8324
|
-
var Tab =
|
|
8325
|
-
var TabsContentComponent =
|
|
8331
|
+
var Tab = React37.memo(TabComponent);
|
|
8332
|
+
var TabsContentComponent = React37.forwardRef(
|
|
8326
8333
|
({ value, className, children }, ref) => {
|
|
8327
8334
|
var _a;
|
|
8328
8335
|
const { value: selectedValue, layoutGroupId } = useTabsContext();
|
|
@@ -8356,8 +8363,8 @@ var TabsContentComponent = React36.forwardRef(
|
|
|
8356
8363
|
}
|
|
8357
8364
|
);
|
|
8358
8365
|
TabsContentComponent.displayName = "TabsContent";
|
|
8359
|
-
var TabsContent =
|
|
8360
|
-
var TabsListComponent =
|
|
8366
|
+
var TabsContent = React37.memo(TabsContentComponent);
|
|
8367
|
+
var TabsListComponent = React37.forwardRef(
|
|
8361
8368
|
({
|
|
8362
8369
|
variant,
|
|
8363
8370
|
scrollable = false,
|
|
@@ -8368,12 +8375,12 @@ var TabsListComponent = React36.forwardRef(
|
|
|
8368
8375
|
}, ref) => {
|
|
8369
8376
|
const { layoutGroupId, value, setFocusedValue } = useTabsContext();
|
|
8370
8377
|
const listLayoutId = `${layoutGroupId}-list`;
|
|
8371
|
-
const listContextValue =
|
|
8378
|
+
const listContextValue = React37.useMemo(
|
|
8372
8379
|
() => ({ variant, scrollable }),
|
|
8373
8380
|
[variant, scrollable]
|
|
8374
8381
|
);
|
|
8375
8382
|
const bgColor = backgroundColor != null ? backgroundColor : "var(--md-sys-color-surface)";
|
|
8376
|
-
const handleBlur =
|
|
8383
|
+
const handleBlur = React37.useCallback(
|
|
8377
8384
|
(e) => {
|
|
8378
8385
|
const listEl = e.currentTarget;
|
|
8379
8386
|
if (listEl.contains(e.relatedTarget)) return;
|
|
@@ -8422,7 +8429,7 @@ var TabsListComponent = React36.forwardRef(
|
|
|
8422
8429
|
}
|
|
8423
8430
|
);
|
|
8424
8431
|
TabsListComponent.displayName = "TabsList";
|
|
8425
|
-
var TabsList =
|
|
8432
|
+
var TabsList = React37.memo(TabsListComponent);
|
|
8426
8433
|
|
|
8427
8434
|
// src/ui/toolbar/toolbar-colors.ts
|
|
8428
8435
|
var standardFloatingToolbarColors = {
|
|
@@ -8478,13 +8485,13 @@ function getToolbarColors(variant = "standard", customColors) {
|
|
|
8478
8485
|
return standardFloatingToolbarColors;
|
|
8479
8486
|
}
|
|
8480
8487
|
}
|
|
8481
|
-
var ToolbarContext =
|
|
8488
|
+
var ToolbarContext = React37.createContext(
|
|
8482
8489
|
null
|
|
8483
8490
|
);
|
|
8484
8491
|
function useToolbarContext() {
|
|
8485
|
-
return
|
|
8492
|
+
return React37.useContext(ToolbarContext);
|
|
8486
8493
|
}
|
|
8487
|
-
var BottomDockedToolbar =
|
|
8494
|
+
var BottomDockedToolbar = React37.forwardRef(
|
|
8488
8495
|
(_a, ref) => {
|
|
8489
8496
|
var _b = _a, {
|
|
8490
8497
|
variant = "standard",
|
|
@@ -8517,8 +8524,8 @@ var BottomDockedToolbar = React36.forwardRef(
|
|
|
8517
8524
|
const { scrollY } = useScroll(
|
|
8518
8525
|
scrollContainerRef ? { container: scrollContainerRef } : void 0
|
|
8519
8526
|
);
|
|
8520
|
-
const [isHidden, setIsHidden] =
|
|
8521
|
-
const lastScrollY =
|
|
8527
|
+
const [isHidden, setIsHidden] = React37.useState(false);
|
|
8528
|
+
const lastScrollY = React37.useRef(0);
|
|
8522
8529
|
useMotionValueEvent(scrollY, "change", (latest) => {
|
|
8523
8530
|
if (!hideOnScroll) return;
|
|
8524
8531
|
const diff = latest - lastScrollY.current;
|
|
@@ -8677,15 +8684,15 @@ function buildSlotVariants(xHidden, yHidden, isHorizontal) {
|
|
|
8677
8684
|
};
|
|
8678
8685
|
}
|
|
8679
8686
|
function applyItemClassName(nodes, itemClassName) {
|
|
8680
|
-
return
|
|
8681
|
-
if (!
|
|
8687
|
+
return React37.Children.map(nodes, (child) => {
|
|
8688
|
+
if (!React37.isValidElement(child)) return child;
|
|
8682
8689
|
const element = child;
|
|
8683
|
-
return
|
|
8690
|
+
return React37.cloneElement(element, {
|
|
8684
8691
|
className: cn(element.props.className, itemClassName)
|
|
8685
8692
|
});
|
|
8686
8693
|
});
|
|
8687
8694
|
}
|
|
8688
|
-
var FloatingToolbarBase =
|
|
8695
|
+
var FloatingToolbarBase = React37.forwardRef(
|
|
8689
8696
|
(_a, ref) => {
|
|
8690
8697
|
var _b = _a, {
|
|
8691
8698
|
expanded,
|
|
@@ -8857,11 +8864,11 @@ var FloatingToolbarBase = React36.forwardRef(
|
|
|
8857
8864
|
}
|
|
8858
8865
|
);
|
|
8859
8866
|
FloatingToolbarBase.displayName = "FloatingToolbarBase";
|
|
8860
|
-
var HorizontalFloatingToolbar =
|
|
8867
|
+
var HorizontalFloatingToolbar = React37.forwardRef((props, ref) => /* @__PURE__ */ jsx(FloatingToolbarBase, __spreadValues({ ref, orientation: "horizontal" }, props)));
|
|
8861
8868
|
HorizontalFloatingToolbar.displayName = "HorizontalFloatingToolbar";
|
|
8862
|
-
var VerticalFloatingToolbar =
|
|
8869
|
+
var VerticalFloatingToolbar = React37.forwardRef((props, ref) => /* @__PURE__ */ jsx(FloatingToolbarBase, __spreadValues({ ref, orientation: "vertical" }, props)));
|
|
8863
8870
|
VerticalFloatingToolbar.displayName = "VerticalFloatingToolbar";
|
|
8864
|
-
var FloatingToolbarWithFabBase =
|
|
8871
|
+
var FloatingToolbarWithFabBase = React37.forwardRef(
|
|
8865
8872
|
(_a, ref) => {
|
|
8866
8873
|
var _b = _a, {
|
|
8867
8874
|
expanded,
|
|
@@ -8989,9 +8996,9 @@ var FloatingToolbarWithFabBase = React36.forwardRef(
|
|
|
8989
8996
|
}
|
|
8990
8997
|
);
|
|
8991
8998
|
FloatingToolbarWithFabBase.displayName = "FloatingToolbarWithFabBase";
|
|
8992
|
-
var HorizontalFloatingToolbarWithFab =
|
|
8999
|
+
var HorizontalFloatingToolbarWithFab = React37.forwardRef((props, ref) => /* @__PURE__ */ jsx(FloatingToolbarWithFabBase, __spreadValues({ ref, orientation: "horizontal" }, props)));
|
|
8993
9000
|
HorizontalFloatingToolbarWithFab.displayName = "HorizontalFloatingToolbarWithFab";
|
|
8994
|
-
var VerticalFloatingToolbarWithFab =
|
|
9001
|
+
var VerticalFloatingToolbarWithFab = React37.forwardRef((props, ref) => /* @__PURE__ */ jsx(FloatingToolbarWithFabBase, __spreadValues({ ref, orientation: "vertical" }, props)));
|
|
8995
9002
|
VerticalFloatingToolbarWithFab.displayName = "VerticalFloatingToolbarWithFab";
|
|
8996
9003
|
var ToolbarDivider = ({
|
|
8997
9004
|
orientation: propsOrientation,
|
|
@@ -9027,7 +9034,7 @@ var VARIANT_TO_COLOR_STYLE = {
|
|
|
9027
9034
|
tonal: "tonal",
|
|
9028
9035
|
filled: "filled"
|
|
9029
9036
|
};
|
|
9030
|
-
var ToolbarIconButton =
|
|
9037
|
+
var ToolbarIconButton = React37.forwardRef(
|
|
9031
9038
|
(_a, ref) => {
|
|
9032
9039
|
var _b = _a, {
|
|
9033
9040
|
emphasis = "standard",
|
|
@@ -9199,7 +9206,7 @@ var MOTION_PROP_KEYS = [
|
|
|
9199
9206
|
"layoutId",
|
|
9200
9207
|
"onLayoutAnimationComplete"
|
|
9201
9208
|
];
|
|
9202
|
-
var ToolbarToggleButton =
|
|
9209
|
+
var ToolbarToggleButton = React37.forwardRef(
|
|
9203
9210
|
(_a, ref) => {
|
|
9204
9211
|
var _b = _a, {
|
|
9205
9212
|
emphasis = "standard",
|
|
@@ -9233,7 +9240,7 @@ var ToolbarToggleButton = React36.forwardRef(
|
|
|
9233
9240
|
"onPointerLeave"
|
|
9234
9241
|
]);
|
|
9235
9242
|
const context = useToolbarContext();
|
|
9236
|
-
const [isPressed, setIsPressed] =
|
|
9243
|
+
const [isPressed, setIsPressed] = React37.useState(false);
|
|
9237
9244
|
const {
|
|
9238
9245
|
ripples,
|
|
9239
9246
|
onPointerDown: handleRipplePointerDown,
|
|
@@ -9241,7 +9248,7 @@ var ToolbarToggleButton = React36.forwardRef(
|
|
|
9241
9248
|
} = useRippleState({
|
|
9242
9249
|
disabled: Boolean(disabled) || !ripple
|
|
9243
9250
|
});
|
|
9244
|
-
const handlePointerDown =
|
|
9251
|
+
const handlePointerDown = React37.useCallback(
|
|
9245
9252
|
(e) => {
|
|
9246
9253
|
setIsPressed(true);
|
|
9247
9254
|
if (!disabled && ripple) {
|
|
@@ -9251,14 +9258,14 @@ var ToolbarToggleButton = React36.forwardRef(
|
|
|
9251
9258
|
},
|
|
9252
9259
|
[disabled, ripple, handleRipplePointerDown, onPointerDownProp]
|
|
9253
9260
|
);
|
|
9254
|
-
const handlePointerUp =
|
|
9261
|
+
const handlePointerUp = React37.useCallback(
|
|
9255
9262
|
(e) => {
|
|
9256
9263
|
setIsPressed(false);
|
|
9257
9264
|
onPointerUpProp == null ? void 0 : onPointerUpProp(e);
|
|
9258
9265
|
},
|
|
9259
9266
|
[onPointerUpProp]
|
|
9260
9267
|
);
|
|
9261
|
-
const handlePointerLeave =
|
|
9268
|
+
const handlePointerLeave = React37.useCallback(
|
|
9262
9269
|
(e) => {
|
|
9263
9270
|
setIsPressed(false);
|
|
9264
9271
|
onPointerLeaveProp == null ? void 0 : onPointerLeaveProp(e);
|
|
@@ -9277,14 +9284,14 @@ var ToolbarToggleButton = React36.forwardRef(
|
|
|
9277
9284
|
context == null ? void 0 : context.itemClassName,
|
|
9278
9285
|
className
|
|
9279
9286
|
);
|
|
9280
|
-
const animateConfig =
|
|
9287
|
+
const animateConfig = React37.useMemo(
|
|
9281
9288
|
() => ({
|
|
9282
9289
|
scaleX: pressExpand && isPressed ? 1 + pressExpandRatio : 1,
|
|
9283
9290
|
borderRadius: isPressed ? ToolbarToggleButtonRadiusTokens.pressedRadius : ToolbarToggleButtonRadiusTokens.pillRadius
|
|
9284
9291
|
}),
|
|
9285
9292
|
[pressExpand, pressExpandRatio, isPressed]
|
|
9286
9293
|
);
|
|
9287
|
-
const transitionConfig =
|
|
9294
|
+
const transitionConfig = React37.useMemo(
|
|
9288
9295
|
() => ({
|
|
9289
9296
|
scaleX: FAST_SPATIAL_SPRING,
|
|
9290
9297
|
borderRadius: BUTTON_RADIUS_SPRING
|
|
@@ -9306,7 +9313,7 @@ var ToolbarToggleButton = React36.forwardRef(
|
|
|
9306
9313
|
children && (typeof children === "string" || typeof children === "number" ? /* @__PURE__ */ jsx("span", { children }) : children)
|
|
9307
9314
|
] });
|
|
9308
9315
|
if (asChild) {
|
|
9309
|
-
const child =
|
|
9316
|
+
const child = React37.Children.only(children);
|
|
9310
9317
|
const childContent = child.props.children;
|
|
9311
9318
|
const innerChildContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9312
9319
|
ripple && /* @__PURE__ */ jsx(
|
|
@@ -9345,7 +9352,7 @@ var ToolbarToggleButton = React36.forwardRef(
|
|
|
9345
9352
|
onPointerUp: handlePointerUp,
|
|
9346
9353
|
onPointerLeave: handlePointerLeave
|
|
9347
9354
|
}, strippedProps), {
|
|
9348
|
-
children:
|
|
9355
|
+
children: React37.cloneElement(child, { children: innerChildContent })
|
|
9349
9356
|
})
|
|
9350
9357
|
) });
|
|
9351
9358
|
}
|