@cerberus-design/react 0.8.0 → 0.8.1

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 (378) hide show
  1. package/build/legacy/{_tsup-dts-rollup.d.ts → _tsup-dts-rollup.d.cts} +207 -5
  2. package/build/legacy/aria-helpers/nav-menu.aria.cjs +36 -0
  3. package/build/legacy/aria-helpers/nav-menu.aria.cjs.map +1 -0
  4. package/build/legacy/aria-helpers/tabs.aria.cjs +100 -0
  5. package/build/legacy/aria-helpers/tabs.aria.cjs.map +1 -0
  6. package/build/legacy/aria-helpers/trap-focus.aria.cjs +54 -0
  7. package/build/legacy/aria-helpers/trap-focus.aria.cjs.map +1 -0
  8. package/build/legacy/components/Button.cjs +50 -0
  9. package/build/legacy/components/Button.cjs.map +1 -0
  10. package/build/legacy/components/Checkbox.cjs +157 -0
  11. package/build/legacy/components/Checkbox.cjs.map +1 -0
  12. package/build/legacy/components/Droppable.cjs +54 -0
  13. package/build/legacy/components/Droppable.cjs.map +1 -0
  14. package/build/legacy/components/FeatureFlag.cjs +63 -0
  15. package/build/legacy/components/FeatureFlag.cjs.map +1 -0
  16. package/build/legacy/components/FieldMessage.cjs +59 -0
  17. package/build/legacy/components/FieldMessage.cjs.map +1 -0
  18. package/build/legacy/components/FileStatus.cjs +390 -0
  19. package/build/legacy/components/FileStatus.cjs.map +1 -0
  20. package/build/legacy/components/FileUploader.cjs +159 -0
  21. package/build/legacy/components/FileUploader.cjs.map +1 -0
  22. package/build/legacy/components/IconButton.cjs +53 -0
  23. package/build/legacy/components/IconButton.cjs.map +1 -0
  24. package/build/legacy/components/Input.cjs +145 -0
  25. package/build/legacy/components/Input.cjs.map +1 -0
  26. package/build/legacy/components/Label.cjs +93 -0
  27. package/build/legacy/components/Label.cjs.map +1 -0
  28. package/build/legacy/components/Modal.cjs +45 -0
  29. package/build/legacy/components/Modal.cjs.map +1 -0
  30. package/build/legacy/components/ModalDescription.cjs +36 -0
  31. package/build/legacy/components/ModalDescription.cjs.map +1 -0
  32. package/build/legacy/components/ModalHeader.cjs +49 -0
  33. package/build/legacy/components/ModalHeader.cjs.map +1 -0
  34. package/build/legacy/components/ModalHeading.cjs +36 -0
  35. package/build/legacy/components/ModalHeading.cjs.map +1 -0
  36. package/build/legacy/components/ModalIcon.cjs +51 -0
  37. package/build/legacy/components/ModalIcon.cjs.map +1 -0
  38. package/build/legacy/components/NavMenuLink.cjs +81 -0
  39. package/build/legacy/components/NavMenuLink.cjs.map +1 -0
  40. package/build/legacy/components/NavMenuList.cjs +131 -0
  41. package/build/legacy/components/NavMenuList.cjs.map +1 -0
  42. package/build/legacy/components/NavMenuTrigger.cjs +128 -0
  43. package/build/legacy/components/NavMenuTrigger.cjs.map +1 -0
  44. package/build/legacy/components/Notification.cjs +181 -0
  45. package/build/legacy/components/Notification.cjs.map +1 -0
  46. package/build/legacy/components/NotificationDescription.cjs +44 -0
  47. package/build/legacy/components/NotificationDescription.cjs.map +1 -0
  48. package/build/legacy/components/NotificationHeading.cjs +38 -0
  49. package/build/legacy/components/NotificationHeading.cjs.map +1 -0
  50. package/build/legacy/components/Portal.cjs +35 -0
  51. package/build/legacy/components/Portal.cjs.map +1 -0
  52. package/build/legacy/components/ProgressBar.cjs +61 -0
  53. package/build/legacy/components/ProgressBar.cjs.map +1 -0
  54. package/build/legacy/components/Radio.cjs +68 -0
  55. package/build/legacy/components/Radio.cjs.map +1 -0
  56. package/build/legacy/components/Select.cjs +170 -0
  57. package/build/legacy/components/Select.cjs.map +1 -0
  58. package/build/legacy/components/Show.cjs +40 -0
  59. package/build/legacy/components/Show.cjs.map +1 -0
  60. package/build/legacy/components/Tab.cjs +135 -0
  61. package/build/legacy/components/Tab.cjs.map +1 -0
  62. package/build/legacy/components/TabList.cjs +68 -0
  63. package/build/legacy/components/TabList.cjs.map +1 -0
  64. package/build/legacy/components/TabPanel.cjs +76 -0
  65. package/build/legacy/components/TabPanel.cjs.map +1 -0
  66. package/build/legacy/components/Table.cjs +53 -0
  67. package/build/legacy/components/Table.cjs.map +1 -0
  68. package/build/legacy/components/Tag.cjs +91 -0
  69. package/build/legacy/components/Tag.cjs.map +1 -0
  70. package/build/legacy/components/Tbody.cjs +48 -0
  71. package/build/legacy/components/Tbody.cjs.map +1 -0
  72. package/build/legacy/components/Td.cjs +48 -0
  73. package/build/legacy/components/Td.cjs.map +1 -0
  74. package/build/legacy/components/Textarea.cjs +71 -0
  75. package/build/legacy/components/Textarea.cjs.map +1 -0
  76. package/build/legacy/components/Th.cjs +80 -0
  77. package/build/legacy/components/Th.cjs.map +1 -0
  78. package/build/legacy/components/Thead.cjs +36 -0
  79. package/build/legacy/components/Thead.cjs.map +1 -0
  80. package/build/legacy/components/Toggle.cjs +151 -0
  81. package/build/legacy/components/Toggle.cjs.map +1 -0
  82. package/build/legacy/config/cerbIcons.cjs +88 -0
  83. package/build/legacy/config/cerbIcons.cjs.map +1 -0
  84. package/build/legacy/config/defineIcons.cjs +110 -0
  85. package/build/legacy/config/defineIcons.cjs.map +1 -0
  86. package/build/legacy/config/icons/checkbox.icons.cjs +67 -0
  87. package/build/legacy/config/icons/checkbox.icons.cjs.map +1 -0
  88. package/build/legacy/context/confirm-modal.cjs +371 -0
  89. package/build/legacy/context/confirm-modal.cjs.map +1 -0
  90. package/build/legacy/context/feature-flags.cjs +48 -0
  91. package/build/legacy/context/feature-flags.cjs.map +1 -0
  92. package/build/legacy/context/field.cjs +55 -0
  93. package/build/legacy/context/field.cjs.map +1 -0
  94. package/build/legacy/context/navMenu.cjs +70 -0
  95. package/build/legacy/context/navMenu.cjs.map +1 -0
  96. package/build/legacy/context/notification-center.cjs +347 -0
  97. package/build/legacy/context/notification-center.cjs.map +1 -0
  98. package/build/legacy/context/prompt-modal.cjs +508 -0
  99. package/build/legacy/context/prompt-modal.cjs.map +1 -0
  100. package/build/legacy/context/tabs.cjs +78 -0
  101. package/build/legacy/context/tabs.cjs.map +1 -0
  102. package/build/legacy/context/theme.cjs +104 -0
  103. package/build/legacy/context/theme.cjs.map +1 -0
  104. package/build/legacy/hooks/useModal.cjs +50 -0
  105. package/build/legacy/hooks/useModal.cjs.map +1 -0
  106. package/build/legacy/hooks/useTheme.cjs +87 -0
  107. package/build/legacy/hooks/useTheme.cjs.map +1 -0
  108. package/build/legacy/hooks/useToggle.cjs +47 -0
  109. package/build/legacy/hooks/useToggle.cjs.map +1 -0
  110. package/build/legacy/index.cjs +2165 -0
  111. package/build/legacy/index.cjs.map +1 -0
  112. package/build/legacy/types.cjs +19 -0
  113. package/build/legacy/types.cjs.map +1 -0
  114. package/build/modern/_tsup-dts-rollup.d.ts +207 -5
  115. package/build/{legacy/chunk-JJGZRBIR.js → modern/chunk-2FK7NR7Y.js} +8 -7
  116. package/build/{legacy/chunk-JJGZRBIR.js.map → modern/chunk-2FK7NR7Y.js.map} +1 -1
  117. package/build/modern/chunk-4FD33RTW.js +56 -0
  118. package/build/modern/chunk-4FD33RTW.js.map +1 -0
  119. package/build/modern/{chunk-XB4ZRAH4.js → chunk-53QBTZZF.js} +5 -5
  120. package/build/modern/{chunk-BEYPMC73.js → chunk-5WVXIAG2.js} +2 -2
  121. package/build/modern/chunk-7NX4RGDB.js +218 -0
  122. package/build/modern/chunk-7NX4RGDB.js.map +1 -0
  123. package/build/modern/chunk-CP7OUC2Q.js +42 -0
  124. package/build/modern/chunk-CP7OUC2Q.js.map +1 -0
  125. package/build/modern/{chunk-4N2L357B.js → chunk-EJIMJWPB.js} +2 -2
  126. package/build/{legacy/chunk-GVNPFXKL.js → modern/chunk-GUECLKHY.js} +18 -1
  127. package/build/modern/chunk-GUECLKHY.js.map +1 -0
  128. package/build/modern/{chunk-Y5IY7O23.js → chunk-GZY6CH7D.js} +5 -5
  129. package/build/{legacy/chunk-IL5ELPTT.js → modern/chunk-ID3XWGLY.js} +2 -2
  130. package/build/modern/chunk-RHG26FYL.js +68 -0
  131. package/build/modern/chunk-RHG26FYL.js.map +1 -0
  132. package/build/modern/{chunk-LTDNZRUY.js → chunk-S6CMAXQF.js} +10 -10
  133. package/build/modern/{chunk-IOG6XIR5.js → chunk-TF3HRELU.js} +3 -3
  134. package/build/modern/{chunk-IOG6XIR5.js.map → chunk-TF3HRELU.js.map} +1 -1
  135. package/build/modern/chunk-TYTEREKZ.js +39 -0
  136. package/build/modern/chunk-TYTEREKZ.js.map +1 -0
  137. package/build/{legacy/chunk-JJP2TFTU.js → modern/chunk-VCR5C6Q3.js} +1 -1
  138. package/build/modern/chunk-VCR5C6Q3.js.map +1 -0
  139. package/build/modern/{chunk-QO2UXGW4.js → chunk-VPWBSZAR.js} +2 -2
  140. package/build/modern/components/Checkbox.js +13 -0
  141. package/build/modern/components/FileStatus.js +17 -0
  142. package/build/modern/components/FileUploader.js +4 -3
  143. package/build/modern/components/Input.js +5 -4
  144. package/build/modern/components/Label.js +2 -2
  145. package/build/modern/components/ModalIcon.js +1 -1
  146. package/build/modern/components/Notification.js +4 -3
  147. package/build/modern/components/ProgressBar.js +7 -0
  148. package/build/modern/components/Select.js +15 -0
  149. package/build/modern/components/Toggle.js +4 -3
  150. package/build/modern/config/cerbIcons.js +2 -1
  151. package/build/modern/config/defineIcons.js +3 -2
  152. package/build/modern/config/icons/checkbox.icons.js +9 -0
  153. package/build/modern/context/confirm-modal.js +5 -4
  154. package/build/modern/context/notification-center.js +5 -4
  155. package/build/modern/context/prompt-modal.js +8 -7
  156. package/build/modern/index.js +59 -38
  157. package/build/modern/index.js.map +1 -1
  158. package/package.json +6 -6
  159. package/src/components/Checkbox.tsx +76 -0
  160. package/src/components/FileStatus.tsx +246 -0
  161. package/src/components/FileUploader.tsx +1 -1
  162. package/src/components/Label.tsx +3 -2
  163. package/src/components/ModalIcon.tsx +2 -2
  164. package/src/components/ProgressBar.tsx +61 -0
  165. package/src/components/Select.tsx +96 -0
  166. package/src/config/cerbIcons.ts +20 -0
  167. package/src/config/icons/checkbox.icons.tsx +49 -0
  168. package/src/index.ts +4 -0
  169. package/build/legacy/aria-helpers/nav-menu.aria.js +0 -7
  170. package/build/legacy/aria-helpers/tabs.aria.js +0 -9
  171. package/build/legacy/aria-helpers/trap-focus.aria.js +0 -7
  172. package/build/legacy/chunk-2UFNQM55.js +0 -21
  173. package/build/legacy/chunk-2UFNQM55.js.map +0 -1
  174. package/build/legacy/chunk-2VPKILZ6.js +0 -122
  175. package/build/legacy/chunk-2VPKILZ6.js.map +0 -1
  176. package/build/legacy/chunk-3C2DJSEE.js +0 -16
  177. package/build/legacy/chunk-3C2DJSEE.js.map +0 -1
  178. package/build/legacy/chunk-3GXISGPS.js +0 -47
  179. package/build/legacy/chunk-3GXISGPS.js.map +0 -1
  180. package/build/legacy/chunk-4CAT3FHV.js +0 -11
  181. package/build/legacy/chunk-4CAT3FHV.js.map +0 -1
  182. package/build/legacy/chunk-4M3EUP57.js +0 -22
  183. package/build/legacy/chunk-4M3EUP57.js.map +0 -1
  184. package/build/legacy/chunk-4M4LCQ43.js +0 -12
  185. package/build/legacy/chunk-4M4LCQ43.js.map +0 -1
  186. package/build/legacy/chunk-4O4QFF4S.js +0 -15
  187. package/build/legacy/chunk-4O4QFF4S.js.map +0 -1
  188. package/build/legacy/chunk-55J6XMHW.js +0 -1
  189. package/build/legacy/chunk-6DIGPXAD.js +0 -48
  190. package/build/legacy/chunk-6DIGPXAD.js.map +0 -1
  191. package/build/legacy/chunk-6F34A7NZ.js +0 -28
  192. package/build/legacy/chunk-6F34A7NZ.js.map +0 -1
  193. package/build/legacy/chunk-7VJOPJVX.js +0 -29
  194. package/build/legacy/chunk-7VJOPJVX.js.map +0 -1
  195. package/build/legacy/chunk-A5WYZVUR.js +0 -28
  196. package/build/legacy/chunk-A5WYZVUR.js.map +0 -1
  197. package/build/legacy/chunk-AAKIOHAX.js +0 -155
  198. package/build/legacy/chunk-AAKIOHAX.js.map +0 -1
  199. package/build/legacy/chunk-BEYPMC73.js +0 -27
  200. package/build/legacy/chunk-EVEEQRH6.js +0 -58
  201. package/build/legacy/chunk-EVEEQRH6.js.map +0 -1
  202. package/build/legacy/chunk-GKUDLVOV.js +0 -64
  203. package/build/legacy/chunk-GKUDLVOV.js.map +0 -1
  204. package/build/legacy/chunk-GVNPFXKL.js.map +0 -1
  205. package/build/legacy/chunk-HW76XVA3.js +0 -22
  206. package/build/legacy/chunk-HW76XVA3.js.map +0 -1
  207. package/build/legacy/chunk-ISPTI4GC.js +0 -32
  208. package/build/legacy/chunk-ISPTI4GC.js.map +0 -1
  209. package/build/legacy/chunk-JB7IQ2BM.js +0 -12
  210. package/build/legacy/chunk-JB7IQ2BM.js.map +0 -1
  211. package/build/legacy/chunk-JF76VIL3.js +0 -12
  212. package/build/legacy/chunk-JF76VIL3.js.map +0 -1
  213. package/build/legacy/chunk-JJP2TFTU.js.map +0 -1
  214. package/build/legacy/chunk-KESKDLX6.js +0 -30
  215. package/build/legacy/chunk-KESKDLX6.js.map +0 -1
  216. package/build/legacy/chunk-KF24CS4S.js +0 -58
  217. package/build/legacy/chunk-KF24CS4S.js.map +0 -1
  218. package/build/legacy/chunk-KJUCHZHV.js +0 -51
  219. package/build/legacy/chunk-KJUCHZHV.js.map +0 -1
  220. package/build/legacy/chunk-L46XIE3D.js +0 -208
  221. package/build/legacy/chunk-L46XIE3D.js.map +0 -1
  222. package/build/legacy/chunk-LF2QFS5S.js +0 -76
  223. package/build/legacy/chunk-N3FUF4TB.js +0 -12
  224. package/build/legacy/chunk-N3FUF4TB.js.map +0 -1
  225. package/build/legacy/chunk-NE5NHILF.js +0 -47
  226. package/build/legacy/chunk-NE5NHILF.js.map +0 -1
  227. package/build/legacy/chunk-PH64POOB.js +0 -33
  228. package/build/legacy/chunk-PH64POOB.js.map +0 -1
  229. package/build/legacy/chunk-PJ3744I6.js +0 -24
  230. package/build/legacy/chunk-PJ3744I6.js.map +0 -1
  231. package/build/legacy/chunk-PMCYXRAH.js +0 -86
  232. package/build/legacy/chunk-PMCYXRAH.js.map +0 -1
  233. package/build/legacy/chunk-QU7UV5DB.js +0 -25
  234. package/build/legacy/chunk-QU7UV5DB.js.map +0 -1
  235. package/build/legacy/chunk-RPZAPUCF.js +0 -81
  236. package/build/legacy/chunk-RPZAPUCF.js.map +0 -1
  237. package/build/legacy/chunk-SCQVXJBT.js +0 -22
  238. package/build/legacy/chunk-SCQVXJBT.js.map +0 -1
  239. package/build/legacy/chunk-SLHX5K6I.js +0 -29
  240. package/build/legacy/chunk-SLHX5K6I.js.map +0 -1
  241. package/build/legacy/chunk-SMCEFK6Q.js +0 -63
  242. package/build/legacy/chunk-SMCEFK6Q.js.map +0 -1
  243. package/build/legacy/chunk-SXXWC6UD.js +0 -83
  244. package/build/legacy/chunk-SXXWC6UD.js.map +0 -1
  245. package/build/legacy/chunk-TCO46FK7.js +0 -36
  246. package/build/legacy/chunk-TCO46FK7.js.map +0 -1
  247. package/build/legacy/chunk-TZNYJ3G7.js +0 -25
  248. package/build/legacy/chunk-TZNYJ3G7.js.map +0 -1
  249. package/build/legacy/chunk-U72VPIZA.js +0 -32
  250. package/build/legacy/chunk-U72VPIZA.js.map +0 -1
  251. package/build/legacy/chunk-VGHVH2T3.js +0 -24
  252. package/build/legacy/chunk-VGHVH2T3.js.map +0 -1
  253. package/build/legacy/chunk-VULPMZUW.js +0 -18
  254. package/build/legacy/chunk-VULPMZUW.js.map +0 -1
  255. package/build/legacy/chunk-XB4ZRAH4.js +0 -42
  256. package/build/legacy/chunk-XREC5IJE.js +0 -24
  257. package/build/legacy/chunk-XREC5IJE.js.map +0 -1
  258. package/build/legacy/chunk-ZAU4JVLL.js +0 -33
  259. package/build/legacy/chunk-ZAU4JVLL.js.map +0 -1
  260. package/build/legacy/components/Button.js +0 -7
  261. package/build/legacy/components/Droppable.js +0 -8
  262. package/build/legacy/components/Droppable.js.map +0 -1
  263. package/build/legacy/components/FeatureFlag.js +0 -10
  264. package/build/legacy/components/FeatureFlag.js.map +0 -1
  265. package/build/legacy/components/FieldMessage.js +0 -9
  266. package/build/legacy/components/FieldMessage.js.map +0 -1
  267. package/build/legacy/components/FileUploader.js +0 -11
  268. package/build/legacy/components/FileUploader.js.map +0 -1
  269. package/build/legacy/components/IconButton.js +0 -7
  270. package/build/legacy/components/IconButton.js.map +0 -1
  271. package/build/legacy/components/Input.js +0 -12
  272. package/build/legacy/components/Input.js.map +0 -1
  273. package/build/legacy/components/Label.js +0 -10
  274. package/build/legacy/components/Label.js.map +0 -1
  275. package/build/legacy/components/Modal.js +0 -7
  276. package/build/legacy/components/Modal.js.map +0 -1
  277. package/build/legacy/components/ModalDescription.js +0 -7
  278. package/build/legacy/components/ModalDescription.js.map +0 -1
  279. package/build/legacy/components/ModalHeader.js +0 -7
  280. package/build/legacy/components/ModalHeader.js.map +0 -1
  281. package/build/legacy/components/ModalHeading.js +0 -7
  282. package/build/legacy/components/ModalHeading.js.map +0 -1
  283. package/build/legacy/components/ModalIcon.js +0 -7
  284. package/build/legacy/components/ModalIcon.js.map +0 -1
  285. package/build/legacy/components/NavMenuLink.js +0 -8
  286. package/build/legacy/components/NavMenuLink.js.map +0 -1
  287. package/build/legacy/components/NavMenuList.js +0 -12
  288. package/build/legacy/components/NavMenuList.js.map +0 -1
  289. package/build/legacy/components/NavMenuTrigger.js +0 -11
  290. package/build/legacy/components/NavMenuTrigger.js.map +0 -1
  291. package/build/legacy/components/Notification.js +0 -11
  292. package/build/legacy/components/Notification.js.map +0 -1
  293. package/build/legacy/components/NotificationDescription.js +0 -7
  294. package/build/legacy/components/NotificationDescription.js.map +0 -1
  295. package/build/legacy/components/NotificationHeading.js +0 -7
  296. package/build/legacy/components/NotificationHeading.js.map +0 -1
  297. package/build/legacy/components/Portal.js +0 -7
  298. package/build/legacy/components/Portal.js.map +0 -1
  299. package/build/legacy/components/Radio.js +0 -9
  300. package/build/legacy/components/Radio.js.map +0 -1
  301. package/build/legacy/components/Show.js +0 -8
  302. package/build/legacy/components/Show.js.map +0 -1
  303. package/build/legacy/components/Tab.js +0 -10
  304. package/build/legacy/components/Tab.js.map +0 -1
  305. package/build/legacy/components/TabList.js +0 -9
  306. package/build/legacy/components/TabList.js.map +0 -1
  307. package/build/legacy/components/TabPanel.js +0 -10
  308. package/build/legacy/components/TabPanel.js.map +0 -1
  309. package/build/legacy/components/Table.js +0 -9
  310. package/build/legacy/components/Table.js.map +0 -1
  311. package/build/legacy/components/Tag.js +0 -8
  312. package/build/legacy/components/Tag.js.map +0 -1
  313. package/build/legacy/components/Tbody.js +0 -7
  314. package/build/legacy/components/Tbody.js.map +0 -1
  315. package/build/legacy/components/Td.js +0 -7
  316. package/build/legacy/components/Td.js.map +0 -1
  317. package/build/legacy/components/Textarea.js +0 -9
  318. package/build/legacy/components/Textarea.js.map +0 -1
  319. package/build/legacy/components/Th.js +0 -8
  320. package/build/legacy/components/Th.js.map +0 -1
  321. package/build/legacy/components/Thead.js +0 -7
  322. package/build/legacy/components/Thead.js.map +0 -1
  323. package/build/legacy/components/Toggle.js +0 -11
  324. package/build/legacy/components/Toggle.js.map +0 -1
  325. package/build/legacy/config/cerbIcons.js +0 -7
  326. package/build/legacy/config/cerbIcons.js.map +0 -1
  327. package/build/legacy/config/defineIcons.js +0 -10
  328. package/build/legacy/config/defineIcons.js.map +0 -1
  329. package/build/legacy/context/confirm-modal.js +0 -22
  330. package/build/legacy/context/confirm-modal.js.map +0 -1
  331. package/build/legacy/context/feature-flags.js +0 -10
  332. package/build/legacy/context/feature-flags.js.map +0 -1
  333. package/build/legacy/context/field.js +0 -10
  334. package/build/legacy/context/field.js.map +0 -1
  335. package/build/legacy/context/navMenu.js +0 -10
  336. package/build/legacy/context/navMenu.js.map +0 -1
  337. package/build/legacy/context/notification-center.js +0 -19
  338. package/build/legacy/context/notification-center.js.map +0 -1
  339. package/build/legacy/context/prompt-modal.js +0 -25
  340. package/build/legacy/context/prompt-modal.js.map +0 -1
  341. package/build/legacy/context/tabs.js +0 -12
  342. package/build/legacy/context/tabs.js.map +0 -1
  343. package/build/legacy/context/theme.js +0 -14
  344. package/build/legacy/context/theme.js.map +0 -1
  345. package/build/legacy/hooks/useModal.js +0 -8
  346. package/build/legacy/hooks/useModal.js.map +0 -1
  347. package/build/legacy/hooks/useTheme.js +0 -8
  348. package/build/legacy/hooks/useTheme.js.map +0 -1
  349. package/build/legacy/hooks/useToggle.js +0 -8
  350. package/build/legacy/hooks/useToggle.js.map +0 -1
  351. package/build/legacy/index.js +0 -226
  352. package/build/legacy/index.js.map +0 -1
  353. package/build/legacy/types.js +0 -2
  354. package/build/legacy/types.js.map +0 -1
  355. package/build/modern/chunk-4N2L357B.js.map +0 -1
  356. package/build/modern/chunk-BEYPMC73.js.map +0 -1
  357. package/build/modern/chunk-GVNPFXKL.js +0 -26
  358. package/build/modern/chunk-GVNPFXKL.js.map +0 -1
  359. package/build/modern/chunk-IL5ELPTT.js +0 -58
  360. package/build/modern/chunk-IL5ELPTT.js.map +0 -1
  361. package/build/modern/chunk-JJGZRBIR.js +0 -49
  362. package/build/modern/chunk-JJGZRBIR.js.map +0 -1
  363. package/build/modern/chunk-JJP2TFTU.js +0 -29
  364. package/build/modern/chunk-JJP2TFTU.js.map +0 -1
  365. package/build/modern/chunk-XB4ZRAH4.js.map +0 -1
  366. /package/build/legacy/{noExternals.d.ts → noExternals.d.cts} +0 -0
  367. /package/build/{legacy/chunk-XB4ZRAH4.js.map → modern/chunk-53QBTZZF.js.map} +0 -0
  368. /package/build/{legacy/chunk-BEYPMC73.js.map → modern/chunk-5WVXIAG2.js.map} +0 -0
  369. /package/build/{legacy/chunk-LF2QFS5S.js.map → modern/chunk-EJIMJWPB.js.map} +0 -0
  370. /package/build/modern/{chunk-Y5IY7O23.js.map → chunk-GZY6CH7D.js.map} +0 -0
  371. /package/build/{legacy/chunk-IL5ELPTT.js.map → modern/chunk-ID3XWGLY.js.map} +0 -0
  372. /package/build/modern/{chunk-LTDNZRUY.js.map → chunk-S6CMAXQF.js.map} +0 -0
  373. /package/build/modern/{chunk-QO2UXGW4.js.map → chunk-VPWBSZAR.js.map} +0 -0
  374. /package/build/{legacy/aria-helpers/nav-menu.aria.js.map → modern/components/Checkbox.js.map} +0 -0
  375. /package/build/{legacy/aria-helpers/tabs.aria.js.map → modern/components/FileStatus.js.map} +0 -0
  376. /package/build/{legacy/aria-helpers/trap-focus.aria.js.map → modern/components/ProgressBar.js.map} +0 -0
  377. /package/build/{legacy/chunk-55J6XMHW.js.map → modern/components/Select.js.map} +0 -0
  378. /package/build/{legacy/components/Button.js.map → modern/config/icons/checkbox.icons.js.map} +0 -0
@@ -1,122 +0,0 @@
1
- import {
2
- Notification
3
- } from "./chunk-LF2QFS5S.js";
4
- import {
5
- NotificationDescription
6
- } from "./chunk-HW76XVA3.js";
7
- import {
8
- NotificationHeading
9
- } from "./chunk-3C2DJSEE.js";
10
- import {
11
- Portal
12
- } from "./chunk-4CAT3FHV.js";
13
- import {
14
- Button
15
- } from "./chunk-6F34A7NZ.js";
16
- import {
17
- Show
18
- } from "./chunk-4O4QFF4S.js";
19
-
20
- // src/context/notification-center.tsx
21
- import {
22
- createContext,
23
- useCallback,
24
- useContext,
25
- useMemo,
26
- useState
27
- } from "react";
28
- import { animateIn, vstack } from "@cerberus/styled-system/patterns";
29
- import { notification } from "@cerberus/styled-system/recipes";
30
- import { cx } from "@cerberus/styled-system/css";
31
- import { jsx, jsxs } from "react/jsx-runtime";
32
- var NotificationsContext = createContext(null);
33
- function NotificationCenter(props) {
34
- const [activeNotifications, setActiveNotifications] = useState([]);
35
- const styles = notification();
36
- const handleNotify = useCallback((options) => {
37
- setActiveNotifications((prev) => {
38
- const id = `${options.palette}:${prev.length + 1}`;
39
- return [...prev, { ...options, id }];
40
- });
41
- }, []);
42
- const handleClose = useCallback((e) => {
43
- const target = e.currentTarget;
44
- setActiveNotifications((prev) => {
45
- const item = prev.find((option) => option.id === target.value);
46
- if (item == null ? void 0 : item.onClose) item.onClose();
47
- return prev.filter((option) => option.id !== target.value);
48
- });
49
- }, []);
50
- const handleCloseAll = useCallback(() => {
51
- setActiveNotifications((prev) => {
52
- prev.forEach((item) => {
53
- if (item.onClose) item.onClose();
54
- });
55
- return [];
56
- });
57
- }, []);
58
- const value = useMemo(
59
- () => ({
60
- notify: handleNotify
61
- }),
62
- [handleNotify]
63
- );
64
- return /* @__PURE__ */ jsxs(NotificationsContext.Provider, { value, children: [
65
- props.children,
66
- /* @__PURE__ */ jsx(Show, { when: activeNotifications.length > 0, children: /* @__PURE__ */ jsx(Portal, { container: props.container, children: /* @__PURE__ */ jsxs("div", { className: styles.center, children: [
67
- /* @__PURE__ */ jsx(Show, { when: activeNotifications.length >= 4, children: /* @__PURE__ */ jsx(
68
- Button,
69
- {
70
- className: cx(styles.closeAll, animateIn()),
71
- onClick: handleCloseAll,
72
- palette: "action",
73
- shape: "rounded",
74
- size: "sm",
75
- usage: "text",
76
- children: "Close all"
77
- }
78
- ) }),
79
- /* @__PURE__ */ jsx(
80
- "div",
81
- {
82
- className: vstack({
83
- alignItems: "flex-end",
84
- gap: "4"
85
- }),
86
- style: {
87
- alignItems: "flex-end"
88
- },
89
- children: activeNotifications.map((option) => /* @__PURE__ */ jsxs(
90
- Notification,
91
- {
92
- id: option.id,
93
- onClose: handleClose,
94
- open: true,
95
- palette: option.palette,
96
- children: [
97
- /* @__PURE__ */ jsx(NotificationHeading, { palette: option.palette, children: option.heading }),
98
- /* @__PURE__ */ jsx(NotificationDescription, { palette: option.palette, children: option.description })
99
- ]
100
- },
101
- option.id
102
- ))
103
- }
104
- )
105
- ] }) }) })
106
- ] });
107
- }
108
- function useNotificationCenter() {
109
- const context = useContext(NotificationsContext);
110
- if (!context) {
111
- throw new Error(
112
- "useNotificationCenter must be used within a NotificationsProvider"
113
- );
114
- }
115
- return context;
116
- }
117
-
118
- export {
119
- NotificationCenter,
120
- useNotificationCenter
121
- };
122
- //# sourceMappingURL=chunk-2VPKILZ6.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/context/notification-center.tsx"],"sourcesContent":["'use client'\n\nimport {\n createContext,\n useCallback,\n useContext,\n useMemo,\n useState,\n type MouseEvent,\n type PropsWithChildren,\n type ReactNode,\n} from 'react'\nimport { Show } from '../components/Show'\nimport { NotificationHeading } from '../components/NotificationHeading'\nimport { NotificationDescription } from '../components/NotificationDescription'\nimport { Notification } from '../components/Notification'\nimport { animateIn, vstack } from '@cerberus/styled-system/patterns'\nimport { Portal, type PortalProps } from '../components/Portal'\nimport { notification } from '@cerberus/styled-system/recipes'\nimport { Button } from '../components/Button'\nimport { cx } from '@cerberus/styled-system/css'\n\n/**\n * This module provides a context and hook for notifications.\n * @module\n */\n\nexport interface NotifyOptions {\n palette: 'info' | 'success' | 'warning' | 'danger'\n heading: string\n id?: string\n description?: ReactNode\n onClose?: () => void\n}\n\nexport interface NotificationsValue {\n notify: (options: NotifyOptions) => void\n}\n\nconst NotificationsContext = createContext<NotificationsValue | null>(null)\n\nexport interface NotificationsProviderProps extends PortalProps {}\n\n/**\n * Provides a notification center to the app.\n * @example\n * ```tsx\n * // Wrap the Provider around the root of the feature.\n * <Notifications>\n * <SomeFeatureSection />\n * </Notifications>\n *\n * // Use the hook to show a notification.\n * const notify = useNotifications()\n *\n * const handleClick = useCallback(() => {\n * notify({\n * palette: 'info',\n * heading: 'New feature!',\n * description: 'We have added a new feature to the app.',\n * })\n * }, [notify])\n * ```\n */\nexport function NotificationCenter(\n props: PropsWithChildren<NotificationsProviderProps>,\n) {\n const [activeNotifications, setActiveNotifications] = useState<\n NotifyOptions[]\n >([])\n const styles = notification()\n\n const handleNotify = useCallback((options: NotifyOptions) => {\n setActiveNotifications((prev) => {\n const id = `${options.palette}:${prev.length + 1}`\n return [...prev, { ...options, id }]\n })\n }, [])\n\n const handleClose = useCallback((e: MouseEvent<HTMLButtonElement>) => {\n const target = e.currentTarget as HTMLButtonElement\n setActiveNotifications((prev) => {\n const item = prev.find((option) => option.id === target.value)\n if (item?.onClose) item.onClose()\n return prev.filter((option) => option.id !== target.value)\n })\n }, [])\n\n const handleCloseAll = useCallback(() => {\n setActiveNotifications((prev) => {\n prev.forEach((item) => {\n if (item.onClose) item.onClose()\n })\n return []\n })\n }, [])\n\n const value = useMemo(\n () => ({\n notify: handleNotify,\n }),\n [handleNotify],\n )\n\n // For some reason, the vstack pattern alignItems is not registering here.\n // So we are forcing it with the style prop.\n\n return (\n <NotificationsContext.Provider value={value}>\n {props.children}\n\n <Show when={activeNotifications.length > 0}>\n <Portal container={props.container}>\n <div className={styles.center}>\n <Show when={activeNotifications.length >= 4}>\n <Button\n className={cx(styles.closeAll, animateIn())}\n onClick={handleCloseAll}\n palette=\"action\"\n shape=\"rounded\"\n size=\"sm\"\n usage=\"text\"\n >\n Close all\n </Button>\n </Show>\n <div\n className={vstack({\n alignItems: 'flex-end',\n gap: '4',\n })}\n style={{\n alignItems: 'flex-end',\n }}\n >\n {activeNotifications.map((option) => (\n <Notification\n id={option.id!}\n key={option.id}\n onClose={handleClose}\n open\n palette={option.palette}\n >\n <NotificationHeading palette={option.palette}>\n {option.heading}\n </NotificationHeading>\n <NotificationDescription palette={option.palette}>\n {option.description}\n </NotificationDescription>\n </Notification>\n ))}\n </div>\n </div>\n </Portal>\n </Show>\n </NotificationsContext.Provider>\n )\n}\n\n/**\n * The hook to use the NotificationCenter.\n * @returns The notify method to trigger a notification.\n * @example\n * ```tsx\n * const {notify} = useNotificationCenter()\n * notify({\n * palette: 'info',\n * heading: 'New feature',\n * description: 'We have added a new feature to the app.',\n * })\n * ```\n */\nexport function useNotificationCenter(): NotificationsValue {\n const context = useContext(NotificationsContext)\n if (!context) {\n throw new Error(\n 'useNotificationCenter must be used within a NotificationsProvider',\n )\n }\n return context\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AAKP,SAAS,WAAW,cAAc;AAElC,SAAS,oBAAoB;AAE7B,SAAS,UAAU;AA+FL,cAqBE,YArBF;AA5Ed,IAAM,uBAAuB,cAAyC,IAAI;AAyBnE,SAAS,mBACd,OACA;AACA,QAAM,CAAC,qBAAqB,sBAAsB,IAAI,SAEpD,CAAC,CAAC;AACJ,QAAM,SAAS,aAAa;AAE5B,QAAM,eAAe,YAAY,CAAC,YAA2B;AAC3D,2BAAuB,CAAC,SAAS;AAC/B,YAAM,KAAK,GAAG,QAAQ,OAAO,IAAI,KAAK,SAAS,CAAC;AAChD,aAAO,CAAC,GAAG,MAAM,EAAE,GAAG,SAAS,GAAG,CAAC;AAAA,IACrC,CAAC;AAAA,EACH,GAAG,CAAC,CAAC;AAEL,QAAM,cAAc,YAAY,CAAC,MAAqC;AACpE,UAAM,SAAS,EAAE;AACjB,2BAAuB,CAAC,SAAS;AAC/B,YAAM,OAAO,KAAK,KAAK,CAAC,WAAW,OAAO,OAAO,OAAO,KAAK;AAC7D,UAAI,6BAAM,QAAS,MAAK,QAAQ;AAChC,aAAO,KAAK,OAAO,CAAC,WAAW,OAAO,OAAO,OAAO,KAAK;AAAA,IAC3D,CAAC;AAAA,EACH,GAAG,CAAC,CAAC;AAEL,QAAM,iBAAiB,YAAY,MAAM;AACvC,2BAAuB,CAAC,SAAS;AAC/B,WAAK,QAAQ,CAAC,SAAS;AACrB,YAAI,KAAK,QAAS,MAAK,QAAQ;AAAA,MACjC,CAAC;AACD,aAAO,CAAC;AAAA,IACV,CAAC;AAAA,EACH,GAAG,CAAC,CAAC;AAEL,QAAM,QAAQ;AAAA,IACZ,OAAO;AAAA,MACL,QAAQ;AAAA,IACV;AAAA,IACA,CAAC,YAAY;AAAA,EACf;AAKA,SACE,qBAAC,qBAAqB,UAArB,EAA8B,OAC5B;AAAA,UAAM;AAAA,IAEP,oBAAC,QAAK,MAAM,oBAAoB,SAAS,GACvC,8BAAC,UAAO,WAAW,MAAM,WACvB,+BAAC,SAAI,WAAW,OAAO,QACrB;AAAA,0BAAC,QAAK,MAAM,oBAAoB,UAAU,GACxC;AAAA,QAAC;AAAA;AAAA,UACC,WAAW,GAAG,OAAO,UAAU,UAAU,CAAC;AAAA,UAC1C,SAAS;AAAA,UACT,SAAQ;AAAA,UACR,OAAM;AAAA,UACN,MAAK;AAAA,UACL,OAAM;AAAA,UACP;AAAA;AAAA,MAED,GACF;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACC,WAAW,OAAO;AAAA,YAChB,YAAY;AAAA,YACZ,KAAK;AAAA,UACP,CAAC;AAAA,UACD,OAAO;AAAA,YACL,YAAY;AAAA,UACd;AAAA,UAEC,8BAAoB,IAAI,CAAC,WACxB;AAAA,YAAC;AAAA;AAAA,cACC,IAAI,OAAO;AAAA,cAEX,SAAS;AAAA,cACT,MAAI;AAAA,cACJ,SAAS,OAAO;AAAA,cAEhB;AAAA,oCAAC,uBAAoB,SAAS,OAAO,SAClC,iBAAO,SACV;AAAA,gBACA,oBAAC,2BAAwB,SAAS,OAAO,SACtC,iBAAO,aACV;AAAA;AAAA;AAAA,YAVK,OAAO;AAAA,UAWd,CACD;AAAA;AAAA,MACH;AAAA,OACF,GACF,GACF;AAAA,KACF;AAEJ;AAeO,SAAS,wBAA4C;AAC1D,QAAM,UAAU,WAAW,oBAAoB;AAC/C,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
@@ -1,16 +0,0 @@
1
- // src/components/NotificationHeading.tsx
2
- import { cx } from "@cerberus/styled-system/css";
3
- import {
4
- notification
5
- } from "@cerberus/styled-system/recipes";
6
- import { jsx } from "react/jsx-runtime";
7
- function NotificationHeading(props) {
8
- const { palette, ...nativeProps } = props;
9
- const styles = notification({ palette });
10
- return /* @__PURE__ */ jsx("p", { className: cx(nativeProps.className, styles.heading), ...nativeProps });
11
- }
12
-
13
- export {
14
- NotificationHeading
15
- };
16
- //# sourceMappingURL=chunk-3C2DJSEE.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/NotificationHeading.tsx"],"sourcesContent":["/**\n * This module exports the NotificationHeading component.\n * @module\n */\n\nimport { cx } from '@cerberus/styled-system/css'\nimport {\n notification,\n type NotificationVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport type { HTMLAttributes } from 'react'\n\nexport interface BaseNotificationHeadingProps\n extends HTMLAttributes<HTMLParagraphElement> {}\nexport type NotificationHeadingProps = BaseNotificationHeadingProps &\n NotificationVariantProps\n\n/**\n * The NotificationHeading component is used to render the heading of a notification.\n * @param props - The anything a HTMLParagraphElement can accept.\n */\nexport function NotificationHeading(props: NotificationHeadingProps) {\n const { palette, ...nativeProps } = props\n const styles = notification({ palette })\n return (\n <p className={cx(nativeProps.className, styles.heading)} {...nativeProps} />\n )\n}\n"],"mappings":";AAKA,SAAS,UAAU;AACnB;AAAA,EACE;AAAA,OAEK;AAgBH;AAJG,SAAS,oBAAoB,OAAiC;AACnE,QAAM,EAAE,SAAS,GAAG,YAAY,IAAI;AACpC,QAAM,SAAS,aAAa,EAAE,QAAQ,CAAC;AACvC,SACE,oBAAC,OAAE,WAAW,GAAG,YAAY,WAAW,OAAO,OAAO,GAAI,GAAG,aAAa;AAE9E;","names":[]}
@@ -1,47 +0,0 @@
1
- import {
2
- Show
3
- } from "./chunk-4O4QFF4S.js";
4
-
5
- // src/components/Th.tsx
6
- import { css, cx } from "@cerberus/styled-system/css";
7
- import { th } from "@cerberus/styled-system/recipes";
8
- import { jsx } from "react/jsx-runtime";
9
- function Th(props) {
10
- const { size, onClick, ...nativeProps } = props;
11
- return /* @__PURE__ */ jsx(
12
- Show,
13
- {
14
- when: Boolean(onClick),
15
- fallback: /* @__PURE__ */ jsx(
16
- "th",
17
- {
18
- ...nativeProps,
19
- className: cx(nativeProps.className, th({ size }))
20
- }
21
- ),
22
- children: /* @__PURE__ */ jsx("th", { ...nativeProps, children: /* @__PURE__ */ jsx(
23
- "button",
24
- {
25
- className: cx(
26
- nativeProps.className,
27
- th({ size }),
28
- css({
29
- alignItems: "center",
30
- display: "inline-flex",
31
- justifyContent: "space-between",
32
- userSelect: "none",
33
- w: "full"
34
- })
35
- ),
36
- onClick,
37
- children: props.children
38
- }
39
- ) })
40
- }
41
- );
42
- }
43
-
44
- export {
45
- Th
46
- };
47
- //# sourceMappingURL=chunk-3GXISGPS.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/Th.tsx"],"sourcesContent":["import { css, cx } from '@cerberus/styled-system/css'\nimport { th, type ThVariantProps } from '@cerberus/styled-system/recipes'\nimport type { MouseEvent, TableHTMLAttributes } from 'react'\nimport { Show } from './Show'\n\n/**\n * Th component for the Table component\n * @module\n */\n\nexport type ThBaseProps = TableHTMLAttributes<HTMLTableCellElement> & {\n onClick?: (e: MouseEvent<HTMLButtonElement>) => void\n}\nexport type ThProps = ThBaseProps & ThVariantProps\n\n/**\n * Styles for the Th component\n * @definition [Table docs](https://cerberus.digitalu.design/react/table)\n * @example\n * ```tsx\n * <Th>Header 1</Th>\n * ```\n */\nexport function Th(props: ThProps) {\n const { size, onClick, ...nativeProps } = props\n return (\n <Show\n when={Boolean(onClick)}\n fallback={\n <th\n {...nativeProps}\n className={cx(nativeProps.className, th({ size }))}\n />\n }\n >\n <th {...nativeProps}>\n <button\n className={cx(\n nativeProps.className,\n th({ size }),\n css({\n alignItems: 'center',\n display: 'inline-flex',\n justifyContent: 'space-between',\n userSelect: 'none',\n w: 'full',\n }),\n )}\n onClick={onClick}\n >\n {props.children}\n </button>\n </th>\n </Show>\n )\n}\n"],"mappings":";;;;;AAAA,SAAS,KAAK,UAAU;AACxB,SAAS,UAA+B;AA4BhC;AAND,SAAS,GAAG,OAAgB;AACjC,QAAM,EAAE,MAAM,SAAS,GAAG,YAAY,IAAI;AAC1C,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAM,QAAQ,OAAO;AAAA,MACrB,UACE;AAAA,QAAC;AAAA;AAAA,UACE,GAAG;AAAA,UACJ,WAAW,GAAG,YAAY,WAAW,GAAG,EAAE,KAAK,CAAC,CAAC;AAAA;AAAA,MACnD;AAAA,MAGF,8BAAC,QAAI,GAAG,aACN;AAAA,QAAC;AAAA;AAAA,UACC,WAAW;AAAA,YACT,YAAY;AAAA,YACZ,GAAG,EAAE,KAAK,CAAC;AAAA,YACX,IAAI;AAAA,cACF,YAAY;AAAA,cACZ,SAAS;AAAA,cACT,gBAAgB;AAAA,cAChB,YAAY;AAAA,cACZ,GAAG;AAAA,YACL,CAAC;AAAA,UACH;AAAA,UACA;AAAA,UAEC,gBAAM;AAAA;AAAA,MACT,GACF;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -1,11 +0,0 @@
1
- // src/components/Portal.tsx
2
- import { createPortal } from "react-dom";
3
- function Portal(props) {
4
- const container = props.container || document.body;
5
- return createPortal(props.children, container, props.key);
6
- }
7
-
8
- export {
9
- Portal
10
- };
11
- //# sourceMappingURL=chunk-4CAT3FHV.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/Portal.tsx"],"sourcesContent":["import type { PropsWithChildren } from 'react'\nimport { createPortal } from 'react-dom'\n\n/**\n * This module is the Portal component.\n * @module\n */\n\nexport interface PortalProps {\n container?: Element | DocumentFragment\n key?: null | string\n}\n\n/**\n * The Portal component is used to render children into a DOM node that exists outside the DOM hierarchy of the parent component.\n * @param container - The props for the Portal component.\n * @returns ReactPortal\n */\nexport function Portal(props: PropsWithChildren<PortalProps>) {\n const container = props.container || document.body\n return createPortal(props.children, container, props.key)\n}\n"],"mappings":";AACA,SAAS,oBAAoB;AAiBtB,SAAS,OAAO,OAAuC;AAC5D,QAAM,YAAY,MAAM,aAAa,SAAS;AAC9C,SAAO,aAAa,MAAM,UAAU,WAAW,MAAM,GAAG;AAC1D;","names":[]}
@@ -1,22 +0,0 @@
1
- // src/context/feature-flags.tsx
2
- import { createContext, useContext } from "react";
3
- import { jsx } from "react/jsx-runtime";
4
- var FeatureFlagContext = createContext(null);
5
- function FeatureFlags(props) {
6
- return /* @__PURE__ */ jsx(FeatureFlagContext.Provider, { value: props.flags, children: props.children });
7
- }
8
- function useFeatureFlags(key) {
9
- const context = useContext(FeatureFlagContext);
10
- if (context === null) {
11
- throw new Error(
12
- "useFeatureFlag must be used within a FeatureFlags Provider"
13
- );
14
- }
15
- return context[key] ?? false;
16
- }
17
-
18
- export {
19
- FeatureFlags,
20
- useFeatureFlags
21
- };
22
- //# sourceMappingURL=chunk-4M3EUP57.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/context/feature-flags.tsx"],"sourcesContent":["'use client'\n\nimport { createContext, useContext, type PropsWithChildren } from 'react'\n\n/**\n * This module provides a context and hook for feature flags.\n * @module\n */\n\nexport interface FeatureFlagValue {\n [key: string]: boolean\n}\n\nconst FeatureFlagContext = createContext<FeatureFlagValue | null>(null)\n\nexport interface FeatureFlagProviderProps {\n flags: FeatureFlagValue\n}\n\n/**\n * Provides feature flags to the application.\n * @param flags - The flags data for the provider.\n * @example\n * ```tsx\n * // This should be a JSON file or a server response.\n * const flags = {\n * featureOne: true,\n * featureTwo: false\n * }\n *\n * // Wrap the Provider around the root of your application.\n * <FeatureFlags flags={flags}>\n * <FeatureFlag flag=\"featureOne\">\n * This is visible.\n * </FeatureFlag>\n * <FeatureFlag flag=\"featureTwo\">\n * This is hidden.\n * </FeatureFlag>\n * </FeatureFlags>\n * ```\n */\nexport function FeatureFlags(\n props: PropsWithChildren<FeatureFlagProviderProps>,\n) {\n return (\n <FeatureFlagContext.Provider value={props.flags}>\n {props.children}\n </FeatureFlagContext.Provider>\n )\n}\n\nexport function useFeatureFlags(key: string): boolean {\n const context = useContext(FeatureFlagContext)\n if (context === null) {\n throw new Error(\n 'useFeatureFlag must be used within a FeatureFlags Provider',\n )\n }\n return context[key] ?? false\n}\n"],"mappings":";AAEA,SAAS,eAAe,kBAA0C;AA2C9D;AAhCJ,IAAM,qBAAqB,cAAuC,IAAI;AA4B/D,SAAS,aACd,OACA;AACA,SACE,oBAAC,mBAAmB,UAAnB,EAA4B,OAAO,MAAM,OACvC,gBAAM,UACT;AAEJ;AAEO,SAAS,gBAAgB,KAAsB;AACpD,QAAM,UAAU,WAAW,kBAAkB;AAC7C,MAAI,YAAY,MAAM;AACpB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,SAAO,QAAQ,GAAG,KAAK;AACzB;","names":[]}
@@ -1,12 +0,0 @@
1
- // src/components/ModalDescription.tsx
2
- import { cx } from "@cerberus/styled-system/css";
3
- import { modal } from "@cerberus/styled-system/recipes";
4
- import { jsx } from "react/jsx-runtime";
5
- function ModalDescription(props) {
6
- return /* @__PURE__ */ jsx("p", { ...props, className: cx(props.className, modal().description) });
7
- }
8
-
9
- export {
10
- ModalDescription
11
- };
12
- //# sourceMappingURL=chunk-4M4LCQ43.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/ModalDescription.tsx"],"sourcesContent":["import { cx } from '@cerberus/styled-system/css'\nimport { modal } from '@cerberus/styled-system/recipes'\nimport type { HTMLAttributes } from 'react'\n\n/**\n * This module contains the ModalDescription component for a customizable modal.\n * @module\n */\n\nexport type ModalDescriptionProps = HTMLAttributes<HTMLParagraphElement>\n\n/**\n * The ModalDescription component is a heading element for a customizable modal.\n * @example\n * ```tsx\n * <Modal>\n * <ModalDescription>Modal Heading</ModalDescription>\n * </Modal>\n * ```\n */\nexport function ModalDescription(props: ModalDescriptionProps) {\n return <p {...props} className={cx(props.className, modal().description)} />\n}\n"],"mappings":";AAAA,SAAS,UAAU;AACnB,SAAS,aAAa;AAoBb;AADF,SAAS,iBAAiB,OAA8B;AAC7D,SAAO,oBAAC,OAAG,GAAG,OAAO,WAAW,GAAG,MAAM,WAAW,MAAM,EAAE,WAAW,GAAG;AAC5E;","names":[]}
@@ -1,15 +0,0 @@
1
- // src/components/Show.tsx
2
- import { useMemo } from "react";
3
- function Show(props) {
4
- const { when, children, fallback } = props;
5
- const condition = useMemo(() => when ?? false, [when]);
6
- return useMemo(() => {
7
- if (condition) return children;
8
- return fallback ?? null;
9
- }, [condition, children, fallback]);
10
- }
11
-
12
- export {
13
- Show
14
- };
15
- //# sourceMappingURL=chunk-4O4QFF4S.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/Show.tsx"],"sourcesContent":["'use client'\n\nimport { useMemo, type PropsWithChildren, type ReactNode } from 'react'\n\nexport interface ShowProps {\n when: boolean | null | undefined\n fallback?: ReactNode\n}\n\n/**\n * Conditionally render its children or an optional fallback component\n * based on the SolidJS component.\n * @definition [Show docs](https://cerberus.digitalu.design/react/show)\n * @example\n * ```tsx\n * <Show when={condition}>\n * <div>Content</div>\n * </Show>\n */\nexport function Show(props: PropsWithChildren<ShowProps>): ReactNode {\n const { when, children, fallback } = props\n const condition = useMemo(() => when ?? false, [when])\n\n return useMemo(() => {\n if (condition) return children\n return fallback ?? null\n }, [condition, children, fallback])\n}\n"],"mappings":";AAEA,SAAS,eAAuD;AAiBzD,SAAS,KAAK,OAAgD;AACnE,QAAM,EAAE,MAAM,UAAU,SAAS,IAAI;AACrC,QAAM,YAAY,QAAQ,MAAM,QAAQ,OAAO,CAAC,IAAI,CAAC;AAErD,SAAO,QAAQ,MAAM;AACnB,QAAI,UAAW,QAAO;AACtB,WAAO,YAAY;AAAA,EACrB,GAAG,CAAC,WAAW,UAAU,QAAQ,CAAC;AACpC;","names":[]}
@@ -1 +0,0 @@
1
- //# sourceMappingURL=chunk-55J6XMHW.js.map
@@ -1,48 +0,0 @@
1
- import {
2
- Show
3
- } from "./chunk-4O4QFF4S.js";
4
-
5
- // src/components/NavMenuLink.tsx
6
- import { css, cx } from "@cerberus/styled-system/css";
7
- import { jsx } from "react/jsx-runtime";
8
- function NavMenuLink(props) {
9
- const { as, ...nativeProps } = props;
10
- const hasAs = Boolean(as);
11
- const AsSub = as;
12
- return /* @__PURE__ */ jsx(
13
- "li",
14
- {
15
- className: css({
16
- w: "full"
17
- }),
18
- children: /* @__PURE__ */ jsx(
19
- Show,
20
- {
21
- when: hasAs,
22
- fallback: /* @__PURE__ */ jsx(
23
- "a",
24
- {
25
- ...nativeProps,
26
- className: cx(
27
- nativeProps.className,
28
- css({
29
- color: "action.navigation.initial",
30
- textStyle: "link",
31
- _hover: {
32
- color: "action.navigation.hover"
33
- }
34
- })
35
- )
36
- }
37
- ),
38
- children: hasAs && /* @__PURE__ */ jsx(AsSub, { ...nativeProps })
39
- }
40
- )
41
- }
42
- );
43
- }
44
-
45
- export {
46
- NavMenuLink
47
- };
48
- //# sourceMappingURL=chunk-6DIGPXAD.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/NavMenuLink.tsx"],"sourcesContent":["import type { AnchorHTMLAttributes, ElementType } from 'react'\nimport { css, cx } from '@cerberus/styled-system/css'\nimport { Show } from './Show'\n\nexport interface NavMenuLinkProps\n extends AnchorHTMLAttributes<HTMLAnchorElement> {\n as?: ElementType\n}\n\nexport function NavMenuLink(props: NavMenuLinkProps): JSX.Element {\n const { as, ...nativeProps } = props\n const hasAs = Boolean(as)\n const AsSub: ElementType = as!\n\n return (\n <li\n className={css({\n w: 'full',\n })}\n >\n <Show\n when={hasAs}\n fallback={\n <a\n {...nativeProps}\n className={cx(\n nativeProps.className,\n css({\n color: 'action.navigation.initial',\n textStyle: 'link',\n _hover: {\n color: 'action.navigation.hover',\n },\n }),\n )}\n />\n }\n >\n {hasAs && <AsSub {...nativeProps} />}\n </Show>\n </li>\n )\n}\n"],"mappings":";;;;;AACA,SAAS,KAAK,UAAU;AAsBd;AAdH,SAAS,YAAY,OAAsC;AAChE,QAAM,EAAE,IAAI,GAAG,YAAY,IAAI;AAC/B,QAAM,QAAQ,QAAQ,EAAE;AACxB,QAAM,QAAqB;AAE3B,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,IAAI;AAAA,QACb,GAAG;AAAA,MACL,CAAC;AAAA,MAED;AAAA,QAAC;AAAA;AAAA,UACC,MAAM;AAAA,UACN,UACE;AAAA,YAAC;AAAA;AAAA,cACE,GAAG;AAAA,cACJ,WAAW;AAAA,gBACT,YAAY;AAAA,gBACZ,IAAI;AAAA,kBACF,OAAO;AAAA,kBACP,WAAW;AAAA,kBACX,QAAQ;AAAA,oBACN,OAAO;AAAA,kBACT;AAAA,gBACF,CAAC;AAAA,cACH;AAAA;AAAA,UACF;AAAA,UAGD,mBAAS,oBAAC,SAAO,GAAG,aAAa;AAAA;AAAA,MACpC;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -1,28 +0,0 @@
1
- // src/components/Button.tsx
2
- import { cx } from "@cerberus/styled-system/css";
3
- import {
4
- button
5
- } from "@cerberus/styled-system/recipes";
6
- import { jsx } from "react/jsx-runtime";
7
- function Button(props) {
8
- const { palette, usage, shape, ...nativeProps } = props;
9
- return /* @__PURE__ */ jsx(
10
- "button",
11
- {
12
- ...nativeProps,
13
- className: cx(
14
- nativeProps.className,
15
- button({
16
- palette,
17
- usage,
18
- shape
19
- })
20
- )
21
- }
22
- );
23
- }
24
-
25
- export {
26
- Button
27
- };
28
- //# sourceMappingURL=chunk-6F34A7NZ.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/Button.tsx"],"sourcesContent":["import type { ButtonHTMLAttributes } from 'react'\nimport { cx } from '@cerberus/styled-system/css'\nimport {\n button,\n type ButtonVariantProps,\n} from '@cerberus/styled-system/recipes'\n\n/**\n * This module contains the Button component.\n * @module\n */\n\nexport type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> &\n ButtonVariantProps\n\n/**\n * A component that allows the user to perform actions\n * @description https://github.com/omnifed/cerberus/blob/main/packages/react/src/components/Button.tsx\n */\nexport function Button(props: ButtonProps): JSX.Element {\n const { palette, usage, shape, ...nativeProps } = props\n return (\n <button\n {...nativeProps}\n className={cx(\n nativeProps.className,\n button({\n palette,\n usage,\n shape,\n }),\n )}\n />\n )\n}\n"],"mappings":";AACA,SAAS,UAAU;AACnB;AAAA,EACE;AAAA,OAEK;AAiBH;AAHG,SAAS,OAAO,OAAiC;AACtD,QAAM,EAAE,SAAS,OAAO,OAAO,GAAG,YAAY,IAAI;AAClD,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW;AAAA,QACT,YAAY;AAAA,QACZ,OAAO;AAAA,UACL;AAAA,UACA;AAAA,UACA;AAAA,QACF,CAAC;AAAA,MACH;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -1,29 +0,0 @@
1
- // src/components/Droppable.tsx
2
- import { useDroppable } from "@dnd-kit/core";
3
- import { useId } from "react";
4
- import { jsx } from "react/jsx-runtime";
5
- function Droppable(props) {
6
- const { dropped, id, disabled, data, resizeObserverConfig, ...nativeProps } = props;
7
- const uuid = useId();
8
- const { isOver, setNodeRef } = useDroppable({
9
- data,
10
- disabled,
11
- id: id || uuid,
12
- resizeObserverConfig
13
- });
14
- return /* @__PURE__ */ jsx(
15
- "div",
16
- {
17
- ...nativeProps,
18
- "data-over": isOver,
19
- "data-dropped": dropped,
20
- ref: setNodeRef,
21
- children: props.children
22
- }
23
- );
24
- }
25
-
26
- export {
27
- Droppable
28
- };
29
- //# sourceMappingURL=chunk-7VJOPJVX.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/Droppable.tsx"],"sourcesContent":["'use client'\n\nimport { useDroppable, type UseDroppableArguments } from '@dnd-kit/core'\nimport { useId, type HtmlHTMLAttributes, type PropsWithChildren } from 'react'\n\nexport interface DroppableProps\n extends Omit<HtmlHTMLAttributes<HTMLDivElement>, 'id'>,\n UseDroppableArguments {\n dropped?: boolean\n}\n\nexport function Droppable(props: PropsWithChildren<DroppableProps>) {\n const { dropped, id, disabled, data, resizeObserverConfig, ...nativeProps } =\n props\n const uuid = useId()\n const { isOver, setNodeRef } = useDroppable({\n data,\n disabled,\n id: id || uuid,\n resizeObserverConfig,\n })\n\n return (\n <div\n {...nativeProps}\n data-over={isOver}\n data-dropped={dropped}\n ref={setNodeRef}\n >\n {props.children}\n </div>\n )\n}\n"],"mappings":";AAEA,SAAS,oBAAgD;AACzD,SAAS,aAA8D;AAoBnE;AAZG,SAAS,UAAU,OAA0C;AAClE,QAAM,EAAE,SAAS,IAAI,UAAU,MAAM,sBAAsB,GAAG,YAAY,IACxE;AACF,QAAM,OAAO,MAAM;AACnB,QAAM,EAAE,QAAQ,WAAW,IAAI,aAAa;AAAA,IAC1C;AAAA,IACA;AAAA,IACA,IAAI,MAAM;AAAA,IACV;AAAA,EACF,CAAC;AAED,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,aAAW;AAAA,MACX,gBAAc;AAAA,MACd,KAAK;AAAA,MAEJ,gBAAM;AAAA;AAAA,EACT;AAEJ;","names":[]}
@@ -1,28 +0,0 @@
1
- // src/components/Table.tsx
2
- import { cx } from "@cerberus/styled-system/css";
3
- import { table } from "@cerberus/styled-system/recipes";
4
- import { jsx, jsxs } from "react/jsx-runtime";
5
- function Table(props) {
6
- const { caption, children, ...nativeProps } = props;
7
- const styles = table();
8
- return /* @__PURE__ */ jsx("div", { className: styles.container, children: /* @__PURE__ */ jsxs(
9
- "table",
10
- {
11
- ...nativeProps,
12
- className: cx(nativeProps.className, styles.table),
13
- children: [
14
- /* @__PURE__ */ jsx("caption", { className: styles.caption, children: caption }),
15
- children
16
- ]
17
- }
18
- ) });
19
- }
20
- function Tr(props) {
21
- return /* @__PURE__ */ jsx("tr", { ...props });
22
- }
23
-
24
- export {
25
- Table,
26
- Tr
27
- };
28
- //# sourceMappingURL=chunk-A5WYZVUR.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/Table.tsx"],"sourcesContent":["import { cx } from '@cerberus/styled-system/css'\nimport { table } from '@cerberus/styled-system/recipes'\nimport type { PropsWithChildren, TableHTMLAttributes } from 'react'\n\n/**\n * This module contains the table component.\n * @module\n */\n\nexport interface TableProps extends TableHTMLAttributes<HTMLTableElement> {\n caption: string\n}\n\n/**\n * The Table component is used to render a table.\n * @definition [Table docs](https://cerberus.digitalu.design/react/table)\n * @prop caption - An easy to understand description of the table.\n * @example\n * ```tsx\n * <Table caption=\"Basic Table\">\n * {children}\n * </Table>\n * ```\n */\nexport function Table(props: PropsWithChildren<TableProps>) {\n const { caption, children, ...nativeProps } = props\n const styles = table()\n\n return (\n <div className={styles.container}>\n <table\n {...nativeProps}\n className={cx(nativeProps.className, styles.table)}\n >\n <caption className={styles.caption}>{caption}</caption>\n {children}\n </table>\n </div>\n )\n}\n\n// We only provide this for consistency with the rest of the components\n\nexport type TrProps = TableHTMLAttributes<HTMLTableRowElement>\n\n/**\n * The Tr component is used to render a table row.\n * @definition [Table docs](https://cerberus.digitalu.design/react/table)\n * @example\n * ```tsx\n * <Tr>\n * {children}\n * </Tr>\n * ```\n */\nexport function Tr(props: PropsWithChildren<TrProps>) {\n return <tr {...props} />\n}\n"],"mappings":";AAAA,SAAS,UAAU;AACnB,SAAS,aAAa;AA6BhB,SAIE,KAJF;AANC,SAAS,MAAM,OAAsC;AAC1D,QAAM,EAAE,SAAS,UAAU,GAAG,YAAY,IAAI;AAC9C,QAAM,SAAS,MAAM;AAErB,SACE,oBAAC,SAAI,WAAW,OAAO,WACrB;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW,GAAG,YAAY,WAAW,OAAO,KAAK;AAAA,MAEjD;AAAA,4BAAC,aAAQ,WAAW,OAAO,SAAU,mBAAQ;AAAA,QAC5C;AAAA;AAAA;AAAA,EACH,GACF;AAEJ;AAgBO,SAAS,GAAG,OAAmC;AACpD,SAAO,oBAAC,QAAI,GAAG,OAAO;AACxB;","names":[]}
@@ -1,155 +0,0 @@
1
- import {
2
- Portal
3
- } from "./chunk-4CAT3FHV.js";
4
- import {
5
- Modal
6
- } from "./chunk-2UFNQM55.js";
7
- import {
8
- ModalDescription
9
- } from "./chunk-4M4LCQ43.js";
10
- import {
11
- ModalHeader
12
- } from "./chunk-QU7UV5DB.js";
13
- import {
14
- ModalHeading
15
- } from "./chunk-JB7IQ2BM.js";
16
- import {
17
- ModalIcon
18
- } from "./chunk-JJP2TFTU.js";
19
- import {
20
- Button
21
- } from "./chunk-6F34A7NZ.js";
22
- import {
23
- Show
24
- } from "./chunk-4O4QFF4S.js";
25
- import {
26
- trapFocus
27
- } from "./chunk-KESKDLX6.js";
28
- import {
29
- $cerberusIcons
30
- } from "./chunk-BEYPMC73.js";
31
- import {
32
- useModal
33
- } from "./chunk-TZNYJ3G7.js";
34
-
35
- // src/context/confirm-modal.tsx
36
- import {
37
- createContext,
38
- useCallback,
39
- useContext,
40
- useMemo,
41
- useRef,
42
- useState
43
- } from "react";
44
- import { css } from "@cerberus/styled-system/css";
45
- import { hstack } from "@cerberus/styled-system/patterns";
46
- import { jsx, jsxs } from "react/jsx-runtime";
47
- var ConfirmModalContext = createContext(null);
48
- function ConfirmModal(props) {
49
- const { modalRef, show, close } = useModal();
50
- const resolveRef = useRef(null);
51
- const [content, setContent] = useState(null);
52
- const focusTrap = trapFocus(modalRef);
53
- const ConfirmIcon = $cerberusIcons.confirmModal;
54
- const palette = useMemo(
55
- () => (content == null ? void 0 : content.kind) === "destructive" ? "danger" : "action",
56
- [content]
57
- );
58
- const handleChoice = useCallback(
59
- (e) => {
60
- var _a, _b;
61
- const target = e.currentTarget;
62
- if (target.value === "true") {
63
- (_a = resolveRef.current) == null ? void 0 : _a.call(resolveRef, true);
64
- }
65
- (_b = resolveRef.current) == null ? void 0 : _b.call(resolveRef, false);
66
- close();
67
- },
68
- [close]
69
- );
70
- const handleShow = useCallback(
71
- (options) => {
72
- return new Promise((resolve) => {
73
- setContent({ ...options, kind: options.kind || "non-destructive" });
74
- show();
75
- resolveRef.current = resolve;
76
- });
77
- },
78
- [show]
79
- );
80
- const value = useMemo(
81
- () => ({
82
- show: handleShow
83
- }),
84
- [handleShow]
85
- );
86
- return /* @__PURE__ */ jsxs(ConfirmModalContext.Provider, { value, children: [
87
- props.children,
88
- /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsxs(Modal, { onKeyDown: focusTrap, ref: modalRef, children: [
89
- /* @__PURE__ */ jsxs(ModalHeader, { children: [
90
- /* @__PURE__ */ jsx(
91
- Show,
92
- {
93
- when: palette === "danger",
94
- fallback: /* @__PURE__ */ jsx(ModalIcon, { palette: "action", children: /* @__PURE__ */ jsx(ConfirmIcon, { size: 24 }) }),
95
- children: /* @__PURE__ */ jsx(ModalIcon, { palette: "danger", children: /* @__PURE__ */ jsx(ConfirmIcon, { size: 24 }) })
96
- }
97
- ),
98
- /* @__PURE__ */ jsx(ModalHeading, { children: content == null ? void 0 : content.heading }),
99
- /* @__PURE__ */ jsx(ModalDescription, { children: content == null ? void 0 : content.description })
100
- ] }),
101
- /* @__PURE__ */ jsxs(
102
- "div",
103
- {
104
- className: hstack({
105
- gap: "4"
106
- }),
107
- children: [
108
- /* @__PURE__ */ jsx(
109
- Button,
110
- {
111
- autoFocus: true,
112
- className: css({
113
- w: "1/2"
114
- }),
115
- name: "confirm",
116
- onClick: handleChoice,
117
- palette,
118
- value: "true",
119
- children: content == null ? void 0 : content.actionText
120
- }
121
- ),
122
- /* @__PURE__ */ jsx(
123
- Button,
124
- {
125
- className: css({
126
- w: "1/2"
127
- }),
128
- name: "cancel",
129
- onClick: handleChoice,
130
- usage: "outlined",
131
- value: "false",
132
- children: content == null ? void 0 : content.cancelText
133
- }
134
- )
135
- ]
136
- }
137
- )
138
- ] }) })
139
- ] });
140
- }
141
- function useConfirmModal() {
142
- const context = useContext(ConfirmModalContext);
143
- if (context === null) {
144
- throw new Error(
145
- "useConfirmModal must be used within a ConfirmModal Provider"
146
- );
147
- }
148
- return context;
149
- }
150
-
151
- export {
152
- ConfirmModal,
153
- useConfirmModal
154
- };
155
- //# sourceMappingURL=chunk-AAKIOHAX.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/context/confirm-modal.tsx"],"sourcesContent":["'use client'\n\nimport {\n createContext,\n useCallback,\n useContext,\n useMemo,\n useRef,\n useState,\n type MouseEvent,\n type PropsWithChildren,\n} from 'react'\nimport { Portal } from '../components/Portal'\nimport { Button } from '../components/Button'\nimport { css } from '@cerberus/styled-system/css'\nimport { hstack } from '@cerberus/styled-system/patterns'\nimport { $cerberusIcons } from '../config/defineIcons'\nimport { trapFocus } from '../aria-helpers/trap-focus.aria'\nimport { ModalIcon } from '../components/ModalIcon'\nimport { Show } from '../components/Show'\nimport { Modal } from '../components/Modal'\nimport { useModal } from '../hooks/useModal'\nimport { ModalHeader } from '../components/ModalHeader'\nimport { ModalHeading } from '../components/ModalHeading'\nimport { ModalDescription } from '../components/ModalDescription'\n\n/**\n * This module provides a context and hook for the confirm modal.\n * @module\n */\n\nexport interface ShowConfirmModalOptions {\n kind?: 'destructive' | 'non-destructive'\n heading: string\n description?: string\n actionText: string\n cancelText: string\n}\nexport type ShowResult =\n | ((value: boolean | PromiseLike<boolean>) => void)\n | null\n\nexport interface ConfirmModalValue {\n show: (options: ShowConfirmModalOptions) => Promise<boolean>\n}\n\nconst ConfirmModalContext = createContext<ConfirmModalValue | null>(null)\n\nexport interface ConfirmModalProviderProps {}\n\n/**\n * Provides a confirm modal to the app.\n * @example\n * ```tsx\n * // Wrap the Provider around the root of the feature.\n * <ConfirmModal>\n * <SomeFeatureSection />\n * </ConfirmModal>\n *\n * // Use the hook to show the confirm modal.\n * const confirm = useConfirmModal()\n *\n * const handleClick = useCallback(async () => {\n * const userConsent = await confirm.show({\n * heading: 'Add new payment method?',\n * description:\n * 'This will add a new payment method to your account to be billed for future purchases.',\n * actionText: 'Yes, add payment method',\n * cancelText: 'No, cancel',\n * })\n * setConsent(userConsent)\n * }, [confirm])\n * ```\n */\nexport function ConfirmModal(\n props: PropsWithChildren<ConfirmModalProviderProps>,\n) {\n const { modalRef, show, close } = useModal()\n const resolveRef = useRef<ShowResult>(null)\n const [content, setContent] = useState<ShowConfirmModalOptions | null>(null)\n const focusTrap = trapFocus(modalRef)\n const ConfirmIcon = $cerberusIcons.confirmModal\n\n const palette = useMemo(\n () => (content?.kind === 'destructive' ? 'danger' : 'action'),\n [content],\n )\n\n const handleChoice = useCallback(\n (e: MouseEvent<HTMLButtonElement>) => {\n const target = e.currentTarget as HTMLButtonElement\n if (target.value === 'true') {\n resolveRef.current?.(true)\n }\n resolveRef.current?.(false)\n close()\n },\n [close],\n )\n\n const handleShow = useCallback(\n (options: ShowConfirmModalOptions) => {\n return new Promise<boolean>((resolve) => {\n setContent({ ...options, kind: options.kind || 'non-destructive' })\n show()\n resolveRef.current = resolve\n })\n },\n [show],\n )\n\n const value = useMemo(\n () => ({\n show: handleShow,\n }),\n [handleShow],\n )\n\n return (\n <ConfirmModalContext.Provider value={value}>\n {props.children}\n\n <Portal>\n <Modal onKeyDown={focusTrap} ref={modalRef}>\n <ModalHeader>\n <Show\n when={palette === 'danger'}\n fallback={\n <ModalIcon palette=\"action\">\n <ConfirmIcon size={24} />\n </ModalIcon>\n }\n >\n <ModalIcon palette=\"danger\">\n <ConfirmIcon size={24} />\n </ModalIcon>\n </Show>\n <ModalHeading>{content?.heading}</ModalHeading>\n <ModalDescription>{content?.description}</ModalDescription>\n </ModalHeader>\n\n <div\n className={hstack({\n gap: '4',\n })}\n >\n <Button\n autoFocus\n className={css({\n w: '1/2',\n })}\n name=\"confirm\"\n onClick={handleChoice}\n palette={palette}\n value=\"true\"\n >\n {content?.actionText}\n </Button>\n <Button\n className={css({\n w: '1/2',\n })}\n name=\"cancel\"\n onClick={handleChoice}\n usage=\"outlined\"\n value=\"false\"\n >\n {content?.cancelText}\n </Button>\n </div>\n </Modal>\n </Portal>\n </ConfirmModalContext.Provider>\n )\n}\n\nexport function useConfirmModal(): ConfirmModalValue {\n const context = useContext(ConfirmModalContext)\n if (context === null) {\n throw new Error(\n 'useConfirmModal must be used within a ConfirmModal Provider',\n )\n }\n return context\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AAGP,SAAS,WAAW;AACpB,SAAS,cAAc;AA6Gb,SAKQ,KALR;AA9EV,IAAM,sBAAsB,cAAwC,IAAI;AA4BjE,SAAS,aACd,OACA;AACA,QAAM,EAAE,UAAU,MAAM,MAAM,IAAI,SAAS;AAC3C,QAAM,aAAa,OAAmB,IAAI;AAC1C,QAAM,CAAC,SAAS,UAAU,IAAI,SAAyC,IAAI;AAC3E,QAAM,YAAY,UAAU,QAAQ;AACpC,QAAM,cAAc,eAAe;AAEnC,QAAM,UAAU;AAAA,IACd,OAAO,mCAAS,UAAS,gBAAgB,WAAW;AAAA,IACpD,CAAC,OAAO;AAAA,EACV;AAEA,QAAM,eAAe;AAAA,IACnB,CAAC,MAAqC;AAzF1C;AA0FM,YAAM,SAAS,EAAE;AACjB,UAAI,OAAO,UAAU,QAAQ;AAC3B,yBAAW,YAAX,oCAAqB;AAAA,MACvB;AACA,uBAAW,YAAX,oCAAqB;AACrB,YAAM;AAAA,IACR;AAAA,IACA,CAAC,KAAK;AAAA,EACR;AAEA,QAAM,aAAa;AAAA,IACjB,CAAC,YAAqC;AACpC,aAAO,IAAI,QAAiB,CAAC,YAAY;AACvC,mBAAW,EAAE,GAAG,SAAS,MAAM,QAAQ,QAAQ,kBAAkB,CAAC;AAClE,aAAK;AACL,mBAAW,UAAU;AAAA,MACvB,CAAC;AAAA,IACH;AAAA,IACA,CAAC,IAAI;AAAA,EACP;AAEA,QAAM,QAAQ;AAAA,IACZ,OAAO;AAAA,MACL,MAAM;AAAA,IACR;AAAA,IACA,CAAC,UAAU;AAAA,EACb;AAEA,SACE,qBAAC,oBAAoB,UAApB,EAA6B,OAC3B;AAAA,UAAM;AAAA,IAEP,oBAAC,UACC,+BAAC,SAAM,WAAW,WAAW,KAAK,UAChC;AAAA,2BAAC,eACC;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,MAAM,YAAY;AAAA,YAClB,UACE,oBAAC,aAAU,SAAQ,UACjB,8BAAC,eAAY,MAAM,IAAI,GACzB;AAAA,YAGF,8BAAC,aAAU,SAAQ,UACjB,8BAAC,eAAY,MAAM,IAAI,GACzB;AAAA;AAAA,QACF;AAAA,QACA,oBAAC,gBAAc,6CAAS,SAAQ;AAAA,QAChC,oBAAC,oBAAkB,6CAAS,aAAY;AAAA,SAC1C;AAAA,MAEA;AAAA,QAAC;AAAA;AAAA,UACC,WAAW,OAAO;AAAA,YAChB,KAAK;AAAA,UACP,CAAC;AAAA,UAED;AAAA;AAAA,cAAC;AAAA;AAAA,gBACC,WAAS;AAAA,gBACT,WAAW,IAAI;AAAA,kBACb,GAAG;AAAA,gBACL,CAAC;AAAA,gBACD,MAAK;AAAA,gBACL,SAAS;AAAA,gBACT;AAAA,gBACA,OAAM;AAAA,gBAEL,6CAAS;AAAA;AAAA,YACZ;AAAA,YACA;AAAA,cAAC;AAAA;AAAA,gBACC,WAAW,IAAI;AAAA,kBACb,GAAG;AAAA,gBACL,CAAC;AAAA,gBACD,MAAK;AAAA,gBACL,SAAS;AAAA,gBACT,OAAM;AAAA,gBACN,OAAM;AAAA,gBAEL,6CAAS;AAAA;AAAA,YACZ;AAAA;AAAA;AAAA,MACF;AAAA,OACF,GACF;AAAA,KACF;AAEJ;AAEO,SAAS,kBAAqC;AACnD,QAAM,UAAU,WAAW,mBAAmB;AAC9C,MAAI,YAAY,MAAM;AACpB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;","names":[]}