@fusion.dev/helix-headless 0.147.0 → 0.149.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 +11222 -2332
- package/dist/accordion/item/accordion-item.d.ts +5 -2
- package/dist/accordion/item/accordion-item.js +11 -7
- package/dist/accordion/root/accordion-root.js +4 -6
- package/dist/announcement/root/announcement-root.d.ts +61 -5
- package/dist/announcement/root/announcement-root.js +126 -20
- package/dist/area-chart/root/area-chart-root.d.ts +11 -0
- package/dist/area-chart/root/area-chart-root.js +21 -9
- package/dist/avatar/group/avatar-group.d.ts +10 -2
- package/dist/avatar/group/avatar-group.js +10 -5
- package/dist/badge/count.d.ts +19 -0
- package/dist/badge/count.js +20 -0
- package/dist/badge/root/badge-root.d.ts +6 -2
- package/dist/badge/root/badge-root.js +8 -22
- package/dist/bar-chart/root/bar-chart-root.d.ts +13 -1
- package/dist/bar-chart/root/bar-chart-root.js +17 -4
- package/dist/blockquote/root/blockquote-root.d.ts +66 -8
- package/dist/blockquote/root/blockquote-root.js +85 -8
- package/dist/breadcrumbs/breadcrumb/breadcrumb.js +2 -2
- package/dist/breadcrumbs/root/breadcrumbs-root.d.ts +8 -1
- package/dist/breadcrumbs/root/breadcrumbs-root.js +5 -2
- package/dist/button/root/button-root.d.ts +10 -1
- package/dist/button/root/button-root.js +3 -2
- package/dist/button-group/arrows.d.ts +14 -0
- package/dist/button-group/arrows.js +10 -0
- package/dist/button-group/root/button-group-root.d.ts +144 -3
- package/dist/button-group/root/button-group-root.js +142 -2
- package/dist/callout/root/callout-root.d.ts +16 -2
- package/dist/callout/root/callout-root.js +16 -4
- package/dist/canvas/describe.d.ts +10 -0
- package/dist/canvas/describe.js +9 -0
- package/dist/canvas/edge-pan.d.ts +61 -0
- package/dist/canvas/edge-pan.js +63 -0
- package/dist/canvas/neighbor.d.ts +17 -0
- package/dist/canvas/neighbor.js +1 -0
- package/dist/canvas/node/canvas-node.d.ts +12 -2
- package/dist/canvas/node/canvas-node.js +8 -3
- package/dist/canvas/root/canvas-document.d.ts +10 -0
- package/dist/canvas/root/canvas-document.js +1 -0
- package/dist/canvas/root/canvas-root.d.ts +168 -9
- package/dist/canvas/root/canvas-root.js +239 -69
- package/dist/canvas/snap.d.ts +42 -0
- package/dist/canvas/snap.js +32 -0
- package/dist/carousel/root/carousel-root.d.ts +9 -3
- package/dist/carousel/root/carousel-root.js +17 -10
- package/dist/chat/composer/chat-composer.d.ts +5 -0
- package/dist/chat/composer/chat-composer.js +4 -1
- package/dist/chat/message/chat-message.d.ts +9 -5
- package/dist/chat/message/chat-message.js +8 -4
- package/dist/chat/naming.js +2 -2
- package/dist/chat/root/chat-root.d.ts +40 -4
- package/dist/chat/root/chat-root.js +38 -14
- package/dist/checkbox/root/checkbox-root.d.ts +11 -0
- package/dist/checkbox/root/checkbox-root.js +8 -2
- package/dist/checkbox-group/root/checkbox-group-root.d.ts +24 -0
- package/dist/checkbox-group/root/checkbox-group-root.js +28 -12
- package/dist/checkbox-group/select-all.d.ts +11 -0
- package/dist/checkbox-group/select-all.js +5 -0
- package/dist/code-block/root/code-block-root.d.ts +20 -8
- package/dist/code-block/root/code-block-root.js +16 -5
- package/dist/color-input/root/color-input-root.d.ts +13 -0
- package/dist/color-input/root/color-input-root.js +18 -5
- package/dist/color-picker/root/color-picker-root.d.ts +19 -3
- package/dist/color-picker/root/color-picker-root.js +52 -24
- package/dist/color-picker/wheel.d.ts +11 -0
- package/dist/color-picker/wheel.js +9 -0
- package/dist/combobox/root/combobox-root.d.ts +106 -18
- package/dist/combobox/root/combobox-root.js +101 -26
- package/dist/command/root/command-root.d.ts +19 -9
- package/dist/command/root/command-root.js +9 -4
- package/dist/copy-button/root/copy-button-root.d.ts +5 -0
- package/dist/copy-button/root/copy-button-root.js +7 -2
- package/dist/data-table/root/data-table-root.d.ts +171 -29
- package/dist/data-table/root/data-table-root.js +284 -161
- package/dist/date-input/root/date-input-root.d.ts +32 -9
- package/dist/date-input/root/date-input-root.js +66 -44
- package/dist/date-picker/root/date-picker-root.d.ts +38 -15
- package/dist/date-picker/root/date-picker-root.js +52 -33
- package/dist/description-list/item/description-list-item.d.ts +4 -0
- package/dist/description-list/item/description-list-item.js +7 -1
- package/dist/dialog/root/dialog-root.d.ts +12 -1
- package/dist/dialog/root/dialog-root.js +11 -4
- package/dist/divider/root/divider-root.d.ts +45 -16
- package/dist/divider/root/divider-root.js +28 -4
- package/dist/donut-chart/root/donut-chart-root.d.ts +5 -0
- package/dist/donut-chart/root/donut-chart-root.js +8 -5
- package/dist/drawer/root/drawer-root.d.ts +12 -1
- package/dist/drawer/root/drawer-root.js +9 -2
- package/dist/drilldown/item/drilldown-item.js +3 -4
- package/dist/drilldown/root/drilldown-root.d.ts +5 -0
- package/dist/drilldown/root/drilldown-root.js +4 -1
- package/dist/element-events.generated.js +26 -3
- package/dist/empty/root/empty-root.d.ts +17 -3
- package/dist/empty/root/empty-root.js +29 -5
- package/dist/file-input/root/file-input-root.d.ts +18 -3
- package/dist/file-input/root/file-input-root.js +34 -18
- package/dist/file-input/status.js +2 -1
- package/dist/filter-input/chip/filter-chip.d.ts +13 -0
- package/dist/filter-input/chip/filter-chip.js +7 -3
- package/dist/filter-input/menu/filter-menu.d.ts +5 -0
- package/dist/filter-input/menu/filter-menu.js +3 -1
- package/dist/filter-input/root/filter-input-root.d.ts +20 -3
- package/dist/filter-input/root/filter-input-root.js +8 -4
- package/dist/format-date/fields.d.ts +20 -0
- package/dist/format-date/fields.js +14 -0
- package/dist/format-date/options.d.ts +2 -1
- package/dist/format-date/options.js +9 -38
- package/dist/format-date/root/format-date-root.d.ts +55 -5
- package/dist/format-date/root/format-date-root.js +29 -34
- package/dist/graph/root/graph-model.d.ts +11 -0
- package/dist/graph/root/graph-model.js +4 -0
- package/dist/graph/root/graph-root.d.ts +101 -14
- package/dist/graph/root/graph-root.js +140 -46
- package/dist/heatmap/root/heatmap-root.d.ts +37 -4
- package/dist/heatmap/root/heatmap-root.js +51 -16
- package/dist/icon-button/root/icon-button-root.d.ts +5 -0
- package/dist/icon-button/root/icon-button-root.js +1 -0
- package/dist/image/root/image-root.d.ts +11 -0
- package/dist/input/root/input-root.d.ts +5 -0
- package/dist/input/root/input-root.js +4 -1
- package/dist/kbd/root/kbd-root.js +1 -2
- package/dist/legend/root/legend-root.js +4 -17
- package/dist/lightbox/root/lightbox-root.d.ts +14 -4
- package/dist/lightbox/root/lightbox-root.js +25 -7
- package/dist/line-chart/root/line-chart-root.d.ts +5 -0
- package/dist/line-chart/root/line-chart-root.js +4 -2
- package/dist/list/item/list-item.d.ts +32 -0
- package/dist/list/item/list-item.js +34 -7
- package/dist/list/root/list-root.d.ts +87 -0
- package/dist/list/root/list-root.js +119 -23
- package/dist/listbox/reorder/index.d.ts +1 -0
- package/dist/listbox/reorder/index.js +4 -0
- package/dist/listbox/reorder/listbox-reorder.d.ts +83 -0
- package/dist/listbox/reorder/listbox-reorder.js +151 -0
- package/dist/listbox/root/listbox-root.d.ts +185 -33
- package/dist/listbox/root/listbox-root.js +166 -136
- package/dist/loader/root/loader-root.d.ts +5 -0
- package/dist/loader/root/loader-root.js +3 -1
- package/dist/map/area/map-area.d.ts +5 -0
- package/dist/map/area/map-area.js +3 -1
- package/dist/map/buildings/map-buildings.d.ts +5 -0
- package/dist/map/buildings/map-buildings.js +3 -1
- package/dist/map/contours/map-contours.d.ts +5 -0
- package/dist/map/contours/map-contours.js +3 -1
- package/dist/map/landcover/map-landcover.d.ts +5 -0
- package/dist/map/landcover/map-landcover.js +3 -1
- package/dist/map/marker/map-marker.d.ts +18 -2
- package/dist/map/marker/map-marker.js +13 -5
- package/dist/map/points/map-points.d.ts +5 -0
- package/dist/map/points/map-points.js +6 -4
- package/dist/map/position/map-position.d.ts +5 -0
- package/dist/map/position/map-position.js +3 -1
- package/dist/map/raster/map-raster.d.ts +5 -0
- package/dist/map/raster/map-raster.js +3 -1
- package/dist/map/root/map-root.d.ts +73 -16
- package/dist/map/root/map-root.js +122 -44
- package/dist/map/route/map-route.d.ts +5 -0
- package/dist/map/route/map-route.js +3 -1
- package/dist/map/terrain/map-terrain.d.ts +5 -0
- package/dist/map/terrain/map-terrain.js +3 -1
- package/dist/megamenu/root/megamenu-root.js +4 -11
- package/dist/menu/root/menu-root.d.ts +7 -2
- package/dist/menu/root/menu-root.js +3 -1
- package/dist/meter/root/meter-root.d.ts +16 -3
- package/dist/meter/root/meter-root.js +12 -5
- package/dist/navigation/root/navigation-root.d.ts +5 -0
- package/dist/navigation/root/navigation-root.js +7 -8
- package/dist/notifications/group/notification-group.d.ts +8 -1
- package/dist/notifications/group/notification-group.js +12 -6
- package/dist/notifications/notification/notification.d.ts +17 -1
- package/dist/notifications/notification/notification.js +6 -2
- package/dist/notifications/root/notifications-root.d.ts +49 -5
- package/dist/notifications/root/notifications-root.js +36 -8
- package/dist/number-input/root/number-input-root.d.ts +21 -8
- package/dist/number-input/root/number-input-root.js +26 -11
- package/dist/object-inspector/root/object-inspector-root.d.ts +56 -13
- package/dist/object-inspector/root/object-inspector-root.js +41 -30
- package/dist/outline/root/outline-root.d.ts +5 -0
- package/dist/outline/root/outline-root.js +3 -1
- package/dist/pagination/root/pagination-root.d.ts +7 -1
- package/dist/pagination/root/pagination-root.js +16 -7
- package/dist/pagination/size/pagination-size.d.ts +8 -3
- package/dist/pagination/size/pagination-size.js +5 -3
- package/dist/pagination/summary/pagination-summary.d.ts +8 -6
- package/dist/pagination/summary/pagination-summary.js +4 -9
- package/dist/pin-input/code.d.ts +23 -0
- package/dist/pin-input/code.js +21 -0
- package/dist/pin-input/root/pin-input-root.d.ts +9 -3
- package/dist/pin-input/root/pin-input-root.js +13 -23
- package/dist/popover/root/popover-root.d.ts +12 -2
- package/dist/popover/root/popover-root.js +10 -4
- package/dist/progress/root/progress-root.d.ts +7 -2
- package/dist/progress/root/progress-root.js +5 -2
- package/dist/qr-code/name.d.ts +3 -2
- package/dist/qr-code/name.js +2 -2
- package/dist/qr-code/root/qr-code-root.d.ts +26 -5
- package/dist/qr-code/root/qr-code-root.js +27 -6
- package/dist/radio/group/radio-group.d.ts +11 -0
- package/dist/radio/group/radio-group.js +8 -2
- package/dist/rating/root/rating-root.d.ts +12 -1
- package/dist/rating/root/rating-root.js +10 -3
- package/dist/scatter-chart/measures.d.ts +22 -0
- package/dist/scatter-chart/measures.js +11 -0
- package/dist/scatter-chart/root/scatter-chart-root.d.ts +22 -8
- package/dist/scatter-chart/root/scatter-chart-root.js +25 -23
- package/dist/select/root/select-root.d.ts +67 -8
- package/dist/select/root/select-root.js +45 -11
- package/dist/skip-link/root/skip-link-root.d.ts +5 -0
- package/dist/skip-link/root/skip-link-root.js +3 -1
- package/dist/slider/root/slider-root.d.ts +7 -2
- package/dist/slider/root/slider-root.js +11 -5
- package/dist/sparkline/readings.d.ts +15 -5
- package/dist/sparkline/readings.js +3 -3
- package/dist/sparkline/root/sparkline-root.d.ts +9 -4
- package/dist/sparkline/root/sparkline-root.js +9 -3
- package/dist/speed-dial/group/speed-dial-group.d.ts +48 -0
- package/dist/speed-dial/group/speed-dial-group.js +43 -0
- package/dist/speed-dial/index.d.ts +1 -0
- package/dist/speed-dial/index.js +1 -0
- package/dist/speed-dial/item/speed-dial-item.d.ts +26 -1
- package/dist/speed-dial/item/speed-dial-item.js +41 -3
- package/dist/speed-dial/long-press.d.ts +50 -0
- package/dist/speed-dial/long-press.js +48 -0
- package/dist/speed-dial/root/speed-dial-root.d.ts +85 -1
- package/dist/speed-dial/root/speed-dial-root.js +117 -5
- package/dist/splitter/root/splitter-root.d.ts +12 -3
- package/dist/splitter/root/splitter-root.js +22 -4
- package/dist/steps/root/steps-root.d.ts +9 -2
- package/dist/steps/root/steps-root.js +6 -3
- package/dist/steps/step/step.d.ts +12 -0
- package/dist/steps/step/step.js +11 -2
- package/dist/switch/root/switch-root.d.ts +11 -0
- package/dist/switch/root/switch-root.js +8 -2
- package/dist/table/cell/table-cell.d.ts +8 -1
- package/dist/table/cell/table-cell.js +6 -2
- package/dist/table/column/table-column.d.ts +11 -4
- package/dist/table/column/table-column.js +15 -10
- package/dist/table/grid-controller.d.ts +122 -0
- package/dist/table/grid-controller.js +299 -0
- package/dist/table/root/table-root.d.ts +154 -8
- package/dist/table/root/table-root.js +197 -38
- package/dist/table/row/table-row.d.ts +55 -1
- package/dist/table/row/table-row.js +60 -7
- package/dist/tabs/root/tabs-root.d.ts +5 -0
- package/dist/tabs/root/tabs-root.js +3 -1
- package/dist/tag/group/tag-group.d.ts +5 -0
- package/dist/tag/group/tag-group.js +8 -15
- package/dist/tag/root/tag-root.d.ts +14 -1
- package/dist/tag/root/tag-root.js +11 -8
- package/dist/textarea/root/textarea-root.d.ts +5 -0
- package/dist/textarea/root/textarea-root.js +3 -1
- package/dist/time-input/root/time-input-root.d.ts +14 -7
- package/dist/time-input/root/time-input-root.js +43 -32
- package/dist/time-picker/root/time-picker-root.d.ts +16 -7
- package/dist/time-picker/root/time-picker-root.js +28 -12
- package/dist/toast/item/toast-item.d.ts +13 -3
- package/dist/toast/item/toast-item.js +2 -0
- package/dist/toast/root/toast-root.d.ts +22 -2
- package/dist/toast/root/toast-root.js +24 -17
- package/dist/toggle/group/toggle-group.js +3 -5
- package/dist/toolbar/root/toolbar-root.d.ts +36 -0
- package/dist/toolbar/root/toolbar-root.js +43 -9
- package/dist/tooltip/root/tooltip-root.d.ts +27 -17
- package/dist/tooltip/root/tooltip-root.js +1 -2
- package/dist/tour/root/tour-root.d.ts +8 -2
- package/dist/tour/root/tour-root.js +4 -2
- package/dist/tour/stop/tour-stop.d.ts +5 -0
- package/dist/tour/stop/tour-stop.js +6 -1
- package/dist/tree/grip.d.ts +5 -0
- package/dist/tree/grip.js +1 -0
- package/dist/tree/item/tree-item.d.ts +24 -0
- package/dist/tree/item/tree-item.js +27 -5
- package/dist/tree/root/tree-root.d.ts +66 -1
- package/dist/tree/root/tree-root.js +77 -5
- package/dist/trend/root/trend-root.d.ts +20 -4
- package/dist/trend/root/trend-root.js +20 -5
- package/dist/video/root/video-root.d.ts +23 -3
- package/dist/video/root/video-root.js +56 -15
- package/dist/video-playlist/menu/video-playlist-menu.d.ts +5 -0
- package/dist/video-playlist/menu/video-playlist-menu.js +3 -1
- package/dist/video-playlist/root/video-playlist-root.d.ts +5 -0
- package/dist/video-playlist/root/video-playlist-root.js +3 -1
- package/dist/virtual-list/root/virtual-list-root.d.ts +19 -3
- package/dist/virtual-list/root/virtual-list-root.js +10 -19
- package/lint.json +1 -1
- package/package.json +7 -6
- package/types/jsx.d.ts +6005 -2114
- package/types/svelte.d.ts +1 -0
- package/types/vue.d.ts +1594 -676
- package/types/words.d.ts +3280 -0
- package/dist/kbd/keys.d.ts +0 -29
- package/dist/kbd/keys.js +0 -52
- package/dist/toast/hotkey.d.ts +0 -22
- package/dist/toast/hotkey.js +0 -23
- package/dist/tooltip/focus-target.d.ts +0 -6
- package/dist/tooltip/focus-target.js +0 -9
|
@@ -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 { addDays, addMonths, valueAsDate as asDate, barredBy, customElement,
|
|
7
|
+
import { addDays, addMonths, valueAsDate as asDate, barredBy, calendarLocale, customElement, formatWords, dateAsValue as fromDate, HelixFormElement, HelixNavigateEvent, handedLocale, hostAria, inlineStep, commaList as list, localToday, MixinControllerValue, MixinPickerFeedback, monthOf, monthOut, periodCells, periodKey, reportValues, requestChange, sameMonth, weekStartOf, words, wordsLocale, YEARS_SHOWN, yearOut, yearPageOf, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { caretLeft, caretRight } from '@fusion.dev/helix-icons';
|
|
9
9
|
import { html, nothing } from 'lit';
|
|
10
10
|
import { property, state } from 'lit/decorators.js';
|
|
@@ -25,6 +25,7 @@ const firstOf = (year, month) => addMonths(asDate('2000-01-01'), (year - 2000) *
|
|
|
25
25
|
let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinPickerFeedback(MixinControllerValue(HelixFormElement)) {
|
|
26
26
|
constructor() {
|
|
27
27
|
super(...arguments);
|
|
28
|
+
this.badInputMessage = '{mode, select, single {Enter a date as YYYY-MM-DD.} other {Enter dates as YYYY-MM-DD, separated by commas.}}';
|
|
28
29
|
this.defaultMonth = '';
|
|
29
30
|
this.disableDates = '';
|
|
30
31
|
this.disableDays = '';
|
|
@@ -41,6 +42,7 @@ let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinPickerF
|
|
|
41
42
|
this.previousLabel = 'Previous month';
|
|
42
43
|
this.previousYearLabel = 'Previous year';
|
|
43
44
|
this.previousYearsLabel = 'Earlier years';
|
|
45
|
+
this.rangeOverflowMessage = 'Choose a date on or before {max}.';
|
|
44
46
|
this.focused = '';
|
|
45
47
|
this.choosing = false;
|
|
46
48
|
this.handleKeydown = (event) => {
|
|
@@ -98,14 +100,19 @@ let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinPickerF
|
|
|
98
100
|
this.zoom('year');
|
|
99
101
|
}
|
|
100
102
|
};
|
|
103
|
+
this.rangeUnderflowMessage = 'Choose a date on or after {min}.';
|
|
101
104
|
this.readOnly = false;
|
|
102
105
|
this.required = false;
|
|
103
106
|
this.step = 1;
|
|
107
|
+
this.stepMismatchMessage = 'Choose one of the dates the calendar offers.';
|
|
108
|
+
this.unavailableMessage = 'Choose a date that is available.';
|
|
109
|
+
this.valueMissingMessage = 'Choose a date.';
|
|
104
110
|
this.view = 'day';
|
|
105
111
|
this.yearViewLabel = '{heading}. Choose a year';
|
|
106
112
|
}
|
|
113
|
+
static { this.words = 'helix-date-picker'; }
|
|
107
114
|
get language() {
|
|
108
|
-
return
|
|
115
|
+
return wordsLocale(this);
|
|
109
116
|
}
|
|
110
117
|
get month() {
|
|
111
118
|
return this.monthState ?? (this.defaultMonth || fromDate(this.derivedMonth).slice(0, 7));
|
|
@@ -122,8 +129,7 @@ let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinPickerF
|
|
|
122
129
|
if (this.firstDayOfWeek !== undefined && Number.isFinite(this.firstDayOfWeek)) {
|
|
123
130
|
return ((Math.floor(this.firstDayOfWeek) % 7) + 7) % 7;
|
|
124
131
|
}
|
|
125
|
-
|
|
126
|
-
return language === '' ? 0 : weekStartOf(language);
|
|
132
|
+
return handedLocale(this) === '' ? 0 : weekStartOf(this.language);
|
|
127
133
|
}
|
|
128
134
|
get range() {
|
|
129
135
|
const dates = this.selected;
|
|
@@ -363,17 +369,13 @@ let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinPickerF
|
|
|
363
369
|
if (this.min !== '' && iso < this.min) {
|
|
364
370
|
return [
|
|
365
371
|
'rangeUnderflow',
|
|
366
|
-
|
|
367
|
-
min: this.spoken(this.min),
|
|
368
|
-
}),
|
|
372
|
+
formatWords(this, 'rangeUnderflowMessage', { min: this.spoken(this.min) }),
|
|
369
373
|
];
|
|
370
374
|
}
|
|
371
375
|
if (this.max !== '' && iso > this.max) {
|
|
372
376
|
return [
|
|
373
377
|
'rangeOverflow',
|
|
374
|
-
|
|
375
|
-
max: this.spoken(this.max),
|
|
376
|
-
}),
|
|
378
|
+
formatWords(this, 'rangeOverflowMessage', { max: this.spoken(this.max) }),
|
|
377
379
|
];
|
|
378
380
|
}
|
|
379
381
|
const date = asDate(iso);
|
|
@@ -382,21 +384,18 @@ let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinPickerF
|
|
|
382
384
|
return undefined;
|
|
383
385
|
}
|
|
384
386
|
return why === 'listed'
|
|
385
|
-
? ['badInput', this.unavailableMessage
|
|
386
|
-
: ['stepMismatch', this.stepMismatchMessage
|
|
387
|
+
? ['badInput', this.unavailableMessage]
|
|
388
|
+
: ['stepMismatch', this.stepMismatchMessage];
|
|
387
389
|
}
|
|
388
390
|
reportRequired() {
|
|
389
391
|
const anchor = this.partNamed('grid') ?? undefined;
|
|
390
392
|
if (this.required && this.value === '') {
|
|
391
|
-
this.internals.setValidity({ valueMissing: true }, this.valueMissingMessage
|
|
393
|
+
this.internals.setValidity({ valueMissing: true }, this.valueMissingMessage, anchor);
|
|
392
394
|
return;
|
|
393
395
|
}
|
|
394
396
|
const held = this.selected;
|
|
395
397
|
if (held.length > 0 && held.some((one) => asDate(one) === null)) {
|
|
396
|
-
this.internals.setValidity({ badInput: true }, this
|
|
397
|
-
(this.mode === undefined
|
|
398
|
-
? 'Enter a date as YYYY-MM-DD.'
|
|
399
|
-
: 'Enter dates as YYYY-MM-DD, separated by commas.'), anchor);
|
|
398
|
+
this.internals.setValidity({ badInput: true }, formatWords(this, 'badInputMessage', { mode: this.mode ?? 'single' }), anchor);
|
|
400
399
|
return;
|
|
401
400
|
}
|
|
402
401
|
for (const one of held) {
|
|
@@ -414,7 +413,7 @@ let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinPickerF
|
|
|
414
413
|
this.focused = '';
|
|
415
414
|
}
|
|
416
415
|
this.choosing = false;
|
|
417
|
-
const outside = this.label
|
|
416
|
+
const outside = this.hasAttribute('label') ? [] : [...(this.internals.labels ?? [])];
|
|
418
417
|
hostAria(this.internals, {
|
|
419
418
|
label: this.label,
|
|
420
419
|
labelledBy: outside,
|
|
@@ -438,19 +437,20 @@ let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinPickerF
|
|
|
438
437
|
return Math.max(1, Math.floor(this.months) || 1);
|
|
439
438
|
}
|
|
440
439
|
get formats() {
|
|
441
|
-
const language = this.language;
|
|
440
|
+
const language = calendarLocale(this.language, this.calendar);
|
|
442
441
|
if (this.cachedFormats?.locale === language) {
|
|
443
442
|
return this.cachedFormats;
|
|
444
443
|
}
|
|
445
|
-
const
|
|
444
|
+
const utc = (options) => new Intl.DateTimeFormat(language || undefined, { ...options, timeZone: 'UTC' });
|
|
446
445
|
const built = {
|
|
447
|
-
full:
|
|
448
|
-
heading:
|
|
446
|
+
full: utc({ dateStyle: 'full' }),
|
|
447
|
+
heading: utc({ month: 'long', year: 'numeric' }),
|
|
449
448
|
locale: language,
|
|
450
|
-
long:
|
|
451
|
-
monthName:
|
|
452
|
-
|
|
453
|
-
|
|
449
|
+
long: utc({ dateStyle: 'long' }),
|
|
450
|
+
monthName: utc({ month: 'short' }),
|
|
451
|
+
monthYear: utc({ month: 'short', year: 'numeric' }),
|
|
452
|
+
weekday: utc({ weekday: 'short' }),
|
|
453
|
+
year: utc({ year: 'numeric' }),
|
|
454
454
|
};
|
|
455
455
|
this.cachedFormats = built;
|
|
456
456
|
return built;
|
|
@@ -470,7 +470,8 @@ let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinPickerF
|
|
|
470
470
|
</slot>`;
|
|
471
471
|
}
|
|
472
472
|
renderMonth(month, index) {
|
|
473
|
-
const { full, heading, weekday } = this.formats;
|
|
473
|
+
const { full, heading: named, weekday } = this.formats;
|
|
474
|
+
const heading = named.format(month);
|
|
474
475
|
const weeks = this.weeksOf(month);
|
|
475
476
|
const anchor = fromDate(this.anchor);
|
|
476
477
|
const today = localToday();
|
|
@@ -492,7 +493,7 @@ let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinPickerF
|
|
|
492
493
|
: nothing}
|
|
493
494
|
${''}
|
|
494
495
|
<span part="heading" aria-live="polite"
|
|
495
|
-
>${this.renderHeadingText(heading
|
|
496
|
+
>${this.renderHeadingText(heading, 'monthViewLabel')}</span
|
|
496
497
|
>
|
|
497
498
|
${last
|
|
498
499
|
? html `<button
|
|
@@ -509,7 +510,7 @@ let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinPickerF
|
|
|
509
510
|
<div
|
|
510
511
|
part="grid"
|
|
511
512
|
role="grid"
|
|
512
|
-
aria-label=${heading
|
|
513
|
+
aria-label=${heading}
|
|
513
514
|
aria-readonly=${this.readOnly ? 'true' : nothing}
|
|
514
515
|
data-unset=${this.value === '' ? '' : nothing}
|
|
515
516
|
>
|
|
@@ -561,13 +562,13 @@ let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinPickerF
|
|
|
561
562
|
return html `<button
|
|
562
563
|
part="heading-button"
|
|
563
564
|
type="button"
|
|
564
|
-
aria-label=${
|
|
565
|
+
aria-label=${formatWords(this, label, { heading: text })}
|
|
565
566
|
?disabled=${this.isDisabled}
|
|
566
567
|
@click=${this.handleHeading}
|
|
567
568
|
>${text}</button>`;
|
|
568
569
|
}
|
|
569
570
|
renderPeriods() {
|
|
570
|
-
const { monthName, year: yearName } = this.formats;
|
|
571
|
+
const { monthName, monthYear, year: yearName } = this.formats;
|
|
571
572
|
const years = this.view === 'year';
|
|
572
573
|
const page = years ? yearPageOf(this.periodYear) : this.periodYear;
|
|
573
574
|
const heading = years
|
|
@@ -588,7 +589,7 @@ let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinPickerF
|
|
|
588
589
|
role="gridcell"
|
|
589
590
|
aria-current=${current ? 'date' : nothing}
|
|
590
591
|
aria-disabled=${out ? 'true' : nothing}
|
|
591
|
-
aria-label=${years ? words :
|
|
592
|
+
aria-label=${years ? words : monthYear.format(first)}
|
|
592
593
|
aria-selected=${chosen ? 'true' : nothing}
|
|
593
594
|
tabindex=${at === stop && !this.isDisabled ? '0' : '-1'}
|
|
594
595
|
@click=${() => this.choosePeriod(at)}
|
|
@@ -608,7 +609,7 @@ let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinPickerF
|
|
|
608
609
|
${this.renderPreviousMark()}
|
|
609
610
|
</button>
|
|
610
611
|
<span part="heading" aria-live="polite"
|
|
611
|
-
>${this.renderHeadingText(heading,
|
|
612
|
+
>${this.renderHeadingText(heading, 'yearViewLabel')}</span
|
|
612
613
|
>
|
|
613
614
|
<button
|
|
614
615
|
part="next"
|
|
@@ -650,8 +651,12 @@ let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinPickerF
|
|
|
650
651
|
}
|
|
651
652
|
};
|
|
652
653
|
__decorate([
|
|
654
|
+
words,
|
|
653
655
|
property({ attribute: 'bad-input-message' })
|
|
654
656
|
], HelixHeadlessDatePicker.prototype, "badInputMessage", void 0);
|
|
657
|
+
__decorate([
|
|
658
|
+
property()
|
|
659
|
+
], HelixHeadlessDatePicker.prototype, "calendar", void 0);
|
|
655
660
|
__decorate([
|
|
656
661
|
property({ attribute: false })
|
|
657
662
|
], HelixHeadlessDatePicker.prototype, "dayContent", void 0);
|
|
@@ -671,6 +676,7 @@ __decorate([
|
|
|
671
676
|
property({ attribute: false })
|
|
672
677
|
], HelixHeadlessDatePicker.prototype, "isDateUnavailable", void 0);
|
|
673
678
|
__decorate([
|
|
679
|
+
words,
|
|
674
680
|
property()
|
|
675
681
|
], HelixHeadlessDatePicker.prototype, "label", void 0);
|
|
676
682
|
__decorate([
|
|
@@ -695,27 +701,35 @@ __decorate([
|
|
|
695
701
|
property({ type: Number })
|
|
696
702
|
], HelixHeadlessDatePicker.prototype, "months", void 0);
|
|
697
703
|
__decorate([
|
|
704
|
+
words,
|
|
698
705
|
property({ attribute: 'month-view-label' })
|
|
699
706
|
], HelixHeadlessDatePicker.prototype, "monthViewLabel", void 0);
|
|
700
707
|
__decorate([
|
|
708
|
+
words,
|
|
701
709
|
property({ attribute: 'next-label' })
|
|
702
710
|
], HelixHeadlessDatePicker.prototype, "nextLabel", void 0);
|
|
703
711
|
__decorate([
|
|
712
|
+
words,
|
|
704
713
|
property({ attribute: 'next-year-label' })
|
|
705
714
|
], HelixHeadlessDatePicker.prototype, "nextYearLabel", void 0);
|
|
706
715
|
__decorate([
|
|
716
|
+
words,
|
|
707
717
|
property({ attribute: 'next-years-label' })
|
|
708
718
|
], HelixHeadlessDatePicker.prototype, "nextYearsLabel", void 0);
|
|
709
719
|
__decorate([
|
|
720
|
+
words,
|
|
710
721
|
property({ attribute: 'previous-label' })
|
|
711
722
|
], HelixHeadlessDatePicker.prototype, "previousLabel", void 0);
|
|
712
723
|
__decorate([
|
|
724
|
+
words,
|
|
713
725
|
property({ attribute: 'previous-year-label' })
|
|
714
726
|
], HelixHeadlessDatePicker.prototype, "previousYearLabel", void 0);
|
|
715
727
|
__decorate([
|
|
728
|
+
words,
|
|
716
729
|
property({ attribute: 'previous-years-label' })
|
|
717
730
|
], HelixHeadlessDatePicker.prototype, "previousYearsLabel", void 0);
|
|
718
731
|
__decorate([
|
|
732
|
+
words,
|
|
719
733
|
property({ attribute: 'range-overflow-message' })
|
|
720
734
|
], HelixHeadlessDatePicker.prototype, "rangeOverflowMessage", void 0);
|
|
721
735
|
__decorate([
|
|
@@ -728,6 +742,7 @@ __decorate([
|
|
|
728
742
|
state()
|
|
729
743
|
], HelixHeadlessDatePicker.prototype, "periodFocus", void 0);
|
|
730
744
|
__decorate([
|
|
745
|
+
words,
|
|
731
746
|
property({ attribute: 'range-underflow-message' })
|
|
732
747
|
], HelixHeadlessDatePicker.prototype, "rangeUnderflowMessage", void 0);
|
|
733
748
|
__decorate([
|
|
@@ -740,18 +755,22 @@ __decorate([
|
|
|
740
755
|
property({ type: Number })
|
|
741
756
|
], HelixHeadlessDatePicker.prototype, "step", void 0);
|
|
742
757
|
__decorate([
|
|
758
|
+
words,
|
|
743
759
|
property({ attribute: 'step-mismatch-message' })
|
|
744
760
|
], HelixHeadlessDatePicker.prototype, "stepMismatchMessage", void 0);
|
|
745
761
|
__decorate([
|
|
762
|
+
words,
|
|
746
763
|
property({ attribute: 'unavailable-message' })
|
|
747
764
|
], HelixHeadlessDatePicker.prototype, "unavailableMessage", void 0);
|
|
748
765
|
__decorate([
|
|
766
|
+
words,
|
|
749
767
|
property({ attribute: 'value-missing-message' })
|
|
750
768
|
], HelixHeadlessDatePicker.prototype, "valueMissingMessage", void 0);
|
|
751
769
|
__decorate([
|
|
752
770
|
property()
|
|
753
771
|
], HelixHeadlessDatePicker.prototype, "view", void 0);
|
|
754
772
|
__decorate([
|
|
773
|
+
words,
|
|
755
774
|
property({ attribute: 'year-view-label' })
|
|
756
775
|
], HelixHeadlessDatePicker.prototype, "yearViewLabel", void 0);
|
|
757
776
|
HelixHeadlessDatePicker = __decorate([
|
|
@@ -33,8 +33,11 @@ import { type PropertyValues, type TemplateResult } from 'lit';
|
|
|
33
33
|
* @slot actions - Controls that act on the value, such as a copy button, after it inside its `<dd>`.
|
|
34
34
|
* @slot label - The label, when it is more than text. Falls back to `label`.
|
|
35
35
|
*
|
|
36
|
+
* @csspart actions - The box after the value inside its `<dd>`, holding the `actions` slot.
|
|
36
37
|
* @csspart label - The `<dt>`, holding the label.
|
|
37
38
|
* @csspart value - The `<dd>`, holding the value.
|
|
39
|
+
*
|
|
40
|
+
* @cssstate several - The values are several `<dd>` elements of your own, so the item draws no `value` part.
|
|
38
41
|
*/
|
|
39
42
|
export declare class HelixHeadlessDescriptionListItem extends HelixElement {
|
|
40
43
|
/**
|
|
@@ -58,6 +61,7 @@ export declare class HelixHeadlessDescriptionListItem extends HelixElement {
|
|
|
58
61
|
*/
|
|
59
62
|
private get ownValues();
|
|
60
63
|
protected firstUpdated(changed: PropertyValues): void;
|
|
64
|
+
protected updated(changed: PropertyValues): void;
|
|
61
65
|
protected render(): TemplateResult;
|
|
62
66
|
/** A value arriving or leaving can change whether the item wraps them. */
|
|
63
67
|
private readonly handleSlotChange;
|
|
@@ -23,12 +23,18 @@ let HelixHeadlessDescriptionListItem = class HelixHeadlessDescriptionListItem ex
|
|
|
23
23
|
super.firstUpdated(changed);
|
|
24
24
|
this.finishHydration();
|
|
25
25
|
}
|
|
26
|
+
updated(changed) {
|
|
27
|
+
super.updated(changed);
|
|
28
|
+
this.toggleState('several', this.ownValues);
|
|
29
|
+
}
|
|
26
30
|
render() {
|
|
27
31
|
const label = html `<dt part="label"><slot name="label">${this.label}</slot></dt>`;
|
|
28
32
|
return this.ownValues
|
|
29
33
|
? html `${label}<slot @slotchange=${this.handleSlotChange}></slot>`
|
|
30
34
|
: html `${label}
|
|
31
|
-
<dd part="value"><slot @slotchange=${this.handleSlotChange}></slot><
|
|
35
|
+
<dd part="value"><slot @slotchange=${this.handleSlotChange}></slot><span part="actions"
|
|
36
|
+
><slot name="actions"></slot></span
|
|
37
|
+
></dd>`;
|
|
32
38
|
}
|
|
33
39
|
};
|
|
34
40
|
__decorate([
|
|
@@ -24,7 +24,8 @@ declare const HelixHeadlessDialog_base: (new (...args: any[]) => import("@fusion
|
|
|
24
24
|
* says it is open, which would leave it impossible to reopen.
|
|
25
25
|
*
|
|
26
26
|
* The dialog's name is `label` when you set it. Otherwise it is the heading in
|
|
27
|
-
* the `header` slot, or the elements an `aria-labelledby` on the host names
|
|
27
|
+
* the `header` slot, or the elements an `aria-labelledby` on the host names,
|
|
28
|
+
* and `fallback-label` where nothing names it.
|
|
28
29
|
* While it is open, the page behind it does not scroll.
|
|
29
30
|
*
|
|
30
31
|
* The dialog is described by the words at the start of its body: the elements
|
|
@@ -67,6 +68,11 @@ declare const HelixHeadlessDialog_base: (new (...args: any[]) => import("@fusion
|
|
|
67
68
|
* @cssstate open - While the dialog is open.
|
|
68
69
|
*/
|
|
69
70
|
export declare class HelixHeadlessDialog extends HelixHeadlessDialog_base {
|
|
71
|
+
/**
|
|
72
|
+
* The key this family's words are registered under, its styled tag:
|
|
73
|
+
* `registerWords('de', { 'helix-dialog': { dismissLabel: 'Schließen' } })`.
|
|
74
|
+
*/
|
|
75
|
+
static words: string;
|
|
70
76
|
/**
|
|
71
77
|
* Makes the dialog an alert dialog, for a message that interrupts to ask for
|
|
72
78
|
* an answer, such as a confirmation before something is deleted.
|
|
@@ -104,6 +110,11 @@ export declare class HelixHeadlessDialog extends HelixHeadlessDialog_base {
|
|
|
104
110
|
* interface.
|
|
105
111
|
*/
|
|
106
112
|
dismissLabel: string;
|
|
113
|
+
/**
|
|
114
|
+
* The dialog's name where nothing names it: no `label`, no heading in the
|
|
115
|
+
* `header` slot, and no `aria-labelledby` on the host.
|
|
116
|
+
*/
|
|
117
|
+
fallbackLabel: string;
|
|
107
118
|
/**
|
|
108
119
|
* Accessible name for the dialog. When it is empty, the heading in the
|
|
109
120
|
* `header` slot names the dialog.
|
|
@@ -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, auditName, CommandController, customElement, drawDismiss, drawDismissGlyph, FocusScopeController, HelixElement, headingsIn, hostAria, lockScroll, MixinControllerOpen, OpenPhaseController, reflectElements, unlockScroll, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { AriaForwardController, auditName, CommandController, customElement, drawDismiss, drawDismissGlyph, FocusScopeController, HelixElement, headingsIn, hostAria, lockScroll, MixinControllerOpen, OpenPhaseController, reflectElements, unlockScroll, words, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { html, nothing } from 'lit';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
10
|
import { wordsIn } from '../description.js';
|
|
@@ -14,6 +14,7 @@ let HelixHeadlessDialog = class HelixHeadlessDialog extends MixinControllerOpen(
|
|
|
14
14
|
this.alert = false;
|
|
15
15
|
this.dismissible = false;
|
|
16
16
|
this.dismissLabel = 'Close';
|
|
17
|
+
this.fallbackLabel = 'Dialog';
|
|
17
18
|
this.label = '';
|
|
18
19
|
this.phases = new OpenPhaseController(this, {
|
|
19
20
|
mark: {
|
|
@@ -90,6 +91,7 @@ let HelixHeadlessDialog = class HelixHeadlessDialog extends MixinControllerOpen(
|
|
|
90
91
|
this.requestOpen(false);
|
|
91
92
|
};
|
|
92
93
|
}
|
|
94
|
+
static { this.words = 'helix-dialog'; }
|
|
93
95
|
get returnValue() {
|
|
94
96
|
return this.dialog?.returnValue ?? this.returned;
|
|
95
97
|
}
|
|
@@ -124,8 +126,8 @@ let HelixHeadlessDialog = class HelixHeadlessDialog extends MixinControllerOpen(
|
|
|
124
126
|
}
|
|
125
127
|
describeByBody() {
|
|
126
128
|
const slot = this.renderRoot.querySelector('slot:not([name])');
|
|
127
|
-
const
|
|
128
|
-
this.describedByBody = reflectElements(this.dialog, 'ariaDescribedByElements',
|
|
129
|
+
const said = this.hasAttribute('aria-describedby') ? [] : wordsIn(slot);
|
|
130
|
+
this.describedByBody = reflectElements(this.dialog, 'ariaDescribedByElements', said, this.describedByBody);
|
|
129
131
|
}
|
|
130
132
|
willUpdate(changed) {
|
|
131
133
|
super.willUpdate(changed);
|
|
@@ -204,7 +206,7 @@ let HelixHeadlessDialog = class HelixHeadlessDialog extends MixinControllerOpen(
|
|
|
204
206
|
part="dialog"
|
|
205
207
|
role=${this.alert ? 'alertdialog' : nothing}
|
|
206
208
|
closedby=${this.closedBy ?? nothing}
|
|
207
|
-
aria-label=${this.label ||
|
|
209
|
+
aria-label=${this.label || this.fallbackLabel}
|
|
208
210
|
@cancel=${this.handleCancel}
|
|
209
211
|
@click=${this.handleBackdrop}
|
|
210
212
|
@close=${this.handleClose}
|
|
@@ -233,8 +235,13 @@ __decorate([
|
|
|
233
235
|
property({ reflect: true, type: Boolean })
|
|
234
236
|
], HelixHeadlessDialog.prototype, "dismissible", void 0);
|
|
235
237
|
__decorate([
|
|
238
|
+
words,
|
|
236
239
|
property({ attribute: 'dismiss-label' })
|
|
237
240
|
], HelixHeadlessDialog.prototype, "dismissLabel", void 0);
|
|
241
|
+
__decorate([
|
|
242
|
+
words,
|
|
243
|
+
property({ attribute: 'fallback-label' })
|
|
244
|
+
], HelixHeadlessDialog.prototype, "fallbackLabel", void 0);
|
|
238
245
|
__decorate([
|
|
239
246
|
property()
|
|
240
247
|
], HelixHeadlessDialog.prototype, "label", void 0);
|
|
@@ -9,12 +9,22 @@ import { type PropertyValues, type TemplateResult } from 'lit';
|
|
|
9
9
|
* rendered element. The semantics are then in the server-rendered markup, with
|
|
10
10
|
* no attribute written by script after the element connects.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
12
|
+
* **The line is a separator**, as `<hr>` is, and as Radix Separator, React
|
|
13
|
+
* Aria Separator, and Web Awesome's divider are. It is named by any content
|
|
14
|
+
* set into it, so a screen reader says "Or, separator" where you wrote "Or" on
|
|
15
|
+
* the line. Set `decorative` on a rule that separates nothing, such as one
|
|
16
|
+
* under a heading or between the facts of a byline, and it leaves the
|
|
17
|
+
* accessibility tree.
|
|
14
18
|
*
|
|
15
|
-
* Use `orientation="vertical"` between items on one line
|
|
16
|
-
*
|
|
17
|
-
*
|
|
19
|
+
* Use `orientation="vertical"` between items on one line. A vertical divider
|
|
20
|
+
* stretches to fit its flex parent and sets no height of its own.
|
|
21
|
+
*
|
|
22
|
+
* **Inside a toolbar it runs across the toolbar** without being told: vertical
|
|
23
|
+
* in a horizontal toolbar and horizontal in a vertical one, with
|
|
24
|
+
* `aria-orientation` to match, as React Aria's separator does inside a
|
|
25
|
+
* toolbar. Inside means a child of Toolbar or of the page's own
|
|
26
|
+
* `role="toolbar"`. An `orientation` you write still wins. A server cannot see
|
|
27
|
+
* the toolbar, so the turn arrives with hydration, inside the shadow root.
|
|
18
28
|
*
|
|
19
29
|
* @since 0.1.0
|
|
20
30
|
* @status stable
|
|
@@ -26,27 +36,44 @@ import { type PropertyValues, type TemplateResult } from 'lit';
|
|
|
26
36
|
*
|
|
27
37
|
* @csspart content - The content set into the line.
|
|
28
38
|
* @csspart line - The line, or each half of it when content is set into it.
|
|
39
|
+
*
|
|
40
|
+
* @cssstate vertical - The line runs vertically: `orientation="vertical"`, or no `orientation` inside a horizontal toolbar.
|
|
29
41
|
*/
|
|
30
42
|
export declare class HelixHeadlessDivider extends HelixElement {
|
|
31
43
|
/**
|
|
32
|
-
* Whether screen readers announce the line as a separator
|
|
33
|
-
*
|
|
34
|
-
* Off by default, and out of the accessibility tree. Most rules on a page
|
|
35
|
-
* separate nothing: they underline a heading or close a section that space
|
|
36
|
-
* had already closed, and announcing every one as a separator is noise a
|
|
37
|
-
* screen-reader user has to walk past.
|
|
44
|
+
* Whether screen readers announce the line as a separator, which they now do
|
|
45
|
+
* by default.
|
|
38
46
|
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* property. An opt-in is absent by default, which every reflected property
|
|
43
|
-
* here has to be.
|
|
47
|
+
* It dates from when the line was decorative by default. It is still read,
|
|
48
|
+
* and it wins over `decorative`, so a divider written with it stays a
|
|
49
|
+
* separator.
|
|
44
50
|
*/
|
|
45
51
|
announced: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Takes the line out of the accessibility tree, for a rule that separates
|
|
54
|
+
* nothing: one under a heading, or between the facts of a byline.
|
|
55
|
+
*
|
|
56
|
+
* Absent, the line is a separator, as `<hr>` is. Radix Separator's opt-out
|
|
57
|
+
* has the same name. It turns the role off because a boolean attribute that
|
|
58
|
+
* is on by default cannot be turned off from HTML.
|
|
59
|
+
*/
|
|
60
|
+
decorative: boolean;
|
|
46
61
|
/**
|
|
47
62
|
* The direction the line runs: `horizontal` or `vertical`.
|
|
63
|
+
*
|
|
64
|
+
* Unset is horizontal, or across the toolbar the divider sits in.
|
|
48
65
|
*/
|
|
49
66
|
orientation?: 'horizontal' | 'vertical';
|
|
67
|
+
/**
|
|
68
|
+
* The direction the line is drawn and announced in: `orientation`, else
|
|
69
|
+
* across the toolbar around it, else horizontal.
|
|
70
|
+
*
|
|
71
|
+
* The toolbar is read only where the tree is known, never while hydrating
|
|
72
|
+
* what a server sent, whose render has to be the server's.
|
|
73
|
+
*/
|
|
74
|
+
private get drawn();
|
|
75
|
+
/** Reads the toolbar again when the divider moves into or out of one. */
|
|
76
|
+
connectedCallback(): void;
|
|
50
77
|
/**
|
|
51
78
|
* Marks the middle region when nothing has been set into it.
|
|
52
79
|
*
|
|
@@ -59,6 +86,8 @@ export declare class HelixHeadlessDivider extends HelixElement {
|
|
|
59
86
|
* attribute written onto the host is a change to markup the consumer rendered.
|
|
60
87
|
*/
|
|
61
88
|
private markEmpty;
|
|
89
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
90
|
+
protected firstUpdated(changed: PropertyValues): void;
|
|
62
91
|
protected updated(changed: PropertyValues): void;
|
|
63
92
|
protected render(): TemplateResult;
|
|
64
93
|
}
|
|
@@ -4,27 +4,48 @@ 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, markRegion } from '@fusion.dev/helix-core';
|
|
7
|
+
import { customElement, HelixElement, markRegion, toolbarAround, toolbarAxis, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { html, nothing } from 'lit';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
10
|
let HelixHeadlessDivider = class HelixHeadlessDivider extends HelixElement {
|
|
11
11
|
constructor() {
|
|
12
12
|
super(...arguments);
|
|
13
13
|
this.announced = false;
|
|
14
|
+
this.decorative = false;
|
|
15
|
+
}
|
|
16
|
+
get drawn() {
|
|
17
|
+
const toolbar = this.orientation || this.hydrating ? null : toolbarAround(this);
|
|
18
|
+
if (toolbar) {
|
|
19
|
+
return toolbarAxis(toolbar) === 'vertical' ? 'horizontal' : 'vertical';
|
|
20
|
+
}
|
|
21
|
+
return this.orientation ?? 'horizontal';
|
|
22
|
+
}
|
|
23
|
+
connectedCallback() {
|
|
24
|
+
super.connectedCallback();
|
|
25
|
+
this.requestUpdate();
|
|
14
26
|
}
|
|
15
27
|
markEmpty() {
|
|
16
28
|
markRegion(this.renderRoot, 'content', ['']);
|
|
17
29
|
}
|
|
30
|
+
willUpdate(changed) {
|
|
31
|
+
super.willUpdate(changed);
|
|
32
|
+
this.toggleState('vertical', this.drawn === 'vertical');
|
|
33
|
+
}
|
|
34
|
+
firstUpdated(changed) {
|
|
35
|
+
super.firstUpdated(changed);
|
|
36
|
+
this.finishHydration();
|
|
37
|
+
}
|
|
18
38
|
updated(changed) {
|
|
19
39
|
super.updated(changed);
|
|
20
40
|
this.markEmpty();
|
|
21
41
|
}
|
|
22
42
|
render() {
|
|
43
|
+
const separator = this.announced || !this.decorative;
|
|
23
44
|
return html `<div
|
|
24
45
|
part="line"
|
|
25
|
-
role=${
|
|
26
|
-
aria-labelledby=${
|
|
27
|
-
aria-orientation=${
|
|
46
|
+
role=${separator ? 'separator' : 'presentation'}
|
|
47
|
+
aria-labelledby=${separator ? 'content' : nothing}
|
|
48
|
+
aria-orientation=${separator ? this.drawn : nothing}
|
|
28
49
|
></div>
|
|
29
50
|
<span id="content" part="content"><slot @slotchange=${() => this.markEmpty()}></slot></span>
|
|
30
51
|
<div part="line" role="presentation"></div>`;
|
|
@@ -33,6 +54,9 @@ let HelixHeadlessDivider = class HelixHeadlessDivider extends HelixElement {
|
|
|
33
54
|
__decorate([
|
|
34
55
|
property({ reflect: true, type: Boolean })
|
|
35
56
|
], HelixHeadlessDivider.prototype, "announced", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
property({ reflect: true, type: Boolean })
|
|
59
|
+
], HelixHeadlessDivider.prototype, "decorative", void 0);
|
|
36
60
|
__decorate([
|
|
37
61
|
property({ reflect: true })
|
|
38
62
|
], HelixHeadlessDivider.prototype, "orientation", void 0);
|
|
@@ -72,6 +72,11 @@ declare const HelixHeadlessDonutChart_base: typeof HelixElement & (new (...args:
|
|
|
72
72
|
* @cssproperty --donut-chart-stroke - How thick the ring is drawn, derived from `hole`.
|
|
73
73
|
*/
|
|
74
74
|
export declare class HelixHeadlessDonutChart extends HelixHeadlessDonutChart_base {
|
|
75
|
+
/**
|
|
76
|
+
* The key this family's words are registered under, its styled tag:
|
|
77
|
+
* `registerWords('de', { 'helix-donut-chart': { positionLabel: '{position} von {count}' } })`.
|
|
78
|
+
*/
|
|
79
|
+
static words: string;
|
|
75
80
|
/**
|
|
76
81
|
* The pointer is not mapped across this one.
|
|
77
82
|
*
|
|
@@ -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 { CHART_PLOT, customElement, drawTooltip, HelixElement, MixinChartSource, PLOT_HEIGHT, PLOT_WIDTH, seriesIndex, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { CHART_PLOT, customElement, drawTooltip, HelixElement, MixinChartSource, PLOT_HEIGHT, PLOT_WIDTH, seriesIndex, wordsLocale, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { html, nothing, svg } from 'lit';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
10
|
import '../../tooltip/index.js';
|
|
@@ -35,6 +35,7 @@ let HelixHeadlessDonutChart = class HelixHeadlessDonutChart extends MixinChartSo
|
|
|
35
35
|
super(...arguments);
|
|
36
36
|
this.sliceLabels = false;
|
|
37
37
|
}
|
|
38
|
+
static { this.words = 'helix-donut-chart'; }
|
|
38
39
|
connectedCallback() {
|
|
39
40
|
super.connectedCallback();
|
|
40
41
|
this.pointer.axis = 'none';
|
|
@@ -84,11 +85,13 @@ let HelixHeadlessDonutChart = class HelixHeadlessDonutChart extends MixinChartSo
|
|
|
84
85
|
}
|
|
85
86
|
renderSummary(shares) {
|
|
86
87
|
const rows = this.sourceRows;
|
|
88
|
+
const locale = wordsLocale(this);
|
|
87
89
|
const parts = shares
|
|
88
90
|
.filter((share) => this.showsSeries(rows[share.row]?.label ?? ''))
|
|
89
|
-
.map((share) => `${rows[share.row]?.label ?? ''} ${percentIn(
|
|
91
|
+
.map((share) => `${rows[share.row]?.label ?? ''} ${percentIn(locale).format(share.fraction)}`);
|
|
90
92
|
const named = this.named ? `${this.named}: ` : '';
|
|
91
|
-
|
|
93
|
+
const listed = new Intl.ListFormat(locale, { style: 'short', type: 'unit' }).format(parts);
|
|
94
|
+
return html `<p id="helix-chart-summary" part="summary">${named}${listed}.</p>`;
|
|
92
95
|
}
|
|
93
96
|
renderPlot(shares) {
|
|
94
97
|
return html `<div
|
|
@@ -134,7 +137,7 @@ let HelixHeadlessDonutChart = class HelixHeadlessDonutChart extends MixinChartSo
|
|
|
134
137
|
top: half ? CENTER - EDGE : 0,
|
|
135
138
|
width: PLOT_WIDTH,
|
|
136
139
|
};
|
|
137
|
-
const format = percentIn(this
|
|
140
|
+
const format = percentIn(wordsLocale(this));
|
|
138
141
|
return html `${shares.map((share, index) => {
|
|
139
142
|
const place = sliceLabelAt(share, ring);
|
|
140
143
|
if (!place) {
|
|
@@ -221,7 +224,7 @@ let HelixHeadlessDonutChart = class HelixHeadlessDonutChart extends MixinChartSo
|
|
|
221
224
|
const cells = [...row.cells];
|
|
222
225
|
cells[column] = {
|
|
223
226
|
...cell,
|
|
224
|
-
text: `${cell.text} (${percentIn(this
|
|
227
|
+
text: `${cell.text} (${percentIn(wordsLocale(this)).format(share.fraction)})`,
|
|
225
228
|
};
|
|
226
229
|
return rows.map((one, index) => (index === share.row ? { ...row, cells } : one));
|
|
227
230
|
}
|