@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,74 @@
|
|
|
1
|
+
## Steps
|
|
2
|
+
|
|
3
|
+
Group: Content
|
|
4
|
+
|
|
5
|
+
When to use: The way into a product: install, log in, run.
|
|
6
|
+
|
|
7
|
+
### Use instead
|
|
8
|
+
- BulletList (bullet-list.md): The items have no order.
|
|
9
|
+
- Timeline (timeline.md): The items already happened: a history, each with its time.
|
|
10
|
+
|
|
11
|
+
### The one right way
|
|
12
|
+
`Steps` numbers itself: give each `Step` a `title` and a line of detail, in the order they are done.
|
|
13
|
+
```tsx
|
|
14
|
+
import { Code, Step, Steps } from "@slashsuite/ui-react";
|
|
15
|
+
|
|
16
|
+
<Steps aria-label="Get started">
|
|
17
|
+
<Step title="Install the CLI">
|
|
18
|
+
Run <Code>bun add -d pixelslash</Code> in your repo.
|
|
19
|
+
</Step>
|
|
20
|
+
<Step title="Upload a build">
|
|
21
|
+
Run <Code>pixelslash upload</Code>.
|
|
22
|
+
</Step>
|
|
23
|
+
</Steps>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Do
|
|
27
|
+
- Give each `Step` a `title` and, as its children, one line of detail. A step with only a `title` is fine.
|
|
28
|
+
- For things done in order only. Nothing here is done or current, so it is not a progress indicator.
|
|
29
|
+
- A list with no order is a `BulletList`.
|
|
30
|
+
- In an empty view, put `Steps` inside the `EmptyState` as the "get started" list.
|
|
31
|
+
- `size="lg"` is a landing page's way in: two to four steps side by side from `md`, each number at feature size, stacked on a phone. `Step` takes its size from its `Steps`.
|
|
32
|
+
|
|
33
|
+
### Don't
|
|
34
|
+
- Do not type the numbers: `Steps` counts them, so a step can sit behind a condition and the rest still run 1, 2, 3.
|
|
35
|
+
|
|
36
|
+
Typed numbers double up with the ones `Steps` draws, and drift when a step is added. Leave the numbering to `Steps`.
|
|
37
|
+
```tsx
|
|
38
|
+
import { Step, Steps } from "@slashsuite/ui-react";
|
|
39
|
+
|
|
40
|
+
<Steps aria-label="Get started">
|
|
41
|
+
<Step title="1. Install the CLI">Run bun add -d pixelslash in your repo.</Step>
|
|
42
|
+
<Step title="2. Upload a build">Run pixelslash upload.</Step>
|
|
43
|
+
</Steps>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Numbering features that have no order tells the reader there is a sequence to follow. Use a `BulletList`.
|
|
47
|
+
```tsx
|
|
48
|
+
import { Step, Steps } from "@slashsuite/ui-react";
|
|
49
|
+
|
|
50
|
+
<Steps>
|
|
51
|
+
<Step title="Light and dark themes" />
|
|
52
|
+
<Step title="Keyboard shortcuts" />
|
|
53
|
+
<Step title="Email digests" />
|
|
54
|
+
</Steps>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Accessibility
|
|
58
|
+
- `Steps` is an `<ol role="list">` and each `Step` an `<li>`, so a screen reader announces the list and each step's position.
|
|
59
|
+
- The drawn number is `aria-hidden`, so it is not read twice.
|
|
60
|
+
- Name the list with `aria-label`.
|
|
61
|
+
|
|
62
|
+
### Props
|
|
63
|
+
### Steps
|
|
64
|
+
A numbered list of things to do, in order: a `title` and, under it, a line of `children`. The numbers are counted by CSS, so `Step`s can sit in a fragment or behind a condition and still run 1, 2, 3. For the way into a product ("install, log in, run"), not for progress: nothing here is done or current. A wizard's progress indicator is a different part. `size="lg"` is the steps across a landing page: from `md` they sit side by side in equal columns, each number at feature size over a large title; below `md` they stack. Use it for two to four steps.
|
|
65
|
+
- id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
|
|
66
|
+
- size: "md" | "lg" (default md). `md` a small list down a column; `lg` the steps across a landing page from `md` (two to four).
|
|
67
|
+
|
|
68
|
+
### Step
|
|
69
|
+
One step of `Steps`: a `title` and the `children` as the detail under it, at its `Steps`' size.
|
|
70
|
+
- id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
|
|
71
|
+
- title: ReactNode (required). What to do; `children` is the detail under it.
|
|
72
|
+
|
|
73
|
+
### Types
|
|
74
|
+
- StepsSize: `"md" | "lg"`. A `Steps` scale: `md` the small list down a column, `lg` the steps across a landing page.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
## StickyBar
|
|
2
|
+
|
|
3
|
+
Group: Layout
|
|
4
|
+
|
|
5
|
+
When to use: A page's filters or bulk actions that must stay in reach while a long `bleed` page scrolls.
|
|
6
|
+
|
|
7
|
+
### The one right way
|
|
8
|
+
The page's filters and its bulk action go in one `StickyBar`, so they stay in reach under the header as the list scrolls.
|
|
9
|
+
```tsx
|
|
10
|
+
import { Button, Cluster, Input, StickyBar } from "@slashsuite/ui-react";
|
|
11
|
+
|
|
12
|
+
<StickyBar>
|
|
13
|
+
<Cluster justify="between">
|
|
14
|
+
<Input aria-label="Filter builds" placeholder="Filter builds" width="auto" />
|
|
15
|
+
<Button size="sm" variant="outline">
|
|
16
|
+
Accept all
|
|
17
|
+
</Button>
|
|
18
|
+
</Cluster>
|
|
19
|
+
</StickyBar>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Do
|
|
23
|
+
- Put it first in an `AppShell bleed` page; it spans its parent and sticks just under the shell's header as the page scrolls.
|
|
24
|
+
- It draws the surface, the bottom line and the padding; its `children` are the row, such as a `Cluster justify="between"` of filters and an action.
|
|
25
|
+
- `FullBleedLayout`'s `bar` is a `StickyBar`; with that layout, pass the row as `bar` instead.
|
|
26
|
+
- Write no `sticky` row of your own.
|
|
27
|
+
|
|
28
|
+
### Don't
|
|
29
|
+
Filters in a `Card` at the top of the page scroll away with it, so the action is out of reach halfway down a long list. Use `StickyBar`.
|
|
30
|
+
```tsx
|
|
31
|
+
import { Button, Card, Cluster, Input } from "@slashsuite/ui-react";
|
|
32
|
+
|
|
33
|
+
<Card>
|
|
34
|
+
<Cluster justify="between">
|
|
35
|
+
<Input aria-label="Filter builds" placeholder="Filter builds" width="auto" />
|
|
36
|
+
<Button size="sm" variant="outline">
|
|
37
|
+
Accept all
|
|
38
|
+
</Button>
|
|
39
|
+
</Cluster>
|
|
40
|
+
</Card>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Accessibility
|
|
44
|
+
- It is a plain `<div>`, not a landmark; it sits in the page's `<main>` and its controls keep their own names.
|
|
45
|
+
- `aria-*` and `data-*` props go on the root element.
|
|
46
|
+
|
|
47
|
+
### Props
|
|
48
|
+
### StickyBar
|
|
49
|
+
A full-width row that sticks under AppShell's header as the page scrolls: a filter or actions bar, or a viewer's title and its actions. It sits on the surface with a bottom line and pads its content as the Container pads a page. Put a `Cluster` in it for the row's layout. It spans its parent, so it belongs at the top of an `AppShell bleed` page; `FullBleedLayout`'s `bar` is one.
|
|
50
|
+
- children: ReactNode (required). The bar's content, usually one `Cluster` (`justify="between"` for a title and its actions).
|
|
51
|
+
- id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
## Switch
|
|
2
|
+
|
|
3
|
+
Group: Forms
|
|
4
|
+
|
|
5
|
+
When to use: A setting that acts the moment it is flipped, usually by saving it to a server: a flag per environment, notifications on or off.
|
|
6
|
+
|
|
7
|
+
### The one right way
|
|
8
|
+
A Switch takes a `label`: the whole label is the click target, and it names the switch.
|
|
9
|
+
```tsx
|
|
10
|
+
import { useState } from "react";
|
|
11
|
+
import { Switch } from "@slashsuite/ui-react";
|
|
12
|
+
|
|
13
|
+
function Example() {
|
|
14
|
+
const [checked, setChecked] = useState(true);
|
|
15
|
+
return <Switch label="Live in staging" checked={checked} onChange={setChecked} />;
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Do
|
|
20
|
+
- Control it: you own `checked`, and `onChange` gets the next value. There is no uncontrolled mode.
|
|
21
|
+
- Give a `Switch` a `label`; the whole label is the click target. In a table cell leave the `label` out, use `size="sm"` and name it with `aria-label`: one of the two is required.
|
|
22
|
+
- Keep `checked` as it was while the change saves and pass `busy`: a click or a key does nothing, and it keeps its colour and its focus. Flip `checked` when the save lands.
|
|
23
|
+
- A `hint` is a muted line under the label for a setting that needs a sentence, and an `error` goes under it in red; the switch sits on the label's first line.
|
|
24
|
+
- `size` is `sm`, `md` (default) or `lg`, the same scale as a `Checkbox`.
|
|
25
|
+
- Say why it cannot flip with `disabledReason`.
|
|
26
|
+
- A value sent with a form, ticked and then submitted, is a `Checkbox`. One of several is a `RadioGroup`, a `Select` or a `SegmentedControl`.
|
|
27
|
+
|
|
28
|
+
### Don't
|
|
29
|
+
- Do not wrap a `Switch` in a `Field`; it is its own label.
|
|
30
|
+
|
|
31
|
+
Words beside the switch, not in it, name nothing: clicking the words does nothing.
|
|
32
|
+
```tsx
|
|
33
|
+
import { useState } from "react";
|
|
34
|
+
import { Cluster, Switch, Text } from "@slashsuite/ui-react";
|
|
35
|
+
|
|
36
|
+
function Example() {
|
|
37
|
+
const [checked, setChecked] = useState(true);
|
|
38
|
+
return (
|
|
39
|
+
<Cluster gap="sm">
|
|
40
|
+
<Switch aria-label="Live in staging" checked={checked} onChange={setChecked} />
|
|
41
|
+
<Text>Live in staging</Text>
|
|
42
|
+
</Cluster>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
A bare `disabled` switch drops out of the tab order and never says why.
|
|
48
|
+
```tsx
|
|
49
|
+
import { Switch } from "@slashsuite/ui-react";
|
|
50
|
+
|
|
51
|
+
<Switch label="Live in production" checked={false} onChange={() => undefined} disabled />
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Accessibility
|
|
55
|
+
- A native `<button type="button" role="switch">` with `aria-checked`, inside a `<label>`, so clicking the text flips it and the label is its name. Space and Enter flip it.
|
|
56
|
+
- A bare switch has no name of its own: `aria-label` is required.
|
|
57
|
+
- `busy` sets `aria-busy` and `aria-disabled` and keeps focus on the switch; `disabled` is the native one and takes it out of the tab order.
|
|
58
|
+
- `disabledReason` sets `aria-disabled` and keeps the switch in the tab order; a click, Space and Enter do nothing, and the reason shows as a tooltip on hover, keyboard focus and a tap, read out as its description (the native `title` without CSS anchor positioning).
|
|
59
|
+
- A `hint` and an `error` are the switch's `aria-describedby`, added to any you pass; an `error` is announced politely, not as an alert, and marks the switch `aria-invalid`.
|
|
60
|
+
- The thumb's slide stops under `prefers-reduced-motion`. The focus ring comes from the component.
|
|
61
|
+
|
|
62
|
+
### Props
|
|
63
|
+
### Switch
|
|
64
|
+
An on/off switch for a setting that takes effect at once, usually by saving it to a server: a native `<button role="switch" aria-checked>`. The caller owns `checked` and flips it in `onChange`, or gives `defaultChecked` and the switch keeps its own state. A value sent with a form is a `Checkbox`, not a Switch. Give it a `label` (the whole label is the click target), or in a table cell leave the label out and name it with `aria-label`. `hint` is a muted line under the label; `error` adds a red line under it, with an alert icon, and makes the switch `aria-invalid` and red-edged. The note is the switch's `aria-describedby`. `size` is `sm`, `md` (the default) or `lg`. `busy` is for the save in flight: clicks and keys do nothing, and the switch keeps its colour and its focus. `disabledReason` blocks it, focusable, with the reason as its tooltip. `disabled` is the native one, washed out. While `loading` the label is drawn and the track is a bone of its size.
|
|
65
|
+
- busy: boolean. The change is being saved: `aria-busy`, and a click or a key does nothing. It keeps its colour
|
|
66
|
+
and its focus, which a native `disabled` would lose when the save starts.
|
|
67
|
+
- checked: boolean. Whether it is on, when the caller owns it (with `onChange`).
|
|
68
|
+
- defaultChecked: boolean. Whether it starts on, when the switch keeps its own state.
|
|
69
|
+
- disabledReason: string. Why the switch cannot be flipped: it washes out and is blocked (`aria-disabled`; a click,
|
|
70
|
+
Enter and Space do nothing) while it keeps its focus, and the reason is its tooltip on hover,
|
|
71
|
+
keyboard focus and a tap, read out as its description.
|
|
72
|
+
- error: ReactNode. A red line under the hint, with an alert icon, announced politely; makes the switch `aria-invalid`.
|
|
73
|
+
- hint: ReactNode. A muted line under the label that says more. It is the switch's `aria-describedby`.
|
|
74
|
+
- label: NonNullable<ReactNode>. The text beside the switch; the whole label is a click target.
|
|
75
|
+
- loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
|
|
76
|
+
Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
|
|
77
|
+
- loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
|
|
78
|
+
- onChange: ((checked: boolean) => void). Called with the next value when the person flips it. Not called while `busy`.
|
|
79
|
+
- size: "sm" | "md" | "lg" (default md). The label's text size and the switch with it.
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
## TableOfContents
|
|
2
|
+
|
|
3
|
+
Group: Navigation
|
|
4
|
+
|
|
5
|
+
When to use: A long page of several sections, such as a guide or a reference, where a reader jumps to a section or checks where they are.
|
|
6
|
+
|
|
7
|
+
### Use instead
|
|
8
|
+
- Breadcrumbs (breadcrumbs.md): The reader needs the way back up to a parent page.
|
|
9
|
+
|
|
10
|
+
### The one right way
|
|
11
|
+
The app tracks the section being read and passes it as `current`, so the reader sees where they are.
|
|
12
|
+
```tsx
|
|
13
|
+
import { TableOfContents } from "@slashsuite/ui-react";
|
|
14
|
+
|
|
15
|
+
<TableOfContents
|
|
16
|
+
items={[
|
|
17
|
+
{ id: "install", label: "Install", level: 2 },
|
|
18
|
+
{ id: "with-bun", label: "With Bun", level: 3 },
|
|
19
|
+
{ id: "with-npm", label: "With npm", level: 3 },
|
|
20
|
+
{ id: "usage", label: "Usage", level: 2 },
|
|
21
|
+
{ id: "themes", label: "Themes", level: 2 },
|
|
22
|
+
]}
|
|
23
|
+
current="with-bun"
|
|
24
|
+
/>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Do
|
|
28
|
+
- Give `items` the page's `h2`s and `h3`s in order, each `{ id, label, level }`: `id` is the heading's anchor and `label` its words. A level 3 entry is indented under the entry before it.
|
|
29
|
+
- `current` is the id of the section being read. The app tracks it, from the scroll position or the URL hash, and its link is marked in the accent; the rest are small and quiet.
|
|
30
|
+
- `label` is the words over the list and the name of its landmark, "On this page" by default; set it for an app in another language.
|
|
31
|
+
- Put it in a sticky `SideColumn` aside beside the page. `DocsLayout` draws its own, so a docs page passes its headings to the layout instead.
|
|
32
|
+
|
|
33
|
+
### Don't
|
|
34
|
+
- Never list links to other pages in it: those are `Tabs` of links or a `SidebarLayout` rail.
|
|
35
|
+
|
|
36
|
+
With no `current` every entry looks the same, and a reader halfway down a long page cannot tell where they are.
|
|
37
|
+
```tsx
|
|
38
|
+
import { TableOfContents } from "@slashsuite/ui-react";
|
|
39
|
+
|
|
40
|
+
<TableOfContents
|
|
41
|
+
items={[
|
|
42
|
+
{ id: "install", label: "Install", level: 2 },
|
|
43
|
+
{ id: "with-bun", label: "With Bun", level: 3 },
|
|
44
|
+
{ id: "with-npm", label: "With npm", level: 3 },
|
|
45
|
+
{ id: "usage", label: "Usage", level: 2 },
|
|
46
|
+
{ id: "themes", label: "Themes", level: 2 },
|
|
47
|
+
]}
|
|
48
|
+
/>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
A label that is not the heading's words sends the reader to a section they do not recognise when they land.
|
|
52
|
+
```tsx
|
|
53
|
+
import { TableOfContents } from "@slashsuite/ui-react";
|
|
54
|
+
|
|
55
|
+
<TableOfContents
|
|
56
|
+
items={[
|
|
57
|
+
{ id: "install", label: "How to get the package into your project", level: 2 },
|
|
58
|
+
{ id: "usage", label: "Some notes on using it", level: 2 },
|
|
59
|
+
{ id: "themes", label: "Colours", level: 2 },
|
|
60
|
+
]}
|
|
61
|
+
current="usage"
|
|
62
|
+
/>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Accessibility
|
|
66
|
+
- A `<nav>` named by `label`, around a list of links to `#id`. The current one has `aria-current="location"`.
|
|
67
|
+
- The current link is told apart by more than colour: it is medium weight.
|
|
68
|
+
|
|
69
|
+
### Props
|
|
70
|
+
### TableOfContents
|
|
71
|
+
The headings of a long page, as links to their anchors: "On this page". `items` are the page's `h2`s and `h3`s in order, each `{ id, label, level }`; a level 3 entry is indented under the one before it. `current` is the id of the section being read, which the app tracks (from the scroll position or the URL hash): its link is marked in the accent and has `aria-current="location"`. The rest are small and quiet. `label` names the list and the `<nav>` landmark. It sets no width or position: put it in a `SideColumn`'s aside, sticky, beside the page. `DocsLayout` draws its own.
|
|
72
|
+
- current: string. The id of the section being read; its link is marked as the current one.
|
|
73
|
+
- id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
|
|
74
|
+
- items: TableOfContentsItem[] (required). The page's headings in order: `{ id, label, level }`, `level` 2 or 3.
|
|
75
|
+
- label: string (default On this page). The words over the list, and the name of the `<nav>` landmark.
|
|
76
|
+
|
|
77
|
+
### Types
|
|
78
|
+
- TableOfContentsItem: `{ id: string; label: string; level: 2 | 3 }`. One entry of a `TableOfContents`: the heading's `id` (its anchor), its words, and its level.
|