@cerberus-design/react 0.12.0-next-bd594cf → 0.12.0-next-d7d547a
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 +112 -0
- package/build/legacy/components/Tooltip.cjs +55 -0
- package/build/legacy/components/Tooltip.cjs.map +1 -0
- package/build/legacy/context/notification-center.cjs +1 -1
- package/build/legacy/context/notification-center.cjs.map +1 -1
- package/build/legacy/hooks/useDate.cjs +122 -0
- package/build/legacy/hooks/useDate.cjs.map +1 -0
- package/build/legacy/index.cjs +212 -88
- package/build/legacy/index.cjs.map +1 -1
- package/build/modern/_tsup-dts-rollup.d.ts +112 -0
- package/build/modern/{chunk-ZBMA5G54.js → chunk-7MM5KYEX.js} +4 -4
- package/build/modern/chunk-CZND26FC.js +98 -0
- package/build/modern/chunk-CZND26FC.js.map +1 -0
- package/build/modern/{chunk-3FCUTX4S.js → chunk-J4LOSTEP.js} +13 -13
- package/build/modern/{chunk-ON64MA6L.js → chunk-KFGI37CO.js} +12 -12
- package/build/modern/chunk-KML4CTMK.js +33 -0
- package/build/modern/chunk-KML4CTMK.js.map +1 -0
- package/build/modern/{chunk-PNR7ZUAR.js → chunk-KUT2YEEQ.js} +7 -7
- package/build/modern/chunk-KUT2YEEQ.js.map +1 -0
- package/build/modern/{chunk-IFD2BUUW.js → chunk-NCUHRVW2.js} +15 -15
- package/build/modern/components/FileStatus.js +2 -2
- package/build/modern/components/Tooltip.js +7 -0
- package/build/modern/components/Tooltip.js.map +1 -0
- package/build/modern/context/confirm-modal.js +5 -5
- package/build/modern/context/cta-modal.js +5 -5
- package/build/modern/context/notification-center.js +3 -3
- package/build/modern/context/prompt-modal.js +6 -6
- package/build/modern/hooks/useDate.js +14 -0
- package/build/modern/hooks/useDate.js.map +1 -0
- package/build/modern/index.js +43 -29
- package/build/modern/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Tooltip.tsx +61 -0
- package/src/context/notification-center.tsx +1 -1
- package/src/hooks/useDate.ts +164 -0
- package/src/index.ts +2 -0
- package/build/modern/chunk-PNR7ZUAR.js.map +0 -1
- /package/build/modern/{chunk-ZBMA5G54.js.map → chunk-7MM5KYEX.js.map} +0 -0
- /package/build/modern/{chunk-3FCUTX4S.js.map → chunk-J4LOSTEP.js.map} +0 -0
- /package/build/modern/{chunk-ON64MA6L.js.map → chunk-KFGI37CO.js.map} +0 -0
- /package/build/modern/{chunk-IFD2BUUW.js.map → chunk-NCUHRVW2.js.map} +0 -0
package/build/legacy/index.cjs
CHANGED
|
@@ -31,6 +31,7 @@ __export(src_exports, {
|
|
|
31
31
|
Checkbox: () => Checkbox,
|
|
32
32
|
CircularProgress: () => CircularProgress,
|
|
33
33
|
ConfirmModal: () => ConfirmModal,
|
|
34
|
+
DateFormats: () => DateFormats,
|
|
34
35
|
Droppable: () => Droppable,
|
|
35
36
|
FeatureFlag: () => FeatureFlag,
|
|
36
37
|
FeatureFlags: () => FeatureFlags,
|
|
@@ -87,15 +88,19 @@ __export(src_exports, {
|
|
|
87
88
|
Thead: () => Thead,
|
|
88
89
|
ThemeProvider: () => ThemeProvider,
|
|
89
90
|
Toggle: () => Toggle,
|
|
91
|
+
Tooltip: () => Tooltip,
|
|
90
92
|
Tr: () => Tr,
|
|
91
93
|
createNavTriggerProps: () => createNavTriggerProps,
|
|
92
94
|
defineIcons: () => defineIcons,
|
|
95
|
+
formatMilitaryDate: () => formatMilitaryDate,
|
|
96
|
+
formatMilitaryToISO: () => formatMilitaryToISO,
|
|
93
97
|
formatNotifyCount: () => formatNotifyCount,
|
|
94
98
|
getPosition: () => getPosition,
|
|
95
99
|
processStatus: () => processStatus,
|
|
96
100
|
trapFocus: () => trapFocus,
|
|
97
101
|
useCTAModal: () => useCTAModal,
|
|
98
102
|
useConfirmModal: () => useConfirmModal,
|
|
103
|
+
useDate: () => useDate,
|
|
99
104
|
useFeatureFlags: () => useFeatureFlags,
|
|
100
105
|
useFieldContext: () => useFieldContext,
|
|
101
106
|
useModal: () => useModal,
|
|
@@ -2313,9 +2318,36 @@ function Toggle(props) {
|
|
|
2313
2318
|
);
|
|
2314
2319
|
}
|
|
2315
2320
|
|
|
2321
|
+
// src/components/Tooltip.tsx
|
|
2322
|
+
var import_tooltip = require("@ark-ui/react/tooltip");
|
|
2323
|
+
var import_css41 = require("@cerberus/styled-system/css");
|
|
2324
|
+
var import_recipes33 = require("@cerberus/styled-system/recipes");
|
|
2325
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
2326
|
+
function Tooltip(props) {
|
|
2327
|
+
const { content, children, ...nativeProps } = props;
|
|
2328
|
+
const styles = (0, import_recipes33.tooltip)();
|
|
2329
|
+
const position = {
|
|
2330
|
+
placement: props.position || "top"
|
|
2331
|
+
};
|
|
2332
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_tooltip.Tooltip.Root, { openDelay: 400, positioning: position, children: [
|
|
2333
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_tooltip.Tooltip.Trigger, { className: styles.trigger, children }),
|
|
2334
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_tooltip.Tooltip.Positioner, { children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
2335
|
+
import_tooltip.Tooltip.Content,
|
|
2336
|
+
{
|
|
2337
|
+
...nativeProps,
|
|
2338
|
+
className: (0, import_css41.cx)(nativeProps.className, styles.content),
|
|
2339
|
+
children: [
|
|
2340
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_tooltip.Tooltip.Arrow, { className: styles.arrow, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_tooltip.Tooltip.ArrowTip, { className: styles.arrowTip }) }),
|
|
2341
|
+
content
|
|
2342
|
+
]
|
|
2343
|
+
}
|
|
2344
|
+
) })
|
|
2345
|
+
] });
|
|
2346
|
+
}
|
|
2347
|
+
|
|
2316
2348
|
// src/context/confirm-modal.tsx
|
|
2317
2349
|
var import_react17 = require("react");
|
|
2318
|
-
var
|
|
2350
|
+
var import_css42 = require("@cerberus/styled-system/css");
|
|
2319
2351
|
var import_patterns16 = require("@cerberus/styled-system/patterns");
|
|
2320
2352
|
|
|
2321
2353
|
// src/hooks/useModal.ts
|
|
@@ -2344,7 +2376,7 @@ function useModal() {
|
|
|
2344
2376
|
}
|
|
2345
2377
|
|
|
2346
2378
|
// src/context/confirm-modal.tsx
|
|
2347
|
-
var
|
|
2379
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
2348
2380
|
var ConfirmModalContext = (0, import_react17.createContext)(null);
|
|
2349
2381
|
function ConfirmModal(props) {
|
|
2350
2382
|
const { modalRef, show, close } = useModal();
|
|
@@ -2384,36 +2416,36 @@ function ConfirmModal(props) {
|
|
|
2384
2416
|
}),
|
|
2385
2417
|
[handleShow]
|
|
2386
2418
|
);
|
|
2387
|
-
return /* @__PURE__ */ (0,
|
|
2419
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(ConfirmModalContext.Provider, { value, children: [
|
|
2388
2420
|
props.children,
|
|
2389
|
-
/* @__PURE__ */ (0,
|
|
2390
|
-
/* @__PURE__ */ (0,
|
|
2391
|
-
/* @__PURE__ */ (0,
|
|
2421
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(Modal, { onKeyDown: focusTrap, ref: modalRef, children: [
|
|
2422
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(ModalHeader, { children: [
|
|
2423
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
2392
2424
|
"div",
|
|
2393
2425
|
{
|
|
2394
2426
|
className: (0, import_patterns16.hstack)({
|
|
2395
2427
|
justify: "center",
|
|
2396
2428
|
w: "full"
|
|
2397
2429
|
}),
|
|
2398
|
-
children: /* @__PURE__ */ (0,
|
|
2430
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
2399
2431
|
Show,
|
|
2400
2432
|
{
|
|
2401
2433
|
when: palette === "danger",
|
|
2402
|
-
fallback: /* @__PURE__ */ (0,
|
|
2434
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
2403
2435
|
Avatar,
|
|
2404
2436
|
{
|
|
2405
2437
|
ariaLabel: "",
|
|
2406
2438
|
gradient: "charon-light",
|
|
2407
|
-
icon: /* @__PURE__ */ (0,
|
|
2439
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(ConfirmIcon, { size: 24 }),
|
|
2408
2440
|
src: ""
|
|
2409
2441
|
}
|
|
2410
2442
|
),
|
|
2411
|
-
children: /* @__PURE__ */ (0,
|
|
2443
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
2412
2444
|
Avatar,
|
|
2413
2445
|
{
|
|
2414
2446
|
ariaLabel: "",
|
|
2415
2447
|
gradient: "hades-dark",
|
|
2416
|
-
icon: /* @__PURE__ */ (0,
|
|
2448
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(ConfirmIcon, { size: 24 }),
|
|
2417
2449
|
src: ""
|
|
2418
2450
|
}
|
|
2419
2451
|
)
|
|
@@ -2421,21 +2453,21 @@ function ConfirmModal(props) {
|
|
|
2421
2453
|
)
|
|
2422
2454
|
}
|
|
2423
2455
|
),
|
|
2424
|
-
/* @__PURE__ */ (0,
|
|
2425
|
-
/* @__PURE__ */ (0,
|
|
2456
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(ModalHeading, { children: content == null ? void 0 : content.heading }),
|
|
2457
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(ModalDescription, { children: content == null ? void 0 : content.description })
|
|
2426
2458
|
] }),
|
|
2427
|
-
/* @__PURE__ */ (0,
|
|
2459
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
|
|
2428
2460
|
"div",
|
|
2429
2461
|
{
|
|
2430
2462
|
className: (0, import_patterns16.hstack)({
|
|
2431
2463
|
gap: "4"
|
|
2432
2464
|
}),
|
|
2433
2465
|
children: [
|
|
2434
|
-
/* @__PURE__ */ (0,
|
|
2466
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
2435
2467
|
Button,
|
|
2436
2468
|
{
|
|
2437
2469
|
autoFocus: true,
|
|
2438
|
-
className: (0,
|
|
2470
|
+
className: (0, import_css42.css)({
|
|
2439
2471
|
w: "1/2"
|
|
2440
2472
|
}),
|
|
2441
2473
|
name: "confirm",
|
|
@@ -2445,10 +2477,10 @@ function ConfirmModal(props) {
|
|
|
2445
2477
|
children: content == null ? void 0 : content.actionText
|
|
2446
2478
|
}
|
|
2447
2479
|
),
|
|
2448
|
-
/* @__PURE__ */ (0,
|
|
2480
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
2449
2481
|
Button,
|
|
2450
2482
|
{
|
|
2451
|
-
className: (0,
|
|
2483
|
+
className: (0, import_css42.css)({
|
|
2452
2484
|
w: "1/2"
|
|
2453
2485
|
}),
|
|
2454
2486
|
name: "cancel",
|
|
@@ -2477,9 +2509,9 @@ function useConfirmModal() {
|
|
|
2477
2509
|
// src/context/cta-modal.tsx
|
|
2478
2510
|
var import_react18 = require("react");
|
|
2479
2511
|
var import_jsx = require("@cerberus/styled-system/jsx");
|
|
2480
|
-
var
|
|
2512
|
+
var import_css43 = require("@cerberus/styled-system/css");
|
|
2481
2513
|
var import_jsx2 = require("@cerberus/styled-system/jsx");
|
|
2482
|
-
var
|
|
2514
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
2483
2515
|
var CTAModalContext = (0, import_react18.createContext)(null);
|
|
2484
2516
|
function CTAModal(props) {
|
|
2485
2517
|
var _a, _b;
|
|
@@ -2519,49 +2551,49 @@ function CTAModal(props) {
|
|
|
2519
2551
|
}),
|
|
2520
2552
|
[handleShow]
|
|
2521
2553
|
);
|
|
2522
|
-
return /* @__PURE__ */ (0,
|
|
2554
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(CTAModalContext.Provider, { value, children: [
|
|
2523
2555
|
props.children,
|
|
2524
|
-
/* @__PURE__ */ (0,
|
|
2525
|
-
/* @__PURE__ */ (0,
|
|
2556
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(Modal, { onKeyDown: focusTrap, ref: modalRef, children: [
|
|
2557
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
2526
2558
|
"span",
|
|
2527
2559
|
{
|
|
2528
|
-
className: (0,
|
|
2560
|
+
className: (0, import_css43.css)({
|
|
2529
2561
|
padding: "md",
|
|
2530
2562
|
position: "absolute",
|
|
2531
2563
|
right: 0,
|
|
2532
2564
|
top: 0,
|
|
2533
2565
|
zIndex: "decorator"
|
|
2534
2566
|
}),
|
|
2535
|
-
children: /* @__PURE__ */ (0,
|
|
2567
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(IconButton, { ariaLabel: "Close modal", onClick: close, children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(CloseIcon, {}) })
|
|
2536
2568
|
}
|
|
2537
2569
|
),
|
|
2538
|
-
/* @__PURE__ */ (0,
|
|
2539
|
-
/* @__PURE__ */ (0,
|
|
2570
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(ModalHeader, { children: [
|
|
2571
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_jsx.HStack, { justify: "center", w: "full", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
2540
2572
|
Avatar,
|
|
2541
2573
|
{
|
|
2542
2574
|
ariaLabel: "",
|
|
2543
2575
|
gradient: "charon-light",
|
|
2544
|
-
icon: /* @__PURE__ */ (0,
|
|
2576
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
2545
2577
|
Show,
|
|
2546
2578
|
{
|
|
2547
2579
|
when: Boolean(confirmIcon),
|
|
2548
|
-
fallback: /* @__PURE__ */ (0,
|
|
2580
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(FallbackIcon, { size: 24 }),
|
|
2549
2581
|
children: confirmIcon
|
|
2550
2582
|
}
|
|
2551
2583
|
),
|
|
2552
2584
|
src: ""
|
|
2553
2585
|
}
|
|
2554
2586
|
) }),
|
|
2555
|
-
/* @__PURE__ */ (0,
|
|
2556
|
-
/* @__PURE__ */ (0,
|
|
2557
|
-
/* @__PURE__ */ (0,
|
|
2587
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx2.VStack, { gap: "lg", w: "full", children: [
|
|
2588
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ModalHeading, { children: content == null ? void 0 : content.heading }),
|
|
2589
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ModalDescription, { children: content == null ? void 0 : content.description })
|
|
2558
2590
|
] })
|
|
2559
2591
|
] }),
|
|
2560
|
-
/* @__PURE__ */ (0,
|
|
2592
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_jsx.HStack, { gap: "md", pt: "sm", 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)(
|
|
2561
2593
|
Button,
|
|
2562
2594
|
{
|
|
2563
2595
|
"data-index": index,
|
|
2564
|
-
className: (0,
|
|
2596
|
+
className: (0, import_css43.css)({
|
|
2565
2597
|
w: "1/2"
|
|
2566
2598
|
}),
|
|
2567
2599
|
onClick: handleActionClick,
|
|
@@ -2585,13 +2617,13 @@ function useCTAModal() {
|
|
|
2585
2617
|
// src/context/notification-center.tsx
|
|
2586
2618
|
var import_react19 = require("react");
|
|
2587
2619
|
var import_patterns17 = require("@cerberus/styled-system/patterns");
|
|
2588
|
-
var
|
|
2589
|
-
var
|
|
2590
|
-
var
|
|
2620
|
+
var import_recipes34 = require("@cerberus/styled-system/recipes");
|
|
2621
|
+
var import_css44 = require("@cerberus/styled-system/css");
|
|
2622
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
2591
2623
|
var NotificationsContext = (0, import_react19.createContext)(null);
|
|
2592
2624
|
function NotificationCenter(props) {
|
|
2593
2625
|
const [activeNotifications, setActiveNotifications] = (0, import_react19.useState)([]);
|
|
2594
|
-
const styles = (0,
|
|
2626
|
+
const styles = (0, import_recipes34.notification)();
|
|
2595
2627
|
const handleNotify = (0, import_react19.useCallback)((options) => {
|
|
2596
2628
|
setActiveNotifications((prev) => {
|
|
2597
2629
|
const id = `${options.palette}:${prev.length + 1}`;
|
|
@@ -2620,22 +2652,22 @@ function NotificationCenter(props) {
|
|
|
2620
2652
|
}),
|
|
2621
2653
|
[handleNotify]
|
|
2622
2654
|
);
|
|
2623
|
-
return /* @__PURE__ */ (0,
|
|
2655
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(NotificationsContext.Provider, { value, children: [
|
|
2624
2656
|
props.children,
|
|
2625
|
-
/* @__PURE__ */ (0,
|
|
2626
|
-
/* @__PURE__ */ (0,
|
|
2657
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Show, { when: activeNotifications.length > 0, children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Portal, { container: props.container, children: /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: styles.center, children: [
|
|
2658
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Show, { when: activeNotifications.length >= 4, children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
2627
2659
|
Button,
|
|
2628
2660
|
{
|
|
2629
|
-
className: (0,
|
|
2661
|
+
className: (0, import_css44.cx)(styles.closeAll, (0, import_patterns17.animateIn)()),
|
|
2630
2662
|
onClick: handleCloseAll,
|
|
2631
2663
|
palette: "action",
|
|
2632
2664
|
shape: "rounded",
|
|
2633
2665
|
size: "sm",
|
|
2634
|
-
usage: "
|
|
2666
|
+
usage: "ghost",
|
|
2635
2667
|
children: "Close all"
|
|
2636
2668
|
}
|
|
2637
2669
|
) }),
|
|
2638
|
-
/* @__PURE__ */ (0,
|
|
2670
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
2639
2671
|
"div",
|
|
2640
2672
|
{
|
|
2641
2673
|
className: (0, import_patterns17.vstack)({
|
|
@@ -2645,7 +2677,7 @@ function NotificationCenter(props) {
|
|
|
2645
2677
|
style: {
|
|
2646
2678
|
alignItems: "flex-end"
|
|
2647
2679
|
},
|
|
2648
|
-
children: activeNotifications.map((option) => /* @__PURE__ */ (0,
|
|
2680
|
+
children: activeNotifications.map((option) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
2649
2681
|
MatchNotification,
|
|
2650
2682
|
{
|
|
2651
2683
|
...option,
|
|
@@ -2662,7 +2694,7 @@ function MatchNotification(props) {
|
|
|
2662
2694
|
const { palette, id, onClose, heading, description } = props;
|
|
2663
2695
|
switch (palette) {
|
|
2664
2696
|
case "success":
|
|
2665
|
-
return /* @__PURE__ */ (0,
|
|
2697
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
2666
2698
|
Notification,
|
|
2667
2699
|
{
|
|
2668
2700
|
id,
|
|
@@ -2670,14 +2702,14 @@ function MatchNotification(props) {
|
|
|
2670
2702
|
open: true,
|
|
2671
2703
|
palette: "success",
|
|
2672
2704
|
children: [
|
|
2673
|
-
/* @__PURE__ */ (0,
|
|
2674
|
-
/* @__PURE__ */ (0,
|
|
2705
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(NotificationHeading, { palette: "success", children: heading }),
|
|
2706
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(NotificationDescription, { palette: "success", children: description })
|
|
2675
2707
|
]
|
|
2676
2708
|
},
|
|
2677
2709
|
id
|
|
2678
2710
|
);
|
|
2679
2711
|
case "warning":
|
|
2680
|
-
return /* @__PURE__ */ (0,
|
|
2712
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
2681
2713
|
Notification,
|
|
2682
2714
|
{
|
|
2683
2715
|
id,
|
|
@@ -2685,22 +2717,22 @@ function MatchNotification(props) {
|
|
|
2685
2717
|
open: true,
|
|
2686
2718
|
palette: "warning",
|
|
2687
2719
|
children: [
|
|
2688
|
-
/* @__PURE__ */ (0,
|
|
2689
|
-
/* @__PURE__ */ (0,
|
|
2720
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(NotificationHeading, { palette: "warning", children: heading }),
|
|
2721
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(NotificationDescription, { palette: "warning", children: description })
|
|
2690
2722
|
]
|
|
2691
2723
|
},
|
|
2692
2724
|
id
|
|
2693
2725
|
);
|
|
2694
2726
|
case "danger":
|
|
2695
|
-
return /* @__PURE__ */ (0,
|
|
2696
|
-
/* @__PURE__ */ (0,
|
|
2697
|
-
/* @__PURE__ */ (0,
|
|
2727
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(Notification, { id, onClose, open: true, palette: "danger", children: [
|
|
2728
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(NotificationHeading, { palette: "danger", children: heading }),
|
|
2729
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(NotificationDescription, { palette: "danger", children: description })
|
|
2698
2730
|
] }, id);
|
|
2699
2731
|
case "info":
|
|
2700
2732
|
default:
|
|
2701
|
-
return /* @__PURE__ */ (0,
|
|
2702
|
-
/* @__PURE__ */ (0,
|
|
2703
|
-
/* @__PURE__ */ (0,
|
|
2733
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(Notification, { id, onClose, open: true, palette: "info", children: [
|
|
2734
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(NotificationHeading, { palette: "info", children: heading }),
|
|
2735
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(NotificationDescription, { palette: "info", children: description })
|
|
2704
2736
|
] }, id);
|
|
2705
2737
|
}
|
|
2706
2738
|
}
|
|
@@ -2716,9 +2748,9 @@ function useNotificationCenter() {
|
|
|
2716
2748
|
|
|
2717
2749
|
// src/context/prompt-modal.tsx
|
|
2718
2750
|
var import_react20 = require("react");
|
|
2719
|
-
var
|
|
2751
|
+
var import_css45 = require("@cerberus/styled-system/css");
|
|
2720
2752
|
var import_patterns18 = require("@cerberus/styled-system/patterns");
|
|
2721
|
-
var
|
|
2753
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
2722
2754
|
var PromptModalContext = (0, import_react20.createContext)(null);
|
|
2723
2755
|
function PromptModal(props) {
|
|
2724
2756
|
const { modalRef, show, close } = useModal();
|
|
@@ -2768,36 +2800,36 @@ function PromptModal(props) {
|
|
|
2768
2800
|
}),
|
|
2769
2801
|
[handleShow]
|
|
2770
2802
|
);
|
|
2771
|
-
return /* @__PURE__ */ (0,
|
|
2803
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(PromptModalContext.Provider, { value, children: [
|
|
2772
2804
|
props.children,
|
|
2773
|
-
/* @__PURE__ */ (0,
|
|
2774
|
-
/* @__PURE__ */ (0,
|
|
2775
|
-
/* @__PURE__ */ (0,
|
|
2805
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(Modal, { onKeyDown: focusTrap, ref: modalRef, children: [
|
|
2806
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(ModalHeader, { children: [
|
|
2807
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
2776
2808
|
"div",
|
|
2777
2809
|
{
|
|
2778
2810
|
className: (0, import_patterns18.hstack)({
|
|
2779
2811
|
justify: "center",
|
|
2780
2812
|
w: "full"
|
|
2781
2813
|
}),
|
|
2782
|
-
children: /* @__PURE__ */ (0,
|
|
2814
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
2783
2815
|
Show,
|
|
2784
2816
|
{
|
|
2785
2817
|
when: palette === "danger",
|
|
2786
|
-
fallback: /* @__PURE__ */ (0,
|
|
2818
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
2787
2819
|
Avatar,
|
|
2788
2820
|
{
|
|
2789
2821
|
ariaLabel: "",
|
|
2790
2822
|
gradient: "charon-light",
|
|
2791
|
-
icon: /* @__PURE__ */ (0,
|
|
2823
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(PromptIcon, { size: 24 }),
|
|
2792
2824
|
src: ""
|
|
2793
2825
|
}
|
|
2794
2826
|
),
|
|
2795
|
-
children: /* @__PURE__ */ (0,
|
|
2827
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
2796
2828
|
Avatar,
|
|
2797
2829
|
{
|
|
2798
2830
|
ariaLabel: "",
|
|
2799
2831
|
gradient: "hades-dark",
|
|
2800
|
-
icon: /* @__PURE__ */ (0,
|
|
2832
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(PromptIcon, { size: 24 }),
|
|
2801
2833
|
src: ""
|
|
2802
2834
|
}
|
|
2803
2835
|
)
|
|
@@ -2805,10 +2837,10 @@ function PromptModal(props) {
|
|
|
2805
2837
|
)
|
|
2806
2838
|
}
|
|
2807
2839
|
),
|
|
2808
|
-
/* @__PURE__ */ (0,
|
|
2809
|
-
/* @__PURE__ */ (0,
|
|
2840
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ModalHeading, { children: content == null ? void 0 : content.heading }),
|
|
2841
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ModalDescription, { children: content == null ? void 0 : content.description })
|
|
2810
2842
|
] }),
|
|
2811
|
-
/* @__PURE__ */ (0,
|
|
2843
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
2812
2844
|
"div",
|
|
2813
2845
|
{
|
|
2814
2846
|
className: (0, import_patterns18.vstack)({
|
|
@@ -2816,11 +2848,11 @@ function PromptModal(props) {
|
|
|
2816
2848
|
mt: "4",
|
|
2817
2849
|
mb: "8"
|
|
2818
2850
|
}),
|
|
2819
|
-
children: /* @__PURE__ */ (0,
|
|
2820
|
-
/* @__PURE__ */ (0,
|
|
2851
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(Field, { invalid: !isValid, children: [
|
|
2852
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
2821
2853
|
Label,
|
|
2822
2854
|
{
|
|
2823
|
-
className: (0,
|
|
2855
|
+
className: (0, import_css45.css)({
|
|
2824
2856
|
gap: 1,
|
|
2825
2857
|
justifyContent: "flex-start"
|
|
2826
2858
|
}),
|
|
@@ -2828,10 +2860,10 @@ function PromptModal(props) {
|
|
|
2828
2860
|
size: "md",
|
|
2829
2861
|
children: [
|
|
2830
2862
|
"Type",
|
|
2831
|
-
/* @__PURE__ */ (0,
|
|
2863
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
2832
2864
|
"strong",
|
|
2833
2865
|
{
|
|
2834
|
-
className: (0,
|
|
2866
|
+
className: (0, import_css45.css)({
|
|
2835
2867
|
textTransform: "uppercase"
|
|
2836
2868
|
}),
|
|
2837
2869
|
children: content == null ? void 0 : content.key
|
|
@@ -2841,7 +2873,7 @@ function PromptModal(props) {
|
|
|
2841
2873
|
]
|
|
2842
2874
|
}
|
|
2843
2875
|
),
|
|
2844
|
-
/* @__PURE__ */ (0,
|
|
2876
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
2845
2877
|
Input,
|
|
2846
2878
|
{
|
|
2847
2879
|
id: "confirm",
|
|
@@ -2853,7 +2885,7 @@ function PromptModal(props) {
|
|
|
2853
2885
|
] })
|
|
2854
2886
|
}
|
|
2855
2887
|
),
|
|
2856
|
-
/* @__PURE__ */ (0,
|
|
2888
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
2857
2889
|
"div",
|
|
2858
2890
|
{
|
|
2859
2891
|
className: (0, import_patterns18.hstack)({
|
|
@@ -2861,11 +2893,11 @@ function PromptModal(props) {
|
|
|
2861
2893
|
gap: "4"
|
|
2862
2894
|
}),
|
|
2863
2895
|
children: [
|
|
2864
|
-
/* @__PURE__ */ (0,
|
|
2896
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
2865
2897
|
Button,
|
|
2866
2898
|
{
|
|
2867
2899
|
autoFocus: true,
|
|
2868
|
-
className: (0,
|
|
2900
|
+
className: (0, import_css45.css)({
|
|
2869
2901
|
w: "1/2"
|
|
2870
2902
|
}),
|
|
2871
2903
|
disabled: !isValid,
|
|
@@ -2876,10 +2908,10 @@ function PromptModal(props) {
|
|
|
2876
2908
|
children: content == null ? void 0 : content.actionText
|
|
2877
2909
|
}
|
|
2878
2910
|
),
|
|
2879
|
-
/* @__PURE__ */ (0,
|
|
2911
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
2880
2912
|
Button,
|
|
2881
2913
|
{
|
|
2882
|
-
className: (0,
|
|
2914
|
+
className: (0, import_css45.css)({
|
|
2883
2915
|
w: "1/2"
|
|
2884
2916
|
}),
|
|
2885
2917
|
name: "cancel",
|
|
@@ -2970,7 +3002,7 @@ function useTheme(defaultTheme = "cerberus", defaultColorMode = "light", options
|
|
|
2970
3002
|
}
|
|
2971
3003
|
|
|
2972
3004
|
// src/context/theme.tsx
|
|
2973
|
-
var
|
|
3005
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
2974
3006
|
var ThemeContext = (0, import_react22.createContext)(
|
|
2975
3007
|
null
|
|
2976
3008
|
);
|
|
@@ -2980,7 +3012,7 @@ function ThemeProvider(props) {
|
|
|
2980
3012
|
updateMode: props.updateMode,
|
|
2981
3013
|
updateTheme: props.updateTheme
|
|
2982
3014
|
});
|
|
2983
|
-
return /* @__PURE__ */ (0,
|
|
3015
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ThemeContext.Provider, { value: state, children: props.children });
|
|
2984
3016
|
}
|
|
2985
3017
|
function useThemeContext() {
|
|
2986
3018
|
const context = (0, import_react22.useContext)(ThemeContext);
|
|
@@ -2990,12 +3022,99 @@ function useThemeContext() {
|
|
|
2990
3022
|
return context;
|
|
2991
3023
|
}
|
|
2992
3024
|
|
|
2993
|
-
// src/hooks/
|
|
3025
|
+
// src/hooks/useDate.ts
|
|
2994
3026
|
var import_react23 = require("react");
|
|
2995
|
-
function
|
|
2996
|
-
const
|
|
3027
|
+
function useDate(options) {
|
|
3028
|
+
const initialValue = (options == null ? void 0 : options.initialValue) ?? "";
|
|
3029
|
+
const format = (options == null ? void 0 : options.format) ?? DateFormats.USMilitary;
|
|
2997
3030
|
const onChange = options == null ? void 0 : options.onChange;
|
|
3031
|
+
const [value, setValue] = (0, import_react23.useState)(initialValue);
|
|
2998
3032
|
const handleChange = (0, import_react23.useCallback)(
|
|
3033
|
+
(e) => {
|
|
3034
|
+
const newValue = formatMilitaryDate(e.currentTarget.value);
|
|
3035
|
+
if (onChange) onChange(e);
|
|
3036
|
+
setValue(newValue);
|
|
3037
|
+
},
|
|
3038
|
+
[onChange]
|
|
3039
|
+
);
|
|
3040
|
+
return (0, import_react23.useMemo)(
|
|
3041
|
+
() => ({
|
|
3042
|
+
format,
|
|
3043
|
+
value,
|
|
3044
|
+
ISO: formatMilitaryToISO(value),
|
|
3045
|
+
onChange: handleChange
|
|
3046
|
+
}),
|
|
3047
|
+
[format, value, handleChange]
|
|
3048
|
+
);
|
|
3049
|
+
}
|
|
3050
|
+
function formatMilitaryToISO(input3) {
|
|
3051
|
+
const [day, month, year] = input3.split(" ");
|
|
3052
|
+
const monthIndex = MONTHS.findIndex((m) => m.startsWith(month));
|
|
3053
|
+
const monthNum = monthIndex + 1;
|
|
3054
|
+
return `${year ?? "0000"}-${monthNum.toString().padStart(2, "0")}-${day.padStart(
|
|
3055
|
+
2,
|
|
3056
|
+
"0"
|
|
3057
|
+
)}`;
|
|
3058
|
+
}
|
|
3059
|
+
function formatMilitaryDate(input3) {
|
|
3060
|
+
let formatted = input3.toUpperCase().replace(/[^0-9A-Z]/g, "");
|
|
3061
|
+
let day = "";
|
|
3062
|
+
let month = "";
|
|
3063
|
+
let year = "";
|
|
3064
|
+
if (formatted.length >= 2) {
|
|
3065
|
+
day = formatted.replace(/[^0-9]/g, "").slice(0, 2);
|
|
3066
|
+
const dayNum = parseInt(day, 10);
|
|
3067
|
+
if (dayNum > 31) day = "31";
|
|
3068
|
+
else if (dayNum === 0) day = "01";
|
|
3069
|
+
formatted = formatted.slice(2);
|
|
3070
|
+
}
|
|
3071
|
+
if (formatted.length >= 3) {
|
|
3072
|
+
month = formatted.slice(0, 3);
|
|
3073
|
+
const monthIndex = MONTHS.findIndex((m) => m.startsWith(month));
|
|
3074
|
+
if (monthIndex !== -1) {
|
|
3075
|
+
month = MONTHS[monthIndex];
|
|
3076
|
+
} else {
|
|
3077
|
+
month = month.replace(/[^A-Z]/g, "");
|
|
3078
|
+
}
|
|
3079
|
+
formatted = formatted.slice(3);
|
|
3080
|
+
}
|
|
3081
|
+
if (formatted.length > 0) {
|
|
3082
|
+
year = formatted.slice(0, 4);
|
|
3083
|
+
}
|
|
3084
|
+
return [day, month, year].filter(Boolean).join(" ");
|
|
3085
|
+
}
|
|
3086
|
+
var DateFormats = {
|
|
3087
|
+
get ISO() {
|
|
3088
|
+
return "YYYY-MM-DD";
|
|
3089
|
+
},
|
|
3090
|
+
get USMilitary() {
|
|
3091
|
+
return "DD MMM YYYY";
|
|
3092
|
+
},
|
|
3093
|
+
get Months() {
|
|
3094
|
+
return MONTHS;
|
|
3095
|
+
}
|
|
3096
|
+
};
|
|
3097
|
+
var MONTHS = [
|
|
3098
|
+
"JAN",
|
|
3099
|
+
"FEB",
|
|
3100
|
+
"MAR",
|
|
3101
|
+
"APR",
|
|
3102
|
+
"MAY",
|
|
3103
|
+
"JUN",
|
|
3104
|
+
"JUL",
|
|
3105
|
+
"AUG",
|
|
3106
|
+
"SEP",
|
|
3107
|
+
"OCT",
|
|
3108
|
+
"NOV",
|
|
3109
|
+
"DEC"
|
|
3110
|
+
];
|
|
3111
|
+
|
|
3112
|
+
// src/hooks/useToggle.ts
|
|
3113
|
+
var import_react24 = require("react");
|
|
3114
|
+
function useToggle(options) {
|
|
3115
|
+
const [checked, setChecked] = (0, import_react24.useState)((options == null ? void 0 : options.checked) ?? "");
|
|
3116
|
+
const onChange = options == null ? void 0 : options.onChange;
|
|
3117
|
+
const handleChange = (0, import_react24.useCallback)(
|
|
2999
3118
|
(e) => {
|
|
3000
3119
|
const target = e.currentTarget;
|
|
3001
3120
|
setChecked((prev) => {
|
|
@@ -3005,7 +3124,7 @@ function useToggle(options) {
|
|
|
3005
3124
|
},
|
|
3006
3125
|
[onChange]
|
|
3007
3126
|
);
|
|
3008
|
-
return (0,
|
|
3127
|
+
return (0, import_react24.useMemo)(() => ({ checked, handleChange }), [checked, handleChange]);
|
|
3009
3128
|
}
|
|
3010
3129
|
|
|
3011
3130
|
// src/utils/index.ts
|
|
@@ -3028,6 +3147,7 @@ __reExport(src_exports, require("@dnd-kit/core"), module.exports);
|
|
|
3028
3147
|
Checkbox,
|
|
3029
3148
|
CircularProgress,
|
|
3030
3149
|
ConfirmModal,
|
|
3150
|
+
DateFormats,
|
|
3031
3151
|
Droppable,
|
|
3032
3152
|
FeatureFlag,
|
|
3033
3153
|
FeatureFlags,
|
|
@@ -3084,15 +3204,19 @@ __reExport(src_exports, require("@dnd-kit/core"), module.exports);
|
|
|
3084
3204
|
Thead,
|
|
3085
3205
|
ThemeProvider,
|
|
3086
3206
|
Toggle,
|
|
3207
|
+
Tooltip,
|
|
3087
3208
|
Tr,
|
|
3088
3209
|
createNavTriggerProps,
|
|
3089
3210
|
defineIcons,
|
|
3211
|
+
formatMilitaryDate,
|
|
3212
|
+
formatMilitaryToISO,
|
|
3090
3213
|
formatNotifyCount,
|
|
3091
3214
|
getPosition,
|
|
3092
3215
|
processStatus,
|
|
3093
3216
|
trapFocus,
|
|
3094
3217
|
useCTAModal,
|
|
3095
3218
|
useConfirmModal,
|
|
3219
|
+
useDate,
|
|
3096
3220
|
useFeatureFlags,
|
|
3097
3221
|
useFieldContext,
|
|
3098
3222
|
useModal,
|