@fusion.dev/helix-headless 0.149.1 → 0.151.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 (69) hide show
  1. package/custom-elements.json +1211 -110
  2. package/dist/area-chart/root/area-chart-root.d.ts +36 -0
  3. package/dist/area-chart/root/area-chart-root.js +17 -2
  4. package/dist/bar-chart/root/bar-chart-root.d.ts +28 -4
  5. package/dist/bar-chart/root/bar-chart-root.js +17 -4
  6. package/dist/button/root/button-root.d.ts +5 -0
  7. package/dist/button/root/button-root.js +3 -0
  8. package/dist/callout/root/callout-root.d.ts +20 -0
  9. package/dist/callout/root/callout-root.js +19 -4
  10. package/dist/chat/composer/chat-composer.d.ts +30 -0
  11. package/dist/chat/composer/chat-composer.js +47 -2
  12. package/dist/chat/root/chat-root.d.ts +10 -0
  13. package/dist/chat/root/chat-root.js +14 -0
  14. package/dist/color-input/root/color-input-root.d.ts +1 -0
  15. package/dist/color-picker/root/color-picker-root.js +1 -0
  16. package/dist/combobox/root/combobox-root.d.ts +12 -1
  17. package/dist/combobox/root/combobox-root.js +8 -0
  18. package/dist/copy-button/root/copy-button-root.d.ts +4 -3
  19. package/dist/copy-button/root/copy-button-root.js +5 -1
  20. package/dist/data-table/root/data-table-root.d.ts +34 -2
  21. package/dist/data-table/root/data-table-root.js +63 -2
  22. package/dist/date-input/root/date-input-root.d.ts +1 -0
  23. package/dist/divider/root/divider-root.d.ts +8 -6
  24. package/dist/divider/root/divider-root.js +10 -2
  25. package/dist/element-events.generated.js +5 -1
  26. package/dist/filter-input/chip/filter-chip.d.ts +2 -1
  27. package/dist/filter-input/root/filter-input-root.d.ts +5 -0
  28. package/dist/filter-input/root/filter-input-root.js +7 -0
  29. package/dist/kbd/root/kbd-root.d.ts +7 -1
  30. package/dist/kbd/root/kbd-root.js +8 -4
  31. package/dist/line-chart/root/line-chart-root.d.ts +36 -0
  32. package/dist/line-chart/root/line-chart-root.js +15 -2
  33. package/dist/number-input/root/number-input-root.d.ts +6 -0
  34. package/dist/number-input/root/number-input-root.js +14 -3
  35. package/dist/option/root/option-root.d.ts +17 -8
  36. package/dist/option/root/option-root.js +18 -4
  37. package/dist/radio/group/radio-group.d.ts +8 -1
  38. package/dist/radio/group/radio-group.js +15 -1
  39. package/dist/scatter-chart/root/scatter-chart-root.d.ts +18 -0
  40. package/dist/scatter-chart/root/scatter-chart-root.js +38 -15
  41. package/dist/slider/root/slider-root.d.ts +8 -0
  42. package/dist/slider/root/slider-root.js +6 -3
  43. package/dist/table/column/table-column.js +3 -2
  44. package/dist/table/grid-controller.d.ts +14 -2
  45. package/dist/table/grid-controller.js +27 -1
  46. package/dist/table/root/table-root.d.ts +30 -4
  47. package/dist/table/root/table-root.js +45 -7
  48. package/dist/table/row/table-row.d.ts +12 -2
  49. package/dist/table/row/table-row.js +8 -2
  50. package/dist/tag/group/tag-group.d.ts +22 -1
  51. package/dist/tag/group/tag-group.js +63 -3
  52. package/dist/tag/root/tag-root.d.ts +9 -0
  53. package/dist/tag/root/tag-root.js +5 -1
  54. package/dist/time-input/root/time-input-root.d.ts +1 -0
  55. package/dist/toggle/group/toggle-group.d.ts +6 -0
  56. package/dist/toggle/group/toggle-group.js +16 -1
  57. package/dist/toggle/root/toggle-root.d.ts +21 -3
  58. package/dist/toggle/root/toggle-root.js +22 -5
  59. package/dist/video/root/video-root.d.ts +6 -0
  60. package/dist/video/root/video-root.js +5 -1
  61. package/dist/video-playlist/root/video-playlist-root.d.ts +4 -0
  62. package/dist/video-playlist/root/video-playlist-root.js +4 -1
  63. package/dist/virtual-list/root/virtual-list-root.d.ts +23 -1
  64. package/dist/virtual-list/root/virtual-list-root.js +21 -2
  65. package/lint.json +1 -1
  66. package/package.json +5 -5
  67. package/types/jsx.d.ts +808 -156
  68. package/types/vue.d.ts +223 -59
  69. package/types/words.d.ts +4 -2
@@ -91,6 +91,12 @@ export interface VirtualListRange {
91
91
  * the last item says "Loading more" (`loading-label`, or your own content in
92
92
  * the `loading` slot). `scrollToIndex` takes a reader to an item.
93
93
  *
94
+ * **An empty list.** Set `empty-label`, or put your own content in the `empty`
95
+ * slot, for a row shown when there are no items and none are loading, such as
96
+ * "No messages yet" and a link to write one. Without either, an empty list
97
+ * shows nothing, since a list whose items have not arrived yet has not said
98
+ * it has none.
99
+ *
94
100
  * **Row height.** Rows are placed by `estimate` until they are drawn. Then the
95
101
  * list reads the drawn rows' height once and places every row by it, so a
96
102
  * wrong estimate still reaches the last item. Set `measured` for rows of
@@ -112,6 +118,7 @@ export interface VirtualListRange {
112
118
  * @documentation https://fusion.dev/helix/components/virtual-list
113
119
  *
114
120
  * @slot - The `<template>` that defines one row. The list writes the rows it renders beside it, and this slot shows them between the two spacers.
121
+ * @slot empty - Content for the row shown when there are no items and none are loading. Falls back to `empty-label`.
115
122
  * @slot loading - Content for the row after the last item while `loading` is set. Falls back to `loading-label`.
116
123
  *
117
124
  * @event {Event} change - Fired once a press or a key has changed which items are selected, in a list with `selection-mode`.
@@ -121,6 +128,7 @@ export interface VirtualListRange {
121
128
  *
122
129
  * @csspart after - The space that stands in for the rows below the rendered ones.
123
130
  * @csspart before - The space that stands in for the rows above the rendered ones.
131
+ * @csspart empty - The row shown when there are no items and none are loading, where `empty-label` or the `empty` slot gives it content.
124
132
  * @csspart loading - The row after the last item while `loading` is set.
125
133
  * @csspart viewport - The scrolling box. On this tier, it needs only a block size.
126
134
  */
@@ -136,6 +144,11 @@ export declare class HelixHeadlessVirtualList extends HelixElement {
136
144
  * time, with Left and Right moving along a line.
137
145
  */
138
146
  columns: number;
147
+ /**
148
+ * The text of the row shown when there are no items and none are loading,
149
+ * where the `empty` slot is empty. Empty, the default, shows no row.
150
+ */
151
+ emptyLabel: string;
139
152
  /**
140
153
  * The height of one row, in pixels, used to find the row at a scroll offset.
141
154
  *
@@ -376,7 +389,16 @@ export declare class HelixHeadlessVirtualList extends HelixElement {
376
389
  * first when it is not drawn.
377
390
  */
378
391
  private focusIndex;
379
- /** The row kept for focus is let go once focus has left it. */
392
+ /**
393
+ * The row kept for focus is let go once focus has left it.
394
+ *
395
+ * **A task later, and not at once.** Between `focusout` and `focusin` the
396
+ * page's focus is on `<body>`, and Chromium runs microtasks there when a key
397
+ * moves focus. An update asked for here ran in that gap: Tab from a kept row
398
+ * to its own link found no row holding focus, removed the row, and the link
399
+ * went with it, leaving focus on `<body>`. A move to a control inside this
400
+ * list asks for its own update in `handleFocusIn`, so it needs nothing here.
401
+ */
380
402
  private readonly handleFocusOut;
381
403
  /** A row that takes focus, by a press or by Tab, takes the tab stop with it. */
382
404
  private readonly handleFocusIn;
@@ -15,6 +15,7 @@ let HelixHeadlessVirtualList = class HelixHeadlessVirtualList extends HelixEleme
15
15
  constructor() {
16
16
  super(...arguments);
17
17
  this.columns = 1;
18
+ this.emptyLabel = '';
18
19
  this.estimate = 32;
19
20
  this.for = '';
20
21
  this.keyField = '';
@@ -103,8 +104,14 @@ let HelixHeadlessVirtualList = class HelixHeadlessVirtualList extends HelixEleme
103
104
  }
104
105
  this.press(at, event.shiftKey && this.selectionMode === 'multiple');
105
106
  };
106
- this.handleFocusOut = () => {
107
- this.requestUpdate();
107
+ this.handleFocusOut = (event) => {
108
+ const next = event.relatedTarget;
109
+ if (next instanceof Node && this.contains(next)) {
110
+ return;
111
+ }
112
+ setTimeout(() => {
113
+ this.requestUpdate();
114
+ }, 0);
108
115
  };
109
116
  this.handleFocusIn = (event) => {
110
117
  let node = event.target;
@@ -433,6 +440,10 @@ let HelixHeadlessVirtualList = class HelixHeadlessVirtualList extends HelixEleme
433
440
  const kept = this.hasUpdated ? this.keptIndex() : undefined;
434
441
  const { after, before } = this.virtualize.spacers(kept === undefined ? undefined : Math.floor(kept / this.across));
435
442
  const across = this.across;
443
+ const empty = this.readFor !== undefined &&
444
+ !this.loading &&
445
+ this.data.length === 0 &&
446
+ (this.emptyLabel !== '' || this.querySelector(':scope > [slot="empty"]') !== null);
436
447
  return html `<div
437
448
  data-scroller
438
449
  part="viewport"
@@ -457,12 +468,20 @@ let HelixHeadlessVirtualList = class HelixHeadlessVirtualList extends HelixEleme
457
468
  <slot name="loading">${this.loadingLabel}</slot>
458
469
  </div>`
459
470
  : nothing}
471
+ ${empty
472
+ ? html `<div part="empty" role=${this.selectionMode ? 'option' : 'listitem'}>
473
+ <slot name="empty">${this.emptyLabel}</slot>
474
+ </div>`
475
+ : nothing}
460
476
  </div>`;
461
477
  }
462
478
  };
463
479
  __decorate([
464
480
  property({ type: Number })
465
481
  ], HelixHeadlessVirtualList.prototype, "columns", void 0);
482
+ __decorate([
483
+ property({ attribute: 'empty-label' })
484
+ ], HelixHeadlessVirtualList.prototype, "emptyLabel", void 0);
466
485
  __decorate([
467
486
  property({ type: Number })
468
487
  ], HelixHeadlessVirtualList.prototype, "estimate", void 0);