@tabworthy/components 0.9.1 → 0.10.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 (39) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/tabworthy-components.cjs.js +1 -1
  3. package/dist/cjs/tabworthy-dates-calendar_2.cjs.entry.js +19 -9
  4. package/dist/cjs/tabworthy-dates.cjs.entry.js +7 -5
  5. package/dist/cjs/tabworthy-times-picker.cjs.entry.js +6 -6
  6. package/dist/cjs/tabworthy-times.cjs.entry.js +5 -4
  7. package/dist/collection/components/tabworthy-dates/tabworthy-dates.js +28 -6
  8. package/dist/collection/components/tabworthy-dates-calendar/tabworthy-dates-calendar.js +71 -8
  9. package/dist/collection/components/tabworthy-modal/tabworthy-dates-modal.js +2 -2
  10. package/dist/collection/components/tabworthy-times/tabworthy-times.js +50 -5
  11. package/dist/collection/components/tabworthy-times-picker/tabworthy-times-picker.js +9 -9
  12. package/dist/components/p-CGo5md1l.js +1 -0
  13. package/dist/components/{p-B9fGfjA-.js → p-D0CX07Ep.js} +1 -1
  14. package/dist/components/{p-B9YA6avR.js → p-DDp2dGlo.js} +1 -1
  15. package/dist/components/tabworthy-dates-calendar.js +1 -1
  16. package/dist/components/tabworthy-dates-modal.js +1 -1
  17. package/dist/components/tabworthy-dates.js +1 -1
  18. package/dist/components/tabworthy-times-picker.js +1 -1
  19. package/dist/components/tabworthy-times.js +1 -1
  20. package/dist/esm/loader.js +1 -1
  21. package/dist/esm/tabworthy-components.js +1 -1
  22. package/dist/esm/tabworthy-dates-calendar_2.entry.js +19 -9
  23. package/dist/esm/tabworthy-dates.entry.js +7 -5
  24. package/dist/esm/tabworthy-times-picker.entry.js +6 -6
  25. package/dist/esm/tabworthy-times.entry.js +5 -4
  26. package/dist/tabworthy-components/p-327d119d.entry.js +1 -0
  27. package/dist/tabworthy-components/p-42e77ac7.entry.js +1 -0
  28. package/dist/tabworthy-components/{p-4eec41e5.entry.js → p-a67ad7af.entry.js} +1 -1
  29. package/dist/tabworthy-components/{p-0e77d058.entry.js → p-d4a7458b.entry.js} +1 -1
  30. package/dist/tabworthy-components/tabworthy-components.esm.js +1 -1
  31. package/dist/types/components/tabworthy-dates/tabworthy-dates.d.ts +1 -0
  32. package/dist/types/components/tabworthy-dates-calendar/tabworthy-dates-calendar.d.ts +5 -0
  33. package/dist/types/components/tabworthy-times/tabworthy-times.d.ts +3 -0
  34. package/dist/types/components/tabworthy-times-picker/tabworthy-times-picker.d.ts +3 -3
  35. package/dist/types/components.d.ts +40 -4
  36. package/package.json +1 -1
  37. package/dist/components/p-B8sG1vGD.js +0 -1
  38. package/dist/tabworthy-components/p-ee41beed.entry.js +0 -1
  39. package/dist/tabworthy-components/p-fdb3b911.entry.js +0 -1
@@ -1 +1 @@
1
- import{p as e,b as t}from"./p-CwtZ_Lud.js";export{s as setNonce}from"./p-CwtZ_Lud.js";import{g as a}from"./p-DQuL1Twl.js";(()=>{const t=import.meta.url,a={};return""!==t&&(a.resourcesUrl=new URL(".",t).href),e(a)})().then((async e=>(await a(),t([["p-4eec41e5",[[2,"tabworthy-times-picker",{hours:[1026],minutes:[1026],useTwelveHourFormat:[4,"use-twelve-hour-format"],labels:[16],labelsSrOnly:[4,"labels-sr-only"],disabled:[4],elementClassName:[1,"element-class-name"],internalHours:[32],internalMinutes:[32],period:[32]},null,{hours:[{watchHours:0}],minutes:[{watchMinutes:0}]}]]],["p-ee41beed",[[262,"tabworthy-dates-calendar",{clearButtonContent:[1,"clear-button-content"],disabled:[4],modalIsOpen:[4,"modal-is-open"],disableDate:[16],elementClassName:[1,"element-class-name"],firstDayOfWeek:[2,"first-day-of-week"],range:[4],labels:[16],locale:[1],nextMonthButtonContent:[1,"next-month-button-content"],nextYearButtonContent:[1,"next-year-button-content"],previousMonthButtonContent:[1,"previous-month-button-content"],previousYearButtonContent:[1,"previous-year-button-content"],minDate:[1,"min-date"],maxDate:[1,"max-date"],inline:[4],showClearButton:[4,"show-clear-button"],showMonthStepper:[4,"show-month-stepper"],showTodayButton:[4,"show-today-button"],showYearStepper:[4,"show-year-stepper"],showKeyboardHint:[4,"show-keyboard-hint"],showHiddenTitle:[4,"show-hidden-title"],startDate:[1,"start-date"],todayButtonContent:[1,"today-button-content"],value:[1040],currentDate:[32],hoveredDate:[32],weekdays:[32]},null,{modalIsOpen:[{watchModalIsOpen:0}],firstDayOfWeek:[{watchFirstDayOfWeek:0}],locale:[{watchLocale:0}],range:[{watchRange:0}],startDate:[{watchStartDate:0}],value:[{watchValue:0}]}],[257,"tabworthy-dates-modal",{label:[1],inline:[4],placement:[1],offset:[16],appendTo:[1,"append-to"],closing:[32],showing:[32],positioned:[32],open:[64],close:[64],getState:[64],setTriggerElement:[64],updatePosition:[64]},[[10,"click","handleClick"]],{showing:[{watchShowing:0}]}]]],["p-fdb3b911",[[2,"tabworthy-times",{id:[513],value:[1025],range:[4],label:[1],placeholder:[1],locale:[1],disabled:[4],minDate:[1,"min-date"],maxDate:[1,"max-date"],startDate:[1,"start-date"],referenceDate:[1,"reference-date"],useTwelveHourFormat:[4,"use-twelve-hour-format"],timesLabels:[16],datesCalendarLabels:[16],inline:[4],hasError:[1028,"has-error"],showYearStepper:[4,"show-year-stepper"],showMonthStepper:[4,"show-month-stepper"],showClearButton:[4,"show-clear-button"],showTodayButton:[4,"show-today-button"],calendarButtonContent:[1,"calendar-button-content"],disableDate:[16],elementClassName:[1,"element-class-name"],firstDayOfWeek:[2,"first-day-of-week"],format:[1],inputShouldFormat:[8,"input-should-format"],disableFreeformInput:[4,"disable-freeform-input"],inputClass:[1,"input-class"],appendTo:[1,"append-to"],internalValue:[32],selectedDate:[32],selectedHours:[32],selectedMinutes:[32],errorState:[32],disabledState:[32],clearValue:[64]},null,{value:[{watchValue:0}],disabled:[{watchDisabled:0}],hasError:[{watchHasError:0}]}]]],["p-0e77d058",[[2,"tabworthy-dates",{id:[513],value:[1025],range:[4],label:[1],placeholder:[1],locale:[1],disabled:[4],minDate:[1,"min-date"],maxDate:[1,"max-date"],startDate:[1,"start-date"],referenceDate:[1,"reference-date"],useStrictDateParsing:[4,"use-strict-date-parsing"],datesLabels:[16],datesCalendarLabels:[16],inline:[4],hasError:[1028,"has-error"],nextMonthButtonContent:[1,"next-month-button-content"],nextYearButtonContent:[1,"next-year-button-content"],showYearStepper:[4,"show-year-stepper"],showMonthStepper:[4,"show-month-stepper"],showClearButton:[4,"show-clear-button"],showTodayButton:[4,"show-today-button"],inputShouldFormat:[8,"input-should-format"],showKeyboardHint:[4,"show-keyboard-hint"],disableDate:[16],elementClassName:[1,"element-class-name"],firstDayOfWeek:[2,"first-day-of-week"],format:[1],quickButtons:[16],todayButtonContent:[1,"today-button-content"],calendarButtonContent:[1,"calendar-button-content"],showQuickButtons:[4,"show-quick-buttons"],disableFreeformInput:[4,"disable-freeform-input"],inputClass:[1,"input-class"],appendTo:[1,"append-to"],internalValue:[32],errorState:[32],disabledState:[32],parseDate:[64]},null,{disabled:[{watchDisabled:0}],value:[{watchValue:0}]}]]]],e))));
1
+ import{p as e,b as t}from"./p-CwtZ_Lud.js";export{s as setNonce}from"./p-CwtZ_Lud.js";import{g as a}from"./p-DQuL1Twl.js";(()=>{const t=import.meta.url,a={};return""!==t&&(a.resourcesUrl=new URL(".",t).href),e(a)})().then((async e=>(await a(),t([["p-a67ad7af",[[2,"tabworthy-times-picker",{hours:[1026],minutes:[1026],useTwelveHourFormat:[4,"use-twelve-hour-format"],labels:[16],labelsSrOnly:[4,"labels-sr-only"],disabled:[4],elementClassName:[1,"element-class-name"],internalHours:[32],internalMinutes:[32],period:[32]},null,{hours:[{watchHours:0}],minutes:[{watchMinutes:0}]}]]],["p-42e77ac7",[[262,"tabworthy-dates-calendar",{clearButtonContent:[1,"clear-button-content"],closeButtonContent:[1,"close-button-content"],disabled:[4],modalIsOpen:[4,"modal-is-open"],disableDate:[16],elementClassName:[1,"element-class-name"],firstDayOfWeek:[2,"first-day-of-week"],range:[4],labels:[16],locale:[1],nextMonthButtonContent:[1,"next-month-button-content"],nextYearButtonContent:[1,"next-year-button-content"],previousMonthButtonContent:[1,"previous-month-button-content"],previousYearButtonContent:[1,"previous-year-button-content"],minDate:[1,"min-date"],maxDate:[1,"max-date"],inline:[4],showClearButton:[4,"show-clear-button"],showCloseButton:[4,"show-close-button"],showMonthStepper:[4,"show-month-stepper"],showTodayButton:[4,"show-today-button"],showYearStepper:[4,"show-year-stepper"],showKeyboardHint:[4,"show-keyboard-hint"],showHiddenTitle:[4,"show-hidden-title"],startDate:[1,"start-date"],todayButtonContent:[1,"today-button-content"],value:[1040],currentDate:[32],hoveredDate:[32],weekdays:[32]},null,{modalIsOpen:[{watchModalIsOpen:0}],firstDayOfWeek:[{watchFirstDayOfWeek:0}],locale:[{watchLocale:0}],range:[{watchRange:0}],startDate:[{watchStartDate:0}],value:[{watchValue:0}]}],[257,"tabworthy-dates-modal",{label:[1],inline:[4],placement:[1],offset:[16],appendTo:[1,"append-to"],closing:[32],showing:[32],positioned:[32],open:[64],close:[64],getState:[64],setTriggerElement:[64],updatePosition:[64]},[[10,"click","handleClick"]],{showing:[{watchShowing:0}]}]]],["p-327d119d",[[2,"tabworthy-times",{id:[513],value:[1025],range:[4],label:[1],placeholder:[1],locale:[1],disabled:[4],minDate:[1,"min-date"],maxDate:[1,"max-date"],startDate:[1,"start-date"],referenceDate:[1,"reference-date"],useTwelveHourFormat:[4,"use-twelve-hour-format"],timesLabels:[16],datesCalendarLabels:[16],timesPickerLabels:[16],inline:[4],hasError:[1028,"has-error"],showYearStepper:[4,"show-year-stepper"],showMonthStepper:[4,"show-month-stepper"],showClearButton:[4,"show-clear-button"],showCloseButton:[4,"show-close-button"],showTodayButton:[4,"show-today-button"],calendarButtonContent:[1,"calendar-button-content"],disableDate:[16],elementClassName:[1,"element-class-name"],firstDayOfWeek:[2,"first-day-of-week"],format:[1],inputShouldFormat:[8,"input-should-format"],disableFreeformInput:[4,"disable-freeform-input"],inputClass:[1,"input-class"],appendTo:[1,"append-to"],internalValue:[32],selectedDate:[32],selectedHours:[32],selectedMinutes:[32],errorState:[32],disabledState:[32],clearValue:[64]},null,{value:[{watchValue:0}],disabled:[{watchDisabled:0}],hasError:[{watchHasError:0}]}]]],["p-d4a7458b",[[2,"tabworthy-dates",{id:[513],value:[1025],range:[4],label:[1],placeholder:[1],locale:[1],disabled:[4],minDate:[1,"min-date"],maxDate:[1,"max-date"],startDate:[1,"start-date"],referenceDate:[1,"reference-date"],useStrictDateParsing:[4,"use-strict-date-parsing"],datesLabels:[16],datesCalendarLabels:[16],inline:[4],hasError:[1028,"has-error"],nextMonthButtonContent:[1,"next-month-button-content"],nextYearButtonContent:[1,"next-year-button-content"],showYearStepper:[4,"show-year-stepper"],showMonthStepper:[4,"show-month-stepper"],showClearButton:[4,"show-clear-button"],showCloseButton:[4,"show-close-button"],showTodayButton:[4,"show-today-button"],inputShouldFormat:[8,"input-should-format"],showKeyboardHint:[4,"show-keyboard-hint"],disableDate:[16],elementClassName:[1,"element-class-name"],firstDayOfWeek:[2,"first-day-of-week"],format:[1],quickButtons:[16],todayButtonContent:[1,"today-button-content"],calendarButtonContent:[1,"calendar-button-content"],showQuickButtons:[4,"show-quick-buttons"],disableFreeformInput:[4,"disable-freeform-input"],inputClass:[1,"input-class"],appendTo:[1,"append-to"],internalValue:[32],errorState:[32],disabledState:[32],parseDate:[64]},null,{disabled:[{watchDisabled:0}],value:[{watchValue:0}]}]]]],e))));
@@ -38,6 +38,7 @@ export declare class TabworthyDates {
38
38
  showYearStepper: boolean;
39
39
  showMonthStepper: boolean;
40
40
  showClearButton: boolean;
41
+ showCloseButton: boolean;
41
42
  showTodayButton: boolean;
42
43
  inputShouldFormat?: boolean | string;
43
44
  showKeyboardHint: boolean;
@@ -1,6 +1,7 @@
1
1
  import { EventEmitter } from "../../stencil-public-runtime";
2
2
  export type DatesCalendarLabels = {
3
3
  clearButton: string;
4
+ closeButton: string;
4
5
  monthSelect: string;
5
6
  nextMonthButton: string;
6
7
  nextYearButton: string;
@@ -24,6 +25,7 @@ export interface YearChangedEventDetails {
24
25
  export declare class InclusiveDatesCalendar {
25
26
  el: HTMLElement;
26
27
  clearButtonContent?: string;
28
+ closeButtonContent?: string;
27
29
  disabled: boolean;
28
30
  modalIsOpen?: boolean;
29
31
  disableDate: (date: Date) => boolean;
@@ -40,6 +42,7 @@ export declare class InclusiveDatesCalendar {
40
42
  maxDate?: string;
41
43
  inline: boolean;
42
44
  showClearButton?: boolean;
45
+ showCloseButton?: boolean;
43
46
  showMonthStepper?: boolean;
44
47
  showTodayButton?: boolean;
45
48
  showYearStepper?: boolean;
@@ -54,6 +57,7 @@ export declare class InclusiveDatesCalendar {
54
57
  selectDate?: EventEmitter<string | string[] | undefined>;
55
58
  changeMonth?: EventEmitter<MonthChangedEventDetails>;
56
59
  changeYear?: EventEmitter<YearChangedEventDetails>;
60
+ requestClose?: EventEmitter<void>;
57
61
  private moveFocusAfterMonthChanged?;
58
62
  private moveFocusOnModalOpen?;
59
63
  componentWillLoad(): void;
@@ -85,5 +89,6 @@ export declare class InclusiveDatesCalendar {
85
89
  private onKeyDown;
86
90
  private onMouseEnter;
87
91
  private onMouseLeave;
92
+ private close;
88
93
  render(): any;
89
94
  }
@@ -1,4 +1,5 @@
1
1
  import { EventEmitter } from "../../stencil-public-runtime";
2
+ import { TimesPickerLabels } from "../tabworthy-times-picker/tabworthy-times-picker";
2
3
  import { DatesLabels } from "../tabworthy-dates/tabworthy-dates";
3
4
  import { DatesCalendarLabels, YearChangedEventDetails } from "../tabworthy-dates-calendar/tabworthy-dates-calendar";
4
5
  export interface TimesLabels extends Omit<DatesLabels, "quickSelection"> {
@@ -20,11 +21,13 @@ export declare class InclusiveTimes {
20
21
  useTwelveHourFormat: boolean;
21
22
  timesLabels: TimesLabels;
22
23
  datesCalendarLabels?: DatesCalendarLabels;
24
+ timesPickerLabels?: TimesPickerLabels;
23
25
  inline: boolean;
24
26
  hasError: boolean;
25
27
  showYearStepper: boolean;
26
28
  showMonthStepper: boolean;
27
29
  showClearButton: boolean;
30
+ showCloseButton: boolean;
28
31
  showTodayButton: boolean;
29
32
  calendarButtonContent?: string;
30
33
  disableDate: (date: Date) => boolean;
@@ -4,7 +4,7 @@ export interface TimeValue {
4
4
  minutes: number;
5
5
  period?: "AM" | "PM";
6
6
  }
7
- export interface InclusivekTimesPickerLabels {
7
+ export interface TimesPickerLabels {
8
8
  hours: string;
9
9
  minutes: string;
10
10
  am: string;
@@ -15,12 +15,12 @@ export interface InclusivekTimesPickerLabels {
15
15
  incrementMinutes: string;
16
16
  decrementMinutes: string;
17
17
  }
18
- export declare class InclusiveTimesPicker {
18
+ export declare class TabworthyTimesPicker {
19
19
  el: HTMLElement;
20
20
  hours: number;
21
21
  minutes: number;
22
22
  useTwelveHourFormat: boolean;
23
- labels: InclusivekTimesPickerLabels;
23
+ labels: TimesPickerLabels;
24
24
  labelsSrOnly: boolean;
25
25
  disabled: boolean;
26
26
  elementClassName: string;
@@ -11,14 +11,16 @@ import { ChronoOptions, ChronoParsedDateString } from "../shared/utils/chrono-pa
11
11
  import { DatesCalendarLabels as DatesCalendarLabels1, MonthChangedEventDetails, YearChangedEventDetails as YearChangedEventDetails1 } from "./components/tabworthy-dates-calendar/tabworthy-dates-calendar";
12
12
  import { Placement } from "@popperjs/core";
13
13
  import { TimesLabels } from "./components/tabworthy-times/tabworthy-times";
14
- import { InclusivekTimesPickerLabels, TimeValue } from "./components/tabworthy-times-picker/tabworthy-times-picker";
14
+ import { TimesPickerLabels } from "./components/tabworthy-times-picker/tabworthy-times-picker";
15
+ import { TimesPickerLabels as TimesPickerLabels1, TimeValue } from "./components/tabworthy-times-picker/tabworthy-times-picker";
15
16
  export { DatesLabels } from "./components/tabworthy-dates/tabworthy-dates";
16
17
  export { DatesCalendarLabels, YearChangedEventDetails } from "./components/tabworthy-dates-calendar/tabworthy-dates-calendar";
17
18
  export { ChronoOptions, ChronoParsedDateString } from "../shared/utils/chrono-parser/chrono-parser.type";
18
19
  export { DatesCalendarLabels as DatesCalendarLabels1, MonthChangedEventDetails, YearChangedEventDetails as YearChangedEventDetails1 } from "./components/tabworthy-dates-calendar/tabworthy-dates-calendar";
19
20
  export { Placement } from "@popperjs/core";
20
21
  export { TimesLabels } from "./components/tabworthy-times/tabworthy-times";
21
- export { InclusivekTimesPickerLabels, TimeValue } from "./components/tabworthy-times-picker/tabworthy-times-picker";
22
+ export { TimesPickerLabels } from "./components/tabworthy-times-picker/tabworthy-times-picker";
23
+ export { TimesPickerLabels as TimesPickerLabels1, TimeValue } from "./components/tabworthy-times-picker/tabworthy-times-picker";
22
24
  export namespace Components {
23
25
  interface TabworthyDates {
24
26
  /**
@@ -106,6 +108,10 @@ export namespace Components {
106
108
  * @default true
107
109
  */
108
110
  "showClearButton": boolean;
111
+ /**
112
+ * @default false
113
+ */
114
+ "showCloseButton": boolean;
109
115
  /**
110
116
  * @default false
111
117
  */
@@ -139,6 +145,7 @@ export namespace Components {
139
145
  }
140
146
  interface TabworthyDatesCalendar {
141
147
  "clearButtonContent"?: string;
148
+ "closeButtonContent"?: string;
142
149
  /**
143
150
  * @default () => false
144
151
  */
@@ -185,6 +192,10 @@ export namespace Components {
185
192
  * @default false
186
193
  */
187
194
  "showClearButton"?: boolean;
195
+ /**
196
+ * @default false
197
+ */
198
+ "showCloseButton"?: boolean;
188
199
  /**
189
200
  * @default true
190
201
  */
@@ -323,6 +334,10 @@ export namespace Components {
323
334
  * @default true
324
335
  */
325
336
  "showClearButton": boolean;
337
+ /**
338
+ * @default false
339
+ */
340
+ "showCloseButton": boolean;
326
341
  /**
327
342
  * @default true
328
343
  */
@@ -343,6 +358,7 @@ export namespace Components {
343
358
  * @default defaultLabels
344
359
  */
345
360
  "timesLabels": TimesLabels;
361
+ "timesPickerLabels"?: TimesPickerLabels;
346
362
  /**
347
363
  * @default true
348
364
  */
@@ -365,7 +381,7 @@ export namespace Components {
365
381
  /**
366
382
  * @default defaultLabels
367
383
  */
368
- "labels": InclusivekTimesPickerLabels;
384
+ "labels": TimesPickerLabels1;
369
385
  /**
370
386
  * @default true
371
387
  */
@@ -424,6 +440,7 @@ declare global {
424
440
  "selectDate": string | string[] | undefined;
425
441
  "changeMonth": MonthChangedEventDetails;
426
442
  "changeYear": YearChangedEventDetails1;
443
+ "requestClose": void;
427
444
  }
428
445
  interface HTMLTabworthyDatesCalendarElement extends Components.TabworthyDatesCalendar, HTMLStencilElement {
429
446
  addEventListener<K extends keyof HTMLTabworthyDatesCalendarElementEventMap>(type: K, listener: (this: HTMLTabworthyDatesCalendarElement, ev: TabworthyDatesCalendarCustomEvent<HTMLTabworthyDatesCalendarElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
@@ -592,6 +609,10 @@ declare namespace LocalJSX {
592
609
  * @default true
593
610
  */
594
611
  "showClearButton"?: boolean;
612
+ /**
613
+ * @default false
614
+ */
615
+ "showCloseButton"?: boolean;
595
616
  /**
596
617
  * @default false
597
618
  */
@@ -625,6 +646,7 @@ declare namespace LocalJSX {
625
646
  }
626
647
  interface TabworthyDatesCalendar {
627
648
  "clearButtonContent"?: string;
649
+ "closeButtonContent"?: string;
628
650
  /**
629
651
  * @default () => false
630
652
  */
@@ -663,6 +685,7 @@ declare namespace LocalJSX {
663
685
  "nextYearButtonContent"?: string;
664
686
  "onChangeMonth"?: (event: TabworthyDatesCalendarCustomEvent<MonthChangedEventDetails>) => void;
665
687
  "onChangeYear"?: (event: TabworthyDatesCalendarCustomEvent<YearChangedEventDetails1>) => void;
688
+ "onRequestClose"?: (event: TabworthyDatesCalendarCustomEvent<void>) => void;
666
689
  "onSelectDate"?: (event: TabworthyDatesCalendarCustomEvent<string | string[] | undefined>) => void;
667
690
  "previousMonthButtonContent"?: string;
668
691
  "previousYearButtonContent"?: string;
@@ -674,6 +697,10 @@ declare namespace LocalJSX {
674
697
  * @default false
675
698
  */
676
699
  "showClearButton"?: boolean;
700
+ /**
701
+ * @default false
702
+ */
703
+ "showCloseButton"?: boolean;
677
704
  /**
678
705
  * @default true
679
706
  */
@@ -802,6 +829,10 @@ declare namespace LocalJSX {
802
829
  * @default true
803
830
  */
804
831
  "showClearButton"?: boolean;
832
+ /**
833
+ * @default false
834
+ */
835
+ "showCloseButton"?: boolean;
805
836
  /**
806
837
  * @default true
807
838
  */
@@ -822,6 +853,7 @@ declare namespace LocalJSX {
822
853
  * @default defaultLabels
823
854
  */
824
855
  "timesLabels"?: TimesLabels;
856
+ "timesPickerLabels"?: TimesPickerLabels;
825
857
  /**
826
858
  * @default true
827
859
  */
@@ -844,7 +876,7 @@ declare namespace LocalJSX {
844
876
  /**
845
877
  * @default defaultLabels
846
878
  */
847
- "labels"?: InclusivekTimesPickerLabels;
879
+ "labels"?: TimesPickerLabels1;
848
880
  /**
849
881
  * @default true
850
882
  */
@@ -880,6 +912,7 @@ declare namespace LocalJSX {
880
912
  "showYearStepper": boolean;
881
913
  "showMonthStepper": boolean;
882
914
  "showClearButton": boolean;
915
+ "showCloseButton": boolean;
883
916
  "showTodayButton": boolean;
884
917
  "inputShouldFormat": string;
885
918
  "showKeyboardHint": boolean;
@@ -895,6 +928,7 @@ declare namespace LocalJSX {
895
928
  }
896
929
  interface TabworthyDatesCalendarAttributes {
897
930
  "clearButtonContent": string;
931
+ "closeButtonContent": string;
898
932
  "disabled": boolean;
899
933
  "modalIsOpen": boolean;
900
934
  "elementClassName": string;
@@ -909,6 +943,7 @@ declare namespace LocalJSX {
909
943
  "maxDate": string;
910
944
  "inline": boolean;
911
945
  "showClearButton": boolean;
946
+ "showCloseButton": boolean;
912
947
  "showMonthStepper": boolean;
913
948
  "showTodayButton": boolean;
914
949
  "showYearStepper": boolean;
@@ -941,6 +976,7 @@ declare namespace LocalJSX {
941
976
  "showYearStepper": boolean;
942
977
  "showMonthStepper": boolean;
943
978
  "showClearButton": boolean;
979
+ "showCloseButton": boolean;
944
980
  "showTodayButton": boolean;
945
981
  "calendarButtonContent": string;
946
982
  "elementClassName": string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tabworthy/components",
3
- "version": "0.9.1",
3
+ "version": "0.10.0",
4
4
  "description": "Small, accessible datepicker and datetimepicker Web Components with natural language date input.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1 +0,0 @@
1
- import{p as t,H as e,c as i,h as s,d as a,t as n}from"./p-BiJ0HZVY.js";function h(t,e){const i=new Date(t);return i.setDate(i.getDate()+e),i}function o(t){return k(new Date(`${w(t)}-${String(c(t)).padStart(2,"0")}-01`))}function r(t){return function(t){if(t instanceof Date)return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}(t)}function d(t){const e=o(t);return e.setMonth(e.getMonth()+1),e.setDate(e.getDate()-1),e}function c(t){return t.getMonth()+1}function l(t){return h(t,1)}function u(t){const e=new Date(t);return e.setMonth(e.getMonth()+1),e}function b(t){const e=new Date(t);return e.setFullYear(e.getFullYear()+1),e}function f(t){return m(t,1)}function v(t){const e=new Date(t);return e.setMonth(e.getMonth()-1),e}function y(t){const e=new Date(t);return e.setFullYear(e.getFullYear()-1),e}function w(t){return t.getFullYear()}function p(t,e){return!(!t||!e)&&t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()&&t.getDate()===e.getDate()}function k(t){const e=new Date(t);return e.setMinutes(e.getMinutes()+e.getTimezoneOffset()),e}function m(t,e){const i=new Date(t);return i.setDate(i.getDate()-e),i}function D(t,e){if(e){const i=k(new Date(e));return t>=i||p(i,t)}return!0}function g(t,e){if(e){const i=k(new Date(e));return t<=i||p(t,i)}return!0}function C(t,e,i){return D(t,e)&&g(t,i)}function $(t,e,i,s){const a=new Date(e,t,1);a.setDate(a.getDate()-1);const n=new Date(e,t+1,0);return n.setDate(a.getDate()+1),!C(a,i,s)&&!C(n,i,s)}function x(t){if(null==t.match(/^\d{4}-\d{2}-\d{2}$/))return!1;var e=new Date(t);return!isNaN(e.getTime())}function B(t){var e=t.match(/\d{4}-\d{2}-\d{2}/g);return null==e?void 0:e.slice(0,2)}const S={clearButton:"Clear value",monthSelect:"Select month",nextMonthButton:"Next month",nextYearButton:"Next year",picker:"Choose date",previousMonthButton:"Previous month",previousYearButton:"Previous year",todayButton:"Show today",yearSelect:"Select year",keyboardHint:"Keyboard commands",selected:"Selected date",chooseAsStartDate:"choose as start date",chooseAsEndDate:"choose as end date"},M=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.selectDate=i(this,"selectDate",3),this.changeMonth=i(this,"changeMonth",3),this.changeYear=i(this,"changeYear",3),this.disabled=!1,this.modalIsOpen=!1,this.disableDate=()=>!1,this.elementClassName="tabworthy-dates-calendar",this.firstDayOfWeek=0,this.range=!1,this.labels=S,this.locale=(null===navigator||void 0===navigator?void 0:navigator.language)||"en-US",this.inline=!1,this.showClearButton=!1,this.showMonthStepper=!0,this.showTodayButton=!0,this.showYearStepper=!1,this.showKeyboardHint=!1,this.showHiddenTitle=!0,this.startDate=r(new Date),this.init=()=>{this.currentDate=this.startDate?k(new Date(this.startDate)):new Date,this.updateWeekdays()},this.nextMonth=()=>{this.updateCurrentDate(u(this.currentDate))},this.nextYear=()=>{this.updateCurrentDate(b(this.currentDate),!1,!0)},this.previousMonth=()=>{this.updateCurrentDate(v(this.currentDate))},this.previousYear=()=>{this.updateCurrentDate(y(this.currentDate),!1,!0)},this.showToday=()=>{this.updateCurrentDate(new Date,!0)},this.clear=()=>{var t;this.value=void 0,null===(t=this.selectDate)||void 0===t||t.emit(void 0)},this.onClick=t=>{if(this.disabled)return;const e=t.target.closest("[data-date]");if(!Boolean(e))return;const i=k(new Date(e.dataset.date));this.updateCurrentDate(i),this.onSelectDate(i)},this.onMonthSelect=t=>{const e=+t.target.value-1,i=new Date(this.currentDate);C(i,this.minDate,this.maxDate)&&(i.setMonth(e),this.updateCurrentDate(i))},this.onYearSelect=t=>{var e;const i=+t.target.value,s=new Date(this.currentDate);C(s,this.minDate,this.maxDate)&&(s.setFullYear(i),null===(e=this.changeYear)||void 0===e||e.emit({year:i}),this.updateCurrentDate(s))},this.onKeyDown=t=>{this.disabled||("ArrowLeft"===t.code?(t.preventDefault(),this.updateCurrentDate(f(this.currentDate),!0)):"ArrowRight"===t.code?(t.preventDefault(),this.updateCurrentDate(l(this.currentDate),!0)):"ArrowUp"===t.code?(t.preventDefault(),this.updateCurrentDate(m(this.currentDate,7),!0)):"ArrowDown"===t.code?(t.preventDefault(),this.updateCurrentDate(h(this.currentDate,7),!0)):"PageUp"===t.code?(t.preventDefault(),this.updateCurrentDate(t.shiftKey?y(this.currentDate):v(this.currentDate),!0)):"PageDown"===t.code?(t.preventDefault(),this.updateCurrentDate(t.shiftKey?b(this.currentDate):u(this.currentDate),!0)):"Home"===t.code?(t.preventDefault(),this.updateCurrentDate(o(this.currentDate),!0)):"End"===t.code?(t.preventDefault(),this.updateCurrentDate(d(this.currentDate),!0)):"Space"!==t.code&&"Enter"!==t.code||(t.preventDefault(),this.onSelectDate(this.currentDate)))},this.onMouseEnter=t=>{var e;if(this.disabled)return;const i=k(new Date(null===(e=t.target.closest("td"))||void 0===e?void 0:e.dataset.date));this.hoveredDate=i},this.onMouseLeave=()=>{this.hoveredDate=void 0}}componentWillLoad(){this.init()}watchModalIsOpen(){!0===this.modalIsOpen&&(this.moveFocusOnModalOpen=!0)}watchFirstDayOfWeek(){this.updateWeekdays()}watchLocale(){Boolean(this.locale)||(this.locale=(null===navigator||void 0===navigator?void 0:navigator.language)||"en-US"),this.updateWeekdays()}watchRange(){var t;this.value=void 0,null===(t=this.selectDate)||void 0===t||t.emit(void 0)}watchStartDate(){this.currentDate=this.startDate?k(new Date(this.startDate)):new Date}watchValue(){Boolean(this.value)&&(Array.isArray(this.value)&&this.value.length>=1?this.currentDate=this.value[0]:this.value instanceof Date&&(this.currentDate=this.value))}componentDidRender(){this.moveFocusAfterMonthChanged&&(this.focusDate(this.currentDate),this.moveFocusAfterMonthChanged=!1),this.moveFocusOnModalOpen&&setTimeout((()=>{this.focusDate(this.currentDate),this.moveFocusOnModalOpen=!1}),100)}updateWeekdays(){var t,e;this.weekdays=(t=this.firstDayOfWeek,e=this.locale,new Array(7).fill(void 0).map(((e,i)=>(t+i)%7+1)).map((t=>{const i=new Date(2006,0,t);return[Intl.DateTimeFormat(e,{weekday:"short"}).format(i),Intl.DateTimeFormat(e,{weekday:"long"}).format(i)]})))}getClassName(t){return Boolean(t)?`${this.elementClassName}__${t}`:this.elementClassName}getCalendarRows(){const t=function(t,e,i){const s=[],a=o(t),n=0===a.getDay()?7:a.getDay(),h=d(t),r=0===h.getDay()?7:h.getDay(),c=1===i?7:i-1,u=[],b=[];{let t=(7-i+n)%7,e=f(a);for(;t>0;)u.push(e),e=f(e),t-=1;u.reverse();let s=(7-r+c)%7,o=l(h);for(;s>0;)b.push(o),o=l(o),s-=1}let v=a;for(;v.getMonth()===t.getMonth();)s.push(v),v=l(v);return[...u,...s,...b]}(this.currentDate,0,0===this.firstDayOfWeek?7:this.firstDayOfWeek),e=[];for(let i=0;i<t.length;i+=7){const s=t.slice(i,i+7);e.push(s)}return e}getTitle(){if(Boolean(this.currentDate))return Intl.DateTimeFormat(this.locale,{month:"long",year:"numeric"}).format(this.currentDate)}focusDate(t){var e;t&&(null===(e=this.el.querySelector(`[data-date="${r(t)}"]`))||void 0===e||e.focus())}updateCurrentDate(t,e,i=!1){var s,a,n;const h=t.getMonth(),o=t.getFullYear();D(t,this.minDate)||(t=new Date(this.minDate)),g(t,this.maxDate)||(t=new Date(this.maxDate)),(h!==(null===(s=this.currentDate)||void 0===s?void 0:s.getMonth())||o!==this.currentDate.getFullYear())&&(null===(a=this.changeMonth)||void 0===a||a.emit({month:c(t),year:w(t)}),e&&(this.moveFocusAfterMonthChanged=!0)),this.currentDate=t,e&&this.focusDate(this.currentDate),i&&(null===(n=this.changeYear)||void 0===n||n.emit({year:w(t)}))}onSelectDate(t){var e,i,s,a;if(!this.disableDate(t)&&C(t,this.minDate,this.maxDate))if(this.isRangeValue(this.value)){const s=void 0===(null===(e=this.value)||void 0===e?void 0:e[0])||2===this.value.length?[t]:[this.value[0],t];2===s.length&&s[0]>s[1]&&s.reverse();const a=void 0===s[1]?[r(s[0])]:[r(s[0]),r(s[1])];this.value=s,null===(i=this.selectDate)||void 0===i||i.emit(a)}else{if((null===(s=this.value)||void 0===s?void 0:s.getTime())===t.getTime())return;this.value=t,null===(a=this.selectDate)||void 0===a||a.emit(r(t))}}isRangeValue(t){return!!this.range}render(){var t;const e=this.showTodayButton||this.showClearButton||this.showKeyboardHint,i={year:{prev:this.disabled||!!this.minDate&&new Date(this.minDate).getFullYear()>y(this.currentDate).getFullYear(),next:this.disabled||!!this.maxDate&&new Date(this.maxDate).getFullYear()<b(this.currentDate).getFullYear()},month:{prev:this.disabled||$(v(this.currentDate).getMonth(),v(this.currentDate).getFullYear(),this.minDate,this.maxDate),next:this.disabled||$(u(this.currentDate).getMonth(),u(this.currentDate).getFullYear(),this.minDate,this.maxDate)}};return s(a,{key:"cc8676fdeec05b5635c367353e7bb1b8c997dedd"},s("div",{key:"4a4efc949f954772a55dad16e507a938b0308130",class:{[`${this.getClassName()}-wrapper`]:!0,[`${this.getClassName()}-wrapper--inline`]:this.inline}},s("div",{key:"de0afeccacba5e76162a4d22041f3b65983e77fe",class:{[this.getClassName()]:!0,[`${this.getClassName()}--disabled`]:this.disabled}},s("div",{key:"e8ed89a15cd32f629e559c9e9922c97816aff70c",class:this.getClassName("header")},this.showHiddenTitle&&s("span",{key:"8a922cf4df9ee3f87a673cfaf2d04fe539305bbe","aria-atomic":"true","aria-live":"polite",class:"visually-hidden"},this.getTitle()),this.showYearStepper&&s("button",{key:"225e73d3b12646781661d28057f4d9611e624c69","aria-label":this.labels.previousYearButton,class:this.getClassName("previous-year-button"),"aria-disabled":i.year.prev,innerHTML:this.previousYearButtonContent||void 0,onClick:this.previousYear,type:"button"},s("svg",{key:"e0fd3f0d41f596b450642eb9c27c5958feb7ba30",fill:"none",height:"24","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"24"},s("polyline",{key:"85735b11b068015e671f550639ded6193dfbab28",points:"11 17 6 12 11 7"}),s("polyline",{key:"19c3ffcbb7b98261be4b309a2bbbaa826ea1ad73",points:"18 17 13 12 18 7"}))),this.showMonthStepper&&s("button",{key:"4b687ad0f92198cb9a324b8c0d380ae0a31f2346","aria-label":this.labels.previousMonthButton,class:this.getClassName("previous-month-button"),"aria-disabled":i.month.prev,innerHTML:this.previousMonthButtonContent||void 0,onClick:this.previousMonth,type:"button"},s("svg",{key:"a1931a36fddf8a84cc8f4d367b34b8b59d03cc09",fill:"none",height:"24","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"24"},s("polyline",{key:"e053a2405fb992e9eaeddf114b8da460b41ade13",points:"15 18 9 12 15 6"}))),s("span",{key:"fbf8feee129211cf10f611c879288d76f7456c9d",class:this.getClassName("current-month")},s("select",{key:"ca2826280a1ab8065551fa908d40f96cc04d5464","aria-label":this.labels.monthSelect,class:this.getClassName("month-select"),"aria-disabled":this.disabled,name:"month",onChange:this.onMonthSelect},(n=this.locale,new Array(12).fill(void 0).map(((t,e)=>{const i=k(new Date(`2006-${String(e+1).padStart(2,"0")}-01`));return Intl.DateTimeFormat(n,{month:"long"}).format(i)}))).map(((t,e)=>s("option",{key:t,selected:this.currentDate.getMonth()===e,value:e+1,disabled:$(e,this.currentDate.getFullYear(),this.minDate,this.maxDate)},t)))),s("input",{key:"b3f5b2dabeb38734d3602ac8aaff56a7d5a49393","aria-label":this.labels.yearSelect,class:this.getClassName("year-select"),"aria-disabled":this.disabled,max:this.maxDate?this.maxDate.slice(0,4):9999,min:this.minDate?this.minDate.slice(0,4):1,name:"year",onChange:this.onYearSelect,type:"number",value:this.currentDate.getFullYear()})),this.showMonthStepper&&s("button",{key:"9312dc20b70fbda5bd86f25b230665a8f7f75386","aria-label":this.labels.nextMonthButton,class:this.getClassName("next-month-button"),"aria-disabled":i.month.next,innerHTML:this.nextMonthButtonContent||void 0,onClick:this.nextMonth,type:"button"},s("svg",{key:"82f1f31e919a2e316941824c0b0d59c5a1852f73",fill:"none",height:"24","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"24"},s("polyline",{key:"3365487b15f4149b5ae035ca1f1364396c133ef0",points:"9 18 15 12 9 6"}))),this.showYearStepper&&s("button",{key:"e83b33e034ee0fbd49e8aab90e1716ada40d2f19","aria-label":this.labels.nextYearButton,class:this.getClassName("next-year-button"),"aria-disabled":i.year.next,innerHTML:this.nextYearButtonContent||void 0,onClick:this.nextYear,type:"button"},s("svg",{key:"32b65eb085653d5c62e60262fc87f59b6d105e57",fill:"none",height:"24","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"24"},s("polyline",{key:"eaa98641ba48a322fd7b3ac953d13104bb63aad3",points:"13 17 18 12 13 7"}),s("polyline",{key:"89b7de7ec2e24a01a808e885ac68a11c3779f9c2",points:"6 17 11 12 6 7"})))),s("div",{key:"a21c8a94b1ae0e5b66074d2ca956afac456f366f",class:this.getClassName("body")},s("table",{key:"2968d8355122e3eb18de35b4c72d2404794f62e6",class:this.getClassName("calendar"),onKeyDown:this.onKeyDown,role:"grid","aria-label":this.getTitle()},s("thead",{key:"568a00357a3e64e692c80d90739c560513239c1d",class:this.getClassName("calendar-header")},s("tr",{key:"4e80bf075ad630237b5ea156267a0c0d9d4f0423",class:this.getClassName("weekday-row")},null===(t=this.weekdays)||void 0===t?void 0:t.map((t=>s("th",{role:"columnheader",abbr:t[1],class:this.getClassName("weekday"),key:t[0],scope:"col"},s("span",{"aria-hidden":"true"},t[0]),s("span",{class:"visually-hidden"},t[1])))))),s("tbody",{key:"26dfbb76ab92d065ab5f38b7135fced7738ca4a7"},this.getCalendarRows().map((t=>{const e=`row-${t[0].getMonth()}-${t[0].getDate()}`;return s("tr",{class:this.getClassName("calendar-row"),key:e},t.map((t=>{var e,i,a;const n=p(t,this.currentDate),h=t.getMonth()!==(null===(e=this.currentDate)||void 0===e?void 0:e.getMonth()),o=Array.isArray(this.value)?p(t,this.value[0])||this.value[1]&&C(t,r(this.value[0]),r(this.value[1])):p(t,this.value),d=this.disableDate(t)||!C(t,this.minDate,this.maxDate),c=!!this.isRangeValue(this.value)&&(u={from:null===(i=this.value)||void 0===i?void 0:i[0],to:(null===(a=this.value)||void 0===a?void 0:a[1])||this.hoveredDate||this.currentDate},!!((l=t)&&u&&u.from&&u.to)&&l>=(u.from<u.to?u.from:u.to)&&l<=(u.from<u.to?u.to:u.from)&&!d);var l,u;const b=p(t,new Date),f=`cell-${t.getMonth()}-${t.getDate()}`,v={[this.getClassName("date")]:!0,[this.getClassName("date--current")]:n,[this.getClassName("date--disabled")]:d,[this.getClassName("date--overflowing")]:h,[this.getClassName("date--today")]:b,[this.getClassName("date--selected")]:o,[this.getClassName("date--in-range")]:c},y=o?"strong":b?"em":"span";return s("td",{"aria-disabled":String(d),"aria-selected":o?"true":void 0,class:v,"data-date":r(t),key:f,onClick:this.onClick,onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,role:"gridcell",tabIndex:p(t,this.currentDate)&&!this.disabled?0:-1},s(y,{"aria-hidden":"true"},t.getDate()),s("span",{class:"visually-hidden"},(()=>{if(this.range){let e=this.value?"":`, ${this.labels.chooseAsStartDate}.`;return Array.isArray(this.value)&&(e={1:`, ${this.labels.chooseAsEndDate}.`,2:`, ${this.labels.chooseAsStartDate}.`}[this.value.length]),`${o?`${this.labels.selected}, `:""}${Intl.DateTimeFormat(this.locale,{day:"numeric",month:"long",year:"numeric"}).format(t)}${e}`}return`${o?`${this.labels.selected}, `:""}${Intl.DateTimeFormat(this.locale,{day:"numeric",month:"long",year:"numeric"}).format(t)}`})()))})))}))))),e&&s("div",{key:"102ea99b292e7a028692615c68be2e8c5720913c",class:this.getClassName("footer")},s("div",{key:"6e1d52da734e986a9044847edd7ace16460605f2",class:this.getClassName("footer-buttons")},this.showTodayButton&&s("button",{key:"9508eadf9835bea2e1640e6ac622665bd19da4d8",class:this.getClassName("today-button"),disabled:this.disabled,innerHTML:this.todayButtonContent||void 0,onClick:this.showToday,type:"button"},this.labels.todayButton),this.showClearButton&&s("button",{key:"262b926076309bc44d5b36dd64217196b4d6e8e2",class:this.getClassName("clear-button"),disabled:this.disabled,innerHTML:this.clearButtonContent||void 0,onClick:this.clear,type:"button"},this.labels.clearButton)),this.showKeyboardHint&&!window.matchMedia("(pointer: coarse)").matches&&s("button",{key:"09c974e2b246f57381e0461dbb27eb83e523812d",type:"button",onClick:()=>alert("Todo: Add Keyboard helper!"),class:this.getClassName("keyboard-hint")},s("svg",{key:"4dd5a8ce6e5c96e79adf6d8b0308b56fae5be361",xmlns:"http://www.w3.org/2000/svg",height:"1em",width:"1em",viewBox:"0 0 48 48",fill:"currentColor"},s("path",{key:"f3378678d6a0dc9fe7ea9ffd42dc083c3dca5ec8",d:"M7 38q-1.2 0-2.1-.925Q4 36.15 4 35V13q0-1.2.9-2.1.9-.9 2.1-.9h34q1.2 0 2.1.9.9.9.9 2.1v22q0 1.15-.9 2.075Q42.2 38 41 38Zm0-3h34V13H7v22Zm8-3.25h18v-3H15Zm-4.85-6.25h3v-3h-3Zm6.2 0h3v-3h-3Zm6.15 0h3v-3h-3Zm6.2 0h3v-3h-3Zm6.15 0h3v-3h-3Zm-24.7-6.25h3v-3h-3Zm6.2 0h3v-3h-3Zm6.15 0h3v-3h-3Zm6.2 0h3v-3h-3Zm6.15 0h3v-3h-3ZM7 35V13v22Z"})),this.labels.keyboardHint))),s("slot",{key:"ec9b51b9aaf6c48e643120115dbc7f418e9fb8e4",name:"after-calendar"})));var n}get el(){return this}static get watchers(){return{modalIsOpen:[{watchModalIsOpen:0}],firstDayOfWeek:[{watchFirstDayOfWeek:0}],locale:[{watchLocale:0}],range:[{watchRange:0}],startDate:[{watchStartDate:0}],value:[{watchValue:0}]}}static get style(){return".visually-hidden.sc-tabworthy-dates-calendar{position:absolute;overflow:hidden;width:1px;height:1px;white-space:nowrap;clip:rect(0 0 0 0);-webkit-clip-path:inset(50%);clip-path:inset(50%)}"}},[262,"tabworthy-dates-calendar",{clearButtonContent:[1,"clear-button-content"],disabled:[4],modalIsOpen:[4,"modal-is-open"],disableDate:[16],elementClassName:[1,"element-class-name"],firstDayOfWeek:[2,"first-day-of-week"],range:[4],labels:[16],locale:[1],nextMonthButtonContent:[1,"next-month-button-content"],nextYearButtonContent:[1,"next-year-button-content"],previousMonthButtonContent:[1,"previous-month-button-content"],previousYearButtonContent:[1,"previous-year-button-content"],minDate:[1,"min-date"],maxDate:[1,"max-date"],inline:[4],showClearButton:[4,"show-clear-button"],showMonthStepper:[4,"show-month-stepper"],showTodayButton:[4,"show-today-button"],showYearStepper:[4,"show-year-stepper"],showKeyboardHint:[4,"show-keyboard-hint"],showHiddenTitle:[4,"show-hidden-title"],startDate:[1,"start-date"],todayButtonContent:[1,"today-button-content"],value:[1040],currentDate:[32],hoveredDate:[32],weekdays:[32]},void 0,{modalIsOpen:[{watchModalIsOpen:0}],firstDayOfWeek:[{watchFirstDayOfWeek:0}],locale:[{watchLocale:0}],range:[{watchRange:0}],startDate:[{watchStartDate:0}],value:[{watchValue:0}]}]);function Z(){"undefined"!=typeof customElements&&["tabworthy-dates-calendar"].forEach((t=>{"tabworthy-dates-calendar"===t&&(customElements.get(n(t))||customElements.define(n(t),M))}))}export{M as I,D as a,g as b,Z as c,C as d,B as e,r as g,x as i,k as r}
@@ -1 +0,0 @@
1
- import{r as t,c as e,h as i,H as n,g as s}from"./p-CwtZ_Lud.js";import{g as a,r,a as o,b as h,c,d,e as u,f as l,h as f,s as v,i as b,j as p,k as y,l as m,m as w,n as g,o as k,p as x,q as O,t as M,u as j,v as D,w as A}from"./p-BVHu5CWV.js";const C={clearButton:"Clear value",monthSelect:"Select month",nextMonthButton:"Next month",nextYearButton:"Next year",picker:"Choose date",previousMonthButton:"Previous month",previousYearButton:"Previous year",todayButton:"Show today",yearSelect:"Select year",keyboardHint:"Keyboard commands",selected:"Selected date",chooseAsStartDate:"choose as start date",chooseAsEndDate:"choose as end date"},S=class{constructor(i){t(this,i),this.selectDate=e(this,"selectDate",3),this.changeMonth=e(this,"changeMonth",3),this.changeYear=e(this,"changeYear",3),this.disabled=!1,this.modalIsOpen=!1,this.disableDate=()=>!1,this.elementClassName="tabworthy-dates-calendar",this.firstDayOfWeek=0,this.range=!1,this.labels=C,this.locale=(null===navigator||void 0===navigator?void 0:navigator.language)||"en-US",this.inline=!1,this.showClearButton=!1,this.showMonthStepper=!0,this.showTodayButton=!0,this.showYearStepper=!1,this.showKeyboardHint=!1,this.showHiddenTitle=!0,this.startDate=a(new Date),this.init=()=>{this.currentDate=this.startDate?r(new Date(this.startDate)):new Date,this.updateWeekdays()},this.nextMonth=()=>{this.updateCurrentDate(o(this.currentDate))},this.nextYear=()=>{this.updateCurrentDate(h(this.currentDate),!1,!0)},this.previousMonth=()=>{this.updateCurrentDate(c(this.currentDate))},this.previousYear=()=>{this.updateCurrentDate(d(this.currentDate),!1,!0)},this.showToday=()=>{this.updateCurrentDate(new Date,!0)},this.clear=()=>{var t;this.value=void 0,null===(t=this.selectDate)||void 0===t||t.emit(void 0)},this.onClick=t=>{if(this.disabled)return;const e=t.target.closest("[data-date]");if(!Boolean(e))return;const i=r(new Date(e.dataset.date));this.updateCurrentDate(i),this.onSelectDate(i)},this.onMonthSelect=t=>{const e=+t.target.value-1,i=new Date(this.currentDate);u(i,this.minDate,this.maxDate)&&(i.setMonth(e),this.updateCurrentDate(i))},this.onYearSelect=t=>{var e;const i=+t.target.value,n=new Date(this.currentDate);u(n,this.minDate,this.maxDate)&&(n.setFullYear(i),null===(e=this.changeYear)||void 0===e||e.emit({year:i}),this.updateCurrentDate(n))},this.onKeyDown=t=>{this.disabled||("ArrowLeft"===t.code?(t.preventDefault(),this.updateCurrentDate(l(this.currentDate),!0)):"ArrowRight"===t.code?(t.preventDefault(),this.updateCurrentDate(f(this.currentDate),!0)):"ArrowUp"===t.code?(t.preventDefault(),this.updateCurrentDate(v(this.currentDate,7),!0)):"ArrowDown"===t.code?(t.preventDefault(),this.updateCurrentDate(b(this.currentDate,7),!0)):"PageUp"===t.code?(t.preventDefault(),this.updateCurrentDate(t.shiftKey?d(this.currentDate):c(this.currentDate),!0)):"PageDown"===t.code?(t.preventDefault(),this.updateCurrentDate(t.shiftKey?h(this.currentDate):o(this.currentDate),!0)):"Home"===t.code?(t.preventDefault(),this.updateCurrentDate(p(this.currentDate),!0)):"End"===t.code?(t.preventDefault(),this.updateCurrentDate(y(this.currentDate),!0)):"Space"!==t.code&&"Enter"!==t.code||(t.preventDefault(),this.onSelectDate(this.currentDate)))},this.onMouseEnter=t=>{var e;if(this.disabled)return;const i=r(new Date(null===(e=t.target.closest("td"))||void 0===e?void 0:e.dataset.date));this.hoveredDate=i},this.onMouseLeave=()=>{this.hoveredDate=void 0}}componentWillLoad(){this.init()}watchModalIsOpen(){!0===this.modalIsOpen&&(this.moveFocusOnModalOpen=!0)}watchFirstDayOfWeek(){this.updateWeekdays()}watchLocale(){Boolean(this.locale)||(this.locale=(null===navigator||void 0===navigator?void 0:navigator.language)||"en-US"),this.updateWeekdays()}watchRange(){var t;this.value=void 0,null===(t=this.selectDate)||void 0===t||t.emit(void 0)}watchStartDate(){this.currentDate=this.startDate?r(new Date(this.startDate)):new Date}watchValue(){Boolean(this.value)&&(Array.isArray(this.value)&&this.value.length>=1?this.currentDate=this.value[0]:this.value instanceof Date&&(this.currentDate=this.value))}componentDidRender(){this.moveFocusAfterMonthChanged&&(this.focusDate(this.currentDate),this.moveFocusAfterMonthChanged=!1),this.moveFocusOnModalOpen&&setTimeout((()=>{this.focusDate(this.currentDate),this.moveFocusOnModalOpen=!1}),100)}updateWeekdays(){this.weekdays=m(this.firstDayOfWeek,this.locale)}getClassName(t){return Boolean(t)?`${this.elementClassName}__${t}`:this.elementClassName}getCalendarRows(){const t=w(this.currentDate,!0,0===this.firstDayOfWeek?7:this.firstDayOfWeek),e=[];for(let i=0;i<t.length;i+=7){const n=t.slice(i,i+7);e.push(n)}return e}getTitle(){if(Boolean(this.currentDate))return Intl.DateTimeFormat(this.locale,{month:"long",year:"numeric"}).format(this.currentDate)}focusDate(t){var e;t&&(null===(e=this.el.querySelector(`[data-date="${a(t)}"]`))||void 0===e||e.focus())}updateCurrentDate(t,e,i=!1){var n,s,a;const r=t.getMonth(),o=t.getFullYear();g(t,this.minDate)||(t=new Date(this.minDate)),k(t,this.maxDate)||(t=new Date(this.maxDate)),(r!==(null===(n=this.currentDate)||void 0===n?void 0:n.getMonth())||o!==this.currentDate.getFullYear())&&(null===(s=this.changeMonth)||void 0===s||s.emit({month:O(t),year:x(t)}),e&&(this.moveFocusAfterMonthChanged=!0)),this.currentDate=t,e&&this.focusDate(this.currentDate),i&&(null===(a=this.changeYear)||void 0===a||a.emit({year:x(t)}))}onSelectDate(t){var e,i,n,s;if(!this.disableDate(t)&&u(t,this.minDate,this.maxDate))if(this.isRangeValue(this.value)){const n=void 0===(null===(e=this.value)||void 0===e?void 0:e[0])||2===this.value.length?[t]:[this.value[0],t];2===n.length&&n[0]>n[1]&&n.reverse();const s=void 0===n[1]?[a(n[0])]:[a(n[0]),a(n[1])];this.value=n,null===(i=this.selectDate)||void 0===i||i.emit(s)}else{if((null===(n=this.value)||void 0===n?void 0:n.getTime())===t.getTime())return;this.value=t,null===(s=this.selectDate)||void 0===s||s.emit(a(t))}}isRangeValue(t){return!!this.range}render(){var t;const e=this.showTodayButton||this.showClearButton||this.showKeyboardHint,s={year:{prev:this.disabled||!!this.minDate&&new Date(this.minDate).getFullYear()>d(this.currentDate).getFullYear(),next:this.disabled||!!this.maxDate&&new Date(this.maxDate).getFullYear()<h(this.currentDate).getFullYear()},month:{prev:this.disabled||M(c(this.currentDate).getMonth(),c(this.currentDate).getFullYear(),this.minDate,this.maxDate),next:this.disabled||M(o(this.currentDate).getMonth(),o(this.currentDate).getFullYear(),this.minDate,this.maxDate)}};return i(n,{key:"cc8676fdeec05b5635c367353e7bb1b8c997dedd"},i("div",{key:"4a4efc949f954772a55dad16e507a938b0308130",class:{[`${this.getClassName()}-wrapper`]:!0,[`${this.getClassName()}-wrapper--inline`]:this.inline}},i("div",{key:"de0afeccacba5e76162a4d22041f3b65983e77fe",class:{[this.getClassName()]:!0,[`${this.getClassName()}--disabled`]:this.disabled}},i("div",{key:"e8ed89a15cd32f629e559c9e9922c97816aff70c",class:this.getClassName("header")},this.showHiddenTitle&&i("span",{key:"8a922cf4df9ee3f87a673cfaf2d04fe539305bbe","aria-atomic":"true","aria-live":"polite",class:"visually-hidden"},this.getTitle()),this.showYearStepper&&i("button",{key:"225e73d3b12646781661d28057f4d9611e624c69","aria-label":this.labels.previousYearButton,class:this.getClassName("previous-year-button"),"aria-disabled":s.year.prev,innerHTML:this.previousYearButtonContent||void 0,onClick:this.previousYear,type:"button"},i("svg",{key:"e0fd3f0d41f596b450642eb9c27c5958feb7ba30",fill:"none",height:"24","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"24"},i("polyline",{key:"85735b11b068015e671f550639ded6193dfbab28",points:"11 17 6 12 11 7"}),i("polyline",{key:"19c3ffcbb7b98261be4b309a2bbbaa826ea1ad73",points:"18 17 13 12 18 7"}))),this.showMonthStepper&&i("button",{key:"4b687ad0f92198cb9a324b8c0d380ae0a31f2346","aria-label":this.labels.previousMonthButton,class:this.getClassName("previous-month-button"),"aria-disabled":s.month.prev,innerHTML:this.previousMonthButtonContent||void 0,onClick:this.previousMonth,type:"button"},i("svg",{key:"a1931a36fddf8a84cc8f4d367b34b8b59d03cc09",fill:"none",height:"24","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"24"},i("polyline",{key:"e053a2405fb992e9eaeddf114b8da460b41ade13",points:"15 18 9 12 15 6"}))),i("span",{key:"fbf8feee129211cf10f611c879288d76f7456c9d",class:this.getClassName("current-month")},i("select",{key:"ca2826280a1ab8065551fa908d40f96cc04d5464","aria-label":this.labels.monthSelect,class:this.getClassName("month-select"),"aria-disabled":this.disabled,name:"month",onChange:this.onMonthSelect},j(this.locale).map(((t,e)=>i("option",{key:t,selected:this.currentDate.getMonth()===e,value:e+1,disabled:M(e,this.currentDate.getFullYear(),this.minDate,this.maxDate)},t)))),i("input",{key:"b3f5b2dabeb38734d3602ac8aaff56a7d5a49393","aria-label":this.labels.yearSelect,class:this.getClassName("year-select"),"aria-disabled":this.disabled,max:this.maxDate?this.maxDate.slice(0,4):9999,min:this.minDate?this.minDate.slice(0,4):1,name:"year",onChange:this.onYearSelect,type:"number",value:this.currentDate.getFullYear()})),this.showMonthStepper&&i("button",{key:"9312dc20b70fbda5bd86f25b230665a8f7f75386","aria-label":this.labels.nextMonthButton,class:this.getClassName("next-month-button"),"aria-disabled":s.month.next,innerHTML:this.nextMonthButtonContent||void 0,onClick:this.nextMonth,type:"button"},i("svg",{key:"82f1f31e919a2e316941824c0b0d59c5a1852f73",fill:"none",height:"24","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"24"},i("polyline",{key:"3365487b15f4149b5ae035ca1f1364396c133ef0",points:"9 18 15 12 9 6"}))),this.showYearStepper&&i("button",{key:"e83b33e034ee0fbd49e8aab90e1716ada40d2f19","aria-label":this.labels.nextYearButton,class:this.getClassName("next-year-button"),"aria-disabled":s.year.next,innerHTML:this.nextYearButtonContent||void 0,onClick:this.nextYear,type:"button"},i("svg",{key:"32b65eb085653d5c62e60262fc87f59b6d105e57",fill:"none",height:"24","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"24"},i("polyline",{key:"eaa98641ba48a322fd7b3ac953d13104bb63aad3",points:"13 17 18 12 13 7"}),i("polyline",{key:"89b7de7ec2e24a01a808e885ac68a11c3779f9c2",points:"6 17 11 12 6 7"})))),i("div",{key:"a21c8a94b1ae0e5b66074d2ca956afac456f366f",class:this.getClassName("body")},i("table",{key:"2968d8355122e3eb18de35b4c72d2404794f62e6",class:this.getClassName("calendar"),onKeyDown:this.onKeyDown,role:"grid","aria-label":this.getTitle()},i("thead",{key:"568a00357a3e64e692c80d90739c560513239c1d",class:this.getClassName("calendar-header")},i("tr",{key:"4e80bf075ad630237b5ea156267a0c0d9d4f0423",class:this.getClassName("weekday-row")},null===(t=this.weekdays)||void 0===t?void 0:t.map((t=>i("th",{role:"columnheader",abbr:t[1],class:this.getClassName("weekday"),key:t[0],scope:"col"},i("span",{"aria-hidden":"true"},t[0]),i("span",{class:"visually-hidden"},t[1])))))),i("tbody",{key:"26dfbb76ab92d065ab5f38b7135fced7738ca4a7"},this.getCalendarRows().map((t=>{const e=`row-${t[0].getMonth()}-${t[0].getDate()}`;return i("tr",{class:this.getClassName("calendar-row"),key:e},t.map((t=>{var e,n,s;const r=D(t,this.currentDate),o=t.getMonth()!==(null===(e=this.currentDate)||void 0===e?void 0:e.getMonth()),h=Array.isArray(this.value)?D(t,this.value[0])||this.value[1]&&u(t,a(this.value[0]),a(this.value[1])):D(t,this.value),c=this.disableDate(t)||!u(t,this.minDate,this.maxDate),d=!!this.isRangeValue(this.value)&&A(t,{from:null===(n=this.value)||void 0===n?void 0:n[0],to:(null===(s=this.value)||void 0===s?void 0:s[1])||this.hoveredDate||this.currentDate})&&!c,l=D(t,new Date),f=`cell-${t.getMonth()}-${t.getDate()}`,v={[this.getClassName("date")]:!0,[this.getClassName("date--current")]:r,[this.getClassName("date--disabled")]:c,[this.getClassName("date--overflowing")]:o,[this.getClassName("date--today")]:l,[this.getClassName("date--selected")]:h,[this.getClassName("date--in-range")]:d},b=h?"strong":l?"em":"span";return i("td",{"aria-disabled":String(c),"aria-selected":h?"true":void 0,class:v,"data-date":a(t),key:f,onClick:this.onClick,onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,role:"gridcell",tabIndex:D(t,this.currentDate)&&!this.disabled?0:-1},i(b,{"aria-hidden":"true"},t.getDate()),i("span",{class:"visually-hidden"},(()=>{if(this.range){let e=this.value?"":`, ${this.labels.chooseAsStartDate}.`;return Array.isArray(this.value)&&(e={1:`, ${this.labels.chooseAsEndDate}.`,2:`, ${this.labels.chooseAsStartDate}.`}[this.value.length]),`${h?`${this.labels.selected}, `:""}${Intl.DateTimeFormat(this.locale,{day:"numeric",month:"long",year:"numeric"}).format(t)}${e}`}return`${h?`${this.labels.selected}, `:""}${Intl.DateTimeFormat(this.locale,{day:"numeric",month:"long",year:"numeric"}).format(t)}`})()))})))}))))),e&&i("div",{key:"102ea99b292e7a028692615c68be2e8c5720913c",class:this.getClassName("footer")},i("div",{key:"6e1d52da734e986a9044847edd7ace16460605f2",class:this.getClassName("footer-buttons")},this.showTodayButton&&i("button",{key:"9508eadf9835bea2e1640e6ac622665bd19da4d8",class:this.getClassName("today-button"),disabled:this.disabled,innerHTML:this.todayButtonContent||void 0,onClick:this.showToday,type:"button"},this.labels.todayButton),this.showClearButton&&i("button",{key:"262b926076309bc44d5b36dd64217196b4d6e8e2",class:this.getClassName("clear-button"),disabled:this.disabled,innerHTML:this.clearButtonContent||void 0,onClick:this.clear,type:"button"},this.labels.clearButton)),this.showKeyboardHint&&!window.matchMedia("(pointer: coarse)").matches&&i("button",{key:"09c974e2b246f57381e0461dbb27eb83e523812d",type:"button",onClick:()=>alert("Todo: Add Keyboard helper!"),class:this.getClassName("keyboard-hint")},i("svg",{key:"4dd5a8ce6e5c96e79adf6d8b0308b56fae5be361",xmlns:"http://www.w3.org/2000/svg",height:"1em",width:"1em",viewBox:"0 0 48 48",fill:"currentColor"},i("path",{key:"f3378678d6a0dc9fe7ea9ffd42dc083c3dca5ec8",d:"M7 38q-1.2 0-2.1-.925Q4 36.15 4 35V13q0-1.2.9-2.1.9-.9 2.1-.9h34q1.2 0 2.1.9.9.9.9 2.1v22q0 1.15-.9 2.075Q42.2 38 41 38Zm0-3h34V13H7v22Zm8-3.25h18v-3H15Zm-4.85-6.25h3v-3h-3Zm6.2 0h3v-3h-3Zm6.15 0h3v-3h-3Zm6.2 0h3v-3h-3Zm6.15 0h3v-3h-3Zm-24.7-6.25h3v-3h-3Zm6.2 0h3v-3h-3Zm6.15 0h3v-3h-3Zm6.2 0h3v-3h-3Zm6.15 0h3v-3h-3ZM7 35V13v22Z"})),this.labels.keyboardHint))),i("slot",{key:"ec9b51b9aaf6c48e643120115dbc7f418e9fb8e4",name:"after-calendar"})))}get el(){return s(this)}static get watchers(){return{modalIsOpen:[{watchModalIsOpen:0}],firstDayOfWeek:[{watchFirstDayOfWeek:0}],locale:[{watchLocale:0}],range:[{watchRange:0}],startDate:[{watchStartDate:0}],value:[{watchValue:0}]}}};function E(t,e,i,n=20,s=0){let a=[];if(s>=n)return a;const r=t=>{const a=t.assignedNodes().filter((t=>1===t.nodeType));return a.length>0?E(a[0].parentElement,e,i,n,s+1):[]},o=Array.from(t.children||[]);for(const t of o)e(t)||(i(t)&&a.push(t),null!=t.shadowRoot?a.push(...E(t.shadowRoot,e,i,n,s+1)):"SLOT"===t.tagName?a.push(...r(t)):a.push(...E(t,e,i,n,s+1)));return a}function L(t){return t.hasAttribute("hidden")||t.hasAttribute("aria-hidden")&&"false"!==t.getAttribute("aria-hidden")||"none"===t.style.display||"0"===t.style.opacity||"hidden"===t.style.visibility||"collapse"===t.style.visibility}function B(t){return"-1"!==t.getAttribute("tabindex")&&!L(t)&&!function(t){return t.hasAttribute("disabled")||t.hasAttribute("aria-disabled")&&"false"!==t.getAttribute("aria-disabled")}(t)&&(t.hasAttribute("tabindex")||(t instanceof HTMLAnchorElement||t instanceof HTMLAreaElement)&&t.hasAttribute("href")||t instanceof HTMLButtonElement||t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement||t instanceof HTMLIFrameElement)}S.style=".visually-hidden.sc-tabworthy-dates-calendar{position:absolute;overflow:hidden;width:1px;height:1px;white-space:nowrap;clip:rect(0 0 0 0);-webkit-clip-path:inset(50%);clip-path:inset(50%)}";const T=new Map,H=document.createElement("template");H.innerHTML='\n\t<div id="start"></div>\n\t<div id="backup"></div>\n\t<slot></slot>\n\t<div id="end"></div>\n';class $ extends HTMLElement{constructor(){super(),this.debounceId=Math.random().toString(),this._focused=!1;const t=this.attachShadow({mode:"open"});t.appendChild(H.content.cloneNode(!0)),this.$backup=t.querySelector("#backup"),this.$start=t.querySelector("#start"),this.$end=t.querySelector("#end"),this.focusLastElement=this.focusLastElement.bind(this),this.focusFirstElement=this.focusFirstElement.bind(this),this.onFocusIn=this.onFocusIn.bind(this),this.onFocusOut=this.onFocusOut.bind(this)}static get observedAttributes(){return["inactive"]}get inactive(){return this.hasAttribute("inactive")}set inactive(t){t?this.setAttribute("inactive",""):this.removeAttribute("inactive")}get focused(){return this._focused}connectedCallback(){this.$start.addEventListener("focus",this.focusLastElement),this.$end.addEventListener("focus",this.focusFirstElement),this.addEventListener("focusin",this.onFocusIn),this.addEventListener("focusout",this.onFocusOut),this.render()}disconnectedCallback(){this.$start.removeEventListener("focus",this.focusLastElement),this.$end.removeEventListener("focus",this.focusFirstElement),this.removeEventListener("focusin",this.onFocusIn),this.removeEventListener("focusout",this.onFocusOut)}attributeChangedCallback(){this.render()}focusFirstElement(){this.trapFocus()}focusLastElement(){this.trapFocus(!0)}getFocusableElements(){return E(this,L,B)}trapFocus(t){if(this.inactive)return;let e=this.getFocusableElements();e.length>0?(t?e[e.length-1].focus():e[0].focus(),this.$backup.setAttribute("tabindex","-1")):(this.$backup.setAttribute("tabindex","0"),this.$backup.focus())}onFocusIn(){this.updateFocused(!0)}onFocusOut(){this.updateFocused(!1)}updateFocused(t){!function(t,e,i){const n=T.get(i);null!=n&&window.clearTimeout(n),T.set(i,window.setTimeout((()=>{t(),T.delete(i)}),0))}((()=>{this.focused!==t&&(this._focused=t,this.render())}),0,this.debounceId)}render(){this.$start.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.$end.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.focused?this.setAttribute("focused",""):this.removeAttribute("focused")}}window.customElements.define("focus-trap",$);var P=new WeakMap,W=new WeakMap,I={},Z=0,q=function(t){return t&&(t.host||q(t.parentNode))},F=function(t,e,i){void 0===i&&(i="data-aria-hidden");var n=Array.from(Array.isArray(t)?t:[t]),s=function(t){return"undefined"==typeof document?null:(Array.isArray(t)?t[0]:t).ownerDocument.body}(t);return s?(n.push.apply(n,Array.from(s.querySelectorAll("[aria-live]"))),function(t,e,i,n){var s=function(t,e){return e.map((function(e){if(t.contains(e))return e;var i=q(e);return i&&t.contains(i)?i:(console.error("aria-hidden",e,"in not contained inside",t,". Doing nothing"),null)})).filter((function(t){return Boolean(t)}))}(e,Array.isArray(t)?t:[t]);I[i]||(I[i]=new WeakMap);var a=I[i],r=[],o=new Set,h=new Set(s),c=function(t){t&&!o.has(t)&&(o.add(t),c(t.parentNode))};s.forEach(c);var d=function(t){t&&!h.has(t)&&Array.prototype.forEach.call(t.children,(function(t){if(o.has(t))d(t);else{var e=t.getAttribute(n),s=null!==e&&"false"!==e,h=(P.get(t)||0)+1,c=(a.get(t)||0)+1;P.set(t,h),a.set(t,c),r.push(t),1===h&&s&&W.set(t,!0),1===c&&t.setAttribute(i,"true"),s||t.setAttribute(n,"true")}}))};return d(e),o.clear(),Z++,function(){r.forEach((function(t){var e=P.get(t)-1,s=a.get(t)-1;P.set(t,e),a.set(t,s),e||(W.has(t)||t.removeAttribute(n),W.delete(t)),s||t.removeAttribute(i)})),--Z||(P=new WeakMap,P=new WeakMap,W=new WeakMap,I={})}}(n,s,i,"aria-hidden")):function(){return null}},R="top",V="bottom",_="right",U="left",z="auto",K=[R,V,_,U],N="start",Y="end",Q="viewport",G="popper",J=K.reduce((function(t,e){return t.concat([e+"-"+N,e+"-"+Y])}),[]),X=[].concat(K,[z]).reduce((function(t,e){return t.concat([e,e+"-"+N,e+"-"+Y])}),[]),tt=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function et(t){return t?(t.nodeName||"").toLowerCase():null}function it(t){if(null==t)return window;if("[object Window]"!==t.toString()){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function nt(t){return t instanceof it(t).Element||t instanceof Element}function st(t){return t instanceof it(t).HTMLElement||t instanceof HTMLElement}function at(t){return"undefined"!=typeof ShadowRoot&&(t instanceof it(t).ShadowRoot||t instanceof ShadowRoot)}function rt(t){return t.split("-")[0]}var ot=Math.max,ht=Math.min,ct=Math.round;function dt(){var t=navigator.userAgentData;return null!=t&&t.brands&&Array.isArray(t.brands)?t.brands.map((function(t){return t.brand+"/"+t.version})).join(" "):navigator.userAgent}function ut(){return!/^((?!chrome|android).)*safari/i.test(dt())}function lt(t,e,i){void 0===e&&(e=!1),void 0===i&&(i=!1);var n=t.getBoundingClientRect(),s=1,a=1;e&&st(t)&&(s=t.offsetWidth>0&&ct(n.width)/t.offsetWidth||1,a=t.offsetHeight>0&&ct(n.height)/t.offsetHeight||1);var r=(nt(t)?it(t):window).visualViewport,o=!ut()&&i,h=(n.left+(o&&r?r.offsetLeft:0))/s,c=(n.top+(o&&r?r.offsetTop:0))/a,d=n.width/s,u=n.height/a;return{width:d,height:u,top:c,right:h+d,bottom:c+u,left:h,x:h,y:c}}function ft(t){var e=lt(t),i=t.offsetWidth,n=t.offsetHeight;return Math.abs(e.width-i)<=1&&(i=e.width),Math.abs(e.height-n)<=1&&(n=e.height),{x:t.offsetLeft,y:t.offsetTop,width:i,height:n}}function vt(t,e){var i=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(i&&at(i)){var n=e;do{if(n&&t.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}function bt(t){return it(t).getComputedStyle(t)}function pt(t){return["table","td","th"].indexOf(et(t))>=0}function yt(t){return((nt(t)?t.ownerDocument:t.document)||window.document).documentElement}function mt(t){return"html"===et(t)?t:t.assignedSlot||t.parentNode||(at(t)?t.host:null)||yt(t)}function wt(t){return st(t)&&"fixed"!==bt(t).position?t.offsetParent:null}function gt(t){for(var e=it(t),i=wt(t);i&&pt(i)&&"static"===bt(i).position;)i=wt(i);return i&&("html"===et(i)||"body"===et(i)&&"static"===bt(i).position)?e:i||function(t){var e=/firefox/i.test(dt());if(/Trident/i.test(dt())&&st(t)&&"fixed"===bt(t).position)return null;var i=mt(t);for(at(i)&&(i=i.host);st(i)&&["html","body"].indexOf(et(i))<0;){var n=bt(i);if("none"!==n.transform||"none"!==n.perspective||"paint"===n.contain||-1!==["transform","perspective"].indexOf(n.willChange)||e&&"filter"===n.willChange||e&&n.filter&&"none"!==n.filter)return i;i=i.parentNode}return null}(t)||e}function kt(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function xt(t,e,i){return ot(t,ht(e,i))}function Ot(t){return Object.assign({},{top:0,right:0,bottom:0,left:0},t)}function Mt(t,e){return e.reduce((function(e,i){return e[i]=t,e}),{})}function jt(t){return t.split("-")[1]}var Dt={top:"auto",right:"auto",bottom:"auto",left:"auto"};function At(t){var e,i=t.popper,n=t.popperRect,s=t.placement,a=t.variation,r=t.offsets,o=t.position,h=t.gpuAcceleration,c=t.adaptive,d=t.roundOffsets,u=t.isFixed,l=r.x,f=void 0===l?0:l,v=r.y,b=void 0===v?0:v,p="function"==typeof d?d({x:f,y:b}):{x:f,y:b};f=p.x,b=p.y;var y=r.hasOwnProperty("x"),m=r.hasOwnProperty("y"),w=U,g=R,k=window;if(c){var x=gt(i),O="clientHeight",M="clientWidth";x===it(i)&&"static"!==bt(x=yt(i)).position&&"absolute"===o&&(O="scrollHeight",M="scrollWidth"),(s===R||(s===U||s===_)&&a===Y)&&(g=V,b-=(u&&x===k&&k.visualViewport?k.visualViewport.height:x[O])-n.height,b*=h?1:-1),s!==U&&(s!==R&&s!==V||a!==Y)||(w=_,f-=(u&&x===k&&k.visualViewport?k.visualViewport.width:x[M])-n.width,f*=h?1:-1)}var j,D=Object.assign({position:o},c&&Dt),A=!0===d?function(t,e){var i=t.y,n=e.devicePixelRatio||1;return{x:ct(t.x*n)/n||0,y:ct(i*n)/n||0}}({x:f,y:b},it(i)):{x:f,y:b};return f=A.x,b=A.y,Object.assign({},D,h?((j={})[g]=m?"0":"",j[w]=y?"0":"",j.transform=(k.devicePixelRatio||1)<=1?"translate("+f+"px, "+b+"px)":"translate3d("+f+"px, "+b+"px, 0)",j):((e={})[g]=m?b+"px":"",e[w]=y?f+"px":"",e.transform="",e))}var Ct={passive:!0},St={left:"right",right:"left",bottom:"top",top:"bottom"};function Et(t){return t.replace(/left|right|bottom|top/g,(function(t){return St[t]}))}var Lt={start:"end",end:"start"};function Bt(t){return t.replace(/start|end/g,(function(t){return Lt[t]}))}function Tt(t){var e=it(t);return{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Ht(t){return lt(yt(t)).left+Tt(t).scrollLeft}function $t(t){var e=bt(t);return/auto|scroll|overlay|hidden/.test(e.overflow+e.overflowY+e.overflowX)}function Pt(t){return["html","body","#document"].indexOf(et(t))>=0?t.ownerDocument.body:st(t)&&$t(t)?t:Pt(mt(t))}function Wt(t,e){var i;void 0===e&&(e=[]);var n=Pt(t),s=n===(null==(i=t.ownerDocument)?void 0:i.body),a=it(n),r=s?[a].concat(a.visualViewport||[],$t(n)?n:[]):n,o=e.concat(r);return s?o:o.concat(Wt(mt(r)))}function It(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function Zt(t,e,i){return e===Q?It(function(t,e){var i=it(t),n=yt(t),s=i.visualViewport,a=n.clientWidth,r=n.clientHeight,o=0,h=0;if(s){a=s.width,r=s.height;var c=ut();(c||!c&&"fixed"===e)&&(o=s.offsetLeft,h=s.offsetTop)}return{width:a,height:r,x:o+Ht(t),y:h}}(t,i)):nt(e)?function(t,e){var i=lt(t,!1,"fixed"===e);return i.top=i.top+t.clientTop,i.left=i.left+t.clientLeft,i.bottom=i.top+t.clientHeight,i.right=i.left+t.clientWidth,i.width=t.clientWidth,i.height=t.clientHeight,i.x=i.left,i.y=i.top,i}(e,i):It(function(t){var e,i=yt(t),n=Tt(t),s=null==(e=t.ownerDocument)?void 0:e.body,a=ot(i.scrollWidth,i.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),r=ot(i.scrollHeight,i.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),o=-n.scrollLeft+Ht(t),h=-n.scrollTop;return"rtl"===bt(s||i).direction&&(o+=ot(i.clientWidth,s?s.clientWidth:0)-a),{width:a,height:r,x:o,y:h}}(yt(t)))}function qt(t){var e,i=t.reference,n=t.element,s=t.placement,a=s?rt(s):null,r=s?jt(s):null,o=i.x+i.width/2-n.width/2,h=i.y+i.height/2-n.height/2;switch(a){case R:e={x:o,y:i.y-n.height};break;case V:e={x:o,y:i.y+i.height};break;case _:e={x:i.x+i.width,y:h};break;case U:e={x:i.x-n.width,y:h};break;default:e={x:i.x,y:i.y}}var c=a?kt(a):null;if(null!=c){var d="y"===c?"height":"width";switch(r){case N:e[c]=e[c]-(i[d]/2-n[d]/2);break;case Y:e[c]=e[c]+(i[d]/2-n[d]/2)}}return e}function Ft(t,e){void 0===e&&(e={});var i=e.placement,n=void 0===i?t.placement:i,s=e.strategy,a=void 0===s?t.strategy:s,r=e.boundary,o=void 0===r?"clippingParents":r,h=e.rootBoundary,c=void 0===h?Q:h,d=e.elementContext,u=void 0===d?G:d,l=e.altBoundary,f=void 0!==l&&l,v=e.padding,b=void 0===v?0:v,p=Ot("number"!=typeof b?b:Mt(b,K)),y=t.rects.popper,m=t.elements[f?u===G?"reference":G:u],w=function(t,e,i,n){var s="clippingParents"===e?function(t){var e=Wt(mt(t)),i=["absolute","fixed"].indexOf(bt(t).position)>=0&&st(t)?gt(t):t;return nt(i)?e.filter((function(t){return nt(t)&&vt(t,i)&&"body"!==et(t)})):[]}(t):[].concat(e),a=[].concat(s,[i]),r=a.reduce((function(e,i){var s=Zt(t,i,n);return e.top=ot(s.top,e.top),e.right=ht(s.right,e.right),e.bottom=ht(s.bottom,e.bottom),e.left=ot(s.left,e.left),e}),Zt(t,a[0],n));return r.width=r.right-r.left,r.height=r.bottom-r.top,r.x=r.left,r.y=r.top,r}(nt(m)?m:m.contextElement||yt(t.elements.popper),o,c,a),g=lt(t.elements.reference),k=qt({reference:g,element:y,placement:n}),x=It(Object.assign({},y,k)),O=u===G?x:g,M={top:w.top-O.top+p.top,bottom:O.bottom-w.bottom+p.bottom,left:w.left-O.left+p.left,right:O.right-w.right+p.right},j=t.modifiersData.offset;if(u===G&&j){var D=j[n];Object.keys(M).forEach((function(t){var e=[_,V].indexOf(t)>=0?1:-1,i=[R,V].indexOf(t)>=0?"y":"x";M[t]+=D[i]*e}))}return M}function Rt(t,e){void 0===e&&(e={});var i=e.boundary,n=e.rootBoundary,s=e.padding,a=e.flipVariations,r=e.allowedAutoPlacements,o=void 0===r?X:r,h=jt(e.placement),c=h?a?J:J.filter((function(t){return jt(t)===h})):K,d=c.filter((function(t){return o.indexOf(t)>=0}));0===d.length&&(d=c);var u=d.reduce((function(e,a){return e[a]=Ft(t,{placement:a,boundary:i,rootBoundary:n,padding:s})[rt(a)],e}),{});return Object.keys(u).sort((function(t,e){return u[t]-u[e]}))}var Vt={name:"flip",enabled:!0,phase:"main",fn:function(t){var e=t.state,i=t.options,n=t.name;if(!e.modifiersData[n]._skip){for(var s=i.mainAxis,a=void 0===s||s,r=i.altAxis,o=void 0===r||r,h=i.fallbackPlacements,c=i.padding,d=i.boundary,u=i.rootBoundary,l=i.altBoundary,f=i.flipVariations,v=void 0===f||f,b=i.allowedAutoPlacements,p=e.options.placement,y=rt(p),m=h||(y!==p&&v?function(t){if(rt(t)===z)return[];var e=Et(t);return[Bt(t),e,Bt(e)]}(p):[Et(p)]),w=[p].concat(m).reduce((function(t,i){return t.concat(rt(i)===z?Rt(e,{placement:i,boundary:d,rootBoundary:u,padding:c,flipVariations:v,allowedAutoPlacements:b}):i)}),[]),g=e.rects.reference,k=e.rects.popper,x=new Map,O=!0,M=w[0],j=0;j<w.length;j++){var D=w[j],A=rt(D),C=jt(D)===N,S=[R,V].indexOf(A)>=0,E=S?"width":"height",L=Ft(e,{placement:D,boundary:d,rootBoundary:u,altBoundary:l,padding:c}),B=S?C?_:U:C?V:R;g[E]>k[E]&&(B=Et(B));var T=Et(B),H=[];if(a&&H.push(L[A]<=0),o&&H.push(L[B]<=0,L[T]<=0),H.every((function(t){return t}))){M=D,O=!1;break}x.set(D,H)}if(O)for(var $=function(t){var e=w.find((function(e){var i=x.get(e);if(i)return i.slice(0,t).every((function(t){return t}))}));if(e)return M=e,"break"},P=v?3:1;P>0&&"break"!==$(P);P--);e.placement!==M&&(e.modifiersData[n]._skip=!0,e.placement=M,e.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function _t(t,e,i){return void 0===i&&(i={x:0,y:0}),{top:t.top-e.height-i.y,right:t.right-e.width+i.x,bottom:t.bottom-e.height+i.y,left:t.left-e.width-i.x}}function Ut(t){return[R,_,V,U].some((function(e){return t[e]>=0}))}function zt(t,e,i){void 0===i&&(i=!1);var n,s,a=st(e),r=st(e)&&function(t){var e=t.getBoundingClientRect(),i=ct(e.width)/t.offsetWidth||1,n=ct(e.height)/t.offsetHeight||1;return 1!==i||1!==n}(e),o=yt(e),h=lt(t,r,i),c={scrollLeft:0,scrollTop:0},d={x:0,y:0};return(a||!a&&!i)&&(("body"!==et(e)||$t(o))&&(c=(n=e)!==it(n)&&st(n)?{scrollLeft:(s=n).scrollLeft,scrollTop:s.scrollTop}:Tt(n)),st(e)?((d=lt(e,!0)).x+=e.clientLeft,d.y+=e.clientTop):o&&(d.x=Ht(o))),{x:h.left+c.scrollLeft-d.x,y:h.top+c.scrollTop-d.y,width:h.width,height:h.height}}function Kt(t){var e=new Map,i=new Set,n=[];function s(t){i.add(t.name),[].concat(t.requires||[],t.requiresIfExists||[]).forEach((function(t){if(!i.has(t)){var n=e.get(t);n&&s(n)}})),n.push(t)}return t.forEach((function(t){e.set(t.name,t)})),t.forEach((function(t){i.has(t.name)||s(t)})),n}var Nt={placement:"bottom",modifiers:[],strategy:"absolute"};function Yt(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return!e.some((function(t){return!(t&&"function"==typeof t.getBoundingClientRect)}))}function Qt(t){void 0===t&&(t={});var e=t.defaultModifiers,i=void 0===e?[]:e,n=t.defaultOptions,s=void 0===n?Nt:n;return function(t,e,n){void 0===n&&(n=s);var a,r,o={placement:"bottom",orderedModifiers:[],options:Object.assign({},Nt,s),modifiersData:{},elements:{reference:t,popper:e},attributes:{},styles:{}},h=[],c=!1,d={state:o,setOptions:function(n){var a="function"==typeof n?n(o.options):n;u(),o.options=Object.assign({},s,o.options,a),o.scrollParents={reference:nt(t)?Wt(t):t.contextElement?Wt(t.contextElement):[],popper:Wt(e)};var r,c,l=function(t){var e=Kt(t);return tt.reduce((function(t,i){return t.concat(e.filter((function(t){return t.phase===i})))}),[])}((r=[].concat(i,o.options.modifiers),c=r.reduce((function(t,e){var i=t[e.name];return t[e.name]=i?Object.assign({},i,e,{options:Object.assign({},i.options,e.options),data:Object.assign({},i.data,e.data)}):e,t}),{}),Object.keys(c).map((function(t){return c[t]}))));return o.orderedModifiers=l.filter((function(t){return t.enabled})),o.orderedModifiers.forEach((function(t){var e=t.options,i=t.effect;if("function"==typeof i){var n=i({state:o,name:t.name,instance:d,options:void 0===e?{}:e});h.push(n||function(){})}})),d.update()},forceUpdate:function(){if(!c){var t=o.elements,e=t.reference,i=t.popper;if(Yt(e,i)){o.rects={reference:zt(e,gt(i),"fixed"===o.options.strategy),popper:ft(i)},o.reset=!1,o.placement=o.options.placement,o.orderedModifiers.forEach((function(t){return o.modifiersData[t.name]=Object.assign({},t.data)}));for(var n=0;n<o.orderedModifiers.length;n++)if(!0!==o.reset){var s=o.orderedModifiers[n],a=s.fn,r=s.options;"function"==typeof a&&(o=a({state:o,options:void 0===r?{}:r,name:s.name,instance:d})||o)}else o.reset=!1,n=-1}}},update:(a=function(){return new Promise((function(t){d.forceUpdate(),t(o)}))},function(){return r||(r=new Promise((function(t){Promise.resolve().then((function(){r=void 0,t(a())}))}))),r}),destroy:function(){u(),c=!0}};if(!Yt(t,e))return d;function u(){h.forEach((function(t){return t()})),h=[]}return d.setOptions(n).then((function(t){!c&&n.onFirstUpdate&&n.onFirstUpdate(t)})),d}}var Gt=Qt({defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(t){var e=t.state,i=t.instance,n=t.options,s=n.scroll,a=void 0===s||s,r=n.resize,o=void 0===r||r,h=it(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return a&&c.forEach((function(t){t.addEventListener("scroll",i.update,Ct)})),o&&h.addEventListener("resize",i.update,Ct),function(){a&&c.forEach((function(t){t.removeEventListener("scroll",i.update,Ct)})),o&&h.removeEventListener("resize",i.update,Ct)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(t){var e=t.state;e.modifiersData[t.name]=qt({reference:e.rects.reference,element:e.rects.popper,placement:e.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(t){var e=t.state,i=t.options,n=i.gpuAcceleration,s=void 0===n||n,a=i.adaptive,r=void 0===a||a,o=i.roundOffsets,h=void 0===o||o,c={placement:rt(e.placement),variation:jt(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:s,isFixed:"fixed"===e.options.strategy};null!=e.modifiersData.popperOffsets&&(e.styles.popper=Object.assign({},e.styles.popper,At(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:r,roundOffsets:h})))),null!=e.modifiersData.arrow&&(e.styles.arrow=Object.assign({},e.styles.arrow,At(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:h})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})},data:{}},{name:"applyStyles",enabled:!0,phase:"write",fn:function(t){var e=t.state;Object.keys(e.elements).forEach((function(t){var i=e.styles[t]||{},n=e.attributes[t]||{},s=e.elements[t];st(s)&&et(s)&&(Object.assign(s.style,i),Object.keys(n).forEach((function(t){var e=n[t];!1===e?s.removeAttribute(t):s.setAttribute(t,!0===e?"":e)})))}))},effect:function(t){var e=t.state,i={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,i.popper),e.styles=i,e.elements.arrow&&Object.assign(e.elements.arrow.style,i.arrow),function(){Object.keys(e.elements).forEach((function(t){var n=e.elements[t],s=e.attributes[t]||{},a=Object.keys(e.styles.hasOwnProperty(t)?e.styles[t]:i[t]).reduce((function(t,e){return t[e]="",t}),{});st(n)&&et(n)&&(Object.assign(n.style,a),Object.keys(s).forEach((function(t){n.removeAttribute(t)})))}))}},requires:["computeStyles"]},{name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(t){var e=t.state,i=t.name,n=t.options.offset,s=void 0===n?[0,0]:n,a=X.reduce((function(t,i){return t[i]=function(t,e,i){var n=rt(t),s=[U,R].indexOf(n)>=0?-1:1,a="function"==typeof i?i(Object.assign({},e,{placement:t})):i,r=a[0],o=a[1];return r=r||0,o=(o||0)*s,[U,_].indexOf(n)>=0?{x:o,y:r}:{x:r,y:o}}(i,e.rects,s),t}),{}),r=a[e.placement],o=r.y;null!=e.modifiersData.popperOffsets&&(e.modifiersData.popperOffsets.x+=r.x,e.modifiersData.popperOffsets.y+=o),e.modifiersData[i]=a}},Vt,{name:"preventOverflow",enabled:!0,phase:"main",fn:function(t){var e=t.state,i=t.options,n=t.name,s=i.mainAxis,a=void 0===s||s,r=i.altAxis,o=void 0!==r&&r,h=i.tether,c=void 0===h||h,d=i.tetherOffset,u=void 0===d?0:d,l=Ft(e,{boundary:i.boundary,rootBoundary:i.rootBoundary,padding:i.padding,altBoundary:i.altBoundary}),f=rt(e.placement),v=jt(e.placement),b=!v,p=kt(f),y="x"===p?"y":"x",m=e.modifiersData.popperOffsets,w=e.rects.reference,g=e.rects.popper,k="function"==typeof u?u(Object.assign({},e.rects,{placement:e.placement})):u,x="number"==typeof k?{mainAxis:k,altAxis:k}:Object.assign({mainAxis:0,altAxis:0},k),O=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,M={x:0,y:0};if(m){if(a){var j,D="y"===p?R:U,A="y"===p?V:_,C="y"===p?"height":"width",S=m[p],E=S+l[D],L=S-l[A],B=c?-g[C]/2:0,T=v===N?w[C]:g[C],H=v===N?-g[C]:-w[C],$=e.elements.arrow,P=c&&$?ft($):{width:0,height:0},W=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},I=W[D],Z=W[A],q=xt(0,w[C],P[C]),F=b?w[C]/2-B-q-I-x.mainAxis:T-q-I-x.mainAxis,z=b?-w[C]/2+B+q+Z+x.mainAxis:H+q+Z+x.mainAxis,K=e.elements.arrow&&gt(e.elements.arrow),Y=null!=(j=null==O?void 0:O[p])?j:0,Q=S+z-Y,G=xt(c?ht(E,S+F-Y-(K?"y"===p?K.clientTop||0:K.clientLeft||0:0)):E,S,c?ot(L,Q):L);m[p]=G,M[p]=G-S}if(o){var J,X=m[y],tt="y"===y?"height":"width",et=X+l["x"===p?R:U],it=X-l["x"===p?V:_],nt=-1!==[R,U].indexOf(f),st=null!=(J=null==O?void 0:O[y])?J:0,at=nt?et:X-w[tt]-g[tt]-st+x.altAxis,ct=nt?X+w[tt]+g[tt]-st-x.altAxis:it,dt=c&&nt?function(t,e,i){var n=xt(t,e,i);return n>i?i:n}(at,X,ct):xt(c?at:et,X,c?ct:it);m[y]=dt,M[y]=dt-X}e.modifiersData[n]=M}},requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:function(t){var e,i=t.state,n=t.name,s=t.options,a=i.elements.arrow,r=i.modifiersData.popperOffsets,o=rt(i.placement),h=kt(o),c=[U,_].indexOf(o)>=0?"height":"width";if(a&&r){var d=function(t,e){return Ot("number"!=typeof(t="function"==typeof t?t(Object.assign({},e.rects,{placement:e.placement})):t)?t:Mt(t,K))}(s.padding,i),u=ft(a),l="y"===h?R:U,f="y"===h?V:_,v=i.rects.reference[c]+i.rects.reference[h]-r[h]-i.rects.popper[c],b=r[h]-i.rects.reference[h],p=gt(a),y=p?"y"===h?p.clientHeight||0:p.clientWidth||0:0,m=y/2-u[c]/2+(v/2-b/2),w=xt(d[l],m,y-u[c]-d[f]);i.modifiersData[n]=((e={})[h]=w,e.centerOffset=w-m,e)}},effect:function(t){var e=t.state,i=t.options.element,n=void 0===i?"[data-popper-arrow]":i;null!=n&&("string"!=typeof n||(n=e.elements.popper.querySelector(n)))&&vt(e.elements.popper,n)&&(e.elements.arrow=n)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(t){var e=t.state,i=t.name,n=e.rects.reference,s=e.rects.popper,a=e.modifiersData.preventOverflow,r=Ft(e,{elementContext:"reference"}),o=Ft(e,{altBoundary:!0}),h=_t(r,n),c=_t(o,s,a),d=Ut(h),u=Ut(c);e.modifiersData[i]={referenceClippingOffsets:h,popperEscapeOffsets:c,isReferenceHidden:d,hasPopperEscaped:u},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":d,"data-popper-escaped":u})}}]});const Jt=class{constructor(i){t(this,i),this.opened=e(this,"opened",7),this.closed=e(this,"closed",7),this.inline=!1,this.placement="bottom-start",this.offset=[0,8],this.closing=!1,this.showing=this.inline||!1,this.positioned=!1,this.originalParent=null,this.originalNextSibling=null,this.isMovingPortal=!1,this.popperInstance=null,this.onKeyDown=t=>{"Escape"===t.code&&this.close()}}watchShowing(t){t||(this.destroyPopperInstance(),this.cleanupPortal()),this.positioned=!1}getAppendToElement(){return this.appendTo?"body"===this.appendTo?document.body:"string"==typeof this.appendTo?document.querySelector(this.appendTo):this.appendTo:null}setupPortal(){const t=this.getAppendToElement();t&&(this.originalParent=this.hostElement.parentElement,this.originalNextSibling=this.hostElement.nextSibling,this.isMovingPortal=!0,t.appendChild(this.hostElement),this.isMovingPortal=!1)}cleanupPortal(){this.isMovingPortal||this.originalParent&&(this.isMovingPortal=!0,this.originalNextSibling?this.originalParent.insertBefore(this.hostElement,this.originalNextSibling):this.originalParent.appendChild(this.hostElement),this.originalParent=null,this.originalNextSibling=null,this.isMovingPortal=!1)}createPopperInstance(){if(!this.triggerElement||!this.bodyRef)return;const t=!!this.appendTo,e=t?"viewport":"clippingParents";this.popperInstance=Gt(this.triggerElement,this.bodyRef,{placement:this.placement,strategy:t?"fixed":"absolute",modifiers:[{name:"offset",options:{offset:this.offset}},{name:"flip",options:{fallbackPlacements:["top-start","top-end","bottom-end"],boundary:e}},{name:"preventOverflow",options:{boundary:e,altAxis:!0,padding:8}},{name:"computeStyles",options:{gpuAcceleration:!0}},{name:"applyStyles",enabled:!0}]}),this.popperInstance.forceUpdate(),this.positioned=!0}destroyPopperInstance(){this.popperInstance&&(this.popperInstance.destroy(),this.popperInstance=null)}async open(){this.inline||(this.showing=!0,this.undo=F(this.el),this.opened.emit(void 0))}async close(){var t;this.inline||(this.showing=!1,this.closed.emit(void 0),null===(t=this.undo)||void 0===t||t.call(this),this.triggerElement&&this.triggerElement.focus())}disconnectedCallback(){this.isMovingPortal||(this.destroyPopperInstance(),this.cleanupPortal())}async getState(){return this.showing}async setTriggerElement(t){this.triggerElement=t}async updatePosition(){var t;await(null===(t=this.popperInstance)||void 0===t?void 0:t.update())}handleClick(t){var e;if(this.showing){const i=t.target;this.hostElement.contains(i)||(null===(e=this.triggerElement)||void 0===e?void 0:e.contains(i))||this.originalParent&&this.originalParent.contains(i)||this.close()}}render(){return i(n,{key:"35e8ed14b0108e9cb75782516d070dfb8474b0b2",showing:this.showing,ref:t=>t&&(this.el=t)},!this.inline&&this.showing&&i("div",{key:"fdb64ed8717e2a1620ef2d4ffb21a44d1de03a46",part:"body",ref:t=>{t&&(this.bodyRef=t,this.showing&&this.triggerElement&&!this.popperInstance&&(this.setupPortal(),requestAnimationFrame((()=>{requestAnimationFrame((()=>{this.createPopperInstance()}))}))))},style:{visibility:this.positioned?"visible":"hidden"},onKeyDown:this.onKeyDown,role:"dialog",tabindex:-1,"aria-hidden":!this.showing,"aria-label":this.label,"aria-modal":this.showing},i("focus-trap",{key:"af4734b1a18dd62a600ca49313b1ba07f2d19039"},i("div",{key:"fb41d5ce07b5aac179e4bed63c18a8d254503a50",part:"content"},i("slot",{key:"fc480cf1a29a42b1a19737a72d410c139dc32f07"})))),this.inline&&i("div",{key:"7aef10d50f790a1e72e05b26dc108c40500fa7c3",part:"content"},i("slot",{key:"06395cd19052d1b81ab448c0a9a618da876fa86d"})))}get hostElement(){return s(this)}static get watchers(){return{showing:[{watchShowing:0}]}}};Jt.style=":host::part(body){position:absolute;top:0;left:0;width:-moz-fit-content;width:fit-content;z-index:1200}:host::part(backdrop){}:host::part(content){}";export{S as tabworthy_dates_calendar,Jt as tabworthy_dates_modal}
@@ -1 +0,0 @@
1
- import{r as t,c as s,h as i,H as e,g as h}from"./p-CwtZ_Lud.js";import{h as a}from"./p-Mki5YqAR.js";import{g as r,r as o}from"./p-BVHu5CWV.js";const n={selected:"selected",openCalendar:"Choose time",calendar:"date and time picker",invalidDateError:"We could not find a matching date",minDateError:"Please fill in a date after ",maxDateError:"Please fill in a date before ",rangeOutOfBoundsError:"Please enter a valid range of dates",disabledDateError:"Please choose an available date",to:"to",startDate:"Start date",timeLabel:"Time"},d=class{constructor(i){t(this,i),this.selectDateTime=s(this,"selectDateTime",7),this.changeYear=s(this,"changeYear",7),this.componentReady=s(this,"componentReady",7),this.range=!1,this.label="Choose a date and time",this.placeholder="",this.locale=(null===navigator||void 0===navigator?void 0:navigator.language)||"en-US",this.disabled=!1,this.startDate=r(new Date),this.referenceDate=r(new Date),this.useTwelveHourFormat=!0,this.timesLabels=n,this.inline=!1,this.hasError=!1,this.showYearStepper=!1,this.showMonthStepper=!0,this.showClearButton=!0,this.showTodayButton=!0,this.disableDate=()=>!1,this.elementClassName="tabworthy-times",this.firstDayOfWeek=1,this.format="YYYY-MM-DDTHH:mm:ss",this.inputShouldFormat=!0,this.disableFreeformInput=!1,this.inputClass="",this.selectedHours=12,this.selectedMinutes=0,this.errorState=this.hasError,this.disabledState=this.disabled,this.errorMessage="",this.handlePickerSelection=async t=>{const s=t.split(",");if(this.range&&2===s.length){const t=o(new Date(s[0])),i=o(new Date(s[1]));this.updateValue([t,i]),this.pickerRef&&(this.pickerRef.value=[t,i])}else{const t=o(new Date(s[0]));this.updateValue(t),this.pickerRef&&(this.pickerRef.value=t)}},this.handleTimeChange=t=>{this.selectedHours=t.detail.hours,this.selectedMinutes=t.detail.minutes,this.selectedDate&&this.updateValue(this.selectedDate)},this.handleCalendarButtonClick=async()=>{this.modalRef&&(await this.modalRef.setTriggerElement(this.inputContainerRef),await this.modalRef.open())},this.handleYearChange=t=>{this.changeYear&&this.changeYear.emit(t)},this.handleChangedMonths=()=>{},this.handleInputBlur=()=>{this.shouldInputFormat()&&this.formatInput()},this.handleInputChange=t=>{const s=a(t.target.value);s.isValid()&&(this.selectedHours=s.hours(),this.selectedMinutes=s.minutes(),this.updateValue(s.toDate()))}}shouldInputFormat(){return"string"==typeof this.inputShouldFormat?"true"===this.inputShouldFormat:!!this.inputShouldFormat}watchValue(t){this.syncFromValueProp()}watchDisabled(t){this.disabledState=t}watchHasError(t){this.errorState=t}componentDidLoad(){this.syncFromValueProp(),this.componentReady.emit(),this.id||console.error('tabworthy-times: The "id" prop is required for accessibility')}syncFromValueProp(){if(this.value){this.internalValue=this.value;const t=Array.isArray(this.value)?this.value[0]:this.value;if(t){const s=a(t,this.format);s.isValid()&&(this.selectedDate=s.toDate(),this.selectedHours=s.hours(),this.selectedMinutes=s.minutes())}}else this.internalValue=null}updateValue(t){if(Array.isArray(t)){const s=t.map((t=>{const s=a(t);return s.hours(this.selectedHours),s.minutes(this.selectedMinutes),s.seconds(0),s.format(this.format)}));this.internalValue=s,this.value=s,this.selectDateTime.emit(s)}else{const s=a(t);s.hours(this.selectedHours),s.minutes(this.selectedMinutes),s.seconds(0);const i=s.format(this.format);this.internalValue=i,this.value=i,this.selectedDate=t,this.selectDateTime.emit(i)}this.errorState=!1,this.shouldInputFormat()&&this.formatInput()}formatInput(){if(this.internalValue)if(Array.isArray(this.internalValue)){const t=this.internalValue.map((t=>a(t,this.format).format("lll"))).join(` ${this.timesLabels.to} `);this.inputRef.value=t}else this.inputRef.value=a(this.internalValue,this.format).format("lll")}getClassName(t){return`${this.elementClassName}__${t}`}toDate(t){return t?Array.isArray(t)?t.map((t=>a(t,this.format).toDate())):a(t,this.format).toDate():null}async clearValue(){this.internalValue=null,this.value=void 0,this.selectedDate=void 0,this.inputRef.value="",this.pickerRef&&(this.pickerRef.value=null),this.selectDateTime.emit(void 0)}render(){var t;return i(e,{key:"bb2dfac0bb47e71d31aae0af5a864ad46970baf1",class:this.elementClassName,"has-error":this.errorState,disabled:this.disabledState},i("label",{key:"ac7a24801c515a6411dc123ca1f976e5d791efb7",htmlFor:`${this.id}-input`,class:this.getClassName("label")},this.label),i("div",{key:"75368fdfabad0cbe08196013573b827602655335",class:this.getClassName("input-container"),ref:t=>this.inputContainerRef=t},i("input",{key:"6ca23bd4504a10d2bcfa54d194b7ea3bf94ccb57",id:`${this.id}-input`,ref:t=>this.inputRef=t,type:"text",class:{[this.getClassName("input")]:!0,[this.inputClass]:!!this.inputClass},placeholder:this.placeholder,disabled:this.disabledState||this.disableFreeformInput,value:null===(t=this.internalValue)||void 0===t?void 0:t.toString(),onBlur:this.handleInputBlur,onChange:this.handleInputChange,"aria-describedby":this.errorState?`${this.id}-error`:void 0,"aria-invalid":this.errorState}),!this.inline&&i("button",{key:"1e8348e12dbe8e87d17d137721c3903ea8f95ae1",type:"button",onClick:this.handleCalendarButtonClick,class:this.getClassName("calendar-button"),disabled:this.disabledState},this.calendarButtonContent?i("span",{innerHTML:this.calendarButtonContent}):this.timesLabels.openCalendar)),i("tabworthy-dates-modal",{key:"d361f887baa7ac18b901862ea4aa240b614ba210",label:this.timesLabels.calendar,ref:t=>this.modalRef=t,onOpened:()=>{this.pickerRef&&(this.pickerRef.modalIsOpen=!0)},onClosed:()=>{this.pickerRef&&(this.pickerRef.modalIsOpen=!1)},inline:this.inline,appendTo:this.appendTo},i("div",{key:"207708dc4997d068e1d10c08d97551c1037c38d5",class:this.getClassName("picker-container")},i("tabworthy-dates-calendar",{key:"b16f50c72789b5d98c629668c655e10a6ce1e84b",range:this.range,locale:this.locale,onSelectDate:t=>this.handlePickerSelection(t.detail),onChangeMonth:t=>this.handleChangedMonths(t.detail),onChangeYear:t=>this.handleYearChange(t.detail),labels:this.datesCalendarLabels,ref:t=>this.pickerRef=t,startDate:this.startDate,firstDayOfWeek:this.firstDayOfWeek,showHiddenTitle:!0,disabled:this.disabledState,showMonthStepper:this.showMonthStepper,showYearStepper:this.showYearStepper,showClearButton:this.showClearButton,showTodayButton:this.showTodayButton,disableDate:this.disableDate,minDate:this.minDate,maxDate:this.maxDate,inline:this.inline,value:this.value?this.toDate(this.value):void 0},i("div",{key:"b8ca24c7f7437dfce513fbc6d7c28b4dc887e4c2",slot:"after-calendar",class:this.getClassName("time-section")},i("hr",{key:"fc353c6db72e547f044bee19c02eeb6207a8af0b",class:this.getClassName("divider")}),i("tabworthy-times-picker",{key:"c77b51e4a60978c3706ead492e972db81b72aa73",hours:this.selectedHours,minutes:this.selectedMinutes,useTwelveHourFormat:this.useTwelveHourFormat,disabled:this.disabledState,onTimeChanged:this.handleTimeChange}))))),this.errorState&&i("div",{key:"7d3e27a0d9bb0b54642873205bc6bf140126d894",class:this.getClassName("input-error"),id:this.id?`${this.id}-error`:void 0,role:"status"},this.errorMessage))}get el(){return h(this)}static get watchers(){return{value:[{watchValue:0}],disabled:[{watchDisabled:0}],hasError:[{watchHasError:0}]}}};export{d as tabworthy_times}