@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
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/components/Input.tsx","../../../src/context/field.tsx","../../../src/context/cerberus.tsx","../../../src/components/Show.tsx"],"sourcesContent":["'use client'\n\nimport type { InputHTMLAttributes, ReactNode } from 'react'\nimport { input, type InputVariantProps } from '@cerberus/styled-system/recipes'\nimport { cx } from '@cerberus/styled-system/css'\nimport { useFieldContext } from '../context/field'\nimport { useCerberusContext } from '../context/cerberus'\nimport { Show } from './Show'\n\nexport interface InputBaseProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, 'id' | 'size'> {\n /**\n * The id of the FieldMessage component used to describe the input. Required for accessibility.\n */\n describedBy?: string\n /**\n * The unique identifier for the input element. Required for accessibility.\n */\n id: string\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}\nexport type InputProps = InputBaseProps & InputVariantProps\n\n/**\n * A component that allows the user to input text. Must be wrapped in a Field\n * component to keep track of the state for entire group of elements related to\n * the field.\n * @see https://cerberus.digitalu.design/react/input\n */\nexport function Input(props: InputProps) {\n const { describedBy, size, startIcon, endIcon, ...nativeProps } = props\n const inputStyles = input({ size })\n const { invalid, ...fieldStates } = useFieldContext()\n const hasEndIcon = Boolean(endIcon)\n\n const { icons } = useCerberusContext()\n const { invalid: InvalidIcon } = icons\n\n return (\n <div className={inputStyles.root}>\n <Show when={Boolean(startIcon)}>\n <span className={inputStyles.startIcon}>{startIcon}</span>\n </Show>\n\n <input\n {...nativeProps}\n {...fieldStates}\n {...(describedBy && { 'aria-describedby': describedBy })}\n {...(invalid && { 'aria-invalid': true })}\n data-start-icon={Boolean(startIcon)}\n className={cx('peer', nativeProps.className, inputStyles.input)}\n />\n\n <Show when={invalid}>\n <InvalidIcon className={inputStyles.icon} />\n </Show>\n <Show when={hasEndIcon && !invalid}>\n <span className={inputStyles.icon}>{endIcon}</span>\n </Show>\n </div>\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 { 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;AAGA,qBAA8C;AAC9C,iBAAmB;;;ACFnB,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,gBAAkE;AAyB9D,IAAAC,sBAAA;AAfJ,IAAM,sBAAkB,6BAA2C,IAAI;AAyBhE,SAAS,qBAAqB;AACnC,QAAM,cAAU,0BAAW,eAAe;AAC1C,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,oDAAoD;AAAA,EACtE;AACA,SAAO;AACT;;;ACzCA,IAAAC,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;;;AHQI,IAAAC,sBAAA;AAVG,SAAS,MAAM,OAAmB;AACvC,QAAM,EAAE,aAAa,MAAM,WAAW,SAAS,GAAG,YAAY,IAAI;AAClE,QAAM,kBAAc,sBAAM,EAAE,KAAK,CAAC;AAClC,QAAM,EAAE,SAAS,GAAG,YAAY,IAAI,gBAAgB;AACpD,QAAM,aAAa,QAAQ,OAAO;AAElC,QAAM,EAAE,MAAM,IAAI,mBAAmB;AACrC,QAAM,EAAE,SAAS,YAAY,IAAI;AAEjC,SACE,8CAAC,SAAI,WAAW,YAAY,MAC1B;AAAA,iDAAC,QAAK,MAAM,QAAQ,SAAS,GAC3B,uDAAC,UAAK,WAAW,YAAY,WAAY,qBAAU,GACrD;AAAA,IAEA;AAAA,MAAC;AAAA;AAAA,QACE,GAAG;AAAA,QACH,GAAG;AAAA,QACH,GAAI,eAAe,EAAE,oBAAoB,YAAY;AAAA,QACrD,GAAI,WAAW,EAAE,gBAAgB,KAAK;AAAA,QACvC,mBAAiB,QAAQ,SAAS;AAAA,QAClC,eAAW,eAAG,QAAQ,YAAY,WAAW,YAAY,KAAK;AAAA;AAAA,IAChE;AAAA,IAEA,6CAAC,QAAK,MAAM,SACV,uDAAC,eAAY,WAAW,YAAY,MAAM,GAC5C;AAAA,IACA,6CAAC,QAAK,MAAM,cAAc,CAAC,SACzB,uDAAC,UAAK,WAAW,YAAY,MAAO,mBAAQ,GAC9C;AAAA,KACF;AAEJ;","names":["import_react","import_jsx_runtime","import_react","import_jsx_runtime"]}
@@ -1,93 +0,0 @@
1
- "use strict";
2
- "use client";
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
-
21
- // src/components/Label.tsx
22
- var Label_exports = {};
23
- __export(Label_exports, {
24
- Label: () => Label
25
- });
26
- module.exports = __toCommonJS(Label_exports);
27
- var import_recipes = require("@cerberus/styled-system/recipes");
28
- var import_css = require("@cerberus/styled-system/css");
29
- var import_patterns = require("@cerberus/styled-system/patterns");
30
-
31
- // src/context/field.tsx
32
- var import_react = require("react");
33
- var import_jsx_runtime = require("react/jsx-runtime");
34
- var FieldContext = (0, import_react.createContext)(null);
35
- function useFieldContext() {
36
- const context = (0, import_react.useContext)(FieldContext);
37
- if (!context) {
38
- throw new Error("useFieldContext must be used within a Field Provider.");
39
- }
40
- return context;
41
- }
42
-
43
- // src/components/Show.tsx
44
- var import_react2 = require("react");
45
- function Show(props) {
46
- const { when, children, fallback } = props;
47
- const condition = (0, import_react2.useMemo)(() => when ?? false, [when]);
48
- return (0, import_react2.useMemo)(() => {
49
- if (condition) return children;
50
- return fallback ?? null;
51
- }, [condition, children, fallback]);
52
- }
53
-
54
- // src/components/Label.tsx
55
- var import_jsx_runtime2 = require("react/jsx-runtime");
56
- function Label(props) {
57
- const { hidden, size, ...nativeProps } = props;
58
- const { required, disabled } = useFieldContext();
59
- const usage = hidden ? "hidden" : "visible";
60
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
61
- "label",
62
- {
63
- ...nativeProps,
64
- ...disabled && { "data-disabled": true },
65
- className: (0, import_css.cx)(
66
- nativeProps.className,
67
- (0, import_recipes.label)({ size, usage }),
68
- (0, import_patterns.hstack)({
69
- justify: "space-between",
70
- w: "full"
71
- })
72
- ),
73
- children: [
74
- props.children,
75
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Show, { when: required, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
76
- "span",
77
- {
78
- className: (0, import_css.css)({
79
- color: "page.text.100",
80
- fontSize: "inherit"
81
- }),
82
- children: "(required)"
83
- }
84
- ) })
85
- ]
86
- }
87
- );
88
- }
89
- // Annotate the CommonJS export names for ESM import in node:
90
- 0 && (module.exports = {
91
- Label
92
- });
93
- //# sourceMappingURL=Label.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/components/Label.tsx","../../../src/context/field.tsx","../../../src/components/Show.tsx"],"sourcesContent":["'use client'\n\nimport type { HTMLAttributes, PropsWithChildren } from 'react'\nimport { label, type LabelVariantProps } from '@cerberus/styled-system/recipes'\nimport { css, cx } from '@cerberus/styled-system/css'\nimport { hstack } from '@cerberus/styled-system/patterns'\nimport { useFieldContext } from '../context/field'\nimport { Show } from './Show'\n\n/**\n * This module contains the Label component.\n * @module\n */\nexport interface LabelBaseProps extends HTMLAttributes<HTMLLabelElement> {\n /**\n * The unique identifier for the input element. Required for accessibility.\n */\n htmlFor: string\n /**\n * Used to hide the label from the UI while keeping it accessible to screen readers. Typically used for global search inputs that have no visible label.\n */\n hidden?: boolean\n}\nexport type LabelProps = LabelBaseProps & LabelVariantProps\n\n/**\n * A a11y compliant label component.\n * @definition [ARIA Forms](https://www.a11yproject.com/checklist/#forms)\n * @see https://cerberus.digitalu.design/react/label\n * @example\n * ```tsx\n * <Field required>\n * <Label htmlFor=\"search\" hidden>Search everything</Label>\n * <Input id=\"search\" startIcon={Search} type=\"text\" />\n * </Field>\n * ```\n */\nexport function Label(props: PropsWithChildren<LabelProps>) {\n const { hidden, size, ...nativeProps } = props\n const { required, disabled } = useFieldContext()\n const usage = hidden ? 'hidden' : 'visible'\n\n return (\n <label\n {...nativeProps}\n {...(disabled && { 'data-disabled': true })}\n className={cx(\n nativeProps.className,\n label({ size, usage }),\n hstack({\n justify: 'space-between',\n w: 'full',\n }),\n )}\n >\n {props.children}\n <Show when={required}>\n <span\n className={css({\n color: 'page.text.100',\n fontSize: 'inherit',\n })}\n >\n (required)\n </span>\n </Show>\n </label>\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;AAGA,qBAA8C;AAC9C,iBAAwB;AACxB,sBAAuB;;;ACHvB,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;;;AFKI,IAAAC,sBAAA;AANG,SAAS,MAAM,OAAsC;AAC1D,QAAM,EAAE,QAAQ,MAAM,GAAG,YAAY,IAAI;AACzC,QAAM,EAAE,UAAU,SAAS,IAAI,gBAAgB;AAC/C,QAAM,QAAQ,SAAS,WAAW;AAElC,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACH,GAAI,YAAY,EAAE,iBAAiB,KAAK;AAAA,MACzC,eAAW;AAAA,QACT,YAAY;AAAA,YACZ,sBAAM,EAAE,MAAM,MAAM,CAAC;AAAA,YACrB,wBAAO;AAAA,UACL,SAAS;AAAA,UACT,GAAG;AAAA,QACL,CAAC;AAAA,MACH;AAAA,MAEC;AAAA,cAAM;AAAA,QACP,6CAAC,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":["import_react","import_jsx_runtime"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/components/Modal.tsx"],"sourcesContent":["import { cx } from '@cerberus/styled-system/css'\nimport { modal } from '@cerberus/styled-system/recipes'\nimport { forwardRef, type ForwardedRef, type HTMLAttributes } from 'react'\n\n/**\n * This module contains the Modal root component for a customizable modal.\n * @module\n */\n\n// Modal\n\nexport type ModalProps = HTMLAttributes<HTMLDialogElement>\n\nfunction ModalEl(props: ModalProps, ref: ForwardedRef<HTMLDialogElement>) {\n return (\n <dialog\n {...props}\n className={cx(props.className, modal().dialog)}\n ref={ref}\n />\n )\n}\n\n/**\n * @deprecated use `Dialog` instead\n */\nexport const Modal = forwardRef(ModalEl)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAmB;AACnB,qBAAsB;AACtB,mBAAmE;AAa/D;AAFJ,SAAS,QAAQ,OAAmB,KAAsC;AACxE,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,eAAW,eAAG,MAAM,eAAW,sBAAM,EAAE,MAAM;AAAA,MAC7C;AAAA;AAAA,EACF;AAEJ;AAKO,IAAM,YAAQ,yBAAW,OAAO;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/components/ModalDescription.tsx"],"sourcesContent":["import { cx } from '@cerberus/styled-system/css'\nimport { modal } from '@cerberus/styled-system/recipes'\nimport type { HTMLAttributes } from 'react'\n\n/**\n * This module contains the ModalDescription component for a customizable modal.\n * @module\n */\n\nexport type ModalDescriptionProps = HTMLAttributes<HTMLParagraphElement>\n\n/**\n * @deprecated use `DialogDescription` instead\n */\nexport function ModalDescription(props: ModalDescriptionProps) {\n return <p {...props} className={cx(props.className, modal().description)} />\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAmB;AACnB,qBAAsB;AAcb;AADF,SAAS,iBAAiB,OAA8B;AAC7D,SAAO,4CAAC,OAAG,GAAG,OAAO,eAAW,eAAG,MAAM,eAAW,sBAAM,EAAE,WAAW,GAAG;AAC5E;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/components/ModalHeader.tsx"],"sourcesContent":["import { cx } from '@cerberus/styled-system/css'\nimport { vstack } from '@cerberus/styled-system/patterns'\nimport type { HTMLAttributes } from 'react'\n\n/**\n * This module contains the ModalHeader component for a customizable modal.\n * @module\n */\n\nexport type ModalHeaderProps = HTMLAttributes<HTMLDivElement>\n\n/**\n * @deprecated there is no replacement for this component\n */\nexport function ModalHeader(props: ModalHeaderProps) {\n return (\n <div\n {...props}\n className={cx(\n props.className,\n vstack({\n alignItems: 'flex-start',\n gap: 'md',\n position: 'relative',\n }),\n )}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAmB;AACnB,sBAAuB;AAenB;AAFG,SAAS,YAAY,OAAyB;AACnD,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,eAAW;AAAA,QACT,MAAM;AAAA,YACN,wBAAO;AAAA,UACL,YAAY;AAAA,UACZ,KAAK;AAAA,UACL,UAAU;AAAA,QACZ,CAAC;AAAA,MACH;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/components/ModalHeading.tsx"],"sourcesContent":["import { cx } from '@cerberus/styled-system/css'\nimport { modal } from '@cerberus/styled-system/recipes'\nimport type { HTMLAttributes } from 'react'\n\n/**\n * This module contains the ModalHeading component for a customizable modal.\n * @module\n */\n\nexport type ModalHeadingProps = HTMLAttributes<HTMLParagraphElement>\n\n/**\n * @deprecated use `DialogHeading` instead\n */\nexport function ModalHeading(props: ModalHeadingProps) {\n return <p {...props} className={cx(props.className, modal().heading)} />\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAmB;AACnB,qBAAsB;AAcb;AADF,SAAS,aAAa,OAA0B;AACrD,SAAO,4CAAC,OAAG,GAAG,OAAO,eAAW,eAAG,MAAM,eAAW,sBAAM,EAAE,OAAO,GAAG;AACxE;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/components/NavMenuLink.tsx","../../../src/components/Show.tsx"],"sourcesContent":["import type { AnchorHTMLAttributes, ElementType } from 'react'\nimport { css, cx } from '@cerberus/styled-system/css'\nimport { Show } from './Show'\n\n/**\n * This module contains the NavMenuLink component.\n * @module\n */\n\nexport interface NavMenuLinkProps\n extends AnchorHTMLAttributes<HTMLAnchorElement> {\n /**\n * The element type to render as. Recommended to use for Next apps with the\n * `Link` component.\n */\n as?: ElementType\n}\n\n/**\n * @deprecated use the {@link Menu} family instead\n */\nexport function NavMenuLink(props: NavMenuLinkProps): JSX.Element {\n const { as, ...nativeProps } = props\n const hasAs = Boolean(as)\n const AsSub: ElementType = as!\n\n return (\n <li\n className={css({\n w: 'full',\n })}\n >\n <Show\n when={hasAs}\n fallback={\n <a\n {...nativeProps}\n className={cx(\n nativeProps.className,\n css({\n color: 'action.navigation.initial',\n textStyle: 'link',\n _hover: {\n color: 'action.navigation.hover',\n },\n }),\n )}\n />\n }\n >\n {hasAs && <AsSub {...nativeProps} />}\n </Show>\n </li>\n )\n}\n","'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;AACA,iBAAwB;;;ACCxB,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;;;ADHU;AAdH,SAAS,YAAY,OAAsC;AAChE,QAAM,EAAE,IAAI,GAAG,YAAY,IAAI;AAC/B,QAAM,QAAQ,QAAQ,EAAE;AACxB,QAAM,QAAqB;AAE3B,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAW,gBAAI;AAAA,QACb,GAAG;AAAA,MACL,CAAC;AAAA,MAED;AAAA,QAAC;AAAA;AAAA,UACC,MAAM;AAAA,UACN,UACE;AAAA,YAAC;AAAA;AAAA,cACE,GAAG;AAAA,cACJ,eAAW;AAAA,gBACT,YAAY;AAAA,oBACZ,gBAAI;AAAA,kBACF,OAAO;AAAA,kBACP,WAAW;AAAA,kBACX,QAAQ;AAAA,oBACN,OAAO;AAAA,kBACT;AAAA,gBACF,CAAC;AAAA,cACH;AAAA;AAAA,UACF;AAAA,UAGD,mBAAS,4CAAC,SAAO,GAAG,aAAa;AAAA;AAAA,MACpC;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/components/NavMenuList.tsx","../../../src/context/navMenu.tsx","../../../src/components/Show.tsx"],"sourcesContent":["'use client'\n\nimport { useMemo, type HTMLAttributes } from 'react'\nimport { cx } from '@cerberus/styled-system/css'\nimport { vstack } from '@cerberus/styled-system/patterns'\nimport { useNavMenuContext } from '../context/navMenu'\nimport type { Positions } from '../types'\nimport { Show } from './Show'\n\n/**\n * This module contains the NavMenuList component.\n * @module\n */\n\ninterface GetPositionResult {\n /**\n * The left position of the element.\n */\n left: string\n /**\n * The right position of the element.\n */\n right: string\n /**\n * The top position of the element.\n */\n top: string\n /**\n * The bottom position of the element.\n */\n bottom: string\n}\n\n/**\n * @deprecated use the {@link Menu} family instead\n */\nexport function getPosition(position: Positions): GetPositionResult {\n const defaultPositions = {\n left: 'auto',\n right: 'auto',\n top: 'auto',\n bottom: 'auto',\n }\n switch (position) {\n case 'right':\n return { ...defaultPositions, top: '0%', left: '105%' }\n case 'left':\n return { ...defaultPositions, top: '0%', right: '105%' }\n case 'bottom':\n return { ...defaultPositions, top: '110%' }\n case 'top':\n return { ...defaultPositions, bottom: '110%' }\n default:\n return defaultPositions\n }\n}\n\nconst navListStyles = vstack({\n alignItems: 'flex-start',\n bgColor: 'page.surface.100',\n boxShadow: 'lg',\n gap: '2',\n opacity: '0',\n p: '4',\n position: 'absolute',\n rounded: 'md',\n zIndex: 'dropdown',\n _motionSafe: {\n animationName: 'zoomIn',\n animationDelay: '100ms',\n animationDuration: '150ms',\n animationFillMode: 'both',\n animationTimingFunction: 'ease-in-out',\n },\n _positionBottom: {\n transformOrigin: 'top left',\n },\n _positionTop: {\n transformOrigin: 'bottom left',\n },\n _positionLeft: {\n transformOrigin: 'top right',\n },\n _positionRight: {\n transformOrigin: 'top left',\n },\n})\n\nexport interface NavMenuListProps extends HTMLAttributes<HTMLUListElement> {\n /**\n * The unique identifier for the NavMenuList. Required for accessibility.\n */\n id: string\n /**\n * The position of the NavMenuList.\n * @type 'top' | 'right' | 'bottom' | 'left'\n * @default 'bottom'\n */\n position?: Positions\n}\n\n/**\n * A component that allows the user to display a menu of navigation links.\n * @definition [Disclosure Nav](https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/examples/disclosure-navigation/)\n * @see https://cerberus.digitalu.design/react/nav-menu\n *\n * @example\n * ```tsx\n * <NavMenu>\n * <NavMenuList id=\"nav-menu-list\" position=\"bottom\">\n * <NavMenuLink href=\"/home\">Home</NavMenuLink>\n * <NavMenuLink href=\"/about\">About</NavMenuLink>\n * </NavMenuList>\n * </NavMenu>\n * ```\n **/\nexport function NavMenuList(props: NavMenuListProps): JSX.Element {\n const { position, ...nativeProps } = props\n const { menuRef, expanded } = useNavMenuContext()\n const locationStyles = useMemo(\n () => getPosition(position ?? 'bottom'),\n [position],\n )\n\n return (\n <Show when={expanded}>\n <ul\n {...nativeProps}\n data-position={position ?? 'bottom'}\n className={cx(nativeProps.className, navListStyles)}\n ref={menuRef}\n style={locationStyles}\n />\n </Show>\n )\n}\n","'use client'\n\nimport { css } from '@cerberus/styled-system/css'\nimport {\n createContext,\n useCallback,\n useContext,\n useMemo,\n useRef,\n useState,\n type PropsWithChildren,\n type RefObject,\n} from 'react'\n\n/**\n * This module provides a context and hook for the nav menu.\n * @module NavMenu\n */\n\nexport type NavTriggerRef = RefObject<HTMLButtonElement>\nexport type NavMenuRef = RefObject<HTMLUListElement>\n\nexport interface NavMenuContextValue {\n /**\n * The ref for the trigger button.\n */\n triggerRef: NavTriggerRef | null\n /**\n * The ref for the menu.\n */\n menuRef: NavMenuRef | null\n /**\n * Whether the menu is expanded.\n */\n expanded: boolean\n /**\n * Called when the menu button is clicked.\n */\n onToggle: () => void\n}\n\nconst NavMenuContext = createContext<NavMenuContextValue | null>(null)\n\n/**\n * @deprecated use the {@link Menu} family instead\n */\nexport function NavMenu(props: PropsWithChildren): JSX.Element {\n const triggerRef = useRef<HTMLButtonElement>(null)\n const menuRef = useRef<HTMLUListElement>(null)\n const [expanded, setExpanded] = useState<boolean>(false)\n\n const handleToggle = useCallback(() => {\n setExpanded((prev) => !prev)\n }, [])\n\n const value = useMemo(\n () => ({\n triggerRef,\n menuRef,\n expanded,\n onToggle: handleToggle,\n }),\n [expanded, handleToggle],\n )\n\n return (\n <NavMenuContext.Provider value={value}>\n <nav\n className={css({\n position: 'relative',\n })}\n >\n {props.children}\n </nav>\n </NavMenuContext.Provider>\n )\n}\n\n/**\n * Used to access the nav menu context.\n * @returns The nav menu context.\n */\nexport function useNavMenuContext(): NavMenuContextValue {\n const context = useContext(NavMenuContext)\n if (!context) {\n throw new Error('useNavMenuContext must be used within a NavMenu.')\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;AAAA;AAEA,IAAAA,gBAA6C;AAC7C,IAAAC,cAAmB;AACnB,sBAAuB;;;ACFvB,iBAAoB;AACpB,mBASO;AAuDD;AA1BN,IAAM,qBAAiB,4BAA0C,IAAI;AAyC9D,SAAS,oBAAyC;AACvD,QAAM,cAAU,yBAAW,cAAc;AACzC,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,kDAAkD;AAAA,EACpE;AACA,SAAO;AACT;;;ACtFA,IAAAC,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;;;AFwFM,IAAAC,sBAAA;AA1FC,SAAS,YAAY,UAAwC;AAClE,QAAM,mBAAmB;AAAA,IACvB,MAAM;AAAA,IACN,OAAO;AAAA,IACP,KAAK;AAAA,IACL,QAAQ;AAAA,EACV;AACA,UAAQ,UAAU;AAAA,IAChB,KAAK;AACH,aAAO,EAAE,GAAG,kBAAkB,KAAK,MAAM,MAAM,OAAO;AAAA,IACxD,KAAK;AACH,aAAO,EAAE,GAAG,kBAAkB,KAAK,MAAM,OAAO,OAAO;AAAA,IACzD,KAAK;AACH,aAAO,EAAE,GAAG,kBAAkB,KAAK,OAAO;AAAA,IAC5C,KAAK;AACH,aAAO,EAAE,GAAG,kBAAkB,QAAQ,OAAO;AAAA,IAC/C;AACE,aAAO;AAAA,EACX;AACF;AAEA,IAAM,oBAAgB,wBAAO;AAAA,EAC3B,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,WAAW;AAAA,EACX,KAAK;AAAA,EACL,SAAS;AAAA,EACT,GAAG;AAAA,EACH,UAAU;AAAA,EACV,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,aAAa;AAAA,IACX,eAAe;AAAA,IACf,gBAAgB;AAAA,IAChB,mBAAmB;AAAA,IACnB,mBAAmB;AAAA,IACnB,yBAAyB;AAAA,EAC3B;AAAA,EACA,iBAAiB;AAAA,IACf,iBAAiB;AAAA,EACnB;AAAA,EACA,cAAc;AAAA,IACZ,iBAAiB;AAAA,EACnB;AAAA,EACA,eAAe;AAAA,IACb,iBAAiB;AAAA,EACnB;AAAA,EACA,gBAAgB;AAAA,IACd,iBAAiB;AAAA,EACnB;AACF,CAAC;AA8BM,SAAS,YAAY,OAAsC;AAChE,QAAM,EAAE,UAAU,GAAG,YAAY,IAAI;AACrC,QAAM,EAAE,SAAS,SAAS,IAAI,kBAAkB;AAChD,QAAM,qBAAiB;AAAA,IACrB,MAAM,YAAY,YAAY,QAAQ;AAAA,IACtC,CAAC,QAAQ;AAAA,EACX;AAEA,SACE,6CAAC,QAAK,MAAM,UACV;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,iBAAe,YAAY;AAAA,MAC3B,eAAW,gBAAG,YAAY,WAAW,aAAa;AAAA,MAClD,KAAK;AAAA,MACL,OAAO;AAAA;AAAA,EACT,GACF;AAEJ;","names":["import_react","import_css","import_react","import_jsx_runtime"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/components/NavMenuTrigger.tsx","../../../src/aria-helpers/nav-menu.aria.ts","../../../src/context/navMenu.tsx","../../../src/components/Show.tsx"],"sourcesContent":["'use client'\n\nimport {\n useCallback,\n type ButtonHTMLAttributes,\n type ElementType,\n type MouseEvent,\n} from 'react'\nimport { cx } from '@cerberus/styled-system/css'\nimport { button } from '@cerberus/styled-system/recipes'\nimport {\n createNavTriggerProps,\n type NavTriggerAriaValues,\n} from '../aria-helpers/nav-menu.aria'\nimport { useNavMenuContext } from '../context/navMenu'\nimport type { ButtonProps } from './Button'\nimport { Show } from './Show'\n\n/**\n * This module contains the NavMenuTrigger component.\n * @module\n */\n\nexport interface NavMenuTriggerProps\n extends ButtonHTMLAttributes<HTMLButtonElement>,\n ButtonProps,\n NavTriggerAriaValues {\n /**\n * The element type to render as. Recommended to use for an IconButton trigger vs a standard Button.\n * @default 'button'\n * @example\n * ```tsx\n * <NavMenuTrigger as={IconButton} href=\"/home\" />\n * ```\n */\n as?: ElementType\n}\n\n/**\n * @deprecated use the {@link Menu} family instead\n */\nexport function NavMenuTrigger(props: NavMenuTriggerProps): JSX.Element {\n const {\n as,\n palette,\n usage,\n shape,\n controls,\n expanded: propsExpanded,\n onClick,\n ...nativeProps\n } = props\n const { triggerRef, onToggle, expanded } = useNavMenuContext()\n const ariaProps = createNavTriggerProps({\n controls,\n expanded: propsExpanded ?? expanded,\n })\n const hasAs = Boolean(as)\n const AsSub: ElementType = as!\n\n const handleClick = useCallback(\n (e: MouseEvent<HTMLButtonElement>) => {\n if (onClick) return onClick(e)\n onToggle()\n },\n [onClick, onToggle],\n )\n\n return (\n <Show\n when={hasAs}\n fallback={\n <button\n {...nativeProps}\n {...ariaProps}\n className={cx(\n nativeProps.className,\n button({\n palette,\n usage,\n shape,\n }),\n )}\n onClick={handleClick}\n ref={triggerRef}\n >\n {props.children}\n </button>\n }\n >\n {hasAs && (\n <AsSub\n {...nativeProps}\n {...ariaProps}\n onClick={handleClick}\n ref={triggerRef}\n />\n )}\n </Show>\n )\n}\n","export interface NavTriggerAriaValues {\n controls: string\n expanded?: boolean\n}\n\ninterface NavTriggerAriaReturn {\n ['aria-controls']: string\n ['aria-expanded']: boolean\n}\n\nexport function createNavTriggerProps(\n values: NavTriggerAriaValues,\n): NavTriggerAriaReturn {\n return {\n ['aria-controls']: values.controls,\n ['aria-expanded']: values.expanded ?? false,\n }\n}\n","'use client'\n\nimport { css } from '@cerberus/styled-system/css'\nimport {\n createContext,\n useCallback,\n useContext,\n useMemo,\n useRef,\n useState,\n type PropsWithChildren,\n type RefObject,\n} from 'react'\n\n/**\n * This module provides a context and hook for the nav menu.\n * @module NavMenu\n */\n\nexport type NavTriggerRef = RefObject<HTMLButtonElement>\nexport type NavMenuRef = RefObject<HTMLUListElement>\n\nexport interface NavMenuContextValue {\n /**\n * The ref for the trigger button.\n */\n triggerRef: NavTriggerRef | null\n /**\n * The ref for the menu.\n */\n menuRef: NavMenuRef | null\n /**\n * Whether the menu is expanded.\n */\n expanded: boolean\n /**\n * Called when the menu button is clicked.\n */\n onToggle: () => void\n}\n\nconst NavMenuContext = createContext<NavMenuContextValue | null>(null)\n\n/**\n * @deprecated use the {@link Menu} family instead\n */\nexport function NavMenu(props: PropsWithChildren): JSX.Element {\n const triggerRef = useRef<HTMLButtonElement>(null)\n const menuRef = useRef<HTMLUListElement>(null)\n const [expanded, setExpanded] = useState<boolean>(false)\n\n const handleToggle = useCallback(() => {\n setExpanded((prev) => !prev)\n }, [])\n\n const value = useMemo(\n () => ({\n triggerRef,\n menuRef,\n expanded,\n onToggle: handleToggle,\n }),\n [expanded, handleToggle],\n )\n\n return (\n <NavMenuContext.Provider value={value}>\n <nav\n className={css({\n position: 'relative',\n })}\n >\n {props.children}\n </nav>\n </NavMenuContext.Provider>\n )\n}\n\n/**\n * Used to access the nav menu context.\n * @returns The nav menu context.\n */\nexport function useNavMenuContext(): NavMenuContextValue {\n const context = useContext(NavMenuContext)\n if (!context) {\n throw new Error('useNavMenuContext must be used within a NavMenu.')\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,IAAAA,gBAKO;AACP,IAAAC,cAAmB;AACnB,qBAAuB;;;ACChB,SAAS,sBACd,QACsB;AACtB,SAAO;AAAA,IACL,CAAC,eAAe,GAAG,OAAO;AAAA,IAC1B,CAAC,eAAe,GAAG,OAAO,YAAY;AAAA,EACxC;AACF;;;ACfA,iBAAoB;AACpB,mBASO;AAuDD;AA1BN,IAAM,qBAAiB,4BAA0C,IAAI;AAyC9D,SAAS,oBAAyC;AACvD,QAAM,cAAU,yBAAW,cAAc;AACzC,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,kDAAkD;AAAA,EACpE;AACA,SAAO;AACT;;;ACtFA,IAAAC,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;;;AHkCQ,IAAAC,sBAAA;AA/BD,SAAS,eAAe,OAAyC;AACtE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV;AAAA,IACA,GAAG;AAAA,EACL,IAAI;AACJ,QAAM,EAAE,YAAY,UAAU,SAAS,IAAI,kBAAkB;AAC7D,QAAM,YAAY,sBAAsB;AAAA,IACtC;AAAA,IACA,UAAU,iBAAiB;AAAA,EAC7B,CAAC;AACD,QAAM,QAAQ,QAAQ,EAAE;AACxB,QAAM,QAAqB;AAE3B,QAAM,kBAAc;AAAA,IAClB,CAAC,MAAqC;AACpC,UAAI,QAAS,QAAO,QAAQ,CAAC;AAC7B,eAAS;AAAA,IACX;AAAA,IACA,CAAC,SAAS,QAAQ;AAAA,EACpB;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAM;AAAA,MACN,UACE;AAAA,QAAC;AAAA;AAAA,UACE,GAAG;AAAA,UACH,GAAG;AAAA,UACJ,eAAW;AAAA,YACT,YAAY;AAAA,gBACZ,uBAAO;AAAA,cACL;AAAA,cACA;AAAA,cACA;AAAA,YACF,CAAC;AAAA,UACH;AAAA,UACA,SAAS;AAAA,UACT,KAAK;AAAA,UAEJ,gBAAM;AAAA;AAAA,MACT;AAAA,MAGD,mBACC;AAAA,QAAC;AAAA;AAAA,UACE,GAAG;AAAA,UACH,GAAG;AAAA,UACJ,SAAS;AAAA,UACT,KAAK;AAAA;AAAA,MACP;AAAA;AAAA,EAEJ;AAEJ;","names":["import_react","import_css","import_react","import_jsx_runtime"]}
@@ -1,81 +0,0 @@
1
- "use strict";
2
- "use client";
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
-
21
- // src/components/Radio.tsx
22
- var Radio_exports = {};
23
- __export(Radio_exports, {
24
- Radio: () => Radio
25
- });
26
- module.exports = __toCommonJS(Radio_exports);
27
- var import_css = require("@cerberus/styled-system/css");
28
- var import_patterns = require("@cerberus/styled-system/patterns");
29
- var import_recipes = require("@cerberus/styled-system/recipes");
30
-
31
- // src/context/field.tsx
32
- var import_react = require("react");
33
- var import_jsx_runtime = require("react/jsx-runtime");
34
- var FieldContext = (0, import_react.createContext)(null);
35
- function useFieldContext() {
36
- const context = (0, import_react.useContext)(FieldContext);
37
- if (!context) {
38
- throw new Error("useFieldContext must be used within a Field Provider.");
39
- }
40
- return context;
41
- }
42
-
43
- // src/components/Radio.tsx
44
- var import_jsx_runtime2 = require("react/jsx-runtime");
45
- function Radio(props) {
46
- const { children, size, ...nativeProps } = props;
47
- const { invalid, ...state } = useFieldContext();
48
- const styles = (0, import_recipes.radio)({ size });
49
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
50
- "div",
51
- {
52
- className: (0, import_css.cx)(
53
- "group",
54
- (0, import_patterns.hstack)({
55
- gap: "sm"
56
- }),
57
- styles.root
58
- ),
59
- tabIndex: 0,
60
- children: [
61
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
62
- "input",
63
- {
64
- ...nativeProps,
65
- ...state,
66
- ...invalid && { "aria-invalid": true },
67
- className: (0, import_css.cx)(nativeProps.className, styles.input),
68
- tabIndex: -1,
69
- type: "radio"
70
- }
71
- ),
72
- children
73
- ]
74
- }
75
- );
76
- }
77
- // Annotate the CommonJS export names for ESM import in node:
78
- 0 && (module.exports = {
79
- Radio
80
- });
81
- //# sourceMappingURL=Radio.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/components/Radio.tsx","../../../src/context/field.tsx"],"sourcesContent":["'use client'\n\nimport { cx } from '@cerberus/styled-system/css'\nimport { hstack } from '@cerberus/styled-system/patterns'\nimport { radio } from '@cerberus/styled-system/recipes'\nimport type { RecipeVariantProps } from '@cerberus/styled-system/types'\nimport type { InputHTMLAttributes, PropsWithChildren } from 'react'\nimport { useFieldContext } from '../context/field'\n\n/**\n * This module contains the Radio component.\n * @module\n */\n\nexport type RadioRecipe = RecipeVariantProps<typeof radio>\nexport interface RadioBaseProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {\n /**\n * A unique identifier for the radio button. Required for accessibility.\n */\n id: string\n}\nexport type RadioProps = RadioBaseProps & RadioRecipe\n\n/**\n * The Radio component is used to allow users to select a single option from a list of options.\n * @see https://cerberus.digitalu.design/react/radio\n * @memberof module:Field\n * @example\n * ```tsx\n * <Field>\n * <fieldset name=\"fruit\">\n * <Radio id=\"radio-1\" name=\"fruit\" value=\"1\">\n * Option 1\n * </Radio>\n * <Radio id=\"radio-2\" name=\"fruit\" value=\"2\">\n * Option 2\n * </Radio>\n * <Radio id=\"radio-3\" name=\"fruit\" value=\"3\">\n * Option 3\n * </Radio>\n * </fieldset>\n * </Field>\n * ```\n */\nexport function Radio(props: PropsWithChildren<RadioProps>) {\n const { children, size, ...nativeProps } = props\n const { invalid, ...state } = useFieldContext()\n const styles = radio({ size })\n\n return (\n <div\n className={cx(\n 'group',\n hstack({\n gap: 'sm',\n }),\n styles.root,\n )}\n tabIndex={0}\n >\n <input\n {...nativeProps}\n {...state}\n {...(invalid && { 'aria-invalid': true })}\n className={cx(nativeProps.className, styles.input)}\n tabIndex={-1}\n type=\"radio\"\n />\n {children}\n </div>\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,iBAAmB;AACnB,sBAAuB;AACvB,qBAAsB;;;ACFtB,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;;;ADnBI,IAAAA,sBAAA;AANG,SAAS,MAAM,OAAsC;AAC1D,QAAM,EAAE,UAAU,MAAM,GAAG,YAAY,IAAI;AAC3C,QAAM,EAAE,SAAS,GAAG,MAAM,IAAI,gBAAgB;AAC9C,QAAM,aAAS,sBAAM,EAAE,KAAK,CAAC;AAE7B,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAW;AAAA,QACT;AAAA,YACA,wBAAO;AAAA,UACL,KAAK;AAAA,QACP,CAAC;AAAA,QACD,OAAO;AAAA,MACT;AAAA,MACA,UAAU;AAAA,MAEV;AAAA;AAAA,UAAC;AAAA;AAAA,YACE,GAAG;AAAA,YACH,GAAG;AAAA,YACH,GAAI,WAAW,EAAE,gBAAgB,KAAK;AAAA,YACvC,eAAW,eAAG,YAAY,WAAW,OAAO,KAAK;AAAA,YACjD,UAAU;AAAA,YACV,MAAK;AAAA;AAAA,QACP;AAAA,QACC;AAAA;AAAA;AAAA,EACH;AAEJ;","names":["import_jsx_runtime"]}
@@ -1,120 +0,0 @@
1
- "use strict";
2
- "use client";
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
-
21
- // src/components/Select.tsx
22
- var Select_exports = {};
23
- __export(Select_exports, {
24
- Option: () => Option,
25
- Select: () => Select
26
- });
27
- module.exports = __toCommonJS(Select_exports);
28
- var import_css = require("@cerberus/styled-system/css");
29
- var import_patterns = require("@cerberus/styled-system/patterns");
30
- var import_recipes = require("@cerberus/styled-system/recipes");
31
-
32
- // src/context/field.tsx
33
- var import_react = require("react");
34
- var import_jsx_runtime = require("react/jsx-runtime");
35
- var FieldContext = (0, import_react.createContext)(null);
36
- function useFieldContext() {
37
- const context = (0, import_react.useContext)(FieldContext);
38
- if (!context) {
39
- throw new Error("useFieldContext must be used within a Field Provider.");
40
- }
41
- return context;
42
- }
43
-
44
- // src/context/cerberus.tsx
45
- var import_react2 = require("react");
46
- var import_jsx_runtime2 = require("react/jsx-runtime");
47
- var CerberusContext = (0, import_react2.createContext)(null);
48
- function useCerberusContext() {
49
- const context = (0, import_react2.useContext)(CerberusContext);
50
- if (!context) {
51
- throw new Error("useCerberus must be used within a CerberusProvider");
52
- }
53
- return context;
54
- }
55
-
56
- // src/components/Show.tsx
57
- var import_react3 = require("react");
58
- function Show(props) {
59
- const { when, children, fallback } = props;
60
- const condition = (0, import_react3.useMemo)(() => when ?? false, [when]);
61
- return (0, import_react3.useMemo)(() => {
62
- if (condition) return children;
63
- return fallback ?? null;
64
- }, [condition, children, fallback]);
65
- }
66
-
67
- // src/components/Select.tsx
68
- var import_jsx_runtime3 = require("react/jsx-runtime");
69
- function Select(props) {
70
- const { describedBy, size, ...nativeProps } = props;
71
- const { invalid, ...fieldStates } = useFieldContext();
72
- const { icons } = useCerberusContext();
73
- const { invalid: InvalidIcon, selectArrow: SelectArrow } = icons;
74
- const styles = (0, import_recipes.select)({
75
- size
76
- });
77
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: styles.root, children: [
78
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
79
- "select",
80
- {
81
- ...nativeProps,
82
- ...fieldStates,
83
- ...describedBy && { "aria-describedby": describedBy },
84
- ...invalid && { "aria-invalid": true },
85
- className: styles.input
86
- }
87
- ),
88
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
89
- "span",
90
- {
91
- className: (0, import_css.cx)(
92
- styles.iconStack,
93
- (0, import_patterns.hstack)({
94
- gap: "2"
95
- })
96
- ),
97
- children: [
98
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Show, { when: invalid, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
99
- "span",
100
- {
101
- ...invalid && { "data-invalid": true },
102
- className: styles.stateIcon,
103
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(InvalidIcon, {})
104
- }
105
- ) }),
106
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: styles.arrowIcon, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SelectArrow, {}) })
107
- ]
108
- }
109
- )
110
- ] });
111
- }
112
- function Option(props) {
113
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { ...props });
114
- }
115
- // Annotate the CommonJS export names for ESM import in node:
116
- 0 && (module.exports = {
117
- Option,
118
- Select
119
- });
120
- //# sourceMappingURL=Select.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/components/Select.tsx","../../../src/context/field.tsx","../../../src/context/cerberus.tsx","../../../src/components/Show.tsx"],"sourcesContent":["'use client'\n\nimport { cx } from '@cerberus/styled-system/css'\nimport { hstack } from '@cerberus/styled-system/patterns'\nimport {\n select,\n type SelectVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport type { OptionHTMLAttributes, SelectHTMLAttributes } from 'react'\nimport { useFieldContext } from '../context/field'\nimport { useCerberusContext } from '../context/cerberus'\nimport { Show } from './Show'\n\n/**\n * This module contains the select components.\n * @module\n */\n\nexport type SelectProps = Omit<\n SelectHTMLAttributes<HTMLSelectElement>,\n 'size'\n> &\n SelectVariantProps & {\n /**\n * The unique id of the select element. Required for accessibility.\n */\n id: string\n /**\n * The id of the FieldMessage that describes the select element.\n */\n describedBy?: string\n }\n\n/**\n * Used to allow users to select a single option from a list of options.\n * @see https://cerberus.digitalu.design/react/select\n * @memberof module:Field\n * @example\n * ```tsx\n * <Field>\n * <Select describedby=\"help:fruit\" id=\"fruit\">\n * <Option value=\"\">Choose option</Option>\n * <Option value=\"one\">Option 1</Option>\n * <Option value=\"two\">Option 2</Option>\n * <Option value=\"three\">Option 3</Option>\n * </Select>\n * </Field>\n * ```\n */\nexport function Select(props: SelectProps) {\n const { describedBy, size, ...nativeProps } = props\n const { invalid, ...fieldStates } = useFieldContext()\n\n const { icons } = useCerberusContext()\n const { invalid: InvalidIcon, selectArrow: SelectArrow } = icons\n\n const styles = select({\n size,\n })\n\n return (\n <div className={styles.root}>\n <select\n {...nativeProps}\n {...fieldStates}\n {...(describedBy && { 'aria-describedby': describedBy })}\n {...(invalid && { 'aria-invalid': true })}\n className={styles.input}\n />\n <span\n className={cx(\n styles.iconStack,\n hstack({\n gap: '2',\n }),\n )}\n >\n <Show when={invalid}>\n <span\n {...(invalid && { 'data-invalid': true })}\n className={styles.stateIcon}\n >\n <InvalidIcon />\n </span>\n </Show>\n <span className={styles.arrowIcon}>\n <SelectArrow />\n </span>\n </span>\n </div>\n )\n}\n\n// We only export this component for consistency with the other components\n\nexport type OptionProps = OptionHTMLAttributes<HTMLOptionElement>\n\n/**\n * Option component\n * props: OptionHTMLAttributes<HTMLOptionElement>\n * @example\n * ```tsx\n * <Option value=\"one\">Option 1</Option>\n * ```\n */\nexport function Option(props: OptionProps) {\n return <option {...props} />\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 { 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,iBAAmB;AACnB,sBAAuB;AACvB,qBAGO;;;ACLP,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,gBAAkE;AAyB9D,IAAAC,sBAAA;AAfJ,IAAM,sBAAkB,6BAA2C,IAAI;AAyBhE,SAAS,qBAAqB;AACnC,QAAM,cAAU,0BAAW,eAAe;AAC1C,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,oDAAoD;AAAA,EACtE;AACA,SAAO;AACT;;;ACzCA,IAAAC,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;;;AHwBM,IAAAC,sBAAA;AAbC,SAAS,OAAO,OAAoB;AACzC,QAAM,EAAE,aAAa,MAAM,GAAG,YAAY,IAAI;AAC9C,QAAM,EAAE,SAAS,GAAG,YAAY,IAAI,gBAAgB;AAEpD,QAAM,EAAE,MAAM,IAAI,mBAAmB;AACrC,QAAM,EAAE,SAAS,aAAa,aAAa,YAAY,IAAI;AAE3D,QAAM,aAAS,uBAAO;AAAA,IACpB;AAAA,EACF,CAAC;AAED,SACE,8CAAC,SAAI,WAAW,OAAO,MACrB;AAAA;AAAA,MAAC;AAAA;AAAA,QACE,GAAG;AAAA,QACH,GAAG;AAAA,QACH,GAAI,eAAe,EAAE,oBAAoB,YAAY;AAAA,QACrD,GAAI,WAAW,EAAE,gBAAgB,KAAK;AAAA,QACvC,WAAW,OAAO;AAAA;AAAA,IACpB;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC,eAAW;AAAA,UACT,OAAO;AAAA,cACP,wBAAO;AAAA,YACL,KAAK;AAAA,UACP,CAAC;AAAA,QACH;AAAA,QAEA;AAAA,uDAAC,QAAK,MAAM,SACV;AAAA,YAAC;AAAA;AAAA,cACE,GAAI,WAAW,EAAE,gBAAgB,KAAK;AAAA,cACvC,WAAW,OAAO;AAAA,cAElB,uDAAC,eAAY;AAAA;AAAA,UACf,GACF;AAAA,UACA,6CAAC,UAAK,WAAW,OAAO,WACtB,uDAAC,eAAY,GACf;AAAA;AAAA;AAAA,IACF;AAAA,KACF;AAEJ;AAcO,SAAS,OAAO,OAAoB;AACzC,SAAO,6CAAC,YAAQ,GAAG,OAAO;AAC5B;","names":["import_react","import_jsx_runtime","import_react","import_jsx_runtime"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/components/Textarea.tsx","../../../src/context/field.tsx"],"sourcesContent":["'use client'\n\nimport type { TextareaHTMLAttributes } from 'react'\nimport { css, cx } from '@cerberus/styled-system/css'\nimport { input, type InputVariantProps } from '@cerberus/styled-system/recipes'\nimport { useFieldContext } from '../context/field'\n\n/**\n * This module contains the Textarea component.\n * @module\n */\n\nexport interface TextareaBaseProps\n extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'id'> {\n /**\n * The ID of the FieldMessage that describes the textarea.\n */\n describedBy?: string\n /**\n * The unique id of the textarea.\n */\n id: string\n}\nexport type TextareaProps = InputVariantProps & TextareaBaseProps\n\n/**\n * A component that allows the user to input large blocks of text.\n * @see https://cerberus.digitalu.design/react/textarea\n */\nexport function Textarea(props: TextareaProps): JSX.Element {\n const { describedBy, ...nativeProps } = props\n const { invalid, ...fieldState } = useFieldContext()\n\n return (\n <textarea\n {...nativeProps}\n {...fieldState}\n {...(describedBy && { 'aria-describedby': describedBy })}\n {...(invalid && { 'aria-invalid': true })}\n className={cx(\n props.className,\n input().input,\n css({\n pxi: '2',\n py: '2',\n resize: 'vertical',\n }),\n )}\n rows={4}\n />\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,iBAAwB;AACxB,qBAA8C;;;ACF9C,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;;;ADpCI,IAAAA,sBAAA;AALG,SAAS,SAAS,OAAmC;AAC1D,QAAM,EAAE,aAAa,GAAG,YAAY,IAAI;AACxC,QAAM,EAAE,SAAS,GAAG,WAAW,IAAI,gBAAgB;AAEnD,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACH,GAAG;AAAA,MACH,GAAI,eAAe,EAAE,oBAAoB,YAAY;AAAA,MACrD,GAAI,WAAW,EAAE,gBAAgB,KAAK;AAAA,MACvC,eAAW;AAAA,QACT,MAAM;AAAA,YACN,sBAAM,EAAE;AAAA,YACR,gBAAI;AAAA,UACF,KAAK;AAAA,UACL,IAAI;AAAA,UACJ,QAAQ;AAAA,QACV,CAAC;AAAA,MACH;AAAA,MACA,MAAM;AAAA;AAAA,EACR;AAEJ;","names":["import_jsx_runtime"]}
@@ -1,101 +0,0 @@
1
- "use strict";
2
- "use client";
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
-
21
- // src/components/Toggle.tsx
22
- var Toggle_exports = {};
23
- __export(Toggle_exports, {
24
- Toggle: () => Toggle
25
- });
26
- module.exports = __toCommonJS(Toggle_exports);
27
- var import_css = require("@cerberus/styled-system/css");
28
- var import_patterns = require("@cerberus/styled-system/patterns");
29
- var import_recipes = require("@cerberus/styled-system/recipes");
30
-
31
- // src/context/field.tsx
32
- var import_react = require("react");
33
- var import_jsx_runtime = require("react/jsx-runtime");
34
- var FieldContext = (0, import_react.createContext)(null);
35
- function useFieldContext() {
36
- const context = (0, import_react.useContext)(FieldContext);
37
- if (!context) {
38
- throw new Error("useFieldContext must be used within a Field Provider.");
39
- }
40
- return context;
41
- }
42
-
43
- // src/context/cerberus.tsx
44
- var import_react2 = require("react");
45
- var import_jsx_runtime2 = require("react/jsx-runtime");
46
- var CerberusContext = (0, import_react2.createContext)(null);
47
- function useCerberusContext() {
48
- const context = (0, import_react2.useContext)(CerberusContext);
49
- if (!context) {
50
- throw new Error("useCerberus must be used within a CerberusProvider");
51
- }
52
- return context;
53
- }
54
-
55
- // src/components/Toggle.tsx
56
- var import_jsx_runtime3 = require("react/jsx-runtime");
57
- function Toggle(props) {
58
- const { size, describedBy, ...nativeProps } = props;
59
- const styles = (0, import_recipes.toggle)({ size });
60
- const { invalid, ...state } = useFieldContext();
61
- const { icons } = useCerberusContext();
62
- const CheckedIcon = icons.toggleChecked;
63
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
64
- "span",
65
- {
66
- className: (0, import_css.cx)("group", styles.track, (0, import_patterns.hstack)()),
67
- "data-checked": props.checked || props.defaultChecked,
68
- children: [
69
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
70
- "input",
71
- {
72
- ...nativeProps,
73
- ...state,
74
- ...describedBy && { "aria-describedby": describedBy },
75
- ...invalid && { "aria-invalid": true },
76
- className: (0, import_css.cx)("peer", styles.input),
77
- role: "switch",
78
- type: "checkbox"
79
- }
80
- ),
81
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
82
- "span",
83
- {
84
- className: (0, import_css.cx)(
85
- styles.thumb,
86
- (0, import_patterns.vstack)({
87
- justify: "center"
88
- })
89
- ),
90
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(CheckedIcon, {})
91
- }
92
- )
93
- ]
94
- }
95
- );
96
- }
97
- // Annotate the CommonJS export names for ESM import in node:
98
- 0 && (module.exports = {
99
- Toggle
100
- });
101
- //# sourceMappingURL=Toggle.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/components/Toggle.tsx","../../../src/context/field.tsx","../../../src/context/cerberus.tsx"],"sourcesContent":["'use client'\n\nimport { cx } from '@cerberus/styled-system/css'\nimport { hstack, vstack } from '@cerberus/styled-system/patterns'\nimport {\n toggle,\n type ToggleVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport type { InputHTMLAttributes } from 'react'\nimport { useFieldContext } from '../context/field'\nimport { useCerberusContext } from '../context/cerberus'\n\n/**\n * This module provides a toggle component.\n * @module\n */\n\nexport type ToggleBase = Omit<\n InputHTMLAttributes<HTMLInputElement>,\n 'size' | 'id' | 'value'\n> & {\n /**\n * The FieldMessage providing context for the Toggle.\n */\n describedBy?: string\n /**\n * A unique identifier for the Toggle. Required for accessibility.\n */\n id: string\n /**\n * The value of the Toggle.\n */\n value: string\n}\nexport type ToggleProps = ToggleBase & ToggleVariantProps\n\n/**\n * The Toggle component is used to switch between two states. Optionally\n * combine with the `useToggle` hook.\n * @see https://cerberus.digitalu.design/react/toggle\n * @example\n * ```tsx\n * const { checked, handleChange } = useToggle({ checked: 'toggle' })\n *\n * <Hstack justify=\"space-between\" w=\"full\">\n * <Field>\n * <Label htmlFor=\"toggle\">Show notifications</Label>\n * <Toggle\n * checked={checked === 'toggle'}\n * id=\"toggle\"\n * onChange={handleChange}\n * value=\"toggle\"\n * />\n * </Field>\n * </Hstack>\n * ```\n */\nexport function Toggle(props: ToggleProps) {\n const { size, describedBy, ...nativeProps } = props\n const styles = toggle({ size })\n const { invalid, ...state } = useFieldContext()\n const { icons } = useCerberusContext()\n const CheckedIcon = icons.toggleChecked\n\n return (\n <span\n className={cx('group', styles.track, hstack())}\n data-checked={props.checked || props.defaultChecked}\n >\n <input\n {...nativeProps}\n {...state}\n {...(describedBy && { 'aria-describedby': describedBy })}\n {...(invalid && { 'aria-invalid': true })}\n className={cx('peer', styles.input)}\n role=\"switch\"\n type=\"checkbox\"\n />\n <span\n className={cx(\n styles.thumb,\n vstack({\n justify: 'center',\n }),\n )}\n >\n <CheckedIcon />\n </span>\n </span>\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,iBAAmB;AACnB,sBAA+B;AAC/B,qBAGO;;;ACLP,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,gBAAkE;AAyB9D,IAAAC,sBAAA;AAfJ,IAAM,sBAAkB,6BAA2C,IAAI;AAyBhE,SAAS,qBAAqB;AACnC,QAAM,cAAU,0BAAW,eAAe;AAC1C,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,oDAAoD;AAAA,EACtE;AACA,SAAO;AACT;;;AFsBI,IAAAC,sBAAA;AARG,SAAS,OAAO,OAAoB;AACzC,QAAM,EAAE,MAAM,aAAa,GAAG,YAAY,IAAI;AAC9C,QAAM,aAAS,uBAAO,EAAE,KAAK,CAAC;AAC9B,QAAM,EAAE,SAAS,GAAG,MAAM,IAAI,gBAAgB;AAC9C,QAAM,EAAE,MAAM,IAAI,mBAAmB;AACrC,QAAM,cAAc,MAAM;AAE1B,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAW,eAAG,SAAS,OAAO,WAAO,wBAAO,CAAC;AAAA,MAC7C,gBAAc,MAAM,WAAW,MAAM;AAAA,MAErC;AAAA;AAAA,UAAC;AAAA;AAAA,YACE,GAAG;AAAA,YACH,GAAG;AAAA,YACH,GAAI,eAAe,EAAE,oBAAoB,YAAY;AAAA,YACrD,GAAI,WAAW,EAAE,gBAAgB,KAAK;AAAA,YACvC,eAAW,eAAG,QAAQ,OAAO,KAAK;AAAA,YAClC,MAAK;AAAA,YACL,MAAK;AAAA;AAAA,QACP;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,eAAW;AAAA,cACT,OAAO;AAAA,kBACP,wBAAO;AAAA,gBACL,SAAS;AAAA,cACX,CAAC;AAAA,YACH;AAAA,YAEA,uDAAC,eAAY;AAAA;AAAA,QACf;AAAA;AAAA;AAAA,EACF;AAEJ;","names":["import_react","import_jsx_runtime","import_jsx_runtime"]}