@helixds/react 0.0.0-stage → 0.1.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 +292 -0
- package/LICENSE +21 -0
- package/README.md +49 -2
- package/dist/components/Accordion/Accordion.d.ts +14 -0
- package/dist/components/Accordion/Accordion.doc.d.ts +4 -0
- package/dist/components/Accordion/Accordion.doc.js +27 -0
- package/dist/components/Accordion/Accordion.js +76 -0
- package/dist/components/Accordion/Accordion.types.d.ts +24 -0
- package/dist/components/Accordion/Accordion.types.js +2 -0
- package/dist/components/Accordion/index.d.ts +9 -0
- package/dist/components/Accordion/index.js +2 -0
- package/dist/components/Avatar/Avatar.d.ts +14 -0
- package/dist/components/Avatar/Avatar.doc.d.ts +4 -0
- package/dist/components/Avatar/Avatar.doc.js +34 -0
- package/dist/components/Avatar/Avatar.js +14 -0
- package/dist/components/Avatar/Avatar.types.d.ts +20 -0
- package/dist/components/Avatar/Avatar.types.js +2 -0
- package/dist/components/Avatar/index.d.ts +9 -0
- package/dist/components/Avatar/index.js +2 -0
- package/dist/components/AvatarGroup/AvatarGroup.d.ts +14 -0
- package/dist/components/AvatarGroup/AvatarGroup.doc.d.ts +4 -0
- package/dist/components/AvatarGroup/AvatarGroup.doc.js +30 -0
- package/dist/components/AvatarGroup/AvatarGroup.js +15 -0
- package/dist/components/AvatarGroup/AvatarGroup.types.d.ts +21 -0
- package/dist/components/AvatarGroup/AvatarGroup.types.js +2 -0
- package/dist/components/AvatarGroup/index.d.ts +9 -0
- package/dist/components/AvatarGroup/index.js +2 -0
- package/dist/components/Badge/Badge.d.ts +16 -0
- package/dist/components/Badge/Badge.doc.d.ts +4 -0
- package/dist/components/Badge/Badge.doc.js +69 -0
- package/dist/components/Badge/Badge.js +23 -0
- package/dist/components/Badge/Badge.types.d.ts +22 -0
- package/dist/components/Badge/Badge.types.js +2 -0
- package/dist/components/Badge/index.d.ts +9 -0
- package/dist/components/Badge/index.js +2 -0
- package/dist/components/Button/Button.d.ts +11 -0
- package/dist/components/Button/Button.doc.d.ts +4 -0
- package/dist/components/Button/Button.doc.js +98 -0
- package/dist/components/Button/Button.js +80 -0
- package/dist/components/Button/Button.types.d.ts +29 -0
- package/dist/components/Button/Button.types.js +2 -0
- package/dist/components/Button/index.d.ts +9 -0
- package/dist/components/Button/index.js +2 -0
- package/dist/components/Card/Card.d.ts +14 -0
- package/dist/components/Card/Card.doc.d.ts +4 -0
- package/dist/components/Card/Card.doc.js +44 -0
- package/dist/components/Card/Card.js +9 -0
- package/dist/components/Card/Card.types.d.ts +19 -0
- package/dist/components/Card/Card.types.js +2 -0
- package/dist/components/Card/index.d.ts +9 -0
- package/dist/components/Card/index.js +2 -0
- package/dist/components/Chart/Chart.d.ts +14 -0
- package/dist/components/Chart/Chart.doc.d.ts +4 -0
- package/dist/components/Chart/Chart.doc.js +49 -0
- package/dist/components/Chart/Chart.js +184 -0
- package/dist/components/Chart/Chart.types.d.ts +21 -0
- package/dist/components/Chart/Chart.types.js +2 -0
- package/dist/components/Chart/index.d.ts +9 -0
- package/dist/components/Chart/index.js +2 -0
- package/dist/components/Checkbox/Checkbox.d.ts +12 -0
- package/dist/components/Checkbox/Checkbox.doc.d.ts +4 -0
- package/dist/components/Checkbox/Checkbox.doc.js +54 -0
- package/dist/components/Checkbox/Checkbox.js +23 -0
- package/dist/components/Checkbox/Checkbox.types.d.ts +22 -0
- package/dist/components/Checkbox/Checkbox.types.js +2 -0
- package/dist/components/Checkbox/index.d.ts +9 -0
- package/dist/components/Checkbox/index.js +2 -0
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +13 -0
- package/dist/components/CheckboxGroup/CheckboxGroup.doc.d.ts +4 -0
- package/dist/components/CheckboxGroup/CheckboxGroup.doc.js +56 -0
- package/dist/components/CheckboxGroup/CheckboxGroup.js +27 -0
- package/dist/components/CheckboxGroup/CheckboxGroup.types.d.ts +28 -0
- package/dist/components/CheckboxGroup/CheckboxGroup.types.js +2 -0
- package/dist/components/CheckboxGroup/index.d.ts +9 -0
- package/dist/components/CheckboxGroup/index.js +2 -0
- package/dist/components/Chip/Chip.d.ts +11 -0
- package/dist/components/Chip/Chip.doc.d.ts +4 -0
- package/dist/components/Chip/Chip.doc.js +105 -0
- package/dist/components/Chip/Chip.js +30 -0
- package/dist/components/Chip/Chip.types.d.ts +31 -0
- package/dist/components/Chip/Chip.types.js +2 -0
- package/dist/components/Chip/index.d.ts +9 -0
- package/dist/components/Chip/index.js +2 -0
- package/dist/components/ChipGroup/ChipGroup.d.ts +12 -0
- package/dist/components/ChipGroup/ChipGroup.doc.d.ts +4 -0
- package/dist/components/ChipGroup/ChipGroup.doc.js +31 -0
- package/dist/components/ChipGroup/ChipGroup.js +9 -0
- package/dist/components/ChipGroup/ChipGroup.types.d.ts +27 -0
- package/dist/components/ChipGroup/ChipGroup.types.js +2 -0
- package/dist/components/ChipGroup/index.d.ts +9 -0
- package/dist/components/ChipGroup/index.js +2 -0
- package/dist/components/FAB/FAB.d.ts +11 -0
- package/dist/components/FAB/FAB.doc.d.ts +4 -0
- package/dist/components/FAB/FAB.doc.js +52 -0
- package/dist/components/FAB/FAB.js +133 -0
- package/dist/components/FAB/FAB.types.d.ts +37 -0
- package/dist/components/FAB/FAB.types.js +2 -0
- package/dist/components/FAB/index.d.ts +9 -0
- package/dist/components/FAB/index.js +2 -0
- package/dist/components/Icon/Icon.d.ts +14 -0
- package/dist/components/Icon/Icon.doc.d.ts +4 -0
- package/dist/components/Icon/Icon.doc.js +38 -0
- package/dist/components/Icon/Icon.js +15 -0
- package/dist/components/Icon/Icon.types.d.ts +47 -0
- package/dist/components/Icon/Icon.types.js +2 -0
- package/dist/components/Icon/createIconAdapter.d.ts +24 -0
- package/dist/components/Icon/createIconAdapter.js +28 -0
- package/dist/components/Icon/iconStroke.d.ts +20 -0
- package/dist/components/Icon/iconStroke.js +54 -0
- package/dist/components/Icon/index.d.ts +12 -0
- package/dist/components/Icon/index.js +4 -0
- package/dist/components/IconButton/IconButton.d.ts +11 -0
- package/dist/components/IconButton/IconButton.doc.d.ts +4 -0
- package/dist/components/IconButton/IconButton.doc.js +76 -0
- package/dist/components/IconButton/IconButton.js +20 -0
- package/dist/components/IconButton/IconButton.types.d.ts +25 -0
- package/dist/components/IconButton/IconButton.types.js +2 -0
- package/dist/components/IconButton/index.d.ts +9 -0
- package/dist/components/IconButton/index.js +2 -0
- package/dist/components/Input/Input.d.ts +11 -0
- package/dist/components/Input/Input.doc.d.ts +4 -0
- package/dist/components/Input/Input.doc.js +68 -0
- package/dist/components/Input/Input.js +48 -0
- package/dist/components/Input/Input.types.d.ts +36 -0
- package/dist/components/Input/Input.types.js +2 -0
- package/dist/components/Input/index.d.ts +9 -0
- package/dist/components/Input/index.js +2 -0
- package/dist/components/Menu/Menu.d.ts +14 -0
- package/dist/components/Menu/Menu.doc.d.ts +4 -0
- package/dist/components/Menu/Menu.doc.js +46 -0
- package/dist/components/Menu/Menu.js +105 -0
- package/dist/components/Menu/Menu.types.d.ts +34 -0
- package/dist/components/Menu/Menu.types.js +2 -0
- package/dist/components/Menu/index.d.ts +9 -0
- package/dist/components/Menu/index.js +2 -0
- package/dist/components/Modal/Modal.d.ts +14 -0
- package/dist/components/Modal/Modal.doc.d.ts +4 -0
- package/dist/components/Modal/Modal.doc.js +52 -0
- package/dist/components/Modal/Modal.js +30 -0
- package/dist/components/Modal/Modal.types.d.ts +36 -0
- package/dist/components/Modal/Modal.types.js +2 -0
- package/dist/components/Modal/index.d.ts +9 -0
- package/dist/components/Modal/index.js +2 -0
- package/dist/components/MultiSelect/MultiSelect.d.ts +17 -0
- package/dist/components/MultiSelect/MultiSelect.doc.d.ts +4 -0
- package/dist/components/MultiSelect/MultiSelect.doc.js +37 -0
- package/dist/components/MultiSelect/MultiSelect.js +165 -0
- package/dist/components/MultiSelect/MultiSelect.types.d.ts +50 -0
- package/dist/components/MultiSelect/MultiSelect.types.js +2 -0
- package/dist/components/MultiSelect/index.d.ts +9 -0
- package/dist/components/MultiSelect/index.js +2 -0
- package/dist/components/NavItem/NavItem.d.ts +14 -0
- package/dist/components/NavItem/NavItem.doc.d.ts +4 -0
- package/dist/components/NavItem/NavItem.doc.js +31 -0
- package/dist/components/NavItem/NavItem.js +21 -0
- package/dist/components/NavItem/NavItem.types.d.ts +20 -0
- package/dist/components/NavItem/NavItem.types.js +2 -0
- package/dist/components/NavItem/index.d.ts +9 -0
- package/dist/components/NavItem/index.js +2 -0
- package/dist/components/RadioButton/RadioButton.d.ts +14 -0
- package/dist/components/RadioButton/RadioButton.doc.d.ts +4 -0
- package/dist/components/RadioButton/RadioButton.doc.js +35 -0
- package/dist/components/RadioButton/RadioButton.js +15 -0
- package/dist/components/RadioButton/RadioButton.types.d.ts +33 -0
- package/dist/components/RadioButton/RadioButton.types.js +2 -0
- package/dist/components/RadioButton/index.d.ts +9 -0
- package/dist/components/RadioButton/index.js +2 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +12 -0
- package/dist/components/RadioGroup/RadioGroup.doc.d.ts +4 -0
- package/dist/components/RadioGroup/RadioGroup.doc.js +80 -0
- package/dist/components/RadioGroup/RadioGroup.js +19 -0
- package/dist/components/RadioGroup/RadioGroup.types.d.ts +28 -0
- package/dist/components/RadioGroup/RadioGroup.types.js +2 -0
- package/dist/components/RadioGroup/index.d.ts +9 -0
- package/dist/components/RadioGroup/index.js +2 -0
- package/dist/components/SegmentedControl/SegmentedControl.d.ts +13 -0
- package/dist/components/SegmentedControl/SegmentedControl.doc.d.ts +4 -0
- package/dist/components/SegmentedControl/SegmentedControl.doc.js +50 -0
- package/dist/components/SegmentedControl/SegmentedControl.js +64 -0
- package/dist/components/SegmentedControl/SegmentedControl.types.d.ts +26 -0
- package/dist/components/SegmentedControl/SegmentedControl.types.js +2 -0
- package/dist/components/SegmentedControl/index.d.ts +9 -0
- package/dist/components/SegmentedControl/index.js +2 -0
- package/dist/components/Select/Select.d.ts +13 -0
- package/dist/components/Select/Select.doc.d.ts +4 -0
- package/dist/components/Select/Select.doc.js +66 -0
- package/dist/components/Select/Select.js +138 -0
- package/dist/components/Select/Select.types.d.ts +36 -0
- package/dist/components/Select/Select.types.js +2 -0
- package/dist/components/Select/index.d.ts +9 -0
- package/dist/components/Select/index.js +2 -0
- package/dist/components/SidePanel/SidePanel.d.ts +14 -0
- package/dist/components/SidePanel/SidePanel.doc.d.ts +4 -0
- package/dist/components/SidePanel/SidePanel.doc.js +29 -0
- package/dist/components/SidePanel/SidePanel.js +19 -0
- package/dist/components/SidePanel/SidePanel.types.d.ts +28 -0
- package/dist/components/SidePanel/SidePanel.types.js +2 -0
- package/dist/components/SidePanel/index.d.ts +9 -0
- package/dist/components/SidePanel/index.js +2 -0
- package/dist/components/Switch/Switch.d.ts +13 -0
- package/dist/components/Switch/Switch.doc.d.ts +4 -0
- package/dist/components/Switch/Switch.doc.js +56 -0
- package/dist/components/Switch/Switch.js +45 -0
- package/dist/components/Switch/Switch.types.d.ts +21 -0
- package/dist/components/Switch/Switch.types.js +2 -0
- package/dist/components/Switch/index.d.ts +9 -0
- package/dist/components/Switch/index.js +2 -0
- package/dist/components/Table/Table.d.ts +34 -0
- package/dist/components/Table/Table.doc.d.ts +4 -0
- package/dist/components/Table/Table.doc.js +48 -0
- package/dist/components/Table/Table.js +17 -0
- package/dist/components/Table/Table.types.d.ts +30 -0
- package/dist/components/Table/Table.types.js +2 -0
- package/dist/components/Table/index.d.ts +9 -0
- package/dist/components/Table/index.js +2 -0
- package/dist/components/Textarea/Textarea.d.ts +9 -0
- package/dist/components/Textarea/Textarea.doc.d.ts +4 -0
- package/dist/components/Textarea/Textarea.doc.js +60 -0
- package/dist/components/Textarea/Textarea.js +24 -0
- package/dist/components/Textarea/Textarea.types.d.ts +22 -0
- package/dist/components/Textarea/Textarea.types.js +2 -0
- package/dist/components/Textarea/index.d.ts +9 -0
- package/dist/components/Textarea/index.js +2 -0
- package/dist/components/Toast/Toast.d.ts +16 -0
- package/dist/components/Toast/Toast.doc.d.ts +4 -0
- package/dist/components/Toast/Toast.doc.js +37 -0
- package/dist/components/Toast/Toast.js +134 -0
- package/dist/components/Toast/Toast.types.d.ts +11 -0
- package/dist/components/Toast/Toast.types.js +2 -0
- package/dist/components/Toast/index.d.ts +10 -0
- package/dist/components/Toast/index.js +2 -0
- package/dist/components/Toast/toastStore.d.ts +36 -0
- package/dist/components/Toast/toastStore.js +57 -0
- package/dist/components/Tooltip/Tooltip.d.ts +14 -0
- package/dist/components/Tooltip/Tooltip.doc.d.ts +4 -0
- package/dist/components/Tooltip/Tooltip.doc.js +33 -0
- package/dist/components/Tooltip/Tooltip.js +105 -0
- package/dist/components/Tooltip/Tooltip.types.d.ts +21 -0
- package/dist/components/Tooltip/Tooltip.types.js +2 -0
- package/dist/components/Tooltip/index.d.ts +9 -0
- package/dist/components/Tooltip/index.js +2 -0
- package/dist/contracts/Accordion.json +174 -0
- package/dist/contracts/AppShell.json +118 -0
- package/dist/contracts/Avatar.json +157 -0
- package/dist/contracts/AvatarGroup.json +169 -0
- package/dist/contracts/Badge.json +212 -0
- package/dist/contracts/Button.json +295 -0
- package/dist/contracts/Card.json +125 -0
- package/dist/contracts/Chart.json +167 -0
- package/dist/contracts/Checkbox.json +333 -0
- package/dist/contracts/CheckboxGroup.json +200 -0
- package/dist/contracts/Chip.json +320 -0
- package/dist/contracts/ChipGroup.json +182 -0
- package/dist/contracts/FAB.json +215 -0
- package/dist/contracts/Icon.json +306 -0
- package/dist/contracts/IconButton.json +213 -0
- package/dist/contracts/Input.json +400 -0
- package/dist/contracts/Menu.json +197 -0
- package/dist/contracts/Modal.json +192 -0
- package/dist/contracts/MultiSelect.json +244 -0
- package/dist/contracts/NavItem.json +148 -0
- package/dist/contracts/PageHeader.json +134 -0
- package/dist/contracts/RadioButton.json +202 -0
- package/dist/contracts/RadioGroup.json +228 -0
- package/dist/contracts/SegmentedControl.json +193 -0
- package/dist/contracts/Select.json +241 -0
- package/dist/contracts/SideNav.json +138 -0
- package/dist/contracts/SidePanel.json +153 -0
- package/dist/contracts/Switch.json +201 -0
- package/dist/contracts/Table.json +130 -0
- package/dist/contracts/Textarea.json +353 -0
- package/dist/contracts/Toast.json +186 -0
- package/dist/contracts/Tooltip.json +168 -0
- package/dist/contracts/TopBar.json +127 -0
- package/dist/contracts/manifest.json +675 -0
- package/dist/index.d.ts +109 -0
- package/dist/index.js +73 -0
- package/dist/layout/AppShell/AppShell.d.ts +14 -0
- package/dist/layout/AppShell/AppShell.doc.d.ts +4 -0
- package/dist/layout/AppShell/AppShell.doc.js +27 -0
- package/dist/layout/AppShell/AppShell.js +9 -0
- package/dist/layout/AppShell/AppShell.types.d.ts +18 -0
- package/dist/layout/AppShell/AppShell.types.js +2 -0
- package/dist/layout/AppShell/index.d.ts +9 -0
- package/dist/layout/AppShell/index.js +2 -0
- package/dist/layout/PageHeader/PageHeader.d.ts +14 -0
- package/dist/layout/PageHeader/PageHeader.doc.d.ts +4 -0
- package/dist/layout/PageHeader/PageHeader.doc.js +30 -0
- package/dist/layout/PageHeader/PageHeader.js +10 -0
- package/dist/layout/PageHeader/PageHeader.types.d.ts +21 -0
- package/dist/layout/PageHeader/PageHeader.types.js +2 -0
- package/dist/layout/PageHeader/index.d.ts +9 -0
- package/dist/layout/PageHeader/index.js +2 -0
- package/dist/layout/SideNav/SideNav.d.ts +14 -0
- package/dist/layout/SideNav/SideNav.doc.d.ts +4 -0
- package/dist/layout/SideNav/SideNav.doc.js +32 -0
- package/dist/layout/SideNav/SideNav.js +9 -0
- package/dist/layout/SideNav/SideNav.types.d.ts +18 -0
- package/dist/layout/SideNav/SideNav.types.js +2 -0
- package/dist/layout/SideNav/index.d.ts +9 -0
- package/dist/layout/SideNav/index.js +2 -0
- package/dist/layout/TopBar/TopBar.d.ts +14 -0
- package/dist/layout/TopBar/TopBar.doc.d.ts +4 -0
- package/dist/layout/TopBar/TopBar.doc.js +28 -0
- package/dist/layout/TopBar/TopBar.js +9 -0
- package/dist/layout/TopBar/TopBar.types.d.ts +16 -0
- package/dist/layout/TopBar/TopBar.types.js +2 -0
- package/dist/layout/TopBar/index.d.ts +9 -0
- package/dist/layout/TopBar/index.js +2 -0
- package/dist/lib/component-doc.d.ts +34 -0
- package/dist/lib/component-doc.js +2 -0
- package/dist/lib/motionPresets.d.ts +37 -0
- package/dist/lib/motionPresets.js +35 -0
- package/dist/lib/resolveTokenPx.d.ts +11 -0
- package/dist/lib/resolveTokenPx.js +17 -0
- package/dist/lib/useDialogTransition.d.ts +21 -0
- package/dist/lib/useDialogTransition.js +86 -0
- package/dist/lib/useDisclosureTransition.d.ts +19 -0
- package/dist/lib/useDisclosureTransition.js +41 -0
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.js +6 -0
- package/dist/patterns/action-bar.md +127 -0
- package/dist/patterns/border-always.md +40 -0
- package/dist/patterns/data-analytics.md +15 -0
- package/dist/patterns/disabled-state.md +80 -0
- package/dist/patterns/empty-state.md +130 -0
- package/dist/patterns/expand-collapse-chevron.md +101 -0
- package/dist/patterns/form-field-group.md +139 -0
- package/dist/patterns/form-field-spacing.md +99 -0
- package/dist/patterns/group-spacing.md +54 -0
- package/dist/patterns/motion-effects.md +100 -0
- package/dist/patterns/same-row-sizing.md +52 -0
- package/dist/patterns/search-filter.md +118 -0
- package/dist/patterns/show-hide-parts.md +53 -0
- package/dist/patterns/stat-card.md +105 -0
- package/dist/patterns/status-row.md +130 -0
- package/dist/patterns/view-toggle.md +81 -0
- package/dist/prop-map.md +80 -0
- package/package.json +70 -3
- package/src/globals.css +3195 -0
package/AGENTS.md
ADDED
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
# Helix DS — Consumer Agent Guide
|
|
2
|
+
|
|
3
|
+
> For teams using Helix in their apps. If you're contributing to Helix itself, read `contributor-ai/CONTRIBUTOR.md` instead.
|
|
4
|
+
|
|
5
|
+
> **Before writing any JSX with `@helixds/react`: read each component's real props first** — the
|
|
6
|
+
> `use-helix` skill, `helix_get_contracts` (MCP), or the contract shipped in the package
|
|
7
|
+
> (`node_modules/@helixds/react/dist/contracts/<Name>.json`, vocabulary in `dist/prop-map.md`). Never guess a prop:
|
|
8
|
+
> Helix names differ from other libraries (`Button` takes its text as children, not `label`; form
|
|
9
|
+
> controls require `label`; `Select` takes `options`). Use only `--helix-*` tokens for spacing and color.
|
|
10
|
+
|
|
11
|
+
## What is Helix?
|
|
12
|
+
|
|
13
|
+
A design system built for teams building AI-powered products. Components have explicit contracts,
|
|
14
|
+
predictable token structure, and machine-readable documentation.
|
|
15
|
+
|
|
16
|
+
## Available packages
|
|
17
|
+
|
|
18
|
+
| Package | Purpose | Install |
|
|
19
|
+
|-----------------------|--------------------------------------|----------------------------------|
|
|
20
|
+
| `@helixds/react` | All UI components | `pnpm add @helixds/react` |
|
|
21
|
+
| `@helixds/tokens` | CSS tokens + TypeScript constants | `pnpm add @helixds/tokens` |
|
|
22
|
+
|
|
23
|
+
Icons are [Tabler Icons](https://tabler.io/icons) (`@tabler/icons-react`, a peer dependency of core),
|
|
24
|
+
always rendered through core's `Icon` component or a component's `icon` prop — never as a raw
|
|
25
|
+
`<IconXxx />` tag.
|
|
26
|
+
|
|
27
|
+
## Data Analytics
|
|
28
|
+
|
|
29
|
+
For metrics and data visualisation, use Helix's `Chart` component. It is the only supported chart renderer
|
|
30
|
+
and is branded through Apache ECharts using Helix semantic tokens. Never import ECharts directly, pass raw
|
|
31
|
+
ECharts options, or introduce another chart library. Choose `variant="line"`, `"bar"`, `"stacked-bar"`,
|
|
32
|
+
`"donut"`, or `"timeline"` based on the reader's question; compose charts with Helix `Card`, `Table`,
|
|
33
|
+
`Badge`, and `Tooltip` rather than recreating those UI pieces inside a chart.
|
|
34
|
+
|
|
35
|
+
## Setup (required, once)
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
// app/layout.tsx or main.tsx
|
|
39
|
+
import '@helixds/tokens/helix.css'; // CSS custom properties
|
|
40
|
+
import '@helixds/react/globals.css'; // Tailwind base + component styles
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Component inventory
|
|
44
|
+
|
|
45
|
+
Every component's current status (draft / beta / stable) is **computed**, not listed here — see
|
|
46
|
+
Storybook → **Status**, or `contracts/stability.json` (`pnpm verify:stable`, ADR-018). draft = exists and
|
|
47
|
+
works; beta = passes all 8 automatic quality criteria; stable = beta + modeled in Figma.
|
|
48
|
+
|
|
49
|
+
All components import from `@helixds/react`. Generated from `contracts/manifest.json` on every commit
|
|
50
|
+
(`pnpm docs:readme`) — do not edit the table by hand.
|
|
51
|
+
|
|
52
|
+
<!-- helix:component-inventory:start -->
|
|
53
|
+
| Component | Category | Purpose |
|
|
54
|
+
|---|---|---|
|
|
55
|
+
| `Accordion` | core | A single collapsible disclosure — a header that expands/collapses a panel of content, with no JS height measurement needed. |
|
|
56
|
+
| `AppShell` | layout | The top-level page shell — composes a SideNav, a TopBar, and the scrollable main content into one consistent full-height layout. |
|
|
57
|
+
| `Avatar` | core | Represents a person or entity as a small circular image or initials indicator — a table row, a nav footer, a comment author. |
|
|
58
|
+
| `AvatarGroup` | core | Shows several people or entities associated with the same record as a compact overlapping stack of Avatars, collapsing whatever doesn't fit into a '+N' count. |
|
|
59
|
+
| `Badge` | core | Communicates status, category labels, or counts in a compact, high-contrast capsule. |
|
|
60
|
+
| `Button` | core | Triggers an action or navigates to a destination when pressed by the user. |
|
|
61
|
+
| `Card` | core | Groups related content in a visually distinct, flat surface — a dashboard widget, a settings group, a gallery tile. |
|
|
62
|
+
| `Chart` | core | Visualizes a metric with a token-branded, accessible chart so people can understand trends, comparisons, composition, or events. |
|
|
63
|
+
| `Checkbox` | core | Lets users select one or more independent options from a set, or confirm a single binary choice. |
|
|
64
|
+
| `CheckboxGroup` | core | Lets users choose zero or more options from a small, visible set of independent choices. |
|
|
65
|
+
| `Chip` | core | Represents a compact selectable label for filters, categories, or short choices. |
|
|
66
|
+
| `ChipGroup` | core | Shows a small set of related chips side by side — categories, tags or applied filters — as one labelled group. |
|
|
67
|
+
| `FAB` | core | A single, prominent floating action reachable from anywhere in the current view — optionally expanding into 1-3 closely related actions via a speed-dial. |
|
|
68
|
+
| `Icon` | core | Communicates meaning, action, or status through a recognizable visual symbol. |
|
|
69
|
+
| `IconButton` | core | Triggers an action via a single icon, with no visible text label — a toolbar action, a row action, a close/dismiss control. |
|
|
70
|
+
| `Input` | core | Allows users to enter a single line of free-form text. |
|
|
71
|
+
| `Menu` | core | A Helix-styled, portaled popup listbox anchored to a trigger element — the internal primitive Select uses instead of a native <select> dropdown, and the foundation for any future popup list (Combobox, a context menu, a DatePicker's own internals). |
|
|
72
|
+
| `Modal` | core | A centered overlay that interrupts the page for a focused task or decision — blocks interaction with the rest of the page until dismissed. |
|
|
73
|
+
| `MultiSelect` | core | Lets users choose several values from a predefined list, shown as removable chips inside the field. |
|
|
74
|
+
| `NavItem` | core | A single entry in a persistent navigation list (a SideNav, a tab rail) that links to another view. |
|
|
75
|
+
| `PageHeader` | layout | Introduces a page or major section: title, optional supporting description, and trailing actions in one consistent row. |
|
|
76
|
+
| `RadioButton` | core | A single radio input — the individual option unit RadioGroup renders per choice, exposed on its own for cases that need one radio outside a full group (e.g. |
|
|
77
|
+
| `RadioGroup` | core | Lets users choose exactly one option from a small, visible set of mutually exclusive choices. |
|
|
78
|
+
| `SegmentedControl` | core | Lets users switch between a small, fixed set of mutually exclusive modes or views, with no associated content panel. |
|
|
79
|
+
| `Select` | core | Lets users choose a single value from a predefined list. |
|
|
80
|
+
| `SideNav` | layout | The persistent vertical navigation rail of an app shell — brand mark, primary nav entries, and a footer slot for the current user. |
|
|
81
|
+
| `SidePanel` | core | A modal panel anchored to the right edge of the viewport, for a persistent secondary task alongside — but still blocking — the main page (details, a form, a filter builder). |
|
|
82
|
+
| `Switch` | core | Lets users toggle a single setting on or off, with the change taking effect immediately. |
|
|
83
|
+
| `Table` | core | Displays tabular data edge-to-edge — rows and columns of related records, e.g. |
|
|
84
|
+
| `Textarea` | core | Lets users enter multi-line free-form text. |
|
|
85
|
+
| `Toast` | core | A Sonner-style stacking notification, fixed to the top-right corner, triggered imperatively (toast.success('Saved')) from anywhere — not tied to a piece of UI state the consumer renders conditionally, unlike Modal/SidePanel. |
|
|
86
|
+
| `Tooltip` | core | Reveals a short, non-interactive text label for whatever it wraps, on hover or keyboard focus — identifies an ambiguous control (an icon-only button, an avatar) without adding permanent visible text. |
|
|
87
|
+
| `TopBar` | layout | The fixed-height chrome bar at the top of a page — search, quick actions, and the current user, always in the same place. |
|
|
88
|
+
<!-- helix:component-inventory:end -->
|
|
89
|
+
|
|
90
|
+
## Component hierarchy (enforce this order)
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
1. Helix core (@helixds/react) ← always check first
|
|
94
|
+
2. Custom component ← add comment: // [CUSTOM] reason
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Helix components are built directly on native HTML elements — there is no primitive library
|
|
98
|
+
underneath to reach for. If a Helix component doesn't exist yet, file a request.
|
|
99
|
+
|
|
100
|
+
## Token usage
|
|
101
|
+
|
|
102
|
+
Use Helix semantic tokens, never Tailwind primitives directly:
|
|
103
|
+
|
|
104
|
+
```css
|
|
105
|
+
/* ✅ correct */
|
|
106
|
+
color: var(--helix-color-text-neutral);
|
|
107
|
+
background: var(--helix-color-fill-primary);
|
|
108
|
+
|
|
109
|
+
/* ❌ wrong */
|
|
110
|
+
color: #1a1a1a;
|
|
111
|
+
background: blue-600;
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
TypeScript constants are also available:
|
|
115
|
+
```ts
|
|
116
|
+
import { tokens } from '@helixds/tokens';
|
|
117
|
+
tokens.color.fill.primary; // '#1d4ed8'
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Lint while you write
|
|
121
|
+
|
|
122
|
+
`@helixds/eslint-plugin` catches the mistakes agents make most — an invented import path
|
|
123
|
+
(`@helixds/react` → `@helixds/react`), anti-synonym props and values (`onPress` → `onClick`,
|
|
124
|
+
`size="md"` → `size="m"`), raw colors (`#1d4ed8` → the semantic token with that color) and native
|
|
125
|
+
controls (`<button>` → `Button`). Run `pnpm lint` (or `npx eslint --fix <file>`) after writing UI code;
|
|
126
|
+
the editor shows the same warnings live. See `packages/eslint-plugin/README.md`.
|
|
127
|
+
|
|
128
|
+
## Props vocabulary
|
|
129
|
+
|
|
130
|
+
Use the canonical prop names below. Anti-synonyms are rejected by CI.
|
|
131
|
+
|
|
132
|
+
| ✅ Use | ❌ Never | Notes |
|
|
133
|
+
|-------------|------------|--------------------------------|
|
|
134
|
+
| `variant` | `type` | Visual style selector |
|
|
135
|
+
| `size` | `scale` | `xs s m l xl` |
|
|
136
|
+
| `isLoading` | `loading`| Boolean authored state |
|
|
137
|
+
| `disabled` | `isDisabled`| Boolean authored state |
|
|
138
|
+
| `danger` | `error` | Destructive variant name |
|
|
139
|
+
| `current` | `active` | Navigation selected state |
|
|
140
|
+
| `onClick` | `onPress` | Primary action handler |
|
|
141
|
+
| `label` | `title`, `name` | Accessible text |
|
|
142
|
+
## Agent Readiness & Governance (Can it? Should it? May it?)
|
|
143
|
+
|
|
144
|
+
When an AI agent makes design or implementation decisions using Helix, it must validate three levels of readiness:
|
|
145
|
+
|
|
146
|
+
1. **Can it? (Mechanical Readiness)**:
|
|
147
|
+
- Does the generated code compile and use valid tokens (`var(--helix-color-...)`)?
|
|
148
|
+
- Are canonical props (`onClick`, `variant`, `expanded`) used according to component contracts?
|
|
149
|
+
- Query Helix via CLI (`pnpm helix component <Name>`) or contracts to fetch machine-readable props and types.
|
|
150
|
+
|
|
151
|
+
2. **Should it? (Design Judgment Readiness)**:
|
|
152
|
+
- Does the usage respect `neverUseFor` anti-patterns documented in the component contract?
|
|
153
|
+
- Does it preserve accessibility contracts (WCAG AA, focus trapping, aria semantics)?
|
|
154
|
+
- Are responsive constraints and layout components (`AppShell`, `TopBar`, `SideNav`) respected?
|
|
155
|
+
|
|
156
|
+
3. **May it? (Authority & Governance Readiness)**:
|
|
157
|
+
- **Consuming apps**: Agents MAY use core Helix components and create local custom components flagged with `// [CUSTOM] reason`.
|
|
158
|
+
- **Boundary Enforcement**: Agents MAY NOT alter shared token CSS variables directly (`style={{ color: '#xxx' }}`), override internal padding/height tokens, or redefine component prop contracts.
|
|
159
|
+
- **Escalation**: If a requested UI pattern cannot be achieved with existing Helix components or local composition, the agent MUST flag it for human review or file a request for Helix DS.
|
|
160
|
+
|
|
161
|
+
## AI context installation
|
|
162
|
+
|
|
163
|
+
## Helix MCP tools (preferred when your client supports MCP)
|
|
164
|
+
|
|
165
|
+
The repo registers a `helix` MCP server (`.mcp.json`, `pnpm helix:mcp`). Use its tools instead of reading
|
|
166
|
+
files or shelling out:
|
|
167
|
+
|
|
168
|
+
1. `helix_list_components` — check Helix has the component before building anything.
|
|
169
|
+
2. `helix_get_contracts` — the contracts of every component you'll use, in one call (`helix_get_contract` for
|
|
170
|
+
one): the exact import line, props, accessibility and governance. Read one for EVERY component, layout ones too.
|
|
171
|
+
3. `helix_search_tokens` — the token for a concept ("danger background", "subtle text"); never hardcode.
|
|
172
|
+
4. `helix_validate_snippet` — run your JSX through it before writing the file: it lints it and type-checks it
|
|
173
|
+
against Helix's real source. Apply `fixedCode`, then fix what's left in `remainingAfterFix` (lint problems
|
|
174
|
+
and type errors) until `valid` is `true`.
|
|
175
|
+
|
|
176
|
+
## Querying Helix from a terminal
|
|
177
|
+
|
|
178
|
+
When an agent has shell access, use the read-only CLI to discover the exact Helix guidance needed
|
|
179
|
+
instead of searching source files broadly. It reads the same contracts, tokens, and patterns used by
|
|
180
|
+
the design system — it does not maintain a second copy of the documentation.
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
pnpm helix search "confirmation dialog" --json
|
|
184
|
+
pnpm helix component Modal --json
|
|
185
|
+
pnpm helix token color.fill.primary-interactive-default --json
|
|
186
|
+
pnpm helix tokens "danger background" --json
|
|
187
|
+
pnpm helix pattern empty-state --json
|
|
188
|
+
pnpm helix validate src/Settings.tsx --json # or `-` for stdin; exits 1 when not valid
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
It is the MCP server's twin, for any agent or tool that can run a command — every MCP tool has a
|
|
192
|
+
command here (`helix_get_contract` → `component`, `helix_search_tokens` → `tokens`,
|
|
193
|
+
`helix_validate_snippet` → `validate`, …), from the same library. It runs from a clone of the Helix
|
|
194
|
+
repo: `pnpm -s --dir "${HELIX_DS_DIR:-/path/to/helixds}" helix validate "$PWD/src/Settings.tsx"`. In an
|
|
195
|
+
app that only installed the packages, use the MCP server below instead — it answers the same questions.
|
|
196
|
+
|
|
197
|
+
Use `pnpm helix batch --command "component Button" --command "token color.fill.primary-interactive-default" --json`
|
|
198
|
+
when several lookups are needed. If no shell is available, consult `contracts/manifest.json`, the
|
|
199
|
+
specific component contract, and `.ai/maps/` directly.
|
|
200
|
+
|
|
201
|
+
When no Helix component covers what you need, scaffold the custom one instead of writing it from
|
|
202
|
+
scratch — it comes with the `// [CUSTOM] reason:` header, semantic tokens, an accessible base and a
|
|
203
|
+
Storybook story whose `play` function is its first test:
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
pnpm helix scaffold:custom UsageMeter --reason "Helix has no meter component" --dir src/custom/UsageMeter
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
To install Helix AI context in your project:
|
|
210
|
+
|
|
211
|
+
### In an app that installed `@helixds/react`
|
|
212
|
+
|
|
213
|
+
1. **Context** — copy this guide to your project root, where every agent looks for it:
|
|
214
|
+
`cp node_modules/@helixds/react/AGENTS.md ./AGENTS.md`
|
|
215
|
+
2. **MCP server** — add Helix's tools (`helix_get_contracts`, `helix_search_tokens`,
|
|
216
|
+
`helix_validate_snippet`…) to your agent's MCP config (`.mcp.json` for Claude Code,
|
|
217
|
+
`.cursor/mcp.json` for Cursor):
|
|
218
|
+
|
|
219
|
+
```json
|
|
220
|
+
{
|
|
221
|
+
"mcpServers": {
|
|
222
|
+
"helix": { "command": "npx", "args": ["-y", "@helixds/mcp"] }
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
It reads the contracts, tokens and patterns your installed version ships, so its answers match it.
|
|
228
|
+
3. **Lint** — `npm i -D @helixds/eslint-plugin` flags raw colors and spacing, invented props and
|
|
229
|
+
anti-synonyms in the editor ([its README](https://www.npmjs.com/package/@helixds/eslint-plugin)).
|
|
230
|
+
|
|
231
|
+
### Full guardrails, from a clone of the Helix repo
|
|
232
|
+
|
|
233
|
+
The hooks below (contract read before writing, lint after writing, approval before patching Helix)
|
|
234
|
+
run Helix's own scripts, so they need a clone:
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
pnpm setup:ai [target-dir] [--dry-run] [--agents-only]
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
This copies AGENTS.md into your project (never overwriting a hand-edited one — it flags
|
|
241
|
+
a conflict instead) and writes a pointer file for whichever AI tool directories it finds
|
|
242
|
+
already in your project (`.cursor/rules/helix.mdc`, `.github/copilot-instructions.md`).
|
|
243
|
+
|
|
244
|
+
Unless you pass `--agents-only`, it also installs Helix's guardrails for Claude Code, run
|
|
245
|
+
from your Helix clone (set `HELIX_DS_DIR` if a teammate's clone lives elsewhere):
|
|
246
|
+
|
|
247
|
+
- `.mcp.json` — the Helix MCP server (`helix_get_contracts`, `helix_search_tokens`,
|
|
248
|
+
`helix_validate_snippet`…).
|
|
249
|
+
- `.claude/settings.json` — three hooks: a write that uses a Helix component is denied until
|
|
250
|
+
its contract has been read; every written file is linted with Helix's rules (Helix's
|
|
251
|
+
recommended config if your app has no ESLint setup for them); patching Helix in
|
|
252
|
+
`node_modules/@helixds` or with a `patches/` file asks you first.
|
|
253
|
+
|
|
254
|
+
Other agents get the same guardrails, from the same scripts:
|
|
255
|
+
|
|
256
|
+
| Agent | Context | MCP server | Hooks |
|
|
257
|
+
|---|---|---|---|
|
|
258
|
+
| Claude Code | AGENTS.md | `.mcp.json` | `.claude/settings.json` |
|
|
259
|
+
| Cursor | `.cursor/rules/helix.mdc` | `.cursor/mcp.json` | runs `.claude/settings.json`'s — turn on Settings → "Include Third-Party Plugins, Skills, and Other Configs" |
|
|
260
|
+
| Codex (ChatGPT) | AGENTS.md (read natively) | `.codex/config.toml` | `.codex/hooks.json` — trust the project in Codex |
|
|
261
|
+
| Gemini CLI | AGENTS.md (via `context.fileName`) | `.gemini/settings.json` | `.gemini/settings.json` |
|
|
262
|
+
|
|
263
|
+
Cursor, Codex and Gemini are installed when the app already has their folder (`.cursor/`,
|
|
264
|
+
`.codex/`, `.gemini/`), or with `--with codex,gemini` (`--with all`). Codex and Gemini can't
|
|
265
|
+
pause a hook for approval, so the owner gate stops the change there and tells the agent to
|
|
266
|
+
ask you; Claude Code and Cursor show an approval prompt. Every time a hook stops an agent, it
|
|
267
|
+
records a one-line trace in your Helix clone (`evals/traces/hooks/`, never the code;
|
|
268
|
+
`HELIX_TRACES=off` turns it off) — `pnpm eval:traces` shows what agents get wrong most.
|
|
269
|
+
|
|
270
|
+
These files are merged into what's already there — your own servers and hooks stay. Safe to
|
|
271
|
+
run more than once. See `scripts/setup-ai.mjs` for exactly what it does and does not touch.
|
|
272
|
+
|
|
273
|
+
## Common mistakes (seen in real eval runs)
|
|
274
|
+
|
|
275
|
+
These came up when an agent was asked to build with Helix without reading the contracts first
|
|
276
|
+
(`pnpm eval:generate`). Check them before writing the code:
|
|
277
|
+
|
|
278
|
+
- **Toast needs `<Toast />` mounted once** (near the app root). `toast.success(...)` only queues the
|
|
279
|
+
notification; with no `<Toast />` nothing appears (Helix logs a console warning). Signature:
|
|
280
|
+
`toast.success(label, description?)` — the description can also be `{ description }`.
|
|
281
|
+
- **TopBar's slots are `start` and `end`** — not `search`/`actions`, not `left`/`right`.
|
|
282
|
+
- **Canonical prop names only** — `onClick` (not `onPress`), `expanded` (not `open`/`isOpen`),
|
|
283
|
+
`label` (not `title`/`name`; but `Button` takes its text as children, never `label`), `checked` (not `active`/`selected`), `current` (not `active`). Full list:
|
|
284
|
+
`.ai/maps/prop-map.md`.
|
|
285
|
+
- **Icons by reference** — `icon={IconPlus}`, never `icon={<IconPlus />}`, never a raw `<IconPlus />`.
|
|
286
|
+
|
|
287
|
+
## What agents should NOT do
|
|
288
|
+
|
|
289
|
+
- Use `style={{ color: '#xxx' }}` — always use token CSS variables
|
|
290
|
+
- Create a `<div>` grid without importing a Helix layout component first
|
|
291
|
+
- Use `onPress` — prefer `onClick` (prop-map canonical)
|
|
292
|
+
- Use Figma prop names directly — they may not match Helix contracts
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Marta Conde
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,50 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @helixds/react
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
React components for **Helix**, a design system for AI-powered products: native HTML elements, Tailwind CSS
|
|
4
|
+
v4 and semantic design tokens (`@helixds/tokens`).
|
|
5
|
+
|
|
6
|
+
## For AI coding agents — read this first
|
|
7
|
+
|
|
8
|
+
Helix's props are not the ones other libraries use, so guessed props usually don't compile.
|
|
9
|
+
|
|
10
|
+
1. **Before writing JSX, read the contract of every Helix component you will use** (layout ones too):
|
|
11
|
+
`node_modules/@helixds/react/dist/contracts/<Name>.json` — exact props, which are required, when not to
|
|
12
|
+
use it, and the import line. The list of components: `dist/contracts/manifest.json`.
|
|
13
|
+
2. **Import everything from `@helixds/react`** — never `@helix/…` or `@helix-ds/…`.
|
|
14
|
+
3. Common mistakes: Button's text is its children (not `label`); form controls require `label`;
|
|
15
|
+
`PageHeader` takes `label` (not `title`); `Select` takes `options`; `Card` takes no `style`.
|
|
16
|
+
4. Spacing and color come from `--helix-*` tokens, never raw `px`/hex.
|
|
17
|
+
|
|
18
|
+
Full guide: [`AGENTS.md`](./AGENTS.md) · prop vocabulary: `dist/prop-map.md`.
|
|
19
|
+
|
|
20
|
+
## Install
|
|
21
|
+
|
|
22
|
+
Requires React 19 and Tailwind CSS v4 set up in your app.
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install @helixds/react @helixds/tokens @tabler/icons-react
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
In the CSS file Tailwind processes, replace `@import "tailwindcss";` with:
|
|
29
|
+
|
|
30
|
+
```css
|
|
31
|
+
@import "@helixds/react/globals.css"; /* Tailwind + every --helix-* token + component styles */
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
import { Button } from '@helixds/react';
|
|
36
|
+
|
|
37
|
+
export const Save = ({ onSave }: { onSave: () => void }) => (
|
|
38
|
+
<Button variant="primary" onClick={onSave}>Save</Button>
|
|
39
|
+
);
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Dark mode follows the operating system; set `data-theme="dark"` or `"light"` on `<html>` to force one.
|
|
43
|
+
|
|
44
|
+
**Docs:** [Storybook](https://martacondedesign.github.io/helixds/) ·
|
|
45
|
+
[Getting started](https://github.com/MartaCondeDesign/helixds/blob/main/docs/getting-started.md) ·
|
|
46
|
+
[GitHub](https://github.com/MartaCondeDesign/helixds)
|
|
47
|
+
|
|
48
|
+
**Agents:** connect the Helix MCP server (`npx -y @helixds/mcp`) — see [`AGENTS.md`](./AGENTS.md).
|
|
49
|
+
|
|
50
|
+
MIT © Marta Conde
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @helixds/react — agent note
|
|
3
|
+
* Before using Accordion, read its contract: node_modules/@helixds/react/dist/contracts/Accordion.json
|
|
4
|
+
* (every prop, which are required, when not to use it, the import line). Do not guess Helix props.
|
|
5
|
+
* Guide: node_modules/@helixds/react/AGENTS.md
|
|
6
|
+
*/
|
|
7
|
+
import * as React from 'react';
|
|
8
|
+
import type { AccordionProps } from './Accordion.types.js';
|
|
9
|
+
declare const Accordion: {
|
|
10
|
+
({ label, children, expanded, defaultExpanded, onExpandedChange, disabled, className, }: AccordionProps): React.JSX.Element;
|
|
11
|
+
displayName: string;
|
|
12
|
+
};
|
|
13
|
+
export { Accordion };
|
|
14
|
+
//# sourceMappingURL=Accordion.d.ts.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export const doc = {
|
|
2
|
+
name: 'Accordion',
|
|
3
|
+
purpose: 'A single collapsible disclosure — a header that expands/collapses a panel of content.',
|
|
4
|
+
contract: 'contracts/components/Accordion.json',
|
|
5
|
+
a11y: [
|
|
6
|
+
'Built on native <details>/<summary> — open/closed state, keyboard support (Enter/Space), and the implicit disclosure semantics all come from the element itself, no hand-rolled ARIA.',
|
|
7
|
+
'The chevron is aria-hidden — the open/closed state is already exposed by <details>, not by the icon.',
|
|
8
|
+
],
|
|
9
|
+
variants: [],
|
|
10
|
+
sizes: [],
|
|
11
|
+
tokens: [
|
|
12
|
+
{ part: 'accordion-root', label: 'fill', token: '--helix-accordion-fill', kind: 'color' },
|
|
13
|
+
{ part: 'accordion-root', label: 'border', token: '--helix-accordion-border', kind: 'color' },
|
|
14
|
+
{ part: 'accordion-header', label: 'text', token: '--helix-accordion-text', kind: 'color' },
|
|
15
|
+
{ part: 'accordion-chevron', label: 'chevron', token: '--helix-accordion-chevron', kind: 'color' },
|
|
16
|
+
],
|
|
17
|
+
features: [
|
|
18
|
+
'label — the header text',
|
|
19
|
+
'expanded / defaultExpanded / onExpandedChange — controlled or uncontrolled, same pattern as Switch',
|
|
20
|
+
'disabled — prevents toggling',
|
|
21
|
+
],
|
|
22
|
+
examples: [
|
|
23
|
+
{ label: 'Basic', code: `<Accordion label="Shipping details">Ships in 3-5 business days.</Accordion>` },
|
|
24
|
+
{ label: 'Controlled', code: `<Accordion label="Advanced" expanded={isExpanded} onExpandedChange={setIsExpanded}>...</Accordion>` },
|
|
25
|
+
],
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=Accordion.doc.js.map
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { IconChevronDown } from '@tabler/icons-react';
|
|
4
|
+
import { cn } from '../../lib/utils.js';
|
|
5
|
+
import { Icon } from '../Icon/index.js';
|
|
6
|
+
import { useDisclosureTransition } from '../../lib/useDisclosureTransition.js';
|
|
7
|
+
const Accordion = ({ label, children, expanded, defaultExpanded = false, onExpandedChange, disabled = false, className, }) => {
|
|
8
|
+
const [uncontrolledExpanded, setUncontrolledExpanded] = React.useState(defaultExpanded);
|
|
9
|
+
const isControlled = expanded !== undefined;
|
|
10
|
+
const isExpanded = isControlled ? expanded : uncontrolledExpanded;
|
|
11
|
+
const { ref, state } = useDisclosureTransition(isExpanded, '--helix-accordion-duration-collapse');
|
|
12
|
+
const panelRef = React.useRef(null);
|
|
13
|
+
const innerRef = React.useRef(null);
|
|
14
|
+
// Explicit pixel height, not grid-template-rows 0fr/1fr — see the conversation this shipped from:
|
|
15
|
+
// 'fr' unit interpolation doesn't track the same visual pace in both directions even with matched
|
|
16
|
+
// duration/easing, which read as a slow/laggy collapse. A measured, real height transitions
|
|
17
|
+
// identically regardless of direction.
|
|
18
|
+
React.useLayoutEffect(() => {
|
|
19
|
+
const panel = panelRef.current;
|
|
20
|
+
const inner = innerRef.current;
|
|
21
|
+
if (!panel || !inner)
|
|
22
|
+
return;
|
|
23
|
+
if (state === 'open') {
|
|
24
|
+
panel.style.height = `${inner.scrollHeight}px`;
|
|
25
|
+
}
|
|
26
|
+
else if (state === 'closing') {
|
|
27
|
+
// Coming from 'open', height is likely 'auto' (released once the expand settled, below) —
|
|
28
|
+
// 'auto' can't be transitioned, so lock in the current real height first, force the browser to
|
|
29
|
+
// register it (a read that triggers layout), then collapse to 0 on the next line. Without the
|
|
30
|
+
// forced read, the browser could coalesce both writes and jump straight to 0 with no transition.
|
|
31
|
+
panel.style.height = `${inner.scrollHeight}px`;
|
|
32
|
+
void panel.offsetHeight;
|
|
33
|
+
panel.style.height = '0px';
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
panel.style.height = '0px';
|
|
37
|
+
}
|
|
38
|
+
}, [state]);
|
|
39
|
+
// Once fully open, release the locked pixel height to `auto` so content that changes size while
|
|
40
|
+
// expanded (e.g. an image loading in) isn't clipped — re-locked to a real px value above the moment
|
|
41
|
+
// a close starts.
|
|
42
|
+
const handlePanelTransitionEnd = (event) => {
|
|
43
|
+
if (event.target !== event.currentTarget || event.propertyName !== 'height')
|
|
44
|
+
return;
|
|
45
|
+
if (state === 'open') {
|
|
46
|
+
event.currentTarget.style.height = 'auto';
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const toggle = () => {
|
|
50
|
+
if (disabled)
|
|
51
|
+
return;
|
|
52
|
+
const next = !isExpanded;
|
|
53
|
+
if (!isControlled)
|
|
54
|
+
setUncontrolledExpanded(next);
|
|
55
|
+
onExpandedChange?.(next);
|
|
56
|
+
};
|
|
57
|
+
const handleSummaryClick = (event) => {
|
|
58
|
+
// Always prevent the native instant toggle — see useDisclosureTransition's own comment for why:
|
|
59
|
+
// collapsing has to play the closing transition before `open` actually comes off.
|
|
60
|
+
event.preventDefault();
|
|
61
|
+
toggle();
|
|
62
|
+
};
|
|
63
|
+
// Enter/Space handled here rather than left to <summary>'s native activation: preventDefault on the
|
|
64
|
+
// keydown cancels the native click, so each press toggles exactly once — and the behavior no longer
|
|
65
|
+
// depends on the browser's own summary activation, which synthetic key events (tests) don't trigger.
|
|
66
|
+
const handleSummaryKeyDown = (event) => {
|
|
67
|
+
if (event.key !== 'Enter' && event.key !== ' ')
|
|
68
|
+
return;
|
|
69
|
+
event.preventDefault();
|
|
70
|
+
toggle();
|
|
71
|
+
};
|
|
72
|
+
return (_jsxs("details", { ref: ref, "data-helix-part": "accordion-root", "data-state": state, className: cn(className), children: [_jsxs("summary", { "data-helix-part": "accordion-header", "aria-disabled": disabled ? 'true' : undefined, "aria-expanded": isExpanded ? 'true' : 'false', onClick: handleSummaryClick, onKeyDown: handleSummaryKeyDown, children: [_jsx("span", { "data-helix-part": "accordion-title", children: label }), _jsx("span", { "data-helix-part": "accordion-chevron", "aria-hidden": "true", children: _jsx(Icon, { icon: IconChevronDown, size: 16 }) })] }), _jsx("div", { ref: panelRef, "data-helix-part": "accordion-panel", onTransitionEnd: handlePanelTransitionEnd, children: _jsx("div", { ref: innerRef, "data-helix-part": "accordion-panel-inner", children: children }) })] }));
|
|
73
|
+
};
|
|
74
|
+
Accordion.displayName = 'Accordion';
|
|
75
|
+
export { Accordion };
|
|
76
|
+
//# sourceMappingURL=Accordion.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @helixds/react — agent note
|
|
3
|
+
* Before using Accordion, read its contract: node_modules/@helixds/react/dist/contracts/Accordion.json
|
|
4
|
+
* (every prop, which are required, when not to use it, the import line). Do not guess Helix props.
|
|
5
|
+
* Guide: node_modules/@helixds/react/AGENTS.md
|
|
6
|
+
*/
|
|
7
|
+
import type * as React from 'react';
|
|
8
|
+
export interface AccordionProps {
|
|
9
|
+
/** The header's text label. */
|
|
10
|
+
label: string;
|
|
11
|
+
/** The panel's content. */
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
/** Controlled open state. Leave unset for uncontrolled (see `defaultExpanded`). */
|
|
14
|
+
expanded?: boolean;
|
|
15
|
+
/** Initial open state for uncontrolled usage. Default: false */
|
|
16
|
+
defaultExpanded?: boolean;
|
|
17
|
+
/** Fires whenever the disclosure toggles, controlled or not. */
|
|
18
|
+
onExpandedChange?: (expanded: boolean) => void;
|
|
19
|
+
/** Prevents toggling. Default: false */
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
/** Additional className for the root. */
|
|
22
|
+
className?: string;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=Accordion.types.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @helixds/react — agent note
|
|
3
|
+
* Before using Accordion, read its contract: node_modules/@helixds/react/dist/contracts/Accordion.json
|
|
4
|
+
* (every prop, which are required, when not to use it, the import line). Do not guess Helix props.
|
|
5
|
+
* Guide: node_modules/@helixds/react/AGENTS.md
|
|
6
|
+
*/
|
|
7
|
+
export { Accordion } from './Accordion.js';
|
|
8
|
+
export type { AccordionProps } from './Accordion.types.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @helixds/react — agent note
|
|
3
|
+
* Before using Avatar, read its contract: node_modules/@helixds/react/dist/contracts/Avatar.json
|
|
4
|
+
* (every prop, which are required, when not to use it, the import line). Do not guess Helix props.
|
|
5
|
+
* Guide: node_modules/@helixds/react/AGENTS.md
|
|
6
|
+
*/
|
|
7
|
+
import * as React from 'react';
|
|
8
|
+
import type { AvatarProps } from './Avatar.types.js';
|
|
9
|
+
declare const Avatar: {
|
|
10
|
+
({ label, src, size, className, "aria-describedby": ariaDescribedBy }: AvatarProps): React.JSX.Element;
|
|
11
|
+
displayName: string;
|
|
12
|
+
};
|
|
13
|
+
export { Avatar };
|
|
14
|
+
//# sourceMappingURL=Avatar.d.ts.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export const doc = {
|
|
2
|
+
name: 'Avatar',
|
|
3
|
+
purpose: 'Represents a person or entity as a small circular image or initials indicator.',
|
|
4
|
+
contract: 'contracts/components/Avatar.json',
|
|
5
|
+
a11y: [
|
|
6
|
+
'label is required — it drives both the initials fallback and the accessible name.',
|
|
7
|
+
'Falls back to initials automatically if the image fails to load (broken URL, offline).',
|
|
8
|
+
],
|
|
9
|
+
variants: [],
|
|
10
|
+
sizes: ['s', 'm', 'l'],
|
|
11
|
+
tokens: [
|
|
12
|
+
{ part: 'avatar-root', label: 'height.s', token: '--helix-avatar-height-s', kind: 'space', size: 's' },
|
|
13
|
+
{ part: 'avatar-root', label: 'height.m', token: '--helix-avatar-height-m', kind: 'space', size: 'm' },
|
|
14
|
+
{ part: 'avatar-root', label: 'height.l', token: '--helix-avatar-height-l', kind: 'space', size: 'l' },
|
|
15
|
+
{ part: 'avatar-root', label: 'fill', token: '--helix-avatar-fill', kind: 'color' },
|
|
16
|
+
{ part: 'avatar-initials', label: 'text', token: '--helix-avatar-text', kind: 'color' },
|
|
17
|
+
{ part: 'avatar-initials', label: 'fontSize', token: '--helix-avatar-fontSize-s', kind: 'typography', meta: 'Caption / Semibold', size: 's' },
|
|
18
|
+
{ part: 'avatar-initials', label: 'fontWeight', token: '--helix-avatar-fontWeight-s', kind: 'typography', meta: 'Caption / Semibold', size: 's' },
|
|
19
|
+
{ part: 'avatar-initials', label: 'fontSize', token: '--helix-avatar-fontSize-m', kind: 'typography', meta: 'Caption / Semibold', size: 'm' },
|
|
20
|
+
{ part: 'avatar-initials', label: 'fontWeight', token: '--helix-avatar-fontWeight-m', kind: 'typography', meta: 'Caption / Semibold', size: 'm' },
|
|
21
|
+
{ part: 'avatar-initials', label: 'fontSize', token: '--helix-avatar-fontSize-l', kind: 'typography', meta: 'Body / m / Semibold', size: 'l' },
|
|
22
|
+
{ part: 'avatar-initials', label: 'fontWeight', token: '--helix-avatar-fontWeight-l', kind: 'typography', meta: 'Body / m / Semibold', size: 'l' },
|
|
23
|
+
],
|
|
24
|
+
features: [
|
|
25
|
+
'src — renders an image, falling back to initials on load error',
|
|
26
|
+
'label — always required, source of truth for initials and accessible name',
|
|
27
|
+
],
|
|
28
|
+
examples: [
|
|
29
|
+
{ label: 'Initials', code: `<Avatar label="Ana García" />` },
|
|
30
|
+
{ label: 'Image', code: `<Avatar label="Ana García" src="/ana.jpg" />` },
|
|
31
|
+
{ label: 'Current user', code: `<Avatar label="Marta Conde" />` },
|
|
32
|
+
],
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=Avatar.doc.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { cn } from '../../lib/utils.js';
|
|
4
|
+
function getInitials(label) {
|
|
5
|
+
return (label.trim()[0] ?? '').toUpperCase();
|
|
6
|
+
}
|
|
7
|
+
const Avatar = ({ label, src, size = 'm', className, 'aria-describedby': ariaDescribedBy }) => {
|
|
8
|
+
const [imageFailed, setImageFailed] = React.useState(false);
|
|
9
|
+
const showImage = !!src && !imageFailed;
|
|
10
|
+
return (_jsx("span", { "data-helix-part": "avatar-root", "data-size": size, "aria-describedby": ariaDescribedBy, className: cn(className), children: showImage ? (_jsx("img", { "data-helix-part": "avatar-image", src: src, alt: label, onError: () => setImageFailed(true) })) : (_jsx("span", { "data-helix-part": "avatar-initials", "aria-label": label, role: "img", children: getInitials(label) })) }));
|
|
11
|
+
};
|
|
12
|
+
Avatar.displayName = 'Avatar';
|
|
13
|
+
export { Avatar };
|
|
14
|
+
//# sourceMappingURL=Avatar.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @helixds/react — agent note
|
|
3
|
+
* Before using Avatar, read its contract: node_modules/@helixds/react/dist/contracts/Avatar.json
|
|
4
|
+
* (every prop, which are required, when not to use it, the import line). Do not guess Helix props.
|
|
5
|
+
* Guide: node_modules/@helixds/react/AGENTS.md
|
|
6
|
+
*/
|
|
7
|
+
export type AvatarSize = 's' | 'm' | 'l';
|
|
8
|
+
export interface AvatarProps {
|
|
9
|
+
/** The person's full name — source for the initials fallback, and the accessible name (image alt / aria-label). */
|
|
10
|
+
label: string;
|
|
11
|
+
/** Image URL. Falls back to initials when absent or on load error. */
|
|
12
|
+
src?: string;
|
|
13
|
+
/** Physical size. Shares the field scale with Input/Select (s=24, m=32, l=40). Default: 'm' */
|
|
14
|
+
size?: AvatarSize;
|
|
15
|
+
/** Additional className for the root. */
|
|
16
|
+
className?: string;
|
|
17
|
+
/** Forwarded to the root — set by Tooltip when Avatar is used as its trigger (e.g. inside AvatarGroup). */
|
|
18
|
+
'aria-describedby'?: string;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=Avatar.types.d.ts.map
|