@fusion.dev/helix-headless 0.143.0 → 0.145.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +16990 -1383
- package/dist/accordion/item/accordion-item.d.ts +48 -12
- package/dist/accordion/item/accordion-item.js +26 -5
- package/dist/accordion/root/accordion-root.d.ts +6 -0
- package/dist/accordion/root/accordion-root.js +7 -1
- package/dist/announcement/root/announcement-root.d.ts +21 -1
- package/dist/announcement/root/announcement-root.js +36 -1
- package/dist/app-header/root/app-header-root.d.ts +7 -0
- package/dist/app-header/root/app-header-root.js +5 -1
- package/dist/app-header/sectioning.d.ts +7 -0
- package/dist/app-header/sectioning.js +26 -0
- package/dist/area-chart/root/area-chart-root.d.ts +12 -4
- package/dist/area-chart/root/area-chart-root.js +24 -7
- package/dist/avatar/root/avatar-root.d.ts +14 -0
- package/dist/avatar/root/avatar-root.js +23 -9
- package/dist/badge/root/badge-root.d.ts +11 -7
- package/dist/badge/root/badge-root.js +1 -1
- package/dist/bar-chart/root/bar-chart-root.d.ts +12 -3
- package/dist/bar-chart/root/bar-chart-root.js +17 -10
- package/dist/breadcrumbs/root/breadcrumbs-root.d.ts +32 -1
- package/dist/breadcrumbs/root/breadcrumbs-root.js +25 -2
- package/dist/button/root/button-root.d.ts +47 -1
- package/dist/button/root/button-root.js +38 -4
- package/dist/callout/root/callout-root.d.ts +18 -1
- package/dist/callout/root/callout-root.js +15 -4
- package/dist/canvas/root/canvas-root.d.ts +38 -3
- package/dist/canvas/root/canvas-root.js +121 -40
- package/dist/card/root/card-root.d.ts +30 -1
- package/dist/card/root/card-root.js +38 -5
- package/dist/carousel/root/carousel-root.d.ts +90 -0
- package/dist/carousel/root/carousel-root.js +134 -12
- package/dist/chat/composer/chat-composer.d.ts +38 -6
- package/dist/chat/composer/chat-composer.js +42 -9
- package/dist/chat/message/chat-message.d.ts +32 -1
- package/dist/chat/message/chat-message.js +25 -9
- package/dist/chat/naming.d.ts +22 -0
- package/dist/chat/naming.js +12 -0
- package/dist/chat/relative-clock.d.ts +39 -0
- package/dist/chat/relative-clock.js +31 -0
- package/dist/chat/root/chat-root.d.ts +36 -0
- package/dist/chat/root/chat-root.js +24 -1
- package/dist/checkbox/root/checkbox-root.js +2 -0
- package/dist/checkbox-group/root/checkbox-group-root.d.ts +53 -3
- package/dist/checkbox-group/root/checkbox-group-root.js +71 -22
- package/dist/code-block/lines.d.ts +13 -0
- package/dist/code-block/lines.js +2 -0
- package/dist/code-block/root/code-block-root.d.ts +38 -1
- package/dist/code-block/root/code-block-root.js +28 -7
- package/dist/color-input/root/color-input-root.d.ts +34 -1
- package/dist/color-input/root/color-input-root.js +23 -4
- package/dist/color-picker/channels.d.ts +26 -0
- package/dist/color-picker/channels.js +84 -0
- package/dist/color-picker/root/color-picker-root.d.ts +81 -5
- package/dist/color-picker/root/color-picker-root.js +103 -10
- package/dist/combobox/root/combobox-root.d.ts +38 -3
- package/dist/combobox/root/combobox-root.js +64 -2
- package/dist/command/root/command-root.d.ts +30 -4
- package/dist/command/root/command-root.js +33 -3
- package/dist/copy-button/from.d.ts +22 -0
- package/dist/copy-button/from.js +28 -0
- package/dist/copy-button/root/copy-button-root.d.ts +47 -1
- package/dist/copy-button/root/copy-button-root.js +44 -8
- package/dist/data-table/root/data-table-root.d.ts +150 -2
- package/dist/data-table/root/data-table-root.js +303 -29
- package/dist/data-table/tree.d.ts +40 -0
- package/dist/data-table/tree.js +55 -0
- package/dist/date-input/root/date-input-root.d.ts +73 -4
- package/dist/date-input/root/date-input-root.js +93 -43
- package/dist/date-picker/root/date-picker-root.d.ts +145 -1
- package/dist/date-picker/root/date-picker-root.js +239 -48
- package/dist/description-list/item/description-list-item.d.ts +17 -2
- package/dist/description-list/item/description-list-item.js +15 -2
- package/dist/description-list/root/description-list-root.d.ts +27 -1
- package/dist/description-list/root/description-list-root.js +26 -1
- package/dist/dialog/description.d.ts +9 -0
- package/dist/dialog/description.js +14 -0
- package/dist/dialog/root/dialog-root.d.ts +64 -1
- package/dist/dialog/root/dialog-root.js +49 -23
- package/dist/donut-chart/root/donut-chart-root.d.ts +25 -4
- package/dist/donut-chart/root/donut-chart-root.js +21 -6
- package/dist/drawer/root/drawer-root.d.ts +63 -2
- package/dist/drawer/root/drawer-root.js +95 -19
- package/dist/drawer/swipe-start.d.ts +9 -0
- package/dist/drawer/swipe-start.js +12 -0
- package/dist/drilldown/item/drilldown-item.d.ts +11 -6
- package/dist/drilldown/item/drilldown-item.js +8 -5
- package/dist/drilldown/root/drilldown-root.d.ts +11 -0
- package/dist/drilldown/root/drilldown-root.js +8 -3
- package/dist/element-events.generated.js +61 -13
- package/dist/empty/root/empty-root.d.ts +1 -1
- package/dist/file-input/root/file-input-root.d.ts +47 -0
- package/dist/file-input/root/file-input-root.js +60 -22
- package/dist/file-input/screen.d.ts +35 -0
- package/dist/file-input/screen.js +49 -0
- package/dist/filter-input/menu/filter-menu.d.ts +3 -0
- package/dist/filter-input/menu/filter-menu.js +8 -4
- package/dist/filter-input/root/filter-input-root.d.ts +38 -4
- package/dist/filter-input/root/filter-input-root.js +67 -3
- package/dist/filter-input/suggest.d.ts +17 -0
- package/dist/filter-input/suggest.js +23 -0
- package/dist/format-date/options.d.ts +33 -0
- package/dist/format-date/options.js +42 -0
- package/dist/format-date/root/format-date-root.d.ts +51 -0
- package/dist/format-date/root/format-date-root.js +58 -38
- package/dist/heatmap/root/heatmap-root.d.ts +23 -6
- package/dist/heatmap/root/heatmap-root.js +24 -13
- package/dist/icon/index.d.ts +2 -0
- package/dist/icon/index.js +2 -0
- package/dist/icon/registry.d.ts +37 -0
- package/dist/icon/registry.js +83 -0
- package/dist/icon/root/icon-root.d.ts +30 -4
- package/dist/icon/root/icon-root.js +41 -6
- package/dist/icon/root/index.d.ts +2 -0
- package/dist/icon/root/index.js +2 -0
- package/dist/icon/set.d.ts +1 -0
- package/dist/icon/set.js +3 -0
- package/dist/image/root/image-root.d.ts +14 -0
- package/dist/image/root/image-root.js +23 -2
- package/dist/input/root/input-root.d.ts +11 -0
- package/dist/input/root/input-root.js +16 -1
- package/dist/kbd/root/kbd-root.d.ts +20 -13
- package/dist/kbd/root/kbd-root.js +35 -37
- package/dist/kbd/shortcut.d.ts +18 -0
- package/dist/kbd/shortcut.js +35 -0
- package/dist/legend/hidden-series.d.ts +8 -0
- package/dist/legend/hidden-series.js +13 -0
- package/dist/legend/root/legend-root.d.ts +56 -0
- package/dist/legend/root/legend-root.js +54 -5
- package/dist/lightbox/item/lightbox-item.d.ts +15 -0
- package/dist/lightbox/item/lightbox-item.js +10 -1
- package/dist/lightbox/root/lightbox-root.d.ts +61 -1
- package/dist/lightbox/root/lightbox-root.js +94 -4
- package/dist/line-chart/root/line-chart-root.d.ts +11 -3
- package/dist/line-chart/root/line-chart-root.js +19 -5
- package/dist/list/item/list-item.d.ts +68 -1
- package/dist/list/item/list-item.js +66 -4
- package/dist/list/numbering.d.ts +14 -0
- package/dist/list/numbering.js +8 -0
- package/dist/list/root/list-root.d.ts +106 -9
- package/dist/list/root/list-root.js +189 -4
- package/dist/list/selection.d.ts +19 -0
- package/dist/list/selection.js +21 -0
- package/dist/listbox/root/listbox-root.d.ts +74 -3
- package/dist/listbox/root/listbox-root.js +86 -9
- package/dist/loader/busy.d.ts +17 -0
- package/dist/loader/busy.js +24 -0
- package/dist/loader/root/loader-root.d.ts +37 -0
- package/dist/loader/root/loader-root.js +52 -3
- package/dist/map/root/map-root.d.ts +6 -2
- package/dist/map/root/map-root.js +5 -2
- package/dist/megamenu/root/megamenu-root.d.ts +21 -0
- package/dist/megamenu/root/megamenu-root.js +16 -2
- package/dist/menu/index.d.ts +1 -0
- package/dist/menu/index.js +1 -0
- package/dist/menu/item/menu-item.d.ts +38 -11
- package/dist/menu/item/menu-item.js +33 -1
- package/dist/menu/root/menu-root.d.ts +25 -1
- package/dist/menu/root/menu-root.js +63 -6
- package/dist/menu/section/menu-section.d.ts +55 -0
- package/dist/menu/section/menu-section.js +60 -0
- package/dist/meter/root/meter-root.d.ts +7 -0
- package/dist/meter/root/meter-root.js +6 -3
- package/dist/navigation/root/navigation-root.d.ts +16 -1
- package/dist/navigation/root/navigation-root.js +27 -1
- package/dist/notifications/feed-keys.d.ts +10 -0
- package/dist/notifications/feed-keys.js +14 -0
- package/dist/notifications/notification/notification.d.ts +17 -0
- package/dist/notifications/notification/notification.js +21 -2
- package/dist/notifications/root/notifications-root.d.ts +60 -0
- package/dist/notifications/root/notifications-root.js +76 -1
- package/dist/number-input/root/number-input-root.d.ts +47 -0
- package/dist/number-input/root/number-input-root.js +58 -22
- package/dist/object-inspector/root/object-inspector-root.d.ts +98 -16
- package/dist/object-inspector/root/object-inspector-root.js +180 -80
- package/dist/object-inspector/rows.d.ts +57 -0
- package/dist/object-inspector/rows.js +86 -0
- package/dist/option/root/option-root.d.ts +54 -5
- package/dist/option/root/option-root.js +34 -5
- package/dist/outline/levels.d.ts +31 -0
- package/dist/outline/levels.js +23 -0
- package/dist/outline/root/outline-root.d.ts +68 -3
- package/dist/outline/root/outline-root.js +73 -8
- package/dist/pagination/size/pagination-size.d.ts +11 -2
- package/dist/pagination/size/pagination-size.js +19 -4
- package/dist/pin-input/format.d.ts +7 -0
- package/dist/pin-input/format.js +16 -0
- package/dist/pin-input/root/pin-input-root.d.ts +21 -0
- package/dist/pin-input/root/pin-input-root.js +29 -2
- package/dist/popover/root/popover-root.d.ts +62 -4
- package/dist/popover/root/popover-root.js +53 -5
- package/dist/progress/root/progress-root.d.ts +7 -0
- package/dist/progress/root/progress-root.js +9 -3
- package/dist/qr-code/export.d.ts +31 -0
- package/dist/qr-code/export.js +10 -0
- package/dist/qr-code/root/qr-code-root.d.ts +26 -0
- package/dist/qr-code/root/qr-code-root.js +49 -2
- package/dist/radio/group/radio-group.d.ts +17 -0
- package/dist/radio/group/radio-group.js +14 -1
- package/dist/rating/root/rating-root.d.ts +25 -0
- package/dist/rating/root/rating-root.js +46 -4
- package/dist/scatter-chart/root/scatter-chart-root.d.ts +17 -3
- package/dist/scatter-chart/root/scatter-chart-root.js +25 -7
- package/dist/scroll-area/root/scroll-area-root.d.ts +113 -0
- package/dist/scroll-area/root/scroll-area-root.js +218 -3
- package/dist/scroll-area/scrollbar.d.ts +65 -0
- package/dist/scroll-area/scrollbar.js +24 -0
- package/dist/select/root/select-root.d.ts +24 -0
- package/dist/select/root/select-root.js +21 -7
- package/dist/skeleton/root/skeleton-root.d.ts +25 -0
- package/dist/skeleton/root/skeleton-root.js +17 -2
- package/dist/slider/root/slider-root.d.ts +39 -0
- package/dist/slider/root/slider-root.js +45 -9
- package/dist/splitter/root/splitter-root.d.ts +13 -0
- package/dist/splitter/root/splitter-root.js +20 -2
- package/dist/splitter/snap.d.ts +9 -0
- package/dist/splitter/snap.js +12 -0
- package/dist/stat/root/stat-root.d.ts +2 -0
- package/dist/stat/root/stat-root.js +1 -1
- package/dist/steps/reach.d.ts +15 -0
- package/dist/steps/reach.js +12 -0
- package/dist/steps/root/steps-root.d.ts +30 -0
- package/dist/steps/root/steps-root.js +53 -0
- package/dist/steps/step/step.d.ts +39 -2
- package/dist/steps/step/step.js +29 -7
- package/dist/switch/root/switch-root.d.ts +12 -2
- package/dist/switch/root/switch-root.js +6 -1
- package/dist/table/column/table-column.d.ts +11 -0
- package/dist/table/column/table-column.js +6 -1
- package/dist/table/root/table-root.d.ts +101 -0
- package/dist/table/root/table-root.js +166 -5
- package/dist/table/row/table-row.d.ts +47 -1
- package/dist/table/row/table-row.js +39 -2
- package/dist/tabs/panel/tab-panel.d.ts +9 -5
- package/dist/tabs/panel/tab-panel.js +3 -4
- package/dist/tabs/root/tabs-root.d.ts +25 -1
- package/dist/tabs/root/tabs-root.js +21 -3
- package/dist/tabs/tab/tab.d.ts +36 -4
- package/dist/tabs/tab/tab.js +46 -3
- package/dist/tag/group/tag-group.d.ts +107 -0
- package/dist/tag/group/tag-group.js +157 -0
- package/dist/tag/index.d.ts +1 -0
- package/dist/tag/index.js +1 -0
- package/dist/tag/root/tag-root.d.ts +60 -0
- package/dist/tag/root/tag-root.js +74 -18
- package/dist/tag/selection.d.ts +10 -0
- package/dist/tag/selection.js +12 -0
- package/dist/textarea/grow.d.ts +22 -0
- package/dist/textarea/grow.js +20 -0
- package/dist/textarea/root/textarea-root.d.ts +9 -0
- package/dist/textarea/root/textarea-root.js +9 -1
- package/dist/time-input/root/time-input-root.d.ts +44 -5
- package/dist/time-input/root/time-input-root.js +69 -39
- package/dist/time-picker/root/time-picker-root.d.ts +54 -8
- package/dist/time-picker/root/time-picker-root.js +121 -91
- package/dist/timeline/group/timeline-group.d.ts +46 -0
- package/dist/timeline/group/timeline-group.js +37 -0
- package/dist/timeline/index.d.ts +1 -0
- package/dist/timeline/index.js +1 -0
- package/dist/timeline/root/timeline-root.d.ts +10 -3
- package/dist/toast/hotkey.d.ts +22 -0
- package/dist/toast/hotkey.js +23 -0
- package/dist/toast/item/toast-item.d.ts +26 -18
- package/dist/toast/item/toast-item.js +55 -48
- package/dist/toast/root/toast-root.d.ts +42 -8
- package/dist/toast/root/toast-root.js +64 -4
- package/dist/toggle/group/toggle-group.d.ts +57 -15
- package/dist/toggle/group/toggle-group.js +69 -9
- package/dist/toggle/root/toggle-root.d.ts +12 -1
- package/dist/toggle/root/toggle-root.js +11 -3
- package/dist/toolbar/root/toolbar-root.d.ts +13 -0
- package/dist/toolbar/root/toolbar-root.js +15 -5
- package/dist/tooltip/focus-target.d.ts +6 -0
- package/dist/tooltip/focus-target.js +9 -0
- package/dist/tooltip/root/tooltip-root.d.ts +42 -17
- package/dist/tooltip/root/tooltip-root.js +50 -9
- package/dist/tour/naming.d.ts +30 -0
- package/dist/tour/naming.js +10 -0
- package/dist/tour/root/tour-root.d.ts +35 -0
- package/dist/tour/root/tour-root.js +56 -5
- package/dist/tour/stop/tour-stop.d.ts +53 -8
- package/dist/tour/stop/tour-stop.js +45 -15
- package/dist/tour/wait.d.ts +11 -0
- package/dist/tour/wait.js +19 -0
- package/dist/tree/item/tree-item.d.ts +54 -1
- package/dist/tree/item/tree-item.js +89 -20
- package/dist/tree/root/tree-root.d.ts +37 -0
- package/dist/tree/root/tree-root.js +51 -6
- package/dist/tree/selection.d.ts +24 -0
- package/dist/tree/selection.js +26 -0
- package/dist/trend/root/trend-root.d.ts +13 -0
- package/dist/trend/root/trend-root.js +14 -9
- package/dist/video/media-events.d.ts +49 -0
- package/dist/video/media-events.js +39 -0
- package/dist/video/root/video-root.d.ts +99 -13
- package/dist/video/root/video-root.js +84 -47
- package/dist/video-playlist/menu/video-playlist-menu.d.ts +3 -0
- package/dist/video-playlist/menu/video-playlist-menu.js +2 -1
- package/dist/video-playlist/order.d.ts +41 -0
- package/dist/video-playlist/order.js +34 -0
- package/dist/video-playlist/root/video-playlist-root.d.ts +70 -2
- package/dist/video-playlist/root/video-playlist-root.js +60 -16
- package/dist/virtual-list/controls.d.ts +4 -0
- package/dist/virtual-list/controls.js +30 -0
- package/dist/virtual-list/fill.d.ts +30 -0
- package/dist/virtual-list/fill.js +39 -0
- package/dist/virtual-list/keys.d.ts +15 -0
- package/dist/virtual-list/keys.js +24 -0
- package/dist/virtual-list/root/virtual-list-root.d.ts +155 -23
- package/dist/virtual-list/root/virtual-list-root.js +175 -34
- package/lint.json +1 -1
- package/package.json +5 -5
- package/types/jsx.d.ts +8871 -1286
- package/types/svelte.d.ts +3 -0
- package/types/vue.d.ts +1918 -269
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HelixFormElement } from '@fusion.dev/helix-core';
|
|
1
|
+
import { type CalendarView, HelixFormElement } from '@fusion.dev/helix-core';
|
|
2
2
|
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
3
3
|
declare const HelixHeadlessDatePicker_base: (new (...args: any[]) => import("@fusion.dev/helix-core").MixinControllerValueInterface) & typeof HelixFormElement;
|
|
4
4
|
/**
|
|
@@ -23,6 +23,14 @@ declare const HelixHeadlessDatePicker_base: (new (...args: any[]) => import("@fu
|
|
|
23
23
|
* marks the dates between them, and `multiple` toggles each date. All three
|
|
24
24
|
* read and write the same comma-separated `value`.
|
|
25
25
|
*
|
|
26
|
+
* `max-view` makes the heading a button that steps back to the months of the
|
|
27
|
+
* year, and with `year` to a page of years, as Zag's date picker does. The
|
|
28
|
+
* arrows, Home, End and the page keys move there, Enter or a press chooses, and
|
|
29
|
+
* Escape goes back to the days.
|
|
30
|
+
*
|
|
31
|
+
* `isDateUnavailable` and `dayContent` are properties for a script: a rule
|
|
32
|
+
* that bars dates, and what each day shows in place of its number.
|
|
33
|
+
*
|
|
26
34
|
* The month heading is a live region, so a screen reader hears the new month
|
|
27
35
|
* when Previous or Next is pressed. Neither moves past `min` or `max`, and the
|
|
28
36
|
* keys stop at them too. A value outside the bounds, on a barred day, or off
|
|
@@ -55,10 +63,17 @@ declare const HelixHeadlessDatePicker_base: (new (...args: any[]) => import("@fu
|
|
|
55
63
|
* @csspart grid - The grid of days.
|
|
56
64
|
* @csspart header - The month name and its controls.
|
|
57
65
|
* @csspart heading - The month and year being shown.
|
|
66
|
+
* @csspart heading-button - The heading as a button that shows the months or the years, where `max-view` is set.
|
|
58
67
|
* @csspart month - One month, its header and its grid.
|
|
59
68
|
* @csspart months - The run of months.
|
|
60
69
|
* @csspart next - The control that moves to the next month.
|
|
61
70
|
* @csspart next-mark - The glyph on the next month control, where none is slotted.
|
|
71
|
+
* @csspart period - One month in the months view, or one year in the years view.
|
|
72
|
+
* @csspart period-current - This month or this year, beside `period`.
|
|
73
|
+
* @csspart period-disabled - A month or a year wholly outside `min` and `max`, beside `period`.
|
|
74
|
+
* @csspart period-row - One row of three months or years.
|
|
75
|
+
* @csspart period-selected - The month or the year on show, beside `period`.
|
|
76
|
+
* @csspart periods - The grid of months or years.
|
|
62
77
|
* @csspart previous - The control that moves to the previous month.
|
|
63
78
|
* @csspart previous-mark - The glyph on the previous month control, where none is slotted.
|
|
64
79
|
* @csspart week - One row of days.
|
|
@@ -75,6 +90,18 @@ export declare class HelixHeadlessDatePicker extends HelixHeadlessDatePicker_bas
|
|
|
75
90
|
* speaks it. Absent is the control's own sentence, in English.
|
|
76
91
|
*/
|
|
77
92
|
badInputMessage?: string;
|
|
93
|
+
/**
|
|
94
|
+
* What each day shows, in place of its number: a function given the date as
|
|
95
|
+
* `YYYY-MM-DD` that returns text, an element or a Lit template.
|
|
96
|
+
*
|
|
97
|
+
* For a price or a dot under the number, as React Aria's `CalendarCell`
|
|
98
|
+
* takes children. The cell is still named by its whole date, so what you
|
|
99
|
+
* draw here is for the eye; say anything a reader must hear in the date's
|
|
100
|
+
* description elsewhere. Return the day's number with it where it should
|
|
101
|
+
* still show. A property only, there being no way to write a function in
|
|
102
|
+
* markup.
|
|
103
|
+
*/
|
|
104
|
+
dayContent?: ((date: string) => unknown) | undefined;
|
|
78
105
|
/**
|
|
79
106
|
* The month to open on when `month` is not set.
|
|
80
107
|
*/
|
|
@@ -100,6 +127,16 @@ export declare class HelixHeadlessDatePicker extends HelixHeadlessDatePicker_bas
|
|
|
100
127
|
* Whether the current selection fails validation.
|
|
101
128
|
*/
|
|
102
129
|
invalid: boolean;
|
|
130
|
+
/**
|
|
131
|
+
* A rule for which dates cannot be chosen: a function given the date as
|
|
132
|
+
* `YYYY-MM-DD` that returns `true` to bar it.
|
|
133
|
+
*
|
|
134
|
+
* For what a list cannot say, such as the second Tuesday of each month or
|
|
135
|
+
* the days a server has fully booked. It bars a date as `disable-dates`
|
|
136
|
+
* does, in the grid and in validation. A property only, as React Aria's
|
|
137
|
+
* `isDateUnavailable` is a prop.
|
|
138
|
+
*/
|
|
139
|
+
isDateUnavailable?: ((date: string) => boolean) | undefined;
|
|
103
140
|
/**
|
|
104
141
|
* Accessible name for the grid.
|
|
105
142
|
*/
|
|
@@ -114,6 +151,17 @@ export declare class HelixHeadlessDatePicker extends HelixHeadlessDatePicker_bas
|
|
|
114
151
|
* Latest selectable date, as `YYYY-MM-DD`.
|
|
115
152
|
*/
|
|
116
153
|
max: string;
|
|
154
|
+
/**
|
|
155
|
+
* How far the heading lets a reader step back from the days: `month` to a
|
|
156
|
+
* year's months, or `year` to a page of years and then its months.
|
|
157
|
+
*
|
|
158
|
+
* Absent, the heading is text and the calendar moves a month at a time. Set,
|
|
159
|
+
* the heading is a button that shows the months, and from there the years,
|
|
160
|
+
* so a birth date forty years back is three presses rather than four hundred
|
|
161
|
+
* and eighty. Choosing a year shows its months, and choosing a month shows
|
|
162
|
+
* its days.
|
|
163
|
+
*/
|
|
164
|
+
maxView?: 'month' | 'year';
|
|
117
165
|
/**
|
|
118
166
|
* Earliest selectable date, as `YYYY-MM-DD`.
|
|
119
167
|
*/
|
|
@@ -138,10 +186,23 @@ export declare class HelixHeadlessDatePicker extends HelixHeadlessDatePicker_bas
|
|
|
138
186
|
* How many months to show, side by side.
|
|
139
187
|
*/
|
|
140
188
|
months: number;
|
|
189
|
+
/**
|
|
190
|
+
* The name of the heading where it shows the months, with `{heading}`
|
|
191
|
+
* filled in as the month on show.
|
|
192
|
+
*/
|
|
193
|
+
monthViewLabel: string;
|
|
141
194
|
/**
|
|
142
195
|
* Accessible name for the control that pages forward.
|
|
143
196
|
*/
|
|
144
197
|
nextLabel: string;
|
|
198
|
+
/**
|
|
199
|
+
* Accessible name for the control that moves forward a year, in the months.
|
|
200
|
+
*/
|
|
201
|
+
nextYearLabel: string;
|
|
202
|
+
/**
|
|
203
|
+
* Accessible name for the control that moves forward a page, in the years.
|
|
204
|
+
*/
|
|
205
|
+
nextYearsLabel: string;
|
|
145
206
|
/**
|
|
146
207
|
* Accessible name for the control that pages back.
|
|
147
208
|
*
|
|
@@ -151,6 +212,14 @@ export declare class HelixHeadlessDatePicker extends HelixHeadlessDatePicker_bas
|
|
|
151
212
|
* it.
|
|
152
213
|
*/
|
|
153
214
|
previousLabel: string;
|
|
215
|
+
/**
|
|
216
|
+
* Accessible name for the control that moves back a year, in the months.
|
|
217
|
+
*/
|
|
218
|
+
previousYearLabel: string;
|
|
219
|
+
/**
|
|
220
|
+
* Accessible name for the control that moves back a page, in the years.
|
|
221
|
+
*/
|
|
222
|
+
previousYearsLabel: string;
|
|
154
223
|
/**
|
|
155
224
|
* The validation message for a date after `max`. `{max}` is replaced with
|
|
156
225
|
* `max`, written as a date in `locale`.
|
|
@@ -238,6 +307,49 @@ export declare class HelixHeadlessDatePicker extends HelixHeadlessDatePicker_bas
|
|
|
238
307
|
*/
|
|
239
308
|
private select;
|
|
240
309
|
private readonly handleKeydown;
|
|
310
|
+
/**
|
|
311
|
+
* The year the months view shows, and the year the years view is on.
|
|
312
|
+
*
|
|
313
|
+
* Its own state rather than `month`, because looking through the months of
|
|
314
|
+
* another year chooses nothing and moves nothing on show: the month changes,
|
|
315
|
+
* and `helix-navigate` is sent, only once a month is chosen.
|
|
316
|
+
*/
|
|
317
|
+
private pageYear;
|
|
318
|
+
/**
|
|
319
|
+
* Where the tab stop is among the months, as their index, or among the
|
|
320
|
+
* years, as the year.
|
|
321
|
+
*/
|
|
322
|
+
private periodFocus;
|
|
323
|
+
/** The year on show in the months and the years. */
|
|
324
|
+
private get periodYear();
|
|
325
|
+
/** The index or the year the tab stop sits on in the months or the years. */
|
|
326
|
+
private get periodStop();
|
|
327
|
+
/** Whether a month, as its first day, lies wholly outside `min` and `max`. */
|
|
328
|
+
private monthOut;
|
|
329
|
+
/** Whether a year lies wholly outside `min` and `max`. */
|
|
330
|
+
private yearOut;
|
|
331
|
+
/** Changes the view, and takes focus to its tab stop once it has drawn. */
|
|
332
|
+
private zoom;
|
|
333
|
+
/**
|
|
334
|
+
* The heading's press: from the days to the months, and from the months to
|
|
335
|
+
* the years where `max-view` allows.
|
|
336
|
+
*/
|
|
337
|
+
private readonly handleHeading;
|
|
338
|
+
/**
|
|
339
|
+
* Takes a month or a year: a year shows its months, and a month shows its
|
|
340
|
+
* days, moving the calendar there with `helix-navigate` first.
|
|
341
|
+
*/
|
|
342
|
+
private choosePeriod;
|
|
343
|
+
/** Moves the months a year, or the years a page. */
|
|
344
|
+
private turnPage;
|
|
345
|
+
/**
|
|
346
|
+
* The keys in the months and the years: the arrows, Home, End and the page
|
|
347
|
+
* keys move, Enter and Space choose, and Escape goes back to the days.
|
|
348
|
+
*
|
|
349
|
+
* Escape is stopped here, so a Date Input around this calendar keeps its
|
|
350
|
+
* panel open: a reader backing out of the years has not asked to leave.
|
|
351
|
+
*/
|
|
352
|
+
private handlePeriodKeydown;
|
|
241
353
|
/**
|
|
242
354
|
* Moves focus to the grid's tab stop: the selected day, or the day last
|
|
243
355
|
* moved to, or the first of the month.
|
|
@@ -301,6 +413,18 @@ export declare class HelixHeadlessDatePicker extends HelixHeadlessDatePicker_bas
|
|
|
301
413
|
* The validation message for a required date picker with no date chosen.
|
|
302
414
|
*/
|
|
303
415
|
valueMissingMessage?: string;
|
|
416
|
+
/**
|
|
417
|
+
* What the calendar shows: the days of a month, the months of a year, or a
|
|
418
|
+
* page of years. `day` unless `max-view` lets a reader step back.
|
|
419
|
+
*
|
|
420
|
+
* Not reflected, being state. Set it to open on the months or the years.
|
|
421
|
+
*/
|
|
422
|
+
view: CalendarView;
|
|
423
|
+
/**
|
|
424
|
+
* The name of the heading where it shows a page of years, with `{heading}`
|
|
425
|
+
* filled in as the year on show.
|
|
426
|
+
*/
|
|
427
|
+
yearViewLabel: string;
|
|
304
428
|
/** A date written for a message, in `locale`. */
|
|
305
429
|
private spoken;
|
|
306
430
|
/**
|
|
@@ -390,6 +514,26 @@ export declare class HelixHeadlessDatePicker extends HelixHeadlessDatePicker_bas
|
|
|
390
514
|
protected renderPreviousMark(): TemplateResult;
|
|
391
515
|
protected renderNextMark(): TemplateResult;
|
|
392
516
|
private renderMonth;
|
|
517
|
+
/**
|
|
518
|
+
* What a day shows: its number, or what `day-content` returns for it.
|
|
519
|
+
*
|
|
520
|
+
* A seam, so a tier above can draw a day its own way, and filler days from a
|
|
521
|
+
* neighboring month keep their number, being only there to square the grid.
|
|
522
|
+
*/
|
|
523
|
+
protected renderDay(date: Date, outside: boolean): unknown;
|
|
524
|
+
/**
|
|
525
|
+
* The heading's words, as a button that steps back to the months or the
|
|
526
|
+
* years where `max-view` allows, and as text everywhere else.
|
|
527
|
+
*/
|
|
528
|
+
private renderHeadingText;
|
|
529
|
+
/**
|
|
530
|
+
* The months of a year, or a page of years, in rows of three, with the
|
|
531
|
+
* controls that turn the page.
|
|
532
|
+
*
|
|
533
|
+
* A grid of its own, `periods`, so a stylesheet tells it from the days, and
|
|
534
|
+
* one tab stop in it, the month or year the keys are on.
|
|
535
|
+
*/
|
|
536
|
+
private renderPeriods;
|
|
393
537
|
protected render(): TemplateResult;
|
|
394
538
|
/**
|
|
395
539
|
* The value as a `Date`, at midnight UTC, or `null` while there is no date.
|
|
@@ -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 { valueAsDate as asDate, customElement, fillTemplate, dateAsValue as fromDate, HelixFormElement, HelixNavigateEvent, hostAria, inlineStep, MixinControllerValue, reportValues, requestChange,
|
|
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';
|
|
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';
|
|
@@ -21,34 +21,6 @@ const KEYS = new Set([
|
|
|
21
21
|
'PageUp',
|
|
22
22
|
' ',
|
|
23
23
|
]);
|
|
24
|
-
const localToday = () => {
|
|
25
|
-
const now = new Date();
|
|
26
|
-
const month = `${now.getMonth() + 1}`.padStart(2, '0');
|
|
27
|
-
const day = `${now.getDate()}`.padStart(2, '0');
|
|
28
|
-
return `${now.getFullYear()}-${month}-${day}`;
|
|
29
|
-
};
|
|
30
|
-
const list = (value) => value
|
|
31
|
-
.split(',')
|
|
32
|
-
.map((entry) => entry.trim())
|
|
33
|
-
.filter(Boolean);
|
|
34
|
-
const weekStartOf = (locale) => {
|
|
35
|
-
try {
|
|
36
|
-
const tag = new Intl.Locale(locale);
|
|
37
|
-
const first = tag.getWeekInfo?.().firstDay ?? tag.weekInfo?.firstDay;
|
|
38
|
-
return first === undefined ? 0 : first % 7;
|
|
39
|
-
}
|
|
40
|
-
catch {
|
|
41
|
-
return 0;
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
const monthOf = (date) => `${date.getUTCFullYear()}-${String(date.getUTCMonth() + 1).padStart(2, '0')}`;
|
|
45
|
-
const addDays = (date, days) => new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate() + days));
|
|
46
|
-
const sameMonth = (left, right) => left.getUTCFullYear() === right.getUTCFullYear() && left.getUTCMonth() === right.getUTCMonth();
|
|
47
|
-
const addMonths = (date, months) => {
|
|
48
|
-
const target = new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth() + months, 1));
|
|
49
|
-
const last = new Date(Date.UTC(target.getUTCFullYear(), target.getUTCMonth() + 1, 0)).getUTCDate();
|
|
50
|
-
return new Date(Date.UTC(target.getUTCFullYear(), target.getUTCMonth(), Math.min(date.getUTCDate(), last)));
|
|
51
|
-
};
|
|
52
24
|
let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinControllerValue(HelixFormElement) {
|
|
53
25
|
constructor() {
|
|
54
26
|
super(...arguments);
|
|
@@ -62,11 +34,20 @@ let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinControl
|
|
|
62
34
|
this.min = '';
|
|
63
35
|
this.monthState = undefined;
|
|
64
36
|
this.months = 1;
|
|
37
|
+
this.monthViewLabel = '{heading}. Choose a month';
|
|
65
38
|
this.nextLabel = 'Next month';
|
|
39
|
+
this.nextYearLabel = 'Next year';
|
|
40
|
+
this.nextYearsLabel = 'Later years';
|
|
66
41
|
this.previousLabel = 'Previous month';
|
|
42
|
+
this.previousYearLabel = 'Previous year';
|
|
43
|
+
this.previousYearsLabel = 'Earlier years';
|
|
67
44
|
this.focused = '';
|
|
68
45
|
this.choosing = false;
|
|
69
46
|
this.handleKeydown = (event) => {
|
|
47
|
+
if (this.view !== 'day') {
|
|
48
|
+
this.handlePeriodKeydown(event);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
70
51
|
if (!KEYS.has(event.key) || this.isDisabled) {
|
|
71
52
|
return;
|
|
72
53
|
}
|
|
@@ -101,9 +82,27 @@ let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinControl
|
|
|
101
82
|
}
|
|
102
83
|
event.preventDefault();
|
|
103
84
|
};
|
|
85
|
+
this.pageYear = undefined;
|
|
86
|
+
this.periodFocus = undefined;
|
|
87
|
+
this.handleHeading = () => {
|
|
88
|
+
if (this.isDisabled) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
if (this.view === 'day') {
|
|
92
|
+
this.pageYear = this.shown.getUTCFullYear();
|
|
93
|
+
this.periodFocus = this.shown.getUTCMonth();
|
|
94
|
+
this.zoom('month');
|
|
95
|
+
}
|
|
96
|
+
else if (this.view === 'month' && this.maxView === 'year') {
|
|
97
|
+
this.periodFocus = this.periodYear;
|
|
98
|
+
this.zoom('year');
|
|
99
|
+
}
|
|
100
|
+
};
|
|
104
101
|
this.readOnly = false;
|
|
105
102
|
this.required = false;
|
|
106
103
|
this.step = 1;
|
|
104
|
+
this.view = 'day';
|
|
105
|
+
this.yearViewLabel = '{heading}. Choose a year';
|
|
107
106
|
}
|
|
108
107
|
get month() {
|
|
109
108
|
return this.monthState ?? (this.defaultMonth || fromDate(this.derivedMonth).slice(0, 7));
|
|
@@ -170,18 +169,7 @@ let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinControl
|
|
|
170
169
|
if (this.max !== '' && iso > this.max) {
|
|
171
170
|
return true;
|
|
172
171
|
}
|
|
173
|
-
|
|
174
|
-
return true;
|
|
175
|
-
}
|
|
176
|
-
const step = Math.max(1, Math.floor(this.step) || 1);
|
|
177
|
-
if (step > 1) {
|
|
178
|
-
const base = this.min === '' ? 0 : (asDate(this.min)?.getTime() ?? 0);
|
|
179
|
-
const days = Math.round((date.getTime() - base) / 86_400_000);
|
|
180
|
-
if (days % step !== 0) {
|
|
181
|
-
return true;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
return writtenList(this.disableDates).includes(iso);
|
|
172
|
+
return barredBy(date, this) !== null;
|
|
185
173
|
}
|
|
186
174
|
clamp(date) {
|
|
187
175
|
const iso = fromDate(date);
|
|
@@ -252,8 +240,93 @@ let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinControl
|
|
|
252
240
|
this.choosing = true;
|
|
253
241
|
this.requestValue(next.join(','));
|
|
254
242
|
}
|
|
243
|
+
get periodYear() {
|
|
244
|
+
return this.pageYear ?? this.shown.getUTCFullYear();
|
|
245
|
+
}
|
|
246
|
+
get periodStop() {
|
|
247
|
+
if (this.periodFocus !== undefined) {
|
|
248
|
+
return this.periodFocus;
|
|
249
|
+
}
|
|
250
|
+
return this.view === 'year' ? this.periodYear : this.shown.getUTCMonth();
|
|
251
|
+
}
|
|
252
|
+
monthOut(first) {
|
|
253
|
+
return monthOut(first, this.min, this.max);
|
|
254
|
+
}
|
|
255
|
+
yearOut(year) {
|
|
256
|
+
return yearOut(year, this.min, this.max);
|
|
257
|
+
}
|
|
258
|
+
zoom(view) {
|
|
259
|
+
this.view = view;
|
|
260
|
+
void this.updateComplete.then(() => this.focus());
|
|
261
|
+
}
|
|
262
|
+
choosePeriod(at) {
|
|
263
|
+
if (this.isDisabled) {
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
if (this.view === 'year') {
|
|
267
|
+
if (this.yearOut(at)) {
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
this.pageYear = at;
|
|
271
|
+
this.periodFocus = at === this.shown.getUTCFullYear() ? this.shown.getUTCMonth() : 0;
|
|
272
|
+
this.zoom('month');
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
const first = new Date(Date.UTC(this.periodYear, at, 1));
|
|
276
|
+
if (this.monthOut(first)) {
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
this.show(first);
|
|
280
|
+
if (this.month !== monthOf(first)) {
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
this.pageYear = undefined;
|
|
284
|
+
this.periodFocus = undefined;
|
|
285
|
+
this.focused = '';
|
|
286
|
+
this.zoom('day');
|
|
287
|
+
}
|
|
288
|
+
turnPage(direction) {
|
|
289
|
+
const by = this.view === 'year' ? YEARS_SHOWN : 1;
|
|
290
|
+
this.pageYear = this.periodYear + direction * by;
|
|
291
|
+
if (this.view === 'year') {
|
|
292
|
+
this.periodFocus = this.periodStop + direction * by;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
handlePeriodKeydown(event) {
|
|
296
|
+
if (this.isDisabled) {
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
if (event.key === 'Escape') {
|
|
300
|
+
event.preventDefault();
|
|
301
|
+
event.stopPropagation();
|
|
302
|
+
this.pageYear = undefined;
|
|
303
|
+
this.periodFocus = undefined;
|
|
304
|
+
this.zoom('day');
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
const grid = this.partNamed('periods');
|
|
308
|
+
if (!grid || !event.composedPath().includes(grid)) {
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
const stop = this.periodStop;
|
|
312
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
313
|
+
event.preventDefault();
|
|
314
|
+
this.choosePeriod(stop);
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
const moved = periodKey(this.view === 'year' ? 'year' : 'month', stop, this.periodYear, event.key, inlineStep(this, event.key));
|
|
318
|
+
if (moved === null) {
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
event.preventDefault();
|
|
322
|
+
this.periodFocus = moved.focus;
|
|
323
|
+
this.pageYear = moved.pageYear;
|
|
324
|
+
void this.updateComplete.then(() => this.focus());
|
|
325
|
+
}
|
|
255
326
|
focus(options) {
|
|
256
|
-
this.renderRoot
|
|
327
|
+
this.renderRoot
|
|
328
|
+
?.querySelector('[part~="cell"][tabindex="0"], [part~="period"][tabindex="0"]')
|
|
329
|
+
?.focus(options);
|
|
257
330
|
}
|
|
258
331
|
connectedCallback() {
|
|
259
332
|
super.connectedCallback();
|
|
@@ -291,12 +364,11 @@ let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinControl
|
|
|
291
364
|
];
|
|
292
365
|
}
|
|
293
366
|
const date = asDate(iso);
|
|
294
|
-
|
|
367
|
+
const why = date ? barredBy(date, this) : null;
|
|
368
|
+
if (why === null) {
|
|
295
369
|
return undefined;
|
|
296
370
|
}
|
|
297
|
-
|
|
298
|
-
writtenList(this.disableDays).includes(String(date.getUTCDay()));
|
|
299
|
-
return listed
|
|
371
|
+
return why === 'listed'
|
|
300
372
|
? ['badInput', this.unavailableMessage || 'Choose a date that is available.']
|
|
301
373
|
: ['stepMismatch', this.stepMismatchMessage || 'Choose one of the dates the calendar offers.'];
|
|
302
374
|
}
|
|
@@ -363,7 +435,9 @@ let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinControl
|
|
|
363
435
|
heading: new Intl.DateTimeFormat(locale, { month: 'long', timeZone: 'UTC', year: 'numeric' }),
|
|
364
436
|
locale: this.locale,
|
|
365
437
|
long: new Intl.DateTimeFormat(locale, { dateStyle: 'long', timeZone: 'UTC' }),
|
|
438
|
+
monthName: new Intl.DateTimeFormat(locale, { month: 'short', timeZone: 'UTC' }),
|
|
366
439
|
weekday: new Intl.DateTimeFormat(locale, { timeZone: 'UTC', weekday: 'short' }),
|
|
440
|
+
year: new Intl.DateTimeFormat(locale, { timeZone: 'UTC', year: 'numeric' }),
|
|
367
441
|
};
|
|
368
442
|
this.cachedFormats = built;
|
|
369
443
|
return built;
|
|
@@ -404,7 +478,9 @@ let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinControl
|
|
|
404
478
|
</button>`
|
|
405
479
|
: nothing}
|
|
406
480
|
${''}
|
|
407
|
-
<span part="heading" aria-live="polite"
|
|
481
|
+
<span part="heading" aria-live="polite"
|
|
482
|
+
>${this.renderHeadingText(heading.format(month), this.monthViewLabel)}</span
|
|
483
|
+
>
|
|
408
484
|
${last
|
|
409
485
|
? html `<button
|
|
410
486
|
part="next"
|
|
@@ -452,7 +528,7 @@ let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinControl
|
|
|
452
528
|
@click=${outside ? nothing : () => this.select(date)}
|
|
453
529
|
><span
|
|
454
530
|
part="day${!outside && selected && !middle ? ' day-selected' : ''}${iso === today ? ' day-today' : ''}${outside ? ' day-outside' : ''}${disabled ? ' day-disabled' : ''}"
|
|
455
|
-
>${
|
|
531
|
+
>${this.renderDay(date, outside)}</span
|
|
456
532
|
></span
|
|
457
533
|
>`;
|
|
458
534
|
})}
|
|
@@ -460,7 +536,86 @@ let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinControl
|
|
|
460
536
|
</div>
|
|
461
537
|
</div>`;
|
|
462
538
|
}
|
|
539
|
+
renderDay(date, outside) {
|
|
540
|
+
return this.dayContent && !outside ? this.dayContent(fromDate(date)) : date.getUTCDate();
|
|
541
|
+
}
|
|
542
|
+
renderHeadingText(text, label) {
|
|
543
|
+
const steps = this.maxView !== undefined &&
|
|
544
|
+
(this.view === 'day' || (this.view === 'month' && this.maxView === 'year'));
|
|
545
|
+
if (!steps) {
|
|
546
|
+
return text;
|
|
547
|
+
}
|
|
548
|
+
return html `<button
|
|
549
|
+
part="heading-button"
|
|
550
|
+
type="button"
|
|
551
|
+
aria-label=${fillTemplate(label, { heading: text })}
|
|
552
|
+
?disabled=${this.isDisabled}
|
|
553
|
+
@click=${this.handleHeading}
|
|
554
|
+
>${text}</button>`;
|
|
555
|
+
}
|
|
556
|
+
renderPeriods() {
|
|
557
|
+
const { monthName, year: yearName } = this.formats;
|
|
558
|
+
const years = this.view === 'year';
|
|
559
|
+
const page = years ? yearPageOf(this.periodYear) : this.periodYear;
|
|
560
|
+
const heading = years
|
|
561
|
+
? `${yearName.format(new Date(Date.UTC(page, 0, 1)))} – ${yearName.format(new Date(Date.UTC(page + YEARS_SHOWN - 1, 0, 1)))}`
|
|
562
|
+
: yearName.format(new Date(Date.UTC(page, 0, 1)));
|
|
563
|
+
const stop = this.periodStop;
|
|
564
|
+
const cells = periodCells({
|
|
565
|
+
max: this.max,
|
|
566
|
+
min: this.min,
|
|
567
|
+
page: this.periodYear,
|
|
568
|
+
shown: this.shown,
|
|
569
|
+
today: localToday(),
|
|
570
|
+
view: years ? 'year' : 'month',
|
|
571
|
+
}).map(({ at, chosen, current, first, out }) => {
|
|
572
|
+
const words = years ? yearName.format(first) : monthName.format(first);
|
|
573
|
+
return html `<span
|
|
574
|
+
part="period${chosen ? ' period-selected' : ''}${current ? ' period-current' : ''}${out ? ' period-disabled' : ''}"
|
|
575
|
+
role="gridcell"
|
|
576
|
+
aria-current=${current ? 'date' : nothing}
|
|
577
|
+
aria-disabled=${out ? 'true' : nothing}
|
|
578
|
+
aria-label=${years ? words : `${words} ${yearName.format(first)}`}
|
|
579
|
+
aria-selected=${chosen ? 'true' : nothing}
|
|
580
|
+
tabindex=${at === stop && !this.isDisabled ? '0' : '-1'}
|
|
581
|
+
@click=${() => this.choosePeriod(at)}
|
|
582
|
+
>${words}</span
|
|
583
|
+
>`;
|
|
584
|
+
});
|
|
585
|
+
const rows = [0, 3, 6, 9].map((from) => html `<div part="period-row" role="row">${cells.slice(from, from + 3)}</div>`);
|
|
586
|
+
return html `<div part="month">
|
|
587
|
+
<div part="header">
|
|
588
|
+
<button
|
|
589
|
+
part="previous"
|
|
590
|
+
type="button"
|
|
591
|
+
aria-label=${years ? this.previousYearsLabel : this.previousYearLabel}
|
|
592
|
+
?disabled=${this.isDisabled || this.yearOut(page - 1)}
|
|
593
|
+
@click=${() => this.turnPage(-1)}
|
|
594
|
+
>
|
|
595
|
+
${this.renderPreviousMark()}
|
|
596
|
+
</button>
|
|
597
|
+
<span part="heading" aria-live="polite"
|
|
598
|
+
>${this.renderHeadingText(heading, this.yearViewLabel)}</span
|
|
599
|
+
>
|
|
600
|
+
<button
|
|
601
|
+
part="next"
|
|
602
|
+
type="button"
|
|
603
|
+
aria-label=${years ? this.nextYearsLabel : this.nextYearLabel}
|
|
604
|
+
?disabled=${this.isDisabled || this.yearOut(years ? page + YEARS_SHOWN : page + 1)}
|
|
605
|
+
@click=${() => this.turnPage(1)}
|
|
606
|
+
>
|
|
607
|
+
${this.renderNextMark()}
|
|
608
|
+
</button>
|
|
609
|
+
</div>
|
|
610
|
+
<div part="periods" role="grid" aria-label=${heading}>${rows}</div>
|
|
611
|
+
</div>`;
|
|
612
|
+
}
|
|
463
613
|
render() {
|
|
614
|
+
if (this.view !== 'day') {
|
|
615
|
+
return html `<div part="months" style="--date-picker-column-count: 1">
|
|
616
|
+
${this.renderPeriods()}
|
|
617
|
+
</div>`;
|
|
618
|
+
}
|
|
464
619
|
const shown = this.shown;
|
|
465
620
|
const count = this.monthCount;
|
|
466
621
|
return html `<div part="months" style="--date-picker-column-count: ${Math.min(count, 2)}">
|
|
@@ -483,6 +638,9 @@ let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinControl
|
|
|
483
638
|
__decorate([
|
|
484
639
|
property({ attribute: 'bad-input-message' })
|
|
485
640
|
], HelixHeadlessDatePicker.prototype, "badInputMessage", void 0);
|
|
641
|
+
__decorate([
|
|
642
|
+
property({ attribute: false })
|
|
643
|
+
], HelixHeadlessDatePicker.prototype, "dayContent", void 0);
|
|
486
644
|
__decorate([
|
|
487
645
|
property({ attribute: 'default-month' })
|
|
488
646
|
], HelixHeadlessDatePicker.prototype, "defaultMonth", void 0);
|
|
@@ -498,6 +656,9 @@ __decorate([
|
|
|
498
656
|
__decorate([
|
|
499
657
|
property({ reflect: true, type: Boolean })
|
|
500
658
|
], HelixHeadlessDatePicker.prototype, "invalid", void 0);
|
|
659
|
+
__decorate([
|
|
660
|
+
property({ attribute: false })
|
|
661
|
+
], HelixHeadlessDatePicker.prototype, "isDateUnavailable", void 0);
|
|
501
662
|
__decorate([
|
|
502
663
|
property()
|
|
503
664
|
], HelixHeadlessDatePicker.prototype, "label", void 0);
|
|
@@ -507,6 +668,9 @@ __decorate([
|
|
|
507
668
|
__decorate([
|
|
508
669
|
property()
|
|
509
670
|
], HelixHeadlessDatePicker.prototype, "max", void 0);
|
|
671
|
+
__decorate([
|
|
672
|
+
property({ attribute: 'max-view' })
|
|
673
|
+
], HelixHeadlessDatePicker.prototype, "maxView", void 0);
|
|
510
674
|
__decorate([
|
|
511
675
|
property()
|
|
512
676
|
], HelixHeadlessDatePicker.prototype, "min", void 0);
|
|
@@ -519,18 +683,39 @@ __decorate([
|
|
|
519
683
|
__decorate([
|
|
520
684
|
property({ type: Number })
|
|
521
685
|
], HelixHeadlessDatePicker.prototype, "months", void 0);
|
|
686
|
+
__decorate([
|
|
687
|
+
property({ attribute: 'month-view-label' })
|
|
688
|
+
], HelixHeadlessDatePicker.prototype, "monthViewLabel", void 0);
|
|
522
689
|
__decorate([
|
|
523
690
|
property({ attribute: 'next-label' })
|
|
524
691
|
], HelixHeadlessDatePicker.prototype, "nextLabel", void 0);
|
|
692
|
+
__decorate([
|
|
693
|
+
property({ attribute: 'next-year-label' })
|
|
694
|
+
], HelixHeadlessDatePicker.prototype, "nextYearLabel", void 0);
|
|
695
|
+
__decorate([
|
|
696
|
+
property({ attribute: 'next-years-label' })
|
|
697
|
+
], HelixHeadlessDatePicker.prototype, "nextYearsLabel", void 0);
|
|
525
698
|
__decorate([
|
|
526
699
|
property({ attribute: 'previous-label' })
|
|
527
700
|
], HelixHeadlessDatePicker.prototype, "previousLabel", void 0);
|
|
701
|
+
__decorate([
|
|
702
|
+
property({ attribute: 'previous-year-label' })
|
|
703
|
+
], HelixHeadlessDatePicker.prototype, "previousYearLabel", void 0);
|
|
704
|
+
__decorate([
|
|
705
|
+
property({ attribute: 'previous-years-label' })
|
|
706
|
+
], HelixHeadlessDatePicker.prototype, "previousYearsLabel", void 0);
|
|
528
707
|
__decorate([
|
|
529
708
|
property({ attribute: 'range-overflow-message' })
|
|
530
709
|
], HelixHeadlessDatePicker.prototype, "rangeOverflowMessage", void 0);
|
|
531
710
|
__decorate([
|
|
532
711
|
state()
|
|
533
712
|
], HelixHeadlessDatePicker.prototype, "focused", void 0);
|
|
713
|
+
__decorate([
|
|
714
|
+
state()
|
|
715
|
+
], HelixHeadlessDatePicker.prototype, "pageYear", void 0);
|
|
716
|
+
__decorate([
|
|
717
|
+
state()
|
|
718
|
+
], HelixHeadlessDatePicker.prototype, "periodFocus", void 0);
|
|
534
719
|
__decorate([
|
|
535
720
|
property({ attribute: 'range-underflow-message' })
|
|
536
721
|
], HelixHeadlessDatePicker.prototype, "rangeUnderflowMessage", void 0);
|
|
@@ -552,6 +737,12 @@ __decorate([
|
|
|
552
737
|
__decorate([
|
|
553
738
|
property({ attribute: 'value-missing-message' })
|
|
554
739
|
], HelixHeadlessDatePicker.prototype, "valueMissingMessage", void 0);
|
|
740
|
+
__decorate([
|
|
741
|
+
property()
|
|
742
|
+
], HelixHeadlessDatePicker.prototype, "view", void 0);
|
|
743
|
+
__decorate([
|
|
744
|
+
property({ attribute: 'year-view-label' })
|
|
745
|
+
], HelixHeadlessDatePicker.prototype, "yearViewLabel", void 0);
|
|
555
746
|
HelixHeadlessDatePicker = __decorate([
|
|
556
747
|
customElement('helix-headless-date-picker')
|
|
557
748
|
], HelixHeadlessDatePicker);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HelixElement } from '@fusion.dev/helix-core';
|
|
2
|
-
import { type TemplateResult } from 'lit';
|
|
2
|
+
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
3
3
|
/**
|
|
4
4
|
* @summary One label and its value.
|
|
5
5
|
*
|
|
@@ -12,11 +12,17 @@ import { type TemplateResult } from 'lit';
|
|
|
12
12
|
* such as a tag, an avatar, or a link. The label is almost always text, so it
|
|
13
13
|
* is also a property.
|
|
14
14
|
*
|
|
15
|
+
* **For a label with several values, write each value as a `<dd>`**, such as
|
|
16
|
+
* the authors of a paper. The item then puts your `<dd>` elements after its
|
|
17
|
+
* `<dt>` in place of its own, so a screen reader hears one term and each of
|
|
18
|
+
* its descriptions, as in a native `<dl>`. A server cannot see your elements,
|
|
19
|
+
* so the served item wraps them in its own `<dd>` until it runs.
|
|
20
|
+
*
|
|
15
21
|
* @since 0.1.0
|
|
16
22
|
* @status stable
|
|
17
23
|
* @documentation https://fusion.dev/helix/components/description-list
|
|
18
24
|
*
|
|
19
|
-
* @slot - The value.
|
|
25
|
+
* @slot - The value, or several `<dd>` elements for several values.
|
|
20
26
|
* @slot label - The label, when it is more than text. Falls back to `label`.
|
|
21
27
|
*
|
|
22
28
|
* @csspart label - The `<dt>`, holding the label.
|
|
@@ -31,7 +37,16 @@ export declare class HelixHeadlessDescriptionListItem extends HelixElement {
|
|
|
31
37
|
* that varies and is often more than text.
|
|
32
38
|
*/
|
|
33
39
|
label: string;
|
|
40
|
+
/**
|
|
41
|
+
* Whether the values are the consumer's own `<dd>` elements, which the item
|
|
42
|
+
* then does not wrap. Unknown on a server and while hydrating, where the
|
|
43
|
+
* item draws its own.
|
|
44
|
+
*/
|
|
45
|
+
private get several();
|
|
46
|
+
protected firstUpdated(changed: PropertyValues): void;
|
|
34
47
|
protected render(): TemplateResult;
|
|
48
|
+
/** A value arriving or leaving can change whether the item wraps them. */
|
|
49
|
+
private readonly handleSlotChange;
|
|
35
50
|
}
|
|
36
51
|
declare global {
|
|
37
52
|
interface HTMLElementTagNameMap {
|