@cerberus-design/react 0.15.0-next-e0ce56e → 0.15.0-next-5d7dc1e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/legacy/_tsup-dts-rollup.d.cts +491 -119
- 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/checkbox/checkbox-icon.cjs +121 -0
- package/build/legacy/components/checkbox/checkbox-icon.cjs.map +1 -0
- package/build/legacy/components/checkbox/checkbox.cjs +165 -0
- package/build/legacy/components/checkbox/checkbox.cjs.map +1 -0
- package/build/legacy/components/checkbox/index.cjs +179 -0
- package/build/legacy/components/checkbox/index.cjs.map +1 -0
- package/build/legacy/components/checkbox/parts.cjs +89 -0
- package/build/legacy/components/checkbox/parts.cjs.map +1 -0
- package/build/legacy/components/checkbox/primitives.cjs +87 -0
- package/build/legacy/components/checkbox/primitives.cjs.map +1 -0
- 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 +267 -0
- package/build/legacy/components/field/index.cjs.map +1 -0
- package/build/legacy/components/field/parts.cjs +188 -0
- package/build/legacy/components/field/parts.cjs.map +1 -0
- package/build/legacy/components/field/primitives.cjs +191 -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/components/for.cjs +38 -0
- package/build/legacy/components/for.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 +1274 -1123
- 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 +491 -119
- 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-6I2FW4WI.js +33 -0
- package/build/modern/chunk-6I2FW4WI.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-77FJSNGD.js +13 -0
- package/build/modern/chunk-77FJSNGD.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-BPRF34DU.js +62 -0
- package/build/modern/chunk-BPRF34DU.js.map +1 -0
- package/build/modern/{chunk-7P7OWBGV.js → chunk-CF3EHG42.js} +10 -10
- package/build/modern/chunk-CF3EHG42.js.map +1 -0
- package/build/modern/{chunk-Q4IV5NUT.js → chunk-CMYD5KWA.js} +40 -43
- package/build/modern/chunk-CMYD5KWA.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-EL4MX2PG.js +22 -0
- package/build/modern/chunk-EL4MX2PG.js.map +1 -0
- package/build/modern/chunk-FBS7AX76.js +37 -0
- package/build/modern/chunk-FBS7AX76.js.map +1 -0
- package/build/modern/{chunk-KU2AWAK3.js → chunk-FK52US7K.js} +7 -20
- package/build/modern/chunk-FK52US7K.js.map +1 -0
- package/build/modern/{chunk-Z7FGXAND.js → chunk-FMRWRVUS.js} +2 -2
- package/build/modern/{chunk-XQICKZH4.js → chunk-GENS32QO.js} +10 -8
- package/build/modern/chunk-GENS32QO.js.map +1 -0
- package/build/modern/{chunk-7S47NSGR.js → chunk-H54FR7IP.js} +2 -2
- package/build/modern/chunk-KWZ3CEG6.js +23 -0
- package/build/modern/chunk-KWZ3CEG6.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-LT62577B.js +23 -0
- package/build/modern/chunk-LT62577B.js.map +1 -0
- 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-TIJAFPHQ.js +1 -0
- package/build/modern/chunk-TYPULJMJ.js +1 -0
- package/build/modern/chunk-UNN4LHRS.js +31 -0
- package/build/modern/chunk-UNN4LHRS.js.map +1 -0
- package/build/modern/chunk-VSTOSLFS.js +100 -0
- package/build/modern/chunk-VSTOSLFS.js.map +1 -0
- package/build/modern/chunk-Z52R6ABJ.js +21 -0
- package/build/modern/chunk-Z52R6ABJ.js.map +1 -0
- package/build/modern/{chunk-3RGRHMJQ.js → chunk-ZDANBCM3.js} +2 -2
- package/build/modern/components/AccordionItemGroup.js +1 -1
- package/build/modern/components/DatePicker.client.js +4 -5
- package/build/modern/components/Fieldset.js +1 -2
- package/build/modern/components/FieldsetLabel.js +1 -1
- package/build/modern/components/FileStatus.js +10 -4
- 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/checkbox/checkbox-icon.js +12 -0
- package/build/modern/components/checkbox/checkbox.js +13 -0
- package/build/modern/components/checkbox/index.js +30 -0
- package/build/modern/components/checkbox/parts.js +8 -0
- package/build/modern/components/checkbox/parts.js.map +1 -0
- package/build/modern/components/checkbox/primitives.js +17 -0
- package/build/modern/components/checkbox/primitives.js.map +1 -0
- package/build/modern/components/deprecated/FieldMessage.js +8 -0
- package/build/modern/components/deprecated/FieldMessage.js.map +1 -0
- package/build/modern/components/deprecated/Label.js +17 -0
- package/build/modern/components/deprecated/Label.js.map +1 -0
- package/build/modern/components/field/field.js +14 -0
- package/build/modern/components/field/field.js.map +1 -0
- package/build/modern/components/field/index.js +44 -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 +26 -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/components/for.js +7 -0
- package/build/modern/components/for.js.map +1 -0
- package/build/modern/context/confirm-modal.js +3 -3
- 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 +12 -7
- package/build/modern/hooks/useDate.js +1 -1
- package/build/modern/index.js +131 -82
- package/build/modern/index.js.map +1 -1
- package/build/modern/utils/index.js +5 -3
- package/package.json +2 -2
- 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/checkbox/checkbox-icon.tsx +39 -0
- package/src/components/checkbox/checkbox.tsx +48 -0
- package/src/components/checkbox/index.ts +3 -0
- package/src/components/checkbox/parts.ts +59 -0
- package/src/components/checkbox/primitives.tsx +104 -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 +77 -0
- package/src/components/field/primitives.tsx +204 -0
- package/src/components/field/start-indicator.tsx +23 -0
- package/src/components/field/status-indicator.tsx +58 -0
- package/src/components/for.tsx +43 -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 +6 -7
- package/src/utils/index.ts +30 -0
- package/build/legacy/components/Checkbox.cjs +0 -113
- package/build/legacy/components/Checkbox.cjs.map +0 -1
- 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 +0 -63
- 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/Checkbox.js +0 -11
- 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/Checkbox.tsx +0 -93
- 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/{components/Checkbox.js.map → chunk-TIJAFPHQ.js.map} +0 -0
- /package/build/modern/{components/FieldMessage.js.map → chunk-TYPULJMJ.js.map} +0 -0
- /package/build/modern/{chunk-3RGRHMJQ.js.map → chunk-ZDANBCM3.js.map} +0 -0
- /package/build/modern/components/{Input.js.map → checkbox/checkbox-icon.js.map} +0 -0
- /package/build/modern/components/{Label.js.map → checkbox/checkbox.js.map} +0 -0
- /package/build/modern/components/{Textarea.js.map → checkbox/index.js.map} +0 -0
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Field,
|
|
3
|
+
type FieldHelperTextProps,
|
|
4
|
+
type FieldInputProps as ArkFieldInputProps,
|
|
5
|
+
type FieldLabelProps,
|
|
6
|
+
type FieldRootProps as ArkFieldRootProps,
|
|
7
|
+
type FieldTextareaProps,
|
|
8
|
+
} from '@ark-ui/react/field'
|
|
9
|
+
import type { ReactNode } from 'react'
|
|
10
|
+
import { cx } from '@cerberus/styled-system/css'
|
|
11
|
+
import { field, type FieldVariantProps } from '@cerberus/styled-system/recipes'
|
|
12
|
+
import { FieldStatusIndicator } from './status-indicator'
|
|
13
|
+
import { FieldStartIndicator } from './start-indicator'
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* This module contains all the primitives of the Field component.
|
|
17
|
+
* @module 'field'
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
export type FieldRootProps = ArkFieldRootProps & FieldVariantProps
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The context & container for the Field components.
|
|
24
|
+
* @description [Field Docs](https://cerberus.digitalu.design/react/field)
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* <FieldRoot required ids={{ input: 'exampleId' }}>
|
|
28
|
+
* <FieldLabel>Label</FieldLabel>
|
|
29
|
+
* <FieldInput />
|
|
30
|
+
* </FieldRoot>
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export function FieldRoot(props: FieldRootProps) {
|
|
34
|
+
const { size, ...fieldProps } = props
|
|
35
|
+
const styles = field({ size })
|
|
36
|
+
return (
|
|
37
|
+
<Field.Root
|
|
38
|
+
{...fieldProps}
|
|
39
|
+
className={cx(styles.root, fieldProps.className)}
|
|
40
|
+
/>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The label for the Field component.
|
|
46
|
+
* @description [Field Docs](https://cerberus.digitalu.design/react/field)
|
|
47
|
+
* @example
|
|
48
|
+
* ```tsx
|
|
49
|
+
* <FieldRoot>
|
|
50
|
+
* <FieldLabel>Label</FieldLabel>
|
|
51
|
+
* </FieldRoot>
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export function FieldLabel(props: FieldLabelProps) {
|
|
55
|
+
const { children, ...nativeProps } = props
|
|
56
|
+
const styles = field()
|
|
57
|
+
return (
|
|
58
|
+
<Field.Label {...nativeProps} className={cx(styles.label, props.className)}>
|
|
59
|
+
{children}
|
|
60
|
+
<Field.RequiredIndicator>(required)</Field.RequiredIndicator>
|
|
61
|
+
</Field.Label>
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* The required indicator for the Field component.
|
|
67
|
+
*/
|
|
68
|
+
export function FieldRequiredIndicator() {
|
|
69
|
+
return <Field.RequiredIndicator>(required)</Field.RequiredIndicator>
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface FieldInputProps
|
|
73
|
+
extends Omit<ArkFieldInputProps, 'size'>,
|
|
74
|
+
FieldVariantProps {
|
|
75
|
+
/**
|
|
76
|
+
* An optional icon to display at the start of the input.
|
|
77
|
+
*/
|
|
78
|
+
startIcon?: ReactNode
|
|
79
|
+
/**
|
|
80
|
+
* An optional icon to display at the end of the input.
|
|
81
|
+
*/
|
|
82
|
+
endIcon?: ReactNode
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* The input for the Field component.
|
|
87
|
+
* @description [Field Docs](https://cerberus.digitalu.design/react/field)
|
|
88
|
+
* @example
|
|
89
|
+
* ```tsx
|
|
90
|
+
* <FieldRoot>
|
|
91
|
+
* <FieldInput />
|
|
92
|
+
* </FieldRoot>
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
export function FieldInput(props: FieldInputProps) {
|
|
96
|
+
const { size, startIcon, endIcon, ...fieldProps } = props
|
|
97
|
+
const styles = field({ size })
|
|
98
|
+
const hasStartIcon = Boolean(startIcon)
|
|
99
|
+
|
|
100
|
+
return (
|
|
101
|
+
<div className={styles.inputRoot}>
|
|
102
|
+
<FieldStartIndicator>{startIcon}</FieldStartIndicator>
|
|
103
|
+
<Field.Input
|
|
104
|
+
{...fieldProps}
|
|
105
|
+
{...(hasStartIcon && { 'data-has': 'start-indicator' })}
|
|
106
|
+
className={cx(styles.input, fieldProps.className)}
|
|
107
|
+
/>
|
|
108
|
+
<FieldStatusIndicator fallback={endIcon} />
|
|
109
|
+
</div>
|
|
110
|
+
)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* The helper text for the Field component that is shown when the field is
|
|
115
|
+
* valid.
|
|
116
|
+
* @description [Field Docs](https://cerberus.digitalu.design/react/field)
|
|
117
|
+
* @example
|
|
118
|
+
* ```tsx
|
|
119
|
+
* <FieldRoot>
|
|
120
|
+
* <FieldInput />
|
|
121
|
+
* <FieldHelperText>Helper text</FieldHelperText>
|
|
122
|
+
* </FieldRoot>
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
export function FieldHelperText(props: FieldHelperTextProps) {
|
|
126
|
+
const styles = field()
|
|
127
|
+
|
|
128
|
+
if (!props.children) return null
|
|
129
|
+
|
|
130
|
+
return (
|
|
131
|
+
<Field.HelperText
|
|
132
|
+
{...props}
|
|
133
|
+
className={cx(styles.helperText, props.className)}
|
|
134
|
+
/>
|
|
135
|
+
)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* The error text for the Field component that is shown when the field is
|
|
140
|
+
* invalid.
|
|
141
|
+
* @description [Field Docs](https://cerberus.digitalu.design/react/field)
|
|
142
|
+
* @example
|
|
143
|
+
* ```tsx
|
|
144
|
+
* <FieldRoot>
|
|
145
|
+
* <FieldInput />
|
|
146
|
+
* <FieldErrorText>Error text</FieldErrorText>
|
|
147
|
+
* </FieldRoot>
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
150
|
+
export function FieldErrorText(props: FieldHelperTextProps) {
|
|
151
|
+
const styles = field()
|
|
152
|
+
|
|
153
|
+
if (!props.children) return null
|
|
154
|
+
|
|
155
|
+
return (
|
|
156
|
+
<Field.ErrorText
|
|
157
|
+
{...props}
|
|
158
|
+
className={cx(styles.errorText, props.className)}
|
|
159
|
+
/>
|
|
160
|
+
)
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* The textarea for the Field component.
|
|
165
|
+
* @description [Field Docs](https://cerberus.digitalu.design/react/field)
|
|
166
|
+
* @example
|
|
167
|
+
* ```tsx
|
|
168
|
+
* <FieldRoot>
|
|
169
|
+
* <FieldTextarea />
|
|
170
|
+
* </FieldRoot>
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
173
|
+
export function FieldTextarea(props: FieldTextareaProps) {
|
|
174
|
+
const styles = field()
|
|
175
|
+
return (
|
|
176
|
+
<Field.Textarea
|
|
177
|
+
{...props}
|
|
178
|
+
className={cx(styles.textarea, props.className)}
|
|
179
|
+
/>
|
|
180
|
+
)
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* A named export for the FieldInput component.
|
|
185
|
+
* @description [Field Docs](https://cerberus.digitalu.design/react/field)
|
|
186
|
+
* @example
|
|
187
|
+
* ```tsx
|
|
188
|
+
* import { Input } from '@cerberus/react'
|
|
189
|
+
*
|
|
190
|
+
* <Field
|
|
191
|
+
* ids={{
|
|
192
|
+
* control: 'email',
|
|
193
|
+
* }}
|
|
194
|
+
* label="Enter your email"
|
|
195
|
+
* helperText="We'll never share your email with anyone else."
|
|
196
|
+
* errorText="Email is required."
|
|
197
|
+
* required
|
|
198
|
+
* >
|
|
199
|
+
* <Input type="email" />
|
|
200
|
+
* </Field>
|
|
201
|
+
* ```
|
|
202
|
+
*/
|
|
203
|
+
export const Input = FieldInput
|
|
204
|
+
export const Textarea = FieldTextarea
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { cx } from '@cerberus/styled-system/css'
|
|
2
|
+
import { field } from '@cerberus/styled-system/recipes'
|
|
3
|
+
import type { HTMLAttributes } from 'react'
|
|
4
|
+
|
|
5
|
+
export type FieldIndicatorProps = HTMLAttributes<HTMLSpanElement>
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The start indicator displays an indicator at the start of the Input.
|
|
9
|
+
* @description [Field Docs](https://cerberus.digitalu.design/react/field)
|
|
10
|
+
*/
|
|
11
|
+
export function FieldStartIndicator(props: FieldIndicatorProps) {
|
|
12
|
+
const styles = field()
|
|
13
|
+
|
|
14
|
+
if (!props.children) return null
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<span
|
|
18
|
+
{...props}
|
|
19
|
+
data-part="start-indicator"
|
|
20
|
+
className={cx(props.className, styles.startIndicator)}
|
|
21
|
+
/>
|
|
22
|
+
)
|
|
23
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { useFieldContext } from '@ark-ui/react'
|
|
4
|
+
import { cx } from '@cerberus/styled-system/css'
|
|
5
|
+
import { field } from '@cerberus/styled-system/recipes'
|
|
6
|
+
import { useCerberusContext } from '../../context/cerberus'
|
|
7
|
+
import type { HTMLAttributes, ReactNode } from 'react'
|
|
8
|
+
|
|
9
|
+
export interface FieldStatusIndicatorProps
|
|
10
|
+
extends HTMLAttributes<HTMLSpanElement> {
|
|
11
|
+
/**
|
|
12
|
+
* The fallback content to display when the field is valid.
|
|
13
|
+
*/
|
|
14
|
+
fallback?: ReactNode
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The invalid status indicator for the Field component.
|
|
19
|
+
* @description [Field Docs](https://cerberus.digitalu.design/react/field)
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* <FieldRoot>
|
|
23
|
+
* <FieldStatusIndicator />
|
|
24
|
+
* </FieldRoot>
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export function FieldStatusIndicator(props: FieldStatusIndicatorProps) {
|
|
28
|
+
const { fallback, ...nativeProps } = props
|
|
29
|
+
const styles = field()
|
|
30
|
+
const fieldContext = useFieldContext()
|
|
31
|
+
|
|
32
|
+
const { icons } = useCerberusContext()
|
|
33
|
+
const { invalid: InvalidIcon } = icons
|
|
34
|
+
|
|
35
|
+
if (fieldContext.invalid) {
|
|
36
|
+
return (
|
|
37
|
+
<span
|
|
38
|
+
{...nativeProps}
|
|
39
|
+
aria-hidden="true"
|
|
40
|
+
data-invalid
|
|
41
|
+
className={cx(nativeProps.className, styles.statusIndicator)}
|
|
42
|
+
>
|
|
43
|
+
<InvalidIcon />
|
|
44
|
+
</span>
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<span
|
|
50
|
+
{...nativeProps}
|
|
51
|
+
aria-hidden="true"
|
|
52
|
+
data-part="end-indicator"
|
|
53
|
+
className={cx(nativeProps.className, styles.endIndicator)}
|
|
54
|
+
>
|
|
55
|
+
{fallback}
|
|
56
|
+
</span>
|
|
57
|
+
)
|
|
58
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ReactNode } from 'react'
|
|
2
|
+
|
|
3
|
+
export interface ForProps<T> {
|
|
4
|
+
/**
|
|
5
|
+
* The array to iterate over
|
|
6
|
+
*/
|
|
7
|
+
each: T[]
|
|
8
|
+
/**
|
|
9
|
+
* The fallback content to render when the array is empty
|
|
10
|
+
*/
|
|
11
|
+
fallback?: ReactNode
|
|
12
|
+
/**
|
|
13
|
+
* The render function to render each item in the array
|
|
14
|
+
*/
|
|
15
|
+
children: (item: Exclude<T, undefined>, index: number) => ReactNode
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The For component is used to iterate over an array and render a list of
|
|
20
|
+
* components or display a fallback when the array is empty.
|
|
21
|
+
* Inspired by the `<For>` component from SolidJS.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```tsx
|
|
25
|
+
* <For each={['a', 'b', 'c']}>
|
|
26
|
+
* {(item, index) => <div key={index}>{item}</div>}
|
|
27
|
+
* </For>
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export function For<
|
|
31
|
+
T extends string | number | Record<string, unknown> | undefined,
|
|
32
|
+
>(props: ForProps<T>) {
|
|
33
|
+
const mappableChildren = props.children as unknown as (
|
|
34
|
+
item: T,
|
|
35
|
+
index: number,
|
|
36
|
+
) => ReactNode
|
|
37
|
+
|
|
38
|
+
if (props.each?.length === 0) {
|
|
39
|
+
return props.fallback || null
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return props.each?.map(mappableChildren) as ReactNode
|
|
43
|
+
}
|
package/src/context/field.tsx
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
|
+
import type { FieldRootProps } from '@ark-ui/react'
|
|
3
4
|
import {
|
|
4
5
|
createContext,
|
|
5
6
|
useContext,
|
|
6
7
|
useMemo,
|
|
7
8
|
type PropsWithChildren,
|
|
8
9
|
} from 'react'
|
|
10
|
+
import { FieldRoot } from '../components/field/primitives'
|
|
9
11
|
|
|
10
12
|
/**
|
|
11
13
|
* This module provides a context and hook for the field.
|
|
@@ -35,11 +37,10 @@ export interface FieldContextValue {
|
|
|
35
37
|
const FieldContext = createContext<FieldContextValue | null>(null)
|
|
36
38
|
|
|
37
39
|
/**
|
|
38
|
-
*
|
|
39
|
-
* @see https://cerberus.digitalu.design/react/input
|
|
40
|
+
* @deprecated use FieldRoot or FieldParts instead
|
|
40
41
|
*/
|
|
41
|
-
export function
|
|
42
|
-
props: PropsWithChildren<
|
|
42
|
+
export function FieldProvider(
|
|
43
|
+
props: PropsWithChildren<FieldRootProps>,
|
|
43
44
|
): JSX.Element {
|
|
44
45
|
const value = useMemo(
|
|
45
46
|
() => ({
|
|
@@ -53,7 +54,7 @@ export function Field(
|
|
|
53
54
|
|
|
54
55
|
return (
|
|
55
56
|
<FieldContext.Provider value={value}>
|
|
56
|
-
{props
|
|
57
|
+
<FieldRoot {...props} />
|
|
57
58
|
</FieldContext.Provider>
|
|
58
59
|
)
|
|
59
60
|
}
|
|
@@ -11,12 +11,12 @@ import {
|
|
|
11
11
|
type MouseEvent,
|
|
12
12
|
type PropsWithChildren,
|
|
13
13
|
} from 'react'
|
|
14
|
-
import {
|
|
14
|
+
import { DialogCloseTrigger } from '@ark-ui/react'
|
|
15
|
+
import { HStack, VStack } from '@cerberus/styled-system/jsx'
|
|
15
16
|
import { css } from '@cerberus/styled-system/css'
|
|
16
17
|
import { hstack } from '@cerberus/styled-system/patterns'
|
|
17
|
-
import { Input } from '../components/
|
|
18
|
-
import {
|
|
19
|
-
import { Label } from '../components/Label'
|
|
18
|
+
import { FieldLabel, FieldRoot, Input } from '../components/field/index'
|
|
19
|
+
import { Button } from '../components/button/button'
|
|
20
20
|
import { Show } from '../components/Show'
|
|
21
21
|
import { Avatar } from '../components/Avatar'
|
|
22
22
|
import { Text } from '../components/Text'
|
|
@@ -27,8 +27,6 @@ import {
|
|
|
27
27
|
DialogHeading,
|
|
28
28
|
DialogProvider,
|
|
29
29
|
} from '../components/Dialog'
|
|
30
|
-
import { HStack, VStack } from '@cerberus/styled-system/jsx'
|
|
31
|
-
import { DialogCloseTrigger } from '@ark-ui/react'
|
|
32
30
|
|
|
33
31
|
/**
|
|
34
32
|
* This module provides a context and hook for the prompt modal.
|
|
@@ -216,28 +214,28 @@ export function PromptModal(
|
|
|
216
214
|
marginBlockEnd="lg"
|
|
217
215
|
w="full"
|
|
218
216
|
>
|
|
219
|
-
<
|
|
220
|
-
|
|
217
|
+
<FieldRoot
|
|
218
|
+
ids={{
|
|
219
|
+
control: 'confirm',
|
|
220
|
+
}}
|
|
221
|
+
invalid={!isValid}
|
|
222
|
+
>
|
|
223
|
+
<FieldLabel
|
|
221
224
|
className={hstack({
|
|
222
225
|
gap: 'xs',
|
|
223
226
|
justify: 'flex-start !important',
|
|
227
|
+
marginBlockEnd: 'xs',
|
|
228
|
+
textStyle: 'label-md',
|
|
224
229
|
})}
|
|
225
|
-
htmlFor="confirm"
|
|
226
|
-
size="md"
|
|
227
230
|
>
|
|
228
231
|
Type
|
|
229
232
|
<Text as="strong" textTransform="uppercase">
|
|
230
233
|
{content?.key}
|
|
231
234
|
</Text>
|
|
232
235
|
to confirm
|
|
233
|
-
</
|
|
234
|
-
<Input
|
|
235
|
-
|
|
236
|
-
name="confirm"
|
|
237
|
-
onChange={handleChange}
|
|
238
|
-
type="text"
|
|
239
|
-
/>
|
|
240
|
-
</Field>
|
|
236
|
+
</FieldLabel>
|
|
237
|
+
<Input name="confirm" onChange={handleChange} type="text" />
|
|
238
|
+
</FieldRoot>
|
|
241
239
|
</VStack>
|
|
242
240
|
|
|
243
241
|
<HStack gap="md" justify="stretch" w="full">
|
package/src/hooks/useDate.ts
CHANGED
|
@@ -38,13 +38,7 @@ export interface UseDateReturn extends UseDateBase {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
|
-
*
|
|
42
|
-
* @example
|
|
43
|
-
* ```tsx
|
|
44
|
-
* const MyComponent = () => {
|
|
45
|
-
* const date = useDate({ initialValue: '01 JAN 2024' })
|
|
46
|
-
* return <input onChange={date.onChange} type="text" value={date.value} />
|
|
47
|
-
* }
|
|
41
|
+
* @deprecated use the DatePicker family instead
|
|
48
42
|
*/
|
|
49
43
|
export function useDate(options?: UseDateOptions): UseDateReturn {
|
|
50
44
|
const initialValue = options?.initialValue ?? ''
|
package/src/index.ts
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
// deprecated
|
|
7
7
|
|
|
8
|
+
export * from './components/deprecated/FieldMessage'
|
|
9
|
+
export * from './components/deprecated/Label'
|
|
8
10
|
export * from './components/deprecated/Modal'
|
|
9
11
|
export * from './components/deprecated/ModalHeader'
|
|
10
12
|
export * from './components/deprecated/ModalHeading'
|
|
@@ -12,6 +14,7 @@ export * from './components/deprecated/ModalDescription'
|
|
|
12
14
|
export * from './components/deprecated/NavMenuTrigger'
|
|
13
15
|
export * from './components/deprecated/NavMenuList'
|
|
14
16
|
export * from './components/deprecated/NavMenuLink'
|
|
17
|
+
export * from './hooks/useDate'
|
|
15
18
|
|
|
16
19
|
// components
|
|
17
20
|
|
|
@@ -21,22 +24,21 @@ export * from './components/AccordionItemGroup'
|
|
|
21
24
|
export * from './components/Admonition'
|
|
22
25
|
export * from './components/Avatar'
|
|
23
26
|
export * from './components/button/index'
|
|
24
|
-
export * from './components/
|
|
27
|
+
export * from './components/checkbox/index'
|
|
25
28
|
export * from './components/CircularProgress'
|
|
26
29
|
export * from './components/DatePicker.client'
|
|
27
30
|
export * from './components/DatePicker.server'
|
|
28
31
|
export * from './components/Dialog'
|
|
29
32
|
export * from './components/Dialog.client'
|
|
30
33
|
export * from './components/Droppable'
|
|
31
|
-
export * from './components/FieldMessage'
|
|
32
34
|
export * from './components/FeatureFlag'
|
|
35
|
+
export * from './components/field/index'
|
|
33
36
|
export * from './components/Fieldset'
|
|
34
37
|
export * from './components/FieldsetLabel'
|
|
35
38
|
export * from './components/FileStatus'
|
|
36
39
|
export * from './components/FileUploader'
|
|
40
|
+
export * from './components/for'
|
|
37
41
|
export * from './components/IconButton'
|
|
38
|
-
export * from './components/Input'
|
|
39
|
-
export * from './components/Label'
|
|
40
42
|
export * from './components/Legend'
|
|
41
43
|
export * from './components/Menu'
|
|
42
44
|
export * from './components/Notification'
|
|
@@ -54,7 +56,6 @@ export * from './components/Td'
|
|
|
54
56
|
export * from './components/Tbody'
|
|
55
57
|
export * from './components/Tag'
|
|
56
58
|
export * from './components/Text'
|
|
57
|
-
export * from './components/Textarea'
|
|
58
59
|
export * from './components/Toggle'
|
|
59
60
|
export * from './components/Tooltip'
|
|
60
61
|
export * from './components/Select'
|
|
@@ -67,7 +68,6 @@ export * from './context/cerberus'
|
|
|
67
68
|
export * from './context/confirm-modal'
|
|
68
69
|
export * from './context/cta-modal'
|
|
69
70
|
export * from './context/feature-flags'
|
|
70
|
-
export * from './context/field'
|
|
71
71
|
export * from './context/navMenu'
|
|
72
72
|
export * from './context/notification-center'
|
|
73
73
|
export * from './context/prompt-modal'
|
|
@@ -76,7 +76,6 @@ export * from './context/theme'
|
|
|
76
76
|
|
|
77
77
|
// hooks
|
|
78
78
|
|
|
79
|
-
export * from './hooks/useDate'
|
|
80
79
|
export * from './hooks/useModal'
|
|
81
80
|
export * from './hooks/useTheme'
|
|
82
81
|
export * from './hooks/useToggle'
|
package/src/utils/index.ts
CHANGED
|
@@ -18,4 +18,34 @@ export function formatNotifyCount(count: number): string {
|
|
|
18
18
|
return count.toString()
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Splits the properties of an object into multiple groups based on lists of keys.
|
|
23
|
+
* @param props - The object to split.
|
|
24
|
+
* @param keyGroups - The lists of keys to include in each group.
|
|
25
|
+
* @returns An array of objects: each containing the properties specified in the corresponding key group, and the last object containing the remaining keys.
|
|
26
|
+
*/
|
|
27
|
+
export function splitProps<T extends object>(
|
|
28
|
+
props: T,
|
|
29
|
+
...keyGroups: (keyof T)[][]
|
|
30
|
+
): { [K in keyof T]?: T[K] }[] {
|
|
31
|
+
const result = keyGroups.map(() => ({}) as { [K in keyof T]?: T[K] })
|
|
32
|
+
const rest = {} as { [K in keyof T]?: T[K] }
|
|
33
|
+
|
|
34
|
+
for (const key in props) {
|
|
35
|
+
let assigned = false
|
|
36
|
+
for (let i = 0; i < keyGroups.length; i++) {
|
|
37
|
+
if (keyGroups[i].includes(key as keyof T)) {
|
|
38
|
+
result[i][key as keyof T] = props[key]
|
|
39
|
+
assigned = true
|
|
40
|
+
break
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (!assigned) {
|
|
44
|
+
rest[key as keyof T] = props[key]
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return [...result, rest]
|
|
49
|
+
}
|
|
50
|
+
|
|
21
51
|
export * from './localStorage'
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
"use client";
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
|
|
21
|
-
// src/components/Checkbox.tsx
|
|
22
|
-
var Checkbox_exports = {};
|
|
23
|
-
__export(Checkbox_exports, {
|
|
24
|
-
Checkbox: () => Checkbox
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(Checkbox_exports);
|
|
27
|
-
var import_recipes = require("@cerberus/styled-system/recipes");
|
|
28
|
-
var import_patterns = require("@cerberus/styled-system/patterns");
|
|
29
|
-
var import_css = require("@cerberus/styled-system/css");
|
|
30
|
-
|
|
31
|
-
// src/components/Show.tsx
|
|
32
|
-
var import_react = require("react");
|
|
33
|
-
function Show(props) {
|
|
34
|
-
const { when, children, fallback } = props;
|
|
35
|
-
const condition = (0, import_react.useMemo)(() => when ?? false, [when]);
|
|
36
|
-
return (0, import_react.useMemo)(() => {
|
|
37
|
-
if (condition) return children;
|
|
38
|
-
return fallback ?? null;
|
|
39
|
-
}, [condition, children, fallback]);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// src/context/field.tsx
|
|
43
|
-
var import_react2 = require("react");
|
|
44
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
45
|
-
var FieldContext = (0, import_react2.createContext)(null);
|
|
46
|
-
function useFieldContext() {
|
|
47
|
-
const context = (0, import_react2.useContext)(FieldContext);
|
|
48
|
-
if (!context) {
|
|
49
|
-
throw new Error("useFieldContext must be used within a Field Provider.");
|
|
50
|
-
}
|
|
51
|
-
return context;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// src/context/cerberus.tsx
|
|
55
|
-
var import_react3 = require("react");
|
|
56
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
57
|
-
var CerberusContext = (0, import_react3.createContext)(null);
|
|
58
|
-
function useCerberusContext() {
|
|
59
|
-
const context = (0, import_react3.useContext)(CerberusContext);
|
|
60
|
-
if (!context) {
|
|
61
|
-
throw new Error("useCerberus must be used within a CerberusProvider");
|
|
62
|
-
}
|
|
63
|
-
return context;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// src/components/Checkbox.tsx
|
|
67
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
68
|
-
function Checkbox(props) {
|
|
69
|
-
const { describedBy, size, checked, mixed, ...nativeProps } = props;
|
|
70
|
-
const { invalid, ...fieldStates } = useFieldContext();
|
|
71
|
-
const styles = (0, import_recipes.checkbox)({ size });
|
|
72
|
-
const { icons } = useCerberusContext();
|
|
73
|
-
const { checkbox: CheckIcon, indeterminate: IndeterminateIcon } = icons;
|
|
74
|
-
if (!CheckIcon) {
|
|
75
|
-
throw new Error("The CerberusProvider is missing the checkbox icon.");
|
|
76
|
-
}
|
|
77
|
-
if (!IndeterminateIcon) {
|
|
78
|
-
throw new Error("The CerberusProvider is missing the indeterminate icon.");
|
|
79
|
-
}
|
|
80
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
81
|
-
"div",
|
|
82
|
-
{
|
|
83
|
-
className: (0, import_css.cx)(
|
|
84
|
-
styles.root,
|
|
85
|
-
(0, import_patterns.vstack)({
|
|
86
|
-
gap: "0",
|
|
87
|
-
justify: "center"
|
|
88
|
-
})
|
|
89
|
-
),
|
|
90
|
-
children: [
|
|
91
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
92
|
-
"input",
|
|
93
|
-
{
|
|
94
|
-
...nativeProps,
|
|
95
|
-
...fieldStates,
|
|
96
|
-
...describedBy && { "aria-describedby": describedBy },
|
|
97
|
-
...invalid && { "aria-invalid": true },
|
|
98
|
-
...mixed && { "aria-checked": "mixed" },
|
|
99
|
-
className: (0, import_css.cx)("peer", nativeProps.className, styles.input),
|
|
100
|
-
type: "checkbox"
|
|
101
|
-
}
|
|
102
|
-
),
|
|
103
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Show, { when: checked && !mixed, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: styles.icon, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(CheckIcon, {}) }) }),
|
|
104
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Show, { when: mixed, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: styles.icon, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(IndeterminateIcon, {}) }) })
|
|
105
|
-
]
|
|
106
|
-
}
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
110
|
-
0 && (module.exports = {
|
|
111
|
-
Checkbox
|
|
112
|
-
});
|
|
113
|
-
//# sourceMappingURL=Checkbox.cjs.map
|