@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,105 @@
|
|
|
1
|
+
export const doc = {
|
|
2
|
+
name: 'Chip',
|
|
3
|
+
purpose: 'Represents a compact selectable label for filters, categories, or short choices.',
|
|
4
|
+
contract: 'contracts/components/Chip.json',
|
|
5
|
+
a11y: [
|
|
6
|
+
'Use `onClick` for selection and `onDismiss` for removal; they are separate actions.',
|
|
7
|
+
'Keep the label concise and descriptive. The dismiss control must remain reachable with the keyboard.',
|
|
8
|
+
],
|
|
9
|
+
variants: [
|
|
10
|
+
{ name: 'neutral', description: 'Default neutral chip for generic filters and tags.' },
|
|
11
|
+
{ name: 'info', description: 'Blue semantic chip for informational categories.' },
|
|
12
|
+
{ name: 'success', description: 'Green semantic chip for positive or active states.' },
|
|
13
|
+
{ name: 'warning', description: 'Orange semantic chip for caution or pending states.' },
|
|
14
|
+
{ name: 'danger', description: 'Red semantic chip for destructive or error-related states.' },
|
|
15
|
+
],
|
|
16
|
+
sizes: ['s', 'm'],
|
|
17
|
+
tokens: [
|
|
18
|
+
// Fills per variant and interaction state. Chip has no checked/selected state.
|
|
19
|
+
{ part: 'chip', label: 'fill.neutral', token: '--helix-color-fill-surface', kind: 'color', variant: 'neutral' },
|
|
20
|
+
{ part: 'chip', label: 'fill.neutral', token: '--helix-color-fill-surface-dark', kind: 'color', variant: 'neutral', state: 'hover' },
|
|
21
|
+
{ part: 'chip', label: 'fill.neutral', token: '--helix-color-fill-secondary-interactive-default', kind: 'color', variant: 'neutral', state: 'press' },
|
|
22
|
+
{ part: 'chip', label: 'border.neutral', token: '--helix-color-border-neutral', kind: 'color', variant: 'neutral' },
|
|
23
|
+
{ part: 'chip', label: 'text.neutral', token: '--helix-color-text-neutral', kind: 'color', variant: 'neutral' },
|
|
24
|
+
{ part: 'chip', label: 'fill.info', token: '--helix-color-fill-info-light', kind: 'color', variant: 'info' },
|
|
25
|
+
{ part: 'chip', label: 'fill.info', value: 'color-mix(in srgb, var(--helix-color-fill-info-light) 84%, var(--helix-color-fill-page))', kind: 'color', variant: 'info', state: 'hover', meta: 'No discrete token — computed color-mix() over fill.info' },
|
|
26
|
+
{ part: 'chip', label: 'fill.info', value: 'color-mix(in srgb, var(--helix-color-fill-info-light) 72%, var(--helix-color-fill-page))', kind: 'color', variant: 'info', state: 'press', meta: 'No discrete token — computed color-mix() over fill.info' },
|
|
27
|
+
{ part: 'chip', label: 'border.info', token: '--helix-color-border-info', kind: 'color', variant: 'info' },
|
|
28
|
+
{ part: 'chip', label: 'text.info', token: '--helix-color-text-info', kind: 'color', variant: 'info' },
|
|
29
|
+
{ part: 'chip', label: 'fill.success', token: '--helix-color-fill-success-light', kind: 'color', variant: 'success' },
|
|
30
|
+
{ part: 'chip', label: 'fill.success', value: 'color-mix(in srgb, var(--helix-color-fill-success-light) 84%, var(--helix-color-fill-page))', kind: 'color', variant: 'success', state: 'hover', meta: 'No discrete token — computed color-mix() over fill.success' },
|
|
31
|
+
{ part: 'chip', label: 'fill.success', value: 'color-mix(in srgb, var(--helix-color-fill-success-light) 72%, var(--helix-color-fill-page))', kind: 'color', variant: 'success', state: 'press', meta: 'No discrete token — computed color-mix() over fill.success' },
|
|
32
|
+
{ part: 'chip', label: 'border.success', token: '--helix-color-border-success', kind: 'color', variant: 'success' },
|
|
33
|
+
{ part: 'chip', label: 'text.success', token: '--helix-color-text-success', kind: 'color', variant: 'success' },
|
|
34
|
+
{ part: 'chip', label: 'fill.warning', token: '--helix-color-fill-warning-light', kind: 'color', variant: 'warning' },
|
|
35
|
+
{ part: 'chip', label: 'fill.warning', value: 'color-mix(in srgb, var(--helix-color-fill-warning-light) 84%, var(--helix-color-fill-page))', kind: 'color', variant: 'warning', state: 'hover', meta: 'No discrete token — computed color-mix() over fill.warning' },
|
|
36
|
+
{ part: 'chip', label: 'fill.warning', value: 'color-mix(in srgb, var(--helix-color-fill-warning-light) 72%, var(--helix-color-fill-page))', kind: 'color', variant: 'warning', state: 'press', meta: 'No discrete token — computed color-mix() over fill.warning' },
|
|
37
|
+
{ part: 'chip', label: 'border.warning', token: '--helix-color-border-warning', kind: 'color', variant: 'warning' },
|
|
38
|
+
{ part: 'chip', label: 'text.warning', token: '--helix-color-text-warning', kind: 'color', variant: 'warning' },
|
|
39
|
+
{ part: 'chip', label: 'fill.danger', token: '--helix-color-fill-danger-interactive-light-default', kind: 'color', variant: 'danger' },
|
|
40
|
+
{ part: 'chip', label: 'fill.danger', value: 'color-mix(in srgb, var(--helix-color-fill-danger-interactive-light-default) 84%, var(--helix-color-fill-page))', kind: 'color', variant: 'danger', state: 'hover', meta: 'No discrete token — computed color-mix() over fill.danger' },
|
|
41
|
+
{ part: 'chip', label: 'fill.danger', value: 'color-mix(in srgb, var(--helix-color-fill-danger-interactive-light-default) 72%, var(--helix-color-fill-page))', kind: 'color', variant: 'danger', state: 'press', meta: 'No discrete token — computed color-mix() over fill.danger' },
|
|
42
|
+
{ part: 'chip', label: 'border.danger', token: '--helix-color-border-danger', kind: 'color', variant: 'danger' },
|
|
43
|
+
{ part: 'chip', label: 'text.danger', token: '--helix-color-text-danger', kind: 'color', variant: 'danger' },
|
|
44
|
+
{ part: 'chip', label: 'fill.disabled', token: '--helix-color-fill-disabled', kind: 'color', state: 'disabled' },
|
|
45
|
+
{ part: 'chip', label: 'text.disabled', token: '--helix-color-text-disabled', kind: 'color', state: 'disabled' },
|
|
46
|
+
{ part: 'chip', label: 'border.disabled', token: '--helix-color-border-neutral-light', kind: 'color', state: 'disabled' },
|
|
47
|
+
{ part: 'chip', label: 'chip.root', token: '--helix-chip-radius', kind: 'radius' },
|
|
48
|
+
{ part: 'chip', label: 'gap.icon.text', token: '--helix-chip-gap-s', kind: 'space', axis: 'horizontal', size: 's' },
|
|
49
|
+
{ part: 'chip', label: 'gap.icon.text', token: '--helix-chip-gap-m', kind: 'space', axis: 'horizontal', size: 'm' },
|
|
50
|
+
{ part: 'chip', label: 'chip.height', token: '--helix-chip-height-s', kind: 'space', size: 's' },
|
|
51
|
+
{ part: 'chip', label: 'chip.height', token: '--helix-chip-height-m', kind: 'space', size: 'm' },
|
|
52
|
+
{ part: 'chip', label: 'padding.top', value: '0', kind: 'space', axis: 'vertical' },
|
|
53
|
+
{ part: 'chip', label: 'padding.bottom', value: '0', kind: 'space', axis: 'vertical' },
|
|
54
|
+
{ part: 'chip', label: 'padding.start', token: '--helix-chip-padding-x-s', kind: 'space', axis: 'horizontal', size: 's' },
|
|
55
|
+
{ part: 'chip', label: 'padding.end', token: '--helix-chip-padding-x-s', kind: 'space', axis: 'horizontal', size: 's' },
|
|
56
|
+
{ part: 'chip', label: 'padding.start', token: '--helix-chip-padding-x-m', kind: 'space', axis: 'horizontal', size: 'm' },
|
|
57
|
+
{ part: 'chip', label: 'padding.end', token: '--helix-chip-padding-x-m', kind: 'space', axis: 'horizontal', size: 'm' },
|
|
58
|
+
{ part: 'chip', label: 'fontSize', token: '--helix-chip-fontSize-s', kind: 'typography', meta: 'Body / s / Medium', size: 's' },
|
|
59
|
+
{ part: 'chip', label: 'fontSize', token: '--helix-chip-fontSize-m', kind: 'typography', meta: 'Body / s / Medium', size: 'm' },
|
|
60
|
+
{ part: 'chip', label: 'fontWeight', token: '--helix-chip-fontWeight', kind: 'typography', meta: 'Body / s / Medium' },
|
|
61
|
+
{ part: 'chip', label: 'display', value: 'inline-flex' },
|
|
62
|
+
{ part: 'chip', label: 'align-items', value: 'center' },
|
|
63
|
+
{ part: 'chip', label: 'justify-content', value: 'center' },
|
|
64
|
+
{ part: 'chip', label: 'box-sizing', value: 'border-box' },
|
|
65
|
+
{ part: 'chip', label: 'line-height', value: '1' },
|
|
66
|
+
{ part: 'chip', label: 'white-space', value: 'nowrap' },
|
|
67
|
+
{ part: 'chip', label: 'user-select', value: 'none' },
|
|
68
|
+
{ part: 'chip', label: 'text-decoration', value: 'none' },
|
|
69
|
+
{ part: 'chip', label: 'outline', value: 'none' },
|
|
70
|
+
{ part: 'chip', label: '-webkit-appearance', value: 'none' },
|
|
71
|
+
{ part: 'chip', label: 'appearance', value: 'none' },
|
|
72
|
+
{ part: 'chip', label: 'cursor', value: 'pointer' },
|
|
73
|
+
{ part: 'chip', label: 'cursor.disabled', value: 'not-allowed' },
|
|
74
|
+
{ part: 'chip', label: 'opacity.disabled', value: '0.72' },
|
|
75
|
+
{ part: 'chip', label: 'pointer-events', value: 'none' },
|
|
76
|
+
],
|
|
77
|
+
features: [
|
|
78
|
+
'forwardRef — accepts a ref to the underlying <button> element',
|
|
79
|
+
'size — horizontal density preset (documented exception to the global scale)',
|
|
80
|
+
'dismissible — optional close button for removable chips',
|
|
81
|
+
'icon / iconEnd — optional icon slots with aria-hidden',
|
|
82
|
+
'onClick — canonical handler (React\'s own; onClick is an anti-synonym, ADR-022)',
|
|
83
|
+
'onDismiss — close button handler; fires after a Motion fade+scale exit finishes (ADR-007), not on click itself, so the consumer removes it from their list exactly as it goes invisible — see .ai/maps/patterns/motion-effects.md',
|
|
84
|
+
'disabled — native button disabled state',
|
|
85
|
+
],
|
|
86
|
+
examples: [
|
|
87
|
+
{
|
|
88
|
+
label: 'Neutral',
|
|
89
|
+
code: `<Chip label="All" />`,
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
label: 'With icon',
|
|
93
|
+
code: `<Chip label="Filters" icon={IconFilter} />`,
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
label: 'Dismissible',
|
|
97
|
+
code: `<Chip label="Recent" dismissible onDismiss={() => {}} />`,
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
label: 'Success',
|
|
101
|
+
code: `<Chip variant="success" label="Approved" />`,
|
|
102
|
+
},
|
|
103
|
+
],
|
|
104
|
+
};
|
|
105
|
+
//# sourceMappingURL=Chip.doc.js.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { motion, MotionConfig } from 'motion/react';
|
|
4
|
+
import { IconX } from '@tabler/icons-react';
|
|
5
|
+
import { cn } from '../../lib/utils.js';
|
|
6
|
+
import { Icon } from '../Icon/index.js';
|
|
7
|
+
const Chip = React.forwardRef(({ variant = 'neutral', size = 's', disabled = false, label, icon, iconEnd, className, onClick, dismissible = false, onDismiss, ...props }, ref) => {
|
|
8
|
+
const isDismissible = dismissible && !!onDismiss;
|
|
9
|
+
// Chip doesn't own its own presence — the consumer's list state does, via onDismiss. So the exit
|
|
10
|
+
// animation is played HERE first (isDismissing), and the real onDismiss() only fires once it
|
|
11
|
+
// finishes (onAnimationComplete) — the consumer removes it from their array right as it's already
|
|
12
|
+
// fully faded out, not before, so there's no visual jump when the list actually reflows.
|
|
13
|
+
const [isDismissing, setIsDismissing] = React.useState(false);
|
|
14
|
+
const handleClick = e => {
|
|
15
|
+
onClick?.(e);
|
|
16
|
+
};
|
|
17
|
+
// `scale` (in animate below) is Motion's own animation-target key — a verify:props false positive,
|
|
18
|
+
// same category as Button.tsx's whileTap.
|
|
19
|
+
// MotionConfig scoped locally — Motion doesn't honor prefers-reduced-motion on its own (ADR-007).
|
|
20
|
+
return (_jsx(MotionConfig, { reducedMotion: "user", children: _jsxs(motion.span, { "data-helix-part": "chip-shell", "data-variant": variant, "data-size": size, "data-disabled": disabled ? 'true' : undefined, "data-dismissible": isDismissible ? 'true' : undefined, className: cn(className), animate: isDismissing ? { opacity: 0, scale: 0.85 } : { opacity: 1, scale: 1 }, transition: { duration: 0.15 }, onAnimationComplete: () => {
|
|
21
|
+
if (isDismissing)
|
|
22
|
+
onDismiss?.();
|
|
23
|
+
}, children: [_jsxs("button", { ref: ref, type: "button", "data-helix-part": "chip", "data-dismissible": isDismissible ? 'true' : undefined, "data-variant": variant, "data-size": size, "data-disabled": disabled ? 'true' : undefined, disabled: disabled, onClick: handleClick, ...props, children: [icon && (_jsx("span", { "data-helix-part": "chip-icon", children: _jsx(Icon, { icon: icon, size: 14 }) })), _jsx("span", { "data-helix-part": "chip-label", children: label }), iconEnd && (_jsx("span", { "data-helix-part": "chip-icon-end", children: _jsx(Icon, { icon: iconEnd, size: 14 }) }))] }), isDismissible && (_jsx("button", { type: "button", "data-helix-part": "chip-dismiss", "aria-label": `Dismiss ${label}`, disabled: disabled, onClick: e => {
|
|
24
|
+
e.stopPropagation();
|
|
25
|
+
setIsDismissing(true);
|
|
26
|
+
}, children: _jsx(Icon, { icon: IconX, size: 12 }) }))] }) }));
|
|
27
|
+
});
|
|
28
|
+
Chip.displayName = 'Chip';
|
|
29
|
+
export { Chip };
|
|
30
|
+
//# sourceMappingURL=Chip.js.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @helixds/react — agent note
|
|
3
|
+
* Before using Chip, read its contract: node_modules/@helixds/react/dist/contracts/Chip.json
|
|
4
|
+
* (every prop, which are required, when not to use it, the import line). Do not guess Helix props.
|
|
5
|
+
* Guide: node_modules/@helixds/react/AGENTS.md
|
|
6
|
+
*/
|
|
7
|
+
import type * as React from 'react';
|
|
8
|
+
import type { HelixIconComponent } from '../Icon/index.js';
|
|
9
|
+
export type ChipVariant = 'neutral' | 'info' | 'success' | 'warning' | 'danger';
|
|
10
|
+
export type ChipSize = 's' | 'm';
|
|
11
|
+
export interface ChipProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'disabled' | 'size' | 'type'> {
|
|
12
|
+
/** Semantic color variant. Default: 'neutral' */
|
|
13
|
+
variant?: ChipVariant;
|
|
14
|
+
/** Visual size. Default: 's' */
|
|
15
|
+
size?: ChipSize;
|
|
16
|
+
/** Disables interaction. */
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
/** Visible label. */
|
|
19
|
+
label: string;
|
|
20
|
+
/** Leading icon — a Tabler icon component, passed by reference (e.g. IconFilter). Always rendered at size=14 (stroke scales automatically via Icon). */
|
|
21
|
+
icon?: HelixIconComponent;
|
|
22
|
+
/** Trailing icon. Same fixed size as `icon`. */
|
|
23
|
+
iconEnd?: HelixIconComponent;
|
|
24
|
+
/** Primary press handler — React's own `onClick` (ADR-022). */
|
|
25
|
+
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
26
|
+
/** Shows a close button for removing the chip. */
|
|
27
|
+
dismissible?: boolean;
|
|
28
|
+
/** Dismiss handler fired from the close button. */
|
|
29
|
+
onDismiss?: () => void;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=Chip.types.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @helixds/react — agent note
|
|
3
|
+
* Before using Chip, read its contract: node_modules/@helixds/react/dist/contracts/Chip.json
|
|
4
|
+
* (every prop, which are required, when not to use it, the import line). Do not guess Helix props.
|
|
5
|
+
* Guide: node_modules/@helixds/react/AGENTS.md
|
|
6
|
+
*/
|
|
7
|
+
export { Chip } from './Chip.js';
|
|
8
|
+
export type { ChipProps, ChipVariant, ChipSize } from './Chip.types.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @helixds/react — agent note
|
|
3
|
+
* Before using ChipGroup, read its contract: node_modules/@helixds/react/dist/contracts/ChipGroup.json
|
|
4
|
+
* (every prop, which are required, when not to use it, the import line). Do not guess Helix props.
|
|
5
|
+
* Guide: node_modules/@helixds/react/AGENTS.md
|
|
6
|
+
*/
|
|
7
|
+
import type { ChipGroupProps } from './ChipGroup.types.js';
|
|
8
|
+
export declare function ChipGroup({ label, options, size, disabled }: ChipGroupProps): import("react").JSX.Element;
|
|
9
|
+
export declare namespace ChipGroup {
|
|
10
|
+
var displayName: string;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=ChipGroup.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export const doc = {
|
|
2
|
+
name: 'ChipGroup',
|
|
3
|
+
purpose: 'Shows a small set of related chips side by side — categories, tags or applied filters — as one labelled group.',
|
|
4
|
+
contract: 'contracts/components/ChipGroup.json',
|
|
5
|
+
a11y: [
|
|
6
|
+
'role="group" named by `label` (aria-label) — the label is never visible; the chips stand on their own.',
|
|
7
|
+
'Each option renders a real `Chip`, so it inherits Chip\'s own a11y and CSS unchanged.',
|
|
8
|
+
'Tab moves between chips.',
|
|
9
|
+
],
|
|
10
|
+
variants: [],
|
|
11
|
+
sizes: ['s', 'm'],
|
|
12
|
+
tokens: [
|
|
13
|
+
{ part: 'chip-group', label: 'gap.chips', token: '--helix-spacing-2xs', kind: 'space', meta: '4px, between chips and between wrapped rows — group-spacing.md' },
|
|
14
|
+
{ part: 'chip-group', label: 'display', value: 'flex' },
|
|
15
|
+
{ part: 'chip-group', label: 'flex-wrap', value: 'wrap' },
|
|
16
|
+
],
|
|
17
|
+
features: [
|
|
18
|
+
'label — required accessible name for the group (aria-label); never shown',
|
|
19
|
+
'options — array of { value, label, icon?, disabled? }',
|
|
20
|
+
'size — s (default) or m, applied to every chip',
|
|
21
|
+
'disabled — disables every chip; individual options can also disable themselves',
|
|
22
|
+
'Composes real `Chip` instances internally — no duplicated visuals or tokens.',
|
|
23
|
+
],
|
|
24
|
+
examples: [
|
|
25
|
+
{
|
|
26
|
+
label: 'Default',
|
|
27
|
+
code: `<ChipGroup label="Status" options={[{ value: 'active', label: 'Active' }, { value: 'paused', label: 'Paused' }, { value: 'archived', label: 'Archived' }]} />`,
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=ChipGroup.doc.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Chip } from '../Chip/index.js';
|
|
3
|
+
export function ChipGroup({ label, options, size = 's', disabled = false }) {
|
|
4
|
+
// Just the chips side by side — no visible header, no selection. `label` names the group for assistive
|
|
5
|
+
// tech only. Each option is a real Chip, so it inherits Chip's own a11y, sizes and CSS unchanged.
|
|
6
|
+
return (_jsx("div", { role: "group", "aria-label": label, "data-helix-part": "chip-group", ...(disabled ? { 'data-disabled': '' } : {}), children: options.map(opt => (_jsx(Chip, { size: size, label: opt.label, ...(opt.icon ? { icon: opt.icon } : {}), disabled: opt.disabled || disabled }, opt.value))) }));
|
|
7
|
+
}
|
|
8
|
+
ChipGroup.displayName = 'ChipGroup';
|
|
9
|
+
//# sourceMappingURL=ChipGroup.js.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @helixds/react — agent note
|
|
3
|
+
* Before using ChipGroup, read its contract: node_modules/@helixds/react/dist/contracts/ChipGroup.json
|
|
4
|
+
* (every prop, which are required, when not to use it, the import line). Do not guess Helix props.
|
|
5
|
+
* Guide: node_modules/@helixds/react/AGENTS.md
|
|
6
|
+
*/
|
|
7
|
+
import type { HelixIconComponent } from '../Icon/index.js';
|
|
8
|
+
import type { ChipSize } from '../Chip/index.js';
|
|
9
|
+
export interface ChipGroupOption {
|
|
10
|
+
/** Stable key for the chip. */
|
|
11
|
+
value: string;
|
|
12
|
+
label: string;
|
|
13
|
+
/** Leading icon — a Tabler icon component, passed by reference (e.g. IconFilter). */
|
|
14
|
+
icon?: HelixIconComponent;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface ChipGroupProps {
|
|
18
|
+
/** Accessible name of the group (aria-label) — never rendered visibly. */
|
|
19
|
+
label: string;
|
|
20
|
+
/** The chips. */
|
|
21
|
+
options: ChipGroupOption[];
|
|
22
|
+
/** Size of every chip in the group. Default: 's' */
|
|
23
|
+
size?: ChipSize;
|
|
24
|
+
/** Disables every chip in the group. */
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=ChipGroup.types.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @helixds/react — agent note
|
|
3
|
+
* Before using ChipGroup, read its contract: node_modules/@helixds/react/dist/contracts/ChipGroup.json
|
|
4
|
+
* (every prop, which are required, when not to use it, the import line). Do not guess Helix props.
|
|
5
|
+
* Guide: node_modules/@helixds/react/AGENTS.md
|
|
6
|
+
*/
|
|
7
|
+
export { ChipGroup } from './ChipGroup.js';
|
|
8
|
+
export type { ChipGroupProps, ChipGroupOption } from './ChipGroup.types.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @helixds/react — agent note
|
|
3
|
+
* Before using Combobox, read its contract: node_modules/@helixds/react/dist/contracts/Combobox.json
|
|
4
|
+
* (every prop, which are required, when not to use it, the import line). Do not guess Helix props.
|
|
5
|
+
* Guide: node_modules/@helixds/react/AGENTS.md
|
|
6
|
+
*/
|
|
7
|
+
import * as React from 'react';
|
|
8
|
+
import type { ComboboxProps } from './Combobox.types.js';
|
|
9
|
+
/**
|
|
10
|
+
* Select's field with a real <input> as the trigger: typing filters Menu's listbox (see Combobox's and the Menu contracts).
|
|
11
|
+
* Real DOM focus stays on the input; aria-activedescendant points at the highlighted option.
|
|
12
|
+
*/
|
|
13
|
+
export declare function Combobox({ label, options, value, defaultValue, onChange, placeholder, description, errorMessage, invalid, disabled, required, fullWidth, hideLabel, id: idProp, name, className, }: ComboboxProps): React.JSX.Element;
|
|
14
|
+
export declare namespace Combobox {
|
|
15
|
+
var displayName: string;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=Combobox.d.ts.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export const doc = {
|
|
2
|
+
name: 'Combobox',
|
|
3
|
+
purpose: 'Lets users find and choose a single value from a long list by typing to filter it.',
|
|
4
|
+
contract: 'contracts/components/Combobox.json',
|
|
5
|
+
a11y: [
|
|
6
|
+
'The `label` prop is required. `placeholder` is a hint, never the value.',
|
|
7
|
+
'The field is a real `<input role="combobox" aria-autocomplete="list">`; the list is Helix\'s `Menu` (see the Menu and Combobox contracts). Real DOM focus stays on the input and `aria-activedescendant` points at the highlighted option.',
|
|
8
|
+
'Keyboard: typing filters and opens, Arrow Up/Down move, Enter picks, Escape and Tab close and put the chosen label back — see the contract\'s keyboardNav.',
|
|
9
|
+
],
|
|
10
|
+
variants: [],
|
|
11
|
+
sizes: [],
|
|
12
|
+
tokens: [
|
|
13
|
+
{ part: 'combobox-input', label: 'Default fill', token: '--helix-select-fill-default', kind: 'color' },
|
|
14
|
+
{ part: 'combobox-input', label: 'Default border', token: '--helix-select-border-default', kind: 'color' },
|
|
15
|
+
{ part: 'combobox-input', label: 'Hover border', token: '--helix-select-border-hover', kind: 'color', state: 'hover' },
|
|
16
|
+
{ part: 'combobox-input', label: 'Focus border', token: '--helix-select-border-focus', kind: 'color' },
|
|
17
|
+
{ part: 'combobox-input', label: 'Invalid border', token: '--helix-select-border-invalid', kind: 'color' },
|
|
18
|
+
{ part: 'combobox-input', label: 'Disabled fill', token: '--helix-select-fill-disabled', kind: 'color', state: 'disabled' },
|
|
19
|
+
{ part: 'combobox-input', label: 'Value text', token: '--helix-select-text-value', kind: 'color' },
|
|
20
|
+
{ part: 'combobox-input', label: 'Placeholder text', token: '--helix-select-text-placeholder', kind: 'color' },
|
|
21
|
+
{ part: 'combobox-icon', label: 'Icon', token: '--helix-select-icon-default', kind: 'color' },
|
|
22
|
+
{ part: 'combobox-root', label: 'gap', token: '--helix-select-gap', kind: 'space', axis: 'vertical', meta: '8px, label↔field and field↔description/error — form-field-spacing pattern' },
|
|
23
|
+
{ part: 'combobox-input', label: 'field.height', token: '--helix-select-height', kind: 'space', meta: 'One fixed size (semantic.size.m, 32px), Select\'s — no size prop' },
|
|
24
|
+
{ part: 'combobox-icon', label: 'padding.start', token: '--helix-primitive-spacing-75', kind: 'space', axis: 'horizontal', meta: 'Search icon to the field\'s start edge' },
|
|
25
|
+
{ part: 'combobox-input', label: 'radius', token: '--helix-select-radius', kind: 'radius' },
|
|
26
|
+
],
|
|
27
|
+
features: [
|
|
28
|
+
'Select\'s field with a real <input>: type to filter, the list opens below (Helix Menu, never a native datalist)',
|
|
29
|
+
'A search icon always marks the field as searchable',
|
|
30
|
+
'Opening from a chosen value shows every option; the filter starts once the user types',
|
|
31
|
+
'A disabled "No results" row when nothing matches',
|
|
32
|
+
'Leaving the field never keeps half-typed text — the chosen label comes back',
|
|
33
|
+
'One fixed size (32px) and Select\'s tokens, so it reads as the same field',
|
|
34
|
+
],
|
|
35
|
+
examples: [
|
|
36
|
+
{ label: 'Default', code: `<Combobox label="Country" placeholder="Search a country…" options={countries} />` },
|
|
37
|
+
{ label: 'Controlled', code: `<Combobox label="Component" options={components} value={name} onChange={setName} />` },
|
|
38
|
+
{ label: 'Invalid', code: `<Combobox label="Country" options={countries} invalid errorMessage="Pick a country from the list" />` },
|
|
39
|
+
],
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=Combobox.doc.js.map
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { IconChevronDown, IconSearch } from '@tabler/icons-react';
|
|
4
|
+
import { cn } from '../../lib/utils.js';
|
|
5
|
+
import { Icon } from '../Icon/index.js';
|
|
6
|
+
import { Menu, optionId } from '../Menu/index.js';
|
|
7
|
+
let idCounter = 0;
|
|
8
|
+
/** The one row Menu shows when nothing matches — disabled, so it can't be picked (the Combobox contract). */
|
|
9
|
+
const NO_RESULTS = '__helix-combobox-no-results__';
|
|
10
|
+
const matches = (label, query) => label.toLowerCase().includes(query.trim().toLowerCase());
|
|
11
|
+
/**
|
|
12
|
+
* Select's field with a real <input> as the trigger: typing filters Menu's listbox (see Combobox's and the Menu contracts).
|
|
13
|
+
* Real DOM focus stays on the input; aria-activedescendant points at the highlighted option.
|
|
14
|
+
*/
|
|
15
|
+
export function Combobox({ label, options, value, defaultValue, onChange, placeholder, description, errorMessage, invalid = false, disabled = false, required = false, fullWidth = false, hideLabel = false, id: idProp, name, className, }) {
|
|
16
|
+
const uid = React.useRef(`helix-combobox-${++idCounter}`).current;
|
|
17
|
+
const id = idProp ?? uid;
|
|
18
|
+
const menuId = `${id}-menu`;
|
|
19
|
+
const descId = description && !invalid ? `${id}-desc` : undefined;
|
|
20
|
+
const errId = invalid && errorMessage ? `${id}-err` : undefined;
|
|
21
|
+
const describedby = [descId, errId].filter(Boolean).join(' ') || undefined;
|
|
22
|
+
const isControlled = value !== undefined;
|
|
23
|
+
const [internalValue, setInternalValue] = React.useState(defaultValue);
|
|
24
|
+
const current = isControlled ? value : internalValue;
|
|
25
|
+
const labelOf = React.useCallback((v) => options.find(o => o.value === v)?.label ?? '', [options]);
|
|
26
|
+
const [query, setQuery] = React.useState(() => labelOf(current));
|
|
27
|
+
// The filter applies only once the user types — opening from a chosen value shows every option.
|
|
28
|
+
const [typed, setTyped] = React.useState(false);
|
|
29
|
+
const [open, setOpen] = React.useState(false);
|
|
30
|
+
const [activeValue, setActiveValue] = React.useState();
|
|
31
|
+
const inputRef = React.useRef(null);
|
|
32
|
+
// Set while a pointer presses inside the list: Safari doesn't focus a pressed button, so the field's blur has no
|
|
33
|
+
// relatedTarget to tell it the press is on an option — this does.
|
|
34
|
+
const pressingMenu = React.useRef(false);
|
|
35
|
+
// A controlled value changed from outside — show its label (unless the user is mid-typing).
|
|
36
|
+
React.useEffect(() => { if (!typed)
|
|
37
|
+
setQuery(labelOf(current)); }, [current, labelOf, typed]);
|
|
38
|
+
const filtered = React.useMemo(() => (typed && query.trim() ? options.filter(o => matches(o.label, query)) : options), [options, query, typed]);
|
|
39
|
+
const enabled = filtered.filter(o => !o.disabled);
|
|
40
|
+
const menuOptions = filtered.length ? filtered : [{ value: NO_RESULTS, label: 'No results', disabled: true }];
|
|
41
|
+
const restore = () => { setQuery(labelOf(current)); setTyped(false); };
|
|
42
|
+
const openMenu = () => {
|
|
43
|
+
if (disabled)
|
|
44
|
+
return;
|
|
45
|
+
const selected = options.find(o => o.value === current && !o.disabled)?.value;
|
|
46
|
+
setActiveValue(selected ?? enabled[0]?.value);
|
|
47
|
+
setOpen(true);
|
|
48
|
+
};
|
|
49
|
+
const closeMenu = () => { setOpen(false); restore(); };
|
|
50
|
+
const commit = (next) => {
|
|
51
|
+
pressingMenu.current = false;
|
|
52
|
+
if (next === NO_RESULTS)
|
|
53
|
+
return;
|
|
54
|
+
if (!isControlled)
|
|
55
|
+
setInternalValue(next);
|
|
56
|
+
onChange?.(next);
|
|
57
|
+
setQuery(labelOf(next));
|
|
58
|
+
setTyped(false);
|
|
59
|
+
setOpen(false);
|
|
60
|
+
inputRef.current?.focus();
|
|
61
|
+
};
|
|
62
|
+
const moveActive = (dir) => {
|
|
63
|
+
if (!enabled.length)
|
|
64
|
+
return;
|
|
65
|
+
const i = enabled.findIndex(o => o.value === activeValue);
|
|
66
|
+
const next = i === -1 ? (dir === 1 ? 0 : enabled.length - 1) : (i + dir + enabled.length) % enabled.length;
|
|
67
|
+
setActiveValue(enabled[next].value);
|
|
68
|
+
};
|
|
69
|
+
const handleKeyDown = (e) => {
|
|
70
|
+
if (disabled)
|
|
71
|
+
return;
|
|
72
|
+
switch (e.key) {
|
|
73
|
+
case 'ArrowDown':
|
|
74
|
+
e.preventDefault();
|
|
75
|
+
open ? moveActive(1) : openMenu();
|
|
76
|
+
break;
|
|
77
|
+
case 'ArrowUp':
|
|
78
|
+
e.preventDefault();
|
|
79
|
+
open ? moveActive(-1) : openMenu();
|
|
80
|
+
break;
|
|
81
|
+
case 'Enter':
|
|
82
|
+
if (open && activeValue) {
|
|
83
|
+
e.preventDefault();
|
|
84
|
+
commit(activeValue);
|
|
85
|
+
}
|
|
86
|
+
break;
|
|
87
|
+
case 'Escape':
|
|
88
|
+
if (open) {
|
|
89
|
+
e.preventDefault();
|
|
90
|
+
closeMenu();
|
|
91
|
+
}
|
|
92
|
+
break;
|
|
93
|
+
case 'Tab':
|
|
94
|
+
// Close first, then let focus move on as usual (no preventDefault).
|
|
95
|
+
if (open)
|
|
96
|
+
closeMenu();
|
|
97
|
+
break;
|
|
98
|
+
default:
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
const handleChange = (e) => {
|
|
103
|
+
const q = e.target.value;
|
|
104
|
+
setQuery(q);
|
|
105
|
+
setTyped(true);
|
|
106
|
+
setActiveValue(options.find(o => !o.disabled && matches(o.label, q))?.value);
|
|
107
|
+
setOpen(true);
|
|
108
|
+
};
|
|
109
|
+
// Click-outside — closes when a pointer lands outside both the field and the portaled menu.
|
|
110
|
+
React.useEffect(() => {
|
|
111
|
+
if (!open)
|
|
112
|
+
return;
|
|
113
|
+
const handlePointerDown = (e) => {
|
|
114
|
+
const target = e.target;
|
|
115
|
+
if (inputRef.current?.parentElement?.contains(target))
|
|
116
|
+
return;
|
|
117
|
+
if (document.getElementById(menuId)?.contains(target)) {
|
|
118
|
+
pressingMenu.current = true;
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
setOpen(false);
|
|
122
|
+
setQuery(labelOf(current));
|
|
123
|
+
setTyped(false);
|
|
124
|
+
};
|
|
125
|
+
document.addEventListener('pointerdown', handlePointerDown);
|
|
126
|
+
return () => document.removeEventListener('pointerdown', handlePointerDown);
|
|
127
|
+
}, [open, menuId, labelOf, current]);
|
|
128
|
+
return (_jsxs("div", { "data-helix-part": "combobox-root", ...(fullWidth ? { 'data-full-width': '' } : {}), ...(disabled ? { 'data-disabled': '' } : {}), ...(invalid ? { 'data-invalid': '' } : {}), className: cn(className), children: [_jsxs("label", { "data-helix-part": "combobox-label", htmlFor: id, style: hideLabel ? { position: 'absolute', width: 1, height: 1, overflow: 'hidden', clip: 'rect(0,0,0,0)' } : undefined, children: [label, required && _jsx("span", { "data-helix-part": "combobox-required", "aria-hidden": "true", children: " *" })] }), _jsxs("div", { "data-helix-part": "combobox-wrapper", ...(disabled ? { 'data-disabled': '' } : {}), ...(invalid ? { 'data-invalid': '' } : {}), children: [_jsx("span", { "data-helix-part": "combobox-icon", "aria-hidden": "true", children: _jsx(Icon, { icon: IconSearch, size: 16 }) }), _jsx("input", { ref: inputRef, id: id, type: "text", "data-helix-part": "combobox-input", role: "combobox", "aria-autocomplete": "list", "aria-expanded": open, "aria-controls": open ? menuId : undefined, "aria-activedescendant": open && activeValue ? optionId(menuId, activeValue) : undefined, "aria-invalid": invalid || undefined, "aria-describedby": describedby, "aria-required": required || undefined, autoComplete: "off", spellCheck: false, disabled: disabled, placeholder: placeholder, value: query, onFocus: e => e.currentTarget.select(),
|
|
129
|
+
// Focus leaving the field closes the list and puts the chosen label back — unless it went into the list
|
|
130
|
+
// itself (a pointer pressing an option), which picks it.
|
|
131
|
+
onBlur: e => {
|
|
132
|
+
if (pressingMenu.current) {
|
|
133
|
+
pressingMenu.current = false;
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
if (open && !document.getElementById(menuId)?.contains(e.relatedTarget))
|
|
137
|
+
closeMenu();
|
|
138
|
+
}, onClick: () => (open ? closeMenu() : openMenu()), onChange: handleChange, onKeyDown: handleKeyDown }), _jsx("span", { "data-helix-part": "combobox-chevron", "aria-hidden": "true", children: _jsx(Icon, { icon: IconChevronDown, size: 16 }) }), _jsx(Menu, { id: menuId, expanded: open, anchorRef: inputRef, options: menuOptions, onSelect: commit, ...(current !== undefined ? { value: current } : {}), ...(activeValue !== undefined ? { activeValue } : {}) }), (name || required) && (_jsx("input", { "data-helix-part": "combobox-native", type: "text", tabIndex: -1, "aria-hidden": "true", name: name, value: current ?? '', required: required, disabled: disabled, onChange: () => { }, onFocus: () => inputRef.current?.focus() }))] }), description && !invalid && (_jsx("span", { id: descId, "data-helix-part": "combobox-description", children: description })), invalid && errorMessage && (_jsx("span", { id: errId, "data-helix-part": "combobox-error", role: "alert", children: errorMessage }))] }));
|
|
139
|
+
}
|
|
140
|
+
Combobox.displayName = 'Combobox';
|
|
141
|
+
//# sourceMappingURL=Combobox.js.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @helixds/react — agent note
|
|
3
|
+
* Before using Combobox, read its contract: node_modules/@helixds/react/dist/contracts/Combobox.json
|
|
4
|
+
* (every prop, which are required, when not to use it, the import line). Do not guess Helix props.
|
|
5
|
+
* Guide: node_modules/@helixds/react/AGENTS.md
|
|
6
|
+
*/
|
|
7
|
+
export interface ComboboxOption {
|
|
8
|
+
value: string;
|
|
9
|
+
label: string;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface ComboboxProps {
|
|
13
|
+
label: string;
|
|
14
|
+
/** The options to search and pick from. Typing filters them by label (case-insensitive, contains). */
|
|
15
|
+
options: ComboboxOption[];
|
|
16
|
+
value?: string;
|
|
17
|
+
defaultValue?: string;
|
|
18
|
+
onChange?: (value: string) => void;
|
|
19
|
+
placeholder?: string;
|
|
20
|
+
description?: string;
|
|
21
|
+
errorMessage?: string;
|
|
22
|
+
invalid?: boolean;
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
required?: boolean;
|
|
25
|
+
fullWidth?: boolean;
|
|
26
|
+
hideLabel?: boolean;
|
|
27
|
+
id?: string;
|
|
28
|
+
name?: string;
|
|
29
|
+
className?: string;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=Combobox.types.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @helixds/react — agent note
|
|
3
|
+
* Before using Combobox, read its contract: node_modules/@helixds/react/dist/contracts/Combobox.json
|
|
4
|
+
* (every prop, which are required, when not to use it, the import line). Do not guess Helix props.
|
|
5
|
+
* Guide: node_modules/@helixds/react/AGENTS.md
|
|
6
|
+
*/
|
|
7
|
+
export { Combobox } from './Combobox.js';
|
|
8
|
+
export type { ComboboxProps, ComboboxOption } from './Combobox.types.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @helixds/react — agent note
|
|
3
|
+
* Before using FAB, read its contract: node_modules/@helixds/react/dist/contracts/FAB.json
|
|
4
|
+
* (every prop, which are required, when not to use it, the import line). Do not guess Helix props.
|
|
5
|
+
* Guide: node_modules/@helixds/react/AGENTS.md
|
|
6
|
+
*/
|
|
7
|
+
import * as React from 'react';
|
|
8
|
+
import type { FABProps } from './FAB.types.js';
|
|
9
|
+
declare const FAB: React.ForwardRefExoticComponent<FABProps & React.RefAttributes<HTMLButtonElement>>;
|
|
10
|
+
export { FAB };
|
|
11
|
+
//# sourceMappingURL=FAB.d.ts.map
|