@helixds/react 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +292 -0
- package/LICENSE +21 -0
- package/README.md +49 -2
- package/dist/components/Accordion/Accordion.d.ts +14 -0
- package/dist/components/Accordion/Accordion.doc.d.ts +4 -0
- package/dist/components/Accordion/Accordion.doc.js +27 -0
- package/dist/components/Accordion/Accordion.js +76 -0
- package/dist/components/Accordion/Accordion.types.d.ts +24 -0
- package/dist/components/Accordion/Accordion.types.js +2 -0
- package/dist/components/Accordion/index.d.ts +9 -0
- package/dist/components/Accordion/index.js +2 -0
- package/dist/components/Avatar/Avatar.d.ts +14 -0
- package/dist/components/Avatar/Avatar.doc.d.ts +4 -0
- package/dist/components/Avatar/Avatar.doc.js +34 -0
- package/dist/components/Avatar/Avatar.js +14 -0
- package/dist/components/Avatar/Avatar.types.d.ts +20 -0
- package/dist/components/Avatar/Avatar.types.js +2 -0
- package/dist/components/Avatar/index.d.ts +9 -0
- package/dist/components/Avatar/index.js +2 -0
- package/dist/components/AvatarGroup/AvatarGroup.d.ts +14 -0
- package/dist/components/AvatarGroup/AvatarGroup.doc.d.ts +4 -0
- package/dist/components/AvatarGroup/AvatarGroup.doc.js +30 -0
- package/dist/components/AvatarGroup/AvatarGroup.js +15 -0
- package/dist/components/AvatarGroup/AvatarGroup.types.d.ts +21 -0
- package/dist/components/AvatarGroup/AvatarGroup.types.js +2 -0
- package/dist/components/AvatarGroup/index.d.ts +9 -0
- package/dist/components/AvatarGroup/index.js +2 -0
- package/dist/components/Badge/Badge.d.ts +16 -0
- package/dist/components/Badge/Badge.doc.d.ts +4 -0
- package/dist/components/Badge/Badge.doc.js +69 -0
- package/dist/components/Badge/Badge.js +23 -0
- package/dist/components/Badge/Badge.types.d.ts +22 -0
- package/dist/components/Badge/Badge.types.js +2 -0
- package/dist/components/Badge/index.d.ts +9 -0
- package/dist/components/Badge/index.js +2 -0
- package/dist/components/Button/Button.d.ts +11 -0
- package/dist/components/Button/Button.doc.d.ts +4 -0
- package/dist/components/Button/Button.doc.js +98 -0
- package/dist/components/Button/Button.js +80 -0
- package/dist/components/Button/Button.types.d.ts +29 -0
- package/dist/components/Button/Button.types.js +2 -0
- package/dist/components/Button/index.d.ts +9 -0
- package/dist/components/Button/index.js +2 -0
- package/dist/components/Card/Card.d.ts +14 -0
- package/dist/components/Card/Card.doc.d.ts +4 -0
- package/dist/components/Card/Card.doc.js +44 -0
- package/dist/components/Card/Card.js +9 -0
- package/dist/components/Card/Card.types.d.ts +19 -0
- package/dist/components/Card/Card.types.js +2 -0
- package/dist/components/Card/index.d.ts +9 -0
- package/dist/components/Card/index.js +2 -0
- package/dist/components/Chart/Chart.d.ts +14 -0
- package/dist/components/Chart/Chart.doc.d.ts +4 -0
- package/dist/components/Chart/Chart.doc.js +49 -0
- package/dist/components/Chart/Chart.js +184 -0
- package/dist/components/Chart/Chart.types.d.ts +21 -0
- package/dist/components/Chart/Chart.types.js +2 -0
- package/dist/components/Chart/index.d.ts +9 -0
- package/dist/components/Chart/index.js +2 -0
- package/dist/components/Checkbox/Checkbox.d.ts +12 -0
- package/dist/components/Checkbox/Checkbox.doc.d.ts +4 -0
- package/dist/components/Checkbox/Checkbox.doc.js +54 -0
- package/dist/components/Checkbox/Checkbox.js +23 -0
- package/dist/components/Checkbox/Checkbox.types.d.ts +22 -0
- package/dist/components/Checkbox/Checkbox.types.js +2 -0
- package/dist/components/Checkbox/index.d.ts +9 -0
- package/dist/components/Checkbox/index.js +2 -0
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +13 -0
- package/dist/components/CheckboxGroup/CheckboxGroup.doc.d.ts +4 -0
- package/dist/components/CheckboxGroup/CheckboxGroup.doc.js +56 -0
- package/dist/components/CheckboxGroup/CheckboxGroup.js +27 -0
- package/dist/components/CheckboxGroup/CheckboxGroup.types.d.ts +28 -0
- package/dist/components/CheckboxGroup/CheckboxGroup.types.js +2 -0
- package/dist/components/CheckboxGroup/index.d.ts +9 -0
- package/dist/components/CheckboxGroup/index.js +2 -0
- package/dist/components/Chip/Chip.d.ts +11 -0
- package/dist/components/Chip/Chip.doc.d.ts +4 -0
- package/dist/components/Chip/Chip.doc.js +105 -0
- package/dist/components/Chip/Chip.js +30 -0
- package/dist/components/Chip/Chip.types.d.ts +31 -0
- package/dist/components/Chip/Chip.types.js +2 -0
- package/dist/components/Chip/index.d.ts +9 -0
- package/dist/components/Chip/index.js +2 -0
- package/dist/components/ChipGroup/ChipGroup.d.ts +12 -0
- package/dist/components/ChipGroup/ChipGroup.doc.d.ts +4 -0
- package/dist/components/ChipGroup/ChipGroup.doc.js +31 -0
- package/dist/components/ChipGroup/ChipGroup.js +9 -0
- package/dist/components/ChipGroup/ChipGroup.types.d.ts +27 -0
- package/dist/components/ChipGroup/ChipGroup.types.js +2 -0
- package/dist/components/ChipGroup/index.d.ts +9 -0
- package/dist/components/ChipGroup/index.js +2 -0
- package/dist/components/FAB/FAB.d.ts +11 -0
- package/dist/components/FAB/FAB.doc.d.ts +4 -0
- package/dist/components/FAB/FAB.doc.js +52 -0
- package/dist/components/FAB/FAB.js +133 -0
- package/dist/components/FAB/FAB.types.d.ts +37 -0
- package/dist/components/FAB/FAB.types.js +2 -0
- package/dist/components/FAB/index.d.ts +9 -0
- package/dist/components/FAB/index.js +2 -0
- package/dist/components/Icon/Icon.d.ts +14 -0
- package/dist/components/Icon/Icon.doc.d.ts +4 -0
- package/dist/components/Icon/Icon.doc.js +38 -0
- package/dist/components/Icon/Icon.js +15 -0
- package/dist/components/Icon/Icon.types.d.ts +47 -0
- package/dist/components/Icon/Icon.types.js +2 -0
- package/dist/components/Icon/createIconAdapter.d.ts +24 -0
- package/dist/components/Icon/createIconAdapter.js +28 -0
- package/dist/components/Icon/iconStroke.d.ts +20 -0
- package/dist/components/Icon/iconStroke.js +54 -0
- package/dist/components/Icon/index.d.ts +12 -0
- package/dist/components/Icon/index.js +4 -0
- package/dist/components/IconButton/IconButton.d.ts +11 -0
- package/dist/components/IconButton/IconButton.doc.d.ts +4 -0
- package/dist/components/IconButton/IconButton.doc.js +76 -0
- package/dist/components/IconButton/IconButton.js +20 -0
- package/dist/components/IconButton/IconButton.types.d.ts +25 -0
- package/dist/components/IconButton/IconButton.types.js +2 -0
- package/dist/components/IconButton/index.d.ts +9 -0
- package/dist/components/IconButton/index.js +2 -0
- package/dist/components/Input/Input.d.ts +11 -0
- package/dist/components/Input/Input.doc.d.ts +4 -0
- package/dist/components/Input/Input.doc.js +68 -0
- package/dist/components/Input/Input.js +48 -0
- package/dist/components/Input/Input.types.d.ts +36 -0
- package/dist/components/Input/Input.types.js +2 -0
- package/dist/components/Input/index.d.ts +9 -0
- package/dist/components/Input/index.js +2 -0
- package/dist/components/Menu/Menu.d.ts +14 -0
- package/dist/components/Menu/Menu.doc.d.ts +4 -0
- package/dist/components/Menu/Menu.doc.js +46 -0
- package/dist/components/Menu/Menu.js +105 -0
- package/dist/components/Menu/Menu.types.d.ts +34 -0
- package/dist/components/Menu/Menu.types.js +2 -0
- package/dist/components/Menu/index.d.ts +9 -0
- package/dist/components/Menu/index.js +2 -0
- package/dist/components/Modal/Modal.d.ts +14 -0
- package/dist/components/Modal/Modal.doc.d.ts +4 -0
- package/dist/components/Modal/Modal.doc.js +52 -0
- package/dist/components/Modal/Modal.js +30 -0
- package/dist/components/Modal/Modal.types.d.ts +36 -0
- package/dist/components/Modal/Modal.types.js +2 -0
- package/dist/components/Modal/index.d.ts +9 -0
- package/dist/components/Modal/index.js +2 -0
- package/dist/components/MultiSelect/MultiSelect.d.ts +17 -0
- package/dist/components/MultiSelect/MultiSelect.doc.d.ts +4 -0
- package/dist/components/MultiSelect/MultiSelect.doc.js +37 -0
- package/dist/components/MultiSelect/MultiSelect.js +165 -0
- package/dist/components/MultiSelect/MultiSelect.types.d.ts +50 -0
- package/dist/components/MultiSelect/MultiSelect.types.js +2 -0
- package/dist/components/MultiSelect/index.d.ts +9 -0
- package/dist/components/MultiSelect/index.js +2 -0
- package/dist/components/NavItem/NavItem.d.ts +14 -0
- package/dist/components/NavItem/NavItem.doc.d.ts +4 -0
- package/dist/components/NavItem/NavItem.doc.js +31 -0
- package/dist/components/NavItem/NavItem.js +21 -0
- package/dist/components/NavItem/NavItem.types.d.ts +20 -0
- package/dist/components/NavItem/NavItem.types.js +2 -0
- package/dist/components/NavItem/index.d.ts +9 -0
- package/dist/components/NavItem/index.js +2 -0
- package/dist/components/RadioButton/RadioButton.d.ts +14 -0
- package/dist/components/RadioButton/RadioButton.doc.d.ts +4 -0
- package/dist/components/RadioButton/RadioButton.doc.js +35 -0
- package/dist/components/RadioButton/RadioButton.js +15 -0
- package/dist/components/RadioButton/RadioButton.types.d.ts +33 -0
- package/dist/components/RadioButton/RadioButton.types.js +2 -0
- package/dist/components/RadioButton/index.d.ts +9 -0
- package/dist/components/RadioButton/index.js +2 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +12 -0
- package/dist/components/RadioGroup/RadioGroup.doc.d.ts +4 -0
- package/dist/components/RadioGroup/RadioGroup.doc.js +80 -0
- package/dist/components/RadioGroup/RadioGroup.js +19 -0
- package/dist/components/RadioGroup/RadioGroup.types.d.ts +28 -0
- package/dist/components/RadioGroup/RadioGroup.types.js +2 -0
- package/dist/components/RadioGroup/index.d.ts +9 -0
- package/dist/components/RadioGroup/index.js +2 -0
- package/dist/components/SegmentedControl/SegmentedControl.d.ts +13 -0
- package/dist/components/SegmentedControl/SegmentedControl.doc.d.ts +4 -0
- package/dist/components/SegmentedControl/SegmentedControl.doc.js +50 -0
- package/dist/components/SegmentedControl/SegmentedControl.js +64 -0
- package/dist/components/SegmentedControl/SegmentedControl.types.d.ts +26 -0
- package/dist/components/SegmentedControl/SegmentedControl.types.js +2 -0
- package/dist/components/SegmentedControl/index.d.ts +9 -0
- package/dist/components/SegmentedControl/index.js +2 -0
- package/dist/components/Select/Select.d.ts +13 -0
- package/dist/components/Select/Select.doc.d.ts +4 -0
- package/dist/components/Select/Select.doc.js +66 -0
- package/dist/components/Select/Select.js +138 -0
- package/dist/components/Select/Select.types.d.ts +36 -0
- package/dist/components/Select/Select.types.js +2 -0
- package/dist/components/Select/index.d.ts +9 -0
- package/dist/components/Select/index.js +2 -0
- package/dist/components/SidePanel/SidePanel.d.ts +14 -0
- package/dist/components/SidePanel/SidePanel.doc.d.ts +4 -0
- package/dist/components/SidePanel/SidePanel.doc.js +29 -0
- package/dist/components/SidePanel/SidePanel.js +19 -0
- package/dist/components/SidePanel/SidePanel.types.d.ts +28 -0
- package/dist/components/SidePanel/SidePanel.types.js +2 -0
- package/dist/components/SidePanel/index.d.ts +9 -0
- package/dist/components/SidePanel/index.js +2 -0
- package/dist/components/Switch/Switch.d.ts +13 -0
- package/dist/components/Switch/Switch.doc.d.ts +4 -0
- package/dist/components/Switch/Switch.doc.js +56 -0
- package/dist/components/Switch/Switch.js +45 -0
- package/dist/components/Switch/Switch.types.d.ts +21 -0
- package/dist/components/Switch/Switch.types.js +2 -0
- package/dist/components/Switch/index.d.ts +9 -0
- package/dist/components/Switch/index.js +2 -0
- package/dist/components/Table/Table.d.ts +34 -0
- package/dist/components/Table/Table.doc.d.ts +4 -0
- package/dist/components/Table/Table.doc.js +48 -0
- package/dist/components/Table/Table.js +17 -0
- package/dist/components/Table/Table.types.d.ts +30 -0
- package/dist/components/Table/Table.types.js +2 -0
- package/dist/components/Table/index.d.ts +9 -0
- package/dist/components/Table/index.js +2 -0
- package/dist/components/Textarea/Textarea.d.ts +9 -0
- package/dist/components/Textarea/Textarea.doc.d.ts +4 -0
- package/dist/components/Textarea/Textarea.doc.js +60 -0
- package/dist/components/Textarea/Textarea.js +24 -0
- package/dist/components/Textarea/Textarea.types.d.ts +22 -0
- package/dist/components/Textarea/Textarea.types.js +2 -0
- package/dist/components/Textarea/index.d.ts +9 -0
- package/dist/components/Textarea/index.js +2 -0
- package/dist/components/Toast/Toast.d.ts +16 -0
- package/dist/components/Toast/Toast.doc.d.ts +4 -0
- package/dist/components/Toast/Toast.doc.js +37 -0
- package/dist/components/Toast/Toast.js +134 -0
- package/dist/components/Toast/Toast.types.d.ts +11 -0
- package/dist/components/Toast/Toast.types.js +2 -0
- package/dist/components/Toast/index.d.ts +10 -0
- package/dist/components/Toast/index.js +2 -0
- package/dist/components/Toast/toastStore.d.ts +36 -0
- package/dist/components/Toast/toastStore.js +57 -0
- package/dist/components/Tooltip/Tooltip.d.ts +14 -0
- package/dist/components/Tooltip/Tooltip.doc.d.ts +4 -0
- package/dist/components/Tooltip/Tooltip.doc.js +33 -0
- package/dist/components/Tooltip/Tooltip.js +105 -0
- package/dist/components/Tooltip/Tooltip.types.d.ts +21 -0
- package/dist/components/Tooltip/Tooltip.types.js +2 -0
- package/dist/components/Tooltip/index.d.ts +9 -0
- package/dist/components/Tooltip/index.js +2 -0
- package/dist/contracts/Accordion.json +174 -0
- package/dist/contracts/AppShell.json +118 -0
- package/dist/contracts/Avatar.json +157 -0
- package/dist/contracts/AvatarGroup.json +169 -0
- package/dist/contracts/Badge.json +212 -0
- package/dist/contracts/Button.json +295 -0
- package/dist/contracts/Card.json +125 -0
- package/dist/contracts/Chart.json +167 -0
- package/dist/contracts/Checkbox.json +333 -0
- package/dist/contracts/CheckboxGroup.json +200 -0
- package/dist/contracts/Chip.json +320 -0
- package/dist/contracts/ChipGroup.json +182 -0
- package/dist/contracts/FAB.json +215 -0
- package/dist/contracts/Icon.json +306 -0
- package/dist/contracts/IconButton.json +213 -0
- package/dist/contracts/Input.json +400 -0
- package/dist/contracts/Menu.json +197 -0
- package/dist/contracts/Modal.json +192 -0
- package/dist/contracts/MultiSelect.json +244 -0
- package/dist/contracts/NavItem.json +148 -0
- package/dist/contracts/PageHeader.json +134 -0
- package/dist/contracts/RadioButton.json +202 -0
- package/dist/contracts/RadioGroup.json +228 -0
- package/dist/contracts/SegmentedControl.json +193 -0
- package/dist/contracts/Select.json +241 -0
- package/dist/contracts/SideNav.json +138 -0
- package/dist/contracts/SidePanel.json +153 -0
- package/dist/contracts/Switch.json +201 -0
- package/dist/contracts/Table.json +130 -0
- package/dist/contracts/Textarea.json +353 -0
- package/dist/contracts/Toast.json +186 -0
- package/dist/contracts/Tooltip.json +168 -0
- package/dist/contracts/TopBar.json +127 -0
- package/dist/contracts/manifest.json +675 -0
- package/dist/index.d.ts +109 -0
- package/dist/index.js +73 -0
- package/dist/layout/AppShell/AppShell.d.ts +14 -0
- package/dist/layout/AppShell/AppShell.doc.d.ts +4 -0
- package/dist/layout/AppShell/AppShell.doc.js +27 -0
- package/dist/layout/AppShell/AppShell.js +9 -0
- package/dist/layout/AppShell/AppShell.types.d.ts +18 -0
- package/dist/layout/AppShell/AppShell.types.js +2 -0
- package/dist/layout/AppShell/index.d.ts +9 -0
- package/dist/layout/AppShell/index.js +2 -0
- package/dist/layout/PageHeader/PageHeader.d.ts +14 -0
- package/dist/layout/PageHeader/PageHeader.doc.d.ts +4 -0
- package/dist/layout/PageHeader/PageHeader.doc.js +30 -0
- package/dist/layout/PageHeader/PageHeader.js +10 -0
- package/dist/layout/PageHeader/PageHeader.types.d.ts +21 -0
- package/dist/layout/PageHeader/PageHeader.types.js +2 -0
- package/dist/layout/PageHeader/index.d.ts +9 -0
- package/dist/layout/PageHeader/index.js +2 -0
- package/dist/layout/SideNav/SideNav.d.ts +14 -0
- package/dist/layout/SideNav/SideNav.doc.d.ts +4 -0
- package/dist/layout/SideNav/SideNav.doc.js +32 -0
- package/dist/layout/SideNav/SideNav.js +9 -0
- package/dist/layout/SideNav/SideNav.types.d.ts +18 -0
- package/dist/layout/SideNav/SideNav.types.js +2 -0
- package/dist/layout/SideNav/index.d.ts +9 -0
- package/dist/layout/SideNav/index.js +2 -0
- package/dist/layout/TopBar/TopBar.d.ts +14 -0
- package/dist/layout/TopBar/TopBar.doc.d.ts +4 -0
- package/dist/layout/TopBar/TopBar.doc.js +28 -0
- package/dist/layout/TopBar/TopBar.js +9 -0
- package/dist/layout/TopBar/TopBar.types.d.ts +16 -0
- package/dist/layout/TopBar/TopBar.types.js +2 -0
- package/dist/layout/TopBar/index.d.ts +9 -0
- package/dist/layout/TopBar/index.js +2 -0
- package/dist/lib/component-doc.d.ts +34 -0
- package/dist/lib/component-doc.js +2 -0
- package/dist/lib/motionPresets.d.ts +37 -0
- package/dist/lib/motionPresets.js +35 -0
- package/dist/lib/resolveTokenPx.d.ts +11 -0
- package/dist/lib/resolveTokenPx.js +17 -0
- package/dist/lib/useDialogTransition.d.ts +21 -0
- package/dist/lib/useDialogTransition.js +86 -0
- package/dist/lib/useDisclosureTransition.d.ts +19 -0
- package/dist/lib/useDisclosureTransition.js +41 -0
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.js +6 -0
- package/dist/patterns/action-bar.md +127 -0
- package/dist/patterns/border-always.md +40 -0
- package/dist/patterns/data-analytics.md +15 -0
- package/dist/patterns/disabled-state.md +80 -0
- package/dist/patterns/empty-state.md +130 -0
- package/dist/patterns/expand-collapse-chevron.md +101 -0
- package/dist/patterns/form-field-group.md +139 -0
- package/dist/patterns/form-field-spacing.md +99 -0
- package/dist/patterns/group-spacing.md +54 -0
- package/dist/patterns/motion-effects.md +100 -0
- package/dist/patterns/same-row-sizing.md +52 -0
- package/dist/patterns/search-filter.md +118 -0
- package/dist/patterns/show-hide-parts.md +53 -0
- package/dist/patterns/stat-card.md +105 -0
- package/dist/patterns/status-row.md +130 -0
- package/dist/patterns/view-toggle.md +81 -0
- package/dist/prop-map.md +80 -0
- package/package.json +70 -3
- package/src/globals.css +3195 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @helixds/react — agent note
|
|
3
|
+
* Before using MultiSelect, read its contract: node_modules/@helixds/react/dist/contracts/MultiSelect.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 { MultiSelectProps } from './MultiSelect.types.js';
|
|
9
|
+
/**
|
|
10
|
+
* Select's field and interaction model (ADR-013) with the selected values as Chips inside the field —
|
|
11
|
+
* see ADR-019. The combobox button owns real DOM focus; the chips' × buttons are the only other stops.
|
|
12
|
+
*/
|
|
13
|
+
export declare function MultiSelect({ label, options, value, defaultValue, onChange, placeholder, description, errorMessage, invalid, disabled, required, fullWidth, hideLabel, id: idProp, name, className, }: MultiSelectProps): React.JSX.Element;
|
|
14
|
+
export declare namespace MultiSelect {
|
|
15
|
+
var displayName: string;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=MultiSelect.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export const doc = {
|
|
2
|
+
name: 'MultiSelect',
|
|
3
|
+
purpose: 'Lets users choose several values from a predefined list, shown as removable chips inside the field.',
|
|
4
|
+
contract: 'contracts/components/MultiSelect.json',
|
|
5
|
+
a11y: [
|
|
6
|
+
'The `label` prop is required. The combobox button owns focus and announces the selection ("2 selected: …").',
|
|
7
|
+
'Same select-only combobox model as Select (ADR-013), with the Menu listbox in `multiple` mode (`aria-multiselectable`) — ADR-019.',
|
|
8
|
+
'Enter/Space toggle the highlighted option and keep the menu open; Backspace (menu closed) removes the last chip; each chip\'s × is focusable and removes that value.',
|
|
9
|
+
],
|
|
10
|
+
variants: [],
|
|
11
|
+
sizes: [],
|
|
12
|
+
tokens: [
|
|
13
|
+
{ part: 'multi-select-field', label: 'Default fill', token: '--helix-select-fill-default', kind: 'color' },
|
|
14
|
+
{ part: 'multi-select-field', label: 'Default border', token: '--helix-select-border-default', kind: 'color' },
|
|
15
|
+
{ part: 'multi-select-field', label: 'Default border', token: '--helix-select-border-hover', kind: 'color', state: 'hover' },
|
|
16
|
+
{ part: 'multi-select-field', label: 'Focus border', token: '--helix-select-border-focus', kind: 'color' },
|
|
17
|
+
{ part: 'multi-select-field', label: 'Invalid border', token: '--helix-select-border-invalid', kind: 'color' },
|
|
18
|
+
{ part: 'multi-select-field', label: 'Disabled fill', token: '--helix-select-fill-disabled', kind: 'color', state: 'disabled' },
|
|
19
|
+
{ part: 'multi-select-field', label: 'Disabled border', token: '--helix-select-border-disabled', kind: 'color', state: 'disabled' },
|
|
20
|
+
{ part: 'multi-select-placeholder', label: 'Placeholder text', token: '--helix-select-text-placeholder', kind: 'color' },
|
|
21
|
+
{ part: 'multi-select-field', label: 'gap (chips)', token: '--helix-spacing-2xs', kind: 'space', axis: 'horizontal', meta: '4px between chips' },
|
|
22
|
+
{ part: 'multi-select-field', label: 'gap (rows)', token: '--helix-spacing-2xs', kind: 'space', axis: 'vertical', meta: '4px between wrapped rows' },
|
|
23
|
+
{ part: 'multi-select-root', label: 'gap', token: '--helix-select-gap', kind: 'space', axis: 'vertical', meta: '8px, label↔field and field↔description/error — form-field-spacing pattern' },
|
|
24
|
+
],
|
|
25
|
+
features: [
|
|
26
|
+
'Select\'s field — same tokens, 32px minimum height, chevron, label/description/error and form participation',
|
|
27
|
+
'Selected values as dismissible Chips (size s, 24px) inside the field, 4px from its outer edge; the field grows downward when they wrap',
|
|
28
|
+
'Menu in multiple mode — picking an option toggles it without closing the menu',
|
|
29
|
+
'Backspace removes the last chip; each chip\'s × removes its value',
|
|
30
|
+
],
|
|
31
|
+
examples: [
|
|
32
|
+
{ label: 'Default', code: `<MultiSelect label="Skills" options={options} placeholder="Choose skills…" />` },
|
|
33
|
+
{ label: 'Controlled', code: `<MultiSelect label="Skills" options={options} value={skills} onChange={setSkills} />` },
|
|
34
|
+
{ label: 'Invalid', code: `<MultiSelect label="Skills" options={options} invalid errorMessage="Pick at least one" />` },
|
|
35
|
+
],
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=MultiSelect.doc.js.map
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { IconChevronDown } from '@tabler/icons-react';
|
|
4
|
+
import { cn } from '../../lib/utils.js';
|
|
5
|
+
import { Icon } from '../Icon/index.js';
|
|
6
|
+
import { Chip } from '../Chip/index.js';
|
|
7
|
+
import { Menu, optionId } from '../Menu/index.js';
|
|
8
|
+
let idCounter = 0;
|
|
9
|
+
function isGroup(opt) {
|
|
10
|
+
return 'options' in opt;
|
|
11
|
+
}
|
|
12
|
+
function flattenOptions(options) {
|
|
13
|
+
return options.flatMap(opt => (isGroup(opt) ? opt.options : [opt]));
|
|
14
|
+
}
|
|
15
|
+
const VISUALLY_HIDDEN = {
|
|
16
|
+
position: 'absolute', width: 1, height: 1, overflow: 'hidden', clip: 'rect(0,0,0,0)', whiteSpace: 'nowrap',
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Select's field and interaction model (ADR-013) with the selected values as Chips inside the field —
|
|
20
|
+
* see ADR-019. The combobox button owns real DOM focus; the chips' × buttons are the only other stops.
|
|
21
|
+
*/
|
|
22
|
+
export function MultiSelect({ label, options, value, defaultValue, onChange, placeholder, description, errorMessage, invalid = false, disabled = false, required = false, fullWidth = false, hideLabel = false, id: idProp, name, className, }) {
|
|
23
|
+
const uid = React.useRef(`helix-multi-select-${++idCounter}`).current;
|
|
24
|
+
const id = idProp ?? uid;
|
|
25
|
+
const menuId = `${id}-menu`;
|
|
26
|
+
const descId = description && !invalid ? `${id}-desc` : undefined;
|
|
27
|
+
const errId = invalid && errorMessage ? `${id}-err` : undefined;
|
|
28
|
+
const describedby = [descId, errId].filter(Boolean).join(' ') || undefined;
|
|
29
|
+
const isControlled = value !== undefined;
|
|
30
|
+
const [internalValue, setInternalValue] = React.useState(defaultValue ?? []);
|
|
31
|
+
const current = isControlled ? value : internalValue;
|
|
32
|
+
const [open, setOpen] = React.useState(false);
|
|
33
|
+
const [activeValue, setActiveValue] = React.useState(undefined);
|
|
34
|
+
const fieldRef = React.useRef(null);
|
|
35
|
+
const triggerRef = React.useRef(null);
|
|
36
|
+
const flatOptions = React.useMemo(() => flattenOptions(options), [options]);
|
|
37
|
+
// In the order they were picked, so a new chip always lands at the end of the row.
|
|
38
|
+
const selectedOptions = current
|
|
39
|
+
.map(v => flatOptions.find(o => o.value === v))
|
|
40
|
+
.filter((o) => o !== undefined);
|
|
41
|
+
const setValues = (next) => {
|
|
42
|
+
if (!isControlled)
|
|
43
|
+
setInternalValue(next);
|
|
44
|
+
onChange?.(next);
|
|
45
|
+
};
|
|
46
|
+
// Toggle, don't close — several values can be picked in one go (ADR-019).
|
|
47
|
+
const toggle = (optionValue) => {
|
|
48
|
+
setValues(current.includes(optionValue) ? current.filter(v => v !== optionValue) : [...current, optionValue]);
|
|
49
|
+
triggerRef.current?.focus();
|
|
50
|
+
};
|
|
51
|
+
const remove = (optionValue) => {
|
|
52
|
+
setValues(current.filter(v => v !== optionValue));
|
|
53
|
+
};
|
|
54
|
+
const enabledOptions = () => flatOptions.filter(o => !o.disabled);
|
|
55
|
+
// The gray keyboard highlight only starts on the first option when the keyboard opened the menu — a
|
|
56
|
+
// pointer open starts with nothing highlighted, so no option looks hovered that isn't.
|
|
57
|
+
const openMenu = (via = 'keyboard') => {
|
|
58
|
+
if (disabled)
|
|
59
|
+
return;
|
|
60
|
+
setActiveValue(via === 'keyboard' ? enabledOptions()[0]?.value : undefined);
|
|
61
|
+
setOpen(true);
|
|
62
|
+
};
|
|
63
|
+
const closeMenu = () => setOpen(false);
|
|
64
|
+
const moveActive = (dir) => {
|
|
65
|
+
const enabled = enabledOptions();
|
|
66
|
+
if (enabled.length === 0)
|
|
67
|
+
return;
|
|
68
|
+
const currentIndex = enabled.findIndex(o => o.value === activeValue);
|
|
69
|
+
const nextIndex = currentIndex === -1
|
|
70
|
+
? (dir === 1 ? 0 : enabled.length - 1)
|
|
71
|
+
: (currentIndex + dir + enabled.length) % enabled.length;
|
|
72
|
+
setActiveValue(enabled[nextIndex].value);
|
|
73
|
+
};
|
|
74
|
+
// Same hand-rolled roving model as Select's trigger (ADR-013); differences are Enter/Space toggling
|
|
75
|
+
// without closing, and Backspace removing the last chip.
|
|
76
|
+
const handleTriggerKeyDown = (e) => {
|
|
77
|
+
if (disabled)
|
|
78
|
+
return;
|
|
79
|
+
switch (e.key) {
|
|
80
|
+
case 'ArrowDown':
|
|
81
|
+
e.preventDefault();
|
|
82
|
+
open ? moveActive(1) : openMenu();
|
|
83
|
+
break;
|
|
84
|
+
case 'ArrowUp':
|
|
85
|
+
e.preventDefault();
|
|
86
|
+
open ? moveActive(-1) : openMenu();
|
|
87
|
+
break;
|
|
88
|
+
case 'Home': {
|
|
89
|
+
if (!open)
|
|
90
|
+
break;
|
|
91
|
+
e.preventDefault();
|
|
92
|
+
const enabled = enabledOptions();
|
|
93
|
+
if (enabled[0])
|
|
94
|
+
setActiveValue(enabled[0].value);
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
case 'End': {
|
|
98
|
+
if (!open)
|
|
99
|
+
break;
|
|
100
|
+
e.preventDefault();
|
|
101
|
+
const enabled = enabledOptions();
|
|
102
|
+
if (enabled.length)
|
|
103
|
+
setActiveValue(enabled[enabled.length - 1].value);
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
case 'Enter':
|
|
107
|
+
case ' ':
|
|
108
|
+
e.preventDefault();
|
|
109
|
+
if (open) {
|
|
110
|
+
if (activeValue)
|
|
111
|
+
toggle(activeValue);
|
|
112
|
+
}
|
|
113
|
+
else
|
|
114
|
+
openMenu();
|
|
115
|
+
break;
|
|
116
|
+
case 'Backspace':
|
|
117
|
+
if (!open && current.length > 0) {
|
|
118
|
+
e.preventDefault();
|
|
119
|
+
remove(current[current.length - 1]);
|
|
120
|
+
}
|
|
121
|
+
break;
|
|
122
|
+
case 'Escape':
|
|
123
|
+
if (open) {
|
|
124
|
+
e.preventDefault();
|
|
125
|
+
closeMenu();
|
|
126
|
+
}
|
|
127
|
+
break;
|
|
128
|
+
case 'Tab':
|
|
129
|
+
// Close first, then let focus move on as usual (no preventDefault).
|
|
130
|
+
if (open)
|
|
131
|
+
closeMenu();
|
|
132
|
+
break;
|
|
133
|
+
default:
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
// Click-outside — closes when a pointer lands outside both the field and the portaled menu.
|
|
138
|
+
React.useEffect(() => {
|
|
139
|
+
if (!open)
|
|
140
|
+
return;
|
|
141
|
+
const handlePointerDown = (e) => {
|
|
142
|
+
const target = e.target;
|
|
143
|
+
if (fieldRef.current?.contains(target))
|
|
144
|
+
return;
|
|
145
|
+
if (document.getElementById(menuId)?.contains(target))
|
|
146
|
+
return;
|
|
147
|
+
setOpen(false);
|
|
148
|
+
};
|
|
149
|
+
document.addEventListener('pointerdown', handlePointerDown);
|
|
150
|
+
return () => document.removeEventListener('pointerdown', handlePointerDown);
|
|
151
|
+
}, [open, menuId]);
|
|
152
|
+
// Clicking the field's empty area behaves like clicking the combobox. Clicks on a chip (its label or
|
|
153
|
+
// its ×) are left alone.
|
|
154
|
+
const handleFieldClick = (e) => {
|
|
155
|
+
if (disabled || e.target.closest('[data-helix-part="multi-select-chip"]'))
|
|
156
|
+
return;
|
|
157
|
+
if (e.target === triggerRef.current)
|
|
158
|
+
return; // the button's own onClick handles it
|
|
159
|
+
triggerRef.current?.focus();
|
|
160
|
+
open ? closeMenu() : openMenu('pointer');
|
|
161
|
+
};
|
|
162
|
+
return (_jsxs("div", { "data-helix-part": "multi-select-root", ...(fullWidth ? { 'data-full-width': '' } : {}), ...(disabled ? { 'data-disabled': '' } : {}), ...(invalid ? { 'data-invalid': '' } : {}), className: cn(className), children: [_jsxs("label", { "data-helix-part": "multi-select-label", htmlFor: id, style: hideLabel ? VISUALLY_HIDDEN : undefined, children: [label, required && _jsx("span", { "data-helix-part": "multi-select-required", "aria-hidden": "true", children: " *" })] }), _jsxs("div", { ref: fieldRef, "data-helix-part": "multi-select-field", ...(disabled ? { 'data-disabled': '' } : {}), ...(invalid ? { 'data-invalid': '' } : {}), ...(open ? { 'data-open': '' } : {}), ...(selectedOptions.length ? { 'data-has-value': '' } : {}), onClick: handleFieldClick, children: [selectedOptions.map(opt => (_jsx("span", { "data-helix-part": "multi-select-chip", children: _jsx(Chip, { size: "s", label: opt.label, dismissible: true, onDismiss: () => remove(opt.value), disabled: disabled, tabIndex: -1, "aria-hidden": "true" }) }, opt.value))), _jsx("button", { ref: triggerRef, type: "button", id: id, "data-helix-part": "multi-select-trigger", disabled: disabled, role: "combobox", "aria-haspopup": "listbox", "aria-expanded": open, "aria-controls": open ? menuId : undefined, "aria-invalid": invalid || undefined, "aria-describedby": describedby, "aria-required": required || undefined, "aria-activedescendant": open && activeValue ? optionId(menuId, activeValue) : undefined, onClick: () => (open ? closeMenu() : openMenu('pointer')), onKeyDown: handleTriggerKeyDown, children: selectedOptions.length === 0 ? (_jsx("span", { "data-helix-part": "multi-select-placeholder", children: placeholder ?? '' })) : (_jsx("span", { style: VISUALLY_HIDDEN, children: `${selectedOptions.length} selected: ${selectedOptions.map(o => o.label).join(', ')}` })) }), _jsx("span", { "data-helix-part": "multi-select-chevron", "aria-hidden": "true", children: _jsx(Icon, { icon: IconChevronDown, size: 16 }) }), _jsx(Menu, { id: menuId, expanded: open, anchorRef: fieldRef, options: options, multiple: true, values: current, onSelect: toggle, ...(activeValue !== undefined ? { activeValue } : {}) }), (name || required) && (_jsx("input", { "data-helix-part": "multi-select-native", type: "text", tabIndex: -1, "aria-hidden": "true", name: name, value: current.join(','), required: required, disabled: disabled, onChange: () => { }, onFocus: () => triggerRef.current?.focus() }))] }), description && !invalid && (_jsx("span", { id: descId, "data-helix-part": "multi-select-description", children: description })), invalid && errorMessage && (_jsx("span", { id: errId, "data-helix-part": "multi-select-error", role: "alert", children: errorMessage }))] }));
|
|
163
|
+
}
|
|
164
|
+
MultiSelect.displayName = 'MultiSelect';
|
|
165
|
+
//# sourceMappingURL=MultiSelect.js.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @helixds/react — agent note
|
|
3
|
+
* Before using MultiSelect, read its contract: node_modules/@helixds/react/dist/contracts/MultiSelect.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 MultiSelectOption {
|
|
8
|
+
value: string;
|
|
9
|
+
label: string;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface MultiSelectOptionGroup {
|
|
13
|
+
label: string;
|
|
14
|
+
options: MultiSelectOption[];
|
|
15
|
+
}
|
|
16
|
+
export interface MultiSelectProps {
|
|
17
|
+
/** Visible or screen-reader-only label. Required for a11y. */
|
|
18
|
+
label: string;
|
|
19
|
+
/** List of options and grouped options. */
|
|
20
|
+
options: (MultiSelectOption | MultiSelectOptionGroup)[];
|
|
21
|
+
/** Controlled selected values. */
|
|
22
|
+
value?: string[];
|
|
23
|
+
/** Uncontrolled initial values. */
|
|
24
|
+
defaultValue?: string[];
|
|
25
|
+
/** Fires with the full new array whenever a value is added or removed. */
|
|
26
|
+
onChange?: (values: string[]) => void;
|
|
27
|
+
/** Prompt shown while nothing is selected. */
|
|
28
|
+
placeholder?: string;
|
|
29
|
+
/** Helper text shown below the field. */
|
|
30
|
+
description?: string;
|
|
31
|
+
/** Error text shown when invalid=true. */
|
|
32
|
+
errorMessage?: string;
|
|
33
|
+
/** Shows error styling and message. */
|
|
34
|
+
invalid?: boolean;
|
|
35
|
+
/** Non-interactive state. */
|
|
36
|
+
disabled?: boolean;
|
|
37
|
+
/** At least one value required; blocks native form submit while empty, like Select. */
|
|
38
|
+
required?: boolean;
|
|
39
|
+
/** Expands to container width. */
|
|
40
|
+
fullWidth?: boolean;
|
|
41
|
+
/** Hides the label visually but keeps it accessible. */
|
|
42
|
+
hideLabel?: boolean;
|
|
43
|
+
/** Optional field id override (the combobox's id). */
|
|
44
|
+
id?: string;
|
|
45
|
+
/** Native form field name; the submitted value is the selected values joined by commas. */
|
|
46
|
+
name?: string;
|
|
47
|
+
/** Additional className for the root. */
|
|
48
|
+
className?: string;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=MultiSelect.types.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @helixds/react — agent note
|
|
3
|
+
* Before using MultiSelect, read its contract: node_modules/@helixds/react/dist/contracts/MultiSelect.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 { MultiSelect } from './MultiSelect.js';
|
|
8
|
+
export type { MultiSelectProps, MultiSelectOption, MultiSelectOptionGroup } from './MultiSelect.types.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @helixds/react — agent note
|
|
3
|
+
* Before using NavItem, read its contract: node_modules/@helixds/react/dist/contracts/NavItem.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 { NavItemProps } from './NavItem.types.js';
|
|
9
|
+
declare const NavItem: {
|
|
10
|
+
({ label, href, icon, current, className }: NavItemProps): React.JSX.Element;
|
|
11
|
+
displayName: string;
|
|
12
|
+
};
|
|
13
|
+
export { NavItem };
|
|
14
|
+
//# sourceMappingURL=NavItem.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export const doc = {
|
|
2
|
+
name: 'NavItem',
|
|
3
|
+
purpose: 'A single entry in a persistent navigation list that links to another view.',
|
|
4
|
+
contract: 'contracts/components/NavItem.json',
|
|
5
|
+
a11y: [
|
|
6
|
+
"Always a real <a href> — never a <button> (Button's own contract forbids using it for pure navigation).",
|
|
7
|
+
"current sets aria-current='page', not aria-selected or a custom attribute.",
|
|
8
|
+
],
|
|
9
|
+
variants: [],
|
|
10
|
+
sizes: [],
|
|
11
|
+
tokens: [
|
|
12
|
+
{ part: 'nav-item', label: 'fill.hover', token: '--helix-navItem-fill-hover', kind: 'color', state: 'hover' },
|
|
13
|
+
{ part: 'nav-item', label: 'fill.current', token: '--helix-navItem-fill-current', kind: 'color' },
|
|
14
|
+
{ part: 'nav-item-label', label: 'text.default', token: '--helix-navItem-text-default', kind: 'color' },
|
|
15
|
+
{ part: 'nav-item-label', label: 'text.current', token: '--helix-navItem-text-current', kind: 'color' },
|
|
16
|
+
{ part: 'nav-item-icon', label: 'icon.default', token: '--helix-navItem-icon-default', kind: 'color' },
|
|
17
|
+
{ part: 'nav-item-icon', label: 'icon.current', token: '--helix-navItem-icon-current', kind: 'color' },
|
|
18
|
+
{ part: 'nav-item', label: 'radius', token: '--helix-navItem-radius', kind: 'radius' },
|
|
19
|
+
{ part: 'nav-item-label', label: 'fontSize', token: '--helix-navItem-fontSize', kind: 'typography', meta: 'Body / s / Medium' },
|
|
20
|
+
{ part: 'nav-item-label', label: 'fontWeight', token: '--helix-navItem-fontWeight', kind: 'typography', meta: 'Body / s / Medium' },
|
|
21
|
+
],
|
|
22
|
+
features: [
|
|
23
|
+
'current — the current-view state, aria-current="page" plus a tinted background and brand-colored text/icon',
|
|
24
|
+
'icon — optional leading icon at a fixed 16px',
|
|
25
|
+
],
|
|
26
|
+
examples: [
|
|
27
|
+
{ label: 'Default', code: `<NavItem label="Dashboard" href="/dashboard" icon={IconLayoutDashboard} />` },
|
|
28
|
+
{ label: 'Current', code: `<NavItem label="Team" href="/team" icon={IconUsers} current />` },
|
|
29
|
+
],
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=NavItem.doc.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
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 { cn } from '../../lib/utils.js';
|
|
5
|
+
import { SPRING_SNAPPY } from '../../lib/motionPresets.js';
|
|
6
|
+
import { Icon } from '../Icon/index.js';
|
|
7
|
+
// Shared across every NavItem instance in the tree — Motion's layout animation system uses this to
|
|
8
|
+
// recognize "the same element" moving from one NavItem to another when `current` changes, and animates
|
|
9
|
+
// its position/size (a FLIP-style transition) instead of the background just cutting to the new item.
|
|
10
|
+
// See ADR-007 / .ai/maps/patterns/motion-effects.md.
|
|
11
|
+
const ACTIVE_INDICATOR_LAYOUT_ID = 'helix-nav-item-active-indicator';
|
|
12
|
+
const NavItem = ({ label, href, icon, current = false, className }) => {
|
|
13
|
+
// MotionConfig scoped locally — Motion doesn't honor prefers-reduced-motion on its own (ADR-007).
|
|
14
|
+
return (_jsx(MotionConfig, { reducedMotion: "user", children: _jsxs("a", { "data-helix-part": "nav-item", "data-current": current ? 'true' : undefined, href: href, "aria-current": current ? 'page' : undefined, className: cn(className), children: [current && (_jsx(motion.span, { "data-helix-part": "nav-item-indicator", layoutId: ACTIVE_INDICATOR_LAYOUT_ID, "aria-hidden": "true",
|
|
15
|
+
// Shared with Switch's thumb via ../../lib/motionPresets (was damping 35 here vs 32 on
|
|
16
|
+
// Switch — undocumented drift between two springs meant to feel identical, consolidated).
|
|
17
|
+
transition: SPRING_SNAPPY })), icon && (_jsx("span", { "data-helix-part": "nav-item-icon", children: _jsx(Icon, { icon: icon, size: 16 }) })), _jsx("span", { "data-helix-part": "nav-item-label", children: label })] }) }));
|
|
18
|
+
};
|
|
19
|
+
NavItem.displayName = 'NavItem';
|
|
20
|
+
export { NavItem };
|
|
21
|
+
//# sourceMappingURL=NavItem.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @helixds/react — agent note
|
|
3
|
+
* Before using NavItem, read its contract: node_modules/@helixds/react/dist/contracts/NavItem.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
|
+
export interface NavItemProps {
|
|
9
|
+
/** Visible label text. */
|
|
10
|
+
label: string;
|
|
11
|
+
/** Navigation target. */
|
|
12
|
+
href: string;
|
|
13
|
+
/** Leading icon, passed by reference. Rendered at a fixed 16px. */
|
|
14
|
+
icon?: HelixIconComponent;
|
|
15
|
+
/** Marks this item as representing the current view. Default: false */
|
|
16
|
+
current?: boolean;
|
|
17
|
+
/** Additional className for the root. */
|
|
18
|
+
className?: string;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=NavItem.types.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @helixds/react — agent note
|
|
3
|
+
* Before using NavItem, read its contract: node_modules/@helixds/react/dist/contracts/NavItem.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 { NavItem } from './NavItem.js';
|
|
8
|
+
export type { NavItemProps } from './NavItem.types.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @helixds/react — agent note
|
|
3
|
+
* Before using RadioButton, read its contract: node_modules/@helixds/react/dist/contracts/RadioButton.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 { RadioButtonProps } from './RadioButton.types.js';
|
|
9
|
+
declare const RadioButton: {
|
|
10
|
+
({ label, name: nameProp, value, checked, defaultChecked, onChange, description, errorMessage, invalid, disabled, required, className, }: RadioButtonProps): React.JSX.Element;
|
|
11
|
+
displayName: string;
|
|
12
|
+
};
|
|
13
|
+
export { RadioButton };
|
|
14
|
+
//# sourceMappingURL=RadioButton.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export const doc = {
|
|
2
|
+
name: 'RadioButton',
|
|
3
|
+
purpose: 'A single radio input — the same option unit RadioGroup renders per choice, exposed standalone.',
|
|
4
|
+
contract: 'contracts/components/RadioButton.json',
|
|
5
|
+
a11y: [
|
|
6
|
+
'A real `<input type="radio">` — group it with siblings by giving them the same `name` for native arrow-key/mutual-exclusivity behavior.',
|
|
7
|
+
'Prefer RadioGroup for an actual set of options — it wraps the same anatomy in a `<fieldset>`/`<legend>` for free. Reach for RadioButton only when you need one radio outside that structure.',
|
|
8
|
+
],
|
|
9
|
+
variants: [],
|
|
10
|
+
sizes: [],
|
|
11
|
+
tokens: [
|
|
12
|
+
{ part: 'radio-control', label: 'Default fill', token: '--helix-radio-fill-default', kind: 'color' },
|
|
13
|
+
{ part: 'radio-control', label: 'Checked fill', token: '--helix-radio-fill-checked', kind: 'color' },
|
|
14
|
+
{ part: 'radio-control', label: 'Default border', token: '--helix-radio-border-default', kind: 'color' },
|
|
15
|
+
{ part: 'radio-control', label: 'Checked border', token: '--helix-radio-border-checked', kind: 'color' },
|
|
16
|
+
{ part: 'radio-control', label: 'Focus border', token: '--helix-radio-border-focus', kind: 'color' },
|
|
17
|
+
{ part: 'radio-control', label: 'Invalid border', token: '--helix-radio-border-invalid', kind: 'color' },
|
|
18
|
+
{ part: 'radio-dot', label: 'Selected dot color', token: '--helix-radio-dot', kind: 'color' },
|
|
19
|
+
],
|
|
20
|
+
features: [
|
|
21
|
+
'label — visible label',
|
|
22
|
+
'name — shared with sibling RadioButtons for native mutual exclusivity; auto-generated (ungrouped) if omitted',
|
|
23
|
+
'checked / defaultChecked / onChange — controlled or uncontrolled, same pattern as Switch',
|
|
24
|
+
'description — helper text under the label',
|
|
25
|
+
'invalid / disabled / required',
|
|
26
|
+
],
|
|
27
|
+
examples: [
|
|
28
|
+
{ label: 'Basic', code: `<RadioButton label="Free" name="plan" value="free" defaultChecked />` },
|
|
29
|
+
{
|
|
30
|
+
label: 'Grouped by name',
|
|
31
|
+
code: `<RadioButton label="Free" name="plan" value="free" />\n<RadioButton label="Pro" name="plan" value="pro" />`,
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=RadioButton.doc.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { cn } from '../../lib/utils.js';
|
|
4
|
+
let idCounter = 0;
|
|
5
|
+
const RadioButton = ({ label, name: nameProp, value, checked, defaultChecked = false, onChange, description, errorMessage, invalid = false, disabled = false, required = false, className, }) => {
|
|
6
|
+
const uid = `helix-radio-button-${++idCounter}`;
|
|
7
|
+
const name = nameProp ?? uid;
|
|
8
|
+
const descId = description ? `${uid}-desc` : undefined;
|
|
9
|
+
const errId = errorMessage ? `${uid}-err` : undefined;
|
|
10
|
+
const describedby = [descId, errId].filter(Boolean).join(' ') || undefined;
|
|
11
|
+
return (_jsxs("label", { "data-helix-part": "radio-item", htmlFor: uid, className: cn(className), ...(disabled ? { 'data-disabled': '' } : {}), ...(invalid ? { 'data-invalid': '' } : {}), children: [_jsx("input", { id: uid, type: "radio", name: name, value: value, checked: checked, defaultChecked: checked === undefined ? defaultChecked : undefined, disabled: disabled, required: required, "aria-invalid": invalid || undefined, "aria-describedby": describedby, "data-helix-part": "radio-input", onChange: (event) => onChange?.(event.currentTarget.checked) }), _jsx("span", { "data-helix-part": "radio-control", "aria-hidden": "true", children: _jsx("span", { "data-helix-part": "radio-dot" }) }), _jsxs("span", { "data-helix-part": "radio-item-content", children: [_jsxs("span", { "data-helix-part": "radio-item-label", children: [label, required && _jsx("span", { "data-helix-part": "radio-item-required", "aria-hidden": "true", children: "*" })] }), description && !errorMessage && (_jsx("span", { id: descId, "data-helix-part": "radio-item-description", children: description })), errorMessage && (_jsx("span", { id: errId, "data-helix-part": "radio-item-error", role: "alert", children: errorMessage }))] })] }));
|
|
12
|
+
};
|
|
13
|
+
RadioButton.displayName = 'RadioButton';
|
|
14
|
+
export { RadioButton };
|
|
15
|
+
//# sourceMappingURL=RadioButton.js.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @helixds/react — agent note
|
|
3
|
+
* Before using RadioButton, read its contract: node_modules/@helixds/react/dist/contracts/RadioButton.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 RadioButtonProps {
|
|
8
|
+
/** Visible label. */
|
|
9
|
+
label: string;
|
|
10
|
+
/** Native radio group name, shared with any sibling RadioButtons it should be mutually exclusive with. Auto-generated (unique to this instance) if omitted — meaning it won't group with anything unless set explicitly. */
|
|
11
|
+
name?: string;
|
|
12
|
+
/** Native radio value, read from the form on submit. Defaults to the native 'on' if omitted. */
|
|
13
|
+
value?: string;
|
|
14
|
+
/** Controlled checked state. */
|
|
15
|
+
checked?: boolean;
|
|
16
|
+
/** Uncontrolled initial checked state. Default: false */
|
|
17
|
+
defaultChecked?: boolean;
|
|
18
|
+
/** Change handler. */
|
|
19
|
+
onChange?: (checked: boolean) => void;
|
|
20
|
+
/** Helper text shown under the label. Not shown when `errorMessage` is also set. */
|
|
21
|
+
description?: string;
|
|
22
|
+
/** Error text shown under the label when `invalid` is true — takes over from `description`. */
|
|
23
|
+
errorMessage?: string;
|
|
24
|
+
/** Shows error styling. Default: false */
|
|
25
|
+
invalid?: boolean;
|
|
26
|
+
/** Disables the input. Default: false */
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
/** Marks the input as required. Default: false */
|
|
29
|
+
required?: boolean;
|
|
30
|
+
/** Additional className for the root. */
|
|
31
|
+
className?: string;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=RadioButton.types.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @helixds/react — agent note
|
|
3
|
+
* Before using RadioButton, read its contract: node_modules/@helixds/react/dist/contracts/RadioButton.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 { RadioButton } from './RadioButton.js';
|
|
8
|
+
export type { RadioButtonProps } from './RadioButton.types.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @helixds/react — agent note
|
|
3
|
+
* Before using RadioGroup, read its contract: node_modules/@helixds/react/dist/contracts/RadioGroup.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 { RadioGroupProps } from './RadioGroup.types.js';
|
|
8
|
+
export declare function RadioGroup({ label, options, value, defaultValue, onChange, orientation, description, errorMessage, invalid, disabled, required, name: nameProp, }: RadioGroupProps): import("react").JSX.Element;
|
|
9
|
+
export declare namespace RadioGroup {
|
|
10
|
+
var displayName: string;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=RadioGroup.d.ts.map
|