@cerberus-design/react 0.10.4-next-8007762 → 0.10.4-next-4e536c0
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 +138 -0
- package/build/legacy/components/Fieldset.cjs +66 -0
- package/build/legacy/components/Fieldset.cjs.map +1 -0
- package/build/legacy/components/FieldsetLabel.cjs +49 -0
- package/build/legacy/components/FieldsetLabel.cjs.map +1 -0
- package/build/legacy/components/Label.cjs +1 -1
- package/build/legacy/components/Label.cjs.map +1 -1
- package/build/legacy/components/Legend.cjs +95 -0
- package/build/legacy/components/Legend.cjs.map +1 -0
- package/build/legacy/context/prompt-modal.cjs +1 -1
- package/build/legacy/context/prompt-modal.cjs.map +1 -1
- package/build/legacy/index.cjs +424 -333
- package/build/legacy/index.cjs.map +1 -1
- package/build/modern/_tsup-dts-rollup.d.ts +138 -0
- package/build/modern/chunk-3ZDFQO25.js +31 -0
- package/build/modern/chunk-3ZDFQO25.js.map +1 -0
- package/build/modern/chunk-6TTN2JMY.js +54 -0
- package/build/modern/chunk-6TTN2JMY.js.map +1 -0
- package/build/modern/{chunk-LKFXUM3Z.js → chunk-77LI5SP3.js} +8 -8
- package/build/modern/{chunk-6YUB3ITX.js → chunk-BGBCJ2W2.js} +7 -7
- package/build/modern/{chunk-I35HMGJQ.js → chunk-NMF2HYWO.js} +2 -2
- package/build/modern/{chunk-I35HMGJQ.js.map → chunk-NMF2HYWO.js.map} +1 -1
- package/build/modern/chunk-PZAZKQMO.js +25 -0
- package/build/modern/chunk-PZAZKQMO.js.map +1 -0
- package/build/modern/{chunk-EZNGCXVJ.js → chunk-SP6O64KQ.js} +4 -4
- package/build/modern/components/Fieldset.js +9 -0
- package/build/modern/components/Fieldset.js.map +1 -0
- package/build/modern/components/FieldsetLabel.js +7 -0
- package/build/modern/components/FieldsetLabel.js.map +1 -0
- package/build/modern/components/Label.js +1 -1
- package/build/modern/components/Legend.js +10 -0
- package/build/modern/components/Legend.js.map +1 -0
- package/build/modern/context/confirm-modal.js +3 -3
- package/build/modern/context/notification-center.js +2 -2
- package/build/modern/context/prompt-modal.js +4 -4
- package/build/modern/index.js +45 -33
- package/build/modern/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Fieldset.tsx +65 -0
- package/src/components/FieldsetLabel.tsx +59 -0
- package/src/components/Label.tsx +1 -1
- package/src/components/Legend.tsx +87 -0
- package/src/index.ts +3 -0
- /package/build/modern/{chunk-LKFXUM3Z.js.map → chunk-77LI5SP3.js.map} +0 -0
- /package/build/modern/{chunk-6YUB3ITX.js.map → chunk-BGBCJ2W2.js.map} +0 -0
- /package/build/modern/{chunk-EZNGCXVJ.js.map → chunk-SP6O64KQ.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["/**\n * This module is the entry point for the Cerberus React package.\n * @module\n */\n\n// components\n\nexport * from './components/Avatar'\nexport * from './components/Button'\nexport * from './components/Checkbox'\nexport * from './components/CircularProgress'\nexport * from './components/Droppable'\nexport * from './components/FieldMessage'\nexport * from './components/FeatureFlag'\nexport * from './components/FileStatus'\nexport * from './components/FileUploader'\nexport * from './components/IconButton'\nexport * from './components/Input'\nexport * from './components/Label'\nexport * from './components/Modal'\nexport * from './components/ModalHeader'\nexport * from './components/ModalHeading'\nexport * from './components/ModalDescription'\nexport * from './components/NavMenuTrigger'\nexport * from './components/NavMenuList'\nexport * from './components/NavMenuLink'\nexport * from './components/Notification'\nexport * from './components/NotificationHeading'\nexport * from './components/NotificationDescription'\nexport * from './components/Portal'\nexport * from './components/ProgressBar'\nexport * from './components/Radio'\nexport * from './components/Select'\nexport * from './components/Spinner'\nexport * from './components/Tab'\nexport * from './components/TabList'\nexport * from './components/TabPanel'\nexport * from './components/Table'\nexport * from './components/Thead'\nexport * from './components/Th'\nexport * from './components/Td'\nexport * from './components/Tbody'\nexport * from './components/Tag'\nexport * from './components/Textarea'\nexport * from './components/Toggle'\nexport * from './components/Show'\n\n// context\n\nexport * from './context/confirm-modal'\nexport * from './context/feature-flags'\nexport * from './context/field'\nexport * from './context/navMenu'\nexport * from './context/notification-center'\nexport * from './context/prompt-modal'\nexport * from './context/tabs'\nexport * from './context/theme'\n\n// hooks\n\nexport * from './hooks/useModal'\nexport * from './hooks/useTheme'\nexport * from './hooks/useToggle'\n\n// aria-helpers\n\nexport * from './aria-helpers/nav-menu.aria'\nexport * from './aria-helpers/tabs.aria'\nexport * from './aria-helpers/trap-focus.aria'\n\n// utils\n\nexport * from './config/defineIcons'\n\n// shared types\n\nexport * from './types'\n\n// 3rd party\n\nexport * from '@dnd-kit/core'\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["/**\n * This module is the entry point for the Cerberus React package.\n * @module\n */\n\n// components\n\nexport * from './components/Avatar'\nexport * from './components/Button'\nexport * from './components/Checkbox'\nexport * from './components/CircularProgress'\nexport * from './components/Droppable'\nexport * from './components/FieldMessage'\nexport * from './components/FeatureFlag'\nexport * from './components/Fieldset'\nexport * from './components/FieldsetLabel'\nexport * from './components/FileStatus'\nexport * from './components/FileUploader'\nexport * from './components/IconButton'\nexport * from './components/Input'\nexport * from './components/Label'\nexport * from './components/Legend'\nexport * from './components/Modal'\nexport * from './components/ModalHeader'\nexport * from './components/ModalHeading'\nexport * from './components/ModalDescription'\nexport * from './components/NavMenuTrigger'\nexport * from './components/NavMenuList'\nexport * from './components/NavMenuLink'\nexport * from './components/Notification'\nexport * from './components/NotificationHeading'\nexport * from './components/NotificationDescription'\nexport * from './components/Portal'\nexport * from './components/ProgressBar'\nexport * from './components/Radio'\nexport * from './components/Select'\nexport * from './components/Spinner'\nexport * from './components/Tab'\nexport * from './components/TabList'\nexport * from './components/TabPanel'\nexport * from './components/Table'\nexport * from './components/Thead'\nexport * from './components/Th'\nexport * from './components/Td'\nexport * from './components/Tbody'\nexport * from './components/Tag'\nexport * from './components/Textarea'\nexport * from './components/Toggle'\nexport * from './components/Show'\n\n// context\n\nexport * from './context/confirm-modal'\nexport * from './context/feature-flags'\nexport * from './context/field'\nexport * from './context/navMenu'\nexport * from './context/notification-center'\nexport * from './context/prompt-modal'\nexport * from './context/tabs'\nexport * from './context/theme'\n\n// hooks\n\nexport * from './hooks/useModal'\nexport * from './hooks/useTheme'\nexport * from './hooks/useToggle'\n\n// aria-helpers\n\nexport * from './aria-helpers/nav-menu.aria'\nexport * from './aria-helpers/tabs.aria'\nexport * from './aria-helpers/trap-focus.aria'\n\n// utils\n\nexport * from './config/defineIcons'\n\n// shared types\n\nexport * from './types'\n\n// 3rd party\n\nexport * from '@dnd-kit/core'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmFA,cAAc;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cerberus-design/react",
|
|
3
|
-
"version": "0.10.4-next-
|
|
3
|
+
"version": "0.10.4-next-4e536c0",
|
|
4
4
|
"description": "The Cerberus Design React component library.",
|
|
5
5
|
"browserslist": "> 0.25%, not dead",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"react-dom": "^18",
|
|
27
27
|
"tsup": "^8.1.0",
|
|
28
28
|
"@cerberus-design/configs": "0.0.0",
|
|
29
|
-
"@cerberus-design/styled-system": "0.10.4-next-
|
|
29
|
+
"@cerberus-design/styled-system": "0.10.4-next-4e536c0"
|
|
30
30
|
},
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { css, cx } from '@cerberus/styled-system/css'
|
|
4
|
+
import type { FieldsetHTMLAttributes } from 'react'
|
|
5
|
+
import { useFieldContext } from '../context/field'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* This module contains the Fieldset component.
|
|
9
|
+
* @module Fieldset
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
export type FieldsetProps = FieldsetHTMLAttributes<HTMLFieldSetElement>
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* A component to group related elements in a form for accessibility.
|
|
16
|
+
* @memberof Field
|
|
17
|
+
* @see https://cerberus.digitalu.com/react/fieldset
|
|
18
|
+
* @description [A11y Form Checklist](https://www.a11yproject.com/checklist/#forms)
|
|
19
|
+
* @description [MDN Web Docs: Fieldset](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/fieldset)
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* import { Fieldset, Legend, Field, Radio, Label } from '@cerberus/react'
|
|
23
|
+
* import { Hstack } from '@cerberus/styled-system/jsx'
|
|
24
|
+
*
|
|
25
|
+
* function SomeForm() {
|
|
26
|
+
* return (
|
|
27
|
+
* <form>
|
|
28
|
+
* <Fieldset>
|
|
29
|
+
* <Legend>Do you like cats?</Legend>
|
|
30
|
+
* <Hstack>
|
|
31
|
+
* <Field>
|
|
32
|
+
* <Radio id="yes" name="cats" value="yes" />
|
|
33
|
+
* <Label htmlFor="yes">Yes</Label>
|
|
34
|
+
* </Field>
|
|
35
|
+
* </Hstack>
|
|
36
|
+
* <Hstack>
|
|
37
|
+
* <Field>
|
|
38
|
+
* <Radio id="no" name="cats" value="no" />
|
|
39
|
+
* <Label htmlFor="no">No</Label>
|
|
40
|
+
* </Field>
|
|
41
|
+
* </Hstack>
|
|
42
|
+
* </Fieldset>
|
|
43
|
+
* </form>
|
|
44
|
+
* )
|
|
45
|
+
* }
|
|
46
|
+
*/
|
|
47
|
+
export function Fieldset(props: FieldsetProps) {
|
|
48
|
+
const { invalid, ...formState } = useFieldContext()
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<fieldset
|
|
52
|
+
{...props}
|
|
53
|
+
{...formState}
|
|
54
|
+
{...(invalid && { 'aria-invalid': true })}
|
|
55
|
+
className={cx(
|
|
56
|
+
props.className,
|
|
57
|
+
css({
|
|
58
|
+
border: 'none',
|
|
59
|
+
pt: 2,
|
|
60
|
+
margin: 0,
|
|
61
|
+
}),
|
|
62
|
+
)}
|
|
63
|
+
/>
|
|
64
|
+
)
|
|
65
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { cx } from '@cerberus/styled-system/css'
|
|
2
|
+
import { label, type LabelVariantProps } from '@cerberus/styled-system/recipes'
|
|
3
|
+
import type { LabelProps } from './Label'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* This module contains the FieldsetLabel component.
|
|
7
|
+
* @module FieldsetLabel
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export type FieldsetLabelProps = LabelProps & LabelVariantProps
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Used for labeling inputs that are children of a Fieldset group.
|
|
14
|
+
* @memberof Fieldset
|
|
15
|
+
* @see https://cerberus.digitalu.design/react/fieldset
|
|
16
|
+
* @definition [ARIA Forms](https://www.a11yproject.com/checklist/#forms)
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* import { Fieldset, Legend, Field, Radio, Label } from '@cerberus/react'
|
|
20
|
+
* import { Hstack } from '@cerberus/styled-system/jsx'
|
|
21
|
+
*
|
|
22
|
+
* function SomeForm() {
|
|
23
|
+
* return (
|
|
24
|
+
* <form>
|
|
25
|
+
* <Fieldset>
|
|
26
|
+
* <Legend>Do you like cats?</Legend>
|
|
27
|
+
* <Hstack>
|
|
28
|
+
* <Field>
|
|
29
|
+
* <Radio id="yes" name="cats" value="yes" />
|
|
30
|
+
* <FieldsetLabel htmlFor="yes">Yes</FieldsetLabel>
|
|
31
|
+
* </Field>
|
|
32
|
+
* </Hstack>
|
|
33
|
+
* <Hstack>
|
|
34
|
+
* <Field>
|
|
35
|
+
* <Radio id="no" name="cats" value="no" />
|
|
36
|
+
* <FieldsetLabel htmlFor="no">No</FieldsetLabel>
|
|
37
|
+
* </Field>
|
|
38
|
+
* </Hstack>
|
|
39
|
+
* </Fieldset>
|
|
40
|
+
* </form>
|
|
41
|
+
* )
|
|
42
|
+
* }
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export function FieldsetLabel(props: FieldsetLabelProps) {
|
|
46
|
+
const { size, usage, ...nativeProps } = props
|
|
47
|
+
return (
|
|
48
|
+
<label
|
|
49
|
+
{...nativeProps}
|
|
50
|
+
className={cx(
|
|
51
|
+
nativeProps.className,
|
|
52
|
+
label({
|
|
53
|
+
size,
|
|
54
|
+
usage,
|
|
55
|
+
}),
|
|
56
|
+
)}
|
|
57
|
+
/>
|
|
58
|
+
)
|
|
59
|
+
}
|
package/src/components/Label.tsx
CHANGED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { css, cx } from '@cerberus/styled-system/css'
|
|
4
|
+
import { type HTMLAttributes } from 'react'
|
|
5
|
+
import { useFieldContext } from '../context/field'
|
|
6
|
+
import { Show } from './Show'
|
|
7
|
+
import {
|
|
8
|
+
label,
|
|
9
|
+
type LabelVariantProps,
|
|
10
|
+
} from '@cerberus-design/styled-system/recipes'
|
|
11
|
+
import { hstack } from '@cerberus-design/styled-system/patterns'
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* This module contains the Fieldset component.
|
|
15
|
+
* @module Fieldset
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
export type LegendProps = HTMLAttributes<HTMLLegendElement> & LabelVariantProps
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* A component to provide a global label for a group of related elements in a form (for accessibility).
|
|
22
|
+
* @memberof Fieldset
|
|
23
|
+
* @see https://cerberus.digitalu.com/react/fieldset
|
|
24
|
+
* @description [A11y Form Checklist](https://www.a11yproject.com/checklist/#forms)
|
|
25
|
+
* @description [MDN Web Docs: Legend](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/legend)
|
|
26
|
+
* @example
|
|
27
|
+
* ```tsx
|
|
28
|
+
* import { Fieldset, Legend, Field, Radio, Label } from '@cerberus/react'
|
|
29
|
+
* import { Hstack } from '@cerberus/styled-system/jsx'
|
|
30
|
+
*
|
|
31
|
+
* function SomeForm() {
|
|
32
|
+
* return (
|
|
33
|
+
* <form>
|
|
34
|
+
* <Fieldset>
|
|
35
|
+
* <Legend>Do you like cats?</Legend>
|
|
36
|
+
* <Hstack>
|
|
37
|
+
* <Field>
|
|
38
|
+
* <Radio id="yes" name="cats" value="yes" />
|
|
39
|
+
* <Label htmlFor="yes">Yes</Label>
|
|
40
|
+
* </Field>
|
|
41
|
+
* </Hstack>
|
|
42
|
+
* <Hstack>
|
|
43
|
+
* <Field>
|
|
44
|
+
* <Radio id="no" name="cats" value="no" />
|
|
45
|
+
* <Label htmlFor="no">No</Label>
|
|
46
|
+
* </Field>
|
|
47
|
+
* </Hstack>
|
|
48
|
+
* </Fieldset>
|
|
49
|
+
* </form>
|
|
50
|
+
* )
|
|
51
|
+
* }
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export function Legend(props: LegendProps) {
|
|
55
|
+
const { size, ...nativeProps } = props
|
|
56
|
+
const { invalid, ...formState } = useFieldContext()
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<legend
|
|
60
|
+
{...nativeProps}
|
|
61
|
+
{...formState}
|
|
62
|
+
{...(invalid && { 'aria-invalid': true })}
|
|
63
|
+
className={cx(
|
|
64
|
+
nativeProps.className,
|
|
65
|
+
hstack({
|
|
66
|
+
justify: 'space-between',
|
|
67
|
+
w: 'full',
|
|
68
|
+
}),
|
|
69
|
+
label({
|
|
70
|
+
size,
|
|
71
|
+
}),
|
|
72
|
+
)}
|
|
73
|
+
>
|
|
74
|
+
{nativeProps.children}
|
|
75
|
+
<Show when={formState.required}>
|
|
76
|
+
<span
|
|
77
|
+
className={css({
|
|
78
|
+
color: 'page.text.100',
|
|
79
|
+
fontSize: 'inherit',
|
|
80
|
+
})}
|
|
81
|
+
>
|
|
82
|
+
(required)
|
|
83
|
+
</span>
|
|
84
|
+
</Show>
|
|
85
|
+
</legend>
|
|
86
|
+
)
|
|
87
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -12,11 +12,14 @@ export * from './components/CircularProgress'
|
|
|
12
12
|
export * from './components/Droppable'
|
|
13
13
|
export * from './components/FieldMessage'
|
|
14
14
|
export * from './components/FeatureFlag'
|
|
15
|
+
export * from './components/Fieldset'
|
|
16
|
+
export * from './components/FieldsetLabel'
|
|
15
17
|
export * from './components/FileStatus'
|
|
16
18
|
export * from './components/FileUploader'
|
|
17
19
|
export * from './components/IconButton'
|
|
18
20
|
export * from './components/Input'
|
|
19
21
|
export * from './components/Label'
|
|
22
|
+
export * from './components/Legend'
|
|
20
23
|
export * from './components/Modal'
|
|
21
24
|
export * from './components/ModalHeader'
|
|
22
25
|
export * from './components/ModalHeading'
|
|
File without changes
|
|
File without changes
|
|
File without changes
|