@womp/kookie-ui 0.29.2 → 0.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/components.css +86 -0
  2. package/dist/cjs/components/_internal/navigator-host.d.ts +21 -0
  3. package/dist/cjs/components/_internal/navigator-host.d.ts.map +1 -0
  4. package/dist/cjs/components/_internal/navigator-host.js +3 -0
  5. package/dist/cjs/components/_internal/navigator-host.js.map +7 -0
  6. package/dist/cjs/components/combobox.js +1 -1
  7. package/dist/cjs/components/combobox.js.map +4 -4
  8. package/dist/cjs/components/dialog.d.ts.map +1 -1
  9. package/dist/cjs/components/dialog.js +1 -1
  10. package/dist/cjs/components/dialog.js.map +4 -4
  11. package/dist/cjs/components/index.d.ts +1 -0
  12. package/dist/cjs/components/index.d.ts.map +1 -1
  13. package/dist/cjs/components/index.js +2 -2
  14. package/dist/cjs/components/index.js.map +4 -4
  15. package/dist/cjs/components/navigator.d.ts +99 -0
  16. package/dist/cjs/components/navigator.d.ts.map +1 -0
  17. package/dist/cjs/components/navigator.js +3 -0
  18. package/dist/cjs/components/navigator.js.map +7 -0
  19. package/dist/cjs/components/popover.d.ts.map +1 -1
  20. package/dist/cjs/components/popover.js +1 -1
  21. package/dist/cjs/components/popover.js.map +4 -4
  22. package/dist/cjs/components/sheet.d.ts.map +1 -1
  23. package/dist/cjs/components/sheet.js +1 -1
  24. package/dist/cjs/components/sheet.js.map +4 -4
  25. package/dist/cjs/components/sidebar.js +1 -1
  26. package/dist/cjs/components/sidebar.js.map +4 -4
  27. package/dist/cjs/index.js +5 -5
  28. package/dist/cjs/index.js.map +4 -4
  29. package/dist/esm/chunk-4KBKS3ZE.js +3 -0
  30. package/dist/esm/chunk-4KBKS3ZE.js.map +7 -0
  31. package/dist/esm/chunk-5KX3RA3P.js +3 -0
  32. package/dist/esm/chunk-5KX3RA3P.js.map +7 -0
  33. package/dist/esm/chunk-6UFIS6B2.js +3 -0
  34. package/dist/esm/chunk-6UFIS6B2.js.map +7 -0
  35. package/dist/esm/chunk-CMHKCUHP.js +3 -0
  36. package/dist/esm/chunk-CMHKCUHP.js.map +7 -0
  37. package/dist/esm/{chunk-4LV37PHM.js → chunk-D74WY6UO.js} +2 -2
  38. package/dist/esm/chunk-E4KT72IB.js +2 -0
  39. package/dist/esm/chunk-EQE6QQXM.js +3 -0
  40. package/dist/esm/chunk-EQE6QQXM.js.map +7 -0
  41. package/dist/esm/{chunk-2E57H3NH.js → chunk-FRFVGYGX.js} +2 -2
  42. package/dist/esm/{chunk-2FYUM6TA.js → chunk-NEKIU24N.js} +2 -2
  43. package/dist/esm/{chunk-WAXRIARV.js → chunk-R4UKO4UK.js} +2 -2
  44. package/dist/esm/{chunk-AS2STDGA.js → chunk-VGJALIJ5.js} +2 -2
  45. package/dist/esm/{chunk-JTMLFTNZ.js → chunk-WAE4MLBN.js} +2 -2
  46. package/dist/esm/{chunk-MJROOEPE.js → chunk-YMRN5ESN.js} +2 -2
  47. package/dist/esm/{chunk-324VC67W.js → chunk-ZYQEFENG.js} +2 -2
  48. package/dist/esm/components/_internal/base-menu.utils.js +1 -1
  49. package/dist/esm/components/_internal/menu-context.js +1 -1
  50. package/dist/esm/components/_internal/navigator-host.d.ts +21 -0
  51. package/dist/esm/components/_internal/navigator-host.d.ts.map +1 -0
  52. package/dist/esm/components/_internal/navigator-host.js +3 -0
  53. package/dist/esm/components/_internal/navigator-host.js.map +7 -0
  54. package/dist/esm/components/_internal/pane-chrome.js +1 -1
  55. package/dist/esm/components/_internal/shell-sidebar.js +1 -1
  56. package/dist/esm/components/alert-dialog.js +1 -1
  57. package/dist/esm/components/combobox.js +1 -1
  58. package/dist/esm/components/context-menu.js +1 -1
  59. package/dist/esm/components/dialog.d.ts.map +1 -1
  60. package/dist/esm/components/dialog.js +1 -1
  61. package/dist/esm/components/dropdown-menu.js +1 -1
  62. package/dist/esm/components/index.d.ts +1 -0
  63. package/dist/esm/components/index.d.ts.map +1 -1
  64. package/dist/esm/components/index.js +1 -1
  65. package/dist/esm/components/navigator.d.ts +99 -0
  66. package/dist/esm/components/navigator.d.ts.map +1 -0
  67. package/dist/esm/components/navigator.js +3 -0
  68. package/dist/esm/components/navigator.js.map +7 -0
  69. package/dist/esm/components/popover.d.ts.map +1 -1
  70. package/dist/esm/components/popover.js +1 -1
  71. package/dist/esm/components/schemas/index.js +1 -1
  72. package/dist/esm/components/separator.js +1 -1
  73. package/dist/esm/components/sheet.d.ts.map +1 -1
  74. package/dist/esm/components/sheet.js +1 -1
  75. package/dist/esm/components/shell.js +1 -1
  76. package/dist/esm/components/sidebar.js +1 -1
  77. package/dist/esm/components/toolbar.js +1 -1
  78. package/dist/esm/components/virtual-menu.js +1 -1
  79. package/dist/esm/hooks/index.js +1 -1
  80. package/dist/esm/index.js +1 -1
  81. package/package.json +1 -1
  82. package/src/components/_internal/navigator-host.ts +17 -0
  83. package/src/components/dialog.tsx +8 -0
  84. package/src/components/index.css +1 -0
  85. package/src/components/index.tsx +14 -0
  86. package/src/components/navigator.css +85 -0
  87. package/src/components/navigator.tsx +385 -0
  88. package/src/components/popover.tsx +18 -1
  89. package/src/components/sheet.tsx +8 -0
  90. package/styles.css +86 -0
  91. package/dist/esm/chunk-5BX2YZV6.js +0 -3
  92. package/dist/esm/chunk-5BX2YZV6.js.map +0 -7
  93. package/dist/esm/chunk-HR2VHGJ5.js +0 -3
  94. package/dist/esm/chunk-HR2VHGJ5.js.map +0 -7
  95. package/dist/esm/chunk-MJKVVGGV.js +0 -3
  96. package/dist/esm/chunk-MJKVVGGV.js.map +0 -7
  97. package/dist/esm/chunk-NG54K6FL.js +0 -2
  98. /package/dist/esm/{chunk-4LV37PHM.js.map → chunk-D74WY6UO.js.map} +0 -0
  99. /package/dist/esm/{chunk-NG54K6FL.js.map → chunk-E4KT72IB.js.map} +0 -0
  100. /package/dist/esm/{chunk-2E57H3NH.js.map → chunk-FRFVGYGX.js.map} +0 -0
  101. /package/dist/esm/{chunk-2FYUM6TA.js.map → chunk-NEKIU24N.js.map} +0 -0
  102. /package/dist/esm/{chunk-WAXRIARV.js.map → chunk-R4UKO4UK.js.map} +0 -0
  103. /package/dist/esm/{chunk-AS2STDGA.js.map → chunk-VGJALIJ5.js.map} +0 -0
  104. /package/dist/esm/{chunk-JTMLFTNZ.js.map → chunk-WAE4MLBN.js.map} +0 -0
  105. /package/dist/esm/{chunk-MJROOEPE.js.map → chunk-YMRN5ESN.js.map} +0 -0
  106. /package/dist/esm/{chunk-324VC67W.js.map → chunk-ZYQEFENG.js.map} +0 -0
@@ -0,0 +1,85 @@
1
+ /* Navigator (from v2, 2026-11-03): a stack of screens. It paints nothing; the host is the region.
2
+ * No motion: v1 has none, so a screen changes at once. */
3
+ .kui-Navigator,
4
+ .kui-NavigatorLevel,
5
+ .kui-NavigatorScreen {
6
+ display: flex;
7
+ flex-direction: column;
8
+ min-block-size: 0;
9
+ }
10
+
11
+ /* A screen outside a pane: the band, holding Back, the title and Close, then the body. The band
12
+ sits one step closer to the panel's edge than the content, stated against the panel's own
13
+ padding so it moves with the panel's size; the body starts a section's distance under it. */
14
+ .kui-NavigatorBar {
15
+ margin-block-start: calc(-1 * var(--layout-space-2));
16
+ margin-inline: calc(-1 * var(--layout-space-2));
17
+ margin-block-end: var(--layout-space-6);
18
+ }
19
+
20
+ /* The title stays beside Back at the leading edge, and Close goes to the far end. This sheet
21
+ loads after the toolbar's, so the same specificity wins. */
22
+ .kui-NavigatorBarTitle {
23
+ margin-inline-end: auto;
24
+ min-inline-size: 0;
25
+ }
26
+
27
+ /* With no Back before it, the title lines up with the content under it. */
28
+ .kui-NavigatorBarTitle:where(:first-child) {
29
+ padding-inline-start: var(--layout-space-2);
30
+ }
31
+
32
+ .kui-NavigatorBackGlyph,
33
+ .kui-NavigatorLinkGlyph {
34
+ inline-size: 1em;
35
+ block-size: 1em;
36
+ }
37
+
38
+ .kui-NavigatorBackGlyph:where(:dir(rtl)),
39
+ .kui-NavigatorLinkGlyph:where(:dir(rtl)) {
40
+ transform: scaleX(-1);
41
+ }
42
+
43
+ /* A row that opens the next screen: its label, and a quiet chevron at the end. */
44
+ .kui-NavigatorLink {
45
+ display: flex;
46
+ align-items: center;
47
+ gap: var(--layout-space-3);
48
+ inline-size: 100%;
49
+ min-block-size: var(--control-height-3);
50
+ padding-inline: var(--layout-space-3);
51
+ border-radius: var(--radius-control-3);
52
+ color: var(--gray-12);
53
+ font-size: var(--font-size-3);
54
+ line-height: var(--line-height-3);
55
+ text-align: start;
56
+ cursor: var(--cursor-button);
57
+ }
58
+
59
+ .kui-NavigatorLinkLabel {
60
+ display: flex;
61
+ align-items: center;
62
+ gap: var(--layout-space-3);
63
+ flex: 1;
64
+ min-inline-size: 0;
65
+ }
66
+
67
+ .kui-NavigatorLinkGlyph {
68
+ flex-shrink: 0;
69
+ color: var(--gray-a10);
70
+ }
71
+
72
+ @media (hover: hover) {
73
+ .kui-NavigatorLink:where(:hover) {
74
+ background-color: var(--gray-a3);
75
+ }
76
+ }
77
+
78
+ .kui-NavigatorLink:where(:active) {
79
+ background-color: var(--gray-a4);
80
+ }
81
+
82
+ .kui-NavigatorLink:where(:focus-visible) {
83
+ outline: 2px solid var(--focus-8);
84
+ outline-offset: -2px;
85
+ }
@@ -0,0 +1,385 @@
1
+ 'use client';
2
+
3
+ /**
4
+ * Navigator, from v2 (2026-11-03): a stack of screens, any depth. Any screen can open another on
5
+ * top of it, and Back removes the top one. The first screen is the root and never goes.
6
+ *
7
+ * THE PATH IS DATA. The screens above the root are a list of values the app owns, and `screen`
8
+ * turns a value into a screen, so an app can keep the path in its URL, restore it, or open three
9
+ * levels deep from a link.
10
+ *
11
+ * IT HAS NO REGION OF ITS OWN. The host decides how a screen carries its title. In a Shell pane
12
+ * (Sidebar, Panel, Inspector, Bottom), the pane's band holds Back and the title, and the screens
13
+ * go in the pane's scroller. Anywhere else (a card, a Dialog, a Sheet, a Popover, `Shell.Content`)
14
+ * each screen draws its own band: Back, the title, and the overlay's close when it has one.
15
+ *
16
+ * SCREENS UNDER THE TOP STAY MOUNTED, hidden, so a list keeps its scroll and a field its draft.
17
+ *
18
+ * Focus: a pushed screen takes focus at its top; on pop, focus returns to the control that opened
19
+ * the screen. Escape never goes back; it belongs to whatever overlay holds this.
20
+ *
21
+ * Differs from v2 in look only: no motion, since v1 has none. v1 has no Page or Row yet, so a pane
22
+ * screen's title lives in the band from the start, and `NavigatorLink` is its own row.
23
+ */
24
+
25
+ import * as React from 'react';
26
+ import classNames from 'classnames';
27
+
28
+ import { NavigatorHostContext } from './_internal/navigator-host.js';
29
+ import { PaneHeader, Scroll, ShellContentContext } from './_internal/pane-chrome.js';
30
+ import { ShellStoreContext } from './_internal/shell-store.js';
31
+ import { Flex } from './flex.js';
32
+ import { Heading } from './heading.js';
33
+ import { Toolbar, ToolbarButton, ToolbarTitle } from './toolbar.js';
34
+
35
+ type NavigatorApi<T> = {
36
+ /** The values above the root, bottom first. Empty at the root. */
37
+ path: readonly T[];
38
+ /** Open a screen on top. */
39
+ push: (value: T) => void;
40
+ /** Close the top screen. Does nothing at the root. */
41
+ pop: () => void;
42
+ /** Close every screen above `depth`, where 0 is the root. */
43
+ popTo: (depth: number) => void;
44
+ /** Whether there is a screen to go back to. */
45
+ canGoBack: boolean;
46
+ };
47
+
48
+ type NavigatorState = NavigatorApi<unknown> & {
49
+ /** Each level's title, so Back can name the screen it returns to and a pane's band can show it. */
50
+ titles: React.MutableRefObject<(string | undefined)[]>;
51
+ setTitle: (depth: number, title: string) => void;
52
+ /** The control that opened each level, so focus can go back to it. */
53
+ openers: React.MutableRefObject<(HTMLElement | null)[]>;
54
+ direction: 'push' | 'pop' | null;
55
+ inPane: boolean;
56
+ };
57
+
58
+ const NavigatorContext = React.createContext<NavigatorState | null>(null);
59
+ const LevelContext = React.createContext<number>(0);
60
+ const OutletContext = React.createContext<React.ReactNode>(null);
61
+
62
+ /**
63
+ * True in a Shell pane, not in `Shell.Content` and not in an overlay opened from the pane: there
64
+ * the pane's band carries the title. Overlays set the host context, which is how they opt out.
65
+ */
66
+ function useInPane() {
67
+ const store = React.useContext(ShellStoreContext);
68
+ const inContent = React.useContext(ShellContentContext);
69
+ const host = React.useContext(NavigatorHostContext);
70
+ return store !== null && !inContent && host === null;
71
+ }
72
+
73
+ // Activity keeps a hidden screen's state and cleans up its effects (React 19.2). On an older
74
+ // React, the screen is kept in a hidden element instead, with its effects still running.
75
+ const Activity = (React as { Activity?: React.ComponentType<{ mode: 'visible' | 'hidden'; children: React.ReactNode }> }).Activity;
76
+
77
+ function Level({ visible, children }: { visible: boolean; children: React.ReactNode }) {
78
+ if (Activity) return <Activity mode={visible ? 'visible' : 'hidden'}>{children}</Activity>;
79
+ return (
80
+ <div hidden={!visible} style={{ display: visible ? 'contents' : 'none' }}>
81
+ {children}
82
+ </div>
83
+ );
84
+ }
85
+
86
+ interface NavigatorProps<T> {
87
+ /** The screens above the root, as values. Use it with `onPathChange` to control the path. */
88
+ path?: readonly T[];
89
+ /** The path to start with when the navigator controls its own path. */
90
+ defaultPath?: readonly T[];
91
+ /** Called with the new path whenever a screen opens or closes. */
92
+ onPathChange?: (path: T[]) => void;
93
+ /** Turns a value from the path into its screen, usually a `NavigatorScreen`. */
94
+ screen: (value: T) => React.ReactNode;
95
+ /** The root screen, usually a `NavigatorScreen`. It is always at the bottom and never closes. */
96
+ root: React.ReactNode;
97
+ /**
98
+ * The frame around the screens, when you need your own: a `Shell.PaneHeader` with actions, and
99
+ * a `Shell.Scroll` holding `NavigatorOutlet`. Leave it out and the navigator draws the frame: in
100
+ * a Shell pane, the pane's band with Back and the title, and its scroller; anywhere else, the
101
+ * screens on their own.
102
+ */
103
+ children?: React.ReactNode;
104
+ className?: string;
105
+ style?: React.CSSProperties;
106
+ }
107
+
108
+ /**
109
+ * A stack of screens: any screen can open another on top, and Back returns to the one below.
110
+ * `root` is the first screen, `screen` turns each value in the path into its screen, and
111
+ * `children`, when given, is the frame the screens go into through `NavigatorOutlet`.
112
+ */
113
+ function Navigator<T>({ path: pathProp, defaultPath, onPathChange, screen, root, children, className, style }: NavigatorProps<T>) {
114
+ const inPane = useInPane();
115
+ const [own, setOwn] = React.useState<readonly T[]>(defaultPath ?? []);
116
+ const path = pathProp ?? own;
117
+ // The direction comes from the path itself, so a path the app sets moves focus the same way as
118
+ // one changed by push and pop. Equal length with a new top value is a new screen arriving.
119
+ const [seen, setSeen] = React.useState<{ path: readonly T[]; direction: 'push' | 'pop' | null }>({ path, direction: null });
120
+ let direction = seen.direction;
121
+ // Compared by content, not identity: a controlled `path` may be a new array every render.
122
+ if (seen.path.length !== path.length || seen.path.some((value, i) => !Object.is(value, path[i]))) {
123
+ const before = seen.path;
124
+ direction = path.length < before.length ? 'pop' : path.length > before.length || !Object.is(path[path.length - 1], before[before.length - 1]) ? 'push' : seen.direction;
125
+ setSeen({ path, direction });
126
+ }
127
+ const titles = React.useRef<(string | undefined)[]>([]);
128
+ const openers = React.useRef<(HTMLElement | null)[]>([]);
129
+ const [version, setVersion] = React.useState(0);
130
+
131
+ const change = React.useCallback(
132
+ (next: T[]) => {
133
+ if (pathProp === undefined) setOwn(next);
134
+ onPathChange?.(next);
135
+ },
136
+ [pathProp, onPathChange],
137
+ );
138
+
139
+ const api = React.useMemo<NavigatorState>(
140
+ () => ({
141
+ path,
142
+ canGoBack: path.length > 0,
143
+ push: (value) => {
144
+ openers.current[path.length + 1] = typeof document === 'undefined' ? null : (document.activeElement as HTMLElement | null);
145
+ change([...path, value as T]);
146
+ },
147
+ pop: () => {
148
+ if (path.length > 0) change(path.slice(0, -1));
149
+ },
150
+ popTo: (depth) => {
151
+ if (depth < path.length) change(path.slice(0, Math.max(0, depth)));
152
+ },
153
+ titles,
154
+ openers,
155
+ setTitle: (depth, title) => {
156
+ if (titles.current[depth] === title) return;
157
+ titles.current[depth] = title;
158
+ setVersion((v) => v + 1);
159
+ },
160
+ direction,
161
+ inPane,
162
+ }),
163
+ // `version` is read through `titles`; it is here so a new title reaches the band and Back.
164
+ // eslint-disable-next-line react-hooks/exhaustive-deps
165
+ [path, change, version, direction, inPane],
166
+ );
167
+
168
+ // On pop, focus goes back to the control that opened the screen that just closed.
169
+ const previousDepth = React.useRef(path.length);
170
+ React.useEffect(() => {
171
+ const before = previousDepth.current;
172
+ previousDepth.current = path.length;
173
+ if (path.length < before) {
174
+ const opener = openers.current[before];
175
+ openers.current.length = path.length + 1;
176
+ if (opener && opener.isConnected) opener.focus();
177
+ }
178
+ }, [path.length]);
179
+
180
+ const levels = [root, ...path.map((value) => screen(value))];
181
+ const top = levels.length - 1;
182
+ const outlet = (
183
+ <div className={classNames('kui-Navigator', className)} style={style}>
184
+ {levels.map((level, depth) => (
185
+ // Keyed by depth AND value, so a path that replaces the screen at a depth mounts a new
186
+ // screen instead of handing it the old one's state.
187
+ <Level key={depth === 0 ? 'root' : `${depth}:${String(path[depth - 1])}`} visible={depth === top}>
188
+ <LevelContext.Provider value={depth}>
189
+ <div className="kui-NavigatorLevel">{level}</div>
190
+ </LevelContext.Provider>
191
+ </Level>
192
+ ))}
193
+ </div>
194
+ );
195
+
196
+ return (
197
+ <NavigatorContext.Provider value={api}>
198
+ <OutletContext.Provider value={outlet}>{children ?? (inPane ? <PaneFrame /> : outlet)}</OutletContext.Provider>
199
+ </NavigatorContext.Provider>
200
+ );
201
+ }
202
+
203
+ /**
204
+ * The pane's frame: Back and the top screen's title as one cluster at the start of the pane's
205
+ * band, and the screens in the pane's scroller. Pass children to the Navigator instead when the
206
+ * band needs actions of its own, and put `NavigatorBack` and `NavigatorTitle` in it, together in
207
+ * a `Flex`.
208
+ */
209
+ function PaneFrame() {
210
+ return (
211
+ <>
212
+ <PaneHeader>
213
+ <Toolbar>
214
+ {/* One cluster: as two loose toolbar children, the band splits them to its two ends. */}
215
+ <Flex align="center">
216
+ <NavigatorBack />
217
+ <NavigatorTitle />
218
+ </Flex>
219
+ </Toolbar>
220
+ </PaneHeader>
221
+ <Scroll>
222
+ <NavigatorOutlet />
223
+ </Scroll>
224
+ </>
225
+ );
226
+ }
227
+
228
+ /** Where the screens go, inside a frame passed as the navigator's children. */
229
+ function NavigatorOutlet() {
230
+ return <>{React.useContext(OutletContext)}</>;
231
+ }
232
+
233
+ function useNavigatorState(): NavigatorState {
234
+ const state = React.useContext(NavigatorContext);
235
+ if (!state) throw new Error('Kookie: this part must be inside a <Navigator>.');
236
+ return state;
237
+ }
238
+
239
+ /** The navigator around this component: its path, and `push`, `pop` and `popTo`. */
240
+ function useNavigator<T = unknown>(): NavigatorApi<T> {
241
+ return useNavigatorState() as NavigatorApi<T>;
242
+ }
243
+
244
+ function BackGlyph() {
245
+ return (
246
+ <svg className="kui-NavigatorBackGlyph" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden>
247
+ <path d="m15 18-6-6 6-6" stroke="currentColor" strokeWidth={1.75} strokeLinecap="round" strokeLinejoin="round" />
248
+ </svg>
249
+ );
250
+ }
251
+
252
+ function CloseGlyph() {
253
+ return (
254
+ <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden>
255
+ <path d="M18 6 6 18M6 6l12 12" stroke="currentColor" strokeWidth={1.75} strokeLinecap="round" />
256
+ </svg>
257
+ );
258
+ }
259
+
260
+ function backLabel(state: NavigatorState, depth: number) {
261
+ const previous = depth > 0 ? state.titles.current[depth - 1] : undefined;
262
+ return previous ? `Back to ${previous}` : 'Back';
263
+ }
264
+
265
+ interface NavigatorBackProps {
266
+ /** The accessible name. The default is "Back to" and the previous screen's title. */
267
+ 'aria-label'?: string;
268
+ }
269
+
270
+ /**
271
+ * Back, for a toolbar: a chevron that closes the top screen. It is absent at the root rather than
272
+ * disabled, because there is nowhere to go back to. It names the screen it returns to, so a screen
273
+ * reader hears "Back to Settings".
274
+ */
275
+ function NavigatorBack(props: NavigatorBackProps) {
276
+ const state = useNavigatorState();
277
+ if (!state.canGoBack) return null;
278
+ return (
279
+ <ToolbarButton iconOnly aria-label={props['aria-label'] ?? backLabel(state, state.path.length)} onClick={state.pop}>
280
+ <BackGlyph />
281
+ </ToolbarButton>
282
+ );
283
+ }
284
+
285
+ /** The top screen's title, for a toolbar in a frame of your own. */
286
+ function NavigatorTitle() {
287
+ const state = useNavigatorState();
288
+ return <ToolbarTitle>{state.titles.current[state.path.length]}</ToolbarTitle>;
289
+ }
290
+
291
+ interface NavigatorScreenProps {
292
+ /** The screen's title. In a pane it shows in the pane's band; elsewhere in the screen's own. */
293
+ title: string;
294
+ /** The screen's content, under its title. */
295
+ children?: React.ReactNode;
296
+ className?: string;
297
+ }
298
+
299
+ /**
300
+ * One screen in a navigator. In a Shell pane the pane's band carries Back and its title, so the
301
+ * screen is only its content. Anywhere else it draws its own band: Back, the title, and the
302
+ * overlay's close when it sits in one. In a Dialog, Sheet or Popover the title names the panel.
303
+ */
304
+ function NavigatorScreen({ title, children, className }: NavigatorScreenProps) {
305
+ const state = useNavigatorState();
306
+ const depth = React.useContext(LevelContext);
307
+ const Host = React.useContext(NavigatorHostContext);
308
+ const node = React.useRef<HTMLDivElement>(null);
309
+
310
+ React.useEffect(() => {
311
+ state.setTitle(depth, title);
312
+ }, [state, depth, title]);
313
+
314
+ // A pushed screen takes focus at its top, so a keyboard and a screen reader start there. In a
315
+ // pane the title is in the band, outside the screen, so the screen itself takes it.
316
+ React.useEffect(() => {
317
+ if (depth === 0 || state.direction !== 'push') return;
318
+ const target = node.current?.querySelector<HTMLElement>('.kui-NavigatorBar .kui-ToolbarTitle') ?? node.current;
319
+ if (target) {
320
+ target.tabIndex = -1;
321
+ target.focus({ preventScroll: true });
322
+ }
323
+ // Only on arrival: a later re-render must not pull focus back to the title.
324
+ // eslint-disable-next-line react-hooks/exhaustive-deps
325
+ }, []);
326
+
327
+ if (state.inPane) {
328
+ return (
329
+ <div ref={node} className={classNames('kui-NavigatorScreen', className)}>
330
+ {children}
331
+ </div>
332
+ );
333
+ }
334
+
335
+ const heading = (
336
+ <Heading as="h2" size="4" weight="medium" truncate>
337
+ {title}
338
+ </Heading>
339
+ );
340
+ return (
341
+ <div ref={node} className={classNames('kui-NavigatorScreen', className)}>
342
+ {/* One row: Back, the title, and the overlay's close. The band sits one step closer to the
343
+ panel's edge than the content does. */}
344
+ <div className="kui-NavigatorBar">
345
+ <Toolbar aria-label="Navigation">
346
+ {state.canGoBack && depth > 0 ? (
347
+ <ToolbarButton iconOnly aria-label={backLabel(state, depth)} onClick={state.pop}>
348
+ <BackGlyph />
349
+ </ToolbarButton>
350
+ ) : null}
351
+ <ToolbarTitle className="kui-NavigatorBarTitle">{Host ? <Host.Title>{heading}</Host.Title> : heading}</ToolbarTitle>
352
+ {Host ? (
353
+ <Host.Close>
354
+ <ToolbarButton iconOnly aria-label="Close">
355
+ <CloseGlyph />
356
+ </ToolbarButton>
357
+ </Host.Close>
358
+ ) : null}
359
+ </Toolbar>
360
+ </div>
361
+ <div className="kui-NavigatorBody">{children}</div>
362
+ </div>
363
+ );
364
+ }
365
+
366
+ interface NavigatorLinkProps<T> extends Omit<React.ComponentPropsWithoutRef<'button'>, 'value' | 'onClick'> {
367
+ /** The value pushed onto the path when the row is pressed. */
368
+ value: T;
369
+ }
370
+
371
+ /** A row that opens the next screen, with the chevron that says so. */
372
+ function NavigatorLink<T>({ value, className, children, ...props }: NavigatorLinkProps<T>) {
373
+ const state = useNavigatorState();
374
+ return (
375
+ <button type="button" {...props} className={classNames('kui-reset', 'kui-NavigatorLink', className)} onClick={() => state.push(value)}>
376
+ <span className="kui-NavigatorLinkLabel">{children}</span>
377
+ <svg className="kui-NavigatorLinkGlyph" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden>
378
+ <path d="m9 18 6-6-6-6" stroke="currentColor" strokeWidth={1.75} strokeLinecap="round" strokeLinejoin="round" />
379
+ </svg>
380
+ </button>
381
+ );
382
+ }
383
+
384
+ export { Navigator, NavigatorOutlet, NavigatorBack, NavigatorTitle, NavigatorScreen, NavigatorLink, useNavigator };
385
+ export type { NavigatorProps, NavigatorBackProps, NavigatorScreenProps, NavigatorLinkProps, NavigatorApi };
@@ -7,6 +7,7 @@ import { useThemeSizeProps } from '../hooks/theme-size.js';
7
7
  import { requireReactElement } from '../helpers/require-react-element.js';
8
8
  import { popoverContentPropDefs } from './popover.props.js';
9
9
  import { PortalTheme } from './_internal/portal-theme.js';
10
+ import { NavigatorHostContext, type NavigatorHost } from './_internal/navigator-host.js';
10
11
 
11
12
  import type { PopoverContentOwnProps } from './popover.props.js';
12
13
  import type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';
@@ -31,6 +32,22 @@ const usePopoverContentContext = (caller: string) => {
31
32
  };
32
33
 
33
34
  interface PopoverRootProps extends React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Root> {}
35
+ /** A Navigator screen's title names the popover through the content's label. */
36
+ function PopoverNavigatorTitle({ children }: { children: React.ReactElement<{ id?: string }> }) {
37
+ const setLabelId = usePopoverContentContext('Navigator')?.setLabelId;
38
+ const id = React.useId();
39
+ React.useEffect(() => {
40
+ setLabelId?.(id);
41
+ return () => setLabelId?.(undefined);
42
+ }, [id, setLabelId]);
43
+ return React.cloneElement(children, { id });
44
+ }
45
+
46
+ const popoverNavigatorHost: NavigatorHost = {
47
+ Title: PopoverNavigatorTitle,
48
+ Close: ({ children }) => <PopoverPrimitive.Close asChild>{children}</PopoverPrimitive.Close>,
49
+ };
50
+
34
51
  const PopoverRoot: React.FC<PopoverRootProps> = (props: PopoverRootProps) => (
35
52
  <PopoverPrimitive.Root {...props} />
36
53
  );
@@ -81,7 +98,7 @@ const PopoverContent = React.forwardRef<PopoverContentElement, PopoverContentPro
81
98
  className={classNames('kui-PopperContent', 'kui-PopoverContent', className)}
82
99
  >
83
100
  <PopoverContentContext.Provider value={contextValue}>
84
- {props.children}
101
+ <NavigatorHostContext.Provider value={popoverNavigatorHost}>{props.children}</NavigatorHostContext.Provider>
85
102
  </PopoverContentContext.Provider>
86
103
  </PopoverPrimitive.Content>
87
104
  </PortalTheme>
@@ -39,6 +39,7 @@ import { Dialog as DialogPrimitive } from 'radix-ui';
39
39
  import { dialogContentPropDefs } from './dialog.props.js';
40
40
  import type { DialogContentOwnProps } from './dialog.props.js';
41
41
  import { PortalTheme } from './_internal/portal-theme.js';
42
+ import { NavigatorHostContext, type NavigatorHost } from './_internal/navigator-host.js';
42
43
  import { Heading } from './heading.js';
43
44
  import { Text } from './text.js';
44
45
  import { extractProps } from '../helpers/extract-props.js';
@@ -89,6 +90,12 @@ Trigger.displayName = 'Sheet.Trigger';
89
90
  const { align: _alignPropDef, ...dialogPropDefsForSheet } = dialogContentPropDefs;
90
91
  const sheetPropDefs = dialogPropDefsForSheet;
91
92
 
93
+ /** What a Navigator screen in this panel uses: its title names the sheet, its close closes it. */
94
+ const sheetNavigatorHost: NavigatorHost = {
95
+ Title: ({ children }) => <DialogPrimitive.Title asChild>{children}</DialogPrimitive.Title>,
96
+ Close: ({ children }) => <DialogPrimitive.Close asChild>{children}</DialogPrimitive.Close>,
97
+ };
98
+
92
99
  /** Counts the Sheet.Title elements mounted inside a Sheet.Content, for the dev-only name check. */
93
100
  const SheetTitleCountContext = React.createContext<React.MutableRefObject<number> | null>(null);
94
101
 
@@ -155,6 +162,7 @@ const Content = React.forwardRef<SheetContentElement, SheetContentProps>((allPro
155
162
  className={classNames('kui-BaseDialogContent', 'kui-SheetContent', className, extractedClassName)}
156
163
  data-side={normalizedSide}
157
164
  aria-modal="true"
165
+ children={<NavigatorHostContext.Provider value={sheetNavigatorHost}>{contentProps.children}</NavigatorHostContext.Provider>}
158
166
  />
159
167
  </DialogPrimitive.Overlay>
160
168
  </PortalTheme>
package/styles.css CHANGED
@@ -20496,6 +20496,92 @@
20496
20496
  border-style: none;
20497
20497
  }
20498
20498
  }
20499
+ .kui-Navigator,
20500
+ .kui-NavigatorLevel,
20501
+ .kui-NavigatorScreen {
20502
+ display: -webkit-box;
20503
+ display: -ms-flexbox;
20504
+ display: flex;
20505
+ -webkit-box-orient: vertical;
20506
+ -webkit-box-direction: normal;
20507
+ -ms-flex-direction: column;
20508
+ flex-direction: column;
20509
+ min-block-size: 0;
20510
+ }
20511
+ .kui-NavigatorBar {
20512
+ -webkit-margin-before: calc(-1 * var(--layout-space-2));
20513
+ margin-block-start: calc(-1 * var(--layout-space-2));
20514
+ margin-inline: calc(-1 * var(--layout-space-2));
20515
+ -webkit-margin-after: var(--layout-space-6);
20516
+ margin-block-end: var(--layout-space-6);
20517
+ }
20518
+ .kui-NavigatorBarTitle {
20519
+ -webkit-margin-end: auto;
20520
+ margin-inline-end: auto;
20521
+ min-inline-size: 0;
20522
+ }
20523
+ .kui-NavigatorBarTitle:where(:first-child) {
20524
+ -webkit-padding-start: var(--layout-space-2);
20525
+ padding-inline-start: var(--layout-space-2);
20526
+ }
20527
+ .kui-NavigatorBackGlyph,
20528
+ .kui-NavigatorLinkGlyph {
20529
+ inline-size: 1em;
20530
+ block-size: 1em;
20531
+ }
20532
+ .kui-NavigatorBackGlyph:where(:dir(rtl)),
20533
+ .kui-NavigatorLinkGlyph:where(:dir(rtl)) {
20534
+ -webkit-transform: scaleX(-1);
20535
+ transform: scaleX(-1);
20536
+ }
20537
+ .kui-NavigatorLink {
20538
+ display: -webkit-box;
20539
+ display: -ms-flexbox;
20540
+ display: flex;
20541
+ -webkit-box-align: center;
20542
+ -ms-flex-align: center;
20543
+ align-items: center;
20544
+ gap: var(--layout-space-3);
20545
+ inline-size: 100%;
20546
+ min-block-size: var(--control-height-3);
20547
+ padding-inline: var(--layout-space-3);
20548
+ border-radius: var(--radius-control-3);
20549
+ color: var(--gray-12);
20550
+ font-size: var(--font-size-3);
20551
+ line-height: var(--line-height-3);
20552
+ text-align: start;
20553
+ cursor: var(--cursor-button);
20554
+ }
20555
+ .kui-NavigatorLinkLabel {
20556
+ display: -webkit-box;
20557
+ display: -ms-flexbox;
20558
+ display: flex;
20559
+ -webkit-box-align: center;
20560
+ -ms-flex-align: center;
20561
+ align-items: center;
20562
+ gap: var(--layout-space-3);
20563
+ -webkit-box-flex: 1;
20564
+ -ms-flex: 1;
20565
+ flex: 1;
20566
+ min-inline-size: 0;
20567
+ }
20568
+ .kui-NavigatorLinkGlyph {
20569
+ -ms-flex-negative: 0;
20570
+ flex-shrink: 0;
20571
+ color: var(--gray-a10);
20572
+ }
20573
+ @media (hover: hover) {
20574
+ .kui-NavigatorLink:where(:hover) {
20575
+ background-color: var(--gray-a3);
20576
+ }
20577
+ }
20578
+ .kui-NavigatorLink:where(:active) {
20579
+ background-color: var(--gray-a4);
20580
+ }
20581
+ .kui-NavigatorLink:where(:focus-visible) {
20582
+ outline: 2px solid var(--focus-8);
20583
+ outline-offset: -2px;
20584
+ }
20499
20585
  .kui-TooltipContent {
20500
20586
  -webkit-box-sizing: border-box;
20501
20587
  box-sizing: border-box;
@@ -1,3 +0,0 @@
1
- "use client";
2
- import{a as p}from"./chunk-FATCGZZE.js";import{a as D}from"./chunk-7VJF6EXN.js";import{a as g}from"./chunk-JP36JSNP.js";import{a as l}from"./chunk-TGRHRMQI.js";import{a as m}from"./chunk-4MNRLB57.js";import{c as r}from"./chunk-OKQAVYW4.js";import{a as n}from"./chunk-AQKSO3SW.js";import{c as s}from"./chunk-5ON3XLRD.js";import{a as w}from"./chunk-VQPANPMI.js";var S={};w(S,{Close:()=>y,Content:()=>C,Description:()=>R,Root:()=>c,Title:()=>d,Trigger:()=>f});import*as o from"react";import W from"classnames";import{Dialog as t}from"radix-ui";var c=e=>o.createElement(t.Root,{...e,modal:!0});c.displayName="Dialog.Root";var f=o.forwardRef(({children:e,...i},a)=>o.createElement(t.Trigger,{...i,ref:a,asChild:!0},l(e)));f.displayName="Dialog.Trigger";var{align:O,...P}=p,B={align:O},C=o.forwardRef(({align:e,...i},a)=>{let T=s(i,P.size),{className:v}=r({align:e},B),{className:u,forceMount:h,container:E,onCloseAutoFocus:N,...x}=r(T,P);return D(),o.createElement(t.Portal,{container:E,forceMount:h},o.createElement(n,{asChild:!0},o.createElement(t.Overlay,{className:"kui-BaseDialogOverlay kui-DialogOverlay"},o.createElement("div",{className:"kui-BaseDialogScroll kui-DialogScroll"},o.createElement("div",{className:`kui-BaseDialogScrollPadding kui-DialogScrollPadding ${v}`},o.createElement(t.Content,{...x,ref:a,className:W("kui-BaseDialogContent","kui-DialogContent",u),"aria-modal":"true",onCloseAutoFocus:k=>{N?.(k),document.body.style.pointerEvents=""}}))))))});C.displayName="Dialog.Content";var d=o.forwardRef((e,i)=>o.createElement(t.Title,{asChild:!0},o.createElement(g,{size:"5",trim:"start",...e,asChild:!1,ref:i})));d.displayName="Dialog.Title";var R=o.forwardRef((e,i)=>o.createElement(t.Description,{asChild:!0},o.createElement(m,{as:"p",size:"3",...e,asChild:!1,ref:i})));R.displayName="Dialog.Description";var y=o.forwardRef(({children:e,...i},a)=>o.createElement(t.Close,{...i,ref:a,asChild:!0},l(e)));y.displayName="Dialog.Close";export{c as a,f as b,C as c,d,R as e,y as f,S as g};
3
- //# sourceMappingURL=chunk-5BX2YZV6.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/components/dialog.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nimport classNames from 'classnames';\nimport { Dialog as DialogPrimitive } from 'radix-ui';\n\nimport { dialogContentPropDefs } from './dialog.props.js';\nimport { Heading } from './heading.js';\nimport { Text } from './text.js';\nimport { PortalTheme } from './_internal/portal-theme.js';\nimport { extractProps } from '../helpers/extract-props.js';\nimport { useThemeSizeProps } from '../hooks/theme-size.js';\nimport { requireReactElement } from '../helpers/require-react-element.js';\nimport { useBodyPointerEventsCleanup } from '../hooks/use-body-pointer-events-cleanup.js';\n\nimport type { DialogContentOwnProps } from './dialog.props.js';\nimport type { ComponentPropsWithout, RemovedProps, ComponentPropsAs } from '../helpers/component-props.js';\n\ninterface DialogRootProps extends ComponentPropsWithout<typeof DialogPrimitive.Root, 'modal'> {}\nconst DialogRoot: React.FC<DialogRootProps> = (props) => <DialogPrimitive.Root {...props} modal />;\nDialogRoot.displayName = 'Dialog.Root';\n\ntype DialogTriggerElement = React.ElementRef<typeof DialogPrimitive.Trigger>;\ninterface DialogTriggerProps extends ComponentPropsWithout<typeof DialogPrimitive.Trigger, RemovedProps> {}\nconst DialogTrigger = React.forwardRef<DialogTriggerElement, DialogTriggerProps>(({ children, ...props }, forwardedRef) => (\n <DialogPrimitive.Trigger {...props} ref={forwardedRef} asChild>\n {requireReactElement(children)}\n </DialogPrimitive.Trigger>\n));\nDialogTrigger.displayName = 'Dialog.Trigger';\n\n// Split once at module scope. `extractProps` memoises on the identity of the\n// prop def objects it is handed, so rebuilding these per render would recompile\n// them on every render.\nconst { align: alignPropDef, ...contentPropDefs } = dialogContentPropDefs;\nconst alignPropDefs = { align: alignPropDef };\n\ntype DialogContentElement = React.ElementRef<typeof DialogPrimitive.Content>;\ninterface DialogContentProps extends ComponentPropsWithout<typeof DialogPrimitive.Content, RemovedProps>, DialogContentOwnProps {\n container?: React.ComponentPropsWithoutRef<typeof DialogPrimitive.Portal>['container'];\n}\nconst DialogContent = React.forwardRef<DialogContentElement, DialogContentProps>(({ align, ...ownProps }, forwardedRef) => {\n const props = useThemeSizeProps(ownProps, contentPropDefs.size);\n const { className: alignClassName } = extractProps({ align }, alignPropDefs);\n\n const { className, forceMount, container, onCloseAutoFocus, ...contentProps } = extractProps(props, contentPropDefs);\n\n // Cleanup stuck pointer-events on body\n useBodyPointerEventsCleanup();\n\n return (\n <DialogPrimitive.Portal container={container} forceMount={forceMount}>\n <PortalTheme asChild>\n <DialogPrimitive.Overlay className=\"kui-BaseDialogOverlay kui-DialogOverlay\">\n <div className=\"kui-BaseDialogScroll kui-DialogScroll\">\n <div className={`kui-BaseDialogScrollPadding kui-DialogScrollPadding ${alignClassName}`}>\n <DialogPrimitive.Content\n {...contentProps}\n ref={forwardedRef}\n className={classNames('kui-BaseDialogContent', 'kui-DialogContent', className)}\n aria-modal=\"true\"\n onCloseAutoFocus={(event) => {\n // Radix returns focus to the trigger unless the caller prevents it.\n onCloseAutoFocus?.(event);\n // Restore pointer-events to body (Radix UI fix for issue #1241)\n document.body.style.pointerEvents = '';\n }}\n />\n </div>\n </div>\n </DialogPrimitive.Overlay>\n </PortalTheme>\n </DialogPrimitive.Portal>\n );\n});\nDialogContent.displayName = 'Dialog.Content';\n\ntype DialogTitleElement = React.ElementRef<typeof Heading>;\ntype DialogTitleProps = ComponentPropsWithout<typeof Heading, 'asChild'>;\nconst DialogTitle = React.forwardRef<DialogTitleElement, DialogTitleProps>((props, forwardedRef) => (\n <DialogPrimitive.Title asChild>\n <Heading size=\"5\" trim=\"start\" {...props} asChild={false} ref={forwardedRef} />\n </DialogPrimitive.Title>\n));\nDialogTitle.displayName = 'Dialog.Title';\n\ntype DialogDescriptionElement = HTMLParagraphElement;\ntype DialogDescriptionProps = ComponentPropsAs<typeof Text, 'p'>;\nconst DialogDescription = React.forwardRef<DialogDescriptionElement, DialogDescriptionProps>((props, forwardedRef) => (\n <DialogPrimitive.Description asChild>\n <Text as=\"p\" size=\"3\" {...props} asChild={false} ref={forwardedRef} />\n </DialogPrimitive.Description>\n));\nDialogDescription.displayName = 'Dialog.Description';\n\ntype DialogCloseElement = React.ElementRef<typeof DialogPrimitive.Close>;\ninterface DialogCloseProps extends ComponentPropsWithout<typeof DialogPrimitive.Close, RemovedProps> {}\nconst DialogClose = React.forwardRef<DialogCloseElement, DialogCloseProps>(({ children, ...props }, forwardedRef) => (\n <DialogPrimitive.Close {...props} ref={forwardedRef} asChild>\n {requireReactElement(children)}\n </DialogPrimitive.Close>\n));\nDialogClose.displayName = 'Dialog.Close';\n\nexport { DialogRoot as Root, DialogTrigger as Trigger, DialogContent as Content, DialogTitle as Title, DialogDescription as Description, DialogClose as Close };\n\nexport type {\n DialogRootProps as RootProps,\n DialogTriggerProps as TriggerProps,\n DialogContentProps as ContentProps,\n DialogTitleProps as TitleProps,\n DialogDescriptionProps as DescriptionProps,\n DialogCloseProps as CloseProps,\n};\n"],
5
- "mappings": ";wWAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,WAAAE,EAAA,YAAAC,EAAA,gBAAAC,EAAA,SAAAC,EAAA,UAAAC,EAAA,YAAAC,IAAA,UAAYC,MAAW,QACvB,OAAOC,MAAgB,aACvB,OAAS,UAAUC,MAAuB,WAe1C,IAAMC,EAAyCC,GAAU,gBAACC,EAAgB,KAAhB,CAAsB,GAAGD,EAAO,MAAK,GAAC,EAChGD,EAAW,YAAc,cAIzB,IAAMG,EAAsB,aAAqD,CAAC,CAAE,SAAAC,EAAU,GAAGH,CAAM,EAAGI,IACxG,gBAACH,EAAgB,QAAhB,CAAyB,GAAGD,EAAO,IAAKI,EAAc,QAAO,IAC3DC,EAAoBF,CAAQ,CAC/B,CACD,EACDD,EAAc,YAAc,iBAK5B,GAAM,CAAE,MAAOI,EAAc,GAAGC,CAAgB,EAAIC,EAC9CC,EAAgB,CAAE,MAAOH,CAAa,EAMtCI,EAAsB,aAAqD,CAAC,CAAE,MAAAC,EAAO,GAAGC,CAAS,EAAGR,IAAiB,CACzH,IAAMJ,EAAQa,EAAkBD,EAAUL,EAAgB,IAAI,EACxD,CAAE,UAAWO,CAAe,EAAIC,EAAa,CAAE,MAAAJ,CAAM,EAAGF,CAAa,EAErE,CAAE,UAAAO,EAAW,WAAAC,EAAY,UAAAC,EAAW,iBAAAC,EAAkB,GAAGC,CAAa,EAAIL,EAAaf,EAAOO,CAAe,EAGnH,OAAAc,EAA4B,EAG1B,gBAACpB,EAAgB,OAAhB,CAAuB,UAAWiB,EAAW,WAAYD,GACxD,gBAACK,EAAA,CAAY,QAAO,IAClB,gBAACrB,EAAgB,QAAhB,CAAwB,UAAU,2CACjC,gBAAC,OAAI,UAAU,yCACb,gBAAC,OAAI,UAAW,uDAAuDa,CAAc,IACnF,gBAACb,EAAgB,QAAhB,CACE,GAAGmB,EACJ,IAAKhB,EACL,UAAWmB,EAAW,wBAAyB,oBAAqBP,CAAS,EAC7E,aAAW,OACX,iBAAmBQ,GAAU,CAE3BL,IAAmBK,CAAK,EAExB,SAAS,KAAK,MAAM,cAAgB,EACtC,EACF,CACF,CACF,CACF,CACF,CACF,CAEJ,CAAC,EACDd,EAAc,YAAc,iBAI5B,IAAMe,EAAoB,aAAiD,CAACzB,EAAOI,IACjF,gBAACH,EAAgB,MAAhB,CAAsB,QAAO,IAC5B,gBAACyB,EAAA,CAAQ,KAAK,IAAI,KAAK,QAAS,GAAG1B,EAAO,QAAS,GAAO,IAAKI,EAAc,CAC/E,CACD,EACDqB,EAAY,YAAc,eAI1B,IAAME,EAA0B,aAA6D,CAAC3B,EAAOI,IACnG,gBAACH,EAAgB,YAAhB,CAA4B,QAAO,IAClC,gBAAC2B,EAAA,CAAK,GAAG,IAAI,KAAK,IAAK,GAAG5B,EAAO,QAAS,GAAO,IAAKI,EAAc,CACtE,CACD,EACDuB,EAAkB,YAAc,qBAIhC,IAAME,EAAoB,aAAiD,CAAC,CAAE,SAAA1B,EAAU,GAAGH,CAAM,EAAGI,IAClG,gBAACH,EAAgB,MAAhB,CAAuB,GAAGD,EAAO,IAAKI,EAAc,QAAO,IACzDC,EAAoBF,CAAQ,CAC/B,CACD,EACD0B,EAAY,YAAc",
6
- "names": ["dialog_exports", "__export", "DialogClose", "DialogContent", "DialogDescription", "DialogRoot", "DialogTitle", "DialogTrigger", "React", "classNames", "DialogPrimitive", "DialogRoot", "props", "DialogPrimitive", "DialogTrigger", "children", "forwardedRef", "requireReactElement", "alignPropDef", "contentPropDefs", "dialogContentPropDefs", "alignPropDefs", "DialogContent", "align", "ownProps", "useThemeSizeProps", "alignClassName", "extractProps", "className", "forceMount", "container", "onCloseAutoFocus", "contentProps", "useBodyPointerEventsCleanup", "PortalTheme", "classNames", "event", "DialogTitle", "Heading", "DialogDescription", "Text", "DialogClose"]
7
- }
@@ -1,3 +0,0 @@
1
- "use client";
2
- import{a as P}from"./chunk-FATCGZZE.js";import{a as g}from"./chunk-7VJF6EXN.js";import{a as h}from"./chunk-JP36JSNP.js";import{a}from"./chunk-TGRHRMQI.js";import{a as f}from"./chunk-4MNRLB57.js";import{c as p}from"./chunk-OKQAVYW4.js";import{a as c}from"./chunk-AQKSO3SW.js";import{c as m}from"./chunk-5ON3XLRD.js";import{a as W}from"./chunk-VQPANPMI.js";var B={};W(B,{Close:()=>T,Content:()=>R,Description:()=>D,Root:()=>C,Title:()=>y,Trigger:()=>u});import*as e from"react";import k from"classnames";import{Dialog as r}from"radix-ui";var C=o=>e.createElement(r.Root,{...o,modal:!0});C.displayName="Sheet.Root";var u=e.forwardRef(({children:o,...t},i)=>e.createElement(r.Trigger,{...t,ref:i,asChild:!0},a(o)));u.displayName="Sheet.Trigger";var{align:Q,...w}=P,d=w,S=e.createContext(null),R=e.forwardRef((o,t)=>{let{side:i="start",forceMount:s,container:n,className:v,...E}=o,b=m(E,d.size),N={left:"start",right:"end",start:"start",end:"end",top:"top",bottom:"bottom"}[i],{className:x,...O}=p(b,d),z=e.useRef(0),M=e.useCallback(l=>{typeof t=="function"?t(l):t&&(t.current=l)},[t]);return g(),e.createElement(r.Portal,{container:n,forceMount:s},e.createElement(S.Provider,{value:z},e.createElement(c,{asChild:!0},e.createElement(r.Overlay,{className:"kui-BaseDialogOverlay kui-DialogOverlay kui-SheetOverlay"},e.createElement(r.Content,{...O,ref:M,className:k("kui-BaseDialogContent","kui-SheetContent",v,x),"data-side":N,"aria-modal":"true"})))))});R.displayName="Sheet.Content";var y=e.forwardRef(({size:o="4",weight:t="medium",...i},s)=>{let n=e.useContext(S);return e.useLayoutEffect(()=>{if(n)return n.current+=1,()=>{n.current-=1}},[n]),e.createElement(r.Title,{asChild:!0},e.createElement(h,{ref:s,size:o,weight:t,...i}))});y.displayName="Sheet.Title";var D=e.forwardRef(({size:o="2",emphasis:t="medium",...i},s)=>e.createElement(r.Description,{asChild:!0},e.createElement(f,{ref:s,size:o,emphasis:t,...i})));D.displayName="Sheet.Description";var T=e.forwardRef(({children:o,...t},i)=>e.createElement(r.Close,{...t,ref:i,asChild:!0},a(o)));T.displayName="Sheet.Close";export{C as a,u as b,R as c,y as d,D as e,T as f,B as g};
3
- //# sourceMappingURL=chunk-HR2VHGJ5.js.map