@cerberus-design/react 0.11.1-next-c28b077 → 0.12.0-next-c2bae7a
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 +143 -30
- package/build/legacy/components/Menu.cjs +82 -0
- package/build/legacy/components/Menu.cjs.map +1 -0
- package/build/legacy/components/NavMenuLink.cjs.map +1 -1
- package/build/legacy/components/NavMenuList.cjs.map +1 -1
- package/build/legacy/components/NavMenuTrigger.cjs.map +1 -1
- package/build/legacy/components/Tbody.cjs.map +1 -1
- package/build/legacy/components/Td.cjs.map +1 -1
- package/build/legacy/components/Th.cjs +1 -0
- package/build/legacy/components/Th.cjs.map +1 -1
- package/build/legacy/components/Thead.cjs.map +1 -1
- package/build/legacy/context/navMenu.cjs.map +1 -1
- package/build/legacy/index.cjs +400 -344
- package/build/legacy/index.cjs.map +1 -1
- package/build/modern/_tsup-dts-rollup.d.ts +143 -30
- package/build/modern/{chunk-HPM2XRWT.js → chunk-3R4TIF2X.js} +1 -1
- package/build/modern/{chunk-HPM2XRWT.js.map → chunk-3R4TIF2X.js.map} +1 -1
- package/build/modern/{chunk-O75QAT4Z.js → chunk-6WS765J3.js} +1 -1
- package/build/modern/chunk-6WS765J3.js.map +1 -0
- package/build/modern/{chunk-PJGUYNKD.js → chunk-CSEHDNMJ.js} +4 -4
- package/build/modern/{chunk-OWKN5IV7.js → chunk-PM7CWT3N.js} +2 -2
- package/build/modern/chunk-PM7CWT3N.js.map +1 -0
- package/build/modern/chunk-RUR5MV54.js +52 -0
- package/build/modern/chunk-RUR5MV54.js.map +1 -0
- package/build/modern/{chunk-CO4BKT7K.js → chunk-SGKHA4EB.js} +1 -1
- package/build/modern/chunk-SGKHA4EB.js.map +1 -0
- package/build/modern/{chunk-JVIFMN67.js → chunk-T6LS5P5W.js} +4 -4
- package/build/modern/{chunk-5V5MBSM3.js → chunk-UZVQ4INR.js} +2 -2
- package/build/modern/chunk-UZVQ4INR.js.map +1 -0
- package/build/modern/{chunk-C7UVOGPZ.js → chunk-VP5ERLAY.js} +4 -4
- package/build/modern/{chunk-KBBASJIY.js → chunk-WPVDQRRF.js} +1 -1
- package/build/modern/chunk-WPVDQRRF.js.map +1 -0
- package/build/modern/{chunk-PKY46RRA.js → chunk-Y6QQCRQV.js} +1 -1
- package/build/modern/{chunk-PKY46RRA.js.map → chunk-Y6QQCRQV.js.map} +1 -1
- package/build/modern/{chunk-PKQTTFWA.js → chunk-ZR37P4NZ.js} +1 -1
- package/build/modern/{chunk-PKQTTFWA.js.map → chunk-ZR37P4NZ.js.map} +1 -1
- package/build/modern/components/Menu.js +19 -0
- package/build/modern/components/Menu.js.map +1 -0
- package/build/modern/components/NavMenuLink.js +1 -1
- package/build/modern/components/NavMenuList.js +2 -2
- package/build/modern/components/NavMenuTrigger.js +2 -2
- package/build/modern/components/Tbody.js +1 -1
- package/build/modern/components/Td.js +1 -1
- package/build/modern/components/Th.js +2 -1
- package/build/modern/components/Thead.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/navMenu.js +1 -1
- package/build/modern/context/prompt-modal.js +2 -2
- package/build/modern/index.js +39 -23
- package/build/modern/index.js.map +1 -1
- package/package.json +3 -2
- package/src/components/Menu.tsx +244 -0
- package/src/components/NavMenuLink.tsx +1 -11
- package/src/components/NavMenuList.tsx +1 -3
- package/src/components/NavMenuTrigger.tsx +1 -10
- package/src/components/Tbody.tsx +1 -2
- package/src/components/Td.tsx +1 -2
- package/src/components/Th.tsx +4 -2
- package/src/components/Thead.tsx +1 -2
- package/src/context/navMenu.tsx +1 -2
- package/src/index.ts +1 -0
- package/build/modern/chunk-5V5MBSM3.js.map +0 -1
- package/build/modern/chunk-CO4BKT7K.js.map +0 -1
- package/build/modern/chunk-KBBASJIY.js.map +0 -1
- package/build/modern/chunk-O75QAT4Z.js.map +0 -1
- package/build/modern/chunk-OWKN5IV7.js.map +0 -1
- /package/build/modern/{chunk-PJGUYNKD.js.map → chunk-CSEHDNMJ.js.map} +0 -0
- /package/build/modern/{chunk-JVIFMN67.js.map → chunk-T6LS5P5W.js.map} +0 -0
- /package/build/modern/{chunk-C7UVOGPZ.js.map → chunk-VP5ERLAY.js.map} +0 -0
package/build/legacy/index.cjs
CHANGED
|
@@ -45,6 +45,13 @@ __export(src_exports, {
|
|
|
45
45
|
Label: () => Label,
|
|
46
46
|
Legend: () => Legend,
|
|
47
47
|
MODE_KEY: () => MODE_KEY,
|
|
48
|
+
Menu: () => Menu,
|
|
49
|
+
MenuContent: () => MenuContent,
|
|
50
|
+
MenuGroupLabel: () => MenuGroupLabel,
|
|
51
|
+
MenuItem: () => MenuItem,
|
|
52
|
+
MenuItemGroup: () => MenuItemGroup,
|
|
53
|
+
MenuSeparator: () => MenuSeparator,
|
|
54
|
+
MenuTrigger: () => MenuTrigger,
|
|
48
55
|
Modal: () => Modal,
|
|
49
56
|
ModalDescription: () => ModalDescription,
|
|
50
57
|
ModalHeader: () => ModalHeader,
|
|
@@ -1275,33 +1282,75 @@ function Legend(props) {
|
|
|
1275
1282
|
);
|
|
1276
1283
|
}
|
|
1277
1284
|
|
|
1278
|
-
// src/components/
|
|
1279
|
-
var
|
|
1285
|
+
// src/components/Menu.tsx
|
|
1286
|
+
var import_react6 = require("@ark-ui/react");
|
|
1280
1287
|
var import_recipes14 = require("@cerberus/styled-system/recipes");
|
|
1281
|
-
var
|
|
1288
|
+
var import_css16 = require("@cerberus/styled-system/css");
|
|
1282
1289
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1283
|
-
|
|
1290
|
+
var menuStyles = (0, import_recipes14.menu)();
|
|
1291
|
+
var Menu = import_react6.Menu.Root;
|
|
1292
|
+
function MenuTrigger(props) {
|
|
1293
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react6.Menu.Trigger, { ...props, asChild: true });
|
|
1294
|
+
}
|
|
1295
|
+
function MenuContent(props) {
|
|
1296
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react6.Menu.Positioner, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1297
|
+
import_react6.Menu.Content,
|
|
1298
|
+
{
|
|
1299
|
+
...props,
|
|
1300
|
+
className: (0, import_css16.cx)(props.className, menuStyles.content)
|
|
1301
|
+
}
|
|
1302
|
+
) });
|
|
1303
|
+
}
|
|
1304
|
+
function MenuItem(props) {
|
|
1305
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react6.Menu.Item, { ...props, className: (0, import_css16.cx)(props.className, menuStyles.item) });
|
|
1306
|
+
}
|
|
1307
|
+
var MenuItemGroup = import_react6.Menu.ItemGroup;
|
|
1308
|
+
function MenuGroupLabel(props) {
|
|
1309
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1310
|
+
import_react6.Menu.ItemGroupLabel,
|
|
1311
|
+
{
|
|
1312
|
+
...props,
|
|
1313
|
+
className: (0, import_css16.cx)(props.className, menuStyles.itemGroupLabel)
|
|
1314
|
+
}
|
|
1315
|
+
);
|
|
1316
|
+
}
|
|
1317
|
+
function MenuSeparator(props) {
|
|
1284
1318
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1319
|
+
import_react6.Menu.Separator,
|
|
1320
|
+
{
|
|
1321
|
+
...props,
|
|
1322
|
+
className: (0, import_css16.cx)(props.className, menuStyles.separator)
|
|
1323
|
+
}
|
|
1324
|
+
);
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1327
|
+
// src/components/Modal.tsx
|
|
1328
|
+
var import_css17 = require("@cerberus/styled-system/css");
|
|
1329
|
+
var import_recipes15 = require("@cerberus/styled-system/recipes");
|
|
1330
|
+
var import_react7 = require("react");
|
|
1331
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1332
|
+
function ModalEl(props, ref) {
|
|
1333
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1285
1334
|
"dialog",
|
|
1286
1335
|
{
|
|
1287
1336
|
...props,
|
|
1288
|
-
className: (0,
|
|
1337
|
+
className: (0, import_css17.cx)(props.className, (0, import_recipes15.modal)().dialog),
|
|
1289
1338
|
ref
|
|
1290
1339
|
}
|
|
1291
1340
|
);
|
|
1292
1341
|
}
|
|
1293
|
-
var Modal = (0,
|
|
1342
|
+
var Modal = (0, import_react7.forwardRef)(ModalEl);
|
|
1294
1343
|
|
|
1295
1344
|
// src/components/ModalHeader.tsx
|
|
1296
|
-
var
|
|
1345
|
+
var import_css18 = require("@cerberus/styled-system/css");
|
|
1297
1346
|
var import_patterns9 = require("@cerberus/styled-system/patterns");
|
|
1298
|
-
var
|
|
1347
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1299
1348
|
function ModalHeader(props) {
|
|
1300
|
-
return /* @__PURE__ */ (0,
|
|
1349
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1301
1350
|
"div",
|
|
1302
1351
|
{
|
|
1303
1352
|
...props,
|
|
1304
|
-
className: (0,
|
|
1353
|
+
className: (0, import_css18.cx)(
|
|
1305
1354
|
props.className,
|
|
1306
1355
|
(0, import_patterns9.vstack)({
|
|
1307
1356
|
alignItems: "flex-start",
|
|
@@ -1315,25 +1364,25 @@ function ModalHeader(props) {
|
|
|
1315
1364
|
}
|
|
1316
1365
|
|
|
1317
1366
|
// src/components/ModalHeading.tsx
|
|
1318
|
-
var
|
|
1319
|
-
var
|
|
1320
|
-
var
|
|
1367
|
+
var import_css19 = require("@cerberus/styled-system/css");
|
|
1368
|
+
var import_recipes16 = require("@cerberus/styled-system/recipes");
|
|
1369
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1321
1370
|
function ModalHeading(props) {
|
|
1322
|
-
return /* @__PURE__ */ (0,
|
|
1371
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { ...props, className: (0, import_css19.cx)(props.className, (0, import_recipes16.modal)().heading) });
|
|
1323
1372
|
}
|
|
1324
1373
|
|
|
1325
1374
|
// src/components/ModalDescription.tsx
|
|
1326
|
-
var
|
|
1327
|
-
var
|
|
1328
|
-
var
|
|
1375
|
+
var import_css20 = require("@cerberus/styled-system/css");
|
|
1376
|
+
var import_recipes17 = require("@cerberus/styled-system/recipes");
|
|
1377
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1329
1378
|
function ModalDescription(props) {
|
|
1330
|
-
return /* @__PURE__ */ (0,
|
|
1379
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { ...props, className: (0, import_css20.cx)(props.className, (0, import_recipes17.modal)().description) });
|
|
1331
1380
|
}
|
|
1332
1381
|
|
|
1333
1382
|
// src/components/NavMenuTrigger.tsx
|
|
1334
|
-
var
|
|
1335
|
-
var
|
|
1336
|
-
var
|
|
1383
|
+
var import_react9 = require("react");
|
|
1384
|
+
var import_css22 = require("@cerberus/styled-system/css");
|
|
1385
|
+
var import_recipes18 = require("@cerberus/styled-system/recipes");
|
|
1337
1386
|
|
|
1338
1387
|
// src/aria-helpers/nav-menu.aria.ts
|
|
1339
1388
|
function createNavTriggerProps(values) {
|
|
@@ -1344,18 +1393,18 @@ function createNavTriggerProps(values) {
|
|
|
1344
1393
|
}
|
|
1345
1394
|
|
|
1346
1395
|
// src/context/navMenu.tsx
|
|
1347
|
-
var
|
|
1348
|
-
var
|
|
1349
|
-
var
|
|
1350
|
-
var NavMenuContext = (0,
|
|
1396
|
+
var import_css21 = require("@cerberus/styled-system/css");
|
|
1397
|
+
var import_react8 = require("react");
|
|
1398
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1399
|
+
var NavMenuContext = (0, import_react8.createContext)(null);
|
|
1351
1400
|
function NavMenu(props) {
|
|
1352
|
-
const triggerRef = (0,
|
|
1353
|
-
const menuRef = (0,
|
|
1354
|
-
const [expanded, setExpanded] = (0,
|
|
1355
|
-
const handleToggle = (0,
|
|
1401
|
+
const triggerRef = (0, import_react8.useRef)(null);
|
|
1402
|
+
const menuRef = (0, import_react8.useRef)(null);
|
|
1403
|
+
const [expanded, setExpanded] = (0, import_react8.useState)(false);
|
|
1404
|
+
const handleToggle = (0, import_react8.useCallback)(() => {
|
|
1356
1405
|
setExpanded((prev) => !prev);
|
|
1357
1406
|
}, []);
|
|
1358
|
-
const value = (0,
|
|
1407
|
+
const value = (0, import_react8.useMemo)(
|
|
1359
1408
|
() => ({
|
|
1360
1409
|
triggerRef,
|
|
1361
1410
|
menuRef,
|
|
@@ -1364,10 +1413,10 @@ function NavMenu(props) {
|
|
|
1364
1413
|
}),
|
|
1365
1414
|
[expanded, handleToggle]
|
|
1366
1415
|
);
|
|
1367
|
-
return /* @__PURE__ */ (0,
|
|
1416
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(NavMenuContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1368
1417
|
"nav",
|
|
1369
1418
|
{
|
|
1370
|
-
className: (0,
|
|
1419
|
+
className: (0, import_css21.css)({
|
|
1371
1420
|
position: "relative"
|
|
1372
1421
|
}),
|
|
1373
1422
|
children: props.children
|
|
@@ -1375,7 +1424,7 @@ function NavMenu(props) {
|
|
|
1375
1424
|
) });
|
|
1376
1425
|
}
|
|
1377
1426
|
function useNavMenuContext() {
|
|
1378
|
-
const context = (0,
|
|
1427
|
+
const context = (0, import_react8.useContext)(NavMenuContext);
|
|
1379
1428
|
if (!context) {
|
|
1380
1429
|
throw new Error("useNavMenuContext must be used within a NavMenu.");
|
|
1381
1430
|
}
|
|
@@ -1383,7 +1432,7 @@ function useNavMenuContext() {
|
|
|
1383
1432
|
}
|
|
1384
1433
|
|
|
1385
1434
|
// src/components/NavMenuTrigger.tsx
|
|
1386
|
-
var
|
|
1435
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
1387
1436
|
function NavMenuTrigger(props) {
|
|
1388
1437
|
const {
|
|
1389
1438
|
as,
|
|
@@ -1402,25 +1451,25 @@ function NavMenuTrigger(props) {
|
|
|
1402
1451
|
});
|
|
1403
1452
|
const hasAs = Boolean(as);
|
|
1404
1453
|
const AsSub = as;
|
|
1405
|
-
const handleClick = (0,
|
|
1454
|
+
const handleClick = (0, import_react9.useCallback)(
|
|
1406
1455
|
(e) => {
|
|
1407
1456
|
if (onClick) return onClick(e);
|
|
1408
1457
|
onToggle();
|
|
1409
1458
|
},
|
|
1410
1459
|
[onClick, onToggle]
|
|
1411
1460
|
);
|
|
1412
|
-
return /* @__PURE__ */ (0,
|
|
1461
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1413
1462
|
Show,
|
|
1414
1463
|
{
|
|
1415
1464
|
when: hasAs,
|
|
1416
|
-
fallback: /* @__PURE__ */ (0,
|
|
1465
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1417
1466
|
"button",
|
|
1418
1467
|
{
|
|
1419
1468
|
...nativeProps,
|
|
1420
1469
|
...ariaProps,
|
|
1421
|
-
className: (0,
|
|
1470
|
+
className: (0, import_css22.cx)(
|
|
1422
1471
|
nativeProps.className,
|
|
1423
|
-
(0,
|
|
1472
|
+
(0, import_recipes18.button)({
|
|
1424
1473
|
palette,
|
|
1425
1474
|
usage,
|
|
1426
1475
|
shape
|
|
@@ -1431,7 +1480,7 @@ function NavMenuTrigger(props) {
|
|
|
1431
1480
|
children: props.children
|
|
1432
1481
|
}
|
|
1433
1482
|
),
|
|
1434
|
-
children: hasAs && /* @__PURE__ */ (0,
|
|
1483
|
+
children: hasAs && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1435
1484
|
AsSub,
|
|
1436
1485
|
{
|
|
1437
1486
|
...nativeProps,
|
|
@@ -1445,10 +1494,10 @@ function NavMenuTrigger(props) {
|
|
|
1445
1494
|
}
|
|
1446
1495
|
|
|
1447
1496
|
// src/components/NavMenuList.tsx
|
|
1448
|
-
var
|
|
1449
|
-
var
|
|
1497
|
+
var import_react10 = require("react");
|
|
1498
|
+
var import_css23 = require("@cerberus/styled-system/css");
|
|
1450
1499
|
var import_patterns10 = require("@cerberus/styled-system/patterns");
|
|
1451
|
-
var
|
|
1500
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
1452
1501
|
function getPosition(position) {
|
|
1453
1502
|
const defaultPositions = {
|
|
1454
1503
|
left: "auto",
|
|
@@ -1502,16 +1551,16 @@ var navListStyles = (0, import_patterns10.vstack)({
|
|
|
1502
1551
|
function NavMenuList(props) {
|
|
1503
1552
|
const { position, ...nativeProps } = props;
|
|
1504
1553
|
const { menuRef, expanded } = useNavMenuContext();
|
|
1505
|
-
const locationStyles = (0,
|
|
1554
|
+
const locationStyles = (0, import_react10.useMemo)(
|
|
1506
1555
|
() => getPosition(position ?? "bottom"),
|
|
1507
1556
|
[position]
|
|
1508
1557
|
);
|
|
1509
|
-
return /* @__PURE__ */ (0,
|
|
1558
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Show, { when: expanded, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
1510
1559
|
"ul",
|
|
1511
1560
|
{
|
|
1512
1561
|
...nativeProps,
|
|
1513
1562
|
"data-position": position ?? "bottom",
|
|
1514
|
-
className: (0,
|
|
1563
|
+
className: (0, import_css23.cx)(nativeProps.className, navListStyles),
|
|
1515
1564
|
ref: menuRef,
|
|
1516
1565
|
style: locationStyles
|
|
1517
1566
|
}
|
|
@@ -1519,29 +1568,29 @@ function NavMenuList(props) {
|
|
|
1519
1568
|
}
|
|
1520
1569
|
|
|
1521
1570
|
// src/components/NavMenuLink.tsx
|
|
1522
|
-
var
|
|
1523
|
-
var
|
|
1571
|
+
var import_css24 = require("@cerberus/styled-system/css");
|
|
1572
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
1524
1573
|
function NavMenuLink(props) {
|
|
1525
1574
|
const { as, ...nativeProps } = props;
|
|
1526
1575
|
const hasAs = Boolean(as);
|
|
1527
1576
|
const AsSub = as;
|
|
1528
|
-
return /* @__PURE__ */ (0,
|
|
1577
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
1529
1578
|
"li",
|
|
1530
1579
|
{
|
|
1531
|
-
className: (0,
|
|
1580
|
+
className: (0, import_css24.css)({
|
|
1532
1581
|
w: "full"
|
|
1533
1582
|
}),
|
|
1534
|
-
children: /* @__PURE__ */ (0,
|
|
1583
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
1535
1584
|
Show,
|
|
1536
1585
|
{
|
|
1537
1586
|
when: hasAs,
|
|
1538
|
-
fallback: /* @__PURE__ */ (0,
|
|
1587
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
1539
1588
|
"a",
|
|
1540
1589
|
{
|
|
1541
1590
|
...nativeProps,
|
|
1542
|
-
className: (0,
|
|
1591
|
+
className: (0, import_css24.cx)(
|
|
1543
1592
|
nativeProps.className,
|
|
1544
|
-
(0,
|
|
1593
|
+
(0, import_css24.css)({
|
|
1545
1594
|
color: "action.navigation.initial",
|
|
1546
1595
|
textStyle: "link",
|
|
1547
1596
|
_hover: {
|
|
@@ -1551,7 +1600,7 @@ function NavMenuLink(props) {
|
|
|
1551
1600
|
)
|
|
1552
1601
|
}
|
|
1553
1602
|
),
|
|
1554
|
-
children: hasAs && /* @__PURE__ */ (0,
|
|
1603
|
+
children: hasAs && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(AsSub, { ...nativeProps })
|
|
1555
1604
|
}
|
|
1556
1605
|
)
|
|
1557
1606
|
}
|
|
@@ -1559,10 +1608,10 @@ function NavMenuLink(props) {
|
|
|
1559
1608
|
}
|
|
1560
1609
|
|
|
1561
1610
|
// src/components/Notification.tsx
|
|
1562
|
-
var
|
|
1611
|
+
var import_css25 = require("@cerberus/styled-system/css");
|
|
1563
1612
|
var import_patterns11 = require("@cerberus/styled-system/patterns");
|
|
1564
|
-
var
|
|
1565
|
-
var
|
|
1613
|
+
var import_recipes19 = require("@cerberus/styled-system/recipes");
|
|
1614
|
+
var import_react11 = require("react");
|
|
1566
1615
|
|
|
1567
1616
|
// src/aria-helpers/trap-focus.aria.ts
|
|
1568
1617
|
function trapFocus(modalRef) {
|
|
@@ -1591,24 +1640,24 @@ function trapFocus(modalRef) {
|
|
|
1591
1640
|
}
|
|
1592
1641
|
|
|
1593
1642
|
// src/components/Notification.tsx
|
|
1594
|
-
var
|
|
1643
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
1595
1644
|
function MatchNotificationIcon(props) {
|
|
1596
1645
|
const palette = props.palette || "info";
|
|
1597
1646
|
const key = `${palette}Notification`;
|
|
1598
1647
|
const Icon = $cerberusIcons[key];
|
|
1599
|
-
return /* @__PURE__ */ (0,
|
|
1648
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Icon, {});
|
|
1600
1649
|
}
|
|
1601
1650
|
function Notification(props) {
|
|
1602
1651
|
const { children, palette, onClose, ...nativeProps } = props;
|
|
1603
|
-
const ref = (0,
|
|
1652
|
+
const ref = (0, import_react11.useRef)(null);
|
|
1604
1653
|
const onKeyDown = trapFocus(ref);
|
|
1605
|
-
const styles = (0,
|
|
1654
|
+
const styles = (0, import_recipes19.notification)({ palette });
|
|
1606
1655
|
const { close: CloseIcon } = $cerberusIcons;
|
|
1607
|
-
return /* @__PURE__ */ (0,
|
|
1656
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
1608
1657
|
"dialog",
|
|
1609
1658
|
{
|
|
1610
1659
|
...nativeProps,
|
|
1611
|
-
className: (0,
|
|
1660
|
+
className: (0, import_css25.cx)(
|
|
1612
1661
|
nativeProps.className,
|
|
1613
1662
|
(0, import_patterns11.hstack)({
|
|
1614
1663
|
position: "relative",
|
|
@@ -1619,8 +1668,8 @@ function Notification(props) {
|
|
|
1619
1668
|
onKeyDown,
|
|
1620
1669
|
ref,
|
|
1621
1670
|
children: [
|
|
1622
|
-
/* @__PURE__ */ (0,
|
|
1623
|
-
/* @__PURE__ */ (0,
|
|
1671
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: styles.icon, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(MatchNotificationIcon, { palette }) }),
|
|
1672
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
1624
1673
|
"div",
|
|
1625
1674
|
{
|
|
1626
1675
|
className: (0, import_patterns11.vstack)({
|
|
@@ -1631,14 +1680,14 @@ function Notification(props) {
|
|
|
1631
1680
|
children
|
|
1632
1681
|
}
|
|
1633
1682
|
),
|
|
1634
|
-
/* @__PURE__ */ (0,
|
|
1683
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
1635
1684
|
"button",
|
|
1636
1685
|
{
|
|
1637
1686
|
"aria-label": "Close",
|
|
1638
1687
|
className: styles.close,
|
|
1639
1688
|
onClick: onClose,
|
|
1640
1689
|
value: props.id,
|
|
1641
|
-
children: /* @__PURE__ */ (0,
|
|
1690
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(CloseIcon, {})
|
|
1642
1691
|
}
|
|
1643
1692
|
)
|
|
1644
1693
|
]
|
|
@@ -1647,26 +1696,26 @@ function Notification(props) {
|
|
|
1647
1696
|
}
|
|
1648
1697
|
|
|
1649
1698
|
// src/components/NotificationHeading.tsx
|
|
1650
|
-
var
|
|
1651
|
-
var
|
|
1652
|
-
var
|
|
1699
|
+
var import_css26 = require("@cerberus/styled-system/css");
|
|
1700
|
+
var import_recipes20 = require("@cerberus/styled-system/recipes");
|
|
1701
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
1653
1702
|
function NotificationHeading(props) {
|
|
1654
1703
|
const { palette, ...nativeProps } = props;
|
|
1655
|
-
const styles = (0,
|
|
1656
|
-
return /* @__PURE__ */ (0,
|
|
1704
|
+
const styles = (0, import_recipes20.notification)({ palette });
|
|
1705
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: (0, import_css26.cx)(nativeProps.className, styles.heading), ...nativeProps });
|
|
1657
1706
|
}
|
|
1658
1707
|
|
|
1659
1708
|
// src/components/NotificationDescription.tsx
|
|
1660
|
-
var
|
|
1661
|
-
var
|
|
1662
|
-
var
|
|
1709
|
+
var import_css27 = require("@cerberus/styled-system/css");
|
|
1710
|
+
var import_recipes21 = require("@cerberus/styled-system/recipes");
|
|
1711
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
1663
1712
|
function NotificationDescription(props) {
|
|
1664
1713
|
const { palette, ...nativeProps } = props;
|
|
1665
|
-
const styles = (0,
|
|
1666
|
-
return /* @__PURE__ */ (0,
|
|
1714
|
+
const styles = (0, import_recipes21.notification)({ palette });
|
|
1715
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
1667
1716
|
"p",
|
|
1668
1717
|
{
|
|
1669
|
-
className: (0,
|
|
1718
|
+
className: (0, import_css27.cx)(nativeProps.className, styles.description),
|
|
1670
1719
|
...nativeProps
|
|
1671
1720
|
}
|
|
1672
1721
|
);
|
|
@@ -1683,18 +1732,18 @@ function Portal(props) {
|
|
|
1683
1732
|
}
|
|
1684
1733
|
|
|
1685
1734
|
// src/components/Radio.tsx
|
|
1686
|
-
var
|
|
1735
|
+
var import_css28 = require("@cerberus/styled-system/css");
|
|
1687
1736
|
var import_patterns12 = require("@cerberus/styled-system/patterns");
|
|
1688
|
-
var
|
|
1689
|
-
var
|
|
1737
|
+
var import_recipes22 = require("@cerberus/styled-system/recipes");
|
|
1738
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
1690
1739
|
function Radio(props) {
|
|
1691
1740
|
const { children, size, ...nativeProps } = props;
|
|
1692
1741
|
const { invalid, ...state } = useFieldContext();
|
|
1693
|
-
const styles = (0,
|
|
1694
|
-
return /* @__PURE__ */ (0,
|
|
1742
|
+
const styles = (0, import_recipes22.radio)({ size });
|
|
1743
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
1695
1744
|
"div",
|
|
1696
1745
|
{
|
|
1697
|
-
className: (0,
|
|
1746
|
+
className: (0, import_css28.cx)(
|
|
1698
1747
|
"group",
|
|
1699
1748
|
(0, import_patterns12.hstack)({
|
|
1700
1749
|
gap: "sm"
|
|
@@ -1703,13 +1752,13 @@ function Radio(props) {
|
|
|
1703
1752
|
),
|
|
1704
1753
|
tabIndex: 0,
|
|
1705
1754
|
children: [
|
|
1706
|
-
/* @__PURE__ */ (0,
|
|
1755
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
1707
1756
|
"input",
|
|
1708
1757
|
{
|
|
1709
1758
|
...nativeProps,
|
|
1710
1759
|
...state,
|
|
1711
1760
|
...invalid && { "aria-invalid": true },
|
|
1712
|
-
className: (0,
|
|
1761
|
+
className: (0, import_css28.cx)(nativeProps.className, styles.input),
|
|
1713
1762
|
tabIndex: -1,
|
|
1714
1763
|
type: "radio"
|
|
1715
1764
|
}
|
|
@@ -1721,19 +1770,19 @@ function Radio(props) {
|
|
|
1721
1770
|
}
|
|
1722
1771
|
|
|
1723
1772
|
// src/components/Select.tsx
|
|
1724
|
-
var
|
|
1773
|
+
var import_css29 = require("@cerberus/styled-system/css");
|
|
1725
1774
|
var import_patterns13 = require("@cerberus/styled-system/patterns");
|
|
1726
|
-
var
|
|
1727
|
-
var
|
|
1775
|
+
var import_recipes23 = require("@cerberus/styled-system/recipes");
|
|
1776
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
1728
1777
|
function Select(props) {
|
|
1729
1778
|
const { describedBy, size, ...nativeProps } = props;
|
|
1730
1779
|
const { invalid, ...fieldStates } = useFieldContext();
|
|
1731
1780
|
const { invalid: InvalidIcon, selectArrow: SelectArrow } = $cerberusIcons;
|
|
1732
|
-
const styles = (0,
|
|
1781
|
+
const styles = (0, import_recipes23.select)({
|
|
1733
1782
|
size
|
|
1734
1783
|
});
|
|
1735
|
-
return /* @__PURE__ */ (0,
|
|
1736
|
-
/* @__PURE__ */ (0,
|
|
1784
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: styles.root, children: [
|
|
1785
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
1737
1786
|
"select",
|
|
1738
1787
|
{
|
|
1739
1788
|
...nativeProps,
|
|
@@ -1743,38 +1792,38 @@ function Select(props) {
|
|
|
1743
1792
|
className: styles.input
|
|
1744
1793
|
}
|
|
1745
1794
|
),
|
|
1746
|
-
/* @__PURE__ */ (0,
|
|
1795
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
1747
1796
|
"span",
|
|
1748
1797
|
{
|
|
1749
|
-
className: (0,
|
|
1798
|
+
className: (0, import_css29.cx)(
|
|
1750
1799
|
styles.iconStack,
|
|
1751
1800
|
(0, import_patterns13.hstack)({
|
|
1752
1801
|
gap: "2"
|
|
1753
1802
|
})
|
|
1754
1803
|
),
|
|
1755
1804
|
children: [
|
|
1756
|
-
/* @__PURE__ */ (0,
|
|
1805
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Show, { when: invalid, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
1757
1806
|
"span",
|
|
1758
1807
|
{
|
|
1759
1808
|
...invalid && { "data-invalid": true },
|
|
1760
1809
|
className: styles.stateIcon,
|
|
1761
|
-
children: /* @__PURE__ */ (0,
|
|
1810
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(InvalidIcon, {})
|
|
1762
1811
|
}
|
|
1763
1812
|
) }),
|
|
1764
|
-
/* @__PURE__ */ (0,
|
|
1813
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: styles.arrowIcon, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(SelectArrow, {}) })
|
|
1765
1814
|
]
|
|
1766
1815
|
}
|
|
1767
1816
|
)
|
|
1768
1817
|
] });
|
|
1769
1818
|
}
|
|
1770
1819
|
function Option(props) {
|
|
1771
|
-
return /* @__PURE__ */ (0,
|
|
1820
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("option", { ...props });
|
|
1772
1821
|
}
|
|
1773
1822
|
|
|
1774
1823
|
// src/components/Spinner.tsx
|
|
1775
|
-
var
|
|
1824
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
1776
1825
|
function Spinner(props) {
|
|
1777
|
-
return /* @__PURE__ */ (0,
|
|
1826
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
1778
1827
|
"svg",
|
|
1779
1828
|
{
|
|
1780
1829
|
"aria-busy": "true",
|
|
@@ -1784,7 +1833,7 @@ function Spinner(props) {
|
|
|
1784
1833
|
width: props.size,
|
|
1785
1834
|
viewBox: "0 0 24 24",
|
|
1786
1835
|
...props,
|
|
1787
|
-
children: /* @__PURE__ */ (0,
|
|
1836
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
1788
1837
|
"g",
|
|
1789
1838
|
{
|
|
1790
1839
|
fill: "none",
|
|
@@ -1793,14 +1842,14 @@ function Spinner(props) {
|
|
|
1793
1842
|
strokeLinejoin: "round",
|
|
1794
1843
|
strokeWidth: 2,
|
|
1795
1844
|
children: [
|
|
1796
|
-
/* @__PURE__ */ (0,
|
|
1845
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
1797
1846
|
"path",
|
|
1798
1847
|
{
|
|
1799
1848
|
strokeDasharray: 16,
|
|
1800
1849
|
strokeDashoffset: 16,
|
|
1801
1850
|
d: "M12 3c4.97 0 9 4.03 9 9",
|
|
1802
1851
|
children: [
|
|
1803
|
-
/* @__PURE__ */ (0,
|
|
1852
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
1804
1853
|
"animate",
|
|
1805
1854
|
{
|
|
1806
1855
|
fill: "freeze",
|
|
@@ -1809,7 +1858,7 @@ function Spinner(props) {
|
|
|
1809
1858
|
values: "16;0"
|
|
1810
1859
|
}
|
|
1811
1860
|
),
|
|
1812
|
-
/* @__PURE__ */ (0,
|
|
1861
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
1813
1862
|
"animateTransform",
|
|
1814
1863
|
{
|
|
1815
1864
|
attributeName: "transform",
|
|
@@ -1822,14 +1871,14 @@ function Spinner(props) {
|
|
|
1822
1871
|
]
|
|
1823
1872
|
}
|
|
1824
1873
|
),
|
|
1825
|
-
/* @__PURE__ */ (0,
|
|
1874
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
1826
1875
|
"path",
|
|
1827
1876
|
{
|
|
1828
1877
|
strokeDasharray: 64,
|
|
1829
1878
|
strokeDashoffset: 64,
|
|
1830
1879
|
strokeOpacity: 0.3,
|
|
1831
1880
|
d: "M12 3c4.97 0 9 4.03 9 9c0 4.97 -4.03 9 -9 9c-4.97 0 -9 -4.03 -9 -9c0 -4.97 4.03 -9 9 -9Z",
|
|
1832
|
-
children: /* @__PURE__ */ (0,
|
|
1881
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
1833
1882
|
"animate",
|
|
1834
1883
|
{
|
|
1835
1884
|
fill: "freeze",
|
|
@@ -1848,31 +1897,31 @@ function Spinner(props) {
|
|
|
1848
1897
|
}
|
|
1849
1898
|
|
|
1850
1899
|
// src/components/Tab.tsx
|
|
1851
|
-
var
|
|
1900
|
+
var import_react14 = require("react");
|
|
1852
1901
|
|
|
1853
1902
|
// src/context/tabs.tsx
|
|
1854
|
-
var
|
|
1855
|
-
var
|
|
1856
|
-
var
|
|
1857
|
-
var TabsContext = (0,
|
|
1903
|
+
var import_recipes24 = require("@cerberus/styled-system/recipes");
|
|
1904
|
+
var import_react12 = require("react");
|
|
1905
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
1906
|
+
var TabsContext = (0, import_react12.createContext)(null);
|
|
1858
1907
|
function Tabs(props) {
|
|
1859
1908
|
const { cache, active, id, palette } = props;
|
|
1860
|
-
const [activeTab, setActiveTab] = (0,
|
|
1861
|
-
const tabsList = (0,
|
|
1862
|
-
const uuid = (0,
|
|
1909
|
+
const [activeTab, setActiveTab] = (0, import_react12.useState)(() => cache ? "" : active ?? "");
|
|
1910
|
+
const tabsList = (0, import_react12.useRef)([]);
|
|
1911
|
+
const uuid = (0, import_react12.useMemo)(() => {
|
|
1863
1912
|
return id ? `cerberus-tabs-${id}` : "cerberus-tabs";
|
|
1864
1913
|
}, [id]);
|
|
1865
|
-
const value = (0,
|
|
1914
|
+
const value = (0, import_react12.useMemo)(
|
|
1866
1915
|
() => ({
|
|
1867
1916
|
tabs: tabsList,
|
|
1868
1917
|
id: uuid,
|
|
1869
1918
|
active: activeTab,
|
|
1870
|
-
styles: (0,
|
|
1919
|
+
styles: (0, import_recipes24.tabs)({ palette }),
|
|
1871
1920
|
onTabUpdate: setActiveTab
|
|
1872
1921
|
}),
|
|
1873
1922
|
[activeTab, setActiveTab, palette, uuid, tabsList]
|
|
1874
1923
|
);
|
|
1875
|
-
(0,
|
|
1924
|
+
(0, import_react12.useEffect)(() => {
|
|
1876
1925
|
if (cache) {
|
|
1877
1926
|
const cachedTab = window.localStorage.getItem(uuid);
|
|
1878
1927
|
setActiveTab(
|
|
@@ -1880,15 +1929,15 @@ function Tabs(props) {
|
|
|
1880
1929
|
);
|
|
1881
1930
|
}
|
|
1882
1931
|
}, [cache, active, uuid]);
|
|
1883
|
-
(0,
|
|
1932
|
+
(0, import_react12.useEffect)(() => {
|
|
1884
1933
|
if (cache && activeTab) {
|
|
1885
1934
|
window.localStorage.setItem(uuid, activeTab);
|
|
1886
1935
|
}
|
|
1887
1936
|
}, [activeTab, cache]);
|
|
1888
|
-
return /* @__PURE__ */ (0,
|
|
1937
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TabsContext.Provider, { value, children: props.children });
|
|
1889
1938
|
}
|
|
1890
1939
|
function useTabsContext() {
|
|
1891
|
-
const context = (0,
|
|
1940
|
+
const context = (0, import_react12.useContext)(TabsContext);
|
|
1892
1941
|
if (!context) {
|
|
1893
1942
|
throw new Error("useTabsContext must be used within a Tabs Provider.");
|
|
1894
1943
|
}
|
|
@@ -1896,10 +1945,10 @@ function useTabsContext() {
|
|
|
1896
1945
|
}
|
|
1897
1946
|
|
|
1898
1947
|
// src/components/Tab.tsx
|
|
1899
|
-
var
|
|
1948
|
+
var import_css30 = require("@cerberus/styled-system/css");
|
|
1900
1949
|
|
|
1901
1950
|
// src/aria-helpers/tabs.aria.ts
|
|
1902
|
-
var
|
|
1951
|
+
var import_react13 = require("react");
|
|
1903
1952
|
function getNextIndex(index, length) {
|
|
1904
1953
|
return index === length - 1 ? 0 : index + 1;
|
|
1905
1954
|
}
|
|
@@ -1908,8 +1957,8 @@ function getPrevIndex(index, length) {
|
|
|
1908
1957
|
}
|
|
1909
1958
|
function useTabsKeyboardNavigation() {
|
|
1910
1959
|
const { tabs: tabs2 } = useTabsContext();
|
|
1911
|
-
const [activeTab, setActiveTab] = (0,
|
|
1912
|
-
(0,
|
|
1960
|
+
const [activeTab, setActiveTab] = (0, import_react13.useState)(-1);
|
|
1961
|
+
(0, import_react13.useEffect)(() => {
|
|
1913
1962
|
const handleKeyDown = (event) => {
|
|
1914
1963
|
const index = activeTab === -1 ? tabs2.current.findIndex((tab) => tab.ariaSelected === "true") : activeTab;
|
|
1915
1964
|
const nextIndex = getNextIndex(index, tabs2.current.length);
|
|
@@ -1955,19 +2004,19 @@ function useTabsKeyboardNavigation() {
|
|
|
1955
2004
|
}
|
|
1956
2005
|
|
|
1957
2006
|
// src/components/Tab.tsx
|
|
1958
|
-
var
|
|
2007
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
1959
2008
|
function Tab(props) {
|
|
1960
2009
|
const { value, ...nativeProps } = props;
|
|
1961
2010
|
const { active, onTabUpdate, styles } = useTabsContext();
|
|
1962
|
-
const [isPending, startTransition] = (0,
|
|
2011
|
+
const [isPending, startTransition] = (0, import_react14.useTransition)();
|
|
1963
2012
|
const { ref } = useTabsKeyboardNavigation();
|
|
1964
|
-
const isActive = (0,
|
|
2013
|
+
const isActive = (0, import_react14.useMemo)(() => active === value, [active, value]);
|
|
1965
2014
|
function handleClick(e) {
|
|
1966
2015
|
var _a;
|
|
1967
2016
|
(_a = props.onClick) == null ? void 0 : _a.call(props, e);
|
|
1968
2017
|
startTransition(() => onTabUpdate(e.currentTarget.value));
|
|
1969
2018
|
}
|
|
1970
|
-
return /* @__PURE__ */ (0,
|
|
2019
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
1971
2020
|
"button",
|
|
1972
2021
|
{
|
|
1973
2022
|
...nativeProps,
|
|
@@ -1976,7 +2025,7 @@ function Tab(props) {
|
|
|
1976
2025
|
"aria-busy": isPending,
|
|
1977
2026
|
"aria-selected": isActive,
|
|
1978
2027
|
id: `tab:${value}`,
|
|
1979
|
-
className: (0,
|
|
2028
|
+
className: (0, import_css30.cx)(nativeProps.className, styles.tab),
|
|
1980
2029
|
onClick: handleClick,
|
|
1981
2030
|
role: "tab",
|
|
1982
2031
|
ref,
|
|
@@ -1986,18 +2035,18 @@ function Tab(props) {
|
|
|
1986
2035
|
}
|
|
1987
2036
|
|
|
1988
2037
|
// src/components/TabList.tsx
|
|
1989
|
-
var
|
|
2038
|
+
var import_css31 = require("@cerberus/styled-system/css");
|
|
1990
2039
|
var import_patterns14 = require("@cerberus/styled-system/patterns");
|
|
1991
|
-
var
|
|
2040
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
1992
2041
|
function TabList(props) {
|
|
1993
2042
|
const { description, ...nativeProps } = props;
|
|
1994
2043
|
const { id, styles } = useTabsContext();
|
|
1995
|
-
return /* @__PURE__ */ (0,
|
|
2044
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
1996
2045
|
"div",
|
|
1997
2046
|
{
|
|
1998
2047
|
...nativeProps,
|
|
1999
2048
|
"aria-label": description,
|
|
2000
|
-
className: (0,
|
|
2049
|
+
className: (0, import_css31.cx)(
|
|
2001
2050
|
nativeProps.className,
|
|
2002
2051
|
(0, import_patterns14.hstack)({
|
|
2003
2052
|
gap: "0"
|
|
@@ -2011,20 +2060,20 @@ function TabList(props) {
|
|
|
2011
2060
|
}
|
|
2012
2061
|
|
|
2013
2062
|
// src/components/TabPanel.tsx
|
|
2014
|
-
var
|
|
2015
|
-
var
|
|
2016
|
-
var
|
|
2063
|
+
var import_css32 = require("@cerberus/styled-system/css");
|
|
2064
|
+
var import_react15 = require("react");
|
|
2065
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
2017
2066
|
function TabPanel(props) {
|
|
2018
2067
|
const { tab, ...nativeProps } = props;
|
|
2019
2068
|
const { active, styles } = useTabsContext();
|
|
2020
|
-
const isActive = (0,
|
|
2021
|
-
return /* @__PURE__ */ (0,
|
|
2069
|
+
const isActive = (0, import_react15.useMemo)(() => active === tab, [active, tab]);
|
|
2070
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Show, { when: isActive, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2022
2071
|
"div",
|
|
2023
2072
|
{
|
|
2024
2073
|
...nativeProps,
|
|
2025
2074
|
...isActive && { tabIndex: 0 },
|
|
2026
2075
|
"aria-labelledby": `tab:${tab}`,
|
|
2027
|
-
className: (0,
|
|
2076
|
+
className: (0, import_css32.cx)(nativeProps.className, styles.tabPanel),
|
|
2028
2077
|
id: `panel:${tab}`,
|
|
2029
2078
|
role: "tabpanel"
|
|
2030
2079
|
}
|
|
@@ -2032,60 +2081,60 @@ function TabPanel(props) {
|
|
|
2032
2081
|
}
|
|
2033
2082
|
|
|
2034
2083
|
// src/components/Table.tsx
|
|
2035
|
-
var
|
|
2036
|
-
var
|
|
2037
|
-
var
|
|
2084
|
+
var import_css33 = require("@cerberus/styled-system/css");
|
|
2085
|
+
var import_recipes25 = require("@cerberus/styled-system/recipes");
|
|
2086
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
2038
2087
|
function Table(props) {
|
|
2039
2088
|
const { caption, children, ...nativeProps } = props;
|
|
2040
|
-
const styles = (0,
|
|
2041
|
-
return /* @__PURE__ */ (0,
|
|
2089
|
+
const styles = (0, import_recipes25.table)();
|
|
2090
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: styles.container, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
2042
2091
|
"table",
|
|
2043
2092
|
{
|
|
2044
2093
|
...nativeProps,
|
|
2045
|
-
className: (0,
|
|
2094
|
+
className: (0, import_css33.cx)(nativeProps.className, styles.table),
|
|
2046
2095
|
children: [
|
|
2047
|
-
/* @__PURE__ */ (0,
|
|
2096
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("caption", { className: styles.caption, children: caption }),
|
|
2048
2097
|
children
|
|
2049
2098
|
]
|
|
2050
2099
|
}
|
|
2051
2100
|
) });
|
|
2052
2101
|
}
|
|
2053
2102
|
function Tr(props) {
|
|
2054
|
-
return /* @__PURE__ */ (0,
|
|
2103
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("tr", { ...props });
|
|
2055
2104
|
}
|
|
2056
2105
|
|
|
2057
2106
|
// src/components/Thead.tsx
|
|
2058
|
-
var
|
|
2059
|
-
var
|
|
2060
|
-
var
|
|
2107
|
+
var import_css34 = require("@cerberus/styled-system/css");
|
|
2108
|
+
var import_recipes26 = require("@cerberus/styled-system/recipes");
|
|
2109
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
2061
2110
|
function Thead(props) {
|
|
2062
|
-
return /* @__PURE__ */ (0,
|
|
2111
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("thead", { ...props, className: (0, import_css34.cx)(props.className, (0, import_recipes26.thead)()) });
|
|
2063
2112
|
}
|
|
2064
2113
|
|
|
2065
2114
|
// src/components/Th.tsx
|
|
2066
|
-
var
|
|
2067
|
-
var
|
|
2068
|
-
var
|
|
2115
|
+
var import_css35 = require("@cerberus/styled-system/css");
|
|
2116
|
+
var import_recipes27 = require("@cerberus/styled-system/recipes");
|
|
2117
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
2069
2118
|
function Th(props) {
|
|
2070
2119
|
const { size, onClick, ...nativeProps } = props;
|
|
2071
|
-
return /* @__PURE__ */ (0,
|
|
2120
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
2072
2121
|
Show,
|
|
2073
2122
|
{
|
|
2074
2123
|
when: Boolean(onClick),
|
|
2075
|
-
fallback: /* @__PURE__ */ (0,
|
|
2124
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
2076
2125
|
"th",
|
|
2077
2126
|
{
|
|
2078
2127
|
...nativeProps,
|
|
2079
|
-
className: (0,
|
|
2128
|
+
className: (0, import_css35.cx)(nativeProps.className, (0, import_recipes27.th)({ size }))
|
|
2080
2129
|
}
|
|
2081
2130
|
),
|
|
2082
|
-
children: /* @__PURE__ */ (0,
|
|
2131
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("th", { ...nativeProps, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
2083
2132
|
"button",
|
|
2084
2133
|
{
|
|
2085
|
-
className: (0,
|
|
2134
|
+
className: (0, import_css35.cx)(
|
|
2086
2135
|
nativeProps.className,
|
|
2087
|
-
(0,
|
|
2088
|
-
(0,
|
|
2136
|
+
(0, import_recipes27.th)({ size }),
|
|
2137
|
+
(0, import_css35.css)({
|
|
2089
2138
|
alignItems: "center",
|
|
2090
2139
|
display: "inline-flex",
|
|
2091
2140
|
justifyContent: "space-between",
|
|
@@ -2105,18 +2154,18 @@ function Th(props) {
|
|
|
2105
2154
|
}
|
|
2106
2155
|
|
|
2107
2156
|
// src/components/Td.tsx
|
|
2108
|
-
var
|
|
2109
|
-
var
|
|
2110
|
-
var
|
|
2157
|
+
var import_css36 = require("@cerberus/styled-system/css");
|
|
2158
|
+
var import_recipes28 = require("@cerberus/styled-system/recipes");
|
|
2159
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
2111
2160
|
function Td(props) {
|
|
2112
2161
|
const { size, ...nativeProps } = props;
|
|
2113
|
-
return /* @__PURE__ */ (0,
|
|
2162
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
2114
2163
|
"td",
|
|
2115
2164
|
{
|
|
2116
2165
|
...nativeProps,
|
|
2117
|
-
className: (0,
|
|
2166
|
+
className: (0, import_css36.cx)(
|
|
2118
2167
|
nativeProps.className,
|
|
2119
|
-
(0,
|
|
2168
|
+
(0, import_recipes28.td)({
|
|
2120
2169
|
size
|
|
2121
2170
|
})
|
|
2122
2171
|
)
|
|
@@ -2125,18 +2174,18 @@ function Td(props) {
|
|
|
2125
2174
|
}
|
|
2126
2175
|
|
|
2127
2176
|
// src/components/Tbody.tsx
|
|
2128
|
-
var
|
|
2129
|
-
var
|
|
2130
|
-
var
|
|
2177
|
+
var import_recipes29 = require("@cerberus/styled-system/recipes");
|
|
2178
|
+
var import_css37 = require("@cerberus/styled-system/css");
|
|
2179
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
2131
2180
|
function Tbody(props) {
|
|
2132
2181
|
const { decoration, ...nativeProps } = props;
|
|
2133
|
-
return /* @__PURE__ */ (0,
|
|
2182
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
2134
2183
|
"tbody",
|
|
2135
2184
|
{
|
|
2136
2185
|
...nativeProps,
|
|
2137
|
-
className: (0,
|
|
2186
|
+
className: (0, import_css37.cx)(
|
|
2138
2187
|
nativeProps.className,
|
|
2139
|
-
(0,
|
|
2188
|
+
(0, import_recipes29.tbody)({
|
|
2140
2189
|
decoration
|
|
2141
2190
|
})
|
|
2142
2191
|
)
|
|
@@ -2145,9 +2194,9 @@ function Tbody(props) {
|
|
|
2145
2194
|
}
|
|
2146
2195
|
|
|
2147
2196
|
// src/components/Tag.tsx
|
|
2148
|
-
var
|
|
2149
|
-
var
|
|
2150
|
-
var
|
|
2197
|
+
var import_css38 = require("@cerberus/styled-system/css");
|
|
2198
|
+
var import_recipes30 = require("@cerberus/styled-system/recipes");
|
|
2199
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
2151
2200
|
function Tag(props) {
|
|
2152
2201
|
const { shape: initShape, gradient, onClick, usage, ...nativeProps } = props;
|
|
2153
2202
|
const palette = (props == null ? void 0 : props.palette) ?? "page";
|
|
@@ -2155,13 +2204,13 @@ function Tag(props) {
|
|
|
2155
2204
|
const shape = isClosable ? "pill" : initShape;
|
|
2156
2205
|
const closableStyles = isClosable ? closableCss : "";
|
|
2157
2206
|
const { close: Close2 } = $cerberusIcons;
|
|
2158
|
-
return /* @__PURE__ */ (0,
|
|
2207
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
2159
2208
|
"span",
|
|
2160
2209
|
{
|
|
2161
2210
|
...nativeProps,
|
|
2162
|
-
className: (0,
|
|
2211
|
+
className: (0, import_css38.cx)(
|
|
2163
2212
|
nativeProps.className,
|
|
2164
|
-
(0,
|
|
2213
|
+
(0, import_recipes30.tag)({
|
|
2165
2214
|
gradient,
|
|
2166
2215
|
palette,
|
|
2167
2216
|
shape,
|
|
@@ -2171,47 +2220,47 @@ function Tag(props) {
|
|
|
2171
2220
|
),
|
|
2172
2221
|
children: [
|
|
2173
2222
|
props.children,
|
|
2174
|
-
/* @__PURE__ */ (0,
|
|
2223
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Show, { when: isClosable, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
2175
2224
|
"button",
|
|
2176
2225
|
{
|
|
2177
2226
|
"aria-label": "Close",
|
|
2178
|
-
className: (0,
|
|
2227
|
+
className: (0, import_recipes30.iconButton)({
|
|
2179
2228
|
palette: "action",
|
|
2180
2229
|
usage: "filled",
|
|
2181
2230
|
size: "sm"
|
|
2182
2231
|
}),
|
|
2183
2232
|
onClick,
|
|
2184
|
-
children: /* @__PURE__ */ (0,
|
|
2233
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Close2, {})
|
|
2185
2234
|
}
|
|
2186
2235
|
) })
|
|
2187
2236
|
]
|
|
2188
2237
|
}
|
|
2189
2238
|
);
|
|
2190
2239
|
}
|
|
2191
|
-
var closableCss = (0,
|
|
2240
|
+
var closableCss = (0, import_css38.css)({
|
|
2192
2241
|
bgColor: "action.bg.active",
|
|
2193
2242
|
color: "action.text.initial",
|
|
2194
2243
|
paddingInlineEnd: "0"
|
|
2195
2244
|
});
|
|
2196
2245
|
|
|
2197
2246
|
// src/components/Textarea.tsx
|
|
2198
|
-
var
|
|
2199
|
-
var
|
|
2200
|
-
var
|
|
2247
|
+
var import_css39 = require("@cerberus/styled-system/css");
|
|
2248
|
+
var import_recipes31 = require("@cerberus/styled-system/recipes");
|
|
2249
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
2201
2250
|
function Textarea(props) {
|
|
2202
2251
|
const { describedBy, ...nativeProps } = props;
|
|
2203
2252
|
const { invalid, ...fieldState } = useFieldContext();
|
|
2204
|
-
return /* @__PURE__ */ (0,
|
|
2253
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
2205
2254
|
"textarea",
|
|
2206
2255
|
{
|
|
2207
2256
|
...nativeProps,
|
|
2208
2257
|
...fieldState,
|
|
2209
2258
|
...describedBy && { "aria-describedby": describedBy },
|
|
2210
2259
|
...invalid && { "aria-invalid": true },
|
|
2211
|
-
className: (0,
|
|
2260
|
+
className: (0, import_css39.cx)(
|
|
2212
2261
|
props.className,
|
|
2213
|
-
(0,
|
|
2214
|
-
(0,
|
|
2262
|
+
(0, import_recipes31.input)().input,
|
|
2263
|
+
(0, import_css39.css)({
|
|
2215
2264
|
pxi: "2",
|
|
2216
2265
|
py: "2",
|
|
2217
2266
|
resize: "vertical"
|
|
@@ -2223,43 +2272,43 @@ function Textarea(props) {
|
|
|
2223
2272
|
}
|
|
2224
2273
|
|
|
2225
2274
|
// src/components/Toggle.tsx
|
|
2226
|
-
var
|
|
2275
|
+
var import_css40 = require("@cerberus/styled-system/css");
|
|
2227
2276
|
var import_patterns15 = require("@cerberus/styled-system/patterns");
|
|
2228
|
-
var
|
|
2229
|
-
var
|
|
2277
|
+
var import_recipes32 = require("@cerberus/styled-system/recipes");
|
|
2278
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
2230
2279
|
function Toggle(props) {
|
|
2231
2280
|
const { size, describedBy, ...nativeProps } = props;
|
|
2232
|
-
const styles = (0,
|
|
2281
|
+
const styles = (0, import_recipes32.toggle)({ size });
|
|
2233
2282
|
const { invalid, ...state } = useFieldContext();
|
|
2234
2283
|
const Icon = $cerberusIcons.toggleChecked;
|
|
2235
|
-
return /* @__PURE__ */ (0,
|
|
2284
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
2236
2285
|
"span",
|
|
2237
2286
|
{
|
|
2238
|
-
className: (0,
|
|
2287
|
+
className: (0, import_css40.cx)("group", styles.track, (0, import_patterns15.hstack)()),
|
|
2239
2288
|
"data-checked": props.checked || props.defaultChecked,
|
|
2240
2289
|
children: [
|
|
2241
|
-
/* @__PURE__ */ (0,
|
|
2290
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
2242
2291
|
"input",
|
|
2243
2292
|
{
|
|
2244
2293
|
...nativeProps,
|
|
2245
2294
|
...state,
|
|
2246
2295
|
...describedBy && { "aria-describedby": describedBy },
|
|
2247
2296
|
...invalid && { "aria-invalid": true },
|
|
2248
|
-
className: (0,
|
|
2297
|
+
className: (0, import_css40.cx)("peer", styles.input),
|
|
2249
2298
|
role: "switch",
|
|
2250
2299
|
type: "checkbox"
|
|
2251
2300
|
}
|
|
2252
2301
|
),
|
|
2253
|
-
/* @__PURE__ */ (0,
|
|
2302
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
2254
2303
|
"span",
|
|
2255
2304
|
{
|
|
2256
|
-
className: (0,
|
|
2305
|
+
className: (0, import_css40.cx)(
|
|
2257
2306
|
styles.thumb,
|
|
2258
2307
|
(0, import_patterns15.vstack)({
|
|
2259
2308
|
justify: "center"
|
|
2260
2309
|
})
|
|
2261
2310
|
),
|
|
2262
|
-
children: /* @__PURE__ */ (0,
|
|
2311
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Icon, {})
|
|
2263
2312
|
}
|
|
2264
2313
|
)
|
|
2265
2314
|
]
|
|
@@ -2268,26 +2317,26 @@ function Toggle(props) {
|
|
|
2268
2317
|
}
|
|
2269
2318
|
|
|
2270
2319
|
// src/context/confirm-modal.tsx
|
|
2271
|
-
var
|
|
2272
|
-
var
|
|
2320
|
+
var import_react17 = require("react");
|
|
2321
|
+
var import_css41 = require("@cerberus/styled-system/css");
|
|
2273
2322
|
var import_patterns16 = require("@cerberus/styled-system/patterns");
|
|
2274
2323
|
|
|
2275
2324
|
// src/hooks/useModal.ts
|
|
2276
|
-
var
|
|
2325
|
+
var import_react16 = require("react");
|
|
2277
2326
|
function useModal() {
|
|
2278
|
-
const modalRef = (0,
|
|
2279
|
-
const [isOpen, setIsOpen] = (0,
|
|
2280
|
-
const show = (0,
|
|
2327
|
+
const modalRef = (0, import_react16.useRef)(null);
|
|
2328
|
+
const [isOpen, setIsOpen] = (0, import_react16.useState)(false);
|
|
2329
|
+
const show = (0, import_react16.useCallback)(() => {
|
|
2281
2330
|
var _a;
|
|
2282
2331
|
(_a = modalRef.current) == null ? void 0 : _a.showModal();
|
|
2283
2332
|
setIsOpen(true);
|
|
2284
2333
|
}, []);
|
|
2285
|
-
const close = (0,
|
|
2334
|
+
const close = (0, import_react16.useCallback)(() => {
|
|
2286
2335
|
var _a;
|
|
2287
2336
|
(_a = modalRef.current) == null ? void 0 : _a.close();
|
|
2288
2337
|
setIsOpen(false);
|
|
2289
2338
|
}, []);
|
|
2290
|
-
return (0,
|
|
2339
|
+
return (0, import_react16.useMemo)(() => {
|
|
2291
2340
|
return {
|
|
2292
2341
|
modalRef,
|
|
2293
2342
|
show,
|
|
@@ -2298,19 +2347,19 @@ function useModal() {
|
|
|
2298
2347
|
}
|
|
2299
2348
|
|
|
2300
2349
|
// src/context/confirm-modal.tsx
|
|
2301
|
-
var
|
|
2302
|
-
var ConfirmModalContext = (0,
|
|
2350
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
2351
|
+
var ConfirmModalContext = (0, import_react17.createContext)(null);
|
|
2303
2352
|
function ConfirmModal(props) {
|
|
2304
2353
|
const { modalRef, show, close } = useModal();
|
|
2305
|
-
const resolveRef = (0,
|
|
2306
|
-
const [content, setContent] = (0,
|
|
2354
|
+
const resolveRef = (0, import_react17.useRef)(null);
|
|
2355
|
+
const [content, setContent] = (0, import_react17.useState)(null);
|
|
2307
2356
|
const focusTrap = trapFocus(modalRef);
|
|
2308
2357
|
const ConfirmIcon = $cerberusIcons.confirmModal;
|
|
2309
|
-
const palette = (0,
|
|
2358
|
+
const palette = (0, import_react17.useMemo)(
|
|
2310
2359
|
() => (content == null ? void 0 : content.kind) === "destructive" ? "danger" : "action",
|
|
2311
2360
|
[content]
|
|
2312
2361
|
);
|
|
2313
|
-
const handleChoice = (0,
|
|
2362
|
+
const handleChoice = (0, import_react17.useCallback)(
|
|
2314
2363
|
(e) => {
|
|
2315
2364
|
var _a, _b;
|
|
2316
2365
|
const target = e.currentTarget;
|
|
@@ -2322,7 +2371,7 @@ function ConfirmModal(props) {
|
|
|
2322
2371
|
},
|
|
2323
2372
|
[close]
|
|
2324
2373
|
);
|
|
2325
|
-
const handleShow = (0,
|
|
2374
|
+
const handleShow = (0, import_react17.useCallback)(
|
|
2326
2375
|
(options) => {
|
|
2327
2376
|
return new Promise((resolve) => {
|
|
2328
2377
|
setContent({ ...options, kind: options.kind || "non-destructive" });
|
|
@@ -2332,42 +2381,42 @@ function ConfirmModal(props) {
|
|
|
2332
2381
|
},
|
|
2333
2382
|
[show]
|
|
2334
2383
|
);
|
|
2335
|
-
const value = (0,
|
|
2384
|
+
const value = (0, import_react17.useMemo)(
|
|
2336
2385
|
() => ({
|
|
2337
2386
|
show: handleShow
|
|
2338
2387
|
}),
|
|
2339
2388
|
[handleShow]
|
|
2340
2389
|
);
|
|
2341
|
-
return /* @__PURE__ */ (0,
|
|
2390
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(ConfirmModalContext.Provider, { value, children: [
|
|
2342
2391
|
props.children,
|
|
2343
|
-
/* @__PURE__ */ (0,
|
|
2344
|
-
/* @__PURE__ */ (0,
|
|
2345
|
-
/* @__PURE__ */ (0,
|
|
2392
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(Modal, { onKeyDown: focusTrap, ref: modalRef, children: [
|
|
2393
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(ModalHeader, { children: [
|
|
2394
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
2346
2395
|
"div",
|
|
2347
2396
|
{
|
|
2348
2397
|
className: (0, import_patterns16.hstack)({
|
|
2349
2398
|
justify: "center",
|
|
2350
2399
|
w: "full"
|
|
2351
2400
|
}),
|
|
2352
|
-
children: /* @__PURE__ */ (0,
|
|
2401
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
2353
2402
|
Show,
|
|
2354
2403
|
{
|
|
2355
2404
|
when: palette === "danger",
|
|
2356
|
-
fallback: /* @__PURE__ */ (0,
|
|
2405
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
2357
2406
|
Avatar,
|
|
2358
2407
|
{
|
|
2359
2408
|
ariaLabel: "",
|
|
2360
2409
|
gradient: "charon-light",
|
|
2361
|
-
icon: /* @__PURE__ */ (0,
|
|
2410
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ConfirmIcon, { size: 24 }),
|
|
2362
2411
|
src: ""
|
|
2363
2412
|
}
|
|
2364
2413
|
),
|
|
2365
|
-
children: /* @__PURE__ */ (0,
|
|
2414
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
2366
2415
|
Avatar,
|
|
2367
2416
|
{
|
|
2368
2417
|
ariaLabel: "",
|
|
2369
2418
|
gradient: "hades-dark",
|
|
2370
|
-
icon: /* @__PURE__ */ (0,
|
|
2419
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ConfirmIcon, { size: 24 }),
|
|
2371
2420
|
src: ""
|
|
2372
2421
|
}
|
|
2373
2422
|
)
|
|
@@ -2375,21 +2424,21 @@ function ConfirmModal(props) {
|
|
|
2375
2424
|
)
|
|
2376
2425
|
}
|
|
2377
2426
|
),
|
|
2378
|
-
/* @__PURE__ */ (0,
|
|
2379
|
-
/* @__PURE__ */ (0,
|
|
2427
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ModalHeading, { children: content == null ? void 0 : content.heading }),
|
|
2428
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ModalDescription, { children: content == null ? void 0 : content.description })
|
|
2380
2429
|
] }),
|
|
2381
|
-
/* @__PURE__ */ (0,
|
|
2430
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
2382
2431
|
"div",
|
|
2383
2432
|
{
|
|
2384
2433
|
className: (0, import_patterns16.hstack)({
|
|
2385
2434
|
gap: "4"
|
|
2386
2435
|
}),
|
|
2387
2436
|
children: [
|
|
2388
|
-
/* @__PURE__ */ (0,
|
|
2437
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
2389
2438
|
Button,
|
|
2390
2439
|
{
|
|
2391
2440
|
autoFocus: true,
|
|
2392
|
-
className: (0,
|
|
2441
|
+
className: (0, import_css41.css)({
|
|
2393
2442
|
w: "1/2"
|
|
2394
2443
|
}),
|
|
2395
2444
|
name: "confirm",
|
|
@@ -2399,10 +2448,10 @@ function ConfirmModal(props) {
|
|
|
2399
2448
|
children: content == null ? void 0 : content.actionText
|
|
2400
2449
|
}
|
|
2401
2450
|
),
|
|
2402
|
-
/* @__PURE__ */ (0,
|
|
2451
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
2403
2452
|
Button,
|
|
2404
2453
|
{
|
|
2405
|
-
className: (0,
|
|
2454
|
+
className: (0, import_css41.css)({
|
|
2406
2455
|
w: "1/2"
|
|
2407
2456
|
}),
|
|
2408
2457
|
name: "cancel",
|
|
@@ -2419,7 +2468,7 @@ function ConfirmModal(props) {
|
|
|
2419
2468
|
] });
|
|
2420
2469
|
}
|
|
2421
2470
|
function useConfirmModal() {
|
|
2422
|
-
const context = (0,
|
|
2471
|
+
const context = (0, import_react17.useContext)(ConfirmModalContext);
|
|
2423
2472
|
if (context === null) {
|
|
2424
2473
|
throw new Error(
|
|
2425
2474
|
"useConfirmModal must be used within a ConfirmModal Provider"
|
|
@@ -2429,21 +2478,21 @@ function useConfirmModal() {
|
|
|
2429
2478
|
}
|
|
2430
2479
|
|
|
2431
2480
|
// src/context/cta-modal.tsx
|
|
2432
|
-
var
|
|
2481
|
+
var import_react18 = require("react");
|
|
2433
2482
|
var import_jsx = require("@cerberus/styled-system/jsx");
|
|
2434
|
-
var
|
|
2483
|
+
var import_css42 = require("@cerberus/styled-system/css");
|
|
2435
2484
|
var import_jsx2 = require("@cerberus/styled-system/jsx");
|
|
2436
|
-
var
|
|
2437
|
-
var CTAModalContext = (0,
|
|
2485
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
2486
|
+
var CTAModalContext = (0, import_react18.createContext)(null);
|
|
2438
2487
|
function CTAModal(props) {
|
|
2439
2488
|
var _a, _b;
|
|
2440
2489
|
const { modalRef, show, close } = useModal();
|
|
2441
|
-
const [content, setContent] = (0,
|
|
2490
|
+
const [content, setContent] = (0, import_react18.useState)(null);
|
|
2442
2491
|
const focusTrap = trapFocus(modalRef);
|
|
2443
2492
|
const FallbackIcon = $cerberusIcons.confirmModal;
|
|
2444
2493
|
const confirmIcon = content == null ? void 0 : content.icon;
|
|
2445
2494
|
const { close: CloseIcon } = $cerberusIcons;
|
|
2446
|
-
const handleShow = (0,
|
|
2495
|
+
const handleShow = (0, import_react18.useCallback)(
|
|
2447
2496
|
(options) => {
|
|
2448
2497
|
const maxActions = 2;
|
|
2449
2498
|
if (options.actions.length > maxActions) {
|
|
@@ -2456,7 +2505,7 @@ function CTAModal(props) {
|
|
|
2456
2505
|
},
|
|
2457
2506
|
[show]
|
|
2458
2507
|
);
|
|
2459
|
-
const handleActionClick = (0,
|
|
2508
|
+
const handleActionClick = (0, import_react18.useCallback)(
|
|
2460
2509
|
(event) => {
|
|
2461
2510
|
const index = event.currentTarget.getAttribute("data-index");
|
|
2462
2511
|
const action = content == null ? void 0 : content.actions[Number(index)];
|
|
@@ -2467,55 +2516,55 @@ function CTAModal(props) {
|
|
|
2467
2516
|
},
|
|
2468
2517
|
[content, close]
|
|
2469
2518
|
);
|
|
2470
|
-
const value = (0,
|
|
2519
|
+
const value = (0, import_react18.useMemo)(
|
|
2471
2520
|
() => ({
|
|
2472
2521
|
show: handleShow
|
|
2473
2522
|
}),
|
|
2474
2523
|
[handleShow]
|
|
2475
2524
|
);
|
|
2476
|
-
return /* @__PURE__ */ (0,
|
|
2525
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(CTAModalContext.Provider, { value, children: [
|
|
2477
2526
|
props.children,
|
|
2478
|
-
/* @__PURE__ */ (0,
|
|
2479
|
-
/* @__PURE__ */ (0,
|
|
2527
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(Modal, { onKeyDown: focusTrap, ref: modalRef, children: [
|
|
2528
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
2480
2529
|
"span",
|
|
2481
2530
|
{
|
|
2482
|
-
className: (0,
|
|
2531
|
+
className: (0, import_css42.css)({
|
|
2483
2532
|
padding: "md",
|
|
2484
2533
|
position: "absolute",
|
|
2485
2534
|
right: 0,
|
|
2486
2535
|
top: 0,
|
|
2487
2536
|
zIndex: "decorator"
|
|
2488
2537
|
}),
|
|
2489
|
-
children: /* @__PURE__ */ (0,
|
|
2538
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(IconButton, { ariaLabel: "Close modal", onClick: close, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(CloseIcon, {}) })
|
|
2490
2539
|
}
|
|
2491
2540
|
),
|
|
2492
|
-
/* @__PURE__ */ (0,
|
|
2493
|
-
/* @__PURE__ */ (0,
|
|
2541
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(ModalHeader, { children: [
|
|
2542
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_jsx.HStack, { justify: "center", w: "full", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
2494
2543
|
Avatar,
|
|
2495
2544
|
{
|
|
2496
2545
|
ariaLabel: "",
|
|
2497
2546
|
gradient: "charon-light",
|
|
2498
|
-
icon: /* @__PURE__ */ (0,
|
|
2547
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
2499
2548
|
Show,
|
|
2500
2549
|
{
|
|
2501
2550
|
when: Boolean(confirmIcon),
|
|
2502
|
-
fallback: /* @__PURE__ */ (0,
|
|
2551
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(FallbackIcon, { size: 24 }),
|
|
2503
2552
|
children: confirmIcon
|
|
2504
2553
|
}
|
|
2505
2554
|
),
|
|
2506
2555
|
src: ""
|
|
2507
2556
|
}
|
|
2508
2557
|
) }),
|
|
2509
|
-
/* @__PURE__ */ (0,
|
|
2510
|
-
/* @__PURE__ */ (0,
|
|
2511
|
-
/* @__PURE__ */ (0,
|
|
2558
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx2.VStack, { gap: "lg", w: "full", children: [
|
|
2559
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(ModalHeading, { children: content == null ? void 0 : content.heading }),
|
|
2560
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(ModalDescription, { children: content == null ? void 0 : content.description })
|
|
2512
2561
|
] })
|
|
2513
2562
|
] }),
|
|
2514
|
-
/* @__PURE__ */ (0,
|
|
2563
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_jsx.HStack, { gap: "md", pt: "sm", w: "full", children: /* @__PURE__ */ (0, import_jsx_runtime50.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_runtime50.jsx)(
|
|
2515
2564
|
Button,
|
|
2516
2565
|
{
|
|
2517
2566
|
"data-index": index,
|
|
2518
|
-
className: (0,
|
|
2567
|
+
className: (0, import_css42.css)({
|
|
2519
2568
|
w: "1/2"
|
|
2520
2569
|
}),
|
|
2521
2570
|
onClick: handleActionClick,
|
|
@@ -2529,7 +2578,7 @@ function CTAModal(props) {
|
|
|
2529
2578
|
] });
|
|
2530
2579
|
}
|
|
2531
2580
|
function useCTAModal() {
|
|
2532
|
-
const context = (0,
|
|
2581
|
+
const context = (0, import_react18.useContext)(CTAModalContext);
|
|
2533
2582
|
if (context === null) {
|
|
2534
2583
|
throw new Error("useCTAModal must be used within a CTAModal Provider");
|
|
2535
2584
|
}
|
|
@@ -2537,22 +2586,22 @@ function useCTAModal() {
|
|
|
2537
2586
|
}
|
|
2538
2587
|
|
|
2539
2588
|
// src/context/notification-center.tsx
|
|
2540
|
-
var
|
|
2589
|
+
var import_react19 = require("react");
|
|
2541
2590
|
var import_patterns17 = require("@cerberus/styled-system/patterns");
|
|
2542
|
-
var
|
|
2543
|
-
var
|
|
2544
|
-
var
|
|
2545
|
-
var NotificationsContext = (0,
|
|
2591
|
+
var import_recipes33 = require("@cerberus/styled-system/recipes");
|
|
2592
|
+
var import_css43 = require("@cerberus/styled-system/css");
|
|
2593
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
2594
|
+
var NotificationsContext = (0, import_react19.createContext)(null);
|
|
2546
2595
|
function NotificationCenter(props) {
|
|
2547
|
-
const [activeNotifications, setActiveNotifications] = (0,
|
|
2548
|
-
const styles = (0,
|
|
2549
|
-
const handleNotify = (0,
|
|
2596
|
+
const [activeNotifications, setActiveNotifications] = (0, import_react19.useState)([]);
|
|
2597
|
+
const styles = (0, import_recipes33.notification)();
|
|
2598
|
+
const handleNotify = (0, import_react19.useCallback)((options) => {
|
|
2550
2599
|
setActiveNotifications((prev) => {
|
|
2551
2600
|
const id = `${options.palette}:${prev.length + 1}`;
|
|
2552
2601
|
return [...prev, { ...options, id }];
|
|
2553
2602
|
});
|
|
2554
2603
|
}, []);
|
|
2555
|
-
const handleClose = (0,
|
|
2604
|
+
const handleClose = (0, import_react19.useCallback)((e) => {
|
|
2556
2605
|
const target = e.currentTarget;
|
|
2557
2606
|
setActiveNotifications((prev) => {
|
|
2558
2607
|
const item = prev.find((option) => option.id === target.value);
|
|
@@ -2560,7 +2609,7 @@ function NotificationCenter(props) {
|
|
|
2560
2609
|
return prev.filter((option) => option.id !== target.value);
|
|
2561
2610
|
});
|
|
2562
2611
|
}, []);
|
|
2563
|
-
const handleCloseAll = (0,
|
|
2612
|
+
const handleCloseAll = (0, import_react19.useCallback)(() => {
|
|
2564
2613
|
setActiveNotifications((prev) => {
|
|
2565
2614
|
prev.forEach((item) => {
|
|
2566
2615
|
if (item.onClose) item.onClose();
|
|
@@ -2568,19 +2617,19 @@ function NotificationCenter(props) {
|
|
|
2568
2617
|
return [];
|
|
2569
2618
|
});
|
|
2570
2619
|
}, []);
|
|
2571
|
-
const value = (0,
|
|
2620
|
+
const value = (0, import_react19.useMemo)(
|
|
2572
2621
|
() => ({
|
|
2573
2622
|
notify: handleNotify
|
|
2574
2623
|
}),
|
|
2575
2624
|
[handleNotify]
|
|
2576
2625
|
);
|
|
2577
|
-
return /* @__PURE__ */ (0,
|
|
2626
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(NotificationsContext.Provider, { value, children: [
|
|
2578
2627
|
props.children,
|
|
2579
|
-
/* @__PURE__ */ (0,
|
|
2580
|
-
/* @__PURE__ */ (0,
|
|
2628
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Show, { when: activeNotifications.length > 0, children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Portal, { container: props.container, children: /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: styles.center, children: [
|
|
2629
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Show, { when: activeNotifications.length >= 4, children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
2581
2630
|
Button,
|
|
2582
2631
|
{
|
|
2583
|
-
className: (0,
|
|
2632
|
+
className: (0, import_css43.cx)(styles.closeAll, (0, import_patterns17.animateIn)()),
|
|
2584
2633
|
onClick: handleCloseAll,
|
|
2585
2634
|
palette: "action",
|
|
2586
2635
|
shape: "rounded",
|
|
@@ -2589,7 +2638,7 @@ function NotificationCenter(props) {
|
|
|
2589
2638
|
children: "Close all"
|
|
2590
2639
|
}
|
|
2591
2640
|
) }),
|
|
2592
|
-
/* @__PURE__ */ (0,
|
|
2641
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
2593
2642
|
"div",
|
|
2594
2643
|
{
|
|
2595
2644
|
className: (0, import_patterns17.vstack)({
|
|
@@ -2599,7 +2648,7 @@ function NotificationCenter(props) {
|
|
|
2599
2648
|
style: {
|
|
2600
2649
|
alignItems: "flex-end"
|
|
2601
2650
|
},
|
|
2602
|
-
children: activeNotifications.map((option) => /* @__PURE__ */ (0,
|
|
2651
|
+
children: activeNotifications.map((option) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
2603
2652
|
MatchNotification,
|
|
2604
2653
|
{
|
|
2605
2654
|
...option,
|
|
@@ -2616,7 +2665,7 @@ function MatchNotification(props) {
|
|
|
2616
2665
|
const { palette, id, onClose, heading, description } = props;
|
|
2617
2666
|
switch (palette) {
|
|
2618
2667
|
case "success":
|
|
2619
|
-
return /* @__PURE__ */ (0,
|
|
2668
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
|
|
2620
2669
|
Notification,
|
|
2621
2670
|
{
|
|
2622
2671
|
id,
|
|
@@ -2624,14 +2673,14 @@ function MatchNotification(props) {
|
|
|
2624
2673
|
open: true,
|
|
2625
2674
|
palette: "success",
|
|
2626
2675
|
children: [
|
|
2627
|
-
/* @__PURE__ */ (0,
|
|
2628
|
-
/* @__PURE__ */ (0,
|
|
2676
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(NotificationHeading, { palette: "success", children: heading }),
|
|
2677
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(NotificationDescription, { palette: "success", children: description })
|
|
2629
2678
|
]
|
|
2630
2679
|
},
|
|
2631
2680
|
id
|
|
2632
2681
|
);
|
|
2633
2682
|
case "warning":
|
|
2634
|
-
return /* @__PURE__ */ (0,
|
|
2683
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
|
|
2635
2684
|
Notification,
|
|
2636
2685
|
{
|
|
2637
2686
|
id,
|
|
@@ -2639,27 +2688,27 @@ function MatchNotification(props) {
|
|
|
2639
2688
|
open: true,
|
|
2640
2689
|
palette: "warning",
|
|
2641
2690
|
children: [
|
|
2642
|
-
/* @__PURE__ */ (0,
|
|
2643
|
-
/* @__PURE__ */ (0,
|
|
2691
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(NotificationHeading, { palette: "warning", children: heading }),
|
|
2692
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(NotificationDescription, { palette: "warning", children: description })
|
|
2644
2693
|
]
|
|
2645
2694
|
},
|
|
2646
2695
|
id
|
|
2647
2696
|
);
|
|
2648
2697
|
case "danger":
|
|
2649
|
-
return /* @__PURE__ */ (0,
|
|
2650
|
-
/* @__PURE__ */ (0,
|
|
2651
|
-
/* @__PURE__ */ (0,
|
|
2698
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(Notification, { id, onClose, open: true, palette: "danger", children: [
|
|
2699
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(NotificationHeading, { palette: "danger", children: heading }),
|
|
2700
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(NotificationDescription, { palette: "danger", children: description })
|
|
2652
2701
|
] }, id);
|
|
2653
2702
|
case "info":
|
|
2654
2703
|
default:
|
|
2655
|
-
return /* @__PURE__ */ (0,
|
|
2656
|
-
/* @__PURE__ */ (0,
|
|
2657
|
-
/* @__PURE__ */ (0,
|
|
2704
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(Notification, { id, onClose, open: true, palette: "info", children: [
|
|
2705
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(NotificationHeading, { palette: "info", children: heading }),
|
|
2706
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(NotificationDescription, { palette: "info", children: description })
|
|
2658
2707
|
] }, id);
|
|
2659
2708
|
}
|
|
2660
2709
|
}
|
|
2661
2710
|
function useNotificationCenter() {
|
|
2662
|
-
const context = (0,
|
|
2711
|
+
const context = (0, import_react19.useContext)(NotificationsContext);
|
|
2663
2712
|
if (!context) {
|
|
2664
2713
|
throw new Error(
|
|
2665
2714
|
"useNotificationCenter must be used within a NotificationsProvider"
|
|
@@ -2669,33 +2718,33 @@ function useNotificationCenter() {
|
|
|
2669
2718
|
}
|
|
2670
2719
|
|
|
2671
2720
|
// src/context/prompt-modal.tsx
|
|
2672
|
-
var
|
|
2673
|
-
var
|
|
2721
|
+
var import_react20 = require("react");
|
|
2722
|
+
var import_css44 = require("@cerberus/styled-system/css");
|
|
2674
2723
|
var import_patterns18 = require("@cerberus/styled-system/patterns");
|
|
2675
|
-
var
|
|
2676
|
-
var PromptModalContext = (0,
|
|
2724
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
2725
|
+
var PromptModalContext = (0, import_react20.createContext)(null);
|
|
2677
2726
|
function PromptModal(props) {
|
|
2678
2727
|
const { modalRef, show, close } = useModal();
|
|
2679
|
-
const resolveRef = (0,
|
|
2680
|
-
const [content, setContent] = (0,
|
|
2681
|
-
const [inputValue, setInputValue] = (0,
|
|
2728
|
+
const resolveRef = (0, import_react20.useRef)(null);
|
|
2729
|
+
const [content, setContent] = (0, import_react20.useState)(null);
|
|
2730
|
+
const [inputValue, setInputValue] = (0, import_react20.useState)("");
|
|
2682
2731
|
const focusTrap = trapFocus(modalRef);
|
|
2683
2732
|
const PromptIcon = $cerberusIcons.promptModal;
|
|
2684
|
-
const isValid = (0,
|
|
2733
|
+
const isValid = (0, import_react20.useMemo)(
|
|
2685
2734
|
() => inputValue === (content == null ? void 0 : content.key),
|
|
2686
2735
|
[inputValue, content]
|
|
2687
2736
|
);
|
|
2688
|
-
const palette = (0,
|
|
2737
|
+
const palette = (0, import_react20.useMemo)(
|
|
2689
2738
|
() => (content == null ? void 0 : content.kind) === "destructive" ? "danger" : "action",
|
|
2690
2739
|
[content]
|
|
2691
2740
|
);
|
|
2692
|
-
const handleChange = (0,
|
|
2741
|
+
const handleChange = (0, import_react20.useCallback)(
|
|
2693
2742
|
(e) => {
|
|
2694
2743
|
setInputValue(e.currentTarget.value);
|
|
2695
2744
|
},
|
|
2696
2745
|
[content]
|
|
2697
2746
|
);
|
|
2698
|
-
const handleChoice = (0,
|
|
2747
|
+
const handleChoice = (0, import_react20.useCallback)(
|
|
2699
2748
|
(e) => {
|
|
2700
2749
|
var _a;
|
|
2701
2750
|
const target = e.currentTarget;
|
|
@@ -2706,7 +2755,7 @@ function PromptModal(props) {
|
|
|
2706
2755
|
},
|
|
2707
2756
|
[inputValue, close]
|
|
2708
2757
|
);
|
|
2709
|
-
const handleShow = (0,
|
|
2758
|
+
const handleShow = (0, import_react20.useCallback)(
|
|
2710
2759
|
(options) => {
|
|
2711
2760
|
return new Promise((resolve) => {
|
|
2712
2761
|
setContent({ ...options, kind: options.kind || "non-destructive" });
|
|
@@ -2716,42 +2765,42 @@ function PromptModal(props) {
|
|
|
2716
2765
|
},
|
|
2717
2766
|
[show]
|
|
2718
2767
|
);
|
|
2719
|
-
const value = (0,
|
|
2768
|
+
const value = (0, import_react20.useMemo)(
|
|
2720
2769
|
() => ({
|
|
2721
2770
|
show: handleShow
|
|
2722
2771
|
}),
|
|
2723
2772
|
[handleShow]
|
|
2724
2773
|
);
|
|
2725
|
-
return /* @__PURE__ */ (0,
|
|
2774
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(PromptModalContext.Provider, { value, children: [
|
|
2726
2775
|
props.children,
|
|
2727
|
-
/* @__PURE__ */ (0,
|
|
2728
|
-
/* @__PURE__ */ (0,
|
|
2729
|
-
/* @__PURE__ */ (0,
|
|
2776
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(Modal, { onKeyDown: focusTrap, ref: modalRef, children: [
|
|
2777
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(ModalHeader, { children: [
|
|
2778
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
2730
2779
|
"div",
|
|
2731
2780
|
{
|
|
2732
2781
|
className: (0, import_patterns18.hstack)({
|
|
2733
2782
|
justify: "center",
|
|
2734
2783
|
w: "full"
|
|
2735
2784
|
}),
|
|
2736
|
-
children: /* @__PURE__ */ (0,
|
|
2785
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
2737
2786
|
Show,
|
|
2738
2787
|
{
|
|
2739
2788
|
when: palette === "danger",
|
|
2740
|
-
fallback: /* @__PURE__ */ (0,
|
|
2789
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
2741
2790
|
Avatar,
|
|
2742
2791
|
{
|
|
2743
2792
|
ariaLabel: "",
|
|
2744
2793
|
gradient: "charon-light",
|
|
2745
|
-
icon: /* @__PURE__ */ (0,
|
|
2794
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(PromptIcon, { size: 24 }),
|
|
2746
2795
|
src: ""
|
|
2747
2796
|
}
|
|
2748
2797
|
),
|
|
2749
|
-
children: /* @__PURE__ */ (0,
|
|
2798
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
2750
2799
|
Avatar,
|
|
2751
2800
|
{
|
|
2752
2801
|
ariaLabel: "",
|
|
2753
2802
|
gradient: "hades-dark",
|
|
2754
|
-
icon: /* @__PURE__ */ (0,
|
|
2803
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(PromptIcon, { size: 24 }),
|
|
2755
2804
|
src: ""
|
|
2756
2805
|
}
|
|
2757
2806
|
)
|
|
@@ -2759,10 +2808,10 @@ function PromptModal(props) {
|
|
|
2759
2808
|
)
|
|
2760
2809
|
}
|
|
2761
2810
|
),
|
|
2762
|
-
/* @__PURE__ */ (0,
|
|
2763
|
-
/* @__PURE__ */ (0,
|
|
2811
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(ModalHeading, { children: content == null ? void 0 : content.heading }),
|
|
2812
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(ModalDescription, { children: content == null ? void 0 : content.description })
|
|
2764
2813
|
] }),
|
|
2765
|
-
/* @__PURE__ */ (0,
|
|
2814
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
2766
2815
|
"div",
|
|
2767
2816
|
{
|
|
2768
2817
|
className: (0, import_patterns18.vstack)({
|
|
@@ -2770,11 +2819,11 @@ function PromptModal(props) {
|
|
|
2770
2819
|
mt: "4",
|
|
2771
2820
|
mb: "8"
|
|
2772
2821
|
}),
|
|
2773
|
-
children: /* @__PURE__ */ (0,
|
|
2774
|
-
/* @__PURE__ */ (0,
|
|
2822
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(Field, { invalid: !isValid, children: [
|
|
2823
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
2775
2824
|
Label,
|
|
2776
2825
|
{
|
|
2777
|
-
className: (0,
|
|
2826
|
+
className: (0, import_css44.css)({
|
|
2778
2827
|
gap: 1,
|
|
2779
2828
|
justifyContent: "flex-start"
|
|
2780
2829
|
}),
|
|
@@ -2782,10 +2831,10 @@ function PromptModal(props) {
|
|
|
2782
2831
|
size: "md",
|
|
2783
2832
|
children: [
|
|
2784
2833
|
"Type",
|
|
2785
|
-
/* @__PURE__ */ (0,
|
|
2834
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
2786
2835
|
"strong",
|
|
2787
2836
|
{
|
|
2788
|
-
className: (0,
|
|
2837
|
+
className: (0, import_css44.css)({
|
|
2789
2838
|
textTransform: "uppercase"
|
|
2790
2839
|
}),
|
|
2791
2840
|
children: content == null ? void 0 : content.key
|
|
@@ -2795,7 +2844,7 @@ function PromptModal(props) {
|
|
|
2795
2844
|
]
|
|
2796
2845
|
}
|
|
2797
2846
|
),
|
|
2798
|
-
/* @__PURE__ */ (0,
|
|
2847
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
2799
2848
|
Input,
|
|
2800
2849
|
{
|
|
2801
2850
|
id: "confirm",
|
|
@@ -2807,7 +2856,7 @@ function PromptModal(props) {
|
|
|
2807
2856
|
] })
|
|
2808
2857
|
}
|
|
2809
2858
|
),
|
|
2810
|
-
/* @__PURE__ */ (0,
|
|
2859
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
2811
2860
|
"div",
|
|
2812
2861
|
{
|
|
2813
2862
|
className: (0, import_patterns18.hstack)({
|
|
@@ -2815,11 +2864,11 @@ function PromptModal(props) {
|
|
|
2815
2864
|
gap: "4"
|
|
2816
2865
|
}),
|
|
2817
2866
|
children: [
|
|
2818
|
-
/* @__PURE__ */ (0,
|
|
2867
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
2819
2868
|
Button,
|
|
2820
2869
|
{
|
|
2821
2870
|
autoFocus: true,
|
|
2822
|
-
className: (0,
|
|
2871
|
+
className: (0, import_css44.css)({
|
|
2823
2872
|
w: "1/2"
|
|
2824
2873
|
}),
|
|
2825
2874
|
disabled: !isValid,
|
|
@@ -2830,10 +2879,10 @@ function PromptModal(props) {
|
|
|
2830
2879
|
children: content == null ? void 0 : content.actionText
|
|
2831
2880
|
}
|
|
2832
2881
|
),
|
|
2833
|
-
/* @__PURE__ */ (0,
|
|
2882
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
2834
2883
|
Button,
|
|
2835
2884
|
{
|
|
2836
|
-
className: (0,
|
|
2885
|
+
className: (0, import_css44.css)({
|
|
2837
2886
|
w: "1/2"
|
|
2838
2887
|
}),
|
|
2839
2888
|
name: "cancel",
|
|
@@ -2850,7 +2899,7 @@ function PromptModal(props) {
|
|
|
2850
2899
|
] });
|
|
2851
2900
|
}
|
|
2852
2901
|
function usePromptModal() {
|
|
2853
|
-
const context = (0,
|
|
2902
|
+
const context = (0, import_react20.useContext)(PromptModalContext);
|
|
2854
2903
|
if (context === null) {
|
|
2855
2904
|
throw new Error("usePromptModal must be used within a PromptModal Provider");
|
|
2856
2905
|
}
|
|
@@ -2858,50 +2907,50 @@ function usePromptModal() {
|
|
|
2858
2907
|
}
|
|
2859
2908
|
|
|
2860
2909
|
// src/context/theme.tsx
|
|
2861
|
-
var
|
|
2910
|
+
var import_react22 = require("react");
|
|
2862
2911
|
|
|
2863
2912
|
// src/hooks/useTheme.ts
|
|
2864
|
-
var
|
|
2913
|
+
var import_react21 = require("react");
|
|
2865
2914
|
var THEME_KEY = "cerberus-theme";
|
|
2866
2915
|
var MODE_KEY = "cerberus-mode";
|
|
2867
2916
|
function useTheme(defaultTheme = "cerberus", defaultColorMode = "light", options = {}) {
|
|
2868
2917
|
const { updateMode, updateTheme, cache } = options;
|
|
2869
|
-
const [theme, setTheme] = (0,
|
|
2870
|
-
const [colorMode, setColorMode] = (0,
|
|
2871
|
-
const handleThemeChange = (0,
|
|
2918
|
+
const [theme, setTheme] = (0, import_react21.useState)(defaultTheme);
|
|
2919
|
+
const [colorMode, setColorMode] = (0, import_react21.useState)(defaultColorMode);
|
|
2920
|
+
const handleThemeChange = (0, import_react21.useCallback)(
|
|
2872
2921
|
(newTheme) => {
|
|
2873
2922
|
setTheme(newTheme);
|
|
2874
2923
|
updateTheme == null ? void 0 : updateTheme(newTheme);
|
|
2875
2924
|
},
|
|
2876
2925
|
[updateTheme]
|
|
2877
2926
|
);
|
|
2878
|
-
const handleColorModeChange = (0,
|
|
2927
|
+
const handleColorModeChange = (0, import_react21.useCallback)(
|
|
2879
2928
|
(newMode) => {
|
|
2880
2929
|
setColorMode(newMode);
|
|
2881
2930
|
updateMode == null ? void 0 : updateMode(newMode);
|
|
2882
2931
|
},
|
|
2883
2932
|
[updateMode]
|
|
2884
2933
|
);
|
|
2885
|
-
(0,
|
|
2934
|
+
(0, import_react21.useLayoutEffect)(() => {
|
|
2886
2935
|
const theme2 = localStorage.getItem(THEME_KEY);
|
|
2887
2936
|
if (theme2) {
|
|
2888
2937
|
setTheme(theme2);
|
|
2889
2938
|
}
|
|
2890
2939
|
}, []);
|
|
2891
|
-
(0,
|
|
2940
|
+
(0, import_react21.useLayoutEffect)(() => {
|
|
2892
2941
|
const mode = localStorage.getItem(MODE_KEY);
|
|
2893
2942
|
if (mode) {
|
|
2894
2943
|
setColorMode(mode);
|
|
2895
2944
|
}
|
|
2896
2945
|
}, []);
|
|
2897
|
-
(0,
|
|
2946
|
+
(0, import_react21.useEffect)(() => {
|
|
2898
2947
|
const root = document.documentElement;
|
|
2899
2948
|
root.dataset.pandaTheme = theme;
|
|
2900
2949
|
if (cache) {
|
|
2901
2950
|
localStorage.setItem(THEME_KEY, theme);
|
|
2902
2951
|
}
|
|
2903
2952
|
}, [theme, cache]);
|
|
2904
|
-
(0,
|
|
2953
|
+
(0, import_react21.useEffect)(() => {
|
|
2905
2954
|
const root = document.documentElement;
|
|
2906
2955
|
if (colorMode === "system") {
|
|
2907
2956
|
root.dataset.colorMode = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
@@ -2912,7 +2961,7 @@ function useTheme(defaultTheme = "cerberus", defaultColorMode = "light", options
|
|
|
2912
2961
|
localStorage.setItem(MODE_KEY, colorMode);
|
|
2913
2962
|
}
|
|
2914
2963
|
}, [colorMode, cache]);
|
|
2915
|
-
return (0,
|
|
2964
|
+
return (0, import_react21.useMemo)(
|
|
2916
2965
|
() => ({
|
|
2917
2966
|
theme,
|
|
2918
2967
|
mode: colorMode,
|
|
@@ -2924,8 +2973,8 @@ function useTheme(defaultTheme = "cerberus", defaultColorMode = "light", options
|
|
|
2924
2973
|
}
|
|
2925
2974
|
|
|
2926
2975
|
// src/context/theme.tsx
|
|
2927
|
-
var
|
|
2928
|
-
var ThemeContext = (0,
|
|
2976
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
2977
|
+
var ThemeContext = (0, import_react22.createContext)(
|
|
2929
2978
|
null
|
|
2930
2979
|
);
|
|
2931
2980
|
function ThemeProvider(props) {
|
|
@@ -2934,10 +2983,10 @@ function ThemeProvider(props) {
|
|
|
2934
2983
|
updateMode: props.updateMode,
|
|
2935
2984
|
updateTheme: props.updateTheme
|
|
2936
2985
|
});
|
|
2937
|
-
return /* @__PURE__ */ (0,
|
|
2986
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ThemeContext.Provider, { value: state, children: props.children });
|
|
2938
2987
|
}
|
|
2939
2988
|
function useThemeContext() {
|
|
2940
|
-
const context = (0,
|
|
2989
|
+
const context = (0, import_react22.useContext)(ThemeContext);
|
|
2941
2990
|
if (!context) {
|
|
2942
2991
|
throw new Error("useThemeContext must be used within a ThemeProvider");
|
|
2943
2992
|
}
|
|
@@ -2945,11 +2994,11 @@ function useThemeContext() {
|
|
|
2945
2994
|
}
|
|
2946
2995
|
|
|
2947
2996
|
// src/hooks/useToggle.ts
|
|
2948
|
-
var
|
|
2997
|
+
var import_react23 = require("react");
|
|
2949
2998
|
function useToggle(options) {
|
|
2950
|
-
const [checked, setChecked] = (0,
|
|
2999
|
+
const [checked, setChecked] = (0, import_react23.useState)((options == null ? void 0 : options.checked) ?? "");
|
|
2951
3000
|
const onChange = options == null ? void 0 : options.onChange;
|
|
2952
|
-
const handleChange = (0,
|
|
3001
|
+
const handleChange = (0, import_react23.useCallback)(
|
|
2953
3002
|
(e) => {
|
|
2954
3003
|
const target = e.currentTarget;
|
|
2955
3004
|
setChecked((prev) => {
|
|
@@ -2959,7 +3008,7 @@ function useToggle(options) {
|
|
|
2959
3008
|
},
|
|
2960
3009
|
[onChange]
|
|
2961
3010
|
);
|
|
2962
|
-
return (0,
|
|
3011
|
+
return (0, import_react23.useMemo)(() => ({ checked, handleChange }), [checked, handleChange]);
|
|
2963
3012
|
}
|
|
2964
3013
|
|
|
2965
3014
|
// src/utils/index.ts
|
|
@@ -2996,6 +3045,13 @@ __reExport(src_exports, require("@dnd-kit/core"), module.exports);
|
|
|
2996
3045
|
Label,
|
|
2997
3046
|
Legend,
|
|
2998
3047
|
MODE_KEY,
|
|
3048
|
+
Menu,
|
|
3049
|
+
MenuContent,
|
|
3050
|
+
MenuGroupLabel,
|
|
3051
|
+
MenuItem,
|
|
3052
|
+
MenuItemGroup,
|
|
3053
|
+
MenuSeparator,
|
|
3054
|
+
MenuTrigger,
|
|
2999
3055
|
Modal,
|
|
3000
3056
|
ModalDescription,
|
|
3001
3057
|
ModalHeader,
|