@helixds/react 0.0.0-stage → 0.2.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 +295 -0
- package/LICENSE +21 -0
- package/README.md +49 -2
- package/dist/archetypes/actions-navigation.md +62 -0
- package/dist/archetypes/data-display.md +68 -0
- package/dist/archetypes/feedback-status.md +54 -0
- package/dist/archetypes/form-selection.md +61 -0
- package/dist/archetypes/foundation.md +56 -0
- package/dist/archetypes/layout.md +53 -0
- package/dist/archetypes/overlays.md +54 -0
- package/dist/archetypes/text-input.md +58 -0
- 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/Combobox/Combobox.d.ts +17 -0
- package/dist/components/Combobox/Combobox.doc.d.ts +4 -0
- package/dist/components/Combobox/Combobox.doc.js +41 -0
- package/dist/components/Combobox/Combobox.js +141 -0
- package/dist/components/Combobox/Combobox.types.d.ts +31 -0
- package/dist/components/Combobox/Combobox.types.js +2 -0
- package/dist/components/Combobox/index.d.ts +9 -0
- package/dist/components/Combobox/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/Popover/Popover.d.ts +14 -0
- package/dist/components/Popover/Popover.doc.d.ts +4 -0
- package/dist/components/Popover/Popover.doc.js +47 -0
- package/dist/components/Popover/Popover.js +157 -0
- package/dist/components/Popover/Popover.types.d.ts +27 -0
- package/dist/components/Popover/Popover.types.js +2 -0
- package/dist/components/Popover/index.d.ts +9 -0
- package/dist/components/Popover/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/Tabs/Tabs.d.ts +13 -0
- package/dist/components/Tabs/Tabs.doc.d.ts +4 -0
- package/dist/components/Tabs/Tabs.doc.js +47 -0
- package/dist/components/Tabs/Tabs.js +61 -0
- package/dist/components/Tabs/Tabs.types.d.ts +33 -0
- package/dist/components/Tabs/Tabs.types.js +2 -0
- package/dist/components/Tabs/index.d.ts +9 -0
- package/dist/components/Tabs/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 +175 -0
- package/dist/contracts/AppShell.json +201 -0
- package/dist/contracts/Avatar.json +158 -0
- package/dist/contracts/AvatarGroup.json +170 -0
- package/dist/contracts/Badge.json +213 -0
- package/dist/contracts/Button.json +296 -0
- package/dist/contracts/Card.json +126 -0
- package/dist/contracts/Chart.json +168 -0
- package/dist/contracts/Checkbox.json +334 -0
- package/dist/contracts/CheckboxGroup.json +201 -0
- package/dist/contracts/Chip.json +321 -0
- package/dist/contracts/ChipGroup.json +183 -0
- package/dist/contracts/Combobox.json +431 -0
- package/dist/contracts/FAB.json +216 -0
- package/dist/contracts/Icon.json +307 -0
- package/dist/contracts/IconButton.json +214 -0
- package/dist/contracts/Input.json +401 -0
- package/dist/contracts/Menu.json +198 -0
- package/dist/contracts/Modal.json +193 -0
- package/dist/contracts/MultiSelect.json +245 -0
- package/dist/contracts/NavItem.json +149 -0
- package/dist/contracts/PageHeader.json +135 -0
- package/dist/contracts/Popover.json +322 -0
- package/dist/contracts/RadioButton.json +203 -0
- package/dist/contracts/RadioGroup.json +229 -0
- package/dist/contracts/SegmentedControl.json +194 -0
- package/dist/contracts/Select.json +241 -0
- package/dist/contracts/SideNav.json +139 -0
- package/dist/contracts/SidePanel.json +154 -0
- package/dist/contracts/Switch.json +202 -0
- package/dist/contracts/Table.json +131 -0
- package/dist/contracts/Tabs.json +353 -0
- package/dist/contracts/Textarea.json +354 -0
- package/dist/contracts/Toast.json +187 -0
- package/dist/contracts/Tooltip.json +169 -0
- package/dist/contracts/TopBar.json +129 -0
- package/dist/contracts/manifest.json +2170 -0
- package/dist/index.d.ts +118 -0
- package/dist/index.js +79 -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 +32 -0
- package/dist/layout/AppShell/AppShell.js +116 -0
- package/dist/layout/AppShell/AppShell.types.d.ts +24 -0
- package/dist/layout/AppShell/AppShell.types.js +2 -0
- package/dist/layout/AppShell/AppShellContext.d.ts +17 -0
- package/dist/layout/AppShell/AppShellContext.js +4 -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 +33 -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 +15 -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 +98 -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 +92 -3
- package/src/globals.css +3511 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Data Analytics
|
|
2
|
+
|
|
3
|
+
Use `Chart` from `@helixds/react`; it is the only approved renderer and applies the Helix ECharts theme.
|
|
4
|
+
|
|
5
|
+
- `line`: trend across ordered dates or sequence.
|
|
6
|
+
- `bar`: discrete-category comparison.
|
|
7
|
+
- `stacked-bar`: total and composition across categories.
|
|
8
|
+
- `donut`: a small part-to-whole distribution; no more than six meaningful slices.
|
|
9
|
+
- `timeline`: dated events or status periods.
|
|
10
|
+
|
|
11
|
+
Put a dashboard chart in `Card`. Pair it with its key takeaway in a card header or `PageHeader`, and use
|
|
12
|
+
`Table` for exact values. Use `Badge` for status, never custom legend pills.
|
|
13
|
+
|
|
14
|
+
Never import `echarts` in a product or pass raw ECharts options. Never invent chart colours, fonts,
|
|
15
|
+
margins, tooltip styles, shadows, or legends: `Chart` resolves Helix tokens.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: disabled-state
|
|
3
|
+
category: color
|
|
4
|
+
components: [Button, IconButton, Input, Select, MultiSelect, Textarea, Menu, Checkbox, CheckboxGroup, RadioButton, RadioGroup, Switch, SegmentedControl, Chip]
|
|
5
|
+
when: "Building or touching any interactive component's disabled state — the control itself, or a label/text sitting next to it."
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Pattern: Disabled state
|
|
9
|
+
|
|
10
|
+
**Rule: disabled means a real, solid gray look built from dedicated `component.{name}.fill/text/icon/border.disabled`
|
|
11
|
+
tokens (aliasing `semantic.color.fill/text/icon/border.disabled`) — never `opacity`.** Decided 2026-09-13, after
|
|
12
|
+
Button's disabled state turned out to be sharing a bare `opacity: 0.5` rule with its own `loading` state (see
|
|
13
|
+
"Loading is not disabled" below for why that combination was itself wrong, independent of the opacity issue).
|
|
14
|
+
|
|
15
|
+
## Why not opacity
|
|
16
|
+
|
|
17
|
+
`opacity` fades everything inside the element toward whatever's behind it — background, border, text, icon,
|
|
18
|
+
all at once, at whatever contrast ratio falls out of the underlying colors and the page behind them. That's
|
|
19
|
+
the right tool for a large surface or an image going translucent as a whole (an entire disabled table, a
|
|
20
|
+
preview thumbnail) — but for a compact control (a button, an input, a checkbox), it means the disabled look
|
|
21
|
+
is never actually authored: it's a mechanical dimming of whatever colors were already there, landing on a
|
|
22
|
+
different effective gray per variant and per theme instead of one deliberate, consistent look.
|
|
23
|
+
|
|
24
|
+
## The rule
|
|
25
|
+
|
|
26
|
+
1. **Background** → `component.{name}.fill.disabled` → `{semantic.color.fill.disabled}`
|
|
27
|
+
2. **Text** → `component.{name}.text.disabled` → `{semantic.color.text.disabled}`
|
|
28
|
+
3. **Icon** (if the component renders one) → `component.{name}.icon.disabled` → `{semantic.color.icon.disabled}`
|
|
29
|
+
4. **Border** (if the component has one) → `component.{name}.border.disabled` → `{semantic.color.border.neutral-light}`
|
|
30
|
+
— the established convention across every compliant component so far, not a dedicated
|
|
31
|
+
`semantic.color.border.disabled` (no such token exists).
|
|
32
|
+
|
|
33
|
+
These semantic tokens are already documented as not-WCAG-compliant by design (see
|
|
34
|
+
`semantic.color.text.disabled`'s own `$description`) — a disabled control is expected to read as visibly
|
|
35
|
+
inert, not to pass 4.5:1. Don't chase a contrast fix here; that's the intended contrast.
|
|
36
|
+
|
|
37
|
+
## Every text part dims — not only the control (owner's decision 2026-10-20)
|
|
38
|
+
|
|
39
|
+
When a component is disabled, **all of its text goes to `component.{name}.text.disabled`**: the label, the
|
|
40
|
+
description, the required `*`, a group's legend and description. A disabled field whose label or hint stays
|
|
41
|
+
dark reads as half-enabled. The required `*` is its own part (`{name}-required`, never an inline style) so the
|
|
42
|
+
rule can reach it. The error message keeps its danger color — it's still information the user needs.
|
|
43
|
+
|
|
44
|
+
- **Code:** one rule per component, `[...-root][data-disabled] [...-label | -required | -description]`
|
|
45
|
+
(a group: the `fieldset[data-disabled]` legend, its `*` and the group description).
|
|
46
|
+
- **Figma:** the same — every disabled variant binds those text layers to `text/disabled`. Disabled has **no**
|
|
47
|
+
hover / focus / invalid variants (`state` is default only): a disabled control doesn't react or validate.
|
|
48
|
+
- **Contrast:** exempt (WCAG 1.4.3, "part of an inactive user interface component"; root CLAUDE.md rule 9).
|
|
49
|
+
axe alone only knows that for a disabled control's own `<label>`, so the test-runner drops contrast nodes
|
|
50
|
+
inside `[disabled]` / `[data-disabled]` / `[aria-disabled="true"]` — a disabled story never lowers a
|
|
51
|
+
component's status.
|
|
52
|
+
|
|
53
|
+
## Loading is not disabled — don't let them share CSS
|
|
54
|
+
|
|
55
|
+
A `loading` state is not a disabled state, even though the element commonly gets the native `disabled`
|
|
56
|
+
attribute in both cases so it can't be interacted with mid-request (see `Button.tsx`:
|
|
57
|
+
`disabled={disabled || loading}`). Visually they're opposites: loading keeps the component's normal variant
|
|
58
|
+
colors — the user should still see "this is the primary/danger action," just busy right now — the spinner in
|
|
59
|
+
front of the label is the only visible change. Disabled visually recedes. Because the native `disabled`
|
|
60
|
+
attribute is shared, every disabled-only CSS rule needs `:not([data-loading])` (or the component's own
|
|
61
|
+
loading attribute) so loading doesn't fall into the gray look by accident — see Button's
|
|
62
|
+
`[data-helix-part="button"]:disabled:not([data-loading])` rule.
|
|
63
|
+
|
|
64
|
+
## Status (as of 2026-09-13)
|
|
65
|
+
|
|
66
|
+
Every component in the list above is compliant — no `opacity`-based disabled state left anywhere in
|
|
67
|
+
`globals.css`. Fixing the rest of the list turned up two components (`Checkbox`, `RadioButton`) whose
|
|
68
|
+
`fill.disabled`/`border.disabled` tokens already existed in `tokens.json` but were never wired into any CSS
|
|
69
|
+
rule — the control itself was fading via the same bare opacity as its label, silently ignoring its own
|
|
70
|
+
dedicated tokens. Both are now wired: `[data-helix-part="{checkbox,radio}-input"]:disabled + [...]-control`
|
|
71
|
+
sets the real disabled fill/border, placed after the `:checked` rule in source order so it wins when an item
|
|
72
|
+
is both checked and disabled.
|
|
73
|
+
|
|
74
|
+
## Reference
|
|
75
|
+
|
|
76
|
+
- `packages/core/src/globals.css` — Button's `[data-helix-part="button"]:disabled:not([data-loading])` block
|
|
77
|
+
(plus its icon-color sibling rule) is the reference implementation.
|
|
78
|
+
- `packages/tokens/src/tokens.json` — `component.button.fill/text/icon/border.disabled`.
|
|
79
|
+
- [form-field-spacing.md](form-field-spacing.md) — the sibling pattern for how a cross-component rule gets
|
|
80
|
+
enforced here: one canonical approach, documented exceptions, a reference implementation named explicitly.
|
|
@@ -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 (Menu's contract) — 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)`
|