@slashsuite/ui-react 0.12.0 → 0.12.1

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.
Files changed (96) hide show
  1. package/README.md +12 -0
  2. package/agent-docs/components/app-shell.md +136 -0
  3. package/agent-docs/components/avatar-stack.md +64 -0
  4. package/agent-docs/components/avatar.md +76 -0
  5. package/agent-docs/components/badge.md +61 -0
  6. package/agent-docs/components/body-text.md +158 -0
  7. package/agent-docs/components/bottom-sheet.md +95 -0
  8. package/agent-docs/components/breadcrumbs.md +62 -0
  9. package/agent-docs/components/bullet-list.md +54 -0
  10. package/agent-docs/components/button.md +135 -0
  11. package/agent-docs/components/callout.md +86 -0
  12. package/agent-docs/components/card-grid.md +108 -0
  13. package/agent-docs/components/card.md +113 -0
  14. package/agent-docs/components/centered-layout.md +90 -0
  15. package/agent-docs/components/chat-composer.md +48 -0
  16. package/agent-docs/components/chat-message.md +61 -0
  17. package/agent-docs/components/chat-thread.md +49 -0
  18. package/agent-docs/components/checkbox.md +75 -0
  19. package/agent-docs/components/cluster.md +106 -0
  20. package/agent-docs/components/code-example.md +48 -0
  21. package/agent-docs/components/code.md +70 -0
  22. package/agent-docs/components/colour-scheme-toggle.md +92 -0
  23. package/agent-docs/components/container.md +50 -0
  24. package/agent-docs/components/copy-button.md +61 -0
  25. package/agent-docs/components/copy-line.md +54 -0
  26. package/agent-docs/components/date-field.md +103 -0
  27. package/agent-docs/components/date-range-picker.md +101 -0
  28. package/agent-docs/components/detail-layout.md +147 -0
  29. package/agent-docs/components/dialog.md +178 -0
  30. package/agent-docs/components/disclosure.md +66 -0
  31. package/agent-docs/components/divider.md +62 -0
  32. package/agent-docs/components/docs-layout.md +160 -0
  33. package/agent-docs/components/drawer.md +128 -0
  34. package/agent-docs/components/empty-state.md +67 -0
  35. package/agent-docs/components/field-dialog.md +97 -0
  36. package/agent-docs/components/field.md +68 -0
  37. package/agent-docs/components/fieldset.md +82 -0
  38. package/agent-docs/components/file-drop.md +52 -0
  39. package/agent-docs/components/form-layout.md +141 -0
  40. package/agent-docs/components/form-row.md +93 -0
  41. package/agent-docs/components/full-bleed-layout.md +116 -0
  42. package/agent-docs/components/headings.md +101 -0
  43. package/agent-docs/components/hero.md +59 -0
  44. package/agent-docs/components/icon-button.md +92 -0
  45. package/agent-docs/components/icon.md +66 -0
  46. package/agent-docs/components/image.md +64 -0
  47. package/agent-docs/components/input.md +83 -0
  48. package/agent-docs/components/kbd.md +38 -0
  49. package/agent-docs/components/key-value-list.md +81 -0
  50. package/agent-docs/components/lightbox.md +97 -0
  51. package/agent-docs/components/list-layout.md +154 -0
  52. package/agent-docs/components/list-row.md +116 -0
  53. package/agent-docs/components/loading.md +69 -0
  54. package/agent-docs/components/markdown.md +51 -0
  55. package/agent-docs/components/media-tile.md +97 -0
  56. package/agent-docs/components/menu.md +103 -0
  57. package/agent-docs/components/meta-list.md +69 -0
  58. package/agent-docs/components/morph.md +128 -0
  59. package/agent-docs/components/navigation-progress.md +56 -0
  60. package/agent-docs/components/outline-region.md +63 -0
  61. package/agent-docs/components/page-fade.md +116 -0
  62. package/agent-docs/components/page-header.md +93 -0
  63. package/agent-docs/components/pagination.md +64 -0
  64. package/agent-docs/components/pill.md +104 -0
  65. package/agent-docs/components/progress-bar.md +66 -0
  66. package/agent-docs/components/prose-layout.md +87 -0
  67. package/agent-docs/components/prose.md +41 -0
  68. package/agent-docs/components/radio-group.md +74 -0
  69. package/agent-docs/components/scroll-strip.md +48 -0
  70. package/agent-docs/components/segmented-control.md +133 -0
  71. package/agent-docs/components/select.md +65 -0
  72. package/agent-docs/components/show.md +120 -0
  73. package/agent-docs/components/side-column.md +70 -0
  74. package/agent-docs/components/sidebar-layout.md +134 -0
  75. package/agent-docs/components/site-footer.md +63 -0
  76. package/agent-docs/components/site-search.md +67 -0
  77. package/agent-docs/components/sortable-list.md +107 -0
  78. package/agent-docs/components/split-bar.md +54 -0
  79. package/agent-docs/components/stack.md +197 -0
  80. package/agent-docs/components/stacked-bar.md +88 -0
  81. package/agent-docs/components/stat-tile.md +69 -0
  82. package/agent-docs/components/status-pages.md +105 -0
  83. package/agent-docs/components/steps.md +74 -0
  84. package/agent-docs/components/sticky-bar.md +51 -0
  85. package/agent-docs/components/switch.md +79 -0
  86. package/agent-docs/components/table.md +373 -0
  87. package/agent-docs/components/tabs.md +180 -0
  88. package/agent-docs/components/text-link.md +105 -0
  89. package/agent-docs/components/textarea.md +51 -0
  90. package/agent-docs/components/timeline.md +79 -0
  91. package/agent-docs/components/toast.md +86 -0
  92. package/agent-docs/components/trend-chart.md +61 -0
  93. package/agent-docs/components/video.md +44 -0
  94. package/agent-docs/llms.txt +155 -0
  95. package/package.json +6 -3
  96. package/skills/uislash/SKILL.md +20 -0
@@ -0,0 +1,54 @@
1
+ ## SplitBar
2
+
3
+ Group: Data
4
+
5
+ When to use: Two sides of one total: a pot split between two goals, for and against.
6
+
7
+ ### The one right way
8
+ Give `names` so a screen reader hears whose share is whose, and draw the names under the bar for everyone else.
9
+ ```tsx
10
+ import { Caption, Cluster, SplitBar, Stack } from "@slashsuite/ui-react";
11
+
12
+ <Stack gap="xs">
13
+ <SplitBar a={35} b={65} label="Pot split" names={["Debt", "Renos"]} />
14
+ <Cluster justify="between">
15
+ <Caption as="span">Debt 35%</Caption>
16
+ <Caption as="span">Renos 65%</Caption>
17
+ </Cluster>
18
+ </Stack>
19
+ ```
20
+
21
+ ### Do
22
+ - `a` is the left party and `b` the right; each is sized by its share of `a + b`.
23
+ - Give `names` as `[left, right]`, and draw the same names under the bar yourself; the bar draws no text.
24
+ - `toneA` defaults to `danger` and `toneB` to `positive`. Set both when neither side is good or bad, e.g. `accent` and `warn`. `size` is `sm`, `md` (default) or `lg`.
25
+ - More than two parts are a `StackedBar`; progress toward a total is a `ProgressBar`.
26
+
27
+ ### Don't
28
+ No `names` and nothing under the bar: the two colours are never explained, and a screen reader hears two bare percentages.
29
+ ```tsx
30
+ import { SplitBar } from "@slashsuite/ui-react";
31
+
32
+ <SplitBar a={35} b={65} label="Pot split" />
33
+
34
+ ```
35
+
36
+ ### Accessibility
37
+ - A SplitBar has `role="img"` and an `aria-label` of `label` followed by each side's whole percent.
38
+ - With `names` it hears each name before its percent; without, only two bare percentages.
39
+ - Colour alone does not name the parties, so draw their names under the bar.
40
+
41
+ ### Props
42
+ ### SplitBar
43
+ A bar split between two parties, `a` on the left and `b` on the right, each sized by its share of `a + b`. `label` names the split for a screen reader, which hears both percentages; give `names` (left, right) so it hears whose is whose. Put the parties' names under the bar yourself. While `loading` it is one bone the bar's size, since 0 is a real value.
44
+ - a: number (required). The left party's amount; its share is `a` over `a + b`.
45
+ - b: number (required). The right party's amount; its share is `b` over `a + b`.
46
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
47
+ - label: string (required). What the split is, for a screen reader, which hears it before both percentages.
48
+ - loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
49
+ Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
50
+ - loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
51
+ - names: readonly [string, string]. The left and right parties, spoken before their percentages.
52
+ - size: "sm" | "md" | "lg" (default md). The bar's height: `sm` 6px, `md` 8px, `lg` 12px.
53
+ - toneA: "positive" | "warn" | "danger" | "accent" (default danger). The left part's colour, by what it means (`accent`, `positive`, `warn` or `danger`). Defaults to "danger".
54
+ - toneB: "positive" | "warn" | "danger" | "accent" (default positive). The right part's colour, by what it means (`accent`, `positive`, `warn` or `danger`). Defaults to "positive".
@@ -0,0 +1,197 @@
1
+ ## Stack
2
+
3
+ Group: Layout
4
+
5
+ When to use: Any blocks that follow each other: space is a Stack's `gap`, never a margin on a block.
6
+
7
+ ### Use instead
8
+ - FormLayout (form-layout.md): The whole page is one form: header, fields, then Save and Cancel.
9
+ - FormRow (form-row.md): Fields sit side by side: a `FormGrid` of `Field`s, or a `FormRow` to edit one record on a line.
10
+
11
+ ### The one right way
12
+ Blocks that follow each other go in a `Stack`: the gap is one step of the scale, `md` by default.
13
+ ```tsx
14
+ import { Card, Stack, Text } from "@slashsuite/ui-react";
15
+
16
+ <Stack>
17
+ <Card title="Build 412">
18
+ <Text>3 changed</Text>
19
+ </Card>
20
+ <Card title="Build 411">
21
+ <Text>No changes</Text>
22
+ </Card>
23
+ </Stack>
24
+ ```
25
+
26
+ ### Do
27
+ - `gap` is a scale: `xs` between lines of text, `sm` inside a group, `md` between blocks, `lg` between groups, `xl` between a page's top-level blocks (the one responsive page rhythm). Left out, it comes from where the Stack sits: `xs` inside a `Card`, `Dialog`, `Drawer`, `BottomSheet`, `Callout` or `ListRow`, `md` on the page.
28
+ - `width` caps the column at the start edge: `compact` (one card or one picture's column), `narrow` (a reading measure), `wide`, `full`, or `default` for the parent's width. It is never re-centred. A width cap on any one block is a `Stack` around it: `<Stack width="compact"><Card>...</Card></Stack>`.
29
+ - `as` is `div` (default), `section`, `form`, `ul` or `ol`. `as="form"` takes the form props and spaces its fields; `as="ul"` and `as="ol"` draw no markers and their children are `<li>`s, and take `empty`, an `EmptyState` drawn as one muted line when the list has no children.
30
+ - A titled group is a `Section`: `title`, `actions` beside it, then the blocks, spaced as a `Stack`. It takes `gap` and `width` as `Stack` does. `rule` draws a hairline under the title row, `actions` included. Its title is an `h2` on the page, one level below the section that holds it, and a `Card` or `EmptyState` inside it is one below that; `level` sets it by hand.
31
+ - A small titled group (a panel's "Flaky" block, a card's "Ignore areas") is `Section size="sm"`: a small all-caps title, its blocks `xs` apart, `actions` at the end of the title row.
32
+ - `rowFrom` (`sm`, `md` or `lg`) turns the column into a row from that breakpoint and leaves it a column below: a main block beside a side column on a wide screen, stacked on a phone. Put the block that takes the width left in a `ClusterGrow`.
33
+ - A row that is a row at every width is a `Cluster`, not a Stack.
34
+ - `overline` puts a small label above a `Section`'s title, in the same `<header>`, and `description` a line under it that is not part of the heading's name.
35
+
36
+ ### Don't
37
+ - Never build a landing section from an `Overline`, a `Display` and a `Lead` by hand: it is unnamed and drifts from every other one.
38
+ - Do not build a small titled group from `Stack as="section"` and an `Overline as="h2"`: it is unnamed and its gap is a guess. It is `Section size="sm"`.
39
+
40
+ Blocks in a bare `div` touch each other. Space is the Stack's job, never left to the blocks.
41
+ ```tsx
42
+ import { Card, Text } from "@slashsuite/ui-react";
43
+
44
+ <div>
45
+ <Card title="Build 412">
46
+ <Text>3 changed</Text>
47
+ </Card>
48
+ <Card title="Build 411">
49
+ <Text>No changes</Text>
50
+ </Card>
51
+ </div>
52
+ ```
53
+
54
+ A heading row built by hand is not tied to its group: nothing names the region and the row's spacing is a guess. Use `Section`.
55
+ ```tsx
56
+ import { Button, Card, Cluster, SectionHeading, Stack, Text } from "@slashsuite/ui-react";
57
+
58
+ <Stack gap="sm">
59
+ <Cluster justify="between">
60
+ <SectionHeading>Recent builds</SectionHeading>
61
+ <Button variant="outline">All builds</Button>
62
+ </Cluster>
63
+ <Card>
64
+ <Text>Build 412 · 3 changed</Text>
65
+ </Card>
66
+ <Card>
67
+ <Text>Build 411 · no changes</Text>
68
+ </Card>
69
+ </Stack>
70
+ ```
71
+
72
+ The same cards in a plain Stack are two unrelated blocks: no list, no count, nothing to jump by.
73
+ ```tsx
74
+ import { Card, Stack, Text } from "@slashsuite/ui-react";
75
+
76
+ <Stack gap="sm">
77
+ <Card>
78
+ <Text>Build 412 · 3 changed</Text>
79
+ </Card>
80
+ <Card>
81
+ <Text>Build 411 · no changes</Text>
82
+ </Card>
83
+ </Stack>
84
+ ```
85
+
86
+ Left to the page, a small card stretches across it and its few lines float in a wide box.
87
+ ```tsx
88
+ import { Card, KeyValue, KeyValueList, Stack } from "@slashsuite/ui-react";
89
+
90
+ <Stack>
91
+ <Card title="Opening hours" size="sm">
92
+ <KeyValueList>
93
+ <KeyValue label="Mon to Fri">08:00 to 17:00</KeyValue>
94
+ <KeyValue label="Saturday">08:00 to 13:00</KeyValue>
95
+ <KeyValue label="Sunday">Closed</KeyValue>
96
+ </KeyValueList>
97
+ </Card>
98
+ </Stack>
99
+ ```
100
+
101
+ Built from a `Stack as="section"` and an `Overline as="h2"`, the group is an unnamed section whose gap is a guess.
102
+ ```tsx
103
+ import { Button, Card, Cluster, Overline, Stack, Text } from "@slashsuite/ui-react";
104
+
105
+ <Card>
106
+ <Stack gap="sm">
107
+ <Stack as="section" gap="xs">
108
+ <Cluster justify="between">
109
+ <Overline as="h2">Flaky</Overline>
110
+ <Button variant="ghost" size="sm">
111
+ Rerun
112
+ </Button>
113
+ </Cluster>
114
+ <Text>checkout.spec.ts failed once in the last 20 runs.</Text>
115
+ </Stack>
116
+ <Stack as="section" gap="xs">
117
+ <Overline as="h2">Ignore areas</Overline>
118
+ <Text>The clock in the header and the avatar.</Text>
119
+ </Stack>
120
+ </Stack>
121
+ </Card>
122
+ ```
123
+
124
+ An `Overline`, a `Display as="h2"` and a `Lead` by hand: nothing names the region and the spacing drifts from every other landing section.
125
+ ```tsx
126
+ import { Card, Display, Lead, Overline, Stack, Text } from "@slashsuite/ui-react";
127
+
128
+ <Stack as="section" gap="lg">
129
+ <Stack gap="sm">
130
+ <header>
131
+ <Overline mono>Fit</Overline>
132
+ <Display as="h2">Built for agents.</Display>
133
+ </header>
134
+ <Lead>A site from props alone, in every theme.</Lead>
135
+ </Stack>
136
+ <Card>
137
+ <Text>Each tool answers one question about a change.</Text>
138
+ </Card>
139
+ </Stack>
140
+ ```
141
+
142
+ ### Accessibility
143
+ - `Section` is a `<section>` named by its `title` (`aria-labelledby`), so it is a region; with no `title` give it an `aria-label`.
144
+ - A `Stack` with `as="ul"` or `as="ol"` is a real list: give it an `aria-label` when more than one list is on the page. `as="ul" divided` is still a list; the lines are only drawn.
145
+ - `as="form"` is a `<form>`; give it an `aria-label` or let a heading name it.
146
+ - A `div` Stack adds no role.
147
+
148
+ ### Props
149
+ ### Stack
150
+ A vertical column of blocks a fixed `gap` apart: `xs` between lines of text (a heading and the line under it), `sm` inside a group, `md` between blocks, `lg` between groups, `xl` between a page's top-level blocks (`gap-12`, `sm:gap-16`: the one responsive page rhythm). Left out, the gap comes from where the Stack sits: `xs` inside a `Card`, `Dialog`, `Drawer`, `BottomSheet`, `Callout` or `ListRow`, and `md` on the page. `width` caps the column: `compact` is the width of one card or one picture's column (28rem), `narrow` is a reading measure, `wide` is wider again, `full` is the parent's whole width and `default` sets nothing. A capped Stack starts at its parent's start edge (it is never re-centred), so its first line lines up with every other block on the page. A width cap on any one block (a `Card`, an `Image`) is a Stack around it. `align="start"` keeps each child at its own width, capped at the column's (a `Button` under a form's fields); left out, every child spans the column. `divided` draws a line between each pair of children and sets them touching, with no gap: it is for rows that carry their own padding (`ListRow`s in a `Card flush`). Space and a line between blocks is a `Divider` in the Stack instead. `rowFrom` turns the column into a row from `sm`, `md` or `lg` (a column below it): the blocks sit side by side, `gap` apart, and a `ClusterGrow` around one of them takes the width left. Without it the Stack is always a column; a row that is a row at every width is a `Cluster`. `as` is a closed set: `div` (default), `section`, `form`, `ul` or `ol`. A `form` takes the form props (`onSubmit`, `action`, `method`, `noValidate`, ...). A `ul` or `ol` is drawn with no markers and its children are `<li>`s, as in `BulletList` and `Timeline`: the Stack does not wrap them, so a child is one list item and `Text as="li"` or a bare `<li>` both work. A `ul` or `ol` takes `empty` (an `EmptyState`, one muted line here), drawn in place of the list when it has no children.
151
+ - align: "start" | "stretch" (default stretch). Where the children sit across the column: `stretch` spans it, `start` keeps each child at its
152
+ own width (a `Button` under a form's fields).
153
+ - as: "div" | "form" | "ol" | "section" | "ul". The element: `div`, `section`, `form` (takes the form's props), `ul` or `ol` (no markers; each child is an `<li>`).
154
+ - divided: boolean. A line between each pair of children, which then touch (no gap): rows that carry their own
155
+ padding. Space and a line between blocks is a `Divider` in the Stack instead.
156
+
157
+ Such as `ListRow`s in a `Card flush`.
158
+ - empty: ReactNode. Drawn in place of the list when it has no children: an `EmptyState`.
159
+ - gap: "sm" | "md" | "lg" | "xs" | "xl" (default xs inside a `Card`, `Dialog`, `Drawer`, `BottomSheet`, `Callout` or `ListRow`, else md). The space between blocks: `xs` gap-2, `sm` gap-4, `md` gap-6, `lg` gap-8, `xl` gap-12 (gap-16 from `sm`).
160
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
161
+ - rowFrom: "sm" | "md" | "lg". Turns the column into a row from this breakpoint (`sm`, `md` or `lg`), a column below it: a main
162
+ area beside a side column on a wide screen, stacked on a phone. In the row the blocks sit side by side
163
+ the same `gap` apart and are as tall as the tallest; wrap the one that takes the width left in a
164
+ `ClusterGrow`. Left out, the Stack is always a column.
165
+ - width: "compact" | "narrow" | "full" | "default" | "wide" (default default). Caps the column: `compact` max-w-md (one card or one picture's column), `narrow` max-w-3xl (a
166
+ reading measure), `wide` max-w-5xl, `full` the parent's whole width, `default` sets nothing.
167
+
168
+ ### Section
169
+ A `<section>` Stack with an optional title (which names it) and `actions`. Its blocks are `gap` apart, from where it sits as in a `Stack`. `level` is the title's heading level, one below the heading that holds the section (an `h2` on the page), and a heading inside it (a `Card`'s title) is one below that. A line between two sections is a `Divider` in the `Stack` that holds them. `size` picks the scale: - `md` (default): a page's section. A `SectionHeading` title with `actions` at the end of its row; `rule` draws a hairline under the row, `overline` a small label above the title and `description` a muted line under it. - `sm`: the small titled group inside a page, a card, a drawer or a side panel (a panel's "Flaky" block, a card's "Ignore areas"): the title small and all-caps like a `Card`'s, the blocks `xs` apart. Never build one from a `Stack as="section"` and an `Overline`. - `lg`: a landing page's section under the `Hero`: a mono `overline` kicker, the title at display size, `description` as a `Lead` and `actions` under it as its calls to action, the opening capped at the reading measure at the start edge, the blocks `lg` apart. It ignores the prose scale.
170
+ - actions: ReactNode. Buttons or links: at the end of the title row, or under the description at `size="lg"`.
171
+ - description: ReactNode. The line under the title, outside the heading: a muted line at `md`, a `Lead` at `lg`.
172
+ - gap: "sm" | "md" | "lg" | "xs" | "xl" (default xs at `size="sm"`, lg at `size="lg"`; else xs inside a `Card`, `Dialog`, `Drawer`, `BottomSheet`, `Callout` or `ListRow`, else md). The space between blocks: `xs` gap-2, `sm` gap-4, `md` gap-6, `lg` gap-8, `xl` gap-12 (gap-16 from `sm`).
173
+ - id: string. Makes the section a link target: `#<id>` scrolls to its heading, which stops below the sticky
174
+ AppShell header, as every `id` inside the shell does; write no `scroll-margin`. Needs a `title`:
175
+ with no title the heading that carries it is not rendered.
176
+ The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
177
+ - level: 2 | 3 | 4 | 5 | 6 (default one below the heading that holds the section: 2 on the page). The title's heading level, 2 to 6. It does not change how the title looks.
178
+ - overline: ReactNode. A small label above the title, in the same `<header>` (mono at `size="lg"`). Needs a `title`.
179
+ - rule: boolean (default false). A hairline under the title row across the section's width, `actions` included. Needs a
180
+ `title` or `actions`.
181
+ - size: "sm" | "md" | "lg" (default md). `sm` a small titled group inside a page, a card or a panel, its title small and all-caps
182
+ and its blocks `xs` apart; `md` a page's section; `lg` a landing page's section, a display
183
+ title under a mono kicker, a `Lead`, then its calls to action.
184
+
185
+ A landing page's section under the `Hero` is `size="lg"`: its opening is capped at the
186
+ reading measure at the start edge and its blocks sit `lg` apart. A feature card in it is
187
+ a `Card href icon titleStyle="name"` in a `CardGrid`; text beside code is a `SideColumn`.
188
+ - title: ReactNode. The heading at the top, which names the section.
189
+ - width: "compact" | "narrow" | "full" | "default" | "wide" (default default). Caps the column: `compact` max-w-md (one card or one picture's column), `narrow` max-w-3xl (a
190
+ reading measure), `wide` max-w-5xl, `full` the parent's whole width, `default` sets nothing.
191
+
192
+ ### Types
193
+ - SectionSize: `"sm" | "md" | "lg"`. A `Section`'s scale: `sm` a small titled group, `md` a page's section, `lg` a landing page's section.
194
+ - StackAlign: `"start" | "stretch"`. Where a Stack's children sit across the column: `stretch` spans it, `start` keeps each child's own width.
195
+ - StackGap: `"sm" | "md" | "lg" | "xs" | "xl"`. The space between a `Stack`'s blocks, on the gap scale: `xs` 8px, `sm` 16px, `md` 24px, `lg` 32px, `xl` 48px (64px from `sm`).
196
+ - StackRowFrom: `"sm" | "md" | "lg"`. The breakpoint from which a `Stack` turns from a column into a row: `sm`, `md` or `lg`.
197
+ - StackWidth: `"compact" | "narrow" | "default" | "wide" | "full"`. A `Stack`'s width cap at the start edge: `compact`, `narrow` (a reading measure), `default`, `wide` or `full`.
@@ -0,0 +1,88 @@
1
+ ## StackedBar
2
+
3
+ Group: Data
4
+
5
+ When to use: The make-up of one whole in three or more parts: results by status, spend by group.
6
+
7
+ ### The one right way
8
+ `legend` names every colour in words, with its value, under the bar.
9
+ ```tsx
10
+ import { StackedBar } from "@slashsuite/ui-react";
11
+
12
+ <StackedBar
13
+ items={[
14
+ { label: "Changed", value: 24, tone: "warn" },
15
+ { label: "New", value: 9, tone: "info" },
16
+ { label: "Same", value: 163, tone: "muted" },
17
+ ]}
18
+ label="Screenshots by status"
19
+ legend
20
+ />
21
+ ```
22
+
23
+ ### Do
24
+ - `items` are `{ label, value, tone }` in the order to draw; `tone` is `muted`, `positive`, `warn`, `danger`, `info`, `neutral` (a grey apart from `muted`) or `accent`, and you map your own roles onto them. Five distinguishable parts are `warn`, `info`, `danger`, `neutral` and `muted`.
25
+ - Categories with no meaning (shops by kind, spend by group) take the categorical scale, `cat1` to `cat8`, from `cat1` upwards in order; good and bad take the meaning tones; never both in one chart. Each theme publishes the same eight as `--hc-cat-1` to `--hc-cat-8`, so a map pin can match its `Legend`.
26
+ - Set `legend` so every colour is named in words under the bar, with its value.
27
+ - `Legend` alone is the key for colours drawn elsewhere, such as a `TableRow` `stripe`. An item with `swatch: "dashed"` is a dashed ring with no fill, the key for an outline drawn over the chart.
28
+ - `size` is `sm`, `md` (default) or `lg`. A part with no value is zero wide.
29
+ - Two parties are a `SplitBar`; progress toward a total is a `ProgressBar`.
30
+
31
+ ### Don't
32
+ Without `legend` the colours are never named, so the bar cannot be read by anyone who cannot tell them apart.
33
+ ```tsx
34
+ import { StackedBar } from "@slashsuite/ui-react";
35
+
36
+ <StackedBar
37
+ items={[
38
+ { label: "Changed", value: 24, tone: "warn" },
39
+ { label: "New", value: 9, tone: "info" },
40
+ { label: "Same", value: 163, tone: "muted" },
41
+ ]}
42
+ label="Screenshots by status"
43
+ />
44
+ ```
45
+
46
+ The meaning tones on categories make one read as a warning and another as a failure, which they are not.
47
+ ```tsx
48
+ import { StackedBar } from "@slashsuite/ui-react";
49
+
50
+ <StackedBar
51
+ items={[
52
+ { label: "Vintage", value: 14, tone: "warn" },
53
+ { label: "Books", value: 9, tone: "danger" },
54
+ { label: "Furniture", value: 7, tone: "positive" },
55
+ ]}
56
+ label="Shops by category"
57
+ legend
58
+ />
59
+ ```
60
+
61
+ ### Accessibility
62
+ - The bar has `role="img"` and an `aria-label` of `label` followed by every part's name and whole percent; rounded, they may not add up to exactly 100.
63
+ - A `Legend` is a list. Its swatches are hidden from assistive tech and its labels are always drawn, so colour is never the only signal.
64
+
65
+ ### Props
66
+ ### StackedBar
67
+ A bar of any number of parts, each sized by its share of the sum, in the order given. A part with no value is zero wide. `label` names the bar for a screen reader, which hears every part's name and whole percent (rounded, so they may not add up to exactly 100). `legend` draws a `Legend` under the bar, each part's label with its value, so the colours are named in words. While `loading` the bar is one bone (0 is a real value) and the key keeps the names it has, without their values.
68
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
69
+ - items: readonly StackedSegment[] (required). The parts in order, each a `label`, a `value` (its share is the value over the sum) and a `tone`.
70
+ - label: string (required). What the bar shows, for a screen reader, which hears it before every part's name and percent.
71
+ - legend: boolean (default false). Draw the key under the bar. Defaults to false.
72
+ - loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
73
+ Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
74
+ - loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
75
+ - size: "sm" | "md" | "lg" (default md). The bar's height: `sm` 6px, `md` 8px, `lg` 12px.
76
+
77
+ ### Legend
78
+ A key to the colours of a chart or a row stripe: a swatch in the `VizTone` colour (a filled dot, or a dashed ring with `swatch="dashed"`), its `label` and an optional `detail` after it. Colour alone does not say it, so the label is always drawn. `StackedBar legend` draws one under the bar from its segments. While `loading` with no `items` it draws three entries of bones.
79
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
80
+ - items: readonly LegendItem[] (required). One entry per colour: its `label`, its `tone`, an optional `swatch` and `detail` (a count, a share).
81
+ - loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
82
+ Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
83
+ - loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
84
+
85
+ ### Types
86
+ - LegendItem: `{ label: string; tone: VizTone; swatch?: "solid" | "dashed"; detail?: string | number }`. One entry of a `Legend`: the `label` the colour stands for, its swatch, and an optional `detail` (a count, a share) after it.
87
+ - StackedSegment: `{ label: string; value: number; tone: VizTone }`. One part of a `StackedBar`: its `label`, its `value` (its share is `value` over the sum) and its colour.
88
+ - VizTone: `TextTone | "cat1" | "cat2" | "cat3" | "cat4" | "cat5" | "cat6" | "cat7" | "cat8"`. The colour of a `StackedBar` segment, a `Legend` swatch or a `TrendChart` series: the `TextTone` names, painted as a fill, or a category colour, `cat1` to `cat8`. On a chart `neutral` is a grey of its own that sits apart from `muted` (for "unmeasured" next to "same"), and `accent` is the theme's accent, apart from `info`. Categories with no meaning take `cat1` upwards in order; good and bad take the meaning tones; one chart never mixes the two.
@@ -0,0 +1,69 @@
1
+ ## StatTile
2
+
3
+ Group: Data
4
+
5
+ When to use: A single number a person should see first: a total, a date, a balance.
6
+
7
+ ### The one right way
8
+ Pass the value already formatted, with its unit: `R 4 250`, `Mar 2029`, `12%`.
9
+ ```tsx
10
+ import { CardGrid, StatTile } from "@slashsuite/ui-react";
11
+
12
+ <CardGrid columns={2}>
13
+ <StatTile label="Left over" value="R 4 250" hint="after all bills" />
14
+ <StatTile label="Debt-free" value="Mar 2029" />
15
+ </CardGrid>
16
+ ```
17
+
18
+ ### Do
19
+ - Pass `value` already formatted, with its unit and grouping (`R 4 250`, `Mar 2029`); the tile does not format.
20
+ - `label` names the figure; `hint` is one short line under it.
21
+ - `tone` is `neutral`, `positive`, `warn` or `danger`. A tone colours the value, so give it a sign or a `hint` that says the same; `accent` adds a bar in the same tone across the top.
22
+ - Lay several tiles out in a `CardGrid`. A tile is not a button or a link.
23
+ - `trend` takes the figure over time, oldest first, and draws a small line under the value in its colour, on a scale from 0. The line is decoration, so say the trend in `hint` too (`up 12% on last month`). A chart with axes is a `TrendChart`.
24
+
25
+ ### Don't
26
+ A raw number has no unit or grouping, so the tile shows a figure nobody can read at a glance.
27
+ ```tsx
28
+ import { CardGrid, StatTile } from "@slashsuite/ui-react";
29
+
30
+ <CardGrid columns={2}>
31
+ <StatTile label="Left over" value={4250.5} />
32
+ <StatTile label="Savings" value={1250000} />
33
+ </CardGrid>
34
+ ```
35
+
36
+ The same tones with no sign and no hint: red and green are the only difference, so the meaning is lost without colour.
37
+ ```tsx
38
+ import { CardGrid, StatTile } from "@slashsuite/ui-react";
39
+
40
+ <CardGrid columns={2}>
41
+ <StatTile label="Left over" value="R 4 250" tone="positive" accent />
42
+ <StatTile label="Total interest" value="R 12 400" tone="danger" accent />
43
+ </CardGrid>
44
+ ```
45
+
46
+ ### Accessibility
47
+ - A StatTile is plain text in a `<div>`: the caption, the value and the hint are read in that order.
48
+ - The `accent` bar is decoration and hidden from assistive tech.
49
+ - Colour alone never carries the tone; a sign or the hint says it.
50
+
51
+ ### Props
52
+ ### StatTile
53
+ One headline figure: an uppercase caption over a large tabular-nums value, with an optional hint line beneath. `tone` colours the value; `accent` adds a bar across the top edge in the same tone. `trend` draws a small line under the value in the same colour. Pass the value already formatted. While `loading`, a `label` or `value` not here yet is a bone; the hint and the trend are drawn only once given.
54
+ - accent: boolean (default false). A bar across the top edge in the tone's colour.
55
+ - hint: ReactNode. A muted line under the value.
56
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
57
+ - label: ReactNode (required). The small uppercase caption over the value.
58
+ - loading: boolean. The data is not here yet: an empty slot draws a bone of its shape, a filled one draws as usual.
59
+ Left out, the part takes the nearest loading layout's or part's; `false` opts it out inside one.
60
+ - loadingLabel: string (default Loading). What a screen reader hears while this part is loading, when its own `loading` is set.
61
+ - tone: "neutral" | "positive" | "warn" | "danger" (default neutral). What the figure means: `neutral` (the default) a plain figure, `positive` good or on track,
62
+ `warn` at risk, `danger` failed or over. Say it in the text too: colour alone says nothing to a
63
+ screen reader.
64
+ - trend: readonly number[]. The figure over time, oldest first: a sparkline under the value, in its colour, on a scale
65
+ from 0. It is decoration, so say the trend in `hint` as well.
66
+ - value: ReactNode (required). The figure, already formatted, large and in tabular figures.
67
+
68
+ ### Types
69
+ - StatTileTone: `"neutral" | "positive" | "warn" | "danger"`. The colour of a tile's value (and of its accent bar): plain ink, green, amber or red.
@@ -0,0 +1,105 @@
1
+ ## Status pages
2
+
3
+ Group: Pages
4
+
5
+ When to use: A route that cannot show its content: use the status page that names the state.
6
+
7
+ ### Use instead
8
+ - Callout (callout.md): Only a part of the page failed, and the rest of it shows.
9
+ - EmptyState (empty-state.md): The page works and has nothing in it yet.
10
+
11
+ ### The one right way
12
+ A missing page is `NotFound`: the reader needs a way home, and a retry would load the same nothing.
13
+ ```tsx
14
+ import { NotFound } from "@slashsuite/ui-react";
15
+
16
+ <NotFound />
17
+
18
+ ```
19
+
20
+ ### Do
21
+ - Pick the page by the state: `NotFound` for a missing page (404), `Forbidden` for a page the reader may not see (403), `ErrorPage` for a failure (500), `Offline` for no connection, `Maintenance` for a site that is down on purpose.
22
+ - The copy is fixed, so every site reads the same. Change the heading with `title` and the text with children only when the state needs a specific line.
23
+ - Every page but `Maintenance` links "Back to home", to `LinkProvider`'s `home` (`/` by default). `Maintenance` has none: home is the site that is down.
24
+ - Say where home is once, on the provider (`<LinkProvider home="/app">`).
25
+ - `onRetry` adds a "Try again" button on `ErrorPage` and `Offline`; `actions` replaces it with the buttons that fit, and the home link turns outline beside them.
26
+ - A button worded differently goes in `actions`: it comes first, and "Back to home" stays beside it. There is no label prop.
27
+ - A part of a page that failed to load is not an `ErrorPage`: it is a `Callout tone="danger"` with a title and a retry `Button` in its `actions`, and the rest of the page stays.
28
+ - Render one as the content of an `AppShell`, or on its own in a `Container`.
29
+
30
+ ### Don't
31
+ - Do not offer a retry where trying again cannot help.
32
+ - Never put a stack trace in `detail`.
33
+ - Never wire a home link on each page; a page takes no home prop.
34
+
35
+ `ErrorPage` with a retry for a missing page promises that trying again helps, and it does not.
36
+ ```tsx
37
+ import { ErrorPage } from "@slashsuite/ui-react";
38
+
39
+ <ErrorPage onRetry={() => {}} />
40
+
41
+ ```
42
+
43
+ A stack trace shows the reader your internals and buries the one line they can act on.
44
+ ```tsx
45
+ import { ErrorPage } from "@slashsuite/ui-react";
46
+
47
+ <ErrorPage
48
+ detail={
49
+ "TypeError: Cannot read properties of undefined\n at loadBuild (build.ts:42:9)\n" +
50
+ " at async handler (route.ts:17:3)"
51
+ }
52
+ onRetry={() => {}}
53
+ />
54
+ ```
55
+
56
+ ### Accessibility
57
+ - Each page is a `CenteredLayout` card, so the title is the page's `h1` and the copy under it is a paragraph.
58
+ - `detail` is shown in a `CodeBlock` labelled "Error".
59
+ - The buttons are a `Button` and a `Button` with `href`, with their own focus rings; "Back to home" is a real link.
60
+ - The pages do not set an HTTP status; send the 404, 403 or 500 from the server.
61
+
62
+ ### Props
63
+ ### NotFound
64
+ 404: the page is not there. `numeral` draws a large "404" above the title, for a site whose 404 is a designed page; the digits are fixed. Off, the page is the title and copy alone.
65
+ - actions: ReactNode. The page's own buttons, before "Back to home", which turns outline beside them. This is the one
66
+ way to a button worded differently; there is no label prop.
67
+ - children: ReactNode. Replaces the default body copy.
68
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
69
+ - numeral: boolean (default false). Draws a large "404" above the title. Off by default. The digits are fixed: there is no text prop.
70
+ - title: ReactNode. Replaces the default heading.
71
+
72
+ ### Forbidden
73
+ 403: signed in, or not, but not allowed here. The page for a route that exists and the reader may not see; a route that is not there is a `NotFound`.
74
+ - actions: ReactNode. The page's own buttons, before "Back to home", which turns outline beside them. This is the one
75
+ way to a button worded differently; there is no label prop.
76
+ - children: ReactNode. Replaces the default body copy.
77
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
78
+ - title: ReactNode. Replaces the default heading.
79
+
80
+ ### ErrorPage
81
+ 500 or any failure. `detail` is the error text, shown in a `CodeBlock` under the copy; pass it only where a reader may see it (a request id, a message), never a stack trace. `onRetry` adds a "Try again" button, unless `actions` replaces it.
82
+ - actions: ReactNode. The page's own buttons, before "Back to home", which turns outline beside them. This is the one
83
+ way to a button worded differently; there is no label prop.
84
+ - children: ReactNode. Replaces the default body copy.
85
+ - detail: string. The error text, in a `CodeBlock` under the copy: a request id or a message a reader may see, never a stack trace.
86
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
87
+ - onRetry: () => void. Adds a "Try again" button that calls it, unless `actions` replaces the button.
88
+ - title: ReactNode. Replaces the default heading.
89
+
90
+ ### Offline
91
+ The device has no connection. `onRetry` adds a "Try again" button, unless `actions` replaces it.
92
+ - actions: ReactNode. The page's own buttons, before "Back to home", which turns outline beside them. This is the one
93
+ way to a button worded differently; there is no label prop.
94
+ - children: ReactNode. Replaces the default body copy.
95
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
96
+ - onRetry: () => void. Adds a "Try again" button that calls it, unless `actions` replaces the button.
97
+ - title: ReactNode. Replaces the default heading.
98
+
99
+ ### Maintenance
100
+ The site is down on purpose and will be back: the page for planned downtime, such as an upgrade. A failure is an `ErrorPage`, and no connection is `Offline`. It has no "Back to home": home is the site that is down.
101
+ - actions: ReactNode. The page's own buttons, before "Back to home", which turns outline beside them. This is the one
102
+ way to a button worded differently; there is no label prop.
103
+ - children: ReactNode. Replaces the default body copy.
104
+ - id: string. The root element's `id`: an anchor, or the target of a `for` or an `aria-describedby`.
105
+ - title: ReactNode. Replaces the default heading.
@@ -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`.