@cerberus-design/react 0.16.0-next-4f6c716 → 0.16.0-next-feeb186
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 +82 -25
- package/build/legacy/components/cta-dialog/context.cjs +33 -0
- package/build/legacy/components/cta-dialog/context.cjs.map +1 -0
- package/build/legacy/components/cta-dialog/index.cjs +433 -0
- package/build/legacy/components/cta-dialog/index.cjs.map +1 -0
- package/build/legacy/{context/cta-modal.cjs → components/cta-dialog/provider.cjs} +187 -150
- package/build/legacy/components/cta-dialog/provider.cjs.map +1 -0
- package/build/legacy/components/cta-dialog/trigger-item.cjs +99 -0
- package/build/legacy/components/cta-dialog/trigger-item.cjs.map +1 -0
- package/build/legacy/components/cta-dialog/utils.cjs +47 -0
- package/build/legacy/components/cta-dialog/utils.cjs.map +1 -0
- package/build/legacy/components/for.cjs +3 -4
- package/build/legacy/components/for.cjs.map +1 -1
- package/build/legacy/index.cjs +771 -715
- package/build/legacy/index.cjs.map +1 -1
- package/build/modern/_tsup-dts-rollup.d.ts +82 -25
- package/build/modern/chunk-4LSTU6WU.js +8 -0
- package/build/modern/chunk-4LSTU6WU.js.map +1 -0
- package/build/modern/{chunk-P3SF56LT.js → chunk-6ICNCCPD.js} +4 -4
- package/build/modern/chunk-DXOKSZVQ.js +12 -0
- package/build/modern/chunk-DXOKSZVQ.js.map +1 -0
- package/build/modern/chunk-IKDXADLX.js +1 -0
- package/build/modern/chunk-MVO2GNUA.js +47 -0
- package/build/modern/chunk-MVO2GNUA.js.map +1 -0
- package/build/modern/{chunk-CMYD5KWA.js → chunk-O542MPR7.js} +4 -4
- package/build/modern/chunk-PLHYOCY3.js +23 -0
- package/build/modern/chunk-PLHYOCY3.js.map +1 -0
- package/build/modern/{chunk-ZDANBCM3.js → chunk-QEM3M4N3.js} +22 -31
- package/build/modern/chunk-QEM3M4N3.js.map +1 -0
- package/build/modern/{chunk-FMRWRVUS.js → chunk-Z4342DRO.js} +4 -4
- package/build/modern/components/cta-dialog/context.js +8 -0
- package/build/modern/components/cta-dialog/context.js.map +1 -0
- package/build/modern/components/cta-dialog/index.js +26 -0
- package/build/modern/components/cta-dialog/index.js.map +1 -0
- package/build/modern/components/cta-dialog/provider.js +22 -0
- package/build/modern/components/cta-dialog/provider.js.map +1 -0
- package/build/modern/components/cta-dialog/trigger-item.js +10 -0
- package/build/modern/components/cta-dialog/trigger-item.js.map +1 -0
- package/build/modern/components/cta-dialog/utils.js +7 -0
- package/build/modern/components/cta-dialog/utils.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/notification-center.js +2 -2
- package/build/modern/context/prompt-modal.js +2 -2
- package/build/modern/index.js +83 -76
- package/build/modern/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/cta-dialog/context.tsx +34 -0
- package/src/components/cta-dialog/index.ts +2 -0
- package/src/{context/cta-modal.tsx → components/cta-dialog/provider.tsx} +34 -68
- package/src/components/cta-dialog/trigger-item.tsx +53 -0
- package/src/components/cta-dialog/utils.ts +57 -0
- package/src/components/for.tsx +13 -18
- package/src/index.ts +1 -1
- package/build/legacy/context/cta-modal.cjs.map +0 -1
- package/build/modern/chunk-IIH363FO.js +0 -13
- package/build/modern/chunk-IIH363FO.js.map +0 -1
- package/build/modern/chunk-ZDANBCM3.js.map +0 -1
- package/build/modern/context/cta-modal.js +0 -19
- /package/build/modern/{chunk-P3SF56LT.js.map → chunk-6ICNCCPD.js.map} +0 -0
- /package/build/modern/{context/cta-modal.js.map → chunk-IKDXADLX.js.map} +0 -0
- /package/build/modern/{chunk-CMYD5KWA.js.map → chunk-O542MPR7.js.map} +0 -0
- /package/build/modern/{chunk-FMRWRVUS.js.map → chunk-Z4342DRO.js.map} +0 -0
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import {
|
|
3
3
|
PromptModal,
|
|
4
4
|
usePromptModal
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-O542MPR7.js";
|
|
6
|
+
import "../chunk-RU5LOXWI.js";
|
|
6
7
|
import "../chunk-TFL56AYR.js";
|
|
7
8
|
import "../chunk-SXLPDPOZ.js";
|
|
8
9
|
import "../chunk-IQJDVFPP.js";
|
|
9
|
-
import "../chunk-RU5LOXWI.js";
|
|
10
10
|
import "../chunk-TYPULJMJ.js";
|
|
11
11
|
import "../chunk-FBS7AX76.js";
|
|
12
12
|
import "../chunk-6I2FW4WI.js";
|
package/build/modern/index.js
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Label
|
|
3
|
+
} from "./chunk-LT62577B.js";
|
|
4
|
+
import {
|
|
5
|
+
Modal
|
|
6
|
+
} from "./chunk-Q3I4H6EC.js";
|
|
7
|
+
import {
|
|
8
|
+
ModalDescription
|
|
9
|
+
} from "./chunk-WECB67DC.js";
|
|
10
|
+
import {
|
|
11
|
+
ModalHeader
|
|
12
|
+
} from "./chunk-AUALRL3U.js";
|
|
1
13
|
import {
|
|
2
14
|
ModalHeading
|
|
3
15
|
} from "./chunk-SWX5JWZR.js";
|
|
@@ -17,18 +29,6 @@ import {
|
|
|
17
29
|
import {
|
|
18
30
|
FieldsetLabel
|
|
19
31
|
} from "./chunk-DRDNNRU3.js";
|
|
20
|
-
import {
|
|
21
|
-
Label
|
|
22
|
-
} from "./chunk-LT62577B.js";
|
|
23
|
-
import {
|
|
24
|
-
Modal
|
|
25
|
-
} from "./chunk-Q3I4H6EC.js";
|
|
26
|
-
import {
|
|
27
|
-
ModalDescription
|
|
28
|
-
} from "./chunk-WECB67DC.js";
|
|
29
|
-
import {
|
|
30
|
-
ModalHeader
|
|
31
|
-
} from "./chunk-AUALRL3U.js";
|
|
32
32
|
import {
|
|
33
33
|
NavMenu,
|
|
34
34
|
useNavMenuContext
|
|
@@ -36,15 +36,18 @@ import {
|
|
|
36
36
|
import {
|
|
37
37
|
NotificationCenter,
|
|
38
38
|
useNotificationCenter
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-Z4342DRO.js";
|
|
40
40
|
import {
|
|
41
41
|
PromptModal,
|
|
42
42
|
usePromptModal
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-O542MPR7.js";
|
|
44
44
|
import {
|
|
45
45
|
ThemeProvider,
|
|
46
46
|
useThemeContext
|
|
47
47
|
} from "./chunk-EB37HRCN.js";
|
|
48
|
+
import {
|
|
49
|
+
Td
|
|
50
|
+
} from "./chunk-3R4TIF2X.js";
|
|
48
51
|
import {
|
|
49
52
|
Th
|
|
50
53
|
} from "./chunk-SGKHA4EB.js";
|
|
@@ -54,17 +57,10 @@ import {
|
|
|
54
57
|
import {
|
|
55
58
|
Tooltip
|
|
56
59
|
} from "./chunk-LPALHB6R.js";
|
|
57
|
-
import {
|
|
58
|
-
For
|
|
59
|
-
} from "./chunk-IIH363FO.js";
|
|
60
60
|
import {
|
|
61
61
|
ConfirmModal,
|
|
62
62
|
useConfirmModal
|
|
63
63
|
} from "./chunk-H54FR7IP.js";
|
|
64
|
-
import {
|
|
65
|
-
CTAModal,
|
|
66
|
-
useCTAModal
|
|
67
|
-
} from "./chunk-ZDANBCM3.js";
|
|
68
64
|
import {
|
|
69
65
|
Table,
|
|
70
66
|
Tr
|
|
@@ -88,8 +84,15 @@ import {
|
|
|
88
84
|
Tbody
|
|
89
85
|
} from "./chunk-ZR37P4NZ.js";
|
|
90
86
|
import {
|
|
91
|
-
|
|
92
|
-
|
|
87
|
+
FileStatus,
|
|
88
|
+
processStatus
|
|
89
|
+
} from "./chunk-ZFFW5ELD.js";
|
|
90
|
+
import {
|
|
91
|
+
ProgressBar
|
|
92
|
+
} from "./chunk-WZJ5UQNM.js";
|
|
93
|
+
import {
|
|
94
|
+
FileUploader
|
|
95
|
+
} from "./chunk-7SU6FCTJ.js";
|
|
93
96
|
import {
|
|
94
97
|
Legend
|
|
95
98
|
} from "./chunk-RBNOEAWJ.js";
|
|
@@ -111,6 +114,9 @@ import {
|
|
|
111
114
|
import {
|
|
112
115
|
NotificationHeading
|
|
113
116
|
} from "./chunk-SLHYBPJ5.js";
|
|
117
|
+
import {
|
|
118
|
+
CircularProgress
|
|
119
|
+
} from "./chunk-6QHOKCV3.js";
|
|
114
120
|
import {
|
|
115
121
|
DatePicker,
|
|
116
122
|
DatePickerCalendar,
|
|
@@ -133,20 +139,6 @@ import {
|
|
|
133
139
|
DatePickerView,
|
|
134
140
|
DatePickerViewControl
|
|
135
141
|
} from "./chunk-5EWCH7AI.js";
|
|
136
|
-
import {
|
|
137
|
-
DialogCloseIconTrigger
|
|
138
|
-
} from "./chunk-6BN3XKQF.js";
|
|
139
|
-
import {
|
|
140
|
-
Dialog,
|
|
141
|
-
DialogBackdrop,
|
|
142
|
-
DialogCloseTrigger,
|
|
143
|
-
DialogContent,
|
|
144
|
-
DialogDescription,
|
|
145
|
-
DialogHeading,
|
|
146
|
-
DialogPositioner,
|
|
147
|
-
DialogProvider,
|
|
148
|
-
DialogTrigger
|
|
149
|
-
} from "./chunk-TFL56AYR.js";
|
|
150
142
|
import {
|
|
151
143
|
Droppable
|
|
152
144
|
} from "./chunk-TKI2CKHH.js";
|
|
@@ -157,19 +149,7 @@ import {
|
|
|
157
149
|
FeatureFlags,
|
|
158
150
|
useFeatureFlags
|
|
159
151
|
} from "./chunk-CJFW36DZ.js";
|
|
160
|
-
import
|
|
161
|
-
FileStatus,
|
|
162
|
-
processStatus
|
|
163
|
-
} from "./chunk-ZFFW5ELD.js";
|
|
164
|
-
import {
|
|
165
|
-
ProgressBar
|
|
166
|
-
} from "./chunk-WZJ5UQNM.js";
|
|
167
|
-
import {
|
|
168
|
-
IconButton
|
|
169
|
-
} from "./chunk-APD6IX5R.js";
|
|
170
|
-
import {
|
|
171
|
-
FileUploader
|
|
172
|
-
} from "./chunk-7SU6FCTJ.js";
|
|
152
|
+
import "./chunk-V3M3ZOQI.js";
|
|
173
153
|
import {
|
|
174
154
|
AccordionItemGroup
|
|
175
155
|
} from "./chunk-WN7TJX6J.js";
|
|
@@ -188,12 +168,23 @@ import {
|
|
|
188
168
|
AdmonitionHeading
|
|
189
169
|
} from "./chunk-DXBZ3HMY.js";
|
|
190
170
|
import "./chunk-2HOUQ2DX.js";
|
|
171
|
+
import "./chunk-OGYMMATX.js";
|
|
191
172
|
import {
|
|
192
|
-
|
|
193
|
-
} from "./chunk-
|
|
173
|
+
Radio
|
|
174
|
+
} from "./chunk-STLN7BMJ.js";
|
|
194
175
|
import {
|
|
195
|
-
|
|
196
|
-
} from "./chunk-
|
|
176
|
+
RadioParts
|
|
177
|
+
} from "./chunk-FUL2VRDU.js";
|
|
178
|
+
import {
|
|
179
|
+
RadioGroup,
|
|
180
|
+
RadioGroupIndicator,
|
|
181
|
+
RadioGroupItem,
|
|
182
|
+
RadioGroupItemControl,
|
|
183
|
+
RadioGroupItemHiddenInput,
|
|
184
|
+
RadioGroupItemText,
|
|
185
|
+
RadioGroupLabel,
|
|
186
|
+
RadioGroupRoot
|
|
187
|
+
} from "./chunk-5RTNSVYU.js";
|
|
197
188
|
import "./chunk-2LF3HPNA.js";
|
|
198
189
|
import {
|
|
199
190
|
OptionGroup,
|
|
@@ -202,10 +193,7 @@ import {
|
|
|
202
193
|
import {
|
|
203
194
|
Option,
|
|
204
195
|
Select
|
|
205
|
-
} from "./chunk-
|
|
206
|
-
import {
|
|
207
|
-
Portal
|
|
208
|
-
} from "./chunk-IQJDVFPP.js";
|
|
196
|
+
} from "./chunk-6ICNCCPD.js";
|
|
209
197
|
import {
|
|
210
198
|
SelectParts
|
|
211
199
|
} from "./chunk-XTNGF4D6.js";
|
|
@@ -250,7 +238,6 @@ import {
|
|
|
250
238
|
ToggleIndicator,
|
|
251
239
|
ToggleRoot
|
|
252
240
|
} from "./chunk-CIMY2U22.js";
|
|
253
|
-
import "./chunk-V3M3ZOQI.js";
|
|
254
241
|
import "./chunk-TIJAFPHQ.js";
|
|
255
242
|
import {
|
|
256
243
|
Checkbox
|
|
@@ -270,6 +257,42 @@ import {
|
|
|
270
257
|
CheckboxLabel,
|
|
271
258
|
CheckboxRoot
|
|
272
259
|
} from "./chunk-BPRF34DU.js";
|
|
260
|
+
import "./chunk-IKDXADLX.js";
|
|
261
|
+
import {
|
|
262
|
+
CTAModal,
|
|
263
|
+
useCTAModal
|
|
264
|
+
} from "./chunk-QEM3M4N3.js";
|
|
265
|
+
import "./chunk-4LSTU6WU.js";
|
|
266
|
+
import "./chunk-MVO2GNUA.js";
|
|
267
|
+
import {
|
|
268
|
+
For
|
|
269
|
+
} from "./chunk-DXOKSZVQ.js";
|
|
270
|
+
import {
|
|
271
|
+
DialogCloseIconTrigger
|
|
272
|
+
} from "./chunk-6BN3XKQF.js";
|
|
273
|
+
import {
|
|
274
|
+
IconButton
|
|
275
|
+
} from "./chunk-APD6IX5R.js";
|
|
276
|
+
import {
|
|
277
|
+
Dialog,
|
|
278
|
+
DialogBackdrop,
|
|
279
|
+
DialogCloseTrigger,
|
|
280
|
+
DialogContent,
|
|
281
|
+
DialogDescription,
|
|
282
|
+
DialogHeading,
|
|
283
|
+
DialogPositioner,
|
|
284
|
+
DialogProvider,
|
|
285
|
+
DialogTrigger
|
|
286
|
+
} from "./chunk-TFL56AYR.js";
|
|
287
|
+
import {
|
|
288
|
+
Avatar
|
|
289
|
+
} from "./chunk-SXLPDPOZ.js";
|
|
290
|
+
import {
|
|
291
|
+
Portal
|
|
292
|
+
} from "./chunk-IQJDVFPP.js";
|
|
293
|
+
import {
|
|
294
|
+
createCTAModalActions
|
|
295
|
+
} from "./chunk-PLHYOCY3.js";
|
|
273
296
|
import "./chunk-TYPULJMJ.js";
|
|
274
297
|
import {
|
|
275
298
|
Field
|
|
@@ -311,23 +334,6 @@ import {
|
|
|
311
334
|
FieldsetLegend,
|
|
312
335
|
FieldsetRoot
|
|
313
336
|
} from "./chunk-Z3FDG263.js";
|
|
314
|
-
import "./chunk-OGYMMATX.js";
|
|
315
|
-
import {
|
|
316
|
-
Radio
|
|
317
|
-
} from "./chunk-STLN7BMJ.js";
|
|
318
|
-
import {
|
|
319
|
-
RadioParts
|
|
320
|
-
} from "./chunk-FUL2VRDU.js";
|
|
321
|
-
import {
|
|
322
|
-
RadioGroup,
|
|
323
|
-
RadioGroupIndicator,
|
|
324
|
-
RadioGroupItem,
|
|
325
|
-
RadioGroupItemControl,
|
|
326
|
-
RadioGroupItemHiddenInput,
|
|
327
|
-
RadioGroupItemText,
|
|
328
|
-
RadioGroupLabel,
|
|
329
|
-
RadioGroupRoot
|
|
330
|
-
} from "./chunk-5RTNSVYU.js";
|
|
331
337
|
import {
|
|
332
338
|
useModal
|
|
333
339
|
} from "./chunk-KGQG5JGW.js";
|
|
@@ -558,6 +564,7 @@ export {
|
|
|
558
564
|
ToggleRoot,
|
|
559
565
|
Tooltip,
|
|
560
566
|
Tr,
|
|
567
|
+
createCTAModalActions,
|
|
561
568
|
createNavTriggerProps,
|
|
562
569
|
createSelectCollection,
|
|
563
570
|
defineIcons,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["/**\n * This module is the entry point for the Cerberus React package.\n * @module\n */\n\n// deprecated\n\nexport * from './components/deprecated/FieldMessage'\nexport * from './components/deprecated/FieldsetLabel'\nexport * from './components/deprecated/Label'\nexport * from './components/deprecated/Modal'\nexport * from './components/deprecated/ModalHeader'\nexport * from './components/deprecated/ModalHeading'\nexport * from './components/deprecated/ModalDescription'\nexport * from './components/deprecated/NavMenuTrigger'\nexport * from './components/deprecated/NavMenuList'\nexport * from './components/deprecated/NavMenuLink'\nexport * from './hooks/useDate'\nexport * from './hooks/useModal'\nexport * from './hooks/useToggle'\n\n// components\n\nexport * from './components/Accordion'\nexport * from './components/Accordion.client'\nexport * from './components/AccordionItemGroup'\nexport * from './components/Admonition'\nexport * from './components/Avatar'\nexport * from './components/button/index'\nexport * from './components/checkbox/index'\nexport * from './components/CircularProgress'\nexport * from './components/DatePicker.client'\nexport * from './components/DatePicker.server'\nexport * from './components/Dialog'\nexport * from './components/Dialog.client'\nexport * from './components/Droppable'\nexport * from './components/FeatureFlag'\nexport * from './components/field/index'\nexport * from './components/fieldset/index'\nexport * from './components/FileStatus'\nexport * from './components/FileUploader'\nexport * from './components/for'\nexport * from './components/IconButton'\nexport * from './components/Legend'\nexport * from './components/Menu'\nexport * from './components/Notification'\nexport * from './components/NotificationHeading'\nexport * from './components/NotificationDescription'\nexport * from './components/Portal'\nexport * from './components/ProgressBar'\nexport * from './components/radio/index'\nexport * from './components/select/index'\nexport * from './components/Show'\nexport * from './components/Spinner'\nexport * from './components/switch/index'\nexport * from './components/Tabs.client'\nexport * from './components/Table'\nexport * from './components/Thead'\nexport * from './components/Th'\nexport * from './components/Td'\nexport * from './components/Tbody'\nexport * from './components/Tag'\nexport * from './components/Text'\nexport * from './components/toggle/index'\nexport * from './components/Tooltip'\n\n// context\n\nexport * from './context/cerberus'\nexport * from './context/confirm-modal'\nexport * from './context/
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["/**\n * This module is the entry point for the Cerberus React package.\n * @module\n */\n\n// deprecated\n\nexport * from './components/deprecated/FieldMessage'\nexport * from './components/deprecated/FieldsetLabel'\nexport * from './components/deprecated/Label'\nexport * from './components/deprecated/Modal'\nexport * from './components/deprecated/ModalHeader'\nexport * from './components/deprecated/ModalHeading'\nexport * from './components/deprecated/ModalDescription'\nexport * from './components/deprecated/NavMenuTrigger'\nexport * from './components/deprecated/NavMenuList'\nexport * from './components/deprecated/NavMenuLink'\nexport * from './hooks/useDate'\nexport * from './hooks/useModal'\nexport * from './hooks/useToggle'\n\n// components\n\nexport * from './components/Accordion'\nexport * from './components/Accordion.client'\nexport * from './components/AccordionItemGroup'\nexport * from './components/Admonition'\nexport * from './components/Avatar'\nexport * from './components/button/index'\nexport * from './components/checkbox/index'\nexport * from './components/CircularProgress'\nexport * from './components/cta-dialog/index'\nexport * from './components/DatePicker.client'\nexport * from './components/DatePicker.server'\nexport * from './components/Dialog'\nexport * from './components/Dialog.client'\nexport * from './components/Droppable'\nexport * from './components/FeatureFlag'\nexport * from './components/field/index'\nexport * from './components/fieldset/index'\nexport * from './components/FileStatus'\nexport * from './components/FileUploader'\nexport * from './components/for'\nexport * from './components/IconButton'\nexport * from './components/Legend'\nexport * from './components/Menu'\nexport * from './components/Notification'\nexport * from './components/NotificationHeading'\nexport * from './components/NotificationDescription'\nexport * from './components/Portal'\nexport * from './components/ProgressBar'\nexport * from './components/radio/index'\nexport * from './components/select/index'\nexport * from './components/Show'\nexport * from './components/Spinner'\nexport * from './components/switch/index'\nexport * from './components/Tabs.client'\nexport * from './components/Table'\nexport * from './components/Thead'\nexport * from './components/Th'\nexport * from './components/Td'\nexport * from './components/Tbody'\nexport * from './components/Tag'\nexport * from './components/Text'\nexport * from './components/toggle/index'\nexport * from './components/Tooltip'\n\n// context\n\nexport * from './context/cerberus'\nexport * from './context/confirm-modal'\nexport * from './context/feature-flags'\nexport * from './context/navMenu'\nexport * from './context/notification-center'\nexport * from './context/prompt-modal'\nexport * from './context/tabs'\nexport * from './context/theme'\n\n// hooks\n\nexport * from './hooks/useTheme'\nexport * from './hooks/useRootColors'\n\n// aria-helpers\n\nexport * from './aria-helpers/nav-menu.aria'\nexport * from './aria-helpers/trap-focus.aria'\n\n// utils\n\nexport * from './config/index'\nexport * from './utils/index'\n\n// shared types\n\nexport * from './types'\n\n// 3rd party\n\nexport * from '@dnd-kit/core'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmGA,cAAc;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cerberus-design/react",
|
|
3
|
-
"version": "0.16.0-next-
|
|
3
|
+
"version": "0.16.0-next-feeb186",
|
|
4
4
|
"description": "The Cerberus Design React component library.",
|
|
5
5
|
"browserslist": "> 0.25%, not dead",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"react-dom": "^18",
|
|
27
27
|
"tsup": "^8.1.0",
|
|
28
28
|
"@cerberus-design/configs": "0.0.0",
|
|
29
|
-
"@cerberus/styled-system": "npm:@cerberus-design/styled-system@0.16.0-next-
|
|
29
|
+
"@cerberus/styled-system": "npm:@cerberus-design/styled-system@0.16.0-next-feeb186"
|
|
30
30
|
},
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { createContext, type ReactNode } from 'react'
|
|
4
|
+
import type { CTAModalActionReturn } from './utils'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* This module provides the context for the cta modal.
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export interface ShowCTAModalOptions {
|
|
12
|
+
/**
|
|
13
|
+
* The heading of the cta modal.
|
|
14
|
+
*/
|
|
15
|
+
heading: string
|
|
16
|
+
/**
|
|
17
|
+
* The description of the cta modal.
|
|
18
|
+
*/
|
|
19
|
+
description?: string
|
|
20
|
+
/**
|
|
21
|
+
* The icon used for the modal Avatar.
|
|
22
|
+
*/
|
|
23
|
+
icon?: ReactNode
|
|
24
|
+
/**
|
|
25
|
+
* The actions for the cta modal. Requires 2 actions.
|
|
26
|
+
*/
|
|
27
|
+
actions: CTAModalActionReturn
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface CTAModalValue {
|
|
31
|
+
show: (options: ShowCTAModalOptions) => void
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const CTAModalContext = createContext<CTAModalValue | null>(null)
|
|
@@ -1,66 +1,39 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
|
-
createContext,
|
|
5
4
|
useCallback,
|
|
6
5
|
useContext,
|
|
7
6
|
useMemo,
|
|
8
7
|
useState,
|
|
9
8
|
type MouseEvent,
|
|
10
|
-
type MouseEventHandler,
|
|
11
9
|
type PropsWithChildren,
|
|
12
10
|
type ReactNode,
|
|
13
11
|
} from 'react'
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import { css } from '@cerberus/styled-system/css'
|
|
20
|
-
import { VStack } from '@cerberus/styled-system/jsx'
|
|
12
|
+
import { HStack, VStack } from '@cerberus/styled-system/jsx'
|
|
13
|
+
import { useCerberusContext } from '../../context/cerberus'
|
|
14
|
+
import { Show } from '../Show'
|
|
15
|
+
import { For } from '../for'
|
|
16
|
+
import { Avatar } from '../Avatar'
|
|
21
17
|
import {
|
|
22
18
|
Dialog,
|
|
23
19
|
DialogDescription,
|
|
24
20
|
DialogHeading,
|
|
25
21
|
DialogProvider,
|
|
26
|
-
} from '../
|
|
27
|
-
import { DialogCloseIconTrigger } from '../
|
|
22
|
+
} from '../Dialog'
|
|
23
|
+
import { DialogCloseIconTrigger } from '../Dialog.client'
|
|
24
|
+
import type { CTAButtonAction, CTAModalActionReturn } from './utils'
|
|
25
|
+
import {
|
|
26
|
+
CTAModalContext,
|
|
27
|
+
type CTAModalValue,
|
|
28
|
+
type ShowCTAModalOptions,
|
|
29
|
+
} from './context'
|
|
30
|
+
import { TriggerItem } from './trigger-item'
|
|
28
31
|
|
|
29
32
|
/**
|
|
30
|
-
* This module provides
|
|
31
|
-
* @module
|
|
33
|
+
* This module provides the provider and hook for the cta modal.
|
|
34
|
+
* @module 'react/cta-modal/provider'
|
|
32
35
|
*/
|
|
33
36
|
|
|
34
|
-
export interface ShowCTAModalOptions {
|
|
35
|
-
/**
|
|
36
|
-
* The heading of the cta modal.
|
|
37
|
-
*/
|
|
38
|
-
heading: string
|
|
39
|
-
/**
|
|
40
|
-
* The description of the cta modal.
|
|
41
|
-
*/
|
|
42
|
-
description?: string
|
|
43
|
-
/**
|
|
44
|
-
* The icon used for the modal Avatar.
|
|
45
|
-
*/
|
|
46
|
-
icon?: ReactNode
|
|
47
|
-
/**
|
|
48
|
-
* The actions for the cta modal. Max of 2 actions.
|
|
49
|
-
*/
|
|
50
|
-
actions: {
|
|
51
|
-
text: string
|
|
52
|
-
onClick: MouseEventHandler<HTMLButtonElement>
|
|
53
|
-
}[]
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export interface CTAModalValue {
|
|
57
|
-
show: (options: ShowCTAModalOptions) => void
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const CTAModalContext = createContext<CTAModalValue | null>(null)
|
|
61
|
-
|
|
62
|
-
export type CTAModalProviderProps = PropsWithChildren<unknown>
|
|
63
|
-
|
|
64
37
|
/**
|
|
65
38
|
* Provides a CTA modal to the app.
|
|
66
39
|
* @see https://cerberus.digitalu.design/react/cta-modal
|
|
@@ -93,7 +66,7 @@ export type CTAModalProviderProps = PropsWithChildren<unknown>
|
|
|
93
66
|
* }, [cta])
|
|
94
67
|
* ```
|
|
95
68
|
*/
|
|
96
|
-
export function CTAModal(props: PropsWithChildren<
|
|
69
|
+
export function CTAModal(props: PropsWithChildren<object>) {
|
|
97
70
|
const [open, setOpen] = useState<boolean>(false)
|
|
98
71
|
const [content, setContent] = useState<ShowCTAModalOptions | null>(null)
|
|
99
72
|
const confirmIcon = content?.icon
|
|
@@ -103,12 +76,6 @@ export function CTAModal(props: PropsWithChildren<CTAModalProviderProps>) {
|
|
|
103
76
|
|
|
104
77
|
const handleShow = useCallback(
|
|
105
78
|
(options: ShowCTAModalOptions) => {
|
|
106
|
-
const maxActions = 2
|
|
107
|
-
if (options.actions.length > maxActions) {
|
|
108
|
-
throw new Error(
|
|
109
|
-
`CTA Modal only supports a maximum of ${maxActions} actions.`,
|
|
110
|
-
)
|
|
111
|
-
}
|
|
112
79
|
setContent({ ...options })
|
|
113
80
|
setOpen(true)
|
|
114
81
|
},
|
|
@@ -117,10 +84,10 @@ export function CTAModal(props: PropsWithChildren<CTAModalProviderProps>) {
|
|
|
117
84
|
|
|
118
85
|
const handleActionClick = useCallback(
|
|
119
86
|
(event: MouseEvent<HTMLButtonElement>) => {
|
|
120
|
-
const index = event.currentTarget.getAttribute('data-index')
|
|
121
|
-
const
|
|
122
|
-
const
|
|
123
|
-
|
|
87
|
+
const index = Number(event.currentTarget.getAttribute('data-index'))
|
|
88
|
+
const contentActions = content?.actions as CTAModalActionReturn
|
|
89
|
+
const action = contentActions._actions[index] as CTAButtonAction
|
|
90
|
+
action?.handleClick?.(event)
|
|
124
91
|
setOpen(false)
|
|
125
92
|
},
|
|
126
93
|
[content, setOpen],
|
|
@@ -163,22 +130,21 @@ export function CTAModal(props: PropsWithChildren<CTAModalProviderProps>) {
|
|
|
163
130
|
</VStack>
|
|
164
131
|
|
|
165
132
|
<HStack gap="md" w="full">
|
|
166
|
-
<
|
|
167
|
-
{
|
|
168
|
-
<
|
|
169
|
-
data-index={index}
|
|
170
|
-
className={css({
|
|
171
|
-
w: '1/2',
|
|
172
|
-
})}
|
|
133
|
+
<For each={content?.actions._actions}>
|
|
134
|
+
{(action, index) => (
|
|
135
|
+
<Show
|
|
173
136
|
key={index}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
137
|
+
when={content?.actions?.type === 'btnAction'}
|
|
138
|
+
fallback={
|
|
139
|
+
<TriggerItem asChild>{action as ReactNode}</TriggerItem>
|
|
140
|
+
}
|
|
177
141
|
>
|
|
178
|
-
{
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
142
|
+
<TriggerItem data-index={index} onClick={handleActionClick}>
|
|
143
|
+
{(action as CTAButtonAction)?.text}
|
|
144
|
+
</TriggerItem>
|
|
145
|
+
</Show>
|
|
146
|
+
)}
|
|
147
|
+
</For>
|
|
182
148
|
</HStack>
|
|
183
149
|
</VStack>
|
|
184
150
|
</Dialog>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { css, cx } from '@cerberus/styled-system/css'
|
|
2
|
+
import { Button, type ButtonProps } from '../button/button'
|
|
3
|
+
import { ark } from '@ark-ui/react/factory'
|
|
4
|
+
import { button } from '@cerberus/styled-system/recipes'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* This module provides the trigger item for the cta modal.
|
|
8
|
+
* @module 'react/cta-modal/trigger-item'
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export interface TriggerItemProps extends ButtonProps {
|
|
12
|
+
asChild?: boolean
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Trigger item for the cta modal which renders content based on the actions.
|
|
17
|
+
* type.
|
|
18
|
+
*/
|
|
19
|
+
export function TriggerItem(props: TriggerItemProps) {
|
|
20
|
+
const { asChild, children, ...buttonProps } = props
|
|
21
|
+
|
|
22
|
+
if (asChild) {
|
|
23
|
+
return (
|
|
24
|
+
<ark.div
|
|
25
|
+
className={cx(
|
|
26
|
+
button({
|
|
27
|
+
shape: 'rounded',
|
|
28
|
+
usage: 'ghost',
|
|
29
|
+
}),
|
|
30
|
+
css({
|
|
31
|
+
w: '1/2',
|
|
32
|
+
}),
|
|
33
|
+
)}
|
|
34
|
+
asChild
|
|
35
|
+
>
|
|
36
|
+
{children}
|
|
37
|
+
</ark.div>
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<Button
|
|
43
|
+
{...buttonProps}
|
|
44
|
+
className={css({
|
|
45
|
+
w: '1/2',
|
|
46
|
+
})}
|
|
47
|
+
shape="rounded"
|
|
48
|
+
usage="outlined"
|
|
49
|
+
>
|
|
50
|
+
{children}
|
|
51
|
+
</Button>
|
|
52
|
+
)
|
|
53
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { MouseEventHandler, ReactNode } from 'react'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This module provide utility functions for the cta modal.
|
|
5
|
+
* @module 'react/cta-modal/utils'
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export type CTAButtonAction = {
|
|
9
|
+
/**
|
|
10
|
+
* The text of the button.
|
|
11
|
+
*/
|
|
12
|
+
text: string
|
|
13
|
+
/**
|
|
14
|
+
* The onClick handler for the button.
|
|
15
|
+
*/
|
|
16
|
+
handleClick: MouseEventHandler<HTMLButtonElement>
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type CTAModalAction = (CTAButtonAction | ReactNode)[]
|
|
20
|
+
|
|
21
|
+
export interface CTAModalActionReturn {
|
|
22
|
+
/**
|
|
23
|
+
* The type of the action content.
|
|
24
|
+
*/
|
|
25
|
+
type: 'reactNode' | 'btnAction'
|
|
26
|
+
/**
|
|
27
|
+
* The actions for the cta modal. Max of 2 actions.
|
|
28
|
+
*/
|
|
29
|
+
_actions: CTAModalAction
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Creates the action data to pass to the cta modal `show` method.
|
|
34
|
+
*/
|
|
35
|
+
export function createCTAModalActions(
|
|
36
|
+
providedActions: CTAModalAction,
|
|
37
|
+
): CTAModalActionReturn {
|
|
38
|
+
if (providedActions.length !== 2) {
|
|
39
|
+
throw new Error('CTAModal must include 2 actions')
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (
|
|
43
|
+
providedActions.every(
|
|
44
|
+
(action) => (action as unknown as CTAButtonAction)?.handleClick,
|
|
45
|
+
)
|
|
46
|
+
) {
|
|
47
|
+
return {
|
|
48
|
+
type: 'btnAction',
|
|
49
|
+
_actions: providedActions as CTAButtonAction[],
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return {
|
|
54
|
+
type: 'reactNode',
|
|
55
|
+
_actions: providedActions as ReactNode[],
|
|
56
|
+
}
|
|
57
|
+
}
|
package/src/components/for.tsx
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import type { ReactNode } from 'react'
|
|
1
|
+
import type { ReactNode, JSX } from 'react'
|
|
2
2
|
|
|
3
|
-
export interface ForProps<T> {
|
|
3
|
+
export interface ForProps<T extends readonly unknown[], U extends JSX.Element> {
|
|
4
4
|
/**
|
|
5
|
-
* The array to iterate over
|
|
5
|
+
* The array to iterate over.
|
|
6
6
|
*/
|
|
7
|
-
each: T
|
|
7
|
+
each: T | undefined | null | false
|
|
8
8
|
/**
|
|
9
|
-
* The fallback
|
|
9
|
+
* The fallback to render when the array is empty.
|
|
10
10
|
*/
|
|
11
|
-
fallback?:
|
|
11
|
+
fallback?: JSX.Element
|
|
12
12
|
/**
|
|
13
|
-
* The
|
|
13
|
+
* The children to render for each item in the array.
|
|
14
14
|
*/
|
|
15
|
-
children: (item:
|
|
15
|
+
children: (item: T[number], index: number) => U
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
/**
|
|
@@ -27,17 +27,12 @@ export interface ForProps<T> {
|
|
|
27
27
|
* </For>
|
|
28
28
|
* ```
|
|
29
29
|
*/
|
|
30
|
-
export function For<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
item: T,
|
|
35
|
-
index: number,
|
|
36
|
-
) => ReactNode
|
|
37
|
-
|
|
38
|
-
if (props.each?.length === 0) {
|
|
30
|
+
export function For<T extends readonly unknown[], U extends JSX.Element>(
|
|
31
|
+
props: ForProps<T, U>,
|
|
32
|
+
) {
|
|
33
|
+
if (!props.each || !props.each.length) {
|
|
39
34
|
return props.fallback || null
|
|
40
35
|
}
|
|
41
36
|
|
|
42
|
-
return props.each?.map(
|
|
37
|
+
return props.each?.map(props.children) as ReactNode
|
|
43
38
|
}
|
package/src/index.ts
CHANGED
|
@@ -29,6 +29,7 @@ export * from './components/Avatar'
|
|
|
29
29
|
export * from './components/button/index'
|
|
30
30
|
export * from './components/checkbox/index'
|
|
31
31
|
export * from './components/CircularProgress'
|
|
32
|
+
export * from './components/cta-dialog/index'
|
|
32
33
|
export * from './components/DatePicker.client'
|
|
33
34
|
export * from './components/DatePicker.server'
|
|
34
35
|
export * from './components/Dialog'
|
|
@@ -68,7 +69,6 @@ export * from './components/Tooltip'
|
|
|
68
69
|
|
|
69
70
|
export * from './context/cerberus'
|
|
70
71
|
export * from './context/confirm-modal'
|
|
71
|
-
export * from './context/cta-modal'
|
|
72
72
|
export * from './context/feature-flags'
|
|
73
73
|
export * from './context/navMenu'
|
|
74
74
|
export * from './context/notification-center'
|