@fusion.dev/helix-headless 0.145.0 → 0.147.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 +12286 -4281
- package/dist/accordion/item/accordion-item.d.ts +51 -18
- package/dist/accordion/item/accordion-item.js +45 -13
- package/dist/accordion/root/accordion-root.d.ts +16 -7
- package/dist/accordion/root/accordion-root.js +3 -3
- package/dist/announcement/root/announcement-root.d.ts +16 -6
- package/dist/announcement/root/announcement-root.js +37 -7
- package/dist/app-header/root/app-header-root.d.ts +7 -2
- package/dist/app-header/root/app-header-root.js +9 -1
- package/dist/app-header/sectioning.d.ts +3 -1
- package/dist/app-header/sectioning.js +3 -2
- package/dist/area-chart/root/area-chart-root.d.ts +18 -1
- package/dist/area-chart/root/area-chart-root.js +11 -3
- package/dist/avatar/group/avatar-group.d.ts +20 -14
- package/dist/avatar/group/avatar-group.js +17 -19
- package/dist/avatar/root/avatar-root.d.ts +31 -1
- package/dist/avatar/root/avatar-root.js +11 -1
- package/dist/badge/root/badge-root.d.ts +60 -7
- package/dist/badge/root/badge-root.js +89 -6
- package/dist/bar-chart/root/bar-chart-root.d.ts +18 -1
- package/dist/bar-chart/root/bar-chart-root.js +48 -20
- package/dist/bar-chart/stack.d.ts +25 -0
- package/dist/bar-chart/stack.js +27 -0
- package/dist/breadcrumbs/breadcrumb/breadcrumb.d.ts +14 -0
- package/dist/breadcrumbs/breadcrumb/breadcrumb.js +12 -2
- package/dist/breadcrumbs/root/breadcrumbs-root.d.ts +25 -0
- package/dist/breadcrumbs/root/breadcrumbs-root.js +51 -4
- package/dist/button/root/button-root.d.ts +50 -38
- package/dist/button/root/button-root.js +42 -53
- package/dist/button/submitter.d.ts +27 -0
- package/dist/button/submitter.js +25 -0
- 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.js +2 -2
- package/dist/card/root/card-root.d.ts +36 -4
- package/dist/card/root/card-root.js +29 -10
- package/dist/carousel/root/carousel-root.d.ts +43 -4
- package/dist/carousel/root/carousel-root.js +40 -12
- package/dist/carousel/stops.d.ts +20 -0
- package/dist/carousel/stops.js +30 -0
- package/dist/chat/message/chat-message.js +5 -4
- package/dist/chat/naming.d.ts +5 -1
- package/dist/chat/naming.js +4 -2
- package/dist/chat/root/chat-root.d.ts +40 -4
- package/dist/chat/root/chat-root.js +32 -6
- package/dist/checkbox/root/checkbox-root.d.ts +20 -0
- package/dist/checkbox/root/checkbox-root.js +18 -7
- package/dist/checkbox-group/root/checkbox-group-root.d.ts +8 -2
- package/dist/checkbox-group/root/checkbox-group-root.js +14 -11
- package/dist/checkbox-group/select-all.d.ts +21 -0
- package/dist/checkbox-group/select-all.js +7 -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 +79 -10
- package/dist/code-block/root/code-block-root.js +74 -5
- package/dist/color-input/root/color-input-root.d.ts +14 -0
- package/dist/color-input/root/color-input-root.js +17 -7
- package/dist/color-picker/channels.js +1 -2
- package/dist/color-picker/root/color-picker-root.d.ts +53 -16
- package/dist/color-picker/root/color-picker-root.js +155 -46
- package/dist/color-picker/wheel.d.ts +17 -0
- package/dist/color-picker/wheel.js +6 -0
- package/dist/combobox/root/combobox-root.d.ts +56 -0
- package/dist/combobox/root/combobox-root.js +92 -15
- package/dist/command/root/command-root.d.ts +19 -2
- package/dist/command/root/command-root.js +24 -23
- package/dist/copy-button/root/copy-button-root.d.ts +21 -1
- package/dist/copy-button/root/copy-button-root.js +16 -4
- package/dist/data-table/index.d.ts +1 -1
- package/dist/data-table/index.js +1 -1
- package/dist/data-table/keys.d.ts +6 -0
- package/dist/data-table/keys.js +14 -0
- package/dist/data-table/root/data-table-root.d.ts +27 -18
- package/dist/data-table/root/data-table-root.js +31 -57
- package/dist/data-table/tree.d.ts +16 -1
- package/dist/data-table/tree.js +2 -3
- package/dist/date-input/root/date-input-root.d.ts +11 -2
- package/dist/date-input/root/date-input-root.js +26 -12
- package/dist/date-picker/root/date-picker-root.d.ts +14 -9
- package/dist/date-picker/root/date-picker-root.js +33 -22
- package/dist/description-list/item/description-list-item.d.ts +18 -4
- package/dist/description-list/item/description-list-item.js +8 -4
- 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 +55 -1
- package/dist/donut-chart/slice-label.d.ts +35 -0
- package/dist/donut-chart/slice-label.js +11 -0
- package/dist/drawer/reveal.d.ts +8 -0
- package/dist/drawer/reveal.js +1 -0
- package/dist/drawer/root/drawer-root.d.ts +63 -2
- package/dist/drawer/root/drawer-root.js +75 -4
- package/dist/drilldown/item/drilldown-item.d.ts +21 -1
- package/dist/drilldown/item/drilldown-item.js +40 -5
- package/dist/drilldown/root/drilldown-root.d.ts +21 -3
- package/dist/drilldown/root/drilldown-root.js +22 -3
- package/dist/element-events.generated.js +35 -6
- package/dist/empty/root/empty-root.d.ts +34 -2
- package/dist/empty/root/empty-root.js +26 -4
- package/dist/file-input/root/file-input-root.d.ts +99 -8
- package/dist/file-input/root/file-input-root.js +120 -22
- package/dist/file-input/screen.d.ts +2 -1
- package/dist/file-input/status.d.ts +24 -0
- package/dist/file-input/status.js +10 -0
- package/dist/filter-input/chip/filter-chip.d.ts +23 -0
- package/dist/filter-input/chip/filter-chip.js +11 -2
- package/dist/filter-input/menu/filter-menu.d.ts +2 -0
- package/dist/filter-input/menu/filter-menu.js +12 -4
- package/dist/filter-input/root/filter-input-root.d.ts +38 -6
- package/dist/filter-input/root/filter-input-root.js +18 -28
- package/dist/filter-input/suggest.d.ts +28 -3
- package/dist/filter-input/suggest.js +18 -8
- package/dist/format-date/options.d.ts +3 -4
- package/dist/format-date/options.js +2 -2
- package/dist/format-date/root/format-date-root.d.ts +27 -17
- package/dist/format-date/root/format-date-root.js +27 -48
- package/dist/heatmap/root/buckets.d.ts +21 -0
- package/dist/heatmap/root/buckets.js +34 -0
- package/dist/heatmap/root/heatmap-root.d.ts +83 -11
- package/dist/heatmap/root/heatmap-root.js +104 -12
- package/dist/icon/index.d.ts +1 -1
- package/dist/icon/index.js +1 -1
- package/dist/icon/registry.d.ts +26 -1
- package/dist/icon/registry.js +12 -1
- package/dist/icon/root/icon-root.d.ts +25 -1
- package/dist/icon/root/icon-root.js +44 -12
- package/dist/icon/root/index.d.ts +1 -1
- package/dist/icon/root/index.js +1 -1
- 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 +14 -1
- package/dist/image/root/image-root.js +7 -2
- package/dist/input/root/input-root.d.ts +34 -3
- package/dist/input/root/input-root.js +17 -4
- package/dist/kbd/keys.d.ts +29 -0
- package/dist/kbd/keys.js +52 -0
- package/dist/kbd/root/kbd-root.d.ts +52 -1
- package/dist/kbd/root/kbd-root.js +40 -47
- package/dist/legend/hidden-series.d.ts +10 -2
- package/dist/legend/hidden-series.js +5 -2
- package/dist/legend/root/legend-root.d.ts +77 -12
- package/dist/legend/root/legend-root.js +71 -17
- package/dist/lightbox/root/lightbox-root.d.ts +98 -10
- package/dist/lightbox/root/lightbox-root.js +153 -18
- package/dist/lightbox/zoom-controller.d.ts +59 -0
- package/dist/lightbox/zoom-controller.js +128 -0
- package/dist/lightbox/zoom.d.ts +24 -0
- package/dist/lightbox/zoom.js +18 -0
- package/dist/line-chart/root/line-chart-root.d.ts +38 -1
- package/dist/line-chart/root/line-chart-root.js +31 -3
- package/dist/list/item/list-item.d.ts +2 -0
- package/dist/list/item/list-item.js +11 -2
- package/dist/list/root/list-root.d.ts +70 -13
- package/dist/list/root/list-root.js +91 -13
- package/dist/list/selection.d.ts +54 -7
- package/dist/list/selection.js +32 -7
- package/dist/listbox/root/listbox-root.d.ts +44 -4
- package/dist/listbox/root/listbox-root.js +72 -34
- 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/megamenu/hand-over.d.ts +75 -0
- package/dist/megamenu/hand-over.js +67 -0
- package/dist/megamenu/root/megamenu-root.d.ts +80 -15
- package/dist/megamenu/root/megamenu-root.js +76 -19
- package/dist/menu/item/menu-item.d.ts +51 -2
- package/dist/menu/item/menu-item.js +50 -26
- package/dist/menu/root/menu-root.d.ts +17 -0
- package/dist/menu/root/menu-root.js +2 -2
- package/dist/meter/root/meter-root.d.ts +62 -1
- package/dist/meter/root/meter-root.js +38 -16
- package/dist/navigation/root/navigation-root.d.ts +2 -1
- package/dist/navigation/root/navigation-root.js +2 -2
- package/dist/notifications/root/notifications-root.d.ts +20 -4
- package/dist/notifications/root/notifications-root.js +30 -8
- package/dist/number-input/grain.d.ts +28 -0
- package/dist/number-input/grain.js +14 -0
- package/dist/number-input/root/number-input-root.d.ts +34 -9
- package/dist/number-input/root/number-input-root.js +31 -25
- package/dist/object-inspector/root/object-inspector-root.d.ts +88 -33
- package/dist/object-inspector/root/object-inspector-root.js +134 -92
- package/dist/object-inspector/rows.d.ts +18 -0
- package/dist/object-inspector/rows.js +33 -0
- package/dist/option/index.d.ts +1 -0
- package/dist/option/index.js +1 -0
- package/dist/option/root/option-root.d.ts +5 -3
- package/dist/option/separator/option-separator.d.ts +30 -0
- package/dist/option/separator/option-separator.js +21 -0
- package/dist/outline/root/outline-root.d.ts +30 -0
- package/dist/outline/root/outline-root.js +17 -13
- package/dist/pagination/size/pagination-size.d.ts +6 -0
- package/dist/pagination/size/pagination-size.js +5 -3
- package/dist/pin-input/code.d.ts +37 -0
- package/dist/pin-input/code.js +25 -0
- package/dist/pin-input/root/pin-input-root.d.ts +116 -115
- package/dist/pin-input/root/pin-input-root.js +163 -155
- package/dist/popover/hide-outside.d.ts +14 -0
- package/dist/popover/hide-outside.js +34 -0
- package/dist/popover/root/popover-root.d.ts +64 -8
- package/dist/popover/root/popover-root.js +67 -4
- package/dist/progress/root/progress-root.d.ts +47 -0
- package/dist/progress/root/progress-root.js +34 -16
- package/dist/qr-code/export.d.ts +45 -1
- package/dist/qr-code/export.js +28 -0
- package/dist/qr-code/name.d.ts +11 -0
- package/dist/qr-code/name.js +7 -0
- package/dist/qr-code/root/qr-code-root.d.ts +36 -11
- package/dist/qr-code/root/qr-code-root.js +58 -11
- 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 +15 -0
- package/dist/radio/root/radio-root.d.ts +6 -2
- package/dist/radio/root/radio-root.js +7 -2
- package/dist/rating/root/rating-root.d.ts +30 -12
- package/dist/rating/root/rating-root.js +27 -27
- 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 +51 -1
- package/dist/scatter-chart/root/scatter-chart-root.js +64 -24
- package/dist/scroll-area/root/scroll-area-root.d.ts +22 -51
- package/dist/scroll-area/root/scroll-area-root.js +57 -173
- 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 +27 -8
- package/dist/scroll-area/scrollbar.js +10 -1
- package/dist/select/align.d.ts +47 -0
- package/dist/select/align.js +7 -0
- package/dist/select/root/select-root.d.ts +71 -0
- package/dist/select/root/select-root.js +78 -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 +59 -5
- package/dist/slider/root/slider-root.js +45 -3
- package/dist/sparkline/readings.d.ts +36 -0
- package/dist/sparkline/readings.js +36 -0
- package/dist/sparkline/root/sparkline-root.d.ts +121 -7
- package/dist/sparkline/root/sparkline-root.js +160 -26
- package/dist/speed-dial/item/speed-dial-item.d.ts +1 -1
- package/dist/speed-dial/item/speed-dial-item.js +2 -2
- package/dist/speed-dial/root/speed-dial-root.d.ts +6 -0
- package/dist/speed-dial/root/speed-dial-root.js +11 -3
- package/dist/splitter/root/splitter-root.d.ts +10 -12
- package/dist/splitter/root/splitter-root.js +211 -204
- 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 +5 -0
- package/dist/steps/reach.js +3 -0
- package/dist/steps/root/steps-root.d.ts +56 -3
- package/dist/steps/root/steps-root.js +50 -6
- package/dist/steps/step/step.d.ts +8 -0
- package/dist/steps/step/step.js +8 -3
- package/dist/switch/root/switch-root.d.ts +10 -0
- package/dist/table/column/table-column.d.ts +6 -10
- package/dist/table/column/table-column.js +8 -20
- package/dist/table/root/table-root.d.ts +31 -10
- package/dist/table/root/table-root.js +14 -18
- package/dist/table/row/table-row.d.ts +24 -0
- package/dist/table/row/table-row.js +37 -1
- package/dist/tabs/panel/tab-panel.d.ts +16 -3
- package/dist/tabs/panel/tab-panel.js +34 -5
- package/dist/tabs/root/tabs-root.d.ts +17 -3
- package/dist/tabs/root/tabs-root.js +1 -1
- package/dist/tabs/tab/tab.d.ts +5 -0
- package/dist/tabs/tab/tab.js +5 -2
- package/dist/tag/group/tag-group.d.ts +44 -5
- package/dist/tag/group/tag-group.js +60 -9
- package/dist/tag/root/tag-root.js +9 -2
- package/dist/textarea/root/textarea-root.d.ts +41 -2
- package/dist/textarea/root/textarea-root.js +39 -1
- package/dist/time-input/root/time-input-root.d.ts +10 -2
- package/dist/time-input/root/time-input-root.js +24 -13
- package/dist/time-picker/root/time-picker-root.d.ts +28 -17
- package/dist/time-picker/root/time-picker-root.js +18 -29
- 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.js +2 -2
- package/dist/toast/item/toast-item.d.ts +16 -3
- package/dist/toast/item/toast-item.js +22 -6
- package/dist/toast/root/toast-root.d.ts +34 -4
- package/dist/toast/root/toast-root.js +74 -13
- package/dist/toast/words.d.ts +12 -0
- package/dist/toast/words.js +25 -0
- package/dist/toggle/group/toggle-group.d.ts +52 -7
- package/dist/toggle/group/toggle-group.js +58 -44
- package/dist/toggle/root/toggle-root.js +2 -4
- package/dist/toolbar/root/toolbar-root.d.ts +21 -5
- package/dist/toolbar/root/toolbar-root.js +52 -8
- package/dist/tooltip/root/tooltip-root.d.ts +20 -3
- package/dist/tooltip/root/tooltip-root.js +18 -1
- package/dist/tour/back.d.ts +10 -0
- package/dist/tour/back.js +8 -0
- package/dist/tour/root/tour-root.d.ts +45 -2
- package/dist/tour/root/tour-root.js +53 -8
- package/dist/tour/stop/tour-stop.d.ts +3 -0
- package/dist/tour/stop/tour-stop.js +3 -3
- package/dist/tree/item/tree-item.d.ts +7 -3
- package/dist/tree/item/tree-item.js +3 -0
- package/dist/tree/root/tree-root.d.ts +24 -3
- package/dist/tree/root/tree-root.js +32 -13
- package/dist/tree/selection.js +2 -15
- package/dist/trend/figure.d.ts +16 -0
- package/dist/trend/figure.js +8 -0
- package/dist/trend/root/trend-root.d.ts +83 -19
- package/dist/trend/root/trend-root.js +59 -8
- package/dist/video/media-events.d.ts +13 -18
- package/dist/video/media-events.js +1 -5
- package/dist/video/root/extra-controls.d.ts +12 -0
- package/dist/video/root/extra-controls.js +6 -2
- package/dist/video/root/video-root.d.ts +23 -6
- package/dist/video/root/video-root.js +19 -10
- package/dist/video-playlist/menu/video-playlist-menu.d.ts +2 -0
- package/dist/video-playlist/menu/video-playlist-menu.js +2 -1
- package/dist/video-playlist/root/video-playlist-root.d.ts +17 -1
- package/dist/video-playlist/root/video-playlist-root.js +3 -0
- package/dist/virtual-list/fill.d.ts +11 -8
- package/dist/virtual-list/fill.js +10 -17
- package/dist/virtual-list/keys.d.ts +16 -7
- package/dist/virtual-list/keys.js +17 -6
- package/dist/virtual-list/plan.d.ts +65 -0
- package/dist/virtual-list/plan.js +27 -0
- package/dist/virtual-list/root/virtual-list-root.d.ts +136 -13
- package/dist/virtual-list/root/virtual-list-root.js +218 -51
- package/lint.json +1 -1
- package/package.json +8 -8
- package/types/jsx.d.ts +7441 -1458
- package/types/svelte.d.ts +1 -0
- package/types/vue.d.ts +1501 -326
- package/dist/chat/relative-clock.d.ts +0 -39
- package/dist/chat/relative-clock.js +0 -31
- package/dist/data-table/root/order.d.ts +0 -141
- package/dist/data-table/root/order.js +0 -76
- package/dist/tag/selection.d.ts +0 -10
- package/dist/tag/selection.js +0 -12
|
@@ -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
|
};
|
|
@@ -215,6 +245,15 @@ let HelixHeadlessCombobox = class HelixHeadlessCombobox extends MixinControllerO
|
|
|
215
245
|
get showing() {
|
|
216
246
|
return (this.listbox?.options ?? []).some((option) => !option.hidden);
|
|
217
247
|
}
|
|
248
|
+
markStatus() {
|
|
249
|
+
const list = this.listbox;
|
|
250
|
+
this.toggleState('error', this.loadError !== '');
|
|
251
|
+
this.toggleState('no-results', list !== null &&
|
|
252
|
+
!this.loading &&
|
|
253
|
+
list.filter !== '' &&
|
|
254
|
+
list.options.length > 0 &&
|
|
255
|
+
!this.showing);
|
|
256
|
+
}
|
|
218
257
|
get creation() {
|
|
219
258
|
const typed = this.typed.trim();
|
|
220
259
|
if (!this.creatable || typed === '') {
|
|
@@ -261,7 +300,9 @@ let HelixHeadlessCombobox = class HelixHeadlessCombobox extends MixinControllerO
|
|
|
261
300
|
return;
|
|
262
301
|
}
|
|
263
302
|
this.requestOpen(false);
|
|
303
|
+
this.refocusing = true;
|
|
264
304
|
this.partNamed('control')?.focus();
|
|
305
|
+
this.refocusing = false;
|
|
265
306
|
}
|
|
266
307
|
commitEmptied() {
|
|
267
308
|
if (this.emptied && !this.multiple && this.value !== '') {
|
|
@@ -316,6 +357,18 @@ let HelixHeadlessCombobox = class HelixHeadlessCombobox extends MixinControllerO
|
|
|
316
357
|
}
|
|
317
358
|
return false;
|
|
318
359
|
}
|
|
360
|
+
narrow(typed, inserted) {
|
|
361
|
+
this.narrowing.cancel();
|
|
362
|
+
const narrowing = new HelixFilterEvent({ value: typed });
|
|
363
|
+
if (this.dispatchEvent(narrowing)) {
|
|
364
|
+
this.listbox?.requestFilter(typed);
|
|
365
|
+
void this.listbox?.updateComplete.then(() => {
|
|
366
|
+
this.linkActive();
|
|
367
|
+
this.markStatus();
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
this.suggestion = this.suggest && inserted ? this.completionFor(typed) : '';
|
|
371
|
+
}
|
|
319
372
|
completionFor(typed) {
|
|
320
373
|
if (typed === '') {
|
|
321
374
|
return '';
|
|
@@ -393,6 +446,7 @@ let HelixHeadlessCombobox = class HelixHeadlessCombobox extends MixinControllerO
|
|
|
393
446
|
super.updated?.(changed);
|
|
394
447
|
this.sync();
|
|
395
448
|
this.linkActive();
|
|
449
|
+
void (this.listbox?.updateComplete ?? Promise.resolve()).then(() => this.markStatus());
|
|
396
450
|
const control = this.partNamed('control');
|
|
397
451
|
const wanted = this.fieldText;
|
|
398
452
|
if (control && control.value !== wanted) {
|
|
@@ -401,7 +455,7 @@ let HelixHeadlessCombobox = class HelixHeadlessCombobox extends MixinControllerO
|
|
|
401
455
|
if (control && this.suggestion !== '') {
|
|
402
456
|
control.setSelectionRange(this.typed.length, this.suggestion.length);
|
|
403
457
|
}
|
|
404
|
-
if (!this.open) {
|
|
458
|
+
if (!this.open && (this.openOn !== 'manual' || changed.has('open'))) {
|
|
405
459
|
this.typed = '';
|
|
406
460
|
this.suggestion = '';
|
|
407
461
|
this.editing = false;
|
|
@@ -420,7 +474,7 @@ let HelixHeadlessCombobox = class HelixHeadlessCombobox extends MixinControllerO
|
|
|
420
474
|
}
|
|
421
475
|
}
|
|
422
476
|
get fieldText() {
|
|
423
|
-
if (this.multiple || (this.open && this.editing)) {
|
|
477
|
+
if (this.multiple || ((this.open || this.openOn === 'manual') && this.editing)) {
|
|
424
478
|
return this.suggestion || this.typed;
|
|
425
479
|
}
|
|
426
480
|
return this.word;
|
|
@@ -429,13 +483,15 @@ let HelixHeadlessCombobox = class HelixHeadlessCombobox extends MixinControllerO
|
|
|
429
483
|
return html `<${this.tag('listbox')}
|
|
430
484
|
part="listbox"
|
|
431
485
|
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"
|
|
486
|
+
exportparts="empty: listbox-empty, error: listbox-error, feedback: listbox-feedback,
|
|
487
|
+
filter-icon: listbox-filter-icon, filter-mark: listbox-filter-mark, hint: listbox-hint,
|
|
488
|
+
items: listbox-items, label: listbox-label, live: listbox-live, loading: listbox-loading,
|
|
489
|
+
search: listbox-search, search-field: listbox-search-field"
|
|
436
490
|
aria-label=${this.listLabel}
|
|
437
491
|
empty-text=${this.emptyText}
|
|
492
|
+
load-error=${this.loadError}
|
|
438
493
|
loading-text=${this.loadingText}
|
|
494
|
+
no-results-text=${this.noResultsText ?? nothing}
|
|
439
495
|
result-label=${this.resultLabel}
|
|
440
496
|
results-label=${this.resultsLabel}
|
|
441
497
|
?loading=${this.loading}
|
|
@@ -457,6 +513,14 @@ let HelixHeadlessCombobox = class HelixHeadlessCombobox extends MixinControllerO
|
|
|
457
513
|
fills it, so the list's fallback would never show. -->
|
|
458
514
|
<slot name="empty" slot="empty">${this.emptyText}</slot>
|
|
459
515
|
<slot name="loading" slot="loading">${this.loadingText}</slot>
|
|
516
|
+
<slot name="error" slot="error">${this.loadError}</slot>
|
|
517
|
+
<!-- Handed on only while something fills it: an assigned slot hides the
|
|
518
|
+
list's own fallback, which is no-results-text or empty-text. -->
|
|
519
|
+
<slot
|
|
520
|
+
name="no-results"
|
|
521
|
+
slot=${this.querySelector?.(':scope > [slot="no-results"]') ? 'no-results' : nothing}
|
|
522
|
+
@slotchange=${() => this.requestUpdate()}
|
|
523
|
+
></slot>
|
|
460
524
|
</${this.tag('listbox')}>`;
|
|
461
525
|
}
|
|
462
526
|
renderTag(option) {
|
|
@@ -512,6 +576,7 @@ let HelixHeadlessCombobox = class HelixHeadlessCombobox extends MixinControllerO
|
|
|
512
576
|
?disabled=${this.isDisabled}
|
|
513
577
|
?readonly=${this.readOnly}
|
|
514
578
|
.value=${this.fieldText}
|
|
579
|
+
@focus=${this.handleFocus}
|
|
515
580
|
@input=${this.handleInput}
|
|
516
581
|
@keydown=${this.handleKeydown}
|
|
517
582
|
@keypress=${this.handleKeypress}
|
|
@@ -541,9 +606,15 @@ __decorate([
|
|
|
541
606
|
__decorate([
|
|
542
607
|
property({ attribute: 'empty-text' })
|
|
543
608
|
], HelixHeadlessCombobox.prototype, "emptyText", void 0);
|
|
609
|
+
__decorate([
|
|
610
|
+
property({ attribute: 'filter-delay', type: Number })
|
|
611
|
+
], HelixHeadlessCombobox.prototype, "filterDelay", void 0);
|
|
544
612
|
__decorate([
|
|
545
613
|
property({ attribute: 'list-label' })
|
|
546
614
|
], HelixHeadlessCombobox.prototype, "listLabel", void 0);
|
|
615
|
+
__decorate([
|
|
616
|
+
property({ attribute: 'load-error' })
|
|
617
|
+
], HelixHeadlessCombobox.prototype, "loadError", void 0);
|
|
547
618
|
__decorate([
|
|
548
619
|
property({ reflect: true, type: Boolean })
|
|
549
620
|
], HelixHeadlessCombobox.prototype, "loading", void 0);
|
|
@@ -553,6 +624,12 @@ __decorate([
|
|
|
553
624
|
__decorate([
|
|
554
625
|
property({ type: Boolean })
|
|
555
626
|
], HelixHeadlessCombobox.prototype, "multiple", void 0);
|
|
627
|
+
__decorate([
|
|
628
|
+
property({ attribute: 'no-results-text' })
|
|
629
|
+
], HelixHeadlessCombobox.prototype, "noResultsText", void 0);
|
|
630
|
+
__decorate([
|
|
631
|
+
property({ attribute: 'open-on' })
|
|
632
|
+
], HelixHeadlessCombobox.prototype, "openOn", void 0);
|
|
556
633
|
__decorate([
|
|
557
634
|
property()
|
|
558
635
|
], 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.
|
|
@@ -77,7 +81,9 @@ export declare class HelixHeadlessCommand extends HelixHeadlessCommand_base {
|
|
|
77
81
|
*/
|
|
78
82
|
filterDelay: number;
|
|
79
83
|
/**
|
|
80
|
-
* The key that opens the palette, written as `mod+k`, `shift+p`, or `k
|
|
84
|
+
* The key that opens the palette, written as `mod+k`, `shift+p`, or `k`,
|
|
85
|
+
* in Kbd's chord spelling: `mod` is Command or Control, `ctrl`, `cmd`,
|
|
86
|
+
* `alt` and `shift` the keys they name.
|
|
81
87
|
*
|
|
82
88
|
* Empty turns it off, for a consumer who opens the palette from a button or
|
|
83
89
|
* from their own shortcut handler. There is no list of defaults to fight
|
|
@@ -88,6 +94,12 @@ export declare class HelixHeadlessCommand extends HelixHeadlessCommand_base {
|
|
|
88
94
|
* Accessible name for the overlay, which has no visible heading.
|
|
89
95
|
*/
|
|
90
96
|
label: string;
|
|
97
|
+
/**
|
|
98
|
+
* What the list says when its commands could not be loaded, such as after a
|
|
99
|
+
* request to a server fails. Empty is no error. Passed to the list, which
|
|
100
|
+
* shows it under any commands there are and tells screen readers.
|
|
101
|
+
*/
|
|
102
|
+
loadError: string;
|
|
91
103
|
/**
|
|
92
104
|
* Whether the commands are still loading, for a palette that asks a server
|
|
93
105
|
* for them as the user types.
|
|
@@ -99,6 +111,11 @@ export declare class HelixHeadlessCommand extends HelixHeadlessCommand_base {
|
|
|
99
111
|
* The text shown while the commands load.
|
|
100
112
|
*/
|
|
101
113
|
loadingText: string;
|
|
114
|
+
/**
|
|
115
|
+
* The text shown when typing hides every one of the commands, where there are
|
|
116
|
+
* some. Absent, `empty-text` shows. See Listbox's `no-results-text`.
|
|
117
|
+
*/
|
|
118
|
+
noResultsText?: string;
|
|
102
119
|
/**
|
|
103
120
|
* The text shown in the filter field before anything is typed.
|
|
104
121
|
*/
|
|
@@ -4,20 +4,12 @@ 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 { customElement, HelixElement, HelixSelectEvent, MixinControllerOpen, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { customElement, HelixElement, HelixSelectEvent, MixinControllerOpen, matchesChord, } from '@fusion.dev/helix-core';
|
|
8
|
+
import { nothing } from 'lit';
|
|
8
9
|
import { property, state } from 'lit/decorators.js';
|
|
9
10
|
import { html } from 'lit/static-html.js';
|
|
10
11
|
import '../../dialog/index.js';
|
|
11
12
|
import '../../listbox/index.js';
|
|
12
|
-
const parse = (hotkey) => {
|
|
13
|
-
const parts = hotkey.toLowerCase().split('+');
|
|
14
|
-
return {
|
|
15
|
-
alt: parts.includes('alt'),
|
|
16
|
-
key: parts.at(-1) ?? '',
|
|
17
|
-
mod: parts.includes('mod'),
|
|
18
|
-
shift: parts.includes('shift'),
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
13
|
let HelixHeadlessCommand = class HelixHeadlessCommand extends MixinControllerOpen(HelixElement) {
|
|
22
14
|
constructor() {
|
|
23
15
|
super(...arguments);
|
|
@@ -25,6 +17,7 @@ let HelixHeadlessCommand = class HelixHeadlessCommand extends MixinControllerOpe
|
|
|
25
17
|
this.filterDelay = 0;
|
|
26
18
|
this.hotkey = 'mod+k';
|
|
27
19
|
this.label = 'Commands';
|
|
20
|
+
this.loadError = '';
|
|
28
21
|
this.loading = false;
|
|
29
22
|
this.loadingText = 'Loading';
|
|
30
23
|
this.placeholder = 'Search commands';
|
|
@@ -32,15 +25,7 @@ let HelixHeadlessCommand = class HelixHeadlessCommand extends MixinControllerOpe
|
|
|
32
25
|
this.resultsLabel = '{count} commands';
|
|
33
26
|
this.footed = false;
|
|
34
27
|
this.handleHotkey = (event) => {
|
|
35
|
-
if (this.hotkey
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
const wanted = parse(this.hotkey);
|
|
39
|
-
const mod = event.metaKey || event.ctrlKey;
|
|
40
|
-
if (event.key.toLowerCase() !== wanted.key ||
|
|
41
|
-
mod !== wanted.mod ||
|
|
42
|
-
event.shiftKey !== wanted.shift ||
|
|
43
|
-
event.altKey !== wanted.alt) {
|
|
28
|
+
if (!matchesChord(event, this.hotkey, true) && !matchesChord(event, this.hotkey, false)) {
|
|
44
29
|
return;
|
|
45
30
|
}
|
|
46
31
|
event.preventDefault();
|
|
@@ -150,15 +135,17 @@ let HelixHeadlessCommand = class HelixHeadlessCommand extends MixinControllerOpe
|
|
|
150
135
|
>
|
|
151
136
|
<${this.tag('listbox')}
|
|
152
137
|
part="listbox"
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
138
|
+
exportparts="empty: listbox-empty, error: listbox-error, feedback: listbox-feedback,
|
|
139
|
+
filter-icon: listbox-filter-icon, filter-mark: listbox-filter-mark, hint: listbox-hint,
|
|
140
|
+
items: listbox-items, label: listbox-label, live: listbox-live, loading: listbox-loading,
|
|
141
|
+
search: listbox-search, search-field: listbox-search-field"
|
|
157
142
|
aria-label=${this.label}
|
|
158
143
|
empty-text=${this.emptyText}
|
|
159
144
|
filter-delay=${this.filterDelay}
|
|
160
145
|
filter-label=${this.placeholder}
|
|
146
|
+
load-error=${this.loadError}
|
|
161
147
|
loading-text=${this.loadingText}
|
|
148
|
+
no-results-text=${this.noResultsText ?? nothing}
|
|
162
149
|
result-label=${this.resultLabel}
|
|
163
150
|
results-label=${this.resultsLabel}
|
|
164
151
|
?loading=${this.loading}
|
|
@@ -172,6 +159,14 @@ let HelixHeadlessCommand = class HelixHeadlessCommand extends MixinControllerOpe
|
|
|
172
159
|
gives: the list's own fallback never shows behind a passed slot. -->
|
|
173
160
|
<slot name="empty" slot="empty">${this.emptyText}</slot>
|
|
174
161
|
<slot name="loading" slot="loading">${this.loadingText}</slot>
|
|
162
|
+
<slot name="error" slot="error">${this.loadError}</slot>
|
|
163
|
+
<!-- Handed on only while something fills it: an assigned slot hides the
|
|
164
|
+
list's own fallback, which is no-results-text or empty-text. -->
|
|
165
|
+
<slot
|
|
166
|
+
name="no-results"
|
|
167
|
+
slot=${this.querySelector?.(':scope > [slot="no-results"]') ? 'no-results' : nothing}
|
|
168
|
+
@slotchange=${() => this.requestUpdate()}
|
|
169
|
+
></slot>
|
|
175
170
|
</${this.tag('listbox')}>
|
|
176
171
|
<div ?hidden=${!this.footed} part="footer" slot="footer">
|
|
177
172
|
<slot
|
|
@@ -199,12 +194,18 @@ __decorate([
|
|
|
199
194
|
__decorate([
|
|
200
195
|
property()
|
|
201
196
|
], HelixHeadlessCommand.prototype, "label", void 0);
|
|
197
|
+
__decorate([
|
|
198
|
+
property({ attribute: 'load-error' })
|
|
199
|
+
], HelixHeadlessCommand.prototype, "loadError", void 0);
|
|
202
200
|
__decorate([
|
|
203
201
|
property({ reflect: true, type: Boolean })
|
|
204
202
|
], HelixHeadlessCommand.prototype, "loading", void 0);
|
|
205
203
|
__decorate([
|
|
206
204
|
property({ attribute: 'loading-text' })
|
|
207
205
|
], HelixHeadlessCommand.prototype, "loadingText", void 0);
|
|
206
|
+
__decorate([
|
|
207
|
+
property({ attribute: 'no-results-text' })
|
|
208
|
+
], HelixHeadlessCommand.prototype, "noResultsText", void 0);
|
|
208
209
|
__decorate([
|
|
209
210
|
property()
|
|
210
211
|
], HelixHeadlessCommand.prototype, "placeholder", void 0);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type TemplateResult } from 'lit';
|
|
1
|
+
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
2
2
|
import { HelixHeadlessIconButton } from '../../icon-button/root/icon-button-root.js';
|
|
3
3
|
import '../../tooltip/index.js';
|
|
4
4
|
/**
|
|
@@ -26,6 +26,12 @@ import '../../tooltip/index.js';
|
|
|
26
26
|
* rendered. An `aria-label` on the element names it before a copy, in place of
|
|
27
27
|
* `label`.
|
|
28
28
|
*
|
|
29
|
+
* **Keyboard.** Enter and Space copy, as they press a native button.
|
|
30
|
+
*
|
|
31
|
+
* The button is named `label`, or the host's `aria-label`, and its name
|
|
32
|
+
* changes to `copied-label` or `error-label` for the moment after a press,
|
|
33
|
+
* which is what a screen reader on it hears. The tooltip shows the same words.
|
|
34
|
+
*
|
|
29
35
|
* @since 0.1.0
|
|
30
36
|
* @status stable
|
|
31
37
|
* @category actions
|
|
@@ -42,6 +48,7 @@ import '../../tooltip/index.js';
|
|
|
42
48
|
* @csspart button - The inner button.
|
|
43
49
|
* @csspart live - The live region that says `pending-label` when the button becomes pending under focus. It is rendered from the first time the button is pending.
|
|
44
50
|
* @csspart mark - The clipboard icon, and the confirmation icon that replaces it.
|
|
51
|
+
* @csspart spinner - The ring a pending button turns, an empty element the styled button draws over the icon. It is rendered only while the button is pending.
|
|
45
52
|
* @csspart tooltip - The tooltip bubble, forwarded from the tooltip inside the button.
|
|
46
53
|
* @csspart tooltip-arrow - The tooltip's arrow, which points at the button.
|
|
47
54
|
* @csspart tooltip-arrow-bottom - The arrow while the bubble is below the button, on the bubble's top edge. Set together with `tooltip-arrow`.
|
|
@@ -52,6 +59,13 @@ import '../../tooltip/index.js';
|
|
|
52
59
|
* @csspart tooltip-left - The bubble while it is left of the button. Set together with `tooltip`.
|
|
53
60
|
* @csspart tooltip-right - The bubble while it is right of the button. Set together with `tooltip`.
|
|
54
61
|
* @csspart tooltip-top - The bubble while it is above the button. Set together with `tooltip`.
|
|
62
|
+
*
|
|
63
|
+
* @cssstate copied - The moment after a successful copy, while `copied-label` names the button.
|
|
64
|
+
* @cssstate failed - The moment after a press that put nothing on the clipboard, while `error-label` names the button.
|
|
65
|
+
*
|
|
66
|
+
* @withheld csspart text - Button's words, which this does not render: the label is the icon's name.
|
|
67
|
+
* @withheld slot end - Button's, which this does not render.
|
|
68
|
+
* @withheld slot start - Button's, which this does not render.
|
|
55
69
|
*/
|
|
56
70
|
export declare class HelixHeadlessCopyButton extends HelixHeadlessIconButton {
|
|
57
71
|
/**
|
|
@@ -66,6 +80,11 @@ export declare class HelixHeadlessCopyButton extends HelixHeadlessIconButton {
|
|
|
66
80
|
* clipboard.
|
|
67
81
|
*/
|
|
68
82
|
errorLabel: string;
|
|
83
|
+
/**
|
|
84
|
+
* How long the confirmation or the failure stands, in milliseconds, before
|
|
85
|
+
* the button goes back to `label`.
|
|
86
|
+
*/
|
|
87
|
+
feedbackDuration: number;
|
|
69
88
|
/**
|
|
70
89
|
* The element to copy from, by its id: `key` for its text, `key[value]` for
|
|
71
90
|
* an attribute, and `key.value` for a property. Read at the press, and used
|
|
@@ -130,6 +149,7 @@ export declare class HelixHeadlessCopyButton extends HelixHeadlessIconButton {
|
|
|
130
149
|
* cover the confirmation.
|
|
131
150
|
*/
|
|
132
151
|
protected get forwardsLabel(): boolean;
|
|
152
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
133
153
|
/** @internal A copy button never submits, so it is no form's default button. */
|
|
134
154
|
protected get submitsForm(): boolean;
|
|
135
155
|
/**
|
|
@@ -14,17 +14,17 @@ import { html } from 'lit/static-html.js';
|
|
|
14
14
|
import { HelixHeadlessIconButton } from '../../icon-button/root/icon-button-root.js';
|
|
15
15
|
import { readFrom } from '../from.js';
|
|
16
16
|
import '../../tooltip/index.js';
|
|
17
|
-
const CONFIRM = 1600;
|
|
18
17
|
let HelixHeadlessCopyButton = HelixHeadlessCopyButton_1 = class HelixHeadlessCopyButton extends HelixHeadlessIconButton {
|
|
19
18
|
constructor() {
|
|
20
19
|
super(...arguments);
|
|
21
20
|
this.copiedLabel = 'Copied';
|
|
22
21
|
this.errorLabel = 'Could not copy';
|
|
22
|
+
this.feedbackDuration = 1600;
|
|
23
23
|
this.from = '';
|
|
24
24
|
this.label = 'Copy';
|
|
25
25
|
this.value = '';
|
|
26
26
|
this.namedBy = null;
|
|
27
|
-
this.clipboard = new CopyController(this, { after:
|
|
27
|
+
this.clipboard = new CopyController(this, { after: () => this.feedbackDuration });
|
|
28
28
|
this.handleCopy = async (event) => {
|
|
29
29
|
if (this.pending) {
|
|
30
30
|
event.preventDefault();
|
|
@@ -34,7 +34,9 @@ let HelixHeadlessCopyButton = HelixHeadlessCopyButton_1 = class HelixHeadlessCop
|
|
|
34
34
|
if (this.isDisabled) {
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
|
-
const
|
|
37
|
+
const copying = this.clipboard.copy(this.text);
|
|
38
|
+
this.announcePress(event);
|
|
39
|
+
const wrote = await copying;
|
|
38
40
|
if (!wrote && this.isConnected) {
|
|
39
41
|
this.dispatchEvent(new HelixCopyErrorEvent());
|
|
40
42
|
}
|
|
@@ -49,6 +51,11 @@ let HelixHeadlessCopyButton = HelixHeadlessCopyButton_1 = class HelixHeadlessCop
|
|
|
49
51
|
get forwardsLabel() {
|
|
50
52
|
return false;
|
|
51
53
|
}
|
|
54
|
+
willUpdate(changed) {
|
|
55
|
+
super.willUpdate(changed);
|
|
56
|
+
this.toggleState('copied', this.copied);
|
|
57
|
+
this.toggleState('failed', this.failed);
|
|
58
|
+
}
|
|
52
59
|
get submitsForm() {
|
|
53
60
|
return false;
|
|
54
61
|
}
|
|
@@ -78,8 +85,10 @@ let HelixHeadlessCopyButton = HelixHeadlessCopyButton_1 = class HelixHeadlessCop
|
|
|
78
85
|
tabindex=${this.focusable ? nothing : '-1'}
|
|
79
86
|
?disabled=${this.isDisabled}
|
|
80
87
|
@click=${this.handleCopy}
|
|
88
|
+
@keydown=${this.notePress}
|
|
89
|
+
@pointerdown=${this.notePress}
|
|
81
90
|
>
|
|
82
|
-
${this.renderCopiedIcon()} ${this.renderFailedIcon()} ${this.renderCopyIcon()}
|
|
91
|
+
${this.renderCopiedIcon()} ${this.renderFailedIcon()} ${this.renderCopyIcon()}${this.renderSpinner()}
|
|
83
92
|
</button>`)}${this.renderLive()}`;
|
|
84
93
|
}
|
|
85
94
|
renderCopyIcon() {
|
|
@@ -113,6 +122,9 @@ __decorate([
|
|
|
113
122
|
__decorate([
|
|
114
123
|
property({ attribute: 'error-label' })
|
|
115
124
|
], HelixHeadlessCopyButton.prototype, "errorLabel", void 0);
|
|
125
|
+
__decorate([
|
|
126
|
+
property({ attribute: 'feedback-duration', type: Number })
|
|
127
|
+
], HelixHeadlessCopyButton.prototype, "feedbackDuration", void 0);
|
|
116
128
|
__decorate([
|
|
117
129
|
property()
|
|
118
130
|
], HelixHeadlessCopyButton.prototype, "from", void 0);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
+
export { type Axis, cycle, type DataRow, filter, format, ordered, parse, type Sort, sort, window_, } from '@fusion.dev/helix-core';
|
|
1
2
|
export { HelixHeadlessDataTable } from './root/data-table-root.js';
|
|
2
|
-
export { type Axis, cycle, type DataRow, filter, format, ordered, parse, type Sort, sort, window_, } from './root/order.js';
|
package/dist/data-table/index.js
CHANGED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `expanded` a toggle of row `key` leaves, in row order, or `undefined`
|
|
3
|
+
* where the row is open or closed already. Keys are split on commas only, so a
|
|
4
|
+
* key may hold a space.
|
|
5
|
+
*/
|
|
6
|
+
export declare const toggledOpen: (expanded: string, key: string, open: boolean, order: readonly string[]) => string | undefined;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { commaList, inRowOrder } from '@fusion.dev/helix-core';
|
|
2
|
+
export const toggledOpen = (expanded, key, open, order) => {
|
|
3
|
+
const keys = new Set(commaList(expanded));
|
|
4
|
+
if (keys.has(key) === open) {
|
|
5
|
+
return undefined;
|
|
6
|
+
}
|
|
7
|
+
if (open) {
|
|
8
|
+
keys.add(key);
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
keys.delete(key);
|
|
12
|
+
}
|
|
13
|
+
return inRowOrder(keys, order).join(',');
|
|
14
|
+
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { HelixElement } from '@fusion.dev/helix-core';
|
|
1
|
+
import { type DataRow, HelixElement } from '@fusion.dev/helix-core';
|
|
2
2
|
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
3
3
|
import { type HelixHeadlessTableColumn } from '../../table/column/table-column.js';
|
|
4
4
|
import '../../checkbox/index.js';
|
|
5
5
|
import '../../pagination/index.js';
|
|
6
|
-
import { type DataRow } from './order.js';
|
|
7
6
|
declare const HelixHeadlessDataTable_base: (new (...args: any[]) => import("@fusion.dev/helix-core").CollectionElement) & typeof HelixElement;
|
|
8
7
|
/**
|
|
9
8
|
* @summary A table drawn from an array of rows, with sorting, filtering, and paging.
|
|
@@ -44,20 +43,29 @@ declare const HelixHeadlessDataTable_base: (new (...args: any[]) => import("@fus
|
|
|
44
43
|
*
|
|
45
44
|
* To act on a single row, such as opening it, put a link or a button in a cell.
|
|
46
45
|
*
|
|
47
|
-
* The grid is one tab stop, and the arrow keys move between its
|
|
48
|
-
* headings included
|
|
46
|
+
* **Keyboard.** The grid is one tab stop, and the arrow keys move between its
|
|
47
|
+
* cells, the headings included.
|
|
49
48
|
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
49
|
+
* | Key | What it does |
|
|
50
|
+
* |---|---|
|
|
51
|
+
* | Right, Left | Moves one cell along the row. Left moves on, on a right-to-left page. |
|
|
52
|
+
* | Down, Up | Moves one row, the heading row and the `load-more` row included. |
|
|
53
|
+
* | Home, End | Moves to the first or the last cell of the row. |
|
|
54
|
+
* | Control with Home or End | Moves to the first or the last cell of the grid. |
|
|
55
|
+
* | Page Down, Page Up | Moves by the rows that fit in view. |
|
|
56
|
+
* | Enter, F2 | Moves into the cell's controls. Escape moves back to the cell, and Tab moves between the controls of one cell. |
|
|
57
|
+
* | Enter, Space on a sortable heading | Sorts by the column. |
|
|
58
|
+
* | Enter, Space on the `load-more` row | Sends `helix-load-more`. |
|
|
59
|
+
* | Space on a row | Selects the row, in a `selectable` table. |
|
|
60
|
+
* | Shift with Down or Up | Selects the rows it moves across, in a `selectable` table. |
|
|
61
|
+
* | Shift with Space | Selects every row from the one last chosen, in a `selectable` table. |
|
|
62
|
+
* | Control or Command with A | Selects every row, in a `selectable` table. |
|
|
63
|
+
* | Right on a row header in a tree grid | Opens a closed row, and moves one cell along an open one. |
|
|
64
|
+
* | Left on a row header in a tree grid | Closes an open row, and moves to the parent of a closed one. |
|
|
65
|
+
* | A letter or a word | Moves to the next row whose row header starts with what you typed. |
|
|
66
|
+
*
|
|
67
|
+
* `selected` and `expanded` hold their keys in the order of the rows, as do
|
|
68
|
+
* `helix-select`, `helix-selected` and `helix-expand`.
|
|
61
69
|
*
|
|
62
70
|
* Each row is named by its row header, the column marked `row-header`, or the
|
|
63
71
|
* first column with a `field` where none is. A screen reader says it as a reader
|
|
@@ -485,8 +493,6 @@ export declare class HelixHeadlessDataTable extends HelixHeadlessDataTable_base
|
|
|
485
493
|
private anchorKey;
|
|
486
494
|
/** Whether Shift was held on the last press, for a checkbox that asks to range. */
|
|
487
495
|
private shiftPressed;
|
|
488
|
-
/** The number of rows when `helix-load-more` last went out on its own. */
|
|
489
|
-
private askedAt;
|
|
490
496
|
/** The grid's size as the last render counted it, for the internals. */
|
|
491
497
|
private counts;
|
|
492
498
|
/** The order while a grip is being dragged, before anybody has been asked. */
|
|
@@ -540,7 +546,10 @@ export declare class HelixHeadlessDataTable extends HelixHeadlessDataTable_base
|
|
|
540
546
|
* sorts them.
|
|
541
547
|
*/
|
|
542
548
|
private tree;
|
|
543
|
-
/**
|
|
549
|
+
/**
|
|
550
|
+
* The keys of the open rows. Split on commas only, as every other list of
|
|
551
|
+
* keys is, so a key may hold a space.
|
|
552
|
+
*/
|
|
544
553
|
private get opened();
|
|
545
554
|
/**
|
|
546
555
|
* The result in order: the tree laid out flat in a tree grid, and the
|