@fusion.dev/helix-headless 0.148.0 → 0.149.1
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/custom-elements.json +6966 -1798
- package/dist/announcement/root/announcement-root.d.ts +5 -0
- package/dist/announcement/root/announcement-root.js +5 -2
- package/dist/area-chart/root/area-chart-root.d.ts +11 -0
- package/dist/area-chart/root/area-chart-root.js +20 -7
- package/dist/avatar/group/avatar-group.d.ts +10 -2
- package/dist/avatar/group/avatar-group.js +10 -5
- package/dist/badge/count.d.ts +6 -1
- package/dist/badge/count.js +3 -3
- package/dist/badge/root/badge-root.d.ts +6 -2
- package/dist/badge/root/badge-root.js +3 -3
- package/dist/bar-chart/root/bar-chart-root.d.ts +13 -1
- package/dist/bar-chart/root/bar-chart-root.js +17 -4
- package/dist/breadcrumbs/root/breadcrumbs-root.d.ts +8 -1
- package/dist/breadcrumbs/root/breadcrumbs-root.js +5 -2
- package/dist/button/root/button-root.d.ts +10 -1
- package/dist/button/root/button-root.js +3 -2
- package/dist/button-group/root/button-group-root.d.ts +3 -0
- package/dist/button-group/root/button-group-root.js +2 -2
- package/dist/callout/root/callout-root.d.ts +16 -2
- package/dist/callout/root/callout-root.js +16 -4
- package/dist/canvas/describe.d.ts +10 -0
- package/dist/canvas/describe.js +9 -0
- package/dist/canvas/neighbor.d.ts +17 -0
- package/dist/canvas/neighbor.js +1 -0
- package/dist/canvas/node/canvas-node.js +3 -2
- package/dist/canvas/root/canvas-root.d.ts +65 -8
- package/dist/canvas/root/canvas-root.js +115 -49
- package/dist/carousel/root/carousel-root.d.ts +5 -0
- package/dist/carousel/root/carousel-root.js +16 -5
- package/dist/chat/composer/chat-composer.d.ts +5 -0
- package/dist/chat/composer/chat-composer.js +4 -1
- package/dist/chat/message/chat-message.d.ts +9 -5
- package/dist/chat/message/chat-message.js +8 -4
- package/dist/chat/naming.js +2 -2
- package/dist/chat/root/chat-root.d.ts +27 -1
- package/dist/chat/root/chat-root.js +37 -9
- package/dist/checkbox/root/checkbox-root.d.ts +11 -0
- package/dist/checkbox/root/checkbox-root.js +8 -2
- package/dist/checkbox-group/root/checkbox-group-root.d.ts +11 -0
- package/dist/checkbox-group/root/checkbox-group-root.js +11 -3
- package/dist/code-block/root/code-block-root.d.ts +12 -2
- package/dist/code-block/root/code-block-root.js +12 -2
- package/dist/color-input/root/color-input-root.d.ts +13 -0
- package/dist/color-input/root/color-input-root.js +18 -5
- package/dist/color-picker/root/color-picker-root.d.ts +19 -3
- package/dist/color-picker/root/color-picker-root.js +47 -13
- package/dist/combobox/root/combobox-root.d.ts +36 -7
- package/dist/combobox/root/combobox-root.js +37 -12
- package/dist/command/root/command-root.d.ts +15 -6
- package/dist/command/root/command-root.js +9 -4
- package/dist/copy-button/root/copy-button-root.d.ts +5 -0
- package/dist/copy-button/root/copy-button-root.js +7 -2
- package/dist/data-table/root/data-table-root.d.ts +171 -29
- package/dist/data-table/root/data-table-root.js +268 -118
- package/dist/date-input/root/date-input-root.d.ts +32 -9
- package/dist/date-input/root/date-input-root.js +66 -44
- package/dist/date-picker/root/date-picker-root.d.ts +38 -15
- package/dist/date-picker/root/date-picker-root.js +52 -33
- package/dist/dialog/root/dialog-root.d.ts +12 -1
- package/dist/dialog/root/dialog-root.js +11 -4
- package/dist/donut-chart/root/donut-chart-root.d.ts +5 -0
- package/dist/donut-chart/root/donut-chart-root.js +8 -5
- package/dist/drawer/root/drawer-root.d.ts +12 -1
- package/dist/drawer/root/drawer-root.js +9 -2
- package/dist/drilldown/root/drilldown-root.d.ts +5 -0
- package/dist/drilldown/root/drilldown-root.js +4 -1
- package/dist/element-events.generated.js +25 -3
- package/dist/file-input/root/file-input-root.d.ts +18 -3
- package/dist/file-input/root/file-input-root.js +34 -17
- package/dist/filter-input/chip/filter-chip.d.ts +13 -0
- package/dist/filter-input/chip/filter-chip.js +6 -1
- package/dist/filter-input/menu/filter-menu.d.ts +5 -0
- package/dist/filter-input/menu/filter-menu.js +3 -1
- package/dist/filter-input/root/filter-input-root.d.ts +20 -3
- package/dist/filter-input/root/filter-input-root.js +8 -4
- package/dist/format-date/root/format-date-root.d.ts +20 -2
- package/dist/format-date/root/format-date-root.js +5 -2
- package/dist/graph/root/graph-model.d.ts +11 -0
- package/dist/graph/root/graph-model.js +4 -0
- package/dist/graph/root/graph-root.d.ts +78 -9
- package/dist/graph/root/graph-root.js +124 -27
- package/dist/heatmap/root/heatmap-root.d.ts +25 -4
- package/dist/heatmap/root/heatmap-root.js +27 -7
- package/dist/icon-button/root/icon-button-root.d.ts +5 -0
- package/dist/icon-button/root/icon-button-root.js +1 -0
- package/dist/input/root/input-root.d.ts +5 -0
- package/dist/input/root/input-root.js +4 -1
- package/dist/lightbox/root/lightbox-root.d.ts +14 -4
- package/dist/lightbox/root/lightbox-root.js +25 -7
- package/dist/line-chart/root/line-chart-root.d.ts +5 -0
- package/dist/line-chart/root/line-chart-root.js +4 -2
- package/dist/list/item/list-item.d.ts +32 -0
- package/dist/list/item/list-item.js +34 -7
- package/dist/list/root/list-root.d.ts +87 -0
- package/dist/list/root/list-root.js +112 -2
- package/dist/listbox/reorder/index.d.ts +1 -0
- package/dist/listbox/reorder/index.js +4 -0
- package/dist/listbox/reorder/listbox-reorder.d.ts +83 -0
- package/dist/listbox/reorder/listbox-reorder.js +151 -0
- package/dist/listbox/root/listbox-root.d.ts +68 -11
- package/dist/listbox/root/listbox-root.js +41 -9
- package/dist/loader/root/loader-root.d.ts +5 -0
- package/dist/loader/root/loader-root.js +3 -1
- package/dist/map/area/map-area.d.ts +5 -0
- package/dist/map/area/map-area.js +3 -1
- package/dist/map/buildings/map-buildings.d.ts +5 -0
- package/dist/map/buildings/map-buildings.js +3 -1
- package/dist/map/contours/map-contours.d.ts +5 -0
- package/dist/map/contours/map-contours.js +3 -1
- package/dist/map/landcover/map-landcover.d.ts +5 -0
- package/dist/map/landcover/map-landcover.js +3 -1
- package/dist/map/marker/map-marker.d.ts +16 -1
- package/dist/map/marker/map-marker.js +13 -5
- package/dist/map/points/map-points.d.ts +5 -0
- package/dist/map/points/map-points.js +6 -4
- package/dist/map/position/map-position.d.ts +5 -0
- package/dist/map/position/map-position.js +3 -1
- package/dist/map/raster/map-raster.d.ts +5 -0
- package/dist/map/raster/map-raster.js +3 -1
- package/dist/map/root/map-root.d.ts +33 -14
- package/dist/map/root/map-root.js +59 -22
- package/dist/map/route/map-route.d.ts +5 -0
- package/dist/map/route/map-route.js +3 -1
- package/dist/map/terrain/map-terrain.d.ts +5 -0
- package/dist/map/terrain/map-terrain.js +3 -1
- package/dist/menu/root/menu-root.d.ts +5 -0
- package/dist/menu/root/menu-root.js +3 -1
- package/dist/meter/root/meter-root.d.ts +16 -3
- package/dist/meter/root/meter-root.js +12 -5
- package/dist/navigation/root/navigation-root.d.ts +5 -0
- package/dist/navigation/root/navigation-root.js +3 -1
- package/dist/notifications/notification/notification.d.ts +5 -0
- package/dist/notifications/notification/notification.js +3 -1
- package/dist/notifications/root/notifications-root.d.ts +8 -0
- package/dist/notifications/root/notifications-root.js +10 -2
- package/dist/number-input/root/number-input-root.d.ts +21 -8
- package/dist/number-input/root/number-input-root.js +26 -11
- package/dist/object-inspector/root/object-inspector-root.d.ts +51 -12
- package/dist/object-inspector/root/object-inspector-root.js +21 -20
- package/dist/outline/root/outline-root.d.ts +5 -0
- package/dist/outline/root/outline-root.js +3 -1
- package/dist/pagination/root/pagination-root.d.ts +7 -1
- package/dist/pagination/root/pagination-root.js +16 -7
- package/dist/pagination/size/pagination-size.d.ts +7 -3
- package/dist/pagination/size/pagination-size.js +4 -2
- package/dist/pagination/summary/pagination-summary.d.ts +8 -6
- package/dist/pagination/summary/pagination-summary.js +4 -9
- package/dist/pin-input/code.d.ts +6 -6
- package/dist/pin-input/code.js +1 -5
- package/dist/pin-input/root/pin-input-root.d.ts +9 -3
- package/dist/pin-input/root/pin-input-root.js +6 -2
- package/dist/popover/root/popover-root.d.ts +12 -2
- package/dist/popover/root/popover-root.js +10 -4
- package/dist/progress/root/progress-root.d.ts +7 -2
- package/dist/progress/root/progress-root.js +5 -2
- package/dist/qr-code/name.d.ts +3 -2
- package/dist/qr-code/name.js +2 -2
- package/dist/qr-code/root/qr-code-root.d.ts +12 -2
- package/dist/qr-code/root/qr-code-root.js +9 -2
- package/dist/radio/group/radio-group.d.ts +11 -0
- package/dist/radio/group/radio-group.js +8 -2
- package/dist/rating/root/rating-root.d.ts +12 -1
- package/dist/rating/root/rating-root.js +10 -3
- package/dist/scatter-chart/root/scatter-chart-root.d.ts +20 -2
- package/dist/scatter-chart/root/scatter-chart-root.js +20 -5
- package/dist/select/root/select-root.d.ts +11 -0
- package/dist/select/root/select-root.js +13 -3
- package/dist/skip-link/root/skip-link-root.d.ts +5 -0
- package/dist/skip-link/root/skip-link-root.js +3 -1
- package/dist/slider/root/slider-root.d.ts +7 -2
- package/dist/slider/root/slider-root.js +11 -5
- package/dist/sparkline/readings.d.ts +15 -5
- package/dist/sparkline/readings.js +3 -3
- package/dist/sparkline/root/sparkline-root.d.ts +9 -4
- package/dist/sparkline/root/sparkline-root.js +9 -3
- package/dist/speed-dial/root/speed-dial-root.d.ts +5 -0
- package/dist/speed-dial/root/speed-dial-root.js +4 -1
- package/dist/splitter/root/splitter-root.d.ts +6 -1
- package/dist/splitter/root/splitter-root.js +9 -4
- package/dist/steps/root/steps-root.d.ts +9 -2
- package/dist/steps/root/steps-root.js +6 -3
- package/dist/steps/step/step.d.ts +12 -0
- package/dist/steps/step/step.js +11 -2
- package/dist/switch/root/switch-root.d.ts +11 -0
- package/dist/switch/root/switch-root.js +8 -2
- package/dist/table/column/table-column.d.ts +11 -4
- package/dist/table/column/table-column.js +15 -10
- package/dist/table/grid-controller.d.ts +8 -3
- package/dist/table/grid-controller.js +17 -11
- package/dist/table/root/table-root.d.ts +107 -5
- package/dist/table/root/table-root.js +122 -20
- package/dist/table/row/table-row.d.ts +42 -0
- package/dist/table/row/table-row.js +40 -1
- package/dist/tabs/root/tabs-root.d.ts +5 -0
- package/dist/tabs/root/tabs-root.js +3 -1
- package/dist/tag/group/tag-group.d.ts +5 -0
- package/dist/tag/group/tag-group.js +3 -1
- package/dist/tag/root/tag-root.d.ts +14 -1
- package/dist/tag/root/tag-root.js +11 -8
- package/dist/textarea/root/textarea-root.d.ts +5 -0
- package/dist/textarea/root/textarea-root.js +3 -1
- package/dist/time-input/root/time-input-root.d.ts +14 -7
- package/dist/time-input/root/time-input-root.js +43 -32
- package/dist/time-picker/root/time-picker-root.d.ts +15 -7
- package/dist/time-picker/root/time-picker-root.js +25 -12
- package/dist/toast/item/toast-item.d.ts +7 -0
- package/dist/toast/item/toast-item.js +1 -0
- package/dist/toast/root/toast-root.d.ts +9 -1
- package/dist/toast/root/toast-root.js +5 -4
- package/dist/toolbar/root/toolbar-root.d.ts +5 -0
- package/dist/toolbar/root/toolbar-root.js +5 -2
- package/dist/tooltip/root/tooltip-root.d.ts +27 -17
- package/dist/tour/root/tour-root.d.ts +8 -2
- package/dist/tour/root/tour-root.js +4 -2
- package/dist/tour/stop/tour-stop.d.ts +5 -0
- package/dist/tour/stop/tour-stop.js +6 -1
- package/dist/tree/grip.d.ts +5 -0
- package/dist/tree/grip.js +1 -0
- package/dist/tree/item/tree-item.d.ts +24 -0
- package/dist/tree/item/tree-item.js +27 -5
- package/dist/tree/root/tree-root.d.ts +66 -1
- package/dist/tree/root/tree-root.js +77 -5
- package/dist/trend/root/trend-root.d.ts +20 -4
- package/dist/trend/root/trend-root.js +20 -5
- package/dist/video/root/video-root.d.ts +12 -3
- package/dist/video/root/video-root.js +41 -14
- package/dist/video-playlist/menu/video-playlist-menu.d.ts +5 -0
- package/dist/video-playlist/menu/video-playlist-menu.js +3 -1
- package/dist/video-playlist/root/video-playlist-root.d.ts +5 -0
- package/dist/video-playlist/root/video-playlist-root.js +3 -1
- package/dist/virtual-list/root/virtual-list-root.d.ts +19 -3
- package/dist/virtual-list/root/virtual-list-root.js +5 -2
- package/lint.json +1 -1
- package/package.json +9 -8
- package/types/jsx.d.ts +4014 -1862
- package/types/vue.d.ts +1266 -624
- package/types/words.d.ts +3280 -0
- package/dist/toast/hotkey.d.ts +0 -22
- package/dist/toast/hotkey.js +0 -23
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { CommandController, customElement, DelayController, deepActiveElement, deepContains, drawDismiss, drawDismissGlyph, FullscreenController,
|
|
7
|
+
import { CommandController, customElement, DelayController, deepActiveElement, deepContains, drawDismiss, drawDismissGlyph, FullscreenController, formatWords, HelixElement, hostAria, IdleController, inlineStep, isRtl, keyClaimed, lockScroll, MixinControllerActive, MixinControllerOpen, resolveActiveItem, SwipeController, swipeStep, unlockScroll, whenHydrated, words, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { caretLeft, caretRight, minus, plus } from '@fusion.dev/helix-icons';
|
|
9
9
|
import { html, nothing } from 'lit';
|
|
10
10
|
import { property, state } from 'lit/decorators.js';
|
|
@@ -18,6 +18,7 @@ let HelixHeadlessLightbox = class HelixHeadlessLightbox extends MixinControllerA
|
|
|
18
18
|
this.controls = false;
|
|
19
19
|
this.counter = false;
|
|
20
20
|
this.dismissLabel = 'Close';
|
|
21
|
+
this.fallbackLabel = 'Lightbox';
|
|
21
22
|
this.idleDelay = 0;
|
|
22
23
|
this.label = '';
|
|
23
24
|
this.loop = false;
|
|
@@ -29,7 +30,7 @@ let HelixHeadlessLightbox = class HelixHeadlessLightbox extends MixinControllerA
|
|
|
29
30
|
this.statusLabel = '{index} of {count}';
|
|
30
31
|
this.zoomInLabel = 'Zoom in';
|
|
31
32
|
this.zoomOutLabel = 'Zoom out';
|
|
32
|
-
this.zoomStatusLabel = 'Zoomed to {percent}
|
|
33
|
+
this.zoomStatusLabel = 'Zoomed to {scale, number, percent}';
|
|
33
34
|
this.resting = false;
|
|
34
35
|
this.filled = false;
|
|
35
36
|
this.announcement = '';
|
|
@@ -125,6 +126,7 @@ let HelixHeadlessLightbox = class HelixHeadlessLightbox extends MixinControllerA
|
|
|
125
126
|
this.requestOpen(false);
|
|
126
127
|
};
|
|
127
128
|
}
|
|
129
|
+
static { this.words = 'helix-lightbox'; }
|
|
128
130
|
drawZoom(scale, pan) {
|
|
129
131
|
const viewport = this.partNamed('viewport');
|
|
130
132
|
const zoomed = scale > 1;
|
|
@@ -144,7 +146,10 @@ let HelixHeadlessLightbox = class HelixHeadlessLightbox extends MixinControllerA
|
|
|
144
146
|
return;
|
|
145
147
|
}
|
|
146
148
|
this.zoomSaid.start(400, () => {
|
|
147
|
-
this.announcement =
|
|
149
|
+
this.announcement = formatWords(this, 'zoomStatusLabel', {
|
|
150
|
+
percent: percentOf(this.zoomScale),
|
|
151
|
+
scale: this.zoomScale,
|
|
152
|
+
});
|
|
148
153
|
});
|
|
149
154
|
}
|
|
150
155
|
zoomTo(scale) {
|
|
@@ -272,7 +277,7 @@ let HelixHeadlessLightbox = class HelixHeadlessLightbox extends MixinControllerA
|
|
|
272
277
|
items.forEach((item, at) => {
|
|
273
278
|
item.current = item === current;
|
|
274
279
|
whenHydrated(item, () => {
|
|
275
|
-
item.position =
|
|
280
|
+
item.position = formatWords(this, 'slideLabel', {
|
|
276
281
|
count: items.length,
|
|
277
282
|
index: at + 1,
|
|
278
283
|
label: item.label,
|
|
@@ -301,7 +306,7 @@ let HelixHeadlessLightbox = class HelixHeadlessLightbox extends MixinControllerA
|
|
|
301
306
|
this.announcement =
|
|
302
307
|
at === -1 || !current
|
|
303
308
|
? ''
|
|
304
|
-
:
|
|
309
|
+
: formatWords(this, 'statusLabel', {
|
|
305
310
|
count: items.length,
|
|
306
311
|
index: at + 1,
|
|
307
312
|
label: current.label,
|
|
@@ -311,7 +316,7 @@ let HelixHeadlessLightbox = class HelixHeadlessLightbox extends MixinControllerA
|
|
|
311
316
|
const items = this.items;
|
|
312
317
|
const current = resolveActiveItem(this.active, items);
|
|
313
318
|
return current
|
|
314
|
-
?
|
|
319
|
+
? formatWords(this, 'statusLabel', {
|
|
315
320
|
count: items.length,
|
|
316
321
|
index: items.indexOf(current) + 1,
|
|
317
322
|
label: current.label,
|
|
@@ -321,7 +326,7 @@ let HelixHeadlessLightbox = class HelixHeadlessLightbox extends MixinControllerA
|
|
|
321
326
|
render() {
|
|
322
327
|
return html `<dialog
|
|
323
328
|
part="dialog"
|
|
324
|
-
aria-label=${this.label ||
|
|
329
|
+
aria-label=${this.label || this.fallbackLabel}
|
|
325
330
|
autofocus
|
|
326
331
|
tabindex="-1"
|
|
327
332
|
@cancel=${this.handleCancel}
|
|
@@ -412,8 +417,13 @@ __decorate([
|
|
|
412
417
|
property({ reflect: true, type: Boolean })
|
|
413
418
|
], HelixHeadlessLightbox.prototype, "counter", void 0);
|
|
414
419
|
__decorate([
|
|
420
|
+
words,
|
|
415
421
|
property({ attribute: 'dismiss-label' })
|
|
416
422
|
], HelixHeadlessLightbox.prototype, "dismissLabel", void 0);
|
|
423
|
+
__decorate([
|
|
424
|
+
words,
|
|
425
|
+
property({ attribute: 'fallback-label' })
|
|
426
|
+
], HelixHeadlessLightbox.prototype, "fallbackLabel", void 0);
|
|
417
427
|
__decorate([
|
|
418
428
|
property({ attribute: 'idle-delay', type: Number })
|
|
419
429
|
], HelixHeadlessLightbox.prototype, "idleDelay", void 0);
|
|
@@ -427,27 +437,35 @@ __decorate([
|
|
|
427
437
|
property({ attribute: 'max-zoom', type: Number })
|
|
428
438
|
], HelixHeadlessLightbox.prototype, "maxZoom", void 0);
|
|
429
439
|
__decorate([
|
|
440
|
+
words,
|
|
430
441
|
property({ attribute: 'next-label' })
|
|
431
442
|
], HelixHeadlessLightbox.prototype, "nextLabel", void 0);
|
|
432
443
|
__decorate([
|
|
444
|
+
words,
|
|
433
445
|
property({ attribute: 'previous-label' })
|
|
434
446
|
], HelixHeadlessLightbox.prototype, "previousLabel", void 0);
|
|
435
447
|
__decorate([
|
|
448
|
+
words,
|
|
436
449
|
property({ attribute: 'slide-label' })
|
|
437
450
|
], HelixHeadlessLightbox.prototype, "slideLabel", void 0);
|
|
438
451
|
__decorate([
|
|
452
|
+
words,
|
|
439
453
|
property({ attribute: 'slide-role-label' })
|
|
440
454
|
], HelixHeadlessLightbox.prototype, "slideRoleLabel", void 0);
|
|
441
455
|
__decorate([
|
|
456
|
+
words,
|
|
442
457
|
property({ attribute: 'status-label' })
|
|
443
458
|
], HelixHeadlessLightbox.prototype, "statusLabel", void 0);
|
|
444
459
|
__decorate([
|
|
460
|
+
words,
|
|
445
461
|
property({ attribute: 'zoom-in-label' })
|
|
446
462
|
], HelixHeadlessLightbox.prototype, "zoomInLabel", void 0);
|
|
447
463
|
__decorate([
|
|
464
|
+
words,
|
|
448
465
|
property({ attribute: 'zoom-out-label' })
|
|
449
466
|
], HelixHeadlessLightbox.prototype, "zoomOutLabel", void 0);
|
|
450
467
|
__decorate([
|
|
468
|
+
words,
|
|
451
469
|
property({ attribute: 'zoom-status-label' })
|
|
452
470
|
], HelixHeadlessLightbox.prototype, "zoomStatusLabel", void 0);
|
|
453
471
|
__decorate([
|
|
@@ -81,6 +81,11 @@ declare const HelixHeadlessLineChart_base: typeof HelixElement & (new (...args:
|
|
|
81
81
|
* @cssproperty --chart-terminus-y - Where a series' last reading sits vertically, as a percentage. Written by the component.
|
|
82
82
|
*/
|
|
83
83
|
export declare class HelixHeadlessLineChart extends HelixHeadlessLineChart_base {
|
|
84
|
+
/**
|
|
85
|
+
* The key this family's words are registered under, its styled tag:
|
|
86
|
+
* `registerWords('de', { 'helix-line-chart': { positionLabel: '{position} von {count}' } })`.
|
|
87
|
+
*/
|
|
88
|
+
static words: string;
|
|
84
89
|
/**
|
|
85
90
|
* Draws a wash under each line, down to the floor of the plot. The washes
|
|
86
91
|
* overlap and do not add up, so for parts that make a total, use
|
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { byRow, CHART_PLOT, commaList, customElement, drawTooltip, extent, HelixElement, linear, linePath, MixinChartSource, PLOT_HEIGHT, PLOT_WIDTH, seriesIndex, seriesKey, ticks, unbroken, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { byRow, CHART_PLOT, commaList, customElement, drawTooltip, extent, HelixElement, linear, linePath, MixinChartSource, PLOT_HEIGHT, PLOT_WIDTH, seriesIndex, seriesKey, ticks, unbroken, wordsLocale, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { html, nothing, svg } from 'lit';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
10
|
import '../../tooltip/index.js';
|
|
@@ -16,6 +16,7 @@ let HelixHeadlessLineChart = class HelixHeadlessLineChart extends MixinChartSour
|
|
|
16
16
|
this.markers = false;
|
|
17
17
|
this.zero = false;
|
|
18
18
|
}
|
|
19
|
+
static { this.words = 'helix-line-chart'; }
|
|
19
20
|
get rulesValue() {
|
|
20
21
|
return this.gridlines !== undefined && this.gridlines !== 'category';
|
|
21
22
|
}
|
|
@@ -71,8 +72,9 @@ let HelixHeadlessLineChart = class HelixHeadlessLineChart extends MixinChartSour
|
|
|
71
72
|
return [{ label: last.label, reading: `${one.name} ${text}` }];
|
|
72
73
|
});
|
|
73
74
|
const shared = latest.every((one) => one.label === latest[0]?.label);
|
|
75
|
+
const listed = new Intl.ListFormat(wordsLocale(this), { style: 'short', type: 'unit' });
|
|
74
76
|
const body = shared
|
|
75
|
-
? `${latest[0]?.label ?? ''}: ${latest.map((one) => one.reading)
|
|
77
|
+
? `${latest[0]?.label ?? ''}: ${listed.format(latest.map((one) => one.reading))}`
|
|
76
78
|
: latest.map((one) => `${one.label}: ${one.reading}`).join('; ');
|
|
77
79
|
const named = this.named ? `${this.named}, ` : '';
|
|
78
80
|
return html `<p id="helix-chart-summary" part="summary">${named}${body}.</p>`;
|
|
@@ -2,6 +2,8 @@ import { HelixElement } from '@fusion.dev/helix-core';
|
|
|
2
2
|
import { nothing, type PropertyValues, type TemplateResult } from 'lit';
|
|
3
3
|
/** The values `current` takes, which are `aria-current`'s. */
|
|
4
4
|
export type ListItemCurrent = 'date' | 'location' | 'page' | 'step' | 'time' | 'true';
|
|
5
|
+
/** Where a row stands in a move: the row being moved, or the one the drop indicator is beside. */
|
|
6
|
+
export type ListItemMove = 'dragging' | 'drop-after' | 'drop-before';
|
|
5
7
|
/**
|
|
6
8
|
* @summary One row of a list.
|
|
7
9
|
*
|
|
@@ -35,6 +37,11 @@ export type ListItemCurrent = 'date' | 'location' | 'page' | 'step' | 'time' | '
|
|
|
35
37
|
* selects, whether it is selected. Its link leaves the tab order there, and
|
|
36
38
|
* Enter follows it from the row.
|
|
37
39
|
*
|
|
40
|
+
* **In a `reorderable` list, the row has a grip** after its `end` slot, named
|
|
41
|
+
* by the list's `move-label`. The list says which row is moving and where the
|
|
42
|
+
* drop indicator is, with the `dragging`, `drop-before`, and `drop-after`
|
|
43
|
+
* states.
|
|
44
|
+
*
|
|
38
45
|
* @since 0.1.0
|
|
39
46
|
* @status stable
|
|
40
47
|
* @aliases Row, Entry
|
|
@@ -47,10 +54,15 @@ export type ListItemCurrent = 'date' | 'location' | 'page' | 'step' | 'time' | '
|
|
|
47
54
|
*
|
|
48
55
|
* @event {HelixActionEvent} helix-action - The reader pressed Enter on the row, or pressed the row in a list that selects nothing, in a list with `selection-mode`. Read the row from `target`. A row with `href` follows its link instead.
|
|
49
56
|
*
|
|
57
|
+
* @csspart grip - The button that moves the row, in a `reorderable` list.
|
|
58
|
+
* @csspart grip-mark - The icon on the grip.
|
|
50
59
|
* @csspart link - The link, when the row has `href`. It holds every region except `end`.
|
|
51
60
|
* @csspart row - The row's layout. It sits inside the host so the host can carry a list marker. In a list with `selection-mode` it is the grid cell that takes focus.
|
|
52
61
|
* @csspart row-current - Added to `row` while the row is `current`.
|
|
53
62
|
*
|
|
63
|
+
* @cssstate dragging - The row is being moved, in a `reorderable` list.
|
|
64
|
+
* @cssstate drop-after - The row being moved goes after this one when it is dropped.
|
|
65
|
+
* @cssstate drop-before - The row being moved goes before this one when it is dropped.
|
|
54
66
|
* @cssstate selected - The row is selected, in a list that selects.
|
|
55
67
|
*/
|
|
56
68
|
export declare class HelixHeadlessListItem extends HelixElement {
|
|
@@ -77,6 +89,13 @@ export declare class HelixHeadlessListItem extends HelixElement {
|
|
|
77
89
|
* it is coordination between elements, as `Tag.focusable` is.
|
|
78
90
|
*/
|
|
79
91
|
focusable?: boolean | undefined;
|
|
92
|
+
/**
|
|
93
|
+
* The name of the row's grip, written by a `reorderable` list from its
|
|
94
|
+
* `move-label`, and unset in a list that does not reorder, which draws no
|
|
95
|
+
* grip. No attribute: it is coordination between elements, as `focusable`
|
|
96
|
+
* is.
|
|
97
|
+
*/
|
|
98
|
+
grip?: string | undefined;
|
|
80
99
|
/**
|
|
81
100
|
* The URL the row links to. Leave it empty for a row that is not a link.
|
|
82
101
|
*
|
|
@@ -85,6 +104,11 @@ export declare class HelixHeadlessListItem extends HelixElement {
|
|
|
85
104
|
* to the current page on every row a consumer never asked to be one.
|
|
86
105
|
*/
|
|
87
106
|
href: string;
|
|
107
|
+
/**
|
|
108
|
+
* Where the row stands in a move, written by a `reorderable` list: the row
|
|
109
|
+
* being moved, or the one the drop indicator is beside. Unset otherwise.
|
|
110
|
+
*/
|
|
111
|
+
move?: ListItemMove | undefined;
|
|
88
112
|
/**
|
|
89
113
|
* The link's `rel` value. You set it yourself. It is not derived from
|
|
90
114
|
* `target`, for the reason `Tree.Item` gives.
|
|
@@ -121,11 +145,19 @@ export declare class HelixHeadlessListItem extends HelixElement {
|
|
|
121
145
|
* over.
|
|
122
146
|
*/
|
|
123
147
|
get controls(): HTMLElement[];
|
|
148
|
+
/** @internal The grip that moves the row, in a `reorderable` list. */
|
|
149
|
+
get gripElement(): HTMLElement | null;
|
|
124
150
|
/** Moves focus to the row's cell, in a list with `selection-mode`. */
|
|
125
151
|
focusItem(): void;
|
|
126
152
|
/** @internal Follows the row's link, as a press on it would. Called by the list on Enter. */
|
|
127
153
|
follow(): void;
|
|
128
154
|
protected willUpdate(changed: PropertyValues): void;
|
|
155
|
+
/**
|
|
156
|
+
* The grip, after `end`, in a `reorderable` list. A tab stop of its own in a
|
|
157
|
+
* list a reader reads, and reached with Left and Right in a list with
|
|
158
|
+
* `selection-mode`, as a control in `end` is.
|
|
159
|
+
*/
|
|
160
|
+
private renderGrip;
|
|
129
161
|
/**
|
|
130
162
|
* The cell before the row's content, which this tier leaves empty.
|
|
131
163
|
*
|
|
@@ -5,8 +5,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { customElement, HelixElement, hostAria, slottedWords } from '@fusion.dev/helix-core';
|
|
8
|
+
import { dotsSixVertical } from '@fusion.dev/helix-icons';
|
|
8
9
|
import { html, nothing } from 'lit';
|
|
9
10
|
import { property } from 'lit/decorators.js';
|
|
11
|
+
import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
|
|
10
12
|
const CONTROL = 'a[href], button, input, select, textarea, [tabindex]';
|
|
11
13
|
let HelixHeadlessListItem = class HelixHeadlessListItem extends HelixElement {
|
|
12
14
|
constructor() {
|
|
@@ -31,11 +33,18 @@ let HelixHeadlessListItem = class HelixHeadlessListItem extends HelixElement {
|
|
|
31
33
|
}
|
|
32
34
|
get controls() {
|
|
33
35
|
const slot = this.renderRoot?.querySelector?.('slot[name="end"]');
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
const grip = this.gripElement;
|
|
37
|
+
return [
|
|
38
|
+
...(slot?.assignedElements({ flatten: true }) ?? [])
|
|
39
|
+
.flatMap((element) => [element, ...element.querySelectorAll('*')])
|
|
40
|
+
.filter((element) => element instanceof HTMLElement &&
|
|
41
|
+
element.matches(CONTROL) &&
|
|
42
|
+
!element.matches(':disabled')),
|
|
43
|
+
...(grip ? [grip] : []),
|
|
44
|
+
];
|
|
45
|
+
}
|
|
46
|
+
get gripElement() {
|
|
47
|
+
return this.renderRoot?.querySelector?.('[part="grip"]') ?? null;
|
|
39
48
|
}
|
|
40
49
|
focusItem() {
|
|
41
50
|
this.cell?.focus();
|
|
@@ -51,6 +60,18 @@ let HelixHeadlessListItem = class HelixHeadlessListItem extends HelixElement {
|
|
|
51
60
|
this.internals.ariaCurrent =
|
|
52
61
|
this.current !== undefined && this.href === '' ? this.current : null;
|
|
53
62
|
this.toggleState('selected', this.selected === true);
|
|
63
|
+
this.toggleState('dragging', this.move === 'dragging');
|
|
64
|
+
this.toggleState('drop-after', this.move === 'drop-after');
|
|
65
|
+
this.toggleState('drop-before', this.move === 'drop-before');
|
|
66
|
+
}
|
|
67
|
+
renderGrip() {
|
|
68
|
+
return this.grip === undefined
|
|
69
|
+
? nothing
|
|
70
|
+
: html `<button part="grip" type="button" tabindex=${this.grouped ? '-1' : nothing} aria-label=${this.grip}>
|
|
71
|
+
<svg aria-hidden="true" fill="currentColor" part="grip-mark" viewBox=${dotsSixVertical.viewBox}>
|
|
72
|
+
${unsafeSVG(dotsSixVertical.content)}
|
|
73
|
+
</svg>
|
|
74
|
+
</button>`;
|
|
54
75
|
}
|
|
55
76
|
renderRail() {
|
|
56
77
|
return nothing;
|
|
@@ -70,7 +91,7 @@ let HelixHeadlessListItem = class HelixHeadlessListItem extends HelixElement {
|
|
|
70
91
|
tabindex=${tabindex}
|
|
71
92
|
aria-labelledby=${labelledby}
|
|
72
93
|
aria-describedby=${describedby}
|
|
73
|
-
>${content}<slot name="end"></slot
|
|
94
|
+
>${content}<slot name="end"></slot>${this.renderGrip()}</div>`
|
|
74
95
|
: html `<div
|
|
75
96
|
part="row${this.current === undefined ? '' : ' row-current'}"
|
|
76
97
|
role=${role}
|
|
@@ -85,7 +106,7 @@ let HelixHeadlessListItem = class HelixHeadlessListItem extends HelixElement {
|
|
|
85
106
|
aria-current=${this.current ?? nothing}
|
|
86
107
|
tabindex=${this.grouped ? '-1' : nothing}
|
|
87
108
|
>${content}</a
|
|
88
|
-
><slot name="end"></slot
|
|
109
|
+
><slot name="end"></slot>${this.renderGrip()}</div>`;
|
|
89
110
|
}
|
|
90
111
|
};
|
|
91
112
|
__decorate([
|
|
@@ -101,9 +122,15 @@ __decorate([
|
|
|
101
122
|
__decorate([
|
|
102
123
|
property({ attribute: false })
|
|
103
124
|
], HelixHeadlessListItem.prototype, "focusable", void 0);
|
|
125
|
+
__decorate([
|
|
126
|
+
property({ attribute: false })
|
|
127
|
+
], HelixHeadlessListItem.prototype, "grip", void 0);
|
|
104
128
|
__decorate([
|
|
105
129
|
property()
|
|
106
130
|
], HelixHeadlessListItem.prototype, "href", void 0);
|
|
131
|
+
__decorate([
|
|
132
|
+
property({ attribute: false })
|
|
133
|
+
], HelixHeadlessListItem.prototype, "move", void 0);
|
|
107
134
|
__decorate([
|
|
108
135
|
property()
|
|
109
136
|
], HelixHeadlessListItem.prototype, "rel", void 0);
|
|
@@ -46,6 +46,23 @@ import { type ListSelectionBehavior, type ListSelectionMode } from '../selection
|
|
|
46
46
|
* in `end` `tabindex="-1"` to leave it to the arrow keys and out of the tab
|
|
47
47
|
* order.
|
|
48
48
|
*
|
|
49
|
+
* **`reorderable` lets you move rows.** Each row gets a grip after its `end`
|
|
50
|
+
* slot, named by `move-label`. Drag a grip to move its row, and the list
|
|
51
|
+
* scrolls near an edge. Or press a grip with Space, Enter, or a click to pick
|
|
52
|
+
* up its row, move it with the arrow keys, and press the grip again to drop
|
|
53
|
+
* it. A click on another row drops it there, and Escape puts it back. The list
|
|
54
|
+
* says each step in its `live` region. A drop sends `helix-before-reorder`,
|
|
55
|
+
* which you can refuse, and then `helix-reorder`, whose `keys` hold every
|
|
56
|
+
* row's value in the new order. **You move the rows**: the list moves no
|
|
57
|
+
* element of yours, so your framework keeps the order it rendered.
|
|
58
|
+
*
|
|
59
|
+
* | Key, on a held row's grip | What it does |
|
|
60
|
+
* |---|---|
|
|
61
|
+
* | Down, Up | Moves the row one place. |
|
|
62
|
+
* | Home, End | Moves the row to the top or the bottom. |
|
|
63
|
+
* | Space, Enter | Drops the row. |
|
|
64
|
+
* | Escape | Puts the row back where it was. |
|
|
65
|
+
*
|
|
49
66
|
* `start` and `reversed` number an ordered list as `<ol>` does. The list
|
|
50
67
|
* writes where the numbers start and which way they run as `--list-first` and
|
|
51
68
|
* `--list-step` on its slot, which the styled tier counts from. Reversed with
|
|
@@ -63,11 +80,28 @@ import { type ListSelectionBehavior, type ListSelectionMode } from '../selection
|
|
|
63
80
|
* @event {Event} change - Fired once a press has changed which rows are selected.
|
|
64
81
|
* @event {HelixActionEvent} helix-action - Sent from a row when the reader acts on it: Enter, or a press in a list that selects nothing. Read the row from `target`. A row with `href` follows its link instead.
|
|
65
82
|
* @event {HelixBeforeChangeEvent} helix-before-change - Fired before a press changes which rows are selected, with the `value` it would leave. Cancelable.
|
|
83
|
+
* @event {HelixBeforeReorderEvent} helix-before-reorder - Fired when a row is dropped at a new place, in a `reorderable` list, with every row's value in the new order. Cancelable: cancel it to keep the row where it is.
|
|
84
|
+
* @event {HelixReorderEvent} helix-reorder - Fired after `helix-before-reorder` when nobody canceled it. Move your rows to the order in `keys`. Cancelable: cancel it to say the move did not happen.
|
|
85
|
+
*
|
|
86
|
+
* @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.
|
|
87
|
+
* @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.
|
|
66
88
|
*
|
|
67
89
|
* @cssproperty --list-first - The number of the first row, written where `start` or `reversed` moves it.
|
|
68
90
|
* @cssproperty --list-step - What each row adds to the number before it: `1`, or `-1` where `reversed`.
|
|
69
91
|
*/
|
|
70
92
|
export declare class HelixHeadlessList extends HelixElement {
|
|
93
|
+
/**
|
|
94
|
+
* The key this family's words are registered under, its styled tag:
|
|
95
|
+
* `registerWords('de', { 'helix-list': { moveLabel: '{name} verschieben' } })`.
|
|
96
|
+
*/
|
|
97
|
+
static words: string;
|
|
98
|
+
/**
|
|
99
|
+
* What screen readers hear when a held row is put back, or a move is
|
|
100
|
+
* refused, in a `reorderable` list.
|
|
101
|
+
*/
|
|
102
|
+
canceledLabel: string;
|
|
103
|
+
/** What screen readers hear when a row is dropped, in a `reorderable` list. */
|
|
104
|
+
droppedLabel: string;
|
|
71
105
|
/**
|
|
72
106
|
* The kind of list, which follows from the content.
|
|
73
107
|
*
|
|
@@ -95,6 +129,27 @@ export declare class HelixHeadlessList extends HelixElement {
|
|
|
95
129
|
* The list's name, read by screen readers.
|
|
96
130
|
*/
|
|
97
131
|
label: string;
|
|
132
|
+
/**
|
|
133
|
+
* What screen readers hear each time an arrow key moves a held row, in a
|
|
134
|
+
* `reorderable` list. `{name}` is the row's words, `{position}` the place it
|
|
135
|
+
* would go, counting from 1, and `{count}` the number of rows.
|
|
136
|
+
*/
|
|
137
|
+
movedLabel: string;
|
|
138
|
+
/**
|
|
139
|
+
* The name of each row's grip, in a `reorderable` list. `{name}` is
|
|
140
|
+
* replaced with the row's words.
|
|
141
|
+
*/
|
|
142
|
+
moveLabel: string;
|
|
143
|
+
/**
|
|
144
|
+
* What screen readers hear when a key or a click picks up a row, in a
|
|
145
|
+
* `reorderable` list. `{name}` is the row's words.
|
|
146
|
+
*/
|
|
147
|
+
pickedUpLabel: string;
|
|
148
|
+
/**
|
|
149
|
+
* Lets you move rows by dragging a grip, or with the keys. The list moves no
|
|
150
|
+
* row itself: you move your data on `helix-reorder`.
|
|
151
|
+
*/
|
|
152
|
+
reorderable: boolean;
|
|
98
153
|
/**
|
|
99
154
|
* Numbers an ordered list downward, so the count falls row by row and ends at
|
|
100
155
|
* its last row, as `<ol reversed>` does.
|
|
@@ -150,6 +205,15 @@ export declare class HelixHeadlessList extends HelixElement {
|
|
|
150
205
|
* from the focused row and without wrapping. Left and Right are the row's.
|
|
151
206
|
*/
|
|
152
207
|
protected readonly keys: KeyboardNavigationController;
|
|
208
|
+
/** The region that says each step of a move. */
|
|
209
|
+
private readonly status;
|
|
210
|
+
/** The value of a row just moved, whose grip takes focus back once the page has moved it. */
|
|
211
|
+
private moved;
|
|
212
|
+
/**
|
|
213
|
+
* Moving rows by their grips, in a `reorderable` list. The rows are the
|
|
214
|
+
* page's, so a drop asks the page to move them.
|
|
215
|
+
*/
|
|
216
|
+
private readonly reorder;
|
|
153
217
|
/** Whether the list is a grid a reader moves through. */
|
|
154
218
|
private get interactive();
|
|
155
219
|
/** The rows the list holds, in order. */
|
|
@@ -160,6 +224,29 @@ export declare class HelixHeadlessList extends HelixElement {
|
|
|
160
224
|
private navigable;
|
|
161
225
|
/** What a row stands for in `value`: its own `value`, or its words. */
|
|
162
226
|
private valueFor;
|
|
227
|
+
/** The row that stands for a value. */
|
|
228
|
+
private rowFor;
|
|
229
|
+
/**
|
|
230
|
+
* Asks the page to move a row: `helix-before-reorder`, which can refuse it,
|
|
231
|
+
* then `helix-reorder`. Reports whether it stood.
|
|
232
|
+
*/
|
|
233
|
+
private requestMove;
|
|
234
|
+
/**
|
|
235
|
+
* Tells every row whether it has a grip and where it stands in a move. Through
|
|
236
|
+
* `whenHydrated`, as `sync` is.
|
|
237
|
+
*/
|
|
238
|
+
private syncMoves;
|
|
239
|
+
/**
|
|
240
|
+
* Gives focus back to the grip of a row the page has just moved, where moving
|
|
241
|
+
* the row took focus to the body.
|
|
242
|
+
*
|
|
243
|
+
* The page moves its rows when it likes, in the same task or a render later,
|
|
244
|
+
* so this waits for the rows to change. Focus that went anywhere but the body
|
|
245
|
+
* is where you put it, and is left there.
|
|
246
|
+
*/
|
|
247
|
+
private refocus;
|
|
248
|
+
/** Whether the rows changed since the last move asked for one, for `refocus`. */
|
|
249
|
+
private rowsChanged;
|
|
163
250
|
/**
|
|
164
251
|
* Tells every row its place: whether it holds the one tab stop and whether
|
|
165
252
|
* it is selected, or that it is a plain row. Through `whenHydrated`, so a
|
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { commaList, customElement, focusItemOf, HelixActionEvent, HelixElement, hostAria, inlineStep, KeyboardNavigationController, pressedOwnControl, requestValue, rovingStop, scrollRoom, selectsAll, typeaheadByWords, whenHydrated, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { commaList, customElement, deepActiveElement, drawStatus, focusItemOf, formatWords, HelixActionEvent, HelixElement, hostAria, inlineStep, KeyboardNavigationController, placeKey, pressedOwnControl, ReorderController, requestReorder, requestValue, rovingStop, StatusController, scrollingAncestor, scrollRoom, selectsAll, typeaheadByWords, whenHydrated, words, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { html, nothing } from 'lit';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
10
|
import { HelixHeadlessListItem } from '../item/list-item.js';
|
|
@@ -13,7 +13,13 @@ import { choiceValue, pageReach, rowStop, } from '../selection.js';
|
|
|
13
13
|
let HelixHeadlessList = class HelixHeadlessList extends HelixElement {
|
|
14
14
|
constructor() {
|
|
15
15
|
super(...arguments);
|
|
16
|
+
this.canceledLabel = 'Canceled';
|
|
17
|
+
this.droppedLabel = 'Dropped';
|
|
16
18
|
this.label = '';
|
|
19
|
+
this.movedLabel = '{name} moved to position {position} of {count}';
|
|
20
|
+
this.moveLabel = 'Move {name}';
|
|
21
|
+
this.pickedUpLabel = 'Picked up {name}';
|
|
22
|
+
this.reorderable = false;
|
|
17
23
|
this.reversed = false;
|
|
18
24
|
this.selectionBehavior = 'toggle';
|
|
19
25
|
this.value = '';
|
|
@@ -25,6 +31,33 @@ let HelixHeadlessList = class HelixHeadlessList extends HelixElement {
|
|
|
25
31
|
typeahead: typeaheadByWords(),
|
|
26
32
|
wrap: false,
|
|
27
33
|
});
|
|
34
|
+
this.status = new StatusController(this);
|
|
35
|
+
this.reorder = new ReorderController(this, {
|
|
36
|
+
axis: 'block',
|
|
37
|
+
box: (key) => this.rowFor(key)?.getBoundingClientRect(),
|
|
38
|
+
drop: (move) => this.requestMove(move),
|
|
39
|
+
enabled: () => this.reorderable,
|
|
40
|
+
grip: (event) => {
|
|
41
|
+
const row = this.rowOf(event);
|
|
42
|
+
const element = row?.gripElement;
|
|
43
|
+
return row && element && event.composedPath().includes(element)
|
|
44
|
+
? { element, key: this.valueFor(row) }
|
|
45
|
+
: undefined;
|
|
46
|
+
},
|
|
47
|
+
item: (event) => {
|
|
48
|
+
const row = this.rowOf(event);
|
|
49
|
+
return row ? this.valueFor(row) : undefined;
|
|
50
|
+
},
|
|
51
|
+
keys: () => this.rows.map((row) => this.valueFor(row)),
|
|
52
|
+
name: (key) => this.rowFor(key)?.words || key,
|
|
53
|
+
preview: (key) => this.rowFor(key),
|
|
54
|
+
say: (said) => this.status.say(said),
|
|
55
|
+
scroller: () => {
|
|
56
|
+
const first = this.rows[0];
|
|
57
|
+
return first ? scrollingAncestor(first, { axis: 'y', overflowing: true }) : null;
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
this.rowsChanged = false;
|
|
28
61
|
this.handleKeyCapture = (event) => {
|
|
29
62
|
this.moving = { extend: event.shiftKey, toggle: event.ctrlKey || event.metaKey };
|
|
30
63
|
};
|
|
@@ -93,9 +126,11 @@ let HelixHeadlessList = class HelixHeadlessList extends HelixElement {
|
|
|
93
126
|
}
|
|
94
127
|
};
|
|
95
128
|
this.handleSlotChange = () => {
|
|
129
|
+
this.rowsChanged = true;
|
|
96
130
|
this.requestUpdate();
|
|
97
131
|
};
|
|
98
132
|
}
|
|
133
|
+
static { this.words = 'helix-list'; }
|
|
99
134
|
get interactive() {
|
|
100
135
|
return this.selectionMode !== undefined;
|
|
101
136
|
}
|
|
@@ -115,6 +150,54 @@ let HelixHeadlessList = class HelixHeadlessList extends HelixElement {
|
|
|
115
150
|
valueFor(row) {
|
|
116
151
|
return row.value || row.words;
|
|
117
152
|
}
|
|
153
|
+
rowFor(key) {
|
|
154
|
+
return this.rows.find((row) => this.valueFor(row) === key);
|
|
155
|
+
}
|
|
156
|
+
requestMove({ from, key, to }) {
|
|
157
|
+
const old = this.rows.map((row) => this.valueFor(row));
|
|
158
|
+
const keys = placeKey(old, old, key, to);
|
|
159
|
+
const stood = requestReorder(this, {
|
|
160
|
+
from,
|
|
161
|
+
key,
|
|
162
|
+
keys,
|
|
163
|
+
kind: 'item',
|
|
164
|
+
to: keys.indexOf(key),
|
|
165
|
+
value: keys.join(','),
|
|
166
|
+
});
|
|
167
|
+
this.moved = stood ? key : undefined;
|
|
168
|
+
this.rowsChanged = false;
|
|
169
|
+
return stood;
|
|
170
|
+
}
|
|
171
|
+
syncMoves() {
|
|
172
|
+
const held = this.reorder.held;
|
|
173
|
+
const mark = this.reorder.mark;
|
|
174
|
+
for (const row of this.rows) {
|
|
175
|
+
const key = this.valueFor(row);
|
|
176
|
+
whenHydrated(row, () => {
|
|
177
|
+
row.grip =
|
|
178
|
+
this.reorderable && !row.disabled
|
|
179
|
+
? formatWords(this, 'moveLabel', { name: row.words || key })
|
|
180
|
+
: undefined;
|
|
181
|
+
row.move =
|
|
182
|
+
held?.key === key
|
|
183
|
+
? 'dragging'
|
|
184
|
+
: mark?.key === key
|
|
185
|
+
? `drop-${mark.edge}`
|
|
186
|
+
: undefined;
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
refocus() {
|
|
191
|
+
const row = this.moved === undefined ? undefined : this.rowFor(this.moved);
|
|
192
|
+
if (!row || !this.rowsChanged) {
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
const active = deepActiveElement();
|
|
196
|
+
if (active === null || active === document.body) {
|
|
197
|
+
row.gripElement?.focus();
|
|
198
|
+
}
|
|
199
|
+
this.moved = undefined;
|
|
200
|
+
}
|
|
118
201
|
sync() {
|
|
119
202
|
const mode = this.selectionMode;
|
|
120
203
|
const chosen = new Set(commaList(this.value));
|
|
@@ -240,6 +323,10 @@ let HelixHeadlessList = class HelixHeadlessList extends HelixElement {
|
|
|
240
323
|
if (this.interactive || changed.get('selectionMode') !== undefined) {
|
|
241
324
|
this.sync();
|
|
242
325
|
}
|
|
326
|
+
if (this.reorderable || changed.get('reorderable') !== undefined) {
|
|
327
|
+
this.syncMoves();
|
|
328
|
+
this.refocus();
|
|
329
|
+
}
|
|
243
330
|
}
|
|
244
331
|
willUpdate(changed) {
|
|
245
332
|
super.willUpdate(changed);
|
|
@@ -251,15 +338,38 @@ let HelixHeadlessList = class HelixHeadlessList extends HelixElement {
|
|
|
251
338
|
return counted ? `--list-first: ${counted.first}; --list-step: ${counted.step}` : nothing;
|
|
252
339
|
}
|
|
253
340
|
render() {
|
|
254
|
-
return html `<slot style=${this.numbers} @slotchange=${this.handleSlotChange}></slot
|
|
341
|
+
return html `<slot style=${this.numbers} @slotchange=${this.handleSlotChange}></slot>${drawStatus(this.status)}${this.reorder.drawDragPreview()}`;
|
|
255
342
|
}
|
|
256
343
|
};
|
|
344
|
+
__decorate([
|
|
345
|
+
words,
|
|
346
|
+
property({ attribute: 'canceled-label' })
|
|
347
|
+
], HelixHeadlessList.prototype, "canceledLabel", void 0);
|
|
348
|
+
__decorate([
|
|
349
|
+
words,
|
|
350
|
+
property({ attribute: 'dropped-label' })
|
|
351
|
+
], HelixHeadlessList.prototype, "droppedLabel", void 0);
|
|
257
352
|
__decorate([
|
|
258
353
|
property({ reflect: true })
|
|
259
354
|
], HelixHeadlessList.prototype, "kind", void 0);
|
|
260
355
|
__decorate([
|
|
261
356
|
property()
|
|
262
357
|
], HelixHeadlessList.prototype, "label", void 0);
|
|
358
|
+
__decorate([
|
|
359
|
+
words,
|
|
360
|
+
property({ attribute: 'moved-label' })
|
|
361
|
+
], HelixHeadlessList.prototype, "movedLabel", void 0);
|
|
362
|
+
__decorate([
|
|
363
|
+
words,
|
|
364
|
+
property({ attribute: 'move-label' })
|
|
365
|
+
], HelixHeadlessList.prototype, "moveLabel", void 0);
|
|
366
|
+
__decorate([
|
|
367
|
+
words,
|
|
368
|
+
property({ attribute: 'picked-up-label' })
|
|
369
|
+
], HelixHeadlessList.prototype, "pickedUpLabel", void 0);
|
|
370
|
+
__decorate([
|
|
371
|
+
property({ type: Boolean })
|
|
372
|
+
], HelixHeadlessList.prototype, "reorderable", void 0);
|
|
263
373
|
__decorate([
|
|
264
374
|
property({ type: Boolean })
|
|
265
375
|
], HelixHeadlessList.prototype, "reversed", void 0);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ListboxReorderController, reorderListbox } from './listbox-reorder.js';
|