@trellixio/roaster-react 1.1.1 → 2.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 (824) hide show
  1. package/README.md +39 -23
  2. package/cjs/components/ActionCard/ActionCard.js +20 -4
  3. package/cjs/components/ActionCard/ActionCard.js.map +1 -1
  4. package/cjs/components/ActionCard/ActionCardGroup.js +42 -0
  5. package/cjs/components/ActionCard/ActionCardGroup.js.map +1 -0
  6. package/cjs/components/ActionList/ActionList.context.js.map +1 -1
  7. package/cjs/components/ActionList/ActionList.js +20 -23
  8. package/cjs/components/ActionList/ActionList.js.map +1 -1
  9. package/cjs/components/ActionList/components/ActionListDivider.js +6 -3
  10. package/cjs/components/ActionList/components/ActionListDivider.js.map +1 -1
  11. package/cjs/components/ActionList/components/ActionListDropdown.js +30 -15
  12. package/cjs/components/ActionList/components/ActionListDropdown.js.map +1 -1
  13. package/cjs/components/ActionList/components/ActionListGroup.js +25 -4
  14. package/cjs/components/ActionList/components/ActionListGroup.js.map +1 -1
  15. package/cjs/components/ActionList/components/ActionListItem.js +54 -4
  16. package/cjs/components/ActionList/components/ActionListItem.js.map +1 -1
  17. package/cjs/components/ActionList/components/ActionListSearch.js +67 -0
  18. package/cjs/components/ActionList/components/ActionListSearch.js.map +1 -0
  19. package/cjs/components/ActionList/components/ActionListSubmenu.js +125 -0
  20. package/cjs/components/ActionList/components/ActionListSubmenu.js.map +1 -0
  21. package/cjs/components/ActionList/components/ActionListSwitchItem.js +64 -0
  22. package/cjs/components/ActionList/components/ActionListSwitchItem.js.map +1 -0
  23. package/cjs/components/ActionList/components/ActionListTrigger.js +2 -36
  24. package/cjs/components/ActionList/components/ActionListTrigger.js.map +1 -1
  25. package/cjs/components/Alert/Alert.js +19 -2
  26. package/cjs/components/Alert/Alert.js.map +1 -1
  27. package/cjs/components/AppFrame/AppFrame.js +56 -0
  28. package/cjs/components/AppFrame/AppFrame.js.map +1 -0
  29. package/cjs/components/Avatar/Avatar.js +31 -8
  30. package/cjs/components/Avatar/Avatar.js.map +1 -1
  31. package/cjs/components/BlockCard/BlockCard.js +98 -4
  32. package/cjs/components/BlockCard/BlockCard.js.map +1 -1
  33. package/cjs/components/Button/Button.js +36 -15
  34. package/cjs/components/Button/Button.js.map +1 -1
  35. package/cjs/components/ButtonIcon/ButtonIcon.js +8 -9
  36. package/cjs/components/ButtonIcon/ButtonIcon.js.map +1 -1
  37. package/cjs/components/Chart/Chart.js +185 -0
  38. package/cjs/components/Chart/Chart.js.map +1 -0
  39. package/cjs/components/Checkbox/Checkbox.js +65 -38
  40. package/cjs/components/Checkbox/Checkbox.js.map +1 -1
  41. package/cjs/components/Checkbox/CheckboxGroup/CheckboxGroup.context.js.map +1 -1
  42. package/cjs/components/Checkbox/CheckboxGroup/CheckboxGroup.js +45 -11
  43. package/cjs/components/Checkbox/CheckboxGroup/CheckboxGroup.js.map +1 -1
  44. package/cjs/components/Checkbox/ChoiceText.js +49 -0
  45. package/cjs/components/Checkbox/ChoiceText.js.map +1 -0
  46. package/cjs/components/ColorField/ColorField.js +69 -18
  47. package/cjs/components/ColorField/ColorField.js.map +1 -1
  48. package/cjs/components/DatePicker/DatePicker.js +86 -48
  49. package/cjs/components/DatePicker/DatePicker.js.map +1 -1
  50. package/cjs/components/DatePicker/components/Calendar/Calendar.js +65 -35
  51. package/cjs/components/DatePicker/components/Calendar/Calendar.js.map +1 -1
  52. package/cjs/components/DatePicker/components/Day/Day.js +16 -31
  53. package/cjs/components/DatePicker/components/Day/Day.js.map +1 -1
  54. package/cjs/components/DatePicker/components/Month/Month.js +92 -29
  55. package/cjs/components/DatePicker/components/Month/Month.js.map +1 -1
  56. package/cjs/components/DatePicker/components/MonthGrid/MonthGrid.js +97 -0
  57. package/cjs/components/DatePicker/components/MonthGrid/MonthGrid.js.map +1 -0
  58. package/cjs/components/DatePicker/components/Weekday/Weekday.js +3 -15
  59. package/cjs/components/DatePicker/components/Weekday/Weekday.js.map +1 -1
  60. package/cjs/components/DatePicker/utils/index.js +43 -25
  61. package/cjs/components/DatePicker/utils/index.js.map +1 -1
  62. package/cjs/components/DescriptiveList/DescriptiveList.js +14 -5
  63. package/cjs/components/DescriptiveList/DescriptiveList.js.map +1 -1
  64. package/cjs/components/DescriptiveList/DescriptiveListItem.js +15 -3
  65. package/cjs/components/DescriptiveList/DescriptiveListItem.js.map +1 -1
  66. package/cjs/components/DropdownCard/DropdownCard.context.js.map +1 -1
  67. package/cjs/components/DropdownCard/DropdownCard.js +17 -22
  68. package/cjs/components/DropdownCard/DropdownCard.js.map +1 -1
  69. package/cjs/components/DropdownCard/components/DropdownCardActions.js +5 -3
  70. package/cjs/components/DropdownCard/components/DropdownCardActions.js.map +1 -1
  71. package/cjs/components/DropdownCard/components/DropdownCardContent.js +5 -3
  72. package/cjs/components/DropdownCard/components/DropdownCardContent.js.map +1 -1
  73. package/cjs/components/DropdownCard/components/DropdownCardDropdown.js +18 -13
  74. package/cjs/components/DropdownCard/components/DropdownCardDropdown.js.map +1 -1
  75. package/cjs/components/DropdownCard/components/DropdownCardTabs.js +136 -0
  76. package/cjs/components/DropdownCard/components/DropdownCardTabs.js.map +1 -0
  77. package/cjs/components/DropdownCard/components/DropdownCardTrigger.js +2 -34
  78. package/cjs/components/DropdownCard/components/DropdownCardTrigger.js.map +1 -1
  79. package/cjs/components/Field/Field.js +27 -0
  80. package/cjs/components/Field/Field.js.map +1 -0
  81. package/cjs/components/FileField/FileField.js +64 -24
  82. package/cjs/components/FileField/FileField.js.map +1 -1
  83. package/cjs/components/FormActions/FormActions.js +27 -0
  84. package/cjs/components/FormActions/FormActions.js.map +1 -0
  85. package/cjs/components/HyperlinkCard/HyperlinkCard.js +22 -6
  86. package/cjs/components/HyperlinkCard/HyperlinkCard.js.map +1 -1
  87. package/cjs/components/Icon/Icon.js +10 -12
  88. package/cjs/components/Icon/Icon.js.map +1 -1
  89. package/cjs/components/IconBadge/IconBadge.js +40 -0
  90. package/cjs/components/IconBadge/IconBadge.js.map +1 -0
  91. package/cjs/components/Loader/Loader.js +35 -2
  92. package/cjs/components/Loader/Loader.js.map +1 -1
  93. package/cjs/components/Modal/Modal.js +91 -4
  94. package/cjs/components/Modal/Modal.js.map +1 -1
  95. package/cjs/components/Modal/ModalProvider/ModalProviderFooter.js +7 -4
  96. package/cjs/components/Modal/ModalProvider/ModalProviderFooter.js.map +1 -1
  97. package/cjs/components/Modal/ModalProvider/index.js +16 -17
  98. package/cjs/components/Modal/ModalProvider/index.js.map +1 -1
  99. package/cjs/components/Modal/utils/reducer.js +4 -1
  100. package/cjs/components/Modal/utils/reducer.js.map +1 -1
  101. package/cjs/components/Modal/utils/useModal.js +1 -1
  102. package/cjs/components/Modal/utils/useModal.js.map +1 -1
  103. package/cjs/components/Page/Breadcrumbs.js +43 -0
  104. package/cjs/components/Page/Breadcrumbs.js.map +1 -0
  105. package/cjs/components/Page/Page.js +73 -8
  106. package/cjs/components/Page/Page.js.map +1 -1
  107. package/cjs/components/Pagination/Pagination.js +23 -12
  108. package/cjs/components/Pagination/Pagination.js.map +1 -1
  109. package/cjs/components/Progress/Progress.js +48 -3
  110. package/cjs/components/Progress/Progress.js.map +1 -1
  111. package/cjs/components/Radio/Radio.js +35 -25
  112. package/cjs/components/Radio/Radio.js.map +1 -1
  113. package/cjs/components/Radio/RadioGroup/RadioGroup.context.js.map +1 -1
  114. package/cjs/components/Radio/RadioGroup/RadioGroup.js +37 -24
  115. package/cjs/components/Radio/RadioGroup/RadioGroup.js.map +1 -1
  116. package/cjs/components/RangeField/RangeField.js +31 -27
  117. package/cjs/components/RangeField/RangeField.js.map +1 -1
  118. package/cjs/components/Select/Select.js +75 -31
  119. package/cjs/components/Select/Select.js.map +1 -1
  120. package/cjs/components/Sidebar/Sidebar.js +122 -110
  121. package/cjs/components/Sidebar/Sidebar.js.map +1 -1
  122. package/cjs/components/Sidebar/components/Back.js +38 -0
  123. package/cjs/components/Sidebar/components/Back.js.map +1 -0
  124. package/cjs/components/Sidebar/components/Menu.js +17 -6
  125. package/cjs/components/Sidebar/components/Menu.js.map +1 -1
  126. package/cjs/components/Sidebar/components/MenuItem.js +37 -6
  127. package/cjs/components/Sidebar/components/MenuItem.js.map +1 -1
  128. package/cjs/components/Sidebar/components/Section.js +15 -3
  129. package/cjs/components/Sidebar/components/Section.js.map +1 -1
  130. package/cjs/components/Sidebar/components/SubMenu.js +15 -2
  131. package/cjs/components/Sidebar/components/SubMenu.js.map +1 -1
  132. package/cjs/components/Spinner/Spinner.js +20 -2
  133. package/cjs/components/Spinner/Spinner.js.map +1 -1
  134. package/cjs/components/StatCard/StatCard.js +47 -10
  135. package/cjs/components/StatCard/StatCard.js.map +1 -1
  136. package/cjs/components/Switch/Switch.js +42 -20
  137. package/cjs/components/Switch/Switch.js.map +1 -1
  138. package/cjs/components/Table/Table.js +95 -31
  139. package/cjs/components/Table/Table.js.map +1 -1
  140. package/cjs/components/Table/components/Checkbox/index.js +8 -8
  141. package/cjs/components/Table/components/Checkbox/index.js.map +1 -1
  142. package/cjs/components/Table/components/TableBody.js +3 -3
  143. package/cjs/components/Table/components/TableBody.js.map +1 -1
  144. package/cjs/components/Table/components/TableCell.js +3 -4
  145. package/cjs/components/Table/components/TableCell.js.map +1 -1
  146. package/cjs/components/Table/components/TableGroup.js +30 -0
  147. package/cjs/components/Table/components/TableGroup.js.map +1 -0
  148. package/cjs/components/Table/components/TableHead.js +19 -16
  149. package/cjs/components/Table/components/TableHead.js.map +1 -1
  150. package/cjs/components/Table/components/TableHeadCell.js +23 -5
  151. package/cjs/components/Table/components/TableHeadCell.js.map +1 -1
  152. package/cjs/components/Table/components/TablePagination.js +6 -16
  153. package/cjs/components/Table/components/TablePagination.js.map +1 -1
  154. package/cjs/components/Table/components/TableProvider/TableProvider.js +4 -4
  155. package/cjs/components/Table/components/TableProvider/TableProvider.js.map +1 -1
  156. package/cjs/components/Table/components/TableRow.js +12 -9
  157. package/cjs/components/Table/components/TableRow.js.map +1 -1
  158. package/cjs/components/Table/labels.js +34 -0
  159. package/cjs/components/Table/labels.js.map +1 -0
  160. package/cjs/components/Table/utils/rows/context.js.map +1 -1
  161. package/cjs/components/Table/utils/table/context.js.map +1 -1
  162. package/cjs/components/Table/utils/table/hooks.js +3 -3
  163. package/cjs/components/Table/utils/table/hooks.js.map +1 -1
  164. package/cjs/components/Table/utils/table/types.js +0 -7
  165. package/cjs/components/Table/utils/table/types.js.map +1 -1
  166. package/cjs/components/Table/utils/useSelectableResourceState/index.js +4 -5
  167. package/cjs/components/Table/utils/useSelectableResourceState/index.js.map +1 -1
  168. package/cjs/components/Tag/Tag.js +36 -5
  169. package/cjs/components/Tag/Tag.js.map +1 -1
  170. package/cjs/components/Tag/TagGroup.js +3 -2
  171. package/cjs/components/Tag/TagGroup.js.map +1 -1
  172. package/cjs/components/TextField/TextField.js +41 -38
  173. package/cjs/components/TextField/TextField.js.map +1 -1
  174. package/cjs/components/Textarea/Textarea.js +10 -26
  175. package/cjs/components/Textarea/Textarea.js.map +1 -1
  176. package/cjs/components/Thumbnail/Thumbnail.js +22 -8
  177. package/cjs/components/Thumbnail/Thumbnail.js.map +1 -1
  178. package/cjs/components/Timeline/Timeline.js +40 -0
  179. package/cjs/components/Timeline/Timeline.js.map +1 -0
  180. package/cjs/components/Timeline/TimelineGroup.js +42 -0
  181. package/cjs/components/Timeline/TimelineGroup.js.map +1 -0
  182. package/cjs/components/Timeline/TimelineItem.js +38 -0
  183. package/cjs/components/Timeline/TimelineItem.js.map +1 -0
  184. package/cjs/components/Toast/Toast.js +18 -2
  185. package/cjs/components/Toast/Toast.js.map +1 -1
  186. package/cjs/components/Toast/Toasts.context.js +31 -3
  187. package/cjs/components/Toast/Toasts.context.js.map +1 -1
  188. package/cjs/components/Toast/ToastsContainer/index.js +43 -19
  189. package/cjs/components/Toast/ToastsContainer/index.js.map +1 -1
  190. package/cjs/components/Toast/ToastsProvider/index.js +11 -15
  191. package/cjs/components/Toast/ToastsProvider/index.js.map +1 -1
  192. package/cjs/components/Toast/store.js +49 -0
  193. package/cjs/components/Toast/store.js.map +1 -0
  194. package/cjs/components/Tooltip/Tooltip.js +34 -53
  195. package/cjs/components/Tooltip/Tooltip.js.map +1 -1
  196. package/cjs/components/Tooltip/TooltipCallout.js +60 -0
  197. package/cjs/components/Tooltip/TooltipCallout.js.map +1 -0
  198. package/cjs/components/Tooltip/useTooltip.js +11 -45
  199. package/cjs/components/Tooltip/useTooltip.js.map +1 -1
  200. package/cjs/components/Visualizer/Visualizer.js +70 -10
  201. package/cjs/components/Visualizer/Visualizer.js.map +1 -1
  202. package/cjs/index.js +68 -66
  203. package/cjs/index.js.map +1 -1
  204. package/cjs/tokens/tokens.js +1532 -0
  205. package/cjs/tokens/tokens.js.map +1 -0
  206. package/cjs/utils/Slot/index.js +52 -0
  207. package/cjs/utils/Slot/index.js.map +1 -0
  208. package/cjs/utils/classNames/index.js +3 -3
  209. package/cjs/utils/classNames/index.js.map +1 -1
  210. package/cjs/utils/getElementRef/index.js +16 -0
  211. package/cjs/utils/getElementRef/index.js.map +1 -0
  212. package/cjs/utils/guid/index.js.map +1 -1
  213. package/cjs/utils/toPercent/index.js +9 -0
  214. package/cjs/utils/toPercent/index.js.map +1 -0
  215. package/cjs/utils/useControllableState/index.js +39 -0
  216. package/cjs/utils/useControllableState/index.js.map +1 -0
  217. package/cjs/utils/useDropdown/DropdownTrigger.js +33 -0
  218. package/cjs/utils/useDropdown/DropdownTrigger.js.map +1 -0
  219. package/cjs/utils/useDropdown/index.js +54 -23
  220. package/cjs/utils/useDropdown/index.js.map +1 -1
  221. package/cjs/utils/useImageFallback/index.js +26 -0
  222. package/cjs/utils/useImageFallback/index.js.map +1 -0
  223. package/cjs/utils/useUid/index.js.map +1 -1
  224. package/esm/components/ActionCard/ActionCard.js +20 -4
  225. package/esm/components/ActionCard/ActionCard.js.map +1 -1
  226. package/esm/components/ActionCard/ActionCardGroup.js +26 -0
  227. package/esm/components/ActionCard/ActionCardGroup.js.map +1 -0
  228. package/esm/components/ActionList/ActionList.context.js.map +1 -1
  229. package/esm/components/ActionList/ActionList.js +21 -11
  230. package/esm/components/ActionList/ActionList.js.map +1 -1
  231. package/esm/components/ActionList/components/ActionListDivider.js +6 -3
  232. package/esm/components/ActionList/components/ActionListDivider.js.map +1 -1
  233. package/esm/components/ActionList/components/ActionListDropdown.js +31 -16
  234. package/esm/components/ActionList/components/ActionListDropdown.js.map +1 -1
  235. package/esm/components/ActionList/components/ActionListGroup.js +24 -3
  236. package/esm/components/ActionList/components/ActionListGroup.js.map +1 -1
  237. package/esm/components/ActionList/components/ActionListItem.js +53 -3
  238. package/esm/components/ActionList/components/ActionListItem.js.map +1 -1
  239. package/esm/components/ActionList/components/ActionListSearch.js +52 -0
  240. package/esm/components/ActionList/components/ActionListSearch.js.map +1 -0
  241. package/esm/components/ActionList/components/ActionListSubmenu.js +110 -0
  242. package/esm/components/ActionList/components/ActionListSubmenu.js.map +1 -0
  243. package/esm/components/ActionList/components/ActionListSwitchItem.js +49 -0
  244. package/esm/components/ActionList/components/ActionListSwitchItem.js.map +1 -0
  245. package/esm/components/ActionList/components/ActionListTrigger.js +2 -23
  246. package/esm/components/ActionList/components/ActionListTrigger.js.map +1 -1
  247. package/esm/components/Alert/Alert.js +19 -2
  248. package/esm/components/Alert/Alert.js.map +1 -1
  249. package/esm/components/AppFrame/AppFrame.js +37 -0
  250. package/esm/components/AppFrame/AppFrame.js.map +1 -0
  251. package/esm/components/Avatar/Avatar.js +31 -8
  252. package/esm/components/Avatar/Avatar.js.map +1 -1
  253. package/esm/components/BlockCard/BlockCard.js +98 -4
  254. package/esm/components/BlockCard/BlockCard.js.map +1 -1
  255. package/esm/components/Button/Button.js +36 -15
  256. package/esm/components/Button/Button.js.map +1 -1
  257. package/esm/components/ButtonIcon/ButtonIcon.js +8 -9
  258. package/esm/components/ButtonIcon/ButtonIcon.js.map +1 -1
  259. package/esm/components/Chart/Chart.js +170 -0
  260. package/esm/components/Chart/Chart.js.map +1 -0
  261. package/esm/components/Checkbox/Checkbox.js +64 -37
  262. package/esm/components/Checkbox/Checkbox.js.map +1 -1
  263. package/esm/components/Checkbox/CheckboxGroup/CheckboxGroup.context.js.map +1 -1
  264. package/esm/components/Checkbox/CheckboxGroup/CheckboxGroup.js +45 -11
  265. package/esm/components/Checkbox/CheckboxGroup/CheckboxGroup.js.map +1 -1
  266. package/esm/components/Checkbox/ChoiceText.js +33 -0
  267. package/esm/components/Checkbox/ChoiceText.js.map +1 -0
  268. package/esm/components/ColorField/ColorField.js +69 -18
  269. package/esm/components/ColorField/ColorField.js.map +1 -1
  270. package/esm/components/DatePicker/DatePicker.js +86 -48
  271. package/esm/components/DatePicker/DatePicker.js.map +1 -1
  272. package/esm/components/DatePicker/components/Calendar/Calendar.js +60 -18
  273. package/esm/components/DatePicker/components/Calendar/Calendar.js.map +1 -1
  274. package/esm/components/DatePicker/components/Day/Day.js +18 -20
  275. package/esm/components/DatePicker/components/Day/Day.js.map +1 -1
  276. package/esm/components/DatePicker/components/Month/Month.js +93 -30
  277. package/esm/components/DatePicker/components/Month/Month.js.map +1 -1
  278. package/esm/components/DatePicker/components/MonthGrid/MonthGrid.js +82 -0
  279. package/esm/components/DatePicker/components/MonthGrid/MonthGrid.js.map +1 -0
  280. package/esm/components/DatePicker/components/Weekday/Weekday.js +4 -3
  281. package/esm/components/DatePicker/components/Weekday/Weekday.js.map +1 -1
  282. package/esm/components/DatePicker/utils/index.js +37 -25
  283. package/esm/components/DatePicker/utils/index.js.map +1 -1
  284. package/esm/components/DescriptiveList/DescriptiveList.js +14 -5
  285. package/esm/components/DescriptiveList/DescriptiveList.js.map +1 -1
  286. package/esm/components/DescriptiveList/DescriptiveListItem.js +15 -3
  287. package/esm/components/DescriptiveList/DescriptiveListItem.js.map +1 -1
  288. package/esm/components/DropdownCard/DropdownCard.context.js.map +1 -1
  289. package/esm/components/DropdownCard/DropdownCard.js +18 -10
  290. package/esm/components/DropdownCard/DropdownCard.js.map +1 -1
  291. package/esm/components/DropdownCard/components/DropdownCardActions.js +5 -3
  292. package/esm/components/DropdownCard/components/DropdownCardActions.js.map +1 -1
  293. package/esm/components/DropdownCard/components/DropdownCardContent.js +5 -3
  294. package/esm/components/DropdownCard/components/DropdownCardContent.js.map +1 -1
  295. package/esm/components/DropdownCard/components/DropdownCardDropdown.js +19 -14
  296. package/esm/components/DropdownCard/components/DropdownCardDropdown.js.map +1 -1
  297. package/esm/components/DropdownCard/components/DropdownCardTabs.js +118 -0
  298. package/esm/components/DropdownCard/components/DropdownCardTabs.js.map +1 -0
  299. package/esm/components/DropdownCard/components/DropdownCardTrigger.js +2 -21
  300. package/esm/components/DropdownCard/components/DropdownCardTrigger.js.map +1 -1
  301. package/esm/components/Field/Field.js +24 -0
  302. package/esm/components/Field/Field.js.map +1 -0
  303. package/esm/components/FileField/FileField.js +64 -24
  304. package/esm/components/FileField/FileField.js.map +1 -1
  305. package/esm/components/FormActions/FormActions.js +12 -0
  306. package/esm/components/FormActions/FormActions.js.map +1 -0
  307. package/esm/components/HyperlinkCard/HyperlinkCard.js +10 -7
  308. package/esm/components/HyperlinkCard/HyperlinkCard.js.map +1 -1
  309. package/esm/components/Icon/Icon.js +10 -12
  310. package/esm/components/Icon/Icon.js.map +1 -1
  311. package/esm/components/IconBadge/IconBadge.js +25 -0
  312. package/esm/components/IconBadge/IconBadge.js.map +1 -0
  313. package/esm/components/Loader/Loader.js +24 -4
  314. package/esm/components/Loader/Loader.js.map +1 -1
  315. package/esm/components/Modal/Modal.js +90 -3
  316. package/esm/components/Modal/Modal.js.map +1 -1
  317. package/esm/components/Modal/ModalProvider/ModalProviderFooter.js +7 -4
  318. package/esm/components/Modal/ModalProvider/ModalProviderFooter.js.map +1 -1
  319. package/esm/components/Modal/ModalProvider/index.js +16 -17
  320. package/esm/components/Modal/ModalProvider/index.js.map +1 -1
  321. package/esm/components/Modal/utils/reducer.js +4 -1
  322. package/esm/components/Modal/utils/reducer.js.map +1 -1
  323. package/esm/components/Modal/utils/useModal.js +1 -1
  324. package/esm/components/Modal/utils/useModal.js.map +1 -1
  325. package/esm/components/Page/Breadcrumbs.js +28 -0
  326. package/esm/components/Page/Breadcrumbs.js.map +1 -0
  327. package/esm/components/Page/Page.js +73 -9
  328. package/esm/components/Page/Page.js.map +1 -1
  329. package/esm/components/Pagination/Pagination.js +23 -12
  330. package/esm/components/Pagination/Pagination.js.map +1 -1
  331. package/esm/components/Progress/Progress.js +35 -3
  332. package/esm/components/Progress/Progress.js.map +1 -1
  333. package/esm/components/Radio/Radio.js +35 -25
  334. package/esm/components/Radio/Radio.js.map +1 -1
  335. package/esm/components/Radio/RadioGroup/RadioGroup.context.js.map +1 -1
  336. package/esm/components/Radio/RadioGroup/RadioGroup.js +37 -24
  337. package/esm/components/Radio/RadioGroup/RadioGroup.js.map +1 -1
  338. package/esm/components/RangeField/RangeField.js +31 -27
  339. package/esm/components/RangeField/RangeField.js.map +1 -1
  340. package/esm/components/Select/Select.js +75 -31
  341. package/esm/components/Select/Select.js.map +1 -1
  342. package/esm/components/Sidebar/Sidebar.js +121 -109
  343. package/esm/components/Sidebar/Sidebar.js.map +1 -1
  344. package/esm/components/Sidebar/components/Back.js +23 -0
  345. package/esm/components/Sidebar/components/Back.js.map +1 -0
  346. package/esm/components/Sidebar/components/Menu.js +5 -7
  347. package/esm/components/Sidebar/components/Menu.js.map +1 -1
  348. package/esm/components/Sidebar/components/MenuItem.js +25 -7
  349. package/esm/components/Sidebar/components/MenuItem.js.map +1 -1
  350. package/esm/components/Sidebar/components/Section.js +4 -5
  351. package/esm/components/Sidebar/components/Section.js.map +1 -1
  352. package/esm/components/Sidebar/components/SubMenu.js +4 -4
  353. package/esm/components/Sidebar/components/SubMenu.js.map +1 -1
  354. package/esm/components/Spinner/Spinner.js +9 -4
  355. package/esm/components/Spinner/Spinner.js.map +1 -1
  356. package/esm/components/StatCard/StatCard.js +46 -10
  357. package/esm/components/StatCard/StatCard.js.map +1 -1
  358. package/esm/components/Switch/Switch.js +42 -20
  359. package/esm/components/Switch/Switch.js.map +1 -1
  360. package/esm/components/Table/Table.js +95 -31
  361. package/esm/components/Table/Table.js.map +1 -1
  362. package/esm/components/Table/components/Checkbox/index.js +8 -8
  363. package/esm/components/Table/components/Checkbox/index.js.map +1 -1
  364. package/esm/components/Table/components/TableBody.js +3 -3
  365. package/esm/components/Table/components/TableBody.js.map +1 -1
  366. package/esm/components/Table/components/TableCell.js +3 -4
  367. package/esm/components/Table/components/TableCell.js.map +1 -1
  368. package/esm/components/Table/components/TableGroup.js +15 -0
  369. package/esm/components/Table/components/TableGroup.js.map +1 -0
  370. package/esm/components/Table/components/TableHead.js +19 -16
  371. package/esm/components/Table/components/TableHead.js.map +1 -1
  372. package/esm/components/Table/components/TableHeadCell.js +23 -6
  373. package/esm/components/Table/components/TableHeadCell.js.map +1 -1
  374. package/esm/components/Table/components/TablePagination.js +6 -3
  375. package/esm/components/Table/components/TablePagination.js.map +1 -1
  376. package/esm/components/Table/components/TableProvider/TableProvider.js +5 -5
  377. package/esm/components/Table/components/TableProvider/TableProvider.js.map +1 -1
  378. package/esm/components/Table/components/TableRow.js +11 -8
  379. package/esm/components/Table/components/TableRow.js.map +1 -1
  380. package/esm/components/Table/labels.js +18 -0
  381. package/esm/components/Table/labels.js.map +1 -0
  382. package/esm/components/Table/utils/rows/context.js.map +1 -1
  383. package/esm/components/Table/utils/table/context.js.map +1 -1
  384. package/esm/components/Table/utils/table/hooks.js +4 -4
  385. package/esm/components/Table/utils/table/hooks.js.map +1 -1
  386. package/esm/components/Table/utils/table/types.js +1 -7
  387. package/esm/components/Table/utils/table/types.js.map +1 -1
  388. package/esm/components/Table/utils/useSelectableResourceState/index.js +4 -5
  389. package/esm/components/Table/utils/useSelectableResourceState/index.js.map +1 -1
  390. package/esm/components/Tag/Tag.js +36 -5
  391. package/esm/components/Tag/Tag.js.map +1 -1
  392. package/esm/components/Tag/TagGroup.js +3 -2
  393. package/esm/components/Tag/TagGroup.js.map +1 -1
  394. package/esm/components/TextField/TextField.js +41 -38
  395. package/esm/components/TextField/TextField.js.map +1 -1
  396. package/esm/components/Textarea/Textarea.js +10 -26
  397. package/esm/components/Textarea/Textarea.js.map +1 -1
  398. package/esm/components/Thumbnail/Thumbnail.js +22 -8
  399. package/esm/components/Thumbnail/Thumbnail.js.map +1 -1
  400. package/esm/components/Timeline/Timeline.js +25 -0
  401. package/esm/components/Timeline/Timeline.js.map +1 -0
  402. package/esm/components/Timeline/TimelineGroup.js +27 -0
  403. package/esm/components/Timeline/TimelineGroup.js.map +1 -0
  404. package/esm/components/Timeline/TimelineItem.js +23 -0
  405. package/esm/components/Timeline/TimelineItem.js.map +1 -0
  406. package/esm/components/Toast/Toast.js +18 -2
  407. package/esm/components/Toast/Toast.js.map +1 -1
  408. package/esm/components/Toast/Toasts.context.js +17 -4
  409. package/esm/components/Toast/Toasts.context.js.map +1 -1
  410. package/esm/components/Toast/ToastsContainer/index.js +44 -20
  411. package/esm/components/Toast/ToastsContainer/index.js.map +1 -1
  412. package/esm/components/Toast/ToastsProvider/index.js +10 -14
  413. package/esm/components/Toast/ToastsProvider/index.js.map +1 -1
  414. package/esm/components/Toast/store.js +47 -0
  415. package/esm/components/Toast/store.js.map +1 -0
  416. package/esm/components/Tooltip/Tooltip.js +34 -53
  417. package/esm/components/Tooltip/Tooltip.js.map +1 -1
  418. package/esm/components/Tooltip/TooltipCallout.js +45 -0
  419. package/esm/components/Tooltip/TooltipCallout.js.map +1 -0
  420. package/esm/components/Tooltip/useTooltip.js +12 -33
  421. package/esm/components/Tooltip/useTooltip.js.map +1 -1
  422. package/esm/components/Visualizer/Visualizer.js +69 -9
  423. package/esm/components/Visualizer/Visualizer.js.map +1 -1
  424. package/esm/index.js +31 -27
  425. package/esm/index.js.map +1 -1
  426. package/esm/tokens/tokens.js +1530 -0
  427. package/esm/tokens/tokens.js.map +1 -0
  428. package/esm/utils/Slot/index.js +37 -0
  429. package/esm/utils/Slot/index.js.map +1 -0
  430. package/esm/utils/classNames/index.js +3 -3
  431. package/esm/utils/classNames/index.js.map +1 -1
  432. package/esm/utils/getElementRef/index.js +14 -0
  433. package/esm/utils/getElementRef/index.js.map +1 -0
  434. package/esm/utils/guid/index.js.map +1 -1
  435. package/esm/utils/toPercent/index.js +7 -0
  436. package/esm/utils/toPercent/index.js.map +1 -0
  437. package/esm/utils/useControllableState/index.js +24 -0
  438. package/esm/utils/useControllableState/index.js.map +1 -0
  439. package/esm/utils/useDropdown/DropdownTrigger.js +18 -0
  440. package/esm/utils/useDropdown/DropdownTrigger.js.map +1 -0
  441. package/esm/utils/useDropdown/index.js +55 -25
  442. package/esm/utils/useDropdown/index.js.map +1 -1
  443. package/esm/utils/useImageFallback/index.js +11 -0
  444. package/esm/utils/useImageFallback/index.js.map +1 -0
  445. package/esm/utils/useUid/index.js.map +1 -1
  446. package/fonts/dm-sans/LICENSE +93 -0
  447. package/fonts/dm-sans/dm-sans-latin-400-italic.woff2 +0 -0
  448. package/fonts/dm-sans/dm-sans-latin-400-normal.woff2 +0 -0
  449. package/fonts/dm-sans/dm-sans-latin-700-italic.woff2 +0 -0
  450. package/fonts/dm-sans/dm-sans-latin-700-normal.woff2 +0 -0
  451. package/fonts/inter/LICENSE +93 -0
  452. package/fonts/inter/inter-latin-opsz-italic.woff2 +0 -0
  453. package/fonts/inter/inter-latin-opsz-normal.woff2 +0 -0
  454. package/fonts/jetbrains-mono/LICENSE +93 -0
  455. package/fonts/jetbrains-mono/jetbrains-mono-latin-wght-normal.woff2 +0 -0
  456. package/fonts/roboto-mono/LICENSE +93 -0
  457. package/fonts/roboto-mono/roboto-mono-latin-wght-normal.woff2 +0 -0
  458. package/lib/components/ActionCard/ActionCard.d.ts +14 -13
  459. package/lib/components/ActionCard/ActionCard.d.ts.map +1 -1
  460. package/lib/components/ActionCard/ActionCardGroup.d.ts +22 -0
  461. package/lib/components/ActionCard/ActionCardGroup.d.ts.map +1 -0
  462. package/lib/components/ActionCard/index.d.ts +1 -0
  463. package/lib/components/ActionCard/index.d.ts.map +1 -1
  464. package/lib/components/ActionList/ActionList.context.d.ts +6 -3
  465. package/lib/components/ActionList/ActionList.context.d.ts.map +1 -1
  466. package/lib/components/ActionList/ActionList.d.ts +18 -18
  467. package/lib/components/ActionList/ActionList.d.ts.map +1 -1
  468. package/lib/components/ActionList/components/ActionListDivider.d.ts +4 -5
  469. package/lib/components/ActionList/components/ActionListDivider.d.ts.map +1 -1
  470. package/lib/components/ActionList/components/ActionListDropdown.d.ts +4 -1
  471. package/lib/components/ActionList/components/ActionListDropdown.d.ts.map +1 -1
  472. package/lib/components/ActionList/components/ActionListGroup.d.ts +7 -5
  473. package/lib/components/ActionList/components/ActionListGroup.d.ts.map +1 -1
  474. package/lib/components/ActionList/components/ActionListItem.d.ts +32 -7
  475. package/lib/components/ActionList/components/ActionListItem.d.ts.map +1 -1
  476. package/lib/components/ActionList/components/ActionListSearch.d.ts +21 -0
  477. package/lib/components/ActionList/components/ActionListSearch.d.ts.map +1 -0
  478. package/lib/components/ActionList/components/ActionListSubmenu.d.ts +22 -0
  479. package/lib/components/ActionList/components/ActionListSubmenu.d.ts.map +1 -0
  480. package/lib/components/ActionList/components/ActionListSwitchItem.d.ts +17 -0
  481. package/lib/components/ActionList/components/ActionListSwitchItem.d.ts.map +1 -0
  482. package/lib/components/ActionList/components/ActionListTrigger.d.ts +4 -6
  483. package/lib/components/ActionList/components/ActionListTrigger.d.ts.map +1 -1
  484. package/lib/components/Alert/Alert.d.ts +25 -11
  485. package/lib/components/Alert/Alert.d.ts.map +1 -1
  486. package/lib/components/AppFrame/AppFrame.d.ts +48 -0
  487. package/lib/components/AppFrame/AppFrame.d.ts.map +1 -0
  488. package/lib/components/AppFrame/index.d.ts +3 -0
  489. package/lib/components/AppFrame/index.d.ts.map +1 -0
  490. package/lib/components/Avatar/Avatar.d.ts +20 -8
  491. package/lib/components/Avatar/Avatar.d.ts.map +1 -1
  492. package/lib/components/BlockCard/BlockCard.d.ts +77 -11
  493. package/lib/components/BlockCard/BlockCard.d.ts.map +1 -1
  494. package/lib/components/BlockCard/index.d.ts +1 -1
  495. package/lib/components/BlockCard/index.d.ts.map +1 -1
  496. package/lib/components/Button/Button.d.ts +45 -26
  497. package/lib/components/Button/Button.d.ts.map +1 -1
  498. package/lib/components/ButtonIcon/ButtonIcon.d.ts +18 -17
  499. package/lib/components/ButtonIcon/ButtonIcon.d.ts.map +1 -1
  500. package/lib/components/Chart/Chart.d.ts +142 -0
  501. package/lib/components/Chart/Chart.d.ts.map +1 -0
  502. package/lib/components/Chart/index.d.ts +3 -0
  503. package/lib/components/Chart/index.d.ts.map +1 -0
  504. package/lib/components/Checkbox/Checkbox.d.ts +25 -33
  505. package/lib/components/Checkbox/Checkbox.d.ts.map +1 -1
  506. package/lib/components/Checkbox/CheckboxGroup/CheckboxGroup.context.d.ts +2 -0
  507. package/lib/components/Checkbox/CheckboxGroup/CheckboxGroup.context.d.ts.map +1 -1
  508. package/lib/components/Checkbox/CheckboxGroup/CheckboxGroup.d.ts +23 -5
  509. package/lib/components/Checkbox/CheckboxGroup/CheckboxGroup.d.ts.map +1 -1
  510. package/lib/components/Checkbox/ChoiceText.d.ts +17 -0
  511. package/lib/components/Checkbox/ChoiceText.d.ts.map +1 -0
  512. package/lib/components/Checkbox/index.d.ts +0 -1
  513. package/lib/components/Checkbox/index.d.ts.map +1 -1
  514. package/lib/components/ColorField/ColorField.d.ts +15 -13
  515. package/lib/components/ColorField/ColorField.d.ts.map +1 -1
  516. package/lib/components/ColorField/index.d.ts +1 -1
  517. package/lib/components/ColorField/index.d.ts.map +1 -1
  518. package/lib/components/DatePicker/DatePicker.d.ts +13 -5
  519. package/lib/components/DatePicker/DatePicker.d.ts.map +1 -1
  520. package/lib/components/DatePicker/components/Calendar/Calendar.d.ts +24 -3
  521. package/lib/components/DatePicker/components/Calendar/Calendar.d.ts.map +1 -1
  522. package/lib/components/DatePicker/components/Day/Day.d.ts +11 -10
  523. package/lib/components/DatePicker/components/Day/Day.d.ts.map +1 -1
  524. package/lib/components/DatePicker/components/Month/Month.d.ts +21 -17
  525. package/lib/components/DatePicker/components/Month/Month.d.ts.map +1 -1
  526. package/lib/components/DatePicker/components/MonthGrid/MonthGrid.d.ts +32 -0
  527. package/lib/components/DatePicker/components/MonthGrid/MonthGrid.d.ts.map +1 -0
  528. package/lib/components/DatePicker/components/MonthGrid/index.d.ts +3 -0
  529. package/lib/components/DatePicker/components/MonthGrid/index.d.ts.map +1 -0
  530. package/lib/components/DatePicker/components/Weekday/Weekday.d.ts +4 -3
  531. package/lib/components/DatePicker/components/Weekday/Weekday.d.ts.map +1 -1
  532. package/lib/components/DatePicker/components/index.d.ts +1 -0
  533. package/lib/components/DatePicker/components/index.d.ts.map +1 -1
  534. package/lib/components/DatePicker/utils/index.d.ts +339 -17
  535. package/lib/components/DatePicker/utils/index.d.ts.map +1 -1
  536. package/lib/components/DatePicker/utils/types.d.ts +4 -2
  537. package/lib/components/DatePicker/utils/types.d.ts.map +1 -1
  538. package/lib/components/DescriptiveList/DescriptiveList.d.ts +10 -11
  539. package/lib/components/DescriptiveList/DescriptiveList.d.ts.map +1 -1
  540. package/lib/components/DescriptiveList/DescriptiveListItem.d.ts +10 -4
  541. package/lib/components/DescriptiveList/DescriptiveListItem.d.ts.map +1 -1
  542. package/lib/components/DropdownCard/DropdownCard.context.d.ts +5 -2
  543. package/lib/components/DropdownCard/DropdownCard.context.d.ts.map +1 -1
  544. package/lib/components/DropdownCard/DropdownCard.d.ts +15 -13
  545. package/lib/components/DropdownCard/DropdownCard.d.ts.map +1 -1
  546. package/lib/components/DropdownCard/components/DropdownCardActions.d.ts +4 -3
  547. package/lib/components/DropdownCard/components/DropdownCardActions.d.ts.map +1 -1
  548. package/lib/components/DropdownCard/components/DropdownCardContent.d.ts +4 -3
  549. package/lib/components/DropdownCard/components/DropdownCardContent.d.ts.map +1 -1
  550. package/lib/components/DropdownCard/components/DropdownCardDropdown.d.ts +12 -3
  551. package/lib/components/DropdownCard/components/DropdownCardDropdown.d.ts.map +1 -1
  552. package/lib/components/DropdownCard/components/DropdownCardTabs.d.ts +44 -0
  553. package/lib/components/DropdownCard/components/DropdownCardTabs.d.ts.map +1 -0
  554. package/lib/components/DropdownCard/components/DropdownCardTrigger.d.ts +4 -6
  555. package/lib/components/DropdownCard/components/DropdownCardTrigger.d.ts.map +1 -1
  556. package/lib/components/DropdownCard/components/index.d.ts +1 -0
  557. package/lib/components/DropdownCard/components/index.d.ts.map +1 -1
  558. package/lib/components/Field/Field.d.ts +47 -0
  559. package/lib/components/Field/Field.d.ts.map +1 -0
  560. package/lib/components/Field/index.d.ts +3 -0
  561. package/lib/components/Field/index.d.ts.map +1 -0
  562. package/lib/components/FileField/FileField.d.ts +20 -11
  563. package/lib/components/FileField/FileField.d.ts.map +1 -1
  564. package/lib/components/FileField/index.d.ts +1 -1
  565. package/lib/components/FileField/index.d.ts.map +1 -1
  566. package/lib/components/FormActions/FormActions.d.ts +9 -0
  567. package/lib/components/FormActions/FormActions.d.ts.map +1 -0
  568. package/lib/components/FormActions/index.d.ts +3 -0
  569. package/lib/components/FormActions/index.d.ts.map +1 -0
  570. package/lib/components/HyperlinkCard/HyperlinkCard.d.ts +11 -8
  571. package/lib/components/HyperlinkCard/HyperlinkCard.d.ts.map +1 -1
  572. package/lib/components/Icon/Icon.d.ts +14 -13
  573. package/lib/components/Icon/Icon.d.ts.map +1 -1
  574. package/lib/components/IconBadge/IconBadge.d.ts +24 -0
  575. package/lib/components/IconBadge/IconBadge.d.ts.map +1 -0
  576. package/lib/components/IconBadge/index.d.ts +3 -0
  577. package/lib/components/IconBadge/index.d.ts.map +1 -0
  578. package/lib/components/Loader/Loader.d.ts +17 -6
  579. package/lib/components/Loader/Loader.d.ts.map +1 -1
  580. package/lib/components/Loader/index.d.ts +1 -1
  581. package/lib/components/Loader/index.d.ts.map +1 -1
  582. package/lib/components/Modal/Modal.d.ts +4 -6
  583. package/lib/components/Modal/Modal.d.ts.map +1 -1
  584. package/lib/components/Modal/ModalProvider/ModalProviderFooter.d.ts.map +1 -1
  585. package/lib/components/Modal/ModalProvider/index.d.ts.map +1 -1
  586. package/lib/components/Modal/index.d.ts +1 -1
  587. package/lib/components/Modal/index.d.ts.map +1 -1
  588. package/lib/components/Modal/types/index.d.ts +36 -15
  589. package/lib/components/Modal/types/index.d.ts.map +1 -1
  590. package/lib/components/Modal/utils/index.d.ts +0 -1
  591. package/lib/components/Modal/utils/index.d.ts.map +1 -1
  592. package/lib/components/Modal/utils/reducer.d.ts +286 -6
  593. package/lib/components/Modal/utils/reducer.d.ts.map +1 -1
  594. package/lib/components/Modal/utils/useModal.d.ts +3 -2
  595. package/lib/components/Modal/utils/useModal.d.ts.map +1 -1
  596. package/lib/components/Page/Breadcrumbs.d.ts +20 -0
  597. package/lib/components/Page/Breadcrumbs.d.ts.map +1 -0
  598. package/lib/components/Page/Page.d.ts +61 -27
  599. package/lib/components/Page/Page.d.ts.map +1 -1
  600. package/lib/components/Page/index.d.ts +3 -1
  601. package/lib/components/Page/index.d.ts.map +1 -1
  602. package/lib/components/Pagination/Pagination.d.ts +22 -20
  603. package/lib/components/Pagination/Pagination.d.ts.map +1 -1
  604. package/lib/components/Pagination/index.d.ts +1 -1
  605. package/lib/components/Pagination/index.d.ts.map +1 -1
  606. package/lib/components/Progress/Progress.d.ts +29 -6
  607. package/lib/components/Progress/Progress.d.ts.map +1 -1
  608. package/lib/components/Progress/index.d.ts +1 -1
  609. package/lib/components/Progress/index.d.ts.map +1 -1
  610. package/lib/components/Radio/Radio.d.ts +19 -33
  611. package/lib/components/Radio/Radio.d.ts.map +1 -1
  612. package/lib/components/Radio/RadioGroup/RadioGroup.context.d.ts +2 -0
  613. package/lib/components/Radio/RadioGroup/RadioGroup.context.d.ts.map +1 -1
  614. package/lib/components/Radio/RadioGroup/RadioGroup.d.ts +22 -18
  615. package/lib/components/Radio/RadioGroup/RadioGroup.d.ts.map +1 -1
  616. package/lib/components/RangeField/RangeField.d.ts +8 -15
  617. package/lib/components/RangeField/RangeField.d.ts.map +1 -1
  618. package/lib/components/Select/Select.d.ts +45 -43
  619. package/lib/components/Select/Select.d.ts.map +1 -1
  620. package/lib/components/Sidebar/Sidebar.d.ts +48 -25
  621. package/lib/components/Sidebar/Sidebar.d.ts.map +1 -1
  622. package/lib/components/Sidebar/components/Back.d.ts +14 -0
  623. package/lib/components/Sidebar/components/Back.d.ts.map +1 -0
  624. package/lib/components/Sidebar/components/Menu.d.ts +9 -14
  625. package/lib/components/Sidebar/components/Menu.d.ts.map +1 -1
  626. package/lib/components/Sidebar/components/MenuItem.d.ts +18 -15
  627. package/lib/components/Sidebar/components/MenuItem.d.ts.map +1 -1
  628. package/lib/components/Sidebar/components/Section.d.ts +6 -6
  629. package/lib/components/Sidebar/components/Section.d.ts.map +1 -1
  630. package/lib/components/Sidebar/components/SubMenu.d.ts +6 -8
  631. package/lib/components/Sidebar/components/SubMenu.d.ts.map +1 -1
  632. package/lib/components/Sidebar/index.d.ts +1 -1
  633. package/lib/components/Sidebar/index.d.ts.map +1 -1
  634. package/lib/components/Spinner/Spinner.d.ts +12 -5
  635. package/lib/components/Spinner/Spinner.d.ts.map +1 -1
  636. package/lib/components/Spinner/index.d.ts +1 -1
  637. package/lib/components/Spinner/index.d.ts.map +1 -1
  638. package/lib/components/StatCard/StatCard.d.ts +31 -11
  639. package/lib/components/StatCard/StatCard.d.ts.map +1 -1
  640. package/lib/components/StatCard/index.d.ts +1 -1
  641. package/lib/components/StatCard/index.d.ts.map +1 -1
  642. package/lib/components/Switch/Switch.d.ts +14 -15
  643. package/lib/components/Switch/Switch.d.ts.map +1 -1
  644. package/lib/components/Table/Table.d.ts +54 -25
  645. package/lib/components/Table/Table.d.ts.map +1 -1
  646. package/lib/components/Table/Table.types.d.ts +1 -1
  647. package/lib/components/Table/Table.types.d.ts.map +1 -1
  648. package/lib/components/Table/components/Checkbox/index.d.ts +7 -3
  649. package/lib/components/Table/components/Checkbox/index.d.ts.map +1 -1
  650. package/lib/components/Table/components/TableBody.d.ts +2 -2
  651. package/lib/components/Table/components/TableBody.d.ts.map +1 -1
  652. package/lib/components/Table/components/TableCell.d.ts +7 -3
  653. package/lib/components/Table/components/TableCell.d.ts.map +1 -1
  654. package/lib/components/Table/components/TableGroup.d.ts +16 -0
  655. package/lib/components/Table/components/TableGroup.d.ts.map +1 -0
  656. package/lib/components/Table/components/TableHead.d.ts +8 -2
  657. package/lib/components/Table/components/TableHead.d.ts.map +1 -1
  658. package/lib/components/Table/components/TableHeadCell.d.ts +24 -5
  659. package/lib/components/Table/components/TableHeadCell.d.ts.map +1 -1
  660. package/lib/components/Table/components/TablePagination.d.ts +3 -1
  661. package/lib/components/Table/components/TablePagination.d.ts.map +1 -1
  662. package/lib/components/Table/components/TableProvider/TableProvider.d.ts +1 -2
  663. package/lib/components/Table/components/TableProvider/TableProvider.d.ts.map +1 -1
  664. package/lib/components/Table/components/TableRow.d.ts +8 -2
  665. package/lib/components/Table/components/TableRow.d.ts.map +1 -1
  666. package/lib/components/Table/index.d.ts +3 -3
  667. package/lib/components/Table/index.d.ts.map +1 -1
  668. package/lib/components/Table/labels.d.ts +23 -0
  669. package/lib/components/Table/labels.d.ts.map +1 -0
  670. package/lib/components/Table/utils/table/types.d.ts +6 -11
  671. package/lib/components/Table/utils/table/types.d.ts.map +1 -1
  672. package/lib/components/Table/utils/useSelectableResourceState/index.d.ts +1 -2
  673. package/lib/components/Table/utils/useSelectableResourceState/index.d.ts.map +1 -1
  674. package/lib/components/Tag/Tag.d.ts +42 -15
  675. package/lib/components/Tag/Tag.d.ts.map +1 -1
  676. package/lib/components/Tag/TagGroup.d.ts +3 -3
  677. package/lib/components/Tag/TagGroup.d.ts.map +1 -1
  678. package/lib/components/Tag/index.d.ts +1 -1
  679. package/lib/components/Tag/index.d.ts.map +1 -1
  680. package/lib/components/TextField/TextField.d.ts +11 -27
  681. package/lib/components/TextField/TextField.d.ts.map +1 -1
  682. package/lib/components/Textarea/Textarea.d.ts +10 -26
  683. package/lib/components/Textarea/Textarea.d.ts.map +1 -1
  684. package/lib/components/Thumbnail/Thumbnail.d.ts +11 -7
  685. package/lib/components/Thumbnail/Thumbnail.d.ts.map +1 -1
  686. package/lib/components/Timeline/Timeline.d.ts +26 -0
  687. package/lib/components/Timeline/Timeline.d.ts.map +1 -0
  688. package/lib/components/Timeline/TimelineGroup.d.ts +15 -0
  689. package/lib/components/Timeline/TimelineGroup.d.ts.map +1 -0
  690. package/lib/components/Timeline/TimelineItem.d.ts +19 -0
  691. package/lib/components/Timeline/TimelineItem.d.ts.map +1 -0
  692. package/lib/components/Timeline/index.d.ts +5 -0
  693. package/lib/components/Timeline/index.d.ts.map +1 -0
  694. package/lib/components/Toast/Toast.d.ts +20 -10
  695. package/lib/components/Toast/Toast.d.ts.map +1 -1
  696. package/lib/components/Toast/Toasts.context.d.ts +15 -2
  697. package/lib/components/Toast/Toasts.context.d.ts.map +1 -1
  698. package/lib/components/Toast/ToastsContainer/index.d.ts.map +1 -1
  699. package/lib/components/Toast/ToastsProvider/index.d.ts +1 -3
  700. package/lib/components/Toast/ToastsProvider/index.d.ts.map +1 -1
  701. package/lib/components/Toast/index.d.ts +3 -5
  702. package/lib/components/Toast/index.d.ts.map +1 -1
  703. package/lib/components/Toast/store.d.ts +30 -0
  704. package/lib/components/Toast/store.d.ts.map +1 -0
  705. package/lib/components/Toast/types.d.ts +8 -5
  706. package/lib/components/Toast/types.d.ts.map +1 -1
  707. package/lib/components/Tooltip/Tooltip.d.ts +29 -23
  708. package/lib/components/Tooltip/Tooltip.d.ts.map +1 -1
  709. package/lib/components/Tooltip/TooltipCallout.d.ts +31 -0
  710. package/lib/components/Tooltip/TooltipCallout.d.ts.map +1 -0
  711. package/lib/components/Tooltip/useTooltip.d.ts +16 -27
  712. package/lib/components/Tooltip/useTooltip.d.ts.map +1 -1
  713. package/lib/components/Visualizer/Visualizer.d.ts +19 -8
  714. package/lib/components/Visualizer/Visualizer.d.ts.map +1 -1
  715. package/lib/components/Visualizer/index.d.ts +1 -1
  716. package/lib/components/Visualizer/index.d.ts.map +1 -1
  717. package/lib/index.d.ts +134 -1
  718. package/lib/index.d.ts.map +1 -1
  719. package/lib/showcase/chartData.d.ts +29 -0
  720. package/lib/showcase/chartData.d.ts.map +1 -0
  721. package/lib/tokens/tokens.d.ts +1528 -0
  722. package/lib/tokens/tokens.d.ts.map +1 -0
  723. package/lib/types.d.ts +4 -29
  724. package/lib/types.d.ts.map +1 -1
  725. package/lib/utils/Slot/index.d.ts +11 -0
  726. package/lib/utils/Slot/index.d.ts.map +1 -0
  727. package/lib/utils/classNames/index.d.ts +3 -1
  728. package/lib/utils/classNames/index.d.ts.map +1 -1
  729. package/lib/utils/getElementRef/index.d.ts +9 -0
  730. package/lib/utils/getElementRef/index.d.ts.map +1 -0
  731. package/lib/utils/index.d.ts +4 -7
  732. package/lib/utils/index.d.ts.map +1 -1
  733. package/lib/utils/toPercent/index.d.ts +3 -0
  734. package/lib/utils/toPercent/index.d.ts.map +1 -0
  735. package/lib/utils/useControllableState/index.d.ts +19 -0
  736. package/lib/utils/useControllableState/index.d.ts.map +1 -0
  737. package/lib/utils/useDropdown/DropdownTrigger.d.ts +12 -0
  738. package/lib/utils/useDropdown/DropdownTrigger.d.ts.map +1 -0
  739. package/lib/utils/useDropdown/index.d.ts +30 -6
  740. package/lib/utils/useDropdown/index.d.ts.map +1 -1
  741. package/lib/utils/useImageFallback/index.d.ts +15 -0
  742. package/lib/utils/useImageFallback/index.d.ts.map +1 -0
  743. package/package.json +23 -11
  744. package/roaster.css +1 -0
  745. package/roaster.css.d.ts +2 -0
  746. package/themes/azoth.css +1 -0
  747. package/themes/azoth.css.d.ts +2 -0
  748. package/themes/coffee.css +1 -0
  749. package/themes/coffee.css.d.ts +2 -0
  750. package/themes/scalar.css +1 -0
  751. package/themes/scalar.css.d.ts +2 -0
  752. package/cjs/components/ActionList/useDropdown.js +0 -47
  753. package/cjs/components/ActionList/useDropdown.js.map +0 -1
  754. package/cjs/components/Modal/utils/events.js +0 -19
  755. package/cjs/components/Modal/utils/events.js.map +0 -1
  756. package/cjs/components/Toast/ToastsProvider/useToastsState/useToastsState.js +0 -55
  757. package/cjs/components/Toast/ToastsProvider/useToastsState/useToastsState.js.map +0 -1
  758. package/cjs/components/Toast/events.js +0 -20
  759. package/cjs/components/Toast/events.js.map +0 -1
  760. package/cjs/components/Visualizer/Visualizer.context.js +0 -12
  761. package/cjs/components/Visualizer/Visualizer.context.js.map +0 -1
  762. package/cjs/components/Visualizer/VisualizerMobileOpener.js +0 -28
  763. package/cjs/components/Visualizer/VisualizerMobileOpener.js.map +0 -1
  764. package/cjs/utils/createUseExternalEvents/index.js +0 -32
  765. package/cjs/utils/createUseExternalEvents/index.js.map +0 -1
  766. package/cjs/utils/useIsomorphicEffect/index.js +0 -22
  767. package/cjs/utils/useIsomorphicEffect/index.js.map +0 -1
  768. package/cjs/utils/useQueue/index.js +0 -36
  769. package/cjs/utils/useQueue/index.js.map +0 -1
  770. package/cjs/utils/useUncontrolled/index.js +0 -25
  771. package/cjs/utils/useUncontrolled/index.js.map +0 -1
  772. package/esm/components/ActionList/useDropdown.js +0 -45
  773. package/esm/components/ActionList/useDropdown.js.map +0 -1
  774. package/esm/components/Modal/utils/events.js +0 -13
  775. package/esm/components/Modal/utils/events.js.map +0 -1
  776. package/esm/components/Toast/ToastsProvider/useToastsState/useToastsState.js +0 -51
  777. package/esm/components/Toast/ToastsProvider/useToastsState/useToastsState.js.map +0 -1
  778. package/esm/components/Toast/events.js +0 -12
  779. package/esm/components/Toast/events.js.map +0 -1
  780. package/esm/components/Visualizer/Visualizer.context.js +0 -9
  781. package/esm/components/Visualizer/Visualizer.context.js.map +0 -1
  782. package/esm/components/Visualizer/VisualizerMobileOpener.js +0 -13
  783. package/esm/components/Visualizer/VisualizerMobileOpener.js.map +0 -1
  784. package/esm/utils/createUseExternalEvents/index.js +0 -30
  785. package/esm/utils/createUseExternalEvents/index.js.map +0 -1
  786. package/esm/utils/useIsomorphicEffect/index.js +0 -7
  787. package/esm/utils/useIsomorphicEffect/index.js.map +0 -1
  788. package/esm/utils/useQueue/index.js +0 -34
  789. package/esm/utils/useQueue/index.js.map +0 -1
  790. package/esm/utils/useUncontrolled/index.js +0 -23
  791. package/esm/utils/useUncontrolled/index.js.map +0 -1
  792. package/lib/components/ActionList/useDropdown.d.ts +0 -57
  793. package/lib/components/ActionList/useDropdown.d.ts.map +0 -1
  794. package/lib/components/CodeBlock/CodeBlock.d.ts +0 -16
  795. package/lib/components/CodeBlock/CodeBlock.d.ts.map +0 -1
  796. package/lib/components/CodeBlock/index.d.ts +0 -2
  797. package/lib/components/CodeBlock/index.d.ts.map +0 -1
  798. package/lib/components/Modal/utils/events.d.ts +0 -9
  799. package/lib/components/Modal/utils/events.d.ts.map +0 -1
  800. package/lib/components/Toast/ToastsProvider/useToastsState/useToastsState.d.ts +0 -13
  801. package/lib/components/Toast/ToastsProvider/useToastsState/useToastsState.d.ts.map +0 -1
  802. package/lib/components/Toast/events.d.ts +0 -37
  803. package/lib/components/Toast/events.d.ts.map +0 -1
  804. package/lib/components/Visualizer/Visualizer.context.d.ts +0 -14
  805. package/lib/components/Visualizer/Visualizer.context.d.ts.map +0 -1
  806. package/lib/components/Visualizer/VisualizerMobileOpener.d.ts +0 -7
  807. package/lib/components/Visualizer/VisualizerMobileOpener.d.ts.map +0 -1
  808. package/lib/components/index.d.ts +0 -36
  809. package/lib/components/index.d.ts.map +0 -1
  810. package/lib/utils/createUseExternalEvents/index.d.ts +0 -14
  811. package/lib/utils/createUseExternalEvents/index.d.ts.map +0 -1
  812. package/lib/utils/useDidUpdate/index.d.ts +0 -30
  813. package/lib/utils/useDidUpdate/index.d.ts.map +0 -1
  814. package/lib/utils/useEventListener/index.d.ts +0 -7
  815. package/lib/utils/useEventListener/index.d.ts.map +0 -1
  816. package/lib/utils/useForceUpdate/index.d.ts +0 -28
  817. package/lib/utils/useForceUpdate/index.d.ts.map +0 -1
  818. package/lib/utils/useIsomorphicEffect/index.d.ts +0 -21
  819. package/lib/utils/useIsomorphicEffect/index.d.ts.map +0 -1
  820. package/lib/utils/useQueue/index.d.ts +0 -65
  821. package/lib/utils/useQueue/index.d.ts.map +0 -1
  822. package/lib/utils/useUncontrolled/index.d.ts +0 -38
  823. package/lib/utils/useUncontrolled/index.d.ts.map +0 -1
  824. package/theme.css +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"FileField.js","sources":["../../../../src/components/FileField/FileField.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, useUid } from '@/utils';\n\n/** Every native `<input>` prop (`multiple`, `aria-*`, `data-*`, ...) is accepted and forwarded to the file input. */\nexport interface FileFieldProps extends Omit<\n React.ComponentPropsWithoutRef<'input'>,\n 'onChange' | 'type' | 'size' | 'defaultValue' | 'value'\n> {\n /** The HTML ID attribute to be applied to the file upload field input element (optional). */\n id?: string;\n /** The name attribute to be applied to the file upload field input element (optional). */\n name?: string;\n /**\n * The accept attribute to be applied to the file upload field input element (optional).\n * Specifies the types of accepted files.\n */\n accept?: string;\n /**\n * The size of the file upload field (optional).\n * - 'small': render a smaller file upload field\n * - 'medium': render a larger file upload field\n */\n size?: 'small' | 'medium';\n /** Whether the file upload field should be disabled (optional). */\n disabled?: boolean;\n /** The default value of the file upload field input (used to display a preview image when type is image). */\n defaultValue?: string | null;\n /**\n * A function to be called when the value of the file upload field changes (optional).\n * The function receives the new file value of the input as a `File` object, or `null` if no file is selected.\n */\n onChange?(value: File | null): void;\n /** The label to be displayed above the file upload field (optional). */\n label?: React.ReactNode;\n /**\n * The type of file to be uploaded (optional).\n * - 'image': upload an image file\n * - 'file': upload any file type\n */\n type?: 'image' | 'file';\n /** Help text to be displayed below the file upload field (optional). */\n helpText?: React.ReactNode;\n /** CSS class names to be applied to the file upload field input element (optional). */\n inputClassName?: string;\n}\n\nfunction EmptyMarkupPlaceholder({ type, defaultValue }: { type: 'image' | 'file'; defaultValue?: string | null }) {\n if (type === 'file')\n return (\n <>\n <i className=\"fa-regular fa-file-csv\" />\n <span className=\"filename\">No file added</span>\n </>\n );\n\n if (defaultValue) {\n return <img src={defaultValue} alt=\"\" />;\n }\n\n return (\n <div className=\"image-placeholder\">\n <i className=\"fa-regular fa-image\" />\n </div>\n );\n}\n\nfunction Preview({ type, file }: { type: string; file: File }) {\n const [imageUrl, setImageUrl] = React.useState<string>();\n\n // One object URL per file, released when the file changes or the preview goes away, so it doesn't leak memory.\n React.useEffect(() => {\n if (type !== 'image' || !file) return undefined;\n const url = URL.createObjectURL(file);\n setImageUrl(url);\n return () => URL.revokeObjectURL(url);\n }, [type, file]);\n\n if (type === 'image' && file) {\n return imageUrl ? <img src={imageUrl} alt={file.name} /> : null;\n }\n\n return <span className=\"filename\">{file?.name}</span>;\n}\n\n/** A file upload field with a preview for images and the file name for other files. */\nexport const FileField = React.forwardRef<HTMLInputElement, FileFieldProps>((props, ref) => {\n const {\n id,\n label,\n name,\n disabled,\n helpText,\n inputClassName,\n onChange,\n type = 'image',\n accept = type === 'image' ? 'image/*' : '.csv, .xls',\n size = 'small',\n defaultValue,\n ...others\n } = props;\n const uid = useUid(id);\n const [value, setValue] = React.useState<File | null>(null);\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n setValue(event.currentTarget.files?.[0] || null);\n onChange?.(event.currentTarget.files?.[0] || null);\n };\n\n return (\n <label htmlFor={uid}>\n <p>{label}</p>\n <div className={classNames('file-uploader', size, { uploaded: value })}>\n <div className={classNames({ 'file-preview': type === 'file', 'image-preview': type === 'image' })}>\n {!value && <EmptyMarkupPlaceholder type={type} defaultValue={defaultValue} />}\n {value && <Preview type={type} file={value} />}\n </div>\n <div className=\"file-input\">\n <span>\n <i className=\"fa-regular fa-arrow-up-from-bracket\" /> Upload a file\n </span>\n <input\n {...others}\n id={uid}\n name={name}\n ref={ref}\n type=\"file\"\n disabled={disabled}\n accept={accept}\n onChange={handleChange}\n className={inputClassName}\n />\n </div>\n </div>\n <small>{helpText}</small>\n </label>\n );\n});\n\nFileField.displayName = 'FileField';\n"],"names":[],"mappings":";;;;;AAEA,SAAS,sB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* as React from 'react';\nimport { classNames, useUid } from '@/utils';\nimport { Field, fieldControlProps, type FieldBaseProps } from '../Field';\nimport { Icon } from '@/components/Icon';\n\n/**\n * Every native `<input>` prop (`name`, `required`, `aria-*`, ...) is accepted and forwarded to the file input, with the\n * ref. `className` and `style` go to the field's wrapper.\n */\nexport interface FileFieldProps\n extends\n FieldBaseProps,\n Omit<React.ComponentPropsWithoutRef<'input'>, 'type' | 'size' | 'defaultValue' | 'value' | 'className' | 'style'> {\n /** The HTML ID attribute to be applied to the file upload field input element (optional). */\n id?: string;\n /** The name attribute to be applied to the file upload field input element (optional). */\n name?: string;\n /**\n * The accept attribute to be applied to the file upload field input element (optional).\n * Specifies the types of accepted files.\n */\n accept?: string;\n /**\n * The size of the file upload field (optional).\n * - 'small': render a smaller file upload field\n * - 'medium': render a larger file upload field\n */\n size?: 'small' | 'medium';\n /** Whether the file upload field should be disabled (optional). */\n disabled?: boolean;\n /** The default value of the file upload field input (used to display a preview image when type is image). */\n defaultValue?: string | null;\n /**\n * Called with the chosen files when the user picks some: one, or several with `multiple`. The native `onChange`\n * gets the event.\n */\n onValueChange?(files: File[]): void;\n /**\n * The type of file to be uploaded (optional).\n * - 'image': upload an image file\n * - 'file': upload any file type\n */\n type?: 'image' | 'file';\n /** The text of the field, in English by default. */\n labels?: Partial<FileFieldLabels>;\n /** A line under the upload label, such as the files it takes. */\n hint?: React.ReactNode;\n}\n\n/** The text of the file field, for other languages. */\nexport interface FileFieldLabels {\n /** The upload button. */\n upload: React.ReactNode;\n /** Shown for a file field (`type=\"file\"`) with no file yet. */\n noFile: React.ReactNode;\n}\n\nconst defaultFileFieldLabels: FileFieldLabels = { upload: 'Upload a file', noFile: 'No file added' };\n\nfunction EmptyMarkupPlaceholder({\n type,\n defaultValue,\n noFileLabel,\n}: {\n type: 'image' | 'file';\n defaultValue?: string | null;\n noFileLabel: React.ReactNode;\n}) {\n if (type === 'file')\n return (\n <>\n <Icon name=\"file-csv\" className=\"roaster-file__icon\" />\n <span className=\"roaster-file__name\">{noFileLabel}</span>\n </>\n );\n\n if (defaultValue) {\n return <img src={defaultValue} alt=\"\" />;\n }\n\n return (\n <div className=\"roaster-file__placeholder\">\n <Icon name=\"image\" />\n </div>\n );\n}\n\nfunction Preview({ type, files }: { type: string; files: File[] }) {\n const file = files[0];\n const [imageUrl, setImageUrl] = React.useState<string>();\n\n // One object URL per file, released when the file changes or the preview goes away, so it doesn't leak memory.\n React.useEffect(() => {\n if (type !== 'image' || !file) return undefined;\n const url = URL.createObjectURL(file);\n setImageUrl(url);\n return () => URL.revokeObjectURL(url);\n }, [type, file]);\n\n if (type === 'image' && file) {\n return imageUrl ? <img src={imageUrl} alt={file.name} /> : null;\n }\n\n return (\n <>\n <Icon name=\"file-csv\" className=\"roaster-file__icon\" />\n <span className=\"roaster-file__name\">{files.map((chosen) => chosen.name).join(', ')}</span>\n </>\n );\n}\n\n/** A file upload field with a preview for images and the file name for other files. */\nexport const FileField = React.forwardRef<HTMLInputElement, FileFieldProps>((props, ref) => {\n const {\n id,\n label,\n name,\n disabled,\n description,\n error,\n className,\n style,\n onChange,\n onValueChange,\n type = 'image',\n accept = type === 'image' ? 'image/*' : '.csv, .xls',\n size = 'small',\n defaultValue,\n labels,\n hint,\n ...others\n } = props;\n const text = { ...defaultFileFieldLabels, ...labels };\n const uid = useUid(id);\n // Every chosen file: several with `multiple`.\n const [files, setFiles] = React.useState<File[]>([]);\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const chosen = [...(event.currentTarget.files ?? [])];\n setFiles(chosen);\n onChange?.(event);\n onValueChange?.(chosen);\n };\n\n return (\n <Field controlId={uid} label={label} description={description} error={error} className={className} style={style}>\n <div\n className={classNames('roaster-file', `roaster-file--${size}`)}\n data-state={files.length > 0 ? 'filled' : undefined}\n >\n <div className={type === 'image' ? 'roaster-file__image' : 'roaster-file__preview'}>\n {files.length === 0 ? (\n <EmptyMarkupPlaceholder type={type} defaultValue={defaultValue} noFileLabel={text.noFile} />\n ) : (\n <Preview type={type} files={files} />\n )}\n </div>\n <div className=\"roaster-file__button\">\n <span>\n <Icon name=\"arrow-up-from-bracket\" />\n {text.upload}\n {hint && <small className=\"roaster-file__hint\">{hint}</small>}\n </span>\n <input\n {...others}\n {...fieldControlProps(uid, { label, description, error }, others)}\n name={name}\n ref={ref}\n className=\"roaster-file__input\"\n type=\"file\"\n disabled={disabled}\n accept={accept}\n onChange={handleChange}\n />\n </div>\n </div>\n </Field>\n );\n});\n\nFileField.displayName = 'FileField';\n"],"names":[],"mappings":";;;;;;;;AAMA,MAAM,sBAAsB,GAAG,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,eAAe,EAAE;AACnF,SAAS,sBAAsB,CAAC;AAChC,EAAE,IAAI;AACN,EAAE,YAAY;AACd,EAAE;AACF,CAAC,EAAE;AACH,EAAE,IAAI,IAAI,KAAK,MAAM;AACrB,IAAI,uBAAuB,IAAI,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE;AACtD,sBAAsB,GAAG,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,oBAAoB,EAAE,CAAC;AACtF,sBAAsB,GAAG,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,oBAAoB,EAAE,QAAQ,EAAE,WAAW,EAAE;AAC5F,KAAK,EAAE,CAAC;AACR,EAAE,IAAI,YAAY,EAAE;AACpB,IAAI,uBAAuB,GAAG,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,YAAY,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;AACrE,EAAE;AACF,EAAE,uBAAuB,GAAG,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,2BAA2B,EAAE,QAAQ,kBAAkB,GAAG,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;AACvI;AACA,SAAS,OAAO,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;AAClC,EAAE,MAAM,I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KAAK,OAAO,GAAG,qBAAqB,GAAG,uBAAuB,EAAE,QAAQ,EAAE,KAAK,CAAC,MAAM,KAAK,CAAC,mBAAmB,GAAG,CAAC,sBAAsB,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,mBAAmB,GAAG,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;AACnS,wBAAwB,IAAI,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,sBAAsB,EAAE,QAAQ,EAAE;AACnF,0BAA0B,IAAI,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE;AACnD,4BAA4B,GAAG,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,uBAAuB,EAAE,CAAC;AACxE,YAAY,IAAI,CAAC,MAAM;AACvB,YAAY,IAAI,oBAAoB,GAAG,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,oBAAoB,EAAE,QAAQ,EAAE,IAAI,EAAE;AACpG,WAAW,EAAE,CAAC;AACd,0BAA0B,GAAG;AAC7B,YAAY,OAAO;AACnB,YAAY;AACZ,cAAc,GAAG,MAAM;AACvB,cAAc,GAAG,iBAAiB,CAAC,GAAG,EAAE,EAAS,WAAW,EAAE,KAAK,EAAE,EAAE,MAAM,CAAC;AAC9E,cAAc,IAAI;AAClB,cAAc,GAAG;AACjB,cAAc,SAAS,EAAE,qBAAqB;AAC9C,cAAc,IAAI,EAAE,MAAM;AAC1B,cAAc,QAAQ;AACtB,cAAc,MAAM;AACpB,cAAc,QAAQ,EAAE;AACxB;AACA;AACA,SAAS,EAAE;AACX;AACA;AACA,GAAG,EAAE,CAAC;AACN,CAAC;AACD,SAAS,CAAC,WAAW,GAAG,WAAW;;"}
@@ -0,0 +1,12 @@
1
+ 'use client';
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import * as React from 'react';
4
+ import { classNames } from '../../utils/classNames/index.js';
5
+
6
+ const FormActions = React.forwardRef(
7
+ ({ className, children, ...others }, ref) => /* @__PURE__ */ jsx("div", { ...others, ref, className: classNames("roaster-form-actions", className), children })
8
+ );
9
+ FormActions.displayName = "FormActions";
10
+
11
+ export { FormActions };
12
+ //# sourceMappingURL=FormActions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormActions.js","sources":["../../../../src/components/FormActions/FormActions.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames } from '@/utils';\n\n/** Every native `<div>` prop (`id`, `aria-*`, `data-*`, ...) is accepted and forwarded to it. */\nexport interface FormActionsProps extends React.ComponentPropsWithoutRef<'div'> {\n /** The form's buttons, the main one last: it is on the right, and on top on small screens. */\n children: React.ReactNode;\n}\n\n/** The row of a form's buttons, such as Cancel and Save, at its foot. */\nexport const FormActions = React.forwardRef<HTMLDivElement, FormActionsProps>(\n ({ className, children, ...others }, ref) => (\n <div {...others} ref={ref} className={classNames('roaster-form-actions', className)}>\n {children}\n </div>\n )\n);\n\nFormActions.displayName = 'FormActions';\n"],"names":[],"mappings":";;;;;AAIY,MAAC,WAAW,GAAG,KAAK,CAAC,UAAU;AAC3C,EAAE,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,qBAAqB,GAAG,CAAC,KAAK,EAAE,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,UAAU,CAAC,sBAAsB,EAAE,SAAS,CAAC,EAAE,QAAQ,EAAE;AAChK;AACA,WAAW,CAAC,WAAW,GAAG,aAAa;;"}
@@ -1,13 +1,16 @@
1
1
  'use client';
2
- import React__default from 'react';
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import * as React from 'react';
3
4
  import { classNames } from '../../utils/classNames/index.js';
5
+ import { Slot } from '../../utils/Slot/index.js';
4
6
 
5
- const HyperlinkCardImpl = React__default.forwardRef((({ component, children, className, ...restProps }, ref) => {
6
- const Component = component ?? "a";
7
- return /* @__PURE__ */ React__default.createElement(Component, { className: classNames("card-hyperlink", className), ...restProps, ref }, children);
8
- }));
9
- HyperlinkCardImpl.displayName = "HyperlinkCard";
10
- const HyperlinkCard = HyperlinkCardImpl;
7
+ const HyperlinkCard = React.forwardRef(
8
+ ({ asChild, className, children, ...others }, ref) => {
9
+ const props = { ...others, className: classNames("roaster-card-link", className) };
10
+ return asChild ? /* @__PURE__ */ jsx(Slot, { ...props, ref, children }) : /* @__PURE__ */ jsx("a", { ...props, ref, children });
11
+ }
12
+ );
13
+ HyperlinkCard.displayName = "HyperlinkCard";
11
14
 
12
15
  export { HyperlinkCard };
13
16
  //# sourceMappingURL=HyperlinkCard.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"HyperlinkCard.js","sources":["../../../../src/components/HyperlinkCard/HyperlinkCard.tsx"],"sourcesContent":["import React from 'react';\nimport { PolymorphicComponentPropWithRef, PolymorphicRef } from '@/types';\nimport { classNames } from '@/utils';\n\nexport type HyperlinkCardProps<C extends React.ElementType> = PolymorphicComponentPropWithRef<\n C,\n {\n /** HyperlinkCard content */\n children?: React.ReactNode;\n }\n>;\n\ntype HyperlinkCardComponent = <C extends React.ElementType = 'a'>(\n props: HyperlinkCardProps<C>\n) => React.ReactElement | null;\n\nconst HyperlinkCardImpl = React.forwardRef(((\n { component, children, className, ...restProps }: HyperlinkCardProps<React.ElementType>,\n ref?: PolymorphicRef<React.ElementType>\n) => {\n const Component = component ?? 'a';\n\n return (\n <Component className={classNames('card-hyperlink', className)} {...restProps} ref={ref}>\n {children}\n </Component>\n );\n}) as React.ForwardRefRenderFunction<unknown, HyperlinkCardProps<React.ElementType>>);\n\nHyperlinkCardImpl.displayName = 'HyperlinkCard';\n\n/** Turns a card, such as an ActionCard, into a link. */\nexport const HyperlinkCard = HyperlinkCardImpl as unknown as HyperlinkCardComponent;\n"],"names":["React"],"mappings":";;;;AAEA,MAAM,iBAAiB,GAAGA,cAAK,CAAC,UAAU,EAAE,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE,EAAE,GAAG,KAAK;AACvG,EAAE,MAAM,SAAS,GAAG,SAAS,IAAI,GAAG;AACpC,EAAE,uBAAuBA,cAAK,CAAC,aAAa,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,UAAU,CAAC,gBAAgB,EAAE,SAAS,CAAC,EAAE,GAAG,SAAS,EAAE,GAAG,EAAE,EAAE,QAAQ,CAAC;AAC5I,CAAC,EAAE;AACH,iBAAiB,CAAC,WAAW,GAAG,eAAe;AACnC,MAAC,aAAa,GAAG;;"}
1
+ {"version":3,"file":"HyperlinkCard.js","sources":["../../../../src/components/HyperlinkCard/HyperlinkCard.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, Slot } from '@/utils';\n\n/** Every native `<a>` prop (`href`, `target`, `aria-*`, ...) is accepted and forwarded to the link. */\nexport interface HyperlinkCardProps extends React.ComponentPropsWithoutRef<'a'> {\n /** The card to turn into a link, such as an ActionCard. */\n children?: React.ReactNode;\n /**\n * Render the link your child element is, such as a router's `<Link>`, instead of an `<a>`: the card's class and\n * props are merged into it.\n */\n asChild?: boolean;\n}\n\n/** Turns a card, such as an ActionCard, into a link. */\nexport const HyperlinkCard = React.forwardRef<HTMLAnchorElement, HyperlinkCardProps>(\n ({ asChild, className, children, ...others }, ref) => {\n const props = { ...others, className: classNames('roaster-card-link', className) };\n return asChild ? (\n <Slot {...props} ref={ref as React.Ref<HTMLElement>}>\n {children}\n </Slot>\n ) : (\n <a {...props} ref={ref}>\n {children}\n </a>\n );\n }\n);\n\nHyperlinkCard.displayName = 'HyperlinkCard';\n"],"names":[],"mappings":";;;;;;AAIY,MAAC,aAAa,GAAG,KAAK,CAAC,UAAU;AAC7C,EAAE,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,KAAK;AACxD,IAAI,MAAM,KAAK,GAAG,EAAE,GAAG,MAAM,EAAE,SAAS,EAAE,UAAU,CAAC,mBAAmB,EAAE,SAAS,CAAC,EAAE;AACtF,IAAI,OAAO,OAAO,mBAAmB,GAAG,CAAC,IAAI,EAAE,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,mBAAmB,GAAG,CAAC,GAAG,EAAE,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC;AACnI,EAAE;AACF;AACA,aAAa,CAAC,WAAW,GAAG,eAAe;;"}
@@ -1,19 +1,17 @@
1
1
  'use client';
2
+ import { jsx } from 'react/jsx-runtime';
2
3
  import * as React from 'react';
3
4
  import { classNames } from '../../utils/classNames/index.js';
4
5
 
5
- const Icon = React.forwardRef((props, ref) => {
6
- const { color, children, small, hasTooltip, className, ...otherProps } = props;
7
- return /* @__PURE__ */ React.createElement(
8
- "span",
9
- {
10
- ref,
11
- className: classNames("icon", color, { small }, hasTooltip ? "has-tooltip" : "", className),
12
- ...otherProps
13
- },
14
- children
15
- );
16
- });
6
+ const Icon = React.forwardRef(({ name, label, className, ...others }, ref) => /* @__PURE__ */ jsx(
7
+ "i",
8
+ {
9
+ ...label ? { role: "img", "aria-label": label } : { "aria-hidden": true },
10
+ ...others,
11
+ ref,
12
+ className: classNames("fa-regular", `fa-${name}`, className)
13
+ }
14
+ ));
17
15
  Icon.displayName = "Icon";
18
16
 
19
17
  export { Icon };
@@ -1 +1 @@
1
- {"version":3,"file":"Icon.js","sources":["../../../../src/components/Icon/Icon.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames } from '@/utils';\n\n/** This type defines the different background possible for the icon */\nexport type IconColor = 'primary' | 'info' | 'success' | 'danger';\n\nexport interface IconProps extends React.ComponentProps<'span'> {\n /** The content to be displayed within the icon */\n children: React.ReactNode;\n /** The background color of the icon */\n color?: IconColor;\n /** If `true`, the icon will have a smaller size. */\n small?: boolean;\n /** If `true`, the icon will display a tooltip on hoover */\n hasTooltip?: boolean;\n}\n\n/** A rounded badge around an icon or an image, in the default color or a status color. */\nexport const Icon = React.forwardRef<HTMLSpanElement, IconProps>((props: IconProps, ref) => {\n const { color, children, small, hasTooltip, className, ...otherProps } = props;\n\n return (\n <span\n ref={ref}\n className={classNames('icon', color, { small }, hasTooltip ? 'has-tooltip' : '', className)}\n {...otherProps}\n >\n {children}\n </span>\n );\n});\n\nIcon.displayName = 'Icon';\n"],"names":[],"mappings":";;;;AAEY,MAAC,IAAI,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AACrD,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK;AAChF,EAAE,uBAAuB,KAAK,CAAC,aAAa;AAC5C,IAAI,MAAM;AACV,IAAI;AACJ,MAAM,GAAG;AACT,MAAM,SAAS,EAAE,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,UAAU,GAAG,aAAa,GAAG,EAAE,EAAE,SAAS,CAAC;AACjG,MAAM,GAAG;AACT,KAAK;AACL,IAAI;AACJ,GAAG;AACH,CAAC;AACD,IAAI,CAAC,WAAW,GAAG,MAAM;;"}
1
+ {"version":3,"file":"Icon.js","sources":["../../../../src/components/Icon/Icon.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames } from '@/utils';\n\n/** Every native `<i>` prop (`id`, `data-*`, ...) is accepted and forwarded to it. */\nexport interface IconProps extends Omit<React.ComponentPropsWithoutRef<'i'>, 'children'> {\n /** The Font Awesome icon's name, without its `fa-` prefix: `xmark`, `circle-info`. */\n name: string;\n /**\n * What the icon means, for an icon that stands alone, such as a status. Leave it out for an icon next to text that\n * says the same, or inside a button with its own name: the icon is then hidden from screen readers.\n */\n label?: string;\n}\n\n/**\n * A Font Awesome icon, in the regular style: `<Icon name=\"xmark\" />`. It needs `fontawesome.css` from the CDN. Use\n * `IconBadge` for an icon on a colored, rounded background.\n */\nexport const Icon = React.forwardRef<HTMLElement, IconProps>(({ name, label, className, ...others }, ref) => (\n <i\n {...(label ? { role: 'img', 'aria-label': label } : { 'aria-hidden': true })}\n {...others}\n ref={ref}\n className={classNames('fa-regular', `fa-${name}`, className)}\n />\n));\n\nIcon.displayName = 'Icon';\n"],"names":[],"mappings":";;;;;AAIY,MAAC,IAAI,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,qBAAqB,GAAG;AACxG,EAAE,GAAG;AACL,EAAE;AACF,IAAI,GAAG,KAAK,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE;AAC7E,IAAI,GAAG,MAAM;AACb,IAAI,GAAG;AACP,IAAI,SAAS,EAAE,UAAU,CAAC,YAAY,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,EAAE,SAAS;AAC/D;AACA,CAAC;AACD,IAAI,CAAC,WAAW,GAAG,MAAM;;"}
@@ -0,0 +1,25 @@
1
+ 'use client';
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import * as React from 'react';
4
+ import { classNames } from '../../utils/classNames/index.js';
5
+
6
+ const IconBadge = React.forwardRef((props, ref) => {
7
+ const { tone, children, size = "medium", className, ...otherProps } = props;
8
+ return /* @__PURE__ */ jsx(
9
+ "span",
10
+ {
11
+ ...otherProps,
12
+ ref,
13
+ className: classNames(
14
+ "roaster-icon-badge",
15
+ { "roaster-icon-badge--small": size === "small", [`roaster-icon-badge--${tone}`]: tone },
16
+ className
17
+ ),
18
+ children
19
+ }
20
+ );
21
+ });
22
+ IconBadge.displayName = "IconBadge";
23
+
24
+ export { IconBadge };
25
+ //# sourceMappingURL=IconBadge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IconBadge.js","sources":["../../../../src/components/IconBadge/IconBadge.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames } from '@/utils';\n\n/** The tones of the badge's background. Without one, it has none. */\nexport type IconBadgeTone = 'neutral' | 'primary' | 'info' | 'success' | 'danger';\n\n/**\n * Every native `<span>` prop (`id`, `aria-*`, `data-*`, ...) is accepted and forwarded to it, except the obsolete\n * `color`, left out so that v1's `color` prop is an error rather than ignored: use `tone`.\n */\nexport interface IconBadgeProps extends Omit<React.ComponentPropsWithoutRef<'span'>, 'color'> {\n /** The icon or image. */\n children: React.ReactNode;\n /** The background's tone. */\n tone?: IconBadgeTone;\n /**\n * 36px (`medium`) or 20px (`small`). In a Timeline.Item, it takes the timeline marker's size.\n * @defaultValue 'medium'\n */\n size?: 'small' | 'medium';\n}\n\n/**\n * A round badge around an icon or an image, in a tone. For the icon alone, use `Icon`; for a description on hover and\n * focus, put a focusable element in a `Tooltip`.\n */\nexport const IconBadge = React.forwardRef<HTMLSpanElement, IconBadgeProps>((props, ref) => {\n const { tone, children, size = 'medium', className, ...otherProps } = props;\n\n return (\n <span\n {...otherProps}\n ref={ref}\n className={classNames(\n 'roaster-icon-badge',\n { 'roaster-icon-badge--small': size === 'small', [`roaster-icon-badge--${tone}`]: tone },\n className\n )}\n >\n {children}\n </span>\n );\n});\n\nIconBadge.displayName = 'IconBadge';\n"],"names":[],"mappings":";;;;;AAIY,MAAC,SAAS,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AAC1D,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,GAAG,QAAQ,EAAE,SAAS,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK;AAC7E,EAAE,uBAAuB,GAAG;AAC5B,IAAI,MAAM;AACV,IAAI;AACJ,MAAM,GAAG,UAAU;AACnB,MAAM,GAAG;AACT,MAAM,SAAS,EAAE,UAAU;AAC3B,QAAQ,oBAAoB;AAC5B,QAAQ,EAAE,2BAA2B,EAAE,IAAI,KAAK,OAAO,EAAE,CAAC,CAAC,oBAAoB,EAAE,IAAI,CAAC,CAAC,GAAG,IAAI,EAAE;AAChG,QAAQ;AACR,OAAO;AACP,MAAM;AACN;AACA,GAAG;AACH,CAAC;AACD,SAAS,CAAC,WAAW,GAAG,WAAW;;"}
@@ -1,10 +1,30 @@
1
1
  'use client';
2
- import React__default from 'react';
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import * as React from 'react';
3
4
  import { classNames } from '../../utils/classNames/index.js';
5
+ import { toPercent } from '../../utils/toPercent/index.js';
4
6
 
5
- function Loader({ percentage = 30, className }) {
6
- return /* @__PURE__ */ React__default.createElement("div", { className: classNames("loader-container", className) }, /* @__PURE__ */ React__default.createElement("figure", { className: "loader" }, /* @__PURE__ */ React__default.createElement("span", { className: "loading-level", style: { "--percent": `${percentage}%` } })));
7
- }
7
+ const defaultLoaderLabels = { loading: "Loading" };
8
+ const Loader = React.forwardRef((props, ref) => {
9
+ const { value = 30, labels, className, style, ...others } = props;
10
+ const text = { ...defaultLoaderLabels, ...labels };
11
+ const percent = toPercent(value);
12
+ return /* @__PURE__ */ jsx(
13
+ "div",
14
+ {
15
+ role: "progressbar",
16
+ "aria-label": text.loading,
17
+ "aria-valuemin": 0,
18
+ "aria-valuemax": 100,
19
+ "aria-valuenow": percent,
20
+ ...others,
21
+ ref,
22
+ className: classNames("roaster-loader", className),
23
+ style: { "--percent": percent, ...style }
24
+ }
25
+ );
26
+ });
27
+ Loader.displayName = "Loader";
8
28
 
9
29
  export { Loader };
10
30
  //# sourceMappingURL=Loader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Loader.js","sources":["../../../../src/components/Loader/Loader.tsx"],"sourcesContent":["import React from 'react';\nimport { classNames } from '@/utils';\nimport { ProgressCSSProperties } from '@/types';\n\nexport interface LoaderProps {\n percentage?: number;\n className?: string;\n}\n\n/** A loading bar that fills to the given percentage. */\nexport function Loader({ percentage = 30, className }: LoaderProps) {\n return (\n <div className={classNames('loader-container', className)}>\n <figure className=\"loader\">\n <span className=\"loading-level\" style={{ '--percent': `${percentage}%` } as ProgressCSSProperties} />\n </figure>\n </div>\n );\n}\n"],"names":["React"],"mappings":";;;;AAEO,SAAS,MAAM,CAAC,EAAE,UAAU,GAAG,EAAE,EAAE,SAAS,EAAE,EAAE;AACvD,EAAE,uBAAuBA,cAAK,CAAC,aAAa,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,UAAU,CAAC,kBAAkB,EAAE,SAAS,CAAC,EAAE,kBAAkBA,cAAK,CAAC,aAAa,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,kBAAkBA,cAAK,CAAC,aAAa,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,eAAe,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AAC5S;;"}
1
+ {"version":3,"file":"Loader.js","sources":["../../../../src/components/Loader/Loader.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, toPercent } from '@/utils';\nimport { ProgressCSSProperties } from '@/types';\n\n/** The text of the loader, for other languages. */\nexport interface LoaderLabels {\n /** The name of the loading bar, read by screen readers. */\n loading: string;\n}\n\nconst defaultLoaderLabels: LoaderLabels = { loading: 'Loading' };\n\n/** Every native `<div>` prop (`id`, `aria-*`, `data-*`, ...) is accepted and forwarded to it. */\nexport interface LoaderProps extends React.ComponentPropsWithoutRef<'div'> {\n /**\n * How far the page has loaded, from 0 to 100. Values outside are clamped.\n * @defaultValue 30\n */\n value?: number;\n /** The text of the loader, in English by default. */\n labels?: Partial<LoaderLabels>;\n}\n\n/** A thin bar across the top of the window while a page loads (`role=\"progressbar\"`). */\nexport const Loader = React.forwardRef<HTMLDivElement, LoaderProps>((props, ref) => {\n const { value = 30, labels, className, style, ...others } = props;\n const text = { ...defaultLoaderLabels, ...labels };\n const percent = toPercent(value);\n\n return (\n <div\n role=\"progressbar\"\n aria-label={text.loading}\n aria-valuemin={0}\n aria-valuemax={100}\n aria-valuenow={percent}\n {...others}\n ref={ref}\n className={classNames('roaster-loader', className)}\n style={{ '--percent': percent, ...style } as ProgressCSSProperties}\n />\n );\n});\n\nLoader.displayName = 'Loader';\n"],"names":[],"mappings":";;;;;;AAIA,MAAM,mBAAmB,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE;AACtC,MAAC,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AACvD,EAAE,MAAM,EAAE,KAAK,GAAG,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,MAAM,EAAE,GAAG,KAAK;AACnE,EAAE,MAAM,IAAI,GAAG,EAAE,GAAG,mBAAmB,EAAE,GAAG,MAAM,EAAE;AACpD,EAAE,MAAM,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC;AAClC,EAAE,uBAAuB,GAAG;AAC5B,IAAI,KAAK;AACT,IAAI;AACJ,MAAM,IAAI,EAAE,aAAa;AACzB,MAAM,YAAY,EAAE,IAAI,CAAC,OAAO;AAChC,MAAM,eAAe,EAAE,CAAC;AACxB,MAAM,eAAe,EAAE,GAAG;AAC1B,MAAM,eAAe,EAAE,OAAO;AAC9B,MAAM,GAAG,MAAM;AACf,MAAM,GAAG;AACT,MAAM,SAAS,EAAE,UAAU,CAAC,gBAAgB,EAAE,SAAS,CAAC;AACxD,MAAM,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,KAAK;AAC7C;AACA,GAAG;AACH,CAAC;AACD,MAAM,CAAC,WAAW,GAAG,QAAQ;;"}
@@ -1,12 +1,99 @@
1
1
  'use client';
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
3
  import * as React from 'react';
3
4
  import { ButtonIcon } from '../ButtonIcon/ButtonIcon.js';
5
+ import { Icon } from '../Icon/Icon.js';
6
+ import { useControllableState } from '../../utils/useControllableState/index.js';
7
+ import { useUid } from '../../utils/useUid/index.js';
4
8
  import { classNames } from '../../utils/classNames/index.js';
5
9
 
6
- function Modal({ className, opened, title, onClose, children, size = "small", footer }) {
7
- if (!opened) return null;
8
- return /* @__PURE__ */ React.createElement("section", { className: "modal visible" }, /* @__PURE__ */ React.createElement("div", { className: "background-overlay", onClick: onClose }), /* @__PURE__ */ React.createElement("div", { className: classNames("modal-popup", size, className) }, /* @__PURE__ */ React.createElement("div", { className: "modal-header" }, /* @__PURE__ */ React.createElement("h3", null, title), /* @__PURE__ */ React.createElement(ButtonIcon, { variant: "close-modal", onClick: onClose }, /* @__PURE__ */ React.createElement("i", { className: "fa-regular fa-xmark" }))), /* @__PURE__ */ React.createElement("div", { className: "modal-body" }, children), footer && /* @__PURE__ */ React.createElement("div", { className: "modal-footer" }, footer)));
10
+ const defaultModalLabels = { close: "Close" };
11
+ const useClientLayoutEffect = typeof window === "undefined" ? React.useEffect : React.useLayoutEffect;
12
+ function onBackdrop(dialog, event) {
13
+ const box = dialog.getBoundingClientRect();
14
+ return event.clientX < box.left || event.clientX > box.right || event.clientY < box.top || event.clientY > box.bottom;
9
15
  }
16
+ const Modal = React.forwardRef((props, ref) => {
17
+ const {
18
+ open: openProp,
19
+ defaultOpen = false,
20
+ onOpenChange,
21
+ title,
22
+ description,
23
+ size = "small",
24
+ footer,
25
+ labels,
26
+ children,
27
+ className,
28
+ onCancel,
29
+ onMouseDown,
30
+ onClick,
31
+ ...others
32
+ } = props;
33
+ const [open, setOpen] = useControllableState({ value: openProp, defaultValue: defaultOpen, onChange: onOpenChange });
34
+ const text = { ...defaultModalLabels, ...labels };
35
+ const titleId = useUid();
36
+ const descriptionId = useUid();
37
+ const dialogRef = React.useRef(null);
38
+ const setRefs = React.useCallback(
39
+ (dialog) => {
40
+ dialogRef.current = dialog;
41
+ if (typeof ref === "function") ref(dialog);
42
+ else if (ref) ref.current = dialog;
43
+ },
44
+ [ref]
45
+ );
46
+ const pressedOutside = React.useRef(false);
47
+ useClientLayoutEffect(() => {
48
+ if (!open) return void 0;
49
+ const dialog = dialogRef.current;
50
+ const previous = document.activeElement;
51
+ if (dialog && !dialog.open) dialog.showModal();
52
+ return () => {
53
+ if (dialog?.open) dialog.close();
54
+ if (previous instanceof HTMLElement && previous.isConnected) previous.focus({ preventScroll: true });
55
+ };
56
+ }, [open]);
57
+ if (!open) return null;
58
+ return (
59
+ // The mouse handlers only add a click outside to close it; the keyboard has Escape, through the cancel event.
60
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
61
+ /* @__PURE__ */ jsxs(
62
+ "dialog",
63
+ {
64
+ "aria-labelledby": title ? titleId : void 0,
65
+ "aria-describedby": description ? descriptionId : void 0,
66
+ ...others,
67
+ ref: setRefs,
68
+ className: classNames("roaster-modal", size !== "small" && `roaster-modal--${size}`, className),
69
+ onCancel: (event) => {
70
+ onCancel?.(event);
71
+ event.preventDefault();
72
+ setOpen(false);
73
+ },
74
+ onMouseDown: (event) => {
75
+ onMouseDown?.(event);
76
+ pressedOutside.current = event.target === event.currentTarget && onBackdrop(event.currentTarget, event);
77
+ },
78
+ onClick: (event) => {
79
+ onClick?.(event);
80
+ const outside = event.target === event.currentTarget && onBackdrop(event.currentTarget, event);
81
+ if (pressedOutside.current && outside) setOpen(false);
82
+ pressedOutside.current = false;
83
+ },
84
+ children: [
85
+ /* @__PURE__ */ jsxs("div", { className: "roaster-modal__header", children: [
86
+ title && /* @__PURE__ */ jsx("h2", { className: "roaster-modal__title", id: titleId, children: title }),
87
+ /* @__PURE__ */ jsx(ButtonIcon, { size: "medium", "aria-label": text.close, onClick: () => setOpen(false), children: /* @__PURE__ */ jsx(Icon, { name: "xmark" }) }),
88
+ description && /* @__PURE__ */ jsx("p", { className: "roaster-modal__description", id: descriptionId, children: description })
89
+ ] }),
90
+ /* @__PURE__ */ jsx("div", { className: "roaster-modal__body", children }),
91
+ footer && /* @__PURE__ */ jsx("div", { className: "roaster-modal__footer", children: footer })
92
+ ]
93
+ }
94
+ )
95
+ );
96
+ });
10
97
  Modal.displayName = "Modal";
11
98
 
12
99
  export { Modal };
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.js","sources":["../../../../src/components/Modal/Modal.tsx"],"sourcesContent":["/* eslint-disable jsx-a11y/no-static-element-interactions */\n/* eslint-disable jsx-a11y/click-events-have-key-events */\nimport * as React from 'react';\nimport { classNames } from '@/utils';\nimport { ModalProps } from './types';\nimport { ButtonIcon } from '../ButtonIcon';\n\n/**\n * A dialog over the page with a title, content and an optional footer. Open it with the opened prop, or with\n * openModal() through ModalProvider.\n */\nexport function Modal({ className, opened, title, onClose, children, size = 'small', footer }: ModalProps) {\n if (!opened) return null;\n\n return (\n <section className=\"modal visible\">\n <div className=\"background-overlay\" onClick={onClose} />\n <div className={classNames('modal-popup', size, className)}>\n <div className=\"modal-header\">\n <h3>{title}</h3>\n <ButtonIcon variant=\"close-modal\" onClick={onClose}>\n <i className=\"fa-regular fa-xmark\" />\n </ButtonIcon>\n </div>\n <div className=\"modal-body\">{children}</div>\n {footer && <div className=\"modal-footer\">{footer}</div>}\n </div>\n </section>\n );\n}\n\nModal.displayName = 'Modal';\n"],"names":[],"mappings":";;;;;AAGO,SAAS,KAAK,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,GAAG,OAAO,EAAE,MAAM,EAAE,EAAE;AAC/F,EAAE,IAAI,CAAC,MAAM,EAAE,OAAO,IAAI;AAC1B,EAAE,uBAAuB,KAAK,CAAC,aAAa,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,eAAe,EAAE,kBAAkB,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,oBAAoB,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,kBAAkB,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,UAAU,CAAC,aAAa,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,kBAAkB,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,cAAc,EAAE,kBAAkB,KAAK,CAAC,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,kBAAkB,KAAK,CAAC,aAAa,CAAC,UAAU,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,EAAE,kBAAkB,KAAK,CAAC,aAAa,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,qBAAqB,EAAE,CAAC,CAAC,CAAC,kBAAkB,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,YAAY,EAAE,EAAE,QAAQ,CAAC,EAAE,MAAM,oBAAoB,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,cAAc,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC;AACnwB;AACA,KAAK,CAAC,WAAW,GAAG,OAAO;;"}
1
+ {"version":3,"file":"Modal.js","sources":["../../../../src/components/Modal/Modal.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, useControllableState, useUid } from '@/utils';\nimport { ModalLabels, ModalProps } from './types';\nimport { ButtonIcon } from '../ButtonIcon';\nimport { Icon } from '@/components/Icon';\n\nconst defaultModalLabels: ModalLabels = { close: 'Close' };\n\n// A layout effect in the browser (the modal opens before it paints), and nothing on the server, which warns about one.\nconst useClientLayoutEffect = typeof window === 'undefined' ? React.useEffect : React.useLayoutEffect;\n\n/** Whether the pointer event happened outside the dialog's box, on its backdrop. */\nfunction onBackdrop(dialog: HTMLDialogElement, event: React.MouseEvent) {\n const box = dialog.getBoundingClientRect();\n return event.clientX < box.left || event.clientX > box.right || event.clientY < box.top || event.clientY > box.bottom;\n}\n\n/**\n * A dialog over the page (`<dialog>` opened with `showModal()`), with a title, content and an optional footer. The page\n * behind is inert and doesn't scroll; the close button, Escape and a click outside ask to close it; the focus goes\n * back where it was. Open it with `open`, or with `useModal().openModal()` inside a ModalProvider.\n */\nexport const Modal = React.forwardRef<HTMLDialogElement, ModalProps>((props, ref) => {\n const {\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n title,\n description,\n size = 'small',\n footer,\n labels,\n children,\n className,\n onCancel,\n onMouseDown,\n onClick,\n ...others\n } = props;\n const [open, setOpen] = useControllableState({ value: openProp, defaultValue: defaultOpen, onChange: onOpenChange });\n const text = { ...defaultModalLabels, ...labels };\n const titleId = useUid();\n const descriptionId = useUid();\n const dialogRef = React.useRef<HTMLDialogElement | null>(null);\n const setRefs = React.useCallback(\n (dialog: HTMLDialogElement | null) => {\n dialogRef.current = dialog;\n if (typeof ref === 'function') ref(dialog);\n else if (ref) ref.current = dialog;\n },\n [ref]\n );\n // Set on mousedown, so that a selection dragged from inside the dialog to outside doesn't close it.\n const pressedOutside = React.useRef(false);\n\n // Shown as a modal once mounted. Unmounting removes it without close(), so the focus goes back by hand.\n useClientLayoutEffect(() => {\n if (!open) return undefined;\n const dialog = dialogRef.current;\n const previous = document.activeElement;\n if (dialog && !dialog.open) dialog.showModal();\n return () => {\n if (dialog?.open) dialog.close();\n if (previous instanceof HTMLElement && previous.isConnected) previous.focus({ preventScroll: true });\n };\n }, [open]);\n\n if (!open) return null;\n\n return (\n // The mouse handlers only add a click outside to close it; the keyboard has Escape, through the cancel event.\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions\n <dialog\n aria-labelledby={title ? titleId : undefined}\n aria-describedby={description ? descriptionId : undefined}\n {...others}\n ref={setRefs}\n className={classNames('roaster-modal', size !== 'small' && `roaster-modal--${size}`, className)}\n onCancel={(event) => {\n onCancel?.(event);\n // Escape: the state closes the dialog, so a parent that keeps it open is obeyed.\n event.preventDefault();\n setOpen(false);\n }}\n onMouseDown={(event) => {\n onMouseDown?.(event);\n pressedOutside.current = event.target === event.currentTarget && onBackdrop(event.currentTarget, event);\n }}\n onClick={(event) => {\n onClick?.(event);\n const outside = event.target === event.currentTarget && onBackdrop(event.currentTarget, event);\n if (pressedOutside.current && outside) setOpen(false);\n pressedOutside.current = false;\n }}\n >\n <div className=\"roaster-modal__header\">\n {title && (\n <h2 className=\"roaster-modal__title\" id={titleId}>\n {title}\n </h2>\n )}\n <ButtonIcon size=\"medium\" aria-label={text.close} onClick={() => setOpen(false)}>\n <Icon name=\"xmark\" />\n </ButtonIcon>\n {description && (\n <p className=\"roaster-modal__description\" id={descriptionId}>\n {description}\n </p>\n )}\n </div>\n <div className=\"roaster-modal__body\">{children}</div>\n {footer && <div className=\"roaster-modal__footer\">{footer}</div>}\n </dialog>\n );\n});\n\nModal.displayName = 'Modal';\n"],"names":[],"mappings":";;;;;;;;;AAMA,MAAM,kBAAkB,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE;AAC7C,MAAM,qBAAqB,GAAG,OAAO,MAAM,KAAK,WAAW,GAAG,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,eAAe;AACrG,SAAS,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE;AACnC,EAAE,MAAM,GAAG,GAAG,MAAM,CAAC,qBAAqB,EAAE;AAC5C,EAAE,OAAO,KAAK,CAAC,OAAO,GAAG,GAAG,CAAC,IAAI,IAAI,KAAK,CAAC,OAAO,GAAG,GAAG,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,GAAG,GAAG,CAAC,GAAG,IAAI,KAAK,CAAC,OAAO,GAAG,GAAG,CAAC,MAAM;AACvH;AACY,MAAC,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AACtD,EAAE,MAAM;AACR,IAAI,IAAI,EAAE,QAAQ;AAClB,IAAI,WAAW,GAAG,KAAK;AACvB,IAAI,YAAY;AAChB,IAAI,KAAK;AACT,IAAI,WAAW;AACf,IAAI,IAAI,GAAG,OAAO;AAClB,IAAI,MAAM;AACV,IAAI,MAAM;AACV,IAAI,QAAQ;AACZ,IAAI,SAAS;AACb,IAAI,QAAQ;AACZ,IAAI,WAAW;AACf,IAAI,OAAO;AACX,IAAI,GAAG;AACP,GAAG,GAAG,KAAK;AACX,E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CAAC;AACT,QAAQ,QAAQ,EAAE;AAClB,0BAA0B,IAAI,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,uBAAuB,EAAE,QAAQ,EAAE;AACtF,YAAY,KAAK,oBAAoB,GAAG,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,sBAAsB,EAAE,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AACnH,4BAA4B,GAAG,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC,KAAK,CAAC,EAAE,QAAQ,kBAAkB,GAAG,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;AAChL,YAAY,WAAW,oBAAoB,GAAG,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,4BAA4B,EAAE,EAAE,EAAE,aAAa,EAAE,QAAQ,EAAE,WAAW,EAAE;AACzI,WAAW,EAAE,CAAC;AACd,0BAA0B,GAAG,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,qBAAqB,EAAE,QAAQ,EAAE,CAAC;AACpF,UAAU,MAAM,oBAAoB,GAAG,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,uBAAuB,EAAE,QAAQ,EAAE,MAAM,EAAE;AACvG;AACA;AACA;AACA;AACA,CAAC;AACD,KAAK,CAAC,WAAW,GAAG,OAAO;;"}
@@ -1,18 +1,18 @@
1
1
  'use client';
2
- import React__default from 'react';
2
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
3
3
  import { Button } from '../../Button/Button.js';
4
4
  import { useModal } from '../utils/useModal.js';
5
5
 
6
6
  function ModalProviderFooter({
7
7
  cancelProps,
8
8
  confirmProps,
9
- labels = { confirm: "Confirm", cancel: "Cancel" },
9
+ labels,
10
10
  closeOnConfirm = true,
11
11
  closeOnCancel = true,
12
12
  onCancel,
13
13
  onConfirm
14
14
  }) {
15
- const { cancel: cancelLabel, confirm: confirmLabel } = labels;
15
+ const { cancel: cancelLabel, confirm: confirmLabel } = { confirm: "Confirm", cancel: "Cancel", ...labels };
16
16
  const ctx = useModal();
17
17
  const handleCancel = (event) => {
18
18
  typeof cancelProps?.onClick === "function" && cancelProps?.onClick(event);
@@ -24,7 +24,10 @@ function ModalProviderFooter({
24
24
  typeof onConfirm === "function" && onConfirm();
25
25
  closeOnConfirm && ctx.closeModal();
26
26
  };
27
- return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(Button, { variant: "primary", color: "danger", ...cancelProps, onClick: handleCancel }, cancelProps?.children || cancelLabel), /* @__PURE__ */ React__default.createElement(Button, { variant: "primary", color: "success", ...confirmProps, onClick: handleConfirm }, confirmProps?.children || confirmLabel));
27
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
28
+ /* @__PURE__ */ jsx(Button, { variant: "primary", tone: "danger", ...cancelProps, onClick: handleCancel, children: cancelProps?.children || cancelLabel }),
29
+ /* @__PURE__ */ jsx(Button, { variant: "primary", tone: "success", ...confirmProps, onClick: handleConfirm, children: confirmProps?.children || confirmLabel })
30
+ ] });
28
31
  }
29
32
 
30
33
  export { ModalProviderFooter };
@@ -1 +1 @@
1
- {"version":3,"file":"ModalProviderFooter.js","sources":["../../../../../src/components/Modal/ModalProvider/ModalProviderFooter.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-expressions */\nimport React from 'react';\nimport { Button } from '@/components/Button';\nimport { ModalProviderFooterProps } from '../types';\nimport { useModal } from '../utils/useModal';\n\nexport function ModalProviderFooter({\n cancelProps,\n confirmProps,\n labels = { confirm: 'Confirm', cancel: 'Cancel' },\n closeOnConfirm = true,\n closeOnCancel = true,\n onCancel,\n onConfirm,\n}: ModalProviderFooterProps) {\n const { cancel: cancelLabel, confirm: confirmLabel } = labels;\n const ctx = useModal();\n\n const handleCancel = (event: React.MouseEvent<HTMLButtonElement>) => {\n typeof cancelProps?.onClick === 'function' && cancelProps?.onClick(event);\n typeof onCancel === 'function' && onCancel();\n closeOnCancel && ctx.closeModal();\n };\n\n const handleConfirm = (event: React.MouseEvent<HTMLButtonElement>) => {\n typeof confirmProps?.onClick === 'function' && confirmProps?.onClick(event);\n typeof onConfirm === 'function' && onConfirm();\n closeOnConfirm && ctx.closeModal();\n };\n\n return (\n <>\n <Button variant=\"primary\" color=\"danger\" {...cancelProps} onClick={handleCancel}>\n {cancelProps?.children || cancelLabel}\n </Button>\n\n <Button variant=\"primary\" color=\"success\" {...confirmProps} onClick={handleConfirm}>\n {confirmProps?.children || confirmLabel}\n </Button>\n </>\n );\n}\n"],"names":["React"],"mappings":";;;;;AAGO,SAAS,mBAAmB,CAAC;AACpC,EAAE,WAAW;AACb,EAAE,YAAY;AACd,EAAE,MAAM,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE;AACnD,EAAE,cAAc,GAAG,IAAI;AACvB,EAAE,aAAa,GAAG,IAAI;AACtB,EAAE,QAAQ;AACV,EAAE;AACF,CAAC,EAAE;AACH,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,MAAM;AAC/D,EAAE,MAAM,GAAG,GAAG,QAAQ,EAAE;AACxB,EAAE,MAAM,YAAY,GAAG,CAAC,KAAK,KAAK;AAClC,IAAI,OAAO,WAAW,EAAE,OAAO,KAAK,UAAU,IAAI,WAAW,EAAE,OAAO,CAAC,KAAK,CAAC;AAC7E,IAAI,OAAO,QAAQ,KAAK,UAAU,IAAI,QAAQ,EAAE;AAChD,IAAI,aAAa,IAAI,GAAG,CAAC,UAAU,EAAE;AACrC,EAAE,CAAC;AACH,EAAE,MAAM,aAAa,GAAG,CAAC,KAAK,KAAK;AACnC,IAAI,OAAO,YAAY,EAAE,OAAO,KAAK,UAAU,IAAI,YAAY,EAAE,OAAO,CAAC,KAAK,CAAC;AAC/E,IAAI,OAAO,SAAS,KAAK,UAAU,IAAI,SAAS,EAAE;AAClD,IAAI,cAAc,IAAI,GAAG,CAAC,UAAU,EAAE;AACtC,EAAE,CAAC;AACH,EAAE,uBAAuBA,cAAK,CAAC,aAAa,CAACA,cAAK,CAAC,QAAQ,EAAE,IAAI,kBAAkBA,cAAK,CAAC,aAAa,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,WAAW,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,WAAW,EAAE,QAAQ,IAAI,WAAW,CAAC,kBAAkBA,cAAK,CAAC,aAAa,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,EAAE,YAAY,EAAE,QAAQ,IAAI,YAAY,CAAC,CAAC;AAC7Y;;"}
1
+ {"version":3,"file":"ModalProviderFooter.js","sources":["../../../../../src/components/Modal/ModalProvider/ModalProviderFooter.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-expressions */\nimport React from 'react';\nimport { Button } from '@/components/Button';\nimport { ModalProviderFooterProps } from '../types';\nimport { useModal } from '../utils/useModal';\n\nexport function ModalProviderFooter({\n cancelProps,\n confirmProps,\n labels,\n closeOnConfirm = true,\n closeOnCancel = true,\n onCancel,\n onConfirm,\n}: ModalProviderFooterProps) {\n const { cancel: cancelLabel, confirm: confirmLabel } = { confirm: 'Confirm', cancel: 'Cancel', ...labels };\n const ctx = useModal();\n\n const handleCancel = (event: React.MouseEvent<HTMLButtonElement>) => {\n typeof cancelProps?.onClick === 'function' && cancelProps?.onClick(event);\n typeof onCancel === 'function' && onCancel();\n closeOnCancel && ctx.closeModal();\n };\n\n const handleConfirm = (event: React.MouseEvent<HTMLButtonElement>) => {\n typeof confirmProps?.onClick === 'function' && confirmProps?.onClick(event);\n typeof onConfirm === 'function' && onConfirm();\n closeOnConfirm && ctx.closeModal();\n };\n\n return (\n <>\n <Button variant=\"primary\" tone=\"danger\" {...cancelProps} onClick={handleCancel}>\n {cancelProps?.children || cancelLabel}\n </Button>\n\n <Button variant=\"primary\" tone=\"success\" {...confirmProps} onClick={handleConfirm}>\n {confirmProps?.children || confirmLabel}\n </Button>\n </>\n );\n}\n"],"names":[],"mappings":";;;;;AAIO,SAAS,mBAAmB,CAAC;AACpC,EAAE,WAAW;AACb,EAAE,YAAY;AACd,EAAE,MAAM;AACR,EAAE,cAAc,GAAG,IAAI;AACvB,EAAE,aAAa,GAAG,IAAI;AACtB,EAAE,QAAQ;AACV,EAAE;AACF,CAAC,EAAE;AACH,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,EAAE;AAC5G,EAAE,MAAM,GAAG,GAAG,QAAQ,EAAE;AACxB,EAAE,MAAM,YAAY,GAAG,CAAC,KAAK,KAAK;AAClC,IAAI,OAAO,WAAW,EAAE,OAAO,KAAK,UAAU,IAAI,WAAW,EAAE,OAAO,CAAC,KAAK,CAAC;AAC7E,IAAI,OAAO,QAAQ,KAAK,UAAU,IAAI,QAAQ,EAAE;AAChD,IAAI,aAAa,IAAI,GAAG,CAAC,UAAU,EAAE;AACrC,EAAE,CAAC;AACH,EAAE,MAAM,aAAa,GAAG,CAAC,KAAK,KAAK;AACnC,IAAI,OAAO,YAAY,EAAE,OAAO,KAAK,UAAU,IAAI,YAAY,EAAE,OAAO,CAAC,KAAK,CAAC;AAC/E,IAAI,OAAO,SAAS,KAAK,UAAU,IAAI,SAAS,EAAE;AAClD,IAAI,cAAc,IAAI,GAAG,CAAC,UAAU,EAAE;AACtC,EAAE,CAAC;AACH,EAAE,uBAAuB,IAAI,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE;AACpD,oBAAoB,GAAG,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,WAAW,EAAE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,IAAI,WAAW,EAAE,CAAC;AAC9J,oBAAoB,GAAG,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,IAAI,YAAY,EAAE;AAClK,GAAG,EAAE,CAAC;AACN;;"}
@@ -1,7 +1,7 @@
1
1
  'use client';
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
3
  import * as React from 'react';
3
4
  import { Modal } from '../Modal.js';
4
- import { useModalEvents } from '../utils/events.js';
5
5
  import { modalReducer, getModalProviderFooterProps } from '../utils/reducer.js';
6
6
  import { ModalContextProvider } from '../utils/useModal.js';
7
7
  import { ModalProviderFooter } from './ModalProviderFooter.js';
@@ -33,10 +33,6 @@ function ModalProvider({ children, modalProps: sharedProps }) {
33
33
  }),
34
34
  [state, openModal, closeModal]
35
35
  );
36
- useModalEvents({
37
- openModal,
38
- closeModal
39
- });
40
36
  const getModalProps = () => {
41
37
  const modalState = stateRef.current?.props;
42
38
  if (modalState) {
@@ -44,7 +40,7 @@ function ModalProvider({ children, modalProps: sharedProps }) {
44
40
  return {
45
41
  modalProps: { ...modalProps2 },
46
42
  children: modalState.children,
47
- footer: /* @__PURE__ */ React.createElement(ModalProviderFooter, { ...footerProps, labels: modalState.labels || footerProps.labels })
43
+ footer: /* @__PURE__ */ jsx(ModalProviderFooter, { ...footerProps })
48
44
  };
49
45
  }
50
46
  return {
@@ -53,17 +49,20 @@ function ModalProvider({ children, modalProps: sharedProps }) {
53
49
  };
54
50
  };
55
51
  const { modalProps, footer, children: modalChildren } = getModalProps();
56
- return /* @__PURE__ */ React.createElement(ModalContextProvider, { value: ctx }, /* @__PURE__ */ React.createElement(
57
- Modal,
58
- {
59
- footer,
60
- ...sharedProps,
61
- ...modalProps,
62
- opened: modalChildren != null,
63
- onClose: () => closeModal()
64
- },
65
- modalChildren
66
- ), children);
52
+ return /* @__PURE__ */ jsxs(ModalContextProvider, { value: ctx, children: [
53
+ /* @__PURE__ */ jsx(
54
+ Modal,
55
+ {
56
+ footer,
57
+ ...sharedProps,
58
+ ...modalProps,
59
+ open: modalChildren != null,
60
+ onOpenChange: (open) => !open && closeModal(),
61
+ children: modalChildren
62
+ }
63
+ ),
64
+ children
65
+ ] });
67
66
  }
68
67
 
69
68
  export { ModalProvider };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../src/components/Modal/ModalProvider/index.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Modal } from '../Modal';\nimport { ModalContextProps, ModalSettings, ModalProviderProps, ModalState } from '../types';\nimport { getModalProviderFooterProps, modalReducer, ModalContextProvider, useModalEvents } from '../utils';\nimport { ModalProviderFooter } from './ModalProviderFooter';\n\nexport function ModalProvider({ children, modalProps: sharedProps }: ModalProviderProps) {\n // `null` while no modal is open. The shared props are applied to every modal when rendering it, below.\n const [state, dispatch] = React.useReducer(modalReducer, null as ModalState | null);\n const stateRef = React.useRef(state);\n stateRef.current = state;\n\n const openModal = React.useCallback(\n ({ ...props }: ModalSettings) => {\n dispatch({\n type: 'OPEN',\n modal: {\n props,\n },\n });\n },\n [dispatch]\n );\n\n const closeModal = React.useCallback(() => {\n // Called here rather than in the reducer: React runs reducers twice in StrictMode, which called onClose twice.\n stateRef.current?.props.onClose?.();\n dispatch({ type: 'CLOSE' });\n }, [stateRef, dispatch]);\n\n const ctx: ModalContextProps = React.useMemo(\n () => ({\n modal: state,\n openModal,\n closeModal,\n }),\n [state, openModal, closeModal]\n );\n useModalEvents({\n openModal,\n closeModal,\n });\n\n const getModalProps = () => {\n const modalState = stateRef.current?.props;\n\n if (modalState) {\n const { modalProps, footerProps } = getModalProviderFooterProps(modalState);\n\n return {\n modalProps: { ...modalProps },\n children: modalState.children,\n footer: <ModalProviderFooter {...footerProps} labels={modalState.labels || footerProps.labels} />,\n };\n }\n\n return {\n modalProps: {},\n children: null as React.ReactNode,\n };\n };\n\n const { modalProps, footer, children: modalChildren } = getModalProps();\n\n return (\n <ModalContextProvider value={ctx}>\n <Modal\n footer={footer}\n {...sharedProps}\n {...modalProps}\n opened={modalChildren != null}\n onClose={() => closeModal()}\n >\n {modalChildren}\n </Modal>\n\n {children}\n </ModalContextProvider>\n );\n}\n"],"names":[],"mappings":";;;;;;;;AAIO,SAAS,aAAa,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,EAAE;AACrE,EAAE,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,YAAY,EAAE,IAAI,CAAC;AAChE,EAAE,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;AACtC,EAAE,QAAQ,CAAC,OAAO,GAAG,KAAK;AAC1B,EAAE,MAAM,SAAS,GAAG,KAAK,CAAC,WAAW;AACrC,IAAI,CAAC,EAAE,GAAG,KAAK,EAAE,KAAK;AACtB,MAAM,QAAQ,CAAC;AACf,QAAQ,IAAI,EAAE,MAAM;AACpB,QAAQ,KAAK,EAAE;AACf,UAAU;AACV;AACA,OAAO,CAAC;AACR,IAAI,CAAC;AACL,IAAI,CAAC,QAAQ;AACb,GAAG;AACH,EAAE,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,CAAC,MAAM;AAC7C,IAAI,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI;AACvC,IAAI,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AAC/B,EAAE,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAC1B,EAAE,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO;AAC3B,IAAI,OAAO;AACX,MAAM,KAAK,EAAE,KAAK;AAClB,M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3,"file":"index.js","sources":["../../../../../src/components/Modal/ModalProvider/index.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Modal } from '../Modal';\nimport { ModalContextProps, ModalSettings, ModalProviderProps, ModalState } from '../types';\nimport { getModalProviderFooterProps, modalReducer, ModalContextProvider } from '../utils';\nimport { ModalProviderFooter } from './ModalProviderFooter';\n\nexport function ModalProvider({ children, modalProps: sharedProps }: ModalProviderProps) {\n // `null` while no modal is open. The shared props are applied to every modal when rendering it, below.\n const [state, dispatch] = React.useReducer(modalReducer, null as ModalState | null);\n const stateRef = React.useRef(state);\n stateRef.current = state;\n\n const openModal = React.useCallback(\n ({ ...props }: ModalSettings) => {\n dispatch({\n type: 'OPEN',\n modal: {\n props,\n },\n });\n },\n [dispatch]\n );\n\n const closeModal = React.useCallback(() => {\n // Called here rather than in the reducer: React runs reducers twice in StrictMode, which called onClose twice.\n stateRef.current?.props.onClose?.();\n dispatch({ type: 'CLOSE' });\n }, [stateRef, dispatch]);\n\n const ctx: ModalContextProps = React.useMemo(\n () => ({\n modal: state,\n openModal,\n closeModal,\n }),\n [state, openModal, closeModal]\n );\n\n const getModalProps = () => {\n const modalState = stateRef.current?.props;\n\n if (modalState) {\n const { modalProps, footerProps } = getModalProviderFooterProps(modalState);\n\n return {\n modalProps: { ...modalProps },\n children: modalState.children,\n footer: <ModalProviderFooter {...footerProps} />,\n };\n }\n\n return {\n modalProps: {},\n children: null as React.ReactNode,\n };\n };\n\n const { modalProps, footer, children: modalChildren } = getModalProps();\n\n return (\n <ModalContextProvider value={ctx}>\n <Modal\n footer={footer}\n {...sharedProps}\n {...modalProps}\n open={modalChildren != null}\n onOpenChange={(open) => !open && closeModal()}\n >\n {modalChildren}\n </Modal>\n\n {children}\n </ModalContextProvider>\n );\n}\n"],"names":[],"mappings":";;;;;;;;AAMO,SAAS,aAAa,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,EAAE;AACrE,EAAE,MAAM,CAAC,KAAK,EAAE,QA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,MAAM,kBAAkB,GAAG,CAAC,mBAAmB,EAAE,EAAE,GAAG,WAAW,EAAE;AAC3E,OAAO;AACP,IAAI;AACJ,IAAI,OAAO;AACX,MAAM,UAAU,EAAE,EAAE;AACpB,MAAM,QAAQ,EAAE;AAChB,KAAK;AACL,EAAE,CAAC;AACH,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,GAAG,aAAa,EAAE;AACzE,EAAE,uBAAuB,IAAI,CAAC,oBAAoB,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE;AAC5E,oBAAoB,GAAG;AACvB,MAAM,KAAK;AACX,MAAM;AACN,QAAQ,MAAM;AACd,QAAQ,GAAG,WAAW;AACtB,QAAQ,GAAG,UAAU;AACrB,QAAQ,IAAI,EAAE,aAAa,IAAI,IAAI;AACnC,QAAQ,YAAY,EAAE,CAAC,IAAI,KAAK,CAAC,IAAI,IAAI,UAAU,EAAE;AACrD,QAAQ,QAAQ,EAAE;AAClB;AACA,KAAK;AACL,IAAI;AACJ,GAAG,EAAE,CAAC;AACN;;"}
@@ -19,6 +19,8 @@ function getModalProviderFooterProps(props) {
19
19
  return { footerProps: {}, modalProps: {} };
20
20
  }
21
21
  const { onCancel, onConfirm, closeOnConfirm, closeOnCancel, cancelProps, confirmProps, labels, ...others } = props;
22
+ const modalProps = { ...others };
23
+ delete modalProps.onClose;
22
24
  return {
23
25
  footerProps: {
24
26
  onCancel,
@@ -30,7 +32,8 @@ function getModalProviderFooterProps(props) {
30
32
  labels
31
33
  },
32
34
  modalProps: {
33
- ...others
35
+ ...modalProps,
36
+ labels: labels?.close ? { close: labels.close } : void 0
34
37
  }
35
38
  };
36
39
  }
@@ -1 +1 @@
1
- {"version":3,"file":"reducer.js","sources":["../../../../../src/components/Modal/utils/reducer.ts"],"sourcesContent":["import { ModalProviderFooterProps, ModalState } from '../types';\n\ninterface OpenAction {\n type: 'OPEN';\n modal: ModalState;\n}\n\ninterface CloseAction {\n type: 'CLOSE';\n}\n\n/** Keep this function pure: React may call it twice. Side effects such as `onClose` belong to the provider. */\nexport function modalReducer(state: ModalState | null, action: OpenAction | CloseAction): ModalState | null {\n switch (action.type) {\n case 'OPEN': {\n return {\n ...action.modal,\n };\n }\n case 'CLOSE': {\n return null;\n }\n\n default: {\n return state;\n }\n }\n}\n\nexport function getModalProviderFooterProps(props: ModalProviderFooterProps) {\n if (!props) {\n return { footerProps: {}, modalProps: {} };\n }\n\n const { onCancel, onConfirm, closeOnConfirm, closeOnCancel, cancelProps, confirmProps, labels, ...others } = props;\n\n return {\n footerProps: {\n onCancel,\n onConfirm,\n closeOnConfirm,\n closeOnCancel,\n cancelProps,\n confirmProps,\n labels,\n },\n modalProps: {\n ...others,\n },\n };\n}\n"],"names":[],"mappings":";AAAO,SAAS,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE;AAC5C,EAAE,QAAQ,MAAM,CAAC,IAAI;AACrB,IAAI,KAAK,MAAM,EAAE;AACjB,MAAM,OAAO;AACb,QAAQ,GAAG,MAAM,CAAC;AAClB,OAAO;AACP,IAAI;AACJ,IAAI,KAAK,OAAO,EAAE;AAClB,MAAM,OAAO,IAAI;AACjB,IAAI;AACJ,IAAI,SAAS;AACb,MAAM,OAAO,KAAK;AAClB,IAAI;AACJ;AACA;AACO,SAAS,2BAA2B,CAAC,KAAK,EAAE;AACnD,EAAE,IAAI,CAAC,KAAK,EAAE;AACd,IAAI,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE;AAC9C,EAAE;AACF,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,cAAc,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,KAAK;AACpH,EAAE,OAAO;AACT,IAAI,WAAW,EAAE;AACjB,MAAM,QAAQ;AACd,MAAM,SAAS;AACf,MAAM,cAAc;AACpB,MAAM,aAAa;AACnB,MAAM,WAAW;AACjB,MAAM,YAAY;AAClB,MAAM;AACN,KAAK;AACL,IAAI,UAAU,EAAE;AAChB,MAAM,GAAG;AACT;AACA,GAAG;AACH;;"}
1
+ {"version":3,"file":"reducer.js","sources":["../../../../../src/components/Modal/utils/reducer.ts"],"sourcesContent":["import { ModalSettings, ModalState } from '../types';\n\ninterface OpenAction {\n type: 'OPEN';\n modal: ModalState;\n}\n\ninterface CloseAction {\n type: 'CLOSE';\n}\n\n/** Keep this function pure: React may call it twice. Side effects such as `onClose` belong to the provider. */\nexport function modalReducer(state: ModalState | null, action: OpenAction | CloseAction): ModalState | null {\n switch (action.type) {\n case 'OPEN': {\n return {\n ...action.modal,\n };\n }\n case 'CLOSE': {\n return null;\n }\n\n default: {\n return state;\n }\n }\n}\n\n/** Splits the settings of `openModal()` between the modal and its footer. `onClose` is the provider's to call. */\nexport function getModalProviderFooterProps(props: ModalSettings) {\n if (!props) {\n return { footerProps: {}, modalProps: {} };\n }\n\n const { onCancel, onConfirm, closeOnConfirm, closeOnCancel, cancelProps, confirmProps, labels, ...others } = props;\n const modalProps: Omit<ModalSettings, 'onClose'> = { ...others };\n delete (modalProps as ModalSettings).onClose;\n\n return {\n footerProps: {\n onCancel,\n onConfirm,\n closeOnConfirm,\n closeOnCancel,\n cancelProps,\n confirmProps,\n labels,\n },\n modalProps: {\n ...modalProps,\n labels: labels?.close ? { close: labels.close } : undefined,\n },\n };\n}\n"],"names":[],"mappings":";AACO,SAAS,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE;AAC5C,EAAE,QAAQ,MAAM,CAAC,IAAI;AACrB,IAAI,KAAK,MAAM,EAAE;AACjB,MAAM,OAAO;AACb,QAAQ,GAAG,MAAM,CAAC;AAClB,OAAO;AACP,IAAI;AACJ,IAAI,KAAK,OAAO,EAAE;AAClB,MAAM,OAAO,IAAI;AACjB,IAAI;AACJ,IAAI,SAAS;AACb,MAAM,OAAO,KAAK;AAClB,IAAI;AACJ;AACA;AACO,SAAS,2BAA2B,CAAC,KAAK,EAAE;AACnD,EAAE,IAAI,CAAC,KAAK,EAAE;AACd,IAAI,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE;AAC9C,EAAE;AACF,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,cAAc,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,KAAK;AACpH,EAAE,MAAM,UAAU,GAAG,EAAE,GAAG,MAAM,EAAE;AAClC,EAAE,OAAO,UAAU,CAAC,OAAO;AAC3B,EAAE,OAAO;AACT,IAAI,WAAW,EAAE;AACjB,MAAM,QAAQ;AACd,MAAM,SAAS;AACf,MAAM,cAAc;AACpB,MAAM,aAAa;AACnB,MAAM,WAAW;AACjB,MAAM,YAAY;AAClB,MAAM;AACN,KAAK;AACL,IAAI,UAAU,EAAE;AAChB,MAAM,GAAG,UAAU;AACnB,MAAM,MAAM,EAAE,MAAM,EAAE,KAAK,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,GAAG;AACxD;AACA,GAAG;AACH;;"}
@@ -6,7 +6,7 @@ const ModalContextProvider = ModalContext.Provider;
6
6
  function useModal() {
7
7
  const ctx = React.useContext(ModalContext);
8
8
  if (!ctx) {
9
- throw new Error("useModal hook was called outside of context, wrap your app with ModalProvider component");
9
+ throw new Error("useModal() needs a <ModalProvider> around the component that calls it.");
10
10
  }
11
11
  return ctx;
12
12
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useModal.js","sources":["../../../../../src/components/Modal/utils/useModal.ts"],"sourcesContent":["import * as React from 'react';\nimport { ModalContextProps } from '../types';\n\nexport const ModalContext = React.createContext<ModalContextProps>(null as unknown as ModalContextProps);\nexport const ModalContextProvider = ModalContext.Provider;\n\nexport function useModal() {\n const ctx = React.useContext(ModalContext);\n\n if (!ctx) {\n throw new Error('useModal hook was called outside of context, wrap your app with ModalProvider component');\n }\n\n return ctx;\n}\n"],"names":[],"mappings":";;;AACY,MAAC,YAAY,GAAG,KAAK,CAAC,aAAa,CAAC,IAAI;AACxC,MAAC,oBAAoB,GAAG,YAAY,CAAC;AAC1C,SAAS,QAAQ,GAAG;AAC3B,EAAE,MAAM,GAAG,GAAG,KAAK,CAAC,UAAU,CAAC,YAAY,CAAC;AAC5C,EAAE,IAAI,CAAC,GAAG,EAAE;AACZ,IAAI,MAAM,IAAI,KAAK,CAAC,yFAAyF,CAAC;AAC9G,EAAE;AACF,EAAE,OAAO,GAAG;AACZ;;"}
1
+ {"version":3,"file":"useModal.js","sources":["../../../../../src/components/Modal/utils/useModal.ts"],"sourcesContent":["import * as React from 'react';\nimport { ModalContextProps } from '../types';\n\nexport const ModalContext = React.createContext<ModalContextProps | null>(null);\nexport const ModalContextProvider = ModalContext.Provider;\n\n/** The modal of the nearest ModalProvider: the one open (`modal`), `openModal(settings)` and `closeModal()`. */\nexport function useModal(): ModalContextProps {\n const ctx = React.useContext(ModalContext);\n\n if (!ctx) {\n throw new Error('useModal() needs a <ModalProvider> around the component that calls it.');\n }\n\n return ctx;\n}\n"],"names":[],"mappings":";;;AAEY,MAAC,YAAY,GAAG,KAAK,CAAC,aAAa,CAAC,IAAI;AACxC,MAAC,oBAAoB,GAAG,YAAY,CAAC;AAC1C,SAAS,QAAQ,GAAG;AAC3B,EAAE,MAAM,GAAG,GAAG,KAAK,CAAC,UAAU,CAAC,YAAY,CAAC;AAC5C,EAAE,IAAI,CAAC,GAAG,EAAE;AACZ,IAAI,MAAM,IAAI,KAAK,CAAC,wEAAwE,CAAC;AAC7F,EAAE;AACF,EAAE,OAAO,GAAG;AACZ;;"}