@cerberus-design/react 0.13.2-next-61259ca → 0.14.0-next-01a1b5e
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 +103 -107
- package/build/legacy/components/Tabs.client.cjs +104 -0
- package/build/legacy/components/Tabs.client.cjs.map +1 -0
- package/build/legacy/context/tabs.cjs +53 -24
- package/build/legacy/context/tabs.cjs.map +1 -1
- package/build/legacy/index.cjs +320 -371
- package/build/legacy/index.cjs.map +1 -1
- package/build/legacy/utils/index.cjs +21 -2
- package/build/legacy/utils/index.cjs.map +1 -1
- package/build/legacy/utils/localStorage.cjs +44 -0
- package/build/legacy/utils/localStorage.cjs.map +1 -0
- package/build/modern/_tsup-dts-rollup.d.ts +103 -107
- package/build/modern/{chunk-FRWNAVDM.js → chunk-77B4HFKT.js} +4 -4
- package/build/modern/{chunk-G7AGKII3.js → chunk-BHSYQCDV.js} +4 -4
- package/build/modern/{chunk-UTGEFJ3L.js → chunk-C5EHJUS5.js} +1 -1
- package/build/modern/{chunk-UTGEFJ3L.js.map → chunk-C5EHJUS5.js.map} +1 -1
- package/build/modern/chunk-FQLMPEYX.js +18 -0
- package/build/modern/chunk-FQLMPEYX.js.map +1 -0
- package/build/modern/chunk-N7O6D7BW.js +63 -0
- package/build/modern/chunk-N7O6D7BW.js.map +1 -0
- package/build/modern/chunk-RZ7NG77U.js +77 -0
- package/build/modern/chunk-RZ7NG77U.js.map +1 -0
- package/build/modern/{chunk-ECKJGCNH.js → chunk-T6U7AKKP.js} +4 -4
- package/build/modern/components/Tabs.client.js +18 -0
- package/build/modern/context/confirm-modal.js +2 -2
- package/build/modern/context/cta-modal.js +2 -2
- package/build/modern/context/prompt-modal.js +2 -2
- package/build/modern/context/tabs.js +2 -1
- package/build/modern/index.js +42 -40
- package/build/modern/index.js.map +1 -1
- package/build/modern/utils/index.js +8 -2
- package/build/modern/utils/localStorage.js +10 -0
- package/package.json +2 -2
- package/src/components/Tabs.client.tsx +113 -0
- package/src/context/tabs.tsx +66 -65
- package/src/index.ts +1 -4
- package/src/utils/index.ts +2 -0
- package/src/utils/localStorage.ts +28 -0
- package/build/legacy/aria-helpers/tabs.aria.cjs +0 -100
- package/build/legacy/aria-helpers/tabs.aria.cjs.map +0 -1
- package/build/legacy/components/Tab.cjs +0 -135
- package/build/legacy/components/Tab.cjs.map +0 -1
- package/build/legacy/components/TabList.cjs +0 -69
- package/build/legacy/components/TabList.cjs.map +0 -1
- package/build/legacy/components/TabPanel.cjs +0 -76
- package/build/legacy/components/TabPanel.cjs.map +0 -1
- package/build/modern/aria-helpers/tabs.aria.js +0 -9
- package/build/modern/chunk-AYIRV5CL.js +0 -32
- package/build/modern/chunk-AYIRV5CL.js.map +0 -1
- package/build/modern/chunk-ITOIXNJS.js +0 -64
- package/build/modern/chunk-ITOIXNJS.js.map +0 -1
- package/build/modern/chunk-RIFQSCHT.js +0 -58
- package/build/modern/chunk-RIFQSCHT.js.map +0 -1
- package/build/modern/chunk-SLF6SIPB.js +0 -46
- package/build/modern/chunk-SLF6SIPB.js.map +0 -1
- package/build/modern/chunk-UKPF7JOB.js +0 -33
- package/build/modern/chunk-UKPF7JOB.js.map +0 -1
- package/build/modern/components/Tab.js +0 -10
- package/build/modern/components/TabList.js +0 -9
- package/build/modern/components/TabList.js.map +0 -1
- package/build/modern/components/TabPanel.js +0 -10
- package/build/modern/components/TabPanel.js.map +0 -1
- package/src/aria-helpers/tabs.aria.ts +0 -70
- package/src/components/Tab.tsx +0 -68
- package/src/components/TabList.tsx +0 -51
- package/src/components/TabPanel.tsx +0 -49
- /package/build/modern/{chunk-FRWNAVDM.js.map → chunk-77B4HFKT.js.map} +0 -0
- /package/build/modern/{chunk-G7AGKII3.js.map → chunk-BHSYQCDV.js.map} +0 -0
- /package/build/modern/{chunk-ECKJGCNH.js.map → chunk-T6U7AKKP.js.map} +0 -0
- /package/build/modern/{aria-helpers/tabs.aria.js.map → components/Tabs.client.js.map} +0 -0
- /package/build/modern/{components/Tab.js.map → utils/localStorage.js.map} +0 -0
package/build/legacy/index.cjs
CHANGED
|
@@ -99,11 +99,13 @@ __export(src_exports, {
|
|
|
99
99
|
Spinner: () => Spinner,
|
|
100
100
|
THEME_KEY: () => THEME_KEY,
|
|
101
101
|
Tab: () => Tab,
|
|
102
|
+
TabIndicator: () => TabIndicator,
|
|
102
103
|
TabList: () => TabList,
|
|
103
104
|
TabPanel: () => TabPanel,
|
|
104
105
|
Table: () => Table,
|
|
105
106
|
Tabs: () => Tabs,
|
|
106
107
|
TabsContext: () => TabsContext,
|
|
108
|
+
TabsList: () => TabsList,
|
|
107
109
|
Tag: () => Tag,
|
|
108
110
|
Tbody: () => Tbody,
|
|
109
111
|
Td: () => Td,
|
|
@@ -121,8 +123,10 @@ __export(src_exports, {
|
|
|
121
123
|
formatMilitaryDate: () => formatMilitaryDate,
|
|
122
124
|
formatMilitaryToISO: () => formatMilitaryToISO,
|
|
123
125
|
formatNotifyCount: () => formatNotifyCount,
|
|
126
|
+
getLocalStorage: () => getLocalStorage,
|
|
124
127
|
getPosition: () => getPosition,
|
|
125
128
|
processStatus: () => processStatus,
|
|
129
|
+
setLocalStorage: () => setLocalStorage,
|
|
126
130
|
trapFocus: () => trapFocus,
|
|
127
131
|
useCTAModal: () => useCTAModal,
|
|
128
132
|
useConfirmModal: () => useConfirmModal,
|
|
@@ -135,7 +139,6 @@ __export(src_exports, {
|
|
|
135
139
|
usePromptModal: () => usePromptModal,
|
|
136
140
|
useRootColors: () => useRootColors,
|
|
137
141
|
useTabsContext: () => useTabsContext,
|
|
138
|
-
useTabsKeyboardNavigation: () => useTabsKeyboardNavigation,
|
|
139
142
|
useTheme: () => useTheme,
|
|
140
143
|
useThemeContext: () => useThemeContext,
|
|
141
144
|
useToggle: () => useToggle
|
|
@@ -2256,45 +2259,75 @@ function Spinner(props) {
|
|
|
2256
2259
|
);
|
|
2257
2260
|
}
|
|
2258
2261
|
|
|
2259
|
-
// src/components/
|
|
2260
|
-
var
|
|
2262
|
+
// src/components/Tabs.client.tsx
|
|
2263
|
+
var import_tabs2 = require("@ark-ui/react/tabs");
|
|
2264
|
+
var import_css34 = require("@cerberus/styled-system/css");
|
|
2261
2265
|
|
|
2262
2266
|
// src/context/tabs.tsx
|
|
2267
|
+
var import_tabs = require("@ark-ui/react/tabs");
|
|
2263
2268
|
var import_recipes27 = require("@cerberus/styled-system/recipes");
|
|
2264
2269
|
var import_react16 = require("react");
|
|
2270
|
+
|
|
2271
|
+
// src/utils/localStorage.ts
|
|
2272
|
+
function getLocalStorage(key, defaultValue) {
|
|
2273
|
+
const value = window.localStorage.getItem(key);
|
|
2274
|
+
if (value) {
|
|
2275
|
+
return value;
|
|
2276
|
+
}
|
|
2277
|
+
return defaultValue;
|
|
2278
|
+
}
|
|
2279
|
+
function setLocalStorage(key, value) {
|
|
2280
|
+
const stringValue = typeof value === "string" ? value : JSON.stringify(value);
|
|
2281
|
+
window.localStorage.setItem(key, stringValue);
|
|
2282
|
+
}
|
|
2283
|
+
|
|
2284
|
+
// src/context/tabs.tsx
|
|
2265
2285
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
2266
2286
|
var TabsContext = (0, import_react16.createContext)(null);
|
|
2267
2287
|
function Tabs(props) {
|
|
2268
|
-
const { cache,
|
|
2269
|
-
const [activeTab, setActiveTab] = (0, import_react16.useState)(
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2288
|
+
const { cache, defaultValue, palette, uuid, ...arkProps } = props;
|
|
2289
|
+
const [activeTab, setActiveTab] = (0, import_react16.useState)(
|
|
2290
|
+
() => cache ? "" : defaultValue
|
|
2291
|
+
);
|
|
2292
|
+
const styles = (0, import_recipes27.tabs)({ palette });
|
|
2293
|
+
const cacheKey = (0, import_react16.useMemo)(
|
|
2294
|
+
() => uuid ? `cerberus-tabs-${uuid}` : "cerberus-tabs",
|
|
2295
|
+
[uuid]
|
|
2296
|
+
);
|
|
2297
|
+
const handleValueChange = (0, import_react16.useCallback)(
|
|
2298
|
+
(details) => {
|
|
2299
|
+
if (cache) {
|
|
2300
|
+
setLocalStorage(cacheKey, details.value);
|
|
2301
|
+
}
|
|
2302
|
+
setActiveTab(details.value);
|
|
2303
|
+
},
|
|
2304
|
+
[cache]
|
|
2305
|
+
);
|
|
2306
|
+
(0, import_react16.useEffect)(() => {
|
|
2307
|
+
if (cache && !activeTab) {
|
|
2308
|
+
const cachedTab = getLocalStorage(cacheKey, defaultValue ?? "");
|
|
2309
|
+
setActiveTab(cachedTab);
|
|
2310
|
+
}
|
|
2311
|
+
}, [cache, defaultValue, activeTab]);
|
|
2274
2312
|
const value = (0, import_react16.useMemo)(
|
|
2275
2313
|
() => ({
|
|
2276
|
-
tabs: tabsList,
|
|
2277
|
-
id: uuid,
|
|
2278
2314
|
active: activeTab,
|
|
2279
|
-
styles
|
|
2280
|
-
onTabUpdate: setActiveTab
|
|
2315
|
+
styles
|
|
2281
2316
|
}),
|
|
2282
|
-
[activeTab,
|
|
2317
|
+
[activeTab, palette, styles]
|
|
2283
2318
|
);
|
|
2284
|
-
(0,
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
window.localStorage.setItem(uuid, activeTab);
|
|
2319
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(TabsContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
2320
|
+
import_tabs.Tabs.Root,
|
|
2321
|
+
{
|
|
2322
|
+
...arkProps,
|
|
2323
|
+
"aria-busy": !activeTab,
|
|
2324
|
+
className: styles.root,
|
|
2325
|
+
defaultValue,
|
|
2326
|
+
onValueChange: handleValueChange,
|
|
2327
|
+
value: activeTab,
|
|
2328
|
+
children: props.children
|
|
2295
2329
|
}
|
|
2296
|
-
}
|
|
2297
|
-
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(TabsContext.Provider, { value, children: props.children });
|
|
2330
|
+
) });
|
|
2298
2331
|
}
|
|
2299
2332
|
function useTabsContext() {
|
|
2300
2333
|
const context = (0, import_react16.useContext)(TabsContext);
|
|
@@ -2304,197 +2337,110 @@ function useTabsContext() {
|
|
|
2304
2337
|
return context;
|
|
2305
2338
|
}
|
|
2306
2339
|
|
|
2307
|
-
// src/components/
|
|
2308
|
-
var
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
(0, import_react17.useEffect)(() => {
|
|
2322
|
-
const handleKeyDown = (event) => {
|
|
2323
|
-
const index = activeTab === -1 ? tabs2.current.findIndex((tab) => tab.ariaSelected === "true") : activeTab;
|
|
2324
|
-
const nextIndex = getNextIndex(index, tabs2.current.length);
|
|
2325
|
-
const prevIndex = getPrevIndex(index, tabs2.current.length);
|
|
2326
|
-
if (index === -1) return;
|
|
2327
|
-
switch (event.key) {
|
|
2328
|
-
case "ArrowLeft":
|
|
2329
|
-
event.preventDefault();
|
|
2330
|
-
setActiveTab(prevIndex);
|
|
2331
|
-
tabs2.current[prevIndex].focus();
|
|
2332
|
-
break;
|
|
2333
|
-
case "ArrowRight":
|
|
2334
|
-
event.preventDefault();
|
|
2335
|
-
setActiveTab(nextIndex);
|
|
2336
|
-
tabs2.current[nextIndex].focus();
|
|
2337
|
-
break;
|
|
2338
|
-
case "Home":
|
|
2339
|
-
event.preventDefault();
|
|
2340
|
-
setActiveTab(0);
|
|
2341
|
-
tabs2.current[0].focus();
|
|
2342
|
-
break;
|
|
2343
|
-
case "End":
|
|
2344
|
-
event.preventDefault();
|
|
2345
|
-
setActiveTab(tabs2.current.length - 1);
|
|
2346
|
-
tabs2.current[tabs2.current.length - 1].focus();
|
|
2347
|
-
break;
|
|
2348
|
-
default:
|
|
2349
|
-
break;
|
|
2350
|
-
}
|
|
2351
|
-
};
|
|
2352
|
-
document.addEventListener("keydown", handleKeyDown);
|
|
2353
|
-
return () => {
|
|
2354
|
-
document.removeEventListener("keydown", handleKeyDown);
|
|
2355
|
-
};
|
|
2356
|
-
}, [activeTab, tabs2.current]);
|
|
2357
|
-
return {
|
|
2358
|
-
ref: (tab) => {
|
|
2359
|
-
if (tab && !tabs2.current.includes(tab)) {
|
|
2360
|
-
tabs2.current.push(tab);
|
|
2361
|
-
}
|
|
2340
|
+
// src/components/Tabs.client.tsx
|
|
2341
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
2342
|
+
function TabsList(props) {
|
|
2343
|
+
const { children, ...tabsProps } = props;
|
|
2344
|
+
const { styles } = useTabsContext();
|
|
2345
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
2346
|
+
import_tabs2.Tabs.List,
|
|
2347
|
+
{
|
|
2348
|
+
...tabsProps,
|
|
2349
|
+
className: (0, import_css34.cx)(tabsProps.className, styles.list),
|
|
2350
|
+
children: [
|
|
2351
|
+
children,
|
|
2352
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TabIndicator, {})
|
|
2353
|
+
]
|
|
2362
2354
|
}
|
|
2363
|
-
|
|
2355
|
+
);
|
|
2364
2356
|
}
|
|
2365
|
-
|
|
2366
|
-
// src/components/Tab.tsx
|
|
2367
|
-
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
2357
|
+
var TabList = TabsList;
|
|
2368
2358
|
function Tab(props) {
|
|
2369
|
-
const {
|
|
2370
|
-
const { active, onTabUpdate, styles } = useTabsContext();
|
|
2371
|
-
const [isPending, startTransition] = (0, import_react18.useTransition)();
|
|
2372
|
-
const { ref } = useTabsKeyboardNavigation();
|
|
2373
|
-
const isActive = (0, import_react18.useMemo)(() => active === value, [active, value]);
|
|
2374
|
-
function handleClick(e) {
|
|
2375
|
-
var _a;
|
|
2376
|
-
(_a = props.onClick) == null ? void 0 : _a.call(props, e);
|
|
2377
|
-
startTransition(() => onTabUpdate(e.currentTarget.value));
|
|
2378
|
-
}
|
|
2359
|
+
const { styles } = useTabsContext();
|
|
2379
2360
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
2380
|
-
|
|
2361
|
+
import_tabs2.Tabs.Trigger,
|
|
2381
2362
|
{
|
|
2382
|
-
...
|
|
2383
|
-
|
|
2384
|
-
"aria-controls": `panel:${value}`,
|
|
2385
|
-
"aria-busy": isPending,
|
|
2386
|
-
"aria-selected": isActive,
|
|
2387
|
-
id: `tab:${value}`,
|
|
2388
|
-
className: (0, import_css34.cx)(nativeProps.className, styles.tab),
|
|
2389
|
-
onClick: handleClick,
|
|
2390
|
-
role: "tab",
|
|
2391
|
-
ref,
|
|
2392
|
-
value
|
|
2363
|
+
...props,
|
|
2364
|
+
className: (0, import_css34.cx)(props.className, styles.trigger)
|
|
2393
2365
|
}
|
|
2394
2366
|
);
|
|
2395
2367
|
}
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
2401
|
-
function TabList(props) {
|
|
2402
|
-
const { description, ...nativeProps } = props;
|
|
2403
|
-
const { id, styles } = useTabsContext();
|
|
2404
|
-
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
2405
|
-
"div",
|
|
2368
|
+
function TabIndicator(props) {
|
|
2369
|
+
const { styles } = useTabsContext();
|
|
2370
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
2371
|
+
import_tabs2.Tabs.Indicator,
|
|
2406
2372
|
{
|
|
2407
|
-
...
|
|
2408
|
-
|
|
2409
|
-
className: (0, import_css35.cx)(
|
|
2410
|
-
nativeProps.className,
|
|
2411
|
-
(0, import_patterns14.hstack)({
|
|
2412
|
-
gap: "0"
|
|
2413
|
-
}),
|
|
2414
|
-
styles.tabList
|
|
2415
|
-
),
|
|
2416
|
-
id: id ?? nativeProps.id,
|
|
2417
|
-
role: "tablist"
|
|
2373
|
+
...props,
|
|
2374
|
+
className: (0, import_css34.cx)(props.className, styles.indicator)
|
|
2418
2375
|
}
|
|
2419
2376
|
);
|
|
2420
2377
|
}
|
|
2421
|
-
|
|
2422
|
-
// src/components/TabPanel.tsx
|
|
2423
|
-
var import_css36 = require("@cerberus/styled-system/css");
|
|
2424
|
-
var import_react19 = require("react");
|
|
2425
|
-
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
2426
2378
|
function TabPanel(props) {
|
|
2427
|
-
const {
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Show, { when: isActive, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
2431
|
-
"div",
|
|
2379
|
+
const { styles } = useTabsContext();
|
|
2380
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
2381
|
+
import_tabs2.Tabs.Content,
|
|
2432
2382
|
{
|
|
2433
|
-
...
|
|
2434
|
-
|
|
2435
|
-
"aria-labelledby": `tab:${tab}`,
|
|
2436
|
-
className: (0, import_css36.cx)(nativeProps.className, styles.tabPanel),
|
|
2437
|
-
id: `panel:${tab}`,
|
|
2438
|
-
role: "tabpanel"
|
|
2383
|
+
...props,
|
|
2384
|
+
className: (0, import_css34.cx)(props.className, styles.content)
|
|
2439
2385
|
}
|
|
2440
|
-
)
|
|
2386
|
+
);
|
|
2441
2387
|
}
|
|
2442
2388
|
|
|
2443
2389
|
// src/components/Table.tsx
|
|
2444
|
-
var
|
|
2390
|
+
var import_css35 = require("@cerberus/styled-system/css");
|
|
2445
2391
|
var import_recipes28 = require("@cerberus/styled-system/recipes");
|
|
2446
|
-
var
|
|
2392
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
2447
2393
|
function Table(props) {
|
|
2448
2394
|
const { caption, children, ...nativeProps } = props;
|
|
2449
2395
|
const styles = (0, import_recipes28.table)();
|
|
2450
|
-
return /* @__PURE__ */ (0,
|
|
2396
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: styles.container, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
2451
2397
|
"table",
|
|
2452
2398
|
{
|
|
2453
2399
|
...nativeProps,
|
|
2454
|
-
className: (0,
|
|
2400
|
+
className: (0, import_css35.cx)(nativeProps.className, styles.table),
|
|
2455
2401
|
children: [
|
|
2456
|
-
/* @__PURE__ */ (0,
|
|
2402
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("caption", { className: styles.caption, children: caption }),
|
|
2457
2403
|
children
|
|
2458
2404
|
]
|
|
2459
2405
|
}
|
|
2460
2406
|
) });
|
|
2461
2407
|
}
|
|
2462
2408
|
function Tr(props) {
|
|
2463
|
-
return /* @__PURE__ */ (0,
|
|
2409
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("tr", { ...props });
|
|
2464
2410
|
}
|
|
2465
2411
|
|
|
2466
2412
|
// src/components/Thead.tsx
|
|
2467
|
-
var
|
|
2413
|
+
var import_css36 = require("@cerberus/styled-system/css");
|
|
2468
2414
|
var import_recipes29 = require("@cerberus/styled-system/recipes");
|
|
2469
|
-
var
|
|
2415
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
2470
2416
|
function Thead(props) {
|
|
2471
|
-
return /* @__PURE__ */ (0,
|
|
2417
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("thead", { ...props, className: (0, import_css36.cx)(props.className, (0, import_recipes29.thead)()) });
|
|
2472
2418
|
}
|
|
2473
2419
|
|
|
2474
2420
|
// src/components/Th.tsx
|
|
2475
|
-
var
|
|
2421
|
+
var import_css37 = require("@cerberus/styled-system/css");
|
|
2476
2422
|
var import_recipes30 = require("@cerberus/styled-system/recipes");
|
|
2477
|
-
var
|
|
2423
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
2478
2424
|
function Th(props) {
|
|
2479
2425
|
const { size, onClick, ...nativeProps } = props;
|
|
2480
|
-
return /* @__PURE__ */ (0,
|
|
2426
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
2481
2427
|
Show,
|
|
2482
2428
|
{
|
|
2483
2429
|
when: Boolean(onClick),
|
|
2484
|
-
fallback: /* @__PURE__ */ (0,
|
|
2430
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
2485
2431
|
"th",
|
|
2486
2432
|
{
|
|
2487
2433
|
...nativeProps,
|
|
2488
|
-
className: (0,
|
|
2434
|
+
className: (0, import_css37.cx)(nativeProps.className, (0, import_recipes30.th)({ size }))
|
|
2489
2435
|
}
|
|
2490
2436
|
),
|
|
2491
|
-
children: /* @__PURE__ */ (0,
|
|
2437
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("th", { ...nativeProps, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
2492
2438
|
"button",
|
|
2493
2439
|
{
|
|
2494
|
-
className: (0,
|
|
2440
|
+
className: (0, import_css37.cx)(
|
|
2495
2441
|
nativeProps.className,
|
|
2496
2442
|
(0, import_recipes30.th)({ size }),
|
|
2497
|
-
(0,
|
|
2443
|
+
(0, import_css37.css)({
|
|
2498
2444
|
alignItems: "center",
|
|
2499
2445
|
display: "inline-flex",
|
|
2500
2446
|
justifyContent: "space-between",
|
|
@@ -2514,16 +2460,16 @@ function Th(props) {
|
|
|
2514
2460
|
}
|
|
2515
2461
|
|
|
2516
2462
|
// src/components/Td.tsx
|
|
2517
|
-
var
|
|
2463
|
+
var import_css38 = require("@cerberus/styled-system/css");
|
|
2518
2464
|
var import_recipes31 = require("@cerberus/styled-system/recipes");
|
|
2519
|
-
var
|
|
2465
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
2520
2466
|
function Td(props) {
|
|
2521
2467
|
const { size, ...nativeProps } = props;
|
|
2522
|
-
return /* @__PURE__ */ (0,
|
|
2468
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
2523
2469
|
"td",
|
|
2524
2470
|
{
|
|
2525
2471
|
...nativeProps,
|
|
2526
|
-
className: (0,
|
|
2472
|
+
className: (0, import_css38.cx)(
|
|
2527
2473
|
nativeProps.className,
|
|
2528
2474
|
(0, import_recipes31.td)({
|
|
2529
2475
|
size
|
|
@@ -2535,15 +2481,15 @@ function Td(props) {
|
|
|
2535
2481
|
|
|
2536
2482
|
// src/components/Tbody.tsx
|
|
2537
2483
|
var import_recipes32 = require("@cerberus/styled-system/recipes");
|
|
2538
|
-
var
|
|
2539
|
-
var
|
|
2484
|
+
var import_css39 = require("@cerberus/styled-system/css");
|
|
2485
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
2540
2486
|
function Tbody(props) {
|
|
2541
2487
|
const { decoration, ...nativeProps } = props;
|
|
2542
|
-
return /* @__PURE__ */ (0,
|
|
2488
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
2543
2489
|
"tbody",
|
|
2544
2490
|
{
|
|
2545
2491
|
...nativeProps,
|
|
2546
|
-
className: (0,
|
|
2492
|
+
className: (0, import_css39.cx)(
|
|
2547
2493
|
nativeProps.className,
|
|
2548
2494
|
(0, import_recipes32.tbody)({
|
|
2549
2495
|
decoration
|
|
@@ -2554,9 +2500,9 @@ function Tbody(props) {
|
|
|
2554
2500
|
}
|
|
2555
2501
|
|
|
2556
2502
|
// src/components/Tag.tsx
|
|
2557
|
-
var
|
|
2503
|
+
var import_css40 = require("@cerberus/styled-system/css");
|
|
2558
2504
|
var import_recipes33 = require("@cerberus/styled-system/recipes");
|
|
2559
|
-
var
|
|
2505
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
2560
2506
|
function Tag(props) {
|
|
2561
2507
|
const { shape: initShape, gradient, onClick, usage, ...nativeProps } = props;
|
|
2562
2508
|
const palette = (props == null ? void 0 : props.palette) ?? "page";
|
|
@@ -2564,11 +2510,11 @@ function Tag(props) {
|
|
|
2564
2510
|
const shape = isClosable ? "pill" : initShape;
|
|
2565
2511
|
const closableStyles = isClosable ? closableCss : "";
|
|
2566
2512
|
const { close: Close2 } = $cerberusIcons;
|
|
2567
|
-
return /* @__PURE__ */ (0,
|
|
2513
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
2568
2514
|
"span",
|
|
2569
2515
|
{
|
|
2570
2516
|
...nativeProps,
|
|
2571
|
-
className: (0,
|
|
2517
|
+
className: (0, import_css40.cx)(
|
|
2572
2518
|
nativeProps.className,
|
|
2573
2519
|
(0, import_recipes33.tag)({
|
|
2574
2520
|
gradient,
|
|
@@ -2580,7 +2526,7 @@ function Tag(props) {
|
|
|
2580
2526
|
),
|
|
2581
2527
|
children: [
|
|
2582
2528
|
props.children,
|
|
2583
|
-
/* @__PURE__ */ (0,
|
|
2529
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Show, { when: isClosable, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
2584
2530
|
"button",
|
|
2585
2531
|
{
|
|
2586
2532
|
"aria-label": "Close",
|
|
@@ -2590,14 +2536,14 @@ function Tag(props) {
|
|
|
2590
2536
|
size: "sm"
|
|
2591
2537
|
}),
|
|
2592
2538
|
onClick,
|
|
2593
|
-
children: /* @__PURE__ */ (0,
|
|
2539
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Close2, {})
|
|
2594
2540
|
}
|
|
2595
2541
|
) })
|
|
2596
2542
|
]
|
|
2597
2543
|
}
|
|
2598
2544
|
);
|
|
2599
2545
|
}
|
|
2600
|
-
var closableCss = (0,
|
|
2546
|
+
var closableCss = (0, import_css40.css)({
|
|
2601
2547
|
bgColor: "action.bg.active",
|
|
2602
2548
|
color: "action.text.initial",
|
|
2603
2549
|
paddingInlineEnd: "0"
|
|
@@ -2605,53 +2551,53 @@ var closableCss = (0, import_css42.css)({
|
|
|
2605
2551
|
|
|
2606
2552
|
// src/components/Text.tsx
|
|
2607
2553
|
var import_jsx = require("@cerberus-design/styled-system/jsx");
|
|
2608
|
-
var
|
|
2554
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
2609
2555
|
function Text(props) {
|
|
2610
2556
|
const { as = "p", ...pandaJSXProps } = props;
|
|
2611
2557
|
switch (as) {
|
|
2612
2558
|
case "h1":
|
|
2613
|
-
return /* @__PURE__ */ (0,
|
|
2559
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_jsx.H1, { ...pandaJSXProps });
|
|
2614
2560
|
case "h2":
|
|
2615
|
-
return /* @__PURE__ */ (0,
|
|
2561
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_jsx.H2, { ...pandaJSXProps });
|
|
2616
2562
|
case "h3":
|
|
2617
|
-
return /* @__PURE__ */ (0,
|
|
2563
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_jsx.H3, { ...pandaJSXProps });
|
|
2618
2564
|
case "h4":
|
|
2619
|
-
return /* @__PURE__ */ (0,
|
|
2565
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_jsx.H4, { ...pandaJSXProps });
|
|
2620
2566
|
case "h5":
|
|
2621
|
-
return /* @__PURE__ */ (0,
|
|
2567
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_jsx.H5, { ...pandaJSXProps });
|
|
2622
2568
|
case "h6":
|
|
2623
|
-
return /* @__PURE__ */ (0,
|
|
2569
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_jsx.H6, { ...pandaJSXProps });
|
|
2624
2570
|
case "strong":
|
|
2625
|
-
return /* @__PURE__ */ (0,
|
|
2571
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_jsx.Strong, { ...pandaJSXProps });
|
|
2626
2572
|
case "em":
|
|
2627
|
-
return /* @__PURE__ */ (0,
|
|
2573
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_jsx.Em, { ...pandaJSXProps });
|
|
2628
2574
|
case "small":
|
|
2629
|
-
return /* @__PURE__ */ (0,
|
|
2575
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_jsx.Small, { ...pandaJSXProps });
|
|
2630
2576
|
case "span":
|
|
2631
|
-
return /* @__PURE__ */ (0,
|
|
2577
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_jsx.Span, { ...pandaJSXProps });
|
|
2632
2578
|
default:
|
|
2633
|
-
return /* @__PURE__ */ (0,
|
|
2579
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_jsx.P, { ...pandaJSXProps });
|
|
2634
2580
|
}
|
|
2635
2581
|
}
|
|
2636
2582
|
|
|
2637
2583
|
// src/components/Textarea.tsx
|
|
2638
|
-
var
|
|
2584
|
+
var import_css41 = require("@cerberus/styled-system/css");
|
|
2639
2585
|
var import_recipes34 = require("@cerberus/styled-system/recipes");
|
|
2640
|
-
var
|
|
2586
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
2641
2587
|
function Textarea(props) {
|
|
2642
2588
|
const { describedBy, ...nativeProps } = props;
|
|
2643
2589
|
const { invalid, ...fieldState } = useFieldContext();
|
|
2644
|
-
return /* @__PURE__ */ (0,
|
|
2590
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
2645
2591
|
"textarea",
|
|
2646
2592
|
{
|
|
2647
2593
|
...nativeProps,
|
|
2648
2594
|
...fieldState,
|
|
2649
2595
|
...describedBy && { "aria-describedby": describedBy },
|
|
2650
2596
|
...invalid && { "aria-invalid": true },
|
|
2651
|
-
className: (0,
|
|
2597
|
+
className: (0, import_css41.cx)(
|
|
2652
2598
|
props.className,
|
|
2653
2599
|
(0, import_recipes34.input)().input,
|
|
2654
|
-
(0,
|
|
2600
|
+
(0, import_css41.css)({
|
|
2655
2601
|
pxi: "2",
|
|
2656
2602
|
py: "2",
|
|
2657
2603
|
resize: "vertical"
|
|
@@ -2663,43 +2609,43 @@ function Textarea(props) {
|
|
|
2663
2609
|
}
|
|
2664
2610
|
|
|
2665
2611
|
// src/components/Toggle.tsx
|
|
2666
|
-
var
|
|
2667
|
-
var
|
|
2612
|
+
var import_css42 = require("@cerberus/styled-system/css");
|
|
2613
|
+
var import_patterns14 = require("@cerberus/styled-system/patterns");
|
|
2668
2614
|
var import_recipes35 = require("@cerberus/styled-system/recipes");
|
|
2669
|
-
var
|
|
2615
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
2670
2616
|
function Toggle(props) {
|
|
2671
2617
|
const { size, describedBy, ...nativeProps } = props;
|
|
2672
2618
|
const styles = (0, import_recipes35.toggle)({ size });
|
|
2673
2619
|
const { invalid, ...state } = useFieldContext();
|
|
2674
2620
|
const Icon = $cerberusIcons.toggleChecked;
|
|
2675
|
-
return /* @__PURE__ */ (0,
|
|
2621
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
|
|
2676
2622
|
"span",
|
|
2677
2623
|
{
|
|
2678
|
-
className: (0,
|
|
2624
|
+
className: (0, import_css42.cx)("group", styles.track, (0, import_patterns14.hstack)()),
|
|
2679
2625
|
"data-checked": props.checked || props.defaultChecked,
|
|
2680
2626
|
children: [
|
|
2681
|
-
/* @__PURE__ */ (0,
|
|
2627
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
2682
2628
|
"input",
|
|
2683
2629
|
{
|
|
2684
2630
|
...nativeProps,
|
|
2685
2631
|
...state,
|
|
2686
2632
|
...describedBy && { "aria-describedby": describedBy },
|
|
2687
2633
|
...invalid && { "aria-invalid": true },
|
|
2688
|
-
className: (0,
|
|
2634
|
+
className: (0, import_css42.cx)("peer", styles.input),
|
|
2689
2635
|
role: "switch",
|
|
2690
2636
|
type: "checkbox"
|
|
2691
2637
|
}
|
|
2692
2638
|
),
|
|
2693
|
-
/* @__PURE__ */ (0,
|
|
2639
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
2694
2640
|
"span",
|
|
2695
2641
|
{
|
|
2696
|
-
className: (0,
|
|
2642
|
+
className: (0, import_css42.cx)(
|
|
2697
2643
|
styles.thumb,
|
|
2698
|
-
(0,
|
|
2644
|
+
(0, import_patterns14.vstack)({
|
|
2699
2645
|
justify: "center"
|
|
2700
2646
|
})
|
|
2701
2647
|
),
|
|
2702
|
-
children: /* @__PURE__ */ (0,
|
|
2648
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Icon, {})
|
|
2703
2649
|
}
|
|
2704
2650
|
)
|
|
2705
2651
|
]
|
|
@@ -2709,24 +2655,24 @@ function Toggle(props) {
|
|
|
2709
2655
|
|
|
2710
2656
|
// src/components/Tooltip.tsx
|
|
2711
2657
|
var import_tooltip = require("@ark-ui/react/tooltip");
|
|
2712
|
-
var
|
|
2658
|
+
var import_css43 = require("@cerberus/styled-system/css");
|
|
2713
2659
|
var import_recipes36 = require("@cerberus/styled-system/recipes");
|
|
2714
|
-
var
|
|
2660
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
2715
2661
|
function Tooltip(props) {
|
|
2716
2662
|
const { content, children, asChild, ...nativeProps } = props;
|
|
2717
2663
|
const styles = (0, import_recipes36.tooltip)();
|
|
2718
2664
|
const position = {
|
|
2719
2665
|
placement: props.position || "top"
|
|
2720
2666
|
};
|
|
2721
|
-
return /* @__PURE__ */ (0,
|
|
2722
|
-
/* @__PURE__ */ (0,
|
|
2723
|
-
/* @__PURE__ */ (0,
|
|
2667
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_tooltip.Tooltip.Root, { openDelay: 400, positioning: position, children: [
|
|
2668
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_tooltip.Tooltip.Trigger, { className: styles.trigger, asChild, children }),
|
|
2669
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_tooltip.Tooltip.Positioner, { children: /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
2724
2670
|
import_tooltip.Tooltip.Content,
|
|
2725
2671
|
{
|
|
2726
2672
|
...nativeProps,
|
|
2727
|
-
className: (0,
|
|
2673
|
+
className: (0, import_css43.cx)(nativeProps.className, styles.content),
|
|
2728
2674
|
children: [
|
|
2729
|
-
/* @__PURE__ */ (0,
|
|
2675
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_tooltip.Tooltip.Arrow, { className: styles.arrow, children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_tooltip.Tooltip.ArrowTip, { className: styles.arrowTip }) }),
|
|
2730
2676
|
content
|
|
2731
2677
|
]
|
|
2732
2678
|
}
|
|
@@ -2735,26 +2681,26 @@ function Tooltip(props) {
|
|
|
2735
2681
|
}
|
|
2736
2682
|
|
|
2737
2683
|
// src/context/confirm-modal.tsx
|
|
2738
|
-
var
|
|
2739
|
-
var
|
|
2740
|
-
var
|
|
2684
|
+
var import_react18 = require("react");
|
|
2685
|
+
var import_css44 = require("@cerberus/styled-system/css");
|
|
2686
|
+
var import_patterns15 = require("@cerberus/styled-system/patterns");
|
|
2741
2687
|
|
|
2742
2688
|
// src/hooks/useModal.ts
|
|
2743
|
-
var
|
|
2689
|
+
var import_react17 = require("react");
|
|
2744
2690
|
function useModal() {
|
|
2745
|
-
const modalRef = (0,
|
|
2746
|
-
const [isOpen, setIsOpen] = (0,
|
|
2747
|
-
const show = (0,
|
|
2691
|
+
const modalRef = (0, import_react17.useRef)(null);
|
|
2692
|
+
const [isOpen, setIsOpen] = (0, import_react17.useState)(false);
|
|
2693
|
+
const show = (0, import_react17.useCallback)(() => {
|
|
2748
2694
|
var _a;
|
|
2749
2695
|
(_a = modalRef.current) == null ? void 0 : _a.showModal();
|
|
2750
2696
|
setIsOpen(true);
|
|
2751
2697
|
}, []);
|
|
2752
|
-
const close = (0,
|
|
2698
|
+
const close = (0, import_react17.useCallback)(() => {
|
|
2753
2699
|
var _a;
|
|
2754
2700
|
(_a = modalRef.current) == null ? void 0 : _a.close();
|
|
2755
2701
|
setIsOpen(false);
|
|
2756
2702
|
}, []);
|
|
2757
|
-
return (0,
|
|
2703
|
+
return (0, import_react17.useMemo)(() => {
|
|
2758
2704
|
return {
|
|
2759
2705
|
modalRef,
|
|
2760
2706
|
show,
|
|
@@ -2766,20 +2712,20 @@ function useModal() {
|
|
|
2766
2712
|
|
|
2767
2713
|
// src/context/confirm-modal.tsx
|
|
2768
2714
|
var import_jsx2 = require("@cerberus/styled-system/jsx");
|
|
2769
|
-
var
|
|
2770
|
-
var ConfirmModalContext = (0,
|
|
2715
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
2716
|
+
var ConfirmModalContext = (0, import_react18.createContext)(null);
|
|
2771
2717
|
function ConfirmModal(props) {
|
|
2772
2718
|
const { modalRef, show, close } = useModal();
|
|
2773
|
-
const resolveRef = (0,
|
|
2774
|
-
const [content, setContent] = (0,
|
|
2719
|
+
const resolveRef = (0, import_react18.useRef)(null);
|
|
2720
|
+
const [content, setContent] = (0, import_react18.useState)(null);
|
|
2775
2721
|
const focusTrap = trapFocus(modalRef);
|
|
2776
2722
|
const ConfirmIcon = $cerberusIcons.confirmModal;
|
|
2777
2723
|
const kind = (content == null ? void 0 : content.kind) ?? "non-destructive";
|
|
2778
|
-
const palette = (0,
|
|
2724
|
+
const palette = (0, import_react18.useMemo)(
|
|
2779
2725
|
() => kind === "destructive" ? "danger" : "action",
|
|
2780
2726
|
[kind]
|
|
2781
2727
|
);
|
|
2782
|
-
const handleChoice = (0,
|
|
2728
|
+
const handleChoice = (0, import_react18.useCallback)(
|
|
2783
2729
|
(e) => {
|
|
2784
2730
|
var _a, _b;
|
|
2785
2731
|
const target = e.currentTarget;
|
|
@@ -2791,7 +2737,7 @@ function ConfirmModal(props) {
|
|
|
2791
2737
|
},
|
|
2792
2738
|
[close]
|
|
2793
2739
|
);
|
|
2794
|
-
const handleShow = (0,
|
|
2740
|
+
const handleShow = (0, import_react18.useCallback)(
|
|
2795
2741
|
(options) => {
|
|
2796
2742
|
return new Promise((resolve) => {
|
|
2797
2743
|
setContent({ ...options });
|
|
@@ -2801,42 +2747,42 @@ function ConfirmModal(props) {
|
|
|
2801
2747
|
},
|
|
2802
2748
|
[show]
|
|
2803
2749
|
);
|
|
2804
|
-
const value = (0,
|
|
2750
|
+
const value = (0, import_react18.useMemo)(
|
|
2805
2751
|
() => ({
|
|
2806
2752
|
show: handleShow
|
|
2807
2753
|
}),
|
|
2808
2754
|
[handleShow]
|
|
2809
2755
|
);
|
|
2810
|
-
return /* @__PURE__ */ (0,
|
|
2756
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(ConfirmModalContext.Provider, { value, children: [
|
|
2811
2757
|
props.children,
|
|
2812
|
-
/* @__PURE__ */ (0,
|
|
2813
|
-
/* @__PURE__ */ (0,
|
|
2814
|
-
/* @__PURE__ */ (0,
|
|
2758
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Modal, { onKeyDown: focusTrap, ref: modalRef, children: /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_jsx2.VStack, { gap: "xl", w: "full", children: [
|
|
2759
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(ModalHeader, { children: [
|
|
2760
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
2815
2761
|
"div",
|
|
2816
2762
|
{
|
|
2817
|
-
className: (0,
|
|
2763
|
+
className: (0, import_patterns15.hstack)({
|
|
2818
2764
|
justify: "center",
|
|
2819
2765
|
w: "full"
|
|
2820
2766
|
}),
|
|
2821
|
-
children: /* @__PURE__ */ (0,
|
|
2767
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
2822
2768
|
Show,
|
|
2823
2769
|
{
|
|
2824
2770
|
when: palette === "danger",
|
|
2825
|
-
fallback: /* @__PURE__ */ (0,
|
|
2771
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
2826
2772
|
Avatar,
|
|
2827
2773
|
{
|
|
2828
2774
|
ariaLabel: "",
|
|
2829
2775
|
gradient: "charon-light",
|
|
2830
|
-
icon: /* @__PURE__ */ (0,
|
|
2776
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ConfirmIcon, { size: 24 }),
|
|
2831
2777
|
src: ""
|
|
2832
2778
|
}
|
|
2833
2779
|
),
|
|
2834
|
-
children: /* @__PURE__ */ (0,
|
|
2780
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
2835
2781
|
Avatar,
|
|
2836
2782
|
{
|
|
2837
2783
|
ariaLabel: "",
|
|
2838
2784
|
gradient: "hades-dark",
|
|
2839
|
-
icon: /* @__PURE__ */ (0,
|
|
2785
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ConfirmIcon, { size: 24 }),
|
|
2840
2786
|
src: ""
|
|
2841
2787
|
}
|
|
2842
2788
|
)
|
|
@@ -2844,15 +2790,15 @@ function ConfirmModal(props) {
|
|
|
2844
2790
|
)
|
|
2845
2791
|
}
|
|
2846
2792
|
),
|
|
2847
|
-
/* @__PURE__ */ (0,
|
|
2848
|
-
/* @__PURE__ */ (0,
|
|
2793
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ModalHeading, { children: content == null ? void 0 : content.heading }),
|
|
2794
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ModalDescription, { children: content == null ? void 0 : content.description })
|
|
2849
2795
|
] }),
|
|
2850
|
-
/* @__PURE__ */ (0,
|
|
2851
|
-
/* @__PURE__ */ (0,
|
|
2796
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_jsx2.HStack, { gap: "4", w: "full", children: [
|
|
2797
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
2852
2798
|
Button,
|
|
2853
2799
|
{
|
|
2854
2800
|
autoFocus: true,
|
|
2855
|
-
className: (0,
|
|
2801
|
+
className: (0, import_css44.css)({
|
|
2856
2802
|
w: "1/2"
|
|
2857
2803
|
}),
|
|
2858
2804
|
name: "confirm",
|
|
@@ -2862,10 +2808,10 @@ function ConfirmModal(props) {
|
|
|
2862
2808
|
children: content == null ? void 0 : content.actionText
|
|
2863
2809
|
}
|
|
2864
2810
|
),
|
|
2865
|
-
/* @__PURE__ */ (0,
|
|
2811
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
2866
2812
|
Button,
|
|
2867
2813
|
{
|
|
2868
|
-
className: (0,
|
|
2814
|
+
className: (0, import_css44.css)({
|
|
2869
2815
|
w: "1/2"
|
|
2870
2816
|
}),
|
|
2871
2817
|
name: "cancel",
|
|
@@ -2880,7 +2826,7 @@ function ConfirmModal(props) {
|
|
|
2880
2826
|
] });
|
|
2881
2827
|
}
|
|
2882
2828
|
function useConfirmModal() {
|
|
2883
|
-
const context = (0,
|
|
2829
|
+
const context = (0, import_react18.useContext)(ConfirmModalContext);
|
|
2884
2830
|
if (context === null) {
|
|
2885
2831
|
throw new Error(
|
|
2886
2832
|
"useConfirmModal must be used within a ConfirmModal Provider"
|
|
@@ -2890,21 +2836,21 @@ function useConfirmModal() {
|
|
|
2890
2836
|
}
|
|
2891
2837
|
|
|
2892
2838
|
// src/context/cta-modal.tsx
|
|
2893
|
-
var
|
|
2839
|
+
var import_react19 = require("react");
|
|
2894
2840
|
var import_jsx3 = require("@cerberus/styled-system/jsx");
|
|
2895
|
-
var
|
|
2841
|
+
var import_css45 = require("@cerberus/styled-system/css");
|
|
2896
2842
|
var import_jsx4 = require("@cerberus/styled-system/jsx");
|
|
2897
|
-
var
|
|
2898
|
-
var CTAModalContext = (0,
|
|
2843
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
2844
|
+
var CTAModalContext = (0, import_react19.createContext)(null);
|
|
2899
2845
|
function CTAModal(props) {
|
|
2900
2846
|
var _a, _b;
|
|
2901
2847
|
const { modalRef, show, close } = useModal();
|
|
2902
|
-
const [content, setContent] = (0,
|
|
2848
|
+
const [content, setContent] = (0, import_react19.useState)(null);
|
|
2903
2849
|
const focusTrap = trapFocus(modalRef);
|
|
2904
2850
|
const FallbackIcon = $cerberusIcons.confirmModal;
|
|
2905
2851
|
const confirmIcon = content == null ? void 0 : content.icon;
|
|
2906
2852
|
const { close: CloseIcon } = $cerberusIcons;
|
|
2907
|
-
const handleShow = (0,
|
|
2853
|
+
const handleShow = (0, import_react19.useCallback)(
|
|
2908
2854
|
(options) => {
|
|
2909
2855
|
const maxActions = 2;
|
|
2910
2856
|
if (options.actions.length > maxActions) {
|
|
@@ -2917,7 +2863,7 @@ function CTAModal(props) {
|
|
|
2917
2863
|
},
|
|
2918
2864
|
[show]
|
|
2919
2865
|
);
|
|
2920
|
-
const handleActionClick = (0,
|
|
2866
|
+
const handleActionClick = (0, import_react19.useCallback)(
|
|
2921
2867
|
(event) => {
|
|
2922
2868
|
const index = event.currentTarget.getAttribute("data-index");
|
|
2923
2869
|
const action = content == null ? void 0 : content.actions[Number(index)];
|
|
@@ -2927,54 +2873,54 @@ function CTAModal(props) {
|
|
|
2927
2873
|
},
|
|
2928
2874
|
[content, close]
|
|
2929
2875
|
);
|
|
2930
|
-
const value = (0,
|
|
2876
|
+
const value = (0, import_react19.useMemo)(
|
|
2931
2877
|
() => ({
|
|
2932
2878
|
show: handleShow
|
|
2933
2879
|
}),
|
|
2934
2880
|
[handleShow]
|
|
2935
2881
|
);
|
|
2936
|
-
return /* @__PURE__ */ (0,
|
|
2882
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(CTAModalContext.Provider, { value, children: [
|
|
2937
2883
|
props.children,
|
|
2938
|
-
/* @__PURE__ */ (0,
|
|
2939
|
-
/* @__PURE__ */ (0,
|
|
2884
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(Modal, { onKeyDown: focusTrap, ref: modalRef, children: [
|
|
2885
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
2940
2886
|
"span",
|
|
2941
2887
|
{
|
|
2942
|
-
className: (0,
|
|
2888
|
+
className: (0, import_css45.css)({
|
|
2943
2889
|
padding: "md",
|
|
2944
2890
|
position: "absolute",
|
|
2945
2891
|
right: 0,
|
|
2946
2892
|
top: 0,
|
|
2947
2893
|
zIndex: "decorator"
|
|
2948
2894
|
}),
|
|
2949
|
-
children: /* @__PURE__ */ (0,
|
|
2895
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(IconButton, { ariaLabel: "Close modal", onClick: close, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(CloseIcon, {}) })
|
|
2950
2896
|
}
|
|
2951
2897
|
),
|
|
2952
|
-
/* @__PURE__ */ (0,
|
|
2953
|
-
/* @__PURE__ */ (0,
|
|
2954
|
-
/* @__PURE__ */ (0,
|
|
2898
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx4.VStack, { gap: "xl", w: "full", children: [
|
|
2899
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ModalHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx4.VStack, { gap: "lg", w: "full", children: [
|
|
2900
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
2955
2901
|
Avatar,
|
|
2956
2902
|
{
|
|
2957
2903
|
ariaLabel: "",
|
|
2958
2904
|
gradient: "charon-light",
|
|
2959
|
-
icon: /* @__PURE__ */ (0,
|
|
2905
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
2960
2906
|
Show,
|
|
2961
2907
|
{
|
|
2962
2908
|
when: Boolean(confirmIcon),
|
|
2963
|
-
fallback: /* @__PURE__ */ (0,
|
|
2909
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(FallbackIcon, { size: 24 }),
|
|
2964
2910
|
children: confirmIcon
|
|
2965
2911
|
}
|
|
2966
2912
|
),
|
|
2967
2913
|
src: ""
|
|
2968
2914
|
}
|
|
2969
2915
|
),
|
|
2970
|
-
/* @__PURE__ */ (0,
|
|
2971
|
-
/* @__PURE__ */ (0,
|
|
2916
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ModalHeading, { children: content == null ? void 0 : content.heading }),
|
|
2917
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ModalDescription, { children: content == null ? void 0 : content.description })
|
|
2972
2918
|
] }) }),
|
|
2973
|
-
/* @__PURE__ */ (0,
|
|
2919
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_jsx3.HStack, { gap: "md", w: "full", children: /* @__PURE__ */ (0, import_jsx_runtime54.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_runtime54.jsx)(
|
|
2974
2920
|
Button,
|
|
2975
2921
|
{
|
|
2976
2922
|
"data-index": index,
|
|
2977
|
-
className: (0,
|
|
2923
|
+
className: (0, import_css45.css)({
|
|
2978
2924
|
w: "1/2"
|
|
2979
2925
|
}),
|
|
2980
2926
|
onClick: handleActionClick,
|
|
@@ -2989,7 +2935,7 @@ function CTAModal(props) {
|
|
|
2989
2935
|
] });
|
|
2990
2936
|
}
|
|
2991
2937
|
function useCTAModal() {
|
|
2992
|
-
const context = (0,
|
|
2938
|
+
const context = (0, import_react19.useContext)(CTAModalContext);
|
|
2993
2939
|
if (context === null) {
|
|
2994
2940
|
throw new Error("useCTAModal must be used within a CTAModal Provider");
|
|
2995
2941
|
}
|
|
@@ -2997,22 +2943,22 @@ function useCTAModal() {
|
|
|
2997
2943
|
}
|
|
2998
2944
|
|
|
2999
2945
|
// src/context/notification-center.tsx
|
|
3000
|
-
var
|
|
3001
|
-
var
|
|
2946
|
+
var import_react20 = require("react");
|
|
2947
|
+
var import_patterns16 = require("@cerberus/styled-system/patterns");
|
|
3002
2948
|
var import_recipes37 = require("@cerberus/styled-system/recipes");
|
|
3003
|
-
var
|
|
3004
|
-
var
|
|
3005
|
-
var NotificationsContext = (0,
|
|
2949
|
+
var import_css46 = require("@cerberus/styled-system/css");
|
|
2950
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
2951
|
+
var NotificationsContext = (0, import_react20.createContext)(null);
|
|
3006
2952
|
function NotificationCenter(props) {
|
|
3007
|
-
const [activeNotifications, setActiveNotifications] = (0,
|
|
2953
|
+
const [activeNotifications, setActiveNotifications] = (0, import_react20.useState)([]);
|
|
3008
2954
|
const styles = (0, import_recipes37.notification)();
|
|
3009
|
-
const handleNotify = (0,
|
|
2955
|
+
const handleNotify = (0, import_react20.useCallback)((options) => {
|
|
3010
2956
|
setActiveNotifications((prev) => {
|
|
3011
2957
|
const id = `${options.palette}:${prev.length + 1}`;
|
|
3012
2958
|
return [...prev, { ...options, id }];
|
|
3013
2959
|
});
|
|
3014
2960
|
}, []);
|
|
3015
|
-
const handleClose = (0,
|
|
2961
|
+
const handleClose = (0, import_react20.useCallback)((e) => {
|
|
3016
2962
|
const target = e.currentTarget;
|
|
3017
2963
|
setActiveNotifications((prev) => {
|
|
3018
2964
|
const item = prev.find((option) => option.id === target.value);
|
|
@@ -3020,7 +2966,7 @@ function NotificationCenter(props) {
|
|
|
3020
2966
|
return prev.filter((option) => option.id !== target.value);
|
|
3021
2967
|
});
|
|
3022
2968
|
}, []);
|
|
3023
|
-
const handleCloseAll = (0,
|
|
2969
|
+
const handleCloseAll = (0, import_react20.useCallback)(() => {
|
|
3024
2970
|
setActiveNotifications((prev) => {
|
|
3025
2971
|
prev.forEach((item) => {
|
|
3026
2972
|
if (item.onClose) item.onClose();
|
|
@@ -3028,19 +2974,19 @@ function NotificationCenter(props) {
|
|
|
3028
2974
|
return [];
|
|
3029
2975
|
});
|
|
3030
2976
|
}, []);
|
|
3031
|
-
const value = (0,
|
|
2977
|
+
const value = (0, import_react20.useMemo)(
|
|
3032
2978
|
() => ({
|
|
3033
2979
|
notify: handleNotify
|
|
3034
2980
|
}),
|
|
3035
2981
|
[handleNotify]
|
|
3036
2982
|
);
|
|
3037
|
-
return /* @__PURE__ */ (0,
|
|
2983
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(NotificationsContext.Provider, { value, children: [
|
|
3038
2984
|
props.children,
|
|
3039
|
-
/* @__PURE__ */ (0,
|
|
3040
|
-
/* @__PURE__ */ (0,
|
|
2985
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(Show, { when: activeNotifications.length > 0, children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(Portal, { container: props.container, children: /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: styles.center, children: [
|
|
2986
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(Show, { when: activeNotifications.length >= 4, children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
3041
2987
|
Button,
|
|
3042
2988
|
{
|
|
3043
|
-
className: (0,
|
|
2989
|
+
className: (0, import_css46.cx)(styles.closeAll, (0, import_patterns16.animateIn)()),
|
|
3044
2990
|
onClick: handleCloseAll,
|
|
3045
2991
|
palette: "action",
|
|
3046
2992
|
shape: "rounded",
|
|
@@ -3049,17 +2995,17 @@ function NotificationCenter(props) {
|
|
|
3049
2995
|
children: "Close all"
|
|
3050
2996
|
}
|
|
3051
2997
|
) }),
|
|
3052
|
-
/* @__PURE__ */ (0,
|
|
2998
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
3053
2999
|
"div",
|
|
3054
3000
|
{
|
|
3055
|
-
className: (0,
|
|
3001
|
+
className: (0, import_patterns16.vstack)({
|
|
3056
3002
|
alignItems: "flex-end",
|
|
3057
3003
|
gap: "4"
|
|
3058
3004
|
}),
|
|
3059
3005
|
style: {
|
|
3060
3006
|
alignItems: "flex-end"
|
|
3061
3007
|
},
|
|
3062
|
-
children: activeNotifications.map((option) => /* @__PURE__ */ (0,
|
|
3008
|
+
children: activeNotifications.map((option) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
3063
3009
|
MatchNotification,
|
|
3064
3010
|
{
|
|
3065
3011
|
...option,
|
|
@@ -3076,7 +3022,7 @@ function MatchNotification(props) {
|
|
|
3076
3022
|
const { palette, id, onClose, heading, description } = props;
|
|
3077
3023
|
switch (palette) {
|
|
3078
3024
|
case "success":
|
|
3079
|
-
return /* @__PURE__ */ (0,
|
|
3025
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
|
|
3080
3026
|
Notification,
|
|
3081
3027
|
{
|
|
3082
3028
|
id,
|
|
@@ -3084,14 +3030,14 @@ function MatchNotification(props) {
|
|
|
3084
3030
|
open: true,
|
|
3085
3031
|
palette: "success",
|
|
3086
3032
|
children: [
|
|
3087
|
-
/* @__PURE__ */ (0,
|
|
3088
|
-
/* @__PURE__ */ (0,
|
|
3033
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(NotificationHeading, { palette: "success", children: heading }),
|
|
3034
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(NotificationDescription, { palette: "success", children: description })
|
|
3089
3035
|
]
|
|
3090
3036
|
},
|
|
3091
3037
|
id
|
|
3092
3038
|
);
|
|
3093
3039
|
case "warning":
|
|
3094
|
-
return /* @__PURE__ */ (0,
|
|
3040
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
|
|
3095
3041
|
Notification,
|
|
3096
3042
|
{
|
|
3097
3043
|
id,
|
|
@@ -3099,27 +3045,27 @@ function MatchNotification(props) {
|
|
|
3099
3045
|
open: true,
|
|
3100
3046
|
palette: "warning",
|
|
3101
3047
|
children: [
|
|
3102
|
-
/* @__PURE__ */ (0,
|
|
3103
|
-
/* @__PURE__ */ (0,
|
|
3048
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(NotificationHeading, { palette: "warning", children: heading }),
|
|
3049
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(NotificationDescription, { palette: "warning", children: description })
|
|
3104
3050
|
]
|
|
3105
3051
|
},
|
|
3106
3052
|
id
|
|
3107
3053
|
);
|
|
3108
3054
|
case "danger":
|
|
3109
|
-
return /* @__PURE__ */ (0,
|
|
3110
|
-
/* @__PURE__ */ (0,
|
|
3111
|
-
/* @__PURE__ */ (0,
|
|
3055
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(Notification, { id, onClose, open: true, palette: "danger", children: [
|
|
3056
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(NotificationHeading, { palette: "danger", children: heading }),
|
|
3057
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(NotificationDescription, { palette: "danger", children: description })
|
|
3112
3058
|
] }, id);
|
|
3113
3059
|
case "info":
|
|
3114
3060
|
default:
|
|
3115
|
-
return /* @__PURE__ */ (0,
|
|
3116
|
-
/* @__PURE__ */ (0,
|
|
3117
|
-
/* @__PURE__ */ (0,
|
|
3061
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(Notification, { id, onClose, open: true, palette: "info", children: [
|
|
3062
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(NotificationHeading, { palette: "info", children: heading }),
|
|
3063
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(NotificationDescription, { palette: "info", children: description })
|
|
3118
3064
|
] }, id);
|
|
3119
3065
|
}
|
|
3120
3066
|
}
|
|
3121
3067
|
function useNotificationCenter() {
|
|
3122
|
-
const context = (0,
|
|
3068
|
+
const context = (0, import_react20.useContext)(NotificationsContext);
|
|
3123
3069
|
if (!context) {
|
|
3124
3070
|
throw new Error(
|
|
3125
3071
|
"useNotificationCenter must be used within a NotificationsProvider"
|
|
@@ -3129,33 +3075,33 @@ function useNotificationCenter() {
|
|
|
3129
3075
|
}
|
|
3130
3076
|
|
|
3131
3077
|
// src/context/prompt-modal.tsx
|
|
3132
|
-
var
|
|
3133
|
-
var
|
|
3134
|
-
var
|
|
3135
|
-
var
|
|
3136
|
-
var PromptModalContext = (0,
|
|
3078
|
+
var import_react21 = require("react");
|
|
3079
|
+
var import_css47 = require("@cerberus/styled-system/css");
|
|
3080
|
+
var import_patterns17 = require("@cerberus/styled-system/patterns");
|
|
3081
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
3082
|
+
var PromptModalContext = (0, import_react21.createContext)(null);
|
|
3137
3083
|
function PromptModal(props) {
|
|
3138
3084
|
const { modalRef, show, close } = useModal();
|
|
3139
|
-
const resolveRef = (0,
|
|
3140
|
-
const [content, setContent] = (0,
|
|
3141
|
-
const [inputValue, setInputValue] = (0,
|
|
3085
|
+
const resolveRef = (0, import_react21.useRef)(null);
|
|
3086
|
+
const [content, setContent] = (0, import_react21.useState)(null);
|
|
3087
|
+
const [inputValue, setInputValue] = (0, import_react21.useState)("");
|
|
3142
3088
|
const focusTrap = trapFocus(modalRef);
|
|
3143
3089
|
const PromptIcon = $cerberusIcons.promptModal;
|
|
3144
|
-
const isValid = (0,
|
|
3090
|
+
const isValid = (0, import_react21.useMemo)(
|
|
3145
3091
|
() => inputValue === (content == null ? void 0 : content.key),
|
|
3146
3092
|
[inputValue, content]
|
|
3147
3093
|
);
|
|
3148
|
-
const palette = (0,
|
|
3094
|
+
const palette = (0, import_react21.useMemo)(
|
|
3149
3095
|
() => (content == null ? void 0 : content.kind) === "destructive" ? "danger" : "action",
|
|
3150
3096
|
[content]
|
|
3151
3097
|
);
|
|
3152
|
-
const handleChange = (0,
|
|
3098
|
+
const handleChange = (0, import_react21.useCallback)(
|
|
3153
3099
|
(e) => {
|
|
3154
3100
|
setInputValue(e.currentTarget.value);
|
|
3155
3101
|
},
|
|
3156
3102
|
[content]
|
|
3157
3103
|
);
|
|
3158
|
-
const handleChoice = (0,
|
|
3104
|
+
const handleChoice = (0, import_react21.useCallback)(
|
|
3159
3105
|
(e) => {
|
|
3160
3106
|
var _a;
|
|
3161
3107
|
const target = e.currentTarget;
|
|
@@ -3166,7 +3112,7 @@ function PromptModal(props) {
|
|
|
3166
3112
|
},
|
|
3167
3113
|
[inputValue, close]
|
|
3168
3114
|
);
|
|
3169
|
-
const handleShow = (0,
|
|
3115
|
+
const handleShow = (0, import_react21.useCallback)(
|
|
3170
3116
|
(options) => {
|
|
3171
3117
|
return new Promise((resolve) => {
|
|
3172
3118
|
setContent({ ...options, kind: options.kind || "non-destructive" });
|
|
@@ -3176,42 +3122,42 @@ function PromptModal(props) {
|
|
|
3176
3122
|
},
|
|
3177
3123
|
[show]
|
|
3178
3124
|
);
|
|
3179
|
-
const value = (0,
|
|
3125
|
+
const value = (0, import_react21.useMemo)(
|
|
3180
3126
|
() => ({
|
|
3181
3127
|
show: handleShow
|
|
3182
3128
|
}),
|
|
3183
3129
|
[handleShow]
|
|
3184
3130
|
);
|
|
3185
|
-
return /* @__PURE__ */ (0,
|
|
3131
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(PromptModalContext.Provider, { value, children: [
|
|
3186
3132
|
props.children,
|
|
3187
|
-
/* @__PURE__ */ (0,
|
|
3188
|
-
/* @__PURE__ */ (0,
|
|
3189
|
-
/* @__PURE__ */ (0,
|
|
3133
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Modal, { onKeyDown: focusTrap, ref: modalRef, children: [
|
|
3134
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(ModalHeader, { children: [
|
|
3135
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
3190
3136
|
"div",
|
|
3191
3137
|
{
|
|
3192
|
-
className: (0,
|
|
3138
|
+
className: (0, import_patterns17.hstack)({
|
|
3193
3139
|
justify: "center",
|
|
3194
3140
|
w: "full"
|
|
3195
3141
|
}),
|
|
3196
|
-
children: /* @__PURE__ */ (0,
|
|
3142
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
3197
3143
|
Show,
|
|
3198
3144
|
{
|
|
3199
3145
|
when: palette === "danger",
|
|
3200
|
-
fallback: /* @__PURE__ */ (0,
|
|
3146
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
3201
3147
|
Avatar,
|
|
3202
3148
|
{
|
|
3203
3149
|
ariaLabel: "",
|
|
3204
3150
|
gradient: "charon-light",
|
|
3205
|
-
icon: /* @__PURE__ */ (0,
|
|
3151
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(PromptIcon, { size: 24 }),
|
|
3206
3152
|
src: ""
|
|
3207
3153
|
}
|
|
3208
3154
|
),
|
|
3209
|
-
children: /* @__PURE__ */ (0,
|
|
3155
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
3210
3156
|
Avatar,
|
|
3211
3157
|
{
|
|
3212
3158
|
ariaLabel: "",
|
|
3213
3159
|
gradient: "hades-dark",
|
|
3214
|
-
icon: /* @__PURE__ */ (0,
|
|
3160
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(PromptIcon, { size: 24 }),
|
|
3215
3161
|
src: ""
|
|
3216
3162
|
}
|
|
3217
3163
|
)
|
|
@@ -3219,22 +3165,22 @@ function PromptModal(props) {
|
|
|
3219
3165
|
)
|
|
3220
3166
|
}
|
|
3221
3167
|
),
|
|
3222
|
-
/* @__PURE__ */ (0,
|
|
3223
|
-
/* @__PURE__ */ (0,
|
|
3168
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(ModalHeading, { children: content == null ? void 0 : content.heading }),
|
|
3169
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(ModalDescription, { children: content == null ? void 0 : content.description })
|
|
3224
3170
|
] }),
|
|
3225
|
-
/* @__PURE__ */ (0,
|
|
3171
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
3226
3172
|
"div",
|
|
3227
3173
|
{
|
|
3228
|
-
className: (0,
|
|
3174
|
+
className: (0, import_patterns17.vstack)({
|
|
3229
3175
|
alignItems: "flex-start",
|
|
3230
3176
|
mt: "4",
|
|
3231
3177
|
mb: "8"
|
|
3232
3178
|
}),
|
|
3233
|
-
children: /* @__PURE__ */ (0,
|
|
3234
|
-
/* @__PURE__ */ (0,
|
|
3179
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Field, { invalid: !isValid, children: [
|
|
3180
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
3235
3181
|
Label,
|
|
3236
3182
|
{
|
|
3237
|
-
className: (0,
|
|
3183
|
+
className: (0, import_css47.css)({
|
|
3238
3184
|
gap: 1,
|
|
3239
3185
|
justifyContent: "flex-start"
|
|
3240
3186
|
}),
|
|
@@ -3242,10 +3188,10 @@ function PromptModal(props) {
|
|
|
3242
3188
|
size: "md",
|
|
3243
3189
|
children: [
|
|
3244
3190
|
"Type",
|
|
3245
|
-
/* @__PURE__ */ (0,
|
|
3191
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
3246
3192
|
"strong",
|
|
3247
3193
|
{
|
|
3248
|
-
className: (0,
|
|
3194
|
+
className: (0, import_css47.css)({
|
|
3249
3195
|
textTransform: "uppercase"
|
|
3250
3196
|
}),
|
|
3251
3197
|
children: content == null ? void 0 : content.key
|
|
@@ -3255,7 +3201,7 @@ function PromptModal(props) {
|
|
|
3255
3201
|
]
|
|
3256
3202
|
}
|
|
3257
3203
|
),
|
|
3258
|
-
/* @__PURE__ */ (0,
|
|
3204
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
3259
3205
|
Input,
|
|
3260
3206
|
{
|
|
3261
3207
|
id: "confirm",
|
|
@@ -3267,19 +3213,19 @@ function PromptModal(props) {
|
|
|
3267
3213
|
] })
|
|
3268
3214
|
}
|
|
3269
3215
|
),
|
|
3270
|
-
/* @__PURE__ */ (0,
|
|
3216
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
3271
3217
|
"div",
|
|
3272
3218
|
{
|
|
3273
|
-
className: (0,
|
|
3219
|
+
className: (0, import_patterns17.hstack)({
|
|
3274
3220
|
justifyContent: "stretch",
|
|
3275
3221
|
gap: "4"
|
|
3276
3222
|
}),
|
|
3277
3223
|
children: [
|
|
3278
|
-
/* @__PURE__ */ (0,
|
|
3224
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
3279
3225
|
Button,
|
|
3280
3226
|
{
|
|
3281
3227
|
autoFocus: true,
|
|
3282
|
-
className: (0,
|
|
3228
|
+
className: (0, import_css47.css)({
|
|
3283
3229
|
w: "1/2"
|
|
3284
3230
|
}),
|
|
3285
3231
|
disabled: !isValid,
|
|
@@ -3290,10 +3236,10 @@ function PromptModal(props) {
|
|
|
3290
3236
|
children: content == null ? void 0 : content.actionText
|
|
3291
3237
|
}
|
|
3292
3238
|
),
|
|
3293
|
-
/* @__PURE__ */ (0,
|
|
3239
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
3294
3240
|
Button,
|
|
3295
3241
|
{
|
|
3296
|
-
className: (0,
|
|
3242
|
+
className: (0, import_css47.css)({
|
|
3297
3243
|
w: "1/2"
|
|
3298
3244
|
}),
|
|
3299
3245
|
name: "cancel",
|
|
@@ -3310,7 +3256,7 @@ function PromptModal(props) {
|
|
|
3310
3256
|
] });
|
|
3311
3257
|
}
|
|
3312
3258
|
function usePromptModal() {
|
|
3313
|
-
const context = (0,
|
|
3259
|
+
const context = (0, import_react21.useContext)(PromptModalContext);
|
|
3314
3260
|
if (context === null) {
|
|
3315
3261
|
throw new Error("usePromptModal must be used within a PromptModal Provider");
|
|
3316
3262
|
}
|
|
@@ -3318,50 +3264,50 @@ function usePromptModal() {
|
|
|
3318
3264
|
}
|
|
3319
3265
|
|
|
3320
3266
|
// src/context/theme.tsx
|
|
3321
|
-
var
|
|
3267
|
+
var import_react23 = require("react");
|
|
3322
3268
|
|
|
3323
3269
|
// src/hooks/useTheme.ts
|
|
3324
|
-
var
|
|
3270
|
+
var import_react22 = require("react");
|
|
3325
3271
|
var THEME_KEY = "cerberus-theme";
|
|
3326
3272
|
var MODE_KEY = "cerberus-mode";
|
|
3327
3273
|
function useTheme(defaultTheme = "cerberus", defaultColorMode = "light", options = {}) {
|
|
3328
3274
|
const { updateMode, updateTheme, cache } = options;
|
|
3329
|
-
const [theme, setTheme] = (0,
|
|
3330
|
-
const [colorMode, setColorMode] = (0,
|
|
3331
|
-
const handleThemeChange = (0,
|
|
3275
|
+
const [theme, setTheme] = (0, import_react22.useState)(defaultTheme);
|
|
3276
|
+
const [colorMode, setColorMode] = (0, import_react22.useState)(defaultColorMode);
|
|
3277
|
+
const handleThemeChange = (0, import_react22.useCallback)(
|
|
3332
3278
|
(newTheme) => {
|
|
3333
3279
|
setTheme(newTheme);
|
|
3334
3280
|
updateTheme == null ? void 0 : updateTheme(newTheme);
|
|
3335
3281
|
},
|
|
3336
3282
|
[updateTheme]
|
|
3337
3283
|
);
|
|
3338
|
-
const handleColorModeChange = (0,
|
|
3284
|
+
const handleColorModeChange = (0, import_react22.useCallback)(
|
|
3339
3285
|
(newMode) => {
|
|
3340
3286
|
setColorMode(newMode);
|
|
3341
3287
|
updateMode == null ? void 0 : updateMode(newMode);
|
|
3342
3288
|
},
|
|
3343
3289
|
[updateMode]
|
|
3344
3290
|
);
|
|
3345
|
-
(0,
|
|
3291
|
+
(0, import_react22.useLayoutEffect)(() => {
|
|
3346
3292
|
const theme2 = localStorage.getItem(THEME_KEY);
|
|
3347
3293
|
if (theme2) {
|
|
3348
3294
|
setTheme(theme2);
|
|
3349
3295
|
}
|
|
3350
3296
|
}, []);
|
|
3351
|
-
(0,
|
|
3297
|
+
(0, import_react22.useLayoutEffect)(() => {
|
|
3352
3298
|
const mode = localStorage.getItem(MODE_KEY);
|
|
3353
3299
|
if (mode) {
|
|
3354
3300
|
setColorMode(mode);
|
|
3355
3301
|
}
|
|
3356
3302
|
}, []);
|
|
3357
|
-
(0,
|
|
3303
|
+
(0, import_react22.useEffect)(() => {
|
|
3358
3304
|
const root = document.documentElement;
|
|
3359
3305
|
root.dataset.pandaTheme = theme;
|
|
3360
3306
|
if (cache) {
|
|
3361
3307
|
localStorage.setItem(THEME_KEY, theme);
|
|
3362
3308
|
}
|
|
3363
3309
|
}, [theme, cache]);
|
|
3364
|
-
(0,
|
|
3310
|
+
(0, import_react22.useEffect)(() => {
|
|
3365
3311
|
const root = document.documentElement;
|
|
3366
3312
|
if (colorMode === "system") {
|
|
3367
3313
|
root.dataset.colorMode = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
@@ -3372,7 +3318,7 @@ function useTheme(defaultTheme = "cerberus", defaultColorMode = "light", options
|
|
|
3372
3318
|
localStorage.setItem(MODE_KEY, colorMode);
|
|
3373
3319
|
}
|
|
3374
3320
|
}, [colorMode, cache]);
|
|
3375
|
-
return (0,
|
|
3321
|
+
return (0, import_react22.useMemo)(
|
|
3376
3322
|
() => ({
|
|
3377
3323
|
theme,
|
|
3378
3324
|
mode: colorMode,
|
|
@@ -3384,8 +3330,8 @@ function useTheme(defaultTheme = "cerberus", defaultColorMode = "light", options
|
|
|
3384
3330
|
}
|
|
3385
3331
|
|
|
3386
3332
|
// src/context/theme.tsx
|
|
3387
|
-
var
|
|
3388
|
-
var ThemeContext = (0,
|
|
3333
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
3334
|
+
var ThemeContext = (0, import_react23.createContext)(
|
|
3389
3335
|
null
|
|
3390
3336
|
);
|
|
3391
3337
|
function ThemeProvider(props) {
|
|
@@ -3394,10 +3340,10 @@ function ThemeProvider(props) {
|
|
|
3394
3340
|
updateMode: props.updateMode,
|
|
3395
3341
|
updateTheme: props.updateTheme
|
|
3396
3342
|
});
|
|
3397
|
-
return /* @__PURE__ */ (0,
|
|
3343
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(ThemeContext.Provider, { value: state, children: props.children });
|
|
3398
3344
|
}
|
|
3399
3345
|
function useThemeContext() {
|
|
3400
|
-
const context = (0,
|
|
3346
|
+
const context = (0, import_react23.useContext)(ThemeContext);
|
|
3401
3347
|
if (!context) {
|
|
3402
3348
|
throw new Error("useThemeContext must be used within a ThemeProvider");
|
|
3403
3349
|
}
|
|
@@ -3405,13 +3351,13 @@ function useThemeContext() {
|
|
|
3405
3351
|
}
|
|
3406
3352
|
|
|
3407
3353
|
// src/hooks/useDate.ts
|
|
3408
|
-
var
|
|
3354
|
+
var import_react24 = require("react");
|
|
3409
3355
|
function useDate(options) {
|
|
3410
3356
|
const initialValue = (options == null ? void 0 : options.initialValue) ?? "";
|
|
3411
3357
|
const format = (options == null ? void 0 : options.format) ?? DateFormats.USMilitary;
|
|
3412
3358
|
const onChange = options == null ? void 0 : options.onChange;
|
|
3413
|
-
const [value, setValue] = (0,
|
|
3414
|
-
const handleChange = (0,
|
|
3359
|
+
const [value, setValue] = (0, import_react24.useState)(initialValue);
|
|
3360
|
+
const handleChange = (0, import_react24.useCallback)(
|
|
3415
3361
|
(e) => {
|
|
3416
3362
|
const newValue = formatMilitaryDate(e.currentTarget.value);
|
|
3417
3363
|
if (onChange) onChange(e);
|
|
@@ -3419,7 +3365,7 @@ function useDate(options) {
|
|
|
3419
3365
|
},
|
|
3420
3366
|
[onChange]
|
|
3421
3367
|
);
|
|
3422
|
-
return (0,
|
|
3368
|
+
return (0, import_react24.useMemo)(
|
|
3423
3369
|
() => ({
|
|
3424
3370
|
format,
|
|
3425
3371
|
value,
|
|
@@ -3498,11 +3444,11 @@ var MONTHS = [
|
|
|
3498
3444
|
];
|
|
3499
3445
|
|
|
3500
3446
|
// src/hooks/useToggle.ts
|
|
3501
|
-
var
|
|
3447
|
+
var import_react25 = require("react");
|
|
3502
3448
|
function useToggle(options) {
|
|
3503
|
-
const [checked, setChecked] = (0,
|
|
3449
|
+
const [checked, setChecked] = (0, import_react25.useState)((options == null ? void 0 : options.checked) ?? "");
|
|
3504
3450
|
const onChange = options == null ? void 0 : options.onChange;
|
|
3505
|
-
const handleChange = (0,
|
|
3451
|
+
const handleChange = (0, import_react25.useCallback)(
|
|
3506
3452
|
(e) => {
|
|
3507
3453
|
const target = e.currentTarget;
|
|
3508
3454
|
setChecked((prev) => {
|
|
@@ -3512,25 +3458,25 @@ function useToggle(options) {
|
|
|
3512
3458
|
},
|
|
3513
3459
|
[onChange]
|
|
3514
3460
|
);
|
|
3515
|
-
return (0,
|
|
3461
|
+
return (0, import_react25.useMemo)(() => ({ checked, handleChange }), [checked, handleChange]);
|
|
3516
3462
|
}
|
|
3517
3463
|
|
|
3518
3464
|
// src/hooks/useRootColors.ts
|
|
3519
|
-
var
|
|
3465
|
+
var import_react26 = require("react");
|
|
3520
3466
|
function useRootColors(colors = []) {
|
|
3521
|
-
const [state, dispatch] = (0,
|
|
3522
|
-
const handleRefetch = (0,
|
|
3467
|
+
const [state, dispatch] = (0, import_react26.useReducer)(rootColorsReducer, {});
|
|
3468
|
+
const handleRefetch = (0, import_react26.useCallback)(() => {
|
|
3523
3469
|
return new Promise((resolve) => {
|
|
3524
3470
|
dispatch(formatColors(colors));
|
|
3525
3471
|
resolve();
|
|
3526
3472
|
});
|
|
3527
3473
|
}, []);
|
|
3528
|
-
(0,
|
|
3474
|
+
(0, import_react26.useEffect)(() => {
|
|
3529
3475
|
if (Object.keys(state).length === colors.length) return;
|
|
3530
3476
|
dispatch(formatColors(colors));
|
|
3531
3477
|
console.log("updating colors in root hook");
|
|
3532
3478
|
}, [colors]);
|
|
3533
|
-
return (0,
|
|
3479
|
+
return (0, import_react26.useMemo)(
|
|
3534
3480
|
() => ({ colors: state, refetch: handleRefetch }),
|
|
3535
3481
|
[state, handleRefetch]
|
|
3536
3482
|
);
|
|
@@ -3638,11 +3584,13 @@ __reExport(src_exports, require("@dnd-kit/core"), module.exports);
|
|
|
3638
3584
|
Spinner,
|
|
3639
3585
|
THEME_KEY,
|
|
3640
3586
|
Tab,
|
|
3587
|
+
TabIndicator,
|
|
3641
3588
|
TabList,
|
|
3642
3589
|
TabPanel,
|
|
3643
3590
|
Table,
|
|
3644
3591
|
Tabs,
|
|
3645
3592
|
TabsContext,
|
|
3593
|
+
TabsList,
|
|
3646
3594
|
Tag,
|
|
3647
3595
|
Tbody,
|
|
3648
3596
|
Td,
|
|
@@ -3660,8 +3608,10 @@ __reExport(src_exports, require("@dnd-kit/core"), module.exports);
|
|
|
3660
3608
|
formatMilitaryDate,
|
|
3661
3609
|
formatMilitaryToISO,
|
|
3662
3610
|
formatNotifyCount,
|
|
3611
|
+
getLocalStorage,
|
|
3663
3612
|
getPosition,
|
|
3664
3613
|
processStatus,
|
|
3614
|
+
setLocalStorage,
|
|
3665
3615
|
trapFocus,
|
|
3666
3616
|
useCTAModal,
|
|
3667
3617
|
useConfirmModal,
|
|
@@ -3674,7 +3624,6 @@ __reExport(src_exports, require("@dnd-kit/core"), module.exports);
|
|
|
3674
3624
|
usePromptModal,
|
|
3675
3625
|
useRootColors,
|
|
3676
3626
|
useTabsContext,
|
|
3677
|
-
useTabsKeyboardNavigation,
|
|
3678
3627
|
useTheme,
|
|
3679
3628
|
useThemeContext,
|
|
3680
3629
|
useToggle,
|