@pglejzer/datepicker-ui 0.0.1 → 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.
@@ -0,0 +1,853 @@
1
+ interface PlainDate {
2
+ readonly year: number;
3
+ readonly month: number;
4
+ readonly day: number;
5
+ }
6
+ interface YearMonth {
7
+ readonly year: number;
8
+ readonly month: number;
9
+ }
10
+ type DateInput = Date | string;
11
+ type Weekday = 0 | 1 | 2 | 3 | 4 | 5 | 6;
12
+ type CalendarMode = "single" | "range" | "multiple";
13
+ type Precision = "day" | "month" | "year";
14
+ type PageBy = "month" | "view";
15
+ type RangeEnd = "start" | "end";
16
+ type WeekStartOption = "auto" | "sunday" | "monday" | "saturday";
17
+ type DatePart = "day" | "month" | "year";
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;
29
+ type FormatOption = "auto" | (string & Record<never, never>);
30
+ interface FormatPattern {
31
+ readonly order: readonly DatePart[];
32
+ readonly separator: string;
33
+ readonly padDay: boolean;
34
+ readonly padMonth: boolean;
35
+ readonly yearDigits: 2 | 4;
36
+ }
37
+ declare function resolvePattern(format: FormatOption, locale: string, precision?: Precision): FormatPattern;
38
+ interface HintLetters {
39
+ readonly day: string;
40
+ readonly month: string;
41
+ readonly year: string;
42
+ }
43
+ declare function formatHint(pattern: FormatPattern, letters?: HintLetters): string;
44
+ declare function formatDate(date: PlainDate, pattern: FormatPattern): string;
45
+ /** A committed date in every representation the consumer may need. */
46
+ interface DateValue {
47
+ /**
48
+ * ISO 8601 calendar date, `YYYY-MM-DD`, whatever the display format is.
49
+ * With `calendar.precision` `"month"` it is `YYYY-MM` and with `"year"` it
50
+ * is `YYYY`.
51
+ */
52
+ readonly value: string;
53
+ /** The same day as a `Date` at local midnight. */
54
+ readonly date: Date;
55
+ /** The date written the way the input shows it (`ui.format`). */
56
+ readonly formatted: string;
57
+ }
58
+ /** A committed complete range. */
59
+ interface RangeValue {
60
+ /** First day of the range. */
61
+ readonly start: DateValue;
62
+ /** Last day of the range, on or after `start`. */
63
+ readonly end: DateValue;
64
+ }
65
+ /** The committed value: a day (`single`), a range (`range`) or the sorted days (`multiple`). */
66
+ type PickerValue = DateValue | RangeValue | readonly DateValue[];
67
+ /** Accepted by `setValue()`; the shape has to match `calendar.mode`. Any date can be `"today"`. */
68
+ type PickerValueInput = DateInput | {
69
+ readonly start: DateInput;
70
+ readonly end: DateInput;
71
+ } | readonly DateInput[];
72
+ /** Which view a picker shows: the calendar or the text fields. */
73
+ type PickerView = "calendar" | "input";
74
+ /** Payload of the `open` event. */
75
+ interface OpenEventData {
76
+ /** The surface that was opened. */
77
+ mode: "docked" | "modal" | "inline";
78
+ }
79
+ /** Payload of the `close` event. */
80
+ type CloseEventData = Record<string, never>;
81
+ type CancelReason = "button" | "escape" | "outside" | "toggle";
82
+ /** Payload of the `cancel` event. */
83
+ interface CancelEventData {
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
+ */
89
+ reason: CancelReason;
90
+ }
91
+ /** Payload of the `confirm` event. */
92
+ interface ConfirmEventData {
93
+ /** The committed value, or `null` when the value was cleared. */
94
+ value: PickerValue | null;
95
+ /** `true` when the commit came from `behavior.closeOnSelect` or `behavior.commitOnChange` instead of the confirm button. */
96
+ autoCommit: boolean;
97
+ }
98
+ /** Payload of the `update` event, fired by `setOptions()`. */
99
+ interface UpdateEventData {
100
+ /** The options patch that was applied. */
101
+ options: DatepickerOptions;
102
+ }
103
+ /** Payload of the `select:day` event. */
104
+ interface SelectDayEventData {
105
+ /**
106
+ * The day the user picked or typed (not yet committed in modal flow). With
107
+ * `calendar.precision` `"month"` or `"year"` it is the picked month or year,
108
+ * as its first day (`value.value` is `YYYY-MM` or `YYYY`).
109
+ */
110
+ value: DateValue;
111
+ /** `false` when a click in `multiple` mode removed the date from the selection. */
112
+ selected: boolean;
113
+ }
114
+ /** Payload of the `range:start` event. */
115
+ interface RangeStartEventData {
116
+ /** The first day of the range that was just picked or typed. */
117
+ value: DateValue;
118
+ }
119
+ /** Payload of the `range:end` event. */
120
+ interface RangeEndEventData {
121
+ /** First day of the completed range. */
122
+ start: DateValue;
123
+ /** Last day of the completed range. */
124
+ end: DateValue;
125
+ }
126
+ /** Payload of the `select:month` event. */
127
+ interface SelectMonthEventData {
128
+ /** Year of the displayed month. */
129
+ year: number;
130
+ /** Chosen month, 1-12. */
131
+ month: number;
132
+ }
133
+ /** Payload of the `select:year` event. */
134
+ interface SelectYearEventData {
135
+ /** Chosen year. */
136
+ year: number;
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";
147
+ /** Payload of the `navigate` event. */
148
+ interface NavigateEventData {
149
+ /** Year of the first month shown. */
150
+ year: number;
151
+ /** First month shown, 1-12. */
152
+ month: number;
153
+ /** `-1` backwards, `1` forwards, `0` when the first month shown stays. */
154
+ direction: -1 | 0 | 1;
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;
182
+ }
183
+ /** Why a date cannot be selected, in the order the rules are checked. */
184
+ type UnavailableReason = "min" | "max" | "disabled" | "weekday" | "range-length" | "multiple-max";
185
+ /** Payload of the `error` event. */
186
+ interface ErrorEventData {
187
+ /** Machine readable reason. `invalid-value` is a message returned by `calendar.validate`. */
188
+ code: "invalid-date" | "unavailable-date" | "invalid-option" | "invalid-value";
189
+ /** Human readable description. */
190
+ message: string;
191
+ /** The text the user typed, for `invalid-date` and `unavailable-date`. */
192
+ input?: string;
193
+ /** Dotted path of the rejected option, for `invalid-option`. */
194
+ option?: string;
195
+ /** Why the typed date is unavailable, for `unavailable-date`. */
196
+ reason?: UnavailableReason;
197
+ }
198
+ /** Public events of a picker instance, keyed by event name. */
199
+ interface DatepickerEventMap {
200
+ open: OpenEventData;
201
+ close: CloseEventData;
202
+ cancel: CancelEventData;
203
+ confirm: ConfirmEventData;
204
+ update: UpdateEventData;
205
+ error: ErrorEventData;
206
+ "select:day": SelectDayEventData;
207
+ "select:month": SelectMonthEventData;
208
+ "select:year": SelectYearEventData;
209
+ "range:start": RangeStartEventData;
210
+ "range:end": RangeEndEventData;
211
+ navigate: NavigateEventData;
212
+ "switch:view": SwitchViewEventData;
213
+ clear: ClearEventData;
214
+ }
215
+ /** Built-in theme names. */
216
+ type ThemeName = "basic" | "m3-green" | "crane" | "crane-straight" | "m2" | "glassmorphic" | "pastel" | "ai" | "cyberpunk" | "blueprint";
217
+ /** A label that is a plain string or a map from `Intl.PluralRules` categories to strings. `{count}` is replaced by the number. */
218
+ type PluralLabel = string | Readonly<Partial<Record<Intl.LDMLPluralRule, string>>>;
219
+ /** Extra presentation of a single day returned by `calendar.decorateDate`. */
220
+ interface DateDecoration {
221
+ /** Class name added to the day cell. */
222
+ className?: string;
223
+ /** Show a small badge dot on the day. */
224
+ badge?: boolean;
225
+ /** Text appended to the accessible name of the day. */
226
+ label?: string;
227
+ }
228
+ /** The two ends of a range preset. */
229
+ interface RangePresetValue {
230
+ /** First day of the range. */
231
+ start: DateInput;
232
+ /** Last day of the range, on or after `start`. */
233
+ end: DateInput;
234
+ }
235
+ /** A ready-made range offered next to the calendar, for example "Last 7 days". */
236
+ interface RangePreset {
237
+ /** Text of the preset button. */
238
+ label: string;
239
+ /** The range, or a function that returns it (called each time the picker refreshes, so "today" stays current). */
240
+ value: RangePresetValue | (() => RangePresetValue);
241
+ }
242
+ /** Which days exist and how the weeks are laid out. */
243
+ interface CalendarOptions {
244
+ /**
245
+ * What the user selects: one day, a range of days or any number of days.
246
+ * @default "single"
247
+ */
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;
258
+ /**
259
+ * What one selection is: a day, a month or a year. With `"month"` the value
260
+ * is `YYYY-MM` and with `"year"` it is `YYYY`, both standing for the first
261
+ * day of the period. Only used in `single` mode (other modes report an
262
+ * `invalid-option` error and use `"day"`). Typed text is masked only at
263
+ * day precision.
264
+ * @default "day"
265
+ */
266
+ precision?: Precision;
267
+ /**
268
+ * How many months are shown side by side, a positive integer. Applies to
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.
272
+ * @default 1
273
+ */
274
+ months?: number;
275
+ /**
276
+ * How far the previous / next arrows, the swipe and the keyboard page move:
277
+ * `"month"` one month, `"view"` as many months as are shown.
278
+ * @default "view"
279
+ */
280
+ pageBy?: PageBy;
281
+ /**
282
+ * Length limits of a range in days, both ends included, and ready-made
283
+ * ranges (`presets`). Only used in `range` mode. Presets show as a column
284
+ * beside the picker when it fits, otherwise as a chip row; clicking one
285
+ * picks the range and follows `behavior.closeOnSelect` and
286
+ * `behavior.commitOnChange`.
287
+ * @default undefined
288
+ */
289
+ range?: {
290
+ minLength?: number;
291
+ maxLength?: number;
292
+ presets?: readonly RangePreset[];
293
+ };
294
+ /**
295
+ * Limits of a multiple selection. Only used in `multiple` mode.
296
+ * @default undefined
297
+ */
298
+ multiple?: {
299
+ max?: number;
300
+ };
301
+ /**
302
+ * Return `true` for a day that cannot be selected, on top of `minDate`,
303
+ * `maxDate`, `disabledDates` and `enabledDates`.
304
+ * @default undefined
305
+ */
306
+ isDateDisabled?: (date: Date) => boolean;
307
+ /**
308
+ * Weekdays that cannot be selected, `0` is Sunday and `6` is Saturday.
309
+ * @default []
310
+ */
311
+ disabledWeekdays?: readonly number[];
312
+ /**
313
+ * Return extra presentation for a day, or `undefined` for none.
314
+ * @default undefined
315
+ */
316
+ decorateDate?: (date: Date) => DateDecoration | undefined;
317
+ /**
318
+ * Content shown inside each day cell, for example a price: a string (text,
319
+ * never HTML), a DOM node, or `null` / `undefined` for none. The text is
320
+ * added to the accessible name of the day.
321
+ * @default undefined
322
+ */
323
+ renderDate?: (date: Date) => string | Node | null | undefined;
324
+ /**
325
+ * Field validity rule run on the presented value (`null` when empty) after
326
+ * `setValue()`, typed input and every commit. Return a message to mark the
327
+ * input invalid (`aria-invalid`, `setCustomValidity`, an `error` event with
328
+ * code `invalid-value`); return `null`, `undefined` or an empty string when
329
+ * the value is fine. It never blocks a pick or a commit.
330
+ * @default undefined
331
+ */
332
+ validate?: (value: PickerValue | null) => string | null | undefined;
333
+ /**
334
+ * BCP 47 locale for month and weekday names, the headline, the input format
335
+ * and the first day of the week. Falls back to `<html lang>`, then
336
+ * `navigator.language`, then `en-US`.
337
+ * @default the page locale
338
+ */
339
+ locale?: string;
340
+ /**
341
+ * First day of the week. `auto` follows the locale.
342
+ * @default "auto"
343
+ */
344
+ weekStart?: WeekStartOption;
345
+ /**
346
+ * Earliest selectable day: a `Date`, an ISO `YYYY-MM-DD` string or `"today"`.
347
+ * @default undefined
348
+ */
349
+ minDate?: DateInput;
350
+ /**
351
+ * Latest selectable day: a `Date`, an ISO `YYYY-MM-DD` string or `"today"`.
352
+ * @default undefined
353
+ */
354
+ maxDate?: DateInput;
355
+ /**
356
+ * Days that cannot be selected.
357
+ * @default []
358
+ */
359
+ disabledDates?: readonly DateInput[];
360
+ /**
361
+ * When set, only these days can be selected.
362
+ * @default undefined
363
+ */
364
+ enabledDates?: readonly DateInput[];
365
+ }
366
+ /** Presentation and display behaviour. */
367
+ interface UIOptions {
368
+ /**
369
+ * `auto` opens the docked popover on wide viewports and the modal dialog on
370
+ * compact ones; `docked` and `modal` force one of them.
371
+ * @default "auto"
372
+ */
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";
387
+ /**
388
+ * Render the calendar permanently into a container instead of opening it.
389
+ * `container` is a selector or an element.
390
+ * @default { enabled: false }
391
+ */
392
+ inline?: {
393
+ enabled?: boolean;
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;
415
+ };
416
+ /**
417
+ * `auto` follows the locale's numeric order and separators; otherwise a
418
+ * pattern built from `d dd M MM yy yyyy` and one separator of `/ . - space`.
419
+ * With `calendar.precision` `"month"` or `"year"` the pattern may leave out
420
+ * the finer parts (`"MM/yyyy"`, `"yyyy-MM"`, and for `"year"` also `"yyyy"`).
421
+ * @default "auto"
422
+ */
423
+ format?: FormatOption;
424
+ /**
425
+ * Theme applied to the picker surface: `basic`, `m3-green`, `crane`,
426
+ * `crane-straight`, `m2`, `glassmorphic`, `pastel`, `ai`, `cyberpunk`,
427
+ * `blueprint`. `basic` and `blueprint` follow `colorScheme`, the others have
428
+ * one fixed scheme.
429
+ * @default "basic"
430
+ */
431
+ theme?: ThemeName;
432
+ /**
433
+ * `auto` detects the scheme when the picker opens: the first opaque
434
+ * `background-color` from the input up to `<html>` decides (dark when its
435
+ * luminance is low); without one, the page `color-scheme` decides (`dark`
436
+ * is dark, `light dark` follows the OS, anything else is light). An inline
437
+ * picker follows later page changes. `light` and `dark` force one. Themes
438
+ * with a single version ignore this option.
439
+ * @default "auto"
440
+ */
441
+ colorScheme?: "auto" | "light" | "dark";
442
+ /**
443
+ * Range pickers in a dialog open full screen below this window width:
444
+ * `true` below 600 px, a number below that many px (for example 840), `false`
445
+ * never. With `displayMode: "auto"` the surface is docked from 600 px, so a
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.
449
+ * @default true
450
+ */
451
+ fullscreen?: boolean | number;
452
+ /**
453
+ * Selector or element that opens the picker besides the input, for example
454
+ * a calendar icon button.
455
+ * @default undefined
456
+ */
457
+ toggleButton?: string | HTMLElement;
458
+ /**
459
+ * Show ISO week numbers before each row.
460
+ * @default false
461
+ */
462
+ weekNumbers?: boolean;
463
+ /**
464
+ * Show the days of neighbouring months in the first and last rows. `true`
465
+ * and `{}` show them selectable; `{ selectable: false }` shows them dimmed
466
+ * and inert.
467
+ * @default false
468
+ */
469
+ outsideDays?: boolean | {
470
+ selectable?: boolean;
471
+ };
472
+ /**
473
+ * Always render six week rows, so the calendar keeps its height from month
474
+ * to month.
475
+ * @default false
476
+ */
477
+ fixedWeeks?: boolean;
478
+ /**
479
+ * Years offered in the year selection, counted from the current year.
480
+ * @default { before: 100, after: 20 }
481
+ */
482
+ yearRange?: {
483
+ before?: number;
484
+ after?: number;
485
+ };
486
+ /**
487
+ * Show the Today button in the footer.
488
+ * @default false
489
+ */
490
+ todayButton?: boolean;
491
+ /**
492
+ * Show the Clear button in the footer. `true` also clears the input; pass
493
+ * `{ clearInput: false }` to keep the typed text.
494
+ * @default false
495
+ */
496
+ clearButton?: boolean | {
497
+ clearInput?: boolean;
498
+ };
499
+ /**
500
+ * Show the footer with the action buttons. Unset means shown, except in
501
+ * inline mode.
502
+ * @default undefined
503
+ */
504
+ footer?: boolean;
505
+ /**
506
+ * Play motion. Always off with `prefers-reduced-motion: reduce`.
507
+ * @default true
508
+ */
509
+ animation?: boolean;
510
+ /**
511
+ * Keep the page scrollable while the modal is open.
512
+ * @default false
513
+ */
514
+ allowPageScroll?: boolean;
515
+ /**
516
+ * Extra class names added to the picker surface.
517
+ * @default ""
518
+ */
519
+ cssClass?: string;
520
+ /**
521
+ * Selector or element the modal dialog is appended to. Defaults to the
522
+ * picker host.
523
+ * @default undefined
524
+ */
525
+ appendTo?: string | HTMLElement;
526
+ /**
527
+ * Drag, wheel and swipe between months.
528
+ * @default true
529
+ */
530
+ swipe?: boolean;
531
+ /**
532
+ * Show the button that switches between the calendar and the text input
533
+ * view, where the mode and look support it.
534
+ * @default true
535
+ */
536
+ viewSwitch?: boolean;
537
+ /**
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.
541
+ * @default "calendar"
542
+ */
543
+ initialView?: PickerView;
544
+ /**
545
+ * Mask the text typed into the input to `ui.format` (digits only, separators added).
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.
548
+ * @default false
549
+ */
550
+ mask?: boolean;
551
+ /**
552
+ * Selector or element of the page's second `<input>`, which turns a range
553
+ * picker into a Start / End pair: the main input holds the start, this one
554
+ * the end. Read when `create()` runs; only used in `range` mode. Typing
555
+ * commits only a full pair (or two empty fields). Clicking a field opens
556
+ * the picker on that end, and the field being picked gets the class
557
+ * `dp-ui__input--active`.
558
+ * @default undefined
559
+ */
560
+ endInput?: string | HTMLElement;
561
+ /**
562
+ * First calendar panel when the picker opens: the day grid, the month list
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
566
+ * `"day"`.
567
+ * @default "day"
568
+ */
569
+ startView?: "day" | "month" | "year";
570
+ }
571
+ /** Texts used by buttons and assistive technology. Month and weekday names come from `Intl`. */
572
+ interface LabelsOptions {
573
+ /**
574
+ * Modal header supporting text.
575
+ * @default "Select date"
576
+ */
577
+ title?: string;
578
+ /**
579
+ * Header supporting text with `calendar.precision: "month"`.
580
+ * @default "Select month"
581
+ */
582
+ monthTitle?: string;
583
+ /**
584
+ * Header supporting text with `calendar.precision: "year"`.
585
+ * @default "Select year"
586
+ */
587
+ yearTitle?: string;
588
+ /**
589
+ * Modal headline while no date is selected.
590
+ * @default "No date selected"
591
+ */
592
+ noDate?: string;
593
+ /**
594
+ * Confirm button.
595
+ * @default "OK"
596
+ */
597
+ confirm?: string;
598
+ /**
599
+ * Cancel button.
600
+ * @default "Cancel"
601
+ */
602
+ cancel?: string;
603
+ /**
604
+ * Today button.
605
+ * @default "Today"
606
+ */
607
+ today?: string;
608
+ /**
609
+ * Clear button.
610
+ * @default "Clear"
611
+ */
612
+ clear?: string;
613
+ /**
614
+ * Accessible name of the toggle button.
615
+ * @default "Choose date"
616
+ */
617
+ openCalendar?: string;
618
+ /**
619
+ * Previous month button.
620
+ * @default "Previous month"
621
+ */
622
+ previousMonth?: string;
623
+ /**
624
+ * Next month button.
625
+ * @default "Next month"
626
+ */
627
+ nextMonth?: string;
628
+ /**
629
+ * Previous year button.
630
+ * @default "Previous year"
631
+ */
632
+ previousYear?: string;
633
+ /**
634
+ * Next year button.
635
+ * @default "Next year"
636
+ */
637
+ nextYear?: string;
638
+ /**
639
+ * Month menu button and list.
640
+ * @default "Choose month"
641
+ */
642
+ chooseMonth?: string;
643
+ /**
644
+ * Year menu button and list.
645
+ * @default "Choose year"
646
+ */
647
+ chooseYear?: string;
648
+ /**
649
+ * Week number column header.
650
+ * @default "Week"
651
+ */
652
+ weekNumber?: string;
653
+ /**
654
+ * Message for a typed text that is not a date.
655
+ * @default "Enter a valid date"
656
+ */
657
+ invalidDate?: string;
658
+ /**
659
+ * Message for a typed date that is disabled or out of range.
660
+ * @default "This date is not available"
661
+ */
662
+ unavailableDate?: string;
663
+ /**
664
+ * Header supporting text in `range` mode.
665
+ * @default "Select dates"
666
+ */
667
+ rangeTitle?: string;
668
+ /**
669
+ * Headline placeholder for the missing start of a range.
670
+ * @default "Start"
671
+ */
672
+ rangeStart?: string;
673
+ /**
674
+ * Headline placeholder for the missing end of a range.
675
+ * @default "End"
676
+ */
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;
684
+ /**
685
+ * Headline in `multiple` mode; `{count}` is the number of selected days.
686
+ * @default "{count} selected"
687
+ */
688
+ multipleSelected?: PluralLabel;
689
+ /**
690
+ * Save button of the fullscreen range picker.
691
+ * @default "Save"
692
+ */
693
+ save?: string;
694
+ /**
695
+ * Close button of the fullscreen range picker.
696
+ * @default "Close"
697
+ */
698
+ close?: string;
699
+ /**
700
+ * Accessible name of the button that shows the text input view.
701
+ * @default "Switch to text input"
702
+ */
703
+ switchToInput?: string;
704
+ /**
705
+ * Accessible name of the button that shows the calendar view.
706
+ * @default "Switch to calendar"
707
+ */
708
+ switchToCalendar?: string;
709
+ /**
710
+ * Label of the date text field in `single` mode.
711
+ * @default "Date"
712
+ */
713
+ dateField?: string;
714
+ /**
715
+ * Label of the start date text field in `range` mode.
716
+ * @default "Start date"
717
+ */
718
+ startDateField?: string;
719
+ /**
720
+ * Label of the end date text field in `range` mode.
721
+ * @default "End date"
722
+ */
723
+ endDateField?: string;
724
+ /**
725
+ * Message for a range whose end is before its start or breaks the length limits.
726
+ * @default "End date must be on or after the start date"
727
+ */
728
+ invalidRange?: string;
729
+ /**
730
+ * Message for a typed date before `minDate`; `{date}` is the minimum date.
731
+ * @default "Enter a date on or after {date}"
732
+ */
733
+ beforeMinDate?: string;
734
+ /**
735
+ * Message for a typed date after `maxDate`; `{date}` is the maximum date.
736
+ * @default "Enter a date on or before {date}"
737
+ */
738
+ afterMaxDate?: string;
739
+ /**
740
+ * Accessible name of the range presets group.
741
+ * @default "Presets"
742
+ */
743
+ presets?: string;
744
+ /**
745
+ * Name of the Page Up key in the keyboard shortcut tooltips of the navigation buttons.
746
+ * @default "Page Up"
747
+ */
748
+ pageUpKey?: string;
749
+ /**
750
+ * Name of the Page Down key in the keyboard shortcut tooltips of the navigation buttons.
751
+ * @default "Page Down"
752
+ */
753
+ pageDownKey?: string;
754
+ /**
755
+ * Name of the Shift key in the keyboard shortcut tooltips (`Shift+Page Up`, `Shift+M`).
756
+ * @default "Shift"
757
+ */
758
+ shiftKey?: string;
759
+ /**
760
+ * Placeholder letters for the day in the format hint shown under the field (Polish: "dd").
761
+ * @default "dd"
762
+ */
763
+ hintDay?: string;
764
+ /**
765
+ * Placeholder letters for the month in the format hint shown under the field (Polish: "mm").
766
+ * @default "mm"
767
+ */
768
+ hintMonth?: string;
769
+ /**
770
+ * Placeholder letters for the year in the format hint shown under the field (Polish: "rrrr").
771
+ * A two-digit year format uses the first two characters.
772
+ * @default "yyyy"
773
+ */
774
+ hintYear?: string;
775
+ }
776
+ /** Interaction rules. */
777
+ interface BehaviorOptions {
778
+ /**
779
+ * Commit and close as soon as a day is picked.
780
+ * @default false
781
+ */
782
+ closeOnSelect?: boolean;
783
+ /**
784
+ * Close the picker when it is cancelled.
785
+ * @default true
786
+ */
787
+ closeOnCancel?: boolean;
788
+ /**
789
+ * Commit every change to the input immediately, without the confirm button.
790
+ * @default false
791
+ */
792
+ commitOnChange?: boolean;
793
+ /**
794
+ * Keep the picker open when the user clicks outside of it.
795
+ * @default false
796
+ */
797
+ ignoreOutsideClick?: boolean;
798
+ /**
799
+ * Move focus back to the input when the picker closes.
800
+ * @default true
801
+ */
802
+ returnFocus?: boolean;
803
+ /**
804
+ * Custom instance id for `DatepickerUI.getById()`.
805
+ * @default undefined
806
+ */
807
+ id?: string;
808
+ }
809
+ /** User callbacks, called through the event bridge. */
810
+ interface CallbacksOptions {
811
+ /** Called when the picker opens. */
812
+ onOpen?: (data: OpenEventData) => void;
813
+ /** Called when the picker closes. */
814
+ onClose?: (data: CloseEventData) => void;
815
+ /** Called when the picker is dismissed without committing. */
816
+ onCancel?: (data: CancelEventData) => void;
817
+ /** Called when a value is committed or cleared. */
818
+ onConfirm?: (data: ConfirmEventData) => void;
819
+ /** Called after `setOptions()` applied a patch. */
820
+ onUpdate?: (data: UpdateEventData) => void;
821
+ /** Called for invalid typed dates and rejected options. */
822
+ onError?: (data: ErrorEventData) => void;
823
+ /** Called when a day is picked, or typed in the text fields. */
824
+ onSelectDay?: (data: SelectDayEventData) => void;
825
+ /** Called when a month is chosen in the month menu. */
826
+ onSelectMonth?: (data: SelectMonthEventData) => void;
827
+ /** Called when a year is chosen. */
828
+ onSelectYear?: (data: SelectYearEventData) => void;
829
+ /** Called when the first day of a range is picked or typed. */
830
+ onRangeStart?: (data: RangeStartEventData) => void;
831
+ /** Called when the range is completed. */
832
+ onRangeEnd?: (data: RangeEndEventData) => void;
833
+ /** Called when the days shown change, and once when the picker is opened or mounted. */
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;
839
+ }
840
+ /** Options accepted by the `DatepickerUI` constructor and `setOptions()`. */
841
+ interface DatepickerOptions {
842
+ /** Days, locale and week layout. */
843
+ calendar?: CalendarOptions;
844
+ /** Presentation and display behaviour. */
845
+ ui?: UIOptions;
846
+ /** Button texts and accessible names. */
847
+ labels?: LabelsOptions;
848
+ /** Interaction rules. */
849
+ behavior?: BehaviorOptions;
850
+ /** Event callbacks. */
851
+ callbacks?: CallbacksOptions;
852
+ }
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 };