@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
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": "1.9.0",
|
|
3
|
+
"styles": {
|
|
4
|
+
"atomic": [
|
|
5
|
+
"width]___[value:1/2",
|
|
6
|
+
"position]___[value:relative",
|
|
7
|
+
"display]___[value:flex",
|
|
8
|
+
"alignItems]___[value:center",
|
|
9
|
+
"justifyContent]___[value:flex-start",
|
|
10
|
+
"gap]___[value:xs",
|
|
11
|
+
"flexDirection]___[value:row",
|
|
12
|
+
"marginBlockEnd]___[value:xs",
|
|
13
|
+
"textStyle]___[value:label-md",
|
|
14
|
+
"width]___[value:initial",
|
|
15
|
+
"height]___[value:2rem",
|
|
16
|
+
"paddingInline]___[value:md",
|
|
17
|
+
"srOnly]___[value:true",
|
|
18
|
+
"gap]___[value:8px",
|
|
19
|
+
"color]___[value:page.text.100"
|
|
20
|
+
],
|
|
21
|
+
"recipes": {}
|
|
22
|
+
}
|
|
23
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cerberus-design/react",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.6",
|
|
4
4
|
"description": "The Cerberus Design React component library.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"css",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"files": [
|
|
23
23
|
"dist",
|
|
24
|
-
"
|
|
24
|
+
"package.json"
|
|
25
25
|
],
|
|
26
26
|
"type": "module",
|
|
27
27
|
"sideEffects": false,
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@internationalized/date": "^3.11.0",
|
|
39
|
+
"@pandacss/dev": "^1.9.0",
|
|
39
40
|
"@types/react": "^19.2.14",
|
|
40
41
|
"@types/react-dom": "^19.2.3",
|
|
41
42
|
"@vitejs/plugin-react": "^5.1.2",
|
|
@@ -47,13 +48,14 @@
|
|
|
47
48
|
"styled-system": "0.0.0"
|
|
48
49
|
},
|
|
49
50
|
"peerDependencies": {
|
|
50
|
-
"@pandacss/dev": "^1.
|
|
51
|
+
"@pandacss/dev": "^1.9.0",
|
|
51
52
|
"react": "*",
|
|
52
53
|
"react-dom": "*"
|
|
53
54
|
},
|
|
54
55
|
"browserslist": "> 0.25%, not dead",
|
|
55
56
|
"scripts": {
|
|
56
|
-
"
|
|
57
|
+
"generate:info": "pnpm panda ship --outfile dist/panda.buildinfo.json",
|
|
58
|
+
"build": "vite build && pnpm generate:info",
|
|
57
59
|
"clean": "rm -rf ./dist",
|
|
58
60
|
"lint:ts": "tsc --project tsconfig.lint.json --noEmit"
|
|
59
61
|
},
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This module contains an animating icon to use for the FileStatus component.
|
|
3
|
-
* @module
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export interface AnimatingUploadIconProps {
|
|
7
|
-
size?: 16 | 20 | 24 | 32
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function AnimatingUploadIcon(props: AnimatingUploadIconProps) {
|
|
11
|
-
return (
|
|
12
|
-
<svg
|
|
13
|
-
aria-hidden="true"
|
|
14
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
15
|
-
width={props.size ?? '1em'}
|
|
16
|
-
height={props.size ?? '1em'}
|
|
17
|
-
viewBox="0 0 24 24"
|
|
18
|
-
>
|
|
19
|
-
<g
|
|
20
|
-
fill="none"
|
|
21
|
-
stroke="currentColor"
|
|
22
|
-
strokeLinecap="square"
|
|
23
|
-
strokeLinejoin="round"
|
|
24
|
-
strokeWidth={1.5}
|
|
25
|
-
>
|
|
26
|
-
<path
|
|
27
|
-
data-name="animating-trail"
|
|
28
|
-
strokeDasharray="2 4"
|
|
29
|
-
strokeDashoffset={6}
|
|
30
|
-
d="M12 21c-4.97 0 -9 -4.03 -9 -9c0 -4.97 4.03 -9 9 -9"
|
|
31
|
-
>
|
|
32
|
-
<animate
|
|
33
|
-
attributeName="stroke-dashoffset"
|
|
34
|
-
dur="0.45s"
|
|
35
|
-
repeatCount="indefinite"
|
|
36
|
-
values="6;0"
|
|
37
|
-
></animate>
|
|
38
|
-
</path>
|
|
39
|
-
|
|
40
|
-
<path
|
|
41
|
-
data-name="half-circle"
|
|
42
|
-
strokeDasharray={32}
|
|
43
|
-
strokeDashoffset={32}
|
|
44
|
-
d="M12 3c4.97 0 9 4.03 9 9c0 4.97 -4.03 9 -9 9"
|
|
45
|
-
>
|
|
46
|
-
<animate
|
|
47
|
-
fill="freeze"
|
|
48
|
-
attributeName="stroke-dashoffset"
|
|
49
|
-
begin="0.075s"
|
|
50
|
-
dur="0.3s"
|
|
51
|
-
values="32;0"
|
|
52
|
-
></animate>
|
|
53
|
-
</path>
|
|
54
|
-
|
|
55
|
-
<svg
|
|
56
|
-
aria-hidden="true"
|
|
57
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
58
|
-
width="1.1em"
|
|
59
|
-
height="1.1em"
|
|
60
|
-
x="27%"
|
|
61
|
-
y="27%"
|
|
62
|
-
viewBox="0 0 24 24"
|
|
63
|
-
>
|
|
64
|
-
<polygon
|
|
65
|
-
fill="currentColor"
|
|
66
|
-
stroke="currentColor"
|
|
67
|
-
strokeWidth={0.8}
|
|
68
|
-
opacity="1"
|
|
69
|
-
points="3.7,6.7 7.5,2.9 7.5,15 8.5,15 8.5,2.9 12.3,6.7 13,6 8,1 3,6 "
|
|
70
|
-
>
|
|
71
|
-
<animate
|
|
72
|
-
fill="freeze"
|
|
73
|
-
attributeName="opacity"
|
|
74
|
-
values="1;0;1"
|
|
75
|
-
dur="2s"
|
|
76
|
-
repeatCount="indefinite"
|
|
77
|
-
></animate>
|
|
78
|
-
</polygon>
|
|
79
|
-
</svg>
|
|
80
|
-
</g>
|
|
81
|
-
</svg>
|
|
82
|
-
)
|
|
83
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
AccordionItemProps,
|
|
3
|
-
AccordionRootProps,
|
|
4
|
-
} from '@ark-ui/react/accordion'
|
|
5
|
-
import { type AccordionVariantProps } from 'styled-system/recipes'
|
|
6
|
-
import { splitProps } from '../../utils/index'
|
|
7
|
-
import { Show } from '../show/index'
|
|
8
|
-
import { AccordionParts } from './parts'
|
|
9
|
-
import { AccordionChevronItemIndicator } from './item-indicator'
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* This module contains an abstraction of the AccordionItem components.
|
|
13
|
-
* @module
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
export function Accordion(props: AccordionRootProps & AccordionVariantProps) {
|
|
17
|
-
return <AccordionParts.Root {...props} />
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface AccordionItemGroupProps
|
|
21
|
-
extends AccordionItemProps,
|
|
22
|
-
AccordionVariantProps {
|
|
23
|
-
/**
|
|
24
|
-
* The heading of the accordion item to open and close the content.
|
|
25
|
-
*/
|
|
26
|
-
heading: string
|
|
27
|
-
/**
|
|
28
|
-
* The position of the arrow indicator.
|
|
29
|
-
*/
|
|
30
|
-
indicatorPosition?: 'start' | 'end'
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* The AccordionItemGroup component is an abstraction of the Accordion primitive
|
|
35
|
-
* components which renders an accordion item with a heading and an indicator.
|
|
36
|
-
*
|
|
37
|
-
* It is a wrapper around the `AccordionParts.Item`, `AccordionParts.
|
|
38
|
-
* ItemTrigger`, `AccordionParts.ItemIndicator`, and `AccordionParts.ItemContent` components.
|
|
39
|
-
*
|
|
40
|
-
* @description [Cerberus docs](https://cerberus.digitalu.design/react/accordion)
|
|
41
|
-
* @description [Ark docs](https://ark-ui.com/react/docs/components/accordion)
|
|
42
|
-
*/
|
|
43
|
-
export function AccordionItemGroup(props: AccordionItemGroupProps) {
|
|
44
|
-
const [groupProps, itemProps] = splitProps(props, [
|
|
45
|
-
'heading',
|
|
46
|
-
'children',
|
|
47
|
-
'indicatorPosition',
|
|
48
|
-
])
|
|
49
|
-
const indicatorPosition = groupProps.indicatorPosition ?? 'end'
|
|
50
|
-
|
|
51
|
-
return (
|
|
52
|
-
<AccordionParts.Item {...itemProps}>
|
|
53
|
-
<AccordionParts.ItemTrigger data-indicator-position={indicatorPosition}>
|
|
54
|
-
<Show when={indicatorPosition === 'start'}>
|
|
55
|
-
<AccordionChevronItemIndicator />
|
|
56
|
-
</Show>
|
|
57
|
-
|
|
58
|
-
{groupProps.heading}
|
|
59
|
-
|
|
60
|
-
<Show when={indicatorPosition === 'end'}>
|
|
61
|
-
<AccordionChevronItemIndicator />
|
|
62
|
-
</Show>
|
|
63
|
-
</AccordionParts.ItemTrigger>
|
|
64
|
-
|
|
65
|
-
<AccordionParts.ItemContent>
|
|
66
|
-
{groupProps.children}
|
|
67
|
-
</AccordionParts.ItemContent>
|
|
68
|
-
</AccordionParts.Item>
|
|
69
|
-
)
|
|
70
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
import { type AccordionItemIndicatorProps } from '@ark-ui/react/accordion'
|
|
4
|
-
import { type AccordionVariantProps } from 'styled-system/recipes'
|
|
5
|
-
import { useCerberusContext } from '../../context/cerberus'
|
|
6
|
-
import { AccordionParts } from './parts'
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* This module contains the internal AccordionItemIndicator component.
|
|
10
|
-
* @module 'accordion/item-indicator'
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
export function AccordionChevronItemIndicator(
|
|
14
|
-
props: AccordionItemIndicatorProps & AccordionVariantProps,
|
|
15
|
-
) {
|
|
16
|
-
const { size, ...indicatorProps } = props
|
|
17
|
-
const iconSize = size === 'sm' ? 16 : '24'
|
|
18
|
-
|
|
19
|
-
const { icons } = useCerberusContext()
|
|
20
|
-
const { accordionIndicator: ChevronDown } = icons
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<AccordionParts.ItemIndicator {...indicatorProps}>
|
|
24
|
-
<ChevronDown size={iconSize} />
|
|
25
|
-
</AccordionParts.ItemIndicator>
|
|
26
|
-
)
|
|
27
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import type { ElementType } from 'react'
|
|
2
|
-
import {
|
|
3
|
-
AccordionItem,
|
|
4
|
-
AccordionItemContent,
|
|
5
|
-
AccordionItemIndicator,
|
|
6
|
-
AccordionItemTrigger,
|
|
7
|
-
AccordionRoot,
|
|
8
|
-
} from './primitives'
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* This module contains the parts of the Accordion component.
|
|
12
|
-
* @module 'accordion/parts'
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
interface AccordionPartsValue {
|
|
16
|
-
/**
|
|
17
|
-
* The context provider of the accordion.
|
|
18
|
-
*/
|
|
19
|
-
Root: ElementType
|
|
20
|
-
/**
|
|
21
|
-
* The item of the accordion.
|
|
22
|
-
*/
|
|
23
|
-
Item: ElementType
|
|
24
|
-
/**
|
|
25
|
-
* The trigger of the accordion item.
|
|
26
|
-
*/
|
|
27
|
-
ItemTrigger: ElementType
|
|
28
|
-
/**
|
|
29
|
-
* The content of the accordion item.
|
|
30
|
-
*/
|
|
31
|
-
ItemContent: ElementType
|
|
32
|
-
/**
|
|
33
|
-
* The indicator of the accordion item.
|
|
34
|
-
*/
|
|
35
|
-
ItemIndicator: ElementType
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* An Object containing the parts of the Accordion component. For users that
|
|
40
|
-
* prefer Object component syntax.
|
|
41
|
-
*
|
|
42
|
-
* @remarks
|
|
43
|
-
*
|
|
44
|
-
* When using object component syntax, you import the AccordionParts object and
|
|
45
|
-
* the entire family of components vs. only what you use.
|
|
46
|
-
*/
|
|
47
|
-
export const AccordionParts: AccordionPartsValue = {
|
|
48
|
-
Root: AccordionRoot,
|
|
49
|
-
Item: AccordionItem,
|
|
50
|
-
ItemTrigger: AccordionItemTrigger,
|
|
51
|
-
ItemContent: AccordionItemContent,
|
|
52
|
-
ItemIndicator: AccordionItemIndicator,
|
|
53
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Accordion,
|
|
3
|
-
type AccordionItemContentProps as ArkAccordionItemContentProps,
|
|
4
|
-
type AccordionItemIndicatorProps as ArkAccordionItemIndicatorProps,
|
|
5
|
-
type AccordionItemProps as ArkAccordionItemProps,
|
|
6
|
-
type AccordionItemTriggerProps as ArkAccordionItemTriggerProps,
|
|
7
|
-
type AccordionRootProps as ArkAccordionRootProps,
|
|
8
|
-
} from '@ark-ui/react/accordion'
|
|
9
|
-
import { accordion, type AccordionVariantProps } from 'styled-system/recipes'
|
|
10
|
-
import {
|
|
11
|
-
createCerberusPrimitive,
|
|
12
|
-
type CerberusPrimitiveProps,
|
|
13
|
-
} from '../../system/index'
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* This module contains the primitives of the Accordion component.
|
|
17
|
-
* @module 'accordion/primitives'
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
const { withSlotRecipe } = createCerberusPrimitive(accordion)
|
|
21
|
-
|
|
22
|
-
function AccordionRootEl(props: AccordionRootProps) {
|
|
23
|
-
const { size, ...rootProps } = props
|
|
24
|
-
return <Accordion.Root {...rootProps} data-size={size} />
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* The primitive root component of the Accordion component.
|
|
29
|
-
*
|
|
30
|
-
* This component returns the Ark `Accordion.Root` component which has a
|
|
31
|
-
* base style using the Cerberus `accordion` recipe that can be overridden.
|
|
32
|
-
*/
|
|
33
|
-
export const AccordionRoot = withSlotRecipe(AccordionRootEl, 'root')
|
|
34
|
-
export type AccordionRootProps = CerberusPrimitiveProps<
|
|
35
|
-
ArkAccordionRootProps & AccordionVariantProps
|
|
36
|
-
>
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* The primitive item component of the Accordion component.
|
|
40
|
-
*
|
|
41
|
-
* This component returns the Ark `Accordion.Item` component which has a
|
|
42
|
-
* base style using the Cerberus `accordion` recipe that can be overridden.
|
|
43
|
-
*/
|
|
44
|
-
export const AccordionItem = withSlotRecipe(Accordion.Item, 'item')
|
|
45
|
-
export type AccordionItemProps = CerberusPrimitiveProps<
|
|
46
|
-
ArkAccordionItemProps & AccordionVariantProps
|
|
47
|
-
>
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* The primitive trigger component of the Accordion component.
|
|
51
|
-
*
|
|
52
|
-
* This component returns the Ark `Accordion.ItemTrigger` component which has
|
|
53
|
-
* a base style using the Cerberus `accordion` recipe that can be overridden.
|
|
54
|
-
*/
|
|
55
|
-
export const AccordionItemTrigger = withSlotRecipe(
|
|
56
|
-
Accordion.ItemTrigger,
|
|
57
|
-
'itemTrigger',
|
|
58
|
-
)
|
|
59
|
-
export type AccordionItemTriggerProps =
|
|
60
|
-
CerberusPrimitiveProps<ArkAccordionItemTriggerProps>
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* The primitive item indicator component of the Accordion component.
|
|
64
|
-
*
|
|
65
|
-
* This component returns the Ark `Accordion.ItemIndicator` component which has
|
|
66
|
-
* a base style using the Cerberus `accordion` recipe that can be overridden.
|
|
67
|
-
*/
|
|
68
|
-
export const AccordionItemIndicator = withSlotRecipe(
|
|
69
|
-
Accordion.ItemIndicator,
|
|
70
|
-
'itemIndicator',
|
|
71
|
-
)
|
|
72
|
-
export type AccordionItemIndicatorProps =
|
|
73
|
-
CerberusPrimitiveProps<ArkAccordionItemIndicatorProps>
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* The primitive content component of the Accordion component.
|
|
77
|
-
*
|
|
78
|
-
* This component returns the Ark `Accordion.Content` component which has a
|
|
79
|
-
* base style using the Cerberus `accordion` recipe that can be overridden.
|
|
80
|
-
*/
|
|
81
|
-
export const AccordionItemContent = withSlotRecipe(
|
|
82
|
-
Accordion.ItemContent,
|
|
83
|
-
'itemContent',
|
|
84
|
-
)
|
|
85
|
-
export type AccordionItemContentProps =
|
|
86
|
-
CerberusPrimitiveProps<ArkAccordionItemContentProps>
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react'
|
|
2
|
-
import { splitProps } from '../../utils/index'
|
|
3
|
-
import { Show } from '../show/index'
|
|
4
|
-
import { AdmonitionParts } from './parts'
|
|
5
|
-
import type { AdmonitionRootProps } from './primitives'
|
|
6
|
-
import { MatchAvatar } from './match-avatar'
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* This module provides an abstraction for the Admonition component.
|
|
10
|
-
* @module 'admonition/admonition'
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
export interface AdmonitionProps extends AdmonitionRootProps {
|
|
14
|
-
/**
|
|
15
|
-
* The heading title for the Admonition.
|
|
16
|
-
*/
|
|
17
|
-
heading?: string
|
|
18
|
-
/**
|
|
19
|
-
* One off replacement for the icon.
|
|
20
|
-
*/
|
|
21
|
-
icon?: ReactNode
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* The Admonition component is an abstraction of the primitives which
|
|
26
|
-
* displays a Admonition with a label.
|
|
27
|
-
*
|
|
28
|
-
* @description [Cerberus Docs](https://cerberus.digitalu.design/react/admonition)
|
|
29
|
-
*
|
|
30
|
-
* @remarks
|
|
31
|
-
*
|
|
32
|
-
* For a customizable Admonition, use the `AdmonitionParts` object to access the
|
|
33
|
-
* individual primitives of the Admonition component.
|
|
34
|
-
*/
|
|
35
|
-
export function Admonition(props: AdmonitionProps) {
|
|
36
|
-
const [elProps, styleProps, rootProps] = splitProps(
|
|
37
|
-
props,
|
|
38
|
-
['heading', 'icon', 'children'],
|
|
39
|
-
['palette', 'usage'],
|
|
40
|
-
)
|
|
41
|
-
|
|
42
|
-
return (
|
|
43
|
-
<AdmonitionParts.Root {...styleProps} {...rootProps}>
|
|
44
|
-
<Show
|
|
45
|
-
when={elProps.icon}
|
|
46
|
-
fallback={<MatchAvatar palette={styleProps.palette} />}
|
|
47
|
-
>
|
|
48
|
-
<AdmonitionParts.Indicator>{elProps.icon}</AdmonitionParts.Indicator>
|
|
49
|
-
</Show>
|
|
50
|
-
|
|
51
|
-
<AdmonitionParts.Content>
|
|
52
|
-
<Show when={elProps.heading}>
|
|
53
|
-
<AdmonitionParts.Heading>{elProps.heading}</AdmonitionParts.Heading>
|
|
54
|
-
</Show>
|
|
55
|
-
|
|
56
|
-
<AdmonitionParts.Description>
|
|
57
|
-
{elProps.children}
|
|
58
|
-
</AdmonitionParts.Description>
|
|
59
|
-
</AdmonitionParts.Content>
|
|
60
|
-
</AdmonitionParts.Root>
|
|
61
|
-
)
|
|
62
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
import type { AdmonitionVariantProps } from 'styled-system/recipes'
|
|
4
|
-
import { useRef, type ReactNode } from 'react'
|
|
5
|
-
import { useCerberusContext } from '../../context/cerberus'
|
|
6
|
-
import { Avatar } from '../avatar/avatar'
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* This module provides a component for creating the admonition indicator.
|
|
10
|
-
* @module 'admonition/match-avatar'
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
interface AvatarRefProps {
|
|
14
|
-
page: ReactNode
|
|
15
|
-
info: ReactNode
|
|
16
|
-
success: ReactNode
|
|
17
|
-
warning: ReactNode
|
|
18
|
-
danger: ReactNode
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
type MatchAvatarProps = AdmonitionVariantProps
|
|
22
|
-
|
|
23
|
-
export function MatchAvatar(props: MatchAvatarProps) {
|
|
24
|
-
const { palette = 'page' } = props
|
|
25
|
-
|
|
26
|
-
const { icons } = useCerberusContext()
|
|
27
|
-
const {
|
|
28
|
-
infoNotification: InfoIcon,
|
|
29
|
-
successNotification: SuccessIcon,
|
|
30
|
-
warningNotification: WarningIcon,
|
|
31
|
-
dangerNotification: DangerIcon,
|
|
32
|
-
} = icons
|
|
33
|
-
|
|
34
|
-
// cache the el since the result is static and the component is client side
|
|
35
|
-
const elRef = useRef<AvatarRefProps>({
|
|
36
|
-
page: <Avatar gradient="charon-light" fallback={<InfoIcon />} size="sm" />,
|
|
37
|
-
info: (
|
|
38
|
-
<Avatar gradient="amphiaraus-dark" fallback={<InfoIcon />} size="sm" />
|
|
39
|
-
),
|
|
40
|
-
success: (
|
|
41
|
-
<Avatar gradient="thanatos-dark" fallback={<SuccessIcon />} size="sm" />
|
|
42
|
-
),
|
|
43
|
-
warning: (
|
|
44
|
-
<Avatar gradient="asphodel-light" fallback={<WarningIcon />} size="sm" />
|
|
45
|
-
),
|
|
46
|
-
danger: (
|
|
47
|
-
<Avatar gradient="hades-light" fallback={<DangerIcon />} size="sm" />
|
|
48
|
-
),
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
return <>{elRef.current[palette]}</>
|
|
52
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import type { ElementType } from 'react'
|
|
2
|
-
import {
|
|
3
|
-
AdmonitionContent,
|
|
4
|
-
AdmonitionDescription,
|
|
5
|
-
AdmonitionHeading,
|
|
6
|
-
AdmonitionIndicator,
|
|
7
|
-
AdmonitionRoot,
|
|
8
|
-
} from './primitives'
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* This module contains the parts of the Admonition component.
|
|
12
|
-
* @module 'admonition/parts'
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
interface AdmonitionPartsValue {
|
|
16
|
-
/**
|
|
17
|
-
* The context provider of the Admonition.
|
|
18
|
-
*/
|
|
19
|
-
Root: ElementType
|
|
20
|
-
/**
|
|
21
|
-
* The indicator of the Admonition.
|
|
22
|
-
*/
|
|
23
|
-
Indicator: ElementType
|
|
24
|
-
/**
|
|
25
|
-
* The content of the Admonition.
|
|
26
|
-
*/
|
|
27
|
-
Content: ElementType
|
|
28
|
-
/**
|
|
29
|
-
* The heading of the Admonition.
|
|
30
|
-
*/
|
|
31
|
-
Heading: ElementType
|
|
32
|
-
/**
|
|
33
|
-
* The description of the Admonition.
|
|
34
|
-
*/
|
|
35
|
-
Description: ElementType
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* An Object containing the parts of the Accordion component. For users that
|
|
40
|
-
* prefer Object component syntax.
|
|
41
|
-
*
|
|
42
|
-
* @remarks
|
|
43
|
-
*
|
|
44
|
-
* When using object component syntax, you import the AdmonitionParts object and
|
|
45
|
-
* the entire family of components vs. only what you use.
|
|
46
|
-
*/
|
|
47
|
-
export const AdmonitionParts: AdmonitionPartsValue = {
|
|
48
|
-
Root: AdmonitionRoot,
|
|
49
|
-
Indicator: AdmonitionIndicator,
|
|
50
|
-
Content: AdmonitionContent,
|
|
51
|
-
Heading: AdmonitionHeading,
|
|
52
|
-
Description: AdmonitionDescription,
|
|
53
|
-
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { type HTMLArkProps } from '@ark-ui/react/factory'
|
|
2
|
-
import { admonition, type AdmonitionVariantProps } from 'styled-system/recipes'
|
|
3
|
-
import {
|
|
4
|
-
cerberus,
|
|
5
|
-
createCerberusPrimitive,
|
|
6
|
-
type CerberusPrimitiveProps,
|
|
7
|
-
} from '../../system/index'
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* This module contains the primitives of the Admonition components.
|
|
11
|
-
* @module 'admonition/primitives'
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
const { withSlotRecipe, withNoRecipe } = createCerberusPrimitive(admonition)
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* The `AdmonitionRoot` component is the container for the Admonition.
|
|
18
|
-
*/
|
|
19
|
-
export const AdmonitionRoot = withSlotRecipe(cerberus.aside, 'root', {
|
|
20
|
-
defaultProps: {
|
|
21
|
-
'data-scope': 'admonition',
|
|
22
|
-
'data-part': 'root',
|
|
23
|
-
},
|
|
24
|
-
})
|
|
25
|
-
export type AdmonitionRootProps = CerberusPrimitiveProps<
|
|
26
|
-
HTMLArkProps<'aside'> & AdmonitionVariantProps
|
|
27
|
-
>
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* The `AdmonitionIndicator` component is the indicator for the Admonition.
|
|
31
|
-
*/
|
|
32
|
-
export const AdmonitionIndicator = withNoRecipe(cerberus.span, {
|
|
33
|
-
defaultProps: {
|
|
34
|
-
'data-scope': 'admonition',
|
|
35
|
-
'data-part': 'indicator',
|
|
36
|
-
},
|
|
37
|
-
})
|
|
38
|
-
export type AdmonitionIndicatorProps = CerberusPrimitiveProps<
|
|
39
|
-
HTMLArkProps<'span'>
|
|
40
|
-
>
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* The `AdmonitionContent` component is the content for the Admonition.
|
|
44
|
-
*/
|
|
45
|
-
export const AdmonitionContent = withNoRecipe(cerberus.div, {
|
|
46
|
-
defaultProps: {
|
|
47
|
-
'data-scope': 'admonition',
|
|
48
|
-
'data-part': 'content',
|
|
49
|
-
},
|
|
50
|
-
})
|
|
51
|
-
export type AdmonitionContentProps = CerberusPrimitiveProps<HTMLArkProps<'div'>>
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* The `AdmonitionHeading` component is the heading title for the Admonition.
|
|
55
|
-
*/
|
|
56
|
-
export const AdmonitionHeading = withSlotRecipe(cerberus.p, 'heading', {
|
|
57
|
-
defaultProps: {
|
|
58
|
-
'data-scope': 'admonition',
|
|
59
|
-
'data-part': 'heading',
|
|
60
|
-
},
|
|
61
|
-
})
|
|
62
|
-
export type AdmonitionHeadingProps = CerberusPrimitiveProps<
|
|
63
|
-
HTMLArkProps<'p'> & AdmonitionVariantProps
|
|
64
|
-
>
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* The `AdmonitionDescription` component is the description for the Admonition.
|
|
68
|
-
*/
|
|
69
|
-
export const AdmonitionDescription = withSlotRecipe(cerberus.p, 'description', {
|
|
70
|
-
defaultProps: {
|
|
71
|
-
'data-scope': 'admonition',
|
|
72
|
-
'data-part': 'description',
|
|
73
|
-
},
|
|
74
|
-
})
|
|
75
|
-
export type AdmonitionDescriptionProps = CerberusPrimitiveProps<
|
|
76
|
-
HTMLArkProps<'p'> & AdmonitionVariantProps
|
|
77
|
-
>
|