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