@webiny/admin-ui 6.6.0-alpha.0 → 6.6.0-alpha.10

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 (397) hide show
  1. package/Accordion/components/AccordionContent.js +4 -1
  2. package/Accordion/components/AccordionContent.js.map +1 -1
  3. package/Accordion/components/AccordionItem.d.ts +1 -0
  4. package/Accordion/components/AccordionItem.js.map +1 -1
  5. package/Accordion/components/AccordionItemDragHandle.d.ts +2 -1
  6. package/Accordion/components/AccordionItemDragHandle.js +2 -1
  7. package/Accordion/components/AccordionItemDragHandle.js.map +1 -1
  8. package/Accordion/components/AccordionTrigger.js +4 -2
  9. package/Accordion/components/AccordionTrigger.js.map +1 -1
  10. package/Alert/Alert.d.ts +1 -20
  11. package/Alert/Alert.js.map +1 -1
  12. package/AutoComplete/primitives/AutoCompletePrimitive.d.ts +8 -2
  13. package/AutoComplete/primitives/AutoCompletePrimitive.js +1 -0
  14. package/AutoComplete/primitives/AutoCompletePrimitive.js.map +1 -1
  15. package/BetaBadge/BetaBadge.d.ts +6 -0
  16. package/BetaBadge/BetaBadge.js +7 -0
  17. package/BetaBadge/BetaBadge.js.map +1 -0
  18. package/Breadcrumbs/Breadcrumbs.d.ts +54 -0
  19. package/Breadcrumbs/Breadcrumbs.js +66 -0
  20. package/Breadcrumbs/Breadcrumbs.js.map +1 -0
  21. package/Breadcrumbs/Breadcrumbs.stories.d.ts +9 -0
  22. package/Breadcrumbs/Breadcrumbs.stories.js +71 -0
  23. package/Breadcrumbs/Breadcrumbs.stories.js.map +1 -0
  24. package/Breadcrumbs/index.d.ts +1 -0
  25. package/Breadcrumbs/index.js +1 -0
  26. package/Button/Button.d.ts +1 -1
  27. package/Button/Button.js +14 -0
  28. package/Button/Button.js.map +1 -1
  29. package/Button/Button.mdx +13 -0
  30. package/Button/Button.stories.d.ts +1 -0
  31. package/Button/Button.stories.js +10 -2
  32. package/Button/Button.stories.js.map +1 -1
  33. package/Button/Button.test.d.ts +1 -0
  34. package/Button/Button.test.js +28 -0
  35. package/Button/Button.test.js.map +1 -0
  36. package/Calendar/calendarClassNames.js +1 -1
  37. package/Calendar/calendarClassNames.js.map +1 -1
  38. package/Checkbox/primitives/presenters/CheckboxPresenter.js +5 -2
  39. package/Checkbox/primitives/presenters/CheckboxPresenter.js.map +1 -1
  40. package/Checkbox/primitives/presenters/CheckboxPresenter.jsxLabel.test.d.ts +1 -0
  41. package/Checkbox/primitives/presenters/CheckboxPresenter.jsxLabel.test.js +61 -0
  42. package/Checkbox/primitives/presenters/CheckboxPresenter.jsxLabel.test.js.map +1 -0
  43. package/CheckboxGroup/CheckboxGroup.js +4 -1
  44. package/CheckboxGroup/CheckboxGroup.js.map +1 -1
  45. package/CheckboxGroup/primitives/CheckboxGroupPrimitive.d.ts +6 -1
  46. package/CheckboxGroup/primitives/CheckboxGroupPrimitive.js +5 -2
  47. package/CheckboxGroup/primitives/CheckboxGroupPrimitive.js.map +1 -1
  48. package/CheckboxGroup/primitives/presenters/CheckboxGroupPresenter.js +5 -2
  49. package/CheckboxGroup/primitives/presenters/CheckboxGroupPresenter.js.map +1 -1
  50. package/CheckboxGroup/primitives/presenters/CheckboxGroupPresenter.jsxLabel.test.d.ts +1 -0
  51. package/CheckboxGroup/primitives/presenters/CheckboxGroupPresenter.jsxLabel.test.js +108 -0
  52. package/CheckboxGroup/primitives/presenters/CheckboxGroupPresenter.jsxLabel.test.js.map +1 -0
  53. package/Code/Code.d.ts +29 -0
  54. package/Code/Code.js +23 -0
  55. package/Code/Code.js.map +1 -0
  56. package/Code/index.d.ts +1 -0
  57. package/Code/index.js +1 -0
  58. package/CodeEditor/CodeEditor.js +6 -0
  59. package/CodeEditor/CodeEditor.js.map +1 -1
  60. package/CodeEditor/CodeEditorPrimitive.js +3 -1
  61. package/CodeEditor/CodeEditorPrimitive.js.map +1 -1
  62. package/ColorPicker/ColorPicker.js +4 -1
  63. package/ColorPicker/ColorPicker.js.map +1 -1
  64. package/ColorPicker/primitives/ColorPickerPrimitive.d.ts +1 -1
  65. package/ColorPicker/primitives/ColorPickerPrimitive.js +3 -1
  66. package/ColorPicker/primitives/ColorPickerPrimitive.js.map +1 -1
  67. package/Command/components/List.d.ts +1 -1
  68. package/Command/components/List.js +9 -5
  69. package/Command/components/List.js.map +1 -1
  70. package/DataTable/DataTable.d.ts +42 -7
  71. package/DataTable/DataTable.js +122 -26
  72. package/DataTable/DataTable.js.map +1 -1
  73. package/DataTable/DataTable.mdx +64 -0
  74. package/DataTable/DataTable.stories.d.ts +4 -0
  75. package/DataTable/DataTable.stories.js +40 -1
  76. package/DataTable/DataTable.stories.js.map +1 -1
  77. package/DataTable/DataTable.subRows.test.d.ts +1 -0
  78. package/DataTable/DataTable.subRows.test.js +216 -0
  79. package/DataTable/DataTable.subRows.test.js.map +1 -0
  80. package/DataTable/components/ColumnsVisibility.d.ts +5 -4
  81. package/DataTable/components/ColumnsVisibility.js +7 -3
  82. package/DataTable/components/ColumnsVisibility.js.map +1 -1
  83. package/DatePicker/DatePicker.d.ts +5 -2
  84. package/DatePicker/DatePicker.js +14 -3
  85. package/DatePicker/DatePicker.js.map +1 -1
  86. package/DatePicker/DatePicker.stories.d.ts +10 -0
  87. package/DatePicker/DatePicker.stories.js +44 -1
  88. package/DatePicker/DatePicker.stories.js.map +1 -1
  89. package/DatePicker/primitives/BirthdayPicker.d.ts +13 -0
  90. package/DatePicker/primitives/BirthdayPicker.js +355 -0
  91. package/DatePicker/primitives/BirthdayPicker.js.map +1 -0
  92. package/DatePicker/primitives/BirthdayPickerCell.d.ts +14 -0
  93. package/DatePicker/primitives/BirthdayPickerCell.js +19 -0
  94. package/DatePicker/primitives/BirthdayPickerCell.js.map +1 -0
  95. package/DatePicker/primitives/BirthdayPickerSegments.d.ts +9 -0
  96. package/DatePicker/primitives/BirthdayPickerSegments.js +43 -0
  97. package/DatePicker/primitives/BirthdayPickerSegments.js.map +1 -0
  98. package/DatePicker/primitives/DateOnlyPicker.d.ts +1 -1
  99. package/DatePicker/primitives/DateOnlyPicker.js +13 -4
  100. package/DatePicker/primitives/DateOnlyPicker.js.map +1 -1
  101. package/DatePicker/primitives/DatePickerPrimitive.js +3 -0
  102. package/DatePicker/primitives/DatePickerPrimitive.js.map +1 -1
  103. package/DatePicker/primitives/DateRangePicker.d.ts +1 -1
  104. package/DatePicker/primitives/DateRangePicker.js +5 -4
  105. package/DatePicker/primitives/DateRangePicker.js.map +1 -1
  106. package/DatePicker/primitives/DateTimePicker.d.ts +1 -1
  107. package/DatePicker/primitives/DateTimePicker.js +27 -18
  108. package/DatePicker/primitives/DateTimePicker.js.map +1 -1
  109. package/DatePicker/primitives/MonthPicker.d.ts +1 -1
  110. package/DatePicker/primitives/MonthPicker.js +2 -1
  111. package/DatePicker/primitives/MonthPicker.js.map +1 -1
  112. package/DatePicker/primitives/MultipleDatesPicker.d.ts +1 -1
  113. package/DatePicker/primitives/MultipleDatesPicker.js +5 -4
  114. package/DatePicker/primitives/MultipleDatesPicker.js.map +1 -1
  115. package/DatePicker/primitives/MultipleMonthsPicker.d.ts +1 -1
  116. package/DatePicker/primitives/MultipleMonthsPicker.js +2 -1
  117. package/DatePicker/primitives/MultipleMonthsPicker.js.map +1 -1
  118. package/DatePicker/primitives/MultipleYearsPicker.d.ts +1 -1
  119. package/DatePicker/primitives/MultipleYearsPicker.js +2 -1
  120. package/DatePicker/primitives/MultipleYearsPicker.js.map +1 -1
  121. package/DatePicker/primitives/TimeOnlyPicker.d.ts +1 -1
  122. package/DatePicker/primitives/TimeOnlyPicker.js +2 -1
  123. package/DatePicker/primitives/TimeOnlyPicker.js.map +1 -1
  124. package/DatePicker/primitives/WeekPicker.d.ts +1 -1
  125. package/DatePicker/primitives/WeekPicker.js +2 -1
  126. package/DatePicker/primitives/WeekPicker.js.map +1 -1
  127. package/DatePicker/primitives/YearPicker.d.ts +1 -1
  128. package/DatePicker/primitives/YearPicker.js +2 -1
  129. package/DatePicker/primitives/YearPicker.js.map +1 -1
  130. package/DatePicker/primitives/components/DatePickerTrigger.js +1 -1
  131. package/DatePicker/primitives/components/DatePickerTrigger.js.map +1 -1
  132. package/DatePicker/primitives/components/TimePicker.d.ts +2 -1
  133. package/DatePicker/primitives/components/TimePicker.js +2 -1
  134. package/DatePicker/primitives/components/TimePicker.js.map +1 -1
  135. package/DatePicker/utils/birthdayHelpers.d.ts +77 -0
  136. package/DatePicker/utils/birthdayHelpers.js +145 -0
  137. package/DatePicker/utils/birthdayHelpers.js.map +1 -0
  138. package/DatePicker/utils/birthdayHelpers.test.d.ts +1 -0
  139. package/DatePicker/utils/birthdayHelpers.test.js +394 -0
  140. package/DatePicker/utils/birthdayHelpers.test.js.map +1 -0
  141. package/DatePicker/utils/dateHelpers.d.ts +6 -1
  142. package/DatePicker/utils/dateHelpers.js +13 -5
  143. package/DatePicker/utils/dateHelpers.js.map +1 -1
  144. package/DatePicker/utils/dateHelpers.test.d.ts +1 -0
  145. package/DatePicker/utils/dateHelpers.test.js +119 -0
  146. package/DatePicker/utils/dateHelpers.test.js.map +1 -0
  147. package/DatePicker/utils/index.d.ts +1 -0
  148. package/DatePicker/utils/index.js +1 -0
  149. package/DatePicker/utils/timezoneHelpers.d.ts +3 -0
  150. package/DatePicker/utils/timezoneHelpers.js +32 -0
  151. package/DatePicker/utils/timezoneHelpers.js.map +1 -0
  152. package/DatePicker/utils/types.d.ts +17 -2
  153. package/DelayedOnChange/DelayedOnChange.d.ts +9 -2
  154. package/DelayedOnChange/DelayedOnChange.js.map +1 -1
  155. package/Dialog/Dialog.d.ts +8 -7
  156. package/Dialog/Dialog.js.map +1 -1
  157. package/Drawer/Drawer.d.ts +10 -6
  158. package/Drawer/Drawer.js +2 -1
  159. package/Drawer/Drawer.js.map +1 -1
  160. package/Drawer/Drawer.stories.d.ts +1 -0
  161. package/Drawer/Drawer.stories.js +20 -2
  162. package/Drawer/Drawer.stories.js.map +1 -1
  163. package/Drawer/components/DrawerHeader.d.ts +2 -2
  164. package/Drawer/components/DrawerHeader.js +11 -8
  165. package/Drawer/components/DrawerHeader.js.map +1 -1
  166. package/Drawer/components/Icon.d.ts +1 -1
  167. package/Drawer/components/Icon.js +3 -4
  168. package/Drawer/components/Icon.js.map +1 -1
  169. package/DropdownMenu/components/DropdownMenuItem.d.ts +5 -0
  170. package/DropdownMenu/components/DropdownMenuItem.js +3 -2
  171. package/DropdownMenu/components/DropdownMenuItem.js.map +1 -1
  172. package/EmptyState/EmptyState.d.ts +2 -1
  173. package/EmptyState/EmptyState.js +8 -2
  174. package/EmptyState/EmptyState.js.map +1 -1
  175. package/FilePicker/FilePicker.d.ts +12 -12
  176. package/FilePicker/FilePicker.js +6 -1
  177. package/FilePicker/FilePicker.js.map +1 -1
  178. package/FilePicker/FilePicker.stories.d.ts +6 -0
  179. package/FilePicker/FilePicker.stories.js +24 -1
  180. package/FilePicker/FilePicker.stories.js.map +1 -1
  181. package/FilePicker/primitives/FilePickerPrimitive.d.ts +13 -13
  182. package/FilePicker/primitives/FilePickerPrimitive.js +3 -1
  183. package/FilePicker/primitives/FilePickerPrimitive.js.map +1 -1
  184. package/FilePicker/primitives/components/Label.d.ts +3 -1
  185. package/FilePicker/primitives/components/Label.js +2 -1
  186. package/FilePicker/primitives/components/Label.js.map +1 -1
  187. package/FilePicker/primitives/components/previews/ImagePreview/ImagePreview.d.ts +13 -2
  188. package/FilePicker/primitives/components/previews/ImagePreview/ImagePreview.js +15 -6
  189. package/FilePicker/primitives/components/previews/ImagePreview/ImagePreview.js.map +1 -1
  190. package/FilePicker/primitives/components/previews/ItemActions.js +1 -1
  191. package/FilePicker/primitives/components/previews/ItemActions.js.map +1 -1
  192. package/FilePicker/primitives/components/previews/ItemDescription.js +1 -1
  193. package/FilePicker/primitives/components/previews/ItemDescription.js.map +1 -1
  194. package/FilePicker/primitives/components/previews/RichItemPreview/FileType.d.ts +5 -0
  195. package/FilePicker/primitives/components/previews/RichItemPreview/FileType.js +45 -0
  196. package/FilePicker/primitives/components/previews/RichItemPreview/FileType.js.map +1 -0
  197. package/FilePicker/primitives/components/previews/RichItemPreview/Placeholder.d.ts +5 -0
  198. package/FilePicker/primitives/components/previews/RichItemPreview/Placeholder.js +14 -0
  199. package/FilePicker/primitives/components/previews/RichItemPreview/Placeholder.js.map +1 -0
  200. package/FilePicker/primitives/components/previews/RichItemPreview/RichItemPreview.d.ts +6 -1
  201. package/FilePicker/primitives/components/previews/RichItemPreview/RichItemPreview.js +54 -12
  202. package/FilePicker/primitives/components/previews/RichItemPreview/RichItemPreview.js.map +1 -1
  203. package/FilePicker/primitives/components/previews/RichItemPreview/RichItemThumbnail.d.ts +11 -1
  204. package/FilePicker/primitives/components/previews/RichItemPreview/RichItemThumbnail.js +8 -61
  205. package/FilePicker/primitives/components/previews/RichItemPreview/RichItemThumbnail.js.map +1 -1
  206. package/FilePicker/primitives/components/previews/RichItemPreview/Thumbnail.d.ts +11 -0
  207. package/FilePicker/primitives/components/previews/RichItemPreview/Thumbnail.js +24 -0
  208. package/FilePicker/primitives/components/previews/RichItemPreview/Thumbnail.js.map +1 -0
  209. package/FilePicker/primitives/components/previews/RichItemPreview/ThumbnailActions.d.ts +10 -0
  210. package/FilePicker/primitives/components/previews/RichItemPreview/ThumbnailActions.js +46 -0
  211. package/FilePicker/primitives/components/previews/RichItemPreview/ThumbnailActions.js.map +1 -0
  212. package/FilePicker/primitives/components/previews/TruncatedFileName.d.ts +7 -0
  213. package/FilePicker/primitives/components/previews/TruncatedFileName.js +20 -0
  214. package/FilePicker/primitives/components/previews/TruncatedFileName.js.map +1 -0
  215. package/FilePicker/primitives/components/previews/fileName.d.ts +4 -0
  216. package/FilePicker/primitives/components/previews/fileName.js +26 -0
  217. package/FilePicker/primitives/components/previews/fileName.js.map +1 -0
  218. package/FilePicker/primitives/components/previews/index.d.ts +1 -0
  219. package/FilePicker/primitives/components/previews/index.js +1 -0
  220. package/FormComponent/Label.d.ts +6 -1
  221. package/FormComponent/Label.js +5 -2
  222. package/FormComponent/Label.js.map +1 -1
  223. package/FormComponent/labels.test.d.ts +1 -0
  224. package/FormComponent/labels.test.js +276 -0
  225. package/FormComponent/labels.test.js.map +1 -0
  226. package/Icon/Icon.d.ts +6 -1
  227. package/Icon/Icon.js.map +1 -1
  228. package/IconPicker/IconPicker.js +6 -1
  229. package/IconPicker/IconPicker.js.map +1 -1
  230. package/IconPicker/domains/IconPickerIcon.js +1 -1
  231. package/IconPicker/domains/IconPickerIcon.js.map +1 -1
  232. package/IconPicker/primitives/IconPickerPrimitive.d.ts +2 -0
  233. package/IconPicker/primitives/IconPickerPrimitive.js +2 -2
  234. package/IconPicker/primitives/IconPickerPrimitive.js.map +1 -1
  235. package/IconPicker/primitives/components/IconPickerGrid.js.map +1 -1
  236. package/ImageEditor/AspectRatioPreview.d.ts +16 -0
  237. package/ImageEditor/AspectRatioPreview.js +26 -0
  238. package/ImageEditor/AspectRatioPreview.js.map +1 -0
  239. package/ImageEditor/CropHotspotEditor.d.ts +22 -0
  240. package/ImageEditor/CropHotspotEditor.js +402 -0
  241. package/ImageEditor/CropHotspotEditor.js.map +1 -0
  242. package/ImageEditor/ImageEditor.d.ts +18 -0
  243. package/ImageEditor/ImageEditor.js +151 -0
  244. package/ImageEditor/ImageEditor.js.map +1 -0
  245. package/ImageEditor/ImageEditor.stories.d.ts +6 -0
  246. package/ImageEditor/ImageEditor.stories.js +42 -0
  247. package/ImageEditor/ImageEditor.stories.js.map +1 -0
  248. package/ImageEditor/MetaFields.d.ts +12 -0
  249. package/ImageEditor/MetaFields.js +20 -0
  250. package/ImageEditor/MetaFields.js.map +1 -0
  251. package/ImageEditor/SectionLabel.d.ts +8 -0
  252. package/ImageEditor/SectionLabel.js +7 -0
  253. package/ImageEditor/SectionLabel.js.map +1 -0
  254. package/ImageEditor/geometry.d.ts +46 -0
  255. package/ImageEditor/geometry.js +126 -0
  256. package/ImageEditor/geometry.js.map +1 -0
  257. package/ImageEditor/index.d.ts +3 -0
  258. package/ImageEditor/index.js +3 -0
  259. package/ImageEditor/types.d.ts +52 -0
  260. package/ImageEditor/types.js +35 -0
  261. package/ImageEditor/types.js.map +1 -0
  262. package/Input/InputPrimitive.d.ts +4 -4
  263. package/Input/InputPrimitive.js +0 -1
  264. package/Input/InputPrimitive.js.map +1 -1
  265. package/Kbd/Kbd.d.ts +35 -0
  266. package/Kbd/Kbd.js +34 -0
  267. package/Kbd/Kbd.js.map +1 -0
  268. package/Kbd/index.d.ts +1 -0
  269. package/Kbd/index.js +1 -0
  270. package/Link/Link.d.ts +1 -1
  271. package/Link/Link.js +1 -1
  272. package/Link/Link.js.map +1 -1
  273. package/Markdown/Markdown.d.ts +47 -0
  274. package/Markdown/Markdown.js +17 -0
  275. package/Markdown/Markdown.js.map +1 -0
  276. package/Markdown/index.d.ts +1 -0
  277. package/Markdown/index.js +1 -0
  278. package/MultiAutoComplete/primitives/MultiAutoCompletePrimitive.d.ts +8 -2
  279. package/MultiAutoComplete/primitives/MultiAutoCompletePrimitive.js +1 -0
  280. package/MultiAutoComplete/primitives/MultiAutoCompletePrimitive.js.map +1 -1
  281. package/MultiAutoComplete/primitives/presenters/MultiAutoCompletePresenter.test.js +1 -1
  282. package/MultiAutoComplete/primitives/presenters/MultiAutoCompletePresenter.test.js.map +1 -1
  283. package/MultiAutoComplete/primitives/useMultiAutoComplete.js +3 -2
  284. package/MultiAutoComplete/primitives/useMultiAutoComplete.js.map +1 -1
  285. package/MultiFilePicker/MultiFilePicker.d.ts +12 -12
  286. package/MultiFilePicker/primitives/MultiFilePickerPrimitive.d.ts +12 -12
  287. package/MultiSelect/MultiSelect.js +6 -1
  288. package/MultiSelect/MultiSelect.js.map +1 -1
  289. package/MultiSelect/primitives/MultiSelectPrimitive.d.ts +3 -1
  290. package/MultiSelect/primitives/MultiSelectPrimitive.js +16 -7
  291. package/MultiSelect/primitives/MultiSelectPrimitive.js.map +1 -1
  292. package/Popover/Popover.stories.d.ts +7 -0
  293. package/Popover/Popover.stories.js +24 -1
  294. package/Popover/Popover.stories.js.map +1 -1
  295. package/Popover/primitives/components/PopoverContent.js +6 -1
  296. package/Popover/primitives/components/PopoverContent.js.map +1 -1
  297. package/RadioGroup/RadioGroup.js +4 -1
  298. package/RadioGroup/RadioGroup.js.map +1 -1
  299. package/RadioGroup/primitives/RadioGroupPrimitive.d.ts +1 -1
  300. package/RadioGroup/primitives/RadioGroupPrimitive.js +4 -2
  301. package/RadioGroup/primitives/RadioGroupPrimitive.js.map +1 -1
  302. package/RadioGroup/primitives/presenters/RadioGroupPresenter.js +4 -2
  303. package/RadioGroup/primitives/presenters/RadioGroupPresenter.js.map +1 -1
  304. package/RadioGroup/primitives/presenters/RadioGroupPresenter.jsxLabel.test.d.ts +1 -0
  305. package/RadioGroup/primitives/presenters/RadioGroupPresenter.jsxLabel.test.js +88 -0
  306. package/RadioGroup/primitives/presenters/RadioGroupPresenter.jsxLabel.test.js.map +1 -0
  307. package/RangeSlider/RangeSlider.js +4 -1
  308. package/RangeSlider/RangeSlider.js.map +1 -1
  309. package/RangeSlider/primitives/RangeSliderPrimitive.d.ts +1 -1
  310. package/RangeSlider/primitives/RangeSliderPrimitive.js +3 -1
  311. package/RangeSlider/primitives/RangeSliderPrimitive.js.map +1 -1
  312. package/ScrollArea/ScrollArea.d.ts +16 -2
  313. package/ScrollArea/ScrollArea.js +19 -5
  314. package/ScrollArea/ScrollArea.js.map +1 -1
  315. package/SegmentedControl/SegmentedControl.js +4 -1
  316. package/SegmentedControl/SegmentedControl.js.map +1 -1
  317. package/SegmentedControl/primitives/SegmentedControlPrimitive.d.ts +5 -1
  318. package/SegmentedControl/primitives/SegmentedControlPrimitive.js +2 -1
  319. package/SegmentedControl/primitives/SegmentedControlPrimitive.js.map +1 -1
  320. package/Select/Select.js +6 -1
  321. package/Select/Select.js.map +1 -1
  322. package/Select/primitives/SelectPrimitive.d.ts +4 -0
  323. package/Select/primitives/SelectPrimitive.js +4 -2
  324. package/Select/primitives/SelectPrimitive.js.map +1 -1
  325. package/Select/primitives/components/SelectContent.js +4 -6
  326. package/Select/primitives/components/SelectContent.js.map +1 -1
  327. package/SidePanel/SidePanel.d.ts +46 -0
  328. package/SidePanel/SidePanel.js +47 -0
  329. package/SidePanel/SidePanel.js.map +1 -0
  330. package/SidePanel/SidePanelBody.d.ts +37 -0
  331. package/SidePanel/SidePanelBody.js +14 -0
  332. package/SidePanel/SidePanelBody.js.map +1 -0
  333. package/SidePanel/SidePanelFooter.d.ts +27 -0
  334. package/SidePanel/SidePanelFooter.js +10 -0
  335. package/SidePanel/SidePanelFooter.js.map +1 -0
  336. package/SidePanel/index.d.ts +3 -0
  337. package/SidePanel/index.js +3 -0
  338. package/Sidebar/Sidebar.groups.test.d.ts +1 -0
  339. package/Sidebar/Sidebar.groups.test.js +113 -0
  340. package/Sidebar/Sidebar.groups.test.js.map +1 -0
  341. package/Sidebar/components/SidebarContent.js +1 -1
  342. package/Sidebar/components/SidebarContent.js.map +1 -1
  343. package/Sidebar/components/SidebarRoot.js +1 -1
  344. package/Sidebar/components/SidebarRoot.js.map +1 -1
  345. package/Sidebar/components/items/SidebarMenuRootButton.js +1 -0
  346. package/Sidebar/components/items/SidebarMenuRootButton.js.map +1 -1
  347. package/Sidebar/components/items/SidebarMenuSubButton.js +8 -5
  348. package/Sidebar/components/items/SidebarMenuSubButton.js.map +1 -1
  349. package/Sidebar/components/items/SidebarMenuSubItem.js +3 -3
  350. package/Sidebar/components/items/SidebarMenuSubItem.js.map +1 -1
  351. package/Slider/Slider.js +10 -2
  352. package/Slider/Slider.js.map +1 -1
  353. package/Slider/primitives/SliderPrimitive.d.ts +1 -1
  354. package/Slider/primitives/SliderPrimitive.js +2 -1
  355. package/Slider/primitives/SliderPrimitive.js.map +1 -1
  356. package/Slider/primitives/components/SliderThumb.d.ts +5 -2
  357. package/Slider/primitives/components/SliderThumb.js +2 -1
  358. package/Slider/primitives/components/SliderThumb.js.map +1 -1
  359. package/Switch/Switch.d.ts +4 -4
  360. package/Switch/Switch.js +21 -7
  361. package/Switch/Switch.js.map +1 -1
  362. package/Switch/domains/SwitchItemDto.d.ts +1 -1
  363. package/Switch/primitives/SwitchPrimitive.js +4 -3
  364. package/Switch/primitives/SwitchPrimitive.js.map +1 -1
  365. package/Tabs/Tabs.d.ts +7 -2
  366. package/Tabs/Tabs.js +29 -11
  367. package/Tabs/Tabs.js.map +1 -1
  368. package/Tabs/Tabs.mdx +27 -0
  369. package/Tabs/Tabs.stories.d.ts +1 -0
  370. package/Tabs/Tabs.stories.js +19 -1
  371. package/Tabs/Tabs.stories.js.map +1 -1
  372. package/Tag/Tag.d.ts +1 -1
  373. package/Tag/Tag.js +5 -0
  374. package/Tag/Tag.js.map +1 -1
  375. package/Tag/TagIcon.js +7 -1
  376. package/Tag/TagIcon.js.map +1 -1
  377. package/Tags/primitives/TagsPrimitive.d.ts +2 -2
  378. package/Tags/primitives/TagsPrimitive.js.map +1 -1
  379. package/Toast/useToast.stories.js.map +1 -1
  380. package/ToggleGroup/ToggleGroup.js +4 -1
  381. package/ToggleGroup/ToggleGroup.js.map +1 -1
  382. package/ToggleGroup/primitives/ToggleGroupPrimitive.d.ts +2 -0
  383. package/ToggleGroup/primitives/ToggleGroupPrimitive.js +3 -2
  384. package/ToggleGroup/primitives/ToggleGroupPrimitive.js.map +1 -1
  385. package/Tree/useTree.js +6 -2
  386. package/Tree/useTree.js.map +1 -1
  387. package/exports/admin/ui.d.ts +2 -0
  388. package/exports/admin/ui.js +2 -0
  389. package/hooks/index.d.ts +1 -0
  390. package/hooks/index.js +1 -0
  391. package/hooks/useEscapeScrollLock.d.ts +13 -0
  392. package/hooks/useEscapeScrollLock.js +21 -0
  393. package/hooks/useEscapeScrollLock.js.map +1 -0
  394. package/index.d.ts +7 -0
  395. package/index.js +7 -0
  396. package/package.json +31 -29
  397. package/theme.css +43 -0
@@ -0,0 +1,119 @@
1
+ import { afterAll, beforeAll, describe, expect, it } from "vitest";
2
+ import { formatDateForDisplay, parseDateValue } from "./dateHelpers.js";
3
+ const originalTimeZone = process.env.TZ;
4
+ const useTimeZone = (timeZone)=>{
5
+ process.env.TZ = timeZone;
6
+ };
7
+ const restoreTimeZone = ()=>{
8
+ if (void 0 === originalTimeZone) return void delete process.env.TZ;
9
+ process.env.TZ = originalTimeZone;
10
+ };
11
+ describe("date-only values in a zone west of UTC (America/New_York)", ()=>{
12
+ beforeAll(()=>{
13
+ useTimeZone("America/New_York");
14
+ });
15
+ afterAll(()=>{
16
+ restoreTimeZone();
17
+ });
18
+ it("runs in the New York zone, where a UTC parse of a yyyy-MM-dd value lands on the previous day", ()=>{
19
+ const utcMidnight = new Date("2026-10-20");
20
+ expect(utcMidnight.getDate()).toBe(19);
21
+ expect(utcMidnight.getHours()).toBe(20);
22
+ });
23
+ it("parses a yyyy-MM-dd value as local midnight of that day", ()=>{
24
+ const date = parseDateValue("2026-10-20");
25
+ expect(date.getFullYear()).toBe(2026);
26
+ expect(date.getMonth()).toBe(9);
27
+ expect(date.getDate()).toBe(20);
28
+ expect(date.getHours()).toBe(0);
29
+ expect(date.getMinutes()).toBe(0);
30
+ expect(date.getSeconds()).toBe(0);
31
+ expect(date.getMilliseconds()).toBe(0);
32
+ expect(date.toISOString()).toBe("2026-10-20T04:00:00.000Z");
33
+ });
34
+ it("parses a full ISO instant as before", ()=>{
35
+ const value = "2026-10-20T02:00:00.000Z";
36
+ const date = parseDateValue(value);
37
+ expect(date.getTime()).toBe(Date.parse(value));
38
+ expect(date.getDate()).toBe(19);
39
+ });
40
+ it("parses an ISO value with an offset as before", ()=>{
41
+ const value = "2026-10-20T23:59:59.999+02:00";
42
+ const date = parseDateValue(value);
43
+ expect(date.toISOString()).toBe("2026-10-20T21:59:59.999Z");
44
+ });
45
+ it("parses a local date-time value as before", ()=>{
46
+ const value = "2026-10-20T00:00:00";
47
+ const expected = new Date(value);
48
+ const date = parseDateValue(value);
49
+ expect(date.getTime()).toBe(expected.getTime());
50
+ });
51
+ it("shows a yyyy-MM-dd value as that day with the default format", ()=>{
52
+ const label = formatDateForDisplay("2026-10-20", "date");
53
+ expect(label).toBe("October 20th, 2026");
54
+ });
55
+ it("shows a yyyy-MM-dd value as that day with a display format", ()=>{
56
+ const label = formatDateForDisplay("2026-10-20", "date", "d MMM yyyy");
57
+ expect(label).toBe("20 Oct 2026");
58
+ });
59
+ it("shows a full ISO instant on its local day as before", ()=>{
60
+ const label = formatDateForDisplay("2026-10-20T02:00:00.000Z", "date");
61
+ expect(label).toBe("October 19th, 2026");
62
+ });
63
+ it("shows nothing for no value", ()=>{
64
+ const label = formatDateForDisplay(void 0, "date");
65
+ expect(label).toBeUndefined();
66
+ });
67
+ it("leaves the local date-time display unchanged", ()=>{
68
+ const label = formatDateForDisplay("2026-10-20T02:00:00.000Z", "dateTimeLocal", "yyyy-MM-dd HH:mm");
69
+ expect(label).toBe("2026-10-19 22:00");
70
+ });
71
+ });
72
+ describe("date-only values in a zone east of UTC (Asia/Tokyo)", ()=>{
73
+ beforeAll(()=>{
74
+ useTimeZone("Asia/Tokyo");
75
+ });
76
+ afterAll(()=>{
77
+ restoreTimeZone();
78
+ });
79
+ it("parses a yyyy-MM-dd value as local midnight of that day", ()=>{
80
+ const date = parseDateValue("2026-10-20");
81
+ expect(date.getDate()).toBe(20);
82
+ expect(date.getHours()).toBe(0);
83
+ expect(date.toISOString()).toBe("2026-10-19T15:00:00.000Z");
84
+ });
85
+ it("shows a yyyy-MM-dd value as that day", ()=>{
86
+ const label = formatDateForDisplay("2026-10-20", "date", "d MMM yyyy");
87
+ expect(label).toBe("20 Oct 2026");
88
+ });
89
+ });
90
+ describe("dateHelpers in a timezone west of UTC", ()=>{
91
+ const originalTz = process.env.TZ;
92
+ beforeAll(()=>{
93
+ process.env.TZ = "America/Chicago";
94
+ });
95
+ afterAll(()=>{
96
+ process.env.TZ = originalTz;
97
+ });
98
+ it("should parse a bare date as that calendar day", ()=>{
99
+ const date = parseDateValue("2026-10-10");
100
+ expect(date.getFullYear()).toBe(2026);
101
+ expect(date.getMonth()).toBe(9);
102
+ expect(date.getDate()).toBe(10);
103
+ });
104
+ it("should leave full ISO strings to the Date constructor", ()=>{
105
+ const date = parseDateValue("2026-10-10T00:00:00.000Z");
106
+ expect(date.toISOString()).toBe("2026-10-10T00:00:00.000Z");
107
+ });
108
+ it("should display a date-only value as the stored day", ()=>{
109
+ expect(formatDateForDisplay("2026-10-10", "date")).toBe("October 10th, 2026");
110
+ });
111
+ it("should display a date range as the stored days", ()=>{
112
+ expect(formatDateForDisplay({
113
+ from: "2026-10-10",
114
+ to: "2026-10-12"
115
+ }, "dateRange", "yyyy-MM-dd")).toBe("2026-10-10 – 2026-10-12");
116
+ });
117
+ });
118
+
119
+ //# sourceMappingURL=dateHelpers.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DatePicker/utils/dateHelpers.test.js","sources":["../../../src/DatePicker/utils/dateHelpers.test.ts"],"sourcesContent":["import { afterAll } from \"vitest\";\nimport { beforeAll } from \"vitest\";\nimport { describe } from \"vitest\";\nimport { expect } from \"vitest\";\nimport { it } from \"vitest\";\nimport { formatDateForDisplay } from \"./dateHelpers.js\";\nimport { parseDateValue } from \"./dateHelpers.js\";\n\nconst originalTimeZone = process.env.TZ;\n\nconst useTimeZone = (timeZone: string): void => {\n process.env.TZ = timeZone;\n};\n\nconst restoreTimeZone = (): void => {\n if (originalTimeZone === undefined) {\n delete process.env.TZ;\n return;\n }\n process.env.TZ = originalTimeZone;\n};\n\ndescribe(\"date-only values in a zone west of UTC (America/New_York)\", () => {\n beforeAll(() => {\n useTimeZone(\"America/New_York\");\n });\n\n afterAll(() => {\n restoreTimeZone();\n });\n\n it(\"runs in the New York zone, where a UTC parse of a yyyy-MM-dd value lands on the previous day\", () => {\n const utcMidnight = new Date(\"2026-10-20\");\n\n expect(utcMidnight.getDate()).toBe(19);\n expect(utcMidnight.getHours()).toBe(20);\n });\n\n it(\"parses a yyyy-MM-dd value as local midnight of that day\", () => {\n const date = parseDateValue(\"2026-10-20\");\n\n expect(date.getFullYear()).toBe(2026);\n expect(date.getMonth()).toBe(9);\n expect(date.getDate()).toBe(20);\n expect(date.getHours()).toBe(0);\n expect(date.getMinutes()).toBe(0);\n expect(date.getSeconds()).toBe(0);\n expect(date.getMilliseconds()).toBe(0);\n expect(date.toISOString()).toBe(\"2026-10-20T04:00:00.000Z\");\n });\n\n it(\"parses a full ISO instant as before\", () => {\n const value = \"2026-10-20T02:00:00.000Z\";\n\n const date = parseDateValue(value);\n\n expect(date.getTime()).toBe(Date.parse(value));\n expect(date.getDate()).toBe(19);\n });\n\n it(\"parses an ISO value with an offset as before\", () => {\n const value = \"2026-10-20T23:59:59.999+02:00\";\n\n const date = parseDateValue(value);\n\n expect(date.toISOString()).toBe(\"2026-10-20T21:59:59.999Z\");\n });\n\n it(\"parses a local date-time value as before\", () => {\n const value = \"2026-10-20T00:00:00\";\n const expected = new Date(value);\n\n const date = parseDateValue(value);\n\n expect(date.getTime()).toBe(expected.getTime());\n });\n\n it(\"shows a yyyy-MM-dd value as that day with the default format\", () => {\n const label = formatDateForDisplay(\"2026-10-20\", \"date\");\n\n expect(label).toBe(\"October 20th, 2026\");\n });\n\n it(\"shows a yyyy-MM-dd value as that day with a display format\", () => {\n const label = formatDateForDisplay(\"2026-10-20\", \"date\", \"d MMM yyyy\");\n\n expect(label).toBe(\"20 Oct 2026\");\n });\n\n it(\"shows a full ISO instant on its local day as before\", () => {\n const label = formatDateForDisplay(\"2026-10-20T02:00:00.000Z\", \"date\");\n\n expect(label).toBe(\"October 19th, 2026\");\n });\n\n it(\"shows nothing for no value\", () => {\n const label = formatDateForDisplay(undefined, \"date\");\n\n expect(label).toBeUndefined();\n });\n\n it(\"leaves the local date-time display unchanged\", () => {\n const label = formatDateForDisplay(\n \"2026-10-20T02:00:00.000Z\",\n \"dateTimeLocal\",\n \"yyyy-MM-dd HH:mm\"\n );\n\n expect(label).toBe(\"2026-10-19 22:00\");\n });\n});\n\ndescribe(\"date-only values in a zone east of UTC (Asia/Tokyo)\", () => {\n beforeAll(() => {\n useTimeZone(\"Asia/Tokyo\");\n });\n\n afterAll(() => {\n restoreTimeZone();\n });\n\n it(\"parses a yyyy-MM-dd value as local midnight of that day\", () => {\n const date = parseDateValue(\"2026-10-20\");\n\n expect(date.getDate()).toBe(20);\n expect(date.getHours()).toBe(0);\n expect(date.toISOString()).toBe(\"2026-10-19T15:00:00.000Z\");\n });\n\n it(\"shows a yyyy-MM-dd value as that day\", () => {\n const label = formatDateForDisplay(\"2026-10-20\", \"date\", \"d MMM yyyy\");\n\n expect(label).toBe(\"20 Oct 2026\");\n });\n});\n\ndescribe(\"dateHelpers in a timezone west of UTC\", () => {\n const originalTz = process.env.TZ;\n\n beforeAll(() => {\n process.env.TZ = \"America/Chicago\";\n });\n\n afterAll(() => {\n process.env.TZ = originalTz;\n });\n\n it(\"should parse a bare date as that calendar day\", () => {\n const date = parseDateValue(\"2026-10-10\");\n expect(date.getFullYear()).toBe(2026);\n expect(date.getMonth()).toBe(9);\n expect(date.getDate()).toBe(10);\n });\n\n it(\"should leave full ISO strings to the Date constructor\", () => {\n const date = parseDateValue(\"2026-10-10T00:00:00.000Z\");\n expect(date.toISOString()).toBe(\"2026-10-10T00:00:00.000Z\");\n });\n\n it(\"should display a date-only value as the stored day\", () => {\n expect(formatDateForDisplay(\"2026-10-10\", \"date\")).toBe(\"October 10th, 2026\");\n });\n\n it(\"should display a date range as the stored days\", () => {\n expect(\n formatDateForDisplay(\n { from: \"2026-10-10\", to: \"2026-10-12\" },\n \"dateRange\",\n \"yyyy-MM-dd\"\n )\n ).toBe(\"2026-10-10 – 2026-10-12\");\n });\n});\n"],"names":["originalTimeZone","process","useTimeZone","timeZone","restoreTimeZone","undefined","describe","beforeAll","afterAll","it","utcMidnight","Date","expect","date","parseDateValue","value","expected","label","formatDateForDisplay","originalTz"],"mappings":";;AAQA,MAAMA,mBAAmBC,QAAQ,GAAG,CAAC,EAAE;AAEvC,MAAMC,cAAc,CAACC;IACjBF,QAAQ,GAAG,CAAC,EAAE,GAAGE;AACrB;AAEA,MAAMC,kBAAkB;IAC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,CAAC;QAC7BD,OAAOC,KAAK,OAAO,IAAI,IAAI,CAAC;IAChC;IAEAJ,GAAG,yDAAyD;QACxD,MAAMI,OAAOC,eAAe;QAC5BF,OAAOC,KAAK,WAAW,IAAI,IAAI,CAAC;IACpC;IAEAJ,GAAG,sDAAsD;QACrDG,OAAOM,qBAAqB,cAAc,SAAS,IAAI,CAAC;IAC5D;IAEAT,GAAG,kDAAkD;QACjDG,OACIM,qBACI;YAAE,MAAM;YAAc,IAAI;QAAa,GACvC,aACA,eAEN,IAAI,CAAC;IACX;AACJ"}
@@ -1,3 +1,4 @@
1
1
  export * from "./types.js";
2
2
  export * from "./dateHelpers.js";
3
3
  export * from "./constants.js";
4
+ export * from "./birthdayHelpers.js";
@@ -1,3 +1,4 @@
1
1
  export * from "./types.js";
2
2
  export * from "./dateHelpers.js";
3
3
  export * from "./constants.js";
4
+ export * from "./birthdayHelpers.js";
@@ -0,0 +1,3 @@
1
+ export declare function utcToTimezoneDate(utcDate: Date, timezone: string): Date;
2
+ export declare function naiveDateToUtcIso(date: Date, timezone: string): string;
3
+ export declare function parseToDate(value: string | Date | undefined): Date | undefined;
@@ -0,0 +1,32 @@
1
+ import { format } from "date-fns";
2
+ function parseOffset(tz) {
3
+ const match = tz.match(/^([+-])(\d{2}):(\d{2})$/);
4
+ if (!match) return null;
5
+ const sign = "+" === match[1] ? 1 : -1;
6
+ return {
7
+ sign,
8
+ minutes: sign * (60 * Number(match[2]) + Number(match[3]))
9
+ };
10
+ }
11
+ function utcToTimezoneDate(utcDate, timezone) {
12
+ const parsed = parseOffset(timezone);
13
+ if (!parsed) return utcDate;
14
+ const localOffsetMinutes = -utcDate.getTimezoneOffset();
15
+ const shiftMs = (parsed.minutes - localOffsetMinutes) * 60000;
16
+ return new Date(utcDate.getTime() + shiftMs);
17
+ }
18
+ function naiveDateToUtcIso(date, timezone) {
19
+ const naive = format(date, "yyyy-MM-dd'T'HH:mm:ss");
20
+ const parsed = parseOffset(timezone);
21
+ if (parsed) return new Date(`${naive}${timezone}`).toISOString();
22
+ return date.toISOString();
23
+ }
24
+ function parseToDate(value) {
25
+ if (!value) return;
26
+ const d = new Date(value);
27
+ if (Number.isNaN(d.getTime())) return;
28
+ return d;
29
+ }
30
+ export { naiveDateToUtcIso, parseToDate, utcToTimezoneDate };
31
+
32
+ //# sourceMappingURL=timezoneHelpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DatePicker/utils/timezoneHelpers.js","sources":["../../../src/DatePicker/utils/timezoneHelpers.ts"],"sourcesContent":["import { format } from \"date-fns\";\n\ninterface ParsedOffset {\n sign: number;\n minutes: number;\n}\n\nfunction parseOffset(tz: string): ParsedOffset | null {\n const match = tz.match(/^([+-])(\\d{2}):(\\d{2})$/);\n if (!match) {\n return null;\n }\n const sign = match[1] === \"+\" ? 1 : -1;\n return { sign, minutes: sign * (Number(match[2]) * 60 + Number(match[3])) };\n}\n\nexport function utcToTimezoneDate(utcDate: Date, timezone: string): Date {\n const parsed = parseOffset(timezone);\n if (!parsed) {\n return utcDate;\n }\n const localOffsetMinutes = -utcDate.getTimezoneOffset();\n const shiftMs = (parsed.minutes - localOffsetMinutes) * 60 * 1000;\n return new Date(utcDate.getTime() + shiftMs);\n}\n\nexport function naiveDateToUtcIso(date: Date, timezone: string): string {\n const naive = format(date, \"yyyy-MM-dd'T'HH:mm:ss\");\n const parsed = parseOffset(timezone);\n if (parsed) {\n return new Date(`${naive}${timezone}`).toISOString();\n }\n return date.toISOString();\n}\n\nexport function parseToDate(value: string | Date | undefined): Date | undefined {\n if (!value) {\n return undefined;\n }\n const d = new Date(value);\n if (Number.isNaN(d.getTime())) {\n return undefined;\n }\n return d;\n}\n"],"names":["parseOffset","tz","match","sign","Number","utcToTimezoneDate","utcDate","timezone","parsed","localOffsetMinutes","shiftMs","Date","naiveDateToUtcIso","date","naive","format","parseToDate","value","d"],"mappings":";AAOA,SAASA,YAAYC,EAAU;IAC3B,MAAMC,QAAQD,GAAG,KAAK,CAAC;IACvB,IAAI,CAACC,OACD,OAAO;IAEX,MAAMC,OAAOD,AAAa,QAAbA,KAAK,CAAC,EAAE,GAAW,IAAI;IACpC,OAAO;QAAEC;QAAM,SAASA,OAAQC,CAAAA,AAAmB,KAAnBA,OAAOF,KAAK,CAAC,EAAE,IAASE,OAAOF,KAAK,CAAC,EAAE;IAAG;AAC9E;AAEO,SAASG,kBAAkBC,OAAa,EAAEC,QAAgB;IAC7D,MAAMC,SAASR,YAAYO;IAC3B,IAAI,CAACC,QACD,OAAOF;IAEX,MAAMG,qBAAqB,CAACH,QAAQ,iBAAiB;IACrD,MAAMI,UAAWF,AAAAA,CAAAA,OAAO,OAAO,GAAGC,kBAAiB,IAAlCD;IACjB,OAAO,IAAIG,KAAKL,QAAQ,OAAO,KAAKI;AACxC;AAEO,SAASE,kBAAkBC,IAAU,EAAEN,QAAgB;IAC1D,MAAMO,QAAQC,OAAOF,MAAM;IAC3B,MAAML,SAASR,YAAYO;IAC3B,IAAIC,QACA,OAAO,IAAIG,KAAK,GAAGG,QAAQP,UAAU,EAAE,WAAW;IAEtD,OAAOM,KAAK,WAAW;AAC3B;AAEO,SAASG,YAAYC,KAAgC;IACxD,IAAI,CAACA,OACD;IAEJ,MAAMC,IAAI,IAAIP,KAAKM;IACnB,IAAIb,OAAO,KAAK,CAACc,EAAE,OAAO,KACtB;IAEJ,OAAOA;AACX"}
@@ -4,6 +4,8 @@ interface DatePickerPreset {
4
4
  value: () => Date;
5
5
  }
6
6
  interface DatePickerBaseProps {
7
+ /** The label's id — the trigger names itself with it (it's a `role=button`, not a `<label for>` target). */
8
+ "aria-labelledby"?: string;
7
9
  placeholder?: string;
8
10
  disabled?: boolean;
9
11
  className?: string;
@@ -14,6 +16,8 @@ interface DatePickerBaseProps {
14
16
  weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
15
17
  onOpenChange?: (open: boolean) => void;
16
18
  displayFormat?: string;
19
+ minDate?: Date;
20
+ maxDate?: Date;
17
21
  }
18
22
  interface DateOnlyPickerProps extends DatePickerBaseProps {
19
23
  type: "date";
@@ -21,6 +25,17 @@ interface DateOnlyPickerProps extends DatePickerBaseProps {
21
25
  onChange?: (value: string | undefined) => void;
22
26
  presets?: DatePickerPreset[];
23
27
  }
28
+ /**
29
+ * Picks a date as day, then month, then year. The value is a `YYYY-MM-DD` string, the same as
30
+ * the `date` picker's. `yearRange` sets the years offered. By default they run from `maxDate`'s
31
+ * year (or this year) down to `minDate`'s year (or 120 years back). Days, months and years that
32
+ * can't make a date between `minDate` and `maxDate` can't be picked.
33
+ */
34
+ interface BirthdayPickerProps extends DatePickerBaseProps {
35
+ type: "birthday";
36
+ value?: string;
37
+ onChange?: (value: string | undefined) => void;
38
+ }
24
39
  interface TimeOnlyPickerProps extends DatePickerBaseProps {
25
40
  type: "time";
26
41
  value?: string;
@@ -77,5 +92,5 @@ interface MultipleYearsPickerProps extends DatePickerBaseProps {
77
92
  value?: number[];
78
93
  onChange?: (value: number[]) => void;
79
94
  }
80
- type DatePickerPrimitiveProps = DateOnlyPickerProps | TimeOnlyPickerProps | DateTimeLocalPickerProps | DateTimeTzPickerProps | MonthPickerProps | WeekPickerProps | YearPickerProps | DateRangePickerProps | MultipleDatesPickerProps | MultipleMonthsPickerProps | MultipleYearsPickerProps;
81
- export { type DatePickerPreset, type DatePickerBaseProps, type DatePickerPrimitiveProps, type DateOnlyPickerProps, type TimeOnlyPickerProps, type DateTimeLocalPickerProps, type DateTimeTzPickerProps, type MonthPickerProps, type WeekPickerProps, type YearPickerProps, type DateRangePickerProps, type MultipleDatesPickerProps, type MultipleMonthsPickerProps, type MultipleYearsPickerProps };
95
+ type DatePickerPrimitiveProps = DateOnlyPickerProps | BirthdayPickerProps | TimeOnlyPickerProps | DateTimeLocalPickerProps | DateTimeTzPickerProps | MonthPickerProps | WeekPickerProps | YearPickerProps | DateRangePickerProps | MultipleDatesPickerProps | MultipleMonthsPickerProps | MultipleYearsPickerProps;
96
+ export { type DatePickerPreset, type DatePickerBaseProps, type DatePickerPrimitiveProps, type DateOnlyPickerProps, type BirthdayPickerProps, type TimeOnlyPickerProps, type DateTimeLocalPickerProps, type DateTimeTzPickerProps, type MonthPickerProps, type WeekPickerProps, type YearPickerProps, type DateRangePickerProps, type MultipleDatesPickerProps, type MultipleMonthsPickerProps, type MultipleYearsPickerProps };
@@ -24,8 +24,15 @@ interface ChildrenCallableParams<TValue> {
24
24
  value: TValue;
25
25
  onChange: OnChangeCallable<TValue>;
26
26
  }
27
+ /** The props DelayedOnChange reads from and sets on the element it wraps. */
28
+ interface DelayedOnChangeChildProps<TValue> {
29
+ value?: TValue;
30
+ onChange?: OnChangeCallable<TValue>;
31
+ onBlur?: OnBlurCallable;
32
+ onKeyDown?: OnKeyDownCallable;
33
+ }
27
34
  interface ChildrenCallable<TValue> {
28
- (params: ChildrenCallableParams<TValue>): React.ReactElement;
35
+ (params: ChildrenCallableParams<TValue>): React.ReactElement<DelayedOnChangeChildProps<TValue>>;
29
36
  }
30
37
  export interface DelayedOnChangeProps<TValue> {
31
38
  value?: TValue;
@@ -35,5 +42,5 @@ export interface DelayedOnChangeProps<TValue> {
35
42
  onKeyDown?: OnKeyDownCallable;
36
43
  children: React.ReactNode | ChildrenCallable<TValue | undefined>;
37
44
  }
38
- export declare const DelayedOnChange: <TValue = any>({ children, ...other }: DelayedOnChangeProps<TValue>) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
45
+ export declare const DelayedOnChange: <TValue = any>({ children, ...other }: DelayedOnChangeProps<TValue>) => React.ReactElement<DelayedOnChangeChildProps<TValue | undefined>, string | React.JSXElementConstructor<any>>;
39
46
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"DelayedOnChange/DelayedOnChange.js","sources":["../../src/DelayedOnChange/DelayedOnChange.ts"],"sourcesContent":["import React, { useEffect, useRef, useState } from \"react\";\nimport isEqual from \"lodash/isEqual.js\";\n\nconst emptyFunction = (): undefined => {\n return undefined;\n};\n\nexport interface ApplyValueCb<TValue> {\n (value: TValue): void;\n}\n\n/**\n * This component is used to wrap Input and Textarea components to optimize form re-render.\n * These 2 are the only components that trigger form model change on each character input.\n * This means, whenever you type a letter an entire form re-renders.\n * On complex forms you will feel and see a significant delay if this component is not used.\n *\n * The logic behind this component is to serve as a middleware between Form and Input/Textarea, and only notify form of a change when\n * a user stops typing for given period of time (400ms by default).\n */\n\nexport interface OnChangeCallable<TValue = any> {\n (value: TValue, cb?: ApplyValueCb<TValue>): void;\n}\n\ninterface OnBlurCallable {\n (ev: React.SyntheticEvent): void;\n}\n\ninterface OnKeyDownCallable {\n (ev: React.KeyboardEvent<HTMLInputElement>): void;\n}\n\ninterface ChildrenCallableParams<TValue> {\n value: TValue;\n onChange: OnChangeCallable<TValue>;\n}\n\ninterface ChildrenCallable<TValue> {\n (params: ChildrenCallableParams<TValue>): React.ReactElement;\n}\n\nexport interface DelayedOnChangeProps<TValue> {\n value?: TValue;\n delay?: number;\n onChange?: OnChangeCallable<TValue>;\n onBlur?: OnBlurCallable;\n onKeyDown?: OnKeyDownCallable;\n children: React.ReactNode | ChildrenCallable<TValue | undefined>;\n}\n\nexport const DelayedOnChange = <TValue = any>({\n children,\n ...other\n}: DelayedOnChangeProps<TValue>) => {\n const firstMount = useRef(true);\n const { onChange, delay = 400, value: initialValue } = other;\n const [value, setValue] = useState<TValue | undefined>(initialValue);\n // Sync state and props\n useEffect(() => {\n // Do not update local state, if the incoming value is the same as the local state.\n // This is primarily an optimization for non-scalar values (objects).\n if (isEqual(initialValue, value)) {\n return;\n }\n\n setValue(initialValue);\n }, [initialValue]);\n\n const localTimeout = React.useRef<number | null>(null);\n\n const applyValue = (value: TValue | undefined) => {\n localTimeout.current && clearTimeout(localTimeout.current);\n localTimeout.current = null;\n if (!onChange) {\n return;\n }\n onChange(value as NonNullable<TValue>);\n };\n\n const onChangeLocal = React.useCallback((value: TValue | undefined) => {\n setValue(value);\n }, []);\n\n // this is fired upon change value state\n const onValueStateChanged = (nextValue: TValue | undefined) => {\n // We don't want to execute callbacks, if the value hasn't changed.\n if (isEqual(nextValue, initialValue)) {\n return;\n }\n\n localTimeout.current && clearTimeout(localTimeout.current);\n localTimeout.current = null;\n localTimeout.current = setTimeout(() => applyValue(nextValue), delay) as unknown as number;\n };\n\n // need to clear the timeout when unmounting the component\n useEffect(() => {\n return () => {\n if (!localTimeout.current) {\n return;\n }\n clearTimeout(localTimeout.current);\n localTimeout.current = null;\n };\n }, []);\n\n useEffect(() => {\n if (firstMount.current) {\n firstMount.current = false;\n return;\n }\n\n onValueStateChanged(value);\n }, [value]);\n\n const newProps = {\n ...other,\n value: value,\n onChange: onChangeLocal\n };\n\n const renderProp =\n typeof children === \"function\" ? (children as ChildrenCallable<TValue | undefined>) : null;\n const child = renderProp\n ? renderProp(newProps)\n : React.cloneElement(children as unknown as React.ReactElement, newProps);\n\n const props = { ...(child.props as DelayedOnChangeProps<TValue>) };\n const realOnKeyDown = props.onKeyDown || emptyFunction;\n const realOnBlur = props.onBlur || emptyFunction;\n\n // Need to apply value if input lost focus\n const onBlur: OnBlurCallable = ev => {\n if (!ev[\"persist\"]) {\n return;\n }\n ev.persist();\n applyValue((ev.target as HTMLInputElement).value as TValue);\n realOnBlur(ev);\n };\n\n // Need to listen for TAB key to apply new value immediately, without delay. Otherwise validation will be triggered with old value.\n const onKeyDown: OnKeyDownCallable = ev => {\n ev.persist();\n if (ev.key === \"Tab\") {\n applyValue((ev.target as HTMLInputElement).value as TValue);\n realOnKeyDown(ev);\n } else if (ev.key === \"Enter\") {\n applyValue((ev.target as HTMLInputElement).value as TValue);\n realOnKeyDown(ev);\n } else {\n realOnKeyDown(ev);\n }\n };\n\n return React.cloneElement(child, { ...props, onBlur, onKeyDown });\n};\n"],"names":["emptyFunction","DelayedOnChange","children","other","firstMount","useRef","onChange","delay","initialValue","value","setValue","useState","useEffect","isEqual","localTimeout","React","applyValue","clearTimeout","onChangeLocal","onValueStateChanged","nextValue","setTimeout","newProps","renderProp","child","props","realOnKeyDown","realOnBlur","onBlur","ev","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AA2CoB;IAEpE,MAAMG,QAAQ;QAAE,GAAID,MAAM,KAAK;IAAkC;IACjE,MAAME,gBAAgBD,MAAM,SAAS,IAAIzB;IACzC,MAAM2B,aAAaF,MAAM,MAAM,IAAIzB;IAGnC,MAAM4B,SAAyBC,CAAAA;QAC3B,IAAI,CAACA,EAAE,CAAC,UAAU,EACd;QAEJA,GAAG,OAAO;QACVb,WAAYa,GAAG,MAAM,CAAsB,KAAK;QAChDF,WAAWE;IACf;IAGA,MAAMC,YAA+BD,CAAAA;QACjCA,GAAG,OAAO;QACV,IAAIA,AAAW,UAAXA,GAAG,GAAG,EAAY;YAClBb,WAAYa,GAAG,MAAM,CAAsB,KAAK;YAChDH,cAAcG;QAClB,OAAO,IAAIA,AAAW,YAAXA,GAAG,GAAG,EAAc;YAC3Bb,WAAYa,GAAG,MAAM,CAAsB,KAAK;YAChDH,cAAcG;QAClB,OACIH,cAAcG;IAEtB;IAEA,OAAOd,MAAAA,YAAkB,CAACS,OAAO;QAAE,GAAGC,KAAK;QAAEG;QAAQE;IAAU;AACnE"}
1
+ {"version":3,"file":"DelayedOnChange/DelayedOnChange.js","sources":["../../src/DelayedOnChange/DelayedOnChange.ts"],"sourcesContent":["import React, { useEffect, useRef, useState } from \"react\";\nimport isEqual from \"lodash/isEqual.js\";\n\nconst emptyFunction = (): undefined => {\n return undefined;\n};\n\nexport interface ApplyValueCb<TValue> {\n (value: TValue): void;\n}\n\n/**\n * This component is used to wrap Input and Textarea components to optimize form re-render.\n * These 2 are the only components that trigger form model change on each character input.\n * This means, whenever you type a letter an entire form re-renders.\n * On complex forms you will feel and see a significant delay if this component is not used.\n *\n * The logic behind this component is to serve as a middleware between Form and Input/Textarea, and only notify form of a change when\n * a user stops typing for given period of time (400ms by default).\n */\n\nexport interface OnChangeCallable<TValue = any> {\n (value: TValue, cb?: ApplyValueCb<TValue>): void;\n}\n\ninterface OnBlurCallable {\n (ev: React.SyntheticEvent): void;\n}\n\ninterface OnKeyDownCallable {\n (ev: React.KeyboardEvent<HTMLInputElement>): void;\n}\n\ninterface ChildrenCallableParams<TValue> {\n value: TValue;\n onChange: OnChangeCallable<TValue>;\n}\n\n/** The props DelayedOnChange reads from and sets on the element it wraps. */\ninterface DelayedOnChangeChildProps<TValue> {\n value?: TValue;\n onChange?: OnChangeCallable<TValue>;\n onBlur?: OnBlurCallable;\n onKeyDown?: OnKeyDownCallable;\n}\n\ninterface ChildrenCallable<TValue> {\n (params: ChildrenCallableParams<TValue>): React.ReactElement<DelayedOnChangeChildProps<TValue>>;\n}\n\nexport interface DelayedOnChangeProps<TValue> {\n value?: TValue;\n delay?: number;\n onChange?: OnChangeCallable<TValue>;\n onBlur?: OnBlurCallable;\n onKeyDown?: OnKeyDownCallable;\n children: React.ReactNode | ChildrenCallable<TValue | undefined>;\n}\n\nexport const DelayedOnChange = <TValue = any>({\n children,\n ...other\n}: DelayedOnChangeProps<TValue>) => {\n const firstMount = useRef(true);\n const { onChange, delay = 400, value: initialValue } = other;\n const [value, setValue] = useState<TValue | undefined>(initialValue);\n // Sync state and props\n useEffect(() => {\n // Do not update local state, if the incoming value is the same as the local state.\n // This is primarily an optimization for non-scalar values (objects).\n if (isEqual(initialValue, value)) {\n return;\n }\n\n setValue(initialValue);\n }, [initialValue]);\n\n const localTimeout = React.useRef<number | null>(null);\n\n const applyValue = (value: TValue | undefined) => {\n localTimeout.current && clearTimeout(localTimeout.current);\n localTimeout.current = null;\n if (!onChange) {\n return;\n }\n onChange(value as NonNullable<TValue>);\n };\n\n const onChangeLocal = React.useCallback((value: TValue | undefined) => {\n setValue(value);\n }, []);\n\n // this is fired upon change value state\n const onValueStateChanged = (nextValue: TValue | undefined) => {\n // We don't want to execute callbacks, if the value hasn't changed.\n if (isEqual(nextValue, initialValue)) {\n return;\n }\n\n localTimeout.current && clearTimeout(localTimeout.current);\n localTimeout.current = null;\n localTimeout.current = setTimeout(() => applyValue(nextValue), delay) as unknown as number;\n };\n\n // need to clear the timeout when unmounting the component\n useEffect(() => {\n return () => {\n if (!localTimeout.current) {\n return;\n }\n clearTimeout(localTimeout.current);\n localTimeout.current = null;\n };\n }, []);\n\n useEffect(() => {\n if (firstMount.current) {\n firstMount.current = false;\n return;\n }\n\n onValueStateChanged(value);\n }, [value]);\n\n const newProps = {\n ...other,\n value: value,\n onChange: onChangeLocal\n };\n\n const renderProp =\n typeof children === \"function\" ? (children as ChildrenCallable<TValue | undefined>) : null;\n const child = renderProp\n ? renderProp(newProps)\n : React.cloneElement(\n children as unknown as React.ReactElement<\n DelayedOnChangeChildProps<TValue | undefined>\n >,\n newProps\n );\n\n const props = { ...child.props };\n const realOnKeyDown = props.onKeyDown || emptyFunction;\n const realOnBlur = props.onBlur || emptyFunction;\n\n // Need to apply value if input lost focus\n const onBlur: OnBlurCallable = ev => {\n if (!ev[\"persist\"]) {\n return;\n }\n ev.persist();\n applyValue((ev.target as HTMLInputElement).value as TValue);\n realOnBlur(ev);\n };\n\n // Need to listen for TAB key to apply new value immediately, without delay. Otherwise validation will be triggered with old value.\n const onKeyDown: OnKeyDownCallable = ev => {\n ev.persist();\n if (ev.key === \"Tab\") {\n applyValue((ev.target as HTMLInputElement).value as TValue);\n realOnKeyDown(ev);\n } else if (ev.key === \"Enter\") {\n applyValue((ev.target as HTMLInputElement).value as TValue);\n realOnKeyDown(ev);\n } else {\n realOnKeyDown(ev);\n }\n };\n\n return React.cloneElement(child, { ...props, onBlur, onKeyDown });\n};\n"],"names":["emptyFunction","DelayedOnChange","children","other","firstMount","useRef","onChange","delay","initialValue","value","setValue","useState","useEffect","isEqual","localTimeout","React","applyValue","clearTimeout","onChangeLocal","onValueStateChanged","nextValue","setTimeout","newProps","renderProp","child","props","realOnKeyDown","realOnBlur","onBlur","ev","onKeyDown"],"mappings":";;AAGA,MAAMA,gBAAgB,KAEtB;AAsDO,MAAMC,kBAAkB,CAAe,EAC1CC,QAAQ,EACR,GAAGC,OACwB;IAC3B,MAAMC,aAAaC,OAAO;IAC1B,MAAM,EAAEC,QAAQ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AyBC,CAAAA;QAC3B,IAAI,CAACA,EAAE,CAAC,UAAU,EACd;QAEJA,GAAG,OAAO;QACVb,WAAYa,GAAG,MAAM,CAAsB,KAAK;QAChDF,WAAWE;IACf;IAGA,MAAMC,YAA+BD,CAAAA;QACjCA,GAAG,OAAO;QACV,IAAIA,AAAW,UAAXA,GAAG,GAAG,EAAY;YAClBb,WAAYa,GAAG,MAAM,CAAsB,KAAK;YAChDH,cAAcG;QAClB,OAAO,IAAIA,AAAW,YAAXA,GAAG,GAAG,EAAc;YAC3Bb,WAAYa,GAAG,MAAM,CAAsB,KAAK;YAChDH,cAAcG;QAClB,OACIH,cAAcG;IAEtB;IAEA,OAAOd,MAAAA,YAAkB,CAACS,OAAO;QAAE,GAAGC,KAAK;QAAEG;QAAQE;IAAU;AACnE"}
@@ -1,10 +1,11 @@
1
1
  import * as React from "react";
2
2
  import { DialogContent } from "./components/DialogContent.js";
3
3
  import { DialogRoot } from "./components/DialogRoot.js";
4
+ import type { IconElement } from "../Icon/index.js";
4
5
  interface DialogProps extends React.ComponentPropsWithoutRef<typeof DialogRoot>, Omit<React.ComponentPropsWithoutRef<typeof DialogContent>, "title"> {
5
6
  trigger?: React.ReactNode;
6
7
  title?: React.ReactNode;
7
- icon?: React.ReactElement;
8
+ icon?: IconElement;
8
9
  showCloseButton?: boolean;
9
10
  dismissible?: boolean;
10
11
  bodyPadding?: boolean;
@@ -81,21 +82,21 @@ declare const Dialog: typeof DialogBase & {
81
82
  displayName: string;
82
83
  }>) => (props: unknown) => React.JSX.Element;
83
84
  };
84
- Icon: ((props: import("../index.js").IconProps) => React.JSX.Element) & {
85
- original: (props: import("../index.js").IconProps) => React.JSX.Element;
85
+ Icon: ((props: import("~/Icon/index.js").IconProps) => React.JSX.Element) & {
86
+ original: (props: import("~/Icon/index.js").IconProps) => React.JSX.Element;
86
87
  originalName: string;
87
88
  displayName: string;
88
89
  } & {
89
- original: ((props: import("../index.js").IconProps) => React.JSX.Element) & {
90
- original: (props: import("../index.js").IconProps) => React.JSX.Element;
90
+ original: ((props: import("~/Icon/index.js").IconProps) => React.JSX.Element) & {
91
+ original: (props: import("~/Icon/index.js").IconProps) => React.JSX.Element;
91
92
  originalName: string;
92
93
  displayName: string;
93
94
  };
94
95
  originalName: string;
95
96
  displayName: string;
96
97
  } & {
97
- createDecorator: (decorator: import("@webiny/react-composition/types.js").ComponentDecorator<((props: import("../index.js").IconProps) => React.JSX.Element) & {
98
- original: (props: import("../index.js").IconProps) => React.JSX.Element;
98
+ createDecorator: (decorator: import("@webiny/react-composition/types.js").ComponentDecorator<((props: import("~/Icon/index.js").IconProps) => React.JSX.Element) & {
99
+ original: (props: import("~/Icon/index.js").IconProps) => React.JSX.Element;
99
100
  originalName: string;
100
101
  displayName: string;
101
102
  }>) => (props: unknown) => React.JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog/Dialog.js","sources":["../../src/Dialog/Dialog.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { makeDecoratable, withStaticProps } from \"~/utils.js\";\nimport { OverlayLoader } from \"~/Loader/index.js\";\nimport { DialogContent } from \"./components/DialogContent.js\";\nimport { DialogHeader } from \"~/Dialog/components/DialogHeader.js\";\nimport { DialogBody } from \"~/Dialog/components/DialogBody.js\";\nimport { DialogFooter } from \"~/Dialog/components/DialogFooter.js\";\nimport { DialogOverlay } from \"~/Dialog/components/DialogOverlay.js\";\nimport { DialogPortal } from \"./components/DialogPortal.js\";\nimport { DialogRoot } from \"./components/DialogRoot.js\";\nimport { DialogTrigger } from \"./components/DialogTrigger.js\";\nimport { Icon } from \"./components/Icon.js\";\nimport { ConfirmAction } from \"./components/ConfirmAction.js\";\nimport { CancelAction } from \"./components/CancelAction.js\";\nimport { CloseDialogIconButton } from \"~/Dialog/components/CloseDialogIconButton.js\";\nimport { DialogClose } from \"~/Dialog/components/DialogClose.js\";\n\ninterface DialogProps\n extends\n React.ComponentPropsWithoutRef<typeof DialogRoot>,\n Omit<React.ComponentPropsWithoutRef<typeof DialogContent>, \"title\"> {\n trigger?: React.ReactNode;\n title?: React.ReactNode;\n icon?: React.ReactElement;\n showCloseButton?: boolean;\n dismissible?: boolean;\n bodyPadding?: boolean;\n scrollable?: boolean;\n description?: React.ReactNode;\n children: React.ReactNode;\n actions?: React.ReactNode;\n info?: React.ReactNode;\n loading?: boolean | { text?: string };\n overlay?: React.ReactNode;\n onClose?: () => void;\n onOpen?: () => void;\n}\n\nconst DialogBase = (props: DialogProps) => {\n const {\n rootProps,\n triggerProps,\n contentProps,\n headerProps,\n bodyProps,\n footerProps,\n closeButtonProps\n } = React.useMemo(() => {\n const {\n // Root props.\n defaultOpen,\n open,\n onOpenChange: originalOnOpenChange,\n onClose,\n onOpen,\n modal,\n dir,\n\n // Shared props.\n size,\n\n // Trigger props.\n trigger,\n\n // Header props.\n title,\n icon,\n description,\n\n // Body props.\n children,\n bodyPadding,\n scrollable,\n\n // Footer props.\n actions,\n info,\n\n // Overlay props.\n loading,\n overlay,\n\n // Close button props.\n showCloseButton = true,\n\n // Content props.\n ...rest\n } = props;\n\n // Handles dialog open state changes, calling original and onClose / onOpen callbacks as needed\n const onOpenChange = (open: boolean) => {\n originalOnOpenChange && originalOnOpenChange(open);\n\n if (onClose && !open) {\n onClose();\n }\n\n if (onOpen && open) {\n onOpen();\n }\n };\n\n const resolvedOverlay = (() => {\n if (overlay) {\n return overlay;\n }\n if (!loading) {\n return undefined;\n }\n const text = typeof loading === \"object\" ? loading.text : undefined;\n return <OverlayLoader text={text} />;\n })();\n\n return {\n rootProps: {\n defaultOpen,\n open,\n onOpenChange,\n modal,\n dir,\n size\n },\n triggerProps: {\n // Temporary fix. We need this because `ref` doesn't get passed to components\n // that are decorated with `makeDecoratable`. This will be fixed in the future.\n children: <div>{trigger}</div>\n },\n headerProps: { title, icon, description, size },\n bodyProps: { children, bodyPadding, scrollable, size },\n footerProps: { info, actions, size },\n closeButtonProps: { show: showCloseButton, size },\n contentProps: { ...rest, size, overlay: resolvedOverlay }\n };\n }, [props]);\n\n return (\n <DialogRoot {...rootProps}>\n {triggerProps.children && <DialogTrigger {...triggerProps} asChild />}\n <DialogPortal>\n <div data-role=\"dialog\" className={\"z-overlay absolute\"}>\n <DialogOverlay />\n <DialogContent\n {...contentProps}\n header={<DialogHeader {...headerProps} />}\n footer={<DialogFooter {...footerProps} />}\n closeButton={\n closeButtonProps.show ? (\n <CloseDialogIconButton size={closeButtonProps.size} />\n ) : undefined\n }\n >\n <DialogBody {...bodyProps} />\n </DialogContent>\n </div>\n </DialogPortal>\n </DialogRoot>\n );\n};\n\nDialogBase.displayName = \"Dialog\";\n\nconst DecoratableDialog = makeDecoratable(\"Dialog\", DialogBase);\n\nconst Dialog = withStaticProps(DecoratableDialog, {\n ConfirmAction,\n CancelAction,\n Icon,\n Close: DialogClose\n});\n\nexport { Dialog, type DialogProps };\n"],"names":["DialogBase","props","rootProps","triggerProps","contentProps","headerProps","bodyProps","footerProps","closeButtonProps","React","defaultOpen","open","originalOnOpenChange","onClose","onOpen","modal","dir","size","trigger","title","icon","description","children","bodyPadding","scrollable","actions","info","loading","overlay","showCloseButton","rest","onOpenChange","resolvedOverlay","text","undefined","OverlayLoader","DialogRoot","DialogTrigger","DialogPortal","DialogOverlay","DialogContent","DialogHeader","DialogFooter","CloseDialogIconButton","DialogBody","DecoratableDialog","makeDecoratable","Dialog","withStaticProps","ConfirmAction","CancelAction","Icon","DialogClose"],"mappings":";;;;;;;;;;;;;;;;AAsCA,MAAMA,aAAa,CAACC;IAChB,MAAM,EACFC,SAAS,EACTC,YAAY,EACZC,YAAY,EACZC,WAAW,EACXC,SAAS,EACTC,WAAW,EACXC,gBAAgB,EACnB,GAAGC,wBAAAA,OAAa,CAAC;QACd,MAAM,EAEFC,WAAW,EACXC,IAAI,EACJ,cAAcC,oBAAoB,EAClCC,OAAO,EACPC,MAAM,EACNC,KAAK,EACLC,GAAG,EAGHC,IAAI,EAGJC,OAAO,EAGPC,KAAK,EACLC,IAAI,EACJC,WAAW,EAGX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BAAiB,IAAI,GAAG,WAAH,GACjB,sCAACmC,uBAAqBA;YAAC,MAAMnC,iBAAiB,IAAI;aAClD0B;qBAGR,sCAACU,YAAetC;AAMxC;AAEAN,WAAW,WAAW,GAAG;AAEzB,MAAM6C,oBAAoBC,gBAAgB,UAAU9C;AAEpD,MAAM+C,SAASC,gBAAgBH,mBAAmB;IAC9CI,eAAaA;IACbC,cAAYA;IACZC,MAAIA;IACJ,OAAOC;AACX"}
1
+ {"version":3,"file":"Dialog/Dialog.js","sources":["../../src/Dialog/Dialog.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { makeDecoratable, withStaticProps } from \"~/utils.js\";\nimport { OverlayLoader } from \"~/Loader/index.js\";\nimport { DialogContent } from \"./components/DialogContent.js\";\nimport { DialogHeader } from \"~/Dialog/components/DialogHeader.js\";\nimport { DialogBody } from \"~/Dialog/components/DialogBody.js\";\nimport { DialogFooter } from \"~/Dialog/components/DialogFooter.js\";\nimport { DialogOverlay } from \"~/Dialog/components/DialogOverlay.js\";\nimport { DialogPortal } from \"./components/DialogPortal.js\";\nimport { DialogRoot } from \"./components/DialogRoot.js\";\nimport { DialogTrigger } from \"./components/DialogTrigger.js\";\nimport { Icon } from \"./components/Icon.js\";\nimport type { IconElement } from \"~/Icon/index.js\";\nimport { ConfirmAction } from \"./components/ConfirmAction.js\";\nimport { CancelAction } from \"./components/CancelAction.js\";\nimport { CloseDialogIconButton } from \"~/Dialog/components/CloseDialogIconButton.js\";\nimport { DialogClose } from \"~/Dialog/components/DialogClose.js\";\n\ninterface DialogProps\n extends\n React.ComponentPropsWithoutRef<typeof DialogRoot>,\n Omit<React.ComponentPropsWithoutRef<typeof DialogContent>, \"title\"> {\n trigger?: React.ReactNode;\n title?: React.ReactNode;\n icon?: IconElement;\n showCloseButton?: boolean;\n dismissible?: boolean;\n bodyPadding?: boolean;\n scrollable?: boolean;\n description?: React.ReactNode;\n children: React.ReactNode;\n actions?: React.ReactNode;\n info?: React.ReactNode;\n loading?: boolean | { text?: string };\n overlay?: React.ReactNode;\n onClose?: () => void;\n onOpen?: () => void;\n}\n\nconst DialogBase = (props: DialogProps) => {\n const {\n rootProps,\n triggerProps,\n contentProps,\n headerProps,\n bodyProps,\n footerProps,\n closeButtonProps\n } = React.useMemo(() => {\n const {\n // Root props.\n defaultOpen,\n open,\n onOpenChange: originalOnOpenChange,\n onClose,\n onOpen,\n modal,\n dir,\n\n // Shared props.\n size,\n\n // Trigger props.\n trigger,\n\n // Header props.\n title,\n icon,\n description,\n\n // Body props.\n children,\n bodyPadding,\n scrollable,\n\n // Footer props.\n actions,\n info,\n\n // Overlay props.\n loading,\n overlay,\n\n // Close button props.\n showCloseButton = true,\n\n // Content props.\n ...rest\n } = props;\n\n // Handles dialog open state changes, calling original and onClose / onOpen callbacks as needed\n const onOpenChange = (open: boolean) => {\n originalOnOpenChange && originalOnOpenChange(open);\n\n if (onClose && !open) {\n onClose();\n }\n\n if (onOpen && open) {\n onOpen();\n }\n };\n\n const resolvedOverlay = (() => {\n if (overlay) {\n return overlay;\n }\n if (!loading) {\n return undefined;\n }\n const text = typeof loading === \"object\" ? loading.text : undefined;\n return <OverlayLoader text={text} />;\n })();\n\n return {\n rootProps: {\n defaultOpen,\n open,\n onOpenChange,\n modal,\n dir,\n size\n },\n triggerProps: {\n // Temporary fix. We need this because `ref` doesn't get passed to components\n // that are decorated with `makeDecoratable`. This will be fixed in the future.\n children: <div>{trigger}</div>\n },\n headerProps: { title, icon, description, size },\n bodyProps: { children, bodyPadding, scrollable, size },\n footerProps: { info, actions, size },\n closeButtonProps: { show: showCloseButton, size },\n contentProps: { ...rest, size, overlay: resolvedOverlay }\n };\n }, [props]);\n\n return (\n <DialogRoot {...rootProps}>\n {triggerProps.children && <DialogTrigger {...triggerProps} asChild />}\n <DialogPortal>\n <div data-role=\"dialog\" className={\"z-overlay absolute\"}>\n <DialogOverlay />\n <DialogContent\n {...contentProps}\n header={<DialogHeader {...headerProps} />}\n footer={<DialogFooter {...footerProps} />}\n closeButton={\n closeButtonProps.show ? (\n <CloseDialogIconButton size={closeButtonProps.size} />\n ) : undefined\n }\n >\n <DialogBody {...bodyProps} />\n </DialogContent>\n </div>\n </DialogPortal>\n </DialogRoot>\n );\n};\n\nDialogBase.displayName = \"Dialog\";\n\nconst DecoratableDialog = makeDecoratable(\"Dialog\", DialogBase);\n\nconst Dialog = withStaticProps(DecoratableDialog, {\n ConfirmAction,\n CancelAction,\n Icon,\n Close: DialogClose\n});\n\nexport { Dialog, type DialogProps };\n"],"names":["DialogBase","props","rootProps","triggerProps","contentProps","headerProps","bodyProps","footerProps","closeButtonProps","React","defaultOpen","open","originalOnOpenChange","onClose","onOpen","modal","dir","size","trigger","title","icon","description","children","bodyPadding","scrollable","actions","info","loading","overlay","showCloseButton","rest","onOpenChange","resolvedOverlay","text","undefined","OverlayLoader","DialogRoot","DialogTrigger","DialogPortal","DialogOverlay","DialogContent","DialogHeader","DialogFooter","CloseDialogIconButton","DialogBody","DecoratableDialog","makeDecoratable","Dialog","withStaticProps","ConfirmAction","CancelAction","Icon","DialogClose"],"mappings":";;;;;;;;;;;;;;;;AAuCA,MAAMA,aAAa,CAACC;IAChB,MAAM,EACFC,SAAS,EACTC,YAAY,EACZC,YAAY,EACZC,WAAW,EACXC,SAAS,EACTC,WAAW,EACXC,gBAAgB,EACnB,GAAGC,wBAAAA,OAAa,CAAC;QACd,MAAM,EAEFC,WAAW,EACXC,IAAI,EACJ,cAAcC,oBAAoB,EAClCC,OAAO,EACPC,MAAM,EACNC,KAAK,EACLC,GAAG,EAGHC,IAAI,EAGJC,OAAO,EAGPC,KAAK,EACLC,IAAI,EACJC,WAAW,EAGXC,QAAQ,EACRC,WAAW,EACXC,UAAU,EAGVC,OAAO,EACPC,IAAI,EAGJC,OAAO,EACPC,OAAO,EAGPC,kBAAkB,IAAI,EAGtB,GAAGC,MACN,GAAG7B;QAGJ,MAAM8B,eAAe,CAACpB;YAClBC,wBAAwBA,qBAAqBD;YAE7C,IAAIE,WAAW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AgBH,mBAAmB;IAC9CI,eAAaA;IACbC,cAAYA;IACZC,MAAIA;IACJ,OAAOC;AACX"}
@@ -9,6 +9,10 @@ interface DrawerProps extends React.ComponentPropsWithoutRef<typeof DrawerRoot>,
9
9
  showCloseButton?: boolean;
10
10
  bodyPadding?: boolean;
11
11
  headerSeparator?: boolean;
12
+ /**
13
+ * Controls rendered in the header, next to the close button.
14
+ */
15
+ headerActions?: React.ReactNode;
12
16
  footerSeparator?: boolean;
13
17
  description?: React.ReactNode;
14
18
  children: React.ReactNode;
@@ -79,21 +83,21 @@ declare const Drawer: typeof DrawerBase & {
79
83
  displayName: string;
80
84
  }>) => (props: unknown) => React.JSX.Element;
81
85
  };
82
- Icon: (({ className, ...props }: import("../index.js").IconProps) => React.JSX.Element) & {
83
- original: ({ className, ...props }: import("../index.js").IconProps) => React.JSX.Element;
86
+ Icon: ((props: import("../index.js").IconProps) => React.JSX.Element) & {
87
+ original: (props: import("../index.js").IconProps) => React.JSX.Element;
84
88
  originalName: string;
85
89
  displayName: string;
86
90
  } & {
87
- original: (({ className, ...props }: import("../index.js").IconProps) => React.JSX.Element) & {
88
- original: ({ className, ...props }: import("../index.js").IconProps) => React.JSX.Element;
91
+ original: ((props: import("../index.js").IconProps) => React.JSX.Element) & {
92
+ original: (props: import("../index.js").IconProps) => React.JSX.Element;
89
93
  originalName: string;
90
94
  displayName: string;
91
95
  };
92
96
  originalName: string;
93
97
  displayName: string;
94
98
  } & {
95
- createDecorator: (decorator: import("@webiny/react-composition/types.js").ComponentDecorator<(({ className, ...props }: import("../index.js").IconProps) => React.JSX.Element) & {
96
- original: ({ className, ...props }: import("../index.js").IconProps) => React.JSX.Element;
99
+ createDecorator: (decorator: import("@webiny/react-composition/types.js").ComponentDecorator<((props: import("../index.js").IconProps) => React.JSX.Element) & {
100
+ original: (props: import("../index.js").IconProps) => React.JSX.Element;
97
101
  originalName: string;
98
102
  displayName: string;
99
103
  }>) => (props: unknown) => React.JSX.Element;
package/Drawer/Drawer.js CHANGED
@@ -13,7 +13,7 @@ import { CancelButton } from "./components/CancelButton.js";
13
13
  import * as __rspack_external_react from "react";
14
14
  const DrawerBase = (props)=>{
15
15
  const { rootProps, triggerProps, contentProps, headerProps, bodyProps, footerProps } = __rspack_external_react.useMemo(()=>{
16
- const { defaultOpen, open, onOpenChange: originalOnOpenChange, onClose, onOpen, modal = false, dir, trigger, title, icon, description, showCloseButton, headerSeparator, children, bodyPadding, actions, info, footerSeparator, ...rest } = props;
16
+ const { defaultOpen, open, onOpenChange: originalOnOpenChange, onClose, onOpen, modal = false, dir, trigger, title, icon, description, showCloseButton, headerSeparator, headerActions, children, bodyPadding, actions, info, footerSeparator, ...rest } = props;
17
17
  const onOpenChange = (open)=>{
18
18
  originalOnOpenChange && originalOnOpenChange(open);
19
19
  if (onClose && !open) onClose();
@@ -35,6 +35,7 @@ const DrawerBase = (props)=>{
35
35
  icon,
36
36
  description,
37
37
  showCloseButton,
38
+ headerActions,
38
39
  separator: headerSeparator
39
40
  },
40
41
  bodyProps: {
@@ -1 +1 @@
1
- {"version":3,"file":"Drawer/Drawer.js","sources":["../../src/Drawer/Drawer.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { makeDecoratable, withStaticProps } from \"~/utils.js\";\nimport { DrawerContent } from \"./components/DrawerContent.js\";\nimport { DrawerFooter } from \"./components/DrawerFooter.js\";\nimport { DrawerHeader } from \"./components/DrawerHeader.js\";\nimport { DrawerOverlay } from \"./components/DrawerOverlay.js\";\nimport { DrawerPortal } from \"./components/DrawerPortal.js\";\nimport { DrawerRoot } from \"./components/DrawerRoot.js\";\nimport { DrawerTrigger } from \"./components/DrawerTrigger.js\";\nimport { DrawerBody } from \"~/Drawer/components/DrawerBody.js\";\nimport { Icon } from \"./components/Icon.js\";\nimport { ConfirmButton } from \"./components/ConfirmButton.js\";\nimport { CancelButton } from \"./components/CancelButton.js\";\n\ninterface DrawerProps\n extends\n React.ComponentPropsWithoutRef<typeof DrawerRoot>,\n Omit<React.ComponentPropsWithoutRef<typeof DrawerContent>, \"title\"> {\n trigger?: React.ReactNode;\n title?: React.ReactNode;\n icon?: React.ReactElement;\n modal?: boolean;\n showCloseButton?: boolean;\n bodyPadding?: boolean;\n headerSeparator?: boolean;\n footerSeparator?: boolean;\n description?: React.ReactNode;\n children: React.ReactNode;\n actions?: React.ReactNode;\n info?: React.ReactNode;\n width?: React.CSSProperties[\"width\"];\n onClose?: () => void;\n onOpen?: () => void;\n}\n\nconst DrawerBase = (props: DrawerProps) => {\n const { rootProps, triggerProps, contentProps, headerProps, bodyProps, footerProps } =\n React.useMemo(() => {\n const {\n // Root props.\n defaultOpen,\n open,\n onOpenChange: originalOnOpenChange,\n onClose,\n onOpen,\n\n // We want the drawer to always allow interaction with the outside elements.\n modal = false,\n dir,\n\n // Trigger props.\n trigger,\n\n // Header props.\n title,\n icon,\n description,\n showCloseButton,\n headerSeparator,\n\n // Body props.\n children,\n bodyPadding,\n\n // Footer props.\n actions,\n info,\n footerSeparator,\n\n // Content props.\n ...rest\n } = props;\n\n // Handles dialog open state changes, calling original and onClose / onOpen callbacks as needed\n const onOpenChange = (open: boolean) => {\n originalOnOpenChange && originalOnOpenChange(open);\n\n if (onClose && !open) {\n onClose();\n }\n\n if (onOpen && open) {\n onOpen();\n }\n };\n\n return {\n rootProps: {\n defaultOpen,\n open,\n onOpenChange,\n modal,\n dir\n },\n triggerProps: {\n // Temporary fix. We need this because `ref` doesn't get passed to components\n // that are decorated with `makeDecoratable`. This will be fixed in the future.\n children: <div>{trigger}</div>\n },\n headerProps: {\n title,\n icon,\n description,\n showCloseButton,\n separator: headerSeparator\n },\n bodyProps: { children, bodyPadding },\n footerProps: { info, actions, separator: footerSeparator },\n contentProps: rest\n };\n }, [props]);\n\n return (\n <DrawerRoot {...rootProps}>\n {triggerProps.children && <DrawerTrigger {...triggerProps} asChild />}\n <DrawerPortal>\n <div data-role=\"drawer\" className={\"absolute z-overlay\"}>\n {rootProps.modal && <DrawerOverlay />}\n <DrawerContent {...contentProps} modal={rootProps.modal}>\n <DrawerHeader {...headerProps} />\n <DrawerBody {...bodyProps} />\n <DrawerFooter {...footerProps} />\n </DrawerContent>\n </div>\n </DrawerPortal>\n </DrawerRoot>\n );\n};\n\nDrawerBase.displayName = \"Drawer\";\n\nconst DecoratableDrawer = makeDecoratable(\"Drawer\", DrawerBase);\n\nconst Drawer = withStaticProps(DecoratableDrawer, {\n ConfirmButton,\n CancelButton,\n Icon\n});\n\nexport { Drawer, type DrawerProps };\n"],"names":["DrawerBase","props","rootProps","triggerProps","contentProps","headerProps","bodyProps","footerProps","React","defaultOpen","open","originalOnOpenChange","onClose","onOpen","modal","dir","trigger","title","icon","description","showCloseButton","headerSeparator","children","bodyPadding","actions","info","footerSeparator","rest","onOpenChange","DrawerRoot","DrawerTrigger","DrawerPortal","DrawerOverlay","DrawerContent","DrawerHeader","DrawerBody","DrawerFooter","DecoratableDrawer","makeDecoratable","Drawer","withStaticProps","ConfirmButton","CancelButton","Icon"],"mappings":";;;;;;;;;;;;;AAmCA,MAAMA,aAAa,CAACC;IAChB,MAAM,EAAEC,SAAS,EAAEC,YAAY,EAAEC,YAAY,EAAEC,WAAW,EAAEC,SAAS,EAAEC,WAAW,EAAE,GAChFC,wBAAAA,OAAa,CAAC;QACV,MAAM,EAEFC,WAAW,EACXC,IAAI,EACJ,cAAcC,oBAAoB,EAClCC,OAAO,EACPC,MAAM,EAGNC,QAAQ,KAAK,EACbC,GAAG,EAGHC,OAAO,EAGPC,KAAK,EACLC,IAAI,EACJC,WAAW,EACXC,eAAe,EACfC,eAAe,EAGfC,QAAQ,EACRC,WAAW,EAGXC,OAAO,EACPC,IAAI,EACJC,eAAe,EAGf,GAAGC,MACN,GAAG1B;QAGJ,MAAM2B,eAAe,CAAClB;YAClBC,wBAAwBA,qBAAqBD;YAE7C,IAAIE,WAAW,CAACF,MACZE;YAGJ,IAAIC,UAAUH,MACVG;QAER;QAEA,OAAO;YACH,WAAW;gBACPJ;gBACAC;gBACAkB;gBACAd;gBACAC;YACJ;YACA,cAAc;gBAGV,UAAU,WAAV,GAAU,sCAAC,aAAKC;YACpB;YACA,aAAa;gBACTC;gBACAC;gBACAC;gBACAC;gBACA,WAAWC;YACf;YACA,WAAW;gBAAEC;gBAAUC;YAAY;YACnC,aAAa;gBAAEE;gBAAMD;gBAAS,WAAWE;YAAgB;YACzD,cAAcC;QAClB;IACJ,GAAG;QAAC1B;KAAM;IAEd,OAAO,WAAP,GACI,sCAAC4B,YAAe3B,WACXC,aAAa,QAAQ,IAAI,WAAJ,GAAI,sCAAC2B,eAAaA;QAAE,GAAG3B,YAAY;QAAE;sBAC3D,sCAAC4B,cAAYA,MAAAA,WAAAA,GACT,sCAAC;QAAI,aAAU;QAAS,WAAW;OAC9B7B,UAAU,KAAK,IAAI,WAAJ,GAAI,sCAAC8B,eAAaA,OAAAA,WAAAA,GAClC,sCAACC,eAAaA;QAAE,GAAG7B,YAAY;QAAE,OAAOF,UAAU,KAAK;qBACnD,sCAACgC,cAAiB7B,cAAAA,WAAAA,GAClB,sCAAC8B,YAAe7B,YAAAA,WAAAA,GAChB,sCAAC8B,cAAiB7B;AAM1C;AAEAP,WAAW,WAAW,GAAG;AAEzB,MAAMqC,oBAAoBC,gBAAgB,UAAUtC;AAEpD,MAAMuC,SAASC,gBAAgBH,mBAAmB;IAC9CI,eAAaA;IACbC,cAAYA;IACZC,MAAIA;AACR"}
1
+ {"version":3,"file":"Drawer/Drawer.js","sources":["../../src/Drawer/Drawer.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { makeDecoratable, withStaticProps } from \"~/utils.js\";\nimport { DrawerContent } from \"./components/DrawerContent.js\";\nimport { DrawerFooter } from \"./components/DrawerFooter.js\";\nimport { DrawerHeader } from \"./components/DrawerHeader.js\";\nimport { DrawerOverlay } from \"./components/DrawerOverlay.js\";\nimport { DrawerPortal } from \"./components/DrawerPortal.js\";\nimport { DrawerRoot } from \"./components/DrawerRoot.js\";\nimport { DrawerTrigger } from \"./components/DrawerTrigger.js\";\nimport { DrawerBody } from \"~/Drawer/components/DrawerBody.js\";\nimport { Icon } from \"./components/Icon.js\";\nimport { ConfirmButton } from \"./components/ConfirmButton.js\";\nimport { CancelButton } from \"./components/CancelButton.js\";\n\ninterface DrawerProps\n extends\n React.ComponentPropsWithoutRef<typeof DrawerRoot>,\n Omit<React.ComponentPropsWithoutRef<typeof DrawerContent>, \"title\"> {\n trigger?: React.ReactNode;\n title?: React.ReactNode;\n icon?: React.ReactElement;\n modal?: boolean;\n showCloseButton?: boolean;\n bodyPadding?: boolean;\n headerSeparator?: boolean;\n /**\n * Controls rendered in the header, next to the close button.\n */\n headerActions?: React.ReactNode;\n footerSeparator?: boolean;\n description?: React.ReactNode;\n children: React.ReactNode;\n actions?: React.ReactNode;\n info?: React.ReactNode;\n width?: React.CSSProperties[\"width\"];\n onClose?: () => void;\n onOpen?: () => void;\n}\n\nconst DrawerBase = (props: DrawerProps) => {\n const { rootProps, triggerProps, contentProps, headerProps, bodyProps, footerProps } =\n React.useMemo(() => {\n const {\n // Root props.\n defaultOpen,\n open,\n onOpenChange: originalOnOpenChange,\n onClose,\n onOpen,\n\n // We want the drawer to always allow interaction with the outside elements.\n modal = false,\n dir,\n\n // Trigger props.\n trigger,\n\n // Header props.\n title,\n icon,\n description,\n showCloseButton,\n headerSeparator,\n headerActions,\n\n // Body props.\n children,\n bodyPadding,\n\n // Footer props.\n actions,\n info,\n footerSeparator,\n\n // Content props.\n ...rest\n } = props;\n\n // Handles dialog open state changes, calling original and onClose / onOpen callbacks as needed\n const onOpenChange = (open: boolean) => {\n originalOnOpenChange && originalOnOpenChange(open);\n\n if (onClose && !open) {\n onClose();\n }\n\n if (onOpen && open) {\n onOpen();\n }\n };\n\n return {\n rootProps: {\n defaultOpen,\n open,\n onOpenChange,\n modal,\n dir\n },\n triggerProps: {\n // Temporary fix. We need this because `ref` doesn't get passed to components\n // that are decorated with `makeDecoratable`. This will be fixed in the future.\n children: <div>{trigger}</div>\n },\n headerProps: {\n title,\n icon,\n description,\n showCloseButton,\n headerActions,\n separator: headerSeparator\n },\n bodyProps: { children, bodyPadding },\n footerProps: { info, actions, separator: footerSeparator },\n contentProps: rest\n };\n }, [props]);\n\n return (\n <DrawerRoot {...rootProps}>\n {triggerProps.children && <DrawerTrigger {...triggerProps} asChild />}\n <DrawerPortal>\n <div data-role=\"drawer\" className={\"absolute z-overlay\"}>\n {rootProps.modal && <DrawerOverlay />}\n <DrawerContent {...contentProps} modal={rootProps.modal}>\n <DrawerHeader {...headerProps} />\n <DrawerBody {...bodyProps} />\n <DrawerFooter {...footerProps} />\n </DrawerContent>\n </div>\n </DrawerPortal>\n </DrawerRoot>\n );\n};\n\nDrawerBase.displayName = \"Drawer\";\n\nconst DecoratableDrawer = makeDecoratable(\"Drawer\", DrawerBase);\n\nconst Drawer = withStaticProps(DecoratableDrawer, {\n ConfirmButton,\n CancelButton,\n Icon\n});\n\nexport { Drawer, type DrawerProps };\n"],"names":["DrawerBase","props","rootProps","triggerProps","contentProps","headerProps","bodyProps","footerProps","React","defaultOpen","open","originalOnOpenChange","onClose","onOpen","modal","dir","trigger","title","icon","description","showCloseButton","headerSeparator","headerActions","children","bodyPadding","actions","info","footerSeparator","rest","onOpenChange","DrawerRoot","DrawerTrigger","DrawerPortal","DrawerOverlay","DrawerContent","DrawerHeader","DrawerBody","DrawerFooter","DecoratableDrawer","makeDecoratable","Drawer","withStaticProps","ConfirmButton","CancelButton","Icon"],"mappings":";;;;;;;;;;;;;AAuCA,MAAMA,aAAa,CAACC;IAChB,MAAM,EAAEC,SAAS,EAAEC,YAAY,EAAEC,YAAY,EAAEC,WAAW,EAAEC,SAAS,EAAEC,WAAW,EAAE,GAChFC,wBAAAA,OAAa,CAAC;QACV,MAAM,EAEFC,WAAW,EACXC,IAAI,EACJ,cAAcC,oBAAoB,EAClCC,OAAO,EACPC,MAAM,EAGNC,QAAQ,KAAK,EACbC,GAAG,EAGHC,OAAO,EAGPC,KAAK,EACLC,IAAI,EACJC,W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;
17
17
  export declare const DropdownMenuInDrawer: Story;
18
18
  export declare const WithIcon: Story;
19
+ export declare const WithHeaderActions: Story;
19
20
  export declare const AsModal: Story;
20
21
  export declare const Documentation: Story;
@@ -1,9 +1,10 @@
1
1
  import react from "react";
2
2
  import { Drawer } from "./Drawer.js";
3
- import { Button } from "../Button/index.js";
3
+ import { Button, IconButton } from "../Button/index.js";
4
4
  import { DropdownMenu } from "../DropdownMenu/index.js";
5
5
  import { Tabs } from "../Tabs/index.js";
6
6
  import { ReactComponent } from "@webiny/icons/ring_volume.svg";
7
+ import { ReactComponent as refresh_svg_ReactComponent } from "@webiny/icons/refresh.svg";
7
8
  const meta = {
8
9
  title: "Components/Drawer",
9
10
  component: Drawer,
@@ -198,6 +199,20 @@ const WithIcon = {
198
199
  children: /*#__PURE__*/ react.createElement(react.Fragment, null, "The icon helps to visually identify the purpose of this drawer.")
199
200
  }
200
201
  };
202
+ const WithHeaderActions = {
203
+ args: {
204
+ ...Default.args,
205
+ headerActions: /*#__PURE__*/ react.createElement(IconButton, {
206
+ variant: "ghost",
207
+ size: "md",
208
+ iconSize: "lg",
209
+ title: "Refresh",
210
+ "aria-label": "Refresh",
211
+ icon: /*#__PURE__*/ react.createElement(refresh_svg_ReactComponent, null)
212
+ }),
213
+ children: /*#__PURE__*/ react.createElement(react.Fragment, null, "Header actions sit next to the close button.")
214
+ }
215
+ };
201
216
  const AsModal = {
202
217
  args: {
203
218
  ...Default.args,
@@ -287,6 +302,9 @@ const Documentation = {
287
302
  control: "boolean",
288
303
  defaultValue: true
289
304
  },
305
+ headerActions: {
306
+ description: "Controls rendered in the header, next to the close button, e.g. icon buttons."
307
+ },
290
308
  footerSeparator: {
291
309
  description: "Show separator above the footer",
292
310
  control: "boolean",
@@ -307,6 +325,6 @@ const Documentation = {
307
325
  }
308
326
  };
309
327
  export default Drawer_stories;
310
- export { AsModal, ControlledVisibility, CustomWidth, Default, Documentation, DropdownMenuInDrawer, SizeExtraLarge, SizeLarge, SizeMedium, SizeSmall, WithDropdownMenu, WithIcon, WithOpenCloseEventHandler, WithTabs, WithoutCloseButton };
328
+ export { AsModal, ControlledVisibility, CustomWidth, Default, Documentation, DropdownMenuInDrawer, SizeExtraLarge, SizeLarge, SizeMedium, SizeSmall, WithDropdownMenu, WithHeaderActions, WithIcon, WithOpenCloseEventHandler, WithTabs, WithoutCloseButton };
311
329
 
312
330
  //# sourceMappingURL=Drawer.stories.js.map