@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, HelixFormElement, hostAria, MixinControllerOpen, MixinControllerValue, MixinField, PopoverController, reportValues, typesCharacter, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { AriaForwardController, afterLinkFollowed, customElement, HelixFormElement, hostAria, hostWords, isRtl, MixinControllerOpen, MixinControllerValue, MixinField, PopoverController, reportValues, typesCharacter, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { caretDown } from '@fusion.dev/helix-icons';
|
|
9
9
|
import { nothing } from 'lit';
|
|
10
10
|
import { property } from 'lit/decorators.js';
|
|
@@ -12,6 +12,7 @@ import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
|
|
|
12
12
|
import { html } from 'lit/static-html.js';
|
|
13
13
|
import { optionsAmong } from '../../option/root/option-root.js';
|
|
14
14
|
import '../../listbox/index.js';
|
|
15
|
+
import { over } from '../align.js';
|
|
15
16
|
let HelixHeadlessSelect = class HelixHeadlessSelect extends MixinControllerOpen(MixinControllerValue(MixinField(HelixFormElement))) {
|
|
16
17
|
constructor() {
|
|
17
18
|
super(...arguments);
|
|
@@ -24,10 +25,13 @@ let HelixHeadlessSelect = class HelixHeadlessSelect extends MixinControllerOpen(
|
|
|
24
25
|
});
|
|
25
26
|
this.emptyText = 'No matches';
|
|
26
27
|
this.filterable = false;
|
|
28
|
+
this.focusable = true;
|
|
29
|
+
this.listLabel = 'Options';
|
|
27
30
|
this.loading = false;
|
|
28
31
|
this.loadingText = 'Loading';
|
|
29
32
|
this.multiple = false;
|
|
30
33
|
this.placeholder = 'Choose';
|
|
34
|
+
this.position = 'floating';
|
|
31
35
|
this.panel = new PopoverController(this, {
|
|
32
36
|
anchor: () => this.partNamed('trigger'),
|
|
33
37
|
boundary: () => [
|
|
@@ -37,6 +41,7 @@ let HelixHeadlessSelect = class HelixHeadlessSelect extends MixinControllerOpen(
|
|
|
37
41
|
offset: () => 4,
|
|
38
42
|
onDismiss: () => this.close(),
|
|
39
43
|
open: () => this.open,
|
|
44
|
+
place: () => this.position !== 'item-aligned',
|
|
40
45
|
placement: 'bottom-start',
|
|
41
46
|
surface: () => this.partNamed('surface'),
|
|
42
47
|
});
|
|
@@ -46,6 +51,45 @@ let HelixHeadlessSelect = class HelixHeadlessSelect extends MixinControllerOpen(
|
|
|
46
51
|
this.handleLinkFollowed = (event) => {
|
|
47
52
|
afterLinkFollowed(event, () => this.requestOpen(false));
|
|
48
53
|
};
|
|
54
|
+
this.alignOver = () => {
|
|
55
|
+
const surface = this.partNamed('surface');
|
|
56
|
+
const trigger = this.partNamed('trigger');
|
|
57
|
+
if (!this.open || this.position !== 'item-aligned' || !surface || !trigger) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const margin = 8;
|
|
61
|
+
const at = trigger.getBoundingClientRect();
|
|
62
|
+
surface.style.setProperty('--floating-anchor-inline-size', `${Math.round(at.width)}px`);
|
|
63
|
+
surface.style.setProperty('--floating-available-block-size', `${Math.max(0, window.innerHeight - margin * 2)}px`);
|
|
64
|
+
const shown = optionsAmong(this.knownChildren).filter((option) => !option.hidden);
|
|
65
|
+
this.alignedTo ??= shown.find((one) => one.active) ?? this.chosenOptions[0] ?? shown[0];
|
|
66
|
+
const option = this.alignedTo;
|
|
67
|
+
const box = surface.getBoundingClientRect();
|
|
68
|
+
const scale = surface.offsetHeight > 0 ? box.height / surface.offsetHeight : 1;
|
|
69
|
+
const row = option?.getBoundingClientRect();
|
|
70
|
+
const { left, top } = over({
|
|
71
|
+
margin,
|
|
72
|
+
option: row
|
|
73
|
+
? { height: row.height / scale, top: (row.top - box.top) / scale }
|
|
74
|
+
: { height: 0, top: 0 },
|
|
75
|
+
panel: { height: surface.offsetHeight, width: surface.offsetWidth },
|
|
76
|
+
rtl: isRtl(this),
|
|
77
|
+
trigger: at,
|
|
78
|
+
viewport: { height: window.innerHeight, width: window.innerWidth },
|
|
79
|
+
});
|
|
80
|
+
for (const [edge, value] of [
|
|
81
|
+
['bottom', 'auto'],
|
|
82
|
+
['left', '0'],
|
|
83
|
+
['right', 'auto'],
|
|
84
|
+
['top', '0'],
|
|
85
|
+
]) {
|
|
86
|
+
surface.style.setProperty(edge, value, 'important');
|
|
87
|
+
}
|
|
88
|
+
surface.style.position = 'fixed';
|
|
89
|
+
surface.style.translate = `${left}px ${top}px`;
|
|
90
|
+
surface.setAttribute('data-placed', '');
|
|
91
|
+
};
|
|
92
|
+
this.alignedTo = undefined;
|
|
49
93
|
this.handleChange = (event) => {
|
|
50
94
|
const next = event.detail.value;
|
|
51
95
|
if (!this.requestValue(next)) {
|
|
@@ -138,16 +182,24 @@ let HelixHeadlessSelect = class HelixHeadlessSelect extends MixinControllerOpen(
|
|
|
138
182
|
}
|
|
139
183
|
disconnectedCallback() {
|
|
140
184
|
super.disconnectedCallback();
|
|
185
|
+
this.stopAligning();
|
|
141
186
|
this.removeEventListener('helix-select', this.handleLinkFollowed);
|
|
142
187
|
for (const watcher of this.watchers) {
|
|
143
188
|
watcher.disconnect();
|
|
144
189
|
}
|
|
145
190
|
this.watchers = [];
|
|
146
191
|
}
|
|
192
|
+
stopAligning() {
|
|
193
|
+
window.removeEventListener('resize', this.alignOver);
|
|
194
|
+
window.removeEventListener('scroll', this.alignOver, { capture: true });
|
|
195
|
+
}
|
|
147
196
|
openAt(where) {
|
|
148
197
|
this.opening = where;
|
|
149
198
|
this.requestOpen(true);
|
|
150
199
|
}
|
|
200
|
+
focus(options) {
|
|
201
|
+
this.partNamed('trigger')?.focus(options);
|
|
202
|
+
}
|
|
151
203
|
close() {
|
|
152
204
|
if (!this.open) {
|
|
153
205
|
return;
|
|
@@ -202,9 +254,16 @@ let HelixHeadlessSelect = class HelixHeadlessSelect extends MixinControllerOpen(
|
|
|
202
254
|
this.listbox?.highlight(this.opening);
|
|
203
255
|
this.opening = 'selected';
|
|
204
256
|
this.listbox?.focus();
|
|
257
|
+
if (this.position === 'item-aligned') {
|
|
258
|
+
this.alignedTo = undefined;
|
|
259
|
+
void this.listbox?.updateComplete.then(() => this.alignOver());
|
|
260
|
+
window.addEventListener('resize', this.alignOver);
|
|
261
|
+
window.addEventListener('scroll', this.alignOver, { capture: true, passive: true });
|
|
262
|
+
}
|
|
205
263
|
}
|
|
206
264
|
}
|
|
207
265
|
else {
|
|
266
|
+
this.stopAligning();
|
|
208
267
|
this.listbox?.requestFilter('');
|
|
209
268
|
}
|
|
210
269
|
}
|
|
@@ -214,15 +273,15 @@ let HelixHeadlessSelect = class HelixHeadlessSelect extends MixinControllerOpen(
|
|
|
214
273
|
loading-text=${this.loadingText}
|
|
215
274
|
?loading=${this.loading}
|
|
216
275
|
part="listbox"
|
|
217
|
-
exportparts="empty: listbox-empty,
|
|
218
|
-
filter-
|
|
219
|
-
label: listbox-label, live: listbox-live, loading: listbox-loading,
|
|
220
|
-
search-field: listbox-search-field"
|
|
276
|
+
exportparts="empty: listbox-empty, error: listbox-error, feedback: listbox-feedback,
|
|
277
|
+
filter-icon: listbox-filter-icon, filter-mark: listbox-filter-mark, hint: listbox-hint,
|
|
278
|
+
items: listbox-items, label: listbox-label, live: listbox-live, loading: listbox-loading,
|
|
279
|
+
search: listbox-search, search-field: listbox-search-field"
|
|
221
280
|
.value=${this.value}
|
|
222
281
|
?multiple=${this.multiple}
|
|
223
282
|
?filterable=${this.filterable}
|
|
224
283
|
manual
|
|
225
|
-
aria-label=${this.
|
|
284
|
+
aria-label=${this.listName || this.listLabel || nothing}
|
|
226
285
|
@keydown=${this.handleListKeydown}
|
|
227
286
|
@helix-before-change=${this.handleChange}
|
|
228
287
|
@change=${this.stopInner}
|
|
@@ -240,6 +299,9 @@ let HelixHeadlessSelect = class HelixHeadlessSelect extends MixinControllerOpen(
|
|
|
240
299
|
</svg>
|
|
241
300
|
</slot>`;
|
|
242
301
|
}
|
|
302
|
+
get listName() {
|
|
303
|
+
return hostWords(this, this.label);
|
|
304
|
+
}
|
|
243
305
|
get triggerNames() {
|
|
244
306
|
const outside = (this.internals.labels?.length ?? 0) > 0 && !this.labeled;
|
|
245
307
|
if (this.hasAttribute('aria-labelledby') || outside) {
|
|
@@ -258,6 +320,7 @@ let HelixHeadlessSelect = class HelixHeadlessSelect extends MixinControllerOpen(
|
|
|
258
320
|
aria-expanded=${this.open ? 'true' : 'false'}
|
|
259
321
|
aria-describedby=${this.describedBy ?? nothing}
|
|
260
322
|
aria-invalid=${this.invalidity ?? nothing}
|
|
323
|
+
tabindex=${this.focusable ? nothing : '-1'}
|
|
261
324
|
?disabled=${this.isDisabled}
|
|
262
325
|
@click=${() => this.toggleOpen()}
|
|
263
326
|
@keydown=${this.handleTriggerKeydown}
|
|
@@ -282,6 +345,12 @@ __decorate([
|
|
|
282
345
|
__decorate([
|
|
283
346
|
property({ reflect: true, type: Boolean })
|
|
284
347
|
], HelixHeadlessSelect.prototype, "filterable", void 0);
|
|
348
|
+
__decorate([
|
|
349
|
+
property({ attribute: false })
|
|
350
|
+
], HelixHeadlessSelect.prototype, "focusable", void 0);
|
|
351
|
+
__decorate([
|
|
352
|
+
property({ attribute: 'list-label' })
|
|
353
|
+
], HelixHeadlessSelect.prototype, "listLabel", void 0);
|
|
285
354
|
__decorate([
|
|
286
355
|
property({ reflect: true, type: Boolean })
|
|
287
356
|
], HelixHeadlessSelect.prototype, "loading", void 0);
|
|
@@ -294,6 +363,9 @@ __decorate([
|
|
|
294
363
|
__decorate([
|
|
295
364
|
property()
|
|
296
365
|
], HelixHeadlessSelect.prototype, "placeholder", void 0);
|
|
366
|
+
__decorate([
|
|
367
|
+
property()
|
|
368
|
+
], HelixHeadlessSelect.prototype, "position", void 0);
|
|
297
369
|
__decorate([
|
|
298
370
|
property({ attribute: false })
|
|
299
371
|
], HelixHeadlessSelect.prototype, "valueContent", void 0);
|
|
@@ -31,7 +31,10 @@ import { type PropertyValues, type TemplateResult } from 'lit';
|
|
|
31
31
|
* @slot - The content the skeleton stands in for, which sizes it. Optional.
|
|
32
32
|
*
|
|
33
33
|
* @csspart content - The box around the content, inert while `loading`.
|
|
34
|
+
* @csspart sheen - The highlight inside the shape, which the styled tier sweeps across it. Empty, and drawn by no rule on this tier.
|
|
34
35
|
* @csspart skeleton - The placeholder shape.
|
|
36
|
+
*
|
|
37
|
+
* @cssstate wrapping - The skeleton holds content, an element or words, and takes that content's size. Line breaks and spaces alone are not content.
|
|
35
38
|
*/
|
|
36
39
|
export declare class HelixHeadlessSkeleton extends HelixElement {
|
|
37
40
|
/**
|
|
@@ -19,6 +19,8 @@ let HelixHeadlessSkeleton = class HelixHeadlessSkeleton extends HelixElement {
|
|
|
19
19
|
}
|
|
20
20
|
willUpdate(changed) {
|
|
21
21
|
super.willUpdate(changed);
|
|
22
|
+
const wraps = this.wraps;
|
|
23
|
+
this.toggleState('wrapping', wraps);
|
|
22
24
|
this.internals.ariaBusy = this.loading ? 'true' : null;
|
|
23
25
|
if (this.label) {
|
|
24
26
|
hostAria(this.internals, { label: this.label, role: 'progressbar' });
|
|
@@ -26,7 +28,7 @@ let HelixHeadlessSkeleton = class HelixHeadlessSkeleton extends HelixElement {
|
|
|
26
28
|
}
|
|
27
29
|
else {
|
|
28
30
|
hostAria(this.internals, { label: '', role: '' });
|
|
29
|
-
this.internals.ariaHidden =
|
|
31
|
+
this.internals.ariaHidden = wraps ? null : 'true';
|
|
30
32
|
}
|
|
31
33
|
}
|
|
32
34
|
firstUpdated(changed) {
|
|
@@ -36,7 +38,7 @@ let HelixHeadlessSkeleton = class HelixHeadlessSkeleton extends HelixElement {
|
|
|
36
38
|
render() {
|
|
37
39
|
return html `<span part="content" ?inert=${this.loading}
|
|
38
40
|
><slot @slotchange=${() => this.requestUpdate()}></slot></span
|
|
39
|
-
><span part="skeleton"></span>`;
|
|
41
|
+
><span part="skeleton"><span part="sheen"></span></span>`;
|
|
40
42
|
}
|
|
41
43
|
};
|
|
42
44
|
__decorate([
|
|
@@ -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 { customElement, elementById, HelixElement, reportRuntime } from '@fusion.dev/helix-core';
|
|
7
|
+
import { customElement, elementById, HelixElement, plainClick, reportRuntime, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { html } from 'lit';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
10
|
let HelixHeadlessSkipLink = class HelixHeadlessSkipLink extends HelixElement {
|
|
@@ -13,7 +13,7 @@ let HelixHeadlessSkipLink = class HelixHeadlessSkipLink extends HelixElement {
|
|
|
13
13
|
this.href = '#main';
|
|
14
14
|
this.label = 'Skip to content';
|
|
15
15
|
this.skip = (event) => {
|
|
16
|
-
if (event
|
|
16
|
+
if (!plainClick(event)) {
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
19
|
const target = this.target;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AriaForwardController, HelixFormElement } from '@fusion.dev/helix-core';
|
|
2
|
-
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
2
|
+
import { nothing, type PropertyValues, type TemplateResult } from 'lit';
|
|
3
3
|
declare const HelixHeadlessSlider_base: (new (...args: any[]) => import("@fusion.dev/helix-core").MixinControllerValueInterface) & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinFieldInterface) & typeof HelixFormElement;
|
|
4
4
|
/**
|
|
5
5
|
* @summary A value chosen from a range by dragging.
|
|
@@ -20,7 +20,13 @@ declare const HelixHeadlessSlider_base: (new (...args: any[]) => import("@fusion
|
|
|
20
20
|
*
|
|
21
21
|
* A range with two thumbs is two inputs stacked on one track, because there is
|
|
22
22
|
* no native two-thumb range. Each thumb keeps its own value.
|
|
23
|
-
* `min-steps-between-thumbs` keeps them that many steps apart
|
|
23
|
+
* `min-steps-between-thumbs` keeps them that many steps apart, and the readout
|
|
24
|
+
* joins the two as `range-text` writes them.
|
|
25
|
+
*
|
|
26
|
+
* `origin` sets where a single thumb's fill starts: at `min`, at the middle of
|
|
27
|
+
* the track, or at `max`. A balance or an offset from zero fills from the
|
|
28
|
+
* middle, as Zag's slider `origin` does. The fill's ends are published as
|
|
29
|
+
* `--slider-from` and `--slider-to`.
|
|
24
30
|
*
|
|
25
31
|
* `format-options` writes the value with `Intl.NumberFormat` in `locale`, as a
|
|
26
32
|
* currency, a percent or a unit, and `formatter` writes it with a function of
|
|
@@ -34,6 +40,20 @@ declare const HelixHeadlessSlider_base: (new (...args: any[]) => import("@fusion
|
|
|
34
40
|
* the first render. HTML does not apply `required` to a range either, so it is
|
|
35
41
|
* not set on the input. It only adds the marker beside the label.
|
|
36
42
|
*
|
|
43
|
+
* **Keyboard.** Each thumb is one tab stop, and its keys are the native
|
|
44
|
+
* range's.
|
|
45
|
+
*
|
|
46
|
+
* | Key | What it does |
|
|
47
|
+
* |---|---|
|
|
48
|
+
* | Right, Up | Moves the thumb up by `step`. |
|
|
49
|
+
* | Left, Down | Moves the thumb down by `step`. |
|
|
50
|
+
* | Page Up, Page Down | Moves the thumb by a larger step. |
|
|
51
|
+
* | Home, End | Moves the thumb to its lowest or highest value. |
|
|
52
|
+
*
|
|
53
|
+
* Each thumb is an `<input type="range">` with `aria-valuetext` where the value
|
|
54
|
+
* is formatted or worded. A range's thumbs say they stop at each other with
|
|
55
|
+
* `aria-valuemin` and `aria-valuemax`.
|
|
56
|
+
*
|
|
37
57
|
* @since 0.1.0
|
|
38
58
|
* @status stable
|
|
39
59
|
* @category forms
|
|
@@ -57,11 +77,14 @@ declare const HelixHeadlessSlider_base: (new (...args: any[]) => import("@fusion
|
|
|
57
77
|
* @csspart marker-label - The value a mark stands at, when `marker-labels` is set.
|
|
58
78
|
* @csspart markers - The row of marks along the track.
|
|
59
79
|
* @csspart output - The current value, shown beside the track.
|
|
80
|
+
* @csspart tooltip - One thumb's value in a bubble beside it, under `tooltip`. It carries `data-thumb` on a range, `start` or `end`, and `--slider-at`, where its thumb is as a fraction of the track.
|
|
81
|
+
* @csspart tooltips - The layer over the track that holds the bubbles, under `tooltip`.
|
|
60
82
|
*
|
|
83
|
+
* @cssproperty --slider-at - Where a bubble's thumb is, as a fraction of the track, 0 to 1. Set on each `tooltip` part.
|
|
61
84
|
* @cssproperty --slider-fraction - The value as a fraction of the range, 0 to 1.
|
|
62
|
-
* @cssproperty --slider-from - Where
|
|
85
|
+
* @cssproperty --slider-from - Where the filled span starts, as a fraction of the track, 0 to 1: a range's lower thumb, or a single thumb's `origin`.
|
|
63
86
|
* @cssproperty --slider-marker-at - Where one marker sits, as a percentage of the track.
|
|
64
|
-
* @cssproperty --slider-to - Where
|
|
87
|
+
* @cssproperty --slider-to - Where the filled span ends, as a fraction of the track, 0 to 1: a range's upper thumb, or the farther of a single thumb and its `origin`.
|
|
65
88
|
*
|
|
66
89
|
* @cssstate invalid - The slider has an error to show, from the browser's validation or from your `feedback`.
|
|
67
90
|
*/
|
|
@@ -148,6 +171,12 @@ export declare class HelixHeadlessSlider extends HelixHeadlessSlider_base {
|
|
|
148
171
|
* rather than a thumb sitting on nothing.
|
|
149
172
|
*/
|
|
150
173
|
orientation?: 'horizontal' | 'vertical';
|
|
174
|
+
/**
|
|
175
|
+
* Where a single thumb's fill starts: `start` at `min`, `center` at the
|
|
176
|
+
* middle of the track, or `end` at `max`. Absent is `start`. A range fills
|
|
177
|
+
* between its thumbs and ignores it.
|
|
178
|
+
*/
|
|
179
|
+
origin?: 'center' | 'end' | 'start';
|
|
151
180
|
/**
|
|
152
181
|
* Adds a second thumb, so the value is a pair.
|
|
153
182
|
*
|
|
@@ -156,12 +185,24 @@ export declare class HelixHeadlessSlider extends HelixHeadlessSlider_base {
|
|
|
156
185
|
* the two, since a range has no single number.
|
|
157
186
|
*/
|
|
158
187
|
range: boolean;
|
|
188
|
+
/**
|
|
189
|
+
* How the readout joins a range's two values, with `{start}` and `{end}`
|
|
190
|
+
* filled in. Write it in the page's language, such as `{start} bis {end}`.
|
|
191
|
+
*/
|
|
192
|
+
rangeText: string;
|
|
159
193
|
/**
|
|
160
194
|
* Shows the chosen value beside the track.
|
|
161
195
|
*/
|
|
162
196
|
showValue: boolean;
|
|
163
197
|
/** How far one press of an arrow key moves the thumb. */
|
|
164
198
|
step: number;
|
|
199
|
+
/**
|
|
200
|
+
* Whether each thumb shows its value in a bubble beside it, as Web
|
|
201
|
+
* Awesome's `with-tooltip`. The styled slider shows the bubbles while the
|
|
202
|
+
* slider is under the pointer or holds focus. They repeat what each thumb
|
|
203
|
+
* already reports, so a screen reader skips them.
|
|
204
|
+
*/
|
|
205
|
+
tooltip: boolean;
|
|
165
206
|
/**
|
|
166
207
|
* How many characters the readout has to be able to hold, widest case.
|
|
167
208
|
*
|
|
@@ -174,7 +215,8 @@ export declare class HelixHeadlessSlider extends HelixHeadlessSlider_base {
|
|
|
174
215
|
*
|
|
175
216
|
* Widest rather than current, so the box never changes size at all. Measured
|
|
176
217
|
* off the bounds because that is what the readout can ever say: the longer of
|
|
177
|
-
* the two ends, twice, plus the
|
|
218
|
+
* the two ends, twice, plus the words `range-text` puts between them when
|
|
219
|
+
* both are shown. Negative
|
|
178
220
|
* bounds are covered by measuring the rendered string rather than the digits,
|
|
179
221
|
* since the sign is a character like any other.
|
|
180
222
|
*
|
|
@@ -238,6 +280,11 @@ export declare class HelixHeadlessSlider extends HelixHeadlessSlider_base {
|
|
|
238
280
|
* there is no order for this to be on the wrong side of.
|
|
239
281
|
*/
|
|
240
282
|
private get fraction();
|
|
283
|
+
/**
|
|
284
|
+
* A single thumb's fill: `--slider-fraction`, and under `origin` the span
|
|
285
|
+
* from the origin to the thumb as `--slider-from` and `--slider-to`.
|
|
286
|
+
*/
|
|
287
|
+
private get fillStyle();
|
|
241
288
|
/**
|
|
242
289
|
* A value snapped to the step, counted from `min` the way a range counts it.
|
|
243
290
|
*
|
|
@@ -270,6 +317,13 @@ export declare class HelixHeadlessSlider extends HelixHeadlessSlider_base {
|
|
|
270
317
|
* such as `{value} degrees`. Empty announces the number alone.
|
|
271
318
|
*/
|
|
272
319
|
valueText: string;
|
|
320
|
+
/**
|
|
321
|
+
* A bubble for each thumb, under `tooltip`, saying its value where it is.
|
|
322
|
+
* After the thumbs, so a stylesheet can reach a bubble from a focused
|
|
323
|
+
* thumb, and hidden from the accessibility tree for the reason the readout
|
|
324
|
+
* is: each thumb already reports its value.
|
|
325
|
+
*/
|
|
326
|
+
protected renderTooltips(start: number, end: number): TemplateResult | typeof nothing;
|
|
273
327
|
protected render(): TemplateResult;
|
|
274
328
|
}
|
|
275
329
|
declare global {
|
|
@@ -23,8 +23,10 @@ let HelixHeadlessSlider = class HelixHeadlessSlider extends MixinControllerValue
|
|
|
23
23
|
this.minimumLabel = 'minimum';
|
|
24
24
|
this.minStepsBetweenThumbs = 0;
|
|
25
25
|
this.range = false;
|
|
26
|
+
this.rangeText = '{start} to {end}';
|
|
26
27
|
this.showValue = false;
|
|
27
28
|
this.step = 1;
|
|
29
|
+
this.tooltip = false;
|
|
28
30
|
this.handleInput = (event) => {
|
|
29
31
|
event.stopPropagation();
|
|
30
32
|
const control = event.target;
|
|
@@ -51,7 +53,9 @@ let HelixHeadlessSlider = class HelixHeadlessSlider extends MixinControllerValue
|
|
|
51
53
|
}
|
|
52
54
|
get reserve() {
|
|
53
55
|
const widest = Math.max(this.said(this.min).length, this.said(this.max).length);
|
|
54
|
-
return this.range
|
|
56
|
+
return this.range
|
|
57
|
+
? widest * 2 + fillTemplate(this.rangeText, { end: '', start: '' }).length
|
|
58
|
+
: widest;
|
|
55
59
|
}
|
|
56
60
|
get precision() {
|
|
57
61
|
return String(this.step).split('.')[1]?.length ?? 0;
|
|
@@ -104,6 +108,14 @@ let HelixHeadlessSlider = class HelixHeadlessSlider extends MixinControllerValue
|
|
|
104
108
|
}
|
|
105
109
|
return this.along(this.snapped(this.valueAsNumber));
|
|
106
110
|
}
|
|
111
|
+
get fillStyle() {
|
|
112
|
+
const fraction = this.fraction;
|
|
113
|
+
if (!this.origin) {
|
|
114
|
+
return `--slider-fraction: ${fraction}`;
|
|
115
|
+
}
|
|
116
|
+
const at = { center: 0.5, end: 1, start: 0 }[this.origin] ?? 0;
|
|
117
|
+
return `--slider-fraction: ${fraction}; --slider-from: ${Math.min(at, fraction)}; --slider-to: ${Math.max(at, fraction)}`;
|
|
118
|
+
}
|
|
107
119
|
snapped(at) {
|
|
108
120
|
if (!(this.step > 0)) {
|
|
109
121
|
return at;
|
|
@@ -170,6 +182,22 @@ let HelixHeadlessSlider = class HelixHeadlessSlider extends MixinControllerValue
|
|
|
170
182
|
super.updated(changed);
|
|
171
183
|
this.sync();
|
|
172
184
|
}
|
|
185
|
+
renderTooltips(start, end) {
|
|
186
|
+
if (!this.tooltip) {
|
|
187
|
+
return nothing;
|
|
188
|
+
}
|
|
189
|
+
const bubble = (fraction, text, thumb) => html `<span part="tooltip" data-thumb=${thumb ?? nothing} style="--slider-at: ${fraction}"
|
|
190
|
+
>${text}</span
|
|
191
|
+
>`;
|
|
192
|
+
return html `<div part="tooltips" aria-hidden="true">
|
|
193
|
+
${this.range
|
|
194
|
+
? [
|
|
195
|
+
bubble(this.along(start), this.said(start), 'start'),
|
|
196
|
+
bubble(this.along(end), this.said(end), 'end'),
|
|
197
|
+
]
|
|
198
|
+
: bubble(this.fraction, this.said(this.value))}
|
|
199
|
+
</div>`;
|
|
200
|
+
}
|
|
173
201
|
render() {
|
|
174
202
|
const [start, end] = this.bounds;
|
|
175
203
|
const thumb = (which, at) => html `<input
|
|
@@ -201,6 +229,7 @@ let HelixHeadlessSlider = class HelixHeadlessSlider extends MixinControllerValue
|
|
|
201
229
|
part="field"
|
|
202
230
|
data-markers=${this.markerValues.length > 0 ? '' : nothing}
|
|
203
231
|
data-range=${this.range ? '' : nothing}
|
|
232
|
+
data-tooltip=${this.tooltip ? '' : nothing}
|
|
204
233
|
style="--slider-fraction: ${this.fraction}; --slider-from: ${this.along(start)}; --slider-to: ${this.along(end)}"
|
|
205
234
|
>
|
|
206
235
|
${this.range ? thumb('start', start) : nothing}
|
|
@@ -211,7 +240,8 @@ let HelixHeadlessSlider = class HelixHeadlessSlider extends MixinControllerValue
|
|
|
211
240
|
part="control"
|
|
212
241
|
id=${this.controlId}
|
|
213
242
|
type="range"
|
|
214
|
-
style
|
|
243
|
+
style=${this.fillStyle}
|
|
244
|
+
data-origin=${this.origin ?? nothing}
|
|
215
245
|
min=${this.min}
|
|
216
246
|
max=${this.max}
|
|
217
247
|
step=${this.step}
|
|
@@ -235,13 +265,16 @@ let HelixHeadlessSlider = class HelixHeadlessSlider extends MixinControllerValue
|
|
|
235
265
|
>`)}
|
|
236
266
|
</div>`
|
|
237
267
|
: nothing}
|
|
268
|
+
${this.renderTooltips(start, end)}
|
|
238
269
|
${this.showValue
|
|
239
270
|
? html `<output
|
|
240
271
|
part="output"
|
|
241
272
|
for=${this.range ? 'control control-end' : 'control'}
|
|
242
273
|
aria-hidden="true"
|
|
243
274
|
style=${`--_slider-output-reserve: ${this.reserve}ch`}
|
|
244
|
-
>${this.range
|
|
275
|
+
>${this.range
|
|
276
|
+
? fillTemplate(this.rangeText, { end: this.said(end), start: this.said(start) })
|
|
277
|
+
: this.said(this.value)}</output
|
|
245
278
|
>`
|
|
246
279
|
: nothing}
|
|
247
280
|
</div>
|
|
@@ -281,15 +314,24 @@ __decorate([
|
|
|
281
314
|
__decorate([
|
|
282
315
|
property({ reflect: true })
|
|
283
316
|
], HelixHeadlessSlider.prototype, "orientation", void 0);
|
|
317
|
+
__decorate([
|
|
318
|
+
property({ reflect: true })
|
|
319
|
+
], HelixHeadlessSlider.prototype, "origin", void 0);
|
|
284
320
|
__decorate([
|
|
285
321
|
property({ reflect: true, type: Boolean })
|
|
286
322
|
], HelixHeadlessSlider.prototype, "range", void 0);
|
|
323
|
+
__decorate([
|
|
324
|
+
property({ attribute: 'range-text' })
|
|
325
|
+
], HelixHeadlessSlider.prototype, "rangeText", void 0);
|
|
287
326
|
__decorate([
|
|
288
327
|
property({ attribute: 'show-value', reflect: true, type: Boolean })
|
|
289
328
|
], HelixHeadlessSlider.prototype, "showValue", void 0);
|
|
290
329
|
__decorate([
|
|
291
330
|
property({ type: Number })
|
|
292
331
|
], HelixHeadlessSlider.prototype, "step", void 0);
|
|
332
|
+
__decorate([
|
|
333
|
+
property({ type: Boolean })
|
|
334
|
+
], HelixHeadlessSlider.prototype, "tooltip", void 0);
|
|
293
335
|
__decorate([
|
|
294
336
|
property({ attribute: 'value-text' })
|
|
295
337
|
], HelixHeadlessSlider.prototype, "valueText", void 0);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type Point } from '@fusion.dev/helix-core';
|
|
2
|
+
/**
|
|
3
|
+
* A reading in words, for the readout: the row's name where a table gave one,
|
|
4
|
+
* the reading as it is written, and where it stands in brackets, such as
|
|
5
|
+
* "Mon: 12 (3 of 7)". The same order every chart's readout uses.
|
|
6
|
+
*/
|
|
7
|
+
export declare const readingWords: (label: string, text: string, position: string) => string;
|
|
8
|
+
/**
|
|
9
|
+
* The readings in their places: `count` slots, each holding the value read at
|
|
10
|
+
* that place, or nothing where the place is blank. A point outside the places
|
|
11
|
+
* is left out.
|
|
12
|
+
*/
|
|
13
|
+
export declare const slotsOf: (points: readonly {
|
|
14
|
+
at: number;
|
|
15
|
+
value: number;
|
|
16
|
+
}[], count: number) => (number | undefined)[];
|
|
17
|
+
/** One unbroken stretch of the line: its drawn path and the points it runs through. */
|
|
18
|
+
export interface Run {
|
|
19
|
+
/** The path the line draws through the points. */
|
|
20
|
+
path: string;
|
|
21
|
+
/** The points, in drawing coordinates. */
|
|
22
|
+
run: readonly Point[];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Each run of the line closed down to `floor`, the path the wash fills: the
|
|
26
|
+
* run's own path, then down from its last point, across and back up to its
|
|
27
|
+
* first. Empty where there are no runs.
|
|
28
|
+
*/
|
|
29
|
+
export declare const areaPath: (runs: readonly Run[], floor: number) => string;
|
|
30
|
+
/**
|
|
31
|
+
* What the readings come to, in `template`: `{first}` and `{last}` for the
|
|
32
|
+
* first and the last reading, `{high}` and `{low}` for the highest and the
|
|
33
|
+
* lowest, each written by `write`. Empty where there are fewer than two
|
|
34
|
+
* readings, which make no trend.
|
|
35
|
+
*/
|
|
36
|
+
export declare const overviewWords: (template: string, slots: readonly (number | undefined)[], write: (at: number) => string) => string;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { extremesOf, fillTemplate } from '@fusion.dev/helix-core';
|
|
2
|
+
export const readingWords = (label, text, position) => {
|
|
3
|
+
const named = label === '' ? text : text === '' ? label : `${label}: ${text}`;
|
|
4
|
+
return position === '' ? named : `${named} (${position})`;
|
|
5
|
+
};
|
|
6
|
+
export const slotsOf = (points, count) => {
|
|
7
|
+
const slots = Array.from({ length: count }, () => undefined);
|
|
8
|
+
for (const point of points) {
|
|
9
|
+
if (point.at >= 0 && point.at < count) {
|
|
10
|
+
slots[point.at] = point.value;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return slots;
|
|
14
|
+
};
|
|
15
|
+
export const areaPath = (runs, floor) => runs
|
|
16
|
+
.map((one) => {
|
|
17
|
+
const first = one.run[0];
|
|
18
|
+
const last = one.run.at(-1);
|
|
19
|
+
return `${one.path}L${last[0]},${floor}L${first[0]},${floor}Z`;
|
|
20
|
+
})
|
|
21
|
+
.join('');
|
|
22
|
+
export const overviewWords = (template, slots, write) => {
|
|
23
|
+
const placed = slots.flatMap((value, at) => (value === undefined ? [] : [at]));
|
|
24
|
+
const first = placed[0];
|
|
25
|
+
const last = placed.at(-1);
|
|
26
|
+
const { high, low } = extremesOf(slots);
|
|
27
|
+
if (placed.length < 2 || first === undefined || last === undefined) {
|
|
28
|
+
return '';
|
|
29
|
+
}
|
|
30
|
+
return fillTemplate(template, {
|
|
31
|
+
first: write(first),
|
|
32
|
+
high: write(high),
|
|
33
|
+
last: write(last),
|
|
34
|
+
low: write(low),
|
|
35
|
+
});
|
|
36
|
+
};
|