@cerberus-design/react 0.16.0-next-22894bb → 0.16.0-next-1e5283a
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 +108 -90
- package/build/legacy/components/cta-dialog/index.cjs +91 -65
- package/build/legacy/components/cta-dialog/index.cjs.map +1 -1
- package/build/legacy/components/cta-dialog/provider.cjs +91 -65
- package/build/legacy/components/cta-dialog/provider.cjs.map +1 -1
- package/build/legacy/components/{Dialog.client.cjs → dialog/close-icon-trigger.cjs} +36 -28
- package/build/legacy/components/dialog/close-icon-trigger.cjs.map +1 -0
- package/build/legacy/components/dialog/dialog.cjs +80 -0
- package/build/legacy/components/dialog/dialog.cjs.map +1 -0
- package/build/legacy/components/dialog/index.cjs +208 -0
- package/build/legacy/components/dialog/index.cjs.map +1 -0
- package/build/legacy/components/dialog/parts.cjs +109 -0
- package/build/legacy/components/dialog/parts.cjs.map +1 -0
- package/build/legacy/components/dialog/primitives.cjs +112 -0
- package/build/legacy/components/dialog/primitives.cjs.map +1 -0
- package/build/legacy/context/confirm-modal.cjs +78 -49
- package/build/legacy/context/confirm-modal.cjs.map +1 -1
- package/build/legacy/context/notification-center.cjs +3 -9
- package/build/legacy/context/notification-center.cjs.map +1 -1
- package/build/legacy/context/prompt-modal.cjs +84 -58
- package/build/legacy/context/prompt-modal.cjs.map +1 -1
- package/build/legacy/index.cjs +489 -437
- package/build/legacy/index.cjs.map +1 -1
- package/build/modern/_tsup-dts-rollup.d.ts +108 -90
- package/build/modern/{chunk-QEM3M4N3.js → chunk-4WKM2MJC.js} +9 -7
- package/build/modern/chunk-4WKM2MJC.js.map +1 -0
- package/build/modern/{chunk-H5WNUPGH.js → chunk-6DAOKE6Z.js} +1 -1
- package/build/modern/{chunk-H5WNUPGH.js.map → chunk-6DAOKE6Z.js.map} +1 -1
- package/build/modern/chunk-C45HS2C4.js +22 -0
- package/build/modern/chunk-C45HS2C4.js.map +1 -0
- package/build/modern/{chunk-ZFFW5ELD.js → chunk-CF3EHG42.js} +4 -4
- package/build/modern/chunk-D7UIWAFO.js +84 -0
- package/build/modern/chunk-D7UIWAFO.js.map +1 -0
- package/build/modern/chunk-DJOYRUNT.js +1 -0
- package/build/modern/chunk-FCSO6N2Y.js +27 -0
- package/build/modern/chunk-FCSO6N2Y.js.map +1 -0
- package/build/modern/{chunk-H54FR7IP.js → chunk-MTZDZXZM.js} +8 -6
- package/build/modern/{chunk-H54FR7IP.js.map → chunk-MTZDZXZM.js.map} +1 -1
- package/build/modern/{chunk-6BN3XKQF.js → chunk-NZKE7C53.js} +8 -8
- package/build/modern/chunk-NZKE7C53.js.map +1 -0
- package/build/modern/{chunk-O542MPR7.js → chunk-OOUNB643.js} +8 -6
- package/build/modern/{chunk-O542MPR7.js.map → chunk-OOUNB643.js.map} +1 -1
- package/build/modern/components/FileStatus.js +2 -2
- package/build/modern/components/cta-dialog/index.js +8 -5
- package/build/modern/components/cta-dialog/provider.js +7 -4
- package/build/modern/components/dialog/close-icon-trigger.js +11 -0
- package/build/modern/components/dialog/dialog.js +9 -0
- package/build/modern/components/dialog/dialog.js.map +1 -0
- package/build/modern/components/dialog/index.js +39 -0
- package/build/modern/components/dialog/index.js.map +1 -0
- package/build/modern/components/dialog/parts.js +8 -0
- package/build/modern/components/dialog/parts.js.map +1 -0
- package/build/modern/components/{Dialog.js → dialog/primitives.js} +4 -5
- package/build/modern/components/dialog/primitives.js.map +1 -0
- package/build/modern/components/select/index.js +4 -4
- package/build/modern/context/confirm-modal.js +7 -2
- package/build/modern/context/notification-center.js +1 -1
- package/build/modern/context/prompt-modal.js +7 -2
- package/build/modern/index.js +56 -47
- package/build/modern/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/cta-dialog/provider.tsx +2 -2
- package/src/components/{Dialog.client.tsx → dialog/close-icon-trigger.tsx} +11 -13
- package/src/components/dialog/dialog.tsx +41 -0
- package/src/components/dialog/index.ts +4 -0
- package/src/components/dialog/parts.ts +71 -0
- package/src/components/dialog/primitives.tsx +116 -0
- package/src/context/confirm-modal.tsx +1 -1
- package/src/context/notification-center.tsx +3 -3
- package/src/context/prompt-modal.tsx +1 -1
- package/src/index.ts +1 -2
- package/build/legacy/components/Dialog.cjs +0 -86
- package/build/legacy/components/Dialog.cjs.map +0 -1
- package/build/legacy/components/Dialog.client.cjs.map +0 -1
- package/build/modern/chunk-6BN3XKQF.js.map +0 -1
- package/build/modern/chunk-QEM3M4N3.js.map +0 -1
- package/build/modern/chunk-TFL56AYR.js +0 -56
- package/build/modern/chunk-TFL56AYR.js.map +0 -1
- package/build/modern/components/Dialog.client.js +0 -10
- package/src/components/Dialog.tsx +0 -165
- /package/build/modern/{chunk-ZFFW5ELD.js.map → chunk-CF3EHG42.js.map} +0 -0
- /package/build/modern/{components/Dialog.client.js.map → chunk-DJOYRUNT.js.map} +0 -0
- /package/build/modern/components/{Dialog.js.map → dialog/close-icon-trigger.js.map} +0 -0
|
@@ -1,29 +1,27 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from '
|
|
3
|
+
import { type DialogCloseTriggerProps } from '@ark-ui/react/dialog'
|
|
4
|
+
import { useCerberusContext } from '../../context/cerberus'
|
|
5
|
+
import { IconButton } from '../IconButton'
|
|
6
|
+
import { DialogCloseTrigger } from './primitives'
|
|
7
7
|
import { dialog } from '@cerberus/styled-system/recipes'
|
|
8
8
|
import { cx } from '@cerberus/styled-system/css'
|
|
9
|
-
import { IconButton } from './IconButton'
|
|
10
|
-
import { useCerberusContext } from '../context/cerberus'
|
|
11
9
|
|
|
12
10
|
/**
|
|
13
|
-
* This module contains
|
|
14
|
-
* @module
|
|
11
|
+
* This module contains the close trigger for the dialog.
|
|
12
|
+
* @module react/dialog
|
|
15
13
|
*/
|
|
16
14
|
|
|
17
15
|
export function DialogCloseIconTrigger(props: DialogCloseTriggerProps) {
|
|
16
|
+
const styles = dialog()
|
|
17
|
+
|
|
18
18
|
const { icons } = useCerberusContext()
|
|
19
19
|
const { close: CloseIcon } = icons
|
|
20
20
|
|
|
21
|
-
const styles = dialog()
|
|
22
|
-
|
|
23
21
|
return (
|
|
24
|
-
<
|
|
22
|
+
<DialogCloseTrigger
|
|
25
23
|
{...props}
|
|
26
|
-
className={cx(
|
|
24
|
+
className={cx(styles.closeTrigger, props.className)}
|
|
27
25
|
asChild
|
|
28
26
|
>
|
|
29
27
|
<IconButton
|
|
@@ -34,6 +32,6 @@ export function DialogCloseIconTrigger(props: DialogCloseTriggerProps) {
|
|
|
34
32
|
>
|
|
35
33
|
<CloseIcon />
|
|
36
34
|
</IconButton>
|
|
37
|
-
</
|
|
35
|
+
</DialogCloseTrigger>
|
|
38
36
|
)
|
|
39
37
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { DialogContentProps } from '@ark-ui/react/dialog'
|
|
2
|
+
import type { DialogVariantProps } from '@cerberus/styled-system/recipes'
|
|
3
|
+
import { Portal } from '../Portal'
|
|
4
|
+
import { DialogBackdrop, DialogContent, DialogPositioner } from './primitives'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* This module contains and abstraction of the Dialog primitives.
|
|
8
|
+
* @module 'dialog'
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export interface DialogProps
|
|
12
|
+
extends Omit<DialogContentProps, 'size'>,
|
|
13
|
+
DialogVariantProps {}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* An abstraction of the Dialog primitives that controls the content of the
|
|
17
|
+
* dialog. Must be used within the `DialogProvider` component.
|
|
18
|
+
* @definition [Dialog docs](https://cerberus.digitalu.design/react/dialog)
|
|
19
|
+
* @definition [Ark Dialog docs](https://ark-ui.com/react/docs/components/dialog)
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* <DialogProvider>
|
|
23
|
+
* <DialogTrigger asChild>
|
|
24
|
+
* <Button>Open Dialog</Button>
|
|
25
|
+
* </DialogTrigger>
|
|
26
|
+
* <Dialog>
|
|
27
|
+
* <Text>Dialog Content</Text>
|
|
28
|
+
* </Dialog>
|
|
29
|
+
* </DialogProvider>
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export function Dialog(props: DialogProps) {
|
|
33
|
+
return (
|
|
34
|
+
<Portal>
|
|
35
|
+
<DialogBackdrop />
|
|
36
|
+
<DialogPositioner>
|
|
37
|
+
<DialogContent {...props} />
|
|
38
|
+
</DialogPositioner>
|
|
39
|
+
</Portal>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { ElementType } from 'react'
|
|
2
|
+
import {
|
|
3
|
+
DialogBackdrop,
|
|
4
|
+
DialogCloseTrigger,
|
|
5
|
+
DialogContent,
|
|
6
|
+
DialogDescription,
|
|
7
|
+
DialogHeading,
|
|
8
|
+
DialogPositioner,
|
|
9
|
+
DialogRoot,
|
|
10
|
+
DialogTrigger,
|
|
11
|
+
} from './primitives'
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* This module contains the parts of the Dialog component.
|
|
15
|
+
* @module 'dialog/parts'
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
interface DialogPartsValue {
|
|
19
|
+
/**
|
|
20
|
+
* The context provider of the dialog.
|
|
21
|
+
*/
|
|
22
|
+
Root: ElementType
|
|
23
|
+
/**
|
|
24
|
+
* The trigger that opens the dialog.
|
|
25
|
+
*/
|
|
26
|
+
Trigger: ElementType
|
|
27
|
+
/**
|
|
28
|
+
* The overlay of the dialog.
|
|
29
|
+
*/
|
|
30
|
+
Backdrop: ElementType
|
|
31
|
+
/**
|
|
32
|
+
* The container that positions the dialog.
|
|
33
|
+
*/
|
|
34
|
+
Positioner: ElementType
|
|
35
|
+
/**
|
|
36
|
+
* The visible content of the dialog.
|
|
37
|
+
*/
|
|
38
|
+
Content: ElementType
|
|
39
|
+
/**
|
|
40
|
+
* The heading of the dialog.
|
|
41
|
+
*/
|
|
42
|
+
Heading: ElementType
|
|
43
|
+
/**
|
|
44
|
+
* The description of the dialog.
|
|
45
|
+
*/
|
|
46
|
+
Description: ElementType
|
|
47
|
+
/**
|
|
48
|
+
* The trigger that closes the dialog.
|
|
49
|
+
*/
|
|
50
|
+
CloseTrigger: ElementType
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* An Object containing the parts of the dialog component. For users that
|
|
55
|
+
* prefer Object component syntax.
|
|
56
|
+
*
|
|
57
|
+
* @remarks
|
|
58
|
+
*
|
|
59
|
+
* When using object component syntax, you import the DialogParts object and
|
|
60
|
+
* the entire family of components vs. only what you use.
|
|
61
|
+
*/
|
|
62
|
+
export const DialogParts: DialogPartsValue = {
|
|
63
|
+
Root: DialogRoot,
|
|
64
|
+
Trigger: DialogTrigger,
|
|
65
|
+
Backdrop: DialogBackdrop,
|
|
66
|
+
Positioner: DialogPositioner,
|
|
67
|
+
Content: DialogContent,
|
|
68
|
+
Heading: DialogHeading,
|
|
69
|
+
Description: DialogDescription,
|
|
70
|
+
CloseTrigger: DialogCloseTrigger,
|
|
71
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Dialog,
|
|
3
|
+
type DialogBackdropProps,
|
|
4
|
+
type DialogContentProps,
|
|
5
|
+
type DialogDescriptionProps,
|
|
6
|
+
type DialogPositionerProps,
|
|
7
|
+
type DialogRootProps,
|
|
8
|
+
type DialogTitleProps,
|
|
9
|
+
type DialogTriggerProps,
|
|
10
|
+
} from '@ark-ui/react/dialog'
|
|
11
|
+
import { cx } from '@cerberus/styled-system/css'
|
|
12
|
+
import {
|
|
13
|
+
dialog,
|
|
14
|
+
type DialogVariantProps,
|
|
15
|
+
} from '@cerberus/styled-system/recipes'
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* This module contains the primitives of the Dialog component.
|
|
19
|
+
* @module 'dialog/primitives'
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The provider that controls the dialog components.
|
|
24
|
+
*/
|
|
25
|
+
export function DialogRoot(props: DialogRootProps) {
|
|
26
|
+
return <Dialog.Root {...props} />
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The trigger that opens the dialog.
|
|
31
|
+
*/
|
|
32
|
+
export function DialogTrigger(props: DialogTriggerProps) {
|
|
33
|
+
const styles = dialog()
|
|
34
|
+
return (
|
|
35
|
+
<Dialog.Trigger
|
|
36
|
+
{...props}
|
|
37
|
+
className={cx(styles.trigger, props.className)}
|
|
38
|
+
/>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* The overlay of the dialog.
|
|
44
|
+
*/
|
|
45
|
+
export function DialogBackdrop(props: DialogBackdropProps) {
|
|
46
|
+
const styles = dialog()
|
|
47
|
+
return (
|
|
48
|
+
<Dialog.Backdrop
|
|
49
|
+
{...props}
|
|
50
|
+
className={cx(styles.backdrop, props.className)}
|
|
51
|
+
/>
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* The container that positions the dialog.
|
|
57
|
+
*/
|
|
58
|
+
export function DialogPositioner(props: DialogPositionerProps) {
|
|
59
|
+
const styles = dialog()
|
|
60
|
+
return (
|
|
61
|
+
<Dialog.Positioner
|
|
62
|
+
{...props}
|
|
63
|
+
className={cx(styles.positioner, props.className)}
|
|
64
|
+
/>
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* The visible content of the dialog.
|
|
70
|
+
*/
|
|
71
|
+
export function DialogContent(props: DialogContentProps & DialogVariantProps) {
|
|
72
|
+
const { size, ...contentProps } = props
|
|
73
|
+
const styles = dialog({ size })
|
|
74
|
+
return (
|
|
75
|
+
<Dialog.Content
|
|
76
|
+
{...contentProps}
|
|
77
|
+
className={cx(styles.content, contentProps.className)}
|
|
78
|
+
/>
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* The heading of the dialog.
|
|
84
|
+
*/
|
|
85
|
+
export function DialogHeading(props: DialogTitleProps) {
|
|
86
|
+
const styles = dialog()
|
|
87
|
+
return (
|
|
88
|
+
<Dialog.Title {...props} className={cx(styles.title, props.className)} />
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* The description of the dialog.
|
|
94
|
+
*/
|
|
95
|
+
export function DialogDescription(props: DialogDescriptionProps) {
|
|
96
|
+
const styles = dialog()
|
|
97
|
+
return (
|
|
98
|
+
<Dialog.Description
|
|
99
|
+
{...props}
|
|
100
|
+
className={cx(styles.description, props.className)}
|
|
101
|
+
/>
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* The trigger that closes the dialog.
|
|
107
|
+
*/
|
|
108
|
+
export function DialogCloseTrigger(props: DialogTriggerProps) {
|
|
109
|
+
return <Dialog.CloseTrigger {...props} />
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* The provider that controls the dialog components. This is a named export of
|
|
114
|
+
* the DialogRoot primitive.
|
|
115
|
+
*/
|
|
116
|
+
export const DialogProvider = DialogRoot
|
|
@@ -10,15 +10,15 @@ import {
|
|
|
10
10
|
type PropsWithChildren,
|
|
11
11
|
type ReactNode,
|
|
12
12
|
} from 'react'
|
|
13
|
+
import { animateIn, vstack } from '@cerberus/styled-system/patterns'
|
|
14
|
+
import { notification } from '@cerberus/styled-system/recipes'
|
|
15
|
+
import { cx } from '@cerberus/styled-system/css'
|
|
13
16
|
import { Show } from '../components/Show'
|
|
14
17
|
import { NotificationHeading } from '../components/NotificationHeading'
|
|
15
18
|
import { NotificationDescription } from '../components/NotificationDescription'
|
|
16
19
|
import { Notification } from '../components/Notification'
|
|
17
|
-
import { animateIn, vstack } from '@cerberus/styled-system/patterns'
|
|
18
20
|
import { Portal, type PortalProps } from '../components/Portal'
|
|
19
|
-
import { notification } from '@cerberus/styled-system/recipes'
|
|
20
21
|
import { Button } from '../components/button/button'
|
|
21
|
-
import { cx } from '@cerberus/styled-system/css'
|
|
22
22
|
import {
|
|
23
23
|
addNotification,
|
|
24
24
|
clearNotificationState,
|
package/src/index.ts
CHANGED
|
@@ -32,8 +32,7 @@ export * from './components/CircularProgress'
|
|
|
32
32
|
export * from './components/cta-dialog/index'
|
|
33
33
|
export * from './components/DatePicker.client'
|
|
34
34
|
export * from './components/DatePicker.server'
|
|
35
|
-
export * from './components/
|
|
36
|
-
export * from './components/Dialog.client'
|
|
35
|
+
export * from './components/dialog/index'
|
|
37
36
|
export * from './components/Droppable'
|
|
38
37
|
export * from './components/FeatureFlag'
|
|
39
38
|
export * from './components/field/index'
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/components/Dialog.tsx
|
|
21
|
-
var Dialog_exports = {};
|
|
22
|
-
__export(Dialog_exports, {
|
|
23
|
-
Dialog: () => Dialog,
|
|
24
|
-
DialogBackdrop: () => DialogBackdrop,
|
|
25
|
-
DialogCloseTrigger: () => DialogCloseTrigger,
|
|
26
|
-
DialogContent: () => DialogContent,
|
|
27
|
-
DialogDescription: () => DialogDescription,
|
|
28
|
-
DialogHeading: () => DialogHeading,
|
|
29
|
-
DialogPositioner: () => DialogPositioner,
|
|
30
|
-
DialogProvider: () => DialogProvider,
|
|
31
|
-
DialogTrigger: () => DialogTrigger
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(Dialog_exports);
|
|
34
|
-
var import_react2 = require("@ark-ui/react");
|
|
35
|
-
var import_recipes = require("@cerberus/styled-system/recipes");
|
|
36
|
-
|
|
37
|
-
// src/components/Portal.tsx
|
|
38
|
-
var import_react = require("@ark-ui/react");
|
|
39
|
-
var Portal = import_react.Portal;
|
|
40
|
-
|
|
41
|
-
// src/components/Dialog.tsx
|
|
42
|
-
var import_css = require("@cerberus/styled-system/css");
|
|
43
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
44
|
-
function DialogProvider(props) {
|
|
45
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react2.Dialog.Root, { ...props });
|
|
46
|
-
}
|
|
47
|
-
function Dialog(props) {
|
|
48
|
-
const { size, ...contentProps } = props;
|
|
49
|
-
const styles = (0, import_recipes.dialog)({ size });
|
|
50
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Portal, { children: [
|
|
51
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogBackdrop, { className: styles.backdrop }),
|
|
52
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPositioner, { className: styles.positioner, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogContent, { className: styles.content, ...contentProps }) })
|
|
53
|
-
] });
|
|
54
|
-
}
|
|
55
|
-
function DialogHeading(props) {
|
|
56
|
-
const styles = (0, import_recipes.dialog)();
|
|
57
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react2.Dialog.Title, { ...props, className: (0, import_css.cx)(props.className, styles.title) });
|
|
58
|
-
}
|
|
59
|
-
function DialogDescription(props) {
|
|
60
|
-
const styles = (0, import_recipes.dialog)();
|
|
61
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
62
|
-
import_react2.Dialog.Description,
|
|
63
|
-
{
|
|
64
|
-
...props,
|
|
65
|
-
className: (0, import_css.cx)(props.className, styles.description)
|
|
66
|
-
}
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
var DialogTrigger = import_react2.Dialog.Trigger;
|
|
70
|
-
var DialogCloseTrigger = import_react2.Dialog.CloseTrigger;
|
|
71
|
-
var DialogBackdrop = import_react2.Dialog.Backdrop;
|
|
72
|
-
var DialogPositioner = import_react2.Dialog.Positioner;
|
|
73
|
-
var DialogContent = import_react2.Dialog.Content;
|
|
74
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
75
|
-
0 && (module.exports = {
|
|
76
|
-
Dialog,
|
|
77
|
-
DialogBackdrop,
|
|
78
|
-
DialogCloseTrigger,
|
|
79
|
-
DialogContent,
|
|
80
|
-
DialogDescription,
|
|
81
|
-
DialogHeading,
|
|
82
|
-
DialogPositioner,
|
|
83
|
-
DialogProvider,
|
|
84
|
-
DialogTrigger
|
|
85
|
-
});
|
|
86
|
-
//# sourceMappingURL=Dialog.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Dialog.tsx","../../../src/components/Portal.tsx"],"sourcesContent":["import {\n Dialog as ArkDialog,\n type DialogContentProps as ArkDialogContentProps,\n type DialogRootProps,\n type DialogTitleProps,\n} from '@ark-ui/react'\nimport {\n dialog,\n type DialogVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport { Portal } from './Portal'\nimport { cx } from '@cerberus/styled-system/css'\n\nexport type DialogProviderProps = DialogRootProps\n\n/**\n * The provider that controls the dialog components.\n * @definition [Dialog docs](https://cerberus.digitalu.design/react/dialog)\n * @example\n * ```tsx\n * <DialogProvider>\n * <DialogTrigger asChild>\n * <Button>Open Dialog</Button>\n * </DialogTrigger>\n * <Dialog>\n * <Text>Dialog Content</Text>\n * <DialogCloseTrigger>Close</DialogCloseTrigger>\n * </Dialog>\n * </DialogProvider>\n * ```\n */\nexport function DialogProvider(props: DialogProviderProps) {\n return <ArkDialog.Root {...props} />\n}\n\nexport interface DialogProps\n extends Omit<ArkDialogContentProps, 'size'>,\n DialogVariantProps {}\n\n/**\n * The content of the dialog. Must be used within the `DialogProvider` component.\n * @definition [Dialog docs](https://cerberus.digitalu.design/react/dialog)\n * @example\n * ```tsx\n * <DialogProvider>\n * <DialogTrigger asChild>\n * <Button>Open Dialog</Button>\n * </DialogTrigger>\n * <Dialog>\n * <Text>Dialog Content</Text>\n * </Dialog>\n * </DialogProvider>\n * ```\n */\nexport function Dialog(props: DialogProps) {\n const { size, ...contentProps } = props\n const styles = dialog({ size })\n return (\n <Portal>\n <DialogBackdrop className={styles.backdrop} />\n <DialogPositioner className={styles.positioner}>\n <DialogContent className={styles.content} {...contentProps} />\n </DialogPositioner>\n </Portal>\n )\n}\n\n/**\n * The heading of the dialog. Must be used within the `DialogContent` component.\n * @definition [Dialog docs](https://cerberus.digitalu.design/react/dialog)\n * @example\n * ```tsx\n * <DialogProvider>\n * <DialogTrigger asChild>\n * <Button>Open Dialog</Button>\n * </DialogTrigger>\n * <Dialog>\n * <DialogHeading>Dialog Title</DialogHeading>\n * <Text>Dialog Content</Text>\n * </Dialog>\n * </DialogProvider>\n * ```\n */\nexport function DialogHeading(props: DialogTitleProps) {\n const styles = dialog()\n return (\n <ArkDialog.Title {...props} className={cx(props.className, styles.title)} />\n )\n}\n\n/**\n * The description of the dialog. Must be used within the `DialogContent` component.\n * @definition [Dialog docs](https://cerberus.digitalu.design/react/dialog)\n * @example\n * ```tsx\n * <DialogProvider>\n * <DialogTrigger asChild>\n * <Button>Open Dialog</Button>\n * </DialogTrigger>\n * <Dialog>\n * <DialogHeading>Dialog Title</DialogHeading>\n * <DialogDescription>Dialog Description</DialogDescription>\n * </Dialog>\n * </DialogProvider>\n * ```\n */\nexport function DialogDescription(props: DialogTitleProps) {\n const styles = dialog()\n return (\n <ArkDialog.Description\n {...props}\n className={cx(props.className, styles.description)}\n />\n )\n}\n\n/**\n * The trigger that opens the dialog. Must be used within the `DialogProvider`\n * component.\n * @definition [Dialog docs](https://cerberus.digitalu.design/react/dialog)\n * @example\n * ```tsx\n * <DialogTrigger asChild>\n * <Button>Open Dialog</Button>\n * </DialogTrigger>\n * ```\n */\nexport const DialogTrigger = ArkDialog.Trigger\n\n/**\n * The trigger that closes the dialog. Must be used within the `DialogProvider`\n * component.\n * @definition [Dialog docs](https://cerberus.digitalu.design/react/dialog)\n * @example\n * ```tsx\n * <DialogProvider>\n * <DialogTrigger asChild>\n * <Button>Open Dialog</Button>\n * </DialogTrigger>\n * <Dialog>\n * <Text>Dialog Content</Text>\n * <DialogCloseTrigger>Close</DialogCloseTrigger>\n * </Dialog>\n * </DialogProvider>\n * ```\n */\nexport const DialogCloseTrigger = ArkDialog.CloseTrigger\n\n/**\n * The backdrop of the dialog. Must be used within the `DialogProvider`\n * component.\n */\nexport const DialogBackdrop = ArkDialog.Backdrop\n\n/**\n * The positioner of the dialog. Must be used within the `DialogProvider`\n * component.\n */\nexport const DialogPositioner = ArkDialog.Positioner\n\n/**\n * The content of the dialog. Must be used within the `DialogProvider`\n * component.\n */\nexport const DialogContent = ArkDialog.Content\n","import {\n Portal as ArkPortal,\n type PortalProps as ArkPortalProps,\n} from '@ark-ui/react'\n\n/**\n * This module is the Portal component.\n * @module\n */\n\nexport type PortalProps = ArkPortalProps\n\n/**\n * The Portal component is used to render children into a DOM node that exists outside the DOM hierarchy of the parent component.\n * @see https://cerberus.digitalu.design/react/portal\n * @definition [React Portal Docs](https://react.dev/reference/react-dom/createPortal)\n * @example\n * ```tsx\n * 'use client'\n *\n * import { Portal } from '@cerberus/react'\n *\n * function SomeFeatureWithinSSRPage() {\n * return (\n * <Portal>\n * <div>Portal Content outside of the React VDom tree</div>\n * </Portal>\n * )\n * }\n */\nexport const Portal = ArkPortal\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,gBAKO;AACP,qBAGO;;;ACTP,mBAGO;AA2BA,IAAM,SAAS,aAAAC;;;ADnBtB,iBAAmB;AAqBV;AADF,SAAS,eAAe,OAA4B;AACzD,SAAO,4CAAC,cAAAC,OAAU,MAAV,EAAgB,GAAG,OAAO;AACpC;AAqBO,SAAS,OAAO,OAAoB;AACzC,QAAM,EAAE,MAAM,GAAG,aAAa,IAAI;AAClC,QAAM,aAAS,uBAAO,EAAE,KAAK,CAAC;AAC9B,SACE,6CAAC,UACC;AAAA,gDAAC,kBAAe,WAAW,OAAO,UAAU;AAAA,IAC5C,4CAAC,oBAAiB,WAAW,OAAO,YAClC,sDAAC,iBAAc,WAAW,OAAO,SAAU,GAAG,cAAc,GAC9D;AAAA,KACF;AAEJ;AAkBO,SAAS,cAAc,OAAyB;AACrD,QAAM,aAAS,uBAAO;AACtB,SACE,4CAAC,cAAAA,OAAU,OAAV,EAAiB,GAAG,OAAO,eAAW,eAAG,MAAM,WAAW,OAAO,KAAK,GAAG;AAE9E;AAkBO,SAAS,kBAAkB,OAAyB;AACzD,QAAM,aAAS,uBAAO;AACtB,SACE;AAAA,IAAC,cAAAA,OAAU;AAAA,IAAV;AAAA,MACE,GAAG;AAAA,MACJ,eAAW,eAAG,MAAM,WAAW,OAAO,WAAW;AAAA;AAAA,EACnD;AAEJ;AAaO,IAAM,gBAAgB,cAAAA,OAAU;AAmBhC,IAAM,qBAAqB,cAAAA,OAAU;AAMrC,IAAM,iBAAiB,cAAAA,OAAU;AAMjC,IAAM,mBAAmB,cAAAA,OAAU;AAMnC,IAAM,gBAAgB,cAAAA,OAAU;","names":["import_react","ArkPortal","ArkDialog"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Dialog.client.tsx","../../../src/components/IconButton.tsx","../../../src/context/cerberus.tsx"],"sourcesContent":["'use client'\n\nimport {\n Dialog as ArkDialog,\n type DialogCloseTriggerProps,\n} from '@ark-ui/react'\nimport { dialog } from '@cerberus/styled-system/recipes'\nimport { cx } from '@cerberus/styled-system/css'\nimport { IconButton } from './IconButton'\nimport { useCerberusContext } from '../context/cerberus'\n\n/**\n * This module contains client-side components for the Dialog family.\n * @module @cerberus-design/react/dialog\n */\n\nexport function DialogCloseIconTrigger(props: DialogCloseTriggerProps) {\n const { icons } = useCerberusContext()\n const { close: CloseIcon } = icons\n\n const styles = dialog()\n\n return (\n <ArkDialog.CloseTrigger\n {...props}\n className={cx(props.className, styles.closeTrigger)}\n asChild\n >\n <IconButton\n ariaLabel=\"Close dialog\"\n palette=\"action\"\n size=\"lg\"\n usage=\"ghost\"\n >\n <CloseIcon />\n </IconButton>\n </ArkDialog.CloseTrigger>\n )\n}\n","import type { ButtonHTMLAttributes } from 'react'\nimport { cx } from '@cerberus/styled-system/css'\nimport {\n iconButton,\n type IconButtonVariantProps,\n} from '@cerberus/styled-system/recipes'\n\n/**\n * This module contains the Icon Button component.\n * @module\n */\n\nexport interface IconButtonRawProps\n extends ButtonHTMLAttributes<HTMLButtonElement> {\n /**\n * The aria-label attribute for the icon button.\n */\n ariaLabel: string\n}\nexport type IconButtonProps = IconButtonRawProps & IconButtonVariantProps\n\n/**\n * A component that allows the user to perform actions using an icon\n * @see https://cerberus.digitalu.design/react/icon-button\n */\nexport function IconButton(props: IconButtonProps): JSX.Element {\n const { ariaLabel, palette, usage, size, ...nativeProps } = props\n return (\n <button\n {...nativeProps}\n aria-label={ariaLabel ?? 'Icon Button'}\n className={cx(\n nativeProps.className,\n iconButton({\n palette,\n usage,\n size,\n }),\n )}\n />\n )\n}\n","'use client'\n\nimport { createContext, useContext, type PropsWithChildren } from 'react'\nimport type { SystemConfig } from '../config'\n\n/**\n * This module contains the Cerberus configuration context and helpers.\n * @module context/cerberus\n */\n\ntype CerberusContextValue = SystemConfig\n\nconst CerberusContext = createContext<CerberusContextValue | null>(null)\n\ninterface CerberusProviderProps {\n config: SystemConfig\n}\n\n/**\n * Cerberus configuration provider.\n * @param props.config The Cerberus configuration created with\n * `makeSystemConfig` helper.\n */\nexport function CerberusProvider(\n props: PropsWithChildren<CerberusProviderProps>,\n) {\n return (\n <CerberusContext.Provider value={props.config}>\n {props.children}\n </CerberusContext.Provider>\n )\n}\n\n/**\n * Returns the Cerberus configuration context.\n * @returns The Cerberus configuration context.\n */\nexport function useCerberusContext() {\n const context = useContext(CerberusContext)\n if (!context) {\n throw new Error('useCerberus must be used within a CerberusProvider')\n }\n return context\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,IAAAA,gBAGO;AACP,IAAAC,kBAAuB;AACvB,IAAAC,cAAmB;;;ACNnB,iBAAmB;AACnB,qBAGO;AAuBH;AAHG,SAAS,WAAW,OAAqC;AAC9D,QAAM,EAAE,WAAW,SAAS,OAAO,MAAM,GAAG,YAAY,IAAI;AAC5D,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,cAAY,aAAa;AAAA,MACzB,eAAW;AAAA,QACT,YAAY;AAAA,YACZ,2BAAW;AAAA,UACT;AAAA,UACA;AAAA,UACA;AAAA,QACF,CAAC;AAAA,MACH;AAAA;AAAA,EACF;AAEJ;;;ACvCA,mBAAkE;AAyB9D,IAAAC,sBAAA;AAfJ,IAAM,sBAAkB,4BAA2C,IAAI;AAyBhE,SAAS,qBAAqB;AACnC,QAAM,cAAU,yBAAW,eAAe;AAC1C,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,oDAAoD;AAAA,EACtE;AACA,SAAO;AACT;;;AFTQ,IAAAC,sBAAA;AAlBD,SAAS,uBAAuB,OAAgC;AACrE,QAAM,EAAE,MAAM,IAAI,mBAAmB;AACrC,QAAM,EAAE,OAAO,UAAU,IAAI;AAE7B,QAAM,aAAS,wBAAO;AAEtB,SACE;AAAA,IAAC,cAAAC,OAAU;AAAA,IAAV;AAAA,MACE,GAAG;AAAA,MACJ,eAAW,gBAAG,MAAM,WAAW,OAAO,YAAY;AAAA,MAClD,SAAO;AAAA,MAEP;AAAA,QAAC;AAAA;AAAA,UACC,WAAU;AAAA,UACV,SAAQ;AAAA,UACR,MAAK;AAAA,UACL,OAAM;AAAA,UAEN,uDAAC,aAAU;AAAA;AAAA,MACb;AAAA;AAAA,EACF;AAEJ;","names":["import_react","import_recipes","import_css","import_jsx_runtime","import_jsx_runtime","ArkDialog"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/Dialog.client.tsx"],"sourcesContent":["'use client'\n\nimport {\n Dialog as ArkDialog,\n type DialogCloseTriggerProps,\n} from '@ark-ui/react'\nimport { dialog } from '@cerberus/styled-system/recipes'\nimport { cx } from '@cerberus/styled-system/css'\nimport { IconButton } from './IconButton'\nimport { useCerberusContext } from '../context/cerberus'\n\n/**\n * This module contains client-side components for the Dialog family.\n * @module @cerberus-design/react/dialog\n */\n\nexport function DialogCloseIconTrigger(props: DialogCloseTriggerProps) {\n const { icons } = useCerberusContext()\n const { close: CloseIcon } = icons\n\n const styles = dialog()\n\n return (\n <ArkDialog.CloseTrigger\n {...props}\n className={cx(props.className, styles.closeTrigger)}\n asChild\n >\n <IconButton\n ariaLabel=\"Close dialog\"\n palette=\"action\"\n size=\"lg\"\n usage=\"ghost\"\n >\n <CloseIcon />\n </IconButton>\n </ArkDialog.CloseTrigger>\n )\n}\n"],"mappings":";;;;;;;;AAEA;AAAA,EACE,UAAU;AAAA,OAEL;AACP,SAAS,cAAc;AACvB,SAAS,UAAU;AA2BX;AAlBD,SAAS,uBAAuB,OAAgC;AACrE,QAAM,EAAE,MAAM,IAAI,mBAAmB;AACrC,QAAM,EAAE,OAAO,UAAU,IAAI;AAE7B,QAAM,SAAS,OAAO;AAEtB,SACE;AAAA,IAAC,UAAU;AAAA,IAAV;AAAA,MACE,GAAG;AAAA,MACJ,WAAW,GAAG,MAAM,WAAW,OAAO,YAAY;AAAA,MAClD,SAAO;AAAA,MAEP;AAAA,QAAC;AAAA;AAAA,UACC,WAAU;AAAA,UACV,SAAQ;AAAA,UACR,MAAK;AAAA,UACL,OAAM;AAAA,UAEN,8BAAC,aAAU;AAAA;AAAA,MACb;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/cta-dialog/provider.tsx"],"sourcesContent":["'use client'\n\nimport {\n useCallback,\n useContext,\n useMemo,\n useState,\n type MouseEvent,\n type PropsWithChildren,\n type ReactNode,\n} from 'react'\nimport { HStack, VStack } from '@cerberus/styled-system/jsx'\nimport { useCerberusContext } from '../../context/cerberus'\nimport { Show } from '../Show'\nimport { For } from '../for'\nimport { Avatar } from '../Avatar'\nimport {\n Dialog,\n DialogDescription,\n DialogHeading,\n DialogProvider,\n} from '../Dialog'\nimport { DialogCloseIconTrigger } from '../Dialog.client'\nimport type { CTAButtonAction, CTAModalActionReturn } from './utils'\nimport {\n CTAModalContext,\n type CTAModalValue,\n type ShowCTAModalOptions,\n} from './context'\nimport { TriggerItem } from './trigger-item'\n\n/**\n * This module provides the provider and hook for the cta modal.\n * @module 'react/cta-modal/provider'\n */\n\n/**\n * Provides a CTA modal to the app.\n * @see https://cerberus.digitalu.design/react/cta-modal\n * @example\n * ```tsx\n * // Wrap the Provider around the root of the feature.\n * <CTAModal>\n * <SomeFeatureSection />\n * </CTAModal>\n *\n * // Use the hook to show the cta modal.\n * const cta = useCTAModal()\n *\n * const handleClick = useCallback(async () => {\n * const userConsent = await cta.show({\n * heading: 'Create or copy a Cohort',\n * description:\n * 'Create a new cohort or copy and existing one.',\n * icon: <Copy size={24} />,\n * actions: [\n * {\n * text: 'Create Cohort',\n * onClick: () => {},\n * {\n * text: 'Copy Cohort',\n * onClick: () => {}\n * }\n * })\n * setConsent(userConsent)\n * }, [cta])\n * ```\n */\nexport function CTAModal(props: PropsWithChildren<object>) {\n const [open, setOpen] = useState<boolean>(false)\n const [content, setContent] = useState<ShowCTAModalOptions | null>(null)\n const confirmIcon = content?.icon\n\n const { icons } = useCerberusContext()\n const { confirmModal: FallbackIcon } = icons\n\n const handleShow = useCallback(\n (options: ShowCTAModalOptions) => {\n setContent({ ...options })\n setOpen(true)\n },\n [setOpen],\n )\n\n const handleActionClick = useCallback(\n (event: MouseEvent<HTMLButtonElement>) => {\n const index = Number(event.currentTarget.getAttribute('data-index'))\n const contentActions = content?.actions as CTAModalActionReturn\n const action = contentActions._actions[index] as CTAButtonAction\n action?.handleClick?.(event)\n setOpen(false)\n },\n [content, setOpen],\n )\n\n const value = useMemo(\n () => ({\n show: handleShow,\n }),\n [handleShow],\n )\n\n return (\n <CTAModalContext.Provider value={value}>\n {props.children}\n\n <DialogProvider open={open} onOpenChange={(e) => setOpen(e.open)}>\n <Dialog size=\"sm\">\n <DialogCloseIconTrigger />\n\n <VStack gap=\"xl\" w=\"full\">\n <VStack alignItems=\"flex-start\" gap=\"md\" w=\"full\">\n <VStack gap=\"lg\" w=\"full\">\n <Avatar\n ariaLabel=\"\"\n gradient=\"charon-light\"\n icon={\n <Show\n when={Boolean(confirmIcon)}\n fallback={<FallbackIcon size={24} />}\n >\n {confirmIcon}\n </Show>\n }\n src=\"\"\n />\n <DialogHeading>{content?.heading}</DialogHeading>\n <DialogDescription>{content?.description}</DialogDescription>\n </VStack>\n </VStack>\n\n <HStack gap=\"md\" w=\"full\">\n <For each={content?.actions._actions}>\n {(action, index) => (\n <Show\n key={index}\n when={content?.actions?.type === 'btnAction'}\n fallback={\n <TriggerItem asChild>{action as ReactNode}</TriggerItem>\n }\n >\n <TriggerItem data-index={index} onClick={handleActionClick}>\n {(action as CTAButtonAction)?.text}\n </TriggerItem>\n </Show>\n )}\n </For>\n </HStack>\n </VStack>\n </Dialog>\n </DialogProvider>\n </CTAModalContext.Provider>\n )\n}\n\nexport function useCTAModal(): CTAModalValue {\n const context = useContext(CTAModalContext)\n if (context === null) {\n throw new Error('useCTAModal must be used within a CTAModal Provider')\n }\n return context\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AACP,SAAS,QAAQ,cAAc;AAiGrB,cAII,YAJJ;AAxCH,SAAS,SAAS,OAAkC;AACzD,QAAM,CAAC,MAAM,OAAO,IAAI,SAAkB,KAAK;AAC/C,QAAM,CAAC,SAAS,UAAU,IAAI,SAAqC,IAAI;AACvE,QAAM,cAAc,SAAS;AAE7B,QAAM,EAAE,MAAM,IAAI,mBAAmB;AACrC,QAAM,EAAE,cAAc,aAAa,IAAI;AAEvC,QAAM,aAAa;AAAA,IACjB,CAAC,YAAiC;AAChC,iBAAW,EAAE,GAAG,QAAQ,CAAC;AACzB,cAAQ,IAAI;AAAA,IACd;AAAA,IACA,CAAC,OAAO;AAAA,EACV;AAEA,QAAM,oBAAoB;AAAA,IACxB,CAAC,UAAyC;AACxC,YAAM,QAAQ,OAAO,MAAM,cAAc,aAAa,YAAY,CAAC;AACnE,YAAM,iBAAiB,SAAS;AAChC,YAAM,SAAS,eAAe,SAAS,KAAK;AAC5C,cAAQ,cAAc,KAAK;AAC3B,cAAQ,KAAK;AAAA,IACf;AAAA,IACA,CAAC,SAAS,OAAO;AAAA,EACnB;AAEA,QAAM,QAAQ;AAAA,IACZ,OAAO;AAAA,MACL,MAAM;AAAA,IACR;AAAA,IACA,CAAC,UAAU;AAAA,EACb;AAEA,SACE,qBAAC,gBAAgB,UAAhB,EAAyB,OACvB;AAAA,UAAM;AAAA,IAEP,oBAAC,kBAAe,MAAY,cAAc,CAAC,MAAM,QAAQ,EAAE,IAAI,GAC7D,+BAAC,UAAO,MAAK,MACX;AAAA,0BAAC,0BAAuB;AAAA,MAExB,qBAAC,UAAO,KAAI,MAAK,GAAE,QACjB;AAAA,4BAAC,UAAO,YAAW,cAAa,KAAI,MAAK,GAAE,QACzC,+BAAC,UAAO,KAAI,MAAK,GAAE,QACjB;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,WAAU;AAAA,cACV,UAAS;AAAA,cACT,MACE;AAAA,gBAAC;AAAA;AAAA,kBACC,MAAM,QAAQ,WAAW;AAAA,kBACzB,UAAU,oBAAC,gBAAa,MAAM,IAAI;AAAA,kBAEjC;AAAA;AAAA,cACH;AAAA,cAEF,KAAI;AAAA;AAAA,UACN;AAAA,UACA,oBAAC,iBAAe,mBAAS,SAAQ;AAAA,UACjC,oBAAC,qBAAmB,mBAAS,aAAY;AAAA,WAC3C,GACF;AAAA,QAEA,oBAAC,UAAO,KAAI,MAAK,GAAE,QACjB,8BAAC,OAAI,MAAM,SAAS,QAAQ,UACzB,WAAC,QAAQ,UACR;AAAA,UAAC;AAAA;AAAA,YAEC,MAAM,SAAS,SAAS,SAAS;AAAA,YACjC,UACE,oBAAC,eAAY,SAAO,MAAE,kBAAoB;AAAA,YAG5C,8BAAC,eAAY,cAAY,OAAO,SAAS,mBACrC,kBAA4B,MAChC;AAAA;AAAA,UARK;AAAA,QASP,GAEJ,GACF;AAAA,SACF;AAAA,OACF,GACF;AAAA,KACF;AAEJ;AAEO,SAAS,cAA6B;AAC3C,QAAM,UAAU,WAAW,eAAe;AAC1C,MAAI,YAAY,MAAM;AACpB,UAAM,IAAI,MAAM,qDAAqD;AAAA,EACvE;AACA,SAAO;AACT;","names":[]}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Portal
|
|
3
|
-
} from "./chunk-IQJDVFPP.js";
|
|
4
|
-
|
|
5
|
-
// src/components/Dialog.tsx
|
|
6
|
-
import {
|
|
7
|
-
Dialog as ArkDialog
|
|
8
|
-
} from "@ark-ui/react";
|
|
9
|
-
import {
|
|
10
|
-
dialog
|
|
11
|
-
} from "@cerberus/styled-system/recipes";
|
|
12
|
-
import { cx } from "@cerberus/styled-system/css";
|
|
13
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
-
function DialogProvider(props) {
|
|
15
|
-
return /* @__PURE__ */ jsx(ArkDialog.Root, { ...props });
|
|
16
|
-
}
|
|
17
|
-
function Dialog(props) {
|
|
18
|
-
const { size, ...contentProps } = props;
|
|
19
|
-
const styles = dialog({ size });
|
|
20
|
-
return /* @__PURE__ */ jsxs(Portal, { children: [
|
|
21
|
-
/* @__PURE__ */ jsx(DialogBackdrop, { className: styles.backdrop }),
|
|
22
|
-
/* @__PURE__ */ jsx(DialogPositioner, { className: styles.positioner, children: /* @__PURE__ */ jsx(DialogContent, { className: styles.content, ...contentProps }) })
|
|
23
|
-
] });
|
|
24
|
-
}
|
|
25
|
-
function DialogHeading(props) {
|
|
26
|
-
const styles = dialog();
|
|
27
|
-
return /* @__PURE__ */ jsx(ArkDialog.Title, { ...props, className: cx(props.className, styles.title) });
|
|
28
|
-
}
|
|
29
|
-
function DialogDescription(props) {
|
|
30
|
-
const styles = dialog();
|
|
31
|
-
return /* @__PURE__ */ jsx(
|
|
32
|
-
ArkDialog.Description,
|
|
33
|
-
{
|
|
34
|
-
...props,
|
|
35
|
-
className: cx(props.className, styles.description)
|
|
36
|
-
}
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
var DialogTrigger = ArkDialog.Trigger;
|
|
40
|
-
var DialogCloseTrigger = ArkDialog.CloseTrigger;
|
|
41
|
-
var DialogBackdrop = ArkDialog.Backdrop;
|
|
42
|
-
var DialogPositioner = ArkDialog.Positioner;
|
|
43
|
-
var DialogContent = ArkDialog.Content;
|
|
44
|
-
|
|
45
|
-
export {
|
|
46
|
-
DialogProvider,
|
|
47
|
-
Dialog,
|
|
48
|
-
DialogHeading,
|
|
49
|
-
DialogDescription,
|
|
50
|
-
DialogTrigger,
|
|
51
|
-
DialogCloseTrigger,
|
|
52
|
-
DialogBackdrop,
|
|
53
|
-
DialogPositioner,
|
|
54
|
-
DialogContent
|
|
55
|
-
};
|
|
56
|
-
//# sourceMappingURL=chunk-TFL56AYR.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/Dialog.tsx"],"sourcesContent":["import {\n Dialog as ArkDialog,\n type DialogContentProps as ArkDialogContentProps,\n type DialogRootProps,\n type DialogTitleProps,\n} from '@ark-ui/react'\nimport {\n dialog,\n type DialogVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport { Portal } from './Portal'\nimport { cx } from '@cerberus/styled-system/css'\n\nexport type DialogProviderProps = DialogRootProps\n\n/**\n * The provider that controls the dialog components.\n * @definition [Dialog docs](https://cerberus.digitalu.design/react/dialog)\n * @example\n * ```tsx\n * <DialogProvider>\n * <DialogTrigger asChild>\n * <Button>Open Dialog</Button>\n * </DialogTrigger>\n * <Dialog>\n * <Text>Dialog Content</Text>\n * <DialogCloseTrigger>Close</DialogCloseTrigger>\n * </Dialog>\n * </DialogProvider>\n * ```\n */\nexport function DialogProvider(props: DialogProviderProps) {\n return <ArkDialog.Root {...props} />\n}\n\nexport interface DialogProps\n extends Omit<ArkDialogContentProps, 'size'>,\n DialogVariantProps {}\n\n/**\n * The content of the dialog. Must be used within the `DialogProvider` component.\n * @definition [Dialog docs](https://cerberus.digitalu.design/react/dialog)\n * @example\n * ```tsx\n * <DialogProvider>\n * <DialogTrigger asChild>\n * <Button>Open Dialog</Button>\n * </DialogTrigger>\n * <Dialog>\n * <Text>Dialog Content</Text>\n * </Dialog>\n * </DialogProvider>\n * ```\n */\nexport function Dialog(props: DialogProps) {\n const { size, ...contentProps } = props\n const styles = dialog({ size })\n return (\n <Portal>\n <DialogBackdrop className={styles.backdrop} />\n <DialogPositioner className={styles.positioner}>\n <DialogContent className={styles.content} {...contentProps} />\n </DialogPositioner>\n </Portal>\n )\n}\n\n/**\n * The heading of the dialog. Must be used within the `DialogContent` component.\n * @definition [Dialog docs](https://cerberus.digitalu.design/react/dialog)\n * @example\n * ```tsx\n * <DialogProvider>\n * <DialogTrigger asChild>\n * <Button>Open Dialog</Button>\n * </DialogTrigger>\n * <Dialog>\n * <DialogHeading>Dialog Title</DialogHeading>\n * <Text>Dialog Content</Text>\n * </Dialog>\n * </DialogProvider>\n * ```\n */\nexport function DialogHeading(props: DialogTitleProps) {\n const styles = dialog()\n return (\n <ArkDialog.Title {...props} className={cx(props.className, styles.title)} />\n )\n}\n\n/**\n * The description of the dialog. Must be used within the `DialogContent` component.\n * @definition [Dialog docs](https://cerberus.digitalu.design/react/dialog)\n * @example\n * ```tsx\n * <DialogProvider>\n * <DialogTrigger asChild>\n * <Button>Open Dialog</Button>\n * </DialogTrigger>\n * <Dialog>\n * <DialogHeading>Dialog Title</DialogHeading>\n * <DialogDescription>Dialog Description</DialogDescription>\n * </Dialog>\n * </DialogProvider>\n * ```\n */\nexport function DialogDescription(props: DialogTitleProps) {\n const styles = dialog()\n return (\n <ArkDialog.Description\n {...props}\n className={cx(props.className, styles.description)}\n />\n )\n}\n\n/**\n * The trigger that opens the dialog. Must be used within the `DialogProvider`\n * component.\n * @definition [Dialog docs](https://cerberus.digitalu.design/react/dialog)\n * @example\n * ```tsx\n * <DialogTrigger asChild>\n * <Button>Open Dialog</Button>\n * </DialogTrigger>\n * ```\n */\nexport const DialogTrigger = ArkDialog.Trigger\n\n/**\n * The trigger that closes the dialog. Must be used within the `DialogProvider`\n * component.\n * @definition [Dialog docs](https://cerberus.digitalu.design/react/dialog)\n * @example\n * ```tsx\n * <DialogProvider>\n * <DialogTrigger asChild>\n * <Button>Open Dialog</Button>\n * </DialogTrigger>\n * <Dialog>\n * <Text>Dialog Content</Text>\n * <DialogCloseTrigger>Close</DialogCloseTrigger>\n * </Dialog>\n * </DialogProvider>\n * ```\n */\nexport const DialogCloseTrigger = ArkDialog.CloseTrigger\n\n/**\n * The backdrop of the dialog. Must be used within the `DialogProvider`\n * component.\n */\nexport const DialogBackdrop = ArkDialog.Backdrop\n\n/**\n * The positioner of the dialog. Must be used within the `DialogProvider`\n * component.\n */\nexport const DialogPositioner = ArkDialog.Positioner\n\n/**\n * The content of the dialog. Must be used within the `DialogProvider`\n * component.\n */\nexport const DialogContent = ArkDialog.Content\n"],"mappings":";;;;;AAAA;AAAA,EACE,UAAU;AAAA,OAIL;AACP;AAAA,EACE;AAAA,OAEK;AAEP,SAAS,UAAU;AAqBV,cA0BL,YA1BK;AADF,SAAS,eAAe,OAA4B;AACzD,SAAO,oBAAC,UAAU,MAAV,EAAgB,GAAG,OAAO;AACpC;AAqBO,SAAS,OAAO,OAAoB;AACzC,QAAM,EAAE,MAAM,GAAG,aAAa,IAAI;AAClC,QAAM,SAAS,OAAO,EAAE,KAAK,CAAC;AAC9B,SACE,qBAAC,UACC;AAAA,wBAAC,kBAAe,WAAW,OAAO,UAAU;AAAA,IAC5C,oBAAC,oBAAiB,WAAW,OAAO,YAClC,8BAAC,iBAAc,WAAW,OAAO,SAAU,GAAG,cAAc,GAC9D;AAAA,KACF;AAEJ;AAkBO,SAAS,cAAc,OAAyB;AACrD,QAAM,SAAS,OAAO;AACtB,SACE,oBAAC,UAAU,OAAV,EAAiB,GAAG,OAAO,WAAW,GAAG,MAAM,WAAW,OAAO,KAAK,GAAG;AAE9E;AAkBO,SAAS,kBAAkB,OAAyB;AACzD,QAAM,SAAS,OAAO;AACtB,SACE;AAAA,IAAC,UAAU;AAAA,IAAV;AAAA,MACE,GAAG;AAAA,MACJ,WAAW,GAAG,MAAM,WAAW,OAAO,WAAW;AAAA;AAAA,EACnD;AAEJ;AAaO,IAAM,gBAAgB,UAAU;AAmBhC,IAAM,qBAAqB,UAAU;AAMrC,IAAM,iBAAiB,UAAU;AAMjC,IAAM,mBAAmB,UAAU;AAMnC,IAAM,gBAAgB,UAAU;","names":[]}
|