@helixds/react 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (340) hide show
  1. package/AGENTS.md +292 -0
  2. package/LICENSE +21 -0
  3. package/README.md +49 -2
  4. package/dist/components/Accordion/Accordion.d.ts +14 -0
  5. package/dist/components/Accordion/Accordion.doc.d.ts +4 -0
  6. package/dist/components/Accordion/Accordion.doc.js +27 -0
  7. package/dist/components/Accordion/Accordion.js +76 -0
  8. package/dist/components/Accordion/Accordion.types.d.ts +24 -0
  9. package/dist/components/Accordion/Accordion.types.js +2 -0
  10. package/dist/components/Accordion/index.d.ts +9 -0
  11. package/dist/components/Accordion/index.js +2 -0
  12. package/dist/components/Avatar/Avatar.d.ts +14 -0
  13. package/dist/components/Avatar/Avatar.doc.d.ts +4 -0
  14. package/dist/components/Avatar/Avatar.doc.js +34 -0
  15. package/dist/components/Avatar/Avatar.js +14 -0
  16. package/dist/components/Avatar/Avatar.types.d.ts +20 -0
  17. package/dist/components/Avatar/Avatar.types.js +2 -0
  18. package/dist/components/Avatar/index.d.ts +9 -0
  19. package/dist/components/Avatar/index.js +2 -0
  20. package/dist/components/AvatarGroup/AvatarGroup.d.ts +14 -0
  21. package/dist/components/AvatarGroup/AvatarGroup.doc.d.ts +4 -0
  22. package/dist/components/AvatarGroup/AvatarGroup.doc.js +30 -0
  23. package/dist/components/AvatarGroup/AvatarGroup.js +15 -0
  24. package/dist/components/AvatarGroup/AvatarGroup.types.d.ts +21 -0
  25. package/dist/components/AvatarGroup/AvatarGroup.types.js +2 -0
  26. package/dist/components/AvatarGroup/index.d.ts +9 -0
  27. package/dist/components/AvatarGroup/index.js +2 -0
  28. package/dist/components/Badge/Badge.d.ts +16 -0
  29. package/dist/components/Badge/Badge.doc.d.ts +4 -0
  30. package/dist/components/Badge/Badge.doc.js +69 -0
  31. package/dist/components/Badge/Badge.js +23 -0
  32. package/dist/components/Badge/Badge.types.d.ts +22 -0
  33. package/dist/components/Badge/Badge.types.js +2 -0
  34. package/dist/components/Badge/index.d.ts +9 -0
  35. package/dist/components/Badge/index.js +2 -0
  36. package/dist/components/Button/Button.d.ts +11 -0
  37. package/dist/components/Button/Button.doc.d.ts +4 -0
  38. package/dist/components/Button/Button.doc.js +98 -0
  39. package/dist/components/Button/Button.js +80 -0
  40. package/dist/components/Button/Button.types.d.ts +29 -0
  41. package/dist/components/Button/Button.types.js +2 -0
  42. package/dist/components/Button/index.d.ts +9 -0
  43. package/dist/components/Button/index.js +2 -0
  44. package/dist/components/Card/Card.d.ts +14 -0
  45. package/dist/components/Card/Card.doc.d.ts +4 -0
  46. package/dist/components/Card/Card.doc.js +44 -0
  47. package/dist/components/Card/Card.js +9 -0
  48. package/dist/components/Card/Card.types.d.ts +19 -0
  49. package/dist/components/Card/Card.types.js +2 -0
  50. package/dist/components/Card/index.d.ts +9 -0
  51. package/dist/components/Card/index.js +2 -0
  52. package/dist/components/Chart/Chart.d.ts +14 -0
  53. package/dist/components/Chart/Chart.doc.d.ts +4 -0
  54. package/dist/components/Chart/Chart.doc.js +49 -0
  55. package/dist/components/Chart/Chart.js +184 -0
  56. package/dist/components/Chart/Chart.types.d.ts +21 -0
  57. package/dist/components/Chart/Chart.types.js +2 -0
  58. package/dist/components/Chart/index.d.ts +9 -0
  59. package/dist/components/Chart/index.js +2 -0
  60. package/dist/components/Checkbox/Checkbox.d.ts +12 -0
  61. package/dist/components/Checkbox/Checkbox.doc.d.ts +4 -0
  62. package/dist/components/Checkbox/Checkbox.doc.js +54 -0
  63. package/dist/components/Checkbox/Checkbox.js +23 -0
  64. package/dist/components/Checkbox/Checkbox.types.d.ts +22 -0
  65. package/dist/components/Checkbox/Checkbox.types.js +2 -0
  66. package/dist/components/Checkbox/index.d.ts +9 -0
  67. package/dist/components/Checkbox/index.js +2 -0
  68. package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +13 -0
  69. package/dist/components/CheckboxGroup/CheckboxGroup.doc.d.ts +4 -0
  70. package/dist/components/CheckboxGroup/CheckboxGroup.doc.js +56 -0
  71. package/dist/components/CheckboxGroup/CheckboxGroup.js +27 -0
  72. package/dist/components/CheckboxGroup/CheckboxGroup.types.d.ts +28 -0
  73. package/dist/components/CheckboxGroup/CheckboxGroup.types.js +2 -0
  74. package/dist/components/CheckboxGroup/index.d.ts +9 -0
  75. package/dist/components/CheckboxGroup/index.js +2 -0
  76. package/dist/components/Chip/Chip.d.ts +11 -0
  77. package/dist/components/Chip/Chip.doc.d.ts +4 -0
  78. package/dist/components/Chip/Chip.doc.js +105 -0
  79. package/dist/components/Chip/Chip.js +30 -0
  80. package/dist/components/Chip/Chip.types.d.ts +31 -0
  81. package/dist/components/Chip/Chip.types.js +2 -0
  82. package/dist/components/Chip/index.d.ts +9 -0
  83. package/dist/components/Chip/index.js +2 -0
  84. package/dist/components/ChipGroup/ChipGroup.d.ts +12 -0
  85. package/dist/components/ChipGroup/ChipGroup.doc.d.ts +4 -0
  86. package/dist/components/ChipGroup/ChipGroup.doc.js +31 -0
  87. package/dist/components/ChipGroup/ChipGroup.js +9 -0
  88. package/dist/components/ChipGroup/ChipGroup.types.d.ts +27 -0
  89. package/dist/components/ChipGroup/ChipGroup.types.js +2 -0
  90. package/dist/components/ChipGroup/index.d.ts +9 -0
  91. package/dist/components/ChipGroup/index.js +2 -0
  92. package/dist/components/FAB/FAB.d.ts +11 -0
  93. package/dist/components/FAB/FAB.doc.d.ts +4 -0
  94. package/dist/components/FAB/FAB.doc.js +52 -0
  95. package/dist/components/FAB/FAB.js +133 -0
  96. package/dist/components/FAB/FAB.types.d.ts +37 -0
  97. package/dist/components/FAB/FAB.types.js +2 -0
  98. package/dist/components/FAB/index.d.ts +9 -0
  99. package/dist/components/FAB/index.js +2 -0
  100. package/dist/components/Icon/Icon.d.ts +14 -0
  101. package/dist/components/Icon/Icon.doc.d.ts +4 -0
  102. package/dist/components/Icon/Icon.doc.js +38 -0
  103. package/dist/components/Icon/Icon.js +15 -0
  104. package/dist/components/Icon/Icon.types.d.ts +47 -0
  105. package/dist/components/Icon/Icon.types.js +2 -0
  106. package/dist/components/Icon/createIconAdapter.d.ts +24 -0
  107. package/dist/components/Icon/createIconAdapter.js +28 -0
  108. package/dist/components/Icon/iconStroke.d.ts +20 -0
  109. package/dist/components/Icon/iconStroke.js +54 -0
  110. package/dist/components/Icon/index.d.ts +12 -0
  111. package/dist/components/Icon/index.js +4 -0
  112. package/dist/components/IconButton/IconButton.d.ts +11 -0
  113. package/dist/components/IconButton/IconButton.doc.d.ts +4 -0
  114. package/dist/components/IconButton/IconButton.doc.js +76 -0
  115. package/dist/components/IconButton/IconButton.js +20 -0
  116. package/dist/components/IconButton/IconButton.types.d.ts +25 -0
  117. package/dist/components/IconButton/IconButton.types.js +2 -0
  118. package/dist/components/IconButton/index.d.ts +9 -0
  119. package/dist/components/IconButton/index.js +2 -0
  120. package/dist/components/Input/Input.d.ts +11 -0
  121. package/dist/components/Input/Input.doc.d.ts +4 -0
  122. package/dist/components/Input/Input.doc.js +68 -0
  123. package/dist/components/Input/Input.js +48 -0
  124. package/dist/components/Input/Input.types.d.ts +36 -0
  125. package/dist/components/Input/Input.types.js +2 -0
  126. package/dist/components/Input/index.d.ts +9 -0
  127. package/dist/components/Input/index.js +2 -0
  128. package/dist/components/Menu/Menu.d.ts +14 -0
  129. package/dist/components/Menu/Menu.doc.d.ts +4 -0
  130. package/dist/components/Menu/Menu.doc.js +46 -0
  131. package/dist/components/Menu/Menu.js +105 -0
  132. package/dist/components/Menu/Menu.types.d.ts +34 -0
  133. package/dist/components/Menu/Menu.types.js +2 -0
  134. package/dist/components/Menu/index.d.ts +9 -0
  135. package/dist/components/Menu/index.js +2 -0
  136. package/dist/components/Modal/Modal.d.ts +14 -0
  137. package/dist/components/Modal/Modal.doc.d.ts +4 -0
  138. package/dist/components/Modal/Modal.doc.js +52 -0
  139. package/dist/components/Modal/Modal.js +30 -0
  140. package/dist/components/Modal/Modal.types.d.ts +36 -0
  141. package/dist/components/Modal/Modal.types.js +2 -0
  142. package/dist/components/Modal/index.d.ts +9 -0
  143. package/dist/components/Modal/index.js +2 -0
  144. package/dist/components/MultiSelect/MultiSelect.d.ts +17 -0
  145. package/dist/components/MultiSelect/MultiSelect.doc.d.ts +4 -0
  146. package/dist/components/MultiSelect/MultiSelect.doc.js +37 -0
  147. package/dist/components/MultiSelect/MultiSelect.js +165 -0
  148. package/dist/components/MultiSelect/MultiSelect.types.d.ts +50 -0
  149. package/dist/components/MultiSelect/MultiSelect.types.js +2 -0
  150. package/dist/components/MultiSelect/index.d.ts +9 -0
  151. package/dist/components/MultiSelect/index.js +2 -0
  152. package/dist/components/NavItem/NavItem.d.ts +14 -0
  153. package/dist/components/NavItem/NavItem.doc.d.ts +4 -0
  154. package/dist/components/NavItem/NavItem.doc.js +31 -0
  155. package/dist/components/NavItem/NavItem.js +21 -0
  156. package/dist/components/NavItem/NavItem.types.d.ts +20 -0
  157. package/dist/components/NavItem/NavItem.types.js +2 -0
  158. package/dist/components/NavItem/index.d.ts +9 -0
  159. package/dist/components/NavItem/index.js +2 -0
  160. package/dist/components/RadioButton/RadioButton.d.ts +14 -0
  161. package/dist/components/RadioButton/RadioButton.doc.d.ts +4 -0
  162. package/dist/components/RadioButton/RadioButton.doc.js +35 -0
  163. package/dist/components/RadioButton/RadioButton.js +15 -0
  164. package/dist/components/RadioButton/RadioButton.types.d.ts +33 -0
  165. package/dist/components/RadioButton/RadioButton.types.js +2 -0
  166. package/dist/components/RadioButton/index.d.ts +9 -0
  167. package/dist/components/RadioButton/index.js +2 -0
  168. package/dist/components/RadioGroup/RadioGroup.d.ts +12 -0
  169. package/dist/components/RadioGroup/RadioGroup.doc.d.ts +4 -0
  170. package/dist/components/RadioGroup/RadioGroup.doc.js +80 -0
  171. package/dist/components/RadioGroup/RadioGroup.js +19 -0
  172. package/dist/components/RadioGroup/RadioGroup.types.d.ts +28 -0
  173. package/dist/components/RadioGroup/RadioGroup.types.js +2 -0
  174. package/dist/components/RadioGroup/index.d.ts +9 -0
  175. package/dist/components/RadioGroup/index.js +2 -0
  176. package/dist/components/SegmentedControl/SegmentedControl.d.ts +13 -0
  177. package/dist/components/SegmentedControl/SegmentedControl.doc.d.ts +4 -0
  178. package/dist/components/SegmentedControl/SegmentedControl.doc.js +50 -0
  179. package/dist/components/SegmentedControl/SegmentedControl.js +64 -0
  180. package/dist/components/SegmentedControl/SegmentedControl.types.d.ts +26 -0
  181. package/dist/components/SegmentedControl/SegmentedControl.types.js +2 -0
  182. package/dist/components/SegmentedControl/index.d.ts +9 -0
  183. package/dist/components/SegmentedControl/index.js +2 -0
  184. package/dist/components/Select/Select.d.ts +13 -0
  185. package/dist/components/Select/Select.doc.d.ts +4 -0
  186. package/dist/components/Select/Select.doc.js +66 -0
  187. package/dist/components/Select/Select.js +138 -0
  188. package/dist/components/Select/Select.types.d.ts +36 -0
  189. package/dist/components/Select/Select.types.js +2 -0
  190. package/dist/components/Select/index.d.ts +9 -0
  191. package/dist/components/Select/index.js +2 -0
  192. package/dist/components/SidePanel/SidePanel.d.ts +14 -0
  193. package/dist/components/SidePanel/SidePanel.doc.d.ts +4 -0
  194. package/dist/components/SidePanel/SidePanel.doc.js +29 -0
  195. package/dist/components/SidePanel/SidePanel.js +19 -0
  196. package/dist/components/SidePanel/SidePanel.types.d.ts +28 -0
  197. package/dist/components/SidePanel/SidePanel.types.js +2 -0
  198. package/dist/components/SidePanel/index.d.ts +9 -0
  199. package/dist/components/SidePanel/index.js +2 -0
  200. package/dist/components/Switch/Switch.d.ts +13 -0
  201. package/dist/components/Switch/Switch.doc.d.ts +4 -0
  202. package/dist/components/Switch/Switch.doc.js +56 -0
  203. package/dist/components/Switch/Switch.js +45 -0
  204. package/dist/components/Switch/Switch.types.d.ts +21 -0
  205. package/dist/components/Switch/Switch.types.js +2 -0
  206. package/dist/components/Switch/index.d.ts +9 -0
  207. package/dist/components/Switch/index.js +2 -0
  208. package/dist/components/Table/Table.d.ts +34 -0
  209. package/dist/components/Table/Table.doc.d.ts +4 -0
  210. package/dist/components/Table/Table.doc.js +48 -0
  211. package/dist/components/Table/Table.js +17 -0
  212. package/dist/components/Table/Table.types.d.ts +30 -0
  213. package/dist/components/Table/Table.types.js +2 -0
  214. package/dist/components/Table/index.d.ts +9 -0
  215. package/dist/components/Table/index.js +2 -0
  216. package/dist/components/Textarea/Textarea.d.ts +9 -0
  217. package/dist/components/Textarea/Textarea.doc.d.ts +4 -0
  218. package/dist/components/Textarea/Textarea.doc.js +60 -0
  219. package/dist/components/Textarea/Textarea.js +24 -0
  220. package/dist/components/Textarea/Textarea.types.d.ts +22 -0
  221. package/dist/components/Textarea/Textarea.types.js +2 -0
  222. package/dist/components/Textarea/index.d.ts +9 -0
  223. package/dist/components/Textarea/index.js +2 -0
  224. package/dist/components/Toast/Toast.d.ts +16 -0
  225. package/dist/components/Toast/Toast.doc.d.ts +4 -0
  226. package/dist/components/Toast/Toast.doc.js +37 -0
  227. package/dist/components/Toast/Toast.js +134 -0
  228. package/dist/components/Toast/Toast.types.d.ts +11 -0
  229. package/dist/components/Toast/Toast.types.js +2 -0
  230. package/dist/components/Toast/index.d.ts +10 -0
  231. package/dist/components/Toast/index.js +2 -0
  232. package/dist/components/Toast/toastStore.d.ts +36 -0
  233. package/dist/components/Toast/toastStore.js +57 -0
  234. package/dist/components/Tooltip/Tooltip.d.ts +14 -0
  235. package/dist/components/Tooltip/Tooltip.doc.d.ts +4 -0
  236. package/dist/components/Tooltip/Tooltip.doc.js +33 -0
  237. package/dist/components/Tooltip/Tooltip.js +105 -0
  238. package/dist/components/Tooltip/Tooltip.types.d.ts +21 -0
  239. package/dist/components/Tooltip/Tooltip.types.js +2 -0
  240. package/dist/components/Tooltip/index.d.ts +9 -0
  241. package/dist/components/Tooltip/index.js +2 -0
  242. package/dist/contracts/Accordion.json +174 -0
  243. package/dist/contracts/AppShell.json +118 -0
  244. package/dist/contracts/Avatar.json +157 -0
  245. package/dist/contracts/AvatarGroup.json +169 -0
  246. package/dist/contracts/Badge.json +212 -0
  247. package/dist/contracts/Button.json +295 -0
  248. package/dist/contracts/Card.json +125 -0
  249. package/dist/contracts/Chart.json +167 -0
  250. package/dist/contracts/Checkbox.json +333 -0
  251. package/dist/contracts/CheckboxGroup.json +200 -0
  252. package/dist/contracts/Chip.json +320 -0
  253. package/dist/contracts/ChipGroup.json +182 -0
  254. package/dist/contracts/FAB.json +215 -0
  255. package/dist/contracts/Icon.json +306 -0
  256. package/dist/contracts/IconButton.json +213 -0
  257. package/dist/contracts/Input.json +400 -0
  258. package/dist/contracts/Menu.json +197 -0
  259. package/dist/contracts/Modal.json +192 -0
  260. package/dist/contracts/MultiSelect.json +244 -0
  261. package/dist/contracts/NavItem.json +148 -0
  262. package/dist/contracts/PageHeader.json +134 -0
  263. package/dist/contracts/RadioButton.json +202 -0
  264. package/dist/contracts/RadioGroup.json +228 -0
  265. package/dist/contracts/SegmentedControl.json +193 -0
  266. package/dist/contracts/Select.json +241 -0
  267. package/dist/contracts/SideNav.json +138 -0
  268. package/dist/contracts/SidePanel.json +153 -0
  269. package/dist/contracts/Switch.json +201 -0
  270. package/dist/contracts/Table.json +130 -0
  271. package/dist/contracts/Textarea.json +353 -0
  272. package/dist/contracts/Toast.json +186 -0
  273. package/dist/contracts/Tooltip.json +168 -0
  274. package/dist/contracts/TopBar.json +127 -0
  275. package/dist/contracts/manifest.json +675 -0
  276. package/dist/index.d.ts +109 -0
  277. package/dist/index.js +73 -0
  278. package/dist/layout/AppShell/AppShell.d.ts +14 -0
  279. package/dist/layout/AppShell/AppShell.doc.d.ts +4 -0
  280. package/dist/layout/AppShell/AppShell.doc.js +27 -0
  281. package/dist/layout/AppShell/AppShell.js +9 -0
  282. package/dist/layout/AppShell/AppShell.types.d.ts +18 -0
  283. package/dist/layout/AppShell/AppShell.types.js +2 -0
  284. package/dist/layout/AppShell/index.d.ts +9 -0
  285. package/dist/layout/AppShell/index.js +2 -0
  286. package/dist/layout/PageHeader/PageHeader.d.ts +14 -0
  287. package/dist/layout/PageHeader/PageHeader.doc.d.ts +4 -0
  288. package/dist/layout/PageHeader/PageHeader.doc.js +30 -0
  289. package/dist/layout/PageHeader/PageHeader.js +10 -0
  290. package/dist/layout/PageHeader/PageHeader.types.d.ts +21 -0
  291. package/dist/layout/PageHeader/PageHeader.types.js +2 -0
  292. package/dist/layout/PageHeader/index.d.ts +9 -0
  293. package/dist/layout/PageHeader/index.js +2 -0
  294. package/dist/layout/SideNav/SideNav.d.ts +14 -0
  295. package/dist/layout/SideNav/SideNav.doc.d.ts +4 -0
  296. package/dist/layout/SideNav/SideNav.doc.js +32 -0
  297. package/dist/layout/SideNav/SideNav.js +9 -0
  298. package/dist/layout/SideNav/SideNav.types.d.ts +18 -0
  299. package/dist/layout/SideNav/SideNav.types.js +2 -0
  300. package/dist/layout/SideNav/index.d.ts +9 -0
  301. package/dist/layout/SideNav/index.js +2 -0
  302. package/dist/layout/TopBar/TopBar.d.ts +14 -0
  303. package/dist/layout/TopBar/TopBar.doc.d.ts +4 -0
  304. package/dist/layout/TopBar/TopBar.doc.js +28 -0
  305. package/dist/layout/TopBar/TopBar.js +9 -0
  306. package/dist/layout/TopBar/TopBar.types.d.ts +16 -0
  307. package/dist/layout/TopBar/TopBar.types.js +2 -0
  308. package/dist/layout/TopBar/index.d.ts +9 -0
  309. package/dist/layout/TopBar/index.js +2 -0
  310. package/dist/lib/component-doc.d.ts +34 -0
  311. package/dist/lib/component-doc.js +2 -0
  312. package/dist/lib/motionPresets.d.ts +37 -0
  313. package/dist/lib/motionPresets.js +35 -0
  314. package/dist/lib/resolveTokenPx.d.ts +11 -0
  315. package/dist/lib/resolveTokenPx.js +17 -0
  316. package/dist/lib/useDialogTransition.d.ts +21 -0
  317. package/dist/lib/useDialogTransition.js +86 -0
  318. package/dist/lib/useDisclosureTransition.d.ts +19 -0
  319. package/dist/lib/useDisclosureTransition.js +41 -0
  320. package/dist/lib/utils.d.ts +3 -0
  321. package/dist/lib/utils.js +6 -0
  322. package/dist/patterns/action-bar.md +127 -0
  323. package/dist/patterns/border-always.md +40 -0
  324. package/dist/patterns/data-analytics.md +15 -0
  325. package/dist/patterns/disabled-state.md +80 -0
  326. package/dist/patterns/empty-state.md +130 -0
  327. package/dist/patterns/expand-collapse-chevron.md +101 -0
  328. package/dist/patterns/form-field-group.md +139 -0
  329. package/dist/patterns/form-field-spacing.md +99 -0
  330. package/dist/patterns/group-spacing.md +54 -0
  331. package/dist/patterns/motion-effects.md +100 -0
  332. package/dist/patterns/same-row-sizing.md +52 -0
  333. package/dist/patterns/search-filter.md +118 -0
  334. package/dist/patterns/show-hide-parts.md +53 -0
  335. package/dist/patterns/stat-card.md +105 -0
  336. package/dist/patterns/status-row.md +130 -0
  337. package/dist/patterns/view-toggle.md +81 -0
  338. package/dist/prop-map.md +80 -0
  339. package/package.json +70 -3
  340. package/src/globals.css +3195 -0
@@ -0,0 +1,133 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import * as React from 'react';
3
+ import { AnimatePresence, motion, MotionConfig } from 'motion/react';
4
+ import { cn } from '../../lib/utils.js';
5
+ import { resolveTokenPx } from '../../lib/resolveTokenPx.js';
6
+ import { FAB_COLLAPSE_TRANSITION, FAB_EXPAND_TRANSITION, FAB_TRIGGER_BOUNCE_TRANSITION } from '../../lib/motionPresets.js';
7
+ import { Icon } from '../Icon/index.js';
8
+ // Action stack offset: each revealed action sits `ACTION_SIZE + GAP` further from the trigger than the
9
+ // last. Read from tokens at render time (never hardcoded px) via resolveTokenPx — see ADR-007 (motion
10
+ // engine) and .ai/maps/patterns/motion-effects.md for why this indirection exists (Motion's animate.y is a
11
+ // plain number, tokens are CSS custom properties, something has to bridge the two).
12
+ function useStackOffset() {
13
+ // pre-measurement defaults (fabSize 48, actionSize 36, gap 8 -> base 50, step 44)
14
+ const [layout, setLayout] = React.useState({ baseOffset: 50, step: 44, center: 6 });
15
+ React.useEffect(() => {
16
+ const fabSize = resolveTokenPx('--helix-fab-height');
17
+ const actionSize = resolveTokenPx('--helix-fab-action-height');
18
+ const gap = resolveTokenPx('--helix-primitive-spacing-50'); // 8px, explicit spec
19
+ // `step` (action-to-action) and `baseOffset` (trigger-to-first-action) are NOT the same distance — the
20
+ // trigger (fabSize) and an action (actionSize) have different radii, so a uniform `actionSize + gap`
21
+ // step under-spaces the trigger/action-0 pair specifically. Both are true edge-to-edge distances
22
+ // between circle centers, derived from the real radii:
23
+ // baseOffset = fabRadius + actionRadius + gap (trigger center -> action-0 center)
24
+ // step = actionDiameter + gap (action i center -> action i+1 center)
25
+ const baseOffset = fabSize / 2 + actionSize / 2 + gap;
26
+ const step = actionSize + gap;
27
+ // `center` is not itself a token — it's the geometric midpoint between two tokens (how far a smaller
28
+ // action circle sits inset from the larger trigger footprint so both are visually concentric), same
29
+ // category of token-derived arithmetic as Switch's thumb-position math.
30
+ setLayout({ baseOffset, step, center: (fabSize - actionSize) / 2 });
31
+ }, []);
32
+ return layout;
33
+ }
34
+ // Directional easing: expanding overshoots outward (the "back" bounce) — safe, nothing beyond the target
35
+ // to collide with. Collapsing must never dip PAST y=0 (the trigger's own position) — the same "back" curve
36
+ // run in reverse does exactly that, so collapse gets a no-overshoot ease-out instead. Presets shared via
37
+ // ../../lib/motionPresets — see that file for why these can't be tokens.json entries.
38
+ const EXPAND_TRANSITION = FAB_EXPAND_TRANSITION;
39
+ const COLLAPSE_TRANSITION = FAB_COLLAPSE_TRANSITION;
40
+ // A brief squish-and-release, fired once at the exact moment the actions are collected back — not a
41
+ // sustained size change. The trigger's real footprint never changes (48px, always); this is a transient
42
+ // scale pulse on top of it.
43
+ const TRIGGER_BOUNCE_TRANSITION = FAB_TRIGGER_BOUNCE_TRANSITION;
44
+ const FAB = React.forwardRef(({ icon, label, actions, expanded: expandedProp, defaultExpanded = false, onExpandedChange, disabled = false, className, onClick,
45
+ // Native ButtonHTMLAttributes passthrough (style, onDrag, ...) isn't spread onto the trigger —
46
+ // Motion's own `HTMLMotionProps` redefines several of those names (style, onDrag, onAnimationStart,
47
+ // ...) with incompatible signatures for its own gesture/animation system, and FAB's contract never
48
+ // documented arbitrary native passthrough as a feature. Use `className` for styling.
49
+ }, ref) => {
50
+ const [uncontrolledExpanded, setUncontrolledExpanded] = React.useState(defaultExpanded);
51
+ const expanded = expandedProp ?? uncontrolledExpanded;
52
+ const hasActions = !!actions && actions.length > 0;
53
+ const rootRef = React.useRef(null);
54
+ const triggerRef = React.useRef(null);
55
+ const { baseOffset, step, center } = useStackOffset();
56
+ // Trigger's own bounce: always the same size (scale 1) except for a brief squish-and-release pulse
57
+ // fired exactly when the speed-dial collapses (the actions "landing back" on it) — not a size change
58
+ // tied to `expanded` for its whole duration.
59
+ const [triggerScale, setTriggerScale] = React.useState(1);
60
+ const prevExpandedRef = React.useRef(expanded);
61
+ React.useEffect(() => {
62
+ if (prevExpandedRef.current && !expanded) {
63
+ setTriggerScale(0.92);
64
+ const id = setTimeout(() => setTriggerScale(1), 90);
65
+ prevExpandedRef.current = expanded;
66
+ return () => clearTimeout(id);
67
+ }
68
+ prevExpandedRef.current = expanded;
69
+ }, [expanded]);
70
+ // Same convention as a Menu/Popover returning focus to its trigger on close: an action button that
71
+ // just collapsed back into the trigger shouldn't be left holding a visible focus ring on a piece that
72
+ // no longer reads as a separate, reachable control once it's animated back to y=0.
73
+ const setExpanded = React.useCallback((next) => {
74
+ if (expandedProp === undefined)
75
+ setUncontrolledExpanded(next);
76
+ onExpandedChange?.(next);
77
+ if (!next)
78
+ triggerRef.current?.focus();
79
+ }, [expandedProp, onExpandedChange]);
80
+ // Speed-dial UX: Escape and an outside press both collapse.
81
+ React.useEffect(() => {
82
+ if (!expanded)
83
+ return;
84
+ const onKeyDown = (e) => {
85
+ if (e.key === 'Escape')
86
+ setExpanded(false);
87
+ };
88
+ const onPointerDown = (e) => {
89
+ if (rootRef.current && !rootRef.current.contains(e.target))
90
+ setExpanded(false);
91
+ };
92
+ document.addEventListener('keydown', onKeyDown);
93
+ document.addEventListener('pointerdown', onPointerDown);
94
+ return () => {
95
+ document.removeEventListener('keydown', onKeyDown);
96
+ document.removeEventListener('pointerdown', onPointerDown);
97
+ };
98
+ // eslint-disable-next-line react-hooks/exhaustive-deps
99
+ }, [expanded]);
100
+ const handleTriggerPress = e => {
101
+ onClick?.(e);
102
+ if (hasActions)
103
+ setExpanded(!expanded);
104
+ };
105
+ // Merge the internal triggerRef (focus-return target) with the forwarded consumer ref — both need
106
+ // the same DOM node, and React only takes one `ref` prop per element.
107
+ const setTriggerRef = React.useCallback((node) => {
108
+ triggerRef.current = node;
109
+ if (typeof ref === 'function')
110
+ ref(node);
111
+ else if (ref)
112
+ ref.current = node;
113
+ }, [ref]);
114
+ return (
115
+ // MotionConfig scoped locally, not relying on the consuming app to wrap its root in one — Motion
116
+ // does NOT respect prefers-reduced-motion on its own (verified against motion.dev's docs). See
117
+ // ADR-007.
118
+ _jsx(MotionConfig, { reducedMotion: "user", children: _jsxs("div", { ref: rootRef, "data-helix-part": "fab-root-wrapper", className: cn(className), children: [_jsx(motion.button, { ref: setTriggerRef, type: "button", "data-helix-part": "fab-root", "aria-label": label, "aria-expanded": hasActions ? expanded : undefined, disabled: disabled, onClick: handleTriggerPress, animate: { scale: triggerScale }, transition: TRIGGER_BOUNCE_TRANSITION, children: _jsx("span", { "data-helix-part": "fab-icon", "data-expanded": hasActions && expanded ? 'true' : undefined, children: _jsx(Icon, { icon: icon, size: 20 }) }) }), hasActions && (_jsx("div", { "data-helix-part": "fab-actions", children: _jsx(AnimatePresence, { children: expanded &&
119
+ actions.map((action, i) => (_jsx(motion.button, { type: "button", "data-helix-part": "fab-action", "aria-label": action.label, disabled: disabled, onClick: () => {
120
+ action.onClick();
121
+ setExpanded(false);
122
+ }, style: { position: 'absolute', bottom: center, right: center },
123
+ // `scale` in initial/animate/exit is Motion's own animation-target key, not a
124
+ // Helix prop — verify:props flags it as a false positive against prop-map.md's
125
+ // `size` mapping; same category of expected flag as Switch's `type: 'spring'`.
126
+ initial: { opacity: 0, scale: 0.5, y: 0 }, animate: { opacity: 1, scale: 1, y: -(baseOffset + step * i) }, exit: { opacity: 0, scale: 0.5, y: 0 }, transition: {
127
+ ...(expanded ? EXPAND_TRANSITION : COLLAPSE_TRANSITION),
128
+ delay: expanded ? i * 0.04 : (actions.length - i) * 0.04,
129
+ }, children: _jsx(Icon, { icon: action.icon, size: 16 }) }, action.label))) }) }))] }) }));
130
+ });
131
+ FAB.displayName = 'FAB';
132
+ export { FAB };
133
+ //# sourceMappingURL=FAB.js.map
@@ -0,0 +1,37 @@
1
+ /**
2
+ * @helixds/react — agent note
3
+ * Before using FAB, read its contract: node_modules/@helixds/react/dist/contracts/FAB.json
4
+ * (every prop, which are required, when not to use it, the import line). Do not guess Helix props.
5
+ * Guide: node_modules/@helixds/react/AGENTS.md
6
+ */
7
+ import type * as React from 'react';
8
+ import type { HelixIconComponent } from '../Icon/index.js';
9
+ export interface FABAction {
10
+ icon: HelixIconComponent;
11
+ label: string;
12
+ onClick: () => void;
13
+ }
14
+ export interface FABProps {
15
+ /** The trigger's icon, passed by reference (e.g. IconPlus). */
16
+ icon: HelixIconComponent;
17
+ /** Accessible name for the trigger — required, there is no visible text. */
18
+ label: string;
19
+ /** Speed-dial actions revealed when expanded. Omit for a plain FAB with no speed-dial. */
20
+ actions?: FABAction[];
21
+ /** Controlled expanded state. */
22
+ expanded?: boolean;
23
+ /** Uncontrolled initial expanded state. Default: false */
24
+ defaultExpanded?: boolean;
25
+ /** Fired when the speed-dial opens or closes. */
26
+ onExpandedChange?: (expanded: boolean) => void;
27
+ /** Disables interaction. */
28
+ disabled?: boolean;
29
+ /** Additional className for the root wrapper. */
30
+ className?: string;
31
+ /** Trigger press handler — React's own `onClick` (ADR-022). `onPress` is an anti-synonym.
32
+ * No other native <button> passthrough is supported — Motion's HTMLMotionProps redefines several native
33
+ * event names (style, onDrag, onAnimationStart, ...) for its own gesture/animation system, so FAB's
34
+ * root no longer extends ButtonHTMLAttributes wholesale (it did before the Motion migration, ADR-007). */
35
+ onClick?: React.MouseEventHandler<HTMLButtonElement>;
36
+ }
37
+ //# sourceMappingURL=FAB.types.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=FAB.types.js.map
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @helixds/react — agent note
3
+ * Before using FAB, read its contract: node_modules/@helixds/react/dist/contracts/FAB.json
4
+ * (every prop, which are required, when not to use it, the import line). Do not guess Helix props.
5
+ * Guide: node_modules/@helixds/react/AGENTS.md
6
+ */
7
+ export { FAB } from './FAB.js';
8
+ export type { FABProps, FABAction } from './FAB.types.js';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { FAB } from './FAB.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @helixds/react — agent note
3
+ * Before using Icon, read its contract: node_modules/@helixds/react/dist/contracts/Icon.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 { IconProps } from './Icon.types.js';
9
+ declare const Icon: {
10
+ ({ icon: IconComponent, size, stroke, color, label, decorative, className, }: IconProps): React.JSX.Element;
11
+ displayName: string;
12
+ };
13
+ export { Icon };
14
+ //# sourceMappingURL=Icon.d.ts.map
@@ -0,0 +1,4 @@
1
+ /** Machine-readable component documentation for the Helix Icon. */
2
+ import type { ComponentDoc } from '../../lib/component-doc.js';
3
+ export declare const doc: ComponentDoc;
4
+ //# sourceMappingURL=Icon.doc.d.ts.map
@@ -0,0 +1,38 @@
1
+ export const doc = {
2
+ name: 'Icon',
3
+ purpose: 'Communicates meaning, action, or status through a recognizable icon symbol. Defaults to Tabler\'s outline set but accepts any icon-set-agnostic component (ADR-014). Always supplemental to text — never the sole conveyor of information without a label.',
4
+ contract: 'contracts/components/Icon.json',
5
+ a11y: [
6
+ "Default (decorative=true) renders aria-hidden='true' — use when a visible label sits next to the icon.",
7
+ "Pass decorative={false} and a label for icon-only usage — renders role='img' aria-label={label} instead of aria-hidden.",
8
+ 'Never rely on the icon alone to convey status — pair with text or an explicit label.',
9
+ ],
10
+ variants: [],
11
+ sizes: ['12', '14', '16', '18', '20', '24', '28', '32', '36', '40'],
12
+ tokens: [
13
+ { part: 'icon-root', label: 'color.neutral', token: '--helix-color-icon-neutral', kind: 'color' },
14
+ { part: 'icon-root', label: 'color.neutral-light', token: '--helix-color-icon-neutral-light', kind: 'color' },
15
+ { part: 'icon-root', label: 'color.disabled', token: '--helix-color-icon-disabled', kind: 'color' },
16
+ { part: 'icon-root', label: 'color.inverse', token: '--helix-color-icon-inverse', kind: 'color' },
17
+ { part: 'icon-root', label: 'color.primary', token: '--helix-color-icon-primary', kind: 'color' },
18
+ { part: 'icon-root', label: 'color.danger', token: '--helix-color-icon-danger', kind: 'color' },
19
+ { part: 'icon-root', label: 'color.success', token: '--helix-color-icon-success', kind: 'color' },
20
+ { part: 'icon-root', label: 'color.warning', token: '--helix-color-icon-warning', kind: 'color' },
21
+ { part: 'icon-root', label: 'color.info', token: '--helix-color-icon-info', kind: 'color' },
22
+ { part: 'icon-root', label: 'stroke-width', value: '1.3px → 2.8px real', kind: 'other', meta: 'ADR-017 stroke rule — real on-screen width per size (12: 1.3, 14: 1.4, 16: 1.5, 18: 1.5, 20: 1.7, 24: 1.8, 28: 2.0, 32: 2.2, 36: 2.4, 40: 2.8px), applied automatically by Icon' },
23
+ { part: 'icon-root', label: 'viewBox', value: '0 0 24 24', kind: 'other' },
24
+ ],
25
+ features: [
26
+ 'icon — any HelixIconComponent-shaped icon (e.g. IconPlus), passed by reference not by name string — Tabler is the default set, not a requirement',
27
+ 'size — fixed pixel size, one of 12 | 14 | 16 | 18 | 20 | 24 | 28 | 32 | 36 | 40 — never scales with font-size',
28
+ 'stroke — derived automatically from size (ADR-017 stroke rule); pass only for a deliberate one-off',
29
+ 'decorative/label — controls aria-hidden vs role="img" + aria-label',
30
+ ],
31
+ examples: [
32
+ { label: 'Decorative (default, paired with visible text)', code: `<Icon icon={IconPlus} />` },
33
+ { label: 'Icon-only, needs a label', code: `<Icon icon={IconTrash} decorative={false} label="Delete" />` },
34
+ { label: 'Sized + colored via token', code: `<Icon icon={IconAlertCircle} size={20} className="text-[color:var(--helix-color-icon-danger)]" />` },
35
+ { label: 'Non-Tabler icon set via adapter', code: `const LucideSearch = createIconAdapter(Search, { strokeProp: 'strokeWidth' });\n<Icon icon={LucideSearch} />` },
36
+ ],
37
+ };
38
+ //# sourceMappingURL=Icon.doc.js.map
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as React from 'react';
3
+ import { cn } from '../../lib/utils.js';
4
+ import { iconStrokeForSize } from './iconStroke.js';
5
+ const Icon = ({ icon: IconComponent, size = 16, stroke, color = 'currentColor', label, decorative = true, className, }) => {
6
+ const isMeaningful = !decorative && !!label;
7
+ // Stroke rule (ADR-017): derived from the real on-screen line width for this size.
8
+ const resolvedStroke = stroke ?? iconStrokeForSize(size);
9
+ // icon-vector (the inner <path>) is generated inside the Tabler component and isn't
10
+ // reachable as a prop target — only icon-root carries a data-helix-part.
11
+ return (_jsx(IconComponent, { "data-helix-part": "icon-root", size: size, stroke: resolvedStroke, color: color, className: cn(className), "aria-hidden": isMeaningful ? undefined : true, role: isMeaningful ? 'img' : undefined, "aria-label": isMeaningful ? label : undefined }));
12
+ };
13
+ Icon.displayName = 'Icon';
14
+ export { Icon };
15
+ //# sourceMappingURL=Icon.js.map
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @helixds/react — agent note
3
+ * Before using Icon, read its contract: node_modules/@helixds/react/dist/contracts/Icon.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
+ export type IconSize = 12 | 14 | 16 | 18 | 20 | 24 | 28 | 32 | 36 | 40;
9
+ /**
10
+ * Structural shape Helix's `Icon` wrapper actually renders through — `size`, `stroke`, `color`,
11
+ * plus standard SVG/aria passthrough. Every `@tabler/icons-react` icon already satisfies this
12
+ * type as-is (Tabler is the documented default set), so existing usage is unaffected. Any other
13
+ * icon component matching this same prop shape can be passed directly too; one that doesn't
14
+ * (different prop names, e.g. Lucide's `strokeWidth`) can be wrapped with `createIconAdapter` —
15
+ * see `Icon/createIconAdapter.ts` and ADR-014.
16
+ */
17
+ export type HelixIconComponent = React.ComponentType<Omit<React.SVGProps<SVGSVGElement>, 'size' | 'stroke' | 'color'> & {
18
+ size?: number | string;
19
+ stroke?: number;
20
+ color?: string;
21
+ }>;
22
+ export interface IconProps {
23
+ /** The icon component to render, passed by reference (e.g. `IconPlus`), not pre-instantiated.
24
+ * Defaults to Tabler's outline set; any `HelixIconComponent`-shaped component works — see
25
+ * `createIconAdapter` for sets with an incompatible prop dialect. */
26
+ icon: HelixIconComponent;
27
+ /** Rendered icon size in pixels. Default: 16 */
28
+ size?: IconSize;
29
+ /**
30
+ * Stroke width applied to the icon path (24×24 viewBox units). Default: derived automatically
31
+ * from `size` by the icon stroke rule (ADR-017, `ICON_STROKE_PX_BY_SIZE` in iconStroke.ts) —
32
+ * a real on-screen line of 1.3px at 12 rising to 2.8px at 40. Tabler's viewBox stays fixed at
33
+ * 24×24, so a flat stroke value would get thinner on screen as `size` drops. Don't pass it to
34
+ * fix a "too thin" icon — change the rule instead. Pass explicitly only for a deliberate
35
+ * one-off (e.g. Checkbox's bold `stroke={3}` checkmark).
36
+ */
37
+ stroke?: number;
38
+ /** Icon stroke color. Default: 'currentColor' — prefer inheriting from surrounding text/token. */
39
+ color?: string;
40
+ /** Accessible label for icon-only usage. Required when `decorative` is false. */
41
+ label?: string;
42
+ /** Marks the icon as decorative when a visible label already exists nearby. Default: true */
43
+ decorative?: boolean;
44
+ /** Additional className for the root svg. */
45
+ className?: string;
46
+ }
47
+ //# sourceMappingURL=Icon.types.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Icon.types.js.map
@@ -0,0 +1,24 @@
1
+ import * as React from 'react';
2
+ import type { HelixIconComponent } from './Icon.types.js';
3
+ export interface IconAdapterConfig {
4
+ /** Prop name this icon set uses for stroke width. Pass `false` if the set has no concept of
5
+ * stroke width at all (e.g. a filled/solid icon set). Default: 'stroke' */
6
+ strokeProp?: string | false;
7
+ /** Prop name this icon set uses for size. Default: 'size' */
8
+ sizeProp?: string;
9
+ /** Prop name this icon set uses for color. Default: 'color' */
10
+ colorProp?: string;
11
+ }
12
+ /**
13
+ * Wraps a foreign icon component (Lucide, Heroicons, a custom SVG component, ...) so it satisfies
14
+ * `HelixIconComponent` and can be passed to Helix's `icon`/`iconEnd` props. Only needed when the
15
+ * icon set's prop names differ from Tabler's (`size`/`stroke`/`color`) — a set that already
16
+ * matches that shape needs no adapter. See ADR-014.
17
+ *
18
+ * @example
19
+ * import { Search } from 'lucide-react';
20
+ * const LucideSearch = createIconAdapter(Search, { strokeProp: 'strokeWidth' });
21
+ * <Icon icon={LucideSearch} />
22
+ */
23
+ export declare function createIconAdapter(Component: React.ComponentType<Record<string, unknown>>, config?: IconAdapterConfig): HelixIconComponent;
24
+ //# sourceMappingURL=createIconAdapter.d.ts.map
@@ -0,0 +1,28 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * Wraps a foreign icon component (Lucide, Heroicons, a custom SVG component, ...) so it satisfies
4
+ * `HelixIconComponent` and can be passed to Helix's `icon`/`iconEnd` props. Only needed when the
5
+ * icon set's prop names differ from Tabler's (`size`/`stroke`/`color`) — a set that already
6
+ * matches that shape needs no adapter. See ADR-014.
7
+ *
8
+ * @example
9
+ * import { Search } from 'lucide-react';
10
+ * const LucideSearch = createIconAdapter(Search, { strokeProp: 'strokeWidth' });
11
+ * <Icon icon={LucideSearch} />
12
+ */
13
+ export function createIconAdapter(Component, config = {}) {
14
+ const { strokeProp = 'stroke', sizeProp = 'size', colorProp = 'color' } = config;
15
+ const Adapted = ({ size, stroke, color, ...rest }) => {
16
+ const mapped = { ...rest };
17
+ if (size !== undefined)
18
+ mapped[sizeProp] = size;
19
+ if (stroke !== undefined && strokeProp !== false)
20
+ mapped[strokeProp] = stroke;
21
+ if (color !== undefined)
22
+ mapped[colorProp] = color;
23
+ return React.createElement(Component, mapped);
24
+ };
25
+ Adapted.displayName = `IconAdapter(${Component.displayName || Component.name || 'Icon'})`;
26
+ return Adapted;
27
+ }
28
+ //# sourceMappingURL=createIconAdapter.js.map
@@ -0,0 +1,20 @@
1
+ import type { IconSize } from './Icon.types.js';
2
+ /**
3
+ * Icon stroke rule (ADR-017) — the single source of truth for how thick an icon's line reads on
4
+ * screen. Values are the **real rendered line width in CSS px**, not the SVG `stroke` attribute:
5
+ * Tabler's viewBox stays fixed at 24×24 whatever `size` renders at, so the same `stroke` value
6
+ * gets thinner on screen as the icon shrinks (rendered px = stroke × size / 24). Designing in real
7
+ * px and deriving `stroke` from it keeps small icons (Badge's 12px, Chip's 14px) from reading as
8
+ * weak next to semibold text, and makes the line grow steadily with the icon.
9
+ *
10
+ * To change how heavy icons look, edit this table — never pass `stroke` at a call site to fix a
11
+ * "too thin" icon. `iconStrokeForSize` derives the SVG value automatically.
12
+ */
13
+ export declare const ICON_STROKE_PX_BY_SIZE: Record<IconSize, number>;
14
+ /**
15
+ * SVG `stroke` value for an icon rendered at `size` px, following ICON_STROKE_PX_BY_SIZE.
16
+ * Sizes between two rungs interpolate the real px linearly; below the smallest / above the largest
17
+ * rung the edge rung's `stroke` is held, so the line then scales proportionally with the icon.
18
+ */
19
+ export declare function iconStrokeForSize(size: number): number;
20
+ //# sourceMappingURL=iconStroke.d.ts.map
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Icon stroke rule (ADR-017) — the single source of truth for how thick an icon's line reads on
3
+ * screen. Values are the **real rendered line width in CSS px**, not the SVG `stroke` attribute:
4
+ * Tabler's viewBox stays fixed at 24×24 whatever `size` renders at, so the same `stroke` value
5
+ * gets thinner on screen as the icon shrinks (rendered px = stroke × size / 24). Designing in real
6
+ * px and deriving `stroke` from it keeps small icons (Badge's 12px, Chip's 14px) from reading as
7
+ * weak next to semibold text, and makes the line grow steadily with the icon.
8
+ *
9
+ * To change how heavy icons look, edit this table — never pass `stroke` at a call site to fix a
10
+ * "too thin" icon. `iconStrokeForSize` derives the SVG value automatically.
11
+ */
12
+ export const ICON_STROKE_PX_BY_SIZE = {
13
+ 12: 1.3,
14
+ 14: 1.4,
15
+ 16: 1.5,
16
+ 18: 1.5, // same as 16 (was 1.6): IconButton's 18px icons read heavier than Button's 16px ones side by side
17
+ 20: 1.7,
18
+ 24: 1.8,
19
+ 28: 2.0,
20
+ 32: 2.2,
21
+ 36: 2.4,
22
+ 40: 2.8,
23
+ };
24
+ /** [size, real px] rungs, ascending by size. */
25
+ const RUNGS = Object.entries(ICON_STROKE_PX_BY_SIZE)
26
+ .map(([size, px]) => [Number(size), px])
27
+ .sort((a, b) => a[0] - b[0]);
28
+ /** SVG `stroke` attribute (24×24 viewBox units) that renders a line `px` wide at `size`. */
29
+ const toSvgStroke = (px, size) => Math.round(((px * 24) / size) * 100) / 100;
30
+ /**
31
+ * SVG `stroke` value for an icon rendered at `size` px, following ICON_STROKE_PX_BY_SIZE.
32
+ * Sizes between two rungs interpolate the real px linearly; below the smallest / above the largest
33
+ * rung the edge rung's `stroke` is held, so the line then scales proportionally with the icon.
34
+ */
35
+ export function iconStrokeForSize(size) {
36
+ let lower;
37
+ for (const rung of RUNGS) {
38
+ const [rungSize, rungPx] = rung;
39
+ if (size === rungSize)
40
+ return toSvgStroke(rungPx, size);
41
+ if (size < rungSize) {
42
+ // Below the first rung: hold its svg stroke.
43
+ if (!lower)
44
+ return toSvgStroke(rungPx, rungSize);
45
+ const [loSize, loPx] = lower;
46
+ const t = (size - loSize) / (rungSize - loSize);
47
+ return toSvgStroke(loPx + t * (rungPx - loPx), size);
48
+ }
49
+ lower = rung;
50
+ }
51
+ // Above the last rung: hold its svg stroke.
52
+ return lower ? toSvgStroke(lower[1], lower[0]) : 1.5;
53
+ }
54
+ //# sourceMappingURL=iconStroke.js.map
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @helixds/react — agent note
3
+ * Before using Icon, read its contract: node_modules/@helixds/react/dist/contracts/Icon.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 { Icon } from './Icon.js';
8
+ export type { IconProps, IconSize, HelixIconComponent } from './Icon.types.js';
9
+ export { createIconAdapter } from './createIconAdapter.js';
10
+ export { iconStrokeForSize, ICON_STROKE_PX_BY_SIZE } from './iconStroke.js';
11
+ export type { IconAdapterConfig } from './createIconAdapter.js';
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,4 @@
1
+ export { Icon } from './Icon.js';
2
+ export { createIconAdapter } from './createIconAdapter.js';
3
+ export { iconStrokeForSize, ICON_STROKE_PX_BY_SIZE } from './iconStroke.js';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @helixds/react — agent note
3
+ * Before using IconButton, read its contract: node_modules/@helixds/react/dist/contracts/IconButton.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 { IconButtonProps } from './IconButton.types.js';
9
+ declare const IconButton: React.ForwardRefExoticComponent<IconButtonProps & React.RefAttributes<HTMLButtonElement>>;
10
+ export { IconButton };
11
+ //# sourceMappingURL=IconButton.d.ts.map
@@ -0,0 +1,4 @@
1
+ /** Machine-readable component documentation for the Helix IconButton. */
2
+ import type { ComponentDoc } from '../../lib/component-doc.js';
3
+ export declare const doc: ComponentDoc;
4
+ //# sourceMappingURL=IconButton.doc.d.ts.map
@@ -0,0 +1,76 @@
1
+ export const doc = {
2
+ name: 'IconButton',
3
+ purpose: 'Triggers an action via a single icon, with no visible text label — a toolbar action, a row action, a close/dismiss control.',
4
+ contract: 'contracts/components/IconButton.json',
5
+ a11y: [
6
+ '`label` is required — it is the only accessible name the button has, rendered as aria-label.',
7
+ 'Only use an icon universally recognizable on its own (trash, close, more/···, edit pencil). If the icon needs a tooltip to be understood, use Button with a visible text label instead.',
8
+ ],
9
+ variants: [
10
+ { name: 'primary', description: 'Filled brand background. Rare for an icon-only control — most icon actions are secondary.' },
11
+ { name: 'secondary', description: 'Outlined, neutral.' },
12
+ { name: 'ghost', description: 'No background or border. Default — the common case for toolbar/row-action icons.' },
13
+ { name: 'danger', description: 'Filled red. Use only for irreversible destructive actions (e.g. delete).' },
14
+ ],
15
+ sizes: ['s', 'm', 'l'],
16
+ tokens: [
17
+ { part: 'icon-button', label: 'fill.primary', token: '--helix-iconButton-fill-primary-default', kind: 'color', variant: 'primary' },
18
+ { part: 'icon-button', label: 'fill.primary', token: '--helix-iconButton-fill-primary-hover', kind: 'color', variant: 'primary', state: 'hover' },
19
+ { part: 'icon-button', label: 'fill.primary', token: '--helix-iconButton-fill-primary-press', kind: 'color', variant: 'primary', state: 'press' },
20
+ { part: 'icon-button', label: 'fill.secondary', token: '--helix-iconButton-fill-secondary-default', kind: 'color', variant: 'secondary' },
21
+ { part: 'icon-button', label: 'fill.secondary', token: '--helix-iconButton-fill-secondary-hover', kind: 'color', variant: 'secondary', state: 'hover' },
22
+ { part: 'icon-button', label: 'fill.secondary', token: '--helix-iconButton-fill-secondary-press', kind: 'color', variant: 'secondary', state: 'press' },
23
+ { part: 'icon-button', label: 'border.secondary', token: '--helix-iconButton-border-secondary-default', kind: 'color', variant: 'secondary' },
24
+ { part: 'icon-button', label: 'border.secondary', token: '--helix-iconButton-border-secondary-hover', kind: 'color', variant: 'secondary', state: 'hover' },
25
+ { part: 'icon-button', label: 'fill.ghost', token: '--helix-iconButton-fill-secondary-default', kind: 'color', variant: 'ghost', state: 'hover' },
26
+ { part: 'icon-button', label: 'fill.ghost', token: '--helix-iconButton-fill-secondary-hover', kind: 'color', variant: 'ghost', state: 'press' },
27
+ { part: 'icon-button', label: 'fill.danger', token: '--helix-iconButton-fill-danger-default', kind: 'color', variant: 'danger' },
28
+ { part: 'icon-button', label: 'fill.danger', token: '--helix-iconButton-fill-danger-hover', kind: 'color', variant: 'danger', state: 'hover' },
29
+ { part: 'icon-button', label: 'fill.danger', token: '--helix-iconButton-fill-danger-press', kind: 'color', variant: 'danger', state: 'press' },
30
+ { part: 'icon-button', label: 'border.focus', token: '--helix-iconButton-border-focus', kind: 'color' },
31
+ { part: 'icon-button', label: 'icon-button.root', token: '--helix-iconButton-radius', kind: 'radius' },
32
+ { part: 'icon-button', label: 'size.s', token: '--helix-iconButton-height-s', kind: 'space', size: 's', meta: 'width = height (square)' },
33
+ { part: 'icon-button', label: 'size.m', token: '--helix-iconButton-height-m', kind: 'space', size: 'm', meta: 'width = height (square)' },
34
+ { part: 'icon-button', label: 'size.l', token: '--helix-iconButton-height-l', kind: 'space', size: 'l', meta: 'width = height (square)' },
35
+ { part: 'icon-button', label: 'display', value: 'inline-flex' },
36
+ { part: 'icon-button', label: 'align-items', value: 'center' },
37
+ { part: 'icon-button', label: 'justify-content', value: 'center' },
38
+ { part: 'icon-button', label: 'border', value: '1px solid transparent' },
39
+ { part: 'icon-button', label: 'cursor', value: 'pointer' },
40
+ { part: 'icon-button', label: 'outline', value: 'none' },
41
+ { part: 'icon-button', label: 'flex-shrink', value: '0' },
42
+ { part: 'icon-button', label: 'padding', value: '0' },
43
+ { part: 'icon-button', label: '-webkit-appearance', value: 'none' },
44
+ { part: 'icon-button', label: 'background-color', value: 'transparent' },
45
+ { part: 'icon-button', label: 'border-color', value: 'transparent' },
46
+ { part: 'icon-button', label: 'opacity', value: '0.5', state: 'disabled' },
47
+ { part: 'icon-button', label: 'cursor.disabled', value: 'not-allowed', state: 'disabled' },
48
+ { part: 'icon-button', label: 'pointer-events', value: 'none', state: 'disabled' },
49
+ ],
50
+ features: [
51
+ 'forwardRef — accepts a ref to the underlying <button> element',
52
+ "size — same height tokens/scale as Button: s=24px, m=32px (default), l=40px; width always equals height",
53
+ 'isLoading — shows spinner in place of the icon, disables interaction, sets aria-busy',
54
+ 'icon — a single required Tabler icon slot, sized relative to the button (s→16, m→18, l→20)',
55
+ 'onClick — canonical handler (React\'s own; onClick is an anti-synonym, ADR-022)',
56
+ ],
57
+ examples: [
58
+ {
59
+ label: 'Default (ghost)',
60
+ code: `<IconButton icon={IconTrash} label="Delete item" />`,
61
+ },
62
+ {
63
+ label: 'Secondary, small',
64
+ code: `<IconButton icon={IconX} label="Dismiss" variant="secondary" size="s" />`,
65
+ },
66
+ {
67
+ label: 'Danger',
68
+ code: `<IconButton icon={IconTrash} label="Delete account" variant="danger" />`,
69
+ },
70
+ {
71
+ label: 'Loading state',
72
+ code: `<IconButton icon={IconRefresh} label="Refresh" isLoading />`,
73
+ },
74
+ ],
75
+ };
76
+ //# sourceMappingURL=IconButton.doc.js.map
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as React from 'react';
3
+ import { motion } from 'motion/react';
4
+ import { cn } from '../../lib/utils.js';
5
+ import { PRESS_SCALE_COMPACT } from '../../lib/motionPresets.js';
6
+ import { Icon } from '../Icon/index.js';
7
+ const ICON_SIZE_BY_BUTTON_SIZE = { s: 16, m: 18, l: 20 };
8
+ const Spinner = () => (_jsx("svg", { "data-helix-part": "icon-button-spinner", xmlns: "http://www.w3.org/2000/svg", width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": "true", children: _jsx("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }));
9
+ const IconButton = React.forwardRef(({ icon, label, variant = 'ghost', size = 'm', isLoading = false, className, disabled, onClick,
10
+ // Not forwarded to motion.button — same reason as Button (ADR-007): Motion's HTMLMotionProps
11
+ // redefines these native names for its own gesture/animation system.
12
+ style: _style, onDrag: _onDrag, onDragStart: _onDragStart, onDragEnd: _onDragEnd, onAnimationStart: _onAnimationStart, onAnimationEnd: _onAnimationEnd, onAnimationIteration: _onAnimationIteration, ...props }, ref) => {
13
+ const isDisabled = disabled || isLoading;
14
+ // `scale` (in whileTap below) is Motion's own animation-target key — a verify:props false positive,
15
+ // same category as Button.tsx's whileTap.
16
+ return (_jsx(motion.button, { ref: ref, "data-helix-part": "icon-button", "data-variant": variant, "data-size": size, "data-loading": isLoading ? 'true' : undefined, disabled: isDisabled, "aria-busy": isLoading ? 'true' : undefined, "aria-label": label, className: cn(className), onClick: onClick, transition: { duration: 0.1 }, ...(isDisabled ? {} : { whileTap: { scale: PRESS_SCALE_COMPACT } }), ...props, children: isLoading ? _jsx(Spinner, {}) : _jsx(Icon, { icon: icon, size: ICON_SIZE_BY_BUTTON_SIZE[size] }) }));
17
+ });
18
+ IconButton.displayName = 'IconButton';
19
+ export { IconButton };
20
+ //# sourceMappingURL=IconButton.js.map
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @helixds/react — agent note
3
+ * Before using IconButton, read its contract: node_modules/@helixds/react/dist/contracts/IconButton.json
4
+ * (every prop, which are required, when not to use it, the import line). Do not guess Helix props.
5
+ * Guide: node_modules/@helixds/react/AGENTS.md
6
+ */
7
+ import type * as React from 'react';
8
+ import type { HelixIconComponent } from '../Icon/index.js';
9
+ export type IconButtonVariant = 'primary' | 'secondary' | 'ghost' | 'danger';
10
+ export type IconButtonSize = 's' | 'm' | 'l';
11
+ export interface IconButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
12
+ /** The icon to render, passed by reference (e.g. IconTrash), not pre-instantiated. */
13
+ icon: HelixIconComponent;
14
+ /** Accessible name — required, since there's no visible text to describe the button. Rendered as aria-label. */
15
+ label: string;
16
+ /** Visual style. Default: 'ghost' — icon-only controls are almost always a secondary/utility action. */
17
+ variant?: IconButtonVariant;
18
+ /** Physical size — same scale and height tokens as Button. Width always equals height (square). Default: 'm' */
19
+ size?: IconButtonSize;
20
+ /** Async action in progress — shows a spinner in place of the icon, disables interaction. */
21
+ isLoading?: boolean;
22
+ /** Primary action handler — React's own `onClick` (ADR-022). `onPress` is an anti-synonym. */
23
+ onClick?: React.MouseEventHandler<HTMLButtonElement>;
24
+ }
25
+ //# sourceMappingURL=IconButton.types.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IconButton.types.js.map