@fusion.dev/helix-headless 0.146.0 → 0.147.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +5266 -785
- package/dist/accordion/item/accordion-item.d.ts +38 -19
- package/dist/accordion/item/accordion-item.js +31 -9
- package/dist/accordion/root/accordion-root.d.ts +8 -2
- package/dist/accordion/root/accordion-root.js +3 -3
- package/dist/announcement/root/announcement-root.d.ts +13 -4
- package/dist/announcement/root/announcement-root.js +34 -6
- package/dist/area-chart/root/area-chart-root.d.ts +18 -1
- package/dist/area-chart/root/area-chart-root.js +11 -3
- package/dist/avatar/root/avatar-root.d.ts +31 -1
- package/dist/avatar/root/avatar-root.js +11 -1
- package/dist/badge/root/badge-root.d.ts +57 -6
- package/dist/badge/root/badge-root.js +88 -5
- package/dist/bar-chart/root/bar-chart-root.js +11 -20
- package/dist/bar-chart/stack.d.ts +10 -0
- package/dist/bar-chart/stack.js +8 -0
- package/dist/breadcrumbs/breadcrumb/breadcrumb.d.ts +14 -0
- package/dist/breadcrumbs/breadcrumb/breadcrumb.js +12 -2
- package/dist/breadcrumbs/root/breadcrumbs-root.js +2 -2
- package/dist/button/root/button-root.d.ts +24 -38
- package/dist/button/root/button-root.js +6 -37
- package/dist/button/submitter.d.ts +27 -0
- package/dist/button/submitter.js +25 -0
- package/dist/card/root/card-root.d.ts +12 -1
- package/dist/card/root/card-root.js +11 -4
- package/dist/chat/root/chat-root.d.ts +15 -1
- package/dist/chat/root/chat-root.js +11 -2
- package/dist/checkbox/root/checkbox-root.js +5 -7
- package/dist/checkbox-group/root/checkbox-group-root.js +4 -3
- package/dist/checkbox-group/select-all.d.ts +0 -6
- package/dist/checkbox-group/select-all.js +0 -5
- package/dist/code-block/root/code-block-root.d.ts +35 -14
- package/dist/code-block/root/code-block-root.js +17 -3
- package/dist/color-input/root/color-input-root.d.ts +11 -0
- package/dist/color-input/root/color-input-root.js +12 -5
- package/dist/color-picker/channels.js +1 -2
- package/dist/color-picker/root/color-picker-root.d.ts +32 -24
- package/dist/color-picker/root/color-picker-root.js +101 -51
- package/dist/color-picker/wheel.d.ts +17 -0
- package/dist/color-picker/wheel.js +6 -0
- package/dist/combobox/root/combobox-root.d.ts +13 -0
- package/dist/combobox/root/combobox-root.js +14 -1
- package/dist/command/root/command-root.d.ts +3 -1
- package/dist/command/root/command-root.js +2 -19
- package/dist/copy-button/root/copy-button-root.d.ts +16 -1
- package/dist/copy-button/root/copy-button-root.js +7 -2
- package/dist/data-table/keys.d.ts +0 -18
- package/dist/data-table/keys.js +1 -11
- package/dist/data-table/root/data-table-root.js +13 -7
- package/dist/date-input/root/date-input-root.d.ts +8 -1
- package/dist/date-input/root/date-input-root.js +8 -5
- package/dist/date-picker/root/date-picker-root.d.ts +14 -9
- package/dist/date-picker/root/date-picker-root.js +21 -16
- package/dist/description-list/item/description-list-item.d.ts +18 -4
- package/dist/description-list/item/description-list-item.js +8 -4
- package/dist/donut-chart/root/donut-chart-root.js +13 -6
- package/dist/donut-chart/slice-label.d.ts +35 -0
- package/dist/donut-chart/slice-label.js +11 -0
- package/dist/drawer/root/drawer-root.d.ts +4 -2
- package/dist/drawer/root/drawer-root.js +15 -3
- package/dist/drilldown/item/drilldown-item.d.ts +21 -1
- package/dist/drilldown/item/drilldown-item.js +39 -4
- package/dist/drilldown/root/drilldown-root.js +3 -2
- package/dist/element-events.generated.js +4 -1
- package/dist/empty/root/empty-root.d.ts +31 -1
- package/dist/empty/root/empty-root.js +26 -5
- package/dist/file-input/root/file-input-root.d.ts +34 -6
- package/dist/file-input/root/file-input-root.js +54 -19
- package/dist/file-input/status.d.ts +24 -0
- package/dist/file-input/status.js +10 -0
- package/dist/filter-input/chip/filter-chip.d.ts +23 -0
- package/dist/filter-input/chip/filter-chip.js +11 -2
- package/dist/filter-input/root/filter-input-root.d.ts +8 -0
- package/dist/filter-input/root/filter-input-root.js +17 -27
- package/dist/format-date/options.d.ts +3 -4
- package/dist/format-date/options.js +2 -2
- package/dist/format-date/root/format-date-root.d.ts +18 -1
- package/dist/format-date/root/format-date-root.js +19 -23
- package/dist/heatmap/root/buckets.d.ts +21 -0
- package/dist/heatmap/root/buckets.js +34 -0
- package/dist/heatmap/root/heatmap-root.d.ts +64 -3
- package/dist/heatmap/root/heatmap-root.js +89 -19
- package/dist/icon/index.d.ts +1 -1
- package/dist/icon/index.js +1 -1
- package/dist/icon/registry.d.ts +26 -1
- package/dist/icon/registry.js +12 -1
- package/dist/icon/root/icon-root.d.ts +13 -0
- package/dist/icon/root/icon-root.js +23 -2
- package/dist/icon/root/index.d.ts +1 -1
- package/dist/icon/root/index.js +1 -1
- package/dist/image/root/image-root.d.ts +9 -0
- package/dist/image/root/image-root.js +6 -1
- package/dist/input/root/input-root.d.ts +23 -2
- package/dist/input/root/input-root.js +12 -8
- package/dist/kbd/keys.d.ts +29 -0
- package/dist/kbd/keys.js +52 -0
- package/dist/kbd/root/kbd-root.d.ts +20 -3
- package/dist/kbd/root/kbd-root.js +24 -50
- package/dist/legend/hidden-series.d.ts +10 -2
- package/dist/legend/hidden-series.js +5 -2
- package/dist/legend/root/legend-root.d.ts +25 -7
- package/dist/legend/root/legend-root.js +22 -10
- package/dist/lightbox/root/lightbox-root.d.ts +50 -5
- package/dist/lightbox/root/lightbox-root.js +76 -8
- package/dist/lightbox/zoom.d.ts +2 -0
- package/dist/lightbox/zoom.js +5 -3
- package/dist/line-chart/root/line-chart-root.d.ts +16 -0
- package/dist/line-chart/root/line-chart-root.js +10 -2
- package/dist/list/root/list-root.d.ts +10 -2
- package/dist/list/root/list-root.js +26 -5
- package/dist/list/selection.d.ts +17 -0
- package/dist/list/selection.js +16 -0
- package/dist/listbox/root/listbox-root.d.ts +9 -5
- package/dist/listbox/root/listbox-root.js +29 -37
- package/dist/megamenu/hand-over.d.ts +75 -0
- package/dist/megamenu/hand-over.js +67 -0
- package/dist/megamenu/root/megamenu-root.d.ts +38 -14
- package/dist/megamenu/root/megamenu-root.js +36 -50
- package/dist/menu/item/menu-item.js +4 -4
- package/dist/menu/root/menu-root.d.ts +3 -0
- package/dist/meter/root/meter-root.d.ts +42 -0
- package/dist/meter/root/meter-root.js +33 -7
- package/dist/notifications/root/notifications-root.d.ts +10 -1
- package/dist/notifications/root/notifications-root.js +11 -1
- package/dist/number-input/grain.d.ts +28 -0
- package/dist/number-input/grain.js +14 -0
- package/dist/number-input/root/number-input-root.d.ts +17 -1
- package/dist/number-input/root/number-input-root.js +29 -18
- package/dist/object-inspector/root/object-inspector-root.d.ts +13 -6
- package/dist/object-inspector/root/object-inspector-root.js +18 -17
- package/dist/option/index.d.ts +1 -0
- package/dist/option/index.js +1 -0
- package/dist/option/separator/option-separator.d.ts +30 -0
- package/dist/option/separator/option-separator.js +21 -0
- package/dist/outline/root/outline-root.d.ts +12 -0
- package/dist/outline/root/outline-root.js +5 -19
- package/dist/pagination/size/pagination-size.d.ts +5 -0
- package/dist/pagination/size/pagination-size.js +4 -2
- package/dist/pin-input/code.d.ts +28 -1
- package/dist/pin-input/code.js +12 -0
- package/dist/pin-input/root/pin-input-root.d.ts +98 -121
- package/dist/pin-input/root/pin-input-root.js +157 -148
- package/dist/popover/hide-outside.js +2 -9
- package/dist/popover/root/popover-root.d.ts +7 -1
- package/dist/popover/root/popover-root.js +9 -1
- package/dist/progress/root/progress-root.d.ts +27 -0
- package/dist/progress/root/progress-root.js +25 -7
- package/dist/qr-code/export.d.ts +19 -0
- package/dist/qr-code/export.js +14 -0
- package/dist/qr-code/name.d.ts +11 -0
- package/dist/qr-code/name.js +7 -0
- package/dist/qr-code/root/qr-code-root.d.ts +17 -6
- package/dist/qr-code/root/qr-code-root.js +10 -12
- package/dist/radio/group/radio-group.d.ts +15 -0
- package/dist/radio/root/radio-root.js +2 -2
- package/dist/rating/root/rating-root.d.ts +22 -9
- package/dist/rating/root/rating-root.js +15 -39
- package/dist/scatter-chart/root/scatter-chart-root.d.ts +30 -0
- package/dist/scatter-chart/root/scatter-chart-root.js +34 -7
- package/dist/scroll-area/scrollbar.d.ts +0 -8
- package/dist/scroll-area/scrollbar.js +1 -1
- package/dist/select/align.d.ts +47 -0
- package/dist/select/align.js +7 -0
- package/dist/select/root/select-root.d.ts +59 -3
- package/dist/select/root/select-root.js +72 -12
- package/dist/slider/root/slider-root.d.ts +18 -1
- package/dist/slider/root/slider-root.js +22 -0
- package/dist/sparkline/readings.d.ts +30 -12
- package/dist/sparkline/readings.js +32 -15
- package/dist/sparkline/root/sparkline-root.d.ts +46 -3
- package/dist/sparkline/root/sparkline-root.js +60 -21
- package/dist/speed-dial/item/speed-dial-item.d.ts +1 -1
- package/dist/speed-dial/item/speed-dial-item.js +2 -2
- package/dist/speed-dial/root/speed-dial-root.d.ts +6 -0
- package/dist/speed-dial/root/speed-dial-root.js +9 -1
- package/dist/splitter/root/splitter-root.d.ts +3 -0
- package/dist/splitter/root/splitter-root.js +2 -0
- package/dist/steps/root/steps-root.d.ts +8 -1
- package/dist/steps/root/steps-root.js +6 -1
- package/dist/steps/step/step.d.ts +1 -0
- package/dist/steps/step/step.js +1 -1
- package/dist/table/column/table-column.d.ts +6 -0
- package/dist/table/column/table-column.js +5 -1
- package/dist/table/root/table-root.js +13 -6
- package/dist/table/row/table-row.d.ts +24 -0
- package/dist/table/row/table-row.js +37 -1
- package/dist/tabs/root/tabs-root.d.ts +5 -3
- package/dist/tag/group/tag-group.d.ts +16 -4
- package/dist/tag/group/tag-group.js +19 -7
- package/dist/textarea/root/textarea-root.d.ts +14 -2
- package/dist/textarea/root/textarea-root.js +6 -7
- package/dist/time-input/root/time-input-root.d.ts +5 -1
- package/dist/time-input/root/time-input-root.js +10 -7
- package/dist/time-picker/root/time-picker-root.d.ts +11 -14
- package/dist/time-picker/root/time-picker-root.js +15 -23
- package/dist/toast/item/toast-item.d.ts +3 -3
- package/dist/toast/item/toast-item.js +0 -1
- package/dist/toast/root/toast-root.d.ts +28 -4
- package/dist/toast/root/toast-root.js +58 -12
- package/dist/toast/words.d.ts +12 -0
- package/dist/toast/words.js +25 -0
- package/dist/toggle/group/toggle-group.d.ts +29 -5
- package/dist/toggle/group/toggle-group.js +26 -41
- package/dist/toggle/root/toggle-root.js +2 -4
- package/dist/toolbar/root/toolbar-root.d.ts +21 -5
- package/dist/toolbar/root/toolbar-root.js +52 -8
- package/dist/tooltip/root/tooltip-root.d.ts +7 -1
- package/dist/tooltip/root/tooltip-root.js +10 -1
- package/dist/tour/root/tour-root.d.ts +15 -0
- package/dist/tour/root/tour-root.js +20 -1
- package/dist/tour/stop/tour-stop.d.ts +3 -0
- package/dist/tour/stop/tour-stop.js +3 -3
- package/dist/tree/root/tree-root.js +2 -2
- package/dist/trend/figure.d.ts +16 -0
- package/dist/trend/figure.js +8 -0
- package/dist/trend/root/trend-root.d.ts +41 -2
- package/dist/trend/root/trend-root.js +29 -3
- package/dist/video/root/extra-controls.d.ts +12 -0
- package/dist/video/root/extra-controls.js +6 -2
- package/dist/video/root/video-root.d.ts +5 -1
- package/dist/video-playlist/root/video-playlist-root.d.ts +11 -1
- package/dist/video-playlist/root/video-playlist-root.js +3 -0
- package/dist/virtual-list/fill.d.ts +11 -0
- package/dist/virtual-list/fill.js +9 -0
- package/dist/virtual-list/keys.d.ts +16 -7
- package/dist/virtual-list/keys.js +17 -6
- package/dist/virtual-list/plan.d.ts +17 -1
- package/dist/virtual-list/plan.js +13 -2
- package/dist/virtual-list/root/virtual-list-root.d.ts +25 -3
- package/dist/virtual-list/root/virtual-list-root.js +48 -24
- package/lint.json +1 -1
- package/package.json +5 -5
- package/types/jsx.d.ts +2979 -738
- package/types/svelte.d.ts +1 -0
- package/types/vue.d.ts +619 -202
- package/dist/color-picker/swatches.d.ts +0 -12
- package/dist/color-picker/swatches.js +0 -26
- package/dist/rating/steps.d.ts +0 -7
- package/dist/rating/steps.js +0 -9
|
@@ -5,7 +5,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
var HelixHeadlessDataTable_1;
|
|
8
|
-
import { arranged, commaList, countLabel, customElement, cycle, deepActiveElement, deepContains, fillTemplate, format, formatNumbers, HelixActivateEvent, HelixElement, HelixExpandEvent, HelixFilterEvent, HelixFilteredEvent, HelixLoadMoreEvent, HelixNavigateEvent, HelixReorderEvent, HelixReorderedEvent, HelixSelectEvent, HelixSelectedEvent, HelixSortEvent, HelixSortedEvent, hostAria, inlineStep, isRtl, MixinCollection, markRegion, ordered, parse, rangeAdd, reportRuntime, requestChange, Typeahead, toggleEvery, treeArrow, typesCharacter, VirtualizeController, valueAt, window_, writtenList, } from '@fusion.dev/helix-core';
|
|
8
|
+
import { anchorAt, arranged, commaList, countLabel, customElement, cycle, deepActiveElement, deepContains, everyState, fillTemplate, format, formatNumbers, HelixActivateEvent, HelixElement, HelixExpandEvent, HelixFilterEvent, HelixFilteredEvent, HelixLoadMoreEvent, HelixNavigateEvent, HelixReorderEvent, HelixReorderedEvent, HelixSelectEvent, HelixSelectedEvent, HelixSortEvent, HelixSortedEvent, hostAria, inlineStep, inRowOrder, isRtl, MixinCollection, markRegion, onAndroid, ordered, parse, rangeAdd, reportRuntime, requestChange, selectsAll, Typeahead, toggleEvery, treeArrow, typesCharacter, VirtualizeController, valueAt, window_, writtenList, } from '@fusion.dev/helix-core';
|
|
9
9
|
import { caretDown, caretRight } from '@fusion.dev/helix-icons';
|
|
10
10
|
import { nothing } from 'lit';
|
|
11
11
|
import { property, state } from 'lit/decorators.js';
|
|
@@ -15,7 +15,7 @@ import { html } from 'lit/static-html.js';
|
|
|
15
15
|
import { edgeOf } from '../../table/column/table-column.js';
|
|
16
16
|
import '../../checkbox/index.js';
|
|
17
17
|
import '../../pagination/index.js';
|
|
18
|
-
import {
|
|
18
|
+
import { toggledOpen } from '../keys.js';
|
|
19
19
|
import { grow } from '../tree.js';
|
|
20
20
|
const CONTROL = [
|
|
21
21
|
'a[href]',
|
|
@@ -167,7 +167,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
167
167
|
const last = this.drawnPage.length - 1 + (this.moreDrawn ? 1 : 0);
|
|
168
168
|
const edge = this.width - 1;
|
|
169
169
|
const control = event.ctrlKey || event.metaKey;
|
|
170
|
-
if (
|
|
170
|
+
if (!event.shiftKey && selectsAll(event) && this.selectable) {
|
|
171
171
|
event.preventDefault();
|
|
172
172
|
this.requestSelected(new Set([...this.chosen, ...this.everyKey]));
|
|
173
173
|
return;
|
|
@@ -887,6 +887,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
887
887
|
const stop = this.currentRow(this.drawnPage) === -1 ? this.currentColumn : -1;
|
|
888
888
|
const offset = this.selectable ? 1 : 0;
|
|
889
889
|
const shown = this.shownColumns;
|
|
890
|
+
const android = onAndroid();
|
|
890
891
|
for (const column of this.tableColumns) {
|
|
891
892
|
column.movable = this.reorderable && column.field !== '';
|
|
892
893
|
column.gridCell = true;
|
|
@@ -897,6 +898,13 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
897
898
|
? 'ascending'
|
|
898
899
|
: 'descending'
|
|
899
900
|
: undefined;
|
|
901
|
+
column.sortWords =
|
|
902
|
+
android && column.sorted
|
|
903
|
+
? fillTemplate(this.sortedLabel, {
|
|
904
|
+
column: column.textContent?.trim() || column.field,
|
|
905
|
+
order: column.sorted === 'ascending' ? this.ascendingLabel : this.descendingLabel,
|
|
906
|
+
})
|
|
907
|
+
: '';
|
|
900
908
|
}
|
|
901
909
|
}
|
|
902
910
|
renderCell(column, row, picked, place, stop, header) {
|
|
@@ -1013,15 +1021,13 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
1013
1021
|
: html `<div part="after" role="presentation" style="block-size: ${after}px"></div>`;
|
|
1014
1022
|
}
|
|
1015
1023
|
renderSelectAll(stop) {
|
|
1016
|
-
const
|
|
1017
|
-
const keys = this.chosen;
|
|
1018
|
-
const count = every.filter((key) => keys.has(key)).length;
|
|
1024
|
+
const { checked, indeterminate } = everyState(this.chosen, this.everyKey);
|
|
1019
1025
|
return html `<span
|
|
1020
1026
|
part="select-all"
|
|
1021
1027
|
role="columnheader"
|
|
1022
1028
|
tabindex=${stop ? '0' : '-1'}
|
|
1023
1029
|
data-column="0"
|
|
1024
|
-
>${this.renderCheckbox(this.selectAllLabel,
|
|
1030
|
+
>${this.renderCheckbox(this.selectAllLabel, checked, indeterminate, this.toggleAll)}</span>`;
|
|
1025
1031
|
}
|
|
1026
1032
|
renderMore(page) {
|
|
1027
1033
|
if (!this.moreDrawn) {
|
|
@@ -71,6 +71,7 @@ declare const HelixHeadlessDateInput_base: (new (...args: any[]) => import("@fus
|
|
|
71
71
|
* @csspart picker-day-outside - A day from a neighboring month. Applied with `picker-day`.
|
|
72
72
|
* @csspart picker-day-selected - The chosen day, or either end of a chosen range. Applied with `picker-day`.
|
|
73
73
|
* @csspart picker-day-today - Today. Applied with `picker-day`.
|
|
74
|
+
* @csspart picker-feedback - The calendar's own message, under it, while the calendar's `feedback` is set.
|
|
74
75
|
* @csspart picker-grid - The grid of days.
|
|
75
76
|
* @csspart picker-header - The month name and its controls.
|
|
76
77
|
* @csspart picker-heading - The month and year being shown.
|
|
@@ -173,9 +174,15 @@ export declare class HelixHeadlessDateInput extends HelixHeadlessDateInput_base
|
|
|
173
174
|
*/
|
|
174
175
|
isDateUnavailable?: ((date: string) => boolean) | undefined;
|
|
175
176
|
/**
|
|
176
|
-
* The language tag for the
|
|
177
|
+
* The language tag for the field's order and words, and for the names of
|
|
178
|
+
* months and days in the calendar.
|
|
179
|
+
*
|
|
180
|
+
* Absent is the page's: the `lang` of the nearest element with one, as
|
|
181
|
+
* Shoelace and Web Awesome read it, then the runtime's own.
|
|
177
182
|
*/
|
|
178
183
|
locale: string;
|
|
184
|
+
/** The locale the words are written in: `locale`, or the page's `lang`. */
|
|
185
|
+
private get language();
|
|
179
186
|
/**
|
|
180
187
|
* The latest date that can be chosen, as `YYYY-MM-DD`.
|
|
181
188
|
*/
|
|
@@ -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, valueAsDate as asDate, barredBy, customElement, fillTemplate, dateAsValue as fromDate, HelixFormElement, isDateValue, MixinControllerOpen, MixinControllerValue, MixinField, MixinPickerEditing, MixinPickerField, MixinSegmentedField, MixinTokens, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { AriaForwardController, valueAsDate as asDate, barredBy, customElement, fillTemplate, dateAsValue as fromDate, HelixFormElement, isDateValue, localeOf, MixinControllerOpen, MixinControllerValue, MixinField, MixinPickerEditing, MixinPickerField, MixinSegmentedField, MixinTokens, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { calendarBlank } from '@fusion.dev/helix-icons';
|
|
9
9
|
import { nothing } from 'lit';
|
|
10
10
|
import { property, state } from 'lit/decorators.js';
|
|
@@ -100,6 +100,9 @@ let HelixHeadlessDateInput = class HelixHeadlessDateInput extends MixinSegmented
|
|
|
100
100
|
this.requestUpdate();
|
|
101
101
|
};
|
|
102
102
|
}
|
|
103
|
+
get language() {
|
|
104
|
+
return localeOf(this, this.locale);
|
|
105
|
+
}
|
|
103
106
|
placed(room) {
|
|
104
107
|
const all = Math.max(1, Math.floor(this.months) || 1);
|
|
105
108
|
const surface = this.partNamed('surface');
|
|
@@ -132,7 +135,7 @@ let HelixHeadlessDateInput = class HelixHeadlessDateInput extends MixinSegmented
|
|
|
132
135
|
return 'date';
|
|
133
136
|
}
|
|
134
137
|
get segmentLocale() {
|
|
135
|
-
return this.
|
|
138
|
+
return this.language;
|
|
136
139
|
}
|
|
137
140
|
written(date) {
|
|
138
141
|
if (this.dateStyle === 'iso' || !isDateValue(date)) {
|
|
@@ -141,7 +144,7 @@ let HelixHeadlessDateInput = class HelixHeadlessDateInput extends MixinSegmented
|
|
|
141
144
|
const at = new Date(`${date}T00:00:00Z`);
|
|
142
145
|
return Number.isNaN(at.getTime())
|
|
143
146
|
? date
|
|
144
|
-
: new Intl.DateTimeFormat(this.
|
|
147
|
+
: new Intl.DateTimeFormat(this.language || undefined, {
|
|
145
148
|
dateStyle: this.dateStyle,
|
|
146
149
|
timeZone: 'UTC',
|
|
147
150
|
}).format(at);
|
|
@@ -215,7 +218,7 @@ let HelixHeadlessDateInput = class HelixHeadlessDateInput extends MixinSegmented
|
|
|
215
218
|
exportparts="cell: picker-cell, cell-range-end: picker-cell-range-end,
|
|
216
219
|
cell-range-middle: picker-cell-range-middle, cell-range-start: picker-cell-range-start,
|
|
217
220
|
day: picker-day, day-disabled: picker-day-disabled, day-outside: picker-day-outside,
|
|
218
|
-
day-selected: picker-day-selected, day-today: picker-day-today, grid: picker-grid,
|
|
221
|
+
day-selected: picker-day-selected, day-today: picker-day-today, feedback: picker-feedback, grid: picker-grid,
|
|
219
222
|
header: picker-header, heading: picker-heading, heading-button: picker-heading-button,
|
|
220
223
|
month: picker-month, months: picker-months, next: picker-next,
|
|
221
224
|
next-mark: picker-next-mark, period: picker-period, period-current: picker-period-current,
|
|
@@ -231,7 +234,7 @@ let HelixHeadlessDateInput = class HelixHeadlessDateInput extends MixinSegmented
|
|
|
231
234
|
disable-days=${this.disableDays || nothing}
|
|
232
235
|
first-day-of-week=${this.firstDayOfWeek ?? nothing}
|
|
233
236
|
label=${this.calendarLabel}
|
|
234
|
-
locale=${this.
|
|
237
|
+
locale=${this.language || nothing}
|
|
235
238
|
max=${this.max || nothing}
|
|
236
239
|
max-view=${this.maxView ?? nothing}
|
|
237
240
|
min=${this.min || nothing}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type CalendarView, HelixFormElement } from '@fusion.dev/helix-core';
|
|
2
2
|
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
3
|
-
declare const HelixHeadlessDatePicker_base: (new (...args: any[]) => import("@fusion.dev/helix-core").MixinControllerValueInterface) & typeof HelixFormElement;
|
|
3
|
+
declare const HelixHeadlessDatePicker_base: (new (...args: any[]) => import("@fusion.dev/helix-core").MixinPickerFeedbackInterface) & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinControllerValueInterface) & typeof HelixFormElement;
|
|
4
4
|
/**
|
|
5
5
|
* @summary A month calendar for choosing one or more dates.
|
|
6
6
|
*
|
|
@@ -60,6 +60,7 @@ declare const HelixHeadlessDatePicker_base: (new (...args: any[]) => import("@fu
|
|
|
60
60
|
* @csspart day-outside - A day from a neighboring month, filling the grid out, beside `day`.
|
|
61
61
|
* @csspart day-selected - The chosen day, or either end of a chosen range, beside `day`.
|
|
62
62
|
* @csspart day-today - Today, beside `day`.
|
|
63
|
+
* @csspart feedback - The message under the calendar, while `feedback` is set.
|
|
63
64
|
* @csspart grid - The grid of days.
|
|
64
65
|
* @csspart header - The month name and its controls.
|
|
65
66
|
* @csspart heading - The month and year being shown.
|
|
@@ -80,6 +81,8 @@ declare const HelixHeadlessDatePicker_base: (new (...args: any[]) => import("@fu
|
|
|
80
81
|
* @csspart weekday - A column header naming a day of the week.
|
|
81
82
|
*
|
|
82
83
|
* @cssproperty --date-picker-column-count - How many month columns are drawn, capped at two. `--date-picker-columns` overrides it.
|
|
84
|
+
*
|
|
85
|
+
* @cssstate invalid - While `invalid` is set or `feedback` says what is wrong.
|
|
83
86
|
*/
|
|
84
87
|
export declare class HelixHeadlessDatePicker extends HelixHeadlessDatePicker_base {
|
|
85
88
|
/**
|
|
@@ -123,10 +126,6 @@ export declare class HelixHeadlessDatePicker extends HelixHeadlessDatePicker_bas
|
|
|
123
126
|
* (Firefox does not), and is Sunday otherwise.
|
|
124
127
|
*/
|
|
125
128
|
firstDayOfWeek?: number;
|
|
126
|
-
/**
|
|
127
|
-
* Whether the current selection fails validation.
|
|
128
|
-
*/
|
|
129
|
-
invalid: boolean;
|
|
130
129
|
/**
|
|
131
130
|
* A rule for which dates cannot be chosen: a function given the date as
|
|
132
131
|
* `YYYY-MM-DD` that returns `true` to bar it.
|
|
@@ -142,11 +141,14 @@ export declare class HelixHeadlessDatePicker extends HelixHeadlessDatePicker_bas
|
|
|
142
141
|
*/
|
|
143
142
|
label: string;
|
|
144
143
|
/**
|
|
145
|
-
* Locale for month and day names.
|
|
144
|
+
* Locale for month and day names, and the day a week starts on.
|
|
146
145
|
*
|
|
147
|
-
* Absent
|
|
146
|
+
* Absent is the page's: the `lang` of the nearest element with one, as
|
|
147
|
+
* Shoelace and Web Awesome read it, then the runtime's own.
|
|
148
148
|
*/
|
|
149
149
|
locale: string;
|
|
150
|
+
/** The locale the words are written in: `locale`, or the page's `lang`. */
|
|
151
|
+
private get language();
|
|
150
152
|
/**
|
|
151
153
|
* Latest selectable date, as `YYYY-MM-DD`.
|
|
152
154
|
*/
|
|
@@ -267,8 +269,11 @@ export declare class HelixHeadlessDatePicker extends HelixHeadlessDatePicker_bas
|
|
|
267
269
|
*
|
|
268
270
|
* Each candidate is tested in turn rather than the first one winning
|
|
269
271
|
* outright. Where the last date focused is in some other month, the selected
|
|
270
|
-
* date still holds the stop,
|
|
271
|
-
*
|
|
272
|
+
* date still holds the stop, then today, as the APG date picker and React
|
|
273
|
+
* Aria's calendar put it, and only with none of them in view does it fall
|
|
274
|
+
* to the first of the month. Measured before today was a candidate: a
|
|
275
|
+
* calendar with no value opened on October 5 with its stop on "Thursday,
|
|
276
|
+
* October 1".
|
|
272
277
|
*/
|
|
273
278
|
private get anchor();
|
|
274
279
|
/** Six weeks of dates, so a grid does not change height between months. */
|
|
@@ -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, fillTemplate, dateAsValue as fromDate, HelixFormElement, HelixNavigateEvent, hostAria, inlineStep, commaList as list, localToday, MixinControllerValue, monthOf, monthOut, periodCells, periodKey, reportValues, requestChange, sameMonth, weekStartOf, YEARS_SHOWN, yearOut, yearPageOf, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { addDays, addMonths, valueAsDate as asDate, barredBy, customElement, fillTemplate, dateAsValue as fromDate, HelixFormElement, HelixNavigateEvent, hostAria, inlineStep, commaList as list, localeOf, localToday, MixinControllerValue, MixinPickerFeedback, monthOf, monthOut, periodCells, periodKey, reportValues, requestChange, sameMonth, weekStartOf, 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';
|
|
@@ -22,13 +22,12 @@ const KEYS = new Set([
|
|
|
22
22
|
' ',
|
|
23
23
|
]);
|
|
24
24
|
const firstOf = (year, month) => addMonths(asDate('2000-01-01'), (year - 2000) * 12 + month);
|
|
25
|
-
let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinControllerValue(HelixFormElement) {
|
|
25
|
+
let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinPickerFeedback(MixinControllerValue(HelixFormElement)) {
|
|
26
26
|
constructor() {
|
|
27
27
|
super(...arguments);
|
|
28
28
|
this.defaultMonth = '';
|
|
29
29
|
this.disableDates = '';
|
|
30
30
|
this.disableDays = '';
|
|
31
|
-
this.invalid = false;
|
|
32
31
|
this.label = 'Date Picker';
|
|
33
32
|
this.locale = '';
|
|
34
33
|
this.max = '';
|
|
@@ -105,6 +104,9 @@ let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinControl
|
|
|
105
104
|
this.view = 'day';
|
|
106
105
|
this.yearViewLabel = '{heading}. Choose a year';
|
|
107
106
|
}
|
|
107
|
+
get language() {
|
|
108
|
+
return localeOf(this, this.locale);
|
|
109
|
+
}
|
|
108
110
|
get month() {
|
|
109
111
|
return this.monthState ?? (this.defaultMonth || fromDate(this.derivedMonth).slice(0, 7));
|
|
110
112
|
}
|
|
@@ -120,7 +122,8 @@ let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinControl
|
|
|
120
122
|
if (this.firstDayOfWeek !== undefined && Number.isFinite(this.firstDayOfWeek)) {
|
|
121
123
|
return ((Math.floor(this.firstDayOfWeek) % 7) + 7) % 7;
|
|
122
124
|
}
|
|
123
|
-
|
|
125
|
+
const language = this.language;
|
|
126
|
+
return language === '' ? 0 : weekStartOf(language);
|
|
124
127
|
}
|
|
125
128
|
get range() {
|
|
126
129
|
const dates = this.selected;
|
|
@@ -145,12 +148,16 @@ let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinControl
|
|
|
145
148
|
return this.derivedMonth;
|
|
146
149
|
}
|
|
147
150
|
get derivedMonth() {
|
|
148
|
-
const from = asDate(this.selected[0] ?? '') ?? new Date();
|
|
151
|
+
const from = asDate(this.selected[0] ?? '') ?? asDate(localToday()) ?? new Date();
|
|
149
152
|
return firstOf(from.getUTCFullYear(), from.getUTCMonth());
|
|
150
153
|
}
|
|
151
154
|
get anchor() {
|
|
152
155
|
const shown = this.shown;
|
|
153
|
-
for (const candidate of [
|
|
156
|
+
for (const candidate of [
|
|
157
|
+
asDate(this.focused),
|
|
158
|
+
asDate(this.selected[0] ?? ''),
|
|
159
|
+
asDate(localToday()),
|
|
160
|
+
]) {
|
|
154
161
|
if (candidate && sameMonth(candidate, shown)) {
|
|
155
162
|
return candidate;
|
|
156
163
|
}
|
|
@@ -414,7 +421,6 @@ let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinControl
|
|
|
414
421
|
role: 'group',
|
|
415
422
|
});
|
|
416
423
|
this.internals.ariaDisabled = this.isDisabled ? 'true' : null;
|
|
417
|
-
this.internals.ariaInvalid = this.invalid ? 'true' : null;
|
|
418
424
|
this.report();
|
|
419
425
|
}
|
|
420
426
|
updated(changed) {
|
|
@@ -432,14 +438,15 @@ let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinControl
|
|
|
432
438
|
return Math.max(1, Math.floor(this.months) || 1);
|
|
433
439
|
}
|
|
434
440
|
get formats() {
|
|
435
|
-
|
|
441
|
+
const language = this.language;
|
|
442
|
+
if (this.cachedFormats?.locale === language) {
|
|
436
443
|
return this.cachedFormats;
|
|
437
444
|
}
|
|
438
|
-
const locale =
|
|
445
|
+
const locale = language || undefined;
|
|
439
446
|
const built = {
|
|
440
447
|
full: new Intl.DateTimeFormat(locale, { dateStyle: 'full', timeZone: 'UTC' }),
|
|
441
448
|
heading: new Intl.DateTimeFormat(locale, { month: 'long', timeZone: 'UTC', year: 'numeric' }),
|
|
442
|
-
locale:
|
|
449
|
+
locale: language,
|
|
443
450
|
long: new Intl.DateTimeFormat(locale, { dateStyle: 'long', timeZone: 'UTC' }),
|
|
444
451
|
monthName: new Intl.DateTimeFormat(locale, { month: 'short', timeZone: 'UTC' }),
|
|
445
452
|
weekday: new Intl.DateTimeFormat(locale, { timeZone: 'UTC', weekday: 'short' }),
|
|
@@ -619,14 +626,15 @@ let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinControl
|
|
|
619
626
|
render() {
|
|
620
627
|
if (this.view !== 'day') {
|
|
621
628
|
return html `<div part="months" style="--date-picker-column-count: 1">
|
|
622
|
-
|
|
623
|
-
|
|
629
|
+
${this.renderPeriods()}
|
|
630
|
+
</div>
|
|
631
|
+
${this.renderPickerFeedback()}`;
|
|
624
632
|
}
|
|
625
633
|
const shown = this.shown;
|
|
626
634
|
const count = this.monthCount;
|
|
627
635
|
return html `<div part="months" style="--date-picker-column-count: ${Math.min(count, 2)}">
|
|
628
636
|
${Array.from({ length: count }, (_, index) => this.renderMonth(addMonths(shown, index), index))}
|
|
629
|
-
</div
|
|
637
|
+
</div>${this.renderPickerFeedback()}`;
|
|
630
638
|
}
|
|
631
639
|
get valueAsDate() {
|
|
632
640
|
return asDate(this.value);
|
|
@@ -659,9 +667,6 @@ __decorate([
|
|
|
659
667
|
__decorate([
|
|
660
668
|
property({ attribute: 'first-day-of-week', type: Number })
|
|
661
669
|
], HelixHeadlessDatePicker.prototype, "firstDayOfWeek", void 0);
|
|
662
|
-
__decorate([
|
|
663
|
-
property({ reflect: true, type: Boolean })
|
|
664
|
-
], HelixHeadlessDatePicker.prototype, "invalid", void 0);
|
|
665
670
|
__decorate([
|
|
666
671
|
property({ attribute: false })
|
|
667
672
|
], HelixHeadlessDatePicker.prototype, "isDateUnavailable", void 0);
|
|
@@ -16,13 +16,21 @@ import { type PropertyValues, type TemplateResult } from 'lit';
|
|
|
16
16
|
* the authors of a paper. The item then puts your `<dd>` elements after its
|
|
17
17
|
* `<dt>` in place of its own, so a screen reader hears one term and each of
|
|
18
18
|
* its descriptions, as in a native `<dl>`. A server cannot see your elements,
|
|
19
|
-
* so
|
|
19
|
+
* so set `several` as well, and the served item leaves them unwrapped too.
|
|
20
|
+
* Without it, the served item wraps them in its own `<dd>` until it runs.
|
|
21
|
+
*
|
|
22
|
+
* **Controls that act on the value**, such as a copy button, go in the
|
|
23
|
+
* `actions` slot, drawn after the value inside its `<dd>`, as Radix Themes'
|
|
24
|
+
* data list puts an icon button beside a value. A screen reader hears them as
|
|
25
|
+
* part of the description they act on. With several values, put each control
|
|
26
|
+
* inside the `<dd>` it acts on.
|
|
20
27
|
*
|
|
21
28
|
* @since 0.1.0
|
|
22
29
|
* @status stable
|
|
23
30
|
* @documentation https://fusion.dev/helix/components/description-list
|
|
24
31
|
*
|
|
25
32
|
* @slot - The value, or several `<dd>` elements for several values.
|
|
33
|
+
* @slot actions - Controls that act on the value, such as a copy button, after it inside its `<dd>`.
|
|
26
34
|
* @slot label - The label, when it is more than text. Falls back to `label`.
|
|
27
35
|
*
|
|
28
36
|
* @csspart label - The `<dt>`, holding the label.
|
|
@@ -37,12 +45,18 @@ export declare class HelixHeadlessDescriptionListItem extends HelixElement {
|
|
|
37
45
|
* that varies and is often more than text.
|
|
38
46
|
*/
|
|
39
47
|
label: string;
|
|
48
|
+
/**
|
|
49
|
+
* Says the values are several `<dd>` elements of your own, so the item
|
|
50
|
+
* draws no `<dd>` of its own around them, on the server too. Without it the
|
|
51
|
+
* item finds them once it runs, and the served markup wraps them until then.
|
|
52
|
+
*/
|
|
53
|
+
several: boolean;
|
|
40
54
|
/**
|
|
41
55
|
* Whether the values are the consumer's own `<dd>` elements, which the item
|
|
42
|
-
* then does not wrap
|
|
43
|
-
*
|
|
56
|
+
* then does not wrap: `several`, or `<dd>` children found once it runs.
|
|
57
|
+
* Unknown on a server and while hydrating, where `several` decides.
|
|
44
58
|
*/
|
|
45
|
-
private get
|
|
59
|
+
private get ownValues();
|
|
46
60
|
protected firstUpdated(changed: PropertyValues): void;
|
|
47
61
|
protected render(): TemplateResult;
|
|
48
62
|
/** A value arriving or leaving can change whether the item wraps them. */
|
|
@@ -11,12 +11,13 @@ let HelixHeadlessDescriptionListItem = class HelixHeadlessDescriptionListItem ex
|
|
|
11
11
|
constructor() {
|
|
12
12
|
super(...arguments);
|
|
13
13
|
this.label = '';
|
|
14
|
+
this.several = false;
|
|
14
15
|
this.handleSlotChange = () => {
|
|
15
16
|
this.requestUpdate();
|
|
16
17
|
};
|
|
17
18
|
}
|
|
18
|
-
get
|
|
19
|
-
return this.knownChildren.some((child) => child.localName === 'dd');
|
|
19
|
+
get ownValues() {
|
|
20
|
+
return this.several || this.knownChildren.some((child) => child.localName === 'dd');
|
|
20
21
|
}
|
|
21
22
|
firstUpdated(changed) {
|
|
22
23
|
super.firstUpdated(changed);
|
|
@@ -24,15 +25,18 @@ let HelixHeadlessDescriptionListItem = class HelixHeadlessDescriptionListItem ex
|
|
|
24
25
|
}
|
|
25
26
|
render() {
|
|
26
27
|
const label = html `<dt part="label"><slot name="label">${this.label}</slot></dt>`;
|
|
27
|
-
return this.
|
|
28
|
+
return this.ownValues
|
|
28
29
|
? html `${label}<slot @slotchange=${this.handleSlotChange}></slot>`
|
|
29
30
|
: html `${label}
|
|
30
|
-
<dd part="value"><slot @slotchange=${this.handleSlotChange}></slot></dd>`;
|
|
31
|
+
<dd part="value"><slot @slotchange=${this.handleSlotChange}></slot><slot name="actions"></slot></dd>`;
|
|
31
32
|
}
|
|
32
33
|
};
|
|
33
34
|
__decorate([
|
|
34
35
|
property()
|
|
35
36
|
], HelixHeadlessDescriptionListItem.prototype, "label", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
property({ type: Boolean })
|
|
39
|
+
], HelixHeadlessDescriptionListItem.prototype, "several", void 0);
|
|
36
40
|
HelixHeadlessDescriptionListItem = __decorate([
|
|
37
41
|
customElement('helix-headless-description-list-item')
|
|
38
42
|
], HelixHeadlessDescriptionListItem);
|
|
@@ -8,6 +8,7 @@ import { CHART_PLOT, customElement, drawTooltip, HelixElement, MixinChartSource,
|
|
|
8
8
|
import { html, nothing, svg } from 'lit';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
10
|
import '../../tooltip/index.js';
|
|
11
|
+
import { sliceLabelAt } from '../slice-label.js';
|
|
11
12
|
const PERCENTS = new Map();
|
|
12
13
|
const percentIn = (locale) => {
|
|
13
14
|
let found = PERCENTS.get(locale);
|
|
@@ -124,16 +125,22 @@ let HelixHeadlessDonutChart = class HelixHeadlessDonutChart extends MixinChartSo
|
|
|
124
125
|
}
|
|
125
126
|
renderSliceLabels(shares) {
|
|
126
127
|
const half = this.sweep === 'half';
|
|
127
|
-
const
|
|
128
|
-
|
|
128
|
+
const ring = {
|
|
129
|
+
center: CENTER,
|
|
130
|
+
origin: this.origin,
|
|
131
|
+
radius: this.radius,
|
|
132
|
+
span: this.span,
|
|
133
|
+
tall: half ? EDGE + this.thickness / 2 : PLOT_HEIGHT,
|
|
134
|
+
top: half ? CENTER - EDGE : 0,
|
|
135
|
+
width: PLOT_WIDTH,
|
|
136
|
+
};
|
|
129
137
|
const format = percentIn(this.locale);
|
|
130
138
|
return html `${shares.map((share, index) => {
|
|
131
|
-
|
|
139
|
+
const place = sliceLabelAt(share, ring);
|
|
140
|
+
if (!place) {
|
|
132
141
|
return nothing;
|
|
133
142
|
}
|
|
134
|
-
const
|
|
135
|
-
const x = ((CENTER + Math.cos(angle) * this.radius) / PLOT_WIDTH) * 100;
|
|
136
|
-
const y = ((CENTER + Math.sin(angle) * this.radius - top) / tall) * 100;
|
|
143
|
+
const { x, y } = place;
|
|
137
144
|
return html `<span
|
|
138
145
|
aria-hidden="true"
|
|
139
146
|
data-series=${seriesIndex(index)}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** A slice's place on the ring, as shares of the whole from 0 to 1. */
|
|
2
|
+
export interface SliceShare {
|
|
3
|
+
/** How much of the ring the slice takes. */
|
|
4
|
+
fraction: number;
|
|
5
|
+
/** Where the slice starts, as the share of the ring before it. */
|
|
6
|
+
start: number;
|
|
7
|
+
}
|
|
8
|
+
/** The ring a slice label is placed on, in the drawing's own units. */
|
|
9
|
+
export interface RingGeometry {
|
|
10
|
+
/** The center, on both axes. */
|
|
11
|
+
center: number;
|
|
12
|
+
/** Where the ring's turn starts, in radians: a quarter turn back is twelve o'clock. */
|
|
13
|
+
origin: number;
|
|
14
|
+
/** The radius of the band's middle, where a label sits. */
|
|
15
|
+
radius: number;
|
|
16
|
+
/** How much of a turn the ring takes: 1 for a ring, a half for an arc. */
|
|
17
|
+
span: number;
|
|
18
|
+
/** How tall the box the labels are placed in is. */
|
|
19
|
+
tall: number;
|
|
20
|
+
/** Where the top of that box is. */
|
|
21
|
+
top: number;
|
|
22
|
+
/** How wide the drawing is. */
|
|
23
|
+
width: number;
|
|
24
|
+
}
|
|
25
|
+
/** The smallest share that takes a label: a twentieth of the ring. */
|
|
26
|
+
export declare const SMALLEST_LABELED = 0.05;
|
|
27
|
+
/**
|
|
28
|
+
* Where a slice's label goes, as percentages of the box from the left and the
|
|
29
|
+
* top: the middle of its band at its mid-angle. Nothing for a slice under a
|
|
30
|
+
* twentieth, whose label would not fit on it.
|
|
31
|
+
*/
|
|
32
|
+
export declare const sliceLabelAt: (share: SliceShare, ring: RingGeometry) => {
|
|
33
|
+
x: number;
|
|
34
|
+
y: number;
|
|
35
|
+
} | undefined;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const SMALLEST_LABELED = 0.05;
|
|
2
|
+
export const sliceLabelAt = (share, ring) => {
|
|
3
|
+
if (share.fraction < SMALLEST_LABELED) {
|
|
4
|
+
return undefined;
|
|
5
|
+
}
|
|
6
|
+
const angle = (share.start + share.fraction / 2) * 2 * Math.PI * ring.span + ring.origin;
|
|
7
|
+
return {
|
|
8
|
+
x: ((ring.center + Math.cos(angle) * ring.radius) / ring.width) * 100,
|
|
9
|
+
y: ((ring.center + Math.sin(angle) * ring.radius - ring.top) / ring.tall) * 100,
|
|
10
|
+
};
|
|
11
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AriaForwardController, CommandController, HelixElement, OpenPhaseController, SwipeController } from '@fusion.dev/helix-core';
|
|
1
|
+
import { AriaForwardController, CommandController, FocusScopeController, HelixElement, OpenPhaseController, SwipeController } from '@fusion.dev/helix-core';
|
|
2
2
|
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
3
3
|
declare const HelixHeadlessDrawer_base: (new (...args: any[]) => import("@fusion.dev/helix-core").MixinControllerOpenInterface) & typeof HelixElement;
|
|
4
4
|
/**
|
|
@@ -11,7 +11,8 @@ declare const HelixHeadlessDrawer_base: (new (...args: any[]) => import("@fusion
|
|
|
11
11
|
*
|
|
12
12
|
* The drawer is modal by default, which means four things:
|
|
13
13
|
*
|
|
14
|
-
* - focus is trapped inside
|
|
14
|
+
* - focus is trapped inside: `Tab` from the last control goes to the first,
|
|
15
|
+
* and `Shift+Tab` from the first to the last, as in `Dialog`
|
|
15
16
|
* - Escape and a press outside close it
|
|
16
17
|
* - the page behind is covered
|
|
17
18
|
* - the page behind does not scroll
|
|
@@ -233,6 +234,7 @@ export declare class HelixHeadlessDrawer extends HelixHeadlessDrawer_base {
|
|
|
233
234
|
* key is read here, and comes through the same request.
|
|
234
235
|
*/
|
|
235
236
|
private readonly handleKeydown;
|
|
237
|
+
protected readonly scope: FocusScopeController;
|
|
236
238
|
/** The panel, which is a real `<dialog>`. */
|
|
237
239
|
private get panel();
|
|
238
240
|
/**
|
|
@@ -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, CommandController, customElement, drawDismiss, drawDismissGlyph, edgeOffset, HelixElement, headingsIn, isRtl, lockScroll, MixinControllerOpen, OpenPhaseController, onUnlessFalse, parseSnapPoints, reflectElements, SwipeController, settleSwipe, snapTravel, swipeAxis, swipeEdge, towardEdge, unlockScroll, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { AriaForwardController, CommandController, customElement, drawDismiss, drawDismissGlyph, edgeOffset, FocusScopeController, HelixElement, headingsIn, isRtl, lockScroll, MixinControllerOpen, nearest, OpenPhaseController, onUnlessFalse, parseSnapPoints, reflectElements, SwipeController, settleSwipe, snapTravel, swipeAxis, swipeEdge, towardEdge, unlockScroll, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { html, nothing } from 'lit';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
10
|
import { beyondWindow } from '../reveal.js';
|
|
@@ -64,6 +64,16 @@ let HelixHeadlessDrawer = class HelixHeadlessDrawer extends MixinControllerOpen(
|
|
|
64
64
|
event.preventDefault();
|
|
65
65
|
this.requestOpen(false);
|
|
66
66
|
};
|
|
67
|
+
this.scope = new FocusScopeController(this, {
|
|
68
|
+
contain: () => this.open && this.modal,
|
|
69
|
+
contents: () => [
|
|
70
|
+
...['header', '', 'footer'].flatMap((name) => this.renderRoot
|
|
71
|
+
?.querySelector(name ? `slot[name="${name}"]` : 'slot:not([name])')
|
|
72
|
+
?.assignedElements({ flatten: true }) ?? []),
|
|
73
|
+
...[...(this.panel?.children ?? [])].filter((one) => one.localName === 'button'),
|
|
74
|
+
],
|
|
75
|
+
surface: () => this.panel,
|
|
76
|
+
});
|
|
67
77
|
this.handleCancel = (event) => {
|
|
68
78
|
event.preventDefault();
|
|
69
79
|
this.requestOpen(false);
|
|
@@ -153,8 +163,10 @@ let HelixHeadlessDrawer = class HelixHeadlessDrawer extends MixinControllerOpen(
|
|
|
153
163
|
return;
|
|
154
164
|
}
|
|
155
165
|
const points = parseSnapPoints(this.snapPoints);
|
|
156
|
-
const
|
|
157
|
-
|
|
166
|
+
const at = nearest(points, point);
|
|
167
|
+
if (at !== undefined) {
|
|
168
|
+
this.restAt(at);
|
|
169
|
+
}
|
|
158
170
|
}
|
|
159
171
|
show() {
|
|
160
172
|
this.requestOpen(true);
|
|
@@ -13,6 +13,8 @@ import { nothing, type PropertyValues, type TemplateResult } from 'lit';
|
|
|
13
13
|
* - On the page that is showing, it renders its row.
|
|
14
14
|
* - When its own page is showing, it renders only that page's rows. Its row
|
|
15
15
|
* belongs to the page above.
|
|
16
|
+
* - When a page further down its own is showing, it renders its page's slot
|
|
17
|
+
* alone, so the rows below reach the page.
|
|
16
18
|
* - Otherwise it renders nothing. The rows stay in the light DOM untouched, so
|
|
17
19
|
* there is no state to keep.
|
|
18
20
|
*
|
|
@@ -23,6 +25,10 @@ import { nothing, type PropertyValues, type TemplateResult } from 'lit';
|
|
|
23
25
|
* `aria-haspopup`, the same way `Menu` marks a row with a submenu. The server
|
|
24
26
|
* render leaves both out, because the server cannot see the children.
|
|
25
27
|
*
|
|
28
|
+
* The row is named by its label alone. Words in `description`, a line under
|
|
29
|
+
* the label, and in `end` describe it instead, through `aria-describedby`, as
|
|
30
|
+
* `Menu.Item` does: a reader hears "Theme", then "Dark".
|
|
31
|
+
*
|
|
26
32
|
* @since 0.1.0
|
|
27
33
|
* @status stable
|
|
28
34
|
* @aliases Panel item, Drill row
|
|
@@ -30,7 +36,8 @@ import { nothing, type PropertyValues, type TemplateResult } from 'lit';
|
|
|
30
36
|
*
|
|
31
37
|
* @slot - The row's label.
|
|
32
38
|
* @slot chevron - Replaces the caret of a row that opens a page, such as with your own icon.
|
|
33
|
-
* @slot
|
|
39
|
+
* @slot description - A line under the label that describes the row. It describes the row to a screen reader and is not part of its name.
|
|
40
|
+
* @slot end - Content after the label, such as the setting a page holds or a count. It describes the row and is not part of its name.
|
|
34
41
|
* @slot page - The rows of the page this row opens.
|
|
35
42
|
* @slot start - Content before the label, usually an icon.
|
|
36
43
|
*
|
|
@@ -71,6 +78,11 @@ export declare class HelixHeadlessDrilldownItem extends HelixElement {
|
|
|
71
78
|
* event handler is why it is kept off the typings.
|
|
72
79
|
*/
|
|
73
80
|
onPage: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* @internal Whether the page showing is below this row's own, deeper than one
|
|
83
|
+
* level. Written by the stack.
|
|
84
|
+
*/
|
|
85
|
+
onPath: boolean;
|
|
74
86
|
/**
|
|
75
87
|
* @internal Whether this row's own page is the one showing. Written by the
|
|
76
88
|
* stack.
|
|
@@ -89,6 +101,10 @@ export declare class HelixHeadlessDrilldownItem extends HelixElement {
|
|
|
89
101
|
* render would open with no caret on the row that leads to it.
|
|
90
102
|
*/
|
|
91
103
|
private page;
|
|
104
|
+
/** Whether anything is slotted under the label, read the way `page` is. */
|
|
105
|
+
private description;
|
|
106
|
+
/** Whether anything is slotted after the label, read the way `page` is. */
|
|
107
|
+
private end;
|
|
92
108
|
/**
|
|
93
109
|
* Reads the children before each render, where they can be known.
|
|
94
110
|
*
|
|
@@ -109,6 +125,10 @@ export declare class HelixHeadlessDrilldownItem extends HelixElement {
|
|
|
109
125
|
* the same note.
|
|
110
126
|
*/
|
|
111
127
|
private readonly readPage;
|
|
128
|
+
/** Re-reads whether the line under the label or the words after it are filled. */
|
|
129
|
+
private readonly readWords;
|
|
130
|
+
/** What describes the row: the line under its label and the words after it. */
|
|
131
|
+
private get describedBy();
|
|
112
132
|
/** Moves focus onto the row itself. */
|
|
113
133
|
focusItem(): void;
|
|
114
134
|
/**
|