@unofficialbox/box-open-elements 0.22.0 → 0.24.0

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 (137) hide show
  1. package/README.md +15 -12
  2. package/dist/components/actions/button.js +3 -3
  3. package/dist/components/actions/menu-item.js +1 -1
  4. package/dist/components/actions/menu.js +1 -1
  5. package/dist/components/actions/segmented-control.d.ts +1 -0
  6. package/dist/components/actions/segmented-control.js +20 -6
  7. package/dist/components/collections/carousel.js +1 -1
  8. package/dist/components/collections/draggable-list.js +1 -1
  9. package/dist/components/collections/grid-view.js +1 -1
  10. package/dist/components/collections/pagination.js +1 -1
  11. package/dist/components/collections/result-blocks.d.ts +13 -1
  12. package/dist/components/collections/result-blocks.js +22 -10
  13. package/dist/components/collections/tree-grid.js +1 -1
  14. package/dist/components/feedback/alert.js +2 -2
  15. package/dist/components/feedback/chip.js +1 -1
  16. package/dist/components/feedback/empty-state.js +1 -1
  17. package/dist/components/feedback/nudge.js +1 -1
  18. package/dist/components/feedback/progress-bar.js +2 -2
  19. package/dist/components/feedback/status-icon.d.ts +2 -0
  20. package/dist/components/feedback/status-icon.js +6 -5
  21. package/dist/components/feedback/toast.js +1 -1
  22. package/dist/components/files/drop-zone.js +1 -1
  23. package/dist/components/forms/category-selector.js +1 -1
  24. package/dist/components/forms/checkbox-group.js +1 -1
  25. package/dist/components/forms/checkbox.js +5 -3
  26. package/dist/components/forms/code-editor.d.ts +61 -0
  27. package/dist/components/forms/code-editor.js +382 -0
  28. package/dist/components/forms/combobox.js +1 -1
  29. package/dist/components/forms/date-field.js +1 -1
  30. package/dist/components/forms/dropdown.js +1 -1
  31. package/dist/components/forms/multi-select.js +1 -1
  32. package/dist/components/forms/number-input.js +5 -2
  33. package/dist/components/forms/radio-group.js +1 -1
  34. package/dist/components/forms/range-slider.js +1 -1
  35. package/dist/components/forms/slider.js +1 -1
  36. package/dist/components/forms/tile-group.js +1 -1
  37. package/dist/components/layout/sidebar-toggle-button.js +1 -1
  38. package/dist/components/navigation/accordion.js +1 -1
  39. package/dist/components/navigation/tabs.js +1 -1
  40. package/dist/components/output/code-block.js +1 -1
  41. package/dist/components/overlays/dialog.js +1 -1
  42. package/dist/components/overlays/drawer.js +1 -1
  43. package/dist/components/overlays/guide-tooltip.js +1 -1
  44. package/dist/components/overlays/popover.js +1 -1
  45. package/dist/components/overlays/tooltip.js +1 -1
  46. package/dist/core/form-associated.d.ts +1 -0
  47. package/dist/core/form-associated.js +3 -0
  48. package/dist/entries/code-editor.d.ts +1 -0
  49. package/dist/entries/code-editor.js +1 -0
  50. package/dist/foundations/icons/box-iconography.generated.d.ts +1 -472
  51. package/dist/foundations/icons/box-iconography.generated.js +2 -472
  52. package/dist/foundations/icons/glyphs/constants.d.ts +472 -0
  53. package/dist/foundations/icons/glyphs/constants.js +473 -0
  54. package/dist/foundations/icons/glyphs/index.d.ts +1 -1
  55. package/dist/foundations/icons/glyphs/index.js +1 -1
  56. package/dist/foundations/motion/scroll-pin.d.ts +10 -2
  57. package/dist/foundations/motion/scroll-pin.js +43 -7
  58. package/dist/foundations/motion/tokens.d.ts +1 -0
  59. package/dist/foundations/motion/tokens.js +1 -0
  60. package/dist/foundations/profiles/built-ins.js +8 -0
  61. package/dist/foundations/profiles/registry.d.ts +1 -0
  62. package/dist/foundations/profiles/registry.js +1 -0
  63. package/dist/foundations/profiles/types.d.ts +1 -0
  64. package/dist/foundations/status/index.d.ts +4 -2
  65. package/dist/foundations/status/index.js +10 -6
  66. package/dist/foundations/theming/controller.js +3 -1
  67. package/dist/foundations/tokens/box-defaults.d.ts +2 -0
  68. package/dist/foundations/tokens/box-defaults.js +32 -5
  69. package/dist/foundations/tokens/index.d.ts +1 -1
  70. package/dist/foundations/tokens/index.js +1 -1
  71. package/dist/index.d.ts +2 -1
  72. package/dist/index.js +2 -1
  73. package/dist/patterns/agent-chat/agent-chat.js +9 -10
  74. package/dist/patterns/agent-chat/controller.js +8 -4
  75. package/dist/patterns/agent-chat/ndjson.d.ts +1 -0
  76. package/dist/patterns/agent-chat/ndjson.js +20 -4
  77. package/dist/patterns/agent-chat/types.d.ts +7 -0
  78. package/dist/patterns/agent-workspace/agent-workspace.d.ts +13 -1
  79. package/dist/patterns/agent-workspace/agent-workspace.js +47 -15
  80. package/dist/patterns/agent-workspace/controller.d.ts +7 -1
  81. package/dist/patterns/agent-workspace/controller.js +41 -3
  82. package/dist/patterns/call-console/call-console.d.ts +10 -0
  83. package/dist/patterns/call-console/call-console.js +23 -8
  84. package/dist/patterns/call-console/controller.d.ts +2 -1
  85. package/dist/patterns/call-console/controller.js +5 -3
  86. package/dist/patterns/call-console/http-transport.js +13 -2
  87. package/dist/patterns/call-console/types.d.ts +1 -1
  88. package/dist/patterns/call-console/types.js +2 -2
  89. package/dist/patterns/comments/comment-thread.js +1 -1
  90. package/dist/patterns/content-explorer/adapters/action-menu.js +1 -1
  91. package/dist/patterns/content-explorer/adapters/list.js +1 -1
  92. package/dist/patterns/content-explorer/adapters/table.js +1 -1
  93. package/dist/patterns/content-explorer/adapters/toolbar.js +1 -1
  94. package/dist/patterns/content-uploader/content-uploader.js +1 -1
  95. package/dist/patterns/file-request/file-request-builder.js +1 -1
  96. package/dist/patterns/flow-builder/flow-builder.d.ts +2 -0
  97. package/dist/patterns/flow-builder/flow-builder.js +14 -8
  98. package/dist/patterns/flow-builder/model.d.ts +2 -0
  99. package/dist/patterns/flow-builder/model.js +3 -3
  100. package/dist/patterns/flow-builder/primitives.d.ts +1 -0
  101. package/dist/patterns/flow-builder/primitives.js +5 -4
  102. package/dist/patterns/governance/governance-panel.js +1 -1
  103. package/dist/patterns/insights/chart-panel.js +1 -1
  104. package/dist/patterns/insights/metric-card.js +3 -3
  105. package/dist/patterns/item/bulk-action-bar.js +1 -1
  106. package/dist/patterns/item/item-details-panel.js +1 -1
  107. package/dist/patterns/item/item-form.js +1 -1
  108. package/dist/patterns/item/preview-header.js +1 -1
  109. package/dist/patterns/metadata/metadata-filter-builder.js +1 -1
  110. package/dist/patterns/metadata/metadata-inspector.js +1 -1
  111. package/dist/patterns/preview/annotation-inspector.js +1 -1
  112. package/dist/patterns/preview/annotation-toolbar.js +1 -1
  113. package/dist/patterns/process-modeler/index.d.ts +2 -0
  114. package/dist/patterns/process-modeler/index.js +2 -0
  115. package/dist/patterns/process-modeler/model.d.ts +95 -0
  116. package/dist/patterns/process-modeler/model.js +113 -0
  117. package/dist/patterns/process-modeler/process-modeler.d.ts +82 -0
  118. package/dist/patterns/process-modeler/process-modeler.js +861 -0
  119. package/dist/patterns/run/progress.d.ts +1 -1
  120. package/dist/patterns/run/progress.js +1 -1
  121. package/dist/patterns/run/run-summary.js +18 -4
  122. package/dist/patterns/run/run-trace.js +19 -5
  123. package/dist/patterns/search/filter-bar.js +1 -1
  124. package/dist/patterns/search/saved-view-picker.js +1 -1
  125. package/dist/patterns/search/search-results-header.js +1 -1
  126. package/dist/patterns/share/invite-collaborators-modal.js +1 -1
  127. package/dist/patterns/share/permission-matrix.js +1 -1
  128. package/dist/patterns/share/share-panel.js +1 -1
  129. package/dist/patterns/share/unified-share-modal.js +1 -1
  130. package/dist/patterns/task/review-queue-item.js +1 -1
  131. package/dist/patterns/task/task-assignment-panel.js +1 -1
  132. package/dist/patterns/undo/index.js +5 -3
  133. package/docs/api-guidelines.md +284 -0
  134. package/docs/foundations/motion.md +83 -0
  135. package/docs/patterns/agent-ui-guidelines.md +57 -0
  136. package/docs/patterns/agent-ui.md +197 -0
  137. package/package.json +23 -2
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 [docs/taxonomy.md](./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.24.0/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
@@ -21,6 +21,8 @@ The library is organized around three layers (see [docs/taxonomy.md](./docs/taxo
21
21
  Core implementation principles:
22
22
 
23
23
  - plain TypeScript modules, no React requirement in the core package — zero runtime dependencies
24
+ - Optional `code-editor` entrypoint uses CodeMirror 6; its dependencies are not
25
+ loaded by the root catalog or other component imports.
24
26
  - state and business logic separate from rendering: controllers and stores, not framework components
25
27
  - standard DOM events where a UI layer needs them
26
28
  - accessibility semantics and keyboard support as part of the component contract
@@ -75,7 +77,7 @@ selection.toggleSelection("1");
75
77
  - optimized component entrypoints: `@unofficialbox/box-open-elements/<name>`
76
78
  - patterns: `@unofficialbox/box-open-elements/patterns/<area>` and `@unofficialbox/box-open-elements/patterns/<area>/<module>`
77
79
 
78
- See [docs/api-guidelines.md](./docs/api-guidelines.md).
80
+ See the versioned [API guidelines](https://github.com/unofficialbox/box-open-elements/blob/v0.24.0/docs/api-guidelines.md).
79
81
 
80
82
  ## Developing
81
83
 
@@ -89,16 +91,17 @@ bun run docs # build + serve the docs site at http://localhost:4600
89
91
 
90
92
  ## Documentation
91
93
 
92
- The docs index is at [docs/README.md](./docs/README.md). The most important entries:
93
-
94
- - [Taxonomy](./docs/taxonomy.md)
95
- - [Architecture](./docs/architecture.md)
96
- - [API Guidelines](./docs/api-guidelines.md)
97
- - [Components catalog](./docs/components/catalog.md) and [patterns catalog](./docs/patterns/catalog.md)
98
- - [Using with React, Angular, Vue, and Svelte](./docs/integration/frameworks.md)
99
- - [Design Tokens](./docs/foundations/tokens.md)
100
- - [Content Explorer](./docs/patterns/content-explorer.md)
101
- - [Box Server Integration](./docs/integration/box-server.md)
94
+ The versioned docs index is at [docs/README.md](https://github.com/unofficialbox/box-open-elements/blob/v0.24.0/docs/README.md). The most important entries:
95
+
96
+ - [Taxonomy](https://github.com/unofficialbox/box-open-elements/blob/v0.24.0/docs/taxonomy.md)
97
+ - [Architecture](https://github.com/unofficialbox/box-open-elements/blob/v0.24.0/docs/architecture.md)
98
+ - [API Guidelines](https://github.com/unofficialbox/box-open-elements/blob/v0.24.0/docs/api-guidelines.md)
99
+ - [Components catalog](https://github.com/unofficialbox/box-open-elements/blob/v0.24.0/docs/components/catalog.md) and [patterns catalog](https://github.com/unofficialbox/box-open-elements/blob/v0.24.0/docs/patterns/catalog.md)
100
+ - [Using with React, Angular, Vue, and Svelte](https://github.com/unofficialbox/box-open-elements/blob/v0.24.0/docs/integration/frameworks.md)
101
+ - [Design Tokens](https://github.com/unofficialbox/box-open-elements/blob/v0.24.0/docs/foundations/tokens.md)
102
+ - [Content Explorer](https://github.com/unofficialbox/box-open-elements/blob/v0.24.0/docs/patterns/content-explorer.md)
103
+ - [Box Server Integration](https://github.com/unofficialbox/box-open-elements/blob/v0.24.0/docs/integration/box-server.md)
104
+ - [Agent UI guidelines](https://github.com/unofficialbox/box-open-elements/blob/v0.24.0/docs/patterns/agent-ui-guidelines.md), [building blocks](https://github.com/unofficialbox/box-open-elements/blob/v0.24.0/docs/patterns/agent-ui.md), and [motion](https://github.com/unofficialbox/box-open-elements/blob/v0.24.0/docs/foundations/motion.md)
102
105
 
103
106
  ## Contributing
104
107
 
@@ -64,7 +64,7 @@ const buttonStyles = `
64
64
  outline: none;
65
65
  background: var(--boe-token-surface-surface-brand-hover, #006ae9);
66
66
  border-color: var(--boe-token-surface-surface-brand, #0061d5);
67
- box-shadow: ${boeControl.primaryFocusShadow};
67
+ box-shadow: 0 0 0 2px var(--boe-token-surface-surface, #ffffff), 0 0 0 5px var(--boe-token-surface-surface-brand, #0061d5);
68
68
  }
69
69
 
70
70
  button[data-tone="neutral"] {
@@ -86,7 +86,7 @@ const buttonStyles = `
86
86
 
87
87
  button[data-tone="neutral"]:focus-visible {
88
88
  border-color: var(--boe-token-text-text, #222222);
89
- box-shadow: 0 1px 2px rgb(0 0 0 / 10%);
89
+ box-shadow: 0 0 0 2px var(--boe-token-surface-surface, #ffffff), 0 0 0 5px var(--boe-token-surface-surface-brand, #0061d5);
90
90
  }
91
91
 
92
92
  button[data-tone="danger"] {
@@ -106,7 +106,7 @@ const buttonStyles = `
106
106
  }
107
107
 
108
108
  button[data-tone="danger"]:focus-visible {
109
- box-shadow: inset 0 0 0 1px rgb(255 255 255 / 80%), 0 1px 2px rgb(0 0 0 / 10%);
109
+ box-shadow: 0 0 0 2px var(--boe-token-surface-surface, #ffffff), 0 0 0 5px var(--boe-token-surface-surface-brand, #0061d5);
110
110
  }
111
111
 
112
112
  button[data-size="small"] {
@@ -1,6 +1,6 @@
1
1
  import { BaseElement } from "../../core/index.js";
2
2
  import { boeControl, boeOverlay } from "../../foundations/geometry/index.js";
3
- import { boeNeutralInteractiveStyles } from "../../foundations/tokens/index.js";
3
+ import { boeNeutralInteractiveStyles } from "../../foundations/tokens/interaction.js";
4
4
  import { boeMotionDuration, boeMotionEasing } from "../../foundations/motion/index.js";
5
5
  const DEFAULT_TAG_NAME = "box-menu-item";
6
6
  const menuItemStyles = `
@@ -1,7 +1,7 @@
1
1
  import { BaseElement } from "../../core/index.js";
2
2
  import { applyRovingTabindex, focusRovingItem, nextRovingIndex, } from "../../foundations/a11y/index.js";
3
3
  import { boeControl, boeOverlay, boeSpace } from "../../foundations/geometry/index.js";
4
- import { boeNeutralInteractiveStyles } from "../../foundations/tokens/index.js";
4
+ import { boeNeutralInteractiveStyles } from "../../foundations/tokens/interaction.js";
5
5
  import { boeMotionDuration, boeMotionEasing } from "../../foundations/motion/index.js";
6
6
  const DEFAULT_TAG_NAME = "box-menu";
7
7
  const escapeHtml = (value) => value
@@ -9,6 +9,7 @@ export declare class SegmentedControl extends BaseElement {
9
9
  static get observedAttributes(): string[];
10
10
  private valueInternal;
11
11
  private controlEl;
12
+ private renderedOptions;
12
13
  get disabled(): boolean;
13
14
  set disabled(value: boolean);
14
15
  get label(): string;
@@ -84,6 +84,7 @@ export class SegmentedControl extends BaseElement {
84
84
  }
85
85
  valueInternal = "";
86
86
  controlEl;
87
+ renderedOptions = "";
87
88
  get disabled() {
88
89
  return this.hasAttribute("disabled");
89
90
  }
@@ -121,17 +122,17 @@ export class SegmentedControl extends BaseElement {
121
122
  }
122
123
  }
123
124
  set options(value) {
124
- this.setAttribute("options", JSON.stringify(value));
125
+ const serialized = JSON.stringify(value);
126
+ if (serialized !== this.getAttribute("options"))
127
+ this.setAttribute("options", serialized);
125
128
  }
126
129
  get value() {
127
130
  return this.valueInternal;
128
131
  }
129
132
  set value(nextValue) {
130
- this.valueInternal = nextValue;
133
+ if (nextValue === this.valueInternal)
134
+ return;
131
135
  this.setAttribute("value", nextValue);
132
- if (this.isRendered) {
133
- this.update();
134
- }
135
136
  }
136
137
  attributeChangedCallback(name, oldValue, newValue) {
137
138
  if (name === "value") {
@@ -198,7 +199,20 @@ export class SegmentedControl extends BaseElement {
198
199
  this.controlEl.dataset.layout = this.layout;
199
200
  this.controlEl.setAttribute("aria-label", this.label);
200
201
  this.controlEl.setAttribute("aria-disabled", String(this.disabled));
201
- // Rebuild segments (count may change)
202
+ const serialized = JSON.stringify(options);
203
+ if (serialized === this.renderedOptions) {
204
+ this.controlEl.querySelectorAll('[part="segment"]').forEach((button, index) => {
205
+ const selected = options[index].value === selectedValue;
206
+ button.dataset.layout = this.layout;
207
+ button.dataset.selected = String(selected);
208
+ button.setAttribute("aria-checked", String(selected));
209
+ button.tabIndex = selected ? 0 : -1;
210
+ button.disabled = this.disabled || Boolean(options[index].disabled);
211
+ });
212
+ return;
213
+ }
214
+ this.renderedOptions = serialized;
215
+ // Rebuild only when the options themselves change.
202
216
  this.controlEl.innerHTML = options
203
217
  .map((option, index) => {
204
218
  const position = options.length === 1
@@ -1,5 +1,5 @@
1
1
  import { BaseElement } from "../../core/index.js";
2
- import { boeNeutralInteractiveStyles } from "../../foundations/tokens/index.js";
2
+ import { boeNeutralInteractiveStyles } from "../../foundations/tokens/interaction.js";
3
3
  import { boeMotionDuration, boeMotionEasing } from "../../foundations/motion/index.js";
4
4
  import { boeRadius } from "../../foundations/geometry/index.js";
5
5
  const DEFAULT_TAG_NAME = "box-carousel";
@@ -1,5 +1,5 @@
1
1
  import { BaseElement } from "../../core/index.js";
2
- import { boeNeutralInteractiveStyles } from "../../foundations/tokens/index.js";
2
+ import { boeNeutralInteractiveStyles } from "../../foundations/tokens/interaction.js";
3
3
  import { boeRadius } from "../../foundations/geometry/index.js";
4
4
  const DEFAULT_TAG_NAME = "box-draggable-list";
5
5
  const escapeHtml = (value) => value
@@ -1,5 +1,5 @@
1
1
  import { BaseElement } from "../../core/index.js";
2
- import { boeNeutralInteractiveStyles } from "../../foundations/tokens/index.js";
2
+ import { boeNeutralInteractiveStyles } from "../../foundations/tokens/interaction.js";
3
3
  import { boeMotionDuration, boeMotionEasing } from "../../foundations/motion/index.js";
4
4
  import { boeRadius } from "../../foundations/geometry/index.js";
5
5
  import { boxIconography } from "../../foundations/icons/index.js";
@@ -1,5 +1,5 @@
1
1
  import { BaseElement } from "../../core/index.js";
2
- import { boeNeutralInteractiveStyles } from "../../foundations/tokens/index.js";
2
+ import { boeNeutralInteractiveStyles } from "../../foundations/tokens/interaction.js";
3
3
  import { boeMotionDuration, boeMotionEasing } from "../../foundations/motion/index.js";
4
4
  import { boeRadius } from "../../foundations/geometry/index.js";
5
5
  const DEFAULT_TAG_NAME = "box-pagination";
@@ -1,5 +1,11 @@
1
1
  import { BaseElement } from "../../core/element.js";
2
2
  export type CheckStatus = "pass" | "warn" | "fail" | "info";
3
+ export type ResultLabels = Record<CheckStatus, string>;
4
+ export interface ResultRenderOptions {
5
+ labels?: Partial<ResultLabels>;
6
+ linkSuffix?: string;
7
+ selectableDocuments?: boolean;
8
+ }
3
9
  export type ResultBlock = {
4
10
  id?: string;
5
11
  } & ({
@@ -40,13 +46,19 @@ export type ResultBlock = {
40
46
  });
41
47
  export declare const resultDocumentIds: (blocks: readonly ResultBlock[]) => string[];
42
48
  /** Pure escaped renderer also usable by host-composed conversations. */
43
- export declare function renderResultBlock(block: ResultBlock): string;
49
+ export declare function renderResultBlock(block: ResultBlock, options?: ResultRenderOptions): string;
44
50
  export declare const resultBlockStyles: string;
45
51
  export declare class ResultBlocks extends BaseElement {
46
52
  static readonly tagName: string;
53
+ static get observedAttributes(): string[];
47
54
  private value;
55
+ private verdictLabels;
48
56
  get blocks(): ResultBlock[];
49
57
  set blocks(value: ResultBlock[]);
58
+ get labels(): Partial<ResultLabels>;
59
+ set labels(value: Partial<ResultLabels>);
60
+ get selectableDocuments(): boolean;
61
+ set selectableDocuments(value: boolean);
50
62
  get documentIds(): string[];
51
63
  protected renderTemplate(): void;
52
64
  protected setupListeners(): void;
@@ -1,28 +1,30 @@
1
1
  import { BaseElement } from "../../core/element.js";
2
2
  import { isSafeHref } from "../../patterns/internal/safe-href.js";
3
- import { boeStatusGlyph, boeStatusStyles, statusLabel, toStatusKind } from "../../foundations/status/index.js";
3
+ import { boeStatusGlyph, boeStatusStyles, toStatusKind } from "../../foundations/status/index.js";
4
4
  import { boeEntrance, boeEntranceKeyframes, boeReducedMotionPolicy, boeStaggerStyles } from "../../foundations/motion/index.js";
5
5
  const escape = (s) => s.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
6
- const verdict = (s) => ({ pass: "Within policy", warn: "Needs exception", fail: "Outside policy", info: "Information" })[s];
6
+ const defaultLabels = { pass: "Within policy", warn: "Needs exception", fail: "Outside policy", info: "Information" };
7
+ const verdict = (s, labels = {}) => labels[s] ?? defaultLabels[s];
7
8
  const glyph = (s) => boeStatusGlyph(toStatusKind(s));
8
9
  export const resultDocumentIds = (blocks) => [...new Set(blocks.flatMap(b => b.type === "documents" ? b.items.map(i => i.id) : []))];
9
10
  /** Pure escaped renderer also usable by host-composed conversations. */
10
- export function renderResultBlock(block) {
11
+ export function renderResultBlock(block, options = {}) {
11
12
  const heading = block.title ? `<h3 part="title">${escape(block.title)}</h3>` : "";
12
13
  if (block.type === "facts")
13
14
  return `${heading}<dl part="facts">${block.rows.map(r => `<div part="row"><dt>${escape(r.label)}</dt><dd>${escape(r.value)}</dd></div>`).join("")}</dl>`;
14
15
  if (block.type === "checks")
15
- return `${heading}<ul part="checks">${block.rows.map(r => `<li part="row">${glyph(r.status)}<div><strong>${escape(r.label)}</strong>${r.detail ? `<p>${escape(r.detail)}</p>` : ""}</div><span part="verdict" data-status="${r.status}">${escape(r.value ?? verdict(r.status))}</span></li>`).join("")}</ul>`;
16
+ return `${heading}<ul part="checks">${block.rows.map(r => `<li part="row">${glyph(r.status)}<div><strong>${escape(r.label)}</strong>${r.detail ? `<p>${escape(r.detail)}</p>` : ""}</div><span part="verdict" data-status="${r.status}">${escape(r.value ?? verdict(r.status, options.labels))}</span></li>`).join("")}</ul>`;
16
17
  if (block.type === "documents")
17
18
  return `${heading}<ul part="documents">${block.items.map(i => {
18
19
  const content = `<svg aria-hidden="true" width="16" height="20" viewBox="0 0 16 20"><path d="M2 1h8l4 4v14H2zM10 1v5h4" fill="none" stroke="currentColor"/></svg><span><strong>${escape(i.name)}</strong>${i.detail ? `<small>${escape(i.detail)}</small>` : ""}</span>`;
19
- return `<li part="row">${i.href && isSafeHref(i.href) ? `<a part="document" data-document-id="${escape(i.id)}" href="${escape(i.href)}" target="_blank" rel="noopener noreferrer">${content}</a>` : `<button part="document" data-document-id="${escape(i.id)}">${content}</button>`}</li>`;
20
+ const link = i.href && isSafeHref(i.href);
21
+ return `<li part="row">${link ? `<a part="document" data-document-id="${escape(i.id)}" href="${escape(i.href)}" target="_blank" rel="noopener noreferrer">${content}<span part="external" aria-hidden="true">↗</span><span class="sr">${escape(options.linkSuffix ?? " (opens in new tab)")}</span></a>` : options.selectableDocuments ? `<button part="document" data-document-id="${escape(i.id)}">${content}</button>` : `<span part="document">${content}</span>`}</li>`;
20
22
  }).join("")}</ul>`;
21
- return `${heading}<div part="table-frame" role="region" aria-label="${escape(block.title ?? "Results")}" tabindex="0"><table><thead><tr>${block.columns.map(c => `<th scope="col">${escape(c)}</th>`).join("")}</tr></thead><tbody>${block.rows.map(r => `<tr>${r.cells.map((cell, index) => index === 0 ? `<th scope="row">${r.status ? `${glyph(r.status)}<span class="sr">${statusLabel(toStatusKind(r.status))}: </span>` : ""}${escape(cell)}${r.note ? `<small>${escape(r.note)}</small>` : ""}</th>` : `<td>${escape(cell)}</td>`).join("")}</tr>`).join("")}</tbody></table></div>${block.footnote ? `<p>${escape(block.footnote)}</p>` : ""}`;
23
+ return `${heading}<div part="table-frame" role="region" aria-label="${escape(block.title ?? "Results")}" tabindex="0"><table><thead><tr>${block.columns.map(c => `<th scope="col">${escape(c)}</th>`).join("")}</tr></thead><tbody>${block.rows.map(r => `<tr>${r.cells.map((cell, index) => index === 0 ? `<th scope="row">${r.status ? glyph(r.status) : ""}${escape(cell)}${r.note ? `<small>${escape(r.note)}</small>` : r.status ? `<span class="sr"> (${escape(verdict(r.status, options.labels))})</span>` : ""}</th>` : `<td>${escape(cell)}</td>`).join("")}</tr>`).join("")}</tbody></table></div>${block.footnote ? `<p>${escape(block.footnote)}</p>` : ""}`;
22
24
  }
23
25
  export const resultBlockStyles = `
24
26
  :host { display:block; min-width:0; color:var(--boe-token-text-text,#222); font:inherit; }
25
- :host([hidden]){display:none !important} *{box-sizing:border-box} h3{font-size:1em;margin:0 0 .5rem} dl,ul{padding:0;margin:0;list-style:none}
27
+ :host([hidden]){display:none !important} *{box-sizing:border-box} h3{font-size:var(--boe-result-title-size,1em);margin:0 0 .5rem} :host([title-style="eyebrow"]) h3{font-size:.72em;letter-spacing:.08em;text-transform:uppercase;color:var(--boe-token-text-text-secondary,#666)} dl,ul{padding:0;margin:0;list-style:none}
26
28
  [part="row"]{border-bottom:1px solid var(--boe-token-stroke-stroke,#ddd);padding:.7rem 0;display:flex;gap:.6rem;align-items:baseline}
27
29
  dt{color:var(--boe-token-text-text-secondary,#666)} dd{margin:0 0 0 auto;font-variant-numeric:tabular-nums}
28
30
  [part="facts"] [part="row"]{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);overflow-wrap:anywhere}
@@ -31,17 +33,25 @@ dt{color:var(--boe-token-text-text-secondary,#666)} dd{margin:0 0 0 auto;font-va
31
33
  p{margin:.25rem 0;color:var(--boe-token-text-text-secondary,#666)} small{display:block;font-weight:normal;color:var(--boe-token-text-text-secondary,#666)}
32
34
  [part="verdict"]{margin-left:auto;text-align:right} [data-status="warn"]{color:var(--boe-token-text-status-text-warning,#946400)} [data-status="fail"]{color:var(--boe-token-text-status-text-error,#c52a46)}
33
35
  [part="document"]{display:flex;gap:.6rem;align-items:center;width:100%;text-align:left;color:inherit;font:inherit;background:none;border:0;text-decoration:none;cursor:pointer}
34
- [part="table-frame"]{overflow:auto;max-width:100%} table{border-collapse:collapse;min-width:100%;font-variant-numeric:tabular-nums} td,th{padding:.7rem;text-align:left;border-bottom:1px solid var(--boe-token-stroke-stroke,#ddd)} td:last-child{font-weight:600;background:var(--boe-token-surface-surface-secondary,#f7f7f7)}
36
+ span[part="document"]{cursor:default}
37
+ [part="table-frame"]{overflow:auto;max-width:100%} table{border-collapse:collapse;min-width:100%;font-variant-numeric:tabular-nums} td,th{padding:.7rem;text-align:left;border-bottom:1px solid var(--boe-token-stroke-stroke,#ddd)} td:last-child{font-weight:600}
35
38
  .sr{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
36
39
  [part="block"]{${boeEntrance()}${boeStaggerStyles};margin-block:1rem;min-width:0;container:boe-result-block / inline-size}
37
40
  ${boeEntranceKeyframes}${boeStatusStyles}${boeReducedMotionPolicy}`;
38
41
  const DEFAULT_TAG_NAME = "box-result-blocks";
39
42
  export class ResultBlocks extends BaseElement {
40
43
  static tagName = DEFAULT_TAG_NAME;
44
+ static get observedAttributes() { return ["title-style", "link-suffix", "selectable-documents"]; }
41
45
  value = [];
46
+ verdictLabels = {};
42
47
  get blocks() { return this.value; }
43
48
  set blocks(value) { this.value = value; if (this.isRendered)
44
49
  this.update(); }
50
+ get labels() { return this.verdictLabels; }
51
+ set labels(value) { this.verdictLabels = value; if (this.isRendered)
52
+ this.update(); }
53
+ get selectableDocuments() { return this.hasAttribute("selectable-documents"); }
54
+ set selectableDocuments(value) { this.toggleAttribute("selectable-documents", value); }
45
55
  get documentIds() { return resultDocumentIds(this.value); }
46
56
  renderTemplate() { this.shadowRoot.innerHTML = `<style>${resultBlockStyles}</style><div part="blocks"></div>`; }
47
57
  setupListeners() {
@@ -55,15 +65,17 @@ export class ResultBlocks extends BaseElement {
55
65
  const parent = this.shadowRoot.querySelector('[part="blocks"]');
56
66
  this.value.forEach((block, index) => {
57
67
  let node = parent.children[index];
58
- const signature = JSON.stringify(block);
68
+ const options = { labels: this.verdictLabels, linkSuffix: this.getAttribute("link-suffix") ?? undefined, selectableDocuments: this.selectableDocuments };
69
+ const signature = JSON.stringify([block, options]);
59
70
  if (!node) {
60
71
  node = document.createElement("section");
61
72
  node.setAttribute("part", "block");
62
73
  parent.append(node);
63
74
  }
75
+ node.setAttribute("aria-label", block.title ?? ({ facts: "Facts", checks: "Checks", table: "Results", documents: "Documents" }[block.type]));
64
76
  node.style.setProperty("--i", String(index));
65
77
  if (node.dataset.signature !== signature) {
66
- node.innerHTML = renderResultBlock(block);
78
+ node.innerHTML = renderResultBlock(block, options);
67
79
  node.dataset.signature = signature;
68
80
  }
69
81
  });
@@ -1,5 +1,5 @@
1
1
  import { BaseElement } from "../../core/index.js";
2
- import { boeFocusVisibleStyles } from "../../foundations/tokens/index.js";
2
+ import { boeFocusVisibleStyles } from "../../foundations/tokens/interaction.js";
3
3
  import { boeMotionDuration, boeMotionEasing } from "../../foundations/motion/index.js";
4
4
  import { boeRadius } from "../../foundations/geometry/index.js";
5
5
  const DEFAULT_TAG_NAME = "box-tree-grid";
@@ -2,7 +2,7 @@ import { BaseElement } from "../../core/index.js";
2
2
  import { FeedbackAnnouncement } from "../../foundations/a11y/announcer.js";
3
3
  import { toneAccessibleLabel, toneIcon } from "./tone.js";
4
4
  import { boeRadius, boeSpace } from "../../foundations/geometry/index.js";
5
- import { boeNeutralInteractiveStyles } from "../../foundations/tokens/index.js";
5
+ import { boeNeutralInteractiveStyles } from "../../foundations/tokens/interaction.js";
6
6
  import { boeMotionDuration, boeMotionEasing } from "../../foundations/motion/index.js";
7
7
  const DEFAULT_TAG_NAME = "box-alert";
8
8
  const alertStyles = `
@@ -131,7 +131,7 @@ const alertStyles = `
131
131
  border: 0;
132
132
  border-radius: ${boeRadius.med};
133
133
  background: transparent;
134
- color: var(--boe-token-text-text-secondary, #6f6f6f);
134
+ color: var(--boe-token-text-text, #222222);
135
135
  font: inherit;
136
136
  font-size: 13px;
137
137
  font-weight: 700;
@@ -1,5 +1,5 @@
1
1
  import { BaseElement } from "../../core/index.js";
2
- import { boeFocusVisibleStyles, boeNeutralInteractiveStyles, } from "../../foundations/tokens/index.js";
2
+ import { boeFocusVisibleStyles, boeNeutralInteractiveStyles, } from "../../foundations/tokens/interaction.js";
3
3
  import { boeMotionDuration, boeMotionEasing } from "../../foundations/motion/index.js";
4
4
  const DEFAULT_TAG_NAME = "box-chip";
5
5
  const chipStyles = `
@@ -1,6 +1,6 @@
1
1
  import { BaseElement } from "../../core/index.js";
2
2
  import { boeRadius } from "../../foundations/geometry/index.js";
3
- import { boeBrandInteractiveStyles } from "../../foundations/tokens/index.js";
3
+ import { boeBrandInteractiveStyles } from "../../foundations/tokens/interaction.js";
4
4
  import { boeMotionDuration, boeMotionEasing } from "../../foundations/motion/index.js";
5
5
  const DEFAULT_TAG_NAME = "box-empty-state";
6
6
  const emptyStateStyles = `
@@ -1,6 +1,6 @@
1
1
  import { BaseElement } from "../../core/index.js";
2
2
  import { boeRadius } from "../../foundations/geometry/index.js";
3
- import { boeFocusVisibleStyles, boeNeutralInteractiveStyles, } from "../../foundations/tokens/index.js";
3
+ import { boeFocusVisibleStyles, boeNeutralInteractiveStyles, } from "../../foundations/tokens/interaction.js";
4
4
  const DEFAULT_TAG_NAME = "box-nudge";
5
5
  const nudgeStyles = `
6
6
  :host {
@@ -30,8 +30,8 @@ const progressBarStyles = `
30
30
  [part="label"] {
31
31
  font-size: 0.8rem;
32
32
  font-weight: 700;
33
- letter-spacing: 0.08em;
34
- text-transform: uppercase;
33
+ letter-spacing: normal;
34
+ text-transform: none;
35
35
  color: var(--boe-token-text-text-secondary, #6f6f6f);
36
36
  }
37
37
 
@@ -5,6 +5,8 @@ export declare class StatusIcon extends BaseElement {
5
5
  static get observedAttributes(): string[];
6
6
  get kind(): StatusKind;
7
7
  set kind(value: StatusKind);
8
+ get label(): string;
9
+ set label(value: string);
8
10
  protected renderTemplate(): void;
9
11
  protected update(): void;
10
12
  }
@@ -1,16 +1,17 @@
1
1
  import { BaseElement } from "../../core/element.js";
2
- import { boeStatusGlyph, boeStatusStyles, statusLabel, toStatusKind } from "../../foundations/status/index.js";
3
- import { boeEntranceKeyframes, boeReducedMotionPolicy } from "../../foundations/motion/index.js";
2
+ import { boeStatusDocumentStyles, boeStatusGlyph, statusLabel, toStatusKind } from "../../foundations/status/index.js";
4
3
  const DEFAULT_TAG_NAME = "box-status-icon";
5
4
  export class StatusIcon extends BaseElement {
6
5
  static tagName = DEFAULT_TAG_NAME;
7
- static get observedAttributes() { return ["kind"]; }
6
+ static get observedAttributes() { return ["kind", "label"]; }
8
7
  get kind() { return toStatusKind(this.getAttribute("kind") ?? "pending"); }
9
8
  set kind(value) { this.setAttribute("kind", value); }
9
+ get label() { return this.getAttribute("label") ?? statusLabel(this.kind); }
10
+ set label(value) { this.setAttribute("label", value); }
10
11
  renderTemplate() {
11
12
  this.shadowRoot.innerHTML = `<style>:host{display:inline-flex} :host([hidden]){display:none !important}
12
13
  .label{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
13
- ${boeEntranceKeyframes}${boeStatusStyles}${boeReducedMotionPolicy}</style><span part="glyph"></span><span class="label" part="label"></span>`;
14
+ ${boeStatusDocumentStyles}</style><span part="glyph"></span><span class="label" part="label"></span>`;
14
15
  }
15
16
  update() {
16
17
  if (!this.isRendered)
@@ -20,7 +21,7 @@ export class StatusIcon extends BaseElement {
20
21
  glyph.setAttribute("data-kind", this.kind);
21
22
  glyph.innerHTML = boeStatusGlyph(this.kind);
22
23
  }
23
- this.shadowRoot.querySelector('[part="label"]').textContent = statusLabel(this.kind);
24
+ this.shadowRoot.querySelector('[part="label"]').textContent = this.label;
24
25
  }
25
26
  }
26
27
  StatusIcon.register();
@@ -2,7 +2,7 @@ import { BaseElement } from "../../core/index.js";
2
2
  import { FeedbackAnnouncement } from "../../foundations/a11y/announcer.js";
3
3
  import { toneAccessibleLabel, toneIcon } from "./tone.js";
4
4
  import { boeRadius, boeSpace } from "../../foundations/geometry/index.js";
5
- import { boeFocusVisibleStyles } from "../../foundations/tokens/index.js";
5
+ import { boeFocusVisibleStyles } from "../../foundations/tokens/interaction.js";
6
6
  import { boeMotionDuration, boeMotionEasing } from "../../foundations/motion/index.js";
7
7
  const DEFAULT_TAG_NAME = "box-toast";
8
8
  const TOAST_MODES = new Set(["dismissible", "sticky"]);
@@ -1,6 +1,6 @@
1
1
  import { BaseElement } from "../../core/index.js";
2
2
  import { captureDropEntries, collectEntries, entriesFromFileList, } from "../../foundations/files/index.js";
3
- import { boeFocusRingShadow, boeFocusVisibleStyles, } from "../../foundations/tokens/index.js";
3
+ import { boeFocusRingShadow, boeFocusVisibleStyles, } from "../../foundations/tokens/interaction.js";
4
4
  import { boeMotionDuration, boeMotionEasing } from "../../foundations/motion/index.js";
5
5
  import { boeRadius } from "../../foundations/geometry/index.js";
6
6
  const DEFAULT_TAG_NAME = "box-drop-zone";
@@ -1,7 +1,7 @@
1
1
  import { BaseElement } from "../../core/index.js";
2
2
  import { boeMotionDuration, boeMotionEasing } from "../../foundations/motion/index.js";
3
3
  import { boeOverlay, boeRadius } from "../../foundations/geometry/index.js";
4
- import { boeNeutralInteractiveStyles } from "../../foundations/tokens/index.js";
4
+ import { boeNeutralInteractiveStyles } from "../../foundations/tokens/interaction.js";
5
5
  import { parsePlacement, trackAnchor, } from "../../foundations/overlay/index.js";
6
6
  const DEFAULT_TAG_NAME = "box-category-selector";
7
7
  const escapeHtml = (value) => value
@@ -1,5 +1,5 @@
1
1
  import { FormAssociatedElement, boeFormFieldErrorStyles, formDataFromNamedValues, formErrorMessageMarkup, stringValuesFromFormValue, } from "../../core/index.js";
2
- import { boeFocusRingShadow, boeFocusVisibleStyles, } from "../../foundations/tokens/index.js";
2
+ import { boeFocusRingShadow, boeFocusVisibleStyles, } from "../../foundations/tokens/interaction.js";
3
3
  import { boeMotionDuration, boeMotionEasing } from "../../foundations/motion/index.js";
4
4
  import { boeRadius } from "../../foundations/geometry/index.js";
5
5
  const DEFAULT_TAG_NAME = "box-checkbox-group";
@@ -1,5 +1,5 @@
1
- import { FormAssociatedElement, boeFormFieldErrorStyles, formErrorMessageMarkup, } from "../../core/index.js";
2
- import { boeFocusVisibleStyles } from "../../foundations/tokens/index.js";
1
+ import { FormAssociatedElement, boeFormFieldErrorStyles, boeFormFieldSupportStyles, formErrorMessageMarkup, } from "../../core/index.js";
2
+ import { boeFocusVisibleStyles } from "../../foundations/tokens/interaction.js";
3
3
  import { boeControl, boeRadius, boeSpace } from "../../foundations/geometry/index.js";
4
4
  import { boeMotionDuration, boeMotionEasing } from "../../foundations/motion/index.js";
5
5
  const DEFAULT_TAG_NAME = "box-checkbox";
@@ -86,12 +86,13 @@ const checkboxStyles = `
86
86
  }
87
87
 
88
88
  ${boeFormFieldErrorStyles}
89
+ ${boeFormFieldSupportStyles}
89
90
  `;
90
91
  export class Checkbox extends FormAssociatedElement {
91
92
  static tagName = DEFAULT_TAG_NAME;
92
93
  static get observedAttributes() {
93
94
  return [
94
- ...FormAssociatedElement.formObservedAttributes,
95
+ ...FormAssociatedElement.fieldObservedAttributes,
95
96
  "checked",
96
97
  "description",
97
98
  "disabled",
@@ -288,6 +289,7 @@ export class Checkbox extends FormAssociatedElement {
288
289
  }
289
290
  this.inputEl.setAttribute("aria-label", this.label);
290
291
  this.labelEl.textContent = this.label;
292
+ this.applyFieldSupport(this.labelEl, this.inputEl, null);
291
293
  const description = this.description;
292
294
  if (description) {
293
295
  this.descriptionEl.hidden = false;
@@ -0,0 +1,61 @@
1
+ import { BaseElement } from "../../core/index.js";
2
+ import { type Completion } from "@codemirror/autocomplete";
3
+ export interface CodeProblem {
4
+ /** One-based line and column positions. */
5
+ line: number;
6
+ col?: number;
7
+ endCol?: number;
8
+ message: string;
9
+ tone: "error" | "warning" | "info";
10
+ }
11
+ export type CodeCompletion = Completion;
12
+ export interface CodeSelection {
13
+ anchor: number;
14
+ head: number;
15
+ }
16
+ /** Optional CodeMirror entrypoint. Import `code-editor`, not the root catalog. */
17
+ export declare class CodeEditor extends BaseElement {
18
+ static readonly tagName = "box-code-editor";
19
+ static get observedAttributes(): string[];
20
+ private valueInternal;
21
+ private problemsInternal;
22
+ private completionsInternal;
23
+ private view?;
24
+ private languageConfig;
25
+ private readonlyConfig;
26
+ private completionsConfig;
27
+ private timer?;
28
+ private pending;
29
+ private syncing;
30
+ private problemIndex;
31
+ private savedSelection;
32
+ private escapeUntil;
33
+ get value(): string;
34
+ set value(value: string);
35
+ get language(): string;
36
+ set language(value: string);
37
+ get readonly(): boolean;
38
+ set readonly(value: boolean);
39
+ get label(): string;
40
+ set label(value: string);
41
+ get problems(): readonly CodeProblem[];
42
+ set problems(value: readonly CodeProblem[]);
43
+ get completions(): readonly CodeCompletion[];
44
+ set completions(value: readonly CodeCompletion[]);
45
+ get selection(): CodeSelection;
46
+ set selection(value: CodeSelection);
47
+ revealLine(line: number): void;
48
+ focus(): void;
49
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
50
+ connectedCallback(): void;
51
+ disconnectedCallback(): void;
52
+ protected renderTemplate(): void;
53
+ protected setupListeners(): void;
54
+ private languageExtension;
55
+ private completionExtension;
56
+ protected update(): void;
57
+ private flushChange;
58
+ private diagnostics;
59
+ private syncProblems;
60
+ navigateProblem(direction: number): void;
61
+ }