@cerberus-design/react 0.13.2 → 0.14.0
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 +607 -129
- package/build/legacy/components/Accordion.cjs +101 -0
- package/build/legacy/components/Accordion.cjs.map +1 -0
- package/build/legacy/components/AccordionItemGroup.cjs +119 -0
- package/build/legacy/components/AccordionItemGroup.cjs.map +1 -0
- package/build/legacy/components/Admonition.cjs +3 -0
- package/build/legacy/components/Admonition.cjs.map +1 -1
- package/build/legacy/components/Avatar.cjs +3 -0
- package/build/legacy/components/Avatar.cjs.map +1 -1
- package/build/legacy/components/Checkbox.cjs +3 -0
- package/build/legacy/components/Checkbox.cjs.map +1 -1
- package/build/legacy/components/DatePicker.client.cjs +497 -0
- package/build/legacy/components/DatePicker.client.cjs.map +1 -0
- package/build/legacy/components/DatePicker.server.cjs +364 -0
- package/build/legacy/components/DatePicker.server.cjs.map +1 -0
- package/build/legacy/components/FileStatus.cjs +3 -0
- package/build/legacy/components/FileStatus.cjs.map +1 -1
- package/build/legacy/components/FileUploader.cjs +3 -0
- package/build/legacy/components/FileUploader.cjs.map +1 -1
- package/build/legacy/components/Input.cjs +3 -0
- package/build/legacy/components/Input.cjs.map +1 -1
- package/build/legacy/components/Notification.cjs +3 -0
- package/build/legacy/components/Notification.cjs.map +1 -1
- package/build/legacy/components/NotificationDescription.cjs.map +1 -1
- package/build/legacy/components/NotificationHeading.cjs.map +1 -1
- package/build/legacy/components/ProgressBar.cjs.map +1 -1
- package/build/legacy/components/Select.cjs +3 -0
- package/build/legacy/components/Select.cjs.map +1 -1
- package/build/legacy/components/Tabs.client.cjs +104 -0
- package/build/legacy/components/Tabs.client.cjs.map +1 -0
- package/build/legacy/components/Tag.cjs +3 -0
- package/build/legacy/components/Tag.cjs.map +1 -1
- package/build/legacy/components/Text.cjs +59 -0
- package/build/legacy/components/Text.cjs.map +1 -0
- package/build/legacy/components/Toggle.cjs +3 -0
- package/build/legacy/components/Toggle.cjs.map +1 -1
- package/build/legacy/components/Tooltip.cjs +2 -2
- package/build/legacy/components/Tooltip.cjs.map +1 -1
- package/build/legacy/config/cerbIcons.cjs +3 -0
- package/build/legacy/config/cerbIcons.cjs.map +1 -1
- package/build/legacy/config/defineIcons.cjs +3 -0
- package/build/legacy/config/defineIcons.cjs.map +1 -1
- package/build/legacy/config/icons/checkbox.icons.cjs.map +1 -1
- package/build/legacy/context/confirm-modal.cjs +3 -0
- package/build/legacy/context/confirm-modal.cjs.map +1 -1
- package/build/legacy/context/cta-modal.cjs +5 -3
- package/build/legacy/context/cta-modal.cjs.map +1 -1
- package/build/legacy/context/notification-center.cjs +3 -0
- package/build/legacy/context/notification-center.cjs.map +1 -1
- package/build/legacy/context/prompt-modal.cjs +3 -0
- package/build/legacy/context/prompt-modal.cjs.map +1 -1
- package/build/legacy/context/tabs.cjs +53 -24
- package/build/legacy/context/tabs.cjs.map +1 -1
- package/build/legacy/hooks/useDate.cjs +8 -0
- package/build/legacy/hooks/useDate.cjs.map +1 -1
- package/build/legacy/index.cjs +1083 -711
- package/build/legacy/index.cjs.map +1 -1
- package/build/legacy/utils/index.cjs +21 -2
- package/build/legacy/utils/index.cjs.map +1 -1
- package/build/legacy/utils/localStorage.cjs +44 -0
- package/build/legacy/utils/localStorage.cjs.map +1 -0
- package/build/modern/_tsup-dts-rollup.d.ts +607 -129
- package/build/modern/chunk-2ZNIYPDV.js +47 -0
- package/build/modern/chunk-2ZNIYPDV.js.map +1 -0
- package/build/modern/chunk-34E3UFFB.js +75 -0
- package/build/modern/chunk-34E3UFFB.js.map +1 -0
- package/build/modern/{chunk-CZND26FC.js → chunk-3BM6MZ4A.js} +8 -1
- package/build/modern/{chunk-CZND26FC.js.map → chunk-3BM6MZ4A.js.map} +1 -1
- package/build/modern/{chunk-N4QTLDVM.js → chunk-4IMOKN2D.js} +3 -3
- package/build/modern/{chunk-F27AAKQ3.js → chunk-5KHU6MM5.js} +8 -2
- package/build/modern/chunk-5KHU6MM5.js.map +1 -0
- package/build/modern/{chunk-WFJWCZ7E.js → chunk-77B4HFKT.js} +13 -14
- package/build/modern/chunk-77B4HFKT.js.map +1 -0
- package/build/modern/{chunk-FBSESDWJ.js → chunk-BHSYQCDV.js} +16 -16
- package/build/modern/chunk-BHSYQCDV.js.map +1 -0
- package/build/modern/{chunk-SPZYPRZ6.js → chunk-BU5JK37R.js} +2 -2
- package/build/modern/{chunk-UTGEFJ3L.js → chunk-C5EHJUS5.js} +1 -1
- package/build/modern/{chunk-UTGEFJ3L.js.map → chunk-C5EHJUS5.js.map} +1 -1
- package/build/modern/{chunk-VERRHMW4.js → chunk-DDOTCGGA.js} +2 -2
- package/build/modern/{chunk-CP7OUC2Q.js → chunk-E3PAEB7Y.js} +1 -1
- package/build/modern/chunk-E3PAEB7Y.js.map +1 -0
- package/build/modern/{chunk-F72ZABKX.js → chunk-F4LTOZAN.js} +2 -2
- package/build/modern/{chunk-NKM6PISB.js → chunk-F7EWTOML.js} +2 -2
- package/build/modern/chunk-F7XWOSN3.js +39 -0
- package/build/modern/chunk-F7XWOSN3.js.map +1 -0
- package/build/modern/chunk-FQLMPEYX.js +18 -0
- package/build/modern/chunk-FQLMPEYX.js.map +1 -0
- package/build/modern/{chunk-7MM5KYEX.js → chunk-GI6CSUU4.js} +7 -7
- package/build/modern/{chunk-7SGPJM66.js → chunk-HP4ZN473.js} +2 -2
- package/build/modern/chunk-HP4ZN473.js.map +1 -0
- package/build/modern/chunk-IP5VFOPZ.js +132 -0
- package/build/modern/chunk-IP5VFOPZ.js.map +1 -0
- package/build/modern/{chunk-KML4CTMK.js → chunk-LPALHB6R.js} +3 -3
- package/build/modern/chunk-LPALHB6R.js.map +1 -0
- package/build/modern/{chunk-3XGLNXJJ.js → chunk-M73ECA25.js} +8 -8
- package/build/modern/chunk-M73ECA25.js.map +1 -0
- package/build/modern/chunk-N7O6D7BW.js +63 -0
- package/build/modern/chunk-N7O6D7BW.js.map +1 -0
- package/build/modern/{chunk-W4DXACNV.js → chunk-O7QVCF3H.js} +3 -3
- package/build/modern/chunk-RIZGWERR.js +161 -0
- package/build/modern/chunk-RIZGWERR.js.map +1 -0
- package/build/modern/chunk-RZ7NG77U.js +77 -0
- package/build/modern/chunk-RZ7NG77U.js.map +1 -0
- package/build/modern/{chunk-XL4JREDT.js → chunk-S25RHYZV.js} +2 -2
- package/build/modern/{chunk-SXIXDXG3.js → chunk-SLHYBPJ5.js} +1 -1
- package/build/modern/chunk-SLHYBPJ5.js.map +1 -0
- package/build/modern/{chunk-GRUXP3NG.js → chunk-T6U7AKKP.js} +10 -10
- package/build/modern/chunk-T6U7AKKP.js.map +1 -0
- package/build/modern/{chunk-XEW6TJJ4.js → chunk-UXY3KCC3.js} +1 -1
- package/build/modern/chunk-UXY3KCC3.js.map +1 -0
- package/build/modern/{chunk-NB6DV4VA.js → chunk-W2LSPRQ3.js} +2 -2
- package/build/modern/{chunk-KCANMM64.js → chunk-WZJ5UQNM.js} +1 -1
- package/build/modern/chunk-WZJ5UQNM.js.map +1 -0
- package/build/modern/{chunk-NMNONSHU.js → chunk-XVU2NQCW.js} +2 -2
- package/build/modern/components/Accordion.js +15 -0
- package/build/modern/components/AccordionItemGroup.js +9 -0
- package/build/modern/components/Admonition.js +5 -5
- package/build/modern/components/Avatar.js +4 -4
- package/build/modern/components/Checkbox.js +4 -4
- package/build/modern/components/DatePicker.client.js +31 -0
- package/build/modern/components/DatePicker.server.js +31 -0
- package/build/modern/components/FileStatus.js +7 -7
- package/build/modern/components/FileUploader.js +5 -5
- package/build/modern/components/Input.js +4 -4
- package/build/modern/components/Notification.js +4 -4
- package/build/modern/components/NotificationDescription.js +1 -1
- package/build/modern/components/NotificationHeading.js +1 -1
- package/build/modern/components/ProgressBar.js +1 -1
- package/build/modern/components/Select.js +4 -4
- package/build/modern/components/Tabs.client.js +18 -0
- package/build/modern/components/Tabs.client.js.map +1 -0
- package/build/modern/components/Tag.js +4 -4
- package/build/modern/components/Text.js +7 -0
- package/build/modern/components/Text.js.map +1 -0
- package/build/modern/components/Toggle.js +4 -4
- package/build/modern/components/Tooltip.js +1 -1
- package/build/modern/config/cerbIcons.js +2 -2
- package/build/modern/config/defineIcons.js +3 -3
- package/build/modern/config/icons/checkbox.icons.js +1 -1
- package/build/modern/context/confirm-modal.js +8 -8
- package/build/modern/context/cta-modal.js +8 -8
- package/build/modern/context/notification-center.js +7 -7
- package/build/modern/context/prompt-modal.js +11 -11
- package/build/modern/context/tabs.js +2 -1
- package/build/modern/hooks/useDate.js +3 -1
- package/build/modern/index.js +158 -94
- package/build/modern/index.js.map +1 -1
- package/build/modern/utils/index.js +8 -2
- package/build/modern/utils/localStorage.js +10 -0
- package/build/modern/utils/localStorage.js.map +1 -0
- package/package.json +2 -2
- package/src/components/Accordion.tsx +160 -0
- package/src/components/AccordionItemGroup.tsx +79 -0
- package/src/components/DatePicker.client.tsx +365 -0
- package/src/components/DatePicker.server.tsx +229 -0
- package/src/components/Notification.tsx +6 -3
- package/src/components/NotificationDescription.tsx +2 -2
- package/src/components/NotificationHeading.tsx +1 -2
- package/src/components/ProgressBar.tsx +1 -1
- package/src/components/Tabs.client.tsx +113 -0
- package/src/components/Text.tsx +70 -0
- package/src/components/Tooltip.tsx +2 -2
- package/src/config/cerbIcons.ts +9 -0
- package/src/config/icons/checkbox.icons.tsx +2 -2
- package/src/context/confirm-modal.tsx +1 -1
- package/src/context/cta-modal.tsx +6 -7
- package/src/context/notification-center.tsx +1 -1
- package/src/context/prompt-modal.tsx +1 -1
- package/src/context/tabs.tsx +66 -65
- package/src/hooks/useDate.ts +12 -0
- package/src/index.ts +6 -4
- package/src/utils/index.ts +2 -0
- package/src/utils/localStorage.ts +28 -0
- package/build/legacy/aria-helpers/tabs.aria.cjs +0 -100
- package/build/legacy/aria-helpers/tabs.aria.cjs.map +0 -1
- package/build/legacy/components/Tab.cjs +0 -135
- package/build/legacy/components/Tab.cjs.map +0 -1
- package/build/legacy/components/TabList.cjs +0 -69
- package/build/legacy/components/TabList.cjs.map +0 -1
- package/build/legacy/components/TabPanel.cjs +0 -76
- package/build/legacy/components/TabPanel.cjs.map +0 -1
- package/build/modern/aria-helpers/tabs.aria.js +0 -9
- package/build/modern/chunk-3XGLNXJJ.js.map +0 -1
- package/build/modern/chunk-7SGPJM66.js.map +0 -1
- package/build/modern/chunk-AYIRV5CL.js +0 -32
- package/build/modern/chunk-AYIRV5CL.js.map +0 -1
- package/build/modern/chunk-CP7OUC2Q.js.map +0 -1
- package/build/modern/chunk-F27AAKQ3.js.map +0 -1
- package/build/modern/chunk-FBSESDWJ.js.map +0 -1
- package/build/modern/chunk-GRUXP3NG.js.map +0 -1
- package/build/modern/chunk-ITOIXNJS.js +0 -64
- package/build/modern/chunk-ITOIXNJS.js.map +0 -1
- package/build/modern/chunk-KCANMM64.js.map +0 -1
- package/build/modern/chunk-KML4CTMK.js.map +0 -1
- package/build/modern/chunk-RIFQSCHT.js +0 -58
- package/build/modern/chunk-RIFQSCHT.js.map +0 -1
- package/build/modern/chunk-SLF6SIPB.js +0 -46
- package/build/modern/chunk-SLF6SIPB.js.map +0 -1
- package/build/modern/chunk-SXIXDXG3.js.map +0 -1
- package/build/modern/chunk-UKPF7JOB.js +0 -33
- package/build/modern/chunk-UKPF7JOB.js.map +0 -1
- package/build/modern/chunk-WFJWCZ7E.js.map +0 -1
- package/build/modern/chunk-XEW6TJJ4.js.map +0 -1
- package/build/modern/components/Tab.js +0 -10
- package/build/modern/components/TabList.js +0 -9
- package/build/modern/components/TabPanel.js +0 -10
- package/src/aria-helpers/tabs.aria.ts +0 -70
- package/src/components/Tab.tsx +0 -68
- package/src/components/TabList.tsx +0 -51
- package/src/components/TabPanel.tsx +0 -49
- /package/build/modern/{chunk-N4QTLDVM.js.map → chunk-4IMOKN2D.js.map} +0 -0
- /package/build/modern/{chunk-SPZYPRZ6.js.map → chunk-BU5JK37R.js.map} +0 -0
- /package/build/modern/{chunk-VERRHMW4.js.map → chunk-DDOTCGGA.js.map} +0 -0
- /package/build/modern/{chunk-F72ZABKX.js.map → chunk-F4LTOZAN.js.map} +0 -0
- /package/build/modern/{chunk-NKM6PISB.js.map → chunk-F7EWTOML.js.map} +0 -0
- /package/build/modern/{chunk-7MM5KYEX.js.map → chunk-GI6CSUU4.js.map} +0 -0
- /package/build/modern/{chunk-W4DXACNV.js.map → chunk-O7QVCF3H.js.map} +0 -0
- /package/build/modern/{chunk-XL4JREDT.js.map → chunk-S25RHYZV.js.map} +0 -0
- /package/build/modern/{chunk-NB6DV4VA.js.map → chunk-W2LSPRQ3.js.map} +0 -0
- /package/build/modern/{chunk-NMNONSHU.js.map → chunk-XVU2NQCW.js.map} +0 -0
- /package/build/modern/{aria-helpers/tabs.aria.js.map → components/Accordion.js.map} +0 -0
- /package/build/modern/components/{Tab.js.map → AccordionItemGroup.js.map} +0 -0
- /package/build/modern/components/{TabList.js.map → DatePicker.client.js.map} +0 -0
- /package/build/modern/components/{TabPanel.js.map → DatePicker.server.js.map} +0 -0
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DatePicker as ArkDP,
|
|
3
|
+
type DatePickerLabelProps,
|
|
4
|
+
type DatePickerTableCellProps,
|
|
5
|
+
type DatePickerTableCellTriggerProps,
|
|
6
|
+
type DatePickerTableHeaderProps,
|
|
7
|
+
type DatePickerTableProps,
|
|
8
|
+
type DatePickerTriggerProps,
|
|
9
|
+
type DatePickerViewControlProps,
|
|
10
|
+
} from '@ark-ui/react'
|
|
11
|
+
import { css, cx } from '@cerberus/styled-system/css'
|
|
12
|
+
import { datePicker, iconButton, label } from '@cerberus/styled-system/recipes'
|
|
13
|
+
import { $cerberusIcons } from '../config/defineIcons'
|
|
14
|
+
import { IconButton } from './IconButton'
|
|
15
|
+
import { Button } from './Button'
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* This module contains the DatePicker server family components.
|
|
19
|
+
* @module DatePicker
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
// We are not exposing this to the public API
|
|
23
|
+
const datePickerStyles = datePicker()
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The label component for the DatePicker.
|
|
27
|
+
* @definition [datePicker docs](https://cerberus.digitalu.design/react/date-picker)
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* <DatePickerLabel>
|
|
31
|
+
* <DatePickerLabel.Label>...</DatePickerLabel.Label>
|
|
32
|
+
* </DatePickerLabel>
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export function DatePickerLabel(props: DatePickerLabelProps) {
|
|
36
|
+
const { className, ...arkProps } = props
|
|
37
|
+
return (
|
|
38
|
+
<ArkDP.Label
|
|
39
|
+
{...arkProps}
|
|
40
|
+
className={cx(
|
|
41
|
+
className,
|
|
42
|
+
label({
|
|
43
|
+
size: 'sm',
|
|
44
|
+
}),
|
|
45
|
+
)}
|
|
46
|
+
/>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The trigger component for the DatePicker which opens the calendar.
|
|
52
|
+
* @definition [datePicker docs](https://cerberus.digitalu.design/react/date-picker)
|
|
53
|
+
* @example
|
|
54
|
+
* ```tsx
|
|
55
|
+
* <DatePickerTrigger />
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export function DatePickerTrigger(props: DatePickerTriggerProps) {
|
|
59
|
+
const { calendar: CalendarIcon } = $cerberusIcons
|
|
60
|
+
return (
|
|
61
|
+
<ArkDP.Trigger
|
|
62
|
+
{...props}
|
|
63
|
+
className={cx(
|
|
64
|
+
props.className,
|
|
65
|
+
iconButton({
|
|
66
|
+
size: 'sm',
|
|
67
|
+
usage: 'ghost',
|
|
68
|
+
}),
|
|
69
|
+
datePickerStyles.trigger,
|
|
70
|
+
)}
|
|
71
|
+
>
|
|
72
|
+
<CalendarIcon />
|
|
73
|
+
</ArkDP.Trigger>
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* The control component for the DatePicker which wraps the triggers to switch
|
|
79
|
+
* between calendar views.
|
|
80
|
+
* @definition [datePicker docs](https://cerberus.digitalu.design/react/date-picker)
|
|
81
|
+
* @example
|
|
82
|
+
* ```tsx
|
|
83
|
+
* <DatePickerViewControl>
|
|
84
|
+
* <PrevTrigger />
|
|
85
|
+
* <ViewTrigger />
|
|
86
|
+
* <NextTrigger />
|
|
87
|
+
* </DatePickerViewControl>
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
export function DatePickerViewControl(props: DatePickerViewControlProps) {
|
|
91
|
+
return (
|
|
92
|
+
<ArkDP.Control
|
|
93
|
+
{...props}
|
|
94
|
+
className={cx(props.className, datePickerStyles.viewControl)}
|
|
95
|
+
/>
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* An abstraction of the DatePicker control that contains the prev, view, and
|
|
101
|
+
* next triggers which control the calendar output.
|
|
102
|
+
* @definition [datePicker docs](https://cerberus.digitalu.design/react/date-picker)
|
|
103
|
+
* @example
|
|
104
|
+
* ```tsx
|
|
105
|
+
* <DatePickerViewControlGroup />
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
export function DatePickerViewControlGroup(props: DatePickerViewControlProps) {
|
|
109
|
+
const { calendarPrev: PrevIcon, calendarNext: NextIcon } = $cerberusIcons
|
|
110
|
+
return (
|
|
111
|
+
<DatePickerViewControl {...props}>
|
|
112
|
+
<ArkDP.PrevTrigger asChild>
|
|
113
|
+
<IconButton ariaLabel="Previous" size="sm">
|
|
114
|
+
<PrevIcon />
|
|
115
|
+
</IconButton>
|
|
116
|
+
</ArkDP.PrevTrigger>
|
|
117
|
+
|
|
118
|
+
<ArkDP.ViewTrigger asChild>
|
|
119
|
+
<Button
|
|
120
|
+
className={css({
|
|
121
|
+
h: '2rem',
|
|
122
|
+
paddingInline: 'md',
|
|
123
|
+
})}
|
|
124
|
+
shape="rounded"
|
|
125
|
+
size="sm"
|
|
126
|
+
usage="ghost"
|
|
127
|
+
>
|
|
128
|
+
<ArkDP.RangeText />
|
|
129
|
+
</Button>
|
|
130
|
+
</ArkDP.ViewTrigger>
|
|
131
|
+
|
|
132
|
+
<ArkDP.NextTrigger asChild>
|
|
133
|
+
<IconButton ariaLabel="Next" size="sm">
|
|
134
|
+
<NextIcon />
|
|
135
|
+
</IconButton>
|
|
136
|
+
</ArkDP.NextTrigger>
|
|
137
|
+
</DatePickerViewControl>
|
|
138
|
+
)
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* The table component for the DatePicker.
|
|
143
|
+
* @definition [datePicker docs](https://cerberus.digitalu.design/react/date-picker)
|
|
144
|
+
* @example
|
|
145
|
+
* ```tsx
|
|
146
|
+
* <DatePickerTable />
|
|
147
|
+
* ```
|
|
148
|
+
*/
|
|
149
|
+
export function DatePickerTable(props: DatePickerTableProps) {
|
|
150
|
+
return (
|
|
151
|
+
<ArkDP.Table
|
|
152
|
+
{...props}
|
|
153
|
+
className={cx(props.className, datePickerStyles.table)}
|
|
154
|
+
/>
|
|
155
|
+
)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* The header component for the DatePicker table.
|
|
160
|
+
* @definition [datePicker docs](https://cerberus.digitalu.design/react/date-picker)
|
|
161
|
+
* @example
|
|
162
|
+
* ```tsx
|
|
163
|
+
* <DatePickerTableHeader />
|
|
164
|
+
* ```
|
|
165
|
+
*/
|
|
166
|
+
export function DatePickerTableHeader(props: DatePickerTableHeaderProps) {
|
|
167
|
+
return (
|
|
168
|
+
<ArkDP.TableHeader
|
|
169
|
+
{...props}
|
|
170
|
+
className={cx(props.className, datePickerStyles.tableHeader)}
|
|
171
|
+
/>
|
|
172
|
+
)
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* The cell component for the DatePicker table.
|
|
177
|
+
* @definition [datePicker docs](https://cerberus.digitalu.design/react/date-picker)
|
|
178
|
+
* @example
|
|
179
|
+
* ```tsx
|
|
180
|
+
* <DatePickerTableCell />
|
|
181
|
+
* ```
|
|
182
|
+
*/
|
|
183
|
+
export function DatePickerTableCell(props: DatePickerTableCellProps) {
|
|
184
|
+
return (
|
|
185
|
+
<ArkDP.TableCell
|
|
186
|
+
{...props}
|
|
187
|
+
className={cx(props.className, datePickerStyles.tableCell)}
|
|
188
|
+
/>
|
|
189
|
+
)
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* The cell component for the DatePicker table.
|
|
194
|
+
* @definition [datePicker docs](https://cerberus.digitalu.design/react/date-picker)
|
|
195
|
+
* @example
|
|
196
|
+
* ```tsx
|
|
197
|
+
* <DatePickerTableCell />
|
|
198
|
+
* ```
|
|
199
|
+
*/
|
|
200
|
+
export function DatePickerTableCellTrigger(
|
|
201
|
+
props: DatePickerTableCellTriggerProps,
|
|
202
|
+
) {
|
|
203
|
+
return (
|
|
204
|
+
<ArkDP.TableCellTrigger
|
|
205
|
+
{...props}
|
|
206
|
+
className={cx(props.className, datePickerStyles.tableCellTrigger)}
|
|
207
|
+
/>
|
|
208
|
+
)
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* The view container which wraps the control and content components.
|
|
213
|
+
* @definition [datePicker docs](https://cerberus.digitalu.design/react/date-picker)
|
|
214
|
+
* @example
|
|
215
|
+
* ```tsx
|
|
216
|
+
* <DatePickerView />
|
|
217
|
+
* ```
|
|
218
|
+
*/
|
|
219
|
+
export const DatePickerView = ArkDP.View
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* The context component for the DatePicker which provides the DatePicker state.
|
|
223
|
+
* @definition [datePicker docs](https://cerberus.digitalu.design/react/date-picker)
|
|
224
|
+
* @example
|
|
225
|
+
* ```tsx
|
|
226
|
+
* <DatePickerContext />
|
|
227
|
+
* ```
|
|
228
|
+
*/
|
|
229
|
+
export const DatePickerContext = ArkDP.Context
|
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
type MouseEvent,
|
|
14
14
|
} from 'react'
|
|
15
15
|
import { $cerberusIcons } from '../config/defineIcons'
|
|
16
|
-
import type { IconType } from '../config/cerbIcons'
|
|
17
16
|
import { trapFocus } from '../aria-helpers/trap-focus.aria'
|
|
18
17
|
|
|
19
18
|
/**
|
|
@@ -22,9 +21,13 @@ import { trapFocus } from '../aria-helpers/trap-focus.aria'
|
|
|
22
21
|
*/
|
|
23
22
|
|
|
24
23
|
function MatchNotificationIcon(props: NotificationVariantProps) {
|
|
25
|
-
const palette = props.palette || 'info'
|
|
24
|
+
const palette = (props.palette || 'info') as
|
|
25
|
+
| 'info'
|
|
26
|
+
| 'success'
|
|
27
|
+
| 'warning'
|
|
28
|
+
| 'danger'
|
|
26
29
|
const key = `${palette}Notification` as keyof typeof $cerberusIcons
|
|
27
|
-
const Icon = $cerberusIcons[key]
|
|
30
|
+
const Icon = $cerberusIcons[key]
|
|
28
31
|
return <Icon />
|
|
29
32
|
}
|
|
30
33
|
|
|
@@ -10,8 +10,8 @@ import type { HTMLAttributes } from 'react'
|
|
|
10
10
|
* @module
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
export
|
|
14
|
-
|
|
13
|
+
export type BaseNotificationDescriptionProps =
|
|
14
|
+
HTMLAttributes<HTMLParagraphElement>
|
|
15
15
|
export type NotificationDescriptionProps = BaseNotificationDescriptionProps &
|
|
16
16
|
NotificationVariantProps
|
|
17
17
|
|
|
@@ -10,8 +10,7 @@ import type { HTMLAttributes } from 'react'
|
|
|
10
10
|
* @module
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
export
|
|
14
|
-
extends HTMLAttributes<HTMLParagraphElement> {}
|
|
13
|
+
export type BaseNotificationHeadingProps = HTMLAttributes<HTMLParagraphElement>
|
|
15
14
|
export type NotificationHeadingProps = BaseNotificationHeadingProps &
|
|
16
15
|
NotificationVariantProps
|
|
17
16
|
|
|
@@ -10,7 +10,7 @@ import type { HTMLAttributes } from 'react'
|
|
|
10
10
|
* @module
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
export
|
|
13
|
+
export type ProgressBarBaseProps = HTMLAttributes<HTMLDivElement>
|
|
14
14
|
export type NonIndeterminateProgressBarProps = {
|
|
15
15
|
/**
|
|
16
16
|
* A unique identifier for the progress bar. Required for accessibility.
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { Tabs as ArkTabs } from '@ark-ui/react/tabs'
|
|
4
|
+
import { cx } from '@cerberus/styled-system/css'
|
|
5
|
+
import { useTabsContext } from '../context/tabs'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* This module provides the Tabs family.
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The tab list container for the Tabs group.
|
|
14
|
+
* @definition [Tabs docs](https://cerberus.digitalu.design/react/tabs)
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* <Tabs>
|
|
18
|
+
* <TabList description="Profile settings">
|
|
19
|
+
* <Tab value="overview">Overview</Tab>
|
|
20
|
+
* </TabList>
|
|
21
|
+
* <TabPanel tab="overview">...</TabPanel>
|
|
22
|
+
* </Tabs>
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export function TabsList(props: ArkTabs.ListProps) {
|
|
26
|
+
const { children, ...tabsProps } = props
|
|
27
|
+
const { styles } = useTabsContext()
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<ArkTabs.List
|
|
31
|
+
{...tabsProps}
|
|
32
|
+
className={cx(tabsProps.className, styles.list)}
|
|
33
|
+
>
|
|
34
|
+
{children}
|
|
35
|
+
<TabIndicator />
|
|
36
|
+
</ArkTabs.List>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated Use `TabsList` instead.
|
|
42
|
+
*/
|
|
43
|
+
export const TabList = TabsList
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The trigger for the Tabs group.
|
|
47
|
+
* @definition [Tabs docs](https://cerberus.digitalu.design/react/tabs)
|
|
48
|
+
* @example
|
|
49
|
+
* ```tsx
|
|
50
|
+
* <Tabs>
|
|
51
|
+
* <TabList description="Profile settings">
|
|
52
|
+
* <Tab value="overview">Overview</Tab>
|
|
53
|
+
* </TabList>
|
|
54
|
+
* <TabPanel tab="overview">...</TabPanel>
|
|
55
|
+
* </Tabs>
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export function Tab(props: ArkTabs.TriggerProps) {
|
|
59
|
+
const { styles } = useTabsContext()
|
|
60
|
+
return (
|
|
61
|
+
<ArkTabs.Trigger
|
|
62
|
+
{...props}
|
|
63
|
+
className={cx(props.className, styles.trigger)}
|
|
64
|
+
/>
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* The indicator for the Tabs group which shows the active tab.
|
|
70
|
+
* @definition [Tabs docs](https://cerberus.digitalu.design/react/tabs)
|
|
71
|
+
* @example
|
|
72
|
+
* ```tsx
|
|
73
|
+
* <Tabs>
|
|
74
|
+
* <TabList description="Profile settings">
|
|
75
|
+
* <Tab value="overview">Overview</Tab>
|
|
76
|
+
* <TabsIndicator />
|
|
77
|
+
* </TabList>
|
|
78
|
+
* <TabPanel tab="overview">...</TabPanel>
|
|
79
|
+
* </Tabs>
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
export function TabIndicator(props: ArkTabs.IndicatorProps) {
|
|
83
|
+
const { styles } = useTabsContext()
|
|
84
|
+
return (
|
|
85
|
+
<ArkTabs.Indicator
|
|
86
|
+
{...props}
|
|
87
|
+
className={cx(props.className, styles.indicator)}
|
|
88
|
+
/>
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* The content for the Tabs group.
|
|
94
|
+
* @definition [Tabs docs](https://cerberus.digitalu.design/react/tabs)
|
|
95
|
+
* @example
|
|
96
|
+
* ```tsx
|
|
97
|
+
* <Tabs>
|
|
98
|
+
* <TabList description="Profile settings">
|
|
99
|
+
* <Tab value="overview">Overview</Tab>
|
|
100
|
+
* </TabList>
|
|
101
|
+
* <TabPanel tab="overview">...</TabPanel>
|
|
102
|
+
* </Tabs>
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
export function TabPanel(props: ArkTabs.ContentProps) {
|
|
106
|
+
const { styles } = useTabsContext()
|
|
107
|
+
return (
|
|
108
|
+
<ArkTabs.Content
|
|
109
|
+
{...props}
|
|
110
|
+
className={cx(props.className, styles.content)}
|
|
111
|
+
/>
|
|
112
|
+
)
|
|
113
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Em,
|
|
3
|
+
H1,
|
|
4
|
+
H2,
|
|
5
|
+
H3,
|
|
6
|
+
H4,
|
|
7
|
+
H5,
|
|
8
|
+
H6,
|
|
9
|
+
P,
|
|
10
|
+
Small,
|
|
11
|
+
Span,
|
|
12
|
+
Strong,
|
|
13
|
+
type BoxProps,
|
|
14
|
+
} from '@cerberus-design/styled-system/jsx'
|
|
15
|
+
import { type PropsWithChildren } from 'react'
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* This module exports a component for rendering text utilizing the styled-system JSX utility.
|
|
19
|
+
* @module @cerberus-design/react/Text
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
export type Headings = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'
|
|
23
|
+
export type TextElements = 'p' | 'strong' | 'em' | 'small' | 'span'
|
|
24
|
+
|
|
25
|
+
export interface TextProps extends BoxProps {
|
|
26
|
+
/**
|
|
27
|
+
* The element to render as. Defaults to 'p'.
|
|
28
|
+
*/
|
|
29
|
+
as?: TextElements | Headings
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* A component for rendering text utilizing the styled-system JSX utility.
|
|
34
|
+
* @definition [Text docs](https://cerberus.digitalu.design/react/text)
|
|
35
|
+
* @example
|
|
36
|
+
* ```tsx
|
|
37
|
+
* <Text as="h1" color="page.text.100" textStyle={{
|
|
38
|
+
* base: 'heading-md',
|
|
39
|
+
* md: 'heading-lg',
|
|
40
|
+
* }}>
|
|
41
|
+
* Hello, world!
|
|
42
|
+
* </Text>
|
|
43
|
+
*/
|
|
44
|
+
export function Text(props: PropsWithChildren<TextProps>) {
|
|
45
|
+
const { as = 'p', ...pandaJSXProps } = props
|
|
46
|
+
switch (as) {
|
|
47
|
+
case 'h1':
|
|
48
|
+
return <H1 {...pandaJSXProps} />
|
|
49
|
+
case 'h2':
|
|
50
|
+
return <H2 {...pandaJSXProps} />
|
|
51
|
+
case 'h3':
|
|
52
|
+
return <H3 {...pandaJSXProps} />
|
|
53
|
+
case 'h4':
|
|
54
|
+
return <H4 {...pandaJSXProps} />
|
|
55
|
+
case 'h5':
|
|
56
|
+
return <H5 {...pandaJSXProps} />
|
|
57
|
+
case 'h6':
|
|
58
|
+
return <H6 {...pandaJSXProps} />
|
|
59
|
+
case 'strong':
|
|
60
|
+
return <Strong {...pandaJSXProps} />
|
|
61
|
+
case 'em':
|
|
62
|
+
return <Em {...pandaJSXProps} />
|
|
63
|
+
case 'small':
|
|
64
|
+
return <Small {...pandaJSXProps} />
|
|
65
|
+
case 'span':
|
|
66
|
+
return <Span {...pandaJSXProps} />
|
|
67
|
+
default:
|
|
68
|
+
return <P {...pandaJSXProps} />
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -32,7 +32,7 @@ export interface TooltipProps {
|
|
|
32
32
|
* </Tooltip>
|
|
33
33
|
*/
|
|
34
34
|
export function Tooltip(props: TooltipProps & TooltipContentProps) {
|
|
35
|
-
const { content, children, ...nativeProps } = props
|
|
35
|
+
const { content, children, asChild, ...nativeProps } = props
|
|
36
36
|
const styles = tooltip()
|
|
37
37
|
const position = {
|
|
38
38
|
placement: props.position || 'top',
|
|
@@ -40,7 +40,7 @@ export function Tooltip(props: TooltipProps & TooltipContentProps) {
|
|
|
40
40
|
|
|
41
41
|
return (
|
|
42
42
|
<ArkTooltip.Root openDelay={400} positioning={position}>
|
|
43
|
-
<ArkTooltip.Trigger className={styles.trigger}>
|
|
43
|
+
<ArkTooltip.Trigger className={styles.trigger} asChild={asChild}>
|
|
44
44
|
{children}
|
|
45
45
|
</ArkTooltip.Trigger>
|
|
46
46
|
|
package/src/config/cerbIcons.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
+
Calendar,
|
|
2
3
|
Checkmark,
|
|
3
4
|
CheckmarkOutline,
|
|
4
5
|
ChevronDown,
|
|
6
|
+
ChevronLeft,
|
|
7
|
+
ChevronRight,
|
|
5
8
|
Close,
|
|
6
9
|
CloudUpload,
|
|
7
10
|
Information,
|
|
@@ -21,6 +24,9 @@ export type IconType = CarbonIconType | ElementType
|
|
|
21
24
|
|
|
22
25
|
export interface DefinedIcons {
|
|
23
26
|
avatar?: IconType
|
|
27
|
+
calendar?: IconType
|
|
28
|
+
calendarPrev?: IconType
|
|
29
|
+
calendarNext?: IconType
|
|
24
30
|
checkbox?: IconType
|
|
25
31
|
close?: IconType
|
|
26
32
|
confirmModal?: IconType
|
|
@@ -42,6 +48,9 @@ export interface DefinedIcons {
|
|
|
42
48
|
|
|
43
49
|
export const defaultIcons: DefinedIcons = {
|
|
44
50
|
avatar: UserFilled,
|
|
51
|
+
calendar: Calendar,
|
|
52
|
+
calendarPrev: ChevronLeft,
|
|
53
|
+
calendarNext: ChevronRight,
|
|
45
54
|
checkbox: CheckmarkIcon,
|
|
46
55
|
close: Close,
|
|
47
56
|
confirmModal: Information,
|
|
@@ -5,7 +5,7 @@ import type { SVGProps } from 'react'
|
|
|
5
5
|
* @module
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
export type CheckboxIconProps = SVGProps<SVGSVGElement>
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Checkmark icon for Checkbox component
|
|
@@ -28,7 +28,7 @@ export function CheckmarkIcon(props: CheckboxIconProps) {
|
|
|
28
28
|
)
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
export type IndeterminateIconProps = SVGProps<SVGSVGElement>
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* Indeterminate icon for Checkbox component
|
|
@@ -86,7 +86,7 @@ export interface ConfirmModalValue {
|
|
|
86
86
|
|
|
87
87
|
const ConfirmModalContext = createContext<ConfirmModalValue | null>(null)
|
|
88
88
|
|
|
89
|
-
export
|
|
89
|
+
export type ConfirmModalProviderProps = PropsWithChildren<unknown>
|
|
90
90
|
|
|
91
91
|
/**
|
|
92
92
|
* Provides a confirm modal to the app.
|
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
useContext,
|
|
7
7
|
useMemo,
|
|
8
8
|
useState,
|
|
9
|
-
type ButtonHTMLAttributes,
|
|
10
9
|
type MouseEvent,
|
|
10
|
+
type MouseEventHandler,
|
|
11
11
|
type PropsWithChildren,
|
|
12
12
|
type ReactNode,
|
|
13
13
|
} from 'react'
|
|
@@ -50,7 +50,7 @@ export interface ShowCTAModalOptions {
|
|
|
50
50
|
*/
|
|
51
51
|
actions: {
|
|
52
52
|
text: string
|
|
53
|
-
onClick:
|
|
53
|
+
onClick: MouseEventHandler<HTMLButtonElement>
|
|
54
54
|
}[]
|
|
55
55
|
}
|
|
56
56
|
|
|
@@ -60,7 +60,7 @@ export interface CTAModalValue {
|
|
|
60
60
|
|
|
61
61
|
const CTAModalContext = createContext<CTAModalValue | null>(null)
|
|
62
62
|
|
|
63
|
-
export
|
|
63
|
+
export type CTAModalProviderProps = PropsWithChildren<unknown>
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
66
|
* Provides a CTA modal to the app.
|
|
@@ -99,7 +99,7 @@ export function CTAModal(props: PropsWithChildren<CTAModalProviderProps>) {
|
|
|
99
99
|
const [content, setContent] = useState<ShowCTAModalOptions | null>(null)
|
|
100
100
|
const focusTrap = trapFocus(modalRef)
|
|
101
101
|
const FallbackIcon = $cerberusIcons.confirmModal
|
|
102
|
-
const confirmIcon = content?.icon
|
|
102
|
+
const confirmIcon = content?.icon
|
|
103
103
|
const { close: CloseIcon } = $cerberusIcons
|
|
104
104
|
|
|
105
105
|
const handleShow = useCallback(
|
|
@@ -120,9 +120,8 @@ export function CTAModal(props: PropsWithChildren<CTAModalProviderProps>) {
|
|
|
120
120
|
(event: MouseEvent<HTMLButtonElement>) => {
|
|
121
121
|
const index = event.currentTarget.getAttribute('data-index')
|
|
122
122
|
const action = content?.actions[Number(index)]
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
123
|
+
const { onClick } = action || {}
|
|
124
|
+
onClick?.(event)
|
|
126
125
|
close()
|
|
127
126
|
},
|
|
128
127
|
[content, close],
|
|
@@ -55,7 +55,7 @@ export interface NotificationsValue {
|
|
|
55
55
|
|
|
56
56
|
const NotificationsContext = createContext<NotificationsValue | null>(null)
|
|
57
57
|
|
|
58
|
-
export
|
|
58
|
+
export type NotificationsProviderProps = PortalProps
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
61
|
* Provides a notification center to the app.
|
|
@@ -85,7 +85,7 @@ export interface PromptModalValue {
|
|
|
85
85
|
|
|
86
86
|
const PromptModalContext = createContext<PromptModalValue | null>(null)
|
|
87
87
|
|
|
88
|
-
export
|
|
88
|
+
export type PromptModalProviderProps = PropsWithChildren<unknown>
|
|
89
89
|
|
|
90
90
|
/**
|
|
91
91
|
* Provides a prompt modal to the app.
|