@slashsuite/ui-react 0.12.1 → 0.13.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/MIGRATING.md +386 -8
- package/README.md +89 -44
- package/agent-docs/components/app-shell.md +9 -6
- package/agent-docs/components/article-layout.md +140 -0
- package/agent-docs/components/audio.md +42 -0
- package/agent-docs/components/badge.md +2 -1
- package/agent-docs/components/body-text.md +26 -15
- package/agent-docs/components/bottom-sheet.md +27 -17
- package/agent-docs/components/breadcrumbs.md +10 -6
- package/agent-docs/components/button.md +2 -2
- package/agent-docs/components/call-to-action.md +59 -0
- package/agent-docs/components/callout.md +4 -3
- package/agent-docs/components/card-grid.md +15 -7
- package/agent-docs/components/card.md +33 -18
- package/agent-docs/components/cart-button.md +63 -0
- package/agent-docs/components/chat-composer.md +4 -3
- package/agent-docs/components/checkbox.md +11 -5
- package/agent-docs/components/cluster.md +10 -8
- package/agent-docs/components/code-example.md +2 -2
- package/agent-docs/components/code.md +7 -5
- package/agent-docs/components/colour-scheme-toggle.md +12 -6
- package/agent-docs/components/colour-swatch.md +41 -0
- package/agent-docs/components/combobox.md +88 -0
- package/agent-docs/components/confirm-dialog.md +98 -0
- package/agent-docs/components/container.md +2 -1
- package/agent-docs/components/copy-button.md +7 -5
- package/agent-docs/components/copy-line.md +6 -5
- package/agent-docs/components/date-field.md +14 -11
- package/agent-docs/components/date-range-picker.md +16 -9
- package/agent-docs/components/date-time-field.md +73 -0
- package/agent-docs/components/dialog.md +22 -68
- package/agent-docs/components/disclosure.md +4 -0
- package/agent-docs/components/docs-layout.md +10 -6
- package/agent-docs/components/drawer.md +13 -4
- package/agent-docs/components/embed-frame.md +48 -0
- package/agent-docs/components/empty-state.md +4 -1
- package/agent-docs/components/field-dialog.md +6 -5
- package/agent-docs/components/field.md +10 -7
- package/agent-docs/components/fieldset.md +4 -4
- package/agent-docs/components/flow-diagram.md +87 -0
- package/agent-docs/components/form-layout.md +4 -1
- package/agent-docs/components/form-row.md +7 -7
- package/agent-docs/components/full-bleed-layout.md +0 -2
- package/agent-docs/components/headings.md +13 -7
- package/agent-docs/components/hero.md +11 -2
- package/agent-docs/components/icon-button.md +1 -3
- package/agent-docs/components/icon.md +6 -13
- package/agent-docs/components/image.md +24 -14
- package/agent-docs/components/input.md +8 -7
- package/agent-docs/components/key-value-list.md +4 -1
- package/agent-docs/components/lightbox.md +1 -1
- package/agent-docs/components/list-layout.md +5 -7
- package/agent-docs/components/list-row.md +37 -34
- package/agent-docs/components/loading.md +2 -2
- package/agent-docs/components/markdown.md +13 -13
- package/agent-docs/components/media-tile.md +8 -4
- package/agent-docs/components/menu.md +19 -12
- package/agent-docs/components/meta-list.md +2 -2
- package/agent-docs/components/morph.md +11 -5
- package/agent-docs/components/navigation-progress.md +2 -2
- package/agent-docs/components/number-field.md +75 -0
- package/agent-docs/components/outline-region.md +19 -8
- package/agent-docs/components/page-fade.md +2 -1
- package/agent-docs/components/pill.md +7 -6
- package/agent-docs/components/popover.md +63 -0
- package/agent-docs/components/price.md +49 -0
- package/agent-docs/components/product-tile.md +78 -0
- package/agent-docs/components/promo-banner.md +46 -0
- package/agent-docs/components/prose-layout.md +1 -1
- package/agent-docs/components/radio-group.md +9 -6
- package/agent-docs/components/scroll-strip.md +3 -3
- package/agent-docs/components/segmented-control.md +4 -2
- package/agent-docs/components/select.md +8 -3
- package/agent-docs/components/show.md +2 -2
- package/agent-docs/components/side-column.md +13 -9
- package/agent-docs/components/sidebar-layout.md +1 -1
- package/agent-docs/components/site-footer.md +4 -4
- package/agent-docs/components/site-search.md +21 -9
- package/agent-docs/components/slider.md +59 -0
- package/agent-docs/components/sortable-list.md +15 -10
- package/agent-docs/components/stack.md +3 -3
- package/agent-docs/components/stacked-bar.md +7 -4
- package/agent-docs/components/state-machine.md +95 -0
- package/agent-docs/components/status-pages.md +13 -6
- package/agent-docs/components/stepper.md +54 -0
- package/agent-docs/components/switch.md +4 -4
- package/agent-docs/components/table-of-contents.md +78 -0
- package/agent-docs/components/table.md +35 -24
- package/agent-docs/components/tabs.md +24 -26
- package/agent-docs/components/text-link.md +12 -7
- package/agent-docs/components/textarea.md +4 -2
- package/agent-docs/components/toast.md +19 -14
- package/agent-docs/components/video.md +7 -2
- package/agent-docs/llms.txt +22 -3
- package/dist/AppShell.d.ts +25 -9
- package/dist/AppShell.js +67 -33
- package/dist/AppShellMenu.d.ts +31 -18
- package/dist/AppShellMenu.js +72 -45
- package/dist/ArticleLayout.d.ts +36 -0
- package/dist/ArticleLayout.js +27 -0
- package/dist/Audio.d.ts +16 -0
- package/dist/Audio.js +11 -0
- package/dist/Badge.d.ts +2 -1
- package/dist/Badge.js +3 -2
- package/dist/BottomSheet.d.ts +17 -6
- package/dist/BottomSheet.js +62 -11
- package/dist/Breadcrumbs.d.ts +8 -6
- package/dist/Breadcrumbs.js +17 -7
- package/dist/Button.d.ts +1 -0
- package/dist/Button.js +4 -3
- package/dist/CallToAction.d.ts +25 -0
- package/dist/CallToAction.js +17 -0
- package/dist/Callout.d.ts +2 -2
- package/dist/Callout.js +2 -2
- package/dist/Card.d.ts +88 -31
- package/dist/Card.js +55 -92
- package/dist/CardBody.d.ts +2 -0
- package/dist/CardBody.js +33 -3
- package/dist/CardGrid.d.ts +32 -4
- package/dist/CardGrid.js +42 -8
- package/dist/CardParts.d.ts +7 -1
- package/dist/CardParts.js +7 -2
- package/dist/CartButton.d.ts +33 -0
- package/dist/CartButton.js +18 -0
- package/dist/ChatComposer.d.ts +10 -4
- package/dist/ChatComposer.js +35 -13
- package/dist/Checkbox.d.ts +21 -3
- package/dist/Checkbox.js +66 -20
- package/dist/Chevron.js +1 -1
- package/dist/Cluster.d.ts +28 -15
- package/dist/Cluster.js +21 -4
- package/dist/Code.d.ts +15 -3
- package/dist/Code.js +23 -3
- package/dist/CodeBlock.d.ts +4 -4
- package/dist/CodeBlock.js +2 -2
- package/dist/CodeBody.d.ts +1 -1
- package/dist/CodeBody.js +4 -10
- package/dist/CodeExample.d.ts +1 -1
- package/dist/CodeExample.js +3 -2
- package/dist/ColourSchemeToggle.d.ts +21 -5
- package/dist/ColourSchemeToggle.js +15 -9
- package/dist/ColourSwatch.d.ts +15 -0
- package/dist/ColourSwatch.js +14 -0
- package/dist/Combobox.d.ts +42 -0
- package/dist/Combobox.js +43 -0
- package/dist/ConfirmDialog.d.ts +40 -0
- package/dist/ConfirmDialog.js +36 -0
- package/dist/Container.d.ts +3 -3
- package/dist/Container.js +1 -1
- package/dist/CopyButton.d.ts +8 -2
- package/dist/CopyButton.js +38 -28
- package/dist/CopyLine.d.ts +4 -2
- package/dist/CopyLine.js +4 -4
- package/dist/DateCalendar.d.ts +2 -0
- package/dist/DateCalendar.js +11 -9
- package/dist/DateField.d.ts +52 -21
- package/dist/DateField.js +73 -37
- package/dist/DateFieldCalendar.d.ts +12 -8
- package/dist/DateFieldCalendar.js +37 -18
- package/dist/DateRangePicker.d.ts +23 -3
- package/dist/DateRangePicker.js +10 -8
- package/dist/DateTimeField.d.ts +31 -0
- package/dist/DateTimeField.js +19 -0
- package/dist/Dialog.d.ts +42 -6
- package/dist/Dialog.js +50 -12
- package/dist/Disclosure.js +9 -1
- package/dist/DocsLayout.d.ts +13 -5
- package/dist/DocsLayout.js +11 -9
- package/dist/Drawer.d.ts +22 -7
- package/dist/Drawer.js +89 -8
- package/dist/EmbedFrame.d.ts +36 -0
- package/dist/EmbedFrame.js +18 -0
- package/dist/Field.d.ts +41 -4
- package/dist/Field.js +61 -25
- package/dist/FieldDialog.d.ts +8 -3
- package/dist/FieldDialog.js +19 -9
- package/dist/Fieldset.d.ts +3 -3
- package/dist/Fieldset.js +7 -9
- package/dist/FileDrop.js +2 -1
- package/dist/FlowDiagram.d.ts +92 -0
- package/dist/FlowDiagram.js +100 -0
- package/dist/FormRow.d.ts +6 -4
- package/dist/FormRow.js +11 -9
- package/dist/Hero.d.ts +30 -7
- package/dist/Hero.js +23 -9
- package/dist/Icon.d.ts +1 -1
- package/dist/Icon.js +1 -1
- package/dist/IconButton.js +1 -1
- package/dist/Image.d.ts +33 -9
- package/dist/Image.js +61 -16
- package/dist/Input.d.ts +1 -1
- package/dist/Input.js +4 -4
- package/dist/InputShell.d.ts +7 -0
- package/dist/InputShell.js +18 -3
- package/dist/KeyValueList.d.ts +2 -2
- package/dist/Lightbox.js +5 -3
- package/dist/ListRow.d.ts +4 -5
- package/dist/ListRow.js +36 -26
- package/dist/Mark.d.ts +10 -0
- package/dist/Mark.js +9 -0
- package/dist/Markdown.d.ts +18 -4
- package/dist/Markdown.js +176 -37
- package/dist/MediaTile.d.ts +9 -3
- package/dist/MediaTile.js +8 -4
- package/dist/Menu.d.ts +19 -8
- package/dist/Menu.js +13 -11
- package/dist/MetaList.d.ts +4 -3
- package/dist/MetaList.js +12 -4
- package/dist/Morph.d.ts +15 -1
- package/dist/Morph.js +70 -22
- package/dist/NavigationProgress.d.ts +2 -2
- package/dist/NavigationProgress.js +7 -5
- package/dist/NumberField.d.ts +66 -0
- package/dist/NumberField.js +68 -0
- package/dist/OutlineRegion.d.ts +41 -10
- package/dist/OutlineRegion.js +31 -6
- package/dist/PageFade.d.ts +9 -5
- package/dist/PageFade.js +39 -8
- package/dist/PageLayouts.d.ts +15 -5
- package/dist/PageLayouts.js +3 -3
- package/dist/Pill.d.ts +9 -4
- package/dist/Pill.js +15 -6
- package/dist/Popover.d.ts +31 -0
- package/dist/Popover.js +43 -0
- package/dist/Price.d.ts +21 -0
- package/dist/Price.js +34 -0
- package/dist/ProductTile.d.ts +36 -0
- package/dist/ProductTile.js +31 -0
- package/dist/ProgressBar.js +4 -2
- package/dist/PromoBanner.d.ts +25 -0
- package/dist/PromoBanner.js +16 -0
- package/dist/RadioGroup.d.ts +18 -8
- package/dist/RadioGroup.js +42 -18
- package/dist/ScrollStrip.d.ts +1 -1
- package/dist/ScrollStrip.js +1 -1
- package/dist/SearchInput.d.ts +17 -2
- package/dist/SearchInput.js +72 -13
- package/dist/SegmentedField.d.ts +15 -0
- package/dist/SegmentedField.js +15 -0
- package/dist/Select.js +5 -4
- package/dist/Show.d.ts +1 -1
- package/dist/Show.js +1 -1
- package/dist/SideColumn.d.ts +42 -15
- package/dist/SideColumn.js +45 -19
- package/dist/SiteFooter.d.ts +3 -3
- package/dist/SiteFooter.js +4 -3
- package/dist/SiteSearch.d.ts +57 -27
- package/dist/SiteSearch.js +13 -93
- package/dist/Slider.d.ts +27 -0
- package/dist/Slider.js +58 -0
- package/dist/SortableList.d.ts +19 -35
- package/dist/SortableList.js +36 -88
- package/dist/Stack.d.ts +4 -4
- package/dist/StackedBar.d.ts +13 -4
- package/dist/StackedBar.js +12 -7
- package/dist/StateMachine.d.ts +65 -0
- package/dist/StateMachine.js +113 -0
- package/dist/StatusPages.d.ts +28 -10
- package/dist/StatusPages.js +10 -10
- package/dist/Stepper.d.ts +21 -0
- package/dist/Stepper.js +33 -0
- package/dist/Steps.js +4 -3
- package/dist/Switch.d.ts +3 -3
- package/dist/Switch.js +18 -14
- package/dist/Table.d.ts +32 -9
- package/dist/Table.js +50 -20
- package/dist/TableCells.d.ts +24 -21
- package/dist/TableCells.js +68 -27
- package/dist/TableEditCell.d.ts +1 -1
- package/dist/TableOfContents.d.ts +34 -0
- package/dist/TableOfContents.js +23 -0
- package/dist/Tabs.d.ts +31 -16
- package/dist/Tabs.js +97 -22
- package/dist/TextLink.d.ts +18 -5
- package/dist/TextLink.js +19 -6
- package/dist/Textarea.d.ts +12 -1
- package/dist/Textarea.js +15 -2
- package/dist/ToastRegion.d.ts +17 -9
- package/dist/ToastRegion.js +70 -13
- package/dist/Tooltip.d.ts +10 -2
- package/dist/Tooltip.js +32 -11
- package/dist/Video.d.ts +19 -4
- package/dist/Video.js +15 -5
- package/dist/cardContext.d.ts +7 -0
- package/dist/cardContext.js +14 -0
- package/dist/cardControl.d.ts +15 -0
- package/dist/cardControl.js +32 -0
- package/dist/cardForm.d.ts +39 -0
- package/dist/cardForm.js +81 -0
- package/dist/cardWait.js +2 -1
- package/dist/colourScheme.d.ts +12 -2
- package/dist/colourScheme.js +32 -6
- package/dist/control.d.ts +30 -8
- package/dist/control.js +74 -7
- package/dist/copyScript.d.ts +7 -8
- package/dist/copyScript.js +8 -9
- package/dist/cx.d.ts +22 -3
- package/dist/cx.js +22 -3
- package/dist/dateLocale.d.ts +17 -0
- package/dist/dateLocale.js +30 -0
- package/dist/density.d.ts +15 -1
- package/dist/density.js +27 -8
- package/dist/emptySlot.d.ts +1 -0
- package/dist/fieldAnnounce.d.ts +11 -0
- package/dist/fieldAnnounce.js +36 -0
- package/dist/fieldControl.d.ts +7 -2
- package/dist/fieldControl.js +6 -2
- package/dist/fieldWait.d.ts +3 -3
- package/dist/fieldWait.js +3 -4
- package/dist/flowLayout.d.ts +68 -0
- package/dist/flowLayout.js +105 -0
- package/dist/fromXState.d.ts +73 -0
- package/dist/fromXState.js +110 -0
- package/dist/icons.d.ts +1 -1
- package/dist/icons.js +15 -0
- package/dist/index.d.ts +37 -11
- package/dist/index.js +24 -2
- package/dist/isoDate.d.ts +8 -1
- package/dist/isoDate.js +20 -1
- package/dist/labelWords.d.ts +16 -7
- package/dist/labelWords.js +14 -12
- package/dist/listRowProps.d.ts +17 -15
- package/dist/modal.d.ts +5 -0
- package/dist/modal.js +21 -1
- package/dist/navFold.js +6 -3
- package/dist/optionCard.d.ts +18 -0
- package/dist/optionCard.js +16 -0
- package/dist/scrollBody.d.ts +16 -0
- package/dist/scrollBody.js +15 -0
- package/dist/scrollEdges.d.ts +7 -0
- package/dist/scrollEdges.js +39 -5
- package/dist/scrollStop.d.ts +6 -2
- package/dist/scrollStop.js +24 -8
- package/dist/shownDate.d.ts +28 -10
- package/dist/shownDate.js +41 -22
- package/dist/siteSearchBody.d.ts +34 -0
- package/dist/siteSearchBody.js +117 -0
- package/dist/size.d.ts +7 -1
- package/dist/sortableDrop.d.ts +44 -0
- package/dist/sortableDrop.js +78 -0
- package/dist/sortableSlide.d.ts +9 -0
- package/dist/sortableSlide.js +70 -0
- package/dist/sortableTitle.d.ts +10 -0
- package/dist/sortableTitle.js +48 -0
- package/dist/stateMachineDots.d.ts +45 -0
- package/dist/stateMachineDots.js +162 -0
- package/dist/stickyColumn.d.ts +2 -2
- package/dist/stickyColumn.js +2 -2
- package/dist/switcher.d.ts +10 -5
- package/dist/switcher.js +7 -5
- package/dist/tableColumns.d.ts +17 -0
- package/dist/tableColumns.js +30 -2
- package/dist/tableEmpty.js +5 -5
- package/dist/tableRow.d.ts +26 -2
- package/dist/tableRow.js +23 -1
- package/dist/tableSort.d.ts +10 -5
- package/dist/tableSort.js +15 -4
- package/dist/target.d.ts +12 -0
- package/dist/target.js +12 -0
- package/dist/textBox.js +1 -1
- package/dist/truncated.d.ts +31 -0
- package/dist/truncated.js +51 -0
- package/dist/typography.d.ts +19 -11
- package/dist/typography.js +11 -13
- package/dist/useFlowLayout.d.ts +27 -0
- package/dist/useFlowLayout.js +119 -0
- package/package.json +3 -2
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
const text = (value) => typeof value === "string" && value !== "" ? value : undefined;
|
|
2
|
+
const KINDS = ["initial", "normal", "human", "terminal", "failed"];
|
|
3
|
+
const isKind = (value) => KINDS.some((kind) => kind === value);
|
|
4
|
+
const listOf = (value) => {
|
|
5
|
+
if (value === undefined)
|
|
6
|
+
return [];
|
|
7
|
+
return isList(value) ? value : [value];
|
|
8
|
+
};
|
|
9
|
+
function isList(value) {
|
|
10
|
+
return Array.isArray(value);
|
|
11
|
+
}
|
|
12
|
+
/** Every way a node moves on, each with the event name it is drawn with. */
|
|
13
|
+
function movesOf(node) {
|
|
14
|
+
const after = Object.entries(node.after ?? {}).map(([ms, t]) => [`after ${ms}`, t]);
|
|
15
|
+
const invoked = listOf(node.invoke).flatMap((i) => [
|
|
16
|
+
["done", i.onDone],
|
|
17
|
+
["error", i.onError],
|
|
18
|
+
]);
|
|
19
|
+
return [...Object.entries(node.on ?? {}), ["always", node.always], ...after, ...invoked];
|
|
20
|
+
}
|
|
21
|
+
/** A node's kind: its `meta.kind`, else what its `type` and the machine's `initial` say. */
|
|
22
|
+
function kindOf(id, node, initial) {
|
|
23
|
+
const meta = node.meta?.["kind"];
|
|
24
|
+
if (isKind(meta))
|
|
25
|
+
return meta;
|
|
26
|
+
if (node.type === "final")
|
|
27
|
+
return "terminal";
|
|
28
|
+
const start = typeof initial === "object" ? initial.target : initial;
|
|
29
|
+
return id === start ? "initial" : "normal";
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The top-level state a target names: `#machine.review`, `review.waiting` and `#rev` (the `id` of
|
|
33
|
+
* `review` or of a state inside it) are all `review`, and `.waiting` (a child of the state it
|
|
34
|
+
* leaves) is that state. Only the machine's top level is drawn, so a nested target lands on its
|
|
35
|
+
* parent.
|
|
36
|
+
*/
|
|
37
|
+
function targetState(target, from, ids) {
|
|
38
|
+
if (target.startsWith("."))
|
|
39
|
+
return from;
|
|
40
|
+
if (!target.startsWith("#"))
|
|
41
|
+
return target.split(".")[0] ?? target;
|
|
42
|
+
const [id = "", next] = target.slice(1).split(".");
|
|
43
|
+
if (id === ids.machine)
|
|
44
|
+
return next ?? "";
|
|
45
|
+
return ids.nodes.get(id) ?? id;
|
|
46
|
+
}
|
|
47
|
+
/** Each node `id` in `node` and below it, mapped to `top`, the top-level state it is in. */
|
|
48
|
+
function nodeIds(top, node, into) {
|
|
49
|
+
if (node.id !== undefined)
|
|
50
|
+
into.set(node.id, top);
|
|
51
|
+
for (const child of Object.values(node.states ?? {}))
|
|
52
|
+
nodeIds(top, child, into);
|
|
53
|
+
}
|
|
54
|
+
function targets(config) {
|
|
55
|
+
if (config === undefined)
|
|
56
|
+
return { to: [], meta: undefined };
|
|
57
|
+
if (typeof config === "string")
|
|
58
|
+
return { to: [config], meta: undefined };
|
|
59
|
+
const target = config.target ?? [];
|
|
60
|
+
const to = typeof target === "string" ? [target] : target.filter((t) => t !== undefined);
|
|
61
|
+
return { to, meta: config.meta };
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Turns an xstate v5 machine (the machine, or its config) into a `StateMachine` definition: one
|
|
65
|
+
* state per top-level state node, one transition per target in each node's `on`.
|
|
66
|
+
*
|
|
67
|
+
* - A state's `label` is its `meta.label`, else its key; its `owner` is `meta.owner`; its `kind`
|
|
68
|
+
* is `meta.kind` when that is one of the five, else `terminal` for a `type: "final"` node,
|
|
69
|
+
* `initial` for the machine's `initial`, and `normal` for the rest.
|
|
70
|
+
* - Each `on` event, `always`, each `after` delay and each `invoke`'s `onDone` and `onError` is a
|
|
71
|
+
* transition. Its `event` is its `meta.label`, else the event's name (`always`, `after 500`,
|
|
72
|
+
* `done`, `error`). A transition with no target
|
|
73
|
+
* (it stays where it is), one that stays inside its own state, or one whose target is not a
|
|
74
|
+
* top-level state is left out.
|
|
75
|
+
* - `state` adjusts each state, for a machine whose meta says it another way: return the state to
|
|
76
|
+
* draw, given its key, its config and the state the rules above made of it.
|
|
77
|
+
*
|
|
78
|
+
* Only the top level is read: a nested state is drawn as its parent.
|
|
79
|
+
*/
|
|
80
|
+
export function fromXState(machine, options = {}) {
|
|
81
|
+
const config = "config" in machine ? machine.config : machine;
|
|
82
|
+
const nodes = Object.entries(config.states ?? {});
|
|
83
|
+
const keys = new Set(nodes.map(([id]) => id));
|
|
84
|
+
const found = new Map();
|
|
85
|
+
for (const [id, node] of nodes)
|
|
86
|
+
nodeIds(id, node, found);
|
|
87
|
+
// xstate names a machine with no `id` "(machine)".
|
|
88
|
+
const ids = { machine: config.id ?? "(machine)", nodes: found };
|
|
89
|
+
const states = nodes.map(([id, node]) => {
|
|
90
|
+
const meta = node.meta ?? {};
|
|
91
|
+
const kind = kindOf(id, node, config.initial);
|
|
92
|
+
const owner = text(meta["owner"]);
|
|
93
|
+
const state = {
|
|
94
|
+
id,
|
|
95
|
+
label: text(meta["label"]) ?? id,
|
|
96
|
+
kind,
|
|
97
|
+
...(owner === undefined ? {} : { owner }),
|
|
98
|
+
};
|
|
99
|
+
return options.state ? options.state({ id, node, state }) : state;
|
|
100
|
+
});
|
|
101
|
+
const transitions = nodes.flatMap(([from, node]) => movesOf(node).flatMap(([event, on]) => listOf(on).flatMap((one) => {
|
|
102
|
+
const { to, meta } = targets(one);
|
|
103
|
+
const name = text(meta?.["label"]) ?? event;
|
|
104
|
+
return to
|
|
105
|
+
.map((t) => targetState(t, from, ids))
|
|
106
|
+
.filter((t) => t !== from && keys.has(t))
|
|
107
|
+
.map((t) => ({ from, to: t, event: name }));
|
|
108
|
+
})));
|
|
109
|
+
return { states, transitions };
|
|
110
|
+
}
|
package/dist/icons.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import type { ReactElement } from "react";
|
|
|
6
6
|
* icon's own shapes carry no `fill`, `stroke` or `stroke-width` (`Icon.test.tsx` holds them to
|
|
7
7
|
* that). A name is the idea or action the icon stands for, not a product.
|
|
8
8
|
*/
|
|
9
|
-
declare const NAMES: readonly ["diff", "baseline", "review", "ci", "self-host", "privacy", "capture", "branch", "theme", "speed", "search", "chevron-right", "chevron-down", "close", "external-link", "settings", "bell", "check", "plus", "more", "grid", "window", "type", "card", "pointer", "field", "table", "compass", "page", "briefcase"];
|
|
9
|
+
declare const NAMES: readonly ["diff", "baseline", "review", "ci", "self-host", "privacy", "capture", "branch", "theme", "speed", "search", "chevron-right", "chevron-down", "close", "external-link", "settings", "bell", "check", "alert", "plus", "minus", "more", "grid", "window", "type", "card", "pointer", "field", "table", "compass", "page", "briefcase", "cart", "pause", "play"];
|
|
10
10
|
/** The names of the icon set: feature ideas, then UI glyphs, then the ideas the docs sections stand for. */
|
|
11
11
|
export type IconName = (typeof NAMES)[number];
|
|
12
12
|
/** The icon `name` as an `<svg>`: the set's one grid, stroke, caps and joins, drawn in `currentColor`. */
|
package/dist/icons.js
CHANGED
|
@@ -25,7 +25,9 @@ const NAMES = [
|
|
|
25
25
|
"settings",
|
|
26
26
|
"bell",
|
|
27
27
|
"check",
|
|
28
|
+
"alert",
|
|
28
29
|
"plus",
|
|
30
|
+
"minus",
|
|
29
31
|
"more",
|
|
30
32
|
"grid",
|
|
31
33
|
"window",
|
|
@@ -37,6 +39,9 @@ const NAMES = [
|
|
|
37
39
|
"compass",
|
|
38
40
|
"page",
|
|
39
41
|
"briefcase",
|
|
42
|
+
"cart",
|
|
43
|
+
"pause",
|
|
44
|
+
"play",
|
|
40
45
|
];
|
|
41
46
|
const GLYPHS = {
|
|
42
47
|
/** Before and after, side by side: a minus on the left, a plus on the right. */
|
|
@@ -75,8 +80,12 @@ const GLYPHS = {
|
|
|
75
80
|
bell: (_jsxs(_Fragment, { children: [_jsx("path", { d: "M6 9.5a6 6 0 0 1 12 0c0 5 2 6.5 2 6.5H4s2-1.5 2-6.5Z" }), _jsx("path", { d: "M10 19.5a2.2 2.2 0 0 0 4 0" })] })),
|
|
76
81
|
/** Done or selected: a single tick. */
|
|
77
82
|
check: _jsx("path", { d: "m4.5 12.5 5 5L19.5 7" }),
|
|
83
|
+
/** Something is wrong: an exclamation mark in a ring. */
|
|
84
|
+
alert: (_jsxs(_Fragment, { children: [_jsx("circle", { cx: "12", cy: "12", r: "9" }), _jsx("path", { d: "M12 7.5v5.5M12 16.5v.01" })] })),
|
|
78
85
|
/** Add or create: two strokes crossing, upright. */
|
|
79
86
|
plus: _jsx("path", { d: "M12 5v14M5 12h14" }),
|
|
87
|
+
/** Less: one bar, the plus without its upright (a stepper's decrement). */
|
|
88
|
+
minus: _jsx("path", { d: "M5 12h14" }),
|
|
80
89
|
/** More actions behind a menu: three dots in a row. */
|
|
81
90
|
more: (_jsxs(_Fragment, { children: [_jsx("circle", { cx: "5.5", cy: "12", r: "1" }), _jsx("circle", { cx: "12", cy: "12", r: "1" }), _jsx("circle", { cx: "18.5", cy: "12", r: "1" })] })),
|
|
82
91
|
/** Things laid out in a grid: four tiles. */
|
|
@@ -99,6 +108,12 @@ const GLYPHS = {
|
|
|
99
108
|
page: (_jsxs(_Fragment, { children: [_jsx("path", { d: "M7.5 3H14l5 5v10.5a2.5 2.5 0 0 1-2.5 2.5h-9A2.5 2.5 0 0 1 5 18.5v-13A2.5 2.5 0 0 1 7.5 3Z" }), _jsx("path", { d: "M14 3v3.5A1.5 1.5 0 0 0 15.5 8H19M9 13h6M9 16.5h6" })] })),
|
|
100
109
|
/** Work for hire: a briefcase with its handle and clasp. */
|
|
101
110
|
briefcase: (_jsxs(_Fragment, { children: [_jsx("rect", { x: "3", y: "7.5", width: "18", height: "12", rx: "2.5" }), _jsx("path", { d: "M8.5 7.5V6a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v1.5M3 13h18M12 12v2.5" })] })),
|
|
111
|
+
/** A shopping bag: what a visitor has picked to buy (the cart). */
|
|
112
|
+
cart: (_jsxs(_Fragment, { children: [_jsx("path", { d: "M5.5 8h13l-1 11.5a1.5 1.5 0 0 1-1.5 1.5H8a1.5 1.5 0 0 1-1.5-1.5Z" }), _jsx("path", { d: "M9 10.5V7a3 3 0 0 1 6 0v3.5" })] })),
|
|
113
|
+
/** Stop a moving thing for now: two upright bars. */
|
|
114
|
+
pause: _jsx("path", { d: "M9 6v12M15 6v12" }),
|
|
115
|
+
/** Start a moving thing: a triangle pointing forward. */
|
|
116
|
+
play: _jsx("path", { d: "M8 5.5v13l10-6.5Z" }),
|
|
102
117
|
};
|
|
103
118
|
/** The icon `name` as an `<svg>`: the set's one grid, stroke, caps and joins, drawn in `currentColor`. */
|
|
104
119
|
export function iconGlyph(name) {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
export { Card } from "./Card.js";
|
|
1
|
+
export { Card, type CardHue } from "./Card.js";
|
|
2
|
+
export { CardGridRow } from "./CardGrid.js";
|
|
2
3
|
export { Pill, type PillTone } from "./Pill.js";
|
|
3
4
|
export { Badge } from "./Badge.js";
|
|
4
5
|
export { StatTile, type StatTileTone } from "./StatTile.js";
|
|
5
6
|
export { ProgressBar, type BarSize, type BarTone } from "./ProgressBar.js";
|
|
6
7
|
export { SplitBar } from "./SplitBar.js";
|
|
7
|
-
export { Legend, StackedBar, type LegendItem, type StackedSegment, type VizTone, } from "./StackedBar.js";
|
|
8
|
+
export { Legend, StackedBar, type LegendItem, type SegmentTone, type StackedSegment, type VizTone, type CategoryTone, } from "./StackedBar.js";
|
|
8
9
|
export { TrendChart, type TrendSeries } from "./TrendChart.js";
|
|
10
|
+
export { FlowDiagram, type FlowEdge, type FlowNode } from "./FlowDiagram.js";
|
|
11
|
+
export type { FlowBox, FlowDirection, FlowEdgePath, FlowLayout, FlowNodeBox, FlowPoint, } from "./flowLayout.js";
|
|
12
|
+
export { StateMachine, type StateMachineDefinition, type StateMachineItem, type StateMachineKind, type StateMachineState, type StateMachineTransition, } from "./StateMachine.js";
|
|
13
|
+
export { fromXState, type XStateMachineLike, type XStateNodeConfig, type XStateStateInput, type XStateTransitionConfig, } from "./fromXState.js";
|
|
9
14
|
export { Markdown } from "./Markdown.js";
|
|
10
15
|
export { AppShell, AppShellBrand, type AppShellDensity, appShellRootClassFor } from "./AppShell.js";
|
|
11
16
|
export { SiteFooter, type SiteFooterLink } from "./SiteFooter.js";
|
|
@@ -13,13 +18,15 @@ export { Container } from "./Container.js";
|
|
|
13
18
|
export { PageHeader } from "./PageHeader.js";
|
|
14
19
|
export { Hero } from "./Hero.js";
|
|
15
20
|
export { CardGrid, CenteredLayout, DetailLayout, FormLayout, FullBleedLayout, ListLayout, ProseLayout, } from "./PageLayouts.js";
|
|
21
|
+
export { ArticleLayout } from "./ArticleLayout.js";
|
|
16
22
|
export { SidebarLayout } from "./SidebarLayout.js";
|
|
17
23
|
export { DocsLayout, type DocsHeading, type DocsNavGroup, type DocsNeighbour, } from "./DocsLayout.js";
|
|
18
|
-
export { SideColumn, type SideColumnWidth } from "./SideColumn.js";
|
|
24
|
+
export { SideColumn, type SideColumnSide, type SideColumnWidth } from "./SideColumn.js";
|
|
19
25
|
export { StickyBar } from "./StickyBar.js";
|
|
20
26
|
export { ErrorPage, Forbidden, Maintenance, NotFound, Offline } from "./StatusPages.js";
|
|
21
27
|
export { Cluster, ClusterGrow, type ClusterAlign, type ClusterGrowMinWidth, type ClusterGap, type ClusterJustify, } from "./Cluster.js";
|
|
22
28
|
export { Section, type SectionSize } from "./Section.js";
|
|
29
|
+
export type { HeadingLevel } from "./headingLevel.js";
|
|
23
30
|
export { Stack, type StackAlign, type StackGap, type StackRowFrom, type StackWidth, } from "./Stack.js";
|
|
24
31
|
export { Show, type Breakpoint } from "./Show.js";
|
|
25
32
|
export { Button, type ButtonSize, type ButtonTone, type ButtonVariant } from "./Button.js";
|
|
@@ -28,18 +35,20 @@ export { type LinkAdapter, type LinkAdapterProps, LinkProvider } from "./link.js
|
|
|
28
35
|
export { Avatar, type AvatarShape, type AvatarSize } from "./Avatar.js";
|
|
29
36
|
export { AvatarStack, type AvatarStackPerson } from "./AvatarStack.js";
|
|
30
37
|
export { Breadcrumbs, type Crumb } from "./Breadcrumbs.js";
|
|
38
|
+
export { Stepper } from "./Stepper.js";
|
|
31
39
|
export { Pagination } from "./Pagination.js";
|
|
32
40
|
export { BulletItem, BulletList } from "./BulletList.js";
|
|
33
41
|
export { Callout } from "./Callout.js";
|
|
34
42
|
export { ToastRegion, type Toast } from "./ToastRegion.js";
|
|
35
43
|
export { ListRow } from "./ListRow.js";
|
|
36
44
|
export { SortableItem, SortableList, type SortableMove, SortableSection } from "./SortableList.js";
|
|
37
|
-
export { OutlineRegion, RegionFrame, type RegionRect } from "./OutlineRegion.js";
|
|
45
|
+
export { OutlineRegion, type OutlineRegionTone, RegionFrame, type RegionRect, } from "./OutlineRegion.js";
|
|
38
46
|
export { type CellTone, Table, TableBody, TableCell, TableFoot, TableGroupRow, TableHead, TableExpandCell, TableHeaderCell, TableRow, type TableSort, } from "./Table.js";
|
|
39
|
-
export type { RowTone } from "./tableRow.js";
|
|
47
|
+
export type { CellAlign, RowTone } from "./tableRow.js";
|
|
40
48
|
export { InlineEdit } from "./InlineEdit.js";
|
|
41
49
|
export { TableEditCell } from "./TableEditCell.js";
|
|
42
50
|
export { EmptyState } from "./EmptyState.js";
|
|
51
|
+
export type { EmptySize } from "./emptySlot.js";
|
|
43
52
|
export { Step, Steps, type StepsSize } from "./Steps.js";
|
|
44
53
|
export { Timeline, TimelineItem } from "./Timeline.js";
|
|
45
54
|
export { ChatComposer } from "./ChatComposer.js";
|
|
@@ -63,10 +72,12 @@ export { Icon } from "./Icon.js";
|
|
|
63
72
|
export type { IconName } from "./icons.js";
|
|
64
73
|
export { IconButton, type IconButtonTone, type IconButtonVariant } from "./IconButton.js";
|
|
65
74
|
export { Menu, type MenuAction } from "./Menu.js";
|
|
75
|
+
export { Popover } from "./Popover.js";
|
|
66
76
|
export { ColourSchemeToggle } from "./ColourSchemeToggle.js";
|
|
67
77
|
export { applyColourScheme, schemeClass, type ColourSchemeClasses, colourSchemeScript, readColourScheme, storeColourScheme, type ColourScheme, } from "./colourScheme.js";
|
|
68
|
-
export { Tabs, type Tab } from "./Tabs.js";
|
|
78
|
+
export { Tabs, type Tab, type TabButton } from "./Tabs.js";
|
|
69
79
|
export { SegmentedControl, type Segment } from "./SegmentedControl.js";
|
|
80
|
+
export type { SwitchButton, SwitchLink } from "./switcher.js";
|
|
70
81
|
export { Fieldset } from "./Fieldset.js";
|
|
71
82
|
export { Checkbox } from "./Checkbox.js";
|
|
72
83
|
export { Switch } from "./Switch.js";
|
|
@@ -78,22 +89,37 @@ export { CopyLine } from "./CopyLine.js";
|
|
|
78
89
|
export { Field } from "./Field.js";
|
|
79
90
|
export { FormGrid, FormRow, FormRowField, type FormRowSpan } from "./FormRow.js";
|
|
80
91
|
export { FieldDialog } from "./FieldDialog.js";
|
|
92
|
+
export { ConfirmDialog } from "./ConfirmDialog.js";
|
|
81
93
|
export { Input } from "./Input.js";
|
|
82
94
|
export type { ControlSize, ControlWidth } from "./control.js";
|
|
83
95
|
export type { ResponsiveSize, Size } from "./size.js";
|
|
84
96
|
export type { Tone } from "./tone.js";
|
|
85
97
|
export { MetaList, type MetaListSeparator } from "./MetaList.js";
|
|
86
98
|
export { Kbd } from "./Kbd.js";
|
|
87
|
-
export { KeyValue, KeyValueList } from "./KeyValueList.js";
|
|
88
|
-
export { Select } from "./Select.js";
|
|
99
|
+
export { KeyValue, KeyValueList, type KeyValueAlign } from "./KeyValueList.js";
|
|
100
|
+
export { Select, type SelectItem } from "./Select.js";
|
|
101
|
+
export { Combobox } from "./Combobox.js";
|
|
102
|
+
export { NumberField } from "./NumberField.js";
|
|
103
|
+
export { Slider } from "./Slider.js";
|
|
89
104
|
export { Textarea } from "./Textarea.js";
|
|
90
105
|
export { Video } from "./Video.js";
|
|
106
|
+
export { Audio } from "./Audio.js";
|
|
107
|
+
export { EmbedFrame } from "./EmbedFrame.js";
|
|
108
|
+
export { ColourSwatch } from "./ColourSwatch.js";
|
|
91
109
|
export { Image, type ImageAspect, type ImageWidth } from "./Image.js";
|
|
92
110
|
export { MediaTile } from "./MediaTile.js";
|
|
111
|
+
export { Price } from "./Price.js";
|
|
112
|
+
export { ProductTile, type ProductTileStatus } from "./ProductTile.js";
|
|
113
|
+
export { CartButton } from "./CartButton.js";
|
|
114
|
+
export { PromoBanner } from "./PromoBanner.js";
|
|
115
|
+
export { CallToAction } from "./CallToAction.js";
|
|
93
116
|
export { ScrollStrip } from "./ScrollStrip.js";
|
|
94
|
-
export { TextLink, type TextLinkSize } from "./TextLink.js";
|
|
117
|
+
export { TextLink, type TextLinkSize, type TextLinkTone } from "./TextLink.js";
|
|
118
|
+
export { TableOfContents, type TableOfContentsItem } from "./TableOfContents.js";
|
|
95
119
|
export { Caption, Display, Lead, Overline, PageHeading, Prose, SectionHeading, SubsectionHeading, type SubsectionHeadingSize, Text, type TextAlign, type TextLines, type TextMinWidth, type TextTone, } from "./typography.js";
|
|
120
|
+
export { Mark } from "./Mark.js";
|
|
96
121
|
export { DateField } from "./DateField.js";
|
|
97
122
|
export { DateRangePicker, type DateRange, type DateRangePreset } from "./DateRangePicker.js";
|
|
98
|
-
export {
|
|
99
|
-
export
|
|
123
|
+
export { DateTimeField } from "./DateTimeField.js";
|
|
124
|
+
export { fromISODate, fromISODateTime, toISODate, toISODateTime } from "./isoDate.js";
|
|
125
|
+
export type { CalendarDate, CalendarDateTime } from "@internationalized/date";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { Card } from "./Card.js";
|
|
2
|
+
export { CardGridRow } from "./CardGrid.js";
|
|
2
3
|
export { Pill } from "./Pill.js";
|
|
3
4
|
export { Badge } from "./Badge.js";
|
|
4
5
|
export { StatTile } from "./StatTile.js";
|
|
@@ -6,6 +7,9 @@ export { ProgressBar } from "./ProgressBar.js";
|
|
|
6
7
|
export { SplitBar } from "./SplitBar.js";
|
|
7
8
|
export { Legend, StackedBar, } from "./StackedBar.js";
|
|
8
9
|
export { TrendChart } from "./TrendChart.js";
|
|
10
|
+
export { FlowDiagram } from "./FlowDiagram.js";
|
|
11
|
+
export { StateMachine, } from "./StateMachine.js";
|
|
12
|
+
export { fromXState, } from "./fromXState.js";
|
|
9
13
|
export { Markdown } from "./Markdown.js";
|
|
10
14
|
export { AppShell, AppShellBrand, appShellRootClassFor } from "./AppShell.js";
|
|
11
15
|
export { SiteFooter } from "./SiteFooter.js";
|
|
@@ -13,6 +17,7 @@ export { Container } from "./Container.js";
|
|
|
13
17
|
export { PageHeader } from "./PageHeader.js";
|
|
14
18
|
export { Hero } from "./Hero.js";
|
|
15
19
|
export { CardGrid, CenteredLayout, DetailLayout, FormLayout, FullBleedLayout, ListLayout, ProseLayout, } from "./PageLayouts.js";
|
|
20
|
+
export { ArticleLayout } from "./ArticleLayout.js";
|
|
16
21
|
export { SidebarLayout } from "./SidebarLayout.js";
|
|
17
22
|
export { DocsLayout, } from "./DocsLayout.js";
|
|
18
23
|
export { SideColumn } from "./SideColumn.js";
|
|
@@ -28,13 +33,14 @@ export { LinkProvider } from "./link.js";
|
|
|
28
33
|
export { Avatar } from "./Avatar.js";
|
|
29
34
|
export { AvatarStack } from "./AvatarStack.js";
|
|
30
35
|
export { Breadcrumbs } from "./Breadcrumbs.js";
|
|
36
|
+
export { Stepper } from "./Stepper.js";
|
|
31
37
|
export { Pagination } from "./Pagination.js";
|
|
32
38
|
export { BulletItem, BulletList } from "./BulletList.js";
|
|
33
39
|
export { Callout } from "./Callout.js";
|
|
34
40
|
export { ToastRegion } from "./ToastRegion.js";
|
|
35
41
|
export { ListRow } from "./ListRow.js";
|
|
36
42
|
export { SortableItem, SortableList, SortableSection } from "./SortableList.js";
|
|
37
|
-
export { OutlineRegion, RegionFrame } from "./OutlineRegion.js";
|
|
43
|
+
export { OutlineRegion, RegionFrame, } from "./OutlineRegion.js";
|
|
38
44
|
export { Table, TableBody, TableCell, TableFoot, TableGroupRow, TableHead, TableExpandCell, TableHeaderCell, TableRow, } from "./Table.js";
|
|
39
45
|
export { InlineEdit } from "./InlineEdit.js";
|
|
40
46
|
export { TableEditCell } from "./TableEditCell.js";
|
|
@@ -60,6 +66,7 @@ export { Lightbox } from "./Lightbox.js";
|
|
|
60
66
|
export { Icon } from "./Icon.js";
|
|
61
67
|
export { IconButton } from "./IconButton.js";
|
|
62
68
|
export { Menu } from "./Menu.js";
|
|
69
|
+
export { Popover } from "./Popover.js";
|
|
63
70
|
export { ColourSchemeToggle } from "./ColourSchemeToggle.js";
|
|
64
71
|
export { applyColourScheme, schemeClass, colourSchemeScript, readColourScheme, storeColourScheme, } from "./colourScheme.js";
|
|
65
72
|
export { Tabs } from "./Tabs.js";
|
|
@@ -75,18 +82,33 @@ export { CopyLine } from "./CopyLine.js";
|
|
|
75
82
|
export { Field } from "./Field.js";
|
|
76
83
|
export { FormGrid, FormRow, FormRowField } from "./FormRow.js";
|
|
77
84
|
export { FieldDialog } from "./FieldDialog.js";
|
|
85
|
+
export { ConfirmDialog } from "./ConfirmDialog.js";
|
|
78
86
|
export { Input } from "./Input.js";
|
|
79
87
|
export { MetaList } from "./MetaList.js";
|
|
80
88
|
export { Kbd } from "./Kbd.js";
|
|
81
89
|
export { KeyValue, KeyValueList } from "./KeyValueList.js";
|
|
82
90
|
export { Select } from "./Select.js";
|
|
91
|
+
export { Combobox } from "./Combobox.js";
|
|
92
|
+
export { NumberField } from "./NumberField.js";
|
|
93
|
+
export { Slider } from "./Slider.js";
|
|
83
94
|
export { Textarea } from "./Textarea.js";
|
|
84
95
|
export { Video } from "./Video.js";
|
|
96
|
+
export { Audio } from "./Audio.js";
|
|
97
|
+
export { EmbedFrame } from "./EmbedFrame.js";
|
|
98
|
+
export { ColourSwatch } from "./ColourSwatch.js";
|
|
85
99
|
export { Image } from "./Image.js";
|
|
86
100
|
export { MediaTile } from "./MediaTile.js";
|
|
101
|
+
export { Price } from "./Price.js";
|
|
102
|
+
export { ProductTile } from "./ProductTile.js";
|
|
103
|
+
export { CartButton } from "./CartButton.js";
|
|
104
|
+
export { PromoBanner } from "./PromoBanner.js";
|
|
105
|
+
export { CallToAction } from "./CallToAction.js";
|
|
87
106
|
export { ScrollStrip } from "./ScrollStrip.js";
|
|
88
107
|
export { TextLink } from "./TextLink.js";
|
|
108
|
+
export { TableOfContents } from "./TableOfContents.js";
|
|
89
109
|
export { Caption, Display, Lead, Overline, PageHeading, Prose, SectionHeading, SubsectionHeading, Text, } from "./typography.js";
|
|
110
|
+
export { Mark } from "./Mark.js";
|
|
90
111
|
export { DateField } from "./DateField.js";
|
|
91
112
|
export { DateRangePicker } from "./DateRangePicker.js";
|
|
92
|
-
export {
|
|
113
|
+
export { DateTimeField } from "./DateTimeField.js";
|
|
114
|
+
export { fromISODate, fromISODateTime, toISODate, toISODateTime } from "./isoDate.js";
|
package/dist/isoDate.d.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
import { CalendarDate } from "@internationalized/date";
|
|
1
|
+
import { CalendarDate, CalendarDateTime } from "@internationalized/date";
|
|
2
2
|
/** `"1990-05-17"` for `CalendarDate(1990, 5, 17)`; `""` for no date, so it drops into a form field. */
|
|
3
3
|
export declare function toISODate(date: CalendarDate | null | undefined): string;
|
|
4
4
|
/** The `CalendarDate` of a `"YYYY-MM-DD"` string; `null` for an empty, malformed or impossible one. */
|
|
5
5
|
export declare function fromISODate(iso: string | null | undefined): CalendarDate | null;
|
|
6
|
+
/** `"2026-11-29T14:30"` for `CalendarDateTime(2026, 11, 29, 14, 30)`, seconds dropped; `""` for none. */
|
|
7
|
+
export declare function toISODateTime(value: CalendarDateTime | null | undefined): string;
|
|
8
|
+
/**
|
|
9
|
+
* The `CalendarDateTime` of a `"YYYY-MM-DDTHH:mm"` string; `null` for an empty, malformed or
|
|
10
|
+
* impossible one (a day the month does not have, an hour past 23).
|
|
11
|
+
*/
|
|
12
|
+
export declare function fromISODateTime(iso: string | null | undefined): CalendarDateTime | null;
|
package/dist/isoDate.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CalendarDate } from "@internationalized/date";
|
|
1
|
+
import { CalendarDate, CalendarDateTime } from "@internationalized/date";
|
|
2
2
|
const ISO_DATE = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
3
3
|
/** `"1990-05-17"` for `CalendarDate(1990, 5, 17)`; `""` for no date, so it drops into a form field. */
|
|
4
4
|
export function toISODate(date) {
|
|
@@ -14,3 +14,22 @@ export function fromISODate(iso) {
|
|
|
14
14
|
// CalendarDate constrains 1990-02-31 to 1990-02-28; a string that does not survive is impossible.
|
|
15
15
|
return date.toString() === iso ? date : null;
|
|
16
16
|
}
|
|
17
|
+
const ISO_DATE_TIME = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})$/;
|
|
18
|
+
/** `"2026-11-29T14:30"` for `CalendarDateTime(2026, 11, 29, 14, 30)`, seconds dropped; `""` for none. */
|
|
19
|
+
export function toISODateTime(value) {
|
|
20
|
+
return value ? value.toString().slice(0, 16) : "";
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The `CalendarDateTime` of a `"YYYY-MM-DDTHH:mm"` string; `null` for an empty, malformed or
|
|
24
|
+
* impossible one (a day the month does not have, an hour past 23).
|
|
25
|
+
*/
|
|
26
|
+
export function fromISODateTime(iso) {
|
|
27
|
+
const match = ISO_DATE_TIME.exec(iso ?? "");
|
|
28
|
+
if (!match)
|
|
29
|
+
return null;
|
|
30
|
+
const [year, month, day, hour, minute] = [1, 2, 3, 4, 5].map((at) => Number(match[at]));
|
|
31
|
+
if (Number(hour) > 23 || Number(minute) > 59)
|
|
32
|
+
return null;
|
|
33
|
+
const value = new CalendarDateTime(Number(year), Number(month), Number(day), Number(hour), Number(minute));
|
|
34
|
+
return toISODateTime(value) === iso ? value : null;
|
|
35
|
+
}
|
package/dist/labelWords.d.ts
CHANGED
|
@@ -1,20 +1,29 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
+
/** The ids of a choice's two note lines. */
|
|
3
|
+
export type NoteIds = {
|
|
4
|
+
hint: string;
|
|
5
|
+
error: string;
|
|
6
|
+
};
|
|
2
7
|
/**
|
|
3
|
-
* The label, with its
|
|
4
|
-
*
|
|
8
|
+
* The label, with its notes under it when there are any: the muted hint, and under it the error
|
|
9
|
+
* (an alert icon and red text, announced politely) when set. The hint stays while the error shows.
|
|
5
10
|
*/
|
|
6
|
-
export declare function Words({ label, hint, error,
|
|
11
|
+
export declare function Words({ label, hint, error, ids, }: {
|
|
7
12
|
label: ReactNode;
|
|
8
13
|
hint: ReactNode;
|
|
9
14
|
error: ReactNode;
|
|
10
|
-
|
|
15
|
+
ids: NoteIds | undefined;
|
|
11
16
|
}): ReactNode;
|
|
12
17
|
/**
|
|
13
|
-
* The
|
|
14
|
-
* whether it is invalid (an error is set)
|
|
18
|
+
* The notes' ids (none without a hint or an error), the control's whole `aria-describedby` (the
|
|
19
|
+
* caller's, then the hint, then the error), and whether it is invalid (an error is set), as in a
|
|
20
|
+
* `Field`.
|
|
15
21
|
*/
|
|
16
22
|
export declare function useNote(hint: ReactNode, error: ReactNode, describedBy: string | undefined): {
|
|
17
|
-
|
|
23
|
+
ids: {
|
|
24
|
+
hint: string;
|
|
25
|
+
error: string;
|
|
26
|
+
} | undefined;
|
|
18
27
|
describedIds: string;
|
|
19
28
|
invalid: boolean;
|
|
20
29
|
};
|
package/dist/labelWords.js
CHANGED
|
@@ -1,28 +1,30 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useId } from "react";
|
|
3
|
+
import { ErrorLine, Hint, noteDescribedBy } from "./Field.js";
|
|
3
4
|
/** Whether a note is set: `null`, `undefined`, `false` and `""` draw nothing. */
|
|
4
5
|
const given = (note) => note != null && note !== false && note !== "";
|
|
5
6
|
/**
|
|
6
|
-
* The label, with its
|
|
7
|
-
*
|
|
7
|
+
* The label, with its notes under it when there are any: the muted hint, and under it the error
|
|
8
|
+
* (an alert icon and red text, announced politely) when set. The hint stays while the error shows.
|
|
8
9
|
*/
|
|
9
|
-
export function Words({ label, hint, error,
|
|
10
|
-
if (
|
|
10
|
+
export function Words({ label, hint, error, ids, }) {
|
|
11
|
+
if (ids === undefined)
|
|
11
12
|
return label;
|
|
12
|
-
|
|
13
|
-
return (_jsxs("span", { className: "flex flex-col gap-0.5", children: [_jsx("span", { children: label }), _jsx("span", { id: id, role: failed ? "alert" : undefined, className: failed ? "text-xs text-red-700" : "text-xs text-slate-500", children: failed ? error : hint })] }));
|
|
13
|
+
return (_jsxs("span", { className: "flex flex-col gap-0.5", children: [_jsx("span", { children: label }), given(hint) ? _jsx(Hint, { id: ids.hint, children: hint }) : null, given(error) ? _jsx(ErrorLine, { id: ids.error, error: error }) : null] }));
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
* The
|
|
17
|
-
* whether it is invalid (an error is set)
|
|
16
|
+
* The notes' ids (none without a hint or an error), the control's whole `aria-describedby` (the
|
|
17
|
+
* caller's, then the hint, then the error), and whether it is invalid (an error is set), as in a
|
|
18
|
+
* `Field`.
|
|
18
19
|
*/
|
|
19
20
|
export function useNote(hint, error, describedBy) {
|
|
20
|
-
const
|
|
21
|
+
const own = { hint: useId(), error: useId() };
|
|
21
22
|
const invalid = given(error);
|
|
22
|
-
const
|
|
23
|
+
const ids = invalid || given(hint) ? own : undefined;
|
|
24
|
+
const notes = noteDescribedBy(given(hint), invalid, own);
|
|
23
25
|
return {
|
|
24
|
-
|
|
25
|
-
describedIds: [describedBy,
|
|
26
|
+
ids,
|
|
27
|
+
describedIds: [describedBy, notes].filter(Boolean).join(" "),
|
|
26
28
|
invalid,
|
|
27
29
|
};
|
|
28
30
|
}
|
package/dist/listRowProps.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { ComponentPropsWithoutRef, MouseEventHandler, PointerEventHandler, ReactNode } from "react";
|
|
2
|
-
import type { Unstyled } from "./props.js";
|
|
2
|
+
import type { Passthrough, Unstyled } from "./props.js";
|
|
3
3
|
import type { Size } from "./size.js";
|
|
4
4
|
import type { LoadingProps } from "./skeleton.js";
|
|
5
|
+
import type { TextTone } from "./typography.js";
|
|
5
6
|
type Shared = LoadingProps & {
|
|
6
7
|
/**
|
|
7
8
|
* `sm` is dense padding, `lg` one step roomier than `md`. A `Button`, `IconButton` or `Pill` in a
|
|
@@ -9,8 +10,6 @@ type Shared = LoadingProps & {
|
|
|
9
10
|
* @default md
|
|
10
11
|
*/
|
|
11
12
|
size?: Size | undefined;
|
|
12
|
-
/** A hairline above the row: set it on every row after the first. */
|
|
13
|
-
divided?: boolean | undefined;
|
|
14
13
|
/** Content before the label: an Avatar, a thumbnail, an icon. */
|
|
15
14
|
leading?: ReactNode | undefined;
|
|
16
15
|
/** A second, muted line under the label (a date, a note), like `TableCell`'s `secondary`. */
|
|
@@ -31,8 +30,7 @@ type Shared = LoadingProps & {
|
|
|
31
30
|
/**
|
|
32
31
|
* Marks the row a list follows with the pointer and the keyboard alike (set it from
|
|
33
32
|
* `onPointerEnter` and `onFocus`): a fill one step deeper than hover, so it shows on a white card
|
|
34
|
-
* and on a tinted panel alike.
|
|
35
|
-
* shows `actions` that `revealOnHover` hides. `selected` wins.
|
|
33
|
+
* and on a tinted panel alike. It is the only fill a static row takes. `selected` wins.
|
|
36
34
|
*
|
|
37
35
|
* Clear it from `onPointerLeave`.
|
|
38
36
|
*/
|
|
@@ -44,11 +42,15 @@ type Shared = LoadingProps & {
|
|
|
44
42
|
* For a row that shows a screenshot.
|
|
45
43
|
*/
|
|
46
44
|
leadingWidth?: "thumbnail" | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* The row's status, as a stripe on its leading edge in this tone, as a `Table` row's `stripe`. The
|
|
47
|
+
* colour says it to the eye only, so the row's words say it too (a `Pill`, a status in `trailing`).
|
|
48
|
+
*/
|
|
49
|
+
stripe?: Exclude<TextTone, "neutral"> | undefined;
|
|
47
50
|
children: ReactNode;
|
|
48
51
|
};
|
|
49
52
|
type NotStatic = {
|
|
50
53
|
actions?: undefined;
|
|
51
|
-
revealOnHover?: undefined;
|
|
52
54
|
panel?: undefined;
|
|
53
55
|
};
|
|
54
56
|
export type ListRowButtonProps = Shared & NotStatic & {
|
|
@@ -81,21 +83,19 @@ export type ListRowLinkProps = Shared & NotStatic & {
|
|
|
81
83
|
href: string;
|
|
82
84
|
};
|
|
83
85
|
/**
|
|
84
|
-
* A row with no `href` and no `onClick`: a `<div>` with no click target and no hover fill
|
|
85
|
-
*
|
|
86
|
+
* A row with no `href` and no `onClick`: a `<div>` with no click target and no hover fill, for one
|
|
87
|
+
* that holds its own controls, taking `actions` as well.
|
|
86
88
|
*/
|
|
87
89
|
export type ListRowStaticProps = Shared & {
|
|
88
|
-
/** Buttons for this row, after `trailing`: `Button size="sm"`, `IconButton`. */
|
|
89
|
-
actions?: ReactNode | undefined;
|
|
90
90
|
/**
|
|
91
|
-
*
|
|
92
|
-
*
|
|
91
|
+
* Buttons for this row, after `trailing`: `Button size="sm"`, `IconButton`, a `Menu`. Always
|
|
92
|
+
* shown: an action that shows only on hover is one a touch or keyboard user cannot find.
|
|
93
93
|
*/
|
|
94
|
-
|
|
94
|
+
actions?: ReactNode | undefined;
|
|
95
95
|
/**
|
|
96
96
|
* Content under the row, lined up with the label rather than the row's edge (past `leading`): the
|
|
97
97
|
* panel of a row that opens in place, such as a conversation under its chat. It sits inside the
|
|
98
|
-
* row, so
|
|
98
|
+
* row, so the fill and a `Stack divided` line cover it too. Only a row that is neither a
|
|
99
99
|
* button nor a link takes it.
|
|
100
100
|
*/
|
|
101
101
|
panel?: ReactNode | undefined;
|
|
@@ -103,6 +103,8 @@ export type ListRowStaticProps = Shared & {
|
|
|
103
103
|
onClick?: undefined;
|
|
104
104
|
disabledReason?: undefined;
|
|
105
105
|
href?: undefined;
|
|
106
|
-
} &
|
|
106
|
+
} & Passthrough &
|
|
107
|
+
/** What sets and clears `highlighted`; focus events bubble up from the row's own controls. */
|
|
108
|
+
Pick<ComponentPropsWithoutRef<"div">, "onPointerEnter" | "onPointerLeave" | "onFocus" | "onBlur">;
|
|
107
109
|
export type ListRowProps = ListRowButtonProps | ListRowLinkProps | ListRowStaticProps;
|
|
108
110
|
export {};
|
package/dist/modal.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { type RefObject } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Whether a `Dialog`, `Drawer` or `Lightbox` is open. `ToastRegion` holds its toasts back while one
|
|
4
|
+
* is: the page behind a modal is inert, so a toast there could be neither read nor reached.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useModalOpen(): boolean;
|
|
2
7
|
/**
|
|
3
8
|
* Opens the `<dialog>` with `showModal()` on mount and closes it on unmount. Closing on unmount
|
|
4
9
|
* (not just on Esc or the backdrop) hands focus back to the opener and drops the inert page behind
|
package/dist/modal.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useLayoutEffect, useRef } from "react";
|
|
1
|
+
import { useLayoutEffect, useRef, useSyncExternalStore } from "react";
|
|
2
2
|
/** Resolves when the transitions running on the dialog (and its backdrop) have ended. */
|
|
3
3
|
async function exitTransitions(dialog) {
|
|
4
4
|
// A browser without the Web Animations API (or jsdom) has nothing to wait for.
|
|
@@ -7,6 +7,24 @@ async function exitTransitions(dialog) {
|
|
|
7
7
|
const running = dialog.getAnimations({ subtree: true }).filter((a) => "transitionProperty" in a);
|
|
8
8
|
await Promise.allSettled(running.map((a) => a.finished));
|
|
9
9
|
}
|
|
10
|
+
/** How many of the library's modals are open, and who wants to hear when that changes. */
|
|
11
|
+
let openModals = 0;
|
|
12
|
+
const watchers = new Set();
|
|
13
|
+
const opened = (by) => {
|
|
14
|
+
openModals += by;
|
|
15
|
+
for (const watcher of watchers)
|
|
16
|
+
watcher();
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Whether a `Dialog`, `Drawer` or `Lightbox` is open. `ToastRegion` holds its toasts back while one
|
|
20
|
+
* is: the page behind a modal is inert, so a toast there could be neither read nor reached.
|
|
21
|
+
*/
|
|
22
|
+
export function useModalOpen() {
|
|
23
|
+
return useSyncExternalStore((watcher) => {
|
|
24
|
+
watchers.add(watcher);
|
|
25
|
+
return () => watchers.delete(watcher);
|
|
26
|
+
}, () => openModals > 0, () => false);
|
|
27
|
+
}
|
|
10
28
|
/**
|
|
11
29
|
* Opens the `<dialog>` with `showModal()` on mount and closes it on unmount. Closing on unmount
|
|
12
30
|
* (not just on Esc or the backdrop) hands focus back to the opener and drops the inert page behind
|
|
@@ -22,9 +40,11 @@ export function useModal(dialog, onClose) {
|
|
|
22
40
|
const el = dialog.current;
|
|
23
41
|
mounted.current = true;
|
|
24
42
|
el?.showModal();
|
|
43
|
+
opened(1);
|
|
25
44
|
return () => {
|
|
26
45
|
mounted.current = false;
|
|
27
46
|
el?.close();
|
|
47
|
+
opened(-1);
|
|
28
48
|
};
|
|
29
49
|
}, [dialog]);
|
|
30
50
|
return () => {
|