@cerberus-design/react 0.15.0-next-e0ce56e → 0.15.0-next-5d7dc1e

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 (246) hide show
  1. package/build/legacy/_tsup-dts-rollup.d.cts +491 -119
  2. package/build/legacy/components/DatePicker.client.cjs +67 -89
  3. package/build/legacy/components/DatePicker.client.cjs.map +1 -1
  4. package/build/legacy/components/Fieldset.cjs +4 -17
  5. package/build/legacy/components/Fieldset.cjs.map +1 -1
  6. package/build/legacy/components/FieldsetLabel.cjs.map +1 -1
  7. package/build/legacy/components/FileStatus.cjs +126 -79
  8. package/build/legacy/components/FileStatus.cjs.map +1 -1
  9. package/build/legacy/components/Legend.cjs +10 -22
  10. package/build/legacy/components/Legend.cjs.map +1 -1
  11. package/build/legacy/components/Radio.cjs +4 -21
  12. package/build/legacy/components/Radio.cjs.map +1 -1
  13. package/build/legacy/components/Select.cjs +19 -54
  14. package/build/legacy/components/Select.cjs.map +1 -1
  15. package/build/legacy/components/Toggle.cjs +17 -24
  16. package/build/legacy/components/Toggle.cjs.map +1 -1
  17. package/build/legacy/components/button/button.cjs +1 -1
  18. package/build/legacy/components/button/button.cjs.map +1 -1
  19. package/build/legacy/components/button/index.cjs +1 -1
  20. package/build/legacy/components/button/index.cjs.map +1 -1
  21. package/build/legacy/components/button/parts.cjs +1 -1
  22. package/build/legacy/components/button/parts.cjs.map +1 -1
  23. package/build/legacy/components/checkbox/checkbox-icon.cjs +121 -0
  24. package/build/legacy/components/checkbox/checkbox-icon.cjs.map +1 -0
  25. package/build/legacy/components/checkbox/checkbox.cjs +165 -0
  26. package/build/legacy/components/checkbox/checkbox.cjs.map +1 -0
  27. package/build/legacy/components/checkbox/index.cjs +179 -0
  28. package/build/legacy/components/checkbox/index.cjs.map +1 -0
  29. package/build/legacy/components/checkbox/parts.cjs +89 -0
  30. package/build/legacy/components/checkbox/parts.cjs.map +1 -0
  31. package/build/legacy/components/checkbox/primitives.cjs +87 -0
  32. package/build/legacy/components/checkbox/primitives.cjs.map +1 -0
  33. package/build/legacy/components/{FieldMessage.cjs → deprecated/FieldMessage.cjs} +4 -17
  34. package/build/legacy/components/deprecated/FieldMessage.cjs.map +1 -0
  35. package/build/legacy/components/{Textarea.cjs → deprecated/Label.cjs} +24 -36
  36. package/build/legacy/components/deprecated/Label.cjs.map +1 -0
  37. package/build/legacy/components/field/field.cjs +130 -0
  38. package/build/legacy/components/field/field.cjs.map +1 -0
  39. package/build/legacy/components/field/index.cjs +267 -0
  40. package/build/legacy/components/field/index.cjs.map +1 -0
  41. package/build/legacy/components/field/parts.cjs +188 -0
  42. package/build/legacy/components/field/parts.cjs.map +1 -0
  43. package/build/legacy/components/field/primitives.cjs +191 -0
  44. package/build/legacy/components/field/primitives.cjs.map +1 -0
  45. package/build/legacy/components/field/start-indicator.cjs +45 -0
  46. package/build/legacy/components/field/start-indicator.cjs.map +1 -0
  47. package/build/legacy/components/field/status-indicator.cjs +78 -0
  48. package/build/legacy/components/field/status-indicator.cjs.map +1 -0
  49. package/build/legacy/components/for.cjs +38 -0
  50. package/build/legacy/components/for.cjs.map +1 -0
  51. package/build/legacy/context/confirm-modal.cjs +1 -1
  52. package/build/legacy/context/confirm-modal.cjs.map +1 -1
  53. package/build/legacy/context/cta-modal.cjs +1 -1
  54. package/build/legacy/context/cta-modal.cjs.map +1 -1
  55. package/build/legacy/context/field.cjs +23 -4
  56. package/build/legacy/context/field.cjs.map +1 -1
  57. package/build/legacy/context/notification-center.cjs.map +1 -1
  58. package/build/legacy/context/prompt-modal.cjs +168 -166
  59. package/build/legacy/context/prompt-modal.cjs.map +1 -1
  60. package/build/legacy/hooks/useDate.cjs.map +1 -1
  61. package/build/legacy/index.cjs +1274 -1123
  62. package/build/legacy/index.cjs.map +1 -1
  63. package/build/legacy/utils/index.cjs +22 -2
  64. package/build/legacy/utils/index.cjs.map +1 -1
  65. package/build/modern/_tsup-dts-rollup.d.ts +491 -119
  66. package/build/modern/{chunk-2JX27W6Y.js → chunk-2BIHLH4V.js} +2 -2
  67. package/build/modern/chunk-2BIHLH4V.js.map +1 -0
  68. package/build/modern/{chunk-3ZDFQO25.js → chunk-6EUC3SUI.js} +4 -7
  69. package/build/modern/chunk-6EUC3SUI.js.map +1 -0
  70. package/build/modern/chunk-6I2FW4WI.js +33 -0
  71. package/build/modern/chunk-6I2FW4WI.js.map +1 -0
  72. package/build/modern/{chunk-MER66QUY.js → chunk-6KZVE4HC.js} +1 -1
  73. package/build/modern/{chunk-MER66QUY.js.map → chunk-6KZVE4HC.js.map} +1 -1
  74. package/build/modern/{chunk-FTPZHG6J.js → chunk-6WOJAMZV.js} +3 -9
  75. package/build/modern/chunk-6WOJAMZV.js.map +1 -0
  76. package/build/modern/chunk-77FJSNGD.js +13 -0
  77. package/build/modern/chunk-77FJSNGD.js.map +1 -0
  78. package/build/modern/chunk-BL7G3577.js +29 -0
  79. package/build/modern/chunk-BL7G3577.js.map +1 -0
  80. package/build/modern/chunk-BPRF34DU.js +62 -0
  81. package/build/modern/chunk-BPRF34DU.js.map +1 -0
  82. package/build/modern/{chunk-7P7OWBGV.js → chunk-CF3EHG42.js} +10 -10
  83. package/build/modern/chunk-CF3EHG42.js.map +1 -0
  84. package/build/modern/{chunk-Q4IV5NUT.js → chunk-CMYD5KWA.js} +40 -43
  85. package/build/modern/chunk-CMYD5KWA.js.map +1 -0
  86. package/build/modern/chunk-CNA2VKAH.js +43 -0
  87. package/build/modern/chunk-CNA2VKAH.js.map +1 -0
  88. package/build/modern/chunk-EL4MX2PG.js +22 -0
  89. package/build/modern/chunk-EL4MX2PG.js.map +1 -0
  90. package/build/modern/chunk-FBS7AX76.js +37 -0
  91. package/build/modern/chunk-FBS7AX76.js.map +1 -0
  92. package/build/modern/{chunk-KU2AWAK3.js → chunk-FK52US7K.js} +7 -20
  93. package/build/modern/chunk-FK52US7K.js.map +1 -0
  94. package/build/modern/{chunk-Z7FGXAND.js → chunk-FMRWRVUS.js} +2 -2
  95. package/build/modern/{chunk-XQICKZH4.js → chunk-GENS32QO.js} +10 -8
  96. package/build/modern/chunk-GENS32QO.js.map +1 -0
  97. package/build/modern/{chunk-7S47NSGR.js → chunk-H54FR7IP.js} +2 -2
  98. package/build/modern/chunk-KWZ3CEG6.js +23 -0
  99. package/build/modern/chunk-KWZ3CEG6.js.map +1 -0
  100. package/build/modern/{chunk-JWIJHSI6.js → chunk-L7N24B6B.js} +3 -6
  101. package/build/modern/chunk-L7N24B6B.js.map +1 -0
  102. package/build/modern/chunk-LT62577B.js +23 -0
  103. package/build/modern/chunk-LT62577B.js.map +1 -0
  104. package/build/modern/{chunk-3BM6MZ4A.js → chunk-MWRO5QYD.js} +1 -1
  105. package/build/modern/chunk-MWRO5QYD.js.map +1 -0
  106. package/build/modern/{chunk-PZAZKQMO.js → chunk-OYT7RGC7.js} +1 -1
  107. package/build/modern/chunk-OYT7RGC7.js.map +1 -0
  108. package/build/modern/{chunk-ILQW5VZT.js → chunk-RBNOEAWJ.js} +4 -7
  109. package/build/modern/chunk-RBNOEAWJ.js.map +1 -0
  110. package/build/modern/{chunk-5QONP7GT.js → chunk-S2X5OEPK.js} +2 -10
  111. package/build/modern/chunk-S2X5OEPK.js.map +1 -0
  112. package/build/modern/chunk-TIJAFPHQ.js +1 -0
  113. package/build/modern/chunk-TYPULJMJ.js +1 -0
  114. package/build/modern/chunk-UNN4LHRS.js +31 -0
  115. package/build/modern/chunk-UNN4LHRS.js.map +1 -0
  116. package/build/modern/chunk-VSTOSLFS.js +100 -0
  117. package/build/modern/chunk-VSTOSLFS.js.map +1 -0
  118. package/build/modern/chunk-Z52R6ABJ.js +21 -0
  119. package/build/modern/chunk-Z52R6ABJ.js.map +1 -0
  120. package/build/modern/{chunk-3RGRHMJQ.js → chunk-ZDANBCM3.js} +2 -2
  121. package/build/modern/components/AccordionItemGroup.js +1 -1
  122. package/build/modern/components/DatePicker.client.js +4 -5
  123. package/build/modern/components/Fieldset.js +1 -2
  124. package/build/modern/components/FieldsetLabel.js +1 -1
  125. package/build/modern/components/FileStatus.js +10 -4
  126. package/build/modern/components/Legend.js +1 -2
  127. package/build/modern/components/Radio.js +1 -3
  128. package/build/modern/components/Select.js +1 -2
  129. package/build/modern/components/Toggle.js +1 -2
  130. package/build/modern/components/button/button.js +1 -1
  131. package/build/modern/components/button/index.js +2 -2
  132. package/build/modern/components/button/parts.js +2 -2
  133. package/build/modern/components/checkbox/checkbox-icon.js +12 -0
  134. package/build/modern/components/checkbox/checkbox.js +13 -0
  135. package/build/modern/components/checkbox/index.js +30 -0
  136. package/build/modern/components/checkbox/parts.js +8 -0
  137. package/build/modern/components/checkbox/parts.js.map +1 -0
  138. package/build/modern/components/checkbox/primitives.js +17 -0
  139. package/build/modern/components/checkbox/primitives.js.map +1 -0
  140. package/build/modern/components/deprecated/FieldMessage.js +8 -0
  141. package/build/modern/components/deprecated/FieldMessage.js.map +1 -0
  142. package/build/modern/components/deprecated/Label.js +17 -0
  143. package/build/modern/components/deprecated/Label.js.map +1 -0
  144. package/build/modern/components/field/field.js +14 -0
  145. package/build/modern/components/field/field.js.map +1 -0
  146. package/build/modern/components/field/index.js +44 -0
  147. package/build/modern/components/field/index.js.map +1 -0
  148. package/build/modern/components/field/parts.js +11 -0
  149. package/build/modern/components/field/parts.js.map +1 -0
  150. package/build/modern/components/field/primitives.js +26 -0
  151. package/build/modern/components/field/primitives.js.map +1 -0
  152. package/build/modern/components/field/start-indicator.js +7 -0
  153. package/build/modern/components/field/start-indicator.js.map +1 -0
  154. package/build/modern/components/field/status-indicator.js +9 -0
  155. package/build/modern/components/field/status-indicator.js.map +1 -0
  156. package/build/modern/components/for.js +7 -0
  157. package/build/modern/components/for.js.map +1 -0
  158. package/build/modern/context/confirm-modal.js +3 -3
  159. package/build/modern/context/cta-modal.js +4 -4
  160. package/build/modern/context/field.js +34 -4
  161. package/build/modern/context/field.js.map +1 -1
  162. package/build/modern/context/notification-center.js +2 -2
  163. package/build/modern/context/prompt-modal.js +12 -7
  164. package/build/modern/hooks/useDate.js +1 -1
  165. package/build/modern/index.js +131 -82
  166. package/build/modern/index.js.map +1 -1
  167. package/build/modern/utils/index.js +5 -3
  168. package/package.json +2 -2
  169. package/src/components/DatePicker.client.tsx +2 -14
  170. package/src/components/Fieldset.tsx +3 -3
  171. package/src/components/FieldsetLabel.tsx +5 -2
  172. package/src/components/FileStatus.tsx +4 -5
  173. package/src/components/Legend.tsx +5 -6
  174. package/src/components/Radio.tsx +2 -7
  175. package/src/components/Select.tsx +1 -16
  176. package/src/components/Toggle.tsx +14 -7
  177. package/src/components/button/button.tsx +1 -1
  178. package/src/components/button/parts.ts +6 -0
  179. package/src/components/checkbox/checkbox-icon.tsx +39 -0
  180. package/src/components/checkbox/checkbox.tsx +48 -0
  181. package/src/components/checkbox/index.ts +3 -0
  182. package/src/components/checkbox/parts.ts +59 -0
  183. package/src/components/checkbox/primitives.tsx +104 -0
  184. package/src/components/{FieldMessage.tsx → deprecated/FieldMessage.tsx} +2 -13
  185. package/src/components/deprecated/Label.tsx +24 -0
  186. package/src/components/field/field.tsx +77 -0
  187. package/src/components/field/index.ts +5 -0
  188. package/src/components/field/parts.ts +77 -0
  189. package/src/components/field/primitives.tsx +204 -0
  190. package/src/components/field/start-indicator.tsx +23 -0
  191. package/src/components/field/status-indicator.tsx +58 -0
  192. package/src/components/for.tsx +43 -0
  193. package/src/context/field.tsx +6 -5
  194. package/src/context/prompt-modal.tsx +16 -18
  195. package/src/hooks/useDate.ts +1 -7
  196. package/src/index.ts +6 -7
  197. package/src/utils/index.ts +30 -0
  198. package/build/legacy/components/Checkbox.cjs +0 -113
  199. package/build/legacy/components/Checkbox.cjs.map +0 -1
  200. package/build/legacy/components/FieldMessage.cjs.map +0 -1
  201. package/build/legacy/components/Input.cjs +0 -95
  202. package/build/legacy/components/Input.cjs.map +0 -1
  203. package/build/legacy/components/Label.cjs +0 -93
  204. package/build/legacy/components/Label.cjs.map +0 -1
  205. package/build/legacy/components/Textarea.cjs.map +0 -1
  206. package/build/modern/chunk-2JX27W6Y.js.map +0 -1
  207. package/build/modern/chunk-3BM6MZ4A.js.map +0 -1
  208. package/build/modern/chunk-3ZDFQO25.js.map +0 -1
  209. package/build/modern/chunk-5QONP7GT.js.map +0 -1
  210. package/build/modern/chunk-7P7OWBGV.js.map +0 -1
  211. package/build/modern/chunk-C5EHJUS5.js +0 -10
  212. package/build/modern/chunk-C5EHJUS5.js.map +0 -1
  213. package/build/modern/chunk-FTPZHG6J.js.map +0 -1
  214. package/build/modern/chunk-ILQW5VZT.js.map +0 -1
  215. package/build/modern/chunk-JIJM6JFJ.js +0 -36
  216. package/build/modern/chunk-JIJM6JFJ.js.map +0 -1
  217. package/build/modern/chunk-JWIJHSI6.js.map +0 -1
  218. package/build/modern/chunk-KU2AWAK3.js.map +0 -1
  219. package/build/modern/chunk-NGOLRISW.js +0 -63
  220. package/build/modern/chunk-NGOLRISW.js.map +0 -1
  221. package/build/modern/chunk-NMF2HYWO.js +0 -50
  222. package/build/modern/chunk-NMF2HYWO.js.map +0 -1
  223. package/build/modern/chunk-PZAZKQMO.js.map +0 -1
  224. package/build/modern/chunk-Q4IV5NUT.js.map +0 -1
  225. package/build/modern/chunk-UZDVOIW5.js +0 -33
  226. package/build/modern/chunk-UZDVOIW5.js.map +0 -1
  227. package/build/modern/chunk-VYCU7I4J.js +0 -43
  228. package/build/modern/chunk-VYCU7I4J.js.map +0 -1
  229. package/build/modern/chunk-XQICKZH4.js.map +0 -1
  230. package/build/modern/components/Checkbox.js +0 -11
  231. package/build/modern/components/FieldMessage.js +0 -9
  232. package/build/modern/components/Input.js +0 -11
  233. package/build/modern/components/Label.js +0 -10
  234. package/build/modern/components/Textarea.js +0 -9
  235. package/src/components/Checkbox.tsx +0 -93
  236. package/src/components/Input.tsx +0 -69
  237. package/src/components/Label.tsx +0 -69
  238. package/src/components/Textarea.tsx +0 -52
  239. /package/build/modern/{chunk-Z7FGXAND.js.map → chunk-FMRWRVUS.js.map} +0 -0
  240. /package/build/modern/{chunk-7S47NSGR.js.map → chunk-H54FR7IP.js.map} +0 -0
  241. /package/build/modern/{components/Checkbox.js.map → chunk-TIJAFPHQ.js.map} +0 -0
  242. /package/build/modern/{components/FieldMessage.js.map → chunk-TYPULJMJ.js.map} +0 -0
  243. /package/build/modern/{chunk-3RGRHMJQ.js.map → chunk-ZDANBCM3.js.map} +0 -0
  244. /package/build/modern/components/{Input.js.map → checkbox/checkbox-icon.js.map} +0 -0
  245. /package/build/modern/components/{Label.js.map → checkbox/checkbox.js.map} +0 -0
  246. /package/build/modern/components/{Textarea.js.map → checkbox/index.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/field/field.tsx"],"sourcesContent":["import { type FieldRootProps } from '@ark-ui/react/field'\nimport { splitProps } from '../../utils/index'\nimport {\n FieldErrorText,\n FieldHelperText,\n FieldLabel,\n FieldRoot,\n} from './primitives'\nimport { HStack } from '@cerberus/styled-system/jsx'\nimport { Show } from '../Show'\n\nexport interface FieldProps extends FieldRootProps {\n /**\n * The label of the field.\n */\n label?: string\n /**\n * The helper text of the field.\n */\n helperText?: string\n /**\n * A helper text positioned at the end of the field. Good for Textarea fields.\n */\n secondaryHelperText?: string\n /**\n * The error text of the field. Shown when the field is invalid.\n */\n errorText?: string\n}\n\n/**\n * The Field component is the context provider for all FieldParts and displays\n * the label, helperText, and ErrorText.\n * @description [Field Docs](https://cerberus.digitalu.design/react/field)\n * @example\n * ```tsx\n * <Field\n * ids={{\n * control: 'firstName',\n * }}\n * label=\"Label\"\n * helperText=\"This is what people will see on your profile.\"\n * errorText=\"A first name is required to create an account.\"\n * required\n * >\n * <Input name=\"firstName\" type=\"text\" />\n * </Field>\n * ```\n */\nexport function Field(props: FieldProps) {\n const [statusProps, fieldProps, rootProps] = splitProps(\n props,\n ['disabled', 'required', 'readOnly', 'invalid'],\n ['label', 'helperText', 'secondaryHelperText', 'errorText', 'children'],\n )\n\n return (\n <FieldRoot {...statusProps} {...rootProps}>\n <Show when={Boolean(fieldProps.label)}>\n <FieldLabel>{fieldProps.label}</FieldLabel>\n </Show>\n\n {fieldProps.children}\n\n <Show when={Boolean(fieldProps.helperText && !statusProps.invalid)}>\n <HStack justifyContent=\"space-between\" w=\"full\">\n <FieldHelperText>{fieldProps.helperText}</FieldHelperText>\n <Show when={Boolean(fieldProps.secondaryHelperText)}>\n <FieldHelperText>{fieldProps.secondaryHelperText}</FieldHelperText>\n </Show>\n </HStack>\n </Show>\n\n <FieldErrorText>{fieldProps.errorText}</FieldErrorText>\n </FieldRoot>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;AAQA,SAAS,cAAc;AAmDf,cAMA,YANA;AAVD,SAAS,MAAM,OAAmB;AACvC,QAAM,CAAC,aAAa,YAAY,SAAS,IAAI;AAAA,IAC3C;AAAA,IACA,CAAC,YAAY,YAAY,YAAY,SAAS;AAAA,IAC9C,CAAC,SAAS,cAAc,uBAAuB,aAAa,UAAU;AAAA,EACxE;AAEA,SACE,qBAAC,aAAW,GAAG,aAAc,GAAG,WAC9B;AAAA,wBAAC,QAAK,MAAM,QAAQ,WAAW,KAAK,GAClC,8BAAC,cAAY,qBAAW,OAAM,GAChC;AAAA,IAEC,WAAW;AAAA,IAEZ,oBAAC,QAAK,MAAM,QAAQ,WAAW,cAAc,CAAC,YAAY,OAAO,GAC/D,+BAAC,UAAO,gBAAe,iBAAgB,GAAE,QACvC;AAAA,0BAAC,mBAAiB,qBAAW,YAAW;AAAA,MACxC,oBAAC,QAAK,MAAM,QAAQ,WAAW,mBAAmB,GAChD,8BAAC,mBAAiB,qBAAW,qBAAoB,GACnD;AAAA,OACF,GACF;AAAA,IAEA,oBAAC,kBAAgB,qBAAW,WAAU;AAAA,KACxC;AAEJ;","names":[]}
@@ -1,6 +1,9 @@
1
1
  import {
2
- useFieldContext
3
- } from "./chunk-UZDVOIW5.js";
2
+ Portal
3
+ } from "./chunk-IQJDVFPP.js";
4
+ import {
5
+ IconButton
6
+ } from "./chunk-APD6IX5R.js";
4
7
  import {
5
8
  DatePickerContext,
6
9
  DatePickerTable,
@@ -10,18 +13,12 @@ import {
10
13
  DatePickerView,
11
14
  DatePickerViewControl
12
15
  } from "./chunk-5EWCH7AI.js";
13
- import {
14
- IconButton
15
- } from "./chunk-APD6IX5R.js";
16
- import {
17
- Portal
18
- } from "./chunk-IQJDVFPP.js";
19
16
  import {
20
17
  useCerberusContext
21
18
  } from "./chunk-GITT5645.js";
22
19
  import {
23
20
  Button
24
- } from "./chunk-MER66QUY.js";
21
+ } from "./chunk-6KZVE4HC.js";
25
22
 
26
23
  // src/components/DatePicker.client.tsx
27
24
  import {
@@ -33,12 +30,10 @@ import { useMemo } from "react";
33
30
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
34
31
  var datePickerStyles = datePicker();
35
32
  function DatePicker(props) {
36
- const states = useFieldContext();
37
33
  return /* @__PURE__ */ jsx(
38
34
  ArkDP.Root,
39
35
  {
40
36
  ...props,
41
- ...states,
42
37
  positioning: {
43
38
  placement: "bottom-start"
44
39
  }
@@ -86,15 +81,12 @@ function DatePickerTrigger(props) {
86
81
  );
87
82
  }
88
83
  function DatePickerInput(props) {
89
- const { invalid, ...fieldStates } = useFieldContext();
90
84
  return /* @__PURE__ */ jsxs(ArkDP.Control, { className: datePickerStyles.control, children: [
91
85
  /* @__PURE__ */ jsx(DatePickerTrigger, {}),
92
86
  /* @__PURE__ */ jsx(
93
87
  ArkDP.Input,
94
88
  {
95
89
  ...props,
96
- ...fieldStates,
97
- ...invalid && { "aria-invalid": true },
98
90
  className: cx(props.className, datePickerStyles.input),
99
91
  placeholder: props.placeholder ?? "DD MMM YYYY",
100
92
  maxLength: 11
@@ -103,7 +95,6 @@ function DatePickerInput(props) {
103
95
  ] });
104
96
  }
105
97
  function RangePickerInput(props) {
106
- const { invalid, ...fieldStates } = useFieldContext();
107
98
  const { defaultValue, ...nativeProps } = props;
108
99
  const startDate = useMemo(() => defaultValue?.[0], [defaultValue]);
109
100
  const endDate = useMemo(() => defaultValue?.[1], [defaultValue]);
@@ -113,8 +104,6 @@ function RangePickerInput(props) {
113
104
  ArkDP.Input,
114
105
  {
115
106
  ...nativeProps,
116
- ...fieldStates,
117
- ...invalid && { "aria-invalid": true },
118
107
  "data-range-input": true,
119
108
  defaultValue: startDate,
120
109
  className: cx(props.className, datePickerStyles.input),
@@ -127,8 +116,6 @@ function RangePickerInput(props) {
127
116
  ArkDP.Input,
128
117
  {
129
118
  ...nativeProps,
130
- ...fieldStates,
131
- ...invalid && { "aria-invalid": true },
132
119
  "data-range-input": true,
133
120
  defaultValue: endDate,
134
121
  "data-range-end-input": true,
@@ -214,4 +201,4 @@ export {
214
201
  DatePickerYearView,
215
202
  DatePickerCalendar
216
203
  };
217
- //# sourceMappingURL=chunk-KU2AWAK3.js.map
204
+ //# sourceMappingURL=chunk-FK52US7K.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/DatePicker.client.tsx"],"sourcesContent":["'use client'\n\nimport {\n DatePicker as ArkDP,\n type DatePickerContentProps,\n type DatePickerInputProps,\n type DatePickerRootProps,\n type DatePickerTriggerProps,\n type DatePickerViewControlProps,\n type DatePickerViewProps,\n} from '@ark-ui/react'\nimport { Portal } from './Portal'\nimport { datePicker, iconButton } from '@cerberus/styled-system/recipes'\nimport { css, cx } from '@cerberus/styled-system/css'\nimport {\n DatePickerView,\n DatePickerContext,\n DatePickerTable,\n DatePickerTableHeader,\n DatePickerTableCellTrigger,\n DatePickerTableCell,\n DatePickerViewControl,\n} from './DatePicker.server'\nimport { IconButton } from './IconButton'\nimport { Button } from './button/button'\nimport { useCerberusContext } from '../context/cerberus'\nimport { useMemo, type InputHTMLAttributes } from 'react'\n\n/**\n * This module contains the DatePicker client family components.\n * @module DatePicker:client\n */\n\n// We are not exposing this to the public API\nconst datePickerStyles = datePicker()\n\n/**\n * The main context provider for the DatePicker family components.\n * @definition [Date Picker docs](https://cerberus.digitalu.design/react/date-picker)\n * @example\n * ```tsx\n * <Field>\n * <DatePicker name=\"start_date\">\n * <DatePickerLabel>Start date</DatePickerLabel>\n * <DatePickerInput />\n * <DatePickerCalendar />\n * </DatePicker>\n * </Field>\n * ```\n */\nexport function DatePicker(props: DatePickerRootProps) {\n // There is a bug with the Root component that causes random date selection\n // onBlur after the first selection if the format prop is used.\n // ref: https://github.com/chakra-ui/ark/issues/3112#event-16047829195\n\n // const handleFormat = useCallback((value: DateValue) => {\n // return formatISOToMilitary(value.toString())\n // }, [])\n\n return (\n <ArkDP.Root\n {...props}\n positioning={{\n placement: 'bottom-start',\n }}\n />\n )\n}\n\n/**\n * An abstraction of the DatePicker control that contains the prev, view, and\n * next triggers which control the calendar output.\n * @definition [datePicker docs](https://cerberus.digitalu.design/react/date-picker)\n * @example\n * ```tsx\n * <DatePickerViewControlGroup />\n * ```\n */\nexport function DatePickerViewControlGroup(props: DatePickerViewControlProps) {\n const { icons } = useCerberusContext()\n const { calendarPrev: PrevIcon, calendarNext: NextIcon } = icons\n return (\n <DatePickerViewControl {...props}>\n <ArkDP.PrevTrigger asChild>\n <IconButton ariaLabel=\"Previous\" size=\"sm\">\n <PrevIcon />\n </IconButton>\n </ArkDP.PrevTrigger>\n\n <ArkDP.ViewTrigger asChild>\n <Button\n className={css({\n h: '2rem',\n paddingInline: 'md',\n })}\n shape=\"rounded\"\n size=\"sm\"\n usage=\"ghost\"\n >\n <ArkDP.RangeText />\n </Button>\n </ArkDP.ViewTrigger>\n\n <ArkDP.NextTrigger asChild>\n <IconButton ariaLabel=\"Next\" size=\"sm\">\n <NextIcon />\n </IconButton>\n </ArkDP.NextTrigger>\n </DatePickerViewControl>\n )\n}\n\n/**\n * The trigger component for the DatePicker which opens the calendar.\n * @definition [datePicker docs](https://cerberus.digitalu.design/react/date-picker)\n * @example\n * ```tsx\n * <DatePickerTrigger />\n * ```\n */\nexport function DatePickerTrigger(props: DatePickerTriggerProps) {\n const { icons } = useCerberusContext()\n const { calendar: CalendarIcon } = icons\n return (\n <ArkDP.Trigger\n {...props}\n className={cx(\n props.className,\n iconButton({\n size: 'sm',\n usage: 'ghost',\n }),\n datePickerStyles.trigger,\n )}\n >\n <CalendarIcon />\n </ArkDP.Trigger>\n )\n}\n\n/**\n * The input component for the DatePicker.\n * @definition [Date Picker docs](https://cerberus.digitalu.design/react/date-picker)\n * @example\n * ```tsx\n * <Field>\n * <DatePicker name=\"start_date\">\n * <DatePickerLabel>Start date</DatePickerLabel>\n * <DatePickerInput />\n * <DatePickerCalendar />\n * </DatePicker>\n * </Field>\n * ```\n */\nexport function DatePickerInput(props: DatePickerInputProps) {\n return (\n <ArkDP.Control className={datePickerStyles.control}>\n <DatePickerTrigger />\n <ArkDP.Input\n {...props}\n className={cx(props.className, datePickerStyles.input)}\n placeholder={props.placeholder ?? 'DD MMM YYYY'}\n maxLength={11}\n />\n </ArkDP.Control>\n )\n}\n\nexport interface RangePickerInputProps\n extends Omit<DatePickerInputProps, 'defaultValue'> {\n /**\n * The defaultValue to add for the inputs. The first item is the start date\n * and the second item is the end date.\n */\n defaultValue?: [\n InputHTMLAttributes<HTMLInputElement>['defaultValue'],\n InputHTMLAttributes<HTMLInputElement>['defaultValue'],\n ]\n}\n\n/**\n * The input component for the DatePicker that uses ranges.\n * @definition [Date Picker docs](https://cerberus.digitalu.design/react/date-picker)\n * @example\n * ```tsx\n * <Field>\n * <DatePicker name=\"start_date\" selection=\"range\">\n * <DatePickerLabel>Start date</DatePickerLabel>\n * <RangePickerInput />\n * <DatePickerCalendar />\n * </DatePicker>\n * </Field>\n * ```\n */\nexport function RangePickerInput(props: RangePickerInputProps) {\n const { defaultValue, ...nativeProps } = props\n\n const startDate = useMemo(() => defaultValue?.[0], [defaultValue])\n const endDate = useMemo(() => defaultValue?.[1], [defaultValue])\n\n return (\n <ArkDP.Control data-range className={datePickerStyles.control}>\n <DatePickerTrigger />\n <ArkDP.Input\n {...nativeProps}\n data-range-input\n defaultValue={startDate}\n className={cx(props.className, datePickerStyles.input)}\n placeholder={props.placeholder ?? 'DD MMM YYYY'}\n maxLength={11}\n index={0}\n />\n <ArkDP.Input\n {...nativeProps}\n data-range-input\n defaultValue={endDate}\n data-range-end-input\n className={cx(props.className, datePickerStyles.input)}\n placeholder={props.placeholder ?? 'DD MMM YYYY'}\n maxLength={11}\n index={1}\n />\n </ArkDP.Control>\n )\n}\n\n/**\n * The content component for the DatePicker which contains the calendar.\n * @definition [Date Picker docs](https://cerberus.digitalu.design/react/date-picker)\n * @example\n * ```tsx\n * <Field>\n * <DatePicker name=\"start_date\">\n * <DatePickerLabel>Start date</DatePickerLabel>\n * <DatePickerInput />\n * <DatePickerCalendar />\n * </DatePicker>\n * </Field>\n * ```\n */\nexport function DatePickerContent(\n props: DatePickerContentProps & {\n withModal?: boolean\n },\n) {\n const { children, withModal, ...contentProps } = props\n return (\n <Portal disabled={withModal ?? false}>\n <ArkDP.Positioner className={datePickerStyles.positioner}>\n <ArkDP.Content\n {...contentProps}\n className={cx(contentProps.className, datePickerStyles.content)}\n >\n {children}\n </ArkDP.Content>\n </ArkDP.Positioner>\n </Portal>\n )\n}\n\n/**\n * The day view component for the DatePicker.\n * @definition [Date Picker docs](https://cerberus.digitalu.design/react/date-picker)\n * @example\n * ```tsx\n * <Field>\n * <DatePicker name=\"start_date\">\n * <DatePickerLabel>Start date</DatePickerLabel>\n * <DatePickerInput />\n * <DatePickerCalendar />\n * </DatePicker>\n * </Field>\n * ```\n */\nexport function DatePickerDayView(props: Omit<DatePickerViewProps, 'view'>) {\n function isToday(date: ArkDP.DateValue): boolean {\n const today = new Date()\n const formatted = today.toISOString().split('T')[0]\n const arkDate = `${date.year}-${String(date.month).padStart(2, '0')}-${String(date.day).padStart(2, '0')}`\n return formatted === arkDate\n }\n\n function isPastDay(date: ArkDP.DateValue): boolean {\n const today = new Date()\n const arkDate = `${date.year}-${String(date.month).padStart(2, '0')}-${String(date.day).padStart(2, '0')}`\n return new Date(arkDate) < today\n }\n\n function getDayValue(date: ArkDP.DateValue): 'today' | 'past' | 'future' {\n if (isToday(date)) return 'today'\n if (isPastDay(date)) return 'past'\n return 'future'\n }\n\n return (\n <DatePickerView {...props} view=\"day\">\n <DatePickerContext>\n {(datePicker) => (\n <>\n <DatePickerViewControlGroup />\n\n <DatePickerTable>\n <ArkDP.TableHead>\n <ArkDP.TableRow>\n {datePicker.weekDays.map((weekDay, id) => (\n <DatePickerTableHeader key={id}>\n {weekDay.narrow}\n </DatePickerTableHeader>\n ))}\n </ArkDP.TableRow>\n </ArkDP.TableHead>\n\n <ArkDP.TableBody>\n {datePicker.weeks.map((week, id) => (\n <ArkDP.TableRow key={id}>\n {week.map((day, id) => (\n <DatePickerTableCell key={id} value={day}>\n <DatePickerTableCellTrigger\n data-date={getDayValue(day)}\n >\n {day.day}\n </DatePickerTableCellTrigger>\n </DatePickerTableCell>\n ))}\n </ArkDP.TableRow>\n ))}\n </ArkDP.TableBody>\n </DatePickerTable>\n </>\n )}\n </DatePickerContext>\n </DatePickerView>\n )\n}\n\n/**\n * The month view component for the DatePicker.\n * @definition [Date Picker docs](https://cerberus.digitalu.design/react/date-picker)\n * @example\n * ```tsx\n * <Field>\n * <DatePicker name=\"start_date\">\n * <DatePickerLabel>Start date</DatePickerLabel>\n * <DatePickerInput />\n * <DatePickerCalendar />\n * </DatePicker>\n * </Field>\n * ```\n */\nexport function DatePickerMonthView(props: Omit<DatePickerViewProps, 'view'>) {\n return (\n <ArkDP.View {...props} view=\"month\">\n <ArkDP.Context>\n {(datePicker) => (\n <>\n <DatePickerViewControlGroup />\n\n <DatePickerTable>\n <ArkDP.TableBody>\n {datePicker\n .getMonthsGrid({ columns: 4, format: 'short' })\n .map((months, id) => (\n <ArkDP.TableRow key={id}>\n {months.map((month, id) => (\n <DatePickerTableCell key={id} value={month.value}>\n <DatePickerTableCellTrigger>\n {month.label}\n </DatePickerTableCellTrigger>\n </DatePickerTableCell>\n ))}\n </ArkDP.TableRow>\n ))}\n </ArkDP.TableBody>\n </DatePickerTable>\n </>\n )}\n </ArkDP.Context>\n </ArkDP.View>\n )\n}\n\n/**\n * The year view component for the DatePicker.\n * @definition [Date Picker docs](https://cerberus.digitalu.design/react/date-picker)\n * @example\n * ```tsx\n * <Field>\n * <DatePicker name=\"start_date\">\n * <DatePickerLabel>Start date</DatePickerLabel>\n * <DatePickerInput />\n * <DatePickerCalendar />\n * </DatePicker>\n * </Field>\n * ```\n */\nexport function DatePickerYearView(props: Omit<DatePickerViewProps, 'view'>) {\n return (\n <ArkDP.View {...props} view=\"year\">\n <ArkDP.Context>\n {(datePicker) => (\n <>\n <DatePickerViewControlGroup />\n\n <DatePickerTable>\n <ArkDP.TableBody>\n {datePicker.getYearsGrid({ columns: 4 }).map((years, id) => (\n <ArkDP.TableRow key={id}>\n {years.map((year, id) => (\n <DatePickerTableCell key={id} value={year.value}>\n <DatePickerTableCellTrigger>\n {year.label}\n </DatePickerTableCellTrigger>\n </DatePickerTableCell>\n ))}\n </ArkDP.TableRow>\n ))}\n </ArkDP.TableBody>\n </DatePickerTable>\n </>\n )}\n </ArkDP.Context>\n </ArkDP.View>\n )\n}\n\n/**\n * An abstraction of the DatePicker content components that contain the\n * different calendar views and controls.\n * @definition [Date Picker docs](https://cerberus.digitalu.design/react/date-picker)\n * @example\n * ```tsx\n * <Field>\n * <DatePicker name=\"start_date\">\n * <DatePickerLabel>Start date</DatePickerLabel>\n * <DatePickerInput />\n * <DatePickerCalendar />\n * </DatePicker>\n * </Field>\n * ```\n */\nexport function DatePickerCalendar(props: { withModal?: boolean }) {\n return (\n <DatePickerContent withModal={props.withModal}>\n <DatePickerDayView />\n <DatePickerMonthView />\n <DatePickerYearView />\n </DatePickerContent>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAEA;AAAA,EACE,cAAc;AAAA,OAOT;AAEP,SAAS,YAAY,kBAAkB;AACvC,SAAS,KAAK,UAAU;AAaxB,SAAS,eAAyC;AAkC9C,SA8OM,UA9ON,KAsBA,YAtBA;AA1BJ,IAAM,mBAAmB,WAAW;AAgB7B,SAAS,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AAAA,IACrB,oBAAC,sBAAmB;AAAA,KACtB;AAEJ;","names":["datePicker","id"]}
@@ -19,7 +19,7 @@ import {
19
19
  } from "./chunk-V3M3ZOQI.js";
20
20
  import {
21
21
  Button
22
- } from "./chunk-MER66QUY.js";
22
+ } from "./chunk-6KZVE4HC.js";
23
23
  import {
24
24
  Show
25
25
  } from "./chunk-BUVVRQLZ.js";
@@ -177,4 +177,4 @@ export {
177
177
  NotificationCenter,
178
178
  useNotificationCenter
179
179
  };
180
- //# sourceMappingURL=chunk-Z7FGXAND.js.map
180
+ //# sourceMappingURL=chunk-FMRWRVUS.js.map
@@ -1,11 +1,9 @@
1
- import {
2
- useFieldContext
3
- } from "./chunk-UZDVOIW5.js";
4
1
  import {
5
2
  useCerberusContext
6
3
  } from "./chunk-GITT5645.js";
7
4
 
8
5
  // src/components/Toggle.tsx
6
+ import { useFieldContext } from "@ark-ui/react/field";
9
7
  import { cx } from "@cerberus/styled-system/css";
10
8
  import { hstack, vstack } from "@cerberus/styled-system/patterns";
11
9
  import {
@@ -13,9 +11,9 @@ import {
13
11
  } from "@cerberus/styled-system/recipes";
14
12
  import { jsx, jsxs } from "react/jsx-runtime";
15
13
  function Toggle(props) {
16
- const { size, describedBy, ...nativeProps } = props;
14
+ const { size, ...nativeProps } = props;
17
15
  const styles = toggle({ size });
18
- const { invalid, ...state } = useFieldContext();
16
+ const { invalid, disabled, readOnly, required, ariaDescribedby } = useFieldContext();
19
17
  const { icons } = useCerberusContext();
20
18
  const CheckedIcon = icons.toggleChecked;
21
19
  return /* @__PURE__ */ jsxs(
@@ -28,8 +26,12 @@ function Toggle(props) {
28
26
  "input",
29
27
  {
30
28
  ...nativeProps,
31
- ...state,
32
- ...describedBy && { "aria-describedby": describedBy },
29
+ ...disabled && { disabled: true },
30
+ ...readOnly && { readOnly: true },
31
+ ...required && { required: true },
32
+ ...ariaDescribedby && {
33
+ "aria-describedby": ariaDescribedby
34
+ },
33
35
  ...invalid && { "aria-invalid": true },
34
36
  className: cx("peer", styles.input),
35
37
  role: "switch",
@@ -56,4 +58,4 @@ function Toggle(props) {
56
58
  export {
57
59
  Toggle
58
60
  };
59
- //# sourceMappingURL=chunk-XQICKZH4.js.map
61
+ //# sourceMappingURL=chunk-GENS32QO.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/Toggle.tsx"],"sourcesContent":["'use client'\n\nimport { useFieldContext } from '@ark-ui/react/field'\nimport type { InputHTMLAttributes } from 'react'\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 { 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 * @deprecated\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, ...nativeProps } = props\n const styles = toggle({ size })\n\n const { invalid, disabled, readOnly, required, ariaDescribedby } =\n useFieldContext()\n\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 {...(disabled && { disabled: true })}\n {...(readOnly && { readOnly: true })}\n {...(required && { required: true })}\n {...(ariaDescribedby && {\n 'aria-describedby': ariaDescribedby,\n })}\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"],"mappings":";;;;;AAEA,SAAS,uBAAuB;AAEhC,SAAS,UAAU;AACnB,SAAS,QAAQ,cAAc;AAC/B;AAAA,EACE;AAAA,OAEK;AA2DH,SAIE,KAJF;AAXG,SAAS,OAAO,OAAoB;AACzC,QAAM,EAAE,MAAM,GAAG,YAAY,IAAI;AACjC,QAAM,SAAS,OAAO,EAAE,KAAK,CAAC;AAE9B,QAAM,EAAE,SAAS,UAAU,UAAU,UAAU,gBAAgB,IAC7D,gBAAgB;AAElB,QAAM,EAAE,MAAM,IAAI,mBAAmB;AACrC,QAAM,cAAc,MAAM;AAE1B,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,GAAG,SAAS,OAAO,OAAO,OAAO,CAAC;AAAA,MAC7C,gBAAc,MAAM,WAAW,MAAM;AAAA,MAErC;AAAA;AAAA,UAAC;AAAA;AAAA,YACE,GAAG;AAAA,YACH,GAAI,YAAY,EAAE,UAAU,KAAK;AAAA,YACjC,GAAI,YAAY,EAAE,UAAU,KAAK;AAAA,YACjC,GAAI,YAAY,EAAE,UAAU,KAAK;AAAA,YACjC,GAAI,mBAAmB;AAAA,cACtB,oBAAoB;AAAA,YACtB;AAAA,YACC,GAAI,WAAW,EAAE,gBAAgB,KAAK;AAAA,YACvC,WAAW,GAAG,QAAQ,OAAO,KAAK;AAAA,YAClC,MAAK;AAAA,YACL,MAAK;AAAA;AAAA,QACP;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,WAAW;AAAA,cACT,OAAO;AAAA,cACP,OAAO;AAAA,gBACL,SAAS;AAAA,cACX,CAAC;AAAA,YACH;AAAA,YAEA,8BAAC,eAAY;AAAA;AAAA,QACf;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -13,7 +13,7 @@ import {
13
13
  } from "./chunk-GITT5645.js";
14
14
  import {
15
15
  Button
16
- } from "./chunk-MER66QUY.js";
16
+ } from "./chunk-6KZVE4HC.js";
17
17
  import {
18
18
  Show
19
19
  } from "./chunk-BUVVRQLZ.js";
@@ -155,4 +155,4 @@ export {
155
155
  ConfirmModal,
156
156
  useConfirmModal
157
157
  };
158
- //# sourceMappingURL=chunk-7S47NSGR.js.map
158
+ //# sourceMappingURL=chunk-H54FR7IP.js.map
@@ -0,0 +1,23 @@
1
+ import {
2
+ CheckboxControl,
3
+ CheckboxGroup,
4
+ CheckboxHiddenInput,
5
+ CheckboxIndicator,
6
+ CheckboxLabel,
7
+ CheckboxRoot
8
+ } from "./chunk-BPRF34DU.js";
9
+
10
+ // src/components/checkbox/parts.ts
11
+ var CheckboxParts = {
12
+ Root: CheckboxRoot,
13
+ Label: CheckboxLabel,
14
+ Control: CheckboxControl,
15
+ Indicator: CheckboxIndicator,
16
+ HiddenInput: CheckboxHiddenInput,
17
+ Group: CheckboxGroup
18
+ };
19
+
20
+ export {
21
+ CheckboxParts
22
+ };
23
+ //# sourceMappingURL=chunk-KWZ3CEG6.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/checkbox/parts.ts"],"sourcesContent":["import type { ElementType } from 'react'\nimport {\n CheckboxRoot,\n CheckboxLabel,\n CheckboxControl,\n CheckboxIndicator,\n CheckboxHiddenInput,\n CheckboxGroup,\n} from './primitives'\n\n/**\n * This module contains the parts of the Field component.\n * @module 'field/parts'\n */\n\ninterface CheckboxPartsValue {\n /**\n * The container of the field.\n */\n Root: ElementType\n /**\n * The label of the field.\n */\n Label: ElementType\n /**\n * The control of the field.\n */\n Control: ElementType\n /**\n * The indicator of the field.\n */\n Indicator: ElementType\n /**\n * The hidden input of the field.\n */\n HiddenInput: ElementType\n /**\n * The checkbox group component.\n */\n Group: ElementType\n}\n\n/**\n * An Object containing the parts of the Checkbox component. For users that\n * prefer Object component syntax.\n *\n * @remarks\n *\n * When using object component syntax, you import the CheckboxParts object and\n * the entire family of components vs. only what you use.\n */\nexport const CheckboxParts: CheckboxPartsValue = {\n Root: CheckboxRoot,\n Label: CheckboxLabel,\n Control: CheckboxControl,\n Indicator: CheckboxIndicator,\n HiddenInput: CheckboxHiddenInput,\n Group: CheckboxGroup,\n}\n"],"mappings":";;;;;;;;;;AAmDO,IAAM,gBAAoC;AAAA,EAC/C,MAAM;AAAA,EACN,OAAO;AAAA,EACP,SAAS;AAAA,EACT,WAAW;AAAA,EACX,aAAa;AAAA,EACb,OAAO;AACT;","names":[]}
@@ -1,12 +1,9 @@
1
- import {
2
- useFieldContext
3
- } from "./chunk-UZDVOIW5.js";
4
-
5
- // src/components/FieldMessage.tsx
1
+ // src/components/deprecated/FieldMessage.tsx
6
2
  import { cx } from "@cerberus/styled-system/css";
7
3
  import {
8
4
  fieldMessage
9
5
  } from "@cerberus/styled-system/recipes";
6
+ import { useFieldContext } from "@ark-ui/react/field";
10
7
  import { jsx } from "react/jsx-runtime";
11
8
  function FieldMessage(props) {
12
9
  const { invalid } = useFieldContext();
@@ -23,4 +20,4 @@ function FieldMessage(props) {
23
20
  export {
24
21
  FieldMessage
25
22
  };
26
- //# sourceMappingURL=chunk-JWIJHSI6.js.map
23
+ //# sourceMappingURL=chunk-L7N24B6B.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/deprecated/FieldMessage.tsx"],"sourcesContent":["'use client'\n\nimport type { HTMLAttributes } from 'react'\nimport { cx } from '@cerberus/styled-system/css'\nimport {\n fieldMessage,\n type FieldMessageVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport { useFieldContext } from '@ark-ui/react/field'\n\n/**\n * This module contains the FieldMessage component.\n * @module\n */\nexport interface FieldMessageBaseProps\n extends HTMLAttributes<HTMLParagraphElement> {\n /**\n * The id of the FieldMessage element describing the field. Required for accessibility. It is considered best practice to use the `help` or `error` prefix to help screen readers identify the type of message.\n *\n * @example For help messages: `help:field_id`\n * @example For error messages: `error:field_id`\n */\n id: string\n}\nexport type FieldMessageProps = FieldMessageBaseProps & FieldMessageVariantProps\n\n/**\n * @deprecated use FieldHelperText, FieldErrorText, or FieldParts instead\n */\nexport function FieldMessage(props: FieldMessageProps) {\n const { invalid } = useFieldContext()\n return (\n <small\n {...props}\n {...(invalid && { 'aria-invalid': true })}\n className={cx(props.className, fieldMessage())}\n />\n )\n}\n"],"mappings":";AAGA,SAAS,UAAU;AACnB;AAAA,EACE;AAAA,OAEK;AACP,SAAS,uBAAuB;AAwB5B;AAHG,SAAS,aAAa,OAA0B;AACrD,QAAM,EAAE,QAAQ,IAAI,gBAAgB;AACpC,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACH,GAAI,WAAW,EAAE,gBAAgB,KAAK;AAAA,MACvC,WAAW,GAAG,MAAM,WAAW,aAAa,CAAC;AAAA;AAAA,EAC/C;AAEJ;","names":[]}
@@ -0,0 +1,23 @@
1
+ import {
2
+ FieldLabel
3
+ } from "./chunk-VSTOSLFS.js";
4
+
5
+ // src/components/deprecated/Label.tsx
6
+ import { label } from "@cerberus/styled-system/recipes";
7
+ import { cx } from "@cerberus/styled-system/css";
8
+ import { jsx } from "react/jsx-runtime";
9
+ function Label(props) {
10
+ const { size, ...nativeProps } = props;
11
+ return /* @__PURE__ */ jsx(
12
+ FieldLabel,
13
+ {
14
+ ...nativeProps,
15
+ className: cx(label({ size }), props.className)
16
+ }
17
+ );
18
+ }
19
+
20
+ export {
21
+ Label
22
+ };
23
+ //# sourceMappingURL=chunk-LT62577B.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/deprecated/Label.tsx"],"sourcesContent":["import type { HTMLAttributes, PropsWithChildren } from 'react'\nimport { label, type LabelVariantProps } from '@cerberus/styled-system/recipes'\nimport { cx } from '@cerberus/styled-system/css'\nimport { FieldLabel } from '../field'\n\n/**\n * This module contains the Label component.\n * @module\n */\nexport type LabelBaseProps = HTMLAttributes<HTMLLabelElement>\nexport type LabelProps = LabelBaseProps & LabelVariantProps\n\n/**\n * @deprecated Use FieldLabel or FieldParts.Label instead.\n */\nexport function Label(props: PropsWithChildren<LabelProps>) {\n const { size, ...nativeProps } = props\n return (\n <FieldLabel\n {...nativeProps}\n className={cx(label({ size }), props.className)}\n />\n )\n}\n"],"mappings":";;;;;AACA,SAAS,aAAqC;AAC9C,SAAS,UAAU;AAgBf;AAHG,SAAS,MAAM,OAAsC;AAC1D,QAAM,EAAE,MAAM,GAAG,YAAY,IAAI;AACjC,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW,GAAG,MAAM,EAAE,KAAK,CAAC,GAAG,MAAM,SAAS;AAAA;AAAA,EAChD;AAEJ;","names":[]}
@@ -102,4 +102,4 @@ export {
102
102
  formatISOToMilitary,
103
103
  DateFormats
104
104
  };
105
- //# sourceMappingURL=chunk-3BM6MZ4A.js.map
105
+ //# sourceMappingURL=chunk-MWRO5QYD.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/hooks/useDate.ts"],"sourcesContent":["'use client'\n\nimport {\n useState,\n useCallback,\n ChangeEvent,\n useMemo,\n type InputHTMLAttributes,\n} from 'react'\n\nexport interface UseDateBase {\n /**\n * The format of the date input\n */\n format?: string\n /**\n * The callback to run when the date input changes\n */\n onChange?: InputHTMLAttributes<HTMLInputElement>['onChange']\n}\n\nexport interface UseDateOptions extends UseDateBase {\n /**\n * The initial value of the date input\n */\n initialValue?: string\n}\n\nexport interface UseDateReturn extends UseDateBase {\n /**\n * The ISO formatted date string\n */\n ISO: string\n /**\n * The value of the date input\n */\n value: string\n}\n\n/**\n * @deprecated use the DatePicker family instead\n */\nexport function useDate(options?: UseDateOptions): UseDateReturn {\n const initialValue = options?.initialValue ?? ''\n const format = options?.format ?? DateFormats.USMilitary\n const onChange = options?.onChange\n const [value, setValue] = useState(initialValue)\n\n const handleChange = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n const newValue = formatMilitaryDate(e.currentTarget.value)\n if (onChange) onChange(e)\n setValue(newValue)\n },\n [onChange],\n )\n\n return useMemo(\n () => ({\n format,\n value,\n ISO: formatMilitaryToISO(value),\n onChange: handleChange,\n }),\n [format, value, handleChange],\n )\n}\n\n// helpers\n\n/**\n * Converts a string in US Military format to ISO format. Used within the `useDate` hook.\n * @param input The string to format\n * @returns The formatted string in ISO format (YYYY-MM-DD)\n */\nexport function formatMilitaryToISO(input: string) {\n const [day, month, year] = input.split(' ')\n const monthIndex = MONTHS.findIndex((m) => m.startsWith(month))\n const monthNum = monthIndex + 1\n return `${year ?? '0000'}-${monthNum.toString().padStart(2, '0')}-${day.padStart(\n 2,\n '0',\n )}`\n}\n\n/**\n * Converts a string to US Military format. Used within the `useDate` hook.\n * @param input The string to format\n * @returns The formatted string in US Military format (DD MMM YYYY)\n */\nexport function formatMilitaryDate(input: string): string {\n let formatted = input.toUpperCase().replace(/[^0-9A-Z]/g, '')\n let day = ''\n let month = ''\n let year = ''\n\n // Format day\n if (formatted.length >= 2) {\n day = formatted.replace(/[^0-9]/g, '').slice(0, 2)\n const dayNum = parseInt(day, 10)\n if (dayNum > 31) day = '31'\n else if (dayNum === 0) day = '01'\n formatted = formatted.slice(2)\n }\n\n // Format month\n if (formatted.length >= 3) {\n month = formatted.slice(0, 3)\n const monthIndex = MONTHS.findIndex((m) => m.startsWith(month))\n if (monthIndex !== -1) {\n month = MONTHS[monthIndex]\n } else {\n month = month.replace(/[^A-Z]/g, '')\n }\n formatted = formatted.slice(3)\n }\n\n // Format year\n if (formatted.length > 0) {\n year = formatted.slice(0, 4)\n }\n\n return [day, month, year].filter(Boolean).join(' ')\n}\n\n/**\n * Formats a date string to US Military format.\n * @param date The date string to format (i.e., '2024-01-01')\n * @returns The formatted date string in US Military format (DD MMM YYYY)\n */\nexport function formatISOToMilitary(date: string): string {\n const [year, month, day] = date.split('-')\n const monthIndex = parseInt(month, 10) - 1\n const monthStr = MONTHS[monthIndex]\n return `${day} ${monthStr} ${year}`\n}\n\n/**\n * Date formatting options\n * @example\n * ```tsx\n * const date = new Date()\n * const formatted = date.format(DateFormats.USMilitary)\n */\nexport const DateFormats = {\n get ISO() {\n return 'YYYY-MM-DD'\n },\n get USMilitary() {\n return 'DD MMM YYYY'\n },\n get Months() {\n return MONTHS\n },\n}\n\nconst MONTHS = [\n 'JAN',\n 'FEB',\n 'MAR',\n 'APR',\n 'MAY',\n 'JUN',\n 'JUL',\n 'AUG',\n 'SEP',\n 'OCT',\n 'NOV',\n 'DEC',\n]\n"],"mappings":";AAEA;AAAA,EACE;AAAA,EACA;AAAA,EAEA;AAAA,OAEK;AAkCA,SAAS,QAAQ,SAAyC;AAC/D,QAAM,eAAe,SAAS,gBAAgB;AAC9C,QAAM,SAAS,SAAS,UAAU,YAAY;AAC9C,QAAM,WAAW,SAAS;AAC1B,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAS,YAAY;AAE/C,QAAM,eAAe;AAAA,IACnB,CAAC,MAAqC;AACpC,YAAM,WAAW,mBAAmB,EAAE,cAAc,KAAK;AACzD,UAAI,SAAU,UAAS,CAAC;AACxB,eAAS,QAAQ;AAAA,IACnB;AAAA,IACA,CAAC,QAAQ;AAAA,EACX;AAEA,SAAO;AAAA,IACL,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,KAAK,oBAAoB,KAAK;AAAA,MAC9B,UAAU;AAAA,IACZ;AAAA,IACA,CAAC,QAAQ,OAAO,YAAY;AAAA,EAC9B;AACF;AASO,SAAS,oBAAoB,OAAe;AACjD,QAAM,CAAC,KAAK,OAAO,IAAI,IAAI,MAAM,MAAM,GAAG;AAC1C,QAAM,aAAa,OAAO,UAAU,CAAC,MAAM,EAAE,WAAW,KAAK,CAAC;AAC9D,QAAM,WAAW,aAAa;AAC9B,SAAO,GAA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ACA,IAAI,aAAa;AACf,WAAO;AAAA,EACT;AAAA,EACA,IAAI,SAAS;AACX,WAAO;AAAA,EACT;AACF;AAEA,IAAM,SAAS;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;","names":[]}
@@ -22,4 +22,4 @@ function FieldsetLabel(props) {
22
22
  export {
23
23
  FieldsetLabel
24
24
  };
25
- //# sourceMappingURL=chunk-PZAZKQMO.js.map
25
+ //# sourceMappingURL=chunk-OYT7RGC7.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/FieldsetLabel.tsx"],"sourcesContent":["import { cx } from '@cerberus/styled-system/css'\nimport { label, type LabelVariantProps } from '@cerberus/styled-system/recipes'\nimport type { LabelProps } from './deprecated/Label'\n\n/**\n * This module contains the FieldsetLabel component.\n * @module FieldsetLabel\n */\n\nexport type FieldsetLabelProps = LabelProps &\n LabelVariantProps & {\n htmlFor?: string\n }\n\n/**\n * Used for labeling inputs that are children of a Fieldset group.\n * @memberof Fieldset\n * @see https://cerberus.digitalu.design/react/fieldset\n * @definition [ARIA Forms](https://www.a11yproject.com/checklist/#forms)\n * @example\n * ```tsx\n * import { Fieldset, Legend, Field, Radio, Label } from '@cerberus/react'\n * import { Hstack } from '@cerberus/styled-system/jsx'\n *\n * function SomeForm() {\n * return (\n * <form>\n * <Fieldset>\n * <Legend>Do you like cats?</Legend>\n * <Hstack>\n * <Field>\n * <Radio id=\"yes\" name=\"cats\" value=\"yes\" />\n * <FieldsetLabel htmlFor=\"yes\">Yes</FieldsetLabel>\n * </Field>\n * </Hstack>\n * <Hstack>\n * <Field>\n * <Radio id=\"no\" name=\"cats\" value=\"no\" />\n * <FieldsetLabel htmlFor=\"no\">No</FieldsetLabel>\n * </Field>\n * </Hstack>\n * </Fieldset>\n * </form>\n * )\n * }\n * ```\n */\nexport function FieldsetLabel(props: FieldsetLabelProps) {\n const { size, usage, ...nativeProps } = props\n return (\n <label\n {...nativeProps}\n className={cx(\n nativeProps.className,\n label({\n size,\n usage,\n }),\n )}\n />\n )\n}\n"],"mappings":";AAAA,SAAS,UAAU;AACnB,SAAS,aAAqC;AAiD1C;AAHG,SAAS,cAAc,OAA2B;AACvD,QAAM,EAAE,MAAM,OAAO,GAAG,YAAY,IAAI;AACxC,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW;AAAA,QACT,YAAY;AAAA,QACZ,MAAM;AAAA,UACJ;AAAA,UACA;AAAA,QACF,CAAC;AAAA,MACH;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -1,6 +1,3 @@
1
- import {
2
- useFieldContext
3
- } from "./chunk-UZDVOIW5.js";
4
1
  import {
5
2
  Show
6
3
  } from "./chunk-BUVVRQLZ.js";
@@ -9,15 +6,15 @@ import {
9
6
  import { css, cx } from "@cerberus/styled-system/css";
10
7
  import { label } from "@cerberus/styled-system/recipes";
11
8
  import { hstack } from "@cerberus/styled-system/patterns";
9
+ import { useFieldContext } from "@ark-ui/react/field";
12
10
  import { jsx, jsxs } from "react/jsx-runtime";
13
11
  function Legend(props) {
14
12
  const { size, ...nativeProps } = props;
15
- const { invalid, ...formState } = useFieldContext();
13
+ const { invalid, required } = useFieldContext();
16
14
  return /* @__PURE__ */ jsxs(
17
15
  "legend",
18
16
  {
19
17
  ...nativeProps,
20
- ...formState,
21
18
  ...invalid && { "aria-invalid": true },
22
19
  className: cx(
23
20
  nativeProps.className,
@@ -31,7 +28,7 @@ function Legend(props) {
31
28
  ),
32
29
  children: [
33
30
  nativeProps.children,
34
- /* @__PURE__ */ jsx(Show, { when: formState.required, children: /* @__PURE__ */ jsx(
31
+ /* @__PURE__ */ jsx(Show, { when: required, children: /* @__PURE__ */ jsx(
35
32
  "span",
36
33
  {
37
34
  className: css({
@@ -49,4 +46,4 @@ function Legend(props) {
49
46
  export {
50
47
  Legend
51
48
  };
52
- //# sourceMappingURL=chunk-ILQW5VZT.js.map
49
+ //# sourceMappingURL=chunk-RBNOEAWJ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/Legend.tsx"],"sourcesContent":["'use client'\n\nimport { css, cx } from '@cerberus/styled-system/css'\nimport { label, type LabelVariantProps } from '@cerberus/styled-system/recipes'\nimport { hstack } from '@cerberus/styled-system/patterns'\nimport { type HTMLAttributes } from 'react'\nimport { Show } from './Show'\nimport { useFieldContext } from '@ark-ui/react/field'\n\n/**\n * This module contains the Fieldset component.\n * @module Fieldset\n */\n\nexport type LegendProps = HTMLAttributes<HTMLLegendElement> & LabelVariantProps\n\n/**\n * A component to provide a global label for a group of related elements in a form (for accessibility).\n * @memberof Fieldset\n * @see https://cerberus.digitalu.com/react/fieldset\n * @description [A11y Form Checklist](https://www.a11yproject.com/checklist/#forms)\n * @description [MDN Web Docs: Legend](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/legend)\n * @example\n * ```tsx\n * import { Fieldset, Legend, Field, Radio, Label } from '@cerberus/react'\n * import { Hstack } from '@cerberus/styled-system/jsx'\n *\n * function SomeForm() {\n * return (\n * <form>\n * <Fieldset>\n * <Legend>Do you like cats?</Legend>\n * <Hstack>\n * <Field>\n * <Radio id=\"yes\" name=\"cats\" value=\"yes\" />\n * <Label htmlFor=\"yes\">Yes</Label>\n * </Field>\n * </Hstack>\n * <Hstack>\n * <Field>\n * <Radio id=\"no\" name=\"cats\" value=\"no\" />\n * <Label htmlFor=\"no\">No</Label>\n * </Field>\n * </Hstack>\n * </Fieldset>\n * </form>\n * )\n * }\n * ```\n */\nexport function Legend(props: LegendProps) {\n const { size, ...nativeProps } = props\n const { invalid, required } = useFieldContext()\n\n return (\n <legend\n {...nativeProps}\n {...(invalid && { 'aria-invalid': true })}\n className={cx(\n nativeProps.className,\n hstack({\n justify: 'space-between',\n w: 'full',\n }),\n label({\n size,\n }),\n )}\n >\n {nativeProps.children}\n <Show when={required}>\n <span\n className={css({\n color: 'page.text.100',\n fontSize: 'inherit',\n })}\n >\n (required)\n </span>\n </Show>\n </legend>\n )\n}\n"],"mappings":";;;;;AAEA,SAAS,KAAK,UAAU;AACxB,SAAS,aAAqC;AAC9C,SAAS,cAAc;AAGvB,SAAS,uBAAuB;AAgD5B,SAgBI,KAhBJ;AALG,SAAS,OAAO,OAAoB;AACzC,QAAM,EAAE,MAAM,GAAG,YAAY,IAAI;AACjC,QAAM,EAAE,SAAS,SAAS,IAAI,gBAAgB;AAE9C,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACH,GAAI,WAAW,EAAE,gBAAgB,KAAK;AAAA,MACvC,WAAW;AAAA,QACT,YAAY;AAAA,QACZ,OAAO;AAAA,UACL,SAAS;AAAA,UACT,GAAG;AAAA,QACL,CAAC;AAAA,QACD,MAAM;AAAA,UACJ;AAAA,QACF,CAAC;AAAA,MACH;AAAA,MAEC;AAAA,oBAAY;AAAA,QACb,oBAAC,QAAK,MAAM,UACV;AAAA,UAAC;AAAA;AAAA,YACC,WAAW,IAAI;AAAA,cACb,OAAO;AAAA,cACP,UAAU;AAAA,YACZ,CAAC;AAAA,YACF;AAAA;AAAA,QAED,GACF;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -1,6 +1,3 @@
1
- import {
2
- Text
3
- } from "./chunk-RU5LOXWI.js";
4
1
  import {
5
2
  SelectContent,
6
3
  SelectControl,
@@ -10,7 +7,6 @@ import {
10
7
  SelectItemGroupLabel,
11
8
  SelectItemIndicator,
12
9
  SelectItemText,
13
- SelectLabel,
14
10
  SelectPositioner,
15
11
  SelectRoot,
16
12
  SelectTrigger,
@@ -38,15 +34,11 @@ import { cx } from "@cerberus/styled-system/css";
38
34
  import { HStack } from "@cerberus/styled-system/jsx";
39
35
  import { jsx, jsxs } from "react/jsx-runtime";
40
36
  function Select(props) {
41
- const { collection, label, placeholder, size, ...rootProps } = props;
37
+ const { collection, placeholder, size, ...rootProps } = props;
42
38
  const { icons } = useCerberusContext();
43
39
  const { selectArrow: SelectArrow, invalid: InvalidIcon } = icons;
44
40
  const styles = select({ size });
45
41
  return /* @__PURE__ */ jsxs(SelectRoot, { className: styles.root, collection, ...rootProps, children: [
46
- /* @__PURE__ */ jsxs(SelectLabel, { className: styles.label, children: [
47
- label,
48
- /* @__PURE__ */ jsx(Show, { when: props.required, children: /* @__PURE__ */ jsx(Text, { as: "span", color: "page.text.100", children: "(required)" }) })
49
- ] }),
50
42
  /* @__PURE__ */ jsx(SelectControl, { className: styles.control, children: /* @__PURE__ */ jsxs(SelectTrigger, { className: styles.trigger, children: [
51
43
  /* @__PURE__ */ jsx(SelectValueText, { placeholder }),
52
44
  /* @__PURE__ */ jsxs(HStack, { children: [
@@ -94,4 +86,4 @@ export {
94
86
  OptionGroupLabel,
95
87
  createSelectCollection
96
88
  };
97
- //# sourceMappingURL=chunk-5QONP7GT.js.map
89
+ //# sourceMappingURL=chunk-S2X5OEPK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/Select.tsx"],"sourcesContent":["'use client'\n\nimport {\n Select as ArkSelect,\n createListCollection,\n type SelectRootProps,\n type SelectItemProps,\n type SelectItemGroupProps,\n type SelectItemGroupLabelProps,\n type ListCollection,\n type SelectValueChangeDetails,\n} from '@ark-ui/react/select'\nimport {\n select,\n type SelectVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport { cx } from '@cerberus/styled-system/css'\nimport { HStack } from '@cerberus/styled-system/jsx'\nimport { useCerberusContext } from '../context/cerberus'\nimport { Portal } from './Portal'\nimport { Show } from './Show'\nimport {\n SelectContent,\n SelectControl,\n SelectIndicator,\n SelectItem,\n SelectItemGroup,\n SelectItemGroupLabel,\n SelectItemIndicator,\n SelectItemText,\n SelectPositioner,\n SelectRoot,\n SelectTrigger,\n SelectValueText,\n} from './Select.server'\n\n/**\n * This module contains the Select components.\n * @module 'react/select'\n */\n\nexport interface SelectCollectionItem {\n /**\n * What is displayed in the dropdown list.\n */\n label: string\n /**\n * The value of the selected item used in the form.\n */\n value: string\n /**\n * If the item is disabled.\n */\n disabled?: boolean\n}\n\nexport interface SelectCollection {\n /**\n * The items to be displayed in the dropdown list.\n */\n items: SelectCollectionItem[]\n}\n\nexport interface BaseSelectProps {\n /**\n * The placeholder text when no option is selected.\n */\n placeholder?: string\n}\n\nexport type SelectProps = SelectRootProps<SelectCollectionItem> &\n BaseSelectProps &\n SelectVariantProps\n\n/**\n * The Select component is a dropdown list that allows users to select an\n * option from a list.\n * @definition [Select docs](https://cerberus.digitalu.design/react/select)\n * @definition [ARK docs](https://ark-ui.com/react/docs/components/select)\n * @example\n * ```tsx\n * import { Select, Option, createListCollection } from '@cerberus-design/react'\n *\n * export function SelectBasicPreview() {\n * const collection = createListCollection({\n * items: [\n * { label: 'Hades', value: 'hades' },\n * { label: 'Persephone', value: 'persephone' },\n * { label: 'Zeus', value: 'zeus', disabled: true },\n * ]\n * })\n *\n * return (\n * <Select\n * collection={collection}\n * label=\"Select Relative\"\n * placeholder=\"Choose option\"\n * >\n * {collection.items.map((item) => (\n * <Option key={item.value} item={item} />\n * ))}\n * </Select>\n * )\n * }\n */\nexport function Select(props: SelectProps) {\n const { collection, placeholder, size, ...rootProps } = props\n const { icons } = useCerberusContext()\n const { selectArrow: SelectArrow, invalid: InvalidIcon } = icons\n\n const styles = select({ size })\n\n return (\n <SelectRoot className={styles.root} collection={collection} {...rootProps}>\n <SelectControl className={styles.control}>\n <SelectTrigger className={styles.trigger}>\n <SelectValueText placeholder={placeholder} />\n\n <HStack>\n <Show when={props.invalid}>\n <InvalidIcon data-part=\"invalid-icon\" />\n </Show>\n <SelectIndicator className={styles.indicator}>\n <SelectArrow />\n </SelectIndicator>\n </HStack>\n </SelectTrigger>\n </SelectControl>\n\n <Portal>\n <SelectPositioner className={styles.positioner}>\n <SelectContent className={styles.content}>\n {props.children}\n </SelectContent>\n </SelectPositioner>\n </Portal>\n\n <ArkSelect.HiddenSelect />\n </SelectRoot>\n )\n}\n\nexport interface OptionProps extends SelectItemProps {\n /**\n * The CollectionListItem to be displayed in the dropdown list.\n */\n item: SelectCollectionItem\n}\n\nexport function Option(props: OptionProps) {\n const { item, ...itemProps } = props\n\n const { icons } = useCerberusContext()\n const { selectChecked: CheckedIcon } = icons\n\n const styles = select()\n\n return (\n <SelectItem {...itemProps} item={item} className={styles.item}>\n <SelectItemText className={styles.itemText}>{item?.label}</SelectItemText>\n <SelectItemIndicator className={styles.itemIndicator}>\n <CheckedIcon />\n </SelectItemIndicator>\n </SelectItem>\n )\n}\n\n/**\n * The OptionGroup component is a group of options in the dropdown list.\n * @definition [Select docs](https://cerberus.digitalu.design/react/select)\n * @definition [ARK docs](https://ark-ui.com/react/docs/components/select)\n * @example\n * ```tsx\n * <OptionGroup>\n * <OptionGroupLabel>Greek gods</OptionGroupLabel>\n * ...\n * </OptionGroup>\n * ```\n */\nexport function OptionGroup(props: SelectItemGroupProps) {\n return <SelectItemGroup {...props} />\n}\n\n/**\n * The OptionGroupLabel component is the label of the OptionGroup.\n * @definition [Select docs](https://cerberus.digitalu.design/react/select)\n * @definition [ARK docs](https://ark-ui.com/react/docs/components/select)\n * @example\n * ```tsx\n * <OptionGroupLabel>Greek gods</OptionGroupLabel>\n * ```\n */\nexport function OptionGroupLabel(props: SelectItemGroupLabelProps) {\n const styles = select()\n return (\n <SelectItemGroupLabel\n {...props}\n className={cx(props.className, styles.itemGroupLabel)}\n />\n )\n}\n\n/**\n * A helper function to create a SelectCollection object.\n * @param collection - An array of SelectCollectionItem objects that matches\n * the following shape:\n * ```ts\n * [{ label: 'Hades', value: 'hades', disabled?: true }]\n * ```\n */\nexport function createSelectCollection(\n collection: SelectCollectionItem[],\n): ListCollection<SelectCollectionItem> {\n return createListCollection({\n items: collection,\n })\n}\n\nexport type { SelectValueChangeDetails, ListCollection }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAEA;AAAA,EACE,UAAU;AAAA,EACV;AAAA,OAOK;AACP;AAAA,EACE;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AWO,SAAS,iBAAiB,OAAkC;AACjE,QAAM,SAAS,OAAO;AACtB,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW,GAAG,MAAM,WAAW,OAAO,cAAc;AAAA;AAAA,EACtD;AAEJ;AAUO,SAAS,uBACd,YACsC;AACtC,SAAO,qBAAqB;AAAA,IAC1B,OAAO;AAAA,EACT,CAAC;AACH;","names":[]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chunk-TIJAFPHQ.js.map
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chunk-TYPULJMJ.js.map
@@ -0,0 +1,31 @@
1
+ import {
2
+ CheckboxIcon
3
+ } from "./chunk-EL4MX2PG.js";
4
+ import {
5
+ Text
6
+ } from "./chunk-RU5LOXWI.js";
7
+ import {
8
+ CheckboxParts
9
+ } from "./chunk-KWZ3CEG6.js";
10
+ import {
11
+ Show
12
+ } from "./chunk-BUVVRQLZ.js";
13
+
14
+ // src/components/checkbox/checkbox.tsx
15
+ import { jsx, jsxs } from "react/jsx-runtime";
16
+ function Checkbox(props) {
17
+ const { size, children, ...rootProps } = props;
18
+ return /* @__PURE__ */ jsxs(CheckboxParts.Root, { ...rootProps, children: [
19
+ /* @__PURE__ */ jsx(CheckboxParts.Control, { size, children: /* @__PURE__ */ jsx(CheckboxIcon, { indeterminate: rootProps.checked === "indeterminate" }) }),
20
+ /* @__PURE__ */ jsxs(CheckboxParts.Label, { size, children: [
21
+ children,
22
+ /* @__PURE__ */ jsx(Show, { when: props.required, children: /* @__PURE__ */ jsx(Text, { as: "span", "data-part": "required-indicator", children: "(required)" }) })
23
+ ] }),
24
+ /* @__PURE__ */ jsx(CheckboxParts.HiddenInput, {})
25
+ ] });
26
+ }
27
+
28
+ export {
29
+ Checkbox
30
+ };
31
+ //# sourceMappingURL=chunk-UNN4LHRS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/checkbox/checkbox.tsx"],"sourcesContent":["import type { CheckboxRootProps } from '@ark-ui/react'\nimport { type CheckboxVariantProps } from '@cerberus/styled-system/recipes'\nimport { Show } from '../Show'\nimport { Text } from '../Text'\nimport { CheckboxParts } from './parts'\nimport { CheckboxIcon } from './checkbox-icon'\n\n/**\n * This module contains the Checkbox component.\n * @module\n */\n\nexport type CheckboxProps = CheckboxVariantProps & CheckboxRootProps\n\n/**\n * Checkbox component\n * @definition [ARIA Target Size](https://www.w3.org/WAI/WCAG21/Understanding/target-size.html#:~:text=Understanding%20SC%202.5.,%3ATarget%20Size%20(Level%20AAA)&text=The%20size%20of%20the%20target,Equivalent)\n * @definition [ARIA Forms](https://www.a11yproject.com/checklist/#forms)\n * @see https://cerberus.digitalu.design/react/checkbox\n * @example\n * ```tsx\n * <Field>\n * <Checkbox id=\"legal\" checked={checked.legal} onChange={handleChange} />\n * </Field>\n * ```\n */\nexport function Checkbox(props: CheckboxProps) {\n const { size, children, ...rootProps } = props\n\n return (\n <CheckboxParts.Root {...rootProps}>\n <CheckboxParts.Control size={size}>\n <CheckboxIcon indeterminate={rootProps.checked === 'indeterminate'} />\n </CheckboxParts.Control>\n\n <CheckboxParts.Label size={size}>\n {children}\n <Show when={props.required}>\n <Text as=\"span\" data-part=\"required-indicator\">\n (required)\n </Text>\n </Show>\n </CheckboxParts.Label>\n\n <CheckboxParts.HiddenInput />\n </CheckboxParts.Root>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;AAgCQ,cAGF,YAHE;AAND,SAAS,SAAS,OAAsB;AAC7C,QAAM,EAAE,MAAM,UAAU,GAAG,UAAU,IAAI;AAEzC,SACE,qBAAC,cAAc,MAAd,EAAoB,GAAG,WACtB;AAAA,wBAAC,cAAc,SAAd,EAAsB,MACrB,8BAAC,gBAAa,eAAe,UAAU,YAAY,iBAAiB,GACtE;AAAA,IAEA,qBAAC,cAAc,OAAd,EAAoB,MAClB;AAAA;AAAA,MACD,oBAAC,QAAK,MAAM,MAAM,UAChB,8BAAC,QAAK,IAAG,QAAO,aAAU,sBAAqB,wBAE/C,GACF;AAAA,OACF;AAAA,IAEA,oBAAC,cAAc,aAAd,EAA0B;AAAA,KAC7B;AAEJ;","names":[]}
@@ -0,0 +1,100 @@
1
+ import {
2
+ FieldStartIndicator
3
+ } from "./chunk-Z52R6ABJ.js";
4
+ import {
5
+ FieldStatusIndicator
6
+ } from "./chunk-CNA2VKAH.js";
7
+
8
+ // src/components/field/primitives.tsx
9
+ import {
10
+ Field
11
+ } from "@ark-ui/react/field";
12
+ import { cx } from "@cerberus/styled-system/css";
13
+ import { field } from "@cerberus/styled-system/recipes";
14
+ import { jsx, jsxs } from "react/jsx-runtime";
15
+ function FieldRoot(props) {
16
+ const { size, ...fieldProps } = props;
17
+ const styles = field({ size });
18
+ return /* @__PURE__ */ jsx(
19
+ Field.Root,
20
+ {
21
+ ...fieldProps,
22
+ className: cx(styles.root, fieldProps.className)
23
+ }
24
+ );
25
+ }
26
+ function FieldLabel(props) {
27
+ const { children, ...nativeProps } = props;
28
+ const styles = field();
29
+ return /* @__PURE__ */ jsxs(Field.Label, { ...nativeProps, className: cx(styles.label, props.className), children: [
30
+ children,
31
+ /* @__PURE__ */ jsx(Field.RequiredIndicator, { children: "(required)" })
32
+ ] });
33
+ }
34
+ function FieldRequiredIndicator() {
35
+ return /* @__PURE__ */ jsx(Field.RequiredIndicator, { children: "(required)" });
36
+ }
37
+ function FieldInput(props) {
38
+ const { size, startIcon, endIcon, ...fieldProps } = props;
39
+ const styles = field({ size });
40
+ const hasStartIcon = Boolean(startIcon);
41
+ return /* @__PURE__ */ jsxs("div", { className: styles.inputRoot, children: [
42
+ /* @__PURE__ */ jsx(FieldStartIndicator, { children: startIcon }),
43
+ /* @__PURE__ */ jsx(
44
+ Field.Input,
45
+ {
46
+ ...fieldProps,
47
+ ...hasStartIcon && { "data-has": "start-indicator" },
48
+ className: cx(styles.input, fieldProps.className)
49
+ }
50
+ ),
51
+ /* @__PURE__ */ jsx(FieldStatusIndicator, { fallback: endIcon })
52
+ ] });
53
+ }
54
+ function FieldHelperText(props) {
55
+ const styles = field();
56
+ if (!props.children) return null;
57
+ return /* @__PURE__ */ jsx(
58
+ Field.HelperText,
59
+ {
60
+ ...props,
61
+ className: cx(styles.helperText, props.className)
62
+ }
63
+ );
64
+ }
65
+ function FieldErrorText(props) {
66
+ const styles = field();
67
+ if (!props.children) return null;
68
+ return /* @__PURE__ */ jsx(
69
+ Field.ErrorText,
70
+ {
71
+ ...props,
72
+ className: cx(styles.errorText, props.className)
73
+ }
74
+ );
75
+ }
76
+ function FieldTextarea(props) {
77
+ const styles = field();
78
+ return /* @__PURE__ */ jsx(
79
+ Field.Textarea,
80
+ {
81
+ ...props,
82
+ className: cx(styles.textarea, props.className)
83
+ }
84
+ );
85
+ }
86
+ var Input = FieldInput;
87
+ var Textarea = FieldTextarea;
88
+
89
+ export {
90
+ FieldRoot,
91
+ FieldLabel,
92
+ FieldRequiredIndicator,
93
+ FieldInput,
94
+ FieldHelperText,
95
+ FieldErrorText,
96
+ FieldTextarea,
97
+ Input,
98
+ Textarea
99
+ };
100
+ //# sourceMappingURL=chunk-VSTOSLFS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/field/primitives.tsx"],"sourcesContent":["import {\n Field,\n type FieldHelperTextProps,\n type FieldInputProps as ArkFieldInputProps,\n type FieldLabelProps,\n type FieldRootProps as ArkFieldRootProps,\n type FieldTextareaProps,\n} from '@ark-ui/react/field'\nimport type { ReactNode } from 'react'\nimport { cx } from '@cerberus/styled-system/css'\nimport { field, type FieldVariantProps } from '@cerberus/styled-system/recipes'\nimport { FieldStatusIndicator } from './status-indicator'\nimport { FieldStartIndicator } from './start-indicator'\n\n/**\n * This module contains all the primitives of the Field component.\n * @module 'field'\n */\n\nexport type FieldRootProps = ArkFieldRootProps & FieldVariantProps\n\n/**\n * The context & container for the Field components.\n * @description [Field Docs](https://cerberus.digitalu.design/react/field)\n * @example\n * ```tsx\n * <FieldRoot required ids={{ input: 'exampleId' }}>\n * <FieldLabel>Label</FieldLabel>\n * <FieldInput />\n * </FieldRoot>\n * ```\n */\nexport function FieldRoot(props: FieldRootProps) {\n const { size, ...fieldProps } = props\n const styles = field({ size })\n return (\n <Field.Root\n {...fieldProps}\n className={cx(styles.root, fieldProps.className)}\n />\n )\n}\n\n/**\n * The label for the Field component.\n * @description [Field Docs](https://cerberus.digitalu.design/react/field)\n * @example\n * ```tsx\n * <FieldRoot>\n * <FieldLabel>Label</FieldLabel>\n * </FieldRoot>\n * ```\n */\nexport function FieldLabel(props: FieldLabelProps) {\n const { children, ...nativeProps } = props\n const styles = field()\n return (\n <Field.Label {...nativeProps} className={cx(styles.label, props.className)}>\n {children}\n <Field.RequiredIndicator>(required)</Field.RequiredIndicator>\n </Field.Label>\n )\n}\n\n/**\n * The required indicator for the Field component.\n */\nexport function FieldRequiredIndicator() {\n return <Field.RequiredIndicator>(required)</Field.RequiredIndicator>\n}\n\nexport interface FieldInputProps\n extends Omit<ArkFieldInputProps, 'size'>,\n FieldVariantProps {\n /**\n * An optional icon to display at the start of the input.\n */\n startIcon?: ReactNode\n /**\n * An optional icon to display at the end of the input.\n */\n endIcon?: ReactNode\n}\n\n/**\n * The input for the Field component.\n * @description [Field Docs](https://cerberus.digitalu.design/react/field)\n * @example\n * ```tsx\n * <FieldRoot>\n * <FieldInput />\n * </FieldRoot>\n * ```\n */\nexport function FieldInput(props: FieldInputProps) {\n const { size, startIcon, endIcon, ...fieldProps } = props\n const styles = field({ size })\n const hasStartIcon = Boolean(startIcon)\n\n return (\n <div className={styles.inputRoot}>\n <FieldStartIndicator>{startIcon}</FieldStartIndicator>\n <Field.Input\n {...fieldProps}\n {...(hasStartIcon && { 'data-has': 'start-indicator' })}\n className={cx(styles.input, fieldProps.className)}\n />\n <FieldStatusIndicator fallback={endIcon} />\n </div>\n )\n}\n\n/**\n * The helper text for the Field component that is shown when the field is\n * valid.\n * @description [Field Docs](https://cerberus.digitalu.design/react/field)\n * @example\n * ```tsx\n * <FieldRoot>\n * <FieldInput />\n * <FieldHelperText>Helper text</FieldHelperText>\n * </FieldRoot>\n * ```\n */\nexport function FieldHelperText(props: FieldHelperTextProps) {\n const styles = field()\n\n if (!props.children) return null\n\n return (\n <Field.HelperText\n {...props}\n className={cx(styles.helperText, props.className)}\n />\n )\n}\n\n/**\n * The error text for the Field component that is shown when the field is\n * invalid.\n * @description [Field Docs](https://cerberus.digitalu.design/react/field)\n * @example\n * ```tsx\n * <FieldRoot>\n * <FieldInput />\n * <FieldErrorText>Error text</FieldErrorText>\n * </FieldRoot>\n * ```\n */\nexport function FieldErrorText(props: FieldHelperTextProps) {\n const styles = field()\n\n if (!props.children) return null\n\n return (\n <Field.ErrorText\n {...props}\n className={cx(styles.errorText, props.className)}\n />\n )\n}\n\n/**\n * The textarea for the Field component.\n * @description [Field Docs](https://cerberus.digitalu.design/react/field)\n * @example\n * ```tsx\n * <FieldRoot>\n * <FieldTextarea />\n * </FieldRoot>\n * ```\n */\nexport function FieldTextarea(props: FieldTextareaProps) {\n const styles = field()\n return (\n <Field.Textarea\n {...props}\n className={cx(styles.textarea, props.className)}\n />\n )\n}\n\n/**\n * A named export for the FieldInput component.\n * @description [Field Docs](https://cerberus.digitalu.design/react/field)\n * @example\n * ```tsx\n * import { Input } from '@cerberus/react'\n *\n * <Field\n * ids={{\n * control: 'email',\n * }}\n * label=\"Enter your email\"\n * helperText=\"We'll never share your email with anyone else.\"\n * errorText=\"Email is required.\"\n * required\n * >\n * <Input type=\"email\" />\n * </Field>\n * ```\n */\nexport const Input = FieldInput\nexport const Textarea = FieldTextarea\n"],"mappings":";;;;;;;;AAAA;AAAA,EACE;AAAA,OAMK;AAEP,SAAS,UAAU;AACnB,SAAS,aAAqC;AA0B1C,cAqBA,YArBA;AAJG,SAAS,UAAU,OAAuB;AAC/C,QAAM,EAAE,MAAM,GAAG,WAAW,IAAI;AAChC,QAAM,SAAS,MAAM,EAAE,KAAK,CAAC;AAC7B,SACE;AAAA,IAAC,MAAM;AAAA,IAAN;AAAA,M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