@primecoderin/fast-ui-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 (354) hide show
  1. package/CHANGELOG.md +90 -0
  2. package/LICENSE +21 -0
  3. package/README.md +180 -3
  4. package/dist/_virtual/_rolldown/runtime.js +12 -0
  5. package/dist/charts.d.ts +7 -0
  6. package/dist/charts.js +7 -0
  7. package/dist/components/Avatar/Avatar.d.ts +12 -0
  8. package/dist/components/Avatar/Avatar.js +92 -0
  9. package/dist/components/Button/Button.d.ts +44 -0
  10. package/dist/components/Button/Button.js +221 -0
  11. package/dist/components/Checkbox/CheckboxBox.d.ts +33 -0
  12. package/dist/components/Checkbox/CheckboxBox.js +148 -0
  13. package/dist/components/CodeSnippet/CodeSnippet.d.ts +26 -0
  14. package/dist/components/CodeSnippet/CodeSnippet.js +153 -0
  15. package/dist/components/Collapsible/Collapsible.d.ts +20 -0
  16. package/dist/components/Collapsible/Collapsible.js +97 -0
  17. package/dist/components/Container/Container.d.ts +301 -0
  18. package/dist/components/Container/Container.js +20 -0
  19. package/dist/components/FloatingActionButton/FloatingActionButton.d.ts +22 -0
  20. package/dist/components/FloatingActionButton/FloatingActionButton.js +141 -0
  21. package/dist/components/Grid/Grid.d.ts +311 -0
  22. package/dist/components/Grid/Grid.js +30 -0
  23. package/dist/components/IconTile/IconTile.d.ts +12 -0
  24. package/dist/components/IconTile/IconTile.js +70 -0
  25. package/dist/components/InlineError/InlineError.d.ts +9 -0
  26. package/dist/components/InlineError/InlineError.js +62 -0
  27. package/dist/components/Kbd/Kbd.d.ts +11 -0
  28. package/dist/components/Kbd/Kbd.js +31 -0
  29. package/dist/components/Link/Link.d.ts +18 -0
  30. package/dist/components/Link/Link.js +68 -0
  31. package/dist/components/Menu/ContextMenu.d.ts +18 -0
  32. package/dist/components/Menu/ContextMenu.js +68 -0
  33. package/dist/components/Menu/Menu.d.ts +86 -0
  34. package/dist/components/Menu/Menu.js +394 -0
  35. package/dist/components/OtpInput/OtpInput.d.ts +32 -0
  36. package/dist/components/OtpInput/OtpInput.js +177 -0
  37. package/dist/components/Popover/HoverPopover.d.ts +22 -0
  38. package/dist/components/Popover/HoverPopover.js +74 -0
  39. package/dist/components/Popover/Popover.d.ts +21 -0
  40. package/dist/components/Popover/Popover.js +64 -0
  41. package/dist/components/ProgressBar/ProgressBar.d.ts +17 -0
  42. package/dist/components/ProgressBar/ProgressBar.js +44 -0
  43. package/dist/components/Rating/Rating.d.ts +49 -0
  44. package/dist/components/Rating/Rating.js +241 -0
  45. package/dist/components/ScrollArea/ScrollArea.d.ts +23 -0
  46. package/dist/components/ScrollArea/ScrollArea.js +90 -0
  47. package/dist/components/SegmentedControl/SegmentedControl.d.ts +29 -0
  48. package/dist/components/SegmentedControl/SegmentedControl.js +99 -0
  49. package/dist/components/Separator/Separator.d.ts +9 -0
  50. package/dist/components/Separator/Separator.js +34 -0
  51. package/dist/components/Skeleton/Skeleton.d.ts +31 -0
  52. package/dist/components/Skeleton/Skeleton.js +152 -0
  53. package/dist/components/Slider/Slider.d.ts +54 -0
  54. package/dist/components/Slider/Slider.js +178 -0
  55. package/dist/components/Spinner/Spinner.d.ts +17 -0
  56. package/dist/components/Spinner/Spinner.js +118 -0
  57. package/dist/components/Stack/Stack.d.ts +302 -0
  58. package/dist/components/Stack/Stack.js +14 -0
  59. package/dist/components/StateIcon/StateIcon.d.ts +11 -0
  60. package/dist/components/StateIcon/StateIcon.js +65 -0
  61. package/dist/components/StatusBadge/StatusBadge.d.ts +19 -0
  62. package/dist/components/StatusBadge/StatusBadge.js +82 -0
  63. package/dist/components/Tabs/Tabs.d.ts +28 -0
  64. package/dist/components/Tabs/Tabs.js +109 -0
  65. package/dist/components/Tag/Tag.d.ts +11 -0
  66. package/dist/components/Tag/Tag.js +66 -0
  67. package/dist/components/Toast/AppToaster.d.ts +8 -0
  68. package/dist/components/Toast/AppToaster.js +135 -0
  69. package/dist/components/Toast/toast-manager.d.ts +28 -0
  70. package/dist/components/Toast/toast-manager.js +47 -0
  71. package/dist/components/ToggleButton/ToggleButton.d.ts +26 -0
  72. package/dist/components/ToggleButton/ToggleButton.js +106 -0
  73. package/dist/components/ToggleGroup/ToggleGroup.d.ts +32 -0
  74. package/dist/components/ToggleGroup/ToggleGroup.js +79 -0
  75. package/dist/components/Tooltip/Tooltip.d.ts +16 -0
  76. package/dist/components/Tooltip/Tooltip.js +58 -0
  77. package/dist/components/Tooltip/TooltipGroup.d.ts +22 -0
  78. package/dist/components/Tooltip/TooltipGroup.js +65 -0
  79. package/dist/components/Typography/Typography.d.ts +17 -0
  80. package/dist/components/Typography/Typography.js +100 -0
  81. package/dist/editor-forms.d.ts +1 -0
  82. package/dist/editor-forms.js +1 -0
  83. package/dist/editor.d.ts +1 -0
  84. package/dist/editor.js +1 -0
  85. package/dist/fonts/LICENSE +93 -0
  86. package/dist/fonts/inter-cyrillic-ext-wght-normal.woff2 +0 -0
  87. package/dist/fonts/inter-cyrillic-wght-normal.woff2 +0 -0
  88. package/dist/fonts/inter-greek-ext-wght-normal.woff2 +0 -0
  89. package/dist/fonts/inter-greek-wght-normal.woff2 +0 -0
  90. package/dist/fonts/inter-latin-ext-wght-normal.woff2 +0 -0
  91. package/dist/fonts/inter-latin-wght-normal.woff2 +0 -0
  92. package/dist/fonts/inter-vietnamese-wght-normal.woff2 +0 -0
  93. package/dist/fonts.css +69 -0
  94. package/dist/forms.d.ts +22 -0
  95. package/dist/forms.js +23 -0
  96. package/dist/foundation.css +23 -0
  97. package/dist/global.css +116 -0
  98. package/dist/hooks/useAppToast.d.ts +12 -0
  99. package/dist/hooks/useAppToast.js +29 -0
  100. package/dist/icons/icons.d.ts +43 -0
  101. package/dist/icons/icons.js +44 -0
  102. package/dist/index.d.ts +106 -0
  103. package/dist/index.js +101 -0
  104. package/dist/patterns/Accordion/Accordion.d.ts +35 -0
  105. package/dist/patterns/Accordion/Accordion.js +139 -0
  106. package/dist/patterns/Alert/Alert.d.ts +38 -0
  107. package/dist/patterns/Alert/Alert.js +151 -0
  108. package/dist/patterns/AppShell/AppShell.d.ts +39 -0
  109. package/dist/patterns/AppShell/AppShell.js +218 -0
  110. package/dist/patterns/Breadcrumbs/Breadcrumbs.d.ts +21 -0
  111. package/dist/patterns/Breadcrumbs/Breadcrumbs.js +73 -0
  112. package/dist/patterns/Calendar/Calendar.d.ts +59 -0
  113. package/dist/patterns/Calendar/Calendar.js +283 -0
  114. package/dist/patterns/Calendar/DateRangePicker.d.ts +53 -0
  115. package/dist/patterns/Calendar/DateRangePicker.js +266 -0
  116. package/dist/patterns/Calendar/FormDateRangeField.d.ts +24 -0
  117. package/dist/patterns/Calendar/FormDateRangeField.js +138 -0
  118. package/dist/patterns/Card/Card.d.ts +26 -0
  119. package/dist/patterns/Card/Card.js +125 -0
  120. package/dist/patterns/Carousel/Carousel.d.ts +33 -0
  121. package/dist/patterns/Carousel/Carousel.js +127 -0
  122. package/dist/patterns/Cascader/Cascader.d.ts +53 -0
  123. package/dist/patterns/Cascader/Cascader.js +371 -0
  124. package/dist/patterns/Cascader/FormCascaderField.d.ts +21 -0
  125. package/dist/patterns/Cascader/FormCascaderField.js +130 -0
  126. package/dist/patterns/Charts/AreaChart.d.ts +13 -0
  127. package/dist/patterns/Charts/AreaChart.js +220 -0
  128. package/dist/patterns/Charts/BarChart.d.ts +11 -0
  129. package/dist/patterns/Charts/BarChart.js +220 -0
  130. package/dist/patterns/Charts/DonutChart.d.ts +37 -0
  131. package/dist/patterns/Charts/DonutChart.js +215 -0
  132. package/dist/patterns/Charts/GaugeChart.d.ts +44 -0
  133. package/dist/patterns/Charts/GaugeChart.js +210 -0
  134. package/dist/patterns/Charts/LineChart.d.ts +14 -0
  135. package/dist/patterns/Charts/LineChart.js +222 -0
  136. package/dist/patterns/Charts/Sparkline.d.ts +24 -0
  137. package/dist/patterns/Charts/Sparkline.js +81 -0
  138. package/dist/patterns/Charts/chart-parts.d.ts +139 -0
  139. package/dist/patterns/Charts/chart-parts.js +385 -0
  140. package/dist/patterns/Charts/gauge-math.d.ts +20 -0
  141. package/dist/patterns/Charts/gauge-math.js +21 -0
  142. package/dist/patterns/Charts/sparkline-path.d.ts +11 -0
  143. package/dist/patterns/Charts/sparkline-path.js +24 -0
  144. package/dist/patterns/ColorPicker/ColorPicker.d.ts +50 -0
  145. package/dist/patterns/ColorPicker/ColorPicker.js +590 -0
  146. package/dist/patterns/ColorPicker/FormColorField.d.ts +21 -0
  147. package/dist/patterns/ColorPicker/FormColorField.js +130 -0
  148. package/dist/patterns/ColorPicker/color-value.d.ts +19 -0
  149. package/dist/patterns/ColorPicker/color-value.js +72 -0
  150. package/dist/patterns/Combobox/Autocomplete.d.ts +48 -0
  151. package/dist/patterns/Combobox/Autocomplete.js +158 -0
  152. package/dist/patterns/Combobox/Combobox.d.ts +52 -0
  153. package/dist/patterns/Combobox/Combobox.js +195 -0
  154. package/dist/patterns/Combobox/ComboboxPopup.d.ts +24 -0
  155. package/dist/patterns/Combobox/ComboboxPopup.js +107 -0
  156. package/dist/patterns/Combobox/FormAutocompleteField.d.ts +17 -0
  157. package/dist/patterns/Combobox/FormAutocompleteField.js +119 -0
  158. package/dist/patterns/Combobox/FormComboboxField.d.ts +18 -0
  159. package/dist/patterns/Combobox/FormComboboxField.js +119 -0
  160. package/dist/patterns/Combobox/FormMultiSelectField.d.ts +18 -0
  161. package/dist/patterns/Combobox/FormMultiSelectField.js +119 -0
  162. package/dist/patterns/Combobox/MultiSelect.d.ts +54 -0
  163. package/dist/patterns/Combobox/MultiSelect.js +175 -0
  164. package/dist/patterns/CommandPalette/CommandPalette.d.ts +50 -0
  165. package/dist/patterns/CommandPalette/CommandPalette.js +193 -0
  166. package/dist/patterns/DataTable/DataTable.d.ts +107 -0
  167. package/dist/patterns/DataTable/DataTable.js +364 -0
  168. package/dist/patterns/DateTimePicker/DateTimePanel.d.ts +28 -0
  169. package/dist/patterns/DateTimePicker/DateTimePanel.js +444 -0
  170. package/dist/patterns/DateTimePicker/DateTimePicker.d.ts +75 -0
  171. package/dist/patterns/DateTimePicker/DateTimePicker.js +271 -0
  172. package/dist/patterns/DateTimePicker/FormDateTimeField.d.ts +32 -0
  173. package/dist/patterns/DateTimePicker/FormDateTimeField.js +148 -0
  174. package/dist/patterns/DateTimePicker/TimeSliders.d.ts +14 -0
  175. package/dist/patterns/DateTimePicker/TimeSliders.js +206 -0
  176. package/dist/patterns/DateTimePicker/picker-labels.d.ts +30 -0
  177. package/dist/patterns/DateTimePicker/picker-labels.js +23 -0
  178. package/dist/patterns/DateTimePicker/picker-values.d.ts +98 -0
  179. package/dist/patterns/DateTimePicker/picker-values.js +194 -0
  180. package/dist/patterns/DescriptionList/DescriptionList.d.ts +20 -0
  181. package/dist/patterns/DescriptionList/DescriptionList.js +57 -0
  182. package/dist/patterns/Dialog/Dialog.d.ts +26 -0
  183. package/dist/patterns/Dialog/Dialog.js +212 -0
  184. package/dist/patterns/Drawer/Drawer.d.ts +33 -0
  185. package/dist/patterns/Drawer/Drawer.js +153 -0
  186. package/dist/patterns/EmptyState/EmptyState.d.ts +35 -0
  187. package/dist/patterns/EmptyState/EmptyState.js +44 -0
  188. package/dist/patterns/FileUpload/FileUpload.d.ts +87 -0
  189. package/dist/patterns/FileUpload/FileUpload.js +417 -0
  190. package/dist/patterns/FileUpload/FormFileUploadField.d.ts +19 -0
  191. package/dist/patterns/FileUpload/FormFileUploadField.js +117 -0
  192. package/dist/patterns/FileUpload/add-files.d.ts +26 -0
  193. package/dist/patterns/FileUpload/add-files.js +35 -0
  194. package/dist/patterns/FileUpload/file-size.d.ts +14 -0
  195. package/dist/patterns/FileUpload/file-size.js +44 -0
  196. package/dist/patterns/FormField/CheckboxField.d.ts +26 -0
  197. package/dist/patterns/FormField/CheckboxField.js +97 -0
  198. package/dist/patterns/FormField/FieldFrame.d.ts +85 -0
  199. package/dist/patterns/FormField/FieldFrame.js +257 -0
  200. package/dist/patterns/FormField/FormCheckboxField.d.ts +17 -0
  201. package/dist/patterns/FormField/FormCheckboxField.js +92 -0
  202. package/dist/patterns/FormField/FormRadioGroupField.d.ts +16 -0
  203. package/dist/patterns/FormField/FormRadioGroupField.js +97 -0
  204. package/dist/patterns/FormField/FormRatingField.d.ts +19 -0
  205. package/dist/patterns/FormField/FormRatingField.js +119 -0
  206. package/dist/patterns/FormField/FormSelectField.d.ts +16 -0
  207. package/dist/patterns/FormField/FormSelectField.js +91 -0
  208. package/dist/patterns/FormField/FormSliderField.d.ts +22 -0
  209. package/dist/patterns/FormField/FormSliderField.js +128 -0
  210. package/dist/patterns/FormField/FormSwitchField.d.ts +19 -0
  211. package/dist/patterns/FormField/FormSwitchField.js +88 -0
  212. package/dist/patterns/FormField/FormTextAreaField.d.ts +12 -0
  213. package/dist/patterns/FormField/FormTextAreaField.js +91 -0
  214. package/dist/patterns/FormField/FormTextField.d.ts +23 -0
  215. package/dist/patterns/FormField/FormTextField.js +103 -0
  216. package/dist/patterns/FormField/RadioGroupField.d.ts +38 -0
  217. package/dist/patterns/FormField/RadioGroupField.js +201 -0
  218. package/dist/patterns/FormField/SelectField.d.ts +43 -0
  219. package/dist/patterns/FormField/SelectField.js +211 -0
  220. package/dist/patterns/FormField/SwitchField.d.ts +27 -0
  221. package/dist/patterns/FormField/SwitchField.js +105 -0
  222. package/dist/patterns/FormField/TextAreaField.d.ts +37 -0
  223. package/dist/patterns/FormField/TextAreaField.js +134 -0
  224. package/dist/patterns/FormField/TextField.d.ts +51 -0
  225. package/dist/patterns/FormField/TextField.js +256 -0
  226. package/dist/patterns/FormField/error-message.d.ts +6 -0
  227. package/dist/patterns/FormField/error-message.js +8 -0
  228. package/dist/patterns/FormField/field-styles.d.ts +44 -0
  229. package/dist/patterns/FormField/field-styles.js +89 -0
  230. package/dist/patterns/FormField/field-types.d.ts +4 -0
  231. package/dist/patterns/FormField/use-field-ids.d.ts +18 -0
  232. package/dist/patterns/FormField/use-field-ids.js +53 -0
  233. package/dist/patterns/List/List.d.ts +38 -0
  234. package/dist/patterns/List/List.js +174 -0
  235. package/dist/patterns/MentionsInput/FormMentionsField.d.ts +18 -0
  236. package/dist/patterns/MentionsInput/FormMentionsField.js +124 -0
  237. package/dist/patterns/MentionsInput/MentionsInput.d.ts +57 -0
  238. package/dist/patterns/MentionsInput/MentionsInput.js +133 -0
  239. package/dist/patterns/MentionsInput/mention-text.d.ts +24 -0
  240. package/dist/patterns/MentionsInput/mention-text.js +31 -0
  241. package/dist/patterns/Menubar/Menubar.d.ts +22 -0
  242. package/dist/patterns/Menubar/Menubar.js +79 -0
  243. package/dist/patterns/NavigationMenu/NavigationMenu.d.ts +27 -0
  244. package/dist/patterns/NavigationMenu/NavigationMenu.js +104 -0
  245. package/dist/patterns/NumberField/FormNumberField.d.ts +18 -0
  246. package/dist/patterns/NumberField/FormNumberField.js +119 -0
  247. package/dist/patterns/NumberField/NumberField.d.ts +57 -0
  248. package/dist/patterns/NumberField/NumberField.js +242 -0
  249. package/dist/patterns/Pagination/Pagination.d.ts +31 -0
  250. package/dist/patterns/Pagination/Pagination.js +275 -0
  251. package/dist/patterns/Pagination/page-items.d.ts +18 -0
  252. package/dist/patterns/Pagination/page-items.js +40 -0
  253. package/dist/patterns/PhoneField/FormPhoneField.d.ts +22 -0
  254. package/dist/patterns/PhoneField/FormPhoneField.js +97 -0
  255. package/dist/patterns/PhoneField/PhoneField.d.ts +60 -0
  256. package/dist/patterns/PhoneField/PhoneField.js +448 -0
  257. package/dist/patterns/PhoneField/phone-value.d.ts +26 -0
  258. package/dist/patterns/PhoneField/phone-value.js +38 -0
  259. package/dist/patterns/QRCode/QRCode.d.ts +37 -0
  260. package/dist/patterns/QRCode/QRCode.js +120 -0
  261. package/dist/patterns/QRCode/qr-path.d.ts +7 -0
  262. package/dist/patterns/QRCode/qr-path.js +25 -0
  263. package/dist/patterns/ResizablePanels/ResizablePanels.d.ts +34 -0
  264. package/dist/patterns/ResizablePanels/ResizablePanels.js +175 -0
  265. package/dist/patterns/ResizablePanels/panel-sizes.d.ts +31 -0
  266. package/dist/patterns/ResizablePanels/panel-sizes.js +54 -0
  267. package/dist/patterns/RichTextEditor/FormRichTextField.d.ts +18 -0
  268. package/dist/patterns/RichTextEditor/FormRichTextField.js +118 -0
  269. package/dist/patterns/RichTextEditor/RichTextEditor.d.ts +71 -0
  270. package/dist/patterns/RichTextEditor/RichTextEditor.js +453 -0
  271. package/dist/patterns/SearchInput/SearchInput.d.ts +26 -0
  272. package/dist/patterns/SearchInput/SearchInput.js +98 -0
  273. package/dist/patterns/SideNav/SideNav.d.ts +50 -0
  274. package/dist/patterns/SideNav/SideNav.js +269 -0
  275. package/dist/patterns/Stat/Stat.d.ts +51 -0
  276. package/dist/patterns/Stat/Stat.js +292 -0
  277. package/dist/patterns/Stepper/Stepper.d.ts +35 -0
  278. package/dist/patterns/Stepper/Stepper.js +110 -0
  279. package/dist/patterns/TagGroup/TagGroup.d.ts +44 -0
  280. package/dist/patterns/TagGroup/TagGroup.js +151 -0
  281. package/dist/patterns/TagsInput/FormTagsInputField.d.ts +18 -0
  282. package/dist/patterns/TagsInput/FormTagsInputField.js +124 -0
  283. package/dist/patterns/TagsInput/TagsInput.d.ts +51 -0
  284. package/dist/patterns/TagsInput/TagsInput.js +97 -0
  285. package/dist/patterns/Timeline/Timeline.d.ts +29 -0
  286. package/dist/patterns/Timeline/Timeline.js +85 -0
  287. package/dist/patterns/Toolbar/Toolbar.d.ts +31 -0
  288. package/dist/patterns/Toolbar/Toolbar.js +105 -0
  289. package/dist/patterns/Tour/Tour.d.ts +38 -0
  290. package/dist/patterns/Tour/Tour.js +333 -0
  291. package/dist/patterns/TransferList/FormTransferListField.d.ts +19 -0
  292. package/dist/patterns/TransferList/FormTransferListField.js +117 -0
  293. package/dist/patterns/TransferList/TransferList.d.ts +53 -0
  294. package/dist/patterns/TransferList/TransferList.js +441 -0
  295. package/dist/patterns/TreeSelect/FormTreeSelectField.d.ts +28 -0
  296. package/dist/patterns/TreeSelect/FormTreeSelectField.js +88 -0
  297. package/dist/patterns/TreeSelect/TreeSelect.d.ts +49 -0
  298. package/dist/patterns/TreeSelect/TreeSelect.js +375 -0
  299. package/dist/patterns/TreeView/TreeView.d.ts +40 -0
  300. package/dist/patterns/TreeView/TreeView.js +296 -0
  301. package/dist/provider/DesignSystemProvider.d.ts +54 -0
  302. package/dist/provider/DesignSystemProvider.js +270 -0
  303. package/dist/provider/nonce.d.ts +7 -0
  304. package/dist/provider/nonce.js +13 -0
  305. package/dist/styles.css +2 -0
  306. package/dist/theme/chart-palette.d.ts +51 -0
  307. package/dist/theme/chart-palette.js +112 -0
  308. package/dist/theme/create-theme.d.ts +52 -0
  309. package/dist/theme/create-theme.js +75 -0
  310. package/dist/theme/style-element.d.ts +28 -0
  311. package/dist/theme/style-element.js +79 -0
  312. package/dist/theme/tenant-branding.d.ts +48 -0
  313. package/dist/theme/tenant-branding.js +65 -0
  314. package/dist/theme/theme-switch.d.ts +25 -0
  315. package/dist/theme/theme-switch.js +90 -0
  316. package/dist/theme/token-names.d.ts +3 -0
  317. package/dist/theme/token-names.js +166 -0
  318. package/dist/theme.css +241 -0
  319. package/dist/tokens.css +383 -0
  320. package/dist/types/direction.d.ts +4 -0
  321. package/dist/types/tone.d.ts +7 -0
  322. package/dist/utils/cn.d.ts +7 -0
  323. package/dist/utils/cn.js +50 -0
  324. package/dist/utils/first-field.d.ts +8 -0
  325. package/dist/utils/first-field.js +10 -0
  326. package/dist/utils/layout.d.ts +33 -0
  327. package/dist/utils/layout.js +30 -0
  328. package/dist/utils/popup.d.ts +12 -0
  329. package/dist/utils/popup.js +27 -0
  330. package/docs/accessibility.md +61 -0
  331. package/docs/advanced-components.md +38 -0
  332. package/docs/ai-assistants.md +44 -0
  333. package/docs/architecture.md +65 -0
  334. package/docs/browser-support.md +30 -0
  335. package/docs/charts.md +56 -0
  336. package/docs/components.md +2928 -0
  337. package/docs/conventions.md +19 -0
  338. package/docs/customization.md +79 -0
  339. package/docs/dates-files-data.md +48 -0
  340. package/docs/design-principles.md +50 -0
  341. package/docs/faq.md +68 -0
  342. package/docs/forms.md +114 -0
  343. package/docs/getting-started.md +64 -0
  344. package/docs/icons.md +48 -0
  345. package/docs/internationalization.md +64 -0
  346. package/docs/layout-and-navigation.md +51 -0
  347. package/docs/nextjs.md +69 -0
  348. package/docs/releasing.md +41 -0
  349. package/docs/testing.md +242 -0
  350. package/docs/theming.md +118 -0
  351. package/docs/typescript.md +62 -0
  352. package/llms-full.txt +4574 -0
  353. package/llms.txt +52 -0
  354. package/package.json +166 -6
@@ -0,0 +1,110 @@
1
+ "use client";
2
+ import { c } from "react/compiler-runtime";
3
+ import { Check, CircleAlert } from "lucide-react";
4
+ import { cn } from "../../utils/cn.js";
5
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
+ // src/patterns/Stepper/Stepper.tsx
7
+ var INDICATOR = {
8
+ complete: "bg-primary text-on-primary",
9
+ current: "border-2 border-primary bg-surface text-primary-text",
10
+ upcoming: "border border-line-strong bg-surface text-fg-secondary",
11
+ error: "bg-error-solid text-on-destructive"
12
+ };
13
+ /**
14
+ * The steps of a process and where the person is in it: done, current, ahead. An ordered list, so a screen reader
15
+ * announces "step 2 of 4"; the current step is `aria-current="step"` and a step that is done says so through
16
+ * `labels.completed`. With `onStepClick` the steps that are done are buttons that go back.
17
+ */
18
+ var Stepper = (t0) => {
19
+ const $ = c(19);
20
+ const { steps, current, labels, orientation: t1, onStepClick, "aria-label": ariaLabel, className } = t0;
21
+ const isVertical = (t1 === void 0 ? "horizontal" : t1) === "vertical";
22
+ const t2 = isVertical ? "flex-col" : "w-full items-start gap-2";
23
+ let t3;
24
+ if ($[0] !== className || $[1] !== t2) {
25
+ t3 = cn("m-0 flex list-none p-0", t2, className);
26
+ $[0] = className;
27
+ $[1] = t2;
28
+ $[2] = t3;
29
+ } else t3 = $[2];
30
+ let t4;
31
+ if ($[3] !== current || $[4] !== isVertical || $[5] !== labels || $[6] !== onStepClick || $[7] !== steps) {
32
+ let t5;
33
+ if ($[9] !== current || $[10] !== isVertical || $[11] !== labels || $[12] !== onStepClick || $[13] !== steps.length) {
34
+ t5 = (step, index) => {
35
+ const isCurrent = index === current;
36
+ const status = step.error ? "error" : index < current ? "complete" : isCurrent ? "current" : "upcoming";
37
+ const isLast = index === steps.length - 1;
38
+ const isDone = index < current;
39
+ const statusText = status === "complete" ? labels.completed : status === "error" ? labels.error : void 0;
40
+ const text = /* @__PURE__ */ jsxs("span", {
41
+ className: "flex min-w-0 flex-col text-start",
42
+ children: [/* @__PURE__ */ jsxs("span", {
43
+ className: cn("text-body-sm", status === "upcoming" ? "text-fg-secondary" : "font-medium text-fg", status === "error" && "text-error-text"),
44
+ children: [step.label, statusText ? /* @__PURE__ */ jsx("span", {
45
+ className: "sr-only",
46
+ children: `. ${statusText}`
47
+ }) : null]
48
+ }), step.description ? /* @__PURE__ */ jsx("span", {
49
+ className: "text-caption text-fg-secondary",
50
+ children: step.description
51
+ }) : null]
52
+ });
53
+ const indicator = /* @__PURE__ */ jsx("span", {
54
+ "aria-hidden": "true",
55
+ className: cn("box-border inline-flex size-7 shrink-0 items-center justify-center rounded-full text-caption font-semibold [&_svg]:size-3.5", INDICATOR[status]),
56
+ children: status === "complete" ? /* @__PURE__ */ jsx(Check, {}) : status === "error" ? /* @__PURE__ */ jsx(CircleAlert, {}) : index + 1
57
+ });
58
+ const content = /* @__PURE__ */ jsxs(Fragment, { children: [indicator, text] });
59
+ return /* @__PURE__ */ jsxs("li", {
60
+ ...isCurrent ? { "aria-current": "step" } : {},
61
+ className: cn("relative flex min-w-0 gap-3", isVertical ? "items-start pb-6 last:pb-0" : cn("items-start", isLast ? "flex-none" : "flex-1")),
62
+ children: [onStepClick && isDone ? /* @__PURE__ */ jsx("button", {
63
+ type: "button",
64
+ className: "flex min-w-0 cursor-pointer items-start gap-3 rounded-sm border-0 bg-transparent p-0 outline-none hover:opacity-80 focus-visible:ring-2 focus-visible:ring-focus focus-visible:ring-offset-2 focus-visible:ring-offset-page",
65
+ onClick: () => {
66
+ onStepClick(index);
67
+ },
68
+ children: content
69
+ }) : /* @__PURE__ */ jsx("span", {
70
+ className: "flex min-w-0 items-start gap-3",
71
+ children: content
72
+ }), isLast ? null : isVertical ? /* @__PURE__ */ jsx("span", {
73
+ "aria-hidden": "true",
74
+ className: cn("absolute start-[13.5px] top-8 bottom-1 w-px", isDone ? "bg-primary" : "bg-line")
75
+ }) : /* @__PURE__ */ jsx("span", {
76
+ "aria-hidden": "true",
77
+ className: cn("mt-3.5 h-px min-w-6 flex-1", isDone ? "bg-primary" : "bg-line")
78
+ })]
79
+ }, step.id);
80
+ };
81
+ $[9] = current;
82
+ $[10] = isVertical;
83
+ $[11] = labels;
84
+ $[12] = onStepClick;
85
+ $[13] = steps.length;
86
+ $[14] = t5;
87
+ } else t5 = $[14];
88
+ t4 = steps.map(t5);
89
+ $[3] = current;
90
+ $[4] = isVertical;
91
+ $[5] = labels;
92
+ $[6] = onStepClick;
93
+ $[7] = steps;
94
+ $[8] = t4;
95
+ } else t4 = $[8];
96
+ let t5;
97
+ if ($[15] !== ariaLabel || $[16] !== t3 || $[17] !== t4) {
98
+ t5 = /* @__PURE__ */ jsx("ol", {
99
+ "aria-label": ariaLabel,
100
+ className: t3,
101
+ children: t4
102
+ });
103
+ $[15] = ariaLabel;
104
+ $[16] = t3;
105
+ $[17] = t4;
106
+ $[18] = t5;
107
+ } else t5 = $[18];
108
+ return t5;
109
+ };
110
+ export { Stepper };
@@ -0,0 +1,44 @@
1
+ import { type RefObject } from "react";
2
+ export interface TagGroupItem {
3
+ /** Tells the tag apart from the others; `onRemove` receives it. */
4
+ id: string;
5
+ /** The tag's text. */
6
+ label: string;
7
+ }
8
+ /** The texts the group shows and announces. The design system has no i18n, so the caller supplies them. */
9
+ export interface TagGroupLabels {
10
+ /** A tag's accessible name as a remove button, e.g. `Remove filter ${label}`. */
11
+ remove: (label: string) => string;
12
+ /** With `onClearAll`, a "Clear all" button after the tags. */
13
+ clearAll?: string | undefined;
14
+ }
15
+ export interface TagGroupProps {
16
+ /** The tags, in order. */
17
+ items: readonly TagGroupItem[];
18
+ /** Accessible name of the list, e.g. "Active filters". */
19
+ "aria-label": string;
20
+ /** Called with a tag's id when its remove button is used. */
21
+ onRemove: (id: string) => void;
22
+ /** Called by the "Clear all" button, shown when this and `labels.clearAll` are given. */
23
+ onClearAll?: (() => void) | undefined;
24
+ /** The remove buttons' names and the "Clear all" text. */
25
+ labels: TagGroupLabels;
26
+ /**
27
+ * The element that takes the keyboard focus when the last tag goes (removed, or by Clear all), e.g. the field
28
+ * or button that adds tags. The group renders nothing once it is empty, so without this the focus is lost to
29
+ * the page, as it is whenever the focused element goes away.
30
+ */
31
+ emptyFocusRef?: RefObject<HTMLElement | null> | undefined;
32
+ /** Classes for the outer element, e.g. a margin. */
33
+ className?: string | undefined;
34
+ }
35
+ /**
36
+ * A named list of removable tags: light brand-tinted pills, each a button that removes its tag, and an optional
37
+ * "Clear all". The applied filters of a list, the recipients of a message, chosen labels. Renders nothing when
38
+ * there are no items.
39
+ *
40
+ * A remove button or Clear all that had the keyboard focus takes it away with itself, so once the app has
41
+ * removed the tag the focus moves on: to the tag now in its place, to the one before when it was the last, and
42
+ * to `emptyFocusRef` when none is left.
43
+ */
44
+ export declare const TagGroup: ({ items, "aria-label": ariaLabel, onRemove, onClearAll, labels, emptyFocusRef, className, }: TagGroupProps) => import("react").JSX.Element | null;
@@ -0,0 +1,151 @@
1
+ "use client";
2
+ import { c } from "react/compiler-runtime";
3
+ import { useLayoutEffect, useRef } from "react";
4
+ import { X } from "lucide-react";
5
+ import { cn } from "../../utils/cn.js";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ // src/patterns/TagGroup/TagGroup.tsx
8
+ /**
9
+ * A named list of removable tags: light brand-tinted pills, each a button that removes its tag, and an optional
10
+ * "Clear all". The applied filters of a list, the recipients of a message, chosen labels. Renders nothing when
11
+ * there are no items.
12
+ *
13
+ * A remove button or Clear all that had the keyboard focus takes it away with itself, so once the app has
14
+ * removed the tag the focus moves on: to the tag now in its place, to the one before when it was the last, and
15
+ * to `emptyFocusRef` when none is left.
16
+ */
17
+ var TagGroup = (t0) => {
18
+ const $ = c(32);
19
+ const { items, "aria-label": ariaLabel, onRemove, onClearAll, labels, emptyFocusRef, className } = t0;
20
+ const list = useRef(null);
21
+ const pendingFocus = useRef(null);
22
+ let t1;
23
+ if ($[0] !== emptyFocusRef) {
24
+ t1 = () => {
25
+ const pending = pendingFocus.current;
26
+ if (!pending || pending.from.isConnected) return;
27
+ pendingFocus.current = null;
28
+ const active = document.activeElement;
29
+ if (active && active !== document.body) return;
30
+ const buttons = list.current ? [...list.current.querySelectorAll("button")] : [];
31
+ (buttons.length > 0 ? buttons[Math.min(pending.index, buttons.length - 1)] : emptyFocusRef?.current)?.focus();
32
+ };
33
+ $[0] = emptyFocusRef;
34
+ $[1] = t1;
35
+ } else t1 = $[1];
36
+ let t2;
37
+ if ($[2] !== emptyFocusRef || $[3] !== items) {
38
+ t2 = [items, emptyFocusRef];
39
+ $[2] = emptyFocusRef;
40
+ $[3] = items;
41
+ $[4] = t2;
42
+ } else t2 = $[4];
43
+ useLayoutEffect(t1, t2);
44
+ let holdFocus;
45
+ let t3;
46
+ let t4;
47
+ let t5;
48
+ let t6;
49
+ let t7;
50
+ let t8;
51
+ if ($[5] !== ariaLabel || $[6] !== className || $[7] !== items || $[8] !== labels || $[9] !== onRemove) {
52
+ t8 = Symbol.for("react.early_return_sentinel");
53
+ bb0: {
54
+ holdFocus = (control, index) => {
55
+ pendingFocus.current = control === document.activeElement ? {
56
+ from: control,
57
+ index
58
+ } : null;
59
+ };
60
+ if (items.length === 0) {
61
+ t8 = null;
62
+ break bb0;
63
+ }
64
+ if ($[17] !== className) {
65
+ t7 = cn("flex flex-wrap items-center gap-2", className);
66
+ $[17] = className;
67
+ $[18] = t7;
68
+ } else t7 = $[18];
69
+ t3 = list;
70
+ t4 = "m-0 flex list-none flex-wrap gap-2 p-0";
71
+ t5 = ariaLabel;
72
+ t6 = items.map((item, index_0) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs("button", {
73
+ type: "button",
74
+ className: "inline-flex min-h-8 items-center gap-1.25 rounded-pill border-0 bg-primary-light ps-2.75 pe-2.25 text-caption whitespace-nowrap text-primary-text transition-colors duration-150 ease-standard hover:text-primary-text-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus",
75
+ "aria-label": labels.remove(item.label),
76
+ onClick: (event) => {
77
+ holdFocus(event.currentTarget, index_0);
78
+ onRemove(item.id);
79
+ },
80
+ children: [item.label, /* @__PURE__ */ jsx(X, {
81
+ "aria-hidden": "true",
82
+ className: "size-3.25"
83
+ })]
84
+ }) }, item.id));
85
+ }
86
+ $[5] = ariaLabel;
87
+ $[6] = className;
88
+ $[7] = items;
89
+ $[8] = labels;
90
+ $[9] = onRemove;
91
+ $[10] = holdFocus;
92
+ $[11] = t3;
93
+ $[12] = t4;
94
+ $[13] = t5;
95
+ $[14] = t6;
96
+ $[15] = t7;
97
+ $[16] = t8;
98
+ } else {
99
+ holdFocus = $[10];
100
+ t3 = $[11];
101
+ t4 = $[12];
102
+ t5 = $[13];
103
+ t6 = $[14];
104
+ t7 = $[15];
105
+ t8 = $[16];
106
+ }
107
+ if (t8 !== Symbol.for("react.early_return_sentinel")) return t8;
108
+ let t9;
109
+ if ($[19] !== t3 || $[20] !== t4 || $[21] !== t5 || $[22] !== t6) {
110
+ t9 = /* @__PURE__ */ jsx("ul", {
111
+ ref: t3,
112
+ className: t4,
113
+ "aria-label": t5,
114
+ children: t6
115
+ });
116
+ $[19] = t3;
117
+ $[20] = t4;
118
+ $[21] = t5;
119
+ $[22] = t6;
120
+ $[23] = t9;
121
+ } else t9 = $[23];
122
+ let t10;
123
+ if ($[24] !== holdFocus || $[25] !== labels || $[26] !== onClearAll) {
124
+ t10 = onClearAll && labels.clearAll ? /* @__PURE__ */ jsx("button", {
125
+ type: "button",
126
+ className: "rounded-sm border-0 bg-transparent p-0 text-caption text-fg-secondary transition-colors duration-150 ease-standard hover:text-destructive focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus",
127
+ onClick: (event_0) => {
128
+ holdFocus(event_0.currentTarget, 0);
129
+ onClearAll();
130
+ },
131
+ children: labels.clearAll
132
+ }) : null;
133
+ $[24] = holdFocus;
134
+ $[25] = labels;
135
+ $[26] = onClearAll;
136
+ $[27] = t10;
137
+ } else t10 = $[27];
138
+ let t11;
139
+ if ($[28] !== t10 || $[29] !== t7 || $[30] !== t9) {
140
+ t11 = /* @__PURE__ */ jsxs("div", {
141
+ className: t7,
142
+ children: [t9, t10]
143
+ });
144
+ $[28] = t10;
145
+ $[29] = t7;
146
+ $[30] = t9;
147
+ $[31] = t11;
148
+ } else t11 = $[31];
149
+ return t11;
150
+ };
151
+ export { TagGroup };
@@ -0,0 +1,18 @@
1
+ import { type Control, type ControllerProps, type FieldPath, type FieldValues } from "react-hook-form";
2
+ import type { FieldOrientation } from "../FormField/field-types.js";
3
+ import { type TagsInputProps } from "./TagsInput.js";
4
+ export type { TagsInputLabels } from "./TagsInput.js";
5
+ export interface FormTagsInputFieldProps<TValues extends FieldValues> extends Omit<TagsInputProps, "value" | "onValueChange" | "onBlur" | "invalid" | "inputRef" | "id" | "aria-label" | "aria-labelledby" | "aria-describedby"> {
6
+ control: Control<TValues>;
7
+ name: FieldPath<TValues>;
8
+ label: string;
9
+ hint?: string | undefined;
10
+ /** Label above the control (default) or in a column beside it. */
11
+ orientation?: FieldOrientation | undefined;
12
+ /** react-hook-form validation rules, for forms that do not use a schema resolver. */
13
+ rules?: ControllerProps<TValues, FieldPath<TValues>>["rules"] | undefined;
14
+ /** Turns a stored schema message (an i18n key) into display text. */
15
+ formatError?: ((message: string) => string) | undefined;
16
+ }
17
+ /** A TagsInput in a field, bound to a react-hook-form field holding an array of strings. */
18
+ export declare const FormTagsInputField: <TValues extends FieldValues>({ control, name, label, hint, orientation, rules, formatError, required, disabled, size, ...tagsInputProps }: FormTagsInputFieldProps<TValues>) => import("react").JSX.Element;
@@ -0,0 +1,124 @@
1
+ "use client";
2
+ import { c } from "react/compiler-runtime";
3
+ import { Controller } from "react-hook-form";
4
+ import { toErrorText } from "../FormField/error-message.js";
5
+ import { FieldFrame } from "../FormField/FieldFrame.js";
6
+ import { useFieldIds } from "../FormField/use-field-ids.js";
7
+ import { TagsInput } from "./TagsInput.js";
8
+ import { jsx } from "react/jsx-runtime";
9
+ // src/patterns/TagsInput/FormTagsInputField.tsx
10
+ /** A TagsInput in a field, bound to a react-hook-form field holding an array of strings. */
11
+ var FormTagsInputField = (t0) => {
12
+ const $ = c(31);
13
+ let control;
14
+ let formatError;
15
+ let hint;
16
+ let label;
17
+ let name;
18
+ let orientation;
19
+ let required;
20
+ let rules;
21
+ let t1;
22
+ let t2;
23
+ let tagsInputProps;
24
+ if ($[0] !== t0) {
25
+ ({control, name, label, hint, orientation, rules, formatError, required, disabled: t1, size: t2, ...tagsInputProps} = t0);
26
+ $[0] = t0;
27
+ $[1] = control;
28
+ $[2] = formatError;
29
+ $[3] = hint;
30
+ $[4] = label;
31
+ $[5] = name;
32
+ $[6] = orientation;
33
+ $[7] = required;
34
+ $[8] = rules;
35
+ $[9] = t1;
36
+ $[10] = t2;
37
+ $[11] = tagsInputProps;
38
+ } else {
39
+ control = $[1];
40
+ formatError = $[2];
41
+ hint = $[3];
42
+ label = $[4];
43
+ name = $[5];
44
+ orientation = $[6];
45
+ required = $[7];
46
+ rules = $[8];
47
+ t1 = $[9];
48
+ t2 = $[10];
49
+ tagsInputProps = $[11];
50
+ }
51
+ const disabled = t1 === void 0 ? false : t1;
52
+ const size = t2 === void 0 ? "medium" : t2;
53
+ const { labelId, messageIds, describe } = useFieldIds();
54
+ let t3;
55
+ if ($[12] !== rules) {
56
+ t3 = rules ? { rules } : {};
57
+ $[12] = rules;
58
+ $[13] = t3;
59
+ } else t3 = $[13];
60
+ let t4;
61
+ if ($[14] !== describe || $[15] !== disabled || $[16] !== formatError || $[17] !== hint || $[18] !== label || $[19] !== labelId || $[20] !== messageIds || $[21] !== orientation || $[22] !== required || $[23] !== size || $[24] !== tagsInputProps) {
62
+ t4 = (t5) => {
63
+ const { field, fieldState } = t5;
64
+ const errorMessage = toErrorText(fieldState.error?.message, formatError);
65
+ const describedBy = describe(errorMessage, hint);
66
+ return /* @__PURE__ */ jsx(FieldFrame, {
67
+ name: field.name,
68
+ label,
69
+ labelId,
70
+ messageIds,
71
+ disabled,
72
+ invalid: fieldState.invalid,
73
+ touched: fieldState.isTouched,
74
+ dirty: fieldState.isDirty,
75
+ size,
76
+ ...hint ? { hint } : {},
77
+ ...required ? { required } : {},
78
+ ...orientation ? { orientation } : {},
79
+ ...errorMessage === void 0 ? {} : { errorMessage },
80
+ children: /* @__PURE__ */ jsx(TagsInput, {
81
+ ...tagsInputProps,
82
+ inputRef: field.ref,
83
+ "aria-labelledby": labelId,
84
+ ...describedBy ? { "aria-describedby": describedBy } : {},
85
+ value: Array.isArray(field.value) ? field.value : [],
86
+ onValueChange: field.onChange,
87
+ onBlur: field.onBlur,
88
+ invalid: fieldState.invalid,
89
+ required: required ?? false,
90
+ disabled,
91
+ size
92
+ })
93
+ });
94
+ };
95
+ $[14] = describe;
96
+ $[15] = disabled;
97
+ $[16] = formatError;
98
+ $[17] = hint;
99
+ $[18] = label;
100
+ $[19] = labelId;
101
+ $[20] = messageIds;
102
+ $[21] = orientation;
103
+ $[22] = required;
104
+ $[23] = size;
105
+ $[24] = tagsInputProps;
106
+ $[25] = t4;
107
+ } else t4 = $[25];
108
+ let t5;
109
+ if ($[26] !== control || $[27] !== name || $[28] !== t3 || $[29] !== t4) {
110
+ t5 = /* @__PURE__ */ jsx(Controller, {
111
+ control,
112
+ name,
113
+ ...t3,
114
+ render: t4
115
+ });
116
+ $[26] = control;
117
+ $[27] = name;
118
+ $[28] = t3;
119
+ $[29] = t4;
120
+ $[30] = t5;
121
+ } else t5 = $[30];
122
+ return t5;
123
+ };
124
+ export { FormTagsInputField };
@@ -0,0 +1,51 @@
1
+ import { type Ref } from "react";
2
+ import type { FieldSize } from "../FormField/field-types.js";
3
+ /** The texts of the field. The design system has no i18n, so the caller supplies them. */
4
+ export interface TagsInputLabels {
5
+ /** Accessible name of the button that removes a tag, from the tag's text: `(tag) => `Remove ${tag}``. */
6
+ remove: (tag: string) => string;
7
+ }
8
+ export interface TagsInputProps {
9
+ /** The tags, in the order they were added. */
10
+ value: readonly string[];
11
+ /** Called with the new list of tags. */
12
+ onValueChange: (value: string[]) => void;
13
+ labels: TagsInputLabels;
14
+ /**
15
+ * The characters that end a tag as they are typed or pasted, besides Enter. Default `[","]`. Pasted text is
16
+ * split at them, so pasting "a, b, c" adds three tags.
17
+ */
18
+ separators?: readonly string[] | undefined;
19
+ /** Let the same tag be added twice. By default a tag already in the list is not added again. */
20
+ allowDuplicates?: boolean | undefined;
21
+ /** The most tags the list takes; the input stops adding past it. */
22
+ maxTags?: number | undefined;
23
+ /** Returns false for a tag that must not be added (an email address that is not one); the text stays in the input. */
24
+ isValidTag?: ((tag: string) => boolean) | undefined;
25
+ placeholder?: string | undefined;
26
+ disabled?: boolean | undefined;
27
+ /** Draws the box red and marks the input invalid for assistive technology. */
28
+ invalid?: boolean | undefined;
29
+ /** Marks the input required for assistive technology; the label shows the asterisk. */
30
+ required?: boolean | undefined;
31
+ /** "small" is the compact density. */
32
+ size?: FieldSize | undefined;
33
+ /** For a `<label htmlFor>` that names the input. */
34
+ id?: string | undefined;
35
+ /** The accessible name of the input, for a control with no label element of its own. */
36
+ "aria-label"?: string | undefined;
37
+ /** The id of the element that names the input, such as a field's label. */
38
+ "aria-labelledby"?: string | undefined;
39
+ /** The ids of the field's message and hint, read after the name. */
40
+ "aria-describedby"?: string | undefined;
41
+ /** The control was left. Text typed and not yet a tag becomes one first. */
42
+ onBlur?: (() => void) | undefined;
43
+ /** The `<input>`, for a form library to focus the first invalid field. */
44
+ inputRef?: Ref<HTMLInputElement> | undefined;
45
+ }
46
+ /**
47
+ * An input that turns what is typed into tags: Enter or a separator (a comma) ends a tag, a tag is removed with
48
+ * the button on it or with Backspace in the empty input, and text left in the input when it is left becomes a
49
+ * tag. For a choice from a fixed list, see MultiSelect.
50
+ */
51
+ export declare const TagsInput: ({ value, onValueChange, labels, separators, allowDuplicates, maxTags, isValidTag, placeholder, disabled, invalid, required, size, id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, onBlur, inputRef, }: TagsInputProps) => import("react").JSX.Element;
@@ -0,0 +1,97 @@
1
+ "use client";
2
+ import { useRef, useState } from "react";
3
+ import { X } from "lucide-react";
4
+ import { cn } from "../../utils/cn.js";
5
+ import { fieldChip, fieldChipRemove, fieldChipsBox, fieldControl, fieldInput } from "../FormField/field-styles.js";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ // src/patterns/TagsInput/TagsInput.tsx
8
+ /**
9
+ * An input that turns what is typed into tags: Enter or a separator (a comma) ends a tag, a tag is removed with
10
+ * the button on it or with Backspace in the empty input, and text left in the input when it is left becomes a
11
+ * tag. For a choice from a fixed list, see MultiSelect.
12
+ */
13
+ var TagsInput = ({ value, onValueChange, labels, separators = [","], allowDuplicates = false, maxTags, isValidTag, placeholder, disabled = false, invalid = false, required = false, size = "medium", id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, onBlur, inputRef }) => {
14
+ const [draft, setDraft] = useState("");
15
+ const input = useRef(null);
16
+ /** Adds the tags in `text` (split at the separators); returns whether the text was used up. */
17
+ const add = (text) => {
18
+ const parts = separators.reduce((pieces, separator) => pieces.flatMap((piece) => piece.split(separator)), [text]);
19
+ const next = [...value];
20
+ let rejected = false;
21
+ for (const part of parts) {
22
+ const tag = part.trim();
23
+ if (tag === "") continue;
24
+ const full = maxTags !== void 0 && next.length >= maxTags;
25
+ const duplicate = !allowDuplicates && next.includes(tag);
26
+ if (full || isValidTag && !isValidTag(tag)) rejected = true;
27
+ else if (!duplicate) next.push(tag);
28
+ }
29
+ if (next.length !== value.length) onValueChange(next);
30
+ return !rejected;
31
+ };
32
+ return /* @__PURE__ */ jsxs("div", {
33
+ className: cn(fieldControl({ size }), fieldChipsBox),
34
+ "data-invalid": invalid || void 0,
35
+ "data-disabled": disabled || void 0,
36
+ onClick: () => {
37
+ input.current?.focus();
38
+ },
39
+ children: [value.map((tag_0, index) => /* @__PURE__ */ jsxs("span", {
40
+ className: fieldChip,
41
+ children: [/* @__PURE__ */ jsx("span", {
42
+ className: "min-w-0 truncate",
43
+ children: tag_0
44
+ }), /* @__PURE__ */ jsx("button", {
45
+ type: "button",
46
+ "aria-label": labels.remove(tag_0),
47
+ disabled,
48
+ className: fieldChipRemove,
49
+ onClick: (event) => {
50
+ event.stopPropagation();
51
+ onValueChange(value.filter((_, at) => at !== index));
52
+ input.current?.focus();
53
+ },
54
+ children: /* @__PURE__ */ jsx(X, { "aria-hidden": "true" })
55
+ })]
56
+ }, `${tag_0}-${String(index)}`)), /* @__PURE__ */ jsx("input", {
57
+ ref: (element) => {
58
+ input.current = element;
59
+ if (typeof inputRef === "function") inputRef(element);
60
+ else if (inputRef) inputRef.current = element;
61
+ },
62
+ type: "text",
63
+ ...id ? { id } : {},
64
+ ...ariaLabel ? { "aria-label": ariaLabel } : {},
65
+ ...ariaLabelledBy ? { "aria-labelledby": ariaLabelledBy } : {},
66
+ ...ariaDescribedBy ? { "aria-describedby": ariaDescribedBy } : {},
67
+ "aria-invalid": invalid || void 0,
68
+ "aria-required": required || void 0,
69
+ autoComplete: "off",
70
+ className: cn(fieldInput, "min-w-20 flex-1 self-auto"),
71
+ placeholder: value.length === 0 ? placeholder : void 0,
72
+ disabled,
73
+ value: draft,
74
+ onChange: (event_0) => {
75
+ const text_0 = event_0.target.value;
76
+ if (separators.some((separator_1) => text_0.includes(separator_1))) {
77
+ const kept = separators.reduce((pieces_0, separator_0) => pieces_0.flatMap((piece_0) => piece_0.split(separator_0)), [text_0]);
78
+ const last = kept[kept.length - 1] ?? "";
79
+ const complete = text_0.slice(0, text_0.length - last.length);
80
+ setDraft(add(complete) ? last : text_0);
81
+ } else setDraft(text_0);
82
+ },
83
+ onKeyDown: (event_1) => {
84
+ if (event_1.nativeEvent.isComposing || event_1.keyCode === 229) return;
85
+ if (event_1.key === "Enter" && draft.trim() !== "") {
86
+ event_1.preventDefault();
87
+ if (add(draft)) setDraft("");
88
+ } else if (event_1.key === "Backspace" && draft === "" && value.length > 0) onValueChange(value.slice(0, -1));
89
+ },
90
+ onBlur: () => {
91
+ if (draft.trim() !== "" && add(draft)) setDraft("");
92
+ onBlur?.();
93
+ }
94
+ })]
95
+ });
96
+ };
97
+ export { TagsInput };
@@ -0,0 +1,29 @@
1
+ import type { ReactNode } from "react";
2
+ import type { ToneName } from "../../types/tone.js";
3
+ export interface TimelineEvent {
4
+ id: string;
5
+ /** What happened: "Order shipped". */
6
+ title: string;
7
+ /** More about it. */
8
+ description?: ReactNode | undefined;
9
+ /** When, as the person reads it: "Today, 14:05". */
10
+ time?: string | undefined;
11
+ /** The same moment for machines, a date or date and time: "2026-10-24T14:05". Written on the `<time>` element. */
12
+ dateTime?: string | undefined;
13
+ /** Colours the event's dot: success for what went well, error for a failure. Neutral if omitted. */
14
+ tone?: ToneName | undefined;
15
+ /** A glyph in the dot, sized by the dot. Without one the dot is a plain mark. */
16
+ icon?: ReactNode | undefined;
17
+ }
18
+ export interface TimelineProps {
19
+ /** The events in the order they are shown: newest first or oldest first is the caller's. */
20
+ events: readonly TimelineEvent[];
21
+ /** Accessible name of the list, e.g. "Order history". */
22
+ "aria-label": string;
23
+ className?: string | undefined;
24
+ }
25
+ /**
26
+ * Events in the order they happened, joined by a line, each with a dot, a title, the time and a description. An
27
+ * ordered list, so a screen reader counts the events. The caller sorts the events.
28
+ */
29
+ export declare const Timeline: ({ events, "aria-label": ariaLabel, className }: TimelineProps) => import("react").JSX.Element;