@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
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: empty-state
|
|
3
|
+
category: feedback
|
|
4
|
+
components: [Badge, Button]
|
|
5
|
+
when: "The view has no data to display — first use, zero results, or filtered to nothing."
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Pattern: Empty State
|
|
9
|
+
|
|
10
|
+
## When to use
|
|
11
|
+
|
|
12
|
+
- Table/list has zero rows
|
|
13
|
+
- Search returned no results
|
|
14
|
+
- First-use onboarding (before the user has created anything)
|
|
15
|
+
- Permission-denied placeholder
|
|
16
|
+
|
|
17
|
+
## When NOT to use
|
|
18
|
+
|
|
19
|
+
- Loading state — use Skeleton instead
|
|
20
|
+
- Error state — use Error State pattern
|
|
21
|
+
- Single missing field — use inline field validation
|
|
22
|
+
|
|
23
|
+
## Anatomy
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
┌─────────────────────────────┐
|
|
27
|
+
│ [Illustration] │ Optional: Tabler icon at 48px, color-icon-neutral-light
|
|
28
|
+
│ │
|
|
29
|
+
│ No projects yet │ font-size-xl, font-weight-semibold, text-neutral
|
|
30
|
+
│ Create your first project │ font-size-s, text-neutral-light, max-width 320px
|
|
31
|
+
│ │
|
|
32
|
+
│ [New project] [Import] │ Primary + Secondary buttons
|
|
33
|
+
└─────────────────────────────┘
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Components used
|
|
37
|
+
|
|
38
|
+
| Component | Role in pattern |
|
|
39
|
+
|-----------|-------------------------------------------|
|
|
40
|
+
| Button | Primary CTA + optional secondary action |
|
|
41
|
+
| Badge | Optional context label (e.g. "Beta") |
|
|
42
|
+
|
|
43
|
+
## Code
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
import { Button } from '@helixds/react';
|
|
47
|
+
import { IconFolderOpen } from '@tabler/icons-react';
|
|
48
|
+
|
|
49
|
+
function EmptyState({
|
|
50
|
+
icon = <IconFolderOpen size={48} />,
|
|
51
|
+
title,
|
|
52
|
+
description,
|
|
53
|
+
action,
|
|
54
|
+
secondaryAction,
|
|
55
|
+
}: {
|
|
56
|
+
icon?: React.ReactNode;
|
|
57
|
+
title: string;
|
|
58
|
+
description?: string;
|
|
59
|
+
action?: { label: string; onClick: () => void };
|
|
60
|
+
secondaryAction?: { label: string; onClick: () => void };
|
|
61
|
+
}) {
|
|
62
|
+
return (
|
|
63
|
+
<div
|
|
64
|
+
data-helix-pattern="empty-state"
|
|
65
|
+
style={{
|
|
66
|
+
display: 'flex',
|
|
67
|
+
flexDirection: 'column',
|
|
68
|
+
alignItems: 'center',
|
|
69
|
+
gap: 'var(--helix-primitive-spacing-100)',
|
|
70
|
+
padding: 'var(--helix-primitive-spacing-12)',
|
|
71
|
+
textAlign: 'center',
|
|
72
|
+
}}
|
|
73
|
+
>
|
|
74
|
+
{icon && (
|
|
75
|
+
<span style={{ color: 'var(--helix-color-text-neutral-light)' }} aria-hidden="true">
|
|
76
|
+
{icon}
|
|
77
|
+
</span>
|
|
78
|
+
)}
|
|
79
|
+
|
|
80
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: 'var(--helix-primitive-spacing-50)' }}>
|
|
81
|
+
<h3 style={{
|
|
82
|
+
fontSize: 'var(--helix-primitive-fontSize-xl)',
|
|
83
|
+
fontWeight: 'var(--helix-primitive-fontWeight-semibold)',
|
|
84
|
+
color: 'var(--helix-color-text-neutral)',
|
|
85
|
+
margin: 0,
|
|
86
|
+
}}>
|
|
87
|
+
{title}
|
|
88
|
+
</h3>
|
|
89
|
+
{description && (
|
|
90
|
+
<p style={{
|
|
91
|
+
fontSize: 'var(--helix-primitive-fontSize-s)',
|
|
92
|
+
color: 'var(--helix-color-text-neutral-light)',
|
|
93
|
+
maxWidth: '320px',
|
|
94
|
+
margin: 0,
|
|
95
|
+
}}>
|
|
96
|
+
{description}
|
|
97
|
+
</p>
|
|
98
|
+
)}
|
|
99
|
+
</div>
|
|
100
|
+
|
|
101
|
+
{(action || secondaryAction) && (
|
|
102
|
+
<div style={{ display: 'flex', gap: 'var(--helix-spacing-2xs)' }}>
|
|
103
|
+
{action && (
|
|
104
|
+
<Button variant="primary" onClick={action.onClick}>{action.label}</Button>
|
|
105
|
+
)}
|
|
106
|
+
{secondaryAction && (
|
|
107
|
+
<Button variant="secondary" onClick={secondaryAction.onClick}>
|
|
108
|
+
{secondaryAction.label}
|
|
109
|
+
</Button>
|
|
110
|
+
)}
|
|
111
|
+
</div>
|
|
112
|
+
)}
|
|
113
|
+
</div>
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Anti-patterns
|
|
119
|
+
|
|
120
|
+
- ❌ Using a custom `<div className="text-gray-400">` for text — use `--helix-color-text-neutral-light`
|
|
121
|
+
- ❌ Hardcoding the icon color — always use a semantic token
|
|
122
|
+
- ❌ Multiple primary buttons — one primary CTA maximum
|
|
123
|
+
- ❌ Adding a button just because the pattern has one — omit if there's no meaningful action
|
|
124
|
+
|
|
125
|
+
## Tokens used
|
|
126
|
+
|
|
127
|
+
- `--helix-color-text-neutral-light` — icon and description text
|
|
128
|
+
- `--helix-color-text-neutral` — title text
|
|
129
|
+
- `--helix-primitive-spacing-*` — gap and padding
|
|
130
|
+
- `--helix-primitive-fontSize-xl` — title size
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: expand-collapse-chevron
|
|
3
|
+
category: motion
|
|
4
|
+
components: [Accordion, Select]
|
|
5
|
+
when: "Adding a chevron/caret indicator to any component that expands, collapses, opens, or closes."
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Pattern: Expand/collapse chevron
|
|
9
|
+
|
|
10
|
+
**Rule: any hand-rolled component whose own code toggles an open/closed state — an accordion, a future
|
|
11
|
+
dropdown, a combobox, a collapsible tree row, anything in that shape — uses `IconChevronDown` (via the
|
|
12
|
+
`Icon` wrapper, never rendered raw) with a vertical scaleY flip between states, driven by that component's
|
|
13
|
+
own duration/easing tokens.** Do not invent a new rotation treatment (a different icon, `rotate(180deg)`,
|
|
14
|
+
a different easing curve) for a new disclosure component — reuse this one, the same way `SPRING_SNAPPY` is
|
|
15
|
+
reused for sliding indicators instead of a new spring being tuned per component (see
|
|
16
|
+
[motion-effects.md](motion-effects.md)).
|
|
17
|
+
|
|
18
|
+
This is **plain CSS**, not Motion — a transform transition tracking a `data-state`/`data-*` attribute the
|
|
19
|
+
component already sets, not a `motion.*` element. It does not belong in `motion-effects.md`'s Motion
|
|
20
|
+
effects table for that reason, but follows the same "one canonical treatment, reused" philosophy that file
|
|
21
|
+
establishes for Motion-based effects.
|
|
22
|
+
|
|
23
|
+
## The pattern, concretely (from `Accordion`)
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import { IconChevronDown } from '@tabler/icons-react';
|
|
27
|
+
import { Icon } from '../Icon';
|
|
28
|
+
|
|
29
|
+
<span data-helix-part="{component}-chevron" aria-hidden="true">
|
|
30
|
+
<Icon icon={IconChevronDown} size={16} />
|
|
31
|
+
</span>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```css
|
|
35
|
+
[data-helix-part="{component}-chevron"] {
|
|
36
|
+
display: inline-flex;
|
|
37
|
+
color: var(--helix-{component}-chevron);
|
|
38
|
+
transform: scaleY(1); /* closed — chevron points down */
|
|
39
|
+
transform-origin: center;
|
|
40
|
+
transition: transform var(--helix-{component}-duration-chevron) var(--helix-{component}-easing-collapse);
|
|
41
|
+
}
|
|
42
|
+
[data-helix-part="{component}-root"][data-state="open"] [data-helix-part="{component}-chevron"] {
|
|
43
|
+
transform: scaleY(-1); /* open — chevron points up */
|
|
44
|
+
transition: transform var(--helix-{component}-duration-chevron) var(--helix-{component}-easing);
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
- **`scaleY(-1)`, not `rotate(180deg)`.** A vertical flip is the deliberate choice for a symmetric
|
|
49
|
+
chevron glyph — visually identical result, no diagonal artifact mid-transition the way a rotation
|
|
50
|
+
transform can read on some renderers.
|
|
51
|
+
- **Two token references, `easing` and `easing-collapse`** — kept as two separate component tokens even
|
|
52
|
+
though both currently alias the same `semantic.easing.base` value (see `Accordion`'s own tokens in
|
|
53
|
+
`tokens.json`). This is intentional headroom, not redundancy: `Accordion`'s collapse animation went
|
|
54
|
+
through several broken iterations before landing here (a laggy, asymmetric-feeling collapse traced to
|
|
55
|
+
`grid-template-rows: 0fr/1fr` interpolation, not the chevron itself — see the panel's own note in
|
|
56
|
+
`Accordion.tsx`) and having the two directions independently addressable in tokens is what made that
|
|
57
|
+
debugging possible. A new component adopting this pattern should still define both, even if they start
|
|
58
|
+
out equal.
|
|
59
|
+
- **`--helix-{component}-duration-chevron`** — its own token, not reused from a shared "chevron duration"
|
|
60
|
+
constant, so each component can retune independently if its container is a different size/weight than
|
|
61
|
+
Accordion's panel.
|
|
62
|
+
|
|
63
|
+
## `Select`: real now, not the exception it used to be
|
|
64
|
+
|
|
65
|
+
Until 2026-09-12, `Select.json`'s `select-chevron` was documented here as the one static exception —
|
|
66
|
+
`Select` wrapped a real native `<select>` (ADR-001), and a native listbox's open/closed state was never
|
|
67
|
+
exposed to CSS, so there was nothing to hook a rotation to. That's no longer true: `Select` was rebuilt on
|
|
68
|
+
the new `Menu` primitive (ADR-013) — its trigger is a real `<button>` whose own React state (and
|
|
69
|
+
`aria-expanded`) knows exactly when the popup is open. The chevron now flips for real, using this exact
|
|
70
|
+
pattern, keyed off `[aria-expanded="true"]` on the trigger itself rather than a `data-state` attribute on a
|
|
71
|
+
separate `-root` part (see `globals.css`'s `[data-helix-part="select-trigger"][aria-expanded="true"] ~
|
|
72
|
+
[data-helix-part="select-chevron"]`) — a sibling-selector variant of the same rule, not a different one.
|
|
73
|
+
|
|
74
|
+
**The dividing line, updated:** does the component's own React state know whether it's open or closed right
|
|
75
|
+
now — whether that's exposed as `data-state` on a root (`Accordion`) or `aria-expanded` on a trigger
|
|
76
|
+
(`Select`)? If yes, this pattern applies, keyed off whichever attribute that component actually sets. If
|
|
77
|
+
the "open" state lives entirely inside the browser/OS with no hook back into the component at all (a raw
|
|
78
|
+
native `<details>`'s own marker triangle before it's replaced — see `Accordion.tsx`'s own
|
|
79
|
+
`::-webkit-details-marker { display: none }` override — or any future case of wrapping a native disclosure
|
|
80
|
+
element with truly no accessible state), it doesn't, and a static icon is correct there instead.
|
|
81
|
+
|
|
82
|
+
## Applying this to a new component
|
|
83
|
+
|
|
84
|
+
1. Render the chevron through `Icon` with `IconChevronDown` — never a raw Tabler import (`verify:icons`
|
|
85
|
+
enforces this regardless).
|
|
86
|
+
2. Add `{component}.chevron` (color), `{component}.duration-chevron`, `{component}.easing`, and
|
|
87
|
+
`{component}.easing-collapse` to that component's `tokens.json` block, aliasing `semantic.*` values —
|
|
88
|
+
see `packages/tokens/CLAUDE.md`'s "Adding a token" steps.
|
|
89
|
+
3. Copy the two CSS rules above verbatim, swapping in the real `data-helix-part` names.
|
|
90
|
+
4. Add a row to this file's nothing-to-add-here table (there isn't one yet — if a second real consumer
|
|
91
|
+
ships, add a short table here the way `motion-effects.md` does for its own approved-effects list).
|
|
92
|
+
5. Confirm the component's own root sets `data-state="open"`/`data-state="closed"` (or equivalent) so the
|
|
93
|
+
selector above has something real to match — this pattern assumes that attribute already exists as part
|
|
94
|
+
of the component's normal anatomy, it doesn't introduce it.
|
|
95
|
+
|
|
96
|
+
## Reference
|
|
97
|
+
|
|
98
|
+
- `packages/core/src/components/Accordion/Accordion.tsx` / `Accordion.json` — the canonical
|
|
99
|
+
implementation and contract wording.
|
|
100
|
+
- [motion-effects.md](motion-effects.md) — the sibling pattern file for Motion-based (JS) effects; read
|
|
101
|
+
both before adding any new interactive animation.
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: form-field-group
|
|
3
|
+
category: form
|
|
4
|
+
components: [Input, Button, Badge]
|
|
5
|
+
when: "A form with 2-6 fields, a submit action, and optional inline validation."
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Pattern: Form Field Group
|
|
9
|
+
|
|
10
|
+
## When to use
|
|
11
|
+
|
|
12
|
+
- Login, registration, settings, create/edit forms
|
|
13
|
+
- Up to ~6 fields visible at once (beyond that, consider multi-step)
|
|
14
|
+
|
|
15
|
+
## Anatomy
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
┌─────────────────────────────────────────┐
|
|
19
|
+
│ [Badge variant="danger"] │ Auth error — only when submit fails
|
|
20
|
+
│ │
|
|
21
|
+
│ Email * │ Input, required
|
|
22
|
+
│ ┌─────────────────────────────────┐ │
|
|
23
|
+
│ │ you@example.com │ │
|
|
24
|
+
│ └─────────────────────────────────┘ │
|
|
25
|
+
│ │
|
|
26
|
+
│ Password * │ Input, required, type="password"
|
|
27
|
+
│ ┌─────────────────────────────────┐ │
|
|
28
|
+
│ │ •••••••• │ │
|
|
29
|
+
│ └─────────────────────────────────┘ │
|
|
30
|
+
│ Min. 8 characters │ description prop
|
|
31
|
+
│ │
|
|
32
|
+
│ [Cancel] [Sign in ↗] │ Button secondary + primary
|
|
33
|
+
└─────────────────────────────────────────┘
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Components used
|
|
37
|
+
|
|
38
|
+
| Component | Role |
|
|
39
|
+
|-----------|-----------------------------------------------|
|
|
40
|
+
| Input | All form fields |
|
|
41
|
+
| Button | Submit (primary) + Cancel/secondary (secondary)|
|
|
42
|
+
| Badge | Top-level form error after failed submit |
|
|
43
|
+
|
|
44
|
+
## Code
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
import { useState } from 'react';
|
|
48
|
+
import { Input, Button, Badge } from '@helixds/react';
|
|
49
|
+
import { IconMail, IconLock } from '@tabler/icons-react';
|
|
50
|
+
|
|
51
|
+
function LoginForm({ onSubmit }: { onSubmit: (data: { email: string; password: string }) => Promise<void> }) {
|
|
52
|
+
const [email, setEmail] = useState('');
|
|
53
|
+
const [password, setPassword] = useState('');
|
|
54
|
+
const [emailInvalid, setEmailInvalid] = useState(false);
|
|
55
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
56
|
+
const [formError, setFormError] = useState<string | null>(null);
|
|
57
|
+
|
|
58
|
+
async function handleSubmit(e: React.FormEvent) {
|
|
59
|
+
e.preventDefault();
|
|
60
|
+
setFormError(null);
|
|
61
|
+
setEmailInvalid(false);
|
|
62
|
+
|
|
63
|
+
if (!email.includes('@')) {
|
|
64
|
+
setEmailInvalid(true);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
setIsLoading(true);
|
|
69
|
+
try {
|
|
70
|
+
await onSubmit({ email, password });
|
|
71
|
+
} catch {
|
|
72
|
+
setFormError('Incorrect email or password. Please try again.');
|
|
73
|
+
} finally {
|
|
74
|
+
setIsLoading(false);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<form onSubmit={handleSubmit} noValidate style={{ display: 'flex', flexDirection: 'column', gap: 'var(--helix-primitive-spacing-125)', maxWidth: '360px' }}>
|
|
80
|
+
|
|
81
|
+
{formError && (
|
|
82
|
+
<Badge variant="danger" label={formError} />
|
|
83
|
+
)}
|
|
84
|
+
|
|
85
|
+
<Input
|
|
86
|
+
label="Email"
|
|
87
|
+
type="email"
|
|
88
|
+
required
|
|
89
|
+
autoComplete="email"
|
|
90
|
+
icon={IconMail}
|
|
91
|
+
value={email}
|
|
92
|
+
onChange={e => setEmail(e.target.value)}
|
|
93
|
+
invalid={emailInvalid}
|
|
94
|
+
errorMessage="Enter a valid email address"
|
|
95
|
+
fullWidth
|
|
96
|
+
/>
|
|
97
|
+
|
|
98
|
+
<Input
|
|
99
|
+
label="Password"
|
|
100
|
+
type="password"
|
|
101
|
+
required
|
|
102
|
+
autoComplete="current-password"
|
|
103
|
+
icon={IconLock}
|
|
104
|
+
description="Min. 8 characters"
|
|
105
|
+
value={password}
|
|
106
|
+
onChange={e => setPassword(e.target.value)}
|
|
107
|
+
fullWidth
|
|
108
|
+
/>
|
|
109
|
+
|
|
110
|
+
<div style={{ display: 'flex', gap: 'var(--helix-spacing-2xs)', justifyContent: 'flex-end' }}>
|
|
111
|
+
<Button variant="secondary" type="button" onClick={() => {}}>Cancel</Button>
|
|
112
|
+
<Button variant="primary" type="submit" isLoading={loading}>Sign in</Button>
|
|
113
|
+
</div>
|
|
114
|
+
</form>
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Rules
|
|
120
|
+
|
|
121
|
+
1. One primary button maximum per form
|
|
122
|
+
2. Cancel is always `variant="secondary"`, not ghost (ghost is invisible in context)
|
|
123
|
+
3. Form-level errors → `Badge variant="danger"` at top
|
|
124
|
+
4. Field-level errors → `errorMessage` prop on Input with `invalid` state
|
|
125
|
+
5. Always use `required` + `aria-required` via the Input's `required` prop
|
|
126
|
+
6. Never disable the submit button to prevent submission — use `isLoading` + server validation
|
|
127
|
+
|
|
128
|
+
## Anti-patterns
|
|
129
|
+
|
|
130
|
+
- ❌ `<input className="border border-red-500" />` — use `<Input invalid errorMessage="..." />`
|
|
131
|
+
- ❌ Generic `<div style={{ color: 'red' }}>Error</div>` — use `<Badge variant="danger" />`
|
|
132
|
+
- ❌ `loading` prop — use `isLoading`
|
|
133
|
+
- ❌ `onPress` on Button — use `onClick`
|
|
134
|
+
- ❌ `type="primary"` — use `variant="primary"`
|
|
135
|
+
|
|
136
|
+
## Tokens used
|
|
137
|
+
|
|
138
|
+
- `--helix-primitive-spacing-5` — gap between fields
|
|
139
|
+
- `--helix-primitive-spacing-3` — gap between action buttons
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: form-field-spacing
|
|
3
|
+
category: spacing
|
|
4
|
+
components: [Input, Select, Textarea, Checkbox, CheckboxGroup, RadioGroup, RadioButton]
|
|
5
|
+
when: "Adding or touching the vertical spacing around any form field's label or description/error text."
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Pattern: Form field spacing
|
|
9
|
+
|
|
10
|
+
**Rule: every form field's label-to-control gap, and its control-to-description/error gap, is
|
|
11
|
+
exactly `semantic.spacing.component-s` (8px) — the same value, everywhere, no per-component
|
|
12
|
+
exception.** This applies to `Input`, `Select`, `Textarea`, `Checkbox`, `CheckboxGroup`,
|
|
13
|
+
`RadioGroup`, and `RadioButton`. Decided after review found these had silently drifted — Select
|
|
14
|
+
briefly shipped a 16px label gap as a one-off before this rule replaced it, and every other
|
|
15
|
+
component here was hardcoding a raw `primitive.spacing.25` (4px, sometimes coincidentally
|
|
16
|
+
`primitive.spacing.50`/8px) with no component token backing it at all. Neither was a deliberate
|
|
17
|
+
exception; all are now 8px, tokenized properly.
|
|
18
|
+
|
|
19
|
+
## The two gaps this covers
|
|
20
|
+
|
|
21
|
+
1. **Label → control.** For `Input`/`Select`/`Textarea`, the space between the visible `*-label`
|
|
22
|
+
and the field itself. For `CheckboxGroup`/`RadioGroup`, the equivalent is their `*-legend` (a
|
|
23
|
+
fieldset's own stacked group label) to `*-options` — same concept, same 8px. The standalone
|
|
24
|
+
`Checkbox`/`RadioButton` don't have a separate stacked label at all — their label sits inline
|
|
25
|
+
beside the control, not above it — so this half of the rule doesn't apply to them structurally;
|
|
26
|
+
skip it, don't force a gap that doesn't correspond to anything in their anatomy.
|
|
27
|
+
2. **Control → description/error.** The space between the field (or, for the group components, the
|
|
28
|
+
whole options block; for standalone Checkbox/RadioButton, the control+label row) and its own
|
|
29
|
+
`*-description`/`*-error` text below it. This half applies to **all seven** components — every
|
|
30
|
+
one of them can render a description or error line, and that gap is 8px everywhere.
|
|
31
|
+
|
|
32
|
+
## The one documented exception: `Switch`
|
|
33
|
+
|
|
34
|
+
`Switch` does not follow this rule. Its own label sits **beside** the toggle in a horizontal row,
|
|
35
|
+
not above a stacked field — a different spatial relationship entirely, not a vertical "label above
|
|
36
|
+
control" gap this rule is about. Do not force `component-s` onto Switch's toggle↔label gap; that's
|
|
37
|
+
a different design question (horizontal control-to-label spacing), out of this rule's scope.
|
|
38
|
+
|
|
39
|
+
## Implementation
|
|
40
|
+
|
|
41
|
+
Each component gets its own `gap` token under `component.{name}.gap`, aliasing
|
|
42
|
+
`semantic.spacing.component-s` — never a raw `primitive.spacing.*` reference and never a literal.
|
|
43
|
+
Since label→control and control→description want the same value everywhere today, one shared
|
|
44
|
+
token is enough — don't split into two identically-valued tokens purely for documentation's sake.
|
|
45
|
+
A plain flex `gap` on the root usually applies it to every in-flow child directly; a `*-legend`
|
|
46
|
+
using `float: left` (RadioGroup/CheckboxGroup) sits outside that flow and needs the same token
|
|
47
|
+
applied as its own explicit `margin-bottom` instead, since flex `gap` skips floated children.
|
|
48
|
+
|
|
49
|
+
## Multi-field forms: fields, blocks, and section headers
|
|
50
|
+
|
|
51
|
+
A longer form (settings pages, onboarding flows — see `Pages/Form`) groups fields into
|
|
52
|
+
labeled **blocks** (e.g. "Personal info", "Workspace", "Preferences"). This is a page-level layout
|
|
53
|
+
pattern, not a single component, so there's no `component.*` token for it — these are `primitive.spacing.*`
|
|
54
|
+
values applied directly at the composition site, same as any other layout decision `CLAUDE.md`
|
|
55
|
+
leaves to the consumer/pattern. Three distinct gaps, not to be confused with each other:
|
|
56
|
+
|
|
57
|
+
1. **Between fields within one block** — 16px (`primitive.spacing.100`). Note this is **double**
|
|
58
|
+
the 8px label/description gap above — that 8px is the *tight* gap around one field's own parts;
|
|
59
|
+
this 16px is the *looser* gap separating one whole field from the next.
|
|
60
|
+
2. **Block header → its first field** — also 16px (`primitive.spacing.100`), the same value as #1.
|
|
61
|
+
A block's header behaves like just another sibling in that block's own field stack, not a
|
|
62
|
+
separately-spaced element.
|
|
63
|
+
3. **Between blocks** (one labeled section's last field/divider to the next block's header) —
|
|
64
|
+
24px (`primitive.spacing.150`), deliberately larger than #1/#2 so a scan of the page reads the
|
|
65
|
+
block boundaries before the field boundaries within them.
|
|
66
|
+
|
|
67
|
+
**Block header typography: `semantic.textStyle.heading-m-bold`** (14px, bold, normal case) —
|
|
68
|
+
not the smaller, muted, uppercase "eyebrow" treatment `Menu`'s own group label uses
|
|
69
|
+
(`label-uppercase`, a different, much quieter role for a popup listbox, not a full page section).
|
|
70
|
+
A form block header is a real heading; render it as one.
|
|
71
|
+
|
|
72
|
+
```tsx
|
|
73
|
+
<form style={{ display: 'flex', flexDirection: 'column', gap: 'var(--helix-primitive-spacing-150)' }}>
|
|
74
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: 'var(--helix-primitive-spacing-100)' }}>
|
|
75
|
+
<h3 style={{
|
|
76
|
+
margin: 0,
|
|
77
|
+
fontSize: 'var(--helix-textStyle-heading-m-bold-fontSize)',
|
|
78
|
+
fontWeight: 'var(--helix-textStyle-heading-m-bold-fontWeight)',
|
|
79
|
+
lineHeight: 'var(--helix-textStyle-heading-m-bold-lineHeight)',
|
|
80
|
+
color: 'var(--helix-color-text-neutral)',
|
|
81
|
+
}}>
|
|
82
|
+
Personal info
|
|
83
|
+
</h3>
|
|
84
|
+
<Input label="Full name" ... />
|
|
85
|
+
<Input label="Work email" ... />
|
|
86
|
+
</div>
|
|
87
|
+
{/* next block, 24px away */}
|
|
88
|
+
</form>
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Reference
|
|
92
|
+
|
|
93
|
+
- `packages/tokens/src/tokens.json` — `component.{input,select,textarea,checkbox,radio}.gap`;
|
|
94
|
+
`semantic.textStyle.heading-m-bold` for block headers.
|
|
95
|
+
- `apps/storybook/stories/ProductPage.stories.tsx` (`Pages/CreateWorkspace`) — the reference
|
|
96
|
+
implementation of the multi-block layout above.
|
|
97
|
+
- [expand-collapse-chevron.md](expand-collapse-chevron.md) — the sibling pattern for a cross-component
|
|
98
|
+
rule enforced the same way (one canonical value, documented exceptions called out explicitly,
|
|
99
|
+
not silently allowed to drift per component).
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: group-spacing
|
|
3
|
+
category: layout
|
|
4
|
+
components: [Button, IconButton, Chip, Badge]
|
|
5
|
+
when: "Placing several elements of the same kind one after another — a button group, a row of chips, a set of badges."
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Pattern: Group spacing
|
|
9
|
+
|
|
10
|
+
**A rule, not a component.** Elements of the same kind placed one after another form a group, and the
|
|
11
|
+
elements inside a group are **4px apart** — `var(--helix-spacing-2xs)`.
|
|
12
|
+
|
|
13
|
+
## Why
|
|
14
|
+
|
|
15
|
+
A group should read as one unit. At 8px or 12px, two buttons or a row of chips start to read as separate,
|
|
16
|
+
unrelated controls; 4px keeps them visibly together while each one is still distinct and easy to hit.
|
|
17
|
+
One value everywhere also means any group looks the same wherever it appears.
|
|
18
|
+
|
|
19
|
+
## Rule
|
|
20
|
+
|
|
21
|
+
- **Same kind, one after another → 4px** (`--helix-spacing-2xs`):
|
|
22
|
+
- button groups — page header actions, a form's Cancel/Submit, a Modal footer, a toolbar
|
|
23
|
+
- icon-button groups — a view toggle, row actions
|
|
24
|
+
- chip groups — active filters, selected values
|
|
25
|
+
- badge groups — several statuses or tags on one item
|
|
26
|
+
- **Between different groups → more space** (8px or more), so the groups read apart. The one deliberate
|
|
27
|
+
case: a destructive action is set apart from the rest (see `action-bar.md` — Delete sits 16px away).
|
|
28
|
+
- **Not a group:** a control next to unrelated content (a search field and its Clear button are 4px apart
|
|
29
|
+
because they act as one control row, but a heading and its actions are not a group).
|
|
30
|
+
|
|
31
|
+
## Code
|
|
32
|
+
|
|
33
|
+
```tsx
|
|
34
|
+
<div style={{ display: 'flex', gap: 'var(--helix-spacing-2xs)' }}>
|
|
35
|
+
<Button variant="secondary">Cancel</Button>
|
|
36
|
+
<Button variant="primary">Save</Button>
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
<div aria-label="Active filters" style={{ display: 'flex', flexWrap: 'wrap', gap: 'var(--helix-spacing-2xs)' }}>
|
|
40
|
+
{filters.map(f => <Chip key={f.key} label={f.label} dismissible onDismiss={() => remove(f.key)} />)}
|
|
41
|
+
</div>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Where it's applied
|
|
45
|
+
|
|
46
|
+
Search + Filter (chips, and field ↔ Clear), Empty State and Action Bar buttons, Batch actions, the view
|
|
47
|
+
toggle, Team Dashboard's Export + view toggle, Form Field Group's Cancel/Submit, Modal's footer
|
|
48
|
+
(`component.modal.footerGap` → `semantic.spacing.2xs`), and the selected chips inside MultiSelect.
|
|
49
|
+
|
|
50
|
+
## Anti-patterns
|
|
51
|
+
|
|
52
|
+
- ❌ A hand-picked 6px / 8px / 12px between buttons of the same group
|
|
53
|
+
- ❌ The same gap between two different groups as inside one — they stop reading as separate
|
|
54
|
+
- ❌ A hardcoded `4px` instead of `var(--helix-spacing-2xs)`
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: motion-effects
|
|
3
|
+
category: motion
|
|
4
|
+
components: [FAB, Switch, Button, IconButton, Checkbox, RadioGroup, Chip, NavItem, Input, Menu, Toast, Chart]
|
|
5
|
+
when: "Deciding whether a component should use a Motion-based animation, and how."
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Pattern: Motion effects
|
|
9
|
+
|
|
10
|
+
Governed by [ADR-007](../../docs/ADR/ADR-007-motion-engine.md) (supersedes
|
|
11
|
+
[ADR-006](../../docs/ADR/ADR-006-liquid-motion-effects.md), which adopted `liquid-gooey` — replaced the same
|
|
12
|
+
day after real debugging cost). Read ADR-007's two hard rules before using any of this — this file is the
|
|
13
|
+
day-to-day reference, the ADR is the reasoning.
|
|
14
|
+
|
|
15
|
+
## What's available
|
|
16
|
+
|
|
17
|
+
| Need | Motion API | Import |
|
|
18
|
+
|------|-----------|--------|
|
|
19
|
+
| Simple position/scale/opacity animation | `motion.<element>` with `animate`/`initial`/`exit` + `transition` | `import { motion } from 'motion/react'` |
|
|
20
|
+
| Mount/unmount transitions | `AnimatePresence` wrapping conditionally-rendered `motion.*` children | `import { AnimatePresence } from 'motion/react'` |
|
|
21
|
+
| Drag-to-reorder a list | `Reorder.Group`/`Reorder.Item` — both take an `as` prop for real semantic elements (`as="tbody"`/`as="tr"`, not just the `ul`/`li` defaults) | `import { Reorder, useDragControls } from 'motion/react'` |
|
|
22
|
+
|
|
23
|
+
There is no gooey blob-merge equivalent — Motion animates individual elements' transform/opacity/color, it
|
|
24
|
+
doesn't blend SVG silhouettes into one shape. Don't reach for Motion expecting that specific look; that was
|
|
25
|
+
`liquid-gooey`'s one differentiator and it's gone with it (see ADR-007's Consequences).
|
|
26
|
+
|
|
27
|
+
## Approved component ↔ effect table
|
|
28
|
+
|
|
29
|
+
| Component | What | Status |
|
|
30
|
+
|-----------|------|--------|
|
|
31
|
+
| `FAB` | Speed-dial expand/collapse — `AnimatePresence` + `motion.button` per action (fade/scale/slide, not a shape merge), plus a squish-and-release `animate={{ scale }}` bounce on the trigger when it collapses. | Shipped. |
|
|
32
|
+
| `Switch` | Thumb position — `motion.span` + spring `animate`/`transition`. | Shipped. |
|
|
33
|
+
| Table rows / Cards | Drag-reorder — `Reorder.Group`/`Reorder.Item`, `as="tbody"`/`as="tr"` for table rows. | **Storybook-only pattern**. Try it interactively in `Components/Table`'s `DragReorder` story (`apps/storybook/stories/Components/Table.stories.tsx`, `DragRow`), or in context in `apps/storybook/stories/Dashboard.stories.tsx` (`MemberRow`, `handleReorder`). Not a shipped Table/Card prop — do not wire this into the real contracts without a follow-up decision, same status the earlier Bend spike had. **Two things every drag row must do:** `e.preventDefault()` in the grip's `onPointerDown` before `dragControls.start(e)` (otherwise the browser selects the text of every row the pointer crosses), and `data-dragging` on the `Reorder.Item` via `onDragStart`/`onDragEnd` (Table's CSS then keeps that row highlighted and switches off the other rows' hover fill + transition — without it, rows sliding under the pointer flash). **And it must be accessible (WCAG 2.1.1 + 2.5.7) — drag alone fails both:** use `apps/storybook/stories/_shared/row-reorder.tsx`: `ReorderGrip` (the grip is a real IconButton that also works from the keyboard: Space picks up, ↑/↓ move, Space drops, Escape cancels), `RowMoveMenu` (the row's ⋯ menu: Move to top / up / down / to bottom — the no-drag alternative), `ReorderInstructions` + `useReorderAnnouncer` (polite live region with the new position). Focus returns to the moved row. Chosen 2026-10-11 (option C + A). |
|
|
34
|
+
| `Chip` (dismiss) | Merge-on-dismiss (blob fusing into a neighbor). | **Tried and removed** — was a `liquid-gooey` spike (`ChipGroup.tsx`, deleted); there's no Motion equivalent for the shape-merge look. What shipped instead: a plain fade+scale-down exit, `animate`/`onAnimationComplete` — the real `onDismiss()` callback fires only once the exit finishes, so the consumer's list update lands exactly as the chip is already invisible. |
|
|
35
|
+
| `Button` / `IconButton` | Press feedback — `whileTap={{ scale }}` (0.97 / 0.94). | Shipped. **No `MotionConfig` here** — `whileTap` only plays while the user is actively pressing, gated on `isDisabled`; it's the same category as a CSS `:active` pseudo-class, which `prefers-reduced-motion` doesn't suppress either. This is the one deliberate exception to checklist item 1 below — don't extend it to any *autoplaying* animation. |
|
|
36
|
+
| `Checkbox` / `RadioGroup` | Check/dot pop-in. | Shipped, but **not Motion** — plain CSS `transform: scale()` transition. The indicator's visibility already tracks the native input's `:checked` state directly, which is correct for both controlled and uncontrolled usage on its own; adding a JS-tracked boolean just to drive Motion here would reintroduce the exact class of controlled/uncontrolled bug found and fixed in Switch, for no visual benefit CSS doesn't already deliver. Left as a documented case of "the checklist says Motion, the right call here is plain CSS." |
|
|
37
|
+
| `NavItem` | Sliding "current" indicator between nav items. | Shipped — `motion.span` with a shared `layoutId` (`ACTIVE_INDICATOR_LAYOUT_ID` in `NavItem.tsx`) across every instance; Motion's layout system animates it moving from the previously-current item to the new one instead of the background just cutting over. |
|
|
38
|
+
| `AvatarGroup` | Hover lift — only the hovered avatar itself lifts/scales, no cascade to neighbors. | Shipped, but **not Motion** — plain CSS `[data-helix-part="avatar-group-item"]:hover`, no JS at all. Went through the preview-first process (`.ai/skills/ds-preview-before-ship.md`): an earlier version cascaded a distance-based falloff to neighboring avatars (JS-computed `data-hover-distance`, Motion-adjacent complexity) — cut after review feedback that only the hovered avatar should move, at which point the whole effect collapsed to a single `:hover` rule and the JS became unnecessary, same "plain CSS is the right call" reasoning as Checkbox/RadioGroup and Input's shake. Values are `component.avatarGroup.hover-lift`/`hover-scale`, aliasing the new generic `semantic.transform.lift.s`/`scale.s` scale (2px lift + 2% scale — the subtler option, chosen for a compact group) (not component-scoped — see `packages/tokens/CLAUDE.md`'s "Motion naming vocabulary" and `Foundation/Semantic`'s Motion story for the full `transform.lift`/`scale.{s,m,l}` scale, most of which no other component consumes yet). Approved 2026-09-24. Under `prefers-reduced-motion: reduce` the avatar doesn't move at all (no lift, scale or transition). |
|
|
39
|
+
| `Menu` (and so `Select`/`MultiSelect`) | Open/close — grows in from its trigger (`menu.scale-enter` 0.97 → 1, `duration.enter`), closes settling to `menu.scale-exit` 0.99 over the shorter `duration.exit`, `easing.gentle`. | Shipped 2026-10-13, **not Motion** — CSS `@keyframes` on mount, plus `Menu.tsx` keeping the list mounted (`data-state="closing"`, `inert`, `aria-hidden`) for the close. transitions.dev "menu dropdown", approved after the preview-first step. Reduced motion: appears and goes at once. |
|
|
40
|
+
| `Button` | Swap in place — with an `icon`, icon ↔ spinner (`isLoading`) and icon ↔ icon cross-fade with blur + scale (`button.swap-*-icon`); a plain-text label cross-blurs while its width eases to the new text (`button.swap-*-label`, `-width`). | Shipped 2026-10-13, **not Motion** — CSS `@keyframes` on the stacked outgoing/incoming children (`data-swapping`) and an inline width transition; `whileTap` press feedback above is unchanged. transitions.dev "icon swap" + "text morph". Only fires when the content actually changes — never on mount. Reduced motion: instant swap. |
|
|
41
|
+
| `Toast` | Stack depth blur — toasts further back soften (half of `toast.depthBlur` at depth 1, all of it at depth 2) and sharpen on spread. | Shipped 2026-10-13, plain CSS `filter`. Completes the transitions.dev "banner stacking" recipe the stack was already built on. |
|
|
42
|
+
| `Chart` (donut) | Data update — same categories, new values: slices ease to their new angles (`chart.duration-update` 400ms, `chart.easing-update`) instead of drawing in again. | Shipped 2026-10-13 — ECharts' own update animation (`animationDurationUpdate`/`animationEasingUpdate`, read from the tokens). transitions.dev "donut chart". Reduced motion: no animation (Chart already sets `animation: false`). |
|
|
43
|
+
| `Input` (invalid) | Error-state shake — plays once when `invalid` transitions false→true (not on initial mount, not repeatedly while it stays invalid). | Shipped, but **not Motion** — plain CSS `@keyframes` + a `data-shaking="true"` attribute toggled imperatively via ref (remove/reflow/reapply, so a second failed attempt while still invalid retriggers it). Bespoke per-segment easing authored in Figma, same "plain CSS is the right call" reasoning as Checkbox/RadioGroup below. This is the one exception to the "never on Input/Select/Textarea" rule underneath: it fires only on a genuine state transition (the field just became invalid), the same category of feedback as `aria-invalid`/the error message appearing, not ambient/decorative motion — see `.ai/skills/ds-preview-before-ship.md` for how this got approved (a throwaway Artifact preview, tried in both themes and with reduced motion, before touching `Input.tsx`). |
|
|
44
|
+
|
|
45
|
+
**Never use a motion effect on:** `Select`, `Textarea` (form fields — motion here reads as
|
|
46
|
+
instability, not delight, and neither has an approved exception yet — if one comes up, it goes through the
|
|
47
|
+
same preview-first process Input's shake did), `Table` itself as a dense-data surface (only the drag-reorder
|
|
48
|
+
pattern above is scoped, not decorative motion on every row by default), or any component whose whole job is
|
|
49
|
+
to be read quickly and factually (`Badge`, status indicators). `Input` itself stays off-limits for anything
|
|
50
|
+
beyond the one shipped shake above — a new effect there needs its own preview and sign-off, not a rider on
|
|
51
|
+
this exception.
|
|
52
|
+
|
|
53
|
+
## Checklist before shipping a new Motion usage
|
|
54
|
+
|
|
55
|
+
0. **Preview it before it touches a real contract — mandatory for any new effect, or any change to an
|
|
56
|
+
entry in the "never use" list above.** Follow [`.ai/skills/ds-preview-before-ship.md`](../../skills/ds-preview-before-ship.md):
|
|
57
|
+
build the effect against the component's real tokens/anatomy in a throwaway preview (a Storybook story
|
|
58
|
+
not wired into the exported component, or a published Artifact), get explicit sign-off, and only then
|
|
59
|
+
implement it for real — updating this file's table (and the "never use" list, if the effect overturns
|
|
60
|
+
one of its entries) in the same change, not after. This is how Input's error-state shake got approved;
|
|
61
|
+
see its row above.
|
|
62
|
+
1. **Reduced motion is not automatic.** Verified against motion.dev's own accessibility docs, not assumed
|
|
63
|
+
— Motion needs an explicit `<MotionConfig reducedMotion="user">`. Scope it locally around the component's
|
|
64
|
+
own animated elements (see FAB/Switch) rather than relying on the consuming app having wrapped its root
|
|
65
|
+
in one; a shared component can't assume that setup exists. Exception: brief, user-driven `whileTap`
|
|
66
|
+
press feedback (Button/IconButton) — same category as CSS `:active`, not what reduced-motion targets.
|
|
67
|
+
2. Verify in Storybook with `prefers-reduced-motion: reduce` on (devtools → Rendering tab) — confirm the
|
|
68
|
+
`MotionConfig` you added actually degrades this specific usage, not just that the prop is present.
|
|
69
|
+
3. `fill`/`background`/`color` values inside `animate`/`initial`/`exit` are `--helix-*` token references
|
|
70
|
+
(`var(--helix-...)`), same rule as everywhere else in Helix — Motion can animate CSS custom properties
|
|
71
|
+
directly, no resolution hack needed (that hack was `liquid-gooey`-specific and is gone, see ADR-007).
|
|
72
|
+
4. Expect `verify:props` to flag Motion's own object keys that collide with `prop-map.md` names by
|
|
73
|
+
coincidence — `type: 'spring'` (Transition), `scale` (animate/initial/exit target) are confirmed false
|
|
74
|
+
positives, report-only, not a Helix prop. Add a one-line comment at the call site when you hit a new one
|
|
75
|
+
rather than trying to rename Motion's own API.
|
|
76
|
+
5. Verify dark mode — same as any other visual change.
|
|
77
|
+
|
|
78
|
+
## Shared presets
|
|
79
|
+
|
|
80
|
+
Spring physics (`stiffness`/`damping`) and cubic-bezier `ease` arrays have no `var()` form — they can
|
|
81
|
+
never be `tokens.json` entries (see `packages/tokens/CLAUDE.md`'s "Motion naming vocabulary" and "What
|
|
82
|
+
NOT to do"). They're centralized in `packages/core/src/lib/motionPresets.ts` instead — `SPRING_SNAPPY`
|
|
83
|
+
(shared by Switch's thumb and NavItem's indicator; consolidates a previously undocumented `damping: 32`
|
|
84
|
+
vs `35` drift between the two), `EASE_BACK`/`EASE_COLLAPSE` and FAB's three named transitions, and
|
|
85
|
+
`PRESS_SCALE_DEFAULT`/`PRESS_SCALE_COMPACT` for Button/IconButton's `whileTap`. Import from there instead
|
|
86
|
+
of typing a new spring/easing literal inline — that inline-per-component pattern is exactly how the
|
|
87
|
+
Switch/NavItem drift happened.
|
|
88
|
+
|
|
89
|
+
## Reference
|
|
90
|
+
|
|
91
|
+
- [expand-collapse-chevron.md](expand-collapse-chevron.md) — the sibling pattern for a disclosure
|
|
92
|
+
component's chevron icon (Accordion's `scaleY` flip). Plain CSS, not Motion, so it lives in its own
|
|
93
|
+
file rather than this table — read it before adding a chevron to any new expand/collapse component.
|
|
94
|
+
- [ADR-007](../../docs/ADR/ADR-007-motion-engine.md) — why Motion, what replaced `liquid-gooey` and why.
|
|
95
|
+
- [ADR-006](../../docs/ADR/ADR-006-liquid-motion-effects.md) — superseded, historical reasoning only.
|
|
96
|
+
- [ADR-005](../../docs/ADR/ADR-005-elevation-policy.md) — which components may ever carry a shadow (FAB's
|
|
97
|
+
`box-shadow` is now plain CSS, no special resolution needed).
|
|
98
|
+
- `packages/core/src/lib/resolveTokenPx.ts` — shared `getComputedStyle`-based numeric token resolver, used
|
|
99
|
+
by FAB's speed-dial offsets and Switch's thumb position (Motion's `animate.x`/`animate.y` are plain
|
|
100
|
+
numbers, tokens are CSS custom properties — something still has to bridge the two, engine-independent).
|