@aortl/admin-react 0.20.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -1
- package/dist/AdminRoot.d.ts +2 -2
- package/dist/AdminRoot.d.ts.map +1 -1
- package/dist/AppShell.d.ts +1 -1
- package/dist/BrandTile.d.ts +7 -1
- package/dist/BrandTile.d.ts.map +1 -1
- package/dist/Button.d.ts +4 -0
- package/dist/Button.d.ts.map +1 -1
- package/dist/Container.d.ts +3 -1
- package/dist/Container.d.ts.map +1 -1
- package/dist/Dialog.d.ts.map +1 -1
- package/dist/Drawer.d.ts.map +1 -1
- package/dist/Field.d.ts +9 -2
- package/dist/Field.d.ts.map +1 -1
- package/dist/Menu.d.ts +8 -2
- package/dist/Menu.d.ts.map +1 -1
- package/dist/Navbar.d.ts +9 -2
- package/dist/Navbar.d.ts.map +1 -1
- package/dist/Select.d.ts.map +1 -1
- package/dist/Sidebar.d.ts.map +1 -1
- package/dist/Tooltip.d.ts.map +1 -1
- package/dist/admin.scoped.css +31 -161
- package/dist/index.cjs +587 -464
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +588 -466
- package/dist/index.mjs.map +1 -1
- package/dist/useConfirm.d.ts +32 -0
- package/dist/useConfirm.d.ts.map +1 -0
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -2,8 +2,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
let clsx = require("clsx");
|
|
3
3
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
4
4
|
let react = require("react");
|
|
5
|
-
let _base_ui_react_avatar = require("@base-ui/react/avatar");
|
|
6
5
|
let _base_ui_react_button = require("@base-ui/react/button");
|
|
6
|
+
let _base_ui_react_avatar = require("@base-ui/react/avatar");
|
|
7
7
|
let _base_ui_react_toggle = require("@base-ui/react/toggle");
|
|
8
8
|
let _base_ui_react_input = require("@base-ui/react/input");
|
|
9
9
|
let _base_ui_react_number_field = require("@base-ui/react/number-field");
|
|
@@ -77,30 +77,6 @@ var Accordion = Object.assign(AccordionRoot, {
|
|
|
77
77
|
*/
|
|
78
78
|
var PortalContainerContext = (0, react.createContext)(null);
|
|
79
79
|
//#endregion
|
|
80
|
-
//#region src/AdminRoot.tsx
|
|
81
|
-
function AdminRoot({ className, theme, systemAccent, style, ref, ...rest }) {
|
|
82
|
-
const rootStyle = systemAccent !== void 0 ? {
|
|
83
|
-
...style,
|
|
84
|
-
"--color-system-accent": systemAccent
|
|
85
|
-
} : style;
|
|
86
|
-
const portalRef = (0, react.useRef)(null);
|
|
87
|
-
const setRef = (0, react.useCallback)((node) => {
|
|
88
|
-
portalRef.current = node;
|
|
89
|
-
if (typeof ref === "function") ref(node);
|
|
90
|
-
else if (ref) ref.current = node;
|
|
91
|
-
}, [ref]);
|
|
92
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PortalContainerContext.Provider, {
|
|
93
|
-
value: portalRef,
|
|
94
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
95
|
-
ref: setRef,
|
|
96
|
-
className: cn("admin-root", className),
|
|
97
|
-
style: rootStyle,
|
|
98
|
-
...rest,
|
|
99
|
-
...theme !== void 0 && { "data-theme": theme }
|
|
100
|
-
})
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
//#endregion
|
|
104
80
|
//#region src/icon.ts
|
|
105
81
|
/**
|
|
106
82
|
* Render an `IconProp`, defaulting component references to `size="1em"
|
|
@@ -116,226 +92,6 @@ function renderIcon(icon, size = "1em") {
|
|
|
116
92
|
});
|
|
117
93
|
}
|
|
118
94
|
//#endregion
|
|
119
|
-
//#region src/Alert.tsx
|
|
120
|
-
function DismissIcon() {
|
|
121
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
122
|
-
width: "1em",
|
|
123
|
-
height: "1em",
|
|
124
|
-
viewBox: "0 0 24 24",
|
|
125
|
-
fill: "none",
|
|
126
|
-
stroke: "currentColor",
|
|
127
|
-
strokeWidth: "2",
|
|
128
|
-
strokeLinecap: "round",
|
|
129
|
-
strokeLinejoin: "round",
|
|
130
|
-
"aria-hidden": "true",
|
|
131
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M18 6 6 18" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m6 6 12 12" })]
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
function AlertRoot({ variant, icon, title, description, action, onDismiss, dismissLabel = "Dismiss", classNames, className, role, children, ...rest }) {
|
|
135
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
136
|
-
role: role ?? (variant === "danger" || variant === "warning" ? "alert" : "status"),
|
|
137
|
-
className: cn(["alert", `alert-${variant}`], className),
|
|
138
|
-
...rest,
|
|
139
|
-
children: [
|
|
140
|
-
renderIcon(icon),
|
|
141
|
-
title !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AlertTitle, {
|
|
142
|
-
className: classNames?.title,
|
|
143
|
-
children: title
|
|
144
|
-
}) : null,
|
|
145
|
-
description !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AlertDescription, {
|
|
146
|
-
className: classNames?.description,
|
|
147
|
-
children: description
|
|
148
|
-
}) : null,
|
|
149
|
-
children,
|
|
150
|
-
action !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AlertAction, {
|
|
151
|
-
className: classNames?.action,
|
|
152
|
-
children: action
|
|
153
|
-
}) : null,
|
|
154
|
-
onDismiss ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
155
|
-
type: "button",
|
|
156
|
-
className: cn("alert-dismiss", classNames?.dismiss),
|
|
157
|
-
"aria-label": dismissLabel,
|
|
158
|
-
onClick: onDismiss,
|
|
159
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DismissIcon, {})
|
|
160
|
-
}) : null
|
|
161
|
-
]
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
function AlertTitle({ className, ...rest }) {
|
|
165
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", {
|
|
166
|
-
className: cn("alert-title", className),
|
|
167
|
-
...rest
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
function AlertDescription({ className, ...rest }) {
|
|
171
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
172
|
-
className: cn("alert-description", className),
|
|
173
|
-
...rest
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
function AlertAction({ className, ...rest }) {
|
|
177
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
178
|
-
className: cn("alert-action", className),
|
|
179
|
-
...rest
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
var Alert = Object.assign(AlertRoot, {
|
|
183
|
-
Title: AlertTitle,
|
|
184
|
-
Description: AlertDescription,
|
|
185
|
-
Action: AlertAction
|
|
186
|
-
});
|
|
187
|
-
//#endregion
|
|
188
|
-
//#region src/AppShell.tsx
|
|
189
|
-
var AppShellContext = (0, react.createContext)(null);
|
|
190
|
-
function useAppShell() {
|
|
191
|
-
return (0, react.useContext)(AppShellContext);
|
|
192
|
-
}
|
|
193
|
-
function AppShellRoot({ hasSidebar = false, mobileDrawerOpen, defaultMobileDrawerOpen = false, onMobileDrawerOpenChange, systemAccent, className, style, children, ...rest }) {
|
|
194
|
-
const [uncontrolledOpen, setUncontrolledOpen] = (0, react.useState)(defaultMobileDrawerOpen);
|
|
195
|
-
const isControlled = mobileDrawerOpen !== void 0;
|
|
196
|
-
const open = isControlled ? mobileDrawerOpen : uncontrolledOpen;
|
|
197
|
-
const value = (0, react.useMemo)(() => ({
|
|
198
|
-
mobileDrawerOpen: open,
|
|
199
|
-
setMobileDrawerOpen: (next) => {
|
|
200
|
-
if (!isControlled) setUncontrolledOpen(next);
|
|
201
|
-
onMobileDrawerOpenChange?.(next);
|
|
202
|
-
},
|
|
203
|
-
hasSidebar
|
|
204
|
-
}), [
|
|
205
|
-
open,
|
|
206
|
-
isControlled,
|
|
207
|
-
onMobileDrawerOpenChange,
|
|
208
|
-
hasSidebar
|
|
209
|
-
]);
|
|
210
|
-
const rootStyle = systemAccent !== void 0 ? {
|
|
211
|
-
...style,
|
|
212
|
-
"--color-system-accent": systemAccent
|
|
213
|
-
} : style;
|
|
214
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AppShellContext.Provider, {
|
|
215
|
-
value,
|
|
216
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
217
|
-
className: cn(["app-shell", hasSidebar && "app-shell-with-sidebar"], className),
|
|
218
|
-
style: rootStyle,
|
|
219
|
-
...rest,
|
|
220
|
-
children
|
|
221
|
-
})
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
function AppShellMain({ className, ...rest }) {
|
|
225
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("main", {
|
|
226
|
-
className: cn("app-shell-main", className),
|
|
227
|
-
...rest
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
var AppShell = Object.assign(AppShellRoot, { Main: AppShellMain });
|
|
231
|
-
//#endregion
|
|
232
|
-
//#region src/Badge.tsx
|
|
233
|
-
function RemoveIcon() {
|
|
234
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
235
|
-
width: "1em",
|
|
236
|
-
height: "1em",
|
|
237
|
-
viewBox: "0 0 24 24",
|
|
238
|
-
fill: "none",
|
|
239
|
-
stroke: "currentColor",
|
|
240
|
-
strokeWidth: "2",
|
|
241
|
-
strokeLinecap: "round",
|
|
242
|
-
strokeLinejoin: "round",
|
|
243
|
-
"aria-hidden": "true",
|
|
244
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M18 6 6 18" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m6 6 12 12" })]
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
function Badge({ variant = "neutral", size = "md", icon, soft = false, onRemove, removeLabel = "Remove", className, children, ...rest }) {
|
|
248
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
249
|
-
className: cn([
|
|
250
|
-
"badge",
|
|
251
|
-
variant !== "neutral" && `badge-${variant}`,
|
|
252
|
-
size !== "md" && `badge-${size}`,
|
|
253
|
-
soft && "badge-soft"
|
|
254
|
-
], className),
|
|
255
|
-
...rest,
|
|
256
|
-
children: [
|
|
257
|
-
renderIcon(icon),
|
|
258
|
-
children,
|
|
259
|
-
onRemove ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
260
|
-
type: "button",
|
|
261
|
-
className: cn("badge-remove", void 0),
|
|
262
|
-
"aria-label": removeLabel,
|
|
263
|
-
onClick: onRemove,
|
|
264
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RemoveIcon, {})
|
|
265
|
-
}) : null
|
|
266
|
-
]
|
|
267
|
-
});
|
|
268
|
-
}
|
|
269
|
-
//#endregion
|
|
270
|
-
//#region src/BrandTile.tsx
|
|
271
|
-
/**
|
|
272
|
-
* Brand/system mark for the navbar — monogram, icon, or shop logo. Precedence
|
|
273
|
-
* is `src` > `icon` > `monogram`. Monogram/icon tiles are `aria-hidden`; image
|
|
274
|
-
* tiles expose `alt` to assistive tech instead.
|
|
275
|
-
*/
|
|
276
|
-
function BrandTile({ variant = "solid", size = "md", monogram, icon, src, alt = "", className, children, ...rest }) {
|
|
277
|
-
const classes = cn([
|
|
278
|
-
"brand-tile",
|
|
279
|
-
variant !== "solid" && `brand-tile-${variant}`,
|
|
280
|
-
size === "lg" && "brand-tile-lg"
|
|
281
|
-
], className);
|
|
282
|
-
if (src) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
283
|
-
className: classes,
|
|
284
|
-
...rest,
|
|
285
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
286
|
-
src,
|
|
287
|
-
alt
|
|
288
|
-
})
|
|
289
|
-
});
|
|
290
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
291
|
-
className: classes,
|
|
292
|
-
"aria-hidden": true,
|
|
293
|
-
...rest,
|
|
294
|
-
children: icon ? renderIcon(icon) : children ?? monogram
|
|
295
|
-
});
|
|
296
|
-
}
|
|
297
|
-
//#endregion
|
|
298
|
-
//#region src/Avatar.tsx
|
|
299
|
-
/**
|
|
300
|
-
* Image avatar with an initials fallback. Initials show until the image loads
|
|
301
|
-
* (and again, React-only, if it errors); the vanilla CSS layers the `<img>`
|
|
302
|
-
* over the initials instead.
|
|
303
|
-
*/
|
|
304
|
-
function Avatar({ src, alt, initials, size = "md", shape = "circle", className, children, ...rest }) {
|
|
305
|
-
const fallback = children ?? initials;
|
|
306
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_base_ui_react_avatar.Avatar.Root, {
|
|
307
|
-
className: cn([
|
|
308
|
-
"avatar",
|
|
309
|
-
size !== "md" && `avatar-${size}`,
|
|
310
|
-
shape === "square" && "avatar-square"
|
|
311
|
-
], className),
|
|
312
|
-
...rest,
|
|
313
|
-
children: [fallback !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_avatar.Avatar.Fallback, { children: fallback }) : null, src !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_avatar.Avatar.Image, {
|
|
314
|
-
src,
|
|
315
|
-
alt
|
|
316
|
-
}) : null]
|
|
317
|
-
});
|
|
318
|
-
}
|
|
319
|
-
/** Overlapping stack of avatars; later children paint on top. `max` caps the visible count. */
|
|
320
|
-
function AvatarGroup({ max, size = "md", className, children, ...rest }) {
|
|
321
|
-
const items = react.Children.toArray(children);
|
|
322
|
-
const overflow = max !== void 0 && items.length > max ? items.length - max : 0;
|
|
323
|
-
const visible = overflow > 0 ? items.slice(0, max) : items;
|
|
324
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
325
|
-
className: cn("avatar-group", className),
|
|
326
|
-
...rest,
|
|
327
|
-
children: [visible, overflow > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
328
|
-
className: cn([
|
|
329
|
-
"avatar",
|
|
330
|
-
size !== "md" && `avatar-${size}`,
|
|
331
|
-
"avatar-more"
|
|
332
|
-
], void 0),
|
|
333
|
-
"aria-label": `+${overflow} more`,
|
|
334
|
-
children: ["+", overflow]
|
|
335
|
-
}) : null]
|
|
336
|
-
});
|
|
337
|
-
}
|
|
338
|
-
//#endregion
|
|
339
95
|
//#region src/hotkey-parse.ts
|
|
340
96
|
var MOD_ORDER = [
|
|
341
97
|
"ctrl",
|
|
@@ -570,50 +326,561 @@ function useHotkey(keys, handler, options) {
|
|
|
570
326
|
return derived;
|
|
571
327
|
}
|
|
572
328
|
/**
|
|
573
|
-
* `useHotkey` bound to a rendered element: the chord dispatches a native
|
|
574
|
-
* `.click()`, so `onClick` fires, `type="submit"` submits, an anchor
|
|
575
|
-
* navigates. Returns `setRef` to pass as the element's ref; it latches the
|
|
576
|
-
* element and forwards `ref`.
|
|
329
|
+
* `useHotkey` bound to a rendered element: the chord dispatches a native
|
|
330
|
+
* `.click()`, so `onClick` fires, `type="submit"` submits, an anchor
|
|
331
|
+
* navigates. Returns `setRef` to pass as the element's ref; it latches the
|
|
332
|
+
* element and forwards `ref`.
|
|
333
|
+
*/
|
|
334
|
+
function useHotkeyClick(keys, ref, options) {
|
|
335
|
+
const elementRef = (0, react.useRef)(null);
|
|
336
|
+
const setRef = (0, react.useCallback)((node) => {
|
|
337
|
+
elementRef.current = node;
|
|
338
|
+
if (typeof ref === "function") ref(node);
|
|
339
|
+
else if (ref) ref.current = node;
|
|
340
|
+
}, [ref]);
|
|
341
|
+
return {
|
|
342
|
+
...useHotkey(keys, () => elementRef.current?.click(), options),
|
|
343
|
+
setRef
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
//#endregion
|
|
347
|
+
//#region src/Button.tsx
|
|
348
|
+
function Button({ variant = "default", size = "md", fullWidth, loading, icon, iconTrailing, hotkey, className, type = "button", disabled, children, onClick, ref, ...rest }) {
|
|
349
|
+
const { ariaKeyShortcuts, primaryChord, setRef } = useHotkeyClick(hotkey, ref, { enabled: !disabled && !loading });
|
|
350
|
+
const iconOnly = children == null && (icon != null || iconTrailing != null);
|
|
351
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_base_ui_react_button.Button, {
|
|
352
|
+
ref: setRef,
|
|
353
|
+
onClick,
|
|
354
|
+
type,
|
|
355
|
+
disabled: disabled || loading,
|
|
356
|
+
"aria-busy": loading || void 0,
|
|
357
|
+
"aria-keyshortcuts": ariaKeyShortcuts,
|
|
358
|
+
className: cn([
|
|
359
|
+
"btn",
|
|
360
|
+
variant !== "default" && `btn-${variant}`,
|
|
361
|
+
size !== "md" && `btn-${size}`,
|
|
362
|
+
fullWidth && "btn-full-width",
|
|
363
|
+
loading && "btn-loading",
|
|
364
|
+
iconOnly && "btn-square"
|
|
365
|
+
], className),
|
|
366
|
+
...rest,
|
|
367
|
+
children: [
|
|
368
|
+
loading ? null : renderIcon(icon),
|
|
369
|
+
children,
|
|
370
|
+
renderIcon(iconTrailing),
|
|
371
|
+
primaryChord !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Kbd, { keys: primaryChord }) : null
|
|
372
|
+
]
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
//#endregion
|
|
376
|
+
//#region src/dialog-internal.ts
|
|
377
|
+
var DialogContext = (0, react.createContext)(null);
|
|
378
|
+
/**
|
|
379
|
+
* Drives a native `<dialog>` from a controlled `open` prop, shared by `<Dialog>`
|
|
380
|
+
* and `<Drawer>`: merges the consumer ref, calls `showModal()` / `close()` on
|
|
381
|
+
* change, and reports closes (Esc, backdrop, form submit) via `onOpenChange`.
|
|
382
|
+
* Returns `ref` for the portal container context.
|
|
383
|
+
*/
|
|
384
|
+
function useDialogElement(open, onOpenChange, consumerRef) {
|
|
385
|
+
const ref = (0, react.useRef)(null);
|
|
386
|
+
const onOpenChangeRef = (0, react.useRef)(onOpenChange);
|
|
387
|
+
onOpenChangeRef.current = onOpenChange;
|
|
388
|
+
const setRef = (0, react.useCallback)((node) => {
|
|
389
|
+
ref.current = node;
|
|
390
|
+
if (typeof consumerRef === "function") consumerRef(node);
|
|
391
|
+
else if (consumerRef) consumerRef.current = node;
|
|
392
|
+
}, [consumerRef]);
|
|
393
|
+
(0, react.useEffect)(() => {
|
|
394
|
+
const el = ref.current;
|
|
395
|
+
if (!el || open === void 0) return;
|
|
396
|
+
if (open && !el.open) el.showModal();
|
|
397
|
+
else if (!open && el.open) el.close();
|
|
398
|
+
}, [open]);
|
|
399
|
+
(0, react.useEffect)(() => {
|
|
400
|
+
const el = ref.current;
|
|
401
|
+
if (!el) return;
|
|
402
|
+
const handleClose = () => onOpenChangeRef.current?.(false);
|
|
403
|
+
el.addEventListener("close", handleClose);
|
|
404
|
+
return () => el.removeEventListener("close", handleClose);
|
|
405
|
+
}, []);
|
|
406
|
+
return {
|
|
407
|
+
setRef,
|
|
408
|
+
ctx: { close: () => ref.current?.close() },
|
|
409
|
+
ref
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
//#endregion
|
|
413
|
+
//#region src/Dialog.tsx
|
|
414
|
+
function DefaultCloseIcon() {
|
|
415
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
416
|
+
width: "16",
|
|
417
|
+
height: "16",
|
|
418
|
+
viewBox: "0 0 24 24",
|
|
419
|
+
fill: "none",
|
|
420
|
+
stroke: "currentColor",
|
|
421
|
+
strokeWidth: "2",
|
|
422
|
+
strokeLinecap: "round",
|
|
423
|
+
strokeLinejoin: "round",
|
|
424
|
+
"aria-hidden": "true",
|
|
425
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M18 6 6 18" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m6 6 12 12" })]
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
/** The bare `<dialog>` primitive — for layouts the default `<Dialog>` doesn't fit. */
|
|
429
|
+
function DialogContainer({ open, onOpenChange, size = "md", closedby = "any", className, children, ref: consumerRef, ...rest }) {
|
|
430
|
+
const { setRef, ctx, ref } = useDialogElement(open, onOpenChange, consumerRef);
|
|
431
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DialogContext.Provider, {
|
|
432
|
+
value: ctx,
|
|
433
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PortalContainerContext.Provider, {
|
|
434
|
+
value: ref,
|
|
435
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("dialog", {
|
|
436
|
+
ref: setRef,
|
|
437
|
+
className: cn(["dialog", size !== "md" && `dialog-${size}`], className),
|
|
438
|
+
closedby,
|
|
439
|
+
...rest,
|
|
440
|
+
children
|
|
441
|
+
})
|
|
442
|
+
})
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
function DialogHeader({ className, ...rest }) {
|
|
446
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
447
|
+
className: cn("dialog-header", className),
|
|
448
|
+
...rest
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
function DialogTitle({ icon, className, children, ...rest }) {
|
|
452
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("h2", {
|
|
453
|
+
className: cn("dialog-title", className),
|
|
454
|
+
...rest,
|
|
455
|
+
children: [renderIcon(icon), children]
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
function DialogDescription({ className, ...rest }) {
|
|
459
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
460
|
+
className: cn("dialog-description", className),
|
|
461
|
+
...rest
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
function DialogBody({ className, ...rest }) {
|
|
465
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
466
|
+
className: cn("dialog-body", className),
|
|
467
|
+
...rest
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
function DialogFooter({ className, ...rest }) {
|
|
471
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
472
|
+
className: cn("dialog-footer", className),
|
|
473
|
+
...rest
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
function DialogCloseButton({ icon, className, children, onClick, type = "button", "aria-label": ariaLabel = "Close", ...rest }) {
|
|
477
|
+
const ctx = (0, react.useContext)(DialogContext);
|
|
478
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
479
|
+
type,
|
|
480
|
+
className: cn("dialog-close", className),
|
|
481
|
+
"aria-label": ariaLabel,
|
|
482
|
+
onClick: (event) => {
|
|
483
|
+
onClick?.(event);
|
|
484
|
+
if (!event.defaultPrevented) ctx?.close();
|
|
485
|
+
},
|
|
486
|
+
...rest,
|
|
487
|
+
children: children ?? (icon !== void 0 ? renderIcon(icon) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DefaultCloseIcon, {}))
|
|
488
|
+
});
|
|
489
|
+
}
|
|
490
|
+
/** Standard modal with shorthand-driven header/body/footer. For other shapes, compose `<Dialog.Container>` by hand. */
|
|
491
|
+
function DialogRoot({ icon, title, description, actions, dismissible = true, closeLabel = "Close", classNames, children, ...containerProps }) {
|
|
492
|
+
const hasTitle = title !== void 0 || icon !== void 0;
|
|
493
|
+
const showHeader = hasTitle || dismissible;
|
|
494
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DialogContainer, {
|
|
495
|
+
...containerProps,
|
|
496
|
+
children: [
|
|
497
|
+
showHeader ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DialogHeader, {
|
|
498
|
+
className: classNames?.header,
|
|
499
|
+
children: [hasTitle ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DialogTitle, {
|
|
500
|
+
icon,
|
|
501
|
+
className: classNames?.title,
|
|
502
|
+
children: title
|
|
503
|
+
}) : null, dismissible ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DialogCloseButton, {
|
|
504
|
+
"aria-label": closeLabel,
|
|
505
|
+
className: classNames?.close
|
|
506
|
+
}) : null]
|
|
507
|
+
}) : null,
|
|
508
|
+
description !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DialogDescription, {
|
|
509
|
+
className: classNames?.description,
|
|
510
|
+
children: description
|
|
511
|
+
}) : null,
|
|
512
|
+
children !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DialogBody, {
|
|
513
|
+
className: classNames?.body,
|
|
514
|
+
children
|
|
515
|
+
}) : null,
|
|
516
|
+
actions !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DialogFooter, {
|
|
517
|
+
className: classNames?.footer,
|
|
518
|
+
children: actions
|
|
519
|
+
}) : null
|
|
520
|
+
]
|
|
521
|
+
});
|
|
522
|
+
}
|
|
523
|
+
var Dialog = Object.assign(DialogRoot, {
|
|
524
|
+
Container: DialogContainer,
|
|
525
|
+
Header: DialogHeader,
|
|
526
|
+
Title: DialogTitle,
|
|
527
|
+
Description: DialogDescription,
|
|
528
|
+
Body: DialogBody,
|
|
529
|
+
Footer: DialogFooter,
|
|
530
|
+
CloseButton: DialogCloseButton
|
|
531
|
+
});
|
|
532
|
+
//#endregion
|
|
533
|
+
//#region src/useConfirm.tsx
|
|
534
|
+
var ConfirmContext = (0, react.createContext)(null);
|
|
535
|
+
/**
|
|
536
|
+
* Returns `confirm(options)`, an async `window.confirm`: it opens a confirmation
|
|
537
|
+
* dialog and resolves `true` on Confirm, `false` on Cancel, Esc, or when the
|
|
538
|
+
* hosting `<AdminRoot>` unmounts. Calls made while a dialog is open queue and
|
|
539
|
+
* open in call order. The function identity is stable.
|
|
540
|
+
*
|
|
541
|
+
* @throws When called outside `<AdminRoot>`, which hosts the dialog.
|
|
542
|
+
*/
|
|
543
|
+
function useConfirm() {
|
|
544
|
+
const confirm = (0, react.useContext)(ConfirmContext);
|
|
545
|
+
if (confirm === null) throw new Error("useConfirm() must be called inside <AdminRoot>, which hosts the dialog.");
|
|
546
|
+
return confirm;
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
* Hosts `useConfirm()` for its subtree: queues requests FIFO and renders the
|
|
550
|
+
* head of the queue as a dialog, nothing while idle. Rendered by `<AdminRoot>`.
|
|
551
|
+
*/
|
|
552
|
+
function ConfirmHost({ children }) {
|
|
553
|
+
const [queue, setQueue] = (0, react.useState)([]);
|
|
554
|
+
const pending = (0, react.useRef)(/* @__PURE__ */ new Set());
|
|
555
|
+
const nextId = (0, react.useRef)(0);
|
|
556
|
+
const confirm = (0, react.useCallback)((options) => new Promise((resolve) => {
|
|
557
|
+
const entry = {
|
|
558
|
+
id: nextId.current++,
|
|
559
|
+
options,
|
|
560
|
+
resolve
|
|
561
|
+
};
|
|
562
|
+
pending.current.add(entry);
|
|
563
|
+
setQueue((q) => [...q, entry]);
|
|
564
|
+
}), []);
|
|
565
|
+
const settle = (0, react.useCallback)((entry, confirmed) => {
|
|
566
|
+
if (pending.current.delete(entry)) entry.resolve(confirmed);
|
|
567
|
+
setQueue((q) => q.filter((e) => e !== entry));
|
|
568
|
+
}, []);
|
|
569
|
+
(0, react.useEffect)(() => {
|
|
570
|
+
const set = pending.current;
|
|
571
|
+
return () => {
|
|
572
|
+
for (const entry of set) entry.resolve(false);
|
|
573
|
+
set.clear();
|
|
574
|
+
setQueue([]);
|
|
575
|
+
};
|
|
576
|
+
}, []);
|
|
577
|
+
const current = queue[0];
|
|
578
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ConfirmContext.Provider, {
|
|
579
|
+
value: confirm,
|
|
580
|
+
children: [children, current !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ConfirmDialog, {
|
|
581
|
+
options: current.options,
|
|
582
|
+
onSettle: (confirmed) => settle(current, confirmed)
|
|
583
|
+
}, current.id) : null]
|
|
584
|
+
});
|
|
585
|
+
}
|
|
586
|
+
function ConfirmDialog({ options, onSettle }) {
|
|
587
|
+
const { title, description, confirmLabel = "Confirm", cancelLabel = "Cancel", variant = "default" } = options;
|
|
588
|
+
const danger = variant === "danger";
|
|
589
|
+
const dialogRef = (0, react.useRef)(null);
|
|
590
|
+
const initialFocusRef = (0, react.useRef)(null);
|
|
591
|
+
const confirmed = (0, react.useRef)(false);
|
|
592
|
+
const titleId = (0, react.useId)();
|
|
593
|
+
const descriptionId = (0, react.useId)();
|
|
594
|
+
(0, react.useEffect)(() => {
|
|
595
|
+
initialFocusRef.current?.focus();
|
|
596
|
+
}, []);
|
|
597
|
+
const answer = (value) => {
|
|
598
|
+
confirmed.current = value;
|
|
599
|
+
dialogRef.current?.close();
|
|
600
|
+
};
|
|
601
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Dialog.Container, {
|
|
602
|
+
ref: dialogRef,
|
|
603
|
+
open: true,
|
|
604
|
+
onOpenChange: (open) => {
|
|
605
|
+
if (!open) onSettle(confirmed.current);
|
|
606
|
+
},
|
|
607
|
+
size: "sm",
|
|
608
|
+
closedby: "closerequest",
|
|
609
|
+
role: "alertdialog",
|
|
610
|
+
"aria-labelledby": titleId,
|
|
611
|
+
"aria-describedby": description !== void 0 ? descriptionId : void 0,
|
|
612
|
+
children: [
|
|
613
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Dialog.Header, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Dialog.Title, {
|
|
614
|
+
id: titleId,
|
|
615
|
+
children: title
|
|
616
|
+
}) }),
|
|
617
|
+
description !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Dialog.Description, {
|
|
618
|
+
id: descriptionId,
|
|
619
|
+
children: description
|
|
620
|
+
}) : null,
|
|
621
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Dialog.Footer, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
622
|
+
ref: danger ? initialFocusRef : void 0,
|
|
623
|
+
variant: "ghost",
|
|
624
|
+
onClick: () => answer(false),
|
|
625
|
+
children: cancelLabel
|
|
626
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
627
|
+
ref: danger ? void 0 : initialFocusRef,
|
|
628
|
+
variant: danger ? "danger" : "primary",
|
|
629
|
+
onClick: () => answer(true),
|
|
630
|
+
children: confirmLabel
|
|
631
|
+
})] })
|
|
632
|
+
]
|
|
633
|
+
});
|
|
634
|
+
}
|
|
635
|
+
//#endregion
|
|
636
|
+
//#region src/AdminRoot.tsx
|
|
637
|
+
function AdminRoot({ className, theme, systemAccent, style, ref, children, ...rest }) {
|
|
638
|
+
const rootStyle = systemAccent !== void 0 ? {
|
|
639
|
+
...style,
|
|
640
|
+
"--color-system-accent": systemAccent
|
|
641
|
+
} : style;
|
|
642
|
+
const portalRef = (0, react.useRef)(null);
|
|
643
|
+
const setRef = (0, react.useCallback)((node) => {
|
|
644
|
+
portalRef.current = node;
|
|
645
|
+
if (typeof ref === "function") ref(node);
|
|
646
|
+
else if (ref) ref.current = node;
|
|
647
|
+
}, [ref]);
|
|
648
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PortalContainerContext.Provider, {
|
|
649
|
+
value: portalRef,
|
|
650
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
651
|
+
ref: setRef,
|
|
652
|
+
className: cn("admin-root", className),
|
|
653
|
+
style: rootStyle,
|
|
654
|
+
...rest,
|
|
655
|
+
...theme !== void 0 && { "data-theme": theme },
|
|
656
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ConfirmHost, { children })
|
|
657
|
+
})
|
|
658
|
+
});
|
|
659
|
+
}
|
|
660
|
+
//#endregion
|
|
661
|
+
//#region src/Alert.tsx
|
|
662
|
+
function DismissIcon() {
|
|
663
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
664
|
+
width: "1em",
|
|
665
|
+
height: "1em",
|
|
666
|
+
viewBox: "0 0 24 24",
|
|
667
|
+
fill: "none",
|
|
668
|
+
stroke: "currentColor",
|
|
669
|
+
strokeWidth: "2",
|
|
670
|
+
strokeLinecap: "round",
|
|
671
|
+
strokeLinejoin: "round",
|
|
672
|
+
"aria-hidden": "true",
|
|
673
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M18 6 6 18" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m6 6 12 12" })]
|
|
674
|
+
});
|
|
675
|
+
}
|
|
676
|
+
function AlertRoot({ variant, icon, title, description, action, onDismiss, dismissLabel = "Dismiss", classNames, className, role, children, ...rest }) {
|
|
677
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
678
|
+
role: role ?? (variant === "danger" || variant === "warning" ? "alert" : "status"),
|
|
679
|
+
className: cn(["alert", `alert-${variant}`], className),
|
|
680
|
+
...rest,
|
|
681
|
+
children: [
|
|
682
|
+
renderIcon(icon),
|
|
683
|
+
title !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AlertTitle, {
|
|
684
|
+
className: classNames?.title,
|
|
685
|
+
children: title
|
|
686
|
+
}) : null,
|
|
687
|
+
description !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AlertDescription, {
|
|
688
|
+
className: classNames?.description,
|
|
689
|
+
children: description
|
|
690
|
+
}) : null,
|
|
691
|
+
children,
|
|
692
|
+
action !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AlertAction, {
|
|
693
|
+
className: classNames?.action,
|
|
694
|
+
children: action
|
|
695
|
+
}) : null,
|
|
696
|
+
onDismiss ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
697
|
+
type: "button",
|
|
698
|
+
className: cn("alert-dismiss", classNames?.dismiss),
|
|
699
|
+
"aria-label": dismissLabel,
|
|
700
|
+
onClick: onDismiss,
|
|
701
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DismissIcon, {})
|
|
702
|
+
}) : null
|
|
703
|
+
]
|
|
704
|
+
});
|
|
705
|
+
}
|
|
706
|
+
function AlertTitle({ className, ...rest }) {
|
|
707
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", {
|
|
708
|
+
className: cn("alert-title", className),
|
|
709
|
+
...rest
|
|
710
|
+
});
|
|
711
|
+
}
|
|
712
|
+
function AlertDescription({ className, ...rest }) {
|
|
713
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
714
|
+
className: cn("alert-description", className),
|
|
715
|
+
...rest
|
|
716
|
+
});
|
|
717
|
+
}
|
|
718
|
+
function AlertAction({ className, ...rest }) {
|
|
719
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
720
|
+
className: cn("alert-action", className),
|
|
721
|
+
...rest
|
|
722
|
+
});
|
|
723
|
+
}
|
|
724
|
+
var Alert = Object.assign(AlertRoot, {
|
|
725
|
+
Title: AlertTitle,
|
|
726
|
+
Description: AlertDescription,
|
|
727
|
+
Action: AlertAction
|
|
728
|
+
});
|
|
729
|
+
//#endregion
|
|
730
|
+
//#region src/AppShell.tsx
|
|
731
|
+
var AppShellContext = (0, react.createContext)(null);
|
|
732
|
+
function useAppShell() {
|
|
733
|
+
return (0, react.useContext)(AppShellContext);
|
|
734
|
+
}
|
|
735
|
+
function AppShellRoot({ hasSidebar = false, mobileDrawerOpen, defaultMobileDrawerOpen = false, onMobileDrawerOpenChange, systemAccent, className, style, children, ...rest }) {
|
|
736
|
+
const [uncontrolledOpen, setUncontrolledOpen] = (0, react.useState)(defaultMobileDrawerOpen);
|
|
737
|
+
const isControlled = mobileDrawerOpen !== void 0;
|
|
738
|
+
const open = isControlled ? mobileDrawerOpen : uncontrolledOpen;
|
|
739
|
+
const value = (0, react.useMemo)(() => ({
|
|
740
|
+
mobileDrawerOpen: open,
|
|
741
|
+
setMobileDrawerOpen: (next) => {
|
|
742
|
+
if (!isControlled) setUncontrolledOpen(next);
|
|
743
|
+
onMobileDrawerOpenChange?.(next);
|
|
744
|
+
},
|
|
745
|
+
hasSidebar
|
|
746
|
+
}), [
|
|
747
|
+
open,
|
|
748
|
+
isControlled,
|
|
749
|
+
onMobileDrawerOpenChange,
|
|
750
|
+
hasSidebar
|
|
751
|
+
]);
|
|
752
|
+
const rootStyle = systemAccent !== void 0 ? {
|
|
753
|
+
...style,
|
|
754
|
+
"--color-system-accent": systemAccent
|
|
755
|
+
} : style;
|
|
756
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AppShellContext.Provider, {
|
|
757
|
+
value,
|
|
758
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
759
|
+
className: cn(["app-shell", hasSidebar && "app-shell-with-sidebar"], className),
|
|
760
|
+
style: rootStyle,
|
|
761
|
+
...rest,
|
|
762
|
+
children
|
|
763
|
+
})
|
|
764
|
+
});
|
|
765
|
+
}
|
|
766
|
+
function AppShellMain({ className, ...rest }) {
|
|
767
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("main", {
|
|
768
|
+
className: cn("app-shell-main", className),
|
|
769
|
+
...rest
|
|
770
|
+
});
|
|
771
|
+
}
|
|
772
|
+
var AppShell = Object.assign(AppShellRoot, { Main: AppShellMain });
|
|
773
|
+
//#endregion
|
|
774
|
+
//#region src/Badge.tsx
|
|
775
|
+
function RemoveIcon() {
|
|
776
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
777
|
+
width: "1em",
|
|
778
|
+
height: "1em",
|
|
779
|
+
viewBox: "0 0 24 24",
|
|
780
|
+
fill: "none",
|
|
781
|
+
stroke: "currentColor",
|
|
782
|
+
strokeWidth: "2",
|
|
783
|
+
strokeLinecap: "round",
|
|
784
|
+
strokeLinejoin: "round",
|
|
785
|
+
"aria-hidden": "true",
|
|
786
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M18 6 6 18" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m6 6 12 12" })]
|
|
787
|
+
});
|
|
788
|
+
}
|
|
789
|
+
function Badge({ variant = "neutral", size = "md", icon, soft = false, onRemove, removeLabel = "Remove", className, children, ...rest }) {
|
|
790
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
791
|
+
className: cn([
|
|
792
|
+
"badge",
|
|
793
|
+
variant !== "neutral" && `badge-${variant}`,
|
|
794
|
+
size !== "md" && `badge-${size}`,
|
|
795
|
+
soft && "badge-soft"
|
|
796
|
+
], className),
|
|
797
|
+
...rest,
|
|
798
|
+
children: [
|
|
799
|
+
renderIcon(icon),
|
|
800
|
+
children,
|
|
801
|
+
onRemove ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
802
|
+
type: "button",
|
|
803
|
+
className: cn("badge-remove", void 0),
|
|
804
|
+
"aria-label": removeLabel,
|
|
805
|
+
onClick: onRemove,
|
|
806
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RemoveIcon, {})
|
|
807
|
+
}) : null
|
|
808
|
+
]
|
|
809
|
+
});
|
|
810
|
+
}
|
|
811
|
+
//#endregion
|
|
812
|
+
//#region src/BrandTile.tsx
|
|
813
|
+
/**
|
|
814
|
+
* Brand/system mark for the navbar — monogram, icon, or shop logo. Precedence
|
|
815
|
+
* is `src` > `icon` > `monogram`. Monogram/icon tiles are `aria-hidden`; image
|
|
816
|
+
* tiles expose `alt` to assistive tech instead.
|
|
817
|
+
*/
|
|
818
|
+
function BrandTile({ variant = "solid", size = "md", monogram, icon, src, alt = "", systemAccent, className, style, children, ...rest }) {
|
|
819
|
+
const tileStyle = systemAccent !== void 0 ? {
|
|
820
|
+
...style,
|
|
821
|
+
"--color-system-accent": systemAccent
|
|
822
|
+
} : style;
|
|
823
|
+
const classes = cn([
|
|
824
|
+
"brand-tile",
|
|
825
|
+
variant !== "solid" && `brand-tile-${variant}`,
|
|
826
|
+
size === "lg" && "brand-tile-lg"
|
|
827
|
+
], className);
|
|
828
|
+
if (src) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
829
|
+
className: classes,
|
|
830
|
+
style: tileStyle,
|
|
831
|
+
...rest,
|
|
832
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
833
|
+
src,
|
|
834
|
+
alt
|
|
835
|
+
})
|
|
836
|
+
});
|
|
837
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
838
|
+
className: classes,
|
|
839
|
+
style: tileStyle,
|
|
840
|
+
"aria-hidden": true,
|
|
841
|
+
...rest,
|
|
842
|
+
children: icon ? renderIcon(icon) : children ?? monogram
|
|
843
|
+
});
|
|
844
|
+
}
|
|
845
|
+
//#endregion
|
|
846
|
+
//#region src/Avatar.tsx
|
|
847
|
+
/**
|
|
848
|
+
* Image avatar with an initials fallback. Initials show until the image loads
|
|
849
|
+
* (and again, React-only, if it errors); the vanilla CSS layers the `<img>`
|
|
850
|
+
* over the initials instead.
|
|
577
851
|
*/
|
|
578
|
-
function
|
|
579
|
-
const
|
|
580
|
-
|
|
581
|
-
elementRef.current = node;
|
|
582
|
-
if (typeof ref === "function") ref(node);
|
|
583
|
-
else if (ref) ref.current = node;
|
|
584
|
-
}, [ref]);
|
|
585
|
-
return {
|
|
586
|
-
...useHotkey(keys, () => elementRef.current?.click(), options),
|
|
587
|
-
setRef
|
|
588
|
-
};
|
|
589
|
-
}
|
|
590
|
-
//#endregion
|
|
591
|
-
//#region src/Button.tsx
|
|
592
|
-
function Button({ variant = "default", size = "md", fullWidth, loading, icon, iconTrailing, hotkey, className, type = "button", disabled, children, onClick, ref, ...rest }) {
|
|
593
|
-
const { ariaKeyShortcuts, primaryChord, setRef } = useHotkeyClick(hotkey, ref, { enabled: !disabled && !loading });
|
|
594
|
-
const iconOnly = children == null && (icon != null || iconTrailing != null);
|
|
595
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_base_ui_react_button.Button, {
|
|
596
|
-
ref: setRef,
|
|
597
|
-
onClick,
|
|
598
|
-
type,
|
|
599
|
-
disabled: disabled || loading,
|
|
600
|
-
"aria-busy": loading || void 0,
|
|
601
|
-
"aria-keyshortcuts": ariaKeyShortcuts,
|
|
852
|
+
function Avatar({ src, alt, initials, size = "md", shape = "circle", className, children, ...rest }) {
|
|
853
|
+
const fallback = children ?? initials;
|
|
854
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_base_ui_react_avatar.Avatar.Root, {
|
|
602
855
|
className: cn([
|
|
603
|
-
"
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
fullWidth && "btn-full-width",
|
|
607
|
-
loading && "btn-loading",
|
|
608
|
-
iconOnly && "btn-square"
|
|
856
|
+
"avatar",
|
|
857
|
+
size !== "md" && `avatar-${size}`,
|
|
858
|
+
shape === "square" && "avatar-square"
|
|
609
859
|
], className),
|
|
610
860
|
...rest,
|
|
611
|
-
children: [
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
861
|
+
children: [fallback !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_avatar.Avatar.Fallback, { children: fallback }) : null, src !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_avatar.Avatar.Image, {
|
|
862
|
+
src,
|
|
863
|
+
alt
|
|
864
|
+
}) : null]
|
|
865
|
+
});
|
|
866
|
+
}
|
|
867
|
+
/** Overlapping stack of avatars; later children paint on top. `max` caps the visible count. */
|
|
868
|
+
function AvatarGroup({ max, size = "md", className, children, ...rest }) {
|
|
869
|
+
const items = react.Children.toArray(children);
|
|
870
|
+
const overflow = max !== void 0 && items.length > max ? items.length - max : 0;
|
|
871
|
+
const visible = overflow > 0 ? items.slice(0, max) : items;
|
|
872
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
873
|
+
className: cn("avatar-group", className),
|
|
874
|
+
...rest,
|
|
875
|
+
children: [visible, overflow > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
876
|
+
className: cn([
|
|
877
|
+
"avatar",
|
|
878
|
+
size !== "md" && `avatar-${size}`,
|
|
879
|
+
"avatar-more"
|
|
880
|
+
], void 0),
|
|
881
|
+
"aria-label": `+${overflow} more`,
|
|
882
|
+
children: ["+", overflow]
|
|
883
|
+
}) : null]
|
|
617
884
|
});
|
|
618
885
|
}
|
|
619
886
|
//#endregion
|
|
@@ -1270,6 +1537,7 @@ function SelectPopup({ className, sideOffset = 4, children, ...rest }) {
|
|
|
1270
1537
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_select.Select.Portal, {
|
|
1271
1538
|
container: portalContainer ?? void 0,
|
|
1272
1539
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_select.Select.Positioner, {
|
|
1540
|
+
className: cn("popup-layer", void 0),
|
|
1273
1541
|
sideOffset,
|
|
1274
1542
|
alignItemWithTrigger: false,
|
|
1275
1543
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_select.Select.Popup, {
|
|
@@ -1351,13 +1619,18 @@ var Select = Object.assign(SelectRoot, {
|
|
|
1351
1619
|
* gap between stacked sections. Place inside `<AppShell.Main>`, which has no
|
|
1352
1620
|
* padding of its own. Not the `.Container` escape hatch (`Card.Container`).
|
|
1353
1621
|
*/
|
|
1354
|
-
function Container({ size = "md", compact, className, ...rest }) {
|
|
1622
|
+
function Container({ size = "md", compact, maxWidth, className, style, ...rest }) {
|
|
1623
|
+
const rootStyle = maxWidth !== void 0 ? {
|
|
1624
|
+
...style,
|
|
1625
|
+
"--container-max": maxWidth
|
|
1626
|
+
} : style;
|
|
1355
1627
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1356
1628
|
className: cn([
|
|
1357
1629
|
"container",
|
|
1358
1630
|
size !== "md" && `container-${size}`,
|
|
1359
1631
|
compact && "container-compact"
|
|
1360
1632
|
], className),
|
|
1633
|
+
style: rootStyle,
|
|
1361
1634
|
...rest
|
|
1362
1635
|
});
|
|
1363
1636
|
}
|
|
@@ -1771,13 +2044,14 @@ function Bar({ datum, value, label, color, className, style, ...rest }) {
|
|
|
1771
2044
|
}
|
|
1772
2045
|
/** Single-series bar chart. For hand-composed layouts use `<BarChart.Container>` + `<BarChart.Bar>`. */
|
|
1773
2046
|
function BarChartRoot({ data, max, orientation = "horizontal", size = "md", showValues, inline, variant = "info", style, "aria-label": ariaLabel, ...rest }) {
|
|
2047
|
+
const resolvedMax = computeMax(data, max);
|
|
1774
2048
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BarChartContainer, {
|
|
1775
2049
|
orientation,
|
|
1776
2050
|
size,
|
|
1777
2051
|
showValues,
|
|
1778
2052
|
inline,
|
|
1779
2053
|
variant,
|
|
1780
|
-
style: mergeStyle({ "--chart-max":
|
|
2054
|
+
style: mergeStyle({ "--chart-max": resolvedMax }, style),
|
|
1781
2055
|
"aria-label": ariaLabel ?? buildAriaLabel("bar", data),
|
|
1782
2056
|
...rest,
|
|
1783
2057
|
children: data.map((d, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Bar, { datum: d }, d.label ?? i))
|
|
@@ -1900,163 +2174,6 @@ var StackedBar = Object.assign(StackedBarRoot, {
|
|
|
1900
2174
|
Legend: ChartLegend
|
|
1901
2175
|
});
|
|
1902
2176
|
//#endregion
|
|
1903
|
-
//#region src/dialog-internal.ts
|
|
1904
|
-
var DialogContext = (0, react.createContext)(null);
|
|
1905
|
-
/**
|
|
1906
|
-
* Drives a native `<dialog>` from a controlled `open` prop, shared by `<Dialog>`
|
|
1907
|
-
* and `<Drawer>`: merges the consumer ref, calls `showModal()` / `close()` on
|
|
1908
|
-
* change, and reports closes (Esc, backdrop, form submit) via `onOpenChange`.
|
|
1909
|
-
* Returns `ref` for the portal container context.
|
|
1910
|
-
*/
|
|
1911
|
-
function useDialogElement(open, onOpenChange, consumerRef) {
|
|
1912
|
-
const ref = (0, react.useRef)(null);
|
|
1913
|
-
const onOpenChangeRef = (0, react.useRef)(onOpenChange);
|
|
1914
|
-
onOpenChangeRef.current = onOpenChange;
|
|
1915
|
-
const setRef = (0, react.useCallback)((node) => {
|
|
1916
|
-
ref.current = node;
|
|
1917
|
-
if (typeof consumerRef === "function") consumerRef(node);
|
|
1918
|
-
else if (consumerRef) consumerRef.current = node;
|
|
1919
|
-
}, [consumerRef]);
|
|
1920
|
-
(0, react.useEffect)(() => {
|
|
1921
|
-
const el = ref.current;
|
|
1922
|
-
if (!el || open === void 0) return;
|
|
1923
|
-
if (open && !el.open) el.showModal();
|
|
1924
|
-
else if (!open && el.open) el.close();
|
|
1925
|
-
}, [open]);
|
|
1926
|
-
(0, react.useEffect)(() => {
|
|
1927
|
-
const el = ref.current;
|
|
1928
|
-
if (!el) return;
|
|
1929
|
-
const handleClose = () => onOpenChangeRef.current?.(false);
|
|
1930
|
-
el.addEventListener("close", handleClose);
|
|
1931
|
-
return () => el.removeEventListener("close", handleClose);
|
|
1932
|
-
}, []);
|
|
1933
|
-
return {
|
|
1934
|
-
setRef,
|
|
1935
|
-
ctx: { close: () => ref.current?.close() },
|
|
1936
|
-
ref
|
|
1937
|
-
};
|
|
1938
|
-
}
|
|
1939
|
-
//#endregion
|
|
1940
|
-
//#region src/Dialog.tsx
|
|
1941
|
-
function DefaultCloseIcon() {
|
|
1942
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
1943
|
-
width: "16",
|
|
1944
|
-
height: "16",
|
|
1945
|
-
viewBox: "0 0 24 24",
|
|
1946
|
-
fill: "none",
|
|
1947
|
-
stroke: "currentColor",
|
|
1948
|
-
strokeWidth: "2",
|
|
1949
|
-
strokeLinecap: "round",
|
|
1950
|
-
strokeLinejoin: "round",
|
|
1951
|
-
"aria-hidden": "true",
|
|
1952
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M18 6 6 18" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m6 6 12 12" })]
|
|
1953
|
-
});
|
|
1954
|
-
}
|
|
1955
|
-
/** The bare `<dialog>` primitive — for layouts the default `<Dialog>` doesn't fit. */
|
|
1956
|
-
function DialogContainer({ open, onOpenChange, size = "md", closedby = "any", className, children, ref: consumerRef, ...rest }) {
|
|
1957
|
-
const { setRef, ctx, ref } = useDialogElement(open, onOpenChange, consumerRef);
|
|
1958
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DialogContext.Provider, {
|
|
1959
|
-
value: ctx,
|
|
1960
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PortalContainerContext.Provider, {
|
|
1961
|
-
value: ref,
|
|
1962
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("dialog", {
|
|
1963
|
-
ref: setRef,
|
|
1964
|
-
className: cn(["dialog", size !== "md" && `dialog-${size}`], className),
|
|
1965
|
-
closedby,
|
|
1966
|
-
...rest,
|
|
1967
|
-
children
|
|
1968
|
-
})
|
|
1969
|
-
})
|
|
1970
|
-
});
|
|
1971
|
-
}
|
|
1972
|
-
function DialogHeader({ className, ...rest }) {
|
|
1973
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1974
|
-
className: cn("dialog-header", className),
|
|
1975
|
-
...rest
|
|
1976
|
-
});
|
|
1977
|
-
}
|
|
1978
|
-
function DialogTitle({ icon, className, children, ...rest }) {
|
|
1979
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("h2", {
|
|
1980
|
-
className: cn("dialog-title", className),
|
|
1981
|
-
...rest,
|
|
1982
|
-
children: [renderIcon(icon), children]
|
|
1983
|
-
});
|
|
1984
|
-
}
|
|
1985
|
-
function DialogDescription({ className, ...rest }) {
|
|
1986
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1987
|
-
className: cn("dialog-description", className),
|
|
1988
|
-
...rest
|
|
1989
|
-
});
|
|
1990
|
-
}
|
|
1991
|
-
function DialogBody({ className, ...rest }) {
|
|
1992
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1993
|
-
className: cn("dialog-body", className),
|
|
1994
|
-
...rest
|
|
1995
|
-
});
|
|
1996
|
-
}
|
|
1997
|
-
function DialogFooter({ className, ...rest }) {
|
|
1998
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1999
|
-
className: cn("dialog-footer", className),
|
|
2000
|
-
...rest
|
|
2001
|
-
});
|
|
2002
|
-
}
|
|
2003
|
-
function DialogCloseButton({ icon, className, children, onClick, type = "button", "aria-label": ariaLabel = "Close", ...rest }) {
|
|
2004
|
-
const ctx = (0, react.useContext)(DialogContext);
|
|
2005
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
2006
|
-
type,
|
|
2007
|
-
className: cn("dialog-close", className),
|
|
2008
|
-
"aria-label": ariaLabel,
|
|
2009
|
-
onClick: (event) => {
|
|
2010
|
-
onClick?.(event);
|
|
2011
|
-
if (!event.defaultPrevented) ctx?.close();
|
|
2012
|
-
},
|
|
2013
|
-
...rest,
|
|
2014
|
-
children: children ?? (icon !== void 0 ? renderIcon(icon) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DefaultCloseIcon, {}))
|
|
2015
|
-
});
|
|
2016
|
-
}
|
|
2017
|
-
/** Standard modal with shorthand-driven header/body/footer. For other shapes, compose `<Dialog.Container>` by hand. */
|
|
2018
|
-
function DialogRoot({ icon, title, description, actions, dismissible = true, closeLabel = "Close", classNames, children, ...containerProps }) {
|
|
2019
|
-
const hasTitle = title !== void 0 || icon !== void 0;
|
|
2020
|
-
const showHeader = hasTitle || dismissible;
|
|
2021
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DialogContainer, {
|
|
2022
|
-
...containerProps,
|
|
2023
|
-
children: [
|
|
2024
|
-
showHeader ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DialogHeader, {
|
|
2025
|
-
className: classNames?.header,
|
|
2026
|
-
children: [hasTitle ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DialogTitle, {
|
|
2027
|
-
icon,
|
|
2028
|
-
className: classNames?.title,
|
|
2029
|
-
children: title
|
|
2030
|
-
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: cn("flex-1", void 0) }), dismissible ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DialogCloseButton, {
|
|
2031
|
-
"aria-label": closeLabel,
|
|
2032
|
-
className: classNames?.close
|
|
2033
|
-
}) : null]
|
|
2034
|
-
}) : null,
|
|
2035
|
-
description !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DialogDescription, {
|
|
2036
|
-
className: classNames?.description,
|
|
2037
|
-
children: description
|
|
2038
|
-
}) : null,
|
|
2039
|
-
children !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DialogBody, {
|
|
2040
|
-
className: classNames?.body,
|
|
2041
|
-
children
|
|
2042
|
-
}) : null,
|
|
2043
|
-
actions !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DialogFooter, {
|
|
2044
|
-
className: classNames?.footer,
|
|
2045
|
-
children: actions
|
|
2046
|
-
}) : null
|
|
2047
|
-
]
|
|
2048
|
-
});
|
|
2049
|
-
}
|
|
2050
|
-
var Dialog = Object.assign(DialogRoot, {
|
|
2051
|
-
Container: DialogContainer,
|
|
2052
|
-
Header: DialogHeader,
|
|
2053
|
-
Title: DialogTitle,
|
|
2054
|
-
Description: DialogDescription,
|
|
2055
|
-
Body: DialogBody,
|
|
2056
|
-
Footer: DialogFooter,
|
|
2057
|
-
CloseButton: DialogCloseButton
|
|
2058
|
-
});
|
|
2059
|
-
//#endregion
|
|
2060
2177
|
//#region src/Drawer.tsx
|
|
2061
2178
|
/** The bare edge-anchored `<dialog>` primitive — for layouts the default `<Drawer>` doesn't fit. */
|
|
2062
2179
|
function DrawerContainer({ open, onOpenChange, side = "end", size = "md", closedby = "any", className, children, ref: consumerRef, ...rest }) {
|
|
@@ -2093,7 +2210,7 @@ function DrawerRoot({ icon, title, description, actions, dismissible = true, clo
|
|
|
2093
2210
|
icon,
|
|
2094
2211
|
className: classNames?.title,
|
|
2095
2212
|
children: title
|
|
2096
|
-
}) :
|
|
2213
|
+
}) : null, dismissible ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Dialog.CloseButton, {
|
|
2097
2214
|
"aria-label": closeLabel,
|
|
2098
2215
|
className: classNames?.close
|
|
2099
2216
|
}) : null]
|
|
@@ -2160,7 +2277,7 @@ function FieldRoot({ label, description, error, required, inline, className, cla
|
|
|
2160
2277
|
}
|
|
2161
2278
|
function FieldLabel({ className, required, ...rest }) {
|
|
2162
2279
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_field.Field.Label, {
|
|
2163
|
-
"data-required": required ? "" :
|
|
2280
|
+
"data-required": required === void 0 ? void 0 : required ? "" : "false",
|
|
2164
2281
|
className: cn("field-label", className),
|
|
2165
2282
|
...rest
|
|
2166
2283
|
});
|
|
@@ -2223,10 +2340,16 @@ function MenuRoot({ className, ...rest }) {
|
|
|
2223
2340
|
...rest
|
|
2224
2341
|
});
|
|
2225
2342
|
}
|
|
2226
|
-
function MenuTrigger({ className, ...rest }) {
|
|
2343
|
+
function MenuTrigger({ variant, size = "md", className, children, ...rest }) {
|
|
2227
2344
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("summary", {
|
|
2228
|
-
className: cn("menu-trigger",
|
|
2229
|
-
|
|
2345
|
+
className: cn(["menu-trigger", variant !== void 0 && [
|
|
2346
|
+
"btn",
|
|
2347
|
+
variant !== "default" && `btn-${variant}`,
|
|
2348
|
+
size !== "md" && `btn-${size}`,
|
|
2349
|
+
children == null && "btn-square"
|
|
2350
|
+
]], className),
|
|
2351
|
+
...rest,
|
|
2352
|
+
children
|
|
2230
2353
|
});
|
|
2231
2354
|
}
|
|
2232
2355
|
function MenuPopup({ className, role = "menu", ...rest }) {
|
|
@@ -2333,9 +2456,14 @@ var Menu = Object.assign(MenuRoot, {
|
|
|
2333
2456
|
});
|
|
2334
2457
|
//#endregion
|
|
2335
2458
|
//#region src/Navbar.tsx
|
|
2336
|
-
function NavbarRoot({ className, ...rest }) {
|
|
2459
|
+
function NavbarRoot({ systemAccent, className, style, ...rest }) {
|
|
2460
|
+
const rootStyle = systemAccent !== void 0 ? {
|
|
2461
|
+
...style,
|
|
2462
|
+
"--color-system-accent": systemAccent
|
|
2463
|
+
} : style;
|
|
2337
2464
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("header", {
|
|
2338
2465
|
className: cn("navbar", className),
|
|
2466
|
+
style: rootStyle,
|
|
2339
2467
|
...rest
|
|
2340
2468
|
});
|
|
2341
2469
|
}
|
|
@@ -2476,6 +2604,7 @@ function TooltipPopup({ size = "md", side = "top", align = "center", sideOffset
|
|
|
2476
2604
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_tooltip.Tooltip.Portal, {
|
|
2477
2605
|
container: portalContainer ?? void 0,
|
|
2478
2606
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_tooltip.Tooltip.Positioner, {
|
|
2607
|
+
className: cn("popup-layer", void 0),
|
|
2479
2608
|
sideOffset,
|
|
2480
2609
|
side,
|
|
2481
2610
|
align,
|
|
@@ -2866,20 +2995,13 @@ function SidebarCollapseToggle({ label = "Toggle sidebar", className, classNames
|
|
|
2866
2995
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
2867
2996
|
className: cn("sidebar-collapse-toggle", className),
|
|
2868
2997
|
...rest,
|
|
2869
|
-
children: [
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
}),
|
|
2877
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2878
|
-
className: cn("sr-only", void 0),
|
|
2879
|
-
children: label
|
|
2880
|
-
}),
|
|
2881
|
-
children
|
|
2882
|
-
]
|
|
2998
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
2999
|
+
type: "checkbox",
|
|
3000
|
+
className: cn("sidebar-toggle", classNames?.input),
|
|
3001
|
+
"aria-label": label,
|
|
3002
|
+
...isControlled ? { checked: controlledChecked } : { defaultChecked: ctx?.defaultCollapsed },
|
|
3003
|
+
onChange: (event) => ctx?.onCollapsedChange?.(event.currentTarget.checked)
|
|
3004
|
+
}), children]
|
|
2883
3005
|
});
|
|
2884
3006
|
}
|
|
2885
3007
|
var Sidebar = Object.assign(SidebarRoot, {
|
|
@@ -2953,6 +3075,7 @@ exports.ToggleButton = ToggleButton;
|
|
|
2953
3075
|
exports.Tooltip = Tooltip;
|
|
2954
3076
|
exports.getPaginationItems = getPaginationItems;
|
|
2955
3077
|
exports.useAppShell = useAppShell;
|
|
3078
|
+
exports.useConfirm = useConfirm;
|
|
2956
3079
|
exports.useHotkey = useHotkey;
|
|
2957
3080
|
|
|
2958
3081
|
//# sourceMappingURL=index.cjs.map
|