@unofficialbox/box-open-elements 0.27.0 → 0.28.1

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.
Files changed (42) hide show
  1. package/README.md +13 -13
  2. package/dist/components/actions/button.d.ts +3 -0
  3. package/dist/components/actions/button.js +16 -1
  4. package/dist/components/collections/resource-row.d.ts +28 -0
  5. package/dist/components/collections/resource-row.js +75 -0
  6. package/dist/components/feedback/mode-indicator.d.ts +21 -0
  7. package/dist/components/feedback/mode-indicator.js +67 -0
  8. package/dist/components/feedback/progress-steps.d.ts +7 -2
  9. package/dist/components/feedback/progress-steps.js +42 -3
  10. package/dist/components/feedback/verdict-banner.d.ts +23 -0
  11. package/dist/components/feedback/verdict-banner.js +59 -0
  12. package/dist/components/forms/code-editor.d.ts +10 -0
  13. package/dist/components/forms/code-editor.js +54 -4
  14. package/dist/components/forms/number-input.d.ts +1 -0
  15. package/dist/components/forms/number-input.js +11 -0
  16. package/dist/components/forms/text-area.d.ts +1 -0
  17. package/dist/components/forms/text-area.js +2 -0
  18. package/dist/components/forms/text-field.d.ts +3 -0
  19. package/dist/components/forms/text-field.js +15 -1
  20. package/dist/components/forms/tile-group.d.ts +6 -0
  21. package/dist/components/forms/tile-group.js +29 -2
  22. package/dist/components/layout/app-shell.js +13 -3
  23. package/dist/components/layout/nav-sidebar.js +14 -2
  24. package/dist/components/overlays/dialog.d.ts +6 -0
  25. package/dist/components/overlays/dialog.js +18 -2
  26. package/dist/components/overlays/drawer.d.ts +3 -0
  27. package/dist/components/overlays/drawer.js +11 -3
  28. package/dist/entries/mode-indicator.d.ts +1 -0
  29. package/dist/entries/mode-indicator.js +1 -0
  30. package/dist/entries/resource-row.d.ts +1 -0
  31. package/dist/entries/resource-row.js +1 -0
  32. package/dist/entries/verdict-banner.d.ts +1 -0
  33. package/dist/entries/verdict-banner.js +1 -0
  34. package/dist/index.d.ts +3 -0
  35. package/dist/index.js +3 -0
  36. package/dist/patterns/flow-builder/flow-builder.d.ts +8 -0
  37. package/dist/patterns/flow-builder/flow-builder.js +34 -0
  38. package/dist/patterns/flow-builder/primitives.d.ts +14 -2
  39. package/dist/patterns/flow-builder/primitives.js +28 -5
  40. package/dist/patterns/form-wizard/form-wizard.js +31 -8
  41. package/dist/patterns/form-wizard/wizard-summary.js +11 -2
  42. package/package.json +1 -1
package/README.md CHANGED
@@ -12,7 +12,7 @@
12
12
 
13
13
  Browse the full catalog on the **[live docs site](https://unofficialbox.github.io/box-open-elements)** — live previews, an events/properties inspector, per-framework code snippets (React / Angular / Vue / Svelte / HTML), and the foundations pages.
14
14
 
15
- The library is organized around three layers (see [taxonomy](https://github.com/unofficialbox/box-open-elements/blob/v0.27.0/docs/taxonomy.md) for the canonical model):
15
+ The library is organized around three layers (see [taxonomy](https://github.com/unofficialbox/box-open-elements/blob/v0.28.1/docs/taxonomy.md) for the canonical model):
16
16
 
17
17
  - **Foundations** — design decisions as data: tokens, color, typography, iconography, accessibility, theming
18
18
  - **Components** — accessible Web Components for single controls, organized by category
@@ -77,7 +77,7 @@ selection.toggleSelection("1");
77
77
  - optimized component entrypoints: `@unofficialbox/box-open-elements/<name>`
78
78
  - patterns: `@unofficialbox/box-open-elements/patterns/<area>` and `@unofficialbox/box-open-elements/patterns/<area>/<module>`
79
79
 
80
- See the versioned [API guidelines](https://github.com/unofficialbox/box-open-elements/blob/v0.27.0/docs/api-guidelines.md).
80
+ See the versioned [API guidelines](https://github.com/unofficialbox/box-open-elements/blob/v0.28.1/docs/api-guidelines.md).
81
81
 
82
82
  ## Developing
83
83
 
@@ -91,17 +91,17 @@ bun run docs # build + serve the docs site at http://localhost:4600
91
91
 
92
92
  ## Documentation
93
93
 
94
- The versioned docs index is at [docs/README.md](https://github.com/unofficialbox/box-open-elements/blob/v0.27.0/docs/README.md). The most important entries:
95
-
96
- - [Taxonomy](https://github.com/unofficialbox/box-open-elements/blob/v0.27.0/docs/taxonomy.md)
97
- - [Architecture](https://github.com/unofficialbox/box-open-elements/blob/v0.27.0/docs/architecture.md)
98
- - [API Guidelines](https://github.com/unofficialbox/box-open-elements/blob/v0.27.0/docs/api-guidelines.md)
99
- - [Components catalog](https://github.com/unofficialbox/box-open-elements/blob/v0.27.0/docs/components/catalog.md) and [patterns catalog](https://github.com/unofficialbox/box-open-elements/blob/v0.27.0/docs/patterns/catalog.md)
100
- - [Using with React, Angular, Vue, and Svelte](https://github.com/unofficialbox/box-open-elements/blob/v0.27.0/docs/integration/frameworks.md)
101
- - [Design Tokens](https://github.com/unofficialbox/box-open-elements/blob/v0.27.0/docs/foundations/tokens.md)
102
- - [Content Explorer](https://github.com/unofficialbox/box-open-elements/blob/v0.27.0/docs/patterns/content-explorer.md)
103
- - [Box Server Integration](https://github.com/unofficialbox/box-open-elements/blob/v0.27.0/docs/integration/box-server.md)
104
- - [Agent UI guidelines](https://github.com/unofficialbox/box-open-elements/blob/v0.27.0/docs/patterns/agent-ui-guidelines.md), [building blocks](https://github.com/unofficialbox/box-open-elements/blob/v0.27.0/docs/patterns/agent-ui.md), and [motion](https://github.com/unofficialbox/box-open-elements/blob/v0.27.0/docs/foundations/motion.md)
94
+ The versioned docs index is at [docs/README.md](https://github.com/unofficialbox/box-open-elements/blob/v0.28.1/docs/README.md). The most important entries:
95
+
96
+ - [Taxonomy](https://github.com/unofficialbox/box-open-elements/blob/v0.28.1/docs/taxonomy.md)
97
+ - [Architecture](https://github.com/unofficialbox/box-open-elements/blob/v0.28.1/docs/architecture.md)
98
+ - [API Guidelines](https://github.com/unofficialbox/box-open-elements/blob/v0.28.1/docs/api-guidelines.md)
99
+ - [Components catalog](https://github.com/unofficialbox/box-open-elements/blob/v0.28.1/docs/components/catalog.md) and [patterns catalog](https://github.com/unofficialbox/box-open-elements/blob/v0.28.1/docs/patterns/catalog.md)
100
+ - [Using with React, Angular, Vue, and Svelte](https://github.com/unofficialbox/box-open-elements/blob/v0.28.1/docs/integration/frameworks.md)
101
+ - [Design Tokens](https://github.com/unofficialbox/box-open-elements/blob/v0.28.1/docs/foundations/tokens.md)
102
+ - [Content Explorer](https://github.com/unofficialbox/box-open-elements/blob/v0.28.1/docs/patterns/content-explorer.md)
103
+ - [Box Server Integration](https://github.com/unofficialbox/box-open-elements/blob/v0.28.1/docs/integration/box-server.md)
104
+ - [Agent UI guidelines](https://github.com/unofficialbox/box-open-elements/blob/v0.28.1/docs/patterns/agent-ui-guidelines.md), [building blocks](https://github.com/unofficialbox/box-open-elements/blob/v0.28.1/docs/patterns/agent-ui.md), and [motion](https://github.com/unofficialbox/box-open-elements/blob/v0.28.1/docs/foundations/motion.md)
105
105
 
106
106
  ## Contributing
107
107
 
@@ -21,6 +21,9 @@ export declare class Button extends BaseElement {
21
21
  set disabled(value: boolean);
22
22
  get label(): string;
23
23
  set label(value: string);
24
+ /** Optional spoken name for repeated actions whose visible label is brief. */
25
+ get accessibleLabel(): string;
26
+ set accessibleLabel(value: string);
24
27
  get size(): string;
25
28
  set size(value: string);
26
29
  get tone(): string;
@@ -188,7 +188,7 @@ export class Button extends BaseElement {
188
188
  static tagName = DEFAULT_TAG_NAME;
189
189
  static formAssociated = true;
190
190
  static get observedAttributes() {
191
- return ["disabled", "label", "size", "tone", "is-loading", "type"];
191
+ return ["accessible-label", "aria-label", "disabled", "label", "size", "tone", "is-loading", "type"];
192
192
  }
193
193
  buttonEl;
194
194
  focus(options) { if (!this.disabled)
@@ -234,6 +234,16 @@ export class Button extends BaseElement {
234
234
  set label(value) {
235
235
  this.setAttribute("label", value);
236
236
  }
237
+ /** Optional spoken name for repeated actions whose visible label is brief. */
238
+ get accessibleLabel() {
239
+ return this.getAttribute("accessible-label") ?? "";
240
+ }
241
+ set accessibleLabel(value) {
242
+ if (value)
243
+ this.setAttribute("accessible-label", value);
244
+ else
245
+ this.removeAttribute("accessible-label");
246
+ }
237
247
  get size() {
238
248
  return this.getAttribute("size") ?? "medium";
239
249
  }
@@ -294,6 +304,11 @@ export class Button extends BaseElement {
294
304
  this.buttonEl.dataset.tone = this.tone;
295
305
  this.buttonEl.dataset.size = this.size;
296
306
  this.labelEl.textContent = this.label;
307
+ const spokenLabel = this.accessibleLabel || this.getAttribute("aria-label");
308
+ if (spokenLabel)
309
+ this.buttonEl.setAttribute("aria-label", spokenLabel);
310
+ else
311
+ this.buttonEl.removeAttribute("aria-label");
297
312
  const busy = this.isLoading;
298
313
  this.spinnerEl.hidden = !busy;
299
314
  this.buttonEl.setAttribute("aria-busy", String(busy));
@@ -0,0 +1,28 @@
1
+ import { BaseElement } from "../../core/index.js";
2
+ /** Selectable resource information with independent slotted actions. Not a listbox option. */
3
+ export declare class ResourceRow extends BaseElement {
4
+ static readonly tagName = "box-resource-row";
5
+ static get observedAttributes(): string[];
6
+ private selectEl;
7
+ private labelEl;
8
+ private metaEl;
9
+ private statusEl;
10
+ private statusSlot;
11
+ get label(): string;
12
+ set label(value: string);
13
+ get meta(): string;
14
+ set meta(value: string);
15
+ get status(): string;
16
+ set status(value: string);
17
+ get value(): string;
18
+ set value(value: string);
19
+ get selected(): boolean;
20
+ set selected(value: boolean);
21
+ get active(): boolean;
22
+ set active(value: boolean);
23
+ get disabled(): boolean;
24
+ set disabled(value: boolean);
25
+ protected renderTemplate(): void;
26
+ protected setupListeners(): void;
27
+ protected update(): void;
28
+ }
@@ -0,0 +1,75 @@
1
+ import { BaseElement } from "../../core/index.js";
2
+ import { boeRadius } from "../../foundations/geometry/index.js";
3
+ const styles = `
4
+ :host { display:block; container-type:inline-size; font:inherit; color:var(--boe-token-text-text,#222); }
5
+ :host([hidden]) { display:none!important; }
6
+ [part="row"] { display:flex; align-items:center; gap:.75rem; min-inline-size:0; padding:.65rem; border:1px solid var(--boe-token-stroke-stroke,#dedede); border-radius:${boeRadius.med}; background:var(--boe-token-surface-surface,#fff); }
7
+ :host([selected]) [part="row"] { border-color:var(--boe-token-surface-surface-brand,#0061d5); background:color-mix(in srgb,var(--boe-token-surface-surface-brand,#0061d5) 7%,var(--boe-token-surface-surface,#fff)); }
8
+ :host([active]) [part="row"] { box-shadow:inset 0 0 0 1px var(--boe-token-surface-surface-brand,#0061d5); }
9
+ [part="select"] { flex:1 1 auto; min-inline-size:0; display:flex; align-items:center; gap:.65rem; padding:.25rem; border:0; border-radius:4px; background:none; color:inherit; font:inherit; text-align:start; cursor:pointer; }
10
+ [part="select"]:focus-visible { outline:2px solid var(--boe-token-surface-surface-brand,#0061d5); outline-offset:2px; }
11
+ [part="select"]:disabled { cursor:not-allowed; opacity:.55; }
12
+ [part="body"] { display:grid; gap:.15rem; min-inline-size:0; }
13
+ [part="label"] { font-weight:600; overflow-wrap:anywhere; }
14
+ [part="meta"] { color:var(--boe-token-text-text-secondary,#6f6f6f); font-size:.8em; white-space:pre-line; overflow-wrap:anywhere; }
15
+ [part="meta"]:empty, [part="status"]:empty { display:none; }
16
+ [part="trailing"] { flex:0 1 auto; display:flex; align-items:center; gap:.5rem; min-inline-size:0; }
17
+ [part="status"] { color:var(--boe-token-text-text-secondary,#6f6f6f); font-size:.8em; }
18
+ ::slotted([slot="actions"]) { flex:none; }
19
+ @container (max-width: 320px) { [part="row"] { align-items:stretch; flex-wrap:wrap; } [part="trailing"] { inline-size:100%; justify-content:space-between; padding-inline-start:2.5rem; } }
20
+ @media (prefers-reduced-motion:reduce) { *,*::before,*::after { transition:none!important; } }
21
+ `;
22
+ /** Selectable resource information with independent slotted actions. Not a listbox option. */
23
+ export class ResourceRow extends BaseElement {
24
+ static tagName = "box-resource-row";
25
+ static get observedAttributes() { return ["label", "meta", "status", "value", "selected", "active", "disabled"]; }
26
+ selectEl;
27
+ labelEl;
28
+ metaEl;
29
+ statusEl;
30
+ statusSlot;
31
+ get label() { return this.getAttribute("label") ?? ""; }
32
+ set label(value) { this.setAttribute("label", value); }
33
+ get meta() { return this.getAttribute("meta") ?? ""; }
34
+ set meta(value) { this.setAttribute("meta", value); }
35
+ get status() { return this.getAttribute("status") ?? ""; }
36
+ set status(value) { this.setAttribute("status", value); }
37
+ get value() { return this.getAttribute("value") ?? this.label; }
38
+ set value(value) { this.setAttribute("value", value); }
39
+ get selected() { return this.hasAttribute("selected"); }
40
+ set selected(value) { this.toggleAttribute("selected", value); }
41
+ get active() { return this.hasAttribute("active"); }
42
+ set active(value) { this.toggleAttribute("active", value); }
43
+ get disabled() { return this.hasAttribute("disabled"); }
44
+ set disabled(value) { this.toggleAttribute("disabled", value); }
45
+ renderTemplate() {
46
+ this.shadowRoot.innerHTML = `<style>${styles}</style><div part="row"><button part="select" type="button"><slot name="icon"></slot><span part="body"><span part="label"></span><span part="meta"></span></span></button><span part="trailing"><span part="status"></span><slot name="status"></slot><slot name="actions"></slot></span></div>`;
47
+ this.selectEl = this.shadowRoot.querySelector('[part="select"]');
48
+ this.labelEl = this.shadowRoot.querySelector('[part="label"]');
49
+ this.metaEl = this.shadowRoot.querySelector('[part="meta"]');
50
+ this.statusEl = this.shadowRoot.querySelector('[part="status"]');
51
+ this.statusSlot = this.shadowRoot.querySelector('slot[name="status"]');
52
+ }
53
+ setupListeners() {
54
+ this.selectEl.addEventListener("click", () => this.dispatchEvent(new CustomEvent("select", { bubbles: true, composed: true, detail: { value: this.value } })));
55
+ this.statusSlot.addEventListener("slotchange", () => this.update());
56
+ }
57
+ update() {
58
+ this.labelEl.textContent = this.label;
59
+ this.metaEl.textContent = this.meta;
60
+ this.statusEl.textContent = this.status;
61
+ this.statusEl.hidden = this.statusSlot.assignedElements().length > 0;
62
+ this.selectEl.disabled = this.disabled;
63
+ this.selectEl.setAttribute("aria-pressed", String(this.selected));
64
+ this.selectEl.setAttribute("aria-label", this.label);
65
+ const slottedStatus = this.statusSlot.assignedNodes({ flatten: true }).map(node => node instanceof Element
66
+ ? node.getAttribute("aria-label") ?? node.getAttribute("label") ?? node.textContent ?? ""
67
+ : node.textContent ?? "").map(value => value.trim()).filter(Boolean).join(" ");
68
+ const spokenStatus = this.status || slottedStatus;
69
+ if (this.meta || spokenStatus)
70
+ this.selectEl.setAttribute("aria-description", [this.meta.replaceAll("\n", ", "), spokenStatus].filter(Boolean).join("; "));
71
+ else
72
+ this.selectEl.removeAttribute("aria-description");
73
+ }
74
+ }
75
+ ResourceRow.register();
@@ -0,0 +1,21 @@
1
+ import { BaseElement } from "../../core/index.js";
2
+ /** Host-controlled dry/live indicator. The host owns the mode-change destination. */
3
+ export declare class ModeIndicator extends BaseElement {
4
+ static readonly tagName = "box-mode-indicator";
5
+ static get observedAttributes(): string[];
6
+ private indicatorEl;
7
+ private stateEl;
8
+ private detailEl;
9
+ private readonly announcement;
10
+ private previousMode;
11
+ get mode(): "dry" | "live";
12
+ set mode(value: "dry" | "live");
13
+ get detail(): string;
14
+ set detail(value: string);
15
+ get namePrefix(): string;
16
+ set namePrefix(value: string);
17
+ get interactive(): boolean;
18
+ set interactive(value: boolean);
19
+ protected renderTemplate(): void;
20
+ protected update(): void;
21
+ }
@@ -0,0 +1,67 @@
1
+ import { BaseElement } from "../../core/index.js";
2
+ import { FeedbackAnnouncement } from "../../foundations/a11y/announcer.js";
3
+ const styles = `
4
+ :host { display:inline-flex; max-inline-size:100%; font:inherit; color:var(--boe-token-text-text,#222); }
5
+ :host([hidden]) { display:none!important; }
6
+ [part="indicator"] { display:inline-flex; align-items:center; gap:.4rem; min-block-size:24px; min-inline-size:0; padding:.2rem .55rem; border-radius:999px; border:1px solid var(--boe-token-stroke-stroke,#dedede); background:var(--boe-token-surface-surface-secondary,#f4f4f4); color:inherit; font:inherit; text-align:start; }
7
+ button[part="indicator"] { cursor:pointer; }
8
+ button[part="indicator"]:focus-visible { outline:2px solid var(--boe-token-surface-surface-brand,#0061d5); outline-offset:2px; }
9
+ :host([mode="live"]) [part="indicator"] { border-color:var(--boe-token-text-status-text-error,#b92340); background:color-mix(in srgb,var(--boe-token-surface-status-surface-error,#ed3757) 9%,var(--boe-token-surface-surface,#fff)); }
10
+ [part="dot"] { flex:none; inline-size:.45rem; block-size:.45rem; border-radius:50%; background:var(--boe-token-text-text-secondary,#6f6f6f); }
11
+ :host([mode="live"]) [part="dot"] { background:var(--boe-token-text-status-text-error,#b92340); }
12
+ [part="state"] { font-weight:700; white-space:nowrap; }
13
+ [part="detail"] { min-inline-size:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
14
+ [part="detail"]:empty { display:none; }
15
+ :host([live-stripe][mode="live"]) { border-block-start:3px solid var(--boe-token-text-status-text-error,#b92340); }
16
+ @media (max-width:390px) { [part="detail"] { display:none; } }
17
+ `;
18
+ /** Host-controlled dry/live indicator. The host owns the mode-change destination. */
19
+ export class ModeIndicator extends BaseElement {
20
+ static tagName = "box-mode-indicator";
21
+ static get observedAttributes() { return ["mode", "detail", "name-prefix", "interactive", "live-stripe"]; }
22
+ indicatorEl;
23
+ stateEl;
24
+ detailEl;
25
+ announcement = new FeedbackAnnouncement();
26
+ previousMode = null;
27
+ get mode() { return this.getAttribute("mode") === "live" ? "live" : "dry"; }
28
+ set mode(value) { this.setAttribute("mode", value); }
29
+ get detail() { return this.getAttribute("detail") ?? ""; }
30
+ set detail(value) { this.setAttribute("detail", value); }
31
+ get namePrefix() { return this.getAttribute("name-prefix") ?? "Next run"; }
32
+ set namePrefix(value) { this.setAttribute("name-prefix", value); }
33
+ get interactive() { return this.hasAttribute("interactive"); }
34
+ set interactive(value) { this.toggleAttribute("interactive", value); }
35
+ renderTemplate() {
36
+ this.shadowRoot.innerHTML = `<style>${styles}</style><span part="indicator"><span part="dot" aria-hidden="true"></span><span part="state"></span><span part="detail"></span></span>`;
37
+ this.indicatorEl = this.shadowRoot.querySelector('[part="indicator"]');
38
+ this.stateEl = this.shadowRoot.querySelector('[part="state"]');
39
+ this.detailEl = this.shadowRoot.querySelector('[part="detail"]');
40
+ }
41
+ update() {
42
+ const mode = this.mode;
43
+ if (this.interactive !== (this.indicatorEl.tagName === "BUTTON")) {
44
+ const replacement = document.createElement(this.interactive ? "button" : "span");
45
+ replacement.setAttribute("part", "indicator");
46
+ if (!this.interactive)
47
+ replacement.setAttribute("role", "group");
48
+ if (replacement instanceof HTMLButtonElement)
49
+ replacement.type = "button";
50
+ replacement.append(...Array.from(this.indicatorEl.childNodes));
51
+ this.indicatorEl.replaceWith(replacement);
52
+ this.indicatorEl = replacement;
53
+ this.indicatorEl.addEventListener("click", () => { if (this.interactive)
54
+ this.dispatchEvent(new CustomEvent("activate", { bubbles: true, composed: true })); });
55
+ }
56
+ const state = mode === "live" ? "Live" : "Dry run";
57
+ if (!this.interactive)
58
+ this.indicatorEl.setAttribute("role", "group");
59
+ this.stateEl.textContent = state;
60
+ this.detailEl.textContent = this.detail ? `· ${this.detail}` : "";
61
+ this.indicatorEl.setAttribute("aria-label", `${this.namePrefix}: ${state}${this.detail ? `, ${this.detail}` : ""}`);
62
+ if (this.previousMode !== null && this.previousMode !== mode)
63
+ this.announcement.update(this, this.indicatorEl.getAttribute("aria-label") ?? "", "polite");
64
+ this.previousMode = mode;
65
+ }
66
+ }
67
+ ModeIndicator.register();
@@ -3,11 +3,12 @@ import { BaseElement } from "../../core/index.js";
3
3
  * Explicit per-step status. Absent means the step derives complete / current /
4
4
  * upcoming from its position relative to `value` — the behaviour existing
5
5
  * hosts rely on. An explicit status wins over the positional derivation:
6
- * `complete` marks out-of-order completion, `blocked` and `disabled` make the
6
+ * `complete` marks out-of-order completion, `visited` marks a reached step
7
+ * without claiming it passed validation, `blocked` and `disabled` make the
7
8
  * step non-interactive, `failed` stays interactive because a failed step is
8
9
  * usually exactly where the user needs to go.
9
10
  */
10
- export type ProgressStepStatus = "complete" | "blocked" | "failed" | "disabled";
11
+ export type ProgressStepStatus = "complete" | "visited" | "blocked" | "failed" | "disabled";
11
12
  export interface ProgressStepItem {
12
13
  description?: string;
13
14
  label: string;
@@ -46,7 +47,11 @@ export declare class ProgressSteps extends BaseElement {
46
47
  private valueInternal;
47
48
  private stepsEl;
48
49
  private liveEl;
50
+ private compactToggleEl;
51
+ private compactExpanded;
49
52
  private itemsSignature;
53
+ get compact(): boolean;
54
+ set compact(value: boolean);
50
55
  get label(): string;
51
56
  set label(value: string);
52
57
  get items(): ProgressStepItem[];
@@ -8,7 +8,7 @@ const escapeHtml = (value) => value
8
8
  .replaceAll(">", "&gt;")
9
9
  .replaceAll('"', "&quot;")
10
10
  .replaceAll("'", "&#39;");
11
- const STEP_STATUSES = new Set(["complete", "blocked", "failed", "disabled"]);
11
+ const STEP_STATUSES = new Set(["complete", "visited", "blocked", "failed", "disabled"]);
12
12
  /** Attribute payloads are author input — validate every record. */
13
13
  export const isProgressStepRecord = (value) => {
14
14
  if (typeof value !== "object" || value === null) {
@@ -46,6 +46,7 @@ export const resolveStepStates = (items, value) => {
46
46
  /** Every state in words — colour never carries the meaning alone. */
47
47
  export const STEP_STATE_LABEL = {
48
48
  complete: "Complete",
49
+ visited: "Visited",
49
50
  current: "Current step",
50
51
  upcoming: "Not started",
51
52
  blocked: "Blocked",
@@ -59,6 +60,23 @@ const progressStepsStyles = `
59
60
  font: inherit;
60
61
  }
61
62
 
63
+ [part="compact-toggle"] { display: none; }
64
+ @media (max-width: 600px) {
65
+ [part="compact-toggle"][data-enabled="true"] {
66
+ display: block;
67
+ width: 100%;
68
+ min-height: 36px;
69
+ text-align: left;
70
+ border: 1px solid var(--boe-token-stroke-stroke, #e8e8e8);
71
+ border-radius: ${boeRadius.med};
72
+ background: var(--boe-token-surface-surface, #ffffff);
73
+ color: var(--boe-token-text-text, #222222);
74
+ font: inherit;
75
+ padding: 0.45rem 0.65rem;
76
+ }
77
+ [part="steps"][data-compact="true"][data-expanded="false"] { display: none; }
78
+ }
79
+
62
80
  /* The host's own display would otherwise beat the UA rule for [hidden],
63
81
  leaving the element on screen when a host hides it. */
64
82
  :host([hidden]) {
@@ -124,6 +142,12 @@ const progressStepsStyles = `
124
142
  color: color-mix(in srgb, var(--boe-token-surface-status-surface-success, #26c281) 62%, var(--boe-token-text-text, #222222));
125
143
  }
126
144
 
145
+ [part="step"][data-state="visited"] [part="marker"] {
146
+ border-color: color-mix(in srgb, var(--boe-token-surface-surface-brand, #0061d5) 30%, transparent);
147
+ background: color-mix(in srgb, var(--boe-token-surface-surface-brand, #0061d5) 9%, var(--boe-token-surface-surface, #ffffff));
148
+ color: var(--boe-token-text-text, #222222);
149
+ }
150
+
127
151
  [part="step"][data-state="current"] [part="marker"] {
128
152
  border-color: transparent;
129
153
  background: var(--boe-token-surface-surface-brand, #0061d5);
@@ -214,12 +238,16 @@ const progressStepsStyles = `
214
238
  export class ProgressSteps extends BaseElement {
215
239
  static tagName = DEFAULT_TAG_NAME;
216
240
  static get observedAttributes() {
217
- return ["items", "label", "value"];
241
+ return ["compact", "items", "label", "value"];
218
242
  }
219
243
  valueInternal = "";
220
244
  stepsEl;
221
245
  liveEl;
246
+ compactToggleEl;
247
+ compactExpanded = false;
222
248
  itemsSignature = "";
249
+ get compact() { return this.hasAttribute("compact"); }
250
+ set compact(value) { this.toggleAttribute("compact", Boolean(value)); }
223
251
  get label() {
224
252
  return this.getAttribute("label") ?? "Progress Steps";
225
253
  }
@@ -270,13 +298,19 @@ export class ProgressSteps extends BaseElement {
270
298
  }
271
299
  this.shadowRoot.innerHTML = `
272
300
  <style>${progressStepsStyles}</style>
273
- <div part="steps" role="group"></div>
301
+ <button type="button" part="compact-toggle" aria-controls="progress-steps-list" aria-expanded="false"></button>
302
+ <div id="progress-steps-list" part="steps" role="group"></div>
274
303
  <div part="live" class="boe-sr-only" aria-live="polite"></div>
275
304
  `;
276
305
  this.stepsEl = this.shadowRoot.querySelector('[part="steps"]');
306
+ this.compactToggleEl = this.shadowRoot.querySelector('[part="compact-toggle"]');
277
307
  this.liveEl = this.shadowRoot.querySelector('[part="live"]');
278
308
  }
279
309
  setupListeners() {
310
+ this.compactToggleEl.addEventListener("click", () => {
311
+ this.compactExpanded = !this.compactExpanded;
312
+ this.update();
313
+ });
280
314
  this.stepsEl.addEventListener("click", event => {
281
315
  const step = event.target.closest('[part="step"]');
282
316
  if (!step || !this.stepsEl.contains(step)) {
@@ -397,6 +431,11 @@ export class ProgressSteps extends BaseElement {
397
431
  }
398
432
  this.stepsEl.setAttribute("aria-label", this.label);
399
433
  const resolved = resolveStepStates(items, this.valueInternal);
434
+ this.compactToggleEl.dataset.enabled = String(this.compact);
435
+ this.compactToggleEl.setAttribute("aria-expanded", String(this.compactExpanded));
436
+ this.compactToggleEl.textContent = `Step ${activeIndex + 1} of ${items.length}: ${items[activeIndex]?.label ?? ""} · ${this.compactExpanded ? "Hide steps" : "Show steps"}`;
437
+ this.stepsEl.dataset.compact = String(this.compact);
438
+ this.stepsEl.dataset.expanded = String(this.compactExpanded);
400
439
  const tabbable = this.tabbableIndex(resolved);
401
440
  const signature = JSON.stringify(items);
402
441
  if (signature !== this.itemsSignature) {
@@ -0,0 +1,23 @@
1
+ import { BaseElement } from "../../core/index.js";
2
+ /** Finished-run verdict with a single action and one-time polite announcement. */
3
+ export declare class VerdictBanner extends BaseElement {
4
+ static readonly tagName = "box-verdict-banner";
5
+ static get observedAttributes(): string[];
6
+ private readonly headingId;
7
+ private readonly announcement;
8
+ private headingEl;
9
+ private reasonsEl;
10
+ private iconEl;
11
+ private reasonsValue;
12
+ private announced;
13
+ get tone(): "passed" | "missed" | "none";
14
+ set tone(value: "passed" | "missed" | "none");
15
+ get heading(): string;
16
+ set heading(value: string);
17
+ get headingLevel(): number;
18
+ set headingLevel(value: number);
19
+ get reasons(): string[];
20
+ set reasons(value: string[]);
21
+ protected renderTemplate(): void;
22
+ protected update(): void;
23
+ }
@@ -0,0 +1,59 @@
1
+ import { BaseElement } from "../../core/index.js";
2
+ import { FeedbackAnnouncement } from "../../foundations/a11y/announcer.js";
3
+ import { boeRadius } from "../../foundations/geometry/index.js";
4
+ import { toneIcon } from "./tone.js";
5
+ const styles = `
6
+ :host { display:block; font:inherit; color:var(--boe-token-text-text,#222); container-type:inline-size; }
7
+ :host([hidden]) { display:none!important; }
8
+ [part="banner"] { display:grid; grid-template-columns:20px minmax(0,1fr) auto; align-items:start; gap:.7rem; padding:1rem; border-radius:${boeRadius.med}; border:1px solid var(--boe-token-stroke-stroke,#dedede); background:var(--boe-token-surface-surface-secondary,#f4f4f4); }
9
+ :host([tone="passed"]) [part="banner"] { border-color:var(--boe-token-text-status-text-success,#187657); background:color-mix(in srgb,var(--boe-token-surface-status-surface-success,#26c281) 9%,var(--boe-token-surface-surface,#fff)); }
10
+ :host([tone="missed"]) [part="banner"] { border-color:var(--boe-token-text-status-text-error,#b92340); background:color-mix(in srgb,var(--boe-token-surface-status-surface-error,#ed3757) 9%,var(--boe-token-surface-surface,#fff)); }
11
+ [part="icon"] { inline-size:20px; block-size:20px; color:var(--boe-token-text-text-secondary,#6f6f6f); }
12
+ :host([tone="passed"]) [part="icon"] { color:var(--boe-token-text-status-text-success,#187657); }
13
+ :host([tone="missed"]) [part="icon"] { color:var(--boe-token-text-status-text-error,#b92340); }
14
+ [part="icon"] svg { inline-size:100%; block-size:100%; }
15
+ [part="body"] { min-inline-size:0; }
16
+ [part="heading"] { margin:0; font:inherit; font-weight:700; overflow-wrap:anywhere; }
17
+ [part="reasons"] { margin:.45rem 0 0; padding-inline-start:1.2rem; overflow-wrap:anywhere; }
18
+ [part="reasons"]:empty { display:none; }
19
+ @container (max-width:320px) { [part="banner"] { grid-template-columns:20px minmax(0,1fr); } [part="action"] { grid-column:2; } }
20
+ `;
21
+ let nextHeadingId = 0;
22
+ /** Finished-run verdict with a single action and one-time polite announcement. */
23
+ export class VerdictBanner extends BaseElement {
24
+ static tagName = "box-verdict-banner";
25
+ static get observedAttributes() { return ["tone", "heading", "heading-level"]; }
26
+ headingId = `boe-verdict-${++nextHeadingId}`;
27
+ announcement = new FeedbackAnnouncement();
28
+ headingEl;
29
+ reasonsEl;
30
+ iconEl;
31
+ reasonsValue = [];
32
+ announced = false;
33
+ get tone() { const value = this.getAttribute("tone"); return value === "passed" || value === "missed" ? value : "none"; }
34
+ set tone(value) { this.setAttribute("tone", value); }
35
+ get heading() { return this.getAttribute("heading") ?? ""; }
36
+ set heading(value) { this.setAttribute("heading", value); }
37
+ get headingLevel() { const value = Number(this.getAttribute("heading-level") ?? 2); return Number.isInteger(value) && value >= 1 && value <= 6 ? value : 2; }
38
+ set headingLevel(value) { this.setAttribute("heading-level", String(value)); }
39
+ get reasons() { return [...this.reasonsValue]; }
40
+ set reasons(value) { this.reasonsValue = [...value]; if (this.isRendered)
41
+ this.update(); }
42
+ renderTemplate() {
43
+ this.shadowRoot.innerHTML = `<style>${styles}</style><section part="banner" role="group" aria-labelledby="${this.headingId}"><span part="icon" aria-hidden="true"></span><div part="body"><div part="heading" id="${this.headingId}" role="heading"></div><ul part="reasons"></ul></div><span part="action"><slot name="action"></slot></span></section>`;
44
+ this.headingEl = this.shadowRoot.querySelector('[part="heading"]');
45
+ this.reasonsEl = this.shadowRoot.querySelector('[part="reasons"]');
46
+ this.iconEl = this.shadowRoot.querySelector('[part="icon"]');
47
+ }
48
+ update() {
49
+ this.headingEl.textContent = this.heading;
50
+ this.headingEl.setAttribute("aria-level", String(this.headingLevel));
51
+ this.iconEl.innerHTML = toneIcon(this.tone === "passed" ? "success" : this.tone === "missed" ? "error" : "info");
52
+ this.reasonsEl.replaceChildren(...this.reasonsValue.map(reason => { const item = document.createElement("li"); item.textContent = reason; return item; }));
53
+ if (!this.announced && this.heading && this.tone !== "none") {
54
+ this.announced = true;
55
+ this.announcement.update(this, this.heading, "polite");
56
+ }
57
+ }
58
+ }
59
+ VerdictBanner.register();
@@ -38,6 +38,7 @@ export declare class CodeEditor extends BaseElement {
38
38
  private readonlyConfig;
39
39
  private completionsConfig;
40
40
  private wrapConfig;
41
+ private wrapIndentConfig;
41
42
  private highlightsConfig;
42
43
  private highlightsInternal;
43
44
  private source?;
@@ -55,10 +56,19 @@ export declare class CodeEditor extends BaseElement {
55
56
  }): void;
56
57
  get wrap(): boolean;
57
58
  set wrap(value: boolean);
59
+ get currentLineStyle(): "fill" | "border" | "none";
60
+ set currentLineStyle(value: "fill" | "border" | "none");
61
+ get hideHelp(): boolean;
62
+ set hideHelp(value: boolean);
63
+ get hideProblems(): boolean;
64
+ set hideProblems(value: boolean);
65
+ get fillHeight(): boolean;
66
+ set fillHeight(value: boolean);
58
67
  get completionSource(): CodeCompletionSource | undefined;
59
68
  set completionSource(value: CodeCompletionSource | undefined);
60
69
  get highlights(): readonly CodeHighlight[];
61
70
  set highlights(value: readonly CodeHighlight[]);
71
+ private wrapIndentExtension;
62
72
  private highlightExtension;
63
73
  get language(): string;
64
74
  set language(value: string);