@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.
- package/build/legacy/_tsup-dts-rollup.d.cts +313 -112
- package/build/legacy/components/Checkbox.cjs +27 -35
- package/build/legacy/components/Checkbox.cjs.map +1 -1
- package/build/legacy/components/DatePicker.client.cjs +67 -89
- package/build/legacy/components/DatePicker.client.cjs.map +1 -1
- package/build/legacy/components/Fieldset.cjs +4 -17
- package/build/legacy/components/Fieldset.cjs.map +1 -1
- package/build/legacy/components/FieldsetLabel.cjs.map +1 -1
- package/build/legacy/components/FileStatus.cjs +126 -79
- package/build/legacy/components/FileStatus.cjs.map +1 -1
- package/build/legacy/components/Legend.cjs +10 -22
- package/build/legacy/components/Legend.cjs.map +1 -1
- package/build/legacy/components/Radio.cjs +4 -21
- package/build/legacy/components/Radio.cjs.map +1 -1
- package/build/legacy/components/Select.cjs +19 -54
- package/build/legacy/components/Select.cjs.map +1 -1
- package/build/legacy/components/Toggle.cjs +17 -24
- package/build/legacy/components/Toggle.cjs.map +1 -1
- package/build/legacy/components/button/button.cjs +1 -1
- package/build/legacy/components/button/button.cjs.map +1 -1
- package/build/legacy/components/button/index.cjs +1 -1
- package/build/legacy/components/button/index.cjs.map +1 -1
- package/build/legacy/components/button/parts.cjs +1 -1
- package/build/legacy/components/button/parts.cjs.map +1 -1
- package/build/legacy/components/{FieldMessage.cjs → deprecated/FieldMessage.cjs} +4 -17
- package/build/legacy/components/deprecated/FieldMessage.cjs.map +1 -0
- package/build/legacy/components/{Textarea.cjs → deprecated/Label.cjs} +24 -36
- package/build/legacy/components/deprecated/Label.cjs.map +1 -0
- package/build/legacy/components/field/field.cjs +130 -0
- package/build/legacy/components/field/field.cjs.map +1 -0
- package/build/legacy/components/field/index.cjs +261 -0
- package/build/legacy/components/field/index.cjs.map +1 -0
- package/build/legacy/components/field/parts.cjs +184 -0
- package/build/legacy/components/field/parts.cjs.map +1 -0
- package/build/legacy/components/field/primitives.cjs +186 -0
- package/build/legacy/components/field/primitives.cjs.map +1 -0
- package/build/legacy/components/field/start-indicator.cjs +45 -0
- package/build/legacy/components/field/start-indicator.cjs.map +1 -0
- package/build/legacy/components/field/status-indicator.cjs +78 -0
- package/build/legacy/components/field/status-indicator.cjs.map +1 -0
- package/build/legacy/context/confirm-modal.cjs +1 -1
- package/build/legacy/context/confirm-modal.cjs.map +1 -1
- package/build/legacy/context/cta-modal.cjs +1 -1
- package/build/legacy/context/cta-modal.cjs.map +1 -1
- package/build/legacy/context/field.cjs +23 -4
- package/build/legacy/context/field.cjs.map +1 -1
- package/build/legacy/context/notification-center.cjs.map +1 -1
- package/build/legacy/context/prompt-modal.cjs +168 -166
- package/build/legacy/context/prompt-modal.cjs.map +1 -1
- package/build/legacy/hooks/useDate.cjs.map +1 -1
- package/build/legacy/index.cjs +1156 -1067
- package/build/legacy/index.cjs.map +1 -1
- package/build/legacy/utils/index.cjs +22 -2
- package/build/legacy/utils/index.cjs.map +1 -1
- package/build/modern/_tsup-dts-rollup.d.ts +313 -112
- package/build/modern/{chunk-2JX27W6Y.js → chunk-2BIHLH4V.js} +2 -2
- package/build/modern/chunk-2BIHLH4V.js.map +1 -0
- package/build/modern/{chunk-3ZDFQO25.js → chunk-6EUC3SUI.js} +4 -7
- package/build/modern/chunk-6EUC3SUI.js.map +1 -0
- package/build/modern/{chunk-MER66QUY.js → chunk-6KZVE4HC.js} +1 -1
- package/build/modern/{chunk-MER66QUY.js.map → chunk-6KZVE4HC.js.map} +1 -1
- package/build/modern/{chunk-FTPZHG6J.js → chunk-6WOJAMZV.js} +3 -9
- package/build/modern/chunk-6WOJAMZV.js.map +1 -0
- package/build/modern/chunk-7VA5SXTY.js +31 -0
- package/build/modern/chunk-7VA5SXTY.js.map +1 -0
- package/build/modern/chunk-7YVOZULL.js +23 -0
- package/build/modern/chunk-7YVOZULL.js.map +1 -0
- package/build/modern/{chunk-KU2AWAK3.js → chunk-B2A6QFKT.js} +4 -17
- package/build/modern/chunk-B2A6QFKT.js.map +1 -0
- package/build/modern/chunk-BL7G3577.js +29 -0
- package/build/modern/chunk-BL7G3577.js.map +1 -0
- package/build/modern/chunk-C5NL3X7W.js +96 -0
- package/build/modern/chunk-C5NL3X7W.js.map +1 -0
- package/build/modern/chunk-CNA2VKAH.js +43 -0
- package/build/modern/chunk-CNA2VKAH.js.map +1 -0
- package/build/modern/{chunk-Z7FGXAND.js → chunk-FMRWRVUS.js} +2 -2
- package/build/modern/{chunk-NGOLRISW.js → chunk-FVE4GBB7.js} +9 -8
- package/build/modern/chunk-FVE4GBB7.js.map +1 -0
- package/build/modern/{chunk-7P7OWBGV.js → chunk-G2VFEBY4.js} +8 -8
- package/build/modern/chunk-G2VFEBY4.js.map +1 -0
- package/build/modern/{chunk-XQICKZH4.js → chunk-GENS32QO.js} +10 -8
- package/build/modern/chunk-GENS32QO.js.map +1 -0
- package/build/modern/{chunk-Q4IV5NUT.js → chunk-GNPGG4ND.js} +37 -40
- package/build/modern/chunk-GNPGG4ND.js.map +1 -0
- package/build/modern/{chunk-7S47NSGR.js → chunk-H54FR7IP.js} +2 -2
- package/build/modern/chunk-IGSC4IEA.js +37 -0
- package/build/modern/chunk-IGSC4IEA.js.map +1 -0
- package/build/modern/{chunk-JWIJHSI6.js → chunk-L7N24B6B.js} +3 -6
- package/build/modern/chunk-L7N24B6B.js.map +1 -0
- package/build/modern/{chunk-3RGRHMJQ.js → chunk-LCN7LYTU.js} +5 -5
- package/build/modern/{chunk-3BM6MZ4A.js → chunk-MWRO5QYD.js} +1 -1
- package/build/modern/chunk-MWRO5QYD.js.map +1 -0
- package/build/modern/{chunk-PZAZKQMO.js → chunk-OYT7RGC7.js} +1 -1
- package/build/modern/chunk-OYT7RGC7.js.map +1 -0
- package/build/modern/{chunk-ILQW5VZT.js → chunk-RBNOEAWJ.js} +4 -7
- package/build/modern/chunk-RBNOEAWJ.js.map +1 -0
- package/build/modern/{chunk-5QONP7GT.js → chunk-S2X5OEPK.js} +2 -10
- package/build/modern/chunk-S2X5OEPK.js.map +1 -0
- package/build/modern/chunk-TYPULJMJ.js +1 -0
- package/build/modern/chunk-Z52R6ABJ.js +21 -0
- package/build/modern/chunk-Z52R6ABJ.js.map +1 -0
- package/build/modern/components/Checkbox.js +1 -2
- package/build/modern/components/DatePicker.client.js +3 -4
- package/build/modern/components/Fieldset.js +1 -2
- package/build/modern/components/FieldsetLabel.js +1 -1
- package/build/modern/components/FileStatus.js +9 -3
- package/build/modern/components/Legend.js +1 -2
- package/build/modern/components/Radio.js +1 -3
- package/build/modern/components/Select.js +1 -2
- package/build/modern/components/Toggle.js +1 -2
- package/build/modern/components/button/button.js +1 -1
- package/build/modern/components/button/index.js +2 -2
- package/build/modern/components/button/parts.js +2 -2
- package/build/modern/components/deprecated/FieldMessage.js +8 -0
- package/build/modern/components/deprecated/Label.js +17 -0
- package/build/modern/components/field/field.js +14 -0
- package/build/modern/components/field/index.js +42 -0
- package/build/modern/components/field/index.js.map +1 -0
- package/build/modern/components/field/parts.js +11 -0
- package/build/modern/components/field/parts.js.map +1 -0
- package/build/modern/components/field/primitives.js +24 -0
- package/build/modern/components/field/primitives.js.map +1 -0
- package/build/modern/components/field/start-indicator.js +7 -0
- package/build/modern/components/field/start-indicator.js.map +1 -0
- package/build/modern/components/field/status-indicator.js +9 -0
- package/build/modern/components/field/status-indicator.js.map +1 -0
- package/build/modern/context/confirm-modal.js +2 -2
- package/build/modern/context/cta-modal.js +4 -4
- package/build/modern/context/field.js +34 -4
- package/build/modern/context/field.js.map +1 -1
- package/build/modern/context/notification-center.js +2 -2
- package/build/modern/context/prompt-modal.js +10 -5
- package/build/modern/hooks/useDate.js +1 -1
- package/build/modern/index.js +85 -62
- package/build/modern/index.js.map +1 -1
- package/build/modern/utils/index.js +5 -3
- package/package.json +2 -2
- package/src/components/Checkbox.tsx +13 -9
- package/src/components/DatePicker.client.tsx +2 -14
- package/src/components/Fieldset.tsx +3 -3
- package/src/components/FieldsetLabel.tsx +5 -2
- package/src/components/FileStatus.tsx +4 -5
- package/src/components/Legend.tsx +5 -6
- package/src/components/Radio.tsx +2 -7
- package/src/components/Select.tsx +1 -16
- package/src/components/Toggle.tsx +14 -7
- package/src/components/button/button.tsx +1 -1
- package/src/components/button/parts.ts +6 -0
- package/src/components/{FieldMessage.tsx → deprecated/FieldMessage.tsx} +2 -13
- package/src/components/deprecated/Label.tsx +24 -0
- package/src/components/field/field.tsx +77 -0
- package/src/components/field/index.ts +5 -0
- package/src/components/field/parts.ts +71 -0
- package/src/components/field/primitives.tsx +197 -0
- package/src/components/field/start-indicator.tsx +23 -0
- package/src/components/field/status-indicator.tsx +58 -0
- package/src/context/field.tsx +6 -5
- package/src/context/prompt-modal.tsx +16 -18
- package/src/hooks/useDate.ts +1 -7
- package/src/index.ts +4 -6
- package/src/utils/index.ts +30 -0
- package/build/legacy/components/FieldMessage.cjs.map +0 -1
- package/build/legacy/components/Input.cjs +0 -95
- package/build/legacy/components/Input.cjs.map +0 -1
- package/build/legacy/components/Label.cjs +0 -93
- package/build/legacy/components/Label.cjs.map +0 -1
- package/build/legacy/components/Textarea.cjs.map +0 -1
- package/build/modern/chunk-2JX27W6Y.js.map +0 -1
- package/build/modern/chunk-3BM6MZ4A.js.map +0 -1
- package/build/modern/chunk-3ZDFQO25.js.map +0 -1
- package/build/modern/chunk-5QONP7GT.js.map +0 -1
- package/build/modern/chunk-7P7OWBGV.js.map +0 -1
- package/build/modern/chunk-C5EHJUS5.js +0 -10
- package/build/modern/chunk-C5EHJUS5.js.map +0 -1
- package/build/modern/chunk-FTPZHG6J.js.map +0 -1
- package/build/modern/chunk-ILQW5VZT.js.map +0 -1
- package/build/modern/chunk-JIJM6JFJ.js +0 -36
- package/build/modern/chunk-JIJM6JFJ.js.map +0 -1
- package/build/modern/chunk-JWIJHSI6.js.map +0 -1
- package/build/modern/chunk-KU2AWAK3.js.map +0 -1
- package/build/modern/chunk-NGOLRISW.js.map +0 -1
- package/build/modern/chunk-NMF2HYWO.js +0 -50
- package/build/modern/chunk-NMF2HYWO.js.map +0 -1
- package/build/modern/chunk-PZAZKQMO.js.map +0 -1
- package/build/modern/chunk-Q4IV5NUT.js.map +0 -1
- package/build/modern/chunk-UZDVOIW5.js +0 -33
- package/build/modern/chunk-UZDVOIW5.js.map +0 -1
- package/build/modern/chunk-VYCU7I4J.js +0 -43
- package/build/modern/chunk-VYCU7I4J.js.map +0 -1
- package/build/modern/chunk-XQICKZH4.js.map +0 -1
- package/build/modern/components/FieldMessage.js +0 -9
- package/build/modern/components/Input.js +0 -11
- package/build/modern/components/Label.js +0 -10
- package/build/modern/components/Textarea.js +0 -9
- package/src/components/Input.tsx +0 -69
- package/src/components/Label.tsx +0 -69
- package/src/components/Textarea.tsx +0 -52
- /package/build/modern/{chunk-Z7FGXAND.js.map → chunk-FMRWRVUS.js.map} +0 -0
- /package/build/modern/{chunk-7S47NSGR.js.map → chunk-H54FR7IP.js.map} +0 -0
- /package/build/modern/{chunk-3RGRHMJQ.js.map → chunk-LCN7LYTU.js.map} +0 -0
- /package/build/modern/{components/FieldMessage.js.map → chunk-TYPULJMJ.js.map} +0 -0
- /package/build/modern/components/{Input.js.map → deprecated/FieldMessage.js.map} +0 -0
- /package/build/modern/components/{Label.js.map → deprecated/Label.js.map} +0 -0
- /package/build/modern/components/{Textarea.js.map → field/field.js.map} +0 -0
package/src/components/Input.tsx
DELETED
|
@@ -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
|
-
}
|
package/src/components/Label.tsx
DELETED
|
@@ -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
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|