@cerberus-design/react 0.14.2-next-a928afd → 0.14.2-next-0052cda

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 (188) hide show
  1. package/build/legacy/_tsup-dts-rollup.d.cts +111 -34
  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 +119 -268
  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/FileStatus.cjs +62 -212
  22. package/build/legacy/components/FileStatus.cjs.map +1 -1
  23. package/build/legacy/components/FileUploader.cjs +29 -180
  24. package/build/legacy/components/FileUploader.cjs.map +1 -1
  25. package/build/legacy/components/Input.cjs +20 -172
  26. package/build/legacy/components/Input.cjs.map +1 -1
  27. package/build/legacy/components/Notification.cjs +25 -176
  28. package/build/legacy/components/Notification.cjs.map +1 -1
  29. package/build/legacy/components/Select.cjs +26 -178
  30. package/build/legacy/components/Select.cjs.map +1 -1
  31. package/build/legacy/components/Tag.cjs +16 -167
  32. package/build/legacy/components/Tag.cjs.map +1 -1
  33. package/build/legacy/components/Toggle.cjs +20 -172
  34. package/build/legacy/components/Toggle.cjs.map +1 -1
  35. package/build/legacy/config/defineIcons.cjs +3 -39
  36. package/build/legacy/config/defineIcons.cjs.map +1 -1
  37. package/build/legacy/config/{cerbIcons.cjs → index.cjs} +22 -29
  38. package/build/legacy/config/index.cjs.map +1 -0
  39. package/build/legacy/config/types.cjs +19 -0
  40. package/build/legacy/config/types.cjs.map +1 -0
  41. package/build/legacy/context/cerberus.cjs +46 -0
  42. package/build/legacy/context/cerberus.cjs.map +1 -0
  43. package/build/legacy/context/confirm-modal.cjs +58 -207
  44. package/build/legacy/context/confirm-modal.cjs.map +1 -1
  45. package/build/legacy/context/cta-modal.cjs +57 -209
  46. package/build/legacy/context/cta-modal.cjs.map +1 -1
  47. package/build/legacy/context/notification-center.cjs +55 -206
  48. package/build/legacy/context/notification-center.cjs.map +1 -1
  49. package/build/legacy/context/prompt-modal.cjs +83 -233
  50. package/build/legacy/context/prompt-modal.cjs.map +1 -1
  51. package/build/legacy/index.cjs +950 -930
  52. package/build/legacy/index.cjs.map +1 -1
  53. package/build/modern/_tsup-dts-rollup.d.ts +111 -34
  54. package/build/modern/{chunk-BVCXVZAF.js → chunk-25HMVHLT.js} +6 -5
  55. package/build/modern/chunk-25HMVHLT.js.map +1 -0
  56. package/build/modern/chunk-36N4527B.js +1 -0
  57. package/build/modern/chunk-5EWCH7AI.js +82 -0
  58. package/build/modern/chunk-5EWCH7AI.js.map +1 -0
  59. package/build/modern/chunk-5SNLQZYP.js +25 -0
  60. package/build/modern/chunk-5SNLQZYP.js.map +1 -0
  61. package/build/modern/{chunk-6BH5J5GF.js → chunk-CCTLGF5U.js} +18 -17
  62. package/build/modern/chunk-CCTLGF5U.js.map +1 -0
  63. package/build/modern/{chunk-HKJMLWVP.js → chunk-EDARV2EI.js} +5 -4
  64. package/build/modern/chunk-EDARV2EI.js.map +1 -0
  65. package/build/modern/{chunk-FXLLRVAM.js → chunk-EMNBMH7Z.js} +13 -11
  66. package/build/modern/chunk-EMNBMH7Z.js.map +1 -0
  67. package/build/modern/{chunk-PVIMOXSO.js → chunk-GCQMH4QA.js} +5 -4
  68. package/build/modern/chunk-GCQMH4QA.js.map +1 -0
  69. package/build/modern/chunk-GITT5645.js +20 -0
  70. package/build/modern/chunk-GITT5645.js.map +1 -0
  71. package/build/modern/{chunk-TJCFYL5W.js → chunk-IGHMP4WA.js} +1 -20
  72. package/build/modern/chunk-IGHMP4WA.js.map +1 -0
  73. package/build/modern/chunk-ISCJ542I.js +82 -0
  74. package/build/modern/chunk-ISCJ542I.js.map +1 -0
  75. package/build/modern/{chunk-HVKM54BA.js → chunk-IW3LIRDG.js} +1 -1
  76. package/build/modern/chunk-IW3LIRDG.js.map +1 -0
  77. package/build/modern/{chunk-KWJ5FKX7.js → chunk-JQCRDZNI.js} +8 -6
  78. package/build/modern/chunk-JQCRDZNI.js.map +1 -0
  79. package/build/modern/chunk-KDDPAJMR.js +9 -0
  80. package/build/modern/chunk-KDDPAJMR.js.map +1 -0
  81. package/build/modern/{chunk-JJZQGR7A.js → chunk-KF35CYT4.js} +8 -6
  82. package/build/modern/chunk-KF35CYT4.js.map +1 -0
  83. package/build/modern/{chunk-XOROL3JY.js → chunk-KKHL3ZO4.js} +5 -4
  84. package/build/modern/chunk-KKHL3ZO4.js.map +1 -0
  85. package/build/modern/{chunk-U36UZJGZ.js → chunk-MZ3UCDUL.js} +5 -4
  86. package/build/modern/chunk-MZ3UCDUL.js.map +1 -0
  87. package/build/modern/{chunk-T2JOPPGL.js → chunk-N24COMHJ.js} +11 -4
  88. package/build/modern/chunk-N24COMHJ.js.map +1 -0
  89. package/build/modern/{chunk-CVTON5DQ.js → chunk-N3L3PEMF.js} +2 -2
  90. package/build/modern/chunk-NJSETNRL.js +68 -0
  91. package/build/modern/chunk-NJSETNRL.js.map +1 -0
  92. package/build/modern/{chunk-XXWR7UGH.js → chunk-QKZZHZL4.js} +22 -21
  93. package/build/modern/chunk-QKZZHZL4.js.map +1 -0
  94. package/build/modern/{chunk-KPUYKHLW.js → chunk-UMF2TWZN.js} +59 -9
  95. package/build/modern/chunk-UMF2TWZN.js.map +1 -0
  96. package/build/modern/{chunk-QK7R2XJM.js → chunk-XQICKZH4.js} +6 -5
  97. package/build/modern/chunk-XQICKZH4.js.map +1 -0
  98. package/build/modern/chunk-XZGXRRSQ.js +31 -0
  99. package/build/modern/chunk-XZGXRRSQ.js.map +1 -0
  100. package/build/modern/{chunk-5OVH3INN.js → chunk-Z64YZ5IH.js} +18 -18
  101. package/build/modern/chunk-Z64YZ5IH.js.map +1 -0
  102. package/build/modern/components/Accordion.client.js +9 -0
  103. package/build/modern/components/Accordion.client.js.map +1 -0
  104. package/build/modern/components/Accordion.js +1 -7
  105. package/build/modern/components/AccordionItemGroup.js +4 -6
  106. package/build/modern/components/Admonition.client.js +11 -0
  107. package/build/modern/components/Admonition.client.js.map +1 -0
  108. package/build/modern/components/Admonition.js +4 -6
  109. package/build/modern/components/AnimatingUploadIcon.js +1 -1
  110. package/build/modern/components/Avatar.js +3 -5
  111. package/build/modern/components/Checkbox.js +2 -5
  112. package/build/modern/components/DatePicker.client.js +8 -7
  113. package/build/modern/components/DatePicker.server.js +3 -13
  114. package/build/modern/components/FileStatus.js +4 -7
  115. package/build/modern/components/FileUploader.js +3 -6
  116. package/build/modern/components/Input.js +2 -5
  117. package/build/modern/components/Notification.js +2 -5
  118. package/build/modern/components/Select.js +2 -5
  119. package/build/modern/components/Tag.js +3 -5
  120. package/build/modern/components/Toggle.js +2 -5
  121. package/build/modern/config/defineIcons.js +2 -5
  122. package/build/modern/config/index.js +14 -0
  123. package/build/modern/config/index.js.map +1 -0
  124. package/build/modern/config/types.js +2 -0
  125. package/build/modern/config/types.js.map +1 -0
  126. package/build/modern/context/cerberus.js +10 -0
  127. package/build/modern/context/cerberus.js.map +1 -0
  128. package/build/modern/context/confirm-modal.js +6 -9
  129. package/build/modern/context/cta-modal.js +6 -9
  130. package/build/modern/context/notification-center.js +3 -6
  131. package/build/modern/context/prompt-modal.js +8 -11
  132. package/build/modern/index.js +105 -94
  133. package/build/modern/index.js.map +1 -1
  134. package/package.json +4 -8
  135. package/src/components/Accordion.client.tsx +46 -0
  136. package/src/components/Accordion.tsx +0 -37
  137. package/src/components/AccordionItemGroup.tsx +1 -1
  138. package/src/components/Admonition.client.tsx +73 -0
  139. package/src/components/Admonition.tsx +1 -70
  140. package/src/components/AnimatingUploadIcon.tsx +3 -3
  141. package/src/components/Avatar.tsx +5 -2
  142. package/src/components/Checkbox.tsx +10 -3
  143. package/src/components/DatePicker.client.tsx +79 -7
  144. package/src/components/DatePicker.server.tsx +2 -75
  145. package/src/components/FileStatus.tsx +5 -3
  146. package/src/components/FileUploader.tsx +3 -2
  147. package/src/components/Input.tsx +4 -2
  148. package/src/components/Notification.tsx +7 -4
  149. package/src/components/Select.tsx +5 -2
  150. package/src/components/Tag.tsx +5 -2
  151. package/src/components/Toggle.tsx +4 -3
  152. package/src/config/defineIcons.ts +28 -16
  153. package/src/config/index.ts +28 -0
  154. package/src/config/types.ts +42 -0
  155. package/src/context/cerberus.tsx +44 -0
  156. package/src/context/confirm-modal.tsx +4 -2
  157. package/src/context/cta-modal.tsx +5 -4
  158. package/src/context/prompt-modal.tsx +4 -2
  159. package/src/index.ts +3 -1
  160. package/build/legacy/config/cerbIcons.cjs.map +0 -1
  161. package/build/modern/chunk-5OVH3INN.js.map +0 -1
  162. package/build/modern/chunk-6BH5J5GF.js.map +0 -1
  163. package/build/modern/chunk-BC5SZDYY.js +0 -132
  164. package/build/modern/chunk-BC5SZDYY.js.map +0 -1
  165. package/build/modern/chunk-BVCXVZAF.js.map +0 -1
  166. package/build/modern/chunk-CRII2HNX.js +0 -55
  167. package/build/modern/chunk-CRII2HNX.js.map +0 -1
  168. package/build/modern/chunk-FXLLRVAM.js.map +0 -1
  169. package/build/modern/chunk-HKJMLWVP.js.map +0 -1
  170. package/build/modern/chunk-HVKM54BA.js.map +0 -1
  171. package/build/modern/chunk-JJZQGR7A.js.map +0 -1
  172. package/build/modern/chunk-KPUYKHLW.js.map +0 -1
  173. package/build/modern/chunk-KWJ5FKX7.js.map +0 -1
  174. package/build/modern/chunk-PVIMOXSO.js.map +0 -1
  175. package/build/modern/chunk-QK7R2XJM.js.map +0 -1
  176. package/build/modern/chunk-QMF5ZNDG.js +0 -27
  177. package/build/modern/chunk-QMF5ZNDG.js.map +0 -1
  178. package/build/modern/chunk-QQOWWMZ3.js +0 -138
  179. package/build/modern/chunk-QQOWWMZ3.js.map +0 -1
  180. package/build/modern/chunk-T2JOPPGL.js.map +0 -1
  181. package/build/modern/chunk-TJCFYL5W.js.map +0 -1
  182. package/build/modern/chunk-U36UZJGZ.js.map +0 -1
  183. package/build/modern/chunk-XOROL3JY.js.map +0 -1
  184. package/build/modern/chunk-XXWR7UGH.js.map +0 -1
  185. package/build/modern/config/cerbIcons.js +0 -9
  186. package/src/config/cerbIcons.ts +0 -73
  187. /package/build/modern/{config/cerbIcons.js.map → chunk-36N4527B.js.map} +0 -0
  188. /package/build/modern/{chunk-CVTON5DQ.js.map → chunk-N3L3PEMF.js.map} +0 -0
@@ -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,26 @@ 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'
27
28
 
28
29
  /**
29
30
  * This module contains the DatePicker client family components.
@@ -69,6 +70,77 @@ export function DatePicker(props: DatePickerRootProps) {
69
70
  )
70
71
  }
71
72
 
73
+ /**
74
+ * An abstraction of the DatePicker control that contains the prev, view, and
75
+ * next triggers which control the calendar output.
76
+ * @definition [datePicker docs](https://cerberus.digitalu.design/react/date-picker)
77
+ * @example
78
+ * ```tsx
79
+ * <DatePickerViewControlGroup />
80
+ * ```
81
+ */
82
+ export function DatePickerViewControlGroup(props: DatePickerViewControlProps) {
83
+ const { icons } = useCerberusContext()
84
+ const { calendarPrev: PrevIcon, calendarNext: NextIcon } = icons
85
+ return (
86
+ <DatePickerViewControl {...props}>
87
+ <ArkDP.PrevTrigger asChild>
88
+ <IconButton ariaLabel="Previous" size="sm">
89
+ <PrevIcon />
90
+ </IconButton>
91
+ </ArkDP.PrevTrigger>
92
+
93
+ <ArkDP.ViewTrigger asChild>
94
+ <Button
95
+ className={css({
96
+ h: '2rem',
97
+ paddingInline: 'md',
98
+ })}
99
+ shape="rounded"
100
+ size="sm"
101
+ usage="ghost"
102
+ >
103
+ <ArkDP.RangeText />
104
+ </Button>
105
+ </ArkDP.ViewTrigger>
106
+
107
+ <ArkDP.NextTrigger asChild>
108
+ <IconButton ariaLabel="Next" size="sm">
109
+ <NextIcon />
110
+ </IconButton>
111
+ </ArkDP.NextTrigger>
112
+ </DatePickerViewControl>
113
+ )
114
+ }
115
+
116
+ /**
117
+ * The trigger component for the DatePicker which opens the calendar.
118
+ * @definition [datePicker docs](https://cerberus.digitalu.design/react/date-picker)
119
+ * @example
120
+ * ```tsx
121
+ * <DatePickerTrigger />
122
+ * ```
123
+ */
124
+ export function DatePickerTrigger(props: DatePickerTriggerProps) {
125
+ const { icons } = useCerberusContext()
126
+ const { calendar: CalendarIcon } = icons
127
+ return (
128
+ <ArkDP.Trigger
129
+ {...props}
130
+ className={cx(
131
+ props.className,
132
+ iconButton({
133
+ size: 'sm',
134
+ usage: 'ghost',
135
+ }),
136
+ datePickerStyles.trigger,
137
+ )}
138
+ >
139
+ <CalendarIcon />
140
+ </ArkDP.Trigger>
141
+ )
142
+ }
143
+
72
144
  /**
73
145
  * The input component for the DatePicker.
74
146
  * @definition [Date Picker docs](https://cerberus.digitalu.design/react/date-picker)
@@ -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)
@@ -12,8 +12,8 @@ import {
12
12
  } from '@cerberus/styled-system/recipes'
13
13
  import { css, cx } from '@cerberus/styled-system/css'
14
14
  import { hstack, vstack } from '@cerberus/styled-system/patterns'
15
- import { $cerberusIcons } from '../config/defineIcons'
16
15
  import { Field } from '../context/field'
16
+ import { useCerberusContext } from '../context/cerberus'
17
17
  import { FieldMessage } from './FieldMessage'
18
18
  import { ProgressBar, type ProgressBarProps } from './ProgressBar'
19
19
  import { IconButton } from './IconButton'
@@ -188,12 +188,13 @@ interface FileStatusElProps {
188
188
  }
189
189
 
190
190
  function MatchFileStatusIcon(props: FileStatusElProps) {
191
+ const { icons } = useCerberusContext()
191
192
  const {
192
193
  waitingFileUploader: TodoIcon,
193
194
  fileUploader: FileUploaderIcon,
194
195
  invalidAlt: InvalidIcon,
195
196
  successNotification: DoneIcon,
196
- } = $cerberusIcons
197
+ } = icons
197
198
 
198
199
  switch (props.status) {
199
200
  case processStatus.TODO:
@@ -225,7 +226,8 @@ function MatchFileStatusText(props: FileStatusElProps) {
225
226
  }
226
227
 
227
228
  function MatchStatusAction(props: FileStatusElProps) {
228
- const { close: CloseIcon, redo: RedoIcon, delete: TrashIcon } = $cerberusIcons
229
+ const { icons } = useCerberusContext()
230
+ const { close: CloseIcon, redo: RedoIcon, delete: TrashIcon } = icons
229
231
  switch (props.status) {
230
232
  case processStatus.TODO:
231
233
  case processStatus.PROCESSING:
@@ -5,7 +5,7 @@ import { vstack } from '@cerberus/styled-system/patterns'
5
5
  import { type InputHTMLAttributes } from 'react'
6
6
  import { Show } from './Show'
7
7
  import { fileUploader } from '@cerberus/styled-system/recipes'
8
- import { $cerberusIcons } from '../config/defineIcons'
8
+ import { useCerberusContext } from '../context/cerberus'
9
9
  import { Avatar } from './Avatar'
10
10
 
11
11
  export interface FileUploaderProps
@@ -29,8 +29,9 @@ export interface FileUploaderProps
29
29
  * @see https://cerberus.digitalu.design/react/file-uploader
30
30
  */
31
31
  export function FileUploader(props: FileUploaderProps) {
32
+ const { icons } = useCerberusContext()
32
33
  const styles = fileUploader()
33
- const { waitingFileUploader: Icon } = $cerberusIcons
34
+ const { waitingFileUploader: Icon } = icons
34
35
 
35
36
  return (
36
37
  <div
@@ -4,7 +4,7 @@ import type { InputHTMLAttributes, ReactNode } from 'react'
4
4
  import { input, type InputVariantProps } from '@cerberus/styled-system/recipes'
5
5
  import { cx } from '@cerberus/styled-system/css'
6
6
  import { useFieldContext } from '../context/field'
7
- import { $cerberusIcons } from '../config/defineIcons'
7
+ import { useCerberusContext } from '../context/cerberus'
8
8
  import { Show } from './Show'
9
9
 
10
10
  export interface InputBaseProps
@@ -39,7 +39,9 @@ export function Input(props: InputProps) {
39
39
  const inputStyles = input({ size })
40
40
  const { invalid, ...fieldStates } = useFieldContext()
41
41
  const hasEndIcon = Boolean(endIcon)
42
- const { invalid: InvalidIcon } = $cerberusIcons
42
+
43
+ const { icons } = useCerberusContext()
44
+ const { invalid: InvalidIcon } = icons
43
45
 
44
46
  return (
45
47
  <div className={inputStyles.root}>
@@ -12,8 +12,8 @@ import {
12
12
  type PropsWithChildren,
13
13
  type MouseEvent,
14
14
  } from 'react'
15
- import { $cerberusIcons } from '../config/defineIcons'
16
15
  import { trapFocus } from '../aria-helpers/trap-focus.aria'
16
+ import { useCerberusContext } from '../context/cerberus'
17
17
 
18
18
  /**
19
19
  * This module exports the Notification component.
@@ -21,13 +21,14 @@ import { trapFocus } from '../aria-helpers/trap-focus.aria'
21
21
  */
22
22
 
23
23
  function MatchNotificationIcon(props: NotificationVariantProps) {
24
+ const { icons } = useCerberusContext()
24
25
  const palette = (props.palette || 'info') as
25
26
  | 'info'
26
27
  | 'success'
27
28
  | 'warning'
28
29
  | 'danger'
29
- const key = `${palette}Notification` as keyof typeof $cerberusIcons
30
- const Icon = $cerberusIcons[key]
30
+ const key = `${palette}Notification` as keyof typeof icons
31
+ const Icon = icons[key]
31
32
  return <Icon />
32
33
  }
33
34
 
@@ -64,7 +65,9 @@ export function Notification(props: PropsWithChildren<NotificationProps>) {
64
65
  const ref = useRef<HTMLDialogElement>(null)
65
66
  const onKeyDown = trapFocus(ref)
66
67
  const styles = notification({ palette })
67
- const { close: CloseIcon } = $cerberusIcons
68
+
69
+ const { icons } = useCerberusContext()
70
+ const { close: CloseIcon } = icons
68
71
 
69
72
  return (
70
73
  <dialog
@@ -7,8 +7,8 @@ import {
7
7
  type SelectVariantProps,
8
8
  } from '@cerberus/styled-system/recipes'
9
9
  import type { OptionHTMLAttributes, SelectHTMLAttributes } from 'react'
10
- import { $cerberusIcons } from '../config/defineIcons'
11
10
  import { useFieldContext } from '../context/field'
11
+ import { useCerberusContext } from '../context/cerberus'
12
12
  import { Show } from './Show'
13
13
 
14
14
  /**
@@ -50,7 +50,10 @@ export type SelectProps = Omit<
50
50
  export function Select(props: SelectProps) {
51
51
  const { describedBy, size, ...nativeProps } = props
52
52
  const { invalid, ...fieldStates } = useFieldContext()
53
- const { invalid: InvalidIcon, selectArrow: SelectArrow } = $cerberusIcons
53
+
54
+ const { icons } = useCerberusContext()
55
+ const { invalid: InvalidIcon, selectArrow: SelectArrow } = icons
56
+
54
57
  const styles = select({
55
58
  size,
56
59
  })
@@ -1,3 +1,5 @@
1
+ 'use client'
2
+
1
3
  import type {
2
4
  HTMLAttributes,
3
5
  MouseEventHandler,
@@ -10,7 +12,7 @@ import {
10
12
  tag,
11
13
  type TagVariantProps,
12
14
  } from '@cerberus/styled-system/recipes'
13
- import { $cerberusIcons } from '../config/defineIcons'
15
+ import { useCerberusContext } from '../context/cerberus'
14
16
 
15
17
  /**
16
18
  * This module contains the tag component.
@@ -71,7 +73,8 @@ export function Tag(props: PropsWithChildren<TagProps>): JSX.Element {
71
73
  const isClosable = Boolean(onClick)
72
74
  const shape = isClosable ? 'pill' : initShape
73
75
  const closableStyles = isClosable ? closableCss : ''
74
- const { close: Close } = $cerberusIcons
76
+ const { icons } = useCerberusContext()
77
+ const { close: Close } = icons
75
78
 
76
79
  return (
77
80
  <span
@@ -7,8 +7,8 @@ import {
7
7
  type ToggleVariantProps,
8
8
  } from '@cerberus/styled-system/recipes'
9
9
  import type { InputHTMLAttributes } from 'react'
10
- import { $cerberusIcons } from '../config/defineIcons'
11
10
  import { useFieldContext } from '../context/field'
11
+ import { useCerberusContext } from '../context/cerberus'
12
12
 
13
13
  /**
14
14
  * This module provides a toggle component.
@@ -59,7 +59,8 @@ export function Toggle(props: ToggleProps) {
59
59
  const { size, describedBy, ...nativeProps } = props
60
60
  const styles = toggle({ size })
61
61
  const { invalid, ...state } = useFieldContext()
62
- const Icon = $cerberusIcons.toggleChecked
62
+ const { icons } = useCerberusContext()
63
+ const CheckedIcon = icons.toggleChecked
63
64
 
64
65
  return (
65
66
  <span
@@ -83,7 +84,7 @@ export function Toggle(props: ToggleProps) {
83
84
  }),
84
85
  )}
85
86
  >
86
- <Icon />
87
+ <CheckedIcon />
87
88
  </span>
88
89
  </span>
89
90
  )
@@ -1,22 +1,34 @@
1
- import { defaultIcons, type DefinedIcons } from './cerbIcons'
1
+ import { CheckmarkIcon, IndeterminateIcon } from './icons/checkbox.icons'
2
+ import { AnimatingUploadIcon } from '../components/AnimatingUploadIcon'
3
+ import type { DefinedIcons, IconType } from './types'
2
4
 
3
- function _validateIconsProperties(icons: DefinedIcons) {
4
- if (!icons.invalid) {
5
- throw new Error(
6
- 'The an invalid property must be defined in your custom icons library.',
7
- )
8
- }
5
+ const defaultIcons: Pick<
6
+ DefinedIcons,
7
+ 'checkbox' | 'fileUploader' | 'indeterminate'
8
+ > = {
9
+ checkbox: CheckmarkIcon,
10
+ fileUploader: AnimatingUploadIcon,
11
+ indeterminate: IndeterminateIcon,
9
12
  }
10
13
 
11
- export function defineIcons(icons: DefinedIcons): Required<DefinedIcons> {
12
- _validateIconsProperties(icons)
13
- $cerberusIcons = {
14
+ /**
15
+ * Defines the icons that will be used in Cerberus React components via the
16
+ * CerberusProvider.
17
+ * @param icons The icons that will be used in Cerberus React components.
18
+ * @returns Icons object compatible with the CerberusProvider SystemConfig.
19
+ * @example
20
+ * ```tsx
21
+ * const icons = defineIcons({
22
+ * accordionIndicator: MyAccordionIndicatorIcon,
23
+ * ...
24
+ * })
25
+ * ```
26
+ */
27
+ export function defineIcons<T extends IconType>(
28
+ icons: DefinedIcons,
29
+ ): Required<DefinedIcons<T>> {
30
+ return {
14
31
  ...defaultIcons,
15
32
  ...icons,
16
- } as Required<DefinedIcons>
17
- return $cerberusIcons
33
+ } as Required<DefinedIcons<T>>
18
34
  }
19
-
20
- // Default icons
21
-
22
- export let $cerberusIcons = defaultIcons as Required<DefinedIcons>