@fusion.dev/helix-headless 0.233.0 → 0.235.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.
@@ -1745,6 +1745,7 @@ let HelixHeadlessCanvas = class HelixHeadlessCanvas extends MixinViewport(HelixE
1745
1745
  data-target=${editing.target}
1746
1746
  style=${`--_canvas-editor-x: ${at.x}px; --_canvas-editor-y: ${at.y}px`}
1747
1747
  type="text"
1748
+ autocomplete="off"
1748
1749
  .value=${editing.was}
1749
1750
  @blur=${this.handleEditorBlur}
1750
1751
  @keydown=${this.handleEditorKeydown}
@@ -145,6 +145,14 @@ declare const HelixHeadlessDataTable_base: (new (...args: any[]) => import("@fus
145
145
  * In the grid, Alt+Down on a heading opens its menu, and F2 and Tab reach the
146
146
  * button.
147
147
  *
148
+ * **`min-table-width` on a column drops it from a narrow table.** While the
149
+ * table is narrower than that length, it leaves out the column's heading,
150
+ * track and cells, and brings them back when it widens. The other columns
151
+ * keep their widths and edges, `aria-colcount` counts the columns that show,
152
+ * and the column keeps its place in `order` and in the sort. One column
153
+ * always shows. `csv()` still writes every column that is not `hidden`, since
154
+ * a file has no width.
155
+ *
148
156
  * **`reorderable-rows` lets people move rows.** A column of grips leads each
149
157
  * row, named by `move-row-label`. Drag a grip to move its row, and the table
150
158
  * scrolls near an edge. Or press Space or Enter on a grip, or click it, to pick
@@ -895,6 +903,26 @@ export declare class HelixHeadlessDataTable extends HelixHeadlessDataTable_base
895
903
  * sort, which are by field, so showing it again puts it back where it was.
896
904
  */
897
905
  private get shownColumns();
906
+ /** The table's inline size as last measured, or undefined where nothing has measured it, as on a server. */
907
+ private measuredInlineSize;
908
+ /** The font sizes `em` and `rem` read against, taken with the size. */
909
+ private fontSizes;
910
+ /** The columns left out at the measured size, for their `min-table-width`. */
911
+ private dropped;
912
+ /** Measures the `table` part as it changes size, in a browser. */
913
+ private sizeObserver;
914
+ /**
915
+ * Works out which columns are left out at the measured size, and says
916
+ * whether that changed.
917
+ *
918
+ * **Asked on every resize, and the table draws again only when the answer
919
+ * changes**, so dragging a window across a hundred pixels costs a render at
920
+ * each minimum it crosses and none between them. Read off the columns in the
921
+ * order on screen, which keeps the first one there where every column would
922
+ * go. A hidden column takes no part, having no room to give back.
923
+ */
924
+ private fit;
925
+ private readonly handleSize;
898
926
  /** The fields in the order on screen. */
899
927
  private get fields();
900
928
  /** The fields of the columns drawn, in the order on screen: what a grip moves among. */
@@ -1140,8 +1168,9 @@ export declare class HelixHeadlessDataTable extends HelixHeadlessDataTable_base
1140
1168
  * **Values, not cells.** A cell may be a template, a badge or a link, so each
1141
1169
  * column gives its field's value, which is what a spreadsheet wants anyway.
1142
1170
  * A column with no field has no value and is left out, and so is a hidden
1143
- * one, which is not on screen. In `server` mode this is the page it holds,
1144
- * which is all it can know.
1171
+ * one, which is not on screen. A column dropped for its `min-table-width`
1172
+ * is kept, so the file is the same at any window width. In `server` mode
1173
+ * this is the page it holds, which is all it can know.
1145
1174
  *
1146
1175
  * **A text value that a spreadsheet would run is quoted as text.** A cell
1147
1176
  * opening with `=`, `+`, `-` or `@` is a formula to a spreadsheet, and a
@@ -1380,6 +1409,16 @@ export declare class HelixHeadlessDataTable extends HelixHeadlessDataTable_base
1380
1409
  * is the listener's owner rather than its subject.
1381
1410
  */
1382
1411
  connectedCallback(): void;
1412
+ protected firstUpdated(changed: PropertyValues): void;
1413
+ /**
1414
+ * Measures the `table` part as it changes size, once it is drawn.
1415
+ *
1416
+ * **The part and not the host.** The host has no `display` on the headless
1417
+ * tier, so it is inline, and an inline box reports no size: every column
1418
+ * with a minimum dropped at once. The part is a block, as wide as the room
1419
+ * the table has, whatever the rows hold, since it scrolls them.
1420
+ */
1421
+ private watchSize;
1383
1422
  disconnectedCallback(): void;
1384
1423
  /**
1385
1424
  * Notes whether Shift is held, before the press reaches a checkbox, whose
@@ -8,6 +8,7 @@ import { repeat } from 'lit/directives/repeat.js';
8
8
  import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
9
9
  import { html } from 'lit/static-html.js';
10
10
  import { edgeOf } from '../../table/edge.js';
11
+ import { droppedAt } from '../../table/fit.js';
11
12
  import { tracksOf } from '../../table/tracks.js';
12
13
  import '../../checkbox/index.js';
13
14
  import '../../divider/index.js';
@@ -162,6 +163,24 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
162
163
  measured: () => this.windowed,
163
164
  rows: () => (this.windowed ? this.drawn() : []),
164
165
  });
166
+ this.measuredInlineSize = undefined;
167
+ this.fontSizes = { em: 16, rem: 16 };
168
+ this.dropped = new Set();
169
+ this.sizeObserver = undefined;
170
+ this.handleSize = (entries) => {
171
+ const entry = entries[entries.length - 1];
172
+ if (!entry) {
173
+ return;
174
+ }
175
+ this.measuredInlineSize = entry.contentBoxSize?.[0]?.inlineSize ?? entry.contentRect.width;
176
+ this.fontSizes = {
177
+ em: Number.parseFloat(getComputedStyle(this).fontSize) || 16,
178
+ rem: Number.parseFloat(getComputedStyle(document.documentElement).fontSize) || 16,
179
+ };
180
+ if (this.fit()) {
181
+ requestAnimationFrame(() => this.requestUpdate());
182
+ }
183
+ };
165
184
  this.warnedAboutSize = false;
166
185
  this.toggleRow = (key, event) => {
167
186
  event.preventDefault();
@@ -686,7 +705,19 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
686
705
  return columns.map((column) => (column.field === '' ? column : (moving[next++] ?? column)));
687
706
  }
688
707
  get shownColumns() {
689
- return this.orderedColumns.filter((column) => column.shown);
708
+ return this.orderedColumns.filter((column) => column.shown && !this.dropped.has(column));
709
+ }
710
+ fit() {
711
+ const size = this.measuredInlineSize;
712
+ const columns = this.orderedColumns.filter((column) => column.shown);
713
+ const next = size === undefined || !columns.some((column) => column.minTableWidth !== '')
714
+ ? new Set()
715
+ : droppedAt(size, columns.map((column) => ({ column, minimum: column.minTableWidth })), this.fontSizes);
716
+ const same = next.size === this.dropped.size && [...next].every((column) => this.dropped.has(column));
717
+ if (!same) {
718
+ this.dropped = next;
719
+ }
720
+ return !same;
690
721
  }
691
722
  get fields() {
692
723
  return this.orderedColumns.filter((column) => column.field !== '').map((column) => column.field);
@@ -984,7 +1015,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
984
1015
  return this.requestOrder(fields, field);
985
1016
  }
986
1017
  csv() {
987
- const columns = this.shownColumns.filter((column) => column.field !== '');
1018
+ const columns = this.orderedColumns.filter((column) => column.shown && column.field !== '');
988
1019
  const rows = this.mode === 'server' && !this.childField ? this.rows : this.flat().rows;
989
1020
  const quote = (value) => {
990
1021
  if (value === undefined || value === null) {
@@ -1051,7 +1082,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
1051
1082
  if (!head?.assign) {
1052
1083
  return;
1053
1084
  }
1054
- const columns = this.orderedColumns;
1085
+ const columns = this.orderedColumns.filter((column) => !this.dropped.has(column));
1055
1086
  assignSlot(head, ...columns);
1056
1087
  const served = root.querySelector('[part="table"] > slot:not([name])');
1057
1088
  if (served) {
@@ -1107,6 +1138,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
1107
1138
  }
1108
1139
  willUpdate(changed) {
1109
1140
  super.willUpdate(changed);
1141
+ this.fit();
1110
1142
  this.hadFocus = this.hasUpdated && this.gridHasFocus();
1111
1143
  this.announced = this.news();
1112
1144
  hostAria(internalsOf(this), {
@@ -1459,7 +1491,9 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
1459
1491
  ${this.rowGrips ? this.renderGripHead(headStop && this.currentColumn === 0) : nothing}${this.selectable
1460
1492
  ? this.renderSelectAll(headStop && this.currentColumn === this.selectAt)
1461
1493
  : nothing}${this.assignsByName && !this.hydrating
1462
- ? this.orderedColumns.map((_, index) => html `<slot name=${`column-${index + 1}`} @slotchange=${this.handleSlotChange}></slot>`)
1494
+ ? this.orderedColumns.map((column, index) => this.dropped.has(column)
1495
+ ? nothing
1496
+ : html `<slot name=${`column-${index + 1}`} @slotchange=${this.handleSlotChange}></slot>`)
1463
1497
  : html `<slot name="columns" @slotchange=${this.handleSlotChange}></slot>`}${this.sourceKnown ? nothing : html `<slot @slotchange=${this.handleSlotChange}></slot>`}
1464
1498
  </div>
1465
1499
  ${serving
@@ -1509,6 +1543,19 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
1509
1543
  this.addEventListener('keydown', this.handleGridKey);
1510
1544
  this.addEventListener('keydown', this.handleGripKey);
1511
1545
  this.addEventListener('helix-before-resize', this.handleResize);
1546
+ this.watchSize();
1547
+ }
1548
+ firstUpdated(changed) {
1549
+ super.firstUpdated(changed);
1550
+ this.watchSize();
1551
+ }
1552
+ watchSize() {
1553
+ const table = this.partNamed('table');
1554
+ if (!table || typeof ResizeObserver === 'undefined') {
1555
+ return;
1556
+ }
1557
+ this.sizeObserver ??= new ResizeObserver(this.handleSize);
1558
+ this.sizeObserver.observe(table);
1512
1559
  }
1513
1560
  disconnectedCallback() {
1514
1561
  super.disconnectedCallback();
@@ -1523,6 +1570,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
1523
1570
  this.removeEventListener('keydown', this.handleGridKey);
1524
1571
  this.removeEventListener('keydown', this.handleGripKey);
1525
1572
  this.removeEventListener('helix-before-resize', this.handleResize);
1573
+ this.sizeObserver?.disconnect();
1526
1574
  }
1527
1575
  rowPartsOf(row, index) {
1528
1576
  const names = this.rowParts?.(row, index).trim();
@@ -154,12 +154,14 @@ export declare class HelixHeadlessDateInput extends HelixHeadlessDateInput_base
154
154
  protected readonly aria: AriaForwardController;
155
155
  /**
156
156
  * What the browser may autofill here, as one of the platform's own tokens,
157
- * such as `bday`.
157
+ * such as `bday`. `off` by default: the text a date is typed into is a text
158
+ * field to the browser, and its form history offered unrelated words a
159
+ * reader had typed elsewhere.
158
160
  *
159
- * Empty leaves the attribute off, which is the browser's default and is what
160
- * lets autofill work at all: hardcoding `off` here means a birthday or a
161
- * postal code can never be filled in for a reader. With `segmented`, a
162
- * hidden native date input carries it, since no browser fills the segments.
161
+ * **A default, never a fixed value.** Set a token such as `bday` and the
162
+ * browser fills it, so a birthday can still be filled in for a reader. With
163
+ * `segmented`, a hidden native date input carries the token, since no
164
+ * browser fills the segments. Set it empty to leave the attribute off.
163
165
  */
164
166
  autocomplete: string;
165
167
  /**
@@ -19,7 +19,7 @@ let HelixHeadlessDateInput = class HelixHeadlessDateInput extends MixinSegmented
19
19
  this.aria = new AriaForwardController(this, {
20
20
  target: () => this.partNamed('control') ?? this.segmentGroup,
21
21
  });
22
- this.autocomplete = '';
22
+ this.autocomplete = 'off';
23
23
  this.calendarLabel = 'Date Picker';
24
24
  this.clearable = false;
25
25
  this.clearLabel = 'Clear';
@@ -206,6 +206,12 @@ export declare class HelixHeadlessFilterInput extends HelixHeadlessFilterInput_b
206
206
  protected readonly aria: AriaForwardController;
207
207
  /** Typed, so every keystroke is announced. See `announcesInput`. */
208
208
  protected readonly announcesInput = true;
209
+ /**
210
+ * What the browser may autofill in the field, as an HTML `autocomplete`
211
+ * token. `off` by default, since a filter offers its own suggestions and the
212
+ * browser's form history would open a second list over them.
213
+ */
214
+ autocomplete: string;
209
215
  /**
210
216
  * Whether the field keeps a `FilterChip` for each filter in its `tags` slot,
211
217
  * from the `helix-facet` events it hears.
@@ -18,6 +18,7 @@ let HelixHeadlessFilterInput = class HelixHeadlessFilterInput extends MixinVoice
18
18
  target: () => this.partNamed('control'),
19
19
  });
20
20
  this.announcesInput = true;
21
+ this.autocomplete = 'off';
21
22
  this.chips = false;
22
23
  this.clearable = false;
23
24
  this.clearLabel = 'Clear';
@@ -644,6 +645,7 @@ let HelixHeadlessFilterInput = class HelixHeadlessFilterInput extends MixinVoice
644
645
  .value=${this.value}
645
646
  name=${this.name || nothing}
646
647
  placeholder=${this.placeholder || nothing}
648
+ autocomplete=${this.autocomplete || nothing}
647
649
  aria-describedby=${this.describedBy ?? nothing}
648
650
  aria-invalid=${this.invalidity ?? nothing}
649
651
  role=${this.suggesting ? 'combobox' : nothing}
@@ -695,6 +697,9 @@ let HelixHeadlessFilterInput = class HelixHeadlessFilterInput extends MixinVoice
695
697
  ${this.renderHint()}${this.renderFeedback()}`;
696
698
  }
697
699
  };
700
+ __decorate([
701
+ property()
702
+ ], HelixHeadlessFilterInput.prototype, "autocomplete", void 0);
698
703
  __decorate([
699
704
  property({ type: Boolean })
700
705
  ], HelixHeadlessFilterInput.prototype, "chips", void 0);
@@ -263,6 +263,9 @@ export declare class HelixHeadlessListbox extends HelixHeadlessListbox_base {
263
263
  * `::part(items)` as it likes, since the keys read where each option is
264
264
  * drawn. A list of `items` stays a stack. Left out, the list is a stack,
265
265
  * and the host carries no attribute for it.
266
+ *
267
+ * An option with an image in its `media` slot is drawn as a tile, the image
268
+ * above the label, for a picker of photos or products.
266
269
  */
267
270
  layout?: 'grid' | 'stack';
268
271
  /**
@@ -64,7 +64,7 @@ import '../../kbd/index.js';
64
64
  * @slot description - A line under the label that describes the row. It describes the row to a screen reader and is not part of its name.
65
65
  * @slot end - Words after the label, such as a count or a detail, beside any `shortcut`. They describe the row and are not part of its name.
66
66
  * @slot start - Content before the label, such as an icon.
67
- * @slot submenu - The rows of a submenu that this row opens.
67
+ * @slot submenu - The rows of a submenu that this row opens, each a menu item placed directly in the slot.
68
68
  *
69
69
  * @event {HelixBeforeCheckEvent} helix-before-check - A choice row is about to be checked or unchecked, carrying the state asked for. Cancelable: cancel it to keep the row as it is.
70
70
  * @event {HelixBeforeSelectEvent} helix-before-select - The row was chosen. Cancelable: cancel it to keep the menu open.
@@ -40,6 +40,14 @@ declare const HelixHeadlessMenu_base: (new (...args: any[]) => import("@fusion.d
40
40
  * its heading. Between runs of rows, a `<helix-divider>` is a separator a
41
41
  * screen reader announces.
42
42
  *
43
+ * **A row goes directly in the menu, in a `Menu.Section`, or in another row's
44
+ * `submenu` slot.** The menu reads rows in those places only. A row inside an
45
+ * element of your own, such as a `<div>` or a component's host element, is
46
+ * skipped by the arrow keys, and a drilled page hides that element with the
47
+ * rest of the top page, so the row's submenu shows none of its rows. A
48
+ * development build warns about it as `wrapped-row`. In a framework, render a
49
+ * component's rows without a wrapper element, such as with a fragment.
50
+ *
43
51
  * Keys: Enter, Space or Down Arrow on the trigger opens the menu on its first
44
52
  * row, and Up Arrow on its last. In the menu, Up and Down Arrow move between
45
53
  * rows, Home and End go to the first and the last, a typed letter moves to
@@ -227,6 +235,15 @@ export declare class HelixHeadlessMenu extends HelixHeadlessMenu_base {
227
235
  private get topRows();
228
236
  /** The rows of a submenu, or of the top page for null. */
229
237
  private rowsOf;
238
+ /** Every row the menu reads: the top page's, and each submenu's below them. */
239
+ private reachedRows;
240
+ /**
241
+ * Says, in development builds, when a row sits inside an element of the
242
+ * page's own. The menu reads only its children, its sections' rows and each
243
+ * row's `submenu` slot, and a drilled page hides every child that is not a
244
+ * row, wrapper and all.
245
+ */
246
+ private auditRows;
230
247
  /** The row whose submenu holds a row, or null for a row of the top page. */
231
248
  private holderOf;
232
249
  /** The submenus open, from the top page down to the deepest. */
@@ -1,5 +1,5 @@
1
1
  import { __decorate } from "tslib";
2
- import { AriaForwardController, anchorElement, auditEntry, customElement, DrilldownController, deepActiveElement, deepContains, elementById, focusTarget, HelixElement, inlineStep, internalsOf, KeyboardNavigationController, linkDescription, MIRROR_RULE, MixinCollection, MixinControllerOpen, numberConverter, OpenPhaseController, onUnlessFalse, PopoverController, scrollItemIntoView, sideOf, slottedWords, tellDisclosure, typeaheadBy, unlinkDescription, untilReactHydrated, words, } from '@fusion.dev/helix-core';
2
+ import { AriaForwardController, anchorElement, auditEntry, auditWrapped, customElement, DrilldownController, deepActiveElement, deepContains, elementById, focusTarget, HelixElement, inlineStep, internalsOf, KeyboardNavigationController, linkDescription, MIRROR_RULE, MixinCollection, MixinControllerOpen, numberConverter, OpenPhaseController, onUnlessFalse, PopoverController, scrollItemIntoView, sideOf, slottedWords, tellDisclosure, typeaheadBy, unlinkDescription, untilReactHydrated, words, } from '@fusion.dev/helix-core';
3
3
  import { caretLeft } from '@fusion.dev/helix-icons';
4
4
  import { html, nothing } from 'lit';
5
5
  import { property } from 'lit/decorators.js';
@@ -339,6 +339,23 @@ let HelixHeadlessMenu = class HelixHeadlessMenu extends MixinCollection(MixinCon
339
339
  ? [...holder.children].filter((child) => child.slot === 'submenu' && isItem(child))
340
340
  : this.topRows;
341
341
  }
342
+ reachedRows() {
343
+ const rows = [];
344
+ const walk = (holder) => {
345
+ for (const row of this.rowsOf(holder)) {
346
+ rows.push(row);
347
+ walk(row);
348
+ }
349
+ };
350
+ walk(null);
351
+ return rows;
352
+ }
353
+ auditRows() {
354
+ const tier = this.constructor.tier;
355
+ auditWrapped(this, `${tier}menu-item`, () => this.reachedRows(), (stray) => this.drilldown.hasPage(stray)
356
+ ? 'its submenu shows none of its rows and the arrow keys skip it'
357
+ : 'the arrow keys skip it', `Place each <${tier}menu-item> directly in the menu, in a <${tier}menu-section>, or in the submenu slot of another row.`);
358
+ }
342
359
  holderOf(row) {
343
360
  const parent = row.parentElement;
344
361
  return row.slot === 'submenu' && parent && isItem(parent) ? parent : null;
@@ -681,6 +698,7 @@ let HelixHeadlessMenu = class HelixHeadlessMenu extends MixinCollection(MixinCon
681
698
  }
682
699
  if (changed.has('open') && this.open) {
683
700
  this.toldChecked = this.checkedValues.join('\u0000');
701
+ this.auditRows();
684
702
  }
685
703
  if (!this.context) {
686
704
  this.tellTrigger();
@@ -104,12 +104,13 @@ export declare class HelixHeadlessNumberInput extends HelixHeadlessNumberInput_b
104
104
  /** Typed or dragged, so every edit is announced. See `announcesInput`. */
105
105
  protected readonly announcesInput = true;
106
106
  /**
107
- * What the browser may autofill, as an HTML `autocomplete` token.
107
+ * What the browser may autofill, as an HTML `autocomplete` token, such as
108
+ * `postal-code`. `off` by default, since a number field's form history is
109
+ * every number ever typed into a field of the same name.
108
110
  *
109
- * Empty leaves the attribute off, which is the browser's default and is what
110
- * lets autofill work at all. Hardcoding `off` here is what stops a reader
111
- * having a birthday or a postal code filled in for them, with no way for a
112
- * consumer to ask for it.
111
+ * **A default, never a fixed value.** Set a token and the browser fills it,
112
+ * so a postal code or a card's expiry month can still be filled in for a
113
+ * reader. Set it empty to leave the attribute off.
113
114
  */
114
115
  autocomplete: string;
115
116
  /**
@@ -31,7 +31,7 @@ let HelixHeadlessNumberInput = class HelixHeadlessNumberInput extends MixinContr
31
31
  target: () => this.partNamed('control'),
32
32
  });
33
33
  this.announcesInput = true;
34
- this.autocomplete = '';
34
+ this.autocomplete = 'off';
35
35
  this.badInputMessage = 'Please enter a number.';
36
36
  this.decrementLabel = 'Decrease';
37
37
  this.incrementLabel = 'Increase';
@@ -22,11 +22,17 @@ export { isOption, optionsAmong } from '../among.js';
22
22
  * nothing, as an entry in a command palette that goes to a page does.
23
23
  *
24
24
  * The option's name is its label alone, as React Aria's `slot="label"` makes
25
- * it: what is in `start` and `end`, an avatar's initials or a shortcut, is
26
- * drawn and not read as part of the name. The description is read as the
25
+ * it: what is in `start`, `end` and `media`, an avatar's initials, a shortcut
26
+ * or a photo, is drawn and not read as part of the name. The description is read as the
27
27
  * option's description. A name you give with `aria-label` or
28
28
  * `aria-labelledby` wins over both.
29
29
  *
30
+ * **An image goes in `media`, above the label**, for an option drawn as a
31
+ * tile, such as a photo or a product in a listbox with `layout="grid"`. The
32
+ * row is still the option: choosing, the arrow keys and the highlight work as
33
+ * they do on a row with no image, and the label stays its name, so give the
34
+ * image an empty `alt`.
35
+ *
30
36
  * @since 0.1.0
31
37
  * @status stable
32
38
  * @category forms
@@ -37,6 +43,7 @@ export { isOption, optionsAmong } from '../among.js';
37
43
  * @slot description - A second line under the label, for content richer than the `description` text.
38
44
  * @slot end - Content after the label, such as a shortcut or a count.
39
45
  * @slot indicator - An icon shown while the option is chosen, in place of the check the styled option draws.
46
+ * @slot media - An image above the label, for an option drawn as a tile.
40
47
  * @slot start - Content before the label, such as an icon or an avatar.
41
48
  *
42
49
  * @event {HelixBeforeSelectEvent} helix-before-select - The option was chosen. Cancelable: canceling it leaves the selection as it was, and keeps the browser from following an option's `href`.
@@ -51,6 +58,7 @@ export { isOption, optionsAmong } from '../among.js';
51
58
  * @cssstate active - While the keyboard is on the option, which is the option `aria-activedescendant` names.
52
59
  * @cssstate disabled - While the option cannot be chosen.
53
60
  * @cssstate has-indicator - An icon is slotted into `indicator`.
61
+ * @cssstate has-media - Something is slotted into `media`.
54
62
  * @cssstate hovered - While a mouse or a pen is over the option. A touch sets no hover, as React Aria's `data-hovered` does not.
55
63
  * @cssstate pressing - While a pointer presses the option, from the press to the release.
56
64
  * @cssstate selected - While the option is chosen.
@@ -275,6 +283,17 @@ export declare class HelixHeadlessOption extends HelixElement {
275
283
  * consumer's markup means. What stops is the write back.
276
284
  */
277
285
  protected willUpdate(changed: PropertyValues): void;
286
+ /**
287
+ * Reads whether `media` holds anything once the row is drawn, whether this
288
+ * element drew it or hydrated a server's.
289
+ *
290
+ * **`slotchange` alone misses a hydrated option.** A server's shadow root is
291
+ * parsed with the page, so its slots are filled before Lit binds the
292
+ * listener and the event has already gone. Measured on the hydration check in CI:
293
+ * a tile served that way drew its image beside the label, 569 pixels off
294
+ * the same tile drawn by a client.
295
+ */
296
+ protected firstUpdated(changed: PropertyValues): void;
278
297
  /**
279
298
  * The name is the label part and the description the description part, by
280
299
  * reference, because the host's own content runs `start` and `end` into its
@@ -68,6 +68,13 @@ let HelixHeadlessOption = class HelixHeadlessOption extends HelixElement {
68
68
  this.toggleState('active', this.active);
69
69
  this.toggleState('disabled', this.disabled);
70
70
  }
71
+ firstUpdated(changed) {
72
+ super.firstUpdated(changed);
73
+ const media = this.renderRoot.querySelector('slot[name="media"]');
74
+ if (media) {
75
+ this.toggleState('has-media', slotFilled(media));
76
+ }
77
+ }
71
78
  updated(changed) {
72
79
  super.updated(changed);
73
80
  const named = this.hasAttribute('aria-label') || this.hasAttribute('aria-labelledby');
@@ -102,6 +109,10 @@ let HelixHeadlessOption = class HelixHeadlessOption extends HelixElement {
102
109
  @pointerleave=${this.handlePointerLeave}
103
110
  @pointerup=${this.handlePointerUp}
104
111
  >
112
+ <slot
113
+ name="media"
114
+ @slotchange=${(event) => this.toggleState('has-media', slotFilled(event.target))}
115
+ ></slot>
105
116
  <slot name="start"></slot>
106
117
  <span part="text">
107
118
  <span part="label"><slot>${this.label}</slot></span>
@@ -147,6 +147,25 @@ export declare class HelixHeadlessTableColumn extends HelixElement {
147
147
  * `{named}` is `no` for a column without one.
148
148
  */
149
149
  menuLabel: string;
150
+ /**
151
+ * The narrowest a `DataTable` can be with this column showing, as a length
152
+ * in `px`, `rem` or `em`, such as `40rem`. While the table is narrower, it
153
+ * leaves the column out: its heading, its track and its cells.
154
+ *
155
+ * Give the columns a reader can do without the widest minimums, so they go
156
+ * first as the table narrows. The columns that stay keep their widths and
157
+ * their edges, and every row keeps its cells under their headings, as with
158
+ * `hidden`. A column left out is not in the grid at all, so `aria-colcount`
159
+ * counts the columns that show and a screen reader moves among those alone.
160
+ * Widen the table and the column comes back in its place.
161
+ *
162
+ * The table measures its own box, so a server draws every column and the
163
+ * page leaves out what does not fit once it runs. A percentage or a
164
+ * viewport unit is no width of the table, and leaves the column in. One
165
+ * column always shows. Left unset, the column shows at any width. A `Table`
166
+ * ignores it, since its cells are markup you wrote.
167
+ */
168
+ minTableWidth: string;
150
169
  /**
151
170
  * The accessible name of the grip that moves the column. `{name}` is the
152
171
  * heading text, and `{named}` is `no` for a column without one, so the
@@ -14,6 +14,7 @@ let HelixHeadlessTableColumn = class HelixHeadlessTableColumn extends HelixEleme
14
14
  this.field = '';
15
15
  this.menu = false;
16
16
  this.menuLabel = '{named, select, no {Column menu} other {{name} column menu}}';
17
+ this.minTableWidth = '';
17
18
  this.moveLabel = '{named, select, no {Move column} other {Move {name}}}';
18
19
  this.resizable = false;
19
20
  this.resizeLabel = '{named, select, no {Resize column} other {Resize {name}}}';
@@ -150,7 +151,10 @@ let HelixHeadlessTableColumn = class HelixHeadlessTableColumn extends HelixEleme
150
151
  }
151
152
  updated(changed) {
152
153
  super.updated(changed);
153
- if (changed.has('menu') || changed.has('textAlign') || changed.has('width')) {
154
+ if (changed.has('menu') ||
155
+ changed.has('minTableWidth') ||
156
+ changed.has('textAlign') ||
157
+ changed.has('width')) {
154
158
  this.tellHolder();
155
159
  }
156
160
  }
@@ -248,6 +252,9 @@ __decorate([
248
252
  words,
249
253
  property({ attribute: 'menu-label' })
250
254
  ], HelixHeadlessTableColumn.prototype, "menuLabel", void 0);
255
+ __decorate([
256
+ property({ attribute: 'min-table-width' })
257
+ ], HelixHeadlessTableColumn.prototype, "minTableWidth", void 0);
251
258
  __decorate([
252
259
  words,
253
260
  property({ attribute: 'move-label' })
@@ -0,0 +1,26 @@
1
+ /** The font sizes a length in `em` and `rem` is read against, in pixels. */
2
+ export interface FontSizes {
3
+ /** The table's own font size, which `em` is a multiple of. */
4
+ em: number;
5
+ /** The document's font size, which `rem` is a multiple of. */
6
+ rem: number;
7
+ }
8
+ /**
9
+ * A length in pixels: `640px`, `40rem`, `40em`, or a bare number, which is
10
+ * pixels. Anything else, a percentage or a viewport unit among them, is no
11
+ * length here and is `undefined`, being a share of something other than the
12
+ * table.
13
+ */
14
+ export declare const pixelsOf: (length: string, sizes: FontSizes) => number | undefined;
15
+ /**
16
+ * The columns left out of a table `inlineSize` pixels wide: each whose minimum
17
+ * table width is more than that.
18
+ *
19
+ * **One column always stays**, the first in the list, where every column would
20
+ * go: a table with no columns draws its rows as nothing, and a reader cannot
21
+ * tell it from an empty one. A minimum that is no length leaves its column in.
22
+ */
23
+ export declare const droppedAt: <Column>(inlineSize: number, columns: readonly {
24
+ column: Column;
25
+ minimum: string;
26
+ }[], sizes: FontSizes) => Set<Column>;
@@ -0,0 +1,23 @@
1
+ export const pixelsOf = (length, sizes) => {
2
+ const match = /^\s*(\d+(?:\.\d+)?|\.\d+)\s*(px|rem|em)?\s*$/i.exec(length);
3
+ if (!match) {
4
+ return undefined;
5
+ }
6
+ const amount = Number(match[1]);
7
+ const unit = (match[2] ?? 'px').toLowerCase();
8
+ return unit === 'px' ? amount : amount * (unit === 'rem' ? sizes.rem : sizes.em);
9
+ };
10
+ export const droppedAt = (inlineSize, columns, sizes) => {
11
+ const dropped = new Set();
12
+ for (const { column, minimum } of columns) {
13
+ const pixels = minimum === '' ? undefined : pixelsOf(minimum, sizes);
14
+ if (pixels !== undefined && inlineSize < pixels) {
15
+ dropped.add(column);
16
+ }
17
+ }
18
+ const first = columns[0];
19
+ if (first && dropped.size === columns.length) {
20
+ dropped.delete(first.column);
21
+ }
22
+ return dropped;
23
+ };
@@ -172,9 +172,11 @@ export declare class HelixHeadlessTimeInput extends HelixHeadlessTimeInput_base
172
172
  protected readonly aria: AriaForwardController;
173
173
  /**
174
174
  * What the browser may autofill here, as one of the platform's own tokens.
175
+ * `off` by default, since a time field's form history is unrelated text a
176
+ * reader typed elsewhere.
175
177
  *
176
- * Empty leaves the attribute off, which is the browser's default and is what
177
- * lets autofill work at all.
178
+ * A default, never a fixed value: set a token and the browser fills it, or
179
+ * set it empty to leave the attribute off.
178
180
  */
179
181
  autocomplete: string;
180
182
  /**
@@ -13,7 +13,7 @@ let HelixHeadlessTimeInput = class HelixHeadlessTimeInput extends MixinSegmented
13
13
  this.aria = new AriaForwardController(this, {
14
14
  target: () => this.partNamed('control') ?? this.segmentGroup,
15
15
  });
16
- this.autocomplete = '';
16
+ this.autocomplete = 'off';
17
17
  this.clearable = false;
18
18
  this.clearLabel = 'Clear';
19
19
  this.announcesInput = true;