@cerberus-design/react 0.16.0-next-270c731 → 0.16.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 +25 -82
- package/build/legacy/components/for.cjs +4 -3
- package/build/legacy/components/for.cjs.map +1 -1
- package/build/legacy/{components/cta-dialog/provider.cjs → context/cta-modal.cjs} +150 -187
- package/build/legacy/context/cta-modal.cjs.map +1 -0
- package/build/legacy/index.cjs +715 -771
- package/build/legacy/index.cjs.map +1 -1
- package/build/modern/_tsup-dts-rollup.d.ts +25 -82
- package/build/modern/{chunk-O542MPR7.js → chunk-CMYD5KWA.js} +4 -4
- package/build/modern/{chunk-Z4342DRO.js → chunk-FMRWRVUS.js} +4 -4
- package/build/modern/chunk-IIH363FO.js +13 -0
- package/build/modern/chunk-IIH363FO.js.map +1 -0
- package/build/modern/{chunk-6ICNCCPD.js → chunk-P3SF56LT.js} +4 -4
- package/build/modern/{chunk-QEM3M4N3.js → chunk-ZDANBCM3.js} +31 -22
- package/build/modern/chunk-ZDANBCM3.js.map +1 -0
- package/build/modern/components/for.js +1 -1
- package/build/modern/components/select/index.js +2 -2
- package/build/modern/components/select/select.js +2 -2
- package/build/modern/context/cta-modal.js +19 -0
- package/build/modern/context/notification-center.js +2 -2
- package/build/modern/context/prompt-modal.js +2 -2
- package/build/modern/index.js +76 -83
- package/build/modern/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/for.tsx +18 -13
- package/src/{components/cta-dialog/provider.tsx → context/cta-modal.tsx} +68 -34
- package/src/index.ts +1 -1
- package/build/legacy/components/cta-dialog/context.cjs +0 -33
- package/build/legacy/components/cta-dialog/context.cjs.map +0 -1
- package/build/legacy/components/cta-dialog/index.cjs +0 -433
- package/build/legacy/components/cta-dialog/index.cjs.map +0 -1
- package/build/legacy/components/cta-dialog/provider.cjs.map +0 -1
- package/build/legacy/components/cta-dialog/trigger-item.cjs +0 -99
- package/build/legacy/components/cta-dialog/trigger-item.cjs.map +0 -1
- package/build/legacy/components/cta-dialog/utils.cjs +0 -47
- package/build/legacy/components/cta-dialog/utils.cjs.map +0 -1
- package/build/modern/chunk-4LSTU6WU.js +0 -8
- package/build/modern/chunk-4LSTU6WU.js.map +0 -1
- package/build/modern/chunk-DXOKSZVQ.js +0 -12
- package/build/modern/chunk-DXOKSZVQ.js.map +0 -1
- package/build/modern/chunk-IKDXADLX.js +0 -1
- package/build/modern/chunk-MVO2GNUA.js +0 -47
- package/build/modern/chunk-MVO2GNUA.js.map +0 -1
- package/build/modern/chunk-PLHYOCY3.js +0 -23
- package/build/modern/chunk-PLHYOCY3.js.map +0 -1
- package/build/modern/chunk-QEM3M4N3.js.map +0 -1
- package/build/modern/components/cta-dialog/context.js +0 -8
- package/build/modern/components/cta-dialog/context.js.map +0 -1
- package/build/modern/components/cta-dialog/index.js +0 -26
- package/build/modern/components/cta-dialog/index.js.map +0 -1
- package/build/modern/components/cta-dialog/provider.js +0 -22
- package/build/modern/components/cta-dialog/provider.js.map +0 -1
- package/build/modern/components/cta-dialog/trigger-item.js +0 -10
- package/build/modern/components/cta-dialog/trigger-item.js.map +0 -1
- package/build/modern/components/cta-dialog/utils.js +0 -7
- package/build/modern/components/cta-dialog/utils.js.map +0 -1
- package/src/components/cta-dialog/context.tsx +0 -34
- package/src/components/cta-dialog/index.ts +0 -2
- package/src/components/cta-dialog/trigger-item.tsx +0 -53
- package/src/components/cta-dialog/utils.ts +0 -57
- /package/build/modern/{chunk-O542MPR7.js.map → chunk-CMYD5KWA.js.map} +0 -0
- /package/build/modern/{chunk-Z4342DRO.js.map → chunk-FMRWRVUS.js.map} +0 -0
- /package/build/modern/{chunk-6ICNCCPD.js.map → chunk-P3SF56LT.js.map} +0 -0
- /package/build/modern/{chunk-IKDXADLX.js.map → context/cta-modal.js.map} +0 -0
|
@@ -18,53 +18,77 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
20
|
|
|
21
|
-
// src/
|
|
22
|
-
var
|
|
23
|
-
__export(
|
|
21
|
+
// src/context/cta-modal.tsx
|
|
22
|
+
var cta_modal_exports = {};
|
|
23
|
+
__export(cta_modal_exports, {
|
|
24
24
|
CTAModal: () => CTAModal,
|
|
25
25
|
useCTAModal: () => useCTAModal
|
|
26
26
|
});
|
|
27
|
-
module.exports = __toCommonJS(
|
|
28
|
-
var
|
|
29
|
-
var import_jsx2 = require("@cerberus/styled-system/jsx");
|
|
27
|
+
module.exports = __toCommonJS(cta_modal_exports);
|
|
28
|
+
var import_react7 = require("react");
|
|
30
29
|
|
|
31
|
-
// src/
|
|
32
|
-
var
|
|
33
|
-
var
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
const context = (0, import_react.useContext)(CerberusContext);
|
|
37
|
-
if (!context) {
|
|
38
|
-
throw new Error("useCerberus must be used within a CerberusProvider");
|
|
39
|
-
}
|
|
40
|
-
return context;
|
|
41
|
-
}
|
|
30
|
+
// src/components/button/button.tsx
|
|
31
|
+
var import_react2 = require("react");
|
|
32
|
+
var import_css = require("@cerberus/styled-system/css");
|
|
33
|
+
var import_recipes = require("@cerberus/styled-system/recipes");
|
|
34
|
+
var import_jsx = require("@cerberus/styled-system/jsx");
|
|
42
35
|
|
|
43
36
|
// src/components/Show.tsx
|
|
44
|
-
var
|
|
37
|
+
var import_react = require("react");
|
|
45
38
|
function Show(props) {
|
|
46
39
|
const { when, children, fallback } = props;
|
|
47
|
-
const condition = (0,
|
|
48
|
-
return (0,
|
|
40
|
+
const condition = (0, import_react.useMemo)(() => when ?? false, [when]);
|
|
41
|
+
return (0, import_react.useMemo)(() => {
|
|
49
42
|
if (condition) return children;
|
|
50
43
|
return fallback ?? null;
|
|
51
44
|
}, [condition, children, fallback]);
|
|
52
45
|
}
|
|
53
46
|
|
|
54
|
-
// src/components/
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
47
|
+
// src/components/button/button.tsx
|
|
48
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
49
|
+
var ButtonContext = (0, import_react2.createContext)({
|
|
50
|
+
pending: false
|
|
51
|
+
});
|
|
52
|
+
function Button(props) {
|
|
53
|
+
const { palette, usage, shape, size, pending = false, ...nativeProps } = props;
|
|
54
|
+
const value = (0, import_react2.useMemo)(() => ({ pending }), [pending]);
|
|
55
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ButtonContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
56
|
+
"button",
|
|
57
|
+
{
|
|
58
|
+
...nativeProps,
|
|
59
|
+
disabled: pending || nativeProps.disabled,
|
|
60
|
+
className: (0, import_css.cx)(
|
|
61
|
+
nativeProps.className,
|
|
62
|
+
(0, import_recipes.button)({
|
|
63
|
+
palette,
|
|
64
|
+
usage,
|
|
65
|
+
shape,
|
|
66
|
+
size
|
|
67
|
+
})
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
) });
|
|
61
71
|
}
|
|
62
72
|
|
|
63
73
|
// src/components/Avatar.tsx
|
|
64
|
-
var
|
|
74
|
+
var import_css2 = require("@cerberus/styled-system/css");
|
|
65
75
|
var import_patterns = require("@cerberus/styled-system/patterns");
|
|
66
|
-
var
|
|
76
|
+
var import_recipes2 = require("@cerberus/styled-system/recipes");
|
|
77
|
+
|
|
78
|
+
// src/context/cerberus.tsx
|
|
79
|
+
var import_react3 = require("react");
|
|
67
80
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
81
|
+
var CerberusContext = (0, import_react3.createContext)(null);
|
|
82
|
+
function useCerberusContext() {
|
|
83
|
+
const context = (0, import_react3.useContext)(CerberusContext);
|
|
84
|
+
if (!context) {
|
|
85
|
+
throw new Error("useCerberus must be used within a CerberusProvider");
|
|
86
|
+
}
|
|
87
|
+
return context;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// src/components/Avatar.tsx
|
|
91
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
68
92
|
function Avatar(props) {
|
|
69
93
|
const {
|
|
70
94
|
ariaLabel,
|
|
@@ -80,28 +104,28 @@ function Avatar(props) {
|
|
|
80
104
|
const { icons } = useCerberusContext();
|
|
81
105
|
const { avatar: AvatarIcon } = icons;
|
|
82
106
|
const initials = (ariaLabel || "").split(" ").map((word) => word[0]).join("").slice(0, 2);
|
|
83
|
-
return /* @__PURE__ */ (0,
|
|
107
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
84
108
|
"div",
|
|
85
109
|
{
|
|
86
110
|
...nativeProps,
|
|
87
|
-
className: (0,
|
|
111
|
+
className: (0, import_css2.cx)(
|
|
88
112
|
nativeProps.className,
|
|
89
|
-
(0,
|
|
113
|
+
(0, import_recipes2.avatar)({ gradient, size }),
|
|
90
114
|
(0, import_patterns.circle)()
|
|
91
115
|
),
|
|
92
|
-
children: /* @__PURE__ */ (0,
|
|
116
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
93
117
|
Show,
|
|
94
118
|
{
|
|
95
119
|
when: Boolean(src) || Boolean(as),
|
|
96
|
-
fallback: /* @__PURE__ */ (0,
|
|
120
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
97
121
|
Show,
|
|
98
122
|
{
|
|
99
123
|
when: Boolean(initials),
|
|
100
|
-
fallback: /* @__PURE__ */ (0,
|
|
124
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
101
125
|
Show,
|
|
102
126
|
{
|
|
103
127
|
when: Boolean(icon),
|
|
104
|
-
fallback: /* @__PURE__ */ (0,
|
|
128
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
105
129
|
AvatarIcon,
|
|
106
130
|
{
|
|
107
131
|
size: iconSizeMap[size]
|
|
@@ -113,15 +137,15 @@ function Avatar(props) {
|
|
|
113
137
|
children: initials
|
|
114
138
|
}
|
|
115
139
|
),
|
|
116
|
-
children: /* @__PURE__ */ (0,
|
|
140
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
117
141
|
Show,
|
|
118
142
|
{
|
|
119
143
|
when: Boolean(as),
|
|
120
|
-
fallback: /* @__PURE__ */ (0,
|
|
144
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
121
145
|
"img",
|
|
122
146
|
{
|
|
123
147
|
alt: props.ariaLabel,
|
|
124
|
-
className: (0,
|
|
148
|
+
className: (0, import_css2.css)({
|
|
125
149
|
h: "full",
|
|
126
150
|
objectFit: "cover",
|
|
127
151
|
w: "full"
|
|
@@ -152,67 +176,72 @@ var iconSizeMap = {
|
|
|
152
176
|
"4xl": 32
|
|
153
177
|
};
|
|
154
178
|
|
|
179
|
+
// src/context/cta-modal.tsx
|
|
180
|
+
var import_jsx2 = require("@cerberus/styled-system/jsx");
|
|
181
|
+
var import_css6 = require("@cerberus/styled-system/css");
|
|
182
|
+
var import_jsx3 = require("@cerberus/styled-system/jsx");
|
|
183
|
+
|
|
155
184
|
// src/components/Dialog.tsx
|
|
156
|
-
var
|
|
157
|
-
var
|
|
185
|
+
var import_react5 = require("@ark-ui/react");
|
|
186
|
+
var import_recipes3 = require("@cerberus/styled-system/recipes");
|
|
158
187
|
|
|
159
188
|
// src/components/Portal.tsx
|
|
160
|
-
var
|
|
161
|
-
var Portal =
|
|
189
|
+
var import_react4 = require("@ark-ui/react");
|
|
190
|
+
var Portal = import_react4.Portal;
|
|
162
191
|
|
|
163
192
|
// src/components/Dialog.tsx
|
|
164
|
-
var
|
|
165
|
-
var
|
|
193
|
+
var import_css3 = require("@cerberus/styled-system/css");
|
|
194
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
166
195
|
function DialogProvider(props) {
|
|
167
|
-
return /* @__PURE__ */ (0,
|
|
196
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react5.Dialog.Root, { ...props });
|
|
168
197
|
}
|
|
169
198
|
function Dialog(props) {
|
|
170
199
|
const { size, ...contentProps } = props;
|
|
171
|
-
const styles = (0,
|
|
172
|
-
return /* @__PURE__ */ (0,
|
|
173
|
-
/* @__PURE__ */ (0,
|
|
174
|
-
/* @__PURE__ */ (0,
|
|
200
|
+
const styles = (0, import_recipes3.dialog)({ size });
|
|
201
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Portal, { children: [
|
|
202
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DialogBackdrop, { className: styles.backdrop }),
|
|
203
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DialogPositioner, { className: styles.positioner, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DialogContent, { className: styles.content, ...contentProps }) })
|
|
175
204
|
] });
|
|
176
205
|
}
|
|
177
206
|
function DialogHeading(props) {
|
|
178
|
-
const styles = (0,
|
|
179
|
-
return /* @__PURE__ */ (0,
|
|
207
|
+
const styles = (0, import_recipes3.dialog)();
|
|
208
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react5.Dialog.Title, { ...props, className: (0, import_css3.cx)(props.className, styles.title) });
|
|
180
209
|
}
|
|
181
210
|
function DialogDescription(props) {
|
|
182
|
-
const styles = (0,
|
|
183
|
-
return /* @__PURE__ */ (0,
|
|
184
|
-
|
|
211
|
+
const styles = (0, import_recipes3.dialog)();
|
|
212
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
213
|
+
import_react5.Dialog.Description,
|
|
185
214
|
{
|
|
186
215
|
...props,
|
|
187
|
-
className: (0,
|
|
216
|
+
className: (0, import_css3.cx)(props.className, styles.description)
|
|
188
217
|
}
|
|
189
218
|
);
|
|
190
219
|
}
|
|
191
|
-
var DialogTrigger =
|
|
192
|
-
var DialogCloseTrigger =
|
|
193
|
-
var DialogBackdrop =
|
|
194
|
-
var DialogPositioner =
|
|
195
|
-
var DialogContent =
|
|
220
|
+
var DialogTrigger = import_react5.Dialog.Trigger;
|
|
221
|
+
var DialogCloseTrigger = import_react5.Dialog.CloseTrigger;
|
|
222
|
+
var DialogBackdrop = import_react5.Dialog.Backdrop;
|
|
223
|
+
var DialogPositioner = import_react5.Dialog.Positioner;
|
|
224
|
+
var DialogContent = import_react5.Dialog.Content;
|
|
196
225
|
|
|
197
226
|
// src/components/Dialog.client.tsx
|
|
198
|
-
var
|
|
199
|
-
var
|
|
200
|
-
var
|
|
227
|
+
var import_react6 = require("@ark-ui/react");
|
|
228
|
+
var import_recipes5 = require("@cerberus/styled-system/recipes");
|
|
229
|
+
var import_css5 = require("@cerberus/styled-system/css");
|
|
201
230
|
|
|
202
231
|
// src/components/IconButton.tsx
|
|
203
|
-
var
|
|
204
|
-
var
|
|
205
|
-
var
|
|
232
|
+
var import_css4 = require("@cerberus/styled-system/css");
|
|
233
|
+
var import_recipes4 = require("@cerberus/styled-system/recipes");
|
|
234
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
206
235
|
function IconButton(props) {
|
|
207
236
|
const { ariaLabel, palette, usage, size, ...nativeProps } = props;
|
|
208
|
-
return /* @__PURE__ */ (0,
|
|
237
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
209
238
|
"button",
|
|
210
239
|
{
|
|
211
240
|
...nativeProps,
|
|
212
241
|
"aria-label": ariaLabel ?? "Icon Button",
|
|
213
|
-
className: (0,
|
|
242
|
+
className: (0, import_css4.cx)(
|
|
214
243
|
nativeProps.className,
|
|
215
|
-
(0,
|
|
244
|
+
(0, import_recipes4.iconButton)({
|
|
216
245
|
palette,
|
|
217
246
|
usage,
|
|
218
247
|
size
|
|
@@ -223,181 +252,115 @@ function IconButton(props) {
|
|
|
223
252
|
}
|
|
224
253
|
|
|
225
254
|
// src/components/Dialog.client.tsx
|
|
226
|
-
var
|
|
255
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
227
256
|
function DialogCloseIconTrigger(props) {
|
|
228
257
|
const { icons } = useCerberusContext();
|
|
229
258
|
const { close: CloseIcon } = icons;
|
|
230
|
-
const styles = (0,
|
|
231
|
-
return /* @__PURE__ */ (0,
|
|
232
|
-
|
|
259
|
+
const styles = (0, import_recipes5.dialog)();
|
|
260
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
261
|
+
import_react6.Dialog.CloseTrigger,
|
|
233
262
|
{
|
|
234
263
|
...props,
|
|
235
|
-
className: (0,
|
|
264
|
+
className: (0, import_css5.cx)(props.className, styles.closeTrigger),
|
|
236
265
|
asChild: true,
|
|
237
|
-
children: /* @__PURE__ */ (0,
|
|
266
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
238
267
|
IconButton,
|
|
239
268
|
{
|
|
240
269
|
ariaLabel: "Close dialog",
|
|
241
270
|
palette: "action",
|
|
242
271
|
size: "lg",
|
|
243
272
|
usage: "ghost",
|
|
244
|
-
children: /* @__PURE__ */ (0,
|
|
273
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(CloseIcon, {})
|
|
245
274
|
}
|
|
246
275
|
)
|
|
247
276
|
}
|
|
248
277
|
);
|
|
249
278
|
}
|
|
250
279
|
|
|
251
|
-
// src/
|
|
252
|
-
var import_react6 = require("react");
|
|
253
|
-
var CTAModalContext = (0, import_react6.createContext)(null);
|
|
254
|
-
|
|
255
|
-
// src/components/cta-dialog/trigger-item.tsx
|
|
256
|
-
var import_css6 = require("@cerberus/styled-system/css");
|
|
257
|
-
|
|
258
|
-
// src/components/button/button.tsx
|
|
259
|
-
var import_react7 = require("react");
|
|
260
|
-
var import_css5 = require("@cerberus/styled-system/css");
|
|
261
|
-
var import_recipes5 = require("@cerberus/styled-system/recipes");
|
|
262
|
-
var import_jsx = require("@cerberus/styled-system/jsx");
|
|
263
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
264
|
-
var ButtonContext = (0, import_react7.createContext)({
|
|
265
|
-
pending: false
|
|
266
|
-
});
|
|
267
|
-
function Button(props) {
|
|
268
|
-
const { palette, usage, shape, size, pending = false, ...nativeProps } = props;
|
|
269
|
-
const value = (0, import_react7.useMemo)(() => ({ pending }), [pending]);
|
|
270
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ButtonContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
271
|
-
"button",
|
|
272
|
-
{
|
|
273
|
-
...nativeProps,
|
|
274
|
-
disabled: pending || nativeProps.disabled,
|
|
275
|
-
className: (0, import_css5.cx)(
|
|
276
|
-
nativeProps.className,
|
|
277
|
-
(0, import_recipes5.button)({
|
|
278
|
-
palette,
|
|
279
|
-
usage,
|
|
280
|
-
shape,
|
|
281
|
-
size
|
|
282
|
-
})
|
|
283
|
-
)
|
|
284
|
-
}
|
|
285
|
-
) });
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
// src/components/cta-dialog/trigger-item.tsx
|
|
289
|
-
var import_factory = require("@ark-ui/react/factory");
|
|
290
|
-
var import_recipes6 = require("@cerberus/styled-system/recipes");
|
|
280
|
+
// src/context/cta-modal.tsx
|
|
291
281
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
292
|
-
|
|
293
|
-
const { asChild, children, ...buttonProps } = props;
|
|
294
|
-
if (asChild) {
|
|
295
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
296
|
-
import_factory.ark.div,
|
|
297
|
-
{
|
|
298
|
-
className: (0, import_css6.cx)(
|
|
299
|
-
(0, import_recipes6.button)({
|
|
300
|
-
shape: "rounded",
|
|
301
|
-
usage: "ghost"
|
|
302
|
-
}),
|
|
303
|
-
(0, import_css6.css)({
|
|
304
|
-
w: "1/2"
|
|
305
|
-
})
|
|
306
|
-
),
|
|
307
|
-
asChild: true,
|
|
308
|
-
children
|
|
309
|
-
}
|
|
310
|
-
);
|
|
311
|
-
}
|
|
312
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
313
|
-
Button,
|
|
314
|
-
{
|
|
315
|
-
...buttonProps,
|
|
316
|
-
className: (0, import_css6.css)({
|
|
317
|
-
w: "1/2"
|
|
318
|
-
}),
|
|
319
|
-
shape: "rounded",
|
|
320
|
-
usage: "outlined",
|
|
321
|
-
children
|
|
322
|
-
}
|
|
323
|
-
);
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
// src/components/cta-dialog/provider.tsx
|
|
327
|
-
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
282
|
+
var CTAModalContext = (0, import_react7.createContext)(null);
|
|
328
283
|
function CTAModal(props) {
|
|
329
|
-
|
|
330
|
-
const [
|
|
284
|
+
var _a, _b;
|
|
285
|
+
const [open, setOpen] = (0, import_react7.useState)(false);
|
|
286
|
+
const [content, setContent] = (0, import_react7.useState)(null);
|
|
331
287
|
const confirmIcon = content == null ? void 0 : content.icon;
|
|
332
288
|
const { icons } = useCerberusContext();
|
|
333
289
|
const { confirmModal: FallbackIcon } = icons;
|
|
334
|
-
const handleShow = (0,
|
|
290
|
+
const handleShow = (0, import_react7.useCallback)(
|
|
335
291
|
(options) => {
|
|
292
|
+
const maxActions = 2;
|
|
293
|
+
if (options.actions.length > maxActions) {
|
|
294
|
+
throw new Error(
|
|
295
|
+
`CTA Modal only supports a maximum of ${maxActions} actions.`
|
|
296
|
+
);
|
|
297
|
+
}
|
|
336
298
|
setContent({ ...options });
|
|
337
299
|
setOpen(true);
|
|
338
300
|
},
|
|
339
301
|
[setOpen]
|
|
340
302
|
);
|
|
341
|
-
const handleActionClick = (0,
|
|
303
|
+
const handleActionClick = (0, import_react7.useCallback)(
|
|
342
304
|
(event) => {
|
|
343
|
-
|
|
344
|
-
const
|
|
345
|
-
const
|
|
346
|
-
|
|
347
|
-
(_a = action == null ? void 0 : action.handleClick) == null ? void 0 : _a.call(action, event);
|
|
305
|
+
const index = event.currentTarget.getAttribute("data-index");
|
|
306
|
+
const action = content == null ? void 0 : content.actions[Number(index)];
|
|
307
|
+
const { onClick } = action || {};
|
|
308
|
+
onClick == null ? void 0 : onClick(event);
|
|
348
309
|
setOpen(false);
|
|
349
310
|
},
|
|
350
311
|
[content, setOpen]
|
|
351
312
|
);
|
|
352
|
-
const value = (0,
|
|
313
|
+
const value = (0, import_react7.useMemo)(
|
|
353
314
|
() => ({
|
|
354
315
|
show: handleShow
|
|
355
316
|
}),
|
|
356
317
|
[handleShow]
|
|
357
318
|
);
|
|
358
|
-
return /* @__PURE__ */ (0,
|
|
319
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(CTAModalContext.Provider, { value, children: [
|
|
359
320
|
props.children,
|
|
360
|
-
/* @__PURE__ */ (0,
|
|
361
|
-
/* @__PURE__ */ (0,
|
|
362
|
-
/* @__PURE__ */ (0,
|
|
363
|
-
/* @__PURE__ */ (0,
|
|
364
|
-
/* @__PURE__ */ (0,
|
|
321
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DialogProvider, { open, onOpenChange: (e) => setOpen(e.open), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Dialog, { size: "sm", children: [
|
|
322
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DialogCloseIconTrigger, {}),
|
|
323
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx3.VStack, { gap: "xl", w: "full", children: [
|
|
324
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx3.VStack, { alignItems: "flex-start", gap: "md", w: "full", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx3.VStack, { gap: "lg", w: "full", children: [
|
|
325
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
365
326
|
Avatar,
|
|
366
327
|
{
|
|
367
328
|
ariaLabel: "",
|
|
368
329
|
gradient: "charon-light",
|
|
369
|
-
icon: /* @__PURE__ */ (0,
|
|
330
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
370
331
|
Show,
|
|
371
332
|
{
|
|
372
333
|
when: Boolean(confirmIcon),
|
|
373
|
-
fallback: /* @__PURE__ */ (0,
|
|
334
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(FallbackIcon, { size: 24 }),
|
|
374
335
|
children: confirmIcon
|
|
375
336
|
}
|
|
376
337
|
),
|
|
377
338
|
src: ""
|
|
378
339
|
}
|
|
379
340
|
),
|
|
380
|
-
/* @__PURE__ */ (0,
|
|
381
|
-
/* @__PURE__ */ (0,
|
|
341
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DialogHeading, { children: content == null ? void 0 : content.heading }),
|
|
342
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DialogDescription, { children: content == null ? void 0 : content.description })
|
|
382
343
|
] }) }),
|
|
383
|
-
/* @__PURE__ */ (0,
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
{
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
344
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx2.HStack, { gap: "md", w: "full", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Show, { when: Boolean((_a = content == null ? void 0 : content.actions) == null ? void 0 : _a.length), children: (_b = content == null ? void 0 : content.actions) == null ? void 0 : _b.map((action, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
345
|
+
Button,
|
|
346
|
+
{
|
|
347
|
+
"data-index": index,
|
|
348
|
+
className: (0, import_css6.css)({
|
|
349
|
+
w: "1/2"
|
|
350
|
+
}),
|
|
351
|
+
onClick: handleActionClick,
|
|
352
|
+
shape: "rounded",
|
|
353
|
+
usage: "outlined",
|
|
354
|
+
children: action.text
|
|
355
|
+
},
|
|
356
|
+
index
|
|
357
|
+
)) }) })
|
|
395
358
|
] })
|
|
396
359
|
] }) })
|
|
397
360
|
] });
|
|
398
361
|
}
|
|
399
362
|
function useCTAModal() {
|
|
400
|
-
const context = (0,
|
|
363
|
+
const context = (0, import_react7.useContext)(CTAModalContext);
|
|
401
364
|
if (context === null) {
|
|
402
365
|
throw new Error("useCTAModal must be used within a CTAModal Provider");
|
|
403
366
|
}
|
|
@@ -408,4 +371,4 @@ function useCTAModal() {
|
|
|
408
371
|
CTAModal,
|
|
409
372
|
useCTAModal
|
|
410
373
|
});
|
|
411
|
-
//# sourceMappingURL=
|
|
374
|
+
//# sourceMappingURL=cta-modal.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/context/cta-modal.tsx","../../../src/components/button/button.tsx","../../../src/components/Show.tsx","../../../src/components/Avatar.tsx","../../../src/context/cerberus.tsx","../../../src/components/Dialog.tsx","../../../src/components/Portal.tsx","../../../src/components/Dialog.client.tsx","../../../src/components/IconButton.tsx"],"sourcesContent":["'use client'\n\nimport {\n createContext,\n useCallback,\n useContext,\n useMemo,\n useState,\n type MouseEvent,\n type MouseEventHandler,\n type PropsWithChildren,\n type ReactNode,\n} from 'react'\nimport { Button } from '../components/button/button'\nimport { Show } from '../components/Show'\nimport { Avatar } from '../components/Avatar'\nimport { useCerberusContext } from './cerberus'\nimport { HStack } from '@cerberus/styled-system/jsx'\nimport { css } from '@cerberus/styled-system/css'\nimport { VStack } from '@cerberus/styled-system/jsx'\nimport {\n Dialog,\n DialogDescription,\n DialogHeading,\n DialogProvider,\n} from '../components/Dialog'\nimport { DialogCloseIconTrigger } from '../components/Dialog.client'\n\n/**\n * This module provides a context and hook for the cta modal.\n * @module\n */\n\nexport interface ShowCTAModalOptions {\n /**\n * The heading of the cta modal.\n */\n heading: string\n /**\n * The description of the cta modal.\n */\n description?: string\n /**\n * The icon used for the modal Avatar.\n */\n icon?: ReactNode\n /**\n * The actions for the cta modal. Max of 2 actions.\n */\n actions: {\n text: string\n onClick: MouseEventHandler<HTMLButtonElement>\n }[]\n}\n\nexport interface CTAModalValue {\n show: (options: ShowCTAModalOptions) => void\n}\n\nconst CTAModalContext = createContext<CTAModalValue | null>(null)\n\nexport type CTAModalProviderProps = PropsWithChildren<unknown>\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<CTAModalProviderProps>) {\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 const maxActions = 2\n if (options.actions.length > maxActions) {\n throw new Error(\n `CTA Modal only supports a maximum of ${maxActions} actions.`,\n )\n }\n setContent({ ...options })\n setOpen(true)\n },\n [setOpen],\n )\n\n const handleActionClick = useCallback(\n (event: MouseEvent<HTMLButtonElement>) => {\n const index = event.currentTarget.getAttribute('data-index')\n const action = content?.actions[Number(index)]\n const { onClick } = action || {}\n onClick?.(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 <Show when={Boolean(content?.actions?.length)}>\n {content?.actions?.map((action, index) => (\n <Button\n data-index={index}\n className={css({\n w: '1/2',\n })}\n key={index}\n onClick={handleActionClick}\n shape=\"rounded\"\n usage=\"outlined\"\n >\n {action.text}\n </Button>\n ))}\n </Show>\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","'use client'\n\nimport {\n type ButtonHTMLAttributes,\n type PropsWithChildren,\n createContext,\n useContext,\n useMemo,\n} from 'react'\nimport { cx } from '@cerberus/styled-system/css'\nimport {\n button,\n type ButtonVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport { Box } from '@cerberus/styled-system/jsx'\nimport { Show } from '../Show'\nimport { Spinner } from '../Spinner'\n\n/**\n * This module contains the Button component.\n * @module\n */\n\ninterface ButtonContextValue {\n pending: boolean\n}\n\nconst ButtonContext = createContext<ButtonContextValue>({\n pending: false,\n})\n\nexport type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> &\n ButtonVariantProps & {\n pending?: boolean\n }\n\n/**\n * A component that allows the user to perform actions\n * @see https://cerberus.digitalu.design/react/button\n */\nexport function Button(props: ButtonProps): JSX.Element {\n const { palette, usage, shape, size, pending = false, ...nativeProps } = props\n const value = useMemo(() => ({ pending }), [pending])\n\n return (\n <ButtonContext.Provider value={value}>\n <button\n {...nativeProps}\n disabled={pending || nativeProps.disabled}\n className={cx(\n nativeProps.className,\n button({\n palette,\n usage,\n shape,\n size,\n }),\n )}\n />\n </ButtonContext.Provider>\n )\n}\n\n/**\n * An icon to display in a button that utilizes the pending state to display\n * a loading spinner.\n */\nexport function ButtonIcon(props: PropsWithChildren<object>) {\n const { pending } = useContext(ButtonContext)\n return (\n <Show when={pending} fallback={<>{props.children}</>}>\n <Box w=\"4\">\n <Spinner />\n </Box>\n </Show>\n )\n}\n","'use client'\n\nimport { useMemo, type PropsWithChildren, type ReactNode } from 'react'\n\n/**\n * This module contains the Show component.\n * @module\n */\n\nexport interface ShowProps {\n /**\n * The condition to render memoized children or the fallback content.\n */\n when: boolean | null | undefined\n /**\n * The children to render when the condition is false.\n */\n fallback?: ReactNode\n}\n\n/**\n * Conditionally render a memoized version of the children or optional fallback\n * content.\n * @see https://cerberus.digitalu.design/react/show\n * @example\n * ```tsx\n * <Show when={isLoggedIn} fallback={<Navigate to=\"/login\" />}>\n * <Dashboard />\n * </Show>\n */\nexport function Show(props: PropsWithChildren<ShowProps>): ReactNode {\n const { when, children, fallback } = props\n const condition = useMemo(() => when ?? false, [when])\n\n return useMemo(() => {\n if (condition) return children\n return fallback ?? null\n }, [condition, children, fallback])\n}\n","'use client'\n\nimport { css, cx } from '@cerberus/styled-system/css'\nimport { circle } from '@cerberus/styled-system/patterns'\nimport {\n avatar,\n type AvatarVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport type { HtmlHTMLAttributes, ReactNode } from 'react'\nimport { Show } from './Show'\nimport { useCerberusContext } from '../context/cerberus'\n\n/**\n * This module contains the Avatar component.\n * @module\n */\n\nexport type SharedAvatarProps = {\n /**\n * An optional icon to show when no src or ariaLabel is provided.\n */\n icon?: ReactNode\n /**\n * The size of the avatar.\n */\n width?: number\n /**\n * The size of the avatar.\n */\n height?: number\n}\nexport type AvatarImageProps = HtmlHTMLAttributes<HTMLImageElement> &\n SharedAvatarProps & {\n /**\n * The aria-label for the avatar needed for accessibility.\n */\n ariaLabel: string\n /**\n * An optional element to replace the image. Recommended for Next.js Image component.\n */\n as?: never\n /**\n * The source of the image.\n */\n src: string\n }\nexport type AvatarAsProps = SharedAvatarProps & {\n /**\n * An optional element to replace the image. Recommended for Next.js Image component.\n */\n as: ReactNode\n /**\n * The aria-label for the avatar needed for accessibility.\n */\n ariaLabel?: never\n /**\n * The source of the image.\n */\n src?: never\n}\n\nexport type AvatarProps = (HtmlHTMLAttributes<HTMLDivElement> &\n AvatarVariantProps) &\n (AvatarImageProps | AvatarAsProps)\n\n/**\n * The Avatar component is used to represent a user or entity. It will show an image if src provided, otherwise it will show the ariaLabel of the ariaLabel. If the ariaLabel is empty, it will show a `defineIcons().avatar` icon.\n * @see https://cerberus.digitalu.design/react/avatar\n * @example\n * ```tsx\n * <Avatar\n * ariaLabel=\"Protector Cerberus\"\n * src=\"https://cerberus.digitalu.design/logo.svg\"\n * />\n * ```\n */\nexport function Avatar(props: AvatarProps) {\n const {\n ariaLabel,\n as,\n gradient,\n size,\n src,\n width,\n height,\n icon,\n ...nativeProps\n } = props\n const { icons } = useCerberusContext()\n const { avatar: AvatarIcon } = icons\n const initials = (ariaLabel || '')\n .split(' ')\n .map((word) => word[0])\n .join('')\n .slice(0, 2)\n\n return (\n <div\n {...nativeProps}\n className={cx(\n nativeProps.className,\n avatar({ gradient, size }),\n circle(),\n )}\n >\n <Show\n when={Boolean(src) || Boolean(as)}\n fallback={\n <Show\n when={Boolean(initials)}\n fallback={\n <Show\n when={Boolean(icon)}\n fallback={\n <AvatarIcon\n size={iconSizeMap[size as keyof typeof iconSizeMap]}\n />\n }\n >\n {icon}\n </Show>\n }\n >\n {initials}\n </Show>\n }\n >\n <Show\n when={Boolean(as)}\n fallback={\n <img\n alt={props.ariaLabel}\n className={css({\n h: 'full',\n objectFit: 'cover',\n w: 'full',\n })}\n decoding=\"async\"\n loading=\"lazy\"\n src={src}\n height={height}\n width={width}\n />\n }\n >\n {as}\n </Show>\n </Show>\n </div>\n )\n}\n\nconst iconSizeMap = {\n xs: 16,\n sm: 16,\n md: 20,\n lg: 34,\n xl: 32,\n '2xl': 32,\n '3xl': 32,\n '4xl': 32,\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","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","'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"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,IAAAA,gBAUO;;;ACVP,IAAAC,gBAMO;AACP,iBAAmB;AACnB,qBAGO;AACP,iBAAoB;;;ACZpB,mBAAgE;AA4BzD,SAAS,KAAK,OAAgD;AACnE,QAAM,EAAE,MAAM,UAAU,SAAS,IAAI;AACrC,QAAM,gBAAY,sBAAQ,MAAM,QAAQ,OAAO,CAAC,IAAI,CAAC;AAErD,aAAO,sBAAQ,MAAM;AACnB,QAAI,UAA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AAAA,YACT,OAAM;AAAA,YACN,OAAM;AAAA,YAEL,iBAAO;AAAA;AAAA,UALH;AAAA,QAMP,IAEJ,GACF;AAAA,SACF;AAAA,OACF,GACF;AAAA,KACF;AAEJ;AAEO,SAAS,cAA6B;AAC3C,QAAM,cAAU,0BAAW,eAAe;AAC1C,MAAI,YAAY,MAAM;AACpB,UAAM,IAAI,MAAM,qDAAqD;AAAA,EACvE;AACA,SAAO;AACT;","names":["import_react","import_react","import_css","import_recipes","import_react","import_jsx_runtime","import_jsx_runtime","import_jsx","import_css","import_react","import_recipes","import_react","ArkPortal","import_css","import_jsx_runtime","ArkDialog","import_react","import_recipes","import_css","import_css","import_recipes","import_jsx_runtime","import_jsx_runtime","ArkDialog","import_jsx_runtime"]}
|