@hirobius/design-system 0.19.1 → 0.21.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/AGENTS.md +123 -0
- package/CONSUMING.md +11 -6
- package/DESIGN.md +34 -21
- package/NOTICE.md +1 -1
- package/README.md +48 -13
- package/codemods/hds-prefix.mjs +231 -0
- package/codemods/jsx-fold.mjs +515 -0
- package/codemods/not-found-pattern.mjs +71 -0
- package/codemods/patterns-subpath.mjs +242 -81
- package/codemods/patterns-subpath.names.json +41 -15
- package/codemods/removed-0.20.json +194 -0
- package/codemods/tile-grid.mjs +283 -0
- package/codemods/unrewritable.mjs +291 -0
- package/dist/chunks/DemoStateContext-Cz5TmrYu.js +32 -0
- package/dist/chunks/empty-state-DNoThgfV.js +1227 -0
- package/dist/chunks/form-By82qZcC.js +66 -0
- package/dist/contexts.js +157 -78
- package/dist/fonts/geist-mono-400.woff2 +0 -0
- package/dist/fonts/satoshi-400.woff2 +0 -0
- package/dist/fonts/satoshi-500.woff2 +0 -0
- package/dist/fonts/satoshi-700.woff2 +0 -0
- package/dist/fonts.css +53 -0
- package/dist/form.js +1 -1
- package/dist/hirobius-ui.js +1600 -5354
- package/dist/manifest.js +12 -13
- package/dist/patterns.js +796 -510
- package/dist/styles.css +2 -2
- package/dist/tokens.css +1 -1
- package/dist/tokens.js +165 -65
- package/dist/types/src/app/components/alert-dialog.d.ts +5 -0
- package/dist/types/src/app/components/asset-img.d.ts +1 -0
- package/dist/types/src/app/components/avatar-group.d.ts +2 -2
- package/dist/types/src/app/components/badge.d.ts +8 -3
- package/dist/types/src/app/components/blockquote.d.ts +2 -2
- package/dist/types/src/app/components/box-sx.d.ts +110 -13
- package/dist/types/src/app/components/box.d.ts +6 -3
- package/dist/types/src/app/components/breadcrumb.d.ts +0 -5
- package/dist/types/src/app/components/button.d.ts +35 -4
- package/dist/types/src/app/components/card.d.ts +10 -10
- package/dist/types/src/app/components/combobox.d.ts +47 -11
- package/dist/types/src/app/components/container.d.ts +2 -2
- package/dist/types/src/app/components/data-table-section.d.ts +2 -1
- package/dist/types/src/app/components/destructive-section.d.ts +1 -0
- package/dist/types/src/app/components/dialog.d.ts +8 -1
- package/dist/types/src/app/components/disclosure.d.ts +1 -5
- package/dist/types/src/app/components/error-pattern.d.ts +6 -1
- package/dist/types/src/app/components/field.d.ts +1 -2
- package/dist/types/src/app/components/form-actions.d.ts +1 -0
- package/dist/types/src/app/components/form-control.d.ts +10 -0
- package/dist/types/src/app/components/grid.d.ts +15 -6
- package/dist/types/src/app/components/hds-tooltip.d.ts +12 -2
- package/dist/types/src/app/components/icon.d.ts +1 -0
- package/dist/types/src/app/components/inline-code.d.ts +1 -2
- package/dist/types/src/app/components/input.d.ts +8 -5
- package/dist/types/src/app/components/kbd.d.ts +2 -2
- package/dist/types/src/app/components/metadata-list.d.ts +2 -2
- package/dist/types/src/app/components/metric-tiles.d.ts +1 -0
- package/dist/types/src/app/components/page-header.d.ts +0 -2
- package/dist/types/src/app/components/popover.d.ts +8 -0
- package/dist/types/src/app/components/progress.d.ts +33 -6
- package/dist/types/src/app/components/segmented-control.d.ts +2 -26
- package/dist/types/src/app/components/select.d.ts +10 -1
- package/dist/types/src/app/components/skeleton.d.ts +3 -4
- package/dist/types/src/app/components/spinner.d.ts +1 -2
- package/dist/types/src/app/components/stack.d.ts +4 -1
- package/dist/types/src/app/components/stat.d.ts +5 -5
- package/dist/types/src/app/components/status-list-item.d.ts +1 -2
- package/dist/types/src/app/components/status-tile.d.ts +3 -2
- package/dist/types/src/app/components/surface.d.ts +2 -3
- package/dist/types/src/app/components/switcher.d.ts +1 -1
- package/dist/types/src/app/components/table.d.ts +6 -15
- package/dist/types/src/app/components/tag.d.ts +0 -6
- package/dist/types/src/app/components/text.d.ts +54 -8
- package/dist/types/src/app/components/textarea.d.ts +1 -2
- package/dist/types/src/app/components/timestamp.d.ts +1 -0
- package/dist/types/src/app/components/toast.d.ts +1 -2
- package/dist/types/src/app/components/tooltip.d.ts +1 -1
- package/dist/types/src/app/context/DemoStateContext.d.ts +1 -1
- package/dist/types/src/app/context/RouterContext.d.ts +5 -5
- package/dist/types/src/app/data/manifest-types.d.ts +10 -5
- package/dist/types/src/app/design-system/generated-token-refs.d.ts +45 -28
- package/dist/types/src/app/design-system/generated-token-values.d.ts +4 -0
- package/dist/types/src/app/design-system/tokens.d.ts +139 -18
- package/dist/types/src/icons.d.ts +1 -1
- package/dist/types/src/index.d.ts +76 -164
- package/dist/types/src/patterns.d.ts +20 -25
- package/dist/variables.css +47 -33
- package/docs/CONSUMING.md +80 -48
- package/hirobius.tokens.json +125 -88
- package/llms.txt +166 -59
- package/mcp/catalog.mjs +366 -0
- package/mcp/guide.mjs +315 -0
- package/mcp/hds-mcp.mjs +49 -0
- package/mcp/server.mjs +94 -0
- package/package.json +48 -27
- package/public/hds-manifest.json +2667 -6705
- package/public/llms/components.txt +45 -426
- package/public/llms/layout.txt +5 -5
- package/public/llms-full.txt +245 -506
- package/public/llms.txt +166 -59
- package/scripts/eslint-plugin-hds/index.d.mts +29 -0
- package/scripts/eslint-plugin-hds/index.mjs +55 -0
- package/scripts/eslint-plugin-hds/package.json +30 -0
- package/scripts/eslint-plugin-hds/rules/no-raw-controls.mjs +47 -0
- package/scripts/eslint-plugin-hds/rules/no-raw-hex.mjs +70 -0
- package/scripts/eslint-plugin-hds/rules/no-raw-px-spacing.mjs +125 -0
- package/scripts/eslint-plugin-hds/rules/prefer-hds-layout-primitive.mjs +54 -0
- package/scripts/eslint-plugin-hds/rules/sx-token-first.mjs +111 -0
- package/scripts/eslint-plugin-hds/rules/utils.mjs +66 -0
- package/src/app/data/component-api.json +1082 -2913
- package/dist/chunks/LanguageContext-BxdCwiFg.js +0 -95
- package/dist/chunks/TokenDisplayContext-DKYJMVWk.js +0 -26
- package/dist/chunks/activity-feed-BGQ6v3wc.js +0 -22040
- package/dist/chunks/form-COP3vK9_.js +0 -66
- package/dist/types/src/app/components/activity-feed.d.ts +0 -73
- package/dist/types/src/app/components/app-shell.d.ts +0 -40
- package/dist/types/src/app/components/aspect-ratio.d.ts +0 -25
- package/dist/types/src/app/components/bleed.d.ts +0 -39
- package/dist/types/src/app/components/button-group.d.ts +0 -22
- package/dist/types/src/app/components/calendar.d.ts +0 -22
- package/dist/types/src/app/components/carousel.d.ts +0 -26
- package/dist/types/src/app/components/center.d.ts +0 -36
- package/dist/types/src/app/components/cinematic-link.d.ts +0 -18
- package/dist/types/src/app/components/circular-progress.d.ts +0 -28
- package/dist/types/src/app/components/cluster.d.ts +0 -39
- package/dist/types/src/app/components/command-palette.d.ts +0 -46
- package/dist/types/src/app/components/component-instance-matrix.d.ts +0 -27
- package/dist/types/src/app/components/context-menu.d.ts +0 -78
- package/dist/types/src/app/components/cover.d.ts +0 -43
- package/dist/types/src/app/components/date-input.d.ts +0 -31
- package/dist/types/src/app/components/date-range-input.d.ts +0 -34
- package/dist/types/src/app/components/date-time-input.d.ts +0 -30
- package/dist/types/src/app/components/doc-link-card.d.ts +0 -32
- package/dist/types/src/app/components/error-boundary.d.ts +0 -25
- package/dist/types/src/app/components/file-input.d.ts +0 -30
- package/dist/types/src/app/components/foundation-swatch.d.ts +0 -45
- package/dist/types/src/app/components/frame.d.ts +0 -38
- package/dist/types/src/app/components/heading-stack.d.ts +0 -52
- package/dist/types/src/app/components/history-card.d.ts +0 -12
- package/dist/types/src/app/components/hover-card.d.ts +0 -46
- package/dist/types/src/app/components/icon-button.d.ts +0 -22
- package/dist/types/src/app/components/image-lightbox.d.ts +0 -14
- package/dist/types/src/app/components/input-group.d.ts +0 -23
- package/dist/types/src/app/components/multi-selector.d.ts +0 -40
- package/dist/types/src/app/components/nav-group.d.ts +0 -29
- package/dist/types/src/app/components/nav-item.d.ts +0 -33
- package/dist/types/src/app/components/not-found-pattern.d.ts +0 -1
- package/dist/types/src/app/components/overflow-list.d.ts +0 -21
- package/dist/types/src/app/components/selectable-card.d.ts +0 -29
- package/dist/types/src/app/components/side-nav.d.ts +0 -23
- package/dist/types/src/app/components/sketch.d.ts +0 -19
- package/dist/types/src/app/components/stacked-card-rail.d.ts +0 -32
- package/dist/types/src/app/components/status-dot.d.ts +0 -25
- package/dist/types/src/app/components/stepper-field.d.ts +0 -12
- package/dist/types/src/app/components/stepper.d.ts +0 -33
- package/dist/types/src/app/components/text-lockup.d.ts +0 -38
- package/dist/types/src/app/components/tile-grid.d.ts +0 -17
- package/dist/types/src/app/components/time-input.d.ts +0 -24
- package/dist/types/src/app/components/toggle-button.d.ts +0 -32
- package/dist/types/src/app/components/token.d.ts +0 -90
- package/dist/types/src/app/components/tokenUtils.d.ts +0 -38
- package/dist/types/src/app/components/tokenizer.d.ts +0 -24
- package/dist/types/src/app/components/toolbar.d.ts +0 -36
- package/dist/types/src/app/components/top-nav.d.ts +0 -23
- package/dist/types/src/app/components/tree-list.d.ts +0 -30
- package/dist/types/src/app/data/nav-model.d.ts +0 -39
- package/dist/types/src/app/hooks/useFocusVisible.d.ts +0 -9
- package/dist/types/src/app/layouts/CaseStudyLayout.d.ts +0 -20
- package/dist/types/src/app/layouts/DocLayout.d.ts +0 -14
- package/dist/types/src/app/layouts/EmbeddedDocLayoutContext.d.ts +0 -6
- package/dist/types/src/app/layouts/HdsDocsShell.d.ts +0 -72
- package/dist/types/src/app/layouts/HdsSystemDocLayout.d.ts +0 -14
- package/dist/types/src/app/lib/hds-search.d.ts +0 -45
- package/dist/types/src/app/lib/nav-active.d.ts +0 -16
- package/dist/types/src/app/lib/navLevels.d.ts +0 -4
package/llms.txt
CHANGED
|
@@ -1,8 +1,67 @@
|
|
|
1
1
|
# Hirobius Design System
|
|
2
2
|
|
|
3
|
-
Generated: 2026-
|
|
3
|
+
Generated: 2026-10-07T16:09:09.631Z
|
|
4
4
|
Primary sources: `public/hds-manifest.json`, `src/app/data/component-api.json`, `hirobius.tokens.json`
|
|
5
5
|
|
|
6
|
+
## Agents Using The Package: Start Here
|
|
7
|
+
|
|
8
|
+
- Read `AGENTS.md` (package root, `node_modules/@hirobius/design-system/AGENTS.md`) first: which component to use for each screen need, the imports, and the rules.
|
|
9
|
+
- MCP server `hds` ships in the package: run `npx hds-mcp` (stdio). Tools: `list_core`, `search_components`, `get_component`, `search_tokens`; each answer is under 2 KB.
|
|
10
|
+
- Lint before you finish: `import hds from '@hirobius/design-system/eslint-plugin'` and spread `hds.configs.recommended` into `eslint.config.mjs`.
|
|
11
|
+
|
|
12
|
+
## Pick By Need
|
|
13
|
+
|
|
14
|
+
One answer per need. Use the components after the arrow; what follows "Not:" is what agents reached for instead, which is the wrong answer for that need even where it has a purpose of its own. Generated from `mcp/guide.mjs`, the same list as `AGENTS.md`.
|
|
15
|
+
|
|
16
|
+
- **Outermost wrapper of a screen** → `Page`, `Stack`. Not: `Container`, `Box`, a bare Stack as the root.
|
|
17
|
+
`<Page><Stack gap="spacious">…one child per section…</Stack></Page>`. `Container` is for a full-bleed surface that is not a page.
|
|
18
|
+
- **Screen title with breadcrumb, status and actions** → `PageHeader`, `Breadcrumb`, `Badge`. Not: Text as the page title, a Stack row of Text and Badge.
|
|
19
|
+
Exactly one per screen: `<PageHeader breadcrumb={<Breadcrumb items={[{ label, href }, { label }]} />} title="…" status={<Badge tone="success">Active</Badge>} />`.
|
|
20
|
+
- **Row of headline numbers (stats, KPIs, counts, totals)** → `MetricTiles`, `MetricTile`. Not: `Stat`, `StatusTile`, `CardMetric`, Card with Text.
|
|
21
|
+
`<MetricTiles><MetricTile label="Open projects" value="5" />…</MetricTiles>`; one MetricTile per number. `Stat` is for a number inside prose or a dense list, `Card.Metric` for one inside an existing `Card`, `StatusTile` for a state with notes (never a number).
|
|
22
|
+
- **Table of records with row actions** → `DataTableSection`, `Badge`, `Button`. Not: Table on its own, Card around a Table.
|
|
23
|
+
`<DataTableSection title="Projects" columns={[{ key, label }]} rows={[{ key, cells: [...], actions: <Stack direction="row" gap="tight">…</Stack> }]} />`; leave the actions column out of `columns`.
|
|
24
|
+
- **Switch between panels of related content** → `Tabs`, `TabsList`, `TabsTrigger`, `TabsContent`. Not: `SegmentedControl`, Button rows.
|
|
25
|
+
`<Tabs defaultValue="a"><TabsList><TabsTrigger value="a">A</TabsTrigger></TabsList><TabsContent value="a">…</TabsContent></Tabs>`.
|
|
26
|
+
- **Status label in a header or table cell** → `Badge`. Not: `Tag`, `Text`.
|
|
27
|
+
`<Badge tone="success|info|warning|danger|neutral|inProgress">…</Badge>`; tone is the only styling input.
|
|
28
|
+
- **Form with fields and a submit button** → `Form`, `Textarea`, `Input`, `FormActions`, `Button`. Not: a raw `<form>`, a Stack of Buttons as the footer.
|
|
29
|
+
`<Form onSubmit={…}><Textarea label="Notes" … /><FormActions primary={<Button type="submit">Save note</Button>} /></Form>`; every field takes its own `label`.
|
|
30
|
+
- **Confirm a destructive or irreversible action (delete, archive, remove)** → `AlertDialog`, `Button`. Not: `Dialog`, `window.confirm`.
|
|
31
|
+
Trigger, title, description, Cancel and Action parts: `<AlertDialog><AlertDialog.Trigger asChild><Button …>Archive</Button></AlertDialog.Trigger><AlertDialog.Content><AlertDialog.Header><AlertDialog.Title>…</AlertDialog.Title><AlertDialog.Description>…</AlertDialog.Description></AlertDialog.Header><AlertDialog.Footer><AlertDialog.Cancel asChild><Button variant="secondary">Cancel</Button></AlertDialog.Cancel><AlertDialog.Action asChild><Button tone="danger" onClick={…}>Archive</Button></AlertDialog.Action></AlertDialog.Footer></AlertDialog.Content></AlertDialog>`. Focus moves in and returns to the trigger for you.
|
|
32
|
+
- **Brief confirmation after an action (saved, archived, sent)** → `ToastProvider`, `useToast`. Not: `Badge`, `Alert`, `Text`.
|
|
33
|
+
Wrap the app root once in `<ToastProvider>`, then `toast({ title: "Note saved", tone: "success" })` from `useToast()`.
|
|
34
|
+
- **Message that stays next to its content (error, warning, info)** → `Alert`. Not: Text in a coloured Surface.
|
|
35
|
+
`<Alert tone="warning">…</Alert>`.
|
|
36
|
+
- **Button or row action** → `Button`. Not: a raw `<button>`, InlineLink for an action.
|
|
37
|
+
Row actions: `<Button variant="tertiary" size="sm" aria-label="View Brand refresh">View</Button>`; the destructive one adds `tone="danger"`.
|
|
38
|
+
- **Space between sections or items** → `Stack`, `Grid`. Not: margins on children, raw px gaps such as px8.
|
|
39
|
+
Stack `gap`: `spacious` between page sections, `normal` inside a section, `tight` between buttons. `Grid` for two-dimensional layout.
|
|
40
|
+
- **Padded background or a titled content object** → `Surface`, `Card`. Not: a Box with background and padding.
|
|
41
|
+
`Surface` for a plain padded background; `Card` only when the content has a title or can be pressed.
|
|
42
|
+
- **Progress bar or ring** → `Progress`. Not: a hand-built bar.
|
|
43
|
+
`<Progress value={60} label="Upload" />`; inside an existing `Card`, `CardProgress`.
|
|
44
|
+
- **Body copy** → `Text`. Not: Text as a section heading.
|
|
45
|
+
Section headings come from the pattern that owns the section (`PageHeader` `title`, `DataTableSection` `title`), not from extra Text.
|
|
46
|
+
- **Empty state for a list or section** → `EmptyState`. Not: Text saying "No items".
|
|
47
|
+
`DataTableSection` shows its own through `emptyTitle`; use `EmptyState` elsewhere.
|
|
48
|
+
- **The one irreversible action of a screen (delete the client, close the account)** → `DestructiveSection`. Not: a danger Button that acts without a confirm.
|
|
49
|
+
Last on the screen: `<DestructiveSection title="Delete client" description="…" actionLabel="Delete" onConfirm={…} />`; it opens its own AlertDialog. A per-row destructive action uses AlertDialog directly.
|
|
50
|
+
- **Read-only details as label and value pairs** → `MetadataList`, `Field`. Not: a Table with two columns, Text pairs in a Stack.
|
|
51
|
+
`<MetadataList items={[{ term: "Owner", description: "Ada" }]} />` for a set; `Field` for one pair.
|
|
52
|
+
- **A person, or a group of people** → `Avatar`, `AvatarGroup`. Not: an image in a rounded Box.
|
|
53
|
+
`<Avatar src alt initials />`; several in a row: `<AvatarGroup max={3}>…Avatars…</AvatarGroup>`.
|
|
54
|
+
- **A date or time** → `Timestamp`. Not: a formatted string in Text.
|
|
55
|
+
`<Timestamp date="2026-10-14" />` renders a `<time dateTime>`; a date in a table cell may stay plain text.
|
|
56
|
+
- **A keyboard key or shortcut hint** → `Kbd`. Not: `InlineCode`, Text in a Box.
|
|
57
|
+
`<Kbd>⌘K</Kbd>`.
|
|
58
|
+
- **A quotation with attribution** → `Blockquote`. Not: Callout for a quote, italic Text.
|
|
59
|
+
`<Blockquote attribution="Ada Lovelace">…</Blockquote>`.
|
|
60
|
+
- **A fixed-width side rail beside fluid content, or a row that stacks when narrow** → `Sidebar`, `Switcher`. Not: a Grid with media queries.
|
|
61
|
+
`Sidebar` (`side`, `sideWidth`) for rail + content; `Switcher` (`threshold`) for a row that flips to a column. Neither needs a media query.
|
|
62
|
+
- **Keep an element stuck while its region scrolls** → `Pin`. Not: position: sticky in style.
|
|
63
|
+
`<Pin top="…">…</Pin>` inside the scrolling region.
|
|
64
|
+
|
|
6
65
|
## System Architecture
|
|
7
66
|
|
|
8
67
|
- Engine: React + TypeScript
|
|
@@ -36,57 +95,105 @@ This file intentionally does not embed prop tables or long-form API docs.
|
|
|
36
95
|
- Detailed prop types, unions, defaults, and descriptions: read `src/app/data/component-api.json`.
|
|
37
96
|
- Runtime behavior: read the actual component source under `src/app/components/` (and associated styles).
|
|
38
97
|
|
|
98
|
+
## Core set
|
|
99
|
+
|
|
100
|
+
The 43 components of the ratified core set (hds#254, ADR-031): brand-neutral, composable, imported from the package root. Build a screen from these first. Each has `core: true` in `public/hds-manifest.json` and is marked `[core]` under "Which one when". Composed pattern modules (page shells, forms, code blocks, page sections) are imported from `@hirobius/design-system/patterns`.
|
|
101
|
+
|
|
102
|
+
- Button (Actions)
|
|
103
|
+
- Avatar (Display)
|
|
104
|
+
- Card (Display)
|
|
105
|
+
- EmptyState (Display)
|
|
106
|
+
- Field (Display)
|
|
107
|
+
- Icon (Display)
|
|
108
|
+
- Kbd (Display)
|
|
109
|
+
- Table (Display)
|
|
110
|
+
- Alert (Feedback)
|
|
111
|
+
- Badge (Feedback)
|
|
112
|
+
- Progress (Feedback)
|
|
113
|
+
- Skeleton (Feedback)
|
|
114
|
+
- Spinner (Feedback)
|
|
115
|
+
- ToastProvider (Feedback)
|
|
116
|
+
- Checkbox (Inputs)
|
|
117
|
+
- Combobox (Inputs)
|
|
118
|
+
- Input (Inputs)
|
|
119
|
+
- Radio (Inputs)
|
|
120
|
+
- SegmentedControl (Inputs)
|
|
121
|
+
- Select (Inputs)
|
|
122
|
+
- Slider (Inputs)
|
|
123
|
+
- Tag (Inputs)
|
|
124
|
+
- Textarea (Inputs)
|
|
125
|
+
- Toggle (Inputs)
|
|
126
|
+
- Box (Layout)
|
|
127
|
+
- Container (Layout)
|
|
128
|
+
- Disclosure (Layout)
|
|
129
|
+
- Divider (Layout)
|
|
130
|
+
- Grid (Layout)
|
|
131
|
+
- Stack (Layout)
|
|
132
|
+
- Surface (Layout)
|
|
133
|
+
- Breadcrumb (Navigation)
|
|
134
|
+
- InlineLink (Navigation)
|
|
135
|
+
- Pagination (Navigation)
|
|
136
|
+
- Tabs (Navigation)
|
|
137
|
+
- Dialog (Overlays)
|
|
138
|
+
- Menu (Overlays)
|
|
139
|
+
- Popover (Overlays)
|
|
140
|
+
- Tooltip (Overlays)
|
|
141
|
+
- HdsRouterProvider (Theming)
|
|
142
|
+
- HdsThemeProvider (Theming)
|
|
143
|
+
- Text (Typography)
|
|
144
|
+
- VisuallyHidden (Utility)
|
|
145
|
+
|
|
39
146
|
## Which one when
|
|
40
147
|
|
|
41
|
-
One line per component that declares when to use it (`@usage` / `@useInstead` in its JSDoc). Full detail, including `usage.whenNot`, `keyboard` and `aiRules`, is in `public/hds-manifest.json` and `src/app/data/component-api.json`.
|
|
42
|
-
|
|
43
|
-
Alert: Show a persistent inline message with a severity, next to the content it concerns. Use instead: ToastProvider, Badge
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
Card: Group related content on a raised surface with header, body, footer and metric slots. Use instead: Surface, Card.Metric
|
|
51
|
-
CardMetric: Show one headline figure (a KPI, a count, a total) with its label inside a Card.
|
|
52
|
-
Checkbox: Let people tick one or more independent options, or a parent choice that is partly selected. Use instead: Toggle, Radio
|
|
53
|
-
Combobox: Pick one value from a long list of options, with a search field that filters as you type. Use instead: Select, Menu
|
|
54
|
-
Container: Constrain a page region to the content or maximum width and centre it. Use instead: Stack, Grid, Box
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
HdsThemeProvider: Wrap an app or region once to set theme, density and other root attributes for everything inside it. Use instead: Surface
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
VisuallyHidden: Give assistive technology a label or description that sighted people do not need to see. Use instead: Text
|
|
148
|
+
One line per component that declares when to use it (`@usage` / `@useInstead` in its JSDoc); `[core]` marks the core set. Full detail, including `usage.whenNot`, `keyboard` and `aiRules`, is in `public/hds-manifest.json` and `src/app/data/component-api.json`.
|
|
149
|
+
|
|
150
|
+
Alert: [core] Show a persistent inline message with a severity, next to the content it concerns. Use instead: ToastProvider, Badge
|
|
151
|
+
AlertDialog: Confirm a destructive or irreversible action (delete, archive, remove) before it runs, with Cancel and Action buttons. Use instead: Dialog, ToastProvider
|
|
152
|
+
Avatar: [core] Show a person or entity as an image with an initials fallback. Use instead: Icon, Badge
|
|
153
|
+
Badge: [core] Label a status, state or count with a compact neutral or semantic chip, or a dot. Use instead: Tag, Alert
|
|
154
|
+
Box: [core] Build one-off layout that no named layout primitive covers, using token keys through `sx`. Use instead: Stack, Grid, Container
|
|
155
|
+
Breadcrumb: [core] Show where the current page sits in a hierarchy and link back up it. Use instead: Tabs, Pagination
|
|
156
|
+
Button: [core] Trigger an action (submit, save, open a dialog) with a text label and optional icons; for an icon-only control pass iconOnly with iconLeft and label; for an on/off toggle pass pressed. Use instead: InlineLink
|
|
157
|
+
Card: [core] Group related content on a raised surface with header, body, footer and metric slots, or as one selectable option. Use instead: Surface, Card.Metric
|
|
158
|
+
CardMetric: Show one headline figure (a KPI, a count, a total) with its label inside a Card. Use instead: MetricTiles
|
|
159
|
+
Checkbox: [core] Let people tick one or more independent options, or a parent choice that is partly selected. Use instead: Toggle, Radio
|
|
160
|
+
Combobox: [core] Pick one value, or several with `multiple`, from a long list of options, with a search field that filters as you type. Use instead: Select, Menu
|
|
161
|
+
Container: [core] Constrain a page region to the content or maximum width and centre it. Use instead: Stack, Grid, Box
|
|
162
|
+
Dialog: [core] Interrupt the page with a modal that needs a decision or focused input before people continue. Use instead: Tooltip, Alert, ToastProvider, AlertDialog
|
|
163
|
+
Disclosure: [core] Hide optional explanatory content behind a heading that people can expand. Use instead: Tabs
|
|
164
|
+
Divider: [core] Separate two regions of content with a thin semantic rule. Use instead: Stack, Surface
|
|
165
|
+
EmptyState: [core] Say that a list, grid or section has no data yet, with a title and an optional description. Use instead: Skeleton, Alert
|
|
166
|
+
Field: [core] Show a labelled read-only value, such as a name and its value in a detail view. Use instead: Input, Card.Metric
|
|
167
|
+
Grid: [core] Lay out content in responsive columns with token-governed gaps, or align nested content with subgrid. Use instead: Stack, Box
|
|
168
|
+
HdsRouterProvider: [core] Wrap the app root once so HDS links and navigation use your client router; with no provider they stay plain anchors.
|
|
169
|
+
HdsThemeProvider: [core] Wrap an app or region once to set theme, density and other root attributes for everything inside it. Use instead: Surface
|
|
170
|
+
Icon: [core] Draw a Lucide glyph at a size and colour from the design tokens. Use instead: Button, Avatar
|
|
171
|
+
InlineLink: [core] Link to a route or external URL from inside body copy. Use instead: Button, Text
|
|
172
|
+
Input: [core] Collect a single line of text, a number, an email, a password, a date or a time, with label, helper and error slots. Use instead: Textarea, Select, Combobox
|
|
173
|
+
Kbd: [core] Show a keyboard key or shortcut hint inline, as a native kbd element. Use instead: Text
|
|
174
|
+
Menu: [core] Offer a list of actions from a trigger, closed until opened. Use instead: Select
|
|
175
|
+
Pagination: [core] Move between pages of a long result set, with truncated page numbers. Use instead: Breadcrumb
|
|
176
|
+
Popover: [core] Anchor interactive content, such as a short form, a filter set or a picker, to a trigger people click to open. Use instead: Tooltip, Menu, Dialog
|
|
177
|
+
Progress: [core] Show how far a task has got, as a bar or ring that is determinate or indeterminate. Use instead: Spinner, Skeleton
|
|
178
|
+
Radio: [core] Choose exactly one option from a small set that should stay visible together. Use instead: Checkbox, Select, SegmentedControl
|
|
179
|
+
SegmentedControl: [core] Switch between two to five mutually exclusive views or modes in a compact row. Use instead: Radio, Tabs, Select
|
|
180
|
+
Select: [core] Choose one value from a short list of options in a form field. Use instead: Menu, Combobox
|
|
181
|
+
Skeleton: [core] Reserve the shape of content that is still loading, so the layout does not jump. Use instead: Progress, Spinner
|
|
182
|
+
Slider: [core] Pick a number within a known range by dragging, when the exact value matters less than the position. Use instead: Input
|
|
183
|
+
Spinner: [core] Show that something is loading when the wait is short or has no measurable end. Use instead: Progress, Skeleton
|
|
184
|
+
Stack: [core] Space a row or column of content with token gaps and simple flex alignment. Use instead: Grid, Surface
|
|
185
|
+
Stat: Show one headline figure inline, inside prose or a dense list, with its label and an optional sub-line. Use instead: MetricTiles, Card.Metric, StatusTile
|
|
186
|
+
StatusTile: Show a titled status block with optional notes and a trailing badge or affordance. Use instead: MetricTiles, Card.Metric, StatusListItem
|
|
187
|
+
Surface: [core] Wrap content in a padded, background-bearing inset surface with no header or footer anatomy. Use instead: Card, Stack
|
|
188
|
+
Table: [core] Show rows of structured data in aligned columns, with optional sorting. Use instead: Field, Stack
|
|
189
|
+
Tabs: [core] Switch between panels of related content in the same place, one visible at a time. Use instead: SegmentedControl, Disclosure
|
|
190
|
+
Tag: [core] Show an interactive filter or category chip that people can toggle. Use instead: Badge
|
|
191
|
+
Text: [core] Set any text on the type ramp, with the element chosen by `as`. Use instead: InlineLink, Kbd
|
|
192
|
+
Textarea: [core] Collect multi-line free text such as a message, note or description. Use instead: Input
|
|
193
|
+
ToastProvider: [core] Confirm an action with a brief message that appears and dismisses itself, through useToast. Use instead: Alert, Dialog
|
|
194
|
+
Toggle: [core] Switch one setting on or off, with the effect applying immediately. Use instead: Checkbox, Radio
|
|
195
|
+
Tooltip: [core] Name an icon-only control, or add a short hint that appears on hover and keyboard focus. Use instead: Popover, Text
|
|
196
|
+
VisuallyHidden: [core] Give assistive technology a label or description that sighted people do not need to see. Use instead: Text
|
|
90
197
|
|
|
91
198
|
## Tokens (Primary Source Of Truth)
|
|
92
199
|
|
|
@@ -111,16 +218,16 @@ VisuallyHidden: Give assistive technology a label or description that sighted pe
|
|
|
111
218
|
|
|
112
219
|
Canonical skeleton, outermost to innermost:
|
|
113
220
|
|
|
114
|
-
1. `Page` (or `Container
|
|
221
|
+
1. `Page` (from `@hirobius/design-system/patterns`; or `Container` for a full-bleed, non-page surface, with a `Box` inside it for a horizontal gutter) for the outermost width constraint. Never import `Container` directly inside `src/app/pages/**` — use `Page`, which wraps it and owns vertical rhythm.
|
|
115
222
|
2. `Stack` (vertical rhythm between sections) or `Grid` (two-dimensional/column layout) for the structural skeleton. One section = one Section/Stack — never add a second wrapper to fake a section boundary.
|
|
116
|
-
3. Reach for a named
|
|
223
|
+
3. Reach for a named layout primitive before hand-rolling flex/grid math for a common intent: `Stack direction="row" wrap="wrap"` (wrapping row of same-ish things), `Sidebar` (fixed-width rail + fluid content, no media query), `Switcher` (row that flips to a column below a threshold, no media query). A full-height shell with a centered main region, an aspect-ratio-locked media box or a negative margin that escapes a parent padding is a `Box` with `style` (not `sx`, which applies on the client only).
|
|
117
224
|
4. `Surface` for any background-bearing, padded wrapper (card, panel, inset). Never a raw element with backgroundColor + padding hand-rolled inline.
|
|
118
|
-
5. Use the screen patterns (`@hirobius/design-system/patterns`) for the parts every screen repeats: `PageHeader` once at the top (breadcrumb, `heading2` title, status, actions), `MetricTiles` for any row of headline numbers, `FormActions` for a form footer (primary right-most and last in DOM order, destructive on the far left), `DataTableSection` for a titled table (toolbar slot, consumer row actions, empty state, scrolls on narrow widths without a caller `minWidth`), and `DestructiveSection` last for an irreversible action (danger button, then an `AlertDialog` confirm).
|
|
225
|
+
5. Use the screen patterns (`@hirobius/design-system/patterns`) for the parts every screen repeats: `PageHeader` once at the top (breadcrumb, `heading2` title, status, actions), `MetricTiles` for any row of headline numbers, `FormActions` for a form footer (primary right-most and last in DOM order, destructive on the far left), `DataTableSection` for a titled table (toolbar slot, consumer row actions, empty state, scrolls on narrow widths without a caller `minWidth`), and `DestructiveSection` last for an irreversible action (danger button, then an `AlertDialog` confirm). A row of headline numbers is always `MetricTiles`; `Stat`, `Card.Metric` and `StatusTile` answer other needs (see "Pick By Need" in `llms.txt`). Pick between `Card` and `Surface` with the "Which one, when" table in `DESIGN.md`.
|
|
119
226
|
6. `Box` `sx` LAST — only for genuinely one-off layout that no named primitive covers. `sx` spacing/color keys MUST be HDS token keys, never raw hex/px.
|
|
120
227
|
|
|
121
228
|
Negative rules (apply everywhere, checked by `scripts/audit-tokens.mjs --full`, `check-hardcoded-spacing.mjs`, `check-hardcoded-colors.mjs`):
|
|
122
229
|
|
|
123
|
-
- No inline margins on children to fake spacing between siblings — gap/spacing on the parent (Stack/Grid/
|
|
230
|
+
- No inline margins on children to fake spacing between siblings — gap/spacing on the parent (Stack/Grid/Switcher/Sidebar) owns rhythm, not margin on the child.
|
|
124
231
|
- No raw px or hex values in any layout or color prop — every spacing value comes from the semantic gap scale (`tight | normal | inset | spacious`, or a component/subgrid step) and every color comes from a `semantic.color.*` token.
|
|
125
232
|
- No repeated outlined cards as the default structure for roadmap/status/process/overview UI — use open bands, dividers, rails, disclosures, and whitespace instead.
|
|
126
233
|
|
|
@@ -175,7 +282,7 @@ When building any card component or card-like surface, ALL of the following rule
|
|
|
175
282
|
|
|
176
283
|
Cards default to `elevation.flat`. Popovers/tooltips/dropdowns use `elevation.floating`. Dialogs/sheets use `elevation.overlay`. Interactive cards lift to `elevation.raised` on hover. Never combine `raised` with a border — depth is one mechanism (border OR shadow), not both stacked.
|
|
177
284
|
|
|
178
|
-
Overlays (Dialog, AlertDialog, Menu,
|
|
285
|
+
Overlays (Dialog, AlertDialog, Menu, Popover, Select, Tooltip) portal into the nearest `data-hds` scope, so they inherit its theme (for example `<div data-hds data-theme="dark">`); pass `container` on the Content part to override.
|
|
179
286
|
|
|
180
287
|
## Slices And Full Bundle
|
|
181
288
|
|
|
@@ -219,19 +326,19 @@ On-demand only (load only if explicitly requested or the task clearly requires i
|
|
|
219
326
|
Icons come from the curated subpath `@hirobius/design-system/icons`; nothing extra to install.
|
|
220
327
|
|
|
221
328
|
```tsx
|
|
222
|
-
import {
|
|
329
|
+
import { Button, Icon } from '@hirobius/design-system';
|
|
223
330
|
import { Ellipsis } from '@hirobius/design-system/icons';
|
|
224
331
|
|
|
225
|
-
<
|
|
332
|
+
<Button iconOnly label="Row actions" iconLeft={<Icon icon={Ellipsis} />} />
|
|
226
333
|
```
|
|
227
334
|
|
|
228
|
-
Rule: icon-only actions (row menus, close, edit) use `
|
|
335
|
+
Rule: icon-only actions (row menus, close, edit) use `Button iconOnly` with a `label` and an `Icon` in `iconLeft`; do not hand-roll a button with a glyph or text "...".
|
|
229
336
|
|
|
230
337
|
Names: Archive, ArrowDown, ArrowLeft, ArrowRight, ArrowUp, Bell, Bookmark, Calendar, Check, ChevronDown, ChevronLeft, ChevronRight, ChevronUp, CircleAlert, CircleCheck, CircleHelp, Clock, Copy, Download, Ellipsis, EllipsisVertical, ExternalLink, Eye, EyeOff, FileText, Funnel, Heart, House, Image, Info, Link, Lock, LogIn, LogOut, Mail, Menu, Minus, Pencil, Plus, RefreshCw, Save, Search, Settings, Share, Star, Trash2, TriangleAlert, Upload, User, X
|
|
231
338
|
|
|
232
339
|
Legacy names map to canonical ones: MoreHorizontal -> Ellipsis, MoreVertical -> EllipsisVertical, AlertTriangle -> TriangleAlert, Home -> House, Filter -> Funnel.
|
|
233
340
|
|
|
234
|
-
Name collisions: `
|
|
341
|
+
Name collisions: `Menu` shares a name with an HDS component; alias the icon: `import { Menu as MenuIcon } from '@hirobius/design-system/icons'`. For an icon outside the set, install `lucide-react@0.487.0` (same version keeps the `LucideIcon` type identical).
|
|
235
342
|
|
|
236
343
|
## Token Rules
|
|
237
344
|
|