@aortl/admin-react 0.20.1 → 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/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 useHotkeyClick(keys, ref, options) {
579
- const elementRef = (0, react.useRef)(null);
580
- const setRef = (0, react.useCallback)((node) => {
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
- "btn",
604
- variant !== "default" && `btn-${variant}`,
605
- size !== "md" && `btn-${size}`,
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
- loading ? null : renderIcon(icon),
613
- children,
614
- renderIcon(iconTrailing),
615
- primaryChord !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Kbd, { keys: primaryChord }) : null
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
@@ -1352,13 +1619,18 @@ var Select = Object.assign(SelectRoot, {
1352
1619
  * gap between stacked sections. Place inside `<AppShell.Main>`, which has no
1353
1620
  * padding of its own. Not the `.Container` escape hatch (`Card.Container`).
1354
1621
  */
1355
- 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;
1356
1627
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1357
1628
  className: cn([
1358
1629
  "container",
1359
1630
  size !== "md" && `container-${size}`,
1360
1631
  compact && "container-compact"
1361
1632
  ], className),
1633
+ style: rootStyle,
1362
1634
  ...rest
1363
1635
  });
1364
1636
  }
@@ -1772,13 +2044,14 @@ function Bar({ datum, value, label, color, className, style, ...rest }) {
1772
2044
  }
1773
2045
  /** Single-series bar chart. For hand-composed layouts use `<BarChart.Container>` + `<BarChart.Bar>`. */
1774
2046
  function BarChartRoot({ data, max, orientation = "horizontal", size = "md", showValues, inline, variant = "info", style, "aria-label": ariaLabel, ...rest }) {
2047
+ const resolvedMax = computeMax(data, max);
1775
2048
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BarChartContainer, {
1776
2049
  orientation,
1777
2050
  size,
1778
2051
  showValues,
1779
2052
  inline,
1780
2053
  variant,
1781
- style: mergeStyle({ "--chart-max": computeMax(data, max) }, style),
2054
+ style: mergeStyle({ "--chart-max": resolvedMax }, style),
1782
2055
  "aria-label": ariaLabel ?? buildAriaLabel("bar", data),
1783
2056
  ...rest,
1784
2057
  children: data.map((d, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Bar, { datum: d }, d.label ?? i))
@@ -1901,163 +2174,6 @@ var StackedBar = Object.assign(StackedBarRoot, {
1901
2174
  Legend: ChartLegend
1902
2175
  });
1903
2176
  //#endregion
1904
- //#region src/dialog-internal.ts
1905
- var DialogContext = (0, react.createContext)(null);
1906
- /**
1907
- * Drives a native `<dialog>` from a controlled `open` prop, shared by `<Dialog>`
1908
- * and `<Drawer>`: merges the consumer ref, calls `showModal()` / `close()` on
1909
- * change, and reports closes (Esc, backdrop, form submit) via `onOpenChange`.
1910
- * Returns `ref` for the portal container context.
1911
- */
1912
- function useDialogElement(open, onOpenChange, consumerRef) {
1913
- const ref = (0, react.useRef)(null);
1914
- const onOpenChangeRef = (0, react.useRef)(onOpenChange);
1915
- onOpenChangeRef.current = onOpenChange;
1916
- const setRef = (0, react.useCallback)((node) => {
1917
- ref.current = node;
1918
- if (typeof consumerRef === "function") consumerRef(node);
1919
- else if (consumerRef) consumerRef.current = node;
1920
- }, [consumerRef]);
1921
- (0, react.useEffect)(() => {
1922
- const el = ref.current;
1923
- if (!el || open === void 0) return;
1924
- if (open && !el.open) el.showModal();
1925
- else if (!open && el.open) el.close();
1926
- }, [open]);
1927
- (0, react.useEffect)(() => {
1928
- const el = ref.current;
1929
- if (!el) return;
1930
- const handleClose = () => onOpenChangeRef.current?.(false);
1931
- el.addEventListener("close", handleClose);
1932
- return () => el.removeEventListener("close", handleClose);
1933
- }, []);
1934
- return {
1935
- setRef,
1936
- ctx: { close: () => ref.current?.close() },
1937
- ref
1938
- };
1939
- }
1940
- //#endregion
1941
- //#region src/Dialog.tsx
1942
- function DefaultCloseIcon() {
1943
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
1944
- width: "16",
1945
- height: "16",
1946
- viewBox: "0 0 24 24",
1947
- fill: "none",
1948
- stroke: "currentColor",
1949
- strokeWidth: "2",
1950
- strokeLinecap: "round",
1951
- strokeLinejoin: "round",
1952
- "aria-hidden": "true",
1953
- 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" })]
1954
- });
1955
- }
1956
- /** The bare `<dialog>` primitive — for layouts the default `<Dialog>` doesn't fit. */
1957
- function DialogContainer({ open, onOpenChange, size = "md", closedby = "any", className, children, ref: consumerRef, ...rest }) {
1958
- const { setRef, ctx, ref } = useDialogElement(open, onOpenChange, consumerRef);
1959
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DialogContext.Provider, {
1960
- value: ctx,
1961
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PortalContainerContext.Provider, {
1962
- value: ref,
1963
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("dialog", {
1964
- ref: setRef,
1965
- className: cn(["dialog", size !== "md" && `dialog-${size}`], className),
1966
- closedby,
1967
- ...rest,
1968
- children
1969
- })
1970
- })
1971
- });
1972
- }
1973
- function DialogHeader({ className, ...rest }) {
1974
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1975
- className: cn("dialog-header", className),
1976
- ...rest
1977
- });
1978
- }
1979
- function DialogTitle({ icon, className, children, ...rest }) {
1980
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("h2", {
1981
- className: cn("dialog-title", className),
1982
- ...rest,
1983
- children: [renderIcon(icon), children]
1984
- });
1985
- }
1986
- function DialogDescription({ className, ...rest }) {
1987
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1988
- className: cn("dialog-description", className),
1989
- ...rest
1990
- });
1991
- }
1992
- function DialogBody({ className, ...rest }) {
1993
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1994
- className: cn("dialog-body", className),
1995
- ...rest
1996
- });
1997
- }
1998
- function DialogFooter({ className, ...rest }) {
1999
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2000
- className: cn("dialog-footer", className),
2001
- ...rest
2002
- });
2003
- }
2004
- function DialogCloseButton({ icon, className, children, onClick, type = "button", "aria-label": ariaLabel = "Close", ...rest }) {
2005
- const ctx = (0, react.useContext)(DialogContext);
2006
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2007
- type,
2008
- className: cn("dialog-close", className),
2009
- "aria-label": ariaLabel,
2010
- onClick: (event) => {
2011
- onClick?.(event);
2012
- if (!event.defaultPrevented) ctx?.close();
2013
- },
2014
- ...rest,
2015
- children: children ?? (icon !== void 0 ? renderIcon(icon) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DefaultCloseIcon, {}))
2016
- });
2017
- }
2018
- /** Standard modal with shorthand-driven header/body/footer. For other shapes, compose `<Dialog.Container>` by hand. */
2019
- function DialogRoot({ icon, title, description, actions, dismissible = true, closeLabel = "Close", classNames, children, ...containerProps }) {
2020
- const hasTitle = title !== void 0 || icon !== void 0;
2021
- const showHeader = hasTitle || dismissible;
2022
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DialogContainer, {
2023
- ...containerProps,
2024
- children: [
2025
- showHeader ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DialogHeader, {
2026
- className: classNames?.header,
2027
- children: [hasTitle ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DialogTitle, {
2028
- icon,
2029
- className: classNames?.title,
2030
- children: title
2031
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: cn("flex-1", void 0) }), dismissible ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DialogCloseButton, {
2032
- "aria-label": closeLabel,
2033
- className: classNames?.close
2034
- }) : null]
2035
- }) : null,
2036
- description !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DialogDescription, {
2037
- className: classNames?.description,
2038
- children: description
2039
- }) : null,
2040
- children !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DialogBody, {
2041
- className: classNames?.body,
2042
- children
2043
- }) : null,
2044
- actions !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DialogFooter, {
2045
- className: classNames?.footer,
2046
- children: actions
2047
- }) : null
2048
- ]
2049
- });
2050
- }
2051
- var Dialog = Object.assign(DialogRoot, {
2052
- Container: DialogContainer,
2053
- Header: DialogHeader,
2054
- Title: DialogTitle,
2055
- Description: DialogDescription,
2056
- Body: DialogBody,
2057
- Footer: DialogFooter,
2058
- CloseButton: DialogCloseButton
2059
- });
2060
- //#endregion
2061
2177
  //#region src/Drawer.tsx
2062
2178
  /** The bare edge-anchored `<dialog>` primitive — for layouts the default `<Drawer>` doesn't fit. */
2063
2179
  function DrawerContainer({ open, onOpenChange, side = "end", size = "md", closedby = "any", className, children, ref: consumerRef, ...rest }) {
@@ -2094,7 +2210,7 @@ function DrawerRoot({ icon, title, description, actions, dismissible = true, clo
2094
2210
  icon,
2095
2211
  className: classNames?.title,
2096
2212
  children: title
2097
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: cn("flex-1", void 0) }), dismissible ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Dialog.CloseButton, {
2213
+ }) : null, dismissible ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Dialog.CloseButton, {
2098
2214
  "aria-label": closeLabel,
2099
2215
  className: classNames?.close
2100
2216
  }) : null]
@@ -2161,7 +2277,7 @@ function FieldRoot({ label, description, error, required, inline, className, cla
2161
2277
  }
2162
2278
  function FieldLabel({ className, required, ...rest }) {
2163
2279
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_field.Field.Label, {
2164
- "data-required": required ? "" : void 0,
2280
+ "data-required": required === void 0 ? void 0 : required ? "" : "false",
2165
2281
  className: cn("field-label", className),
2166
2282
  ...rest
2167
2283
  });
@@ -2224,10 +2340,16 @@ function MenuRoot({ className, ...rest }) {
2224
2340
  ...rest
2225
2341
  });
2226
2342
  }
2227
- function MenuTrigger({ className, ...rest }) {
2343
+ function MenuTrigger({ variant, size = "md", className, children, ...rest }) {
2228
2344
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("summary", {
2229
- className: cn("menu-trigger", className),
2230
- ...rest
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
2231
2353
  });
2232
2354
  }
2233
2355
  function MenuPopup({ className, role = "menu", ...rest }) {
@@ -2334,9 +2456,14 @@ var Menu = Object.assign(MenuRoot, {
2334
2456
  });
2335
2457
  //#endregion
2336
2458
  //#region src/Navbar.tsx
2337
- 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;
2338
2464
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("header", {
2339
2465
  className: cn("navbar", className),
2466
+ style: rootStyle,
2340
2467
  ...rest
2341
2468
  });
2342
2469
  }
@@ -2868,20 +2995,13 @@ function SidebarCollapseToggle({ label = "Toggle sidebar", className, classNames
2868
2995
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
2869
2996
  className: cn("sidebar-collapse-toggle", className),
2870
2997
  ...rest,
2871
- children: [
2872
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
2873
- type: "checkbox",
2874
- className: cn("sidebar-toggle", classNames?.input),
2875
- "aria-label": label,
2876
- ...isControlled ? { checked: controlledChecked } : { defaultChecked: ctx?.defaultCollapsed },
2877
- onChange: (event) => ctx?.onCollapsedChange?.(event.currentTarget.checked)
2878
- }),
2879
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2880
- className: cn("sr-only", void 0),
2881
- children: label
2882
- }),
2883
- children
2884
- ]
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]
2885
3005
  });
2886
3006
  }
2887
3007
  var Sidebar = Object.assign(SidebarRoot, {
@@ -2955,6 +3075,7 @@ exports.ToggleButton = ToggleButton;
2955
3075
  exports.Tooltip = Tooltip;
2956
3076
  exports.getPaginationItems = getPaginationItems;
2957
3077
  exports.useAppShell = useAppShell;
3078
+ exports.useConfirm = useConfirm;
2958
3079
  exports.useHotkey = useHotkey;
2959
3080
 
2960
3081
  //# sourceMappingURL=index.cjs.map