@pglejzer/datepicker-ui 1.0.0 → 1.1.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/dist/esm/kit.d.ts CHANGED
@@ -1,15 +1,15 @@
1
- import { A as SurfaceMode, F as formatHint, I as resolvePattern, L as DatePart, M as FormatPattern, N as HintLetters, P as formatDate, U as PlainDate, j as FormatOption, z as CalendarMode } from "./shared.js";
2
- //#region src/managers/renderers/SurfaceHost.d.ts
1
+ import { $ as PlainDate, B as formatHint, G as formatFullDate, H as DatePart, I as FormatOption, J as weekdayNames, K as formatMonthYear, L as FormatPattern, R as HintLetters, U as FullDateOptions, V as resolvePattern, W as WeekStartOption, Y as CalendarMode, et as Weekday, q as resolveWeekStart, tt as YearMonth, u as ThemeName, z as formatDate } from "./shared.js";
2
+ type SurfaceMode = "docked" | "modal" | "inline";
3
3
  interface SurfaceHost {
4
4
  readonly root: HTMLElement;
5
5
  readonly body: HTMLElement;
6
6
  open(): Promise<void>;
7
7
  close(): Promise<void>;
8
8
  destroy(): void;
9
+ /** Renames the surface by the constructor's rule: a non-empty `labelledBy` sets `aria-labelledby` and removes `aria-label`; otherwise `label` becomes the `aria-label` and `aria-labelledby` is removed. */
10
+ setLabel(label: string, labelledBy?: string): void;
9
11
  }
10
12
  export declare function waitForExit(element: HTMLElement): Promise<void>;
11
- //#endregion
12
- //#region src/managers/renderers/DialogHost.d.ts
13
13
  export declare class DialogHost implements SurfaceHost {
14
14
  readonly root: HTMLElement;
15
15
  readonly body: HTMLElement;
@@ -24,35 +24,36 @@ export declare class DialogHost implements SurfaceHost {
24
24
  constructor(options: {
25
25
  parent: HTMLElement;
26
26
  label: string;
27
+ /** Id, or space-separated ids, of a visible title that names the surface. When set, the root gets `aria-labelledby` and no `aria-label`. */
28
+ labelledBy?: string;
27
29
  allowPageScroll: boolean;
28
30
  onCancel(reason: "escape" | "outside"): void;
29
31
  });
30
32
  open(): Promise<void>;
31
33
  close(): Promise<void>;
32
34
  destroy(): void;
35
+ setLabel(label: string, labelledBy?: string): void;
33
36
  private unlock;
34
37
  }
35
- //#endregion
36
- //#region src/managers/renderers/InlineHost.d.ts
37
38
  export declare class InlineHost implements SurfaceHost {
38
39
  readonly root: HTMLElement;
39
40
  readonly body: HTMLElement;
40
41
  constructor(options: {
41
42
  container: HTMLElement;
42
43
  label: string;
44
+ /** Id, or space-separated ids, of a visible title that names the surface. When set, the root gets `aria-labelledby` and no `aria-label`. */
45
+ labelledBy?: string;
43
46
  });
44
47
  open(): Promise<void>;
45
48
  close(): Promise<void>;
46
49
  destroy(): void;
50
+ setLabel(label: string, labelledBy?: string): void;
47
51
  }
48
- //#endregion
49
- //#region src/managers/renderers/PopoverHost.d.ts
50
52
  export declare class PopoverHost implements SurfaceHost {
51
53
  readonly root: HTMLElement;
52
54
  readonly body: HTMLElement;
53
55
  private readonly anchor;
54
56
  private readonly anchorName;
55
- private readonly rtl;
56
57
  private readonly fallback;
57
58
  private readonly controller;
58
59
  private stopTracking;
@@ -68,6 +69,8 @@ export declare class PopoverHost implements SurfaceHost {
68
69
  instanceId: string;
69
70
  rtl: boolean;
70
71
  label: string;
72
+ /** Id, or space-separated ids, of a visible title that names the surface. When set, the root gets `aria-labelledby` and no `aria-label`. */
73
+ labelledBy?: string;
71
74
  inside: readonly HTMLElement[];
72
75
  ignoreOutsideClick: boolean;
73
76
  onOutside(): void;
@@ -76,26 +79,116 @@ export declare class PopoverHost implements SurfaceHost {
76
79
  open(): Promise<void>;
77
80
  close(): Promise<void>;
78
81
  destroy(): void;
82
+ setLabel(label: string, labelledBy?: string): void;
79
83
  private endTracking;
80
84
  private show;
81
85
  private hide;
82
86
  private enableFallback;
83
87
  private update;
84
88
  }
85
- //#endregion
86
- //#region src/utils/surface.d.ts
89
+ export declare const createTextButton: (modifier: string, label: string) => HTMLButtonElement;
90
+ interface PagerOptions<K> {
91
+ /** Right-to-left: dragging left goes back. */
92
+ readonly rtl: boolean;
93
+ /** Drag and wheel paging. */
94
+ readonly swipe: boolean;
95
+ /** Slide animation. Reduced motion turns it into a fade. */
96
+ readonly animate: boolean;
97
+ /** Sets the pager height to the shown page through `pageHeight`. Default `false`. */
98
+ readonly fitHeight?: boolean;
99
+ /** Builds the page for `key`. */
100
+ renderPage(key: K): HTMLElement;
101
+ /** Height of the page for `key`, used with `fitHeight`. */
102
+ pageHeight?(key: K): number;
103
+ /** The key one page before (`-1`) or after (`1`) `key`. */
104
+ step(key: K, direction: -1 | 1): K;
105
+ /** Whether two keys name the same page. */
106
+ isSame(a: K, b: K): boolean;
107
+ /** A drag or wheel gesture finished on a neighbour page. Call `slide()` to show it. */
108
+ onCommit(direction: -1 | 1, source: "drag" | "wheel"): void;
109
+ }
110
+ export declare class Pager<K> {
111
+ private readonly viewport;
112
+ private readonly options;
113
+ private readonly track;
114
+ private readonly controller;
115
+ private readonly previousTouchAction;
116
+ private readonly strip;
117
+ private readonly animator;
118
+ private drag;
119
+ private wheel;
120
+ private resizeObserver;
121
+ private observedWidth;
122
+ private offset;
123
+ private revision;
124
+ constructor(viewport: HTMLElement, options: PagerOptions<K>);
125
+ /** Shows `key` without animation. */
126
+ show(key: K): void;
127
+ /** Slides to `key` in `direction`. */
128
+ slide(key: K, direction: -1 | 1): void;
129
+ /** Ends a running slide at once. */
130
+ finish(): void;
131
+ destroy(): void;
132
+ private get destroyed();
133
+ private enableSwipe;
134
+ private observeWidth;
135
+ private cancelGestures;
136
+ private release;
137
+ private settle;
138
+ private fitHeight;
139
+ private rest;
140
+ private setOffset;
141
+ private transformFor;
142
+ private pageWidth;
143
+ }
87
144
  export declare const resolveSurfaceMode: (option: "auto" | "docked" | "modal", inlineEnabled: boolean, viewportWidth: number, viewportHeight: number) => SurfaceMode;
88
145
  export declare const isFullscreenRange: (mode: CalendarMode, surface: SurfaceMode, viewportWidth: number, fullscreenBelow: number) => boolean;
89
- //#endregion
90
- //#region src/utils/colorScheme.d.ts
146
+ /**
147
+ * Whether a docked surface fits the window entirely below its anchor or
148
+ * entirely above it, keeping an 8 px margin to the window edge. These are
149
+ * the two sides the popover tries, below first. The anchor is measured where
150
+ * it is now, so call it while the surface is shown.
151
+ */
152
+ export declare function fitsViewport(root: HTMLElement, anchor: HTMLElement): boolean;
91
153
  type Scheme = "light" | "dark";
92
154
  export declare function detectColorScheme(from: HTMLElement): Scheme;
93
155
  export declare function watchColorScheme(onChange: () => void): () => void;
94
- //#endregion
95
- //#region src/utils/date/mask.d.ts
156
+ /** Theme settings for a surface root. */
157
+ interface SurfaceTheme {
158
+ /** Theme name, written to `data-theme`. */
159
+ readonly theme: ThemeName;
160
+ /** Resolved scheme, written to `data-color-scheme`. For `"auto"` use `detectColorScheme()`. */
161
+ readonly colorScheme: Scheme;
162
+ /** Extra classes, like `ui.cssClass`. Classes from the previous call are removed. */
163
+ readonly className?: string;
164
+ /** Right-to-left: toggles `dp-ui__container--rtl` on the surface container. */
165
+ readonly rtl?: boolean;
166
+ }
167
+ /** Applies theme settings to a surface root (`host.root`). Safe to call again. */
168
+ export declare function applyTheme(root: HTMLElement, theme: SurfaceTheme): void;
96
169
  export declare function maskDateText(text: string, pattern: FormatPattern): string;
97
- //#endregion
98
- //#region src/utils/date/parse.d.ts
170
+ /**
171
+ * Length of the date at the start of `text`, in characters of `text` as
172
+ * given: the index just after the last digit group `pattern` expects, or the
173
+ * separator before the next group. A separator after the last group is not
174
+ * part of the date. Bidi marks, locale digits and characters the mask skips
175
+ * count as written. Returns 0 when `text` holds no digit.
176
+ */
177
+ export declare function leadingDateLength(text: string, pattern: FormatPattern): number;
178
+ /**
179
+ * Whether `text` starts with a whole date: every group `pattern` expects is
180
+ * there and the last one has all its digits. A separator closes an earlier
181
+ * group, so `1.5.2026` is complete. Text after the date is ignored.
182
+ */
183
+ export declare function isDateTextComplete(text: string, pattern: FormatPattern): boolean;
184
+ /** Maps Arabic-Indic and Persian digits to Latin digits, drops bidi marks and trims. */
185
+ export declare function normalizeDigits(text: string): string;
99
186
  export declare function parseDate(text: string, pattern: FormatPattern): PlainDate | null;
100
- //#endregion
101
- export { type DatePart, type FormatOption, type FormatPattern, type HintLetters, type PlainDate, type Scheme, type SurfaceHost, type SurfaceMode, formatDate, formatHint, resolvePattern };
187
+ export declare const RANGE_SEPARATOR = " – ";
188
+ /**
189
+ * Splits range text into its start and end text the way the picker does:
190
+ * at an en or em dash with optional spaces, or at a hyphen with spaces
191
+ * around it. Returns `null` unless the text splits into exactly two parts.
192
+ */
193
+ export declare function splitRangeText(text: string): readonly [string, string] | null;
194
+ export { type DatePart, type FormatOption, type FormatPattern, type FullDateOptions, type HintLetters, type PagerOptions, type PlainDate, type Scheme, type SurfaceHost, type SurfaceMode, type SurfaceTheme, type ThemeName, type WeekStartOption, type Weekday, type YearMonth, formatDate, formatFullDate, formatHint, formatMonthYear, resolvePattern, resolveWeekStart, weekdayNames };
package/dist/esm/kit.js CHANGED
@@ -1 +1 @@
1
- export{i as DialogHost,r as InlineHost,n as PopoverHost,l as detectColorScheme,b as formatDate,x as formatHint,E as isFullscreenRange,t as maskDateText,_ as parseDate,w as resolvePattern,D as resolveSurfaceMode,a as waitForExit,u as watchColorScheme}from"./shared.js";
1
+ export{i as DialogHost,r as InlineHost,o as Pager,n as PopoverHost,b as RANGE_SEPARATOR,t as applyTheme,h as createTextButton,k as detectColorScheme,y as fitsViewport,it as formatDate,G as formatFullDate,at as formatHint,q as formatMonthYear,c as isDateTextComplete,St as isFullscreenRange,l as leadingDateLength,u as maskDateText,U as normalizeDigits,W as parseDate,ct as resolvePattern,Ct as resolveSurfaceMode,tt as resolveWeekStart,T as splitRangeText,a as waitForExit,A as watchColorScheme,nt as weekdayNames}from"./shared.js";
@@ -1,22 +1,31 @@
1
- //#region src/types/date.d.ts
2
1
  interface PlainDate {
3
2
  readonly year: number;
4
3
  readonly month: number;
5
4
  readonly day: number;
6
5
  }
6
+ interface YearMonth {
7
+ readonly year: number;
8
+ readonly month: number;
9
+ }
7
10
  type DateInput = Date | string;
8
- //#endregion
9
- //#region src/types/selection.d.ts
11
+ type Weekday = 0 | 1 | 2 | 3 | 4 | 5 | 6;
10
12
  type CalendarMode = "single" | "range" | "multiple";
11
13
  type Precision = "day" | "month" | "year";
12
14
  type PageBy = "month" | "view";
13
15
  type RangeEnd = "start" | "end";
14
- //#endregion
15
- //#region src/utils/date/intl.d.ts
16
16
  type WeekStartOption = "auto" | "sunday" | "monday" | "saturday";
17
17
  type DatePart = "day" | "month" | "year";
18
- //#endregion
19
- //#region src/utils/date/format.d.ts
18
+ declare function weekdayNames(locale: string, width: "long" | "short" | "narrow"): readonly string[];
19
+ interface FullDateOptions {
20
+ /**
21
+ * `false` leaves the year out, e.g. "Wednesday, October 21".
22
+ * @default true
23
+ */
24
+ readonly year?: boolean;
25
+ }
26
+ declare function formatFullDate(date: PlainDate, locale: string, options?: FullDateOptions): string;
27
+ declare function formatMonthYear(view: YearMonth, locale: string): string;
28
+ declare function resolveWeekStart(locale: string, option: WeekStartOption): Weekday;
20
29
  type FormatOption = "auto" | (string & Record<never, never>);
21
30
  interface FormatPattern {
22
31
  readonly order: readonly DatePart[];
@@ -33,13 +42,6 @@ interface HintLetters {
33
42
  }
34
43
  declare function formatHint(pattern: FormatPattern, letters?: HintLetters): string;
35
44
  declare function formatDate(date: PlainDate, pattern: FormatPattern): string;
36
- //#endregion
37
- //#region src/types/internal.d.ts
38
- type SurfaceMode = "docked" | "modal" | "inline";
39
- type NavigateSource = "drag" | "wheel" | "button" | "keyboard" | "menu" | "api";
40
- type CancelReason = "button" | "escape" | "outside";
41
- //#endregion
42
- //#region src/types/types.d.ts
43
45
  /** A committed date in every representation the consumer may need. */
44
46
  interface DateValue {
45
47
  /**
@@ -62,11 +64,13 @@ interface RangeValue {
62
64
  }
63
65
  /** The committed value: a day (`single`), a range (`range`) or the sorted days (`multiple`). */
64
66
  type PickerValue = DateValue | RangeValue | readonly DateValue[];
65
- /** Accepted by `setValue()`; the shape has to match `calendar.mode`. */
67
+ /** Accepted by `setValue()`; the shape has to match `calendar.mode`. Any date can be `"today"`. */
66
68
  type PickerValueInput = DateInput | {
67
69
  readonly start: DateInput;
68
70
  readonly end: DateInput;
69
71
  } | readonly DateInput[];
72
+ /** Which view a picker shows: the calendar or the text fields. */
73
+ type PickerView = "calendar" | "input";
70
74
  /** Payload of the `open` event. */
71
75
  interface OpenEventData {
72
76
  /** The surface that was opened. */
@@ -74,9 +78,14 @@ interface OpenEventData {
74
78
  }
75
79
  /** Payload of the `close` event. */
76
80
  type CloseEventData = Record<string, never>;
81
+ type CancelReason = "button" | "escape" | "outside" | "toggle";
77
82
  /** Payload of the `cancel` event. */
78
83
  interface CancelEventData {
79
- /** What dismissed the picker without committing. */
84
+ /**
85
+ * What dismissed the picker without committing: `"button"` (the Cancel or
86
+ * close button), `"escape"`, `"outside"` (a click outside a docked picker or
87
+ * on the modal backdrop) or `"toggle"` (`ui.toggleButton` on an open picker).
88
+ */
80
89
  reason: CancelReason;
81
90
  }
82
91
  /** Payload of the `confirm` event. */
@@ -94,7 +103,7 @@ interface UpdateEventData {
94
103
  /** Payload of the `select:day` event. */
95
104
  interface SelectDayEventData {
96
105
  /**
97
- * The day the user picked (not yet committed in modal flow). With
106
+ * The day the user picked or typed (not yet committed in modal flow). With
98
107
  * `calendar.precision` `"month"` or `"year"` it is the picked month or year,
99
108
  * as its first day (`value.value` is `YYYY-MM` or `YYYY`).
100
109
  */
@@ -104,7 +113,7 @@ interface SelectDayEventData {
104
113
  }
105
114
  /** Payload of the `range:start` event. */
106
115
  interface RangeStartEventData {
107
- /** The first day of the range that was just picked. */
116
+ /** The first day of the range that was just picked or typed. */
108
117
  value: DateValue;
109
118
  }
110
119
  /** Payload of the `range:end` event. */
@@ -126,16 +135,50 @@ interface SelectYearEventData {
126
135
  /** Chosen year. */
127
136
  year: number;
128
137
  }
138
+ /** The first and last day a picker shows. */
139
+ interface VisibleRange {
140
+ /** First day shown, at day precision (`value` is `YYYY-MM-DD`). */
141
+ readonly from: DateValue;
142
+ /** Last day shown, at day precision. */
143
+ readonly to: DateValue;
144
+ }
145
+ /** What moved the shown days. */
146
+ type NavigateSource = "drag" | "wheel" | "button" | "keyboard" | "menu" | "open" | "api" | "resize" | "scroll";
129
147
  /** Payload of the `navigate` event. */
130
148
  interface NavigateEventData {
131
- /** Year of the first month now displayed. */
149
+ /** Year of the first month shown. */
132
150
  year: number;
133
- /** First month now displayed, 1-12 (with `calendar.months` above 1 it is the first of the months shown). */
151
+ /** First month shown, 1-12. */
134
152
  month: number;
135
- /** `-1` backwards, `1` forwards, `0` for a jump that keeps the month. */
153
+ /** `-1` backwards, `1` forwards, `0` when the first month shown stays. */
136
154
  direction: -1 | 0 | 1;
137
- /** What caused the navigation. `setValue()` and `open()` move the view without this event. */
138
- source: Exclude<NavigateSource, "api">;
155
+ /**
156
+ * What changed the shown days: a user action (`drag`, `wheel`, `button`,
157
+ * `keyboard`, `menu`), opening or mounting the picker (`open`), `setValue()`,
158
+ * `setOptions()`, `goTo()` or a value the picker sets itself, such as a
159
+ * range preset or a typed date (`api`), a window resize that changes the
160
+ * months shown (`resize`), or the range month list rendering more months
161
+ * (`scroll`).
162
+ */
163
+ source: NavigateSource;
164
+ /** First day shown. */
165
+ from: DateValue;
166
+ /** Last day shown. */
167
+ to: DateValue;
168
+ }
169
+ /**
170
+ * Payload of the `clear` event, fired by `clear()` and the Clear button.
171
+ * `clear()` also fires `input` and `change` on the input. `setValue(null)`
172
+ * empties the value quietly, without either.
173
+ */
174
+ interface ClearEventData {
175
+ /** The value before clearing, or the draft when only the draft was cleared. */
176
+ previousValue: PickerValue | null;
177
+ }
178
+ /** Payload of the `switch:view` event. */
179
+ interface SwitchViewEventData {
180
+ /** The view now shown. */
181
+ view: PickerView;
139
182
  }
140
183
  /** Why a date cannot be selected, in the order the rules are checked. */
141
184
  type UnavailableReason = "min" | "max" | "disabled" | "weekday" | "range-length" | "multiple-max";
@@ -166,9 +209,9 @@ interface DatepickerEventMap {
166
209
  "range:start": RangeStartEventData;
167
210
  "range:end": RangeEndEventData;
168
211
  navigate: NavigateEventData;
212
+ "switch:view": SwitchViewEventData;
213
+ clear: ClearEventData;
169
214
  }
170
- //#endregion
171
- //#region src/types/options.d.ts
172
215
  /** Built-in theme names. */
173
216
  type ThemeName = "basic" | "m3-green" | "crane" | "crane-straight" | "m2" | "glassmorphic" | "pastel" | "ai" | "cyberpunk" | "blueprint";
174
217
  /** A label that is a plain string or a map from `Intl.PluralRules` categories to strings. `{count}` is replaced by the number. */
@@ -203,6 +246,15 @@ interface CalendarOptions {
203
246
  * @default "single"
204
247
  */
205
248
  mode?: CalendarMode;
249
+ /**
250
+ * Starting value for an empty input, in the shape of `setValue()`: a date,
251
+ * `{ start, end }` or an array of dates, matching `calendar.mode`. Any date
252
+ * can be `"today"`. Text already in the input wins when it is a date (with
253
+ * `ui.endInput`, the two fields). The value is written to the input and the
254
+ * form field, and a form reset restores it. Read when `create()` runs.
255
+ * @default undefined
256
+ */
257
+ defaultValue?: PickerValueInput;
206
258
  /**
207
259
  * What one selection is: a day, a month or a year. With `"month"` the value
208
260
  * is `YYYY-MM` and with `"year"` it is `YYYY`, both standing for the first
@@ -214,8 +266,9 @@ interface CalendarOptions {
214
266
  precision?: Precision;
215
267
  /**
216
268
  * How many months are shown side by side, a positive integer. Applies to
217
- * the docked and inline surfaces and to day precision, as many as fit the
218
- * width at open (up to this number). A modal shows one month.
269
+ * the docked look (`ui.layout`) at day precision, as many as fit the width
270
+ * at open (up to this number). The modal and full-screen looks show one
271
+ * month.
219
272
  * @default 1
220
273
  */
221
274
  months?: number;
@@ -318,6 +371,19 @@ interface UIOptions {
318
371
  * @default "auto"
319
372
  */
320
373
  displayMode?: "auto" | "docked" | "modal";
374
+ /**
375
+ * The look of the calendar on any surface. `"auto"` gives each surface its
376
+ * own look: docked for the popover and inline, modal for the dialog (full
377
+ * screen for a range below `ui.fullscreen`). `"docked"` uses the docked
378
+ * header with month and year menus everywhere. `"modal"` uses the headline,
379
+ * a month row with arrows on every page, and month and year grids
380
+ * everywhere. `"fullscreen"` gives a range picker the full-screen layout: in
381
+ * a dialog at every window width, inline sized to the container. Other
382
+ * modes, and the popover, treat it as `"modal"`. An inline calendar with the
383
+ * modal look fits its rows to the month unless `ui.fixedWeeks` is set.
384
+ * @default "auto"
385
+ */
386
+ layout?: "auto" | "docked" | "modal" | "fullscreen";
321
387
  /**
322
388
  * Render the calendar permanently into a container instead of opening it.
323
389
  * `container` is a selector or an element.
@@ -326,6 +392,26 @@ interface UIOptions {
326
392
  inline?: {
327
393
  enabled?: boolean;
328
394
  container?: string | HTMLElement;
395
+ /**
396
+ * `false` leaves out the headline (the modal title, selected value and
397
+ * view switch, or the range header), for a host that shows its own. The
398
+ * full-screen top bar keeps its close and save buttons.
399
+ * @default true
400
+ */
401
+ headline?: boolean;
402
+ /**
403
+ * `"caption"` shows the month and year as plain text next to the arrows,
404
+ * with no month or year menus. Day precision only.
405
+ * @default "menus"
406
+ */
407
+ navigation?: "menus" | "caption";
408
+ /**
409
+ * `false` stops the inline calendar from announcing selection changes, for
410
+ * a host that announces them itself. Month changes and errors are still
411
+ * announced.
412
+ * @default true
413
+ */
414
+ announceSelection?: boolean;
329
415
  };
330
416
  /**
331
417
  * `auto` follows the locale's numeric order and separators; otherwise a
@@ -354,11 +440,12 @@ interface UIOptions {
354
440
  */
355
441
  colorScheme?: "auto" | "light" | "dark";
356
442
  /**
357
- * Range pickers in a modal open full screen below this window width:
443
+ * Range pickers in a dialog open full screen below this window width:
358
444
  * `true` below 600 px, a number below that many px (for example 840), `false`
359
445
  * never. With `displayMode: "auto"` the surface is docked from 600 px, so a
360
- * value above 600 only matters with `displayMode: "modal"`. Decided when the
361
- * picker opens.
446
+ * value above 600 only matters with `displayMode: "modal"`. Used with
447
+ * `ui.layout` `"auto"` and `"modal"`. `"fullscreen"` opens full screen at
448
+ * every width and `"docked"` never does. Decided when the picker opens.
362
449
  * @default true
363
450
  */
364
451
  fullscreen?: boolean | number;
@@ -443,19 +530,21 @@ interface UIOptions {
443
530
  swipe?: boolean;
444
531
  /**
445
532
  * Show the button that switches between the calendar and the text input
446
- * view, where the mode and surface support it.
533
+ * view, where the mode and look support it.
447
534
  * @default true
448
535
  */
449
536
  viewSwitch?: boolean;
450
537
  /**
451
- * View shown when the picker opens, where the mode and surface support the
452
- * input view.
538
+ * View shown when the picker opens, where the input view exists: every
539
+ * range picker, and a single picker with the modal or full-screen look
540
+ * (`ui.layout`), at day precision.
453
541
  * @default "calendar"
454
542
  */
455
- initialView?: "calendar" | "input";
543
+ initialView?: PickerView;
456
544
  /**
457
545
  * Mask the text typed into the input to `ui.format` (digits only, separators added).
458
546
  * Single mode and the split range fields (`ui.endInput`), day precision only.
547
+ * The fields of the picker's input view are always masked.
459
548
  * @default false
460
549
  */
461
550
  mask?: boolean;
@@ -471,8 +560,9 @@ interface UIOptions {
471
560
  endInput?: string | HTMLElement;
472
561
  /**
473
562
  * First calendar panel when the picker opens: the day grid, the month list
474
- * (docked, inline) or grid (modal), or the year list or grid. `initialView:
475
- * "input"` wins; ignored in `range` mode and when `calendar.precision` is not
563
+ * (docked look) or grid (modal look), or the year list or grid.
564
+ * `initialView: "input"` wins. Ignored in `range` mode, with
565
+ * `ui.inline.navigation: "caption"` and when `calendar.precision` is not
476
566
  * `"day"`.
477
567
  * @default "day"
478
568
  */
@@ -585,6 +675,12 @@ interface LabelsOptions {
585
675
  * @default "End"
586
676
  */
587
677
  rangeEnd?: string;
678
+ /**
679
+ * Added to the accessible name of the days between the start and the end of
680
+ * a range.
681
+ * @default "In range"
682
+ */
683
+ inRange?: string;
588
684
  /**
589
685
  * Headline in `multiple` mode; `{count}` is the number of selected days.
590
686
  * @default "{count} selected"
@@ -724,18 +820,22 @@ interface CallbacksOptions {
724
820
  onUpdate?: (data: UpdateEventData) => void;
725
821
  /** Called for invalid typed dates and rejected options. */
726
822
  onError?: (data: ErrorEventData) => void;
727
- /** Called when a day is picked. */
823
+ /** Called when a day is picked, or typed in the text fields. */
728
824
  onSelectDay?: (data: SelectDayEventData) => void;
729
825
  /** Called when a month is chosen in the month menu. */
730
826
  onSelectMonth?: (data: SelectMonthEventData) => void;
731
827
  /** Called when a year is chosen. */
732
828
  onSelectYear?: (data: SelectYearEventData) => void;
733
- /** Called when the first day of a range is picked. */
829
+ /** Called when the first day of a range is picked or typed. */
734
830
  onRangeStart?: (data: RangeStartEventData) => void;
735
831
  /** Called when the range is completed. */
736
832
  onRangeEnd?: (data: RangeEndEventData) => void;
737
- /** Called when the displayed month changes. */
833
+ /** Called when the days shown change, and once when the picker is opened or mounted. */
738
834
  onNavigate?: (data: NavigateEventData) => void;
835
+ /** Called when the picker switches between the calendar and the text fields. */
836
+ onSwitchView?: (data: SwitchViewEventData) => void;
837
+ /** Called when `clear()` or the Clear button clears the value or the draft. */
838
+ onClear?: (data: ClearEventData) => void;
739
839
  }
740
840
  /** Options accepted by the `DatepickerUI` constructor and `setOptions()`. */
741
841
  interface DatepickerOptions {
@@ -750,5 +850,4 @@ interface DatepickerOptions {
750
850
  /** Event callbacks. */
751
851
  callbacks?: CallbacksOptions;
752
852
  }
753
- //#endregion
754
- export { SurfaceMode as A, PageBy as B, RangeStartEventData as C, SelectYearEventData as D, SelectMonthEventData as E, formatHint as F, RangeEnd as H, resolvePattern as I, DatePart as L, FormatPattern as M, HintLetters as N, UnavailableReason as O, formatDate as P, WeekStartOption as R, RangeEndEventData as S, SelectDayEventData as T, PlainDate as U, Precision as V, ErrorEventData as _, DatepickerOptions as a, PickerValue as b, RangePreset as c, UIOptions as d, CancelEventData as f, DatepickerEventMap as g, DateValue as h, DateDecoration as i, FormatOption as j, UpdateEventData as k, RangePresetValue as l, ConfirmEventData as m, CalendarOptions as n, LabelsOptions as o, CloseEventData as p, CallbacksOptions as r, PluralLabel as s, BehaviorOptions as t, ThemeName as u, NavigateEventData as v, RangeValue as w, PickerValueInput as x, OpenEventData as y, CalendarMode as z };
853
+ export { PlainDate as $, SelectMonthEventData as A, formatHint as B, PickerValue as C, RangeStartEventData as D, RangeEndEventData as E, VisibleRange as F, formatFullDate as G, DatePart as H, FormatOption as I, weekdayNames as J, formatMonthYear as K, FormatPattern as L, SwitchViewEventData as M, UnavailableReason as N, RangeValue as O, UpdateEventData as P, RangeEnd as Q, HintLetters as R, OpenEventData as S, PickerView as T, FullDateOptions as U, resolvePattern as V, WeekStartOption as W, PageBy as X, CalendarMode as Y, Precision as Z, DateValue as _, DatepickerOptions as a, NavigateEventData as b, RangePreset as c, UIOptions as d, Weekday as et, CancelEventData as f, ConfirmEventData as g, CloseEventData as h, DateDecoration as i, SelectYearEventData as j, SelectDayEventData as k, RangePresetValue as l, ClearEventData as m, CalendarOptions as n, LabelsOptions as o, CancelReason as p, resolveWeekStart as q, CallbacksOptions as r, PluralLabel as s, BehaviorOptions as t, YearMonth as tt, ThemeName as u, DatepickerEventMap as v, PickerValueInput as w, NavigateSource as x, ErrorEventData as y, formatDate as z };