@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,98 @@
|
|
|
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) (Motion replaced `liquid-gooey` the same
|
|
11
|
+
day it was adopted, after real debugging cost). Read ADR-007's two hard rules before using any of this — this file is the
|
|
12
|
+
day-to-day reference, the ADR is the reasoning.
|
|
13
|
+
|
|
14
|
+
## What's available
|
|
15
|
+
|
|
16
|
+
| Need | Motion API | Import |
|
|
17
|
+
|------|-----------|--------|
|
|
18
|
+
| Simple position/scale/opacity animation | `motion.<element>` with `animate`/`initial`/`exit` + `transition` | `import { motion } from 'motion/react'` |
|
|
19
|
+
| Mount/unmount transitions | `AnimatePresence` wrapping conditionally-rendered `motion.*` children | `import { AnimatePresence } from 'motion/react'` |
|
|
20
|
+
| 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'` |
|
|
21
|
+
|
|
22
|
+
There is no gooey blob-merge equivalent — Motion animates individual elements' transform/opacity/color, it
|
|
23
|
+
doesn't blend SVG silhouettes into one shape. Don't reach for Motion expecting that specific look; that was
|
|
24
|
+
`liquid-gooey`'s one differentiator and it's gone with it (see ADR-007's Consequences).
|
|
25
|
+
|
|
26
|
+
## Approved component ↔ effect table
|
|
27
|
+
|
|
28
|
+
| Component | What | Status |
|
|
29
|
+
|-----------|------|--------|
|
|
30
|
+
| `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. |
|
|
31
|
+
| `Switch` | Thumb position — `motion.span` + spring `animate`/`transition`. | Shipped. |
|
|
32
|
+
| 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). |
|
|
33
|
+
| `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. |
|
|
34
|
+
| `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. |
|
|
35
|
+
| `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." |
|
|
36
|
+
| `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. |
|
|
37
|
+
| `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). |
|
|
38
|
+
| `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. |
|
|
39
|
+
| `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. |
|
|
40
|
+
| `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. |
|
|
41
|
+
| `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`). |
|
|
42
|
+
| `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`). |
|
|
43
|
+
|
|
44
|
+
**Never use a motion effect on:** `Select`, `Textarea` (form fields — motion here reads as
|
|
45
|
+
instability, not delight, and neither has an approved exception yet — if one comes up, it goes through the
|
|
46
|
+
same preview-first process Input's shake did), `Table` itself as a dense-data surface (only the drag-reorder
|
|
47
|
+
pattern above is scoped, not decorative motion on every row by default), or any component whose whole job is
|
|
48
|
+
to be read quickly and factually (`Badge`, status indicators). `Input` itself stays off-limits for anything
|
|
49
|
+
beyond the one shipped shake above — a new effect there needs its own preview and sign-off, not a rider on
|
|
50
|
+
this exception.
|
|
51
|
+
|
|
52
|
+
## Checklist before shipping a new Motion usage
|
|
53
|
+
|
|
54
|
+
0. **Preview it before it touches a real contract — mandatory for any new effect, or any change to an
|
|
55
|
+
entry in the "never use" list above.** Follow [`.ai/skills/ds-preview-before-ship.md`](../../skills/ds-preview-before-ship.md):
|
|
56
|
+
build the effect against the component's real tokens/anatomy in a throwaway preview (a Storybook story
|
|
57
|
+
not wired into the exported component, or a published Artifact), get explicit sign-off, and only then
|
|
58
|
+
implement it for real — updating this file's table (and the "never use" list, if the effect overturns
|
|
59
|
+
one of its entries) in the same change, not after. This is how Input's error-state shake got approved;
|
|
60
|
+
see its row above.
|
|
61
|
+
1. **Reduced motion is not automatic.** Verified against motion.dev's own accessibility docs, not assumed
|
|
62
|
+
— Motion needs an explicit `<MotionConfig reducedMotion="user">`. Scope it locally around the component's
|
|
63
|
+
own animated elements (see FAB/Switch) rather than relying on the consuming app having wrapped its root
|
|
64
|
+
in one; a shared component can't assume that setup exists. Exception: brief, user-driven `whileTap`
|
|
65
|
+
press feedback (Button/IconButton) — same category as CSS `:active`, not what reduced-motion targets.
|
|
66
|
+
2. Verify in Storybook with `prefers-reduced-motion: reduce` on (devtools → Rendering tab) — confirm the
|
|
67
|
+
`MotionConfig` you added actually degrades this specific usage, not just that the prop is present.
|
|
68
|
+
3. `fill`/`background`/`color` values inside `animate`/`initial`/`exit` are `--helix-*` token references
|
|
69
|
+
(`var(--helix-...)`), same rule as everywhere else in Helix — Motion can animate CSS custom properties
|
|
70
|
+
directly, no resolution hack needed (that hack was `liquid-gooey`-specific and is gone, see ADR-007).
|
|
71
|
+
4. Expect `verify:props` to flag Motion's own object keys that collide with `prop-map.md` names by
|
|
72
|
+
coincidence — `type: 'spring'` (Transition), `scale` (animate/initial/exit target) are confirmed false
|
|
73
|
+
positives, report-only, not a Helix prop. Add a one-line comment at the call site when you hit a new one
|
|
74
|
+
rather than trying to rename Motion's own API.
|
|
75
|
+
5. Verify dark mode — same as any other visual change.
|
|
76
|
+
|
|
77
|
+
## Shared presets
|
|
78
|
+
|
|
79
|
+
Spring physics (`stiffness`/`damping`) and cubic-bezier `ease` arrays have no `var()` form — they can
|
|
80
|
+
never be `tokens.json` entries (see `packages/tokens/CLAUDE.md`'s "Motion naming vocabulary" and "What
|
|
81
|
+
NOT to do"). They're centralized in `packages/core/src/lib/motionPresets.ts` instead — `SPRING_SNAPPY`
|
|
82
|
+
(shared by Switch's thumb and NavItem's indicator; consolidates a previously undocumented `damping: 32`
|
|
83
|
+
vs `35` drift between the two), `EASE_BACK`/`EASE_COLLAPSE` and FAB's three named transitions, and
|
|
84
|
+
`PRESS_SCALE_DEFAULT`/`PRESS_SCALE_COMPACT` for Button/IconButton's `whileTap`. Import from there instead
|
|
85
|
+
of typing a new spring/easing literal inline — that inline-per-component pattern is exactly how the
|
|
86
|
+
Switch/NavItem drift happened.
|
|
87
|
+
|
|
88
|
+
## Reference
|
|
89
|
+
|
|
90
|
+
- [expand-collapse-chevron.md](expand-collapse-chevron.md) — the sibling pattern for a disclosure
|
|
91
|
+
component's chevron icon (Accordion's `scaleY` flip). Plain CSS, not Motion, so it lives in its own
|
|
92
|
+
file rather than this table — read it before adding a chevron to any new expand/collapse component.
|
|
93
|
+
- [ADR-007](../../docs/ADR/ADR-007-motion-engine.md) — why Motion, what replaced `liquid-gooey` and why.
|
|
94
|
+
- [ADR-005](../../docs/ADR/ADR-005-elevation-policy.md) — which components may ever carry a shadow (FAB's
|
|
95
|
+
`box-shadow` is now plain CSS, no special resolution needed).
|
|
96
|
+
- `packages/core/src/lib/resolveTokenPx.ts` — shared `getComputedStyle`-based numeric token resolver, used
|
|
97
|
+
by FAB's speed-dial offsets and Switch's thumb position (Motion's `animate.x`/`animate.y` are plain
|
|
98
|
+
numbers, tokens are CSS custom properties — something still has to bridge the two, engine-independent).
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: same-row-sizing
|
|
3
|
+
category: layout
|
|
4
|
+
components: [Button, IconButton, Input, Select]
|
|
5
|
+
when: "Placing two or more controls side by side on one line — a top bar, a filter row, a toolbar, an action bar."
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Pattern: Same-row sizing
|
|
9
|
+
|
|
10
|
+
**A rule, not a component.** Controls that sit next to each other on the same line share the same `size`
|
|
11
|
+
(ADR-004's control ladder: `s` → 24px, `m` → 32px, `l` → 40px), so their heights match.
|
|
12
|
+
|
|
13
|
+
## Why
|
|
14
|
+
|
|
15
|
+
A 24px search field next to 32px icon buttons reads as a mistake, not a hierarchy: the eye sees two
|
|
16
|
+
edges that almost line up but don't. Mixed heights in one row look unfinished even when every control is
|
|
17
|
+
correct on its own. The Team dashboard's top bar had exactly this: `Input size="s"` (24px) beside
|
|
18
|
+
`IconButton size="m"` (32px).
|
|
19
|
+
|
|
20
|
+
## Rule
|
|
21
|
+
|
|
22
|
+
- **Same row → same `size`.** Pick one size for the row and pass it to every control in it: `Input`,
|
|
23
|
+
`Select`, `Button`, `IconButton`.
|
|
24
|
+
- **Default to `m`** unless the whole row has a reason to be denser (`s`, e.g. a bulk-action bar inside a
|
|
25
|
+
table) or larger (`l`).
|
|
26
|
+
- **Applies wherever controls line up:** top bars, filter rows (search + selects + buttons), toolbars,
|
|
27
|
+
action bars, view toggles, a form's inline submit row.
|
|
28
|
+
- **Doesn't apply to** non-control content in the row: text, `Badge`, `Chip`, `Avatar`. Those follow
|
|
29
|
+
their own density model (see ADR-004's documented exceptions) and are vertically centered, not matched
|
|
30
|
+
in height.
|
|
31
|
+
- **`SegmentedControl` has no `size` prop.** It is always 24px (`semantic.size.s`), so put it in a
|
|
32
|
+
row of `s` controls, or accept the mismatch knowingly. Don't stretch it with `style`.
|
|
33
|
+
|
|
34
|
+
## Code
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
<TopBar
|
|
38
|
+
start={<Input label="Search" hideLabel icon={IconSearch} placeholder="Search members…" size="m" />}
|
|
39
|
+
end={
|
|
40
|
+
<>
|
|
41
|
+
<IconButton variant="ghost" size="m" icon={IconBell} label="Notifications" />
|
|
42
|
+
<IconButton variant="ghost" size="m" icon={IconHelp} label="Help" />
|
|
43
|
+
</>
|
|
44
|
+
}
|
|
45
|
+
/>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Anti-patterns
|
|
49
|
+
|
|
50
|
+
- `Input size="s"` next to `IconButton size="m"`: 24px beside 32px.
|
|
51
|
+
- A `Select` at the default `m` next to a `Button size="s"` in the same filter row.
|
|
52
|
+
- Faking a match with a hardcoded `height` in `style` instead of choosing the same `size`.
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: search-filter
|
|
3
|
+
category: form
|
|
4
|
+
components: [Input, Button, Chip]
|
|
5
|
+
when: "Filtering a list or table with a search field + optional filter buttons."
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Pattern: Search + Filter
|
|
9
|
+
|
|
10
|
+
## When to use
|
|
11
|
+
|
|
12
|
+
- Tables/lists where the user needs to find items quickly
|
|
13
|
+
- Any collection with more than ~20 items
|
|
14
|
+
|
|
15
|
+
## Anatomy
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
┌────────────────────────────────────────────────────────────┐
|
|
19
|
+
│ 🔍 Search projects… [Clear] │
|
|
20
|
+
│ │
|
|
21
|
+
│ Active filters: [Status: Active ×] [Date: This week ×] │
|
|
22
|
+
└────────────────────────────────────────────────────────────┘
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Code
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
import { useState } from 'react';
|
|
29
|
+
import { Input, Button, Chip } from '@helixds/react';
|
|
30
|
+
import { IconSearch } from '@tabler/icons-react';
|
|
31
|
+
// icon/iconEnd take the Tabler icon component by reference — never a pre-instantiated
|
|
32
|
+
// element like `icon={<IconSearch size={16} />}` — see root CLAUDE.md rule 2.
|
|
33
|
+
|
|
34
|
+
type ActiveFilter = { key: string; label: string };
|
|
35
|
+
|
|
36
|
+
function SearchFilter({
|
|
37
|
+
placeholder = 'Search…',
|
|
38
|
+
onSearch,
|
|
39
|
+
filters,
|
|
40
|
+
activeFilters,
|
|
41
|
+
onRemoveFilter,
|
|
42
|
+
onClearAll,
|
|
43
|
+
}: {
|
|
44
|
+
placeholder?: string;
|
|
45
|
+
onSearch: (query: string) => void;
|
|
46
|
+
filters?: React.ReactNode;
|
|
47
|
+
activeFilters?: ActiveFilter[];
|
|
48
|
+
onRemoveFilter?: (key: string) => void;
|
|
49
|
+
onClearAll?: () => void;
|
|
50
|
+
}) {
|
|
51
|
+
const [query, setQuery] = useState('');
|
|
52
|
+
const hasActive = (activeFilters?.length ?? 0) > 0;
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<div
|
|
56
|
+
data-helix-pattern="search-filter"
|
|
57
|
+
style={{ display: 'flex', flexDirection: 'column', gap: 'var(--helix-primitive-spacing-75)' }}
|
|
58
|
+
>
|
|
59
|
+
{/* Search + filter controls — 4px (spacing-2xs) between the field and its buttons */}
|
|
60
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: 'var(--helix-spacing-2xs)' }}>
|
|
61
|
+
<Input
|
|
62
|
+
label="Search"
|
|
63
|
+
hideLabel
|
|
64
|
+
icon={IconSearch}
|
|
65
|
+
placeholder={placeholder}
|
|
66
|
+
value={query}
|
|
67
|
+
onChange={e => { setQuery(e.target.value); onSearch(e.target.value); }}
|
|
68
|
+
fullWidth
|
|
69
|
+
/>
|
|
70
|
+
{filters}
|
|
71
|
+
{hasActive && (
|
|
72
|
+
<Button variant="secondary" onClick={onClearAll}>
|
|
73
|
+
Clear
|
|
74
|
+
</Button>
|
|
75
|
+
)}
|
|
76
|
+
</div>
|
|
77
|
+
|
|
78
|
+
{/* Active filter chips */}
|
|
79
|
+
{hasActive && (
|
|
80
|
+
<div
|
|
81
|
+
aria-label="Active filters"
|
|
82
|
+
style={{ display: 'flex', gap: 'var(--helix-spacing-2xs)', flexWrap: 'wrap' }}
|
|
83
|
+
>
|
|
84
|
+
{activeFilters?.map(f => (
|
|
85
|
+
<Chip
|
|
86
|
+
key={f.key}
|
|
87
|
+
variant="neutral"
|
|
88
|
+
size="s"
|
|
89
|
+
label={f.label}
|
|
90
|
+
dismissible
|
|
91
|
+
onDismiss={() => onRemoveFilter?.(f.key)}
|
|
92
|
+
/>
|
|
93
|
+
))}
|
|
94
|
+
</div>
|
|
95
|
+
)}
|
|
96
|
+
</div>
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Rules
|
|
102
|
+
|
|
103
|
+
1. The search Input must have `label` (use `hideLabel` if visually hidden — still needed for a11y)
|
|
104
|
+
2. Active filter chips use the real `<Chip>` component (`dismissible`/`onDismiss`, default
|
|
105
|
+
look, `variant="neutral"`, smallest size `s` (24px)) — not
|
|
106
|
+
`<Badge>` (not interactive) and not a plain `<Button>` (Chip's whole `purpose` is "a compact selectable
|
|
107
|
+
label for filters, categories, or short choices" — this is precisely that case; an earlier version of
|
|
108
|
+
this doc predated Chip's existence and used Button instead, now corrected)
|
|
109
|
+
3. Clear all is a `variant="secondary"` Button with no icon, same size as the search field (same-row-sizing.md)
|
|
110
|
+
4. `aria-label="Active filters"` on the chip container is required for screen readers
|
|
111
|
+
|
|
112
|
+
## Anti-patterns
|
|
113
|
+
|
|
114
|
+
- ❌ Using `<Badge>` for active filter chips — they're not interactive; use `<Chip>`
|
|
115
|
+
- ❌ Using a plain `<Button>` for active filter chips — `<Chip>` already models `dismissible`
|
|
116
|
+
states with the right ARIA (`aria-pressed`, `aria-label="Dismiss {label}"`) for free
|
|
117
|
+
- ❌ Hiding the search label entirely with no `aria-label` fallback
|
|
118
|
+
- ❌ Triggering search on button click instead of `onChange` — users expect immediate filtering
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: show-hide-parts
|
|
3
|
+
category: foundation
|
|
4
|
+
components: [Chip, Button, Input, Badge, Select, NavItem]
|
|
5
|
+
when: "A component has an optional part that is either there or not — an icon, a trailing icon, a dismiss ×, a spinner, a description line."
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Pattern: Show/hide parts
|
|
9
|
+
|
|
10
|
+
**A rule for building components, in code and in Figma.** An optional part that only appears or disappears —
|
|
11
|
+
it doesn't change any color, size or state of the rest of the component — is a **boolean** in code and a
|
|
12
|
+
**BOOLEAN property** in Figma. Never a VARIANT.
|
|
13
|
+
|
|
14
|
+
## Why
|
|
15
|
+
|
|
16
|
+
Every VARIANT axis multiplies the Figma variant count. Chip with `dismissible` as a variant had 100 variants;
|
|
17
|
+
as a boolean it has 50. A boolean also maps 1:1 to the code prop, so designers and developers toggle the same
|
|
18
|
+
thing.
|
|
19
|
+
|
|
20
|
+
A Figma BOOLEAN can only show or hide a layer — it can't change a padding. So the rule only works if the
|
|
21
|
+
component is **built so that showing or hiding the part never changes any other spacing**.
|
|
22
|
+
|
|
23
|
+
## Rule
|
|
24
|
+
|
|
25
|
+
1. **The part brings its own spacing.** Whatever space it needs between itself and its neighbour lives on
|
|
26
|
+
the part itself (a padding on its own wrapper), not on the container. The container's paddings are the
|
|
27
|
+
same with or without it.
|
|
28
|
+
- Chip: `chip-icon` carries 2px on the label side, `chip-icon-end` and `chip-dismiss` too; the chip keeps
|
|
29
|
+
12px on both ends whether or not any of them is shown. Hiding one removes exactly its own width.
|
|
30
|
+
2. **Code mirrors Figma.** The part is rendered in the normal flow inside the container that holds the
|
|
31
|
+
paddings (no absolute positioning that needs the container to reserve room for it, no padding that
|
|
32
|
+
switches with the prop). If the part has a hover surface bigger than itself (the ×'s round hover), draw
|
|
33
|
+
it with a pseudo-element that takes no layout space.
|
|
34
|
+
3. **In Figma:** a BOOLEAN property bound to the part's visibility (`componentPropertyReferences.visible`),
|
|
35
|
+
named exactly like the code prop (`icon`, `iconEnd`, `dismissible`, `loading`…). An icon slot gets the
|
|
36
|
+
BOOLEAN plus an INSTANCE_SWAP (components-to-figma.md).
|
|
37
|
+
4. **When it can't be a boolean:** only if showing the part changes something else's color, size or state
|
|
38
|
+
(e.g. `loading` replacing the label and dimming the button) — then it's a VARIANT, and the contract's
|
|
39
|
+
`figma.properties` says why.
|
|
40
|
+
|
|
41
|
+
## Code stays implicit (decided 2026-10-03)
|
|
42
|
+
|
|
43
|
+
The boolean doesn't need its own prop in code. An icon slot is shown by passing `icon`; an optional text
|
|
44
|
+
part (`description`, `errorMessage`…) is shown by passing its text. Figma mirrors that with two properties
|
|
45
|
+
on the same layer: a BOOLEAN named exactly like the prop (`description`) for visibility and a TEXT
|
|
46
|
+
`description text` for the content — the same pairing as `icon` + `icon swap`. `.ai/maps/figma-map.md` marks
|
|
47
|
+
these rows as `BOOLEAN` + `TEXT`; a component whose Figma set lacks one of them is out of date.
|
|
48
|
+
|
|
49
|
+
## Checklist when building a component
|
|
50
|
+
|
|
51
|
+
- [ ] Every optional part is a boolean prop in code
|
|
52
|
+
- [ ] Toggling it doesn't change any padding or gap outside the part (measure both states)
|
|
53
|
+
- [ ] In Figma it's a BOOLEAN on the part's visibility, same name as the prop
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: stat-card
|
|
3
|
+
category: data-display
|
|
4
|
+
components: [Card, Badge]
|
|
5
|
+
when: "Showing a single labeled metric with an optional trend delta — a dashboard KPI, an analytics summary tile."
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Pattern: Stat Card
|
|
9
|
+
|
|
10
|
+
## When to use
|
|
11
|
+
|
|
12
|
+
- Dashboard KPI rows (Members, Revenue, Active users, ...)
|
|
13
|
+
- Analytics summary tiles
|
|
14
|
+
- Any "label + big number + optional up/down delta" widget
|
|
15
|
+
|
|
16
|
+
**This is a composition, not a component.** It used to be a standalone `StatCard` component; it was
|
|
17
|
+
folded back into a `Card` recipe because it has no anatomy, ARIA, or interaction of its own beyond what
|
|
18
|
+
`Card` already provides — it's `Card` plus a fixed internal text layout. There is nothing here that
|
|
19
|
+
justifies its own contract/tokens/export surface. Copy the code below into your own file rather than
|
|
20
|
+
expecting an import.
|
|
21
|
+
|
|
22
|
+
## Anatomy
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
┌───────────────────────┐
|
|
26
|
+
│ MEMBERS [↗ +14] │ ← delta Badge (xs) on the label's line, right-aligned
|
|
27
|
+
│ 103 │
|
|
28
|
+
└───────────────────────┘
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Code
|
|
32
|
+
|
|
33
|
+
```tsx
|
|
34
|
+
import { Card, Badge } from '@helixds/react';
|
|
35
|
+
import { IconArrowUpRight, IconArrowDownRight } from '@tabler/icons-react';
|
|
36
|
+
|
|
37
|
+
type Trend = 'up' | 'down';
|
|
38
|
+
|
|
39
|
+
function StatCard({
|
|
40
|
+
label, value, delta, trend,
|
|
41
|
+
}: { label: string; value: string; delta?: string; trend?: Trend }) {
|
|
42
|
+
return (
|
|
43
|
+
<Card>
|
|
44
|
+
{/* Header row: label on the left, delta Badge on the right, both centered on the label's line */}
|
|
45
|
+
<div style={{
|
|
46
|
+
display: 'flex',
|
|
47
|
+
alignItems: 'center',
|
|
48
|
+
justifyContent: 'space-between',
|
|
49
|
+
gap: 'var(--helix-spacing-xs)',
|
|
50
|
+
marginBottom: 'var(--helix-spacing-xs)',
|
|
51
|
+
}}>
|
|
52
|
+
<div style={{
|
|
53
|
+
// semantic.textStyle.label-uppercase — its token description asks for text-transform +
|
|
54
|
+
// letter-spacing at the call site, so both come from here (letter-spacing from its token).
|
|
55
|
+
fontFamily: 'var(--helix-textStyle-label-uppercase-fontFamily)',
|
|
56
|
+
fontSize: 'var(--helix-textStyle-label-uppercase-fontSize)',
|
|
57
|
+
fontWeight: 'var(--helix-textStyle-label-uppercase-fontWeight)',
|
|
58
|
+
lineHeight: 'var(--helix-textStyle-label-uppercase-lineHeight)',
|
|
59
|
+
textTransform: 'uppercase',
|
|
60
|
+
letterSpacing: 'var(--helix-primitive-letterSpacing-wide)',
|
|
61
|
+
color: 'var(--helix-color-text-neutral-lightest)',
|
|
62
|
+
}}>
|
|
63
|
+
{label}
|
|
64
|
+
</div>
|
|
65
|
+
{delta && (
|
|
66
|
+
// The delta is a Badge: success when up, danger when down, neutral with no trend — its icon slot
|
|
67
|
+
// carries the trend arrow.
|
|
68
|
+
<Badge
|
|
69
|
+
variant={trend === 'up' ? 'success' : trend === 'down' ? 'danger' : 'neutral'}
|
|
70
|
+
size="xs"
|
|
71
|
+
label={delta}
|
|
72
|
+
{...(trend ? { icon: trend === 'up' ? IconArrowUpRight : IconArrowDownRight } : {})}
|
|
73
|
+
/>
|
|
74
|
+
)}
|
|
75
|
+
</div>
|
|
76
|
+
<div style={{
|
|
77
|
+
fontFamily: 'var(--helix-textStyle-heading-3xl-bold-fontFamily)',
|
|
78
|
+
fontSize: 'var(--helix-textStyle-heading-3xl-bold-fontSize)',
|
|
79
|
+
fontWeight: 'var(--helix-textStyle-heading-3xl-bold-fontWeight)',
|
|
80
|
+
lineHeight: 'var(--helix-textStyle-heading-3xl-bold-lineHeight)',
|
|
81
|
+
letterSpacing: 'var(--helix-primitive-letterSpacing-tight)',
|
|
82
|
+
color: 'var(--helix-color-text-neutral)',
|
|
83
|
+
fontVariantNumeric: 'tabular-nums',
|
|
84
|
+
}}>
|
|
85
|
+
{value}
|
|
86
|
+
</div>
|
|
87
|
+
</Card>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Rules
|
|
93
|
+
|
|
94
|
+
1. `value` is a pre-formatted string from the consumer (`'103'`, `'89%'`) — this pattern never formats numbers itself
|
|
95
|
+
2. The delta is a `Badge`: `success` + up arrow when `trend="up"`, `danger` + down arrow when `trend="down"`.
|
|
96
|
+
Omit `trend` for a delta with no clear direction — a `neutral` Badge with no icon
|
|
97
|
+
3. Lay several of these out with a real CSS grid (`grid-template-columns: repeat(auto-fit, minmax(200px, 1fr))`), not `display: flex` with no basis — flex items without an explicit width just hug their own content, so cards end up different widths with no logic. See `apps/storybook/stories/Dashboard.stories.tsx`'s KPI row.
|
|
98
|
+
4. No shadow — Card is flat by design (see [ADR-005](../../docs/ADR/ADR-005-elevation-policy.md))
|
|
99
|
+
|
|
100
|
+
## Anti-patterns
|
|
101
|
+
|
|
102
|
+
- ❌ Reaching for a `StatCard` import — it doesn't exist; copy the code above
|
|
103
|
+
- ❌ Hardcoded px/hex values instead of the tokens shown above
|
|
104
|
+
- ❌ The delta as loose colored text + a separate Icon — it's a Badge, which already pairs color, icon and text
|
|
105
|
+
- ❌ A `box-shadow` on the card to make it "pop" — see ADR-005
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: status-row
|
|
3
|
+
category: data-display
|
|
4
|
+
components: [Badge]
|
|
5
|
+
when: "Displaying an item with its current status in a list, table row, or detail view."
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Pattern: Status Row
|
|
9
|
+
|
|
10
|
+
## When to use
|
|
11
|
+
|
|
12
|
+
- Table rows with a status column (active, inactive, pending)
|
|
13
|
+
- Detail view headers showing the current state of a record
|
|
14
|
+
- Notification/activity feed items
|
|
15
|
+
- Task list items with completion state
|
|
16
|
+
|
|
17
|
+
## Anatomy
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
┌─────────────────────────────────────────────────────────┐
|
|
21
|
+
│ ○ Deploy to production [Success] 2 min ago │
|
|
22
|
+
│ ○ Run test suite [Warning] 5 min ago │
|
|
23
|
+
│ ○ Build Docker image [Neutral] 12 min ago │
|
|
24
|
+
│ ○ Code review [Danger] 1 hr ago │
|
|
25
|
+
└─────────────────────────────────────────────────────────┘
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Badge variant → semantic meaning
|
|
29
|
+
|
|
30
|
+
| Variant | Use for |
|
|
31
|
+
|-----------|--------------------------------------------------|
|
|
32
|
+
| `success` | Completed, active, healthy, published, verified |
|
|
33
|
+
| `warning` | Pending, in review, needs attention, expiring |
|
|
34
|
+
| `danger` | Failed, blocked, overdue, expired, error |
|
|
35
|
+
| `info` | Scheduled, queued, in progress |
|
|
36
|
+
| `neutral` | Draft, inactive, archived, unknown |
|
|
37
|
+
|
|
38
|
+
**Rule: Never use color alone to communicate status.** The Badge label must also communicate the status.
|
|
39
|
+
|
|
40
|
+
## Code
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
import { Badge } from '@helixds/react';
|
|
44
|
+
import type { BadgeVariant } from '@helixds/react';
|
|
45
|
+
|
|
46
|
+
type Status = 'active' | 'pending' | 'failed' | 'draft' | 'scheduled';
|
|
47
|
+
|
|
48
|
+
const statusConfig: Record<Status, { variant: BadgeVariant; label: string }> = {
|
|
49
|
+
active: { variant: 'success', label: 'Active' },
|
|
50
|
+
pending: { variant: 'warning', label: 'Pending' },
|
|
51
|
+
failed: { variant: 'danger', label: 'Failed' },
|
|
52
|
+
draft: { variant: 'neutral', label: 'Draft' },
|
|
53
|
+
scheduled: { variant: 'info', label: 'Scheduled' },
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
// A list of rows that share columns, so every Badge lines up in one column, left-aligned. Each row is a
|
|
57
|
+
// subgrid of the list's three columns (label · status · meta); a per-row flex layout would instead
|
|
58
|
+
// start each Badge wherever that row's label happened to end.
|
|
59
|
+
function StatusList({ children }: { children: React.ReactNode }) {
|
|
60
|
+
return (
|
|
61
|
+
<div
|
|
62
|
+
data-helix-pattern="status-row-list"
|
|
63
|
+
style={{
|
|
64
|
+
display: 'grid',
|
|
65
|
+
gridTemplateColumns: '1fr auto auto',
|
|
66
|
+
columnGap: 'var(--helix-primitive-spacing-75)',
|
|
67
|
+
}}
|
|
68
|
+
>
|
|
69
|
+
{children}
|
|
70
|
+
</div>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function StatusRow({ label, status, meta }: { label: string; status: Status; meta?: string }) {
|
|
75
|
+
const { variant, label: statusLabel } = statusConfig[status];
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<div
|
|
79
|
+
data-helix-pattern="status-row"
|
|
80
|
+
style={{
|
|
81
|
+
display: 'grid',
|
|
82
|
+
gridColumn: '1 / -1',
|
|
83
|
+
gridTemplateColumns: 'subgrid',
|
|
84
|
+
alignItems: 'center',
|
|
85
|
+
justifyItems: 'start',
|
|
86
|
+
padding: 'var(--helix-primitive-spacing-75) var(--helix-primitive-spacing-100)',
|
|
87
|
+
borderBottom: '1px solid var(--helix-color-border-neutral-light)',
|
|
88
|
+
}}
|
|
89
|
+
>
|
|
90
|
+
<span style={{
|
|
91
|
+
fontSize: 'var(--helix-primitive-fontSize-s)',
|
|
92
|
+
color: 'var(--helix-color-text-neutral)',
|
|
93
|
+
fontWeight: 'var(--helix-primitive-fontWeight-medium)',
|
|
94
|
+
}}>
|
|
95
|
+
{label}
|
|
96
|
+
</span>
|
|
97
|
+
|
|
98
|
+
<Badge variant={variant} label={statusLabel} />
|
|
99
|
+
|
|
100
|
+
<span style={{
|
|
101
|
+
justifySelf: 'end',
|
|
102
|
+
fontSize: 'var(--helix-primitive-fontSize-s)',
|
|
103
|
+
color: 'var(--helix-color-text-neutral-lightest)',
|
|
104
|
+
}}>
|
|
105
|
+
{meta}
|
|
106
|
+
</span>
|
|
107
|
+
</div>
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// <StatusList>
|
|
112
|
+
// <StatusRow label="Deploy to production" status="active" meta="2 min ago" />
|
|
113
|
+
// <StatusRow label="Code review" status="failed" meta="1 hr ago" />
|
|
114
|
+
// </StatusList>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Rules
|
|
118
|
+
|
|
119
|
+
1. Badge label must describe the status in words — not just color
|
|
120
|
+
2. Use the semantic variant that matches the emotional valence (success = good, danger = bad)
|
|
121
|
+
3. When status is dynamic (changes without page reload), add `role="status"` to the Badge
|
|
122
|
+
4. Avoid mixing `size="s"` and `size="m"` badges in the same table column
|
|
123
|
+
5. Rows go inside a `StatusList` (shared columns) so the badges line up, left-aligned, in one column
|
|
124
|
+
|
|
125
|
+
## Anti-patterns
|
|
126
|
+
|
|
127
|
+
- ❌ Custom `<div style={{ background: 'red' }}>Failed</div>` — use Badge
|
|
128
|
+
- ❌ `variant="danger"` for "pending" — pending is `warning`
|
|
129
|
+
- ❌ `variant="info"` for "active" — active is `success`
|
|
130
|
+
- ❌ Using Badge without a text label (icon-only Badge) — always include a label
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: view-toggle
|
|
3
|
+
category: layout
|
|
4
|
+
components: [IconButton]
|
|
5
|
+
when: "Letting the user switch how the same data is displayed — e.g. table vs. cards."
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Pattern: View toggle
|
|
9
|
+
|
|
10
|
+
**Not a component** — same status as `stat-card.md`. A copy-paste recipe built from `IconButton`, not a
|
|
11
|
+
new formal DS primitive. Two buttons and a `useState` don't earn a contract of their own; commissioning a
|
|
12
|
+
`SegmentedControl`/`ToggleGroup` component is a separate, larger decision (grouped-selection semantics,
|
|
13
|
+
`role="radiogroup"` or `role="tablist"`, keyboard arrow navigation) — do that only when a second, unrelated
|
|
14
|
+
use case needs the same grouped-exclusive-choice behavior, not for one view switch.
|
|
15
|
+
|
|
16
|
+
## When to use
|
|
17
|
+
|
|
18
|
+
- The same underlying data can be usefully displayed two (rarely three) different ways — a dense table for
|
|
19
|
+
scanning, a card grid for visual browsing.
|
|
20
|
+
|
|
21
|
+
## Anatomy
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
┌──────────────┐
|
|
25
|
+
│ [▤] [▦] │ ← two IconButtons, one active (variant="secondary"), one not (variant="ghost")
|
|
26
|
+
└──────────────┘
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Code
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
import { useState } from 'react';
|
|
33
|
+
import { IconButton } from '@helixds/react';
|
|
34
|
+
import { IconTable, IconLayoutGrid } from '@tabler/icons-react';
|
|
35
|
+
|
|
36
|
+
function ViewToggle({ view, onViewChange }: { view: 'table' | 'cards'; onViewChange: (v: 'table' | 'cards') => void }) {
|
|
37
|
+
return (
|
|
38
|
+
<div
|
|
39
|
+
data-helix-pattern="view-toggle"
|
|
40
|
+
role="group"
|
|
41
|
+
aria-label="View"
|
|
42
|
+
style={{ display: 'inline-flex', gap: 'var(--helix-spacing-2xs)' }}
|
|
43
|
+
>
|
|
44
|
+
<IconButton
|
|
45
|
+
icon={IconTable}
|
|
46
|
+
label="Table view"
|
|
47
|
+
variant={view === 'table' ? 'secondary' : 'ghost'}
|
|
48
|
+
aria-pressed={view === 'table'}
|
|
49
|
+
onClick={() => onViewChange('table')}
|
|
50
|
+
/>
|
|
51
|
+
<IconButton
|
|
52
|
+
icon={IconLayoutGrid}
|
|
53
|
+
label="Cards view"
|
|
54
|
+
variant={view === 'cards' ? 'secondary' : 'ghost'}
|
|
55
|
+
aria-pressed={view === 'cards'}
|
|
56
|
+
onClick={() => onViewChange('cards')}
|
|
57
|
+
/>
|
|
58
|
+
</div>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Rules
|
|
64
|
+
|
|
65
|
+
1. `role="group"` + `aria-label` on the wrapper — screen readers need to know these two buttons are related.
|
|
66
|
+
2. `aria-pressed` on each `IconButton` reflects whether that view is active — even though IconButton's own
|
|
67
|
+
contract lists "a toggle/pressed state" under `neverUseFor` for a *single* icon button used in isolation,
|
|
68
|
+
a pair of them forming a mutually-exclusive group is exactly the "compose a dedicated toggle control
|
|
69
|
+
instead" escape hatch that rule points to. This recipe *is* that composition.
|
|
70
|
+
3. The active button uses `variant="secondary"` (visibly selected), the inactive one `variant="ghost"` —
|
|
71
|
+
never both `ghost` (no way to tell which is active) or both `primary` (two competing CTAs).
|
|
72
|
+
4. State lives with whatever owns the data being displayed — don't let the toggle own its own disconnected
|
|
73
|
+
state if the two views need to show the same underlying items (see
|
|
74
|
+
`apps/storybook/stories/ReorderableTeamList.stories.tsx` for a worked example where both views share one
|
|
75
|
+
ordering state).
|
|
76
|
+
|
|
77
|
+
## Anti-patterns
|
|
78
|
+
|
|
79
|
+
- ❌ Building a third, unused "list" view "just in case" — two options is the common case; add a third only
|
|
80
|
+
when a real third display mode exists.
|
|
81
|
+
- ❌ Using `Chip` for this — Chip's purpose is filters/categories, not layout mode switching.
|