@cerberus-design/react 0.14.2-next-81321e7 → 0.14.2-next-2f75188
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 +172 -44
- package/build/legacy/components/DatePicker.client.cjs +4 -4
- package/build/legacy/components/DatePicker.client.cjs.map +1 -1
- package/build/legacy/components/Dialog.cjs +86 -0
- package/build/legacy/components/Dialog.cjs.map +1 -0
- package/build/legacy/components/Dialog.client.cjs +95 -0
- package/build/legacy/components/Dialog.client.cjs.map +1 -0
- package/build/legacy/components/Modal.cjs.map +1 -1
- package/build/legacy/components/ModalDescription.cjs.map +1 -1
- package/build/legacy/components/ModalHeader.cjs.map +1 -1
- package/build/legacy/components/ModalHeading.cjs.map +1 -1
- package/build/legacy/context/confirm-modal.cjs.map +1 -1
- package/build/legacy/context/cta-modal.cjs.map +1 -1
- package/build/legacy/context/prompt-modal.cjs.map +1 -1
- package/build/legacy/index.cjs +598 -513
- package/build/legacy/index.cjs.map +1 -1
- package/build/modern/_tsup-dts-rollup.d.ts +172 -44
- package/build/modern/chunk-6BN3XKQF.js +42 -0
- package/build/modern/chunk-6BN3XKQF.js.map +1 -0
- package/build/modern/{chunk-2UXE5PDG.js → chunk-7NN3SJ7W.js} +1 -1
- package/build/modern/chunk-7NN3SJ7W.js.map +1 -0
- package/build/modern/{chunk-XHM46FXT.js → chunk-JAROS4Q3.js} +4 -4
- package/build/modern/{chunk-BE4EOU2P.js → chunk-JIRW4XOJ.js} +1 -1
- package/build/modern/chunk-JIRW4XOJ.js.map +1 -0
- package/build/modern/{chunk-YJI4Y7BH.js → chunk-MUTAYS3P.js} +5 -5
- package/build/modern/{chunk-XY6WL55R.js → chunk-NUMM4TNC.js} +1 -1
- package/build/modern/chunk-NUMM4TNC.js.map +1 -0
- package/build/modern/{chunk-USYM6XU6.js → chunk-O6LFWUHI.js} +4 -4
- package/build/modern/{chunk-XDDLXEFV.js → chunk-R4RFWDBM.js} +8 -8
- package/build/modern/chunk-TFL56AYR.js +56 -0
- package/build/modern/chunk-TFL56AYR.js.map +1 -0
- package/build/modern/{chunk-ZHBHPMTP.js → chunk-VGEK2DQB.js} +8 -8
- package/build/modern/{chunk-Q4JXWPU7.js → chunk-YKKNWILF.js} +12 -12
- package/build/modern/chunk-YKKNWILF.js.map +1 -0
- package/build/modern/{chunk-Q7BRMIBR.js → chunk-ZL6ZITLA.js} +1 -1
- package/build/modern/chunk-ZL6ZITLA.js.map +1 -0
- package/build/modern/components/DatePicker.client.js +4 -4
- package/build/modern/components/Dialog.client.js +10 -0
- package/build/modern/components/Dialog.client.js.map +1 -0
- package/build/modern/components/Dialog.js +24 -0
- package/build/modern/components/Dialog.js.map +1 -0
- package/build/modern/components/FileStatus.js +2 -2
- package/build/modern/components/Modal.js +1 -1
- package/build/modern/components/ModalDescription.js +1 -1
- package/build/modern/components/ModalHeader.js +1 -1
- package/build/modern/components/ModalHeading.js +1 -1
- package/build/modern/context/confirm-modal.js +5 -5
- package/build/modern/context/cta-modal.js +6 -6
- package/build/modern/context/notification-center.js +2 -2
- package/build/modern/context/prompt-modal.js +6 -6
- package/build/modern/index.js +72 -48
- package/build/modern/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/DatePicker.client.tsx +9 -5
- package/src/components/Dialog.client.tsx +39 -0
- package/src/components/Dialog.tsx +165 -0
- package/src/components/Modal.tsx +1 -16
- package/src/components/ModalDescription.tsx +1 -8
- package/src/components/ModalHeader.tsx +1 -10
- package/src/components/ModalHeading.tsx +1 -8
- package/src/index.ts +2 -0
- package/build/modern/chunk-2UXE5PDG.js.map +0 -1
- package/build/modern/chunk-BE4EOU2P.js.map +0 -1
- package/build/modern/chunk-Q4JXWPU7.js.map +0 -1
- package/build/modern/chunk-Q7BRMIBR.js.map +0 -1
- package/build/modern/chunk-XY6WL55R.js.map +0 -1
- /package/build/modern/{chunk-XHM46FXT.js.map → chunk-JAROS4Q3.js.map} +0 -0
- /package/build/modern/{chunk-YJI4Y7BH.js.map → chunk-MUTAYS3P.js.map} +0 -0
- /package/build/modern/{chunk-USYM6XU6.js.map → chunk-O6LFWUHI.js.map} +0 -0
- /package/build/modern/{chunk-XDDLXEFV.js.map → chunk-R4RFWDBM.js.map} +0 -0
- /package/build/modern/{chunk-ZHBHPMTP.js.map → chunk-VGEK2DQB.js.map} +0 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Dialog as ArkDialog,
|
|
3
|
+
type DialogContentProps as ArkDialogContentProps,
|
|
4
|
+
type DialogRootProps,
|
|
5
|
+
type DialogTitleProps,
|
|
6
|
+
} from '@ark-ui/react'
|
|
7
|
+
import {
|
|
8
|
+
dialog,
|
|
9
|
+
type DialogVariantProps,
|
|
10
|
+
} from '@cerberus/styled-system/recipes'
|
|
11
|
+
import { Portal } from './Portal'
|
|
12
|
+
import { cx } from '@cerberus/styled-system/css'
|
|
13
|
+
|
|
14
|
+
export type DialogProviderProps = DialogRootProps
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The provider that controls the dialog components.
|
|
18
|
+
* @definition [Dialog docs](https://cerberus.digitalu.design/react/dialog)
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* <DialogProvider>
|
|
22
|
+
* <DialogTrigger asChild>
|
|
23
|
+
* <Button>Open Dialog</Button>
|
|
24
|
+
* </DialogTrigger>
|
|
25
|
+
* <Dialog>
|
|
26
|
+
* <Text>Dialog Content</Text>
|
|
27
|
+
* <DialogCloseTrigger>Close</DialogCloseTrigger>
|
|
28
|
+
* </Dialog>
|
|
29
|
+
* </DialogProvider>
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export function DialogProvider(props: DialogProviderProps) {
|
|
33
|
+
return <ArkDialog.Root {...props} />
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface DialogProps
|
|
37
|
+
extends Omit<ArkDialogContentProps, 'size'>,
|
|
38
|
+
DialogVariantProps {}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The content of the dialog. Must be used within the `DialogProvider` component.
|
|
42
|
+
* @definition [Dialog docs](https://cerberus.digitalu.design/react/dialog)
|
|
43
|
+
* @example
|
|
44
|
+
* ```tsx
|
|
45
|
+
* <DialogProvider>
|
|
46
|
+
* <DialogTrigger asChild>
|
|
47
|
+
* <Button>Open Dialog</Button>
|
|
48
|
+
* </DialogTrigger>
|
|
49
|
+
* <Dialog>
|
|
50
|
+
* <Text>Dialog Content</Text>
|
|
51
|
+
* </Dialog>
|
|
52
|
+
* </DialogProvider>
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export function Dialog(props: DialogProps) {
|
|
56
|
+
const { size, ...contentProps } = props
|
|
57
|
+
const styles = dialog({ size })
|
|
58
|
+
return (
|
|
59
|
+
<Portal>
|
|
60
|
+
<DialogBackdrop className={styles.backdrop} />
|
|
61
|
+
<DialogPositioner className={styles.positioner}>
|
|
62
|
+
<DialogContent className={styles.content} {...contentProps} />
|
|
63
|
+
</DialogPositioner>
|
|
64
|
+
</Portal>
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* The heading of the dialog. Must be used within the `DialogContent` component.
|
|
70
|
+
* @definition [Dialog docs](https://cerberus.digitalu.design/react/dialog)
|
|
71
|
+
* @example
|
|
72
|
+
* ```tsx
|
|
73
|
+
* <DialogProvider>
|
|
74
|
+
* <DialogTrigger asChild>
|
|
75
|
+
* <Button>Open Dialog</Button>
|
|
76
|
+
* </DialogTrigger>
|
|
77
|
+
* <Dialog>
|
|
78
|
+
* <DialogHeading>Dialog Title</DialogHeading>
|
|
79
|
+
* <Text>Dialog Content</Text>
|
|
80
|
+
* </Dialog>
|
|
81
|
+
* </DialogProvider>
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
export function DialogHeading(props: DialogTitleProps) {
|
|
85
|
+
const styles = dialog()
|
|
86
|
+
return (
|
|
87
|
+
<ArkDialog.Title {...props} className={cx(props.className, styles.title)} />
|
|
88
|
+
)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* The description of the dialog. Must be used within the `DialogContent` component.
|
|
93
|
+
* @definition [Dialog docs](https://cerberus.digitalu.design/react/dialog)
|
|
94
|
+
* @example
|
|
95
|
+
* ```tsx
|
|
96
|
+
* <DialogProvider>
|
|
97
|
+
* <DialogTrigger asChild>
|
|
98
|
+
* <Button>Open Dialog</Button>
|
|
99
|
+
* </DialogTrigger>
|
|
100
|
+
* <Dialog>
|
|
101
|
+
* <DialogHeading>Dialog Title</DialogHeading>
|
|
102
|
+
* <DialogDescription>Dialog Description</DialogDescription>
|
|
103
|
+
* </Dialog>
|
|
104
|
+
* </DialogProvider>
|
|
105
|
+
* ```
|
|
106
|
+
*/
|
|
107
|
+
export function DialogDescription(props: DialogTitleProps) {
|
|
108
|
+
const styles = dialog()
|
|
109
|
+
return (
|
|
110
|
+
<ArkDialog.Description
|
|
111
|
+
{...props}
|
|
112
|
+
className={cx(props.className, styles.description)}
|
|
113
|
+
/>
|
|
114
|
+
)
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* The trigger that opens the dialog. Must be used within the `DialogProvider`
|
|
119
|
+
* component.
|
|
120
|
+
* @definition [Dialog docs](https://cerberus.digitalu.design/react/dialog)
|
|
121
|
+
* @example
|
|
122
|
+
* ```tsx
|
|
123
|
+
* <DialogTrigger asChild>
|
|
124
|
+
* <Button>Open Dialog</Button>
|
|
125
|
+
* </DialogTrigger>
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
export const DialogTrigger = ArkDialog.Trigger
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* The trigger that closes the dialog. Must be used within the `DialogProvider`
|
|
132
|
+
* component.
|
|
133
|
+
* @definition [Dialog docs](https://cerberus.digitalu.design/react/dialog)
|
|
134
|
+
* @example
|
|
135
|
+
* ```tsx
|
|
136
|
+
* <DialogProvider>
|
|
137
|
+
* <DialogTrigger asChild>
|
|
138
|
+
* <Button>Open Dialog</Button>
|
|
139
|
+
* </DialogTrigger>
|
|
140
|
+
* <Dialog>
|
|
141
|
+
* <Text>Dialog Content</Text>
|
|
142
|
+
* <DialogCloseTrigger>Close</DialogCloseTrigger>
|
|
143
|
+
* </Dialog>
|
|
144
|
+
* </DialogProvider>
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
export const DialogCloseTrigger = ArkDialog.CloseTrigger
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* The backdrop of the dialog. Must be used within the `DialogProvider`
|
|
151
|
+
* component.
|
|
152
|
+
*/
|
|
153
|
+
export const DialogBackdrop = ArkDialog.Backdrop
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* The positioner of the dialog. Must be used within the `DialogProvider`
|
|
157
|
+
* component.
|
|
158
|
+
*/
|
|
159
|
+
export const DialogPositioner = ArkDialog.Positioner
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* The content of the dialog. Must be used within the `DialogProvider`
|
|
163
|
+
* component.
|
|
164
|
+
*/
|
|
165
|
+
export const DialogContent = ArkDialog.Content
|
package/src/components/Modal.tsx
CHANGED
|
@@ -22,21 +22,6 @@ function ModalEl(props: ModalProps, ref: ForwardedRef<HTMLDialogElement>) {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
26
|
-
* @see https://cerberus.digitalu.design/react/modal
|
|
27
|
-
* @example
|
|
28
|
-
* ```tsx
|
|
29
|
-
* const { modalRef } = useModal()
|
|
30
|
-
*
|
|
31
|
-
* <Modal ref={modalRef}>
|
|
32
|
-
* <Avatar icon={SomeIcon} />
|
|
33
|
-
* <ModalHeader>
|
|
34
|
-
* <ModalHeading>Modal Heading</ModalHeading>
|
|
35
|
-
* <ModalDescription>Modal description</ModalDescription>
|
|
36
|
-
* </ModalHeader>
|
|
37
|
-
*
|
|
38
|
-
* {props.children}
|
|
39
|
-
* </Modal>
|
|
40
|
-
* ```
|
|
25
|
+
* @deprecated use `Dialog` instead
|
|
41
26
|
*/
|
|
42
27
|
export const Modal = forwardRef(ModalEl)
|
|
@@ -10,14 +10,7 @@ import type { HTMLAttributes } from 'react'
|
|
|
10
10
|
export type ModalDescriptionProps = HTMLAttributes<HTMLParagraphElement>
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
* @see https://cerberus.digitalu.design/react/modal
|
|
15
|
-
* @example
|
|
16
|
-
* ```tsx
|
|
17
|
-
* <Modal>
|
|
18
|
-
* <ModalDescription>Modal Heading</ModalDescription>
|
|
19
|
-
* </Modal>
|
|
20
|
-
* ```
|
|
13
|
+
* @deprecated use `DialogDescription` instead
|
|
21
14
|
*/
|
|
22
15
|
export function ModalDescription(props: ModalDescriptionProps) {
|
|
23
16
|
return <p {...props} className={cx(props.className, modal().description)} />
|
|
@@ -10,16 +10,7 @@ import type { HTMLAttributes } from 'react'
|
|
|
10
10
|
export type ModalHeaderProps = HTMLAttributes<HTMLDivElement>
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
* @see https://cerberus.digitalu.design/react/modal
|
|
15
|
-
* @example
|
|
16
|
-
* ```tsx
|
|
17
|
-
* <Modal>
|
|
18
|
-
* <ModalHeader>
|
|
19
|
-
* <h2>Modal Heading</h2>
|
|
20
|
-
* </ModalHeader>
|
|
21
|
-
* </Modal>
|
|
22
|
-
* ```
|
|
13
|
+
* @deprecated there is no replacement for this component
|
|
23
14
|
*/
|
|
24
15
|
export function ModalHeader(props: ModalHeaderProps) {
|
|
25
16
|
return (
|
|
@@ -10,14 +10,7 @@ import type { HTMLAttributes } from 'react'
|
|
|
10
10
|
export type ModalHeadingProps = HTMLAttributes<HTMLParagraphElement>
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
* @see https://cerberus.digitalu.design/react/modal
|
|
15
|
-
* @example
|
|
16
|
-
* ```tsx
|
|
17
|
-
* <Modal>
|
|
18
|
-
* <ModalHeading>Modal Heading</ModalHeading>
|
|
19
|
-
* </Modal>
|
|
20
|
-
* ```
|
|
13
|
+
* @deprecated use `DialogHeading` instead
|
|
21
14
|
*/
|
|
22
15
|
export function ModalHeading(props: ModalHeadingProps) {
|
|
23
16
|
return <p {...props} className={cx(props.className, modal().heading)} />
|
package/src/index.ts
CHANGED
|
@@ -15,6 +15,8 @@ export * from './components/Checkbox'
|
|
|
15
15
|
export * from './components/CircularProgress'
|
|
16
16
|
export * from './components/DatePicker.client'
|
|
17
17
|
export * from './components/DatePicker.server'
|
|
18
|
+
export * from './components/Dialog'
|
|
19
|
+
export * from './components/Dialog.client'
|
|
18
20
|
export * from './components/Droppable'
|
|
19
21
|
export * from './components/FieldMessage'
|
|
20
22
|
export * from './components/FeatureFlag'
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/ModalHeading.tsx"],"sourcesContent":["import { cx } from '@cerberus/styled-system/css'\nimport { modal } from '@cerberus/styled-system/recipes'\nimport type { HTMLAttributes } from 'react'\n\n/**\n * This module contains the ModalHeading component for a customizable modal.\n * @module\n */\n\nexport type ModalHeadingProps = HTMLAttributes<HTMLParagraphElement>\n\n/**\n * The ModalHeading component is a heading element for a customizable modal.\n * @see https://cerberus.digitalu.design/react/modal\n * @example\n * ```tsx\n * <Modal>\n * <ModalHeading>Modal Heading</ModalHeading>\n * </Modal>\n * ```\n */\nexport function ModalHeading(props: ModalHeadingProps) {\n return <p {...props} className={cx(props.className, modal().heading)} />\n}\n"],"mappings":";AAAA,SAAS,UAAU;AACnB,SAAS,aAAa;AAqBb;AADF,SAAS,aAAa,OAA0B;AACrD,SAAO,oBAAC,OAAG,GAAG,OAAO,WAAW,GAAG,MAAM,WAAW,MAAM,EAAE,OAAO,GAAG;AACxE;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/Modal.tsx"],"sourcesContent":["import { cx } from '@cerberus/styled-system/css'\nimport { modal } from '@cerberus/styled-system/recipes'\nimport { forwardRef, type ForwardedRef, type HTMLAttributes } from 'react'\n\n/**\n * This module contains the Modal root component for a customizable modal.\n * @module\n */\n\n// Modal\n\nexport type ModalProps = HTMLAttributes<HTMLDialogElement>\n\nfunction ModalEl(props: ModalProps, ref: ForwardedRef<HTMLDialogElement>) {\n return (\n <dialog\n {...props}\n className={cx(props.className, modal().dialog)}\n ref={ref}\n />\n )\n}\n\n/**\n * The Modal component is the root element for a customizable modal.\n * @see https://cerberus.digitalu.design/react/modal\n * @example\n * ```tsx\n * const { modalRef } = useModal()\n *\n * <Modal ref={modalRef}>\n * <Avatar icon={SomeIcon} />\n * <ModalHeader>\n * <ModalHeading>Modal Heading</ModalHeading>\n * <ModalDescription>Modal description</ModalDescription>\n * </ModalHeader>\n *\n * {props.children}\n * </Modal>\n * ```\n */\nexport const Modal = forwardRef(ModalEl)\n"],"mappings":";AAAA,SAAS,UAAU;AACnB,SAAS,aAAa;AACtB,SAAS,kBAA0D;AAa/D;AAFJ,SAAS,QAAQ,OAAmB,KAAsC;AACxE,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW,GAAG,MAAM,WAAW,MAAM,EAAE,MAAM;AAAA,MAC7C;AAAA;AAAA,EACF;AAEJ;AAoBO,IAAM,QAAQ,WAAW,OAAO;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/DatePicker.client.tsx"],"sourcesContent":["'use client'\n\nimport {\n DatePicker as ArkDP,\n type DatePickerContentProps,\n type DatePickerInputProps,\n type DatePickerRootProps,\n type DatePickerTriggerProps,\n type DatePickerViewControlProps,\n type DatePickerViewProps,\n} from '@ark-ui/react'\nimport { Portal } from './Portal'\nimport { datePicker, iconButton } from '@cerberus/styled-system/recipes'\nimport { css, cx } from '@cerberus/styled-system/css'\nimport { useFieldContext } from '../context/field'\nimport {\n DatePickerView,\n DatePickerContext,\n DatePickerTable,\n DatePickerTableHeader,\n DatePickerTableCellTrigger,\n DatePickerTableCell,\n DatePickerViewControl,\n} from './DatePicker.server'\nimport { IconButton } from './IconButton'\nimport { Button } from './Button'\nimport { useCerberusContext } from '../context/cerberus'\nimport { useMemo, type InputHTMLAttributes } from 'react'\n\n/**\n * This module contains the DatePicker client family components.\n * @module DatePicker:client\n */\n\n// We are not exposing this to the public API\nconst datePickerStyles = datePicker()\n\n/**\n * The main context provider for the DatePicker family components.\n * @definition [Date Picker docs](https://cerberus.digitalu.design/react/date-picker)\n * @example\n * ```tsx\n * <Field>\n * <DatePicker name=\"start_date\">\n * <DatePickerLabel>Start date</DatePickerLabel>\n * <DatePickerInput />\n * <DatePickerCalendar />\n * </DatePicker>\n * </Field>\n * ```\n */\nexport function DatePicker(props: DatePickerRootProps) {\n const states = useFieldContext()\n\n // TODO: Remove this once the bug is fixed: https://github.com/chakra-ui/ark/issues/3112\n\n // There is a bug with the Root component that causes random date selection\n // onBlur after the first selection if the format prop is used.\n // const handleFormat = useCallback((value: DateValue) => {\n // return formatISOToMilitary(value.toString())\n // }, [])\n\n return (\n <ArkDP.Root\n {...props}\n {...states}\n positioning={{\n placement: 'bottom-start',\n }}\n />\n )\n}\n\n/**\n * An abstraction of the DatePicker control that contains the prev, view, and\n * next triggers which control the calendar output.\n * @definition [datePicker docs](https://cerberus.digitalu.design/react/date-picker)\n * @example\n * ```tsx\n * <DatePickerViewControlGroup />\n * ```\n */\nexport function DatePickerViewControlGroup(props: DatePickerViewControlProps) {\n const { icons } = useCerberusContext()\n const { calendarPrev: PrevIcon, calendarNext: NextIcon } = icons\n return (\n <DatePickerViewControl {...props}>\n <ArkDP.PrevTrigger asChild>\n <IconButton ariaLabel=\"Previous\" size=\"sm\">\n <PrevIcon />\n </IconButton>\n </ArkDP.PrevTrigger>\n\n <ArkDP.ViewTrigger asChild>\n <Button\n className={css({\n h: '2rem',\n paddingInline: 'md',\n })}\n shape=\"rounded\"\n size=\"sm\"\n usage=\"ghost\"\n >\n <ArkDP.RangeText />\n </Button>\n </ArkDP.ViewTrigger>\n\n <ArkDP.NextTrigger asChild>\n <IconButton ariaLabel=\"Next\" size=\"sm\">\n <NextIcon />\n </IconButton>\n </ArkDP.NextTrigger>\n </DatePickerViewControl>\n )\n}\n\n/**\n * The trigger component for the DatePicker which opens the calendar.\n * @definition [datePicker docs](https://cerberus.digitalu.design/react/date-picker)\n * @example\n * ```tsx\n * <DatePickerTrigger />\n * ```\n */\nexport function DatePickerTrigger(props: DatePickerTriggerProps) {\n const { icons } = useCerberusContext()\n const { calendar: CalendarIcon } = icons\n return (\n <ArkDP.Trigger\n {...props}\n className={cx(\n props.className,\n iconButton({\n size: 'sm',\n usage: 'ghost',\n }),\n datePickerStyles.trigger,\n )}\n >\n <CalendarIcon />\n </ArkDP.Trigger>\n )\n}\n\n/**\n * The input component for the DatePicker.\n * @definition [Date Picker docs](https://cerberus.digitalu.design/react/date-picker)\n * @example\n * ```tsx\n * <Field>\n * <DatePicker name=\"start_date\">\n * <DatePickerLabel>Start date</DatePickerLabel>\n * <DatePickerInput />\n * <DatePickerCalendar />\n * </DatePicker>\n * </Field>\n * ```\n */\nexport function DatePickerInput(props: DatePickerInputProps) {\n const { invalid, ...fieldStates } = useFieldContext()\n return (\n <ArkDP.Control className={datePickerStyles.control}>\n <DatePickerTrigger />\n <ArkDP.Input\n {...props}\n {...fieldStates}\n {...(invalid && { 'aria-invalid': true })}\n className={cx(props.className, datePickerStyles.input)}\n placeholder={props.placeholder ?? 'DD MMM YYYY'}\n maxLength={11}\n />\n </ArkDP.Control>\n )\n}\n\nexport interface RangePickerInputProps\n extends Omit<DatePickerInputProps, 'defaultValue'> {\n /**\n * The defaultValue to add for the inputs. The first item is the start date\n * and the second item is the end date.\n */\n defaultValue?: [\n InputHTMLAttributes<HTMLInputElement>['defaultValue'],\n InputHTMLAttributes<HTMLInputElement>['defaultValue'],\n ]\n}\n\n/**\n * The input component for the DatePicker that uses ranges.\n * @definition [Date Picker docs](https://cerberus.digitalu.design/react/date-picker)\n * @example\n * ```tsx\n * <Field>\n * <DatePicker name=\"start_date\" selection=\"range\">\n * <DatePickerLabel>Start date</DatePickerLabel>\n * <RangePickerInput />\n * <DatePickerCalendar />\n * </DatePicker>\n * </Field>\n * ```\n */\nexport function RangePickerInput(props: RangePickerInputProps) {\n const { invalid, ...fieldStates } = useFieldContext()\n const { defaultValue, ...nativeProps } = props\n\n const startDate = useMemo(() => defaultValue?.[0], [defaultValue])\n const endDate = useMemo(() => defaultValue?.[1], [defaultValue])\n\n return (\n <ArkDP.Control data-range className={datePickerStyles.control}>\n <DatePickerTrigger />\n <ArkDP.Input\n {...nativeProps}\n {...fieldStates}\n {...(invalid && { 'aria-invalid': true })}\n data-range-input\n defaultValue={startDate}\n className={cx(props.className, datePickerStyles.input)}\n placeholder={props.placeholder ?? 'DD MMM YYYY'}\n maxLength={11}\n index={0}\n />\n <ArkDP.Input\n {...nativeProps}\n {...fieldStates}\n {...(invalid && { 'aria-invalid': true })}\n data-range-input\n defaultValue={endDate}\n data-range-end-input\n className={cx(props.className, datePickerStyles.input)}\n placeholder={props.placeholder ?? 'DD MMM YYYY'}\n maxLength={11}\n index={1}\n />\n </ArkDP.Control>\n )\n}\n\n/**\n * The content component for the DatePicker which contains the calendar.\n * @definition [Date Picker docs](https://cerberus.digitalu.design/react/date-picker)\n * @example\n * ```tsx\n * <Field>\n * <DatePicker name=\"start_date\">\n * <DatePickerLabel>Start date</DatePickerLabel>\n * <DatePickerInput />\n * <DatePickerCalendar />\n * </DatePicker>\n * </Field>\n * ```\n */\nexport function DatePickerContent(props: DatePickerContentProps) {\n const { children, ...contentProps } = props\n return (\n <Portal>\n <ArkDP.Positioner className={datePickerStyles.positioner}>\n <ArkDP.Content\n {...contentProps}\n className={cx(contentProps.className, datePickerStyles.content)}\n >\n {children}\n </ArkDP.Content>\n </ArkDP.Positioner>\n </Portal>\n )\n}\n\n/**\n * The day view component for the DatePicker.\n * @definition [Date Picker docs](https://cerberus.digitalu.design/react/date-picker)\n * @example\n * ```tsx\n * <Field>\n * <DatePicker name=\"start_date\">\n * <DatePickerLabel>Start date</DatePickerLabel>\n * <DatePickerInput />\n * <DatePickerCalendar />\n * </DatePicker>\n * </Field>\n * ```\n */\nexport function DatePickerDayView(props: Omit<DatePickerViewProps, 'view'>) {\n function isToday(date: ArkDP.DateValue): boolean {\n const today = new Date()\n const formatted = today.toISOString().split('T')[0]\n const arkDate = `${date.year}-${String(date.month).padStart(2, '0')}-${String(date.day).padStart(2, '0')}`\n return formatted === arkDate\n }\n\n function isPastDay(date: ArkDP.DateValue): boolean {\n const today = new Date()\n const arkDate = `${date.year}-${String(date.month).padStart(2, '0')}-${String(date.day).padStart(2, '0')}`\n return new Date(arkDate) < today\n }\n\n function getDayValue(date: ArkDP.DateValue): 'today' | 'past' | 'future' {\n if (isToday(date)) return 'today'\n if (isPastDay(date)) return 'past'\n return 'future'\n }\n\n return (\n <DatePickerView {...props} view=\"day\">\n <DatePickerContext>\n {(datePicker) => (\n <>\n <DatePickerViewControlGroup />\n\n <DatePickerTable>\n <ArkDP.TableHead>\n <ArkDP.TableRow>\n {datePicker.weekDays.map((weekDay, id) => (\n <DatePickerTableHeader key={id}>\n {weekDay.narrow}\n </DatePickerTableHeader>\n ))}\n </ArkDP.TableRow>\n </ArkDP.TableHead>\n\n <ArkDP.TableBody>\n {datePicker.weeks.map((week, id) => (\n <ArkDP.TableRow key={id}>\n {week.map((day, id) => (\n <DatePickerTableCell key={id} value={day}>\n <DatePickerTableCellTrigger\n data-date={getDayValue(day)}\n >\n {day.day}\n </DatePickerTableCellTrigger>\n </DatePickerTableCell>\n ))}\n </ArkDP.TableRow>\n ))}\n </ArkDP.TableBody>\n </DatePickerTable>\n </>\n )}\n </DatePickerContext>\n </DatePickerView>\n )\n}\n\n/**\n * The month view component for the DatePicker.\n * @definition [Date Picker docs](https://cerberus.digitalu.design/react/date-picker)\n * @example\n * ```tsx\n * <Field>\n * <DatePicker name=\"start_date\">\n * <DatePickerLabel>Start date</DatePickerLabel>\n * <DatePickerInput />\n * <DatePickerCalendar />\n * </DatePicker>\n * </Field>\n * ```\n */\nexport function DatePickerMonthView(props: Omit<DatePickerViewProps, 'view'>) {\n return (\n <ArkDP.View {...props} view=\"month\">\n <ArkDP.Context>\n {(datePicker) => (\n <>\n <DatePickerViewControlGroup />\n\n <DatePickerTable>\n <ArkDP.TableBody>\n {datePicker\n .getMonthsGrid({ columns: 4, format: 'short' })\n .map((months, id) => (\n <ArkDP.TableRow key={id}>\n {months.map((month, id) => (\n <DatePickerTableCell key={id} value={month.value}>\n <DatePickerTableCellTrigger>\n {month.label}\n </DatePickerTableCellTrigger>\n </DatePickerTableCell>\n ))}\n </ArkDP.TableRow>\n ))}\n </ArkDP.TableBody>\n </DatePickerTable>\n </>\n )}\n </ArkDP.Context>\n </ArkDP.View>\n )\n}\n\n/**\n * The year view component for the DatePicker.\n * @definition [Date Picker docs](https://cerberus.digitalu.design/react/date-picker)\n * @example\n * ```tsx\n * <Field>\n * <DatePicker name=\"start_date\">\n * <DatePickerLabel>Start date</DatePickerLabel>\n * <DatePickerInput />\n * <DatePickerCalendar />\n * </DatePicker>\n * </Field>\n * ```\n */\nexport function DatePickerYearView(props: Omit<DatePickerViewProps, 'view'>) {\n return (\n <ArkDP.View {...props} view=\"year\">\n <ArkDP.Context>\n {(datePicker) => (\n <>\n <DatePickerViewControlGroup />\n\n <DatePickerTable>\n <ArkDP.TableBody>\n {datePicker.getYearsGrid({ columns: 4 }).map((years, id) => (\n <ArkDP.TableRow key={id}>\n {years.map((year, id) => (\n <DatePickerTableCell key={id} value={year.value}>\n <DatePickerTableCellTrigger>\n {year.label}\n </DatePickerTableCellTrigger>\n </DatePickerTableCell>\n ))}\n </ArkDP.TableRow>\n ))}\n </ArkDP.TableBody>\n </DatePickerTable>\n </>\n )}\n </ArkDP.Context>\n </ArkDP.View>\n )\n}\n\n/**\n * An abstraction of the DatePicker content components that contain the\n * different calendar views and controls.\n * @definition [Date Picker docs](https://cerberus.digitalu.design/react/date-picker)\n * @example\n * ```tsx\n * <Field>\n * <DatePicker name=\"start_date\">\n * <DatePickerLabel>Start date</DatePickerLabel>\n * <DatePickerInput />\n * <DatePickerCalendar />\n * </DatePicker>\n * </Field>\n * ```\n */\nexport function DatePickerCalendar() {\n return (\n <DatePickerContent>\n <DatePickerDayView />\n <DatePickerMonthView />\n <DatePickerYearView />\n </DatePickerContent>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;AAAA,EACE,cAAc;AAAA,OAOT;AAEP,SAAS,YAAY,kBAAkB;AACvC,SAAS,KAAK,UAAU;AAcxB,SAAS,eAAyC;AAoC9C,SAmPM,UAnPN,KAuBA,YAvBA;AA5BJ,IAAM,mBAAmB,WAAW;AAgB7B,SAAS,WAAW,OAA4B;AACrD,QAAM,SAAS,gBAAgB;AAU/B,SACE;AAAA,IAAC,MAAM;AAAA,IAAN;AAAA,MACE,GAAG;AAAA,MACH,GAAG;AAAA,MACJ,aAAa;AAAA,QACX,WAAW;AAAA,MACb;AAAA;AAAA,EACF;AAEJ;AAWO,SAAS,2BAA2B,OAAmC;AAC5E,QAAM,EAAE,MAAM,IAAI,mBAAmB;AACrC,QAAM,EAAE,cAAc,UAAU,cAAc,SAAS,IAAI;AAC3D,SACE,qBAAC,yBAAuB,GAAG,OACzB;AAAA,wBAAC,MAAM,aAAN,EAAkB,SAAO,MACxB,8BAAC,cAAW,WAAU,YAAW,MAAK,MACpC,8BAAC,YAAS,GACZ,GACF;AAAA,IAEA,oBAAC,MAAM,aAAN,EAAkB,SAAO,MACxB;AAAA,MAAC;AAAA;AAAA,QACC,WAAW,IAAI;AAAA,UACb,GAAG;AAAA,UACH,eAAe;AAAA,QACjB,CAAC;AAAA,QACD,OAAM;AAAA,QACN,MAAK;AAAA,QACL,OAAM;AAAA,QAEN,8BAAC,MAAM,WAAN,EA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c,EAAE,SAAS,GAAG,QAAQ,QAAQ,CAAC,EAC7C,IAAI,CAAC,QAAQ,OACZ,oBAAC,MAAM,UAAN,EACE,iBAAO,IAAI,CAAC,OAAOC,QAClB,oBAAC,uBAA6B,OAAO,MAAM,OACzC,8BAAC,8BACE,gBAAM,OACT,KAHwBA,GAI1B,CACD,KAPkB,EAQrB,CACD,GACL,GACF;AAAA,KACF,GAEJ,GACF;AAEJ;AAgBO,SAAS,mBAAmB,OAA0C;AAC3E,SACE,oBAAC,MAAM,MAAN,EAAY,GAAG,OAAO,MAAK,QAC1B,8BAAC,MAAM,SAAN,EACE,WAACD,gBACA,iCACE;AAAA,wBAAC,8BAA2B;AAAA,IAE5B,oBAAC,mBACC,8BAAC,MAAM,WAAN,EACE,UAAAA,YAAW,aAAa,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,CAAC,OAAO,OACnD,oBAAC,MAAM,UAAN,EACE,gBAAM,IAAI,CAAC,MAAMC,QAChB,oBAAC,uBAA6B,OAAO,KAAK,OACxC,8BAAC,8BACE,eAAK,OACR,KAHwBA,GAI1B,CACD,KAPkB,EAQrB,CACD,GACH,GACF;AAAA,KACF,GAEJ,GACF;AAEJ;AAiBO,SAAS,qBAAqB;AACnC,SACE,qBAAC,qBACC;AAAA,wBAAC,qBAAkB;AAAA,IACnB,oBAAC,uBAAoB;AAAA,IACrB,oBAAC,sBAAmB;AAAA,KACtB;AAEJ;","names":["datePicker","id"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/ModalDescription.tsx"],"sourcesContent":["import { cx } from '@cerberus/styled-system/css'\nimport { modal } from '@cerberus/styled-system/recipes'\nimport type { HTMLAttributes } from 'react'\n\n/**\n * This module contains the ModalDescription component for a customizable modal.\n * @module\n */\n\nexport type ModalDescriptionProps = HTMLAttributes<HTMLParagraphElement>\n\n/**\n * The ModalDescription component is a heading element for a customizable modal.\n * @see https://cerberus.digitalu.design/react/modal\n * @example\n * ```tsx\n * <Modal>\n * <ModalDescription>Modal Heading</ModalDescription>\n * </Modal>\n * ```\n */\nexport function ModalDescription(props: ModalDescriptionProps) {\n return <p {...props} className={cx(props.className, modal().description)} />\n}\n"],"mappings":";AAAA,SAAS,UAAU;AACnB,SAAS,aAAa;AAqBb;AADF,SAAS,iBAAiB,OAA8B;AAC7D,SAAO,oBAAC,OAAG,GAAG,OAAO,WAAW,GAAG,MAAM,WAAW,MAAM,EAAE,WAAW,GAAG;AAC5E;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/ModalHeader.tsx"],"sourcesContent":["import { cx } from '@cerberus/styled-system/css'\nimport { vstack } from '@cerberus/styled-system/patterns'\nimport type { HTMLAttributes } from 'react'\n\n/**\n * This module contains the ModalHeader component for a customizable modal.\n * @module\n */\n\nexport type ModalHeaderProps = HTMLAttributes<HTMLDivElement>\n\n/**\n * The ModalHeader component is a header element for a customizable modal.\n * @see https://cerberus.digitalu.design/react/modal\n * @example\n * ```tsx\n * <Modal>\n * <ModalHeader>\n * <h2>Modal Heading</h2>\n * </ModalHeader>\n * </Modal>\n * ```\n */\nexport function ModalHeader(props: ModalHeaderProps) {\n return (\n <div\n {...props}\n className={cx(\n props.className,\n vstack({\n alignItems: 'flex-start',\n gap: 'md',\n position: 'relative',\n }),\n )}\n />\n )\n}\n"],"mappings":";AAAA,SAAS,UAAU;AACnB,SAAS,cAAc;AAwBnB;AAFG,SAAS,YAAY,OAAyB;AACnD,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW;AAAA,QACT,MAAM;AAAA,QACN,OAAO;AAAA,UACL,YAAY;AAAA,UACZ,KAAK;AAAA,UACL,UAAU;AAAA,QACZ,CAAC;AAAA,MACH;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|