@adia-ai/web-components 0.6.19 → 0.6.20

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/CHANGELOG.md CHANGED
@@ -1,5 +1,38 @@
1
1
  # Changelog — @adia-ai/web-components
2
2
 
3
+ ## [0.6.20] — 2026-05-21
4
+
5
+ ### Added — `table-ui` `row-click` event (FEEDBACK-35)
6
+
7
+ - `<table-ui>` now dispatches a bubbling `row-click` event (detail:
8
+ `{ row, dataIndex }`) once per row click, alongside the existing per-cell
9
+ `cell-click`. Master-detail / open-flyout wiring no longer has to
10
+ deduplicate `cell-click` by `dataIndex`. `table.yaml` documents it.
11
+
12
+ ### Changed — `select-ui` honours declarative `<option selected>` (FEEDBACK-36)
13
+
14
+ - `<select-ui>` now promotes an `<option selected>` child to the initial
15
+ value when the host carries no `[value]` attribute — matching native
16
+ `<select>` semantics. Previously the `selected` attribute was silently
17
+ ignored and the placeholder shown. Guarded on an empty `this.value`, so
18
+ consumers who set `[value]` explicitly are unaffected.
19
+
20
+ ### Changed — `chart-ui` wrong-`.data`-shape warning shows the correct shape (FEEDBACK-34)
21
+
22
+ - The one-shot `console.warn` emitted when `.data` is set to a non-array
23
+ now embeds a minimal correct-shape example
24
+ (`[{ label: "Jan", value: 100 }, … ]`) instead of only naming the wrong
25
+ API and pointing at `chart.yaml`.
26
+
27
+ ### Docs — `table.yaml` / `select.yaml` description clarifications (FEEDBACK-35 §2, FEEDBACK-36)
28
+
29
+ - `components/table/table.yaml` `sort` event: the `key` / `dir` detail
30
+ descriptions now name the fields explicitly (`key` not `column`, `dir` not
31
+ `direction`) — closing the guess the bare names invited.
32
+ - `components/select/select.yaml` `value`: documents that a declarative
33
+ `<option selected>` child sets the initial value when the host `[value]`
34
+ attribute is absent.
35
+
3
36
  ## [0.6.19] — 2026-05-21
4
37
 
5
38
  ### Fixed — `drawer-ui` `innerHTML`-on-host orphaned the internal `<dialog>` (FEEDBACK-30)
@@ -260,7 +260,9 @@ export class UIChart extends UIElement {
260
260
  console.warn(
261
261
  `[chart-ui] .data must be an array of plain objects — received ` +
262
262
  `${arr === null ? 'null' : typeof arr}. The {labels, datasets} ` +
263
- `envelope is the Chart.js API, not the chart-ui API. See chart.yaml.`,
263
+ `envelope is the Chart.js API, not the chart-ui API.\n` +
264
+ `Correct shape for <chart-ui x="label" y="value">:\n` +
265
+ ` [{ label: "Jan", value: 100 }, { label: "Feb", value: 200 }]`,
264
266
  );
265
267
  }
266
268
  this.#data = Array.isArray(arr) ? arr : [];
@@ -212,15 +212,20 @@ export class UISelect extends UIFormElement {
212
212
  this.#options = [];
213
213
  // §225 (v0.5.9): track unknown-child-tag names so we can warn once per element.
214
214
  const unknownTags = new Set();
215
+ // FEEDBACK-36: capture the value of an <option selected> child so a
216
+ // declarative initial selection is honoured (native <select> parity).
217
+ let preSelected;
215
218
  for (const child of this.children) {
216
219
  if (child.tagName === 'OPTGROUP') {
217
220
  const group = { label: child.label || child.getAttribute('label') || '', options: [] };
218
221
  for (const opt of child.querySelectorAll('option')) {
219
222
  group.options.push({ value: opt.value, label: opt.textContent.trim(), disabled: opt.disabled });
223
+ if (preSelected === undefined && opt.hasAttribute('selected')) preSelected = opt.value;
220
224
  }
221
225
  this.#options.push(group);
222
226
  } else if (child.tagName === 'OPTION') {
223
227
  this.#options.push({ value: child.value, label: child.textContent.trim(), disabled: child.disabled });
228
+ if (preSelected === undefined && child.hasAttribute('selected')) preSelected = child.value;
224
229
  } else if (
225
230
  // §225: skip [slot="display"] / [slot="listbox"] / [slot="action"] etc. — these are
226
231
  // stamped by the component itself, not consumer-authored options. Anything other
@@ -231,6 +236,10 @@ export class UISelect extends UIFormElement {
231
236
  }
232
237
  }
233
238
  for (const child of [...this.querySelectorAll('option, optgroup')]) child.remove();
239
+ // FEEDBACK-36: honour <option selected> as the initial value when the host
240
+ // carries no [value] — matches native <select> semantics. Guarded on an
241
+ // empty this.value so consumers who set [value] explicitly are unaffected.
242
+ if (!this.value && preSelected !== undefined) this.value = preSelected;
234
243
  // §225 (v0.5.9): warn once per element when consumer authored non-<option> children.
235
244
  if (unknownTags.size > 0 && !UISelect.#warnedNonOption.has(this)) {
236
245
  UISelect.#warnedNonOption.add(this);
@@ -122,7 +122,7 @@
122
122
  "default": "md"
123
123
  },
124
124
  "value": {
125
- "description": "Currently selected option value",
125
+ "description": "Currently selected option value. With declarative <option> children, a child carrying the native `selected` attribute sets the initial value when this attribute is absent (native <select> parity).",
126
126
  "type": "string",
127
127
  "default": ""
128
128
  },
@@ -111,7 +111,10 @@ props:
111
111
  type: boolean
112
112
  default: false
113
113
  value:
114
- description: Currently selected option value
114
+ description: >-
115
+ Currently selected option value. With declarative <option> children, a
116
+ child carrying the native `selected` attribute sets the initial value
117
+ when this attribute is absent (native <select> parity).
115
118
  type: string
116
119
  default: ""
117
120
  events:
@@ -47,6 +47,7 @@
47
47
  * page — { detail: { page } }
48
48
  * resize — { detail: { key, width } }
49
49
  * cell-click — { detail: { key, row, value, dataIndex } }
50
+ * row-click — { detail: { row, dataIndex } } — row-level companion to cell-click
50
51
  */
51
52
 
52
53
  import { UIElement } from '../../core/element.js';
@@ -1303,6 +1304,13 @@ export class UITable extends UIElement {
1303
1304
  bubbles: true,
1304
1305
  detail: { key, row: rowData, value, dataIndex },
1305
1306
  }));
1307
+ // FEEDBACK-35: row-click convenience event — fires once per row,
1308
+ // regardless of which cell was hit. detail is a strict subset of
1309
+ // cell-click (no key/value) so it reads as row identity, not a cell.
1310
+ this.dispatchEvent(new CustomEvent('row-click', {
1311
+ bubbles: true,
1312
+ detail: { row: rowData, dataIndex },
1313
+ }));
1306
1314
  }
1307
1315
  }
1308
1316
  };
@@ -144,6 +144,19 @@
144
144
  }
145
145
  }
146
146
  },
147
+ "row-click": {
148
+ "description": "Fired once when any cell in a data row is clicked — the row-level companion to cell-click. Use it for master-detail / open-flyout wiring.",
149
+ "detail": {
150
+ "dataIndex": {
151
+ "description": "Row index in the underlying data array.",
152
+ "type": "number"
153
+ },
154
+ "row": {
155
+ "description": "Row data object.",
156
+ "type": "object"
157
+ }
158
+ }
159
+ },
147
160
  "row-collapse": {
148
161
  "description": "Fired when an already-expanded row's chevron is activated (collapses the row). Mirror of row-expand.",
149
162
  "detail": {
@@ -183,11 +196,11 @@
183
196
  "description": "Fired when sort state changes via header click.",
184
197
  "detail": {
185
198
  "dir": {
186
- "description": "Sort direction — \"asc\" / \"desc\" / null (cleared).",
199
+ "description": "Sort direction — \"asc\" / \"desc\" / null (cleared). The detail field is `dir` (not `direction`).",
187
200
  "type": "string"
188
201
  },
189
202
  "key": {
190
- "description": "Column key being sorted.",
203
+ "description": "Column key being sorted — the detail field is `key` (not `column`).",
191
204
  "type": "string"
192
205
  },
193
206
  "sortState": {
@@ -44,6 +44,14 @@ export interface TableResizeEventDetail {
44
44
  }
45
45
 
46
46
  export type TableResizeEvent = CustomEvent<TableResizeEventDetail>;
47
+ export interface TableRowClickEventDetail {
48
+ /** Row index in the underlying data array. */
49
+ dataIndex: number;
50
+ /** Row data object. */
51
+ row: Record<string, unknown>;
52
+ }
53
+
54
+ export type TableRowClickEvent = CustomEvent<TableRowClickEventDetail>;
47
55
  export interface TableRowCollapseEventDetail {
48
56
  /** Row index in the underlying data array. */
49
57
  index: number;
@@ -67,9 +75,9 @@ export interface TableSelectEventDetail {
67
75
 
68
76
  export type TableSelectEvent = CustomEvent<TableSelectEventDetail>;
69
77
  export interface TableSortEventDetail {
70
- /** Sort direction — "asc" / "desc" / null (cleared). */
78
+ /** Sort direction — "asc" / "desc" / null (cleared). The detail field is `dir` (not `direction`). */
71
79
  dir: string;
72
- /** Column key being sorted. */
80
+ /** Column key being sorted — the detail field is `key` (not `column`). */
73
81
  key: string;
74
82
  /** Full sort state array (multi-column support). */
75
83
  sortState: unknown[];
@@ -110,6 +118,7 @@ export class UITable extends UIElement {
110
118
  addEventListener(type: 'filter-change', listener: (ev: TableFilterChangeEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
111
119
  addEventListener(type: 'page', listener: (ev: TablePageEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
112
120
  addEventListener(type: 'resize', listener: (ev: TableResizeEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
121
+ addEventListener(type: 'row-click', listener: (ev: TableRowClickEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
113
122
  addEventListener(type: 'row-collapse', listener: (ev: TableRowCollapseEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
114
123
  addEventListener(type: 'row-expand', listener: (ev: TableRowExpandEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
115
124
  addEventListener(type: 'select', listener: (ev: TableSelectEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
@@ -91,6 +91,15 @@ events:
91
91
  dataIndex:
92
92
  type: number
93
93
  description: Row index in the underlying data array.
94
+ row-click:
95
+ description: Fired once when any cell in a data row is clicked — the row-level companion to cell-click. Use it for master-detail / open-flyout wiring.
96
+ detail:
97
+ row:
98
+ type: object
99
+ description: Row data object.
100
+ dataIndex:
101
+ type: number
102
+ description: Row index in the underlying data array.
94
103
  filter-change:
95
104
  description: Fired when an interactive filter row applies / clears. detail.filters is the current filter map.
96
105
  detail:
@@ -141,10 +150,10 @@ events:
141
150
  detail:
142
151
  key:
143
152
  type: string
144
- description: Column key being sorted.
153
+ description: Column key being sorted — the detail field is `key` (not `column`).
145
154
  dir:
146
155
  type: string
147
- description: Sort direction — "asc" / "desc" / null (cleared).
156
+ description: Sort direction — "asc" / "desc" / null (cleared). The detail field is `dir` (not `direction`).
148
157
  sortState:
149
158
  type: array
150
159
  description: Full sort state array (multi-column support).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adia-ai/web-components",
3
- "version": "0.6.19",
3
+ "version": "0.6.20",
4
4
  "description": "AdiaUI web components \u2014 vanilla custom elements. A2UI runtime (renderer, registry, streams, wiring) lives in @adia-ai/a2ui-runtime.",
5
5
  "type": "module",
6
6
  "types": "./index.d.ts",