@cerberus-design/react 1.0.0-rc.5 → 1.0.0-rc.6
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/dist/panda.buildinfo.json +23 -0
- package/package.json +6 -4
- package/src/components/AnimatingUploadIcon.tsx +0 -83
- package/src/components/accordion/index.ts +0 -3
- package/src/components/accordion/item-group.tsx +0 -70
- package/src/components/accordion/item-indicator.tsx +0 -27
- package/src/components/accordion/parts.ts +0 -53
- package/src/components/accordion/primitives.tsx +0 -86
- package/src/components/admonition/admonition.tsx +0 -62
- package/src/components/admonition/index.ts +0 -3
- package/src/components/admonition/match-avatar.tsx +0 -52
- package/src/components/admonition/parts.ts +0 -53
- package/src/components/admonition/primitives.tsx +0 -77
- package/src/components/avatar/avatar.tsx +0 -51
- package/src/components/avatar/index.ts +0 -5
- package/src/components/avatar/parts.ts +0 -37
- package/src/components/avatar/primitives.tsx +0 -38
- package/src/components/button/button.tsx +0 -62
- package/src/components/button/index.ts +0 -3
- package/src/components/button/parts.ts +0 -32
- package/src/components/button/primitives.tsx +0 -41
- package/src/components/carousel/carousel.tsx +0 -55
- package/src/components/carousel/index.ts +0 -3
- package/src/components/carousel/parts.ts +0 -71
- package/src/components/carousel/primitives.ts +0 -58
- package/src/components/checkbox/checkbox-icon.tsx +0 -39
- package/src/components/checkbox/checkbox.tsx +0 -42
- package/src/components/checkbox/index.ts +0 -3
- package/src/components/checkbox/parts.ts +0 -59
- package/src/components/checkbox/primitives.tsx +0 -77
- package/src/components/circular-progress/circular-progress.tsx +0 -49
- package/src/components/circular-progress/index.ts +0 -2
- package/src/components/circular-progress/primitives.ts +0 -80
- package/src/components/clipboard/copy-indicator.tsx +0 -22
- package/src/components/clipboard/copy-text.tsx +0 -13
- package/src/components/clipboard/index.ts +0 -2
- package/src/components/clipboard/parts.ts +0 -74
- package/src/components/clipboard/primitives.ts +0 -56
- package/src/components/clipboard/trigger.tsx +0 -14
- package/src/components/collapsible/index.ts +0 -2
- package/src/components/collapsible/parts.ts +0 -53
- package/src/components/collapsible/primitives.tsx +0 -53
- package/src/components/combobox/combobox.tsx +0 -67
- package/src/components/combobox/index.ts +0 -6
- package/src/components/combobox/item-group.tsx +0 -19
- package/src/components/combobox/item.tsx +0 -30
- package/src/components/combobox/parts.ts +0 -101
- package/src/components/combobox/primitives.tsx +0 -146
- package/src/components/combobox/use-stateful-collection.ts +0 -65
- package/src/components/cta-dialog/context.tsx +0 -38
- package/src/components/cta-dialog/index.ts +0 -2
- package/src/components/cta-dialog/provider.tsx +0 -186
- package/src/components/cta-dialog/trigger-item.tsx +0 -54
- package/src/components/cta-dialog/utils.ts +0 -57
- package/src/components/date-picker/calendar.tsx +0 -47
- package/src/components/date-picker/content.tsx +0 -21
- package/src/components/date-picker/date-picker.tsx +0 -20
- package/src/components/date-picker/day-view.tsx +0 -82
- package/src/components/date-picker/index.ts +0 -16
- package/src/components/date-picker/input.tsx +0 -26
- package/src/components/date-picker/month-view.tsx +0 -49
- package/src/components/date-picker/parts.ts +0 -167
- package/src/components/date-picker/primitives.tsx +0 -235
- package/src/components/date-picker/range-input.tsx +0 -38
- package/src/components/date-picker/trigger.tsx +0 -28
- package/src/components/date-picker/view-control-group.tsx +0 -54
- package/src/components/date-picker/year-view.tsx +0 -47
- package/src/components/dialog/close-icon-trigger.tsx +0 -36
- package/src/components/dialog/dialog.tsx +0 -42
- package/src/components/dialog/index.ts +0 -8
- package/src/components/dialog/parts.ts +0 -71
- package/src/components/dialog/primitives.tsx +0 -83
- package/src/components/feature-flag/feature-flag.tsx +0 -21
- package/src/components/feature-flag/index.ts +0 -1
- package/src/components/field/error-text.tsx +0 -19
- package/src/components/field/field.tsx +0 -93
- package/src/components/field/helper-text.tsx +0 -20
- package/src/components/field/index.ts +0 -7
- package/src/components/field/input.tsx +0 -47
- package/src/components/field/parts.ts +0 -77
- package/src/components/field/primitives.tsx +0 -135
- package/src/components/field/start-indicator.tsx +0 -23
- package/src/components/field/status-indicator.tsx +0 -58
- package/src/components/fieldset/fieldset.tsx +0 -54
- package/src/components/fieldset/index.ts +0 -3
- package/src/components/fieldset/parts.ts +0 -47
- package/src/components/fieldset/primitives.tsx +0 -48
- package/src/components/file-upload/file-status.tsx +0 -271
- package/src/components/file-upload/file-uploader.tsx +0 -60
- package/src/components/file-upload/helpers.ts +0 -28
- package/src/components/file-upload/img-preview.tsx +0 -41
- package/src/components/file-upload/index.ts +0 -6
- package/src/components/file-upload/parts.tsx +0 -132
- package/src/components/file-upload/primitives.ts +0 -161
- package/src/components/file-upload/utils.ts +0 -20
- package/src/components/for/for.tsx +0 -38
- package/src/components/for/index.ts +0 -1
- package/src/components/group/index.ts +0 -1
- package/src/components/group/primitives.ts +0 -7
- package/src/components/icon-button/button.tsx +0 -41
- package/src/components/icon-button/index.tsx +0 -2
- package/src/components/icon-button/primitives.ts +0 -19
- package/src/components/menu/index.ts +0 -2
- package/src/components/menu/menu.tsx +0 -144
- package/src/components/menu/primitives.ts +0 -84
- package/src/components/notifications/center.tsx +0 -88
- package/src/components/notifications/close-trigger.tsx +0 -21
- package/src/components/notifications/index.ts +0 -5
- package/src/components/notifications/match-icon.tsx +0 -41
- package/src/components/notifications/parts.ts +0 -53
- package/src/components/notifications/primitives.tsx +0 -66
- package/src/components/notifications/toaster.ts +0 -13
- package/src/components/notifications/types.ts +0 -44
- package/src/components/number-input/decrement-trigger.tsx +0 -16
- package/src/components/number-input/increment-trigger.tsx +0 -16
- package/src/components/number-input/index.ts +0 -3
- package/src/components/number-input/input.tsx +0 -33
- package/src/components/number-input/parts.ts +0 -65
- package/src/components/number-input/primitives.tsx +0 -74
- package/src/components/pagination/compact.tsx +0 -25
- package/src/components/pagination/index.ts +0 -6
- package/src/components/pagination/item-list.tsx +0 -34
- package/src/components/pagination/item.tsx +0 -6
- package/src/components/pagination/pagination.tsx +0 -53
- package/src/components/pagination/parts.ts +0 -65
- package/src/components/pagination/primitives.ts +0 -41
- package/src/components/pagination/triggers.tsx +0 -55
- package/src/components/pin-input/index.ts +0 -3
- package/src/components/pin-input/input.tsx +0 -22
- package/src/components/pin-input/parts.ts +0 -53
- package/src/components/pin-input/primitives.tsx +0 -46
- package/src/components/portal/index.ts +0 -1
- package/src/components/portal/portal.tsx +0 -28
- package/src/components/progress/index.ts +0 -2
- package/src/components/progress/primitives.ts +0 -37
- package/src/components/progress/progress-bar.tsx +0 -80
- package/src/components/radio/index.ts +0 -3
- package/src/components/radio/parts.ts +0 -65
- package/src/components/radio/primitives.tsx +0 -92
- package/src/components/radio/radio.tsx +0 -35
- package/src/components/rating/index.ts +0 -8
- package/src/components/rating/parts.tsx +0 -65
- package/src/components/rating/primitives.tsx +0 -64
- package/src/components/rating/rating.tsx +0 -75
- package/src/components/select/index.ts +0 -5
- package/src/components/select/option-group.tsx +0 -32
- package/src/components/select/option.tsx +0 -42
- package/src/components/select/parts.ts +0 -113
- package/src/components/select/primitives.tsx +0 -147
- package/src/components/select/select.tsx +0 -110
- package/src/components/show/index.ts +0 -1
- package/src/components/show/show.tsx +0 -48
- package/src/components/spinner/index.ts +0 -1
- package/src/components/spinner/spinner.tsx +0 -81
- package/src/components/split-button/button.tsx +0 -63
- package/src/components/split-button/index.tsx +0 -1
- package/src/components/switch/index.ts +0 -3
- package/src/components/switch/parts.ts +0 -53
- package/src/components/switch/primitives.tsx +0 -51
- package/src/components/switch/switch-indicator.tsx +0 -9
- package/src/components/switch/switch.tsx +0 -27
- package/src/components/table/index.ts +0 -3
- package/src/components/table/parts.ts +0 -83
- package/src/components/table/primitives.tsx +0 -115
- package/src/components/table/table.tsx +0 -73
- package/src/components/tabs/index.ts +0 -3
- package/src/components/tabs/parts.ts +0 -53
- package/src/components/tabs/primitives.tsx +0 -47
- package/src/components/tabs/tabs.tsx +0 -48
- package/src/components/tag/closable.tsx +0 -47
- package/src/components/tag/index.ts +0 -2
- package/src/components/tag/primitives.ts +0 -19
- package/src/components/tag/tag.tsx +0 -39
- package/src/components/text/index.ts +0 -1
- package/src/components/text/text.tsx +0 -55
- package/src/components/theme/index.ts +0 -1
- package/src/components/theme/theme.tsx +0 -34
- package/src/components/toggle/index.ts +0 -2
- package/src/components/toggle/parts.ts +0 -32
- package/src/components/toggle/primitives.tsx +0 -27
- package/src/components/tooltip/index.ts +0 -3
- package/src/components/tooltip/parts.ts +0 -59
- package/src/components/tooltip/primitives.ts +0 -56
- package/src/components/tooltip/tooltip.tsx +0 -46
- package/src/config/defineIcons.ts +0 -24
- package/src/config/icons/checkbox.icons.tsx +0 -98
- package/src/config/icons/default.ts +0 -69
- package/src/config/icons/pinned.icons.tsx +0 -31
- package/src/config/icons/sort.icons.tsx +0 -19
- package/src/config/index.ts +0 -41
- package/src/config/types.ts +0 -53
- package/src/context/cerberus.tsx +0 -53
- package/src/context/confirm-modal.tsx +0 -276
- package/src/context/feature-flags.tsx +0 -63
- package/src/context/field.tsx +0 -70
- package/src/context/navMenu.tsx +0 -89
- package/src/context/prompt-modal.tsx +0 -315
- package/src/context/theme.tsx +0 -83
- package/src/hooks/useModal.ts +0 -63
- package/src/hooks/useRootColors.ts +0 -72
- package/src/hooks/useTheme.ts +0 -121
- package/src/index.client.ts +0 -30
- package/src/index.ts +0 -76
- package/src/system/factory.ts +0 -32
- package/src/system/index.ts +0 -47
- package/src/system/primitive-factory.tsx +0 -180
- package/src/system/types.ts +0 -88
- package/src/types.ts +0 -23
- package/src/utils/index.ts +0 -51
- package/src/utils/localStorage.ts +0 -28
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react'
|
|
2
|
-
import { Show } from '../show/index'
|
|
3
|
-
import { AvatarParts } from './parts'
|
|
4
|
-
import type { AvatarRootProps } from './primitives'
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* This module provides an abstraction of the Avatar primitives.
|
|
8
|
-
* @module 'avatar'
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
export type AvatarWithoutImage = {
|
|
12
|
-
alt?: never
|
|
13
|
-
src?: never
|
|
14
|
-
fallback: ReactNode
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export type AvatarWithImage = {
|
|
18
|
-
alt: string
|
|
19
|
-
src: string
|
|
20
|
-
fallback?: ReactNode
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export type AvatarProps = AvatarRootProps &
|
|
24
|
-
(AvatarWithoutImage | AvatarWithImage)
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Avatar component is an abstraction of the primitives that displays a
|
|
28
|
-
* avatar or it's fallback when the image fails to load.
|
|
29
|
-
* @description [Cerberus Docs](https://cerberus.digitalu.design/react/avatar/overview)
|
|
30
|
-
* @description [Ark Docs](https://ark-ui.com/react/docs/components/avatar#api-reference)
|
|
31
|
-
*/
|
|
32
|
-
export function Avatar(props: AvatarProps) {
|
|
33
|
-
const { alt, src, fallback, children, ...rootProps } = props
|
|
34
|
-
const imgProps = { alt, src }
|
|
35
|
-
|
|
36
|
-
return (
|
|
37
|
-
<AvatarParts.Root {...rootProps}>
|
|
38
|
-
<Show
|
|
39
|
-
when={children}
|
|
40
|
-
fallback={
|
|
41
|
-
<>
|
|
42
|
-
<AvatarParts.Fallback>{fallback}</AvatarParts.Fallback>
|
|
43
|
-
<AvatarParts.Image {...imgProps} />
|
|
44
|
-
</>
|
|
45
|
-
}
|
|
46
|
-
>
|
|
47
|
-
{children}
|
|
48
|
-
</Show>
|
|
49
|
-
</AvatarParts.Root>
|
|
50
|
-
)
|
|
51
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { ElementType } from 'react'
|
|
2
|
-
import { AvatarFallback, AvatarImage, AvatarRoot } from './primitives'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* This module contains the parts of the Avatar component.
|
|
6
|
-
* @module 'avatar/parts'
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
interface AvatarPartsValue {
|
|
10
|
-
/**
|
|
11
|
-
* The context provider of the Avatar.
|
|
12
|
-
*/
|
|
13
|
-
Root: ElementType
|
|
14
|
-
/**
|
|
15
|
-
* The image of the Avatar.
|
|
16
|
-
*/
|
|
17
|
-
Image: ElementType
|
|
18
|
-
/**
|
|
19
|
-
* The fallback content to display when the image fails to load.
|
|
20
|
-
*/
|
|
21
|
-
Fallback: ElementType
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* An Object containing the parts of the Accordion component. For users that
|
|
26
|
-
* prefer Object component syntax.
|
|
27
|
-
*
|
|
28
|
-
* @remarks
|
|
29
|
-
*
|
|
30
|
-
* When using object component syntax, you import the AvatarParts object and
|
|
31
|
-
* the entire family of components vs. only what you use.
|
|
32
|
-
*/
|
|
33
|
-
export const AvatarParts: AvatarPartsValue = {
|
|
34
|
-
Root: AvatarRoot,
|
|
35
|
-
Image: AvatarImage,
|
|
36
|
-
Fallback: AvatarFallback,
|
|
37
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Avatar,
|
|
3
|
-
type AvatarFallbackProps as ArkAvatarFallbackProps,
|
|
4
|
-
type AvatarImageProps as ArkAvatarImageProps,
|
|
5
|
-
type AvatarRootProps as ArkAvatarRootProps,
|
|
6
|
-
} from '@ark-ui/react/avatar'
|
|
7
|
-
import { avatar, type AvatarVariantProps } from 'styled-system/recipes'
|
|
8
|
-
import {
|
|
9
|
-
createCerberusPrimitive,
|
|
10
|
-
type CerberusPrimitiveProps,
|
|
11
|
-
} from '../../system/index'
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* This module provides the primitive components for the Avatar component.
|
|
15
|
-
* @module 'avatar/primitives'
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
const { withSlotRecipe } = createCerberusPrimitive(avatar)
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* The root component of the Avatar.
|
|
22
|
-
*/
|
|
23
|
-
export const AvatarRoot = withSlotRecipe(Avatar.Root, 'root')
|
|
24
|
-
export type AvatarRootProps = CerberusPrimitiveProps<
|
|
25
|
-
ArkAvatarRootProps & AvatarVariantProps
|
|
26
|
-
>
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* The image component of the Avatar.
|
|
30
|
-
*/
|
|
31
|
-
export const AvatarImage = withSlotRecipe(Avatar.Image, 'image')
|
|
32
|
-
export type AvatarImageProps = CerberusPrimitiveProps<ArkAvatarImageProps>
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* The fallback component of the Avatar.
|
|
36
|
-
*/
|
|
37
|
-
export const AvatarFallback = withSlotRecipe(Avatar.Fallback, 'fallback')
|
|
38
|
-
export type AvatarFallbackProps = CerberusPrimitiveProps<ArkAvatarFallbackProps>
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
import { createContext, useContext, useMemo } from 'react'
|
|
4
|
-
import { Box } from 'styled-system/jsx'
|
|
5
|
-
import type { CerberusProps } from '../../system/types'
|
|
6
|
-
import { Show } from '../show/index'
|
|
7
|
-
import { Spinner } from '../spinner/index'
|
|
8
|
-
import { ButtonRoot, ButtonRootProps } from './primitives'
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* This module contains the Button component.
|
|
12
|
-
* @module
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
interface ButtonContextValue {
|
|
16
|
-
pending: boolean
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const ButtonContext = createContext<ButtonContextValue>({
|
|
20
|
-
pending: false,
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
export interface ButtonProps extends ButtonRootProps {
|
|
24
|
-
/**
|
|
25
|
-
* If true, the button will show a loading spinner.
|
|
26
|
-
*/
|
|
27
|
-
pending?: boolean
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* A component that allows the user to perform actions
|
|
32
|
-
* @see https://cerberus.digitalu.design/react/button
|
|
33
|
-
*/
|
|
34
|
-
export function Button(props: ButtonProps) {
|
|
35
|
-
const { pending = false, ...nativeProps } = props
|
|
36
|
-
const value = useMemo(() => ({ pending }), [pending])
|
|
37
|
-
return (
|
|
38
|
-
<ButtonContext.Provider value={value}>
|
|
39
|
-
<ButtonRoot
|
|
40
|
-
{...nativeProps}
|
|
41
|
-
data-scope="button"
|
|
42
|
-
data-part="root"
|
|
43
|
-
disabled={pending || props.disabled}
|
|
44
|
-
/>
|
|
45
|
-
</ButtonContext.Provider>
|
|
46
|
-
)
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* An icon to display in a button that utilizes the pending state to display
|
|
51
|
-
* a loading spinner.
|
|
52
|
-
*/
|
|
53
|
-
export function ButtonIcon(props: CerberusProps<'div'>) {
|
|
54
|
-
const { pending } = useContext(ButtonContext)
|
|
55
|
-
return (
|
|
56
|
-
<Show when={pending} fallback={<>{props.children}</>}>
|
|
57
|
-
<Box data-scope="button" data-part="button-spinner" w="4">
|
|
58
|
-
<Spinner />
|
|
59
|
-
</Box>
|
|
60
|
-
</Show>
|
|
61
|
-
)
|
|
62
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { ElementType } from 'react'
|
|
2
|
-
import { Button, ButtonIcon } from './button'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* This module contains the parts of the Button component.
|
|
6
|
-
* @module 'button/parts'
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
interface ButtonPartsValue {
|
|
10
|
-
/**
|
|
11
|
-
* The context provider of the button.
|
|
12
|
-
*/
|
|
13
|
-
Root: ElementType
|
|
14
|
-
/**
|
|
15
|
-
* The icon of the button.
|
|
16
|
-
*/
|
|
17
|
-
Icon: ElementType
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* An Object containing the parts of the Button component. For users that
|
|
22
|
-
* prefer Object component syntax.
|
|
23
|
-
*
|
|
24
|
-
* @remarks
|
|
25
|
-
*
|
|
26
|
-
* When using object component syntax, you import the ButtonParts object and
|
|
27
|
-
* the entire family of components vs. only what you use.
|
|
28
|
-
*/
|
|
29
|
-
export const ButtonParts: ButtonPartsValue = {
|
|
30
|
-
Root: Button,
|
|
31
|
-
Icon: ButtonIcon,
|
|
32
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { ark } from '@ark-ui/react/factory'
|
|
2
|
-
import type { HTMLAttributes } from 'react'
|
|
3
|
-
import {
|
|
4
|
-
button,
|
|
5
|
-
buttonGroup,
|
|
6
|
-
ButtonVariantProps,
|
|
7
|
-
type ButtonGroupVariantProps,
|
|
8
|
-
} from 'styled-system/recipes'
|
|
9
|
-
import {
|
|
10
|
-
createCerberusPrimitive,
|
|
11
|
-
type CerberusPrimitiveProps,
|
|
12
|
-
} from '../../system/index'
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* This module contains the Button component primitives.
|
|
16
|
-
* @module @cerberus-design/react/components/button/primitives
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
const { withRecipe } = createCerberusPrimitive(button)
|
|
20
|
-
const { withRecipe: withGroupRecipe } = createCerberusPrimitive(buttonGroup)
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* The root element of the Button component.
|
|
24
|
-
*/
|
|
25
|
-
export const ButtonRoot = withRecipe(ark.button)
|
|
26
|
-
export type ButtonRootProps = CerberusPrimitiveProps<
|
|
27
|
-
HTMLAttributes<HTMLButtonElement> & ButtonVariantProps
|
|
28
|
-
>
|
|
29
|
-
|
|
30
|
-
const ButtonGroupEl = withGroupRecipe(ark.div)
|
|
31
|
-
export type ButtonGroupProps = CerberusPrimitiveProps<
|
|
32
|
-
HTMLAttributes<HTMLDivElement> & ButtonGroupVariantProps
|
|
33
|
-
>
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* The ButtonGroup component is a wrapper that groups multiple Button
|
|
37
|
-
* components together.
|
|
38
|
-
*/
|
|
39
|
-
export function ButtonGroup(props: ButtonGroupProps) {
|
|
40
|
-
return <ButtonGroupEl {...props} />
|
|
41
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import type { PropsWithChildren } from 'react'
|
|
2
|
-
import { Show } from '../show/show'
|
|
3
|
-
import { For } from '../for/for'
|
|
4
|
-
import { CarouselParts } from './parts'
|
|
5
|
-
import type { CarouselRootProps } from './primitives'
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* This module contains an abstraction of the carousel family of components.
|
|
9
|
-
* @module carousel
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
export interface CarouselProps extends CarouselRootProps {
|
|
13
|
-
/**
|
|
14
|
-
* Whether to show the carousel indicators (dot list).
|
|
15
|
-
* @default false
|
|
16
|
-
*/
|
|
17
|
-
showIndicators?: boolean
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* The Carousel component is an abstraction of the carousel family of
|
|
22
|
-
* components. It provides a simple interface for creating carousels with
|
|
23
|
-
* various configurations.
|
|
24
|
-
*
|
|
25
|
-
* @remarks
|
|
26
|
-
* This component uses the `CarouselParts` object to provide the necessary
|
|
27
|
-
* parts. For customization, we recommend using the `CarouselParts` object
|
|
28
|
-
* directly in combination with the `css` prop.
|
|
29
|
-
*/
|
|
30
|
-
function CarouselEl(props: PropsWithChildren<CarouselProps>) {
|
|
31
|
-
const { showIndicators = false, children, ...rootProps } = props
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<CarouselParts.Root {...rootProps}>
|
|
35
|
-
{children}
|
|
36
|
-
|
|
37
|
-
<Show when={showIndicators}>
|
|
38
|
-
<CarouselParts.IndicatorGroup>
|
|
39
|
-
<For each={Array.from({ length: props.slideCount ?? 0 })}>
|
|
40
|
-
{(_, idx) => <CarouselParts.Indicator key={idx} index={idx} />}
|
|
41
|
-
</For>
|
|
42
|
-
</CarouselParts.IndicatorGroup>
|
|
43
|
-
</Show>
|
|
44
|
-
</CarouselParts.Root>
|
|
45
|
-
)
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export const Carousel = {
|
|
49
|
-
Root: CarouselEl,
|
|
50
|
-
ItemGroup: CarouselParts.ItemGroup,
|
|
51
|
-
Item: CarouselParts.Item,
|
|
52
|
-
Control: CarouselParts.Control,
|
|
53
|
-
PrevTrigger: CarouselParts.PrevTrigger,
|
|
54
|
-
NextTrigger: CarouselParts.NextTrigger,
|
|
55
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import type { ElementType } from 'react'
|
|
2
|
-
import {
|
|
3
|
-
CarouselRoot,
|
|
4
|
-
CarouselControl,
|
|
5
|
-
CarouselPrevTrigger,
|
|
6
|
-
CarouselNextTrigger,
|
|
7
|
-
CarouselIndicatorGroup,
|
|
8
|
-
CarouselIndicator,
|
|
9
|
-
CarouselItemGroup,
|
|
10
|
-
CarouselItem,
|
|
11
|
-
} from './primitives'
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* This module contains the parts of the Carousel component.
|
|
15
|
-
* @module 'carousel/parts'
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
interface CarouselPartsValue {
|
|
19
|
-
/**
|
|
20
|
-
* The context provider of the carousel.
|
|
21
|
-
*/
|
|
22
|
-
Root: ElementType
|
|
23
|
-
/**
|
|
24
|
-
* The control of the carousel.
|
|
25
|
-
*/
|
|
26
|
-
Control: ElementType
|
|
27
|
-
/**
|
|
28
|
-
* The previous trigger of the carousel.
|
|
29
|
-
*/
|
|
30
|
-
PrevTrigger: ElementType
|
|
31
|
-
/**
|
|
32
|
-
* The next trigger of the carousel.
|
|
33
|
-
*/
|
|
34
|
-
NextTrigger: ElementType
|
|
35
|
-
/**
|
|
36
|
-
* The indicator group of the carousel.
|
|
37
|
-
*/
|
|
38
|
-
IndicatorGroup: ElementType
|
|
39
|
-
/**
|
|
40
|
-
* The indicator of the carousel.
|
|
41
|
-
*/
|
|
42
|
-
Indicator: ElementType
|
|
43
|
-
/**
|
|
44
|
-
* The item group of the carousel.
|
|
45
|
-
*/
|
|
46
|
-
ItemGroup: ElementType
|
|
47
|
-
/**
|
|
48
|
-
* The item of the carousel.
|
|
49
|
-
*/
|
|
50
|
-
Item: ElementType
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* An Object containing the parts of the Button component. For users that
|
|
55
|
-
* prefer Object component syntax.
|
|
56
|
-
*
|
|
57
|
-
* @remarks
|
|
58
|
-
*
|
|
59
|
-
* When using object component syntax, you import the CarouselParts object and
|
|
60
|
-
* the entire family of components vs. only what you use.
|
|
61
|
-
*/
|
|
62
|
-
export const CarouselParts: CarouselPartsValue = {
|
|
63
|
-
Root: CarouselRoot,
|
|
64
|
-
Control: CarouselControl,
|
|
65
|
-
PrevTrigger: CarouselPrevTrigger,
|
|
66
|
-
NextTrigger: CarouselNextTrigger,
|
|
67
|
-
IndicatorGroup: CarouselIndicatorGroup,
|
|
68
|
-
Indicator: CarouselIndicator,
|
|
69
|
-
ItemGroup: CarouselItemGroup,
|
|
70
|
-
Item: CarouselItem,
|
|
71
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Carousel,
|
|
3
|
-
type CarouselRootProps as ArkRootProps,
|
|
4
|
-
type CarouselControlProps as ArkControlProps,
|
|
5
|
-
type CarouselPrevTriggerProps as ArkPrevTriggerProps,
|
|
6
|
-
type CarouselNextTriggerProps as ArkNextTriggerProps,
|
|
7
|
-
type CarouselIndicatorGroupProps as ArkIndicatorGroupProps,
|
|
8
|
-
type CarouselIndicatorProps as ArkIndicatorProps,
|
|
9
|
-
type CarouselItemGroupProps as ArkItemGroupProps,
|
|
10
|
-
type CarouselItemProps as ArkItemProps,
|
|
11
|
-
} from '@ark-ui/react/carousel'
|
|
12
|
-
import { carousel, type CarouselVariantProps } from 'styled-system/recipes'
|
|
13
|
-
import { createCerberusPrimitive } from '../../system/index'
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* This module contains the carousel primitives.
|
|
17
|
-
* @module carousel/primitives
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
const { withSlotRecipe } = createCerberusPrimitive(carousel)
|
|
21
|
-
|
|
22
|
-
// Primitives
|
|
23
|
-
|
|
24
|
-
export type CarouselRootProps = CarouselVariantProps & ArkRootProps
|
|
25
|
-
export const CarouselRoot = withSlotRecipe(Carousel.Root, 'root')
|
|
26
|
-
|
|
27
|
-
export type CarouselControlProps = CarouselVariantProps & ArkControlProps
|
|
28
|
-
export const CarouselControl = withSlotRecipe(Carousel.Control, 'control')
|
|
29
|
-
|
|
30
|
-
export type CarouselPrevTriggerProps = CarouselVariantProps &
|
|
31
|
-
ArkPrevTriggerProps
|
|
32
|
-
export const CarouselPrevTrigger = withSlotRecipe(
|
|
33
|
-
Carousel.PrevTrigger,
|
|
34
|
-
'prevTrigger',
|
|
35
|
-
)
|
|
36
|
-
|
|
37
|
-
export type CarouselNextTriggerProps = CarouselVariantProps &
|
|
38
|
-
ArkNextTriggerProps
|
|
39
|
-
export const CarouselNextTrigger = withSlotRecipe(
|
|
40
|
-
Carousel.NextTrigger,
|
|
41
|
-
'nextTrigger',
|
|
42
|
-
)
|
|
43
|
-
|
|
44
|
-
export type CarouselIndicatorGroupProps = CarouselVariantProps &
|
|
45
|
-
ArkIndicatorGroupProps
|
|
46
|
-
export const CarouselIndicatorGroup = withSlotRecipe(
|
|
47
|
-
Carousel.IndicatorGroup,
|
|
48
|
-
'indicatorGroup',
|
|
49
|
-
)
|
|
50
|
-
|
|
51
|
-
export type CarouselIndicatorProps = CarouselVariantProps & ArkIndicatorProps
|
|
52
|
-
export const CarouselIndicator = withSlotRecipe(Carousel.Indicator, 'indicator')
|
|
53
|
-
|
|
54
|
-
export type CarouselItemGroupProps = CarouselVariantProps & ArkItemGroupProps
|
|
55
|
-
export const CarouselItemGroup = withSlotRecipe(Carousel.ItemGroup, 'itemGroup')
|
|
56
|
-
|
|
57
|
-
export type CarouselItemProps = CarouselVariantProps & ArkItemProps
|
|
58
|
-
export const CarouselItem = withSlotRecipe(Carousel.Item, 'item')
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
import { useCerberusContext } from '../../context/cerberus'
|
|
4
|
-
import { Show } from '../show/index'
|
|
5
|
-
import { CheckboxParts } from './parts'
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* This module contains the Checkbox Icon component.
|
|
9
|
-
* @module
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
interface CheckboxIconProps {
|
|
13
|
-
indeterminate?: boolean
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Checkbox component
|
|
18
|
-
* @definition [ARIA Target Size](https://www.w3.org/WAI/WCAG21/Understanding/target-size.html#:~:text=Understanding%20SC%202.5.,%3ATarget%20Size%20(Level%20AAA)&text=The%20size%20of%20the%20target,Equivalent)
|
|
19
|
-
* @definition [ARIA Forms](https://www.a11yproject.com/checklist/#forms)
|
|
20
|
-
* @see https://cerberus.digitalu.design/react/checkbox
|
|
21
|
-
* @example
|
|
22
|
-
* ```tsx
|
|
23
|
-
* <Field>
|
|
24
|
-
* <Checkbox id="legal" checked={checked.legal} onChange={handleChange} />
|
|
25
|
-
* </Field>
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
export function CheckboxIcon(props: CheckboxIconProps) {
|
|
29
|
-
const { icons } = useCerberusContext()
|
|
30
|
-
const { checkbox: CheckIcon, indeterminate: IndeterminateIcon } = icons
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<CheckboxParts.Indicator indeterminate={props.indeterminate}>
|
|
34
|
-
<Show when={props.indeterminate} fallback={<CheckIcon />}>
|
|
35
|
-
<IndeterminateIcon />
|
|
36
|
-
</Show>
|
|
37
|
-
</CheckboxParts.Indicator>
|
|
38
|
-
)
|
|
39
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { CheckboxRootProps } from '@ark-ui/react'
|
|
2
|
-
import { type CheckboxVariantProps } from 'styled-system/recipes'
|
|
3
|
-
import { Show } from '../show/index'
|
|
4
|
-
import { Text } from '../text/index'
|
|
5
|
-
import { CheckboxParts } from './parts'
|
|
6
|
-
import { CheckboxIcon } from './checkbox-icon'
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* This module contains the Checkbox component.
|
|
10
|
-
* @module
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
export type CheckboxProps = CheckboxVariantProps & CheckboxRootProps
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Checkbox component is an abstraction of the primitives that displays a
|
|
17
|
-
* controlled checkbox with a label.
|
|
18
|
-
* @description [Cerberus Docs](https://cerberus.digitalu.design/react/checkbox)
|
|
19
|
-
* @description [Ark Docs](https://ark-ui.com/docs/components/checkbox)
|
|
20
|
-
*/
|
|
21
|
-
export function Checkbox(props: CheckboxProps) {
|
|
22
|
-
const { size, children, ...rootProps } = props
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<CheckboxParts.Root {...rootProps}>
|
|
26
|
-
<CheckboxParts.Control size={size}>
|
|
27
|
-
<CheckboxIcon indeterminate={rootProps.checked === 'indeterminate'} />
|
|
28
|
-
</CheckboxParts.Control>
|
|
29
|
-
|
|
30
|
-
<CheckboxParts.Label size={size}>
|
|
31
|
-
{children}
|
|
32
|
-
<Show when={props.required}>
|
|
33
|
-
<Text as="span" data-part="required-indicator">
|
|
34
|
-
(required)
|
|
35
|
-
</Text>
|
|
36
|
-
</Show>
|
|
37
|
-
</CheckboxParts.Label>
|
|
38
|
-
|
|
39
|
-
<CheckboxParts.HiddenInput />
|
|
40
|
-
</CheckboxParts.Root>
|
|
41
|
-
)
|
|
42
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import type { ElementType } from 'react'
|
|
2
|
-
import {
|
|
3
|
-
CheckboxRoot,
|
|
4
|
-
CheckboxLabel,
|
|
5
|
-
CheckboxControl,
|
|
6
|
-
CheckboxIndicator,
|
|
7
|
-
CheckboxHiddenInput,
|
|
8
|
-
CheckboxGroup,
|
|
9
|
-
} from './primitives'
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* This module contains the parts of the Field component.
|
|
13
|
-
* @module 'field/parts'
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
interface CheckboxPartsValue {
|
|
17
|
-
/**
|
|
18
|
-
* The container of the field.
|
|
19
|
-
*/
|
|
20
|
-
Root: ElementType
|
|
21
|
-
/**
|
|
22
|
-
* The label of the field.
|
|
23
|
-
*/
|
|
24
|
-
Label: ElementType
|
|
25
|
-
/**
|
|
26
|
-
* The control of the field.
|
|
27
|
-
*/
|
|
28
|
-
Control: ElementType
|
|
29
|
-
/**
|
|
30
|
-
* The indicator of the field.
|
|
31
|
-
*/
|
|
32
|
-
Indicator: ElementType
|
|
33
|
-
/**
|
|
34
|
-
* The hidden input of the field.
|
|
35
|
-
*/
|
|
36
|
-
HiddenInput: ElementType
|
|
37
|
-
/**
|
|
38
|
-
* The checkbox group component.
|
|
39
|
-
*/
|
|
40
|
-
Group: ElementType
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* An Object containing the parts of the Checkbox component. For users that
|
|
45
|
-
* prefer Object component syntax.
|
|
46
|
-
*
|
|
47
|
-
* @remarks
|
|
48
|
-
*
|
|
49
|
-
* When using object component syntax, you import the CheckboxParts object and
|
|
50
|
-
* the entire family of components vs. only what you use.
|
|
51
|
-
*/
|
|
52
|
-
export const CheckboxParts: CheckboxPartsValue = {
|
|
53
|
-
Root: CheckboxRoot,
|
|
54
|
-
Label: CheckboxLabel,
|
|
55
|
-
Control: CheckboxControl,
|
|
56
|
-
Indicator: CheckboxIndicator,
|
|
57
|
-
HiddenInput: CheckboxHiddenInput,
|
|
58
|
-
Group: CheckboxGroup,
|
|
59
|
-
}
|