@fusion.dev/helix-headless 0.143.0 → 0.144.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.
Files changed (191) hide show
  1. package/custom-elements.json +8551 -375
  2. package/dist/area-chart/root/area-chart-root.d.ts +12 -4
  3. package/dist/area-chart/root/area-chart-root.js +24 -7
  4. package/dist/avatar/root/avatar-root.d.ts +14 -0
  5. package/dist/avatar/root/avatar-root.js +23 -9
  6. package/dist/badge/root/badge-root.d.ts +11 -7
  7. package/dist/badge/root/badge-root.js +1 -1
  8. package/dist/bar-chart/root/bar-chart-root.d.ts +12 -3
  9. package/dist/bar-chart/root/bar-chart-root.js +17 -10
  10. package/dist/button/root/button-root.d.ts +47 -1
  11. package/dist/button/root/button-root.js +38 -4
  12. package/dist/callout/root/callout-root.d.ts +18 -1
  13. package/dist/callout/root/callout-root.js +15 -4
  14. package/dist/card/root/card-root.d.ts +30 -1
  15. package/dist/card/root/card-root.js +38 -5
  16. package/dist/checkbox/root/checkbox-root.js +2 -0
  17. package/dist/checkbox-group/root/checkbox-group-root.d.ts +53 -3
  18. package/dist/checkbox-group/root/checkbox-group-root.js +71 -22
  19. package/dist/code-block/lines.d.ts +13 -0
  20. package/dist/code-block/lines.js +2 -0
  21. package/dist/code-block/root/code-block-root.d.ts +30 -0
  22. package/dist/code-block/root/code-block-root.js +23 -2
  23. package/dist/color-input/root/color-input-root.d.ts +34 -1
  24. package/dist/color-input/root/color-input-root.js +23 -4
  25. package/dist/color-picker/channels.d.ts +26 -0
  26. package/dist/color-picker/channels.js +84 -0
  27. package/dist/color-picker/root/color-picker-root.d.ts +81 -5
  28. package/dist/color-picker/root/color-picker-root.js +103 -10
  29. package/dist/combobox/root/combobox-root.d.ts +38 -3
  30. package/dist/combobox/root/combobox-root.js +64 -2
  31. package/dist/command/root/command-root.d.ts +30 -4
  32. package/dist/command/root/command-root.js +33 -3
  33. package/dist/copy-button/from.d.ts +22 -0
  34. package/dist/copy-button/from.js +28 -0
  35. package/dist/copy-button/root/copy-button-root.d.ts +27 -1
  36. package/dist/copy-button/root/copy-button-root.js +43 -7
  37. package/dist/date-input/root/date-input-root.d.ts +73 -4
  38. package/dist/date-input/root/date-input-root.js +93 -43
  39. package/dist/date-picker/root/date-picker-root.d.ts +145 -1
  40. package/dist/date-picker/root/date-picker-root.js +239 -48
  41. package/dist/dialog/description.d.ts +9 -0
  42. package/dist/dialog/description.js +14 -0
  43. package/dist/dialog/root/dialog-root.d.ts +64 -1
  44. package/dist/dialog/root/dialog-root.js +49 -23
  45. package/dist/donut-chart/root/donut-chart-root.d.ts +25 -4
  46. package/dist/donut-chart/root/donut-chart-root.js +21 -6
  47. package/dist/drawer/root/drawer-root.d.ts +63 -2
  48. package/dist/drawer/root/drawer-root.js +95 -19
  49. package/dist/drawer/swipe-start.d.ts +9 -0
  50. package/dist/drawer/swipe-start.js +12 -0
  51. package/dist/element-events.generated.js +8 -5
  52. package/dist/empty/root/empty-root.d.ts +1 -1
  53. package/dist/file-input/root/file-input-root.d.ts +47 -0
  54. package/dist/file-input/root/file-input-root.js +60 -22
  55. package/dist/file-input/screen.d.ts +35 -0
  56. package/dist/file-input/screen.js +49 -0
  57. package/dist/filter-input/root/filter-input-root.d.ts +38 -4
  58. package/dist/filter-input/root/filter-input-root.js +67 -3
  59. package/dist/filter-input/suggest.d.ts +17 -0
  60. package/dist/filter-input/suggest.js +23 -0
  61. package/dist/format-date/options.d.ts +33 -0
  62. package/dist/format-date/options.js +42 -0
  63. package/dist/format-date/root/format-date-root.d.ts +51 -0
  64. package/dist/format-date/root/format-date-root.js +58 -38
  65. package/dist/heatmap/root/heatmap-root.d.ts +23 -6
  66. package/dist/heatmap/root/heatmap-root.js +24 -13
  67. package/dist/icon/index.d.ts +2 -0
  68. package/dist/icon/index.js +2 -0
  69. package/dist/icon/registry.d.ts +37 -0
  70. package/dist/icon/registry.js +83 -0
  71. package/dist/icon/root/icon-root.d.ts +30 -4
  72. package/dist/icon/root/icon-root.js +41 -6
  73. package/dist/icon/root/index.d.ts +2 -0
  74. package/dist/icon/root/index.js +2 -0
  75. package/dist/icon/set.d.ts +1 -0
  76. package/dist/icon/set.js +3 -0
  77. package/dist/image/root/image-root.d.ts +14 -0
  78. package/dist/image/root/image-root.js +15 -2
  79. package/dist/input/root/input-root.d.ts +11 -0
  80. package/dist/input/root/input-root.js +15 -0
  81. package/dist/kbd/root/kbd-root.d.ts +20 -13
  82. package/dist/kbd/root/kbd-root.js +35 -37
  83. package/dist/kbd/shortcut.d.ts +18 -0
  84. package/dist/kbd/shortcut.js +35 -0
  85. package/dist/legend/hidden-series.d.ts +8 -0
  86. package/dist/legend/hidden-series.js +13 -0
  87. package/dist/legend/root/legend-root.d.ts +56 -0
  88. package/dist/legend/root/legend-root.js +54 -5
  89. package/dist/lightbox/item/lightbox-item.d.ts +15 -0
  90. package/dist/lightbox/item/lightbox-item.js +10 -1
  91. package/dist/lightbox/root/lightbox-root.d.ts +61 -1
  92. package/dist/lightbox/root/lightbox-root.js +94 -4
  93. package/dist/line-chart/root/line-chart-root.d.ts +11 -3
  94. package/dist/line-chart/root/line-chart-root.js +19 -5
  95. package/dist/listbox/range.d.ts +17 -0
  96. package/dist/listbox/range.js +5 -0
  97. package/dist/listbox/root/listbox-root.d.ts +74 -3
  98. package/dist/listbox/root/listbox-root.js +87 -9
  99. package/dist/loader/busy.d.ts +17 -0
  100. package/dist/loader/busy.js +24 -0
  101. package/dist/loader/root/loader-root.d.ts +37 -0
  102. package/dist/loader/root/loader-root.js +52 -3
  103. package/dist/meter/root/meter-root.d.ts +7 -0
  104. package/dist/meter/root/meter-root.js +6 -3
  105. package/dist/notifications/feed-keys.d.ts +10 -0
  106. package/dist/notifications/feed-keys.js +14 -0
  107. package/dist/notifications/notification/notification.d.ts +17 -0
  108. package/dist/notifications/notification/notification.js +21 -2
  109. package/dist/notifications/root/notifications-root.d.ts +42 -0
  110. package/dist/notifications/root/notifications-root.js +60 -1
  111. package/dist/number-input/root/number-input-root.d.ts +47 -0
  112. package/dist/number-input/root/number-input-root.js +58 -22
  113. package/dist/object-inspector/root/object-inspector-root.d.ts +1 -0
  114. package/dist/object-inspector/root/object-inspector-root.js +1 -1
  115. package/dist/option/root/option-root.d.ts +54 -5
  116. package/dist/option/root/option-root.js +34 -5
  117. package/dist/pin-input/format.d.ts +7 -0
  118. package/dist/pin-input/format.js +16 -0
  119. package/dist/pin-input/root/pin-input-root.d.ts +21 -0
  120. package/dist/pin-input/root/pin-input-root.js +29 -2
  121. package/dist/popover/root/popover-root.d.ts +62 -4
  122. package/dist/popover/root/popover-root.js +53 -5
  123. package/dist/progress/root/progress-root.d.ts +7 -0
  124. package/dist/progress/root/progress-root.js +9 -3
  125. package/dist/qr-code/export.d.ts +31 -0
  126. package/dist/qr-code/export.js +10 -0
  127. package/dist/qr-code/root/qr-code-root.d.ts +26 -0
  128. package/dist/qr-code/root/qr-code-root.js +49 -2
  129. package/dist/radio/group/radio-group.d.ts +23 -0
  130. package/dist/radio/group/radio-group.js +18 -0
  131. package/dist/rating/root/rating-root.d.ts +25 -0
  132. package/dist/rating/root/rating-root.js +45 -3
  133. package/dist/scatter-chart/root/scatter-chart-root.d.ts +17 -3
  134. package/dist/scatter-chart/root/scatter-chart-root.js +25 -7
  135. package/dist/select/root/select-root.d.ts +24 -0
  136. package/dist/select/root/select-root.js +20 -6
  137. package/dist/skeleton/root/skeleton-root.d.ts +25 -0
  138. package/dist/skeleton/root/skeleton-root.js +17 -2
  139. package/dist/slider/root/slider-root.d.ts +39 -0
  140. package/dist/slider/root/slider-root.js +45 -9
  141. package/dist/stat/root/stat-root.d.ts +2 -0
  142. package/dist/stat/root/stat-root.js +1 -1
  143. package/dist/steps/step/step.d.ts +1 -0
  144. package/dist/steps/step/step.js +1 -1
  145. package/dist/switch/root/switch-root.d.ts +12 -2
  146. package/dist/switch/root/switch-root.js +6 -1
  147. package/dist/tag/group/tag-group.d.ts +107 -0
  148. package/dist/tag/group/tag-group.js +157 -0
  149. package/dist/tag/index.d.ts +1 -0
  150. package/dist/tag/index.js +1 -0
  151. package/dist/tag/root/tag-root.d.ts +60 -0
  152. package/dist/tag/root/tag-root.js +74 -18
  153. package/dist/tag/selection.d.ts +10 -0
  154. package/dist/tag/selection.js +12 -0
  155. package/dist/textarea/grow.d.ts +22 -0
  156. package/dist/textarea/grow.js +20 -0
  157. package/dist/textarea/root/textarea-root.d.ts +9 -0
  158. package/dist/textarea/root/textarea-root.js +9 -1
  159. package/dist/time-input/root/time-input-root.d.ts +44 -5
  160. package/dist/time-input/root/time-input-root.js +69 -39
  161. package/dist/time-picker/root/time-picker-root.d.ts +54 -8
  162. package/dist/time-picker/root/time-picker-root.js +121 -91
  163. package/dist/toast/hotkey.d.ts +22 -0
  164. package/dist/toast/hotkey.js +23 -0
  165. package/dist/toast/item/toast-item.d.ts +16 -1
  166. package/dist/toast/item/toast-item.js +41 -13
  167. package/dist/toast/root/toast-root.d.ts +42 -8
  168. package/dist/toast/root/toast-root.js +64 -4
  169. package/dist/toggle/group/toggle-group.d.ts +57 -15
  170. package/dist/toggle/group/toggle-group.js +69 -9
  171. package/dist/toggle/root/toggle-root.d.ts +12 -1
  172. package/dist/toggle/root/toggle-root.js +11 -3
  173. package/dist/tooltip/focus-target.d.ts +6 -0
  174. package/dist/tooltip/focus-target.js +9 -0
  175. package/dist/tooltip/root/tooltip-root.d.ts +42 -17
  176. package/dist/tooltip/root/tooltip-root.js +50 -9
  177. package/dist/tour/naming.d.ts +30 -0
  178. package/dist/tour/naming.js +10 -0
  179. package/dist/tour/root/tour-root.d.ts +35 -0
  180. package/dist/tour/root/tour-root.js +56 -5
  181. package/dist/tour/stop/tour-stop.d.ts +53 -8
  182. package/dist/tour/stop/tour-stop.js +45 -15
  183. package/dist/tour/wait.d.ts +11 -0
  184. package/dist/tour/wait.js +19 -0
  185. package/dist/trend/root/trend-root.d.ts +13 -0
  186. package/dist/trend/root/trend-root.js +14 -9
  187. package/lint.json +1 -1
  188. package/package.json +5 -5
  189. package/types/jsx.d.ts +4862 -254
  190. package/types/svelte.d.ts +1 -0
  191. package/types/vue.d.ts +1149 -67
@@ -2,7 +2,7 @@ import { AriaForwardController, HelixFormElement } from '@fusion.dev/helix-core'
2
2
  import { type PropertyValues, type TemplateResult } from 'lit';
3
3
  import '../../date-picker/index.js';
4
4
  import '../../tag/index.js';
5
- declare const HelixHeadlessDateInput_base: (new (...args: any[]) => import("@fusion.dev/helix-core").MixinPickerEditingInterface) & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinPickerFieldInterface) & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinControllerOpenInterface) & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinTokensInterface) & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinControllerValueInterface) & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinFieldInterface) & typeof HelixFormElement;
5
+ declare const HelixHeadlessDateInput_base: (new (...args: any[]) => import("@fusion.dev/helix-core").MixinSegmentedFieldInterface) & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinPickerEditingInterface) & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinPickerFieldInterface) & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinControllerOpenInterface) & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinTokensInterface) & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinControllerValueInterface) & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinFieldInterface) & typeof HelixFormElement;
6
6
  /**
7
7
  * @summary A date, typed or picked from a calendar.
8
8
  *
@@ -17,9 +17,15 @@ declare const HelixHeadlessDateInput_base: (new (...args: any[]) => import("@fus
17
17
  * when you leave the field, as a text field does. A date picked from the
18
18
  * calendar sends both.
19
19
  *
20
- * The trigger opens the calendar with focus on the selected day, and Escape
21
- * closes it and returns focus to the field. Focusing the field opens the
22
- * calendar too, and Tab out of the field closes it again.
20
+ * The trigger and ArrowDown open the calendar with focus on the selected day,
21
+ * Tab moves between the calendar's controls without leaving it, and Escape
22
+ * closes it and returns focus to the field. A press into the field opens the
23
+ * calendar too. Tab into the field opens nothing, and Tab out of the field
24
+ * closes the calendar.
25
+ *
26
+ * With `segmented`, the field is a row of segments in place of the text: a
27
+ * month, a day and a year in the order the locale writes them, each set with
28
+ * digits or the arrow keys. Alt+Down opens the calendar from a segment.
23
29
  *
24
30
  * @since 0.1.0
25
31
  * @status stable
@@ -42,14 +48,17 @@ declare const HelixHeadlessDateInput_base: (new (...args: any[]) => import("@fus
42
48
  *
43
49
  * @csspart control - The text input.
44
50
  * @csspart date - One held date, as a tag, in `multiple`.
51
+ * @csspart date-cell - The tag's grid cell, which a tag draws only inside a tag group.
45
52
  * @csspart date-dismiss - The remove button, when `dismissible`.
46
53
  * @csspart date-dismiss-mark - The icon on the remove button, shown when no icon is slotted.
47
54
  * @csspart date-label - The label, trimmed to its capitals and baseline.
55
+ * @csspart date-link - The tag's link around its label, which a tag draws only with `href`.
48
56
  * @csspart date-start - The category before the label.
49
57
  * @csspart feedback - The error message under the field.
50
58
  * @csspart field - The box that holds the text and the trigger.
51
59
  * @csspart hint - The help text under the field, shown while there is no error.
52
60
  * @csspart label - The label above the field.
61
+ * @csspart literal - The text the locale writes between two segments, such as a slash, in `segmented`.
53
62
  * @csspart picker - The date picker inside the panel.
54
63
  * @csspart picker-cell - One cell in a row of days. A range colors these cells.
55
64
  * @csspart picker-cell-range-end - The cell of a range's last day. Applied with `picker-cell`.
@@ -63,15 +72,25 @@ declare const HelixHeadlessDateInput_base: (new (...args: any[]) => import("@fus
63
72
  * @csspart picker-grid - The grid of days.
64
73
  * @csspart picker-header - The month name and its controls.
65
74
  * @csspart picker-heading - The month and year being shown.
75
+ * @csspart picker-heading-button - The calendar's heading as a button that shows the months or the years, where `max-view` is set.
66
76
  * @csspart picker-month - One month, with its header and its grid.
67
77
  * @csspart picker-months - The row of months.
68
78
  * @csspart picker-next - The control that moves to the next month.
69
79
  * @csspart picker-next-mark - The icon on the next month control.
80
+ * @csspart picker-period - One month or one year, in the calendar's months and years views.
81
+ * @csspart picker-period-current - This month or this year, beside `picker-period`.
82
+ * @csspart picker-period-disabled - A month or a year wholly outside `min` and `max`, beside `picker-period`.
83
+ * @csspart picker-period-row - One row of three months or years.
84
+ * @csspart picker-period-selected - The month or the year on show, beside `picker-period`.
85
+ * @csspart picker-periods - The grid of months or years.
70
86
  * @csspart picker-previous - The control that moves to the previous month.
71
87
  * @csspart picker-previous-mark - The icon on the previous month control.
72
88
  * @csspart picker-week - One row of days.
73
89
  * @csspart picker-weekday - A column header naming a day of the week.
74
90
  * @csspart rest - The count of dates beyond the ones shown. It is a `<button>` with `expandable` and a `<span>` without it.
91
+ * @csspart segment - One part of the date, a year, a month or a day, in `segmented`.
92
+ * @csspart segment-placeholder - A segment with nothing in it yet. Applied with `segment`.
93
+ * @csspart segments - The row of segments that holds the date, in `segmented`.
75
94
  * @csspart surface - The floating panel.
76
95
  * @csspart tags - The row the dates sit in.
77
96
  * @csspart trigger - The control that opens the calendar.
@@ -121,6 +140,12 @@ export declare class HelixHeadlessDateInput extends HelixHeadlessDateInput_base
121
140
  * submits and what `min` and `max` compare against.
122
141
  */
123
142
  dateStyle: 'full' | 'iso' | 'long' | 'medium' | 'short';
143
+ /**
144
+ * What each day in the calendar shows, in place of its number: a function
145
+ * given the date as `YYYY-MM-DD`. Handed to the calendar; see Date Picker's
146
+ * `dayContent`.
147
+ */
148
+ dayContent?: ((date: string) => unknown) | undefined;
124
149
  /**
125
150
  * Dates that cannot be chosen, as `YYYY-MM-DD`, separated by commas or
126
151
  * spaces.
@@ -139,6 +164,12 @@ export declare class HelixHeadlessDateInput extends HelixHeadlessDateInput_base
139
164
  * and is Sunday otherwise.
140
165
  */
141
166
  firstDayOfWeek?: number;
167
+ /**
168
+ * A rule for which dates cannot be chosen: a function given the date as
169
+ * `YYYY-MM-DD` that returns `true` to bar it. The calendar offers such a date
170
+ * as unavailable, and a typed one is invalid, as with `disable-dates`.
171
+ */
172
+ isDateUnavailable?: ((date: string) => boolean) | undefined;
142
173
  /**
143
174
  * The language tag for the names of months and days in the calendar.
144
175
  */
@@ -147,6 +178,11 @@ export declare class HelixHeadlessDateInput extends HelixHeadlessDateInput_base
147
178
  * The latest date that can be chosen, as `YYYY-MM-DD`.
148
179
  */
149
180
  max: string;
181
+ /**
182
+ * How far the calendar's heading steps back from the days: `month` or
183
+ * `year`. Handed to the calendar; see Date Picker's `max-view`.
184
+ */
185
+ maxView?: 'month' | 'year';
150
186
  /**
151
187
  * The earliest date that can be chosen, as `YYYY-MM-DD`.
152
188
  */
@@ -200,10 +236,23 @@ export declare class HelixHeadlessDateInput extends HelixHeadlessDateInput_base
200
236
  */
201
237
  protected placed(room: number | undefined): void;
202
238
  protected willUpdate(changed: PropertyValues): void;
239
+ /**
240
+ * The name of the calendar's heading where it shows the months, with
241
+ * `{heading}` filled in.
242
+ */
243
+ monthViewLabel: string;
203
244
  /**
204
245
  * The name of the calendar's control that moves to the next month.
205
246
  */
206
247
  nextLabel: string;
248
+ /**
249
+ * The name of the calendar's control that moves forward a year.
250
+ */
251
+ nextYearLabel: string;
252
+ /**
253
+ * The name of the calendar's control that moves forward a page of years.
254
+ */
255
+ nextYearsLabel: string;
207
256
  /**
208
257
  * The text the field shows before a date is entered.
209
258
  */
@@ -212,6 +261,14 @@ export declare class HelixHeadlessDateInput extends HelixHeadlessDateInput_base
212
261
  * The name of the calendar's control that moves to the previous month.
213
262
  */
214
263
  previousLabel: string;
264
+ /**
265
+ * The name of the calendar's control that moves back a year.
266
+ */
267
+ previousYearLabel: string;
268
+ /**
269
+ * The name of the calendar's control that moves back a page of years.
270
+ */
271
+ previousYearsLabel: string;
215
272
  /**
216
273
  * The message shown when a range holds more than two dates.
217
274
  *
@@ -264,6 +321,13 @@ export declare class HelixHeadlessDateInput extends HelixHeadlessDateInput_base
264
321
  * complete.
265
322
  */
266
323
  private get picked();
324
+ /**
325
+ * Segments hold one date, so `range` and `multiple` keep the line of text,
326
+ * whose separators and tags are how those modes write several.
327
+ */
328
+ protected get segmentable(): boolean;
329
+ protected get segmentedKind(): 'date';
330
+ protected get segmentLocale(): string;
267
331
  /** One date, written the way `dateStyle` asks for. */
268
332
  private written;
269
333
  protected get display(): string;
@@ -296,6 +360,11 @@ export declare class HelixHeadlessDateInput extends HelixHeadlessDateInput_base
296
360
  * The message shown when `disable-dates` or `disable-days` bars a date.
297
361
  */
298
362
  unavailableMessage?: string;
363
+ /**
364
+ * The name of the calendar's heading where it shows a page of years, with
365
+ * `{heading}` filled in.
366
+ */
367
+ yearViewLabel: string;
299
368
  /**
300
369
  * The calendar the field opens, behind a seam the styled tier can move.
301
370
  *
@@ -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, customElement, fillTemplate, dateAsValue as fromDate, HelixFormElement, isDateValue, MixinControllerOpen, MixinControllerValue, MixinField, MixinPickerEditing, MixinPickerField, MixinTokens, writtenList, } from '@fusion.dev/helix-core';
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';
8
8
  import { calendarBlank } from '@fusion.dev/helix-icons';
9
9
  import { nothing } from 'lit';
10
10
  import { property, state } from 'lit/decorators.js';
@@ -17,11 +17,11 @@ const dates = (value) => value
17
17
  .split(',')
18
18
  .map((one) => one.trim())
19
19
  .filter(Boolean);
20
- let HelixHeadlessDateInput = class HelixHeadlessDateInput extends MixinPickerEditing(MixinPickerField(MixinControllerOpen(MixinTokens(MixinControllerValue(MixinField(HelixFormElement)))))) {
20
+ let HelixHeadlessDateInput = class HelixHeadlessDateInput extends MixinSegmentedField(MixinPickerEditing(MixinPickerField(MixinControllerOpen(MixinTokens(MixinControllerValue(MixinField(HelixFormElement))))))) {
21
21
  constructor() {
22
22
  super(...arguments);
23
23
  this.aria = new AriaForwardController(this, {
24
- target: () => this.partNamed('control'),
24
+ target: () => this.partNamed('control') ?? this.segmentGroup,
25
25
  });
26
26
  this.autocomplete = '';
27
27
  this.calendarLabel = 'Date Picker';
@@ -35,9 +35,14 @@ let HelixHeadlessDateInput = class HelixHeadlessDateInput extends MixinPickerEdi
35
35
  this.months = 1;
36
36
  this.fitted = undefined;
37
37
  this.wide = undefined;
38
+ this.monthViewLabel = '{heading}. Choose a month';
38
39
  this.nextLabel = 'Next month';
40
+ this.nextYearLabel = 'Next year';
41
+ this.nextYearsLabel = 'Later years';
39
42
  this.placeholder = 'YYYY-MM-DD';
40
43
  this.previousLabel = 'Previous month';
44
+ this.previousYearLabel = 'Previous year';
45
+ this.previousYearsLabel = 'Earlier years';
41
46
  this.removeLabel = 'Remove {name}';
42
47
  this.step = 1;
43
48
  this.triggerLabel = 'Choose a date';
@@ -90,6 +95,7 @@ let HelixHeadlessDateInput = class HelixHeadlessDateInput extends MixinPickerEdi
90
95
  this.updateComplete.then(() => this.returnFocus());
91
96
  }
92
97
  };
98
+ this.yearViewLabel = '{heading}. Choose a year';
93
99
  this.handleIconChange = () => {
94
100
  this.requestUpdate();
95
101
  };
@@ -119,6 +125,15 @@ let HelixHeadlessDateInput = class HelixHeadlessDateInput extends MixinPickerEdi
119
125
  const held = dates(this.value);
120
126
  return held.length > 0 && held.every(isDateValue) ? held.join(',') : '';
121
127
  }
128
+ get segmentable() {
129
+ return this.mode === undefined;
130
+ }
131
+ get segmentedKind() {
132
+ return 'date';
133
+ }
134
+ get segmentLocale() {
135
+ return this.locale;
136
+ }
122
137
  written(date) {
123
138
  if (this.dateStyle === 'iso' || !isDateValue(date)) {
124
139
  return date;
@@ -170,21 +185,15 @@ let HelixHeadlessDateInput = class HelixHeadlessDateInput extends MixinPickerEdi
170
185
  max: this.written(this.max),
171
186
  });
172
187
  }
173
- const days = writtenList(this.disableDays);
174
- const listed = writtenList(this.disableDates);
175
- if (held.some((one) => listed.includes(one) || days.includes(String(asDate(one)?.getUTCDay() ?? '')))) {
188
+ const why = held.map((one) => {
189
+ const date = asDate(one);
190
+ return date ? barredBy(date, this) : null;
191
+ });
192
+ if (why.includes('listed')) {
176
193
  return this.unavailableMessage || 'Choose a date that is available.';
177
194
  }
178
- const step = Math.max(1, Math.floor(this.step) || 1);
179
- if (step > 1) {
180
- const base = asDate(this.min)?.getTime() ?? 0;
181
- const off = held.some((one) => {
182
- const at = asDate(one)?.getTime();
183
- return at !== undefined && Math.round((at - base) / 86_400_000) % step !== 0;
184
- });
185
- if (off) {
186
- return this.stepMismatchMessage || 'Choose one of the dates the calendar offers.';
187
- }
195
+ if (why.includes('step')) {
196
+ return this.stepMismatchMessage || 'Choose one of the dates the calendar offers.';
188
197
  }
189
198
  if (this.mode === 'range' && held.length > 2) {
190
199
  return this.rangeLengthMessage || 'A range is two dates.';
@@ -198,9 +207,12 @@ let HelixHeadlessDateInput = class HelixHeadlessDateInput extends MixinPickerEdi
198
207
  cell-range-middle: picker-cell-range-middle, cell-range-start: picker-cell-range-start,
199
208
  day: picker-day, day-disabled: picker-day-disabled, day-outside: picker-day-outside,
200
209
  day-selected: picker-day-selected, day-today: picker-day-today, grid: picker-grid,
201
- header: picker-header, heading: picker-heading, month: picker-month, months: picker-months,
202
- next: picker-next,
203
- next-mark: picker-next-mark, previous: picker-previous, previous-mark: picker-previous-mark,
210
+ header: picker-header, heading: picker-heading, heading-button: picker-heading-button,
211
+ month: picker-month, months: picker-months, next: picker-next,
212
+ next-mark: picker-next-mark, period: picker-period, period-current: picker-period-current,
213
+ period-disabled: picker-period-disabled, period-row: picker-period-row,
214
+ period-selected: picker-period-selected, periods: picker-periods,
215
+ previous: picker-previous, previous-mark: picker-previous-mark,
204
216
  week: picker-week, weekday: picker-weekday"
205
217
  ?invalid=${this.resolvedFeedback !== ''}
206
218
  mode=${this.mode ?? nothing}
@@ -212,10 +224,19 @@ let HelixHeadlessDateInput = class HelixHeadlessDateInput extends MixinPickerEdi
212
224
  label=${this.calendarLabel}
213
225
  locale=${this.locale || nothing}
214
226
  max=${this.max || nothing}
227
+ max-view=${this.maxView ?? nothing}
215
228
  min=${this.min || nothing}
229
+ month-view-label=${this.monthViewLabel}
216
230
  next-label=${this.nextLabel}
231
+ next-year-label=${this.nextYearLabel}
232
+ next-years-label=${this.nextYearsLabel}
217
233
  previous-label=${this.previousLabel}
234
+ previous-year-label=${this.previousYearLabel}
235
+ previous-years-label=${this.previousYearsLabel}
218
236
  step=${this.step}
237
+ year-view-label=${this.yearViewLabel}
238
+ .dayContent=${this.dayContent}
239
+ .isDateUnavailable=${this.isDateUnavailable}
219
240
  @helix-before-change=${this.handleCalendarChange}
220
241
  @change=${this.stopInner}
221
242
  @input=${this.stopInner}
@@ -235,7 +256,7 @@ let HelixHeadlessDateInput = class HelixHeadlessDateInput extends MixinPickerEdi
235
256
  renderTag(date) {
236
257
  return html `<${this.tag('tag')}
237
258
  part="date"
238
- exportparts="dismiss: date-dismiss, dismiss-mark: date-dismiss-mark, label: date-label, start: date-start"
259
+ exportparts="cell: date-cell, dismiss: date-dismiss, dismiss-mark: date-dismiss-mark, label: date-label, link: date-link, start: date-start"
239
260
  dismissible
240
261
  dismiss-label=${fillTemplate(this.removeLabel, { name: this.written(date) })}
241
262
  ?disabled=${this.isDisabled}
@@ -257,29 +278,31 @@ let HelixHeadlessDateInput = class HelixHeadlessDateInput extends MixinPickerEdi
257
278
  ${this.mode === 'multiple'
258
279
  ? this.renderTokenRow(this.shownDates.map((date) => this.renderTag(date)), this.restCount)
259
280
  : nothing}
260
- <input
261
- part="control"
262
- id=${this.controlId}
263
- type="text"
264
- .value=${this.display}
265
- name=${this.name || nothing}
266
- placeholder=${this.mode === 'multiple' && dates(this.value).length > 0
267
- ? nothing
268
- : this.placeholder || nothing}
269
- autocomplete=${this.autocomplete || nothing}
270
- inputmode="numeric"
271
- aria-describedby=${this.describedBy ?? nothing}
272
- aria-invalid=${this.invalidity ?? nothing}
273
- ?disabled=${this.isDisabled}
274
- ?readonly=${this.readOnly}
275
- ?required=${this.required}
276
- @blur=${this.handleBlur}
277
- @change=${this.handleCommit}
278
- @focus=${this.handleFocus}
279
- @input=${this.handleInput}
280
- @keydown=${this.handleDraftKey}
281
- @keypress=${this.handleKeypress}
282
- />
281
+ ${this.segmentsShown
282
+ ? this.renderSegments()
283
+ : html `<input
284
+ part="control"
285
+ id=${this.controlId}
286
+ type="text"
287
+ .value=${this.display}
288
+ name=${this.name || nothing}
289
+ placeholder=${this.mode === 'multiple' && dates(this.value).length > 0
290
+ ? nothing
291
+ : this.placeholder || nothing}
292
+ autocomplete=${this.autocomplete || nothing}
293
+ inputmode="numeric"
294
+ aria-describedby=${this.describedBy ?? nothing}
295
+ aria-invalid=${this.invalidity ?? nothing}
296
+ ?disabled=${this.isDisabled}
297
+ ?readonly=${this.readOnly}
298
+ ?required=${this.required}
299
+ @blur=${this.handleBlur}
300
+ @change=${this.handleCommit}
301
+ @focus=${this.handleFocus}
302
+ @input=${this.handleInput}
303
+ @keydown=${this.handleDraftKey}
304
+ @keypress=${this.handleKeypress}
305
+ />`}
283
306
  <button
284
307
  part="trigger"
285
308
  type="button"
@@ -330,6 +353,9 @@ __decorate([
330
353
  __decorate([
331
354
  property({ attribute: 'date-style' })
332
355
  ], HelixHeadlessDateInput.prototype, "dateStyle", void 0);
356
+ __decorate([
357
+ property({ attribute: false })
358
+ ], HelixHeadlessDateInput.prototype, "dayContent", void 0);
333
359
  __decorate([
334
360
  property({ attribute: 'disable-dates' })
335
361
  ], HelixHeadlessDateInput.prototype, "disableDates", void 0);
@@ -339,12 +365,18 @@ __decorate([
339
365
  __decorate([
340
366
  property({ attribute: 'first-day-of-week', type: Number })
341
367
  ], HelixHeadlessDateInput.prototype, "firstDayOfWeek", void 0);
368
+ __decorate([
369
+ property({ attribute: false })
370
+ ], HelixHeadlessDateInput.prototype, "isDateUnavailable", void 0);
342
371
  __decorate([
343
372
  property()
344
373
  ], HelixHeadlessDateInput.prototype, "locale", void 0);
345
374
  __decorate([
346
375
  property()
347
376
  ], HelixHeadlessDateInput.prototype, "max", void 0);
377
+ __decorate([
378
+ property({ attribute: 'max-view' })
379
+ ], HelixHeadlessDateInput.prototype, "maxView", void 0);
348
380
  __decorate([
349
381
  property()
350
382
  ], HelixHeadlessDateInput.prototype, "min", void 0);
@@ -357,15 +389,30 @@ __decorate([
357
389
  __decorate([
358
390
  state()
359
391
  ], HelixHeadlessDateInput.prototype, "fitted", void 0);
392
+ __decorate([
393
+ property({ attribute: 'month-view-label' })
394
+ ], HelixHeadlessDateInput.prototype, "monthViewLabel", void 0);
360
395
  __decorate([
361
396
  property({ attribute: 'next-label' })
362
397
  ], HelixHeadlessDateInput.prototype, "nextLabel", void 0);
398
+ __decorate([
399
+ property({ attribute: 'next-year-label' })
400
+ ], HelixHeadlessDateInput.prototype, "nextYearLabel", void 0);
401
+ __decorate([
402
+ property({ attribute: 'next-years-label' })
403
+ ], HelixHeadlessDateInput.prototype, "nextYearsLabel", void 0);
363
404
  __decorate([
364
405
  property()
365
406
  ], HelixHeadlessDateInput.prototype, "placeholder", void 0);
366
407
  __decorate([
367
408
  property({ attribute: 'previous-label' })
368
409
  ], HelixHeadlessDateInput.prototype, "previousLabel", void 0);
410
+ __decorate([
411
+ property({ attribute: 'previous-year-label' })
412
+ ], HelixHeadlessDateInput.prototype, "previousYearLabel", void 0);
413
+ __decorate([
414
+ property({ attribute: 'previous-years-label' })
415
+ ], HelixHeadlessDateInput.prototype, "previousYearsLabel", void 0);
369
416
  __decorate([
370
417
  property({ attribute: 'range-length-message' })
371
418
  ], HelixHeadlessDateInput.prototype, "rangeLengthMessage", void 0);
@@ -393,6 +440,9 @@ __decorate([
393
440
  __decorate([
394
441
  property({ attribute: 'unavailable-message' })
395
442
  ], HelixHeadlessDateInput.prototype, "unavailableMessage", void 0);
443
+ __decorate([
444
+ property({ attribute: 'year-view-label' })
445
+ ], HelixHeadlessDateInput.prototype, "yearViewLabel", void 0);
396
446
  HelixHeadlessDateInput = __decorate([
397
447
  customElement('helix-headless-date-input')
398
448
  ], HelixHeadlessDateInput);
@@ -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.