@aortl/admin-react 0.16.0 → 0.16.2
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 +54 -0
- package/dist/AdminRoot.d.ts.map +1 -1
- package/dist/BarChart.d.ts +4 -14
- package/dist/BarChart.d.ts.map +1 -1
- package/dist/Breadcrumbs.d.ts +0 -1
- package/dist/Breadcrumbs.d.ts.map +1 -1
- package/dist/Button.d.ts +4 -6
- package/dist/Button.d.ts.map +1 -1
- package/dist/ButtonGroup.d.ts +2 -5
- package/dist/ButtonGroup.d.ts.map +1 -1
- package/dist/ChartLegend.d.ts +2 -5
- package/dist/ChartLegend.d.ts.map +1 -1
- package/dist/CodeBlock.d.ts +2 -4
- package/dist/CodeBlock.d.ts.map +1 -1
- package/dist/Container.d.ts +3 -4
- package/dist/Container.d.ts.map +1 -1
- package/dist/Dialog.d.ts +3 -14
- package/dist/Dialog.d.ts.map +1 -1
- package/dist/Donut.d.ts +4 -6
- package/dist/Donut.d.ts.map +1 -1
- package/dist/Field.d.ts +3 -19
- package/dist/Field.d.ts.map +1 -1
- package/dist/Indicator.d.ts +2 -3
- package/dist/Indicator.d.ts.map +1 -1
- package/dist/Kbd.d.ts +3 -15
- package/dist/Kbd.d.ts.map +1 -1
- package/dist/Link.d.ts +5 -13
- package/dist/Link.d.ts.map +1 -1
- package/dist/Menu.d.ts +1 -5
- package/dist/Menu.d.ts.map +1 -1
- package/dist/Pagination.d.ts +2 -9
- package/dist/Pagination.d.ts.map +1 -1
- package/dist/PropertyList.d.ts +3 -7
- package/dist/PropertyList.d.ts.map +1 -1
- package/dist/Prose.d.ts +3 -12
- package/dist/Prose.d.ts.map +1 -1
- package/dist/Select.d.ts.map +1 -1
- package/dist/Sidebar.d.ts +0 -2
- package/dist/Sidebar.d.ts.map +1 -1
- package/dist/Spinner.d.ts.map +1 -1
- package/dist/StackedBar.d.ts +2 -9
- package/dist/StackedBar.d.ts.map +1 -1
- package/dist/StatCard.d.ts +3 -6
- package/dist/StatCard.d.ts.map +1 -1
- package/dist/Table.d.ts +4 -12
- package/dist/Table.d.ts.map +1 -1
- package/dist/Textarea.d.ts +5 -9
- package/dist/Textarea.d.ts.map +1 -1
- package/dist/Tooltip.d.ts +0 -1
- package/dist/Tooltip.d.ts.map +1 -1
- package/dist/admin.scoped.css +25 -4
- package/dist/chart-internal.d.ts +4 -16
- package/dist/chart-internal.d.ts.map +1 -1
- package/dist/cn.d.ts +5 -8
- package/dist/cn.d.ts.map +1 -1
- package/dist/hotkey-parse.d.ts +7 -21
- package/dist/hotkey-parse.d.ts.map +1 -1
- package/dist/hotkey-registry.d.ts +2 -14
- package/dist/hotkey-registry.d.ts.map +1 -1
- package/dist/icon.d.ts +5 -17
- package/dist/icon.d.ts.map +1 -1
- package/dist/index.cjs +53 -172
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +53 -172
- package/dist/index.mjs.map +1 -1
- package/dist/portal-context.d.ts +5 -8
- package/dist/portal-context.d.ts.map +1 -1
- package/dist/useHotkey.d.ts +5 -20
- package/dist/useHotkey.d.ts.map +1 -1
- package/package.json +4 -3
package/dist/index.mjs
CHANGED
|
@@ -14,10 +14,9 @@ import { Tooltip as Tooltip$1 } from "@base-ui/react/tooltip";
|
|
|
14
14
|
import { Dialog as Dialog$1 } from "@base-ui/react/dialog";
|
|
15
15
|
//#region src/cn.ts
|
|
16
16
|
/**
|
|
17
|
-
* Every admin class
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* `wrap-scoped.mjs`), which carries the same prefix on every selector.
|
|
17
|
+
* Every admin class is prefixed so the bundle coexists with host-page CSS
|
|
18
|
+
* without colliding on common names like `.btn`. Must match the selector
|
|
19
|
+
* prefix `wrap-scoped.mjs` bakes into `@aortl/admin-css/admin.scoped.css`.
|
|
21
20
|
*/
|
|
22
21
|
var PREFIX = "_ao-";
|
|
23
22
|
function prefixTokens(value) {
|
|
@@ -66,14 +65,11 @@ var Accordion = Object.assign(AccordionRoot, {
|
|
|
66
65
|
//#endregion
|
|
67
66
|
//#region src/portal-context.ts
|
|
68
67
|
/**
|
|
69
|
-
* Container
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
* join the top layer, painting above the backdrop and escaping its
|
|
75
|
-
* `overflow: hidden`. With no provider the context is null and popups fall
|
|
76
|
-
* back to `document.body`.
|
|
68
|
+
* Container Base UI popups portal into. `<AdminRoot>` publishes its element so
|
|
69
|
+
* popups stay inside the `@scope (._ao-admin-root)` subtree — portaled to
|
|
70
|
+
* `document.body` they fall outside the scope and render unstyled. A `<Dialog>`
|
|
71
|
+
* ancestor overrides it with its `<dialog>` so popups join the top layer above
|
|
72
|
+
* the backdrop. Null falls back to `document.body`.
|
|
77
73
|
*/
|
|
78
74
|
var PortalContainerContext = createContext(null);
|
|
79
75
|
//#endregion
|
|
@@ -103,14 +99,9 @@ function AdminRoot({ className, theme, systemAccent, style, ref, ...rest }) {
|
|
|
103
99
|
//#endregion
|
|
104
100
|
//#region src/icon.ts
|
|
105
101
|
/**
|
|
106
|
-
* Render an `IconProp
|
|
107
|
-
*
|
|
108
|
-
* the
|
|
109
|
-
* renders in the vanilla bundle — so both previews end up the same size.
|
|
110
|
-
*
|
|
111
|
-
* Anything that is not `null`/`undefined` and not already a React element is
|
|
112
|
-
* treated as a component type — `createElement` accepts function components,
|
|
113
|
-
* `forwardRef`s (e.g. `@tabler/icons-react`), `memo`, etc.
|
|
102
|
+
* Render an `IconProp`, defaulting component references to `size="1em"
|
|
103
|
+
* aria-hidden`. `"1em"` makes SVG icons inherit the host `font-size`, matching
|
|
104
|
+
* the Tabler webfont in the vanilla bundle.
|
|
114
105
|
*/
|
|
115
106
|
function renderIcon(icon, size = "1em") {
|
|
116
107
|
if (icon == null) return null;
|
|
@@ -226,12 +217,6 @@ var MOD_ORDER = [
|
|
|
226
217
|
"alt",
|
|
227
218
|
"meta"
|
|
228
219
|
];
|
|
229
|
-
/**
|
|
230
|
-
* Resolve the modifier `mod` aliases to. Apple platforms use ⌘ (`meta`) as the
|
|
231
|
-
* primary command modifier; everywhere else it's Ctrl. Detected once at module
|
|
232
|
-
* load (SSR-safe — the registry never dispatches server-side) and shared by the
|
|
233
|
-
* parse and display layers so the binding and its `<Kbd>` chip always agree.
|
|
234
|
-
*/
|
|
235
220
|
function detectApplePlatform() {
|
|
236
221
|
if (typeof navigator === "undefined") return false;
|
|
237
222
|
const platform = navigator.userAgentData?.platform || navigator.platform || "";
|
|
@@ -280,11 +265,7 @@ function canonicalize(chord) {
|
|
|
280
265
|
parts.push(chord.key);
|
|
281
266
|
return parts.join("+");
|
|
282
267
|
}
|
|
283
|
-
/**
|
|
284
|
-
* Normalize a keyboard event to its canonical chord string. Returns `null`
|
|
285
|
-
* if the event is a bare modifier press (`Shift` by itself, etc.) so callers
|
|
286
|
-
* can short-circuit before a map lookup.
|
|
287
|
-
*/
|
|
268
|
+
/** Canonical chord string for a keyboard event; `null` for a bare modifier press. */
|
|
288
269
|
function normalizeEvent(e) {
|
|
289
270
|
const key = e.key.toLowerCase();
|
|
290
271
|
if (key === "control" || key === "shift" || key === "alt" || key === "meta") return null;
|
|
@@ -298,7 +279,6 @@ function normalizeEvent(e) {
|
|
|
298
279
|
key
|
|
299
280
|
});
|
|
300
281
|
}
|
|
301
|
-
/** A single printable symbol (`?`, `+`, `:`, …) — not a letter, digit, or named key. */
|
|
302
282
|
function isShiftedSymbol(key) {
|
|
303
283
|
return key.length === 1 && !/[a-z0-9]/.test(key);
|
|
304
284
|
}
|
|
@@ -350,26 +330,13 @@ function toAriaPart(chord) {
|
|
|
350
330
|
parts.push(chord.key.length === 1 ? chord.key.toUpperCase() : chord.key);
|
|
351
331
|
return parts.join("+");
|
|
352
332
|
}
|
|
353
|
-
/**
|
|
354
|
-
* Serialize one or more chords to the `aria-keyshortcuts` format
|
|
355
|
-
* (space-separated alternatives, modifiers as `Control`/`Shift`/etc.).
|
|
356
|
-
*/
|
|
333
|
+
/** Serialize chords to `aria-keyshortcuts` format (space-separated alternatives). */
|
|
357
334
|
function toAriaKeyShortcuts(chords) {
|
|
358
335
|
return chords.map(toAriaPart).join(" ");
|
|
359
336
|
}
|
|
360
337
|
//#endregion
|
|
361
338
|
//#region src/Kbd.tsx
|
|
362
|
-
/**
|
|
363
|
-
* Visual representation of a keyboard shortcut. Two shapes:
|
|
364
|
-
*
|
|
365
|
-
* ```tsx
|
|
366
|
-
* <Kbd keys="mod+s" /> // parsed: <Ctrl><S> in a .kbd-group
|
|
367
|
-
* <Kbd>Esc</Kbd> // literal: single <kbd>Esc</kbd>
|
|
368
|
-
* ```
|
|
369
|
-
*
|
|
370
|
-
* Render outside of action surfaces (tooltips, help dialogs) or inside them
|
|
371
|
-
* via the `hotkey` prop on `<Button>` / `<Menu.Item>`.
|
|
372
|
-
*/
|
|
339
|
+
/** Keyboard shortcut chips — parsed via `keys`, or a single literal chip via `children`. */
|
|
373
340
|
function Kbd({ keys, children, className, ...rest }) {
|
|
374
341
|
if (keys != null) {
|
|
375
342
|
const chord = parseKeys(keys)[0];
|
|
@@ -421,11 +388,7 @@ function dispatch(e) {
|
|
|
421
388
|
e.preventDefault();
|
|
422
389
|
for (const entry of bucket) entry.handlerRef.current?.(e);
|
|
423
390
|
}
|
|
424
|
-
/**
|
|
425
|
-
* Register a hotkey entry under each of its canonical chord strings.
|
|
426
|
-
* Returns an unregister function that removes the entry from every bucket
|
|
427
|
-
* and detaches the listener if the registry is empty.
|
|
428
|
-
*/
|
|
391
|
+
/** Returns an unregister function. */
|
|
429
392
|
function register(canonicalChords, entry) {
|
|
430
393
|
for (const chord of canonicalChords) {
|
|
431
394
|
let bucket = registry.get(chord);
|
|
@@ -449,16 +412,9 @@ function register(canonicalChords, entry) {
|
|
|
449
412
|
//#endregion
|
|
450
413
|
//#region src/useHotkey.ts
|
|
451
414
|
/**
|
|
452
|
-
* Register a keyboard shortcut. The handler
|
|
453
|
-
* callers
|
|
454
|
-
* the hook is safe to call unconditionally
|
|
455
|
-
* not have a binding (e.g. the `hotkey` prop on `<Button>`).
|
|
456
|
-
*
|
|
457
|
-
* @example
|
|
458
|
-
* useHotkey("mod+s", save);
|
|
459
|
-
* useHotkey(["mod+s", "mod+enter"], save, { enabled: !isLoading });
|
|
460
|
-
*
|
|
461
|
-
* Returns derived strings for rendering — see {@link HotkeyInfo}.
|
|
415
|
+
* Register a keyboard shortcut, e.g. `useHotkey("mod+s", save)`. The handler
|
|
416
|
+
* is latched in a ref, so callers need not memoize it. Nullish `keys` is a
|
|
417
|
+
* no-op, so the hook is safe to call unconditionally.
|
|
462
418
|
*/
|
|
463
419
|
function useHotkey(keys, handler, options) {
|
|
464
420
|
const enabled = options?.enabled ?? true;
|
|
@@ -655,11 +611,7 @@ function Indicator({ label, variant = "neutral", size = "sm", icon, placement =
|
|
|
655
611
|
}
|
|
656
612
|
//#endregion
|
|
657
613
|
//#region src/Link.tsx
|
|
658
|
-
/**
|
|
659
|
-
* A text link — a plain `<a>` with the design system's link styling: primary
|
|
660
|
-
* color, hover shift, underline, and a focus-visible ring. Pass `external` for
|
|
661
|
-
* the new-tab affordance.
|
|
662
|
-
*/
|
|
614
|
+
/** A plain `<a>` with the design system's link styling. */
|
|
663
615
|
function Link({ external, icon, iconTrailing, className, target, rel, children, ...rest }) {
|
|
664
616
|
return /* @__PURE__ */ jsxs("a", {
|
|
665
617
|
target: target ?? (external ? "_blank" : void 0),
|
|
@@ -675,12 +627,7 @@ function Link({ external, icon, iconTrailing, className, target, rel, children,
|
|
|
675
627
|
}
|
|
676
628
|
//#endregion
|
|
677
629
|
//#region src/Pagination.tsx
|
|
678
|
-
/**
|
|
679
|
-
* Compute the items to render for a given `page` / `total`. Always returns:
|
|
680
|
-
* previous, ...numbers/ellipses, next
|
|
681
|
-
* with `boundaryCount` items on each end and `siblingCount` items around `page`.
|
|
682
|
-
* Pure: no React state, safe to call during render.
|
|
683
|
-
*/
|
|
630
|
+
/** Pure (safe during render): previous, numbers/ellipses (`boundaryCount` at each end, `siblingCount` around `page`), next. */
|
|
684
631
|
function getPaginationItems({ page, total, siblingCount = 1, boundaryCount = 1 }) {
|
|
685
632
|
if (total <= 0) return [{
|
|
686
633
|
type: "previous",
|
|
@@ -836,11 +783,9 @@ function defaultRender(item, onPageChange, prev, next) {
|
|
|
836
783
|
//#endregion
|
|
837
784
|
//#region src/Textarea.tsx
|
|
838
785
|
/**
|
|
839
|
-
* Multi-line
|
|
840
|
-
* `<
|
|
841
|
-
*
|
|
842
|
-
* association, and validity-driven `:user-valid` / `<Field.Error>`. Works
|
|
843
|
-
* standalone too — `Field.Control` falls back to a default context.
|
|
786
|
+
* Multi-line input via Base UI `Field.Control` with a `<textarea>` swapped in,
|
|
787
|
+
* so inside a `<Field>` it gets the same wiring as `<Input>` (generated id,
|
|
788
|
+
* label association, validity). Works standalone via the default context.
|
|
844
789
|
*/
|
|
845
790
|
function Textarea({ variant = "bordered", textareaSize = "md", autoResize, className, ...rest }) {
|
|
846
791
|
return /* @__PURE__ */ jsx(Field$1.Control, {
|
|
@@ -1052,10 +997,9 @@ var Select = Object.assign(SelectRoot, {
|
|
|
1052
997
|
//#endregion
|
|
1053
998
|
//#region src/Container.tsx
|
|
1054
999
|
/**
|
|
1055
|
-
* Page content region: a centered, max-width column that
|
|
1056
|
-
*
|
|
1057
|
-
*
|
|
1058
|
-
* escape hatch (e.g. `Card.Container`) — this is a standalone page region.
|
|
1000
|
+
* Page content region: a centered, max-width column that owns the vertical
|
|
1001
|
+
* gap between stacked sections. Place inside `<AppShell.Main>`, which has no
|
|
1002
|
+
* padding of its own. Not the `.Container` escape hatch (`Card.Container`).
|
|
1059
1003
|
*/
|
|
1060
1004
|
function Container({ size = "md", compact, className, ...rest }) {
|
|
1061
1005
|
return /* @__PURE__ */ jsx("div", {
|
|
@@ -1157,12 +1101,9 @@ var Card = Object.assign(CardRoot, {
|
|
|
1157
1101
|
//#endregion
|
|
1158
1102
|
//#region src/StatCard.tsx
|
|
1159
1103
|
/**
|
|
1160
|
-
* Compact KPI tile
|
|
1161
|
-
*
|
|
1162
|
-
*
|
|
1163
|
-
* annotation. `compact`/`bordered` map to the shared `.card-compact`/
|
|
1164
|
-
* `.card-bordered` modifiers. For free-form tiles, use `<Card>`; for
|
|
1165
|
-
* label/value tables, use `<PropertyList>`.
|
|
1104
|
+
* Compact KPI tile (label / value / detail) on a `.card` shell, so it shares
|
|
1105
|
+
* every card modifier — `compact`/`bordered` map to `.card-compact`/`.card-bordered`.
|
|
1106
|
+
* Free-form tiles: `<Card>`; label/value tables: `<PropertyList>`.
|
|
1166
1107
|
*/
|
|
1167
1108
|
function StatCard({ variant = "default", label, value, detail, icon, compact, bordered, className, children, ...rest }) {
|
|
1168
1109
|
const hasLabel = label !== void 0;
|
|
@@ -1195,11 +1136,8 @@ function StatCard({ variant = "default", label, value, detail, icon, compact, bo
|
|
|
1195
1136
|
//#endregion
|
|
1196
1137
|
//#region src/chart-internal.ts
|
|
1197
1138
|
/**
|
|
1198
|
-
* Multi-series palette
|
|
1199
|
-
*
|
|
1200
|
-
* overrides. Vanilla authors copy the same sequence (it's documented), so both
|
|
1201
|
-
* bundles render identical colours. Single-series charts ignore this entirely
|
|
1202
|
-
* and follow `currentColor`.
|
|
1139
|
+
* Multi-series palette of existing Flexoki tokens, not a new token layer. The
|
|
1140
|
+
* documented vanilla sequence copies this exactly — both bundles must match.
|
|
1203
1141
|
*/
|
|
1204
1142
|
var SERIES = [
|
|
1205
1143
|
"var(--color-blue-500)",
|
|
@@ -1211,7 +1149,6 @@ var SERIES = [
|
|
|
1211
1149
|
"var(--color-yellow-500)",
|
|
1212
1150
|
"var(--color-red-400)"
|
|
1213
1151
|
];
|
|
1214
|
-
/** Resolve a segment's colour: explicit `datum.color` wins, else cycle SERIES. */
|
|
1215
1152
|
function seriesColor(datum, index) {
|
|
1216
1153
|
return datum.color ?? SERIES[index % SERIES.length];
|
|
1217
1154
|
}
|
|
@@ -1220,11 +1157,7 @@ function computeMax(data, explicit) {
|
|
|
1220
1157
|
if (explicit !== void 0) return explicit;
|
|
1221
1158
|
return Math.max(1, ...data.map((d) => d.value));
|
|
1222
1159
|
}
|
|
1223
|
-
/**
|
|
1224
|
-
* Build the cumulative `conic-gradient` stop string for a donut/pie:
|
|
1225
|
-
* `<color> <from>deg <to>deg, …`. Degrees accumulate across segments. A
|
|
1226
|
-
* non-positive total yields a single neutral fill so the ring isn't blank.
|
|
1227
|
-
*/
|
|
1160
|
+
/** Cumulative `conic-gradient` stops. A non-positive total yields a neutral fill so the ring isn't blank. */
|
|
1228
1161
|
function buildDonutSegments(data) {
|
|
1229
1162
|
const total = data.reduce((sum, d) => sum + Math.max(0, d.value), 0);
|
|
1230
1163
|
if (total <= 0) return "var(--color-surface-strong) 0 100%";
|
|
@@ -1245,10 +1178,7 @@ var TYPE_NOUN = {
|
|
|
1245
1178
|
donut: "Donut chart",
|
|
1246
1179
|
pie: "Pie chart"
|
|
1247
1180
|
};
|
|
1248
|
-
/**
|
|
1249
|
-
* Auto-generated summary for the chart root's `aria-label`. Callers that pass
|
|
1250
|
-
* their own `aria-label` skip this. Example: "Bar chart. Mon: 80, Tue: 52."
|
|
1251
|
-
*/
|
|
1181
|
+
/** Chart-root `aria-label` summary, e.g. "Bar chart. Mon: 80, Tue: 52." */
|
|
1252
1182
|
function buildAriaLabel(type, data) {
|
|
1253
1183
|
const parts = data.map((d) => d.label !== void 0 ? `${d.label}: ${d.value}` : `${d.value}`);
|
|
1254
1184
|
return `${TYPE_NOUN[type]}. ${parts.join(", ")}.`;
|
|
@@ -1266,10 +1196,7 @@ function mergeStyle(vars, incoming) {
|
|
|
1266
1196
|
}
|
|
1267
1197
|
//#endregion
|
|
1268
1198
|
//#region src/BarChart.tsx
|
|
1269
|
-
/**
|
|
1270
|
-
* The bare bar-chart grid — no bars. Compose `<BarChart.Bar>` children by hand
|
|
1271
|
-
* (e.g. to interleave a reference line). Sets `role="img"`; pass `aria-label`.
|
|
1272
|
-
*/
|
|
1199
|
+
/** Bare grid, no bars — compose `<BarChart.Bar>` by hand. Sets `role="img"`; pass `aria-label`. */
|
|
1273
1200
|
function BarChartContainer({ orientation = "horizontal", size = "md", showValues, inline, variant = "info", className, ...rest }) {
|
|
1274
1201
|
return /* @__PURE__ */ jsx("div", {
|
|
1275
1202
|
role: "img",
|
|
@@ -1286,10 +1213,8 @@ function BarChartContainer({ orientation = "horizontal", size = "md", showValues
|
|
|
1286
1213
|
});
|
|
1287
1214
|
}
|
|
1288
1215
|
/**
|
|
1289
|
-
* One bar.
|
|
1290
|
-
* `
|
|
1291
|
-
* carries `.chart-values`). Stays `currentColor` unless an explicit colour is
|
|
1292
|
-
* given — single-series bars never cycle the SERIES palette.
|
|
1216
|
+
* One bar. The value cell always renders (CSS hides it without `.chart-values`);
|
|
1217
|
+
* fill stays `currentColor` — single-series bars never cycle SERIES.
|
|
1293
1218
|
*/
|
|
1294
1219
|
function Bar({ datum, value, label, color, className, style, ...rest }) {
|
|
1295
1220
|
const v = datum?.value ?? value ?? 0;
|
|
@@ -1321,12 +1246,7 @@ function Bar({ datum, value, label, color, className, style, ...rest }) {
|
|
|
1321
1246
|
]
|
|
1322
1247
|
});
|
|
1323
1248
|
}
|
|
1324
|
-
/**
|
|
1325
|
-
* Single-series bar chart. Computes the max, sets `--chart-max` on the
|
|
1326
|
-
* container (bars inherit it), and generates an overridable `aria-label`.
|
|
1327
|
-
* Horizontal by default; pass `orientation="vertical"` for columns. For
|
|
1328
|
-
* hand-composed layouts use `<BarChart.Container>` + `<BarChart.Bar>`.
|
|
1329
|
-
*/
|
|
1249
|
+
/** Single-series bar chart. For hand-composed layouts use `<BarChart.Container>` + `<BarChart.Bar>`. */
|
|
1330
1250
|
function BarChartRoot({ data, max, orientation = "horizontal", size = "md", showValues, inline, variant = "info", style, "aria-label": ariaLabel, ...rest }) {
|
|
1331
1251
|
return /* @__PURE__ */ jsx(BarChartContainer, {
|
|
1332
1252
|
orientation,
|
|
@@ -1347,11 +1267,8 @@ var BarChart = Object.assign(BarChartRoot, {
|
|
|
1347
1267
|
//#endregion
|
|
1348
1268
|
//#region src/ChartLegend.tsx
|
|
1349
1269
|
/**
|
|
1350
|
-
*
|
|
1351
|
-
*
|
|
1352
|
-
* per-slice read-out lives (a conic-gradient slice has no element to hang a
|
|
1353
|
-
* `title` on). The swatch colour mirrors `seriesColor`, so legend and chart
|
|
1354
|
-
* stay in sync.
|
|
1270
|
+
* Each row's `title` carries the donut's per-slice read-out — a conic-gradient
|
|
1271
|
+
* slice has no element to hang a `title` on.
|
|
1355
1272
|
*/
|
|
1356
1273
|
function ChartLegend({ data, className, ...rest }) {
|
|
1357
1274
|
return /* @__PURE__ */ jsx("ul", {
|
|
@@ -1374,7 +1291,7 @@ function Figure({ size = "md", className, ...rest }) {
|
|
|
1374
1291
|
...rest
|
|
1375
1292
|
});
|
|
1376
1293
|
}
|
|
1377
|
-
/** The masked conic-gradient ring.
|
|
1294
|
+
/** The masked conic-gradient ring. */
|
|
1378
1295
|
function Ring({ data, pie, thickness, className, style, ...rest }) {
|
|
1379
1296
|
const vars = { "--donut-segments": buildDonutSegments(data) };
|
|
1380
1297
|
if (thickness !== void 0 && !pie) vars["--donut-thickness"] = thickness;
|
|
@@ -1392,11 +1309,9 @@ function Center({ className, ...rest }) {
|
|
|
1392
1309
|
});
|
|
1393
1310
|
}
|
|
1394
1311
|
/**
|
|
1395
|
-
* Donut (or `pie`) breakdown.
|
|
1396
|
-
*
|
|
1397
|
-
*
|
|
1398
|
-
* conic slice has no element to carry a `title`. Resize by overriding
|
|
1399
|
-
* `--chart-size` (it inherits to the figure) or via `size`.
|
|
1312
|
+
* Donut (or `pie`) breakdown. Per-slice read-outs live on the `legend` rows —
|
|
1313
|
+
* a conic slice has no element to carry a `title`. Resize via `size` or
|
|
1314
|
+
* `--chart-size`.
|
|
1400
1315
|
*/
|
|
1401
1316
|
function DonutRoot({ data, size = "md", thickness, pie, centerLabel, legend, inline, className, "aria-label": ariaLabel, ...rest }) {
|
|
1402
1317
|
return /* @__PURE__ */ jsxs("div", {
|
|
@@ -1429,10 +1344,7 @@ function Track({ className, ...rest }) {
|
|
|
1429
1344
|
...rest
|
|
1430
1345
|
});
|
|
1431
1346
|
}
|
|
1432
|
-
/**
|
|
1433
|
-
* One proportion segment, sized by `flex: var(--value)`. Multi-series by
|
|
1434
|
-
* default: takes its colour from `seriesColor` (SERIES cycle or `datum.color`).
|
|
1435
|
-
*/
|
|
1347
|
+
/** One proportion segment, sized by `flex: var(--value)`; SERIES-cycle colours by default. */
|
|
1436
1348
|
function Segment({ datum, index = 0, value, color, className, style, ...rest }) {
|
|
1437
1349
|
const v = datum?.value ?? value ?? 0;
|
|
1438
1350
|
const segColor = datum !== void 0 ? seriesColor(datum, index) : color;
|
|
@@ -1446,11 +1358,7 @@ function Segment({ datum, index = 0, value, color, className, style, ...rest })
|
|
|
1446
1358
|
...rest
|
|
1447
1359
|
});
|
|
1448
1360
|
}
|
|
1449
|
-
/**
|
|
1450
|
-
* Single horizontal proportion bar — a "60% A / 30% B / 10% C" breakdown.
|
|
1451
|
-
* Segments are sized by their flex ratios (no max needed) and coloured from the
|
|
1452
|
-
* SERIES palette by default. Generates an overridable `aria-label`.
|
|
1453
|
-
*/
|
|
1361
|
+
/** Single horizontal proportion bar. Segments size by flex ratio — no max needed. */
|
|
1454
1362
|
function StackedBarRoot({ data, legend, inline, className, "aria-label": ariaLabel, ...rest }) {
|
|
1455
1363
|
return /* @__PURE__ */ jsxs("div", {
|
|
1456
1364
|
role: "img",
|
|
@@ -1485,11 +1393,7 @@ function DefaultCloseIcon() {
|
|
|
1485
1393
|
children: [/* @__PURE__ */ jsx("path", { d: "M18 6 6 18" }), /* @__PURE__ */ jsx("path", { d: "m6 6 12 12" })]
|
|
1486
1394
|
});
|
|
1487
1395
|
}
|
|
1488
|
-
/**
|
|
1489
|
-
* The bare `<dialog>` primitive — no opinions about header, body, or footer.
|
|
1490
|
-
* Use this when the default `<Dialog>` layout doesn't fit (custom header,
|
|
1491
|
-
* media block, multi-step content).
|
|
1492
|
-
*/
|
|
1396
|
+
/** The bare `<dialog>` primitive — for layouts the default `<Dialog>` doesn't fit. */
|
|
1493
1397
|
function DialogContainer({ open, onOpenChange, size = "md", closedby = "any", className, children, ref: consumerRef, ...rest }) {
|
|
1494
1398
|
const ref = useRef(null);
|
|
1495
1399
|
const onOpenChangeRef = useRef(onOpenChange);
|
|
@@ -1571,11 +1475,7 @@ function DialogCloseButton({ icon, className, children, onClick, type = "button"
|
|
|
1571
1475
|
children: children ?? (icon !== void 0 ? renderIcon(icon) : /* @__PURE__ */ jsx(DefaultCloseIcon, {}))
|
|
1572
1476
|
});
|
|
1573
1477
|
}
|
|
1574
|
-
/**
|
|
1575
|
-
* Standard modal: a `<dialog>` with an opinionated header / body / footer
|
|
1576
|
-
* layout driven by shorthand props. For anything outside that shape, use
|
|
1577
|
-
* `<Dialog.Container>` and compose by hand.
|
|
1578
|
-
*/
|
|
1478
|
+
/** Standard modal with shorthand-driven header/body/footer. For other shapes, compose `<Dialog.Container>` by hand. */
|
|
1579
1479
|
function DialogRoot({ icon, title, description, actions, dismissible = true, closeLabel = "Close", children, ...containerProps }) {
|
|
1580
1480
|
const hasTitle = title !== void 0 || icon !== void 0;
|
|
1581
1481
|
const showHeader = hasTitle || dismissible;
|
|
@@ -1603,23 +1503,14 @@ var Dialog = Object.assign(DialogRoot, {
|
|
|
1603
1503
|
});
|
|
1604
1504
|
//#endregion
|
|
1605
1505
|
//#region src/Field.tsx
|
|
1606
|
-
/**
|
|
1607
|
-
* The bare `.field` container. Use this when the default layout doesn't fit —
|
|
1608
|
-
* multiple validity-keyed `<Field.Error>` messages, a control that needs to
|
|
1609
|
-
* sit between description and error, etc.
|
|
1610
|
-
*/
|
|
1506
|
+
/** The bare `.field` container — for layouts the default `<Field>` doesn't fit. */
|
|
1611
1507
|
function FieldContainer({ className, ...rest }) {
|
|
1612
1508
|
return /* @__PURE__ */ jsx(Field$1.Root, {
|
|
1613
1509
|
className: cn("field", className),
|
|
1614
1510
|
...rest
|
|
1615
1511
|
});
|
|
1616
1512
|
}
|
|
1617
|
-
/**
|
|
1618
|
-
* Standard field: a `.field` container that lays out an optional label, the
|
|
1619
|
-
* control passed as `children`, an optional description, and an optional
|
|
1620
|
-
* single-message error. For anything outside that shape, use
|
|
1621
|
-
* `<Field.Container>` and compose by hand.
|
|
1622
|
-
*/
|
|
1513
|
+
/** Standard field — label, control (`children`), description, error. For other shapes, compose `<Field.Container>` by hand. */
|
|
1623
1514
|
function FieldRoot({ label, description, error, required, inline, className, children, ...rest }) {
|
|
1624
1515
|
const labelEl = label !== void 0 ? /* @__PURE__ */ jsx(FieldLabel, {
|
|
1625
1516
|
required,
|
|
@@ -1893,8 +1784,7 @@ var Tabs = Object.assign(TabsRoot, {
|
|
|
1893
1784
|
/**
|
|
1894
1785
|
* Styled `<pre>` for logs, JSON dumps, terminal output, raw model output.
|
|
1895
1786
|
* Theme-following surface via `--color-code-surface` / `--color-code-text`.
|
|
1896
|
-
*
|
|
1897
|
-
* Shiki/Prism on a nested `<code>` if needed.
|
|
1787
|
+
* No syntax highlighting — layer Shiki/Prism on a nested `<code>` if needed.
|
|
1898
1788
|
*/
|
|
1899
1789
|
function CodeBlock({ nowrap, className, ...rest }) {
|
|
1900
1790
|
return /* @__PURE__ */ jsx("pre", {
|
|
@@ -1905,18 +1795,9 @@ function CodeBlock({ nowrap, className, ...rest }) {
|
|
|
1905
1795
|
//#endregion
|
|
1906
1796
|
//#region src/Prose.tsx
|
|
1907
1797
|
/**
|
|
1908
|
-
*
|
|
1909
|
-
*
|
|
1910
|
-
*
|
|
1911
|
-
* from the design tokens, scoped to this wrapper so the rest of the admin UI
|
|
1912
|
-
* keeps the global element reset.
|
|
1913
|
-
*
|
|
1914
|
-
* ```tsx
|
|
1915
|
-
* <Prose dangerouslySetInnerHTML={{ __html: renderedMarkdown }} />
|
|
1916
|
-
* ```
|
|
1917
|
-
*
|
|
1918
|
-
* Accepts children too — `<Prose><h2>…</h2><p>…</p></Prose>` — for content
|
|
1919
|
-
* authored directly in JSX.
|
|
1798
|
+
* Styled container for HTML the system can't annotate with its class names —
|
|
1799
|
+
* backend-rendered markdown, CMS bodies, model output. Element styles are
|
|
1800
|
+
* scoped to this wrapper; the rest of the admin UI keeps the global reset.
|
|
1920
1801
|
*/
|
|
1921
1802
|
function Prose({ className, ...rest }) {
|
|
1922
1803
|
return /* @__PURE__ */ jsx("div", {
|