@fusion.dev/helix-headless 0.143.0 → 0.145.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 +16990 -1383
- package/dist/accordion/item/accordion-item.d.ts +48 -12
- package/dist/accordion/item/accordion-item.js +26 -5
- package/dist/accordion/root/accordion-root.d.ts +6 -0
- package/dist/accordion/root/accordion-root.js +7 -1
- package/dist/announcement/root/announcement-root.d.ts +21 -1
- package/dist/announcement/root/announcement-root.js +36 -1
- package/dist/app-header/root/app-header-root.d.ts +7 -0
- package/dist/app-header/root/app-header-root.js +5 -1
- package/dist/app-header/sectioning.d.ts +7 -0
- package/dist/app-header/sectioning.js +26 -0
- package/dist/area-chart/root/area-chart-root.d.ts +12 -4
- package/dist/area-chart/root/area-chart-root.js +24 -7
- package/dist/avatar/root/avatar-root.d.ts +14 -0
- package/dist/avatar/root/avatar-root.js +23 -9
- package/dist/badge/root/badge-root.d.ts +11 -7
- package/dist/badge/root/badge-root.js +1 -1
- package/dist/bar-chart/root/bar-chart-root.d.ts +12 -3
- package/dist/bar-chart/root/bar-chart-root.js +17 -10
- package/dist/breadcrumbs/root/breadcrumbs-root.d.ts +32 -1
- package/dist/breadcrumbs/root/breadcrumbs-root.js +25 -2
- package/dist/button/root/button-root.d.ts +47 -1
- package/dist/button/root/button-root.js +38 -4
- package/dist/callout/root/callout-root.d.ts +18 -1
- package/dist/callout/root/callout-root.js +15 -4
- package/dist/canvas/root/canvas-root.d.ts +38 -3
- package/dist/canvas/root/canvas-root.js +121 -40
- package/dist/card/root/card-root.d.ts +30 -1
- package/dist/card/root/card-root.js +38 -5
- package/dist/carousel/root/carousel-root.d.ts +90 -0
- package/dist/carousel/root/carousel-root.js +134 -12
- 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 +25 -9
- package/dist/chat/naming.d.ts +22 -0
- package/dist/chat/naming.js +12 -0
- package/dist/chat/relative-clock.d.ts +39 -0
- package/dist/chat/relative-clock.js +31 -0
- package/dist/chat/root/chat-root.d.ts +36 -0
- package/dist/chat/root/chat-root.js +24 -1
- package/dist/checkbox/root/checkbox-root.js +2 -0
- package/dist/checkbox-group/root/checkbox-group-root.d.ts +53 -3
- package/dist/checkbox-group/root/checkbox-group-root.js +71 -22
- package/dist/code-block/lines.d.ts +13 -0
- package/dist/code-block/lines.js +2 -0
- package/dist/code-block/root/code-block-root.d.ts +38 -1
- package/dist/code-block/root/code-block-root.js +28 -7
- package/dist/color-input/root/color-input-root.d.ts +34 -1
- package/dist/color-input/root/color-input-root.js +23 -4
- package/dist/color-picker/channels.d.ts +26 -0
- package/dist/color-picker/channels.js +84 -0
- package/dist/color-picker/root/color-picker-root.d.ts +81 -5
- package/dist/color-picker/root/color-picker-root.js +103 -10
- package/dist/combobox/root/combobox-root.d.ts +38 -3
- package/dist/combobox/root/combobox-root.js +64 -2
- package/dist/command/root/command-root.d.ts +30 -4
- package/dist/command/root/command-root.js +33 -3
- package/dist/copy-button/from.d.ts +22 -0
- package/dist/copy-button/from.js +28 -0
- package/dist/copy-button/root/copy-button-root.d.ts +47 -1
- package/dist/copy-button/root/copy-button-root.js +44 -8
- package/dist/data-table/root/data-table-root.d.ts +150 -2
- package/dist/data-table/root/data-table-root.js +303 -29
- package/dist/data-table/tree.d.ts +40 -0
- package/dist/data-table/tree.js +55 -0
- package/dist/date-input/root/date-input-root.d.ts +73 -4
- package/dist/date-input/root/date-input-root.js +93 -43
- package/dist/date-picker/root/date-picker-root.d.ts +145 -1
- package/dist/date-picker/root/date-picker-root.js +239 -48
- 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.d.ts +9 -0
- package/dist/dialog/description.js +14 -0
- package/dist/dialog/root/dialog-root.d.ts +64 -1
- package/dist/dialog/root/dialog-root.js +49 -23
- package/dist/donut-chart/root/donut-chart-root.d.ts +25 -4
- package/dist/donut-chart/root/donut-chart-root.js +21 -6
- package/dist/drawer/root/drawer-root.d.ts +63 -2
- package/dist/drawer/root/drawer-root.js +95 -19
- package/dist/drawer/swipe-start.d.ts +9 -0
- package/dist/drawer/swipe-start.js +12 -0
- 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 +11 -0
- package/dist/drilldown/root/drilldown-root.js +8 -3
- package/dist/element-events.generated.js +61 -13
- package/dist/empty/root/empty-root.d.ts +1 -1
- package/dist/file-input/root/file-input-root.d.ts +47 -0
- package/dist/file-input/root/file-input-root.js +60 -22
- package/dist/file-input/screen.d.ts +35 -0
- package/dist/file-input/screen.js +49 -0
- package/dist/filter-input/menu/filter-menu.d.ts +3 -0
- package/dist/filter-input/menu/filter-menu.js +8 -4
- package/dist/filter-input/root/filter-input-root.d.ts +38 -4
- package/dist/filter-input/root/filter-input-root.js +67 -3
- package/dist/filter-input/suggest.d.ts +17 -0
- package/dist/filter-input/suggest.js +23 -0
- package/dist/format-date/options.d.ts +33 -0
- package/dist/format-date/options.js +42 -0
- package/dist/format-date/root/format-date-root.d.ts +51 -0
- package/dist/format-date/root/format-date-root.js +58 -38
- package/dist/heatmap/root/heatmap-root.d.ts +23 -6
- package/dist/heatmap/root/heatmap-root.js +24 -13
- package/dist/icon/index.d.ts +2 -0
- package/dist/icon/index.js +2 -0
- package/dist/icon/registry.d.ts +37 -0
- package/dist/icon/registry.js +83 -0
- package/dist/icon/root/icon-root.d.ts +30 -4
- package/dist/icon/root/icon-root.js +41 -6
- package/dist/icon/root/index.d.ts +2 -0
- package/dist/icon/root/index.js +2 -0
- package/dist/icon/set.d.ts +1 -0
- package/dist/icon/set.js +3 -0
- package/dist/image/root/image-root.d.ts +14 -0
- package/dist/image/root/image-root.js +23 -2
- package/dist/input/root/input-root.d.ts +11 -0
- package/dist/input/root/input-root.js +16 -1
- package/dist/kbd/root/kbd-root.d.ts +20 -13
- package/dist/kbd/root/kbd-root.js +35 -37
- package/dist/kbd/shortcut.d.ts +18 -0
- package/dist/kbd/shortcut.js +35 -0
- package/dist/legend/hidden-series.d.ts +8 -0
- package/dist/legend/hidden-series.js +13 -0
- package/dist/legend/root/legend-root.d.ts +56 -0
- package/dist/legend/root/legend-root.js +54 -5
- package/dist/lightbox/item/lightbox-item.d.ts +15 -0
- package/dist/lightbox/item/lightbox-item.js +10 -1
- package/dist/lightbox/root/lightbox-root.d.ts +61 -1
- package/dist/lightbox/root/lightbox-root.js +94 -4
- package/dist/line-chart/root/line-chart-root.d.ts +11 -3
- package/dist/line-chart/root/line-chart-root.js +19 -5
- package/dist/list/item/list-item.d.ts +68 -1
- package/dist/list/item/list-item.js +66 -4
- package/dist/list/numbering.d.ts +14 -0
- package/dist/list/numbering.js +8 -0
- package/dist/list/root/list-root.d.ts +106 -9
- package/dist/list/root/list-root.js +189 -4
- package/dist/list/selection.d.ts +19 -0
- package/dist/list/selection.js +21 -0
- package/dist/listbox/root/listbox-root.d.ts +74 -3
- package/dist/listbox/root/listbox-root.js +86 -9
- package/dist/loader/busy.d.ts +17 -0
- package/dist/loader/busy.js +24 -0
- package/dist/loader/root/loader-root.d.ts +37 -0
- package/dist/loader/root/loader-root.js +52 -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 +21 -0
- package/dist/megamenu/root/megamenu-root.js +16 -2
- package/dist/menu/index.d.ts +1 -0
- package/dist/menu/index.js +1 -0
- package/dist/menu/item/menu-item.d.ts +38 -11
- package/dist/menu/item/menu-item.js +33 -1
- package/dist/menu/root/menu-root.d.ts +25 -1
- package/dist/menu/root/menu-root.js +63 -6
- 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 +7 -0
- package/dist/meter/root/meter-root.js +6 -3
- package/dist/navigation/root/navigation-root.d.ts +16 -1
- package/dist/navigation/root/navigation-root.js +27 -1
- package/dist/notifications/feed-keys.d.ts +10 -0
- package/dist/notifications/feed-keys.js +14 -0
- package/dist/notifications/notification/notification.d.ts +17 -0
- package/dist/notifications/notification/notification.js +21 -2
- package/dist/notifications/root/notifications-root.d.ts +60 -0
- package/dist/notifications/root/notifications-root.js +76 -1
- package/dist/number-input/root/number-input-root.d.ts +47 -0
- package/dist/number-input/root/number-input-root.js +58 -22
- package/dist/object-inspector/root/object-inspector-root.d.ts +98 -16
- package/dist/object-inspector/root/object-inspector-root.js +180 -80
- package/dist/object-inspector/rows.d.ts +57 -0
- package/dist/object-inspector/rows.js +86 -0
- package/dist/option/root/option-root.d.ts +54 -5
- package/dist/option/root/option-root.js +34 -5
- package/dist/outline/levels.d.ts +31 -0
- package/dist/outline/levels.js +23 -0
- package/dist/outline/root/outline-root.d.ts +68 -3
- package/dist/outline/root/outline-root.js +73 -8
- package/dist/pagination/size/pagination-size.d.ts +11 -2
- package/dist/pagination/size/pagination-size.js +19 -4
- package/dist/pin-input/format.d.ts +7 -0
- package/dist/pin-input/format.js +16 -0
- package/dist/pin-input/root/pin-input-root.d.ts +21 -0
- package/dist/pin-input/root/pin-input-root.js +29 -2
- package/dist/popover/root/popover-root.d.ts +62 -4
- package/dist/popover/root/popover-root.js +53 -5
- package/dist/progress/root/progress-root.d.ts +7 -0
- package/dist/progress/root/progress-root.js +9 -3
- package/dist/qr-code/export.d.ts +31 -0
- package/dist/qr-code/export.js +10 -0
- package/dist/qr-code/root/qr-code-root.d.ts +26 -0
- package/dist/qr-code/root/qr-code-root.js +49 -2
- package/dist/radio/group/radio-group.d.ts +17 -0
- package/dist/radio/group/radio-group.js +14 -1
- package/dist/rating/root/rating-root.d.ts +25 -0
- package/dist/rating/root/rating-root.js +46 -4
- package/dist/scatter-chart/root/scatter-chart-root.d.ts +17 -3
- package/dist/scatter-chart/root/scatter-chart-root.js +25 -7
- package/dist/scroll-area/root/scroll-area-root.d.ts +113 -0
- package/dist/scroll-area/root/scroll-area-root.js +218 -3
- package/dist/scroll-area/scrollbar.d.ts +65 -0
- package/dist/scroll-area/scrollbar.js +24 -0
- package/dist/select/root/select-root.d.ts +24 -0
- package/dist/select/root/select-root.js +21 -7
- package/dist/skeleton/root/skeleton-root.d.ts +25 -0
- package/dist/skeleton/root/skeleton-root.js +17 -2
- package/dist/slider/root/slider-root.d.ts +39 -0
- package/dist/slider/root/slider-root.js +45 -9
- package/dist/splitter/root/splitter-root.d.ts +13 -0
- package/dist/splitter/root/splitter-root.js +20 -2
- package/dist/splitter/snap.d.ts +9 -0
- package/dist/splitter/snap.js +12 -0
- package/dist/stat/root/stat-root.d.ts +2 -0
- package/dist/stat/root/stat-root.js +1 -1
- package/dist/steps/reach.d.ts +15 -0
- package/dist/steps/reach.js +12 -0
- package/dist/steps/root/steps-root.d.ts +30 -0
- package/dist/steps/root/steps-root.js +53 -0
- package/dist/steps/step/step.d.ts +39 -2
- package/dist/steps/step/step.js +29 -7
- package/dist/switch/root/switch-root.d.ts +12 -2
- package/dist/switch/root/switch-root.js +6 -1
- package/dist/table/column/table-column.d.ts +11 -0
- package/dist/table/column/table-column.js +6 -1
- package/dist/table/root/table-root.d.ts +101 -0
- package/dist/table/root/table-root.js +166 -5
- 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 +9 -5
- package/dist/tabs/panel/tab-panel.js +3 -4
- package/dist/tabs/root/tabs-root.d.ts +25 -1
- package/dist/tabs/root/tabs-root.js +21 -3
- package/dist/tabs/tab/tab.d.ts +36 -4
- package/dist/tabs/tab/tab.js +46 -3
- package/dist/tag/group/tag-group.d.ts +107 -0
- package/dist/tag/group/tag-group.js +157 -0
- package/dist/tag/index.d.ts +1 -0
- package/dist/tag/index.js +1 -0
- package/dist/tag/root/tag-root.d.ts +60 -0
- package/dist/tag/root/tag-root.js +74 -18
- package/dist/tag/selection.d.ts +10 -0
- package/dist/tag/selection.js +12 -0
- package/dist/textarea/grow.d.ts +22 -0
- package/dist/textarea/grow.js +20 -0
- package/dist/textarea/root/textarea-root.d.ts +9 -0
- package/dist/textarea/root/textarea-root.js +9 -1
- package/dist/time-input/root/time-input-root.d.ts +44 -5
- package/dist/time-input/root/time-input-root.js +69 -39
- package/dist/time-picker/root/time-picker-root.d.ts +54 -8
- package/dist/time-picker/root/time-picker-root.js +121 -91
- 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/hotkey.d.ts +22 -0
- package/dist/toast/hotkey.js +23 -0
- package/dist/toast/item/toast-item.d.ts +26 -18
- package/dist/toast/item/toast-item.js +55 -48
- package/dist/toast/root/toast-root.d.ts +42 -8
- package/dist/toast/root/toast-root.js +64 -4
- package/dist/toggle/group/toggle-group.d.ts +57 -15
- package/dist/toggle/group/toggle-group.js +69 -9
- package/dist/toggle/root/toggle-root.d.ts +12 -1
- package/dist/toggle/root/toggle-root.js +11 -3
- package/dist/toolbar/root/toolbar-root.d.ts +13 -0
- package/dist/toolbar/root/toolbar-root.js +15 -5
- package/dist/tooltip/focus-target.d.ts +6 -0
- package/dist/tooltip/focus-target.js +9 -0
- package/dist/tooltip/root/tooltip-root.d.ts +42 -17
- package/dist/tooltip/root/tooltip-root.js +50 -9
- package/dist/tour/naming.d.ts +30 -0
- package/dist/tour/naming.js +10 -0
- package/dist/tour/root/tour-root.d.ts +35 -0
- package/dist/tour/root/tour-root.js +56 -5
- package/dist/tour/stop/tour-stop.d.ts +53 -8
- package/dist/tour/stop/tour-stop.js +45 -15
- package/dist/tour/wait.d.ts +11 -0
- package/dist/tour/wait.js +19 -0
- package/dist/tree/item/tree-item.d.ts +54 -1
- package/dist/tree/item/tree-item.js +89 -20
- package/dist/tree/root/tree-root.d.ts +37 -0
- package/dist/tree/root/tree-root.js +51 -6
- package/dist/tree/selection.d.ts +24 -0
- package/dist/tree/selection.js +26 -0
- package/dist/trend/root/trend-root.d.ts +13 -0
- package/dist/trend/root/trend-root.js +14 -9
- package/dist/video/media-events.d.ts +49 -0
- package/dist/video/media-events.js +39 -0
- package/dist/video/root/video-root.d.ts +99 -13
- package/dist/video/root/video-root.js +84 -47
- package/dist/video-playlist/menu/video-playlist-menu.d.ts +3 -0
- package/dist/video-playlist/menu/video-playlist-menu.js +2 -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 +70 -2
- 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 +30 -0
- package/dist/virtual-list/fill.js +39 -0
- package/dist/virtual-list/keys.d.ts +15 -0
- package/dist/virtual-list/keys.js +24 -0
- package/dist/virtual-list/root/virtual-list-root.d.ts +155 -23
- package/dist/virtual-list/root/virtual-list-root.js +175 -34
- package/lint.json +1 -1
- package/package.json +5 -5
- package/types/jsx.d.ts +8871 -1286
- package/types/svelte.d.ts +3 -0
- package/types/vue.d.ts +1918 -269
|
@@ -4,11 +4,13 @@ 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, customElement, drawIcon, fillTemplate, formatColor, HelixFormElement, HelixSampleEndEvent, HelixSampleStartEvent, hostAria, isRtl, MixinControllerValue, parseColor, splitValues, toCss, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { CopyController, capturePointer, colorName, customElement, drawIcon, fillTemplate, formatColor, HelixFormElement, HelixSampleEndEvent, HelixSampleStartEvent, hostAria, hueName, isRtl, MixinControllerValue, parseColor, splitValues, toCss, } 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
|
+
import { live } from 'lit/directives/live.js';
|
|
11
12
|
import { html } from 'lit/static-html.js';
|
|
13
|
+
import { channelFields, writeChannel } from '../channels.js';
|
|
12
14
|
import '../../button/index.js';
|
|
13
15
|
import '../../button-group/index.js';
|
|
14
16
|
import '../../slider/index.js';
|
|
@@ -19,19 +21,25 @@ let HelixHeadlessColorPicker = class HelixHeadlessColorPicker extends MixinContr
|
|
|
19
21
|
super(...arguments);
|
|
20
22
|
this.alpha = false;
|
|
21
23
|
this.autocomplete = 'off';
|
|
24
|
+
this.blueLabel = 'Blue';
|
|
22
25
|
this.brightnessLabel = 'Brightness';
|
|
26
|
+
this.channelFields = false;
|
|
27
|
+
this.colorWords = {};
|
|
23
28
|
this.copiedLabel = 'Copied';
|
|
24
29
|
this.copyLabel = 'Copy {value}';
|
|
25
30
|
this.eyedropperLabel = 'Sample a color from the screen';
|
|
26
31
|
this.formatLabel = 'Syntax: {format}. Change it.';
|
|
32
|
+
this.greenLabel = 'Green';
|
|
27
33
|
this.hueLabel = 'Hue';
|
|
28
34
|
this.invalid = false;
|
|
35
|
+
this.lightnessLabel = 'Lightness';
|
|
29
36
|
this.noEyedropper = false;
|
|
30
37
|
this.noFormat = false;
|
|
31
38
|
this.noValue = false;
|
|
32
39
|
this.opacityLabel = 'Opacity';
|
|
33
40
|
this.presetsLabel = 'Presets';
|
|
34
41
|
this.readOnly = false;
|
|
42
|
+
this.redLabel = 'Red';
|
|
35
43
|
this.required = false;
|
|
36
44
|
this.saturationLabel = 'Saturation';
|
|
37
45
|
this.swatches = '';
|
|
@@ -156,6 +164,18 @@ let HelixHeadlessColorPicker = class HelixHeadlessColorPicker extends MixinContr
|
|
|
156
164
|
this.move(next);
|
|
157
165
|
this.settle();
|
|
158
166
|
};
|
|
167
|
+
this.handleField = (channel, event) => {
|
|
168
|
+
event.stopPropagation();
|
|
169
|
+
const typed = event.target.value;
|
|
170
|
+
if (typed.trim() === '') {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
const format = this.format ?? 'hex';
|
|
174
|
+
const written = writeChannel(channelFields(this.value, this.color, format, this.alpha), format, this.alpha, channel, Number(typed));
|
|
175
|
+
if (written !== null) {
|
|
176
|
+
this.takeWritten(written);
|
|
177
|
+
}
|
|
178
|
+
};
|
|
159
179
|
this.keepChannelRequest = (event) => {
|
|
160
180
|
event.stopPropagation();
|
|
161
181
|
};
|
|
@@ -223,7 +243,56 @@ let HelixHeadlessColorPicker = class HelixHeadlessColorPicker extends MixinContr
|
|
|
223
243
|
focus(options) {
|
|
224
244
|
this.partNamed('grid-saturation')?.focus(options);
|
|
225
245
|
}
|
|
226
|
-
|
|
246
|
+
channelWord(channel) {
|
|
247
|
+
return {
|
|
248
|
+
alpha: this.opacityLabel,
|
|
249
|
+
blue: this.blueLabel,
|
|
250
|
+
green: this.greenLabel,
|
|
251
|
+
hue: this.hueLabel,
|
|
252
|
+
lightness: this.lightnessLabel,
|
|
253
|
+
red: this.redLabel,
|
|
254
|
+
saturation: this.saturationLabel,
|
|
255
|
+
}[channel];
|
|
256
|
+
}
|
|
257
|
+
takeWritten(next) {
|
|
258
|
+
const parsed = parseColor(next);
|
|
259
|
+
if (this.readOnly || parsed === null) {
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
const before = this.moved;
|
|
263
|
+
const hueless = parsed.saturation === 0 || parsed.brightness === 0;
|
|
264
|
+
this.moved = hueless ? { ...parsed, hue: this.color.hue } : parsed;
|
|
265
|
+
this.owned = next !== this.value;
|
|
266
|
+
if (!this.requestValue(next)) {
|
|
267
|
+
this.moved = before;
|
|
268
|
+
this.owned = false;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
renderFields(color) {
|
|
272
|
+
return html `<div part="fields">
|
|
273
|
+
${channelFields(this.value, color, this.format ?? 'hex', this.alpha).map((field) => html `<label part="field">
|
|
274
|
+
<span part="field-label">${this.channelWord(field.channel)}</span>
|
|
275
|
+
<input
|
|
276
|
+
part="field-input"
|
|
277
|
+
type="number"
|
|
278
|
+
inputmode="numeric"
|
|
279
|
+
min=${field.min}
|
|
280
|
+
max=${field.max}
|
|
281
|
+
step="1"
|
|
282
|
+
.value=${live(String(field.value))}
|
|
283
|
+
?disabled=${this.isDisabled}
|
|
284
|
+
?readonly=${this.readOnly}
|
|
285
|
+
@input=${(event) => this.handleField(field.channel, event)}
|
|
286
|
+
@change=${(event) => {
|
|
287
|
+
event.stopPropagation();
|
|
288
|
+
this.settle();
|
|
289
|
+
this.requestUpdate();
|
|
290
|
+
}}
|
|
291
|
+
/>
|
|
292
|
+
</label>`)}
|
|
293
|
+
</div>`;
|
|
294
|
+
}
|
|
295
|
+
renderChannel(channel, label, max, value, spoken = '') {
|
|
227
296
|
return html `<${this.tag('slider')}
|
|
228
297
|
part="channel"
|
|
229
298
|
exportparts="control: channel-control, feedback: channel-feedback, field: channel-field,
|
|
@@ -234,6 +303,7 @@ let HelixHeadlessColorPicker = class HelixHeadlessColorPicker extends MixinContr
|
|
|
234
303
|
label=${label}
|
|
235
304
|
max=${max}
|
|
236
305
|
min="0"
|
|
306
|
+
value-text=${spoken || nothing}
|
|
237
307
|
.value=${String(value)}
|
|
238
308
|
?disabled=${this.isDisabled}
|
|
239
309
|
@input=${(event) => this.takeChannel(channel, event)}
|
|
@@ -279,7 +349,7 @@ let HelixHeadlessColorPicker = class HelixHeadlessColorPicker extends MixinContr
|
|
|
279
349
|
${this.sampling && !this.noEyedropper
|
|
280
350
|
? html `<${this.tag('button')}
|
|
281
351
|
part="eyedropper"
|
|
282
|
-
exportparts="button: eyedropper-button, text: eyedropper-text"
|
|
352
|
+
exportparts="button: eyedropper-button, live: eyedropper-live, text: eyedropper-text"
|
|
283
353
|
label=${this.eyedropperLabel}
|
|
284
354
|
?disabled=${this.isDisabled}
|
|
285
355
|
@click=${this.handleEyeDropper}
|
|
@@ -291,7 +361,7 @@ let HelixHeadlessColorPicker = class HelixHeadlessColorPicker extends MixinContr
|
|
|
291
361
|
? nothing
|
|
292
362
|
: html `<${this.tag('button')}
|
|
293
363
|
part="format"
|
|
294
|
-
exportparts="button: format-button, text: format-text"
|
|
364
|
+
exportparts="button: format-button, live: format-live, text: format-text"
|
|
295
365
|
label=${fillTemplate(this.formatLabel, { format: this.format ?? 'hex' })}
|
|
296
366
|
?disabled=${this.isDisabled}
|
|
297
367
|
@click=${this.handleFormat}
|
|
@@ -303,8 +373,12 @@ let HelixHeadlessColorPicker = class HelixHeadlessColorPicker extends MixinContr
|
|
|
303
373
|
render() {
|
|
304
374
|
const color = this.color;
|
|
305
375
|
const painted = toCss(color);
|
|
306
|
-
const
|
|
307
|
-
const
|
|
376
|
+
const named = colorName(color, this.colorWords, this.lang);
|
|
377
|
+
const both = `${this.saturationLabel} ${color.saturation}%, ${this.brightnessLabel} ${color.brightness}%, ${named}`;
|
|
378
|
+
const reversed = `${this.brightnessLabel} ${color.brightness}%, ${this.saturationLabel} ${color.saturation}%, ${named}`;
|
|
379
|
+
const hue = hueName({ alpha: 100, brightness: 100, hue: color.hue, saturation: 100 }, this.colorWords, this.lang);
|
|
380
|
+
const owner = this.getAttribute('aria-label')?.trim();
|
|
381
|
+
const axisName = (channel) => (owner ? `${owner}, ${channel}` : channel);
|
|
308
382
|
return html `<div
|
|
309
383
|
part="grid"
|
|
310
384
|
style="--color-picker-hue: ${color.hue}; --color-picker-saturation: ${color.saturation}%; --color-picker-brightness: ${color.brightness}%"
|
|
@@ -319,7 +393,7 @@ let HelixHeadlessColorPicker = class HelixHeadlessColorPicker extends MixinContr
|
|
|
319
393
|
type="range"
|
|
320
394
|
min="0"
|
|
321
395
|
max="100"
|
|
322
|
-
aria-label=${this.saturationLabel}
|
|
396
|
+
aria-label=${axisName(this.saturationLabel)}
|
|
323
397
|
aria-valuetext=${both}
|
|
324
398
|
aria-invalid=${this.invalid ? 'true' : nothing}
|
|
325
399
|
.value=${String(color.saturation)}
|
|
@@ -334,7 +408,7 @@ let HelixHeadlessColorPicker = class HelixHeadlessColorPicker extends MixinContr
|
|
|
334
408
|
min="0"
|
|
335
409
|
max="100"
|
|
336
410
|
tabindex="-1"
|
|
337
|
-
aria-label=${this.brightnessLabel}
|
|
411
|
+
aria-label=${axisName(this.brightnessLabel)}
|
|
338
412
|
aria-valuetext=${reversed}
|
|
339
413
|
aria-invalid=${this.invalid ? 'true' : nothing}
|
|
340
414
|
.value=${String(color.brightness)}
|
|
@@ -356,10 +430,11 @@ let HelixHeadlessColorPicker = class HelixHeadlessColorPicker extends MixinContr
|
|
|
356
430
|
@click=${() => this.copier.copy(this.value)}
|
|
357
431
|
></button>
|
|
358
432
|
<div part="channels">
|
|
359
|
-
${this.renderChannel('hue', this.hueLabel, 360, color.hue)}
|
|
433
|
+
${this.renderChannel('hue', this.hueLabel, 360, color.hue, `{value}, ${hue}`)}
|
|
360
434
|
${this.alpha ? this.renderChannel('alpha', this.opacityLabel, 100, color.alpha) : nothing}
|
|
361
435
|
</div>
|
|
362
436
|
</div>
|
|
437
|
+
${this.channelFields ? this.renderFields(color) : nothing}
|
|
363
438
|
|
|
364
439
|
<!-- The syntax and the presets share a row, because neither fills one.
|
|
365
440
|
Above them the ramps get the whole width, which is what they need:
|
|
@@ -395,7 +470,7 @@ let HelixHeadlessColorPicker = class HelixHeadlessColorPicker extends MixinContr
|
|
|
395
470
|
return html `<button
|
|
396
471
|
part="swatch"
|
|
397
472
|
type="button"
|
|
398
|
-
aria-label=${preset}
|
|
473
|
+
aria-label=${parsed ? colorName(parsed, this.colorWords, this.lang) : preset}
|
|
399
474
|
aria-pressed=${parsed !== null && toCss(parsed) === painted ? 'true' : 'false'}
|
|
400
475
|
style="--color-picker-swatch: ${preset}"
|
|
401
476
|
?disabled=${this.isDisabled}
|
|
@@ -414,9 +489,18 @@ __decorate([
|
|
|
414
489
|
__decorate([
|
|
415
490
|
property({ attribute: 'bad-input-message' })
|
|
416
491
|
], HelixHeadlessColorPicker.prototype, "badInputMessage", void 0);
|
|
492
|
+
__decorate([
|
|
493
|
+
property({ attribute: 'blue-label' })
|
|
494
|
+
], HelixHeadlessColorPicker.prototype, "blueLabel", void 0);
|
|
417
495
|
__decorate([
|
|
418
496
|
property({ attribute: 'brightness-label' })
|
|
419
497
|
], HelixHeadlessColorPicker.prototype, "brightnessLabel", void 0);
|
|
498
|
+
__decorate([
|
|
499
|
+
property({ attribute: 'channel-fields', type: Boolean })
|
|
500
|
+
], HelixHeadlessColorPicker.prototype, "channelFields", void 0);
|
|
501
|
+
__decorate([
|
|
502
|
+
property({ attribute: 'color-words', type: Object })
|
|
503
|
+
], HelixHeadlessColorPicker.prototype, "colorWords", void 0);
|
|
420
504
|
__decorate([
|
|
421
505
|
property({ attribute: 'copied-label' })
|
|
422
506
|
], HelixHeadlessColorPicker.prototype, "copiedLabel", void 0);
|
|
@@ -432,12 +516,18 @@ __decorate([
|
|
|
432
516
|
__decorate([
|
|
433
517
|
property({ attribute: 'format-label' })
|
|
434
518
|
], HelixHeadlessColorPicker.prototype, "formatLabel", void 0);
|
|
519
|
+
__decorate([
|
|
520
|
+
property({ attribute: 'green-label' })
|
|
521
|
+
], HelixHeadlessColorPicker.prototype, "greenLabel", void 0);
|
|
435
522
|
__decorate([
|
|
436
523
|
property({ attribute: 'hue-label' })
|
|
437
524
|
], HelixHeadlessColorPicker.prototype, "hueLabel", void 0);
|
|
438
525
|
__decorate([
|
|
439
526
|
property({ reflect: true, type: Boolean })
|
|
440
527
|
], HelixHeadlessColorPicker.prototype, "invalid", void 0);
|
|
528
|
+
__decorate([
|
|
529
|
+
property({ attribute: 'lightness-label' })
|
|
530
|
+
], HelixHeadlessColorPicker.prototype, "lightnessLabel", void 0);
|
|
441
531
|
__decorate([
|
|
442
532
|
property({ attribute: 'no-eyedropper', type: Boolean })
|
|
443
533
|
], HelixHeadlessColorPicker.prototype, "noEyedropper", void 0);
|
|
@@ -456,6 +546,9 @@ __decorate([
|
|
|
456
546
|
__decorate([
|
|
457
547
|
property({ attribute: 'readonly', reflect: true, type: Boolean })
|
|
458
548
|
], HelixHeadlessColorPicker.prototype, "readOnly", void 0);
|
|
549
|
+
__decorate([
|
|
550
|
+
property({ attribute: 'red-label' })
|
|
551
|
+
], HelixHeadlessColorPicker.prototype, "redLabel", void 0);
|
|
459
552
|
__decorate([
|
|
460
553
|
property({ reflect: true, type: Boolean })
|
|
461
554
|
], HelixHeadlessColorPicker.prototype, "required", void 0);
|
|
@@ -19,9 +19,11 @@ declare const HelixHeadlessCombobox_base: (new (...args: any[]) => import("@fusi
|
|
|
19
19
|
* Focus stays in the text field. The arrow keys move through the list with the
|
|
20
20
|
* listbox's public `navigate` method. `role="combobox"` is on the input itself.
|
|
21
21
|
* ArrowDown and ArrowUp open the list on the chosen option, and Enter chooses
|
|
22
|
-
* the highlighted one.
|
|
22
|
+
* the highlighted one. As typing narrows the list, a screen reader hears how
|
|
23
|
+
* many options are left, such as "3 results". Space, Home, End and letters edit the text, and Enter in
|
|
23
24
|
* a closed field is left to the form. Emptying the field and leaving it clears
|
|
24
|
-
* a single choice; Escape puts the chosen words back
|
|
25
|
+
* a single choice; Escape puts the chosen words back, and a second Escape on
|
|
26
|
+
* the closed field clears the choice.
|
|
25
27
|
*
|
|
26
28
|
* With `multiple`, each chosen option is a tag in the field with its own remove
|
|
27
29
|
* control. The panel stays open and the filter clears after each choice, so the
|
|
@@ -39,11 +41,13 @@ declare const HelixHeadlessCombobox_base: (new (...args: any[]) => import("@fusi
|
|
|
39
41
|
* @documentation https://fusion.dev/helix/components/combobox
|
|
40
42
|
*
|
|
41
43
|
* @slot - The options.
|
|
44
|
+
* @slot empty - What the list shows when typing hides every option, for content richer than `empty-text`.
|
|
42
45
|
* @slot end - After the text, for a unit or a clear button.
|
|
43
46
|
* @slot feedback - The message that says what is wrong, for content richer than a string. It shows while there is a message.
|
|
44
47
|
* @slot hint - The hint, for content richer than plain text.
|
|
45
48
|
* @slot indicator - Replaces the caret that shows the field opens a list.
|
|
46
49
|
* @slot label - The label, for content richer than plain text.
|
|
50
|
+
* @slot loading - What the list shows while the options load, for content richer than `loading-text`.
|
|
47
51
|
* @slot start - Before the text, for an icon.
|
|
48
52
|
*
|
|
49
53
|
* @event {Event} change - Fired after the value changes.
|
|
@@ -71,16 +75,18 @@ declare const HelixHeadlessCombobox_base: (new (...args: any[]) => import("@fusi
|
|
|
71
75
|
* @csspart listbox-hint - Help under the list.
|
|
72
76
|
* @csspart listbox-items - The element that holds the options.
|
|
73
77
|
* @csspart listbox-label - The label above the list.
|
|
74
|
-
* @csspart listbox-live - The inner list's `live` part, the region screen readers announce its empty and loading messages from.
|
|
78
|
+
* @csspart listbox-live - The inner list's `live` part, the region screen readers announce its empty and loading messages, and how many options typing left, from.
|
|
75
79
|
* @csspart listbox-loading - Shown while the options are loading.
|
|
76
80
|
* @csspart listbox-search - The region holding the field that narrows the list.
|
|
77
81
|
* @csspart listbox-search-field - The filter field inside that region.
|
|
78
82
|
* @csspart rest - The count of choices held beyond `max-tags`. A `<button>` with `expandable`, a `<span>` without it.
|
|
79
83
|
* @csspart surface - The floating panel.
|
|
80
84
|
* @csspart tag - One chosen option.
|
|
85
|
+
* @csspart tag-cell - The tag's grid cell, which a tag draws only inside a tag group.
|
|
81
86
|
* @csspart tag-dismiss - The remove button, when `dismissible`.
|
|
82
87
|
* @csspart tag-dismiss-mark - The glyph on the dismiss control, where none is slotted.
|
|
83
88
|
* @csspart tag-label - The label, trimmed to its capitals and baseline.
|
|
89
|
+
* @csspart tag-link - The tag's link around its label, which a tag draws only with `href`.
|
|
84
90
|
* @csspart tag-start - The category before the label.
|
|
85
91
|
* @csspart tags - The row of chosen options, when `multiple` is set.
|
|
86
92
|
*
|
|
@@ -89,6 +95,17 @@ declare const HelixHeadlessCombobox_base: (new (...args: any[]) => import("@fusi
|
|
|
89
95
|
*/
|
|
90
96
|
export declare class HelixHeadlessCombobox extends HelixHeadlessCombobox_base {
|
|
91
97
|
protected readonly aria: AriaForwardController;
|
|
98
|
+
/**
|
|
99
|
+
* Whether text that names no option is taken as the value, as React Aria's
|
|
100
|
+
* `allowsCustomValue`.
|
|
101
|
+
*
|
|
102
|
+
* For a field where the list is a help and not the whole of the answer, a
|
|
103
|
+
* city or a job title. What was typed becomes the value when the reader
|
|
104
|
+
* leaves the field or presses Enter with nothing highlighted, and text that
|
|
105
|
+
* names an option takes that option. Unlike `creatable`, no event asks
|
|
106
|
+
* first and no option is expected to be added: the value is the text.
|
|
107
|
+
*/
|
|
108
|
+
allowsCustomValue: boolean;
|
|
92
109
|
/**
|
|
93
110
|
* What the browser may autofill in the text field, as a platform token.
|
|
94
111
|
*
|
|
@@ -174,6 +191,17 @@ export declare class HelixHeadlessCombobox extends HelixHeadlessCombobox_base {
|
|
|
174
191
|
* removes rather than as "Remove" said once per chosen option.
|
|
175
192
|
*/
|
|
176
193
|
removeLabel: string;
|
|
194
|
+
/**
|
|
195
|
+
* What a screen reader hears when typing leaves one option. `{count}` is
|
|
196
|
+
* the count.
|
|
197
|
+
*/
|
|
198
|
+
resultLabel: string;
|
|
199
|
+
/**
|
|
200
|
+
* What a screen reader hears when typing leaves any other number of
|
|
201
|
+
* options. `{count}` is the count, and `Intl.PluralRules` picks between the
|
|
202
|
+
* two.
|
|
203
|
+
*/
|
|
204
|
+
resultsLabel: string;
|
|
177
205
|
/**
|
|
178
206
|
* Whether the field completes the word as the user types.
|
|
179
207
|
*
|
|
@@ -313,6 +341,11 @@ export declare class HelixHeadlessCombobox extends HelixHeadlessCombobox_base {
|
|
|
313
341
|
* once answered.
|
|
314
342
|
*/
|
|
315
343
|
private commitEmptied;
|
|
344
|
+
/**
|
|
345
|
+
* Takes what was typed as the answer, where `allows-custom-value` asks: the
|
|
346
|
+
* option its words name, or the text itself. Returns whether it took any.
|
|
347
|
+
*/
|
|
348
|
+
private commitTyped;
|
|
316
349
|
/** The options the arrows can reach. */
|
|
317
350
|
private get reachable();
|
|
318
351
|
/**
|
|
@@ -418,6 +451,8 @@ export declare class HelixHeadlessCombobox extends HelixHeadlessCombobox_base {
|
|
|
418
451
|
* component: a form that received "jav" got the filter, not an option.
|
|
419
452
|
*/
|
|
420
453
|
private sync;
|
|
454
|
+
/** A link option, once followed, closes the panel as a choice does. */
|
|
455
|
+
private readonly handleLinkFollowed;
|
|
421
456
|
connectedCallback(): void;
|
|
422
457
|
disconnectedCallback(): void;
|
|
423
458
|
protected willUpdate(changed: PropertyValues): void;
|
|
@@ -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, customElement, fillTemplate, HelixCreateEvent, HelixFilterEvent, HelixFormElement, MixinControllerOpen, MixinControllerValue, MixinField, MixinTokens, PopoverController, reportValues, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { AriaForwardController, afterLinkFollowed, customElement, fillTemplate, HelixCreateEvent, HelixFilterEvent, HelixFormElement, MixinControllerOpen, MixinControllerValue, MixinField, MixinTokens, PopoverController, reportValues, } 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';
|
|
@@ -21,6 +21,7 @@ let HelixHeadlessCombobox = class HelixHeadlessCombobox extends MixinControllerO
|
|
|
21
21
|
this.aria = new AriaForwardController(this, {
|
|
22
22
|
target: () => this.partNamed('control'),
|
|
23
23
|
});
|
|
24
|
+
this.allowsCustomValue = false;
|
|
24
25
|
this.autocomplete = 'off';
|
|
25
26
|
this.creatable = false;
|
|
26
27
|
this.createLabel = 'Add';
|
|
@@ -32,6 +33,8 @@ let HelixHeadlessCombobox = class HelixHeadlessCombobox extends MixinControllerO
|
|
|
32
33
|
this.placeholder = '';
|
|
33
34
|
this.readOnly = false;
|
|
34
35
|
this.removeLabel = 'Remove {name}';
|
|
36
|
+
this.resultLabel = '{count} result';
|
|
37
|
+
this.resultsLabel = '{count} results';
|
|
35
38
|
this.suggest = false;
|
|
36
39
|
this.typed = '';
|
|
37
40
|
this.suggestion = '';
|
|
@@ -81,6 +84,12 @@ let HelixHeadlessCombobox = class HelixHeadlessCombobox extends MixinControllerO
|
|
|
81
84
|
if (this.open) {
|
|
82
85
|
event.preventDefault();
|
|
83
86
|
this.close();
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (!this.multiple && this.value !== '' && !this.readOnly) {
|
|
90
|
+
event.preventDefault();
|
|
91
|
+
event.stopPropagation();
|
|
92
|
+
this.requestValue('');
|
|
84
93
|
}
|
|
85
94
|
return;
|
|
86
95
|
}
|
|
@@ -99,6 +108,16 @@ let HelixHeadlessCombobox = class HelixHeadlessCombobox extends MixinControllerO
|
|
|
99
108
|
this.create();
|
|
100
109
|
return;
|
|
101
110
|
}
|
|
111
|
+
if (event.key === 'Enter' &&
|
|
112
|
+
this.allowsCustomValue &&
|
|
113
|
+
!this.reachable.some((option) => option.active) &&
|
|
114
|
+
this.commitTyped()) {
|
|
115
|
+
event.preventDefault();
|
|
116
|
+
if (!this.multiple) {
|
|
117
|
+
this.close();
|
|
118
|
+
}
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
102
121
|
if (!this.open) {
|
|
103
122
|
if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {
|
|
104
123
|
event.preventDefault();
|
|
@@ -151,6 +170,9 @@ let HelixHeadlessCombobox = class HelixHeadlessCombobox extends MixinControllerO
|
|
|
151
170
|
const tag = event.currentTarget;
|
|
152
171
|
this.drop(tag.dataset.value ?? '');
|
|
153
172
|
};
|
|
173
|
+
this.handleLinkFollowed = (event) => {
|
|
174
|
+
afterLinkFollowed(event, () => this.requestOpen(false));
|
|
175
|
+
};
|
|
154
176
|
}
|
|
155
177
|
requestValue(next) {
|
|
156
178
|
if (this.readOnly) {
|
|
@@ -246,6 +268,28 @@ let HelixHeadlessCombobox = class HelixHeadlessCombobox extends MixinControllerO
|
|
|
246
268
|
this.requestValue('');
|
|
247
269
|
}
|
|
248
270
|
this.emptied = false;
|
|
271
|
+
this.commitTyped();
|
|
272
|
+
}
|
|
273
|
+
commitTyped() {
|
|
274
|
+
const typed = this.typed.trim();
|
|
275
|
+
if (!this.allowsCustomValue || !this.editing || typed === '') {
|
|
276
|
+
return false;
|
|
277
|
+
}
|
|
278
|
+
const named = (this.listbox?.options ?? []).find((option) => option.text.trim().toLowerCase() === typed.toLowerCase());
|
|
279
|
+
const answer = named?.value ?? typed;
|
|
280
|
+
if (this.multiple) {
|
|
281
|
+
if (!this.values.includes(answer)) {
|
|
282
|
+
this.requestValue([...this.values, answer].join(','));
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
else if (answer !== this.value) {
|
|
286
|
+
this.requestValue(answer);
|
|
287
|
+
}
|
|
288
|
+
this.typed = '';
|
|
289
|
+
this.suggestion = '';
|
|
290
|
+
this.editing = false;
|
|
291
|
+
this.listbox?.requestFilter('');
|
|
292
|
+
return true;
|
|
249
293
|
}
|
|
250
294
|
get reachable() {
|
|
251
295
|
return (this.listbox?.options ?? []).filter((option) => !option.hidden && !option.disabled);
|
|
@@ -312,6 +356,7 @@ let HelixHeadlessCombobox = class HelixHeadlessCombobox extends MixinControllerO
|
|
|
312
356
|
}
|
|
313
357
|
connectedCallback() {
|
|
314
358
|
super.connectedCallback();
|
|
359
|
+
this.addEventListener('helix-select', this.handleLinkFollowed);
|
|
315
360
|
this.watcher = new MutationObserver(() => this.requestUpdate());
|
|
316
361
|
this.watcher.observe(this, {
|
|
317
362
|
attributeFilter: ['label', 'value'],
|
|
@@ -322,6 +367,7 @@ let HelixHeadlessCombobox = class HelixHeadlessCombobox extends MixinControllerO
|
|
|
322
367
|
}
|
|
323
368
|
disconnectedCallback() {
|
|
324
369
|
super.disconnectedCallback();
|
|
370
|
+
this.removeEventListener('helix-select', this.handleLinkFollowed);
|
|
325
371
|
this.watcher?.disconnect();
|
|
326
372
|
this.watcher = undefined;
|
|
327
373
|
}
|
|
@@ -390,6 +436,8 @@ let HelixHeadlessCombobox = class HelixHeadlessCombobox extends MixinControllerO
|
|
|
390
436
|
aria-label=${this.listLabel}
|
|
391
437
|
empty-text=${this.emptyText}
|
|
392
438
|
loading-text=${this.loadingText}
|
|
439
|
+
result-label=${this.resultLabel}
|
|
440
|
+
results-label=${this.resultsLabel}
|
|
393
441
|
?loading=${this.loading}
|
|
394
442
|
?multiple=${this.multiple}
|
|
395
443
|
.value=${this.value}
|
|
@@ -404,12 +452,17 @@ let HelixHeadlessCombobox = class HelixHeadlessCombobox extends MixinControllerO
|
|
|
404
452
|
property, so nothing else would schedule the update that fixes
|
|
405
453
|
it. -->
|
|
406
454
|
<slot @slotchange=${() => this.requestUpdate()}></slot>
|
|
455
|
+
<!-- Handed on to the list's own, with the text as this slot's fallback:
|
|
456
|
+
a slot passed into another is assigned there whether or not anything
|
|
457
|
+
fills it, so the list's fallback would never show. -->
|
|
458
|
+
<slot name="empty" slot="empty">${this.emptyText}</slot>
|
|
459
|
+
<slot name="loading" slot="loading">${this.loadingText}</slot>
|
|
407
460
|
</${this.tag('listbox')}>`;
|
|
408
461
|
}
|
|
409
462
|
renderTag(option) {
|
|
410
463
|
return html `<${this.tag('tag')}
|
|
411
464
|
part="tag"
|
|
412
|
-
exportparts="dismiss: tag-dismiss, dismiss-mark: tag-dismiss-mark, label: tag-label, start: tag-start"
|
|
465
|
+
exportparts="cell: tag-cell, dismiss: tag-dismiss, dismiss-mark: tag-dismiss-mark, label: tag-label, link: tag-link, start: tag-start"
|
|
413
466
|
data-value=${option.value}
|
|
414
467
|
dismiss-label=${fillTemplate(this.removeLabel, { name: option.text })}
|
|
415
468
|
?dismissible=${!this.isDisabled && !this.readOnly}
|
|
@@ -473,6 +526,9 @@ let HelixHeadlessCombobox = class HelixHeadlessCombobox extends MixinControllerO
|
|
|
473
526
|
${this.renderHint()}${this.renderFeedback()}`;
|
|
474
527
|
}
|
|
475
528
|
};
|
|
529
|
+
__decorate([
|
|
530
|
+
property({ attribute: 'allows-custom-value', type: Boolean })
|
|
531
|
+
], HelixHeadlessCombobox.prototype, "allowsCustomValue", void 0);
|
|
476
532
|
__decorate([
|
|
477
533
|
property()
|
|
478
534
|
], HelixHeadlessCombobox.prototype, "autocomplete", void 0);
|
|
@@ -506,6 +562,12 @@ __decorate([
|
|
|
506
562
|
__decorate([
|
|
507
563
|
property({ attribute: 'remove-label' })
|
|
508
564
|
], HelixHeadlessCombobox.prototype, "removeLabel", void 0);
|
|
565
|
+
__decorate([
|
|
566
|
+
property({ attribute: 'result-label' })
|
|
567
|
+
], HelixHeadlessCombobox.prototype, "resultLabel", void 0);
|
|
568
|
+
__decorate([
|
|
569
|
+
property({ attribute: 'results-label' })
|
|
570
|
+
], HelixHeadlessCombobox.prototype, "resultsLabel", void 0);
|
|
509
571
|
__decorate([
|
|
510
572
|
property({ type: Boolean })
|
|
511
573
|
], HelixHeadlessCombobox.prototype, "suggest", void 0);
|
|
@@ -14,7 +14,8 @@ declare const HelixHeadlessCommand_base: (new (...args: any[]) => import("@fusio
|
|
|
14
14
|
*
|
|
15
15
|
* The palette keeps no value. It is not a form control and submits nothing.
|
|
16
16
|
* Choosing an option dispatches `helix-select` once. To remember the last
|
|
17
|
-
* command, store it yourself.
|
|
17
|
+
* command, store it yourself. An option with `href` is a link to a page, which
|
|
18
|
+
* the browser follows once the palette has closed.
|
|
18
19
|
*
|
|
19
20
|
* The hotkey listener is on the document, so the hotkey works from anywhere on
|
|
20
21
|
* the page, including inside another control's text field, whether or not the
|
|
@@ -22,7 +23,8 @@ declare const HelixHeadlessCommand_base: (new (...args: any[]) => import("@fusio
|
|
|
22
23
|
* write one binding.
|
|
23
24
|
*
|
|
24
25
|
* The filter is cleared when the palette closes, so each opening starts from
|
|
25
|
-
* the full list. Combobox and Select do the same.
|
|
26
|
+
* the full list. Combobox and Select do the same. As typing narrows the list, a
|
|
27
|
+
* screen reader hears how many commands are left, such as "3 commands".
|
|
26
28
|
*
|
|
27
29
|
* @since 0.1.0
|
|
28
30
|
* @status stable
|
|
@@ -31,15 +33,22 @@ declare const HelixHeadlessCommand_base: (new (...args: any[]) => import("@fusio
|
|
|
31
33
|
* @documentation https://fusion.dev/helix/components/command
|
|
32
34
|
*
|
|
33
35
|
* @slot - The commands, and any groups of them.
|
|
36
|
+
* @slot empty - What the palette shows when typing matches no commands, for content richer than `empty-text`.
|
|
34
37
|
* @slot footer - Content under the list, such as the keys that work in the palette.
|
|
38
|
+
* @slot loading - What the palette shows while the commands load, for content richer than `loading-text`.
|
|
35
39
|
*
|
|
36
40
|
* @event {HelixBeforeCloseEvent} helix-before-close - The palette is about to close. Cancelable: cancel it to keep it open.
|
|
37
41
|
* @event {HelixBeforeOpenEvent} helix-before-open - The palette is about to open. Cancelable: cancel it to keep it closed.
|
|
38
42
|
* @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.
|
|
39
|
-
* @event {HelixSelectEvent} helix-select - A command was chosen. Cancelable: cancel it to keep the palette open.
|
|
43
|
+
* @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.
|
|
40
44
|
* @event {ToggleEvent} toggle - The palette opened or closed. The event carries `newState` and `oldState`.
|
|
41
45
|
*
|
|
42
46
|
* @csspart dialog - The box of the dialog the palette opens in, forwarded from `Dialog`.
|
|
47
|
+
* @csspart dialog-body - The dialog's slot for its content, which holds the list. It draws no box until you give it one.
|
|
48
|
+
* @csspart dialog-dismiss - The dialog's close control, drawn when the dialog is `dismissible`.
|
|
49
|
+
* @csspart dialog-dismiss-mark - The glyph on the dialog's close control, where none is slotted.
|
|
50
|
+
* @csspart dialog-footer - The dialog's slot for its actions, which holds the `footer` row. It draws no box until you give it one.
|
|
51
|
+
* @csspart dialog-header - The dialog's slot for its title. It draws no box until you give it one.
|
|
43
52
|
* @csspart footer - The row under the list.
|
|
44
53
|
* @csspart listbox - The listbox inside the palette.
|
|
45
54
|
* @csspart listbox-empty - The text shown when the filter matches no commands.
|
|
@@ -49,7 +58,7 @@ declare const HelixHeadlessCommand_base: (new (...args: any[]) => import("@fusio
|
|
|
49
58
|
* @csspart listbox-hint - Help text under the list.
|
|
50
59
|
* @csspart listbox-items - The list of commands.
|
|
51
60
|
* @csspart listbox-label - The label above the list.
|
|
52
|
-
* @csspart listbox-live - The listbox's `live` part, a live region that holds the empty and loading text for screen readers.
|
|
61
|
+
* @csspart listbox-live - The listbox's `live` part, a live region that holds the empty and loading text, and how many commands typing left, for screen readers.
|
|
53
62
|
* @csspart listbox-loading - The text shown while the commands are loading.
|
|
54
63
|
* @csspart listbox-search - The region that holds the filter field.
|
|
55
64
|
* @csspart listbox-search-field - The filter field.
|
|
@@ -61,6 +70,12 @@ export declare class HelixHeadlessCommand extends HelixHeadlessCommand_base {
|
|
|
61
70
|
* The text shown when the filter matches no commands.
|
|
62
71
|
*/
|
|
63
72
|
emptyText: string;
|
|
73
|
+
/**
|
|
74
|
+
* How long typing rests before the commands are filtered, in milliseconds,
|
|
75
|
+
* so a palette filtered on a server sends one `helix-filter` for a word.
|
|
76
|
+
* `0` filters on every keystroke. See Listbox's `filter-delay`.
|
|
77
|
+
*/
|
|
78
|
+
filterDelay: number;
|
|
64
79
|
/**
|
|
65
80
|
* The key that opens the palette, written as `mod+k`, `shift+p`, or `k`.
|
|
66
81
|
*
|
|
@@ -88,6 +103,17 @@ export declare class HelixHeadlessCommand extends HelixHeadlessCommand_base {
|
|
|
88
103
|
* The text shown in the filter field before anything is typed.
|
|
89
104
|
*/
|
|
90
105
|
placeholder: string;
|
|
106
|
+
/**
|
|
107
|
+
* What a screen reader hears when typing leaves one command. `{count}` is
|
|
108
|
+
* the count.
|
|
109
|
+
*/
|
|
110
|
+
resultLabel: string;
|
|
111
|
+
/**
|
|
112
|
+
* What a screen reader hears when typing leaves any other number of
|
|
113
|
+
* commands. `{count}` is the count, and `Intl.PluralRules` picks between the
|
|
114
|
+
* two.
|
|
115
|
+
*/
|
|
116
|
+
resultsLabel: string;
|
|
91
117
|
/**
|
|
92
118
|
* Whether the consumer put anything under the list.
|
|
93
119
|
*
|