@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,184 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import * as echarts from 'echarts/core';
|
|
4
|
+
import { BarChart, LineChart, PieChart } from 'echarts/charts';
|
|
5
|
+
import { GridComponent, LegendComponent, TooltipComponent } from 'echarts/components';
|
|
6
|
+
import { CanvasRenderer } from 'echarts/renderers';
|
|
7
|
+
import { cn } from '../../lib/utils.js';
|
|
8
|
+
echarts.use([BarChart, LineChart, PieChart, GridComponent, LegendComponent, TooltipComponent, CanvasRenderer]);
|
|
9
|
+
const token = (style, name) => style.getPropertyValue(name).trim();
|
|
10
|
+
// A duration token resolved to milliseconds ("700ms" or "0.7s").
|
|
11
|
+
const ms = (value) => (value.endsWith('ms') ? parseFloat(value) : parseFloat(value) * 1000) || 0;
|
|
12
|
+
// A cubic-bezier() easing token as a function — the canvas can't read CSS easings, ECharts takes a function.
|
|
13
|
+
const bezier = (css) => {
|
|
14
|
+
const points = (css.match(/-?[\d.]+/g) ?? []).map(Number);
|
|
15
|
+
if (points.length !== 4 || points.some(Number.isNaN))
|
|
16
|
+
return 'cubicOut';
|
|
17
|
+
const [x1, y1, x2, y2] = points;
|
|
18
|
+
const at = (a, b, t) => ((1 - 3 * b + 3 * a) * t + (3 * b - 6 * a)) * t * t + 3 * a * t;
|
|
19
|
+
const slope = (a, b, t) => 3 * (1 - 3 * b + 3 * a) * t * t + 2 * (3 * b - 6 * a) * t + 3 * a;
|
|
20
|
+
return (x) => {
|
|
21
|
+
let t = x;
|
|
22
|
+
for (let i = 0; i < 8; i++) {
|
|
23
|
+
const dx = at(x1, x2, t) - x;
|
|
24
|
+
const d = slope(x1, x2, t);
|
|
25
|
+
if (Math.abs(dx) < 1e-5 || !d)
|
|
26
|
+
break;
|
|
27
|
+
t -= dx / d;
|
|
28
|
+
}
|
|
29
|
+
return at(y1, y2, Math.min(1, Math.max(0, t)));
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
// The inverse of an easing: at what share of the time it reaches a given share of the way. Used to pop each
|
|
33
|
+
// line point in exactly when an eased line reveal reaches it.
|
|
34
|
+
const timeAt = (ease, progress) => {
|
|
35
|
+
let lo = 0, hi = 1;
|
|
36
|
+
for (let i = 0; i < 24; i++) {
|
|
37
|
+
const mid = (lo + hi) / 2;
|
|
38
|
+
if (ease(mid) < progress)
|
|
39
|
+
lo = mid;
|
|
40
|
+
else
|
|
41
|
+
hi = mid;
|
|
42
|
+
}
|
|
43
|
+
return (lo + hi) / 2;
|
|
44
|
+
};
|
|
45
|
+
// A hex color with an alpha, for the area gradient (the canvas reads plain color strings, not color-mix()).
|
|
46
|
+
const withAlpha = (hex, alpha) => {
|
|
47
|
+
const h = hex.replace('#', '');
|
|
48
|
+
const full = h.length === 3 ? h.split('').map(c => c + c).join('') : h;
|
|
49
|
+
const [r, g, b] = [0, 2, 4].map(i => parseInt(full.slice(i, i + 2), 16));
|
|
50
|
+
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
|
51
|
+
};
|
|
52
|
+
// The canvas can't follow CSS variables or media queries on its own — tokens are read once per render. Re-render
|
|
53
|
+
// whenever they can change: the data-theme/class attribute on <html>, the OS color scheme, or reduced motion.
|
|
54
|
+
const useThemeVersion = () => {
|
|
55
|
+
const [version, setVersion] = React.useState(0);
|
|
56
|
+
React.useEffect(() => {
|
|
57
|
+
const bump = () => setVersion(v => v + 1);
|
|
58
|
+
const observer = new MutationObserver(bump);
|
|
59
|
+
observer.observe(document.documentElement, { attributes: true, attributeFilter: ['data-theme', 'class'] });
|
|
60
|
+
const queries = ['(prefers-color-scheme: dark)', '(prefers-reduced-motion: reduce)'].map(q => window.matchMedia(q));
|
|
61
|
+
queries.forEach(q => q.addEventListener('change', bump));
|
|
62
|
+
return () => { observer.disconnect(); queries.forEach(q => q.removeEventListener('change', bump)); };
|
|
63
|
+
}, []);
|
|
64
|
+
return version;
|
|
65
|
+
};
|
|
66
|
+
const Chart = ({ variant, categories, series, label, description, height = 280, className }) => {
|
|
67
|
+
const root = React.useRef(null);
|
|
68
|
+
const instance = React.useRef(null);
|
|
69
|
+
const themeVersion = useThemeVersion();
|
|
70
|
+
// The legend is HTML, not the canvas's own: real buttons (hover, focus, aria-pressed) that show and hide
|
|
71
|
+
// a series. Its entries are the series — or the categories, for a donut. With one entry there's nothing
|
|
72
|
+
// to toggle, so it's a plain label.
|
|
73
|
+
const entries = variant === 'donut' ? categories : series.map(item => item.name);
|
|
74
|
+
const [hidden, setHidden] = React.useState(() => new Set());
|
|
75
|
+
const toggle = (name) => setHidden(current => { const next = new Set(current); if (next.has(name))
|
|
76
|
+
next.delete(name);
|
|
77
|
+
else
|
|
78
|
+
next.add(name); return next; });
|
|
79
|
+
const interactive = entries.length > 1;
|
|
80
|
+
// What was last drawn in: a new variant or new data draws in again from scratch; a legend toggle or a theme
|
|
81
|
+
// change only updates what's there. Without this, React rendering twice on mount turns the first draw-in
|
|
82
|
+
// into a plain update and the line just appears.
|
|
83
|
+
const drawn = React.useRef('');
|
|
84
|
+
// The donut's shape (its categories) when it was last drawn: new values for the same categories morph
|
|
85
|
+
// the slices into place instead of drawing in from scratch.
|
|
86
|
+
const drawnShape = React.useRef('');
|
|
87
|
+
// Everything the option depends on: an identical re-render (React runs effects twice on mount) must not
|
|
88
|
+
// call setOption again — a second setOption, even an identical one, redraws the line in full mid draw-in.
|
|
89
|
+
const applied = React.useRef('');
|
|
90
|
+
React.useEffect(() => {
|
|
91
|
+
if (!root.current)
|
|
92
|
+
return;
|
|
93
|
+
const chart = instance.current && !instance.current.isDisposed() ? instance.current : echarts.init(root.current);
|
|
94
|
+
instance.current = chart;
|
|
95
|
+
const style = getComputedStyle(root.current);
|
|
96
|
+
const palette = [1, 2, 3, 4, 5, 6].map(n => token(style, `--helix-color-chart-series-${n}`));
|
|
97
|
+
const text = token(style, '--helix-color-text-neutral-light');
|
|
98
|
+
const border = token(style, '--helix-color-border-neutral');
|
|
99
|
+
const page = token(style, '--helix-color-fill-page');
|
|
100
|
+
const fontFamily = token(style, '--helix-textStyle-body-s-regular-fontFamily');
|
|
101
|
+
// Draw-in motion: lines sweep in over duration.draw and each point appears as the line reaches it; bars
|
|
102
|
+
// grow one category after another (duration.stagger apart); each series starts after the previous one.
|
|
103
|
+
// Reduced motion shows the finished chart straight away.
|
|
104
|
+
const reduced = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
105
|
+
const draw = ms(token(style, '--helix-duration-draw'));
|
|
106
|
+
const stagger = ms(token(style, '--helix-duration-stagger'));
|
|
107
|
+
const gentle = bezier(token(style, '--helix-easing-gentle'));
|
|
108
|
+
const easeOut = bezier(token(style, '--helix-easing-out'));
|
|
109
|
+
const motion = reduced ? { animation: false } : { animation: true, animationEasing: gentle, animationDuration: draw };
|
|
110
|
+
const areaOpacity = parseFloat(token(style, '--helix-chart-area-opacity')) || 0;
|
|
111
|
+
const base = { color: palette, textStyle: { color: text, fontFamily }, tooltip: { trigger: variant === 'donut' ? 'item' : 'axis', axisPointer: { type: 'line', lineStyle: { color: border, width: 1, type: 'dashed' } }, borderRadius: parseFloat(token(style, '--helix-radius-l')), padding: parseFloat(token(style, '--helix-spacing-s')), extraCssText: 'box-shadow: var(--helix-shadow-s);', backgroundColor: token(style, '--helix-color-fill-page'), borderColor: border, borderWidth: 1, textStyle: { color: token(style, '--helix-color-text-neutral'), fontFamily } }, legend: { show: false, selected: Object.fromEntries(entries.map(name => [name, !hidden.has(name)])) }, ...motion };
|
|
112
|
+
// Lines start fast and ease out (easing.out). ECharts pops each point in with the series' animationDelay(index)
|
|
113
|
+
// and reveals the line with animationDelay(null), so each point waits until the eased reveal reaches it
|
|
114
|
+
// (category points sit at (i + 0.5) / n of the width).
|
|
115
|
+
const n = Math.max(categories.length, 1);
|
|
116
|
+
const lineMotion = (start) => typeof easeOut === 'function'
|
|
117
|
+
? { symbol: 'circle', animationEasing: easeOut, animationDelay: (point) => point == null ? start : start + timeAt(easeOut, (point + 0.5) / n) * draw }
|
|
118
|
+
: { symbol: 'circle', animationDelay: start };
|
|
119
|
+
// Bars: the tallest grows first, then the next tallest… (ranked across every series).
|
|
120
|
+
const ranked = series.flatMap((item, si) => item.data.map((v, point) => ({ si, point, v: Math.abs(v ?? 0) }))).sort((a, b) => b.v - a.v);
|
|
121
|
+
const rank = (si, point) => ranked.findIndex(r => r.si === si && r.point === point);
|
|
122
|
+
const barMotion = (si) => ({ animationDelay: (point) => Math.max(rank(si, point), 0) * stagger });
|
|
123
|
+
// Stacked bars fill up level by level: each segment starts when the one below it ends and takes time in
|
|
124
|
+
// proportion to its height, so the tallest column takes the full duration.draw.
|
|
125
|
+
const totals = categories.map((_, point) => series.reduce((sum, item) => sum + Math.abs(item.data[point] ?? 0), 0));
|
|
126
|
+
const tallest = Math.max(...totals, 1);
|
|
127
|
+
const below = (si, point) => series.slice(0, si).reduce((sum, item) => sum + Math.abs(item.data[point] ?? 0), 0);
|
|
128
|
+
const stackMotion = (si, value) => ({
|
|
129
|
+
animationEasing: 'linear',
|
|
130
|
+
animationDuration: (point) => (value(point) / tallest) * draw,
|
|
131
|
+
animationDelay: (point) => (below(si, point) / tallest) * draw,
|
|
132
|
+
});
|
|
133
|
+
// Neighbouring blues are under 3:1 apart, so stacked segments and donut slices are separated by a
|
|
134
|
+
// page-colored gap instead (WCAG 1.4.11).
|
|
135
|
+
const gap = { borderColor: page };
|
|
136
|
+
// Donut update (transitions.dev "donut chart"): when only the values change, each slice eases from
|
|
137
|
+
// its old angle to its new one over component.chart.duration-update with easing-update — the gaps
|
|
138
|
+
// between slices stay even the whole way.
|
|
139
|
+
const update = { animationDurationUpdate: ms(token(style, '--helix-chart-duration-update')), animationEasingUpdate: bezier(token(style, '--helix-chart-easing-update')) };
|
|
140
|
+
const option = variant === 'donut'
|
|
141
|
+
? { ...base, ...update, series: [{ type: 'pie', radius: ['56%', '78%'], animationType: 'expansion', animationEasing: easeOut, ...update, itemStyle: { ...gap, borderWidth: 2 }, data: categories.map((name, index) => ({ name, value: series[0]?.data[index] ?? 0 })) }] }
|
|
142
|
+
: { ...base, grid: { left: 8, right: 16, top: 24, bottom: 8, containLabel: true }, xAxis: { type: 'category', data: categories, axisLine: { lineStyle: { color: border } }, axisLabel: { color: text, fontFamily } }, yAxis: { type: 'value', splitLine: { lineStyle: { color: border } }, axisLabel: { color: text, fontFamily } },
|
|
143
|
+
series: series.map((item, index) => {
|
|
144
|
+
const value = (point) => Math.abs(item.data[point] ?? 0);
|
|
145
|
+
const line = variant === 'line' || variant === 'timeline' || variant === 'area';
|
|
146
|
+
const start = index * stagger * 2;
|
|
147
|
+
// A line is revealed left to right at a constant pace and ECharts shows each point as the reveal
|
|
148
|
+
// reaches it — the points follow the reveal linearly, so the line must be linear too or it runs ahead of
|
|
149
|
+
// them. Bars keep easing.gentle.
|
|
150
|
+
return { name: item.name, type: line ? 'line' : 'bar', stack: variant === 'stacked-bar' ? 'total' : undefined, smooth: variant === 'line' || variant === 'area', data: item.data,
|
|
151
|
+
...(line ? lineMotion(start) : variant === 'stacked-bar' ? stackMotion(index, value) : barMotion(index)),
|
|
152
|
+
itemStyle: variant === 'stacked-bar' ? { ...gap, borderWidth: 1 } : undefined,
|
|
153
|
+
areaStyle: variant === 'area' ? { color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ offset: 0, color: withAlpha(palette[index % 6] ?? '', areaOpacity) }, { offset: 1, color: withAlpha(palette[index % 6] ?? '', 0) }]) } : undefined };
|
|
154
|
+
}) };
|
|
155
|
+
const signature = JSON.stringify([variant, categories, series]);
|
|
156
|
+
// New data draws in from scratch; anything else merges into what's on screen, so an identical re-render
|
|
157
|
+
// (React's double effect on mount) doesn't cut the draw-in short.
|
|
158
|
+
// A donut whose categories didn't change only morphs to its new values.
|
|
159
|
+
const shape = JSON.stringify([variant, categories]);
|
|
160
|
+
const morph = variant === 'donut' && drawnShape.current === shape;
|
|
161
|
+
const fresh = drawn.current !== signature && !morph;
|
|
162
|
+
const key = JSON.stringify([signature, themeVersion, [...hidden], height, label, description]);
|
|
163
|
+
if (fresh)
|
|
164
|
+
chart.clear();
|
|
165
|
+
drawn.current = signature;
|
|
166
|
+
drawnShape.current = shape;
|
|
167
|
+
if (applied.current !== key) {
|
|
168
|
+
chart.setOption(option, fresh);
|
|
169
|
+
applied.current = key;
|
|
170
|
+
}
|
|
171
|
+
// ResizeObserver always fires once when it starts observing; resizing then would redraw the line in full
|
|
172
|
+
// mid draw-in, so only resize when the size really changed.
|
|
173
|
+
const el = root.current;
|
|
174
|
+
const observer = new ResizeObserver(() => { if (el.clientWidth !== chart.getWidth() || el.clientHeight !== chart.getHeight())
|
|
175
|
+
chart.resize(); });
|
|
176
|
+
observer.observe(el);
|
|
177
|
+
return () => observer.disconnect();
|
|
178
|
+
}, [variant, categories, series, label, description, height, themeVersion, hidden]);
|
|
179
|
+
React.useEffect(() => () => { instance.current?.dispose(); instance.current = null; drawn.current = ''; drawnShape.current = ''; applied.current = ''; }, []);
|
|
180
|
+
return _jsxs("div", { "data-helix-part": "chart-root", "data-variant": variant, className: cn(className), children: [_jsx("div", { ref: root, "data-helix-part": "chart-canvas", role: "img", "aria-label": description ? `${label}. ${description}` : label, style: { height } }), _jsx("div", { "data-helix-part": "chart-legend", role: interactive ? 'group' : undefined, "aria-label": interactive ? `${label} — show or hide series` : undefined, children: entries.map((name, index) => { const swatch = _jsx("span", { "data-helix-part": "chart-legend-swatch", "aria-hidden": "true", style: { '--chart-swatch': `var(--helix-color-chart-series-${(index % 6) + 1})` } }); return interactive ? _jsxs("button", { type: "button", "data-helix-part": "chart-legend-item", "aria-pressed": !hidden.has(name), onClick: () => toggle(name), children: [swatch, name] }, name) : _jsxs("span", { "data-helix-part": "chart-legend-item", children: [swatch, name] }, name); }) }), _jsx("div", { "data-helix-part": "chart-data", children: _jsxs("table", { children: [_jsx("caption", { children: label }), _jsx("tbody", { children: categories.map((category, index) => _jsxs("tr", { children: [_jsx("th", { scope: "row", children: category }), series.map(item => _jsx("td", { children: item.data[index] ?? 'No data' }, item.name))] }, category)) })] }) })] });
|
|
181
|
+
};
|
|
182
|
+
Chart.displayName = 'Chart';
|
|
183
|
+
export { Chart };
|
|
184
|
+
//# sourceMappingURL=Chart.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @helixds/react — agent note
|
|
3
|
+
* Before using Chart, read its contract: node_modules/@helixds/react/dist/contracts/Chart.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 type ChartVariant = 'line' | 'area' | 'bar' | 'stacked-bar' | 'donut' | 'timeline';
|
|
8
|
+
export interface ChartSeries {
|
|
9
|
+
name: string;
|
|
10
|
+
data: Array<number | null>;
|
|
11
|
+
}
|
|
12
|
+
export interface ChartProps {
|
|
13
|
+
variant: ChartVariant;
|
|
14
|
+
categories: string[];
|
|
15
|
+
series: ChartSeries[];
|
|
16
|
+
label: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
height?: number;
|
|
19
|
+
className?: string;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=Chart.types.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @helixds/react — agent note
|
|
3
|
+
* Before using Chart, read its contract: node_modules/@helixds/react/dist/contracts/Chart.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 { Chart } from './Chart.js';
|
|
8
|
+
export type { ChartProps, ChartSeries, ChartVariant } from './Chart.types.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @helixds/react — agent note
|
|
3
|
+
* Before using Checkbox, read its contract: node_modules/@helixds/react/dist/contracts/Checkbox.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 { CheckboxProps } from './Checkbox.types.js';
|
|
8
|
+
export declare function Checkbox({ label, description, errorMessage, checked, defaultChecked, onChange, disabled, required, invalid, indeterminate, id: idProp, name, value, }: CheckboxProps): import("react").JSX.Element;
|
|
9
|
+
export declare namespace Checkbox {
|
|
10
|
+
var displayName: string;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=Checkbox.d.ts.map
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export const doc = {
|
|
2
|
+
name: 'Checkbox',
|
|
3
|
+
purpose: 'Lets users toggle a single independent boolean option on or off.',
|
|
4
|
+
contract: 'contracts/components/Checkbox.json',
|
|
5
|
+
a11y: [
|
|
6
|
+
'The `label` prop is required and renders inside a real `<label>` bound to the native checkbox input.',
|
|
7
|
+
'Pair `invalid` with `errorMessage` so screen readers get a clear validation message.',
|
|
8
|
+
'`indeterminate` sets the native `indeterminate` DOM property — it is a visual/AX state only, not a value.',
|
|
9
|
+
],
|
|
10
|
+
variants: [],
|
|
11
|
+
sizes: [],
|
|
12
|
+
tokens: [
|
|
13
|
+
{ part: 'checkbox-control', label: 'Default fill', token: '--helix-checkbox-fill-default', kind: 'color' },
|
|
14
|
+
{ part: 'checkbox-control', label: 'Checked fill', token: '--helix-checkbox-fill-checked', kind: 'color' },
|
|
15
|
+
{ part: 'checkbox-control', label: 'Checked fill', token: '--helix-checkbox-fill-checked-hover', kind: 'color', state: 'hover', meta: 'Hover while checked' },
|
|
16
|
+
{ part: 'checkbox-control', label: 'Default border', token: '--helix-checkbox-border-default', kind: 'color' },
|
|
17
|
+
{ part: 'checkbox-control', label: 'Default border', token: '--helix-checkbox-border-hover', kind: 'color', state: 'hover', meta: 'Hover while unchecked' },
|
|
18
|
+
{ part: 'checkbox-control', label: 'Checked border', token: '--helix-checkbox-border-checked', kind: 'color' },
|
|
19
|
+
{ part: 'checkbox-control', label: 'Focus border', token: '--helix-checkbox-border-focus', kind: 'color' },
|
|
20
|
+
{ part: 'checkbox-control', label: 'Invalid border', token: '--helix-checkbox-border-invalid', kind: 'color' },
|
|
21
|
+
{ part: 'checkbox-indicator', label: 'Check icon color', token: '--helix-checkbox-icon-color', kind: 'color' },
|
|
22
|
+
{ part: 'checkbox-text', label: 'Label text', token: '--helix-checkbox-text-label', kind: 'color' },
|
|
23
|
+
{ part: 'checkbox-description', label: 'Description text', token: '--helix-checkbox-text-description', kind: 'color' },
|
|
24
|
+
{ part: 'checkbox-error', label: 'Error text', token: '--helix-checkbox-text-error', kind: 'color' },
|
|
25
|
+
{ part: 'checkbox-control', label: 'control.size', token: '--helix-checkbox-size', kind: 'space' },
|
|
26
|
+
{ part: 'checkbox-label', label: 'gap.control.text', token: '--helix-primitive-spacing-50', kind: 'space', axis: 'horizontal' },
|
|
27
|
+
{ part: 'checkbox-description', label: 'gap.control.description', token: '--helix-primitive-spacing-50', kind: 'space', axis: 'horizontal' },
|
|
28
|
+
{ part: 'checkbox-control', label: 'checkbox.control', token: '--helix-checkbox-radius', kind: 'radius' },
|
|
29
|
+
{ part: 'checkbox-root', label: 'display', value: 'block' },
|
|
30
|
+
{ part: 'checkbox-label', label: 'display', value: 'flex' },
|
|
31
|
+
{ part: 'checkbox-label', label: 'align-items', value: 'flex-start' },
|
|
32
|
+
{ part: 'checkbox-label', label: 'cursor', value: 'pointer' },
|
|
33
|
+
{ part: 'checkbox-input', label: 'position', value: 'absolute' },
|
|
34
|
+
{ part: 'checkbox-input', label: 'opacity', value: '0' },
|
|
35
|
+
{ part: 'checkbox-control', label: 'display', value: 'inline-flex' },
|
|
36
|
+
{ part: 'checkbox-control', label: 'align-items', value: 'center' },
|
|
37
|
+
{ part: 'checkbox-control', label: 'justify-content', value: 'center' },
|
|
38
|
+
{ part: 'checkbox-control', label: 'flex-shrink', value: '0' },
|
|
39
|
+
],
|
|
40
|
+
features: [
|
|
41
|
+
'label — required accessible label, rendered next to the control',
|
|
42
|
+
'description / errorMessage — helper copy and validation message',
|
|
43
|
+
'indeterminate — visual "partial selection" state for parent/group checkboxes',
|
|
44
|
+
'checked / defaultChecked — controlled or uncontrolled boolean state',
|
|
45
|
+
'invalid — validation state, pairs with errorMessage',
|
|
46
|
+
],
|
|
47
|
+
examples: [
|
|
48
|
+
{ label: 'Default', code: `<Checkbox label="Accept terms" />` },
|
|
49
|
+
{ label: 'With description', code: `<Checkbox label="Marketing emails" description="Occasional product updates" />` },
|
|
50
|
+
{ label: 'Indeterminate', code: `<Checkbox label="Select all" indeterminate />` },
|
|
51
|
+
{ label: 'Invalid', code: `<Checkbox label="Accept terms" invalid errorMessage="You must accept the terms" />` },
|
|
52
|
+
],
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=Checkbox.doc.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef } from 'react';
|
|
3
|
+
import { IconCheck, IconMinus } from '@tabler/icons-react';
|
|
4
|
+
import { Icon } from '../Icon/index.js';
|
|
5
|
+
let idCounter = 0;
|
|
6
|
+
export function Checkbox({ label, description, errorMessage, checked, defaultChecked, onChange, disabled = false, required = false, invalid = false, indeterminate = false, id: idProp, name, value, }) {
|
|
7
|
+
const uid = `helix-checkbox-${++idCounter}`;
|
|
8
|
+
const id = idProp ?? uid;
|
|
9
|
+
const inputRef = useRef(null);
|
|
10
|
+
const descId = description ? `${id}-desc` : undefined;
|
|
11
|
+
const errId = errorMessage ? `${id}-err` : undefined;
|
|
12
|
+
const describedby = [descId, errId].filter(Boolean).join(' ') || undefined;
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (inputRef.current) {
|
|
15
|
+
inputRef.current.indeterminate = indeterminate;
|
|
16
|
+
}
|
|
17
|
+
}, [indeterminate]);
|
|
18
|
+
return (_jsxs("div", { "data-helix-part": "checkbox-root", ...(disabled ? { 'data-disabled': '' } : {}), ...(invalid ? { 'data-invalid': '' } : {}), children: [_jsxs("label", { "data-helix-part": "checkbox-label", htmlFor: id, children: [_jsx("input", { ref: inputRef, id: id, type: "checkbox", name: name, value: value, checked: checked, defaultChecked: defaultChecked, disabled: disabled, required: required, "aria-required": required || undefined, "aria-invalid": invalid || undefined, "aria-describedby": describedby, "data-helix-part": "checkbox-input", ...(indeterminate ? { 'data-indeterminate': '' } : {}), onChange: e => onChange?.(e.target.checked) }), _jsx("span", { "data-helix-part": "checkbox-control", "aria-hidden": "true", children: _jsx("span", { "data-helix-part": "checkbox-indicator", children: indeterminate
|
|
19
|
+
? _jsx(Icon, { icon: IconMinus, size: 12, stroke: 3 })
|
|
20
|
+
: _jsx(Icon, { icon: IconCheck, size: 12, stroke: 3 }) }) }), _jsxs("span", { "data-helix-part": "checkbox-text", children: [label, required && _jsx("span", { "data-helix-part": "checkbox-required", "aria-hidden": "true", children: "*" })] })] }), description && !errorMessage && (_jsx("span", { id: descId, "data-helix-part": "checkbox-description", children: description })), errorMessage && (_jsx("span", { id: errId, "data-helix-part": "checkbox-error", role: "alert", children: errorMessage }))] }));
|
|
21
|
+
}
|
|
22
|
+
Checkbox.displayName = 'Checkbox';
|
|
23
|
+
//# sourceMappingURL=Checkbox.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @helixds/react — agent note
|
|
3
|
+
* Before using Checkbox, read its contract: node_modules/@helixds/react/dist/contracts/Checkbox.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 CheckboxProps {
|
|
8
|
+
label: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
errorMessage?: string;
|
|
11
|
+
checked?: boolean;
|
|
12
|
+
defaultChecked?: boolean;
|
|
13
|
+
onChange?: (checked: boolean) => void;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
required?: boolean;
|
|
16
|
+
invalid?: boolean;
|
|
17
|
+
indeterminate?: boolean;
|
|
18
|
+
id?: string;
|
|
19
|
+
name?: string;
|
|
20
|
+
value?: string;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=Checkbox.types.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @helixds/react — agent note
|
|
3
|
+
* Before using Checkbox, read its contract: node_modules/@helixds/react/dist/contracts/Checkbox.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 { Checkbox } from './Checkbox.js';
|
|
8
|
+
export type { CheckboxProps } from './Checkbox.types.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @helixds/react — agent note
|
|
3
|
+
* Before using CheckboxGroup, read its contract: node_modules/@helixds/react/dist/contracts/CheckboxGroup.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 { CheckboxGroupProps } from './CheckboxGroup.types.js';
|
|
9
|
+
export declare function CheckboxGroup({ label, options, value, defaultValue, onChange, orientation, description, errorMessage, invalid, disabled, required, name: nameProp, }: CheckboxGroupProps): React.JSX.Element;
|
|
10
|
+
export declare namespace CheckboxGroup {
|
|
11
|
+
var displayName: string;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=CheckboxGroup.d.ts.map
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export const doc = {
|
|
2
|
+
name: 'CheckboxGroup',
|
|
3
|
+
purpose: 'Lets users choose zero or more options from a small, visible set of independent choices.',
|
|
4
|
+
contract: 'contracts/components/CheckboxGroup.json',
|
|
5
|
+
a11y: [
|
|
6
|
+
'Renders a real `<fieldset>`/`<legend>` — the group `label` is the legend, not a per-option label.',
|
|
7
|
+
'Each option renders a real, standalone `Checkbox` — no bespoke markup, so it inherits all of Checkbox\'s own a11y and CSS unchanged.',
|
|
8
|
+
'Pair `invalid` with `errorMessage` so screen readers get a clear validation message.',
|
|
9
|
+
],
|
|
10
|
+
variants: [
|
|
11
|
+
{ name: 'vertical', description: 'Default orientation — options stack top to bottom.' },
|
|
12
|
+
{ name: 'horizontal', description: 'Options lay out left to right. Use for short option sets only.' },
|
|
13
|
+
],
|
|
14
|
+
sizes: [],
|
|
15
|
+
tokens: [
|
|
16
|
+
{ part: 'checkbox-group-legend', label: 'Group label text', token: '--helix-checkbox-text-label', kind: 'color' },
|
|
17
|
+
{ part: 'checkbox-group-error', label: 'Error text', token: '--helix-checkbox-text-error', kind: 'color' },
|
|
18
|
+
{ part: 'checkbox-group-legend', label: 'legend', token: '--helix-primitive-fontSize-s', kind: 'typography', meta: 'Label' },
|
|
19
|
+
{ part: 'checkbox-group-legend', label: 'legend.weight', token: '--helix-primitive-fontWeight-medium', kind: 'typography', meta: 'Medium' },
|
|
20
|
+
{ part: 'checkbox-group', label: 'gap.legend.options', token: '--helix-primitive-spacing-50', kind: 'space', axis: 'vertical' },
|
|
21
|
+
{ part: 'checkbox-group-options', label: 'gap.options', token: '--helix-primitive-spacing-75', kind: 'space', axis: 'vertical' },
|
|
22
|
+
{ part: 'checkbox-group', label: 'display', value: 'flex' },
|
|
23
|
+
{ part: 'checkbox-group', label: 'flex-direction', value: 'column' },
|
|
24
|
+
{ part: 'checkbox-group-options', label: 'display', value: 'flex' },
|
|
25
|
+
{ part: 'checkbox-group-options', label: 'flex-direction', value: 'column' },
|
|
26
|
+
],
|
|
27
|
+
features: [
|
|
28
|
+
'label — required legend for the whole group',
|
|
29
|
+
'options — array of { value, label, description?, disabled? }',
|
|
30
|
+
'orientation — vertical (default) or horizontal layout',
|
|
31
|
+
'value / defaultValue — controlled or uncontrolled multi-selection, as string[]',
|
|
32
|
+
'onChange — receives the full updated set of selected values, not a single toggle event',
|
|
33
|
+
'invalid / errorMessage — group-level validation state and helper copy',
|
|
34
|
+
'disabled — disables the whole group; individual options can also disable themselves',
|
|
35
|
+
'Composes real `Checkbox` instances internally — no duplicated visuals or tokens.',
|
|
36
|
+
],
|
|
37
|
+
examples: [
|
|
38
|
+
{
|
|
39
|
+
label: 'Default',
|
|
40
|
+
code: `<CheckboxGroup label="Notify me about" options={[{ value: 'comments', label: 'Comments' }, { value: 'mentions', label: 'Mentions' }]} />`,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
label: 'With descriptions',
|
|
44
|
+
code: `<CheckboxGroup label="Notify me about" options={[{ value: 'comments', label: 'Comments', description: 'Replies to your posts' }, { value: 'mentions', label: 'Mentions', description: 'When someone @-mentions you' }]} />`,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
label: 'Horizontal',
|
|
48
|
+
code: `<CheckboxGroup label="Days" orientation="horizontal" options={[{ value: 'mon', label: 'Mon' }, { value: 'tue', label: 'Tue' }, { value: 'wed', label: 'Wed' }]} />`,
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
label: 'Invalid',
|
|
52
|
+
code: `<CheckboxGroup label="Topics" options={options} invalid errorMessage="Choose at least one topic" />`,
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=CheckboxGroup.doc.js.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Checkbox } from '../Checkbox/index.js';
|
|
4
|
+
let idCounter = 0;
|
|
5
|
+
export function CheckboxGroup({ label, options, value, defaultValue, onChange, orientation = 'vertical', description, errorMessage, invalid = false, disabled = false, required = false, name: nameProp, }) {
|
|
6
|
+
const uid = `helix-checkbox-group-${++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
|
+
const isControlled = value !== undefined;
|
|
12
|
+
const [internalValue, setInternalValue] = React.useState(defaultValue ?? []);
|
|
13
|
+
const selected = isControlled ? value : internalValue;
|
|
14
|
+
const toggle = (optionValue, checked) => {
|
|
15
|
+
const next = checked ? [...selected, optionValue] : selected.filter(v => v !== optionValue);
|
|
16
|
+
if (!isControlled)
|
|
17
|
+
setInternalValue(next);
|
|
18
|
+
onChange?.(next);
|
|
19
|
+
};
|
|
20
|
+
return (_jsxs("fieldset", { "data-helix-part": "checkbox-group", ...(disabled ? { 'data-disabled': '' } : {}), ...(invalid ? { 'data-invalid': '' } : {}), "aria-describedby": describedby, children: [_jsxs("legend", { "data-helix-part": "checkbox-group-legend", children: [label, required && _jsx("span", { "data-helix-part": "checkbox-group-required", "aria-hidden": "true", children: "*" }), required && (_jsxs("span", { style: { position: 'absolute', width: 1, height: 1, overflow: 'hidden', clip: 'rect(0,0,0,0)', whiteSpace: 'nowrap' }, children: [' ', "(required)"] }))] }), _jsx("div", { "data-helix-part": "checkbox-group-options", "data-orientation": orientation, children: options.map(opt => (_jsx(Checkbox, { id: `${uid}-${opt.value}`, name: name, value: opt.value, label: opt.label, ...(opt.description !== undefined ? { description: opt.description } : {}), checked: selected.includes(opt.value), onChange: checked => toggle(opt.value, checked), disabled: opt.disabled || disabled,
|
|
21
|
+
// Not `required` on each checkbox: native validation would then demand EVERY option be
|
|
22
|
+
// checked, while the group's contract means "at least one". The consumer enforces that
|
|
23
|
+
// through `invalid` + `errorMessage`.
|
|
24
|
+
invalid: invalid }, opt.value))) }), description && !errorMessage && (_jsx("span", { id: descId, "data-helix-part": "checkbox-group-description", children: description })), errorMessage && (_jsx("span", { id: errId, "data-helix-part": "checkbox-group-error", role: "alert", children: errorMessage }))] }));
|
|
25
|
+
}
|
|
26
|
+
CheckboxGroup.displayName = 'CheckboxGroup';
|
|
27
|
+
//# sourceMappingURL=CheckboxGroup.js.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @helixds/react — agent note
|
|
3
|
+
* Before using CheckboxGroup, read its contract: node_modules/@helixds/react/dist/contracts/CheckboxGroup.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 CheckboxOption {
|
|
8
|
+
value: string;
|
|
9
|
+
label: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export type CheckboxGroupOrientation = 'vertical' | 'horizontal';
|
|
14
|
+
export interface CheckboxGroupProps {
|
|
15
|
+
label: string;
|
|
16
|
+
options: CheckboxOption[];
|
|
17
|
+
value?: string[];
|
|
18
|
+
defaultValue?: string[];
|
|
19
|
+
onChange?: (values: string[]) => void;
|
|
20
|
+
orientation?: CheckboxGroupOrientation;
|
|
21
|
+
description?: string;
|
|
22
|
+
errorMessage?: string;
|
|
23
|
+
invalid?: boolean;
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
required?: boolean;
|
|
26
|
+
name?: string;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=CheckboxGroup.types.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @helixds/react — agent note
|
|
3
|
+
* Before using CheckboxGroup, read its contract: node_modules/@helixds/react/dist/contracts/CheckboxGroup.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 { CheckboxGroup } from './CheckboxGroup.js';
|
|
8
|
+
export type { CheckboxGroupProps, CheckboxOption, CheckboxGroupOrientation } from './CheckboxGroup.types.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @helixds/react — agent note
|
|
3
|
+
* Before using Chip, read its contract: node_modules/@helixds/react/dist/contracts/Chip.json
|
|
4
|
+
* (every prop, which are required, when not to use it, the import line). Do not guess Helix props.
|
|
5
|
+
* Guide: node_modules/@helixds/react/AGENTS.md
|
|
6
|
+
*/
|
|
7
|
+
import * as React from 'react';
|
|
8
|
+
import type { ChipProps } from './Chip.types.js';
|
|
9
|
+
declare const Chip: React.ForwardRefExoticComponent<ChipProps & React.RefAttributes<HTMLButtonElement>>;
|
|
10
|
+
export { Chip };
|
|
11
|
+
//# sourceMappingURL=Chip.d.ts.map
|