@cboxdk/cbox-ui 0.15.3 → 0.15.5
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/dist/index.js +67 -58
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/tokens/shell.css +4 -2
package/dist/index.js
CHANGED
|
@@ -47,6 +47,20 @@ function useCboxLocalization() {
|
|
|
47
47
|
function defaultDate(value) {
|
|
48
48
|
return new Date(value).toLocaleString();
|
|
49
49
|
}
|
|
50
|
+
function inSentence(label, locale) {
|
|
51
|
+
const language = locale.toLowerCase().split(/[-_]/)[0] ?? "";
|
|
52
|
+
if (language === "de" || language === "lb") return label;
|
|
53
|
+
const [first = "", second = ""] = Array.from(label);
|
|
54
|
+
if (second !== "" && second !== second.toLowerCase()) return label;
|
|
55
|
+
return lowered(first, language) + label.slice(first.length);
|
|
56
|
+
}
|
|
57
|
+
function lowered(letter, language) {
|
|
58
|
+
try {
|
|
59
|
+
return letter.toLocaleLowerCase(language);
|
|
60
|
+
} catch {
|
|
61
|
+
return letter.toLowerCase();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
50
64
|
var EMPTY = [];
|
|
51
65
|
function useKnownAppCatalog() {
|
|
52
66
|
return useSyncExternalStore(subscribeKnownAppCatalog, readKnownAppCatalog, () => EMPTY);
|
|
@@ -266,6 +280,7 @@ function rovingKeyDown(event, container) {
|
|
|
266
280
|
}
|
|
267
281
|
}
|
|
268
282
|
function OptionList({ label, options, current, onPick, autoFocus = true }) {
|
|
283
|
+
const { locale } = useCboxLocalization();
|
|
269
284
|
const { t } = useShell();
|
|
270
285
|
const [q, setQ] = useState("");
|
|
271
286
|
const id = useId();
|
|
@@ -316,7 +331,7 @@ function OptionList({ label, options, current, onPick, autoFocus = true }) {
|
|
|
316
331
|
"aria-expanded": "true",
|
|
317
332
|
"aria-controls": `${id}-list`,
|
|
318
333
|
"aria-activedescendant": shown[active] !== void 0 ? `${id}-${active}` : void 0,
|
|
319
|
-
"aria-label": t("Search {things}", { things: label
|
|
334
|
+
"aria-label": t("Search {things}", { things: inSentence(label, locale) }),
|
|
320
335
|
placeholder: t("Search\u2026"),
|
|
321
336
|
value: q,
|
|
322
337
|
onChange: (event) => setQ(event.target.value),
|
|
@@ -954,6 +969,7 @@ function isEnvironmentLevel(level) {
|
|
|
954
969
|
return level.key === "environment";
|
|
955
970
|
}
|
|
956
971
|
function LevelPane({ level, parent, currentId, heading, viewAll = true, searchable = true, autoFocus = false, chevron = false, createLabel: createLabel2, onPick, onPreview, onArrowRight, onArrowLeft, handle, className }) {
|
|
972
|
+
const { locale } = useCboxLocalization();
|
|
957
973
|
const { t, Link, navigate } = useShell();
|
|
958
974
|
const [q, setQ] = useState("");
|
|
959
975
|
const [active, setActiveRow] = useState(-1);
|
|
@@ -1117,8 +1133,8 @@ function LevelPane({ level, parent, currentId, heading, viewAll = true, searchab
|
|
|
1117
1133
|
"aria-controls": listboxId,
|
|
1118
1134
|
"aria-activedescendant": activeId,
|
|
1119
1135
|
"aria-autocomplete": "list",
|
|
1120
|
-
"aria-label": t("Search {things}", { things: plural
|
|
1121
|
-
placeholder: t("Search {things}\u2026", { things: plural
|
|
1136
|
+
"aria-label": t("Search {things}", { things: inSentence(plural, locale) }),
|
|
1137
|
+
placeholder: t("Search {things}\u2026", { things: inSentence(plural, locale) }),
|
|
1122
1138
|
value: q,
|
|
1123
1139
|
onChange: (event) => setQ(event.target.value),
|
|
1124
1140
|
autoComplete: "off",
|
|
@@ -1197,6 +1213,7 @@ function LevelPane({ level, parent, currentId, heading, viewAll = true, searchab
|
|
|
1197
1213
|
] });
|
|
1198
1214
|
}
|
|
1199
1215
|
function ListStatus({ status, empty, query: query2, plural, onRetry }) {
|
|
1216
|
+
const { locale } = useCboxLocalization();
|
|
1200
1217
|
const { t } = useShell();
|
|
1201
1218
|
if (status === "error") {
|
|
1202
1219
|
return /* @__PURE__ */ jsxs("div", { className: "cbx-list-note", role: "alert", children: [
|
|
@@ -1207,7 +1224,7 @@ function ListStatus({ status, empty, query: query2, plural, onRetry }) {
|
|
|
1207
1224
|
}
|
|
1208
1225
|
if (status === "loading" && empty) return /* @__PURE__ */ jsx("div", { className: "cbx-list-note", "aria-live": "polite", children: t("Loading\u2026") });
|
|
1209
1226
|
if (status === "ready" && empty) {
|
|
1210
|
-
return /* @__PURE__ */ jsx("div", { className: "cbx-list-note", "aria-live": "polite", children: query2.trim() === "" ? t("No {things} yet.", { things: plural
|
|
1227
|
+
return /* @__PURE__ */ jsx("div", { className: "cbx-list-note", "aria-live": "polite", children: query2.trim() === "" ? t("No {things} yet.", { things: inSentence(plural, locale) }) : t("Nothing matches \u201C{query}\u201D.", { query: query2.trim() }) });
|
|
1211
1228
|
}
|
|
1212
1229
|
return null;
|
|
1213
1230
|
}
|
|
@@ -1290,6 +1307,7 @@ async function pickKeepingEnvironment(outer, inner, item, switchTo) {
|
|
|
1290
1307
|
switchTo(environment === void 0 ? { [outer.key]: item.id } : { [outer.key]: item.id, [inner.key]: environment.id });
|
|
1291
1308
|
}
|
|
1292
1309
|
function OrganizationMenu({ level }) {
|
|
1310
|
+
const { locale } = useCboxLocalization();
|
|
1293
1311
|
const { t, switchTo } = useShell();
|
|
1294
1312
|
return /* @__PURE__ */ jsx("div", { className: "cbx-menu cbx-menu-org", children: /* @__PURE__ */ jsx(
|
|
1295
1313
|
LevelPane,
|
|
@@ -1298,12 +1316,13 @@ function OrganizationMenu({ level }) {
|
|
|
1298
1316
|
currentId: level.current.id,
|
|
1299
1317
|
heading: pluralOf(level),
|
|
1300
1318
|
autoFocus: true,
|
|
1301
|
-
createLabel: t("New {thing}", { thing: level.label
|
|
1319
|
+
createLabel: t("New {thing}", { thing: inSentence(level.label, locale) }),
|
|
1302
1320
|
onPick: (item) => switchTo({ [level.key]: item.id })
|
|
1303
1321
|
}
|
|
1304
1322
|
) });
|
|
1305
1323
|
}
|
|
1306
1324
|
function CascadeMenu({ levels, parent }) {
|
|
1325
|
+
const { locale } = useCboxLocalization();
|
|
1307
1326
|
const { t, switchTo } = useShell();
|
|
1308
1327
|
const [outer, inner] = levels;
|
|
1309
1328
|
const [preview, setPreview] = useState(outer.current);
|
|
@@ -1318,7 +1337,7 @@ function CascadeMenu({ levels, parent }) {
|
|
|
1318
1337
|
currentId: outer.current.id,
|
|
1319
1338
|
heading: pluralOf(outer),
|
|
1320
1339
|
autoFocus: true,
|
|
1321
|
-
createLabel: t("New {thing}", { thing: outer.label
|
|
1340
|
+
createLabel: t("New {thing}", { thing: inSentence(outer.label, locale) }),
|
|
1322
1341
|
onPick: (item) => switchTo({ [outer.key]: item.id })
|
|
1323
1342
|
}
|
|
1324
1343
|
) });
|
|
@@ -1335,7 +1354,7 @@ function CascadeMenu({ levels, parent }) {
|
|
|
1335
1354
|
heading: pluralOf(outer),
|
|
1336
1355
|
autoFocus: true,
|
|
1337
1356
|
chevron: true,
|
|
1338
|
-
createLabel: t("New {thing}", { thing: outer.label
|
|
1357
|
+
createLabel: t("New {thing}", { thing: inSentence(outer.label, locale) }),
|
|
1339
1358
|
onPick: (item) => void pickOuter(item),
|
|
1340
1359
|
onPreview: setPreview,
|
|
1341
1360
|
onArrowRight: () => {
|
|
@@ -1355,7 +1374,7 @@ function CascadeMenu({ levels, parent }) {
|
|
|
1355
1374
|
heading: t("{things} in {name}", { things: pluralOf(inner), name: preview.name }),
|
|
1356
1375
|
viewAll: false,
|
|
1357
1376
|
searchable: false,
|
|
1358
|
-
createLabel: t("New {thing} in {name}", { thing: inner.label
|
|
1377
|
+
createLabel: t("New {thing} in {name}", { thing: inSentence(inner.label, locale), name: preview.name }),
|
|
1359
1378
|
onPick: (item) => switchTo({ [outer.key]: preview.id, [inner.key]: item.id }),
|
|
1360
1379
|
onArrowLeft: () => left.current?.focus()
|
|
1361
1380
|
},
|
|
@@ -2962,6 +2981,7 @@ function rows(body, group) {
|
|
|
2962
2981
|
return Array.isArray(data) ? data.filter((row) => typeof row === "object" && row !== null) : [];
|
|
2963
2982
|
}
|
|
2964
2983
|
function CommandPalette({ onClose }) {
|
|
2984
|
+
const { locale } = useCboxLocalization();
|
|
2965
2985
|
const { shell, t, help: helpStore, navigate, switchTo, openArticle, ask, mobile, openContext, openCreate, canCreate, searchRecords } = useShell();
|
|
2966
2986
|
const [scope, setScope] = useState("all");
|
|
2967
2987
|
const [input, setInput] = useState("");
|
|
@@ -3139,7 +3159,7 @@ function CommandPalette({ onClose }) {
|
|
|
3139
3159
|
const createItem2 = (key) => {
|
|
3140
3160
|
const creatable = findCreatable(shell, key);
|
|
3141
3161
|
if (creatable === void 0 || !canCreate) return null;
|
|
3142
|
-
return { id: `create:${key}`, title: t("New {thing}", { thing: creatable.label
|
|
3162
|
+
return { id: `create:${key}`, title: t("New {thing}", { thing: inSentence(creatable.label, locale) }), kind: "actions", icon: /* @__PURE__ */ jsx(Plus, { size: 16, strokeWidth: 1.8, "aria-hidden": true }), run: () => {
|
|
3143
3163
|
onClose();
|
|
3144
3164
|
openCreate(key);
|
|
3145
3165
|
} };
|
|
@@ -3166,7 +3186,7 @@ function CommandPalette({ onClose }) {
|
|
|
3166
3186
|
if (organization !== void 0) {
|
|
3167
3187
|
switchItems.push({
|
|
3168
3188
|
id: "switch:organization",
|
|
3169
|
-
title: t("Switch {thing}", { thing: organization.label
|
|
3189
|
+
title: t("Switch {thing}", { thing: inSentence(organization.label, locale) }),
|
|
3170
3190
|
subtitle: t("Now {name}", { name: organization.current.name }),
|
|
3171
3191
|
kind: "actions",
|
|
3172
3192
|
icon: /* @__PURE__ */ jsx(ArrowLeftRight, { size: 16, strokeWidth: 1.8, "aria-hidden": true }),
|
|
@@ -3450,12 +3470,13 @@ function findCreatable(shell, key) {
|
|
|
3450
3470
|
function pageCreateKey(shell) {
|
|
3451
3471
|
return findCreatable(shell, shell.page?.create)?.key ?? findCreatable(shell, shell.create?.default)?.key ?? null;
|
|
3452
3472
|
}
|
|
3453
|
-
function createLabel(shell, t) {
|
|
3473
|
+
function createLabel(shell, t, locale = "en") {
|
|
3454
3474
|
const own = findCreatable(shell, shell.page?.create);
|
|
3455
|
-
return own !== void 0 ? t("New {thing}", { thing: own.label
|
|
3475
|
+
return own !== void 0 ? t("New {thing}", { thing: inSentence(own.label, locale) }) : t("Create");
|
|
3456
3476
|
}
|
|
3457
3477
|
function CreateSheet({ onClose }) {
|
|
3458
3478
|
const { shell, t, mobile, createKey, renderCreate } = useShell();
|
|
3479
|
+
const { locale } = useCboxLocalization();
|
|
3459
3480
|
const [stack, setStack] = useState(() => findCreatable(shell, createKey) !== void 0 ? [{ kind: "tree" }, { kind: "form", key: createKey }] : [{ kind: "tree" }]);
|
|
3460
3481
|
const guards = useRef(/* @__PURE__ */ new Map());
|
|
3461
3482
|
const [leaving, setLeaving] = useState(null);
|
|
@@ -3480,7 +3501,7 @@ function CreateSheet({ onClose }) {
|
|
|
3480
3501
|
else pop();
|
|
3481
3502
|
return true;
|
|
3482
3503
|
};
|
|
3483
|
-
const title = top.kind === "tree" ? t("Create") : t("New {thing}", { thing: name(top)
|
|
3504
|
+
const title = top.kind === "tree" ? t("Create") : t("New {thing}", { thing: inSentence(name(top), locale) });
|
|
3484
3505
|
return /* @__PURE__ */ jsxs(
|
|
3485
3506
|
Sheet2,
|
|
3486
3507
|
{
|
|
@@ -3506,7 +3527,7 @@ function CreateSheet({ onClose }) {
|
|
|
3506
3527
|
const form = {
|
|
3507
3528
|
creatable,
|
|
3508
3529
|
parent,
|
|
3509
|
-
submitLabel: parent !== null ? t("Create and use in {thing}", { thing: parent.label
|
|
3530
|
+
submitLabel: parent !== null ? t("Create and use in {thing}", { thing: inSentence(parent.label, locale) }) : creatable.submitLabel ?? t("Create {thing}", { thing: inSentence(creatable.label, locale) }),
|
|
3510
3531
|
createRef: (key, onCreated) => {
|
|
3511
3532
|
if (findCreatable(shell, key) === void 0) return;
|
|
3512
3533
|
const returnFocus = document.activeElement instanceof HTMLElement ? document.activeElement : void 0;
|
|
@@ -3535,7 +3556,7 @@ function CreateSheet({ onClose }) {
|
|
|
3535
3556
|
onOpenChange: (open) => {
|
|
3536
3557
|
if (!open) setLeaving(null);
|
|
3537
3558
|
},
|
|
3538
|
-
title: leaving === "all" ? t("Discard this creation flow?") : t("Discard {thing}?", { thing: name(top)
|
|
3559
|
+
title: leaving === "all" ? t("Discard this creation flow?") : t("Discard {thing}?", { thing: inSentence(name(top), locale) }),
|
|
3539
3560
|
description: leaving === "all" ? t("Unsaved entries in every task will be lost.") : t("Only this task is discarded. The task underneath keeps its values."),
|
|
3540
3561
|
footer: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3541
3562
|
/* @__PURE__ */ jsx(Button, { onClick: () => setLeaving(null), children: t("Keep editing") }),
|
|
@@ -3591,6 +3612,7 @@ function CreateField({ label, children, htmlFor }) {
|
|
|
3591
3612
|
}
|
|
3592
3613
|
function CreateRefField({ label, value, placeholder, thing, onChoose, onCreate }) {
|
|
3593
3614
|
const { t } = useShell();
|
|
3615
|
+
const { locale } = useCboxLocalization();
|
|
3594
3616
|
const id = useId();
|
|
3595
3617
|
return /* @__PURE__ */ jsxs("div", { className: "cbx-cfield", role: "group", "aria-labelledby": id, children: [
|
|
3596
3618
|
/* @__PURE__ */ jsx("span", { id, className: "cbx-cfield-label", children: label }),
|
|
@@ -3601,7 +3623,7 @@ function CreateRefField({ label, value, placeholder, thing, onChoose, onCreate }
|
|
|
3601
3623
|
] }),
|
|
3602
3624
|
/* @__PURE__ */ jsxs("button", { type: "button", className: "cbx-grow is-accent", onClick: onCreate, children: [
|
|
3603
3625
|
/* @__PURE__ */ jsx(Plus, { size: 16, strokeWidth: 1.8, "aria-hidden": true }),
|
|
3604
|
-
/* @__PURE__ */ jsx("span", { className: "cbx-grow-label", children: t("New {thing}", { thing: thing
|
|
3626
|
+
/* @__PURE__ */ jsx("span", { className: "cbx-grow-label", children: t("New {thing}", { thing: inSentence(thing, locale) }) })
|
|
3605
3627
|
] })
|
|
3606
3628
|
] })
|
|
3607
3629
|
] });
|
|
@@ -3898,6 +3920,7 @@ function useUnread() {
|
|
|
3898
3920
|
}
|
|
3899
3921
|
function MobileTopBar() {
|
|
3900
3922
|
const { shell, t, openContext, toggleHelp, setOverlay, openCreate, canCreate, overlay } = useShell();
|
|
3923
|
+
const { locale } = useCboxLocalization();
|
|
3901
3924
|
const apps = useRef(null);
|
|
3902
3925
|
const levels = shell.context.levels;
|
|
3903
3926
|
const organization = levels[0];
|
|
@@ -3925,7 +3948,7 @@ function MobileTopBar() {
|
|
|
3925
3948
|
/* @__PURE__ */ jsx("button", { type: "button", className: "cbx-m-icon", onClick: () => setOverlay("palette"), "aria-label": t("Search and commands"), "aria-haspopup": "dialog", children: /* @__PURE__ */ jsx(Search, { size: 21, strokeWidth: 1.8, "aria-hidden": true }) }),
|
|
3926
3949
|
/* @__PURE__ */ jsx("button", { ref: apps, type: "button", className: "cbx-m-icon", onClick: () => setOverlay(overlay === "apps" ? null : "apps"), "aria-label": t("Switch app"), "aria-haspopup": "dialog", "aria-expanded": overlay === "apps", children: /* @__PURE__ */ jsx(LayoutGrid, { size: 20, strokeWidth: 1.8, "aria-hidden": true }) }),
|
|
3927
3950
|
/* @__PURE__ */ jsx(Popover, { open: overlay === "apps", anchor: apps, placement: "bottom-end", label: t("Switch app"), onClose: () => setOverlay(null), children: /* @__PURE__ */ jsx(AppGrid, {}) }),
|
|
3928
|
-
canCreate && /* @__PURE__ */ jsx("button", { type: "button", className: "cbx-m-icon is-primary", onClick: () => openCreate(), "aria-haspopup": "dialog", "aria-label": createLabel(shell, t), children: /* @__PURE__ */ jsx(Plus, { size: 22, strokeWidth: 2, "aria-hidden": true }) })
|
|
3951
|
+
canCreate && /* @__PURE__ */ jsx("button", { type: "button", className: "cbx-m-icon is-primary", onClick: () => openCreate(), "aria-haspopup": "dialog", "aria-label": createLabel(shell, t, locale), children: /* @__PURE__ */ jsx(Plus, { size: 22, strokeWidth: 2, "aria-hidden": true }) })
|
|
3929
3952
|
] });
|
|
3930
3953
|
}
|
|
3931
3954
|
function MobileAreaHead() {
|
|
@@ -4239,6 +4262,7 @@ function useMoreView() {
|
|
|
4239
4262
|
}
|
|
4240
4263
|
function ContextSheet({ onClose }) {
|
|
4241
4264
|
const { shell, t, switchTo, contextStep } = useShell();
|
|
4265
|
+
const { locale } = useCboxLocalization();
|
|
4242
4266
|
const [step, setStep] = useState(contextStep.step);
|
|
4243
4267
|
const direct = contextStep.direct;
|
|
4244
4268
|
const levels = shell.context.levels;
|
|
@@ -4263,7 +4287,7 @@ function ContextSheet({ onClose }) {
|
|
|
4263
4287
|
parent: parent?.current.id,
|
|
4264
4288
|
currentId: level.current.id,
|
|
4265
4289
|
heading: pluralOf(level),
|
|
4266
|
-
createLabel: t("New {thing}", { thing: level.label
|
|
4290
|
+
createLabel: t("New {thing}", { thing: inSentence(level.label, locale) }),
|
|
4267
4291
|
onPick: (item) => index === 0 ? switchTo({ [level.key]: item.id }) : void pickKeepingEnvironment(level, inner, item, switchTo)
|
|
4268
4292
|
}
|
|
4269
4293
|
) }) });
|
|
@@ -4272,6 +4296,7 @@ function ContextSheet({ onClose }) {
|
|
|
4272
4296
|
}
|
|
4273
4297
|
function ContextRoot({ onStep }) {
|
|
4274
4298
|
const { shell, t, switchTo } = useShell();
|
|
4299
|
+
const { locale } = useCboxLocalization();
|
|
4275
4300
|
const levels = shell.context.levels;
|
|
4276
4301
|
const environment = environmentLevel(levels);
|
|
4277
4302
|
const above = levels.filter((level) => level !== environment);
|
|
@@ -4304,7 +4329,7 @@ function ContextRoot({ onStep }) {
|
|
|
4304
4329
|
] }, item.id);
|
|
4305
4330
|
}),
|
|
4306
4331
|
/* @__PURE__ */ jsxs("button", { type: "button", className: "cbx-grow is-accent", onClick: () => onStep("environments"), children: [
|
|
4307
|
-
/* @__PURE__ */ jsx("span", { className: "cbx-grow-label", children: list.status === "ready" && !list.hasMore ? t("All {count} {things}", { count: list.items.length, things: pluralOf(environment)
|
|
4332
|
+
/* @__PURE__ */ jsx("span", { className: "cbx-grow-label", children: list.status === "ready" && !list.hasMore ? t("All {count} {things}", { count: list.items.length, things: inSentence(pluralOf(environment), locale) }) : t("All {things}", { things: inSentence(pluralOf(environment), locale) }) }),
|
|
4308
4333
|
/* @__PURE__ */ jsx(Trail, {})
|
|
4309
4334
|
] })
|
|
4310
4335
|
] })
|
|
@@ -4313,6 +4338,7 @@ function ContextRoot({ onStep }) {
|
|
|
4313
4338
|
}
|
|
4314
4339
|
function EnvironmentList({ level, parent, parentName, onPick }) {
|
|
4315
4340
|
const { t } = useShell();
|
|
4341
|
+
const { locale } = useCboxLocalization();
|
|
4316
4342
|
const [q, setQ] = useState("");
|
|
4317
4343
|
const [creating, setCreating] = useState(false);
|
|
4318
4344
|
const list = useContextList(level.listUrl, { q, parent });
|
|
@@ -4320,7 +4346,7 @@ function EnvironmentList({ level, parent, parentName, onPick }) {
|
|
|
4320
4346
|
return /* @__PURE__ */ jsxs("div", { className: "cbx-env-list", children: [
|
|
4321
4347
|
/* @__PURE__ */ jsxs("label", { className: "cbx-field-search", children: [
|
|
4322
4348
|
/* @__PURE__ */ jsx(Search, { size: 18, strokeWidth: 1.8, "aria-hidden": true }),
|
|
4323
|
-
/* @__PURE__ */ jsx("input", { type: "search", value: q, onChange: (event) => setQ(event.target.value), placeholder: t("Search {things}", { things: plural
|
|
4349
|
+
/* @__PURE__ */ jsx("input", { type: "search", value: q, onChange: (event) => setQ(event.target.value), placeholder: t("Search {things}", { things: inSentence(plural, locale) }), "aria-label": t("Search {things}", { things: inSentence(plural, locale) }), autoComplete: "off" })
|
|
4324
4350
|
] }),
|
|
4325
4351
|
groupItems(list.items).map((run, index) => /* @__PURE__ */ jsxs("section", { "aria-label": run.group ?? plural, children: [
|
|
4326
4352
|
run.group !== void 0 && /* @__PURE__ */ jsx("h2", { className: "cbx-eyebrow", children: run.group }),
|
|
@@ -4343,10 +4369,10 @@ function EnvironmentList({ level, parent, parentName, onPick }) {
|
|
|
4343
4369
|
" ",
|
|
4344
4370
|
/* @__PURE__ */ jsx("button", { type: "button", className: "cbx-link", onClick: list.retry, children: t("Try again") })
|
|
4345
4371
|
] }),
|
|
4346
|
-
list.status === "ready" && list.items.length === 0 && /* @__PURE__ */ jsx("p", { className: "cbx-list-note", "aria-live": "polite", children: q.trim() === "" ? t("No {things} yet.", { things: plural
|
|
4347
|
-
level.createUrl !== void 0 && /* @__PURE__ */ jsx("div", { className: "cbx-group", children: creating ? /* @__PURE__ */ jsx("div", { className: "cbx-grow is-static", children: /* @__PURE__ */ jsx(InlineCreate, { level, parent, label: parentName !== void 0 ? t("New {thing} in {name}", { thing: level.label
|
|
4372
|
+
list.status === "ready" && list.items.length === 0 && /* @__PURE__ */ jsx("p", { className: "cbx-list-note", "aria-live": "polite", children: q.trim() === "" ? t("No {things} yet.", { things: inSentence(plural, locale) }) : t("Nothing matches \u201C{query}\u201D.", { query: q.trim() }) }),
|
|
4373
|
+
level.createUrl !== void 0 && /* @__PURE__ */ jsx("div", { className: "cbx-group", children: creating ? /* @__PURE__ */ jsx("div", { className: "cbx-grow is-static", children: /* @__PURE__ */ jsx(InlineCreate, { level, parent, label: parentName !== void 0 ? t("New {thing} in {name}", { thing: inSentence(level.label, locale), name: parentName }) : t("New {thing}", { thing: inSentence(level.label, locale) }), onCancel: () => setCreating(false) }) }) : /* @__PURE__ */ jsxs("button", { type: "button", className: "cbx-grow is-accent", onClick: () => setCreating(true), children: [
|
|
4348
4374
|
/* @__PURE__ */ jsx(Plus, { size: 16, strokeWidth: 1.8, "aria-hidden": true }),
|
|
4349
|
-
/* @__PURE__ */ jsx("span", { className: "cbx-grow-label", children: t("New {thing}", { thing: level.label
|
|
4375
|
+
/* @__PURE__ */ jsx("span", { className: "cbx-grow-label", children: t("New {thing}", { thing: inSentence(level.label, locale) }) })
|
|
4350
4376
|
] }) })
|
|
4351
4377
|
] });
|
|
4352
4378
|
}
|
|
@@ -4598,50 +4624,33 @@ function CboxShell({ shell, children, navigate = defaultNavigate, LinkComponent
|
|
|
4598
4624
|
overlay === "apps-sheet" && /* @__PURE__ */ jsx(AppsSheet, { onClose: () => setOverlay("more") }),
|
|
4599
4625
|
overlay === "create" && /* @__PURE__ */ jsx(CreateSheet, { onClose: () => setOverlay(null) }, createKey ?? "tree")
|
|
4600
4626
|
] });
|
|
4601
|
-
|
|
4602
|
-
|
|
4603
|
-
return /* @__PURE__ */ jsx(ShellContext.Provider, { value: api, children: /* @__PURE__ */ jsxs("div", { className: "cbx-shell is-mobile", "data-help-open": helpOpen, children: [
|
|
4604
|
-
skip,
|
|
4605
|
-
/* @__PURE__ */ jsxs("div", { className: "cbx-shell-column", children: [
|
|
4606
|
-
/* @__PURE__ */ jsxs("header", { className: "cbx-m-chrome", hidden: moreOpen, children: [
|
|
4607
|
-
/* @__PURE__ */ jsx(MobileTopBar, {}),
|
|
4608
|
-
/* @__PURE__ */ jsx(MobileAreaHead, {}),
|
|
4609
|
-
strips
|
|
4610
|
-
] }),
|
|
4611
|
-
/* @__PURE__ */ jsxs("main", { id: mainId, tabIndex: -1, className: "cbx-shell-main canvas-gradient", children: [
|
|
4612
|
-
moreOpen && /* @__PURE__ */ jsx(MoreScreen, { view: moreView, setView: setMoreView }),
|
|
4613
|
-
/* @__PURE__ */ jsx(MobilePage, { hidden: moreOpen, children })
|
|
4614
|
-
] })
|
|
4615
|
-
] }),
|
|
4616
|
-
/* @__PURE__ */ jsx(
|
|
4617
|
-
TabBar,
|
|
4618
|
-
{
|
|
4619
|
-
onMore: () => {
|
|
4620
|
-
setMoreView({ kind: "root" });
|
|
4621
|
-
setOverlay("more");
|
|
4622
|
-
}
|
|
4623
|
-
}
|
|
4624
|
-
),
|
|
4625
|
-
/* @__PURE__ */ jsx(HelpColumn, { docked: false, mobile: true }),
|
|
4626
|
-
overlays
|
|
4627
|
-
] }) });
|
|
4628
|
-
}
|
|
4629
|
-
return /* @__PURE__ */ jsx(ShellContext.Provider, { value: api, children: /* @__PURE__ */ jsxs("div", { className: "cbx-shell", "data-help-open": helpOpen, children: [
|
|
4627
|
+
const moreOpen = mobile && (overlay === "more" || overlay === "apps-sheet" || overlay === "context-sheet" && contextStep.underMore === true);
|
|
4628
|
+
return /* @__PURE__ */ jsx(ShellContext.Provider, { value: api, children: /* @__PURE__ */ jsxs("div", { className: `cbx-shell${mobile ? " is-mobile" : ""}`, "data-help-open": helpOpen, children: [
|
|
4630
4629
|
skip,
|
|
4631
|
-
/* @__PURE__ */ jsx(Rail, { brandAssetBase }),
|
|
4630
|
+
!mobile && /* @__PURE__ */ jsx(Rail, { brandAssetBase }),
|
|
4632
4631
|
/* @__PURE__ */ jsxs("div", { className: "cbx-shell-column", children: [
|
|
4633
|
-
/* @__PURE__ */
|
|
4632
|
+
mobile ? /* @__PURE__ */ jsxs("header", { className: "cbx-m-chrome", hidden: moreOpen, children: [
|
|
4633
|
+
/* @__PURE__ */ jsx(MobileTopBar, {}),
|
|
4634
|
+
/* @__PURE__ */ jsx(MobileAreaHead, {})
|
|
4635
|
+
] }) : /* @__PURE__ */ jsx(Header, {}),
|
|
4634
4636
|
envBanner !== null && /* @__PURE__ */ jsxs("div", { className: `cbx-banner cbx-banner-env cbx-env-${envBanner.tone ?? "neutral"}`, role: "status", children: [
|
|
4635
4637
|
/* @__PURE__ */ jsx(ToneSquare, { tone: envBanner.tone }),
|
|
4636
4638
|
/* @__PURE__ */ jsx("span", { className: "cbx-banner-text", children: t("{environment}. Not production, nothing here touches live customers.", { environment: envBanner.name }) })
|
|
4637
4639
|
] }),
|
|
4638
|
-
strips,
|
|
4640
|
+
/* @__PURE__ */ jsx("div", { hidden: moreOpen, children: strips }),
|
|
4639
4641
|
/* @__PURE__ */ jsxs("div", { className: "cbx-shell-body", children: [
|
|
4640
|
-
/* @__PURE__ */ jsx(Subnav, {}),
|
|
4641
|
-
/* @__PURE__ */
|
|
4642
|
+
!mobile && /* @__PURE__ */ jsx(Subnav, {}),
|
|
4643
|
+
/* @__PURE__ */ jsxs("main", { id: mainId, tabIndex: -1, className: "cbx-shell-main canvas-gradient", children: [
|
|
4644
|
+
moreOpen && /* @__PURE__ */ jsx(MoreScreen, { view: moreView, setView: setMoreView }),
|
|
4645
|
+
/* @__PURE__ */ jsx(MobilePage, { hidden: moreOpen, children })
|
|
4646
|
+
] })
|
|
4642
4647
|
] })
|
|
4643
4648
|
] }),
|
|
4644
|
-
/* @__PURE__ */ jsx(
|
|
4649
|
+
mobile && /* @__PURE__ */ jsx(TabBar, { onMore: () => {
|
|
4650
|
+
setMoreView({ kind: "root" });
|
|
4651
|
+
setOverlay("more");
|
|
4652
|
+
} }),
|
|
4653
|
+
/* @__PURE__ */ jsx(HelpColumn, { docked: !mobile && docked, mobile }),
|
|
4645
4654
|
overlays
|
|
4646
4655
|
] }) });
|
|
4647
4656
|
}
|