@vokality/design-system 0.0.0-stage → 1.2.3

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 (350) hide show
  1. package/CHANGELOG.md +97 -0
  2. package/README.md +134 -2
  3. package/dist/charts/chart.d.ts +52 -0
  4. package/dist/charts/chart.js +108 -0
  5. package/dist/components/Accordion/Accordion.d.ts +15 -0
  6. package/dist/components/Accordion/Accordion.js +16 -0
  7. package/dist/components/Alert/Alert.d.ts +14 -0
  8. package/dist/components/Alert/Alert.js +12 -0
  9. package/dist/components/AppShell/AppShell.d.ts +21 -0
  10. package/dist/components/AppShell/AppShell.js +48 -0
  11. package/dist/components/Avatar/Avatar.d.ts +11 -0
  12. package/dist/components/Avatar/Avatar.js +19 -0
  13. package/dist/components/AvatarGroup/AvatarGroup.d.ts +11 -0
  14. package/dist/components/AvatarGroup/AvatarGroup.js +13 -0
  15. package/dist/components/Badge/Badge.d.ts +9 -0
  16. package/dist/components/Badge/Badge.js +6 -0
  17. package/dist/components/BarChart/BarChart.d.ts +7 -0
  18. package/dist/components/BarChart/BarChart.js +45 -0
  19. package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +11 -0
  20. package/dist/components/Breadcrumbs/Breadcrumbs.js +11 -0
  21. package/dist/components/Button/Button.d.ts +17 -0
  22. package/dist/components/Button/Button.js +23 -0
  23. package/dist/components/Calendar/Calendar.d.ts +21 -0
  24. package/dist/components/Calendar/Calendar.js +144 -0
  25. package/dist/components/Card/Card.d.ts +16 -0
  26. package/dist/components/Card/Card.js +11 -0
  27. package/dist/components/Checkbox/Checkbox.d.ts +12 -0
  28. package/dist/components/Checkbox/Checkbox.js +24 -0
  29. package/dist/components/Code/Code.d.ts +7 -0
  30. package/dist/components/Code/Code.js +6 -0
  31. package/dist/components/CodeBlock/CodeBlock.d.ts +10 -0
  32. package/dist/components/CodeBlock/CodeBlock.js +43 -0
  33. package/dist/components/Combobox/Combobox.d.ts +23 -0
  34. package/dist/components/Combobox/Combobox.js +188 -0
  35. package/dist/components/Combobox/ListPanel.d.ts +16 -0
  36. package/dist/components/Combobox/ListPanel.js +75 -0
  37. package/dist/components/CommandPalette/CommandPalette.d.ts +23 -0
  38. package/dist/components/CommandPalette/CommandPalette.js +86 -0
  39. package/dist/components/Container/Container.d.ts +10 -0
  40. package/dist/components/Container/Container.js +7 -0
  41. package/dist/components/ContextMenu/ContextMenu.d.ts +11 -0
  42. package/dist/components/ContextMenu/ContextMenu.js +56 -0
  43. package/dist/components/DatePicker/DatePicker.d.ts +25 -0
  44. package/dist/components/DatePicker/DatePicker.js +198 -0
  45. package/dist/components/DescriptionList/DescriptionList.d.ts +12 -0
  46. package/dist/components/DescriptionList/DescriptionList.js +6 -0
  47. package/dist/components/Dialog/Dialog.d.ts +23 -0
  48. package/dist/components/Dialog/Dialog.js +53 -0
  49. package/dist/components/Divider/Divider.d.ts +6 -0
  50. package/dist/components/Divider/Divider.js +10 -0
  51. package/dist/components/Drawer/Drawer.d.ts +6 -0
  52. package/dist/components/Drawer/Drawer.js +6 -0
  53. package/dist/components/EmptyState/EmptyState.d.ts +11 -0
  54. package/dist/components/EmptyState/EmptyState.js +10 -0
  55. package/dist/components/ErrorSummary/ErrorSummary.d.ts +10 -0
  56. package/dist/components/ErrorSummary/ErrorSummary.js +28 -0
  57. package/dist/components/FaqList/FaqList.d.ts +10 -0
  58. package/dist/components/FaqList/FaqList.js +6 -0
  59. package/dist/components/Field/Field.d.ts +12 -0
  60. package/dist/components/Field/Field.js +25 -0
  61. package/dist/components/Figure/Figure.d.ts +11 -0
  62. package/dist/components/Figure/Figure.js +6 -0
  63. package/dist/components/FileUpload/FileUpload.d.ts +25 -0
  64. package/dist/components/FileUpload/FileUpload.js +47 -0
  65. package/dist/components/Grid/Grid.d.ts +12 -0
  66. package/dist/components/Grid/Grid.js +10 -0
  67. package/dist/components/HatchDivider/HatchDivider.d.ts +2 -0
  68. package/dist/components/HatchDivider/HatchDivider.js +5 -0
  69. package/dist/components/Heading/Heading.d.ts +12 -0
  70. package/dist/components/Heading/Heading.js +11 -0
  71. package/dist/components/Icon/Icon.d.ts +8 -0
  72. package/dist/components/Icon/Icon.js +17 -0
  73. package/dist/components/IconButton/IconButton.d.ts +11 -0
  74. package/dist/components/IconButton/IconButton.js +16 -0
  75. package/dist/components/Inline/Inline.d.ts +13 -0
  76. package/dist/components/Inline/Inline.js +8 -0
  77. package/dist/components/Input/Input.d.ts +10 -0
  78. package/dist/components/Input/Input.js +25 -0
  79. package/dist/components/Kbd/Kbd.d.ts +7 -0
  80. package/dist/components/Kbd/Kbd.js +6 -0
  81. package/dist/components/LineChart/LineChart.d.ts +7 -0
  82. package/dist/components/LineChart/LineChart.js +53 -0
  83. package/dist/components/Link/Link.d.ts +7 -0
  84. package/dist/components/Link/Link.js +12 -0
  85. package/dist/components/LinkProvider/LinkProvider.d.ts +22 -0
  86. package/dist/components/LinkProvider/LinkProvider.js +21 -0
  87. package/dist/components/List/List.d.ts +24 -0
  88. package/dist/components/List/List.js +24 -0
  89. package/dist/components/MediaCard/MediaCard.d.ts +19 -0
  90. package/dist/components/MediaCard/MediaCard.js +25 -0
  91. package/dist/components/Menu/Menu.d.ts +14 -0
  92. package/dist/components/Menu/Menu.js +53 -0
  93. package/dist/components/Menu/entries.d.ts +40 -0
  94. package/dist/components/Menu/entries.js +146 -0
  95. package/dist/components/MultiSelect/MultiSelect.d.ts +24 -0
  96. package/dist/components/MultiSelect/MultiSelect.js +166 -0
  97. package/dist/components/NavList/NavList.d.ts +19 -0
  98. package/dist/components/NavList/NavList.js +10 -0
  99. package/dist/components/NumberInput/NumberInput.d.ts +13 -0
  100. package/dist/components/NumberInput/NumberInput.js +90 -0
  101. package/dist/components/OtpInput/OtpInput.d.ts +19 -0
  102. package/dist/components/OtpInput/OtpInput.js +75 -0
  103. package/dist/components/PageHeader/PageHeader.d.ts +18 -0
  104. package/dist/components/PageHeader/PageHeader.js +11 -0
  105. package/dist/components/Pagination/Pagination.d.ts +15 -0
  106. package/dist/components/Pagination/Pagination.js +22 -0
  107. package/dist/components/PasswordInput/PasswordInput.d.ts +7 -0
  108. package/dist/components/PasswordInput/PasswordInput.js +11 -0
  109. package/dist/components/Popover/Popover.d.ts +18 -0
  110. package/dist/components/Popover/Popover.js +26 -0
  111. package/dist/components/Progress/Progress.d.ts +13 -0
  112. package/dist/components/Progress/Progress.js +24 -0
  113. package/dist/components/Prose/Prose.d.ts +8 -0
  114. package/dist/components/Prose/Prose.js +7 -0
  115. package/dist/components/Quote/Quote.d.ts +10 -0
  116. package/dist/components/Quote/Quote.js +7 -0
  117. package/dist/components/Radio/Radio.d.ts +7 -0
  118. package/dist/components/Radio/Radio.js +9 -0
  119. package/dist/components/RadioGroup/RadioGroup.d.ts +21 -0
  120. package/dist/components/RadioGroup/RadioGroup.js +41 -0
  121. package/dist/components/SearchInput/SearchInput.d.ts +10 -0
  122. package/dist/components/SearchInput/SearchInput.js +39 -0
  123. package/dist/components/SectionHeader/SectionHeader.d.ts +10 -0
  124. package/dist/components/SectionHeader/SectionHeader.js +9 -0
  125. package/dist/components/SegmentedControl/SegmentedControl.d.ts +19 -0
  126. package/dist/components/SegmentedControl/SegmentedControl.js +21 -0
  127. package/dist/components/Select/Select.d.ts +26 -0
  128. package/dist/components/Select/Select.js +262 -0
  129. package/dist/components/Skeleton/Skeleton.d.ts +8 -0
  130. package/dist/components/Skeleton/Skeleton.js +13 -0
  131. package/dist/components/Slider/Slider.d.ts +21 -0
  132. package/dist/components/Slider/Slider.js +43 -0
  133. package/dist/components/Sparkline/Sparkline.d.ts +11 -0
  134. package/dist/components/Sparkline/Sparkline.js +15 -0
  135. package/dist/components/Spinner/Spinner.d.ts +8 -0
  136. package/dist/components/Spinner/Spinner.js +8 -0
  137. package/dist/components/SquareGlyph/SquareGlyph.d.ts +7 -0
  138. package/dist/components/SquareGlyph/SquareGlyph.js +6 -0
  139. package/dist/components/Stack/Stack.d.ts +11 -0
  140. package/dist/components/Stack/Stack.js +8 -0
  141. package/dist/components/Stat/Stat.d.ts +13 -0
  142. package/dist/components/Stat/Stat.js +22 -0
  143. package/dist/components/Steps/Steps.d.ts +13 -0
  144. package/dist/components/Steps/Steps.js +13 -0
  145. package/dist/components/Switch/Switch.d.ts +7 -0
  146. package/dist/components/Switch/Switch.js +16 -0
  147. package/dist/components/Table/Table.d.ts +48 -0
  148. package/dist/components/Table/Table.js +144 -0
  149. package/dist/components/Tabs/Tabs.d.ts +19 -0
  150. package/dist/components/Tabs/Tabs.js +29 -0
  151. package/dist/components/Tag/Tag.d.ts +12 -0
  152. package/dist/components/Tag/Tag.js +8 -0
  153. package/dist/components/Text/Text.d.ts +10 -0
  154. package/dist/components/Text/Text.js +7 -0
  155. package/dist/components/Textarea/Textarea.d.ts +6 -0
  156. package/dist/components/Textarea/Textarea.js +17 -0
  157. package/dist/components/ThemeScript/ThemeScript.d.ts +7 -0
  158. package/dist/components/ThemeScript/ThemeScript.js +9 -0
  159. package/dist/components/TileGrid/TileGrid.d.ts +13 -0
  160. package/dist/components/TileGrid/TileGrid.js +8 -0
  161. package/dist/components/TimePicker/TimePicker.d.ts +28 -0
  162. package/dist/components/TimePicker/TimePicker.js +192 -0
  163. package/dist/components/Timeline/Timeline.d.ts +16 -0
  164. package/dist/components/Timeline/Timeline.js +10 -0
  165. package/dist/components/Toaster/Toaster.d.ts +50 -0
  166. package/dist/components/Toaster/Toaster.js +63 -0
  167. package/dist/components/Tooltip/Tooltip.d.ts +11 -0
  168. package/dist/components/Tooltip/Tooltip.js +21 -0
  169. package/dist/components/TreeView/TreeView.d.ts +30 -0
  170. package/dist/components/TreeView/TreeView.js +127 -0
  171. package/dist/components.css +1798 -0
  172. package/dist/fonts/FONT-NOTICES.txt +20 -0
  173. package/dist/fonts/IBMPlexSans-Latin.woff2 +0 -0
  174. package/dist/fonts/IBMPlexSans-OFL.txt +93 -0
  175. package/dist/fonts/Manrope-Latin.woff2 +0 -0
  176. package/dist/fonts/Manrope-OFL.txt +93 -0
  177. package/dist/fonts/SpaceGrotesk-Latin.woff2 +0 -0
  178. package/dist/fonts/SpaceGrotesk-OFL.txt +93 -0
  179. package/dist/fonts.css +23 -0
  180. package/dist/hooks/useTheme.d.ts +16 -0
  181. package/dist/hooks/useTheme.js +82 -0
  182. package/dist/icons/arrow-down.svg +1 -0
  183. package/dist/icons/arrow-up-right.svg +1 -0
  184. package/dist/icons/arrow-up.svg +1 -0
  185. package/dist/icons/calendar.svg +1 -0
  186. package/dist/icons/chart.svg +1 -0
  187. package/dist/icons/check.svg +1 -0
  188. package/dist/icons/chevron-down.svg +1 -0
  189. package/dist/icons/chevron-left.svg +1 -0
  190. package/dist/icons/chevron-right.svg +1 -0
  191. package/dist/icons/chevrons-up-down.svg +1 -0
  192. package/dist/icons/circle-alert.svg +1 -0
  193. package/dist/icons/circle-check.svg +1 -0
  194. package/dist/icons/clock.svg +1 -0
  195. package/dist/icons/copy.svg +1 -0
  196. package/dist/icons/ellipsis.svg +1 -0
  197. package/dist/icons/file.svg +1 -0
  198. package/dist/icons/folder.svg +1 -0
  199. package/dist/icons/home.svg +1 -0
  200. package/dist/icons/info.svg +1 -0
  201. package/dist/icons/map-pin.svg +1 -0
  202. package/dist/icons/menu.svg +1 -0
  203. package/dist/icons/minus.svg +1 -0
  204. package/dist/icons/pencil.svg +1 -0
  205. package/dist/icons/phone.svg +1 -0
  206. package/dist/icons/plus.svg +1 -0
  207. package/dist/icons/quote.svg +1 -0
  208. package/dist/icons/search.svg +1 -0
  209. package/dist/icons/sidebar.svg +1 -0
  210. package/dist/icons/trash.svg +1 -0
  211. package/dist/icons/triangle-alert.svg +1 -0
  212. package/dist/icons/upload.svg +1 -0
  213. package/dist/icons/users.svg +1 -0
  214. package/dist/icons/x.svg +1 -0
  215. package/dist/index.d.ts +178 -0
  216. package/dist/index.js +93 -0
  217. package/dist/internal/CharCount.d.ts +17 -0
  218. package/dist/internal/CharCount.js +23 -0
  219. package/dist/internal/choice.d.ts +65 -0
  220. package/dist/internal/choice.js +111 -0
  221. package/dist/internal/focusables.d.ts +3 -0
  222. package/dist/internal/focusables.js +8 -0
  223. package/dist/internal/options.d.ts +15 -0
  224. package/dist/internal/options.js +30 -0
  225. package/dist/internal/status.d.ts +6 -0
  226. package/dist/internal/status.js +5 -0
  227. package/dist/internal/useIsoLayoutEffect.d.ts +3 -0
  228. package/dist/internal/useIsoLayoutEffect.js +4 -0
  229. package/dist/internal/useScrollActive.d.ts +3 -0
  230. package/dist/internal/useScrollActive.js +12 -0
  231. package/dist/internal/useUid.d.ts +2 -0
  232. package/dist/internal/useUid.js +6 -0
  233. package/dist/lib/cx.d.ts +2 -0
  234. package/dist/lib/cx.js +4 -0
  235. package/dist/lib/dates.d.ts +10 -0
  236. package/dist/lib/dates.js +107 -0
  237. package/dist/lib/format.d.ts +15 -0
  238. package/dist/lib/format.js +50 -0
  239. package/dist/lib/icons.d.ts +220 -0
  240. package/dist/lib/icons.js +54 -0
  241. package/dist/lib/intl.d.ts +4 -0
  242. package/dist/lib/intl.js +19 -0
  243. package/dist/lib/math.d.ts +5 -0
  244. package/dist/lib/math.js +36 -0
  245. package/dist/lib/omit.d.ts +2 -0
  246. package/dist/lib/omit.js +10 -0
  247. package/dist/lib/space.d.ts +4 -0
  248. package/dist/lib/space.js +9 -0
  249. package/dist/lib/text.d.ts +8 -0
  250. package/dist/lib/text.js +12 -0
  251. package/dist/lib/theme.d.ts +16 -0
  252. package/dist/lib/theme.js +14 -0
  253. package/dist/lib/utils.d.ts +17 -0
  254. package/dist/lib/utils.js +5 -0
  255. package/dist/tailwind.css +110 -0
  256. package/dist/tokens.css +316 -0
  257. package/dist/tokens.dtcg.json +1606 -0
  258. package/dist/tokens.json +1217 -0
  259. package/dist/types.d.ts +67 -0
  260. package/dist/types.js +1 -0
  261. package/dist/vokality.css +2139 -0
  262. package/dist/vokality.iife.js +19408 -0
  263. package/docs/brand.md +163 -0
  264. package/docs/components/Accordion/README.md +24 -0
  265. package/docs/components/Alert/README.md +31 -0
  266. package/docs/components/AppShell/README.md +20 -0
  267. package/docs/components/Avatar/README.md +17 -0
  268. package/docs/components/AvatarGroup/README.md +12 -0
  269. package/docs/components/Badge/README.md +24 -0
  270. package/docs/components/BarChart/README.md +30 -0
  271. package/docs/components/Breadcrumbs/README.md +16 -0
  272. package/docs/components/Button/README.md +43 -0
  273. package/docs/components/Calendar/README.md +43 -0
  274. package/docs/components/Card/README.md +16 -0
  275. package/docs/components/Checkbox/README.md +30 -0
  276. package/docs/components/Code/README.md +9 -0
  277. package/docs/components/CodeBlock/README.md +15 -0
  278. package/docs/components/Combobox/README.md +43 -0
  279. package/docs/components/CommandPalette/README.md +20 -0
  280. package/docs/components/Container/README.md +10 -0
  281. package/docs/components/ContextMenu/README.md +13 -0
  282. package/docs/components/Dashboard/README.md +12 -0
  283. package/docs/components/DatePicker/README.md +34 -0
  284. package/docs/components/DescriptionList/README.md +18 -0
  285. package/docs/components/Dialog/README.md +28 -0
  286. package/docs/components/Divider/README.md +15 -0
  287. package/docs/components/Drawer/README.md +16 -0
  288. package/docs/components/EmptyState/README.md +17 -0
  289. package/docs/components/ErrorPage/README.md +11 -0
  290. package/docs/components/ErrorSummary/README.md +16 -0
  291. package/docs/components/FaqList/README.md +11 -0
  292. package/docs/components/Field/README.md +27 -0
  293. package/docs/components/Figure/README.md +9 -0
  294. package/docs/components/FileUpload/README.md +20 -0
  295. package/docs/components/FormPage/README.md +11 -0
  296. package/docs/components/Grid/README.md +11 -0
  297. package/docs/components/HatchDivider/README.md +10 -0
  298. package/docs/components/Heading/README.md +10 -0
  299. package/docs/components/Icon/README.md +23 -0
  300. package/docs/components/IconButton/README.md +28 -0
  301. package/docs/components/Inline/README.md +9 -0
  302. package/docs/components/Input/README.md +31 -0
  303. package/docs/components/Kbd/README.md +13 -0
  304. package/docs/components/LineChart/README.md +27 -0
  305. package/docs/components/Link/README.md +31 -0
  306. package/docs/components/List/README.md +21 -0
  307. package/docs/components/ListDetail/README.md +11 -0
  308. package/docs/components/MediaCard/README.md +16 -0
  309. package/docs/components/Menu/README.md +45 -0
  310. package/docs/components/MultiSelect/README.md +41 -0
  311. package/docs/components/NavList/README.md +21 -0
  312. package/docs/components/NumberInput/README.md +19 -0
  313. package/docs/components/OtpInput/README.md +17 -0
  314. package/docs/components/PageHeader/README.md +17 -0
  315. package/docs/components/Pagination/README.md +22 -0
  316. package/docs/components/PasswordInput/README.md +13 -0
  317. package/docs/components/Popover/README.md +23 -0
  318. package/docs/components/Progress/README.md +19 -0
  319. package/docs/components/Prose/README.md +12 -0
  320. package/docs/components/Quote/README.md +13 -0
  321. package/docs/components/Radio/README.md +25 -0
  322. package/docs/components/RadioGroup/README.md +23 -0
  323. package/docs/components/SearchInput/README.md +23 -0
  324. package/docs/components/SectionHeader/README.md +14 -0
  325. package/docs/components/SegmentedControl/README.md +19 -0
  326. package/docs/components/Select/README.md +52 -0
  327. package/docs/components/SettingsPage/README.md +11 -0
  328. package/docs/components/SignIn/README.md +11 -0
  329. package/docs/components/Skeleton/README.md +16 -0
  330. package/docs/components/Slider/README.md +22 -0
  331. package/docs/components/Sparkline/README.md +13 -0
  332. package/docs/components/Spinner/README.md +16 -0
  333. package/docs/components/SquareGlyph/README.md +18 -0
  334. package/docs/components/Stack/README.md +11 -0
  335. package/docs/components/Stat/README.md +20 -0
  336. package/docs/components/Steps/README.md +22 -0
  337. package/docs/components/Switch/README.md +27 -0
  338. package/docs/components/Table/README.md +35 -0
  339. package/docs/components/Tabs/README.md +26 -0
  340. package/docs/components/Tag/README.md +21 -0
  341. package/docs/components/Text/README.md +11 -0
  342. package/docs/components/Textarea/README.md +20 -0
  343. package/docs/components/ThemeScript/README.md +47 -0
  344. package/docs/components/TileGrid/README.md +12 -0
  345. package/docs/components/TimePicker/README.md +19 -0
  346. package/docs/components/Timeline/README.md +12 -0
  347. package/docs/components/Toaster/README.md +34 -0
  348. package/docs/components/Tooltip/README.md +23 -0
  349. package/docs/components/TreeView/README.md +15 -0
  350. package/package.json +76 -4
@@ -0,0 +1,178 @@
1
+ /**
2
+ * @vokality/design-system: React components, tokens and helpers for Vokality projects.
3
+ * Each component is its own module (most are client components with "use client");
4
+ * bundlers keep only what an app imports. The helpers and ThemeScript are server-safe.
5
+ */
6
+ export { Button } from "./components/Button/Button.js";
7
+ export type * from "./components/Button/Button.js";
8
+ export { Icon } from "./components/Icon/Icon.js";
9
+ export type * from "./components/Icon/Icon.js";
10
+ export { SquareGlyph } from "./components/SquareGlyph/SquareGlyph.js";
11
+ export type * from "./components/SquareGlyph/SquareGlyph.js";
12
+ export { HatchDivider } from "./components/HatchDivider/HatchDivider.js";
13
+ export type * from "./components/HatchDivider/HatchDivider.js";
14
+ export { Divider } from "./components/Divider/Divider.js";
15
+ export type * from "./components/Divider/Divider.js";
16
+ export { SectionHeader } from "./components/SectionHeader/SectionHeader.js";
17
+ export type * from "./components/SectionHeader/SectionHeader.js";
18
+ export { Card } from "./components/Card/Card.js";
19
+ export type * from "./components/Card/Card.js";
20
+ export { MediaCard } from "./components/MediaCard/MediaCard.js";
21
+ export type * from "./components/MediaCard/MediaCard.js";
22
+ export { Badge } from "./components/Badge/Badge.js";
23
+ export type * from "./components/Badge/Badge.js";
24
+ export { Quote } from "./components/Quote/Quote.js";
25
+ export type * from "./components/Quote/Quote.js";
26
+ export { FaqList } from "./components/FaqList/FaqList.js";
27
+ export type * from "./components/FaqList/FaqList.js";
28
+ export { TileGrid } from "./components/TileGrid/TileGrid.js";
29
+ export type * from "./components/TileGrid/TileGrid.js";
30
+ export { IconButton } from "./components/IconButton/IconButton.js";
31
+ export type * from "./components/IconButton/IconButton.js";
32
+ export { Link } from "./components/Link/Link.js";
33
+ export type * from "./components/Link/Link.js";
34
+ export { Avatar } from "./components/Avatar/Avatar.js";
35
+ export type * from "./components/Avatar/Avatar.js";
36
+ export { Field } from "./components/Field/Field.js";
37
+ export type * from "./components/Field/Field.js";
38
+ export { Input } from "./components/Input/Input.js";
39
+ export type * from "./components/Input/Input.js";
40
+ export { Textarea } from "./components/Textarea/Textarea.js";
41
+ export type * from "./components/Textarea/Textarea.js";
42
+ export { Select } from "./components/Select/Select.js";
43
+ export type * from "./components/Select/Select.js";
44
+ export { Checkbox } from "./components/Checkbox/Checkbox.js";
45
+ export type * from "./components/Checkbox/Checkbox.js";
46
+ export { Radio } from "./components/Radio/Radio.js";
47
+ export type * from "./components/Radio/Radio.js";
48
+ export { RadioGroup } from "./components/RadioGroup/RadioGroup.js";
49
+ export type * from "./components/RadioGroup/RadioGroup.js";
50
+ export { Switch } from "./components/Switch/Switch.js";
51
+ export type * from "./components/Switch/Switch.js";
52
+ export { Tag } from "./components/Tag/Tag.js";
53
+ export type * from "./components/Tag/Tag.js";
54
+ export { SearchInput } from "./components/SearchInput/SearchInput.js";
55
+ export type * from "./components/SearchInput/SearchInput.js";
56
+ export { Combobox } from "./components/Combobox/Combobox.js";
57
+ export type * from "./components/Combobox/Combobox.js";
58
+ export { MultiSelect } from "./components/MultiSelect/MultiSelect.js";
59
+ export type * from "./components/MultiSelect/MultiSelect.js";
60
+ export { Calendar } from "./components/Calendar/Calendar.js";
61
+ export type * from "./components/Calendar/Calendar.js";
62
+ export { DatePicker } from "./components/DatePicker/DatePicker.js";
63
+ export type * from "./components/DatePicker/DatePicker.js";
64
+ export { Alert } from "./components/Alert/Alert.js";
65
+ export type * from "./components/Alert/Alert.js";
66
+ export { Toaster } from "./components/Toaster/Toaster.js";
67
+ export type * from "./components/Toaster/Toaster.js";
68
+ export { Tooltip } from "./components/Tooltip/Tooltip.js";
69
+ export type * from "./components/Tooltip/Tooltip.js";
70
+ export { Menu } from "./components/Menu/Menu.js";
71
+ export type * from "./components/Menu/Menu.js";
72
+ export { Popover } from "./components/Popover/Popover.js";
73
+ export type * from "./components/Popover/Popover.js";
74
+ export { Dialog } from "./components/Dialog/Dialog.js";
75
+ export type * from "./components/Dialog/Dialog.js";
76
+ export { Drawer } from "./components/Drawer/Drawer.js";
77
+ export type * from "./components/Drawer/Drawer.js";
78
+ export { Tabs } from "./components/Tabs/Tabs.js";
79
+ export type * from "./components/Tabs/Tabs.js";
80
+ export { SegmentedControl } from "./components/SegmentedControl/SegmentedControl.js";
81
+ export type * from "./components/SegmentedControl/SegmentedControl.js";
82
+ export { Breadcrumbs } from "./components/Breadcrumbs/Breadcrumbs.js";
83
+ export type * from "./components/Breadcrumbs/Breadcrumbs.js";
84
+ export { Pagination } from "./components/Pagination/Pagination.js";
85
+ export type * from "./components/Pagination/Pagination.js";
86
+ export { NavList } from "./components/NavList/NavList.js";
87
+ export type * from "./components/NavList/NavList.js";
88
+ export { Table } from "./components/Table/Table.js";
89
+ export type * from "./components/Table/Table.js";
90
+ export { Accordion } from "./components/Accordion/Accordion.js";
91
+ export type * from "./components/Accordion/Accordion.js";
92
+ export { Progress } from "./components/Progress/Progress.js";
93
+ export type * from "./components/Progress/Progress.js";
94
+ export { Spinner } from "./components/Spinner/Spinner.js";
95
+ export type * from "./components/Spinner/Spinner.js";
96
+ export { Skeleton } from "./components/Skeleton/Skeleton.js";
97
+ export type * from "./components/Skeleton/Skeleton.js";
98
+ export { EmptyState } from "./components/EmptyState/EmptyState.js";
99
+ export type * from "./components/EmptyState/EmptyState.js";
100
+ export { Steps } from "./components/Steps/Steps.js";
101
+ export type * from "./components/Steps/Steps.js";
102
+ export { Kbd } from "./components/Kbd/Kbd.js";
103
+ export type * from "./components/Kbd/Kbd.js";
104
+ export { DescriptionList } from "./components/DescriptionList/DescriptionList.js";
105
+ export type * from "./components/DescriptionList/DescriptionList.js";
106
+ export { Stat } from "./components/Stat/Stat.js";
107
+ export type * from "./components/Stat/Stat.js";
108
+ export { FileUpload } from "./components/FileUpload/FileUpload.js";
109
+ export type * from "./components/FileUpload/FileUpload.js";
110
+ export { Stack } from "./components/Stack/Stack.js";
111
+ export type * from "./components/Stack/Stack.js";
112
+ export { Inline } from "./components/Inline/Inline.js";
113
+ export type * from "./components/Inline/Inline.js";
114
+ export { Grid } from "./components/Grid/Grid.js";
115
+ export type * from "./components/Grid/Grid.js";
116
+ export { Container } from "./components/Container/Container.js";
117
+ export type * from "./components/Container/Container.js";
118
+ export { PageHeader } from "./components/PageHeader/PageHeader.js";
119
+ export type * from "./components/PageHeader/PageHeader.js";
120
+ export { AppShell } from "./components/AppShell/AppShell.js";
121
+ export type * from "./components/AppShell/AppShell.js";
122
+ export { PasswordInput } from "./components/PasswordInput/PasswordInput.js";
123
+ export type * from "./components/PasswordInput/PasswordInput.js";
124
+ export { NumberInput } from "./components/NumberInput/NumberInput.js";
125
+ export type * from "./components/NumberInput/NumberInput.js";
126
+ export { Slider } from "./components/Slider/Slider.js";
127
+ export type * from "./components/Slider/Slider.js";
128
+ export { OtpInput } from "./components/OtpInput/OtpInput.js";
129
+ export type * from "./components/OtpInput/OtpInput.js";
130
+ export { TimePicker } from "./components/TimePicker/TimePicker.js";
131
+ export type * from "./components/TimePicker/TimePicker.js";
132
+ export { ErrorSummary } from "./components/ErrorSummary/ErrorSummary.js";
133
+ export type * from "./components/ErrorSummary/ErrorSummary.js";
134
+ export { ContextMenu } from "./components/ContextMenu/ContextMenu.js";
135
+ export type * from "./components/ContextMenu/ContextMenu.js";
136
+ export { List } from "./components/List/List.js";
137
+ export type * from "./components/List/List.js";
138
+ export { ListItem } from "./components/List/List.js";
139
+ export { AvatarGroup } from "./components/AvatarGroup/AvatarGroup.js";
140
+ export type * from "./components/AvatarGroup/AvatarGroup.js";
141
+ export { Timeline } from "./components/Timeline/Timeline.js";
142
+ export type * from "./components/Timeline/Timeline.js";
143
+ export { TreeView } from "./components/TreeView/TreeView.js";
144
+ export type * from "./components/TreeView/TreeView.js";
145
+ export { Heading } from "./components/Heading/Heading.js";
146
+ export type * from "./components/Heading/Heading.js";
147
+ export { Text } from "./components/Text/Text.js";
148
+ export type * from "./components/Text/Text.js";
149
+ export { Prose } from "./components/Prose/Prose.js";
150
+ export type * from "./components/Prose/Prose.js";
151
+ export { Code } from "./components/Code/Code.js";
152
+ export type * from "./components/Code/Code.js";
153
+ export { CodeBlock } from "./components/CodeBlock/CodeBlock.js";
154
+ export type * from "./components/CodeBlock/CodeBlock.js";
155
+ export { Figure } from "./components/Figure/Figure.js";
156
+ export type * from "./components/Figure/Figure.js";
157
+ export { CommandPalette } from "./components/CommandPalette/CommandPalette.js";
158
+ export type * from "./components/CommandPalette/CommandPalette.js";
159
+ export { BarChart } from "./components/BarChart/BarChart.js";
160
+ export type * from "./components/BarChart/BarChart.js";
161
+ export { LineChart } from "./components/LineChart/LineChart.js";
162
+ export type * from "./components/LineChart/LineChart.js";
163
+ export { Sparkline } from "./components/Sparkline/Sparkline.js";
164
+ export type * from "./components/Sparkline/Sparkline.js";
165
+ export { toast } from "./components/Toaster/Toaster.js";
166
+ export { useTheme } from "./hooks/useTheme.js";
167
+ export { LinkProvider } from "./components/LinkProvider/LinkProvider.js";
168
+ export type * from "./components/LinkProvider/LinkProvider.js";
169
+ export { ThemeScript } from "./components/ThemeScript/ThemeScript.js";
170
+ export type * from "./components/ThemeScript/ThemeScript.js";
171
+ export { formatCurrency, formatNumber, formatPercent, formatDate, LOCALES as locales } from "./lib/format.js";
172
+ export type { NumberOptions, DateOptions } from "./lib/format.js";
173
+ export { utils } from "./lib/utils.js";
174
+ export { ICONS as iconData } from "./lib/icons.js";
175
+ export type { IconDef, IconCircle } from "./lib/icons.js";
176
+ export { themeScript, THEMES as themes } from "./lib/theme.js";
177
+ export type { Theme, ThemeOptions } from "./lib/theme.js";
178
+ export type * from "./types.js";
package/dist/index.js ADDED
@@ -0,0 +1,93 @@
1
+ /**
2
+ * @vokality/design-system: React components, tokens and helpers for Vokality projects.
3
+ * Each component is its own module (most are client components with "use client");
4
+ * bundlers keep only what an app imports. The helpers and ThemeScript are server-safe.
5
+ */
6
+ export { Button } from "./components/Button/Button.js";
7
+ export { Icon } from "./components/Icon/Icon.js";
8
+ export { SquareGlyph } from "./components/SquareGlyph/SquareGlyph.js";
9
+ export { HatchDivider } from "./components/HatchDivider/HatchDivider.js";
10
+ export { Divider } from "./components/Divider/Divider.js";
11
+ export { SectionHeader } from "./components/SectionHeader/SectionHeader.js";
12
+ export { Card } from "./components/Card/Card.js";
13
+ export { MediaCard } from "./components/MediaCard/MediaCard.js";
14
+ export { Badge } from "./components/Badge/Badge.js";
15
+ export { Quote } from "./components/Quote/Quote.js";
16
+ export { FaqList } from "./components/FaqList/FaqList.js";
17
+ export { TileGrid } from "./components/TileGrid/TileGrid.js";
18
+ export { IconButton } from "./components/IconButton/IconButton.js";
19
+ export { Link } from "./components/Link/Link.js";
20
+ export { Avatar } from "./components/Avatar/Avatar.js";
21
+ export { Field } from "./components/Field/Field.js";
22
+ export { Input } from "./components/Input/Input.js";
23
+ export { Textarea } from "./components/Textarea/Textarea.js";
24
+ export { Select } from "./components/Select/Select.js";
25
+ export { Checkbox } from "./components/Checkbox/Checkbox.js";
26
+ export { Radio } from "./components/Radio/Radio.js";
27
+ export { RadioGroup } from "./components/RadioGroup/RadioGroup.js";
28
+ export { Switch } from "./components/Switch/Switch.js";
29
+ export { Tag } from "./components/Tag/Tag.js";
30
+ export { SearchInput } from "./components/SearchInput/SearchInput.js";
31
+ export { Combobox } from "./components/Combobox/Combobox.js";
32
+ export { MultiSelect } from "./components/MultiSelect/MultiSelect.js";
33
+ export { Calendar } from "./components/Calendar/Calendar.js";
34
+ export { DatePicker } from "./components/DatePicker/DatePicker.js";
35
+ export { Alert } from "./components/Alert/Alert.js";
36
+ export { Toaster } from "./components/Toaster/Toaster.js";
37
+ export { Tooltip } from "./components/Tooltip/Tooltip.js";
38
+ export { Menu } from "./components/Menu/Menu.js";
39
+ export { Popover } from "./components/Popover/Popover.js";
40
+ export { Dialog } from "./components/Dialog/Dialog.js";
41
+ export { Drawer } from "./components/Drawer/Drawer.js";
42
+ export { Tabs } from "./components/Tabs/Tabs.js";
43
+ export { SegmentedControl } from "./components/SegmentedControl/SegmentedControl.js";
44
+ export { Breadcrumbs } from "./components/Breadcrumbs/Breadcrumbs.js";
45
+ export { Pagination } from "./components/Pagination/Pagination.js";
46
+ export { NavList } from "./components/NavList/NavList.js";
47
+ export { Table } from "./components/Table/Table.js";
48
+ export { Accordion } from "./components/Accordion/Accordion.js";
49
+ export { Progress } from "./components/Progress/Progress.js";
50
+ export { Spinner } from "./components/Spinner/Spinner.js";
51
+ export { Skeleton } from "./components/Skeleton/Skeleton.js";
52
+ export { EmptyState } from "./components/EmptyState/EmptyState.js";
53
+ export { Steps } from "./components/Steps/Steps.js";
54
+ export { Kbd } from "./components/Kbd/Kbd.js";
55
+ export { DescriptionList } from "./components/DescriptionList/DescriptionList.js";
56
+ export { Stat } from "./components/Stat/Stat.js";
57
+ export { FileUpload } from "./components/FileUpload/FileUpload.js";
58
+ export { Stack } from "./components/Stack/Stack.js";
59
+ export { Inline } from "./components/Inline/Inline.js";
60
+ export { Grid } from "./components/Grid/Grid.js";
61
+ export { Container } from "./components/Container/Container.js";
62
+ export { PageHeader } from "./components/PageHeader/PageHeader.js";
63
+ export { AppShell } from "./components/AppShell/AppShell.js";
64
+ export { PasswordInput } from "./components/PasswordInput/PasswordInput.js";
65
+ export { NumberInput } from "./components/NumberInput/NumberInput.js";
66
+ export { Slider } from "./components/Slider/Slider.js";
67
+ export { OtpInput } from "./components/OtpInput/OtpInput.js";
68
+ export { TimePicker } from "./components/TimePicker/TimePicker.js";
69
+ export { ErrorSummary } from "./components/ErrorSummary/ErrorSummary.js";
70
+ export { ContextMenu } from "./components/ContextMenu/ContextMenu.js";
71
+ export { List } from "./components/List/List.js";
72
+ export { ListItem } from "./components/List/List.js";
73
+ export { AvatarGroup } from "./components/AvatarGroup/AvatarGroup.js";
74
+ export { Timeline } from "./components/Timeline/Timeline.js";
75
+ export { TreeView } from "./components/TreeView/TreeView.js";
76
+ export { Heading } from "./components/Heading/Heading.js";
77
+ export { Text } from "./components/Text/Text.js";
78
+ export { Prose } from "./components/Prose/Prose.js";
79
+ export { Code } from "./components/Code/Code.js";
80
+ export { CodeBlock } from "./components/CodeBlock/CodeBlock.js";
81
+ export { Figure } from "./components/Figure/Figure.js";
82
+ export { CommandPalette } from "./components/CommandPalette/CommandPalette.js";
83
+ export { BarChart } from "./components/BarChart/BarChart.js";
84
+ export { LineChart } from "./components/LineChart/LineChart.js";
85
+ export { Sparkline } from "./components/Sparkline/Sparkline.js";
86
+ export { toast } from "./components/Toaster/Toaster.js";
87
+ export { useTheme } from "./hooks/useTheme.js";
88
+ export { LinkProvider } from "./components/LinkProvider/LinkProvider.js";
89
+ export { ThemeScript } from "./components/ThemeScript/ThemeScript.js";
90
+ export { formatCurrency, formatNumber, formatPercent, formatDate, LOCALES as locales } from "./lib/format.js";
91
+ export { utils } from "./lib/utils.js";
92
+ export { ICONS as iconData } from "./lib/icons.js";
93
+ export { themeScript, THEMES as themes } from "./lib/theme.js";
@@ -0,0 +1,17 @@
1
+ import { type ChangeEvent } from "react";
2
+ /** "12 / 280" under a field; announces the characters left once 90% are used. */
3
+ export declare function CharCount({ value, max }: {
4
+ value: string | number | readonly string[] | undefined;
5
+ max: number;
6
+ }): import("react/jsx-runtime").JSX.Element;
7
+ type TextElement = HTMLInputElement | HTMLTextAreaElement;
8
+ /** The text of an input that may be controlled (value) or not (defaultValue), so a counter can follow it. */
9
+ export declare function useControlledText<E extends TextElement>(props: {
10
+ value?: string | number | readonly string[];
11
+ defaultValue?: string | number | readonly string[];
12
+ onChange?: (e: ChangeEvent<E>) => void;
13
+ }): {
14
+ value: string | number | readonly string[] | undefined;
15
+ onChange: (e: ChangeEvent<E>) => void;
16
+ };
17
+ export {};
@@ -0,0 +1,23 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useState } from "react";
4
+ import { cx } from "../lib/cx.js";
5
+ /** "12 / 280" under a field; announces the characters left once 90% are used. */
6
+ export function CharCount({ value, max }) {
7
+ const n = String(value || "").length;
8
+ const near = n >= max * 0.9;
9
+ return (_jsxs("span", { className: cx("vk-char-count", n > max && "vk-char-count-over"), "aria-live": near ? "polite" : "off", children: [_jsx("span", { className: "vk-sr-only", children: near ? (max - n >= 0 ? max - n + " characters left" : n - max + " characters over") : "" }), _jsx("span", { "aria-hidden": "true", children: n + " / " + max })] }));
10
+ }
11
+ /** The text of an input that may be controlled (value) or not (defaultValue), so a counter can follow it. */
12
+ export function useControlledText(props) {
13
+ const controlled = props.value !== undefined;
14
+ const [text, setText] = useState(props.defaultValue != null ? String(props.defaultValue) : "");
15
+ return {
16
+ value: controlled ? props.value : text,
17
+ onChange: (e) => {
18
+ if (!controlled)
19
+ setText(e.target.value);
20
+ props.onChange?.(e);
21
+ },
22
+ };
23
+ }
@@ -0,0 +1,65 @@
1
+ import { type ChangeEvent, type FocusEvent, type KeyboardEvent, type MouseEvent, type ReactNode, type SyntheticEvent } from "react";
2
+ import type { CheckboxProps } from "../components/Checkbox/Checkbox.js";
3
+ interface ChoiceLabelProps {
4
+ label: ReactNode;
5
+ description?: ReactNode;
6
+ hideLabel?: boolean;
7
+ disabled?: boolean;
8
+ className?: string;
9
+ /** The control's own class on the label, e.g. "vk-switch". */
10
+ kind?: string;
11
+ /** The control: a Radix Checkbox, Switch or RadioGroup item, or a native radio. */
12
+ children: ReactNode;
13
+ }
14
+ /** The label around a choice control, then its label and description; clicking anywhere on it toggles the control. */
15
+ export declare function ChoiceLabel(props: ChoiceLabelProps): import("react/jsx-runtime").JSX.Element;
16
+ /** The accessible name when the visible label is hidden (React stringifies attribute values the same way). */
17
+ export declare function hiddenLabel(props: {
18
+ label: ReactNode;
19
+ hideLabel?: boolean;
20
+ }): string | undefined;
21
+ /** The checkbox tick, or a dash when indeterminate. */
22
+ export declare function checkMark(mixed: boolean): import("react/jsx-runtime").JSX.Element;
23
+ /** What a native checkbox or radio would report as its event target. */
24
+ export interface ChoiceTarget {
25
+ type: "checkbox" | "radio";
26
+ checked: boolean;
27
+ value: string;
28
+ name?: string;
29
+ }
30
+ /**
31
+ * The change event for a Radix choice control, so `onChange` handlers written for a native input keep working.
32
+ * It is the click that changed the control, with `type: "change"` and a target that is the control element
33
+ * reading `checked`, `value`, `name` and `type` as the native input would.
34
+ */
35
+ export declare function choiceChangeEvent(click: SyntheticEvent, control: HTMLElement, input: ChoiceTarget): ChangeEvent<HTMLInputElement>;
36
+ /**
37
+ * Checked state for a Radix Checkbox or Switch with the native input's API: `checked` or `defaultChecked`, and
38
+ * `onChange` with an event. Radix is always controlled from here, so its onCheckedChange runs inside the click.
39
+ */
40
+ export declare function useChoiceToggle(props: CheckboxProps): {
41
+ checked: boolean;
42
+ /** Runs before Radix's own click handler; a prevented click does not toggle, as natively. */
43
+ onClick(e: MouseEvent<HTMLButtonElement>): void;
44
+ /** For Radix's onCheckedChange: true after a click; false when the form was reset, which (as natively) fires no change. */
45
+ change(): boolean;
46
+ };
47
+ /**
48
+ * Selection follows focus on arrow keys in a Radix RadioGroup even when the key is released at once. Radix moves
49
+ * focus on a timer and checks the focused radio only if the key is still down then, so a quick press (some assistive
50
+ * tech, scripted input) moved focus without selecting. Spread `group` on the Root and `item` on each Item.
51
+ */
52
+ export declare function useArrowSelect(): {
53
+ group: {
54
+ onKeyDown(e: KeyboardEvent): void;
55
+ onKeyUp(): void;
56
+ onBlur(e: FocusEvent<HTMLElement>): void;
57
+ onPointerDown(): void;
58
+ };
59
+ item: {
60
+ onFocus(e: FocusEvent<HTMLButtonElement>): void;
61
+ };
62
+ };
63
+ /** A standalone Radio: a native radio under a drawn box (Radix radios only work inside a RadioGroup). */
64
+ export declare function nativeRadio(props: CheckboxProps): import("react/jsx-runtime").JSX.Element;
65
+ export {};
@@ -0,0 +1,111 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useRef, useState } from "react";
4
+ import { CHECK_PATH } from "./status.js";
5
+ import { cx } from "../lib/cx.js";
6
+ import { omit } from "../lib/omit.js";
7
+ /** The label around a choice control, then its label and description; clicking anywhere on it toggles the control. */
8
+ export function ChoiceLabel(props) {
9
+ return (_jsxs("label", { className: cx("vk-choice", props.kind, props.disabled && "vk-choice-disabled", props.className), children: [props.children, props.hideLabel ? null : (_jsxs("span", { className: "vk-choice-text", children: [_jsx("span", { className: "vk-choice-label", children: props.label }), props.description ? _jsx("span", { className: "vk-choice-description", children: props.description }) : null] }))] }));
10
+ }
11
+ /** The accessible name when the visible label is hidden (React stringifies attribute values the same way). */
12
+ export function hiddenLabel(props) {
13
+ return props.hideLabel && props.label != null ? String(props.label) : undefined;
14
+ }
15
+ /** The checkbox tick, or a dash when indeterminate. */
16
+ export function checkMark(mixed) {
17
+ return (_jsx("svg", { className: "vk-choice-mark", viewBox: "0 0 16 16", width: 12, height: 12, fill: "none", "aria-hidden": "true", children: _jsx("path", { d: mixed ? "M4 8h8" : CHECK_PATH, stroke: "currentColor", strokeWidth: 2, strokeLinecap: "square" }) }));
18
+ }
19
+ /**
20
+ * The change event for a Radix choice control, so `onChange` handlers written for a native input keep working.
21
+ * It is the click that changed the control, with `type: "change"` and a target that is the control element
22
+ * reading `checked`, `value`, `name` and `type` as the native input would.
23
+ */
24
+ export function choiceChangeEvent(click, control, input) {
25
+ const own = input;
26
+ const target = new Proxy(control, {
27
+ get(el, key) {
28
+ if (Object.prototype.hasOwnProperty.call(own, key))
29
+ return own[key];
30
+ const v = Reflect.get(el, key, el);
31
+ return typeof v === "function" ? v.bind(el) : v;
32
+ },
33
+ set: (el, key, v) => Reflect.set(el, key, v, el),
34
+ });
35
+ return Object.assign(Object.create(click), { type: "change", target, currentTarget: target });
36
+ }
37
+ /**
38
+ * Checked state for a Radix Checkbox or Switch with the native input's API: `checked` or `defaultChecked`, and
39
+ * `onChange` with an event. Radix is always controlled from here, so its onCheckedChange runs inside the click.
40
+ */
41
+ export function useChoiceToggle(props) {
42
+ const controlled = props.checked !== undefined;
43
+ const [own, setOwn] = useState(Boolean(props.defaultChecked));
44
+ const checked = controlled ? Boolean(props.checked) : own;
45
+ const click = useRef(null);
46
+ return {
47
+ checked,
48
+ /** Runs before Radix's own click handler; a prevented click does not toggle, as natively. */
49
+ onClick(e) {
50
+ props.onClick?.(e);
51
+ click.current = e.defaultPrevented ? null : { event: e, control: e.currentTarget };
52
+ },
53
+ /** For Radix's onCheckedChange: true after a click; false when the form was reset, which (as natively) fires no change. */
54
+ change() {
55
+ const c = click.current;
56
+ click.current = null;
57
+ if (!c) {
58
+ if (!controlled)
59
+ setOwn(Boolean(props.defaultChecked));
60
+ return false;
61
+ }
62
+ const next = !checked;
63
+ if (!controlled)
64
+ setOwn(next);
65
+ props.onChange?.(choiceChangeEvent(c.event, c.control, { type: "checkbox", checked: next, value: c.control.value, name: props.name }));
66
+ return true;
67
+ },
68
+ };
69
+ }
70
+ const ARROWS = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"];
71
+ /**
72
+ * Selection follows focus on arrow keys in a Radix RadioGroup even when the key is released at once. Radix moves
73
+ * focus on a timer and checks the focused radio only if the key is still down then, so a quick press (some assistive
74
+ * tech, scripted input) moved focus without selecting. Spread `group` on the Root and `item` on each Item.
75
+ */
76
+ export function useArrowSelect() {
77
+ const pending = useRef(false), held = useRef(false);
78
+ return {
79
+ group: {
80
+ onKeyDown(e) {
81
+ pending.current = held.current = ARROWS.includes(e.key);
82
+ },
83
+ onKeyUp() {
84
+ held.current = false;
85
+ },
86
+ // An arrow key that moved nowhere must not select whatever is focused next.
87
+ onBlur(e) {
88
+ if (!e.currentTarget.contains(e.relatedTarget))
89
+ pending.current = false;
90
+ },
91
+ onPointerDown() {
92
+ pending.current = false;
93
+ },
94
+ },
95
+ item: {
96
+ onFocus(e) {
97
+ if (!pending.current)
98
+ return;
99
+ pending.current = false;
100
+ // While the key is held, Radix's own focus handler checks the radio.
101
+ if (!held.current)
102
+ e.currentTarget.click();
103
+ },
104
+ },
105
+ };
106
+ }
107
+ /** A standalone Radio: a native radio under a drawn box (Radix radios only work inside a RadioGroup). */
108
+ export function nativeRadio(props) {
109
+ const rest = omit(props, ["label", "description", "className", "indeterminate", "hideLabel"]);
110
+ return (_jsxs(ChoiceLabel, { label: props.label, description: props.description, hideLabel: props.hideLabel, disabled: props.disabled, className: props.className, children: [_jsx("input", { type: "radio", className: "vk-choice-input", "aria-label": hiddenLabel(props), ...rest }), _jsx("span", { className: "vk-choice-box vk-choice-box-radio", "aria-hidden": "true", children: _jsx("span", { className: "vk-choice-dot", "aria-hidden": "true" }) })] }));
111
+ }
@@ -0,0 +1,3 @@
1
+ export declare const FOCUSABLE = "a[href],button:not([disabled]),input:not([disabled]):not([type=\"hidden\"]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex=\"-1\"])";
2
+ /** The visible, focusable elements inside `el`, in DOM order. */
3
+ export declare function focusables(el: Element | null | undefined): HTMLElement[];
@@ -0,0 +1,8 @@
1
+ "use client";
2
+ export const FOCUSABLE = 'a[href],button:not([disabled]),input:not([disabled]):not([type="hidden"]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])';
3
+ /** The visible, focusable elements inside `el`, in DOM order. */
4
+ export function focusables(el) {
5
+ if (!el)
6
+ return [];
7
+ return Array.from(el.querySelectorAll(FOCUSABLE)).filter((n) => n.offsetParent !== null || n === document.activeElement);
8
+ }
@@ -0,0 +1,15 @@
1
+ import type { ReactNode } from "react";
2
+ import type { SelectOption } from "../types.js";
3
+ /** Options may be plain strings; components work with { value, label }. */
4
+ export declare function normalizeOptions<T extends {
5
+ value: string;
6
+ label: ReactNode;
7
+ } = SelectOption>(list: ReadonlyArray<string | T> | undefined): T[];
8
+ /** The next enabled option from `from` in direction `dir`, or -1. */
9
+ export declare function nextEnabled(list: ReadonlyArray<{
10
+ disabled?: boolean;
11
+ }>, from: number, dir: 1 | -1): number;
12
+ /** The label with the matched part wrapped in <mark>. */
13
+ export declare function highlight(label: ReactNode, query: string): ReactNode;
14
+ /** Whether the option's label or description contains the query (case-insensitive). */
15
+ export declare function matches(o: SelectOption, query: string): boolean;
@@ -0,0 +1,30 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /** Options may be plain strings; components work with { value, label }. */
3
+ export function normalizeOptions(list) {
4
+ // T's fields beyond value and label are optional, so { value, label } is a valid T.
5
+ return (list || []).map((o) => (typeof o === "string" ? { value: o, label: o } : o));
6
+ }
7
+ /** The next enabled option from `from` in direction `dir`, or -1. */
8
+ export function nextEnabled(list, from, dir) {
9
+ for (let i = from; i >= 0 && i < list.length; i += dir)
10
+ if (!list[i].disabled)
11
+ return i;
12
+ return -1;
13
+ }
14
+ /** The label with the matched part wrapped in <mark>. */
15
+ export function highlight(label, query) {
16
+ const text = String(label);
17
+ if (!query)
18
+ return text;
19
+ const at = text.toLowerCase().indexOf(query.toLowerCase());
20
+ if (at < 0)
21
+ return text;
22
+ return [text.slice(0, at), _jsx("mark", { className: "vk-match", children: text.slice(at, at + query.length) }, "m"), text.slice(at + query.length)];
23
+ }
24
+ /** Whether the option's label or description contains the query (case-insensitive). */
25
+ export function matches(o, query) {
26
+ if (!query)
27
+ return true;
28
+ const q = query.toLowerCase();
29
+ return String(o.label).toLowerCase().includes(q) || Boolean(o.description && String(o.description).toLowerCase().includes(q));
30
+ }
@@ -0,0 +1,6 @@
1
+ import type { IconName, Status } from "../types.js";
2
+ /** The checkbox tick. */
3
+ export declare const CHECK_PATH = "M4 8.5 6.75 11.25 12 5";
4
+ export declare const STATUS_ICON: Record<Status, IconName>;
5
+ /** Announced before status text, so color is never the only signal. */
6
+ export declare const STATUS_WORD: Record<Status, string>;
@@ -0,0 +1,5 @@
1
+ /** The checkbox tick. */
2
+ export const CHECK_PATH = "M4 8.5 6.75 11.25 12 5";
3
+ export const STATUS_ICON = { info: "info", success: "circle-check", warning: "triangle-alert", danger: "circle-alert" };
4
+ /** Announced before status text, so color is never the only signal. */
5
+ export const STATUS_WORD = { info: "Info", success: "Success", warning: "Warning", danger: "Error" };
@@ -0,0 +1,3 @@
1
+ import { useLayoutEffect } from "react";
2
+ /** useLayoutEffect in the browser; useEffect during server rendering, where useLayoutEffect warns. */
3
+ export declare const useIsoLayoutEffect: typeof useLayoutEffect;
@@ -0,0 +1,4 @@
1
+ "use client";
2
+ import { useEffect, useLayoutEffect } from "react";
3
+ /** useLayoutEffect in the browser; useEffect during server rendering, where useLayoutEffect warns. */
4
+ export const useIsoLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
@@ -0,0 +1,3 @@
1
+ import { type RefObject } from "react";
2
+ /** Keeps the active option (data-index) scrolled into view in an open list. */
3
+ export declare function useScrollActive(open: boolean, listRef: RefObject<HTMLElement | null>, active: number): void;
@@ -0,0 +1,12 @@
1
+ "use client";
2
+ import { useEffect } from "react";
3
+ /** Keeps the active option (data-index) scrolled into view in an open list. */
4
+ export function useScrollActive(open, listRef, active) {
5
+ useEffect(() => {
6
+ if (!open || !listRef.current || active < 0)
7
+ return;
8
+ const el = listRef.current.querySelector(`[data-index="${active}"]`);
9
+ if (el && el.scrollIntoView)
10
+ el.scrollIntoView({ block: "nearest" });
11
+ }, [open, listRef, active]);
12
+ }
@@ -0,0 +1,2 @@
1
+ /** Ids that match between server and client rendering, safe to use in CSS selectors: "vk-select-r0". */
2
+ export declare function useUid(prefix: string): string;
@@ -0,0 +1,6 @@
1
+ "use client";
2
+ import { useId } from "react";
3
+ /** Ids that match between server and client rendering, safe to use in CSS selectors: "vk-select-r0". */
4
+ export function useUid(prefix) {
5
+ return prefix + "-" + useId().replace(/[^A-Za-z0-9_-]/g, "");
6
+ }
@@ -0,0 +1,2 @@
1
+ /** Joins the truthy class names: cx("a", cond && "b", null) → "a b". */
2
+ export declare function cx(...names: Array<string | false | null | undefined>): string;
package/dist/lib/cx.js ADDED
@@ -0,0 +1,4 @@
1
+ /** Joins the truthy class names: cx("a", cond && "b", null) → "a b". */
2
+ export function cx(...names) {
3
+ return names.filter(Boolean).join(" ");
4
+ }
@@ -0,0 +1,10 @@
1
+ export declare function pad2(n: number): string;
2
+ export declare function toISO(d: Date): string;
3
+ export declare function parseISO(s: string | Date | null | undefined): Date | null;
4
+ export declare function addDays(d: Date, n: number): Date;
5
+ export declare function addMonths(d: Date, n: number): Date;
6
+ export declare function sameDay(a: Date | null | undefined, b: Date | null | undefined): boolean;
7
+ export declare function clampDate(d: Date, min: Date | null | undefined, max: Date | null | undefined): Date;
8
+ export declare function parseTime(text: string | null | undefined): string | null;
9
+ export declare function formatTime(value: string | null | undefined, locale?: string): string;
10
+ export declare function parseDateInput(text: string | null | undefined, locale?: string): string | null;