@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,37 @@
1
+ declare const ECC: {
2
+ readonly low: "L";
3
+ readonly medium: "M";
4
+ readonly quartile: "Q";
5
+ readonly high: "H";
6
+ };
7
+ export interface QRCodeProps {
8
+ /** The text or address to encode. Nothing is drawn for an empty value, or for one too long for a code. */
9
+ value: string;
10
+ /**
11
+ * What the code is, in words, since a picture of squares says nothing: "Link to your order". A screen reader reads
12
+ * this as the code's name.
13
+ */
14
+ "aria-label": string;
15
+ /** The width and height in pixels, quiet zone included. Default 160. */
16
+ size?: number | undefined;
17
+ /**
18
+ * How much of the code can be damaged and still read: `low` (7%), `medium` (15%, default), `quartile` (25%) or
19
+ * `high` (30%). A higher level makes a denser code.
20
+ */
21
+ level?: keyof typeof ECC | undefined;
22
+ /** The dark squares. Black by default: scanners read dark on light most reliably, so it does not follow the theme. */
23
+ foreground?: string | undefined;
24
+ /** The light ground, and the quiet zone around the code. White by default, for the same reason. */
25
+ background?: string | undefined;
26
+ /** The blank border around the code, in modules. Scanners need four (the default). */
27
+ quietZone?: number | undefined;
28
+ /** Extra classes for the code's SVG. Merged last. */
29
+ className?: string | undefined;
30
+ }
31
+ /**
32
+ * A QR code for a link or a short text, drawn as SVG (crisp at any size and in print). It stays black on white
33
+ * whatever the theme, because a code with its colours inverted is not read by every scanner. The code is an image
34
+ * to a screen reader, named by `aria-label`: put the same address in text next to it.
35
+ */
36
+ export declare const QRCode: ({ value, "aria-label": ariaLabel, size, level, foreground, background, quietZone, className, }: QRCodeProps) => import("react").JSX.Element | null;
37
+ export {};
@@ -0,0 +1,120 @@
1
+ "use client";
2
+ import { c } from "react/compiler-runtime";
3
+ import "react";
4
+ import { encode } from "uqr";
5
+ import { cn } from "../../utils/cn.js";
6
+ import { qrPath } from "./qr-path.js";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ // src/patterns/QRCode/QRCode.tsx
9
+ var ECC = {
10
+ low: "L",
11
+ medium: "M",
12
+ quartile: "Q",
13
+ high: "H"
14
+ };
15
+ /**
16
+ * A QR code for a link or a short text, drawn as SVG (crisp at any size and in print). It stays black on white
17
+ * whatever the theme, because a code with its colours inverted is not read by every scanner. The code is an image
18
+ * to a screen reader, named by `aria-label`: put the same address in text next to it.
19
+ */
20
+ var QRCode = (t0) => {
21
+ const $ = c(23);
22
+ const { value, "aria-label": ariaLabel, size: t1, level: t2, foreground: t3, background: t4, quietZone: t5, className } = t0;
23
+ const size = t1 === void 0 ? 160 : t1;
24
+ const level = t2 === void 0 ? "medium" : t2;
25
+ const foreground = t3 === void 0 ? "#000000" : t3;
26
+ const background = t4 === void 0 ? "#ffffff" : t4;
27
+ const quietZone = t5 === void 0 ? 4 : t5;
28
+ let t6;
29
+ bb0: {
30
+ if (value === "") {
31
+ t6 = null;
32
+ break bb0;
33
+ }
34
+ try {
35
+ let data;
36
+ let t7;
37
+ if ($[0] !== level || $[1] !== quietZone || $[2] !== value) {
38
+ ({data} = encode(value, {
39
+ ecc: ECC[level],
40
+ border: 0
41
+ }));
42
+ t7 = qrPath(data, quietZone);
43
+ $[0] = level;
44
+ $[1] = quietZone;
45
+ $[2] = value;
46
+ $[3] = data;
47
+ $[4] = t7;
48
+ } else {
49
+ data = $[3];
50
+ t7 = $[4];
51
+ }
52
+ const t8 = data.length + quietZone * 2;
53
+ let t9;
54
+ if ($[5] !== t7 || $[6] !== t8) {
55
+ t9 = {
56
+ path: t7,
57
+ modules: t8
58
+ };
59
+ $[5] = t7;
60
+ $[6] = t8;
61
+ $[7] = t9;
62
+ } else t9 = $[7];
63
+ t6 = t9;
64
+ } catch {
65
+ t6 = null;
66
+ }
67
+ }
68
+ const drawing = t6;
69
+ if (!drawing) return null;
70
+ const t7 = `0 0 ${String(drawing.modules)} ${String(drawing.modules)}`;
71
+ let t8;
72
+ if ($[8] !== className) {
73
+ t8 = cn("inline-block shrink-0", className);
74
+ $[8] = className;
75
+ $[9] = t8;
76
+ } else t8 = $[9];
77
+ let t9;
78
+ if ($[10] !== background || $[11] !== drawing.modules) {
79
+ t9 = /* @__PURE__ */ jsx("rect", {
80
+ width: drawing.modules,
81
+ height: drawing.modules,
82
+ fill: background
83
+ });
84
+ $[10] = background;
85
+ $[11] = drawing.modules;
86
+ $[12] = t9;
87
+ } else t9 = $[12];
88
+ let t10;
89
+ if ($[13] !== drawing.path || $[14] !== foreground) {
90
+ t10 = /* @__PURE__ */ jsx("path", {
91
+ d: drawing.path,
92
+ fill: foreground
93
+ });
94
+ $[13] = drawing.path;
95
+ $[14] = foreground;
96
+ $[15] = t10;
97
+ } else t10 = $[15];
98
+ let t11;
99
+ if ($[16] !== ariaLabel || $[17] !== size || $[18] !== t10 || $[19] !== t7 || $[20] !== t8 || $[21] !== t9) {
100
+ t11 = /* @__PURE__ */ jsxs("svg", {
101
+ role: "img",
102
+ "aria-label": ariaLabel,
103
+ width: size,
104
+ height: size,
105
+ viewBox: t7,
106
+ shapeRendering: "crispEdges",
107
+ className: t8,
108
+ children: [t9, t10]
109
+ });
110
+ $[16] = ariaLabel;
111
+ $[17] = size;
112
+ $[18] = t10;
113
+ $[19] = t7;
114
+ $[20] = t8;
115
+ $[21] = t9;
116
+ $[22] = t11;
117
+ } else t11 = $[22];
118
+ return t11;
119
+ };
120
+ export { QRCode };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * A QR code's modules as one SVG path, in a grid where each module is 1 by 1. Pure, so it is tested in Node. Runs of
3
+ * dark modules along a row become one rectangle each, so a code of 100 by 100 modules is a few thousand short
4
+ * commands, not ten thousand squares.
5
+ */
6
+ /** The path of the dark modules of a matrix (`true` is dark), offset by `margin` modules on every side. */
7
+ export declare const qrPath: (matrix: readonly (readonly boolean[])[], margin?: number) => string;
@@ -0,0 +1,25 @@
1
+ // src/patterns/QRCode/qr-path.ts
2
+ /**
3
+ * A QR code's modules as one SVG path, in a grid where each module is 1 by 1. Pure, so it is tested in Node. Runs of
4
+ * dark modules along a row become one rectangle each, so a code of 100 by 100 modules is a few thousand short
5
+ * commands, not ten thousand squares.
6
+ */
7
+ /** The path of the dark modules of a matrix (`true` is dark), offset by `margin` modules on every side. */
8
+ var qrPath = (matrix, margin = 0) => {
9
+ const parts = [];
10
+ matrix.forEach((row, y) => {
11
+ let x = 0;
12
+ while (x < row.length) {
13
+ if (!row[x]) {
14
+ x += 1;
15
+ continue;
16
+ }
17
+ let end = x;
18
+ while (end < row.length && row[end]) end += 1;
19
+ parts.push(`M${String(x + margin)} ${String(y + margin)}h${String(end - x)}v1h${String(x - end)}z`);
20
+ x = end;
21
+ }
22
+ });
23
+ return parts.join("");
24
+ };
25
+ export { qrPath };
@@ -0,0 +1,34 @@
1
+ import { type ReactNode } from "react";
2
+ export interface ResizablePanel {
3
+ id: string;
4
+ content: ReactNode;
5
+ /** The share of the container the panel starts with, in percent. Panels with none share what is left. */
6
+ defaultSize?: number | undefined;
7
+ /** The least the panel can be dragged to, in percent. Default 10. */
8
+ minSize?: number | undefined;
9
+ }
10
+ /** The texts of the dividers. The design system has no i18n, so the caller supplies them. */
11
+ export interface ResizablePanelsLabels {
12
+ /** Names the divider after panel `index` (from 0), e.g. `(i) => `Resize panels ${i + 1} and ${i + 2}``. */
13
+ resize: (index: number) => string;
14
+ }
15
+ export interface ResizablePanelsProps {
16
+ panels: readonly ResizablePanel[];
17
+ labels: ResizablePanelsLabels;
18
+ /** Side by side (default) or one above the other. */
19
+ orientation?: "horizontal" | "vertical" | undefined;
20
+ /** The sizes in percent, one for each panel, adding up to 100. Leave it out to let the panels keep their own. */
21
+ sizes?: readonly number[] | undefined;
22
+ /** Called with the sizes as a divider moves. */
23
+ onSizesChange?: ((sizes: number[]) => void) | undefined;
24
+ /** What the panels are, e.g. "Mail". A group's name. */
25
+ "aria-label"?: string | undefined;
26
+ className?: string | undefined;
27
+ }
28
+ /**
29
+ * Panels with dividers between them that the person drags to give one more room and the next less. The dividers
30
+ * are focusable separators with a value, so the arrow keys move them too (1%, or 10% with Shift), and Home and End
31
+ * take the panel before to its least and most. Side by side, the panels run the way the page reads. Give the
32
+ * container a height.
33
+ */
34
+ export declare const ResizablePanels: ({ panels, labels, orientation, sizes: controlled, onSizesChange, "aria-label": ariaLabel, className, }: ResizablePanelsProps) => import("react").JSX.Element;
@@ -0,0 +1,175 @@
1
+ "use client";
2
+ import { c } from "react/compiler-runtime";
3
+ import { Fragment, useEffect, useRef, useState } from "react";
4
+ import { useDirection } from "@base-ui/react/direction-provider";
5
+ import { cn } from "../../utils/cn.js";
6
+ import { dividerRange, normalizeSizes, reconcileSizes, resizeSizes, sameIds } from "./panel-sizes.js";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ // src/patterns/ResizablePanels/ResizablePanels.tsx
9
+ var KEY_STEP = 1;
10
+ var KEY_STEP_LARGE = 10;
11
+ /**
12
+ * Panels with dividers between them that the person drags to give one more room and the next less. The dividers
13
+ * are focusable separators with a value, so the arrow keys move them too (1%, or 10% with Shift), and Home and End
14
+ * take the panel before to its least and most. Side by side, the panels run the way the page reads. Give the
15
+ * container a height.
16
+ */
17
+ var ResizablePanels = (t0) => {
18
+ const $ = c(13);
19
+ const { panels, labels, orientation: t1, sizes: controlled, onSizesChange, "aria-label": ariaLabel, className } = t0;
20
+ const orientation = t1 === void 0 ? "horizontal" : t1;
21
+ const direction = useDirection();
22
+ const isVertical = orientation === "vertical";
23
+ const container = useRef(null);
24
+ let t2;
25
+ if ($[0] !== panels) {
26
+ t2 = () => ({
27
+ ids: panels.map(_temp),
28
+ sizes: normalizeSizes(panels.length, panels.map(_temp2))
29
+ });
30
+ $[0] = panels;
31
+ $[1] = t2;
32
+ } else t2 = $[1];
33
+ const [own, setOwn] = useState(t2);
34
+ const ownSizes = sameIds(own.ids, panels) ? own.sizes : reconcileSizes(own, panels);
35
+ const sizes = controlled ? normalizeSizes(panels.length, controlled) : ownSizes;
36
+ const minimums = panels.map(_temp3);
37
+ const endDrag = useRef(null);
38
+ let t3;
39
+ let t4;
40
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
41
+ t3 = () => () => {
42
+ endDrag.current?.();
43
+ };
44
+ t4 = [];
45
+ $[2] = t3;
46
+ $[3] = t4;
47
+ } else {
48
+ t3 = $[2];
49
+ t4 = $[3];
50
+ }
51
+ useEffect(t3, t4);
52
+ const move = (index, delta, t5) => {
53
+ const next = resizeSizes(t5 === void 0 ? sizes : t5, index, delta, minimums);
54
+ if (!controlled) setOwn({
55
+ ids: panels.map(_temp4),
56
+ sizes: next
57
+ });
58
+ onSizesChange?.(next);
59
+ };
60
+ const onKeyDown = (index_0, event) => {
61
+ const step = event.shiftKey ? KEY_STEP_LARGE : KEY_STEP;
62
+ const { min, max } = dividerRange(sizes, index_0, minimums);
63
+ const grow = isVertical ? "ArrowDown" : direction === "rtl" ? "ArrowLeft" : "ArrowRight";
64
+ const shrink = isVertical ? "ArrowUp" : direction === "rtl" ? "ArrowRight" : "ArrowLeft";
65
+ const before = sizes[index_0] ?? 0;
66
+ if (event.key === grow) move(index_0, step);
67
+ else if (event.key === shrink) move(index_0, -step);
68
+ else if (event.key === "Home") move(index_0, min - before);
69
+ else if (event.key === "End") move(index_0, max - before);
70
+ else return;
71
+ event.preventDefault();
72
+ };
73
+ const onPointerDown = (index_1, event_0) => {
74
+ if (event_0.button !== 0) return;
75
+ const box = container.current?.getBoundingClientRect();
76
+ const length = box ? isVertical ? box.height : box.width : 0;
77
+ if (length === 0) return;
78
+ endDrag.current?.();
79
+ const divider = event_0.currentTarget;
80
+ const { pointerId } = event_0;
81
+ try {
82
+ divider.setPointerCapture(pointerId);
83
+ } catch {}
84
+ divider.focus();
85
+ const start = isVertical ? event_0.clientY : event_0.clientX;
86
+ const startSizes = sizes;
87
+ const sign = !isVertical && direction === "rtl" ? -1 : 1;
88
+ const onMove = (moveEvent) => {
89
+ if (moveEvent.pointerId !== pointerId) return;
90
+ const at = isVertical ? moveEvent.clientY : moveEvent.clientX;
91
+ move(index_1, sign * (at - start) * 100 / length, startSizes);
92
+ };
93
+ const onEnd = (endEvent) => {
94
+ if (endEvent.pointerId === pointerId) stop();
95
+ };
96
+ const stop = () => {
97
+ window.removeEventListener("pointermove", onMove);
98
+ window.removeEventListener("pointerup", onEnd);
99
+ window.removeEventListener("pointercancel", onEnd);
100
+ divider.removeEventListener("lostpointercapture", onEnd);
101
+ endDrag.current = null;
102
+ };
103
+ window.addEventListener("pointermove", onMove);
104
+ window.addEventListener("pointerup", onEnd);
105
+ window.addEventListener("pointercancel", onEnd);
106
+ divider.addEventListener("lostpointercapture", onEnd);
107
+ endDrag.current = stop;
108
+ };
109
+ const t6 = "group";
110
+ let t7;
111
+ if ($[4] !== ariaLabel) {
112
+ t7 = ariaLabel ? { "aria-label": ariaLabel } : {};
113
+ $[4] = ariaLabel;
114
+ $[5] = t7;
115
+ } else t7 = $[5];
116
+ const t8 = isVertical ? "flex-col" : "flex-row";
117
+ let t9;
118
+ if ($[6] !== className || $[7] !== t8) {
119
+ t9 = cn("flex size-full min-h-0 min-w-0", t8, className);
120
+ $[6] = className;
121
+ $[7] = t8;
122
+ $[8] = t9;
123
+ } else t9 = $[8];
124
+ const t10 = panels.map((panel_3, index_2) => {
125
+ const { min: min_0, max: max_0 } = dividerRange(sizes, index_2, minimums);
126
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
127
+ className: "min-h-0 min-w-0 overflow-auto",
128
+ style: { flex: `${String(sizes[index_2] ?? 0)} 1 0%` },
129
+ children: panel_3.content
130
+ }), index_2 < panels.length - 1 ? /* @__PURE__ */ jsx("div", {
131
+ role: "separator",
132
+ "aria-orientation": isVertical ? "horizontal" : "vertical",
133
+ "aria-label": labels.resize(index_2),
134
+ "aria-valuenow": Math.round(sizes[index_2] ?? 0),
135
+ "aria-valuemin": Math.round(min_0),
136
+ "aria-valuemax": Math.round(max_0),
137
+ tabIndex: 0,
138
+ className: cn("relative shrink-0 touch-none bg-line outline-none transition-colors hover:bg-primary focus-visible:bg-primary", isVertical ? "h-px cursor-row-resize" : "w-px cursor-col-resize", "before:absolute before:content-['']", isVertical ? "before:inset-x-0 before:-inset-y-1.5" : "before:inset-y-0 before:-inset-x-1.5", "focus-visible:ring-2 focus-visible:ring-focus"),
139
+ onKeyDown: (event_1) => {
140
+ onKeyDown(index_2, event_1);
141
+ },
142
+ onPointerDown: (event_2) => {
143
+ onPointerDown(index_2, event_2);
144
+ }
145
+ }) : null] }, panel_3.id);
146
+ });
147
+ let t11;
148
+ if ($[9] !== t10 || $[10] !== t7 || $[11] !== t9) {
149
+ t11 = /* @__PURE__ */ jsx("div", {
150
+ ref: container,
151
+ role: t6,
152
+ ...t7,
153
+ className: t9,
154
+ children: t10
155
+ });
156
+ $[9] = t10;
157
+ $[10] = t7;
158
+ $[11] = t9;
159
+ $[12] = t11;
160
+ } else t11 = $[12];
161
+ return t11;
162
+ };
163
+ function _temp(panel) {
164
+ return panel.id;
165
+ }
166
+ function _temp2(panel_0) {
167
+ return panel_0.defaultSize;
168
+ }
169
+ function _temp3(panel_1) {
170
+ return panel_1.minSize ?? 10;
171
+ }
172
+ function _temp4(panel_2) {
173
+ return panel_2.id;
174
+ }
175
+ export { ResizablePanels };
@@ -0,0 +1,31 @@
1
+ /**
2
+ * The arithmetic of resizable panels, as pure functions so it is tested in Node. Sizes are percentages of the
3
+ * container that add up to 100.
4
+ */
5
+ /** Sizes scaled so they add up to 100. Missing or non-positive sizes share what the given ones leave. */
6
+ export declare const normalizeSizes: (count: number, given?: readonly (number | undefined)[]) => number[];
7
+ /**
8
+ * Moves the divider after panel `index` by `delta` percent (positive grows that panel and shrinks the next), so the
9
+ * two share what they had, neither going under its minimum. The other panels are untouched.
10
+ */
11
+ export declare const resizeSizes: (sizes: readonly number[], index: number, delta: number, minimums: readonly number[]) => number[];
12
+ /** The least and the most the panel before a divider can be, for the divider's `aria-valuemin` and `aria-valuemax`. */
13
+ export declare const dividerRange: (sizes: readonly number[], index: number, minimums: readonly number[]) => {
14
+ min: number;
15
+ max: number;
16
+ };
17
+ /**
18
+ * The sizes after the panels changed (one added, one removed): a panel that was there keeps its size, a new one
19
+ * takes its `defaultSize`, or a share when it has none, and the result is scaled to add up to 100 again.
20
+ */
21
+ export declare const reconcileSizes: (previous: {
22
+ ids: readonly string[];
23
+ sizes: readonly number[];
24
+ }, panels: readonly {
25
+ id: string;
26
+ defaultSize?: number | undefined;
27
+ }[]) => number[];
28
+ /** Whether the panels are still the ones, in the same order, that `ids` lists. */
29
+ export declare const sameIds: (ids: readonly string[], panels: readonly {
30
+ id: string;
31
+ }[]) => boolean;
@@ -0,0 +1,54 @@
1
+ // src/patterns/ResizablePanels/panel-sizes.ts
2
+ /**
3
+ * The arithmetic of resizable panels, as pure functions so it is tested in Node. Sizes are percentages of the
4
+ * container that add up to 100.
5
+ */
6
+ /** Sizes scaled so they add up to 100. Missing or non-positive sizes share what the given ones leave. */
7
+ var normalizeSizes = (count, given = []) => {
8
+ const known = Array.from({ length: count }, (_, index) => {
9
+ const size = given[index];
10
+ return size !== void 0 && size > 0 ? size : void 0;
11
+ });
12
+ const used = known.reduce((sum, size) => sum + (size ?? 0), 0);
13
+ const missing = known.filter((size) => size === void 0).length;
14
+ const share = missing === 0 ? 0 : used >= 100 || used === 0 ? 100 / count : (100 - used) / missing;
15
+ const raw = known.map((size) => size ?? share);
16
+ const total = raw.reduce((sum, size) => sum + size, 0);
17
+ return raw.map((size) => size / total * 100);
18
+ };
19
+ /**
20
+ * Moves the divider after panel `index` by `delta` percent (positive grows that panel and shrinks the next), so the
21
+ * two share what they had, neither going under its minimum. The other panels are untouched.
22
+ */
23
+ var resizeSizes = (sizes, index, delta, minimums) => {
24
+ const before = sizes[index];
25
+ const after = sizes[index + 1];
26
+ if (before === void 0 || after === void 0) return [...sizes];
27
+ const pair = before + after;
28
+ const least = minimums[index] ?? 0;
29
+ const most = pair - (minimums[index + 1] ?? 0);
30
+ const next = Math.min(Math.max(before + delta, least), Math.max(most, least));
31
+ const result = [...sizes];
32
+ result[index] = next;
33
+ result[index + 1] = pair - next;
34
+ return result;
35
+ };
36
+ /** The least and the most the panel before a divider can be, for the divider's `aria-valuemin` and `aria-valuemax`. */
37
+ var dividerRange = (sizes, index, minimums) => {
38
+ const pair = (sizes[index] ?? 0) + (sizes[index + 1] ?? 0);
39
+ return {
40
+ min: minimums[index] ?? 0,
41
+ max: pair - (minimums[index + 1] ?? 0)
42
+ };
43
+ };
44
+ /**
45
+ * The sizes after the panels changed (one added, one removed): a panel that was there keeps its size, a new one
46
+ * takes its `defaultSize`, or a share when it has none, and the result is scaled to add up to 100 again.
47
+ */
48
+ var reconcileSizes = (previous, panels) => normalizeSizes(panels.length, panels.map((panel) => {
49
+ const at = previous.ids.indexOf(panel.id);
50
+ return at === -1 ? panel.defaultSize : previous.sizes[at];
51
+ }));
52
+ /** Whether the panels are still the ones, in the same order, that `ids` lists. */
53
+ var sameIds = (ids, panels) => ids.length === panels.length && panels.every((panel, index) => panel.id === ids[index]);
54
+ export { dividerRange, normalizeSizes, reconcileSizes, resizeSizes, sameIds };
@@ -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 RichTextEditorProps } from "./RichTextEditor.js";
4
+ export type { RichTextEditorLabels } from "./RichTextEditor.js";
5
+ export interface FormRichTextFieldProps<TValues extends FieldValues> extends Omit<RichTextEditorProps, "value" | "onValueChange" | "onBlur" | "invalid" | "editorRef" | "aria-label" | "aria-labelledby" | "aria-describedby" | "className"> {
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 RichTextEditor in a field, bound to a react-hook-form string field holding the text as HTML. */
18
+ export declare const FormRichTextField: <TValues extends FieldValues>({ control, name, label, hint, orientation, rules, formatError, required, disabled, ...editorProps }: FormRichTextFieldProps<TValues>) => import("react").JSX.Element;
@@ -0,0 +1,118 @@
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 { RichTextEditor } from "./RichTextEditor.js";
8
+ import { jsx } from "react/jsx-runtime";
9
+ // src/patterns/RichTextEditor/FormRichTextField.tsx
10
+ /** A RichTextEditor in a field, bound to a react-hook-form string field holding the text as HTML. */
11
+ var FormRichTextField = (t0) => {
12
+ const $ = c(29);
13
+ let control;
14
+ let editorProps;
15
+ let formatError;
16
+ let hint;
17
+ let label;
18
+ let name;
19
+ let orientation;
20
+ let required;
21
+ let rules;
22
+ let t1;
23
+ if ($[0] !== t0) {
24
+ ({control, name, label, hint, orientation, rules, formatError, required, disabled: t1, ...editorProps} = t0);
25
+ $[0] = t0;
26
+ $[1] = control;
27
+ $[2] = editorProps;
28
+ $[3] = formatError;
29
+ $[4] = hint;
30
+ $[5] = label;
31
+ $[6] = name;
32
+ $[7] = orientation;
33
+ $[8] = required;
34
+ $[9] = rules;
35
+ $[10] = t1;
36
+ } else {
37
+ control = $[1];
38
+ editorProps = $[2];
39
+ formatError = $[3];
40
+ hint = $[4];
41
+ label = $[5];
42
+ name = $[6];
43
+ orientation = $[7];
44
+ required = $[8];
45
+ rules = $[9];
46
+ t1 = $[10];
47
+ }
48
+ const disabled = t1 === void 0 ? false : t1;
49
+ const { labelId, messageIds, describe } = useFieldIds();
50
+ let t2;
51
+ if ($[11] !== rules) {
52
+ t2 = rules ? { rules } : {};
53
+ $[11] = rules;
54
+ $[12] = t2;
55
+ } else t2 = $[12];
56
+ let t3;
57
+ if ($[13] !== describe || $[14] !== disabled || $[15] !== editorProps || $[16] !== formatError || $[17] !== hint || $[18] !== label || $[19] !== labelId || $[20] !== messageIds || $[21] !== orientation || $[22] !== required) {
58
+ t3 = (t4) => {
59
+ const { field, fieldState } = t4;
60
+ const errorMessage = toErrorText(fieldState.error?.message, formatError);
61
+ const describedBy = describe(errorMessage, hint);
62
+ return /* @__PURE__ */ jsx(FieldFrame, {
63
+ name: field.name,
64
+ label,
65
+ labelId,
66
+ triggerLabel: true,
67
+ messageIds,
68
+ disabled,
69
+ invalid: fieldState.invalid,
70
+ touched: fieldState.isTouched,
71
+ dirty: fieldState.isDirty,
72
+ ...hint ? { hint } : {},
73
+ ...required ? { required } : {},
74
+ ...orientation ? { orientation } : {},
75
+ ...errorMessage === void 0 ? {} : { errorMessage },
76
+ children: /* @__PURE__ */ jsx(RichTextEditor, {
77
+ ...editorProps,
78
+ editorRef: field.ref,
79
+ "aria-labelledby": labelId,
80
+ ...describedBy ? { "aria-describedby": describedBy } : {},
81
+ value: field.value == null ? "" : String(field.value),
82
+ onValueChange: field.onChange,
83
+ onBlur: field.onBlur,
84
+ invalid: fieldState.invalid,
85
+ required: required ?? false,
86
+ disabled
87
+ })
88
+ });
89
+ };
90
+ $[13] = describe;
91
+ $[14] = disabled;
92
+ $[15] = editorProps;
93
+ $[16] = formatError;
94
+ $[17] = hint;
95
+ $[18] = label;
96
+ $[19] = labelId;
97
+ $[20] = messageIds;
98
+ $[21] = orientation;
99
+ $[22] = required;
100
+ $[23] = t3;
101
+ } else t3 = $[23];
102
+ let t4;
103
+ if ($[24] !== control || $[25] !== name || $[26] !== t2 || $[27] !== t3) {
104
+ t4 = /* @__PURE__ */ jsx(Controller, {
105
+ control,
106
+ name,
107
+ ...t2,
108
+ render: t3
109
+ });
110
+ $[24] = control;
111
+ $[25] = name;
112
+ $[26] = t2;
113
+ $[27] = t3;
114
+ $[28] = t4;
115
+ } else t4 = $[28];
116
+ return t4;
117
+ };
118
+ export { FormRichTextField };