@cerberus-design/react 0.15.0 → 0.16.0-next-feeb186

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 (550) hide show
  1. package/build/legacy/_tsup-dts-rollup.d.cts +1345 -319
  2. package/build/legacy/components/Accordion.cjs.map +1 -1
  3. package/build/legacy/components/AccordionItemGroup.cjs.map +1 -1
  4. package/build/legacy/components/DatePicker.client.cjs +63 -77
  5. package/build/legacy/components/DatePicker.client.cjs.map +1 -1
  6. package/build/legacy/components/FileStatus.cjs +126 -79
  7. package/build/legacy/components/FileStatus.cjs.map +1 -1
  8. package/build/legacy/components/Legend.cjs +10 -22
  9. package/build/legacy/components/Legend.cjs.map +1 -1
  10. package/build/legacy/components/button/button.cjs +154 -0
  11. package/build/legacy/components/button/button.cjs.map +1 -0
  12. package/build/legacy/components/button/index.cjs +163 -0
  13. package/build/legacy/components/button/index.cjs.map +1 -0
  14. package/build/legacy/components/button/parts.cjs +159 -0
  15. package/build/legacy/components/button/parts.cjs.map +1 -0
  16. package/build/legacy/components/checkbox/checkbox-icon.cjs +121 -0
  17. package/build/legacy/components/checkbox/checkbox-icon.cjs.map +1 -0
  18. package/build/legacy/components/checkbox/checkbox.cjs +165 -0
  19. package/build/legacy/components/checkbox/checkbox.cjs.map +1 -0
  20. package/build/legacy/components/checkbox/index.cjs +179 -0
  21. package/build/legacy/components/checkbox/index.cjs.map +1 -0
  22. package/build/legacy/components/checkbox/parts.cjs +89 -0
  23. package/build/legacy/components/checkbox/parts.cjs.map +1 -0
  24. package/build/legacy/components/checkbox/primitives.cjs +87 -0
  25. package/build/legacy/components/checkbox/primitives.cjs.map +1 -0
  26. package/build/legacy/components/cta-dialog/context.cjs +33 -0
  27. package/build/legacy/components/cta-dialog/context.cjs.map +1 -0
  28. package/build/legacy/components/cta-dialog/index.cjs +433 -0
  29. package/build/legacy/components/cta-dialog/index.cjs.map +1 -0
  30. package/build/legacy/{context/cta-modal.cjs → components/cta-dialog/provider.cjs} +175 -128
  31. package/build/legacy/components/cta-dialog/provider.cjs.map +1 -0
  32. package/build/legacy/components/cta-dialog/trigger-item.cjs +99 -0
  33. package/build/legacy/components/cta-dialog/trigger-item.cjs.map +1 -0
  34. package/build/legacy/components/cta-dialog/utils.cjs +47 -0
  35. package/build/legacy/components/cta-dialog/utils.cjs.map +1 -0
  36. package/build/legacy/components/{FieldMessage.cjs → deprecated/FieldMessage.cjs} +4 -17
  37. package/build/legacy/components/deprecated/FieldMessage.cjs.map +1 -0
  38. package/build/legacy/components/{FieldsetLabel.cjs → deprecated/FieldsetLabel.cjs} +1 -1
  39. package/build/legacy/components/deprecated/FieldsetLabel.cjs.map +1 -0
  40. package/build/legacy/components/{Textarea.cjs → deprecated/Label.cjs} +24 -36
  41. package/build/legacy/components/deprecated/Label.cjs.map +1 -0
  42. package/build/legacy/components/{Modal.cjs → deprecated/Modal.cjs} +1 -1
  43. package/build/legacy/components/deprecated/Modal.cjs.map +1 -0
  44. package/build/legacy/components/{ModalDescription.cjs → deprecated/ModalDescription.cjs} +1 -1
  45. package/build/legacy/components/deprecated/ModalDescription.cjs.map +1 -0
  46. package/build/legacy/components/{ModalHeader.cjs → deprecated/ModalHeader.cjs} +1 -1
  47. package/build/legacy/components/deprecated/ModalHeader.cjs.map +1 -0
  48. package/build/legacy/components/{ModalHeading.cjs → deprecated/ModalHeading.cjs} +1 -1
  49. package/build/legacy/components/deprecated/ModalHeading.cjs.map +1 -0
  50. package/build/legacy/components/{NavMenuLink.cjs → deprecated/NavMenuLink.cjs} +2 -2
  51. package/build/legacy/components/deprecated/NavMenuLink.cjs.map +1 -0
  52. package/build/legacy/components/{NavMenuList.cjs → deprecated/NavMenuList.cjs} +2 -2
  53. package/build/legacy/components/deprecated/NavMenuList.cjs.map +1 -0
  54. package/build/legacy/components/{NavMenuTrigger.cjs → deprecated/NavMenuTrigger.cjs} +2 -2
  55. package/build/legacy/components/deprecated/NavMenuTrigger.cjs.map +1 -0
  56. package/build/legacy/components/field/field.cjs +130 -0
  57. package/build/legacy/components/field/field.cjs.map +1 -0
  58. package/build/legacy/components/field/index.cjs +267 -0
  59. package/build/legacy/components/field/index.cjs.map +1 -0
  60. package/build/legacy/components/field/parts.cjs +188 -0
  61. package/build/legacy/components/field/parts.cjs.map +1 -0
  62. package/build/legacy/components/field/primitives.cjs +191 -0
  63. package/build/legacy/components/field/primitives.cjs.map +1 -0
  64. package/build/legacy/components/{Button.cjs → field/start-indicator.cjs} +14 -19
  65. package/build/legacy/components/field/start-indicator.cjs.map +1 -0
  66. package/build/legacy/components/field/status-indicator.cjs +78 -0
  67. package/build/legacy/components/field/status-indicator.cjs.map +1 -0
  68. package/build/legacy/components/fieldset/fieldset.cjs +116 -0
  69. package/build/legacy/components/fieldset/fieldset.cjs.map +1 -0
  70. package/build/legacy/components/fieldset/index.cjs +126 -0
  71. package/build/legacy/components/fieldset/index.cjs.map +1 -0
  72. package/build/legacy/components/fieldset/parts.cjs +80 -0
  73. package/build/legacy/components/fieldset/parts.cjs.map +1 -0
  74. package/build/legacy/components/fieldset/primitives.cjs +76 -0
  75. package/build/legacy/components/fieldset/primitives.cjs.map +1 -0
  76. package/build/legacy/components/for.cjs +37 -0
  77. package/build/legacy/components/for.cjs.map +1 -0
  78. package/build/legacy/components/radio/index.cjs +143 -0
  79. package/build/legacy/components/radio/index.cjs.map +1 -0
  80. package/build/legacy/components/radio/parts.cjs +113 -0
  81. package/build/legacy/components/radio/parts.cjs.map +1 -0
  82. package/build/legacy/components/radio/primitives.cjs +115 -0
  83. package/build/legacy/components/radio/primitives.cjs.map +1 -0
  84. package/build/legacy/components/radio/radio.cjs +82 -0
  85. package/build/legacy/components/radio/radio.cjs.map +1 -0
  86. package/build/legacy/components/select/index.cjs +265 -0
  87. package/build/legacy/components/select/index.cjs.map +1 -0
  88. package/build/legacy/components/select/option-group.cjs +60 -0
  89. package/build/legacy/components/select/option-group.cjs.map +1 -0
  90. package/build/legacy/components/select/parts.cjs +153 -0
  91. package/build/legacy/components/select/parts.cjs.map +1 -0
  92. package/build/legacy/components/select/primitives.cjs +167 -0
  93. package/build/legacy/components/select/primitives.cjs.map +1 -0
  94. package/build/legacy/components/select/select.cjs +212 -0
  95. package/build/legacy/components/select/select.cjs.map +1 -0
  96. package/build/legacy/components/switch/index.cjs +118 -0
  97. package/build/legacy/components/switch/index.cjs.map +1 -0
  98. package/build/legacy/components/switch/parts.cjs +75 -0
  99. package/build/legacy/components/switch/parts.cjs.map +1 -0
  100. package/build/legacy/components/switch/primitives.cjs +72 -0
  101. package/build/legacy/components/switch/primitives.cjs.map +1 -0
  102. package/build/legacy/components/{Fieldset.cjs → switch/switch-indicator.cjs} +17 -32
  103. package/build/legacy/components/switch/switch-indicator.cjs.map +1 -0
  104. package/build/legacy/components/switch/switch.cjs +106 -0
  105. package/build/legacy/components/switch/switch.cjs.map +1 -0
  106. package/build/legacy/components/toggle/index.cjs +45 -0
  107. package/build/legacy/components/toggle/index.cjs.map +1 -0
  108. package/build/legacy/components/toggle/parts.cjs +41 -0
  109. package/build/legacy/components/toggle/parts.cjs.map +1 -0
  110. package/build/legacy/components/toggle/primitives.cjs +35 -0
  111. package/build/legacy/components/toggle/primitives.cjs.map +1 -0
  112. package/build/legacy/config/types.cjs.map +1 -1
  113. package/build/legacy/context/confirm-modal.cjs +55 -45
  114. package/build/legacy/context/confirm-modal.cjs.map +1 -1
  115. package/build/legacy/context/field.cjs +23 -4
  116. package/build/legacy/context/field.cjs.map +1 -1
  117. package/build/legacy/context/notification-center.cjs +24 -16
  118. package/build/legacy/context/notification-center.cjs.map +1 -1
  119. package/build/legacy/context/prompt-modal.cjs +206 -194
  120. package/build/legacy/context/prompt-modal.cjs.map +1 -1
  121. package/build/legacy/hooks/useDate.cjs.map +1 -1
  122. package/build/legacy/hooks/useRootColors.cjs +0 -1
  123. package/build/legacy/hooks/useRootColors.cjs.map +1 -1
  124. package/build/legacy/hooks/useToggle.cjs.map +1 -1
  125. package/build/legacy/index.cjs +2023 -1466
  126. package/build/legacy/index.cjs.map +1 -1
  127. package/build/legacy/utils/index.cjs +22 -2
  128. package/build/legacy/utils/index.cjs.map +1 -1
  129. package/build/modern/_tsup-dts-rollup.d.ts +1345 -319
  130. package/build/modern/{chunk-PM7CWT3N.js → chunk-245SMQ45.js} +2 -2
  131. package/build/modern/chunk-245SMQ45.js.map +1 -0
  132. package/build/modern/chunk-2BIHLH4V.js +15 -0
  133. package/build/modern/chunk-2BIHLH4V.js.map +1 -0
  134. package/build/modern/chunk-2CVGNLIM.js +15 -0
  135. package/build/modern/chunk-2CVGNLIM.js.map +1 -0
  136. package/build/modern/{chunk-ISCJ542I.js → chunk-2HOUQ2DX.js} +2 -2
  137. package/build/modern/chunk-2LF3HPNA.js +1 -0
  138. package/build/modern/chunk-4LSTU6WU.js +8 -0
  139. package/build/modern/chunk-4LSTU6WU.js.map +1 -0
  140. package/build/modern/chunk-5RTNSVYU.js +88 -0
  141. package/build/modern/chunk-5RTNSVYU.js.map +1 -0
  142. package/build/modern/chunk-6I2FW4WI.js +33 -0
  143. package/build/modern/chunk-6I2FW4WI.js.map +1 -0
  144. package/build/modern/chunk-6ICNCCPD.js +47 -0
  145. package/build/modern/chunk-6ICNCCPD.js.map +1 -0
  146. package/build/modern/chunk-6KZVE4HC.js +52 -0
  147. package/build/modern/chunk-6KZVE4HC.js.map +1 -0
  148. package/build/modern/{chunk-25HMVHLT.js → chunk-7SU6FCTJ.js} +5 -5
  149. package/build/modern/chunk-7TQRTBUP.js +19 -0
  150. package/build/modern/chunk-7TQRTBUP.js.map +1 -0
  151. package/build/modern/{chunk-UZVQ4INR.js → chunk-AIJ75ENY.js} +2 -2
  152. package/build/modern/chunk-AIJ75ENY.js.map +1 -0
  153. package/build/modern/chunk-AO3GB72J.js +27 -0
  154. package/build/modern/chunk-AO3GB72J.js.map +1 -0
  155. package/build/modern/{chunk-NUMM4TNC.js → chunk-AUALRL3U.js} +2 -2
  156. package/build/modern/chunk-AUALRL3U.js.map +1 -0
  157. package/build/modern/{chunk-IGHMP4WA.js → chunk-AZRFYQO7.js} +1 -1
  158. package/build/modern/chunk-AZRFYQO7.js.map +1 -0
  159. package/build/modern/chunk-BL7G3577.js +29 -0
  160. package/build/modern/chunk-BL7G3577.js.map +1 -0
  161. package/build/modern/chunk-BPRF34DU.js +62 -0
  162. package/build/modern/chunk-BPRF34DU.js.map +1 -0
  163. package/build/modern/chunk-CAZ3EICD.js +16 -0
  164. package/build/modern/chunk-CAZ3EICD.js.map +1 -0
  165. package/build/modern/chunk-CIMY2U22.js +10 -0
  166. package/build/modern/chunk-CIMY2U22.js.map +1 -0
  167. package/build/modern/chunk-CNA2VKAH.js +43 -0
  168. package/build/modern/chunk-CNA2VKAH.js.map +1 -0
  169. package/build/modern/chunk-CYC2YUKU.js +1 -0
  170. package/build/modern/{chunk-PZAZKQMO.js → chunk-DRDNNRU3.js} +2 -2
  171. package/build/modern/chunk-DRDNNRU3.js.map +1 -0
  172. package/build/modern/{chunk-NJSETNRL.js → chunk-DXBZ3HMY.js} +2 -2
  173. package/build/modern/chunk-DXOKSZVQ.js +12 -0
  174. package/build/modern/chunk-DXOKSZVQ.js.map +1 -0
  175. package/build/modern/chunk-EL4MX2PG.js +22 -0
  176. package/build/modern/chunk-EL4MX2PG.js.map +1 -0
  177. package/build/modern/chunk-FBS7AX76.js +37 -0
  178. package/build/modern/chunk-FBS7AX76.js.map +1 -0
  179. package/build/modern/chunk-FUL2VRDU.js +25 -0
  180. package/build/modern/chunk-FUL2VRDU.js.map +1 -0
  181. package/build/modern/{chunk-BHB56M7S.js → chunk-H54FR7IP.js} +6 -6
  182. package/build/modern/chunk-H54FR7IP.js.map +1 -0
  183. package/build/modern/chunk-IASVL7CW.js +19 -0
  184. package/build/modern/chunk-IASVL7CW.js.map +1 -0
  185. package/build/modern/{chunk-REO5GUNC.js → chunk-ICTISECN.js} +1 -1
  186. package/build/modern/chunk-ICTISECN.js.map +1 -0
  187. package/build/modern/chunk-IDTAB2UJ.js +1 -0
  188. package/build/modern/chunk-IKDXADLX.js +1 -0
  189. package/build/modern/chunk-KQQPZJEI.js +21 -0
  190. package/build/modern/chunk-KQQPZJEI.js.map +1 -0
  191. package/build/modern/chunk-KWZ3CEG6.js +23 -0
  192. package/build/modern/chunk-KWZ3CEG6.js.map +1 -0
  193. package/build/modern/{chunk-JWIJHSI6.js → chunk-L7N24B6B.js} +3 -6
  194. package/build/modern/chunk-L7N24B6B.js.map +1 -0
  195. package/build/modern/chunk-LT62577B.js +23 -0
  196. package/build/modern/chunk-LT62577B.js.map +1 -0
  197. package/build/modern/chunk-LZWNHXRP.js +48 -0
  198. package/build/modern/chunk-LZWNHXRP.js.map +1 -0
  199. package/build/modern/{chunk-EDARV2EI.js → chunk-MISIUX63.js} +4 -4
  200. package/build/modern/chunk-MVO2GNUA.js +47 -0
  201. package/build/modern/chunk-MVO2GNUA.js.map +1 -0
  202. package/build/modern/{chunk-3BM6MZ4A.js → chunk-MWRO5QYD.js} +1 -1
  203. package/build/modern/chunk-MWRO5QYD.js.map +1 -0
  204. package/build/modern/{chunk-SD3OVTHT.js → chunk-O542MPR7.js} +40 -43
  205. package/build/modern/chunk-O542MPR7.js.map +1 -0
  206. package/build/modern/chunk-OGYMMATX.js +1 -0
  207. package/build/modern/chunk-OVHCXBBI.js +22 -0
  208. package/build/modern/chunk-OVHCXBBI.js.map +1 -0
  209. package/build/modern/chunk-PLHYOCY3.js +23 -0
  210. package/build/modern/chunk-PLHYOCY3.js.map +1 -0
  211. package/build/modern/{chunk-JIRW4XOJ.js → chunk-Q3I4H6EC.js} +2 -2
  212. package/build/modern/chunk-Q3I4H6EC.js.map +1 -0
  213. package/build/modern/chunk-QCBLRACK.js +133 -0
  214. package/build/modern/chunk-QCBLRACK.js.map +1 -0
  215. package/build/modern/{chunk-FGCO27TC.js → chunk-QEM3M4N3.js} +25 -34
  216. package/build/modern/chunk-QEM3M4N3.js.map +1 -0
  217. package/build/modern/{chunk-ILQW5VZT.js → chunk-RBNOEAWJ.js} +4 -7
  218. package/build/modern/chunk-RBNOEAWJ.js.map +1 -0
  219. package/build/modern/{chunk-YKKNWILF.js → chunk-RHCTPSKT.js} +2 -15
  220. package/build/modern/chunk-RHCTPSKT.js.map +1 -0
  221. package/build/modern/chunk-STLN7BMJ.js +22 -0
  222. package/build/modern/chunk-STLN7BMJ.js.map +1 -0
  223. package/build/modern/{chunk-7NN3SJ7W.js → chunk-SWX5JWZR.js} +2 -2
  224. package/build/modern/chunk-SWX5JWZR.js.map +1 -0
  225. package/build/modern/{chunk-GCQMH4QA.js → chunk-SXLPDPOZ.js} +4 -4
  226. package/build/modern/chunk-TIJAFPHQ.js +1 -0
  227. package/build/modern/chunk-TYPULJMJ.js +1 -0
  228. package/build/modern/chunk-UDY6USHW.js +1 -0
  229. package/build/modern/chunk-V4YYGGMH.js +1 -0
  230. package/build/modern/chunk-VSTOSLFS.js +100 -0
  231. package/build/modern/chunk-VSTOSLFS.js.map +1 -0
  232. package/build/modern/{chunk-ZL6ZITLA.js → chunk-WECB67DC.js} +2 -2
  233. package/build/modern/chunk-WECB67DC.js.map +1 -0
  234. package/build/modern/{chunk-BAWZBF5Q.js → chunk-WN7TJX6J.js} +2 -2
  235. package/build/modern/{chunk-RMVJK26W.js → chunk-XJQXHSH7.js} +1 -2
  236. package/build/modern/chunk-XJQXHSH7.js.map +1 -0
  237. package/build/modern/chunk-XTNGF4D6.js +41 -0
  238. package/build/modern/chunk-XTNGF4D6.js.map +1 -0
  239. package/build/modern/chunk-Y4ZEJ2EF.js +31 -0
  240. package/build/modern/chunk-Y4ZEJ2EF.js.map +1 -0
  241. package/build/modern/{chunk-WPVDQRRF.js → chunk-YOTXFCCC.js} +2 -2
  242. package/build/modern/chunk-YOTXFCCC.js.map +1 -0
  243. package/build/modern/chunk-Z3FDG263.js +53 -0
  244. package/build/modern/chunk-Z3FDG263.js.map +1 -0
  245. package/build/modern/{chunk-JAROS4Q3.js → chunk-Z4342DRO.js} +10 -10
  246. package/build/modern/chunk-Z4342DRO.js.map +1 -0
  247. package/build/modern/chunk-Z52R6ABJ.js +21 -0
  248. package/build/modern/chunk-Z52R6ABJ.js.map +1 -0
  249. package/build/modern/{chunk-O6LFWUHI.js → chunk-ZFFW5ELD.js} +10 -10
  250. package/build/modern/chunk-ZFFW5ELD.js.map +1 -0
  251. package/build/modern/components/Accordion.js +1 -1
  252. package/build/modern/components/AccordionItemGroup.js +3 -3
  253. package/build/modern/components/Admonition.client.js +3 -3
  254. package/build/modern/components/Admonition.js +4 -4
  255. package/build/modern/components/Avatar.js +2 -2
  256. package/build/modern/components/DatePicker.client.js +4 -3
  257. package/build/modern/components/FileStatus.js +11 -5
  258. package/build/modern/components/FileUploader.js +3 -3
  259. package/build/modern/components/Legend.js +1 -2
  260. package/build/modern/components/Tag.js +2 -2
  261. package/build/modern/components/button/button.js +12 -0
  262. package/build/modern/components/button/index.js +16 -0
  263. package/build/modern/components/button/parts.js +10 -0
  264. package/build/modern/components/checkbox/checkbox-icon.js +12 -0
  265. package/build/modern/components/checkbox/checkbox.js +13 -0
  266. package/build/modern/components/checkbox/index.js +30 -0
  267. package/build/modern/components/checkbox/parts.js +8 -0
  268. package/build/modern/components/checkbox/primitives.js +17 -0
  269. package/build/modern/components/cta-dialog/context.js +8 -0
  270. package/build/modern/components/cta-dialog/index.js +26 -0
  271. package/build/modern/components/cta-dialog/provider.js +22 -0
  272. package/build/modern/components/cta-dialog/provider.js.map +1 -0
  273. package/build/modern/components/cta-dialog/trigger-item.js +10 -0
  274. package/build/modern/components/cta-dialog/trigger-item.js.map +1 -0
  275. package/build/modern/components/cta-dialog/utils.js +7 -0
  276. package/build/modern/components/cta-dialog/utils.js.map +1 -0
  277. package/build/modern/components/deprecated/FieldMessage.js +8 -0
  278. package/build/modern/components/deprecated/FieldMessage.js.map +1 -0
  279. package/build/modern/components/deprecated/FieldsetLabel.js +7 -0
  280. package/build/modern/components/deprecated/FieldsetLabel.js.map +1 -0
  281. package/build/modern/components/deprecated/Label.js +17 -0
  282. package/build/modern/components/deprecated/Label.js.map +1 -0
  283. package/build/modern/components/deprecated/Modal.js +7 -0
  284. package/build/modern/components/deprecated/Modal.js.map +1 -0
  285. package/build/modern/components/deprecated/ModalDescription.js +7 -0
  286. package/build/modern/components/deprecated/ModalDescription.js.map +1 -0
  287. package/build/modern/components/deprecated/ModalHeader.js +7 -0
  288. package/build/modern/components/deprecated/ModalHeader.js.map +1 -0
  289. package/build/modern/components/deprecated/ModalHeading.js +7 -0
  290. package/build/modern/components/deprecated/ModalHeading.js.map +1 -0
  291. package/build/modern/components/deprecated/NavMenuLink.js +8 -0
  292. package/build/modern/components/deprecated/NavMenuLink.js.map +1 -0
  293. package/build/modern/components/deprecated/NavMenuList.js +12 -0
  294. package/build/modern/components/deprecated/NavMenuList.js.map +1 -0
  295. package/build/modern/components/deprecated/NavMenuTrigger.js +11 -0
  296. package/build/modern/components/deprecated/NavMenuTrigger.js.map +1 -0
  297. package/build/modern/components/field/field.js +14 -0
  298. package/build/modern/components/field/field.js.map +1 -0
  299. package/build/modern/components/field/index.js +44 -0
  300. package/build/modern/components/field/index.js.map +1 -0
  301. package/build/modern/components/field/parts.js +11 -0
  302. package/build/modern/components/field/parts.js.map +1 -0
  303. package/build/modern/components/field/primitives.js +26 -0
  304. package/build/modern/components/field/primitives.js.map +1 -0
  305. package/build/modern/components/field/start-indicator.js +7 -0
  306. package/build/modern/components/field/start-indicator.js.map +1 -0
  307. package/build/modern/components/field/status-indicator.js +9 -0
  308. package/build/modern/components/field/status-indicator.js.map +1 -0
  309. package/build/modern/components/fieldset/fieldset.js +11 -0
  310. package/build/modern/components/fieldset/fieldset.js.map +1 -0
  311. package/build/modern/components/fieldset/index.js +24 -0
  312. package/build/modern/components/fieldset/index.js.map +1 -0
  313. package/build/modern/components/fieldset/parts.js +8 -0
  314. package/build/modern/components/fieldset/parts.js.map +1 -0
  315. package/build/modern/components/fieldset/primitives.js +13 -0
  316. package/build/modern/components/fieldset/primitives.js.map +1 -0
  317. package/build/modern/components/for.js +7 -0
  318. package/build/modern/components/for.js.map +1 -0
  319. package/build/modern/components/radio/index.js +30 -0
  320. package/build/modern/components/radio/index.js.map +1 -0
  321. package/build/modern/components/radio/parts.js +8 -0
  322. package/build/modern/components/radio/parts.js.map +1 -0
  323. package/build/modern/components/radio/primitives.js +21 -0
  324. package/build/modern/components/radio/primitives.js.map +1 -0
  325. package/build/modern/components/radio/radio.js +8 -0
  326. package/build/modern/components/radio/radio.js.map +1 -0
  327. package/build/modern/components/select/index.js +57 -0
  328. package/build/modern/components/select/index.js.map +1 -0
  329. package/build/modern/components/select/option-group.js +10 -0
  330. package/build/modern/components/select/option-group.js.map +1 -0
  331. package/build/modern/components/select/parts.js +8 -0
  332. package/build/modern/components/select/parts.js.map +1 -0
  333. package/build/modern/components/select/primitives.js +37 -0
  334. package/build/modern/components/select/primitives.js.map +1 -0
  335. package/build/modern/components/select/select.js +15 -0
  336. package/build/modern/components/select/select.js.map +1 -0
  337. package/build/modern/components/switch/index.js +26 -0
  338. package/build/modern/components/switch/index.js.map +1 -0
  339. package/build/modern/components/switch/parts.js +8 -0
  340. package/build/modern/components/switch/parts.js.map +1 -0
  341. package/build/modern/components/switch/primitives.js +15 -0
  342. package/build/modern/components/switch/primitives.js.map +1 -0
  343. package/build/modern/components/switch/switch-indicator.js +9 -0
  344. package/build/modern/components/switch/switch-indicator.js.map +1 -0
  345. package/build/modern/components/switch/switch.js +11 -0
  346. package/build/modern/components/switch/switch.js.map +1 -0
  347. package/build/modern/components/toggle/index.js +14 -0
  348. package/build/modern/components/toggle/index.js.map +1 -0
  349. package/build/modern/components/toggle/parts.js +8 -0
  350. package/build/modern/components/toggle/parts.js.map +1 -0
  351. package/build/modern/components/toggle/primitives.js +9 -0
  352. package/build/modern/components/toggle/primitives.js.map +1 -0
  353. package/build/modern/context/confirm-modal.js +5 -4
  354. package/build/modern/context/field.js +34 -4
  355. package/build/modern/context/field.js.map +1 -1
  356. package/build/modern/context/notification-center.js +5 -4
  357. package/build/modern/context/prompt-modal.js +13 -7
  358. package/build/modern/hooks/useDate.js +1 -1
  359. package/build/modern/hooks/useRootColors.js +1 -1
  360. package/build/modern/hooks/useToggle.js +1 -1
  361. package/build/modern/index.js +304 -129
  362. package/build/modern/index.js.map +1 -1
  363. package/build/modern/utils/index.js +5 -3
  364. package/package.json +2 -2
  365. package/src/components/Accordion.tsx +1 -0
  366. package/src/components/DatePicker.client.tsx +3 -15
  367. package/src/components/FileStatus.tsx +4 -5
  368. package/src/components/Legend.tsx +5 -6
  369. package/src/components/button/button.tsx +77 -0
  370. package/src/components/button/index.ts +2 -0
  371. package/src/components/button/parts.ts +32 -0
  372. package/src/components/checkbox/checkbox-icon.tsx +39 -0
  373. package/src/components/checkbox/checkbox.tsx +42 -0
  374. package/src/components/checkbox/index.ts +3 -0
  375. package/src/components/checkbox/parts.ts +59 -0
  376. package/src/components/checkbox/primitives.tsx +104 -0
  377. package/src/components/cta-dialog/context.tsx +34 -0
  378. package/src/components/cta-dialog/index.ts +2 -0
  379. package/src/{context/cta-modal.tsx → components/cta-dialog/provider.tsx} +34 -68
  380. package/src/components/cta-dialog/trigger-item.tsx +53 -0
  381. package/src/components/cta-dialog/utils.ts +57 -0
  382. package/src/components/{FieldMessage.tsx → deprecated/FieldMessage.tsx} +2 -13
  383. package/src/components/deprecated/FieldsetLabel.tsx +32 -0
  384. package/src/components/deprecated/Label.tsx +24 -0
  385. package/src/components/{NavMenuLink.tsx → deprecated/NavMenuLink.tsx} +1 -1
  386. package/src/components/{NavMenuList.tsx → deprecated/NavMenuList.tsx} +3 -3
  387. package/src/components/{NavMenuTrigger.tsx → deprecated/NavMenuTrigger.tsx} +4 -4
  388. package/src/components/field/field.tsx +77 -0
  389. package/src/components/field/index.ts +5 -0
  390. package/src/components/field/parts.ts +77 -0
  391. package/src/components/field/primitives.tsx +204 -0
  392. package/src/components/field/start-indicator.tsx +23 -0
  393. package/src/components/field/status-indicator.tsx +58 -0
  394. package/src/components/fieldset/fieldset.tsx +55 -0
  395. package/src/components/fieldset/index.ts +3 -0
  396. package/src/components/fieldset/parts.ts +47 -0
  397. package/src/components/fieldset/primitives.tsx +79 -0
  398. package/src/components/for.tsx +38 -0
  399. package/src/components/radio/index.ts +3 -0
  400. package/src/components/radio/parts.ts +65 -0
  401. package/src/components/radio/primitives.tsx +123 -0
  402. package/src/components/radio/radio.tsx +35 -0
  403. package/src/components/select/index.ts +4 -0
  404. package/src/components/select/option-group.tsx +34 -0
  405. package/src/components/select/parts.ts +113 -0
  406. package/src/components/select/primitives.tsx +205 -0
  407. package/src/components/select/select.tsx +135 -0
  408. package/src/components/switch/index.ts +3 -0
  409. package/src/components/switch/parts.ts +53 -0
  410. package/src/components/switch/primitives.tsx +69 -0
  411. package/src/components/switch/switch-indicator.tsx +9 -0
  412. package/src/components/switch/switch.tsx +30 -0
  413. package/src/components/toggle/index.ts +2 -0
  414. package/src/components/toggle/parts.ts +32 -0
  415. package/src/components/toggle/primitives.tsx +17 -0
  416. package/src/config/types.ts +1 -0
  417. package/src/context/confirm-modal.tsx +1 -1
  418. package/src/context/field.tsx +6 -5
  419. package/src/context/notification-center.tsx +1 -1
  420. package/src/context/prompt-modal.tsx +16 -18
  421. package/src/hooks/useDate.ts +1 -7
  422. package/src/hooks/useRootColors.ts +0 -1
  423. package/src/hooks/useToggle.ts +1 -3
  424. package/src/index.ts +24 -24
  425. package/src/utils/index.ts +30 -0
  426. package/build/legacy/components/Button.cjs.map +0 -1
  427. package/build/legacy/components/Checkbox.cjs +0 -113
  428. package/build/legacy/components/Checkbox.cjs.map +0 -1
  429. package/build/legacy/components/FieldMessage.cjs.map +0 -1
  430. package/build/legacy/components/Fieldset.cjs.map +0 -1
  431. package/build/legacy/components/FieldsetLabel.cjs.map +0 -1
  432. package/build/legacy/components/Input.cjs +0 -95
  433. package/build/legacy/components/Input.cjs.map +0 -1
  434. package/build/legacy/components/Label.cjs +0 -93
  435. package/build/legacy/components/Label.cjs.map +0 -1
  436. package/build/legacy/components/Modal.cjs.map +0 -1
  437. package/build/legacy/components/ModalDescription.cjs.map +0 -1
  438. package/build/legacy/components/ModalHeader.cjs.map +0 -1
  439. package/build/legacy/components/ModalHeading.cjs.map +0 -1
  440. package/build/legacy/components/NavMenuLink.cjs.map +0 -1
  441. package/build/legacy/components/NavMenuList.cjs.map +0 -1
  442. package/build/legacy/components/NavMenuTrigger.cjs.map +0 -1
  443. package/build/legacy/components/Radio.cjs +0 -81
  444. package/build/legacy/components/Radio.cjs.map +0 -1
  445. package/build/legacy/components/Select.cjs +0 -120
  446. package/build/legacy/components/Select.cjs.map +0 -1
  447. package/build/legacy/components/Textarea.cjs.map +0 -1
  448. package/build/legacy/components/Toggle.cjs +0 -101
  449. package/build/legacy/components/Toggle.cjs.map +0 -1
  450. package/build/legacy/context/cta-modal.cjs.map +0 -1
  451. package/build/modern/chunk-3BM6MZ4A.js.map +0 -1
  452. package/build/modern/chunk-3ZDFQO25.js +0 -31
  453. package/build/modern/chunk-3ZDFQO25.js.map +0 -1
  454. package/build/modern/chunk-7NN3SJ7W.js.map +0 -1
  455. package/build/modern/chunk-BHB56M7S.js.map +0 -1
  456. package/build/modern/chunk-C5EHJUS5.js +0 -10
  457. package/build/modern/chunk-C5EHJUS5.js.map +0 -1
  458. package/build/modern/chunk-EXGKZGML.js +0 -28
  459. package/build/modern/chunk-EXGKZGML.js.map +0 -1
  460. package/build/modern/chunk-FGCO27TC.js.map +0 -1
  461. package/build/modern/chunk-FTPZHG6J.js +0 -46
  462. package/build/modern/chunk-FTPZHG6J.js.map +0 -1
  463. package/build/modern/chunk-IGHMP4WA.js.map +0 -1
  464. package/build/modern/chunk-ILQW5VZT.js.map +0 -1
  465. package/build/modern/chunk-JAROS4Q3.js.map +0 -1
  466. package/build/modern/chunk-JIJM6JFJ.js +0 -36
  467. package/build/modern/chunk-JIJM6JFJ.js.map +0 -1
  468. package/build/modern/chunk-JIRW4XOJ.js.map +0 -1
  469. package/build/modern/chunk-JWIJHSI6.js.map +0 -1
  470. package/build/modern/chunk-KKHL3ZO4.js +0 -69
  471. package/build/modern/chunk-KKHL3ZO4.js.map +0 -1
  472. package/build/modern/chunk-MZ3UCDUL.js +0 -43
  473. package/build/modern/chunk-MZ3UCDUL.js.map +0 -1
  474. package/build/modern/chunk-N24COMHJ.js +0 -63
  475. package/build/modern/chunk-N24COMHJ.js.map +0 -1
  476. package/build/modern/chunk-NMF2HYWO.js +0 -50
  477. package/build/modern/chunk-NMF2HYWO.js.map +0 -1
  478. package/build/modern/chunk-NUMM4TNC.js.map +0 -1
  479. package/build/modern/chunk-O6LFWUHI.js.map +0 -1
  480. package/build/modern/chunk-PM7CWT3N.js.map +0 -1
  481. package/build/modern/chunk-PZAZKQMO.js.map +0 -1
  482. package/build/modern/chunk-REO5GUNC.js.map +0 -1
  483. package/build/modern/chunk-RMVJK26W.js.map +0 -1
  484. package/build/modern/chunk-SD3OVTHT.js.map +0 -1
  485. package/build/modern/chunk-UZDVOIW5.js +0 -33
  486. package/build/modern/chunk-UZDVOIW5.js.map +0 -1
  487. package/build/modern/chunk-UZVQ4INR.js.map +0 -1
  488. package/build/modern/chunk-WPVDQRRF.js.map +0 -1
  489. package/build/modern/chunk-XQICKZH4.js +0 -59
  490. package/build/modern/chunk-XQICKZH4.js.map +0 -1
  491. package/build/modern/chunk-YKKNWILF.js.map +0 -1
  492. package/build/modern/chunk-ZL6ZITLA.js.map +0 -1
  493. package/build/modern/components/Button.js +0 -7
  494. package/build/modern/components/Checkbox.js +0 -11
  495. package/build/modern/components/FieldMessage.js +0 -9
  496. package/build/modern/components/Fieldset.js +0 -9
  497. package/build/modern/components/FieldsetLabel.js +0 -7
  498. package/build/modern/components/Input.js +0 -11
  499. package/build/modern/components/Label.js +0 -10
  500. package/build/modern/components/Modal.js +0 -7
  501. package/build/modern/components/ModalDescription.js +0 -7
  502. package/build/modern/components/ModalHeader.js +0 -7
  503. package/build/modern/components/ModalHeading.js +0 -7
  504. package/build/modern/components/NavMenuLink.js +0 -8
  505. package/build/modern/components/NavMenuList.js +0 -12
  506. package/build/modern/components/NavMenuTrigger.js +0 -11
  507. package/build/modern/components/Radio.js +0 -9
  508. package/build/modern/components/Select.js +0 -13
  509. package/build/modern/components/Textarea.js +0 -9
  510. package/build/modern/components/Toggle.js +0 -10
  511. package/build/modern/context/cta-modal.js +0 -18
  512. package/src/components/Button.tsx +0 -35
  513. package/src/components/Checkbox.tsx +0 -93
  514. package/src/components/Fieldset.tsx +0 -65
  515. package/src/components/FieldsetLabel.tsx +0 -59
  516. package/src/components/Input.tsx +0 -69
  517. package/src/components/Label.tsx +0 -69
  518. package/src/components/Radio.tsx +0 -73
  519. package/src/components/Select.tsx +0 -108
  520. package/src/components/Textarea.tsx +0 -52
  521. package/src/components/Toggle.tsx +0 -91
  522. /package/build/modern/{chunk-ISCJ542I.js.map → chunk-2HOUQ2DX.js.map} +0 -0
  523. /package/build/modern/{components/Button.js.map → chunk-2LF3HPNA.js.map} +0 -0
  524. /package/build/modern/{chunk-25HMVHLT.js.map → chunk-7SU6FCTJ.js.map} +0 -0
  525. /package/build/modern/{components/Checkbox.js.map → chunk-CYC2YUKU.js.map} +0 -0
  526. /package/build/modern/{chunk-NJSETNRL.js.map → chunk-DXBZ3HMY.js.map} +0 -0
  527. /package/build/modern/{components/FieldMessage.js.map → chunk-IDTAB2UJ.js.map} +0 -0
  528. /package/build/modern/{components/Fieldset.js.map → chunk-IKDXADLX.js.map} +0 -0
  529. /package/build/modern/{chunk-EDARV2EI.js.map → chunk-MISIUX63.js.map} +0 -0
  530. /package/build/modern/{components/FieldsetLabel.js.map → chunk-OGYMMATX.js.map} +0 -0
  531. /package/build/modern/{chunk-GCQMH4QA.js.map → chunk-SXLPDPOZ.js.map} +0 -0
  532. /package/build/modern/{components/Input.js.map → chunk-TIJAFPHQ.js.map} +0 -0
  533. /package/build/modern/{components/Label.js.map → chunk-TYPULJMJ.js.map} +0 -0
  534. /package/build/modern/{components/Modal.js.map → chunk-UDY6USHW.js.map} +0 -0
  535. /package/build/modern/{components/ModalDescription.js.map → chunk-V4YYGGMH.js.map} +0 -0
  536. /package/build/modern/{chunk-BAWZBF5Q.js.map → chunk-WN7TJX6J.js.map} +0 -0
  537. /package/build/modern/components/{ModalHeader.js.map → button/button.js.map} +0 -0
  538. /package/build/modern/components/{ModalHeading.js.map → button/index.js.map} +0 -0
  539. /package/build/modern/components/{NavMenuLink.js.map → button/parts.js.map} +0 -0
  540. /package/build/modern/components/{NavMenuList.js.map → checkbox/checkbox-icon.js.map} +0 -0
  541. /package/build/modern/components/{NavMenuTrigger.js.map → checkbox/checkbox.js.map} +0 -0
  542. /package/build/modern/components/{Radio.js.map → checkbox/index.js.map} +0 -0
  543. /package/build/modern/components/{Select.js.map → checkbox/parts.js.map} +0 -0
  544. /package/build/modern/components/{Textarea.js.map → checkbox/primitives.js.map} +0 -0
  545. /package/build/modern/components/{Toggle.js.map → cta-dialog/context.js.map} +0 -0
  546. /package/build/modern/{context/cta-modal.js.map → components/cta-dialog/index.js.map} +0 -0
  547. /package/src/components/{Modal.tsx → deprecated/Modal.tsx} +0 -0
  548. /package/src/components/{ModalDescription.tsx → deprecated/ModalDescription.tsx} +0 -0
  549. /package/src/components/{ModalHeader.tsx → deprecated/ModalHeader.tsx} +0 -0
  550. /package/src/components/{ModalHeading.tsx → deprecated/ModalHeading.tsx} +0 -0
@@ -25,75 +25,35 @@ __export(FileStatus_exports, {
25
25
  processStatus: () => processStatus
26
26
  });
27
27
  module.exports = __toCommonJS(FileStatus_exports);
28
- var import_react4 = require("react");
28
+ var import_react3 = require("react");
29
29
  var import_recipes5 = require("@cerberus/styled-system/recipes");
30
30
  var import_css5 = require("@cerberus/styled-system/css");
31
31
  var import_patterns2 = require("@cerberus/styled-system/patterns");
32
32
 
33
- // src/context/field.tsx
33
+ // src/context/cerberus.tsx
34
34
  var import_react = require("react");
35
35
  var import_jsx_runtime = require("react/jsx-runtime");
36
- var FieldContext = (0, import_react.createContext)(null);
37
- function Field(props) {
38
- const value = (0, import_react.useMemo)(
39
- () => ({
40
- disabled: props.disabled,
41
- readOnly: props.readOnly,
42
- required: props.required,
43
- invalid: props.invalid
44
- }),
45
- [props.disabled, props.readOnly, props.required, props.invalid]
46
- );
47
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FieldContext.Provider, { value, children: props.children });
48
- }
49
- function useFieldContext() {
50
- const context = (0, import_react.useContext)(FieldContext);
51
- if (!context) {
52
- throw new Error("useFieldContext must be used within a Field Provider.");
53
- }
54
- return context;
55
- }
56
-
57
- // src/context/cerberus.tsx
58
- var import_react2 = require("react");
59
- var import_jsx_runtime2 = require("react/jsx-runtime");
60
- var CerberusContext = (0, import_react2.createContext)(null);
36
+ var CerberusContext = (0, import_react.createContext)(null);
61
37
  function useCerberusContext() {
62
- const context = (0, import_react2.useContext)(CerberusContext);
38
+ const context = (0, import_react.useContext)(CerberusContext);
63
39
  if (!context) {
64
40
  throw new Error("useCerberus must be used within a CerberusProvider");
65
41
  }
66
42
  return context;
67
43
  }
68
44
 
69
- // src/components/FieldMessage.tsx
45
+ // src/components/ProgressBar.tsx
70
46
  var import_css = require("@cerberus/styled-system/css");
71
47
  var import_recipes = require("@cerberus/styled-system/recipes");
72
- var import_jsx_runtime3 = require("react/jsx-runtime");
73
- function FieldMessage(props) {
74
- const { invalid } = useFieldContext();
75
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
76
- "small",
77
- {
78
- ...props,
79
- ...invalid && { "aria-invalid": true },
80
- className: (0, import_css.cx)(props.className, (0, import_recipes.fieldMessage)())
81
- }
82
- );
83
- }
84
-
85
- // src/components/ProgressBar.tsx
86
- var import_css2 = require("@cerberus/styled-system/css");
87
- var import_recipes2 = require("@cerberus/styled-system/recipes");
88
- var import_jsx_runtime4 = require("react/jsx-runtime");
48
+ var import_jsx_runtime2 = require("react/jsx-runtime");
89
49
  function ProgressBar(props) {
90
50
  const { indeterminate, size, usage, now, label, ...nativeProps } = props;
91
- const styles = (0, import_recipes2.progressBar)({ size, usage });
51
+ const styles = (0, import_recipes.progressBar)({ size, usage });
92
52
  const nowClamped = Math.min(100, Math.max(0, now || 0));
93
53
  const width = {
94
54
  width: indeterminate ? "50%" : `${nowClamped}%`
95
55
  };
96
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
56
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
97
57
  "div",
98
58
  {
99
59
  ...nativeProps,
@@ -101,9 +61,9 @@ function ProgressBar(props) {
101
61
  "aria-valuemin": 0,
102
62
  "aria-valuemax": 100,
103
63
  "aria-valuenow": indeterminate ? 0 : nowClamped,
104
- className: (0, import_css2.cx)(nativeProps.className, styles.root),
64
+ className: (0, import_css.cx)(nativeProps.className, styles.root),
105
65
  role: "progressbar",
106
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
66
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
107
67
  "div",
108
68
  {
109
69
  ...indeterminate && { "data-indeterminate": true },
@@ -117,19 +77,19 @@ function ProgressBar(props) {
117
77
  }
118
78
 
119
79
  // src/components/IconButton.tsx
120
- var import_css3 = require("@cerberus/styled-system/css");
121
- var import_recipes3 = require("@cerberus/styled-system/recipes");
122
- var import_jsx_runtime5 = require("react/jsx-runtime");
80
+ var import_css2 = require("@cerberus/styled-system/css");
81
+ var import_recipes2 = require("@cerberus/styled-system/recipes");
82
+ var import_jsx_runtime3 = require("react/jsx-runtime");
123
83
  function IconButton(props) {
124
84
  const { ariaLabel, palette, usage, size, ...nativeProps } = props;
125
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
85
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
126
86
  "button",
127
87
  {
128
88
  ...nativeProps,
129
89
  "aria-label": ariaLabel ?? "Icon Button",
130
- className: (0, import_css3.cx)(
90
+ className: (0, import_css2.cx)(
131
91
  nativeProps.className,
132
- (0, import_recipes3.iconButton)({
92
+ (0, import_recipes2.iconButton)({
133
93
  palette,
134
94
  usage,
135
95
  size
@@ -140,23 +100,23 @@ function IconButton(props) {
140
100
  }
141
101
 
142
102
  // src/components/Avatar.tsx
143
- var import_css4 = require("@cerberus/styled-system/css");
103
+ var import_css3 = require("@cerberus/styled-system/css");
144
104
  var import_patterns = require("@cerberus/styled-system/patterns");
145
- var import_recipes4 = require("@cerberus/styled-system/recipes");
105
+ var import_recipes3 = require("@cerberus/styled-system/recipes");
146
106
 
147
107
  // src/components/Show.tsx
148
- var import_react3 = require("react");
108
+ var import_react2 = require("react");
149
109
  function Show(props) {
150
110
  const { when, children, fallback } = props;
151
- const condition = (0, import_react3.useMemo)(() => when ?? false, [when]);
152
- return (0, import_react3.useMemo)(() => {
111
+ const condition = (0, import_react2.useMemo)(() => when ?? false, [when]);
112
+ return (0, import_react2.useMemo)(() => {
153
113
  if (condition) return children;
154
114
  return fallback ?? null;
155
115
  }, [condition, children, fallback]);
156
116
  }
157
117
 
158
118
  // src/components/Avatar.tsx
159
- var import_jsx_runtime6 = require("react/jsx-runtime");
119
+ var import_jsx_runtime4 = require("react/jsx-runtime");
160
120
  function Avatar(props) {
161
121
  const {
162
122
  ariaLabel,
@@ -172,28 +132,28 @@ function Avatar(props) {
172
132
  const { icons } = useCerberusContext();
173
133
  const { avatar: AvatarIcon } = icons;
174
134
  const initials = (ariaLabel || "").split(" ").map((word) => word[0]).join("").slice(0, 2);
175
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
135
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
176
136
  "div",
177
137
  {
178
138
  ...nativeProps,
179
- className: (0, import_css4.cx)(
139
+ className: (0, import_css3.cx)(
180
140
  nativeProps.className,
181
- (0, import_recipes4.avatar)({ gradient, size }),
141
+ (0, import_recipes3.avatar)({ gradient, size }),
182
142
  (0, import_patterns.circle)()
183
143
  ),
184
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
144
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
185
145
  Show,
186
146
  {
187
147
  when: Boolean(src) || Boolean(as),
188
- fallback: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
148
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
189
149
  Show,
190
150
  {
191
151
  when: Boolean(initials),
192
- fallback: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
152
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
193
153
  Show,
194
154
  {
195
155
  when: Boolean(icon),
196
- fallback: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
156
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
197
157
  AvatarIcon,
198
158
  {
199
159
  size: iconSizeMap[size]
@@ -205,15 +165,15 @@ function Avatar(props) {
205
165
  children: initials
206
166
  }
207
167
  ),
208
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
168
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
209
169
  Show,
210
170
  {
211
171
  when: Boolean(as),
212
- fallback: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
172
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
213
173
  "img",
214
174
  {
215
175
  alt: props.ariaLabel,
216
- className: (0, import_css4.css)({
176
+ className: (0, import_css3.css)({
217
177
  h: "full",
218
178
  objectFit: "cover",
219
179
  w: "full"
@@ -244,6 +204,93 @@ var iconSizeMap = {
244
204
  "4xl": 32
245
205
  };
246
206
 
207
+ // src/utils/index.ts
208
+ function splitProps(props, ...keyGroups) {
209
+ const result = keyGroups.map(() => ({}));
210
+ const rest = {};
211
+ for (const key in props) {
212
+ let assigned = false;
213
+ for (let i = 0; i < keyGroups.length; i++) {
214
+ if (keyGroups[i].includes(key)) {
215
+ result[i][key] = props[key];
216
+ assigned = true;
217
+ break;
218
+ }
219
+ }
220
+ if (!assigned) {
221
+ rest[key] = props[key];
222
+ }
223
+ }
224
+ return [...result, rest];
225
+ }
226
+
227
+ // src/components/field/primitives.tsx
228
+ var import_field = require("@ark-ui/react/field");
229
+ var import_css4 = require("@cerberus/styled-system/css");
230
+ var import_recipes4 = require("@cerberus/styled-system/recipes");
231
+ var import_jsx_runtime5 = require("react/jsx-runtime");
232
+ function FieldRoot(props) {
233
+ const { size, ...fieldProps } = props;
234
+ const styles = (0, import_recipes4.field)({ size });
235
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
236
+ import_field.Field.Root,
237
+ {
238
+ ...fieldProps,
239
+ className: (0, import_css4.cx)(styles.root, fieldProps.className)
240
+ }
241
+ );
242
+ }
243
+ function FieldLabel(props) {
244
+ const { children, ...nativeProps } = props;
245
+ const styles = (0, import_recipes4.field)();
246
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_field.Field.Label, { ...nativeProps, className: (0, import_css4.cx)(styles.label, props.className), children: [
247
+ children,
248
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_field.Field.RequiredIndicator, { children: "(required)" })
249
+ ] });
250
+ }
251
+ function FieldHelperText(props) {
252
+ const styles = (0, import_recipes4.field)();
253
+ if (!props.children) return null;
254
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
255
+ import_field.Field.HelperText,
256
+ {
257
+ ...props,
258
+ className: (0, import_css4.cx)(styles.helperText, props.className)
259
+ }
260
+ );
261
+ }
262
+ function FieldErrorText(props) {
263
+ const styles = (0, import_recipes4.field)();
264
+ if (!props.children) return null;
265
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
266
+ import_field.Field.ErrorText,
267
+ {
268
+ ...props,
269
+ className: (0, import_css4.cx)(styles.errorText, props.className)
270
+ }
271
+ );
272
+ }
273
+
274
+ // src/components/field/field.tsx
275
+ var import_jsx = require("@cerberus/styled-system/jsx");
276
+ var import_jsx_runtime6 = require("react/jsx-runtime");
277
+ function Field2(props) {
278
+ const [statusProps, fieldProps, rootProps] = splitProps(
279
+ props,
280
+ ["disabled", "required", "readOnly", "invalid"],
281
+ ["label", "helperText", "secondaryHelperText", "errorText", "children"]
282
+ );
283
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(FieldRoot, { ...statusProps, ...rootProps, children: [
284
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Show, { when: Boolean(fieldProps.label), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(FieldLabel, { children: fieldProps.label }) }),
285
+ fieldProps.children,
286
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Show, { when: Boolean(fieldProps.helperText && !statusProps.invalid), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx.HStack, { justifyContent: "space-between", w: "full", children: [
287
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(FieldHelperText, { children: fieldProps.helperText }),
288
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Show, { when: Boolean(fieldProps.secondaryHelperText), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(FieldHelperText, { children: fieldProps.secondaryHelperText }) })
289
+ ] }) }),
290
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(FieldErrorText, { children: fieldProps.errorText })
291
+ ] });
292
+ }
293
+
247
294
  // src/components/FileStatus.tsx
248
295
  var import_jsx_runtime7 = require("react/jsx-runtime");
249
296
  var processStatus = /* @__PURE__ */ ((processStatus2) => {
@@ -255,10 +302,10 @@ var processStatus = /* @__PURE__ */ ((processStatus2) => {
255
302
  })(processStatus || {});
256
303
  function FileStatus(props) {
257
304
  const { file, now, status, onClick, ...nativeProps } = props;
258
- const actionLabel = (0, import_react4.useMemo)(() => getStatusActionLabel(status), [status]);
259
- const palette = (0, import_react4.useMemo)(() => getPalette(status), [status]);
260
- const modalIconPalette = (0, import_react4.useMemo)(() => getModalIconPalette(status), [status]);
261
- const styles = (0, import_react4.useMemo)(() => {
305
+ const actionLabel = (0, import_react3.useMemo)(() => getStatusActionLabel(status), [status]);
306
+ const palette = (0, import_react3.useMemo)(() => getPalette(status), [status]);
307
+ const modalIconPalette = (0, import_react3.useMemo)(() => getModalIconPalette(status), [status]);
308
+ const styles = (0, import_react3.useMemo)(() => {
262
309
  switch (status) {
263
310
  case "todo" /* TODO */:
264
311
  return (0, import_recipes5.fileStatus)({ status: "todo" });
@@ -272,7 +319,7 @@ function FileStatus(props) {
272
319
  return (0, import_recipes5.fileStatus)();
273
320
  }
274
321
  }, [status]);
275
- const handleClick = (0, import_react4.useCallback)(
322
+ const handleClick = (0, import_react3.useCallback)(
276
323
  (e) => {
277
324
  const actionStatus = getStatusActionLabel(
278
325
  status
@@ -324,8 +371,8 @@ function FileStatus(props) {
324
371
  size: "sm"
325
372
  }
326
373
  ),
327
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Field, { invalid: modalIconPalette === "hades-dark", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
328
- FieldMessage,
374
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Field2, { label: "", invalid: modalIconPalette === "hades-dark", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
375
+ FieldHelperText,
329
376
  {
330
377
  className: (0, import_css5.css)({
331
378
  color: "page.text.100"
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/FileStatus.tsx","../../../src/context/field.tsx","../../../src/context/cerberus.tsx","../../../src/components/FieldMessage.tsx","../../../src/components/ProgressBar.tsx","../../../src/components/IconButton.tsx","../../../src/components/Avatar.tsx","../../../src/components/Show.tsx"],"sourcesContent":["'use client'\n\nimport {\n useCallback,\n useMemo,\n type HTMLAttributes,\n type MouseEvent,\n} from 'react'\nimport {\n fileStatus,\n type FileStatusVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport { css, cx } from '@cerberus/styled-system/css'\nimport { hstack, vstack } from '@cerberus/styled-system/patterns'\nimport { Field } from '../context/field'\nimport { useCerberusContext } from '../context/cerberus'\nimport { FieldMessage } from './FieldMessage'\nimport { ProgressBar, type ProgressBarProps } from './ProgressBar'\nimport { IconButton } from './IconButton'\nimport { Avatar } from './Avatar'\n\n/**\n * This module contains the FileStatus component.\n * @module\n */\n\n/**\n * The available values of the fileStatus helper Object.\n * @example\n * ```tsx\n * import { fileStatus } from '@cerberus/react'\n * processStatus.TODO // 'todo'\n * ```\n */\nexport type FileStatusKey = (typeof processStatus)[keyof typeof processStatus]\n\n/**\n * The actions that can be performed on a file.\n */\nexport type FileStatusActions = 'cancel' | 'retry' | 'delete'\nexport interface FileBaseStatusProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'onClick'> {\n /**\n * A unique identifier for the file status. Required for accessibility.\n */\n id: string\n /**\n * The name of the file.\n */\n file: string\n /**\n * The percentage of the file that has been processed.\n */\n now: ProgressBarProps['now']\n /**\n * The status of the file.\n */\n status: processStatus\n /**\n * The action to perform on the file when a user clicks the\n * button located at the end of the status card.\n * @param status - The status of the file.\n * @param e - The event object.\n * @example\n * ```tsx\n * <FileStatus file=\"file.txt\" now={0} status={processStatus.TODO} action={(status, e) => console.log(status, e)} />\n * ```\n * @default () => {}\n */\n onClick: (status: FileStatusActions, e: MouseEvent<HTMLButtonElement>) => void\n}\nexport type FileStatusProps = FileBaseStatusProps & FileStatusVariantProps\n\n/**\n * A helper object to represent the status of a file.\n * @example\n * ```tsx\n * import { fileStatus } from '@cerberus/react'\n * processStatus.TODO // 'todo'\n * ```\n */\nexport const enum processStatus {\n TODO = 'todo',\n PROCESSING = 'processing',\n DONE = 'done',\n ERROR = 'error',\n}\n\n/**\n * A component that displays the status of a file during file processing.\n * @see https://cerberus.digitalu.design/react/file-uploader\n * @example\n * ```tsx\n * <FileStatus file=\"file.txt\" now={0} status={processStatus.TODO} action={(status, e) => console.log(status, e)} />\n * ```\n */\nexport function FileStatus(props: FileStatusProps) {\n const { file, now, status, onClick, ...nativeProps } = props\n const actionLabel = useMemo(() => getStatusActionLabel(status), [status])\n const palette = useMemo(() => getPalette(status), [status])\n const modalIconPalette = useMemo(() => getModalIconPalette(status), [status])\n const styles = useMemo(() => {\n switch (status) {\n case processStatus.TODO:\n return fileStatus({ status: 'todo' })\n case processStatus.PROCESSING:\n return fileStatus({ status: 'processing' })\n case processStatus.DONE:\n return fileStatus({ status: 'done' })\n case processStatus.ERROR:\n return fileStatus({ status: 'error' })\n default:\n return fileStatus()\n }\n }, [status])\n\n const handleClick = useCallback(\n (e: MouseEvent<HTMLButtonElement>) => {\n const actionStatus = getStatusActionLabel(\n status,\n ).toLocaleLowerCase() as FileStatusActions\n onClick(actionStatus, e)\n },\n [onClick],\n )\n\n return (\n <div\n {...nativeProps}\n className={cx(nativeProps.className, styles.root, hstack())}\n >\n <Avatar\n ariaLabel=\"\"\n gradient={modalIconPalette}\n icon={<MatchFileStatusIcon size={24} status={status} />}\n src=\"\"\n />\n\n <div\n className={vstack({\n alignItems: 'flex-start',\n gap: '0.12rem',\n w: 'full',\n })}\n >\n <small\n className={css({\n color: 'page.text.initial',\n textStyle: 'label-sm',\n })}\n >\n {file}\n </small>\n <ProgressBar\n id={props.id}\n label=\"File upload status\"\n now={now}\n size=\"sm\"\n />\n <Field invalid={modalIconPalette === 'hades-dark'}>\n <FieldMessage\n className={css({\n color: 'page.text.100',\n })}\n id={`help:${file}`}\n >\n <MatchFileStatusText status={status} now={now} />\n </FieldMessage>\n </Field>\n </div>\n\n <IconButton\n ariaLabel={actionLabel}\n onClick={handleClick}\n palette={palette}\n size=\"sm\"\n >\n <MatchStatusAction status={status} />\n </IconButton>\n </div>\n )\n}\n\ninterface FileStatusElProps {\n status: FileStatusProps['status']\n size?: 16 | 20 | 24 | 32\n now?: number\n}\n\nfunction MatchFileStatusIcon(props: FileStatusElProps) {\n const { icons } = useCerberusContext()\n const {\n waitingFileUploader: TodoIcon,\n fileUploader: FileUploaderIcon,\n invalidAlt: InvalidIcon,\n successNotification: DoneIcon,\n } = icons\n\n switch (props.status) {\n case processStatus.TODO:\n return <TodoIcon size={props.size} />\n case processStatus.PROCESSING:\n return <FileUploaderIcon size={props.size} />\n case processStatus.DONE:\n return <DoneIcon size={props.size} />\n case processStatus.ERROR:\n return <InvalidIcon size={props.size} />\n default:\n throw new Error('Unknown status')\n }\n}\n\nfunction MatchFileStatusText(props: FileStatusElProps) {\n switch (props.status) {\n case processStatus.TODO:\n return 'Waiting to upload'\n case processStatus.PROCESSING:\n return `${props.now}% Complete`\n case processStatus.DONE:\n return 'File uploaded successfully'\n case processStatus.ERROR:\n return 'There was an error uploading the file'\n default:\n throw new Error('Invalid status')\n }\n}\n\nfunction MatchStatusAction(props: FileStatusElProps) {\n const { icons } = useCerberusContext()\n const { close: CloseIcon, redo: RedoIcon, delete: TrashIcon } = icons\n switch (props.status) {\n case processStatus.TODO:\n case processStatus.PROCESSING:\n return <CloseIcon />\n case processStatus.ERROR:\n return <RedoIcon />\n case processStatus.DONE:\n return <TrashIcon />\n default:\n throw new Error('Invalid status')\n }\n}\n\nfunction getStatusActionLabel(status: FileStatusKey) {\n switch (status) {\n case processStatus.TODO:\n case processStatus.PROCESSING:\n return 'Cancel'\n case processStatus.ERROR:\n return 'Retry'\n case processStatus.DONE:\n return 'Delete'\n default:\n return ''\n }\n}\n\nfunction getPalette(status: FileStatusKey) {\n switch (status) {\n case processStatus.TODO:\n case processStatus.PROCESSING:\n return 'danger'\n case processStatus.ERROR:\n return 'action'\n case processStatus.DONE:\n return 'danger'\n default:\n return 'action'\n }\n}\n\nfunction getModalIconPalette(status: FileStatusKey) {\n switch (status) {\n case processStatus.TODO:\n case processStatus.PROCESSING:\n return 'charon-light'\n case processStatus.ERROR:\n return 'hades-dark'\n case processStatus.DONE:\n return 'thanatos-light'\n default:\n return 'charon-light'\n }\n}\n","'use client'\n\nimport {\n createContext,\n useContext,\n useMemo,\n type PropsWithChildren,\n} from 'react'\n\n/**\n * This module provides a context and hook for the field.\n * @module Field\n */\n\nexport interface FieldContextValue {\n /**\n * Whether the field is disabled.\n * @description [Moz Input Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attributes)\n */\n disabled?: boolean\n /**\n * Whether the field is read-only.\n */\n readOnly?: boolean\n /**\n * Whether the field is required.\n */\n required?: boolean\n /**\n * Whether the field is invalid.\n */\n invalid?: boolean\n}\n\nconst FieldContext = createContext<FieldContextValue | null>(null)\n\n/**\n * Provides the field state for a all related components used within a group.\n * @see https://cerberus.digitalu.design/react/input\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\n/**\n * Used to access the field context.\n * @returns The field context.\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","'use client'\n\nimport { createContext, useContext, type PropsWithChildren } from 'react'\nimport type { SystemConfig } from '../config'\n\n/**\n * This module contains the Cerberus configuration context and helpers.\n * @module context/cerberus\n */\n\ntype CerberusContextValue = SystemConfig\n\nconst CerberusContext = createContext<CerberusContextValue | null>(null)\n\ninterface CerberusProviderProps {\n config: SystemConfig\n}\n\n/**\n * Cerberus configuration provider.\n * @param props.config The Cerberus configuration created with\n * `makeSystemConfig` helper.\n */\nexport function CerberusProvider(\n props: PropsWithChildren<CerberusProviderProps>,\n) {\n return (\n <CerberusContext.Provider value={props.config}>\n {props.children}\n </CerberusContext.Provider>\n )\n}\n\n/**\n * Returns the Cerberus configuration context.\n * @returns The Cerberus configuration context.\n */\nexport function useCerberusContext() {\n const context = useContext(CerberusContext)\n if (!context) {\n throw new Error('useCerberus must be used within a CerberusProvider')\n }\n return context\n}\n","'use client'\n\nimport type { HTMLAttributes } from 'react'\nimport { cx } from '@cerberus/styled-system/css'\nimport {\n fieldMessage,\n type FieldMessageVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport { useFieldContext } from '../context/field'\n\n/**\n * This module contains the FieldMessage component.\n * @module\n */\nexport interface FieldMessageBaseProps\n extends HTMLAttributes<HTMLParagraphElement> {\n /**\n * The id of the FieldMessage element describing the field. Required for accessibility. It is considered best practice to use the `help` or `error` prefix to help screen readers identify the type of message.\n *\n * @example For help messages: `help:field_id`\n * @example For error messages: `error:field_id`\n */\n id: string\n}\nexport type FieldMessageProps = FieldMessageBaseProps & FieldMessageVariantProps\n\n/**\n * A component that provides feedback about the field.\n * @see 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","import { cx } from '@cerberus/styled-system/css'\nimport {\n progressBar,\n type ProgressBarVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport type { HTMLAttributes } from 'react'\n\n/**\n * This module contains the ProgressBar component.\n * @module\n */\n\nexport type ProgressBarBaseProps = HTMLAttributes<HTMLDivElement>\nexport type NonIndeterminateProgressBarProps = {\n /**\n * A unique identifier for the progress bar. Required for accessibility.\n */\n id: string\n /**\n * A description label for the progress bar. Required for accessibility.\n */\n label: string\n /**\n * The state of the progress bar.\n */\n indeterminate?: never\n /**\n * The current value of the progress bar.\n */\n now: number\n}\nexport type IndeterminateProgressBarProps = {\n /**\n * A unique identifier for the progress bar. Required for accessibility.\n */\n id: string\n /**\n * A description label for the progress bar. Required for accessibility.\n */\n label: string\n /**\n * The state of the progress bar.\n */\n indeterminate?: true\n /**\n * The current value of the progress bar.\n */\n now?: never\n}\nexport type ProgressBarProps = ProgressBarBaseProps &\n ProgressBarVariantProps &\n (NonIndeterminateProgressBarProps | IndeterminateProgressBarProps)\n\n/**\n * The ProgressBar component is used to display the progress of a task.\n * @see https://cerberus.digitalu.design/react/progress-indicators\n * @example\n * ```tsx\n * <ProgressBar value={75} />\n * ```\n */\nexport function ProgressBar(props: ProgressBarProps) {\n const { indeterminate, size, usage, now, label, ...nativeProps } = props\n const styles = progressBar({ size, usage })\n const nowClamped = Math.min(100, Math.max(0, now || 0))\n const width = {\n width: indeterminate ? '50%' : `${nowClamped}%`,\n }\n\n return (\n <div\n {...nativeProps}\n aria-label={label}\n aria-valuemin={0}\n aria-valuemax={100}\n aria-valuenow={indeterminate ? 0 : nowClamped}\n className={cx(nativeProps.className, styles.root)}\n role=\"progressbar\"\n >\n <div\n {...(indeterminate && { 'data-indeterminate': true })}\n data-complete={nowClamped === 100}\n className={styles.bar}\n style={width}\n />\n </div>\n )\n}\n","import type { ButtonHTMLAttributes } from 'react'\nimport { cx } from '@cerberus/styled-system/css'\nimport {\n iconButton,\n type IconButtonVariantProps,\n} from '@cerberus/styled-system/recipes'\n\n/**\n * This module contains the Icon Button component.\n * @module\n */\n\nexport interface IconButtonRawProps\n extends ButtonHTMLAttributes<HTMLButtonElement> {\n /**\n * The aria-label attribute for the icon button.\n */\n ariaLabel: string\n}\nexport type IconButtonProps = IconButtonRawProps & IconButtonVariantProps\n\n/**\n * A component that allows the user to perform actions using an icon\n * @see https://cerberus.digitalu.design/react/icon-button\n */\nexport function IconButton(props: IconButtonProps): JSX.Element {\n const { ariaLabel, palette, usage, size, ...nativeProps } = props\n return (\n <button\n {...nativeProps}\n aria-label={ariaLabel ?? 'Icon Button'}\n className={cx(\n nativeProps.className,\n iconButton({\n palette,\n usage,\n size,\n }),\n )}\n />\n )\n}\n","'use client'\n\nimport { css, cx } from '@cerberus/styled-system/css'\nimport { circle } from '@cerberus/styled-system/patterns'\nimport {\n avatar,\n type AvatarVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport type { HtmlHTMLAttributes, ReactNode } from 'react'\nimport { Show } from './Show'\nimport { useCerberusContext } from '../context/cerberus'\n\n/**\n * This module contains the Avatar component.\n * @module\n */\n\nexport type SharedAvatarProps = {\n /**\n * An optional icon to show when no src or ariaLabel is provided.\n */\n icon?: ReactNode\n /**\n * The size of the avatar.\n */\n width?: number\n /**\n * The size of the avatar.\n */\n height?: number\n}\nexport type AvatarImageProps = HtmlHTMLAttributes<HTMLImageElement> &\n SharedAvatarProps & {\n /**\n * The aria-label for the avatar needed for accessibility.\n */\n ariaLabel: string\n /**\n * An optional element to replace the image. Recommended for Next.js Image component.\n */\n as?: never\n /**\n * The source of the image.\n */\n src: string\n }\nexport type AvatarAsProps = SharedAvatarProps & {\n /**\n * An optional element to replace the image. Recommended for Next.js Image component.\n */\n as: ReactNode\n /**\n * The aria-label for the avatar needed for accessibility.\n */\n ariaLabel?: never\n /**\n * The source of the image.\n */\n src?: never\n}\n\nexport type AvatarProps = (HtmlHTMLAttributes<HTMLDivElement> &\n AvatarVariantProps) &\n (AvatarImageProps | AvatarAsProps)\n\n/**\n * The Avatar component is used to represent a user or entity. It will show an image if src provided, otherwise it will show the ariaLabel of the ariaLabel. If the ariaLabel is empty, it will show a `defineIcons().avatar` icon.\n * @see https://cerberus.digitalu.design/react/avatar\n * @example\n * ```tsx\n * <Avatar\n * ariaLabel=\"Protector Cerberus\"\n * src=\"https://cerberus.digitalu.design/logo.svg\"\n * />\n * ```\n */\nexport function Avatar(props: AvatarProps) {\n const {\n ariaLabel,\n as,\n gradient,\n size,\n src,\n width,\n height,\n icon,\n ...nativeProps\n } = props\n const { icons } = useCerberusContext()\n const { avatar: AvatarIcon } = icons\n const initials = (ariaLabel || '')\n .split(' ')\n .map((word) => word[0])\n .join('')\n .slice(0, 2)\n\n return (\n <div\n {...nativeProps}\n className={cx(\n nativeProps.className,\n avatar({ gradient, size }),\n circle(),\n )}\n >\n <Show\n when={Boolean(src) || Boolean(as)}\n fallback={\n <Show\n when={Boolean(initials)}\n fallback={\n <Show\n when={Boolean(icon)}\n fallback={\n <AvatarIcon\n size={iconSizeMap[size as keyof typeof iconSizeMap]}\n />\n }\n >\n {icon}\n </Show>\n }\n >\n {initials}\n </Show>\n }\n >\n <Show\n when={Boolean(as)}\n fallback={\n <img\n alt={props.ariaLabel}\n className={css({\n h: 'full',\n objectFit: 'cover',\n w: 'full',\n })}\n decoding=\"async\"\n loading=\"lazy\"\n src={src}\n height={height}\n width={width}\n />\n }\n >\n {as}\n </Show>\n </Show>\n </div>\n )\n}\n\nconst iconSizeMap = {\n xs: 16,\n sm: 16,\n md: 20,\n lg: 34,\n xl: 32,\n '2xl': 32,\n '3xl': 32,\n '4xl': 32,\n}\n","'use client'\n\nimport { useMemo, type PropsWithChildren, type ReactNode } from 'react'\n\n/**\n * This module contains the Show component.\n * @module\n */\n\nexport interface ShowProps {\n /**\n * The condition to render memoized children or the fallback content.\n */\n when: boolean | null | undefined\n /**\n * The children to render when the condition is false.\n */\n fallback?: ReactNode\n}\n\n/**\n * Conditionally render a memoized version of the children or optional fallback\n * content.\n * @see https://cerberus.digitalu.design/react/show\n * @example\n * ```tsx\n * <Show when={isLoggedIn} fallback={<Navigate to=\"/login\" />}>\n * <Dashboard />\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;AAAA;AAEA,IAAAA,gBAKO;AACP,IAAAC,kBAGO;AACP,IAAAC,cAAwB;AACxB,IAAAC,mBAA+B;;;ACX/B,mBAKO;AA+CH;AApBJ,IAAM,mBAAe,4BAAwC,IAAI;AAM1D,SAAS,MACd,OACa;AACb,QAAM,YAAQ;AAAA,IACZ,OAAO;AAAA,MACL,UAAU,MAAM;AAAA,MAChB,UAAU,MAAM;AAAA,MAChB,UAAU,MAAM;AAAA,MAChB,SAAS,MAAM;AAAA,IACjB;AAAA,IACA,CAAC,MAAM,UAA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A,IACT;AACE,aAAO;AAAA,EACX;AACF;","names":["import_react","import_recipes","import_css","import_patterns","import_react","import_jsx_runtime","import_jsx_runtime","import_css","import_recipes","import_jsx_runtime","import_css","import_recipes","import_jsx_runtime","import_css","import_recipes","import_react","import_jsx_runtime","import_jsx_runtime","processStatus"]}
1
+ {"version":3,"sources":["../../../src/components/FileStatus.tsx","../../../src/context/cerberus.tsx","../../../src/components/ProgressBar.tsx","../../../src/components/IconButton.tsx","../../../src/components/Avatar.tsx","../../../src/components/Show.tsx","../../../src/utils/index.ts","../../../src/components/field/primitives.tsx","../../../src/components/field/field.tsx"],"sourcesContent":["'use client'\n\nimport {\n useCallback,\n useMemo,\n type HTMLAttributes,\n type MouseEvent,\n} from 'react'\nimport {\n fileStatus,\n type FileStatusVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport { css, cx } from '@cerberus/styled-system/css'\nimport { hstack, vstack } from '@cerberus/styled-system/patterns'\nimport { useCerberusContext } from '../context/cerberus'\nimport { ProgressBar, type ProgressBarProps } from './ProgressBar'\nimport { IconButton } from './IconButton'\nimport { Avatar } from './Avatar'\nimport { Field, FieldHelperText } from './field/index'\n\n/**\n * This module contains the FileStatus component.\n * @module\n */\n\n/**\n * The available values of the fileStatus helper Object.\n * @example\n * ```tsx\n * import { fileStatus } from '@cerberus/react'\n * processStatus.TODO // 'todo'\n * ```\n */\nexport type FileStatusKey = (typeof processStatus)[keyof typeof processStatus]\n\n/**\n * The actions that can be performed on a file.\n */\nexport type FileStatusActions = 'cancel' | 'retry' | 'delete'\nexport interface FileBaseStatusProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'onClick'> {\n /**\n * A unique identifier for the file status. Required for accessibility.\n */\n id: string\n /**\n * The name of the file.\n */\n file: string\n /**\n * The percentage of the file that has been processed.\n */\n now: ProgressBarProps['now']\n /**\n * The status of the file.\n */\n status: processStatus\n /**\n * The action to perform on the file when a user clicks the\n * button located at the end of the status card.\n * @param status - The status of the file.\n * @param e - The event object.\n * @example\n * ```tsx\n * <FileStatus file=\"file.txt\" now={0} status={processStatus.TODO} action={(status, e) => console.log(status, e)} />\n * ```\n * @default () => {}\n */\n onClick: (status: FileStatusActions, e: MouseEvent<HTMLButtonElement>) => void\n}\nexport type FileStatusProps = FileBaseStatusProps & FileStatusVariantProps\n\n/**\n * A helper object to represent the status of a file.\n * @example\n * ```tsx\n * import { fileStatus } from '@cerberus/react'\n * processStatus.TODO // 'todo'\n * ```\n */\nexport const enum processStatus {\n TODO = 'todo',\n PROCESSING = 'processing',\n DONE = 'done',\n ERROR = 'error',\n}\n\n/**\n * A component that displays the status of a file during file processing.\n * @see https://cerberus.digitalu.design/react/file-uploader\n * @example\n * ```tsx\n * <FileStatus file=\"file.txt\" now={0} status={processStatus.TODO} action={(status, e) => console.log(status, e)} />\n * ```\n */\nexport function FileStatus(props: FileStatusProps) {\n const { file, now, status, onClick, ...nativeProps } = props\n const actionLabel = useMemo(() => getStatusActionLabel(status), [status])\n const palette = useMemo(() => getPalette(status), [status])\n const modalIconPalette = useMemo(() => getModalIconPalette(status), [status])\n const styles = useMemo(() => {\n switch (status) {\n case processStatus.TODO:\n return fileStatus({ status: 'todo' })\n case processStatus.PROCESSING:\n return fileStatus({ status: 'processing' })\n case processStatus.DONE:\n return fileStatus({ status: 'done' })\n case processStatus.ERROR:\n return fileStatus({ status: 'error' })\n default:\n return fileStatus()\n }\n }, [status])\n\n const handleClick = useCallback(\n (e: MouseEvent<HTMLButtonElement>) => {\n const actionStatus = getStatusActionLabel(\n status,\n ).toLocaleLowerCase() as FileStatusActions\n onClick(actionStatus, e)\n },\n [onClick],\n )\n\n return (\n <div\n {...nativeProps}\n className={cx(nativeProps.className, styles.root, hstack())}\n >\n <Avatar\n ariaLabel=\"\"\n gradient={modalIconPalette}\n icon={<MatchFileStatusIcon size={24} status={status} />}\n src=\"\"\n />\n\n <div\n className={vstack({\n alignItems: 'flex-start',\n gap: '0.12rem',\n w: 'full',\n })}\n >\n <small\n className={css({\n color: 'page.text.initial',\n textStyle: 'label-sm',\n })}\n >\n {file}\n </small>\n <ProgressBar\n id={props.id}\n label=\"File upload status\"\n now={now}\n size=\"sm\"\n />\n <Field label=\"\" invalid={modalIconPalette === 'hades-dark'}>\n <FieldHelperText\n className={css({\n color: 'page.text.100',\n })}\n id={`help:${file}`}\n >\n <MatchFileStatusText status={status} now={now} />\n </FieldHelperText>\n </Field>\n </div>\n\n <IconButton\n ariaLabel={actionLabel}\n onClick={handleClick}\n palette={palette}\n size=\"sm\"\n >\n <MatchStatusAction status={status} />\n </IconButton>\n </div>\n )\n}\n\ninterface FileStatusElProps {\n status: FileStatusProps['status']\n size?: 16 | 20 | 24 | 32\n now?: number\n}\n\nfunction MatchFileStatusIcon(props: FileStatusElProps) {\n const { icons } = useCerberusContext()\n const {\n waitingFileUploader: TodoIcon,\n fileUploader: FileUploaderIcon,\n invalidAlt: InvalidIcon,\n successNotification: DoneIcon,\n } = icons\n\n switch (props.status) {\n case processStatus.TODO:\n return <TodoIcon size={props.size} />\n case processStatus.PROCESSING:\n return <FileUploaderIcon size={props.size} />\n case processStatus.DONE:\n return <DoneIcon size={props.size} />\n case processStatus.ERROR:\n return <InvalidIcon size={props.size} />\n default:\n throw new Error('Unknown status')\n }\n}\n\nfunction MatchFileStatusText(props: FileStatusElProps) {\n switch (props.status) {\n case processStatus.TODO:\n return 'Waiting to upload'\n case processStatus.PROCESSING:\n return `${props.now}% Complete`\n case processStatus.DONE:\n return 'File uploaded successfully'\n case processStatus.ERROR:\n return 'There was an error uploading the file'\n default:\n throw new Error('Invalid status')\n }\n}\n\nfunction MatchStatusAction(props: FileStatusElProps) {\n const { icons } = useCerberusContext()\n const { close: CloseIcon, redo: RedoIcon, delete: TrashIcon } = icons\n switch (props.status) {\n case processStatus.TODO:\n case processStatus.PROCESSING:\n return <CloseIcon />\n case processStatus.ERROR:\n return <RedoIcon />\n case processStatus.DONE:\n return <TrashIcon />\n default:\n throw new Error('Invalid status')\n }\n}\n\nfunction getStatusActionLabel(status: FileStatusKey) {\n switch (status) {\n case processStatus.TODO:\n case processStatus.PROCESSING:\n return 'Cancel'\n case processStatus.ERROR:\n return 'Retry'\n case processStatus.DONE:\n return 'Delete'\n default:\n return ''\n }\n}\n\nfunction getPalette(status: FileStatusKey) {\n switch (status) {\n case processStatus.TODO:\n case processStatus.PROCESSING:\n return 'danger'\n case processStatus.ERROR:\n return 'action'\n case processStatus.DONE:\n return 'danger'\n default:\n return 'action'\n }\n}\n\nfunction getModalIconPalette(status: FileStatusKey) {\n switch (status) {\n case processStatus.TODO:\n case processStatus.PROCESSING:\n return 'charon-light'\n case processStatus.ERROR:\n return 'hades-dark'\n case processStatus.DONE:\n return 'thanatos-light'\n default:\n return 'charon-light'\n }\n}\n","'use client'\n\nimport { createContext, useContext, type PropsWithChildren } from 'react'\nimport type { SystemConfig } from '../config'\n\n/**\n * This module contains the Cerberus configuration context and helpers.\n * @module context/cerberus\n */\n\ntype CerberusContextValue = SystemConfig\n\nconst CerberusContext = createContext<CerberusContextValue | null>(null)\n\ninterface CerberusProviderProps {\n config: SystemConfig\n}\n\n/**\n * Cerberus configuration provider.\n * @param props.config The Cerberus configuration created with\n * `makeSystemConfig` helper.\n */\nexport function CerberusProvider(\n props: PropsWithChildren<CerberusProviderProps>,\n) {\n return (\n <CerberusContext.Provider value={props.config}>\n {props.children}\n </CerberusContext.Provider>\n )\n}\n\n/**\n * Returns the Cerberus configuration context.\n * @returns The Cerberus configuration context.\n */\nexport function useCerberusContext() {\n const context = useContext(CerberusContext)\n if (!context) {\n throw new Error('useCerberus must be used within a CerberusProvider')\n }\n return context\n}\n","import { cx } from '@cerberus/styled-system/css'\nimport {\n progressBar,\n type ProgressBarVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport type { HTMLAttributes } from 'react'\n\n/**\n * This module contains the ProgressBar component.\n * @module\n */\n\nexport type ProgressBarBaseProps = HTMLAttributes<HTMLDivElement>\nexport type NonIndeterminateProgressBarProps = {\n /**\n * A unique identifier for the progress bar. Required for accessibility.\n */\n id: string\n /**\n * A description label for the progress bar. Required for accessibility.\n */\n label: string\n /**\n * The state of the progress bar.\n */\n indeterminate?: never\n /**\n * The current value of the progress bar.\n */\n now: number\n}\nexport type IndeterminateProgressBarProps = {\n /**\n * A unique identifier for the progress bar. Required for accessibility.\n */\n id: string\n /**\n * A description label for the progress bar. Required for accessibility.\n */\n label: string\n /**\n * The state of the progress bar.\n */\n indeterminate?: true\n /**\n * The current value of the progress bar.\n */\n now?: never\n}\nexport type ProgressBarProps = ProgressBarBaseProps &\n ProgressBarVariantProps &\n (NonIndeterminateProgressBarProps | IndeterminateProgressBarProps)\n\n/**\n * The ProgressBar component is used to display the progress of a task.\n * @see https://cerberus.digitalu.design/react/progress-indicators\n * @example\n * ```tsx\n * <ProgressBar value={75} />\n * ```\n */\nexport function ProgressBar(props: ProgressBarProps) {\n const { indeterminate, size, usage, now, label, ...nativeProps } = props\n const styles = progressBar({ size, usage })\n const nowClamped = Math.min(100, Math.max(0, now || 0))\n const width = {\n width: indeterminate ? '50%' : `${nowClamped}%`,\n }\n\n return (\n <div\n {...nativeProps}\n aria-label={label}\n aria-valuemin={0}\n aria-valuemax={100}\n aria-valuenow={indeterminate ? 0 : nowClamped}\n className={cx(nativeProps.className, styles.root)}\n role=\"progressbar\"\n >\n <div\n {...(indeterminate && { 'data-indeterminate': true })}\n data-complete={nowClamped === 100}\n className={styles.bar}\n style={width}\n />\n </div>\n )\n}\n","import type { ButtonHTMLAttributes } from 'react'\nimport { cx } from '@cerberus/styled-system/css'\nimport {\n iconButton,\n type IconButtonVariantProps,\n} from '@cerberus/styled-system/recipes'\n\n/**\n * This module contains the Icon Button component.\n * @module\n */\n\nexport interface IconButtonRawProps\n extends ButtonHTMLAttributes<HTMLButtonElement> {\n /**\n * The aria-label attribute for the icon button.\n */\n ariaLabel: string\n}\nexport type IconButtonProps = IconButtonRawProps & IconButtonVariantProps\n\n/**\n * A component that allows the user to perform actions using an icon\n * @see https://cerberus.digitalu.design/react/icon-button\n */\nexport function IconButton(props: IconButtonProps): JSX.Element {\n const { ariaLabel, palette, usage, size, ...nativeProps } = props\n return (\n <button\n {...nativeProps}\n aria-label={ariaLabel ?? 'Icon Button'}\n className={cx(\n nativeProps.className,\n iconButton({\n palette,\n usage,\n size,\n }),\n )}\n />\n )\n}\n","'use client'\n\nimport { css, cx } from '@cerberus/styled-system/css'\nimport { circle } from '@cerberus/styled-system/patterns'\nimport {\n avatar,\n type AvatarVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport type { HtmlHTMLAttributes, ReactNode } from 'react'\nimport { Show } from './Show'\nimport { useCerberusContext } from '../context/cerberus'\n\n/**\n * This module contains the Avatar component.\n * @module\n */\n\nexport type SharedAvatarProps = {\n /**\n * An optional icon to show when no src or ariaLabel is provided.\n */\n icon?: ReactNode\n /**\n * The size of the avatar.\n */\n width?: number\n /**\n * The size of the avatar.\n */\n height?: number\n}\nexport type AvatarImageProps = HtmlHTMLAttributes<HTMLImageElement> &\n SharedAvatarProps & {\n /**\n * The aria-label for the avatar needed for accessibility.\n */\n ariaLabel: string\n /**\n * An optional element to replace the image. Recommended for Next.js Image component.\n */\n as?: never\n /**\n * The source of the image.\n */\n src: string\n }\nexport type AvatarAsProps = SharedAvatarProps & {\n /**\n * An optional element to replace the image. Recommended for Next.js Image component.\n */\n as: ReactNode\n /**\n * The aria-label for the avatar needed for accessibility.\n */\n ariaLabel?: never\n /**\n * The source of the image.\n */\n src?: never\n}\n\nexport type AvatarProps = (HtmlHTMLAttributes<HTMLDivElement> &\n AvatarVariantProps) &\n (AvatarImageProps | AvatarAsProps)\n\n/**\n * The Avatar component is used to represent a user or entity. It will show an image if src provided, otherwise it will show the ariaLabel of the ariaLabel. If the ariaLabel is empty, it will show a `defineIcons().avatar` icon.\n * @see https://cerberus.digitalu.design/react/avatar\n * @example\n * ```tsx\n * <Avatar\n * ariaLabel=\"Protector Cerberus\"\n * src=\"https://cerberus.digitalu.design/logo.svg\"\n * />\n * ```\n */\nexport function Avatar(props: AvatarProps) {\n const {\n ariaLabel,\n as,\n gradient,\n size,\n src,\n width,\n height,\n icon,\n ...nativeProps\n } = props\n const { icons } = useCerberusContext()\n const { avatar: AvatarIcon } = icons\n const initials = (ariaLabel || '')\n .split(' ')\n .map((word) => word[0])\n .join('')\n .slice(0, 2)\n\n return (\n <div\n {...nativeProps}\n className={cx(\n nativeProps.className,\n avatar({ gradient, size }),\n circle(),\n )}\n >\n <Show\n when={Boolean(src) || Boolean(as)}\n fallback={\n <Show\n when={Boolean(initials)}\n fallback={\n <Show\n when={Boolean(icon)}\n fallback={\n <AvatarIcon\n size={iconSizeMap[size as keyof typeof iconSizeMap]}\n />\n }\n >\n {icon}\n </Show>\n }\n >\n {initials}\n </Show>\n }\n >\n <Show\n when={Boolean(as)}\n fallback={\n <img\n alt={props.ariaLabel}\n className={css({\n h: 'full',\n objectFit: 'cover',\n w: 'full',\n })}\n decoding=\"async\"\n loading=\"lazy\"\n src={src}\n height={height}\n width={width}\n />\n }\n >\n {as}\n </Show>\n </Show>\n </div>\n )\n}\n\nconst iconSizeMap = {\n xs: 16,\n sm: 16,\n md: 20,\n lg: 34,\n xl: 32,\n '2xl': 32,\n '3xl': 32,\n '4xl': 32,\n}\n","'use client'\n\nimport { useMemo, type PropsWithChildren, type ReactNode } from 'react'\n\n/**\n * This module contains the Show component.\n * @module\n */\n\nexport interface ShowProps {\n /**\n * The condition to render memoized children or the fallback content.\n */\n when: boolean | null | undefined\n /**\n * The children to render when the condition is false.\n */\n fallback?: ReactNode\n}\n\n/**\n * Conditionally render a memoized version of the children or optional fallback\n * content.\n * @see https://cerberus.digitalu.design/react/show\n * @example\n * ```tsx\n * <Show when={isLoggedIn} fallback={<Navigate to=\"/login\" />}>\n * <Dashboard />\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","/**\n * This module contains utility functions that are used across your app.\n * @module Utils\n */\n\n/**\n * Formats the count of notifications to be displayed in the notification badge.\n * @param count - The number of notifications.\n * @returns The formatted count of notifications.\n * @example\n * ```tsx\n * const count = formatNotifyCount(100)\n * console.log(count) // '99+'\n * ```\n */\nexport function formatNotifyCount(count: number): string {\n if (count > 99) return '99+'\n return count.toString()\n}\n\n/**\n * Splits the properties of an object into multiple groups based on lists of keys.\n * @param props - The object to split.\n * @param keyGroups - The lists of keys to include in each group.\n * @returns An array of objects: each containing the properties specified in the corresponding key group, and the last object containing the remaining keys.\n */\nexport function splitProps<T extends object>(\n props: T,\n ...keyGroups: (keyof T)[][]\n): { [K in keyof T]?: T[K] }[] {\n const result = keyGroups.map(() => ({}) as { [K in keyof T]?: T[K] })\n const rest = {} as { [K in keyof T]?: T[K] }\n\n for (const key in props) {\n let assigned = false\n for (let i = 0; i < keyGroups.length; i++) {\n if (keyGroups[i].includes(key as keyof T)) {\n result[i][key as keyof T] = props[key]\n assigned = true\n break\n }\n }\n if (!assigned) {\n rest[key as keyof T] = props[key]\n }\n }\n\n return [...result, rest]\n}\n\nexport * from './localStorage'\n","import {\n Field,\n type FieldHelperTextProps,\n type FieldInputProps as ArkFieldInputProps,\n type FieldLabelProps,\n type FieldRootProps as ArkFieldRootProps,\n type FieldTextareaProps,\n} from '@ark-ui/react/field'\nimport type { ReactNode } from 'react'\nimport { cx } from '@cerberus/styled-system/css'\nimport { field, type FieldVariantProps } from '@cerberus/styled-system/recipes'\nimport { FieldStatusIndicator } from './status-indicator'\nimport { FieldStartIndicator } from './start-indicator'\n\n/**\n * This module contains all the primitives of the Field component.\n * @module 'field'\n */\n\nexport type FieldRootProps = ArkFieldRootProps & FieldVariantProps\n\n/**\n * The context & container for the Field components.\n * @description [Field Docs](https://cerberus.digitalu.design/react/field)\n * @example\n * ```tsx\n * <FieldRoot required ids={{ input: 'exampleId' }}>\n * <FieldLabel>Label</FieldLabel>\n * <FieldInput />\n * </FieldRoot>\n * ```\n */\nexport function FieldRoot(props: FieldRootProps) {\n const { size, ...fieldProps } = props\n const styles = field({ size })\n return (\n <Field.Root\n {...fieldProps}\n className={cx(styles.root, fieldProps.className)}\n />\n )\n}\n\n/**\n * The label for the Field component.\n * @description [Field Docs](https://cerberus.digitalu.design/react/field)\n * @example\n * ```tsx\n * <FieldRoot>\n * <FieldLabel>Label</FieldLabel>\n * </FieldRoot>\n * ```\n */\nexport function FieldLabel(props: FieldLabelProps) {\n const { children, ...nativeProps } = props\n const styles = field()\n return (\n <Field.Label {...nativeProps} className={cx(styles.label, props.className)}>\n {children}\n <Field.RequiredIndicator>(required)</Field.RequiredIndicator>\n </Field.Label>\n )\n}\n\n/**\n * The required indicator for the Field component.\n */\nexport function FieldRequiredIndicator() {\n return <Field.RequiredIndicator>(required)</Field.RequiredIndicator>\n}\n\nexport interface FieldInputProps\n extends Omit<ArkFieldInputProps, 'size'>,\n FieldVariantProps {\n /**\n * An optional icon to display at the start of the input.\n */\n startIcon?: ReactNode\n /**\n * An optional icon to display at the end of the input.\n */\n endIcon?: ReactNode\n}\n\n/**\n * The input for the Field component.\n * @description [Field Docs](https://cerberus.digitalu.design/react/field)\n * @example\n * ```tsx\n * <FieldRoot>\n * <FieldInput />\n * </FieldRoot>\n * ```\n */\nexport function FieldInput(props: FieldInputProps) {\n const { size, startIcon, endIcon, ...fieldProps } = props\n const styles = field({ size })\n const hasStartIcon = Boolean(startIcon)\n\n return (\n <div className={styles.inputRoot}>\n <FieldStartIndicator>{startIcon}</FieldStartIndicator>\n <Field.Input\n {...fieldProps}\n {...(hasStartIcon && { 'data-has': 'start-indicator' })}\n className={cx(styles.input, fieldProps.className)}\n />\n <FieldStatusIndicator fallback={endIcon} />\n </div>\n )\n}\n\n/**\n * The helper text for the Field component that is shown when the field is\n * valid.\n * @description [Field Docs](https://cerberus.digitalu.design/react/field)\n * @example\n * ```tsx\n * <FieldRoot>\n * <FieldInput />\n * <FieldHelperText>Helper text</FieldHelperText>\n * </FieldRoot>\n * ```\n */\nexport function FieldHelperText(props: FieldHelperTextProps) {\n const styles = field()\n\n if (!props.children) return null\n\n return (\n <Field.HelperText\n {...props}\n className={cx(styles.helperText, props.className)}\n />\n )\n}\n\n/**\n * The error text for the Field component that is shown when the field is\n * invalid.\n * @description [Field Docs](https://cerberus.digitalu.design/react/field)\n * @example\n * ```tsx\n * <FieldRoot>\n * <FieldInput />\n * <FieldErrorText>Error text</FieldErrorText>\n * </FieldRoot>\n * ```\n */\nexport function FieldErrorText(props: FieldHelperTextProps) {\n const styles = field()\n\n if (!props.children) return null\n\n return (\n <Field.ErrorText\n {...props}\n className={cx(styles.errorText, props.className)}\n />\n )\n}\n\n/**\n * The textarea for the Field component.\n * @description [Field Docs](https://cerberus.digitalu.design/react/field)\n * @example\n * ```tsx\n * <FieldRoot>\n * <FieldTextarea />\n * </FieldRoot>\n * ```\n */\nexport function FieldTextarea(props: FieldTextareaProps) {\n const styles = field()\n return (\n <Field.Textarea\n {...props}\n className={cx(styles.textarea, props.className)}\n />\n )\n}\n\n/**\n * A named export for the FieldInput component.\n * @description [Field Docs](https://cerberus.digitalu.design/react/field)\n * @example\n * ```tsx\n * import { Input } from '@cerberus/react'\n *\n * <Field\n * ids={{\n * control: 'email',\n * }}\n * label=\"Enter your email\"\n * helperText=\"We'll never share your email with anyone else.\"\n * errorText=\"Email is required.\"\n * required\n * >\n * <Input type=\"email\" />\n * </Field>\n * ```\n */\nexport const Input = FieldInput\nexport const Textarea = FieldTextarea\n","import { type FieldRootProps } from '@ark-ui/react/field'\nimport { splitProps } from '../../utils/index'\nimport {\n FieldErrorText,\n FieldHelperText,\n FieldLabel,\n FieldRoot,\n} from './primitives'\nimport { HStack } from '@cerberus/styled-system/jsx'\nimport { Show } from '../Show'\n\nexport interface FieldProps extends FieldRootProps {\n /**\n * The label of the field.\n */\n label?: string\n /**\n * The helper text of the field.\n */\n helperText?: string\n /**\n * A helper text positioned at the end of the field. Good for Textarea fields.\n */\n secondaryHelperText?: string\n /**\n * The error text of the field. Shown when the field is invalid.\n */\n errorText?: string\n}\n\n/**\n * The Field component is the context provider for all FieldParts and displays\n * the label, helperText, and ErrorText.\n * @description [Field Docs](https://cerberus.digitalu.design/react/field)\n * @example\n * ```tsx\n * <Field\n * ids={{\n * control: 'firstName',\n * }}\n * label=\"Label\"\n * helperText=\"This is what people will see on your profile.\"\n * errorText=\"A first name is required to create an account.\"\n * required\n * >\n * <Input name=\"firstName\" type=\"text\" />\n * </Field>\n * ```\n */\nexport function Field(props: FieldProps) {\n const [statusProps, fieldProps, rootProps] = splitProps(\n props,\n ['disabled', 'required', 'readOnly', 'invalid'],\n ['label', 'helperText', 'secondaryHelperText', 'errorText', 'children'],\n )\n\n return (\n <FieldRoot {...statusProps} {...rootProps}>\n <Show when={Boolean(fieldProps.label)}>\n <FieldLabel>{fieldProps.label}</FieldLabel>\n </Show>\n\n {fieldProps.children}\n\n <Show when={Boolean(fieldProps.helperText && !statusProps.invalid)}>\n <HStack justifyContent=\"space-between\" w=\"full\">\n <FieldHelperText>{fieldProps.helperText}</FieldHelperText>\n <Show when={Boolean(fieldProps.secondaryHelperText)}>\n <FieldHelperText>{fieldProps.secondaryHelperText}</FieldHelperText>\n </Show>\n </HStack>\n </Show>\n\n <FieldErrorText>{fieldProps.errorText}</FieldErrorText>\n </FieldRoot>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,IAAAA,gBAKO;AACP,IAAAC,kBAGO;AACP,IAAAC,cAAwB;AACxB,IAAAC,mBAA+B;;;ACX/B,mBAAkE;AAyB9D;AAfJ,IAAM,sBAAkB,4BAA2C,IAAI;AAyBhE,SAAS,qBAAqB;AACnC,QAAM,cAAU,yBAAW,eAAe;AAC1C,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,oDAAoD;AAAA,EACtE;AACA,SAAO;AACT;;;AC3CA,iBAAmB;AACnB,qBAGO;AA2ED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AO;AAAA,EACX;AACF;AAEA,SAAS,oBAAoB,QAAuB;AAClD,UAAQ,QAAQ;AAAA,IACd,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;","names":["import_react","import_recipes","import_css","import_patterns","import_jsx_runtime","import_css","import_recipes","import_jsx_runtime","import_css","import_recipes","import_react","import_jsx_runtime","import_css","import_recipes","import_jsx_runtime","import_jsx_runtime","Field","import_jsx_runtime","processStatus","Field"]}
@@ -25,42 +25,30 @@ __export(Legend_exports, {
25
25
  });
26
26
  module.exports = __toCommonJS(Legend_exports);
27
27
  var import_css = require("@cerberus/styled-system/css");
28
-
29
- // src/context/field.tsx
30
- var import_react = require("react");
31
- var import_jsx_runtime = require("react/jsx-runtime");
32
- var FieldContext = (0, import_react.createContext)(null);
33
- function useFieldContext() {
34
- const context = (0, import_react.useContext)(FieldContext);
35
- if (!context) {
36
- throw new Error("useFieldContext must be used within a Field Provider.");
37
- }
38
- return context;
39
- }
28
+ var import_recipes = require("@cerberus/styled-system/recipes");
29
+ var import_patterns = require("@cerberus/styled-system/patterns");
40
30
 
41
31
  // src/components/Show.tsx
42
- var import_react2 = require("react");
32
+ var import_react = require("react");
43
33
  function Show(props) {
44
34
  const { when, children, fallback } = props;
45
- const condition = (0, import_react2.useMemo)(() => when ?? false, [when]);
46
- return (0, import_react2.useMemo)(() => {
35
+ const condition = (0, import_react.useMemo)(() => when ?? false, [when]);
36
+ return (0, import_react.useMemo)(() => {
47
37
  if (condition) return children;
48
38
  return fallback ?? null;
49
39
  }, [condition, children, fallback]);
50
40
  }
51
41
 
52
42
  // src/components/Legend.tsx
53
- var import_recipes = require("@cerberus/styled-system/recipes");
54
- var import_patterns = require("@cerberus/styled-system/patterns");
55
- var import_jsx_runtime2 = require("react/jsx-runtime");
43
+ var import_field = require("@ark-ui/react/field");
44
+ var import_jsx_runtime = require("react/jsx-runtime");
56
45
  function Legend(props) {
57
46
  const { size, ...nativeProps } = props;
58
- const { invalid, ...formState } = useFieldContext();
59
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
47
+ const { invalid, required } = (0, import_field.useFieldContext)();
48
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
60
49
  "legend",
61
50
  {
62
51
  ...nativeProps,
63
- ...formState,
64
52
  ...invalid && { "aria-invalid": true },
65
53
  className: (0, import_css.cx)(
66
54
  nativeProps.className,
@@ -74,7 +62,7 @@ function Legend(props) {
74
62
  ),
75
63
  children: [
76
64
  nativeProps.children,
77
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Show, { when: formState.required, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
65
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Show, { when: required, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
78
66
  "span",
79
67
  {
80
68
  className: (0, import_css.css)({
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Legend.tsx","../../../src/context/field.tsx","../../../src/components/Show.tsx"],"sourcesContent":["'use client'\n\nimport { css, cx } from '@cerberus/styled-system/css'\nimport { type HTMLAttributes } from 'react'\nimport { useFieldContext } from '../context/field'\nimport { Show } from './Show'\nimport { label, type LabelVariantProps } from '@cerberus/styled-system/recipes'\nimport { hstack } from '@cerberus/styled-system/patterns'\n\n/**\n * This module contains the Fieldset component.\n * @module Fieldset\n */\n\nexport type LegendProps = HTMLAttributes<HTMLLegendElement> & LabelVariantProps\n\n/**\n * A component to provide a global label for a group of related elements in a form (for accessibility).\n * @memberof Fieldset\n * @see https://cerberus.digitalu.com/react/fieldset\n * @description [A11y Form Checklist](https://www.a11yproject.com/checklist/#forms)\n * @description [MDN Web Docs: Legend](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/legend)\n * @example\n * ```tsx\n * import { Fieldset, Legend, Field, Radio, Label } from '@cerberus/react'\n * import { Hstack } from '@cerberus/styled-system/jsx'\n *\n * function SomeForm() {\n * return (\n * <form>\n * <Fieldset>\n * <Legend>Do you like cats?</Legend>\n * <Hstack>\n * <Field>\n * <Radio id=\"yes\" name=\"cats\" value=\"yes\" />\n * <Label htmlFor=\"yes\">Yes</Label>\n * </Field>\n * </Hstack>\n * <Hstack>\n * <Field>\n * <Radio id=\"no\" name=\"cats\" value=\"no\" />\n * <Label htmlFor=\"no\">No</Label>\n * </Field>\n * </Hstack>\n * </Fieldset>\n * </form>\n * )\n * }\n * ```\n */\nexport function Legend(props: LegendProps) {\n const { size, ...nativeProps } = props\n const { invalid, ...formState } = useFieldContext()\n\n return (\n <legend\n {...nativeProps}\n {...formState}\n {...(invalid && { 'aria-invalid': true })}\n className={cx(\n nativeProps.className,\n hstack({\n justify: 'space-between',\n w: 'full',\n }),\n label({\n size,\n }),\n )}\n >\n {nativeProps.children}\n <Show when={formState.required}>\n <span\n className={css({\n color: 'page.text.100',\n fontSize: 'inherit',\n })}\n >\n (required)\n </span>\n </Show>\n </legend>\n )\n}\n","'use client'\n\nimport {\n createContext,\n useContext,\n useMemo,\n type PropsWithChildren,\n} from 'react'\n\n/**\n * This module provides a context and hook for the field.\n * @module Field\n */\n\nexport interface FieldContextValue {\n /**\n * Whether the field is disabled.\n * @description [Moz Input Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attributes)\n */\n disabled?: boolean\n /**\n * Whether the field is read-only.\n */\n readOnly?: boolean\n /**\n * Whether the field is required.\n */\n required?: boolean\n /**\n * Whether the field is invalid.\n */\n invalid?: boolean\n}\n\nconst FieldContext = createContext<FieldContextValue | null>(null)\n\n/**\n * Provides the field state for a all related components used within a group.\n * @see https://cerberus.digitalu.design/react/input\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\n/**\n * Used to access the field context.\n * @returns The field context.\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","'use client'\n\nimport { useMemo, type PropsWithChildren, type ReactNode } from 'react'\n\n/**\n * This module contains the Show component.\n * @module\n */\n\nexport interface ShowProps {\n /**\n * The condition to render memoized children or the fallback content.\n */\n when: boolean | null | undefined\n /**\n * The children to render when the condition is false.\n */\n fallback?: ReactNode\n}\n\n/**\n * Conditionally render a memoized version of the children or optional fallback\n * content.\n * @see https://cerberus.digitalu.design/react/show\n * @example\n * ```tsx\n * <Show when={isLoggedIn} fallback={<Navigate to=\"/login\" />}>\n * <Dashboard />\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;AAEA,iBAAwB;;;ACAxB,mBAKO;AA+CH;AApBJ,IAAM,mBAAe,4BAAwC,IAAI;AA8B1D,SAAS,kBAAqC;AACnD,QAAM,cAAU,yBAAW,YAAY;AACvC,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,uDAAuD;AAAA,EACzE;AACA,SAAO;AACT;;;ACpEA,IAAAA,gBAAgE;AA4BzD,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;;;AFhCA,qBAA8C;AAC9C,sBAAuB;AAgDnB,IAAAC,sBAAA;AALG,SAAS,OAAO,OAAoB;AACzC,QAAM,EAAE,MAAM,GAAG,YAAY,IAAI;AACjC,QAAM,EAAE,SAAS,GAAG,UAAU,IAAI,gBAAgB;AAElD,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACH,GAAG;AAAA,MACH,GAAI,WAAW,EAAE,gBAAgB,KAAK;AAAA,MACvC,eAAW;AAAA,QACT,YAAY;AAAA,YACZ,wBAAO;AAAA,UACL,SAAS;AAAA,UACT,GAAG;AAAA,QACL,CAAC;AAAA,YACD,sBAAM;AAAA,UACJ;AAAA,QACF,CAAC;AAAA,MACH;AAAA,MAEC;AAAA,oBAAY;AAAA,QACb,6CAAC,QAAK,MAAM,UAAU,UACpB;AAAA,UAAC;AAAA;AAAA,YACC,eAAW,gBAAI;AAAA,cACb,OAAO;AAAA,cACP,UAAU;AAAA,YACZ,CAAC;AAAA,YACF;AAAA;AAAA,QAED,GACF;AAAA;AAAA;AAAA,EACF;AAEJ;","names":["import_react","import_jsx_runtime"]}
1
+ {"version":3,"sources":["../../../src/components/Legend.tsx","../../../src/components/Show.tsx"],"sourcesContent":["'use client'\n\nimport { css, cx } from '@cerberus/styled-system/css'\nimport { label, type LabelVariantProps } from '@cerberus/styled-system/recipes'\nimport { hstack } from '@cerberus/styled-system/patterns'\nimport { type HTMLAttributes } from 'react'\nimport { Show } from './Show'\nimport { useFieldContext } from '@ark-ui/react/field'\n\n/**\n * This module contains the Fieldset component.\n * @module Fieldset\n */\n\nexport type LegendProps = HTMLAttributes<HTMLLegendElement> & LabelVariantProps\n\n/**\n * A component to provide a global label for a group of related elements in a form (for accessibility).\n * @memberof Fieldset\n * @see https://cerberus.digitalu.com/react/fieldset\n * @description [A11y Form Checklist](https://www.a11yproject.com/checklist/#forms)\n * @description [MDN Web Docs: Legend](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/legend)\n * @example\n * ```tsx\n * import { Fieldset, Legend, Field, Radio, Label } from '@cerberus/react'\n * import { Hstack } from '@cerberus/styled-system/jsx'\n *\n * function SomeForm() {\n * return (\n * <form>\n * <Fieldset>\n * <Legend>Do you like cats?</Legend>\n * <Hstack>\n * <Field>\n * <Radio id=\"yes\" name=\"cats\" value=\"yes\" />\n * <Label htmlFor=\"yes\">Yes</Label>\n * </Field>\n * </Hstack>\n * <Hstack>\n * <Field>\n * <Radio id=\"no\" name=\"cats\" value=\"no\" />\n * <Label htmlFor=\"no\">No</Label>\n * </Field>\n * </Hstack>\n * </Fieldset>\n * </form>\n * )\n * }\n * ```\n */\nexport function Legend(props: LegendProps) {\n const { size, ...nativeProps } = props\n const { invalid, required } = useFieldContext()\n\n return (\n <legend\n {...nativeProps}\n {...(invalid && { 'aria-invalid': true })}\n className={cx(\n nativeProps.className,\n hstack({\n justify: 'space-between',\n w: 'full',\n }),\n label({\n size,\n }),\n )}\n >\n {nativeProps.children}\n <Show when={required}>\n <span\n className={css({\n color: 'page.text.100',\n fontSize: 'inherit',\n })}\n >\n (required)\n </span>\n </Show>\n </legend>\n )\n}\n","'use client'\n\nimport { useMemo, type PropsWithChildren, type ReactNode } from 'react'\n\n/**\n * This module contains the Show component.\n * @module\n */\n\nexport interface ShowProps {\n /**\n * The condition to render memoized children or the fallback content.\n */\n when: boolean | null | undefined\n /**\n * The children to render when the condition is false.\n */\n fallback?: ReactNode\n}\n\n/**\n * Conditionally render a memoized version of the children or optional fallback\n * content.\n * @see https://cerberus.digitalu.design/react/show\n * @example\n * ```tsx\n * <Show when={isLoggedIn} fallback={<Navigate to=\"/login\" />}>\n * <Dashboard />\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;AAEA,iBAAwB;AACxB,qBAA8C;AAC9C,sBAAuB;;;ACFvB,mBAAgE;AA4BzD,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;;;AD/BA,mBAAgC;AAgD5B;AALG,SAAS,OAAO,OAAoB;AACzC,QAAM,EAAE,MAAM,GAAG,YAAY,IAAI;AACjC,QAAM,EAAE,SAAS,SAAS,QAAI,8BAAgB;AAE9C,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACH,GAAI,WAAW,EAAE,gBAAgB,KAAK;AAAA,MACvC,eAAW;AAAA,QACT,YAAY;AAAA,YACZ,wBAAO;AAAA,UACL,SAAS;AAAA,UACT,GAAG;AAAA,QACL,CAAC;AAAA,YACD,sBAAM;AAAA,UACJ;AAAA,QACF,CAAC;AAAA,MACH;AAAA,MAEC;AAAA,oBAAY;AAAA,QACb,4CAAC,QAAK,MAAM,UACV;AAAA,UAAC;AAAA;AAAA,YACC,eAAW,gBAAI;AAAA,cACb,OAAO;AAAA,cACP,UAAU;AAAA,YACZ,CAAC;AAAA,YACF;AAAA;AAAA,QAED,GACF;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}