@bug-on/md3-react 2.0.2 → 3.0.0
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/.turbo/turbo-build.log +33 -0
- package/CHANGELOG.md +55 -0
- package/dist/index.css +23 -0
- package/dist/index.css.d.ts +2 -0
- package/dist/index.d.mts +6127 -0
- package/dist/index.d.ts +6127 -69
- package/dist/index.js +2536 -665
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2443 -603
- package/dist/index.mjs.map +1 -1
- package/dist/material-symbols-cdn.css.d.ts +2 -0
- package/dist/material-symbols-self-hosted.css.d.ts +2 -0
- package/dist/typography.css.d.ts +2 -0
- package/package.json +23 -19
- package/scripts/copy-assets.js +82 -0
- package/src/assets/fonts/GoogleSansFlex-VariableFont.woff2 +0 -0
- package/src/assets/fonts/MaterialSymbolsOutlined-VariableFont_FILL,GRAD,opsz,wght.ttf +0 -0
- package/src/assets/fonts/MaterialSymbolsRounded-VariableFont_FILL,GRAD,opsz,wght.ttf +0 -0
- package/src/assets/fonts/MaterialSymbolsSharp-VariableFont_FILL,GRAD,opsz,wght.ttf +0 -0
- package/src/assets/loading-indicator.svg +19 -0
- package/src/assets/material-symbols-cdn.css +65 -0
- package/src/assets/material-symbols-self-hosted.css +90 -0
- package/src/css.d.ts +20 -0
- package/{dist/hooks/index.d.ts → src/hooks/index.ts} +1 -0
- package/src/hooks/useClickOutside.ts +37 -0
- package/src/hooks/useMediaQuery.ts +28 -0
- package/src/hooks/useRipple.ts +88 -0
- package/src/index.css +23 -0
- package/src/index.ts +349 -0
- package/src/lib/material-symbols-preconnect.tsx +82 -0
- package/src/lib/theme-utils.ts +180 -0
- package/src/lib/utils.ts +6 -0
- package/src/test/button.test.tsx +59 -0
- package/src/test/icon.test.tsx +91 -0
- package/src/test/loading-indicator.test.tsx +128 -0
- package/src/test/progress-indicator.test.tsx +306 -0
- package/src/test/setup.ts +80 -0
- package/src/test/typography.test.tsx +206 -0
- package/src/types/index.ts +7 -0
- package/src/types/md3.ts +31 -0
- package/src/ui/Text.tsx +60 -0
- package/src/ui/__snapshots__/divider.test.tsx.snap +63 -0
- package/src/ui/app-bar/app-bar-column.tsx +99 -0
- package/src/ui/app-bar/app-bar-item-button.tsx +71 -0
- package/src/ui/app-bar/app-bar-items.test.tsx +89 -0
- package/src/ui/app-bar/app-bar-overflow-indicator.tsx +108 -0
- package/src/ui/app-bar/app-bar-row.tsx +104 -0
- package/src/ui/app-bar/app-bar.test.tsx +87 -0
- package/src/ui/app-bar/app-bar.tokens.ts +223 -0
- package/src/ui/app-bar/app-bar.types.ts +441 -0
- package/src/ui/app-bar/bottom-app-bar.test.tsx +42 -0
- package/src/ui/app-bar/bottom-app-bar.tsx +84 -0
- package/src/ui/app-bar/docked-toolbar.test.tsx +34 -0
- package/src/ui/app-bar/docked-toolbar.tsx +54 -0
- package/src/ui/app-bar/flexible-app-bar.test.tsx +75 -0
- package/src/ui/app-bar/hooks/use-app-bar-scroll.ts +110 -0
- package/src/ui/app-bar/hooks/use-flexible-app-bar.ts +123 -0
- package/{dist/ui/app-bar/index.d.ts → src/ui/app-bar/index.ts} +35 -2
- package/src/ui/app-bar/large-flexible-app-bar.tsx +165 -0
- package/src/ui/app-bar/medium-flexible-app-bar.tsx +167 -0
- package/src/ui/app-bar/search-app-bar.test.tsx +49 -0
- package/src/ui/app-bar/search-app-bar.tsx +176 -0
- package/src/ui/app-bar/search-view.tsx +227 -0
- package/src/ui/app-bar/small-app-bar.test.tsx +48 -0
- package/src/ui/app-bar/small-app-bar.tsx +203 -0
- package/src/ui/badge.test.tsx +345 -0
- package/src/ui/badge.tsx +282 -0
- package/src/ui/button-group.test.tsx +71 -0
- package/src/ui/button-group.tsx +350 -0
- package/src/ui/button.test.tsx +297 -0
- package/src/ui/button.tsx +669 -0
- package/src/ui/card.test.tsx +187 -0
- package/src/ui/card.tsx +259 -0
- package/src/ui/checkbox.test.tsx +423 -0
- package/src/ui/checkbox.tsx +525 -0
- package/src/ui/chip.test.tsx +292 -0
- package/src/ui/chip.tsx +548 -0
- package/src/ui/code-block.tsx +219 -0
- package/src/ui/dialog.test.tsx +300 -0
- package/src/ui/dialog.tsx +384 -0
- package/src/ui/divider.test.tsx +314 -0
- package/src/ui/divider.tsx +412 -0
- package/src/ui/drawer.tsx +240 -0
- package/src/ui/fab-menu.test.tsx +494 -0
- package/src/ui/fab-menu.tsx +739 -0
- package/src/ui/fab.test.tsx +232 -0
- package/src/ui/fab.tsx +505 -0
- package/src/ui/icon-button.test.tsx +515 -0
- package/src/ui/icon-button.tsx +525 -0
- package/src/ui/icon.test.tsx +197 -0
- package/src/ui/icon.tsx +179 -0
- package/src/ui/loading-indicator.test.tsx +73 -0
- package/src/ui/loading-indicator.tsx +312 -0
- package/src/ui/menu/context-menu.tsx +275 -0
- package/src/ui/menu/index.ts +77 -0
- package/src/ui/menu/menu-animations.ts +102 -0
- package/src/ui/menu/menu-context.tsx +99 -0
- package/src/ui/menu/menu-divider.tsx +47 -0
- package/src/ui/menu/menu-group.tsx +200 -0
- package/src/ui/menu/menu-item.tsx +294 -0
- package/src/ui/menu/menu-tokens.ts +208 -0
- package/src/ui/menu/menu-types.ts +313 -0
- package/src/ui/menu/menu.test.tsx +624 -0
- package/src/ui/menu/menu.tsx +289 -0
- package/src/ui/menu/sub-menu.tsx +223 -0
- package/src/ui/menu/vertical-menu.tsx +382 -0
- package/src/ui/navigation-rail.test.tsx +404 -0
- package/src/ui/navigation-rail.tsx +604 -0
- package/src/ui/progress-indicator/circular.tsx +248 -0
- package/src/ui/progress-indicator/hooks.ts +51 -0
- package/{dist/ui/progress-indicator/index.d.ts → src/ui/progress-indicator/index.tsx} +20 -2
- package/src/ui/progress-indicator/linear-flat.tsx +83 -0
- package/src/ui/progress-indicator/linear-wavy.tsx +243 -0
- package/src/ui/progress-indicator/linear.tsx +143 -0
- package/src/ui/progress-indicator/types.ts +158 -0
- package/src/ui/progress-indicator/utils.ts +73 -0
- package/src/ui/radio-button.test.tsx +407 -0
- package/src/ui/radio-button.tsx +551 -0
- package/src/ui/ripple.test.tsx +72 -0
- package/src/ui/ripple.tsx +234 -0
- package/src/ui/scroll-area.test.tsx +58 -0
- package/src/ui/scroll-area.tsx +139 -0
- package/src/ui/search/animated-placeholder.tsx +145 -0
- package/src/ui/search/hooks/use-search-keyboard.test.ts +202 -0
- package/src/ui/search/hooks/use-search-keyboard.ts +104 -0
- package/src/ui/search/hooks/use-search-view-focus.test.ts +96 -0
- package/src/ui/search/hooks/use-search-view-focus.ts +24 -0
- package/src/ui/search/index.ts +44 -0
- package/src/ui/search/search-bar.tsx +220 -0
- package/src/ui/search/search-context.tsx +42 -0
- package/src/ui/search/search-view-docked.tsx +194 -0
- package/src/ui/search/search-view-fullscreen.tsx +247 -0
- package/src/ui/search/search.test.tsx +233 -0
- package/src/ui/search/search.tokens.ts +134 -0
- package/src/ui/search/search.tsx +131 -0
- package/src/ui/search/search.types.ts +154 -0
- package/src/ui/search/trailing-action.tsx +49 -0
- package/src/ui/shared/constants.ts +122 -0
- package/{dist/ui/shared/touch-target.d.ts → src/ui/shared/touch-target.tsx} +13 -1
- package/src/ui/slider/hooks/useSliderMath.ts +195 -0
- package/{dist/ui/slider/index.d.ts → src/ui/slider/index.ts} +12 -1
- package/src/ui/slider/range-slider.tsx +561 -0
- package/src/ui/slider/slider-thumb.tsx +379 -0
- package/src/ui/slider/slider-track.tsx +912 -0
- package/src/ui/slider/slider.tokens.ts +189 -0
- package/src/ui/slider/slider.tsx +259 -0
- package/src/ui/slider/slider.types.ts +288 -0
- package/src/ui/snackbar/index.ts +20 -0
- package/src/ui/snackbar/snackbar.test.tsx +338 -0
- package/src/ui/snackbar/snackbar.tsx +476 -0
- package/{dist/ui/switch/index.d.ts → src/ui/switch/index.ts} +1 -0
- package/src/ui/switch/switch.stories.tsx +309 -0
- package/src/ui/switch/switch.test.tsx +243 -0
- package/src/ui/switch/switch.tokens.ts +89 -0
- package/src/ui/switch/switch.tsx +504 -0
- package/src/ui/switch/switch.types.ts +62 -0
- package/{dist/ui/tabs/index.d.ts → src/ui/tabs/index.ts} +8 -1
- package/src/ui/tabs/tab.tsx +407 -0
- package/src/ui/tabs/tabs-content.tsx +89 -0
- package/src/ui/tabs/tabs-list.tsx +146 -0
- package/src/ui/tabs/tabs.test.tsx +290 -0
- package/src/ui/tabs/tabs.tokens.ts +121 -0
- package/src/ui/tabs/tabs.tsx +229 -0
- package/src/ui/tabs/tabs.types.ts +185 -0
- package/{dist/ui/text-field/index.d.ts → src/ui/text-field/index.ts} +8 -1
- package/src/ui/text-field/subcomponents/active-indicator.tsx +67 -0
- package/src/ui/text-field/subcomponents/floating-label.tsx +161 -0
- package/src/ui/text-field/subcomponents/leading-icon.tsx +46 -0
- package/src/ui/text-field/subcomponents/outline-container.tsx +170 -0
- package/src/ui/text-field/subcomponents/prefix-suffix.tsx +59 -0
- package/src/ui/text-field/subcomponents/supporting-text.tsx +145 -0
- package/src/ui/text-field/subcomponents/trailing-icon.tsx +199 -0
- package/src/ui/text-field/text-field.test.tsx +454 -0
- package/src/ui/text-field/text-field.tokens.ts +104 -0
- package/src/ui/text-field/text-field.tsx +548 -0
- package/src/ui/text-field/text-field.types.ts +180 -0
- package/src/ui/theme-provider/index.tsx +190 -0
- package/src/ui/toc.test.tsx +108 -0
- package/src/ui/toc.tsx +172 -0
- package/src/ui/tooltip/plain-tooltip.tsx +63 -0
- package/src/ui/tooltip/rich-tooltip.tsx +94 -0
- package/src/ui/tooltip/tooltip-box.tsx +266 -0
- package/src/ui/tooltip/tooltip-caret-shape.tsx +68 -0
- package/src/ui/tooltip/tooltip.tokens.ts +26 -0
- package/src/ui/tooltip/tooltip.types.ts +70 -0
- package/src/ui/tooltip/use-tooltip-position.ts +208 -0
- package/src/ui/tooltip/use-tooltip-state.ts +41 -0
- package/src/ui/typography/__tests__/typography.test.tsx +170 -0
- package/{dist/ui/typography/index.d.ts → src/ui/typography/index.ts} +21 -3
- package/src/ui/typography/type-scale-tokens.ts +205 -0
- package/src/ui/typography/typography-key-tokens.ts +43 -0
- package/src/ui/typography/typography-tokens.ts +360 -0
- package/src/ui/typography/typography.css +22 -0
- package/src/ui/typography/typography.tsx +559 -0
- package/test-render.tsx +4 -0
- package/test-shadow.html +26 -0
- package/test_output.txt +164 -0
- package/test_output_v2.txt +5 -0
- package/tsconfig.build.json +10 -0
- package/tsconfig.json +18 -0
- package/tsup.config.ts +20 -0
- package/vitest.config.ts +11 -0
- package/dist/hooks/useMediaQuery.d.ts +0 -11
- package/dist/hooks/useRipple.d.ts +0 -26
- package/dist/lib/material-symbols-preconnect.d.ts +0 -42
- package/dist/lib/theme-utils.d.ts +0 -63
- package/dist/lib/utils.d.ts +0 -2
- package/dist/types/index.d.ts +0 -1
- package/dist/types/md3.d.ts +0 -14
- package/dist/ui/app-bar/app-bar-column.d.ts +0 -28
- package/dist/ui/app-bar/app-bar-item-button.d.ts +0 -16
- package/dist/ui/app-bar/app-bar-overflow-indicator.d.ts +0 -18
- package/dist/ui/app-bar/app-bar-row.d.ts +0 -36
- package/dist/ui/app-bar/app-bar.tokens.d.ts +0 -184
- package/dist/ui/app-bar/app-bar.types.d.ts +0 -392
- package/dist/ui/app-bar/bottom-app-bar.d.ts +0 -31
- package/dist/ui/app-bar/docked-toolbar.d.ts +0 -25
- package/dist/ui/app-bar/hooks/use-app-bar-scroll.d.ts +0 -42
- package/dist/ui/app-bar/hooks/use-flexible-app-bar.d.ts +0 -37
- package/dist/ui/app-bar/large-flexible-app-bar.d.ts +0 -26
- package/dist/ui/app-bar/medium-flexible-app-bar.d.ts +0 -28
- package/dist/ui/app-bar/search-app-bar.d.ts +0 -43
- package/dist/ui/app-bar/search-view.d.ts +0 -54
- package/dist/ui/app-bar/small-app-bar.d.ts +0 -37
- package/dist/ui/badge.d.ts +0 -125
- package/dist/ui/button-group.d.ts +0 -59
- package/dist/ui/button.d.ts +0 -148
- package/dist/ui/card.d.ts +0 -62
- package/dist/ui/checkbox.d.ts +0 -82
- package/dist/ui/chip.d.ts +0 -110
- package/dist/ui/code-block.d.ts +0 -14
- package/dist/ui/dialog.d.ts +0 -111
- package/dist/ui/divider.d.ts +0 -164
- package/dist/ui/drawer.d.ts +0 -39
- package/dist/ui/dropdown.d.ts +0 -29
- package/dist/ui/fab-menu.d.ts +0 -204
- package/dist/ui/fab.d.ts +0 -162
- package/dist/ui/icon-button.d.ts +0 -131
- package/dist/ui/icon.d.ts +0 -88
- package/dist/ui/loading-indicator.d.ts +0 -42
- package/dist/ui/navigation-rail.d.ts +0 -29
- package/dist/ui/progress-indicator/circular.d.ts +0 -3
- package/dist/ui/progress-indicator/hooks.d.ts +0 -3
- package/dist/ui/progress-indicator/linear-flat.d.ts +0 -10
- package/dist/ui/progress-indicator/linear-wavy.d.ts +0 -18
- package/dist/ui/progress-indicator/linear.d.ts +0 -3
- package/dist/ui/progress-indicator/types.d.ts +0 -151
- package/dist/ui/progress-indicator/utils.d.ts +0 -3
- package/dist/ui/radio-button.d.ts +0 -106
- package/dist/ui/ripple.d.ts +0 -126
- package/dist/ui/scroll-area.d.ts +0 -27
- package/dist/ui/shared/constants.d.ts +0 -86
- package/dist/ui/slider/hooks/useSliderMath.d.ts +0 -101
- package/dist/ui/slider/range-slider.d.ts +0 -47
- package/dist/ui/slider/slider-thumb.d.ts +0 -33
- package/dist/ui/slider/slider-track.d.ts +0 -25
- package/dist/ui/slider/slider.d.ts +0 -60
- package/dist/ui/slider/slider.tokens.d.ts +0 -151
- package/dist/ui/slider/slider.types.d.ts +0 -259
- package/dist/ui/snackbar/index.d.ts +0 -6
- package/dist/ui/snackbar/snackbar.d.ts +0 -197
- package/dist/ui/switch/switch.d.ts +0 -30
- package/dist/ui/switch/switch.stories.d.ts +0 -48
- package/dist/ui/switch/switch.tokens.d.ts +0 -67
- package/dist/ui/switch/switch.types.d.ts +0 -59
- package/dist/ui/tabs/tab.d.ts +0 -43
- package/dist/ui/tabs/tabs-content.d.ts +0 -36
- package/dist/ui/tabs/tabs-list.d.ts +0 -40
- package/dist/ui/tabs/tabs.d.ts +0 -60
- package/dist/ui/tabs/tabs.tokens.d.ts +0 -94
- package/dist/ui/tabs/tabs.types.d.ts +0 -172
- package/dist/ui/text-field/subcomponents/active-indicator.d.ts +0 -24
- package/dist/ui/text-field/subcomponents/floating-label.d.ts +0 -43
- package/dist/ui/text-field/subcomponents/leading-icon.d.ts +0 -23
- package/dist/ui/text-field/subcomponents/outline-container.d.ts +0 -42
- package/dist/ui/text-field/subcomponents/prefix-suffix.d.ts +0 -24
- package/dist/ui/text-field/subcomponents/supporting-text.d.ts +0 -37
- package/dist/ui/text-field/subcomponents/trailing-icon.d.ts +0 -41
- package/dist/ui/text-field/text-field.d.ts +0 -49
- package/dist/ui/text-field/text-field.tokens.d.ts +0 -76
- package/dist/ui/text-field/text-field.types.d.ts +0 -126
- package/dist/ui/theme-provider/index.d.ts +0 -48
- package/dist/ui/toc.d.ts +0 -80
- package/dist/ui/tooltip/plain-tooltip.d.ts +0 -2
- package/dist/ui/tooltip/rich-tooltip.d.ts +0 -2
- package/dist/ui/tooltip/tooltip-box.d.ts +0 -2
- package/dist/ui/tooltip/tooltip-caret-shape.d.ts +0 -9
- package/dist/ui/tooltip/tooltip.tokens.d.ts +0 -26
- package/dist/ui/tooltip/tooltip.types.d.ts +0 -56
- package/dist/ui/tooltip/use-tooltip-position.d.ts +0 -8
- package/dist/ui/tooltip/use-tooltip-state.d.ts +0 -2
- package/dist/ui/typography/type-scale-tokens.d.ts +0 -162
- package/dist/ui/typography/typography-key-tokens.d.ts +0 -40
- package/dist/ui/typography/typography-tokens.d.ts +0 -220
- package/dist/ui/typography/typography.d.ts +0 -265
- /package/{dist/ui/tooltip/index.d.ts → src/ui/tooltip/index.ts} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import * as
|
|
3
|
-
import { createContext, forwardRef, useMemo,
|
|
2
|
+
import * as React38 from 'react';
|
|
3
|
+
import { createContext, forwardRef, useMemo, useRef, useEffect, useState, useCallback, useContext, useId, cloneElement, useLayoutEffect, createElement } from 'react';
|
|
4
4
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
5
|
import { argbFromHex, themeFromSourceColor, hexFromArgb } from '@material/material-color-utilities';
|
|
6
6
|
import { clsx } from 'clsx';
|
|
7
7
|
import { twMerge } from 'tailwind-merge';
|
|
8
|
-
import * as
|
|
9
|
-
import {
|
|
8
|
+
import * as RxContextMenu from '@radix-ui/react-context-menu';
|
|
9
|
+
import { AnimatePresence, m, LazyMotion, domMax, useReducedMotion, useMotionValue, animate, useAnimationFrame, useSpring, useTransform, LayoutGroup } from 'motion/react';
|
|
10
|
+
import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
|
|
10
11
|
import { Slot } from '@radix-ui/react-slot';
|
|
11
12
|
import { cva } from 'class-variance-authority';
|
|
12
13
|
import * as RadixScrollArea from '@radix-ui/react-scroll-area';
|
|
@@ -212,7 +213,7 @@ function generateM3Theme(sourceColorHex, mode = "light") {
|
|
|
212
213
|
function applyTheme(sourceColorHex, mode = "light", root = document.documentElement) {
|
|
213
214
|
const colors = generateM3Theme(sourceColorHex, mode);
|
|
214
215
|
for (const [key, value] of Object.entries(colors)) {
|
|
215
|
-
const kebabKey = key.replace(/[A-Z]/g, (
|
|
216
|
+
const kebabKey = key.replace(/[A-Z]/g, (m47) => `-${m47.toLowerCase()}`);
|
|
216
217
|
root.style.setProperty(`--md-sys-color-${kebabKey}`, value);
|
|
217
218
|
root.style.setProperty(`--color-m3-${kebabKey}`, value);
|
|
218
219
|
}
|
|
@@ -409,6 +410,671 @@ function AppBarItemButton({ item }) {
|
|
|
409
410
|
);
|
|
410
411
|
}
|
|
411
412
|
|
|
413
|
+
// src/ui/menu/menu-animations.ts
|
|
414
|
+
var FAST_SPATIAL_SPRING = {
|
|
415
|
+
type: "spring",
|
|
416
|
+
stiffness: 380,
|
|
417
|
+
damping: 28,
|
|
418
|
+
mass: 1
|
|
419
|
+
};
|
|
420
|
+
var FAST_EFFECTS_TRANSITION = {
|
|
421
|
+
duration: 0.15,
|
|
422
|
+
ease: [0.4, 0, 1, 1]
|
|
423
|
+
// FastOutLinearIn
|
|
424
|
+
};
|
|
425
|
+
var MENU_CONTAINER_VARIANTS = {
|
|
426
|
+
hidden: {
|
|
427
|
+
opacity: 0,
|
|
428
|
+
scale: 0.8
|
|
429
|
+
},
|
|
430
|
+
visible: {
|
|
431
|
+
opacity: 1,
|
|
432
|
+
scale: 1,
|
|
433
|
+
transition: FAST_SPATIAL_SPRING
|
|
434
|
+
},
|
|
435
|
+
exit: {
|
|
436
|
+
opacity: 0,
|
|
437
|
+
scale: 0.8,
|
|
438
|
+
transition: FAST_EFFECTS_TRANSITION
|
|
439
|
+
}
|
|
440
|
+
};
|
|
441
|
+
var MENU_CHECK_ICON_SIZE = 20;
|
|
442
|
+
var CHECK_ICON_VARIANTS = {
|
|
443
|
+
hidden: {
|
|
444
|
+
opacity: 0,
|
|
445
|
+
width: 0
|
|
446
|
+
},
|
|
447
|
+
visible: {
|
|
448
|
+
opacity: 1,
|
|
449
|
+
width: MENU_CHECK_ICON_SIZE,
|
|
450
|
+
transition: FAST_SPATIAL_SPRING
|
|
451
|
+
},
|
|
452
|
+
exit: {
|
|
453
|
+
opacity: 0,
|
|
454
|
+
width: 0,
|
|
455
|
+
transition: FAST_EFFECTS_TRANSITION
|
|
456
|
+
}
|
|
457
|
+
};
|
|
458
|
+
var SUBMENU_CONTAINER_VARIANTS = {
|
|
459
|
+
hidden: {
|
|
460
|
+
opacity: 0,
|
|
461
|
+
scale: 0.9,
|
|
462
|
+
x: -4
|
|
463
|
+
},
|
|
464
|
+
visible: {
|
|
465
|
+
opacity: 1,
|
|
466
|
+
scale: 1,
|
|
467
|
+
x: 0,
|
|
468
|
+
transition: FAST_SPATIAL_SPRING
|
|
469
|
+
},
|
|
470
|
+
exit: {
|
|
471
|
+
opacity: 0,
|
|
472
|
+
scale: 0.9,
|
|
473
|
+
x: -4,
|
|
474
|
+
transition: FAST_EFFECTS_TRANSITION
|
|
475
|
+
}
|
|
476
|
+
};
|
|
477
|
+
var MenuContext = React38.createContext({
|
|
478
|
+
variant: "baseline",
|
|
479
|
+
colorVariant: "standard",
|
|
480
|
+
menuPrimitive: "dropdown",
|
|
481
|
+
open: false,
|
|
482
|
+
onOpenChange: () => {
|
|
483
|
+
}
|
|
484
|
+
});
|
|
485
|
+
function MenuProvider({
|
|
486
|
+
variant = "baseline",
|
|
487
|
+
colorVariant = "standard",
|
|
488
|
+
menuPrimitive = "dropdown",
|
|
489
|
+
open,
|
|
490
|
+
onOpenChange,
|
|
491
|
+
children
|
|
492
|
+
}) {
|
|
493
|
+
const value = React38.useMemo(
|
|
494
|
+
() => ({ variant, colorVariant, menuPrimitive, open, onOpenChange }),
|
|
495
|
+
[variant, colorVariant, menuPrimitive, open, onOpenChange]
|
|
496
|
+
);
|
|
497
|
+
return /* @__PURE__ */ jsx(MenuContext.Provider, { value, children });
|
|
498
|
+
}
|
|
499
|
+
function useMenuContext() {
|
|
500
|
+
const ctx = React38.useContext(MenuContext);
|
|
501
|
+
return React38.useMemo(
|
|
502
|
+
() => __spreadProps(__spreadValues({}, ctx), {
|
|
503
|
+
isStatic: ctx.menuPrimitive === "static",
|
|
504
|
+
menuVariant: ctx.variant
|
|
505
|
+
}),
|
|
506
|
+
[ctx]
|
|
507
|
+
);
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
// src/ui/menu/menu-tokens.ts
|
|
511
|
+
var MENU_BASELINE_ITEM_HORIZONTAL_PADDING = "px-3";
|
|
512
|
+
var MENU_ITEM_MIN_HEIGHT = "min-h-11";
|
|
513
|
+
var MENU_MIN_WIDTH = "min-w-28";
|
|
514
|
+
var MENU_MAX_WIDTH = "max-w-70";
|
|
515
|
+
var MENU_GROUP_GAP = "gap-0.5";
|
|
516
|
+
var MENU_GROUP_PADDING_Y = "py-1";
|
|
517
|
+
var MENU_POPUP_PADDING_Y = "py-2";
|
|
518
|
+
var MENU_ICON_SIZE = 20;
|
|
519
|
+
var MENU_CONTAINER_SHAPE = "rounded-[4px]";
|
|
520
|
+
var BASELINE_ITEM_SHAPE = "rounded-none";
|
|
521
|
+
var GROUP_SHAPES = {
|
|
522
|
+
/** Active standalone group shape: CornerLarge all corners (16px) */
|
|
523
|
+
standaloneActive: "16px",
|
|
524
|
+
/**
|
|
525
|
+
* Active leading group shape: top=CornerLarge(16px), bottom=CornerSmall(8px)
|
|
526
|
+
* Source: SegmentedMenuTokens — LeadingContainerShape:
|
|
527
|
+
* topStart=CornerLarge, topEnd=CornerLarge, bottomStart=CornerSmall, bottomEnd=CornerSmall
|
|
528
|
+
*/
|
|
529
|
+
leadingActive: "16px 16px 8px 8px",
|
|
530
|
+
/** Active middle group shape: CornerExtraSmall all corners (4px) */
|
|
531
|
+
middleActive: "4px",
|
|
532
|
+
/**
|
|
533
|
+
* Active trailing group shape: top=CornerSmall(8px), bottom=CornerLarge(16px)
|
|
534
|
+
* Source: SegmentedMenuTokens — TrailingContainerShape:
|
|
535
|
+
* topStart=CornerSmall, topEnd=CornerSmall, bottomStart=CornerLarge, bottomEnd=CornerLarge
|
|
536
|
+
*/
|
|
537
|
+
trailingActive: "8px 8px 16px 16px",
|
|
538
|
+
/** Inactive (default, pre-hover) shape for all groups: CornerExtraSmall (4px) */
|
|
539
|
+
inactive: "4px"
|
|
540
|
+
};
|
|
541
|
+
var ITEM_SHAPE_CLASSES = {
|
|
542
|
+
leading: "rounded-t-[12px] rounded-b-[4px]",
|
|
543
|
+
middle: "rounded-[4px]",
|
|
544
|
+
trailing: "rounded-t-[4px] rounded-b-[12px]",
|
|
545
|
+
standalone: "rounded-[4px]",
|
|
546
|
+
selected: "rounded-[12px]"
|
|
547
|
+
};
|
|
548
|
+
var STANDARD_COLORS = {
|
|
549
|
+
/** Group/popup container background (StandardMenuTokens.ContainerColor) */
|
|
550
|
+
containerBg: "bg-m3-surface-container-low",
|
|
551
|
+
/** Label text color (StandardMenuTokens.ItemLabelTextColor) */
|
|
552
|
+
labelText: "text-m3-on-surface",
|
|
553
|
+
/** Leading/trailing icon color (StandardMenuTokens.ItemLeadingIconColor) */
|
|
554
|
+
iconColor: "text-m3-on-surface-variant",
|
|
555
|
+
/** Supporting text below label (StandardMenuTokens.ItemSupportingTextColor) */
|
|
556
|
+
supportingTextColor: "text-m3-on-surface-variant",
|
|
557
|
+
/** Trailing supporting text (StandardMenuTokens.ItemTrailingSupportingTextColor) */
|
|
558
|
+
trailingSupportingTextColor: "text-m3-on-surface-variant",
|
|
559
|
+
/** Trailing icon color (StandardMenuTokens.ItemTrailingIconColor) */
|
|
560
|
+
trailingIconColor: "text-m3-on-surface-variant",
|
|
561
|
+
/** Hover state layer (OnSurface @ 8% opacity) */
|
|
562
|
+
hoverLayer: "hover:bg-m3-on-surface/8",
|
|
563
|
+
/** Focus state layer (OnSurface @ 12% opacity) */
|
|
564
|
+
focusLayer: "focus:bg-m3-on-surface/12",
|
|
565
|
+
/** Selected item background (StandardMenuTokens.ItemSelectedContainerColor) */
|
|
566
|
+
selectedBg: "bg-m3-tertiary-container",
|
|
567
|
+
/** Selected item text (StandardMenuTokens.ItemSelectedLabelTextColor) */
|
|
568
|
+
selectedText: "text-m3-on-tertiary-container",
|
|
569
|
+
/** Selected item icon (StandardMenuTokens.ItemSelectedLeadingIconColor) */
|
|
570
|
+
selectedIcon: "text-m3-on-tertiary-container",
|
|
571
|
+
/** Disabled opacity: 38% (StandardMenuTokens.ItemDisabledLabelTextOpacity) */
|
|
572
|
+
disabledOpacity: "data-disabled:opacity-[0.38]"
|
|
573
|
+
};
|
|
574
|
+
var BASELINE_COLORS = {
|
|
575
|
+
containerBg: "bg-m3-surface-container",
|
|
576
|
+
labelText: "text-m3-on-surface",
|
|
577
|
+
iconColor: "text-m3-on-surface-variant",
|
|
578
|
+
supportingTextColor: "text-m3-on-surface-variant",
|
|
579
|
+
trailingIconColor: "text-m3-on-surface-variant",
|
|
580
|
+
hoverLayer: "hover:bg-m3-on-surface/8",
|
|
581
|
+
focusLayer: "focus:bg-m3-on-surface/12",
|
|
582
|
+
selectedBg: "bg-m3-secondary-container",
|
|
583
|
+
selectedText: "text-m3-on-secondary-container",
|
|
584
|
+
selectedIcon: "text-m3-on-secondary-container"};
|
|
585
|
+
var VIBRANT_COLORS = {
|
|
586
|
+
/** Group/popup container background (VibrantMenuTokens.ContainerColor) */
|
|
587
|
+
containerBg: "bg-m3-tertiary-container",
|
|
588
|
+
/** Label text color (VibrantMenuTokens.ItemLabelTextColor) */
|
|
589
|
+
labelText: "text-m3-on-tertiary-container",
|
|
590
|
+
/** Leading/trailing icon color (VibrantMenuTokens.ItemLeadingIconColor) */
|
|
591
|
+
iconColor: "text-m3-on-tertiary-container",
|
|
592
|
+
/** Supporting text below label (VibrantMenuTokens.ItemSupportingTextColor) */
|
|
593
|
+
supportingTextColor: "text-m3-on-tertiary-container",
|
|
594
|
+
/** Trailing supporting text (VibrantMenuTokens.ItemTrailingSupportingTextColor) */
|
|
595
|
+
trailingSupportingTextColor: "text-m3-on-tertiary-container",
|
|
596
|
+
/** Trailing icon color (VibrantMenuTokens.ItemTrailingIconColor) */
|
|
597
|
+
trailingIconColor: "text-m3-on-tertiary-container",
|
|
598
|
+
/** Hover state layer (OnTertiaryContainer @ 8% opacity) */
|
|
599
|
+
hoverLayer: "hover:bg-m3-on-tertiary-container/8",
|
|
600
|
+
/** Focus state layer (OnTertiaryContainer @ 12% opacity) */
|
|
601
|
+
focusLayer: "focus:bg-m3-on-tertiary-container/12",
|
|
602
|
+
/** Selected item background (VibrantMenuTokens.ItemSelectedContainerColor = Tertiary) */
|
|
603
|
+
selectedBg: "bg-m3-tertiary",
|
|
604
|
+
/** Selected item text (VibrantMenuTokens.ItemSelectedLabelTextColor = OnTertiary) */
|
|
605
|
+
selectedText: "text-m3-on-tertiary",
|
|
606
|
+
/** Selected item icon (VibrantMenuTokens.ItemSelectedLeadingIconColor = OnTertiary) */
|
|
607
|
+
selectedIcon: "text-m3-on-tertiary",
|
|
608
|
+
/** Disabled opacity: 38% (VibrantMenuTokens.ItemDisabledLabelTextOpacity) */
|
|
609
|
+
disabledOpacity: "data-disabled:opacity-[0.38]"
|
|
610
|
+
};
|
|
611
|
+
var DIVIDER_PADDING = "mx-3 my-0.5";
|
|
612
|
+
var DIVIDER_COLOR = "bg-m3-outline-variant";
|
|
613
|
+
function ContextMenu({
|
|
614
|
+
children,
|
|
615
|
+
variant = "baseline",
|
|
616
|
+
colorVariant = "standard"
|
|
617
|
+
}) {
|
|
618
|
+
const [open, setOpen] = React38.useState(false);
|
|
619
|
+
return /* @__PURE__ */ jsx(
|
|
620
|
+
MenuProvider,
|
|
621
|
+
{
|
|
622
|
+
variant,
|
|
623
|
+
colorVariant,
|
|
624
|
+
menuPrimitive: "context",
|
|
625
|
+
open,
|
|
626
|
+
onOpenChange: setOpen,
|
|
627
|
+
children: /* @__PURE__ */ jsx(RxContextMenu.Root, { onOpenChange: setOpen, children })
|
|
628
|
+
}
|
|
629
|
+
);
|
|
630
|
+
}
|
|
631
|
+
ContextMenu.displayName = "ContextMenu";
|
|
632
|
+
var ContextMenuTrigger = React38.forwardRef((_a, ref) => {
|
|
633
|
+
var _b = _a, { children, asChild = true } = _b, props = __objRest(_b, ["children", "asChild"]);
|
|
634
|
+
return /* @__PURE__ */ jsx(RxContextMenu.Trigger, __spreadProps(__spreadValues({ ref, asChild }, props), { children }));
|
|
635
|
+
});
|
|
636
|
+
ContextMenuTrigger.displayName = "ContextMenuTrigger";
|
|
637
|
+
var ContextMenuContent = React38.forwardRef(
|
|
638
|
+
(_a, ref) => {
|
|
639
|
+
var _b = _a, {
|
|
640
|
+
children,
|
|
641
|
+
hasOverflow = false,
|
|
642
|
+
colorVariant: propColorVariant,
|
|
643
|
+
separatorStyle = "gap",
|
|
644
|
+
className
|
|
645
|
+
} = _b, props = __objRest(_b, [
|
|
646
|
+
"children",
|
|
647
|
+
"hasOverflow",
|
|
648
|
+
"colorVariant",
|
|
649
|
+
"separatorStyle",
|
|
650
|
+
"className"
|
|
651
|
+
]);
|
|
652
|
+
const {
|
|
653
|
+
open,
|
|
654
|
+
variant,
|
|
655
|
+
colorVariant: contextColorVariant
|
|
656
|
+
} = useMenuContext();
|
|
657
|
+
const colorVariant = propColorVariant != null ? propColorVariant : contextColorVariant;
|
|
658
|
+
const colors = variant === "baseline" ? BASELINE_COLORS : colorVariant === "vibrant" ? VIBRANT_COLORS : STANDARD_COLORS;
|
|
659
|
+
const isExpressiveGap = variant === "expressive" && separatorStyle === "gap";
|
|
660
|
+
const containerClassName = variant === "expressive" ? cn(
|
|
661
|
+
"z-50 flex flex-col w-full",
|
|
662
|
+
MENU_MIN_WIDTH,
|
|
663
|
+
MENU_MAX_WIDTH,
|
|
664
|
+
isExpressiveGap ? MENU_GROUP_GAP : "",
|
|
665
|
+
isExpressiveGap ? "bg-transparent" : colors.containerBg,
|
|
666
|
+
isExpressiveGap ? "" : "rounded-2xl",
|
|
667
|
+
isExpressiveGap ? "" : "elevation-2",
|
|
668
|
+
hasOverflow || isExpressiveGap ? "overflow-visible" : "overflow-hidden",
|
|
669
|
+
"outline-none",
|
|
670
|
+
className
|
|
671
|
+
) : cn(
|
|
672
|
+
"z-50 flex flex-col",
|
|
673
|
+
MENU_MIN_WIDTH,
|
|
674
|
+
MENU_MAX_WIDTH,
|
|
675
|
+
MENU_POPUP_PADDING_Y,
|
|
676
|
+
MENU_GROUP_GAP,
|
|
677
|
+
colors.containerBg,
|
|
678
|
+
MENU_CONTAINER_SHAPE,
|
|
679
|
+
"elevation-2",
|
|
680
|
+
hasOverflow ? "overflow-visible" : "overflow-hidden",
|
|
681
|
+
"outline-none",
|
|
682
|
+
className
|
|
683
|
+
);
|
|
684
|
+
const flattenChildren = (nodes) => {
|
|
685
|
+
return React38.Children.toArray(nodes).reduce(
|
|
686
|
+
(acc, child) => {
|
|
687
|
+
if (React38.isValidElement(child)) {
|
|
688
|
+
if (child.type === React38.Fragment) {
|
|
689
|
+
return acc.concat(
|
|
690
|
+
flattenChildren(
|
|
691
|
+
child.props.children
|
|
692
|
+
)
|
|
693
|
+
);
|
|
694
|
+
}
|
|
695
|
+
acc.push(child);
|
|
696
|
+
}
|
|
697
|
+
return acc;
|
|
698
|
+
},
|
|
699
|
+
[]
|
|
700
|
+
);
|
|
701
|
+
};
|
|
702
|
+
let renderedChildren = children;
|
|
703
|
+
if (variant === "expressive") {
|
|
704
|
+
const validChildren = flattenChildren(children);
|
|
705
|
+
const groupCount = validChildren.length;
|
|
706
|
+
const enhancedChildren = validChildren.map(
|
|
707
|
+
(child, i) => React38.cloneElement(
|
|
708
|
+
child,
|
|
709
|
+
{
|
|
710
|
+
index: i,
|
|
711
|
+
count: groupCount,
|
|
712
|
+
isGapVariant: isExpressiveGap
|
|
713
|
+
}
|
|
714
|
+
)
|
|
715
|
+
);
|
|
716
|
+
renderedChildren = separatorStyle === "divider" ? enhancedChildren.reduce((acc, child, i) => {
|
|
717
|
+
if (i > 0) {
|
|
718
|
+
acc.push(
|
|
719
|
+
/* @__PURE__ */ jsx(
|
|
720
|
+
"hr",
|
|
721
|
+
{
|
|
722
|
+
className: cn(
|
|
723
|
+
"mx-3 my-0.5 h-px border-0 bg-m3-outline-variant"
|
|
724
|
+
)
|
|
725
|
+
},
|
|
726
|
+
`divider-${child.key || i}`
|
|
727
|
+
)
|
|
728
|
+
);
|
|
729
|
+
}
|
|
730
|
+
acc.push(child);
|
|
731
|
+
return acc;
|
|
732
|
+
}, []) : enhancedChildren;
|
|
733
|
+
}
|
|
734
|
+
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(
|
|
735
|
+
m.div,
|
|
736
|
+
{
|
|
737
|
+
className: containerClassName,
|
|
738
|
+
initial: { opacity: 0, scale: 0.95, y: -4 },
|
|
739
|
+
animate: { opacity: 1, scale: 1, y: 0 },
|
|
740
|
+
exit: { opacity: 0, scale: 0.95, y: -4 },
|
|
741
|
+
transition: FAST_SPATIAL_SPRING,
|
|
742
|
+
style: __spreadProps(__spreadValues({}, props.style), {
|
|
743
|
+
transformOrigin: "var(--radix-context-menu-content-transform-origin)"
|
|
744
|
+
}),
|
|
745
|
+
children: renderedChildren
|
|
746
|
+
}
|
|
747
|
+
) })) }) });
|
|
748
|
+
}
|
|
749
|
+
);
|
|
750
|
+
ContextMenuContent.displayName = "ContextMenuContent";
|
|
751
|
+
function Menu(_a) {
|
|
752
|
+
var _b = _a, {
|
|
753
|
+
children,
|
|
754
|
+
variant,
|
|
755
|
+
menuVariant,
|
|
756
|
+
colorVariant = "standard",
|
|
757
|
+
open: controlledOpen,
|
|
758
|
+
onOpenChange: controlledOnOpenChange,
|
|
759
|
+
defaultOpen
|
|
760
|
+
} = _b, props = __objRest(_b, [
|
|
761
|
+
"children",
|
|
762
|
+
"variant",
|
|
763
|
+
"menuVariant",
|
|
764
|
+
"colorVariant",
|
|
765
|
+
"open",
|
|
766
|
+
"onOpenChange",
|
|
767
|
+
"defaultOpen"
|
|
768
|
+
]);
|
|
769
|
+
var _a2;
|
|
770
|
+
const resolvedVariant = (_a2 = variant != null ? variant : menuVariant) != null ? _a2 : "baseline";
|
|
771
|
+
const [internalOpen, setInternalOpen] = React38.useState(
|
|
772
|
+
() => defaultOpen != null ? defaultOpen : false
|
|
773
|
+
);
|
|
774
|
+
const isControlled = controlledOpen !== void 0;
|
|
775
|
+
const open = isControlled ? controlledOpen : internalOpen;
|
|
776
|
+
const handleOpenChange = React38.useCallback(
|
|
777
|
+
(next) => {
|
|
778
|
+
if (!isControlled) setInternalOpen(next);
|
|
779
|
+
controlledOnOpenChange == null ? void 0 : controlledOnOpenChange(next);
|
|
780
|
+
},
|
|
781
|
+
[isControlled, controlledOnOpenChange]
|
|
782
|
+
);
|
|
783
|
+
return /* @__PURE__ */ jsx(
|
|
784
|
+
MenuProvider,
|
|
785
|
+
{
|
|
786
|
+
variant: resolvedVariant,
|
|
787
|
+
colorVariant,
|
|
788
|
+
open,
|
|
789
|
+
onOpenChange: handleOpenChange,
|
|
790
|
+
children: /* @__PURE__ */ jsx(
|
|
791
|
+
DropdownMenu.Root,
|
|
792
|
+
__spreadProps(__spreadValues({}, props), {
|
|
793
|
+
defaultOpen,
|
|
794
|
+
open: isControlled ? open : void 0,
|
|
795
|
+
onOpenChange: handleOpenChange,
|
|
796
|
+
children
|
|
797
|
+
})
|
|
798
|
+
)
|
|
799
|
+
}
|
|
800
|
+
);
|
|
801
|
+
}
|
|
802
|
+
Menu.displayName = "Menu";
|
|
803
|
+
var MenuTrigger = React38.forwardRef((_a, ref) => {
|
|
804
|
+
var _b = _a, { children, asChild = true } = _b, props = __objRest(_b, ["children", "asChild"]);
|
|
805
|
+
return /* @__PURE__ */ jsx(DropdownMenu.Trigger, __spreadProps(__spreadValues({ ref, asChild }, props), { children }));
|
|
806
|
+
});
|
|
807
|
+
MenuTrigger.displayName = "MenuTrigger";
|
|
808
|
+
var MenuContent = React38.forwardRef(
|
|
809
|
+
(_a, ref) => {
|
|
810
|
+
var _b = _a, {
|
|
811
|
+
children,
|
|
812
|
+
sideOffset = 6,
|
|
813
|
+
side = "bottom",
|
|
814
|
+
align = "start",
|
|
815
|
+
hasOverflow = false,
|
|
816
|
+
colorVariant: propColorVariant,
|
|
817
|
+
separatorStyle = "gap",
|
|
818
|
+
className
|
|
819
|
+
} = _b, props = __objRest(_b, [
|
|
820
|
+
"children",
|
|
821
|
+
"sideOffset",
|
|
822
|
+
"side",
|
|
823
|
+
"align",
|
|
824
|
+
"hasOverflow",
|
|
825
|
+
"colorVariant",
|
|
826
|
+
"separatorStyle",
|
|
827
|
+
"className"
|
|
828
|
+
]);
|
|
829
|
+
const {
|
|
830
|
+
open,
|
|
831
|
+
variant,
|
|
832
|
+
colorVariant: contextColorVariant
|
|
833
|
+
} = useMenuContext();
|
|
834
|
+
const colorVariant = propColorVariant != null ? propColorVariant : contextColorVariant;
|
|
835
|
+
const colors = variant === "baseline" ? BASELINE_COLORS : colorVariant === "vibrant" ? VIBRANT_COLORS : STANDARD_COLORS;
|
|
836
|
+
const isExpressiveGap = variant === "expressive" && separatorStyle === "gap";
|
|
837
|
+
const containerClassName = variant === "expressive" ? cn(
|
|
838
|
+
"z-50 flex flex-col",
|
|
839
|
+
MENU_MIN_WIDTH,
|
|
840
|
+
MENU_MAX_WIDTH,
|
|
841
|
+
isExpressiveGap ? MENU_GROUP_GAP : "",
|
|
842
|
+
isExpressiveGap ? "bg-transparent" : colors.containerBg,
|
|
843
|
+
isExpressiveGap ? "" : "rounded-2xl",
|
|
844
|
+
isExpressiveGap ? "" : "elevation-2",
|
|
845
|
+
hasOverflow || isExpressiveGap ? "overflow-visible" : "overflow-hidden",
|
|
846
|
+
"outline-none",
|
|
847
|
+
className
|
|
848
|
+
) : cn(
|
|
849
|
+
"z-50 flex flex-col",
|
|
850
|
+
MENU_MIN_WIDTH,
|
|
851
|
+
MENU_MAX_WIDTH,
|
|
852
|
+
MENU_POPUP_PADDING_Y,
|
|
853
|
+
MENU_GROUP_GAP,
|
|
854
|
+
colors.containerBg,
|
|
855
|
+
MENU_CONTAINER_SHAPE,
|
|
856
|
+
"elevation-2",
|
|
857
|
+
hasOverflow ? "overflow-visible" : "overflow-hidden",
|
|
858
|
+
"outline-none",
|
|
859
|
+
className
|
|
860
|
+
);
|
|
861
|
+
const flattenChildren = (nodes) => {
|
|
862
|
+
return React38.Children.toArray(nodes).reduce(
|
|
863
|
+
(acc, child) => {
|
|
864
|
+
if (React38.isValidElement(child)) {
|
|
865
|
+
if (child.type === React38.Fragment) {
|
|
866
|
+
return acc.concat(
|
|
867
|
+
flattenChildren(
|
|
868
|
+
child.props.children
|
|
869
|
+
)
|
|
870
|
+
);
|
|
871
|
+
}
|
|
872
|
+
acc.push(child);
|
|
873
|
+
}
|
|
874
|
+
return acc;
|
|
875
|
+
},
|
|
876
|
+
[]
|
|
877
|
+
);
|
|
878
|
+
};
|
|
879
|
+
let renderedChildren = children;
|
|
880
|
+
if (variant === "expressive") {
|
|
881
|
+
const validChildren = flattenChildren(children);
|
|
882
|
+
const groupCount = validChildren.length;
|
|
883
|
+
const enhancedChildren = validChildren.map(
|
|
884
|
+
(child, i) => React38.cloneElement(child, {
|
|
885
|
+
index: i,
|
|
886
|
+
count: groupCount,
|
|
887
|
+
isGapVariant: isExpressiveGap
|
|
888
|
+
})
|
|
889
|
+
);
|
|
890
|
+
renderedChildren = separatorStyle === "divider" ? enhancedChildren.reduce((acc, child, i) => {
|
|
891
|
+
if (i > 0) {
|
|
892
|
+
acc.push(
|
|
893
|
+
/* @__PURE__ */ jsx(
|
|
894
|
+
"hr",
|
|
895
|
+
{
|
|
896
|
+
className: cn(
|
|
897
|
+
"mx-3 my-0.5 h-px border-0 bg-m3-outline-variant"
|
|
898
|
+
)
|
|
899
|
+
},
|
|
900
|
+
`divider-${child.key || i}`
|
|
901
|
+
)
|
|
902
|
+
);
|
|
903
|
+
}
|
|
904
|
+
acc.push(child);
|
|
905
|
+
return acc;
|
|
906
|
+
}, []) : enhancedChildren;
|
|
907
|
+
}
|
|
908
|
+
return /* @__PURE__ */ jsx(AnimatePresence, { children: open && /* @__PURE__ */ jsx(DropdownMenu.Portal, { forceMount: true, children: /* @__PURE__ */ jsx(
|
|
909
|
+
DropdownMenu.Content,
|
|
910
|
+
__spreadProps(__spreadValues({
|
|
911
|
+
ref,
|
|
912
|
+
sideOffset,
|
|
913
|
+
side,
|
|
914
|
+
align,
|
|
915
|
+
asChild: true,
|
|
916
|
+
forceMount: true
|
|
917
|
+
}, props), {
|
|
918
|
+
children: /* @__PURE__ */ jsx(
|
|
919
|
+
m.div,
|
|
920
|
+
{
|
|
921
|
+
role: "menu",
|
|
922
|
+
"aria-orientation": "vertical",
|
|
923
|
+
className: containerClassName,
|
|
924
|
+
variants: MENU_CONTAINER_VARIANTS,
|
|
925
|
+
initial: "hidden",
|
|
926
|
+
animate: "visible",
|
|
927
|
+
exit: "exit",
|
|
928
|
+
style: __spreadProps(__spreadValues({}, props.style), {
|
|
929
|
+
transformOrigin: "var(--radix-dropdown-menu-content-transform-origin)"
|
|
930
|
+
}),
|
|
931
|
+
children: renderedChildren
|
|
932
|
+
}
|
|
933
|
+
)
|
|
934
|
+
})
|
|
935
|
+
) }) });
|
|
936
|
+
}
|
|
937
|
+
);
|
|
938
|
+
MenuContent.displayName = "MenuContent";
|
|
939
|
+
var MenuDivider = React38.forwardRef(
|
|
940
|
+
(_a, ref) => {
|
|
941
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
942
|
+
const { menuVariant } = useMenuContext();
|
|
943
|
+
return /* @__PURE__ */ jsx(DropdownMenu.Separator, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
944
|
+
"hr",
|
|
945
|
+
__spreadValues({
|
|
946
|
+
ref,
|
|
947
|
+
className: cn(
|
|
948
|
+
// Baseline: 8dp vertical margin, 0 horizontal. Expressive: 12dp horizontal, 2dp vertical
|
|
949
|
+
menuVariant === "baseline" ? "my-2 mx-0" : "mx-3 my-0.5",
|
|
950
|
+
// 1px height line
|
|
951
|
+
"h-px border-0",
|
|
952
|
+
// outline-variant color
|
|
953
|
+
"bg-m3-outline-variant",
|
|
954
|
+
className
|
|
955
|
+
)
|
|
956
|
+
}, props)
|
|
957
|
+
) });
|
|
958
|
+
}
|
|
959
|
+
);
|
|
960
|
+
MenuDivider.displayName = "MenuDivider";
|
|
961
|
+
function getGroupPosition(index, count) {
|
|
962
|
+
if (count === 1) return "standalone";
|
|
963
|
+
if (index === 0) return "leading";
|
|
964
|
+
if (index === count - 1) return "trailing";
|
|
965
|
+
return "middle";
|
|
966
|
+
}
|
|
967
|
+
function getGroupActiveShape(position) {
|
|
968
|
+
return GROUP_SHAPES[`${position}Active`];
|
|
969
|
+
}
|
|
970
|
+
var MenuGroup = React38.forwardRef(
|
|
971
|
+
(_a, ref) => {
|
|
972
|
+
var _b = _a, {
|
|
973
|
+
children,
|
|
974
|
+
label,
|
|
975
|
+
index = 0,
|
|
976
|
+
count = 1,
|
|
977
|
+
colorVariant: propColorVariant,
|
|
978
|
+
isGapVariant,
|
|
979
|
+
itemPosition,
|
|
980
|
+
className
|
|
981
|
+
} = _b, rest = __objRest(_b, [
|
|
982
|
+
"children",
|
|
983
|
+
"label",
|
|
984
|
+
"index",
|
|
985
|
+
"count",
|
|
986
|
+
"colorVariant",
|
|
987
|
+
"isGapVariant",
|
|
988
|
+
"itemPosition",
|
|
989
|
+
"className"
|
|
990
|
+
]);
|
|
991
|
+
const {
|
|
992
|
+
menuVariant,
|
|
993
|
+
colorVariant: contextColorVariant,
|
|
994
|
+
isStatic
|
|
995
|
+
} = useMenuContext();
|
|
996
|
+
const colorVariant = propColorVariant != null ? propColorVariant : contextColorVariant;
|
|
997
|
+
const colors = menuVariant === "baseline" ? BASELINE_COLORS : colorVariant === "vibrant" ? VIBRANT_COLORS : STANDARD_COLORS;
|
|
998
|
+
const position = getGroupPosition(index, count);
|
|
999
|
+
const activeShape = getGroupActiveShape(position);
|
|
1000
|
+
const [isHovered, setIsHovered] = React38.useState(false);
|
|
1001
|
+
const currentShape = isStatic || isHovered ? activeShape : GROUP_SHAPES.inactive;
|
|
1002
|
+
const handlePointerEnter = React38.useCallback(() => setIsHovered(true), []);
|
|
1003
|
+
const handlePointerLeave = React38.useCallback(() => setIsHovered(false), []);
|
|
1004
|
+
const flattenChildren = (children2) => {
|
|
1005
|
+
return React38.Children.toArray(children2).reduce(
|
|
1006
|
+
(acc, child) => {
|
|
1007
|
+
if (React38.isValidElement(child)) {
|
|
1008
|
+
if (child.type === React38.Fragment) {
|
|
1009
|
+
return acc.concat(
|
|
1010
|
+
flattenChildren(
|
|
1011
|
+
child.props.children
|
|
1012
|
+
)
|
|
1013
|
+
);
|
|
1014
|
+
}
|
|
1015
|
+
acc.push(child);
|
|
1016
|
+
}
|
|
1017
|
+
return acc;
|
|
1018
|
+
},
|
|
1019
|
+
[]
|
|
1020
|
+
);
|
|
1021
|
+
};
|
|
1022
|
+
const validChildren = flattenChildren(children);
|
|
1023
|
+
const itemCount = validChildren.length;
|
|
1024
|
+
const enhancedChildren = validChildren.map((child, i) => {
|
|
1025
|
+
const itemPosition2 = itemCount === 1 ? "standalone" : i === 0 ? "leading" : i === itemCount - 1 ? "trailing" : "middle";
|
|
1026
|
+
return React38.cloneElement(child, {
|
|
1027
|
+
itemPosition: itemPosition2,
|
|
1028
|
+
colorVariant
|
|
1029
|
+
});
|
|
1030
|
+
});
|
|
1031
|
+
return /* @__PURE__ */ jsxs(
|
|
1032
|
+
m.div,
|
|
1033
|
+
__spreadProps(__spreadValues({
|
|
1034
|
+
ref,
|
|
1035
|
+
role: "group",
|
|
1036
|
+
"aria-label": label,
|
|
1037
|
+
className: cn(
|
|
1038
|
+
"relative",
|
|
1039
|
+
// In baseline variant, MenuGroup is transparent so it shouldn't clip.
|
|
1040
|
+
// In expressive variant, it needs overflow-hidden to clip hover states to its morphing shape.
|
|
1041
|
+
menuVariant === "baseline" ? "" : "overflow-hidden",
|
|
1042
|
+
// Vertical padding: 2dp for gap variant (to match Figma), 4dp for baseline
|
|
1043
|
+
isGapVariant ? "py-0.5" : MENU_GROUP_PADDING_Y,
|
|
1044
|
+
// Horizontal padding: 4dp for expressive menus (both static and popup), 0 for baseline
|
|
1045
|
+
menuVariant === "expressive" ? "px-1" : "",
|
|
1046
|
+
// Gap variant has floating segments, so each group manages its own shadow
|
|
1047
|
+
isGapVariant ? "elevation-2" : "",
|
|
1048
|
+
// Background based on color variant (transparent for baseline to avoid double-layering)
|
|
1049
|
+
menuVariant === "baseline" ? "bg-transparent" : colors.containerBg,
|
|
1050
|
+
className
|
|
1051
|
+
),
|
|
1052
|
+
animate: { borderRadius: currentShape },
|
|
1053
|
+
transition: FAST_SPATIAL_SPRING,
|
|
1054
|
+
onPointerEnter: handlePointerEnter,
|
|
1055
|
+
onPointerLeave: handlePointerLeave
|
|
1056
|
+
}, rest), {
|
|
1057
|
+
children: [
|
|
1058
|
+
label && /* @__PURE__ */ jsx(
|
|
1059
|
+
"span",
|
|
1060
|
+
{
|
|
1061
|
+
className: cn(
|
|
1062
|
+
// Padding: 12dp top, 12dp horizontal, 8dp bottom (MD3 spec)
|
|
1063
|
+
"block pt-3 px-3 pb-2",
|
|
1064
|
+
"text-label-small",
|
|
1065
|
+
menuVariant === "baseline" ? "text-m3-on-surface-variant" : colorVariant === "vibrant" ? "text-m3-on-tertiary-container" : "text-m3-on-surface-variant"
|
|
1066
|
+
),
|
|
1067
|
+
children: label
|
|
1068
|
+
}
|
|
1069
|
+
),
|
|
1070
|
+
enhancedChildren
|
|
1071
|
+
]
|
|
1072
|
+
})
|
|
1073
|
+
);
|
|
1074
|
+
}
|
|
1075
|
+
);
|
|
1076
|
+
MenuGroup.displayName = "MenuGroup";
|
|
1077
|
+
|
|
412
1078
|
// src/ui/shared/constants.ts
|
|
413
1079
|
var SPRING_TRANSITION_FAST = {
|
|
414
1080
|
type: "spring",
|
|
@@ -440,7 +1106,7 @@ var VARIANT_FONT = {
|
|
|
440
1106
|
rounded: "'Material Symbols Rounded'",
|
|
441
1107
|
sharp: "'Material Symbols Sharp'"
|
|
442
1108
|
};
|
|
443
|
-
var IconComponent =
|
|
1109
|
+
var IconComponent = React38.forwardRef(
|
|
444
1110
|
(_a, ref) => {
|
|
445
1111
|
var _b = _a, {
|
|
446
1112
|
name,
|
|
@@ -506,222 +1172,527 @@ var IconComponent = React31.forwardRef(
|
|
|
506
1172
|
}
|
|
507
1173
|
);
|
|
508
1174
|
IconComponent.displayName = "Icon";
|
|
509
|
-
var Icon =
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
1175
|
+
var Icon = React38.memo(IconComponent);
|
|
1176
|
+
function getItemShapeClass(position, selected, isStatic = false, menuVariant = "expressive") {
|
|
1177
|
+
if (menuVariant === "baseline") return BASELINE_ITEM_SHAPE;
|
|
1178
|
+
if (selected) return ITEM_SHAPE_CLASSES.selected;
|
|
1179
|
+
if (isStatic && position === "standalone") return "rounded-[12px]";
|
|
1180
|
+
return ITEM_SHAPE_CLASSES[position];
|
|
1181
|
+
}
|
|
1182
|
+
var MenuItem = React38.forwardRef(
|
|
1183
|
+
(_a, ref) => {
|
|
1184
|
+
var _b = _a, {
|
|
1185
|
+
children,
|
|
1186
|
+
onClick,
|
|
1187
|
+
leadingIcon,
|
|
1188
|
+
trailingIcon,
|
|
1189
|
+
supportingText,
|
|
1190
|
+
trailingText,
|
|
1191
|
+
selected,
|
|
1192
|
+
disabled = false,
|
|
1193
|
+
itemPosition = "standalone",
|
|
1194
|
+
colorVariant: propColorVariant,
|
|
1195
|
+
keepOpen = false,
|
|
1196
|
+
className,
|
|
1197
|
+
isSubTrigger,
|
|
1198
|
+
value,
|
|
1199
|
+
role
|
|
1200
|
+
} = _b, rest = __objRest(_b, [
|
|
1201
|
+
"children",
|
|
1202
|
+
"onClick",
|
|
1203
|
+
"leadingIcon",
|
|
1204
|
+
"trailingIcon",
|
|
1205
|
+
"supportingText",
|
|
1206
|
+
"trailingText",
|
|
1207
|
+
"selected",
|
|
1208
|
+
"disabled",
|
|
1209
|
+
"itemPosition",
|
|
1210
|
+
"colorVariant",
|
|
1211
|
+
"keepOpen",
|
|
1212
|
+
"className",
|
|
1213
|
+
"isSubTrigger",
|
|
1214
|
+
"value",
|
|
1215
|
+
"role"
|
|
1216
|
+
]);
|
|
1217
|
+
const {
|
|
1218
|
+
menuVariant,
|
|
1219
|
+
colorVariant: contextColorVariant,
|
|
1220
|
+
menuPrimitive
|
|
1221
|
+
} = useMenuContext();
|
|
1222
|
+
const colorVariant = propColorVariant != null ? propColorVariant : contextColorVariant;
|
|
1223
|
+
const colors = menuVariant === "baseline" ? BASELINE_COLORS : colorVariant === "vibrant" ? VIBRANT_COLORS : STANDARD_COLORS;
|
|
1224
|
+
const isStaticMenu = menuPrimitive === "static";
|
|
1225
|
+
const shapeClass = getItemShapeClass(
|
|
1226
|
+
itemPosition,
|
|
1227
|
+
!!selected,
|
|
1228
|
+
isStaticMenu,
|
|
1229
|
+
menuVariant
|
|
1230
|
+
);
|
|
1231
|
+
const isSelectable = selected !== void 0 && !isSubTrigger;
|
|
1232
|
+
const isCheckbox = role === "menuitemcheckbox" || selected !== void 0 && !role && !isSubTrigger;
|
|
1233
|
+
const isRadio = role === "menuitemradio";
|
|
1234
|
+
const ItemPrimitive = isStaticMenu || isSubTrigger ? Slot : menuPrimitive === "context" ? isCheckbox ? RxContextMenu.CheckboxItem : isRadio ? RxContextMenu.RadioItem : RxContextMenu.Item : isCheckbox ? DropdownMenu.CheckboxItem : isRadio ? DropdownMenu.RadioItem : DropdownMenu.Item;
|
|
1235
|
+
return /* @__PURE__ */ jsx(
|
|
1236
|
+
ItemPrimitive,
|
|
1237
|
+
__spreadProps(__spreadValues({
|
|
1238
|
+
ref
|
|
1239
|
+
}, isStaticMenu || isSubTrigger ? {
|
|
1240
|
+
role: role || (isCheckbox ? "menuitemcheckbox" : isRadio ? "menuitemradio" : "menuitem"),
|
|
1241
|
+
"aria-checked": isCheckbox || isRadio ? !!selected : void 0,
|
|
1242
|
+
"aria-disabled": disabled ? true : void 0,
|
|
1243
|
+
tabIndex: disabled ? -1 : 0,
|
|
1244
|
+
onKeyDown: (e) => {
|
|
1245
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
1246
|
+
e.preventDefault();
|
|
1247
|
+
onClick == null ? void 0 : onClick(e);
|
|
1248
|
+
}
|
|
1249
|
+
},
|
|
1250
|
+
onClick
|
|
1251
|
+
} : __spreadProps(__spreadValues(__spreadValues({
|
|
1252
|
+
disabled,
|
|
1253
|
+
onSelect: keepOpen ? (e) => e.preventDefault() : void 0,
|
|
1254
|
+
onClick
|
|
1255
|
+
}, isCheckbox || isRadio ? { checked: !!selected } : {}), isRadio ? { value: value != null ? value : "" } : {}), {
|
|
1256
|
+
asChild: true
|
|
1257
|
+
})), {
|
|
1258
|
+
children: /* @__PURE__ */ jsxs(
|
|
1259
|
+
"div",
|
|
1260
|
+
__spreadProps(__spreadValues({
|
|
1261
|
+
className: cn(
|
|
1262
|
+
// Layout
|
|
1263
|
+
"relative flex w-full cursor-pointer select-none items-center outline-none",
|
|
1264
|
+
// Sizing: min-h 48dp, min-w 112dp, max-w 280dp
|
|
1265
|
+
"min-h-12 min-w-28 max-w-70",
|
|
1266
|
+
// Horizontal padding
|
|
1267
|
+
menuVariant === "baseline" ? MENU_BASELINE_ITEM_HORIZONTAL_PADDING : "px-4",
|
|
1268
|
+
// Spacing between items
|
|
1269
|
+
isStaticMenu ? "my-0.5" : "",
|
|
1270
|
+
// Shape morphing (position-based + selected override)
|
|
1271
|
+
shapeClass,
|
|
1272
|
+
// Animate border-radius AND background-color together (FastEffects: 150ms)
|
|
1273
|
+
"transition-[border-radius,background-color] duration-150 ease-in",
|
|
1274
|
+
// Colors based on variant + selection
|
|
1275
|
+
selected ? cn(colors.selectedBg, colors.selectedText) : cn(colors.labelText),
|
|
1276
|
+
// State layers (only on unselected items)
|
|
1277
|
+
!selected && colors.hoverLayer,
|
|
1278
|
+
!selected && colors.focusLayer,
|
|
1279
|
+
// Focus visible ring (WCAG 2.4.11 — visible focus indicator)
|
|
1280
|
+
// Uses ring-inset so the ring doesn't overflow the item bounds.
|
|
1281
|
+
"focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-m3-primary",
|
|
1282
|
+
// Disabled
|
|
1283
|
+
disabled && "pointer-events-none opacity-[0.38]",
|
|
1284
|
+
className
|
|
1285
|
+
)
|
|
1286
|
+
}, rest), {
|
|
1287
|
+
children: [
|
|
1288
|
+
(isSelectable || leadingIcon) && /* @__PURE__ */ jsx(
|
|
1289
|
+
"div",
|
|
1290
|
+
{
|
|
1291
|
+
className: "flex h-5 w-5 shrink-0 items-center justify-center mr-3",
|
|
1292
|
+
"aria-hidden": "true",
|
|
1293
|
+
children: isSelectable ? /* @__PURE__ */ jsx(AnimatePresence, { initial: false, mode: "wait", children: selected ? /* @__PURE__ */ jsx(
|
|
1294
|
+
m.span,
|
|
1295
|
+
{
|
|
1296
|
+
className: cn(
|
|
1297
|
+
"flex h-full w-full items-center justify-center overflow-hidden",
|
|
1298
|
+
colors.selectedIcon
|
|
1299
|
+
),
|
|
1300
|
+
variants: CHECK_ICON_VARIANTS,
|
|
1301
|
+
initial: "hidden",
|
|
1302
|
+
animate: "visible",
|
|
1303
|
+
exit: "exit",
|
|
1304
|
+
children: /* @__PURE__ */ jsx(Icon, { name: "check", fill: 1, size: MENU_CHECK_ICON_SIZE })
|
|
1305
|
+
},
|
|
1306
|
+
"check"
|
|
1307
|
+
) : leadingIcon ? /* @__PURE__ */ jsx(
|
|
1308
|
+
m.span,
|
|
1309
|
+
{
|
|
1310
|
+
className: cn(
|
|
1311
|
+
"flex h-full w-full items-center justify-center overflow-hidden",
|
|
1312
|
+
colors.iconColor
|
|
1313
|
+
),
|
|
1314
|
+
variants: CHECK_ICON_VARIANTS,
|
|
1315
|
+
initial: "hidden",
|
|
1316
|
+
animate: "visible",
|
|
1317
|
+
exit: "exit",
|
|
1318
|
+
children: leadingIcon
|
|
1319
|
+
},
|
|
1320
|
+
"icon"
|
|
1321
|
+
) : (
|
|
1322
|
+
// Spacer for selectable items with no icon, to keep text aligned
|
|
1323
|
+
/* @__PURE__ */ jsx("div", { className: "w-5" })
|
|
1324
|
+
) }) : (
|
|
1325
|
+
// Static icon for non-selectable items
|
|
1326
|
+
/* @__PURE__ */ jsx(
|
|
1327
|
+
"span",
|
|
1328
|
+
{
|
|
1329
|
+
className: cn(
|
|
1330
|
+
"flex h-full w-full items-center justify-center",
|
|
1331
|
+
colors.iconColor
|
|
1332
|
+
),
|
|
1333
|
+
children: leadingIcon
|
|
1334
|
+
}
|
|
1335
|
+
)
|
|
1336
|
+
)
|
|
1337
|
+
}
|
|
1338
|
+
),
|
|
1339
|
+
/* @__PURE__ */ jsxs("span", { className: "flex flex-1 flex-col", children: [
|
|
1340
|
+
/* @__PURE__ */ jsx("span", { className: "text-body-large leading-snug", children }),
|
|
1341
|
+
supportingText && /* @__PURE__ */ jsx(
|
|
1342
|
+
"span",
|
|
1343
|
+
{
|
|
1344
|
+
className: cn(
|
|
1345
|
+
"text-body-medium leading-snug",
|
|
1346
|
+
// Source: StandardMenuTokens.ItemSupportingTextColor / VibrantMenuTokens
|
|
1347
|
+
selected ? colors.selectedText : colors.supportingTextColor
|
|
1348
|
+
),
|
|
1349
|
+
children: supportingText
|
|
1350
|
+
}
|
|
1351
|
+
)
|
|
1352
|
+
] }),
|
|
1353
|
+
(trailingText || trailingIcon) && /* @__PURE__ */ jsx(
|
|
1354
|
+
"span",
|
|
1355
|
+
{
|
|
1356
|
+
className: cn(
|
|
1357
|
+
// Minimum 12dp gap from label column (ListTokens)
|
|
1358
|
+
"ml-3 flex shrink-0 items-center",
|
|
1359
|
+
// Source: StandardMenuTokens.ItemTrailingIconColor / VibrantMenuTokens
|
|
1360
|
+
selected ? colors.selectedText : colors.trailingIconColor
|
|
1361
|
+
),
|
|
1362
|
+
"aria-hidden": trailingIcon ? "true" : void 0,
|
|
1363
|
+
children: trailingText ? /* @__PURE__ */ jsx("span", { className: "text-label-small tracking-wider", children: trailingText }) : trailingIcon
|
|
1364
|
+
}
|
|
1365
|
+
)
|
|
1366
|
+
]
|
|
1367
|
+
})
|
|
1368
|
+
)
|
|
1369
|
+
})
|
|
1370
|
+
);
|
|
1371
|
+
}
|
|
1372
|
+
);
|
|
1373
|
+
MenuItem.displayName = "MenuItem";
|
|
1374
|
+
function SubMenu({
|
|
1375
|
+
children,
|
|
1376
|
+
trigger,
|
|
1377
|
+
side = "right",
|
|
1378
|
+
colorVariant: propColorVariant,
|
|
1379
|
+
hoverOpenDelay = 200,
|
|
1380
|
+
hoverCloseDelay = 300
|
|
1381
|
+
}) {
|
|
1382
|
+
const { colorVariant: contextColorVariant, menuPrimitive } = useMenuContext();
|
|
1383
|
+
const colorVariant = propColorVariant != null ? propColorVariant : contextColorVariant;
|
|
1384
|
+
const [open, setOpen] = React38.useState(false);
|
|
1385
|
+
const openTimerRef = React38.useRef(null);
|
|
1386
|
+
const closeTimerRef = React38.useRef(
|
|
1387
|
+
null
|
|
647
1388
|
);
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
1389
|
+
const clearTimers = React38.useCallback(() => {
|
|
1390
|
+
if (openTimerRef.current) clearTimeout(openTimerRef.current);
|
|
1391
|
+
if (closeTimerRef.current) clearTimeout(closeTimerRef.current);
|
|
1392
|
+
}, []);
|
|
1393
|
+
const handleTriggerPointerEnter = React38.useCallback(() => {
|
|
1394
|
+
clearTimers();
|
|
1395
|
+
openTimerRef.current = setTimeout(() => setOpen(true), hoverOpenDelay);
|
|
1396
|
+
}, [hoverOpenDelay, clearTimers]);
|
|
1397
|
+
const handleTriggerPointerLeave = React38.useCallback(() => {
|
|
1398
|
+
clearTimers();
|
|
1399
|
+
closeTimerRef.current = setTimeout(() => setOpen(false), hoverCloseDelay);
|
|
1400
|
+
}, [hoverCloseDelay, clearTimers]);
|
|
1401
|
+
const handleContentPointerEnter = React38.useCallback(() => {
|
|
1402
|
+
clearTimers();
|
|
1403
|
+
}, [clearTimers]);
|
|
1404
|
+
const handleContentPointerLeave = React38.useCallback(() => {
|
|
1405
|
+
clearTimers();
|
|
1406
|
+
closeTimerRef.current = setTimeout(() => setOpen(false), hoverCloseDelay);
|
|
1407
|
+
}, [hoverCloseDelay, clearTimers]);
|
|
1408
|
+
React38.useEffect(() => () => clearTimers(), [clearTimers]);
|
|
1409
|
+
const Sub3 = menuPrimitive === "context" ? RxContextMenu.Sub : DropdownMenu.Sub;
|
|
1410
|
+
const SubTrigger3 = menuPrimitive === "context" ? RxContextMenu.SubTrigger : DropdownMenu.SubTrigger;
|
|
1411
|
+
const SubContent3 = menuPrimitive === "context" ? RxContextMenu.SubContent : DropdownMenu.SubContent;
|
|
1412
|
+
const Portal7 = menuPrimitive === "context" ? RxContextMenu.Portal : DropdownMenu.Portal;
|
|
1413
|
+
return /* @__PURE__ */ jsxs(Sub3, { open, onOpenChange: setOpen, children: [
|
|
1414
|
+
/* @__PURE__ */ jsx(
|
|
1415
|
+
SubTrigger3,
|
|
1416
|
+
{
|
|
1417
|
+
className: "w-full outline-none",
|
|
1418
|
+
onPointerEnter: handleTriggerPointerEnter,
|
|
1419
|
+
onPointerLeave: handleTriggerPointerLeave,
|
|
1420
|
+
children: React38.isValidElement(trigger) ? React38.cloneElement(trigger, {
|
|
1421
|
+
isSubTrigger: true,
|
|
1422
|
+
// Auto-add chevron if missing
|
|
1423
|
+
trailingIcon: trigger.props.trailingIcon || /* @__PURE__ */ jsx(Icon, { name: "chevron_right", size: 20 })
|
|
1424
|
+
}) : trigger
|
|
1425
|
+
}
|
|
1426
|
+
),
|
|
1427
|
+
/* @__PURE__ */ jsx(AnimatePresence, { children: open && /* @__PURE__ */ jsx(Portal7, { forceMount: true, children: /* @__PURE__ */ jsx(
|
|
1428
|
+
SubContent3,
|
|
1429
|
+
{
|
|
1430
|
+
sideOffset: 4,
|
|
1431
|
+
alignOffset: -4,
|
|
1432
|
+
forceMount: true,
|
|
1433
|
+
className: "outline-none",
|
|
1434
|
+
children: /* @__PURE__ */ jsx(
|
|
1435
|
+
SubMenuContent,
|
|
1436
|
+
{
|
|
1437
|
+
side,
|
|
1438
|
+
colorVariant,
|
|
1439
|
+
onPointerEnter: handleContentPointerEnter,
|
|
1440
|
+
onPointerLeave: handleContentPointerLeave,
|
|
1441
|
+
children
|
|
1442
|
+
}
|
|
1443
|
+
)
|
|
1444
|
+
}
|
|
1445
|
+
) }) })
|
|
1446
|
+
] });
|
|
1447
|
+
}
|
|
1448
|
+
SubMenu.displayName = "SubMenu";
|
|
1449
|
+
function SubMenuContent({
|
|
1450
|
+
children,
|
|
1451
|
+
side,
|
|
1452
|
+
colorVariant: propColorVariant,
|
|
1453
|
+
onPointerEnter,
|
|
1454
|
+
onPointerLeave
|
|
1455
|
+
}) {
|
|
1456
|
+
const { menuVariant, colorVariant: contextColorVariant } = useMenuContext();
|
|
1457
|
+
const colorVariant = propColorVariant != null ? propColorVariant : contextColorVariant;
|
|
1458
|
+
const colors = menuVariant === "baseline" ? BASELINE_COLORS : colorVariant === "vibrant" ? VIBRANT_COLORS : STANDARD_COLORS;
|
|
652
1459
|
return /* @__PURE__ */ jsx(
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
1460
|
+
m.div,
|
|
1461
|
+
{
|
|
1462
|
+
role: "menu",
|
|
1463
|
+
"aria-orientation": "vertical",
|
|
1464
|
+
onPointerEnter,
|
|
1465
|
+
onPointerLeave,
|
|
1466
|
+
className: cn(
|
|
1467
|
+
"z-50 flex flex-col",
|
|
1468
|
+
// Width constraints
|
|
1469
|
+
MENU_MIN_WIDTH,
|
|
1470
|
+
MENU_MAX_WIDTH,
|
|
1471
|
+
// Vertical padding: 8dp
|
|
1472
|
+
MENU_POPUP_PADDING_Y,
|
|
1473
|
+
// Gap between groups: 2dp
|
|
1474
|
+
MENU_GROUP_GAP,
|
|
1475
|
+
// Container background
|
|
1476
|
+
colors.containerBg,
|
|
1477
|
+
// Container shape: CornerExtraSmall (4px)
|
|
1478
|
+
MENU_CONTAINER_SHAPE,
|
|
1479
|
+
// Elevation-2 shadow
|
|
1480
|
+
"elevation-2",
|
|
1481
|
+
// Overflow clip
|
|
1482
|
+
"overflow-hidden",
|
|
1483
|
+
"outline-none"
|
|
1484
|
+
),
|
|
1485
|
+
variants: SUBMENU_CONTAINER_VARIANTS,
|
|
1486
|
+
initial: "hidden",
|
|
1487
|
+
animate: "visible",
|
|
1488
|
+
exit: "exit",
|
|
1489
|
+
style: {
|
|
1490
|
+
transformOrigin: side === "right" ? "top left" : "top right"
|
|
1491
|
+
},
|
|
1492
|
+
children
|
|
1493
|
+
}
|
|
658
1494
|
);
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
var
|
|
662
|
-
var _b = _a, { className,
|
|
1495
|
+
}
|
|
1496
|
+
SubMenuContent.displayName = "SubMenuContent";
|
|
1497
|
+
var VerticalMenuDivider = React38.forwardRef((_a, ref) => {
|
|
1498
|
+
var _b = _a, { className, index, count, isGapVariant } = _b, props = __objRest(_b, ["className", "index", "count", "isGapVariant"]);
|
|
663
1499
|
return /* @__PURE__ */ jsx(
|
|
664
|
-
|
|
1500
|
+
"hr",
|
|
665
1501
|
__spreadValues({
|
|
666
1502
|
ref,
|
|
667
1503
|
className: cn(
|
|
668
|
-
|
|
669
|
-
|
|
1504
|
+
// HorizontalDividerPadding: horizontal=12dp, vertical=2dp
|
|
1505
|
+
"mx-3 my-0.5",
|
|
1506
|
+
// 1px height, no default border
|
|
1507
|
+
"h-px border-0",
|
|
1508
|
+
// Source: MenuDefaults.HorizontalDividerPadding / outline-variant
|
|
1509
|
+
"bg-m3-outline-variant",
|
|
670
1510
|
className
|
|
671
1511
|
)
|
|
672
1512
|
}, props)
|
|
673
1513
|
);
|
|
674
1514
|
});
|
|
675
|
-
|
|
676
|
-
var
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
{
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
1515
|
+
VerticalMenuDivider.displayName = "VerticalMenuDivider";
|
|
1516
|
+
var VerticalMenuGroup = MenuGroup;
|
|
1517
|
+
var VerticalMenuContent = React38.forwardRef(
|
|
1518
|
+
(_a, ref) => {
|
|
1519
|
+
var _b = _a, {
|
|
1520
|
+
children,
|
|
1521
|
+
separatorStyle = "gap",
|
|
1522
|
+
colorVariant: propColorVariant,
|
|
1523
|
+
className
|
|
1524
|
+
} = _b, props = __objRest(_b, [
|
|
1525
|
+
"children",
|
|
1526
|
+
"separatorStyle",
|
|
1527
|
+
"colorVariant",
|
|
1528
|
+
"className"
|
|
1529
|
+
]);
|
|
1530
|
+
const { colorVariant: contextColorVariant } = useMenuContext();
|
|
1531
|
+
const colorVariant = propColorVariant != null ? propColorVariant : contextColorVariant;
|
|
1532
|
+
const colors = colorVariant === "vibrant" ? VIBRANT_COLORS : STANDARD_COLORS;
|
|
1533
|
+
const flattenChildren = (children2) => {
|
|
1534
|
+
return React38.Children.toArray(children2).reduce(
|
|
1535
|
+
(acc, child) => {
|
|
1536
|
+
if (React38.isValidElement(child)) {
|
|
1537
|
+
if (child.type === React38.Fragment) {
|
|
1538
|
+
return acc.concat(
|
|
1539
|
+
flattenChildren(
|
|
1540
|
+
child.props.children
|
|
1541
|
+
)
|
|
1542
|
+
);
|
|
1543
|
+
}
|
|
1544
|
+
acc.push(child);
|
|
701
1545
|
}
|
|
1546
|
+
return acc;
|
|
1547
|
+
},
|
|
1548
|
+
[]
|
|
1549
|
+
);
|
|
1550
|
+
};
|
|
1551
|
+
const validChildren = flattenChildren(children);
|
|
1552
|
+
const groupCount = validChildren.length;
|
|
1553
|
+
const enhancedChildren = validChildren.map(
|
|
1554
|
+
(child, i) => React38.cloneElement(child, {
|
|
1555
|
+
index: i,
|
|
1556
|
+
count: groupCount,
|
|
1557
|
+
isGapVariant: separatorStyle === "gap"
|
|
1558
|
+
})
|
|
1559
|
+
);
|
|
1560
|
+
const renderedChildren = separatorStyle === "divider" ? enhancedChildren.reduce((acc, child, i) => {
|
|
1561
|
+
if (i > 0) {
|
|
1562
|
+
acc.push(
|
|
1563
|
+
/* @__PURE__ */ jsx(
|
|
1564
|
+
VerticalMenuDivider,
|
|
1565
|
+
{},
|
|
1566
|
+
`divider-${child.key || i}`
|
|
1567
|
+
)
|
|
1568
|
+
);
|
|
1569
|
+
}
|
|
1570
|
+
acc.push(child);
|
|
1571
|
+
return acc;
|
|
1572
|
+
}, []) : enhancedChildren;
|
|
1573
|
+
return /* @__PURE__ */ jsx(
|
|
1574
|
+
"div",
|
|
1575
|
+
__spreadProps(__spreadValues({
|
|
1576
|
+
ref,
|
|
1577
|
+
className: cn(
|
|
1578
|
+
"flex flex-col w-full",
|
|
1579
|
+
// Gap variant: transparent background + 2dp gap — page bg shows through gaps.
|
|
1580
|
+
// Divider variant: solid container background behind all groups.
|
|
1581
|
+
separatorStyle === "gap" ? cn("bg-transparent", MENU_GROUP_GAP) : colors.containerBg,
|
|
1582
|
+
className
|
|
702
1583
|
)
|
|
703
|
-
|
|
704
|
-
|
|
1584
|
+
}, props), {
|
|
1585
|
+
children: renderedChildren
|
|
1586
|
+
})
|
|
1587
|
+
);
|
|
1588
|
+
}
|
|
1589
|
+
);
|
|
1590
|
+
VerticalMenuContent.displayName = "VerticalMenuContent";
|
|
1591
|
+
var VerticalMenu = React38.forwardRef((_a, ref) => {
|
|
1592
|
+
var _b = _a, { children, colorVariant = "standard", className } = _b, props = __objRest(_b, ["children", "colorVariant", "className"]);
|
|
1593
|
+
const noop = React38.useCallback(() => {
|
|
1594
|
+
}, []);
|
|
1595
|
+
const colors = colorVariant === "vibrant" ? VIBRANT_COLORS : STANDARD_COLORS;
|
|
1596
|
+
const containerRef = React38.useRef(null);
|
|
1597
|
+
const mergedRef = React38.useCallback(
|
|
1598
|
+
(node) => {
|
|
1599
|
+
containerRef.current = node;
|
|
1600
|
+
if (typeof ref === "function") ref(node);
|
|
1601
|
+
else if (ref)
|
|
1602
|
+
ref.current = node;
|
|
1603
|
+
},
|
|
1604
|
+
[ref]
|
|
705
1605
|
);
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
var
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
1606
|
+
const handleKeyDown = React38.useCallback(
|
|
1607
|
+
(e) => {
|
|
1608
|
+
var _a2;
|
|
1609
|
+
if (!containerRef.current) return;
|
|
1610
|
+
const items = Array.from(
|
|
1611
|
+
containerRef.current.querySelectorAll(
|
|
1612
|
+
'[role="menuitem"]:not([aria-disabled="true"]):not([tabindex="-1"]),[role="menuitemcheckbox"]:not([aria-disabled="true"]):not([tabindex="-1"]),[role="menuitemradio"]:not([aria-disabled="true"]):not([tabindex="-1"])'
|
|
1613
|
+
)
|
|
1614
|
+
);
|
|
1615
|
+
if (!items.length) return;
|
|
1616
|
+
const idx = items.indexOf(document.activeElement);
|
|
1617
|
+
let next = null;
|
|
1618
|
+
switch (e.key) {
|
|
1619
|
+
case "ArrowDown":
|
|
1620
|
+
e.preventDefault();
|
|
1621
|
+
next = idx < items.length - 1 ? idx + 1 : 0;
|
|
1622
|
+
break;
|
|
1623
|
+
case "ArrowUp":
|
|
1624
|
+
e.preventDefault();
|
|
1625
|
+
next = idx > 0 ? idx - 1 : items.length - 1;
|
|
1626
|
+
break;
|
|
1627
|
+
case "Home":
|
|
1628
|
+
e.preventDefault();
|
|
1629
|
+
next = 0;
|
|
1630
|
+
break;
|
|
1631
|
+
case "End":
|
|
1632
|
+
e.preventDefault();
|
|
1633
|
+
next = items.length - 1;
|
|
1634
|
+
break;
|
|
1635
|
+
default:
|
|
1636
|
+
return;
|
|
1637
|
+
}
|
|
1638
|
+
if (next !== null) (_a2 = items[next]) == null ? void 0 : _a2.focus();
|
|
1639
|
+
},
|
|
1640
|
+
[]
|
|
1641
|
+
);
|
|
1642
|
+
const separatorStyle = detectSeparatorStyle(children);
|
|
1643
|
+
const isGapVariant = separatorStyle !== "divider";
|
|
714
1644
|
return /* @__PURE__ */ jsx(
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
1645
|
+
MenuProvider,
|
|
1646
|
+
{
|
|
1647
|
+
variant: "expressive",
|
|
1648
|
+
colorVariant,
|
|
1649
|
+
menuPrimitive: "static",
|
|
1650
|
+
open: true,
|
|
1651
|
+
onOpenChange: noop,
|
|
1652
|
+
children: /* @__PURE__ */ jsx(
|
|
1653
|
+
"div",
|
|
1654
|
+
__spreadProps(__spreadValues({
|
|
1655
|
+
ref: mergedRef,
|
|
1656
|
+
role: "menu",
|
|
1657
|
+
"aria-orientation": "vertical",
|
|
1658
|
+
onKeyDown: handleKeyDown,
|
|
1659
|
+
className: cn(
|
|
1660
|
+
// Width constraints: 112dp min, 280dp max (MenuTokens)
|
|
1661
|
+
MENU_MIN_WIDTH,
|
|
1662
|
+
MENU_MAX_WIDTH,
|
|
1663
|
+
"flex flex-col",
|
|
1664
|
+
isGapVariant ? [
|
|
1665
|
+
// GAP VARIANT: NO overflow-hidden — groups must morph freely.
|
|
1666
|
+
"outline-none"
|
|
1667
|
+
// NO background — transparent between segments.
|
|
1668
|
+
// NO rounded corners — each group manages its own shape.
|
|
1669
|
+
// Elevation is managed by each individual group.
|
|
1670
|
+
] : [
|
|
1671
|
+
// DIVIDER VARIANT: Container clips the content.
|
|
1672
|
+
"rounded-2xl",
|
|
1673
|
+
"overflow-hidden",
|
|
1674
|
+
colors.containerBg,
|
|
1675
|
+
"elevation-2",
|
|
1676
|
+
"outline-none"
|
|
1677
|
+
],
|
|
1678
|
+
className
|
|
1679
|
+
)
|
|
1680
|
+
}, props), {
|
|
1681
|
+
children
|
|
1682
|
+
})
|
|
720
1683
|
)
|
|
721
|
-
}
|
|
1684
|
+
}
|
|
722
1685
|
);
|
|
723
|
-
};
|
|
724
|
-
|
|
1686
|
+
});
|
|
1687
|
+
VerticalMenu.displayName = "VerticalMenu";
|
|
1688
|
+
function detectSeparatorStyle(children) {
|
|
1689
|
+
const child = React38.Children.toArray(children).find(React38.isValidElement);
|
|
1690
|
+
if (child) {
|
|
1691
|
+
const style = child.props.separatorStyle;
|
|
1692
|
+
if (style) return style;
|
|
1693
|
+
}
|
|
1694
|
+
return "gap";
|
|
1695
|
+
}
|
|
725
1696
|
function MoreVertIcon() {
|
|
726
1697
|
return /* @__PURE__ */ jsx(
|
|
727
1698
|
"span",
|
|
@@ -736,10 +1707,14 @@ function OverflowItem({ item }) {
|
|
|
736
1707
|
var _a;
|
|
737
1708
|
if (item.type === "toggleable") {
|
|
738
1709
|
return /* @__PURE__ */ jsx(
|
|
739
|
-
|
|
1710
|
+
MenuItem,
|
|
740
1711
|
{
|
|
741
|
-
|
|
742
|
-
|
|
1712
|
+
role: "menuitemcheckbox",
|
|
1713
|
+
selected: (_a = item.checked) != null ? _a : false,
|
|
1714
|
+
onClick: () => {
|
|
1715
|
+
var _a2;
|
|
1716
|
+
return (_a2 = item.onCheckedChange) == null ? void 0 : _a2.call(item, !item.checked);
|
|
1717
|
+
},
|
|
743
1718
|
disabled: item.enabled === false,
|
|
744
1719
|
children: item.label
|
|
745
1720
|
}
|
|
@@ -754,15 +1729,15 @@ function OverflowItem({ item }) {
|
|
|
754
1729
|
}
|
|
755
1730
|
}) });
|
|
756
1731
|
}
|
|
757
|
-
return /* @__PURE__ */ jsx(
|
|
1732
|
+
return /* @__PURE__ */ jsx(MenuItem, { onClick: item.onClick, disabled: item.enabled === false, children: item.label });
|
|
758
1733
|
}
|
|
759
1734
|
function AppBarOverflowIndicator({
|
|
760
1735
|
items,
|
|
761
1736
|
className
|
|
762
1737
|
}) {
|
|
763
1738
|
if (items.length === 0) return null;
|
|
764
|
-
return /* @__PURE__ */ jsxs(
|
|
765
|
-
/* @__PURE__ */ jsx(
|
|
1739
|
+
return /* @__PURE__ */ jsxs(Menu, { children: [
|
|
1740
|
+
/* @__PURE__ */ jsx(MenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
766
1741
|
"button",
|
|
767
1742
|
{
|
|
768
1743
|
type: "button",
|
|
@@ -781,7 +1756,7 @@ function AppBarOverflowIndicator({
|
|
|
781
1756
|
children: /* @__PURE__ */ jsx(MoreVertIcon, {})
|
|
782
1757
|
}
|
|
783
1758
|
) }),
|
|
784
|
-
/* @__PURE__ */ jsx(
|
|
1759
|
+
/* @__PURE__ */ jsx(MenuContent, { align: "end", sideOffset: 4, children: items.map((item, index) => (
|
|
785
1760
|
// biome-ignore lint/suspicious/noArrayIndexKey: static list from props
|
|
786
1761
|
/* @__PURE__ */ jsx(OverflowItem, { item }, index)
|
|
787
1762
|
)) })
|
|
@@ -792,11 +1767,11 @@ function AppBarColumn({
|
|
|
792
1767
|
maxItemCount,
|
|
793
1768
|
className
|
|
794
1769
|
}) {
|
|
795
|
-
const containerRef =
|
|
796
|
-
const [visibleCount, setVisibleCount] =
|
|
1770
|
+
const containerRef = React38.useRef(null);
|
|
1771
|
+
const [visibleCount, setVisibleCount] = React38.useState(
|
|
797
1772
|
maxItemCount != null ? maxItemCount : items.length
|
|
798
1773
|
);
|
|
799
|
-
|
|
1774
|
+
React38.useEffect(() => {
|
|
800
1775
|
if (maxItemCount !== void 0) {
|
|
801
1776
|
setVisibleCount(Math.min(maxItemCount, items.length));
|
|
802
1777
|
return;
|
|
@@ -844,11 +1819,11 @@ function AppBarColumn({
|
|
|
844
1819
|
);
|
|
845
1820
|
}
|
|
846
1821
|
function AppBarRow({ items, maxItemCount, className }) {
|
|
847
|
-
const containerRef =
|
|
848
|
-
const [visibleCount, setVisibleCount] =
|
|
1822
|
+
const containerRef = React38.useRef(null);
|
|
1823
|
+
const [visibleCount, setVisibleCount] = React38.useState(
|
|
849
1824
|
maxItemCount != null ? maxItemCount : items.length
|
|
850
1825
|
);
|
|
851
|
-
|
|
1826
|
+
React38.useEffect(() => {
|
|
852
1827
|
if (maxItemCount !== void 0) {
|
|
853
1828
|
setVisibleCount(Math.min(maxItemCount, items.length));
|
|
854
1829
|
return;
|
|
@@ -902,12 +1877,12 @@ function useAppBarScroll({
|
|
|
902
1877
|
collapsedHeight = 64,
|
|
903
1878
|
expandedHeight = 112
|
|
904
1879
|
} = {}) {
|
|
905
|
-
const [isScrolled, setIsScrolled] =
|
|
906
|
-
const [collapsedFraction, setCollapsedFraction] =
|
|
907
|
-
const [isHidden, setIsHidden] =
|
|
908
|
-
const prevScrollYRef =
|
|
1880
|
+
const [isScrolled, setIsScrolled] = React38.useState(false);
|
|
1881
|
+
const [collapsedFraction, setCollapsedFraction] = React38.useState(0);
|
|
1882
|
+
const [isHidden, setIsHidden] = React38.useState(false);
|
|
1883
|
+
const prevScrollYRef = React38.useRef(0);
|
|
909
1884
|
const hideThreshold = 64;
|
|
910
|
-
|
|
1885
|
+
React38.useEffect(() => {
|
|
911
1886
|
var _a;
|
|
912
1887
|
const scrollDistance = expandedHeight - collapsedHeight;
|
|
913
1888
|
const getScrollY = () => {
|
|
@@ -1028,7 +2003,7 @@ function useFlexibleAppBar({
|
|
|
1028
2003
|
expandedHeight
|
|
1029
2004
|
});
|
|
1030
2005
|
const scrollProgress = useMotionValue(0);
|
|
1031
|
-
|
|
2006
|
+
React38.useEffect(() => {
|
|
1032
2007
|
scrollProgress.set(
|
|
1033
2008
|
shouldReduceMotion ? collapsedFraction > 0.5 ? 1 : 0 : collapsedFraction
|
|
1034
2009
|
);
|
|
@@ -1369,7 +2344,7 @@ function SearchAppBar({
|
|
|
1369
2344
|
}) {
|
|
1370
2345
|
var _a, _b;
|
|
1371
2346
|
const shouldReduceMotion = useReducedMotion();
|
|
1372
|
-
const [isSearchOpen, setIsSearchOpen] =
|
|
2347
|
+
const [isSearchOpen, setIsSearchOpen] = React38.useState(false);
|
|
1373
2348
|
const { isScrolled } = useAppBarScroll({
|
|
1374
2349
|
scrollElement,
|
|
1375
2350
|
behavior: scrollBehavior === "exitUntilCollapsed" ? "pinned" : scrollBehavior
|
|
@@ -1483,8 +2458,8 @@ function SearchView({
|
|
|
1483
2458
|
className
|
|
1484
2459
|
}) {
|
|
1485
2460
|
const shouldReduceMotion = useReducedMotion();
|
|
1486
|
-
const inputRef =
|
|
1487
|
-
|
|
2461
|
+
const inputRef = React38.useRef(null);
|
|
2462
|
+
React38.useEffect(() => {
|
|
1488
2463
|
const timer = window.setTimeout(() => {
|
|
1489
2464
|
var _a;
|
|
1490
2465
|
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
@@ -1754,9 +2729,9 @@ function formatBadgeLabel(children, max) {
|
|
|
1754
2729
|
return "";
|
|
1755
2730
|
}
|
|
1756
2731
|
function detectBadgeHasContent(badge) {
|
|
1757
|
-
return
|
|
2732
|
+
return React38.isValidElement(badge) && badge.props.children != null;
|
|
1758
2733
|
}
|
|
1759
|
-
var BadgeImpl =
|
|
2734
|
+
var BadgeImpl = React38.forwardRef(
|
|
1760
2735
|
(_a, ref) => {
|
|
1761
2736
|
var _b = _a, {
|
|
1762
2737
|
children,
|
|
@@ -1810,7 +2785,7 @@ var BadgeImpl = React31.forwardRef(
|
|
|
1810
2785
|
}
|
|
1811
2786
|
);
|
|
1812
2787
|
BadgeImpl.displayName = "Badge";
|
|
1813
|
-
var Badge =
|
|
2788
|
+
var Badge = React38.memo(BadgeImpl);
|
|
1814
2789
|
function BadgedBox({
|
|
1815
2790
|
badge,
|
|
1816
2791
|
children,
|
|
@@ -1876,11 +2851,11 @@ var ROTATE_KEY_SPLINES = [
|
|
|
1876
2851
|
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";
|
|
1877
2852
|
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";
|
|
1878
2853
|
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";
|
|
1879
|
-
var IndeterminateSvg =
|
|
2854
|
+
var IndeterminateSvg = React38.memo(function IndeterminateSvg2({
|
|
1880
2855
|
size
|
|
1881
2856
|
}) {
|
|
1882
|
-
const [ready, setReady] =
|
|
1883
|
-
|
|
2857
|
+
const [ready, setReady] = React38.useState(false);
|
|
2858
|
+
React38.useEffect(() => {
|
|
1884
2859
|
const raf = requestAnimationFrame(() => setReady(true));
|
|
1885
2860
|
return () => cancelAnimationFrame(raf);
|
|
1886
2861
|
}, []);
|
|
@@ -1925,7 +2900,7 @@ var IndeterminateSvg = React31.memo(function IndeterminateSvg2({
|
|
|
1925
2900
|
}
|
|
1926
2901
|
);
|
|
1927
2902
|
});
|
|
1928
|
-
var DeterminateSvg =
|
|
2903
|
+
var DeterminateSvg = React38.memo(function DeterminateSvg2({
|
|
1929
2904
|
size,
|
|
1930
2905
|
progress
|
|
1931
2906
|
}) {
|
|
@@ -1950,7 +2925,7 @@ var DeterminateSvg = React31.memo(function DeterminateSvg2({
|
|
|
1950
2925
|
}
|
|
1951
2926
|
);
|
|
1952
2927
|
});
|
|
1953
|
-
var LoadingIndicator =
|
|
2928
|
+
var LoadingIndicator = React38.forwardRef(
|
|
1954
2929
|
(_a, ref) => {
|
|
1955
2930
|
var _b = _a, {
|
|
1956
2931
|
variant = "uncontained",
|
|
@@ -2065,7 +3040,7 @@ function getSinePath(startX, endX, phase, wl, amp) {
|
|
|
2065
3040
|
d += ` L ${endX.toFixed(2)} ${yEnd.toFixed(2)}`;
|
|
2066
3041
|
return d;
|
|
2067
3042
|
}
|
|
2068
|
-
var CircularProgress =
|
|
3043
|
+
var CircularProgress = React38.forwardRef(
|
|
2069
3044
|
(_a, ref) => {
|
|
2070
3045
|
var _b = _a, {
|
|
2071
3046
|
value,
|
|
@@ -2103,15 +3078,15 @@ var CircularProgress = React31.forwardRef(
|
|
|
2103
3078
|
const isWavy = shape === "wavy";
|
|
2104
3079
|
const BASELINE_SIZE = 48;
|
|
2105
3080
|
const scaleFactor = size / BASELINE_SIZE;
|
|
2106
|
-
const effectiveAmplitude =
|
|
3081
|
+
const effectiveAmplitude = React38.useMemo(
|
|
2107
3082
|
() => amplitude != null ? amplitude : 1.6 * scaleFactor,
|
|
2108
3083
|
[amplitude, scaleFactor]
|
|
2109
3084
|
);
|
|
2110
|
-
const effectiveWavelength =
|
|
3085
|
+
const effectiveWavelength = React38.useMemo(
|
|
2111
3086
|
() => wavelength != null ? wavelength : 15 * scaleFactor,
|
|
2112
3087
|
[wavelength, scaleFactor]
|
|
2113
3088
|
);
|
|
2114
|
-
const wavyActivePath =
|
|
3089
|
+
const wavyActivePath = React38.useMemo(
|
|
2115
3090
|
() => isWavy ? generateWavyCircularPath(
|
|
2116
3091
|
center,
|
|
2117
3092
|
radius,
|
|
@@ -2120,8 +3095,8 @@ var CircularProgress = React31.forwardRef(
|
|
|
2120
3095
|
) : null,
|
|
2121
3096
|
[isWavy, center, radius, effectiveAmplitude, effectiveWavelength]
|
|
2122
3097
|
);
|
|
2123
|
-
const circumference =
|
|
2124
|
-
const gapForTrack =
|
|
3098
|
+
const circumference = React38.useMemo(() => 2 * Math.PI * radius, [radius]);
|
|
3099
|
+
const gapForTrack = React38.useMemo(
|
|
2125
3100
|
() => (gapSize + trackHeight) / circumference,
|
|
2126
3101
|
[gapSize, trackHeight, circumference]
|
|
2127
3102
|
);
|
|
@@ -2310,9 +3285,9 @@ var CircularProgress = React31.forwardRef(
|
|
|
2310
3285
|
);
|
|
2311
3286
|
CircularProgress.displayName = "CircularProgress";
|
|
2312
3287
|
function useContainerWidth() {
|
|
2313
|
-
const [width, setWidth] =
|
|
2314
|
-
const observerRef =
|
|
2315
|
-
const ref =
|
|
3288
|
+
const [width, setWidth] = React38.useState(0);
|
|
3289
|
+
const observerRef = React38.useRef(null);
|
|
3290
|
+
const ref = React38.useCallback((node) => {
|
|
2316
3291
|
if (observerRef.current) {
|
|
2317
3292
|
observerRef.current.disconnect();
|
|
2318
3293
|
observerRef.current = null;
|
|
@@ -2326,7 +3301,7 @@ function useContainerWidth() {
|
|
|
2326
3301
|
observerRef.current = obs;
|
|
2327
3302
|
}
|
|
2328
3303
|
}, []);
|
|
2329
|
-
|
|
3304
|
+
React38.useEffect(() => {
|
|
2330
3305
|
return () => {
|
|
2331
3306
|
if (observerRef.current) {
|
|
2332
3307
|
observerRef.current.disconnect();
|
|
@@ -2336,7 +3311,7 @@ function useContainerWidth() {
|
|
|
2336
3311
|
return [ref, width];
|
|
2337
3312
|
}
|
|
2338
3313
|
function useMergedRef(...refs) {
|
|
2339
|
-
return
|
|
3314
|
+
return React38.useCallback(
|
|
2340
3315
|
(node) => {
|
|
2341
3316
|
for (const ref of refs) {
|
|
2342
3317
|
if (typeof ref === "function") {
|
|
@@ -2350,7 +3325,7 @@ function useMergedRef(...refs) {
|
|
|
2350
3325
|
[refs]
|
|
2351
3326
|
);
|
|
2352
3327
|
}
|
|
2353
|
-
var FlatLinearTrack =
|
|
3328
|
+
var FlatLinearTrack = React38.memo(function FlatLinearTrack2({
|
|
2354
3329
|
trackHeight,
|
|
2355
3330
|
activeColor,
|
|
2356
3331
|
trackColor,
|
|
@@ -2426,7 +3401,7 @@ var FlatLinearTrack = React31.memo(function FlatLinearTrack2({
|
|
|
2426
3401
|
}
|
|
2427
3402
|
);
|
|
2428
3403
|
});
|
|
2429
|
-
var WavyLinearTrack =
|
|
3404
|
+
var WavyLinearTrack = React38.memo(function WavyLinearTrack2({
|
|
2430
3405
|
trackHeight,
|
|
2431
3406
|
svgHeight,
|
|
2432
3407
|
amplitude,
|
|
@@ -2445,13 +3420,13 @@ var WavyLinearTrack = React31.memo(function WavyLinearTrack2({
|
|
|
2445
3420
|
}) {
|
|
2446
3421
|
const isDeterminate = typeof value === "number";
|
|
2447
3422
|
const clampedValue = isDeterminate ? Math.max(0, Math.min(100, value)) : 100;
|
|
2448
|
-
const titleId =
|
|
3423
|
+
const titleId = React38.useId();
|
|
2449
3424
|
const [containerRef, width] = useContainerWidth();
|
|
2450
|
-
const activePathRef =
|
|
2451
|
-
const trackPathRef =
|
|
3425
|
+
const activePathRef = React38.useRef(null);
|
|
3426
|
+
const trackPathRef = React38.useRef(null);
|
|
2452
3427
|
const amplitudeMV = useMotionValue(amplitude);
|
|
2453
3428
|
const fractionMV = useMotionValue(isDeterminate ? clampedValue / 100 : 1);
|
|
2454
|
-
|
|
3429
|
+
React38.useEffect(() => {
|
|
2455
3430
|
if (isDeterminate) {
|
|
2456
3431
|
const fraction = clampedValue / 100;
|
|
2457
3432
|
let targetAmp = amplitude;
|
|
@@ -2622,7 +3597,7 @@ var WavyLinearTrack = React31.memo(function WavyLinearTrack2({
|
|
|
2622
3597
|
}
|
|
2623
3598
|
);
|
|
2624
3599
|
});
|
|
2625
|
-
var LinearProgress =
|
|
3600
|
+
var LinearProgress = React38.forwardRef(
|
|
2626
3601
|
(_a, ref) => {
|
|
2627
3602
|
var _b = _a, {
|
|
2628
3603
|
value,
|
|
@@ -2663,10 +3638,10 @@ var LinearProgress = React31.forwardRef(
|
|
|
2663
3638
|
]);
|
|
2664
3639
|
const isDeterminate = value !== void 0;
|
|
2665
3640
|
const clampedValue = isDeterminate ? Math.min(100, Math.max(0, value)) : 0;
|
|
2666
|
-
const containerRef =
|
|
3641
|
+
const containerRef = React38.useRef(null);
|
|
2667
3642
|
const mergedRef = useMergedRef(ref, containerRef);
|
|
2668
|
-
const [isRtl, setIsRtl] =
|
|
2669
|
-
|
|
3643
|
+
const [isRtl, setIsRtl] = React38.useState(false);
|
|
3644
|
+
React38.useEffect(() => {
|
|
2670
3645
|
if (containerRef.current) {
|
|
2671
3646
|
const dir = getComputedStyle(containerRef.current).direction;
|
|
2672
3647
|
setIsRtl(dir === "rtl");
|
|
@@ -2674,16 +3649,16 @@ var LinearProgress = React31.forwardRef(
|
|
|
2674
3649
|
}, []);
|
|
2675
3650
|
const isWavy = shape === "wavy";
|
|
2676
3651
|
const resolvedTrackShape = trackShape != null ? trackShape : shape;
|
|
2677
|
-
const effectiveAmplitude =
|
|
2678
|
-
const svgHeight =
|
|
3652
|
+
const effectiveAmplitude = React38.useMemo(() => amplitude != null ? amplitude : 3, [amplitude]);
|
|
3653
|
+
const svgHeight = React38.useMemo(
|
|
2679
3654
|
() => isWavy ? trackHeight + effectiveAmplitude * 2 : trackHeight,
|
|
2680
3655
|
[isWavy, trackHeight, effectiveAmplitude]
|
|
2681
3656
|
);
|
|
2682
|
-
const shouldShowStop =
|
|
3657
|
+
const shouldShowStop = React38.useMemo(
|
|
2683
3658
|
() => isDeterminate && resolvedTrackShape === "flat" && (showStopIndicator === true || showStopIndicator === "auto" && isDeterminate),
|
|
2684
3659
|
[isDeterminate, resolvedTrackShape, showStopIndicator]
|
|
2685
3660
|
);
|
|
2686
|
-
const stopSize =
|
|
3661
|
+
const stopSize = React38.useMemo(
|
|
2687
3662
|
() => Math.max(2, trackHeight > 4 ? 4 : trackHeight / 2),
|
|
2688
3663
|
[trackHeight]
|
|
2689
3664
|
);
|
|
@@ -2756,14 +3731,14 @@ var LinearProgress = React31.forwardRef(
|
|
|
2756
3731
|
}
|
|
2757
3732
|
);
|
|
2758
3733
|
LinearProgress.displayName = "LinearProgress";
|
|
2759
|
-
var ProgressIndicator =
|
|
3734
|
+
var ProgressIndicator = React38.forwardRef((props, ref) => {
|
|
2760
3735
|
if (props.variant === "circular") {
|
|
2761
3736
|
return /* @__PURE__ */ jsx(CircularProgress, __spreadValues({ ref }, props));
|
|
2762
3737
|
}
|
|
2763
3738
|
return /* @__PURE__ */ jsx(LinearProgress, __spreadValues({ ref }, props));
|
|
2764
3739
|
});
|
|
2765
3740
|
ProgressIndicator.displayName = "ProgressIndicator";
|
|
2766
|
-
var RippleItem =
|
|
3741
|
+
var RippleItem = React38.memo(function RippleItem2({
|
|
2767
3742
|
ripple,
|
|
2768
3743
|
onDone
|
|
2769
3744
|
}) {
|
|
@@ -2807,8 +3782,8 @@ function Ripple({
|
|
|
2807
3782
|
}
|
|
2808
3783
|
function useRippleState(options = {}) {
|
|
2809
3784
|
const { disabled = false } = options;
|
|
2810
|
-
const [ripples, setRipples] =
|
|
2811
|
-
const onPointerDown =
|
|
3785
|
+
const [ripples, setRipples] = React38.useState([]);
|
|
3786
|
+
const onPointerDown = React38.useCallback(
|
|
2812
3787
|
(e) => {
|
|
2813
3788
|
if (disabled) return;
|
|
2814
3789
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
@@ -2822,7 +3797,7 @@ function useRippleState(options = {}) {
|
|
|
2822
3797
|
},
|
|
2823
3798
|
[disabled]
|
|
2824
3799
|
);
|
|
2825
|
-
const removeRipple =
|
|
3800
|
+
const removeRipple = React38.useCallback((id) => {
|
|
2826
3801
|
setRipples((prev) => prev.filter((r) => r.id !== id));
|
|
2827
3802
|
}, []);
|
|
2828
3803
|
return { ripples, onPointerDown, removeRipple };
|
|
@@ -2956,7 +3931,7 @@ function toSentenceCase(text) {
|
|
|
2956
3931
|
}
|
|
2957
3932
|
function resolveLabel(children, asChild) {
|
|
2958
3933
|
if (asChild) {
|
|
2959
|
-
const child =
|
|
3934
|
+
const child = React38.Children.only(children);
|
|
2960
3935
|
return child.props.children;
|
|
2961
3936
|
}
|
|
2962
3937
|
return typeof children === "string" ? toSentenceCase(children) : children;
|
|
@@ -3028,7 +4003,7 @@ function AnimatedIconSlot({
|
|
|
3028
4003
|
}
|
|
3029
4004
|
);
|
|
3030
4005
|
}
|
|
3031
|
-
var ButtonComponent =
|
|
4006
|
+
var ButtonComponent = React38.forwardRef(
|
|
3032
4007
|
(_a, ref) => {
|
|
3033
4008
|
var _b = _a, {
|
|
3034
4009
|
className,
|
|
@@ -3077,15 +4052,15 @@ var ButtonComponent = React31.forwardRef(
|
|
|
3077
4052
|
const { pressed: pressedRadius } = (_b2 = radiusMap[size]) != null ? _b2 : radiusMap.sm;
|
|
3078
4053
|
const iconClass = (_c = SIZE_ICON_CLASS[size]) != null ? _c : "size-5";
|
|
3079
4054
|
const mergedStyle = __spreadValues(__spreadValues({}, SIZE_STYLES[size]), style);
|
|
3080
|
-
const labelText =
|
|
4055
|
+
const labelText = React38.useMemo(
|
|
3081
4056
|
() => resolveLabel(children, asChild),
|
|
3082
4057
|
[children, asChild]
|
|
3083
4058
|
);
|
|
3084
4059
|
const computedAriaLabel = ariaLabelProp || (typeof children === "string" ? children : void 0);
|
|
3085
4060
|
const needsTouchTarget = size === "xs" || size === "sm";
|
|
3086
4061
|
const motionRadius = useMotionValue(animateRadius);
|
|
3087
|
-
const asChildRef =
|
|
3088
|
-
const mergedRef =
|
|
4062
|
+
const asChildRef = React38.useRef(null);
|
|
4063
|
+
const mergedRef = React38.useCallback(
|
|
3089
4064
|
(node) => {
|
|
3090
4065
|
asChildRef.current = node;
|
|
3091
4066
|
if (typeof ref === "function") ref(node);
|
|
@@ -3094,27 +4069,27 @@ var ButtonComponent = React31.forwardRef(
|
|
|
3094
4069
|
},
|
|
3095
4070
|
[ref]
|
|
3096
4071
|
);
|
|
3097
|
-
|
|
4072
|
+
React38.useEffect(
|
|
3098
4073
|
() => motionRadius.on("change", (v) => {
|
|
3099
4074
|
if (asChildRef.current)
|
|
3100
4075
|
asChildRef.current.style.borderRadius = `${v}px`;
|
|
3101
4076
|
}),
|
|
3102
4077
|
[motionRadius]
|
|
3103
4078
|
);
|
|
3104
|
-
|
|
4079
|
+
React38.useEffect(() => {
|
|
3105
4080
|
springAnimate(motionRadius, animateRadius);
|
|
3106
4081
|
}, [animateRadius, motionRadius]);
|
|
3107
4082
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
3108
4083
|
disabled: loading
|
|
3109
4084
|
});
|
|
3110
|
-
const handleClick =
|
|
4085
|
+
const handleClick = React38.useCallback(
|
|
3111
4086
|
(e) => {
|
|
3112
4087
|
if (loading) return e.preventDefault();
|
|
3113
4088
|
onClick == null ? void 0 : onClick(e);
|
|
3114
4089
|
},
|
|
3115
4090
|
[loading, onClick]
|
|
3116
4091
|
);
|
|
3117
|
-
const handleKeyDown =
|
|
4092
|
+
const handleKeyDown = React38.useCallback(
|
|
3118
4093
|
(e) => {
|
|
3119
4094
|
if (loading) return;
|
|
3120
4095
|
if (onClick && (e.key === "Enter" || e.key === " ")) {
|
|
@@ -3157,7 +4132,7 @@ var ButtonComponent = React31.forwardRef(
|
|
|
3157
4132
|
] });
|
|
3158
4133
|
if (asChild) {
|
|
3159
4134
|
const htmlProps = stripMotionProps(restProps);
|
|
3160
|
-
const child =
|
|
4135
|
+
const child = React38.Children.only(children);
|
|
3161
4136
|
const handleAsChildPointerDown = (e) => {
|
|
3162
4137
|
springAnimate(motionRadius, pressedRadius);
|
|
3163
4138
|
onPointerDown == null ? void 0 : onPointerDown(e);
|
|
@@ -3181,7 +4156,7 @@ var ButtonComponent = React31.forwardRef(
|
|
|
3181
4156
|
}),
|
|
3182
4157
|
className: buttonClassName
|
|
3183
4158
|
}, htmlProps), {
|
|
3184
|
-
children:
|
|
4159
|
+
children: React38.cloneElement(child, { children: innerContent })
|
|
3185
4160
|
})
|
|
3186
4161
|
) });
|
|
3187
4162
|
}
|
|
@@ -3209,7 +4184,7 @@ var ButtonComponent = React31.forwardRef(
|
|
|
3209
4184
|
}
|
|
3210
4185
|
);
|
|
3211
4186
|
ButtonComponent.displayName = "Button";
|
|
3212
|
-
var Button =
|
|
4187
|
+
var Button = React38.memo(ButtonComponent);
|
|
3213
4188
|
var SIZE_PADDING_MAP = {
|
|
3214
4189
|
xs: "0.75rem",
|
|
3215
4190
|
sm: "1rem",
|
|
@@ -3238,7 +4213,7 @@ var PRESSED_RADIUS_MAP = {
|
|
|
3238
4213
|
lg: 28,
|
|
3239
4214
|
xl: 40
|
|
3240
4215
|
};
|
|
3241
|
-
var ButtonGroupComponent =
|
|
4216
|
+
var ButtonGroupComponent = React38.forwardRef(
|
|
3242
4217
|
(_a, ref) => {
|
|
3243
4218
|
var _b = _a, {
|
|
3244
4219
|
className,
|
|
@@ -3259,13 +4234,13 @@ var ButtonGroupComponent = React31.forwardRef(
|
|
|
3259
4234
|
"showCheck",
|
|
3260
4235
|
"children"
|
|
3261
4236
|
]);
|
|
3262
|
-
const [pressedIndex, setPressedIndex] =
|
|
3263
|
-
const childrenArray =
|
|
3264
|
-
() =>
|
|
4237
|
+
const [pressedIndex, setPressedIndex] = React38.useState(null);
|
|
4238
|
+
const childrenArray = React38.useMemo(
|
|
4239
|
+
() => React38.Children.toArray(children).filter(React38.isValidElement),
|
|
3265
4240
|
[children]
|
|
3266
4241
|
);
|
|
3267
4242
|
const count = childrenArray.length;
|
|
3268
|
-
const handlePointerLeaveAndUp =
|
|
4243
|
+
const handlePointerLeaveAndUp = React38.useCallback(() => {
|
|
3269
4244
|
setPressedIndex(null);
|
|
3270
4245
|
}, []);
|
|
3271
4246
|
return /* @__PURE__ */ jsx(
|
|
@@ -3404,7 +4379,7 @@ var ButtonGroupComponent = React31.forwardRef(
|
|
|
3404
4379
|
duration: 0.2
|
|
3405
4380
|
};
|
|
3406
4381
|
}
|
|
3407
|
-
return
|
|
4382
|
+
return React38.cloneElement(element, __spreadValues(__spreadProps(__spreadValues({
|
|
3408
4383
|
key: (_a2 = element.key) != null ? _a2 : index,
|
|
3409
4384
|
tabIndex: isFirst ? 0 : -1,
|
|
3410
4385
|
size: size || element.props.size,
|
|
@@ -3433,7 +4408,7 @@ var ButtonGroupComponent = React31.forwardRef(
|
|
|
3433
4408
|
}
|
|
3434
4409
|
);
|
|
3435
4410
|
ButtonGroupComponent.displayName = "ButtonGroup";
|
|
3436
|
-
var ButtonGroup =
|
|
4411
|
+
var ButtonGroup = React38.memo(ButtonGroupComponent);
|
|
3437
4412
|
var SHADOW = {
|
|
3438
4413
|
level0: "none",
|
|
3439
4414
|
level1: "0px 1px 2px 0px rgba(0,0,0,.3), 0px 1px 3px 1px rgba(0,0,0,.15)",
|
|
@@ -3492,7 +4467,7 @@ function useCardElevation(variant, disabled) {
|
|
|
3492
4467
|
}
|
|
3493
4468
|
};
|
|
3494
4469
|
}
|
|
3495
|
-
var CardImpl =
|
|
4470
|
+
var CardImpl = React38.forwardRef(
|
|
3496
4471
|
(_a, ref) => {
|
|
3497
4472
|
var _b = _a, {
|
|
3498
4473
|
className,
|
|
@@ -3590,7 +4565,7 @@ var CardImpl = React31.forwardRef(
|
|
|
3590
4565
|
}
|
|
3591
4566
|
);
|
|
3592
4567
|
CardImpl.displayName = "Card";
|
|
3593
|
-
var Card =
|
|
4568
|
+
var Card = React38.memo(CardImpl);
|
|
3594
4569
|
var MD3_STANDARD = [0.2, 0, 0, 1];
|
|
3595
4570
|
var MD3_FAST_EFFECTS = [0.3, 0, 1, 1];
|
|
3596
4571
|
var CHECKMARK_PATH = "M 4.5 9.5 L 7.5 12.5 L 13.5 5.5";
|
|
@@ -3604,7 +4579,7 @@ var NEXT_STATE = {
|
|
|
3604
4579
|
checked: "indeterminate",
|
|
3605
4580
|
indeterminate: "unchecked"
|
|
3606
4581
|
};
|
|
3607
|
-
var CheckboxVisual =
|
|
4582
|
+
var CheckboxVisual = React38.memo(function CheckboxVisual2({
|
|
3608
4583
|
isSelected,
|
|
3609
4584
|
isIndeterminate,
|
|
3610
4585
|
containerBg,
|
|
@@ -3675,7 +4650,7 @@ var CheckboxVisual = React31.memo(function CheckboxVisual2({
|
|
|
3675
4650
|
);
|
|
3676
4651
|
});
|
|
3677
4652
|
function useMergedRef2(externalRef, internalRef) {
|
|
3678
|
-
return
|
|
4653
|
+
return React38.useCallback(
|
|
3679
4654
|
(node) => {
|
|
3680
4655
|
internalRef.current = node;
|
|
3681
4656
|
if (!externalRef) return;
|
|
@@ -3688,7 +4663,7 @@ function useMergedRef2(externalRef, internalRef) {
|
|
|
3688
4663
|
[externalRef, internalRef]
|
|
3689
4664
|
);
|
|
3690
4665
|
}
|
|
3691
|
-
var CheckboxComponent =
|
|
4666
|
+
var CheckboxComponent = React38.forwardRef(
|
|
3692
4667
|
({
|
|
3693
4668
|
checked,
|
|
3694
4669
|
defaultChecked = false,
|
|
@@ -3710,20 +4685,20 @@ var CheckboxComponent = React31.forwardRef(
|
|
|
3710
4685
|
}, ref) => {
|
|
3711
4686
|
var _a;
|
|
3712
4687
|
const prefersReduced = (_a = useReducedMotion()) != null ? _a : false;
|
|
3713
|
-
const generatedId =
|
|
4688
|
+
const generatedId = React38.useId();
|
|
3714
4689
|
const inputId = idProp != null ? idProp : label ? `checkbox-${generatedId}` : void 0;
|
|
3715
|
-
const [internalState, setInternalState] =
|
|
4690
|
+
const [internalState, setInternalState] = React38.useState(
|
|
3716
4691
|
() => defaultChecked ? "checked" : "unchecked"
|
|
3717
4692
|
);
|
|
3718
4693
|
const isControlled = stateProp !== void 0 || checked !== void 0;
|
|
3719
4694
|
const baseState = isControlled ? resolveState(checked, false, stateProp) : internalState;
|
|
3720
4695
|
const effectiveState = indeterminate ? "indeterminate" : baseState;
|
|
3721
|
-
const [ripples, setRipples] =
|
|
3722
|
-
const removeRipple =
|
|
4696
|
+
const [ripples, setRipples] = React38.useState([]);
|
|
4697
|
+
const removeRipple = React38.useCallback(
|
|
3723
4698
|
(id) => setRipples((prev) => prev.filter((r) => r.id !== id)),
|
|
3724
4699
|
[]
|
|
3725
4700
|
);
|
|
3726
|
-
const onPointerDown =
|
|
4701
|
+
const onPointerDown = React38.useCallback(
|
|
3727
4702
|
(e) => {
|
|
3728
4703
|
if (disabled) return;
|
|
3729
4704
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
@@ -3737,7 +4712,7 @@ var CheckboxComponent = React31.forwardRef(
|
|
|
3737
4712
|
},
|
|
3738
4713
|
[disabled]
|
|
3739
4714
|
);
|
|
3740
|
-
const handleChange =
|
|
4715
|
+
const handleChange = React38.useCallback(
|
|
3741
4716
|
(e) => {
|
|
3742
4717
|
if (disabled) return;
|
|
3743
4718
|
if (stateProp !== void 0) {
|
|
@@ -3763,9 +4738,9 @@ var CheckboxComponent = React31.forwardRef(
|
|
|
3763
4738
|
onCheckedChange
|
|
3764
4739
|
]
|
|
3765
4740
|
);
|
|
3766
|
-
const inputRef =
|
|
4741
|
+
const inputRef = React38.useRef(null);
|
|
3767
4742
|
const mergedRef = useMergedRef2(ref, inputRef);
|
|
3768
|
-
|
|
4743
|
+
React38.useEffect(() => {
|
|
3769
4744
|
if (inputRef.current) {
|
|
3770
4745
|
inputRef.current.indeterminate = effectiveState === "indeterminate";
|
|
3771
4746
|
}
|
|
@@ -3890,13 +4865,13 @@ var CheckboxComponent = React31.forwardRef(
|
|
|
3890
4865
|
}
|
|
3891
4866
|
);
|
|
3892
4867
|
CheckboxComponent.displayName = "Checkbox";
|
|
3893
|
-
var Checkbox =
|
|
3894
|
-
var TriStateCheckboxComponent =
|
|
4868
|
+
var Checkbox = React38.memo(CheckboxComponent);
|
|
4869
|
+
var TriStateCheckboxComponent = React38.forwardRef((_a, ref) => {
|
|
3895
4870
|
var _b = _a, { state, onStateChange } = _b, rest = __objRest(_b, ["state", "onStateChange"]);
|
|
3896
4871
|
return /* @__PURE__ */ jsx(Checkbox, __spreadValues({ ref, state, onStateChange }, rest));
|
|
3897
4872
|
});
|
|
3898
4873
|
TriStateCheckboxComponent.displayName = "TriStateCheckbox";
|
|
3899
|
-
var TriStateCheckbox =
|
|
4874
|
+
var TriStateCheckbox = React38.memo(TriStateCheckboxComponent);
|
|
3900
4875
|
function CheckIcon({ className }) {
|
|
3901
4876
|
return /* @__PURE__ */ jsx(
|
|
3902
4877
|
"svg",
|
|
@@ -3990,7 +4965,7 @@ var chipVariants = cva(
|
|
|
3990
4965
|
defaultVariants: { variant: "assist" }
|
|
3991
4966
|
}
|
|
3992
4967
|
);
|
|
3993
|
-
var ChipImpl =
|
|
4968
|
+
var ChipImpl = React38.forwardRef(
|
|
3994
4969
|
(_a, ref) => {
|
|
3995
4970
|
var _b = _a, {
|
|
3996
4971
|
variant = "assist",
|
|
@@ -4026,7 +5001,7 @@ var ChipImpl = React31.forwardRef(
|
|
|
4026
5001
|
const showCheckmark = isFilter && selected;
|
|
4027
5002
|
const hasTrailingContent = !!trailingIcon || !!onRemove;
|
|
4028
5003
|
const hasLeadingContent = isFilter || !!resolvedLeadingIcon;
|
|
4029
|
-
const paddingClass =
|
|
5004
|
+
const paddingClass = React38.useMemo(
|
|
4030
5005
|
() => cn(
|
|
4031
5006
|
!isInput && !hasLeadingContent && !hasTrailingContent && "px-4",
|
|
4032
5007
|
!isInput && hasLeadingContent && !hasTrailingContent && "pl-2 pr-4",
|
|
@@ -4039,7 +5014,7 @@ var ChipImpl = React31.forwardRef(
|
|
|
4039
5014
|
),
|
|
4040
5015
|
[isInput, hasLeadingContent, hasTrailingContent]
|
|
4041
5016
|
);
|
|
4042
|
-
const stateClass =
|
|
5017
|
+
const stateClass = React38.useMemo(
|
|
4043
5018
|
() => cn(
|
|
4044
5019
|
(isFilter || isInput) && selected && "bg-m3-secondary-container text-m3-on-secondary-container border-none before:bg-m3-on-secondary-container",
|
|
4045
5020
|
elevated && !selected && "bg-m3-surface-container-low border-none elevation-1",
|
|
@@ -4050,7 +5025,7 @@ var ChipImpl = React31.forwardRef(
|
|
|
4050
5025
|
),
|
|
4051
5026
|
[isFilter, isInput, selected, elevated, disabled]
|
|
4052
5027
|
);
|
|
4053
|
-
const leadingIconColorClass =
|
|
5028
|
+
const leadingIconColorClass = React38.useMemo(
|
|
4054
5029
|
() => cn(
|
|
4055
5030
|
(variant === "assist" || variant === "suggestion") && "text-m3-primary",
|
|
4056
5031
|
isFilter && !selected && "text-m3-primary",
|
|
@@ -4061,7 +5036,7 @@ var ChipImpl = React31.forwardRef(
|
|
|
4061
5036
|
[variant, isFilter, isInput, selected]
|
|
4062
5037
|
);
|
|
4063
5038
|
const isCompound = !!onRemove;
|
|
4064
|
-
const
|
|
5039
|
+
const Root6 = isCompound ? "div" : "button";
|
|
4065
5040
|
const containerClass = cn(
|
|
4066
5041
|
chipVariants({ variant }),
|
|
4067
5042
|
!isCompound && paddingClass,
|
|
@@ -4131,7 +5106,7 @@ var ChipImpl = React31.forwardRef(
|
|
|
4131
5106
|
/* @__PURE__ */ jsx("span", { className: "whitespace-nowrap", children: label })
|
|
4132
5107
|
] });
|
|
4133
5108
|
return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: /* @__PURE__ */ jsxs(
|
|
4134
|
-
|
|
5109
|
+
Root6,
|
|
4135
5110
|
__spreadProps(__spreadValues(__spreadProps(__spreadValues({
|
|
4136
5111
|
ref: !isCompound ? ref : void 0,
|
|
4137
5112
|
type: !isCompound ? "button" : void 0
|
|
@@ -4222,8 +5197,8 @@ var ChipImpl = React31.forwardRef(
|
|
|
4222
5197
|
}
|
|
4223
5198
|
);
|
|
4224
5199
|
ChipImpl.displayName = "Chip";
|
|
4225
|
-
var Chip =
|
|
4226
|
-
var ScrollArea =
|
|
5200
|
+
var Chip = React38.memo(ChipImpl);
|
|
5201
|
+
var ScrollArea = React38.forwardRef(
|
|
4227
5202
|
(_a, ref) => {
|
|
4228
5203
|
var _b = _a, {
|
|
4229
5204
|
className,
|
|
@@ -4282,7 +5257,7 @@ var ScrollArea = React31.forwardRef(
|
|
|
4282
5257
|
}
|
|
4283
5258
|
);
|
|
4284
5259
|
ScrollArea.displayName = "ScrollArea";
|
|
4285
|
-
var ScrollAreaScrollbar =
|
|
5260
|
+
var ScrollAreaScrollbar = React38.forwardRef((_a, ref) => {
|
|
4286
5261
|
var _b = _a, { className, orientation = "vertical" } = _b, props = __objRest(_b, ["className", "orientation"]);
|
|
4287
5262
|
return /* @__PURE__ */ jsx(
|
|
4288
5263
|
RadixScrollArea.Scrollbar,
|
|
@@ -4312,7 +5287,7 @@ var ScrollAreaScrollbar = React31.forwardRef((_a, ref) => {
|
|
|
4312
5287
|
);
|
|
4313
5288
|
});
|
|
4314
5289
|
ScrollAreaScrollbar.displayName = RadixScrollArea.Scrollbar.displayName;
|
|
4315
|
-
var ScrollAreaCorner =
|
|
5290
|
+
var ScrollAreaCorner = React38.forwardRef((_a, ref) => {
|
|
4316
5291
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
4317
5292
|
return /* @__PURE__ */ jsx(
|
|
4318
5293
|
RadixScrollArea.Corner,
|
|
@@ -4589,7 +5564,7 @@ function resolveDisabledBgClass(colorStyle) {
|
|
|
4589
5564
|
}
|
|
4590
5565
|
return "disabled:text-m3-on-surface/[0.38]";
|
|
4591
5566
|
}
|
|
4592
|
-
var IconButtonComponent =
|
|
5567
|
+
var IconButtonComponent = React38.forwardRef(
|
|
4593
5568
|
(_a, ref) => {
|
|
4594
5569
|
var _b = _a, {
|
|
4595
5570
|
className,
|
|
@@ -4623,18 +5598,18 @@ var IconButtonComponent = React31.forwardRef(
|
|
|
4623
5598
|
var _a2, _b2;
|
|
4624
5599
|
const isToggle = variant === "toggle";
|
|
4625
5600
|
const isSelected = isToggle && !!selected;
|
|
4626
|
-
const resolvedColorClass =
|
|
5601
|
+
const resolvedColorClass = React38.useMemo(
|
|
4627
5602
|
() => isSelected ? colorStyles[colorStyle].selected : colorStyles[colorStyle].default,
|
|
4628
5603
|
[isSelected, colorStyle]
|
|
4629
5604
|
);
|
|
4630
|
-
const outlineWidthClass =
|
|
5605
|
+
const outlineWidthClass = React38.useMemo(
|
|
4631
5606
|
() => {
|
|
4632
5607
|
var _a3;
|
|
4633
5608
|
return colorStyle === "outlined" && !isSelected ? (_a3 = SIZE_OUTLINE_WIDTH[size]) != null ? _a3 : "border" : "";
|
|
4634
5609
|
},
|
|
4635
5610
|
[colorStyle, isSelected, size]
|
|
4636
5611
|
);
|
|
4637
|
-
const disabledBgClass =
|
|
5612
|
+
const disabledBgClass = React38.useMemo(
|
|
4638
5613
|
() => resolveDisabledBgClass(colorStyle),
|
|
4639
5614
|
[colorStyle]
|
|
4640
5615
|
);
|
|
@@ -4653,7 +5628,7 @@ var IconButtonComponent = React31.forwardRef(
|
|
|
4653
5628
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
4654
5629
|
disabled: loading
|
|
4655
5630
|
});
|
|
4656
|
-
const handleClick =
|
|
5631
|
+
const handleClick = React38.useCallback(
|
|
4657
5632
|
(e) => {
|
|
4658
5633
|
if (loading) {
|
|
4659
5634
|
e.preventDefault();
|
|
@@ -4663,7 +5638,7 @@ var IconButtonComponent = React31.forwardRef(
|
|
|
4663
5638
|
},
|
|
4664
5639
|
[loading, onClick]
|
|
4665
5640
|
);
|
|
4666
|
-
const handleKeyDown =
|
|
5641
|
+
const handleKeyDown = React38.useCallback(
|
|
4667
5642
|
(e) => {
|
|
4668
5643
|
if (loading) return;
|
|
4669
5644
|
if ((e.key === "Enter" || e.key === " ") && onClick) {
|
|
@@ -4751,7 +5726,7 @@ var IconButtonComponent = React31.forwardRef(
|
|
|
4751
5726
|
}
|
|
4752
5727
|
);
|
|
4753
5728
|
IconButtonComponent.displayName = "IconButton";
|
|
4754
|
-
var IconButton =
|
|
5729
|
+
var IconButton = React38.memo(IconButtonComponent);
|
|
4755
5730
|
var MD3_SPRING = {
|
|
4756
5731
|
type: "spring",
|
|
4757
5732
|
stiffness: 400,
|
|
@@ -4788,9 +5763,9 @@ DialogTrigger.displayName = "DialogTrigger";
|
|
|
4788
5763
|
var DialogPortal = ({
|
|
4789
5764
|
open,
|
|
4790
5765
|
children
|
|
4791
|
-
}) => /* @__PURE__ */ jsx(RadixDialog.Portal, { forceMount: true, children: /* @__PURE__ */ jsx(AnimatePresence, { children: open ?
|
|
5766
|
+
}) => /* @__PURE__ */ jsx(RadixDialog.Portal, { forceMount: true, children: /* @__PURE__ */ jsx(AnimatePresence, { children: open ? React38.Children.toArray(children) : null }) });
|
|
4792
5767
|
DialogPortal.displayName = "DialogPortal";
|
|
4793
|
-
var DialogOverlay =
|
|
5768
|
+
var DialogOverlay = React38.forwardRef((_a, ref) => {
|
|
4794
5769
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
4795
5770
|
return /* @__PURE__ */ jsx(RadixDialog.Overlay, __spreadProps(__spreadValues({ ref, asChild: true }, props), { children: /* @__PURE__ */ jsx(
|
|
4796
5771
|
m.div,
|
|
@@ -4801,7 +5776,7 @@ var DialogOverlay = React31.forwardRef((_a, ref) => {
|
|
|
4801
5776
|
) }));
|
|
4802
5777
|
});
|
|
4803
5778
|
DialogOverlay.displayName = "DialogOverlay";
|
|
4804
|
-
var DialogContent =
|
|
5779
|
+
var DialogContent = React38.forwardRef((_a, ref) => {
|
|
4805
5780
|
var _b = _a, { className, children, hideCloseButton = false } = _b, props = __objRest(_b, ["className", "children", "hideCloseButton"]);
|
|
4806
5781
|
return /* @__PURE__ */ jsx(
|
|
4807
5782
|
RadixDialog.Content,
|
|
@@ -4841,7 +5816,7 @@ var DialogContent = React31.forwardRef((_a, ref) => {
|
|
|
4841
5816
|
);
|
|
4842
5817
|
});
|
|
4843
5818
|
DialogContent.displayName = "DialogContent";
|
|
4844
|
-
var DialogIcon =
|
|
5819
|
+
var DialogIcon = React38.forwardRef((_a, ref) => {
|
|
4845
5820
|
var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
|
|
4846
5821
|
return /* @__PURE__ */ jsx(
|
|
4847
5822
|
"div",
|
|
@@ -4864,7 +5839,7 @@ var DialogHeader = (_a) => {
|
|
|
4864
5839
|
return /* @__PURE__ */ jsx("div", __spreadValues({ className: cn("flex flex-col gap-2 mb-4", className) }, props));
|
|
4865
5840
|
};
|
|
4866
5841
|
DialogHeader.displayName = "DialogHeader";
|
|
4867
|
-
var DialogTitle =
|
|
5842
|
+
var DialogTitle = React38.forwardRef((_a, ref) => {
|
|
4868
5843
|
var _b = _a, { className, asChild } = _b, props = __objRest(_b, ["className", "asChild"]);
|
|
4869
5844
|
return /* @__PURE__ */ jsx(
|
|
4870
5845
|
RadixDialog.Title,
|
|
@@ -4879,7 +5854,7 @@ var DialogTitle = React31.forwardRef((_a, ref) => {
|
|
|
4879
5854
|
);
|
|
4880
5855
|
});
|
|
4881
5856
|
DialogTitle.displayName = "DialogTitle";
|
|
4882
|
-
var DialogDescription =
|
|
5857
|
+
var DialogDescription = React38.forwardRef((_a, ref) => {
|
|
4883
5858
|
var _b = _a, { className, asChild } = _b, props = __objRest(_b, ["className", "asChild"]);
|
|
4884
5859
|
return /* @__PURE__ */ jsx(
|
|
4885
5860
|
RadixDialog.Description,
|
|
@@ -4891,7 +5866,7 @@ var DialogDescription = React31.forwardRef((_a, ref) => {
|
|
|
4891
5866
|
);
|
|
4892
5867
|
});
|
|
4893
5868
|
DialogDescription.displayName = "DialogDescription";
|
|
4894
|
-
var DialogBody =
|
|
5869
|
+
var DialogBody = React38.forwardRef((_a, ref) => {
|
|
4895
5870
|
var _b = _a, { className, children, dir } = _b, props = __objRest(_b, ["className", "children", "dir"]);
|
|
4896
5871
|
return /* @__PURE__ */ jsx(
|
|
4897
5872
|
ScrollArea,
|
|
@@ -4922,7 +5897,7 @@ var DialogFooter = (_a) => {
|
|
|
4922
5897
|
};
|
|
4923
5898
|
DialogFooter.displayName = "DialogFooter";
|
|
4924
5899
|
var DialogClose = RadixDialog.Close;
|
|
4925
|
-
var DialogFullScreenContent =
|
|
5900
|
+
var DialogFullScreenContent = React38.forwardRef(
|
|
4926
5901
|
(_a, ref) => {
|
|
4927
5902
|
var _b = _a, {
|
|
4928
5903
|
className,
|
|
@@ -5005,7 +5980,7 @@ function buildWavePath(startX, endX, amplitude = 2, wavelength = 32, yCenter = 4
|
|
|
5005
5980
|
}
|
|
5006
5981
|
return d;
|
|
5007
5982
|
}
|
|
5008
|
-
var DividerImpl =
|
|
5983
|
+
var DividerImpl = React38.forwardRef(
|
|
5009
5984
|
(_a, ref) => {
|
|
5010
5985
|
var _b = _a, {
|
|
5011
5986
|
variant = "full-bleed",
|
|
@@ -5125,7 +6100,7 @@ var DividerImpl = React31.forwardRef(
|
|
|
5125
6100
|
}
|
|
5126
6101
|
);
|
|
5127
6102
|
DividerImpl.displayName = "Divider";
|
|
5128
|
-
var Divider =
|
|
6103
|
+
var Divider = React38.memo(DividerImpl);
|
|
5129
6104
|
var MD3_DRAWER_SPRING = {
|
|
5130
6105
|
type: "spring",
|
|
5131
6106
|
stiffness: 350,
|
|
@@ -5162,7 +6137,7 @@ var DrawerPortal = ({
|
|
|
5162
6137
|
open,
|
|
5163
6138
|
children
|
|
5164
6139
|
}) => /* @__PURE__ */ jsx(RadixDialog.Portal, { forceMount: true, children: /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", children: open && children }) });
|
|
5165
|
-
var DrawerOverlay =
|
|
6140
|
+
var DrawerOverlay = React38.forwardRef((_a, ref) => {
|
|
5166
6141
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
5167
6142
|
return /* @__PURE__ */ jsx(RadixDialog.Overlay, __spreadProps(__spreadValues({ ref, asChild: true }, props), { children: /* @__PURE__ */ jsx(
|
|
5168
6143
|
m.div,
|
|
@@ -5173,7 +6148,7 @@ var DrawerOverlay = React31.forwardRef((_a, ref) => {
|
|
|
5173
6148
|
) }));
|
|
5174
6149
|
});
|
|
5175
6150
|
DrawerOverlay.displayName = "DrawerOverlay";
|
|
5176
|
-
var DrawerContent =
|
|
6151
|
+
var DrawerContent = React38.forwardRef(
|
|
5177
6152
|
(_a, ref) => {
|
|
5178
6153
|
var _b = _a, {
|
|
5179
6154
|
className,
|
|
@@ -5252,7 +6227,7 @@ var DrawerFooter = (_a) => {
|
|
|
5252
6227
|
return /* @__PURE__ */ jsx("div", __spreadValues({ className: cn("flex flex-col gap-2 mt-4", className) }, props));
|
|
5253
6228
|
};
|
|
5254
6229
|
DrawerFooter.displayName = "DrawerFooter";
|
|
5255
|
-
var DrawerTitle =
|
|
6230
|
+
var DrawerTitle = React38.forwardRef((_a, ref) => {
|
|
5256
6231
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
5257
6232
|
return /* @__PURE__ */ jsx(
|
|
5258
6233
|
RadixDialog.Title,
|
|
@@ -5266,7 +6241,7 @@ var DrawerTitle = React31.forwardRef((_a, ref) => {
|
|
|
5266
6241
|
);
|
|
5267
6242
|
});
|
|
5268
6243
|
DrawerTitle.displayName = "DrawerTitle";
|
|
5269
|
-
var DrawerDescription =
|
|
6244
|
+
var DrawerDescription = React38.forwardRef((_a, ref) => {
|
|
5270
6245
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
5271
6246
|
return /* @__PURE__ */ jsx(
|
|
5272
6247
|
RadixDialog.Description,
|
|
@@ -5347,7 +6322,7 @@ function FABPosition({
|
|
|
5347
6322
|
}
|
|
5348
6323
|
);
|
|
5349
6324
|
}
|
|
5350
|
-
var FABComponent =
|
|
6325
|
+
var FABComponent = React38.forwardRef(
|
|
5351
6326
|
(_a, ref) => {
|
|
5352
6327
|
var _b = _a, {
|
|
5353
6328
|
className,
|
|
@@ -5392,7 +6367,7 @@ var FABComponent = React31.forwardRef(
|
|
|
5392
6367
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
5393
6368
|
disabled: loading
|
|
5394
6369
|
});
|
|
5395
|
-
const handleClick =
|
|
6370
|
+
const handleClick = React38.useCallback(
|
|
5396
6371
|
(e) => {
|
|
5397
6372
|
if (loading) {
|
|
5398
6373
|
e.preventDefault();
|
|
@@ -5402,7 +6377,7 @@ var FABComponent = React31.forwardRef(
|
|
|
5402
6377
|
},
|
|
5403
6378
|
[loading, onClick]
|
|
5404
6379
|
);
|
|
5405
|
-
const handleKeyDown =
|
|
6380
|
+
const handleKeyDown = React38.useCallback(
|
|
5406
6381
|
(e) => {
|
|
5407
6382
|
if (loading) return;
|
|
5408
6383
|
if ((e.key === "Enter" || e.key === " ") && onClick) {
|
|
@@ -5511,7 +6486,7 @@ var FABComponent = React31.forwardRef(
|
|
|
5511
6486
|
}
|
|
5512
6487
|
);
|
|
5513
6488
|
FABComponent.displayName = "FAB";
|
|
5514
|
-
var FAB =
|
|
6489
|
+
var FAB = React38.memo(FABComponent);
|
|
5515
6490
|
var SPRING_NORMAL = { stiffness: 700, damping: 40 };
|
|
5516
6491
|
var SPRING_REDUCED = { stiffness: 1e4, damping: 100 };
|
|
5517
6492
|
var FOCUS_DELAY_MS = 50;
|
|
@@ -5576,7 +6551,7 @@ var ALIGNMENT_TRANSFORM_ORIGIN = {
|
|
|
5576
6551
|
center: "bottom"
|
|
5577
6552
|
};
|
|
5578
6553
|
var ITEM_SPRING = { type: "spring", stiffness: 700, damping: 25 };
|
|
5579
|
-
var
|
|
6554
|
+
var MENU_CONTAINER_VARIANTS2 = {
|
|
5580
6555
|
open: { transition: { staggerChildren: 0.033, staggerDirection: 1 } },
|
|
5581
6556
|
closed: { transition: { staggerChildren: 0.02, staggerDirection: -1 } }
|
|
5582
6557
|
};
|
|
@@ -5619,7 +6594,7 @@ function CloseIcon3() {
|
|
|
5619
6594
|
function defaultFabIcon(progress) {
|
|
5620
6595
|
return progress > 0.5 ? /* @__PURE__ */ jsx(CloseIcon3, {}) : /* @__PURE__ */ jsx(AddIcon, {});
|
|
5621
6596
|
}
|
|
5622
|
-
var ToggleFABComponent =
|
|
6597
|
+
var ToggleFABComponent = React38.forwardRef(
|
|
5623
6598
|
({
|
|
5624
6599
|
expanded,
|
|
5625
6600
|
onToggle,
|
|
@@ -5637,7 +6612,7 @@ var ToggleFABComponent = React31.forwardRef(
|
|
|
5637
6612
|
const sizeTokens = (_b = TOGGLE_FAB_SIZES[fabSize]) != null ? _b : TOGGLE_FAB_SIZES.baseline;
|
|
5638
6613
|
const springConfig = prefersReduced ? SPRING_REDUCED : SPRING_NORMAL;
|
|
5639
6614
|
const checkedProgress = useSpring(expanded ? 1 : 0, springConfig);
|
|
5640
|
-
|
|
6615
|
+
React38.useEffect(() => {
|
|
5641
6616
|
checkedProgress.set(expanded ? 1 : 0);
|
|
5642
6617
|
}, [expanded, checkedProgress]);
|
|
5643
6618
|
const borderRadius = useTransform(
|
|
@@ -5645,12 +6620,12 @@ var ToggleFABComponent = React31.forwardRef(
|
|
|
5645
6620
|
[0, 1],
|
|
5646
6621
|
[`${sizeTokens.initialRadius}px`, `${sizeTokens.finalRadius}px`]
|
|
5647
6622
|
);
|
|
5648
|
-
const [iconProgress, setIconProgress] =
|
|
5649
|
-
|
|
6623
|
+
const [iconProgress, setIconProgress] = React38.useState(expanded ? 1 : 0);
|
|
6624
|
+
React38.useEffect(() => {
|
|
5650
6625
|
return checkedProgress.on("change", setIconProgress);
|
|
5651
6626
|
}, [checkedProgress]);
|
|
5652
6627
|
const { ripples, onPointerDown, removeRipple } = useRippleState();
|
|
5653
|
-
const handleClick =
|
|
6628
|
+
const handleClick = React38.useCallback(() => {
|
|
5654
6629
|
onToggle(!expanded);
|
|
5655
6630
|
}, [expanded, onToggle]);
|
|
5656
6631
|
return /* @__PURE__ */ jsxs(
|
|
@@ -5699,7 +6674,7 @@ var ToggleFABComponent = React31.forwardRef(
|
|
|
5699
6674
|
}
|
|
5700
6675
|
);
|
|
5701
6676
|
ToggleFABComponent.displayName = "ToggleFAB";
|
|
5702
|
-
var ToggleFAB =
|
|
6677
|
+
var ToggleFAB = React38.memo(ToggleFABComponent);
|
|
5703
6678
|
function FABMenuItem({
|
|
5704
6679
|
icon,
|
|
5705
6680
|
label,
|
|
@@ -5712,7 +6687,7 @@ function FABMenuItem({
|
|
|
5712
6687
|
var _a;
|
|
5713
6688
|
const colors = (_a = MENU_ITEM_COLORS[colorVariant]) != null ? _a : MENU_ITEM_COLORS.primary;
|
|
5714
6689
|
const { ripples, onPointerDown, removeRipple } = useRippleState({ disabled });
|
|
5715
|
-
const handleClick =
|
|
6690
|
+
const handleClick = React38.useCallback(
|
|
5716
6691
|
(e) => {
|
|
5717
6692
|
if (disabled) {
|
|
5718
6693
|
e.preventDefault();
|
|
@@ -5722,7 +6697,7 @@ function FABMenuItem({
|
|
|
5722
6697
|
},
|
|
5723
6698
|
[disabled, onClick]
|
|
5724
6699
|
);
|
|
5725
|
-
const handleKeyDown =
|
|
6700
|
+
const handleKeyDown = React38.useCallback(
|
|
5726
6701
|
(e) => {
|
|
5727
6702
|
if (disabled) return;
|
|
5728
6703
|
if (e.key === "Enter" || e.key === " ") {
|
|
@@ -5789,13 +6764,13 @@ function FABMenu({
|
|
|
5789
6764
|
focusLast = true,
|
|
5790
6765
|
"aria-label": ariaLabel
|
|
5791
6766
|
}) {
|
|
5792
|
-
const fabId =
|
|
5793
|
-
const menuId =
|
|
5794
|
-
const toggleRef =
|
|
5795
|
-
const itemRefs =
|
|
5796
|
-
const [focusedIndex, setFocusedIndex] =
|
|
5797
|
-
const reversedItems =
|
|
5798
|
-
const focusItem =
|
|
6767
|
+
const fabId = React38.useId();
|
|
6768
|
+
const menuId = React38.useId();
|
|
6769
|
+
const toggleRef = React38.useRef(null);
|
|
6770
|
+
const itemRefs = React38.useRef([]);
|
|
6771
|
+
const [focusedIndex, setFocusedIndex] = React38.useState(-1);
|
|
6772
|
+
const reversedItems = React38.useMemo(() => [...items].reverse(), [items]);
|
|
6773
|
+
const focusItem = React38.useCallback((index) => {
|
|
5799
6774
|
var _a;
|
|
5800
6775
|
const clampedIndex = Math.max(
|
|
5801
6776
|
0,
|
|
@@ -5804,8 +6779,8 @@ function FABMenu({
|
|
|
5804
6779
|
setFocusedIndex(clampedIndex);
|
|
5805
6780
|
(_a = itemRefs.current[clampedIndex]) == null ? void 0 : _a.focus();
|
|
5806
6781
|
}, []);
|
|
5807
|
-
const wasExpandedRef =
|
|
5808
|
-
|
|
6782
|
+
const wasExpandedRef = React38.useRef(false);
|
|
6783
|
+
React38.useEffect(() => {
|
|
5809
6784
|
var _a;
|
|
5810
6785
|
if (expanded) {
|
|
5811
6786
|
wasExpandedRef.current = true;
|
|
@@ -5820,7 +6795,7 @@ function FABMenu({
|
|
|
5820
6795
|
wasExpandedRef.current = false;
|
|
5821
6796
|
setFocusedIndex(-1);
|
|
5822
6797
|
}, [expanded, focusLast, items.length, focusItem]);
|
|
5823
|
-
const handleMenuKeyDown =
|
|
6798
|
+
const handleMenuKeyDown = React38.useCallback(
|
|
5824
6799
|
(e) => {
|
|
5825
6800
|
if (!expanded) return;
|
|
5826
6801
|
const lastIndex = items.length - 1;
|
|
@@ -5881,7 +6856,7 @@ function FABMenu({
|
|
|
5881
6856
|
role: "menu",
|
|
5882
6857
|
"aria-labelledby": fabId,
|
|
5883
6858
|
"aria-orientation": "vertical",
|
|
5884
|
-
variants:
|
|
6859
|
+
variants: MENU_CONTAINER_VARIANTS2,
|
|
5885
6860
|
initial: "closed",
|
|
5886
6861
|
animate: "open",
|
|
5887
6862
|
exit: "closed",
|
|
@@ -5944,7 +6919,7 @@ function FABMenu({
|
|
|
5944
6919
|
)
|
|
5945
6920
|
] });
|
|
5946
6921
|
}
|
|
5947
|
-
var NavigationRailContext =
|
|
6922
|
+
var NavigationRailContext = React38.createContext({ variant: "collapsed", labelVisibility: "labeled", xr: false });
|
|
5948
6923
|
var MD3_MODAL_TRANSITION = {
|
|
5949
6924
|
type: "tween",
|
|
5950
6925
|
ease: [0.05, 0.7, 0.1, 1],
|
|
@@ -5980,9 +6955,9 @@ var railContainerVariants = cva(
|
|
|
5980
6955
|
}
|
|
5981
6956
|
);
|
|
5982
6957
|
function cloneIconWithFill(icon, selected) {
|
|
5983
|
-
if (!
|
|
6958
|
+
if (!React38.isValidElement(icon)) return icon;
|
|
5984
6959
|
if (icon.type === Icon) {
|
|
5985
|
-
return
|
|
6960
|
+
return React38.cloneElement(
|
|
5986
6961
|
icon,
|
|
5987
6962
|
{ fill: selected ? 1 : 0, animateFill: true }
|
|
5988
6963
|
);
|
|
@@ -6040,7 +7015,7 @@ function IconContainer({ selected, badge, children }) {
|
|
|
6040
7015
|
}
|
|
6041
7016
|
);
|
|
6042
7017
|
}
|
|
6043
|
-
var NavigationRailItemComponent =
|
|
7018
|
+
var NavigationRailItemComponent = React38.forwardRef(
|
|
6044
7019
|
({
|
|
6045
7020
|
selected,
|
|
6046
7021
|
icon,
|
|
@@ -6051,18 +7026,18 @@ var NavigationRailItemComponent = React31.forwardRef(
|
|
|
6051
7026
|
className,
|
|
6052
7027
|
"aria-label": ariaLabelProp
|
|
6053
7028
|
}, ref) => {
|
|
6054
|
-
const { variant, labelVisibility } =
|
|
7029
|
+
const { variant, labelVisibility } = React38.useContext(
|
|
6055
7030
|
NavigationRailContext
|
|
6056
7031
|
);
|
|
6057
7032
|
const isExpanded = variant === "expanded" || variant === "modal";
|
|
6058
7033
|
const isModal = variant === "modal";
|
|
6059
7034
|
const enableLayout = !isModal;
|
|
6060
|
-
const activePillId = `rail-pill-${
|
|
7035
|
+
const activePillId = `rail-pill-${React38.useId()}`;
|
|
6061
7036
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
6062
7037
|
disabled
|
|
6063
7038
|
});
|
|
6064
7039
|
const showLabel = isExpanded || labelVisibility === "labeled" || labelVisibility === "auto" && selected;
|
|
6065
|
-
const handleClick =
|
|
7040
|
+
const handleClick = React38.useCallback(
|
|
6066
7041
|
(e) => {
|
|
6067
7042
|
if (disabled) {
|
|
6068
7043
|
e.preventDefault();
|
|
@@ -6164,9 +7139,9 @@ var NavigationRailItemComponent = React31.forwardRef(
|
|
|
6164
7139
|
}
|
|
6165
7140
|
);
|
|
6166
7141
|
NavigationRailItemComponent.displayName = "NavigationRailItem";
|
|
6167
|
-
var NavigationRailItem =
|
|
7142
|
+
var NavigationRailItem = React38.memo(NavigationRailItemComponent);
|
|
6168
7143
|
function useRoving(navRef) {
|
|
6169
|
-
|
|
7144
|
+
React38.useEffect(() => {
|
|
6170
7145
|
if (!navRef.current) return;
|
|
6171
7146
|
const items = getMenuItems(navRef.current);
|
|
6172
7147
|
const selected = items.find(
|
|
@@ -6176,7 +7151,7 @@ function useRoving(navRef) {
|
|
|
6176
7151
|
const firstFocusable = selected != null ? selected : items[0];
|
|
6177
7152
|
if (firstFocusable) firstFocusable.tabIndex = 0;
|
|
6178
7153
|
}, [navRef]);
|
|
6179
|
-
return
|
|
7154
|
+
return React38.useCallback(
|
|
6180
7155
|
(e) => {
|
|
6181
7156
|
if (!navRef.current) return;
|
|
6182
7157
|
const items = getMenuItems(navRef.current);
|
|
@@ -6204,7 +7179,7 @@ function useRoving(navRef) {
|
|
|
6204
7179
|
[navRef]
|
|
6205
7180
|
);
|
|
6206
7181
|
}
|
|
6207
|
-
var NavigationRailComponent =
|
|
7182
|
+
var NavigationRailComponent = React38.forwardRef(
|
|
6208
7183
|
({
|
|
6209
7184
|
variant = "collapsed",
|
|
6210
7185
|
labelVisibility = "labeled",
|
|
@@ -6224,9 +7199,9 @@ var NavigationRailComponent = React31.forwardRef(
|
|
|
6224
7199
|
const xrMode = xr === "spatialized" ? "spatialized" : "contained";
|
|
6225
7200
|
const isSpatial = isXr && xrMode === "spatialized";
|
|
6226
7201
|
const applyAnimation = !isXr || !isSpatial;
|
|
6227
|
-
const navRef =
|
|
7202
|
+
const navRef = React38.useRef(null);
|
|
6228
7203
|
const handleKeyDown = useRoving(navRef);
|
|
6229
|
-
const setRefs =
|
|
7204
|
+
const setRefs = React38.useCallback(
|
|
6230
7205
|
(node) => {
|
|
6231
7206
|
navRef.current = node;
|
|
6232
7207
|
if (typeof ref === "function") ref(node);
|
|
@@ -6319,7 +7294,7 @@ var NavigationRailComponent = React31.forwardRef(
|
|
|
6319
7294
|
children: fab
|
|
6320
7295
|
}
|
|
6321
7296
|
),
|
|
6322
|
-
|
|
7297
|
+
React38.cloneElement(
|
|
6323
7298
|
navElement,
|
|
6324
7299
|
{
|
|
6325
7300
|
className: cn(navBaseClasses, "pointer-events-auto")
|
|
@@ -6357,13 +7332,13 @@ var NavigationRailComponent = React31.forwardRef(
|
|
|
6357
7332
|
}
|
|
6358
7333
|
);
|
|
6359
7334
|
NavigationRailComponent.displayName = "NavigationRail";
|
|
6360
|
-
var NavigationRail =
|
|
7335
|
+
var NavigationRail = React38.memo(NavigationRailComponent);
|
|
6361
7336
|
var MD3_FAST_EFFECTS2 = [0.3, 0, 1, 1];
|
|
6362
|
-
var RadioGroupContext =
|
|
7337
|
+
var RadioGroupContext = React38.createContext(
|
|
6363
7338
|
null
|
|
6364
7339
|
);
|
|
6365
7340
|
function useMergedRef3(externalRef, internalRef) {
|
|
6366
|
-
return
|
|
7341
|
+
return React38.useCallback(
|
|
6367
7342
|
(node) => {
|
|
6368
7343
|
internalRef.current = node;
|
|
6369
7344
|
if (!externalRef) return;
|
|
@@ -6376,7 +7351,7 @@ function useMergedRef3(externalRef, internalRef) {
|
|
|
6376
7351
|
[externalRef, internalRef]
|
|
6377
7352
|
);
|
|
6378
7353
|
}
|
|
6379
|
-
var RadioVisual =
|
|
7354
|
+
var RadioVisual = React38.memo(function RadioVisual2({
|
|
6380
7355
|
isSelected,
|
|
6381
7356
|
disabled,
|
|
6382
7357
|
error,
|
|
@@ -6429,7 +7404,7 @@ var RadioVisual = React31.memo(function RadioVisual2({
|
|
|
6429
7404
|
}
|
|
6430
7405
|
);
|
|
6431
7406
|
});
|
|
6432
|
-
var RadioButtonComponent =
|
|
7407
|
+
var RadioButtonComponent = React38.forwardRef(
|
|
6433
7408
|
({
|
|
6434
7409
|
selected,
|
|
6435
7410
|
defaultSelected = false,
|
|
@@ -6448,23 +7423,23 @@ var RadioButtonComponent = React31.forwardRef(
|
|
|
6448
7423
|
required: requiredProp
|
|
6449
7424
|
}, ref) => {
|
|
6450
7425
|
var _a, _b;
|
|
6451
|
-
const group =
|
|
7426
|
+
const group = React38.useContext(RadioGroupContext);
|
|
6452
7427
|
const prefersReduced = (_a = useReducedMotion()) != null ? _a : false;
|
|
6453
|
-
const generatedId =
|
|
7428
|
+
const generatedId = React38.useId();
|
|
6454
7429
|
const inputId = idProp != null ? idProp : label ? `radio-${generatedId}` : void 0;
|
|
6455
7430
|
const name = (_b = group == null ? void 0 : group.name) != null ? _b : nameProp;
|
|
6456
7431
|
const disabled = (group == null ? void 0 : group.disabled) || disabledProp;
|
|
6457
7432
|
const error = (group == null ? void 0 : group.error) || errorProp || color === "error";
|
|
6458
7433
|
const required = (group == null ? void 0 : group.required) || requiredProp;
|
|
6459
|
-
const [internalSelected, setInternalSelected] =
|
|
7434
|
+
const [internalSelected, setInternalSelected] = React38.useState(defaultSelected);
|
|
6460
7435
|
const isControlled = selected !== void 0;
|
|
6461
7436
|
const isSelected = group ? group.selectedValue === value : isControlled ? selected != null ? selected : false : internalSelected;
|
|
6462
|
-
const [ripples, setRipples] =
|
|
6463
|
-
const removeRipple =
|
|
7437
|
+
const [ripples, setRipples] = React38.useState([]);
|
|
7438
|
+
const removeRipple = React38.useCallback(
|
|
6464
7439
|
(id) => setRipples((prev) => prev.filter((r) => r.id !== id)),
|
|
6465
7440
|
[]
|
|
6466
7441
|
);
|
|
6467
|
-
const onPointerDown =
|
|
7442
|
+
const onPointerDown = React38.useCallback(
|
|
6468
7443
|
(e) => {
|
|
6469
7444
|
if (disabled) return;
|
|
6470
7445
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
@@ -6478,12 +7453,12 @@ var RadioButtonComponent = React31.forwardRef(
|
|
|
6478
7453
|
},
|
|
6479
7454
|
[disabled]
|
|
6480
7455
|
);
|
|
6481
|
-
const [isHovered, setIsHovered] =
|
|
6482
|
-
const onPointerEnter =
|
|
7456
|
+
const [isHovered, setIsHovered] = React38.useState(false);
|
|
7457
|
+
const onPointerEnter = React38.useCallback(() => {
|
|
6483
7458
|
if (!disabled) setIsHovered(true);
|
|
6484
7459
|
}, [disabled]);
|
|
6485
|
-
const onPointerLeave =
|
|
6486
|
-
const handleChange =
|
|
7460
|
+
const onPointerLeave = React38.useCallback(() => setIsHovered(false), []);
|
|
7461
|
+
const handleChange = React38.useCallback(
|
|
6487
7462
|
(_e) => {
|
|
6488
7463
|
if (disabled || onClick === null) return;
|
|
6489
7464
|
if (group) {
|
|
@@ -6497,7 +7472,7 @@ var RadioButtonComponent = React31.forwardRef(
|
|
|
6497
7472
|
},
|
|
6498
7473
|
[disabled, onClick, group, value, isControlled]
|
|
6499
7474
|
);
|
|
6500
|
-
const inputRef =
|
|
7475
|
+
const inputRef = React38.useRef(null);
|
|
6501
7476
|
const mergedRef = useMergedRef3(ref, inputRef);
|
|
6502
7477
|
const stateLayerBg = error ? "before:bg-m3-error" : "before:bg-m3-primary";
|
|
6503
7478
|
const stateLayerClass = cn(
|
|
@@ -6604,98 +7579,917 @@ var RadioButtonComponent = React31.forwardRef(
|
|
|
6604
7579
|
visual
|
|
6605
7580
|
]
|
|
6606
7581
|
}
|
|
6607
|
-
) });
|
|
7582
|
+
) });
|
|
7583
|
+
}
|
|
7584
|
+
);
|
|
7585
|
+
RadioButtonComponent.displayName = "RadioButton";
|
|
7586
|
+
var RadioButton = React38.memo(RadioButtonComponent);
|
|
7587
|
+
var RadioGroupComponent = React38.forwardRef(
|
|
7588
|
+
({
|
|
7589
|
+
name,
|
|
7590
|
+
value: valueProp,
|
|
7591
|
+
defaultValue,
|
|
7592
|
+
onValueChange,
|
|
7593
|
+
disabled = false,
|
|
7594
|
+
error = false,
|
|
7595
|
+
label,
|
|
7596
|
+
"aria-labelledby": ariaLabelledby,
|
|
7597
|
+
required = false,
|
|
7598
|
+
orientation = "vertical",
|
|
7599
|
+
children,
|
|
7600
|
+
className
|
|
7601
|
+
}, ref) => {
|
|
7602
|
+
const [internalValue, setInternalValue] = React38.useState(defaultValue);
|
|
7603
|
+
const isControlled = valueProp !== void 0;
|
|
7604
|
+
const selectedValue = isControlled ? valueProp : internalValue;
|
|
7605
|
+
const handleValueChange = React38.useCallback(
|
|
7606
|
+
(val) => {
|
|
7607
|
+
if (!isControlled) setInternalValue(val);
|
|
7608
|
+
onValueChange == null ? void 0 : onValueChange(val);
|
|
7609
|
+
},
|
|
7610
|
+
[isControlled, onValueChange]
|
|
7611
|
+
);
|
|
7612
|
+
const groupRef = React38.useRef(null);
|
|
7613
|
+
const mergedRef = useMergedRef3(ref, groupRef);
|
|
7614
|
+
const onKeyDown = React38.useCallback(
|
|
7615
|
+
(e) => {
|
|
7616
|
+
var _a, _b;
|
|
7617
|
+
if (disabled) return;
|
|
7618
|
+
const isNext = e.key === "ArrowDown" || e.key === "ArrowRight";
|
|
7619
|
+
const isPrev = e.key === "ArrowUp" || e.key === "ArrowLeft";
|
|
7620
|
+
if (!isNext && !isPrev) return;
|
|
7621
|
+
e.preventDefault();
|
|
7622
|
+
const inputs = Array.from(
|
|
7623
|
+
(_b = (_a = groupRef.current) == null ? void 0 : _a.querySelectorAll(
|
|
7624
|
+
'input[type="radio"]:not(:disabled)'
|
|
7625
|
+
)) != null ? _b : []
|
|
7626
|
+
);
|
|
7627
|
+
if (inputs.length === 0) return;
|
|
7628
|
+
const currentIdx = inputs.indexOf(
|
|
7629
|
+
document.activeElement
|
|
7630
|
+
);
|
|
7631
|
+
const nextIdx = isNext ? currentIdx < inputs.length - 1 ? currentIdx + 1 : 0 : currentIdx > 0 ? currentIdx - 1 : inputs.length - 1;
|
|
7632
|
+
const target = inputs[nextIdx];
|
|
7633
|
+
target.focus();
|
|
7634
|
+
handleValueChange(target.value);
|
|
7635
|
+
},
|
|
7636
|
+
[disabled, handleValueChange]
|
|
7637
|
+
);
|
|
7638
|
+
const contextValue = React38.useMemo(
|
|
7639
|
+
() => ({
|
|
7640
|
+
name,
|
|
7641
|
+
selectedValue,
|
|
7642
|
+
onValueChange: handleValueChange,
|
|
7643
|
+
disabled,
|
|
7644
|
+
error,
|
|
7645
|
+
required
|
|
7646
|
+
}),
|
|
7647
|
+
[name, selectedValue, handleValueChange, disabled, error, required]
|
|
7648
|
+
);
|
|
7649
|
+
return /* @__PURE__ */ jsx(RadioGroupContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxs(
|
|
7650
|
+
"div",
|
|
7651
|
+
{
|
|
7652
|
+
ref: mergedRef,
|
|
7653
|
+
role: "radiogroup",
|
|
7654
|
+
"aria-label": label && !ariaLabelledby ? label : void 0,
|
|
7655
|
+
"aria-labelledby": ariaLabelledby,
|
|
7656
|
+
"aria-disabled": disabled || void 0,
|
|
7657
|
+
"aria-required": required || void 0,
|
|
7658
|
+
className: cn(
|
|
7659
|
+
"flex",
|
|
7660
|
+
orientation === "horizontal" ? "flex-row gap-4" : "flex-col gap-1",
|
|
7661
|
+
className
|
|
7662
|
+
),
|
|
7663
|
+
onKeyDown,
|
|
7664
|
+
children: [
|
|
7665
|
+
label && !ariaLabelledby && /* @__PURE__ */ jsx("span", { className: "sr-only", children: label }),
|
|
7666
|
+
children
|
|
7667
|
+
]
|
|
7668
|
+
}
|
|
7669
|
+
) });
|
|
7670
|
+
}
|
|
7671
|
+
);
|
|
7672
|
+
RadioGroupComponent.displayName = "RadioGroup";
|
|
7673
|
+
var RadioGroup = React38.memo(RadioGroupComponent);
|
|
7674
|
+
function useSearchKeyboard({
|
|
7675
|
+
active,
|
|
7676
|
+
onActiveChange,
|
|
7677
|
+
onSearch,
|
|
7678
|
+
query,
|
|
7679
|
+
itemCount,
|
|
7680
|
+
onSelectSuggestion
|
|
7681
|
+
}) {
|
|
7682
|
+
const [activeIndex, setActiveIndex] = React38.useState(-1);
|
|
7683
|
+
const resetKeyRef = React38.useRef(`${active}:${query}`);
|
|
7684
|
+
const currentKey = `${active}:${query}`;
|
|
7685
|
+
if (resetKeyRef.current !== currentKey) {
|
|
7686
|
+
resetKeyRef.current = currentKey;
|
|
7687
|
+
setActiveIndex(-1);
|
|
7688
|
+
}
|
|
7689
|
+
const handleKeyDown = React38.useCallback(
|
|
7690
|
+
(e) => {
|
|
7691
|
+
if (!active) return;
|
|
7692
|
+
switch (e.key) {
|
|
7693
|
+
case "ArrowDown": {
|
|
7694
|
+
e.preventDefault();
|
|
7695
|
+
setActiveIndex((i) => i < itemCount - 1 ? i + 1 : i);
|
|
7696
|
+
break;
|
|
7697
|
+
}
|
|
7698
|
+
case "ArrowUp": {
|
|
7699
|
+
e.preventDefault();
|
|
7700
|
+
setActiveIndex((i) => i > -1 ? i - 1 : -1);
|
|
7701
|
+
break;
|
|
7702
|
+
}
|
|
7703
|
+
case "Enter": {
|
|
7704
|
+
e.preventDefault();
|
|
7705
|
+
if (activeIndex >= 0 && onSelectSuggestion) {
|
|
7706
|
+
onSelectSuggestion(activeIndex);
|
|
7707
|
+
} else {
|
|
7708
|
+
onSearch(query);
|
|
7709
|
+
}
|
|
7710
|
+
break;
|
|
7711
|
+
}
|
|
7712
|
+
case "Escape": {
|
|
7713
|
+
e.preventDefault();
|
|
7714
|
+
onActiveChange(false);
|
|
7715
|
+
break;
|
|
7716
|
+
}
|
|
7717
|
+
}
|
|
7718
|
+
},
|
|
7719
|
+
[
|
|
7720
|
+
active,
|
|
7721
|
+
activeIndex,
|
|
7722
|
+
itemCount,
|
|
7723
|
+
onActiveChange,
|
|
7724
|
+
onSearch,
|
|
7725
|
+
onSelectSuggestion,
|
|
7726
|
+
query
|
|
7727
|
+
]
|
|
7728
|
+
);
|
|
7729
|
+
const resetActiveIndex = React38.useCallback(() => {
|
|
7730
|
+
setActiveIndex(-1);
|
|
7731
|
+
}, []);
|
|
7732
|
+
return { activeIndex, handleKeyDown, resetActiveIndex };
|
|
7733
|
+
}
|
|
7734
|
+
|
|
7735
|
+
// src/ui/search/search.tokens.ts
|
|
7736
|
+
var SearchTokens = {
|
|
7737
|
+
// ── Heights ─────────────────────────────────────────────────────────────
|
|
7738
|
+
heights: {
|
|
7739
|
+
/** SearchBarTokens.ContainerHeight = 56dp */
|
|
7740
|
+
bar: 56,
|
|
7741
|
+
/** SearchViewTokens.DockedHeaderContainerHeight = 56dp */
|
|
7742
|
+
dockedHeader: 56,
|
|
7743
|
+
/** SearchViewTokens.FullScreenHeaderContainerHeight = 72dp */
|
|
7744
|
+
fullScreenHeader: 72
|
|
7745
|
+
},
|
|
7746
|
+
// ── Avatar ────────────────────────────────────────────────────────────
|
|
7747
|
+
/** SearchBarTokens.AvatarSize = 30dp */
|
|
7748
|
+
avatarSize: 30,
|
|
7749
|
+
// ── Icon ───────────────────────────────────────────────────────────────
|
|
7750
|
+
/** Standard icon size for leading/trailing icons. */
|
|
7751
|
+
iconSize: 20,
|
|
7752
|
+
/** Touch target for interactive icons per MD3 a11y spec. */
|
|
7753
|
+
iconTouchTarget: 48,
|
|
7754
|
+
// ── Gap ────────────────────────────────────────────────────────────────
|
|
7755
|
+
/** Gap between SearchBar and results list when hasGap=true. */
|
|
7756
|
+
dropdownGap: 2
|
|
7757
|
+
};
|
|
7758
|
+
var SEARCH_COLORS = {
|
|
7759
|
+
/** SearchBarTokens.ContainerColor → surface-container-high */
|
|
7760
|
+
container: "var(--md-sys-color-surface-container-high)",
|
|
7761
|
+
/** SearchBarTokens.LeadingIconColor → on-surface */
|
|
7762
|
+
leadingIcon: "var(--md-sys-color-on-surface)",
|
|
7763
|
+
/** SearchBarTokens.TrailingIconColor → on-surface-variant */
|
|
7764
|
+
trailingIcon: "var(--md-sys-color-on-surface-variant)",
|
|
7765
|
+
/** SearchBarTokens.InputTextColor → on-surface */
|
|
7766
|
+
inputText: "var(--md-sys-color-on-surface)",
|
|
7767
|
+
/** SearchBarTokens.SupportingTextColor → on-surface-variant (placeholder) */
|
|
7768
|
+
supportingText: "var(--md-sys-color-on-surface-variant)",
|
|
7769
|
+
/** SearchViewTokens.DividerColor → outline */
|
|
7770
|
+
divider: "var(--md-sys-color-outline)",
|
|
7771
|
+
/** Focus indicator → secondary */
|
|
7772
|
+
focusIndicator: "var(--md-sys-color-secondary)"
|
|
7773
|
+
};
|
|
7774
|
+
var SEARCH_TYPOGRAPHY = {
|
|
7775
|
+
/** BodyLarge — used for input text and placeholder. */
|
|
7776
|
+
bodyLarge: "text-[16px] leading-6 font-normal tracking-[0.5px]"
|
|
7777
|
+
};
|
|
7778
|
+
var SEARCH_BAR_EXPAND_SPRING = {
|
|
7779
|
+
type: "spring",
|
|
7780
|
+
stiffness: 380,
|
|
7781
|
+
damping: 38,
|
|
7782
|
+
mass: 1
|
|
7783
|
+
};
|
|
7784
|
+
var SEARCH_DOCKED_REVEAL_SPRING = {
|
|
7785
|
+
type: "spring",
|
|
7786
|
+
stiffness: 400,
|
|
7787
|
+
damping: 35,
|
|
7788
|
+
mass: 0.8
|
|
7789
|
+
};
|
|
7790
|
+
var SEARCH_FULLSCREEN_SPRING = {
|
|
7791
|
+
type: "spring",
|
|
7792
|
+
stiffness: 300,
|
|
7793
|
+
damping: 30,
|
|
7794
|
+
mass: 0.9
|
|
7795
|
+
};
|
|
7796
|
+
var SEARCH_BAR_EXIT_SPRING = {
|
|
7797
|
+
type: "spring",
|
|
7798
|
+
stiffness: 500,
|
|
7799
|
+
damping: 40,
|
|
7800
|
+
mass: 0.6
|
|
7801
|
+
};
|
|
7802
|
+
var PLACEHOLDER_SPRING = {
|
|
7803
|
+
type: "spring",
|
|
7804
|
+
stiffness: 350,
|
|
7805
|
+
damping: 30,
|
|
7806
|
+
mass: 0.8
|
|
7807
|
+
};
|
|
7808
|
+
function AnimatedPlaceholder({
|
|
7809
|
+
text,
|
|
7810
|
+
textAlign,
|
|
7811
|
+
visible,
|
|
7812
|
+
focused,
|
|
7813
|
+
children,
|
|
7814
|
+
className
|
|
7815
|
+
}) {
|
|
7816
|
+
const shouldReduceMotion = useReducedMotion();
|
|
7817
|
+
const containerRef = React38.useRef(null);
|
|
7818
|
+
const spanRef = React38.useRef(null);
|
|
7819
|
+
const [xOffset, setXOffset] = React38.useState(0);
|
|
7820
|
+
const recalculate = React38.useCallback(() => {
|
|
7821
|
+
const container = containerRef.current;
|
|
7822
|
+
const span = spanRef.current;
|
|
7823
|
+
if (!container || !span || textAlign === "left") {
|
|
7824
|
+
setXOffset(0);
|
|
7825
|
+
return;
|
|
7826
|
+
}
|
|
7827
|
+
const containerWidth = container.offsetWidth;
|
|
7828
|
+
const textWidth = span.offsetWidth;
|
|
7829
|
+
if (textAlign === "center") {
|
|
7830
|
+
setXOffset(Math.max(0, (containerWidth - textWidth) / 2));
|
|
7831
|
+
} else {
|
|
7832
|
+
setXOffset(Math.max(0, containerWidth - textWidth));
|
|
7833
|
+
}
|
|
7834
|
+
}, [textAlign]);
|
|
7835
|
+
React38.useLayoutEffect(() => {
|
|
7836
|
+
recalculate();
|
|
7837
|
+
}, [recalculate]);
|
|
7838
|
+
React38.useEffect(() => {
|
|
7839
|
+
const container = containerRef.current;
|
|
7840
|
+
if (!container) return;
|
|
7841
|
+
const observer = new ResizeObserver(recalculate);
|
|
7842
|
+
observer.observe(container);
|
|
7843
|
+
return () => observer.disconnect();
|
|
7844
|
+
}, [recalculate]);
|
|
7845
|
+
const targetX = focused || !visible ? 0 : xOffset;
|
|
7846
|
+
return /* @__PURE__ */ jsxs(
|
|
7847
|
+
"div",
|
|
7848
|
+
{
|
|
7849
|
+
ref: containerRef,
|
|
7850
|
+
className: cn("relative flex-1 min-w-0", className),
|
|
7851
|
+
children: [
|
|
7852
|
+
children,
|
|
7853
|
+
/* @__PURE__ */ jsx(
|
|
7854
|
+
m.span,
|
|
7855
|
+
{
|
|
7856
|
+
ref: (el) => {
|
|
7857
|
+
spanRef.current = el;
|
|
7858
|
+
},
|
|
7859
|
+
"aria-hidden": "true",
|
|
7860
|
+
className: cn(
|
|
7861
|
+
"pointer-events-none absolute inset-y-0 left-0",
|
|
7862
|
+
"flex items-center whitespace-nowrap select-none",
|
|
7863
|
+
SEARCH_TYPOGRAPHY.bodyLarge
|
|
7864
|
+
),
|
|
7865
|
+
style: { color: SEARCH_COLORS.supportingText },
|
|
7866
|
+
animate: {
|
|
7867
|
+
x: targetX,
|
|
7868
|
+
opacity: visible ? 1 : 0
|
|
7869
|
+
},
|
|
7870
|
+
transition: shouldReduceMotion ? { duration: 0 } : PLACEHOLDER_SPRING,
|
|
7871
|
+
children: text
|
|
7872
|
+
}
|
|
7873
|
+
)
|
|
7874
|
+
]
|
|
7875
|
+
}
|
|
7876
|
+
);
|
|
7877
|
+
}
|
|
7878
|
+
function DefaultSearchIcon() {
|
|
7879
|
+
return /* @__PURE__ */ jsx(
|
|
7880
|
+
"span",
|
|
7881
|
+
{
|
|
7882
|
+
className: "material-symbols-rounded select-none leading-none",
|
|
7883
|
+
style: { fontSize: SearchTokens.iconSize },
|
|
7884
|
+
"aria-hidden": "true",
|
|
7885
|
+
children: "search"
|
|
7886
|
+
}
|
|
7887
|
+
);
|
|
7888
|
+
}
|
|
7889
|
+
function SearchBar({
|
|
7890
|
+
query,
|
|
7891
|
+
onQueryChange,
|
|
7892
|
+
onSearch,
|
|
7893
|
+
active,
|
|
7894
|
+
onActiveChange,
|
|
7895
|
+
leadingIcon,
|
|
7896
|
+
trailingIcon,
|
|
7897
|
+
placeholder = "Search",
|
|
7898
|
+
textAlign = "left",
|
|
7899
|
+
className,
|
|
7900
|
+
"aria-label": ariaLabel = "Search",
|
|
7901
|
+
searchId,
|
|
7902
|
+
listboxId,
|
|
7903
|
+
onKeyDown,
|
|
7904
|
+
activeIndex
|
|
7905
|
+
}) {
|
|
7906
|
+
const shouldReduceMotion = useReducedMotion();
|
|
7907
|
+
const inputRef = React38.useRef(null);
|
|
7908
|
+
const prevActiveRef = React38.useRef(active);
|
|
7909
|
+
const isRestoringFocusRef = React38.useRef(false);
|
|
7910
|
+
React38.useEffect(() => {
|
|
7911
|
+
var _a;
|
|
7912
|
+
let rafId;
|
|
7913
|
+
if (prevActiveRef.current === true && active === false) {
|
|
7914
|
+
isRestoringFocusRef.current = true;
|
|
7915
|
+
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
7916
|
+
rafId = requestAnimationFrame(() => {
|
|
7917
|
+
isRestoringFocusRef.current = false;
|
|
7918
|
+
});
|
|
7919
|
+
}
|
|
7920
|
+
prevActiveRef.current = active;
|
|
7921
|
+
return () => {
|
|
7922
|
+
if (rafId) cancelAnimationFrame(rafId);
|
|
7923
|
+
};
|
|
7924
|
+
}, [active]);
|
|
7925
|
+
const handleFocus = () => {
|
|
7926
|
+
if (!active && !isRestoringFocusRef.current) {
|
|
7927
|
+
onActiveChange(true);
|
|
7928
|
+
}
|
|
7929
|
+
};
|
|
7930
|
+
const handleFormSubmit = (e) => {
|
|
7931
|
+
e.preventDefault();
|
|
7932
|
+
onSearch(query);
|
|
7933
|
+
};
|
|
7934
|
+
const activeDescendant = activeIndex >= 0 ? `${listboxId}-option-${activeIndex}` : void 0;
|
|
7935
|
+
return (
|
|
7936
|
+
/*
|
|
7937
|
+
* AnimatePresence mode="popLayout":
|
|
7938
|
+
* When SearchView opens (active=true), SearchBar plays its exit animation
|
|
7939
|
+
* first, then unmounts — releasing the shared layoutId for SearchView to
|
|
7940
|
+
* claim and morph from the pill shape.
|
|
7941
|
+
*/
|
|
7942
|
+
/* @__PURE__ */ jsx(AnimatePresence, { mode: "popLayout", children: !active && /* @__PURE__ */ jsxs(
|
|
7943
|
+
m.div,
|
|
7944
|
+
{
|
|
7945
|
+
layout: !shouldReduceMotion,
|
|
7946
|
+
layoutId: shouldReduceMotion ? void 0 : searchId,
|
|
7947
|
+
transition: shouldReduceMotion ? void 0 : SEARCH_BAR_EXPAND_SPRING,
|
|
7948
|
+
className: cn("relative", className),
|
|
7949
|
+
style: { height: SearchTokens.heights.bar },
|
|
7950
|
+
initial: shouldReduceMotion ? false : { opacity: 0, scale: 0.95 },
|
|
7951
|
+
animate: { opacity: 1, scale: 1 },
|
|
7952
|
+
exit: shouldReduceMotion ? {} : { opacity: 0, scale: 0.95, transition: SEARCH_BAR_EXIT_SPRING },
|
|
7953
|
+
children: [
|
|
7954
|
+
/* @__PURE__ */ jsx(
|
|
7955
|
+
"div",
|
|
7956
|
+
{
|
|
7957
|
+
className: "absolute inset-0 rounded-full",
|
|
7958
|
+
style: { backgroundColor: SEARCH_COLORS.container },
|
|
7959
|
+
"aria-hidden": "true"
|
|
7960
|
+
}
|
|
7961
|
+
),
|
|
7962
|
+
/* @__PURE__ */ jsx(
|
|
7963
|
+
"search",
|
|
7964
|
+
{
|
|
7965
|
+
"aria-label": ariaLabel,
|
|
7966
|
+
className: "relative flex h-full items-center gap-2 rounded-full px-4",
|
|
7967
|
+
children: /* @__PURE__ */ jsxs("form", { className: "contents", onSubmit: handleFormSubmit, children: [
|
|
7968
|
+
/* @__PURE__ */ jsx(
|
|
7969
|
+
"span",
|
|
7970
|
+
{
|
|
7971
|
+
className: "flex shrink-0 items-center justify-center",
|
|
7972
|
+
style: { color: SEARCH_COLORS.leadingIcon },
|
|
7973
|
+
"aria-hidden": "true",
|
|
7974
|
+
children: leadingIcon != null ? leadingIcon : /* @__PURE__ */ jsx(DefaultSearchIcon, {})
|
|
7975
|
+
}
|
|
7976
|
+
),
|
|
7977
|
+
/* @__PURE__ */ jsx(
|
|
7978
|
+
AnimatedPlaceholder,
|
|
7979
|
+
{
|
|
7980
|
+
text: placeholder,
|
|
7981
|
+
textAlign,
|
|
7982
|
+
visible: !query,
|
|
7983
|
+
focused: active,
|
|
7984
|
+
children: /* @__PURE__ */ jsx(
|
|
7985
|
+
"input",
|
|
7986
|
+
{
|
|
7987
|
+
ref: inputRef,
|
|
7988
|
+
id: searchId,
|
|
7989
|
+
type: "search",
|
|
7990
|
+
role: "combobox",
|
|
7991
|
+
"aria-expanded": active,
|
|
7992
|
+
"aria-controls": listboxId,
|
|
7993
|
+
"aria-autocomplete": "list",
|
|
7994
|
+
"aria-activedescendant": activeDescendant,
|
|
7995
|
+
"aria-label": placeholder,
|
|
7996
|
+
value: query,
|
|
7997
|
+
placeholder,
|
|
7998
|
+
className: cn(
|
|
7999
|
+
"w-full bg-transparent border-none outline-none",
|
|
8000
|
+
"text-[16px] leading-6 font-normal tracking-[0.5px]",
|
|
8001
|
+
"placeholder:text-transparent"
|
|
8002
|
+
),
|
|
8003
|
+
style: { color: SEARCH_COLORS.inputText },
|
|
8004
|
+
onFocus: handleFocus,
|
|
8005
|
+
onChange: (e) => onQueryChange(e.target.value),
|
|
8006
|
+
onKeyDown
|
|
8007
|
+
}
|
|
8008
|
+
)
|
|
8009
|
+
}
|
|
8010
|
+
),
|
|
8011
|
+
trailingIcon && /* @__PURE__ */ jsx(
|
|
8012
|
+
"span",
|
|
8013
|
+
{
|
|
8014
|
+
className: "flex shrink-0 items-center justify-center",
|
|
8015
|
+
style: { color: SEARCH_COLORS.trailingIcon },
|
|
8016
|
+
"aria-hidden": "true",
|
|
8017
|
+
children: trailingIcon
|
|
8018
|
+
}
|
|
8019
|
+
)
|
|
8020
|
+
] })
|
|
8021
|
+
}
|
|
8022
|
+
)
|
|
8023
|
+
]
|
|
8024
|
+
},
|
|
8025
|
+
searchId
|
|
8026
|
+
) })
|
|
8027
|
+
);
|
|
8028
|
+
}
|
|
8029
|
+
var SearchContext = React38.createContext(null);
|
|
8030
|
+
function SearchProvider({
|
|
8031
|
+
children,
|
|
8032
|
+
value
|
|
8033
|
+
}) {
|
|
8034
|
+
return /* @__PURE__ */ jsx(SearchContext.Provider, { value, children });
|
|
8035
|
+
}
|
|
8036
|
+
function useSearch() {
|
|
8037
|
+
const context = React38.useContext(SearchContext);
|
|
8038
|
+
if (!context) {
|
|
8039
|
+
return { listboxId: "", activeIndex: -1 };
|
|
8040
|
+
}
|
|
8041
|
+
return context;
|
|
8042
|
+
}
|
|
8043
|
+
function useClickOutside(handler, enabled = true) {
|
|
8044
|
+
const ref = useRef(null);
|
|
8045
|
+
useEffect(() => {
|
|
8046
|
+
if (!enabled) return;
|
|
8047
|
+
const listener = (event) => {
|
|
8048
|
+
const el = ref.current;
|
|
8049
|
+
if (!el || el.contains(event.target)) {
|
|
8050
|
+
return;
|
|
8051
|
+
}
|
|
8052
|
+
handler();
|
|
8053
|
+
};
|
|
8054
|
+
document.addEventListener("mousedown", listener);
|
|
8055
|
+
document.addEventListener("touchstart", listener);
|
|
8056
|
+
return () => {
|
|
8057
|
+
document.removeEventListener("mousedown", listener);
|
|
8058
|
+
document.removeEventListener("touchstart", listener);
|
|
8059
|
+
};
|
|
8060
|
+
}, [handler, enabled]);
|
|
8061
|
+
return ref;
|
|
8062
|
+
}
|
|
8063
|
+
function useSearchViewFocus(inputRef, active) {
|
|
8064
|
+
React38.useEffect(() => {
|
|
8065
|
+
if (!active) return;
|
|
8066
|
+
let raf2;
|
|
8067
|
+
const raf1 = requestAnimationFrame(() => {
|
|
8068
|
+
raf2 = requestAnimationFrame(() => {
|
|
8069
|
+
var _a;
|
|
8070
|
+
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
8071
|
+
});
|
|
8072
|
+
});
|
|
8073
|
+
return () => {
|
|
8074
|
+
cancelAnimationFrame(raf1);
|
|
8075
|
+
if (raf2) cancelAnimationFrame(raf2);
|
|
8076
|
+
};
|
|
8077
|
+
}, [active, inputRef]);
|
|
8078
|
+
}
|
|
8079
|
+
function TrailingAction({
|
|
8080
|
+
query,
|
|
8081
|
+
trailingIcon,
|
|
8082
|
+
onClear
|
|
8083
|
+
}) {
|
|
8084
|
+
if (query) {
|
|
8085
|
+
return /* @__PURE__ */ jsx(
|
|
8086
|
+
IconButton,
|
|
8087
|
+
{
|
|
8088
|
+
size: "sm",
|
|
8089
|
+
style: { color: SEARCH_COLORS.trailingIcon },
|
|
8090
|
+
"aria-label": "Clear search",
|
|
8091
|
+
onClick: onClear,
|
|
8092
|
+
children: /* @__PURE__ */ jsx(
|
|
8093
|
+
"span",
|
|
8094
|
+
{
|
|
8095
|
+
className: "material-symbols-rounded select-none leading-none",
|
|
8096
|
+
style: { fontSize: 20 },
|
|
8097
|
+
"aria-hidden": "true",
|
|
8098
|
+
children: "close"
|
|
8099
|
+
}
|
|
8100
|
+
)
|
|
8101
|
+
}
|
|
8102
|
+
);
|
|
6608
8103
|
}
|
|
6609
|
-
)
|
|
6610
|
-
|
|
6611
|
-
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
|
|
6615
|
-
|
|
6616
|
-
|
|
6617
|
-
|
|
6618
|
-
disabled = false,
|
|
6619
|
-
error = false,
|
|
6620
|
-
label,
|
|
6621
|
-
"aria-labelledby": ariaLabelledby,
|
|
6622
|
-
required = false,
|
|
6623
|
-
orientation = "vertical",
|
|
6624
|
-
children,
|
|
6625
|
-
className
|
|
6626
|
-
}, ref) => {
|
|
6627
|
-
const [internalValue, setInternalValue] = React31.useState(defaultValue);
|
|
6628
|
-
const isControlled = valueProp !== void 0;
|
|
6629
|
-
const selectedValue = isControlled ? valueProp : internalValue;
|
|
6630
|
-
const handleValueChange = React31.useCallback(
|
|
6631
|
-
(val) => {
|
|
6632
|
-
if (!isControlled) setInternalValue(val);
|
|
6633
|
-
onValueChange == null ? void 0 : onValueChange(val);
|
|
6634
|
-
},
|
|
6635
|
-
[isControlled, onValueChange]
|
|
8104
|
+
if (trailingIcon) {
|
|
8105
|
+
return /* @__PURE__ */ jsx(
|
|
8106
|
+
"span",
|
|
8107
|
+
{
|
|
8108
|
+
className: "flex shrink-0 items-center justify-center",
|
|
8109
|
+
style: { color: SEARCH_COLORS.trailingIcon },
|
|
8110
|
+
"aria-hidden": "true",
|
|
8111
|
+
children: trailingIcon
|
|
8112
|
+
}
|
|
6636
8113
|
);
|
|
6637
|
-
|
|
6638
|
-
|
|
6639
|
-
|
|
6640
|
-
|
|
6641
|
-
|
|
6642
|
-
|
|
6643
|
-
|
|
6644
|
-
|
|
6645
|
-
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
|
|
6651
|
-
|
|
6652
|
-
|
|
6653
|
-
|
|
6654
|
-
|
|
6655
|
-
|
|
6656
|
-
|
|
6657
|
-
|
|
6658
|
-
|
|
6659
|
-
|
|
8114
|
+
}
|
|
8115
|
+
return null;
|
|
8116
|
+
}
|
|
8117
|
+
function SearchViewDocked({
|
|
8118
|
+
query,
|
|
8119
|
+
onQueryChange,
|
|
8120
|
+
onSearch,
|
|
8121
|
+
active,
|
|
8122
|
+
onActiveChange,
|
|
8123
|
+
leadingIcon,
|
|
8124
|
+
trailingIcon,
|
|
8125
|
+
placeholder = "Search",
|
|
8126
|
+
textAlign = "left",
|
|
8127
|
+
styleType = "contained",
|
|
8128
|
+
hasGap = false,
|
|
8129
|
+
children,
|
|
8130
|
+
viewClassName,
|
|
8131
|
+
"aria-label": ariaLabel = "Search",
|
|
8132
|
+
searchId,
|
|
8133
|
+
listboxId,
|
|
8134
|
+
onKeyDown,
|
|
8135
|
+
activeIndex
|
|
8136
|
+
}) {
|
|
8137
|
+
const shouldReduceMotion = useReducedMotion();
|
|
8138
|
+
const inputRef = React38.useRef(null);
|
|
8139
|
+
useSearchViewFocus(inputRef, active);
|
|
8140
|
+
const dropdownRef = useClickOutside(() => {
|
|
8141
|
+
onActiveChange(false);
|
|
8142
|
+
}, active);
|
|
8143
|
+
const handleFormSubmit = (e) => {
|
|
8144
|
+
e.preventDefault();
|
|
8145
|
+
onSearch(query);
|
|
8146
|
+
};
|
|
8147
|
+
const activeDescendant = activeIndex >= 0 ? `${listboxId}-option-${activeIndex}` : void 0;
|
|
8148
|
+
return (
|
|
8149
|
+
/*
|
|
8150
|
+
* mode="popLayout": when SearchView exits, it plays exit animation first,
|
|
8151
|
+
* then unmounts — freeing the layoutId for SearchBar to re-enter and morph back.
|
|
8152
|
+
*/
|
|
8153
|
+
/* @__PURE__ */ jsx(AnimatePresence, { mode: "popLayout", children: active && /* @__PURE__ */ jsxs(
|
|
8154
|
+
m.div,
|
|
8155
|
+
{
|
|
8156
|
+
ref: dropdownRef,
|
|
8157
|
+
layoutId: shouldReduceMotion ? void 0 : searchId,
|
|
8158
|
+
className: cn(
|
|
8159
|
+
// DockedContainerShape = CornerExtraLarge = 28dp radius
|
|
8160
|
+
"rounded-[28px] overflow-hidden",
|
|
8161
|
+
viewClassName
|
|
8162
|
+
),
|
|
8163
|
+
style: { backgroundColor: SEARCH_COLORS.container },
|
|
8164
|
+
initial: shouldReduceMotion ? {} : { opacity: 0, y: -8 },
|
|
8165
|
+
animate: { opacity: 1, y: 0 },
|
|
8166
|
+
exit: shouldReduceMotion ? {} : { opacity: 0, y: -8 },
|
|
8167
|
+
transition: shouldReduceMotion ? { duration: 0 } : SEARCH_DOCKED_REVEAL_SPRING,
|
|
8168
|
+
children: [
|
|
8169
|
+
/* @__PURE__ */ jsx(
|
|
8170
|
+
"search",
|
|
8171
|
+
{
|
|
8172
|
+
"aria-label": ariaLabel,
|
|
8173
|
+
className: "flex items-center gap-2 px-4",
|
|
8174
|
+
style: { height: SearchTokens.heights.dockedHeader },
|
|
8175
|
+
children: /* @__PURE__ */ jsxs("form", { className: "contents", onSubmit: handleFormSubmit, children: [
|
|
8176
|
+
/* @__PURE__ */ jsx(
|
|
8177
|
+
"span",
|
|
8178
|
+
{
|
|
8179
|
+
className: "flex shrink-0 items-center justify-center",
|
|
8180
|
+
style: { color: SEARCH_COLORS.leadingIcon },
|
|
8181
|
+
"aria-hidden": "true",
|
|
8182
|
+
children: leadingIcon
|
|
8183
|
+
}
|
|
8184
|
+
),
|
|
8185
|
+
/* @__PURE__ */ jsx(
|
|
8186
|
+
AnimatedPlaceholder,
|
|
8187
|
+
{
|
|
8188
|
+
text: placeholder,
|
|
8189
|
+
textAlign,
|
|
8190
|
+
visible: !query,
|
|
8191
|
+
focused: active,
|
|
8192
|
+
children: /* @__PURE__ */ jsx(
|
|
8193
|
+
"input",
|
|
8194
|
+
{
|
|
8195
|
+
ref: inputRef,
|
|
8196
|
+
id: `${searchId}-view`,
|
|
8197
|
+
type: "search",
|
|
8198
|
+
role: "combobox",
|
|
8199
|
+
"aria-expanded": true,
|
|
8200
|
+
"aria-controls": listboxId,
|
|
8201
|
+
"aria-autocomplete": "list",
|
|
8202
|
+
"aria-activedescendant": activeDescendant,
|
|
8203
|
+
"aria-label": placeholder,
|
|
8204
|
+
value: query,
|
|
8205
|
+
placeholder,
|
|
8206
|
+
className: cn(
|
|
8207
|
+
"w-full bg-transparent border-none outline-none",
|
|
8208
|
+
"text-[16px] leading-6 font-normal tracking-[0.5px]",
|
|
8209
|
+
"placeholder:text-transparent"
|
|
8210
|
+
),
|
|
8211
|
+
style: { color: SEARCH_COLORS.inputText },
|
|
8212
|
+
onChange: (e) => onQueryChange(e.target.value),
|
|
8213
|
+
onKeyDown
|
|
8214
|
+
}
|
|
8215
|
+
)
|
|
8216
|
+
}
|
|
8217
|
+
),
|
|
8218
|
+
/* @__PURE__ */ jsx(
|
|
8219
|
+
TrailingAction,
|
|
8220
|
+
{
|
|
8221
|
+
query,
|
|
8222
|
+
trailingIcon,
|
|
8223
|
+
onClear: () => onQueryChange("")
|
|
8224
|
+
}
|
|
8225
|
+
)
|
|
8226
|
+
] })
|
|
8227
|
+
}
|
|
8228
|
+
),
|
|
8229
|
+
hasGap && children && /* @__PURE__ */ jsx("div", { className: "h-0.5", "aria-hidden": "true" }),
|
|
8230
|
+
styleType === "divided" && children && /* @__PURE__ */ jsx(
|
|
8231
|
+
"hr",
|
|
8232
|
+
{
|
|
8233
|
+
className: "border-0 border-t",
|
|
8234
|
+
style: { borderColor: SEARCH_COLORS.divider }
|
|
8235
|
+
}
|
|
8236
|
+
),
|
|
8237
|
+
children && /* @__PURE__ */ jsx(
|
|
8238
|
+
"div",
|
|
8239
|
+
{
|
|
8240
|
+
id: listboxId,
|
|
8241
|
+
role: "listbox",
|
|
8242
|
+
"aria-label": `${ariaLabel} results`,
|
|
8243
|
+
className: "min-h-30",
|
|
8244
|
+
children
|
|
8245
|
+
}
|
|
8246
|
+
)
|
|
8247
|
+
]
|
|
6660
8248
|
},
|
|
6661
|
-
|
|
6662
|
-
)
|
|
6663
|
-
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
|
|
6668
|
-
|
|
6669
|
-
|
|
6670
|
-
|
|
6671
|
-
|
|
6672
|
-
|
|
6673
|
-
|
|
6674
|
-
|
|
6675
|
-
|
|
8249
|
+
`${searchId}-view`
|
|
8250
|
+
) })
|
|
8251
|
+
);
|
|
8252
|
+
}
|
|
8253
|
+
function ArrowBackIcon2() {
|
|
8254
|
+
return /* @__PURE__ */ jsx(
|
|
8255
|
+
"span",
|
|
8256
|
+
{
|
|
8257
|
+
className: "material-symbols-rounded select-none leading-none",
|
|
8258
|
+
style: { fontSize: 24 },
|
|
8259
|
+
"aria-hidden": "true",
|
|
8260
|
+
children: "arrow_back"
|
|
8261
|
+
}
|
|
8262
|
+
);
|
|
8263
|
+
}
|
|
8264
|
+
function SearchViewFullScreen({
|
|
8265
|
+
query,
|
|
8266
|
+
onQueryChange,
|
|
8267
|
+
onSearch,
|
|
8268
|
+
active,
|
|
8269
|
+
onActiveChange,
|
|
8270
|
+
leadingIcon,
|
|
8271
|
+
trailingIcon,
|
|
8272
|
+
placeholder = "Search",
|
|
8273
|
+
textAlign = "left",
|
|
8274
|
+
styleType = "contained",
|
|
8275
|
+
children,
|
|
8276
|
+
viewClassName,
|
|
8277
|
+
"aria-label": ariaLabel = "Search",
|
|
8278
|
+
searchId,
|
|
8279
|
+
listboxId,
|
|
8280
|
+
onKeyDown,
|
|
8281
|
+
activeIndex
|
|
8282
|
+
}) {
|
|
8283
|
+
const shouldReduceMotion = useReducedMotion();
|
|
8284
|
+
const inputRef = React38.useRef(null);
|
|
8285
|
+
useSearchViewFocus(inputRef, active);
|
|
8286
|
+
const [mounted, setMounted] = React38.useState(false);
|
|
8287
|
+
React38.useEffect(() => {
|
|
8288
|
+
setMounted(true);
|
|
8289
|
+
}, []);
|
|
8290
|
+
const handleFormSubmit = (e) => {
|
|
8291
|
+
e.preventDefault();
|
|
8292
|
+
onSearch(query);
|
|
8293
|
+
};
|
|
8294
|
+
const handleEscape = (e) => {
|
|
8295
|
+
if (e.key === "Escape") {
|
|
8296
|
+
e.stopPropagation();
|
|
8297
|
+
onActiveChange(false);
|
|
8298
|
+
}
|
|
8299
|
+
};
|
|
8300
|
+
const activeDescendant = activeIndex >= 0 ? `${listboxId}-option-${activeIndex}` : void 0;
|
|
8301
|
+
if (!mounted) return null;
|
|
8302
|
+
const content = (
|
|
8303
|
+
/*
|
|
8304
|
+
* mode="popLayout": when FullScreen exits, it plays exit animation first,
|
|
8305
|
+
* then unmounts — freeing the layoutId for SearchBar to re-enter and morph back
|
|
8306
|
+
* to the pill shape.
|
|
8307
|
+
*/
|
|
8308
|
+
/* @__PURE__ */ jsx(AnimatePresence, { mode: "popLayout", children: active && /* @__PURE__ */ jsxs(
|
|
8309
|
+
m.div,
|
|
6676
8310
|
{
|
|
6677
|
-
|
|
6678
|
-
role: "
|
|
6679
|
-
"aria-
|
|
6680
|
-
"aria-
|
|
6681
|
-
"aria-disabled": disabled || void 0,
|
|
6682
|
-
"aria-required": required || void 0,
|
|
8311
|
+
layoutId: shouldReduceMotion ? void 0 : searchId,
|
|
8312
|
+
role: "dialog",
|
|
8313
|
+
"aria-modal": "true",
|
|
8314
|
+
"aria-label": ariaLabel,
|
|
6683
8315
|
className: cn(
|
|
6684
|
-
"flex",
|
|
6685
|
-
|
|
6686
|
-
|
|
8316
|
+
"fixed inset-0 z-50 flex flex-col overflow-hidden",
|
|
8317
|
+
// CornerNone — shape is resolved by Framer Motion layout animation
|
|
8318
|
+
"rounded-none",
|
|
8319
|
+
viewClassName
|
|
6687
8320
|
),
|
|
6688
|
-
|
|
8321
|
+
style: { backgroundColor: SEARCH_COLORS.container },
|
|
8322
|
+
initial: shouldReduceMotion ? {} : { opacity: 0 },
|
|
8323
|
+
animate: { opacity: 1 },
|
|
8324
|
+
exit: shouldReduceMotion ? {} : { opacity: 0 },
|
|
8325
|
+
transition: shouldReduceMotion ? { duration: 0 } : SEARCH_FULLSCREEN_SPRING,
|
|
8326
|
+
onKeyDown: handleEscape,
|
|
6689
8327
|
children: [
|
|
6690
|
-
|
|
6691
|
-
|
|
8328
|
+
/* @__PURE__ */ jsx(
|
|
8329
|
+
"search",
|
|
8330
|
+
{
|
|
8331
|
+
"aria-label": ariaLabel,
|
|
8332
|
+
className: "flex shrink-0 items-center gap-2 px-4",
|
|
8333
|
+
style: { height: SearchTokens.heights.fullScreenHeader },
|
|
8334
|
+
children: /* @__PURE__ */ jsxs("form", { className: "contents", onSubmit: handleFormSubmit, children: [
|
|
8335
|
+
/* @__PURE__ */ jsx(
|
|
8336
|
+
IconButton,
|
|
8337
|
+
{
|
|
8338
|
+
size: "sm",
|
|
8339
|
+
style: { color: SEARCH_COLORS.leadingIcon },
|
|
8340
|
+
"aria-label": "Close search",
|
|
8341
|
+
onClick: (e) => {
|
|
8342
|
+
e.stopPropagation();
|
|
8343
|
+
onActiveChange(false);
|
|
8344
|
+
},
|
|
8345
|
+
children: leadingIcon != null ? leadingIcon : /* @__PURE__ */ jsx(ArrowBackIcon2, {})
|
|
8346
|
+
}
|
|
8347
|
+
),
|
|
8348
|
+
/* @__PURE__ */ jsx(
|
|
8349
|
+
AnimatedPlaceholder,
|
|
8350
|
+
{
|
|
8351
|
+
text: placeholder,
|
|
8352
|
+
textAlign,
|
|
8353
|
+
visible: !query,
|
|
8354
|
+
focused: active,
|
|
8355
|
+
children: /* @__PURE__ */ jsx(
|
|
8356
|
+
"input",
|
|
8357
|
+
{
|
|
8358
|
+
ref: inputRef,
|
|
8359
|
+
id: `${searchId}-fs`,
|
|
8360
|
+
type: "search",
|
|
8361
|
+
role: "combobox",
|
|
8362
|
+
"aria-expanded": true,
|
|
8363
|
+
"aria-controls": listboxId,
|
|
8364
|
+
"aria-autocomplete": "list",
|
|
8365
|
+
"aria-activedescendant": activeDescendant,
|
|
8366
|
+
"aria-label": placeholder,
|
|
8367
|
+
value: query,
|
|
8368
|
+
placeholder,
|
|
8369
|
+
className: cn(
|
|
8370
|
+
"w-full bg-transparent border-none outline-none",
|
|
8371
|
+
"text-[16px] leading-6 font-normal tracking-[0.5px]",
|
|
8372
|
+
"placeholder:text-transparent"
|
|
8373
|
+
),
|
|
8374
|
+
style: { color: SEARCH_COLORS.inputText },
|
|
8375
|
+
onChange: (e) => onQueryChange(e.target.value),
|
|
8376
|
+
onKeyDown
|
|
8377
|
+
}
|
|
8378
|
+
)
|
|
8379
|
+
}
|
|
8380
|
+
),
|
|
8381
|
+
/* @__PURE__ */ jsx(
|
|
8382
|
+
TrailingAction,
|
|
8383
|
+
{
|
|
8384
|
+
query,
|
|
8385
|
+
trailingIcon,
|
|
8386
|
+
onClear: () => onQueryChange("")
|
|
8387
|
+
}
|
|
8388
|
+
)
|
|
8389
|
+
] })
|
|
8390
|
+
}
|
|
8391
|
+
),
|
|
8392
|
+
styleType === "divided" && /* @__PURE__ */ jsx(
|
|
8393
|
+
"hr",
|
|
8394
|
+
{
|
|
8395
|
+
className: "border-0 border-t shrink-0",
|
|
8396
|
+
style: { borderColor: SEARCH_COLORS.divider }
|
|
8397
|
+
}
|
|
8398
|
+
),
|
|
8399
|
+
/* @__PURE__ */ jsx(
|
|
8400
|
+
"div",
|
|
8401
|
+
{
|
|
8402
|
+
id: listboxId,
|
|
8403
|
+
role: "listbox",
|
|
8404
|
+
tabIndex: 0,
|
|
8405
|
+
"aria-label": `${ariaLabel} results`,
|
|
8406
|
+
className: "flex-1 overflow-y-auto outline-none",
|
|
8407
|
+
onClick: (e) => {
|
|
8408
|
+
if (e.target === e.currentTarget) onActiveChange(false);
|
|
8409
|
+
},
|
|
8410
|
+
onKeyDown: (e) => {
|
|
8411
|
+
if (e.target === e.currentTarget && (e.key === "Enter" || e.key === " ")) {
|
|
8412
|
+
e.preventDefault();
|
|
8413
|
+
onActiveChange(false);
|
|
8414
|
+
}
|
|
8415
|
+
},
|
|
8416
|
+
children
|
|
8417
|
+
}
|
|
8418
|
+
)
|
|
6692
8419
|
]
|
|
6693
|
-
}
|
|
6694
|
-
|
|
6695
|
-
|
|
6696
|
-
);
|
|
6697
|
-
|
|
6698
|
-
|
|
8420
|
+
},
|
|
8421
|
+
`${searchId}-fs`
|
|
8422
|
+
) })
|
|
8423
|
+
);
|
|
8424
|
+
return createPortal(content, document.body);
|
|
8425
|
+
}
|
|
8426
|
+
function SearchComponent({
|
|
8427
|
+
query,
|
|
8428
|
+
onQueryChange,
|
|
8429
|
+
onSearch,
|
|
8430
|
+
active,
|
|
8431
|
+
onActiveChange,
|
|
8432
|
+
variant = "docked",
|
|
8433
|
+
styleType = "contained",
|
|
8434
|
+
hasGap = false,
|
|
8435
|
+
leadingIcon,
|
|
8436
|
+
trailingIcon,
|
|
8437
|
+
placeholder = "Search",
|
|
8438
|
+
textAlign = "left",
|
|
8439
|
+
children,
|
|
8440
|
+
id,
|
|
8441
|
+
"aria-label": ariaLabel = "Search",
|
|
8442
|
+
className,
|
|
8443
|
+
viewClassName
|
|
8444
|
+
}) {
|
|
8445
|
+
const generatedId = React38.useId();
|
|
8446
|
+
const searchId = id != null ? id : generatedId;
|
|
8447
|
+
const listboxId = `${searchId}-listbox`;
|
|
8448
|
+
const itemCount = React38.Children.count(children);
|
|
8449
|
+
const { activeIndex, handleKeyDown } = useSearchKeyboard({
|
|
8450
|
+
active,
|
|
8451
|
+
onActiveChange,
|
|
8452
|
+
onSearch,
|
|
8453
|
+
query,
|
|
8454
|
+
itemCount
|
|
8455
|
+
});
|
|
8456
|
+
const sharedProps = {
|
|
8457
|
+
query,
|
|
8458
|
+
onQueryChange,
|
|
8459
|
+
onSearch,
|
|
8460
|
+
active,
|
|
8461
|
+
onActiveChange,
|
|
8462
|
+
leadingIcon,
|
|
8463
|
+
trailingIcon,
|
|
8464
|
+
placeholder,
|
|
8465
|
+
textAlign,
|
|
8466
|
+
"aria-label": ariaLabel,
|
|
8467
|
+
searchId,
|
|
8468
|
+
listboxId,
|
|
8469
|
+
onKeyDown: handleKeyDown,
|
|
8470
|
+
activeIndex
|
|
8471
|
+
};
|
|
8472
|
+
return /* @__PURE__ */ jsx(SearchProvider, { value: { activeIndex, listboxId }, children: /* @__PURE__ */ jsxs(m.div, { className, style: { minHeight: 56 }, children: [
|
|
8473
|
+
/* @__PURE__ */ jsx(SearchBar, __spreadValues({}, sharedProps)),
|
|
8474
|
+
variant === "fullscreen" ? /* @__PURE__ */ jsx(
|
|
8475
|
+
SearchViewFullScreen,
|
|
8476
|
+
__spreadProps(__spreadValues({}, sharedProps), {
|
|
8477
|
+
styleType,
|
|
8478
|
+
viewClassName,
|
|
8479
|
+
children
|
|
8480
|
+
})
|
|
8481
|
+
) : /* @__PURE__ */ jsx(
|
|
8482
|
+
SearchViewDocked,
|
|
8483
|
+
__spreadProps(__spreadValues({}, sharedProps), {
|
|
8484
|
+
styleType,
|
|
8485
|
+
hasGap,
|
|
8486
|
+
viewClassName,
|
|
8487
|
+
children
|
|
8488
|
+
})
|
|
8489
|
+
)
|
|
8490
|
+
] }) });
|
|
8491
|
+
}
|
|
8492
|
+
var Search = Object.assign(SearchComponent, { useSearch });
|
|
6699
8493
|
function coerceValue(value, min, max) {
|
|
6700
8494
|
return Math.max(min, Math.min(max, value));
|
|
6701
8495
|
}
|
|
@@ -6887,7 +8681,7 @@ var SLIDER_INDICATOR_TRANSITION = {
|
|
|
6887
8681
|
stiffness: 450,
|
|
6888
8682
|
damping: 32
|
|
6889
8683
|
};
|
|
6890
|
-
var ValueIndicator =
|
|
8684
|
+
var ValueIndicator = React38.memo(function ValueIndicator2({
|
|
6891
8685
|
value,
|
|
6892
8686
|
visible,
|
|
6893
8687
|
orientation,
|
|
@@ -6934,7 +8728,7 @@ var ValueIndicator = React31.memo(function ValueIndicator2({
|
|
|
6934
8728
|
"value-indicator"
|
|
6935
8729
|
) });
|
|
6936
8730
|
});
|
|
6937
|
-
var SliderThumb =
|
|
8731
|
+
var SliderThumb = React38.memo(function SliderThumb2({
|
|
6938
8732
|
value,
|
|
6939
8733
|
percent,
|
|
6940
8734
|
min,
|
|
@@ -6966,11 +8760,11 @@ var SliderThumb = React31.memo(function SliderThumb2({
|
|
|
6966
8760
|
[posTarget]: `calc(${trackInset}px + ${percent} * (100% - ${trackInset * 2}px))`
|
|
6967
8761
|
};
|
|
6968
8762
|
const prefersReduced = (_a = useReducedMotion()) != null ? _a : false;
|
|
6969
|
-
const [isDragging, setIsDragging] =
|
|
6970
|
-
const [isHovered, setIsHovered] =
|
|
6971
|
-
const [isFocused, setIsFocused] =
|
|
6972
|
-
const pointerIdRef =
|
|
6973
|
-
const thumbRef =
|
|
8763
|
+
const [isDragging, setIsDragging] = React38.useState(false);
|
|
8764
|
+
const [isHovered, setIsHovered] = React38.useState(false);
|
|
8765
|
+
const [isFocused, setIsFocused] = React38.useState(false);
|
|
8766
|
+
const pointerIdRef = React38.useRef(null);
|
|
8767
|
+
const thumbRef = React38.useRef(null);
|
|
6974
8768
|
const showIndicator = showValueIndicator && (isDragging || isHovered || isFocused);
|
|
6975
8769
|
const positionStyle = isHorizontal ? __spreadProps(__spreadValues({
|
|
6976
8770
|
position: "absolute"
|
|
@@ -6985,7 +8779,7 @@ var SliderThumb = React31.memo(function SliderThumb2({
|
|
|
6985
8779
|
transform: "translate(-50%, 50%)",
|
|
6986
8780
|
zIndex
|
|
6987
8781
|
});
|
|
6988
|
-
const getDeltaFromPointer =
|
|
8782
|
+
const getDeltaFromPointer = React38.useCallback(
|
|
6989
8783
|
(e) => {
|
|
6990
8784
|
const trackEl = trackRef.current;
|
|
6991
8785
|
if (!trackEl) return percent;
|
|
@@ -7012,7 +8806,7 @@ var SliderThumb = React31.memo(function SliderThumb2({
|
|
|
7012
8806
|
},
|
|
7013
8807
|
[isHorizontal, max, min, percent, step, trackRef, trackSize]
|
|
7014
8808
|
);
|
|
7015
|
-
const handlePointerDown =
|
|
8809
|
+
const handlePointerDown = React38.useCallback(
|
|
7016
8810
|
(e) => {
|
|
7017
8811
|
if (disabled) return;
|
|
7018
8812
|
e.preventDefault();
|
|
@@ -7023,7 +8817,7 @@ var SliderThumb = React31.memo(function SliderThumb2({
|
|
|
7023
8817
|
},
|
|
7024
8818
|
[disabled]
|
|
7025
8819
|
);
|
|
7026
|
-
const handlePointerMove =
|
|
8820
|
+
const handlePointerMove = React38.useCallback(
|
|
7027
8821
|
(e) => {
|
|
7028
8822
|
if (!isDragging || e.pointerId !== pointerIdRef.current) return;
|
|
7029
8823
|
const newValue = getDeltaFromPointer(e.nativeEvent);
|
|
@@ -7031,7 +8825,7 @@ var SliderThumb = React31.memo(function SliderThumb2({
|
|
|
7031
8825
|
},
|
|
7032
8826
|
[isDragging, getDeltaFromPointer, onValueChange]
|
|
7033
8827
|
);
|
|
7034
|
-
const handlePointerUp =
|
|
8828
|
+
const handlePointerUp = React38.useCallback(
|
|
7035
8829
|
(e) => {
|
|
7036
8830
|
if (e.pointerId !== pointerIdRef.current) return;
|
|
7037
8831
|
e.currentTarget.releasePointerCapture(e.pointerId);
|
|
@@ -7041,7 +8835,7 @@ var SliderThumb = React31.memo(function SliderThumb2({
|
|
|
7041
8835
|
},
|
|
7042
8836
|
[onValueChangeEnd, value]
|
|
7043
8837
|
);
|
|
7044
|
-
const handleKeyDown =
|
|
8838
|
+
const handleKeyDown = React38.useCallback(
|
|
7045
8839
|
(e) => {
|
|
7046
8840
|
if (disabled) return;
|
|
7047
8841
|
if (e.key === "Home") {
|
|
@@ -7145,7 +8939,7 @@ var SliderThumb = React31.memo(function SliderThumb2({
|
|
|
7145
8939
|
}
|
|
7146
8940
|
);
|
|
7147
8941
|
});
|
|
7148
|
-
var RangeTrack =
|
|
8942
|
+
var RangeTrack = React38.memo(function RangeTrack2({
|
|
7149
8943
|
startPercent,
|
|
7150
8944
|
endPercent,
|
|
7151
8945
|
trackSize,
|
|
@@ -7390,7 +9184,7 @@ var RangeTrack = React31.memo(function RangeTrack2({
|
|
|
7390
9184
|
}
|
|
7391
9185
|
);
|
|
7392
9186
|
});
|
|
7393
|
-
var RangeSliderComponent =
|
|
9187
|
+
var RangeSliderComponent = React38.forwardRef(
|
|
7394
9188
|
({
|
|
7395
9189
|
value: controlledValue,
|
|
7396
9190
|
defaultValue,
|
|
@@ -7414,7 +9208,7 @@ var RangeSliderComponent = React31.forwardRef(
|
|
|
7414
9208
|
const isHorizontal = orientation === "horizontal";
|
|
7415
9209
|
const defaultStart = (_a = defaultValue == null ? void 0 : defaultValue[0]) != null ? _a : min;
|
|
7416
9210
|
const defaultEnd = (_b = defaultValue == null ? void 0 : defaultValue[1]) != null ? _b : max;
|
|
7417
|
-
const [internalValue, setInternalValue] =
|
|
9211
|
+
const [internalValue, setInternalValue] = React38.useState([
|
|
7418
9212
|
defaultStart,
|
|
7419
9213
|
defaultEnd
|
|
7420
9214
|
]);
|
|
@@ -7428,10 +9222,10 @@ var RangeSliderComponent = React31.forwardRef(
|
|
|
7428
9222
|
const endValue = snap(coerce(resolvedValue[1]));
|
|
7429
9223
|
const startPercent = toPercent(startValue);
|
|
7430
9224
|
const endPercent = toPercent(endValue);
|
|
7431
|
-
const [topThumb, setTopThumb] =
|
|
7432
|
-
const trackRef =
|
|
9225
|
+
const [topThumb, setTopThumb] = React38.useState("end");
|
|
9226
|
+
const trackRef = React38.useRef(null);
|
|
7433
9227
|
const minGap = step > 0 ? step : (max - min) / 1e3;
|
|
7434
|
-
const handleStartChange =
|
|
9228
|
+
const handleStartChange = React38.useCallback(
|
|
7435
9229
|
(newStart) => {
|
|
7436
9230
|
setTopThumb("start");
|
|
7437
9231
|
const clamped = Math.min(newStart, endValue - minGap);
|
|
@@ -7443,7 +9237,7 @@ var RangeSliderComponent = React31.forwardRef(
|
|
|
7443
9237
|
},
|
|
7444
9238
|
[controlledValue, coerce, endValue, minGap, onValueChange, snap]
|
|
7445
9239
|
);
|
|
7446
|
-
const handleEndChange =
|
|
9240
|
+
const handleEndChange = React38.useCallback(
|
|
7447
9241
|
(newEnd) => {
|
|
7448
9242
|
setTopThumb("end");
|
|
7449
9243
|
const clamped = Math.max(newEnd, startValue + minGap);
|
|
@@ -7455,15 +9249,15 @@ var RangeSliderComponent = React31.forwardRef(
|
|
|
7455
9249
|
},
|
|
7456
9250
|
[controlledValue, coerce, minGap, onValueChange, snap, startValue]
|
|
7457
9251
|
);
|
|
7458
|
-
const handleStartChangeEnd =
|
|
9252
|
+
const handleStartChangeEnd = React38.useCallback(
|
|
7459
9253
|
(v) => onValueChangeEnd == null ? void 0 : onValueChangeEnd([v, endValue]),
|
|
7460
9254
|
[endValue, onValueChangeEnd]
|
|
7461
9255
|
);
|
|
7462
|
-
const handleEndChangeEnd =
|
|
9256
|
+
const handleEndChangeEnd = React38.useCallback(
|
|
7463
9257
|
(v) => onValueChangeEnd == null ? void 0 : onValueChangeEnd([startValue, v]),
|
|
7464
9258
|
[onValueChangeEnd, startValue]
|
|
7465
9259
|
);
|
|
7466
|
-
const handleTrackPointerDown =
|
|
9260
|
+
const handleTrackPointerDown = React38.useCallback(
|
|
7467
9261
|
(e) => {
|
|
7468
9262
|
if (disabled) return;
|
|
7469
9263
|
const trackEl = trackRef.current;
|
|
@@ -7507,7 +9301,7 @@ var RangeSliderComponent = React31.forwardRef(
|
|
|
7507
9301
|
trackSize
|
|
7508
9302
|
]
|
|
7509
9303
|
);
|
|
7510
|
-
const id =
|
|
9304
|
+
const id = React38.useId();
|
|
7511
9305
|
return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: /* @__PURE__ */ jsxs(
|
|
7512
9306
|
"div",
|
|
7513
9307
|
{
|
|
@@ -7587,7 +9381,7 @@ var RangeSliderComponent = React31.forwardRef(
|
|
|
7587
9381
|
}
|
|
7588
9382
|
);
|
|
7589
9383
|
RangeSliderComponent.displayName = "RangeSlider";
|
|
7590
|
-
var RangeSlider =
|
|
9384
|
+
var RangeSlider = React38.memo(RangeSliderComponent);
|
|
7591
9385
|
function getHorizontalRadius(isLeading, innerR, outerR) {
|
|
7592
9386
|
if (isLeading) {
|
|
7593
9387
|
return {
|
|
@@ -7626,7 +9420,7 @@ var allInnerRadius = (innerR) => ({
|
|
|
7626
9420
|
borderTopRightRadius: innerR,
|
|
7627
9421
|
borderBottomRightRadius: innerR
|
|
7628
9422
|
});
|
|
7629
|
-
var InsetIcon =
|
|
9423
|
+
var InsetIcon = React38.memo(function InsetIcon2({
|
|
7630
9424
|
icon,
|
|
7631
9425
|
isOnActiveSegment,
|
|
7632
9426
|
position,
|
|
@@ -7720,7 +9514,7 @@ function Ticks({
|
|
|
7720
9514
|
return /* @__PURE__ */ jsx("div", { style, "aria-hidden": "true" }, tick);
|
|
7721
9515
|
}) });
|
|
7722
9516
|
}
|
|
7723
|
-
var SliderTrack =
|
|
9517
|
+
var SliderTrack = React38.memo(function SliderTrack2({
|
|
7724
9518
|
percent,
|
|
7725
9519
|
trackSize,
|
|
7726
9520
|
orientation,
|
|
@@ -7755,8 +9549,8 @@ var SliderTrack = React31.memo(function SliderTrack2({
|
|
|
7755
9549
|
const gapWithThumbStr = `${thumbGap + thumbHalfWidth}px`;
|
|
7756
9550
|
const hasAnyInsetIcon = Boolean(insetIcon || insetIconTrailing);
|
|
7757
9551
|
const prefersReduced = (_a = useReducedMotion()) != null ? _a : false;
|
|
7758
|
-
const [trackWidth, setTrackWidth] =
|
|
7759
|
-
|
|
9552
|
+
const [trackWidth, setTrackWidth] = React38.useState(0);
|
|
9553
|
+
React38.useLayoutEffect(() => {
|
|
7760
9554
|
const el = trackRef.current;
|
|
7761
9555
|
if (!el || !hasAnyInsetIcon) return;
|
|
7762
9556
|
setTrackWidth(isHorizontal ? el.clientWidth : el.clientHeight);
|
|
@@ -7773,8 +9567,8 @@ var SliderTrack = React31.memo(function SliderTrack2({
|
|
|
7773
9567
|
const iconTotalWidth = activeIconSize + SliderTokens.insetIconPadding * 2 + thumbGap + thumbHalfWidth;
|
|
7774
9568
|
const iconThreshold = trackWidth > 0 ? iconTotalWidth / trackWidth : 0.15;
|
|
7775
9569
|
const HYSTERESIS_GAP = 0.04;
|
|
7776
|
-
const trailingActiveRef =
|
|
7777
|
-
const leadingActiveRef =
|
|
9570
|
+
const trailingActiveRef = React38.useRef(1 - percent <= iconThreshold);
|
|
9571
|
+
const leadingActiveRef = React38.useRef(percent > iconThreshold);
|
|
7778
9572
|
const trailingPercent = 1 - percent;
|
|
7779
9573
|
if (trailingActiveRef.current) {
|
|
7780
9574
|
if (trailingPercent > iconThreshold + HYSTERESIS_GAP) {
|
|
@@ -8281,7 +10075,7 @@ var SliderTrack = React31.memo(function SliderTrack2({
|
|
|
8281
10075
|
}
|
|
8282
10076
|
);
|
|
8283
10077
|
});
|
|
8284
|
-
var SliderComponent =
|
|
10078
|
+
var SliderComponent = React38.forwardRef(
|
|
8285
10079
|
({
|
|
8286
10080
|
value: controlledValue,
|
|
8287
10081
|
defaultValue,
|
|
@@ -8310,7 +10104,7 @@ var SliderComponent = React31.forwardRef(
|
|
|
8310
10104
|
const isHorizontal = orientation === "horizontal";
|
|
8311
10105
|
const midpoint = min + (max - min) / 2;
|
|
8312
10106
|
const initialValue = defaultValue != null ? defaultValue : midpoint;
|
|
8313
|
-
const [internalValue, setInternalValue] =
|
|
10107
|
+
const [internalValue, setInternalValue] = React38.useState(initialValue);
|
|
8314
10108
|
const resolvedValue = controlledValue !== void 0 ? controlledValue : internalValue;
|
|
8315
10109
|
const { coerce, snap, toPercent, ticks } = useSliderMath({
|
|
8316
10110
|
min,
|
|
@@ -8319,8 +10113,8 @@ var SliderComponent = React31.forwardRef(
|
|
|
8319
10113
|
});
|
|
8320
10114
|
const safeValue = snap(coerce(resolvedValue));
|
|
8321
10115
|
const percent = toPercent(safeValue);
|
|
8322
|
-
const trackRef =
|
|
8323
|
-
const handleValueChange =
|
|
10116
|
+
const trackRef = React38.useRef(null);
|
|
10117
|
+
const handleValueChange = React38.useCallback(
|
|
8324
10118
|
(newValue) => {
|
|
8325
10119
|
const clamped = snap(coerce(newValue));
|
|
8326
10120
|
if (controlledValue === void 0) {
|
|
@@ -8330,13 +10124,13 @@ var SliderComponent = React31.forwardRef(
|
|
|
8330
10124
|
},
|
|
8331
10125
|
[coerce, controlledValue, onValueChange, snap]
|
|
8332
10126
|
);
|
|
8333
|
-
const handleValueChangeEnd =
|
|
10127
|
+
const handleValueChangeEnd = React38.useCallback(
|
|
8334
10128
|
(newValue) => {
|
|
8335
10129
|
onValueChangeEnd == null ? void 0 : onValueChangeEnd(snap(coerce(newValue)));
|
|
8336
10130
|
},
|
|
8337
10131
|
[coerce, onValueChangeEnd, snap]
|
|
8338
10132
|
);
|
|
8339
|
-
const handleTrackPointerDown =
|
|
10133
|
+
const handleTrackPointerDown = React38.useCallback(
|
|
8340
10134
|
(e) => {
|
|
8341
10135
|
if (disabled) return;
|
|
8342
10136
|
const trackEl = trackRef.current;
|
|
@@ -8371,7 +10165,7 @@ var SliderComponent = React31.forwardRef(
|
|
|
8371
10165
|
trackSize
|
|
8372
10166
|
]
|
|
8373
10167
|
);
|
|
8374
|
-
const id =
|
|
10168
|
+
const id = React38.useId();
|
|
8375
10169
|
const thumbId = `slider-thumb-${id}`;
|
|
8376
10170
|
const supportsInsetIcon = !isCentered && SliderTokens.trackSizes[trackSize] >= 40;
|
|
8377
10171
|
const hasAnyInsetIcon = !!(insetIcon || insetIconTrailing);
|
|
@@ -8443,7 +10237,7 @@ var SliderComponent = React31.forwardRef(
|
|
|
8443
10237
|
}
|
|
8444
10238
|
);
|
|
8445
10239
|
SliderComponent.displayName = "Slider";
|
|
8446
|
-
var Slider =
|
|
10240
|
+
var Slider = React38.memo(SliderComponent);
|
|
8447
10241
|
var DURATION_MAP = {
|
|
8448
10242
|
short: 4e3,
|
|
8449
10243
|
long: 7e3
|
|
@@ -8489,9 +10283,9 @@ function toSnackbarData(item) {
|
|
|
8489
10283
|
return { id: generateId(), visuals: item.visuals, resolve: item.resolve };
|
|
8490
10284
|
}
|
|
8491
10285
|
function useSnackbarState() {
|
|
8492
|
-
const [current, setCurrent] =
|
|
8493
|
-
const queueRef =
|
|
8494
|
-
const showSnackbar =
|
|
10286
|
+
const [current, setCurrent] = React38.useState(null);
|
|
10287
|
+
const queueRef = React38.useRef([]);
|
|
10288
|
+
const showSnackbar = React38.useCallback(
|
|
8495
10289
|
(visuals) => {
|
|
8496
10290
|
return new Promise((resolve) => {
|
|
8497
10291
|
const item = { visuals, resolve };
|
|
@@ -8504,14 +10298,14 @@ function useSnackbarState() {
|
|
|
8504
10298
|
},
|
|
8505
10299
|
[]
|
|
8506
10300
|
);
|
|
8507
|
-
const _dismiss =
|
|
10301
|
+
const _dismiss = React38.useCallback((result) => {
|
|
8508
10302
|
setCurrent((prev) => {
|
|
8509
10303
|
if (prev) prev.resolve(result);
|
|
8510
10304
|
const next = queueRef.current.shift();
|
|
8511
10305
|
return next ? toSnackbarData(next) : null;
|
|
8512
10306
|
});
|
|
8513
10307
|
}, []);
|
|
8514
|
-
|
|
10308
|
+
React38.useEffect(() => {
|
|
8515
10309
|
return () => {
|
|
8516
10310
|
for (const item of queueRef.current) {
|
|
8517
10311
|
item.resolve(RESULT.DISMISSED);
|
|
@@ -8521,7 +10315,7 @@ function useSnackbarState() {
|
|
|
8521
10315
|
}, []);
|
|
8522
10316
|
return { current, showSnackbar, _dismiss };
|
|
8523
10317
|
}
|
|
8524
|
-
var Snackbar =
|
|
10318
|
+
var Snackbar = React38.memo(function Snackbar2({
|
|
8525
10319
|
data,
|
|
8526
10320
|
className
|
|
8527
10321
|
}) {
|
|
@@ -8535,15 +10329,15 @@ var Snackbar = React31.memo(function Snackbar2({
|
|
|
8535
10329
|
} = visuals;
|
|
8536
10330
|
const reducedMotion = useReducedMotion();
|
|
8537
10331
|
const durationMs = resolveDuration(duration);
|
|
8538
|
-
|
|
10332
|
+
React38.useEffect(() => {
|
|
8539
10333
|
const timer = setTimeout(() => resolve(RESULT.DISMISSED), durationMs);
|
|
8540
10334
|
return () => clearTimeout(timer);
|
|
8541
10335
|
}, [resolve, durationMs]);
|
|
8542
|
-
const handleAction =
|
|
10336
|
+
const handleAction = React38.useCallback(
|
|
8543
10337
|
() => resolve(RESULT.ACTION),
|
|
8544
10338
|
[resolve]
|
|
8545
10339
|
);
|
|
8546
|
-
const handleDismiss =
|
|
10340
|
+
const handleDismiss = React38.useCallback(
|
|
8547
10341
|
() => resolve(RESULT.DISMISSED),
|
|
8548
10342
|
[resolve]
|
|
8549
10343
|
);
|
|
@@ -8611,7 +10405,7 @@ var Snackbar = React31.memo(function Snackbar2({
|
|
|
8611
10405
|
Snackbar.displayName = "Snackbar";
|
|
8612
10406
|
function SnackbarHost({ state, className }) {
|
|
8613
10407
|
const { current, _dismiss } = state;
|
|
8614
|
-
const wrappedData =
|
|
10408
|
+
const wrappedData = React38.useMemo(() => {
|
|
8615
10409
|
if (!current) return null;
|
|
8616
10410
|
return __spreadProps(__spreadValues({}, current), { resolve: _dismiss });
|
|
8617
10411
|
}, [current, _dismiss]);
|
|
@@ -8629,10 +10423,12 @@ function SnackbarHost({ state, className }) {
|
|
|
8629
10423
|
) });
|
|
8630
10424
|
}
|
|
8631
10425
|
SnackbarHost.displayName = "SnackbarHost";
|
|
8632
|
-
var SnackbarContext =
|
|
10426
|
+
var SnackbarContext = React38.createContext(
|
|
10427
|
+
null
|
|
10428
|
+
);
|
|
8633
10429
|
function SnackbarProvider({ children }) {
|
|
8634
10430
|
const state = useSnackbarState();
|
|
8635
|
-
const contextValue =
|
|
10431
|
+
const contextValue = React38.useMemo(
|
|
8636
10432
|
() => ({ showSnackbar: state.showSnackbar }),
|
|
8637
10433
|
[state.showSnackbar]
|
|
8638
10434
|
);
|
|
@@ -8643,7 +10439,7 @@ function SnackbarProvider({ children }) {
|
|
|
8643
10439
|
}
|
|
8644
10440
|
SnackbarProvider.displayName = "SnackbarProvider";
|
|
8645
10441
|
function useSnackbar() {
|
|
8646
|
-
const ctx =
|
|
10442
|
+
const ctx = React38.useContext(SnackbarContext);
|
|
8647
10443
|
if (!ctx) {
|
|
8648
10444
|
throw new Error("useSnackbar must be used within a <SnackbarProvider>.");
|
|
8649
10445
|
}
|
|
@@ -8706,7 +10502,7 @@ var SwitchColors = {
|
|
|
8706
10502
|
// Focus indicator
|
|
8707
10503
|
focusIndicator: "var(--md-sys-color-secondary)"
|
|
8708
10504
|
};
|
|
8709
|
-
var
|
|
10505
|
+
var FAST_SPATIAL_SPRING2 = {
|
|
8710
10506
|
type: "spring",
|
|
8711
10507
|
stiffness: 500,
|
|
8712
10508
|
damping: 40
|
|
@@ -8747,7 +10543,7 @@ function isIconVisible(thumbContent, icons, showOnlySelectedIcon, checked) {
|
|
|
8747
10543
|
if (icons) return true;
|
|
8748
10544
|
return showOnlySelectedIcon && checked;
|
|
8749
10545
|
}
|
|
8750
|
-
var SwitchVisual =
|
|
10546
|
+
var SwitchVisual = React38.memo(function SwitchVisual2({
|
|
8751
10547
|
checked,
|
|
8752
10548
|
disabled,
|
|
8753
10549
|
isPressed,
|
|
@@ -8838,9 +10634,9 @@ var SwitchVisual = React31.memo(function SwitchVisual2({
|
|
|
8838
10634
|
backgroundColor: thumbBg
|
|
8839
10635
|
},
|
|
8840
10636
|
transition: prefersReduced ? { duration: 0 } : isPressed ? SNAP_TRANSITION : {
|
|
8841
|
-
x:
|
|
8842
|
-
width:
|
|
8843
|
-
height:
|
|
10637
|
+
x: FAST_SPATIAL_SPRING2,
|
|
10638
|
+
width: FAST_SPATIAL_SPRING2,
|
|
10639
|
+
height: FAST_SPATIAL_SPRING2,
|
|
8844
10640
|
backgroundColor: colorTransition
|
|
8845
10641
|
},
|
|
8846
10642
|
children: /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", children: showIcon && /* @__PURE__ */ jsx(
|
|
@@ -8867,7 +10663,7 @@ var SwitchVisual = React31.memo(function SwitchVisual2({
|
|
|
8867
10663
|
}
|
|
8868
10664
|
);
|
|
8869
10665
|
});
|
|
8870
|
-
var SwitchComponent =
|
|
10666
|
+
var SwitchComponent = React38.forwardRef(
|
|
8871
10667
|
({
|
|
8872
10668
|
checked,
|
|
8873
10669
|
onCheckedChange,
|
|
@@ -8885,16 +10681,16 @@ var SwitchComponent = React31.forwardRef(
|
|
|
8885
10681
|
}, ref) => {
|
|
8886
10682
|
var _a;
|
|
8887
10683
|
const prefersReduced = (_a = useReducedMotion()) != null ? _a : false;
|
|
8888
|
-
const [isPressed, setIsPressed] =
|
|
8889
|
-
const [isHovered, setIsHovered] =
|
|
8890
|
-
const [isFocused, setIsFocused] =
|
|
8891
|
-
const [ripples, setRipples] =
|
|
8892
|
-
const generatedId =
|
|
10684
|
+
const [isPressed, setIsPressed] = React38.useState(false);
|
|
10685
|
+
const [isHovered, setIsHovered] = React38.useState(false);
|
|
10686
|
+
const [isFocused, setIsFocused] = React38.useState(false);
|
|
10687
|
+
const [ripples, setRipples] = React38.useState([]);
|
|
10688
|
+
const generatedId = React38.useId();
|
|
8893
10689
|
const switchId = label ? `switch-${generatedId}` : void 0;
|
|
8894
|
-
const handleClick =
|
|
10690
|
+
const handleClick = React38.useCallback(() => {
|
|
8895
10691
|
if (!disabled) onCheckedChange(!checked);
|
|
8896
10692
|
}, [disabled, checked, onCheckedChange]);
|
|
8897
|
-
const handleKeyDown =
|
|
10693
|
+
const handleKeyDown = React38.useCallback(
|
|
8898
10694
|
(e) => {
|
|
8899
10695
|
if (disabled) return;
|
|
8900
10696
|
if (e.key === " " || e.key === "Enter") {
|
|
@@ -8904,7 +10700,7 @@ var SwitchComponent = React31.forwardRef(
|
|
|
8904
10700
|
},
|
|
8905
10701
|
[disabled, checked, onCheckedChange]
|
|
8906
10702
|
);
|
|
8907
|
-
const handlePointerDown =
|
|
10703
|
+
const handlePointerDown = React38.useCallback(
|
|
8908
10704
|
(e) => {
|
|
8909
10705
|
if (disabled) return;
|
|
8910
10706
|
setIsPressed(true);
|
|
@@ -8919,19 +10715,19 @@ var SwitchComponent = React31.forwardRef(
|
|
|
8919
10715
|
},
|
|
8920
10716
|
[disabled]
|
|
8921
10717
|
);
|
|
8922
|
-
const handlePointerUp =
|
|
10718
|
+
const handlePointerUp = React38.useCallback(() => {
|
|
8923
10719
|
setIsPressed(false);
|
|
8924
10720
|
}, []);
|
|
8925
|
-
const handlePointerEnter =
|
|
10721
|
+
const handlePointerEnter = React38.useCallback(() => {
|
|
8926
10722
|
if (!disabled) setIsHovered(true);
|
|
8927
10723
|
}, [disabled]);
|
|
8928
|
-
const handlePointerLeave =
|
|
10724
|
+
const handlePointerLeave = React38.useCallback(() => {
|
|
8929
10725
|
setIsHovered(false);
|
|
8930
10726
|
setIsPressed(false);
|
|
8931
10727
|
}, []);
|
|
8932
|
-
const handleFocus =
|
|
8933
|
-
const handleBlur =
|
|
8934
|
-
const removeRipple =
|
|
10728
|
+
const handleFocus = React38.useCallback(() => setIsFocused(true), []);
|
|
10729
|
+
const handleBlur = React38.useCallback(() => setIsFocused(false), []);
|
|
10730
|
+
const removeRipple = React38.useCallback(
|
|
8935
10731
|
(id) => setRipples((prev) => prev.filter((r) => r.id !== id)),
|
|
8936
10732
|
[]
|
|
8937
10733
|
);
|
|
@@ -9016,10 +10812,54 @@ var SwitchComponent = React31.forwardRef(
|
|
|
9016
10812
|
}
|
|
9017
10813
|
);
|
|
9018
10814
|
SwitchComponent.displayName = "Switch";
|
|
9019
|
-
var Switch =
|
|
9020
|
-
var
|
|
10815
|
+
var Switch = React38.memo(SwitchComponent);
|
|
10816
|
+
var typographyVariants = cva("m-0 p-0 text-m3-on-surface", {
|
|
10817
|
+
variants: {
|
|
10818
|
+
variant: {
|
|
10819
|
+
"display-lg": "text-[57px] leading-[64px] font-normal tracking-[-0.25px]",
|
|
10820
|
+
"display-md": "text-[45px] leading-[52px] font-normal tracking-[0px]",
|
|
10821
|
+
"display-sm": "text-[36px] leading-[44px] font-normal tracking-[0px]",
|
|
10822
|
+
"headline-lg": "text-[32px] leading-[40px] font-normal tracking-[0px]",
|
|
10823
|
+
"headline-md": "text-[28px] leading-[36px] font-normal tracking-[0px]",
|
|
10824
|
+
"headline-sm": "text-[24px] leading-[32px] font-normal tracking-[0px]",
|
|
10825
|
+
"title-lg": "text-[22px] leading-[28px] font-normal tracking-[0px]",
|
|
10826
|
+
"title-md": "text-[16px] leading-[24px] font-medium tracking-[0.15px]",
|
|
10827
|
+
"title-sm": "text-[14px] leading-[20px] font-medium tracking-[0.1px]",
|
|
10828
|
+
"label-lg": "text-[14px] leading-[20px] font-medium tracking-[0.1px]",
|
|
10829
|
+
"label-md": "text-[12px] leading-[16px] font-medium tracking-[0.5px]",
|
|
10830
|
+
"label-sm": "text-[11px] leading-[16px] font-medium tracking-[0.5px]",
|
|
10831
|
+
"body-lg": "text-[16px] leading-[24px] font-normal tracking-[0.5px]",
|
|
10832
|
+
"body-md": "text-[14px] leading-[20px] font-normal tracking-[0.25px]",
|
|
10833
|
+
"body-sm": "text-[12px] leading-[16px] font-normal tracking-[0.4px]"
|
|
10834
|
+
}
|
|
10835
|
+
},
|
|
10836
|
+
defaultVariants: {
|
|
10837
|
+
variant: "body-md"
|
|
10838
|
+
}
|
|
10839
|
+
});
|
|
10840
|
+
var Text = React38.forwardRef(
|
|
10841
|
+
(_a, ref) => {
|
|
10842
|
+
var _b = _a, { className, variant, as: Component } = _b, props = __objRest(_b, ["className", "variant", "as"]);
|
|
10843
|
+
const defaultComponent = React38.useMemo(() => {
|
|
10844
|
+
if ((variant == null ? void 0 : variant.startsWith("display")) || (variant == null ? void 0 : variant.startsWith("headline")))
|
|
10845
|
+
return "h1";
|
|
10846
|
+
if (variant == null ? void 0 : variant.startsWith("title")) return "h2";
|
|
10847
|
+
return "p";
|
|
10848
|
+
}, [variant]);
|
|
10849
|
+
const Tag = Component || defaultComponent;
|
|
10850
|
+
return /* @__PURE__ */ jsx(
|
|
10851
|
+
Tag,
|
|
10852
|
+
__spreadValues({
|
|
10853
|
+
ref,
|
|
10854
|
+
className: cn(typographyVariants({ variant, className }))
|
|
10855
|
+
}, props)
|
|
10856
|
+
);
|
|
10857
|
+
}
|
|
10858
|
+
);
|
|
10859
|
+
Text.displayName = "Text";
|
|
10860
|
+
var TabsContext = React38.createContext(null);
|
|
9021
10861
|
function useTabsContext() {
|
|
9022
|
-
const ctx =
|
|
10862
|
+
const ctx = React38.useContext(TabsContext);
|
|
9023
10863
|
if (!ctx) {
|
|
9024
10864
|
throw new Error(
|
|
9025
10865
|
"[MD3 Tabs] Component must be used within a <Tabs> root. Ensure <TabsList>, <Tab>, and <TabsContent> are descendants of <Tabs>."
|
|
@@ -9027,7 +10867,7 @@ function useTabsContext() {
|
|
|
9027
10867
|
}
|
|
9028
10868
|
return ctx;
|
|
9029
10869
|
}
|
|
9030
|
-
var TabsComponent =
|
|
10870
|
+
var TabsComponent = React38.forwardRef(
|
|
9031
10871
|
({
|
|
9032
10872
|
value: controlledValue,
|
|
9033
10873
|
defaultValue = "",
|
|
@@ -9036,35 +10876,35 @@ var TabsComponent = React31.forwardRef(
|
|
|
9036
10876
|
children,
|
|
9037
10877
|
className
|
|
9038
10878
|
}, ref) => {
|
|
9039
|
-
const [internalValue, setInternalValue] =
|
|
10879
|
+
const [internalValue, setInternalValue] = React38.useState(defaultValue);
|
|
9040
10880
|
const isControlled = controlledValue !== void 0;
|
|
9041
10881
|
const value = isControlled ? controlledValue : internalValue;
|
|
9042
|
-
const handleValueChange =
|
|
10882
|
+
const handleValueChange = React38.useCallback(
|
|
9043
10883
|
(newValue) => {
|
|
9044
10884
|
if (!isControlled) setInternalValue(newValue);
|
|
9045
10885
|
onValueChange == null ? void 0 : onValueChange(newValue);
|
|
9046
10886
|
},
|
|
9047
10887
|
[isControlled, onValueChange]
|
|
9048
10888
|
);
|
|
9049
|
-
const [focusedValue, setFocusedValue] =
|
|
9050
|
-
|
|
10889
|
+
const [focusedValue, setFocusedValue] = React38.useState(value);
|
|
10890
|
+
React38.useEffect(() => {
|
|
9051
10891
|
setFocusedValue(value);
|
|
9052
10892
|
}, [value]);
|
|
9053
|
-
const [tabValues, setTabValues] =
|
|
9054
|
-
const registerTab =
|
|
10893
|
+
const [tabValues, setTabValues] = React38.useState([]);
|
|
10894
|
+
const registerTab = React38.useCallback((tabValue) => {
|
|
9055
10895
|
setTabValues((prev) => {
|
|
9056
10896
|
if (prev.includes(tabValue)) return prev;
|
|
9057
10897
|
return [...prev, tabValue];
|
|
9058
10898
|
});
|
|
9059
10899
|
}, []);
|
|
9060
|
-
const unregisterTab =
|
|
10900
|
+
const unregisterTab = React38.useCallback((tabValue) => {
|
|
9061
10901
|
setTabValues((prev) => prev.filter((v) => v !== tabValue));
|
|
9062
10902
|
}, []);
|
|
9063
|
-
const hasAutoSelected =
|
|
9064
|
-
const [disabledValues, setDisabledValues] =
|
|
10903
|
+
const hasAutoSelected = React38.useRef(false);
|
|
10904
|
+
const [disabledValues, setDisabledValues] = React38.useState(
|
|
9065
10905
|
/* @__PURE__ */ new Set()
|
|
9066
10906
|
);
|
|
9067
|
-
const markTabDisabled =
|
|
10907
|
+
const markTabDisabled = React38.useCallback(
|
|
9068
10908
|
(tabValue, disabled) => {
|
|
9069
10909
|
setDisabledValues((prev) => {
|
|
9070
10910
|
const next = new Set(prev);
|
|
@@ -9078,7 +10918,7 @@ var TabsComponent = React31.forwardRef(
|
|
|
9078
10918
|
},
|
|
9079
10919
|
[]
|
|
9080
10920
|
);
|
|
9081
|
-
|
|
10921
|
+
React38.useEffect(() => {
|
|
9082
10922
|
if (isControlled || hasAutoSelected.current || tabValues.length === 0) {
|
|
9083
10923
|
return;
|
|
9084
10924
|
}
|
|
@@ -9093,9 +10933,9 @@ var TabsComponent = React31.forwardRef(
|
|
|
9093
10933
|
setFocusedValue(firstEnabled);
|
|
9094
10934
|
}
|
|
9095
10935
|
}, [tabValues, disabledValues, isControlled, value]);
|
|
9096
|
-
const id =
|
|
10936
|
+
const id = React38.useId();
|
|
9097
10937
|
const layoutGroupId = `tabs-${id}`;
|
|
9098
|
-
const contextValue =
|
|
10938
|
+
const contextValue = React38.useMemo(
|
|
9099
10939
|
() => ({
|
|
9100
10940
|
value,
|
|
9101
10941
|
onValueChange: handleValueChange,
|
|
@@ -9126,12 +10966,12 @@ var TabsComponent = React31.forwardRef(
|
|
|
9126
10966
|
}
|
|
9127
10967
|
);
|
|
9128
10968
|
TabsComponent.displayName = "Tabs";
|
|
9129
|
-
var Tabs =
|
|
9130
|
-
var TabsListContext =
|
|
10969
|
+
var Tabs = React38.memo(TabsComponent);
|
|
10970
|
+
var TabsListContext = React38.createContext(
|
|
9131
10971
|
null
|
|
9132
10972
|
);
|
|
9133
10973
|
function useTabsListContext() {
|
|
9134
|
-
const ctx =
|
|
10974
|
+
const ctx = React38.useContext(TabsListContext);
|
|
9135
10975
|
return ctx != null ? ctx : { variant: "primary", scrollable: false };
|
|
9136
10976
|
}
|
|
9137
10977
|
|
|
@@ -9215,7 +11055,7 @@ var TABS_CONTENT_TRANSITION = {
|
|
|
9215
11055
|
ease: "easeInOut"
|
|
9216
11056
|
};
|
|
9217
11057
|
var INDICATOR_MIN_WIDTH = 24;
|
|
9218
|
-
var TabComponent =
|
|
11058
|
+
var TabComponent = React38.forwardRef(
|
|
9219
11059
|
({
|
|
9220
11060
|
value,
|
|
9221
11061
|
icon,
|
|
@@ -9245,9 +11085,9 @@ var TabComponent = React31.forwardRef(
|
|
|
9245
11085
|
const isFocused = focusedValue === value;
|
|
9246
11086
|
const hasIcon = icon != null;
|
|
9247
11087
|
const isStackedIcon = hasIcon && !inlineIcon;
|
|
9248
|
-
const buttonRef =
|
|
9249
|
-
const isFirstMount =
|
|
9250
|
-
const mergedRef =
|
|
11088
|
+
const buttonRef = React38.useRef(null);
|
|
11089
|
+
const isFirstMount = React38.useRef(true);
|
|
11090
|
+
const mergedRef = React38.useCallback(
|
|
9251
11091
|
(node) => {
|
|
9252
11092
|
buttonRef.current = node;
|
|
9253
11093
|
if (typeof ref === "function") ref(node);
|
|
@@ -9255,15 +11095,15 @@ var TabComponent = React31.forwardRef(
|
|
|
9255
11095
|
},
|
|
9256
11096
|
[ref]
|
|
9257
11097
|
);
|
|
9258
|
-
|
|
11098
|
+
React38.useEffect(() => {
|
|
9259
11099
|
registerTab(value);
|
|
9260
11100
|
return () => unregisterTab(value);
|
|
9261
11101
|
}, [value, registerTab, unregisterTab]);
|
|
9262
|
-
|
|
11102
|
+
React38.useEffect(() => {
|
|
9263
11103
|
markTabDisabled(value, disabled);
|
|
9264
11104
|
return () => markTabDisabled(value, false);
|
|
9265
11105
|
}, [value, disabled, markTabDisabled]);
|
|
9266
|
-
const handleKeyDown =
|
|
11106
|
+
const handleKeyDown = React38.useCallback(
|
|
9267
11107
|
(e) => {
|
|
9268
11108
|
const isRtl = buttonRef.current ? getComputedStyle(buttonRef.current).direction === "rtl" : false;
|
|
9269
11109
|
const enabledValues = tabValues.filter((v) => !disabledValues.has(v));
|
|
@@ -9317,7 +11157,7 @@ var TabComponent = React31.forwardRef(
|
|
|
9317
11157
|
autoActivate
|
|
9318
11158
|
]
|
|
9319
11159
|
);
|
|
9320
|
-
|
|
11160
|
+
React38.useEffect(() => {
|
|
9321
11161
|
if (isFirstMount.current) {
|
|
9322
11162
|
isFirstMount.current = false;
|
|
9323
11163
|
return;
|
|
@@ -9326,7 +11166,7 @@ var TabComponent = React31.forwardRef(
|
|
|
9326
11166
|
buttonRef.current.focus({ preventScroll: true });
|
|
9327
11167
|
}
|
|
9328
11168
|
}, [isFocused]);
|
|
9329
|
-
|
|
11169
|
+
React38.useEffect(() => {
|
|
9330
11170
|
if (!isActive || !scrollable || !buttonRef.current) return;
|
|
9331
11171
|
const btn = buttonRef.current;
|
|
9332
11172
|
let container = btn.parentElement;
|
|
@@ -9463,8 +11303,8 @@ var TabComponent = React31.forwardRef(
|
|
|
9463
11303
|
}
|
|
9464
11304
|
);
|
|
9465
11305
|
TabComponent.displayName = "Tab";
|
|
9466
|
-
var Tab =
|
|
9467
|
-
var TabsContentComponent =
|
|
11306
|
+
var Tab = React38.memo(TabComponent);
|
|
11307
|
+
var TabsContentComponent = React38.forwardRef(
|
|
9468
11308
|
({ value, className, children }, ref) => {
|
|
9469
11309
|
var _a;
|
|
9470
11310
|
const { value: selectedValue, layoutGroupId } = useTabsContext();
|
|
@@ -9498,8 +11338,8 @@ var TabsContentComponent = React31.forwardRef(
|
|
|
9498
11338
|
}
|
|
9499
11339
|
);
|
|
9500
11340
|
TabsContentComponent.displayName = "TabsContent";
|
|
9501
|
-
var TabsContent =
|
|
9502
|
-
var TabsListComponent =
|
|
11341
|
+
var TabsContent = React38.memo(TabsContentComponent);
|
|
11342
|
+
var TabsListComponent = React38.forwardRef(
|
|
9503
11343
|
({
|
|
9504
11344
|
variant,
|
|
9505
11345
|
scrollable = false,
|
|
@@ -9510,12 +11350,12 @@ var TabsListComponent = React31.forwardRef(
|
|
|
9510
11350
|
}, ref) => {
|
|
9511
11351
|
const { layoutGroupId, value, setFocusedValue } = useTabsContext();
|
|
9512
11352
|
const listLayoutId = `${layoutGroupId}-list`;
|
|
9513
|
-
const listContextValue =
|
|
11353
|
+
const listContextValue = React38.useMemo(
|
|
9514
11354
|
() => ({ variant, scrollable }),
|
|
9515
11355
|
[variant, scrollable]
|
|
9516
11356
|
);
|
|
9517
11357
|
const bgColor = backgroundColor != null ? backgroundColor : "var(--md-sys-color-surface)";
|
|
9518
|
-
const handleBlur =
|
|
11358
|
+
const handleBlur = React38.useCallback(
|
|
9519
11359
|
(e) => {
|
|
9520
11360
|
const listEl = e.currentTarget;
|
|
9521
11361
|
if (listEl.contains(e.relatedTarget)) return;
|
|
@@ -9564,7 +11404,7 @@ var TabsListComponent = React31.forwardRef(
|
|
|
9564
11404
|
}
|
|
9565
11405
|
);
|
|
9566
11406
|
TabsListComponent.displayName = "TabsList";
|
|
9567
|
-
var TabsList =
|
|
11407
|
+
var TabsList = React38.memo(TabsListComponent);
|
|
9568
11408
|
|
|
9569
11409
|
// src/ui/text-field/text-field.tokens.ts
|
|
9570
11410
|
var TF_COLORS = {
|
|
@@ -9603,7 +11443,7 @@ var TF_TYPOGRAPHY = {
|
|
|
9603
11443
|
var TF_CLASSES = {
|
|
9604
11444
|
// Prefix / Suffix
|
|
9605
11445
|
prefixSuffix: "text-base text-[var(--color-m3-on-surface-variant)] select-none shrink-0"};
|
|
9606
|
-
var ActiveIndicator =
|
|
11446
|
+
var ActiveIndicator = React38.memo(function ActiveIndicator2({
|
|
9607
11447
|
isFocused,
|
|
9608
11448
|
isError,
|
|
9609
11449
|
isDisabled,
|
|
@@ -9650,7 +11490,7 @@ function getLabelColor(isFloated, isFocused, isError, isDisabled) {
|
|
|
9650
11490
|
if (isFloated && isFocused) return TF_COLORS.primary;
|
|
9651
11491
|
return TF_COLORS.onSurfaceVariant;
|
|
9652
11492
|
}
|
|
9653
|
-
var FloatingLabel =
|
|
11493
|
+
var FloatingLabel = React38.memo(function FloatingLabel2({
|
|
9654
11494
|
text,
|
|
9655
11495
|
isFloated,
|
|
9656
11496
|
isFocused,
|
|
@@ -9710,7 +11550,7 @@ var FloatingLabel = React31.memo(function FloatingLabel2({
|
|
|
9710
11550
|
);
|
|
9711
11551
|
});
|
|
9712
11552
|
FloatingLabel.displayName = "FloatingLabel";
|
|
9713
|
-
var LeadingIcon =
|
|
11553
|
+
var LeadingIcon = React38.memo(function LeadingIcon2({
|
|
9714
11554
|
children,
|
|
9715
11555
|
isError,
|
|
9716
11556
|
isDisabled
|
|
@@ -9734,7 +11574,7 @@ function getOutlineColor(isFocused, isError, isHovered, isDisabled) {
|
|
|
9734
11574
|
if (isHovered) return TF_COLORS.inputText;
|
|
9735
11575
|
return TF_COLORS.outline;
|
|
9736
11576
|
}
|
|
9737
|
-
var OutlineContainer =
|
|
11577
|
+
var OutlineContainer = React38.memo(function OutlineContainer2({
|
|
9738
11578
|
isFloated,
|
|
9739
11579
|
isFocused,
|
|
9740
11580
|
isError,
|
|
@@ -9832,7 +11672,7 @@ var OutlineContainer = React31.memo(function OutlineContainer2({
|
|
|
9832
11672
|
);
|
|
9833
11673
|
});
|
|
9834
11674
|
OutlineContainer.displayName = "OutlineContainer";
|
|
9835
|
-
var PrefixSuffix =
|
|
11675
|
+
var PrefixSuffix = React38.memo(function PrefixSuffix2({
|
|
9836
11676
|
text,
|
|
9837
11677
|
type,
|
|
9838
11678
|
visible,
|
|
@@ -9874,7 +11714,7 @@ function AnimatedText({
|
|
|
9874
11714
|
motionKey
|
|
9875
11715
|
);
|
|
9876
11716
|
}
|
|
9877
|
-
var SupportingText =
|
|
11717
|
+
var SupportingText = React38.memo(function SupportingText2({
|
|
9878
11718
|
supportingText,
|
|
9879
11719
|
errorText,
|
|
9880
11720
|
isError,
|
|
@@ -9985,7 +11825,7 @@ function ClearIcon() {
|
|
|
9985
11825
|
}
|
|
9986
11826
|
);
|
|
9987
11827
|
}
|
|
9988
|
-
var TrailingIcon =
|
|
11828
|
+
var TrailingIcon = React38.memo(function TrailingIcon2({
|
|
9989
11829
|
mode,
|
|
9990
11830
|
children,
|
|
9991
11831
|
value,
|
|
@@ -10051,7 +11891,7 @@ var TrailingIcon = React31.memo(function TrailingIcon2({
|
|
|
10051
11891
|
});
|
|
10052
11892
|
TrailingIcon.displayName = "TrailingIcon";
|
|
10053
11893
|
var LINE_HEIGHT_PX = 24;
|
|
10054
|
-
var TextFieldComponent =
|
|
11894
|
+
var TextFieldComponent = React38.forwardRef(
|
|
10055
11895
|
({
|
|
10056
11896
|
// Core
|
|
10057
11897
|
variant = "filled",
|
|
@@ -10115,30 +11955,30 @@ var TextFieldComponent = React31.forwardRef(
|
|
|
10115
11955
|
}, ref) => {
|
|
10116
11956
|
var _a;
|
|
10117
11957
|
const prefersReduced = (_a = useReducedMotion()) != null ? _a : false;
|
|
10118
|
-
const generatedId =
|
|
11958
|
+
const generatedId = React38.useId();
|
|
10119
11959
|
const inputId = idProp != null ? idProp : `tf-${generatedId}`;
|
|
10120
11960
|
const supportingId = `${inputId}-supporting`;
|
|
10121
11961
|
const isControlled = valueProp !== void 0;
|
|
10122
|
-
const [internalValue, setInternalValue] =
|
|
11962
|
+
const [internalValue, setInternalValue] = React38.useState(defaultValue);
|
|
10123
11963
|
const currentValue = isControlled ? valueProp : internalValue;
|
|
10124
|
-
const [isFocused, setIsFocused] =
|
|
10125
|
-
const [showPassword, setShowPassword] =
|
|
11964
|
+
const [isFocused, setIsFocused] = React38.useState(false);
|
|
11965
|
+
const [showPassword, setShowPassword] = React38.useState(false);
|
|
10126
11966
|
const resolvedInputType = type === "password" && showPassword ? "text" : type;
|
|
10127
|
-
const [nativeError, setNativeError] =
|
|
10128
|
-
const [labelWidth, setLabelWidth] =
|
|
11967
|
+
const [nativeError, setNativeError] = React38.useState("");
|
|
11968
|
+
const [labelWidth, setLabelWidth] = React38.useState(0);
|
|
10129
11969
|
const hasValue = currentValue.length > 0;
|
|
10130
11970
|
const isFloated = isFocused || hasValue;
|
|
10131
11971
|
const isError = errorProp || !!nativeError || maxLength !== void 0 && currentValue.length > maxLength;
|
|
10132
11972
|
const containerHeight = dense ? TF_SIZE.denseHeight : TF_SIZE.height;
|
|
10133
11973
|
const showAsterisk = required && !noAsterisk;
|
|
10134
|
-
const inputRef =
|
|
10135
|
-
const labelSpanRef =
|
|
10136
|
-
|
|
11974
|
+
const inputRef = React38.useRef(null);
|
|
11975
|
+
const labelSpanRef = React38.useRef(null);
|
|
11976
|
+
React38.useLayoutEffect(() => {
|
|
10137
11977
|
if (labelSpanRef.current) {
|
|
10138
11978
|
setLabelWidth(labelSpanRef.current.offsetWidth);
|
|
10139
11979
|
}
|
|
10140
11980
|
}, []);
|
|
10141
|
-
|
|
11981
|
+
React38.useLayoutEffect(() => {
|
|
10142
11982
|
if (type !== "textarea" || !inputRef.current) return;
|
|
10143
11983
|
const textarea = inputRef.current;
|
|
10144
11984
|
if (autoResize) {
|
|
@@ -10150,7 +11990,7 @@ var TextFieldComponent = React31.forwardRef(
|
|
|
10150
11990
|
}
|
|
10151
11991
|
textarea.style.overflowY = "hidden";
|
|
10152
11992
|
}, [type, autoResize, maxRows, currentValue]);
|
|
10153
|
-
const handleValueChange =
|
|
11993
|
+
const handleValueChange = React38.useCallback(
|
|
10154
11994
|
(newValue) => {
|
|
10155
11995
|
var _a2, _b;
|
|
10156
11996
|
if (!isControlled) setInternalValue(newValue);
|
|
@@ -10159,7 +11999,7 @@ var TextFieldComponent = React31.forwardRef(
|
|
|
10159
11999
|
},
|
|
10160
12000
|
[isControlled]
|
|
10161
12001
|
);
|
|
10162
|
-
const handleChange =
|
|
12002
|
+
const handleChange = React38.useCallback(
|
|
10163
12003
|
(e) => {
|
|
10164
12004
|
const newVal = e.target.value;
|
|
10165
12005
|
handleValueChange(newVal);
|
|
@@ -10167,14 +12007,14 @@ var TextFieldComponent = React31.forwardRef(
|
|
|
10167
12007
|
},
|
|
10168
12008
|
[handleValueChange, onChange]
|
|
10169
12009
|
);
|
|
10170
|
-
const handleFocus =
|
|
12010
|
+
const handleFocus = React38.useCallback(
|
|
10171
12011
|
(e) => {
|
|
10172
12012
|
setIsFocused(true);
|
|
10173
12013
|
onFocus == null ? void 0 : onFocus(e);
|
|
10174
12014
|
},
|
|
10175
12015
|
[onFocus]
|
|
10176
12016
|
);
|
|
10177
|
-
const handleBlur =
|
|
12017
|
+
const handleBlur = React38.useCallback(
|
|
10178
12018
|
(e) => {
|
|
10179
12019
|
setIsFocused(false);
|
|
10180
12020
|
const el = inputRef.current;
|
|
@@ -10187,7 +12027,7 @@ var TextFieldComponent = React31.forwardRef(
|
|
|
10187
12027
|
},
|
|
10188
12028
|
[onBlur]
|
|
10189
12029
|
);
|
|
10190
|
-
const handleClear =
|
|
12030
|
+
const handleClear = React38.useCallback(() => {
|
|
10191
12031
|
var _a2;
|
|
10192
12032
|
handleValueChange("");
|
|
10193
12033
|
onChange == null ? void 0 : onChange("", {
|
|
@@ -10195,12 +12035,12 @@ var TextFieldComponent = React31.forwardRef(
|
|
|
10195
12035
|
});
|
|
10196
12036
|
(_a2 = inputRef.current) == null ? void 0 : _a2.focus();
|
|
10197
12037
|
}, [handleValueChange, onChange]);
|
|
10198
|
-
const handlePasswordToggle =
|
|
12038
|
+
const handlePasswordToggle = React38.useCallback(() => {
|
|
10199
12039
|
var _a2;
|
|
10200
12040
|
setShowPassword((prev) => !prev);
|
|
10201
12041
|
(_a2 = inputRef.current) == null ? void 0 : _a2.focus();
|
|
10202
12042
|
}, []);
|
|
10203
|
-
|
|
12043
|
+
React38.useImperativeHandle(
|
|
10204
12044
|
ref,
|
|
10205
12045
|
() => ({
|
|
10206
12046
|
focus: () => {
|
|
@@ -10445,7 +12285,7 @@ var TextFieldComponent = React31.forwardRef(
|
|
|
10445
12285
|
}
|
|
10446
12286
|
);
|
|
10447
12287
|
TextFieldComponent.displayName = "TextField";
|
|
10448
|
-
var TextField =
|
|
12288
|
+
var TextField = React38.memo(TextFieldComponent);
|
|
10449
12289
|
|
|
10450
12290
|
// src/ui/typography/typography-key-tokens.ts
|
|
10451
12291
|
var TypographyKeyTokens = /* @__PURE__ */ ((TypographyKeyTokens2) => {
|
|
@@ -11890,7 +13730,7 @@ function TooltipBox({
|
|
|
11890
13730
|
onKeyDown: handleKeyDown,
|
|
11891
13731
|
"aria-label": ariaLabel,
|
|
11892
13732
|
"aria-describedby": state.isVisible ? tooltipId : void 0,
|
|
11893
|
-
children:
|
|
13733
|
+
children: React38.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children })
|
|
11894
13734
|
}
|
|
11895
13735
|
),
|
|
11896
13736
|
mounted && createPortal(
|
|
@@ -11920,6 +13760,6 @@ function TooltipBox({
|
|
|
11920
13760
|
] });
|
|
11921
13761
|
}
|
|
11922
13762
|
|
|
11923
|
-
export { APP_BAR_BOTTOM_SPRING, APP_BAR_COLORS, APP_BAR_COLOR_TRANSITION, APP_BAR_ENTER_ALWAYS_SPRING, APP_BAR_TITLE_FADE, AppBarColumn, AppBarOverflowIndicator, AppBarRow, AppBarTokens, Badge, BadgedBox, BottomAppBar, Button, ButtonGroup, Card, Checkbox, Chip, CodeBlock, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogFullScreenContent, DialogHeader, DialogIcon, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Divider, DockedToolbar, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger,
|
|
13763
|
+
export { APP_BAR_BOTTOM_SPRING, APP_BAR_COLORS, APP_BAR_COLOR_TRANSITION, APP_BAR_ENTER_ALWAYS_SPRING, APP_BAR_TITLE_FADE, AppBarColumn, AppBarOverflowIndicator, AppBarRow, AppBarTokens, Badge, BadgedBox, BottomAppBar, Button, ButtonGroup, CHECK_ICON_VARIANTS, Card, Checkbox, Chip, CodeBlock, ContextMenu, ContextMenuContent, ContextMenuTrigger, DIVIDER_COLOR, DIVIDER_PADDING, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogFullScreenContent, DialogHeader, DialogIcon, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Divider, DockedToolbar, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, FAB, FABMenu, FABMenuItem, FABPosition, FAST_EFFECTS_TRANSITION, FAST_SPATIAL_SPRING, GROUP_SHAPES, ITEM_SHAPE_CLASSES, Icon, IconButton, LargeFlexibleAppBar, LoadingIndicator, MD3ThemeProvider, MD3_EXPRESSIVE_FONT_VARIATION, MENU_CHECK_ICON_SIZE, MENU_CONTAINER_VARIANTS, MENU_GROUP_GAP, MENU_ICON_SIZE, MENU_ITEM_MIN_HEIGHT, MENU_MAX_WIDTH, MENU_MIN_WIDTH, MaterialSymbolsPreconnect, MediumFlexibleAppBar, Menu, MenuContent, MenuDivider, MenuGroup, MenuItem, MenuProvider, MenuTrigger, NavigationRail, NavigationRailItem, PlainTooltip, ProgressIndicator, RadioButton, RadioGroup, RangeSlider, RichTooltip, Ripple, SEARCH_BAR_EXPAND_SPRING, SEARCH_COLORS, SEARCH_DOCKED_REVEAL_SPRING, SEARCH_FULLSCREEN_SPRING, SEARCH_TYPOGRAPHY, SEARCH_VIEW_SPRING, STANDARD_COLORS, SUBMENU_CONTAINER_VARIANTS, ScrollArea, ScrollAreaScrollbar, Search, SearchAppBar, SearchBar, SearchTokens, SearchView, SearchViewContainer, SearchViewDocked, SearchViewFullScreen, Slider, SliderColors, SliderTokens, SmallAppBar, Snackbar, SnackbarHost, SnackbarProvider, SubMenu, Switch, SwitchColors, SwitchTokens, Tab, TableOfContents, Tabs, TabsColors, TabsContent, TabsList, TabsTokens, Text, TextField, ToggleFAB, TooltipBox, TooltipCaretShape, TooltipTokens, TriStateCheckbox, TypeScaleTokens, Typography, TypographyContext, TypographyKeyTokens, TypographyProvider, TypographyTokens, VIBRANT_COLORS, VerticalMenu, VerticalMenuContent, VerticalMenuDivider, VerticalMenuGroup, appBarTypography, applyTheme, buildWavePath, cn, generateM3Theme, useAppBarScroll, useRipple as useDOMRipple, useMediaQuery, useMenuContext, useRipple2 as useRipple, useRippleState, useSearchKeyboard, useSnackbar, useSnackbarState, useTheme, useThemeMode, useTooltipPosition, useTooltipState, useTypography };
|
|
11924
13764
|
//# sourceMappingURL=index.mjs.map
|
|
11925
13765
|
//# sourceMappingURL=index.mjs.map
|