@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,36 @@
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/aria-helpers/nav-menu.aria.ts
21
+ var nav_menu_aria_exports = {};
22
+ __export(nav_menu_aria_exports, {
23
+ createNavTriggerProps: () => createNavTriggerProps
24
+ });
25
+ module.exports = __toCommonJS(nav_menu_aria_exports);
26
+ function createNavTriggerProps(values) {
27
+ return {
28
+ ["aria-controls"]: values.controls,
29
+ ["aria-expanded"]: values.expanded ?? false
30
+ };
31
+ }
32
+ // Annotate the CommonJS export names for ESM import in node:
33
+ 0 && (module.exports = {
34
+ createNavTriggerProps
35
+ });
36
+ //# sourceMappingURL=nav-menu.aria.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/aria-helpers/nav-menu.aria.ts"],"sourcesContent":["export interface NavTriggerAriaValues {\n controls: string\n expanded?: boolean\n}\n\ninterface NavTriggerAriaReturn {\n ['aria-controls']: string\n ['aria-expanded']: boolean\n}\n\nexport function createNavTriggerProps(\n values: NavTriggerAriaValues,\n): NavTriggerAriaReturn {\n return {\n ['aria-controls']: values.controls,\n ['aria-expanded']: values.expanded ?? false,\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAUO,SAAS,sBACd,QACsB;AACtB,SAAO;AAAA,IACL,CAAC,eAAe,GAAG,OAAO;AAAA,IAC1B,CAAC,eAAe,GAAG,OAAO,YAAY;AAAA,EACxC;AACF;","names":[]}
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ "use client";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/aria-helpers/tabs.aria.ts
22
+ var tabs_aria_exports = {};
23
+ __export(tabs_aria_exports, {
24
+ useTabsKeyboardNavigation: () => useTabsKeyboardNavigation
25
+ });
26
+ module.exports = __toCommonJS(tabs_aria_exports);
27
+ var import_react2 = require("react");
28
+
29
+ // src/context/tabs.tsx
30
+ var import_recipes = require("@cerberus/styled-system/recipes");
31
+ var import_react = require("react");
32
+ var import_jsx_runtime = require("react/jsx-runtime");
33
+ var TabsContext = (0, import_react.createContext)(null);
34
+ function useTabsContext() {
35
+ const context = (0, import_react.useContext)(TabsContext);
36
+ if (!context) {
37
+ throw new Error("useTabsContext must be used within a Tabs Provider.");
38
+ }
39
+ return context;
40
+ }
41
+
42
+ // src/aria-helpers/tabs.aria.ts
43
+ function getNextIndex(index, length) {
44
+ return index === length - 1 ? 0 : index + 1;
45
+ }
46
+ function getPrevIndex(index, length) {
47
+ return index === 0 ? length - 1 : index - 1;
48
+ }
49
+ function useTabsKeyboardNavigation() {
50
+ const { tabs: tabs2 } = useTabsContext();
51
+ const [activeTab, setActiveTab] = (0, import_react2.useState)(-1);
52
+ (0, import_react2.useEffect)(() => {
53
+ const handleKeyDown = (event) => {
54
+ const index = activeTab === -1 ? tabs2.current.findIndex((tab) => tab.ariaSelected === "true") : activeTab;
55
+ const nextIndex = getNextIndex(index, tabs2.current.length);
56
+ const prevIndex = getPrevIndex(index, tabs2.current.length);
57
+ if (index === -1) return;
58
+ switch (event.key) {
59
+ case "ArrowLeft":
60
+ event.preventDefault();
61
+ setActiveTab(prevIndex);
62
+ tabs2.current[prevIndex].focus();
63
+ break;
64
+ case "ArrowRight":
65
+ event.preventDefault();
66
+ setActiveTab(nextIndex);
67
+ tabs2.current[nextIndex].focus();
68
+ break;
69
+ case "Home":
70
+ event.preventDefault();
71
+ setActiveTab(0);
72
+ tabs2.current[0].focus();
73
+ break;
74
+ case "End":
75
+ event.preventDefault();
76
+ setActiveTab(tabs2.current.length - 1);
77
+ tabs2.current[tabs2.current.length - 1].focus();
78
+ break;
79
+ default:
80
+ break;
81
+ }
82
+ };
83
+ document.addEventListener("keydown", handleKeyDown);
84
+ return () => {
85
+ document.removeEventListener("keydown", handleKeyDown);
86
+ };
87
+ }, [activeTab, tabs2.current]);
88
+ return {
89
+ ref: (tab) => {
90
+ if (tab && !tabs2.current.includes(tab)) {
91
+ tabs2.current.push(tab);
92
+ }
93
+ }
94
+ };
95
+ }
96
+ // Annotate the CommonJS export names for ESM import in node:
97
+ 0 && (module.exports = {
98
+ useTabsKeyboardNavigation
99
+ });
100
+ //# sourceMappingURL=tabs.aria.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/aria-helpers/tabs.aria.ts","../../../src/context/tabs.tsx"],"sourcesContent":["'use client'\n\nimport { useEffect, useState } from 'react'\nimport { useTabsContext } from '../context/tabs'\n\nfunction getNextIndex(index: number, length: number) {\n return index === length - 1 ? 0 : index + 1\n}\n\nfunction getPrevIndex(index: number, length: number) {\n return index === 0 ? length - 1 : index - 1\n}\n\nexport function useTabsKeyboardNavigation() {\n const { tabs } = useTabsContext()\n const [activeTab, setActiveTab] = useState(-1)\n\n useEffect(() => {\n const handleKeyDown = (event: KeyboardEvent) => {\n const index =\n activeTab === -1\n ? tabs.current.findIndex((tab) => tab.ariaSelected === 'true')\n : activeTab\n const nextIndex = getNextIndex(index, tabs.current.length)\n const prevIndex = getPrevIndex(index, tabs.current.length)\n\n // If the active tab is not found, do nothing\n if (index === -1) return\n\n switch (event.key) {\n case 'ArrowLeft':\n event.preventDefault()\n setActiveTab(prevIndex)\n tabs.current[prevIndex].focus()\n break\n case 'ArrowRight':\n event.preventDefault()\n setActiveTab(nextIndex)\n tabs.current[nextIndex].focus()\n break\n case 'Home':\n event.preventDefault()\n setActiveTab(0)\n tabs.current[0].focus()\n break\n case 'End':\n event.preventDefault()\n setActiveTab(tabs.current.length - 1)\n tabs.current[tabs.current.length - 1].focus()\n break\n default:\n break\n }\n }\n\n document.addEventListener('keydown', handleKeyDown)\n\n return () => {\n document.removeEventListener('keydown', handleKeyDown)\n }\n }, [activeTab, tabs.current])\n\n return {\n ref: (tab: HTMLButtonElement) => {\n if (tab && !tabs.current.includes(tab)) {\n tabs.current.push(tab)\n }\n },\n }\n}\n","'use client'\n\nimport { tabs, type TabsVariantProps } from '@cerberus/styled-system/recipes'\nimport type { Pretty } from '@cerberus/styled-system/types'\nimport {\n createContext,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n type MutableRefObject,\n type PropsWithChildren,\n} from 'react'\n\n/**\n * This module provides a Tabs component and a hook to access its context.\n * @module\n */\n\nexport interface TabsContextValue {\n tabs: MutableRefObject<HTMLButtonElement[]>\n id: string\n active: string\n styles: Pretty<Record<'tabList' | 'tab' | 'tabPanel', string>>\n onTabUpdate: (active: string) => void\n}\n\nexport const TabsContext = createContext<TabsContextValue | null>(null)\n\nexport interface TabsProps {\n id?: string\n active?: string\n cache?: boolean\n}\n\n/**\n * The Tabs component provides a context to manage tab state.\n * @param id - the id of the tabs component,\n * @param active - the default active tab id,\n * @param cache - whether to cache the active tab state in local storage\n * @example\n * ```tsx\n * <Tabs cache>\n * <TabList description=\"Button details\">\n * <Tab id=\"overview\">Overview</Tab>\n * <Tab id=\"guidelines\">Guidelines</Tab>\n * </TabList>\n * <TabPanels>\n * <TabPanel id=\"overview\">Overview content</TabPanel>\n * <TabPanel id=\"guidelines\">Guidelines content</TabPanel>\n * </TabPanels>\n * </Tabs>\n * ```\n */\nexport function Tabs(\n props: PropsWithChildren<TabsProps & TabsVariantProps>,\n): JSX.Element {\n const { cache, active, id, palette } = props\n const [activeTab, setActiveTab] = useState(() => (cache ? '' : active ?? ''))\n const tabsList = useRef<HTMLButtonElement[]>([])\n const uuid = useMemo(() => {\n return id ? `cerberus-tabs-${id}` : 'cerberus-tabs'\n }, [id])\n\n const value = useMemo(\n () => ({\n tabs: tabsList,\n id: uuid,\n active: activeTab,\n styles: tabs({ palette }),\n onTabUpdate: setActiveTab,\n }),\n [activeTab, setActiveTab, palette, uuid, tabsList],\n )\n\n // Get the active tab from local storage\n useEffect(() => {\n if (cache) {\n const cachedTab = window.localStorage.getItem(uuid)\n setActiveTab(\n cache ? cachedTab || (props.active ?? '') : props.active ?? '',\n )\n }\n }, [cache, active, uuid])\n\n // Update the active tab in local storage\n useEffect(() => {\n if (cache && activeTab) {\n window.localStorage.setItem(uuid, activeTab)\n }\n }, [activeTab, cache])\n\n return (\n <TabsContext.Provider value={value}>{props.children}</TabsContext.Provider>\n )\n}\n\nexport function useTabsContext(): TabsContextValue {\n const context = useContext(TabsContext)\n if (!context) {\n throw new Error('useTabsContext must be used within a Tabs Provider.')\n }\n return context\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,IAAAA,gBAAoC;;;ACApC,qBAA4C;AAE5C,mBASO;AAiFH;AAlEG,IAAM,kBAAc,4BAAuC,IAAI;AAsE/D,SAAS,iBAAmC;AACjD,QAAM,cAAU,yBAAW,WAAW;AACtC,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,qDAAqD;AAAA,EACvE;AACA,SAAO;AACT;;;ADnGA,SAAS,aAAa,OAAe,QAAgB;AACnD,SAAO,UAAU,SAAS,IAAI,IAAI,QAAQ;AAC5C;AAEA,SAAS,aAAa,OAAe,QAAgB;AACnD,SAAO,UAAU,IAAI,SAAS,IAAI,QAAQ;AAC5C;AAEO,SAAS,4BAA4B;AAC1C,QAAM,EAAE,MAAAC,MAAK,IAAI,eAAe;AAChC,QAAM,CAAC,WAAW,YAAY,QAAI,wBAAS,EAAE;AAE7C,+BAAU,MAAM;AACd,UAAM,gBAAgB,CAAC,UAAyB;AAC9C,YAAM,QACJ,cAAc,KACVA,MAAK,QAAQ,UAAU,CAAC,QAAQ,IAAI,iBAAiB,MAAM,IAC3D;AACN,YAAM,YAAY,aAAa,OAAOA,MAAK,QAAQ,MAAM;AACzD,YAAM,YAAY,aAAa,OAAOA,MAAK,QAAQ,MAAM;AAGzD,UAAI,UAAU,GAAI;AAElB,cAAQ,MAAM,KAAK;AAAA,QACjB,KAAK;AACH,gBAAM,eAAe;AACrB,uBAAa,SAAS;AACtB,UAAAA,MAAK,QAAQ,SAAS,EAAE,MAAM;AAC9B;AAAA,QACF,KAAK;AACH,gBAAM,eAAe;AACrB,uBAAa,SAAS;AACtB,UAAAA,MAAK,QAAQ,SAAS,EAAE,MAAM;AAC9B;AAAA,QACF,KAAK;AACH,gBAAM,eAAe;AACrB,uBAAa,CAAC;AACd,UAAAA,MAAK,QAAQ,CAAC,EAAE,MAAM;AACtB;AAAA,QACF,KAAK;AACH,gBAAM,eAAe;AACrB,uBAAaA,MAAK,QAAQ,SAAS,CAAC;AACpC,UAAAA,MAAK,QAAQA,MAAK,QAAQ,SAAS,CAAC,EAAE,MAAM;AAC5C;AAAA,QACF;AACE;AAAA,MACJ;AAAA,IACF;AAEA,aAAS,iBAAiB,WAAW,aAAa;AAElD,WAAO,MAAM;AACX,eAAS,oBAAoB,WAAW,aAAa;AAAA,IACvD;AAAA,EACF,GAAG,CAAC,WAAWA,MAAK,OAAO,CAAC;AAE5B,SAAO;AAAA,IACL,KAAK,CAAC,QAA2B;AAC/B,UAAI,OAAO,CAACA,MAAK,QAAQ,SAAS,GAAG,GAAG;AACtC,QAAAA,MAAK,QAAQ,KAAK,GAAG;AAAA,MACvB;AAAA,IACF;AAAA,EACF;AACF;","names":["import_react","tabs"]}
@@ -0,0 +1,54 @@
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/aria-helpers/trap-focus.aria.ts
21
+ var trap_focus_aria_exports = {};
22
+ __export(trap_focus_aria_exports, {
23
+ trapFocus: () => trapFocus
24
+ });
25
+ module.exports = __toCommonJS(trap_focus_aria_exports);
26
+ function trapFocus(modalRef) {
27
+ var _a;
28
+ const focusableElements = 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
29
+ const focusable = Array.from(
30
+ ((_a = modalRef.current) == null ? void 0 : _a.querySelectorAll(focusableElements)) ?? []
31
+ );
32
+ const firstFocusable = focusable[0];
33
+ const lastFocusable = focusable[focusable.length - 1];
34
+ return function handleKeyDown(event) {
35
+ if (event.key === "Tab") {
36
+ if (event.shiftKey) {
37
+ if (document.activeElement === firstFocusable) {
38
+ lastFocusable.focus();
39
+ event.preventDefault();
40
+ }
41
+ } else {
42
+ if (document.activeElement === lastFocusable) {
43
+ firstFocusable.focus();
44
+ event.preventDefault();
45
+ }
46
+ }
47
+ }
48
+ };
49
+ }
50
+ // Annotate the CommonJS export names for ESM import in node:
51
+ 0 && (module.exports = {
52
+ trapFocus
53
+ });
54
+ //# sourceMappingURL=trap-focus.aria.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/aria-helpers/trap-focus.aria.ts"],"sourcesContent":["import type { KeyboardEvent, KeyboardEventHandler, RefObject } from 'react'\n\nexport function trapFocus(\n modalRef: RefObject<HTMLDialogElement>,\n): KeyboardEventHandler<HTMLDialogElement> {\n const focusableElements =\n 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])'\n const focusable = Array.from(\n modalRef.current?.querySelectorAll(focusableElements) ?? [],\n )\n const firstFocusable = focusable[0] as HTMLElement\n const lastFocusable = focusable[focusable.length - 1] as HTMLElement\n\n return function handleKeyDown(event: KeyboardEvent<HTMLDialogElement>) {\n if (event.key === 'Tab') {\n if (event.shiftKey) {\n if (document.activeElement === firstFocusable) {\n lastFocusable.focus()\n event.preventDefault()\n }\n } else {\n if (document.activeElement === lastFocusable) {\n firstFocusable.focus()\n event.preventDefault()\n }\n }\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,SAAS,UACd,UACyC;AAJ3C;AAKE,QAAM,oBACJ;AACF,QAAM,YAAY,MAAM;AAAA,MACtB,cAAS,YAAT,mBAAkB,iBAAiB,uBAAsB,CAAC;AAAA,EAC5D;AACA,QAAM,iBAAiB,UAAU,CAAC;AAClC,QAAM,gBAAgB,UAAU,UAAU,SAAS,CAAC;AAEpD,SAAO,SAAS,cAAc,OAAyC;AACrE,QAAI,MAAM,QAAQ,OAAO;AACvB,UAAI,MAAM,UAAU;AAClB,YAAI,SAAS,kBAAkB,gBAAgB;AAC7C,wBAAc,MAAM;AACpB,gBAAM,eAAe;AAAA,QACvB;AAAA,MACF,OAAO;AACL,YAAI,SAAS,kBAAkB,eAAe;AAC5C,yBAAe,MAAM;AACrB,gBAAM,eAAe;AAAA,QACvB;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
@@ -0,0 +1,50 @@
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/components/Button.tsx
21
+ var Button_exports = {};
22
+ __export(Button_exports, {
23
+ Button: () => Button
24
+ });
25
+ module.exports = __toCommonJS(Button_exports);
26
+ var import_css = require("@cerberus/styled-system/css");
27
+ var import_recipes = require("@cerberus/styled-system/recipes");
28
+ var import_jsx_runtime = require("react/jsx-runtime");
29
+ function Button(props) {
30
+ const { palette, usage, shape, ...nativeProps } = props;
31
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
32
+ "button",
33
+ {
34
+ ...nativeProps,
35
+ className: (0, import_css.cx)(
36
+ nativeProps.className,
37
+ (0, import_recipes.button)({
38
+ palette,
39
+ usage,
40
+ shape
41
+ })
42
+ )
43
+ }
44
+ );
45
+ }
46
+ // Annotate the CommonJS export names for ESM import in node:
47
+ 0 && (module.exports = {
48
+ Button
49
+ });
50
+ //# sourceMappingURL=Button.cjs.map
@@ -0,0 +1 @@
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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,iBAAmB;AACnB,qBAGO;AAiBH;AAHG,SAAS,OAAO,OAAiC;AACtD,QAAM,EAAE,SAAS,OAAO,OAAO,GAAG,YAAY,IAAI;AAClD,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,eAAW;AAAA,QACT,YAAY;AAAA,YACZ,uBAAO;AAAA,UACL;AAAA,UACA;AAAA,UACA;AAAA,QACF,CAAC;AAAA,MACH;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -0,0 +1,157 @@
1
+ "use strict";
2
+ "use client";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/components/Checkbox.tsx
22
+ var Checkbox_exports = {};
23
+ __export(Checkbox_exports, {
24
+ Checkbox: () => Checkbox
25
+ });
26
+ module.exports = __toCommonJS(Checkbox_exports);
27
+ var import_recipes = require("@cerberus/styled-system/recipes");
28
+ var import_patterns = require("@cerberus/styled-system/patterns");
29
+ var import_css = require("@cerberus/styled-system/css");
30
+
31
+ // src/components/Show.tsx
32
+ var import_react = require("react");
33
+ function Show(props) {
34
+ const { when, children, fallback } = props;
35
+ const condition = (0, import_react.useMemo)(() => when ?? false, [when]);
36
+ return (0, import_react.useMemo)(() => {
37
+ if (condition) return children;
38
+ return fallback ?? null;
39
+ }, [condition, children, fallback]);
40
+ }
41
+
42
+ // src/context/field.tsx
43
+ var import_react2 = require("react");
44
+ var import_jsx_runtime = require("react/jsx-runtime");
45
+ var FieldContext = (0, import_react2.createContext)(null);
46
+ function useFieldContext() {
47
+ const context = (0, import_react2.useContext)(FieldContext);
48
+ if (!context) {
49
+ throw new Error("useFieldContext must be used within a Field Provider.");
50
+ }
51
+ return context;
52
+ }
53
+
54
+ // src/config/cerbIcons.ts
55
+ var import_icons = require("@cerberus/icons");
56
+
57
+ // src/config/icons/checkbox.icons.tsx
58
+ var import_jsx_runtime2 = require("react/jsx-runtime");
59
+ function CheckmarkIcon(props) {
60
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
61
+ "svg",
62
+ {
63
+ "aria-hidden": "true",
64
+ xmlns: "http://www.w3.org/2000/svg",
65
+ fill: "none",
66
+ role: "img",
67
+ viewBox: "0 0 24 24",
68
+ ...props,
69
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
70
+ "path",
71
+ {
72
+ fill: "currentColor",
73
+ d: "M9.714 18 4 12.335l1.818-1.764 3.896 3.824L18.181 6 20 7.803 9.714 18Z"
74
+ }
75
+ )
76
+ }
77
+ );
78
+ }
79
+ function IndeterminateIcon(props) {
80
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
81
+ "svg",
82
+ {
83
+ "aria-hidden": "true",
84
+ xmlns: "http://www.w3.org/2000/svg",
85
+ role: "img",
86
+ fill: "none",
87
+ viewBox: "0 0 24 24",
88
+ ...props,
89
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { fill: "currentColor", d: "M4 11h16v2.667H4z" })
90
+ }
91
+ );
92
+ }
93
+
94
+ // src/config/cerbIcons.ts
95
+ var defaultIcons = {
96
+ checkbox: CheckmarkIcon,
97
+ close: import_icons.CloseFilled,
98
+ confirmModal: import_icons.Information,
99
+ delete: import_icons.TrashCan,
100
+ promptModal: import_icons.Information,
101
+ fileUploader: import_icons.CloudUpload,
102
+ indeterminate: IndeterminateIcon,
103
+ infoNotification: import_icons.InformationFilled,
104
+ successNotification: import_icons.CheckmarkFilled,
105
+ warningNotification: import_icons.WarningFilled,
106
+ dangerNotification: import_icons.ErrorFilled,
107
+ invalid: import_icons.WarningFilled,
108
+ invalidAlt: import_icons.Warning,
109
+ redo: import_icons.Restart,
110
+ selectArrow: import_icons.ChevronDown,
111
+ toggleChecked: import_icons.Checkmark
112
+ };
113
+
114
+ // src/config/defineIcons.ts
115
+ var $cerberusIcons = defaultIcons;
116
+
117
+ // src/components/Checkbox.tsx
118
+ var import_jsx_runtime3 = require("react/jsx-runtime");
119
+ function Checkbox(props) {
120
+ const { describedBy, size, checked, mixed, ...nativeProps } = props;
121
+ const { invalid, ...fieldStates } = useFieldContext();
122
+ const styles = (0, import_recipes.checkbox)({ size });
123
+ const { checkbox: CheckIcon, indeterminate: IndeterminateIcon2 } = $cerberusIcons;
124
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
125
+ "div",
126
+ {
127
+ className: (0, import_css.cx)(
128
+ styles.root,
129
+ (0, import_patterns.vstack)({
130
+ gap: "0",
131
+ justify: "center"
132
+ })
133
+ ),
134
+ children: [
135
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
136
+ "input",
137
+ {
138
+ ...nativeProps,
139
+ ...fieldStates,
140
+ ...describedBy && { "aria-describedby": describedBy },
141
+ ...invalid && { "aria-invalid": true },
142
+ ...mixed && { "aria-checked": "mixed" },
143
+ className: (0, import_css.cx)("peer", nativeProps.className, styles.input),
144
+ type: "checkbox"
145
+ }
146
+ ),
147
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Show, { when: checked && !mixed, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: styles.icon, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(CheckIcon, {}) }) }),
148
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Show, { when: mixed, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: styles.icon, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(IndeterminateIcon2, {}) }) })
149
+ ]
150
+ }
151
+ );
152
+ }
153
+ // Annotate the CommonJS export names for ESM import in node:
154
+ 0 && (module.exports = {
155
+ Checkbox
156
+ });
157
+ //# sourceMappingURL=Checkbox.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/Checkbox.tsx","../../../src/components/Show.tsx","../../../src/context/field.tsx","../../../src/config/cerbIcons.ts","../../../src/config/icons/checkbox.icons.tsx","../../../src/config/defineIcons.ts"],"sourcesContent":["'use client'\n\nimport {\n checkbox,\n type CheckboxVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport { vstack } from '@cerberus/styled-system/patterns'\nimport { cx } from '@cerberus/styled-system/css'\nimport type { InputHTMLAttributes } from 'react'\nimport { Show } from './Show'\nimport { useFieldContext } from '../context/field'\nimport { $cerberusIcons } from '../config/defineIcons'\n\n/**\n * This module contains the Checkbox component.\n * @module\n */\n\nexport type CheckboxProps = CheckboxVariantProps &\n Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'id'> & {\n describedBy?: string\n id: string\n mixed?: boolean\n }\n\n/**\n * Checkbox component\n * @definition [ARIA Target Size](https://www.w3.org/WAI/WCAG21/Understanding/target-size.html#:~:text=Understanding%20SC%202.5.,%3ATarget%20Size%20(Level%20AAA)&text=The%20size%20of%20the%20target,Equivalent)\n * @definition [ARIA Forms](https://www.a11yproject.com/checklist/#forms)\n * @definition [Checkbox docs](https://cerberus.digitalu.design/react/checkbox)\n * @example\n * ```tsx\n * <Field>\n * <Checkbox id=\"legal\" checked={checked.legal} onChange={handleChange} />\n * </Field>\n * ```\n */\nexport function Checkbox(props: CheckboxProps) {\n const { describedBy, size, checked, mixed, ...nativeProps } = props\n const { invalid, ...fieldStates } = useFieldContext()\n const styles = checkbox({ size })\n const { checkbox: CheckIcon, indeterminate: IndeterminateIcon } =\n $cerberusIcons\n\n return (\n <div\n className={cx(\n styles.root,\n vstack({\n gap: '0',\n justify: 'center',\n }),\n )}\n >\n <input\n {...nativeProps}\n {...fieldStates}\n {...(describedBy && { 'aria-describedby': describedBy })}\n {...(invalid && { 'aria-invalid': true })}\n {...(mixed && { 'aria-checked': 'mixed' })}\n className={cx('peer', nativeProps.className, styles.input)}\n type=\"checkbox\"\n />\n <Show when={checked && !mixed}>\n <span className={styles.icon}>\n <CheckIcon />\n </span>\n </Show>\n <Show when={mixed}>\n <span className={styles.icon}>\n <IndeterminateIcon />\n </span>\n </Show>\n </div>\n )\n}\n","'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","'use client'\n\nimport {\n createContext,\n useContext,\n useMemo,\n type PropsWithChildren,\n} from 'react'\n\nexport interface FieldContextValue {\n disabled?: boolean\n readOnly?: boolean\n required?: boolean\n invalid?: boolean\n}\n\nconst FieldContext = createContext<FieldContextValue | null>(null)\n\nexport function Field(\n props: PropsWithChildren<FieldContextValue>,\n): JSX.Element {\n const value = useMemo(\n () => ({\n disabled: props.disabled,\n readOnly: props.readOnly,\n required: props.required,\n invalid: props.invalid,\n }),\n [props.disabled, props.readOnly, props.required, props.invalid],\n )\n\n return (\n <FieldContext.Provider value={value}>\n {props.children}\n </FieldContext.Provider>\n )\n}\n\nexport function useFieldContext(): FieldContextValue {\n const context = useContext(FieldContext)\n if (!context) {\n throw new Error('useFieldContext must be used within a Field Provider.')\n }\n return context\n}\n","import {\n Checkmark,\n CheckmarkFilled,\n ChevronDown,\n CloseFilled,\n CloudUpload,\n ErrorFilled,\n Information,\n InformationFilled,\n Restart,\n TrashCan,\n Warning,\n WarningFilled,\n type CarbonIconType,\n} from '@cerberus/icons'\nimport type { ElementType } from 'react'\nimport { CheckmarkIcon, IndeterminateIcon } from './icons/checkbox.icons'\n\nexport type IconType = CarbonIconType | ElementType\n\nexport interface DefinedIcons {\n checkbox?: IconType\n close?: IconType\n confirmModal?: IconType\n delete?: IconType\n promptModal?: IconType\n fileUploader?: IconType\n indeterminate?: IconType\n infoNotification?: IconType\n successNotification?: IconType\n warningNotification?: IconType\n dangerNotification?: IconType\n invalid: IconType\n invalidAlt?: IconType\n redo?: IconType\n selectArrow?: IconType\n toggleChecked?: IconType\n}\n\nexport const defaultIcons: DefinedIcons = {\n checkbox: CheckmarkIcon,\n close: CloseFilled,\n confirmModal: Information,\n delete: TrashCan,\n promptModal: Information,\n fileUploader: CloudUpload,\n indeterminate: IndeterminateIcon,\n infoNotification: InformationFilled,\n successNotification: CheckmarkFilled,\n warningNotification: WarningFilled,\n dangerNotification: ErrorFilled,\n invalid: WarningFilled,\n invalidAlt: Warning,\n redo: Restart,\n selectArrow: ChevronDown,\n toggleChecked: Checkmark,\n}\n","import type { SVGProps } from 'react'\n\n/**\n * This module contains substitute icons for the Checkbox component.\n * @module\n */\n\ninterface CheckboxIconProps extends SVGProps<SVGSVGElement> {}\n\n/**\n * Checkmark icon for Checkbox component\n */\nexport function CheckmarkIcon(props: CheckboxIconProps) {\n return (\n <svg\n aria-hidden=\"true\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n role=\"img\"\n viewBox=\"0 0 24 24\"\n {...props}\n >\n <path\n fill=\"currentColor\"\n d=\"M9.714 18 4 12.335l1.818-1.764 3.896 3.824L18.181 6 20 7.803 9.714 18Z\"\n />\n </svg>\n )\n}\n\ninterface IndeterminateIconProps extends SVGProps<SVGSVGElement> {}\n\n/**\n * Indeterminate icon for Checkbox component\n */\nexport function IndeterminateIcon(props: IndeterminateIconProps) {\n return (\n <svg\n aria-hidden=\"true\"\n xmlns=\"http://www.w3.org/2000/svg\"\n role=\"img\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n {...props}\n >\n <path fill=\"currentColor\" d=\"M4 11h16v2.667H4z\" />\n </svg>\n )\n}\n","import { defaultIcons, type DefinedIcons } from './cerbIcons'\n\nfunction _validateIconsProperties(icons: DefinedIcons) {\n if (!icons.invalid) {\n throw new Error(\n 'The an invalid property must be defined in your custom icons library.',\n )\n }\n}\n\nexport function defineIcons(icons: DefinedIcons): Required<DefinedIcons> {\n _validateIconsProperties(icons)\n $cerberusIcons = {\n ...defaultIcons,\n ...icons,\n } as Required<DefinedIcons>\n return $cerberusIcons\n}\n\n// Default icons\n\nexport let $cerberusIcons = defaultIcons as Required<DefinedIcons>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,qBAGO;AACP,sBAAuB;AACvB,iBAAmB;;;ACLnB,mBAAgE;AAiBzD,SAAS,KAAK,OAAgD;AACnE,QAAM,EAAE,MAAM,UAAU,SAAS,IAAI;AACrC,QAAM,gBAAY,sBAAQ,MAAM,QAAQ,OAAO,CAAC,IAAI,CAAC;AAErD,aAAO,sBAAQ,MAAM;AACnB,QAAI,UAAW,QAAO;AACtB,WAAO,YAAY;AAAA,EACrB,GAAG,CAAC,WAAW,UAAU,QAAQ,CAAC;AACpC;;;ACzBA,IAAAA,gBAKO;AAyBH;AAhBJ,IAAM,mBAAe,6BAAwC,IAAI;AAsB1D,SAAS,kBAAqC;AACnD,QAAM,cAAU,0BAAW,YAAY;AACvC,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,uDAAuD;AAAA,EACzE;AACA,SAAO;AACT;;;AC5CA,mBAcO;;;ACQD,IAAAC,sBAAA;AAVC,SAAS,cAAc,OAA0B;AACtD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAY;AAAA,MACZ,OAAM;AAAA,MACN,MAAK;AAAA,MACL,MAAK;AAAA,MACL,SAAQ;AAAA,MACP,GAAG;AAAA,MAEJ;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,GAAE;AAAA;AAAA,MACJ;AAAA;AAAA,EACF;AAEJ;AAOO,SAAS,kBAAkB,OAA+B;AAC/D,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAY;AAAA,MACZ,OAAM;AAAA,MACN,MAAK;AAAA,MACL,MAAK;AAAA,MACL,SAAQ;AAAA,MACP,GAAG;AAAA,MAEJ,uDAAC,UAAK,MAAK,gBAAe,GAAE,qBAAoB;AAAA;AAAA,EAClD;AAEJ;;;ADTO,IAAM,eAA6B;AAAA,EACxC,UAAU;AAAA,EACV,OAAO;AAAA,EACP,cAAc;AAAA,EACd,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,cAAc;AAAA,EACd,eAAe;AAAA,EACf,kBAAkB;AAAA,EAClB,qBAAqB;AAAA,EACrB,qBAAqB;AAAA,EACrB,oBAAoB;AAAA,EACpB,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,aAAa;AAAA,EACb,eAAe;AACjB;;;AEnCO,IAAI,iBAAiB;;;ALwBxB,IAAAC,sBAAA;AARG,SAAS,SAAS,OAAsB;AAC7C,QAAM,EAAE,aAAa,MAAM,SAAS,OAAO,GAAG,YAAY,IAAI;AAC9D,QAAM,EAAE,SAAS,GAAG,YAAY,IAAI,gBAAgB;AACpD,QAAM,aAAS,yBAAS,EAAE,KAAK,CAAC;AAChC,QAAM,EAAE,UAAU,WAAW,eAAeC,mBAAkB,IAC5D;AAEF,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAW;AAAA,QACT,OAAO;AAAA,YACP,wBAAO;AAAA,UACL,KAAK;AAAA,UACL,SAAS;AAAA,QACX,CAAC;AAAA,MACH;AAAA,MAEA;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,YACtC,GAAI,SAAS,EAAE,gBAAgB,QAAQ;AAAA,YACxC,eAAW,eAAG,QAAQ,YAAY,WAAW,OAAO,KAAK;AAAA,YACzD,MAAK;AAAA;AAAA,QACP;AAAA,QACA,6CAAC,QAAK,MAAM,WAAW,CAAC,OACtB,uDAAC,UAAK,WAAW,OAAO,MACtB,uDAAC,aAAU,GACb,GACF;AAAA,QACA,6CAAC,QAAK,MAAM,OACV,uDAAC,UAAK,WAAW,OAAO,MACtB,uDAACA,oBAAA,EAAkB,GACrB,GACF;AAAA;AAAA;AAAA,EACF;AAEJ;","names":["import_react","import_jsx_runtime","import_jsx_runtime","IndeterminateIcon"]}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ "use client";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/components/Droppable.tsx
22
+ var Droppable_exports = {};
23
+ __export(Droppable_exports, {
24
+ Droppable: () => Droppable
25
+ });
26
+ module.exports = __toCommonJS(Droppable_exports);
27
+ var import_core = require("@dnd-kit/core");
28
+ var import_react = require("react");
29
+ var import_jsx_runtime = require("react/jsx-runtime");
30
+ function Droppable(props) {
31
+ const { dropped, id, disabled, data, resizeObserverConfig, ...nativeProps } = props;
32
+ const uuid = (0, import_react.useId)();
33
+ const { isOver, setNodeRef } = (0, import_core.useDroppable)({
34
+ data,
35
+ disabled,
36
+ id: id || uuid,
37
+ resizeObserverConfig
38
+ });
39
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
40
+ "div",
41
+ {
42
+ ...nativeProps,
43
+ "data-over": isOver,
44
+ "data-dropped": dropped,
45
+ ref: setNodeRef,
46
+ children: props.children
47
+ }
48
+ );
49
+ }
50
+ // Annotate the CommonJS export names for ESM import in node:
51
+ 0 && (module.exports = {
52
+ Droppable
53
+ });
54
+ //# sourceMappingURL=Droppable.cjs.map
@@ -0,0 +1 @@
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":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,kBAAyD;AACzD,mBAAuE;AAoBnE;AAZG,SAAS,UAAU,OAA0C;AAClE,QAAM,EAAE,SAAS,IAAI,UAAU,MAAM,sBAAsB,GAAG,YAAY,IACxE;AACF,QAAM,WAAO,oBAAM;AACnB,QAAM,EAAE,QAAQ,WAAW,QAAI,0BAAa;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":[]}
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ "use client";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/components/FeatureFlag.tsx
22
+ var FeatureFlag_exports = {};
23
+ __export(FeatureFlag_exports, {
24
+ FeatureFlag: () => FeatureFlag
25
+ });
26
+ module.exports = __toCommonJS(FeatureFlag_exports);
27
+
28
+ // src/context/feature-flags.tsx
29
+ var import_react = require("react");
30
+ var import_jsx_runtime = require("react/jsx-runtime");
31
+ var FeatureFlagContext = (0, import_react.createContext)(null);
32
+ function useFeatureFlags(key) {
33
+ const context = (0, import_react.useContext)(FeatureFlagContext);
34
+ if (context === null) {
35
+ throw new Error(
36
+ "useFeatureFlag must be used within a FeatureFlags Provider"
37
+ );
38
+ }
39
+ return context[key] ?? false;
40
+ }
41
+
42
+ // src/components/Show.tsx
43
+ var import_react2 = require("react");
44
+ function Show(props) {
45
+ const { when, children, fallback } = props;
46
+ const condition = (0, import_react2.useMemo)(() => when ?? false, [when]);
47
+ return (0, import_react2.useMemo)(() => {
48
+ if (condition) return children;
49
+ return fallback ?? null;
50
+ }, [condition, children, fallback]);
51
+ }
52
+
53
+ // src/components/FeatureFlag.tsx
54
+ var import_jsx_runtime2 = require("react/jsx-runtime");
55
+ function FeatureFlag(props) {
56
+ const showContent = useFeatureFlags(props.flag);
57
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Show, { when: showContent, children: props.children });
58
+ }
59
+ // Annotate the CommonJS export names for ESM import in node:
60
+ 0 && (module.exports = {
61
+ FeatureFlag
62
+ });
63
+ //# sourceMappingURL=FeatureFlag.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/FeatureFlag.tsx","../../../src/context/feature-flags.tsx","../../../src/components/Show.tsx"],"sourcesContent":["'use client'\n\nimport type { PropsWithChildren } from 'react'\nimport { useFeatureFlags } from '../context/feature-flags'\nimport { Show } from './Show'\n\nexport interface FeatureFlagProps {\n flag: string\n}\n\nexport function FeatureFlag(props: PropsWithChildren<FeatureFlagProps>) {\n const showContent = useFeatureFlags(props.flag)\n return <Show when={showContent}>{props.children}</Show>\n}\n","'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","'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":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,mBAAkE;AA2C9D;AAhCJ,IAAM,yBAAqB,4BAAuC,IAAI;AAsC/D,SAAS,gBAAgB,KAAsB;AACpD,QAAM,cAAU,yBAAW,kBAAkB;AAC7C,MAAI,YAAY,MAAM;AACpB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,SAAO,QAAQ,GAAG,KAAK;AACzB;;;ACzDA,IAAAA,gBAAgE;AAiBzD,SAAS,KAAK,OAAgD;AACnE,QAAM,EAAE,MAAM,UAAU,SAAS,IAAI;AACrC,QAAM,gBAAY,uBAAQ,MAAM,QAAQ,OAAO,CAAC,IAAI,CAAC;AAErD,aAAO,uBAAQ,MAAM;AACnB,QAAI,UAAW,QAAO;AACtB,WAAO,YAAY;AAAA,EACrB,GAAG,CAAC,WAAW,UAAU,QAAQ,CAAC;AACpC;;;AFfS,IAAAC,sBAAA;AAFF,SAAS,YAAY,OAA4C;AACtE,QAAM,cAAc,gBAAgB,MAAM,IAAI;AAC9C,SAAO,6CAAC,QAAK,MAAM,aAAc,gBAAM,UAAS;AAClD;","names":["import_react","import_jsx_runtime"]}
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ "use client";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/components/FieldMessage.tsx
22
+ var FieldMessage_exports = {};
23
+ __export(FieldMessage_exports, {
24
+ FieldMessage: () => FieldMessage
25
+ });
26
+ module.exports = __toCommonJS(FieldMessage_exports);
27
+ var import_css = require("@cerberus/styled-system/css");
28
+ var import_recipes = require("@cerberus/styled-system/recipes");
29
+
30
+ // src/context/field.tsx
31
+ var import_react = require("react");
32
+ var import_jsx_runtime = require("react/jsx-runtime");
33
+ var FieldContext = (0, import_react.createContext)(null);
34
+ function useFieldContext() {
35
+ const context = (0, import_react.useContext)(FieldContext);
36
+ if (!context) {
37
+ throw new Error("useFieldContext must be used within a Field Provider.");
38
+ }
39
+ return context;
40
+ }
41
+
42
+ // src/components/FieldMessage.tsx
43
+ var import_jsx_runtime2 = require("react/jsx-runtime");
44
+ function FieldMessage(props) {
45
+ const { invalid } = useFieldContext();
46
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
47
+ "small",
48
+ {
49
+ ...props,
50
+ ...invalid && { "aria-invalid": true },
51
+ className: (0, import_css.cx)(props.className, (0, import_recipes.fieldMessage)())
52
+ }
53
+ );
54
+ }
55
+ // Annotate the CommonJS export names for ESM import in node:
56
+ 0 && (module.exports = {
57
+ FieldMessage
58
+ });
59
+ //# sourceMappingURL=FieldMessage.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/FieldMessage.tsx","../../../src/context/field.tsx"],"sourcesContent":["'use client'\n\nimport type { HTMLAttributes } from 'react'\nimport { cx, type RecipeVariantProps } from '@cerberus/styled-system/css'\nimport { fieldMessage } from '@cerberus/styled-system/recipes'\nimport { useFieldContext } from '../context/field'\n\n/**\n * This module contains the FieldMessage component.\n * @module\n */\n\nexport type FieldMessageRecipe = RecipeVariantProps<typeof fieldMessage>\nexport interface FieldMessageBaseProps\n extends HTMLAttributes<HTMLParagraphElement> {\n id: string\n}\nexport type FieldMessageProps = FieldMessageBaseProps & FieldMessageRecipe\n\n/**\n * A component that provides feedback about the field.\n * @description [FieldMessage Docs](https://cerberus.digitalu.design/react/field-message)\n * @example\n * ```tsx\n * <Field>\n * <Label htmlFor=\"first_name\">First Name</Label>\n * <Input aria-describedBy=\"help:first_name\" id=\"first_name\" type=\"text\" />\n * <FieldMessage id=\"help:first_name\">\n * This will only be used in your account information.\n * </FieldMessage>\n * </Field>\n * ```\n */\nexport function FieldMessage(props: FieldMessageProps) {\n const { invalid } = useFieldContext()\n return (\n <small\n {...props}\n {...(invalid && { 'aria-invalid': true })}\n className={cx(props.className, fieldMessage())}\n />\n )\n}\n","'use client'\n\nimport {\n createContext,\n useContext,\n useMemo,\n type PropsWithChildren,\n} from 'react'\n\nexport interface FieldContextValue {\n disabled?: boolean\n readOnly?: boolean\n required?: boolean\n invalid?: boolean\n}\n\nconst FieldContext = createContext<FieldContextValue | null>(null)\n\nexport function Field(\n props: PropsWithChildren<FieldContextValue>,\n): JSX.Element {\n const value = useMemo(\n () => ({\n disabled: props.disabled,\n readOnly: props.readOnly,\n required: props.required,\n invalid: props.invalid,\n }),\n [props.disabled, props.readOnly, props.required, props.invalid],\n )\n\n return (\n <FieldContext.Provider value={value}>\n {props.children}\n </FieldContext.Provider>\n )\n}\n\nexport function useFieldContext(): FieldContextValue {\n const context = useContext(FieldContext)\n if (!context) {\n throw new Error('useFieldContext must be used within a Field Provider.')\n }\n return context\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,iBAA4C;AAC5C,qBAA6B;;;ACF7B,mBAKO;AAyBH;AAhBJ,IAAM,mBAAe,4BAAwC,IAAI;AAsB1D,SAAS,kBAAqC;AACnD,QAAM,cAAU,yBAAW,YAAY;AACvC,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,uDAAuD;AAAA,EACzE;AACA,SAAO;AACT;;;ADRI,IAAAA,sBAAA;AAHG,SAAS,aAAa,OAA0B;AACrD,QAAM,EAAE,QAAQ,IAAI,gBAAgB;AACpC,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACH,GAAI,WAAW,EAAE,gBAAgB,KAAK;AAAA,MACvC,eAAW,eAAG,MAAM,eAAW,6BAAa,CAAC;AAAA;AAAA,EAC/C;AAEJ;","names":["import_jsx_runtime"]}