@cerberus-design/react 0.13.1-next-e3e9e48 → 0.13.1-next-d1e87c5
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 +52 -27
- package/build/legacy/components/ModalHeader.cjs +0 -1
- package/build/legacy/components/ModalHeader.cjs.map +1 -1
- package/build/legacy/context/confirm-modal.cjs +36 -43
- package/build/legacy/context/confirm-modal.cjs.map +1 -1
- package/build/legacy/context/cta-modal.cjs +34 -35
- package/build/legacy/context/cta-modal.cjs.map +1 -1
- package/build/legacy/context/prompt-modal.cjs +0 -1
- package/build/legacy/context/prompt-modal.cjs.map +1 -1
- package/build/legacy/index.cjs +72 -79
- package/build/legacy/index.cjs.map +1 -1
- package/build/modern/_tsup-dts-rollup.d.ts +52 -27
- package/build/modern/{chunk-KFGI37CO.js → chunk-4D6VIGNQ.js} +38 -44
- package/build/modern/chunk-4D6VIGNQ.js.map +1 -0
- package/build/modern/{chunk-NCUHRVW2.js → chunk-MMHCX2RG.js} +2 -2
- package/build/modern/{chunk-J4LOSTEP.js → chunk-MXMVC3ZQ.js} +36 -36
- package/build/modern/{chunk-J4LOSTEP.js.map → chunk-MXMVC3ZQ.js.map} +1 -1
- package/build/modern/{chunk-ZFAIE47A.js → chunk-XY6WL55R.js} +1 -2
- package/build/modern/{chunk-ZFAIE47A.js.map → chunk-XY6WL55R.js.map} +1 -1
- package/build/modern/components/ModalHeader.js +1 -1
- package/build/modern/context/confirm-modal.js +2 -2
- package/build/modern/context/cta-modal.js +2 -2
- package/build/modern/context/prompt-modal.js +2 -2
- package/build/modern/index.js +4 -4
- package/package.json +2 -2
- package/src/components/ModalHeader.tsx +0 -1
- package/src/context/confirm-modal.tsx +89 -66
- package/src/context/cta-modal.tsx +38 -38
- package/build/modern/chunk-KFGI37CO.js.map +0 -1
- /package/build/modern/{chunk-NCUHRVW2.js.map → chunk-MMHCX2RG.js.map} +0 -0
package/build/legacy/index.cjs
CHANGED
|
@@ -1360,7 +1360,6 @@ function ModalHeader(props) {
|
|
|
1360
1360
|
(0, import_patterns9.vstack)({
|
|
1361
1361
|
alignItems: "flex-start",
|
|
1362
1362
|
gap: "md",
|
|
1363
|
-
mb: "md",
|
|
1364
1363
|
position: "relative"
|
|
1365
1364
|
})
|
|
1366
1365
|
)
|
|
@@ -2376,6 +2375,7 @@ function useModal() {
|
|
|
2376
2375
|
}
|
|
2377
2376
|
|
|
2378
2377
|
// src/context/confirm-modal.tsx
|
|
2378
|
+
var import_jsx = require("@cerberus/styled-system/jsx");
|
|
2379
2379
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
2380
2380
|
var ConfirmModalContext = (0, import_react17.createContext)(null);
|
|
2381
2381
|
function ConfirmModal(props) {
|
|
@@ -2384,9 +2384,10 @@ function ConfirmModal(props) {
|
|
|
2384
2384
|
const [content, setContent] = (0, import_react17.useState)(null);
|
|
2385
2385
|
const focusTrap = trapFocus(modalRef);
|
|
2386
2386
|
const ConfirmIcon = $cerberusIcons.confirmModal;
|
|
2387
|
+
const kind = (content == null ? void 0 : content.kind) ?? "non-destructive";
|
|
2387
2388
|
const palette = (0, import_react17.useMemo)(
|
|
2388
|
-
() =>
|
|
2389
|
-
[
|
|
2389
|
+
() => kind === "destructive" ? "danger" : "action",
|
|
2390
|
+
[kind]
|
|
2390
2391
|
);
|
|
2391
2392
|
const handleChoice = (0, import_react17.useCallback)(
|
|
2392
2393
|
(e) => {
|
|
@@ -2403,7 +2404,7 @@ function ConfirmModal(props) {
|
|
|
2403
2404
|
const handleShow = (0, import_react17.useCallback)(
|
|
2404
2405
|
(options) => {
|
|
2405
2406
|
return new Promise((resolve) => {
|
|
2406
|
-
setContent({ ...options
|
|
2407
|
+
setContent({ ...options });
|
|
2407
2408
|
show();
|
|
2408
2409
|
resolveRef.current = resolve;
|
|
2409
2410
|
});
|
|
@@ -2418,7 +2419,7 @@ function ConfirmModal(props) {
|
|
|
2418
2419
|
);
|
|
2419
2420
|
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(ConfirmModalContext.Provider, { value, children: [
|
|
2420
2421
|
props.children,
|
|
2421
|
-
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime50.
|
|
2422
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Modal, { onKeyDown: focusTrap, ref: modalRef, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx.VStack, { gap: "xl", w: "full", children: [
|
|
2422
2423
|
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(ModalHeader, { children: [
|
|
2423
2424
|
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
2424
2425
|
"div",
|
|
@@ -2456,44 +2457,36 @@ function ConfirmModal(props) {
|
|
|
2456
2457
|
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(ModalHeading, { children: content == null ? void 0 : content.heading }),
|
|
2457
2458
|
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(ModalDescription, { children: content == null ? void 0 : content.description })
|
|
2458
2459
|
] }),
|
|
2459
|
-
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
),
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
value: "false",
|
|
2490
|
-
children: content == null ? void 0 : content.cancelText
|
|
2491
|
-
}
|
|
2492
|
-
)
|
|
2493
|
-
]
|
|
2494
|
-
}
|
|
2495
|
-
)
|
|
2496
|
-
] }) })
|
|
2460
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx.HStack, { gap: "4", w: "full", children: [
|
|
2461
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
2462
|
+
Button,
|
|
2463
|
+
{
|
|
2464
|
+
autoFocus: true,
|
|
2465
|
+
className: (0, import_css42.css)({
|
|
2466
|
+
w: "1/2"
|
|
2467
|
+
}),
|
|
2468
|
+
name: "confirm",
|
|
2469
|
+
onClick: handleChoice,
|
|
2470
|
+
palette,
|
|
2471
|
+
value: "true",
|
|
2472
|
+
children: content == null ? void 0 : content.actionText
|
|
2473
|
+
}
|
|
2474
|
+
),
|
|
2475
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
2476
|
+
Button,
|
|
2477
|
+
{
|
|
2478
|
+
className: (0, import_css42.css)({
|
|
2479
|
+
w: "1/2"
|
|
2480
|
+
}),
|
|
2481
|
+
name: "cancel",
|
|
2482
|
+
onClick: handleChoice,
|
|
2483
|
+
usage: "outlined",
|
|
2484
|
+
value: "false",
|
|
2485
|
+
children: content == null ? void 0 : content.cancelText
|
|
2486
|
+
}
|
|
2487
|
+
)
|
|
2488
|
+
] })
|
|
2489
|
+
] }) }) })
|
|
2497
2490
|
] });
|
|
2498
2491
|
}
|
|
2499
2492
|
function useConfirmModal() {
|
|
@@ -2508,9 +2501,9 @@ function useConfirmModal() {
|
|
|
2508
2501
|
|
|
2509
2502
|
// src/context/cta-modal.tsx
|
|
2510
2503
|
var import_react18 = require("react");
|
|
2511
|
-
var import_jsx = require("@cerberus/styled-system/jsx");
|
|
2512
|
-
var import_css43 = require("@cerberus/styled-system/css");
|
|
2513
2504
|
var import_jsx2 = require("@cerberus/styled-system/jsx");
|
|
2505
|
+
var import_css43 = require("@cerberus/styled-system/css");
|
|
2506
|
+
var import_jsx3 = require("@cerberus/styled-system/jsx");
|
|
2514
2507
|
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
2515
2508
|
var CTAModalContext = (0, import_react18.createContext)(null);
|
|
2516
2509
|
function CTAModal(props) {
|
|
@@ -2567,42 +2560,42 @@ function CTAModal(props) {
|
|
|
2567
2560
|
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(IconButton, { ariaLabel: "Close modal", onClick: close, children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(CloseIcon, {}) })
|
|
2568
2561
|
}
|
|
2569
2562
|
),
|
|
2570
|
-
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
|
|
2571
|
-
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2563
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx3.VStack, { gap: "xl", w: "full", children: [
|
|
2564
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ModalHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx3.VStack, { gap: "lg", w: "full", children: [
|
|
2565
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
2566
|
+
Avatar,
|
|
2567
|
+
{
|
|
2568
|
+
ariaLabel: "",
|
|
2569
|
+
gradient: "charon-light",
|
|
2570
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
2571
|
+
Show,
|
|
2572
|
+
{
|
|
2573
|
+
when: Boolean(confirmIcon),
|
|
2574
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(FallbackIcon, { size: 24 }),
|
|
2575
|
+
children: confirmIcon
|
|
2576
|
+
}
|
|
2577
|
+
),
|
|
2578
|
+
src: ""
|
|
2579
|
+
}
|
|
2580
|
+
),
|
|
2588
2581
|
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ModalHeading, { children: content == null ? void 0 : content.heading }),
|
|
2589
2582
|
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ModalDescription, { children: content == null ? void 0 : content.description })
|
|
2590
|
-
] })
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2583
|
+
] }) }),
|
|
2584
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_jsx2.HStack, { gap: "md", w: "full", children: /* @__PURE__ */ (0, import_jsx_runtime51.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_runtime51.jsx)(
|
|
2585
|
+
Button,
|
|
2586
|
+
{
|
|
2587
|
+
"data-index": index,
|
|
2588
|
+
className: (0, import_css43.css)({
|
|
2589
|
+
w: "1/2"
|
|
2590
|
+
}),
|
|
2591
|
+
onClick: handleActionClick,
|
|
2592
|
+
shape: "rounded",
|
|
2593
|
+
usage: "outlined",
|
|
2594
|
+
children: action.text
|
|
2595
|
+
},
|
|
2596
|
+
index
|
|
2597
|
+
)) }) })
|
|
2598
|
+
] })
|
|
2606
2599
|
] }) })
|
|
2607
2600
|
] });
|
|
2608
2601
|
}
|