@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,64 @@
|
|
|
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 { Icon } from '../Icon/index.js';
|
|
6
|
+
import { SPRING_SNAPPY } from '../../lib/motionPresets.js';
|
|
7
|
+
let idCounter = 0;
|
|
8
|
+
export function SegmentedControl({ label, options, value, defaultValue, onChange, disabled = false, name: nameProp, className, }) {
|
|
9
|
+
// One layoutId per instance — otherwise two SegmentedControls on the same page would share Motion's
|
|
10
|
+
// FLIP animation and the pill would jump between them instead of staying scoped to its own group.
|
|
11
|
+
const uid = React.useRef(`helix-segmented-control-${++idCounter}`).current;
|
|
12
|
+
const layoutId = `${uid}-pill`;
|
|
13
|
+
const name = nameProp ?? uid;
|
|
14
|
+
const isControlled = value !== undefined;
|
|
15
|
+
const [internalValue, setInternalValue] = React.useState(defaultValue ?? options[0]?.value);
|
|
16
|
+
const current = isControlled ? value : internalValue;
|
|
17
|
+
const itemRefs = React.useRef(new Map());
|
|
18
|
+
const select = (optionValue) => {
|
|
19
|
+
if (!isControlled)
|
|
20
|
+
setInternalValue(optionValue);
|
|
21
|
+
onChange?.(optionValue);
|
|
22
|
+
};
|
|
23
|
+
// Roving tabindex + arrow-key navigation, hand-rolled — these are buttons, not native radio inputs,
|
|
24
|
+
// so the browser doesn't give this behavior away for free the way it does for RadioGroup (the SegmentedControl contract).
|
|
25
|
+
const handleKeyDown = (e, index) => {
|
|
26
|
+
const enabled = options.filter(o => !(o.disabled || disabled));
|
|
27
|
+
if (enabled.length === 0)
|
|
28
|
+
return;
|
|
29
|
+
const currentEnabledIndex = enabled.findIndex(o => o.value === options[index].value);
|
|
30
|
+
let nextIndex = -1;
|
|
31
|
+
if (e.key === 'ArrowRight' || e.key === 'ArrowDown') {
|
|
32
|
+
nextIndex = (currentEnabledIndex + 1) % enabled.length;
|
|
33
|
+
}
|
|
34
|
+
else if (e.key === 'ArrowLeft' || e.key === 'ArrowUp') {
|
|
35
|
+
nextIndex = (currentEnabledIndex - 1 + enabled.length) % enabled.length;
|
|
36
|
+
}
|
|
37
|
+
else if (e.key === 'Home') {
|
|
38
|
+
nextIndex = 0;
|
|
39
|
+
}
|
|
40
|
+
else if (e.key === 'End') {
|
|
41
|
+
nextIndex = enabled.length - 1;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
e.preventDefault();
|
|
47
|
+
const next = enabled[nextIndex];
|
|
48
|
+
select(next.value);
|
|
49
|
+
itemRefs.current.get(next.value)?.focus();
|
|
50
|
+
};
|
|
51
|
+
// MotionConfig scoped locally — Motion doesn't honor prefers-reduced-motion on its own (ADR-007).
|
|
52
|
+
return (_jsx(MotionConfig, { reducedMotion: "user", children: _jsxs("div", { "data-helix-part": "segmented-control-root", role: "radiogroup", "aria-label": label, ...(disabled ? { 'data-disabled': '' } : {}), className: cn(className), children: [_jsx("input", { type: "hidden", name: name, value: current ?? '' }), options.map((opt, index) => {
|
|
53
|
+
const isChecked = opt.value === current;
|
|
54
|
+
const isDisabled = opt.disabled || disabled;
|
|
55
|
+
return (_jsxs("button", { ref: el => {
|
|
56
|
+
if (el)
|
|
57
|
+
itemRefs.current.set(opt.value, el);
|
|
58
|
+
else
|
|
59
|
+
itemRefs.current.delete(opt.value);
|
|
60
|
+
}, type: "button", role: "radio", "aria-checked": isChecked, tabIndex: isChecked ? 0 : -1, disabled: isDisabled, "data-helix-part": "segmented-control-item", ...(opt.icon ? { 'data-icon-only': '' } : {}), onClick: () => select(opt.value), onKeyDown: e => handleKeyDown(e, index), children: [isChecked && (_jsx(motion.span, { "data-helix-part": "segmented-control-pill", layoutId: layoutId, "aria-hidden": "true", transition: SPRING_SNAPPY })), opt.icon && (_jsx("span", { "data-helix-part": "segmented-control-item-icon", children: _jsx(Icon, { icon: opt.icon, size: 16 }) })), _jsx("span", { "data-helix-part": "segmented-control-item-label", children: opt.label })] }, opt.value));
|
|
61
|
+
})] }) }));
|
|
62
|
+
}
|
|
63
|
+
SegmentedControl.displayName = 'SegmentedControl';
|
|
64
|
+
//# sourceMappingURL=SegmentedControl.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @helixds/react — agent note
|
|
3
|
+
* Before using SegmentedControl, read its contract: node_modules/@helixds/react/dist/contracts/SegmentedControl.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 SegmentedControlOption {
|
|
9
|
+
value: string;
|
|
10
|
+
/** Always required: the visible text — or, with `icon`, the option's accessible name. */
|
|
11
|
+
label: string;
|
|
12
|
+
/** Makes the option icon-only: the Tabler icon component (not an element), rendered through Icon. */
|
|
13
|
+
icon?: HelixIconComponent;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface SegmentedControlProps {
|
|
17
|
+
label: string;
|
|
18
|
+
options: SegmentedControlOption[];
|
|
19
|
+
value?: string;
|
|
20
|
+
defaultValue?: string;
|
|
21
|
+
onChange?: (value: string) => void;
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
name?: string;
|
|
24
|
+
className?: string;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=SegmentedControl.types.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @helixds/react — agent note
|
|
3
|
+
* Before using SegmentedControl, read its contract: node_modules/@helixds/react/dist/contracts/SegmentedControl.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 { SegmentedControl } from './SegmentedControl.js';
|
|
8
|
+
export type { SegmentedControlProps, SegmentedControlOption } from './SegmentedControl.types.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @helixds/react — agent note
|
|
3
|
+
* Before using Select, read its contract: node_modules/@helixds/react/dist/contracts/Select.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 { SelectProps } from './Select.types.js';
|
|
9
|
+
export declare function Select({ label, options, value, defaultValue, onChange, placeholder, description, errorMessage, invalid, disabled, required, fullWidth, hideLabel, id: idProp, name, className, }: SelectProps): React.JSX.Element;
|
|
10
|
+
export declare namespace Select {
|
|
11
|
+
var displayName: string;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=Select.d.ts.map
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export const doc = {
|
|
2
|
+
name: 'Select',
|
|
3
|
+
purpose: 'Lets users choose a single value from a predefined list.',
|
|
4
|
+
contract: 'contracts/components/Select.json',
|
|
5
|
+
a11y: [
|
|
6
|
+
'The `label` prop is required. Use `placeholder` as a prompt, not as the selected value.',
|
|
7
|
+
'The trigger is a real `<button>`, not a native `<select>` — the dropdown is Helix\'s own `Menu` primitive (the Menu contract), keeping real DOM focus on the button and driving the popup via `aria-haspopup`/`aria-expanded`/`aria-controls`/`aria-activedescendant`.',
|
|
8
|
+
'Keyboard nav (Arrow Up/Down, Home/End, Enter/Space, Escape) is hand-rolled on the trigger, not native — see the contract\'s own keyboardNav list.',
|
|
9
|
+
],
|
|
10
|
+
variants: [],
|
|
11
|
+
sizes: [],
|
|
12
|
+
tokens: [
|
|
13
|
+
{ part: 'select-trigger', label: 'Default fill', token: '--helix-select-fill-default', kind: 'color' },
|
|
14
|
+
{ part: 'select-trigger', label: 'Default border', token: '--helix-select-border-default', kind: 'color' },
|
|
15
|
+
{ part: 'select-trigger', label: 'Default border', token: '--helix-select-border-hover', kind: 'color', state: 'hover' },
|
|
16
|
+
{ part: 'select-trigger', label: 'Focus border', token: '--helix-select-border-focus', kind: 'color' },
|
|
17
|
+
{ part: 'select-trigger', label: 'Disabled fill', token: '--helix-select-fill-disabled', kind: 'color', state: 'disabled' },
|
|
18
|
+
{ part: 'select-trigger', label: 'Disabled border', token: '--helix-select-border-disabled', kind: 'color', state: 'disabled' },
|
|
19
|
+
{ part: 'select-trigger', label: 'Disabled text', token: '--helix-select-text-disabled', kind: 'color', state: 'disabled' },
|
|
20
|
+
{ part: 'select-trigger', label: 'Value text', token: '--helix-select-text-value', kind: 'color' },
|
|
21
|
+
{ part: 'select-trigger', label: 'Placeholder text', token: '--helix-select-text-placeholder', kind: 'color' },
|
|
22
|
+
{ part: 'select-root', label: 'gap', token: '--helix-select-gap', kind: 'space', axis: 'vertical', meta: '8px, label↔trigger and trigger↔description/error alike — see .ai/maps/patterns/form-field-spacing.md' },
|
|
23
|
+
{ part: 'select-label', label: 'label', token: '--helix-select-text-labelFontSize', kind: 'typography', meta: 'body-m-medium, 14px' },
|
|
24
|
+
{ part: 'select-label', label: 'label.weight', token: '--helix-select-text-labelFontWeight', kind: 'typography' },
|
|
25
|
+
{ part: 'select-trigger', label: 'value', token: '--helix-select-text-valueFontSize', kind: 'typography', meta: 'body-m-regular, 14px' },
|
|
26
|
+
{ part: 'select-description', label: 'description', token: '--helix-select-text-descriptionFontSize', kind: 'typography', meta: 'body-s-regular, 12px' },
|
|
27
|
+
{ part: 'select-error', label: 'error', token: '--helix-select-text-errorFontSize', kind: 'typography', meta: 'body-s-regular, 12px' },
|
|
28
|
+
{ part: 'select-trigger', label: 'field.height', token: '--helix-select-height', kind: 'space', meta: 'One fixed size (semantic.size.m, 32px) — no size prop, matches Menu item height and Input/Textarea\'s own "m"' },
|
|
29
|
+
{ part: 'select-chevron', label: 'padding.end', token: '--helix-primitive-spacing-75', kind: 'space', axis: 'horizontal', meta: 'Chevron to trigger edge' },
|
|
30
|
+
{ part: 'select-trigger', label: 'select.root', token: '--helix-select-radius', kind: 'radius' },
|
|
31
|
+
{ part: 'select-root', label: 'display', value: 'flex' },
|
|
32
|
+
{ part: 'select-root', label: 'flex-direction', value: 'column' },
|
|
33
|
+
{ part: 'select-root', label: 'width', value: 'fit-content' },
|
|
34
|
+
{ part: 'select-wrapper', label: 'position.wrapper', value: 'relative' },
|
|
35
|
+
{ part: 'select-wrapper', label: 'display.wrapper', value: 'flex' },
|
|
36
|
+
{ part: 'select-trigger', label: 'appearance', value: 'none' },
|
|
37
|
+
{ part: 'select-trigger', label: '-webkit-appearance', value: 'none' },
|
|
38
|
+
{ part: 'select-trigger', label: 'cursor', value: 'pointer' },
|
|
39
|
+
{ part: 'select-trigger', label: 'outline', value: 'none' },
|
|
40
|
+
{ part: 'select-trigger', label: 'cursor.disabled', value: 'not-allowed' },
|
|
41
|
+
{ part: 'select-trigger-label', label: 'overflow', value: 'hidden, ellipsis, nowrap', meta: 'Truncates a label that doesn\'t fit a fixed-width trigger instead of overflowing or growing the box' },
|
|
42
|
+
{ part: 'select-chevron', label: 'pointer-events', value: 'none' },
|
|
43
|
+
{ part: 'select-chevron', label: 'display.chevron', value: 'flex' },
|
|
44
|
+
{ part: 'select-chevron', label: 'position.chevron', value: 'absolute' },
|
|
45
|
+
{ part: 'select-chevron', label: 'top.chevron', value: '50%' },
|
|
46
|
+
{ part: 'select-chevron', label: 'flip.duration', token: '--helix-select-duration-chevron', kind: 'space', meta: 'Same expand-collapse-chevron pattern as Accordion' },
|
|
47
|
+
{ part: 'select-chevron', label: 'flip.easing', token: '--helix-select-easing', kind: 'space' },
|
|
48
|
+
{ part: 'select-chevron', label: 'flip.easing.collapse', token: '--helix-select-easing-collapse', kind: 'space' },
|
|
49
|
+
],
|
|
50
|
+
features: [
|
|
51
|
+
'Button trigger + Helix-styled Menu popup (the Menu contract) — no native OS dropdown chrome, matches Helix\'s own visual language',
|
|
52
|
+
'One fixed size, deliberately — no size prop. 32px (semantic.size.m), the same height Menu items and Input/Textarea\'s own default use, so nothing needs picking.',
|
|
53
|
+
'fullWidth — stretches to container width',
|
|
54
|
+
'labelEnd on an option — short secondary text (a value, count or percentage) on the end edge of that option in the list; the trigger shows only the label',
|
|
55
|
+
'className — set a fixed width so the trigger never visibly resizes as a shorter/longer option is selected (it truncates with an ellipsis instead of growing)',
|
|
56
|
+
'placeholder option — optional prompt before selection',
|
|
57
|
+
'option groups — supports grouped option sets',
|
|
58
|
+
'Chevron flips on open, same treatment as Accordion (.ai/maps/patterns/expand-collapse-chevron.md) — now real, driven by the trigger\'s own aria-expanded',
|
|
59
|
+
],
|
|
60
|
+
examples: [
|
|
61
|
+
{ label: 'Default', code: `<Select label="Status" options={options} />` },
|
|
62
|
+
{ label: 'With placeholder', code: `<Select label="Country" placeholder="Choose a country" options={options} />` },
|
|
63
|
+
{ label: 'Invalid', code: `<Select label="Role" invalid errorMessage="Pick a role" options={options} />` },
|
|
64
|
+
],
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=Select.doc.js.map
|
|
@@ -0,0 +1,138 @@
|
|
|
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 { Menu, optionId } from '../Menu/index.js';
|
|
7
|
+
let idCounter = 0;
|
|
8
|
+
function isGroup(opt) {
|
|
9
|
+
return 'options' in opt;
|
|
10
|
+
}
|
|
11
|
+
function flattenOptions(options) {
|
|
12
|
+
return options.flatMap(opt => (isGroup(opt) ? opt.options : [opt]));
|
|
13
|
+
}
|
|
14
|
+
export function Select({ label, options, value, defaultValue, onChange, placeholder, description, errorMessage, invalid = false, disabled = false, required = false, fullWidth = false, hideLabel = false, id: idProp, name, className, }) {
|
|
15
|
+
const uid = React.useRef(`helix-select-${++idCounter}`).current;
|
|
16
|
+
const id = idProp ?? uid;
|
|
17
|
+
const menuId = `${id}-menu`;
|
|
18
|
+
const descId = description && !invalid ? `${id}-desc` : undefined;
|
|
19
|
+
const errId = invalid && errorMessage ? `${id}-err` : undefined;
|
|
20
|
+
const describedby = [descId, errId].filter(Boolean).join(' ') || undefined;
|
|
21
|
+
const isControlled = value !== undefined;
|
|
22
|
+
const [internalValue, setInternalValue] = React.useState(defaultValue);
|
|
23
|
+
const current = isControlled ? value : internalValue;
|
|
24
|
+
const [open, setOpen] = React.useState(false);
|
|
25
|
+
const [activeValue, setActiveValue] = React.useState(current);
|
|
26
|
+
const triggerRef = React.useRef(null);
|
|
27
|
+
const flatOptions = React.useMemo(() => flattenOptions(options), [options]);
|
|
28
|
+
const selectedOption = flatOptions.find(o => o.value === current);
|
|
29
|
+
const commit = (next) => {
|
|
30
|
+
if (!isControlled)
|
|
31
|
+
setInternalValue(next);
|
|
32
|
+
onChange?.(next);
|
|
33
|
+
setOpen(false);
|
|
34
|
+
triggerRef.current?.focus();
|
|
35
|
+
};
|
|
36
|
+
// A pointer open highlights only the selected option (if any), never a fallback first option — the
|
|
37
|
+
// gray keyboard highlight on an option the pointer isn't on reads as a stray hover.
|
|
38
|
+
const openMenu = (initialActive, via = 'keyboard') => {
|
|
39
|
+
if (disabled)
|
|
40
|
+
return;
|
|
41
|
+
// Highlight the selected option if it's a real, enabled one — not just `current ?? first`: a
|
|
42
|
+
// controlled "nothing selected" value of '' isn't nullish, and would open with no highlight at all.
|
|
43
|
+
const selected = flatOptions.find(o => o.value === current && !o.disabled)?.value;
|
|
44
|
+
setActiveValue(initialActive ?? selected ?? (via === 'keyboard' ? flatOptions.find(o => !o.disabled)?.value : undefined));
|
|
45
|
+
setOpen(true);
|
|
46
|
+
};
|
|
47
|
+
const closeMenu = () => setOpen(false);
|
|
48
|
+
const moveActive = (dir) => {
|
|
49
|
+
const enabled = flatOptions.filter(o => !o.disabled);
|
|
50
|
+
if (enabled.length === 0)
|
|
51
|
+
return;
|
|
52
|
+
const currentIndex = enabled.findIndex(o => o.value === activeValue);
|
|
53
|
+
const nextIndex = currentIndex === -1
|
|
54
|
+
? (dir === 1 ? 0 : enabled.length - 1)
|
|
55
|
+
: (currentIndex + dir + enabled.length) % enabled.length;
|
|
56
|
+
setActiveValue(enabled[nextIndex].value);
|
|
57
|
+
};
|
|
58
|
+
// Hand-rolled roving keyboard nav on the trigger — Menu itself is deliberately non-focusable
|
|
59
|
+
// (real DOM focus stays on this button throughout, aria-activedescendant tracks the highlighted
|
|
60
|
+
// option), the same interaction model a native <select> gives away for free. See the Menu contract.
|
|
61
|
+
const handleTriggerKeyDown = (e) => {
|
|
62
|
+
if (disabled)
|
|
63
|
+
return;
|
|
64
|
+
switch (e.key) {
|
|
65
|
+
case 'ArrowDown':
|
|
66
|
+
e.preventDefault();
|
|
67
|
+
open ? moveActive(1) : openMenu();
|
|
68
|
+
break;
|
|
69
|
+
case 'ArrowUp':
|
|
70
|
+
e.preventDefault();
|
|
71
|
+
open ? moveActive(-1) : openMenu();
|
|
72
|
+
break;
|
|
73
|
+
case 'Home': {
|
|
74
|
+
if (!open)
|
|
75
|
+
break;
|
|
76
|
+
e.preventDefault();
|
|
77
|
+
const enabled = flatOptions.filter(o => !o.disabled);
|
|
78
|
+
if (enabled[0])
|
|
79
|
+
setActiveValue(enabled[0].value);
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
case 'End': {
|
|
83
|
+
if (!open)
|
|
84
|
+
break;
|
|
85
|
+
e.preventDefault();
|
|
86
|
+
const enabled = flatOptions.filter(o => !o.disabled);
|
|
87
|
+
if (enabled.length)
|
|
88
|
+
setActiveValue(enabled[enabled.length - 1].value);
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
case 'Enter':
|
|
92
|
+
case ' ':
|
|
93
|
+
e.preventDefault();
|
|
94
|
+
if (open) {
|
|
95
|
+
if (activeValue)
|
|
96
|
+
commit(activeValue);
|
|
97
|
+
}
|
|
98
|
+
else
|
|
99
|
+
openMenu();
|
|
100
|
+
break;
|
|
101
|
+
case 'Escape':
|
|
102
|
+
if (open) {
|
|
103
|
+
e.preventDefault();
|
|
104
|
+
closeMenu();
|
|
105
|
+
}
|
|
106
|
+
break;
|
|
107
|
+
case 'Tab':
|
|
108
|
+
// Close first, then let focus move on as usual (no preventDefault) — contract a11y.keyboardNav.
|
|
109
|
+
if (open)
|
|
110
|
+
closeMenu();
|
|
111
|
+
break;
|
|
112
|
+
default:
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
// Click-outside — closes when a pointer lands outside both the trigger and the portaled menu.
|
|
117
|
+
React.useEffect(() => {
|
|
118
|
+
if (!open)
|
|
119
|
+
return;
|
|
120
|
+
const handlePointerDown = (e) => {
|
|
121
|
+
const target = e.target;
|
|
122
|
+
if (triggerRef.current?.contains(target))
|
|
123
|
+
return;
|
|
124
|
+
if (document.getElementById(menuId)?.contains(target))
|
|
125
|
+
return;
|
|
126
|
+
setOpen(false);
|
|
127
|
+
};
|
|
128
|
+
document.addEventListener('pointerdown', handlePointerDown);
|
|
129
|
+
return () => document.removeEventListener('pointerdown', handlePointerDown);
|
|
130
|
+
}, [open, menuId]);
|
|
131
|
+
return (_jsxs("div", { "data-helix-part": "select-root", ...(fullWidth ? { 'data-full-width': '' } : {}), ...(disabled ? { 'data-disabled': '' } : {}), ...(invalid ? { 'data-invalid': '' } : {}), className: cn(className), children: [_jsxs("label", { "data-helix-part": "select-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": "select-required", "aria-hidden": "true", children: " *" })] }), _jsxs("div", { "data-helix-part": "select-wrapper", ...(disabled ? { 'data-disabled': '' } : {}), ...(invalid ? { 'data-invalid': '' } : {}), children: [_jsx("button", { ref: triggerRef, type: "button", id: id, "data-helix-part": "select-trigger", ...(!selectedOption ? { 'data-placeholder': '' } : {}), disabled: disabled,
|
|
132
|
+
// role="combobox" — the WAI-ARIA select-only combobox pattern. A plain button role doesn't
|
|
133
|
+
// allow aria-required or aria-activedescendant (axe aria-allowed-attr); combobox allows both
|
|
134
|
+
// and is a permitted role on <button> (ARIA in HTML).
|
|
135
|
+
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(undefined, 'pointer')), onKeyDown: handleTriggerKeyDown, children: _jsx("span", { "data-helix-part": "select-trigger-label", children: selectedOption?.label ?? placeholder ?? '' }) }), _jsx("span", { "data-helix-part": "select-chevron", "aria-hidden": "true", children: _jsx(Icon, { icon: IconChevronDown, size: 16 }) }), _jsx(Menu, { id: menuId, expanded: open, anchorRef: triggerRef, options: options, onSelect: commit, ...(current !== undefined ? { value: current } : {}), ...(activeValue !== undefined ? { activeValue } : {}) }), (name || required) && (_jsx("input", { "data-helix-part": "select-native", type: "text", tabIndex: -1, "aria-hidden": "true", name: name, value: current ?? '', required: required, disabled: disabled, onChange: () => { }, onFocus: () => triggerRef.current?.focus() }))] }), description && !invalid && (_jsx("span", { id: descId, "data-helix-part": "select-description", children: description })), invalid && errorMessage && (_jsx("span", { id: errId, "data-helix-part": "select-error", role: "alert", children: errorMessage }))] }));
|
|
136
|
+
}
|
|
137
|
+
Select.displayName = 'Select';
|
|
138
|
+
//# sourceMappingURL=Select.js.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @helixds/react — agent note
|
|
3
|
+
* Before using Select, read its contract: node_modules/@helixds/react/dist/contracts/Select.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 SelectOption {
|
|
8
|
+
value: string;
|
|
9
|
+
label: string;
|
|
10
|
+
/** Short secondary text aligned to the end of the option in the list — a value, count or percentage. */
|
|
11
|
+
labelEnd?: string;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface SelectOptionGroup {
|
|
15
|
+
label: string;
|
|
16
|
+
options: SelectOption[];
|
|
17
|
+
}
|
|
18
|
+
export interface SelectProps {
|
|
19
|
+
label: string;
|
|
20
|
+
options: (SelectOption | SelectOptionGroup)[];
|
|
21
|
+
value?: string;
|
|
22
|
+
defaultValue?: string;
|
|
23
|
+
onChange?: (value: string) => void;
|
|
24
|
+
placeholder?: string;
|
|
25
|
+
description?: string;
|
|
26
|
+
errorMessage?: string;
|
|
27
|
+
invalid?: boolean;
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
required?: boolean;
|
|
30
|
+
fullWidth?: boolean;
|
|
31
|
+
hideLabel?: boolean;
|
|
32
|
+
id?: string;
|
|
33
|
+
name?: string;
|
|
34
|
+
className?: string;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=Select.types.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @helixds/react — agent note
|
|
3
|
+
* Before using Select, read its contract: node_modules/@helixds/react/dist/contracts/Select.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 { Select } from './Select.js';
|
|
8
|
+
export type { SelectProps, SelectOption, SelectOptionGroup } from './Select.types.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @helixds/react — agent note
|
|
3
|
+
* Before using SidePanel, read its contract: node_modules/@helixds/react/dist/contracts/SidePanel.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 { SidePanelProps } from './SidePanel.types.js';
|
|
9
|
+
declare const SidePanel: {
|
|
10
|
+
({ label, children, expanded, onDismiss, showCloseButton, closeOnBackdropClick, placement, className, }: SidePanelProps): React.JSX.Element;
|
|
11
|
+
displayName: string;
|
|
12
|
+
};
|
|
13
|
+
export { SidePanel };
|
|
14
|
+
//# sourceMappingURL=SidePanel.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export const doc = {
|
|
2
|
+
name: 'SidePanel',
|
|
3
|
+
purpose: 'A modal panel anchored to the right edge of the viewport, for a persistent secondary task alongside the main page.',
|
|
4
|
+
contract: 'contracts/components/SidePanel.json',
|
|
5
|
+
a11y: [
|
|
6
|
+
'Same native <dialog> + showModal() primitive as Modal — focus trap, Escape-to-close, top-layer stacking (see the Modal contract). No backdrop scrim, unlike Modal — the page behind stays visible.',
|
|
7
|
+
'The title is referenced via aria-labelledby, giving the panel its accessible name.',
|
|
8
|
+
'SidePanel never closes itself — it always calls onDismiss and expects the consumer to set expanded to false.',
|
|
9
|
+
],
|
|
10
|
+
variants: [],
|
|
11
|
+
sizes: [],
|
|
12
|
+
tokens: [
|
|
13
|
+
{ part: 'side-panel-root', label: 'fill', token: '--helix-sidePanel-fill', kind: 'color' },
|
|
14
|
+
{ part: 'side-panel-root', label: 'shadow (placement=right)', token: '--helix-sidePanel-shadow', kind: 'shadow' },
|
|
15
|
+
{ part: 'side-panel-root', label: 'shadow (placement=bottom)', token: '--helix-sidePanel-shadowBottom', kind: 'shadow' },
|
|
16
|
+
{ part: 'side-panel-root', label: 'width', token: '--helix-sidePanel-width', kind: 'space' },
|
|
17
|
+
],
|
|
18
|
+
features: [
|
|
19
|
+
'label — the panel\'s title / accessible name',
|
|
20
|
+
'expanded / onDismiss — always controlled, no uncontrolled form',
|
|
21
|
+
'showCloseButton — toggles the header\'s X button',
|
|
22
|
+
'closeOnBackdropClick — toggles dismissal on a click outside the panel',
|
|
23
|
+
'placement — \'right\' (default, full height) or \'bottom\' (full width) — same vocabulary as Tooltip\'s placement prop',
|
|
24
|
+
],
|
|
25
|
+
examples: [
|
|
26
|
+
{ label: 'Basic', code: `<SidePanel label="Edit filters" expanded={isOpen} onDismiss={() => setIsOpen(false)}>...</SidePanel>` },
|
|
27
|
+
],
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=SidePanel.doc.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { IconX } from '@tabler/icons-react';
|
|
4
|
+
import { cn } from '../../lib/utils.js';
|
|
5
|
+
import { IconButton } from '../IconButton/index.js';
|
|
6
|
+
import { useDialogTransition } from '../../lib/useDialogTransition.js';
|
|
7
|
+
let idCounter = 0;
|
|
8
|
+
const SidePanel = ({ label, children, expanded, onDismiss, showCloseButton = true, closeOnBackdropClick = true, placement = 'right', className, }) => {
|
|
9
|
+
const titleId = `helix-sidePanel-title-${++idCounter}`;
|
|
10
|
+
const { ref, state } = useDialogTransition(expanded, '--helix-sidePanel-duration-close', onDismiss, closeOnBackdropClick);
|
|
11
|
+
return (_jsxs("dialog", { ref: ref, "data-helix-part": "side-panel-root", "data-state": state, "data-placement": placement, "aria-labelledby": titleId, className: cn(className), children: [_jsx("div", { "data-helix-part": "side-panel-header", children: _jsx("h2", { "data-helix-part": "side-panel-title", id: titleId, children: label }) }), showCloseButton && (
|
|
12
|
+
// Wrapped, not passed data-helix-part directly — see Modal.tsx's identical comment: IconButton
|
|
13
|
+
// spreads ...props after its own hardcoded data-helix-part="icon-button", so passing the same
|
|
14
|
+
// prop name here would silently detach every IconButton CSS rule, hover included.
|
|
15
|
+
_jsx("span", { "data-helix-part": "side-panel-close", children: _jsx(IconButton, { icon: IconX, label: "Close", size: "l", variant: "ghost", onClick: onDismiss }) })), _jsx("div", { "data-helix-part": "side-panel-body", children: children })] }));
|
|
16
|
+
};
|
|
17
|
+
SidePanel.displayName = 'SidePanel';
|
|
18
|
+
export { SidePanel };
|
|
19
|
+
//# sourceMappingURL=SidePanel.js.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @helixds/react — agent note
|
|
3
|
+
* Before using SidePanel, read its contract: node_modules/@helixds/react/dist/contracts/SidePanel.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
|
+
/** Same vocabulary as Tooltip's `placement` — only the two edges that make sense for a full-height/full-width panel. */
|
|
9
|
+
export type SidePanelPlacement = 'right' | 'bottom';
|
|
10
|
+
export interface SidePanelProps {
|
|
11
|
+
/** Which edge of the viewport the panel is anchored to and slides from. Default: 'right' */
|
|
12
|
+
placement?: SidePanelPlacement;
|
|
13
|
+
/** The panel's title — rendered visibly and used as its accessible name. */
|
|
14
|
+
label: string;
|
|
15
|
+
/** The panel's body content. */
|
|
16
|
+
children: React.ReactNode;
|
|
17
|
+
/** Whether the panel is open. Always controlled — see the Modal contract. */
|
|
18
|
+
expanded: boolean;
|
|
19
|
+
/** Called when the panel should close (close button, Escape, or a backdrop click). SidePanel never closes itself — set `expanded` to false in response. */
|
|
20
|
+
onDismiss: () => void;
|
|
21
|
+
/** Whether to render the header's close (X) button. Default: true */
|
|
22
|
+
showCloseButton?: boolean;
|
|
23
|
+
/** Whether clicking outside the panel dismisses it. Default: true */
|
|
24
|
+
closeOnBackdropClick?: boolean;
|
|
25
|
+
/** Additional className for the root. */
|
|
26
|
+
className?: string;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=SidePanel.types.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @helixds/react — agent note
|
|
3
|
+
* Before using SidePanel, read its contract: node_modules/@helixds/react/dist/contracts/SidePanel.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 { SidePanel } from './SidePanel.js';
|
|
8
|
+
export type { SidePanelProps } from './SidePanel.types.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @helixds/react — agent note
|
|
3
|
+
* Before using Switch, read its contract: node_modules/@helixds/react/dist/contracts/Switch.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 { SwitchProps } from './Switch.types.js';
|
|
9
|
+
export declare function Switch({ label, hideLabel, description, checked, defaultChecked, onChange, disabled, size, id: idProp, name, }: SwitchProps): React.JSX.Element;
|
|
10
|
+
export declare namespace Switch {
|
|
11
|
+
var displayName: string;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=Switch.d.ts.map
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export const doc = {
|
|
2
|
+
name: 'Switch',
|
|
3
|
+
purpose: 'Toggles a single setting on or off immediately, with no separate save step.',
|
|
4
|
+
contract: 'contracts/components/Switch.json',
|
|
5
|
+
a11y: [
|
|
6
|
+
'Renders a real `role="switch"` button plus a visually-hidden native checkbox for form submission.',
|
|
7
|
+
'The `label` prop is required and is bound to the visible control via a real `<label htmlFor>`.',
|
|
8
|
+
'Toggling calls `onChange` immediately — Switch is for instant-effect settings, not for state that needs a separate Save action (use Checkbox for that).',
|
|
9
|
+
],
|
|
10
|
+
variants: [],
|
|
11
|
+
sizes: ['s', 'm'],
|
|
12
|
+
tokens: [
|
|
13
|
+
{ part: 'switch-track', label: 'Off fill', token: '--helix-switch-track-fill-off', kind: 'color' },
|
|
14
|
+
{ part: 'switch-track', label: 'On fill', token: '--helix-switch-track-fill-on', kind: 'color' },
|
|
15
|
+
{ part: 'switch-track', label: 'On fill', token: '--helix-switch-track-fill-on-hover', kind: 'color', state: 'hover', meta: 'Hover while on — off state has no dedicated hover token' },
|
|
16
|
+
{ part: 'switch-track', label: 'Disabled fill', token: '--helix-switch-track-fill-disabled', kind: 'color', state: 'disabled' },
|
|
17
|
+
{ part: 'switch-thumb', label: 'Thumb fill', token: '--helix-switch-thumb-fill', kind: 'color' },
|
|
18
|
+
{ part: 'switch-track', label: 'Focus outline', token: '--helix-switch-border-focus', kind: 'color' },
|
|
19
|
+
{ part: 'switch-label', label: 'Label text', token: '--helix-switch-text-label', kind: 'color' },
|
|
20
|
+
{ part: 'switch-description', label: 'Description text', token: '--helix-switch-text-description', kind: 'color' },
|
|
21
|
+
{ part: 'switch-label', label: 'label', token: '--helix-primitive-fontSize-s', kind: 'typography', meta: 'Body small' },
|
|
22
|
+
{ part: 'switch-description', label: 'description', token: '--helix-primitive-fontSize-s', kind: 'typography', meta: 'Body xsmall' },
|
|
23
|
+
{ part: 'switch-track', label: 'track.width.s', token: '--helix-switch-width-s', kind: 'space', axis: 'horizontal', size: 's', meta: 'The one width-typed sizing token — sizing defaults to vertical everywhere else' },
|
|
24
|
+
{ part: 'switch-track', label: 'track.width.m', token: '--helix-switch-width-m', kind: 'space', axis: 'horizontal', size: 'm' },
|
|
25
|
+
{ part: 'switch-track', label: 'track.height.s', token: '--helix-switch-height-s', kind: 'space', size: 's' },
|
|
26
|
+
{ part: 'switch-track', label: 'track.height.m', token: '--helix-switch-height-m', kind: 'space', size: 'm' },
|
|
27
|
+
{ part: 'switch-thumb', label: 'thumb.size.s', token: '--helix-switch-thumb-size-s', kind: 'space', size: 's' },
|
|
28
|
+
{ part: 'switch-thumb', label: 'thumb.size.m', token: '--helix-switch-thumb-size-m', kind: 'space', size: 'm' },
|
|
29
|
+
{ part: 'switch-row', label: 'gap.track.label', token: '--helix-primitive-spacing-75', kind: 'space', axis: 'horizontal' },
|
|
30
|
+
{ part: 'switch-root', label: 'gap.row.description', token: '--helix-primitive-spacing-25', kind: 'space', axis: 'vertical' },
|
|
31
|
+
{ part: 'switch-track', label: 'switch.track', token: '--helix-radius-full', kind: 'radius' },
|
|
32
|
+
{ part: 'switch-thumb', label: 'switch.thumb', value: '50%', kind: 'radius', meta: 'Always a full circle, independent of the track radius token' },
|
|
33
|
+
{ part: 'switch-root', label: 'display', value: 'flex' },
|
|
34
|
+
{ part: 'switch-root', label: 'flex-direction', value: 'column' },
|
|
35
|
+
{ part: 'switch-row', label: 'display', value: 'inline-flex' },
|
|
36
|
+
{ part: 'switch-row', label: 'align-items', value: 'center' },
|
|
37
|
+
{ part: 'switch-track', label: 'cursor', value: 'pointer' },
|
|
38
|
+
{ part: 'switch-track', label: 'cursor.disabled', value: 'not-allowed' },
|
|
39
|
+
],
|
|
40
|
+
features: [
|
|
41
|
+
'label — required accessible label',
|
|
42
|
+
'hideLabel — visually hides the label while keeping it as the accessible name',
|
|
43
|
+
'description — optional helper copy below the row',
|
|
44
|
+
'size — s or m track/thumb scale',
|
|
45
|
+
'checked / defaultChecked — controlled or uncontrolled boolean state',
|
|
46
|
+
'onChange fires immediately on toggle — no separate confirm step',
|
|
47
|
+
'Thumb slides via a Motion spring (ADR-007) instead of a flat CSS transition; internal only, no new prop',
|
|
48
|
+
],
|
|
49
|
+
examples: [
|
|
50
|
+
{ label: 'Default', code: `<Switch label="Enable notifications" />` },
|
|
51
|
+
{ label: 'With description', code: `<Switch label="Auto-save" description="Save changes as you type" />` },
|
|
52
|
+
{ label: 'Small', code: `<Switch label="Compact mode" size="s" />` },
|
|
53
|
+
{ label: 'Checked', code: `<Switch label="Dark mode" defaultChecked />` },
|
|
54
|
+
],
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=Switch.doc.js.map
|