@fusion.dev/helix-headless 0.143.0 → 0.145.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +16990 -1383
- package/dist/accordion/item/accordion-item.d.ts +48 -12
- package/dist/accordion/item/accordion-item.js +26 -5
- package/dist/accordion/root/accordion-root.d.ts +6 -0
- package/dist/accordion/root/accordion-root.js +7 -1
- package/dist/announcement/root/announcement-root.d.ts +21 -1
- package/dist/announcement/root/announcement-root.js +36 -1
- package/dist/app-header/root/app-header-root.d.ts +7 -0
- package/dist/app-header/root/app-header-root.js +5 -1
- package/dist/app-header/sectioning.d.ts +7 -0
- package/dist/app-header/sectioning.js +26 -0
- package/dist/area-chart/root/area-chart-root.d.ts +12 -4
- package/dist/area-chart/root/area-chart-root.js +24 -7
- package/dist/avatar/root/avatar-root.d.ts +14 -0
- package/dist/avatar/root/avatar-root.js +23 -9
- package/dist/badge/root/badge-root.d.ts +11 -7
- package/dist/badge/root/badge-root.js +1 -1
- package/dist/bar-chart/root/bar-chart-root.d.ts +12 -3
- package/dist/bar-chart/root/bar-chart-root.js +17 -10
- package/dist/breadcrumbs/root/breadcrumbs-root.d.ts +32 -1
- package/dist/breadcrumbs/root/breadcrumbs-root.js +25 -2
- package/dist/button/root/button-root.d.ts +47 -1
- package/dist/button/root/button-root.js +38 -4
- package/dist/callout/root/callout-root.d.ts +18 -1
- package/dist/callout/root/callout-root.js +15 -4
- package/dist/canvas/root/canvas-root.d.ts +38 -3
- package/dist/canvas/root/canvas-root.js +121 -40
- package/dist/card/root/card-root.d.ts +30 -1
- package/dist/card/root/card-root.js +38 -5
- package/dist/carousel/root/carousel-root.d.ts +90 -0
- package/dist/carousel/root/carousel-root.js +134 -12
- package/dist/chat/composer/chat-composer.d.ts +38 -6
- package/dist/chat/composer/chat-composer.js +42 -9
- package/dist/chat/message/chat-message.d.ts +32 -1
- package/dist/chat/message/chat-message.js +25 -9
- package/dist/chat/naming.d.ts +22 -0
- package/dist/chat/naming.js +12 -0
- package/dist/chat/relative-clock.d.ts +39 -0
- package/dist/chat/relative-clock.js +31 -0
- package/dist/chat/root/chat-root.d.ts +36 -0
- package/dist/chat/root/chat-root.js +24 -1
- package/dist/checkbox/root/checkbox-root.js +2 -0
- package/dist/checkbox-group/root/checkbox-group-root.d.ts +53 -3
- package/dist/checkbox-group/root/checkbox-group-root.js +71 -22
- package/dist/code-block/lines.d.ts +13 -0
- package/dist/code-block/lines.js +2 -0
- package/dist/code-block/root/code-block-root.d.ts +38 -1
- package/dist/code-block/root/code-block-root.js +28 -7
- package/dist/color-input/root/color-input-root.d.ts +34 -1
- package/dist/color-input/root/color-input-root.js +23 -4
- package/dist/color-picker/channels.d.ts +26 -0
- package/dist/color-picker/channels.js +84 -0
- package/dist/color-picker/root/color-picker-root.d.ts +81 -5
- package/dist/color-picker/root/color-picker-root.js +103 -10
- package/dist/combobox/root/combobox-root.d.ts +38 -3
- package/dist/combobox/root/combobox-root.js +64 -2
- package/dist/command/root/command-root.d.ts +30 -4
- package/dist/command/root/command-root.js +33 -3
- package/dist/copy-button/from.d.ts +22 -0
- package/dist/copy-button/from.js +28 -0
- package/dist/copy-button/root/copy-button-root.d.ts +47 -1
- package/dist/copy-button/root/copy-button-root.js +44 -8
- package/dist/data-table/root/data-table-root.d.ts +150 -2
- package/dist/data-table/root/data-table-root.js +303 -29
- package/dist/data-table/tree.d.ts +40 -0
- package/dist/data-table/tree.js +55 -0
- package/dist/date-input/root/date-input-root.d.ts +73 -4
- package/dist/date-input/root/date-input-root.js +93 -43
- package/dist/date-picker/root/date-picker-root.d.ts +145 -1
- package/dist/date-picker/root/date-picker-root.js +239 -48
- package/dist/description-list/item/description-list-item.d.ts +17 -2
- package/dist/description-list/item/description-list-item.js +15 -2
- package/dist/description-list/root/description-list-root.d.ts +27 -1
- package/dist/description-list/root/description-list-root.js +26 -1
- package/dist/dialog/description.d.ts +9 -0
- package/dist/dialog/description.js +14 -0
- package/dist/dialog/root/dialog-root.d.ts +64 -1
- package/dist/dialog/root/dialog-root.js +49 -23
- package/dist/donut-chart/root/donut-chart-root.d.ts +25 -4
- package/dist/donut-chart/root/donut-chart-root.js +21 -6
- package/dist/drawer/root/drawer-root.d.ts +63 -2
- package/dist/drawer/root/drawer-root.js +95 -19
- package/dist/drawer/swipe-start.d.ts +9 -0
- package/dist/drawer/swipe-start.js +12 -0
- package/dist/drilldown/item/drilldown-item.d.ts +11 -6
- package/dist/drilldown/item/drilldown-item.js +8 -5
- package/dist/drilldown/root/drilldown-root.d.ts +11 -0
- package/dist/drilldown/root/drilldown-root.js +8 -3
- package/dist/element-events.generated.js +61 -13
- package/dist/empty/root/empty-root.d.ts +1 -1
- package/dist/file-input/root/file-input-root.d.ts +47 -0
- package/dist/file-input/root/file-input-root.js +60 -22
- package/dist/file-input/screen.d.ts +35 -0
- package/dist/file-input/screen.js +49 -0
- package/dist/filter-input/menu/filter-menu.d.ts +3 -0
- package/dist/filter-input/menu/filter-menu.js +8 -4
- package/dist/filter-input/root/filter-input-root.d.ts +38 -4
- package/dist/filter-input/root/filter-input-root.js +67 -3
- package/dist/filter-input/suggest.d.ts +17 -0
- package/dist/filter-input/suggest.js +23 -0
- package/dist/format-date/options.d.ts +33 -0
- package/dist/format-date/options.js +42 -0
- package/dist/format-date/root/format-date-root.d.ts +51 -0
- package/dist/format-date/root/format-date-root.js +58 -38
- package/dist/heatmap/root/heatmap-root.d.ts +23 -6
- package/dist/heatmap/root/heatmap-root.js +24 -13
- package/dist/icon/index.d.ts +2 -0
- package/dist/icon/index.js +2 -0
- package/dist/icon/registry.d.ts +37 -0
- package/dist/icon/registry.js +83 -0
- package/dist/icon/root/icon-root.d.ts +30 -4
- package/dist/icon/root/icon-root.js +41 -6
- package/dist/icon/root/index.d.ts +2 -0
- package/dist/icon/root/index.js +2 -0
- package/dist/icon/set.d.ts +1 -0
- package/dist/icon/set.js +3 -0
- package/dist/image/root/image-root.d.ts +14 -0
- package/dist/image/root/image-root.js +23 -2
- package/dist/input/root/input-root.d.ts +11 -0
- package/dist/input/root/input-root.js +16 -1
- package/dist/kbd/root/kbd-root.d.ts +20 -13
- package/dist/kbd/root/kbd-root.js +35 -37
- package/dist/kbd/shortcut.d.ts +18 -0
- package/dist/kbd/shortcut.js +35 -0
- package/dist/legend/hidden-series.d.ts +8 -0
- package/dist/legend/hidden-series.js +13 -0
- package/dist/legend/root/legend-root.d.ts +56 -0
- package/dist/legend/root/legend-root.js +54 -5
- package/dist/lightbox/item/lightbox-item.d.ts +15 -0
- package/dist/lightbox/item/lightbox-item.js +10 -1
- package/dist/lightbox/root/lightbox-root.d.ts +61 -1
- package/dist/lightbox/root/lightbox-root.js +94 -4
- package/dist/line-chart/root/line-chart-root.d.ts +11 -3
- package/dist/line-chart/root/line-chart-root.js +19 -5
- package/dist/list/item/list-item.d.ts +68 -1
- package/dist/list/item/list-item.js +66 -4
- package/dist/list/numbering.d.ts +14 -0
- package/dist/list/numbering.js +8 -0
- package/dist/list/root/list-root.d.ts +106 -9
- package/dist/list/root/list-root.js +189 -4
- package/dist/list/selection.d.ts +19 -0
- package/dist/list/selection.js +21 -0
- package/dist/listbox/root/listbox-root.d.ts +74 -3
- package/dist/listbox/root/listbox-root.js +86 -9
- package/dist/loader/busy.d.ts +17 -0
- package/dist/loader/busy.js +24 -0
- package/dist/loader/root/loader-root.d.ts +37 -0
- package/dist/loader/root/loader-root.js +52 -3
- package/dist/map/root/map-root.d.ts +6 -2
- package/dist/map/root/map-root.js +5 -2
- package/dist/megamenu/root/megamenu-root.d.ts +21 -0
- package/dist/megamenu/root/megamenu-root.js +16 -2
- package/dist/menu/index.d.ts +1 -0
- package/dist/menu/index.js +1 -0
- package/dist/menu/item/menu-item.d.ts +38 -11
- package/dist/menu/item/menu-item.js +33 -1
- package/dist/menu/root/menu-root.d.ts +25 -1
- package/dist/menu/root/menu-root.js +63 -6
- package/dist/menu/section/menu-section.d.ts +55 -0
- package/dist/menu/section/menu-section.js +60 -0
- package/dist/meter/root/meter-root.d.ts +7 -0
- package/dist/meter/root/meter-root.js +6 -3
- package/dist/navigation/root/navigation-root.d.ts +16 -1
- package/dist/navigation/root/navigation-root.js +27 -1
- package/dist/notifications/feed-keys.d.ts +10 -0
- package/dist/notifications/feed-keys.js +14 -0
- package/dist/notifications/notification/notification.d.ts +17 -0
- package/dist/notifications/notification/notification.js +21 -2
- package/dist/notifications/root/notifications-root.d.ts +60 -0
- package/dist/notifications/root/notifications-root.js +76 -1
- package/dist/number-input/root/number-input-root.d.ts +47 -0
- package/dist/number-input/root/number-input-root.js +58 -22
- package/dist/object-inspector/root/object-inspector-root.d.ts +98 -16
- package/dist/object-inspector/root/object-inspector-root.js +180 -80
- package/dist/object-inspector/rows.d.ts +57 -0
- package/dist/object-inspector/rows.js +86 -0
- package/dist/option/root/option-root.d.ts +54 -5
- package/dist/option/root/option-root.js +34 -5
- package/dist/outline/levels.d.ts +31 -0
- package/dist/outline/levels.js +23 -0
- package/dist/outline/root/outline-root.d.ts +68 -3
- package/dist/outline/root/outline-root.js +73 -8
- package/dist/pagination/size/pagination-size.d.ts +11 -2
- package/dist/pagination/size/pagination-size.js +19 -4
- package/dist/pin-input/format.d.ts +7 -0
- package/dist/pin-input/format.js +16 -0
- package/dist/pin-input/root/pin-input-root.d.ts +21 -0
- package/dist/pin-input/root/pin-input-root.js +29 -2
- package/dist/popover/root/popover-root.d.ts +62 -4
- package/dist/popover/root/popover-root.js +53 -5
- package/dist/progress/root/progress-root.d.ts +7 -0
- package/dist/progress/root/progress-root.js +9 -3
- package/dist/qr-code/export.d.ts +31 -0
- package/dist/qr-code/export.js +10 -0
- package/dist/qr-code/root/qr-code-root.d.ts +26 -0
- package/dist/qr-code/root/qr-code-root.js +49 -2
- package/dist/radio/group/radio-group.d.ts +17 -0
- package/dist/radio/group/radio-group.js +14 -1
- package/dist/rating/root/rating-root.d.ts +25 -0
- package/dist/rating/root/rating-root.js +46 -4
- package/dist/scatter-chart/root/scatter-chart-root.d.ts +17 -3
- package/dist/scatter-chart/root/scatter-chart-root.js +25 -7
- package/dist/scroll-area/root/scroll-area-root.d.ts +113 -0
- package/dist/scroll-area/root/scroll-area-root.js +218 -3
- package/dist/scroll-area/scrollbar.d.ts +65 -0
- package/dist/scroll-area/scrollbar.js +24 -0
- package/dist/select/root/select-root.d.ts +24 -0
- package/dist/select/root/select-root.js +21 -7
- package/dist/skeleton/root/skeleton-root.d.ts +25 -0
- package/dist/skeleton/root/skeleton-root.js +17 -2
- package/dist/slider/root/slider-root.d.ts +39 -0
- package/dist/slider/root/slider-root.js +45 -9
- package/dist/splitter/root/splitter-root.d.ts +13 -0
- package/dist/splitter/root/splitter-root.js +20 -2
- package/dist/splitter/snap.d.ts +9 -0
- package/dist/splitter/snap.js +12 -0
- package/dist/stat/root/stat-root.d.ts +2 -0
- package/dist/stat/root/stat-root.js +1 -1
- package/dist/steps/reach.d.ts +15 -0
- package/dist/steps/reach.js +12 -0
- package/dist/steps/root/steps-root.d.ts +30 -0
- package/dist/steps/root/steps-root.js +53 -0
- package/dist/steps/step/step.d.ts +39 -2
- package/dist/steps/step/step.js +29 -7
- package/dist/switch/root/switch-root.d.ts +12 -2
- package/dist/switch/root/switch-root.js +6 -1
- package/dist/table/column/table-column.d.ts +11 -0
- package/dist/table/column/table-column.js +6 -1
- package/dist/table/root/table-root.d.ts +101 -0
- package/dist/table/root/table-root.js +166 -5
- package/dist/table/row/table-row.d.ts +47 -1
- package/dist/table/row/table-row.js +39 -2
- package/dist/tabs/panel/tab-panel.d.ts +9 -5
- package/dist/tabs/panel/tab-panel.js +3 -4
- package/dist/tabs/root/tabs-root.d.ts +25 -1
- package/dist/tabs/root/tabs-root.js +21 -3
- package/dist/tabs/tab/tab.d.ts +36 -4
- package/dist/tabs/tab/tab.js +46 -3
- package/dist/tag/group/tag-group.d.ts +107 -0
- package/dist/tag/group/tag-group.js +157 -0
- package/dist/tag/index.d.ts +1 -0
- package/dist/tag/index.js +1 -0
- package/dist/tag/root/tag-root.d.ts +60 -0
- package/dist/tag/root/tag-root.js +74 -18
- package/dist/tag/selection.d.ts +10 -0
- package/dist/tag/selection.js +12 -0
- package/dist/textarea/grow.d.ts +22 -0
- package/dist/textarea/grow.js +20 -0
- package/dist/textarea/root/textarea-root.d.ts +9 -0
- package/dist/textarea/root/textarea-root.js +9 -1
- package/dist/time-input/root/time-input-root.d.ts +44 -5
- package/dist/time-input/root/time-input-root.js +69 -39
- package/dist/time-picker/root/time-picker-root.d.ts +54 -8
- package/dist/time-picker/root/time-picker-root.js +121 -91
- package/dist/timeline/group/timeline-group.d.ts +46 -0
- package/dist/timeline/group/timeline-group.js +37 -0
- package/dist/timeline/index.d.ts +1 -0
- package/dist/timeline/index.js +1 -0
- package/dist/timeline/root/timeline-root.d.ts +10 -3
- package/dist/toast/hotkey.d.ts +22 -0
- package/dist/toast/hotkey.js +23 -0
- package/dist/toast/item/toast-item.d.ts +26 -18
- package/dist/toast/item/toast-item.js +55 -48
- package/dist/toast/root/toast-root.d.ts +42 -8
- package/dist/toast/root/toast-root.js +64 -4
- package/dist/toggle/group/toggle-group.d.ts +57 -15
- package/dist/toggle/group/toggle-group.js +69 -9
- package/dist/toggle/root/toggle-root.d.ts +12 -1
- package/dist/toggle/root/toggle-root.js +11 -3
- package/dist/toolbar/root/toolbar-root.d.ts +13 -0
- package/dist/toolbar/root/toolbar-root.js +15 -5
- package/dist/tooltip/focus-target.d.ts +6 -0
- package/dist/tooltip/focus-target.js +9 -0
- package/dist/tooltip/root/tooltip-root.d.ts +42 -17
- package/dist/tooltip/root/tooltip-root.js +50 -9
- package/dist/tour/naming.d.ts +30 -0
- package/dist/tour/naming.js +10 -0
- package/dist/tour/root/tour-root.d.ts +35 -0
- package/dist/tour/root/tour-root.js +56 -5
- package/dist/tour/stop/tour-stop.d.ts +53 -8
- package/dist/tour/stop/tour-stop.js +45 -15
- package/dist/tour/wait.d.ts +11 -0
- package/dist/tour/wait.js +19 -0
- package/dist/tree/item/tree-item.d.ts +54 -1
- package/dist/tree/item/tree-item.js +89 -20
- package/dist/tree/root/tree-root.d.ts +37 -0
- package/dist/tree/root/tree-root.js +51 -6
- package/dist/tree/selection.d.ts +24 -0
- package/dist/tree/selection.js +26 -0
- package/dist/trend/root/trend-root.d.ts +13 -0
- package/dist/trend/root/trend-root.js +14 -9
- package/dist/video/media-events.d.ts +49 -0
- package/dist/video/media-events.js +39 -0
- package/dist/video/root/video-root.d.ts +99 -13
- package/dist/video/root/video-root.js +84 -47
- package/dist/video-playlist/menu/video-playlist-menu.d.ts +3 -0
- package/dist/video-playlist/menu/video-playlist-menu.js +2 -1
- package/dist/video-playlist/order.d.ts +41 -0
- package/dist/video-playlist/order.js +34 -0
- package/dist/video-playlist/root/video-playlist-root.d.ts +70 -2
- package/dist/video-playlist/root/video-playlist-root.js +60 -16
- package/dist/virtual-list/controls.d.ts +4 -0
- package/dist/virtual-list/controls.js +30 -0
- package/dist/virtual-list/fill.d.ts +30 -0
- package/dist/virtual-list/fill.js +39 -0
- package/dist/virtual-list/keys.d.ts +15 -0
- package/dist/virtual-list/keys.js +24 -0
- package/dist/virtual-list/root/virtual-list-root.d.ts +155 -23
- package/dist/virtual-list/root/virtual-list-root.js +175 -34
- package/lint.json +1 -1
- package/package.json +5 -5
- package/types/jsx.d.ts +8871 -1286
- package/types/svelte.d.ts +3 -0
- package/types/vue.d.ts +1918 -269
|
@@ -4,17 +4,45 @@ 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, MixinDismissible, slottedWords } from '@fusion.dev/helix-core';
|
|
8
|
-
import { x } from '@fusion.dev/helix-icons';
|
|
7
|
+
import { customElement, drawDismiss, drawDismissGlyph, HelixElement, hostAria, MixinDismissible, slottedWords, } from '@fusion.dev/helix-core';
|
|
9
8
|
import { html, nothing } from 'lit';
|
|
10
|
-
import {
|
|
9
|
+
import { property } from 'lit/decorators.js';
|
|
11
10
|
let HelixHeadlessTag = class HelixHeadlessTag extends MixinDismissible(HelixElement) {
|
|
12
11
|
constructor() {
|
|
13
12
|
super(...arguments);
|
|
14
13
|
this.dismissLabel = 'Remove';
|
|
14
|
+
this.disabled = false;
|
|
15
|
+
this.href = '';
|
|
16
|
+
this.value = '';
|
|
17
|
+
}
|
|
18
|
+
get words() {
|
|
19
|
+
return this.childrenKnown ? slottedWords(this, ['start', '']) : '';
|
|
20
|
+
}
|
|
21
|
+
get grouped() {
|
|
22
|
+
return this.focusable !== undefined;
|
|
23
|
+
}
|
|
24
|
+
focusItem() {
|
|
25
|
+
this.renderRoot
|
|
26
|
+
.querySelector(this.grouped ? '[part~="cell"]' : '[part~="link"], [part~="dismiss"]')
|
|
27
|
+
?.focus();
|
|
28
|
+
}
|
|
29
|
+
get returnFocusTo() {
|
|
30
|
+
if (this.disabled) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
return this.grouped
|
|
34
|
+
? this.renderRoot.querySelector('[part~="cell"]')
|
|
35
|
+
: super.returnFocusTo;
|
|
36
|
+
}
|
|
37
|
+
willUpdate(changed) {
|
|
38
|
+
super.willUpdate(changed);
|
|
39
|
+
hostAria(this.internals, { role: this.grouped ? 'row' : '' });
|
|
40
|
+
this.internals.ariaSelected = this.selected === undefined ? null : String(this.selected);
|
|
41
|
+
this.internals.ariaDisabled = this.disabled ? 'true' : null;
|
|
42
|
+
this.toggleState('selected', this.selected === true);
|
|
15
43
|
}
|
|
16
44
|
get removeName() {
|
|
17
|
-
const words = this.
|
|
45
|
+
const words = this.words;
|
|
18
46
|
if (this.dismissLabel.includes('{label}')) {
|
|
19
47
|
return this.dismissLabel.replace('{label}', words).trim();
|
|
20
48
|
}
|
|
@@ -28,22 +56,50 @@ let HelixHeadlessTag = class HelixHeadlessTag extends MixinDismissible(HelixElem
|
|
|
28
56
|
this.finishHydration();
|
|
29
57
|
}
|
|
30
58
|
render() {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
59
|
+
const content = html `<slot name="start" part="start"></slot>${this.renderLabel()}${this.dismissible ? this.renderDismiss() : nothing}`;
|
|
60
|
+
return this.grouped
|
|
61
|
+
? html `<span part="cell" role="gridcell" tabindex=${this.focusable ? '0' : '-1'}
|
|
62
|
+
>${content}</span
|
|
63
|
+
>`
|
|
64
|
+
: content;
|
|
65
|
+
}
|
|
66
|
+
renderLabel() {
|
|
67
|
+
if (this.href === '') {
|
|
68
|
+
return html `<slot part="label"></slot>`;
|
|
69
|
+
}
|
|
70
|
+
return html `<a
|
|
71
|
+
aria-disabled=${this.disabled ? 'true' : nothing}
|
|
72
|
+
href=${this.disabled ? nothing : this.href}
|
|
73
|
+
part="link"
|
|
74
|
+
tabindex=${this.grouped ? '-1' : nothing}
|
|
75
|
+
><slot part="label"></slot
|
|
76
|
+
></a>`;
|
|
77
|
+
}
|
|
78
|
+
renderDismiss() {
|
|
79
|
+
return drawDismiss({
|
|
80
|
+
disabled: this.disabled,
|
|
81
|
+
label: this.removeName,
|
|
82
|
+
mark: html `<slot name="dismiss-icon">${drawDismissGlyph()}</slot>`,
|
|
83
|
+
onDismiss: () => this.dismiss(),
|
|
84
|
+
tabindex: this.grouped ? '-1' : undefined,
|
|
85
|
+
});
|
|
45
86
|
}
|
|
46
87
|
};
|
|
88
|
+
__decorate([
|
|
89
|
+
property({ reflect: true, type: Boolean })
|
|
90
|
+
], HelixHeadlessTag.prototype, "disabled", void 0);
|
|
91
|
+
__decorate([
|
|
92
|
+
property({ attribute: false })
|
|
93
|
+
], HelixHeadlessTag.prototype, "focusable", void 0);
|
|
94
|
+
__decorate([
|
|
95
|
+
property()
|
|
96
|
+
], HelixHeadlessTag.prototype, "href", void 0);
|
|
97
|
+
__decorate([
|
|
98
|
+
property({ attribute: false })
|
|
99
|
+
], HelixHeadlessTag.prototype, "selected", void 0);
|
|
100
|
+
__decorate([
|
|
101
|
+
property()
|
|
102
|
+
], HelixHeadlessTag.prototype, "value", void 0);
|
|
47
103
|
HelixHeadlessTag = __decorate([
|
|
48
104
|
customElement('helix-headless-tag')
|
|
49
105
|
], HelixHeadlessTag);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** How many tags a group lets a reader select. */
|
|
2
|
+
export type TagSelectionMode = 'multiple' | 'none' | 'single';
|
|
3
|
+
/**
|
|
4
|
+
* The `value` a press on the tag carrying `pressed` leaves.
|
|
5
|
+
*
|
|
6
|
+
* `single` selects that tag alone, or none where it was the one selected.
|
|
7
|
+
* `multiple` adds it, or takes it out. `none` selects nothing and leaves the
|
|
8
|
+
* value as it was.
|
|
9
|
+
*/
|
|
10
|
+
export declare const pressedValue: (mode: TagSelectionMode, value: string, pressed: string) => string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { commaList, toggleValue } from '@fusion.dev/helix-core';
|
|
2
|
+
export const pressedValue = (mode, value, pressed) => {
|
|
3
|
+
const now = commaList(value);
|
|
4
|
+
const held = now.includes(pressed);
|
|
5
|
+
if (mode === 'single') {
|
|
6
|
+
return held ? '' : pressed;
|
|
7
|
+
}
|
|
8
|
+
if (mode === 'multiple') {
|
|
9
|
+
return toggleValue(now, pressed).join(', ');
|
|
10
|
+
}
|
|
11
|
+
return value;
|
|
12
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** What a box adds around its lines, and how tall one line is, in pixels. */
|
|
2
|
+
export interface LineMetrics {
|
|
3
|
+
/** Padding and border above and below the lines. */
|
|
4
|
+
readonly around: number;
|
|
5
|
+
/** The height of one line. */
|
|
6
|
+
readonly line: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The height a growing field takes: what its text needs, held to `maxRows`
|
|
10
|
+
* lines where that is a positive number. The second answer says whether the
|
|
11
|
+
* text is taller than the cap, so the field scrolls.
|
|
12
|
+
*/
|
|
13
|
+
export declare const grownHeight: (needed: number, maxRows: number | undefined, metrics: LineMetrics) => {
|
|
14
|
+
height: number;
|
|
15
|
+
scrolls: boolean;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Reads a box's line height and what it adds around its lines from its
|
|
19
|
+
* computed style. A `normal` line height counts as 1.2 times the font size,
|
|
20
|
+
* which is what browsers draw it as for most fonts.
|
|
21
|
+
*/
|
|
22
|
+
export declare const lineMetrics: (style: CSSStyleDeclaration) => LineMetrics;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const grownHeight = (needed, maxRows, metrics) => {
|
|
2
|
+
if (maxRows === undefined || !(maxRows > 0) || metrics.line <= 0) {
|
|
3
|
+
return { height: needed, scrolls: false };
|
|
4
|
+
}
|
|
5
|
+
const cap = Math.ceil(maxRows * metrics.line + metrics.around);
|
|
6
|
+
return needed > cap ? { height: cap, scrolls: true } : { height: needed, scrolls: false };
|
|
7
|
+
};
|
|
8
|
+
export const lineMetrics = (style) => {
|
|
9
|
+
const px = (value) => Number.parseFloat(value) || 0;
|
|
10
|
+
const line = style.lineHeight === 'normal' || style.lineHeight === ''
|
|
11
|
+
? px(style.fontSize) * 1.2
|
|
12
|
+
: px(style.lineHeight);
|
|
13
|
+
const around = style.boxSizing === 'border-box'
|
|
14
|
+
? px(style.paddingBlockStart) +
|
|
15
|
+
px(style.paddingBlockEnd) +
|
|
16
|
+
px(style.borderBlockStartWidth) +
|
|
17
|
+
px(style.borderBlockEndWidth)
|
|
18
|
+
: 0;
|
|
19
|
+
return { around, line };
|
|
20
|
+
};
|
|
@@ -14,6 +14,8 @@ declare const HelixHeadlessTextarea_base: (new (...args: any[]) => import("@fusi
|
|
|
14
14
|
*
|
|
15
15
|
* `rows` sets the starting height, and `auto-grow` makes the field grow with
|
|
16
16
|
* its content. You can use both: `rows` sets where an empty field begins.
|
|
17
|
+
* `max-rows` stops the growth at that many lines, and the field scrolls past
|
|
18
|
+
* them.
|
|
17
19
|
*
|
|
18
20
|
* @since 0.1.0
|
|
19
21
|
* @status stable
|
|
@@ -21,9 +23,11 @@ declare const HelixHeadlessTextarea_base: (new (...args: any[]) => import("@fusi
|
|
|
21
23
|
* @aliases Multiline, TextArea
|
|
22
24
|
* @documentation https://fusion.dev/helix/components/textarea
|
|
23
25
|
*
|
|
26
|
+
* @slot end - After the text, for an icon or an action beside it.
|
|
24
27
|
* @slot feedback - The message that says what is wrong, for content richer than a string. It shows while there is a message.
|
|
25
28
|
* @slot hint - Help under the control, for content richer than the `hint` text.
|
|
26
29
|
* @slot label - The label, for content richer than the `label` text.
|
|
30
|
+
* @slot start - Before the text, for an icon.
|
|
27
31
|
*
|
|
28
32
|
* @event {Event} change - Sent from the textarea when the user finishes an edit.
|
|
29
33
|
* @event {HelixBeforeChangeEvent} helix-before-change - Fired as the text changes, and cancelable.
|
|
@@ -79,6 +83,11 @@ export declare class HelixHeadlessTextarea extends HelixHeadlessTextarea_base {
|
|
|
79
83
|
* The most characters the value can have.
|
|
80
84
|
*/
|
|
81
85
|
maxLength?: number;
|
|
86
|
+
/**
|
|
87
|
+
* How many lines an `auto-grow` field grows to before it scrolls. Absent,
|
|
88
|
+
* it grows with all of its text.
|
|
89
|
+
*/
|
|
90
|
+
maxRows?: number;
|
|
82
91
|
/**
|
|
83
92
|
* The fewest characters the value can have.
|
|
84
93
|
*
|
|
@@ -7,6 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { AriaForwardController, customElement, HelixFormElement, holdCaret, isRtl, MixinControllerValue, MixinField, restoreValue, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { html, nothing } from 'lit';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
|
+
import { grownHeight, lineMetrics } from '../grow.js';
|
|
10
11
|
let HelixHeadlessTextarea = class HelixHeadlessTextarea extends MixinControllerValue(MixinField(HelixFormElement)) {
|
|
11
12
|
constructor() {
|
|
12
13
|
super(...arguments);
|
|
@@ -51,7 +52,9 @@ let HelixHeadlessTextarea = class HelixHeadlessTextarea extends MixinControllerV
|
|
|
51
52
|
if (next === 0) {
|
|
52
53
|
return;
|
|
53
54
|
}
|
|
54
|
-
|
|
55
|
+
const grown = grownHeight(next, this.maxRows, lineMetrics(getComputedStyle(control)));
|
|
56
|
+
control.style.blockSize = `${grown.height}px`;
|
|
57
|
+
control.style.overflowY = grown.scrolls ? 'auto' : '';
|
|
55
58
|
}
|
|
56
59
|
formValue() {
|
|
57
60
|
const control = this.control;
|
|
@@ -155,6 +158,7 @@ let HelixHeadlessTextarea = class HelixHeadlessTextarea extends MixinControllerV
|
|
|
155
158
|
render() {
|
|
156
159
|
return html `${this.renderLabel()}
|
|
157
160
|
<div part="field">
|
|
161
|
+
<slot name="start"></slot>
|
|
158
162
|
<textarea
|
|
159
163
|
part="control"
|
|
160
164
|
id=${this.controlId}
|
|
@@ -175,6 +179,7 @@ let HelixHeadlessTextarea = class HelixHeadlessTextarea extends MixinControllerV
|
|
|
175
179
|
@input=${this.handleInput}
|
|
176
180
|
@change=${this.handleChange}
|
|
177
181
|
></textarea>
|
|
182
|
+
<slot name="end"></slot>
|
|
178
183
|
</div>
|
|
179
184
|
${this.renderHint()}${this.renderFeedback()}`;
|
|
180
185
|
}
|
|
@@ -194,6 +199,9 @@ __decorate([
|
|
|
194
199
|
__decorate([
|
|
195
200
|
property({ attribute: 'maxlength', type: Number })
|
|
196
201
|
], HelixHeadlessTextarea.prototype, "maxLength", void 0);
|
|
202
|
+
__decorate([
|
|
203
|
+
property({ attribute: 'max-rows', type: Number })
|
|
204
|
+
], HelixHeadlessTextarea.prototype, "maxRows", void 0);
|
|
197
205
|
__decorate([
|
|
198
206
|
property({ attribute: 'minlength', type: Number })
|
|
199
207
|
], HelixHeadlessTextarea.prototype, "minLength", void 0);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { AriaForwardController, HelixFormElement } from '@fusion.dev/helix-core';
|
|
1
|
+
import { AriaForwardController, HelixFormElement, type HourCycle } from '@fusion.dev/helix-core';
|
|
2
2
|
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
3
3
|
import '../../tag/index.js';
|
|
4
4
|
import '../../time-picker/index.js';
|
|
5
|
-
declare const HelixHeadlessTimeInput_base: (new (...args: any[]) => import("@fusion.dev/helix-core").MixinPickerEditingInterface) & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinPickerFieldInterface) & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinControllerOpenInterface) & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinTokensInterface) & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinControllerValueInterface) & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinFieldInterface) & typeof HelixFormElement;
|
|
5
|
+
declare const HelixHeadlessTimeInput_base: (new (...args: any[]) => import("@fusion.dev/helix-core").MixinSegmentedFieldInterface) & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinPickerEditingInterface) & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinPickerFieldInterface) & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinControllerOpenInterface) & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinTokensInterface) & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinControllerValueInterface) & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinFieldInterface) & typeof HelixFormElement;
|
|
6
6
|
/**
|
|
7
7
|
* @summary A field for a time, typed or picked from a list.
|
|
8
8
|
*
|
|
@@ -15,7 +15,8 @@ declare const HelixHeadlessTimeInput_base: (new (...args: any[]) => import("@fus
|
|
|
15
15
|
* You can type a time or pick one. The list offers times at a step, and the
|
|
16
16
|
* field lets you enter any time, such as `09:07`.
|
|
17
17
|
*
|
|
18
|
-
* The value is always `HH:mm` on a 24-hour clock,
|
|
18
|
+
* The value is always `HH:mm` on a 24-hour clock, or `HH:mm:ss` with
|
|
19
|
+
* `seconds`, because that is what the form
|
|
19
20
|
* submits, what `min` and `max` compare against, and what sorts correctly as a
|
|
20
21
|
* string. While idle, the field shows the time in the user's locale format.
|
|
21
22
|
* Once the caret is in the field, it shows the value itself, because a
|
|
@@ -23,11 +24,16 @@ declare const HelixHeadlessTimeInput_base: (new (...args: any[]) => import("@fus
|
|
|
23
24
|
* parser for it.
|
|
24
25
|
*
|
|
25
26
|
* Typing sends `input` on each keystroke and `change` when you leave the
|
|
26
|
-
* field.
|
|
27
|
+
* field. The trigger and ArrowDown open the list, and so does a press into the
|
|
28
|
+
* field; Tab into the field opens nothing. In the list, the arrow keys, typed digits and PageUp and PageDown
|
|
27
29
|
* move through the times, and Enter, Space or a click chooses one and closes
|
|
28
30
|
* the panel. With `variant="wheels"` each wheel moves the time as you turn it,
|
|
29
31
|
* the panel stays open, and Enter or Escape closes it.
|
|
30
32
|
*
|
|
33
|
+
* With `segmented`, the field is a row of segments in place of the text: an
|
|
34
|
+
* hour, a minute, and AM or PM where the clock has them, each set with digits
|
|
35
|
+
* or the arrow keys. Alt+Down opens the list from a segment.
|
|
36
|
+
*
|
|
31
37
|
* @since 0.1.0
|
|
32
38
|
* @status stable
|
|
33
39
|
* @category forms
|
|
@@ -50,6 +56,7 @@ declare const HelixHeadlessTimeInput_base: (new (...args: any[]) => import("@fus
|
|
|
50
56
|
* @csspart field - The box that holds the text and the trigger.
|
|
51
57
|
* @csspart hint - Help under the field, while nothing is wrong.
|
|
52
58
|
* @csspart label - The label above the field.
|
|
59
|
+
* @csspart literal - The text the locale writes between two segments, such as a colon, in `segmented`.
|
|
53
60
|
* @csspart picker - The time picker inside the panel.
|
|
54
61
|
* @csspart picker-column - One column of the picker.
|
|
55
62
|
* @csspart picker-column-empty - The text shown when the filter hides every option.
|
|
@@ -85,12 +92,17 @@ declare const HelixHeadlessTimeInput_base: (new (...args: any[]) => import("@fus
|
|
|
85
92
|
* @csspart picker-option-label - The option's label.
|
|
86
93
|
* @csspart picker-option-text - The label and the caption, as one column.
|
|
87
94
|
* @csspart rest - The count of times held beyond the ones shown. A `<button>` with `expandable`, and a `<span>` without it.
|
|
95
|
+
* @csspart segment - One part of the time, an hour, a minute, a second or AM and PM, in `segmented`.
|
|
96
|
+
* @csspart segment-placeholder - A segment with nothing in it yet. Applied with `segment`.
|
|
97
|
+
* @csspart segments - The row of segments that holds the time, in `segmented`.
|
|
88
98
|
* @csspart surface - The floating panel.
|
|
89
99
|
* @csspart tags - The row the times sit in.
|
|
90
100
|
* @csspart time - One held time, as a tag, in `multiple`.
|
|
101
|
+
* @csspart time-cell - The tag's grid cell, which a tag draws only inside a tag group.
|
|
91
102
|
* @csspart time-dismiss - The remove button, when `dismissible`.
|
|
92
103
|
* @csspart time-dismiss-mark - The default icon on the remove button, shown when none is slotted.
|
|
93
104
|
* @csspart time-label - The label, trimmed to its capitals and baseline.
|
|
105
|
+
* @csspart time-link - The tag's link around its label, which a tag draws only with `href`.
|
|
94
106
|
* @csspart time-start - The category before the label.
|
|
95
107
|
* @csspart trigger - The control that opens the list.
|
|
96
108
|
* @csspart trigger-icon - The icon on the button that opens the clock.
|
|
@@ -116,6 +128,13 @@ export declare class HelixHeadlessTimeInput extends HelixHeadlessTimeInput_base
|
|
|
116
128
|
* a typed time, which is then invalid.
|
|
117
129
|
*/
|
|
118
130
|
disableTimes: string;
|
|
131
|
+
/**
|
|
132
|
+
* The clock the times are written on: `h12` for twelve hours with a
|
|
133
|
+
* meridiem, `h23` for twenty-four. Absent is the locale's own.
|
|
134
|
+
*
|
|
135
|
+
* Handed to the list. The value is `HH:mm` on twenty-four hours either way.
|
|
136
|
+
*/
|
|
137
|
+
hourCycle?: HourCycle;
|
|
119
138
|
/**
|
|
120
139
|
* Language tag the times are written in.
|
|
121
140
|
*
|
|
@@ -169,7 +188,14 @@ export declare class HelixHeadlessTimeInput extends HelixHeadlessTimeInput_base
|
|
|
169
188
|
*/
|
|
170
189
|
removeLabel: string;
|
|
171
190
|
/**
|
|
172
|
-
*
|
|
191
|
+
* Whether times carry their seconds: the value is `HH:mm:ss`, a typed time
|
|
192
|
+
* may give them, the field writes them, and the list's `step` counts seconds.
|
|
193
|
+
* See Time Picker's `seconds`.
|
|
194
|
+
*/
|
|
195
|
+
seconds: boolean;
|
|
196
|
+
/**
|
|
197
|
+
* How far apart the offered times are, in minutes, or in seconds with
|
|
198
|
+
* `seconds`.
|
|
173
199
|
*/
|
|
174
200
|
step: number;
|
|
175
201
|
/**
|
|
@@ -192,6 +218,19 @@ export declare class HelixHeadlessTimeInput extends HelixHeadlessTimeInput_base
|
|
|
192
218
|
unavailableMessage?: string;
|
|
193
219
|
/** Every time in the value, which may hold more than one. */
|
|
194
220
|
private get held();
|
|
221
|
+
/**
|
|
222
|
+
* Segments hold one time, so `range` and `multiple` keep the line of text,
|
|
223
|
+
* whose separators and tags are how those modes write several.
|
|
224
|
+
*/
|
|
225
|
+
protected get segmentable(): boolean;
|
|
226
|
+
protected get segmentedKind(): 'time';
|
|
227
|
+
protected get segmentLocale(): string;
|
|
228
|
+
protected get segmentOptions(): {
|
|
229
|
+
hourCycle?: HourCycle | undefined;
|
|
230
|
+
seconds: boolean;
|
|
231
|
+
};
|
|
232
|
+
/** Whether a typed time is one this field holds, to the second where it holds seconds. */
|
|
233
|
+
private isTime;
|
|
195
234
|
/** One time, written the way `time-style` asks for. */
|
|
196
235
|
private written;
|
|
197
236
|
/** What the field shows: the value while it is being edited, a reading when not. */
|
|
@@ -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, valueAsTime as asTime, customElement, fillTemplate, timeAsValue as fromTime, HelixFormElement,
|
|
7
|
+
import { AriaForwardController, valueAsTime as asTime, clockLocale, customElement, fillTemplate, timeAsValue as fromTime, HelixFormElement, isClockValue, MixinControllerOpen, MixinControllerValue, MixinField, MixinPickerEditing, MixinPickerField, MixinSegmentedField, MixinTokens, timeFault, writeClock, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { clock } from '@fusion.dev/helix-icons';
|
|
9
9
|
import { nothing } from 'lit';
|
|
10
10
|
import { property, state } from 'lit/decorators.js';
|
|
@@ -12,11 +12,11 @@ import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
|
|
|
12
12
|
import { html } from 'lit/static-html.js';
|
|
13
13
|
import '../../tag/index.js';
|
|
14
14
|
import '../../time-picker/index.js';
|
|
15
|
-
let HelixHeadlessTimeInput = class HelixHeadlessTimeInput extends MixinPickerEditing(MixinPickerField(MixinControllerOpen(MixinTokens(MixinControllerValue(MixinField(HelixFormElement)))))) {
|
|
15
|
+
let HelixHeadlessTimeInput = class HelixHeadlessTimeInput extends MixinSegmentedField(MixinPickerEditing(MixinPickerField(MixinControllerOpen(MixinTokens(MixinControllerValue(MixinField(HelixFormElement))))))) {
|
|
16
16
|
constructor() {
|
|
17
17
|
super(...arguments);
|
|
18
18
|
this.aria = new AriaForwardController(this, {
|
|
19
|
-
target: () => this.partNamed('control'),
|
|
19
|
+
target: () => this.partNamed('control') ?? this.segmentGroup,
|
|
20
20
|
});
|
|
21
21
|
this.autocomplete = '';
|
|
22
22
|
this.announcesInput = true;
|
|
@@ -26,6 +26,7 @@ let HelixHeadlessTimeInput = class HelixHeadlessTimeInput extends MixinPickerEdi
|
|
|
26
26
|
this.min = '00:00';
|
|
27
27
|
this.placeholder = 'HH:mm';
|
|
28
28
|
this.removeLabel = 'Remove {name}';
|
|
29
|
+
this.seconds = false;
|
|
29
30
|
this.step = 15;
|
|
30
31
|
this.timeStyle = 'local';
|
|
31
32
|
this.triggerLabel = 'Choose a time';
|
|
@@ -35,7 +36,7 @@ let HelixHeadlessTimeInput = class HelixHeadlessTimeInput extends MixinPickerEdi
|
|
|
35
36
|
return;
|
|
36
37
|
}
|
|
37
38
|
const held = this.held;
|
|
38
|
-
if (event.key === 'Enter' &&
|
|
39
|
+
if (event.key === 'Enter' && this.isTime(this.draft)) {
|
|
39
40
|
event.preventDefault();
|
|
40
41
|
if (!held.includes(this.draft)) {
|
|
41
42
|
this.requestPicked([...held, this.draft].sort().join(','));
|
|
@@ -62,7 +63,7 @@ let HelixHeadlessTimeInput = class HelixHeadlessTimeInput extends MixinPickerEdi
|
|
|
62
63
|
.split(',')
|
|
63
64
|
.map((one) => one.trim())
|
|
64
65
|
.filter(Boolean);
|
|
65
|
-
const whole = held.length > 0 && held.every(
|
|
66
|
+
const whole = held.length > 0 && held.every((one) => this.isTime(one));
|
|
66
67
|
this.requestValue(whole ? held.join(',') : typed);
|
|
67
68
|
this.restore();
|
|
68
69
|
};
|
|
@@ -94,8 +95,25 @@ let HelixHeadlessTimeInput = class HelixHeadlessTimeInput extends MixinPickerEdi
|
|
|
94
95
|
.map((one) => one.trim())
|
|
95
96
|
.filter(Boolean);
|
|
96
97
|
}
|
|
98
|
+
get segmentable() {
|
|
99
|
+
return this.mode === undefined;
|
|
100
|
+
}
|
|
101
|
+
get segmentedKind() {
|
|
102
|
+
return 'time';
|
|
103
|
+
}
|
|
104
|
+
get segmentLocale() {
|
|
105
|
+
return this.locale;
|
|
106
|
+
}
|
|
107
|
+
get segmentOptions() {
|
|
108
|
+
return { hourCycle: this.hourCycle, seconds: this.seconds };
|
|
109
|
+
}
|
|
110
|
+
isTime(at) {
|
|
111
|
+
return isClockValue(at, this.seconds);
|
|
112
|
+
}
|
|
97
113
|
written(at) {
|
|
98
|
-
return this.timeStyle === 'iso' || !
|
|
114
|
+
return this.timeStyle === 'iso' || !this.isTime(at)
|
|
115
|
+
? at
|
|
116
|
+
: writeClock(at, clockLocale(this.locale, this.hourCycle), this.seconds);
|
|
99
117
|
}
|
|
100
118
|
get display() {
|
|
101
119
|
if (this.mode === 'multiple') {
|
|
@@ -117,33 +135,33 @@ let HelixHeadlessTimeInput = class HelixHeadlessTimeInput extends MixinPickerEdi
|
|
|
117
135
|
}
|
|
118
136
|
get picked() {
|
|
119
137
|
const held = this.held;
|
|
120
|
-
return held.length > 0 && held.every(
|
|
138
|
+
return held.length > 0 && held.every((one) => this.isTime(one)) ? held.join(',') : '';
|
|
121
139
|
}
|
|
122
140
|
get answers() {
|
|
123
141
|
return this.mode === undefined ? undefined : this.held;
|
|
124
142
|
}
|
|
125
143
|
validate() {
|
|
126
144
|
const held = this.held;
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
if (held.length > 0 && !held.every(isTimeValue)) {
|
|
145
|
+
const shape = this.seconds ? 'HH:mm:ss' : 'HH:mm';
|
|
146
|
+
if (held.length > 0 && !held.every((one) => this.isTime(one))) {
|
|
130
147
|
return (this.badInputMessage ||
|
|
131
148
|
(this.mode === undefined
|
|
132
|
-
?
|
|
133
|
-
:
|
|
149
|
+
? `Enter a time as ${shape}.`
|
|
150
|
+
: `Enter times as ${shape}, separated by commas.`));
|
|
134
151
|
}
|
|
135
|
-
|
|
152
|
+
const rules = { disableTimes: this.disableTimes, max: this.max, min: this.min };
|
|
153
|
+
const faults = held.map((one) => timeFault(one, rules));
|
|
154
|
+
if (faults.includes('rangeUnderflow')) {
|
|
136
155
|
return fillTemplate(this.rangeUnderflowMessage || 'Choose a time at or after {min}.', {
|
|
137
|
-
min:
|
|
156
|
+
min: writeClock(this.min, clockLocale(this.locale, this.hourCycle), this.seconds),
|
|
138
157
|
});
|
|
139
158
|
}
|
|
140
|
-
if (
|
|
159
|
+
if (faults.includes('rangeOverflow')) {
|
|
141
160
|
return fillTemplate(this.rangeOverflowMessage || 'Choose a time at or before {max}.', {
|
|
142
|
-
max:
|
|
161
|
+
max: writeClock(this.max, clockLocale(this.locale, this.hourCycle), this.seconds),
|
|
143
162
|
});
|
|
144
163
|
}
|
|
145
|
-
|
|
146
|
-
if (held.some((one) => barred.includes(one))) {
|
|
164
|
+
if (faults.includes('unavailable')) {
|
|
147
165
|
return this.unavailableMessage || 'Choose a time that is available.';
|
|
148
166
|
}
|
|
149
167
|
if (this.mode === 'range' && held.length > 2) {
|
|
@@ -181,9 +199,11 @@ let HelixHeadlessTimeInput = class HelixHeadlessTimeInput extends MixinPickerEdi
|
|
|
181
199
|
disable-times=${this.disableTimes || nothing}
|
|
182
200
|
manual
|
|
183
201
|
label=${this.label || 'Time'}
|
|
202
|
+
hour-cycle=${this.hourCycle ?? nothing}
|
|
184
203
|
locale=${this.locale || nothing}
|
|
185
204
|
max=${this.max}
|
|
186
205
|
min=${this.min}
|
|
206
|
+
?seconds=${this.seconds}
|
|
187
207
|
step=${this.step}
|
|
188
208
|
.value=${this.picked}
|
|
189
209
|
@helix-before-change=${this.handlePicked}
|
|
@@ -194,7 +214,7 @@ let HelixHeadlessTimeInput = class HelixHeadlessTimeInput extends MixinPickerEdi
|
|
|
194
214
|
renderTag(at) {
|
|
195
215
|
return html `<${this.tag('tag')}
|
|
196
216
|
part="time"
|
|
197
|
-
exportparts="dismiss: time-dismiss, dismiss-mark: time-dismiss-mark, label: time-label, start: time-start"
|
|
217
|
+
exportparts="cell: time-cell, dismiss: time-dismiss, dismiss-mark: time-dismiss-mark, label: time-label, link: time-link, start: time-start"
|
|
198
218
|
dismissible
|
|
199
219
|
dismiss-label=${fillTemplate(this.removeLabel, { name: this.written(at) })}
|
|
200
220
|
?disabled=${this.isDisabled}
|
|
@@ -216,26 +236,30 @@ let HelixHeadlessTimeInput = class HelixHeadlessTimeInput extends MixinPickerEdi
|
|
|
216
236
|
${this.mode === 'multiple'
|
|
217
237
|
? this.renderTokenRow(this.shownTimes.map((at) => this.renderTag(at)), this.restCount)
|
|
218
238
|
: nothing}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
+
${this.segmentsShown
|
|
240
|
+
? this.renderSegments()
|
|
241
|
+
: html `<input
|
|
242
|
+
part="control"
|
|
243
|
+
id=${this.controlId}
|
|
244
|
+
type="text"
|
|
245
|
+
.value=${this.display}
|
|
246
|
+
name=${this.name || nothing}
|
|
247
|
+
placeholder=${this.mode === 'multiple' && this.held.length > 0
|
|
248
|
+
? nothing
|
|
249
|
+
: this.placeholder || nothing}
|
|
250
|
+
autocomplete=${this.autocomplete || nothing}
|
|
251
|
+
aria-describedby=${this.describedBy ?? nothing}
|
|
252
|
+
aria-invalid=${this.invalidity ?? nothing}
|
|
253
|
+
?disabled=${this.isDisabled}
|
|
254
|
+
?readonly=${this.readOnly}
|
|
255
|
+
?required=${this.required}
|
|
256
|
+
@blur=${this.handleBlur}
|
|
257
|
+
@change=${this.handleCommit}
|
|
258
|
+
@focus=${this.handleFocus}
|
|
259
|
+
@input=${this.handleInput}
|
|
260
|
+
@keydown=${this.handleDraftKey}
|
|
261
|
+
@keypress=${this.handleKeypress}
|
|
262
|
+
/>`}
|
|
239
263
|
<button
|
|
240
264
|
part="trigger"
|
|
241
265
|
type="button"
|
|
@@ -284,6 +308,9 @@ __decorate([
|
|
|
284
308
|
__decorate([
|
|
285
309
|
property({ attribute: 'disable-times' })
|
|
286
310
|
], HelixHeadlessTimeInput.prototype, "disableTimes", void 0);
|
|
311
|
+
__decorate([
|
|
312
|
+
property({ attribute: 'hour-cycle' })
|
|
313
|
+
], HelixHeadlessTimeInput.prototype, "hourCycle", void 0);
|
|
287
314
|
__decorate([
|
|
288
315
|
property()
|
|
289
316
|
], HelixHeadlessTimeInput.prototype, "locale", void 0);
|
|
@@ -311,6 +338,9 @@ __decorate([
|
|
|
311
338
|
__decorate([
|
|
312
339
|
property({ attribute: 'remove-label' })
|
|
313
340
|
], HelixHeadlessTimeInput.prototype, "removeLabel", void 0);
|
|
341
|
+
__decorate([
|
|
342
|
+
property({ type: Boolean })
|
|
343
|
+
], HelixHeadlessTimeInput.prototype, "seconds", void 0);
|
|
314
344
|
__decorate([
|
|
315
345
|
property({ type: Number })
|
|
316
346
|
], HelixHeadlessTimeInput.prototype, "step", void 0);
|