@fusion.dev/helix-headless 0.146.0 → 0.148.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 +9287 -1084
- package/dist/accordion/item/accordion-item.d.ts +43 -21
- package/dist/accordion/item/accordion-item.js +37 -11
- package/dist/accordion/root/accordion-root.d.ts +8 -2
- package/dist/accordion/root/accordion-root.js +6 -8
- package/dist/announcement/root/announcement-root.d.ts +66 -6
- package/dist/announcement/root/announcement-root.js +144 -13
- package/dist/area-chart/root/area-chart-root.d.ts +18 -1
- package/dist/area-chart/root/area-chart-root.js +14 -7
- package/dist/avatar/root/avatar-root.d.ts +31 -1
- package/dist/avatar/root/avatar-root.js +11 -1
- package/dist/badge/count.d.ts +14 -0
- package/dist/badge/count.js +20 -0
- package/dist/badge/root/badge-root.d.ts +57 -6
- package/dist/badge/root/badge-root.js +77 -8
- 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/blockquote/root/blockquote-root.d.ts +66 -8
- package/dist/blockquote/root/blockquote-root.js +85 -8
- 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/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 +141 -3
- package/dist/button-group/root/button-group-root.js +142 -2
- package/dist/canvas/edge-pan.d.ts +61 -0
- package/dist/canvas/edge-pan.js +63 -0
- package/dist/canvas/node/canvas-node.d.ts +12 -2
- package/dist/canvas/node/canvas-node.js +6 -2
- 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 +107 -5
- package/dist/canvas/root/canvas-root.js +140 -36
- package/dist/canvas/snap.d.ts +42 -0
- package/dist/canvas/snap.js +32 -0
- package/dist/card/root/card-root.d.ts +12 -1
- package/dist/card/root/card-root.js +11 -4
- package/dist/carousel/root/carousel-root.d.ts +4 -3
- package/dist/carousel/root/carousel-root.js +2 -6
- package/dist/chat/root/chat-root.d.ts +28 -4
- package/dist/chat/root/chat-root.js +12 -7
- package/dist/checkbox/root/checkbox-root.js +5 -7
- package/dist/checkbox-group/root/checkbox-group-root.d.ts +13 -0
- package/dist/checkbox-group/root/checkbox-group-root.js +16 -7
- package/dist/checkbox-group/select-all.d.ts +9 -4
- package/dist/checkbox-group/select-all.js +1 -1
- package/dist/code-block/root/code-block-root.d.ts +41 -18
- package/dist/code-block/root/code-block-root.js +21 -6
- 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 +99 -55
- package/dist/color-picker/wheel.d.ts +28 -0
- package/dist/color-picker/wheel.js +15 -0
- package/dist/combobox/root/combobox-root.d.ts +83 -11
- package/dist/combobox/root/combobox-root.js +81 -18
- package/dist/command/root/command-root.d.ts +7 -4
- 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 +29 -50
- 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 +22 -4
- package/dist/description-list/item/description-list-item.js +14 -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.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 +38 -4
- package/dist/drilldown/root/drilldown-root.js +3 -2
- package/dist/element-events.generated.js +5 -1
- package/dist/empty/root/empty-root.d.ts +46 -2
- package/dist/empty/root/empty-root.js +50 -5
- package/dist/file-input/root/file-input-root.d.ts +34 -6
- package/dist/file-input/root/file-input-root.js +55 -21
- package/dist/file-input/status.d.ts +24 -0
- package/dist/file-input/status.js +11 -0
- package/dist/filter-input/chip/filter-chip.d.ts +23 -0
- package/dist/filter-input/chip/filter-chip.js +10 -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/fields.d.ts +20 -0
- package/dist/format-date/fields.js +14 -0
- package/dist/format-date/options.d.ts +5 -5
- package/dist/format-date/options.js +10 -39
- package/dist/format-date/root/format-date-root.d.ts +53 -4
- package/dist/format-date/root/format-date-root.js +38 -50
- package/dist/graph/root/graph-root.d.ts +23 -5
- package/dist/graph/root/graph-root.js +17 -20
- 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 +76 -3
- package/dist/heatmap/root/heatmap-root.js +105 -20
- 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 +20 -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/root/kbd-root.d.ts +20 -3
- package/dist/kbd/root/kbd-root.js +23 -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 +25 -26
- 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 +31 -24
- package/dist/list/selection.d.ts +17 -0
- package/dist/list/selection.js +16 -0
- package/dist/listbox/root/listbox-root.d.ts +125 -26
- package/dist/listbox/root/listbox-root.js +156 -166
- package/dist/map/marker/map-marker.d.ts +2 -1
- package/dist/map/root/map-root.d.ts +40 -2
- package/dist/map/root/map-root.js +64 -23
- 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 +29 -50
- package/dist/menu/item/menu-item.js +4 -4
- package/dist/menu/root/menu-root.d.ts +5 -2
- package/dist/meter/root/meter-root.d.ts +42 -0
- package/dist/meter/root/meter-root.js +33 -7
- package/dist/navigation/root/navigation-root.js +5 -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 +12 -1
- package/dist/notifications/notification/notification.js +3 -1
- package/dist/notifications/root/notifications-root.d.ts +48 -3
- package/dist/notifications/root/notifications-root.js +36 -6
- 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 +17 -6
- package/dist/object-inspector/root/object-inspector-root.js +31 -20
- 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 +6 -0
- package/dist/pagination/size/pagination-size.js +5 -3
- package/dist/pin-input/code.d.ts +51 -1
- package/dist/pin-input/code.js +37 -0
- package/dist/pin-input/root/pin-input-root.d.ts +98 -121
- package/dist/pin-input/root/pin-input-root.js +151 -156
- 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 +31 -9
- package/dist/qr-code/root/qr-code-root.js +29 -17
- 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/measures.d.ts +22 -0
- package/dist/scatter-chart/measures.js +11 -0
- package/dist/scatter-chart/root/scatter-chart-root.d.ts +26 -0
- package/dist/scatter-chart/root/scatter-chart-root.js +21 -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 +115 -11
- package/dist/select/root/select-root.js +104 -20
- 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/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 +27 -2
- package/dist/speed-dial/item/speed-dial-item.js +43 -5
- 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 +86 -1
- package/dist/speed-dial/root/speed-dial-root.js +123 -6
- package/dist/splitter/root/splitter-root.d.ts +9 -2
- package/dist/splitter/root/splitter-root.js +18 -3
- 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/cell/table-cell.d.ts +8 -1
- package/dist/table/cell/table-cell.js +6 -2
- package/dist/table/column/table-column.d.ts +6 -0
- package/dist/table/column/table-column.js +5 -1
- package/dist/table/grid-controller.d.ts +117 -0
- package/dist/table/grid-controller.js +293 -0
- package/dist/table/root/table-root.d.ts +47 -3
- package/dist/table/root/table-root.js +93 -29
- package/dist/table/row/table-row.d.ts +36 -0
- package/dist/table/row/table-row.js +52 -2
- 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 +23 -20
- 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 +12 -14
- package/dist/time-picker/root/time-picker-root.js +18 -23
- package/dist/toast/item/toast-item.d.ts +9 -6
- package/dist/toast/item/toast-item.js +1 -1
- package/dist/toast/root/toast-root.d.ts +40 -4
- package/dist/toast/root/toast-root.js +68 -16
- 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 -43
- package/dist/toggle/root/toggle-root.js +2 -4
- package/dist/toolbar/root/toolbar-root.d.ts +52 -5
- package/dist/toolbar/root/toolbar-root.js +88 -13
- package/dist/tooltip/root/tooltip-root.d.ts +7 -1
- package/dist/tooltip/root/tooltip-root.js +10 -2
- 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 +16 -1
- package/dist/video/root/video-root.js +15 -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 +53 -41
- package/lint.json +1 -1
- package/package.json +5 -5
- package/types/jsx.d.ts +4934 -954
- package/types/svelte.d.ts +2 -0
- package/types/vue.d.ts +946 -253
- 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
- package/dist/tooltip/focus-target.d.ts +0 -6
- package/dist/tooltip/focus-target.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, gridMove, HelixActivateEvent, HelixElement, HelixExpandEvent, HelixFilterEvent, HelixFilteredEvent, HelixLoadMoreEvent, HelixNavigateEvent, HelixReorderEvent, HelixReorderedEvent, HelixSelectEvent, HelixSelectedEvent, HelixSortEvent, HelixSortedEvent, hostAria, inlineStep, inRowOrder, isRtl, MixinCollection, markRegion, onAndroid, ordered, pageRows, parse, rangeAdd, reportRuntime, requestChange, scrollRoom, 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]',
|
|
@@ -165,9 +165,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
165
165
|
return;
|
|
166
166
|
}
|
|
167
167
|
const last = this.drawnPage.length - 1 + (this.moreDrawn ? 1 : 0);
|
|
168
|
-
|
|
169
|
-
const control = event.ctrlKey || event.metaKey;
|
|
170
|
-
if (control && !event.shiftKey && event.key.toLowerCase() === 'a' && this.selectable) {
|
|
168
|
+
if (!event.shiftKey && selectsAll(event) && this.selectable) {
|
|
171
169
|
event.preventDefault();
|
|
172
170
|
this.requestSelected(new Set([...this.chosen, ...this.everyKey]));
|
|
173
171
|
return;
|
|
@@ -180,43 +178,22 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
180
178
|
}
|
|
181
179
|
return;
|
|
182
180
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
break;
|
|
198
|
-
case 'Home':
|
|
199
|
-
row = control ? -1 : row;
|
|
200
|
-
column = 0;
|
|
201
|
-
break;
|
|
202
|
-
case 'End':
|
|
203
|
-
row = control ? Math.max(row, last) : row;
|
|
204
|
-
column = edge;
|
|
205
|
-
break;
|
|
206
|
-
case 'PageUp':
|
|
207
|
-
row = Math.max(-1, row - this.pageStep(place.cell));
|
|
208
|
-
break;
|
|
209
|
-
case 'PageDown':
|
|
210
|
-
row = Math.min(last, row + this.pageStep(place.cell));
|
|
211
|
-
break;
|
|
212
|
-
case 'Enter':
|
|
213
|
-
case ' ':
|
|
214
|
-
case 'F2':
|
|
215
|
-
this.activate(event, place);
|
|
216
|
-
return;
|
|
217
|
-
default:
|
|
218
|
-
return;
|
|
181
|
+
if (event.key === 'Enter' || event.key === ' ' || event.key === 'F2') {
|
|
182
|
+
this.activate(event, place);
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
if ((event.key === 'ArrowLeft' || event.key === 'ArrowRight') && this.treeKey(event, place)) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
const to = gridMove(event.key, place, { last, top: -1, width: this.width }, {
|
|
189
|
+
control: event.ctrlKey || event.metaKey,
|
|
190
|
+
page: event.key.startsWith('Page') ? this.pageStep(place.cell) : 1,
|
|
191
|
+
step: inlineStep(this, event.key),
|
|
192
|
+
});
|
|
193
|
+
if (!to) {
|
|
194
|
+
return;
|
|
219
195
|
}
|
|
196
|
+
const { column, row } = to;
|
|
220
197
|
event.preventDefault();
|
|
221
198
|
if (event.shiftKey &&
|
|
222
199
|
this.selectable &&
|
|
@@ -887,6 +864,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
887
864
|
const stop = this.currentRow(this.drawnPage) === -1 ? this.currentColumn : -1;
|
|
888
865
|
const offset = this.selectable ? 1 : 0;
|
|
889
866
|
const shown = this.shownColumns;
|
|
867
|
+
const android = onAndroid();
|
|
890
868
|
for (const column of this.tableColumns) {
|
|
891
869
|
column.movable = this.reorderable && column.field !== '';
|
|
892
870
|
column.gridCell = true;
|
|
@@ -897,6 +875,13 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
897
875
|
? 'ascending'
|
|
898
876
|
: 'descending'
|
|
899
877
|
: undefined;
|
|
878
|
+
column.sortWords =
|
|
879
|
+
android && column.sorted
|
|
880
|
+
? fillTemplate(this.sortedLabel, {
|
|
881
|
+
column: column.textContent?.trim() || column.field,
|
|
882
|
+
order: column.sorted === 'ascending' ? this.ascendingLabel : this.descendingLabel,
|
|
883
|
+
})
|
|
884
|
+
: '';
|
|
900
885
|
}
|
|
901
886
|
}
|
|
902
887
|
renderCell(column, row, picked, place, stop, header) {
|
|
@@ -1013,15 +998,13 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
1013
998
|
: html `<div part="after" role="presentation" style="block-size: ${after}px"></div>`;
|
|
1014
999
|
}
|
|
1015
1000
|
renderSelectAll(stop) {
|
|
1016
|
-
const
|
|
1017
|
-
const keys = this.chosen;
|
|
1018
|
-
const count = every.filter((key) => keys.has(key)).length;
|
|
1001
|
+
const { checked, indeterminate } = everyState(this.chosen, this.everyKey);
|
|
1019
1002
|
return html `<span
|
|
1020
1003
|
part="select-all"
|
|
1021
1004
|
role="columnheader"
|
|
1022
1005
|
tabindex=${stop ? '0' : '-1'}
|
|
1023
1006
|
data-column="0"
|
|
1024
|
-
>${this.renderCheckbox(this.selectAllLabel,
|
|
1007
|
+
>${this.renderCheckbox(this.selectAllLabel, checked, indeterminate, this.toggleAll)}</span>`;
|
|
1025
1008
|
}
|
|
1026
1009
|
renderMore(page) {
|
|
1027
1010
|
if (!this.moreDrawn) {
|
|
@@ -1198,11 +1181,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
|
|
|
1198
1181
|
this.focusWanted = true;
|
|
1199
1182
|
}
|
|
1200
1183
|
pageStep(cell) {
|
|
1201
|
-
|
|
1202
|
-
const tall = cell.getBoundingClientRect().height || this.estimate;
|
|
1203
|
-
const scrolls = box !== null && box.scrollHeight > box.clientHeight + 1;
|
|
1204
|
-
const room = scrolls ? box.clientHeight - this.headHeight() : window.innerHeight;
|
|
1205
|
-
return Math.max(1, Math.floor(room / tall) - 1);
|
|
1184
|
+
return pageRows(scrollRoom(this.partNamed('table'), { covered: this.headHeight() }), cell.getBoundingClientRect().height || this.estimate);
|
|
1206
1185
|
}
|
|
1207
1186
|
headHeight() {
|
|
1208
1187
|
return this.cellAt(-1, 0)?.getBoundingClientRect().height ?? 0;
|
|
@@ -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,17 +16,28 @@ 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
|
*
|
|
36
|
+
* @csspart actions - The box after the value inside its `<dd>`, holding the `actions` slot.
|
|
28
37
|
* @csspart label - The `<dt>`, holding the label.
|
|
29
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.
|
|
30
41
|
*/
|
|
31
42
|
export declare class HelixHeadlessDescriptionListItem extends HelixElement {
|
|
32
43
|
/**
|
|
@@ -37,13 +48,20 @@ export declare class HelixHeadlessDescriptionListItem extends HelixElement {
|
|
|
37
48
|
* that varies and is often more than text.
|
|
38
49
|
*/
|
|
39
50
|
label: string;
|
|
51
|
+
/**
|
|
52
|
+
* Says the values are several `<dd>` elements of your own, so the item
|
|
53
|
+
* draws no `<dd>` of its own around them, on the server too. Without it the
|
|
54
|
+
* item finds them once it runs, and the served markup wraps them until then.
|
|
55
|
+
*/
|
|
56
|
+
several: boolean;
|
|
40
57
|
/**
|
|
41
58
|
* Whether the values are the consumer's own `<dd>` elements, which the item
|
|
42
|
-
* then does not wrap
|
|
43
|
-
*
|
|
59
|
+
* then does not wrap: `several`, or `<dd>` children found once it runs.
|
|
60
|
+
* Unknown on a server and while hydrating, where `several` decides.
|
|
44
61
|
*/
|
|
45
|
-
private get
|
|
62
|
+
private get ownValues();
|
|
46
63
|
protected firstUpdated(changed: PropertyValues): void;
|
|
64
|
+
protected updated(changed: PropertyValues): void;
|
|
47
65
|
protected render(): TemplateResult;
|
|
48
66
|
/** A value arriving or leaving can change whether the item wraps them. */
|
|
49
67
|
private readonly handleSlotChange;
|
|
@@ -11,28 +11,38 @@ 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);
|
|
23
24
|
this.finishHydration();
|
|
24
25
|
}
|
|
26
|
+
updated(changed) {
|
|
27
|
+
super.updated(changed);
|
|
28
|
+
this.toggleState('several', this.ownValues);
|
|
29
|
+
}
|
|
25
30
|
render() {
|
|
26
31
|
const label = html `<dt part="label"><slot name="label">${this.label}</slot></dt>`;
|
|
27
|
-
return this.
|
|
32
|
+
return this.ownValues
|
|
28
33
|
? html `${label}<slot @slotchange=${this.handleSlotChange}></slot>`
|
|
29
34
|
: html `${label}
|
|
30
|
-
<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>`;
|
|
31
38
|
}
|
|
32
39
|
};
|
|
33
40
|
__decorate([
|
|
34
41
|
property()
|
|
35
42
|
], HelixHeadlessDescriptionListItem.prototype, "label", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
property({ type: Boolean })
|
|
45
|
+
], HelixHeadlessDescriptionListItem.prototype, "several", void 0);
|
|
36
46
|
HelixHeadlessDescriptionListItem = __decorate([
|
|
37
47
|
customElement('helix-headless-description-list-item')
|
|
38
48
|
], HelixHeadlessDescriptionListItem);
|
|
@@ -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
|
}
|