@slashsuite/ui-react 0.12.0 → 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 +101 -44
- package/agent-docs/components/app-shell.md +139 -0
- package/agent-docs/components/article-layout.md +140 -0
- package/agent-docs/components/audio.md +42 -0
- package/agent-docs/components/avatar-stack.md +64 -0
- package/agent-docs/components/avatar.md +76 -0
- package/agent-docs/components/badge.md +62 -0
- package/agent-docs/components/body-text.md +169 -0
- package/agent-docs/components/bottom-sheet.md +105 -0
- package/agent-docs/components/breadcrumbs.md +66 -0
- package/agent-docs/components/bullet-list.md +54 -0
- package/agent-docs/components/button.md +135 -0
- package/agent-docs/components/call-to-action.md +59 -0
- package/agent-docs/components/callout.md +87 -0
- package/agent-docs/components/card-grid.md +116 -0
- package/agent-docs/components/card.md +128 -0
- package/agent-docs/components/cart-button.md +63 -0
- package/agent-docs/components/centered-layout.md +90 -0
- package/agent-docs/components/chat-composer.md +49 -0
- package/agent-docs/components/chat-message.md +61 -0
- package/agent-docs/components/chat-thread.md +49 -0
- package/agent-docs/components/checkbox.md +81 -0
- package/agent-docs/components/cluster.md +108 -0
- package/agent-docs/components/code-example.md +48 -0
- package/agent-docs/components/code.md +72 -0
- package/agent-docs/components/colour-scheme-toggle.md +98 -0
- 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 +51 -0
- package/agent-docs/components/copy-button.md +63 -0
- package/agent-docs/components/copy-line.md +55 -0
- package/agent-docs/components/date-field.md +106 -0
- package/agent-docs/components/date-range-picker.md +108 -0
- package/agent-docs/components/date-time-field.md +73 -0
- package/agent-docs/components/detail-layout.md +147 -0
- package/agent-docs/components/dialog.md +132 -0
- package/agent-docs/components/disclosure.md +70 -0
- package/agent-docs/components/divider.md +62 -0
- package/agent-docs/components/docs-layout.md +164 -0
- package/agent-docs/components/drawer.md +137 -0
- package/agent-docs/components/embed-frame.md +48 -0
- package/agent-docs/components/empty-state.md +70 -0
- package/agent-docs/components/field-dialog.md +98 -0
- package/agent-docs/components/field.md +71 -0
- package/agent-docs/components/fieldset.md +82 -0
- package/agent-docs/components/file-drop.md +52 -0
- package/agent-docs/components/flow-diagram.md +87 -0
- package/agent-docs/components/form-layout.md +144 -0
- package/agent-docs/components/form-row.md +93 -0
- package/agent-docs/components/full-bleed-layout.md +114 -0
- package/agent-docs/components/headings.md +107 -0
- package/agent-docs/components/hero.md +68 -0
- package/agent-docs/components/icon-button.md +90 -0
- package/agent-docs/components/icon.md +59 -0
- package/agent-docs/components/image.md +74 -0
- package/agent-docs/components/input.md +84 -0
- package/agent-docs/components/kbd.md +38 -0
- package/agent-docs/components/key-value-list.md +84 -0
- package/agent-docs/components/lightbox.md +97 -0
- package/agent-docs/components/list-layout.md +152 -0
- package/agent-docs/components/list-row.md +119 -0
- package/agent-docs/components/loading.md +69 -0
- package/agent-docs/components/markdown.md +51 -0
- package/agent-docs/components/media-tile.md +101 -0
- package/agent-docs/components/menu.md +110 -0
- package/agent-docs/components/meta-list.md +69 -0
- package/agent-docs/components/morph.md +134 -0
- package/agent-docs/components/navigation-progress.md +56 -0
- package/agent-docs/components/number-field.md +75 -0
- package/agent-docs/components/outline-region.md +74 -0
- package/agent-docs/components/page-fade.md +117 -0
- package/agent-docs/components/page-header.md +93 -0
- package/agent-docs/components/pagination.md +64 -0
- package/agent-docs/components/pill.md +105 -0
- 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/progress-bar.md +66 -0
- package/agent-docs/components/promo-banner.md +46 -0
- package/agent-docs/components/prose-layout.md +87 -0
- package/agent-docs/components/prose.md +41 -0
- package/agent-docs/components/radio-group.md +77 -0
- package/agent-docs/components/scroll-strip.md +48 -0
- package/agent-docs/components/segmented-control.md +135 -0
- package/agent-docs/components/select.md +70 -0
- package/agent-docs/components/show.md +120 -0
- package/agent-docs/components/side-column.md +74 -0
- package/agent-docs/components/sidebar-layout.md +134 -0
- package/agent-docs/components/site-footer.md +63 -0
- package/agent-docs/components/site-search.md +79 -0
- package/agent-docs/components/slider.md +59 -0
- package/agent-docs/components/sortable-list.md +112 -0
- package/agent-docs/components/split-bar.md +54 -0
- package/agent-docs/components/stack.md +197 -0
- package/agent-docs/components/stacked-bar.md +91 -0
- package/agent-docs/components/stat-tile.md +69 -0
- package/agent-docs/components/state-machine.md +95 -0
- package/agent-docs/components/status-pages.md +112 -0
- package/agent-docs/components/stepper.md +54 -0
- package/agent-docs/components/steps.md +74 -0
- package/agent-docs/components/sticky-bar.md +51 -0
- package/agent-docs/components/switch.md +79 -0
- package/agent-docs/components/table-of-contents.md +78 -0
- package/agent-docs/components/table.md +384 -0
- package/agent-docs/components/tabs.md +178 -0
- package/agent-docs/components/text-link.md +110 -0
- package/agent-docs/components/textarea.md +53 -0
- package/agent-docs/components/timeline.md +79 -0
- package/agent-docs/components/toast.md +91 -0
- package/agent-docs/components/trend-chart.md +61 -0
- package/agent-docs/components/video.md +49 -0
- package/agent-docs/llms.txt +174 -0
- 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 +7 -3
- package/skills/uislash/SKILL.md +20 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
## FlowDiagram
|
|
2
|
+
|
|
3
|
+
Group: Data
|
|
4
|
+
|
|
5
|
+
When to use: Things that move from one step to another along named arrows, loops and branches included: a review flow, a deploy pipeline, the states an order goes through.
|
|
6
|
+
|
|
7
|
+
### The one right way
|
|
8
|
+
One box carries a tone, the step that waits on a person, and its label says so too.
|
|
9
|
+
```tsx
|
|
10
|
+
import { FlowDiagram } from "@slashsuite/ui-react";
|
|
11
|
+
|
|
12
|
+
<FlowDiagram
|
|
13
|
+
label="How a build lands"
|
|
14
|
+
nodes={[
|
|
15
|
+
{ id: "launched", label: "Building" },
|
|
16
|
+
{ id: "gate", label: "Waiting on a reviewer", tone: "warn" },
|
|
17
|
+
{ id: "merged", label: "Merged" },
|
|
18
|
+
]}
|
|
19
|
+
edges={[
|
|
20
|
+
{ from: "launched", to: "gate", label: "hand off" },
|
|
21
|
+
{ from: "gate", to: "launched", label: "send back" },
|
|
22
|
+
{ from: "gate", to: "merged", label: "land" },
|
|
23
|
+
]}
|
|
24
|
+
/>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Do
|
|
28
|
+
- Give it `nodes` (`{ id, label }`) and `edges` (`{ from, to }`, by id) and nothing else: it ranks the boxes along the arrows and routes every arrow round them, loops and arrows back included. Their order is only a hint.
|
|
29
|
+
- `label` on an edge is a word or two: the event or the action that moves along it (`submit`, `approve`).
|
|
30
|
+
- `direction` is `down` (default) for a flow read from the top, or `right` for a short pipeline read from the start.
|
|
31
|
+
- `tone` says what a box means: `warn` for a step that waits on a person, `danger` for a failure, `positive` for done. Say it in the label too, and leave the rest `neutral`.
|
|
32
|
+
- `content` goes under a box's label and the box grows to hold it: a few `Pill`s, a short list. It is display only, so no links or buttons.
|
|
33
|
+
- `group` frames boxes that belong together (a lane, an owner) in a dashed frame named by it. `active` rings the one box a thing is in now.
|
|
34
|
+
- `overlay` draws on top of the diagram in its own coordinates, from each box's place and each arrow's SVG path (`FlowLayout`): a marker on an arrow, a count over a box.
|
|
35
|
+
- A diagram wider or taller than its room scrolls inside its own box, so the page never scrolls sideways.
|
|
36
|
+
|
|
37
|
+
### Don't
|
|
38
|
+
- Do not colour every box: a tone on every step means nothing.
|
|
39
|
+
- Do not draw steps that only run in a line with no branch or loop: that is `Steps`.
|
|
40
|
+
|
|
41
|
+
A tone on every box means nothing: the one that needs a person no longer stands out.
|
|
42
|
+
```tsx
|
|
43
|
+
import { FlowDiagram } from "@slashsuite/ui-react";
|
|
44
|
+
|
|
45
|
+
<FlowDiagram
|
|
46
|
+
label="How a build lands"
|
|
47
|
+
nodes={[
|
|
48
|
+
{ id: "launched", label: "Building", tone: "info" },
|
|
49
|
+
{ id: "gate", label: "Waiting on a reviewer", tone: "warn" },
|
|
50
|
+
{ id: "merged", label: "Merged", tone: "positive" },
|
|
51
|
+
]}
|
|
52
|
+
edges={[
|
|
53
|
+
{ from: "launched", to: "gate", label: "hand off" },
|
|
54
|
+
{ from: "gate", to: "launched", label: "send back" },
|
|
55
|
+
{ from: "gate", to: "merged", label: "land" },
|
|
56
|
+
]}
|
|
57
|
+
/>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Accessibility
|
|
61
|
+
- The diagram is an image named by `label`, with the count of boxes and arrows. It takes the keyboard focus so a diagram that scrolls can be scrolled with the arrow keys.
|
|
62
|
+
- A visually hidden list after it carries every box, in `nodes` order: its label, `current` for `active`, its group, its content, and an item per arrow out of it naming the target and the arrow's label.
|
|
63
|
+
- `overlay` is hidden from assistive tech and the pointer: say in a box's label or content what it shows.
|
|
64
|
+
|
|
65
|
+
### Props
|
|
66
|
+
### FlowDiagram
|
|
67
|
+
Boxes joined by arrows, laid out for you: a flow, a pipeline, a state machine. Give it the `nodes` and the `edges` between them and it places every box in ranks `direction` (`down` or `right`) and routes every arrow round them, loops and arrows back up included (dagre's layered layout). Each box is as wide as its label and its `content`, so no text spills; boxes with a `group` share a dashed frame; `active` rings one box in the accent. The diagram is drawn at its own size and scrolls inside its own box when it is wider or taller than the room it has, so it never makes the page scroll sideways. It is an image named by `label`; every box and every arrow is also a visually hidden list after it. `overlay` draws on top of the diagram in its own coordinates: it is handed the laid-out `FlowLayout` (each box's place and each arrow's SVG path), for a marker that follows an arrow. It is not hit by the pointer, and it is hidden from a screen reader. While `loading` with no nodes it draws one bone the height of a small diagram.
|
|
68
|
+
- active: string. The `id` of the one box to ring in the accent: the current step, the state a thing is in now.
|
|
69
|
+
- direction: "down" | "right" (default down). Where the arrows run: `down` (top to bottom) or `right` (start to end).
|
|
70
|
+
- edges: readonly FlowEdge[] (required). The arrows. One whose `from` or `to` is not a node's `id` is not drawn.
|
|
71
|
+
- id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
|
|
72
|
+
- label: string (required). What the diagram shows: its accessible name, and the name of its hidden list.
|
|
73
|
+
- loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
|
|
74
|
+
Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
|
|
75
|
+
- loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
|
|
76
|
+
- nodes: readonly FlowNode[] (required). The boxes, each with a unique `id`. Their order is only a hint: the layout ranks them by the arrows.
|
|
77
|
+
- overlay: ((layout: FlowLayout) => ReactNode). Draws on top of the diagram, in its coordinates, from the laid-out boxes and arrow paths.
|
|
78
|
+
|
|
79
|
+
### Types
|
|
80
|
+
- FlowNode: `{ id: string; label: string; tone?: Tone; group?: string; content?: ReactNode }`. One box of a `FlowDiagram`: its `id` (what an arrow's `from` and `to` name), its `label`, a `tone` that says what it means, the `group` it is framed in, and `content` drawn under the label (a few `Pill`s, a short list).
|
|
81
|
+
- FlowEdge: `{ from: string; to: string; label?: string }`. One arrow of a `FlowDiagram`, from one node's `id` to another's, with an optional short `label` on it.
|
|
82
|
+
- FlowDirection: `"down" | "right"`. `down` reads from the top, `right` from the start edge.
|
|
83
|
+
- FlowLayout: `{ width: number; height: number; nodes: readonly FlowNodeBox[]; groups: readonly (FlowBox & { name: string })[]; edges: readonly FlowEdgePath[] }`. The whole diagram as laid out, in one coordinate space: `width` and `height`, a box per node and per group, and a path per arrow. `FlowDiagram` hands it to `overlay`.
|
|
84
|
+
- FlowNodeBox: `{ x: number; y: number; width: number; height: number; id: string }`. A node as laid out: its `id` and its box. A group's box (`group`) is the frame round its nodes.
|
|
85
|
+
- FlowEdgePath: `{ from: string; to: string; index: number; points: readonly FlowPoint[]; path: string; labelAt: FlowPoint | null }`. An arrow as laid out: the `from` and `to` ids, its place in `edges` (`index`), the points dagre routed it through, the SVG path drawn through them (it ends on the target's edge, at the arrowhead's tip) and its label's centre when it has one.
|
|
86
|
+
- FlowBox: `{ x: number; y: number; width: number; height: number }`. Where a node or a group sits, its top left corner and its size, in CSS pixels.
|
|
87
|
+
- FlowPoint: `{ x: number; y: number }`. A point in the diagram's own space, in CSS pixels from its top left corner.
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
## FormLayout
|
|
2
|
+
|
|
3
|
+
Group: Page layouts
|
|
4
|
+
|
|
5
|
+
When to use: Creating or editing a record on a page of its own.
|
|
6
|
+
|
|
7
|
+
### Use instead
|
|
8
|
+
- FormRow (form-row.md): Fields sit side by side inside the form: a `FormGrid`, or a `FormRow` to edit one record on a line.
|
|
9
|
+
- Stack (stack.md): The form sits in a `Card` on a page that is not the form: `Stack as="form"`.
|
|
10
|
+
- FieldDialog (field-dialog.md): One text value is asked for over the page, such as a new name.
|
|
11
|
+
|
|
12
|
+
### The one right way
|
|
13
|
+
The fields go in `children`; Save and Cancel go in `actions`, at the end of the form.
|
|
14
|
+
```tsx
|
|
15
|
+
import { Button, Card, Field, FormLayout, Input, Stack } from "@slashsuite/ui-react";
|
|
16
|
+
|
|
17
|
+
<FormLayout
|
|
18
|
+
title="New client"
|
|
19
|
+
description="Who is the quote for?"
|
|
20
|
+
onSubmit={(event) => event.preventDefault()}
|
|
21
|
+
actions={
|
|
22
|
+
<>
|
|
23
|
+
<Button type="submit">Save client</Button>
|
|
24
|
+
<Button variant="ghost">Cancel</Button>
|
|
25
|
+
</>
|
|
26
|
+
}
|
|
27
|
+
>
|
|
28
|
+
<Card title="Client">
|
|
29
|
+
<Stack>
|
|
30
|
+
<Field label="Full name">
|
|
31
|
+
<Input placeholder="Naledi Mokoena" />
|
|
32
|
+
</Field>
|
|
33
|
+
<Field label="Email">
|
|
34
|
+
<Input type="email" placeholder="naledi@example.com" />
|
|
35
|
+
</Field>
|
|
36
|
+
</Stack>
|
|
37
|
+
</Card>
|
|
38
|
+
</FormLayout>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Full page
|
|
42
|
+
A whole form page: the shell with its brand and nav, then the layout with the fields in `children` and Save and Cancel in `actions`.
|
|
43
|
+
```tsx
|
|
44
|
+
import {
|
|
45
|
+
AppShell,
|
|
46
|
+
Button,
|
|
47
|
+
Card,
|
|
48
|
+
Field,
|
|
49
|
+
FormLayout,
|
|
50
|
+
Input,
|
|
51
|
+
Tabs,
|
|
52
|
+
Stack,
|
|
53
|
+
} from "@slashsuite/ui-react";
|
|
54
|
+
|
|
55
|
+
<AppShell
|
|
56
|
+
brand={<a href="#">Hack Cove</a>}
|
|
57
|
+
nav={
|
|
58
|
+
<Tabs
|
|
59
|
+
label="Main"
|
|
60
|
+
items={[
|
|
61
|
+
{ label: "Quotes", href: "#quotes", selected: true },
|
|
62
|
+
{ label: "Clients", href: "#clients" },
|
|
63
|
+
]}
|
|
64
|
+
/>
|
|
65
|
+
}
|
|
66
|
+
>
|
|
67
|
+
<FormLayout
|
|
68
|
+
title="New client"
|
|
69
|
+
description="Who is the quote for?"
|
|
70
|
+
onSubmit={(event) => event.preventDefault()}
|
|
71
|
+
actions={
|
|
72
|
+
<>
|
|
73
|
+
<Button type="submit">Save client</Button>
|
|
74
|
+
<Button variant="ghost">Cancel</Button>
|
|
75
|
+
</>
|
|
76
|
+
}
|
|
77
|
+
>
|
|
78
|
+
<Card title="Client">
|
|
79
|
+
<Stack>
|
|
80
|
+
<Field label="Full name">
|
|
81
|
+
<Input placeholder="Naledi Mokoena" />
|
|
82
|
+
</Field>
|
|
83
|
+
<Field label="Email">
|
|
84
|
+
<Input type="email" />
|
|
85
|
+
</Field>
|
|
86
|
+
</Stack>
|
|
87
|
+
</Card>
|
|
88
|
+
</FormLayout>
|
|
89
|
+
</AppShell>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Do
|
|
93
|
+
- The fields are the `children`, grouped in `Card`s; the layout spaces them in a reading-width column.
|
|
94
|
+
- Save and Cancel go in `actions`, at the end of the form: a `type="submit"` Button first, then a ghost Cancel. The header has no `actions` here.
|
|
95
|
+
- Handle the submit with `onSubmit`: other props go on the `<form>` itself.
|
|
96
|
+
- A failed submit (the server refused it, no connection) is `error`: an alert directly above the `actions`. An error about one field is that `Field`'s `error`.
|
|
97
|
+
- A closing remark about the whole form (when you will hear back, what happens next) is `note`: a muted line set apart under the `actions`. A remark about one field is that `Field`'s `hint`.
|
|
98
|
+
- A form in a small panel is a `Dialog` or `FieldDialog`; a sign-in is `CenteredLayout`.
|
|
99
|
+
|
|
100
|
+
### Don't
|
|
101
|
+
- Do not put Save in the header of a `ListLayout`: that is not a form.
|
|
102
|
+
|
|
103
|
+
`ListLayout` is not a form: Save sits in the header, away from the fields, and nothing submits on Enter. Use `FormLayout`.
|
|
104
|
+
```tsx
|
|
105
|
+
import { Button, Card, Field, Input, ListLayout, Stack } from "@slashsuite/ui-react";
|
|
106
|
+
|
|
107
|
+
<ListLayout
|
|
108
|
+
title="New client"
|
|
109
|
+
description="Who is the quote for?"
|
|
110
|
+
actions={<Button>Save client</Button>}
|
|
111
|
+
>
|
|
112
|
+
<Card title="Client">
|
|
113
|
+
<Stack>
|
|
114
|
+
<Field label="Full name">
|
|
115
|
+
<Input placeholder="Naledi Mokoena" />
|
|
116
|
+
</Field>
|
|
117
|
+
<Field label="Email">
|
|
118
|
+
<Input type="email" placeholder="naledi@example.com" />
|
|
119
|
+
</Field>
|
|
120
|
+
</Stack>
|
|
121
|
+
</Card>
|
|
122
|
+
</ListLayout>
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Accessibility
|
|
126
|
+
- The root is a real `<form>`: Enter in a field submits it, and a `type="submit"` Button submits it.
|
|
127
|
+
- The title is the page's `h1`.
|
|
128
|
+
- Give each control a `Field`, so every input has a label.
|
|
129
|
+
|
|
130
|
+
### Props
|
|
131
|
+
### FormLayout
|
|
132
|
+
A form page: header (no header `actions`), then a `max-w-3xl` column that starts at the Container's start edge (it is not re-centred), with an `actions` row at the end. `note` is a muted line under that row, set apart from the form: a closing remark about the whole submit (when you will hear back, what happens next), never a field's hint. `error` is the submit's failure, a danger `Callout` (an alert) directly above that row. Other props go on the `<form>`. While `loading` it owns the wait and passes it to everything inside, the header too.
|
|
133
|
+
- actions: ReactNode. The row at the end of the form: its submit and cancel buttons.
|
|
134
|
+
- breadcrumbs: ReactNode. A `Breadcrumbs` above the title.
|
|
135
|
+
- description: ReactNode. The lede under the title: a `Lead`, so it outranks the body text after it.
|
|
136
|
+
- error: ReactNode. What went wrong with the whole submit (the server refused it, no connection), announced as an
|
|
137
|
+
alert directly above the `actions`. An error about one field is that `Field`'s `error`.
|
|
138
|
+
- loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
|
|
139
|
+
Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
|
|
140
|
+
- loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
|
|
141
|
+
- note: ReactNode. A muted line under the `actions`, set apart from them: a closing remark about the whole form
|
|
142
|
+
("We reply within two working days."). A note about one field is that `Field`'s `hint`.
|
|
143
|
+
- tabs: ReactNode. A `Tabs` (or similar) under the title.
|
|
144
|
+
- title: ReactNode (required). The page's `h1`.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
## FormRow
|
|
2
|
+
|
|
3
|
+
Group: Forms
|
|
4
|
+
|
|
5
|
+
When to use: `FormGrid` lays Fields out in two columns; `FormRow` puts several controls and a save button on one line.
|
|
6
|
+
|
|
7
|
+
### Use instead
|
|
8
|
+
- FormLayout (form-layout.md): The whole page is one form, with Save and Cancel at its end.
|
|
9
|
+
- Stack (stack.md): The fields run one under another in a `Card`: a `Stack as="form"` of `Field`s.
|
|
10
|
+
|
|
11
|
+
### The one right way
|
|
12
|
+
A row of controls with proportional widths, `actions` after them, and one `hint` under the whole row.
|
|
13
|
+
```tsx
|
|
14
|
+
import { Button, FormRow, FormRowField, Input } from "@slashsuite/ui-react";
|
|
15
|
+
|
|
16
|
+
<FormRow hint="Press Save to apply the change." actions={<Button>Save</Button>}>
|
|
17
|
+
<FormRowField label="Description" htmlFor="do-row-desc" span={3}>
|
|
18
|
+
<Input id="do-row-desc" defaultValue="Kitchen renovation" />
|
|
19
|
+
</FormRowField>
|
|
20
|
+
<FormRowField label="Amount" htmlFor="do-row-amount">
|
|
21
|
+
<Input id="do-row-amount" defaultValue="12,400.00" numeric />
|
|
22
|
+
</FormRowField>
|
|
23
|
+
</FormRow>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Do
|
|
27
|
+
- A form of several fields is a `FormGrid` of `Field`s: two columns once the grid is 36rem wide (its own width, so one in a `Dialog`), one below. A long control, such as a `Textarea`, takes `span="full"`.
|
|
28
|
+
- A line of controls to edit one record in place is a `FormRow` of `FormRowField`s, with the save `Button` as `actions`.
|
|
29
|
+
- `FormRowField` `span` 1 to 4 is its share of the row's width.
|
|
30
|
+
- The `hint` or `error` goes on the `FormRow`, once, under the whole line. A `FormRowField` has no hint or error, and a `Field` does not belong inside a `FormRow`.
|
|
31
|
+
- A `FormRow` inside a `FormGrid` runs across both columns.
|
|
32
|
+
|
|
33
|
+
### Don't
|
|
34
|
+
A `Field` with its own hint inside a `FormRow` makes its column taller, so the controls drift out of line and the save button with them.
|
|
35
|
+
```tsx
|
|
36
|
+
import { Button, Field, FormRow, Input } from "@slashsuite/ui-react";
|
|
37
|
+
|
|
38
|
+
<FormRow actions={<Button>Save</Button>}>
|
|
39
|
+
<Field label="Description" htmlFor="dont-row-desc" hint="Shown on the invoice.">
|
|
40
|
+
<Input id="dont-row-desc" defaultValue="Kitchen renovation" />
|
|
41
|
+
</Field>
|
|
42
|
+
<Field label="Amount" htmlFor="dont-row-amount">
|
|
43
|
+
<Input id="dont-row-amount" defaultValue="12,400.00" numeric />
|
|
44
|
+
</Field>
|
|
45
|
+
</FormRow>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Without `span="full"` a `Textarea` takes half the width and leaves a hole beside it.
|
|
49
|
+
```tsx
|
|
50
|
+
import { Field, FormGrid, Input, Textarea } from "@slashsuite/ui-react";
|
|
51
|
+
|
|
52
|
+
<FormGrid>
|
|
53
|
+
<Field label="First name" htmlFor="dont-grid-first">
|
|
54
|
+
<Input id="dont-grid-first" />
|
|
55
|
+
</Field>
|
|
56
|
+
<Field label="Last name" htmlFor="dont-grid-last">
|
|
57
|
+
<Input id="dont-grid-last" />
|
|
58
|
+
</Field>
|
|
59
|
+
<Field label="Notes" htmlFor="dont-grid-notes">
|
|
60
|
+
<Textarea id="dont-grid-notes" />
|
|
61
|
+
</Field>
|
|
62
|
+
</FormGrid>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Accessibility
|
|
66
|
+
- `FormRowField` renders a `<label>` tied to its control by `htmlFor`, as `Field` does.
|
|
67
|
+
- The row's `error` sits under its hint and is announced politely, as `Field`'s is.
|
|
68
|
+
- Narrower than 36rem (the row's own width) the fields and the action stack in reading order.
|
|
69
|
+
|
|
70
|
+
### Props
|
|
71
|
+
### FormRow
|
|
72
|
+
An inline-edit row: several controls side by side with proportional widths (`FormRowField` `span` 1 to 4), optional `actions` after them (a save button), and one `hint` or `error` line under the whole row. Every control sits on the bottom edge, so the actions line up with them whatever the labels do. Narrower than 36rem (the row's own width, not the viewport's) the fields and the actions stack. The row owns the note, so the fields beside each other keep their height: a `FormRowField` has no `hint` or `error` of its own.
|
|
73
|
+
- actions: ReactNode. A button or two after the last field. It keeps its own width.
|
|
74
|
+
- error: ReactNode. A red line under the hint, announced politely, as `Field`'s is.
|
|
75
|
+
- hint: ReactNode. One muted line under the whole row.
|
|
76
|
+
- id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
|
|
77
|
+
|
|
78
|
+
### FormRowField
|
|
79
|
+
A compact label over one control, for a `FormRow`. `span` is its share of the row (1 default). While `loading` the label is drawn and the control is a bone of its height, as in a `Field`.
|
|
80
|
+
- htmlFor: string (required). The id of the control inside; the label's htmlFor.
|
|
81
|
+
- id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
|
|
82
|
+
- label: ReactNode (required). The small label above the control.
|
|
83
|
+
- loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
|
|
84
|
+
Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
|
|
85
|
+
- loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
|
|
86
|
+
- span: 2 | 3 | 4 | 1 (default 1). The field's share of the row, 1 to 4: a `span` of 2 is twice as wide as a 1.
|
|
87
|
+
|
|
88
|
+
### FormGrid
|
|
89
|
+
Two columns of `Field`s once the grid is 36rem wide, one below that. It folds by its own width, not the viewport's, so it stays one column in a `Dialog` or a side column. A `Field` takes one column; `span="full"` runs it across both, and a `FormRow` is always full width.
|
|
90
|
+
- id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
|
|
91
|
+
|
|
92
|
+
### Types
|
|
93
|
+
- FormRowSpan: `2 | 3 | 4 | 1`. Relative widths in a `FormRow`: a field of `span` 2 is twice as wide as one of `span` 1.
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
## FullBleedLayout
|
|
2
|
+
|
|
3
|
+
Group: Page layouts
|
|
4
|
+
|
|
5
|
+
When to use: A viewer that needs the whole width, such as a snapshot, a canvas or a player; an ordinary page is not.
|
|
6
|
+
|
|
7
|
+
### The one right way
|
|
8
|
+
A viewer that needs the whole width (a snapshot, a canvas, a player) fills it, with the facts in the `aside`.
|
|
9
|
+
```tsx
|
|
10
|
+
import {
|
|
11
|
+
FullBleedLayout,
|
|
12
|
+
KeyValue,
|
|
13
|
+
KeyValueList,
|
|
14
|
+
Overline,
|
|
15
|
+
Text,
|
|
16
|
+
} from "@slashsuite/ui-react";
|
|
17
|
+
|
|
18
|
+
<FullBleedLayout
|
|
19
|
+
aside={
|
|
20
|
+
<>
|
|
21
|
+
<Overline as="h2">Snapshot</Overline>
|
|
22
|
+
<KeyValueList>
|
|
23
|
+
<KeyValue label="Story">Button / Primary</KeyValue>
|
|
24
|
+
<KeyValue label="Changed">0.4%</KeyValue>
|
|
25
|
+
</KeyValueList>
|
|
26
|
+
</>
|
|
27
|
+
}
|
|
28
|
+
>
|
|
29
|
+
<Text>The snapshot fills the width.</Text>
|
|
30
|
+
</FullBleedLayout>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Full page
|
|
34
|
+
A whole viewer page: the shell with `bleed`, then the layout with the viewer in `children` and the facts in `aside`. The `EmptyState` stands in for the app's own viewer.
|
|
35
|
+
```tsx
|
|
36
|
+
import {
|
|
37
|
+
AppShell,
|
|
38
|
+
EmptyState,
|
|
39
|
+
FullBleedLayout,
|
|
40
|
+
KeyValue,
|
|
41
|
+
KeyValueList,
|
|
42
|
+
Tabs,
|
|
43
|
+
Overline,
|
|
44
|
+
Text,
|
|
45
|
+
} from "@slashsuite/ui-react";
|
|
46
|
+
|
|
47
|
+
<AppShell
|
|
48
|
+
brand={<a href="#">Hack Cove</a>}
|
|
49
|
+
nav={
|
|
50
|
+
<Tabs
|
|
51
|
+
label="Main"
|
|
52
|
+
items={[
|
|
53
|
+
{ label: "Quotes", href: "#quotes", selected: true },
|
|
54
|
+
{ label: "Clients", href: "#clients" },
|
|
55
|
+
]}
|
|
56
|
+
/>
|
|
57
|
+
}
|
|
58
|
+
bleed
|
|
59
|
+
>
|
|
60
|
+
<FullBleedLayout
|
|
61
|
+
aside={
|
|
62
|
+
<>
|
|
63
|
+
<Overline as="h2">Snapshot</Overline>
|
|
64
|
+
<KeyValueList>
|
|
65
|
+
<KeyValue label="Story">Button / Primary</KeyValue>
|
|
66
|
+
<KeyValue label="Changed">0.4%</KeyValue>
|
|
67
|
+
</KeyValueList>
|
|
68
|
+
</>
|
|
69
|
+
}
|
|
70
|
+
>
|
|
71
|
+
<EmptyState title="Snapshot viewer">
|
|
72
|
+
<Text>Your viewer goes here and fills the width.</Text>
|
|
73
|
+
</EmptyState>
|
|
74
|
+
</FullBleedLayout>
|
|
75
|
+
</AppShell>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Do
|
|
79
|
+
- Render it in an `AppShell` with `bleed`; the canvas starts at the viewport's start edge.
|
|
80
|
+
- It adds no padding and has no page title; the canvas is the `children`. Set `padded` when the body is not a viewer and should have the other layouts' page padding.
|
|
81
|
+
- Put the facts about what is shown in `aside`, a `KeyValueList` under an `Overline`. From `lg` the aside is a fixed-width column at the end; below it, it stacks under the canvas.
|
|
82
|
+
- Omit `aside` when the canvas stands alone.
|
|
83
|
+
- `asideLabel` names the aside's landmark. Set it when the page has another complementary landmark.
|
|
84
|
+
- `bar` is a full-width row above the canvas and the panel, such as a viewer's title and its actions in a `Cluster justify="between"`. It is a `StickyBar`: it sticks under the shell's header as the page scrolls; `padded` does not pad it.
|
|
85
|
+
- A page with a title and content is `ListLayout` or `DetailLayout`.
|
|
86
|
+
|
|
87
|
+
### Don't
|
|
88
|
+
`FullBleedLayout` adds no padding unless `padded`, so an ordinary page lands on the screen edge. A page with a title is a `ListLayout` or `DetailLayout`.
|
|
89
|
+
```tsx
|
|
90
|
+
import { Card, FullBleedLayout, Text } from "@slashsuite/ui-react";
|
|
91
|
+
|
|
92
|
+
<FullBleedLayout>
|
|
93
|
+
<Card title="Quotes">
|
|
94
|
+
<Text>Every quote you have sent.</Text>
|
|
95
|
+
</Card>
|
|
96
|
+
</FullBleedLayout>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Accessibility
|
|
100
|
+
- The `aside` is an `<aside>`, a complementary landmark; give it a heading with `Overline as="h2"`, or name it with `asideLabel`.
|
|
101
|
+
- The canvas comes first in the DOM, then the panel.
|
|
102
|
+
|
|
103
|
+
### Props
|
|
104
|
+
### FullBleedLayout
|
|
105
|
+
Edge-to-edge `children` with an optional `aside` at the end (`lg:w-72`) that stacks below on a smaller screen. Render it in `<AppShell bleed>`. It deliberately breaks the shared start edge: a viewer that needs the whole width has no Container of its own, so `children` start at the viewport's start edge. `padded` gives them the Container's padding instead (`px-4`, `sm:px-6`, `py-8`), for a page of ordinary content beside a full-height `aside`. A `bar` is a `StickyBar` above both: the full width, on the surface with a bottom line, sticking under AppShell's header as the page scrolls. While `loading` it owns the wait and passes it to everything inside, the header too.
|
|
106
|
+
- aside: ReactNode. A side column on the right (`lg:w-72`) on a tinted surface; below `lg` it stacks under `children`.
|
|
107
|
+
- asideLabel: string. Names the `<aside>` landmark (`aria-label`). Left out, it is unnamed.
|
|
108
|
+
- bar: ReactNode. A full-width row above `children` and `aside` that sticks under the header, e.g. a viewer's title and actions. `padded` does not pad it.
|
|
109
|
+
- id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
|
|
110
|
+
- loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
|
|
111
|
+
Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
|
|
112
|
+
- loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
|
|
113
|
+
- padded: boolean (default false). Pads `children` as the Container pads every other page. Off, they run to the viewport's edges.
|
|
114
|
+
A notice in the column is a plain `Callout` in a `Stack`, never a `Callout banner`.
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
## Headings
|
|
2
|
+
|
|
3
|
+
Group: Text
|
|
4
|
+
|
|
5
|
+
When to use: Any title on a page: the public headline, the page title, a section, a subsection.
|
|
6
|
+
|
|
7
|
+
### The one right way
|
|
8
|
+
One `PageHeading` names the page, `SectionHeading` its parts and `SubsectionHeading` what is inside a part.
|
|
9
|
+
```tsx
|
|
10
|
+
import {
|
|
11
|
+
PageHeading,
|
|
12
|
+
SectionHeading,
|
|
13
|
+
Stack,
|
|
14
|
+
SubsectionHeading,
|
|
15
|
+
Text,
|
|
16
|
+
} from "@slashsuite/ui-react";
|
|
17
|
+
|
|
18
|
+
<Stack gap="sm">
|
|
19
|
+
<PageHeading>Quotes</PageHeading>
|
|
20
|
+
<SectionHeading rule>Open</SectionHeading>
|
|
21
|
+
<SubsectionHeading>Awaiting reply</SubsectionHeading>
|
|
22
|
+
<Text>Three quotes are waiting on the customer.</Text>
|
|
23
|
+
</Stack>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Do
|
|
27
|
+
- A page has one title: `PageHeading` for an app page, `Display` for the headline of a public page. A `PageHeader` already draws the `PageHeading` and its `description`, so use it for the top of a page.
|
|
28
|
+
- Name the parts of a page with `SectionHeading`; `rule` puts the hairline under it, with the space either side built in.
|
|
29
|
+
- Name what is inside a part with `SubsectionHeading`: `size` `sm` is a form-group caption, `md` (default) a card title in a header bar, `lg` a drawer title. `lines={1}` cuts one that is too long for its column to a single line.
|
|
30
|
+
- Put a `Lead` under a `Display`, and a `Text` under any other heading. `Dialog` and `Drawer` draw their own title from their `title`.
|
|
31
|
+
- Pick the heading for its place in the outline, never for its size. `Display` is not a big `SectionHeading`.
|
|
32
|
+
- Each heading has its own fixed ink and takes no colour. A heading's meaning is carried by its words, not a colour.
|
|
33
|
+
- `as` changes the element, only to keep the outline in order, and never the look.
|
|
34
|
+
- `description` on a `SectionHeading` is a muted line under it that says more; it is not part of the heading's name.
|
|
35
|
+
|
|
36
|
+
### Don't
|
|
37
|
+
`PageHeading` is an `h1`, and a page has one. A second one for a section breaks the outline: use `SectionHeading`.
|
|
38
|
+
```tsx
|
|
39
|
+
import { PageHeading, Stack, Text } from "@slashsuite/ui-react";
|
|
40
|
+
|
|
41
|
+
<Stack gap="sm">
|
|
42
|
+
<PageHeading>Quotes</PageHeading>
|
|
43
|
+
<Text>Three quotes are waiting on the customer.</Text>
|
|
44
|
+
<PageHeading>Open</PageHeading>
|
|
45
|
+
<Text>Two quotes are open.</Text>
|
|
46
|
+
</Stack>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
`Display` is marketing scale, not a section title: inside a page it dwarfs everything around it. Use `SectionHeading`.
|
|
50
|
+
```tsx
|
|
51
|
+
import { Display, PageHeading, Stack, Text } from "@slashsuite/ui-react";
|
|
52
|
+
|
|
53
|
+
<Stack gap="sm">
|
|
54
|
+
<PageHeading>Dashboard</PageHeading>
|
|
55
|
+
<Display as="h2">Recent activity</Display>
|
|
56
|
+
<Text>Nothing has changed since yesterday.</Text>
|
|
57
|
+
</Stack>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Accessibility
|
|
61
|
+
- Each heading renders a real heading element: `Display` and `PageHeading` an `h1`, `SectionHeading` an `h2`, `SubsectionHeading` an `h3`.
|
|
62
|
+
- `as` swaps the element and keeps the look, so the outline can follow the page without a visual change.
|
|
63
|
+
- `id`, `aria-*` and `data-*` go on the heading element.
|
|
64
|
+
- `Dialog` and `Drawer` draw their title as a `SectionHeading` and name themselves by it; an `EmptyState` does the same.
|
|
65
|
+
|
|
66
|
+
### Props
|
|
67
|
+
### Display
|
|
68
|
+
Marketing-scale headline: the one line at the top of a public page. `h1`, text-4xl/tight semibold, primary text, growing to text-6xl on wider screens. `PageHeading` is the title of an ordinary page, a step below; a brochure hero needs a display scale, so it gets its own pinned role rather than callers overriding PageHeading's size.
|
|
69
|
+
- as: ElementType. The element to render; each role has a semantic default.
|
|
70
|
+
- id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
|
|
71
|
+
- loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
|
|
72
|
+
Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
|
|
73
|
+
- loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
|
|
74
|
+
|
|
75
|
+
### PageHeading
|
|
76
|
+
Page title. `h1`, text-3xl/9 bold (text-4xl/10 from `sm`), tight, primary text: well above the `Lead` under it and the body text after it, so the page's title reads first.
|
|
77
|
+
- as: ElementType. The element to render; each role has a semantic default.
|
|
78
|
+
- id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
|
|
79
|
+
- loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
|
|
80
|
+
Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
|
|
81
|
+
- loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
|
|
82
|
+
|
|
83
|
+
### SectionHeading
|
|
84
|
+
Top-level section header. `h2`, text-xl/7 semibold, primary text (text-base/6 under an `AppShell density="compact"`, text-2xl/8 semibold tight inside a `Prose`). `rule` sets a hairline under it (the `Divider` line colour) with the space either side of the line built in. `description` is a muted line under the heading, outside the `<h2>`, so the heading's name stays the title; the rule then sits under the description.
|
|
85
|
+
- as: ElementType. The element to render; each role has a semantic default.
|
|
86
|
+
- description: ReactNode. A muted line under the heading that says more. It is a paragraph beside the heading, not part of its name.
|
|
87
|
+
- id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
|
|
88
|
+
- loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
|
|
89
|
+
Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
|
|
90
|
+
- loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
|
|
91
|
+
- rule: boolean. A hairline under the heading, with the space either side of it built in.
|
|
92
|
+
|
|
93
|
+
### SubsectionHeading
|
|
94
|
+
Nested header. `h3`, text-lg/7 semibold, primary text. `size` steps it down to `sm` (text-base, body size set apart by its weight) for a form-group caption or a dense card, or up to `lg` (text-xl) for a drawer title; `md` is the default. Under an `AppShell density="compact"` each is one step down. Inside a `Prose` `md` is text-xl/7 (the h3 of a doc), `sm` text-base/7 (the h4: body size, set apart by its weight) and `lg` text-2xl/8, the size of a `SectionHeading` there. `lines={1}` keeps it on one line and cuts it with an ellipsis where its container ends, the full text as the `title`.
|
|
95
|
+
- as: ElementType. The element to render; each role has a semantic default.
|
|
96
|
+
- id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
|
|
97
|
+
- lines: 2 | 3 | 4 | 1. Show at most this many lines (1 to 4) and end in an ellipsis, as on `Text`: `1` cuts the
|
|
98
|
+
heading where its container ends. With plain-text content the full text becomes the `title`.
|
|
99
|
+
- loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
|
|
100
|
+
Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
|
|
101
|
+
- loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
|
|
102
|
+
- size: "sm" | "md" | "lg" (default md). The heading's type size: `sm` is text-base/6, `md` text-lg/7 and `lg` text-xl/7 (one step down
|
|
103
|
+
each under an `AppShell density="compact"`).
|
|
104
|
+
|
|
105
|
+
### Types
|
|
106
|
+
- HeadingLevel: `2 | 3 | 4 | 5 | 6`. A heading level below the page's own `h1`.
|
|
107
|
+
- SubsectionHeadingSize: `"sm" | "md" | "lg"`. A SubsectionHeading's type size: `sm` a form-group caption, `md` a card title, `lg` a drawer title.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
## Hero
|
|
2
|
+
|
|
3
|
+
Group: Layout
|
|
4
|
+
|
|
5
|
+
When to use: The first block of a site's landing page, and nowhere else: every other page opens with a `PageHeader`.
|
|
6
|
+
|
|
7
|
+
### The one right way
|
|
8
|
+
A landing page opens with one `Hero`: the overline, the title and the lede, over the theme's glow.
|
|
9
|
+
```tsx
|
|
10
|
+
import { Hero, Lead } from "@slashsuite/ui-react";
|
|
11
|
+
|
|
12
|
+
<Hero overline="Products" title="Software we make.">
|
|
13
|
+
<Lead>A component library and the tools we build it with.</Lead>
|
|
14
|
+
</Hero>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Do
|
|
18
|
+
- One `Hero` per page, and only on the landing page: it is the page's top block. Inner pages use `PageHeader`.
|
|
19
|
+
- Pass `title` and, if it has one, `overline`; put a `Lead` in `children`, then the page's first actions in a `Cluster` if there are any: a primary `Button` and an `outline` or `ghost` one in the default tone, or a `TextLink`. That is the text the theme's contrast check holds over the glow.
|
|
20
|
+
- The glow is always on. Its colours and its strength are the theme's, so a paper theme keeps it faint.
|
|
21
|
+
- It caps itself at a reading measure at the parent's start edge, and the glow is clipped to it, so a phone never scrolls sideways. Put it as the first child of the page's `Stack`.
|
|
22
|
+
- A product page passes its picture as `media`: an `Image` at `width="full"`, beside the words from `md` up and under them on a phone.
|
|
23
|
+
- A landing page with no picture and one or two actions may set `align="center"`, with its actions' `Cluster` at `justify="center"`.
|
|
24
|
+
|
|
25
|
+
### Don't
|
|
26
|
+
- Never build the block from an `Overline`, a `Display` and a `Lead` by hand: the hand-built one has no glow and drifts from the one top block.
|
|
27
|
+
|
|
28
|
+
An overline, a `Display` and a `Lead` put together by hand drift from the one top block, and have no glow. Use `Hero`.
|
|
29
|
+
```tsx
|
|
30
|
+
import { Display, Lead, Overline, Stack } from "@slashsuite/ui-react";
|
|
31
|
+
|
|
32
|
+
<Stack gap="sm" width="narrow">
|
|
33
|
+
<header>
|
|
34
|
+
<Overline mono>Products</Overline>
|
|
35
|
+
<Display>Software we make.</Display>
|
|
36
|
+
</header>
|
|
37
|
+
<Lead>A component library and the tools we build it with.</Lead>
|
|
38
|
+
</Stack>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
A `Hero` on an inner page shouts over the content it heads. Use `PageHeader`.
|
|
42
|
+
```tsx
|
|
43
|
+
import { Hero, Lead } from "@slashsuite/ui-react";
|
|
44
|
+
|
|
45
|
+
<Hero title="Members">
|
|
46
|
+
<Lead>Who can see this project.</Lead>
|
|
47
|
+
</Hero>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Accessibility
|
|
51
|
+
- The title is the page's `<h1>`, in a `<header>` with the overline.
|
|
52
|
+
- The glow is `aria-hidden="true"` and takes no pointer; the text sits above it and holds AA contrast over it in every theme.
|
|
53
|
+
- The glow drifts only under `prefers-reduced-motion: no-preference`; with reduced motion it stands still. It is plain markup and CSS, so it renders on the server and needs no script.
|
|
54
|
+
- The drift never ends on its own, so a checkbox in the hero's top corner, named by `pauseLabel` (Pause the background motion), holds it still. It is a native checkbox, reached by Tab and toggled by Space, and is not drawn under reduced motion.
|
|
55
|
+
|
|
56
|
+
### Props
|
|
57
|
+
### Hero
|
|
58
|
+
A landing page's top block: an overline, the display title (the page's `h1`) and the lede under it, over a soft glow of three tilted ribbons that drift slowly behind the text. The glow is always there and its colours and strength are the theme's (the palette's `glow` role), so a paper theme keeps it faint. It is anchored to the text's own column (`max-w-3xl`, at the parent's start edge, or in its middle with `align="center"`), never the viewport, and clipped to it, so nothing scrolls sideways on a phone. It is `aria-hidden`, and the text sits above it. `media` puts a picture beside the words from `md` up. A small checkbox in the top corner holds the drift still, since it never ends on its own; under `prefers-reduced-motion: reduce` the glow stands still and the checkbox is not drawn. Pure markup and one inline stylesheet: it works rendered on the server with no script. One per page, on a landing page; every other page opens with a `PageHeader`.
|
|
59
|
+
- align: "center" | "start" (default start). `center` sets the words in the middle of the page, under a centred glow: a landing page
|
|
60
|
+
with no picture whose actions are one or two buttons. Pass the actions' `Cluster`
|
|
61
|
+
`justify="center"` too.
|
|
62
|
+
- children: ReactNode. What follows the title: a `Lead`, and the page's first actions if it has any.
|
|
63
|
+
- id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
|
|
64
|
+
- media: ReactNode. A picture beside the words from `md` up, and under them on a phone: an `Image` of the
|
|
65
|
+
product, at `width="full"`. The words keep the glow; the picture sits clear of it.
|
|
66
|
+
- overline: ReactNode. The small label above the title, set in the monospace face.
|
|
67
|
+
- pauseLabel: string (default Pause the background motion). The name of the control that holds the glow still, for an app in another language.
|
|
68
|
+
- title: ReactNode (required). The page's `h1`, at display size.
|