@cerberus-design/react 0.14.2 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (241) hide show
  1. package/build/legacy/_tsup-dts-rollup.d.cts +374 -80
  2. package/build/legacy/components/Accordion.cjs +4 -187
  3. package/build/legacy/components/Accordion.cjs.map +1 -1
  4. package/build/legacy/components/Accordion.client.cjs +64 -0
  5. package/build/legacy/components/Accordion.client.cjs.map +1 -0
  6. package/build/legacy/components/AccordionItemGroup.cjs +41 -185
  7. package/build/legacy/components/AccordionItemGroup.cjs.map +1 -1
  8. package/build/legacy/components/Admonition.cjs +89 -239
  9. package/build/legacy/components/Admonition.cjs.map +1 -1
  10. package/build/legacy/components/Admonition.client.cjs +219 -0
  11. package/build/legacy/components/Admonition.client.cjs.map +1 -0
  12. package/build/legacy/components/AnimatingUploadIcon.cjs.map +1 -1
  13. package/build/legacy/components/Avatar.cjs +23 -174
  14. package/build/legacy/components/Avatar.cjs.map +1 -1
  15. package/build/legacy/components/Checkbox.cjs +22 -168
  16. package/build/legacy/components/Checkbox.cjs.map +1 -1
  17. package/build/legacy/components/DatePicker.client.cjs +129 -272
  18. package/build/legacy/components/DatePicker.client.cjs.map +1 -1
  19. package/build/legacy/components/DatePicker.server.cjs +17 -271
  20. package/build/legacy/components/DatePicker.server.cjs.map +1 -1
  21. package/build/legacy/components/Dialog.cjs +86 -0
  22. package/build/legacy/components/Dialog.cjs.map +1 -0
  23. package/build/legacy/components/Dialog.client.cjs +95 -0
  24. package/build/legacy/components/Dialog.client.cjs.map +1 -0
  25. package/build/legacy/components/FileStatus.cjs +62 -212
  26. package/build/legacy/components/FileStatus.cjs.map +1 -1
  27. package/build/legacy/components/FileUploader.cjs +29 -180
  28. package/build/legacy/components/FileUploader.cjs.map +1 -1
  29. package/build/legacy/components/Input.cjs +20 -172
  30. package/build/legacy/components/Input.cjs.map +1 -1
  31. package/build/legacy/components/Modal.cjs.map +1 -1
  32. package/build/legacy/components/ModalDescription.cjs.map +1 -1
  33. package/build/legacy/components/ModalHeader.cjs.map +1 -1
  34. package/build/legacy/components/ModalHeading.cjs.map +1 -1
  35. package/build/legacy/components/Notification.cjs +26 -176
  36. package/build/legacy/components/Notification.cjs.map +1 -1
  37. package/build/legacy/components/Select.cjs +26 -178
  38. package/build/legacy/components/Select.cjs.map +1 -1
  39. package/build/legacy/components/Tag.cjs +16 -167
  40. package/build/legacy/components/Tag.cjs.map +1 -1
  41. package/build/legacy/components/Toggle.cjs +20 -172
  42. package/build/legacy/components/Toggle.cjs.map +1 -1
  43. package/build/legacy/config/defineIcons.cjs +3 -39
  44. package/build/legacy/config/defineIcons.cjs.map +1 -1
  45. package/build/legacy/config/{cerbIcons.cjs → index.cjs} +22 -29
  46. package/build/legacy/config/index.cjs.map +1 -0
  47. package/build/legacy/config/types.cjs +19 -0
  48. package/build/legacy/config/types.cjs.map +1 -0
  49. package/build/legacy/context/cerberus.cjs +46 -0
  50. package/build/legacy/context/cerberus.cjs.map +1 -0
  51. package/build/legacy/context/confirm-modal.cjs +105 -321
  52. package/build/legacy/context/confirm-modal.cjs.map +1 -1
  53. package/build/legacy/context/cta-modal.cjs +137 -336
  54. package/build/legacy/context/cta-modal.cjs.map +1 -1
  55. package/build/legacy/context/notification-center/store.cjs +66 -0
  56. package/build/legacy/context/notification-center/store.cjs.map +1 -0
  57. package/build/legacy/context/notification-center/types.cjs +19 -0
  58. package/build/legacy/context/notification-center/types.cjs.map +1 -0
  59. package/build/legacy/context/notification-center.cjs +142 -249
  60. package/build/legacy/context/notification-center.cjs.map +1 -1
  61. package/build/legacy/context/prompt-modal.cjs +185 -388
  62. package/build/legacy/context/prompt-modal.cjs.map +1 -1
  63. package/build/legacy/index.cjs +1577 -1456
  64. package/build/legacy/index.cjs.map +1 -1
  65. package/build/modern/_tsup-dts-rollup.d.ts +374 -80
  66. package/build/modern/{chunk-BVCXVZAF.js → chunk-25HMVHLT.js} +6 -5
  67. package/build/modern/chunk-25HMVHLT.js.map +1 -0
  68. package/build/modern/chunk-36N4527B.js +1 -0
  69. package/build/modern/chunk-5EWCH7AI.js +82 -0
  70. package/build/modern/chunk-5EWCH7AI.js.map +1 -0
  71. package/build/modern/chunk-5SNLQZYP.js +25 -0
  72. package/build/modern/chunk-5SNLQZYP.js.map +1 -0
  73. package/build/modern/chunk-6BN3XKQF.js +42 -0
  74. package/build/modern/chunk-6BN3XKQF.js.map +1 -0
  75. package/build/modern/{chunk-2UXE5PDG.js → chunk-7NN3SJ7W.js} +1 -1
  76. package/build/modern/chunk-7NN3SJ7W.js.map +1 -0
  77. package/build/modern/{chunk-KWJ5FKX7.js → chunk-BAWZBF5Q.js} +5 -3
  78. package/build/modern/chunk-BAWZBF5Q.js.map +1 -0
  79. package/build/modern/{chunk-6BH5J5GF.js → chunk-BHB56M7S.js} +31 -46
  80. package/build/modern/chunk-BHB56M7S.js.map +1 -0
  81. package/build/modern/{chunk-HKJMLWVP.js → chunk-EDARV2EI.js} +5 -4
  82. package/build/modern/chunk-EDARV2EI.js.map +1 -0
  83. package/build/modern/{chunk-5OVH3INN.js → chunk-FGCO27TC.js} +25 -53
  84. package/build/modern/chunk-FGCO27TC.js.map +1 -0
  85. package/build/modern/{chunk-PVIMOXSO.js → chunk-GCQMH4QA.js} +5 -4
  86. package/build/modern/chunk-GCQMH4QA.js.map +1 -0
  87. package/build/modern/chunk-GITT5645.js +20 -0
  88. package/build/modern/chunk-GITT5645.js.map +1 -0
  89. package/build/modern/{chunk-TJCFYL5W.js → chunk-IGHMP4WA.js} +1 -20
  90. package/build/modern/chunk-IGHMP4WA.js.map +1 -0
  91. package/build/modern/chunk-ISCJ542I.js +82 -0
  92. package/build/modern/chunk-ISCJ542I.js.map +1 -0
  93. package/build/modern/{chunk-HVKM54BA.js → chunk-IW3LIRDG.js} +1 -1
  94. package/build/modern/chunk-IW3LIRDG.js.map +1 -0
  95. package/build/modern/chunk-JAROS4Q3.js +180 -0
  96. package/build/modern/chunk-JAROS4Q3.js.map +1 -0
  97. package/build/modern/{chunk-BE4EOU2P.js → chunk-JIRW4XOJ.js} +1 -1
  98. package/build/modern/chunk-JIRW4XOJ.js.map +1 -0
  99. package/build/modern/chunk-KDDPAJMR.js +9 -0
  100. package/build/modern/chunk-KDDPAJMR.js.map +1 -0
  101. package/build/modern/{chunk-XOROL3JY.js → chunk-KKHL3ZO4.js} +5 -4
  102. package/build/modern/chunk-KKHL3ZO4.js.map +1 -0
  103. package/build/modern/{chunk-U36UZJGZ.js → chunk-MZ3UCDUL.js} +5 -4
  104. package/build/modern/chunk-MZ3UCDUL.js.map +1 -0
  105. package/build/modern/{chunk-T2JOPPGL.js → chunk-N24COMHJ.js} +11 -4
  106. package/build/modern/chunk-N24COMHJ.js.map +1 -0
  107. package/build/modern/chunk-NJSETNRL.js +68 -0
  108. package/build/modern/chunk-NJSETNRL.js.map +1 -0
  109. package/build/modern/{chunk-XY6WL55R.js → chunk-NUMM4TNC.js} +1 -1
  110. package/build/modern/chunk-NUMM4TNC.js.map +1 -0
  111. package/build/modern/{chunk-FXLLRVAM.js → chunk-O6LFWUHI.js} +8 -6
  112. package/build/modern/chunk-O6LFWUHI.js.map +1 -0
  113. package/build/modern/{chunk-JJZQGR7A.js → chunk-RDRD6ACD.js} +9 -6
  114. package/build/modern/chunk-RDRD6ACD.js.map +1 -0
  115. package/build/modern/{chunk-XXWR7UGH.js → chunk-SD3OVTHT.js} +75 -103
  116. package/build/modern/chunk-SD3OVTHT.js.map +1 -0
  117. package/build/modern/chunk-TFL56AYR.js +56 -0
  118. package/build/modern/chunk-TFL56AYR.js.map +1 -0
  119. package/build/modern/chunk-V3M3ZOQI.js +38 -0
  120. package/build/modern/chunk-V3M3ZOQI.js.map +1 -0
  121. package/build/modern/{chunk-QK7R2XJM.js → chunk-XQICKZH4.js} +6 -5
  122. package/build/modern/chunk-XQICKZH4.js.map +1 -0
  123. package/build/modern/chunk-XZGXRRSQ.js +31 -0
  124. package/build/modern/chunk-XZGXRRSQ.js.map +1 -0
  125. package/build/modern/{chunk-KPUYKHLW.js → chunk-YKKNWILF.js} +71 -15
  126. package/build/modern/chunk-YKKNWILF.js.map +1 -0
  127. package/build/modern/{chunk-Q7BRMIBR.js → chunk-ZL6ZITLA.js} +1 -1
  128. package/build/modern/chunk-ZL6ZITLA.js.map +1 -0
  129. package/build/modern/components/Accordion.client.js +9 -0
  130. package/build/modern/components/Accordion.client.js.map +1 -0
  131. package/build/modern/components/Accordion.js +1 -7
  132. package/build/modern/components/AccordionItemGroup.js +4 -6
  133. package/build/modern/components/Admonition.client.js +11 -0
  134. package/build/modern/components/Admonition.client.js.map +1 -0
  135. package/build/modern/components/Admonition.js +4 -6
  136. package/build/modern/components/AnimatingUploadIcon.js +1 -1
  137. package/build/modern/components/Avatar.js +3 -5
  138. package/build/modern/components/Checkbox.js +2 -5
  139. package/build/modern/components/DatePicker.client.js +8 -7
  140. package/build/modern/components/DatePicker.server.js +3 -13
  141. package/build/modern/components/Dialog.client.js +10 -0
  142. package/build/modern/components/Dialog.client.js.map +1 -0
  143. package/build/modern/components/Dialog.js +24 -0
  144. package/build/modern/components/Dialog.js.map +1 -0
  145. package/build/modern/components/FileStatus.js +3 -6
  146. package/build/modern/components/FileUploader.js +3 -6
  147. package/build/modern/components/Input.js +2 -5
  148. package/build/modern/components/Modal.js +1 -1
  149. package/build/modern/components/ModalDescription.js +1 -1
  150. package/build/modern/components/ModalHeader.js +1 -1
  151. package/build/modern/components/ModalHeading.js +1 -1
  152. package/build/modern/components/Notification.js +2 -5
  153. package/build/modern/components/Select.js +2 -5
  154. package/build/modern/components/Tag.js +3 -5
  155. package/build/modern/components/Toggle.js +2 -5
  156. package/build/modern/config/defineIcons.js +2 -5
  157. package/build/modern/config/index.js +14 -0
  158. package/build/modern/config/index.js.map +1 -0
  159. package/build/modern/config/types.js +2 -0
  160. package/build/modern/config/types.js.map +1 -0
  161. package/build/modern/context/cerberus.js +10 -0
  162. package/build/modern/context/cerberus.js.map +1 -0
  163. package/build/modern/context/confirm-modal.js +5 -13
  164. package/build/modern/context/cta-modal.js +7 -14
  165. package/build/modern/context/notification-center/store.js +15 -0
  166. package/build/modern/context/notification-center/store.js.map +1 -0
  167. package/build/modern/context/notification-center/types.js +1 -0
  168. package/build/modern/context/notification-center/types.js.map +1 -0
  169. package/build/modern/context/notification-center.js +5 -7
  170. package/build/modern/context/prompt-modal.js +8 -15
  171. package/build/modern/index.js +111 -75
  172. package/build/modern/index.js.map +1 -1
  173. package/package.json +4 -8
  174. package/src/components/Accordion.client.tsx +46 -0
  175. package/src/components/Accordion.tsx +0 -37
  176. package/src/components/AccordionItemGroup.tsx +1 -1
  177. package/src/components/Admonition.client.tsx +73 -0
  178. package/src/components/Admonition.tsx +1 -70
  179. package/src/components/AnimatingUploadIcon.tsx +3 -3
  180. package/src/components/Avatar.tsx +5 -2
  181. package/src/components/Checkbox.tsx +10 -3
  182. package/src/components/DatePicker.client.tsx +111 -15
  183. package/src/components/DatePicker.server.tsx +2 -75
  184. package/src/components/Dialog.client.tsx +39 -0
  185. package/src/components/Dialog.tsx +165 -0
  186. package/src/components/FileStatus.tsx +5 -3
  187. package/src/components/FileUploader.tsx +3 -2
  188. package/src/components/Input.tsx +4 -2
  189. package/src/components/Modal.tsx +1 -16
  190. package/src/components/ModalDescription.tsx +1 -8
  191. package/src/components/ModalHeader.tsx +1 -10
  192. package/src/components/ModalHeading.tsx +1 -8
  193. package/src/components/Notification.tsx +9 -4
  194. package/src/components/Select.tsx +5 -2
  195. package/src/components/Tag.tsx +5 -2
  196. package/src/components/Toggle.tsx +4 -3
  197. package/src/config/defineIcons.ts +28 -16
  198. package/src/config/index.ts +28 -0
  199. package/src/config/types.ts +42 -0
  200. package/src/context/cerberus.tsx +44 -0
  201. package/src/context/confirm-modal.tsx +44 -42
  202. package/src/context/cta-modal.tsx +25 -38
  203. package/src/context/notification-center/store.ts +88 -0
  204. package/src/context/notification-center/types.ts +28 -0
  205. package/src/context/notification-center.tsx +81 -46
  206. package/src/context/prompt-modal.tsx +101 -103
  207. package/src/index.ts +15 -8
  208. package/build/legacy/config/cerbIcons.cjs.map +0 -1
  209. package/build/modern/chunk-2UXE5PDG.js.map +0 -1
  210. package/build/modern/chunk-5OVH3INN.js.map +0 -1
  211. package/build/modern/chunk-6BH5J5GF.js.map +0 -1
  212. package/build/modern/chunk-BC5SZDYY.js +0 -132
  213. package/build/modern/chunk-BC5SZDYY.js.map +0 -1
  214. package/build/modern/chunk-BE4EOU2P.js.map +0 -1
  215. package/build/modern/chunk-BVCXVZAF.js.map +0 -1
  216. package/build/modern/chunk-CRII2HNX.js +0 -55
  217. package/build/modern/chunk-CRII2HNX.js.map +0 -1
  218. package/build/modern/chunk-CVTON5DQ.js +0 -162
  219. package/build/modern/chunk-CVTON5DQ.js.map +0 -1
  220. package/build/modern/chunk-FXLLRVAM.js.map +0 -1
  221. package/build/modern/chunk-HKJMLWVP.js.map +0 -1
  222. package/build/modern/chunk-HVKM54BA.js.map +0 -1
  223. package/build/modern/chunk-JJZQGR7A.js.map +0 -1
  224. package/build/modern/chunk-KPUYKHLW.js.map +0 -1
  225. package/build/modern/chunk-KWJ5FKX7.js.map +0 -1
  226. package/build/modern/chunk-PVIMOXSO.js.map +0 -1
  227. package/build/modern/chunk-Q7BRMIBR.js.map +0 -1
  228. package/build/modern/chunk-QK7R2XJM.js.map +0 -1
  229. package/build/modern/chunk-QMF5ZNDG.js +0 -27
  230. package/build/modern/chunk-QMF5ZNDG.js.map +0 -1
  231. package/build/modern/chunk-QQOWWMZ3.js +0 -138
  232. package/build/modern/chunk-QQOWWMZ3.js.map +0 -1
  233. package/build/modern/chunk-T2JOPPGL.js.map +0 -1
  234. package/build/modern/chunk-TJCFYL5W.js.map +0 -1
  235. package/build/modern/chunk-U36UZJGZ.js.map +0 -1
  236. package/build/modern/chunk-XOROL3JY.js.map +0 -1
  237. package/build/modern/chunk-XXWR7UGH.js.map +0 -1
  238. package/build/modern/chunk-XY6WL55R.js.map +0 -1
  239. package/build/modern/config/cerbIcons.js +0 -9
  240. package/src/config/cerbIcons.ts +0 -73
  241. /package/build/modern/{config/cerbIcons.js.map → chunk-36N4527B.js.map} +0 -0
@@ -5,10 +5,10 @@ import { Show } from './Show'
5
5
  import {
6
6
  AccordionItem,
7
7
  AccordionItemContent,
8
- AccordionItemIndicator,
9
8
  AccordionItemTrigger,
10
9
  } from './Accordion'
11
10
  import { css } from '@cerberus/styled-system/css'
11
+ import { AccordionItemIndicator } from './Accordion.client'
12
12
 
13
13
  /**
14
14
  * This module contains an abstraction of the AccordionItem components.
@@ -0,0 +1,73 @@
1
+ 'use client'
2
+
3
+ import type { AdmonitionVariantProps } from '@cerberus/styled-system/recipes'
4
+ import { useCerberusContext } from '../context/cerberus'
5
+ import { Avatar } from './Avatar'
6
+
7
+ type MatchAvatarProps = AdmonitionVariantProps
8
+
9
+ export function MatchAvatar(props: MatchAvatarProps) {
10
+ const { icons } = useCerberusContext()
11
+ const {
12
+ infoNotification: InfoIcon,
13
+ successNotification: SuccessIcon,
14
+ warningNotification: WarningIcon,
15
+ dangerNotification: DangerIcon,
16
+ } = icons
17
+
18
+ switch (props.palette) {
19
+ case 'page':
20
+ return (
21
+ <Avatar
22
+ gradient="charon-light"
23
+ ariaLabel=""
24
+ icon={<InfoIcon />}
25
+ size="sm"
26
+ src=""
27
+ />
28
+ )
29
+ case 'info':
30
+ return (
31
+ <Avatar
32
+ gradient="amphiaraus-dark"
33
+ ariaLabel=""
34
+ icon={<InfoIcon />}
35
+ size="sm"
36
+ src=""
37
+ />
38
+ )
39
+ case 'success':
40
+ return (
41
+ <Avatar
42
+ gradient="thanatos-dark"
43
+ ariaLabel=""
44
+ icon={<SuccessIcon />}
45
+ size="sm"
46
+ src=""
47
+ />
48
+ )
49
+ case 'warning':
50
+ return (
51
+ <Avatar
52
+ gradient="asphodel-light"
53
+ ariaLabel=""
54
+ icon={<WarningIcon />}
55
+ size="sm"
56
+ src=""
57
+ />
58
+ )
59
+ case 'danger':
60
+ return (
61
+ <Avatar
62
+ gradient="hades-light"
63
+ ariaLabel=""
64
+ icon={<DangerIcon />}
65
+ size="sm"
66
+ src=""
67
+ />
68
+ )
69
+
70
+ default:
71
+ throw new Error('Unsupported admonition palette')
72
+ }
73
+ }
@@ -4,10 +4,9 @@ import {
4
4
  } from '@cerberus/styled-system/recipes'
5
5
  import { cx } from '@cerberus/styled-system/css'
6
6
  import { hstack } from '@cerberus/styled-system/patterns'
7
- import { $cerberusIcons } from '../config/defineIcons'
8
7
  import type { HTMLAttributes, ReactNode } from 'react'
9
- import { Avatar } from './Avatar'
10
8
  import { Show } from './Show'
9
+ import { MatchAvatar } from './Admonition.client'
11
10
 
12
11
  /**
13
12
  * This module provides a set of components for creating admonitions.
@@ -116,71 +115,3 @@ export function AdmonitionDescription(props: AdmonitionDescriptionProps) {
116
115
  />
117
116
  )
118
117
  }
119
-
120
- // Private components
121
-
122
- type MatchAvatarProps = AdmonitionVariantProps
123
-
124
- function MatchAvatar(props: MatchAvatarProps) {
125
- const {
126
- infoNotification: InfoIcon,
127
- successNotification: SuccessIcon,
128
- warningNotification: WarningIcon,
129
- dangerNotification: DangerIcon,
130
- } = $cerberusIcons
131
- switch (props.palette) {
132
- case 'page':
133
- return (
134
- <Avatar
135
- gradient="charon-light"
136
- ariaLabel=""
137
- icon={<InfoIcon />}
138
- size="sm"
139
- src=""
140
- />
141
- )
142
- case 'info':
143
- return (
144
- <Avatar
145
- gradient="amphiaraus-dark"
146
- ariaLabel=""
147
- icon={<InfoIcon />}
148
- size="sm"
149
- src=""
150
- />
151
- )
152
- case 'success':
153
- return (
154
- <Avatar
155
- gradient="thanatos-dark"
156
- ariaLabel=""
157
- icon={<SuccessIcon />}
158
- size="sm"
159
- src=""
160
- />
161
- )
162
- case 'warning':
163
- return (
164
- <Avatar
165
- gradient="asphodel-light"
166
- ariaLabel=""
167
- icon={<WarningIcon />}
168
- size="sm"
169
- src=""
170
- />
171
- )
172
- case 'danger':
173
- return (
174
- <Avatar
175
- gradient="hades-light"
176
- ariaLabel=""
177
- icon={<DangerIcon />}
178
- size="sm"
179
- src=""
180
- />
181
- )
182
-
183
- default:
184
- throw new Error('Unsupported admonition palette')
185
- }
186
- }
@@ -1,11 +1,11 @@
1
- import { type CarbonIconProps } from '@cerberus/icons'
2
-
3
1
  /**
4
2
  * This module contains an animating icon to use for the FileStatus component.
5
3
  * @module
6
4
  */
7
5
 
8
- export type AnimatingUploadIconProps = CarbonIconProps
6
+ export interface AnimatingUploadIconProps {
7
+ size?: 16 | 20 | 24 | 32
8
+ }
9
9
 
10
10
  export function AnimatingUploadIcon(props: AnimatingUploadIconProps) {
11
11
  return (
@@ -1,12 +1,14 @@
1
+ 'use client'
2
+
1
3
  import { css, cx } from '@cerberus/styled-system/css'
2
4
  import { circle } from '@cerberus/styled-system/patterns'
3
5
  import {
4
6
  avatar,
5
7
  type AvatarVariantProps,
6
8
  } from '@cerberus/styled-system/recipes'
7
- import { $cerberusIcons } from '../config/defineIcons'
8
9
  import type { HtmlHTMLAttributes, ReactNode } from 'react'
9
10
  import { Show } from './Show'
11
+ import { useCerberusContext } from '../context/cerberus'
10
12
 
11
13
  /**
12
14
  * This module contains the Avatar component.
@@ -84,7 +86,8 @@ export function Avatar(props: AvatarProps) {
84
86
  icon,
85
87
  ...nativeProps
86
88
  } = props
87
- const { avatar: AvatarIcon } = $cerberusIcons
89
+ const { icons } = useCerberusContext()
90
+ const { avatar: AvatarIcon } = icons
88
91
  const initials = (ariaLabel || '')
89
92
  .split(' ')
90
93
  .map((word) => word[0])
@@ -9,7 +9,7 @@ import { cx } from '@cerberus/styled-system/css'
9
9
  import type { InputHTMLAttributes } from 'react'
10
10
  import { Show } from './Show'
11
11
  import { useFieldContext } from '../context/field'
12
- import { $cerberusIcons } from '../config/defineIcons'
12
+ import { useCerberusContext } from '../context/cerberus'
13
13
 
14
14
  /**
15
15
  * This module contains the Checkbox component.
@@ -49,8 +49,15 @@ export function Checkbox(props: CheckboxProps) {
49
49
  const { describedBy, size, checked, mixed, ...nativeProps } = props
50
50
  const { invalid, ...fieldStates } = useFieldContext()
51
51
  const styles = checkbox({ size })
52
- const { checkbox: CheckIcon, indeterminate: IndeterminateIcon } =
53
- $cerberusIcons
52
+ const { icons } = useCerberusContext()
53
+ const { checkbox: CheckIcon, indeterminate: IndeterminateIcon } = icons
54
+
55
+ if (!CheckIcon) {
56
+ throw new Error('The CerberusProvider is missing the checkbox icon.')
57
+ }
58
+ if (!IndeterminateIcon) {
59
+ throw new Error('The CerberusProvider is missing the indeterminate icon.')
60
+ }
54
61
 
55
62
  return (
56
63
  <div
@@ -5,25 +5,27 @@ import {
5
5
  type DatePickerContentProps,
6
6
  type DatePickerInputProps,
7
7
  type DatePickerRootProps,
8
+ type DatePickerTriggerProps,
9
+ type DatePickerViewControlProps,
8
10
  type DatePickerViewProps,
9
- // type DateValue,
10
11
  } from '@ark-ui/react'
11
12
  import { Portal } from './Portal'
12
- // import { useCallback } from 'react'
13
- import { datePicker } from '@cerberus/styled-system/recipes'
14
- import { cx } from '@cerberus/styled-system/css'
13
+ import { datePicker, iconButton } from '@cerberus/styled-system/recipes'
14
+ import { css, cx } from '@cerberus/styled-system/css'
15
15
  import { useFieldContext } from '../context/field'
16
16
  import {
17
- DatePickerTrigger,
18
17
  DatePickerView,
19
18
  DatePickerContext,
20
- DatePickerViewControlGroup,
21
19
  DatePickerTable,
22
20
  DatePickerTableHeader,
23
21
  DatePickerTableCellTrigger,
24
22
  DatePickerTableCell,
23
+ DatePickerViewControl,
25
24
  } from './DatePicker.server'
26
- // import { formatISOToMilitary } from '../hooks/useDate'
25
+ import { IconButton } from './IconButton'
26
+ import { Button } from './Button'
27
+ import { useCerberusContext } from '../context/cerberus'
28
+ import { useMemo, type InputHTMLAttributes } from 'react'
27
29
 
28
30
  /**
29
31
  * This module contains the DatePicker client family components.
@@ -69,6 +71,77 @@ export function DatePicker(props: DatePickerRootProps) {
69
71
  )
70
72
  }
71
73
 
74
+ /**
75
+ * An abstraction of the DatePicker control that contains the prev, view, and
76
+ * next triggers which control the calendar output.
77
+ * @definition [datePicker docs](https://cerberus.digitalu.design/react/date-picker)
78
+ * @example
79
+ * ```tsx
80
+ * <DatePickerViewControlGroup />
81
+ * ```
82
+ */
83
+ export function DatePickerViewControlGroup(props: DatePickerViewControlProps) {
84
+ const { icons } = useCerberusContext()
85
+ const { calendarPrev: PrevIcon, calendarNext: NextIcon } = icons
86
+ return (
87
+ <DatePickerViewControl {...props}>
88
+ <ArkDP.PrevTrigger asChild>
89
+ <IconButton ariaLabel="Previous" size="sm">
90
+ <PrevIcon />
91
+ </IconButton>
92
+ </ArkDP.PrevTrigger>
93
+
94
+ <ArkDP.ViewTrigger asChild>
95
+ <Button
96
+ className={css({
97
+ h: '2rem',
98
+ paddingInline: 'md',
99
+ })}
100
+ shape="rounded"
101
+ size="sm"
102
+ usage="ghost"
103
+ >
104
+ <ArkDP.RangeText />
105
+ </Button>
106
+ </ArkDP.ViewTrigger>
107
+
108
+ <ArkDP.NextTrigger asChild>
109
+ <IconButton ariaLabel="Next" size="sm">
110
+ <NextIcon />
111
+ </IconButton>
112
+ </ArkDP.NextTrigger>
113
+ </DatePickerViewControl>
114
+ )
115
+ }
116
+
117
+ /**
118
+ * The trigger component for the DatePicker which opens the calendar.
119
+ * @definition [datePicker docs](https://cerberus.digitalu.design/react/date-picker)
120
+ * @example
121
+ * ```tsx
122
+ * <DatePickerTrigger />
123
+ * ```
124
+ */
125
+ export function DatePickerTrigger(props: DatePickerTriggerProps) {
126
+ const { icons } = useCerberusContext()
127
+ const { calendar: CalendarIcon } = icons
128
+ return (
129
+ <ArkDP.Trigger
130
+ {...props}
131
+ className={cx(
132
+ props.className,
133
+ iconButton({
134
+ size: 'sm',
135
+ usage: 'ghost',
136
+ }),
137
+ datePickerStyles.trigger,
138
+ )}
139
+ >
140
+ <CalendarIcon />
141
+ </ArkDP.Trigger>
142
+ )
143
+ }
144
+
72
145
  /**
73
146
  * The input component for the DatePicker.
74
147
  * @definition [Date Picker docs](https://cerberus.digitalu.design/react/date-picker)
@@ -100,6 +173,18 @@ export function DatePickerInput(props: DatePickerInputProps) {
100
173
  )
101
174
  }
102
175
 
176
+ export interface RangePickerInputProps
177
+ extends Omit<DatePickerInputProps, 'defaultValue'> {
178
+ /**
179
+ * The defaultValue to add for the inputs. The first item is the start date
180
+ * and the second item is the end date.
181
+ */
182
+ defaultValue?: [
183
+ InputHTMLAttributes<HTMLInputElement>['defaultValue'],
184
+ InputHTMLAttributes<HTMLInputElement>['defaultValue'],
185
+ ]
186
+ }
187
+
103
188
  /**
104
189
  * The input component for the DatePicker that uses ranges.
105
190
  * @definition [Date Picker docs](https://cerberus.digitalu.design/react/date-picker)
@@ -114,26 +199,33 @@ export function DatePickerInput(props: DatePickerInputProps) {
114
199
  * </Field>
115
200
  * ```
116
201
  */
117
- export function RangePickerInput(props: DatePickerInputProps) {
202
+ export function RangePickerInput(props: RangePickerInputProps) {
118
203
  const { invalid, ...fieldStates } = useFieldContext()
204
+ const { defaultValue, ...nativeProps } = props
205
+
206
+ const startDate = useMemo(() => defaultValue?.[0], [defaultValue])
207
+ const endDate = useMemo(() => defaultValue?.[1], [defaultValue])
208
+
119
209
  return (
120
210
  <ArkDP.Control data-range className={datePickerStyles.control}>
121
211
  <DatePickerTrigger />
122
212
  <ArkDP.Input
123
- {...props}
213
+ {...nativeProps}
124
214
  {...fieldStates}
125
215
  {...(invalid && { 'aria-invalid': true })}
126
216
  data-range-input
217
+ defaultValue={startDate}
127
218
  className={cx(props.className, datePickerStyles.input)}
128
219
  placeholder={props.placeholder ?? 'DD MMM YYYY'}
129
220
  maxLength={11}
130
221
  index={0}
131
222
  />
132
223
  <ArkDP.Input
133
- {...props}
224
+ {...nativeProps}
134
225
  {...fieldStates}
135
226
  {...(invalid && { 'aria-invalid': true })}
136
227
  data-range-input
228
+ defaultValue={endDate}
137
229
  data-range-end-input
138
230
  className={cx(props.className, datePickerStyles.input)}
139
231
  placeholder={props.placeholder ?? 'DD MMM YYYY'}
@@ -158,10 +250,14 @@ export function RangePickerInput(props: DatePickerInputProps) {
158
250
  * </Field>
159
251
  * ```
160
252
  */
161
- export function DatePickerContent(props: DatePickerContentProps) {
162
- const { children, ...contentProps } = props
253
+ export function DatePickerContent(
254
+ props: DatePickerContentProps & {
255
+ withModal?: boolean
256
+ },
257
+ ) {
258
+ const { children, withModal, ...contentProps } = props
163
259
  return (
164
- <Portal>
260
+ <Portal disabled={withModal ?? false}>
165
261
  <ArkDP.Positioner className={datePickerStyles.positioner}>
166
262
  <ArkDP.Content
167
263
  {...contentProps}
@@ -354,9 +450,9 @@ export function DatePickerYearView(props: Omit<DatePickerViewProps, 'view'>) {
354
450
  * </Field>
355
451
  * ```
356
452
  */
357
- export function DatePickerCalendar() {
453
+ export function DatePickerCalendar(props: { withModal?: boolean }) {
358
454
  return (
359
- <DatePickerContent>
455
+ <DatePickerContent withModal={props.withModal}>
360
456
  <DatePickerDayView />
361
457
  <DatePickerMonthView />
362
458
  <DatePickerYearView />
@@ -5,14 +5,10 @@ import {
5
5
  type DatePickerTableCellTriggerProps,
6
6
  type DatePickerTableHeaderProps,
7
7
  type DatePickerTableProps,
8
- type DatePickerTriggerProps,
9
8
  type DatePickerViewControlProps,
10
9
  } from '@ark-ui/react'
11
- import { css, cx } from '@cerberus/styled-system/css'
12
- import { datePicker, iconButton, label } from '@cerberus/styled-system/recipes'
13
- import { $cerberusIcons } from '../config/defineIcons'
14
- import { IconButton } from './IconButton'
15
- import { Button } from './Button'
10
+ import { cx } from '@cerberus/styled-system/css'
11
+ import { datePicker, label } from '@cerberus/styled-system/recipes'
16
12
 
17
13
  /**
18
14
  * This module contains the DatePicker server family components.
@@ -47,33 +43,6 @@ export function DatePickerLabel(props: DatePickerLabelProps) {
47
43
  )
48
44
  }
49
45
 
50
- /**
51
- * The trigger component for the DatePicker which opens the calendar.
52
- * @definition [datePicker docs](https://cerberus.digitalu.design/react/date-picker)
53
- * @example
54
- * ```tsx
55
- * <DatePickerTrigger />
56
- * ```
57
- */
58
- export function DatePickerTrigger(props: DatePickerTriggerProps) {
59
- const { calendar: CalendarIcon } = $cerberusIcons
60
- return (
61
- <ArkDP.Trigger
62
- {...props}
63
- className={cx(
64
- props.className,
65
- iconButton({
66
- size: 'sm',
67
- usage: 'ghost',
68
- }),
69
- datePickerStyles.trigger,
70
- )}
71
- >
72
- <CalendarIcon />
73
- </ArkDP.Trigger>
74
- )
75
- }
76
-
77
46
  /**
78
47
  * The control component for the DatePicker which wraps the triggers to switch
79
48
  * between calendar views.
@@ -96,48 +65,6 @@ export function DatePickerViewControl(props: DatePickerViewControlProps) {
96
65
  )
97
66
  }
98
67
 
99
- /**
100
- * An abstraction of the DatePicker control that contains the prev, view, and
101
- * next triggers which control the calendar output.
102
- * @definition [datePicker docs](https://cerberus.digitalu.design/react/date-picker)
103
- * @example
104
- * ```tsx
105
- * <DatePickerViewControlGroup />
106
- * ```
107
- */
108
- export function DatePickerViewControlGroup(props: DatePickerViewControlProps) {
109
- const { calendarPrev: PrevIcon, calendarNext: NextIcon } = $cerberusIcons
110
- return (
111
- <DatePickerViewControl {...props}>
112
- <ArkDP.PrevTrigger asChild>
113
- <IconButton ariaLabel="Previous" size="sm">
114
- <PrevIcon />
115
- </IconButton>
116
- </ArkDP.PrevTrigger>
117
-
118
- <ArkDP.ViewTrigger asChild>
119
- <Button
120
- className={css({
121
- h: '2rem',
122
- paddingInline: 'md',
123
- })}
124
- shape="rounded"
125
- size="sm"
126
- usage="ghost"
127
- >
128
- <ArkDP.RangeText />
129
- </Button>
130
- </ArkDP.ViewTrigger>
131
-
132
- <ArkDP.NextTrigger asChild>
133
- <IconButton ariaLabel="Next" size="sm">
134
- <NextIcon />
135
- </IconButton>
136
- </ArkDP.NextTrigger>
137
- </DatePickerViewControl>
138
- )
139
- }
140
-
141
68
  /**
142
69
  * The table component for the DatePicker.
143
70
  * @definition [datePicker docs](https://cerberus.digitalu.design/react/date-picker)
@@ -0,0 +1,39 @@
1
+ 'use client'
2
+
3
+ import {
4
+ Dialog as ArkDialog,
5
+ type DialogCloseTriggerProps,
6
+ } from '@ark-ui/react'
7
+ import { dialog } from '@cerberus/styled-system/recipes'
8
+ import { cx } from '@cerberus/styled-system/css'
9
+ import { IconButton } from './IconButton'
10
+ import { useCerberusContext } from '../context/cerberus'
11
+
12
+ /**
13
+ * This module contains client-side components for the Dialog family.
14
+ * @module @cerberus-design/react/dialog
15
+ */
16
+
17
+ export function DialogCloseIconTrigger(props: DialogCloseTriggerProps) {
18
+ const { icons } = useCerberusContext()
19
+ const { close: CloseIcon } = icons
20
+
21
+ const styles = dialog()
22
+
23
+ return (
24
+ <ArkDialog.CloseTrigger
25
+ {...props}
26
+ className={cx(props.className, styles.closeTrigger)}
27
+ asChild
28
+ >
29
+ <IconButton
30
+ ariaLabel="Close dialog"
31
+ palette="action"
32
+ size="lg"
33
+ usage="ghost"
34
+ >
35
+ <CloseIcon />
36
+ </IconButton>
37
+ </ArkDialog.CloseTrigger>
38
+ )
39
+ }