@cerberus-design/react 0.8.0-next-4b2aad4 → 0.8.1-next-956775c

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 (335) hide show
  1. package/build/legacy/aria-helpers/nav-menu.aria.cjs +36 -0
  2. package/build/legacy/aria-helpers/nav-menu.aria.cjs.map +1 -0
  3. package/build/legacy/aria-helpers/tabs.aria.cjs +100 -0
  4. package/build/legacy/aria-helpers/tabs.aria.cjs.map +1 -0
  5. package/build/legacy/aria-helpers/trap-focus.aria.cjs +54 -0
  6. package/build/legacy/aria-helpers/trap-focus.aria.cjs.map +1 -0
  7. package/build/legacy/components/Button.cjs +50 -0
  8. package/build/legacy/components/Button.cjs.map +1 -0
  9. package/build/legacy/components/Checkbox.cjs +157 -0
  10. package/build/legacy/components/Checkbox.cjs.map +1 -0
  11. package/build/legacy/components/Droppable.cjs +54 -0
  12. package/build/legacy/components/Droppable.cjs.map +1 -0
  13. package/build/legacy/components/FeatureFlag.cjs +63 -0
  14. package/build/legacy/components/FeatureFlag.cjs.map +1 -0
  15. package/build/legacy/components/FieldMessage.cjs +59 -0
  16. package/build/legacy/components/FieldMessage.cjs.map +1 -0
  17. package/build/legacy/components/FileStatus.cjs +390 -0
  18. package/build/legacy/components/FileStatus.cjs.map +1 -0
  19. package/build/legacy/components/FileUploader.cjs +159 -0
  20. package/build/legacy/components/FileUploader.cjs.map +1 -0
  21. package/build/legacy/components/IconButton.cjs +53 -0
  22. package/build/legacy/components/IconButton.cjs.map +1 -0
  23. package/build/legacy/components/Input.cjs +145 -0
  24. package/build/legacy/components/Input.cjs.map +1 -0
  25. package/build/legacy/components/Label.cjs +93 -0
  26. package/build/legacy/components/Label.cjs.map +1 -0
  27. package/build/legacy/components/Modal.cjs +45 -0
  28. package/build/legacy/components/Modal.cjs.map +1 -0
  29. package/build/legacy/components/ModalDescription.cjs +36 -0
  30. package/build/legacy/components/ModalDescription.cjs.map +1 -0
  31. package/build/legacy/components/ModalHeader.cjs +49 -0
  32. package/build/legacy/components/ModalHeader.cjs.map +1 -0
  33. package/build/legacy/components/ModalHeading.cjs +36 -0
  34. package/build/legacy/components/ModalHeading.cjs.map +1 -0
  35. package/build/legacy/components/ModalIcon.cjs +51 -0
  36. package/build/legacy/components/ModalIcon.cjs.map +1 -0
  37. package/build/legacy/components/NavMenuLink.cjs +81 -0
  38. package/build/legacy/components/NavMenuLink.cjs.map +1 -0
  39. package/build/legacy/components/NavMenuList.cjs +131 -0
  40. package/build/legacy/components/NavMenuList.cjs.map +1 -0
  41. package/build/legacy/components/NavMenuTrigger.cjs +128 -0
  42. package/build/legacy/components/NavMenuTrigger.cjs.map +1 -0
  43. package/build/legacy/components/Notification.cjs +181 -0
  44. package/build/legacy/components/Notification.cjs.map +1 -0
  45. package/build/legacy/components/NotificationDescription.cjs +44 -0
  46. package/build/legacy/components/NotificationDescription.cjs.map +1 -0
  47. package/build/legacy/components/NotificationHeading.cjs +38 -0
  48. package/build/legacy/components/NotificationHeading.cjs.map +1 -0
  49. package/build/legacy/components/Portal.cjs +35 -0
  50. package/build/legacy/components/Portal.cjs.map +1 -0
  51. package/build/legacy/components/ProgressBar.cjs +61 -0
  52. package/build/legacy/components/ProgressBar.cjs.map +1 -0
  53. package/build/legacy/components/Radio.cjs +68 -0
  54. package/build/legacy/components/Radio.cjs.map +1 -0
  55. package/build/legacy/components/Select.cjs +170 -0
  56. package/build/legacy/components/Select.cjs.map +1 -0
  57. package/build/legacy/components/Show.cjs +40 -0
  58. package/build/legacy/components/Show.cjs.map +1 -0
  59. package/build/legacy/components/Tab.cjs +135 -0
  60. package/build/legacy/components/Tab.cjs.map +1 -0
  61. package/build/legacy/components/TabList.cjs +68 -0
  62. package/build/legacy/components/TabList.cjs.map +1 -0
  63. package/build/legacy/components/TabPanel.cjs +76 -0
  64. package/build/legacy/components/TabPanel.cjs.map +1 -0
  65. package/build/legacy/components/Table.cjs +53 -0
  66. package/build/legacy/components/Table.cjs.map +1 -0
  67. package/build/legacy/components/Tag.cjs +91 -0
  68. package/build/legacy/components/Tag.cjs.map +1 -0
  69. package/build/legacy/components/Tbody.cjs +48 -0
  70. package/build/legacy/components/Tbody.cjs.map +1 -0
  71. package/build/legacy/components/Td.cjs +48 -0
  72. package/build/legacy/components/Td.cjs.map +1 -0
  73. package/build/legacy/components/Textarea.cjs +71 -0
  74. package/build/legacy/components/Textarea.cjs.map +1 -0
  75. package/build/legacy/components/Th.cjs +80 -0
  76. package/build/legacy/components/Th.cjs.map +1 -0
  77. package/build/legacy/components/Thead.cjs +36 -0
  78. package/build/legacy/components/Thead.cjs.map +1 -0
  79. package/build/legacy/components/Toggle.cjs +151 -0
  80. package/build/legacy/components/Toggle.cjs.map +1 -0
  81. package/build/legacy/config/cerbIcons.cjs +88 -0
  82. package/build/legacy/config/cerbIcons.cjs.map +1 -0
  83. package/build/legacy/config/defineIcons.cjs +110 -0
  84. package/build/legacy/config/defineIcons.cjs.map +1 -0
  85. package/build/legacy/config/icons/checkbox.icons.cjs +67 -0
  86. package/build/legacy/config/icons/checkbox.icons.cjs.map +1 -0
  87. package/build/legacy/context/confirm-modal.cjs +371 -0
  88. package/build/legacy/context/confirm-modal.cjs.map +1 -0
  89. package/build/legacy/context/feature-flags.cjs +48 -0
  90. package/build/legacy/context/feature-flags.cjs.map +1 -0
  91. package/build/legacy/context/field.cjs +55 -0
  92. package/build/legacy/context/field.cjs.map +1 -0
  93. package/build/legacy/context/navMenu.cjs +70 -0
  94. package/build/legacy/context/navMenu.cjs.map +1 -0
  95. package/build/legacy/context/notification-center.cjs +347 -0
  96. package/build/legacy/context/notification-center.cjs.map +1 -0
  97. package/build/legacy/context/prompt-modal.cjs +508 -0
  98. package/build/legacy/context/prompt-modal.cjs.map +1 -0
  99. package/build/legacy/context/tabs.cjs +78 -0
  100. package/build/legacy/context/tabs.cjs.map +1 -0
  101. package/build/legacy/context/theme.cjs +104 -0
  102. package/build/legacy/context/theme.cjs.map +1 -0
  103. package/build/legacy/hooks/useModal.cjs +50 -0
  104. package/build/legacy/hooks/useModal.cjs.map +1 -0
  105. package/build/legacy/hooks/useTheme.cjs +87 -0
  106. package/build/legacy/hooks/useTheme.cjs.map +1 -0
  107. package/build/legacy/hooks/useToggle.cjs +47 -0
  108. package/build/legacy/hooks/useToggle.cjs.map +1 -0
  109. package/build/legacy/index.cjs +2165 -0
  110. package/build/legacy/index.cjs.map +1 -0
  111. package/build/legacy/types.cjs +19 -0
  112. package/build/legacy/types.cjs.map +1 -0
  113. package/package.json +7 -7
  114. package/build/legacy/aria-helpers/nav-menu.aria.js +0 -7
  115. package/build/legacy/aria-helpers/nav-menu.aria.js.map +0 -1
  116. package/build/legacy/aria-helpers/tabs.aria.js +0 -9
  117. package/build/legacy/aria-helpers/tabs.aria.js.map +0 -1
  118. package/build/legacy/aria-helpers/trap-focus.aria.js +0 -7
  119. package/build/legacy/aria-helpers/trap-focus.aria.js.map +0 -1
  120. package/build/legacy/chunk-23UPROCG.js +0 -63
  121. package/build/legacy/chunk-23UPROCG.js.map +0 -1
  122. package/build/legacy/chunk-2FK7NR7Y.js +0 -50
  123. package/build/legacy/chunk-2FK7NR7Y.js.map +0 -1
  124. package/build/legacy/chunk-2UFNQM55.js +0 -21
  125. package/build/legacy/chunk-2UFNQM55.js.map +0 -1
  126. package/build/legacy/chunk-3C2DJSEE.js +0 -16
  127. package/build/legacy/chunk-3C2DJSEE.js.map +0 -1
  128. package/build/legacy/chunk-3GXISGPS.js +0 -47
  129. package/build/legacy/chunk-3GXISGPS.js.map +0 -1
  130. package/build/legacy/chunk-3RRNMPFC.js +0 -122
  131. package/build/legacy/chunk-3RRNMPFC.js.map +0 -1
  132. package/build/legacy/chunk-4CAT3FHV.js +0 -11
  133. package/build/legacy/chunk-4CAT3FHV.js.map +0 -1
  134. package/build/legacy/chunk-4FD33RTW.js +0 -56
  135. package/build/legacy/chunk-4FD33RTW.js.map +0 -1
  136. package/build/legacy/chunk-4M3EUP57.js +0 -22
  137. package/build/legacy/chunk-4M3EUP57.js.map +0 -1
  138. package/build/legacy/chunk-4M4LCQ43.js +0 -12
  139. package/build/legacy/chunk-4M4LCQ43.js.map +0 -1
  140. package/build/legacy/chunk-4O4QFF4S.js +0 -15
  141. package/build/legacy/chunk-4O4QFF4S.js.map +0 -1
  142. package/build/legacy/chunk-53QBTZZF.js +0 -42
  143. package/build/legacy/chunk-53QBTZZF.js.map +0 -1
  144. package/build/legacy/chunk-55J6XMHW.js +0 -1
  145. package/build/legacy/chunk-55J6XMHW.js.map +0 -1
  146. package/build/legacy/chunk-5WVXIAG2.js +0 -27
  147. package/build/legacy/chunk-5WVXIAG2.js.map +0 -1
  148. package/build/legacy/chunk-6DIGPXAD.js +0 -48
  149. package/build/legacy/chunk-6DIGPXAD.js.map +0 -1
  150. package/build/legacy/chunk-6F34A7NZ.js +0 -28
  151. package/build/legacy/chunk-6F34A7NZ.js.map +0 -1
  152. package/build/legacy/chunk-7NX4RGDB.js +0 -218
  153. package/build/legacy/chunk-7NX4RGDB.js.map +0 -1
  154. package/build/legacy/chunk-7VJOPJVX.js +0 -29
  155. package/build/legacy/chunk-7VJOPJVX.js.map +0 -1
  156. package/build/legacy/chunk-A5WYZVUR.js +0 -28
  157. package/build/legacy/chunk-A5WYZVUR.js.map +0 -1
  158. package/build/legacy/chunk-CP7OUC2Q.js +0 -42
  159. package/build/legacy/chunk-CP7OUC2Q.js.map +0 -1
  160. package/build/legacy/chunk-EVEEQRH6.js +0 -58
  161. package/build/legacy/chunk-EVEEQRH6.js.map +0 -1
  162. package/build/legacy/chunk-GKUDLVOV.js +0 -64
  163. package/build/legacy/chunk-GKUDLVOV.js.map +0 -1
  164. package/build/legacy/chunk-GUECLKHY.js +0 -43
  165. package/build/legacy/chunk-GUECLKHY.js.map +0 -1
  166. package/build/legacy/chunk-HW76XVA3.js +0 -22
  167. package/build/legacy/chunk-HW76XVA3.js.map +0 -1
  168. package/build/legacy/chunk-ID3XWGLY.js +0 -58
  169. package/build/legacy/chunk-ID3XWGLY.js.map +0 -1
  170. package/build/legacy/chunk-ISPTI4GC.js +0 -32
  171. package/build/legacy/chunk-ISPTI4GC.js.map +0 -1
  172. package/build/legacy/chunk-JB7IQ2BM.js +0 -12
  173. package/build/legacy/chunk-JB7IQ2BM.js.map +0 -1
  174. package/build/legacy/chunk-JF76VIL3.js +0 -12
  175. package/build/legacy/chunk-JF76VIL3.js.map +0 -1
  176. package/build/legacy/chunk-JHAI4ZHG.js +0 -76
  177. package/build/legacy/chunk-JHAI4ZHG.js.map +0 -1
  178. package/build/legacy/chunk-KESKDLX6.js +0 -30
  179. package/build/legacy/chunk-KESKDLX6.js.map +0 -1
  180. package/build/legacy/chunk-KF24CS4S.js +0 -58
  181. package/build/legacy/chunk-KF24CS4S.js.map +0 -1
  182. package/build/legacy/chunk-KJUCHZHV.js +0 -51
  183. package/build/legacy/chunk-KJUCHZHV.js.map +0 -1
  184. package/build/legacy/chunk-KUQZECNS.js +0 -155
  185. package/build/legacy/chunk-KUQZECNS.js.map +0 -1
  186. package/build/legacy/chunk-N3FUF4TB.js +0 -12
  187. package/build/legacy/chunk-N3FUF4TB.js.map +0 -1
  188. package/build/legacy/chunk-NE5NHILF.js +0 -47
  189. package/build/legacy/chunk-NE5NHILF.js.map +0 -1
  190. package/build/legacy/chunk-PH64POOB.js +0 -33
  191. package/build/legacy/chunk-PH64POOB.js.map +0 -1
  192. package/build/legacy/chunk-PJ3744I6.js +0 -24
  193. package/build/legacy/chunk-PJ3744I6.js.map +0 -1
  194. package/build/legacy/chunk-PMCYXRAH.js +0 -86
  195. package/build/legacy/chunk-PMCYXRAH.js.map +0 -1
  196. package/build/legacy/chunk-QU7UV5DB.js +0 -25
  197. package/build/legacy/chunk-QU7UV5DB.js.map +0 -1
  198. package/build/legacy/chunk-RHG26FYL.js +0 -68
  199. package/build/legacy/chunk-RHG26FYL.js.map +0 -1
  200. package/build/legacy/chunk-RPZAPUCF.js +0 -81
  201. package/build/legacy/chunk-RPZAPUCF.js.map +0 -1
  202. package/build/legacy/chunk-SCQVXJBT.js +0 -22
  203. package/build/legacy/chunk-SCQVXJBT.js.map +0 -1
  204. package/build/legacy/chunk-SLHX5K6I.js +0 -29
  205. package/build/legacy/chunk-SLHX5K6I.js.map +0 -1
  206. package/build/legacy/chunk-SXXWC6UD.js +0 -83
  207. package/build/legacy/chunk-SXXWC6UD.js.map +0 -1
  208. package/build/legacy/chunk-TCO46FK7.js +0 -36
  209. package/build/legacy/chunk-TCO46FK7.js.map +0 -1
  210. package/build/legacy/chunk-TJI2SJCZ.js +0 -208
  211. package/build/legacy/chunk-TJI2SJCZ.js.map +0 -1
  212. package/build/legacy/chunk-TYTEREKZ.js +0 -39
  213. package/build/legacy/chunk-TYTEREKZ.js.map +0 -1
  214. package/build/legacy/chunk-TZNYJ3G7.js +0 -25
  215. package/build/legacy/chunk-TZNYJ3G7.js.map +0 -1
  216. package/build/legacy/chunk-U72VPIZA.js +0 -32
  217. package/build/legacy/chunk-U72VPIZA.js.map +0 -1
  218. package/build/legacy/chunk-VCR5C6Q3.js +0 -29
  219. package/build/legacy/chunk-VCR5C6Q3.js.map +0 -1
  220. package/build/legacy/chunk-VGHVH2T3.js +0 -24
  221. package/build/legacy/chunk-VGHVH2T3.js.map +0 -1
  222. package/build/legacy/chunk-VULPMZUW.js +0 -18
  223. package/build/legacy/chunk-VULPMZUW.js.map +0 -1
  224. package/build/legacy/chunk-XREC5IJE.js +0 -24
  225. package/build/legacy/chunk-XREC5IJE.js.map +0 -1
  226. package/build/legacy/chunk-ZAU4JVLL.js +0 -33
  227. package/build/legacy/chunk-ZAU4JVLL.js.map +0 -1
  228. package/build/legacy/components/Button.js +0 -7
  229. package/build/legacy/components/Button.js.map +0 -1
  230. package/build/legacy/components/Checkbox.js +0 -13
  231. package/build/legacy/components/Checkbox.js.map +0 -1
  232. package/build/legacy/components/Droppable.js +0 -8
  233. package/build/legacy/components/Droppable.js.map +0 -1
  234. package/build/legacy/components/FeatureFlag.js +0 -10
  235. package/build/legacy/components/FeatureFlag.js.map +0 -1
  236. package/build/legacy/components/FieldMessage.js +0 -9
  237. package/build/legacy/components/FieldMessage.js.map +0 -1
  238. package/build/legacy/components/FileStatus.js +0 -17
  239. package/build/legacy/components/FileStatus.js.map +0 -1
  240. package/build/legacy/components/FileUploader.js +0 -12
  241. package/build/legacy/components/FileUploader.js.map +0 -1
  242. package/build/legacy/components/IconButton.js +0 -7
  243. package/build/legacy/components/IconButton.js.map +0 -1
  244. package/build/legacy/components/Input.js +0 -13
  245. package/build/legacy/components/Input.js.map +0 -1
  246. package/build/legacy/components/Label.js +0 -10
  247. package/build/legacy/components/Label.js.map +0 -1
  248. package/build/legacy/components/Modal.js +0 -7
  249. package/build/legacy/components/Modal.js.map +0 -1
  250. package/build/legacy/components/ModalDescription.js +0 -7
  251. package/build/legacy/components/ModalDescription.js.map +0 -1
  252. package/build/legacy/components/ModalHeader.js +0 -7
  253. package/build/legacy/components/ModalHeader.js.map +0 -1
  254. package/build/legacy/components/ModalHeading.js +0 -7
  255. package/build/legacy/components/ModalHeading.js.map +0 -1
  256. package/build/legacy/components/ModalIcon.js +0 -7
  257. package/build/legacy/components/ModalIcon.js.map +0 -1
  258. package/build/legacy/components/NavMenuLink.js +0 -8
  259. package/build/legacy/components/NavMenuLink.js.map +0 -1
  260. package/build/legacy/components/NavMenuList.js +0 -12
  261. package/build/legacy/components/NavMenuList.js.map +0 -1
  262. package/build/legacy/components/NavMenuTrigger.js +0 -11
  263. package/build/legacy/components/NavMenuTrigger.js.map +0 -1
  264. package/build/legacy/components/Notification.js +0 -12
  265. package/build/legacy/components/Notification.js.map +0 -1
  266. package/build/legacy/components/NotificationDescription.js +0 -7
  267. package/build/legacy/components/NotificationDescription.js.map +0 -1
  268. package/build/legacy/components/NotificationHeading.js +0 -7
  269. package/build/legacy/components/NotificationHeading.js.map +0 -1
  270. package/build/legacy/components/Portal.js +0 -7
  271. package/build/legacy/components/Portal.js.map +0 -1
  272. package/build/legacy/components/ProgressBar.js +0 -7
  273. package/build/legacy/components/ProgressBar.js.map +0 -1
  274. package/build/legacy/components/Radio.js +0 -9
  275. package/build/legacy/components/Radio.js.map +0 -1
  276. package/build/legacy/components/Select.js +0 -15
  277. package/build/legacy/components/Select.js.map +0 -1
  278. package/build/legacy/components/Show.js +0 -8
  279. package/build/legacy/components/Show.js.map +0 -1
  280. package/build/legacy/components/Tab.js +0 -10
  281. package/build/legacy/components/Tab.js.map +0 -1
  282. package/build/legacy/components/TabList.js +0 -9
  283. package/build/legacy/components/TabList.js.map +0 -1
  284. package/build/legacy/components/TabPanel.js +0 -10
  285. package/build/legacy/components/TabPanel.js.map +0 -1
  286. package/build/legacy/components/Table.js +0 -9
  287. package/build/legacy/components/Table.js.map +0 -1
  288. package/build/legacy/components/Tag.js +0 -8
  289. package/build/legacy/components/Tag.js.map +0 -1
  290. package/build/legacy/components/Tbody.js +0 -7
  291. package/build/legacy/components/Tbody.js.map +0 -1
  292. package/build/legacy/components/Td.js +0 -7
  293. package/build/legacy/components/Td.js.map +0 -1
  294. package/build/legacy/components/Textarea.js +0 -9
  295. package/build/legacy/components/Textarea.js.map +0 -1
  296. package/build/legacy/components/Th.js +0 -8
  297. package/build/legacy/components/Th.js.map +0 -1
  298. package/build/legacy/components/Thead.js +0 -7
  299. package/build/legacy/components/Thead.js.map +0 -1
  300. package/build/legacy/components/Toggle.js +0 -12
  301. package/build/legacy/components/Toggle.js.map +0 -1
  302. package/build/legacy/config/cerbIcons.js +0 -8
  303. package/build/legacy/config/cerbIcons.js.map +0 -1
  304. package/build/legacy/config/defineIcons.js +0 -11
  305. package/build/legacy/config/defineIcons.js.map +0 -1
  306. package/build/legacy/config/icons/checkbox.icons.js +0 -9
  307. package/build/legacy/config/icons/checkbox.icons.js.map +0 -1
  308. package/build/legacy/context/confirm-modal.js +0 -23
  309. package/build/legacy/context/confirm-modal.js.map +0 -1
  310. package/build/legacy/context/feature-flags.js +0 -10
  311. package/build/legacy/context/feature-flags.js.map +0 -1
  312. package/build/legacy/context/field.js +0 -10
  313. package/build/legacy/context/field.js.map +0 -1
  314. package/build/legacy/context/navMenu.js +0 -10
  315. package/build/legacy/context/navMenu.js.map +0 -1
  316. package/build/legacy/context/notification-center.js +0 -20
  317. package/build/legacy/context/notification-center.js.map +0 -1
  318. package/build/legacy/context/prompt-modal.js +0 -26
  319. package/build/legacy/context/prompt-modal.js.map +0 -1
  320. package/build/legacy/context/tabs.js +0 -12
  321. package/build/legacy/context/tabs.js.map +0 -1
  322. package/build/legacy/context/theme.js +0 -14
  323. package/build/legacy/context/theme.js.map +0 -1
  324. package/build/legacy/hooks/useModal.js +0 -8
  325. package/build/legacy/hooks/useModal.js.map +0 -1
  326. package/build/legacy/hooks/useTheme.js +0 -8
  327. package/build/legacy/hooks/useTheme.js.map +0 -1
  328. package/build/legacy/hooks/useToggle.js +0 -8
  329. package/build/legacy/hooks/useToggle.js.map +0 -1
  330. package/build/legacy/index.js +0 -247
  331. package/build/legacy/index.js.map +0 -1
  332. package/build/legacy/types.js +0 -2
  333. package/build/legacy/types.js.map +0 -1
  334. /package/build/legacy/{_tsup-dts-rollup.d.ts → _tsup-dts-rollup.d.cts} +0 -0
  335. /package/build/legacy/{noExternals.d.ts → noExternals.d.cts} +0 -0
@@ -0,0 +1,2165 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/index.ts
22
+ var src_exports = {};
23
+ __export(src_exports, {
24
+ $cerberusIcons: () => $cerberusIcons,
25
+ Button: () => Button,
26
+ Checkbox: () => Checkbox,
27
+ ConfirmModal: () => ConfirmModal,
28
+ Droppable: () => Droppable,
29
+ FeatureFlag: () => FeatureFlag,
30
+ FeatureFlags: () => FeatureFlags,
31
+ Field: () => Field,
32
+ FieldMessage: () => FieldMessage,
33
+ FileStatus: () => FileStatus,
34
+ FileUploader: () => FileUploader,
35
+ IconButton: () => IconButton,
36
+ Input: () => Input,
37
+ Label: () => Label,
38
+ MODE_KEY: () => MODE_KEY,
39
+ Modal: () => Modal,
40
+ ModalDescription: () => ModalDescription,
41
+ ModalHeader: () => ModalHeader,
42
+ ModalHeading: () => ModalHeading,
43
+ ModalIcon: () => ModalIcon,
44
+ NavMenu: () => NavMenu,
45
+ NavMenuLink: () => NavMenuLink,
46
+ NavMenuList: () => NavMenuList,
47
+ NavMenuTrigger: () => NavMenuTrigger,
48
+ Notification: () => Notification,
49
+ NotificationCenter: () => NotificationCenter,
50
+ NotificationDescription: () => NotificationDescription,
51
+ NotificationHeading: () => NotificationHeading,
52
+ Option: () => Option,
53
+ Portal: () => Portal,
54
+ ProgressBar: () => ProgressBar,
55
+ PromptModal: () => PromptModal,
56
+ Radio: () => Radio,
57
+ Select: () => Select,
58
+ Show: () => Show,
59
+ THEME_KEY: () => THEME_KEY,
60
+ Tab: () => Tab,
61
+ TabList: () => TabList,
62
+ TabPanel: () => TabPanel,
63
+ Table: () => Table,
64
+ Tabs: () => Tabs,
65
+ TabsContext: () => TabsContext,
66
+ Tag: () => Tag,
67
+ Tbody: () => Tbody,
68
+ Td: () => Td,
69
+ Textarea: () => Textarea,
70
+ Th: () => Th,
71
+ Thead: () => Thead,
72
+ ThemeProvider: () => ThemeProvider,
73
+ Toggle: () => Toggle,
74
+ Tr: () => Tr,
75
+ createNavTriggerProps: () => createNavTriggerProps,
76
+ defineIcons: () => defineIcons,
77
+ getPosition: () => getPosition,
78
+ processStatus: () => processStatus,
79
+ trapFocus: () => trapFocus,
80
+ useConfirmModal: () => useConfirmModal,
81
+ useFeatureFlags: () => useFeatureFlags,
82
+ useFieldContext: () => useFieldContext,
83
+ useModal: () => useModal,
84
+ useNavMenuContext: () => useNavMenuContext,
85
+ useNotificationCenter: () => useNotificationCenter,
86
+ usePromptModal: () => usePromptModal,
87
+ useTabsContext: () => useTabsContext,
88
+ useTabsKeyboardNavigation: () => useTabsKeyboardNavigation,
89
+ useTheme: () => useTheme,
90
+ useThemeContext: () => useThemeContext,
91
+ useToggle: () => useToggle
92
+ });
93
+ module.exports = __toCommonJS(src_exports);
94
+
95
+ // src/components/Button.tsx
96
+ var import_css = require("@cerberus/styled-system/css");
97
+ var import_recipes = require("@cerberus/styled-system/recipes");
98
+ var import_jsx_runtime = require("react/jsx-runtime");
99
+ function Button(props) {
100
+ const { palette, usage, shape, ...nativeProps } = props;
101
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
102
+ "button",
103
+ {
104
+ ...nativeProps,
105
+ className: (0, import_css.cx)(
106
+ nativeProps.className,
107
+ (0, import_recipes.button)({
108
+ palette,
109
+ usage,
110
+ shape
111
+ })
112
+ )
113
+ }
114
+ );
115
+ }
116
+
117
+ // src/components/Checkbox.tsx
118
+ var import_recipes2 = require("@cerberus/styled-system/recipes");
119
+ var import_patterns = require("@cerberus/styled-system/patterns");
120
+ var import_css2 = require("@cerberus/styled-system/css");
121
+
122
+ // src/components/Show.tsx
123
+ var import_react = require("react");
124
+ function Show(props) {
125
+ const { when, children, fallback } = props;
126
+ const condition = (0, import_react.useMemo)(() => when ?? false, [when]);
127
+ return (0, import_react.useMemo)(() => {
128
+ if (condition) return children;
129
+ return fallback ?? null;
130
+ }, [condition, children, fallback]);
131
+ }
132
+
133
+ // src/context/field.tsx
134
+ var import_react2 = require("react");
135
+ var import_jsx_runtime2 = require("react/jsx-runtime");
136
+ var FieldContext = (0, import_react2.createContext)(null);
137
+ function Field(props) {
138
+ const value = (0, import_react2.useMemo)(
139
+ () => ({
140
+ disabled: props.disabled,
141
+ readOnly: props.readOnly,
142
+ required: props.required,
143
+ invalid: props.invalid
144
+ }),
145
+ [props.disabled, props.readOnly, props.required, props.invalid]
146
+ );
147
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(FieldContext.Provider, { value, children: props.children });
148
+ }
149
+ function useFieldContext() {
150
+ const context = (0, import_react2.useContext)(FieldContext);
151
+ if (!context) {
152
+ throw new Error("useFieldContext must be used within a Field Provider.");
153
+ }
154
+ return context;
155
+ }
156
+
157
+ // src/config/cerbIcons.ts
158
+ var import_icons = require("@cerberus/icons");
159
+
160
+ // src/config/icons/checkbox.icons.tsx
161
+ var import_jsx_runtime3 = require("react/jsx-runtime");
162
+ function CheckmarkIcon(props) {
163
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
164
+ "svg",
165
+ {
166
+ "aria-hidden": "true",
167
+ xmlns: "http://www.w3.org/2000/svg",
168
+ fill: "none",
169
+ role: "img",
170
+ viewBox: "0 0 24 24",
171
+ ...props,
172
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
173
+ "path",
174
+ {
175
+ fill: "currentColor",
176
+ d: "M9.714 18 4 12.335l1.818-1.764 3.896 3.824L18.181 6 20 7.803 9.714 18Z"
177
+ }
178
+ )
179
+ }
180
+ );
181
+ }
182
+ function IndeterminateIcon(props) {
183
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
184
+ "svg",
185
+ {
186
+ "aria-hidden": "true",
187
+ xmlns: "http://www.w3.org/2000/svg",
188
+ role: "img",
189
+ fill: "none",
190
+ viewBox: "0 0 24 24",
191
+ ...props,
192
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { fill: "currentColor", d: "M4 11h16v2.667H4z" })
193
+ }
194
+ );
195
+ }
196
+
197
+ // src/config/cerbIcons.ts
198
+ var defaultIcons = {
199
+ checkbox: CheckmarkIcon,
200
+ close: import_icons.CloseFilled,
201
+ confirmModal: import_icons.Information,
202
+ delete: import_icons.TrashCan,
203
+ promptModal: import_icons.Information,
204
+ fileUploader: import_icons.CloudUpload,
205
+ indeterminate: IndeterminateIcon,
206
+ infoNotification: import_icons.InformationFilled,
207
+ successNotification: import_icons.CheckmarkFilled,
208
+ warningNotification: import_icons.WarningFilled,
209
+ dangerNotification: import_icons.ErrorFilled,
210
+ invalid: import_icons.WarningFilled,
211
+ invalidAlt: import_icons.Warning,
212
+ redo: import_icons.Restart,
213
+ selectArrow: import_icons.ChevronDown,
214
+ toggleChecked: import_icons.Checkmark
215
+ };
216
+
217
+ // src/config/defineIcons.ts
218
+ function _validateIconsProperties(icons) {
219
+ if (!icons.invalid) {
220
+ throw new Error(
221
+ "The an invalid property must be defined in your custom icons library."
222
+ );
223
+ }
224
+ }
225
+ function defineIcons(icons) {
226
+ _validateIconsProperties(icons);
227
+ $cerberusIcons = {
228
+ ...defaultIcons,
229
+ ...icons
230
+ };
231
+ return $cerberusIcons;
232
+ }
233
+ var $cerberusIcons = defaultIcons;
234
+
235
+ // src/components/Checkbox.tsx
236
+ var import_jsx_runtime4 = require("react/jsx-runtime");
237
+ function Checkbox(props) {
238
+ const { describedBy, size, checked, mixed, ...nativeProps } = props;
239
+ const { invalid, ...fieldStates } = useFieldContext();
240
+ const styles = (0, import_recipes2.checkbox)({ size });
241
+ const { checkbox: CheckIcon, indeterminate: IndeterminateIcon2 } = $cerberusIcons;
242
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
243
+ "div",
244
+ {
245
+ className: (0, import_css2.cx)(
246
+ styles.root,
247
+ (0, import_patterns.vstack)({
248
+ gap: "0",
249
+ justify: "center"
250
+ })
251
+ ),
252
+ children: [
253
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
254
+ "input",
255
+ {
256
+ ...nativeProps,
257
+ ...fieldStates,
258
+ ...describedBy && { "aria-describedby": describedBy },
259
+ ...invalid && { "aria-invalid": true },
260
+ ...mixed && { "aria-checked": "mixed" },
261
+ className: (0, import_css2.cx)("peer", nativeProps.className, styles.input),
262
+ type: "checkbox"
263
+ }
264
+ ),
265
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Show, { when: checked && !mixed, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: styles.icon, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CheckIcon, {}) }) }),
266
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Show, { when: mixed, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: styles.icon, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(IndeterminateIcon2, {}) }) })
267
+ ]
268
+ }
269
+ );
270
+ }
271
+
272
+ // src/components/Droppable.tsx
273
+ var import_core = require("@dnd-kit/core");
274
+ var import_react3 = require("react");
275
+ var import_jsx_runtime5 = require("react/jsx-runtime");
276
+ function Droppable(props) {
277
+ const { dropped, id, disabled, data, resizeObserverConfig, ...nativeProps } = props;
278
+ const uuid = (0, import_react3.useId)();
279
+ const { isOver, setNodeRef } = (0, import_core.useDroppable)({
280
+ data,
281
+ disabled,
282
+ id: id || uuid,
283
+ resizeObserverConfig
284
+ });
285
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
286
+ "div",
287
+ {
288
+ ...nativeProps,
289
+ "data-over": isOver,
290
+ "data-dropped": dropped,
291
+ ref: setNodeRef,
292
+ children: props.children
293
+ }
294
+ );
295
+ }
296
+
297
+ // src/components/FieldMessage.tsx
298
+ var import_css3 = require("@cerberus/styled-system/css");
299
+ var import_recipes3 = require("@cerberus/styled-system/recipes");
300
+ var import_jsx_runtime6 = require("react/jsx-runtime");
301
+ function FieldMessage(props) {
302
+ const { invalid } = useFieldContext();
303
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
304
+ "small",
305
+ {
306
+ ...props,
307
+ ...invalid && { "aria-invalid": true },
308
+ className: (0, import_css3.cx)(props.className, (0, import_recipes3.fieldMessage)())
309
+ }
310
+ );
311
+ }
312
+
313
+ // src/context/feature-flags.tsx
314
+ var import_react4 = require("react");
315
+ var import_jsx_runtime7 = require("react/jsx-runtime");
316
+ var FeatureFlagContext = (0, import_react4.createContext)(null);
317
+ function FeatureFlags(props) {
318
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(FeatureFlagContext.Provider, { value: props.flags, children: props.children });
319
+ }
320
+ function useFeatureFlags(key) {
321
+ const context = (0, import_react4.useContext)(FeatureFlagContext);
322
+ if (context === null) {
323
+ throw new Error(
324
+ "useFeatureFlag must be used within a FeatureFlags Provider"
325
+ );
326
+ }
327
+ return context[key] ?? false;
328
+ }
329
+
330
+ // src/components/FeatureFlag.tsx
331
+ var import_jsx_runtime8 = require("react/jsx-runtime");
332
+ function FeatureFlag(props) {
333
+ const showContent = useFeatureFlags(props.flag);
334
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Show, { when: showContent, children: props.children });
335
+ }
336
+
337
+ // src/components/FileStatus.tsx
338
+ var import_react5 = require("react");
339
+
340
+ // src/components/ProgressBar.tsx
341
+ var import_css4 = require("@cerberus/styled-system/css");
342
+ var import_recipes4 = require("@cerberus/styled-system/recipes");
343
+ var import_jsx_runtime9 = require("react/jsx-runtime");
344
+ function ProgressBar(props) {
345
+ const { indeterminate, size, usage, now, ...nativeProps } = props;
346
+ const styles = (0, import_recipes4.progressBar)({ size, usage });
347
+ const nowClamped = Math.min(100, Math.max(0, now || 0));
348
+ const width = {
349
+ width: indeterminate ? "50%" : `${nowClamped}%`
350
+ };
351
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
352
+ "div",
353
+ {
354
+ ...nativeProps,
355
+ "aria-valuemin": 0,
356
+ "aria-valuemax": 100,
357
+ "aria-valuenow": indeterminate ? 0 : nowClamped,
358
+ className: (0, import_css4.cx)(nativeProps.className, styles.root),
359
+ role: "meter",
360
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
361
+ "div",
362
+ {
363
+ ...indeterminate && { "data-indeterminate": true },
364
+ "data-complete": nowClamped === 100,
365
+ className: styles.bar,
366
+ style: width
367
+ }
368
+ )
369
+ }
370
+ );
371
+ }
372
+
373
+ // src/components/IconButton.tsx
374
+ var import_css5 = require("@cerberus/styled-system/css");
375
+ var import_recipes5 = require("@cerberus/styled-system/recipes");
376
+ var import_jsx_runtime10 = require("react/jsx-runtime");
377
+ function IconButton(props) {
378
+ const { ariaLabel, palette, usage, size, ...nativeProps } = props;
379
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
380
+ "button",
381
+ {
382
+ ...nativeProps,
383
+ "data-tooltip": true,
384
+ "data-position": props.tooltipPosition ?? "top",
385
+ "aria-label": ariaLabel ?? "Icon Button",
386
+ className: (0, import_css5.cx)(
387
+ nativeProps.className,
388
+ (0, import_recipes5.iconButton)({
389
+ palette,
390
+ usage,
391
+ size
392
+ })
393
+ )
394
+ }
395
+ );
396
+ }
397
+
398
+ // src/components/FileStatus.tsx
399
+ var import_recipes6 = require("@cerberus/styled-system/recipes");
400
+ var import_css6 = require("@cerberus/styled-system/css");
401
+ var import_patterns2 = require("@cerberus/styled-system/patterns");
402
+ var import_jsx_runtime11 = require("react/jsx-runtime");
403
+ var processStatus = /* @__PURE__ */ ((processStatus2) => {
404
+ processStatus2["TODO"] = "todo";
405
+ processStatus2["PROCESSING"] = "processing";
406
+ processStatus2["DONE"] = "done";
407
+ processStatus2["ERROR"] = "error";
408
+ return processStatus2;
409
+ })(processStatus || {});
410
+ function FileStatus(props) {
411
+ const { file, now, status, onClick, ...nativeProps } = props;
412
+ const actionLabel = (0, import_react5.useMemo)(() => getStatusActionLabel(status), [status]);
413
+ const palette = (0, import_react5.useMemo)(() => getPalette(status), [status]);
414
+ const modalIconPalette = (0, import_react5.useMemo)(() => getModalIconPalette(status), [status]);
415
+ const styles = (0, import_react5.useMemo)(() => {
416
+ switch (status) {
417
+ case "todo" /* TODO */:
418
+ return (0, import_recipes6.fileStatus)({ status: "todo" });
419
+ case "processing" /* PROCESSING */:
420
+ return (0, import_recipes6.fileStatus)({ status: "processing" });
421
+ case "done" /* DONE */:
422
+ return (0, import_recipes6.fileStatus)({ status: "done" });
423
+ case "error" /* ERROR */:
424
+ return (0, import_recipes6.fileStatus)({ status: "error" });
425
+ default:
426
+ return (0, import_recipes6.fileStatus)();
427
+ }
428
+ }, [status]);
429
+ const handleClick = (0, import_react5.useCallback)(
430
+ (e) => {
431
+ const actionStatus = getStatusActionLabel(
432
+ status
433
+ ).toLocaleLowerCase();
434
+ onClick(actionStatus, e);
435
+ },
436
+ [onClick]
437
+ );
438
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
439
+ "div",
440
+ {
441
+ ...nativeProps,
442
+ className: (0, import_css6.cx)(nativeProps.className, styles.root, (0, import_patterns2.hstack)()),
443
+ children: [
444
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
445
+ "div",
446
+ {
447
+ className: (0, import_css6.cx)(
448
+ styles.icon,
449
+ (0, import_patterns2.circle)({
450
+ size: "2rem"
451
+ })
452
+ ),
453
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(MatchFileStatusIcon, { status })
454
+ }
455
+ ),
456
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
457
+ "div",
458
+ {
459
+ className: (0, import_patterns2.vstack)({
460
+ alignItems: "flex-start",
461
+ gap: "0.12rem",
462
+ w: "full"
463
+ }),
464
+ children: [
465
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
466
+ "small",
467
+ {
468
+ className: (0, import_css6.css)({
469
+ color: "page.text.initial",
470
+ textStyle: "label-sm"
471
+ }),
472
+ children: file
473
+ }
474
+ ),
475
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ProgressBar, { now, size: "sm" }),
476
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Field, { invalid: modalIconPalette === "danger", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
477
+ FieldMessage,
478
+ {
479
+ className: (0, import_css6.css)({
480
+ color: "page.text.100"
481
+ }),
482
+ id: `help:${file}`,
483
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(MatchFileStatusText, { status, now })
484
+ }
485
+ ) })
486
+ ]
487
+ }
488
+ ),
489
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
490
+ IconButton,
491
+ {
492
+ ariaLabel: actionLabel,
493
+ onClick: handleClick,
494
+ palette,
495
+ size: "sm",
496
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(MatchStatusAction, { status })
497
+ }
498
+ )
499
+ ]
500
+ }
501
+ );
502
+ }
503
+ function MatchFileStatusIcon(props) {
504
+ const {
505
+ fileUploader: FileUploaderIcon,
506
+ invalidAlt: InvalidIcon,
507
+ successNotification: DoneIcon
508
+ } = $cerberusIcons;
509
+ switch (props.status) {
510
+ case "todo" /* TODO */:
511
+ case "processing" /* PROCESSING */:
512
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FileUploaderIcon, {});
513
+ case "done" /* DONE */:
514
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(DoneIcon, {});
515
+ case "error" /* ERROR */:
516
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(InvalidIcon, {});
517
+ default:
518
+ throw new Error("Unknown status");
519
+ }
520
+ }
521
+ function MatchFileStatusText(props) {
522
+ switch (props.status) {
523
+ case "todo" /* TODO */:
524
+ return "Waiting to upload";
525
+ case "processing" /* PROCESSING */:
526
+ return `${props.now}% Complete`;
527
+ case "done" /* DONE */:
528
+ return "File uploaded successfully";
529
+ case "error" /* ERROR */:
530
+ return "There was an error uploading the file";
531
+ default:
532
+ throw new Error("Invalid status");
533
+ }
534
+ }
535
+ function MatchStatusAction(props) {
536
+ const { close: CloseIcon, redo: RedoIcon, delete: TrashIcon } = $cerberusIcons;
537
+ switch (props.status) {
538
+ case "todo" /* TODO */:
539
+ case "processing" /* PROCESSING */:
540
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CloseIcon, {});
541
+ case "error" /* ERROR */:
542
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(RedoIcon, {});
543
+ case "done" /* DONE */:
544
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TrashIcon, {});
545
+ default:
546
+ throw new Error("Invalid status");
547
+ }
548
+ }
549
+ function getStatusActionLabel(status) {
550
+ switch (status) {
551
+ case "todo" /* TODO */:
552
+ case "processing" /* PROCESSING */:
553
+ return "Cancel";
554
+ case "error" /* ERROR */:
555
+ return "Retry";
556
+ case "done" /* DONE */:
557
+ return "Delete";
558
+ default:
559
+ return "";
560
+ }
561
+ }
562
+ function getPalette(status) {
563
+ switch (status) {
564
+ case "todo" /* TODO */:
565
+ case "processing" /* PROCESSING */:
566
+ return "danger";
567
+ case "error" /* ERROR */:
568
+ return "action";
569
+ case "done" /* DONE */:
570
+ return "danger";
571
+ default:
572
+ return "action";
573
+ }
574
+ }
575
+ function getModalIconPalette(status) {
576
+ switch (status) {
577
+ case "todo" /* TODO */:
578
+ case "processing" /* PROCESSING */:
579
+ return "action";
580
+ case "error" /* ERROR */:
581
+ return "danger";
582
+ case "done" /* DONE */:
583
+ return "success";
584
+ default:
585
+ return "action";
586
+ }
587
+ }
588
+
589
+ // src/components/FileUploader.tsx
590
+ var import_css7 = require("@cerberus/styled-system/css");
591
+ var import_patterns3 = require("@cerberus/styled-system/patterns");
592
+ var import_recipes7 = require("@cerberus/styled-system/recipes");
593
+ var import_jsx_runtime12 = require("react/jsx-runtime");
594
+ function FileUploader(props) {
595
+ var _a;
596
+ const styles = (0, import_recipes7.fileUploader)();
597
+ const Icon = $cerberusIcons.fileUploader;
598
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
599
+ "div",
600
+ {
601
+ className: (0, import_css7.cx)(
602
+ (0, import_patterns3.vstack)({
603
+ justify: "center"
604
+ }),
605
+ styles.container
606
+ ),
607
+ children: [
608
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: (0, import_css7.cx)(styles.icon, (0, import_recipes7.modalIcon)(), (0, import_patterns3.circle)()), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Icon, {}) }),
609
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
610
+ "label",
611
+ {
612
+ className: (0, import_css7.cx)(
613
+ (0, import_patterns3.vstack)({
614
+ justify: "center"
615
+ }),
616
+ styles.label
617
+ ),
618
+ htmlFor: props.name,
619
+ children: [
620
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Show, { when: Boolean(props.heading), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: styles.heading, children: props.heading }) }),
621
+ "Import ",
622
+ (_a = props.accept) == null ? void 0 : _a.replace(",", ", "),
623
+ " files",
624
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: styles.description, children: "Click to select files" }),
625
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
626
+ "input",
627
+ {
628
+ ...props,
629
+ className: (0, import_css7.cx)(props.className, styles.input),
630
+ type: "file"
631
+ }
632
+ )
633
+ ]
634
+ }
635
+ )
636
+ ]
637
+ }
638
+ );
639
+ }
640
+
641
+ // src/components/Input.tsx
642
+ var import_recipes8 = require("@cerberus/styled-system/recipes");
643
+ var import_css8 = require("@cerberus/styled-system/css");
644
+ var import_jsx_runtime13 = require("react/jsx-runtime");
645
+ function Input(props) {
646
+ const { describedBy, size, startIcon, endIcon, ...nativeProps } = props;
647
+ const inputStyles = (0, import_recipes8.input)({ size });
648
+ const { invalid, ...fieldStates } = useFieldContext();
649
+ const hasEndIcon = Boolean(endIcon);
650
+ const { invalid: InvalidIcon } = $cerberusIcons;
651
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: inputStyles.root, children: [
652
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Show, { when: Boolean(startIcon), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: inputStyles.startIcon, children: startIcon }) }),
653
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
654
+ "input",
655
+ {
656
+ ...nativeProps,
657
+ ...fieldStates,
658
+ ...describedBy && { "aria-describedby": describedBy },
659
+ ...invalid && { "aria-invalid": true },
660
+ "data-start-icon": Boolean(startIcon),
661
+ className: (0, import_css8.cx)("peer", nativeProps.className, inputStyles.input)
662
+ }
663
+ ),
664
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Show, { when: invalid, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(InvalidIcon, { className: inputStyles.icon }) }),
665
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Show, { when: hasEndIcon && !invalid, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: inputStyles.icon, children: endIcon }) })
666
+ ] });
667
+ }
668
+
669
+ // src/components/Label.tsx
670
+ var import_recipes9 = require("@cerberus/styled-system/recipes");
671
+ var import_css9 = require("@cerberus/styled-system/css");
672
+ var import_patterns4 = require("@cerberus/styled-system/patterns");
673
+ var import_jsx_runtime14 = require("react/jsx-runtime");
674
+ function Label(props) {
675
+ const { hidden, size, ...nativeProps } = props;
676
+ const { required, disabled } = useFieldContext();
677
+ const usage = hidden ? "hidden" : "visible";
678
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
679
+ "label",
680
+ {
681
+ ...nativeProps,
682
+ ...disabled && { "data-disabled": true },
683
+ className: (0, import_css9.cx)(
684
+ nativeProps.className,
685
+ (0, import_recipes9.label)({ size, usage }),
686
+ (0, import_patterns4.hstack)({
687
+ justify: "space-between",
688
+ w: "full"
689
+ })
690
+ ),
691
+ children: [
692
+ props.children,
693
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Show, { when: required, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
694
+ "span",
695
+ {
696
+ className: (0, import_css9.css)({
697
+ color: "inherit",
698
+ fontSize: "inherit"
699
+ }),
700
+ children: "(required)"
701
+ }
702
+ ) })
703
+ ]
704
+ }
705
+ );
706
+ }
707
+
708
+ // src/components/Modal.tsx
709
+ var import_css10 = require("@cerberus/styled-system/css");
710
+ var import_recipes10 = require("@cerberus/styled-system/recipes");
711
+ var import_react6 = require("react");
712
+ var import_jsx_runtime15 = require("react/jsx-runtime");
713
+ function ModalEl(props, ref) {
714
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
715
+ "dialog",
716
+ {
717
+ ...props,
718
+ className: (0, import_css10.cx)(props.className, (0, import_recipes10.modal)().dialog),
719
+ ref
720
+ }
721
+ );
722
+ }
723
+ var Modal = (0, import_react6.forwardRef)(ModalEl);
724
+
725
+ // src/components/ModalHeader.tsx
726
+ var import_css11 = require("@cerberus/styled-system/css");
727
+ var import_patterns5 = require("@cerberus/styled-system/patterns");
728
+ var import_jsx_runtime16 = require("react/jsx-runtime");
729
+ function ModalHeader(props) {
730
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
731
+ "div",
732
+ {
733
+ ...props,
734
+ className: (0, import_css11.cx)(
735
+ props.className,
736
+ (0, import_patterns5.vstack)({
737
+ alignItems: "flex-start",
738
+ gap: "4",
739
+ mb: "8"
740
+ })
741
+ )
742
+ }
743
+ );
744
+ }
745
+
746
+ // src/components/ModalHeading.tsx
747
+ var import_css12 = require("@cerberus/styled-system/css");
748
+ var import_recipes11 = require("@cerberus/styled-system/recipes");
749
+ var import_jsx_runtime17 = require("react/jsx-runtime");
750
+ function ModalHeading(props) {
751
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { ...props, className: (0, import_css12.cx)(props.className, (0, import_recipes11.modal)().heading) });
752
+ }
753
+
754
+ // src/components/ModalDescription.tsx
755
+ var import_css13 = require("@cerberus/styled-system/css");
756
+ var import_recipes12 = require("@cerberus/styled-system/recipes");
757
+ var import_jsx_runtime18 = require("react/jsx-runtime");
758
+ function ModalDescription(props) {
759
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { ...props, className: (0, import_css13.cx)(props.className, (0, import_recipes12.modal)().description) });
760
+ }
761
+
762
+ // src/components/ModalIcon.tsx
763
+ var import_css14 = require("@cerberus/styled-system/css");
764
+ var import_patterns6 = require("@cerberus/styled-system/patterns");
765
+ var import_recipes13 = require("@cerberus/styled-system/recipes");
766
+ var import_jsx_runtime19 = require("react/jsx-runtime");
767
+ function ModalIcon(props) {
768
+ const { palette, ...nativeProps } = props;
769
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
770
+ "div",
771
+ {
772
+ ...nativeProps,
773
+ className: (0, import_css14.cx)(
774
+ nativeProps.className,
775
+ (0, import_recipes13.modalIcon)({
776
+ palette
777
+ }),
778
+ (0, import_patterns6.circle)()
779
+ ),
780
+ children: props.children
781
+ }
782
+ );
783
+ }
784
+
785
+ // src/components/NavMenuTrigger.tsx
786
+ var import_react8 = require("react");
787
+ var import_css16 = require("@cerberus/styled-system/css");
788
+ var import_recipes14 = require("@cerberus/styled-system/recipes");
789
+
790
+ // src/aria-helpers/nav-menu.aria.ts
791
+ function createNavTriggerProps(values) {
792
+ return {
793
+ ["aria-controls"]: values.controls,
794
+ ["aria-expanded"]: values.expanded ?? false
795
+ };
796
+ }
797
+
798
+ // src/context/navMenu.tsx
799
+ var import_css15 = require("@cerberus/styled-system/css");
800
+ var import_react7 = require("react");
801
+ var import_jsx_runtime20 = require("react/jsx-runtime");
802
+ var NavMenuContext = (0, import_react7.createContext)(null);
803
+ function NavMenu(props) {
804
+ const triggerRef = (0, import_react7.useRef)(null);
805
+ const menuRef = (0, import_react7.useRef)(null);
806
+ const [expanded, setExpanded] = (0, import_react7.useState)(false);
807
+ const handleToggle = (0, import_react7.useCallback)(() => {
808
+ setExpanded((prev) => !prev);
809
+ }, []);
810
+ const value = (0, import_react7.useMemo)(
811
+ () => ({
812
+ triggerRef,
813
+ menuRef,
814
+ expanded,
815
+ onToggle: handleToggle
816
+ }),
817
+ [expanded, handleToggle]
818
+ );
819
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(NavMenuContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
820
+ "nav",
821
+ {
822
+ className: (0, import_css15.css)({
823
+ position: "relative"
824
+ }),
825
+ children: props.children
826
+ }
827
+ ) });
828
+ }
829
+ function useNavMenuContext() {
830
+ const context = (0, import_react7.useContext)(NavMenuContext);
831
+ if (!context) {
832
+ throw new Error("useNavMenuContext must be used within a NavMenu.");
833
+ }
834
+ return context;
835
+ }
836
+
837
+ // src/components/NavMenuTrigger.tsx
838
+ var import_jsx_runtime21 = require("react/jsx-runtime");
839
+ function NavMenuTrigger(props) {
840
+ const {
841
+ as,
842
+ palette,
843
+ usage,
844
+ shape,
845
+ controls,
846
+ expanded: propsExpanded,
847
+ onClick,
848
+ ...nativeProps
849
+ } = props;
850
+ const { triggerRef, onToggle, expanded } = useNavMenuContext();
851
+ const ariaProps = createNavTriggerProps({
852
+ controls,
853
+ expanded: propsExpanded ?? expanded
854
+ });
855
+ const hasAs = Boolean(as);
856
+ const AsSub = as;
857
+ const handleClick = (0, import_react8.useCallback)(
858
+ (e) => {
859
+ if (onClick) return onClick(e);
860
+ onToggle();
861
+ },
862
+ [onClick, onToggle]
863
+ );
864
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
865
+ Show,
866
+ {
867
+ when: hasAs,
868
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
869
+ "button",
870
+ {
871
+ ...nativeProps,
872
+ ...ariaProps,
873
+ className: (0, import_css16.cx)(
874
+ nativeProps.className,
875
+ (0, import_recipes14.button)({
876
+ palette,
877
+ usage,
878
+ shape
879
+ })
880
+ ),
881
+ onClick: handleClick,
882
+ ref: triggerRef,
883
+ children: props.children
884
+ }
885
+ ),
886
+ children: hasAs && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
887
+ AsSub,
888
+ {
889
+ ...nativeProps,
890
+ ...ariaProps,
891
+ onClick: handleClick,
892
+ ref: triggerRef
893
+ }
894
+ )
895
+ }
896
+ );
897
+ }
898
+
899
+ // src/components/NavMenuList.tsx
900
+ var import_react9 = require("react");
901
+ var import_css17 = require("@cerberus/styled-system/css");
902
+ var import_patterns7 = require("@cerberus/styled-system/patterns");
903
+ var import_jsx_runtime22 = require("react/jsx-runtime");
904
+ function getPosition(position) {
905
+ const defaultPositions = {
906
+ left: "auto",
907
+ right: "auto",
908
+ top: "auto",
909
+ bottom: "auto"
910
+ };
911
+ switch (position) {
912
+ case "right":
913
+ return { ...defaultPositions, top: "0%", left: "105%" };
914
+ case "left":
915
+ return { ...defaultPositions, top: "0%", right: "105%" };
916
+ case "bottom":
917
+ return { ...defaultPositions, top: "110%" };
918
+ case "top":
919
+ return { ...defaultPositions, bottom: "110%" };
920
+ default:
921
+ return defaultPositions;
922
+ }
923
+ }
924
+ var navListStyles = (0, import_patterns7.vstack)({
925
+ alignItems: "flex-start",
926
+ bgColor: "page.surface.100",
927
+ boxShadow: "lg",
928
+ gap: "2",
929
+ opacity: "0",
930
+ p: "4",
931
+ position: "absolute",
932
+ rounded: "md",
933
+ zIndex: "dropdown",
934
+ _motionSafe: {
935
+ animationName: "zoomIn",
936
+ animationDelay: "100ms",
937
+ animationDuration: "150ms",
938
+ animationFillMode: "both",
939
+ animationTimingFunction: "ease-in-out"
940
+ },
941
+ _positionBottom: {
942
+ transformOrigin: "top left"
943
+ },
944
+ _positionTop: {
945
+ transformOrigin: "bottom left"
946
+ },
947
+ _positionLeft: {
948
+ transformOrigin: "top right"
949
+ },
950
+ _positionRight: {
951
+ transformOrigin: "top left"
952
+ }
953
+ });
954
+ function NavMenuList(props) {
955
+ const { position, ...nativeProps } = props;
956
+ const { menuRef, expanded } = useNavMenuContext();
957
+ const locationStyles = (0, import_react9.useMemo)(
958
+ () => getPosition(position ?? "bottom"),
959
+ [position]
960
+ );
961
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Show, { when: expanded, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
962
+ "ul",
963
+ {
964
+ ...nativeProps,
965
+ "data-position": position ?? "bottom",
966
+ className: (0, import_css17.cx)(nativeProps.className, navListStyles),
967
+ ref: menuRef,
968
+ style: locationStyles
969
+ }
970
+ ) });
971
+ }
972
+
973
+ // src/components/NavMenuLink.tsx
974
+ var import_css18 = require("@cerberus/styled-system/css");
975
+ var import_jsx_runtime23 = require("react/jsx-runtime");
976
+ function NavMenuLink(props) {
977
+ const { as, ...nativeProps } = props;
978
+ const hasAs = Boolean(as);
979
+ const AsSub = as;
980
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
981
+ "li",
982
+ {
983
+ className: (0, import_css18.css)({
984
+ w: "full"
985
+ }),
986
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
987
+ Show,
988
+ {
989
+ when: hasAs,
990
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
991
+ "a",
992
+ {
993
+ ...nativeProps,
994
+ className: (0, import_css18.cx)(
995
+ nativeProps.className,
996
+ (0, import_css18.css)({
997
+ color: "action.navigation.initial",
998
+ textStyle: "link",
999
+ _hover: {
1000
+ color: "action.navigation.hover"
1001
+ }
1002
+ })
1003
+ )
1004
+ }
1005
+ ),
1006
+ children: hasAs && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(AsSub, { ...nativeProps })
1007
+ }
1008
+ )
1009
+ }
1010
+ );
1011
+ }
1012
+
1013
+ // src/components/Notification.tsx
1014
+ var import_css19 = require("@cerberus/styled-system/css");
1015
+ var import_patterns8 = require("@cerberus/styled-system/patterns");
1016
+ var import_recipes15 = require("@cerberus/styled-system/recipes");
1017
+ var import_react10 = require("react");
1018
+ var import_icons2 = require("@cerberus/icons");
1019
+
1020
+ // src/aria-helpers/trap-focus.aria.ts
1021
+ function trapFocus(modalRef) {
1022
+ var _a;
1023
+ const focusableElements = 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
1024
+ const focusable = Array.from(
1025
+ ((_a = modalRef.current) == null ? void 0 : _a.querySelectorAll(focusableElements)) ?? []
1026
+ );
1027
+ const firstFocusable = focusable[0];
1028
+ const lastFocusable = focusable[focusable.length - 1];
1029
+ return function handleKeyDown(event) {
1030
+ if (event.key === "Tab") {
1031
+ if (event.shiftKey) {
1032
+ if (document.activeElement === firstFocusable) {
1033
+ lastFocusable.focus();
1034
+ event.preventDefault();
1035
+ }
1036
+ } else {
1037
+ if (document.activeElement === lastFocusable) {
1038
+ firstFocusable.focus();
1039
+ event.preventDefault();
1040
+ }
1041
+ }
1042
+ }
1043
+ };
1044
+ }
1045
+
1046
+ // src/components/Notification.tsx
1047
+ var import_jsx_runtime24 = require("react/jsx-runtime");
1048
+ function MatchNotificationIcon(props) {
1049
+ const palette = props.palette || "info";
1050
+ const key = `${palette}Notification`;
1051
+ const Icon = $cerberusIcons[key];
1052
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Icon, {});
1053
+ }
1054
+ function Notification(props) {
1055
+ const { children, palette, onClose, ...nativeProps } = props;
1056
+ const ref = (0, import_react10.useRef)(null);
1057
+ const onKeyDown = trapFocus(ref);
1058
+ const styles = (0, import_recipes15.notification)({ palette });
1059
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
1060
+ "dialog",
1061
+ {
1062
+ ...nativeProps,
1063
+ className: (0, import_css19.cx)(
1064
+ nativeProps.className,
1065
+ (0, import_patterns8.hstack)({
1066
+ position: "relative",
1067
+ gap: "4"
1068
+ }),
1069
+ styles.dialog
1070
+ ),
1071
+ onKeyDown,
1072
+ ref,
1073
+ role: "alert",
1074
+ children: [
1075
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: styles.icon, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MatchNotificationIcon, { palette }) }),
1076
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1077
+ "div",
1078
+ {
1079
+ className: (0, import_patterns8.vstack)({
1080
+ alignItems: "flex-start",
1081
+ gap: "0",
1082
+ py: "2"
1083
+ }),
1084
+ children
1085
+ }
1086
+ ),
1087
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1088
+ "button",
1089
+ {
1090
+ "aria-label": "Close",
1091
+ className: styles.close,
1092
+ onClick: onClose,
1093
+ value: props.id,
1094
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons2.Close, {})
1095
+ }
1096
+ )
1097
+ ]
1098
+ }
1099
+ );
1100
+ }
1101
+
1102
+ // src/components/NotificationHeading.tsx
1103
+ var import_css20 = require("@cerberus/styled-system/css");
1104
+ var import_recipes16 = require("@cerberus/styled-system/recipes");
1105
+ var import_jsx_runtime25 = require("react/jsx-runtime");
1106
+ function NotificationHeading(props) {
1107
+ const { palette, ...nativeProps } = props;
1108
+ const styles = (0, import_recipes16.notification)({ palette });
1109
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: (0, import_css20.cx)(nativeProps.className, styles.heading), ...nativeProps });
1110
+ }
1111
+
1112
+ // src/components/NotificationDescription.tsx
1113
+ var import_css21 = require("@cerberus/styled-system/css");
1114
+ var import_recipes17 = require("@cerberus/styled-system/recipes");
1115
+ var import_jsx_runtime26 = require("react/jsx-runtime");
1116
+ function NotificationDescription(props) {
1117
+ const { palette, ...nativeProps } = props;
1118
+ const styles = (0, import_recipes17.notification)({ palette });
1119
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
1120
+ "p",
1121
+ {
1122
+ className: (0, import_css21.cx)(nativeProps.className, styles.description),
1123
+ ...nativeProps
1124
+ }
1125
+ );
1126
+ }
1127
+
1128
+ // src/components/Portal.tsx
1129
+ var import_react_dom = require("react-dom");
1130
+ function Portal(props) {
1131
+ const container = props.container || document.body;
1132
+ return (0, import_react_dom.createPortal)(props.children, container, props.key);
1133
+ }
1134
+
1135
+ // src/components/Radio.tsx
1136
+ var import_css22 = require("@cerberus/styled-system/css");
1137
+ var import_patterns9 = require("@cerberus/styled-system/patterns");
1138
+ var import_recipes18 = require("@cerberus/styled-system/recipes");
1139
+ var import_jsx_runtime27 = require("react/jsx-runtime");
1140
+ function Radio(props) {
1141
+ const { children, size, ...nativeProps } = props;
1142
+ const { invalid, ...state } = useFieldContext();
1143
+ const styles = (0, import_recipes18.radio)({ size });
1144
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: (0, import_css22.cx)("group", (0, import_patterns9.hstack)(), styles.root), tabIndex: 0, children: [
1145
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
1146
+ "input",
1147
+ {
1148
+ ...nativeProps,
1149
+ ...state,
1150
+ ...invalid && { "aria-invalid": true },
1151
+ className: (0, import_css22.cx)(nativeProps.className, styles.input),
1152
+ tabIndex: -1,
1153
+ type: "radio"
1154
+ }
1155
+ ),
1156
+ children
1157
+ ] });
1158
+ }
1159
+
1160
+ // src/components/Select.tsx
1161
+ var import_css23 = require("@cerberus/styled-system/css");
1162
+ var import_patterns10 = require("@cerberus/styled-system/patterns");
1163
+ var import_recipes19 = require("@cerberus/styled-system/recipes");
1164
+ var import_jsx_runtime28 = require("react/jsx-runtime");
1165
+ function Select(props) {
1166
+ const { describedBy, size, ...nativeProps } = props;
1167
+ const { invalid, ...fieldStates } = useFieldContext();
1168
+ const { invalid: InvalidIcon, selectArrow: SelectArrow } = $cerberusIcons;
1169
+ const styles = (0, import_recipes19.select)({
1170
+ size
1171
+ });
1172
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: styles.root, children: [
1173
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
1174
+ "select",
1175
+ {
1176
+ ...nativeProps,
1177
+ ...fieldStates,
1178
+ ...describedBy && { "aria-describedby": describedBy },
1179
+ ...invalid && { "aria-invalid": true },
1180
+ className: styles.input
1181
+ }
1182
+ ),
1183
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
1184
+ "span",
1185
+ {
1186
+ className: (0, import_css23.cx)(
1187
+ styles.iconStack,
1188
+ (0, import_patterns10.hstack)({
1189
+ gap: "2"
1190
+ })
1191
+ ),
1192
+ children: [
1193
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Show, { when: invalid, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
1194
+ "span",
1195
+ {
1196
+ ...invalid && { "data-invalid": true },
1197
+ className: styles.stateIcon,
1198
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(InvalidIcon, {})
1199
+ }
1200
+ ) }),
1201
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: styles.arrowIcon, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(SelectArrow, {}) })
1202
+ ]
1203
+ }
1204
+ )
1205
+ ] });
1206
+ }
1207
+ function Option(props) {
1208
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { ...props });
1209
+ }
1210
+
1211
+ // src/components/Tab.tsx
1212
+ var import_react13 = require("react");
1213
+
1214
+ // src/context/tabs.tsx
1215
+ var import_recipes20 = require("@cerberus/styled-system/recipes");
1216
+ var import_react11 = require("react");
1217
+ var import_jsx_runtime29 = require("react/jsx-runtime");
1218
+ var TabsContext = (0, import_react11.createContext)(null);
1219
+ function Tabs(props) {
1220
+ const { cache, active, id, palette } = props;
1221
+ const [activeTab, setActiveTab] = (0, import_react11.useState)(() => cache ? "" : active ?? "");
1222
+ const tabsList = (0, import_react11.useRef)([]);
1223
+ const uuid = (0, import_react11.useMemo)(() => {
1224
+ return id ? `cerberus-tabs-${id}` : "cerberus-tabs";
1225
+ }, [id]);
1226
+ const value = (0, import_react11.useMemo)(
1227
+ () => ({
1228
+ tabs: tabsList,
1229
+ id: uuid,
1230
+ active: activeTab,
1231
+ styles: (0, import_recipes20.tabs)({ palette }),
1232
+ onTabUpdate: setActiveTab
1233
+ }),
1234
+ [activeTab, setActiveTab, palette, uuid, tabsList]
1235
+ );
1236
+ (0, import_react11.useEffect)(() => {
1237
+ if (cache) {
1238
+ const cachedTab = window.localStorage.getItem(uuid);
1239
+ setActiveTab(
1240
+ cache ? cachedTab || (props.active ?? "") : props.active ?? ""
1241
+ );
1242
+ }
1243
+ }, [cache, active, uuid]);
1244
+ (0, import_react11.useEffect)(() => {
1245
+ if (cache && activeTab) {
1246
+ window.localStorage.setItem(uuid, activeTab);
1247
+ }
1248
+ }, [activeTab, cache]);
1249
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TabsContext.Provider, { value, children: props.children });
1250
+ }
1251
+ function useTabsContext() {
1252
+ const context = (0, import_react11.useContext)(TabsContext);
1253
+ if (!context) {
1254
+ throw new Error("useTabsContext must be used within a Tabs Provider.");
1255
+ }
1256
+ return context;
1257
+ }
1258
+
1259
+ // src/components/Tab.tsx
1260
+ var import_css24 = require("@cerberus/styled-system/css");
1261
+
1262
+ // src/aria-helpers/tabs.aria.ts
1263
+ var import_react12 = require("react");
1264
+ function getNextIndex(index, length) {
1265
+ return index === length - 1 ? 0 : index + 1;
1266
+ }
1267
+ function getPrevIndex(index, length) {
1268
+ return index === 0 ? length - 1 : index - 1;
1269
+ }
1270
+ function useTabsKeyboardNavigation() {
1271
+ const { tabs: tabs2 } = useTabsContext();
1272
+ const [activeTab, setActiveTab] = (0, import_react12.useState)(-1);
1273
+ (0, import_react12.useEffect)(() => {
1274
+ const handleKeyDown = (event) => {
1275
+ const index = activeTab === -1 ? tabs2.current.findIndex((tab) => tab.ariaSelected === "true") : activeTab;
1276
+ const nextIndex = getNextIndex(index, tabs2.current.length);
1277
+ const prevIndex = getPrevIndex(index, tabs2.current.length);
1278
+ if (index === -1) return;
1279
+ switch (event.key) {
1280
+ case "ArrowLeft":
1281
+ event.preventDefault();
1282
+ setActiveTab(prevIndex);
1283
+ tabs2.current[prevIndex].focus();
1284
+ break;
1285
+ case "ArrowRight":
1286
+ event.preventDefault();
1287
+ setActiveTab(nextIndex);
1288
+ tabs2.current[nextIndex].focus();
1289
+ break;
1290
+ case "Home":
1291
+ event.preventDefault();
1292
+ setActiveTab(0);
1293
+ tabs2.current[0].focus();
1294
+ break;
1295
+ case "End":
1296
+ event.preventDefault();
1297
+ setActiveTab(tabs2.current.length - 1);
1298
+ tabs2.current[tabs2.current.length - 1].focus();
1299
+ break;
1300
+ default:
1301
+ break;
1302
+ }
1303
+ };
1304
+ document.addEventListener("keydown", handleKeyDown);
1305
+ return () => {
1306
+ document.removeEventListener("keydown", handleKeyDown);
1307
+ };
1308
+ }, [activeTab, tabs2.current]);
1309
+ return {
1310
+ ref: (tab) => {
1311
+ if (tab && !tabs2.current.includes(tab)) {
1312
+ tabs2.current.push(tab);
1313
+ }
1314
+ }
1315
+ };
1316
+ }
1317
+
1318
+ // src/components/Tab.tsx
1319
+ var import_jsx_runtime30 = require("react/jsx-runtime");
1320
+ function Tab(props) {
1321
+ const { value, ...nativeProps } = props;
1322
+ const { active, onTabUpdate, styles } = useTabsContext();
1323
+ const [isPending, startTransition] = (0, import_react13.useTransition)();
1324
+ const { ref } = useTabsKeyboardNavigation();
1325
+ const isActive = (0, import_react13.useMemo)(() => active === value, [active, value]);
1326
+ function handleClick(e) {
1327
+ var _a;
1328
+ (_a = props.onClick) == null ? void 0 : _a.call(props, e);
1329
+ startTransition(() => onTabUpdate(e.currentTarget.value));
1330
+ }
1331
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
1332
+ "button",
1333
+ {
1334
+ ...nativeProps,
1335
+ ...!isActive && { tabIndex: -1 },
1336
+ "aria-controls": `panel:${value}`,
1337
+ "aria-busy": isPending,
1338
+ "aria-selected": isActive,
1339
+ id: value,
1340
+ className: (0, import_css24.cx)(nativeProps.className, styles.tab),
1341
+ onClick: handleClick,
1342
+ role: "tab",
1343
+ ref,
1344
+ value
1345
+ }
1346
+ );
1347
+ }
1348
+
1349
+ // src/components/TabList.tsx
1350
+ var import_css25 = require("@cerberus/styled-system/css");
1351
+ var import_patterns11 = require("@cerberus/styled-system/patterns");
1352
+ var import_jsx_runtime31 = require("react/jsx-runtime");
1353
+ function TabList(props) {
1354
+ const { description, ...nativeProps } = props;
1355
+ const { id, styles } = useTabsContext();
1356
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
1357
+ "div",
1358
+ {
1359
+ ...nativeProps,
1360
+ "aria-describedby": description,
1361
+ className: (0, import_css25.cx)(
1362
+ nativeProps.className,
1363
+ (0, import_patterns11.hstack)({
1364
+ gap: "0"
1365
+ }),
1366
+ styles.tabList
1367
+ ),
1368
+ id: id ?? nativeProps.id
1369
+ }
1370
+ );
1371
+ }
1372
+
1373
+ // src/components/TabPanel.tsx
1374
+ var import_css26 = require("@cerberus/styled-system/css");
1375
+ var import_react14 = require("react");
1376
+ var import_jsx_runtime32 = require("react/jsx-runtime");
1377
+ function TabPanel(props) {
1378
+ const { tab, ...nativeProps } = props;
1379
+ const { active, styles } = useTabsContext();
1380
+ const isActive = (0, import_react14.useMemo)(() => active === tab, [active, tab]);
1381
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Show, { when: isActive, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
1382
+ "div",
1383
+ {
1384
+ ...nativeProps,
1385
+ ...isActive && { tabIndex: 0 },
1386
+ "aria-labelledby": tab,
1387
+ className: (0, import_css26.cx)(nativeProps.className, styles.tabPanel),
1388
+ id: `panel:${tab}`,
1389
+ role: "tabpanel"
1390
+ }
1391
+ ) });
1392
+ }
1393
+
1394
+ // src/components/Table.tsx
1395
+ var import_css27 = require("@cerberus/styled-system/css");
1396
+ var import_recipes21 = require("@cerberus/styled-system/recipes");
1397
+ var import_jsx_runtime33 = require("react/jsx-runtime");
1398
+ function Table(props) {
1399
+ const { caption, children, ...nativeProps } = props;
1400
+ const styles = (0, import_recipes21.table)();
1401
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: styles.container, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
1402
+ "table",
1403
+ {
1404
+ ...nativeProps,
1405
+ className: (0, import_css27.cx)(nativeProps.className, styles.table),
1406
+ children: [
1407
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("caption", { className: styles.caption, children: caption }),
1408
+ children
1409
+ ]
1410
+ }
1411
+ ) });
1412
+ }
1413
+ function Tr(props) {
1414
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("tr", { ...props });
1415
+ }
1416
+
1417
+ // src/components/Thead.tsx
1418
+ var import_css28 = require("@cerberus/styled-system/css");
1419
+ var import_recipes22 = require("@cerberus/styled-system/recipes");
1420
+ var import_jsx_runtime34 = require("react/jsx-runtime");
1421
+ function Thead(props) {
1422
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("thead", { ...props, className: (0, import_css28.cx)(props.className, (0, import_recipes22.thead)()) });
1423
+ }
1424
+
1425
+ // src/components/Th.tsx
1426
+ var import_css29 = require("@cerberus/styled-system/css");
1427
+ var import_recipes23 = require("@cerberus/styled-system/recipes");
1428
+ var import_jsx_runtime35 = require("react/jsx-runtime");
1429
+ function Th(props) {
1430
+ const { size, onClick, ...nativeProps } = props;
1431
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
1432
+ Show,
1433
+ {
1434
+ when: Boolean(onClick),
1435
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
1436
+ "th",
1437
+ {
1438
+ ...nativeProps,
1439
+ className: (0, import_css29.cx)(nativeProps.className, (0, import_recipes23.th)({ size }))
1440
+ }
1441
+ ),
1442
+ children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("th", { ...nativeProps, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
1443
+ "button",
1444
+ {
1445
+ className: (0, import_css29.cx)(
1446
+ nativeProps.className,
1447
+ (0, import_recipes23.th)({ size }),
1448
+ (0, import_css29.css)({
1449
+ alignItems: "center",
1450
+ display: "inline-flex",
1451
+ justifyContent: "space-between",
1452
+ userSelect: "none",
1453
+ w: "full"
1454
+ })
1455
+ ),
1456
+ onClick,
1457
+ children: props.children
1458
+ }
1459
+ ) })
1460
+ }
1461
+ );
1462
+ }
1463
+
1464
+ // src/components/Td.tsx
1465
+ var import_css30 = require("@cerberus/styled-system/css");
1466
+ var import_recipes24 = require("@cerberus/styled-system/recipes");
1467
+ var import_jsx_runtime36 = require("react/jsx-runtime");
1468
+ function Td(props) {
1469
+ const { size, ...nativeProps } = props;
1470
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
1471
+ "td",
1472
+ {
1473
+ ...nativeProps,
1474
+ className: (0, import_css30.cx)(
1475
+ nativeProps.className,
1476
+ (0, import_recipes24.td)({
1477
+ size
1478
+ })
1479
+ )
1480
+ }
1481
+ );
1482
+ }
1483
+
1484
+ // src/components/Tbody.tsx
1485
+ var import_recipes25 = require("@cerberus/styled-system/recipes");
1486
+ var import_css31 = require("@cerberus/styled-system/css");
1487
+ var import_jsx_runtime37 = require("react/jsx-runtime");
1488
+ function Tbody(props) {
1489
+ const { decoration, ...nativeProps } = props;
1490
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
1491
+ "tbody",
1492
+ {
1493
+ ...nativeProps,
1494
+ className: (0, import_css31.cx)(
1495
+ nativeProps.className,
1496
+ (0, import_recipes25.tbody)({
1497
+ decoration
1498
+ })
1499
+ )
1500
+ }
1501
+ );
1502
+ }
1503
+
1504
+ // src/components/Tag.tsx
1505
+ var import_icons3 = require("@cerberus/icons");
1506
+ var import_css32 = require("@cerberus/styled-system/css");
1507
+ var import_recipes26 = require("@cerberus/styled-system/recipes");
1508
+ var import_jsx_runtime38 = require("react/jsx-runtime");
1509
+ function Tag(props) {
1510
+ const { shape: initShape, gradient, onClick, usage, ...nativeProps } = props;
1511
+ const palette = (props == null ? void 0 : props.palette) ?? "page";
1512
+ const isClosable = Boolean(onClick);
1513
+ const shape = isClosable ? "pill" : initShape;
1514
+ const closableStyles = isClosable ? closableCss : "";
1515
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
1516
+ "span",
1517
+ {
1518
+ ...nativeProps,
1519
+ className: (0, import_css32.cx)(
1520
+ nativeProps.className,
1521
+ (0, import_recipes26.tag)({
1522
+ gradient,
1523
+ palette,
1524
+ shape,
1525
+ usage
1526
+ }),
1527
+ closableStyles
1528
+ ),
1529
+ children: [
1530
+ props.children,
1531
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Show, { when: isClosable, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
1532
+ "button",
1533
+ {
1534
+ "aria-label": "Close",
1535
+ className: (0, import_recipes26.iconButton)({
1536
+ palette: "action",
1537
+ usage: "filled",
1538
+ size: "sm"
1539
+ }),
1540
+ onClick,
1541
+ children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_icons3.Close, {})
1542
+ }
1543
+ ) })
1544
+ ]
1545
+ }
1546
+ );
1547
+ }
1548
+ var closableCss = (0, import_css32.css)({
1549
+ bgColor: "action.bg.active",
1550
+ color: "action.text.initial",
1551
+ paddingInlineEnd: "0"
1552
+ });
1553
+
1554
+ // src/components/Textarea.tsx
1555
+ var import_css33 = require("@cerberus/styled-system/css");
1556
+ var import_recipes27 = require("@cerberus/styled-system/recipes");
1557
+ var import_jsx_runtime39 = require("react/jsx-runtime");
1558
+ function Textarea(props) {
1559
+ const { describedBy, ...nativeProps } = props;
1560
+ const { invalid, ...fieldState } = useFieldContext();
1561
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
1562
+ "textarea",
1563
+ {
1564
+ ...nativeProps,
1565
+ ...fieldState,
1566
+ ...describedBy && { "aria-describedby": describedBy },
1567
+ ...invalid && { "aria-invalid": true },
1568
+ className: (0, import_css33.cx)(
1569
+ props.className,
1570
+ (0, import_recipes27.input)().input,
1571
+ (0, import_css33.css)({
1572
+ pxi: "2",
1573
+ py: "2",
1574
+ resize: "vertical"
1575
+ })
1576
+ ),
1577
+ rows: 4
1578
+ }
1579
+ );
1580
+ }
1581
+
1582
+ // src/components/Toggle.tsx
1583
+ var import_css34 = require("@cerberus/styled-system/css");
1584
+ var import_patterns12 = require("@cerberus/styled-system/patterns");
1585
+ var import_recipes28 = require("@cerberus/styled-system/recipes");
1586
+ var import_jsx_runtime40 = require("react/jsx-runtime");
1587
+ function Toggle(props) {
1588
+ const { size, describedBy, ...nativeProps } = props;
1589
+ const styles = (0, import_recipes28.toggle)({ size });
1590
+ const { invalid, ...state } = useFieldContext();
1591
+ const Icon = $cerberusIcons.toggleChecked;
1592
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
1593
+ "span",
1594
+ {
1595
+ className: (0, import_css34.cx)("group", styles.track, (0, import_patterns12.hstack)()),
1596
+ "data-checked": props.checked || props.defaultChecked,
1597
+ children: [
1598
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
1599
+ "input",
1600
+ {
1601
+ ...nativeProps,
1602
+ ...state,
1603
+ ...describedBy && { "aria-describedby": describedBy },
1604
+ ...invalid && { "aria-invalid": true },
1605
+ className: (0, import_css34.cx)("peer", styles.input),
1606
+ role: "switch",
1607
+ type: "checkbox"
1608
+ }
1609
+ ),
1610
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
1611
+ "span",
1612
+ {
1613
+ className: (0, import_css34.cx)(
1614
+ styles.thumb,
1615
+ (0, import_patterns12.vstack)({
1616
+ justify: "center"
1617
+ })
1618
+ ),
1619
+ children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Icon, {})
1620
+ }
1621
+ )
1622
+ ]
1623
+ }
1624
+ );
1625
+ }
1626
+
1627
+ // src/context/confirm-modal.tsx
1628
+ var import_react16 = require("react");
1629
+ var import_css35 = require("@cerberus/styled-system/css");
1630
+ var import_patterns13 = require("@cerberus/styled-system/patterns");
1631
+
1632
+ // src/hooks/useModal.ts
1633
+ var import_react15 = require("react");
1634
+ function useModal() {
1635
+ const modalRef = (0, import_react15.useRef)(null);
1636
+ const show = (0, import_react15.useCallback)(() => {
1637
+ var _a;
1638
+ (_a = modalRef.current) == null ? void 0 : _a.showModal();
1639
+ }, []);
1640
+ const close = (0, import_react15.useCallback)(() => {
1641
+ var _a;
1642
+ (_a = modalRef.current) == null ? void 0 : _a.close();
1643
+ }, []);
1644
+ return (0, import_react15.useMemo)(() => {
1645
+ return {
1646
+ modalRef,
1647
+ show,
1648
+ close
1649
+ };
1650
+ }, [modalRef, show, close]);
1651
+ }
1652
+
1653
+ // src/context/confirm-modal.tsx
1654
+ var import_jsx_runtime41 = require("react/jsx-runtime");
1655
+ var ConfirmModalContext = (0, import_react16.createContext)(null);
1656
+ function ConfirmModal(props) {
1657
+ const { modalRef, show, close } = useModal();
1658
+ const resolveRef = (0, import_react16.useRef)(null);
1659
+ const [content, setContent] = (0, import_react16.useState)(null);
1660
+ const focusTrap = trapFocus(modalRef);
1661
+ const ConfirmIcon = $cerberusIcons.confirmModal;
1662
+ const palette = (0, import_react16.useMemo)(
1663
+ () => (content == null ? void 0 : content.kind) === "destructive" ? "danger" : "action",
1664
+ [content]
1665
+ );
1666
+ const handleChoice = (0, import_react16.useCallback)(
1667
+ (e) => {
1668
+ var _a, _b;
1669
+ const target = e.currentTarget;
1670
+ if (target.value === "true") {
1671
+ (_a = resolveRef.current) == null ? void 0 : _a.call(resolveRef, true);
1672
+ }
1673
+ (_b = resolveRef.current) == null ? void 0 : _b.call(resolveRef, false);
1674
+ close();
1675
+ },
1676
+ [close]
1677
+ );
1678
+ const handleShow = (0, import_react16.useCallback)(
1679
+ (options) => {
1680
+ return new Promise((resolve) => {
1681
+ setContent({ ...options, kind: options.kind || "non-destructive" });
1682
+ show();
1683
+ resolveRef.current = resolve;
1684
+ });
1685
+ },
1686
+ [show]
1687
+ );
1688
+ const value = (0, import_react16.useMemo)(
1689
+ () => ({
1690
+ show: handleShow
1691
+ }),
1692
+ [handleShow]
1693
+ );
1694
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(ConfirmModalContext.Provider, { value, children: [
1695
+ props.children,
1696
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Modal, { onKeyDown: focusTrap, ref: modalRef, children: [
1697
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(ModalHeader, { children: [
1698
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
1699
+ Show,
1700
+ {
1701
+ when: palette === "danger",
1702
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ModalIcon, { palette: "action", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ConfirmIcon, { size: 24 }) }),
1703
+ children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ModalIcon, { palette: "danger", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ConfirmIcon, { size: 24 }) })
1704
+ }
1705
+ ),
1706
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ModalHeading, { children: content == null ? void 0 : content.heading }),
1707
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ModalDescription, { children: content == null ? void 0 : content.description })
1708
+ ] }),
1709
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
1710
+ "div",
1711
+ {
1712
+ className: (0, import_patterns13.hstack)({
1713
+ gap: "4"
1714
+ }),
1715
+ children: [
1716
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
1717
+ Button,
1718
+ {
1719
+ autoFocus: true,
1720
+ className: (0, import_css35.css)({
1721
+ w: "1/2"
1722
+ }),
1723
+ name: "confirm",
1724
+ onClick: handleChoice,
1725
+ palette,
1726
+ value: "true",
1727
+ children: content == null ? void 0 : content.actionText
1728
+ }
1729
+ ),
1730
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
1731
+ Button,
1732
+ {
1733
+ className: (0, import_css35.css)({
1734
+ w: "1/2"
1735
+ }),
1736
+ name: "cancel",
1737
+ onClick: handleChoice,
1738
+ usage: "outlined",
1739
+ value: "false",
1740
+ children: content == null ? void 0 : content.cancelText
1741
+ }
1742
+ )
1743
+ ]
1744
+ }
1745
+ )
1746
+ ] }) })
1747
+ ] });
1748
+ }
1749
+ function useConfirmModal() {
1750
+ const context = (0, import_react16.useContext)(ConfirmModalContext);
1751
+ if (context === null) {
1752
+ throw new Error(
1753
+ "useConfirmModal must be used within a ConfirmModal Provider"
1754
+ );
1755
+ }
1756
+ return context;
1757
+ }
1758
+
1759
+ // src/context/notification-center.tsx
1760
+ var import_react17 = require("react");
1761
+ var import_patterns14 = require("@cerberus/styled-system/patterns");
1762
+ var import_recipes29 = require("@cerberus/styled-system/recipes");
1763
+ var import_css36 = require("@cerberus/styled-system/css");
1764
+ var import_jsx_runtime42 = require("react/jsx-runtime");
1765
+ var NotificationsContext = (0, import_react17.createContext)(null);
1766
+ function NotificationCenter(props) {
1767
+ const [activeNotifications, setActiveNotifications] = (0, import_react17.useState)([]);
1768
+ const styles = (0, import_recipes29.notification)();
1769
+ const handleNotify = (0, import_react17.useCallback)((options) => {
1770
+ setActiveNotifications((prev) => {
1771
+ const id = `${options.palette}:${prev.length + 1}`;
1772
+ return [...prev, { ...options, id }];
1773
+ });
1774
+ }, []);
1775
+ const handleClose = (0, import_react17.useCallback)((e) => {
1776
+ const target = e.currentTarget;
1777
+ setActiveNotifications((prev) => {
1778
+ const item = prev.find((option) => option.id === target.value);
1779
+ if (item == null ? void 0 : item.onClose) item.onClose();
1780
+ return prev.filter((option) => option.id !== target.value);
1781
+ });
1782
+ }, []);
1783
+ const handleCloseAll = (0, import_react17.useCallback)(() => {
1784
+ setActiveNotifications((prev) => {
1785
+ prev.forEach((item) => {
1786
+ if (item.onClose) item.onClose();
1787
+ });
1788
+ return [];
1789
+ });
1790
+ }, []);
1791
+ const value = (0, import_react17.useMemo)(
1792
+ () => ({
1793
+ notify: handleNotify
1794
+ }),
1795
+ [handleNotify]
1796
+ );
1797
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(NotificationsContext.Provider, { value, children: [
1798
+ props.children,
1799
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Show, { when: activeNotifications.length > 0, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Portal, { container: props.container, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: styles.center, children: [
1800
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Show, { when: activeNotifications.length >= 4, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
1801
+ Button,
1802
+ {
1803
+ className: (0, import_css36.cx)(styles.closeAll, (0, import_patterns14.animateIn)()),
1804
+ onClick: handleCloseAll,
1805
+ palette: "action",
1806
+ shape: "rounded",
1807
+ size: "sm",
1808
+ usage: "text",
1809
+ children: "Close all"
1810
+ }
1811
+ ) }),
1812
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
1813
+ "div",
1814
+ {
1815
+ className: (0, import_patterns14.vstack)({
1816
+ alignItems: "flex-end",
1817
+ gap: "4"
1818
+ }),
1819
+ style: {
1820
+ alignItems: "flex-end"
1821
+ },
1822
+ children: activeNotifications.map((option) => /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
1823
+ Notification,
1824
+ {
1825
+ id: option.id,
1826
+ onClose: handleClose,
1827
+ open: true,
1828
+ palette: option.palette,
1829
+ children: [
1830
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(NotificationHeading, { palette: option.palette, children: option.heading }),
1831
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(NotificationDescription, { palette: option.palette, children: option.description })
1832
+ ]
1833
+ },
1834
+ option.id
1835
+ ))
1836
+ }
1837
+ )
1838
+ ] }) }) })
1839
+ ] });
1840
+ }
1841
+ function useNotificationCenter() {
1842
+ const context = (0, import_react17.useContext)(NotificationsContext);
1843
+ if (!context) {
1844
+ throw new Error(
1845
+ "useNotificationCenter must be used within a NotificationsProvider"
1846
+ );
1847
+ }
1848
+ return context;
1849
+ }
1850
+
1851
+ // src/context/prompt-modal.tsx
1852
+ var import_react18 = require("react");
1853
+ var import_css37 = require("@cerberus/styled-system/css");
1854
+ var import_patterns15 = require("@cerberus/styled-system/patterns");
1855
+ var import_jsx_runtime43 = require("react/jsx-runtime");
1856
+ var PromptModalContext = (0, import_react18.createContext)(null);
1857
+ function PromptModal(props) {
1858
+ const { modalRef, show, close } = useModal();
1859
+ const resolveRef = (0, import_react18.useRef)(null);
1860
+ const [content, setContent] = (0, import_react18.useState)(null);
1861
+ const [inputValue, setInputValue] = (0, import_react18.useState)("");
1862
+ const focusTrap = trapFocus(modalRef);
1863
+ const PromptIcon = $cerberusIcons.promptModal;
1864
+ const isValid = (0, import_react18.useMemo)(
1865
+ () => inputValue === (content == null ? void 0 : content.key),
1866
+ [inputValue, content]
1867
+ );
1868
+ const palette = (0, import_react18.useMemo)(
1869
+ () => (content == null ? void 0 : content.kind) === "destructive" ? "danger" : "action",
1870
+ [content]
1871
+ );
1872
+ const handleChange = (0, import_react18.useCallback)(
1873
+ (e) => {
1874
+ setInputValue(e.currentTarget.value);
1875
+ },
1876
+ [content]
1877
+ );
1878
+ const handleChoice = (0, import_react18.useCallback)(
1879
+ (e) => {
1880
+ var _a;
1881
+ const target = e.currentTarget;
1882
+ if (target.value === "true") {
1883
+ (_a = resolveRef.current) == null ? void 0 : _a.call(resolveRef, inputValue);
1884
+ }
1885
+ close();
1886
+ },
1887
+ [inputValue, close]
1888
+ );
1889
+ const handleShow = (0, import_react18.useCallback)(
1890
+ (options) => {
1891
+ return new Promise((resolve) => {
1892
+ setContent({ ...options, kind: options.kind || "non-destructive" });
1893
+ show();
1894
+ resolveRef.current = resolve;
1895
+ });
1896
+ },
1897
+ [show]
1898
+ );
1899
+ const value = (0, import_react18.useMemo)(
1900
+ () => ({
1901
+ show: handleShow
1902
+ }),
1903
+ [handleShow]
1904
+ );
1905
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(PromptModalContext.Provider, { value, children: [
1906
+ props.children,
1907
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Modal, { onKeyDown: focusTrap, ref: modalRef, children: [
1908
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(ModalHeader, { children: [
1909
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
1910
+ Show,
1911
+ {
1912
+ when: palette === "danger",
1913
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ModalIcon, { palette: "action", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(PromptIcon, { size: 24 }) }),
1914
+ children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ModalIcon, { palette: "danger", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(PromptIcon, { size: 24 }) })
1915
+ }
1916
+ ),
1917
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ModalHeading, { children: content == null ? void 0 : content.heading }),
1918
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ModalDescription, { children: content == null ? void 0 : content.description })
1919
+ ] }),
1920
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
1921
+ "div",
1922
+ {
1923
+ className: (0, import_patterns15.vstack)({
1924
+ alignItems: "flex-start",
1925
+ mt: "4",
1926
+ mb: "8"
1927
+ }),
1928
+ children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Field, { invalid: !isValid, children: [
1929
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Label, { htmlFor: "confirm", size: "md", children: [
1930
+ "Type",
1931
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
1932
+ "strong",
1933
+ {
1934
+ className: (0, import_css37.css)({
1935
+ textTransform: "uppercase"
1936
+ }),
1937
+ children: content == null ? void 0 : content.key
1938
+ }
1939
+ ),
1940
+ "to confirm"
1941
+ ] }),
1942
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
1943
+ Input,
1944
+ {
1945
+ id: "confirm",
1946
+ name: "confirm",
1947
+ onChange: handleChange,
1948
+ type: "text"
1949
+ }
1950
+ )
1951
+ ] })
1952
+ }
1953
+ ),
1954
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
1955
+ "div",
1956
+ {
1957
+ className: (0, import_patterns15.hstack)({
1958
+ justifyContent: "stretch",
1959
+ gap: "4"
1960
+ }),
1961
+ children: [
1962
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
1963
+ Button,
1964
+ {
1965
+ autoFocus: true,
1966
+ className: (0, import_css37.css)({
1967
+ w: "1/2"
1968
+ }),
1969
+ disabled: !isValid,
1970
+ name: "confirm",
1971
+ onClick: handleChoice,
1972
+ palette,
1973
+ value: "true",
1974
+ children: content == null ? void 0 : content.actionText
1975
+ }
1976
+ ),
1977
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
1978
+ Button,
1979
+ {
1980
+ className: (0, import_css37.css)({
1981
+ w: "1/2"
1982
+ }),
1983
+ name: "cancel",
1984
+ onClick: handleChoice,
1985
+ usage: "outlined",
1986
+ value: "false",
1987
+ children: content == null ? void 0 : content.cancelText
1988
+ }
1989
+ )
1990
+ ]
1991
+ }
1992
+ )
1993
+ ] }) })
1994
+ ] });
1995
+ }
1996
+ function usePromptModal() {
1997
+ const context = (0, import_react18.useContext)(PromptModalContext);
1998
+ if (context === null) {
1999
+ throw new Error("usePromptModal must be used within a PromptModal Provider");
2000
+ }
2001
+ return context;
2002
+ }
2003
+
2004
+ // src/context/theme.tsx
2005
+ var import_react20 = require("react");
2006
+
2007
+ // src/hooks/useTheme.ts
2008
+ var import_react19 = require("react");
2009
+ function useTheme(defaultTheme = "cerberus", defaultColorMode = "light") {
2010
+ const [theme, setTheme] = (0, import_react19.useState)(defaultTheme);
2011
+ const [colorMode, setColorMode] = (0, import_react19.useState)(defaultColorMode);
2012
+ const handleThemeChange = (0, import_react19.useCallback)((newTheme) => {
2013
+ setTheme(newTheme);
2014
+ localStorage.setItem(THEME_KEY, newTheme);
2015
+ }, []);
2016
+ const handleColorModeChange = (0, import_react19.useCallback)(() => {
2017
+ setColorMode((prev) => {
2018
+ const newMode = prev === "light" ? "dark" : "light";
2019
+ localStorage.setItem(MODE_KEY, newMode);
2020
+ return newMode;
2021
+ });
2022
+ }, []);
2023
+ (0, import_react19.useLayoutEffect)(() => {
2024
+ const theme2 = localStorage.getItem(THEME_KEY);
2025
+ if (theme2) {
2026
+ setTheme(theme2);
2027
+ }
2028
+ }, []);
2029
+ (0, import_react19.useLayoutEffect)(() => {
2030
+ const mode = localStorage.getItem(MODE_KEY);
2031
+ if (mode) {
2032
+ setColorMode(mode);
2033
+ }
2034
+ }, []);
2035
+ (0, import_react19.useEffect)(() => {
2036
+ const root = document.documentElement;
2037
+ root.dataset.theme = theme;
2038
+ }, [theme]);
2039
+ (0, import_react19.useEffect)(() => {
2040
+ const root = document.documentElement;
2041
+ root.dataset.colorMode = colorMode;
2042
+ }, [colorMode]);
2043
+ return (0, import_react19.useMemo)(
2044
+ () => ({
2045
+ theme,
2046
+ mode: colorMode,
2047
+ updateTheme: handleThemeChange,
2048
+ updateMode: handleColorModeChange
2049
+ }),
2050
+ [theme, colorMode, handleThemeChange, handleColorModeChange]
2051
+ );
2052
+ }
2053
+
2054
+ // src/context/theme.tsx
2055
+ var import_jsx_runtime44 = require("react/jsx-runtime");
2056
+ var THEME_KEY = "cerberus-theme";
2057
+ var MODE_KEY = "cerberus-mode";
2058
+ var ThemeContext = (0, import_react20.createContext)(
2059
+ null
2060
+ );
2061
+ function ThemeProvider(props) {
2062
+ const state = useTheme();
2063
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ThemeContext.Provider, { value: state, children: props.children });
2064
+ }
2065
+ function useThemeContext() {
2066
+ const context = (0, import_react20.useContext)(ThemeContext);
2067
+ if (!context) {
2068
+ throw new Error("useThemeContext must be used within a ThemeProvider");
2069
+ }
2070
+ return context;
2071
+ }
2072
+
2073
+ // src/hooks/useToggle.ts
2074
+ var import_react21 = require("react");
2075
+ function useToggle(options) {
2076
+ const [checked, setChecked] = (0, import_react21.useState)((options == null ? void 0 : options.checked) ?? "");
2077
+ const onChange = options == null ? void 0 : options.onChange;
2078
+ const handleChange = (0, import_react21.useCallback)(
2079
+ (e) => {
2080
+ const target = e.currentTarget;
2081
+ setChecked((prev) => {
2082
+ return prev === target.value ? "" : target.value;
2083
+ });
2084
+ onChange == null ? void 0 : onChange(e);
2085
+ },
2086
+ [onChange]
2087
+ );
2088
+ return (0, import_react21.useMemo)(() => ({ checked, handleChange }), [checked, handleChange]);
2089
+ }
2090
+
2091
+ // src/index.ts
2092
+ __reExport(src_exports, require("@dnd-kit/core"), module.exports);
2093
+ // Annotate the CommonJS export names for ESM import in node:
2094
+ 0 && (module.exports = {
2095
+ $cerberusIcons,
2096
+ Button,
2097
+ Checkbox,
2098
+ ConfirmModal,
2099
+ Droppable,
2100
+ FeatureFlag,
2101
+ FeatureFlags,
2102
+ Field,
2103
+ FieldMessage,
2104
+ FileStatus,
2105
+ FileUploader,
2106
+ IconButton,
2107
+ Input,
2108
+ Label,
2109
+ MODE_KEY,
2110
+ Modal,
2111
+ ModalDescription,
2112
+ ModalHeader,
2113
+ ModalHeading,
2114
+ ModalIcon,
2115
+ NavMenu,
2116
+ NavMenuLink,
2117
+ NavMenuList,
2118
+ NavMenuTrigger,
2119
+ Notification,
2120
+ NotificationCenter,
2121
+ NotificationDescription,
2122
+ NotificationHeading,
2123
+ Option,
2124
+ Portal,
2125
+ ProgressBar,
2126
+ PromptModal,
2127
+ Radio,
2128
+ Select,
2129
+ Show,
2130
+ THEME_KEY,
2131
+ Tab,
2132
+ TabList,
2133
+ TabPanel,
2134
+ Table,
2135
+ Tabs,
2136
+ TabsContext,
2137
+ Tag,
2138
+ Tbody,
2139
+ Td,
2140
+ Textarea,
2141
+ Th,
2142
+ Thead,
2143
+ ThemeProvider,
2144
+ Toggle,
2145
+ Tr,
2146
+ createNavTriggerProps,
2147
+ defineIcons,
2148
+ getPosition,
2149
+ processStatus,
2150
+ trapFocus,
2151
+ useConfirmModal,
2152
+ useFeatureFlags,
2153
+ useFieldContext,
2154
+ useModal,
2155
+ useNavMenuContext,
2156
+ useNotificationCenter,
2157
+ usePromptModal,
2158
+ useTabsContext,
2159
+ useTabsKeyboardNavigation,
2160
+ useTheme,
2161
+ useThemeContext,
2162
+ useToggle,
2163
+ ...require("@dnd-kit/core")
2164
+ });
2165
+ //# sourceMappingURL=index.cjs.map