@cboxdk/cbox-ui 0.10.2 → 0.10.4
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/README.md +34 -7
- package/dist/charts.d.ts +53 -3
- package/dist/charts.js +142 -4
- package/dist/charts.js.map +1 -1
- package/dist/chunk-QJ4T7RR2.js +113 -0
- package/dist/chunk-QJ4T7RR2.js.map +1 -0
- package/dist/engine-J67R3KY5.js +10 -0
- package/dist/engine-J67R3KY5.js.map +1 -0
- package/dist/index.d.ts +31 -7
- package/dist/index.js +87 -39
- package/dist/index.js.map +1 -1
- package/dist/scale-CYX7qlwJ.d.ts +55 -0
- package/package.json +1 -1
- package/tailwind.preset.js +4 -0
- package/tokens/cbox.css +17 -0
- package/tokens/shell.css +16 -8
- package/dist/chunk-OFTNLF7H.js +0 -55
- package/dist/chunk-OFTNLF7H.js.map +0 -1
- package/dist/engine-4DRZ3POZ.js +0 -10
- package/dist/engine-4DRZ3POZ.js.map +0 -1
- package/dist/scale-BaaY5qJs.d.ts +0 -24
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { C as CboxThemeMode, a as CboxKnownApp } from './catalog-BroZWvws.js';
|
|
|
5
5
|
export { b as CboxAppCatalogState, c as CboxCatalogApp, d as authorizeHref, p as parseAppCatalog, r as readKnownAppCatalog, e as rememberAppCatalog, s as secureIconUrl, f as signInTarget } from './catalog-BroZWvws.js';
|
|
6
6
|
import { LucideIcon } from 'lucide-react';
|
|
7
7
|
import { ClassValue } from 'clsx';
|
|
8
|
-
export { T as TimePoint, n as niceTicks, t as timeTicks } from './scale-
|
|
8
|
+
export { T as TimePoint, n as niceTicks, t as timeTicks } from './scale-CYX7qlwJ.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Identity contract every Cbox-family app must populate.
|
|
@@ -487,7 +487,10 @@ type Shell = {
|
|
|
487
487
|
/** `GET ?q=` → level 2/3 combinations across organizations (§6.1.4). */
|
|
488
488
|
gotoUrl?: string;
|
|
489
489
|
actions: PaletteAction[];
|
|
490
|
-
/**
|
|
490
|
+
/**
|
|
491
|
+
* The palette search field's placeholder, e.g. "Search customers, invoices… or pages". Default
|
|
492
|
+
* "Search or ask…". The header's Search button keeps "Search or ask…" in every app (spec §4.3).
|
|
493
|
+
*/
|
|
491
494
|
placeholder?: string;
|
|
492
495
|
};
|
|
493
496
|
help: ShellHelp;
|
|
@@ -500,7 +503,13 @@ type Shell = {
|
|
|
500
503
|
};
|
|
501
504
|
/** The account menu's links. Absent (laravel-console-kit 0.2.2): the menu has only the preferences. */
|
|
502
505
|
account?: ShellAccount;
|
|
506
|
+
/** The single strip of laravel-console-kit 0.2.3 and older. Shown only when `banners` is absent. */
|
|
503
507
|
banner?: ShellBanner;
|
|
508
|
+
/**
|
|
509
|
+
* Every strip under the header, top to bottom: the sandbox strip first, then the app's banners
|
|
510
|
+
* (a tax hold, impersonation). An app banner never hides the sandbox strip. Wins over `banner`.
|
|
511
|
+
*/
|
|
512
|
+
banners?: ShellBanner[];
|
|
504
513
|
preferences: ShellPreferences;
|
|
505
514
|
};
|
|
506
515
|
/** How the shell moves the person. An Inertia host passes `router.visit`. */
|
|
@@ -663,10 +672,23 @@ declare function settingsHref(level: Pick<ContextLevel, 'settingsUrl'>, id: stri
|
|
|
663
672
|
* name when the project has it, else its first. Undefined when the project has none.
|
|
664
673
|
*/
|
|
665
674
|
declare function environmentFor(environments: readonly ContextItem[], currentName: string | undefined): ContextItem | undefined;
|
|
675
|
+
/** The body `CboxShell` posts to `context.switchUrl`: laravel-console-kit's `select` and `from`. */
|
|
676
|
+
type SwitchBody = {
|
|
677
|
+
select: Record<string, string>;
|
|
678
|
+
from: string;
|
|
679
|
+
};
|
|
680
|
+
/**
|
|
681
|
+
* The switch body (§5.6): every level above the chosen one keeps its current id, the chosen
|
|
682
|
+
* levels get theirs, and levels below are left to the server (it keeps the item with the same
|
|
683
|
+
* name, else the first). `from` is where the person is, so the server can stay on the same page.
|
|
684
|
+
* This is the shape `POST /shell/switch` reads in laravel-console-kit, and the same one its
|
|
685
|
+
* palette links use as a query (`?select[project]=…&from=…`).
|
|
686
|
+
*/
|
|
687
|
+
declare function switchBody(levels: readonly ContextLevel[], chosen: Record<string, string>, from: string): SwitchBody;
|
|
666
688
|
/**
|
|
667
|
-
* The
|
|
668
|
-
*
|
|
669
|
-
*
|
|
689
|
+
* @deprecated The flat body 0.10.3 and older posted, `{ <level key>: id, …, return_to }`, which
|
|
690
|
+
* laravel-console-kit 0.2.4 and older answered with a 404. `CboxShell` posts `switchBody()` now.
|
|
691
|
+
* Kept for one minor; removed in 0.11.
|
|
670
692
|
*/
|
|
671
693
|
declare function switchPayload(levels: readonly ContextLevel[], chosen: Record<string, string>, returnTo: string): Record<string, string>;
|
|
672
694
|
|
|
@@ -934,7 +956,9 @@ type SectionHeaderProps = {
|
|
|
934
956
|
};
|
|
935
957
|
/**
|
|
936
958
|
* Section header that sits inside a DataPanel. Title in semibold sans,
|
|
937
|
-
* optional muted lead, right-aligned actions slot.
|
|
959
|
+
* optional muted lead, right-aligned actions slot. The actions stay beside
|
|
960
|
+
* the title while there is room (also on a phone) and wrap under it, left
|
|
961
|
+
* aligned, when there is not; several actions wrap among themselves.
|
|
938
962
|
*/
|
|
939
963
|
declare function SectionHeader({ title, description, actions, className, }: SectionHeaderProps): react_jsx_runtime.JSX.Element;
|
|
940
964
|
/**
|
|
@@ -1463,4 +1487,4 @@ declare function Sparkline({ values, color, width, height }: {
|
|
|
1463
1487
|
height?: number;
|
|
1464
1488
|
}): react_jsx_runtime.JSX.Element | null;
|
|
1465
1489
|
|
|
1466
|
-
export { APP_HUES, AppContent, type AppKey, AppShell, CHART_PALETTE, CboxAppCatalog, type CboxAppCatalogProps, CboxAppIcon, type CboxAppIconProps, type CboxAppKey, type CboxAppLink, CboxBrand, type CboxBrandProps, type CboxIdContextValue, CboxIdProvider, CboxKnownApp, CboxLocalizationProvider, type CboxNotificationPreviewItem, type CboxNotificationsState, type CboxOrganization, CboxServiceMark, type CboxServiceMarkProps, CboxShell, type CboxShellProps, CboxSurfaces, type CboxSurfacesProps, type CboxTranslationValues, type CboxTranslator, type CboxUser, Combobox, type ComboboxAvatar, type ComboboxGroup, type ComboboxOption, type ComboboxProps, type ContextItem, type ContextLevel, type ContextTone, DataPanel, EmptyState, Heading, type HelpArticle, type HelpState, type HelpStore, type InboxState, type InferUrlState, KeyValue, KeyValueList, type ListPage, type NavArea, type NavPage, PageHeader, type PageIntent, PageShell, type PageTabSpec, PageTabs, type PageTabsProps, type PageWidth, type PaletteAction, PanelBody, type RealtimeState, type RealtimeStatus, RowLink, type RowLinkProps, SHELL_ICONS, SectionHeader, type Shell, type ShellAccount, type Link as ShellActionLink, type ShellApp, type ShellBanner, type ShellCatalogState, type ShellHelp, type ShellIcon, type ShellLinkComponent, type ShellNavigate, type ShellNotifications, type ShellOption, type ShellPreferenceChange, type ShellPreferences, type ShellTheme, Sparkline, StatTile, StatusPill, type SupportUpdate, type SurfaceArgs, type SurfaceConfig, type SurfaceController, type SurfaceId, type Transport, type UrlField, type UrlSchema, applyTheme, buildUrlSearch, cn, contextTrail, createHelpStore, defineUrlSchema, environmentFor, hueFor, initialsOf, interpolate, pageIntent, parseListPage, parseShellCatalog, parseUrlSearch, settingsHref, switchPayload, themeBootScript, urlBoolean, urlEnum, urlNumber, urlString, urlStringArray, useCboxId, useCboxIdOptional, useCboxLocalization, useCboxSurfaces, useCboxSurfacesOptional, useKnownAppCatalog, useShellHelp, withQuery };
|
|
1490
|
+
export { APP_HUES, AppContent, type AppKey, AppShell, CHART_PALETTE, CboxAppCatalog, type CboxAppCatalogProps, CboxAppIcon, type CboxAppIconProps, type CboxAppKey, type CboxAppLink, CboxBrand, type CboxBrandProps, type CboxIdContextValue, CboxIdProvider, CboxKnownApp, CboxLocalizationProvider, type CboxNotificationPreviewItem, type CboxNotificationsState, type CboxOrganization, CboxServiceMark, type CboxServiceMarkProps, CboxShell, type CboxShellProps, CboxSurfaces, type CboxSurfacesProps, type CboxTranslationValues, type CboxTranslator, type CboxUser, Combobox, type ComboboxAvatar, type ComboboxGroup, type ComboboxOption, type ComboboxProps, type ContextItem, type ContextLevel, type ContextTone, DataPanel, EmptyState, Heading, type HelpArticle, type HelpState, type HelpStore, type InboxState, type InferUrlState, KeyValue, KeyValueList, type ListPage, type NavArea, type NavPage, PageHeader, type PageIntent, PageShell, type PageTabSpec, PageTabs, type PageTabsProps, type PageWidth, type PaletteAction, PanelBody, type RealtimeState, type RealtimeStatus, RowLink, type RowLinkProps, SHELL_ICONS, SectionHeader, type Shell, type ShellAccount, type Link as ShellActionLink, type ShellApp, type ShellBanner, type ShellCatalogState, type ShellHelp, type ShellIcon, type ShellLinkComponent, type ShellNavigate, type ShellNotifications, type ShellOption, type ShellPreferenceChange, type ShellPreferences, type ShellTheme, Sparkline, StatTile, StatusPill, type SupportUpdate, type SurfaceArgs, type SurfaceConfig, type SurfaceController, type SurfaceId, type SwitchBody, type Transport, type UrlField, type UrlSchema, applyTheme, buildUrlSearch, cn, contextTrail, createHelpStore, defineUrlSchema, environmentFor, hueFor, initialsOf, interpolate, pageIntent, parseListPage, parseShellCatalog, parseUrlSearch, settingsHref, switchBody, switchPayload, themeBootScript, urlBoolean, urlEnum, urlNumber, urlString, urlStringArray, useCboxId, useCboxIdOptional, useCboxLocalization, useCboxSurfaces, useCboxSurfacesOptional, useKnownAppCatalog, useShellHelp, withQuery };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { cn } from './chunk-
|
|
2
|
-
export { cn, niceTicks, timeTicks } from './chunk-
|
|
1
|
+
import { cn } from './chunk-QJ4T7RR2.js';
|
|
2
|
+
export { cn, niceTicks, timeTicks } from './chunk-QJ4T7RR2.js';
|
|
3
3
|
import { defineCboxAppSwitcher, subscribeKnownAppCatalog, readKnownAppCatalog, secureIconUrl, initials, parseAppCatalog, signInTarget, rememberAppCatalog } from './chunk-AJCYF7SS.js';
|
|
4
4
|
export { authorizeHref, parseAppCatalog, readKnownAppCatalog, rememberAppCatalog, secureIconUrl, signInTarget } from './chunk-AJCYF7SS.js';
|
|
5
5
|
import { createContext, useContext, useMemo, useSyncExternalStore, useState, useEffect, useCallback, useRef, createElement, useId, useLayoutEffect, useImperativeHandle } from 'react';
|
|
@@ -157,7 +157,7 @@ function Popover({
|
|
|
157
157
|
return () => document.removeEventListener("pointerdown", down, true);
|
|
158
158
|
}, [open, anchor, onClose]);
|
|
159
159
|
if (!open) return null;
|
|
160
|
-
const style = position === null ? { position: "fixed", top: 0, left: 0,
|
|
160
|
+
const style = position === null ? { position: "fixed", top: 0, left: 0, opacity: 0, pointerEvents: "none" } : { position: "fixed", top: position.top, bottom: position.bottom, left: position.left, maxHeight: position.maxHeight };
|
|
161
161
|
return /* @__PURE__ */ jsx(
|
|
162
162
|
"div",
|
|
163
163
|
{
|
|
@@ -687,16 +687,19 @@ function environmentFor(environments, currentName) {
|
|
|
687
687
|
}
|
|
688
688
|
return environments[0];
|
|
689
689
|
}
|
|
690
|
-
function
|
|
691
|
-
const
|
|
690
|
+
function switchBody(levels, chosen, from) {
|
|
691
|
+
const select = {};
|
|
692
692
|
const deepest = Math.max(-1, ...levels.map((level, index) => chosen[level.key] !== void 0 ? index : -1));
|
|
693
693
|
levels.forEach((level, index) => {
|
|
694
694
|
const id = chosen[level.key];
|
|
695
|
-
if (id !== void 0)
|
|
696
|
-
else if (index < deepest)
|
|
695
|
+
if (id !== void 0) select[level.key] = id;
|
|
696
|
+
else if (index < deepest) select[level.key] = level.current.id;
|
|
697
697
|
});
|
|
698
|
-
|
|
699
|
-
|
|
698
|
+
return { select, from };
|
|
699
|
+
}
|
|
700
|
+
function switchPayload(levels, chosen, returnTo) {
|
|
701
|
+
const { select } = switchBody(levels, chosen, returnTo);
|
|
702
|
+
return { ...select, return_to: returnTo };
|
|
700
703
|
}
|
|
701
704
|
function cookie(name) {
|
|
702
705
|
if (typeof document === "undefined") return null;
|
|
@@ -782,16 +785,27 @@ var defaultNavigate = (url, options = {}) => {
|
|
|
782
785
|
const fields = { ...options.data ?? {} };
|
|
783
786
|
const token = csrfToken();
|
|
784
787
|
if (token !== null) fields._token = token;
|
|
785
|
-
for (const [name, value] of
|
|
788
|
+
for (const [name, value] of formFields(fields)) {
|
|
786
789
|
const input = document.createElement("input");
|
|
787
790
|
input.type = "hidden";
|
|
788
791
|
input.name = name;
|
|
789
|
-
input.value =
|
|
792
|
+
input.value = value;
|
|
790
793
|
form.append(input);
|
|
791
794
|
}
|
|
792
795
|
document.body.append(form);
|
|
793
796
|
form.submit();
|
|
794
797
|
};
|
|
798
|
+
function formFields(data, prefix) {
|
|
799
|
+
const out = [];
|
|
800
|
+
for (const [key, value] of Object.entries(data)) {
|
|
801
|
+
const name = prefix === void 0 ? key : `${prefix}[${key}]`;
|
|
802
|
+
if (value === void 0 || value === null) continue;
|
|
803
|
+
if (typeof value === "object" && !Array.isArray(value)) out.push(...formFields(value, name));
|
|
804
|
+
else if (Array.isArray(value)) value.forEach((item, index) => out.push([`${name}[${index}]`, String(item)]));
|
|
805
|
+
else out.push([name, String(value)]);
|
|
806
|
+
}
|
|
807
|
+
return out;
|
|
808
|
+
}
|
|
795
809
|
function currentLocation() {
|
|
796
810
|
if (typeof window === "undefined") return "/";
|
|
797
811
|
return window.location.pathname + window.location.search + window.location.hash;
|
|
@@ -929,7 +943,9 @@ function LevelPane({ level, parent, currentId, heading, viewAll = true, searchab
|
|
|
929
943
|
});
|
|
930
944
|
}, [list.status, list.items, q, currentId]);
|
|
931
945
|
useEffect(() => {
|
|
932
|
-
if (autoFocus
|
|
946
|
+
if (!autoFocus) return;
|
|
947
|
+
if (searchable && canAutofocus()) input.current?.focus();
|
|
948
|
+
else box.current?.focus({ preventScroll: true });
|
|
933
949
|
}, [autoFocus, searchable]);
|
|
934
950
|
const focusSelf = useCallback(() => {
|
|
935
951
|
if (searchable) input.current?.focus();
|
|
@@ -974,6 +990,10 @@ function LevelPane({ level, parent, currentId, heading, viewAll = true, searchab
|
|
|
974
990
|
};
|
|
975
991
|
const onKeyDown = (event) => {
|
|
976
992
|
if (event.target instanceof HTMLElement && event.target.closest(".cbx-create")) return;
|
|
993
|
+
if (searchable && event.target === box.current && event.key.length === 1 && !event.metaKey && !event.ctrlKey && !event.altKey) {
|
|
994
|
+
input.current?.focus();
|
|
995
|
+
return;
|
|
996
|
+
}
|
|
977
997
|
if (event.target instanceof HTMLElement && event.target.closest("[data-pane-action]")) return;
|
|
978
998
|
const last = options.length - 1;
|
|
979
999
|
switch (event.key) {
|
|
@@ -1089,7 +1109,7 @@ function LevelPane({ level, parent, currentId, heading, viewAll = true, searchab
|
|
|
1089
1109
|
role: "listbox",
|
|
1090
1110
|
"aria-label": heading,
|
|
1091
1111
|
tabIndex: searchable ? -1 : 0,
|
|
1092
|
-
"aria-activedescendant":
|
|
1112
|
+
"aria-activedescendant": activeId,
|
|
1093
1113
|
className: "cbx-listbox",
|
|
1094
1114
|
children: options.map((option, index) => {
|
|
1095
1115
|
if (option.kind === "more") {
|
|
@@ -1803,6 +1823,14 @@ function resolveIcon(name, extra = {}) {
|
|
|
1803
1823
|
function navUrl(entry) {
|
|
1804
1824
|
return entry.url ?? entry.href ?? "#";
|
|
1805
1825
|
}
|
|
1826
|
+
function areaLocked(area) {
|
|
1827
|
+
const pages = area.pages ?? [];
|
|
1828
|
+
return pages.length > 0 && pages.every((page) => page.locked === true);
|
|
1829
|
+
}
|
|
1830
|
+
function shellBanners(shell, testData) {
|
|
1831
|
+
const all = shell.banners ?? (shell.banner !== void 0 ? [shell.banner] : []);
|
|
1832
|
+
return all.filter((banner) => banner.kind !== "sandbox" || testData);
|
|
1833
|
+
}
|
|
1806
1834
|
function groupPages(pages) {
|
|
1807
1835
|
const runs = /* @__PURE__ */ new Map();
|
|
1808
1836
|
for (const page of pages) {
|
|
@@ -1898,7 +1926,11 @@ function NavSheet({ onClose }) {
|
|
|
1898
1926
|
return /* @__PURE__ */ jsxs("div", { className: "cbx-sheet-area", children: [
|
|
1899
1927
|
/* @__PURE__ */ jsxs(Link, { href: navUrl(area), className: `cbx-row cbx-row-action ${activeArea ? (area.pages ?? []).length > 1 ? "is-open" : "is-current" : ""}`, "aria-current": activeArea && (area.pages ?? []).length <= 1 ? "page" : void 0, onClick: onClose, children: [
|
|
1900
1928
|
/* @__PURE__ */ jsx(Icon, { size: 16, strokeWidth: 1.8, "aria-hidden": true }),
|
|
1901
|
-
/* @__PURE__ */ jsx("span", { className: "cbx-row-name", children: area.label })
|
|
1929
|
+
/* @__PURE__ */ jsx("span", { className: "cbx-row-name", children: area.label }),
|
|
1930
|
+
areaLocked(area) && /* @__PURE__ */ jsxs("span", { className: "cbx-nav-lock", title: t("Not in your plan"), children: [
|
|
1931
|
+
/* @__PURE__ */ jsx(Lock, { size: 13, strokeWidth: 1.9, "aria-hidden": true }),
|
|
1932
|
+
/* @__PURE__ */ jsx("span", { className: "cbx-sr-only", children: t("(locked)") })
|
|
1933
|
+
] })
|
|
1902
1934
|
] }),
|
|
1903
1935
|
(area.pages ?? []).length > 1 && /* @__PURE__ */ jsx("div", { className: "cbx-sheet-pages", children: /* @__PURE__ */ jsx(
|
|
1904
1936
|
NavPageList,
|
|
@@ -2398,7 +2430,7 @@ function CboxShell({ shell, children, navigate = defaultNavigate, LinkComponent
|
|
|
2398
2430
|
},
|
|
2399
2431
|
switchTo: (chosen) => {
|
|
2400
2432
|
setOverlay(null);
|
|
2401
|
-
navigate(switchUrl, { method: "post", data:
|
|
2433
|
+
navigate(switchUrl, { method: "post", data: switchBody(levels, chosen, currentLocation()) });
|
|
2402
2434
|
}
|
|
2403
2435
|
}),
|
|
2404
2436
|
[shell, t, navigate, LinkComponent, icons, preferences, setPreference, overlay, store, toggleHelp, levels, switchUrl]
|
|
@@ -2427,7 +2459,7 @@ function CboxShell({ shell, children, navigate = defaultNavigate, LinkComponent
|
|
|
2427
2459
|
const mobile = useMedia(MOBILE, false);
|
|
2428
2460
|
const testData = levels.some((level) => level.current.testData === true);
|
|
2429
2461
|
const helpOpen = useHelpState(store, (state) => helpVisible(state, docked));
|
|
2430
|
-
const
|
|
2462
|
+
const banners = shellBanners(shell, testData);
|
|
2431
2463
|
return /* @__PURE__ */ jsx(ShellContext.Provider, { value: api, children: /* @__PURE__ */ jsxs("div", { className: "cbx-shell", "data-help-open": helpOpen, children: [
|
|
2432
2464
|
/* @__PURE__ */ jsx(
|
|
2433
2465
|
"a",
|
|
@@ -2447,10 +2479,10 @@ function CboxShell({ shell, children, navigate = defaultNavigate, LinkComponent
|
|
|
2447
2479
|
/* @__PURE__ */ jsx(Rail, { brandAssetBase }),
|
|
2448
2480
|
/* @__PURE__ */ jsxs("div", { className: "cbx-shell-column", children: [
|
|
2449
2481
|
/* @__PURE__ */ jsx(Header, { mobile }),
|
|
2450
|
-
banner
|
|
2482
|
+
banners.map((banner, index) => /* @__PURE__ */ jsxs("div", { className: `cbx-banner cbx-banner-${banner.kind}`, role: "status", children: [
|
|
2451
2483
|
/* @__PURE__ */ jsx("span", { className: "cbx-banner-text", children: banner.text }),
|
|
2452
2484
|
banner.action !== void 0 && /* @__PURE__ */ jsx(LinkComponent, { href: navUrl(banner.action), className: "cbx-banner-action", children: banner.action.label })
|
|
2453
|
-
] }),
|
|
2485
|
+
] }, `${banner.kind}-${index}`)),
|
|
2454
2486
|
/* @__PURE__ */ jsxs("div", { className: "cbx-shell-body", children: [
|
|
2455
2487
|
/* @__PURE__ */ jsx(Subnav, {}),
|
|
2456
2488
|
/* @__PURE__ */ jsx("main", { id: mainId, tabIndex: -1, className: "cbx-shell-main canvas-gradient", children })
|
|
@@ -2510,9 +2542,15 @@ function Rail({ brandAssetBase }) {
|
|
|
2510
2542
|
/* @__PURE__ */ jsx("nav", { className: "cbx-rail-nav", "aria-label": name, children: shell.nav.areas.map((area) => {
|
|
2511
2543
|
const Icon = resolveIcon(area.icon, icons);
|
|
2512
2544
|
const active = area.key === shell.nav.activeArea;
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2545
|
+
const locked = areaLocked(area);
|
|
2546
|
+
const label = locked ? t("{area} (locked)", { area: area.label }) : area.label;
|
|
2547
|
+
return /* @__PURE__ */ jsxs(Link, { href: navUrl(area), className: `cbx-rail-link ${active ? "is-active" : ""} ${locked ? "is-locked" : ""}`, "aria-current": active ? "page" : void 0, title: open ? void 0 : label, "aria-label": label, "data-locked": locked ? "true" : void 0, children: [
|
|
2548
|
+
/* @__PURE__ */ jsxs("span", { className: "cbx-rail-icon", children: [
|
|
2549
|
+
/* @__PURE__ */ jsx(Icon, { size: 18, strokeWidth: 1.7, "aria-hidden": true }),
|
|
2550
|
+
locked && /* @__PURE__ */ jsx("span", { className: "cbx-rail-lock", "aria-hidden": "true", children: /* @__PURE__ */ jsx(Lock, { size: 9, strokeWidth: 2.4 }) })
|
|
2551
|
+
] }),
|
|
2552
|
+
/* @__PURE__ */ jsx("span", { className: "cbx-rail-label", children: area.label }),
|
|
2553
|
+
locked && /* @__PURE__ */ jsx(Lock, { className: "cbx-rail-lock-open", size: 13, strokeWidth: 1.9, "aria-hidden": true })
|
|
2516
2554
|
] }, area.key);
|
|
2517
2555
|
}) }),
|
|
2518
2556
|
/* @__PURE__ */ jsx("div", { className: "cbx-rail-foot", children: /* @__PURE__ */ jsxs(
|
|
@@ -2584,10 +2622,20 @@ function Header({ mobile }) {
|
|
|
2584
2622
|
const [organization, ...rest] = shell.context.levels;
|
|
2585
2623
|
const trail = shell.context.levels.map((level) => level.current.name).join(" / ");
|
|
2586
2624
|
const close = useCallback(() => setOverlay(null), [setOverlay]);
|
|
2625
|
+
const triggerKeyDown = (event, menu) => {
|
|
2626
|
+
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
2627
|
+
event.preventDefault();
|
|
2628
|
+
if (overlay !== menu) setOverlay(menu);
|
|
2629
|
+
else document.querySelector('.cbx-popover .cbx-pane-search input, .cbx-popover [role="listbox"]')?.focus();
|
|
2630
|
+
} else if (event.key === "Escape" && overlay === menu) {
|
|
2631
|
+
event.preventDefault();
|
|
2632
|
+
setOverlay(null);
|
|
2633
|
+
}
|
|
2634
|
+
};
|
|
2587
2635
|
return /* @__PURE__ */ jsxs("header", { className: "cbx-header", children: [
|
|
2588
2636
|
/* @__PURE__ */ jsx("button", { type: "button", className: "cbx-icon-button cbx-only-mobile", onClick: () => setOverlay("nav-sheet"), "aria-label": t("Open navigation"), "aria-haspopup": "dialog", children: /* @__PURE__ */ jsx(Menu, { size: 20, strokeWidth: 1.8, "aria-hidden": true }) }),
|
|
2589
2637
|
organization !== void 0 && /* @__PURE__ */ jsxs("div", { className: "cbx-context cbx-only-desktop", children: [
|
|
2590
|
-
/* @__PURE__ */ jsxs("button", { ref: org, type: "button", className: `cbx-trigger ${overlay === "org" ? "is-open" : ""}`, "aria-haspopup": "dialog", "aria-expanded": overlay === "org", "aria-label": t("{level}: {name}", { level: organization.label, name: organization.current.name }), onClick: () => setOverlay(overlay === "org" ? null : "org"), children: [
|
|
2638
|
+
/* @__PURE__ */ jsxs("button", { ref: org, type: "button", className: `cbx-trigger ${overlay === "org" ? "is-open" : ""}`, "aria-haspopup": "dialog", "aria-expanded": overlay === "org", "aria-label": t("{level}: {name}", { level: organization.label, name: organization.current.name }), onClick: () => setOverlay(overlay === "org" ? null : "org"), onKeyDown: (event) => triggerKeyDown(event, "org"), children: [
|
|
2591
2639
|
/* @__PURE__ */ jsx(Chip, { item: organization.current, tone: "solid" }),
|
|
2592
2640
|
/* @__PURE__ */ jsx("span", { className: "cbx-trigger-text", title: organization.current.name, children: organization.current.name }),
|
|
2593
2641
|
/* @__PURE__ */ jsx(ChevronsUpDown, { className: "cbx-trigger-chevron", size: 14, strokeWidth: 1.8, "aria-hidden": true })
|
|
@@ -2595,7 +2643,7 @@ function Header({ mobile }) {
|
|
|
2595
2643
|
!mobile && /* @__PURE__ */ jsx(Popover, { open: overlay === "org", anchor: org, label: organization.label, onClose: close, children: /* @__PURE__ */ jsx(OrganizationMenu, { level: organization }) }),
|
|
2596
2644
|
rest.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2597
2645
|
/* @__PURE__ */ jsx("span", { className: "cbx-separator", "aria-hidden": "true", children: "/" }),
|
|
2598
|
-
/* @__PURE__ */ jsxs("button", { ref: second, type: "button", className: `cbx-trigger ${overlay === "context" ? "is-open" : ""}`, "aria-haspopup": "dialog", "aria-expanded": overlay === "context", "aria-label": rest.map((level) => t("{level}: {name}", { level: level.label, name: level.current.name })).join(", "), onClick: () => setOverlay(overlay === "context" ? null : "context"), children: [
|
|
2646
|
+
/* @__PURE__ */ jsxs("button", { ref: second, type: "button", className: `cbx-trigger ${overlay === "context" ? "is-open" : ""}`, "aria-haspopup": "dialog", "aria-expanded": overlay === "context", "aria-label": rest.map((level) => t("{level}: {name}", { level: level.label, name: level.current.name })).join(", "), onClick: () => setOverlay(overlay === "context" ? null : "context"), onKeyDown: (event) => triggerKeyDown(event, "context"), children: [
|
|
2599
2647
|
/* @__PURE__ */ jsx(CascadeLabel, { levels: rest }),
|
|
2600
2648
|
/* @__PURE__ */ jsx(ChevronsUpDown, { className: "cbx-trigger-chevron", size: 14, strokeWidth: 1.8, "aria-hidden": true })
|
|
2601
2649
|
] }),
|
|
@@ -3082,7 +3130,7 @@ function FooterLink({
|
|
|
3082
3130
|
LinkComponent,
|
|
3083
3131
|
onAfterClick
|
|
3084
3132
|
}) {
|
|
3085
|
-
const className = "flex items-center gap-2 border-t border-border/60 px-3 py-2.5 text-[13px] font-medium text-info transition-colors hover:bg-info-soft";
|
|
3133
|
+
const className = "flex items-center gap-2 border-t border-border/60 px-3 py-2.5 text-[13px] font-medium text-info-text transition-colors hover:bg-info-soft";
|
|
3086
3134
|
if (LinkComponent !== void 0) {
|
|
3087
3135
|
return /* @__PURE__ */ jsxs(
|
|
3088
3136
|
LinkComponent,
|
|
@@ -3133,7 +3181,7 @@ function ComboboxAvatarChip({
|
|
|
3133
3181
|
style,
|
|
3134
3182
|
className: cn(
|
|
3135
3183
|
"flex h-5 w-5 shrink-0 items-center justify-center rounded-sm text-[9px] font-semibold tracking-tight",
|
|
3136
|
-
avatar.accent === void 0 && "bg-info-soft text-info"
|
|
3184
|
+
avatar.accent === void 0 && "bg-info-soft text-info-text"
|
|
3137
3185
|
),
|
|
3138
3186
|
children: initials2
|
|
3139
3187
|
}
|
|
@@ -3288,15 +3336,15 @@ function SectionHeader({
|
|
|
3288
3336
|
"header",
|
|
3289
3337
|
{
|
|
3290
3338
|
className: cn(
|
|
3291
|
-
"flex flex-
|
|
3339
|
+
"flex flex-wrap items-center justify-between gap-x-4 gap-y-3 border-b border-border px-5 py-4",
|
|
3292
3340
|
className
|
|
3293
3341
|
),
|
|
3294
3342
|
children: [
|
|
3295
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
3343
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-[1_1_12rem] space-y-1", children: [
|
|
3296
3344
|
/* @__PURE__ */ jsx("h2", { className: "text-[15px] leading-none font-semibold text-foreground", children: title }),
|
|
3297
3345
|
description ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: description }) : null
|
|
3298
3346
|
] }),
|
|
3299
|
-
actions ? /* @__PURE__ */ jsx("div", { className: "flex
|
|
3347
|
+
actions ? /* @__PURE__ */ jsx("div", { className: "flex max-w-full flex-wrap items-center gap-2", children: actions }) : null
|
|
3300
3348
|
]
|
|
3301
3349
|
}
|
|
3302
3350
|
);
|
|
@@ -3760,10 +3808,10 @@ function RowLink({
|
|
|
3760
3808
|
);
|
|
3761
3809
|
}
|
|
3762
3810
|
var toneStyles = {
|
|
3763
|
-
info: { bg: "bg-info-soft", fg: "text-info" },
|
|
3764
|
-
success: { bg: "bg-success-soft", fg: "text-success" },
|
|
3765
|
-
warning: { bg: "bg-warning-soft", fg: "text-warning" },
|
|
3766
|
-
destructive: { bg: "bg-destructive-soft", fg: "text-destructive" },
|
|
3811
|
+
info: { bg: "bg-info-soft", fg: "text-info-text" },
|
|
3812
|
+
success: { bg: "bg-success-soft", fg: "text-success-text" },
|
|
3813
|
+
warning: { bg: "bg-warning-soft", fg: "text-warning-text" },
|
|
3814
|
+
destructive: { bg: "bg-destructive-soft", fg: "text-destructive-text" },
|
|
3767
3815
|
neutral: { bg: "bg-secondary", fg: "text-foreground" }
|
|
3768
3816
|
};
|
|
3769
3817
|
function StatTile({
|
|
@@ -3796,7 +3844,7 @@ function StatTile({
|
|
|
3796
3844
|
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1 space-y-0.5", children: [
|
|
3797
3845
|
/* @__PURE__ */ jsx("p", { className: "tabular text-2xl leading-none font-semibold tracking-tight text-foreground", children: value }),
|
|
3798
3846
|
/* @__PURE__ */ jsx("p", { className: "truncate text-xs text-muted-foreground", children: label }),
|
|
3799
|
-
suffix ? /* @__PURE__ */ jsx("p", { className: "text-mono truncate text-[10px] text-muted-foreground
|
|
3847
|
+
suffix ? /* @__PURE__ */ jsx("p", { className: "text-mono truncate text-[10px] text-muted-foreground", children: suffix }) : null
|
|
3800
3848
|
] })
|
|
3801
3849
|
]
|
|
3802
3850
|
}
|
|
@@ -3804,10 +3852,10 @@ function StatTile({
|
|
|
3804
3852
|
}
|
|
3805
3853
|
var toneStyles2 = {
|
|
3806
3854
|
neutral: "border-border bg-secondary text-secondary-foreground",
|
|
3807
|
-
info: "border-info/20 bg-info-soft text-info",
|
|
3808
|
-
success: "border-success/20 bg-success-soft text-success",
|
|
3809
|
-
warning: "border-warning/20 bg-warning-soft text-warning",
|
|
3810
|
-
destructive: "border-destructive/20 bg-destructive-soft text-destructive",
|
|
3855
|
+
info: "border-info/20 bg-info-soft text-info-text",
|
|
3856
|
+
success: "border-success/20 bg-success-soft text-success-text",
|
|
3857
|
+
warning: "border-warning/20 bg-warning-soft text-warning-text",
|
|
3858
|
+
destructive: "border-destructive/20 bg-destructive-soft text-destructive-text",
|
|
3811
3859
|
muted: "border-border bg-card text-muted-foreground"
|
|
3812
3860
|
};
|
|
3813
3861
|
var dotStyles = {
|
|
@@ -4083,7 +4131,7 @@ function InboxSurface({ open, onClose }) {
|
|
|
4083
4131
|
)
|
|
4084
4132
|
] }) : /* @__PURE__ */ jsx("span", { children: "\u2014" }),
|
|
4085
4133
|
children: error !== null ? /* @__PURE__ */ jsxs("div", { className: "px-5 py-8 text-center", children: [
|
|
4086
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-destructive", children: t("Couldn't load inbox") }),
|
|
4134
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-destructive-text", children: t("Couldn't load inbox") }),
|
|
4087
4135
|
/* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: error })
|
|
4088
4136
|
] }) : loading && inbox === null ? /* @__PURE__ */ jsx("div", { className: "px-5 py-12 text-center text-sm text-muted-foreground", children: t("Loading\u2026") }) : filtered.length === 0 ? /* @__PURE__ */ jsx("div", { className: "px-5 py-12", children: /* @__PURE__ */ jsx(
|
|
4089
4137
|
EmptyState,
|
|
@@ -4335,6 +4383,6 @@ function Sparkline({ values, color = "var(--chart-1)", width = 90, height = 20 }
|
|
|
4335
4383
|
] });
|
|
4336
4384
|
}
|
|
4337
4385
|
|
|
4338
|
-
export { APP_HUES, AppContent, AppShell, CHART_PALETTE, CboxAppCatalog, CboxAppIcon, CboxBrand, CboxIdProvider, CboxLocalizationProvider, CboxServiceMark, CboxShell, CboxSurfaces, Combobox, DataPanel, EmptyState, Heading, KeyValue, KeyValueList, PageHeader, PageShell, PageTabs, PanelBody, RowLink, SHELL_ICONS, SectionHeader, Sparkline, StatTile, StatusPill, applyTheme, buildUrlSearch, contextTrail, createHelpStore, defineUrlSchema, environmentFor, hueFor, initialsOf, interpolate, pageIntent, parseListPage, parseShellCatalog, parseUrlSearch, settingsHref, switchPayload, themeBootScript, urlBoolean, urlEnum, urlNumber, urlString, urlStringArray, useCboxId, useCboxIdOptional, useCboxLocalization, useCboxSurfaces, useCboxSurfacesOptional, useKnownAppCatalog, useShellHelp, withQuery };
|
|
4386
|
+
export { APP_HUES, AppContent, AppShell, CHART_PALETTE, CboxAppCatalog, CboxAppIcon, CboxBrand, CboxIdProvider, CboxLocalizationProvider, CboxServiceMark, CboxShell, CboxSurfaces, Combobox, DataPanel, EmptyState, Heading, KeyValue, KeyValueList, PageHeader, PageShell, PageTabs, PanelBody, RowLink, SHELL_ICONS, SectionHeader, Sparkline, StatTile, StatusPill, applyTheme, buildUrlSearch, contextTrail, createHelpStore, defineUrlSchema, environmentFor, hueFor, initialsOf, interpolate, pageIntent, parseListPage, parseShellCatalog, parseUrlSearch, settingsHref, switchBody, switchPayload, themeBootScript, urlBoolean, urlEnum, urlNumber, urlString, urlStringArray, useCboxId, useCboxIdOptional, useCboxLocalization, useCboxSurfaces, useCboxSurfacesOptional, useKnownAppCatalog, useShellHelp, withQuery };
|
|
4339
4387
|
//# sourceMappingURL=index.js.map
|
|
4340
4388
|
//# sourceMappingURL=index.js.map
|