@fasl-work/caos-app-shell 0.6.1 → 0.6.2
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.d.ts +12 -0
- package/dist/index.js +13 -2
- package/package.json +1 -1
- package/styles.css +4 -0
package/dist/index.d.ts
CHANGED
|
@@ -262,6 +262,18 @@ interface CaseSelectorProps {
|
|
|
262
262
|
deepLink?: boolean | string;
|
|
263
263
|
ariaLabel?: string;
|
|
264
264
|
className?: string;
|
|
265
|
+
/**
|
|
266
|
+
* How the one-of-N choice is presented. Default 'chips' keeps the labelled chip
|
|
267
|
+
* blocks; 'select' renders a native dropdown with one optgroup per category.
|
|
268
|
+
*
|
|
269
|
+
* ADR-0071 rule 7 asks for the dropdown whenever the deck is a categorised
|
|
270
|
+
* one-of-N choice, because the chip layout spends vertical space linearly in the
|
|
271
|
+
* number of cases and that space is taken from the instrument on every render.
|
|
272
|
+
* Measured on Porvenir at 2560x1440: ten cases in four categories occupied a
|
|
273
|
+
* 308px block, 21% of the viewport, for a choice one control expresses. The
|
|
274
|
+
* category structure is preserved either way; only the height changes.
|
|
275
|
+
*/
|
|
276
|
+
layout?: 'chips' | 'select';
|
|
265
277
|
}
|
|
266
278
|
/**
|
|
267
279
|
* CaseSelector v2 — the shared source + case picker. Renders (1) an optional first-level source
|
package/dist/index.js
CHANGED
|
@@ -568,7 +568,8 @@ function CaseSelector(props) {
|
|
|
568
568
|
text,
|
|
569
569
|
deepLink,
|
|
570
570
|
ariaLabel,
|
|
571
|
-
className
|
|
571
|
+
className,
|
|
572
|
+
layout = "chips"
|
|
572
573
|
} = props;
|
|
573
574
|
const t = { ...TEXT[lang], ...text };
|
|
574
575
|
const baseId = useId();
|
|
@@ -606,7 +607,17 @@ function CaseSelector(props) {
|
|
|
606
607
|
)) })
|
|
607
608
|
] }),
|
|
608
609
|
source && source !== "synthetic" && /* @__PURE__ */ jsx("p", { className: "cs-locked banner", children: lockedNote ?? t.lockedNote }),
|
|
609
|
-
|
|
610
|
+
layout === "select" && /* @__PURE__ */ jsx(
|
|
611
|
+
"select",
|
|
612
|
+
{
|
|
613
|
+
className: "select cs-select",
|
|
614
|
+
"aria-label": ariaLabel ?? "Case selector",
|
|
615
|
+
value: selectedId,
|
|
616
|
+
onChange: (e) => onSelect(e.target.value),
|
|
617
|
+
children: groups.map((g) => /* @__PURE__ */ jsx("optgroup", { label: g.category || " ", children: g.cases.map((c) => /* @__PURE__ */ jsx("option", { value: c.id, disabled: c.disabled, title: caseTooltip(c) || void 0, children: `${c.id} \xB7 ${c.name}` }, c.id)) }, g.category || "_"))
|
|
618
|
+
}
|
|
619
|
+
),
|
|
620
|
+
layout === "chips" && groups.map((g) => /* @__PURE__ */ jsxs("div", { className: "cs-group", role: "group", "aria-label": g.category || void 0, children: [
|
|
610
621
|
g.category && /* @__PURE__ */ jsx("span", { className: "cs-group-label", children: g.category }),
|
|
611
622
|
/* @__PURE__ */ jsx("div", { className: "cs-chips", children: g.cases.map((c) => {
|
|
612
623
|
const on = c.id === selectedId;
|
package/package.json
CHANGED
package/styles.css
CHANGED
|
@@ -316,3 +316,7 @@ html, body { overflow-x: hidden; }
|
|
|
316
316
|
[data-arch-lang] .l-es { display: none; }
|
|
317
317
|
[data-arch-lang="es"] .l-en { display: none; }
|
|
318
318
|
[data-arch-lang="es"] .l-es { display: inline; }
|
|
319
|
+
|
|
320
|
+
/* The compact one-of-N case picker (ADR-0071 rule 7). Ten cases in four categories
|
|
321
|
+
cost a 308px chip block, 21% of a 2560x1440 viewport, and one row as a dropdown. */
|
|
322
|
+
.cs-select { width: 100%; max-width: 460px; }
|