@bug-on/md3-react 2.0.3 → 3.0.1
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 +42 -0
- package/CHANGELOG.md +69 -0
- package/dist/index.css +178 -0
- package/dist/index.css.d.ts +2 -0
- package/dist/index.d.mts +6135 -0
- package/dist/index.d.ts +6135 -71
- package/dist/index.js +1688 -631
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1600 -564
- 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/plugin.d.mts +1 -0
- package/dist/plugin.d.ts +1 -0
- package/dist/plugin.js +13 -0
- package/dist/plugin.js.map +1 -0
- package/dist/plugin.mjs +3 -0
- package/dist/plugin.mjs.map +1 -0
- package/dist/typography.css.d.ts +2 -0
- package/package.json +28 -19
- package/scripts/copy-assets.js +115 -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/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 +195 -0
- package/src/lib/utils.ts +6 -0
- package/src/plugin.ts +12 -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 +306 -0
- package/src/ui/button.tsx +665 -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 +607 -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 +135 -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 +215 -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/useClickOutside.d.ts +0 -8
- 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/search/animated-placeholder.d.ts +0 -54
- package/dist/ui/search/hooks/use-search-keyboard.d.ts +0 -32
- package/dist/ui/search/hooks/use-search-view-focus.d.ts +0 -6
- package/dist/ui/search/index.d.ts +0 -27
- package/dist/ui/search/search-bar.d.ts +0 -32
- package/dist/ui/search/search-context.d.ts +0 -24
- package/dist/ui/search/search-view-docked.d.ts +0 -25
- package/dist/ui/search/search-view-fullscreen.d.ts +0 -36
- package/dist/ui/search/search.d.ts +0 -50
- package/dist/ui/search/search.tokens.d.ts +0 -112
- package/dist/ui/search/search.types.d.ts +0 -131
- package/dist/ui/search/trailing-action.d.ts +0 -9
- 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/hooks/index.d.ts → src/hooks/index.ts} +0 -0
- /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
|
|
2
|
+
import * as React38 from 'react';
|
|
3
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';
|
|
@@ -152,6 +153,11 @@ function MaterialSymbolsPreconnect({
|
|
|
152
153
|
)
|
|
153
154
|
] });
|
|
154
155
|
}
|
|
156
|
+
function resolveMode(mode) {
|
|
157
|
+
if (mode !== "system") return mode;
|
|
158
|
+
if (typeof window === "undefined") return "light";
|
|
159
|
+
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
160
|
+
}
|
|
155
161
|
function generateM3Theme(sourceColorHex, mode = "light") {
|
|
156
162
|
const sourceColor = argbFromHex(sourceColorHex);
|
|
157
163
|
const theme = themeFromSourceColor(sourceColor);
|
|
@@ -210,13 +216,14 @@ function generateM3Theme(sourceColorHex, mode = "light") {
|
|
|
210
216
|
};
|
|
211
217
|
}
|
|
212
218
|
function applyTheme(sourceColorHex, mode = "light", root = document.documentElement) {
|
|
213
|
-
const
|
|
219
|
+
const resolved = resolveMode(mode);
|
|
220
|
+
const colors = generateM3Theme(sourceColorHex, resolved);
|
|
214
221
|
for (const [key, value] of Object.entries(colors)) {
|
|
215
|
-
const kebabKey = key.replace(/[A-Z]/g, (
|
|
222
|
+
const kebabKey = key.replace(/[A-Z]/g, (m47) => `-${m47.toLowerCase()}`);
|
|
216
223
|
root.style.setProperty(`--md-sys-color-${kebabKey}`, value);
|
|
217
224
|
root.style.setProperty(`--color-m3-${kebabKey}`, value);
|
|
218
225
|
}
|
|
219
|
-
root.setAttribute("data-theme",
|
|
226
|
+
root.setAttribute("data-theme", resolved);
|
|
220
227
|
}
|
|
221
228
|
function cn(...inputs) {
|
|
222
229
|
return twMerge(clsx(inputs));
|
|
@@ -409,6 +416,671 @@ function AppBarItemButton({ item }) {
|
|
|
409
416
|
);
|
|
410
417
|
}
|
|
411
418
|
|
|
419
|
+
// src/ui/menu/menu-animations.ts
|
|
420
|
+
var FAST_SPATIAL_SPRING = {
|
|
421
|
+
type: "spring",
|
|
422
|
+
stiffness: 380,
|
|
423
|
+
damping: 28,
|
|
424
|
+
mass: 1
|
|
425
|
+
};
|
|
426
|
+
var FAST_EFFECTS_TRANSITION = {
|
|
427
|
+
duration: 0.15,
|
|
428
|
+
ease: [0.4, 0, 1, 1]
|
|
429
|
+
// FastOutLinearIn
|
|
430
|
+
};
|
|
431
|
+
var MENU_CONTAINER_VARIANTS = {
|
|
432
|
+
hidden: {
|
|
433
|
+
opacity: 0,
|
|
434
|
+
scale: 0.8
|
|
435
|
+
},
|
|
436
|
+
visible: {
|
|
437
|
+
opacity: 1,
|
|
438
|
+
scale: 1,
|
|
439
|
+
transition: FAST_SPATIAL_SPRING
|
|
440
|
+
},
|
|
441
|
+
exit: {
|
|
442
|
+
opacity: 0,
|
|
443
|
+
scale: 0.8,
|
|
444
|
+
transition: FAST_EFFECTS_TRANSITION
|
|
445
|
+
}
|
|
446
|
+
};
|
|
447
|
+
var MENU_CHECK_ICON_SIZE = 20;
|
|
448
|
+
var CHECK_ICON_VARIANTS = {
|
|
449
|
+
hidden: {
|
|
450
|
+
opacity: 0,
|
|
451
|
+
width: 0
|
|
452
|
+
},
|
|
453
|
+
visible: {
|
|
454
|
+
opacity: 1,
|
|
455
|
+
width: MENU_CHECK_ICON_SIZE,
|
|
456
|
+
transition: FAST_SPATIAL_SPRING
|
|
457
|
+
},
|
|
458
|
+
exit: {
|
|
459
|
+
opacity: 0,
|
|
460
|
+
width: 0,
|
|
461
|
+
transition: FAST_EFFECTS_TRANSITION
|
|
462
|
+
}
|
|
463
|
+
};
|
|
464
|
+
var SUBMENU_CONTAINER_VARIANTS = {
|
|
465
|
+
hidden: {
|
|
466
|
+
opacity: 0,
|
|
467
|
+
scale: 0.9,
|
|
468
|
+
x: -4
|
|
469
|
+
},
|
|
470
|
+
visible: {
|
|
471
|
+
opacity: 1,
|
|
472
|
+
scale: 1,
|
|
473
|
+
x: 0,
|
|
474
|
+
transition: FAST_SPATIAL_SPRING
|
|
475
|
+
},
|
|
476
|
+
exit: {
|
|
477
|
+
opacity: 0,
|
|
478
|
+
scale: 0.9,
|
|
479
|
+
x: -4,
|
|
480
|
+
transition: FAST_EFFECTS_TRANSITION
|
|
481
|
+
}
|
|
482
|
+
};
|
|
483
|
+
var MenuContext = React38.createContext({
|
|
484
|
+
variant: "baseline",
|
|
485
|
+
colorVariant: "standard",
|
|
486
|
+
menuPrimitive: "dropdown",
|
|
487
|
+
open: false,
|
|
488
|
+
onOpenChange: () => {
|
|
489
|
+
}
|
|
490
|
+
});
|
|
491
|
+
function MenuProvider({
|
|
492
|
+
variant = "baseline",
|
|
493
|
+
colorVariant = "standard",
|
|
494
|
+
menuPrimitive = "dropdown",
|
|
495
|
+
open,
|
|
496
|
+
onOpenChange,
|
|
497
|
+
children
|
|
498
|
+
}) {
|
|
499
|
+
const value = React38.useMemo(
|
|
500
|
+
() => ({ variant, colorVariant, menuPrimitive, open, onOpenChange }),
|
|
501
|
+
[variant, colorVariant, menuPrimitive, open, onOpenChange]
|
|
502
|
+
);
|
|
503
|
+
return /* @__PURE__ */ jsx(MenuContext.Provider, { value, children });
|
|
504
|
+
}
|
|
505
|
+
function useMenuContext() {
|
|
506
|
+
const ctx = React38.useContext(MenuContext);
|
|
507
|
+
return React38.useMemo(
|
|
508
|
+
() => __spreadProps(__spreadValues({}, ctx), {
|
|
509
|
+
isStatic: ctx.menuPrimitive === "static",
|
|
510
|
+
menuVariant: ctx.variant
|
|
511
|
+
}),
|
|
512
|
+
[ctx]
|
|
513
|
+
);
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
// src/ui/menu/menu-tokens.ts
|
|
517
|
+
var MENU_BASELINE_ITEM_HORIZONTAL_PADDING = "px-3";
|
|
518
|
+
var MENU_ITEM_MIN_HEIGHT = "min-h-11";
|
|
519
|
+
var MENU_MIN_WIDTH = "min-w-28";
|
|
520
|
+
var MENU_MAX_WIDTH = "max-w-70";
|
|
521
|
+
var MENU_GROUP_GAP = "gap-0.5";
|
|
522
|
+
var MENU_GROUP_PADDING_Y = "py-1";
|
|
523
|
+
var MENU_POPUP_PADDING_Y = "py-2";
|
|
524
|
+
var MENU_ICON_SIZE = 20;
|
|
525
|
+
var MENU_CONTAINER_SHAPE = "rounded-[4px]";
|
|
526
|
+
var BASELINE_ITEM_SHAPE = "rounded-none";
|
|
527
|
+
var GROUP_SHAPES = {
|
|
528
|
+
/** Active standalone group shape: CornerLarge all corners (16px) */
|
|
529
|
+
standaloneActive: "16px",
|
|
530
|
+
/**
|
|
531
|
+
* Active leading group shape: top=CornerLarge(16px), bottom=CornerSmall(8px)
|
|
532
|
+
* Source: SegmentedMenuTokens — LeadingContainerShape:
|
|
533
|
+
* topStart=CornerLarge, topEnd=CornerLarge, bottomStart=CornerSmall, bottomEnd=CornerSmall
|
|
534
|
+
*/
|
|
535
|
+
leadingActive: "16px 16px 8px 8px",
|
|
536
|
+
/** Active middle group shape: CornerExtraSmall all corners (4px) */
|
|
537
|
+
middleActive: "4px",
|
|
538
|
+
/**
|
|
539
|
+
* Active trailing group shape: top=CornerSmall(8px), bottom=CornerLarge(16px)
|
|
540
|
+
* Source: SegmentedMenuTokens — TrailingContainerShape:
|
|
541
|
+
* topStart=CornerSmall, topEnd=CornerSmall, bottomStart=CornerLarge, bottomEnd=CornerLarge
|
|
542
|
+
*/
|
|
543
|
+
trailingActive: "8px 8px 16px 16px",
|
|
544
|
+
/** Inactive (default, pre-hover) shape for all groups: CornerExtraSmall (4px) */
|
|
545
|
+
inactive: "4px"
|
|
546
|
+
};
|
|
547
|
+
var ITEM_SHAPE_CLASSES = {
|
|
548
|
+
leading: "rounded-t-[12px] rounded-b-[4px]",
|
|
549
|
+
middle: "rounded-[4px]",
|
|
550
|
+
trailing: "rounded-t-[4px] rounded-b-[12px]",
|
|
551
|
+
standalone: "rounded-[4px]",
|
|
552
|
+
selected: "rounded-[12px]"
|
|
553
|
+
};
|
|
554
|
+
var STANDARD_COLORS = {
|
|
555
|
+
/** Group/popup container background (StandardMenuTokens.ContainerColor) */
|
|
556
|
+
containerBg: "bg-m3-surface-container-low",
|
|
557
|
+
/** Label text color (StandardMenuTokens.ItemLabelTextColor) */
|
|
558
|
+
labelText: "text-m3-on-surface",
|
|
559
|
+
/** Leading/trailing icon color (StandardMenuTokens.ItemLeadingIconColor) */
|
|
560
|
+
iconColor: "text-m3-on-surface-variant",
|
|
561
|
+
/** Supporting text below label (StandardMenuTokens.ItemSupportingTextColor) */
|
|
562
|
+
supportingTextColor: "text-m3-on-surface-variant",
|
|
563
|
+
/** Trailing supporting text (StandardMenuTokens.ItemTrailingSupportingTextColor) */
|
|
564
|
+
trailingSupportingTextColor: "text-m3-on-surface-variant",
|
|
565
|
+
/** Trailing icon color (StandardMenuTokens.ItemTrailingIconColor) */
|
|
566
|
+
trailingIconColor: "text-m3-on-surface-variant",
|
|
567
|
+
/** Hover state layer (OnSurface @ 8% opacity) */
|
|
568
|
+
hoverLayer: "hover:bg-m3-on-surface/8",
|
|
569
|
+
/** Focus state layer (OnSurface @ 12% opacity) */
|
|
570
|
+
focusLayer: "focus:bg-m3-on-surface/12",
|
|
571
|
+
/** Selected item background (StandardMenuTokens.ItemSelectedContainerColor) */
|
|
572
|
+
selectedBg: "bg-m3-tertiary-container",
|
|
573
|
+
/** Selected item text (StandardMenuTokens.ItemSelectedLabelTextColor) */
|
|
574
|
+
selectedText: "text-m3-on-tertiary-container",
|
|
575
|
+
/** Selected item icon (StandardMenuTokens.ItemSelectedLeadingIconColor) */
|
|
576
|
+
selectedIcon: "text-m3-on-tertiary-container",
|
|
577
|
+
/** Disabled opacity: 38% (StandardMenuTokens.ItemDisabledLabelTextOpacity) */
|
|
578
|
+
disabledOpacity: "data-disabled:opacity-[0.38]"
|
|
579
|
+
};
|
|
580
|
+
var BASELINE_COLORS = {
|
|
581
|
+
containerBg: "bg-m3-surface-container",
|
|
582
|
+
labelText: "text-m3-on-surface",
|
|
583
|
+
iconColor: "text-m3-on-surface-variant",
|
|
584
|
+
supportingTextColor: "text-m3-on-surface-variant",
|
|
585
|
+
trailingIconColor: "text-m3-on-surface-variant",
|
|
586
|
+
hoverLayer: "hover:bg-m3-on-surface/8",
|
|
587
|
+
focusLayer: "focus:bg-m3-on-surface/12",
|
|
588
|
+
selectedBg: "bg-m3-secondary-container",
|
|
589
|
+
selectedText: "text-m3-on-secondary-container",
|
|
590
|
+
selectedIcon: "text-m3-on-secondary-container"};
|
|
591
|
+
var VIBRANT_COLORS = {
|
|
592
|
+
/** Group/popup container background (VibrantMenuTokens.ContainerColor) */
|
|
593
|
+
containerBg: "bg-m3-tertiary-container",
|
|
594
|
+
/** Label text color (VibrantMenuTokens.ItemLabelTextColor) */
|
|
595
|
+
labelText: "text-m3-on-tertiary-container",
|
|
596
|
+
/** Leading/trailing icon color (VibrantMenuTokens.ItemLeadingIconColor) */
|
|
597
|
+
iconColor: "text-m3-on-tertiary-container",
|
|
598
|
+
/** Supporting text below label (VibrantMenuTokens.ItemSupportingTextColor) */
|
|
599
|
+
supportingTextColor: "text-m3-on-tertiary-container",
|
|
600
|
+
/** Trailing supporting text (VibrantMenuTokens.ItemTrailingSupportingTextColor) */
|
|
601
|
+
trailingSupportingTextColor: "text-m3-on-tertiary-container",
|
|
602
|
+
/** Trailing icon color (VibrantMenuTokens.ItemTrailingIconColor) */
|
|
603
|
+
trailingIconColor: "text-m3-on-tertiary-container",
|
|
604
|
+
/** Hover state layer (OnTertiaryContainer @ 8% opacity) */
|
|
605
|
+
hoverLayer: "hover:bg-m3-on-tertiary-container/8",
|
|
606
|
+
/** Focus state layer (OnTertiaryContainer @ 12% opacity) */
|
|
607
|
+
focusLayer: "focus:bg-m3-on-tertiary-container/12",
|
|
608
|
+
/** Selected item background (VibrantMenuTokens.ItemSelectedContainerColor = Tertiary) */
|
|
609
|
+
selectedBg: "bg-m3-tertiary",
|
|
610
|
+
/** Selected item text (VibrantMenuTokens.ItemSelectedLabelTextColor = OnTertiary) */
|
|
611
|
+
selectedText: "text-m3-on-tertiary",
|
|
612
|
+
/** Selected item icon (VibrantMenuTokens.ItemSelectedLeadingIconColor = OnTertiary) */
|
|
613
|
+
selectedIcon: "text-m3-on-tertiary",
|
|
614
|
+
/** Disabled opacity: 38% (VibrantMenuTokens.ItemDisabledLabelTextOpacity) */
|
|
615
|
+
disabledOpacity: "data-disabled:opacity-[0.38]"
|
|
616
|
+
};
|
|
617
|
+
var DIVIDER_PADDING = "mx-3 my-0.5";
|
|
618
|
+
var DIVIDER_COLOR = "bg-m3-outline-variant";
|
|
619
|
+
function ContextMenu({
|
|
620
|
+
children,
|
|
621
|
+
variant = "baseline",
|
|
622
|
+
colorVariant = "standard"
|
|
623
|
+
}) {
|
|
624
|
+
const [open, setOpen] = React38.useState(false);
|
|
625
|
+
return /* @__PURE__ */ jsx(
|
|
626
|
+
MenuProvider,
|
|
627
|
+
{
|
|
628
|
+
variant,
|
|
629
|
+
colorVariant,
|
|
630
|
+
menuPrimitive: "context",
|
|
631
|
+
open,
|
|
632
|
+
onOpenChange: setOpen,
|
|
633
|
+
children: /* @__PURE__ */ jsx(RxContextMenu.Root, { onOpenChange: setOpen, children })
|
|
634
|
+
}
|
|
635
|
+
);
|
|
636
|
+
}
|
|
637
|
+
ContextMenu.displayName = "ContextMenu";
|
|
638
|
+
var ContextMenuTrigger = React38.forwardRef((_a, ref) => {
|
|
639
|
+
var _b = _a, { children, asChild = true } = _b, props = __objRest(_b, ["children", "asChild"]);
|
|
640
|
+
return /* @__PURE__ */ jsx(RxContextMenu.Trigger, __spreadProps(__spreadValues({ ref, asChild }, props), { children }));
|
|
641
|
+
});
|
|
642
|
+
ContextMenuTrigger.displayName = "ContextMenuTrigger";
|
|
643
|
+
var ContextMenuContent = React38.forwardRef(
|
|
644
|
+
(_a, ref) => {
|
|
645
|
+
var _b = _a, {
|
|
646
|
+
children,
|
|
647
|
+
hasOverflow = false,
|
|
648
|
+
colorVariant: propColorVariant,
|
|
649
|
+
separatorStyle = "gap",
|
|
650
|
+
className
|
|
651
|
+
} = _b, props = __objRest(_b, [
|
|
652
|
+
"children",
|
|
653
|
+
"hasOverflow",
|
|
654
|
+
"colorVariant",
|
|
655
|
+
"separatorStyle",
|
|
656
|
+
"className"
|
|
657
|
+
]);
|
|
658
|
+
const {
|
|
659
|
+
open,
|
|
660
|
+
variant,
|
|
661
|
+
colorVariant: contextColorVariant
|
|
662
|
+
} = useMenuContext();
|
|
663
|
+
const colorVariant = propColorVariant != null ? propColorVariant : contextColorVariant;
|
|
664
|
+
const colors = variant === "baseline" ? BASELINE_COLORS : colorVariant === "vibrant" ? VIBRANT_COLORS : STANDARD_COLORS;
|
|
665
|
+
const isExpressiveGap = variant === "expressive" && separatorStyle === "gap";
|
|
666
|
+
const containerClassName = variant === "expressive" ? cn(
|
|
667
|
+
"z-50 flex flex-col w-full",
|
|
668
|
+
MENU_MIN_WIDTH,
|
|
669
|
+
MENU_MAX_WIDTH,
|
|
670
|
+
isExpressiveGap ? MENU_GROUP_GAP : "",
|
|
671
|
+
isExpressiveGap ? "bg-transparent" : colors.containerBg,
|
|
672
|
+
isExpressiveGap ? "" : "rounded-2xl",
|
|
673
|
+
isExpressiveGap ? "" : "elevation-2",
|
|
674
|
+
hasOverflow || isExpressiveGap ? "overflow-visible" : "overflow-hidden",
|
|
675
|
+
"outline-none",
|
|
676
|
+
className
|
|
677
|
+
) : cn(
|
|
678
|
+
"z-50 flex flex-col",
|
|
679
|
+
MENU_MIN_WIDTH,
|
|
680
|
+
MENU_MAX_WIDTH,
|
|
681
|
+
MENU_POPUP_PADDING_Y,
|
|
682
|
+
MENU_GROUP_GAP,
|
|
683
|
+
colors.containerBg,
|
|
684
|
+
MENU_CONTAINER_SHAPE,
|
|
685
|
+
"elevation-2",
|
|
686
|
+
hasOverflow ? "overflow-visible" : "overflow-hidden",
|
|
687
|
+
"outline-none",
|
|
688
|
+
className
|
|
689
|
+
);
|
|
690
|
+
const flattenChildren = (nodes) => {
|
|
691
|
+
return React38.Children.toArray(nodes).reduce(
|
|
692
|
+
(acc, child) => {
|
|
693
|
+
if (React38.isValidElement(child)) {
|
|
694
|
+
if (child.type === React38.Fragment) {
|
|
695
|
+
return acc.concat(
|
|
696
|
+
flattenChildren(
|
|
697
|
+
child.props.children
|
|
698
|
+
)
|
|
699
|
+
);
|
|
700
|
+
}
|
|
701
|
+
acc.push(child);
|
|
702
|
+
}
|
|
703
|
+
return acc;
|
|
704
|
+
},
|
|
705
|
+
[]
|
|
706
|
+
);
|
|
707
|
+
};
|
|
708
|
+
let renderedChildren = children;
|
|
709
|
+
if (variant === "expressive") {
|
|
710
|
+
const validChildren = flattenChildren(children);
|
|
711
|
+
const groupCount = validChildren.length;
|
|
712
|
+
const enhancedChildren = validChildren.map(
|
|
713
|
+
(child, i) => React38.cloneElement(
|
|
714
|
+
child,
|
|
715
|
+
{
|
|
716
|
+
index: i,
|
|
717
|
+
count: groupCount,
|
|
718
|
+
isGapVariant: isExpressiveGap
|
|
719
|
+
}
|
|
720
|
+
)
|
|
721
|
+
);
|
|
722
|
+
renderedChildren = separatorStyle === "divider" ? enhancedChildren.reduce((acc, child, i) => {
|
|
723
|
+
if (i > 0) {
|
|
724
|
+
acc.push(
|
|
725
|
+
/* @__PURE__ */ jsx(
|
|
726
|
+
"hr",
|
|
727
|
+
{
|
|
728
|
+
className: cn(
|
|
729
|
+
"mx-3 my-0.5 h-px border-0 bg-m3-outline-variant"
|
|
730
|
+
)
|
|
731
|
+
},
|
|
732
|
+
`divider-${child.key || i}`
|
|
733
|
+
)
|
|
734
|
+
);
|
|
735
|
+
}
|
|
736
|
+
acc.push(child);
|
|
737
|
+
return acc;
|
|
738
|
+
}, []) : enhancedChildren;
|
|
739
|
+
}
|
|
740
|
+
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(
|
|
741
|
+
m.div,
|
|
742
|
+
{
|
|
743
|
+
className: containerClassName,
|
|
744
|
+
initial: { opacity: 0, scale: 0.95, y: -4 },
|
|
745
|
+
animate: { opacity: 1, scale: 1, y: 0 },
|
|
746
|
+
exit: { opacity: 0, scale: 0.95, y: -4 },
|
|
747
|
+
transition: FAST_SPATIAL_SPRING,
|
|
748
|
+
style: __spreadProps(__spreadValues({}, props.style), {
|
|
749
|
+
transformOrigin: "var(--radix-context-menu-content-transform-origin)"
|
|
750
|
+
}),
|
|
751
|
+
children: renderedChildren
|
|
752
|
+
}
|
|
753
|
+
) })) }) });
|
|
754
|
+
}
|
|
755
|
+
);
|
|
756
|
+
ContextMenuContent.displayName = "ContextMenuContent";
|
|
757
|
+
function Menu(_a) {
|
|
758
|
+
var _b = _a, {
|
|
759
|
+
children,
|
|
760
|
+
variant,
|
|
761
|
+
menuVariant,
|
|
762
|
+
colorVariant = "standard",
|
|
763
|
+
open: controlledOpen,
|
|
764
|
+
onOpenChange: controlledOnOpenChange,
|
|
765
|
+
defaultOpen
|
|
766
|
+
} = _b, props = __objRest(_b, [
|
|
767
|
+
"children",
|
|
768
|
+
"variant",
|
|
769
|
+
"menuVariant",
|
|
770
|
+
"colorVariant",
|
|
771
|
+
"open",
|
|
772
|
+
"onOpenChange",
|
|
773
|
+
"defaultOpen"
|
|
774
|
+
]);
|
|
775
|
+
var _a2;
|
|
776
|
+
const resolvedVariant = (_a2 = variant != null ? variant : menuVariant) != null ? _a2 : "baseline";
|
|
777
|
+
const [internalOpen, setInternalOpen] = React38.useState(
|
|
778
|
+
() => defaultOpen != null ? defaultOpen : false
|
|
779
|
+
);
|
|
780
|
+
const isControlled = controlledOpen !== void 0;
|
|
781
|
+
const open = isControlled ? controlledOpen : internalOpen;
|
|
782
|
+
const handleOpenChange = React38.useCallback(
|
|
783
|
+
(next) => {
|
|
784
|
+
if (!isControlled) setInternalOpen(next);
|
|
785
|
+
controlledOnOpenChange == null ? void 0 : controlledOnOpenChange(next);
|
|
786
|
+
},
|
|
787
|
+
[isControlled, controlledOnOpenChange]
|
|
788
|
+
);
|
|
789
|
+
return /* @__PURE__ */ jsx(
|
|
790
|
+
MenuProvider,
|
|
791
|
+
{
|
|
792
|
+
variant: resolvedVariant,
|
|
793
|
+
colorVariant,
|
|
794
|
+
open,
|
|
795
|
+
onOpenChange: handleOpenChange,
|
|
796
|
+
children: /* @__PURE__ */ jsx(
|
|
797
|
+
DropdownMenu.Root,
|
|
798
|
+
__spreadProps(__spreadValues({}, props), {
|
|
799
|
+
defaultOpen,
|
|
800
|
+
open: isControlled ? open : void 0,
|
|
801
|
+
onOpenChange: handleOpenChange,
|
|
802
|
+
children
|
|
803
|
+
})
|
|
804
|
+
)
|
|
805
|
+
}
|
|
806
|
+
);
|
|
807
|
+
}
|
|
808
|
+
Menu.displayName = "Menu";
|
|
809
|
+
var MenuTrigger = React38.forwardRef((_a, ref) => {
|
|
810
|
+
var _b = _a, { children, asChild = true } = _b, props = __objRest(_b, ["children", "asChild"]);
|
|
811
|
+
return /* @__PURE__ */ jsx(DropdownMenu.Trigger, __spreadProps(__spreadValues({ ref, asChild }, props), { children }));
|
|
812
|
+
});
|
|
813
|
+
MenuTrigger.displayName = "MenuTrigger";
|
|
814
|
+
var MenuContent = React38.forwardRef(
|
|
815
|
+
(_a, ref) => {
|
|
816
|
+
var _b = _a, {
|
|
817
|
+
children,
|
|
818
|
+
sideOffset = 6,
|
|
819
|
+
side = "bottom",
|
|
820
|
+
align = "start",
|
|
821
|
+
hasOverflow = false,
|
|
822
|
+
colorVariant: propColorVariant,
|
|
823
|
+
separatorStyle = "gap",
|
|
824
|
+
className
|
|
825
|
+
} = _b, props = __objRest(_b, [
|
|
826
|
+
"children",
|
|
827
|
+
"sideOffset",
|
|
828
|
+
"side",
|
|
829
|
+
"align",
|
|
830
|
+
"hasOverflow",
|
|
831
|
+
"colorVariant",
|
|
832
|
+
"separatorStyle",
|
|
833
|
+
"className"
|
|
834
|
+
]);
|
|
835
|
+
const {
|
|
836
|
+
open,
|
|
837
|
+
variant,
|
|
838
|
+
colorVariant: contextColorVariant
|
|
839
|
+
} = useMenuContext();
|
|
840
|
+
const colorVariant = propColorVariant != null ? propColorVariant : contextColorVariant;
|
|
841
|
+
const colors = variant === "baseline" ? BASELINE_COLORS : colorVariant === "vibrant" ? VIBRANT_COLORS : STANDARD_COLORS;
|
|
842
|
+
const isExpressiveGap = variant === "expressive" && separatorStyle === "gap";
|
|
843
|
+
const containerClassName = variant === "expressive" ? cn(
|
|
844
|
+
"z-50 flex flex-col",
|
|
845
|
+
MENU_MIN_WIDTH,
|
|
846
|
+
MENU_MAX_WIDTH,
|
|
847
|
+
isExpressiveGap ? MENU_GROUP_GAP : "",
|
|
848
|
+
isExpressiveGap ? "bg-transparent" : colors.containerBg,
|
|
849
|
+
isExpressiveGap ? "" : "rounded-2xl",
|
|
850
|
+
isExpressiveGap ? "" : "elevation-2",
|
|
851
|
+
hasOverflow || isExpressiveGap ? "overflow-visible" : "overflow-hidden",
|
|
852
|
+
"outline-none",
|
|
853
|
+
className
|
|
854
|
+
) : cn(
|
|
855
|
+
"z-50 flex flex-col",
|
|
856
|
+
MENU_MIN_WIDTH,
|
|
857
|
+
MENU_MAX_WIDTH,
|
|
858
|
+
MENU_POPUP_PADDING_Y,
|
|
859
|
+
MENU_GROUP_GAP,
|
|
860
|
+
colors.containerBg,
|
|
861
|
+
MENU_CONTAINER_SHAPE,
|
|
862
|
+
"elevation-2",
|
|
863
|
+
hasOverflow ? "overflow-visible" : "overflow-hidden",
|
|
864
|
+
"outline-none",
|
|
865
|
+
className
|
|
866
|
+
);
|
|
867
|
+
const flattenChildren = (nodes) => {
|
|
868
|
+
return React38.Children.toArray(nodes).reduce(
|
|
869
|
+
(acc, child) => {
|
|
870
|
+
if (React38.isValidElement(child)) {
|
|
871
|
+
if (child.type === React38.Fragment) {
|
|
872
|
+
return acc.concat(
|
|
873
|
+
flattenChildren(
|
|
874
|
+
child.props.children
|
|
875
|
+
)
|
|
876
|
+
);
|
|
877
|
+
}
|
|
878
|
+
acc.push(child);
|
|
879
|
+
}
|
|
880
|
+
return acc;
|
|
881
|
+
},
|
|
882
|
+
[]
|
|
883
|
+
);
|
|
884
|
+
};
|
|
885
|
+
let renderedChildren = children;
|
|
886
|
+
if (variant === "expressive") {
|
|
887
|
+
const validChildren = flattenChildren(children);
|
|
888
|
+
const groupCount = validChildren.length;
|
|
889
|
+
const enhancedChildren = validChildren.map(
|
|
890
|
+
(child, i) => React38.cloneElement(child, {
|
|
891
|
+
index: i,
|
|
892
|
+
count: groupCount,
|
|
893
|
+
isGapVariant: isExpressiveGap
|
|
894
|
+
})
|
|
895
|
+
);
|
|
896
|
+
renderedChildren = separatorStyle === "divider" ? enhancedChildren.reduce((acc, child, i) => {
|
|
897
|
+
if (i > 0) {
|
|
898
|
+
acc.push(
|
|
899
|
+
/* @__PURE__ */ jsx(
|
|
900
|
+
"hr",
|
|
901
|
+
{
|
|
902
|
+
className: cn(
|
|
903
|
+
"mx-3 my-0.5 h-px border-0 bg-m3-outline-variant"
|
|
904
|
+
)
|
|
905
|
+
},
|
|
906
|
+
`divider-${child.key || i}`
|
|
907
|
+
)
|
|
908
|
+
);
|
|
909
|
+
}
|
|
910
|
+
acc.push(child);
|
|
911
|
+
return acc;
|
|
912
|
+
}, []) : enhancedChildren;
|
|
913
|
+
}
|
|
914
|
+
return /* @__PURE__ */ jsx(AnimatePresence, { children: open && /* @__PURE__ */ jsx(DropdownMenu.Portal, { forceMount: true, children: /* @__PURE__ */ jsx(
|
|
915
|
+
DropdownMenu.Content,
|
|
916
|
+
__spreadProps(__spreadValues({
|
|
917
|
+
ref,
|
|
918
|
+
sideOffset,
|
|
919
|
+
side,
|
|
920
|
+
align,
|
|
921
|
+
asChild: true,
|
|
922
|
+
forceMount: true
|
|
923
|
+
}, props), {
|
|
924
|
+
children: /* @__PURE__ */ jsx(
|
|
925
|
+
m.div,
|
|
926
|
+
{
|
|
927
|
+
role: "menu",
|
|
928
|
+
"aria-orientation": "vertical",
|
|
929
|
+
className: containerClassName,
|
|
930
|
+
variants: MENU_CONTAINER_VARIANTS,
|
|
931
|
+
initial: "hidden",
|
|
932
|
+
animate: "visible",
|
|
933
|
+
exit: "exit",
|
|
934
|
+
style: __spreadProps(__spreadValues({}, props.style), {
|
|
935
|
+
transformOrigin: "var(--radix-dropdown-menu-content-transform-origin)"
|
|
936
|
+
}),
|
|
937
|
+
children: renderedChildren
|
|
938
|
+
}
|
|
939
|
+
)
|
|
940
|
+
})
|
|
941
|
+
) }) });
|
|
942
|
+
}
|
|
943
|
+
);
|
|
944
|
+
MenuContent.displayName = "MenuContent";
|
|
945
|
+
var MenuDivider = React38.forwardRef(
|
|
946
|
+
(_a, ref) => {
|
|
947
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
948
|
+
const { menuVariant } = useMenuContext();
|
|
949
|
+
return /* @__PURE__ */ jsx(DropdownMenu.Separator, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
950
|
+
"hr",
|
|
951
|
+
__spreadValues({
|
|
952
|
+
ref,
|
|
953
|
+
className: cn(
|
|
954
|
+
// Baseline: 8dp vertical margin, 0 horizontal. Expressive: 12dp horizontal, 2dp vertical
|
|
955
|
+
menuVariant === "baseline" ? "my-2 mx-0" : "mx-3 my-0.5",
|
|
956
|
+
// 1px height line
|
|
957
|
+
"h-px border-0",
|
|
958
|
+
// outline-variant color
|
|
959
|
+
"bg-m3-outline-variant",
|
|
960
|
+
className
|
|
961
|
+
)
|
|
962
|
+
}, props)
|
|
963
|
+
) });
|
|
964
|
+
}
|
|
965
|
+
);
|
|
966
|
+
MenuDivider.displayName = "MenuDivider";
|
|
967
|
+
function getGroupPosition(index, count) {
|
|
968
|
+
if (count === 1) return "standalone";
|
|
969
|
+
if (index === 0) return "leading";
|
|
970
|
+
if (index === count - 1) return "trailing";
|
|
971
|
+
return "middle";
|
|
972
|
+
}
|
|
973
|
+
function getGroupActiveShape(position) {
|
|
974
|
+
return GROUP_SHAPES[`${position}Active`];
|
|
975
|
+
}
|
|
976
|
+
var MenuGroup = React38.forwardRef(
|
|
977
|
+
(_a, ref) => {
|
|
978
|
+
var _b = _a, {
|
|
979
|
+
children,
|
|
980
|
+
label,
|
|
981
|
+
index = 0,
|
|
982
|
+
count = 1,
|
|
983
|
+
colorVariant: propColorVariant,
|
|
984
|
+
isGapVariant,
|
|
985
|
+
itemPosition,
|
|
986
|
+
className
|
|
987
|
+
} = _b, rest = __objRest(_b, [
|
|
988
|
+
"children",
|
|
989
|
+
"label",
|
|
990
|
+
"index",
|
|
991
|
+
"count",
|
|
992
|
+
"colorVariant",
|
|
993
|
+
"isGapVariant",
|
|
994
|
+
"itemPosition",
|
|
995
|
+
"className"
|
|
996
|
+
]);
|
|
997
|
+
const {
|
|
998
|
+
menuVariant,
|
|
999
|
+
colorVariant: contextColorVariant,
|
|
1000
|
+
isStatic
|
|
1001
|
+
} = useMenuContext();
|
|
1002
|
+
const colorVariant = propColorVariant != null ? propColorVariant : contextColorVariant;
|
|
1003
|
+
const colors = menuVariant === "baseline" ? BASELINE_COLORS : colorVariant === "vibrant" ? VIBRANT_COLORS : STANDARD_COLORS;
|
|
1004
|
+
const position = getGroupPosition(index, count);
|
|
1005
|
+
const activeShape = getGroupActiveShape(position);
|
|
1006
|
+
const [isHovered, setIsHovered] = React38.useState(false);
|
|
1007
|
+
const currentShape = isStatic || isHovered ? activeShape : GROUP_SHAPES.inactive;
|
|
1008
|
+
const handlePointerEnter = React38.useCallback(() => setIsHovered(true), []);
|
|
1009
|
+
const handlePointerLeave = React38.useCallback(() => setIsHovered(false), []);
|
|
1010
|
+
const flattenChildren = (children2) => {
|
|
1011
|
+
return React38.Children.toArray(children2).reduce(
|
|
1012
|
+
(acc, child) => {
|
|
1013
|
+
if (React38.isValidElement(child)) {
|
|
1014
|
+
if (child.type === React38.Fragment) {
|
|
1015
|
+
return acc.concat(
|
|
1016
|
+
flattenChildren(
|
|
1017
|
+
child.props.children
|
|
1018
|
+
)
|
|
1019
|
+
);
|
|
1020
|
+
}
|
|
1021
|
+
acc.push(child);
|
|
1022
|
+
}
|
|
1023
|
+
return acc;
|
|
1024
|
+
},
|
|
1025
|
+
[]
|
|
1026
|
+
);
|
|
1027
|
+
};
|
|
1028
|
+
const validChildren = flattenChildren(children);
|
|
1029
|
+
const itemCount = validChildren.length;
|
|
1030
|
+
const enhancedChildren = validChildren.map((child, i) => {
|
|
1031
|
+
const itemPosition2 = itemCount === 1 ? "standalone" : i === 0 ? "leading" : i === itemCount - 1 ? "trailing" : "middle";
|
|
1032
|
+
return React38.cloneElement(child, {
|
|
1033
|
+
itemPosition: itemPosition2,
|
|
1034
|
+
colorVariant
|
|
1035
|
+
});
|
|
1036
|
+
});
|
|
1037
|
+
return /* @__PURE__ */ jsxs(
|
|
1038
|
+
m.div,
|
|
1039
|
+
__spreadProps(__spreadValues({
|
|
1040
|
+
ref,
|
|
1041
|
+
role: "group",
|
|
1042
|
+
"aria-label": label,
|
|
1043
|
+
className: cn(
|
|
1044
|
+
"relative",
|
|
1045
|
+
// In baseline variant, MenuGroup is transparent so it shouldn't clip.
|
|
1046
|
+
// In expressive variant, it needs overflow-hidden to clip hover states to its morphing shape.
|
|
1047
|
+
menuVariant === "baseline" ? "" : "overflow-hidden",
|
|
1048
|
+
// Vertical padding: 2dp for gap variant (to match Figma), 4dp for baseline
|
|
1049
|
+
isGapVariant ? "py-0.5" : MENU_GROUP_PADDING_Y,
|
|
1050
|
+
// Horizontal padding: 4dp for expressive menus (both static and popup), 0 for baseline
|
|
1051
|
+
menuVariant === "expressive" ? "px-1" : "",
|
|
1052
|
+
// Gap variant has floating segments, so each group manages its own shadow
|
|
1053
|
+
isGapVariant ? "elevation-2" : "",
|
|
1054
|
+
// Background based on color variant (transparent for baseline to avoid double-layering)
|
|
1055
|
+
menuVariant === "baseline" ? "bg-transparent" : colors.containerBg,
|
|
1056
|
+
className
|
|
1057
|
+
),
|
|
1058
|
+
animate: { borderRadius: currentShape },
|
|
1059
|
+
transition: FAST_SPATIAL_SPRING,
|
|
1060
|
+
onPointerEnter: handlePointerEnter,
|
|
1061
|
+
onPointerLeave: handlePointerLeave
|
|
1062
|
+
}, rest), {
|
|
1063
|
+
children: [
|
|
1064
|
+
label && /* @__PURE__ */ jsx(
|
|
1065
|
+
"span",
|
|
1066
|
+
{
|
|
1067
|
+
className: cn(
|
|
1068
|
+
// Padding: 12dp top, 12dp horizontal, 8dp bottom (MD3 spec)
|
|
1069
|
+
"block pt-3 px-3 pb-2",
|
|
1070
|
+
"text-label-small",
|
|
1071
|
+
menuVariant === "baseline" ? "text-m3-on-surface-variant" : colorVariant === "vibrant" ? "text-m3-on-tertiary-container" : "text-m3-on-surface-variant"
|
|
1072
|
+
),
|
|
1073
|
+
children: label
|
|
1074
|
+
}
|
|
1075
|
+
),
|
|
1076
|
+
enhancedChildren
|
|
1077
|
+
]
|
|
1078
|
+
})
|
|
1079
|
+
);
|
|
1080
|
+
}
|
|
1081
|
+
);
|
|
1082
|
+
MenuGroup.displayName = "MenuGroup";
|
|
1083
|
+
|
|
412
1084
|
// src/ui/shared/constants.ts
|
|
413
1085
|
var SPRING_TRANSITION_FAST = {
|
|
414
1086
|
type: "spring",
|
|
@@ -420,6 +1092,11 @@ var SPRING_TRANSITION = {
|
|
|
420
1092
|
bounce: 0,
|
|
421
1093
|
duration: 0.3
|
|
422
1094
|
};
|
|
1095
|
+
var SPRING_TRANSITION_EXPRESSIVE = {
|
|
1096
|
+
type: "spring",
|
|
1097
|
+
bounce: 0.35,
|
|
1098
|
+
duration: 0.4
|
|
1099
|
+
};
|
|
423
1100
|
var ICON_SPAN_VARIANTS = {
|
|
424
1101
|
initial: { scale: 0.01 },
|
|
425
1102
|
animate: { scale: 1 },
|
|
@@ -440,7 +1117,7 @@ var VARIANT_FONT = {
|
|
|
440
1117
|
rounded: "'Material Symbols Rounded'",
|
|
441
1118
|
sharp: "'Material Symbols Sharp'"
|
|
442
1119
|
};
|
|
443
|
-
var IconComponent =
|
|
1120
|
+
var IconComponent = React38.forwardRef(
|
|
444
1121
|
(_a, ref) => {
|
|
445
1122
|
var _b = _a, {
|
|
446
1123
|
name,
|
|
@@ -506,222 +1183,527 @@ var IconComponent = React31.forwardRef(
|
|
|
506
1183
|
}
|
|
507
1184
|
);
|
|
508
1185
|
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
|
-
|
|
1186
|
+
var Icon = React38.memo(IconComponent);
|
|
1187
|
+
function getItemShapeClass(position, selected, isStatic = false, menuVariant = "expressive") {
|
|
1188
|
+
if (menuVariant === "baseline") return BASELINE_ITEM_SHAPE;
|
|
1189
|
+
if (selected) return ITEM_SHAPE_CLASSES.selected;
|
|
1190
|
+
if (isStatic && position === "standalone") return "rounded-[12px]";
|
|
1191
|
+
return ITEM_SHAPE_CLASSES[position];
|
|
1192
|
+
}
|
|
1193
|
+
var MenuItem = React38.forwardRef(
|
|
1194
|
+
(_a, ref) => {
|
|
1195
|
+
var _b = _a, {
|
|
1196
|
+
children,
|
|
1197
|
+
onClick,
|
|
1198
|
+
leadingIcon,
|
|
1199
|
+
trailingIcon,
|
|
1200
|
+
supportingText,
|
|
1201
|
+
trailingText,
|
|
1202
|
+
selected,
|
|
1203
|
+
disabled = false,
|
|
1204
|
+
itemPosition = "standalone",
|
|
1205
|
+
colorVariant: propColorVariant,
|
|
1206
|
+
keepOpen = false,
|
|
1207
|
+
className,
|
|
1208
|
+
isSubTrigger,
|
|
1209
|
+
value,
|
|
1210
|
+
role
|
|
1211
|
+
} = _b, rest = __objRest(_b, [
|
|
1212
|
+
"children",
|
|
1213
|
+
"onClick",
|
|
1214
|
+
"leadingIcon",
|
|
1215
|
+
"trailingIcon",
|
|
1216
|
+
"supportingText",
|
|
1217
|
+
"trailingText",
|
|
1218
|
+
"selected",
|
|
1219
|
+
"disabled",
|
|
1220
|
+
"itemPosition",
|
|
1221
|
+
"colorVariant",
|
|
1222
|
+
"keepOpen",
|
|
1223
|
+
"className",
|
|
1224
|
+
"isSubTrigger",
|
|
1225
|
+
"value",
|
|
1226
|
+
"role"
|
|
1227
|
+
]);
|
|
1228
|
+
const {
|
|
1229
|
+
menuVariant,
|
|
1230
|
+
colorVariant: contextColorVariant,
|
|
1231
|
+
menuPrimitive
|
|
1232
|
+
} = useMenuContext();
|
|
1233
|
+
const colorVariant = propColorVariant != null ? propColorVariant : contextColorVariant;
|
|
1234
|
+
const colors = menuVariant === "baseline" ? BASELINE_COLORS : colorVariant === "vibrant" ? VIBRANT_COLORS : STANDARD_COLORS;
|
|
1235
|
+
const isStaticMenu = menuPrimitive === "static";
|
|
1236
|
+
const shapeClass = getItemShapeClass(
|
|
1237
|
+
itemPosition,
|
|
1238
|
+
!!selected,
|
|
1239
|
+
isStaticMenu,
|
|
1240
|
+
menuVariant
|
|
1241
|
+
);
|
|
1242
|
+
const isSelectable = selected !== void 0 && !isSubTrigger;
|
|
1243
|
+
const isCheckbox = role === "menuitemcheckbox" || selected !== void 0 && !role && !isSubTrigger;
|
|
1244
|
+
const isRadio = role === "menuitemradio";
|
|
1245
|
+
const ItemPrimitive = isStaticMenu || isSubTrigger ? Slot : menuPrimitive === "context" ? isCheckbox ? RxContextMenu.CheckboxItem : isRadio ? RxContextMenu.RadioItem : RxContextMenu.Item : isCheckbox ? DropdownMenu.CheckboxItem : isRadio ? DropdownMenu.RadioItem : DropdownMenu.Item;
|
|
1246
|
+
return /* @__PURE__ */ jsx(
|
|
1247
|
+
ItemPrimitive,
|
|
1248
|
+
__spreadProps(__spreadValues({
|
|
1249
|
+
ref
|
|
1250
|
+
}, isStaticMenu || isSubTrigger ? {
|
|
1251
|
+
role: role || (isCheckbox ? "menuitemcheckbox" : isRadio ? "menuitemradio" : "menuitem"),
|
|
1252
|
+
"aria-checked": isCheckbox || isRadio ? !!selected : void 0,
|
|
1253
|
+
"aria-disabled": disabled ? true : void 0,
|
|
1254
|
+
tabIndex: disabled ? -1 : 0,
|
|
1255
|
+
onKeyDown: (e) => {
|
|
1256
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
1257
|
+
e.preventDefault();
|
|
1258
|
+
onClick == null ? void 0 : onClick(e);
|
|
1259
|
+
}
|
|
1260
|
+
},
|
|
1261
|
+
onClick
|
|
1262
|
+
} : __spreadProps(__spreadValues(__spreadValues({
|
|
1263
|
+
disabled,
|
|
1264
|
+
onSelect: keepOpen ? (e) => e.preventDefault() : void 0,
|
|
1265
|
+
onClick
|
|
1266
|
+
}, isCheckbox || isRadio ? { checked: !!selected } : {}), isRadio ? { value: value != null ? value : "" } : {}), {
|
|
1267
|
+
asChild: true
|
|
1268
|
+
})), {
|
|
1269
|
+
children: /* @__PURE__ */ jsxs(
|
|
1270
|
+
"div",
|
|
1271
|
+
__spreadProps(__spreadValues({
|
|
1272
|
+
className: cn(
|
|
1273
|
+
// Layout
|
|
1274
|
+
"relative flex w-full cursor-pointer select-none items-center outline-none",
|
|
1275
|
+
// Sizing: min-h 48dp, min-w 112dp, max-w 280dp
|
|
1276
|
+
"min-h-12 min-w-28 max-w-70",
|
|
1277
|
+
// Horizontal padding
|
|
1278
|
+
menuVariant === "baseline" ? MENU_BASELINE_ITEM_HORIZONTAL_PADDING : "px-4",
|
|
1279
|
+
// Spacing between items
|
|
1280
|
+
isStaticMenu ? "my-0.5" : "",
|
|
1281
|
+
// Shape morphing (position-based + selected override)
|
|
1282
|
+
shapeClass,
|
|
1283
|
+
// Animate border-radius AND background-color together (FastEffects: 150ms)
|
|
1284
|
+
"transition-[border-radius,background-color] duration-150 ease-in",
|
|
1285
|
+
// Colors based on variant + selection
|
|
1286
|
+
selected ? cn(colors.selectedBg, colors.selectedText) : cn(colors.labelText),
|
|
1287
|
+
// State layers (only on unselected items)
|
|
1288
|
+
!selected && colors.hoverLayer,
|
|
1289
|
+
!selected && colors.focusLayer,
|
|
1290
|
+
// Focus visible ring (WCAG 2.4.11 — visible focus indicator)
|
|
1291
|
+
// Uses ring-inset so the ring doesn't overflow the item bounds.
|
|
1292
|
+
"focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-m3-primary",
|
|
1293
|
+
// Disabled
|
|
1294
|
+
disabled && "pointer-events-none opacity-[0.38]",
|
|
1295
|
+
className
|
|
1296
|
+
)
|
|
1297
|
+
}, rest), {
|
|
1298
|
+
children: [
|
|
1299
|
+
(isSelectable || leadingIcon) && /* @__PURE__ */ jsx(
|
|
1300
|
+
"div",
|
|
1301
|
+
{
|
|
1302
|
+
className: "flex h-5 w-5 shrink-0 items-center justify-center mr-3",
|
|
1303
|
+
"aria-hidden": "true",
|
|
1304
|
+
children: isSelectable ? /* @__PURE__ */ jsx(AnimatePresence, { initial: false, mode: "wait", children: selected ? /* @__PURE__ */ jsx(
|
|
1305
|
+
m.span,
|
|
1306
|
+
{
|
|
1307
|
+
className: cn(
|
|
1308
|
+
"flex h-full w-full items-center justify-center overflow-hidden",
|
|
1309
|
+
colors.selectedIcon
|
|
1310
|
+
),
|
|
1311
|
+
variants: CHECK_ICON_VARIANTS,
|
|
1312
|
+
initial: "hidden",
|
|
1313
|
+
animate: "visible",
|
|
1314
|
+
exit: "exit",
|
|
1315
|
+
children: /* @__PURE__ */ jsx(Icon, { name: "check", fill: 1, size: MENU_CHECK_ICON_SIZE })
|
|
1316
|
+
},
|
|
1317
|
+
"check"
|
|
1318
|
+
) : leadingIcon ? /* @__PURE__ */ jsx(
|
|
1319
|
+
m.span,
|
|
1320
|
+
{
|
|
1321
|
+
className: cn(
|
|
1322
|
+
"flex h-full w-full items-center justify-center overflow-hidden",
|
|
1323
|
+
colors.iconColor
|
|
1324
|
+
),
|
|
1325
|
+
variants: CHECK_ICON_VARIANTS,
|
|
1326
|
+
initial: "hidden",
|
|
1327
|
+
animate: "visible",
|
|
1328
|
+
exit: "exit",
|
|
1329
|
+
children: leadingIcon
|
|
1330
|
+
},
|
|
1331
|
+
"icon"
|
|
1332
|
+
) : (
|
|
1333
|
+
// Spacer for selectable items with no icon, to keep text aligned
|
|
1334
|
+
/* @__PURE__ */ jsx("div", { className: "w-5" })
|
|
1335
|
+
) }) : (
|
|
1336
|
+
// Static icon for non-selectable items
|
|
1337
|
+
/* @__PURE__ */ jsx(
|
|
1338
|
+
"span",
|
|
1339
|
+
{
|
|
1340
|
+
className: cn(
|
|
1341
|
+
"flex h-full w-full items-center justify-center",
|
|
1342
|
+
colors.iconColor
|
|
1343
|
+
),
|
|
1344
|
+
children: leadingIcon
|
|
1345
|
+
}
|
|
1346
|
+
)
|
|
1347
|
+
)
|
|
1348
|
+
}
|
|
1349
|
+
),
|
|
1350
|
+
/* @__PURE__ */ jsxs("span", { className: "flex flex-1 flex-col", children: [
|
|
1351
|
+
/* @__PURE__ */ jsx("span", { className: "text-body-large leading-snug", children }),
|
|
1352
|
+
supportingText && /* @__PURE__ */ jsx(
|
|
1353
|
+
"span",
|
|
1354
|
+
{
|
|
1355
|
+
className: cn(
|
|
1356
|
+
"text-body-medium leading-snug",
|
|
1357
|
+
// Source: StandardMenuTokens.ItemSupportingTextColor / VibrantMenuTokens
|
|
1358
|
+
selected ? colors.selectedText : colors.supportingTextColor
|
|
1359
|
+
),
|
|
1360
|
+
children: supportingText
|
|
1361
|
+
}
|
|
1362
|
+
)
|
|
1363
|
+
] }),
|
|
1364
|
+
(trailingText || trailingIcon) && /* @__PURE__ */ jsx(
|
|
1365
|
+
"span",
|
|
1366
|
+
{
|
|
1367
|
+
className: cn(
|
|
1368
|
+
// Minimum 12dp gap from label column (ListTokens)
|
|
1369
|
+
"ml-3 flex shrink-0 items-center",
|
|
1370
|
+
// Source: StandardMenuTokens.ItemTrailingIconColor / VibrantMenuTokens
|
|
1371
|
+
selected ? colors.selectedText : colors.trailingIconColor
|
|
1372
|
+
),
|
|
1373
|
+
"aria-hidden": trailingIcon ? "true" : void 0,
|
|
1374
|
+
children: trailingText ? /* @__PURE__ */ jsx("span", { className: "text-label-small tracking-wider", children: trailingText }) : trailingIcon
|
|
1375
|
+
}
|
|
1376
|
+
)
|
|
1377
|
+
]
|
|
1378
|
+
})
|
|
1379
|
+
)
|
|
1380
|
+
})
|
|
1381
|
+
);
|
|
1382
|
+
}
|
|
1383
|
+
);
|
|
1384
|
+
MenuItem.displayName = "MenuItem";
|
|
1385
|
+
function SubMenu({
|
|
1386
|
+
children,
|
|
1387
|
+
trigger,
|
|
1388
|
+
side = "right",
|
|
1389
|
+
colorVariant: propColorVariant,
|
|
1390
|
+
hoverOpenDelay = 200,
|
|
1391
|
+
hoverCloseDelay = 300
|
|
1392
|
+
}) {
|
|
1393
|
+
const { colorVariant: contextColorVariant, menuPrimitive } = useMenuContext();
|
|
1394
|
+
const colorVariant = propColorVariant != null ? propColorVariant : contextColorVariant;
|
|
1395
|
+
const [open, setOpen] = React38.useState(false);
|
|
1396
|
+
const openTimerRef = React38.useRef(null);
|
|
1397
|
+
const closeTimerRef = React38.useRef(
|
|
1398
|
+
null
|
|
577
1399
|
);
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
1400
|
+
const clearTimers = React38.useCallback(() => {
|
|
1401
|
+
if (openTimerRef.current) clearTimeout(openTimerRef.current);
|
|
1402
|
+
if (closeTimerRef.current) clearTimeout(closeTimerRef.current);
|
|
1403
|
+
}, []);
|
|
1404
|
+
const handleTriggerPointerEnter = React38.useCallback(() => {
|
|
1405
|
+
clearTimers();
|
|
1406
|
+
openTimerRef.current = setTimeout(() => setOpen(true), hoverOpenDelay);
|
|
1407
|
+
}, [hoverOpenDelay, clearTimers]);
|
|
1408
|
+
const handleTriggerPointerLeave = React38.useCallback(() => {
|
|
1409
|
+
clearTimers();
|
|
1410
|
+
closeTimerRef.current = setTimeout(() => setOpen(false), hoverCloseDelay);
|
|
1411
|
+
}, [hoverCloseDelay, clearTimers]);
|
|
1412
|
+
const handleContentPointerEnter = React38.useCallback(() => {
|
|
1413
|
+
clearTimers();
|
|
1414
|
+
}, [clearTimers]);
|
|
1415
|
+
const handleContentPointerLeave = React38.useCallback(() => {
|
|
1416
|
+
clearTimers();
|
|
1417
|
+
closeTimerRef.current = setTimeout(() => setOpen(false), hoverCloseDelay);
|
|
1418
|
+
}, [hoverCloseDelay, clearTimers]);
|
|
1419
|
+
React38.useEffect(() => () => clearTimers(), [clearTimers]);
|
|
1420
|
+
const Sub3 = menuPrimitive === "context" ? RxContextMenu.Sub : DropdownMenu.Sub;
|
|
1421
|
+
const SubTrigger3 = menuPrimitive === "context" ? RxContextMenu.SubTrigger : DropdownMenu.SubTrigger;
|
|
1422
|
+
const SubContent3 = menuPrimitive === "context" ? RxContextMenu.SubContent : DropdownMenu.SubContent;
|
|
1423
|
+
const Portal7 = menuPrimitive === "context" ? RxContextMenu.Portal : DropdownMenu.Portal;
|
|
1424
|
+
return /* @__PURE__ */ jsxs(Sub3, { open, onOpenChange: setOpen, children: [
|
|
1425
|
+
/* @__PURE__ */ jsx(
|
|
1426
|
+
SubTrigger3,
|
|
1427
|
+
{
|
|
1428
|
+
className: "w-full outline-none",
|
|
1429
|
+
onPointerEnter: handleTriggerPointerEnter,
|
|
1430
|
+
onPointerLeave: handleTriggerPointerLeave,
|
|
1431
|
+
children: React38.isValidElement(trigger) ? React38.cloneElement(trigger, {
|
|
1432
|
+
isSubTrigger: true,
|
|
1433
|
+
// Auto-add chevron if missing
|
|
1434
|
+
trailingIcon: trigger.props.trailingIcon || /* @__PURE__ */ jsx(Icon, { name: "chevron_right", size: 20 })
|
|
1435
|
+
}) : trigger
|
|
1436
|
+
}
|
|
1437
|
+
),
|
|
1438
|
+
/* @__PURE__ */ jsx(AnimatePresence, { children: open && /* @__PURE__ */ jsx(Portal7, { forceMount: true, children: /* @__PURE__ */ jsx(
|
|
1439
|
+
SubContent3,
|
|
1440
|
+
{
|
|
1441
|
+
sideOffset: 4,
|
|
1442
|
+
alignOffset: -4,
|
|
1443
|
+
forceMount: true,
|
|
1444
|
+
className: "outline-none",
|
|
1445
|
+
children: /* @__PURE__ */ jsx(
|
|
1446
|
+
SubMenuContent,
|
|
1447
|
+
{
|
|
1448
|
+
side,
|
|
1449
|
+
colorVariant,
|
|
1450
|
+
onPointerEnter: handleContentPointerEnter,
|
|
1451
|
+
onPointerLeave: handleContentPointerLeave,
|
|
1452
|
+
children
|
|
1453
|
+
}
|
|
1454
|
+
)
|
|
1455
|
+
}
|
|
1456
|
+
) }) })
|
|
1457
|
+
] });
|
|
1458
|
+
}
|
|
1459
|
+
SubMenu.displayName = "SubMenu";
|
|
1460
|
+
function SubMenuContent({
|
|
1461
|
+
children,
|
|
1462
|
+
side,
|
|
1463
|
+
colorVariant: propColorVariant,
|
|
1464
|
+
onPointerEnter,
|
|
1465
|
+
onPointerLeave
|
|
1466
|
+
}) {
|
|
1467
|
+
const { menuVariant, colorVariant: contextColorVariant } = useMenuContext();
|
|
1468
|
+
const colorVariant = propColorVariant != null ? propColorVariant : contextColorVariant;
|
|
1469
|
+
const colors = menuVariant === "baseline" ? BASELINE_COLORS : colorVariant === "vibrant" ? VIBRANT_COLORS : STANDARD_COLORS;
|
|
582
1470
|
return /* @__PURE__ */ jsx(
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
"rounded-lg px-3 py-2 text-sm text-m3-on-surface",
|
|
590
|
-
"outline-none transition-colors duration-150",
|
|
591
|
-
"hover:bg-m3-on-surface/8",
|
|
592
|
-
"focus:bg-m3-on-surface/12",
|
|
593
|
-
"data-disabled:pointer-events-none data-disabled:opacity-38",
|
|
594
|
-
"focus-visible:ring-0",
|
|
595
|
-
// Radix gốc handle ring internally
|
|
596
|
-
inset && "pl-8",
|
|
597
|
-
className
|
|
598
|
-
)
|
|
599
|
-
}, props)
|
|
600
|
-
);
|
|
601
|
-
});
|
|
602
|
-
DropdownMenuItem.displayName = "DropdownMenuItem";
|
|
603
|
-
var DropdownMenuCheckboxItem = React31.forwardRef((_a, ref) => {
|
|
604
|
-
var _b = _a, { className, children, checked } = _b, props = __objRest(_b, ["className", "children", "checked"]);
|
|
605
|
-
return /* @__PURE__ */ jsxs(
|
|
606
|
-
RadixDropdown.CheckboxItem,
|
|
607
|
-
__spreadProps(__spreadValues({
|
|
608
|
-
ref,
|
|
1471
|
+
m.div,
|
|
1472
|
+
{
|
|
1473
|
+
role: "menu",
|
|
1474
|
+
"aria-orientation": "vertical",
|
|
1475
|
+
onPointerEnter,
|
|
1476
|
+
onPointerLeave,
|
|
609
1477
|
className: cn(
|
|
610
|
-
"
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
1478
|
+
"z-50 flex flex-col",
|
|
1479
|
+
// Width constraints
|
|
1480
|
+
MENU_MIN_WIDTH,
|
|
1481
|
+
MENU_MAX_WIDTH,
|
|
1482
|
+
// Vertical padding: 8dp
|
|
1483
|
+
MENU_POPUP_PADDING_Y,
|
|
1484
|
+
// Gap between groups: 2dp
|
|
1485
|
+
MENU_GROUP_GAP,
|
|
1486
|
+
// Container background
|
|
1487
|
+
colors.containerBg,
|
|
1488
|
+
// Container shape: CornerExtraSmall (4px)
|
|
1489
|
+
MENU_CONTAINER_SHAPE,
|
|
1490
|
+
// Elevation-2 shadow
|
|
1491
|
+
"elevation-2",
|
|
1492
|
+
// Overflow clip
|
|
1493
|
+
"overflow-hidden",
|
|
1494
|
+
"outline-none"
|
|
616
1495
|
),
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
}
|
|
626
|
-
DropdownMenuCheckboxItem.displayName = "DropdownMenuCheckboxItem";
|
|
627
|
-
var DropdownMenuRadioItem = React31.forwardRef((_a, ref) => {
|
|
628
|
-
var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
|
|
629
|
-
return /* @__PURE__ */ jsxs(
|
|
630
|
-
RadixDropdown.RadioItem,
|
|
631
|
-
__spreadProps(__spreadValues({
|
|
632
|
-
ref,
|
|
633
|
-
className: cn(
|
|
634
|
-
"relative flex cursor-pointer select-none items-center gap-2",
|
|
635
|
-
"rounded-lg py-2 pl-8 pr-3 text-sm text-m3-on-surface",
|
|
636
|
-
"outline-none transition-colors duration-150",
|
|
637
|
-
"hover:bg-m3-on-surface/8 focus:bg-m3-on-surface/12",
|
|
638
|
-
"data-disabled:pointer-events-none data-disabled:opacity-38",
|
|
639
|
-
className
|
|
640
|
-
)
|
|
641
|
-
}, props), {
|
|
642
|
-
children: [
|
|
643
|
-
/* @__PURE__ */ jsx("span", { className: "absolute left-2 flex h-4 w-4 items-center justify-center", children: /* @__PURE__ */ jsx(RadixDropdown.ItemIndicator, { children: /* @__PURE__ */ jsx(Icon, { name: "circle", fill: 1, size: 8, "aria-hidden": "true" }) }) }),
|
|
644
|
-
children
|
|
645
|
-
]
|
|
646
|
-
})
|
|
647
|
-
);
|
|
648
|
-
});
|
|
649
|
-
DropdownMenuRadioItem.displayName = "DropdownMenuRadioItem";
|
|
650
|
-
var DropdownMenuSeparator = React31.forwardRef((_a, ref) => {
|
|
651
|
-
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
652
|
-
return /* @__PURE__ */ jsx(
|
|
653
|
-
RadixDropdown.Separator,
|
|
654
|
-
__spreadValues({
|
|
655
|
-
ref,
|
|
656
|
-
className: cn("my-1 h-px bg-m3-outline-variant", className)
|
|
657
|
-
}, props)
|
|
1496
|
+
variants: SUBMENU_CONTAINER_VARIANTS,
|
|
1497
|
+
initial: "hidden",
|
|
1498
|
+
animate: "visible",
|
|
1499
|
+
exit: "exit",
|
|
1500
|
+
style: {
|
|
1501
|
+
transformOrigin: side === "right" ? "top left" : "top right"
|
|
1502
|
+
},
|
|
1503
|
+
children
|
|
1504
|
+
}
|
|
658
1505
|
);
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
var
|
|
662
|
-
var _b = _a, { className,
|
|
1506
|
+
}
|
|
1507
|
+
SubMenuContent.displayName = "SubMenuContent";
|
|
1508
|
+
var VerticalMenuDivider = React38.forwardRef((_a, ref) => {
|
|
1509
|
+
var _b = _a, { className, index, count, isGapVariant } = _b, props = __objRest(_b, ["className", "index", "count", "isGapVariant"]);
|
|
663
1510
|
return /* @__PURE__ */ jsx(
|
|
664
|
-
|
|
1511
|
+
"hr",
|
|
665
1512
|
__spreadValues({
|
|
666
1513
|
ref,
|
|
667
1514
|
className: cn(
|
|
668
|
-
|
|
669
|
-
|
|
1515
|
+
// HorizontalDividerPadding: horizontal=12dp, vertical=2dp
|
|
1516
|
+
"mx-3 my-0.5",
|
|
1517
|
+
// 1px height, no default border
|
|
1518
|
+
"h-px border-0",
|
|
1519
|
+
// Source: MenuDefaults.HorizontalDividerPadding / outline-variant
|
|
1520
|
+
"bg-m3-outline-variant",
|
|
670
1521
|
className
|
|
671
1522
|
)
|
|
672
1523
|
}, props)
|
|
673
1524
|
);
|
|
674
1525
|
});
|
|
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
|
-
|
|
1526
|
+
VerticalMenuDivider.displayName = "VerticalMenuDivider";
|
|
1527
|
+
var VerticalMenuGroup = MenuGroup;
|
|
1528
|
+
var VerticalMenuContent = React38.forwardRef(
|
|
1529
|
+
(_a, ref) => {
|
|
1530
|
+
var _b = _a, {
|
|
1531
|
+
children,
|
|
1532
|
+
separatorStyle = "gap",
|
|
1533
|
+
colorVariant: propColorVariant,
|
|
1534
|
+
className
|
|
1535
|
+
} = _b, props = __objRest(_b, [
|
|
1536
|
+
"children",
|
|
1537
|
+
"separatorStyle",
|
|
1538
|
+
"colorVariant",
|
|
1539
|
+
"className"
|
|
1540
|
+
]);
|
|
1541
|
+
const { colorVariant: contextColorVariant } = useMenuContext();
|
|
1542
|
+
const colorVariant = propColorVariant != null ? propColorVariant : contextColorVariant;
|
|
1543
|
+
const colors = colorVariant === "vibrant" ? VIBRANT_COLORS : STANDARD_COLORS;
|
|
1544
|
+
const flattenChildren = (children2) => {
|
|
1545
|
+
return React38.Children.toArray(children2).reduce(
|
|
1546
|
+
(acc, child) => {
|
|
1547
|
+
if (React38.isValidElement(child)) {
|
|
1548
|
+
if (child.type === React38.Fragment) {
|
|
1549
|
+
return acc.concat(
|
|
1550
|
+
flattenChildren(
|
|
1551
|
+
child.props.children
|
|
1552
|
+
)
|
|
1553
|
+
);
|
|
1554
|
+
}
|
|
1555
|
+
acc.push(child);
|
|
701
1556
|
}
|
|
1557
|
+
return acc;
|
|
1558
|
+
},
|
|
1559
|
+
[]
|
|
1560
|
+
);
|
|
1561
|
+
};
|
|
1562
|
+
const validChildren = flattenChildren(children);
|
|
1563
|
+
const groupCount = validChildren.length;
|
|
1564
|
+
const enhancedChildren = validChildren.map(
|
|
1565
|
+
(child, i) => React38.cloneElement(child, {
|
|
1566
|
+
index: i,
|
|
1567
|
+
count: groupCount,
|
|
1568
|
+
isGapVariant: separatorStyle === "gap"
|
|
1569
|
+
})
|
|
1570
|
+
);
|
|
1571
|
+
const renderedChildren = separatorStyle === "divider" ? enhancedChildren.reduce((acc, child, i) => {
|
|
1572
|
+
if (i > 0) {
|
|
1573
|
+
acc.push(
|
|
1574
|
+
/* @__PURE__ */ jsx(
|
|
1575
|
+
VerticalMenuDivider,
|
|
1576
|
+
{},
|
|
1577
|
+
`divider-${child.key || i}`
|
|
1578
|
+
)
|
|
1579
|
+
);
|
|
1580
|
+
}
|
|
1581
|
+
acc.push(child);
|
|
1582
|
+
return acc;
|
|
1583
|
+
}, []) : enhancedChildren;
|
|
1584
|
+
return /* @__PURE__ */ jsx(
|
|
1585
|
+
"div",
|
|
1586
|
+
__spreadProps(__spreadValues({
|
|
1587
|
+
ref,
|
|
1588
|
+
className: cn(
|
|
1589
|
+
"flex flex-col w-full",
|
|
1590
|
+
// Gap variant: transparent background + 2dp gap — page bg shows through gaps.
|
|
1591
|
+
// Divider variant: solid container background behind all groups.
|
|
1592
|
+
separatorStyle === "gap" ? cn("bg-transparent", MENU_GROUP_GAP) : colors.containerBg,
|
|
1593
|
+
className
|
|
702
1594
|
)
|
|
703
|
-
|
|
704
|
-
|
|
1595
|
+
}, props), {
|
|
1596
|
+
children: renderedChildren
|
|
1597
|
+
})
|
|
1598
|
+
);
|
|
1599
|
+
}
|
|
1600
|
+
);
|
|
1601
|
+
VerticalMenuContent.displayName = "VerticalMenuContent";
|
|
1602
|
+
var VerticalMenu = React38.forwardRef((_a, ref) => {
|
|
1603
|
+
var _b = _a, { children, colorVariant = "standard", className } = _b, props = __objRest(_b, ["children", "colorVariant", "className"]);
|
|
1604
|
+
const noop = React38.useCallback(() => {
|
|
1605
|
+
}, []);
|
|
1606
|
+
const colors = colorVariant === "vibrant" ? VIBRANT_COLORS : STANDARD_COLORS;
|
|
1607
|
+
const containerRef = React38.useRef(null);
|
|
1608
|
+
const mergedRef = React38.useCallback(
|
|
1609
|
+
(node) => {
|
|
1610
|
+
containerRef.current = node;
|
|
1611
|
+
if (typeof ref === "function") ref(node);
|
|
1612
|
+
else if (ref)
|
|
1613
|
+
ref.current = node;
|
|
1614
|
+
},
|
|
1615
|
+
[ref]
|
|
705
1616
|
);
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
var
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
1617
|
+
const handleKeyDown = React38.useCallback(
|
|
1618
|
+
(e) => {
|
|
1619
|
+
var _a2;
|
|
1620
|
+
if (!containerRef.current) return;
|
|
1621
|
+
const items = Array.from(
|
|
1622
|
+
containerRef.current.querySelectorAll(
|
|
1623
|
+
'[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"])'
|
|
1624
|
+
)
|
|
1625
|
+
);
|
|
1626
|
+
if (!items.length) return;
|
|
1627
|
+
const idx = items.indexOf(document.activeElement);
|
|
1628
|
+
let next = null;
|
|
1629
|
+
switch (e.key) {
|
|
1630
|
+
case "ArrowDown":
|
|
1631
|
+
e.preventDefault();
|
|
1632
|
+
next = idx < items.length - 1 ? idx + 1 : 0;
|
|
1633
|
+
break;
|
|
1634
|
+
case "ArrowUp":
|
|
1635
|
+
e.preventDefault();
|
|
1636
|
+
next = idx > 0 ? idx - 1 : items.length - 1;
|
|
1637
|
+
break;
|
|
1638
|
+
case "Home":
|
|
1639
|
+
e.preventDefault();
|
|
1640
|
+
next = 0;
|
|
1641
|
+
break;
|
|
1642
|
+
case "End":
|
|
1643
|
+
e.preventDefault();
|
|
1644
|
+
next = items.length - 1;
|
|
1645
|
+
break;
|
|
1646
|
+
default:
|
|
1647
|
+
return;
|
|
1648
|
+
}
|
|
1649
|
+
if (next !== null) (_a2 = items[next]) == null ? void 0 : _a2.focus();
|
|
1650
|
+
},
|
|
1651
|
+
[]
|
|
1652
|
+
);
|
|
1653
|
+
const separatorStyle = detectSeparatorStyle(children);
|
|
1654
|
+
const isGapVariant = separatorStyle !== "divider";
|
|
714
1655
|
return /* @__PURE__ */ jsx(
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
1656
|
+
MenuProvider,
|
|
1657
|
+
{
|
|
1658
|
+
variant: "expressive",
|
|
1659
|
+
colorVariant,
|
|
1660
|
+
menuPrimitive: "static",
|
|
1661
|
+
open: true,
|
|
1662
|
+
onOpenChange: noop,
|
|
1663
|
+
children: /* @__PURE__ */ jsx(
|
|
1664
|
+
"div",
|
|
1665
|
+
__spreadProps(__spreadValues({
|
|
1666
|
+
ref: mergedRef,
|
|
1667
|
+
role: "menu",
|
|
1668
|
+
"aria-orientation": "vertical",
|
|
1669
|
+
onKeyDown: handleKeyDown,
|
|
1670
|
+
className: cn(
|
|
1671
|
+
// Width constraints: 112dp min, 280dp max (MenuTokens)
|
|
1672
|
+
MENU_MIN_WIDTH,
|
|
1673
|
+
MENU_MAX_WIDTH,
|
|
1674
|
+
"flex flex-col",
|
|
1675
|
+
isGapVariant ? [
|
|
1676
|
+
// GAP VARIANT: NO overflow-hidden — groups must morph freely.
|
|
1677
|
+
"outline-none"
|
|
1678
|
+
// NO background — transparent between segments.
|
|
1679
|
+
// NO rounded corners — each group manages its own shape.
|
|
1680
|
+
// Elevation is managed by each individual group.
|
|
1681
|
+
] : [
|
|
1682
|
+
// DIVIDER VARIANT: Container clips the content.
|
|
1683
|
+
"rounded-2xl",
|
|
1684
|
+
"overflow-hidden",
|
|
1685
|
+
colors.containerBg,
|
|
1686
|
+
"elevation-2",
|
|
1687
|
+
"outline-none"
|
|
1688
|
+
],
|
|
1689
|
+
className
|
|
1690
|
+
)
|
|
1691
|
+
}, props), {
|
|
1692
|
+
children
|
|
1693
|
+
})
|
|
720
1694
|
)
|
|
721
|
-
}
|
|
1695
|
+
}
|
|
722
1696
|
);
|
|
723
|
-
};
|
|
724
|
-
|
|
1697
|
+
});
|
|
1698
|
+
VerticalMenu.displayName = "VerticalMenu";
|
|
1699
|
+
function detectSeparatorStyle(children) {
|
|
1700
|
+
const child = React38.Children.toArray(children).find(React38.isValidElement);
|
|
1701
|
+
if (child) {
|
|
1702
|
+
const style = child.props.separatorStyle;
|
|
1703
|
+
if (style) return style;
|
|
1704
|
+
}
|
|
1705
|
+
return "gap";
|
|
1706
|
+
}
|
|
725
1707
|
function MoreVertIcon() {
|
|
726
1708
|
return /* @__PURE__ */ jsx(
|
|
727
1709
|
"span",
|
|
@@ -736,10 +1718,14 @@ function OverflowItem({ item }) {
|
|
|
736
1718
|
var _a;
|
|
737
1719
|
if (item.type === "toggleable") {
|
|
738
1720
|
return /* @__PURE__ */ jsx(
|
|
739
|
-
|
|
1721
|
+
MenuItem,
|
|
740
1722
|
{
|
|
741
|
-
|
|
742
|
-
|
|
1723
|
+
role: "menuitemcheckbox",
|
|
1724
|
+
selected: (_a = item.checked) != null ? _a : false,
|
|
1725
|
+
onClick: () => {
|
|
1726
|
+
var _a2;
|
|
1727
|
+
return (_a2 = item.onCheckedChange) == null ? void 0 : _a2.call(item, !item.checked);
|
|
1728
|
+
},
|
|
743
1729
|
disabled: item.enabled === false,
|
|
744
1730
|
children: item.label
|
|
745
1731
|
}
|
|
@@ -754,15 +1740,15 @@ function OverflowItem({ item }) {
|
|
|
754
1740
|
}
|
|
755
1741
|
}) });
|
|
756
1742
|
}
|
|
757
|
-
return /* @__PURE__ */ jsx(
|
|
1743
|
+
return /* @__PURE__ */ jsx(MenuItem, { onClick: item.onClick, disabled: item.enabled === false, children: item.label });
|
|
758
1744
|
}
|
|
759
1745
|
function AppBarOverflowIndicator({
|
|
760
1746
|
items,
|
|
761
1747
|
className
|
|
762
1748
|
}) {
|
|
763
1749
|
if (items.length === 0) return null;
|
|
764
|
-
return /* @__PURE__ */ jsxs(
|
|
765
|
-
/* @__PURE__ */ jsx(
|
|
1750
|
+
return /* @__PURE__ */ jsxs(Menu, { children: [
|
|
1751
|
+
/* @__PURE__ */ jsx(MenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
766
1752
|
"button",
|
|
767
1753
|
{
|
|
768
1754
|
type: "button",
|
|
@@ -781,7 +1767,7 @@ function AppBarOverflowIndicator({
|
|
|
781
1767
|
children: /* @__PURE__ */ jsx(MoreVertIcon, {})
|
|
782
1768
|
}
|
|
783
1769
|
) }),
|
|
784
|
-
/* @__PURE__ */ jsx(
|
|
1770
|
+
/* @__PURE__ */ jsx(MenuContent, { align: "end", sideOffset: 4, children: items.map((item, index) => (
|
|
785
1771
|
// biome-ignore lint/suspicious/noArrayIndexKey: static list from props
|
|
786
1772
|
/* @__PURE__ */ jsx(OverflowItem, { item }, index)
|
|
787
1773
|
)) })
|
|
@@ -792,11 +1778,11 @@ function AppBarColumn({
|
|
|
792
1778
|
maxItemCount,
|
|
793
1779
|
className
|
|
794
1780
|
}) {
|
|
795
|
-
const containerRef =
|
|
796
|
-
const [visibleCount, setVisibleCount] =
|
|
1781
|
+
const containerRef = React38.useRef(null);
|
|
1782
|
+
const [visibleCount, setVisibleCount] = React38.useState(
|
|
797
1783
|
maxItemCount != null ? maxItemCount : items.length
|
|
798
1784
|
);
|
|
799
|
-
|
|
1785
|
+
React38.useEffect(() => {
|
|
800
1786
|
if (maxItemCount !== void 0) {
|
|
801
1787
|
setVisibleCount(Math.min(maxItemCount, items.length));
|
|
802
1788
|
return;
|
|
@@ -844,11 +1830,11 @@ function AppBarColumn({
|
|
|
844
1830
|
);
|
|
845
1831
|
}
|
|
846
1832
|
function AppBarRow({ items, maxItemCount, className }) {
|
|
847
|
-
const containerRef =
|
|
848
|
-
const [visibleCount, setVisibleCount] =
|
|
1833
|
+
const containerRef = React38.useRef(null);
|
|
1834
|
+
const [visibleCount, setVisibleCount] = React38.useState(
|
|
849
1835
|
maxItemCount != null ? maxItemCount : items.length
|
|
850
1836
|
);
|
|
851
|
-
|
|
1837
|
+
React38.useEffect(() => {
|
|
852
1838
|
if (maxItemCount !== void 0) {
|
|
853
1839
|
setVisibleCount(Math.min(maxItemCount, items.length));
|
|
854
1840
|
return;
|
|
@@ -902,12 +1888,12 @@ function useAppBarScroll({
|
|
|
902
1888
|
collapsedHeight = 64,
|
|
903
1889
|
expandedHeight = 112
|
|
904
1890
|
} = {}) {
|
|
905
|
-
const [isScrolled, setIsScrolled] =
|
|
906
|
-
const [collapsedFraction, setCollapsedFraction] =
|
|
907
|
-
const [isHidden, setIsHidden] =
|
|
908
|
-
const prevScrollYRef =
|
|
1891
|
+
const [isScrolled, setIsScrolled] = React38.useState(false);
|
|
1892
|
+
const [collapsedFraction, setCollapsedFraction] = React38.useState(0);
|
|
1893
|
+
const [isHidden, setIsHidden] = React38.useState(false);
|
|
1894
|
+
const prevScrollYRef = React38.useRef(0);
|
|
909
1895
|
const hideThreshold = 64;
|
|
910
|
-
|
|
1896
|
+
React38.useEffect(() => {
|
|
911
1897
|
var _a;
|
|
912
1898
|
const scrollDistance = expandedHeight - collapsedHeight;
|
|
913
1899
|
const getScrollY = () => {
|
|
@@ -1028,7 +2014,7 @@ function useFlexibleAppBar({
|
|
|
1028
2014
|
expandedHeight
|
|
1029
2015
|
});
|
|
1030
2016
|
const scrollProgress = useMotionValue(0);
|
|
1031
|
-
|
|
2017
|
+
React38.useEffect(() => {
|
|
1032
2018
|
scrollProgress.set(
|
|
1033
2019
|
shouldReduceMotion ? collapsedFraction > 0.5 ? 1 : 0 : collapsedFraction
|
|
1034
2020
|
);
|
|
@@ -1369,7 +2355,7 @@ function SearchAppBar({
|
|
|
1369
2355
|
}) {
|
|
1370
2356
|
var _a, _b;
|
|
1371
2357
|
const shouldReduceMotion = useReducedMotion();
|
|
1372
|
-
const [isSearchOpen, setIsSearchOpen] =
|
|
2358
|
+
const [isSearchOpen, setIsSearchOpen] = React38.useState(false);
|
|
1373
2359
|
const { isScrolled } = useAppBarScroll({
|
|
1374
2360
|
scrollElement,
|
|
1375
2361
|
behavior: scrollBehavior === "exitUntilCollapsed" ? "pinned" : scrollBehavior
|
|
@@ -1483,8 +2469,8 @@ function SearchView({
|
|
|
1483
2469
|
className
|
|
1484
2470
|
}) {
|
|
1485
2471
|
const shouldReduceMotion = useReducedMotion();
|
|
1486
|
-
const inputRef =
|
|
1487
|
-
|
|
2472
|
+
const inputRef = React38.useRef(null);
|
|
2473
|
+
React38.useEffect(() => {
|
|
1488
2474
|
const timer = window.setTimeout(() => {
|
|
1489
2475
|
var _a;
|
|
1490
2476
|
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
@@ -1754,9 +2740,9 @@ function formatBadgeLabel(children, max) {
|
|
|
1754
2740
|
return "";
|
|
1755
2741
|
}
|
|
1756
2742
|
function detectBadgeHasContent(badge) {
|
|
1757
|
-
return
|
|
2743
|
+
return React38.isValidElement(badge) && badge.props.children != null;
|
|
1758
2744
|
}
|
|
1759
|
-
var BadgeImpl =
|
|
2745
|
+
var BadgeImpl = React38.forwardRef(
|
|
1760
2746
|
(_a, ref) => {
|
|
1761
2747
|
var _b = _a, {
|
|
1762
2748
|
children,
|
|
@@ -1810,7 +2796,7 @@ var BadgeImpl = React31.forwardRef(
|
|
|
1810
2796
|
}
|
|
1811
2797
|
);
|
|
1812
2798
|
BadgeImpl.displayName = "Badge";
|
|
1813
|
-
var Badge =
|
|
2799
|
+
var Badge = React38.memo(BadgeImpl);
|
|
1814
2800
|
function BadgedBox({
|
|
1815
2801
|
badge,
|
|
1816
2802
|
children,
|
|
@@ -1876,11 +2862,11 @@ var ROTATE_KEY_SPLINES = [
|
|
|
1876
2862
|
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
2863
|
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
2864
|
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 =
|
|
2865
|
+
var IndeterminateSvg = React38.memo(function IndeterminateSvg2({
|
|
1880
2866
|
size
|
|
1881
2867
|
}) {
|
|
1882
|
-
const [ready, setReady] =
|
|
1883
|
-
|
|
2868
|
+
const [ready, setReady] = React38.useState(false);
|
|
2869
|
+
React38.useEffect(() => {
|
|
1884
2870
|
const raf = requestAnimationFrame(() => setReady(true));
|
|
1885
2871
|
return () => cancelAnimationFrame(raf);
|
|
1886
2872
|
}, []);
|
|
@@ -1925,7 +2911,7 @@ var IndeterminateSvg = React31.memo(function IndeterminateSvg2({
|
|
|
1925
2911
|
}
|
|
1926
2912
|
);
|
|
1927
2913
|
});
|
|
1928
|
-
var DeterminateSvg =
|
|
2914
|
+
var DeterminateSvg = React38.memo(function DeterminateSvg2({
|
|
1929
2915
|
size,
|
|
1930
2916
|
progress
|
|
1931
2917
|
}) {
|
|
@@ -1950,7 +2936,7 @@ var DeterminateSvg = React31.memo(function DeterminateSvg2({
|
|
|
1950
2936
|
}
|
|
1951
2937
|
);
|
|
1952
2938
|
});
|
|
1953
|
-
var LoadingIndicator =
|
|
2939
|
+
var LoadingIndicator = React38.forwardRef(
|
|
1954
2940
|
(_a, ref) => {
|
|
1955
2941
|
var _b = _a, {
|
|
1956
2942
|
variant = "uncontained",
|
|
@@ -2065,7 +3051,7 @@ function getSinePath(startX, endX, phase, wl, amp) {
|
|
|
2065
3051
|
d += ` L ${endX.toFixed(2)} ${yEnd.toFixed(2)}`;
|
|
2066
3052
|
return d;
|
|
2067
3053
|
}
|
|
2068
|
-
var CircularProgress =
|
|
3054
|
+
var CircularProgress = React38.forwardRef(
|
|
2069
3055
|
(_a, ref) => {
|
|
2070
3056
|
var _b = _a, {
|
|
2071
3057
|
value,
|
|
@@ -2103,15 +3089,15 @@ var CircularProgress = React31.forwardRef(
|
|
|
2103
3089
|
const isWavy = shape === "wavy";
|
|
2104
3090
|
const BASELINE_SIZE = 48;
|
|
2105
3091
|
const scaleFactor = size / BASELINE_SIZE;
|
|
2106
|
-
const effectiveAmplitude =
|
|
3092
|
+
const effectiveAmplitude = React38.useMemo(
|
|
2107
3093
|
() => amplitude != null ? amplitude : 1.6 * scaleFactor,
|
|
2108
3094
|
[amplitude, scaleFactor]
|
|
2109
3095
|
);
|
|
2110
|
-
const effectiveWavelength =
|
|
3096
|
+
const effectiveWavelength = React38.useMemo(
|
|
2111
3097
|
() => wavelength != null ? wavelength : 15 * scaleFactor,
|
|
2112
3098
|
[wavelength, scaleFactor]
|
|
2113
3099
|
);
|
|
2114
|
-
const wavyActivePath =
|
|
3100
|
+
const wavyActivePath = React38.useMemo(
|
|
2115
3101
|
() => isWavy ? generateWavyCircularPath(
|
|
2116
3102
|
center,
|
|
2117
3103
|
radius,
|
|
@@ -2120,8 +3106,8 @@ var CircularProgress = React31.forwardRef(
|
|
|
2120
3106
|
) : null,
|
|
2121
3107
|
[isWavy, center, radius, effectiveAmplitude, effectiveWavelength]
|
|
2122
3108
|
);
|
|
2123
|
-
const circumference =
|
|
2124
|
-
const gapForTrack =
|
|
3109
|
+
const circumference = React38.useMemo(() => 2 * Math.PI * radius, [radius]);
|
|
3110
|
+
const gapForTrack = React38.useMemo(
|
|
2125
3111
|
() => (gapSize + trackHeight) / circumference,
|
|
2126
3112
|
[gapSize, trackHeight, circumference]
|
|
2127
3113
|
);
|
|
@@ -2310,9 +3296,9 @@ var CircularProgress = React31.forwardRef(
|
|
|
2310
3296
|
);
|
|
2311
3297
|
CircularProgress.displayName = "CircularProgress";
|
|
2312
3298
|
function useContainerWidth() {
|
|
2313
|
-
const [width, setWidth] =
|
|
2314
|
-
const observerRef =
|
|
2315
|
-
const ref =
|
|
3299
|
+
const [width, setWidth] = React38.useState(0);
|
|
3300
|
+
const observerRef = React38.useRef(null);
|
|
3301
|
+
const ref = React38.useCallback((node) => {
|
|
2316
3302
|
if (observerRef.current) {
|
|
2317
3303
|
observerRef.current.disconnect();
|
|
2318
3304
|
observerRef.current = null;
|
|
@@ -2326,7 +3312,7 @@ function useContainerWidth() {
|
|
|
2326
3312
|
observerRef.current = obs;
|
|
2327
3313
|
}
|
|
2328
3314
|
}, []);
|
|
2329
|
-
|
|
3315
|
+
React38.useEffect(() => {
|
|
2330
3316
|
return () => {
|
|
2331
3317
|
if (observerRef.current) {
|
|
2332
3318
|
observerRef.current.disconnect();
|
|
@@ -2336,7 +3322,7 @@ function useContainerWidth() {
|
|
|
2336
3322
|
return [ref, width];
|
|
2337
3323
|
}
|
|
2338
3324
|
function useMergedRef(...refs) {
|
|
2339
|
-
return
|
|
3325
|
+
return React38.useCallback(
|
|
2340
3326
|
(node) => {
|
|
2341
3327
|
for (const ref of refs) {
|
|
2342
3328
|
if (typeof ref === "function") {
|
|
@@ -2350,7 +3336,7 @@ function useMergedRef(...refs) {
|
|
|
2350
3336
|
[refs]
|
|
2351
3337
|
);
|
|
2352
3338
|
}
|
|
2353
|
-
var FlatLinearTrack =
|
|
3339
|
+
var FlatLinearTrack = React38.memo(function FlatLinearTrack2({
|
|
2354
3340
|
trackHeight,
|
|
2355
3341
|
activeColor,
|
|
2356
3342
|
trackColor,
|
|
@@ -2426,7 +3412,7 @@ var FlatLinearTrack = React31.memo(function FlatLinearTrack2({
|
|
|
2426
3412
|
}
|
|
2427
3413
|
);
|
|
2428
3414
|
});
|
|
2429
|
-
var WavyLinearTrack =
|
|
3415
|
+
var WavyLinearTrack = React38.memo(function WavyLinearTrack2({
|
|
2430
3416
|
trackHeight,
|
|
2431
3417
|
svgHeight,
|
|
2432
3418
|
amplitude,
|
|
@@ -2445,13 +3431,13 @@ var WavyLinearTrack = React31.memo(function WavyLinearTrack2({
|
|
|
2445
3431
|
}) {
|
|
2446
3432
|
const isDeterminate = typeof value === "number";
|
|
2447
3433
|
const clampedValue = isDeterminate ? Math.max(0, Math.min(100, value)) : 100;
|
|
2448
|
-
const titleId =
|
|
3434
|
+
const titleId = React38.useId();
|
|
2449
3435
|
const [containerRef, width] = useContainerWidth();
|
|
2450
|
-
const activePathRef =
|
|
2451
|
-
const trackPathRef =
|
|
3436
|
+
const activePathRef = React38.useRef(null);
|
|
3437
|
+
const trackPathRef = React38.useRef(null);
|
|
2452
3438
|
const amplitudeMV = useMotionValue(amplitude);
|
|
2453
3439
|
const fractionMV = useMotionValue(isDeterminate ? clampedValue / 100 : 1);
|
|
2454
|
-
|
|
3440
|
+
React38.useEffect(() => {
|
|
2455
3441
|
if (isDeterminate) {
|
|
2456
3442
|
const fraction = clampedValue / 100;
|
|
2457
3443
|
let targetAmp = amplitude;
|
|
@@ -2622,7 +3608,7 @@ var WavyLinearTrack = React31.memo(function WavyLinearTrack2({
|
|
|
2622
3608
|
}
|
|
2623
3609
|
);
|
|
2624
3610
|
});
|
|
2625
|
-
var LinearProgress =
|
|
3611
|
+
var LinearProgress = React38.forwardRef(
|
|
2626
3612
|
(_a, ref) => {
|
|
2627
3613
|
var _b = _a, {
|
|
2628
3614
|
value,
|
|
@@ -2663,10 +3649,10 @@ var LinearProgress = React31.forwardRef(
|
|
|
2663
3649
|
]);
|
|
2664
3650
|
const isDeterminate = value !== void 0;
|
|
2665
3651
|
const clampedValue = isDeterminate ? Math.min(100, Math.max(0, value)) : 0;
|
|
2666
|
-
const containerRef =
|
|
3652
|
+
const containerRef = React38.useRef(null);
|
|
2667
3653
|
const mergedRef = useMergedRef(ref, containerRef);
|
|
2668
|
-
const [isRtl, setIsRtl] =
|
|
2669
|
-
|
|
3654
|
+
const [isRtl, setIsRtl] = React38.useState(false);
|
|
3655
|
+
React38.useEffect(() => {
|
|
2670
3656
|
if (containerRef.current) {
|
|
2671
3657
|
const dir = getComputedStyle(containerRef.current).direction;
|
|
2672
3658
|
setIsRtl(dir === "rtl");
|
|
@@ -2674,16 +3660,16 @@ var LinearProgress = React31.forwardRef(
|
|
|
2674
3660
|
}, []);
|
|
2675
3661
|
const isWavy = shape === "wavy";
|
|
2676
3662
|
const resolvedTrackShape = trackShape != null ? trackShape : shape;
|
|
2677
|
-
const effectiveAmplitude =
|
|
2678
|
-
const svgHeight =
|
|
3663
|
+
const effectiveAmplitude = React38.useMemo(() => amplitude != null ? amplitude : 3, [amplitude]);
|
|
3664
|
+
const svgHeight = React38.useMemo(
|
|
2679
3665
|
() => isWavy ? trackHeight + effectiveAmplitude * 2 : trackHeight,
|
|
2680
3666
|
[isWavy, trackHeight, effectiveAmplitude]
|
|
2681
3667
|
);
|
|
2682
|
-
const shouldShowStop =
|
|
3668
|
+
const shouldShowStop = React38.useMemo(
|
|
2683
3669
|
() => isDeterminate && resolvedTrackShape === "flat" && (showStopIndicator === true || showStopIndicator === "auto" && isDeterminate),
|
|
2684
3670
|
[isDeterminate, resolvedTrackShape, showStopIndicator]
|
|
2685
3671
|
);
|
|
2686
|
-
const stopSize =
|
|
3672
|
+
const stopSize = React38.useMemo(
|
|
2687
3673
|
() => Math.max(2, trackHeight > 4 ? 4 : trackHeight / 2),
|
|
2688
3674
|
[trackHeight]
|
|
2689
3675
|
);
|
|
@@ -2756,14 +3742,14 @@ var LinearProgress = React31.forwardRef(
|
|
|
2756
3742
|
}
|
|
2757
3743
|
);
|
|
2758
3744
|
LinearProgress.displayName = "LinearProgress";
|
|
2759
|
-
var ProgressIndicator =
|
|
3745
|
+
var ProgressIndicator = React38.forwardRef((props, ref) => {
|
|
2760
3746
|
if (props.variant === "circular") {
|
|
2761
3747
|
return /* @__PURE__ */ jsx(CircularProgress, __spreadValues({ ref }, props));
|
|
2762
3748
|
}
|
|
2763
3749
|
return /* @__PURE__ */ jsx(LinearProgress, __spreadValues({ ref }, props));
|
|
2764
3750
|
});
|
|
2765
3751
|
ProgressIndicator.displayName = "ProgressIndicator";
|
|
2766
|
-
var RippleItem =
|
|
3752
|
+
var RippleItem = React38.memo(function RippleItem2({
|
|
2767
3753
|
ripple,
|
|
2768
3754
|
onDone
|
|
2769
3755
|
}) {
|
|
@@ -2807,8 +3793,8 @@ function Ripple({
|
|
|
2807
3793
|
}
|
|
2808
3794
|
function useRippleState(options = {}) {
|
|
2809
3795
|
const { disabled = false } = options;
|
|
2810
|
-
const [ripples, setRipples] =
|
|
2811
|
-
const onPointerDown =
|
|
3796
|
+
const [ripples, setRipples] = React38.useState([]);
|
|
3797
|
+
const onPointerDown = React38.useCallback(
|
|
2812
3798
|
(e) => {
|
|
2813
3799
|
if (disabled) return;
|
|
2814
3800
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
@@ -2822,7 +3808,7 @@ function useRippleState(options = {}) {
|
|
|
2822
3808
|
},
|
|
2823
3809
|
[disabled]
|
|
2824
3810
|
);
|
|
2825
|
-
const removeRipple =
|
|
3811
|
+
const removeRipple = React38.useCallback((id) => {
|
|
2826
3812
|
setRipples((prev) => prev.filter((r) => r.id !== id));
|
|
2827
3813
|
}, []);
|
|
2828
3814
|
return { ripples, onPointerDown, removeRipple };
|
|
@@ -2951,15 +3937,12 @@ var buttonColorVariants = cva(
|
|
|
2951
3937
|
defaultVariants: { colorStyle: "filled" }
|
|
2952
3938
|
}
|
|
2953
3939
|
);
|
|
2954
|
-
function toSentenceCase(text) {
|
|
2955
|
-
return text.charAt(0).toUpperCase() + text.slice(1).toLowerCase();
|
|
2956
|
-
}
|
|
2957
3940
|
function resolveLabel(children, asChild) {
|
|
2958
3941
|
if (asChild) {
|
|
2959
|
-
const child =
|
|
3942
|
+
const child = React38.Children.only(children);
|
|
2960
3943
|
return child.props.children;
|
|
2961
3944
|
}
|
|
2962
|
-
return
|
|
3945
|
+
return children;
|
|
2963
3946
|
}
|
|
2964
3947
|
var MOTION_PROP_KEYS = [
|
|
2965
3948
|
"animate",
|
|
@@ -3028,7 +4011,7 @@ function AnimatedIconSlot({
|
|
|
3028
4011
|
}
|
|
3029
4012
|
);
|
|
3030
4013
|
}
|
|
3031
|
-
var ButtonComponent =
|
|
4014
|
+
var ButtonComponent = React38.forwardRef(
|
|
3032
4015
|
(_a, ref) => {
|
|
3033
4016
|
var _b = _a, {
|
|
3034
4017
|
className,
|
|
@@ -3077,15 +4060,15 @@ var ButtonComponent = React31.forwardRef(
|
|
|
3077
4060
|
const { pressed: pressedRadius } = (_b2 = radiusMap[size]) != null ? _b2 : radiusMap.sm;
|
|
3078
4061
|
const iconClass = (_c = SIZE_ICON_CLASS[size]) != null ? _c : "size-5";
|
|
3079
4062
|
const mergedStyle = __spreadValues(__spreadValues({}, SIZE_STYLES[size]), style);
|
|
3080
|
-
const labelText =
|
|
4063
|
+
const labelText = React38.useMemo(
|
|
3081
4064
|
() => resolveLabel(children, asChild),
|
|
3082
4065
|
[children, asChild]
|
|
3083
4066
|
);
|
|
3084
4067
|
const computedAriaLabel = ariaLabelProp || (typeof children === "string" ? children : void 0);
|
|
3085
4068
|
const needsTouchTarget = size === "xs" || size === "sm";
|
|
3086
4069
|
const motionRadius = useMotionValue(animateRadius);
|
|
3087
|
-
const asChildRef =
|
|
3088
|
-
const mergedRef =
|
|
4070
|
+
const asChildRef = React38.useRef(null);
|
|
4071
|
+
const mergedRef = React38.useCallback(
|
|
3089
4072
|
(node) => {
|
|
3090
4073
|
asChildRef.current = node;
|
|
3091
4074
|
if (typeof ref === "function") ref(node);
|
|
@@ -3094,27 +4077,27 @@ var ButtonComponent = React31.forwardRef(
|
|
|
3094
4077
|
},
|
|
3095
4078
|
[ref]
|
|
3096
4079
|
);
|
|
3097
|
-
|
|
4080
|
+
React38.useEffect(
|
|
3098
4081
|
() => motionRadius.on("change", (v) => {
|
|
3099
4082
|
if (asChildRef.current)
|
|
3100
4083
|
asChildRef.current.style.borderRadius = `${v}px`;
|
|
3101
4084
|
}),
|
|
3102
4085
|
[motionRadius]
|
|
3103
4086
|
);
|
|
3104
|
-
|
|
4087
|
+
React38.useEffect(() => {
|
|
3105
4088
|
springAnimate(motionRadius, animateRadius);
|
|
3106
4089
|
}, [animateRadius, motionRadius]);
|
|
3107
4090
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
3108
4091
|
disabled: loading
|
|
3109
4092
|
});
|
|
3110
|
-
const handleClick =
|
|
4093
|
+
const handleClick = React38.useCallback(
|
|
3111
4094
|
(e) => {
|
|
3112
4095
|
if (loading) return e.preventDefault();
|
|
3113
4096
|
onClick == null ? void 0 : onClick(e);
|
|
3114
4097
|
},
|
|
3115
4098
|
[loading, onClick]
|
|
3116
4099
|
);
|
|
3117
|
-
const handleKeyDown =
|
|
4100
|
+
const handleKeyDown = React38.useCallback(
|
|
3118
4101
|
(e) => {
|
|
3119
4102
|
if (loading) return;
|
|
3120
4103
|
if (onClick && (e.key === "Enter" || e.key === " ")) {
|
|
@@ -3148,7 +4131,7 @@ var ButtonComponent = React31.forwardRef(
|
|
|
3148
4131
|
m.span,
|
|
3149
4132
|
{
|
|
3150
4133
|
layout: "size",
|
|
3151
|
-
className: "inline-flex items-center gap-[inherit]",
|
|
4134
|
+
className: "inline-flex items-center h-full gap-[inherit]",
|
|
3152
4135
|
transition: SPRING_TRANSITION,
|
|
3153
4136
|
children: labelText
|
|
3154
4137
|
}
|
|
@@ -3157,7 +4140,7 @@ var ButtonComponent = React31.forwardRef(
|
|
|
3157
4140
|
] });
|
|
3158
4141
|
if (asChild) {
|
|
3159
4142
|
const htmlProps = stripMotionProps(restProps);
|
|
3160
|
-
const child =
|
|
4143
|
+
const child = React38.Children.only(children);
|
|
3161
4144
|
const handleAsChildPointerDown = (e) => {
|
|
3162
4145
|
springAnimate(motionRadius, pressedRadius);
|
|
3163
4146
|
onPointerDown == null ? void 0 : onPointerDown(e);
|
|
@@ -3181,7 +4164,7 @@ var ButtonComponent = React31.forwardRef(
|
|
|
3181
4164
|
}),
|
|
3182
4165
|
className: buttonClassName
|
|
3183
4166
|
}, htmlProps), {
|
|
3184
|
-
children:
|
|
4167
|
+
children: React38.cloneElement(child, { children: innerContent })
|
|
3185
4168
|
})
|
|
3186
4169
|
) });
|
|
3187
4170
|
}
|
|
@@ -3209,7 +4192,7 @@ var ButtonComponent = React31.forwardRef(
|
|
|
3209
4192
|
}
|
|
3210
4193
|
);
|
|
3211
4194
|
ButtonComponent.displayName = "Button";
|
|
3212
|
-
var Button =
|
|
4195
|
+
var Button = React38.memo(ButtonComponent);
|
|
3213
4196
|
var SIZE_PADDING_MAP = {
|
|
3214
4197
|
xs: "0.75rem",
|
|
3215
4198
|
sm: "1rem",
|
|
@@ -3238,7 +4221,7 @@ var PRESSED_RADIUS_MAP = {
|
|
|
3238
4221
|
lg: 28,
|
|
3239
4222
|
xl: 40
|
|
3240
4223
|
};
|
|
3241
|
-
var ButtonGroupComponent =
|
|
4224
|
+
var ButtonGroupComponent = React38.forwardRef(
|
|
3242
4225
|
(_a, ref) => {
|
|
3243
4226
|
var _b = _a, {
|
|
3244
4227
|
className,
|
|
@@ -3259,13 +4242,13 @@ var ButtonGroupComponent = React31.forwardRef(
|
|
|
3259
4242
|
"showCheck",
|
|
3260
4243
|
"children"
|
|
3261
4244
|
]);
|
|
3262
|
-
const [pressedIndex, setPressedIndex] =
|
|
3263
|
-
const childrenArray =
|
|
3264
|
-
() =>
|
|
4245
|
+
const [pressedIndex, setPressedIndex] = React38.useState(null);
|
|
4246
|
+
const childrenArray = React38.useMemo(
|
|
4247
|
+
() => React38.Children.toArray(children).filter(React38.isValidElement),
|
|
3265
4248
|
[children]
|
|
3266
4249
|
);
|
|
3267
4250
|
const count = childrenArray.length;
|
|
3268
|
-
const handlePointerLeaveAndUp =
|
|
4251
|
+
const handlePointerLeaveAndUp = React38.useCallback(() => {
|
|
3269
4252
|
setPressedIndex(null);
|
|
3270
4253
|
}, []);
|
|
3271
4254
|
return /* @__PURE__ */ jsx(
|
|
@@ -3404,7 +4387,7 @@ var ButtonGroupComponent = React31.forwardRef(
|
|
|
3404
4387
|
duration: 0.2
|
|
3405
4388
|
};
|
|
3406
4389
|
}
|
|
3407
|
-
return
|
|
4390
|
+
return React38.cloneElement(element, __spreadValues(__spreadProps(__spreadValues({
|
|
3408
4391
|
key: (_a2 = element.key) != null ? _a2 : index,
|
|
3409
4392
|
tabIndex: isFirst ? 0 : -1,
|
|
3410
4393
|
size: size || element.props.size,
|
|
@@ -3433,7 +4416,7 @@ var ButtonGroupComponent = React31.forwardRef(
|
|
|
3433
4416
|
}
|
|
3434
4417
|
);
|
|
3435
4418
|
ButtonGroupComponent.displayName = "ButtonGroup";
|
|
3436
|
-
var ButtonGroup =
|
|
4419
|
+
var ButtonGroup = React38.memo(ButtonGroupComponent);
|
|
3437
4420
|
var SHADOW = {
|
|
3438
4421
|
level0: "none",
|
|
3439
4422
|
level1: "0px 1px 2px 0px rgba(0,0,0,.3), 0px 1px 3px 1px rgba(0,0,0,.15)",
|
|
@@ -3492,7 +4475,7 @@ function useCardElevation(variant, disabled) {
|
|
|
3492
4475
|
}
|
|
3493
4476
|
};
|
|
3494
4477
|
}
|
|
3495
|
-
var CardImpl =
|
|
4478
|
+
var CardImpl = React38.forwardRef(
|
|
3496
4479
|
(_a, ref) => {
|
|
3497
4480
|
var _b = _a, {
|
|
3498
4481
|
className,
|
|
@@ -3590,7 +4573,7 @@ var CardImpl = React31.forwardRef(
|
|
|
3590
4573
|
}
|
|
3591
4574
|
);
|
|
3592
4575
|
CardImpl.displayName = "Card";
|
|
3593
|
-
var Card =
|
|
4576
|
+
var Card = React38.memo(CardImpl);
|
|
3594
4577
|
var MD3_STANDARD = [0.2, 0, 0, 1];
|
|
3595
4578
|
var MD3_FAST_EFFECTS = [0.3, 0, 1, 1];
|
|
3596
4579
|
var CHECKMARK_PATH = "M 4.5 9.5 L 7.5 12.5 L 13.5 5.5";
|
|
@@ -3604,7 +4587,7 @@ var NEXT_STATE = {
|
|
|
3604
4587
|
checked: "indeterminate",
|
|
3605
4588
|
indeterminate: "unchecked"
|
|
3606
4589
|
};
|
|
3607
|
-
var CheckboxVisual =
|
|
4590
|
+
var CheckboxVisual = React38.memo(function CheckboxVisual2({
|
|
3608
4591
|
isSelected,
|
|
3609
4592
|
isIndeterminate,
|
|
3610
4593
|
containerBg,
|
|
@@ -3675,7 +4658,7 @@ var CheckboxVisual = React31.memo(function CheckboxVisual2({
|
|
|
3675
4658
|
);
|
|
3676
4659
|
});
|
|
3677
4660
|
function useMergedRef2(externalRef, internalRef) {
|
|
3678
|
-
return
|
|
4661
|
+
return React38.useCallback(
|
|
3679
4662
|
(node) => {
|
|
3680
4663
|
internalRef.current = node;
|
|
3681
4664
|
if (!externalRef) return;
|
|
@@ -3688,7 +4671,7 @@ function useMergedRef2(externalRef, internalRef) {
|
|
|
3688
4671
|
[externalRef, internalRef]
|
|
3689
4672
|
);
|
|
3690
4673
|
}
|
|
3691
|
-
var CheckboxComponent =
|
|
4674
|
+
var CheckboxComponent = React38.forwardRef(
|
|
3692
4675
|
({
|
|
3693
4676
|
checked,
|
|
3694
4677
|
defaultChecked = false,
|
|
@@ -3710,20 +4693,20 @@ var CheckboxComponent = React31.forwardRef(
|
|
|
3710
4693
|
}, ref) => {
|
|
3711
4694
|
var _a;
|
|
3712
4695
|
const prefersReduced = (_a = useReducedMotion()) != null ? _a : false;
|
|
3713
|
-
const generatedId =
|
|
4696
|
+
const generatedId = React38.useId();
|
|
3714
4697
|
const inputId = idProp != null ? idProp : label ? `checkbox-${generatedId}` : void 0;
|
|
3715
|
-
const [internalState, setInternalState] =
|
|
4698
|
+
const [internalState, setInternalState] = React38.useState(
|
|
3716
4699
|
() => defaultChecked ? "checked" : "unchecked"
|
|
3717
4700
|
);
|
|
3718
4701
|
const isControlled = stateProp !== void 0 || checked !== void 0;
|
|
3719
4702
|
const baseState = isControlled ? resolveState(checked, false, stateProp) : internalState;
|
|
3720
4703
|
const effectiveState = indeterminate ? "indeterminate" : baseState;
|
|
3721
|
-
const [ripples, setRipples] =
|
|
3722
|
-
const removeRipple =
|
|
4704
|
+
const [ripples, setRipples] = React38.useState([]);
|
|
4705
|
+
const removeRipple = React38.useCallback(
|
|
3723
4706
|
(id) => setRipples((prev) => prev.filter((r) => r.id !== id)),
|
|
3724
4707
|
[]
|
|
3725
4708
|
);
|
|
3726
|
-
const onPointerDown =
|
|
4709
|
+
const onPointerDown = React38.useCallback(
|
|
3727
4710
|
(e) => {
|
|
3728
4711
|
if (disabled) return;
|
|
3729
4712
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
@@ -3737,7 +4720,7 @@ var CheckboxComponent = React31.forwardRef(
|
|
|
3737
4720
|
},
|
|
3738
4721
|
[disabled]
|
|
3739
4722
|
);
|
|
3740
|
-
const handleChange =
|
|
4723
|
+
const handleChange = React38.useCallback(
|
|
3741
4724
|
(e) => {
|
|
3742
4725
|
if (disabled) return;
|
|
3743
4726
|
if (stateProp !== void 0) {
|
|
@@ -3763,9 +4746,9 @@ var CheckboxComponent = React31.forwardRef(
|
|
|
3763
4746
|
onCheckedChange
|
|
3764
4747
|
]
|
|
3765
4748
|
);
|
|
3766
|
-
const inputRef =
|
|
4749
|
+
const inputRef = React38.useRef(null);
|
|
3767
4750
|
const mergedRef = useMergedRef2(ref, inputRef);
|
|
3768
|
-
|
|
4751
|
+
React38.useEffect(() => {
|
|
3769
4752
|
if (inputRef.current) {
|
|
3770
4753
|
inputRef.current.indeterminate = effectiveState === "indeterminate";
|
|
3771
4754
|
}
|
|
@@ -3890,13 +4873,13 @@ var CheckboxComponent = React31.forwardRef(
|
|
|
3890
4873
|
}
|
|
3891
4874
|
);
|
|
3892
4875
|
CheckboxComponent.displayName = "Checkbox";
|
|
3893
|
-
var Checkbox =
|
|
3894
|
-
var TriStateCheckboxComponent =
|
|
4876
|
+
var Checkbox = React38.memo(CheckboxComponent);
|
|
4877
|
+
var TriStateCheckboxComponent = React38.forwardRef((_a, ref) => {
|
|
3895
4878
|
var _b = _a, { state, onStateChange } = _b, rest = __objRest(_b, ["state", "onStateChange"]);
|
|
3896
4879
|
return /* @__PURE__ */ jsx(Checkbox, __spreadValues({ ref, state, onStateChange }, rest));
|
|
3897
4880
|
});
|
|
3898
4881
|
TriStateCheckboxComponent.displayName = "TriStateCheckbox";
|
|
3899
|
-
var TriStateCheckbox =
|
|
4882
|
+
var TriStateCheckbox = React38.memo(TriStateCheckboxComponent);
|
|
3900
4883
|
function CheckIcon({ className }) {
|
|
3901
4884
|
return /* @__PURE__ */ jsx(
|
|
3902
4885
|
"svg",
|
|
@@ -3990,7 +4973,7 @@ var chipVariants = cva(
|
|
|
3990
4973
|
defaultVariants: { variant: "assist" }
|
|
3991
4974
|
}
|
|
3992
4975
|
);
|
|
3993
|
-
var ChipImpl =
|
|
4976
|
+
var ChipImpl = React38.forwardRef(
|
|
3994
4977
|
(_a, ref) => {
|
|
3995
4978
|
var _b = _a, {
|
|
3996
4979
|
variant = "assist",
|
|
@@ -4026,7 +5009,7 @@ var ChipImpl = React31.forwardRef(
|
|
|
4026
5009
|
const showCheckmark = isFilter && selected;
|
|
4027
5010
|
const hasTrailingContent = !!trailingIcon || !!onRemove;
|
|
4028
5011
|
const hasLeadingContent = isFilter || !!resolvedLeadingIcon;
|
|
4029
|
-
const paddingClass =
|
|
5012
|
+
const paddingClass = React38.useMemo(
|
|
4030
5013
|
() => cn(
|
|
4031
5014
|
!isInput && !hasLeadingContent && !hasTrailingContent && "px-4",
|
|
4032
5015
|
!isInput && hasLeadingContent && !hasTrailingContent && "pl-2 pr-4",
|
|
@@ -4039,7 +5022,7 @@ var ChipImpl = React31.forwardRef(
|
|
|
4039
5022
|
),
|
|
4040
5023
|
[isInput, hasLeadingContent, hasTrailingContent]
|
|
4041
5024
|
);
|
|
4042
|
-
const stateClass =
|
|
5025
|
+
const stateClass = React38.useMemo(
|
|
4043
5026
|
() => cn(
|
|
4044
5027
|
(isFilter || isInput) && selected && "bg-m3-secondary-container text-m3-on-secondary-container border-none before:bg-m3-on-secondary-container",
|
|
4045
5028
|
elevated && !selected && "bg-m3-surface-container-low border-none elevation-1",
|
|
@@ -4050,7 +5033,7 @@ var ChipImpl = React31.forwardRef(
|
|
|
4050
5033
|
),
|
|
4051
5034
|
[isFilter, isInput, selected, elevated, disabled]
|
|
4052
5035
|
);
|
|
4053
|
-
const leadingIconColorClass =
|
|
5036
|
+
const leadingIconColorClass = React38.useMemo(
|
|
4054
5037
|
() => cn(
|
|
4055
5038
|
(variant === "assist" || variant === "suggestion") && "text-m3-primary",
|
|
4056
5039
|
isFilter && !selected && "text-m3-primary",
|
|
@@ -4061,7 +5044,7 @@ var ChipImpl = React31.forwardRef(
|
|
|
4061
5044
|
[variant, isFilter, isInput, selected]
|
|
4062
5045
|
);
|
|
4063
5046
|
const isCompound = !!onRemove;
|
|
4064
|
-
const
|
|
5047
|
+
const Root6 = isCompound ? "div" : "button";
|
|
4065
5048
|
const containerClass = cn(
|
|
4066
5049
|
chipVariants({ variant }),
|
|
4067
5050
|
!isCompound && paddingClass,
|
|
@@ -4131,7 +5114,7 @@ var ChipImpl = React31.forwardRef(
|
|
|
4131
5114
|
/* @__PURE__ */ jsx("span", { className: "whitespace-nowrap", children: label })
|
|
4132
5115
|
] });
|
|
4133
5116
|
return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: /* @__PURE__ */ jsxs(
|
|
4134
|
-
|
|
5117
|
+
Root6,
|
|
4135
5118
|
__spreadProps(__spreadValues(__spreadProps(__spreadValues({
|
|
4136
5119
|
ref: !isCompound ? ref : void 0,
|
|
4137
5120
|
type: !isCompound ? "button" : void 0
|
|
@@ -4222,8 +5205,8 @@ var ChipImpl = React31.forwardRef(
|
|
|
4222
5205
|
}
|
|
4223
5206
|
);
|
|
4224
5207
|
ChipImpl.displayName = "Chip";
|
|
4225
|
-
var Chip =
|
|
4226
|
-
var ScrollArea =
|
|
5208
|
+
var Chip = React38.memo(ChipImpl);
|
|
5209
|
+
var ScrollArea = React38.forwardRef(
|
|
4227
5210
|
(_a, ref) => {
|
|
4228
5211
|
var _b = _a, {
|
|
4229
5212
|
className,
|
|
@@ -4282,7 +5265,7 @@ var ScrollArea = React31.forwardRef(
|
|
|
4282
5265
|
}
|
|
4283
5266
|
);
|
|
4284
5267
|
ScrollArea.displayName = "ScrollArea";
|
|
4285
|
-
var ScrollAreaScrollbar =
|
|
5268
|
+
var ScrollAreaScrollbar = React38.forwardRef((_a, ref) => {
|
|
4286
5269
|
var _b = _a, { className, orientation = "vertical" } = _b, props = __objRest(_b, ["className", "orientation"]);
|
|
4287
5270
|
return /* @__PURE__ */ jsx(
|
|
4288
5271
|
RadixScrollArea.Scrollbar,
|
|
@@ -4312,7 +5295,7 @@ var ScrollAreaScrollbar = React31.forwardRef((_a, ref) => {
|
|
|
4312
5295
|
);
|
|
4313
5296
|
});
|
|
4314
5297
|
ScrollAreaScrollbar.displayName = RadixScrollArea.Scrollbar.displayName;
|
|
4315
|
-
var ScrollAreaCorner =
|
|
5298
|
+
var ScrollAreaCorner = React38.forwardRef((_a, ref) => {
|
|
4316
5299
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
4317
5300
|
return /* @__PURE__ */ jsx(
|
|
4318
5301
|
RadixScrollArea.Corner,
|
|
@@ -4589,7 +5572,7 @@ function resolveDisabledBgClass(colorStyle) {
|
|
|
4589
5572
|
}
|
|
4590
5573
|
return "disabled:text-m3-on-surface/[0.38]";
|
|
4591
5574
|
}
|
|
4592
|
-
var IconButtonComponent =
|
|
5575
|
+
var IconButtonComponent = React38.forwardRef(
|
|
4593
5576
|
(_a, ref) => {
|
|
4594
5577
|
var _b = _a, {
|
|
4595
5578
|
className,
|
|
@@ -4623,18 +5606,18 @@ var IconButtonComponent = React31.forwardRef(
|
|
|
4623
5606
|
var _a2, _b2;
|
|
4624
5607
|
const isToggle = variant === "toggle";
|
|
4625
5608
|
const isSelected = isToggle && !!selected;
|
|
4626
|
-
const resolvedColorClass =
|
|
5609
|
+
const resolvedColorClass = React38.useMemo(
|
|
4627
5610
|
() => isSelected ? colorStyles[colorStyle].selected : colorStyles[colorStyle].default,
|
|
4628
5611
|
[isSelected, colorStyle]
|
|
4629
5612
|
);
|
|
4630
|
-
const outlineWidthClass =
|
|
5613
|
+
const outlineWidthClass = React38.useMemo(
|
|
4631
5614
|
() => {
|
|
4632
5615
|
var _a3;
|
|
4633
5616
|
return colorStyle === "outlined" && !isSelected ? (_a3 = SIZE_OUTLINE_WIDTH[size]) != null ? _a3 : "border" : "";
|
|
4634
5617
|
},
|
|
4635
5618
|
[colorStyle, isSelected, size]
|
|
4636
5619
|
);
|
|
4637
|
-
const disabledBgClass =
|
|
5620
|
+
const disabledBgClass = React38.useMemo(
|
|
4638
5621
|
() => resolveDisabledBgClass(colorStyle),
|
|
4639
5622
|
[colorStyle]
|
|
4640
5623
|
);
|
|
@@ -4653,7 +5636,7 @@ var IconButtonComponent = React31.forwardRef(
|
|
|
4653
5636
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
4654
5637
|
disabled: loading
|
|
4655
5638
|
});
|
|
4656
|
-
const handleClick =
|
|
5639
|
+
const handleClick = React38.useCallback(
|
|
4657
5640
|
(e) => {
|
|
4658
5641
|
if (loading) {
|
|
4659
5642
|
e.preventDefault();
|
|
@@ -4663,7 +5646,7 @@ var IconButtonComponent = React31.forwardRef(
|
|
|
4663
5646
|
},
|
|
4664
5647
|
[loading, onClick]
|
|
4665
5648
|
);
|
|
4666
|
-
const handleKeyDown =
|
|
5649
|
+
const handleKeyDown = React38.useCallback(
|
|
4667
5650
|
(e) => {
|
|
4668
5651
|
if (loading) return;
|
|
4669
5652
|
if ((e.key === "Enter" || e.key === " ") && onClick) {
|
|
@@ -4751,7 +5734,7 @@ var IconButtonComponent = React31.forwardRef(
|
|
|
4751
5734
|
}
|
|
4752
5735
|
);
|
|
4753
5736
|
IconButtonComponent.displayName = "IconButton";
|
|
4754
|
-
var IconButton =
|
|
5737
|
+
var IconButton = React38.memo(IconButtonComponent);
|
|
4755
5738
|
var MD3_SPRING = {
|
|
4756
5739
|
type: "spring",
|
|
4757
5740
|
stiffness: 400,
|
|
@@ -4788,9 +5771,9 @@ DialogTrigger.displayName = "DialogTrigger";
|
|
|
4788
5771
|
var DialogPortal = ({
|
|
4789
5772
|
open,
|
|
4790
5773
|
children
|
|
4791
|
-
}) => /* @__PURE__ */ jsx(RadixDialog.Portal, { forceMount: true, children: /* @__PURE__ */ jsx(AnimatePresence, { children: open ?
|
|
5774
|
+
}) => /* @__PURE__ */ jsx(RadixDialog.Portal, { forceMount: true, children: /* @__PURE__ */ jsx(AnimatePresence, { children: open ? React38.Children.toArray(children) : null }) });
|
|
4792
5775
|
DialogPortal.displayName = "DialogPortal";
|
|
4793
|
-
var DialogOverlay =
|
|
5776
|
+
var DialogOverlay = React38.forwardRef((_a, ref) => {
|
|
4794
5777
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
4795
5778
|
return /* @__PURE__ */ jsx(RadixDialog.Overlay, __spreadProps(__spreadValues({ ref, asChild: true }, props), { children: /* @__PURE__ */ jsx(
|
|
4796
5779
|
m.div,
|
|
@@ -4801,7 +5784,7 @@ var DialogOverlay = React31.forwardRef((_a, ref) => {
|
|
|
4801
5784
|
) }));
|
|
4802
5785
|
});
|
|
4803
5786
|
DialogOverlay.displayName = "DialogOverlay";
|
|
4804
|
-
var DialogContent =
|
|
5787
|
+
var DialogContent = React38.forwardRef((_a, ref) => {
|
|
4805
5788
|
var _b = _a, { className, children, hideCloseButton = false } = _b, props = __objRest(_b, ["className", "children", "hideCloseButton"]);
|
|
4806
5789
|
return /* @__PURE__ */ jsx(
|
|
4807
5790
|
RadixDialog.Content,
|
|
@@ -4841,7 +5824,7 @@ var DialogContent = React31.forwardRef((_a, ref) => {
|
|
|
4841
5824
|
);
|
|
4842
5825
|
});
|
|
4843
5826
|
DialogContent.displayName = "DialogContent";
|
|
4844
|
-
var DialogIcon =
|
|
5827
|
+
var DialogIcon = React38.forwardRef((_a, ref) => {
|
|
4845
5828
|
var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
|
|
4846
5829
|
return /* @__PURE__ */ jsx(
|
|
4847
5830
|
"div",
|
|
@@ -4864,7 +5847,7 @@ var DialogHeader = (_a) => {
|
|
|
4864
5847
|
return /* @__PURE__ */ jsx("div", __spreadValues({ className: cn("flex flex-col gap-2 mb-4", className) }, props));
|
|
4865
5848
|
};
|
|
4866
5849
|
DialogHeader.displayName = "DialogHeader";
|
|
4867
|
-
var DialogTitle =
|
|
5850
|
+
var DialogTitle = React38.forwardRef((_a, ref) => {
|
|
4868
5851
|
var _b = _a, { className, asChild } = _b, props = __objRest(_b, ["className", "asChild"]);
|
|
4869
5852
|
return /* @__PURE__ */ jsx(
|
|
4870
5853
|
RadixDialog.Title,
|
|
@@ -4879,7 +5862,7 @@ var DialogTitle = React31.forwardRef((_a, ref) => {
|
|
|
4879
5862
|
);
|
|
4880
5863
|
});
|
|
4881
5864
|
DialogTitle.displayName = "DialogTitle";
|
|
4882
|
-
var DialogDescription =
|
|
5865
|
+
var DialogDescription = React38.forwardRef((_a, ref) => {
|
|
4883
5866
|
var _b = _a, { className, asChild } = _b, props = __objRest(_b, ["className", "asChild"]);
|
|
4884
5867
|
return /* @__PURE__ */ jsx(
|
|
4885
5868
|
RadixDialog.Description,
|
|
@@ -4891,7 +5874,7 @@ var DialogDescription = React31.forwardRef((_a, ref) => {
|
|
|
4891
5874
|
);
|
|
4892
5875
|
});
|
|
4893
5876
|
DialogDescription.displayName = "DialogDescription";
|
|
4894
|
-
var DialogBody =
|
|
5877
|
+
var DialogBody = React38.forwardRef((_a, ref) => {
|
|
4895
5878
|
var _b = _a, { className, children, dir } = _b, props = __objRest(_b, ["className", "children", "dir"]);
|
|
4896
5879
|
return /* @__PURE__ */ jsx(
|
|
4897
5880
|
ScrollArea,
|
|
@@ -4922,7 +5905,7 @@ var DialogFooter = (_a) => {
|
|
|
4922
5905
|
};
|
|
4923
5906
|
DialogFooter.displayName = "DialogFooter";
|
|
4924
5907
|
var DialogClose = RadixDialog.Close;
|
|
4925
|
-
var DialogFullScreenContent =
|
|
5908
|
+
var DialogFullScreenContent = React38.forwardRef(
|
|
4926
5909
|
(_a, ref) => {
|
|
4927
5910
|
var _b = _a, {
|
|
4928
5911
|
className,
|
|
@@ -5005,7 +5988,7 @@ function buildWavePath(startX, endX, amplitude = 2, wavelength = 32, yCenter = 4
|
|
|
5005
5988
|
}
|
|
5006
5989
|
return d;
|
|
5007
5990
|
}
|
|
5008
|
-
var DividerImpl =
|
|
5991
|
+
var DividerImpl = React38.forwardRef(
|
|
5009
5992
|
(_a, ref) => {
|
|
5010
5993
|
var _b = _a, {
|
|
5011
5994
|
variant = "full-bleed",
|
|
@@ -5125,7 +6108,7 @@ var DividerImpl = React31.forwardRef(
|
|
|
5125
6108
|
}
|
|
5126
6109
|
);
|
|
5127
6110
|
DividerImpl.displayName = "Divider";
|
|
5128
|
-
var Divider =
|
|
6111
|
+
var Divider = React38.memo(DividerImpl);
|
|
5129
6112
|
var MD3_DRAWER_SPRING = {
|
|
5130
6113
|
type: "spring",
|
|
5131
6114
|
stiffness: 350,
|
|
@@ -5162,7 +6145,7 @@ var DrawerPortal = ({
|
|
|
5162
6145
|
open,
|
|
5163
6146
|
children
|
|
5164
6147
|
}) => /* @__PURE__ */ jsx(RadixDialog.Portal, { forceMount: true, children: /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", children: open && children }) });
|
|
5165
|
-
var DrawerOverlay =
|
|
6148
|
+
var DrawerOverlay = React38.forwardRef((_a, ref) => {
|
|
5166
6149
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
5167
6150
|
return /* @__PURE__ */ jsx(RadixDialog.Overlay, __spreadProps(__spreadValues({ ref, asChild: true }, props), { children: /* @__PURE__ */ jsx(
|
|
5168
6151
|
m.div,
|
|
@@ -5173,7 +6156,7 @@ var DrawerOverlay = React31.forwardRef((_a, ref) => {
|
|
|
5173
6156
|
) }));
|
|
5174
6157
|
});
|
|
5175
6158
|
DrawerOverlay.displayName = "DrawerOverlay";
|
|
5176
|
-
var DrawerContent =
|
|
6159
|
+
var DrawerContent = React38.forwardRef(
|
|
5177
6160
|
(_a, ref) => {
|
|
5178
6161
|
var _b = _a, {
|
|
5179
6162
|
className,
|
|
@@ -5252,7 +6235,7 @@ var DrawerFooter = (_a) => {
|
|
|
5252
6235
|
return /* @__PURE__ */ jsx("div", __spreadValues({ className: cn("flex flex-col gap-2 mt-4", className) }, props));
|
|
5253
6236
|
};
|
|
5254
6237
|
DrawerFooter.displayName = "DrawerFooter";
|
|
5255
|
-
var DrawerTitle =
|
|
6238
|
+
var DrawerTitle = React38.forwardRef((_a, ref) => {
|
|
5256
6239
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
5257
6240
|
return /* @__PURE__ */ jsx(
|
|
5258
6241
|
RadixDialog.Title,
|
|
@@ -5266,7 +6249,7 @@ var DrawerTitle = React31.forwardRef((_a, ref) => {
|
|
|
5266
6249
|
);
|
|
5267
6250
|
});
|
|
5268
6251
|
DrawerTitle.displayName = "DrawerTitle";
|
|
5269
|
-
var DrawerDescription =
|
|
6252
|
+
var DrawerDescription = React38.forwardRef((_a, ref) => {
|
|
5270
6253
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
5271
6254
|
return /* @__PURE__ */ jsx(
|
|
5272
6255
|
RadixDialog.Description,
|
|
@@ -5347,7 +6330,7 @@ function FABPosition({
|
|
|
5347
6330
|
}
|
|
5348
6331
|
);
|
|
5349
6332
|
}
|
|
5350
|
-
var FABComponent =
|
|
6333
|
+
var FABComponent = React38.forwardRef(
|
|
5351
6334
|
(_a, ref) => {
|
|
5352
6335
|
var _b = _a, {
|
|
5353
6336
|
className,
|
|
@@ -5392,7 +6375,7 @@ var FABComponent = React31.forwardRef(
|
|
|
5392
6375
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
5393
6376
|
disabled: loading
|
|
5394
6377
|
});
|
|
5395
|
-
const handleClick =
|
|
6378
|
+
const handleClick = React38.useCallback(
|
|
5396
6379
|
(e) => {
|
|
5397
6380
|
if (loading) {
|
|
5398
6381
|
e.preventDefault();
|
|
@@ -5402,7 +6385,7 @@ var FABComponent = React31.forwardRef(
|
|
|
5402
6385
|
},
|
|
5403
6386
|
[loading, onClick]
|
|
5404
6387
|
);
|
|
5405
|
-
const handleKeyDown =
|
|
6388
|
+
const handleKeyDown = React38.useCallback(
|
|
5406
6389
|
(e) => {
|
|
5407
6390
|
if (loading) return;
|
|
5408
6391
|
if ((e.key === "Enter" || e.key === " ") && onClick) {
|
|
@@ -5511,7 +6494,7 @@ var FABComponent = React31.forwardRef(
|
|
|
5511
6494
|
}
|
|
5512
6495
|
);
|
|
5513
6496
|
FABComponent.displayName = "FAB";
|
|
5514
|
-
var FAB =
|
|
6497
|
+
var FAB = React38.memo(FABComponent);
|
|
5515
6498
|
var SPRING_NORMAL = { stiffness: 700, damping: 40 };
|
|
5516
6499
|
var SPRING_REDUCED = { stiffness: 1e4, damping: 100 };
|
|
5517
6500
|
var FOCUS_DELAY_MS = 50;
|
|
@@ -5576,7 +6559,7 @@ var ALIGNMENT_TRANSFORM_ORIGIN = {
|
|
|
5576
6559
|
center: "bottom"
|
|
5577
6560
|
};
|
|
5578
6561
|
var ITEM_SPRING = { type: "spring", stiffness: 700, damping: 25 };
|
|
5579
|
-
var
|
|
6562
|
+
var MENU_CONTAINER_VARIANTS2 = {
|
|
5580
6563
|
open: { transition: { staggerChildren: 0.033, staggerDirection: 1 } },
|
|
5581
6564
|
closed: { transition: { staggerChildren: 0.02, staggerDirection: -1 } }
|
|
5582
6565
|
};
|
|
@@ -5619,7 +6602,7 @@ function CloseIcon3() {
|
|
|
5619
6602
|
function defaultFabIcon(progress) {
|
|
5620
6603
|
return progress > 0.5 ? /* @__PURE__ */ jsx(CloseIcon3, {}) : /* @__PURE__ */ jsx(AddIcon, {});
|
|
5621
6604
|
}
|
|
5622
|
-
var ToggleFABComponent =
|
|
6605
|
+
var ToggleFABComponent = React38.forwardRef(
|
|
5623
6606
|
({
|
|
5624
6607
|
expanded,
|
|
5625
6608
|
onToggle,
|
|
@@ -5637,7 +6620,7 @@ var ToggleFABComponent = React31.forwardRef(
|
|
|
5637
6620
|
const sizeTokens = (_b = TOGGLE_FAB_SIZES[fabSize]) != null ? _b : TOGGLE_FAB_SIZES.baseline;
|
|
5638
6621
|
const springConfig = prefersReduced ? SPRING_REDUCED : SPRING_NORMAL;
|
|
5639
6622
|
const checkedProgress = useSpring(expanded ? 1 : 0, springConfig);
|
|
5640
|
-
|
|
6623
|
+
React38.useEffect(() => {
|
|
5641
6624
|
checkedProgress.set(expanded ? 1 : 0);
|
|
5642
6625
|
}, [expanded, checkedProgress]);
|
|
5643
6626
|
const borderRadius = useTransform(
|
|
@@ -5645,12 +6628,12 @@ var ToggleFABComponent = React31.forwardRef(
|
|
|
5645
6628
|
[0, 1],
|
|
5646
6629
|
[`${sizeTokens.initialRadius}px`, `${sizeTokens.finalRadius}px`]
|
|
5647
6630
|
);
|
|
5648
|
-
const [iconProgress, setIconProgress] =
|
|
5649
|
-
|
|
6631
|
+
const [iconProgress, setIconProgress] = React38.useState(expanded ? 1 : 0);
|
|
6632
|
+
React38.useEffect(() => {
|
|
5650
6633
|
return checkedProgress.on("change", setIconProgress);
|
|
5651
6634
|
}, [checkedProgress]);
|
|
5652
6635
|
const { ripples, onPointerDown, removeRipple } = useRippleState();
|
|
5653
|
-
const handleClick =
|
|
6636
|
+
const handleClick = React38.useCallback(() => {
|
|
5654
6637
|
onToggle(!expanded);
|
|
5655
6638
|
}, [expanded, onToggle]);
|
|
5656
6639
|
return /* @__PURE__ */ jsxs(
|
|
@@ -5699,7 +6682,7 @@ var ToggleFABComponent = React31.forwardRef(
|
|
|
5699
6682
|
}
|
|
5700
6683
|
);
|
|
5701
6684
|
ToggleFABComponent.displayName = "ToggleFAB";
|
|
5702
|
-
var ToggleFAB =
|
|
6685
|
+
var ToggleFAB = React38.memo(ToggleFABComponent);
|
|
5703
6686
|
function FABMenuItem({
|
|
5704
6687
|
icon,
|
|
5705
6688
|
label,
|
|
@@ -5712,7 +6695,7 @@ function FABMenuItem({
|
|
|
5712
6695
|
var _a;
|
|
5713
6696
|
const colors = (_a = MENU_ITEM_COLORS[colorVariant]) != null ? _a : MENU_ITEM_COLORS.primary;
|
|
5714
6697
|
const { ripples, onPointerDown, removeRipple } = useRippleState({ disabled });
|
|
5715
|
-
const handleClick =
|
|
6698
|
+
const handleClick = React38.useCallback(
|
|
5716
6699
|
(e) => {
|
|
5717
6700
|
if (disabled) {
|
|
5718
6701
|
e.preventDefault();
|
|
@@ -5722,7 +6705,7 @@ function FABMenuItem({
|
|
|
5722
6705
|
},
|
|
5723
6706
|
[disabled, onClick]
|
|
5724
6707
|
);
|
|
5725
|
-
const handleKeyDown =
|
|
6708
|
+
const handleKeyDown = React38.useCallback(
|
|
5726
6709
|
(e) => {
|
|
5727
6710
|
if (disabled) return;
|
|
5728
6711
|
if (e.key === "Enter" || e.key === " ") {
|
|
@@ -5789,13 +6772,13 @@ function FABMenu({
|
|
|
5789
6772
|
focusLast = true,
|
|
5790
6773
|
"aria-label": ariaLabel
|
|
5791
6774
|
}) {
|
|
5792
|
-
const fabId =
|
|
5793
|
-
const menuId =
|
|
5794
|
-
const toggleRef =
|
|
5795
|
-
const itemRefs =
|
|
5796
|
-
const [focusedIndex, setFocusedIndex] =
|
|
5797
|
-
const reversedItems =
|
|
5798
|
-
const focusItem =
|
|
6775
|
+
const fabId = React38.useId();
|
|
6776
|
+
const menuId = React38.useId();
|
|
6777
|
+
const toggleRef = React38.useRef(null);
|
|
6778
|
+
const itemRefs = React38.useRef([]);
|
|
6779
|
+
const [focusedIndex, setFocusedIndex] = React38.useState(-1);
|
|
6780
|
+
const reversedItems = React38.useMemo(() => [...items].reverse(), [items]);
|
|
6781
|
+
const focusItem = React38.useCallback((index) => {
|
|
5799
6782
|
var _a;
|
|
5800
6783
|
const clampedIndex = Math.max(
|
|
5801
6784
|
0,
|
|
@@ -5804,8 +6787,8 @@ function FABMenu({
|
|
|
5804
6787
|
setFocusedIndex(clampedIndex);
|
|
5805
6788
|
(_a = itemRefs.current[clampedIndex]) == null ? void 0 : _a.focus();
|
|
5806
6789
|
}, []);
|
|
5807
|
-
const wasExpandedRef =
|
|
5808
|
-
|
|
6790
|
+
const wasExpandedRef = React38.useRef(false);
|
|
6791
|
+
React38.useEffect(() => {
|
|
5809
6792
|
var _a;
|
|
5810
6793
|
if (expanded) {
|
|
5811
6794
|
wasExpandedRef.current = true;
|
|
@@ -5820,7 +6803,7 @@ function FABMenu({
|
|
|
5820
6803
|
wasExpandedRef.current = false;
|
|
5821
6804
|
setFocusedIndex(-1);
|
|
5822
6805
|
}, [expanded, focusLast, items.length, focusItem]);
|
|
5823
|
-
const handleMenuKeyDown =
|
|
6806
|
+
const handleMenuKeyDown = React38.useCallback(
|
|
5824
6807
|
(e) => {
|
|
5825
6808
|
if (!expanded) return;
|
|
5826
6809
|
const lastIndex = items.length - 1;
|
|
@@ -5881,7 +6864,7 @@ function FABMenu({
|
|
|
5881
6864
|
role: "menu",
|
|
5882
6865
|
"aria-labelledby": fabId,
|
|
5883
6866
|
"aria-orientation": "vertical",
|
|
5884
|
-
variants:
|
|
6867
|
+
variants: MENU_CONTAINER_VARIANTS2,
|
|
5885
6868
|
initial: "closed",
|
|
5886
6869
|
animate: "open",
|
|
5887
6870
|
exit: "closed",
|
|
@@ -5944,7 +6927,7 @@ function FABMenu({
|
|
|
5944
6927
|
)
|
|
5945
6928
|
] });
|
|
5946
6929
|
}
|
|
5947
|
-
var NavigationRailContext =
|
|
6930
|
+
var NavigationRailContext = React38.createContext({ variant: "collapsed", labelVisibility: "labeled", xr: false });
|
|
5948
6931
|
var MD3_MODAL_TRANSITION = {
|
|
5949
6932
|
type: "tween",
|
|
5950
6933
|
ease: [0.05, 0.7, 0.1, 1],
|
|
@@ -5980,9 +6963,9 @@ var railContainerVariants = cva(
|
|
|
5980
6963
|
}
|
|
5981
6964
|
);
|
|
5982
6965
|
function cloneIconWithFill(icon, selected) {
|
|
5983
|
-
if (!
|
|
6966
|
+
if (!React38.isValidElement(icon)) return icon;
|
|
5984
6967
|
if (icon.type === Icon) {
|
|
5985
|
-
return
|
|
6968
|
+
return React38.cloneElement(
|
|
5986
6969
|
icon,
|
|
5987
6970
|
{ fill: selected ? 1 : 0, animateFill: true }
|
|
5988
6971
|
);
|
|
@@ -6010,11 +6993,11 @@ function ActivePill({ layoutId, disableInitial = false }) {
|
|
|
6010
6993
|
{
|
|
6011
6994
|
layoutId,
|
|
6012
6995
|
className: "absolute inset-0 bg-m3-secondary-container pointer-events-none",
|
|
6013
|
-
style: { borderRadius: 9999, zIndex: 0 },
|
|
6014
|
-
initial: disableInitial ? false : { opacity: 0 },
|
|
6015
|
-
animate: { opacity: 1 },
|
|
6016
|
-
exit: { opacity: 0 },
|
|
6017
|
-
transition:
|
|
6996
|
+
style: { borderRadius: 9999, zIndex: 0, originX: 0.5, originY: 0.5 },
|
|
6997
|
+
initial: disableInitial ? false : { opacity: 0, scale: 0.5 },
|
|
6998
|
+
animate: { opacity: 1, scale: 1 },
|
|
6999
|
+
exit: { opacity: 0, scale: 0.5, transition: { duration: 0.15 } },
|
|
7000
|
+
transition: SPRING_TRANSITION_EXPRESSIVE
|
|
6018
7001
|
}
|
|
6019
7002
|
);
|
|
6020
7003
|
}
|
|
@@ -6040,7 +7023,7 @@ function IconContainer({ selected, badge, children }) {
|
|
|
6040
7023
|
}
|
|
6041
7024
|
);
|
|
6042
7025
|
}
|
|
6043
|
-
var NavigationRailItemComponent =
|
|
7026
|
+
var NavigationRailItemComponent = React38.forwardRef(
|
|
6044
7027
|
({
|
|
6045
7028
|
selected,
|
|
6046
7029
|
icon,
|
|
@@ -6051,18 +7034,18 @@ var NavigationRailItemComponent = React31.forwardRef(
|
|
|
6051
7034
|
className,
|
|
6052
7035
|
"aria-label": ariaLabelProp
|
|
6053
7036
|
}, ref) => {
|
|
6054
|
-
const { variant, labelVisibility } =
|
|
7037
|
+
const { variant, labelVisibility } = React38.useContext(
|
|
6055
7038
|
NavigationRailContext
|
|
6056
7039
|
);
|
|
6057
7040
|
const isExpanded = variant === "expanded" || variant === "modal";
|
|
6058
7041
|
const isModal = variant === "modal";
|
|
6059
7042
|
const enableLayout = !isModal;
|
|
6060
|
-
const activePillId = `rail-pill-${
|
|
7043
|
+
const activePillId = `rail-pill-${React38.useId()}`;
|
|
6061
7044
|
const { ripples, onPointerDown, removeRipple } = useRippleState({
|
|
6062
7045
|
disabled
|
|
6063
7046
|
});
|
|
6064
7047
|
const showLabel = isExpanded || labelVisibility === "labeled" || labelVisibility === "auto" && selected;
|
|
6065
|
-
const handleClick =
|
|
7048
|
+
const handleClick = React38.useCallback(
|
|
6066
7049
|
(e) => {
|
|
6067
7050
|
if (disabled) {
|
|
6068
7051
|
e.preventDefault();
|
|
@@ -6164,9 +7147,9 @@ var NavigationRailItemComponent = React31.forwardRef(
|
|
|
6164
7147
|
}
|
|
6165
7148
|
);
|
|
6166
7149
|
NavigationRailItemComponent.displayName = "NavigationRailItem";
|
|
6167
|
-
var NavigationRailItem =
|
|
7150
|
+
var NavigationRailItem = React38.memo(NavigationRailItemComponent);
|
|
6168
7151
|
function useRoving(navRef) {
|
|
6169
|
-
|
|
7152
|
+
React38.useEffect(() => {
|
|
6170
7153
|
if (!navRef.current) return;
|
|
6171
7154
|
const items = getMenuItems(navRef.current);
|
|
6172
7155
|
const selected = items.find(
|
|
@@ -6176,7 +7159,7 @@ function useRoving(navRef) {
|
|
|
6176
7159
|
const firstFocusable = selected != null ? selected : items[0];
|
|
6177
7160
|
if (firstFocusable) firstFocusable.tabIndex = 0;
|
|
6178
7161
|
}, [navRef]);
|
|
6179
|
-
return
|
|
7162
|
+
return React38.useCallback(
|
|
6180
7163
|
(e) => {
|
|
6181
7164
|
if (!navRef.current) return;
|
|
6182
7165
|
const items = getMenuItems(navRef.current);
|
|
@@ -6204,7 +7187,7 @@ function useRoving(navRef) {
|
|
|
6204
7187
|
[navRef]
|
|
6205
7188
|
);
|
|
6206
7189
|
}
|
|
6207
|
-
var NavigationRailComponent =
|
|
7190
|
+
var NavigationRailComponent = React38.forwardRef(
|
|
6208
7191
|
({
|
|
6209
7192
|
variant = "collapsed",
|
|
6210
7193
|
labelVisibility = "labeled",
|
|
@@ -6224,9 +7207,9 @@ var NavigationRailComponent = React31.forwardRef(
|
|
|
6224
7207
|
const xrMode = xr === "spatialized" ? "spatialized" : "contained";
|
|
6225
7208
|
const isSpatial = isXr && xrMode === "spatialized";
|
|
6226
7209
|
const applyAnimation = !isXr || !isSpatial;
|
|
6227
|
-
const navRef =
|
|
7210
|
+
const navRef = React38.useRef(null);
|
|
6228
7211
|
const handleKeyDown = useRoving(navRef);
|
|
6229
|
-
const setRefs =
|
|
7212
|
+
const setRefs = React38.useCallback(
|
|
6230
7213
|
(node) => {
|
|
6231
7214
|
navRef.current = node;
|
|
6232
7215
|
if (typeof ref === "function") ref(node);
|
|
@@ -6319,7 +7302,7 @@ var NavigationRailComponent = React31.forwardRef(
|
|
|
6319
7302
|
children: fab
|
|
6320
7303
|
}
|
|
6321
7304
|
),
|
|
6322
|
-
|
|
7305
|
+
React38.cloneElement(
|
|
6323
7306
|
navElement,
|
|
6324
7307
|
{
|
|
6325
7308
|
className: cn(navBaseClasses, "pointer-events-auto")
|
|
@@ -6357,13 +7340,13 @@ var NavigationRailComponent = React31.forwardRef(
|
|
|
6357
7340
|
}
|
|
6358
7341
|
);
|
|
6359
7342
|
NavigationRailComponent.displayName = "NavigationRail";
|
|
6360
|
-
var NavigationRail =
|
|
7343
|
+
var NavigationRail = React38.memo(NavigationRailComponent);
|
|
6361
7344
|
var MD3_FAST_EFFECTS2 = [0.3, 0, 1, 1];
|
|
6362
|
-
var RadioGroupContext =
|
|
7345
|
+
var RadioGroupContext = React38.createContext(
|
|
6363
7346
|
null
|
|
6364
7347
|
);
|
|
6365
7348
|
function useMergedRef3(externalRef, internalRef) {
|
|
6366
|
-
return
|
|
7349
|
+
return React38.useCallback(
|
|
6367
7350
|
(node) => {
|
|
6368
7351
|
internalRef.current = node;
|
|
6369
7352
|
if (!externalRef) return;
|
|
@@ -6376,7 +7359,7 @@ function useMergedRef3(externalRef, internalRef) {
|
|
|
6376
7359
|
[externalRef, internalRef]
|
|
6377
7360
|
);
|
|
6378
7361
|
}
|
|
6379
|
-
var RadioVisual =
|
|
7362
|
+
var RadioVisual = React38.memo(function RadioVisual2({
|
|
6380
7363
|
isSelected,
|
|
6381
7364
|
disabled,
|
|
6382
7365
|
error,
|
|
@@ -6429,7 +7412,7 @@ var RadioVisual = React31.memo(function RadioVisual2({
|
|
|
6429
7412
|
}
|
|
6430
7413
|
);
|
|
6431
7414
|
});
|
|
6432
|
-
var RadioButtonComponent =
|
|
7415
|
+
var RadioButtonComponent = React38.forwardRef(
|
|
6433
7416
|
({
|
|
6434
7417
|
selected,
|
|
6435
7418
|
defaultSelected = false,
|
|
@@ -6448,23 +7431,23 @@ var RadioButtonComponent = React31.forwardRef(
|
|
|
6448
7431
|
required: requiredProp
|
|
6449
7432
|
}, ref) => {
|
|
6450
7433
|
var _a, _b;
|
|
6451
|
-
const group =
|
|
7434
|
+
const group = React38.useContext(RadioGroupContext);
|
|
6452
7435
|
const prefersReduced = (_a = useReducedMotion()) != null ? _a : false;
|
|
6453
|
-
const generatedId =
|
|
7436
|
+
const generatedId = React38.useId();
|
|
6454
7437
|
const inputId = idProp != null ? idProp : label ? `radio-${generatedId}` : void 0;
|
|
6455
7438
|
const name = (_b = group == null ? void 0 : group.name) != null ? _b : nameProp;
|
|
6456
7439
|
const disabled = (group == null ? void 0 : group.disabled) || disabledProp;
|
|
6457
7440
|
const error = (group == null ? void 0 : group.error) || errorProp || color === "error";
|
|
6458
7441
|
const required = (group == null ? void 0 : group.required) || requiredProp;
|
|
6459
|
-
const [internalSelected, setInternalSelected] =
|
|
7442
|
+
const [internalSelected, setInternalSelected] = React38.useState(defaultSelected);
|
|
6460
7443
|
const isControlled = selected !== void 0;
|
|
6461
7444
|
const isSelected = group ? group.selectedValue === value : isControlled ? selected != null ? selected : false : internalSelected;
|
|
6462
|
-
const [ripples, setRipples] =
|
|
6463
|
-
const removeRipple =
|
|
7445
|
+
const [ripples, setRipples] = React38.useState([]);
|
|
7446
|
+
const removeRipple = React38.useCallback(
|
|
6464
7447
|
(id) => setRipples((prev) => prev.filter((r) => r.id !== id)),
|
|
6465
7448
|
[]
|
|
6466
7449
|
);
|
|
6467
|
-
const onPointerDown =
|
|
7450
|
+
const onPointerDown = React38.useCallback(
|
|
6468
7451
|
(e) => {
|
|
6469
7452
|
if (disabled) return;
|
|
6470
7453
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
@@ -6478,12 +7461,12 @@ var RadioButtonComponent = React31.forwardRef(
|
|
|
6478
7461
|
},
|
|
6479
7462
|
[disabled]
|
|
6480
7463
|
);
|
|
6481
|
-
const [isHovered, setIsHovered] =
|
|
6482
|
-
const onPointerEnter =
|
|
7464
|
+
const [isHovered, setIsHovered] = React38.useState(false);
|
|
7465
|
+
const onPointerEnter = React38.useCallback(() => {
|
|
6483
7466
|
if (!disabled) setIsHovered(true);
|
|
6484
7467
|
}, [disabled]);
|
|
6485
|
-
const onPointerLeave =
|
|
6486
|
-
const handleChange =
|
|
7468
|
+
const onPointerLeave = React38.useCallback(() => setIsHovered(false), []);
|
|
7469
|
+
const handleChange = React38.useCallback(
|
|
6487
7470
|
(_e) => {
|
|
6488
7471
|
if (disabled || onClick === null) return;
|
|
6489
7472
|
if (group) {
|
|
@@ -6497,7 +7480,7 @@ var RadioButtonComponent = React31.forwardRef(
|
|
|
6497
7480
|
},
|
|
6498
7481
|
[disabled, onClick, group, value, isControlled]
|
|
6499
7482
|
);
|
|
6500
|
-
const inputRef =
|
|
7483
|
+
const inputRef = React38.useRef(null);
|
|
6501
7484
|
const mergedRef = useMergedRef3(ref, inputRef);
|
|
6502
7485
|
const stateLayerBg = error ? "before:bg-m3-error" : "before:bg-m3-primary";
|
|
6503
7486
|
const stateLayerClass = cn(
|
|
@@ -6608,8 +7591,8 @@ var RadioButtonComponent = React31.forwardRef(
|
|
|
6608
7591
|
}
|
|
6609
7592
|
);
|
|
6610
7593
|
RadioButtonComponent.displayName = "RadioButton";
|
|
6611
|
-
var RadioButton =
|
|
6612
|
-
var RadioGroupComponent =
|
|
7594
|
+
var RadioButton = React38.memo(RadioButtonComponent);
|
|
7595
|
+
var RadioGroupComponent = React38.forwardRef(
|
|
6613
7596
|
({
|
|
6614
7597
|
name,
|
|
6615
7598
|
value: valueProp,
|
|
@@ -6624,19 +7607,19 @@ var RadioGroupComponent = React31.forwardRef(
|
|
|
6624
7607
|
children,
|
|
6625
7608
|
className
|
|
6626
7609
|
}, ref) => {
|
|
6627
|
-
const [internalValue, setInternalValue] =
|
|
7610
|
+
const [internalValue, setInternalValue] = React38.useState(defaultValue);
|
|
6628
7611
|
const isControlled = valueProp !== void 0;
|
|
6629
7612
|
const selectedValue = isControlled ? valueProp : internalValue;
|
|
6630
|
-
const handleValueChange =
|
|
7613
|
+
const handleValueChange = React38.useCallback(
|
|
6631
7614
|
(val) => {
|
|
6632
7615
|
if (!isControlled) setInternalValue(val);
|
|
6633
7616
|
onValueChange == null ? void 0 : onValueChange(val);
|
|
6634
7617
|
},
|
|
6635
7618
|
[isControlled, onValueChange]
|
|
6636
7619
|
);
|
|
6637
|
-
const groupRef =
|
|
7620
|
+
const groupRef = React38.useRef(null);
|
|
6638
7621
|
const mergedRef = useMergedRef3(ref, groupRef);
|
|
6639
|
-
const onKeyDown =
|
|
7622
|
+
const onKeyDown = React38.useCallback(
|
|
6640
7623
|
(e) => {
|
|
6641
7624
|
var _a, _b;
|
|
6642
7625
|
if (disabled) return;
|
|
@@ -6660,7 +7643,7 @@ var RadioGroupComponent = React31.forwardRef(
|
|
|
6660
7643
|
},
|
|
6661
7644
|
[disabled, handleValueChange]
|
|
6662
7645
|
);
|
|
6663
|
-
const contextValue =
|
|
7646
|
+
const contextValue = React38.useMemo(
|
|
6664
7647
|
() => ({
|
|
6665
7648
|
name,
|
|
6666
7649
|
selectedValue,
|
|
@@ -6695,7 +7678,7 @@ var RadioGroupComponent = React31.forwardRef(
|
|
|
6695
7678
|
}
|
|
6696
7679
|
);
|
|
6697
7680
|
RadioGroupComponent.displayName = "RadioGroup";
|
|
6698
|
-
var
|
|
7681
|
+
var RadioGroup = React38.memo(RadioGroupComponent);
|
|
6699
7682
|
function useSearchKeyboard({
|
|
6700
7683
|
active,
|
|
6701
7684
|
onActiveChange,
|
|
@@ -6704,14 +7687,14 @@ function useSearchKeyboard({
|
|
|
6704
7687
|
itemCount,
|
|
6705
7688
|
onSelectSuggestion
|
|
6706
7689
|
}) {
|
|
6707
|
-
const [activeIndex, setActiveIndex] =
|
|
6708
|
-
const resetKeyRef =
|
|
7690
|
+
const [activeIndex, setActiveIndex] = React38.useState(-1);
|
|
7691
|
+
const resetKeyRef = React38.useRef(`${active}:${query}`);
|
|
6709
7692
|
const currentKey = `${active}:${query}`;
|
|
6710
7693
|
if (resetKeyRef.current !== currentKey) {
|
|
6711
7694
|
resetKeyRef.current = currentKey;
|
|
6712
7695
|
setActiveIndex(-1);
|
|
6713
7696
|
}
|
|
6714
|
-
const handleKeyDown =
|
|
7697
|
+
const handleKeyDown = React38.useCallback(
|
|
6715
7698
|
(e) => {
|
|
6716
7699
|
if (!active) return;
|
|
6717
7700
|
switch (e.key) {
|
|
@@ -6751,7 +7734,7 @@ function useSearchKeyboard({
|
|
|
6751
7734
|
query
|
|
6752
7735
|
]
|
|
6753
7736
|
);
|
|
6754
|
-
const resetActiveIndex =
|
|
7737
|
+
const resetActiveIndex = React38.useCallback(() => {
|
|
6755
7738
|
setActiveIndex(-1);
|
|
6756
7739
|
}, []);
|
|
6757
7740
|
return { activeIndex, handleKeyDown, resetActiveIndex };
|
|
@@ -6839,10 +7822,10 @@ function AnimatedPlaceholder({
|
|
|
6839
7822
|
className
|
|
6840
7823
|
}) {
|
|
6841
7824
|
const shouldReduceMotion = useReducedMotion();
|
|
6842
|
-
const containerRef =
|
|
6843
|
-
const spanRef =
|
|
6844
|
-
const [xOffset, setXOffset] =
|
|
6845
|
-
const recalculate =
|
|
7825
|
+
const containerRef = React38.useRef(null);
|
|
7826
|
+
const spanRef = React38.useRef(null);
|
|
7827
|
+
const [xOffset, setXOffset] = React38.useState(0);
|
|
7828
|
+
const recalculate = React38.useCallback(() => {
|
|
6846
7829
|
const container = containerRef.current;
|
|
6847
7830
|
const span = spanRef.current;
|
|
6848
7831
|
if (!container || !span || textAlign === "left") {
|
|
@@ -6857,10 +7840,10 @@ function AnimatedPlaceholder({
|
|
|
6857
7840
|
setXOffset(Math.max(0, containerWidth - textWidth));
|
|
6858
7841
|
}
|
|
6859
7842
|
}, [textAlign]);
|
|
6860
|
-
|
|
7843
|
+
React38.useLayoutEffect(() => {
|
|
6861
7844
|
recalculate();
|
|
6862
7845
|
}, [recalculate]);
|
|
6863
|
-
|
|
7846
|
+
React38.useEffect(() => {
|
|
6864
7847
|
const container = containerRef.current;
|
|
6865
7848
|
if (!container) return;
|
|
6866
7849
|
const observer = new ResizeObserver(recalculate);
|
|
@@ -6929,10 +7912,10 @@ function SearchBar({
|
|
|
6929
7912
|
activeIndex
|
|
6930
7913
|
}) {
|
|
6931
7914
|
const shouldReduceMotion = useReducedMotion();
|
|
6932
|
-
const inputRef =
|
|
6933
|
-
const prevActiveRef =
|
|
6934
|
-
const isRestoringFocusRef =
|
|
6935
|
-
|
|
7915
|
+
const inputRef = React38.useRef(null);
|
|
7916
|
+
const prevActiveRef = React38.useRef(active);
|
|
7917
|
+
const isRestoringFocusRef = React38.useRef(false);
|
|
7918
|
+
React38.useEffect(() => {
|
|
6936
7919
|
var _a;
|
|
6937
7920
|
let rafId;
|
|
6938
7921
|
if (prevActiveRef.current === true && active === false) {
|
|
@@ -7051,7 +8034,7 @@ function SearchBar({
|
|
|
7051
8034
|
) })
|
|
7052
8035
|
);
|
|
7053
8036
|
}
|
|
7054
|
-
var SearchContext =
|
|
8037
|
+
var SearchContext = React38.createContext(null);
|
|
7055
8038
|
function SearchProvider({
|
|
7056
8039
|
children,
|
|
7057
8040
|
value
|
|
@@ -7059,7 +8042,7 @@ function SearchProvider({
|
|
|
7059
8042
|
return /* @__PURE__ */ jsx(SearchContext.Provider, { value, children });
|
|
7060
8043
|
}
|
|
7061
8044
|
function useSearch() {
|
|
7062
|
-
const context =
|
|
8045
|
+
const context = React38.useContext(SearchContext);
|
|
7063
8046
|
if (!context) {
|
|
7064
8047
|
return { listboxId: "", activeIndex: -1 };
|
|
7065
8048
|
}
|
|
@@ -7086,7 +8069,7 @@ function useClickOutside(handler, enabled = true) {
|
|
|
7086
8069
|
return ref;
|
|
7087
8070
|
}
|
|
7088
8071
|
function useSearchViewFocus(inputRef, active) {
|
|
7089
|
-
|
|
8072
|
+
React38.useEffect(() => {
|
|
7090
8073
|
if (!active) return;
|
|
7091
8074
|
let raf2;
|
|
7092
8075
|
const raf1 = requestAnimationFrame(() => {
|
|
@@ -7160,7 +8143,7 @@ function SearchViewDocked({
|
|
|
7160
8143
|
activeIndex
|
|
7161
8144
|
}) {
|
|
7162
8145
|
const shouldReduceMotion = useReducedMotion();
|
|
7163
|
-
const inputRef =
|
|
8146
|
+
const inputRef = React38.useRef(null);
|
|
7164
8147
|
useSearchViewFocus(inputRef, active);
|
|
7165
8148
|
const dropdownRef = useClickOutside(() => {
|
|
7166
8149
|
onActiveChange(false);
|
|
@@ -7306,10 +8289,10 @@ function SearchViewFullScreen({
|
|
|
7306
8289
|
activeIndex
|
|
7307
8290
|
}) {
|
|
7308
8291
|
const shouldReduceMotion = useReducedMotion();
|
|
7309
|
-
const inputRef =
|
|
8292
|
+
const inputRef = React38.useRef(null);
|
|
7310
8293
|
useSearchViewFocus(inputRef, active);
|
|
7311
|
-
const [mounted, setMounted] =
|
|
7312
|
-
|
|
8294
|
+
const [mounted, setMounted] = React38.useState(false);
|
|
8295
|
+
React38.useEffect(() => {
|
|
7313
8296
|
setMounted(true);
|
|
7314
8297
|
}, []);
|
|
7315
8298
|
const handleFormSubmit = (e) => {
|
|
@@ -7467,10 +8450,10 @@ function SearchComponent({
|
|
|
7467
8450
|
className,
|
|
7468
8451
|
viewClassName
|
|
7469
8452
|
}) {
|
|
7470
|
-
const generatedId =
|
|
8453
|
+
const generatedId = React38.useId();
|
|
7471
8454
|
const searchId = id != null ? id : generatedId;
|
|
7472
8455
|
const listboxId = `${searchId}-listbox`;
|
|
7473
|
-
const itemCount =
|
|
8456
|
+
const itemCount = React38.Children.count(children);
|
|
7474
8457
|
const { activeIndex, handleKeyDown } = useSearchKeyboard({
|
|
7475
8458
|
active,
|
|
7476
8459
|
onActiveChange,
|
|
@@ -7706,7 +8689,7 @@ var SLIDER_INDICATOR_TRANSITION = {
|
|
|
7706
8689
|
stiffness: 450,
|
|
7707
8690
|
damping: 32
|
|
7708
8691
|
};
|
|
7709
|
-
var ValueIndicator =
|
|
8692
|
+
var ValueIndicator = React38.memo(function ValueIndicator2({
|
|
7710
8693
|
value,
|
|
7711
8694
|
visible,
|
|
7712
8695
|
orientation,
|
|
@@ -7753,7 +8736,7 @@ var ValueIndicator = React31.memo(function ValueIndicator2({
|
|
|
7753
8736
|
"value-indicator"
|
|
7754
8737
|
) });
|
|
7755
8738
|
});
|
|
7756
|
-
var SliderThumb =
|
|
8739
|
+
var SliderThumb = React38.memo(function SliderThumb2({
|
|
7757
8740
|
value,
|
|
7758
8741
|
percent,
|
|
7759
8742
|
min,
|
|
@@ -7785,11 +8768,11 @@ var SliderThumb = React31.memo(function SliderThumb2({
|
|
|
7785
8768
|
[posTarget]: `calc(${trackInset}px + ${percent} * (100% - ${trackInset * 2}px))`
|
|
7786
8769
|
};
|
|
7787
8770
|
const prefersReduced = (_a = useReducedMotion()) != null ? _a : false;
|
|
7788
|
-
const [isDragging, setIsDragging] =
|
|
7789
|
-
const [isHovered, setIsHovered] =
|
|
7790
|
-
const [isFocused, setIsFocused] =
|
|
7791
|
-
const pointerIdRef =
|
|
7792
|
-
const thumbRef =
|
|
8771
|
+
const [isDragging, setIsDragging] = React38.useState(false);
|
|
8772
|
+
const [isHovered, setIsHovered] = React38.useState(false);
|
|
8773
|
+
const [isFocused, setIsFocused] = React38.useState(false);
|
|
8774
|
+
const pointerIdRef = React38.useRef(null);
|
|
8775
|
+
const thumbRef = React38.useRef(null);
|
|
7793
8776
|
const showIndicator = showValueIndicator && (isDragging || isHovered || isFocused);
|
|
7794
8777
|
const positionStyle = isHorizontal ? __spreadProps(__spreadValues({
|
|
7795
8778
|
position: "absolute"
|
|
@@ -7804,7 +8787,7 @@ var SliderThumb = React31.memo(function SliderThumb2({
|
|
|
7804
8787
|
transform: "translate(-50%, 50%)",
|
|
7805
8788
|
zIndex
|
|
7806
8789
|
});
|
|
7807
|
-
const getDeltaFromPointer =
|
|
8790
|
+
const getDeltaFromPointer = React38.useCallback(
|
|
7808
8791
|
(e) => {
|
|
7809
8792
|
const trackEl = trackRef.current;
|
|
7810
8793
|
if (!trackEl) return percent;
|
|
@@ -7831,7 +8814,7 @@ var SliderThumb = React31.memo(function SliderThumb2({
|
|
|
7831
8814
|
},
|
|
7832
8815
|
[isHorizontal, max, min, percent, step, trackRef, trackSize]
|
|
7833
8816
|
);
|
|
7834
|
-
const handlePointerDown =
|
|
8817
|
+
const handlePointerDown = React38.useCallback(
|
|
7835
8818
|
(e) => {
|
|
7836
8819
|
if (disabled) return;
|
|
7837
8820
|
e.preventDefault();
|
|
@@ -7842,7 +8825,7 @@ var SliderThumb = React31.memo(function SliderThumb2({
|
|
|
7842
8825
|
},
|
|
7843
8826
|
[disabled]
|
|
7844
8827
|
);
|
|
7845
|
-
const handlePointerMove =
|
|
8828
|
+
const handlePointerMove = React38.useCallback(
|
|
7846
8829
|
(e) => {
|
|
7847
8830
|
if (!isDragging || e.pointerId !== pointerIdRef.current) return;
|
|
7848
8831
|
const newValue = getDeltaFromPointer(e.nativeEvent);
|
|
@@ -7850,7 +8833,7 @@ var SliderThumb = React31.memo(function SliderThumb2({
|
|
|
7850
8833
|
},
|
|
7851
8834
|
[isDragging, getDeltaFromPointer, onValueChange]
|
|
7852
8835
|
);
|
|
7853
|
-
const handlePointerUp =
|
|
8836
|
+
const handlePointerUp = React38.useCallback(
|
|
7854
8837
|
(e) => {
|
|
7855
8838
|
if (e.pointerId !== pointerIdRef.current) return;
|
|
7856
8839
|
e.currentTarget.releasePointerCapture(e.pointerId);
|
|
@@ -7860,7 +8843,7 @@ var SliderThumb = React31.memo(function SliderThumb2({
|
|
|
7860
8843
|
},
|
|
7861
8844
|
[onValueChangeEnd, value]
|
|
7862
8845
|
);
|
|
7863
|
-
const handleKeyDown =
|
|
8846
|
+
const handleKeyDown = React38.useCallback(
|
|
7864
8847
|
(e) => {
|
|
7865
8848
|
if (disabled) return;
|
|
7866
8849
|
if (e.key === "Home") {
|
|
@@ -7964,7 +8947,7 @@ var SliderThumb = React31.memo(function SliderThumb2({
|
|
|
7964
8947
|
}
|
|
7965
8948
|
);
|
|
7966
8949
|
});
|
|
7967
|
-
var RangeTrack =
|
|
8950
|
+
var RangeTrack = React38.memo(function RangeTrack2({
|
|
7968
8951
|
startPercent,
|
|
7969
8952
|
endPercent,
|
|
7970
8953
|
trackSize,
|
|
@@ -8209,7 +9192,7 @@ var RangeTrack = React31.memo(function RangeTrack2({
|
|
|
8209
9192
|
}
|
|
8210
9193
|
);
|
|
8211
9194
|
});
|
|
8212
|
-
var RangeSliderComponent =
|
|
9195
|
+
var RangeSliderComponent = React38.forwardRef(
|
|
8213
9196
|
({
|
|
8214
9197
|
value: controlledValue,
|
|
8215
9198
|
defaultValue,
|
|
@@ -8233,7 +9216,7 @@ var RangeSliderComponent = React31.forwardRef(
|
|
|
8233
9216
|
const isHorizontal = orientation === "horizontal";
|
|
8234
9217
|
const defaultStart = (_a = defaultValue == null ? void 0 : defaultValue[0]) != null ? _a : min;
|
|
8235
9218
|
const defaultEnd = (_b = defaultValue == null ? void 0 : defaultValue[1]) != null ? _b : max;
|
|
8236
|
-
const [internalValue, setInternalValue] =
|
|
9219
|
+
const [internalValue, setInternalValue] = React38.useState([
|
|
8237
9220
|
defaultStart,
|
|
8238
9221
|
defaultEnd
|
|
8239
9222
|
]);
|
|
@@ -8247,10 +9230,10 @@ var RangeSliderComponent = React31.forwardRef(
|
|
|
8247
9230
|
const endValue = snap(coerce(resolvedValue[1]));
|
|
8248
9231
|
const startPercent = toPercent(startValue);
|
|
8249
9232
|
const endPercent = toPercent(endValue);
|
|
8250
|
-
const [topThumb, setTopThumb] =
|
|
8251
|
-
const trackRef =
|
|
9233
|
+
const [topThumb, setTopThumb] = React38.useState("end");
|
|
9234
|
+
const trackRef = React38.useRef(null);
|
|
8252
9235
|
const minGap = step > 0 ? step : (max - min) / 1e3;
|
|
8253
|
-
const handleStartChange =
|
|
9236
|
+
const handleStartChange = React38.useCallback(
|
|
8254
9237
|
(newStart) => {
|
|
8255
9238
|
setTopThumb("start");
|
|
8256
9239
|
const clamped = Math.min(newStart, endValue - minGap);
|
|
@@ -8262,7 +9245,7 @@ var RangeSliderComponent = React31.forwardRef(
|
|
|
8262
9245
|
},
|
|
8263
9246
|
[controlledValue, coerce, endValue, minGap, onValueChange, snap]
|
|
8264
9247
|
);
|
|
8265
|
-
const handleEndChange =
|
|
9248
|
+
const handleEndChange = React38.useCallback(
|
|
8266
9249
|
(newEnd) => {
|
|
8267
9250
|
setTopThumb("end");
|
|
8268
9251
|
const clamped = Math.max(newEnd, startValue + minGap);
|
|
@@ -8274,15 +9257,15 @@ var RangeSliderComponent = React31.forwardRef(
|
|
|
8274
9257
|
},
|
|
8275
9258
|
[controlledValue, coerce, minGap, onValueChange, snap, startValue]
|
|
8276
9259
|
);
|
|
8277
|
-
const handleStartChangeEnd =
|
|
9260
|
+
const handleStartChangeEnd = React38.useCallback(
|
|
8278
9261
|
(v) => onValueChangeEnd == null ? void 0 : onValueChangeEnd([v, endValue]),
|
|
8279
9262
|
[endValue, onValueChangeEnd]
|
|
8280
9263
|
);
|
|
8281
|
-
const handleEndChangeEnd =
|
|
9264
|
+
const handleEndChangeEnd = React38.useCallback(
|
|
8282
9265
|
(v) => onValueChangeEnd == null ? void 0 : onValueChangeEnd([startValue, v]),
|
|
8283
9266
|
[onValueChangeEnd, startValue]
|
|
8284
9267
|
);
|
|
8285
|
-
const handleTrackPointerDown =
|
|
9268
|
+
const handleTrackPointerDown = React38.useCallback(
|
|
8286
9269
|
(e) => {
|
|
8287
9270
|
if (disabled) return;
|
|
8288
9271
|
const trackEl = trackRef.current;
|
|
@@ -8326,7 +9309,7 @@ var RangeSliderComponent = React31.forwardRef(
|
|
|
8326
9309
|
trackSize
|
|
8327
9310
|
]
|
|
8328
9311
|
);
|
|
8329
|
-
const id =
|
|
9312
|
+
const id = React38.useId();
|
|
8330
9313
|
return /* @__PURE__ */ jsx(LazyMotion, { features: domMax, strict: true, children: /* @__PURE__ */ jsxs(
|
|
8331
9314
|
"div",
|
|
8332
9315
|
{
|
|
@@ -8406,7 +9389,7 @@ var RangeSliderComponent = React31.forwardRef(
|
|
|
8406
9389
|
}
|
|
8407
9390
|
);
|
|
8408
9391
|
RangeSliderComponent.displayName = "RangeSlider";
|
|
8409
|
-
var RangeSlider =
|
|
9392
|
+
var RangeSlider = React38.memo(RangeSliderComponent);
|
|
8410
9393
|
function getHorizontalRadius(isLeading, innerR, outerR) {
|
|
8411
9394
|
if (isLeading) {
|
|
8412
9395
|
return {
|
|
@@ -8445,7 +9428,7 @@ var allInnerRadius = (innerR) => ({
|
|
|
8445
9428
|
borderTopRightRadius: innerR,
|
|
8446
9429
|
borderBottomRightRadius: innerR
|
|
8447
9430
|
});
|
|
8448
|
-
var InsetIcon =
|
|
9431
|
+
var InsetIcon = React38.memo(function InsetIcon2({
|
|
8449
9432
|
icon,
|
|
8450
9433
|
isOnActiveSegment,
|
|
8451
9434
|
position,
|
|
@@ -8539,7 +9522,7 @@ function Ticks({
|
|
|
8539
9522
|
return /* @__PURE__ */ jsx("div", { style, "aria-hidden": "true" }, tick);
|
|
8540
9523
|
}) });
|
|
8541
9524
|
}
|
|
8542
|
-
var SliderTrack =
|
|
9525
|
+
var SliderTrack = React38.memo(function SliderTrack2({
|
|
8543
9526
|
percent,
|
|
8544
9527
|
trackSize,
|
|
8545
9528
|
orientation,
|
|
@@ -8574,8 +9557,8 @@ var SliderTrack = React31.memo(function SliderTrack2({
|
|
|
8574
9557
|
const gapWithThumbStr = `${thumbGap + thumbHalfWidth}px`;
|
|
8575
9558
|
const hasAnyInsetIcon = Boolean(insetIcon || insetIconTrailing);
|
|
8576
9559
|
const prefersReduced = (_a = useReducedMotion()) != null ? _a : false;
|
|
8577
|
-
const [trackWidth, setTrackWidth] =
|
|
8578
|
-
|
|
9560
|
+
const [trackWidth, setTrackWidth] = React38.useState(0);
|
|
9561
|
+
React38.useLayoutEffect(() => {
|
|
8579
9562
|
const el = trackRef.current;
|
|
8580
9563
|
if (!el || !hasAnyInsetIcon) return;
|
|
8581
9564
|
setTrackWidth(isHorizontal ? el.clientWidth : el.clientHeight);
|
|
@@ -8592,8 +9575,8 @@ var SliderTrack = React31.memo(function SliderTrack2({
|
|
|
8592
9575
|
const iconTotalWidth = activeIconSize + SliderTokens.insetIconPadding * 2 + thumbGap + thumbHalfWidth;
|
|
8593
9576
|
const iconThreshold = trackWidth > 0 ? iconTotalWidth / trackWidth : 0.15;
|
|
8594
9577
|
const HYSTERESIS_GAP = 0.04;
|
|
8595
|
-
const trailingActiveRef =
|
|
8596
|
-
const leadingActiveRef =
|
|
9578
|
+
const trailingActiveRef = React38.useRef(1 - percent <= iconThreshold);
|
|
9579
|
+
const leadingActiveRef = React38.useRef(percent > iconThreshold);
|
|
8597
9580
|
const trailingPercent = 1 - percent;
|
|
8598
9581
|
if (trailingActiveRef.current) {
|
|
8599
9582
|
if (trailingPercent > iconThreshold + HYSTERESIS_GAP) {
|
|
@@ -9100,7 +10083,7 @@ var SliderTrack = React31.memo(function SliderTrack2({
|
|
|
9100
10083
|
}
|
|
9101
10084
|
);
|
|
9102
10085
|
});
|
|
9103
|
-
var SliderComponent =
|
|
10086
|
+
var SliderComponent = React38.forwardRef(
|
|
9104
10087
|
({
|
|
9105
10088
|
value: controlledValue,
|
|
9106
10089
|
defaultValue,
|
|
@@ -9129,7 +10112,7 @@ var SliderComponent = React31.forwardRef(
|
|
|
9129
10112
|
const isHorizontal = orientation === "horizontal";
|
|
9130
10113
|
const midpoint = min + (max - min) / 2;
|
|
9131
10114
|
const initialValue = defaultValue != null ? defaultValue : midpoint;
|
|
9132
|
-
const [internalValue, setInternalValue] =
|
|
10115
|
+
const [internalValue, setInternalValue] = React38.useState(initialValue);
|
|
9133
10116
|
const resolvedValue = controlledValue !== void 0 ? controlledValue : internalValue;
|
|
9134
10117
|
const { coerce, snap, toPercent, ticks } = useSliderMath({
|
|
9135
10118
|
min,
|
|
@@ -9138,8 +10121,8 @@ var SliderComponent = React31.forwardRef(
|
|
|
9138
10121
|
});
|
|
9139
10122
|
const safeValue = snap(coerce(resolvedValue));
|
|
9140
10123
|
const percent = toPercent(safeValue);
|
|
9141
|
-
const trackRef =
|
|
9142
|
-
const handleValueChange =
|
|
10124
|
+
const trackRef = React38.useRef(null);
|
|
10125
|
+
const handleValueChange = React38.useCallback(
|
|
9143
10126
|
(newValue) => {
|
|
9144
10127
|
const clamped = snap(coerce(newValue));
|
|
9145
10128
|
if (controlledValue === void 0) {
|
|
@@ -9149,13 +10132,13 @@ var SliderComponent = React31.forwardRef(
|
|
|
9149
10132
|
},
|
|
9150
10133
|
[coerce, controlledValue, onValueChange, snap]
|
|
9151
10134
|
);
|
|
9152
|
-
const handleValueChangeEnd =
|
|
10135
|
+
const handleValueChangeEnd = React38.useCallback(
|
|
9153
10136
|
(newValue) => {
|
|
9154
10137
|
onValueChangeEnd == null ? void 0 : onValueChangeEnd(snap(coerce(newValue)));
|
|
9155
10138
|
},
|
|
9156
10139
|
[coerce, onValueChangeEnd, snap]
|
|
9157
10140
|
);
|
|
9158
|
-
const handleTrackPointerDown =
|
|
10141
|
+
const handleTrackPointerDown = React38.useCallback(
|
|
9159
10142
|
(e) => {
|
|
9160
10143
|
if (disabled) return;
|
|
9161
10144
|
const trackEl = trackRef.current;
|
|
@@ -9190,7 +10173,7 @@ var SliderComponent = React31.forwardRef(
|
|
|
9190
10173
|
trackSize
|
|
9191
10174
|
]
|
|
9192
10175
|
);
|
|
9193
|
-
const id =
|
|
10176
|
+
const id = React38.useId();
|
|
9194
10177
|
const thumbId = `slider-thumb-${id}`;
|
|
9195
10178
|
const supportsInsetIcon = !isCentered && SliderTokens.trackSizes[trackSize] >= 40;
|
|
9196
10179
|
const hasAnyInsetIcon = !!(insetIcon || insetIconTrailing);
|
|
@@ -9262,7 +10245,7 @@ var SliderComponent = React31.forwardRef(
|
|
|
9262
10245
|
}
|
|
9263
10246
|
);
|
|
9264
10247
|
SliderComponent.displayName = "Slider";
|
|
9265
|
-
var Slider =
|
|
10248
|
+
var Slider = React38.memo(SliderComponent);
|
|
9266
10249
|
var DURATION_MAP = {
|
|
9267
10250
|
short: 4e3,
|
|
9268
10251
|
long: 7e3
|
|
@@ -9308,9 +10291,9 @@ function toSnackbarData(item) {
|
|
|
9308
10291
|
return { id: generateId(), visuals: item.visuals, resolve: item.resolve };
|
|
9309
10292
|
}
|
|
9310
10293
|
function useSnackbarState() {
|
|
9311
|
-
const [current, setCurrent] =
|
|
9312
|
-
const queueRef =
|
|
9313
|
-
const showSnackbar =
|
|
10294
|
+
const [current, setCurrent] = React38.useState(null);
|
|
10295
|
+
const queueRef = React38.useRef([]);
|
|
10296
|
+
const showSnackbar = React38.useCallback(
|
|
9314
10297
|
(visuals) => {
|
|
9315
10298
|
return new Promise((resolve) => {
|
|
9316
10299
|
const item = { visuals, resolve };
|
|
@@ -9323,14 +10306,14 @@ function useSnackbarState() {
|
|
|
9323
10306
|
},
|
|
9324
10307
|
[]
|
|
9325
10308
|
);
|
|
9326
|
-
const _dismiss =
|
|
10309
|
+
const _dismiss = React38.useCallback((result) => {
|
|
9327
10310
|
setCurrent((prev) => {
|
|
9328
10311
|
if (prev) prev.resolve(result);
|
|
9329
10312
|
const next = queueRef.current.shift();
|
|
9330
10313
|
return next ? toSnackbarData(next) : null;
|
|
9331
10314
|
});
|
|
9332
10315
|
}, []);
|
|
9333
|
-
|
|
10316
|
+
React38.useEffect(() => {
|
|
9334
10317
|
return () => {
|
|
9335
10318
|
for (const item of queueRef.current) {
|
|
9336
10319
|
item.resolve(RESULT.DISMISSED);
|
|
@@ -9340,7 +10323,7 @@ function useSnackbarState() {
|
|
|
9340
10323
|
}, []);
|
|
9341
10324
|
return { current, showSnackbar, _dismiss };
|
|
9342
10325
|
}
|
|
9343
|
-
var Snackbar =
|
|
10326
|
+
var Snackbar = React38.memo(function Snackbar2({
|
|
9344
10327
|
data,
|
|
9345
10328
|
className
|
|
9346
10329
|
}) {
|
|
@@ -9354,15 +10337,15 @@ var Snackbar = React31.memo(function Snackbar2({
|
|
|
9354
10337
|
} = visuals;
|
|
9355
10338
|
const reducedMotion = useReducedMotion();
|
|
9356
10339
|
const durationMs = resolveDuration(duration);
|
|
9357
|
-
|
|
10340
|
+
React38.useEffect(() => {
|
|
9358
10341
|
const timer = setTimeout(() => resolve(RESULT.DISMISSED), durationMs);
|
|
9359
10342
|
return () => clearTimeout(timer);
|
|
9360
10343
|
}, [resolve, durationMs]);
|
|
9361
|
-
const handleAction =
|
|
10344
|
+
const handleAction = React38.useCallback(
|
|
9362
10345
|
() => resolve(RESULT.ACTION),
|
|
9363
10346
|
[resolve]
|
|
9364
10347
|
);
|
|
9365
|
-
const handleDismiss =
|
|
10348
|
+
const handleDismiss = React38.useCallback(
|
|
9366
10349
|
() => resolve(RESULT.DISMISSED),
|
|
9367
10350
|
[resolve]
|
|
9368
10351
|
);
|
|
@@ -9430,7 +10413,7 @@ var Snackbar = React31.memo(function Snackbar2({
|
|
|
9430
10413
|
Snackbar.displayName = "Snackbar";
|
|
9431
10414
|
function SnackbarHost({ state, className }) {
|
|
9432
10415
|
const { current, _dismiss } = state;
|
|
9433
|
-
const wrappedData =
|
|
10416
|
+
const wrappedData = React38.useMemo(() => {
|
|
9434
10417
|
if (!current) return null;
|
|
9435
10418
|
return __spreadProps(__spreadValues({}, current), { resolve: _dismiss });
|
|
9436
10419
|
}, [current, _dismiss]);
|
|
@@ -9448,12 +10431,12 @@ function SnackbarHost({ state, className }) {
|
|
|
9448
10431
|
) });
|
|
9449
10432
|
}
|
|
9450
10433
|
SnackbarHost.displayName = "SnackbarHost";
|
|
9451
|
-
var SnackbarContext =
|
|
10434
|
+
var SnackbarContext = React38.createContext(
|
|
9452
10435
|
null
|
|
9453
10436
|
);
|
|
9454
10437
|
function SnackbarProvider({ children }) {
|
|
9455
10438
|
const state = useSnackbarState();
|
|
9456
|
-
const contextValue =
|
|
10439
|
+
const contextValue = React38.useMemo(
|
|
9457
10440
|
() => ({ showSnackbar: state.showSnackbar }),
|
|
9458
10441
|
[state.showSnackbar]
|
|
9459
10442
|
);
|
|
@@ -9464,7 +10447,7 @@ function SnackbarProvider({ children }) {
|
|
|
9464
10447
|
}
|
|
9465
10448
|
SnackbarProvider.displayName = "SnackbarProvider";
|
|
9466
10449
|
function useSnackbar() {
|
|
9467
|
-
const ctx =
|
|
10450
|
+
const ctx = React38.useContext(SnackbarContext);
|
|
9468
10451
|
if (!ctx) {
|
|
9469
10452
|
throw new Error("useSnackbar must be used within a <SnackbarProvider>.");
|
|
9470
10453
|
}
|
|
@@ -9527,7 +10510,7 @@ var SwitchColors = {
|
|
|
9527
10510
|
// Focus indicator
|
|
9528
10511
|
focusIndicator: "var(--md-sys-color-secondary)"
|
|
9529
10512
|
};
|
|
9530
|
-
var
|
|
10513
|
+
var FAST_SPATIAL_SPRING2 = {
|
|
9531
10514
|
type: "spring",
|
|
9532
10515
|
stiffness: 500,
|
|
9533
10516
|
damping: 40
|
|
@@ -9568,7 +10551,7 @@ function isIconVisible(thumbContent, icons, showOnlySelectedIcon, checked) {
|
|
|
9568
10551
|
if (icons) return true;
|
|
9569
10552
|
return showOnlySelectedIcon && checked;
|
|
9570
10553
|
}
|
|
9571
|
-
var SwitchVisual =
|
|
10554
|
+
var SwitchVisual = React38.memo(function SwitchVisual2({
|
|
9572
10555
|
checked,
|
|
9573
10556
|
disabled,
|
|
9574
10557
|
isPressed,
|
|
@@ -9659,9 +10642,9 @@ var SwitchVisual = React31.memo(function SwitchVisual2({
|
|
|
9659
10642
|
backgroundColor: thumbBg
|
|
9660
10643
|
},
|
|
9661
10644
|
transition: prefersReduced ? { duration: 0 } : isPressed ? SNAP_TRANSITION : {
|
|
9662
|
-
x:
|
|
9663
|
-
width:
|
|
9664
|
-
height:
|
|
10645
|
+
x: FAST_SPATIAL_SPRING2,
|
|
10646
|
+
width: FAST_SPATIAL_SPRING2,
|
|
10647
|
+
height: FAST_SPATIAL_SPRING2,
|
|
9665
10648
|
backgroundColor: colorTransition
|
|
9666
10649
|
},
|
|
9667
10650
|
children: /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", children: showIcon && /* @__PURE__ */ jsx(
|
|
@@ -9688,7 +10671,7 @@ var SwitchVisual = React31.memo(function SwitchVisual2({
|
|
|
9688
10671
|
}
|
|
9689
10672
|
);
|
|
9690
10673
|
});
|
|
9691
|
-
var SwitchComponent =
|
|
10674
|
+
var SwitchComponent = React38.forwardRef(
|
|
9692
10675
|
({
|
|
9693
10676
|
checked,
|
|
9694
10677
|
onCheckedChange,
|
|
@@ -9706,16 +10689,16 @@ var SwitchComponent = React31.forwardRef(
|
|
|
9706
10689
|
}, ref) => {
|
|
9707
10690
|
var _a;
|
|
9708
10691
|
const prefersReduced = (_a = useReducedMotion()) != null ? _a : false;
|
|
9709
|
-
const [isPressed, setIsPressed] =
|
|
9710
|
-
const [isHovered, setIsHovered] =
|
|
9711
|
-
const [isFocused, setIsFocused] =
|
|
9712
|
-
const [ripples, setRipples] =
|
|
9713
|
-
const generatedId =
|
|
10692
|
+
const [isPressed, setIsPressed] = React38.useState(false);
|
|
10693
|
+
const [isHovered, setIsHovered] = React38.useState(false);
|
|
10694
|
+
const [isFocused, setIsFocused] = React38.useState(false);
|
|
10695
|
+
const [ripples, setRipples] = React38.useState([]);
|
|
10696
|
+
const generatedId = React38.useId();
|
|
9714
10697
|
const switchId = label ? `switch-${generatedId}` : void 0;
|
|
9715
|
-
const handleClick =
|
|
10698
|
+
const handleClick = React38.useCallback(() => {
|
|
9716
10699
|
if (!disabled) onCheckedChange(!checked);
|
|
9717
10700
|
}, [disabled, checked, onCheckedChange]);
|
|
9718
|
-
const handleKeyDown =
|
|
10701
|
+
const handleKeyDown = React38.useCallback(
|
|
9719
10702
|
(e) => {
|
|
9720
10703
|
if (disabled) return;
|
|
9721
10704
|
if (e.key === " " || e.key === "Enter") {
|
|
@@ -9725,7 +10708,7 @@ var SwitchComponent = React31.forwardRef(
|
|
|
9725
10708
|
},
|
|
9726
10709
|
[disabled, checked, onCheckedChange]
|
|
9727
10710
|
);
|
|
9728
|
-
const handlePointerDown =
|
|
10711
|
+
const handlePointerDown = React38.useCallback(
|
|
9729
10712
|
(e) => {
|
|
9730
10713
|
if (disabled) return;
|
|
9731
10714
|
setIsPressed(true);
|
|
@@ -9740,19 +10723,19 @@ var SwitchComponent = React31.forwardRef(
|
|
|
9740
10723
|
},
|
|
9741
10724
|
[disabled]
|
|
9742
10725
|
);
|
|
9743
|
-
const handlePointerUp =
|
|
10726
|
+
const handlePointerUp = React38.useCallback(() => {
|
|
9744
10727
|
setIsPressed(false);
|
|
9745
10728
|
}, []);
|
|
9746
|
-
const handlePointerEnter =
|
|
10729
|
+
const handlePointerEnter = React38.useCallback(() => {
|
|
9747
10730
|
if (!disabled) setIsHovered(true);
|
|
9748
10731
|
}, [disabled]);
|
|
9749
|
-
const handlePointerLeave =
|
|
10732
|
+
const handlePointerLeave = React38.useCallback(() => {
|
|
9750
10733
|
setIsHovered(false);
|
|
9751
10734
|
setIsPressed(false);
|
|
9752
10735
|
}, []);
|
|
9753
|
-
const handleFocus =
|
|
9754
|
-
const handleBlur =
|
|
9755
|
-
const removeRipple =
|
|
10736
|
+
const handleFocus = React38.useCallback(() => setIsFocused(true), []);
|
|
10737
|
+
const handleBlur = React38.useCallback(() => setIsFocused(false), []);
|
|
10738
|
+
const removeRipple = React38.useCallback(
|
|
9756
10739
|
(id) => setRipples((prev) => prev.filter((r) => r.id !== id)),
|
|
9757
10740
|
[]
|
|
9758
10741
|
);
|
|
@@ -9837,10 +10820,54 @@ var SwitchComponent = React31.forwardRef(
|
|
|
9837
10820
|
}
|
|
9838
10821
|
);
|
|
9839
10822
|
SwitchComponent.displayName = "Switch";
|
|
9840
|
-
var Switch =
|
|
9841
|
-
var
|
|
10823
|
+
var Switch = React38.memo(SwitchComponent);
|
|
10824
|
+
var typographyVariants = cva("m-0 p-0 text-m3-on-surface", {
|
|
10825
|
+
variants: {
|
|
10826
|
+
variant: {
|
|
10827
|
+
"display-lg": "text-[57px] leading-[64px] font-normal tracking-[-0.25px]",
|
|
10828
|
+
"display-md": "text-[45px] leading-[52px] font-normal tracking-[0px]",
|
|
10829
|
+
"display-sm": "text-[36px] leading-[44px] font-normal tracking-[0px]",
|
|
10830
|
+
"headline-lg": "text-[32px] leading-[40px] font-normal tracking-[0px]",
|
|
10831
|
+
"headline-md": "text-[28px] leading-[36px] font-normal tracking-[0px]",
|
|
10832
|
+
"headline-sm": "text-[24px] leading-[32px] font-normal tracking-[0px]",
|
|
10833
|
+
"title-lg": "text-[22px] leading-[28px] font-normal tracking-[0px]",
|
|
10834
|
+
"title-md": "text-[16px] leading-[24px] font-medium tracking-[0.15px]",
|
|
10835
|
+
"title-sm": "text-[14px] leading-[20px] font-medium tracking-[0.1px]",
|
|
10836
|
+
"label-lg": "text-[14px] leading-[20px] font-medium tracking-[0.1px]",
|
|
10837
|
+
"label-md": "text-[12px] leading-[16px] font-medium tracking-[0.5px]",
|
|
10838
|
+
"label-sm": "text-[11px] leading-[16px] font-medium tracking-[0.5px]",
|
|
10839
|
+
"body-lg": "text-[16px] leading-[24px] font-normal tracking-[0.5px]",
|
|
10840
|
+
"body-md": "text-[14px] leading-[20px] font-normal tracking-[0.25px]",
|
|
10841
|
+
"body-sm": "text-[12px] leading-[16px] font-normal tracking-[0.4px]"
|
|
10842
|
+
}
|
|
10843
|
+
},
|
|
10844
|
+
defaultVariants: {
|
|
10845
|
+
variant: "body-md"
|
|
10846
|
+
}
|
|
10847
|
+
});
|
|
10848
|
+
var Text = React38.forwardRef(
|
|
10849
|
+
(_a, ref) => {
|
|
10850
|
+
var _b = _a, { className, variant, as: Component } = _b, props = __objRest(_b, ["className", "variant", "as"]);
|
|
10851
|
+
const defaultComponent = React38.useMemo(() => {
|
|
10852
|
+
if ((variant == null ? void 0 : variant.startsWith("display")) || (variant == null ? void 0 : variant.startsWith("headline")))
|
|
10853
|
+
return "h1";
|
|
10854
|
+
if (variant == null ? void 0 : variant.startsWith("title")) return "h2";
|
|
10855
|
+
return "p";
|
|
10856
|
+
}, [variant]);
|
|
10857
|
+
const Tag = Component || defaultComponent;
|
|
10858
|
+
return /* @__PURE__ */ jsx(
|
|
10859
|
+
Tag,
|
|
10860
|
+
__spreadValues({
|
|
10861
|
+
ref,
|
|
10862
|
+
className: cn(typographyVariants({ variant, className }))
|
|
10863
|
+
}, props)
|
|
10864
|
+
);
|
|
10865
|
+
}
|
|
10866
|
+
);
|
|
10867
|
+
Text.displayName = "Text";
|
|
10868
|
+
var TabsContext = React38.createContext(null);
|
|
9842
10869
|
function useTabsContext() {
|
|
9843
|
-
const ctx =
|
|
10870
|
+
const ctx = React38.useContext(TabsContext);
|
|
9844
10871
|
if (!ctx) {
|
|
9845
10872
|
throw new Error(
|
|
9846
10873
|
"[MD3 Tabs] Component must be used within a <Tabs> root. Ensure <TabsList>, <Tab>, and <TabsContent> are descendants of <Tabs>."
|
|
@@ -9848,7 +10875,7 @@ function useTabsContext() {
|
|
|
9848
10875
|
}
|
|
9849
10876
|
return ctx;
|
|
9850
10877
|
}
|
|
9851
|
-
var TabsComponent =
|
|
10878
|
+
var TabsComponent = React38.forwardRef(
|
|
9852
10879
|
({
|
|
9853
10880
|
value: controlledValue,
|
|
9854
10881
|
defaultValue = "",
|
|
@@ -9857,35 +10884,35 @@ var TabsComponent = React31.forwardRef(
|
|
|
9857
10884
|
children,
|
|
9858
10885
|
className
|
|
9859
10886
|
}, ref) => {
|
|
9860
|
-
const [internalValue, setInternalValue] =
|
|
10887
|
+
const [internalValue, setInternalValue] = React38.useState(defaultValue);
|
|
9861
10888
|
const isControlled = controlledValue !== void 0;
|
|
9862
10889
|
const value = isControlled ? controlledValue : internalValue;
|
|
9863
|
-
const handleValueChange =
|
|
10890
|
+
const handleValueChange = React38.useCallback(
|
|
9864
10891
|
(newValue) => {
|
|
9865
10892
|
if (!isControlled) setInternalValue(newValue);
|
|
9866
10893
|
onValueChange == null ? void 0 : onValueChange(newValue);
|
|
9867
10894
|
},
|
|
9868
10895
|
[isControlled, onValueChange]
|
|
9869
10896
|
);
|
|
9870
|
-
const [focusedValue, setFocusedValue] =
|
|
9871
|
-
|
|
10897
|
+
const [focusedValue, setFocusedValue] = React38.useState(value);
|
|
10898
|
+
React38.useEffect(() => {
|
|
9872
10899
|
setFocusedValue(value);
|
|
9873
10900
|
}, [value]);
|
|
9874
|
-
const [tabValues, setTabValues] =
|
|
9875
|
-
const registerTab =
|
|
10901
|
+
const [tabValues, setTabValues] = React38.useState([]);
|
|
10902
|
+
const registerTab = React38.useCallback((tabValue) => {
|
|
9876
10903
|
setTabValues((prev) => {
|
|
9877
10904
|
if (prev.includes(tabValue)) return prev;
|
|
9878
10905
|
return [...prev, tabValue];
|
|
9879
10906
|
});
|
|
9880
10907
|
}, []);
|
|
9881
|
-
const unregisterTab =
|
|
10908
|
+
const unregisterTab = React38.useCallback((tabValue) => {
|
|
9882
10909
|
setTabValues((prev) => prev.filter((v) => v !== tabValue));
|
|
9883
10910
|
}, []);
|
|
9884
|
-
const hasAutoSelected =
|
|
9885
|
-
const [disabledValues, setDisabledValues] =
|
|
10911
|
+
const hasAutoSelected = React38.useRef(false);
|
|
10912
|
+
const [disabledValues, setDisabledValues] = React38.useState(
|
|
9886
10913
|
/* @__PURE__ */ new Set()
|
|
9887
10914
|
);
|
|
9888
|
-
const markTabDisabled =
|
|
10915
|
+
const markTabDisabled = React38.useCallback(
|
|
9889
10916
|
(tabValue, disabled) => {
|
|
9890
10917
|
setDisabledValues((prev) => {
|
|
9891
10918
|
const next = new Set(prev);
|
|
@@ -9899,7 +10926,7 @@ var TabsComponent = React31.forwardRef(
|
|
|
9899
10926
|
},
|
|
9900
10927
|
[]
|
|
9901
10928
|
);
|
|
9902
|
-
|
|
10929
|
+
React38.useEffect(() => {
|
|
9903
10930
|
if (isControlled || hasAutoSelected.current || tabValues.length === 0) {
|
|
9904
10931
|
return;
|
|
9905
10932
|
}
|
|
@@ -9914,9 +10941,9 @@ var TabsComponent = React31.forwardRef(
|
|
|
9914
10941
|
setFocusedValue(firstEnabled);
|
|
9915
10942
|
}
|
|
9916
10943
|
}, [tabValues, disabledValues, isControlled, value]);
|
|
9917
|
-
const id =
|
|
10944
|
+
const id = React38.useId();
|
|
9918
10945
|
const layoutGroupId = `tabs-${id}`;
|
|
9919
|
-
const contextValue =
|
|
10946
|
+
const contextValue = React38.useMemo(
|
|
9920
10947
|
() => ({
|
|
9921
10948
|
value,
|
|
9922
10949
|
onValueChange: handleValueChange,
|
|
@@ -9947,12 +10974,12 @@ var TabsComponent = React31.forwardRef(
|
|
|
9947
10974
|
}
|
|
9948
10975
|
);
|
|
9949
10976
|
TabsComponent.displayName = "Tabs";
|
|
9950
|
-
var Tabs =
|
|
9951
|
-
var TabsListContext =
|
|
10977
|
+
var Tabs = React38.memo(TabsComponent);
|
|
10978
|
+
var TabsListContext = React38.createContext(
|
|
9952
10979
|
null
|
|
9953
10980
|
);
|
|
9954
10981
|
function useTabsListContext() {
|
|
9955
|
-
const ctx =
|
|
10982
|
+
const ctx = React38.useContext(TabsListContext);
|
|
9956
10983
|
return ctx != null ? ctx : { variant: "primary", scrollable: false };
|
|
9957
10984
|
}
|
|
9958
10985
|
|
|
@@ -10036,7 +11063,7 @@ var TABS_CONTENT_TRANSITION = {
|
|
|
10036
11063
|
ease: "easeInOut"
|
|
10037
11064
|
};
|
|
10038
11065
|
var INDICATOR_MIN_WIDTH = 24;
|
|
10039
|
-
var TabComponent =
|
|
11066
|
+
var TabComponent = React38.forwardRef(
|
|
10040
11067
|
({
|
|
10041
11068
|
value,
|
|
10042
11069
|
icon,
|
|
@@ -10066,9 +11093,9 @@ var TabComponent = React31.forwardRef(
|
|
|
10066
11093
|
const isFocused = focusedValue === value;
|
|
10067
11094
|
const hasIcon = icon != null;
|
|
10068
11095
|
const isStackedIcon = hasIcon && !inlineIcon;
|
|
10069
|
-
const buttonRef =
|
|
10070
|
-
const isFirstMount =
|
|
10071
|
-
const mergedRef =
|
|
11096
|
+
const buttonRef = React38.useRef(null);
|
|
11097
|
+
const isFirstMount = React38.useRef(true);
|
|
11098
|
+
const mergedRef = React38.useCallback(
|
|
10072
11099
|
(node) => {
|
|
10073
11100
|
buttonRef.current = node;
|
|
10074
11101
|
if (typeof ref === "function") ref(node);
|
|
@@ -10076,15 +11103,15 @@ var TabComponent = React31.forwardRef(
|
|
|
10076
11103
|
},
|
|
10077
11104
|
[ref]
|
|
10078
11105
|
);
|
|
10079
|
-
|
|
11106
|
+
React38.useEffect(() => {
|
|
10080
11107
|
registerTab(value);
|
|
10081
11108
|
return () => unregisterTab(value);
|
|
10082
11109
|
}, [value, registerTab, unregisterTab]);
|
|
10083
|
-
|
|
11110
|
+
React38.useEffect(() => {
|
|
10084
11111
|
markTabDisabled(value, disabled);
|
|
10085
11112
|
return () => markTabDisabled(value, false);
|
|
10086
11113
|
}, [value, disabled, markTabDisabled]);
|
|
10087
|
-
const handleKeyDown =
|
|
11114
|
+
const handleKeyDown = React38.useCallback(
|
|
10088
11115
|
(e) => {
|
|
10089
11116
|
const isRtl = buttonRef.current ? getComputedStyle(buttonRef.current).direction === "rtl" : false;
|
|
10090
11117
|
const enabledValues = tabValues.filter((v) => !disabledValues.has(v));
|
|
@@ -10138,7 +11165,7 @@ var TabComponent = React31.forwardRef(
|
|
|
10138
11165
|
autoActivate
|
|
10139
11166
|
]
|
|
10140
11167
|
);
|
|
10141
|
-
|
|
11168
|
+
React38.useEffect(() => {
|
|
10142
11169
|
if (isFirstMount.current) {
|
|
10143
11170
|
isFirstMount.current = false;
|
|
10144
11171
|
return;
|
|
@@ -10147,7 +11174,7 @@ var TabComponent = React31.forwardRef(
|
|
|
10147
11174
|
buttonRef.current.focus({ preventScroll: true });
|
|
10148
11175
|
}
|
|
10149
11176
|
}, [isFocused]);
|
|
10150
|
-
|
|
11177
|
+
React38.useEffect(() => {
|
|
10151
11178
|
if (!isActive || !scrollable || !buttonRef.current) return;
|
|
10152
11179
|
const btn = buttonRef.current;
|
|
10153
11180
|
let container = btn.parentElement;
|
|
@@ -10284,8 +11311,8 @@ var TabComponent = React31.forwardRef(
|
|
|
10284
11311
|
}
|
|
10285
11312
|
);
|
|
10286
11313
|
TabComponent.displayName = "Tab";
|
|
10287
|
-
var Tab =
|
|
10288
|
-
var TabsContentComponent =
|
|
11314
|
+
var Tab = React38.memo(TabComponent);
|
|
11315
|
+
var TabsContentComponent = React38.forwardRef(
|
|
10289
11316
|
({ value, className, children }, ref) => {
|
|
10290
11317
|
var _a;
|
|
10291
11318
|
const { value: selectedValue, layoutGroupId } = useTabsContext();
|
|
@@ -10319,8 +11346,8 @@ var TabsContentComponent = React31.forwardRef(
|
|
|
10319
11346
|
}
|
|
10320
11347
|
);
|
|
10321
11348
|
TabsContentComponent.displayName = "TabsContent";
|
|
10322
|
-
var TabsContent =
|
|
10323
|
-
var TabsListComponent =
|
|
11349
|
+
var TabsContent = React38.memo(TabsContentComponent);
|
|
11350
|
+
var TabsListComponent = React38.forwardRef(
|
|
10324
11351
|
({
|
|
10325
11352
|
variant,
|
|
10326
11353
|
scrollable = false,
|
|
@@ -10331,12 +11358,12 @@ var TabsListComponent = React31.forwardRef(
|
|
|
10331
11358
|
}, ref) => {
|
|
10332
11359
|
const { layoutGroupId, value, setFocusedValue } = useTabsContext();
|
|
10333
11360
|
const listLayoutId = `${layoutGroupId}-list`;
|
|
10334
|
-
const listContextValue =
|
|
11361
|
+
const listContextValue = React38.useMemo(
|
|
10335
11362
|
() => ({ variant, scrollable }),
|
|
10336
11363
|
[variant, scrollable]
|
|
10337
11364
|
);
|
|
10338
11365
|
const bgColor = backgroundColor != null ? backgroundColor : "var(--md-sys-color-surface)";
|
|
10339
|
-
const handleBlur =
|
|
11366
|
+
const handleBlur = React38.useCallback(
|
|
10340
11367
|
(e) => {
|
|
10341
11368
|
const listEl = e.currentTarget;
|
|
10342
11369
|
if (listEl.contains(e.relatedTarget)) return;
|
|
@@ -10385,7 +11412,7 @@ var TabsListComponent = React31.forwardRef(
|
|
|
10385
11412
|
}
|
|
10386
11413
|
);
|
|
10387
11414
|
TabsListComponent.displayName = "TabsList";
|
|
10388
|
-
var TabsList =
|
|
11415
|
+
var TabsList = React38.memo(TabsListComponent);
|
|
10389
11416
|
|
|
10390
11417
|
// src/ui/text-field/text-field.tokens.ts
|
|
10391
11418
|
var TF_COLORS = {
|
|
@@ -10424,7 +11451,7 @@ var TF_TYPOGRAPHY = {
|
|
|
10424
11451
|
var TF_CLASSES = {
|
|
10425
11452
|
// Prefix / Suffix
|
|
10426
11453
|
prefixSuffix: "text-base text-[var(--color-m3-on-surface-variant)] select-none shrink-0"};
|
|
10427
|
-
var ActiveIndicator =
|
|
11454
|
+
var ActiveIndicator = React38.memo(function ActiveIndicator2({
|
|
10428
11455
|
isFocused,
|
|
10429
11456
|
isError,
|
|
10430
11457
|
isDisabled,
|
|
@@ -10471,7 +11498,7 @@ function getLabelColor(isFloated, isFocused, isError, isDisabled) {
|
|
|
10471
11498
|
if (isFloated && isFocused) return TF_COLORS.primary;
|
|
10472
11499
|
return TF_COLORS.onSurfaceVariant;
|
|
10473
11500
|
}
|
|
10474
|
-
var FloatingLabel =
|
|
11501
|
+
var FloatingLabel = React38.memo(function FloatingLabel2({
|
|
10475
11502
|
text,
|
|
10476
11503
|
isFloated,
|
|
10477
11504
|
isFocused,
|
|
@@ -10531,7 +11558,7 @@ var FloatingLabel = React31.memo(function FloatingLabel2({
|
|
|
10531
11558
|
);
|
|
10532
11559
|
});
|
|
10533
11560
|
FloatingLabel.displayName = "FloatingLabel";
|
|
10534
|
-
var LeadingIcon =
|
|
11561
|
+
var LeadingIcon = React38.memo(function LeadingIcon2({
|
|
10535
11562
|
children,
|
|
10536
11563
|
isError,
|
|
10537
11564
|
isDisabled
|
|
@@ -10555,7 +11582,7 @@ function getOutlineColor(isFocused, isError, isHovered, isDisabled) {
|
|
|
10555
11582
|
if (isHovered) return TF_COLORS.inputText;
|
|
10556
11583
|
return TF_COLORS.outline;
|
|
10557
11584
|
}
|
|
10558
|
-
var OutlineContainer =
|
|
11585
|
+
var OutlineContainer = React38.memo(function OutlineContainer2({
|
|
10559
11586
|
isFloated,
|
|
10560
11587
|
isFocused,
|
|
10561
11588
|
isError,
|
|
@@ -10653,7 +11680,7 @@ var OutlineContainer = React31.memo(function OutlineContainer2({
|
|
|
10653
11680
|
);
|
|
10654
11681
|
});
|
|
10655
11682
|
OutlineContainer.displayName = "OutlineContainer";
|
|
10656
|
-
var PrefixSuffix =
|
|
11683
|
+
var PrefixSuffix = React38.memo(function PrefixSuffix2({
|
|
10657
11684
|
text,
|
|
10658
11685
|
type,
|
|
10659
11686
|
visible,
|
|
@@ -10695,7 +11722,7 @@ function AnimatedText({
|
|
|
10695
11722
|
motionKey
|
|
10696
11723
|
);
|
|
10697
11724
|
}
|
|
10698
|
-
var SupportingText =
|
|
11725
|
+
var SupportingText = React38.memo(function SupportingText2({
|
|
10699
11726
|
supportingText,
|
|
10700
11727
|
errorText,
|
|
10701
11728
|
isError,
|
|
@@ -10806,7 +11833,7 @@ function ClearIcon() {
|
|
|
10806
11833
|
}
|
|
10807
11834
|
);
|
|
10808
11835
|
}
|
|
10809
|
-
var TrailingIcon =
|
|
11836
|
+
var TrailingIcon = React38.memo(function TrailingIcon2({
|
|
10810
11837
|
mode,
|
|
10811
11838
|
children,
|
|
10812
11839
|
value,
|
|
@@ -10872,7 +11899,7 @@ var TrailingIcon = React31.memo(function TrailingIcon2({
|
|
|
10872
11899
|
});
|
|
10873
11900
|
TrailingIcon.displayName = "TrailingIcon";
|
|
10874
11901
|
var LINE_HEIGHT_PX = 24;
|
|
10875
|
-
var TextFieldComponent =
|
|
11902
|
+
var TextFieldComponent = React38.forwardRef(
|
|
10876
11903
|
({
|
|
10877
11904
|
// Core
|
|
10878
11905
|
variant = "filled",
|
|
@@ -10936,30 +11963,30 @@ var TextFieldComponent = React31.forwardRef(
|
|
|
10936
11963
|
}, ref) => {
|
|
10937
11964
|
var _a;
|
|
10938
11965
|
const prefersReduced = (_a = useReducedMotion()) != null ? _a : false;
|
|
10939
|
-
const generatedId =
|
|
11966
|
+
const generatedId = React38.useId();
|
|
10940
11967
|
const inputId = idProp != null ? idProp : `tf-${generatedId}`;
|
|
10941
11968
|
const supportingId = `${inputId}-supporting`;
|
|
10942
11969
|
const isControlled = valueProp !== void 0;
|
|
10943
|
-
const [internalValue, setInternalValue] =
|
|
11970
|
+
const [internalValue, setInternalValue] = React38.useState(defaultValue);
|
|
10944
11971
|
const currentValue = isControlled ? valueProp : internalValue;
|
|
10945
|
-
const [isFocused, setIsFocused] =
|
|
10946
|
-
const [showPassword, setShowPassword] =
|
|
11972
|
+
const [isFocused, setIsFocused] = React38.useState(false);
|
|
11973
|
+
const [showPassword, setShowPassword] = React38.useState(false);
|
|
10947
11974
|
const resolvedInputType = type === "password" && showPassword ? "text" : type;
|
|
10948
|
-
const [nativeError, setNativeError] =
|
|
10949
|
-
const [labelWidth, setLabelWidth] =
|
|
11975
|
+
const [nativeError, setNativeError] = React38.useState("");
|
|
11976
|
+
const [labelWidth, setLabelWidth] = React38.useState(0);
|
|
10950
11977
|
const hasValue = currentValue.length > 0;
|
|
10951
11978
|
const isFloated = isFocused || hasValue;
|
|
10952
11979
|
const isError = errorProp || !!nativeError || maxLength !== void 0 && currentValue.length > maxLength;
|
|
10953
11980
|
const containerHeight = dense ? TF_SIZE.denseHeight : TF_SIZE.height;
|
|
10954
11981
|
const showAsterisk = required && !noAsterisk;
|
|
10955
|
-
const inputRef =
|
|
10956
|
-
const labelSpanRef =
|
|
10957
|
-
|
|
11982
|
+
const inputRef = React38.useRef(null);
|
|
11983
|
+
const labelSpanRef = React38.useRef(null);
|
|
11984
|
+
React38.useLayoutEffect(() => {
|
|
10958
11985
|
if (labelSpanRef.current) {
|
|
10959
11986
|
setLabelWidth(labelSpanRef.current.offsetWidth);
|
|
10960
11987
|
}
|
|
10961
11988
|
}, []);
|
|
10962
|
-
|
|
11989
|
+
React38.useLayoutEffect(() => {
|
|
10963
11990
|
if (type !== "textarea" || !inputRef.current) return;
|
|
10964
11991
|
const textarea = inputRef.current;
|
|
10965
11992
|
if (autoResize) {
|
|
@@ -10971,7 +11998,7 @@ var TextFieldComponent = React31.forwardRef(
|
|
|
10971
11998
|
}
|
|
10972
11999
|
textarea.style.overflowY = "hidden";
|
|
10973
12000
|
}, [type, autoResize, maxRows, currentValue]);
|
|
10974
|
-
const handleValueChange =
|
|
12001
|
+
const handleValueChange = React38.useCallback(
|
|
10975
12002
|
(newValue) => {
|
|
10976
12003
|
var _a2, _b;
|
|
10977
12004
|
if (!isControlled) setInternalValue(newValue);
|
|
@@ -10980,7 +12007,7 @@ var TextFieldComponent = React31.forwardRef(
|
|
|
10980
12007
|
},
|
|
10981
12008
|
[isControlled]
|
|
10982
12009
|
);
|
|
10983
|
-
const handleChange =
|
|
12010
|
+
const handleChange = React38.useCallback(
|
|
10984
12011
|
(e) => {
|
|
10985
12012
|
const newVal = e.target.value;
|
|
10986
12013
|
handleValueChange(newVal);
|
|
@@ -10988,14 +12015,14 @@ var TextFieldComponent = React31.forwardRef(
|
|
|
10988
12015
|
},
|
|
10989
12016
|
[handleValueChange, onChange]
|
|
10990
12017
|
);
|
|
10991
|
-
const handleFocus =
|
|
12018
|
+
const handleFocus = React38.useCallback(
|
|
10992
12019
|
(e) => {
|
|
10993
12020
|
setIsFocused(true);
|
|
10994
12021
|
onFocus == null ? void 0 : onFocus(e);
|
|
10995
12022
|
},
|
|
10996
12023
|
[onFocus]
|
|
10997
12024
|
);
|
|
10998
|
-
const handleBlur =
|
|
12025
|
+
const handleBlur = React38.useCallback(
|
|
10999
12026
|
(e) => {
|
|
11000
12027
|
setIsFocused(false);
|
|
11001
12028
|
const el = inputRef.current;
|
|
@@ -11008,7 +12035,7 @@ var TextFieldComponent = React31.forwardRef(
|
|
|
11008
12035
|
},
|
|
11009
12036
|
[onBlur]
|
|
11010
12037
|
);
|
|
11011
|
-
const handleClear =
|
|
12038
|
+
const handleClear = React38.useCallback(() => {
|
|
11012
12039
|
var _a2;
|
|
11013
12040
|
handleValueChange("");
|
|
11014
12041
|
onChange == null ? void 0 : onChange("", {
|
|
@@ -11016,12 +12043,12 @@ var TextFieldComponent = React31.forwardRef(
|
|
|
11016
12043
|
});
|
|
11017
12044
|
(_a2 = inputRef.current) == null ? void 0 : _a2.focus();
|
|
11018
12045
|
}, [handleValueChange, onChange]);
|
|
11019
|
-
const handlePasswordToggle =
|
|
12046
|
+
const handlePasswordToggle = React38.useCallback(() => {
|
|
11020
12047
|
var _a2;
|
|
11021
12048
|
setShowPassword((prev) => !prev);
|
|
11022
12049
|
(_a2 = inputRef.current) == null ? void 0 : _a2.focus();
|
|
11023
12050
|
}, []);
|
|
11024
|
-
|
|
12051
|
+
React38.useImperativeHandle(
|
|
11025
12052
|
ref,
|
|
11026
12053
|
() => ({
|
|
11027
12054
|
focus: () => {
|
|
@@ -11266,7 +12293,7 @@ var TextFieldComponent = React31.forwardRef(
|
|
|
11266
12293
|
}
|
|
11267
12294
|
);
|
|
11268
12295
|
TextFieldComponent.displayName = "TextField";
|
|
11269
|
-
var TextField =
|
|
12296
|
+
var TextField = React38.memo(TextFieldComponent);
|
|
11270
12297
|
|
|
11271
12298
|
// src/ui/typography/typography-key-tokens.ts
|
|
11272
12299
|
var TypographyKeyTokens = /* @__PURE__ */ ((TypographyKeyTokens2) => {
|
|
@@ -12027,7 +13054,8 @@ function MD3ThemeProvider({
|
|
|
12027
13054
|
STORAGE_KEY_MODE
|
|
12028
13055
|
);
|
|
12029
13056
|
if (savedColor) setSourceColor(savedColor);
|
|
12030
|
-
if (savedMode === "light" || savedMode === "dark"
|
|
13057
|
+
if (savedMode === "light" || savedMode === "dark" || savedMode === "system")
|
|
13058
|
+
setMode(savedMode);
|
|
12031
13059
|
setIsHydrated(true);
|
|
12032
13060
|
}, [persistToLocalStorage]);
|
|
12033
13061
|
useEffect(() => {
|
|
@@ -12038,9 +13066,17 @@ function MD3ThemeProvider({
|
|
|
12038
13066
|
localStorage.setItem(STORAGE_KEY_MODE, mode);
|
|
12039
13067
|
}
|
|
12040
13068
|
}, [sourceColor, mode, persistToLocalStorage, isHydrated]);
|
|
13069
|
+
useEffect(() => {
|
|
13070
|
+
if (mode !== "system" || typeof window === "undefined") return;
|
|
13071
|
+
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
13072
|
+
const handleChange = () => applyTheme(sourceColor, "system");
|
|
13073
|
+
mediaQuery.addEventListener("change", handleChange);
|
|
13074
|
+
return () => mediaQuery.removeEventListener("change", handleChange);
|
|
13075
|
+
}, [mode, sourceColor]);
|
|
13076
|
+
const effectiveMode = resolveMode(mode);
|
|
12041
13077
|
const themeValue = useMemo(
|
|
12042
|
-
() => ({ sourceColor, setSourceColor, mode, setMode }),
|
|
12043
|
-
[sourceColor, mode]
|
|
13078
|
+
() => ({ sourceColor, setSourceColor, mode, setMode, effectiveMode }),
|
|
13079
|
+
[sourceColor, mode, effectiveMode]
|
|
12044
13080
|
);
|
|
12045
13081
|
const typographyValue = useMemo(() => {
|
|
12046
13082
|
if (typographyProp) return typographyProp;
|
|
@@ -12072,8 +13108,8 @@ function useTheme() {
|
|
|
12072
13108
|
return context;
|
|
12073
13109
|
}
|
|
12074
13110
|
function useThemeMode() {
|
|
12075
|
-
const { mode, setMode } = useTheme();
|
|
12076
|
-
return { mode, setMode };
|
|
13111
|
+
const { mode, setMode, effectiveMode } = useTheme();
|
|
13112
|
+
return { mode, setMode, effectiveMode };
|
|
12077
13113
|
}
|
|
12078
13114
|
function TableOfContents({
|
|
12079
13115
|
items,
|
|
@@ -12711,7 +13747,7 @@ function TooltipBox({
|
|
|
12711
13747
|
onKeyDown: handleKeyDown,
|
|
12712
13748
|
"aria-label": ariaLabel,
|
|
12713
13749
|
"aria-describedby": state.isVisible ? tooltipId : void 0,
|
|
12714
|
-
children:
|
|
13750
|
+
children: React38.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children })
|
|
12715
13751
|
}
|
|
12716
13752
|
),
|
|
12717
13753
|
mounted && createPortal(
|
|
@@ -12741,6 +13777,6 @@ function TooltipBox({
|
|
|
12741
13777
|
] });
|
|
12742
13778
|
}
|
|
12743
13779
|
|
|
12744
|
-
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,
|
|
13780
|
+
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, resolveMode, useAppBarScroll, useRipple as useDOMRipple, useMediaQuery, useMenuContext, useRipple2 as useRipple, useRippleState, useSearchKeyboard, useSnackbar, useSnackbarState, useTheme, useThemeMode, useTooltipPosition, useTooltipState, useTypography };
|
|
12745
13781
|
//# sourceMappingURL=index.mjs.map
|
|
12746
13782
|
//# sourceMappingURL=index.mjs.map
|