@cerberus-design/react 0.15.0-next-e0ce56e → 0.15.0-next-739c492

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 (204) hide show
  1. package/build/legacy/_tsup-dts-rollup.d.cts +313 -112
  2. package/build/legacy/components/Checkbox.cjs +27 -35
  3. package/build/legacy/components/Checkbox.cjs.map +1 -1
  4. package/build/legacy/components/DatePicker.client.cjs +67 -89
  5. package/build/legacy/components/DatePicker.client.cjs.map +1 -1
  6. package/build/legacy/components/Fieldset.cjs +4 -17
  7. package/build/legacy/components/Fieldset.cjs.map +1 -1
  8. package/build/legacy/components/FieldsetLabel.cjs.map +1 -1
  9. package/build/legacy/components/FileStatus.cjs +126 -79
  10. package/build/legacy/components/FileStatus.cjs.map +1 -1
  11. package/build/legacy/components/Legend.cjs +10 -22
  12. package/build/legacy/components/Legend.cjs.map +1 -1
  13. package/build/legacy/components/Radio.cjs +4 -21
  14. package/build/legacy/components/Radio.cjs.map +1 -1
  15. package/build/legacy/components/Select.cjs +19 -54
  16. package/build/legacy/components/Select.cjs.map +1 -1
  17. package/build/legacy/components/Toggle.cjs +17 -24
  18. package/build/legacy/components/Toggle.cjs.map +1 -1
  19. package/build/legacy/components/button/button.cjs +1 -1
  20. package/build/legacy/components/button/button.cjs.map +1 -1
  21. package/build/legacy/components/button/index.cjs +1 -1
  22. package/build/legacy/components/button/index.cjs.map +1 -1
  23. package/build/legacy/components/button/parts.cjs +1 -1
  24. package/build/legacy/components/button/parts.cjs.map +1 -1
  25. package/build/legacy/components/{FieldMessage.cjs → deprecated/FieldMessage.cjs} +4 -17
  26. package/build/legacy/components/deprecated/FieldMessage.cjs.map +1 -0
  27. package/build/legacy/components/{Textarea.cjs → deprecated/Label.cjs} +24 -36
  28. package/build/legacy/components/deprecated/Label.cjs.map +1 -0
  29. package/build/legacy/components/field/field.cjs +130 -0
  30. package/build/legacy/components/field/field.cjs.map +1 -0
  31. package/build/legacy/components/field/index.cjs +261 -0
  32. package/build/legacy/components/field/index.cjs.map +1 -0
  33. package/build/legacy/components/field/parts.cjs +184 -0
  34. package/build/legacy/components/field/parts.cjs.map +1 -0
  35. package/build/legacy/components/field/primitives.cjs +186 -0
  36. package/build/legacy/components/field/primitives.cjs.map +1 -0
  37. package/build/legacy/components/field/start-indicator.cjs +45 -0
  38. package/build/legacy/components/field/start-indicator.cjs.map +1 -0
  39. package/build/legacy/components/field/status-indicator.cjs +78 -0
  40. package/build/legacy/components/field/status-indicator.cjs.map +1 -0
  41. package/build/legacy/context/confirm-modal.cjs +1 -1
  42. package/build/legacy/context/confirm-modal.cjs.map +1 -1
  43. package/build/legacy/context/cta-modal.cjs +1 -1
  44. package/build/legacy/context/cta-modal.cjs.map +1 -1
  45. package/build/legacy/context/field.cjs +23 -4
  46. package/build/legacy/context/field.cjs.map +1 -1
  47. package/build/legacy/context/notification-center.cjs.map +1 -1
  48. package/build/legacy/context/prompt-modal.cjs +168 -166
  49. package/build/legacy/context/prompt-modal.cjs.map +1 -1
  50. package/build/legacy/hooks/useDate.cjs.map +1 -1
  51. package/build/legacy/index.cjs +1156 -1067
  52. package/build/legacy/index.cjs.map +1 -1
  53. package/build/legacy/utils/index.cjs +22 -2
  54. package/build/legacy/utils/index.cjs.map +1 -1
  55. package/build/modern/_tsup-dts-rollup.d.ts +313 -112
  56. package/build/modern/{chunk-2JX27W6Y.js → chunk-2BIHLH4V.js} +2 -2
  57. package/build/modern/chunk-2BIHLH4V.js.map +1 -0
  58. package/build/modern/{chunk-3ZDFQO25.js → chunk-6EUC3SUI.js} +4 -7
  59. package/build/modern/chunk-6EUC3SUI.js.map +1 -0
  60. package/build/modern/{chunk-MER66QUY.js → chunk-6KZVE4HC.js} +1 -1
  61. package/build/modern/{chunk-MER66QUY.js.map → chunk-6KZVE4HC.js.map} +1 -1
  62. package/build/modern/{chunk-FTPZHG6J.js → chunk-6WOJAMZV.js} +3 -9
  63. package/build/modern/chunk-6WOJAMZV.js.map +1 -0
  64. package/build/modern/chunk-7VA5SXTY.js +31 -0
  65. package/build/modern/chunk-7VA5SXTY.js.map +1 -0
  66. package/build/modern/chunk-7YVOZULL.js +23 -0
  67. package/build/modern/chunk-7YVOZULL.js.map +1 -0
  68. package/build/modern/{chunk-KU2AWAK3.js → chunk-B2A6QFKT.js} +4 -17
  69. package/build/modern/chunk-B2A6QFKT.js.map +1 -0
  70. package/build/modern/chunk-BL7G3577.js +29 -0
  71. package/build/modern/chunk-BL7G3577.js.map +1 -0
  72. package/build/modern/chunk-C5NL3X7W.js +96 -0
  73. package/build/modern/chunk-C5NL3X7W.js.map +1 -0
  74. package/build/modern/chunk-CNA2VKAH.js +43 -0
  75. package/build/modern/chunk-CNA2VKAH.js.map +1 -0
  76. package/build/modern/{chunk-Z7FGXAND.js → chunk-FMRWRVUS.js} +2 -2
  77. package/build/modern/{chunk-NGOLRISW.js → chunk-FVE4GBB7.js} +9 -8
  78. package/build/modern/chunk-FVE4GBB7.js.map +1 -0
  79. package/build/modern/{chunk-7P7OWBGV.js → chunk-G2VFEBY4.js} +8 -8
  80. package/build/modern/chunk-G2VFEBY4.js.map +1 -0
  81. package/build/modern/{chunk-XQICKZH4.js → chunk-GENS32QO.js} +10 -8
  82. package/build/modern/chunk-GENS32QO.js.map +1 -0
  83. package/build/modern/{chunk-Q4IV5NUT.js → chunk-GNPGG4ND.js} +37 -40
  84. package/build/modern/chunk-GNPGG4ND.js.map +1 -0
  85. package/build/modern/{chunk-7S47NSGR.js → chunk-H54FR7IP.js} +2 -2
  86. package/build/modern/chunk-IGSC4IEA.js +37 -0
  87. package/build/modern/chunk-IGSC4IEA.js.map +1 -0
  88. package/build/modern/{chunk-JWIJHSI6.js → chunk-L7N24B6B.js} +3 -6
  89. package/build/modern/chunk-L7N24B6B.js.map +1 -0
  90. package/build/modern/{chunk-3RGRHMJQ.js → chunk-LCN7LYTU.js} +5 -5
  91. package/build/modern/{chunk-3BM6MZ4A.js → chunk-MWRO5QYD.js} +1 -1
  92. package/build/modern/chunk-MWRO5QYD.js.map +1 -0
  93. package/build/modern/{chunk-PZAZKQMO.js → chunk-OYT7RGC7.js} +1 -1
  94. package/build/modern/chunk-OYT7RGC7.js.map +1 -0
  95. package/build/modern/{chunk-ILQW5VZT.js → chunk-RBNOEAWJ.js} +4 -7
  96. package/build/modern/chunk-RBNOEAWJ.js.map +1 -0
  97. package/build/modern/{chunk-5QONP7GT.js → chunk-S2X5OEPK.js} +2 -10
  98. package/build/modern/chunk-S2X5OEPK.js.map +1 -0
  99. package/build/modern/chunk-TYPULJMJ.js +1 -0
  100. package/build/modern/chunk-Z52R6ABJ.js +21 -0
  101. package/build/modern/chunk-Z52R6ABJ.js.map +1 -0
  102. package/build/modern/components/Checkbox.js +1 -2
  103. package/build/modern/components/DatePicker.client.js +3 -4
  104. package/build/modern/components/Fieldset.js +1 -2
  105. package/build/modern/components/FieldsetLabel.js +1 -1
  106. package/build/modern/components/FileStatus.js +9 -3
  107. package/build/modern/components/Legend.js +1 -2
  108. package/build/modern/components/Radio.js +1 -3
  109. package/build/modern/components/Select.js +1 -2
  110. package/build/modern/components/Toggle.js +1 -2
  111. package/build/modern/components/button/button.js +1 -1
  112. package/build/modern/components/button/index.js +2 -2
  113. package/build/modern/components/button/parts.js +2 -2
  114. package/build/modern/components/deprecated/FieldMessage.js +8 -0
  115. package/build/modern/components/deprecated/Label.js +17 -0
  116. package/build/modern/components/field/field.js +14 -0
  117. package/build/modern/components/field/index.js +42 -0
  118. package/build/modern/components/field/index.js.map +1 -0
  119. package/build/modern/components/field/parts.js +11 -0
  120. package/build/modern/components/field/parts.js.map +1 -0
  121. package/build/modern/components/field/primitives.js +24 -0
  122. package/build/modern/components/field/primitives.js.map +1 -0
  123. package/build/modern/components/field/start-indicator.js +7 -0
  124. package/build/modern/components/field/start-indicator.js.map +1 -0
  125. package/build/modern/components/field/status-indicator.js +9 -0
  126. package/build/modern/components/field/status-indicator.js.map +1 -0
  127. package/build/modern/context/confirm-modal.js +2 -2
  128. package/build/modern/context/cta-modal.js +4 -4
  129. package/build/modern/context/field.js +34 -4
  130. package/build/modern/context/field.js.map +1 -1
  131. package/build/modern/context/notification-center.js +2 -2
  132. package/build/modern/context/prompt-modal.js +10 -5
  133. package/build/modern/hooks/useDate.js +1 -1
  134. package/build/modern/index.js +85 -62
  135. package/build/modern/index.js.map +1 -1
  136. package/build/modern/utils/index.js +5 -3
  137. package/package.json +2 -2
  138. package/src/components/Checkbox.tsx +13 -9
  139. package/src/components/DatePicker.client.tsx +2 -14
  140. package/src/components/Fieldset.tsx +3 -3
  141. package/src/components/FieldsetLabel.tsx +5 -2
  142. package/src/components/FileStatus.tsx +4 -5
  143. package/src/components/Legend.tsx +5 -6
  144. package/src/components/Radio.tsx +2 -7
  145. package/src/components/Select.tsx +1 -16
  146. package/src/components/Toggle.tsx +14 -7
  147. package/src/components/button/button.tsx +1 -1
  148. package/src/components/button/parts.ts +6 -0
  149. package/src/components/{FieldMessage.tsx → deprecated/FieldMessage.tsx} +2 -13
  150. package/src/components/deprecated/Label.tsx +24 -0
  151. package/src/components/field/field.tsx +77 -0
  152. package/src/components/field/index.ts +5 -0
  153. package/src/components/field/parts.ts +71 -0
  154. package/src/components/field/primitives.tsx +197 -0
  155. package/src/components/field/start-indicator.tsx +23 -0
  156. package/src/components/field/status-indicator.tsx +58 -0
  157. package/src/context/field.tsx +6 -5
  158. package/src/context/prompt-modal.tsx +16 -18
  159. package/src/hooks/useDate.ts +1 -7
  160. package/src/index.ts +4 -6
  161. package/src/utils/index.ts +30 -0
  162. package/build/legacy/components/FieldMessage.cjs.map +0 -1
  163. package/build/legacy/components/Input.cjs +0 -95
  164. package/build/legacy/components/Input.cjs.map +0 -1
  165. package/build/legacy/components/Label.cjs +0 -93
  166. package/build/legacy/components/Label.cjs.map +0 -1
  167. package/build/legacy/components/Textarea.cjs.map +0 -1
  168. package/build/modern/chunk-2JX27W6Y.js.map +0 -1
  169. package/build/modern/chunk-3BM6MZ4A.js.map +0 -1
  170. package/build/modern/chunk-3ZDFQO25.js.map +0 -1
  171. package/build/modern/chunk-5QONP7GT.js.map +0 -1
  172. package/build/modern/chunk-7P7OWBGV.js.map +0 -1
  173. package/build/modern/chunk-C5EHJUS5.js +0 -10
  174. package/build/modern/chunk-C5EHJUS5.js.map +0 -1
  175. package/build/modern/chunk-FTPZHG6J.js.map +0 -1
  176. package/build/modern/chunk-ILQW5VZT.js.map +0 -1
  177. package/build/modern/chunk-JIJM6JFJ.js +0 -36
  178. package/build/modern/chunk-JIJM6JFJ.js.map +0 -1
  179. package/build/modern/chunk-JWIJHSI6.js.map +0 -1
  180. package/build/modern/chunk-KU2AWAK3.js.map +0 -1
  181. package/build/modern/chunk-NGOLRISW.js.map +0 -1
  182. package/build/modern/chunk-NMF2HYWO.js +0 -50
  183. package/build/modern/chunk-NMF2HYWO.js.map +0 -1
  184. package/build/modern/chunk-PZAZKQMO.js.map +0 -1
  185. package/build/modern/chunk-Q4IV5NUT.js.map +0 -1
  186. package/build/modern/chunk-UZDVOIW5.js +0 -33
  187. package/build/modern/chunk-UZDVOIW5.js.map +0 -1
  188. package/build/modern/chunk-VYCU7I4J.js +0 -43
  189. package/build/modern/chunk-VYCU7I4J.js.map +0 -1
  190. package/build/modern/chunk-XQICKZH4.js.map +0 -1
  191. package/build/modern/components/FieldMessage.js +0 -9
  192. package/build/modern/components/Input.js +0 -11
  193. package/build/modern/components/Label.js +0 -10
  194. package/build/modern/components/Textarea.js +0 -9
  195. package/src/components/Input.tsx +0 -69
  196. package/src/components/Label.tsx +0 -69
  197. package/src/components/Textarea.tsx +0 -52
  198. /package/build/modern/{chunk-Z7FGXAND.js.map → chunk-FMRWRVUS.js.map} +0 -0
  199. /package/build/modern/{chunk-7S47NSGR.js.map → chunk-H54FR7IP.js.map} +0 -0
  200. /package/build/modern/{chunk-3RGRHMJQ.js.map → chunk-LCN7LYTU.js.map} +0 -0
  201. /package/build/modern/{components/FieldMessage.js.map → chunk-TYPULJMJ.js.map} +0 -0
  202. /package/build/modern/components/{Input.js.map → deprecated/FieldMessage.js.map} +0 -0
  203. /package/build/modern/components/{Label.js.map → deprecated/Label.js.map} +0 -0
  204. /package/build/modern/components/{Textarea.js.map → field/field.js.map} +0 -0
@@ -1,69 +0,0 @@
1
- 'use client'
2
-
3
- import type { InputHTMLAttributes, ReactNode } from 'react'
4
- import { input, type InputVariantProps } from '@cerberus/styled-system/recipes'
5
- import { cx } from '@cerberus/styled-system/css'
6
- import { useFieldContext } from '../context/field'
7
- import { useCerberusContext } from '../context/cerberus'
8
- import { Show } from './Show'
9
-
10
- export interface InputBaseProps
11
- extends Omit<InputHTMLAttributes<HTMLInputElement>, 'id' | 'size'> {
12
- /**
13
- * The id of the FieldMessage component used to describe the input. Required for accessibility.
14
- */
15
- describedBy?: string
16
- /**
17
- * The unique identifier for the input element. Required for accessibility.
18
- */
19
- id: string
20
- /**
21
- * An optional icon to display at the start of the input.
22
- */
23
- startIcon?: ReactNode
24
- /**
25
- * An optional icon to display at the end of the input.
26
- */
27
- endIcon?: ReactNode
28
- }
29
- export type InputProps = InputBaseProps & InputVariantProps
30
-
31
- /**
32
- * A component that allows the user to input text. Must be wrapped in a Field
33
- * component to keep track of the state for entire group of elements related to
34
- * the field.
35
- * @see https://cerberus.digitalu.design/react/input
36
- */
37
- export function Input(props: InputProps) {
38
- const { describedBy, size, startIcon, endIcon, ...nativeProps } = props
39
- const inputStyles = input({ size })
40
- const { invalid, ...fieldStates } = useFieldContext()
41
- const hasEndIcon = Boolean(endIcon)
42
-
43
- const { icons } = useCerberusContext()
44
- const { invalid: InvalidIcon } = icons
45
-
46
- return (
47
- <div className={inputStyles.root}>
48
- <Show when={Boolean(startIcon)}>
49
- <span className={inputStyles.startIcon}>{startIcon}</span>
50
- </Show>
51
-
52
- <input
53
- {...nativeProps}
54
- {...fieldStates}
55
- {...(describedBy && { 'aria-describedby': describedBy })}
56
- {...(invalid && { 'aria-invalid': true })}
57
- data-start-icon={Boolean(startIcon)}
58
- className={cx('peer', nativeProps.className, inputStyles.input)}
59
- />
60
-
61
- <Show when={invalid}>
62
- <InvalidIcon className={inputStyles.icon} />
63
- </Show>
64
- <Show when={hasEndIcon && !invalid}>
65
- <span className={inputStyles.icon}>{endIcon}</span>
66
- </Show>
67
- </div>
68
- )
69
- }
@@ -1,69 +0,0 @@
1
- 'use client'
2
-
3
- import type { HTMLAttributes, PropsWithChildren } from 'react'
4
- import { label, type LabelVariantProps } from '@cerberus/styled-system/recipes'
5
- import { css, cx } from '@cerberus/styled-system/css'
6
- import { hstack } from '@cerberus/styled-system/patterns'
7
- import { useFieldContext } from '../context/field'
8
- import { Show } from './Show'
9
-
10
- /**
11
- * This module contains the Label component.
12
- * @module
13
- */
14
- export interface LabelBaseProps extends HTMLAttributes<HTMLLabelElement> {
15
- /**
16
- * The unique identifier for the input element. Required for accessibility.
17
- */
18
- htmlFor: string
19
- /**
20
- * Used to hide the label from the UI while keeping it accessible to screen readers. Typically used for global search inputs that have no visible label.
21
- */
22
- hidden?: boolean
23
- }
24
- export type LabelProps = LabelBaseProps & LabelVariantProps
25
-
26
- /**
27
- * A a11y compliant label component.
28
- * @definition [ARIA Forms](https://www.a11yproject.com/checklist/#forms)
29
- * @see https://cerberus.digitalu.design/react/label
30
- * @example
31
- * ```tsx
32
- * <Field required>
33
- * <Label htmlFor="search" hidden>Search everything</Label>
34
- * <Input id="search" startIcon={Search} type="text" />
35
- * </Field>
36
- * ```
37
- */
38
- export function Label(props: PropsWithChildren<LabelProps>) {
39
- const { hidden, size, ...nativeProps } = props
40
- const { required, disabled } = useFieldContext()
41
- const usage = hidden ? 'hidden' : 'visible'
42
-
43
- return (
44
- <label
45
- {...nativeProps}
46
- {...(disabled && { 'data-disabled': true })}
47
- className={cx(
48
- nativeProps.className,
49
- label({ size, usage }),
50
- hstack({
51
- justify: 'space-between',
52
- w: 'full',
53
- }),
54
- )}
55
- >
56
- {props.children}
57
- <Show when={required}>
58
- <span
59
- className={css({
60
- color: 'page.text.100',
61
- fontSize: 'inherit',
62
- })}
63
- >
64
- (required)
65
- </span>
66
- </Show>
67
- </label>
68
- )
69
- }
@@ -1,52 +0,0 @@
1
- 'use client'
2
-
3
- import type { TextareaHTMLAttributes } from 'react'
4
- import { css, cx } from '@cerberus/styled-system/css'
5
- import { input, type InputVariantProps } from '@cerberus/styled-system/recipes'
6
- import { useFieldContext } from '../context/field'
7
-
8
- /**
9
- * This module contains the Textarea component.
10
- * @module
11
- */
12
-
13
- export interface TextareaBaseProps
14
- extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'id'> {
15
- /**
16
- * The ID of the FieldMessage that describes the textarea.
17
- */
18
- describedBy?: string
19
- /**
20
- * The unique id of the textarea.
21
- */
22
- id: string
23
- }
24
- export type TextareaProps = InputVariantProps & TextareaBaseProps
25
-
26
- /**
27
- * A component that allows the user to input large blocks of text.
28
- * @see https://cerberus.digitalu.design/react/textarea
29
- */
30
- export function Textarea(props: TextareaProps): JSX.Element {
31
- const { describedBy, ...nativeProps } = props
32
- const { invalid, ...fieldState } = useFieldContext()
33
-
34
- return (
35
- <textarea
36
- {...nativeProps}
37
- {...fieldState}
38
- {...(describedBy && { 'aria-describedby': describedBy })}
39
- {...(invalid && { 'aria-invalid': true })}
40
- className={cx(
41
- props.className,
42
- input().input,
43
- css({
44
- pxi: '2',
45
- py: '2',
46
- resize: 'vertical',
47
- }),
48
- )}
49
- rows={4}
50
- />
51
- )
52
- }