@fusion.dev/helix-headless 0.233.0 → 0.234.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/canvas/root/canvas-root.js +1 -0
- package/dist/data-table/root/data-table-root.d.ts +41 -2
- package/dist/data-table/root/data-table-root.js +52 -4
- package/dist/date-input/root/date-input-root.d.ts +7 -5
- package/dist/date-input/root/date-input-root.js +1 -1
- package/dist/filter-input/root/filter-input-root.d.ts +6 -0
- package/dist/filter-input/root/filter-input-root.js +5 -0
- package/dist/number-input/root/number-input-root.d.ts +6 -5
- package/dist/number-input/root/number-input-root.js +1 -1
- package/dist/table/column/table-column.d.ts +19 -0
- package/dist/table/column/table-column.js +8 -1
- package/dist/table/fit.d.ts +26 -0
- package/dist/table/fit.js +23 -0
- package/dist/time-input/root/time-input-root.d.ts +4 -2
- package/dist/time-input/root/time-input-root.js +1 -1
- package/dist/tree/item/tree-item.d.ts +43 -0
- package/dist/tree/item/tree-item.js +85 -2
- package/dist/tree/root/tree-root.d.ts +4 -0
- package/dist/tree/root/tree-root.js +3 -0
- package/lint.json +1 -1
- package/package.json +5 -5
- package/types/jsx.d.ts +81 -19
- package/types/vue.d.ts +64 -13
|
@@ -21,6 +21,22 @@ let HelixHeadlessTreeItem = class HelixHeadlessTreeItem extends MixinControllerO
|
|
|
21
21
|
this.focusable = false;
|
|
22
22
|
this.value = '';
|
|
23
23
|
this.branch = false;
|
|
24
|
+
this.hovered = false;
|
|
25
|
+
this.focusedHere = false;
|
|
26
|
+
this.handleFocusIn = (event) => {
|
|
27
|
+
const first = event.composedPath()[0];
|
|
28
|
+
this.focusedHere =
|
|
29
|
+
this.fromActions(event) || first === this.partNamed('item') || first === this.partNamed('row');
|
|
30
|
+
};
|
|
31
|
+
this.handleFocusOut = (event) => {
|
|
32
|
+
this.focusedHere = this.intoActions(event.relatedTarget);
|
|
33
|
+
};
|
|
34
|
+
this.handleRowEnter = () => {
|
|
35
|
+
this.hovered = true;
|
|
36
|
+
};
|
|
37
|
+
this.handleRowLeave = () => {
|
|
38
|
+
this.hovered = false;
|
|
39
|
+
};
|
|
24
40
|
this.handleBeforeMatch = (event) => {
|
|
25
41
|
if (this.open || this.requestOpen(true)) {
|
|
26
42
|
return;
|
|
@@ -45,6 +61,12 @@ let HelixHeadlessTreeItem = class HelixHeadlessTreeItem extends MixinControllerO
|
|
|
45
61
|
this.toggleOpen();
|
|
46
62
|
};
|
|
47
63
|
this.handleRowClick = (event) => {
|
|
64
|
+
if (this.fromActions(event)) {
|
|
65
|
+
if (this.href !== '' && !this.landedOnControl(event)) {
|
|
66
|
+
event.preventDefault();
|
|
67
|
+
}
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
48
70
|
if (fromGrip(event)) {
|
|
49
71
|
event.preventDefault();
|
|
50
72
|
return;
|
|
@@ -69,6 +91,33 @@ let HelixHeadlessTreeItem = class HelixHeadlessTreeItem extends MixinControllerO
|
|
|
69
91
|
}
|
|
70
92
|
};
|
|
71
93
|
}
|
|
94
|
+
get actionsShown() {
|
|
95
|
+
return this.hovered || this.focusedHere;
|
|
96
|
+
}
|
|
97
|
+
fromActions(event) {
|
|
98
|
+
const actions = this.partNamed('actions');
|
|
99
|
+
return event
|
|
100
|
+
.composedPath()
|
|
101
|
+
.some((node) => node === actions ||
|
|
102
|
+
(node instanceof Element && node.parentElement === this && node.slot === 'actions'));
|
|
103
|
+
}
|
|
104
|
+
intoActions(node) {
|
|
105
|
+
let at = node instanceof Node ? node : null;
|
|
106
|
+
while (at && at.parentNode !== this) {
|
|
107
|
+
at = at.parentNode;
|
|
108
|
+
}
|
|
109
|
+
return at instanceof Element && at.slot === 'actions';
|
|
110
|
+
}
|
|
111
|
+
connectedCallback() {
|
|
112
|
+
super.connectedCallback();
|
|
113
|
+
this.addEventListener('focusin', this.handleFocusIn);
|
|
114
|
+
this.addEventListener('focusout', this.handleFocusOut);
|
|
115
|
+
}
|
|
116
|
+
disconnectedCallback() {
|
|
117
|
+
super.disconnectedCallback();
|
|
118
|
+
this.removeEventListener('focusin', this.handleFocusIn);
|
|
119
|
+
this.removeEventListener('focusout', this.handleFocusOut);
|
|
120
|
+
}
|
|
72
121
|
firstUpdated(changed) {
|
|
73
122
|
super.firstUpdated(changed);
|
|
74
123
|
this.finishHydration();
|
|
@@ -126,6 +175,20 @@ let HelixHeadlessTreeItem = class HelixHeadlessTreeItem extends MixinControllerO
|
|
|
126
175
|
}
|
|
127
176
|
}
|
|
128
177
|
}
|
|
178
|
+
landedOnControl(event) {
|
|
179
|
+
const row = this.partNamed('row');
|
|
180
|
+
for (const node of event.composedPath()) {
|
|
181
|
+
if (node === row) {
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
if (node instanceof HTMLElement &&
|
|
185
|
+
(node.matches('a[href], button, input, label, select, summary, textarea') ||
|
|
186
|
+
node.getAttribute('role') === 'button')) {
|
|
187
|
+
return true;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
129
192
|
renderToggle() {
|
|
130
193
|
return html `<slot
|
|
131
194
|
name="chevron"
|
|
@@ -154,8 +217,14 @@ let HelixHeadlessTreeItem = class HelixHeadlessTreeItem extends MixinControllerO
|
|
|
154
217
|
renderRow() {
|
|
155
218
|
return html `${this.isBranch ? this.renderToggle() : nothing}${this.renderCheckbox()}
|
|
156
219
|
<slot name="start"></slot>
|
|
157
|
-
<span part="label"><slot></slot></span>
|
|
158
|
-
<slot name="end"></slot
|
|
220
|
+
<span part="label" id="label"><slot></slot></span>
|
|
221
|
+
<slot name="end"></slot>
|
|
222
|
+
<slot
|
|
223
|
+
name="actions"
|
|
224
|
+
part="actions"
|
|
225
|
+
?inert=${!this.actionsShown}
|
|
226
|
+
@slotchange=${() => this.requestUpdate()}
|
|
227
|
+
></slot>${this.grip && !this.disabled
|
|
159
228
|
? html `<span part="grip" aria-hidden="true"
|
|
160
229
|
><svg part="grip-mark" fill="currentColor" viewBox=${dotsSixVertical.viewBox}>
|
|
161
230
|
${unsafeSVG(dotsSixVertical.content)}
|
|
@@ -172,6 +241,7 @@ let HelixHeadlessTreeItem = class HelixHeadlessTreeItem extends MixinControllerO
|
|
|
172
241
|
this.toggleState('dragging', this.move === 'dragging');
|
|
173
242
|
this.toggleState('drop-after', this.move === 'drop-after');
|
|
174
243
|
this.toggleState('drop-before', this.move === 'drop-before');
|
|
244
|
+
this.toggleState('actions-shown', this.actionsShown);
|
|
175
245
|
if (this.childrenKnown) {
|
|
176
246
|
this.branch = this.knownChildren.some((child) => child.slot === 'children');
|
|
177
247
|
}
|
|
@@ -198,6 +268,7 @@ let HelixHeadlessTreeItem = class HelixHeadlessTreeItem extends MixinControllerO
|
|
|
198
268
|
const busy = this.open && this.lazy ? 'true' : nothing;
|
|
199
269
|
const off = this.disabled ? 'true' : nothing;
|
|
200
270
|
const tabIndex = this.focusable || !this.childrenKnown ? '0' : '-1';
|
|
271
|
+
const named = this.knownChildren.some((child) => child.slot === 'actions') ? 'label' : nothing;
|
|
201
272
|
return html `<div
|
|
202
273
|
part="item"
|
|
203
274
|
role=${linked ? 'none' : 'treeitem'}
|
|
@@ -209,6 +280,7 @@ let HelixHeadlessTreeItem = class HelixHeadlessTreeItem extends MixinControllerO
|
|
|
209
280
|
aria-level=${linked ? nothing : depth}
|
|
210
281
|
aria-posinset=${linked ? nothing : position}
|
|
211
282
|
aria-setsize=${linked ? nothing : size}
|
|
283
|
+
aria-labelledby=${linked ? nothing : named}
|
|
212
284
|
tabindex=${linked ? nothing : tabIndex}
|
|
213
285
|
>
|
|
214
286
|
${linked
|
|
@@ -226,14 +298,19 @@ let HelixHeadlessTreeItem = class HelixHeadlessTreeItem extends MixinControllerO
|
|
|
226
298
|
aria-level=${depth}
|
|
227
299
|
aria-posinset=${position}
|
|
228
300
|
aria-setsize=${size}
|
|
301
|
+
aria-labelledby=${named}
|
|
229
302
|
tabindex=${tabIndex}
|
|
230
303
|
style="--tree-level: ${level}"
|
|
231
304
|
@click=${this.handleRowClick}
|
|
305
|
+
@pointerenter=${this.handleRowEnter}
|
|
306
|
+
@pointerleave=${this.handleRowLeave}
|
|
232
307
|
>${this.renderRow()}</a>`
|
|
233
308
|
: html `<div
|
|
234
309
|
part="row"
|
|
235
310
|
style="--tree-level: ${level}"
|
|
236
311
|
@click=${this.handleRowClick}
|
|
312
|
+
@pointerenter=${this.handleRowEnter}
|
|
313
|
+
@pointerleave=${this.handleRowLeave}
|
|
237
314
|
>${this.renderRow()}</div>`}
|
|
238
315
|
<!-- Inside the treeitem, not beside it. As a sibling, the row's
|
|
239
316
|
\`aria-expanded\` describes a group the row does not own and the
|
|
@@ -302,6 +379,12 @@ __decorate([
|
|
|
302
379
|
__decorate([
|
|
303
380
|
state()
|
|
304
381
|
], HelixHeadlessTreeItem.prototype, "branch", void 0);
|
|
382
|
+
__decorate([
|
|
383
|
+
state()
|
|
384
|
+
], HelixHeadlessTreeItem.prototype, "hovered", void 0);
|
|
385
|
+
__decorate([
|
|
386
|
+
state()
|
|
387
|
+
], HelixHeadlessTreeItem.prototype, "focusedHere", void 0);
|
|
305
388
|
HelixHeadlessTreeItem = __decorate([
|
|
306
389
|
customElement('helix-headless-tree-item')
|
|
307
390
|
], HelixHeadlessTreeItem);
|
|
@@ -39,6 +39,10 @@ declare const HelixHeadlessTree_base: (new (...args: any[]) => import("@fusion.d
|
|
|
39
39
|
* and Control+Shift+Home or End checks every item from the focused one to the
|
|
40
40
|
* first or the last, then moves there, as the tree pattern's range keys do.
|
|
41
41
|
*
|
|
42
|
+
* Tab moves from the focused item into its `actions`, and out of the tree
|
|
43
|
+
* after them. A key pressed there is the control's, so the arrows, Enter,
|
|
44
|
+
* Space and typed letters move and choose nothing in the tree.
|
|
45
|
+
*
|
|
42
46
|
* A tree with no name of its own is announced as "Tree", which says nothing
|
|
43
47
|
* about what it holds, so a development build warns once with the kind
|
|
44
48
|
* `missing-name` where neither `label` nor an `aria-label` names it.
|
|
@@ -74,6 +74,9 @@ let HelixHeadlessTree = class HelixHeadlessTree extends MixinCollection(MixinCon
|
|
|
74
74
|
if (!current || !this.items.includes(current)) {
|
|
75
75
|
return;
|
|
76
76
|
}
|
|
77
|
+
if (current.fromActions(event)) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
77
80
|
if (this.multiple && this.handleMultiple(current, event)) {
|
|
78
81
|
event.preventDefault();
|
|
79
82
|
return;
|