@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,23 @@
1
+ // src/patterns/DateTimePicker/picker-labels.ts
2
+ /** The texts used when a picker is given none. */
3
+ var ENGLISH_PICKER_LABELS = {
4
+ select: "Select",
5
+ today: "Today",
6
+ now: "Now",
7
+ clear: "Clear",
8
+ done: "Done",
9
+ time: "Time",
10
+ hour: "Hour",
11
+ minute: "Minute",
12
+ second: "Second",
13
+ previousMonth: "Previous month",
14
+ nextMonth: "Next month",
15
+ previousYear: "Previous year",
16
+ nextYear: "Next year",
17
+ chooseMonth: "Choose month and year",
18
+ backToCalendar: "Back to the calendar",
19
+ chooseDate: "Choose date",
20
+ chooseDateTime: "Choose date and time",
21
+ chooseTime: "Choose time"
22
+ };
23
+ export { ENGLISH_PICKER_LABELS };
@@ -0,0 +1,98 @@
1
+ import { type Locale } from "date-fns";
2
+ /** What the picker holds: a day, a day and a time, or a time. */
3
+ export type PickerKind = "date" | "datetime" | "time";
4
+ /** A value taken apart. The part the kind does not hold is null. */
5
+ export interface PickerParts {
6
+ /** "yyyy-MM-dd" */
7
+ day: string | null;
8
+ /** "HH:mm:ss" */
9
+ time: string | null;
10
+ }
11
+ /** The value as parts, or null for an empty or unreadable one, or one of another kind. */
12
+ export declare const readPickerValue: (value: string, kind: PickerKind) => PickerParts | null;
13
+ /** The text of a value, with or without seconds; empty if a part the kind needs is missing. */
14
+ export declare const joinPickerValue: ({ day, time }: PickerParts, kind: PickerKind, withSeconds: boolean) => string;
15
+ /** A time with its seconds set to ":00" unless the picker has seconds. */
16
+ export declare const roundTime: (time: string, withSeconds: boolean) => string;
17
+ /** Today and the time now. */
18
+ export declare const currentParts: (now?: Date) => PickerParts;
19
+ /** The time of day a text names ("00:00", "23:59:59"), or the time now if it names none. */
20
+ export declare const timeOrNow: (text: string | undefined) => string;
21
+ /** The hour, minute and second of "HH:mm:ss". */
22
+ export declare const clockOf: (time: string) => {
23
+ hour: number;
24
+ minute: number;
25
+ second: number;
26
+ };
27
+ /** "HH:mm:ss" for an hour, a minute and a second. */
28
+ export declare const timeOf: (hour: number, minute: number, second: number) => string;
29
+ /** The earliest and latest value the picker accepts, as parts. Either may be missing. */
30
+ export interface PickerBounds {
31
+ min: PickerParts | null;
32
+ max: PickerParts | null;
33
+ }
34
+ /**
35
+ * The range from the `min` and `max` texts, which are written as the picker's value is
36
+ * (and, for a date and time, may be a day alone). One that cannot be read is no limit.
37
+ */
38
+ export declare const readBounds: (min: string | undefined, max: string | undefined, kind: PickerKind) => PickerBounds;
39
+ /** The value held inside the range: one outside it becomes the nearer limit. A value still missing a part is left as it is. */
40
+ export declare const clampPickerParts: (parts: PickerParts, kind: PickerKind, { min, max }: PickerBounds) => PickerParts;
41
+ /** Whether a day may be picked (a day-and-time range allows all of its first and last days). */
42
+ export declare const isDayAllowed: (day: string, { min, max }: PickerBounds) => boolean;
43
+ /** The day, or the nearest day inside the range if it is outside. */
44
+ export declare const nearestAllowedDay: (day: string, { min, max }: PickerBounds) => string;
45
+ export interface CalendarCell {
46
+ /** "yyyy-MM-dd" */
47
+ day: string;
48
+ /** The day of the month, 1 to 31. */
49
+ date: number;
50
+ /** False for the days of the neighbouring months that fill the first and last weeks. */
51
+ inMonth: boolean;
52
+ }
53
+ /**
54
+ * The weeks of a month ("yyyy-MM"), from the locale's first day of the week (Sunday without one), with only as
55
+ * many weeks as the month needs (4 to 6).
56
+ */
57
+ export declare const monthWeeks: (month: string, locale?: Locale) => CalendarCell[][];
58
+ /** The month ("yyyy-MM") of a day. */
59
+ export declare const monthOf: (day: string) => string;
60
+ /** The month ("yyyy-MM") a number of months from another. */
61
+ export declare const shiftMonth: (month: string, by: number) => string;
62
+ /** The day a number of days from another. */
63
+ export declare const shiftDay: (day: string, by: number) => string;
64
+ /** The same day of the month a number of months away, or the last day of a shorter month (31 Jan + 1 is 28 Feb). */
65
+ export declare const shiftDayByMonths: (day: string, by: number) => string;
66
+ /** The first or last day of the day's week, as `monthWeeks` lays the weeks out (Sunday and Saturday without a locale). */
67
+ export declare const weekEdge: (day: string, edge: "start" | "end", locale?: Locale) => string;
68
+ /** The names of the week's days from the locale's first day of the week: "S" and "Sunday" first in English. */
69
+ export declare const weekdayNames: (locale: Locale) => {
70
+ narrow: string;
71
+ long: string;
72
+ }[];
73
+ /** The names of the twelve months from January: "Jan" and "January" in English. */
74
+ export declare const monthNames: (locale: Locale) => {
75
+ short: string;
76
+ long: string;
77
+ }[];
78
+ /** "October 2026" for "2026-10". */
79
+ export declare const monthTitle: (month: string, locale: Locale) => string;
80
+ /** "2026" for "2026-10". */
81
+ export declare const yearOf: (month: string) => string;
82
+ /**
83
+ * "Saturday 24 October 2026" for "2026-10-24": the name of a day's button. The day's number stays a word of the
84
+ * name, so the name contains the text the button shows (WCAG 2.5.3 Label in Name); the long date "Saturday,
85
+ * October 24th, 2026" does not.
86
+ */
87
+ export declare const dayLabel: (day: string, locale: Locale) => string;
88
+ export interface PickerDisplay {
89
+ withSeconds: boolean;
90
+ /** For a day: "24 October" and not "24/10/2026", for a date whose year does not matter (a season's first day). */
91
+ dayMonth: boolean;
92
+ locale: Locale;
93
+ }
94
+ /**
95
+ * The value as the picker shows it: "24/10/2026", "24/10/2026 14:05" or "14:05" (day first, 24-hour,
96
+ * whatever the locale), with ":09" if it has seconds. Empty for an unreadable value.
97
+ */
98
+ export declare const formatPickerValue: (value: string, kind: PickerKind, { withSeconds, dayMonth, locale }: PickerDisplay) => string;
@@ -0,0 +1,194 @@
1
+ import { addDays, addMonths, eachDayOfInterval, eachMonthOfInterval, endOfMonth, endOfWeek, endOfYear, format, getDate, isExists, parseISO, set, startOfMonth, startOfWeek, startOfYear } from "date-fns";
2
+ // src/patterns/DateTimePicker/picker-values.ts
3
+ var DAY_FORMAT = "yyyy-MM-dd";
4
+ var MONTH_FORMAT = "yyyy-MM";
5
+ var DAY_PATTERN = /^(\d{4})-(\d{2})-(\d{2})$/;
6
+ var TIME_PATTERN = /^([01]\d|2[0-3]):([0-5]\d)(?::([0-5]\d))?$/;
7
+ /** A date for a time of day alone, only to let date-fns write it. */
8
+ var CLOCK_DAY = "2000-01-01";
9
+ var START_OF_DAY = "00:00:00";
10
+ var END_OF_DAY = "23:59:59";
11
+ /** The day, if it is one that exists ("2026-02-31" is not). */
12
+ var readDay = (text) => {
13
+ const match = DAY_PATTERN.exec(text);
14
+ if (!match) return null;
15
+ return isExists(Number(match[1]), Number(match[2]) - 1, Number(match[3])) ? text : null;
16
+ };
17
+ /** "HH:mm:ss", from "HH:mm" or "HH:mm:ss"; null for anything else (no "24:00", no "9:5"). */
18
+ var readTime = (text) => {
19
+ const match = TIME_PATTERN.exec(text);
20
+ return match ? `${match[1]}:${match[2]}:${match[3] ?? "00"}` : null;
21
+ };
22
+ /**
23
+ * The moment a day ("yyyy-MM-dd") and a time ("HH:mm:ss") stand for in the viewer's zone:
24
+ * an ISO text without a zone is local time to date-fns. A time the clocks skip is the
25
+ * moment as far past the jump (02:30 is 03:30 where they jump from 02:00 to 03:00).
26
+ * Days that do not exist are refused before this.
27
+ */
28
+ var toDate = (day, time = null) => parseISO(`${day}T${time ?? START_OF_DAY}`);
29
+ /** The value as parts, or null for an empty or unreadable one, or one of another kind. */
30
+ var readPickerValue = (value, kind) => {
31
+ if (kind === "date") {
32
+ const day = readDay(value);
33
+ return day === null ? null : {
34
+ day,
35
+ time: null
36
+ };
37
+ }
38
+ if (kind === "time") {
39
+ const time = readTime(value);
40
+ return time === null ? null : {
41
+ day: null,
42
+ time
43
+ };
44
+ }
45
+ const [dayText = "", timeText = ""] = value.split("T");
46
+ const day = readDay(dayText);
47
+ const time = readTime(timeText);
48
+ return day === null || time === null ? null : {
49
+ day,
50
+ time
51
+ };
52
+ };
53
+ /** The text of a value, with or without seconds; empty if a part the kind needs is missing. */
54
+ var joinPickerValue = ({ day, time }, kind, withSeconds) => {
55
+ const clock = time === null ? null : withSeconds ? time : time.slice(0, 5);
56
+ if (kind === "date") return day ?? "";
57
+ if (kind === "time") return clock ?? "";
58
+ return day === null || clock === null ? "" : `${day}T${clock}`;
59
+ };
60
+ /** A time with its seconds set to ":00" unless the picker has seconds. */
61
+ var roundTime = (time, withSeconds) => withSeconds ? time : `${time.slice(0, 5)}:00`;
62
+ /** Today and the time now. */
63
+ var currentParts = (now = /* @__PURE__ */ new Date()) => ({
64
+ day: format(now, DAY_FORMAT),
65
+ time: format(now, "HH:mm:ss")
66
+ });
67
+ /** The time of day a text names ("00:00", "23:59:59"), or the time now if it names none. */
68
+ var timeOrNow = (text) => (text === void 0 ? null : readTime(text)) ?? currentParts().time ?? START_OF_DAY;
69
+ /** The hour, minute and second of "HH:mm:ss". */
70
+ var clockOf = (time) => {
71
+ const [hour = 0, minute = 0, second = 0] = time.split(":").map(Number);
72
+ return {
73
+ hour,
74
+ minute,
75
+ second
76
+ };
77
+ };
78
+ /** "HH:mm:ss" for an hour, a minute and a second. */
79
+ var timeOf = (hour, minute, second) => format(set(toDate(CLOCK_DAY), {
80
+ hours: hour,
81
+ minutes: minute,
82
+ seconds: second
83
+ }), "HH:mm:ss");
84
+ var readBound = (text, kind, edge) => {
85
+ if (text === void 0 || text === "") return null;
86
+ const whole = readPickerValue(text, kind);
87
+ if (whole) return whole;
88
+ const day = kind === "datetime" ? readDay(text) : null;
89
+ return day === null ? null : {
90
+ day,
91
+ time: edge === "min" ? START_OF_DAY : END_OF_DAY
92
+ };
93
+ };
94
+ /**
95
+ * The range from the `min` and `max` texts, which are written as the picker's value is
96
+ * (and, for a date and time, may be a day alone). One that cannot be read is no limit.
97
+ */
98
+ var readBounds = (min, max, kind) => ({
99
+ min: readBound(min, kind, "min"),
100
+ max: readBound(max, kind, "max")
101
+ });
102
+ /** The text two values of one kind are compared by. */
103
+ var comparable = (parts, kind) => kind === "date" ? parts.day ?? "" : kind === "time" ? parts.time ?? "" : `${parts.day ?? ""}T${parts.time ?? ""}`;
104
+ /** The value held inside the range: one outside it becomes the nearer limit. A value still missing a part is left as it is. */
105
+ var clampPickerParts = (parts, kind, { min, max }) => {
106
+ const key = comparable(parts, kind);
107
+ if (kind !== "time" && parts.day === null) return parts;
108
+ if (kind !== "date" && parts.time === null) return parts;
109
+ if (min && key < comparable(min, kind)) return min;
110
+ if (max && key > comparable(max, kind)) return max;
111
+ return parts;
112
+ };
113
+ /** Before every day and after every day: the limits of a range that has none. */
114
+ var FIRST_DAY = "0000-01-01";
115
+ var LAST_DAY = "9999-12-31";
116
+ /** Whether a day may be picked (a day-and-time range allows all of its first and last days). */
117
+ var isDayAllowed = (day, { min, max }) => day >= (min?.day ?? FIRST_DAY) && day <= (max?.day ?? LAST_DAY);
118
+ /** The day, or the nearest day inside the range if it is outside. */
119
+ var nearestAllowedDay = (day, { min, max }) => {
120
+ const earliest = min?.day ?? FIRST_DAY;
121
+ const latest = max?.day ?? LAST_DAY;
122
+ return day < earliest ? earliest : day > latest ? latest : day;
123
+ };
124
+ /**
125
+ * The day a week starts on: the locale's (Monday for `de` or `enGB`), or Sunday for a locale that names none and
126
+ * when no locale is given.
127
+ */
128
+ var weekOf = (locale) => ({ weekStartsOn: locale?.options?.weekStartsOn ?? 0 });
129
+ /**
130
+ * The weeks of a month ("yyyy-MM"), from the locale's first day of the week (Sunday without one), with only as
131
+ * many weeks as the month needs (4 to 6).
132
+ */
133
+ var monthWeeks = (month, locale) => {
134
+ const first = startOfMonth(toDate(`${month}-01`));
135
+ const days = eachDayOfInterval({
136
+ start: startOfWeek(first, weekOf(locale)),
137
+ end: endOfWeek(endOfMonth(first), weekOf(locale))
138
+ });
139
+ const weeks = [];
140
+ for (let start = 0; start < days.length; start += 7) weeks.push(days.slice(start, start + 7).map((date) => ({
141
+ day: format(date, DAY_FORMAT),
142
+ date: getDate(date),
143
+ inMonth: format(date, MONTH_FORMAT) === month
144
+ })));
145
+ return weeks;
146
+ };
147
+ /** The month ("yyyy-MM") of a day. */
148
+ var monthOf = (day) => day.slice(0, 7);
149
+ /** The month ("yyyy-MM") a number of months from another. */
150
+ var shiftMonth = (month, by) => format(addMonths(toDate(`${month}-01`), by), MONTH_FORMAT);
151
+ /** The day a number of days from another. */
152
+ var shiftDay = (day, by) => format(addDays(toDate(day), by), DAY_FORMAT);
153
+ /** The same day of the month a number of months away, or the last day of a shorter month (31 Jan + 1 is 28 Feb). */
154
+ var shiftDayByMonths = (day, by) => format(addMonths(toDate(day), by), DAY_FORMAT);
155
+ /** The first or last day of the day's week, as `monthWeeks` lays the weeks out (Sunday and Saturday without a locale). */
156
+ var weekEdge = (day, edge, locale) => format((edge === "start" ? startOfWeek : endOfWeek)(toDate(day), weekOf(locale)), DAY_FORMAT);
157
+ /** The names of the week's days from the locale's first day of the week: "S" and "Sunday" first in English. */
158
+ var weekdayNames = (locale) => eachDayOfInterval({
159
+ start: startOfWeek(toDate(CLOCK_DAY), weekOf(locale)),
160
+ end: endOfWeek(toDate(CLOCK_DAY), weekOf(locale))
161
+ }).map((day) => ({
162
+ narrow: format(day, "EEEEE", { locale }),
163
+ long: format(day, "EEEE", { locale })
164
+ }));
165
+ /** The names of the twelve months from January: "Jan" and "January" in English. */
166
+ var monthNames = (locale) => eachMonthOfInterval({
167
+ start: startOfYear(toDate(CLOCK_DAY)),
168
+ end: endOfYear(toDate(CLOCK_DAY))
169
+ }).map((month) => ({
170
+ short: format(month, "LLL", { locale }),
171
+ long: format(month, "LLLL", { locale })
172
+ }));
173
+ /** "October 2026" for "2026-10". */
174
+ var monthTitle = (month, locale) => format(toDate(`${month}-01`), "LLLL yyyy", { locale });
175
+ /** "2026" for "2026-10". */
176
+ var yearOf = (month) => month.slice(0, 4);
177
+ /**
178
+ * "Saturday 24 October 2026" for "2026-10-24": the name of a day's button. The day's number stays a word of the
179
+ * name, so the name contains the text the button shows (WCAG 2.5.3 Label in Name); the long date "Saturday,
180
+ * October 24th, 2026" does not.
181
+ */
182
+ var dayLabel = (day, locale) => format(toDate(day), "EEEE d MMMM yyyy", { locale });
183
+ /**
184
+ * The value as the picker shows it: "24/10/2026", "24/10/2026 14:05" or "14:05" (day first, 24-hour,
185
+ * whatever the locale), with ":09" if it has seconds. Empty for an unreadable value.
186
+ */
187
+ var formatPickerValue = (value, kind, { withSeconds, dayMonth, locale }) => {
188
+ const parts = readPickerValue(value, kind);
189
+ if (!parts) return "";
190
+ const clock = withSeconds ? "HH:mm:ss" : "HH:mm";
191
+ const pattern = kind === "time" ? clock : kind === "date" ? dayMonth ? "dd MMMM" : "dd/MM/yyyy" : `dd/MM/yyyy ${clock}`;
192
+ return format(toDate(parts.day ?? CLOCK_DAY, parts.time), pattern, { locale });
193
+ };
194
+ export { clampPickerParts, clockOf, currentParts, dayLabel, formatPickerValue, isDayAllowed, joinPickerValue, monthNames, monthOf, monthTitle, monthWeeks, nearestAllowedDay, readBounds, readPickerValue, roundTime, shiftDay, shiftDayByMonths, shiftMonth, timeOf, timeOrNow, weekEdge, weekdayNames, yearOf };
@@ -0,0 +1,20 @@
1
+ import type { ReactNode } from "react";
2
+ export interface DescriptionListItem {
3
+ /** What the value is: "Status", "Created". */
4
+ term: string;
5
+ /** The value. Text, or any content (a StatusBadge, a link). */
6
+ description: ReactNode;
7
+ }
8
+ export interface DescriptionListProps {
9
+ items: readonly DescriptionListItem[];
10
+ /** "stacked" (default) puts the term over its value; "horizontal" puts the terms in a column beside the values. */
11
+ layout?: "stacked" | "horizontal" | undefined;
12
+ /** A rule between the pairs. */
13
+ dividers?: boolean | undefined;
14
+ className?: string | undefined;
15
+ }
16
+ /**
17
+ * The details of one record as term and value pairs: an order's status, date and total. It is a `<dl>`, so a screen
18
+ * reader announces each value with its term. For a table of many records, see DataTable.
19
+ */
20
+ export declare const DescriptionList: ({ items, layout, dividers, className }: DescriptionListProps) => import("react").JSX.Element;
@@ -0,0 +1,57 @@
1
+ "use client";
2
+ import { c } from "react/compiler-runtime";
3
+ import { cn } from "../../utils/cn.js";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ // src/patterns/DescriptionList/DescriptionList.tsx
6
+ /**
7
+ * The details of one record as term and value pairs: an order's status, date and total. It is a `<dl>`, so a screen
8
+ * reader announces each value with its term. For a table of many records, see DataTable.
9
+ */
10
+ var DescriptionList = (t0) => {
11
+ const $ = c(12);
12
+ const { items, layout: t1, dividers: t2, className } = t0;
13
+ const layout = t1 === void 0 ? "stacked" : t1;
14
+ const dividers = t2 === void 0 ? false : t2;
15
+ let t3;
16
+ if ($[0] !== className) {
17
+ t3 = cn("m-0 flex flex-col", className);
18
+ $[0] = className;
19
+ $[1] = t3;
20
+ } else t3 = $[1];
21
+ let t4;
22
+ if ($[2] !== dividers || $[3] !== items || $[4] !== layout) {
23
+ let t5;
24
+ if ($[6] !== dividers || $[7] !== layout) {
25
+ t5 = (item, index) => /* @__PURE__ */ jsxs("div", {
26
+ className: cn("grid gap-x-6 gap-y-0.5 py-2.5", layout === "horizontal" ? "grid-cols-[minmax(0,1fr)_minmax(0,2fr)] items-baseline" : "grid-cols-1", dividers && "border-b border-line last:border-b-0"),
27
+ children: [/* @__PURE__ */ jsx("dt", {
28
+ className: "text-caption font-medium text-fg-secondary",
29
+ children: item.term
30
+ }), /* @__PURE__ */ jsx("dd", {
31
+ className: "m-0 min-w-0 text-body-sm text-fg",
32
+ children: item.description
33
+ })]
34
+ }, `${item.term}-${String(index)}`);
35
+ $[6] = dividers;
36
+ $[7] = layout;
37
+ $[8] = t5;
38
+ } else t5 = $[8];
39
+ t4 = items.map(t5);
40
+ $[2] = dividers;
41
+ $[3] = items;
42
+ $[4] = layout;
43
+ $[5] = t4;
44
+ } else t4 = $[5];
45
+ let t5;
46
+ if ($[9] !== t3 || $[10] !== t4) {
47
+ t5 = /* @__PURE__ */ jsx("dl", {
48
+ className: t3,
49
+ children: t4
50
+ });
51
+ $[9] = t3;
52
+ $[10] = t4;
53
+ $[11] = t5;
54
+ } else t5 = $[11];
55
+ return t5;
56
+ };
57
+ export { DescriptionList };
@@ -0,0 +1,26 @@
1
+ import { type ReactNode } from "react";
2
+ export interface DialogProps {
3
+ open: boolean;
4
+ onOpenChange: (open: boolean) => void;
5
+ title: string;
6
+ /** The small teal line above the title, e.g. the section the dialog belongs to. */
7
+ eyebrow?: string | undefined;
8
+ /** An icon in a teal tile before the title. */
9
+ icon?: ReactNode | undefined;
10
+ /** One small grey line under the title, e.g. an id. */
11
+ description?: string | undefined;
12
+ children: ReactNode;
13
+ /** Footer buttons, end-aligned in the order given: Cancel first, then the primary action. */
14
+ actions?: ReactNode | undefined;
15
+ /** Accessible name for the close (X) button. The button is omitted when not provided. */
16
+ closeLabel?: string | undefined;
17
+ /** "alert" blocks outside-click and Escape dismissal, for decisions that must be answered. */
18
+ modalType?: "modal" | "alert" | undefined;
19
+ /** Widest the dialog grows: 480px, 800px (default) or 940px. */
20
+ size?: "narrow" | "default" | "wide" | undefined;
21
+ }
22
+ /**
23
+ * A modal dialog, opened and closed by its caller through `open` and `onOpenChange`: a header with an
24
+ * icon tile, eyebrow, title and close button, a body that scrolls, and a footer of actions.
25
+ */
26
+ export declare const Dialog: ({ open, onOpenChange, title, eyebrow, icon, description, children, actions, closeLabel, modalType, size, }: DialogProps) => import("react").JSX.Element;
@@ -0,0 +1,212 @@
1
+ "use client";
2
+ import { c } from "react/compiler-runtime";
3
+ import { useRef } from "react";
4
+ import { Dialog as Dialog$1 } from "@base-ui/react/dialog";
5
+ import { X } from "lucide-react";
6
+ import { cva } from "class-variance-authority";
7
+ import { Button } from "../../components/Button/Button.js";
8
+ import { IconTile } from "../../components/IconTile/IconTile.js";
9
+ import { findFirstField } from "../../utils/first-field.js";
10
+ import { jsx, jsxs } from "react/jsx-runtime";
11
+ // src/patterns/Dialog/Dialog.tsx
12
+ /**
13
+ * Figma's modal: a 16px-rounded white card with a grey hairline and a deep
14
+ * shadow, rising in over a dimmed, blurred page. A header (icon tile, eyebrow,
15
+ * 23px title, close), a body that scrolls, and an off-white footer with its
16
+ * buttons at the end. At most 940px tall and 40px short of the viewport. A
17
+ * dialog with fields opens with the cursor in the first one.
18
+ */
19
+ var dialogPopup = cva([
20
+ "box-border flex max-h-[min(940px,calc(100dvh-40px))] w-full flex-col overflow-hidden rounded-xl border border-line-strong bg-surface text-fg shadow-modal outline-none",
21
+ "transition-[opacity,translate,scale] duration-200 ease-standard",
22
+ "data-starting-style:translate-y-2.5 data-starting-style:scale-98 data-starting-style:opacity-0",
23
+ "data-ending-style:translate-y-2.5 data-ending-style:scale-98 data-ending-style:opacity-0"
24
+ ], {
25
+ variants: { size: {
26
+ narrow: "max-w-120",
27
+ default: "max-w-200",
28
+ wide: "max-w-235"
29
+ } },
30
+ defaultVariants: { size: "default" }
31
+ });
32
+ /**
33
+ * A modal dialog, opened and closed by its caller through `open` and `onOpenChange`: a header with an
34
+ * icon tile, eyebrow, title and close button, a body that scrolls, and a footer of actions.
35
+ */
36
+ var Dialog = (t0) => {
37
+ const $ = c(42);
38
+ const { open, onOpenChange, title, eyebrow, icon, description, children, actions, closeLabel, modalType: t1, size: t2 } = t0;
39
+ const modalType = t1 === void 0 ? "modal" : t1;
40
+ const size = t2 === void 0 ? "default" : t2;
41
+ const bodyRef = useRef(null);
42
+ const t3 = modalType === "alert";
43
+ let t4;
44
+ if ($[0] !== modalType || $[1] !== onOpenChange) {
45
+ t4 = (next, details) => {
46
+ if (modalType === "alert" && details.reason === "escape-key") {
47
+ details.cancel();
48
+ return;
49
+ }
50
+ onOpenChange(next);
51
+ };
52
+ $[0] = modalType;
53
+ $[1] = onOpenChange;
54
+ $[2] = t4;
55
+ } else t4 = $[2];
56
+ let t5;
57
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
58
+ t5 = /* @__PURE__ */ jsx(Dialog$1.Backdrop, { className: "fixed inset-0 z-1100 bg-overlay backdrop-blur-[5px] transition-opacity duration-200 ease-standard data-starting-style:opacity-0 data-ending-style:opacity-0" });
59
+ $[3] = t5;
60
+ } else t5 = $[3];
61
+ let t6;
62
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
63
+ t6 = () => findFirstField(bodyRef.current) ?? true;
64
+ $[4] = t6;
65
+ } else t6 = $[4];
66
+ let t7;
67
+ if ($[5] !== size) {
68
+ t7 = dialogPopup({ size });
69
+ $[5] = size;
70
+ $[6] = t7;
71
+ } else t7 = $[6];
72
+ let t8;
73
+ if ($[7] !== modalType) {
74
+ t8 = modalType === "alert" ? { role: "alertdialog" } : {};
75
+ $[7] = modalType;
76
+ $[8] = t8;
77
+ } else t8 = $[8];
78
+ let t9;
79
+ if ($[9] !== icon) {
80
+ t9 = icon ? /* @__PURE__ */ jsx(IconTile, {
81
+ icon,
82
+ size: "large"
83
+ }) : null;
84
+ $[9] = icon;
85
+ $[10] = t9;
86
+ } else t9 = $[10];
87
+ let t10;
88
+ if ($[11] !== eyebrow) {
89
+ t10 = eyebrow ? /* @__PURE__ */ jsx("span", {
90
+ className: "text-caption font-semibold tracking-[0.08em] text-primary-text uppercase",
91
+ children: eyebrow
92
+ }) : null;
93
+ $[11] = eyebrow;
94
+ $[12] = t10;
95
+ } else t10 = $[12];
96
+ let t11;
97
+ if ($[13] !== title) {
98
+ t11 = /* @__PURE__ */ jsx(Dialog$1.Title, {
99
+ className: "m-0 mt-0.75 min-w-0 text-dialog-title text-fg",
100
+ children: title
101
+ });
102
+ $[13] = title;
103
+ $[14] = t11;
104
+ } else t11 = $[14];
105
+ let t12;
106
+ if ($[15] !== description) {
107
+ t12 = description ? /* @__PURE__ */ jsx(Dialog$1.Description, {
108
+ className: "m-0 mt-0.5 text-caption font-normal text-fg-secondary",
109
+ children: description
110
+ }) : null;
111
+ $[15] = description;
112
+ $[16] = t12;
113
+ } else t12 = $[16];
114
+ let t13;
115
+ if ($[17] !== t10 || $[18] !== t11 || $[19] !== t12) {
116
+ t13 = /* @__PURE__ */ jsxs("div", {
117
+ className: "flex min-w-0 flex-1 flex-col",
118
+ children: [
119
+ t10,
120
+ t11,
121
+ t12
122
+ ]
123
+ });
124
+ $[17] = t10;
125
+ $[18] = t11;
126
+ $[19] = t12;
127
+ $[20] = t13;
128
+ } else t13 = $[20];
129
+ let t14;
130
+ if ($[21] !== closeLabel) {
131
+ t14 = closeLabel ? /* @__PURE__ */ jsx(Dialog$1.Close, { render: /* @__PURE__ */ jsx(Button, {
132
+ variant: "icon",
133
+ "aria-label": closeLabel,
134
+ icon: /* @__PURE__ */ jsx(X, {}),
135
+ className: "size-9 not-data-disabled:hover:bg-subtle not-data-disabled:hover:text-fg"
136
+ }) }) : null;
137
+ $[21] = closeLabel;
138
+ $[22] = t14;
139
+ } else t14 = $[22];
140
+ let t15;
141
+ if ($[23] !== t13 || $[24] !== t14 || $[25] !== t9) {
142
+ t15 = /* @__PURE__ */ jsxs("div", {
143
+ className: "flex min-h-21.5 shrink-0 items-center gap-3.5 border-b border-line px-6.5 py-5",
144
+ children: [
145
+ t9,
146
+ t13,
147
+ t14
148
+ ]
149
+ });
150
+ $[23] = t13;
151
+ $[24] = t14;
152
+ $[25] = t9;
153
+ $[26] = t15;
154
+ } else t15 = $[26];
155
+ let t16;
156
+ if ($[27] !== children) {
157
+ t16 = /* @__PURE__ */ jsx("div", {
158
+ ref: bodyRef,
159
+ className: "min-h-0 flex-1 overflow-y-auto px-7 pt-6.5 pb-7.5 text-body",
160
+ children
161
+ });
162
+ $[27] = children;
163
+ $[28] = t16;
164
+ } else t16 = $[28];
165
+ let t17;
166
+ if ($[29] !== actions) {
167
+ t17 = actions ? /* @__PURE__ */ jsx("div", {
168
+ className: "flex min-h-19.5 shrink-0 flex-wrap items-center justify-end gap-2.5 border-t border-line bg-faint px-6.5 py-4.25",
169
+ children: actions
170
+ }) : null;
171
+ $[29] = actions;
172
+ $[30] = t17;
173
+ } else t17 = $[30];
174
+ let t18;
175
+ if ($[31] !== t15 || $[32] !== t16 || $[33] !== t17 || $[34] !== t7 || $[35] !== t8) {
176
+ t18 = /* @__PURE__ */ jsxs(Dialog$1.Portal, { children: [t5, /* @__PURE__ */ jsx(Dialog$1.Viewport, {
177
+ className: "fixed inset-0 z-1100 box-border grid place-items-center px-4.5 py-8",
178
+ children: /* @__PURE__ */ jsxs(Dialog$1.Popup, {
179
+ initialFocus: t6,
180
+ className: t7,
181
+ ...t8,
182
+ children: [
183
+ t15,
184
+ t16,
185
+ t17
186
+ ]
187
+ })
188
+ })] });
189
+ $[31] = t15;
190
+ $[32] = t16;
191
+ $[33] = t17;
192
+ $[34] = t7;
193
+ $[35] = t8;
194
+ $[36] = t18;
195
+ } else t18 = $[36];
196
+ let t19;
197
+ if ($[37] !== open || $[38] !== t18 || $[39] !== t3 || $[40] !== t4) {
198
+ t19 = /* @__PURE__ */ jsx(Dialog$1.Root, {
199
+ open,
200
+ disablePointerDismissal: t3,
201
+ onOpenChange: t4,
202
+ children: t18
203
+ });
204
+ $[37] = open;
205
+ $[38] = t18;
206
+ $[39] = t3;
207
+ $[40] = t4;
208
+ $[41] = t19;
209
+ } else t19 = $[41];
210
+ return t19;
211
+ };
212
+ export { Dialog };
@@ -0,0 +1,33 @@
1
+ import { type ReactNode, type SubmitEvent } from "react";
2
+ /** The edge it slides in from: `start` (left, right to left on the right) suits navigation, `end` filters and details. */
3
+ export type DrawerSide = "start" | "end";
4
+ /** `medium` pads the content; `none` leaves it edge to edge, e.g. a navigation list that brings its own. */
5
+ export type DrawerPadding = "none" | "medium";
6
+ export interface DrawerProps {
7
+ open: boolean;
8
+ onOpenChange: (open: boolean) => void;
9
+ /** The drawer's name: shown in its header, and its accessible name. */
10
+ title: string;
11
+ /** Keep the title for assistive technology only, and draw no header: e.g. navigation that has its own heading. */
12
+ hideTitle?: boolean | undefined;
13
+ side?: DrawerSide | undefined;
14
+ /** A small glyph before the title. */
15
+ icon?: ReactNode | undefined;
16
+ /** At the end of the header, e.g. a Reset button. */
17
+ headerAction?: ReactNode | undefined;
18
+ children: ReactNode;
19
+ /** Pinned under the content, e.g. the Apply button. */
20
+ footer?: ReactNode | undefined;
21
+ /** Makes the content and footer one form, so Enter in a field submits it. */
22
+ onSubmit?: ((event: SubmitEvent<HTMLFormElement>) => void) | undefined;
23
+ padding?: DrawerPadding | undefined;
24
+ /** On the panel, e.g. a width: `w-[min(420px,90vw)]`. */
25
+ className?: string | undefined;
26
+ }
27
+ /**
28
+ * A full-height panel that slides in at one edge over a dimmed page: navigation on a narrow screen (`start`), or
29
+ * filters and details (`end`). A header (glyph, title, an action), scrolling content and a footer; with
30
+ * `hideTitle`, only the content. Opening it puts the cursor in its first field, if it has one; Escape or a click
31
+ * on the page closes it, and focus stays inside while it is open.
32
+ */
33
+ export declare const Drawer: ({ open, onOpenChange, title, hideTitle, side, icon, headerAction, children, footer, onSubmit, padding, className, }: DrawerProps) => import("react").JSX.Element;