@fusion.dev/helix-headless 0.144.0 → 0.146.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/custom-elements.json +15195 -4240
- package/dist/accordion/item/accordion-item.d.ts +62 -12
- package/dist/accordion/item/accordion-item.js +41 -10
- package/dist/accordion/root/accordion-root.d.ts +14 -5
- package/dist/accordion/root/accordion-root.js +7 -1
- package/dist/announcement/root/announcement-root.d.ts +24 -3
- package/dist/announcement/root/announcement-root.js +39 -2
- package/dist/app-header/root/app-header-root.d.ts +12 -0
- package/dist/app-header/root/app-header-root.js +13 -1
- package/dist/app-header/sectioning.d.ts +9 -0
- package/dist/app-header/sectioning.js +27 -0
- package/dist/avatar/group/avatar-group.d.ts +20 -14
- package/dist/avatar/group/avatar-group.js +17 -19
- package/dist/badge/root/badge-root.d.ts +3 -1
- package/dist/badge/root/badge-root.js +2 -2
- package/dist/bar-chart/root/bar-chart-root.d.ts +18 -1
- package/dist/bar-chart/root/bar-chart-root.js +52 -15
- package/dist/bar-chart/stack.d.ts +15 -0
- package/dist/bar-chart/stack.js +19 -0
- package/dist/breadcrumbs/root/breadcrumbs-root.d.ts +57 -1
- package/dist/breadcrumbs/root/breadcrumbs-root.js +73 -3
- package/dist/button/root/button-root.d.ts +26 -0
- package/dist/button/root/button-root.js +38 -18
- package/dist/button-group/root/button-group-root.d.ts +2 -1
- package/dist/button-group/root/button-group-root.js +5 -1
- package/dist/canvas/node/canvas-node.d.ts +4 -3
- package/dist/canvas/node/canvas-node.js +3 -2
- package/dist/canvas/root/canvas-root.d.ts +38 -3
- package/dist/canvas/root/canvas-root.js +123 -42
- package/dist/card/root/card-root.d.ts +24 -3
- package/dist/card/root/card-root.js +20 -8
- package/dist/carousel/root/carousel-root.d.ts +133 -4
- package/dist/carousel/root/carousel-root.js +174 -24
- package/dist/carousel/stops.d.ts +20 -0
- package/dist/carousel/stops.js +30 -0
- package/dist/chat/composer/chat-composer.d.ts +38 -6
- package/dist/chat/composer/chat-composer.js +42 -9
- package/dist/chat/message/chat-message.d.ts +32 -1
- package/dist/chat/message/chat-message.js +27 -10
- package/dist/chat/naming.d.ts +26 -0
- package/dist/chat/naming.js +14 -0
- package/dist/chat/root/chat-root.d.ts +58 -0
- package/dist/chat/root/chat-root.js +43 -3
- package/dist/checkbox/root/checkbox-root.d.ts +20 -0
- package/dist/checkbox/root/checkbox-root.js +14 -1
- package/dist/checkbox-group/root/checkbox-group-root.d.ts +8 -2
- package/dist/checkbox-group/root/checkbox-group-root.js +12 -10
- package/dist/checkbox-group/select-all.d.ts +27 -0
- package/dist/checkbox-group/select-all.js +12 -0
- package/dist/code-block/highlight.d.ts +15 -0
- package/dist/code-block/highlight.js +4 -0
- package/dist/code-block/root/code-block-root.d.ts +57 -2
- package/dist/code-block/root/code-block-root.js +63 -8
- package/dist/color-input/root/color-input-root.d.ts +3 -0
- package/dist/color-input/root/color-input-root.js +6 -3
- package/dist/color-picker/root/color-picker-root.d.ts +33 -4
- package/dist/color-picker/root/color-picker-root.js +80 -21
- package/dist/color-picker/swatches.d.ts +12 -0
- package/dist/color-picker/swatches.js +26 -0
- package/dist/combobox/root/combobox-root.d.ts +43 -0
- package/dist/combobox/root/combobox-root.js +79 -15
- package/dist/command/root/command-root.d.ts +16 -1
- package/dist/command/root/command-root.js +22 -4
- package/dist/copy-button/root/copy-button-root.d.ts +26 -1
- package/dist/copy-button/root/copy-button-root.js +12 -5
- package/dist/data-table/index.d.ts +1 -1
- package/dist/data-table/index.js +1 -1
- package/dist/data-table/keys.d.ts +24 -0
- package/dist/data-table/keys.js +24 -0
- package/dist/data-table/root/data-table-root.d.ts +170 -13
- package/dist/data-table/root/data-table-root.js +294 -52
- package/dist/data-table/tree.d.ts +55 -0
- package/dist/data-table/tree.js +54 -0
- package/dist/date-input/root/date-input-root.d.ts +3 -1
- package/dist/date-input/root/date-input-root.js +18 -7
- package/dist/date-picker/root/date-picker-root.js +12 -6
- package/dist/description-list/item/description-list-item.d.ts +17 -2
- package/dist/description-list/item/description-list-item.js +15 -2
- package/dist/description-list/root/description-list-root.d.ts +27 -1
- package/dist/description-list/root/description-list-root.js +26 -1
- package/dist/dialog/description.js +15 -1
- package/dist/dialog/root/dialog-root.d.ts +8 -2
- package/dist/dialog/root/dialog-root.js +16 -1
- package/dist/divider/root/divider-root.d.ts +3 -0
- package/dist/divider/root/divider-root.js +2 -1
- package/dist/donut-chart/root/donut-chart-root.d.ts +31 -0
- package/dist/donut-chart/root/donut-chart-root.js +48 -1
- package/dist/drawer/reveal.d.ts +8 -0
- package/dist/drawer/reveal.js +1 -0
- package/dist/drawer/root/drawer-root.d.ts +59 -0
- package/dist/drawer/root/drawer-root.js +63 -4
- package/dist/drilldown/item/drilldown-item.d.ts +11 -6
- package/dist/drilldown/item/drilldown-item.js +8 -5
- package/dist/drilldown/root/drilldown-root.d.ts +29 -0
- package/dist/drilldown/root/drilldown-root.js +28 -5
- package/dist/element-events.generated.js +83 -12
- package/dist/empty/root/empty-root.d.ts +3 -1
- package/dist/empty/root/empty-root.js +3 -2
- package/dist/file-input/root/file-input-root.d.ts +69 -6
- package/dist/file-input/root/file-input-root.js +82 -19
- package/dist/file-input/screen.d.ts +2 -1
- package/dist/filter-input/menu/filter-menu.d.ts +5 -0
- package/dist/filter-input/menu/filter-menu.js +16 -4
- package/dist/filter-input/root/filter-input-root.d.ts +30 -6
- package/dist/filter-input/root/filter-input-root.js +1 -1
- package/dist/filter-input/suggest.d.ts +28 -3
- package/dist/filter-input/suggest.js +18 -8
- package/dist/format-date/root/format-date-root.d.ts +9 -16
- package/dist/format-date/root/format-date-root.js +10 -27
- package/dist/heatmap/root/heatmap-root.d.ts +24 -13
- package/dist/heatmap/root/heatmap-root.js +34 -12
- package/dist/icon/root/icon-root.d.ts +12 -1
- package/dist/icon/root/icon-root.js +21 -10
- package/dist/icon/settle.d.ts +7 -0
- package/dist/icon/settle.js +10 -0
- package/dist/icon-button/root/icon-button-root.d.ts +2 -0
- package/dist/image/root/image-root.d.ts +5 -1
- package/dist/image/root/image-root.js +10 -2
- package/dist/input/root/input-root.d.ts +13 -3
- package/dist/input/root/input-root.js +12 -3
- package/dist/kbd/root/kbd-root.d.ts +35 -1
- package/dist/kbd/root/kbd-root.js +23 -4
- package/dist/legend/root/legend-root.d.ts +55 -8
- package/dist/legend/root/legend-root.js +55 -13
- package/dist/lightbox/root/lightbox-root.d.ts +49 -6
- package/dist/lightbox/root/lightbox-root.js +86 -19
- package/dist/lightbox/zoom-controller.d.ts +59 -0
- package/dist/lightbox/zoom-controller.js +128 -0
- package/dist/lightbox/zoom.d.ts +22 -0
- package/dist/lightbox/zoom.js +16 -0
- package/dist/line-chart/root/line-chart-root.d.ts +22 -1
- package/dist/line-chart/root/line-chart-root.js +21 -1
- package/dist/list/item/list-item.d.ts +70 -1
- package/dist/list/item/list-item.js +77 -6
- package/dist/list/numbering.d.ts +14 -0
- package/dist/list/numbering.js +8 -0
- package/dist/list/root/list-root.d.ts +155 -9
- package/dist/list/root/list-root.js +246 -4
- package/dist/list/selection.d.ts +49 -0
- package/dist/list/selection.js +30 -0
- package/dist/listbox/root/listbox-root.d.ts +37 -1
- package/dist/listbox/root/listbox-root.js +49 -4
- package/dist/loader/busy.d.ts +10 -0
- package/dist/loader/busy.js +11 -0
- package/dist/loader/root/loader-root.d.ts +9 -2
- package/dist/loader/root/loader-root.js +23 -3
- package/dist/map/root/map-root.d.ts +6 -2
- package/dist/map/root/map-root.js +5 -2
- package/dist/megamenu/root/megamenu-root.d.ts +62 -0
- package/dist/megamenu/root/megamenu-root.js +90 -5
- package/dist/menu/index.d.ts +1 -0
- package/dist/menu/index.js +1 -0
- package/dist/menu/item/menu-item.d.ts +87 -11
- package/dist/menu/item/menu-item.js +78 -22
- package/dist/menu/root/menu-root.d.ts +39 -1
- package/dist/menu/root/menu-root.js +65 -8
- package/dist/menu/section/menu-section.d.ts +55 -0
- package/dist/menu/section/menu-section.js +60 -0
- package/dist/meter/root/meter-root.d.ts +20 -1
- package/dist/meter/root/meter-root.js +11 -15
- package/dist/navigation/root/navigation-root.d.ts +18 -2
- package/dist/navigation/root/navigation-root.js +29 -3
- package/dist/notifications/root/notifications-root.d.ts +25 -0
- package/dist/notifications/root/notifications-root.js +33 -5
- package/dist/number-input/root/number-input-root.d.ts +17 -8
- package/dist/number-input/root/number-input-root.js +2 -7
- package/dist/object-inspector/root/object-inspector-root.d.ts +161 -32
- package/dist/object-inspector/root/object-inspector-root.js +264 -123
- package/dist/object-inspector/rows.d.ts +75 -0
- package/dist/object-inspector/rows.js +119 -0
- package/dist/option/root/option-root.d.ts +5 -3
- package/dist/outline/levels.d.ts +31 -0
- package/dist/outline/levels.js +23 -0
- package/dist/outline/root/outline-root.d.ts +86 -3
- package/dist/outline/root/outline-root.js +95 -12
- package/dist/pagination/size/pagination-size.d.ts +12 -2
- package/dist/pagination/size/pagination-size.js +20 -5
- package/dist/pin-input/code.d.ts +10 -0
- package/dist/pin-input/code.js +13 -0
- package/dist/pin-input/root/pin-input-root.d.ts +25 -1
- package/dist/pin-input/root/pin-input-root.js +10 -11
- package/dist/popover/hide-outside.d.ts +14 -0
- package/dist/popover/hide-outside.js +41 -0
- package/dist/popover/root/popover-root.d.ts +57 -7
- package/dist/popover/root/popover-root.js +58 -3
- package/dist/progress/root/progress-root.d.ts +20 -0
- package/dist/progress/root/progress-root.js +15 -15
- package/dist/qr-code/export.d.ts +26 -1
- package/dist/qr-code/export.js +14 -0
- package/dist/qr-code/root/qr-code-root.d.ts +19 -5
- package/dist/qr-code/root/qr-code-root.js +58 -9
- package/dist/quote/marks.d.ts +8 -0
- package/dist/quote/marks.js +5 -0
- package/dist/quote/root/quote-root.d.ts +14 -2
- package/dist/quote/root/quote-root.js +23 -1
- package/dist/radio/group/radio-group.d.ts +4 -10
- package/dist/radio/group/radio-group.js +5 -10
- package/dist/radio/root/radio-root.d.ts +6 -2
- package/dist/radio/root/radio-root.js +6 -1
- package/dist/rating/root/rating-root.d.ts +10 -5
- package/dist/rating/root/rating-root.js +32 -8
- package/dist/rating/steps.d.ts +7 -0
- package/dist/rating/steps.js +9 -0
- package/dist/scatter-chart/fit.d.ts +15 -0
- package/dist/scatter-chart/fit.js +35 -0
- package/dist/scatter-chart/root/scatter-chart-root.d.ts +21 -1
- package/dist/scatter-chart/root/scatter-chart-root.js +30 -17
- package/dist/scroll-area/root/scroll-area-root.d.ts +84 -0
- package/dist/scroll-area/root/scroll-area-root.js +106 -7
- package/dist/scroll-area/scrollbar-controller.d.ts +111 -0
- package/dist/scroll-area/scrollbar-controller.js +172 -0
- package/dist/scroll-area/scrollbar.d.ts +92 -0
- package/dist/scroll-area/scrollbar.js +33 -0
- package/dist/select/root/select-root.d.ts +15 -0
- package/dist/select/root/select-root.js +18 -6
- package/dist/skeleton/root/skeleton-root.d.ts +3 -0
- package/dist/skeleton/root/skeleton-root.js +4 -2
- package/dist/skip-link/root/skip-link-root.js +2 -2
- package/dist/slider/root/slider-root.d.ts +41 -4
- package/dist/slider/root/slider-root.js +23 -3
- package/dist/sparkline/readings.d.ts +18 -0
- package/dist/sparkline/readings.js +19 -0
- package/dist/sparkline/root/sparkline-root.d.ts +78 -7
- package/dist/sparkline/root/sparkline-root.js +118 -23
- package/dist/speed-dial/root/speed-dial-root.js +2 -2
- package/dist/splitter/root/splitter-root.d.ts +20 -12
- package/dist/splitter/root/splitter-root.js +226 -203
- package/dist/splitter/snap.d.ts +9 -0
- package/dist/splitter/snap.js +12 -0
- package/dist/stat/root/stat-root.d.ts +14 -5
- package/dist/stat/root/stat-root.js +21 -5
- package/dist/steps/reach.d.ts +20 -0
- package/dist/steps/reach.js +15 -0
- package/dist/steps/root/steps-root.d.ts +76 -0
- package/dist/steps/root/steps-root.js +93 -1
- package/dist/steps/step/step.d.ts +45 -2
- package/dist/steps/step/step.js +33 -6
- package/dist/switch/root/switch-root.d.ts +10 -0
- package/dist/table/column/table-column.d.ts +11 -10
- package/dist/table/column/table-column.js +8 -19
- package/dist/table/root/table-root.d.ts +126 -4
- package/dist/table/root/table-root.js +156 -6
- package/dist/table/row/table-row.d.ts +47 -1
- package/dist/table/row/table-row.js +39 -2
- package/dist/tabs/panel/tab-panel.d.ts +22 -5
- package/dist/tabs/panel/tab-panel.js +34 -6
- package/dist/tabs/root/tabs-root.d.ts +37 -1
- package/dist/tabs/root/tabs-root.js +22 -4
- package/dist/tabs/tab/tab.d.ts +41 -4
- package/dist/tabs/tab/tab.js +49 -3
- package/dist/tag/group/tag-group.d.ts +31 -4
- package/dist/tag/group/tag-group.js +46 -7
- package/dist/tag/root/tag-root.js +9 -2
- package/dist/textarea/root/textarea-root.d.ts +28 -1
- package/dist/textarea/root/textarea-root.js +40 -1
- package/dist/time-input/root/time-input-root.d.ts +5 -1
- package/dist/time-input/root/time-input-root.js +16 -8
- package/dist/time-picker/root/time-picker-root.d.ts +18 -4
- package/dist/time-picker/root/time-picker-root.js +7 -10
- package/dist/time-picker/wheel-name.d.ts +9 -0
- package/dist/time-picker/wheel-name.js +15 -0
- package/dist/timeline/group/timeline-group.d.ts +46 -0
- package/dist/timeline/group/timeline-group.js +37 -0
- package/dist/timeline/index.d.ts +1 -0
- package/dist/timeline/index.js +1 -0
- package/dist/timeline/root/timeline-root.d.ts +10 -3
- package/dist/toast/item/toast-item.d.ts +24 -18
- package/dist/toast/item/toast-item.js +36 -40
- package/dist/toast/root/toast-root.d.ts +6 -0
- package/dist/toast/root/toast-root.js +16 -1
- package/dist/toggle/group/toggle-group.d.ts +24 -3
- package/dist/toggle/group/toggle-group.js +34 -5
- package/dist/toolbar/root/toolbar-root.d.ts +13 -0
- package/dist/toolbar/root/toolbar-root.js +15 -5
- package/dist/tooltip/root/tooltip-root.d.ts +13 -2
- package/dist/tooltip/root/tooltip-root.js +9 -1
- package/dist/tour/back.d.ts +10 -0
- package/dist/tour/back.js +8 -0
- package/dist/tour/root/tour-root.d.ts +30 -2
- package/dist/tour/root/tour-root.js +34 -8
- package/dist/tree/item/tree-item.d.ts +61 -4
- package/dist/tree/item/tree-item.js +92 -20
- package/dist/tree/root/tree-root.d.ts +58 -0
- package/dist/tree/root/tree-root.js +80 -16
- package/dist/tree/selection.d.ts +24 -0
- package/dist/tree/selection.js +13 -0
- package/dist/trend/root/trend-root.d.ts +43 -18
- package/dist/trend/root/trend-root.js +31 -6
- package/dist/video/media-events.d.ts +44 -0
- package/dist/video/media-events.js +35 -0
- package/dist/video/root/video-root.d.ts +117 -18
- package/dist/video/root/video-root.js +93 -47
- 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/order.d.ts +41 -0
- package/dist/video-playlist/order.js +34 -0
- package/dist/video-playlist/root/video-playlist-root.d.ts +77 -3
- package/dist/video-playlist/root/video-playlist-root.js +60 -16
- package/dist/virtual-list/controls.d.ts +4 -0
- package/dist/virtual-list/controls.js +30 -0
- package/dist/virtual-list/fill.d.ts +22 -0
- package/dist/virtual-list/fill.js +23 -0
- package/dist/virtual-list/keys.d.ts +15 -0
- package/dist/virtual-list/keys.js +24 -0
- package/dist/virtual-list/plan.d.ts +49 -0
- package/dist/virtual-list/plan.js +16 -0
- package/dist/virtual-list/root/virtual-list-root.d.ts +259 -26
- package/dist/virtual-list/root/virtual-list-root.js +333 -49
- package/lint.json +1 -1
- package/package.json +8 -8
- package/types/jsx.d.ts +8113 -1394
- package/types/svelte.d.ts +2 -0
- package/types/vue.d.ts +1678 -353
- package/dist/data-table/root/order.d.ts +0 -141
- package/dist/data-table/root/order.js +0 -76
- package/dist/listbox/range.d.ts +0 -17
- package/dist/listbox/range.js +0 -5
- package/dist/tag/selection.d.ts +0 -10
- package/dist/tag/selection.js +0 -12
|
@@ -4,13 +4,14 @@ 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 { CopyController, capturePointer, colorName, customElement, drawIcon, fillTemplate, formatColor, HelixFormElement, HelixSampleEndEvent, HelixSampleStartEvent, hostAria, hueName, isRtl, MixinControllerValue, parseColor, splitValues, toCss, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { CopyController, capturePointer, colorName, customElement, drawIcon, fillTemplate, formatColor, HelixFormElement, HelixSampleEndEvent, HelixSampleStartEvent, hostAria, hueName, inlineStep, isRtl, MixinControllerValue, parseColor, rovingStop, splitValues, toCss, wordsConverter, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { eyedropper } from '@fusion.dev/helix-icons';
|
|
9
9
|
import { nothing } from 'lit';
|
|
10
10
|
import { property, state } from 'lit/decorators.js';
|
|
11
11
|
import { live } from 'lit/directives/live.js';
|
|
12
12
|
import { html } from 'lit/static-html.js';
|
|
13
13
|
import { channelFields, writeChannel } from '../channels.js';
|
|
14
|
+
import { swatchMove } from '../swatches.js';
|
|
14
15
|
import '../../button/index.js';
|
|
15
16
|
import '../../button-group/index.js';
|
|
16
17
|
import '../../slider/index.js';
|
|
@@ -28,6 +29,7 @@ let HelixHeadlessColorPicker = class HelixHeadlessColorPicker extends MixinContr
|
|
|
28
29
|
this.copiedLabel = 'Copied';
|
|
29
30
|
this.copyLabel = 'Copy {value}';
|
|
30
31
|
this.eyedropperLabel = 'Sample a color from the screen';
|
|
32
|
+
this.feedback = '';
|
|
31
33
|
this.formatLabel = 'Syntax: {format}. Change it.';
|
|
32
34
|
this.greenLabel = 'Green';
|
|
33
35
|
this.hueLabel = 'Hue';
|
|
@@ -79,10 +81,33 @@ let HelixHeadlessColorPicker = class HelixHeadlessColorPicker extends MixinContr
|
|
|
79
81
|
this.copier = new CopyController(this);
|
|
80
82
|
this.handleSwatch = (preset) => {
|
|
81
83
|
const parsed = parseColor(preset);
|
|
82
|
-
if (parsed) {
|
|
84
|
+
if (!parsed) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const format = this.format ?? 'hex';
|
|
88
|
+
const fields = channelFields(preset, parsed, format, this.alpha);
|
|
89
|
+
const first = fields[0];
|
|
90
|
+
const exact = first && writeChannel(fields, format, this.alpha, first.channel, first.value);
|
|
91
|
+
if (exact) {
|
|
92
|
+
this.takeWritten(exact);
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
83
95
|
this.move(parsed);
|
|
84
|
-
this.settle();
|
|
85
96
|
}
|
|
97
|
+
this.settle();
|
|
98
|
+
};
|
|
99
|
+
this.handleSwatchKeydown = (event) => {
|
|
100
|
+
const row = [
|
|
101
|
+
...(this.renderRoot.querySelectorAll('[part="swatches"] [part="swatch"]') ?? []),
|
|
102
|
+
];
|
|
103
|
+
const at = row.indexOf(event.target);
|
|
104
|
+
const next = swatchMove(event.key, inlineStep(this, event.key), at, row.length);
|
|
105
|
+
if (at < 0 || next === null) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
event.preventDefault();
|
|
109
|
+
this.swatchAt = next;
|
|
110
|
+
row[next]?.focus();
|
|
86
111
|
};
|
|
87
112
|
this.handleFormat = () => {
|
|
88
113
|
if (this.readOnly) {
|
|
@@ -214,6 +239,9 @@ let HelixHeadlessColorPicker = class HelixHeadlessColorPicker extends MixinContr
|
|
|
214
239
|
this.internals.setFormValue(this.value === '' ? null : this.value);
|
|
215
240
|
this.reportRequired();
|
|
216
241
|
}
|
|
242
|
+
get validityFeedback() {
|
|
243
|
+
return this.feedback;
|
|
244
|
+
}
|
|
217
245
|
reportRequired() {
|
|
218
246
|
if (this.required && this.value === '') {
|
|
219
247
|
this.internals.setValidity({ valueMissing: true }, this.valueMissingMessage || 'Choose a color.', this.partNamed('grid') ?? undefined);
|
|
@@ -370,6 +398,40 @@ let HelixHeadlessColorPicker = class HelixHeadlessColorPicker extends MixinContr
|
|
|
370
398
|
</${this.tag('button')}>`}
|
|
371
399
|
</${this.tag('button-group')}>`;
|
|
372
400
|
}
|
|
401
|
+
renderSwatches(painted) {
|
|
402
|
+
const presets = this.presets;
|
|
403
|
+
const chosen = presets.map((preset) => {
|
|
404
|
+
const parsed = parseColor(preset);
|
|
405
|
+
return parsed !== null && toCss(parsed) === painted;
|
|
406
|
+
});
|
|
407
|
+
const indexes = presets.map((_, index) => index);
|
|
408
|
+
const stop = rovingStop(indexes, this.swatchAt, { selected: (index) => chosen[index] === true });
|
|
409
|
+
return html `<div
|
|
410
|
+
part="swatches"
|
|
411
|
+
role="listbox"
|
|
412
|
+
aria-label=${this.presetsLabel}
|
|
413
|
+
aria-orientation="horizontal"
|
|
414
|
+
@keydown=${this.handleSwatchKeydown}
|
|
415
|
+
>
|
|
416
|
+
${presets.map((preset, index) => {
|
|
417
|
+
const parsed = parseColor(preset);
|
|
418
|
+
return html `<button
|
|
419
|
+
part="swatch"
|
|
420
|
+
type="button"
|
|
421
|
+
role="option"
|
|
422
|
+
tabindex=${index === stop ? '0' : '-1'}
|
|
423
|
+
aria-label=${parsed ? colorName(parsed, this.colorWords, this.lang) : preset}
|
|
424
|
+
aria-selected=${chosen[index] ? 'true' : 'false'}
|
|
425
|
+
style="--color-picker-swatch: ${preset}"
|
|
426
|
+
?disabled=${this.isDisabled}
|
|
427
|
+
@click=${() => {
|
|
428
|
+
this.swatchAt = index;
|
|
429
|
+
this.handleSwatch(preset);
|
|
430
|
+
}}
|
|
431
|
+
></button>`;
|
|
432
|
+
})}
|
|
433
|
+
</div>`;
|
|
434
|
+
}
|
|
373
435
|
render() {
|
|
374
436
|
const color = this.color;
|
|
375
437
|
const painted = toCss(color);
|
|
@@ -394,6 +456,7 @@ let HelixHeadlessColorPicker = class HelixHeadlessColorPicker extends MixinContr
|
|
|
394
456
|
min="0"
|
|
395
457
|
max="100"
|
|
396
458
|
aria-label=${axisName(this.saturationLabel)}
|
|
459
|
+
aria-describedby=${this.feedback === '' ? nothing : 'feedback'}
|
|
397
460
|
aria-valuetext=${both}
|
|
398
461
|
aria-invalid=${this.invalid ? 'true' : nothing}
|
|
399
462
|
.value=${String(color.saturation)}
|
|
@@ -409,6 +472,7 @@ let HelixHeadlessColorPicker = class HelixHeadlessColorPicker extends MixinContr
|
|
|
409
472
|
max="100"
|
|
410
473
|
tabindex="-1"
|
|
411
474
|
aria-label=${axisName(this.brightnessLabel)}
|
|
475
|
+
aria-describedby=${this.feedback === '' ? nothing : 'feedback'}
|
|
412
476
|
aria-valuetext=${reversed}
|
|
413
477
|
aria-invalid=${this.invalid ? 'true' : nothing}
|
|
414
478
|
.value=${String(color.brightness)}
|
|
@@ -431,7 +495,9 @@ let HelixHeadlessColorPicker = class HelixHeadlessColorPicker extends MixinContr
|
|
|
431
495
|
></button>
|
|
432
496
|
<div part="channels">
|
|
433
497
|
${this.renderChannel('hue', this.hueLabel, 360, color.hue, `{value}, ${hue}`)}
|
|
434
|
-
${this.alpha
|
|
498
|
+
${this.alpha
|
|
499
|
+
? this.renderChannel('alpha', this.opacityLabel, 100, color.alpha, new Intl.NumberFormat(this.lang || undefined, { style: 'percent' }).format(color.alpha / 100))
|
|
500
|
+
: nothing}
|
|
435
501
|
</div>
|
|
436
502
|
</div>
|
|
437
503
|
${this.channelFields ? this.renderFields(color) : nothing}
|
|
@@ -447,6 +513,7 @@ let HelixHeadlessColorPicker = class HelixHeadlessColorPicker extends MixinContr
|
|
|
447
513
|
part="value"
|
|
448
514
|
type="text"
|
|
449
515
|
aria-label=${this.valueLabel}
|
|
516
|
+
aria-describedby=${this.feedback === '' ? nothing : 'feedback'}
|
|
450
517
|
aria-invalid=${this.invalid ? 'true' : nothing}
|
|
451
518
|
autocomplete=${this.autocomplete || nothing}
|
|
452
519
|
spellcheck="false"
|
|
@@ -462,22 +529,8 @@ let HelixHeadlessColorPicker = class HelixHeadlessColorPicker extends MixinContr
|
|
|
462
529
|
${this.tools ? html `${this.renderTools()}` : nothing}
|
|
463
530
|
</div>
|
|
464
531
|
|
|
465
|
-
${this.presets.length === 0
|
|
466
|
-
|
|
467
|
-
: html `<div part="swatches" role="group" aria-label=${this.presetsLabel}>
|
|
468
|
-
${this.presets.map((preset) => {
|
|
469
|
-
const parsed = parseColor(preset);
|
|
470
|
-
return html `<button
|
|
471
|
-
part="swatch"
|
|
472
|
-
type="button"
|
|
473
|
-
aria-label=${parsed ? colorName(parsed, this.colorWords, this.lang) : preset}
|
|
474
|
-
aria-pressed=${parsed !== null && toCss(parsed) === painted ? 'true' : 'false'}
|
|
475
|
-
style="--color-picker-swatch: ${preset}"
|
|
476
|
-
?disabled=${this.isDisabled}
|
|
477
|
-
@click=${() => this.handleSwatch(preset)}
|
|
478
|
-
></button>`;
|
|
479
|
-
})}
|
|
480
|
-
</div>`}`;
|
|
532
|
+
${this.presets.length === 0 ? nothing : this.renderSwatches(painted)}
|
|
533
|
+
${this.feedback === '' ? nothing : html `<p part="feedback" id="feedback">${this.feedback}</p>`}`;
|
|
481
534
|
}
|
|
482
535
|
};
|
|
483
536
|
__decorate([
|
|
@@ -499,7 +552,7 @@ __decorate([
|
|
|
499
552
|
property({ attribute: 'channel-fields', type: Boolean })
|
|
500
553
|
], HelixHeadlessColorPicker.prototype, "channelFields", void 0);
|
|
501
554
|
__decorate([
|
|
502
|
-
property({ attribute: 'color-words',
|
|
555
|
+
property({ attribute: 'color-words', converter: wordsConverter })
|
|
503
556
|
], HelixHeadlessColorPicker.prototype, "colorWords", void 0);
|
|
504
557
|
__decorate([
|
|
505
558
|
property({ attribute: 'copied-label' })
|
|
@@ -510,6 +563,9 @@ __decorate([
|
|
|
510
563
|
__decorate([
|
|
511
564
|
property({ attribute: 'eyedropper-label' })
|
|
512
565
|
], HelixHeadlessColorPicker.prototype, "eyedropperLabel", void 0);
|
|
566
|
+
__decorate([
|
|
567
|
+
property()
|
|
568
|
+
], HelixHeadlessColorPicker.prototype, "feedback", void 0);
|
|
513
569
|
__decorate([
|
|
514
570
|
property({ reflect: true })
|
|
515
571
|
], HelixHeadlessColorPicker.prototype, "format", void 0);
|
|
@@ -573,6 +629,9 @@ __decorate([
|
|
|
573
629
|
__decorate([
|
|
574
630
|
state()
|
|
575
631
|
], HelixHeadlessColorPicker.prototype, "sampling", void 0);
|
|
632
|
+
__decorate([
|
|
633
|
+
state()
|
|
634
|
+
], HelixHeadlessColorPicker.prototype, "swatchAt", void 0);
|
|
576
635
|
HelixHeadlessColorPicker = __decorate([
|
|
577
636
|
customElement('helix-headless-color-picker')
|
|
578
637
|
], HelixHeadlessColorPicker);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a key moves focus in a row of presets, or `null` for a key that moves
|
|
3
|
+
* nothing.
|
|
4
|
+
*
|
|
5
|
+
* The presets are a listbox, React Aria's ColorSwatchPicker: one tab stop, and
|
|
6
|
+
* the arrows move between the colors without choosing one. `along` is the
|
|
7
|
+
* horizontal arrow's direction along the line of text, from `inlineStep`, so
|
|
8
|
+
* the row reverses with it; Up and Down go to the previous and the next as a
|
|
9
|
+
* list does, since the row wraps. Home and End go to the ends. Focus stops at
|
|
10
|
+
* the ends; a row of colors does not wrap around.
|
|
11
|
+
*/
|
|
12
|
+
export declare const swatchMove: (key: string, along: -1 | 0 | 1, at: number, count: number) => number | null;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export const swatchMove = (key, along, at, count) => {
|
|
2
|
+
if (count === 0) {
|
|
3
|
+
return null;
|
|
4
|
+
}
|
|
5
|
+
const last = count - 1;
|
|
6
|
+
let next;
|
|
7
|
+
if (along !== 0) {
|
|
8
|
+
next = at + along;
|
|
9
|
+
}
|
|
10
|
+
else if (key === 'ArrowUp') {
|
|
11
|
+
next = at - 1;
|
|
12
|
+
}
|
|
13
|
+
else if (key === 'ArrowDown') {
|
|
14
|
+
next = at + 1;
|
|
15
|
+
}
|
|
16
|
+
else if (key === 'Home') {
|
|
17
|
+
next = 0;
|
|
18
|
+
}
|
|
19
|
+
else if (key === 'End') {
|
|
20
|
+
next = last;
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
return Math.min(last, Math.max(0, next));
|
|
26
|
+
};
|
|
@@ -43,11 +43,13 @@ declare const HelixHeadlessCombobox_base: (new (...args: any[]) => import("@fusi
|
|
|
43
43
|
* @slot - The options.
|
|
44
44
|
* @slot empty - What the list shows when typing hides every option, for content richer than `empty-text`.
|
|
45
45
|
* @slot end - After the text, for a unit or a clear button.
|
|
46
|
+
* @slot error - What the list shows while `load-error` is set, for content richer than its text.
|
|
46
47
|
* @slot feedback - The message that says what is wrong, for content richer than a string. It shows while there is a message.
|
|
47
48
|
* @slot hint - The hint, for content richer than plain text.
|
|
48
49
|
* @slot indicator - Replaces the caret that shows the field opens a list.
|
|
49
50
|
* @slot label - The label, for content richer than plain text.
|
|
50
51
|
* @slot loading - What the list shows while the options load, for content richer than `loading-text`.
|
|
52
|
+
* @slot no-results - What the list shows when typing hides every option, for content richer than `no-results-text`.
|
|
51
53
|
* @slot start - Before the text, for an icon.
|
|
52
54
|
*
|
|
53
55
|
* @event {Event} change - Fired after the value changes.
|
|
@@ -56,6 +58,7 @@ declare const HelixHeadlessCombobox_base: (new (...args: any[]) => import("@fusi
|
|
|
56
58
|
* @event {HelixBeforeOpenEvent} helix-before-open - Fired before the panel opens. Cancelable: cancel it to keep the panel closed.
|
|
57
59
|
* @event {HelixCreateEvent} helix-create - Fired when the user adds a value that is not in the list. Cancelable.
|
|
58
60
|
* @event {HelixFilterEvent} helix-filter - Fired as the user types, with the text the list is filtered by. Cancelable: cancel it to leave the list unfiltered and do the filtering yourself.
|
|
61
|
+
* @event {HelixLoadMoreEvent} helix-load-more - Fired once the list is scrolled within a screen of its end, once for each number of options, and not while `loading` is set. Add the next page and set `loading` while you fetch it.
|
|
59
62
|
* @event {Event} input - Fired after the value changes.
|
|
60
63
|
* @event {ToggleEvent} toggle - Fired when the panel opens or closes, with `newState` and `oldState`.
|
|
61
64
|
*
|
|
@@ -69,6 +72,7 @@ declare const HelixHeadlessCombobox_base: (new (...args: any[]) => import("@fusi
|
|
|
69
72
|
* @csspart label - The label above the field.
|
|
70
73
|
* @csspart listbox - The list inside the panel.
|
|
71
74
|
* @csspart listbox-empty - Shown when a filter has hidden everything.
|
|
75
|
+
* @csspart listbox-error - Shown while `load-error` is set.
|
|
72
76
|
* @csspart listbox-feedback - The inner list's error message.
|
|
73
77
|
* @csspart listbox-filter-icon - The icon beside the list's filter field.
|
|
74
78
|
* @csspart listbox-filter-mark - The glyph beside the filter field, where none is slotted.
|
|
@@ -133,10 +137,26 @@ export declare class HelixHeadlessCombobox extends HelixHeadlessCombobox_base {
|
|
|
133
137
|
* Text shown when the filter hides every option.
|
|
134
138
|
*/
|
|
135
139
|
emptyText: string;
|
|
140
|
+
/**
|
|
141
|
+
* How long typing rests before the list is narrowed and `helix-filter` is
|
|
142
|
+
* sent, in milliseconds.
|
|
143
|
+
*
|
|
144
|
+
* For options filtered on a server, where `helix-filter` starts a request: a
|
|
145
|
+
* delay sends one request for a word instead of one per letter. The arrow
|
|
146
|
+
* keys, Enter and Escape narrow at once on what was typed. `0` narrows on
|
|
147
|
+
* every keystroke. See Listbox's `filter-delay`.
|
|
148
|
+
*/
|
|
149
|
+
filterDelay: number;
|
|
136
150
|
/**
|
|
137
151
|
* The list's name, read by screen readers. The list has no visible name.
|
|
138
152
|
*/
|
|
139
153
|
listLabel: string;
|
|
154
|
+
/**
|
|
155
|
+
* What the list says when its options could not be loaded, such as after a
|
|
156
|
+
* request to a server fails. Empty is no error. Passed to the list, which
|
|
157
|
+
* shows it under any options there are and tells screen readers.
|
|
158
|
+
*/
|
|
159
|
+
loadError: string;
|
|
140
160
|
/**
|
|
141
161
|
* Whether the options are still loading.
|
|
142
162
|
*
|
|
@@ -168,6 +188,18 @@ export declare class HelixHeadlessCombobox extends HelixHeadlessCombobox_base {
|
|
|
168
188
|
* element is responsible for.
|
|
169
189
|
*/
|
|
170
190
|
multiple: boolean;
|
|
191
|
+
/**
|
|
192
|
+
* The text shown when typing hides every one of the options, where there are
|
|
193
|
+
* some. Absent, `empty-text` shows. See Listbox's `no-results-text`.
|
|
194
|
+
*/
|
|
195
|
+
noResultsText?: string;
|
|
196
|
+
/**
|
|
197
|
+
* What opens the list: `input`, typing or pressing Down; `focus`, also
|
|
198
|
+
* arriving in the field, by Tab or a press; or `manual`, only Down, Alt+Down
|
|
199
|
+
* or a press on the caret, so typing narrows a list the reader has asked
|
|
200
|
+
* for. React Aria's `menuTrigger`.
|
|
201
|
+
*/
|
|
202
|
+
openOn: 'focus' | 'input' | 'manual';
|
|
171
203
|
/**
|
|
172
204
|
* Text shown while nothing has been chosen.
|
|
173
205
|
*/
|
|
@@ -358,6 +390,17 @@ export declare class HelixHeadlessCombobox extends HelixHeadlessCombobox_base {
|
|
|
358
390
|
*/
|
|
359
391
|
private moveAroundCreate;
|
|
360
392
|
private readonly handleInput;
|
|
393
|
+
/**
|
|
394
|
+
* Arriving in the field opens the list where `open-on` is `focus`, unless
|
|
395
|
+
* this element is handing focus back to it as the list closes.
|
|
396
|
+
*/
|
|
397
|
+
private readonly handleFocus;
|
|
398
|
+
/** Whether `close` is putting focus back in the field, which opens nothing. */
|
|
399
|
+
private refocusing;
|
|
400
|
+
/** The narrowing waiting out `filterDelay`, if any. */
|
|
401
|
+
private readonly narrowing;
|
|
402
|
+
/** Narrows the list to what was typed, and finds the completion in what is left. */
|
|
403
|
+
private narrow;
|
|
361
404
|
/**
|
|
362
405
|
* The words of the first option the typing begins, or nothing.
|
|
363
406
|
*
|
|
@@ -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 { AriaForwardController, afterLinkFollowed, customElement, fillTemplate, HelixCreateEvent, HelixFilterEvent, HelixFormElement, MixinControllerOpen, MixinControllerValue, MixinField, MixinTokens, PopoverController, reportValues, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { AriaForwardController, afterLinkFollowed, customElement, DelayController, fillTemplate, HelixCreateEvent, HelixFilterEvent, HelixFormElement, MixinControllerOpen, MixinControllerValue, MixinField, MixinTokens, PopoverController, reportValues, submitImplicitly, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { caretDown } from '@fusion.dev/helix-icons';
|
|
9
9
|
import { nothing } from 'lit';
|
|
10
10
|
import { property, state } from 'lit/decorators.js';
|
|
@@ -26,10 +26,13 @@ let HelixHeadlessCombobox = class HelixHeadlessCombobox extends MixinControllerO
|
|
|
26
26
|
this.creatable = false;
|
|
27
27
|
this.createLabel = 'Add';
|
|
28
28
|
this.emptyText = 'No matches';
|
|
29
|
+
this.filterDelay = 0;
|
|
29
30
|
this.listLabel = 'Options';
|
|
31
|
+
this.loadError = '';
|
|
30
32
|
this.loading = false;
|
|
31
33
|
this.loadingText = 'Loading';
|
|
32
34
|
this.multiple = false;
|
|
35
|
+
this.openOn = 'input';
|
|
33
36
|
this.placeholder = '';
|
|
34
37
|
this.readOnly = false;
|
|
35
38
|
this.removeLabel = 'Remove {name}';
|
|
@@ -65,20 +68,37 @@ let HelixHeadlessCombobox = class HelixHeadlessCombobox extends MixinControllerO
|
|
|
65
68
|
this.editing = true;
|
|
66
69
|
this.onCreate = false;
|
|
67
70
|
this.emptied = typed.trim() === '';
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
71
|
+
const inserted = isInsertion(event);
|
|
72
|
+
this.narrowing.cancel();
|
|
73
|
+
if (this.filterDelay > 0) {
|
|
74
|
+
this.suggestion = '';
|
|
75
|
+
this.narrowing.start(this.filterDelay, () => this.narrow(typed, inserted));
|
|
72
76
|
}
|
|
73
|
-
|
|
74
|
-
|
|
77
|
+
else {
|
|
78
|
+
this.narrow(typed, inserted);
|
|
79
|
+
}
|
|
80
|
+
if (!this.open && this.openOn !== 'manual') {
|
|
75
81
|
this.requestOpen(true);
|
|
76
82
|
}
|
|
77
83
|
};
|
|
84
|
+
this.handleFocus = () => {
|
|
85
|
+
if (this.openOn !== 'focus' || this.open || this.refocusing) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (this.isDisabled || this.readOnly) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
this.requestOpen(true);
|
|
92
|
+
};
|
|
93
|
+
this.refocusing = false;
|
|
94
|
+
this.narrowing = new DelayController(this, { renders: false });
|
|
78
95
|
this.handleKeydown = (event) => {
|
|
79
96
|
if (this.isDisabled) {
|
|
80
97
|
return;
|
|
81
98
|
}
|
|
99
|
+
if (['ArrowDown', 'ArrowUp', 'Enter', 'Escape', 'PageDown', 'PageUp'].includes(event.key)) {
|
|
100
|
+
this.narrowing.flush();
|
|
101
|
+
}
|
|
82
102
|
if (event.key === 'Escape') {
|
|
83
103
|
this.emptied = false;
|
|
84
104
|
if (this.open) {
|
|
@@ -98,6 +118,13 @@ let HelixHeadlessCombobox = class HelixHeadlessCombobox extends MixinControllerO
|
|
|
98
118
|
if (this.open) {
|
|
99
119
|
this.requestOpen(false);
|
|
100
120
|
}
|
|
121
|
+
else if (this.openOn === 'manual' && this.editing) {
|
|
122
|
+
this.typed = '';
|
|
123
|
+
this.suggestion = '';
|
|
124
|
+
this.editing = false;
|
|
125
|
+
this.listbox?.requestFilter('');
|
|
126
|
+
this.requestUpdate();
|
|
127
|
+
}
|
|
101
128
|
return;
|
|
102
129
|
}
|
|
103
130
|
if (this.multiple && this.tokenKeydown(event, this.typed)) {
|
|
@@ -136,7 +163,7 @@ let HelixHeadlessCombobox = class HelixHeadlessCombobox extends MixinControllerO
|
|
|
136
163
|
};
|
|
137
164
|
this.handleKeypress = (event) => {
|
|
138
165
|
if (event.key === 'Enter' && !this.open && !event.defaultPrevented) {
|
|
139
|
-
this.
|
|
166
|
+
submitImplicitly(this.form);
|
|
140
167
|
}
|
|
141
168
|
};
|
|
142
169
|
this.handleChange = (event) => {
|
|
@@ -160,8 +187,11 @@ let HelixHeadlessCombobox = class HelixHeadlessCombobox extends MixinControllerO
|
|
|
160
187
|
if (event.composedPath().some((node) => node instanceof HelixHeadlessTag)) {
|
|
161
188
|
return;
|
|
162
189
|
}
|
|
190
|
+
const onText = event.composedPath().includes(this.partNamed('control'));
|
|
191
|
+
this.refocusing = true;
|
|
163
192
|
this.partNamed('control')?.focus();
|
|
164
|
-
|
|
193
|
+
this.refocusing = false;
|
|
194
|
+
if (!this.open && !(this.openOn === 'manual' && onText)) {
|
|
165
195
|
this.requestOpen(true);
|
|
166
196
|
}
|
|
167
197
|
};
|
|
@@ -261,7 +291,9 @@ let HelixHeadlessCombobox = class HelixHeadlessCombobox extends MixinControllerO
|
|
|
261
291
|
return;
|
|
262
292
|
}
|
|
263
293
|
this.requestOpen(false);
|
|
294
|
+
this.refocusing = true;
|
|
264
295
|
this.partNamed('control')?.focus();
|
|
296
|
+
this.refocusing = false;
|
|
265
297
|
}
|
|
266
298
|
commitEmptied() {
|
|
267
299
|
if (this.emptied && !this.multiple && this.value !== '') {
|
|
@@ -316,6 +348,15 @@ let HelixHeadlessCombobox = class HelixHeadlessCombobox extends MixinControllerO
|
|
|
316
348
|
}
|
|
317
349
|
return false;
|
|
318
350
|
}
|
|
351
|
+
narrow(typed, inserted) {
|
|
352
|
+
this.narrowing.cancel();
|
|
353
|
+
const narrowing = new HelixFilterEvent({ value: typed });
|
|
354
|
+
if (this.dispatchEvent(narrowing)) {
|
|
355
|
+
this.listbox?.requestFilter(typed);
|
|
356
|
+
void this.listbox?.updateComplete.then(() => this.linkActive());
|
|
357
|
+
}
|
|
358
|
+
this.suggestion = this.suggest && inserted ? this.completionFor(typed) : '';
|
|
359
|
+
}
|
|
319
360
|
completionFor(typed) {
|
|
320
361
|
if (typed === '') {
|
|
321
362
|
return '';
|
|
@@ -401,7 +442,7 @@ let HelixHeadlessCombobox = class HelixHeadlessCombobox extends MixinControllerO
|
|
|
401
442
|
if (control && this.suggestion !== '') {
|
|
402
443
|
control.setSelectionRange(this.typed.length, this.suggestion.length);
|
|
403
444
|
}
|
|
404
|
-
if (!this.open) {
|
|
445
|
+
if (!this.open && (this.openOn !== 'manual' || changed.has('open'))) {
|
|
405
446
|
this.typed = '';
|
|
406
447
|
this.suggestion = '';
|
|
407
448
|
this.editing = false;
|
|
@@ -420,7 +461,7 @@ let HelixHeadlessCombobox = class HelixHeadlessCombobox extends MixinControllerO
|
|
|
420
461
|
}
|
|
421
462
|
}
|
|
422
463
|
get fieldText() {
|
|
423
|
-
if (this.multiple || (this.open && this.editing)) {
|
|
464
|
+
if (this.multiple || ((this.open || this.openOn === 'manual') && this.editing)) {
|
|
424
465
|
return this.suggestion || this.typed;
|
|
425
466
|
}
|
|
426
467
|
return this.word;
|
|
@@ -429,13 +470,15 @@ let HelixHeadlessCombobox = class HelixHeadlessCombobox extends MixinControllerO
|
|
|
429
470
|
return html `<${this.tag('listbox')}
|
|
430
471
|
part="listbox"
|
|
431
472
|
id="listbox"
|
|
432
|
-
exportparts="empty: listbox-empty,
|
|
433
|
-
filter-
|
|
434
|
-
label: listbox-label, live: listbox-live, loading: listbox-loading,
|
|
435
|
-
search-field: listbox-search-field"
|
|
473
|
+
exportparts="empty: listbox-empty, error: listbox-error, feedback: listbox-feedback,
|
|
474
|
+
filter-icon: listbox-filter-icon, filter-mark: listbox-filter-mark, hint: listbox-hint,
|
|
475
|
+
items: listbox-items, label: listbox-label, live: listbox-live, loading: listbox-loading,
|
|
476
|
+
search: listbox-search, search-field: listbox-search-field"
|
|
436
477
|
aria-label=${this.listLabel}
|
|
437
478
|
empty-text=${this.emptyText}
|
|
479
|
+
load-error=${this.loadError}
|
|
438
480
|
loading-text=${this.loadingText}
|
|
481
|
+
no-results-text=${this.noResultsText ?? nothing}
|
|
439
482
|
result-label=${this.resultLabel}
|
|
440
483
|
results-label=${this.resultsLabel}
|
|
441
484
|
?loading=${this.loading}
|
|
@@ -457,6 +500,14 @@ let HelixHeadlessCombobox = class HelixHeadlessCombobox extends MixinControllerO
|
|
|
457
500
|
fills it, so the list's fallback would never show. -->
|
|
458
501
|
<slot name="empty" slot="empty">${this.emptyText}</slot>
|
|
459
502
|
<slot name="loading" slot="loading">${this.loadingText}</slot>
|
|
503
|
+
<slot name="error" slot="error">${this.loadError}</slot>
|
|
504
|
+
<!-- Handed on only while something fills it: an assigned slot hides the
|
|
505
|
+
list's own fallback, which is no-results-text or empty-text. -->
|
|
506
|
+
<slot
|
|
507
|
+
name="no-results"
|
|
508
|
+
slot=${this.querySelector?.(':scope > [slot="no-results"]') ? 'no-results' : nothing}
|
|
509
|
+
@slotchange=${() => this.requestUpdate()}
|
|
510
|
+
></slot>
|
|
460
511
|
</${this.tag('listbox')}>`;
|
|
461
512
|
}
|
|
462
513
|
renderTag(option) {
|
|
@@ -512,6 +563,7 @@ let HelixHeadlessCombobox = class HelixHeadlessCombobox extends MixinControllerO
|
|
|
512
563
|
?disabled=${this.isDisabled}
|
|
513
564
|
?readonly=${this.readOnly}
|
|
514
565
|
.value=${this.fieldText}
|
|
566
|
+
@focus=${this.handleFocus}
|
|
515
567
|
@input=${this.handleInput}
|
|
516
568
|
@keydown=${this.handleKeydown}
|
|
517
569
|
@keypress=${this.handleKeypress}
|
|
@@ -541,9 +593,15 @@ __decorate([
|
|
|
541
593
|
__decorate([
|
|
542
594
|
property({ attribute: 'empty-text' })
|
|
543
595
|
], HelixHeadlessCombobox.prototype, "emptyText", void 0);
|
|
596
|
+
__decorate([
|
|
597
|
+
property({ attribute: 'filter-delay', type: Number })
|
|
598
|
+
], HelixHeadlessCombobox.prototype, "filterDelay", void 0);
|
|
544
599
|
__decorate([
|
|
545
600
|
property({ attribute: 'list-label' })
|
|
546
601
|
], HelixHeadlessCombobox.prototype, "listLabel", void 0);
|
|
602
|
+
__decorate([
|
|
603
|
+
property({ attribute: 'load-error' })
|
|
604
|
+
], HelixHeadlessCombobox.prototype, "loadError", void 0);
|
|
547
605
|
__decorate([
|
|
548
606
|
property({ reflect: true, type: Boolean })
|
|
549
607
|
], HelixHeadlessCombobox.prototype, "loading", void 0);
|
|
@@ -553,6 +611,12 @@ __decorate([
|
|
|
553
611
|
__decorate([
|
|
554
612
|
property({ type: Boolean })
|
|
555
613
|
], HelixHeadlessCombobox.prototype, "multiple", void 0);
|
|
614
|
+
__decorate([
|
|
615
|
+
property({ attribute: 'no-results-text' })
|
|
616
|
+
], HelixHeadlessCombobox.prototype, "noResultsText", void 0);
|
|
617
|
+
__decorate([
|
|
618
|
+
property({ attribute: 'open-on' })
|
|
619
|
+
], HelixHeadlessCombobox.prototype, "openOn", void 0);
|
|
556
620
|
__decorate([
|
|
557
621
|
property()
|
|
558
622
|
], HelixHeadlessCombobox.prototype, "placeholder", void 0);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HelixElement } from '@fusion.dev/helix-core';
|
|
2
|
-
import type
|
|
2
|
+
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
3
3
|
import '../../dialog/index.js';
|
|
4
4
|
import '../../listbox/index.js';
|
|
5
5
|
declare const HelixHeadlessCommand_base: (new (...args: any[]) => import("@fusion.dev/helix-core").MixinControllerOpenInterface) & typeof HelixElement;
|
|
@@ -34,12 +34,15 @@ declare const HelixHeadlessCommand_base: (new (...args: any[]) => import("@fusio
|
|
|
34
34
|
*
|
|
35
35
|
* @slot - The commands, and any groups of them.
|
|
36
36
|
* @slot empty - What the palette shows when typing matches no commands, for content richer than `empty-text`.
|
|
37
|
+
* @slot error - What the palette shows while `load-error` is set, for content richer than its text.
|
|
37
38
|
* @slot footer - Content under the list, such as the keys that work in the palette.
|
|
38
39
|
* @slot loading - What the palette shows while the commands load, for content richer than `loading-text`.
|
|
40
|
+
* @slot no-results - What the palette shows when typing matches no commands, for content richer than `no-results-text`.
|
|
39
41
|
*
|
|
40
42
|
* @event {HelixBeforeCloseEvent} helix-before-close - The palette is about to close. Cancelable: cancel it to keep it open.
|
|
41
43
|
* @event {HelixBeforeOpenEvent} helix-before-open - The palette is about to open. Cancelable: cancel it to keep it closed.
|
|
42
44
|
* @event {HelixFilterEvent} helix-filter - Fired as the user types, with the text the list is filtered by. Cancelable: cancel it to leave the list unfiltered and filter the commands yourself, for example on a server while `loading` is set.
|
|
45
|
+
* @event {HelixLoadMoreEvent} helix-load-more - Fired once the list is scrolled within a screen of its end, once for each number of commands, and not while `loading` is set. Add the next page and set `loading` while you fetch it.
|
|
43
46
|
* @event {HelixSelectEvent} helix-select - A command was chosen, with its `href` where the option is a link. Cancelable: cancel it to keep the palette open, and to keep the browser from following the link.
|
|
44
47
|
* @event {ToggleEvent} toggle - The palette opened or closed. The event carries `newState` and `oldState`.
|
|
45
48
|
*
|
|
@@ -52,6 +55,7 @@ declare const HelixHeadlessCommand_base: (new (...args: any[]) => import("@fusio
|
|
|
52
55
|
* @csspart footer - The row under the list.
|
|
53
56
|
* @csspart listbox - The listbox inside the palette.
|
|
54
57
|
* @csspart listbox-empty - The text shown when the filter matches no commands.
|
|
58
|
+
* @csspart listbox-error - The text shown while `load-error` is set.
|
|
55
59
|
* @csspart listbox-feedback - The listbox's error message.
|
|
56
60
|
* @csspart listbox-filter-icon - The icon beside the filter field.
|
|
57
61
|
* @csspart listbox-filter-mark - The default icon beside the filter field, drawn when no icon is slotted.
|
|
@@ -88,6 +92,12 @@ export declare class HelixHeadlessCommand extends HelixHeadlessCommand_base {
|
|
|
88
92
|
* Accessible name for the overlay, which has no visible heading.
|
|
89
93
|
*/
|
|
90
94
|
label: string;
|
|
95
|
+
/**
|
|
96
|
+
* What the list says when its commands could not be loaded, such as after a
|
|
97
|
+
* request to a server fails. Empty is no error. Passed to the list, which
|
|
98
|
+
* shows it under any commands there are and tells screen readers.
|
|
99
|
+
*/
|
|
100
|
+
loadError: string;
|
|
91
101
|
/**
|
|
92
102
|
* Whether the commands are still loading, for a palette that asks a server
|
|
93
103
|
* for them as the user types.
|
|
@@ -99,6 +109,11 @@ export declare class HelixHeadlessCommand extends HelixHeadlessCommand_base {
|
|
|
99
109
|
* The text shown while the commands load.
|
|
100
110
|
*/
|
|
101
111
|
loadingText: string;
|
|
112
|
+
/**
|
|
113
|
+
* The text shown when typing hides every one of the commands, where there are
|
|
114
|
+
* some. Absent, `empty-text` shows. See Listbox's `no-results-text`.
|
|
115
|
+
*/
|
|
116
|
+
noResultsText?: string;
|
|
102
117
|
/**
|
|
103
118
|
* The text shown in the filter field before anything is typed.
|
|
104
119
|
*/
|