@cboxdk/cbox-ui 0.15.2 → 0.15.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/dist/index.js +64 -25
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/tokens/shell.css +7 -3
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
|
},
|
|
@@ -2575,6 +2594,15 @@ function HelpColumn({ docked, mobile = false }) {
|
|
|
2575
2594
|
environment !== void 0 && /* @__PURE__ */ jsx("span", { className: `cbx-tone cbx-tone-${environment.tone ?? "neutral"}`, "aria-hidden": "true" }),
|
|
2576
2595
|
/* @__PURE__ */ jsx("span", { className: "cbx-truncate", title: t("Cbox sees this page: {page} in {where}", { page: topic, where }), children: t("Cbox sees this page: {page} in {where}", { page: topic, where }) })
|
|
2577
2596
|
] });
|
|
2597
|
+
const typed = query2.trim();
|
|
2598
|
+
const askTyped = typed !== "" && chatReady && /* @__PURE__ */ jsx("div", { className: "cbx-group cbx-help-resume", children: /* @__PURE__ */ jsxs("button", { type: "button", className: "cbx-grow is-tall", "data-help-ask": "", onClick: () => askCbox(typed), children: [
|
|
2599
|
+
/* @__PURE__ */ jsx("span", { className: "cbx-tile is-accent", "aria-hidden": "true", children: /* @__PURE__ */ jsx(Sparkles, { size: 16, strokeWidth: 1.8 }) }),
|
|
2600
|
+
/* @__PURE__ */ jsxs("span", { className: "cbx-grow-text", children: [
|
|
2601
|
+
/* @__PURE__ */ jsx("span", { className: "cbx-grow-strong cbx-truncate", title: typed, children: t("Ask Cbox: \u201C{query}\u201D", { query: typed }) }),
|
|
2602
|
+
/* @__PURE__ */ jsx("span", { className: "cbx-grow-sub cbx-truncate", children: t("Answers with what you see on {page}", { page: topic }) })
|
|
2603
|
+
] }),
|
|
2604
|
+
/* @__PURE__ */ jsx(CornerDownLeft, { className: "cbx-grow-trail", size: 16, strokeWidth: 1.8, "aria-hidden": true })
|
|
2605
|
+
] }) });
|
|
2578
2606
|
const home = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2579
2607
|
unavailable && /* @__PURE__ */ jsxs("div", { className: "cbx-help-notice", role: "status", children: [
|
|
2580
2608
|
/* @__PURE__ */ jsx(CircleAlert, { size: 16, strokeWidth: 1.8, "aria-hidden": true }),
|
|
@@ -2599,15 +2627,19 @@ function HelpColumn({ docked, mobile = false }) {
|
|
|
2599
2627
|
chatReady && context(false)
|
|
2600
2628
|
] }),
|
|
2601
2629
|
chatProblem && /* @__PURE__ */ jsx("p", { className: "cbx-create-error", role: "alert", children: t("The chat could not be opened. Try again, or use the support portal.") }),
|
|
2630
|
+
askTyped,
|
|
2602
2631
|
results !== null ? /* @__PURE__ */ jsxs("section", { "aria-labelledby": "cbx-help-results", "aria-live": "polite", children: [
|
|
2603
2632
|
/* @__PURE__ */ jsx("h3", { id: "cbx-help-results", className: "cbx-help-heading", children: t("Results") }),
|
|
2604
2633
|
results.items.length > 0 && /* @__PURE__ */ jsx("div", { className: "cbx-group", children: results.items.map((item) => /* @__PURE__ */ jsx(ArticleRow, { article: item }, item.id)) }),
|
|
2605
2634
|
results.status === "ready" && results.items.length === 0 && /* @__PURE__ */ jsx("p", { className: "cbx-list-note", children: chatReady ? t("No articles match. Send it to ask Cbox.") : t("Nothing matches \u201C{query}\u201D.", { query: results.q }) }),
|
|
2606
2635
|
results.status === "loading" && results.items.length === 0 && /* @__PURE__ */ jsx("p", { className: "cbx-list-note", children: t("Searching\u2026") })
|
|
2607
2636
|
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2608
|
-
|
|
2637
|
+
chatReady && typed === "" && /* @__PURE__ */ jsx("div", { className: "cbx-group cbx-help-resume", children: /* @__PURE__ */ jsxs("button", { type: "button", className: "cbx-grow is-tall", "data-help-chat": "", onClick: () => void openChat(), children: [
|
|
2609
2638
|
/* @__PURE__ */ jsx("span", { className: "cbx-tile is-accent", "aria-hidden": "true", children: /* @__PURE__ */ jsx(MessageSquare, { size: 16, strokeWidth: 1.8 }) }),
|
|
2610
|
-
/* @__PURE__ */
|
|
2639
|
+
/* @__PURE__ */ jsxs("span", { className: "cbx-grow-text", children: [
|
|
2640
|
+
/* @__PURE__ */ jsx("span", { className: "cbx-grow-strong cbx-truncate", children: chatKnown ? t("Continue the conversation") : t("Ask Cbox") }),
|
|
2641
|
+
/* @__PURE__ */ jsx("span", { className: "cbx-grow-sub cbx-truncate", children: t("Answers with what you see on {page}", { page: topic }) })
|
|
2642
|
+
] }),
|
|
2611
2643
|
/* @__PURE__ */ jsx(ChevronRight, { className: "cbx-grow-trail", size: 16, strokeWidth: 1.8, "aria-hidden": true })
|
|
2612
2644
|
] }) }),
|
|
2613
2645
|
updates.length > 0 && /* @__PURE__ */ jsxs("section", { "aria-labelledby": "cbx-help-updates", children: [
|
|
@@ -2949,6 +2981,7 @@ function rows(body, group) {
|
|
|
2949
2981
|
return Array.isArray(data) ? data.filter((row) => typeof row === "object" && row !== null) : [];
|
|
2950
2982
|
}
|
|
2951
2983
|
function CommandPalette({ onClose }) {
|
|
2984
|
+
const { locale } = useCboxLocalization();
|
|
2952
2985
|
const { shell, t, help: helpStore, navigate, switchTo, openArticle, ask, mobile, openContext, openCreate, canCreate, searchRecords } = useShell();
|
|
2953
2986
|
const [scope, setScope] = useState("all");
|
|
2954
2987
|
const [input, setInput] = useState("");
|
|
@@ -3126,7 +3159,7 @@ function CommandPalette({ onClose }) {
|
|
|
3126
3159
|
const createItem2 = (key) => {
|
|
3127
3160
|
const creatable = findCreatable(shell, key);
|
|
3128
3161
|
if (creatable === void 0 || !canCreate) return null;
|
|
3129
|
-
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: () => {
|
|
3130
3163
|
onClose();
|
|
3131
3164
|
openCreate(key);
|
|
3132
3165
|
} };
|
|
@@ -3153,7 +3186,7 @@ function CommandPalette({ onClose }) {
|
|
|
3153
3186
|
if (organization !== void 0) {
|
|
3154
3187
|
switchItems.push({
|
|
3155
3188
|
id: "switch:organization",
|
|
3156
|
-
title: t("Switch {thing}", { thing: organization.label
|
|
3189
|
+
title: t("Switch {thing}", { thing: inSentence(organization.label, locale) }),
|
|
3157
3190
|
subtitle: t("Now {name}", { name: organization.current.name }),
|
|
3158
3191
|
kind: "actions",
|
|
3159
3192
|
icon: /* @__PURE__ */ jsx(ArrowLeftRight, { size: 16, strokeWidth: 1.8, "aria-hidden": true }),
|
|
@@ -3437,12 +3470,13 @@ function findCreatable(shell, key) {
|
|
|
3437
3470
|
function pageCreateKey(shell) {
|
|
3438
3471
|
return findCreatable(shell, shell.page?.create)?.key ?? findCreatable(shell, shell.create?.default)?.key ?? null;
|
|
3439
3472
|
}
|
|
3440
|
-
function createLabel(shell, t) {
|
|
3473
|
+
function createLabel(shell, t, locale = "en") {
|
|
3441
3474
|
const own = findCreatable(shell, shell.page?.create);
|
|
3442
|
-
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");
|
|
3443
3476
|
}
|
|
3444
3477
|
function CreateSheet({ onClose }) {
|
|
3445
3478
|
const { shell, t, mobile, createKey, renderCreate } = useShell();
|
|
3479
|
+
const { locale } = useCboxLocalization();
|
|
3446
3480
|
const [stack, setStack] = useState(() => findCreatable(shell, createKey) !== void 0 ? [{ kind: "tree" }, { kind: "form", key: createKey }] : [{ kind: "tree" }]);
|
|
3447
3481
|
const guards = useRef(/* @__PURE__ */ new Map());
|
|
3448
3482
|
const [leaving, setLeaving] = useState(null);
|
|
@@ -3467,7 +3501,7 @@ function CreateSheet({ onClose }) {
|
|
|
3467
3501
|
else pop();
|
|
3468
3502
|
return true;
|
|
3469
3503
|
};
|
|
3470
|
-
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) });
|
|
3471
3505
|
return /* @__PURE__ */ jsxs(
|
|
3472
3506
|
Sheet2,
|
|
3473
3507
|
{
|
|
@@ -3493,7 +3527,7 @@ function CreateSheet({ onClose }) {
|
|
|
3493
3527
|
const form = {
|
|
3494
3528
|
creatable,
|
|
3495
3529
|
parent,
|
|
3496
|
-
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) }),
|
|
3497
3531
|
createRef: (key, onCreated) => {
|
|
3498
3532
|
if (findCreatable(shell, key) === void 0) return;
|
|
3499
3533
|
const returnFocus = document.activeElement instanceof HTMLElement ? document.activeElement : void 0;
|
|
@@ -3522,7 +3556,7 @@ function CreateSheet({ onClose }) {
|
|
|
3522
3556
|
onOpenChange: (open) => {
|
|
3523
3557
|
if (!open) setLeaving(null);
|
|
3524
3558
|
},
|
|
3525
|
-
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) }),
|
|
3526
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."),
|
|
3527
3561
|
footer: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3528
3562
|
/* @__PURE__ */ jsx(Button, { onClick: () => setLeaving(null), children: t("Keep editing") }),
|
|
@@ -3578,6 +3612,7 @@ function CreateField({ label, children, htmlFor }) {
|
|
|
3578
3612
|
}
|
|
3579
3613
|
function CreateRefField({ label, value, placeholder, thing, onChoose, onCreate }) {
|
|
3580
3614
|
const { t } = useShell();
|
|
3615
|
+
const { locale } = useCboxLocalization();
|
|
3581
3616
|
const id = useId();
|
|
3582
3617
|
return /* @__PURE__ */ jsxs("div", { className: "cbx-cfield", role: "group", "aria-labelledby": id, children: [
|
|
3583
3618
|
/* @__PURE__ */ jsx("span", { id, className: "cbx-cfield-label", children: label }),
|
|
@@ -3588,7 +3623,7 @@ function CreateRefField({ label, value, placeholder, thing, onChoose, onCreate }
|
|
|
3588
3623
|
] }),
|
|
3589
3624
|
/* @__PURE__ */ jsxs("button", { type: "button", className: "cbx-grow is-accent", onClick: onCreate, children: [
|
|
3590
3625
|
/* @__PURE__ */ jsx(Plus, { size: 16, strokeWidth: 1.8, "aria-hidden": true }),
|
|
3591
|
-
/* @__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) }) })
|
|
3592
3627
|
] })
|
|
3593
3628
|
] })
|
|
3594
3629
|
] });
|
|
@@ -3885,6 +3920,7 @@ function useUnread() {
|
|
|
3885
3920
|
}
|
|
3886
3921
|
function MobileTopBar() {
|
|
3887
3922
|
const { shell, t, openContext, toggleHelp, setOverlay, openCreate, canCreate, overlay } = useShell();
|
|
3923
|
+
const { locale } = useCboxLocalization();
|
|
3888
3924
|
const apps = useRef(null);
|
|
3889
3925
|
const levels = shell.context.levels;
|
|
3890
3926
|
const organization = levels[0];
|
|
@@ -3912,7 +3948,7 @@ function MobileTopBar() {
|
|
|
3912
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 }) }),
|
|
3913
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 }) }),
|
|
3914
3950
|
/* @__PURE__ */ jsx(Popover, { open: overlay === "apps", anchor: apps, placement: "bottom-end", label: t("Switch app"), onClose: () => setOverlay(null), children: /* @__PURE__ */ jsx(AppGrid, {}) }),
|
|
3915
|
-
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 }) })
|
|
3916
3952
|
] });
|
|
3917
3953
|
}
|
|
3918
3954
|
function MobileAreaHead() {
|
|
@@ -4226,6 +4262,7 @@ function useMoreView() {
|
|
|
4226
4262
|
}
|
|
4227
4263
|
function ContextSheet({ onClose }) {
|
|
4228
4264
|
const { shell, t, switchTo, contextStep } = useShell();
|
|
4265
|
+
const { locale } = useCboxLocalization();
|
|
4229
4266
|
const [step, setStep] = useState(contextStep.step);
|
|
4230
4267
|
const direct = contextStep.direct;
|
|
4231
4268
|
const levels = shell.context.levels;
|
|
@@ -4250,7 +4287,7 @@ function ContextSheet({ onClose }) {
|
|
|
4250
4287
|
parent: parent?.current.id,
|
|
4251
4288
|
currentId: level.current.id,
|
|
4252
4289
|
heading: pluralOf(level),
|
|
4253
|
-
createLabel: t("New {thing}", { thing: level.label
|
|
4290
|
+
createLabel: t("New {thing}", { thing: inSentence(level.label, locale) }),
|
|
4254
4291
|
onPick: (item) => index === 0 ? switchTo({ [level.key]: item.id }) : void pickKeepingEnvironment(level, inner, item, switchTo)
|
|
4255
4292
|
}
|
|
4256
4293
|
) }) });
|
|
@@ -4259,6 +4296,7 @@ function ContextSheet({ onClose }) {
|
|
|
4259
4296
|
}
|
|
4260
4297
|
function ContextRoot({ onStep }) {
|
|
4261
4298
|
const { shell, t, switchTo } = useShell();
|
|
4299
|
+
const { locale } = useCboxLocalization();
|
|
4262
4300
|
const levels = shell.context.levels;
|
|
4263
4301
|
const environment = environmentLevel(levels);
|
|
4264
4302
|
const above = levels.filter((level) => level !== environment);
|
|
@@ -4291,7 +4329,7 @@ function ContextRoot({ onStep }) {
|
|
|
4291
4329
|
] }, item.id);
|
|
4292
4330
|
}),
|
|
4293
4331
|
/* @__PURE__ */ jsxs("button", { type: "button", className: "cbx-grow is-accent", onClick: () => onStep("environments"), children: [
|
|
4294
|
-
/* @__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) }) }),
|
|
4295
4333
|
/* @__PURE__ */ jsx(Trail, {})
|
|
4296
4334
|
] })
|
|
4297
4335
|
] })
|
|
@@ -4300,6 +4338,7 @@ function ContextRoot({ onStep }) {
|
|
|
4300
4338
|
}
|
|
4301
4339
|
function EnvironmentList({ level, parent, parentName, onPick }) {
|
|
4302
4340
|
const { t } = useShell();
|
|
4341
|
+
const { locale } = useCboxLocalization();
|
|
4303
4342
|
const [q, setQ] = useState("");
|
|
4304
4343
|
const [creating, setCreating] = useState(false);
|
|
4305
4344
|
const list = useContextList(level.listUrl, { q, parent });
|
|
@@ -4307,7 +4346,7 @@ function EnvironmentList({ level, parent, parentName, onPick }) {
|
|
|
4307
4346
|
return /* @__PURE__ */ jsxs("div", { className: "cbx-env-list", children: [
|
|
4308
4347
|
/* @__PURE__ */ jsxs("label", { className: "cbx-field-search", children: [
|
|
4309
4348
|
/* @__PURE__ */ jsx(Search, { size: 18, strokeWidth: 1.8, "aria-hidden": true }),
|
|
4310
|
-
/* @__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" })
|
|
4311
4350
|
] }),
|
|
4312
4351
|
groupItems(list.items).map((run, index) => /* @__PURE__ */ jsxs("section", { "aria-label": run.group ?? plural, children: [
|
|
4313
4352
|
run.group !== void 0 && /* @__PURE__ */ jsx("h2", { className: "cbx-eyebrow", children: run.group }),
|
|
@@ -4330,10 +4369,10 @@ function EnvironmentList({ level, parent, parentName, onPick }) {
|
|
|
4330
4369
|
" ",
|
|
4331
4370
|
/* @__PURE__ */ jsx("button", { type: "button", className: "cbx-link", onClick: list.retry, children: t("Try again") })
|
|
4332
4371
|
] }),
|
|
4333
|
-
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
|
|
4334
|
-
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: [
|
|
4335
4374
|
/* @__PURE__ */ jsx(Plus, { size: 16, strokeWidth: 1.8, "aria-hidden": true }),
|
|
4336
|
-
/* @__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) }) })
|
|
4337
4376
|
] }) })
|
|
4338
4377
|
] });
|
|
4339
4378
|
}
|