@cerberus-design/react 0.16.0-next-feeb186 → 0.16.0-next-22894bb
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 +166 -2
- package/build/legacy/components/checkbox/checkbox.cjs.map +1 -1
- package/build/legacy/components/checkbox/index.cjs.map +1 -1
- package/build/legacy/components/rating/index.cjs +167 -0
- package/build/legacy/components/rating/index.cjs.map +1 -0
- package/build/legacy/components/rating/parts.cjs +98 -0
- package/build/legacy/components/rating/parts.cjs.map +1 -0
- package/build/legacy/components/rating/primitives.cjs +97 -0
- package/build/legacy/components/rating/primitives.cjs.map +1 -0
- package/build/legacy/components/rating/rating.cjs +151 -0
- package/build/legacy/components/rating/rating.cjs.map +1 -0
- package/build/legacy/index.cjs +325 -217
- package/build/legacy/index.cjs.map +1 -1
- package/build/modern/_tsup-dts-rollup.d.ts +166 -2
- package/build/modern/{chunk-Z4342DRO.js → chunk-H5WNUPGH.js} +4 -4
- package/build/modern/chunk-OS73F4SR.js +25 -0
- package/build/modern/chunk-OS73F4SR.js.map +1 -0
- package/build/modern/chunk-QQCB6JXW.js +36 -0
- package/build/modern/chunk-QQCB6JXW.js.map +1 -0
- package/build/modern/{chunk-Y4ZEJ2EF.js → chunk-UNRQAXLJ.js} +1 -1
- package/build/modern/chunk-UNRQAXLJ.js.map +1 -0
- package/build/modern/chunk-W47QEZD5.js +71 -0
- package/build/modern/chunk-W47QEZD5.js.map +1 -0
- package/build/modern/chunk-ZOSGUATV.js +1 -0
- package/build/modern/chunk-ZOSGUATV.js.map +1 -0
- package/build/modern/components/checkbox/checkbox.js +1 -1
- package/build/modern/components/checkbox/index.js +1 -1
- package/build/modern/components/rating/index.js +31 -0
- package/build/modern/components/rating/index.js.map +1 -0
- package/build/modern/components/rating/parts.js +8 -0
- package/build/modern/components/rating/parts.js.map +1 -0
- package/build/modern/components/rating/primitives.js +19 -0
- package/build/modern/components/rating/primitives.js.map +1 -0
- package/build/modern/components/rating/rating.js +12 -0
- package/build/modern/components/rating/rating.js.map +1 -0
- package/build/modern/context/notification-center.js +2 -2
- package/build/modern/index.js +47 -22
- package/build/modern/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/checkbox/checkbox.tsx +2 -2
- package/src/components/rating/index.ts +8 -0
- package/src/components/rating/parts.tsx +65 -0
- package/src/components/rating/primitives.tsx +99 -0
- package/src/components/rating/rating.tsx +78 -0
- package/src/index.ts +1 -0
- package/build/modern/chunk-Y4ZEJ2EF.js.map +0 -1
- /package/build/modern/{chunk-Z4342DRO.js.map → chunk-H5WNUPGH.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// deprecated\n\nexport * from './components/deprecated/FieldMessage'\nexport * from './components/deprecated/FieldsetLabel'\nexport * from './components/deprecated/Label'\nexport * from './components/deprecated/Modal'\nexport * from './components/deprecated/ModalHeader'\nexport * from './components/deprecated/ModalHeading'\nexport * from './components/deprecated/ModalDescription'\nexport * from './components/deprecated/NavMenuTrigger'\nexport * from './components/deprecated/NavMenuList'\nexport * from './components/deprecated/NavMenuLink'\nexport * from './hooks/useDate'\nexport * from './hooks/useModal'\nexport * from './hooks/useToggle'\n\n// components\n\nexport * from './components/Accordion'\nexport * from './components/Accordion.client'\nexport * from './components/AccordionItemGroup'\nexport * from './components/Admonition'\nexport * from './components/Avatar'\nexport * from './components/button/index'\nexport * from './components/checkbox/index'\nexport * from './components/CircularProgress'\nexport * from './components/cta-dialog/index'\nexport * from './components/DatePicker.client'\nexport * from './components/DatePicker.server'\nexport * from './components/Dialog'\nexport * from './components/Dialog.client'\nexport * from './components/Droppable'\nexport * from './components/FeatureFlag'\nexport * from './components/field/index'\nexport * from './components/fieldset/index'\nexport * from './components/FileStatus'\nexport * from './components/FileUploader'\nexport * from './components/for'\nexport * from './components/IconButton'\nexport * from './components/Legend'\nexport * from './components/Menu'\nexport * from './components/Notification'\nexport * from './components/NotificationHeading'\nexport * from './components/NotificationDescription'\nexport * from './components/Portal'\nexport * from './components/ProgressBar'\nexport * from './components/radio/index'\nexport * from './components/select/index'\nexport * from './components/Show'\nexport * from './components/Spinner'\nexport * from './components/switch/index'\nexport * from './components/Tabs.client'\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/Text'\nexport * from './components/toggle/index'\nexport * from './components/Tooltip'\n\n// context\n\nexport * from './context/cerberus'\nexport * from './context/confirm-modal'\nexport * from './context/feature-flags'\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/useTheme'\nexport * from './hooks/useRootColors'\n\n// aria-helpers\n\nexport * from './aria-helpers/nav-menu.aria'\nexport * from './aria-helpers/trap-focus.aria'\n\n// utils\n\nexport * from './config/index'\nexport * from './utils/index'\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// deprecated\n\nexport * from './components/deprecated/FieldMessage'\nexport * from './components/deprecated/FieldsetLabel'\nexport * from './components/deprecated/Label'\nexport * from './components/deprecated/Modal'\nexport * from './components/deprecated/ModalHeader'\nexport * from './components/deprecated/ModalHeading'\nexport * from './components/deprecated/ModalDescription'\nexport * from './components/deprecated/NavMenuTrigger'\nexport * from './components/deprecated/NavMenuList'\nexport * from './components/deprecated/NavMenuLink'\nexport * from './hooks/useDate'\nexport * from './hooks/useModal'\nexport * from './hooks/useToggle'\n\n// components\n\nexport * from './components/Accordion'\nexport * from './components/Accordion.client'\nexport * from './components/AccordionItemGroup'\nexport * from './components/Admonition'\nexport * from './components/Avatar'\nexport * from './components/button/index'\nexport * from './components/checkbox/index'\nexport * from './components/CircularProgress'\nexport * from './components/cta-dialog/index'\nexport * from './components/DatePicker.client'\nexport * from './components/DatePicker.server'\nexport * from './components/Dialog'\nexport * from './components/Dialog.client'\nexport * from './components/Droppable'\nexport * from './components/FeatureFlag'\nexport * from './components/field/index'\nexport * from './components/fieldset/index'\nexport * from './components/FileStatus'\nexport * from './components/FileUploader'\nexport * from './components/for'\nexport * from './components/IconButton'\nexport * from './components/Legend'\nexport * from './components/Menu'\nexport * from './components/Notification'\nexport * from './components/NotificationHeading'\nexport * from './components/NotificationDescription'\nexport * from './components/Portal'\nexport * from './components/ProgressBar'\nexport * from './components/radio/index'\nexport * from './components/rating/index'\nexport * from './components/select/index'\nexport * from './components/Show'\nexport * from './components/Spinner'\nexport * from './components/switch/index'\nexport * from './components/Tabs.client'\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/Text'\nexport * from './components/toggle/index'\nexport * from './components/Tooltip'\n\n// context\n\nexport * from './context/cerberus'\nexport * from './context/confirm-modal'\nexport * from './context/feature-flags'\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/useTheme'\nexport * from './hooks/useRootColors'\n\n// aria-helpers\n\nexport * from './aria-helpers/nav-menu.aria'\nexport * from './aria-helpers/trap-focus.aria'\n\n// utils\n\nexport * from './config/index'\nexport * from './utils/index'\n\n// shared types\n\nexport * from './types'\n\n// 3rd party\n\nexport * from '@dnd-kit/core'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoGA,cAAc;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cerberus-design/react",
|
|
3
|
-
"version": "0.16.0-next-
|
|
3
|
+
"version": "0.16.0-next-22894bb",
|
|
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/styled-system": "npm:@cerberus-design/styled-system@0.16.0-next-
|
|
29
|
+
"@cerberus/styled-system": "npm:@cerberus-design/styled-system@0.16.0-next-22894bb"
|
|
30
30
|
},
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|
|
@@ -15,8 +15,8 @@ export type CheckboxProps = CheckboxVariantProps & CheckboxRootProps
|
|
|
15
15
|
/**
|
|
16
16
|
* Checkbox component is an abstraction of the primitives that displays a
|
|
17
17
|
* controlled checkbox with a label.
|
|
18
|
-
* @description [Cerberus Docs]
|
|
19
|
-
* @description [Ark Docs]
|
|
18
|
+
* @description [Cerberus Docs](https://cerberus.digitalu.design/react/checkbox)
|
|
19
|
+
* @description [Ark Docs](https://ark-ui.com/docs/components/checkbox)
|
|
20
20
|
*/
|
|
21
21
|
export function Checkbox(props: CheckboxProps) {
|
|
22
22
|
const { size, children, ...rootProps } = props
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { ElementType } from 'react'
|
|
2
|
+
import {
|
|
3
|
+
RatingContext,
|
|
4
|
+
RatingControl,
|
|
5
|
+
RatingHiddenInput,
|
|
6
|
+
RatingItem,
|
|
7
|
+
RatingItemContext,
|
|
8
|
+
RatingLabel,
|
|
9
|
+
RatingRoot,
|
|
10
|
+
} from './primitives'
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* This module contains the parts of the Rating component.
|
|
14
|
+
* @module 'rating/parts'
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
interface RatingPartsValue {
|
|
18
|
+
/**
|
|
19
|
+
* The container of the rating.
|
|
20
|
+
*/
|
|
21
|
+
Root: ElementType
|
|
22
|
+
/**
|
|
23
|
+
* The label of the rating.
|
|
24
|
+
*/
|
|
25
|
+
Label: ElementType
|
|
26
|
+
/**
|
|
27
|
+
* The visual representation of the rating.
|
|
28
|
+
*/
|
|
29
|
+
Control: ElementType
|
|
30
|
+
/**
|
|
31
|
+
* The context of the rating.
|
|
32
|
+
*/
|
|
33
|
+
Context: ElementType
|
|
34
|
+
/**
|
|
35
|
+
* The item to display for the rating.
|
|
36
|
+
*/
|
|
37
|
+
Item: ElementType
|
|
38
|
+
/**
|
|
39
|
+
* The context provider for the rating items.
|
|
40
|
+
*/
|
|
41
|
+
ItemContext: ElementType
|
|
42
|
+
/**
|
|
43
|
+
* The native input of the rating.
|
|
44
|
+
*/
|
|
45
|
+
HiddenInput: ElementType
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* An Object containing the parts of the Rating component. For users that
|
|
50
|
+
* prefer Object component syntax.
|
|
51
|
+
*
|
|
52
|
+
* @remarks
|
|
53
|
+
*
|
|
54
|
+
* When using object component syntax, you import the RatingParts object and
|
|
55
|
+
* the entire family of components vs. only what you use.
|
|
56
|
+
*/
|
|
57
|
+
export const RatingParts: RatingPartsValue = {
|
|
58
|
+
Root: RatingRoot,
|
|
59
|
+
Label: RatingLabel,
|
|
60
|
+
Control: RatingControl,
|
|
61
|
+
Context: RatingContext,
|
|
62
|
+
Item: RatingItem,
|
|
63
|
+
ItemContext: RatingItemContext,
|
|
64
|
+
HiddenInput: RatingHiddenInput,
|
|
65
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import {
|
|
2
|
+
RatingGroup,
|
|
3
|
+
type RatingGroupContextProps,
|
|
4
|
+
type RatingGroupControlProps,
|
|
5
|
+
type RatingGroupHiddenInputProps,
|
|
6
|
+
type RatingGroupItemContextProps,
|
|
7
|
+
type RatingGroupItemProps,
|
|
8
|
+
type RatingGroupLabelProps,
|
|
9
|
+
type RatingGroupRootProps,
|
|
10
|
+
} from '@ark-ui/react/rating-group'
|
|
11
|
+
import { cx } from '@cerberus/styled-system/css'
|
|
12
|
+
import {
|
|
13
|
+
ratingGroup,
|
|
14
|
+
type RatingGroupVariantProps,
|
|
15
|
+
} from '@cerberus/styled-system/recipes'
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* This module contains the primitives of the Rating component.
|
|
19
|
+
* @module 'rating/primitives'
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The root primitive of the Rating component.
|
|
24
|
+
*/
|
|
25
|
+
export function RatingRoot(
|
|
26
|
+
props: RatingGroupRootProps & RatingGroupVariantProps,
|
|
27
|
+
) {
|
|
28
|
+
const { orientation, size, ...rootProps } = props
|
|
29
|
+
const styles = ratingGroup({ orientation, size })
|
|
30
|
+
return (
|
|
31
|
+
<RatingGroup.Root
|
|
32
|
+
{...rootProps}
|
|
33
|
+
className={cx(styles.root, rootProps.className)}
|
|
34
|
+
/>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The label primitive of the Rating component.
|
|
40
|
+
*/
|
|
41
|
+
export function RatingLabel(props: RatingGroupLabelProps) {
|
|
42
|
+
const styles = ratingGroup()
|
|
43
|
+
return (
|
|
44
|
+
<RatingGroup.Label
|
|
45
|
+
{...props}
|
|
46
|
+
className={cx(styles.label, props.className)}
|
|
47
|
+
/>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* The control primitive of the Rating component.
|
|
53
|
+
*/
|
|
54
|
+
export function RatingControl(props: RatingGroupControlProps) {
|
|
55
|
+
const styles = ratingGroup()
|
|
56
|
+
return (
|
|
57
|
+
<RatingGroup.Control
|
|
58
|
+
{...props}
|
|
59
|
+
className={cx(styles.control, props.className)}
|
|
60
|
+
/>
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* The context primitive of the Rating component.
|
|
66
|
+
*/
|
|
67
|
+
export function RatingContext(props: RatingGroupContextProps) {
|
|
68
|
+
return <RatingGroup.Context {...props} />
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* The item primitive of the Rating component.
|
|
73
|
+
*/
|
|
74
|
+
export function RatingItem(
|
|
75
|
+
props: RatingGroupItemProps & RatingGroupVariantProps,
|
|
76
|
+
) {
|
|
77
|
+
const { palette, ...itemProps } = props
|
|
78
|
+
const styles = ratingGroup({ palette })
|
|
79
|
+
return (
|
|
80
|
+
<RatingGroup.Item
|
|
81
|
+
{...itemProps}
|
|
82
|
+
className={cx(styles.item, itemProps.className)}
|
|
83
|
+
/>
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* The item context primitive of the Rating component.
|
|
89
|
+
*/
|
|
90
|
+
export function RatingItemContext(props: RatingGroupItemContextProps) {
|
|
91
|
+
return <RatingGroup.ItemContext {...props} />
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* The hidden input primitive of the Rating component.
|
|
96
|
+
*/
|
|
97
|
+
export function RatingHiddenInput(props: RatingGroupHiddenInputProps) {
|
|
98
|
+
return <RatingGroup.HiddenInput {...props} />
|
|
99
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
RatingGroupRootProps,
|
|
3
|
+
UseRatingGroupContext,
|
|
4
|
+
UseRatingGroupItemContext,
|
|
5
|
+
} from '@ark-ui/react/rating-group'
|
|
6
|
+
import type { RatingGroupVariantProps } from '@cerberus/styled-system/recipes'
|
|
7
|
+
import type { ReactNode } from 'react'
|
|
8
|
+
import { splitProps } from '../../utils/index'
|
|
9
|
+
import { Show } from '../Show'
|
|
10
|
+
import { RatingParts } from './parts'
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* This module contains the abstracted Rating component.
|
|
14
|
+
* @module 'react/rating'
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
export interface RatingProps
|
|
18
|
+
extends Omit<RatingGroupRootProps, 'children'>,
|
|
19
|
+
RatingGroupVariantProps {
|
|
20
|
+
/**
|
|
21
|
+
* The label of the rating component.
|
|
22
|
+
*/
|
|
23
|
+
label?: string
|
|
24
|
+
/**
|
|
25
|
+
* The children of the rating component.
|
|
26
|
+
*/
|
|
27
|
+
children: (context: UseRatingGroupItemContext) => ReactNode
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The Rating component is an abstraction of the primitives which provides a
|
|
32
|
+
* visual rating system for a user to select a value.
|
|
33
|
+
* @description [Cerberus Docs](https://cerberus.digitalu.design/react/rating)
|
|
34
|
+
* @description [Ark Docs](https://ark-ui.com/react/docs/components/rating-group#api-reference)
|
|
35
|
+
* @example
|
|
36
|
+
* ```tsx
|
|
37
|
+
* <Rating count={5} defaultValue={3} allowHalf>
|
|
38
|
+
* {({ half, highlighted }) => {
|
|
39
|
+
* if (half) return <StarHalfIcon fill="current" />
|
|
40
|
+
* if (highlighted) return <StarIcon fill="current" />
|
|
41
|
+
* return <StarIcon />
|
|
42
|
+
* }}
|
|
43
|
+
* </Rating>
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export function Rating(props: RatingProps) {
|
|
47
|
+
const [{ label }, styleProps, rootProps] = splitProps(
|
|
48
|
+
props,
|
|
49
|
+
['label'],
|
|
50
|
+
['orientation', 'palette', 'size'],
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<RatingParts.Root {...styleProps} {...rootProps}>
|
|
55
|
+
<Show when={Boolean(label)}>
|
|
56
|
+
<RatingParts.Label>{label}</RatingParts.Label>
|
|
57
|
+
</Show>
|
|
58
|
+
|
|
59
|
+
<RatingParts.Control>
|
|
60
|
+
<RatingParts.Context>
|
|
61
|
+
{(context: UseRatingGroupContext) =>
|
|
62
|
+
context.items.map((item) => (
|
|
63
|
+
<RatingParts.Item
|
|
64
|
+
key={item}
|
|
65
|
+
index={item}
|
|
66
|
+
palette={styleProps.palette}
|
|
67
|
+
>
|
|
68
|
+
<RatingParts.ItemContext>
|
|
69
|
+
{rootProps.children}
|
|
70
|
+
</RatingParts.ItemContext>
|
|
71
|
+
</RatingParts.Item>
|
|
72
|
+
))
|
|
73
|
+
}
|
|
74
|
+
</RatingParts.Context>
|
|
75
|
+
</RatingParts.Control>
|
|
76
|
+
</RatingParts.Root>
|
|
77
|
+
)
|
|
78
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -50,6 +50,7 @@ export * from './components/NotificationDescription'
|
|
|
50
50
|
export * from './components/Portal'
|
|
51
51
|
export * from './components/ProgressBar'
|
|
52
52
|
export * from './components/radio/index'
|
|
53
|
+
export * from './components/rating/index'
|
|
53
54
|
export * from './components/select/index'
|
|
54
55
|
export * from './components/Show'
|
|
55
56
|
export * from './components/Spinner'
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/checkbox/checkbox.tsx"],"sourcesContent":["import type { CheckboxRootProps } from '@ark-ui/react'\nimport { type CheckboxVariantProps } from '@cerberus/styled-system/recipes'\nimport { Show } from '../Show'\nimport { Text } from '../Text'\nimport { CheckboxParts } from './parts'\nimport { CheckboxIcon } from './checkbox-icon'\n\n/**\n * This module contains the Checkbox component.\n * @module\n */\n\nexport type CheckboxProps = CheckboxVariantProps & CheckboxRootProps\n\n/**\n * Checkbox component is an abstraction of the primitives that displays a\n * controlled checkbox with a label.\n * @description [Cerberus Docs] https://cerberus.digitalu.design/react/checkbox\n * @description [Ark Docs] https://ark-ui.com/docs/components/checkbox\n */\nexport function Checkbox(props: CheckboxProps) {\n const { size, children, ...rootProps } = props\n\n return (\n <CheckboxParts.Root {...rootProps}>\n <CheckboxParts.Control size={size}>\n <CheckboxIcon indeterminate={rootProps.checked === 'indeterminate'} />\n </CheckboxParts.Control>\n\n <CheckboxParts.Label size={size}>\n {children}\n <Show when={props.required}>\n <Text as=\"span\" data-part=\"required-indicator\">\n (required)\n </Text>\n </Show>\n </CheckboxParts.Label>\n\n <CheckboxParts.HiddenInput />\n </CheckboxParts.Root>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;AA0BQ,cAGF,YAHE;AAND,SAAS,SAAS,OAAsB;AAC7C,QAAM,EAAE,MAAM,UAAU,GAAG,UAAU,IAAI;AAEzC,SACE,qBAAC,cAAc,MAAd,EAAoB,GAAG,WACtB;AAAA,wBAAC,cAAc,SAAd,EAAsB,MACrB,8BAAC,gBAAa,eAAe,UAAU,YAAY,iBAAiB,GACtE;AAAA,IAEA,qBAAC,cAAc,OAAd,EAAoB,MAClB;AAAA;AAAA,MACD,oBAAC,QAAK,MAAM,MAAM,UAChB,8BAAC,QAAK,IAAG,QAAO,aAAU,sBAAqB,wBAE/C,GACF;AAAA,OACF;AAAA,IAEA,oBAAC,cAAc,aAAd,EAA0B;AAAA,KAC7B;AAEJ;","names":[]}
|
|
File without changes
|