@ixfx/components 0.7.2 → 0.7.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.
Files changed (82) hide show
  1. package/bundle/index.d.ts +805 -137
  2. package/bundle/index.d.ts.map +1 -1
  3. package/bundle/index.js +2168 -42
  4. package/bundle/index.js.map +1 -1
  5. package/dist/ac-text.js +1 -1
  6. package/dist/ac-token.js +1 -1
  7. package/dist/crumbs.js +3 -3
  8. package/dist/{data-grid-Bh4YrQGK.d.ts → data-grid-BddUjAti.d.ts} +33 -1
  9. package/dist/data-grid-BddUjAti.d.ts.map +1 -0
  10. package/dist/data-grid.d.ts +1 -1
  11. package/dist/data-grid.js +180 -7
  12. package/dist/data-grid.js.map +1 -1
  13. package/dist/detail-list-Br0WAnry.d.ts +167 -0
  14. package/dist/detail-list-Br0WAnry.d.ts.map +1 -0
  15. package/dist/detail-list.d.ts +3 -0
  16. package/dist/detail-list.js +1115 -0
  17. package/dist/detail-list.js.map +1 -0
  18. package/dist/grid-list-B_orPsot.d.ts +304 -0
  19. package/dist/grid-list-B_orPsot.d.ts.map +1 -0
  20. package/dist/grid-list.d.ts +3 -0
  21. package/dist/grid-list.js +933 -0
  22. package/dist/grid-list.js.map +1 -0
  23. package/dist/{grouped-item-lister-DnWB-eFT.d.ts → grouped-item-lister-fdZHVxFM.d.ts} +2 -2
  24. package/dist/{grouped-item-lister-DnWB-eFT.d.ts.map → grouped-item-lister-fdZHVxFM.d.ts.map} +1 -1
  25. package/dist/grouped-item-lister.d.ts +1 -1
  26. package/dist/index.d.ts +267 -124
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +469 -979
  29. package/dist/index.js.map +1 -1
  30. package/dist/interaction-Cr13azbM.js +3 -0
  31. package/dist/list-item-animation-DuiwgN3l.js +112 -0
  32. package/dist/list-item-animation-DuiwgN3l.js.map +1 -0
  33. package/dist/list-selection-controller-CUo-Hhcm.js +338 -0
  34. package/dist/list-selection-controller-CUo-Hhcm.js.map +1 -0
  35. package/dist/{list-selection-types-DSuRNWpx.d.ts → list-selection-types-B5ioL-dG.d.ts} +6 -1
  36. package/dist/list-selection-types-B5ioL-dG.d.ts.map +1 -0
  37. package/dist/{menu-CXDFJxNm.js → menu-Bg90Qr0B.js} +7 -7
  38. package/dist/menu-Bg90Qr0B.js.map +1 -0
  39. package/dist/{menu-item-D2S4i8u1.js → menu-item-Bx-Fs7jq.js} +3 -3
  40. package/dist/{menu-item-D2S4i8u1.js.map → menu-item-Bx-Fs7jq.js.map} +1 -1
  41. package/dist/menu.js +2 -2
  42. package/dist/miller.d.ts +1 -1
  43. package/dist/miller.js +2 -2
  44. package/dist/narrowed-text.js +2 -2
  45. package/dist/plots.js +1 -1
  46. package/dist/select-horiz.js +2 -2
  47. package/dist/{tickled-controller-CRzdIEjJ.d.ts → tickled-controller-Bn3YdQsM.d.ts} +13 -2
  48. package/dist/{tickled-controller-CRzdIEjJ.d.ts.map → tickled-controller-Bn3YdQsM.d.ts.map} +1 -1
  49. package/dist/{tickled-controller-h9GmJ_bU.js → tickled-controller-C66DgJHl.js} +16 -1
  50. package/dist/tickled-controller-C66DgJHl.js.map +1 -0
  51. package/dist/{tree-Ch4W8qXQ.js → tree-B74zdI60.js} +116 -17
  52. package/dist/tree-B74zdI60.js.map +1 -0
  53. package/dist/tree.d.ts +6 -3
  54. package/dist/tree.d.ts.map +1 -1
  55. package/dist/tree.js +1 -1
  56. package/dist/vertical-list-CQSEVeOT.d.ts +140 -0
  57. package/dist/vertical-list-CQSEVeOT.d.ts.map +1 -0
  58. package/dist/vertical-list.d.ts +3 -121
  59. package/dist/vertical-list.js +710 -1
  60. package/dist/vertical-list.js.map +1 -0
  61. package/dist/{xy-axis-DWizs0bt.js → xy-axis-VrX8dmvS.js} +2 -2
  62. package/dist/{xy-axis-DWizs0bt.js.map → xy-axis-VrX8dmvS.js.map} +1 -1
  63. package/docs-user/README.md +2 -0
  64. package/docs-user/data-grid.md +51 -2
  65. package/docs-user/detail-list.md +80 -15
  66. package/docs-user/grid-list.md +274 -0
  67. package/docs-user/index.json +11 -2
  68. package/docs-user/infra-tickled.md +163 -0
  69. package/docs-user/llms.txt +2 -0
  70. package/docs-user/tree.md +13 -0
  71. package/docs-user/vertical-list.md +51 -1
  72. package/llms.txt +2 -0
  73. package/package.json +17 -2
  74. package/dist/data-grid-Bh4YrQGK.d.ts.map +0 -1
  75. package/dist/interaction-D5XdKzbR.js +0 -2
  76. package/dist/list-selection-types-DSuRNWpx.d.ts.map +0 -1
  77. package/dist/menu-CXDFJxNm.js.map +0 -1
  78. package/dist/tickled-controller-h9GmJ_bU.js.map +0 -1
  79. package/dist/tree-Ch4W8qXQ.js.map +0 -1
  80. package/dist/vertical-list-ClnqTkF3.js +0 -814
  81. package/dist/vertical-list-ClnqTkF3.js.map +0 -1
  82. package/dist/vertical-list.d.ts.map +0 -1
@@ -1,2 +1,711 @@
1
- import { t as VerticalListElement } from "./vertical-list-ClnqTkF3.js";
1
+ import { t as TickledController } from "./tickled-controller-C66DgJHl.js";
2
+ import { t as themeFallbacks } from "./fallbacks-DNI9xt0F.js";
3
+ import { n as safeCustomElement, t as __decorate } from "./decorate-VRK8rslU.js";
4
+ import { t as createElementIncrSearch } from "./element-search-Y8SRfPGM.js";
5
+ import { i as keyForElement, t as ListSelectionController } from "./list-selection-controller-CUo-Hhcm.js";
6
+ import { n as animateListItemIn, r as animateListItemOut } from "./list-item-animation-DuiwgN3l.js";
7
+ import { LitElement, css, html, render } from "lit";
8
+ import { property, query, state } from "lit/decorators.js";
9
+ //#region src/vertical-list/vertical-list.ts
10
+ const ITEM_SELECTOR = `li, [data-list-item]`;
11
+ let VerticalListElement = class VerticalListElement extends LitElement {
12
+ constructor(..._args2) {
13
+ super(..._args2);
14
+ this.selectionMode = `single`;
15
+ this.interactionMode = `standard`;
16
+ this.itemWrap = `stop`;
17
+ this._searchVisible = false;
18
+ this._searchQuery = ``;
19
+ this.#customWrappers = /* @__PURE__ */ new Map();
20
+ this.#wrappedElements = /* @__PURE__ */ new Set();
21
+ this.#animatedItems = /* @__PURE__ */ new WeakSet();
22
+ this.selection = new ListSelectionController({
23
+ getOrderedItems: () => this._getVisibleItems(),
24
+ isSelectable: (el) => this._isCheckable(el),
25
+ getModes: () => ({
26
+ selectionMode: this.selectionMode,
27
+ interactionMode: this.interactionMode
28
+ }),
29
+ getKey: keyForElement,
30
+ onChange: (selected, previous) => {
31
+ this._syncItemStates();
32
+ this._dispatch(`list-select`, {
33
+ selected,
34
+ previous,
35
+ selectedKeys: this.selection.selectedKeys
36
+ });
37
+ }
38
+ });
39
+ this.tickled = new TickledController(this, {
40
+ getItems: () => this._getVisibleItems().map((el) => ({
41
+ id: el,
42
+ enabled: !el.hasAttribute(`not-checked`)
43
+ })),
44
+ onTickle: (id) => {
45
+ if (id !== void 0) this._dispatch(`list-tickle`, { item: id });
46
+ },
47
+ onStateChange: () => this._syncItemStates(),
48
+ itemWrap: this.itemWrap
49
+ });
50
+ this._onPointerOver = (e) => {
51
+ const item = this._findListItem(e.composedPath());
52
+ if (item) this.tickled.handlePointerEnter(item);
53
+ };
54
+ this._onPointerLeave = (e) => {
55
+ this.tickled.handlePointerLeave(e);
56
+ };
57
+ this._onKeyDown = (e) => {
58
+ if ((e.ctrlKey || e.metaKey) && e.key === `f`) {
59
+ e.preventDefault();
60
+ this._openSearch();
61
+ return;
62
+ }
63
+ if ((e.ctrlKey || e.metaKey) && e.key === `a`) {
64
+ if (this.selection.canSelectAll()) {
65
+ e.preventDefault();
66
+ this.selection.selectAll();
67
+ }
68
+ return;
69
+ }
70
+ if (this._searchVisible) return;
71
+ switch (e.key) {
72
+ case `ArrowDown`:
73
+ e.preventDefault();
74
+ this.tickled.handleKeyboardNavigation(`next`);
75
+ if (e.shiftKey && this.interactionMode === `vscode`) {
76
+ const cur = this.tickled.tickledId;
77
+ if (cur) this.selection.rangeTo(cur);
78
+ }
79
+ break;
80
+ case `ArrowUp`:
81
+ e.preventDefault();
82
+ this.tickled.handleKeyboardNavigation(`previous`);
83
+ if (e.shiftKey && this.interactionMode === `vscode`) {
84
+ const cur = this.tickled.tickledId;
85
+ if (cur) this.selection.rangeTo(cur);
86
+ }
87
+ break;
88
+ case `Enter`: {
89
+ const id = this.tickled.tickledId;
90
+ if (id) {
91
+ e.preventDefault();
92
+ this._dispatch(`list-item-click`, { item: id });
93
+ this._activateItem(id);
94
+ }
95
+ break;
96
+ }
97
+ case ` `: {
98
+ const id = this.tickled.tickledId;
99
+ if (id) {
100
+ e.preventDefault();
101
+ this.selection.handleSpace(id);
102
+ }
103
+ break;
104
+ }
105
+ case `Escape`: this.selection.clear();
106
+ }
107
+ };
108
+ this._onClick = (e) => {
109
+ const item = this._findListItem(e.composedPath());
110
+ if (!item) return;
111
+ this._dispatch(`list-item-click`, { item });
112
+ this.selection.handleClick(item, e);
113
+ };
114
+ this._onDblClick = (e) => {
115
+ const item = this._findListItem(e.composedPath());
116
+ if (item) this._activateItem(item);
117
+ };
118
+ this._onSearchInput = (e) => {
119
+ const input = e.target;
120
+ this._searchQuery = input.value;
121
+ this.#search?.setQuery(this._searchQuery);
122
+ };
123
+ this._onSearchKeydown = (e) => {
124
+ if (e.key === `Escape`) {
125
+ e.stopPropagation();
126
+ this._closeSearch();
127
+ } else if (e.key === `ArrowDown`) {
128
+ e.preventDefault();
129
+ this.tickled.handleKeyboardNavigation(`next`);
130
+ } else if (e.key === `ArrowUp`) {
131
+ e.preventDefault();
132
+ this.tickled.handleKeyboardNavigation(`previous`);
133
+ } else if (e.key === `Enter`) {
134
+ e.preventDefault();
135
+ e.stopPropagation();
136
+ const id = this.tickled.tickledId ?? this._getVisibleItems()[0];
137
+ if (id) {
138
+ this._dispatch(`list-item-click`, { item: id });
139
+ this._activateItem(id);
140
+ this._closeSearch();
141
+ }
142
+ }
143
+ };
144
+ }
145
+ #search;
146
+ #customWrappers;
147
+ #wrappedElements;
148
+ /** Watches for items added to the light DOM so they can be animated in. */
149
+ #itemObserver;
150
+ /** Items that have already played (or been skipped for) their enter animation. */
151
+ #animatedItems;
152
+ connectedCallback() {
153
+ super.connectedCallback();
154
+ if (!this.hasAttribute(`tabindex`)) this.tabIndex = 0;
155
+ this.addEventListener(`pointerover`, this._onPointerOver);
156
+ this.addEventListener(`pointerleave`, this._onPointerLeave);
157
+ this.addEventListener(`keydown`, this._onKeyDown);
158
+ this.addEventListener(`click`, this._onClick);
159
+ this.addEventListener(`dblclick`, this._onDblClick);
160
+ for (const el of this.querySelectorAll(ITEM_SELECTOR)) this.#animatedItems.add(el);
161
+ this.#itemObserver ??= new MutationObserver((records) => this.#onItemsMutated(records));
162
+ this.#itemObserver.observe(this, { childList: true });
163
+ }
164
+ disconnectedCallback() {
165
+ super.disconnectedCallback();
166
+ this.removeEventListener(`pointerover`, this._onPointerOver);
167
+ this.removeEventListener(`pointerleave`, this._onPointerLeave);
168
+ this.removeEventListener(`keydown`, this._onKeyDown);
169
+ this.removeEventListener(`click`, this._onClick);
170
+ this.removeEventListener(`dblclick`, this._onDblClick);
171
+ this.#itemObserver?.disconnect();
172
+ this.#search?.dispose();
173
+ this.#search = void 0;
174
+ }
175
+ /**
176
+ * Animate in items appended to the light DOM (however they got there —
177
+ * {@link addItem}, direct `appendChild`, a framework binding). A bulk populate
178
+ * (roughly everything at once) is left alone, as are the wrapper `<li>`s the
179
+ * checked-mode plumbing shuffles around.
180
+ */
181
+ #onItemsMutated(records) {
182
+ if (!this.isConnected) return;
183
+ const fresh = [];
184
+ for (const record of records) for (const node of record.addedNodes) {
185
+ if (!(node instanceof HTMLElement) || node.parentElement !== this) continue;
186
+ if (!node.matches(ITEM_SELECTOR)) continue;
187
+ if (this.#animatedItems.has(node) || this.#customWrappers.has(node) || this.#wrappedElements.has(node)) continue;
188
+ this.#animatedItems.add(node);
189
+ fresh.push(node);
190
+ }
191
+ if (fresh.length === 0) return;
192
+ const total = this.querySelectorAll(ITEM_SELECTOR).length;
193
+ if (fresh.length >= total) return;
194
+ for (const el of fresh) animateListItemIn(el);
195
+ }
196
+ firstUpdated() {
197
+ this.#search = createElementIncrSearch({
198
+ container: this,
199
+ itemSelector: ITEM_SELECTOR,
200
+ getLabel: (el) => el.getAttribute(`data-search-label`) ?? el.textContent?.trim() ?? ``,
201
+ getKey: (el) => el.getAttribute(`data-key`) ?? el.getAttribute(`data-search-label`) ?? el.textContent?.trim() ?? ``,
202
+ highlightKey: `vertical-list-search`
203
+ });
204
+ }
205
+ updated(changed) {
206
+ super.updated(changed);
207
+ if (changed.has(`interactionMode`)) {
208
+ this.selection.clearAnchor();
209
+ const previousSelected = this.selection.selected;
210
+ const savedWrappers = changed.get(`interactionMode`) === `checked` ? new Map(this.#customWrappers) : null;
211
+ this._syncCheckboxes();
212
+ if (previousSelected.size > 0) {
213
+ if (savedWrappers && savedWrappers.size > 0) this.selection.remap((el) => savedWrappers.get(el) ?? el);
214
+ else if (this.#customWrappers.size > 0) {
215
+ const innerToWrapper = new Map([...this.#customWrappers].map(([w, i]) => [i, w]));
216
+ this.selection.remap((el) => innerToWrapper.get(el) ?? el);
217
+ }
218
+ }
219
+ this._syncItemStates();
220
+ } else if (changed.has(`checkboxRenderer`) && this.interactionMode === `checked`) this._syncCheckboxes();
221
+ }
222
+ /** The most recently selected item, or `undefined` if nothing is selected. */
223
+ get selectedItem() {
224
+ return [...this.selection.selected].at(-1);
225
+ }
226
+ /** The full current selection set (read-only). */
227
+ get selectedItems() {
228
+ return this.selection.selected;
229
+ }
230
+ addItem(item, options) {
231
+ let el;
232
+ if (typeof item === `string`) {
233
+ const li = document.createElement(`li`);
234
+ li.textContent = item;
235
+ el = li;
236
+ } else el = item;
237
+ if (options?.notChecked) el.setAttribute(`not-checked`, ``);
238
+ this.appendChild(el);
239
+ if (this.interactionMode === `checked`) this._syncCheckboxes();
240
+ }
241
+ /**
242
+ * Collapse + fade `item` out, then detach it. The rows below slide up to
243
+ * close the gap. Resolves once the element has actually been removed.
244
+ * Under `prefers-reduced-motion: reduce` it's removed immediately.
245
+ */
246
+ removeItem(item) {
247
+ this.selection.deselect(item);
248
+ return animateListItemOut(item).then(() => {
249
+ item.remove();
250
+ if (this.interactionMode === `checked`) this._syncCheckboxes();
251
+ });
252
+ }
253
+ /** {@link removeItem} for several items at once. */
254
+ removeItems(items) {
255
+ return Promise.all([...items].map((item) => this.removeItem(item))).then(() => void 0);
256
+ }
257
+ clearItems() {
258
+ this.#customWrappers.clear();
259
+ this.replaceChildren();
260
+ this.selection.reset();
261
+ this._syncItemStates();
262
+ }
263
+ /**
264
+ * Replace the entire item list in one call.
265
+ * Equivalent to `clearItems()` followed by `addItem()` for each element.
266
+ * Preserves `interactionMode` checkbox wrapping.
267
+ */
268
+ setItems(items) {
269
+ this.clearItems();
270
+ for (const item of items) this.appendChild(item);
271
+ if (this.interactionMode === `checked`) this._syncCheckboxes();
272
+ }
273
+ /**
274
+ * Dispatch a command to this list. No-op by default.
275
+ * Intended for use with `ixfx-grouped-item-lister`'s `dispatch()` method,
276
+ * which forwards commands to all sub-components.
277
+ */
278
+ dispatch(_commandId, _args) {}
279
+ select(item) {
280
+ this.selection.replace(item);
281
+ }
282
+ selectMany(items) {
283
+ this.selection.selectMany(items);
284
+ }
285
+ deselect(item) {
286
+ this.selection.deselect(item);
287
+ }
288
+ clearSelection() {
289
+ this.selection.clear();
290
+ }
291
+ selectAll() {
292
+ if (this.selection.canSelectAll()) this.selection.selectAll();
293
+ }
294
+ /** The selection as stable `data-key` / `data-value` strings. */
295
+ get selectedKeys() {
296
+ return this.selection.selectedKeys;
297
+ }
298
+ /** The key of the item under the cursor, or `undefined`. */
299
+ get tickledKey() {
300
+ const id = this.tickled.tickledId;
301
+ return id ? keyForElement(id) : void 0;
302
+ }
303
+ /** Replace the selection with the items carrying these keys (unknown keys ignored). */
304
+ selectKeys(keys) {
305
+ this.selection.selectKeys(keys, (key) => this.#itemForKey(key));
306
+ }
307
+ /** Add items by key to the selection (multi-select modes only). */
308
+ addSelectedKeys(keys) {
309
+ this.selection.addKeys(keys, (key) => this.#itemForKey(key));
310
+ }
311
+ /** Remove items by key from the selection. */
312
+ removeSelectedKeys(keys) {
313
+ this.selection.removeKeys(keys, (key) => this.#itemForKey(key));
314
+ }
315
+ /** Move the cursor to the item with this key and scroll it into view. */
316
+ focusKey(key) {
317
+ const el = this.#itemForKey(key);
318
+ if (!el) return;
319
+ this.tickled.focus(el);
320
+ el.scrollIntoView({
321
+ block: `nearest`,
322
+ inline: `nearest`
323
+ });
324
+ }
325
+ #itemForKey(key) {
326
+ for (const el of this.querySelectorAll(ITEM_SELECTOR)) {
327
+ if (this.#wrappedElements.has(el)) continue;
328
+ if (keyForElement(el) === key) return el;
329
+ }
330
+ }
331
+ *selectedFilter(kind) {
332
+ const wanted = (el) => {
333
+ switch (kind) {
334
+ case `selected`: return el.hasAttribute(`data-selected`);
335
+ case `checked`: return el.hasAttribute(`data-checked`);
336
+ case `either`: return el.hasAttribute(`data-selected`) || el.hasAttribute(`data-checked`);
337
+ }
338
+ };
339
+ for (const el of this.querySelectorAll(ITEM_SELECTOR)) {
340
+ if (this.#wrappedElements.has(el)) continue;
341
+ if (el.hidden) continue;
342
+ if (wanted(el)) yield el;
343
+ }
344
+ }
345
+ _getVisibleItems() {
346
+ return Array.from(this.querySelectorAll(ITEM_SELECTOR)).filter((el) => {
347
+ if (this.#wrappedElements.has(el)) return false;
348
+ if (el.hidden) return false;
349
+ if (this.filterPredicate && !this.filterPredicate(el)) return false;
350
+ return true;
351
+ });
352
+ }
353
+ _isCheckable(item) {
354
+ if (this.interactionMode !== `checked`) return true;
355
+ return !(this.#customWrappers.get(item) ?? item).hasAttribute(`not-checked`);
356
+ }
357
+ _syncItemStates() {
358
+ for (const el of this.querySelectorAll(ITEM_SELECTOR)) {
359
+ if (this.#wrappedElements.has(el)) continue;
360
+ const item = this.#customWrappers.get(el) ?? el;
361
+ el.toggleAttribute(`data-tickled`, this.tickled.isTickled(el));
362
+ el.toggleAttribute(`data-selected`, this.selection.selected.has(el));
363
+ if (this.interactionMode === `checked`) el.toggleAttribute(`data-checked`, !item.hasAttribute(`not-checked`) && this.selection.selected.has(el));
364
+ else el.removeAttribute(`data-checked`);
365
+ }
366
+ this.dataset.inputMode = this.tickled.inputMode;
367
+ this._syncCheckboxes();
368
+ }
369
+ _syncCheckboxes() {
370
+ const inCheckedMode = this.interactionMode === `checked`;
371
+ const wantsCustom = typeof this.checkboxRenderer === `function`;
372
+ if (inCheckedMode) for (const inner of Array.from(this.children)) {
373
+ if (!inner.hasAttribute(`data-list-item`)) continue;
374
+ if (inner.parentElement !== this) continue;
375
+ const wrapper = document.createElement(`li`);
376
+ wrapper.className = `ixfx-custom-row`;
377
+ const key = inner.getAttribute(`data-key`);
378
+ const label = inner.getAttribute(`data-search-label`);
379
+ if (key !== null) wrapper.setAttribute(`data-key`, key);
380
+ if (label !== null) wrapper.setAttribute(`data-search-label`, label);
381
+ inner.removeAttribute(`data-list-item`);
382
+ this.insertBefore(wrapper, inner);
383
+ wrapper.appendChild(inner);
384
+ this.#customWrappers.set(wrapper, inner);
385
+ this.#wrappedElements.add(inner);
386
+ }
387
+ else {
388
+ for (const [wrapper, inner] of this.#customWrappers) {
389
+ if (wrapper.parentElement !== this) continue;
390
+ inner.setAttribute(`data-list-item`, ``);
391
+ this.insertBefore(inner, wrapper);
392
+ wrapper.remove();
393
+ }
394
+ this.#customWrappers.clear();
395
+ this.#wrappedElements.clear();
396
+ }
397
+ for (const el of this.querySelectorAll(`li`)) {
398
+ const existing = el.querySelector(`.ixfx-list-checkbox`);
399
+ if (!inCheckedMode) {
400
+ if (existing) existing.remove();
401
+ continue;
402
+ }
403
+ if ((this.#customWrappers.get(el) ?? el).hasAttribute(`not-checked`)) {
404
+ if (existing) existing.remove();
405
+ continue;
406
+ }
407
+ const existingIsCustom = existing?.classList.contains(`ixfx-list-checkbox-custom`) ?? false;
408
+ if (existing && existingIsCustom !== wantsCustom) existing.remove();
409
+ let cb = el.querySelector(`.ixfx-list-checkbox`);
410
+ if (!cb) {
411
+ if (wantsCustom) {
412
+ const opts = this.checkboxRenderer;
413
+ const margin = opts.margin ?? `0`;
414
+ const width = opts.width ?? `24px`;
415
+ cb = this._createCustomCheckbox(el, margin, width);
416
+ } else cb = this._createNativeCheckboxCell(el);
417
+ el.prepend(cb);
418
+ }
419
+ const checked = this.selection.selected.has(el);
420
+ if (wantsCustom) {
421
+ cb.setAttribute(`aria-checked`, String(checked));
422
+ cb.toggleAttribute(`data-checked`, checked);
423
+ if (this.checkboxRenderer) {
424
+ const renderer = typeof this.checkboxRenderer === `function` ? this.checkboxRenderer : this.checkboxRenderer.renderer;
425
+ render(renderer(checked), cb);
426
+ }
427
+ } else {
428
+ const input = cb.querySelector(`input.ixfx-list-checkbox`);
429
+ if (input) input.checked = checked;
430
+ }
431
+ }
432
+ }
433
+ /**
434
+ * Native checkbox cell: a span that stretches to the row's full cross-axis
435
+ * (so the entire column height is a click target) with a real `<input>`
436
+ * centred inside. The span owns the click; the input is purely visual and
437
+ * has `pointer-events:none` so a single click produces one toggle.
438
+ */
439
+ _createNativeCheckboxCell(el) {
440
+ const cell = document.createElement(`span`);
441
+ cell.className = `ixfx-list-checkbox ixfx-list-checkbox-native`;
442
+ cell.style.cssText = `display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;align-self:stretch;width:18px;margin:0 6px 0 0;cursor:pointer;pointer-events:auto`;
443
+ cell.tabIndex = -1;
444
+ cell.setAttribute(`role`, `checkbox`);
445
+ cell.setAttribute(`part`, `checkbox`);
446
+ cell.addEventListener(`click`, (e) => {
447
+ e.stopPropagation();
448
+ this.selection.toggle(el);
449
+ });
450
+ const input = document.createElement(`input`);
451
+ input.type = `checkbox`;
452
+ input.className = `ixfx-list-checkbox`;
453
+ input.style.cssText = `pointer-events:none;cursor:pointer;margin:0`;
454
+ cell.appendChild(input);
455
+ return cell;
456
+ }
457
+ /**
458
+ * Custom checkbox cell: same shape as the native cell (a stretching span)
459
+ * so behaviour is identical. The renderer's content goes inside.
460
+ */
461
+ _createCustomCheckbox(el, margin, width) {
462
+ const span = document.createElement(`span`);
463
+ span.className = `ixfx-list-checkbox ixfx-list-checkbox-custom`;
464
+ span.style.cssText = `display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;align-self:stretch;width:${width};margin:${margin};cursor:pointer;pointer-events:auto`;
465
+ span.tabIndex = -1;
466
+ span.setAttribute(`role`, `checkbox`);
467
+ span.setAttribute(`part`, `checkbox`);
468
+ span.addEventListener(`click`, (e) => {
469
+ e.stopPropagation();
470
+ this.selection.toggle(el);
471
+ });
472
+ return span;
473
+ }
474
+ _findListItem(path) {
475
+ for (const target of path) {
476
+ if (!(target instanceof Element)) continue;
477
+ if (target === this) break;
478
+ if (target.parentElement === this && target.matches(ITEM_SELECTOR)) return target;
479
+ }
480
+ }
481
+ _dispatch(name, detail) {
482
+ this.dispatchEvent(new CustomEvent(name, {
483
+ detail,
484
+ bubbles: true,
485
+ composed: true
486
+ }));
487
+ }
488
+ _openSearch() {
489
+ this._searchVisible = true;
490
+ this.updateComplete.then(() => this._searchInputEl?.focus());
491
+ }
492
+ _closeSearch() {
493
+ this._searchVisible = false;
494
+ this._searchQuery = ``;
495
+ this.#search?.clearQuery();
496
+ this.focus();
497
+ }
498
+ _activateItem(item) {
499
+ if (this.interactionMode !== `manual`) this.selection.replace(item);
500
+ this._dispatch(`list-activate`, { item });
501
+ }
502
+ static {
503
+ this.styles = [themeFallbacks, css`
504
+ :host {
505
+ display: block;
506
+ position: relative;
507
+ background: var(--list-bg, var(--surface-3));
508
+ color: var(--list-text, var(--surface-3-text));
509
+ border-radius: var(--list-radius, var(--radius-s));
510
+ border: 1px solid var(--list-border, var(--border));
511
+ width: 100%;
512
+ height: 100%;
513
+ overflow: hidden;
514
+ box-sizing: border-box;
515
+ outline: none;
516
+ --ixfx-list-item-padding: var(--ixfx-list-item-padding, var(--list-item-padding, 4px var(--space-m, 8px)));
517
+ }
518
+
519
+ :host(:focus-visible) {
520
+ outline: 2px solid var(--accent);
521
+ outline-offset: 2px;
522
+ }
523
+
524
+ .container {
525
+ position: relative;
526
+ width: 100%;
527
+ height: 100%;
528
+ }
529
+
530
+ ul {
531
+ list-style: none;
532
+ margin: 0;
533
+ padding: 0;
534
+ width: 100%;
535
+ height: 100%;
536
+ overflow-x: hidden;
537
+ overflow-y: auto;
538
+ box-sizing: border-box;
539
+ /* Scrollbar theming: end users override these CSS variables to control
540
+ the native scrollbar (scrollbar-width, scrollbar-gutter, scrollbar-color). */
541
+ scrollbar-width: var(--list-scrollbar-width, auto);
542
+ scrollbar-gutter: var(--list-scrollbar-gutter, auto);
543
+ scrollbar-color: var(--list-scrollbar-color, auto);
544
+ }
545
+
546
+ ::slotted([hidden]) {
547
+ display: none !important;
548
+ }
549
+
550
+ ::slotted(li) {
551
+ display: flex;
552
+ align-items: center;
553
+ padding: var(--ixfx-list-item-padding);
554
+ min-height: var(--list-item-height, 28px);
555
+ cursor: pointer;
556
+ user-select: none;
557
+ transition: background var(--transition, 0.1s ease-out),
558
+ outline-color var(--transition, 0.1s ease-out);
559
+ box-sizing: border-box;
560
+ outline: 1px solid transparent;
561
+ }
562
+
563
+ /* Custom shadow-DOM components handle their own internal layout/padding */
564
+ ::slotted([data-list-item]) {
565
+ display: block;
566
+ cursor: pointer;
567
+ user-select: none;
568
+ transition: background var(--transition, 0.1s ease-out),
569
+ outline-color var(--transition, 0.1s ease-out);
570
+ outline: 1px solid transparent;
571
+ }
572
+
573
+ /* In checked mode, only the checkbox column is clickable; the row body
574
+ gets a default cursor so it doesn't suggest otherwise. */
575
+ :host([interaction-mode="checked"]) ::slotted(li),
576
+ :host([interaction-mode="checked"]) ::slotted([data-list-item]) {
577
+ cursor: default;
578
+ }
579
+
580
+ /* Wrapper inserted around custom [data-list-item] elements in checked mode.
581
+ Provides the flex layout so the injected checkbox can stretch to the
582
+ row's full height via align-self:stretch. */
583
+ .ixfx-custom-row {
584
+ display: flex;
585
+ align-items: center;
586
+ min-height: var(--list-item-height, 28px);
587
+ box-sizing: border-box;
588
+ cursor: default;
589
+ user-select: none;
590
+ }
591
+
592
+ ::slotted([data-tickled]) {
593
+ background: var(--item-bg-tickled);
594
+ outline: var(--item-border-tickled);
595
+ }
596
+
597
+ ::slotted([data-selected]) {
598
+ background: var(--item-bg-selected);
599
+ color: var(--item-text-selected);
600
+ outline: 1px solid transparent;
601
+ }
602
+
603
+ ::slotted([data-selected][data-tickled]) {
604
+ background: var(--item-bg-selected-tickled);
605
+ outline: 2px dashed var(--surface-3);
606
+ outline-offset: -2px;
607
+ }
608
+
609
+ /* checked mode: checkbox (injected into li) communicates selection — suppress bg highlight */
610
+ :host([interaction-mode="checked"]) ::slotted([data-selected]) {
611
+ background: transparent;
612
+ color: inherit;
613
+ outline: 1px solid transparent;
614
+ }
615
+
616
+ :host([interaction-mode="checked"]) ::slotted([data-selected][data-tickled]) {
617
+ background: var(--item-bg-tickled);
618
+ color: inherit;
619
+ outline: var(--item-border-tickled);
620
+ }
621
+
622
+ .search-overlay {
623
+ position: absolute;
624
+ top: 8px;
625
+ right: 8px;
626
+ z-index: 10;
627
+ display: flex;
628
+ align-items: center;
629
+ gap: 4px;
630
+ background: var(--surface-4, #2a2a2a);
631
+ border: 1px solid var(--border, #444);
632
+ border-radius: var(--radius-m, 4px);
633
+ padding: 4px 6px;
634
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
635
+ }
636
+
637
+ .search-overlay[hidden] {
638
+ display: none;
639
+ }
640
+
641
+ .search-input {
642
+ background: transparent;
643
+ border: none;
644
+ outline: none;
645
+ color: inherit;
646
+ font-size: var(--text-m, 0.875em);
647
+ min-width: 140px;
648
+ }
649
+
650
+ .search-close {
651
+ background: transparent;
652
+ border: none;
653
+ color: var(--surface-muted-text, #888);
654
+ cursor: pointer;
655
+ font-size: 1.1em;
656
+ line-height: 1;
657
+ padding: 0 2px;
658
+ }
659
+
660
+ .search-close:hover {
661
+ color: inherit;
662
+ }
663
+ `];
664
+ }
665
+ render() {
666
+ return html`
667
+ <div class="container">
668
+ <ul part="list">
669
+ <slot></slot>
670
+ </ul>
671
+ <div
672
+ class="search-overlay"
673
+ part="search-overlay"
674
+ ?hidden=${!this._searchVisible}
675
+ >
676
+ <input
677
+ type="text"
678
+ class="search-input"
679
+ placeholder="Search…"
680
+ .value=${this._searchQuery}
681
+ @input=${this._onSearchInput}
682
+ @keydown=${this._onSearchKeydown}
683
+ />
684
+ <button class="search-close" @click=${this._closeSearch} title="Close search (Esc)">×</button>
685
+ </div>
686
+ </div>
687
+ `;
688
+ }
689
+ };
690
+ __decorate([property({
691
+ type: String,
692
+ attribute: `selection-mode`
693
+ })], VerticalListElement.prototype, "selectionMode", void 0);
694
+ __decorate([property({
695
+ type: String,
696
+ attribute: `interaction-mode`
697
+ })], VerticalListElement.prototype, "interactionMode", void 0);
698
+ __decorate([property({ attribute: false })], VerticalListElement.prototype, "filterPredicate", void 0);
699
+ __decorate([property({
700
+ type: String,
701
+ attribute: `item-wrap`
702
+ })], VerticalListElement.prototype, "itemWrap", void 0);
703
+ __decorate([property({ attribute: false })], VerticalListElement.prototype, "checkboxRenderer", void 0);
704
+ __decorate([state()], VerticalListElement.prototype, "_searchVisible", void 0);
705
+ __decorate([state()], VerticalListElement.prototype, "_searchQuery", void 0);
706
+ __decorate([query(`.search-input`)], VerticalListElement.prototype, "_searchInputEl", void 0);
707
+ VerticalListElement = __decorate([safeCustomElement(`ixfx-vertical-list`)], VerticalListElement);
708
+ //#endregion
2
709
  export { VerticalListElement };
710
+
711
+ //# sourceMappingURL=vertical-list.js.map