@cerberus-design/react 0.9.2 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (321) hide show
  1. package/build/legacy/_tsup-dts-rollup.d.cts +811 -126
  2. package/build/legacy/aria-helpers/tabs.aria.cjs.map +1 -1
  3. package/build/legacy/components/Avatar.cjs.map +1 -1
  4. package/build/legacy/components/Button.cjs.map +1 -1
  5. package/build/legacy/components/Checkbox.cjs.map +1 -1
  6. package/build/legacy/components/CircularProgress.cjs +180 -0
  7. package/build/legacy/components/CircularProgress.cjs.map +1 -0
  8. package/build/legacy/components/Droppable.cjs.map +1 -1
  9. package/build/legacy/components/FeatureFlag.cjs.map +1 -1
  10. package/build/legacy/components/FieldMessage.cjs.map +1 -1
  11. package/build/legacy/components/FileStatus.cjs +75 -79
  12. package/build/legacy/components/FileStatus.cjs.map +1 -1
  13. package/build/legacy/components/FileUploader.cjs +1 -1
  14. package/build/legacy/components/FileUploader.cjs.map +1 -1
  15. package/build/legacy/components/IconButton.cjs.map +1 -1
  16. package/build/legacy/components/Input.cjs.map +1 -1
  17. package/build/legacy/components/Label.cjs.map +1 -1
  18. package/build/legacy/components/Modal.cjs.map +1 -1
  19. package/build/legacy/components/ModalDescription.cjs.map +1 -1
  20. package/build/legacy/components/ModalHeader.cjs.map +1 -1
  21. package/build/legacy/components/ModalHeading.cjs.map +1 -1
  22. package/build/legacy/components/NavMenuLink.cjs.map +1 -1
  23. package/build/legacy/components/NavMenuList.cjs.map +1 -1
  24. package/build/legacy/components/NavMenuTrigger.cjs.map +1 -1
  25. package/build/legacy/components/Notification.cjs.map +1 -1
  26. package/build/legacy/components/NotificationDescription.cjs.map +1 -1
  27. package/build/legacy/components/NotificationHeading.cjs.map +1 -1
  28. package/build/legacy/components/Portal.cjs.map +1 -1
  29. package/build/legacy/components/ProgressBar.cjs +1 -1
  30. package/build/legacy/components/ProgressBar.cjs.map +1 -1
  31. package/build/legacy/components/Radio.cjs.map +1 -1
  32. package/build/legacy/components/Select.cjs.map +1 -1
  33. package/build/legacy/components/Show.cjs.map +1 -1
  34. package/build/legacy/components/Spinner.cjs +104 -0
  35. package/build/legacy/components/Spinner.cjs.map +1 -0
  36. package/build/legacy/components/Tab.cjs.map +1 -1
  37. package/build/legacy/components/TabList.cjs.map +1 -1
  38. package/build/legacy/components/TabPanel.cjs.map +1 -1
  39. package/build/legacy/components/Table.cjs.map +1 -1
  40. package/build/legacy/components/Tag.cjs +70 -4
  41. package/build/legacy/components/Tag.cjs.map +1 -1
  42. package/build/legacy/components/Tbody.cjs.map +1 -1
  43. package/build/legacy/components/Td.cjs.map +1 -1
  44. package/build/legacy/components/Textarea.cjs.map +1 -1
  45. package/build/legacy/components/Th.cjs.map +1 -1
  46. package/build/legacy/components/Thead.cjs.map +1 -1
  47. package/build/legacy/components/Toggle.cjs.map +1 -1
  48. package/build/legacy/context/confirm-modal.cjs +2 -2
  49. package/build/legacy/context/confirm-modal.cjs.map +1 -1
  50. package/build/legacy/context/feature-flags.cjs.map +1 -1
  51. package/build/legacy/context/field.cjs.map +1 -1
  52. package/build/legacy/context/navMenu.cjs.map +1 -1
  53. package/build/legacy/context/notification-center.cjs +50 -10
  54. package/build/legacy/context/notification-center.cjs.map +1 -1
  55. package/build/legacy/context/prompt-modal.cjs +2 -2
  56. package/build/legacy/context/prompt-modal.cjs.map +1 -1
  57. package/build/legacy/context/tabs.cjs.map +1 -1
  58. package/build/legacy/context/theme.cjs +37 -23
  59. package/build/legacy/context/theme.cjs.map +1 -1
  60. package/build/legacy/hooks/useModal.cjs.map +1 -1
  61. package/build/legacy/hooks/useTheme.cjs +41 -32
  62. package/build/legacy/hooks/useTheme.cjs.map +1 -1
  63. package/build/legacy/hooks/useToggle.cjs.map +1 -1
  64. package/build/legacy/index.cjs +605 -316
  65. package/build/legacy/index.cjs.map +1 -1
  66. package/build/modern/_tsup-dts-rollup.d.ts +811 -126
  67. package/build/modern/aria-helpers/tabs.aria.js +2 -2
  68. package/build/modern/{chunk-DGJPW76I.js → chunk-2RPWSVRX.js} +13 -13
  69. package/build/modern/chunk-2RPWSVRX.js.map +1 -0
  70. package/build/modern/{chunk-JB7IQ2BM.js → chunk-2UXE5PDG.js} +1 -1
  71. package/build/modern/chunk-2UXE5PDG.js.map +1 -0
  72. package/build/modern/{chunk-4CAT3FHV.js → chunk-2VX52EEJ.js} +1 -1
  73. package/build/modern/chunk-2VX52EEJ.js.map +1 -0
  74. package/build/modern/chunk-3O6UTN3J.js +155 -0
  75. package/build/modern/chunk-3O6UTN3J.js.map +1 -0
  76. package/build/modern/{chunk-UN3OAW56.js → chunk-477G5ZEL.js} +2 -2
  77. package/build/modern/chunk-477G5ZEL.js.map +1 -0
  78. package/build/modern/{chunk-PMCYXRAH.js → chunk-5V5MBSM3.js} +3 -3
  79. package/build/modern/chunk-5V5MBSM3.js.map +1 -0
  80. package/build/modern/{chunk-3GXISGPS.js → chunk-7K6PZBHN.js} +2 -2
  81. package/build/modern/chunk-7K6PZBHN.js.map +1 -0
  82. package/build/modern/chunk-7SYJFI5E.js +80 -0
  83. package/build/modern/chunk-7SYJFI5E.js.map +1 -0
  84. package/build/modern/{chunk-ZCIJRM2X.js → chunk-AUAPBPGW.js} +5 -5
  85. package/build/modern/chunk-AUAPBPGW.js.map +1 -0
  86. package/build/modern/{chunk-A5WYZVUR.js → chunk-B4CVET74.js} +1 -1
  87. package/build/modern/chunk-B4CVET74.js.map +1 -0
  88. package/build/modern/{chunk-2UFNQM55.js → chunk-BE4EOU2P.js} +1 -1
  89. package/build/modern/{chunk-2UFNQM55.js.map → chunk-BE4EOU2P.js.map} +1 -1
  90. package/build/modern/{chunk-VULPMZUW.js → chunk-BIDE4IJG.js} +3 -3
  91. package/build/modern/chunk-BIDE4IJG.js.map +1 -0
  92. package/build/modern/{chunk-4O4QFF4S.js → chunk-BUVVRQLZ.js} +1 -1
  93. package/build/modern/chunk-BUVVRQLZ.js.map +1 -0
  94. package/build/modern/{chunk-4M3EUP57.js → chunk-CJFW36DZ.js} +1 -1
  95. package/build/modern/chunk-CJFW36DZ.js.map +1 -0
  96. package/build/modern/{chunk-T7TOXGZT.js → chunk-E6QFLLXH.js} +21 -21
  97. package/build/modern/chunk-E6QFLLXH.js.map +1 -0
  98. package/build/modern/chunk-EB37HRCN.js +31 -0
  99. package/build/modern/chunk-EB37HRCN.js.map +1 -0
  100. package/build/modern/chunk-EJOXOICK.js +75 -0
  101. package/build/modern/chunk-EJOXOICK.js.map +1 -0
  102. package/build/modern/{chunk-6F34A7NZ.js → chunk-EXGKZGML.js} +1 -1
  103. package/build/modern/chunk-EXGKZGML.js.map +1 -0
  104. package/build/modern/{chunk-ISPTI4GC.js → chunk-EZYCKM7R.js} +2 -2
  105. package/build/modern/chunk-EZYCKM7R.js.map +1 -0
  106. package/build/modern/{chunk-4YJOK7JJ.js → chunk-GMG3B34U.js} +2 -2
  107. package/build/modern/chunk-GMG3B34U.js.map +1 -0
  108. package/build/modern/{chunk-U72VPIZA.js → chunk-HHVQ6LCA.js} +3 -3
  109. package/build/modern/chunk-HHVQ6LCA.js.map +1 -0
  110. package/build/modern/{chunk-XREC5IJE.js → chunk-HPM2XRWT.js} +1 -1
  111. package/build/modern/chunk-HPM2XRWT.js.map +1 -0
  112. package/build/modern/{chunk-2FK7NR7Y.js → chunk-I35HMGJQ.js} +5 -5
  113. package/build/modern/chunk-I35HMGJQ.js.map +1 -0
  114. package/build/modern/{chunk-WWJRKSM5.js → chunk-ILZKQP6R.js} +16 -16
  115. package/build/modern/chunk-ILZKQP6R.js.map +1 -0
  116. package/build/modern/{chunk-GKUDLVOV.js → chunk-ITOIXNJS.js} +2 -2
  117. package/build/modern/{chunk-XOVQGPIE.js → chunk-JCGWTIR4.js} +4 -4
  118. package/build/modern/chunk-JCGWTIR4.js.map +1 -0
  119. package/build/modern/{chunk-TCO46FK7.js → chunk-JIJM6JFJ.js} +2 -2
  120. package/build/modern/chunk-JIJM6JFJ.js.map +1 -0
  121. package/build/modern/{chunk-VGHVH2T3.js → chunk-JWIJHSI6.js} +5 -3
  122. package/build/modern/chunk-JWIJHSI6.js.map +1 -0
  123. package/build/modern/{chunk-6DIGPXAD.js → chunk-KBBASJIY.js} +2 -2
  124. package/build/modern/chunk-KBBASJIY.js.map +1 -0
  125. package/build/modern/{chunk-SONHHNYQ.js → chunk-LFWAJ5DX.js} +3 -3
  126. package/build/modern/chunk-LFWAJ5DX.js.map +1 -0
  127. package/build/modern/{chunk-PH64POOB.js → chunk-LJYCFFX7.js} +2 -2
  128. package/build/modern/chunk-LJYCFFX7.js.map +1 -0
  129. package/build/modern/{chunk-O6WHVUEW.js → chunk-NUGDTZCL.js} +59 -19
  130. package/build/modern/chunk-NUGDTZCL.js.map +1 -0
  131. package/build/modern/{chunk-VRPAW76S.js → chunk-O6JYYVO7.js} +5 -5
  132. package/build/modern/chunk-O6JYYVO7.js.map +1 -0
  133. package/build/modern/{chunk-KJUCHZHV.js → chunk-O75QAT4Z.js} +1 -1
  134. package/build/modern/chunk-O75QAT4Z.js.map +1 -0
  135. package/build/modern/{chunk-C5HLLGME.js → chunk-OW62FLJ6.js} +1 -1
  136. package/build/modern/chunk-OW62FLJ6.js.map +1 -0
  137. package/build/modern/{chunk-RPZAPUCF.js → chunk-OWKN5IV7.js} +3 -3
  138. package/build/modern/chunk-OWKN5IV7.js.map +1 -0
  139. package/build/modern/{chunk-PJ3744I6.js → chunk-PKQTTFWA.js} +1 -1
  140. package/build/modern/chunk-PKQTTFWA.js.map +1 -0
  141. package/build/modern/{chunk-N3FUF4TB.js → chunk-PKY46RRA.js} +1 -1
  142. package/build/modern/chunk-PKY46RRA.js.map +1 -0
  143. package/build/modern/{chunk-4M4LCQ43.js → chunk-Q7BRMIBR.js} +1 -1
  144. package/build/modern/{chunk-4M4LCQ43.js.map → chunk-Q7BRMIBR.js.map} +1 -1
  145. package/build/modern/{chunk-QEA6N6TN.js → chunk-REO5GUNC.js} +1 -1
  146. package/build/modern/chunk-REO5GUNC.js.map +1 -0
  147. package/build/modern/{chunk-KF24CS4S.js → chunk-RIFQSCHT.js} +1 -1
  148. package/build/modern/chunk-RIFQSCHT.js.map +1 -0
  149. package/build/modern/{chunk-Z6IWNVPN.js → chunk-S7XGIQY6.js} +10 -4
  150. package/build/modern/chunk-S7XGIQY6.js.map +1 -0
  151. package/build/modern/{chunk-3C2DJSEE.js → chunk-SXIXDXG3.js} +1 -1
  152. package/build/modern/chunk-SXIXDXG3.js.map +1 -0
  153. package/build/modern/{chunk-7VJOPJVX.js → chunk-TKI2CKHH.js} +1 -1
  154. package/build/modern/chunk-TKI2CKHH.js.map +1 -0
  155. package/build/modern/{chunk-SLHX5K6I.js → chunk-UBJBMOG7.js} +4 -2
  156. package/build/modern/chunk-UBJBMOG7.js.map +1 -0
  157. package/build/modern/{chunk-ZAU4JVLL.js → chunk-UZDVOIW5.js} +1 -1
  158. package/build/modern/chunk-UZDVOIW5.js.map +1 -0
  159. package/build/modern/{chunk-QZ6NS6VN.js → chunk-VG46RHBJ.js} +1 -1
  160. package/build/modern/chunk-VG46RHBJ.js.map +1 -0
  161. package/build/modern/{chunk-QU7UV5DB.js → chunk-WLEX22KS.js} +1 -1
  162. package/build/modern/chunk-WLEX22KS.js.map +1 -0
  163. package/build/modern/{chunk-FMFKM2AB.js → chunk-WZOYPFUU.js} +5 -5
  164. package/build/modern/chunk-WZOYPFUU.js.map +1 -0
  165. package/build/modern/{chunk-HW76XVA3.js → chunk-XEW6TJJ4.js} +1 -1
  166. package/build/modern/chunk-XEW6TJJ4.js.map +1 -0
  167. package/build/modern/{chunk-TYTEREKZ.js → chunk-ZFK33MVD.js} +2 -2
  168. package/build/modern/chunk-ZFK33MVD.js.map +1 -0
  169. package/build/modern/components/Avatar.js +2 -2
  170. package/build/modern/components/Button.js +1 -1
  171. package/build/modern/components/Checkbox.js +3 -3
  172. package/build/modern/components/CircularProgress.js +8 -0
  173. package/build/modern/components/CircularProgress.js.map +1 -0
  174. package/build/modern/components/Droppable.js +1 -1
  175. package/build/modern/components/FeatureFlag.js +3 -3
  176. package/build/modern/components/FieldMessage.js +2 -2
  177. package/build/modern/components/FileStatus.js +7 -7
  178. package/build/modern/components/FileUploader.js +3 -3
  179. package/build/modern/components/IconButton.js +1 -1
  180. package/build/modern/components/Input.js +3 -3
  181. package/build/modern/components/Label.js +3 -3
  182. package/build/modern/components/Modal.js +1 -1
  183. package/build/modern/components/ModalDescription.js +1 -1
  184. package/build/modern/components/ModalHeader.js +1 -1
  185. package/build/modern/components/ModalHeading.js +1 -1
  186. package/build/modern/components/NavMenuLink.js +2 -2
  187. package/build/modern/components/NavMenuList.js +3 -3
  188. package/build/modern/components/NavMenuTrigger.js +3 -3
  189. package/build/modern/components/Notification.js +1 -1
  190. package/build/modern/components/NotificationDescription.js +1 -1
  191. package/build/modern/components/NotificationHeading.js +1 -1
  192. package/build/modern/components/Portal.js +1 -1
  193. package/build/modern/components/ProgressBar.js +1 -1
  194. package/build/modern/components/Radio.js +2 -2
  195. package/build/modern/components/Select.js +3 -3
  196. package/build/modern/components/Show.js +1 -1
  197. package/build/modern/components/Spinner.js +7 -0
  198. package/build/modern/components/Spinner.js.map +1 -0
  199. package/build/modern/components/Tab.js +3 -3
  200. package/build/modern/components/TabList.js +2 -2
  201. package/build/modern/components/TabPanel.js +3 -3
  202. package/build/modern/components/Table.js +1 -1
  203. package/build/modern/components/Tag.js +5 -2
  204. package/build/modern/components/Tbody.js +1 -1
  205. package/build/modern/components/Td.js +1 -1
  206. package/build/modern/components/Textarea.js +2 -2
  207. package/build/modern/components/Th.js +2 -2
  208. package/build/modern/components/Thead.js +1 -1
  209. package/build/modern/components/Toggle.js +2 -2
  210. package/build/modern/context/confirm-modal.js +10 -10
  211. package/build/modern/context/feature-flags.js +1 -1
  212. package/build/modern/context/field.js +1 -1
  213. package/build/modern/context/navMenu.js +1 -1
  214. package/build/modern/context/notification-center.js +7 -7
  215. package/build/modern/context/prompt-modal.js +13 -13
  216. package/build/modern/context/tabs.js +1 -1
  217. package/build/modern/context/theme.js +2 -5
  218. package/build/modern/hooks/useModal.js +1 -1
  219. package/build/modern/hooks/useTheme.js +5 -1
  220. package/build/modern/hooks/useToggle.js +1 -1
  221. package/build/modern/index.js +78 -68
  222. package/build/modern/index.js.map +1 -1
  223. package/package.json +3 -4
  224. package/src/components/Avatar.tsx +28 -1
  225. package/src/components/Button.tsx +1 -1
  226. package/src/components/Checkbox.tsx +11 -1
  227. package/src/components/CircularProgress.tsx +170 -0
  228. package/src/components/Droppable.tsx +13 -0
  229. package/src/components/FeatureFlag.tsx +7 -0
  230. package/src/components/FieldMessage.tsx +13 -6
  231. package/src/components/FileStatus.tsx +43 -16
  232. package/src/components/FileUploader.tsx +11 -1
  233. package/src/components/IconButton.tsx +15 -5
  234. package/src/components/Input.tsx +21 -4
  235. package/src/components/Label.tsx +13 -8
  236. package/src/components/Modal.tsx +8 -3
  237. package/src/components/ModalDescription.tsx +1 -0
  238. package/src/components/ModalHeader.tsx +1 -0
  239. package/src/components/ModalHeading.tsx +1 -0
  240. package/src/components/NavMenuLink.tsx +22 -0
  241. package/src/components/NavMenuList.tsx +37 -5
  242. package/src/components/NavMenuTrigger.tsx +13 -0
  243. package/src/components/Notification.tsx +13 -6
  244. package/src/components/NotificationDescription.tsx +8 -6
  245. package/src/components/NotificationHeading.tsx +8 -6
  246. package/src/components/Portal.tsx +9 -2
  247. package/src/components/ProgressBar.tsx +15 -5
  248. package/src/components/Radio.tsx +29 -0
  249. package/src/components/Select.tsx +17 -8
  250. package/src/components/Show.tsx +16 -5
  251. package/src/components/Spinner.tsx +82 -0
  252. package/src/components/Tab.tsx +13 -5
  253. package/src/components/TabList.tsx +5 -1
  254. package/src/components/TabPanel.tsx +7 -2
  255. package/src/components/Table.tsx +6 -3
  256. package/src/components/Tag.tsx +34 -7
  257. package/src/components/Tbody.tsx +7 -1
  258. package/src/components/Td.tsx +2 -1
  259. package/src/components/Textarea.tsx +9 -4
  260. package/src/components/Th.tsx +13 -1
  261. package/src/components/Thead.tsx +2 -1
  262. package/src/components/Toggle.tsx +35 -0
  263. package/src/context/confirm-modal.tsx +19 -2
  264. package/src/context/feature-flags.tsx +4 -1
  265. package/src/context/field.tsx +26 -0
  266. package/src/context/navMenu.tsx +25 -0
  267. package/src/context/notification-center.tsx +84 -12
  268. package/src/context/prompt-modal.tsx +41 -3
  269. package/src/context/tabs.tsx +31 -4
  270. package/src/context/theme.tsx +47 -10
  271. package/src/hooks/useModal.ts +14 -0
  272. package/src/hooks/useTheme.ts +66 -17
  273. package/src/hooks/useToggle.ts +22 -0
  274. package/src/index.ts +2 -0
  275. package/build/modern/chunk-2FK7NR7Y.js.map +0 -1
  276. package/build/modern/chunk-3C2DJSEE.js.map +0 -1
  277. package/build/modern/chunk-3GXISGPS.js.map +0 -1
  278. package/build/modern/chunk-4CAT3FHV.js.map +0 -1
  279. package/build/modern/chunk-4M3EUP57.js.map +0 -1
  280. package/build/modern/chunk-4O4QFF4S.js.map +0 -1
  281. package/build/modern/chunk-4YJOK7JJ.js.map +0 -1
  282. package/build/modern/chunk-6DIGPXAD.js.map +0 -1
  283. package/build/modern/chunk-6F34A7NZ.js.map +0 -1
  284. package/build/modern/chunk-7VJOPJVX.js.map +0 -1
  285. package/build/modern/chunk-A5WYZVUR.js.map +0 -1
  286. package/build/modern/chunk-C5HLLGME.js.map +0 -1
  287. package/build/modern/chunk-DGJPW76I.js.map +0 -1
  288. package/build/modern/chunk-FMFKM2AB.js.map +0 -1
  289. package/build/modern/chunk-HW76XVA3.js.map +0 -1
  290. package/build/modern/chunk-ISPTI4GC.js.map +0 -1
  291. package/build/modern/chunk-JB7IQ2BM.js.map +0 -1
  292. package/build/modern/chunk-KF24CS4S.js.map +0 -1
  293. package/build/modern/chunk-KJUCHZHV.js.map +0 -1
  294. package/build/modern/chunk-N3FUF4TB.js.map +0 -1
  295. package/build/modern/chunk-O6WHVUEW.js.map +0 -1
  296. package/build/modern/chunk-PH64POOB.js.map +0 -1
  297. package/build/modern/chunk-PJ3744I6.js.map +0 -1
  298. package/build/modern/chunk-PMCYXRAH.js.map +0 -1
  299. package/build/modern/chunk-QEA6N6TN.js.map +0 -1
  300. package/build/modern/chunk-QU7UV5DB.js.map +0 -1
  301. package/build/modern/chunk-QZ6NS6VN.js.map +0 -1
  302. package/build/modern/chunk-RPZAPUCF.js.map +0 -1
  303. package/build/modern/chunk-SLHX5K6I.js.map +0 -1
  304. package/build/modern/chunk-SONHHNYQ.js.map +0 -1
  305. package/build/modern/chunk-SXXWC6UD.js +0 -83
  306. package/build/modern/chunk-SXXWC6UD.js.map +0 -1
  307. package/build/modern/chunk-T7TOXGZT.js.map +0 -1
  308. package/build/modern/chunk-TCO46FK7.js.map +0 -1
  309. package/build/modern/chunk-TYTEREKZ.js.map +0 -1
  310. package/build/modern/chunk-U72VPIZA.js.map +0 -1
  311. package/build/modern/chunk-UN3OAW56.js.map +0 -1
  312. package/build/modern/chunk-VGHVH2T3.js.map +0 -1
  313. package/build/modern/chunk-VRPAW76S.js.map +0 -1
  314. package/build/modern/chunk-VULPMZUW.js.map +0 -1
  315. package/build/modern/chunk-WWJRKSM5.js.map +0 -1
  316. package/build/modern/chunk-XOVQGPIE.js.map +0 -1
  317. package/build/modern/chunk-XREC5IJE.js.map +0 -1
  318. package/build/modern/chunk-Z6IWNVPN.js.map +0 -1
  319. package/build/modern/chunk-ZAU4JVLL.js.map +0 -1
  320. package/build/modern/chunk-ZCIJRM2X.js.map +0 -1
  321. /package/build/modern/{chunk-GKUDLVOV.js.map → chunk-ITOIXNJS.js.map} +0 -0
@@ -26,10 +26,26 @@ import { cx } from '@cerberus/styled-system/css'
26
26
  */
27
27
 
28
28
  export interface NotifyOptions {
29
+ /**
30
+ * The palette of the notification.
31
+ * @default 'info'
32
+ */
29
33
  palette: 'info' | 'success' | 'warning' | 'danger'
34
+ /**
35
+ * The heading of the notification.
36
+ */
30
37
  heading: string
38
+ /**
39
+ * The unique id of the notification.
40
+ */
31
41
  id?: string
42
+ /**
43
+ * The description of the notification.
44
+ */
32
45
  description?: ReactNode
46
+ /**
47
+ * The action to take when the notification is closed
48
+ */
33
49
  onClose?: () => void
34
50
  }
35
51
 
@@ -43,6 +59,7 @@ export interface NotificationsProviderProps extends PortalProps {}
43
59
 
44
60
  /**
45
61
  * Provides a notification center to the app.
62
+ * @see https://cerberus.digitalu.design/react/notification
46
63
  * @example
47
64
  * ```tsx
48
65
  * // Wrap the Provider around the root of the feature.
@@ -134,20 +151,11 @@ export function NotificationCenter(
134
151
  }}
135
152
  >
136
153
  {activeNotifications.map((option) => (
137
- <Notification
138
- id={option.id!}
154
+ <MatchNotification
139
155
  key={option.id}
156
+ {...option}
140
157
  onClose={handleClose}
141
- open
142
- palette={option.palette}
143
- >
144
- <NotificationHeading palette={option.palette}>
145
- {option.heading}
146
- </NotificationHeading>
147
- <NotificationDescription palette={option.palette}>
148
- {option.description}
149
- </NotificationDescription>
150
- </Notification>
158
+ />
151
159
  ))}
152
160
  </div>
153
161
  </div>
@@ -157,6 +165,70 @@ export function NotificationCenter(
157
165
  )
158
166
  }
159
167
 
168
+ interface MatchNotificationProps extends Omit<NotifyOptions, 'onClose'> {
169
+ onClose: (e: MouseEvent<HTMLButtonElement>) => void
170
+ key: string | undefined
171
+ }
172
+
173
+ function MatchNotification(props: MatchNotificationProps) {
174
+ const { palette, id, onClose, heading, description } = props
175
+
176
+ switch (palette) {
177
+ case 'success':
178
+ return (
179
+ <Notification
180
+ id={id!}
181
+ key={id}
182
+ onClose={onClose}
183
+ open
184
+ palette="success"
185
+ >
186
+ <NotificationHeading palette="success">{heading}</NotificationHeading>
187
+ <NotificationDescription palette="success">
188
+ {description}
189
+ </NotificationDescription>
190
+ </Notification>
191
+ )
192
+
193
+ case 'warning':
194
+ return (
195
+ <Notification
196
+ id={id!}
197
+ key={id}
198
+ onClose={onClose}
199
+ open
200
+ palette="warning"
201
+ >
202
+ <NotificationHeading palette="warning">{heading}</NotificationHeading>
203
+ <NotificationDescription palette="warning">
204
+ {description}
205
+ </NotificationDescription>
206
+ </Notification>
207
+ )
208
+
209
+ case 'danger':
210
+ return (
211
+ <Notification id={id!} key={id} onClose={onClose} open palette="danger">
212
+ <NotificationHeading palette="danger">{heading}</NotificationHeading>
213
+ <NotificationDescription palette="danger">
214
+ {description}
215
+ </NotificationDescription>
216
+ </Notification>
217
+ )
218
+
219
+ case 'info':
220
+ default:
221
+ return (
222
+ <Notification id={id!} key={id} onClose={onClose} open palette="info">
223
+ <NotificationHeading palette="info">{heading}</NotificationHeading>
224
+ <NotificationDescription palette="info">
225
+ {description}
226
+ </NotificationDescription>
227
+ </Notification>
228
+ )
229
+ }
230
+ }
231
+
160
232
  /**
161
233
  * The hook to use the NotificationCenter.
162
234
  * @returns The notify method to trigger a notification.
@@ -30,15 +30,34 @@ import { Avatar } from '../components/Avatar'
30
30
 
31
31
  /**
32
32
  * This module provides a context and hook for the prompt modal.
33
- * @module
33
+ * @module PromptModal
34
34
  */
35
35
 
36
36
  export interface ShowPromptModalOptions {
37
+ /**
38
+ * The kind of prompt modal to show.
39
+ * @default 'non-destructive'
40
+ */
37
41
  kind?: 'destructive' | 'non-destructive'
42
+ /**
43
+ * The heading of the prompt modal.
44
+ */
38
45
  heading: string
46
+ /**
47
+ * The description of the prompt modal.
48
+ */
39
49
  description?: string
50
+ /**
51
+ * The key to confirm the action.
52
+ */
40
53
  key: string
54
+ /**
55
+ * The text for the action button.
56
+ */
41
57
  actionText: string
58
+ /**
59
+ * The text for the cancel button.
60
+ */
42
61
  cancelText: string
43
62
  }
44
63
  export type PromptShowResult =
@@ -46,6 +65,21 @@ export type PromptShowResult =
46
65
  | null
47
66
 
48
67
  export interface PromptModalValue {
68
+ /**
69
+ * The method to trigger the prompt modal.
70
+ * @returns the value of the key if the action is confirmed.
71
+ * @example
72
+ * ```tsx
73
+ * const accepted = await prompt.show({
74
+ * kind: 'destructive',
75
+ * heading: 'Delete channel?',
76
+ * description:
77
+ * 'This will permanently delete a channel on your account. There is no going back.',
78
+ * key: CHANNEL_NAME,
79
+ * actionText: 'Yes, delete channel',
80
+ * cancelText: 'No, cancel',
81
+ * })
82
+ */
49
83
  show: (options: ShowPromptModalOptions) => Promise<string>
50
84
  }
51
85
 
@@ -55,6 +89,7 @@ export interface PromptModalProviderProps {}
55
89
 
56
90
  /**
57
91
  * Provides a prompt modal to the app.
92
+ * @see https://cerberus.digitalu.design/react/prompt-modal
58
93
  * @example
59
94
  * ```tsx
60
95
  * // Wrap the Provider around the root of the feature.
@@ -153,7 +188,7 @@ export function PromptModal(
153
188
  fallback={
154
189
  <Avatar
155
190
  ariaLabel=""
156
- gradient="light-purple"
191
+ gradient="charon-light"
157
192
  icon={<PromptIcon size={24} />}
158
193
  src=""
159
194
  />
@@ -161,7 +196,7 @@ export function PromptModal(
161
196
  >
162
197
  <Avatar
163
198
  ariaLabel=""
164
- gradient="red"
199
+ gradient="hades-dark"
165
200
  icon={<PromptIcon size={24} />}
166
201
  src=""
167
202
  />
@@ -236,6 +271,9 @@ export function PromptModal(
236
271
  )
237
272
  }
238
273
 
274
+ /**
275
+ * Used to retrieve the context of the PromptModal provider.
276
+ */
239
277
  export function usePromptModal(): PromptModalValue {
240
278
  const context = useContext(PromptModalContext)
241
279
  if (context === null) {
@@ -15,30 +15,53 @@ import {
15
15
 
16
16
  /**
17
17
  * This module provides a Tabs component and a hook to access its context.
18
- * @module
18
+ * @module Tabs
19
19
  */
20
20
 
21
21
  export interface TabsContextValue {
22
+ /**
23
+ * The ref for the tabs.
24
+ */
22
25
  tabs: MutableRefObject<HTMLButtonElement[]>
26
+ /**
27
+ * The id of the tabs component.
28
+ */
23
29
  id: string
30
+ /**
31
+ * The active tab id.
32
+ */
24
33
  active: string
34
+ /**
35
+ * The styles for the tabs.
36
+ */
25
37
  styles: Pretty<Record<'tabList' | 'tab' | 'tabPanel', string>>
38
+ /**
39
+ * Called when the active tab is updated.
40
+ */
26
41
  onTabUpdate: (active: string) => void
27
42
  }
28
43
 
29
44
  export const TabsContext = createContext<TabsContextValue | null>(null)
30
45
 
31
46
  export interface TabsProps {
47
+ /**
48
+ * A unique identifier for the Tabs component. Typically used when there are
49
+ * multiple Tabs components on the same page.
50
+ */
32
51
  id?: string
52
+ /**
53
+ * The default active tab id.
54
+ */
33
55
  active?: string
56
+ /**
57
+ * Whether to cache the active tab state in local storage.
58
+ */
34
59
  cache?: boolean
35
60
  }
36
61
 
37
62
  /**
38
63
  * The Tabs component provides a context to manage tab state.
39
- * @param id - the id of the tabs component,
40
- * @param active - the default active tab id,
41
- * @param cache - whether to cache the active tab state in local storage
64
+ * @see https://cerberus.digitalu.design/react/tabs
42
65
  * @example
43
66
  * ```tsx
44
67
  * <Tabs cache>
@@ -96,6 +119,10 @@ export function Tabs(
96
119
  )
97
120
  }
98
121
 
122
+ /**
123
+ * Used to access the tabs context.
124
+ * @returns The tabs context.
125
+ */
99
126
  export function useTabsContext(): TabsContextValue {
100
127
  const context = useContext(TabsContext)
101
128
  if (!context) {
@@ -1,28 +1,55 @@
1
1
  'use client'
2
2
 
3
3
  import { createContext, useContext, type PropsWithChildren } from 'react'
4
- import { useTheme } from '../hooks/useTheme'
4
+ import { useTheme, type UseThemeOptions } from '../hooks/useTheme'
5
5
 
6
- export type DefaultThemes = 'cerberus'
6
+ /**
7
+ * This module provides a context and hook for the theme.
8
+ * @module Theme
9
+ */
10
+
11
+ export type DefaultThemes = 'cerberus' | 'acheron'
7
12
  export type CustomThemes<K extends string = DefaultThemes> = 'cerberus' | K
8
- export type ColorModes = 'light' | 'dark'
13
+ export type ColorModes = 'light' | 'dark' | 'system'
9
14
 
10
15
  export interface ThemeContextValue<T extends string = DefaultThemes> {
16
+ /**
17
+ * The current theme.
18
+ */
11
19
  theme: CustomThemes<T>
20
+ /**
21
+ * The current color mode.
22
+ */
12
23
  mode: ColorModes
24
+ /**
25
+ * Called when the theme is updated.
26
+ */
13
27
  updateTheme: (theme: T) => void
14
- updateMode: () => void
28
+ /**
29
+ * Called when the color mode is updated.
30
+ */
31
+ updateMode: (mode: ColorModes) => void
15
32
  }
16
33
 
17
- export const THEME_KEY = 'cerberus-theme'
18
- export const MODE_KEY = 'cerberus-mode'
19
-
20
34
  const ThemeContext = createContext<ThemeContextValue<DefaultThemes> | null>(
21
35
  null,
22
36
  )
23
37
 
38
+ export interface ThemeProviderProps extends UseThemeOptions {
39
+ /**
40
+ * The default theme.
41
+ */
42
+ defaultTheme?: DefaultThemes
43
+ /**
44
+ * The default color mode.
45
+ */
46
+ defaultColorMode?: ColorModes
47
+ }
48
+
24
49
  /**
25
- * A context provider that allows the user to set the theme and mode of the application.
50
+ * A context provider that allows the user to set the theme and mode of the
51
+ * application.
52
+ * @see https://cerberus.digitalu.design/react/use-theme-context
26
53
  * @example
27
54
  * ```tsx
28
55
  * <ThemeProvider>
@@ -30,8 +57,15 @@ const ThemeContext = createContext<ThemeContextValue<DefaultThemes> | null>(
30
57
  * </ThemeProvider>
31
58
  * ```
32
59
  */
33
- export function ThemeProvider(props: PropsWithChildren<unknown>): JSX.Element {
34
- const state = useTheme()
60
+ export function ThemeProvider(
61
+ props: PropsWithChildren<ThemeProviderProps>,
62
+ ): JSX.Element {
63
+ const state = useTheme(props.defaultTheme, props.defaultColorMode, {
64
+ cache: props.cache,
65
+ updateMode: props.updateMode,
66
+ updateTheme: props.updateTheme,
67
+ }) as ThemeContextValue<DefaultThemes>
68
+
35
69
  return (
36
70
  <ThemeContext.Provider value={state}>
37
71
  {props.children}
@@ -39,6 +73,9 @@ export function ThemeProvider(props: PropsWithChildren<unknown>): JSX.Element {
39
73
  )
40
74
  }
41
75
 
76
+ /**
77
+ * Used to access the theme context.
78
+ */
42
79
  export function useThemeContext(): ThemeContextValue<DefaultThemes> {
43
80
  const context = useContext(ThemeContext)
44
81
  if (!context) {
@@ -8,11 +8,25 @@ import { useCallback, useMemo, useRef, type RefObject } from 'react'
8
8
  */
9
9
 
10
10
  interface UseModalReturnValue {
11
+ /**
12
+ * The ref for the modal.
13
+ */
11
14
  modalRef: RefObject<HTMLDialogElement>
15
+ /**
16
+ * Shows the modal.
17
+ */
12
18
  show: () => void
19
+ /**
20
+ * Closes the modal.
21
+ */
13
22
  close: () => void
14
23
  }
15
24
 
25
+ /**
26
+ * Provides a hook for using a custom modal.
27
+ * @memberof module:Modal
28
+ * @returns The modal hook.
29
+ */
16
30
  export function useModal(): UseModalReturnValue {
17
31
  const modalRef = useRef<HTMLDialogElement | null>(null)
18
32
 
@@ -8,33 +8,66 @@ import {
8
8
  useState,
9
9
  } from 'react'
10
10
  import {
11
- MODE_KEY,
12
- THEME_KEY,
13
11
  type ColorModes,
14
12
  type CustomThemes,
15
13
  type DefaultThemes,
16
14
  type ThemeContextValue,
17
15
  } from '../context/theme'
18
16
 
17
+ /**
18
+ * This module provides a hook for using the theme.
19
+ * @module
20
+ */
21
+
22
+ export const THEME_KEY = 'cerberus-theme'
23
+ export const MODE_KEY = 'cerberus-mode'
24
+
25
+ export interface UseThemeOptions<T extends string = DefaultThemes> {
26
+ /**
27
+ * Whether to cache the theme in local storage.
28
+ */
29
+ cache?: boolean
30
+ /**
31
+ * Called when the theme is updated.
32
+ */
33
+ updateTheme?: (theme: T) => void
34
+ /**
35
+ * Called when the color mode is updated.
36
+ */
37
+ updateMode?: (mode: ColorModes) => void
38
+ }
39
+
40
+ /**
41
+ * Provides a hook for using the theme for a single instance of the application.
42
+ * @see https://cerberus.digitalu.design/react/use-theme
43
+ * @param defaultTheme The default theme.
44
+ * @param defaultColorMode The default color mode.
45
+ * @param options Additional options.
46
+ */
19
47
  export function useTheme<C extends string = DefaultThemes>(
20
48
  defaultTheme: CustomThemes<C> = 'cerberus',
21
49
  defaultColorMode: ColorModes = 'light',
50
+ options: UseThemeOptions<C> = {},
22
51
  ): ThemeContextValue<C> {
52
+ const { updateMode, updateTheme, cache } = options
23
53
  const [theme, setTheme] = useState<CustomThemes<C>>(defaultTheme)
24
54
  const [colorMode, setColorMode] = useState<ColorModes>(defaultColorMode)
25
55
 
26
- const handleThemeChange = useCallback((newTheme: CustomThemes<C>) => {
27
- setTheme(newTheme)
28
- localStorage.setItem(THEME_KEY, newTheme)
29
- }, [])
56
+ const handleThemeChange = useCallback(
57
+ (newTheme: C) => {
58
+ setTheme(newTheme)
59
+ updateTheme?.(newTheme)
60
+ },
61
+ [updateTheme],
62
+ )
30
63
 
31
- const handleColorModeChange = useCallback(() => {
32
- setColorMode((prev) => {
33
- const newMode = prev === 'light' ? 'dark' : 'light'
34
- localStorage.setItem(MODE_KEY, newMode)
35
- return newMode
36
- })
37
- }, [])
64
+ const handleColorModeChange = useCallback(
65
+ (newMode: ColorModes) => {
66
+ setColorMode(newMode)
67
+ updateMode?.(newMode)
68
+ },
69
+ [updateMode],
70
+ )
38
71
 
39
72
  useLayoutEffect(() => {
40
73
  const theme = localStorage.getItem(THEME_KEY)
@@ -52,13 +85,29 @@ export function useTheme<C extends string = DefaultThemes>(
52
85
 
53
86
  useEffect(() => {
54
87
  const root = document.documentElement
55
- root.dataset.theme = theme
56
- }, [theme])
88
+ root.dataset.pandaTheme = theme
89
+
90
+ if (cache) {
91
+ localStorage.setItem(THEME_KEY, theme)
92
+ }
93
+ }, [theme, cache])
57
94
 
58
95
  useEffect(() => {
59
96
  const root = document.documentElement
60
- root.dataset.colorMode = colorMode
61
- }, [colorMode])
97
+
98
+ if (colorMode === 'system') {
99
+ root.dataset.colorMode = window.matchMedia('(prefers-color-scheme: dark)')
100
+ .matches
101
+ ? 'dark'
102
+ : 'light'
103
+ } else {
104
+ root.dataset.colorMode = colorMode
105
+ }
106
+
107
+ if (cache) {
108
+ localStorage.setItem(MODE_KEY, colorMode)
109
+ }
110
+ }, [colorMode, cache])
62
111
 
63
112
  return useMemo(
64
113
  () => ({
@@ -2,15 +2,37 @@
2
2
 
3
3
  import { useCallback, useMemo, useState, type ChangeEvent } from 'react'
4
4
 
5
+ /**
6
+ * This module provides a hook for using a toggle.
7
+ * @module useToggle
8
+ */
9
+
5
10
  export interface UseToggleOptions {
11
+ /**
12
+ * The initial checked state.
13
+ */
6
14
  checked?: string
15
+ /**
16
+ * Called when the checked state changes.
17
+ */
7
18
  onChange?: (e: ChangeEvent<HTMLInputElement>) => void
8
19
  }
9
20
  export interface ToggleHookReturn {
21
+ /**
22
+ * The checked state.
23
+ */
10
24
  checked: string
25
+ /**
26
+ * A custom handler to be called when the checked state changes.
27
+ */
11
28
  handleChange: (e: ChangeEvent<HTMLInputElement>) => void
12
29
  }
13
30
 
31
+ /**
32
+ * Provides a hook for using a toggle.
33
+ * @see https://cerberus.digitalu.design/react/use-toggle
34
+ * @memberof module:Toggle
35
+ */
14
36
  export function useToggle(options?: UseToggleOptions): ToggleHookReturn {
15
37
  const [checked, setChecked] = useState<string>(options?.checked ?? '')
16
38
  const onChange = options?.onChange
package/src/index.ts CHANGED
@@ -8,6 +8,7 @@
8
8
  export * from './components/Avatar'
9
9
  export * from './components/Button'
10
10
  export * from './components/Checkbox'
11
+ export * from './components/CircularProgress'
11
12
  export * from './components/Droppable'
12
13
  export * from './components/FieldMessage'
13
14
  export * from './components/FeatureFlag'
@@ -30,6 +31,7 @@ export * from './components/Portal'
30
31
  export * from './components/ProgressBar'
31
32
  export * from './components/Radio'
32
33
  export * from './components/Select'
34
+ export * from './components/Spinner'
33
35
  export * from './components/Tab'
34
36
  export * from './components/TabList'
35
37
  export * from './components/TabPanel'
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/Label.tsx"],"sourcesContent":["'use client'\n\nimport type { HTMLAttributes, PropsWithChildren } from 'react'\nimport { label } from '@cerberus/styled-system/recipes'\nimport { css, cx, type RecipeVariantProps } from '@cerberus/styled-system/css'\nimport { hstack } from '@cerberus/styled-system/patterns'\nimport { useFieldContext } from '../context/field'\nimport { Show } from './Show'\n\n/**\n * This module contains the Label component.\n * @module\n */\n\nexport type LabelRecipeProps = RecipeVariantProps<typeof label>\nexport interface LabelBaseProps extends HTMLAttributes<HTMLLabelElement> {\n htmlFor: string\n hidden?: boolean\n}\nexport type LabelProps = LabelBaseProps & LabelRecipeProps\n\n/**\n * A screen ready friendly label component.\n * @definition [ARIA Forms](https://www.a11yproject.com/checklist/#forms)\n * @definition [Label docs](https://cerberus.digitalu.design/react/label)\n * @example\n * ```tsx\n * <Field required>\n * <Label htmlFor=\"test\">Test Label</Label>\n * </Field>\n * ```\n */\nexport function Label(props: PropsWithChildren<LabelProps>) {\n const { hidden, size, ...nativeProps } = props\n const { required, disabled } = useFieldContext()\n const usage = hidden ? 'hidden' : 'visible'\n\n return (\n <label\n {...nativeProps}\n {...(disabled && { 'data-disabled': true })}\n className={cx(\n nativeProps.className,\n label({ size, usage }),\n hstack({\n justify: 'space-between',\n w: 'full',\n }),\n )}\n >\n {props.children}\n <Show when={required}>\n <span\n className={css({\n color: 'inherit',\n fontSize: 'inherit',\n })}\n >\n (required)\n </span>\n </Show>\n </label>\n )\n}\n"],"mappings":";;;;;;;;AAGA,SAAS,aAAa;AACtB,SAAS,KAAK,UAAmC;AACjD,SAAS,cAAc;AAiCnB,SAcI,KAdJ;AANG,SAAS,MAAM,OAAsC;AAC1D,QAAM,EAAE,QAAQ,MAAM,GAAG,YAAY,IAAI;AACzC,QAAM,EAAE,UAAU,SAAS,IAAI,gBAAgB;AAC/C,QAAM,QAAQ,SAAS,WAAW;AAElC,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACH,GAAI,YAAY,EAAE,iBAAiB,KAAK;AAAA,MACzC,WAAW;AAAA,QACT,YAAY;AAAA,QACZ,MAAM,EAAE,MAAM,MAAM,CAAC;AAAA,QACrB,OAAO;AAAA,UACL,SAAS;AAAA,UACT,GAAG;AAAA,QACL,CAAC;AAAA,MACH;AAAA,MAEC;AAAA,cAAM;AAAA,QACP,oBAAC,QAAK,MAAM,UACV;AAAA,UAAC;AAAA;AAAA,YACC,WAAW,IAAI;AAAA,cACb,OAAO;AAAA,cACP,UAAU;AAAA,YACZ,CAAC;AAAA,YACF;AAAA;AAAA,QAED,GACF;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/NotificationHeading.tsx"],"sourcesContent":["/**\n * This module exports the NotificationHeading component.\n * @module\n */\n\nimport { cx } from '@cerberus/styled-system/css'\nimport {\n notification,\n type NotificationVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport type { HTMLAttributes } from 'react'\n\nexport interface BaseNotificationHeadingProps\n extends HTMLAttributes<HTMLParagraphElement> {}\nexport type NotificationHeadingProps = BaseNotificationHeadingProps &\n NotificationVariantProps\n\n/**\n * The NotificationHeading component is used to render the heading of a notification.\n * @param props - The anything a HTMLParagraphElement can accept.\n */\nexport function NotificationHeading(props: NotificationHeadingProps) {\n const { palette, ...nativeProps } = props\n const styles = notification({ palette })\n return (\n <p className={cx(nativeProps.className, styles.heading)} {...nativeProps} />\n )\n}\n"],"mappings":";AAKA,SAAS,UAAU;AACnB;AAAA,EACE;AAAA,OAEK;AAgBH;AAJG,SAAS,oBAAoB,OAAiC;AACnE,QAAM,EAAE,SAAS,GAAG,YAAY,IAAI;AACpC,QAAM,SAAS,aAAa,EAAE,QAAQ,CAAC;AACvC,SACE,oBAAC,OAAE,WAAW,GAAG,YAAY,WAAW,OAAO,OAAO,GAAI,GAAG,aAAa;AAE9E;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/Th.tsx"],"sourcesContent":["import { css, cx } from '@cerberus/styled-system/css'\nimport { th, type ThVariantProps } from '@cerberus/styled-system/recipes'\nimport type { MouseEvent, TableHTMLAttributes } from 'react'\nimport { Show } from './Show'\n\n/**\n * Th component for the Table component\n * @module\n */\n\nexport type ThBaseProps = TableHTMLAttributes<HTMLTableCellElement> & {\n onClick?: (e: MouseEvent<HTMLButtonElement>) => void\n}\nexport type ThProps = ThBaseProps & ThVariantProps\n\n/**\n * Styles for the Th component\n * @definition [Table docs](https://cerberus.digitalu.design/react/table)\n * @example\n * ```tsx\n * <Th>Header 1</Th>\n * ```\n */\nexport function Th(props: ThProps) {\n const { size, onClick, ...nativeProps } = props\n return (\n <Show\n when={Boolean(onClick)}\n fallback={\n <th\n {...nativeProps}\n className={cx(nativeProps.className, th({ size }))}\n />\n }\n >\n <th {...nativeProps}>\n <button\n className={cx(\n nativeProps.className,\n th({ size }),\n css({\n alignItems: 'center',\n display: 'inline-flex',\n justifyContent: 'space-between',\n userSelect: 'none',\n w: 'full',\n }),\n )}\n onClick={onClick}\n >\n {props.children}\n </button>\n </th>\n </Show>\n )\n}\n"],"mappings":";;;;;AAAA,SAAS,KAAK,UAAU;AACxB,SAAS,UAA+B;AA4BhC;AAND,SAAS,GAAG,OAAgB;AACjC,QAAM,EAAE,MAAM,SAAS,GAAG,YAAY,IAAI;AAC1C,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAM,QAAQ,OAAO;AAAA,MACrB,UACE;AAAA,QAAC;AAAA;AAAA,UACE,GAAG;AAAA,UACJ,WAAW,GAAG,YAAY,WAAW,GAAG,EAAE,KAAK,CAAC,CAAC;AAAA;AAAA,MACnD;AAAA,MAGF,8BAAC,QAAI,GAAG,aACN;AAAA,QAAC;AAAA;AAAA,UACC,WAAW;AAAA,YACT,YAAY;AAAA,YACZ,GAAG,EAAE,KAAK,CAAC;AAAA,YACX,IAAI;AAAA,cACF,YAAY;AAAA,cACZ,SAAS;AAAA,cACT,gBAAgB;AAAA,cAChB,YAAY;AAAA,cACZ,GAAG;AAAA,YACL,CAAC;AAAA,UACH;AAAA,UACA;AAAA,UAEC,gBAAM;AAAA;AAAA,MACT,GACF;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/Portal.tsx"],"sourcesContent":["import type { PropsWithChildren } from 'react'\nimport { createPortal } from 'react-dom'\n\n/**\n * This module is the Portal component.\n * @module\n */\n\nexport interface PortalProps {\n container?: Element | DocumentFragment\n key?: null | string\n}\n\n/**\n * The Portal component is used to render children into a DOM node that exists outside the DOM hierarchy of the parent component.\n * @param container - The props for the Portal component.\n * @returns ReactPortal\n */\nexport function Portal(props: PropsWithChildren<PortalProps>) {\n const container = props.container || document.body\n return createPortal(props.children, container, props.key)\n}\n"],"mappings":";AACA,SAAS,oBAAoB;AAiBtB,SAAS,OAAO,OAAuC;AAC5D,QAAM,YAAY,MAAM,aAAa,SAAS;AAC9C,SAAO,aAAa,MAAM,UAAU,WAAW,MAAM,GAAG;AAC1D;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/context/feature-flags.tsx"],"sourcesContent":["'use client'\n\nimport { createContext, useContext, type PropsWithChildren } from 'react'\n\n/**\n * This module provides a context and hook for feature flags.\n * @module\n */\n\nexport interface FeatureFlagValue {\n [key: string]: boolean\n}\n\nconst FeatureFlagContext = createContext<FeatureFlagValue | null>(null)\n\nexport interface FeatureFlagProviderProps {\n flags: FeatureFlagValue\n}\n\n/**\n * Provides feature flags to the application.\n * @param flags - The flags data for the provider.\n * @example\n * ```tsx\n * // This should be a JSON file or a server response.\n * const flags = {\n * featureOne: true,\n * featureTwo: false\n * }\n *\n * // Wrap the Provider around the root of your application.\n * <FeatureFlags flags={flags}>\n * <FeatureFlag flag=\"featureOne\">\n * This is visible.\n * </FeatureFlag>\n * <FeatureFlag flag=\"featureTwo\">\n * This is hidden.\n * </FeatureFlag>\n * </FeatureFlags>\n * ```\n */\nexport function FeatureFlags(\n props: PropsWithChildren<FeatureFlagProviderProps>,\n) {\n return (\n <FeatureFlagContext.Provider value={props.flags}>\n {props.children}\n </FeatureFlagContext.Provider>\n )\n}\n\nexport function useFeatureFlags(key: string): boolean {\n const context = useContext(FeatureFlagContext)\n if (context === null) {\n throw new Error(\n 'useFeatureFlag must be used within a FeatureFlags Provider',\n )\n }\n return context[key] ?? false\n}\n"],"mappings":";AAEA,SAAS,eAAe,kBAA0C;AA2C9D;AAhCJ,IAAM,qBAAqB,cAAuC,IAAI;AA4B/D,SAAS,aACd,OACA;AACA,SACE,oBAAC,mBAAmB,UAAnB,EAA4B,OAAO,MAAM,OACvC,gBAAM,UACT;AAEJ;AAEO,SAAS,gBAAgB,KAAsB;AACpD,QAAM,UAAU,WAAW,kBAAkB;AAC7C,MAAI,YAAY,MAAM;AACpB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,SAAO,QAAQ,GAAG,KAAK;AACzB;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/Show.tsx"],"sourcesContent":["'use client'\n\nimport { useMemo, type PropsWithChildren, type ReactNode } from 'react'\n\nexport interface ShowProps {\n when: boolean | null | undefined\n fallback?: ReactNode\n}\n\n/**\n * Conditionally render its children or an optional fallback component\n * based on the SolidJS component.\n * @definition [Show docs](https://cerberus.digitalu.design/react/show)\n * @example\n * ```tsx\n * <Show when={condition}>\n * <div>Content</div>\n * </Show>\n */\nexport function Show(props: PropsWithChildren<ShowProps>): ReactNode {\n const { when, children, fallback } = props\n const condition = useMemo(() => when ?? false, [when])\n\n return useMemo(() => {\n if (condition) return children\n return fallback ?? null\n }, [condition, children, fallback])\n}\n"],"mappings":";AAEA,SAAS,eAAuD;AAiBzD,SAAS,KAAK,OAAgD;AACnE,QAAM,EAAE,MAAM,UAAU,SAAS,IAAI;AACrC,QAAM,YAAY,QAAQ,MAAM,QAAQ,OAAO,CAAC,IAAI,CAAC;AAErD,SAAO,QAAQ,MAAM;AACnB,QAAI,UAAW,QAAO;AACtB,WAAO,YAAY;AAAA,EACrB,GAAG,CAAC,WAAW,UAAU,QAAQ,CAAC;AACpC;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/Toggle.tsx"],"sourcesContent":["'use client'\n\nimport { cx } from '@cerberus/styled-system/css'\nimport { hstack, vstack } from '@cerberus/styled-system/patterns'\nimport {\n toggle,\n type ToggleVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport type { InputHTMLAttributes } from 'react'\nimport { $cerberusIcons } from '../config/defineIcons'\nimport { useFieldContext } from '../context/field'\n\nexport type ToggleBase = Omit<\n InputHTMLAttributes<HTMLInputElement>,\n 'size' | 'id' | 'value'\n> & {\n describedBy?: string\n id: string\n value: string\n}\nexport type ToggleProps = ToggleBase & ToggleVariantProps\n\nexport function Toggle(props: ToggleProps) {\n const { size, describedBy, ...nativeProps } = props\n const styles = toggle({ size })\n const { invalid, ...state } = useFieldContext()\n const Icon = $cerberusIcons.toggleChecked\n\n return (\n <span\n className={cx('group', styles.track, hstack())}\n data-checked={props.checked || props.defaultChecked}\n >\n <input\n {...nativeProps}\n {...state}\n {...(describedBy && { 'aria-describedby': describedBy })}\n {...(invalid && { 'aria-invalid': true })}\n className={cx('peer', styles.input)}\n role=\"switch\"\n type=\"checkbox\"\n />\n <span\n className={cx(\n styles.thumb,\n vstack({\n justify: 'center',\n }),\n )}\n >\n <Icon />\n </span>\n </span>\n )\n}\n"],"mappings":";;;;;;;;AAEA,SAAS,UAAU;AACnB,SAAS,QAAQ,cAAc;AAC/B;AAAA,EACE;AAAA,OAEK;AAsBH,SAIE,KAJF;AAPG,SAAS,OAAO,OAAoB;AACzC,QAAM,EAAE,MAAM,aAAa,GAAG,YAAY,IAAI;AAC9C,QAAM,SAAS,OAAO,EAAE,KAAK,CAAC;AAC9B,QAAM,EAAE,SAAS,GAAG,MAAM,IAAI,gBAAgB;AAC9C,QAAM,OAAO,eAAe;AAE5B,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,GAAG,SAAS,OAAO,OAAO,OAAO,CAAC;AAAA,MAC7C,gBAAc,MAAM,WAAW,MAAM;AAAA,MAErC;AAAA;AAAA,UAAC;AAAA;AAAA,YACE,GAAG;AAAA,YACH,GAAG;AAAA,YACH,GAAI,eAAe,EAAE,oBAAoB,YAAY;AAAA,YACrD,GAAI,WAAW,EAAE,gBAAgB,KAAK;AAAA,YACvC,WAAW,GAAG,QAAQ,OAAO,KAAK;AAAA,YAClC,MAAK;AAAA,YACL,MAAK;AAAA;AAAA,QACP;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,WAAW;AAAA,cACT,OAAO;AAAA,cACP,OAAO;AAAA,gBACL,SAAS;AAAA,cACX,CAAC;AAAA,YACH;AAAA,YAEA,8BAAC,QAAK;AAAA;AAAA,QACR;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/NavMenuLink.tsx"],"sourcesContent":["import type { AnchorHTMLAttributes, ElementType } from 'react'\nimport { css, cx } from '@cerberus/styled-system/css'\nimport { Show } from './Show'\n\nexport interface NavMenuLinkProps\n extends AnchorHTMLAttributes<HTMLAnchorElement> {\n as?: ElementType\n}\n\nexport function NavMenuLink(props: NavMenuLinkProps): JSX.Element {\n const { as, ...nativeProps } = props\n const hasAs = Boolean(as)\n const AsSub: ElementType = as!\n\n return (\n <li\n className={css({\n w: 'full',\n })}\n >\n <Show\n when={hasAs}\n fallback={\n <a\n {...nativeProps}\n className={cx(\n nativeProps.className,\n css({\n color: 'action.navigation.initial',\n textStyle: 'link',\n _hover: {\n color: 'action.navigation.hover',\n },\n }),\n )}\n />\n }\n >\n {hasAs && <AsSub {...nativeProps} />}\n </Show>\n </li>\n )\n}\n"],"mappings":";;;;;AACA,SAAS,KAAK,UAAU;AAsBd;AAdH,SAAS,YAAY,OAAsC;AAChE,QAAM,EAAE,IAAI,GAAG,YAAY,IAAI;AAC/B,QAAM,QAAQ,QAAQ,EAAE;AACxB,QAAM,QAAqB;AAE3B,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,IAAI;AAAA,QACb,GAAG;AAAA,MACL,CAAC;AAAA,MAED;AAAA,QAAC;AAAA;AAAA,UACC,MAAM;AAAA,UACN,UACE;AAAA,YAAC;AAAA;AAAA,cACE,GAAG;AAAA,cACJ,WAAW;AAAA,gBACT,YAAY;AAAA,gBACZ,IAAI;AAAA,kBACF,OAAO;AAAA,kBACP,WAAW;AAAA,kBACX,QAAQ;AAAA,oBACN,OAAO;AAAA,kBACT;AAAA,gBACF,CAAC;AAAA,cACH;AAAA;AAAA,UACF;AAAA,UAGD,mBAAS,oBAAC,SAAO,GAAG,aAAa;AAAA;AAAA,MACpC;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/Button.tsx"],"sourcesContent":["import type { ButtonHTMLAttributes } from 'react'\nimport { cx } from '@cerberus/styled-system/css'\nimport {\n button,\n type ButtonVariantProps,\n} from '@cerberus/styled-system/recipes'\n\n/**\n * This module contains the Button component.\n * @module\n */\n\nexport type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> &\n ButtonVariantProps\n\n/**\n * A component that allows the user to perform actions\n * @description https://github.com/omnifed/cerberus/blob/main/packages/react/src/components/Button.tsx\n */\nexport function Button(props: ButtonProps): JSX.Element {\n const { palette, usage, shape, ...nativeProps } = props\n return (\n <button\n {...nativeProps}\n className={cx(\n nativeProps.className,\n button({\n palette,\n usage,\n shape,\n }),\n )}\n />\n )\n}\n"],"mappings":";AACA,SAAS,UAAU;AACnB;AAAA,EACE;AAAA,OAEK;AAiBH;AAHG,SAAS,OAAO,OAAiC;AACtD,QAAM,EAAE,SAAS,OAAO,OAAO,GAAG,YAAY,IAAI;AAClD,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW;AAAA,QACT,YAAY;AAAA,QACZ,OAAO;AAAA,UACL;AAAA,UACA;AAAA,UACA;AAAA,QACF,CAAC;AAAA,MACH;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/Droppable.tsx"],"sourcesContent":["'use client'\n\nimport { useDroppable, type UseDroppableArguments } from '@dnd-kit/core'\nimport { useId, type HtmlHTMLAttributes, type PropsWithChildren } from 'react'\n\nexport interface DroppableProps\n extends Omit<HtmlHTMLAttributes<HTMLDivElement>, 'id'>,\n UseDroppableArguments {\n dropped?: boolean\n}\n\nexport function Droppable(props: PropsWithChildren<DroppableProps>) {\n const { dropped, id, disabled, data, resizeObserverConfig, ...nativeProps } =\n props\n const uuid = useId()\n const { isOver, setNodeRef } = useDroppable({\n data,\n disabled,\n id: id || uuid,\n resizeObserverConfig,\n })\n\n return (\n <div\n {...nativeProps}\n data-over={isOver}\n data-dropped={dropped}\n ref={setNodeRef}\n >\n {props.children}\n </div>\n )\n}\n"],"mappings":";AAEA,SAAS,oBAAgD;AACzD,SAAS,aAA8D;AAoBnE;AAZG,SAAS,UAAU,OAA0C;AAClE,QAAM,EAAE,SAAS,IAAI,UAAU,MAAM,sBAAsB,GAAG,YAAY,IACxE;AACF,QAAM,OAAO,MAAM;AACnB,QAAM,EAAE,QAAQ,WAAW,IAAI,aAAa;AAAA,IAC1C;AAAA,IACA;AAAA,IACA,IAAI,MAAM;AAAA,IACV;AAAA,EACF,CAAC;AAED,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,aAAW;AAAA,MACX,gBAAc;AAAA,MACd,KAAK;AAAA,MAEJ,gBAAM;AAAA;AAAA,EACT;AAEJ;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/Table.tsx"],"sourcesContent":["import { cx } from '@cerberus/styled-system/css'\nimport { table } from '@cerberus/styled-system/recipes'\nimport type { PropsWithChildren, TableHTMLAttributes } from 'react'\n\n/**\n * This module contains the table component.\n * @module\n */\n\nexport interface TableProps extends TableHTMLAttributes<HTMLTableElement> {\n caption: string\n}\n\n/**\n * The Table component is used to render a table.\n * @definition [Table docs](https://cerberus.digitalu.design/react/table)\n * @prop caption - An easy to understand description of the table.\n * @example\n * ```tsx\n * <Table caption=\"Basic Table\">\n * {children}\n * </Table>\n * ```\n */\nexport function Table(props: PropsWithChildren<TableProps>) {\n const { caption, children, ...nativeProps } = props\n const styles = table()\n\n return (\n <div className={styles.container}>\n <table\n {...nativeProps}\n className={cx(nativeProps.className, styles.table)}\n >\n <caption className={styles.caption}>{caption}</caption>\n {children}\n </table>\n </div>\n )\n}\n\n// We only provide this for consistency with the rest of the components\n\nexport type TrProps = TableHTMLAttributes<HTMLTableRowElement>\n\n/**\n * The Tr component is used to render a table row.\n * @definition [Table docs](https://cerberus.digitalu.design/react/table)\n * @example\n * ```tsx\n * <Tr>\n * {children}\n * </Tr>\n * ```\n */\nexport function Tr(props: PropsWithChildren<TrProps>) {\n return <tr {...props} />\n}\n"],"mappings":";AAAA,SAAS,UAAU;AACnB,SAAS,aAAa;AA6BhB,SAIE,KAJF;AANC,SAAS,MAAM,OAAsC;AAC1D,QAAM,EAAE,SAAS,UAAU,GAAG,YAAY,IAAI;AAC9C,QAAM,SAAS,MAAM;AAErB,SACE,oBAAC,SAAI,WAAW,OAAO,WACrB;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW,GAAG,YAAY,WAAW,OAAO,KAAK;AAAA,MAEjD;AAAA,4BAAC,aAAQ,WAAW,OAAO,SAAU,mBAAQ;AAAA,QAC5C;AAAA;AAAA;AAAA,EACH,GACF;AAEJ;AAgBO,SAAS,GAAG,OAAmC;AACpD,SAAO,oBAAC,QAAI,GAAG,OAAO;AACxB;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/hooks/useModal.ts"],"sourcesContent":["'use client'\n\nimport { useCallback, useMemo, useRef, type RefObject } from 'react'\n\n/**\n * This module provides a hook for using a custom modal.\n * @module\n */\n\ninterface UseModalReturnValue {\n modalRef: RefObject<HTMLDialogElement>\n show: () => void\n close: () => void\n}\n\nexport function useModal(): UseModalReturnValue {\n const modalRef = useRef<HTMLDialogElement | null>(null)\n\n const show = useCallback(() => {\n modalRef.current?.showModal()\n }, [])\n\n const close = useCallback(() => {\n modalRef.current?.close()\n }, [])\n\n return useMemo(() => {\n return {\n modalRef,\n show,\n close,\n }\n }, [modalRef, show, close])\n}\n"],"mappings":";AAEA,SAAS,aAAa,SAAS,cAA8B;AAatD,SAAS,WAAgC;AAC9C,QAAM,WAAW,OAAiC,IAAI;AAEtD,QAAM,OAAO,YAAY,MAAM;AAC7B,aAAS,SAAS,UAAU;AAAA,EAC9B,GAAG,CAAC,CAAC;AAEL,QAAM,QAAQ,YAAY,MAAM;AAC9B,aAAS,SAAS,MAAM;AAAA,EAC1B,GAAG,CAAC,CAAC;AAEL,SAAO,QAAQ,MAAM;AACnB,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF,GAAG,CAAC,UAAU,MAAM,KAAK,CAAC;AAC5B;","names":[]}