@fusion.dev/helix-headless 0.236.0 → 0.237.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.
- package/api.json +1 -1
- package/custom-elements.json +1 -1
- package/dist/app-header/root/app-header-root.d.ts +9 -0
- package/dist/app-header/root/app-header-root.js +21 -0
- package/dist/area-chart/root/area-chart-root.d.ts +29 -15
- package/dist/area-chart/root/area-chart-root.js +10 -7
- package/dist/bar-chart/root/bar-chart-root.d.ts +41 -23
- package/dist/bar-chart/root/bar-chart-root.js +15 -10
- package/dist/button/root/button-root.js +1 -1
- package/dist/canvas/root/canvas-root.d.ts +10 -3
- package/dist/canvas/root/canvas-root.js +31 -14
- package/dist/color-input/root/color-input-root.d.ts +4 -2
- package/dist/color-input/root/color-input-root.js +1 -1
- package/dist/combobox/root/combobox-root.d.ts +8 -7
- package/dist/combobox/root/combobox-root.js +7 -3
- package/dist/command/root/command-root.d.ts +22 -2
- package/dist/command/root/command-root.js +39 -5
- package/dist/data-table/root/data-table-root.d.ts +10 -7
- package/dist/data-table/root/data-table-root.js +6 -1
- package/dist/date-picker/root/date-picker-root.d.ts +1 -1
- package/dist/date-picker/root/date-picker-root.js +9 -2
- package/dist/dialog/root/dialog-root.d.ts +13 -3
- package/dist/dialog/root/dialog-root.js +33 -2
- package/dist/donut-chart/root/donut-chart-root.d.ts +23 -1
- package/dist/donut-chart/root/donut-chart-root.js +41 -13
- package/dist/drawer/root/drawer-root.d.ts +10 -2
- package/dist/drawer/root/drawer-root.js +34 -1
- package/dist/filter-input/chip/filter-chip.js +2 -2
- package/dist/find/root/find-root.d.ts +11 -1
- package/dist/find/root/find-root.js +11 -0
- package/dist/heatmap/root/heatmap-root.d.ts +11 -8
- package/dist/heatmap/root/heatmap-root.js +27 -2
- package/dist/kbd/root/kbd-root.d.ts +4 -0
- package/dist/kbd/root/kbd-root.js +2 -1
- package/dist/lightbox/root/lightbox-root.js +3 -2
- package/dist/line-chart/root/line-chart-root.d.ts +36 -23
- package/dist/line-chart/root/line-chart-root.js +20 -13
- package/dist/list/item/list-item.d.ts +2 -1
- package/dist/list/item/list-item.js +4 -1
- package/dist/list/root/list-root.d.ts +33 -8
- package/dist/list/root/list-root.js +17 -3
- package/dist/listbox/root/listbox-root.d.ts +48 -15
- package/dist/listbox/root/listbox-root.js +65 -6
- package/dist/map/root/map-root.js +7 -7
- package/dist/markdown/tree.d.ts +6 -1
- package/dist/markdown/tree.js +1 -1
- package/dist/megamenu/root/megamenu-root.d.ts +19 -0
- package/dist/megamenu/root/megamenu-root.js +24 -0
- package/dist/menu/filter/menu-filter.js +3 -1
- package/dist/menu/item/menu-item.d.ts +12 -0
- package/dist/menu/item/menu-item.js +3 -0
- package/dist/menu/root/menu-root.d.ts +7 -1
- package/dist/menu/root/menu-root.js +6 -3
- package/dist/motion-toggle/root/motion-toggle-root.js +2 -2
- package/dist/notifications/notification/notification.d.ts +1 -0
- package/dist/notifications/notification/notification.js +1 -0
- package/dist/notifications/root/notifications-root.d.ts +7 -5
- package/dist/notifications/root/notifications-root.js +1 -1
- package/dist/number-input/root/number-input-root.d.ts +6 -0
- package/dist/number-input/root/number-input-root.js +14 -4
- package/dist/object-inspector/root/object-inspector-root.d.ts +6 -5
- package/dist/object-inspector/root/object-inspector-root.js +9 -3
- package/dist/option/root/option-root.d.ts +14 -0
- package/dist/option/root/option-root.js +3 -0
- package/dist/pagination/root/pagination-root.d.ts +36 -0
- package/dist/pagination/root/pagination-root.js +55 -2
- package/dist/pin-input/code.js +1 -1
- package/dist/qr-code/root/qr-code-root.d.ts +1 -0
- package/dist/qr-code/root/qr-code-root.js +1 -0
- package/dist/rating/root/rating-root.d.ts +1 -0
- package/dist/rating/root/rating-root.js +1 -0
- package/dist/scatter-chart/root/scatter-chart-root.d.ts +6 -0
- package/dist/select/root/select-root.d.ts +27 -1
- package/dist/select/root/select-root.js +34 -3
- package/dist/shortcut-overlay/root/shortcut-overlay-root.d.ts +5 -0
- package/dist/shortcut-overlay/root/shortcut-overlay-root.js +15 -1
- package/dist/skeleton/root/skeleton-root.d.ts +1 -0
- package/dist/skeleton/root/skeleton-root.js +3 -0
- package/dist/sparkline/root/sparkline-root.d.ts +53 -0
- package/dist/sparkline/root/sparkline-root.js +37 -1
- package/dist/spatial-bar-chart/root/spatial-bar-chart-root.d.ts +4 -1
- package/dist/spatial-bar-chart/root/spatial-bar-chart-root.js +2 -2
- package/dist/spatial-ribbon-chart/root/spatial-ribbon-chart-root.d.ts +3 -0
- package/dist/spatial-ribbon-chart/root/spatial-ribbon-chart-root.js +2 -2
- package/dist/spatial-scatter-chart/root/spatial-scatter-chart-root.d.ts +3 -0
- package/dist/spatial-scatter-chart/root/spatial-scatter-chart-root.js +2 -2
- package/dist/spatial-scatter-chart/view.d.ts +17 -8
- package/dist/spatial-scatter-chart/view.js +7 -6
- package/dist/spatial-surface-chart/root/spatial-surface-chart-root.d.ts +3 -0
- package/dist/spatial-surface-chart/root/spatial-surface-chart-root.js +2 -2
- package/dist/spatial-treemap/root/spatial-treemap-root.d.ts +3 -0
- package/dist/spatial-treemap/root/spatial-treemap-root.js +2 -2
- package/dist/splitter/root/splitter-root.js +3 -1
- package/dist/stat/group/stat-group.d.ts +13 -0
- package/dist/stat/group/stat-group.js +22 -1
- package/dist/stat/root/stat-root.d.ts +62 -1
- package/dist/stat/root/stat-root.js +146 -4
- package/dist/table/cell/table-cell.d.ts +1 -0
- package/dist/table/cell/table-cell.js +4 -0
- package/dist/table/root/table-root.d.ts +7 -6
- package/dist/table/root/table-root.js +1 -1
- package/dist/tabs/tab/tab.js +2 -2
- package/dist/tag/root/tag-root.js +2 -2
- package/dist/timeline/root/timeline-root.d.ts +2 -2
- package/dist/timeline/root/timeline-root.js +1 -1
- package/dist/toast/root/toast-root.d.ts +53 -6
- package/dist/toast/root/toast-root.js +158 -1
- package/dist/toggle/root/toggle-root.d.ts +1 -0
- package/dist/toggle/root/toggle-root.js +1 -1
- package/dist/video-playlist/root/video-playlist-root.d.ts +1 -0
- package/dist/video-playlist/root/video-playlist-root.js +2 -0
- package/dist/virtual-list/root/virtual-list-root.d.ts +2 -2
- package/dist/virtual-list/root/virtual-list-root.js +1 -1
- package/examples.json +1 -1
- package/lint.json +1 -1
- package/package.json +5 -5
- package/types/jsx.d.ts +633 -168
- package/types/vue.d.ts +379 -95
- package/types/words.d.ts +51 -12
|
@@ -71,18 +71,18 @@ import { type ListSelectionBehavior, type ListSelectionMode } from '../selection
|
|
|
71
71
|
* no `start` counts down from the number of rows, which a server cannot know,
|
|
72
72
|
* so served markup counts from one until the list runs.
|
|
73
73
|
*
|
|
74
|
-
* **An empty list.**
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
* shows.
|
|
74
|
+
* **An empty list.** A list with no rows and none loading shows a row that
|
|
75
|
+
* says "Nothing to show", the words every collection uses. Set `empty-text`,
|
|
76
|
+
* or put your own content in the `empty` slot, to say more, such as "No files
|
|
77
|
+
* yet" and a link to add one. An empty `empty-text` shows no row. The list
|
|
78
|
+
* takes the `empty` state while it has no rows, whatever it shows.
|
|
79
79
|
*
|
|
80
80
|
* **Loading more.** `load-more` sends `helix-load-more` once the end of the
|
|
81
81
|
* list comes within a screen of view, in the box that scrolls it or the page,
|
|
82
82
|
* once for each number of rows: add rows and it can send it again. While you
|
|
83
83
|
* fetch, set `loading`: the list is busy, and a row after the last says
|
|
84
|
-
* "Loading
|
|
85
|
-
*
|
|
84
|
+
* "Loading" (`loading-text`, or your own content in the `loading` slot). The
|
|
85
|
+
* list asks for nothing while `loading` is set.
|
|
86
86
|
*
|
|
87
87
|
* An interactive list with no name is reported once in a development build,
|
|
88
88
|
* since a screen reader announces it as a grid and nothing more. Name it with
|
|
@@ -96,6 +96,7 @@ import { type ListSelectionBehavior, type ListSelectionMode } from '../selection
|
|
|
96
96
|
*
|
|
97
97
|
* @slot - The rows.
|
|
98
98
|
* @slot empty - Content for the row shown while the list has no rows and none are loading. Falls back to `empty-text`.
|
|
99
|
+
* @slot error - Content shown after `error-text` while it is set, such as a button that tries again.
|
|
99
100
|
* @slot loading - Content for the row after the last while `loading` is set. Falls back to `loading-text`.
|
|
100
101
|
*
|
|
101
102
|
* @event {Event} change - Fired once a press has changed which rows are selected.
|
|
@@ -107,6 +108,7 @@ import { type ListSelectionBehavior, type ListSelectionMode } from '../selection
|
|
|
107
108
|
*
|
|
108
109
|
* @csspart drag-preview - A copy of the row a pointer drags, which follows the pointer in the top layer until the row is let go, in a `reorderable` list. Hidden from assistive technology.
|
|
109
110
|
* @csspart empty - The row shown while the list has no rows and none are loading, where `empty-text` or the `empty` slot gives it content. A grid row with one cell in a list that selects.
|
|
111
|
+
* @csspart error - The row after the last while `error-text` is set, in place of the empty and loading rows: the words, then the `error` slot. A grid row with one cell in a list that selects.
|
|
110
112
|
* @csspart live - The region that says each step of a move to screen readers, in a `reorderable` list. Drawn from the first move. Visually hidden in the styled tier.
|
|
111
113
|
* @csspart loading - The row after the last while `loading` is set. A grid row with one cell in a list that selects.
|
|
112
114
|
*
|
|
@@ -114,6 +116,7 @@ import { type ListSelectionBehavior, type ListSelectionMode } from '../selection
|
|
|
114
116
|
* @cssproperty --list-step - What each row adds to the number before it: `1`, or `-1` where `reversed`.
|
|
115
117
|
*
|
|
116
118
|
* @cssstate empty - While the list has no rows.
|
|
119
|
+
* @cssstate error - While `error-text` is set.
|
|
117
120
|
* @cssstate loading - While `loading` is set.
|
|
118
121
|
*/
|
|
119
122
|
export declare class HelixHeadlessList extends HelixElement {
|
|
@@ -149,6 +152,17 @@ export declare class HelixHeadlessList extends HelixElement {
|
|
|
149
152
|
* slot is empty. An empty string shows no row.
|
|
150
153
|
*/
|
|
151
154
|
emptyText: string;
|
|
155
|
+
/**
|
|
156
|
+
* The words shown after the rows when they did not load, such as "The files
|
|
157
|
+
* did not load". Set it when a fetch fails, and clear it once you try again.
|
|
158
|
+
* Empty, the default, shows nothing.
|
|
159
|
+
*
|
|
160
|
+
* While it is set, a row after the last shows it, followed by your own
|
|
161
|
+
* content in the `error` slot, such as a button that tries again, in place of
|
|
162
|
+
* the empty and loading rows, and screen readers hear it. Table, Listbox, and
|
|
163
|
+
* every chart take the same property and slot.
|
|
164
|
+
*/
|
|
165
|
+
errorText: string;
|
|
152
166
|
/**
|
|
153
167
|
* The kind of list, which follows from the content.
|
|
154
168
|
*
|
|
@@ -187,7 +201,11 @@ export declare class HelixHeadlessList extends HelixElement {
|
|
|
187
201
|
* @deprecated Use `loading-text`. Removed in the next release.
|
|
188
202
|
*/
|
|
189
203
|
loadingLabel?: string;
|
|
190
|
-
/**
|
|
204
|
+
/**
|
|
205
|
+
* The text of the row drawn while `loading` is set, where the `loading` slot
|
|
206
|
+
* is empty. "Loading", the word every collection uses, since the same row
|
|
207
|
+
* stands alone in a list that has no rows yet.
|
|
208
|
+
*/
|
|
191
209
|
loadingText: string;
|
|
192
210
|
/**
|
|
193
211
|
* Sends `helix-load-more` once the end of the list comes within a screen of
|
|
@@ -397,6 +415,13 @@ export declare class HelixHeadlessList extends HelixElement {
|
|
|
397
415
|
* while it has neither `empty-text` nor content in the `empty` slot.
|
|
398
416
|
*/
|
|
399
417
|
private drawEmpty;
|
|
418
|
+
/**
|
|
419
|
+
* The row after the last while `error-text` is set: the words and then the
|
|
420
|
+
* `error` slot, so a button that tries again never stands alone with no
|
|
421
|
+
* reason for it. A list item, or a grid row with one cell in a list that
|
|
422
|
+
* selects, carrying no value, so a key never lands on it.
|
|
423
|
+
*/
|
|
424
|
+
private drawError;
|
|
400
425
|
/**
|
|
401
426
|
* The row after the last while `loading` is set: a list item, or a grid row
|
|
402
427
|
* with one cell in a list that selects. It is not one of the rows, so it
|
|
@@ -11,10 +11,11 @@ let HelixHeadlessList = class HelixHeadlessList extends HelixElement {
|
|
|
11
11
|
super(...arguments);
|
|
12
12
|
this.canceledLabel = 'Canceled';
|
|
13
13
|
this.droppedLabel = 'Dropped';
|
|
14
|
-
this.emptyText = '
|
|
14
|
+
this.emptyText = 'Nothing to show';
|
|
15
|
+
this.errorText = '';
|
|
15
16
|
this.label = '';
|
|
16
17
|
this.loading = false;
|
|
17
|
-
this.loadingText = 'Loading
|
|
18
|
+
this.loadingText = 'Loading';
|
|
18
19
|
this.loadMore = false;
|
|
19
20
|
this.movedLabel = '{name} moved to position {position} of {count}';
|
|
20
21
|
this.moveLabel = 'Move {name}';
|
|
@@ -386,6 +387,10 @@ let HelixHeadlessList = class HelixHeadlessList extends HelixElement {
|
|
|
386
387
|
super.willUpdate(changed);
|
|
387
388
|
hostAria(internalsOf(this), { label: this.label, role: this.interactive ? 'grid' : 'list' });
|
|
388
389
|
internalsOf(this).ariaBusy = this.loading ? 'true' : null;
|
|
390
|
+
if (changed.has('errorText') && this.errorText !== '') {
|
|
391
|
+
this.status.say(this.errorText);
|
|
392
|
+
}
|
|
393
|
+
this.toggleState('error', this.errorText !== '');
|
|
389
394
|
internalsOf(this).ariaMultiSelectable = this.selectionMode === 'multiple' ? 'true' : null;
|
|
390
395
|
}
|
|
391
396
|
get numbers() {
|
|
@@ -395,7 +400,7 @@ let HelixHeadlessList = class HelixHeadlessList extends HelixElement {
|
|
|
395
400
|
return counted ? `--list-first: ${counted.first}; --list-step: ${counted.step}` : nothing;
|
|
396
401
|
}
|
|
397
402
|
render() {
|
|
398
|
-
return html `<slot style=${this.numbers} @slotchange=${this.handleSlotChange}></slot>${this.drawLoading()}${this.drawEmpty()}${this.loadMore ? html `<span data-end aria-hidden="true"></span>` : nothing}${drawStatus(this.status)}${this.reorder.drawDragPreview()}`;
|
|
403
|
+
return html `<slot style=${this.numbers} @slotchange=${this.handleSlotChange}></slot>${this.errorText === '' ? html `${this.drawLoading()}${this.drawEmpty()}` : this.drawError()}${this.loadMore ? html `<span data-end aria-hidden="true"></span>` : nothing}${drawStatus(this.status)}${this.reorder.drawDragPreview()}`;
|
|
399
404
|
}
|
|
400
405
|
drawEmpty() {
|
|
401
406
|
if (!this.childrenKnown || this.rows.length > 0 || this.loading) {
|
|
@@ -408,6 +413,12 @@ let HelixHeadlessList = class HelixHeadlessList extends HelixElement {
|
|
|
408
413
|
? html `<div part="empty" role="row" ?hidden=${!shown}><div role="gridcell">${content}</div></div>`
|
|
409
414
|
: html `<div part="empty" role="listitem" ?hidden=${!shown}>${content}</div>`;
|
|
410
415
|
}
|
|
416
|
+
drawError() {
|
|
417
|
+
const content = html `${this.errorText}<slot name="error"></slot>`;
|
|
418
|
+
return this.interactive
|
|
419
|
+
? html `<div part="error" role="row"><div role="gridcell">${content}</div></div>`
|
|
420
|
+
: html `<div part="error" role="listitem">${content}</div>`;
|
|
421
|
+
}
|
|
411
422
|
drawLoading() {
|
|
412
423
|
if (!this.loading) {
|
|
413
424
|
return nothing;
|
|
@@ -464,6 +475,9 @@ __decorate([
|
|
|
464
475
|
words,
|
|
465
476
|
property({ attribute: 'empty-text' })
|
|
466
477
|
], HelixHeadlessList.prototype, "emptyText", void 0);
|
|
478
|
+
__decorate([
|
|
479
|
+
property({ attribute: 'error-text' })
|
|
480
|
+
], HelixHeadlessList.prototype, "errorText", void 0);
|
|
467
481
|
__decorate([
|
|
468
482
|
property({ reflect: true })
|
|
469
483
|
], HelixHeadlessList.prototype, "kind", void 0);
|
|
@@ -54,7 +54,7 @@ declare const HelixHeadlessListbox_base: (new (...args: any[]) => import("@fusio
|
|
|
54
54
|
*
|
|
55
55
|
* As a filter narrows the list, a screen reader hears how many options are
|
|
56
56
|
* left, such as "3 results", from `result-label` and `results-label`. A filter
|
|
57
|
-
* that leaves none says `
|
|
57
|
+
* that leaves none says `no-results-text`.
|
|
58
58
|
*
|
|
59
59
|
* **Moving options** is a separate import, `@fusion.dev/helix/listbox/reorder`,
|
|
60
60
|
* so a list that never moves options carries none of its code. With it
|
|
@@ -97,7 +97,7 @@ declare const HelixHeadlessListbox_base: (new (...args: any[]) => import("@fusio
|
|
|
97
97
|
*
|
|
98
98
|
* @slot - The options, and any groups of them.
|
|
99
99
|
* @slot empty - What the list shows when it has no options to show, for content richer than `empty-text`.
|
|
100
|
-
* @slot error -
|
|
100
|
+
* @slot error - Content shown after `error-text` while it is set, such as a button that tries again.
|
|
101
101
|
* @slot feedback - The message that says what is wrong, for content richer than a string. It shows while there is a message.
|
|
102
102
|
* @slot filter-icon - The icon in the filter field. Defaults to a magnifying glass.
|
|
103
103
|
* @slot hint - The hint, for content richer than plain text.
|
|
@@ -117,7 +117,7 @@ declare const HelixHeadlessListbox_base: (new (...args: any[]) => import("@fusio
|
|
|
117
117
|
* @event {Event} input - Fired after the value changes.
|
|
118
118
|
*
|
|
119
119
|
* @csspart empty - The text shown when the list has no options to show, or the filter hides every one. `:state(no-results)` is set for the second.
|
|
120
|
-
* @csspart error - The text shown while `error-text` is set.
|
|
120
|
+
* @csspart error - The text shown while `error-text` is set, followed by the `error` slot.
|
|
121
121
|
* @csspart feedback - The message that says what is wrong with the value.
|
|
122
122
|
* @csspart filter-icon - The icon beside the filter field.
|
|
123
123
|
* @csspart filter-mark - The default icon beside the filter field, shown when none is slotted.
|
|
@@ -167,12 +167,11 @@ export declare class HelixHeadlessListbox extends HelixHeadlessListbox_base {
|
|
|
167
167
|
*/
|
|
168
168
|
defaultFilter: string;
|
|
169
169
|
/**
|
|
170
|
-
* The text shown when the filter hides every
|
|
170
|
+
* The text shown when the list has no options. A filter that hides every
|
|
171
|
+
* option shows `no-results-text`.
|
|
171
172
|
*
|
|
172
|
-
* From `MixinCollection`,
|
|
173
|
-
*
|
|
174
|
-
* about a filter, and the mixin's "Nothing to show" is about a list that was
|
|
175
|
-
* never given anything.
|
|
173
|
+
* From `MixinCollection`, and re-declared here to name what the list holds,
|
|
174
|
+
* as Select does.
|
|
176
175
|
*/
|
|
177
176
|
emptyText: string;
|
|
178
177
|
/** What the list is narrowed to, whoever set it. */
|
|
@@ -292,11 +291,9 @@ export declare class HelixHeadlessListbox extends HelixHeadlessListbox_base {
|
|
|
292
291
|
multiple: boolean;
|
|
293
292
|
/**
|
|
294
293
|
* The text shown when a filter hides every option of a list that has some.
|
|
295
|
-
*
|
|
296
|
-
* Absent, the list says `empty-text` in both cases. Set it to tell "nothing
|
|
297
|
-
* matches what you typed" from "there is nothing here".
|
|
294
|
+
* `empty-text` is what a list with no options says.
|
|
298
295
|
*/
|
|
299
|
-
noResultsText
|
|
296
|
+
noResultsText: string;
|
|
300
297
|
/**
|
|
301
298
|
* Lets a reader move options, once `@fusion.dev/helix/listbox/reorder` (or
|
|
302
299
|
* `@fusion.dev/helix-headless/listbox/reorder`) is imported: Alt with an
|
|
@@ -362,6 +359,17 @@ export declare class HelixHeadlessListbox extends HelixHeadlessListbox_base {
|
|
|
362
359
|
* its way down to the option, which is where React Aria extends a range.
|
|
363
360
|
*/
|
|
364
361
|
private shifted;
|
|
362
|
+
/**
|
|
363
|
+
* Where the highlight was before the pointer took it, so leaving the list
|
|
364
|
+
* gives it back. Unset while the keyboard has it.
|
|
365
|
+
*/
|
|
366
|
+
private beforePointer;
|
|
367
|
+
/**
|
|
368
|
+
* Whether the pointer moved the highlight on this update, which then is not
|
|
369
|
+
* scrolled to: the row is already under the pointer, and scrolling the list
|
|
370
|
+
* would slide another row under it.
|
|
371
|
+
*/
|
|
372
|
+
private pointed;
|
|
365
373
|
/** The letters typed at the list, which move the highlight to a match. */
|
|
366
374
|
private readonly typeahead;
|
|
367
375
|
/**
|
|
@@ -423,8 +431,8 @@ export declare class HelixHeadlessListbox extends HelixHeadlessListbox_base {
|
|
|
423
431
|
* was said here, so a query that left forty options and one that left one
|
|
424
432
|
* sounded the same. Said when the filter changes and the count with it, so
|
|
425
433
|
* a keystroke that leaves the same options says nothing new. An empty filter
|
|
426
|
-
* says nothing, being the list as it was given; no matches is
|
|
427
|
-
* which the region says in place of this. A load that ends says the count
|
|
434
|
+
* says nothing, being the list as it was given; no matches is
|
|
435
|
+
* `no-results-text`, which the region says in place of this. A load that ends says the count
|
|
428
436
|
* too, whatever the filter.
|
|
429
437
|
*/
|
|
430
438
|
private tell;
|
|
@@ -515,6 +523,29 @@ export declare class HelixHeadlessListbox extends HelixHeadlessListbox_base {
|
|
|
515
523
|
* panel, so a query of two words could not be typed.
|
|
516
524
|
*/
|
|
517
525
|
private readonly handleClick;
|
|
526
|
+
/**
|
|
527
|
+
* Moves the highlight to the option under a mouse or a pen, as Radix's Select
|
|
528
|
+
* and the menus of macOS do, so a list draws one highlighted row. The hover
|
|
529
|
+
* and the highlight were drawn in one wash, and an open Select lit the chosen
|
|
530
|
+
* row and the row under the pointer alike. Only a move counts, so a list that
|
|
531
|
+
* scrolls under a resting pointer keeps the highlight the keyboard gave it.
|
|
532
|
+
* Nothing is chosen on the way past.
|
|
533
|
+
*/
|
|
534
|
+
private readonly handlePointerMove;
|
|
535
|
+
/**
|
|
536
|
+
* Puts the highlight where the reader arrives, as Tab brings them in.
|
|
537
|
+
*
|
|
538
|
+
* **The chosen option, or the first one a reader can reach**, which is
|
|
539
|
+
* where APG's listbox puts focus as it arrives and the option
|
|
540
|
+
* `aria-activedescendant` already named. The list took the ring and every
|
|
541
|
+
* option stayed transparent until an arrow key, so a reader could not see
|
|
542
|
+
* where the arrows would start. Only from the keyboard, since a press
|
|
543
|
+
* places the highlight on the option pressed, and only where nothing holds
|
|
544
|
+
* it yet: a highlight the reader left stays where they left it.
|
|
545
|
+
*/
|
|
546
|
+
private readonly handleItemsFocus;
|
|
547
|
+
/** Gives the highlight back to where the keyboard left it. */
|
|
548
|
+
private readonly handlePointerLeave;
|
|
518
549
|
private readonly handleKeydown;
|
|
519
550
|
/**
|
|
520
551
|
* Puts the highlight on an option, and chooses it where moving is choosing.
|
|
@@ -728,7 +759,9 @@ export declare class HelixHeadlessListbox extends HelixHeadlessListbox_base {
|
|
|
728
759
|
*
|
|
729
760
|
* **The text is the slot's fallback**, which is this library's rule for a
|
|
730
761
|
* content property, so `empty-text` still shows where nothing is slotted and
|
|
731
|
-
* the live region still says it.
|
|
762
|
+
* the live region still says it. **The error line keeps its words** and puts
|
|
763
|
+
* the `error` slot after them, as Table does, so a button that tries again
|
|
764
|
+
* never stands alone with no reason for it.
|
|
732
765
|
*/
|
|
733
766
|
protected renderStatus(hasContent: boolean): TemplateResult | typeof nothing;
|
|
734
767
|
/**
|
|
@@ -16,7 +16,7 @@ let HelixHeadlessListbox = class HelixHeadlessListbox extends MixinVoice(MixinCo
|
|
|
16
16
|
});
|
|
17
17
|
this.autocomplete = 'off';
|
|
18
18
|
this.defaultFilter = '';
|
|
19
|
-
this.emptyText = 'No
|
|
19
|
+
this.emptyText = 'No options';
|
|
20
20
|
this.filterState = undefined;
|
|
21
21
|
this.errorText = '';
|
|
22
22
|
this.fieldHomeEnd = false;
|
|
@@ -30,6 +30,7 @@ let HelixHeadlessListbox = class HelixHeadlessListbox extends MixinVoice(MixinCo
|
|
|
30
30
|
});
|
|
31
31
|
this.manual = false;
|
|
32
32
|
this.multiple = false;
|
|
33
|
+
this.noResultsText = 'No matches';
|
|
33
34
|
this.reorderable = false;
|
|
34
35
|
this.resultsLabel = '{count, plural, one {# result} other {# results}}';
|
|
35
36
|
this.selectedLabel = '{name}, selected';
|
|
@@ -40,6 +41,7 @@ let HelixHeadlessListbox = class HelixHeadlessListbox extends MixinVoice(MixinCo
|
|
|
40
41
|
this.sources = undefined;
|
|
41
42
|
this.anchor = '';
|
|
42
43
|
this.shifted = false;
|
|
44
|
+
this.pointed = false;
|
|
43
45
|
this.typeahead = new Typeahead();
|
|
44
46
|
this.seen = new Set();
|
|
45
47
|
this.forwarded = false;
|
|
@@ -72,7 +74,49 @@ let HelixHeadlessListbox = class HelixHeadlessListbox extends MixinVoice(MixinCo
|
|
|
72
74
|
this.handleClick = (event) => {
|
|
73
75
|
this.shifted = event.shiftKey;
|
|
74
76
|
};
|
|
77
|
+
this.handlePointerMove = (event) => {
|
|
78
|
+
if (event.pointerType === 'touch') {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const options = this.elements;
|
|
82
|
+
const option = event
|
|
83
|
+
.composedPath()
|
|
84
|
+
.find((node) => options.includes(node));
|
|
85
|
+
if (!option || option.disabled || option.hidden || option.value === this.activeValue) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
this.beforePointer ??= { parked: this.parked, steered: this.steered, value: this.activeValue };
|
|
89
|
+
this.parked = false;
|
|
90
|
+
this.steered = true;
|
|
91
|
+
this.pointed = true;
|
|
92
|
+
this.activeValue = option.value;
|
|
93
|
+
};
|
|
94
|
+
this.handleItemsFocus = (event) => {
|
|
95
|
+
const items = event.currentTarget;
|
|
96
|
+
if (this.activeValue !== '' || this.filterable || !items.matches(':focus-visible')) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const shown = this.shown.filter((option) => !option.disabled);
|
|
100
|
+
const values = new Set(this.values);
|
|
101
|
+
const at = shown.find((option) => values.has(option.value)) ?? shown[0];
|
|
102
|
+
if (at) {
|
|
103
|
+
this.parked = false;
|
|
104
|
+
this.activeValue = at.value;
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
this.handlePointerLeave = () => {
|
|
108
|
+
const before = this.beforePointer;
|
|
109
|
+
if (!before) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
this.beforePointer = undefined;
|
|
113
|
+
this.parked = before.parked;
|
|
114
|
+
this.steered = before.steered;
|
|
115
|
+
this.pointed = true;
|
|
116
|
+
this.activeValue = before.value;
|
|
117
|
+
};
|
|
75
118
|
this.handleKeydown = (event) => {
|
|
119
|
+
this.beforePointer = undefined;
|
|
76
120
|
const shown = this.shown.filter((option) => !option.disabled);
|
|
77
121
|
if (shown.length === 0) {
|
|
78
122
|
return;
|
|
@@ -243,6 +287,7 @@ let HelixHeadlessListbox = class HelixHeadlessListbox extends MixinVoice(MixinCo
|
|
|
243
287
|
this.value = option?.value ?? '';
|
|
244
288
|
}
|
|
245
289
|
highlight(where) {
|
|
290
|
+
this.beforePointer = undefined;
|
|
246
291
|
const shown = this.shown.filter((option) => !option.disabled);
|
|
247
292
|
this.typeahead.reset();
|
|
248
293
|
this.parked = where === 'none';
|
|
@@ -289,6 +334,7 @@ let HelixHeadlessListbox = class HelixHeadlessListbox extends MixinVoice(MixinCo
|
|
|
289
334
|
}
|
|
290
335
|
}
|
|
291
336
|
typeaheadTo(key) {
|
|
337
|
+
this.beforePointer = undefined;
|
|
292
338
|
const shown = this.shown.filter((option) => !option.disabled);
|
|
293
339
|
const current = this.currentValue;
|
|
294
340
|
const from = shown.findIndex((option) => option.value === current);
|
|
@@ -368,6 +414,7 @@ let HelixHeadlessListbox = class HelixHeadlessListbox extends MixinVoice(MixinCo
|
|
|
368
414
|
}
|
|
369
415
|
}
|
|
370
416
|
arrive(value) {
|
|
417
|
+
this.beforePointer = undefined;
|
|
371
418
|
this.parked = false;
|
|
372
419
|
this.steered = true;
|
|
373
420
|
this.activeValue = value;
|
|
@@ -404,6 +451,7 @@ let HelixHeadlessListbox = class HelixHeadlessListbox extends MixinVoice(MixinCo
|
|
|
404
451
|
}
|
|
405
452
|
}
|
|
406
453
|
highlightValue(value) {
|
|
454
|
+
this.beforePointer = undefined;
|
|
407
455
|
if (!this.shown.some((option) => !option.disabled && option.value === value)) {
|
|
408
456
|
return;
|
|
409
457
|
}
|
|
@@ -481,6 +529,10 @@ let HelixHeadlessListbox = class HelixHeadlessListbox extends MixinVoice(MixinCo
|
|
|
481
529
|
}
|
|
482
530
|
}
|
|
483
531
|
followActive(changed) {
|
|
532
|
+
if (this.pointed) {
|
|
533
|
+
this.pointed = false;
|
|
534
|
+
return;
|
|
535
|
+
}
|
|
484
536
|
if (this.data.records &&
|
|
485
537
|
!this.data.follow(changed.has('activeValue') || changed.has('filter'))) {
|
|
486
538
|
return;
|
|
@@ -505,6 +557,8 @@ let HelixHeadlessListbox = class HelixHeadlessListbox extends MixinVoice(MixinCo
|
|
|
505
557
|
this.addEventListener('helix-before-select', this.handleSelection);
|
|
506
558
|
this.addEventListener('keydown', this.handleKeydown);
|
|
507
559
|
this.addEventListener('click', this.handleClick, true);
|
|
560
|
+
this.addEventListener('pointermove', this.handlePointerMove);
|
|
561
|
+
this.addEventListener('pointerleave', this.handlePointerLeave);
|
|
508
562
|
auditChildren(this, 'option', 'option', 'the list offers no choices');
|
|
509
563
|
if (this.hasUpdated) {
|
|
510
564
|
this.watchSources(this.filter.trim() !== '');
|
|
@@ -515,6 +569,8 @@ let HelixHeadlessListbox = class HelixHeadlessListbox extends MixinVoice(MixinCo
|
|
|
515
569
|
this.removeEventListener('helix-before-select', this.handleSelection);
|
|
516
570
|
this.removeEventListener('keydown', this.handleKeydown);
|
|
517
571
|
this.removeEventListener('click', this.handleClick, true);
|
|
572
|
+
this.removeEventListener('pointermove', this.handlePointerMove);
|
|
573
|
+
this.removeEventListener('pointerleave', this.handlePointerLeave);
|
|
518
574
|
this.sources?.disconnect();
|
|
519
575
|
markMatches(this, [], '');
|
|
520
576
|
}
|
|
@@ -536,6 +592,7 @@ let HelixHeadlessListbox = class HelixHeadlessListbox extends MixinVoice(MixinCo
|
|
|
536
592
|
}
|
|
537
593
|
if (changed.has('filter')) {
|
|
538
594
|
this.steered = false;
|
|
595
|
+
this.beforePointer = undefined;
|
|
539
596
|
}
|
|
540
597
|
if (this.childrenKnown) {
|
|
541
598
|
this.place();
|
|
@@ -623,7 +680,7 @@ let HelixHeadlessListbox = class HelixHeadlessListbox extends MixinVoice(MixinCo
|
|
|
623
680
|
}
|
|
624
681
|
renderStatus(hasContent) {
|
|
625
682
|
if (this.failed) {
|
|
626
|
-
return html `<p part="error"
|
|
683
|
+
return html `<p part="error">${this.loadError || this.errorText}<slot name="error"></slot></p>`;
|
|
627
684
|
}
|
|
628
685
|
if (!this.loading && hasContent) {
|
|
629
686
|
return nothing;
|
|
@@ -631,10 +688,8 @@ let HelixHeadlessListbox = class HelixHeadlessListbox extends MixinVoice(MixinCo
|
|
|
631
688
|
if (this.loading) {
|
|
632
689
|
return html `<p part="loading"><slot name="loading">${this.loadingText}</slot></p>`;
|
|
633
690
|
}
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
return this.noResults && given
|
|
637
|
-
? html `<p part="empty"><slot name="no-results">${this.noResultsText ?? this.emptyText}</slot></p>`
|
|
691
|
+
return this.noResults
|
|
692
|
+
? html `<p part="empty"><slot name="no-results">${this.noResultsText}</slot></p>`
|
|
638
693
|
: html `<p part="empty"><slot name="empty">${this.emptyText}</slot></p>`;
|
|
639
694
|
}
|
|
640
695
|
get noResults() {
|
|
@@ -667,7 +722,9 @@ let HelixHeadlessListbox = class HelixHeadlessListbox extends MixinVoice(MixinCo
|
|
|
667
722
|
<input
|
|
668
723
|
part="search-field"
|
|
669
724
|
type="text"
|
|
725
|
+
autocapitalize="off"
|
|
670
726
|
autocomplete="off"
|
|
727
|
+
autocorrect="off"
|
|
671
728
|
spellcheck="false"
|
|
672
729
|
.value=${this.filter}
|
|
673
730
|
placeholder=${this.filterLabel}
|
|
@@ -691,6 +748,7 @@ let HelixHeadlessListbox = class HelixHeadlessListbox extends MixinVoice(MixinCo
|
|
|
691
748
|
aria-multiselectable=${this.multiple ? 'true' : nothing}
|
|
692
749
|
aria-required=${this.required ? 'true' : nothing}
|
|
693
750
|
tabindex=${this.filterable ? nothing : this.isDisabled ? -1 : 0}
|
|
751
|
+
@focus=${this.handleItemsFocus}
|
|
694
752
|
@scroll=${this.handleScroll}
|
|
695
753
|
>
|
|
696
754
|
${this.data.render() ?? html `<slot @slotchange=${() => this.requestUpdate()}></slot>`}
|
|
@@ -756,6 +814,7 @@ __decorate([
|
|
|
756
814
|
property({ reflect: true, type: Boolean })
|
|
757
815
|
], HelixHeadlessListbox.prototype, "multiple", void 0);
|
|
758
816
|
__decorate([
|
|
817
|
+
words,
|
|
759
818
|
property({ attribute: 'no-results-text' })
|
|
760
819
|
], HelixHeadlessListbox.prototype, "noResultsText", void 0);
|
|
761
820
|
__decorate([
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { auditChildren, auditName, customElement, focusItemOf, formatWords, HelixActivateEvent, HelixBeforeChangeEvent, HelixBeforeCheckEvent, HelixCheckEvent, HelixElement, hostAria, internalsOf, KeyboardNavigationController, MixinViewport, numberConverter, requestChange, stopPress, words, } from '@fusion.dev/helix-core';
|
|
3
|
-
import { buildings, cloudRain, dotsNine, leaf, mountains, path, polygon, stack, target, } from '@fusion.dev/helix-icons';
|
|
2
|
+
import { auditChildren, auditName, customElement, drawIcon, focusItemOf, formatWords, HelixActivateEvent, HelixBeforeChangeEvent, HelixBeforeCheckEvent, HelixCheckEvent, HelixElement, hostAria, internalsOf, KeyboardNavigationController, MixinViewport, numberConverter, requestChange, stopPress, words, } from '@fusion.dev/helix-core';
|
|
3
|
+
import { arrowClockwise, arrowCounterClockwise, buildings, cloudRain, dotsNine, leaf, mountains, path, polygon, stack, target, } from '@fusion.dev/helix-icons';
|
|
4
4
|
import { html, nothing } from 'lit';
|
|
5
5
|
import { property, state } from 'lit/decorators.js';
|
|
6
6
|
import { html as staticHtml } from 'lit/static-html.js';
|
|
@@ -525,7 +525,7 @@ let HelixHeadlessMap = class HelixHeadlessMap extends MixinViewport(HelixElement
|
|
|
525
525
|
@click=${() => this.rotate(-ROTATE_STEP)}
|
|
526
526
|
@helix-press=${stopPress}
|
|
527
527
|
>
|
|
528
|
-
<slot name="rotate-left-icon"
|
|
528
|
+
<slot name="rotate-left-icon">${drawIcon(arrowCounterClockwise)}</slot>
|
|
529
529
|
</${button}><${tip} for="rotate-left" content=${this.rotateLeftLabel} exportparts="arrow: tooltip-arrow, arrow-bottom: tooltip-arrow-bottom, arrow-left: tooltip-arrow-left, arrow-right: tooltip-arrow-right, arrow-top: tooltip-arrow-top, surface: tooltip-surface, surface-bottom: tooltip-surface-bottom, surface-left: tooltip-surface-left, surface-right: tooltip-surface-right, surface-top: tooltip-surface-top"></${tip}>`
|
|
530
530
|
: nothing}
|
|
531
531
|
${pan
|
|
@@ -551,7 +551,7 @@ let HelixHeadlessMap = class HelixHeadlessMap extends MixinViewport(HelixElement
|
|
|
551
551
|
@click=${() => this.rotate(ROTATE_STEP)}
|
|
552
552
|
@helix-press=${stopPress}
|
|
553
553
|
>
|
|
554
|
-
<slot name="rotate-right-icon"
|
|
554
|
+
<slot name="rotate-right-icon">${drawIcon(arrowClockwise)}</slot>
|
|
555
555
|
</${button}><${tip} for="rotate-right" content=${this.rotateRightLabel} exportparts="arrow: tooltip-arrow, arrow-bottom: tooltip-arrow-bottom, arrow-left: tooltip-arrow-left, arrow-right: tooltip-arrow-right, arrow-top: tooltip-arrow-top, surface: tooltip-surface, surface-bottom: tooltip-surface-bottom, surface-left: tooltip-surface-left, surface-right: tooltip-surface-right, surface-top: tooltip-surface-top"></${tip}>`
|
|
556
556
|
: nothing}
|
|
557
557
|
${pan
|
|
@@ -640,7 +640,7 @@ let HelixHeadlessMap = class HelixHeadlessMap extends MixinViewport(HelixElement
|
|
|
640
640
|
@click=${this.toggleFullscreen}
|
|
641
641
|
@helix-press=${stopPress}
|
|
642
642
|
>
|
|
643
|
-
<slot name="fullscreen-icon"
|
|
643
|
+
<slot name="fullscreen-icon">${this.controlGlyph('fullscreen')}</slot>
|
|
644
644
|
</${button}><${tip} for="fullscreen" content=${this.fullscreenLabel} exportparts="arrow: tooltip-arrow, arrow-bottom: tooltip-arrow-bottom, arrow-left: tooltip-arrow-left, arrow-right: tooltip-arrow-right, arrow-top: tooltip-arrow-top, surface: tooltip-surface, surface-bottom: tooltip-surface-bottom, surface-left: tooltip-surface-left, surface-right: tooltip-surface-right, surface-top: tooltip-surface-top"></${tip}>`
|
|
645
645
|
: nothing}
|
|
646
646
|
${menu}
|
|
@@ -670,7 +670,7 @@ let HelixHeadlessMap = class HelixHeadlessMap extends MixinViewport(HelixElement
|
|
|
670
670
|
@click=${() => this.zoom(1)}
|
|
671
671
|
@helix-press=${stopPress}
|
|
672
672
|
>
|
|
673
|
-
<slot name="zoom-in-icon"
|
|
673
|
+
<slot name="zoom-in-icon">${this.controlGlyph('zoom-in')}</slot>
|
|
674
674
|
</${button}><${tip} for="zoom-in" content=${this.zoomInLabel} exportparts="arrow: tooltip-arrow, arrow-bottom: tooltip-arrow-bottom, arrow-left: tooltip-arrow-left, arrow-right: tooltip-arrow-right, arrow-top: tooltip-arrow-top, surface: tooltip-surface, surface-bottom: tooltip-surface-bottom, surface-left: tooltip-surface-left, surface-right: tooltip-surface-right, surface-top: tooltip-surface-top"></${tip}>
|
|
675
675
|
<${button}
|
|
676
676
|
part="zoom-out"
|
|
@@ -682,7 +682,7 @@ let HelixHeadlessMap = class HelixHeadlessMap extends MixinViewport(HelixElement
|
|
|
682
682
|
@click=${() => this.zoom(-1)}
|
|
683
683
|
@helix-press=${stopPress}
|
|
684
684
|
>
|
|
685
|
-
<slot name="zoom-out-icon"
|
|
685
|
+
<slot name="zoom-out-icon">${this.controlGlyph('zoom-out')}</slot>
|
|
686
686
|
</${button}><${tip} for="zoom-out" content=${this.zoomOutLabel} exportparts="arrow: tooltip-arrow, arrow-bottom: tooltip-arrow-bottom, arrow-left: tooltip-arrow-left, arrow-right: tooltip-arrow-right, arrow-top: tooltip-arrow-top, surface: tooltip-surface, surface-bottom: tooltip-surface-bottom, surface-left: tooltip-surface-left, surface-right: tooltip-surface-right, surface-top: tooltip-surface-top"></${tip}>`
|
|
687
687
|
: nothing}
|
|
688
688
|
${this.drawsCompass ? this.renderCompass(pan, rotate) : nothing}
|
package/dist/markdown/tree.d.ts
CHANGED
|
@@ -35,8 +35,13 @@ export interface MarkdownTags {
|
|
|
35
35
|
export declare const safeUrl: (url: string) => string | undefined;
|
|
36
36
|
/**
|
|
37
37
|
* Each column's share of a table's width, from its heading's length, between
|
|
38
|
-
*
|
|
38
|
+
* 10 and 24 characters. Set once, from the rows that arrive first, so the
|
|
39
39
|
* columns never move as the rest arrives.
|
|
40
|
+
*
|
|
41
|
+
* **Ten at the least, because a short heading says nothing about its cells.**
|
|
42
|
+
* From a floor of four, "Step" over "Backfill" and "Constraint" took 16% of a
|
|
43
|
+
* 336 pixel table at 390, a 50 pixel column, and both words broke inside
|
|
44
|
+
* themselves. At ten the column is 86 and both fit.
|
|
40
45
|
*/
|
|
41
46
|
export declare const columnShares: (head: string[]) => number[];
|
|
42
47
|
/** A block as the node it draws. `open` reads its end as still arriving. */
|
package/dist/markdown/tree.js
CHANGED
|
@@ -61,7 +61,7 @@ const inlineNodes = (nodes) => nodes.flatMap((node) => {
|
|
|
61
61
|
const inline = (text, open) => inlineNodes(parseInline(text, { open }));
|
|
62
62
|
const aligned = (align) => align === undefined ? {} : { 'data-align': align };
|
|
63
63
|
export const columnShares = (head) => {
|
|
64
|
-
const weights = head.map((cell) => Math.min(24, Math.max(
|
|
64
|
+
const weights = head.map((cell) => Math.min(24, Math.max(10, cell.length)));
|
|
65
65
|
const total = weights.reduce((sum, weight) => sum + weight, 0);
|
|
66
66
|
return weights.map((weight) => Math.round((weight / total) * 10000) / 100);
|
|
67
67
|
};
|
|
@@ -84,7 +84,9 @@ declare const HelixHeadlessMegamenu_base: (new (...args: any[]) => import("@fusi
|
|
|
84
84
|
* @csspart indicator - The `indicator` slot, rendered while the panel is open.
|
|
85
85
|
* @csspart surface - The floating panel that opens.
|
|
86
86
|
* @csspart trigger - The default trigger button, shown when the `trigger` slot is empty.
|
|
87
|
+
* @csspart trigger-indicator - The caret on the default trigger, turned while the panel is open.
|
|
87
88
|
*
|
|
89
|
+
* @cssproperty --megamenu-edge - How far the card keeps from the window's edge, which is as far as the row it sits in starts from it, between 8 and 32 pixels. Written on the card while it is placed, and read there.
|
|
88
90
|
* @cssproperty --megamenu-from-block-size - The height of the panel this one took over from, written on the surface while it is open.
|
|
89
91
|
* @cssproperty --megamenu-from-inline-size - The width of the panel this one took over from, written on the surface while it is open.
|
|
90
92
|
* @cssproperty --megamenu-surface-block-size - The panel's own height, written on the surface while it is open.
|
|
@@ -274,6 +276,23 @@ export declare class HelixHeadlessMegamenu extends HelixHeadlessMegamenu_base {
|
|
|
274
276
|
* the trigger is the honest answer again.
|
|
275
277
|
*/
|
|
276
278
|
private bar;
|
|
279
|
+
/**
|
|
280
|
+
* How far the card keeps from the window's edge: as far as the row it sits
|
|
281
|
+
* in starts from it, between 8 and 32 pixels.
|
|
282
|
+
*
|
|
283
|
+
* At 640 the card slid to 8 pixels from the edge while the navigation it
|
|
284
|
+
* hangs from started at 24, so neither edge of the card lined up with
|
|
285
|
+
* anything on the page. Written on the card as `--megamenu-edge` as well, so
|
|
286
|
+
* a stylesheet can hold the card's width inside the same margin on both
|
|
287
|
+
* sides, and a card as wide as the room then starts where the row does.
|
|
288
|
+
* On the card and not the host: a style written on the host is an attribute
|
|
289
|
+
* a server never sent, and hydration would find it.
|
|
290
|
+
*
|
|
291
|
+
* The row is the first flex or grid box above the trigger in the flat tree,
|
|
292
|
+
* which is what lays destinations out side by side, by fact and not by tag
|
|
293
|
+
* name, as `bar` finds the bar.
|
|
294
|
+
*/
|
|
295
|
+
private edge;
|
|
277
296
|
private timer;
|
|
278
297
|
private pointer;
|
|
279
298
|
private schedule;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
var HelixHeadlessMegamenu_1;
|
|
2
2
|
import { __decorate } from "tslib";
|
|
3
3
|
import { anchorElement, customElement, deepContains, focusableElements, focusItemOf, HelixElement, KeyboardNavigationController, MixinControllerOpen, numberConverter, PopoverController, tellDisclosure, timeConverter, untilReactHydrated, } from '@fusion.dev/helix-core';
|
|
4
|
+
import { caretDown } from '@fusion.dev/helix-icons';
|
|
4
5
|
import { html, nothing } from 'lit';
|
|
5
6
|
import { property, state } from 'lit/decorators.js';
|
|
7
|
+
import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
|
|
6
8
|
import { HandOver } from '../hand-over.js';
|
|
7
9
|
let HelixHeadlessMegamenu = class HelixHeadlessMegamenu extends MixinControllerOpen(HelixElement) {
|
|
8
10
|
constructor() {
|
|
@@ -22,6 +24,7 @@ let HelixHeadlessMegamenu = class HelixHeadlessMegamenu extends MixinControllerO
|
|
|
22
24
|
boundary: () => [...HelixHeadlessMegamenu_1.bar.connected],
|
|
23
25
|
onDismiss: () => this.close(),
|
|
24
26
|
open: () => this.open,
|
|
27
|
+
padding: () => this.edge(),
|
|
25
28
|
place: () => !this.banded,
|
|
26
29
|
placement: () => this.placement,
|
|
27
30
|
surface: () => this.partNamed('surface'),
|
|
@@ -198,6 +201,26 @@ let HelixHeadlessMegamenu = class HelixHeadlessMegamenu extends MixinControllerO
|
|
|
198
201
|
}
|
|
199
202
|
return this.trigger.getBoundingClientRect().bottom;
|
|
200
203
|
}
|
|
204
|
+
edge() {
|
|
205
|
+
let node = this;
|
|
206
|
+
let row = null;
|
|
207
|
+
for (let step = 0; node && step < 4 && !row; step += 1) {
|
|
208
|
+
const up = node.assignedSlot?.parentElement ??
|
|
209
|
+
node.parentElement ??
|
|
210
|
+
(node.parentNode?.host || null);
|
|
211
|
+
if (up && /flex|grid/.test(getComputedStyle(up).display)) {
|
|
212
|
+
row = up;
|
|
213
|
+
}
|
|
214
|
+
node = up;
|
|
215
|
+
}
|
|
216
|
+
const box = (row ?? this).getBoundingClientRect();
|
|
217
|
+
const start = getComputedStyle(this).direction === 'rtl'
|
|
218
|
+
? document.documentElement.clientWidth - box.right
|
|
219
|
+
: box.left;
|
|
220
|
+
const edge = Math.min(32, Math.max(8, Math.round(start)));
|
|
221
|
+
this.partNamed('surface')?.style.setProperty('--megamenu-edge', `${edge}px`);
|
|
222
|
+
return edge;
|
|
223
|
+
}
|
|
201
224
|
schedule(delay, then) {
|
|
202
225
|
this.stop();
|
|
203
226
|
this.timer = setTimeout(then, delay);
|
|
@@ -305,6 +328,7 @@ let HelixHeadlessMegamenu = class HelixHeadlessMegamenu extends MixinControllerO
|
|
|
305
328
|
aria-expanded=${this.open ? 'true' : 'false'}
|
|
306
329
|
>
|
|
307
330
|
${this.label}
|
|
331
|
+
<svg part="trigger-indicator" fill="currentColor" width="1em" height="1em" viewBox=${caretDown.viewBox} aria-hidden="true">${unsafeSVG(caretDown.content)}</svg>
|
|
308
332
|
</button>
|
|
309
333
|
</slot>`;
|
|
310
334
|
}
|
|
@@ -3,7 +3,9 @@ import { html, nothing } from 'lit';
|
|
|
3
3
|
export const drawFilter = (host, rows, busy, onInput) => html `<input
|
|
4
4
|
part="search-field"
|
|
5
5
|
type="text"
|
|
6
|
+
autocapitalize="off"
|
|
6
7
|
autocomplete="off"
|
|
8
|
+
autocorrect="off"
|
|
7
9
|
spellcheck="false"
|
|
8
10
|
.value=${host.filter}
|
|
9
11
|
placeholder=${host.filterLabel}
|
|
@@ -113,7 +115,7 @@ export class MenuFilterController {
|
|
|
113
115
|
}
|
|
114
116
|
status() {
|
|
115
117
|
const { host } = this;
|
|
116
|
-
const count = this.filtering ? this.keptRows.length : -1;
|
|
118
|
+
const count = this.filtering && host.children !== undefined ? this.keptRows.length : -1;
|
|
117
119
|
this.inside.announced =
|
|
118
120
|
count === 0
|
|
119
121
|
? host.noResultsText
|