@ionic/core 7.5.5-dev.11699997410.16566960 → 7.5.5-dev.11700511127.1168d13f

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 (38) hide show
  1. package/components/data.js +2 -8
  2. package/components/ion-accordion-group.js +0 -10
  3. package/components/ion-datetime.js +22 -3
  4. package/dist/cjs/{data-c8d21093.js → data-49d6c30f.js} +2 -8
  5. package/dist/cjs/ion-accordion_2.cjs.entry.js +0 -10
  6. package/dist/cjs/ion-datetime-button.cjs.entry.js +1 -1
  7. package/dist/cjs/ion-datetime_3.cjs.entry.js +23 -4
  8. package/dist/collection/components/accordion-group/accordion-group.js +0 -10
  9. package/dist/collection/components/datetime/datetime.js +22 -3
  10. package/dist/collection/components/datetime/utils/manipulation.js +2 -8
  11. package/dist/docs.json +1 -1
  12. package/dist/esm/{data-44d9e816.js → data-b0787d87.js} +2 -8
  13. package/dist/esm/ion-accordion_2.entry.js +0 -10
  14. package/dist/esm/ion-datetime-button.entry.js +1 -1
  15. package/dist/esm/ion-datetime_3.entry.js +23 -4
  16. package/dist/esm-es5/data-b0787d87.js +4 -0
  17. package/dist/esm-es5/ion-accordion_2.entry.js +1 -1
  18. package/dist/esm-es5/ion-datetime-button.entry.js +1 -1
  19. package/dist/esm-es5/ion-datetime_3.entry.js +1 -1
  20. package/dist/ionic/ionic.esm.js +1 -1
  21. package/dist/ionic/p-12d62aa9.entry.js +4 -0
  22. package/dist/ionic/p-65662aad.system.entry.js +4 -0
  23. package/dist/ionic/{p-4430713b.entry.js → p-6a2f7d41.entry.js} +1 -1
  24. package/dist/ionic/{p-59f4fa22.system.entry.js → p-70bf6086.system.entry.js} +1 -1
  25. package/dist/ionic/{p-00a10b94.system.entry.js → p-82057bbb.system.entry.js} +1 -1
  26. package/dist/ionic/p-94d56d67.entry.js +4 -0
  27. package/dist/ionic/p-bf7c3200.system.js +4 -0
  28. package/dist/ionic/p-c1db8914.system.js +1 -1
  29. package/dist/ionic/p-f07db0a2.js +4 -0
  30. package/dist/types/components/datetime/utils/manipulation.d.ts +34 -15
  31. package/hydrate/index.js +24 -21
  32. package/package.json +2 -2
  33. package/dist/esm-es5/data-44d9e816.js +0 -4
  34. package/dist/ionic/p-17240d90.js +0 -4
  35. package/dist/ionic/p-26094a27.entry.js +0 -4
  36. package/dist/ionic/p-9a1f6169.system.entry.js +0 -4
  37. package/dist/ionic/p-a18ba684.entry.js +0 -4
  38. package/dist/ionic/p-b8c3f071.system.js +0 -4
@@ -716,16 +716,10 @@ const validateParts = (parts, minParts, maxParts) => {
716
716
  * Returns the closest date to refParts
717
717
  * that also meets the constraints of
718
718
  * the *Values params.
719
- * @param refParts The reference date
720
- * @param monthValues The allowed month values
721
- * @param dayValues The allowed day (of the month) values
722
- * @param yearValues The allowed year values
723
- * @param hourValues The allowed hour values
724
- * @param minuteValues The allowed minute values
725
719
  */
726
- const getClosestValidDate = (refParts, monthValues, dayValues, yearValues, hourValues, minuteValues) => {
720
+ const getClosestValidDate = ({ refParts, monthValues, dayValues, yearValues, hourValues, minuteValues, minParts, maxParts, }) => {
727
721
  const { hour, minute, day, month, year } = refParts;
728
- const copyParts = Object.assign(Object.assign({}, refParts), { dayOfWeek: undefined });
722
+ const copyParts = clampDate(Object.assign(Object.assign({}, refParts), { dayOfWeek: undefined }), minParts, maxParts);
729
723
  if (monthValues !== undefined) {
730
724
  copyParts.month = findClosestValue(month, monthValues);
731
725
  }
@@ -112,16 +112,6 @@ const AccordionGroup = /*@__PURE__*/ proxyCustomElement(class AccordionGroup ext
112
112
  if (this.readonly) {
113
113
  this.readonlyChanged();
114
114
  }
115
- /**
116
- * When binding values in frameworks such as Angular
117
- * it is possible for the value to be set after the Web Component
118
- * initializes but before the value watcher is set up in Stencil.
119
- * As a result, the watcher callback may not be fired.
120
- * We work around this by manually calling the watcher
121
- * callback when the component has loaded and the watcher
122
- * is configured.
123
- */
124
- this.valueChanged();
125
115
  }
126
116
  /**
127
117
  * Sets the value property and emits ionChange.
@@ -867,14 +867,24 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
867
867
  * or modal that the datetime was presented in.
868
868
  */
869
869
  async confirm(closeOverlay = false) {
870
- const { isCalendarPicker, activeParts } = this;
870
+ const { isCalendarPicker, activeParts, preferWheel, workingParts } = this;
871
871
  /**
872
872
  * We only update the value if the presentation is not a calendar picker.
873
873
  */
874
874
  if (activeParts !== undefined || !isCalendarPicker) {
875
875
  const activePartsIsArray = Array.isArray(activeParts);
876
876
  if (activePartsIsArray && activeParts.length === 0) {
877
- this.setValue(undefined);
877
+ if (preferWheel) {
878
+ /**
879
+ * If the datetime is using a wheel picker, but the
880
+ * active parts are empty, then the user has confirmed the
881
+ * initial value (working parts) presented to them.
882
+ */
883
+ this.setValue(convertDataToISO(workingParts));
884
+ }
885
+ else {
886
+ this.setValue(undefined);
887
+ }
878
888
  }
879
889
  else {
880
890
  this.setValue(convertDataToISO(activeParts));
@@ -1065,9 +1075,18 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
1065
1075
  const yearValues = (this.parsedYearValues = convertToArrayOfNumbers(this.yearValues));
1066
1076
  const dayValues = (this.parsedDayValues = convertToArrayOfNumbers(this.dayValues));
1067
1077
  const todayParts = (this.todayParts = parseDate(getToday()));
1068
- this.defaultParts = getClosestValidDate(todayParts, monthValues, dayValues, yearValues, hourValues, minuteValues);
1069
1078
  this.processMinParts();
1070
1079
  this.processMaxParts();
1080
+ this.defaultParts = getClosestValidDate({
1081
+ refParts: todayParts,
1082
+ monthValues,
1083
+ dayValues,
1084
+ yearValues,
1085
+ hourValues,
1086
+ minuteValues,
1087
+ minParts: this.minParts,
1088
+ maxParts: this.maxParts,
1089
+ });
1071
1090
  this.processValue(this.value);
1072
1091
  this.emitStyle();
1073
1092
  }
@@ -718,16 +718,10 @@ const validateParts = (parts, minParts, maxParts) => {
718
718
  * Returns the closest date to refParts
719
719
  * that also meets the constraints of
720
720
  * the *Values params.
721
- * @param refParts The reference date
722
- * @param monthValues The allowed month values
723
- * @param dayValues The allowed day (of the month) values
724
- * @param yearValues The allowed year values
725
- * @param hourValues The allowed hour values
726
- * @param minuteValues The allowed minute values
727
721
  */
728
- const getClosestValidDate = (refParts, monthValues, dayValues, yearValues, hourValues, minuteValues) => {
722
+ const getClosestValidDate = ({ refParts, monthValues, dayValues, yearValues, hourValues, minuteValues, minParts, maxParts, }) => {
729
723
  const { hour, minute, day, month, year } = refParts;
730
- const copyParts = Object.assign(Object.assign({}, refParts), { dayOfWeek: undefined });
724
+ const copyParts = clampDate(Object.assign(Object.assign({}, refParts), { dayOfWeek: undefined }), minParts, maxParts);
731
725
  if (monthValues !== undefined) {
732
726
  copyParts.month = findClosestValue(month, monthValues);
733
727
  }
@@ -428,16 +428,6 @@ const AccordionGroup = class {
428
428
  if (this.readonly) {
429
429
  this.readonlyChanged();
430
430
  }
431
- /**
432
- * When binding values in frameworks such as Angular
433
- * it is possible for the value to be set after the Web Component
434
- * initializes but before the value watcher is set up in Stencil.
435
- * As a result, the watcher callback may not be fired.
436
- * We work around this by manually calling the watcher
437
- * callback when the component has loaded and the watcher
438
- * is configured.
439
- */
440
- this.valueChanged();
441
431
  }
442
432
  /**
443
433
  * Sets the value property and emits ionChange.
@@ -10,7 +10,7 @@ const helpers = require('./helpers-ea4ccbcb.js');
10
10
  const index$1 = require('./index-cc7dfb7c.js');
11
11
  const theme = require('./theme-fbc56b3b.js');
12
12
  const ionicGlobal = require('./ionic-global-4538d91c.js');
13
- const data = require('./data-c8d21093.js');
13
+ const data = require('./data-49d6c30f.js');
14
14
 
15
15
  const iosDatetimeButtonCss = ":host{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}:host button{border-radius:8px;-webkit-padding-start:12px;padding-inline-start:12px;-webkit-padding-end:12px;padding-inline-end:12px;padding-top:6px;padding-bottom:6px;-webkit-margin-start:2px;margin-inline-start:2px;-webkit-margin-end:2px;margin-inline-end:2px;margin-top:0px;margin-bottom:0px;position:relative;-webkit-transition:150ms color ease-in-out;transition:150ms color ease-in-out;border:none;background:var(--ion-color-step-300, #edeef0);color:var(--ion-text-color, #000);font-family:inherit;font-size:1rem;cursor:pointer;overflow:hidden;-webkit-appearance:none;-moz-appearance:none;appearance:none}:host(.time-active) #time-button,:host(.date-active) #date-button{color:var(--ion-color-base)}:host(.datetime-button-disabled){pointer-events:none}:host(.datetime-button-disabled) button{opacity:0.4}";
16
16
 
@@ -13,7 +13,7 @@ const dir = require('./dir-f1e0ca26.js');
13
13
  const theme = require('./theme-fbc56b3b.js');
14
14
  const index$2 = require('./index-09471526.js');
15
15
  const ionicGlobal = require('./ionic-global-4538d91c.js');
16
- const data = require('./data-c8d21093.js');
16
+ const data = require('./data-49d6c30f.js');
17
17
  const lockController = require('./lock-controller-4ae2eb59.js');
18
18
  const overlays = require('./overlays-6d1daf80.js');
19
19
  const animation = require('./animation-1083855c.js');
@@ -866,14 +866,24 @@ const Datetime = class {
866
866
  * or modal that the datetime was presented in.
867
867
  */
868
868
  async confirm(closeOverlay = false) {
869
- const { isCalendarPicker, activeParts } = this;
869
+ const { isCalendarPicker, activeParts, preferWheel, workingParts } = this;
870
870
  /**
871
871
  * We only update the value if the presentation is not a calendar picker.
872
872
  */
873
873
  if (activeParts !== undefined || !isCalendarPicker) {
874
874
  const activePartsIsArray = Array.isArray(activeParts);
875
875
  if (activePartsIsArray && activeParts.length === 0) {
876
- this.setValue(undefined);
876
+ if (preferWheel) {
877
+ /**
878
+ * If the datetime is using a wheel picker, but the
879
+ * active parts are empty, then the user has confirmed the
880
+ * initial value (working parts) presented to them.
881
+ */
882
+ this.setValue(data.convertDataToISO(workingParts));
883
+ }
884
+ else {
885
+ this.setValue(undefined);
886
+ }
877
887
  }
878
888
  else {
879
889
  this.setValue(data.convertDataToISO(activeParts));
@@ -1064,9 +1074,18 @@ const Datetime = class {
1064
1074
  const yearValues = (this.parsedYearValues = data.convertToArrayOfNumbers(this.yearValues));
1065
1075
  const dayValues = (this.parsedDayValues = data.convertToArrayOfNumbers(this.dayValues));
1066
1076
  const todayParts = (this.todayParts = data.parseDate(data.getToday()));
1067
- this.defaultParts = data.getClosestValidDate(todayParts, monthValues, dayValues, yearValues, hourValues, minuteValues);
1068
1077
  this.processMinParts();
1069
1078
  this.processMaxParts();
1079
+ this.defaultParts = data.getClosestValidDate({
1080
+ refParts: todayParts,
1081
+ monthValues,
1082
+ dayValues,
1083
+ yearValues,
1084
+ hourValues,
1085
+ minuteValues,
1086
+ minParts: this.minParts,
1087
+ maxParts: this.maxParts,
1088
+ });
1070
1089
  this.processValue(this.value);
1071
1090
  this.emitStyle();
1072
1091
  }
@@ -105,16 +105,6 @@ export class AccordionGroup {
105
105
  if (this.readonly) {
106
106
  this.readonlyChanged();
107
107
  }
108
- /**
109
- * When binding values in frameworks such as Angular
110
- * it is possible for the value to be set after the Web Component
111
- * initializes but before the value watcher is set up in Stencil.
112
- * As a result, the watcher callback may not be fired.
113
- * We work around this by manually calling the watcher
114
- * callback when the component has loaded and the watcher
115
- * is configured.
116
- */
117
- this.valueChanged();
118
108
  }
119
109
  /**
120
110
  * Sets the value property and emits ionChange.
@@ -704,14 +704,24 @@ export class Datetime {
704
704
  * or modal that the datetime was presented in.
705
705
  */
706
706
  async confirm(closeOverlay = false) {
707
- const { isCalendarPicker, activeParts } = this;
707
+ const { isCalendarPicker, activeParts, preferWheel, workingParts } = this;
708
708
  /**
709
709
  * We only update the value if the presentation is not a calendar picker.
710
710
  */
711
711
  if (activeParts !== undefined || !isCalendarPicker) {
712
712
  const activePartsIsArray = Array.isArray(activeParts);
713
713
  if (activePartsIsArray && activeParts.length === 0) {
714
- this.setValue(undefined);
714
+ if (preferWheel) {
715
+ /**
716
+ * If the datetime is using a wheel picker, but the
717
+ * active parts are empty, then the user has confirmed the
718
+ * initial value (working parts) presented to them.
719
+ */
720
+ this.setValue(convertDataToISO(workingParts));
721
+ }
722
+ else {
723
+ this.setValue(undefined);
724
+ }
715
725
  }
716
726
  else {
717
727
  this.setValue(convertDataToISO(activeParts));
@@ -902,9 +912,18 @@ export class Datetime {
902
912
  const yearValues = (this.parsedYearValues = convertToArrayOfNumbers(this.yearValues));
903
913
  const dayValues = (this.parsedDayValues = convertToArrayOfNumbers(this.dayValues));
904
914
  const todayParts = (this.todayParts = parseDate(getToday()));
905
- this.defaultParts = getClosestValidDate(todayParts, monthValues, dayValues, yearValues, hourValues, minuteValues);
906
915
  this.processMinParts();
907
916
  this.processMaxParts();
917
+ this.defaultParts = getClosestValidDate({
918
+ refParts: todayParts,
919
+ monthValues,
920
+ dayValues,
921
+ yearValues,
922
+ hourValues,
923
+ minuteValues,
924
+ minParts: this.minParts,
925
+ maxParts: this.maxParts,
926
+ });
908
927
  this.processValue(this.value);
909
928
  this.emitStyle();
910
929
  }
@@ -355,16 +355,10 @@ export const validateParts = (parts, minParts, maxParts) => {
355
355
  * Returns the closest date to refParts
356
356
  * that also meets the constraints of
357
357
  * the *Values params.
358
- * @param refParts The reference date
359
- * @param monthValues The allowed month values
360
- * @param dayValues The allowed day (of the month) values
361
- * @param yearValues The allowed year values
362
- * @param hourValues The allowed hour values
363
- * @param minuteValues The allowed minute values
364
358
  */
365
- export const getClosestValidDate = (refParts, monthValues, dayValues, yearValues, hourValues, minuteValues) => {
359
+ export const getClosestValidDate = ({ refParts, monthValues, dayValues, yearValues, hourValues, minuteValues, minParts, maxParts, }) => {
366
360
  const { hour, minute, day, month, year } = refParts;
367
- const copyParts = Object.assign(Object.assign({}, refParts), { dayOfWeek: undefined });
361
+ const copyParts = clampDate(Object.assign(Object.assign({}, refParts), { dayOfWeek: undefined }), minParts, maxParts);
368
362
  if (monthValues !== undefined) {
369
363
  copyParts.month = findClosestValue(month, monthValues);
370
364
  }
package/dist/docs.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "timestamp": "2023-11-14T21:31:57",
2
+ "timestamp": "2023-11-20T20:13:50",
3
3
  "compiler": {
4
4
  "name": "@stencil/core",
5
5
  "version": "4.7.1",
@@ -716,16 +716,10 @@ const validateParts = (parts, minParts, maxParts) => {
716
716
  * Returns the closest date to refParts
717
717
  * that also meets the constraints of
718
718
  * the *Values params.
719
- * @param refParts The reference date
720
- * @param monthValues The allowed month values
721
- * @param dayValues The allowed day (of the month) values
722
- * @param yearValues The allowed year values
723
- * @param hourValues The allowed hour values
724
- * @param minuteValues The allowed minute values
725
719
  */
726
- const getClosestValidDate = (refParts, monthValues, dayValues, yearValues, hourValues, minuteValues) => {
720
+ const getClosestValidDate = ({ refParts, monthValues, dayValues, yearValues, hourValues, minuteValues, minParts, maxParts, }) => {
727
721
  const { hour, minute, day, month, year } = refParts;
728
- const copyParts = Object.assign(Object.assign({}, refParts), { dayOfWeek: undefined });
722
+ const copyParts = clampDate(Object.assign(Object.assign({}, refParts), { dayOfWeek: undefined }), minParts, maxParts);
729
723
  if (monthValues !== undefined) {
730
724
  copyParts.month = findClosestValue(month, monthValues);
731
725
  }
@@ -424,16 +424,6 @@ const AccordionGroup = class {
424
424
  if (this.readonly) {
425
425
  this.readonlyChanged();
426
426
  }
427
- /**
428
- * When binding values in frameworks such as Angular
429
- * it is possible for the value to be set after the Web Component
430
- * initializes but before the value watcher is set up in Stencil.
431
- * As a result, the watcher callback may not be fired.
432
- * We work around this by manually calling the watcher
433
- * callback when the component has loaded and the watcher
434
- * is configured.
435
- */
436
- this.valueChanged();
437
427
  }
438
428
  /**
439
429
  * Sets the value property and emits ionChange.
@@ -6,7 +6,7 @@ import { a as addEventListener, c as componentOnReady } from './helpers-3379ba19
6
6
  import { a as printIonError } from './index-595d62c9.js';
7
7
  import { c as createColorClasses } from './theme-17531cdf.js';
8
8
  import { b as getIonMode } from './ionic-global-7efdecd0.js';
9
- import { q as parseDate, t as getToday, J as getHourCycle, S as getLocalizedDateTime, G as getMonthAndYear, K as getLocalizedTime, T as getMonthDayAndYear } from './data-44d9e816.js';
9
+ import { q as parseDate, t as getToday, J as getHourCycle, S as getLocalizedDateTime, G as getMonthAndYear, K as getLocalizedTime, T as getMonthDayAndYear } from './data-b0787d87.js';
10
10
 
11
11
  const iosDatetimeButtonCss = ":host{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}:host button{border-radius:8px;-webkit-padding-start:12px;padding-inline-start:12px;-webkit-padding-end:12px;padding-inline-end:12px;padding-top:6px;padding-bottom:6px;-webkit-margin-start:2px;margin-inline-start:2px;-webkit-margin-end:2px;margin-inline-end:2px;margin-top:0px;margin-bottom:0px;position:relative;-webkit-transition:150ms color ease-in-out;transition:150ms color ease-in-out;border:none;background:var(--ion-color-step-300, #edeef0);color:var(--ion-text-color, #000);font-family:inherit;font-size:1rem;cursor:pointer;overflow:hidden;-webkit-appearance:none;-moz-appearance:none;appearance:none}:host(.time-active) #time-button,:host(.date-active) #date-button{color:var(--ion-color-base)}:host(.datetime-button-disabled){pointer-events:none}:host(.datetime-button-disabled) button{opacity:0.4}";
12
12
 
@@ -9,7 +9,7 @@ import { i as isRTL } from './dir-912e3e13.js';
9
9
  import { c as createColorClasses, g as getClassMap } from './theme-17531cdf.js';
10
10
  import { c as chevronBack, o as chevronForward, l as chevronDown, p as caretUpSharp, q as caretDownSharp } from './index-c132c5f1.js';
11
11
  import { b as getIonMode } from './ionic-global-7efdecd0.js';
12
- import { g as generateDayAriaLabel, a as getDay, i as isBefore, b as isAfter, c as isSameDay, d as getPreviousMonth, e as getNextMonth, v as validateParts, f as getPartsFromCalendarDay, h as getEndOfWeek, j as getStartOfWeek, k as getPreviousDay, l as getNextDay, m as getPreviousWeek, n as getNextWeek, p as parseMinParts, o as parseMaxParts, q as parseDate, w as warnIfValueOutOfBounds, r as convertToArrayOfNumbers, s as convertDataToISO, t as getToday, u as getClosestValidDate, x as getNumDaysInMonth, y as getCombinedDateColumnData, z as getMonthColumnData, A as getDayColumnData, B as getYearColumnData, C as isMonthFirstLocale, D as getTimeColumnsData, E as isLocaleDayPeriodRTL, F as getDaysOfWeek, G as getMonthAndYear, H as getDaysOfMonth, I as generateMonths, J as getHourCycle, K as getLocalizedTime, L as getMonthAndDay, M as formatValue, N as getNextYear, O as getPreviousYear, P as clampDate, Q as parseAmPm, R as calculateHourFromAMPM } from './data-44d9e816.js';
12
+ import { g as generateDayAriaLabel, a as getDay, i as isBefore, b as isAfter, c as isSameDay, d as getPreviousMonth, e as getNextMonth, v as validateParts, f as getPartsFromCalendarDay, h as getEndOfWeek, j as getStartOfWeek, k as getPreviousDay, l as getNextDay, m as getPreviousWeek, n as getNextWeek, p as parseMinParts, o as parseMaxParts, q as parseDate, w as warnIfValueOutOfBounds, r as convertToArrayOfNumbers, s as convertDataToISO, t as getToday, u as getClosestValidDate, x as getNumDaysInMonth, y as getCombinedDateColumnData, z as getMonthColumnData, A as getDayColumnData, B as getYearColumnData, C as isMonthFirstLocale, D as getTimeColumnsData, E as isLocaleDayPeriodRTL, F as getDaysOfWeek, G as getMonthAndYear, H as getDaysOfMonth, I as generateMonths, J as getHourCycle, K as getLocalizedTime, L as getMonthAndDay, M as formatValue, N as getNextYear, O as getPreviousYear, P as clampDate, Q as parseAmPm, R as calculateHourFromAMPM } from './data-b0787d87.js';
13
13
  import { c as createLockController } from './lock-controller-e8c6c051.js';
14
14
  import { d as createDelegateController, e as createTriggerController, B as BACKDROP, i as isCancel, j as prepareOverlay, k as setOverlayId, f as present, g as dismiss, h as eventMethod, s as safeCall } from './overlays-928a4afe.js';
15
15
  import { c as createAnimation } from './animation-8aa13916.js';
@@ -862,14 +862,24 @@ const Datetime = class {
862
862
  * or modal that the datetime was presented in.
863
863
  */
864
864
  async confirm(closeOverlay = false) {
865
- const { isCalendarPicker, activeParts } = this;
865
+ const { isCalendarPicker, activeParts, preferWheel, workingParts } = this;
866
866
  /**
867
867
  * We only update the value if the presentation is not a calendar picker.
868
868
  */
869
869
  if (activeParts !== undefined || !isCalendarPicker) {
870
870
  const activePartsIsArray = Array.isArray(activeParts);
871
871
  if (activePartsIsArray && activeParts.length === 0) {
872
- this.setValue(undefined);
872
+ if (preferWheel) {
873
+ /**
874
+ * If the datetime is using a wheel picker, but the
875
+ * active parts are empty, then the user has confirmed the
876
+ * initial value (working parts) presented to them.
877
+ */
878
+ this.setValue(convertDataToISO(workingParts));
879
+ }
880
+ else {
881
+ this.setValue(undefined);
882
+ }
873
883
  }
874
884
  else {
875
885
  this.setValue(convertDataToISO(activeParts));
@@ -1060,9 +1070,18 @@ const Datetime = class {
1060
1070
  const yearValues = (this.parsedYearValues = convertToArrayOfNumbers(this.yearValues));
1061
1071
  const dayValues = (this.parsedDayValues = convertToArrayOfNumbers(this.dayValues));
1062
1072
  const todayParts = (this.todayParts = parseDate(getToday()));
1063
- this.defaultParts = getClosestValidDate(todayParts, monthValues, dayValues, yearValues, hourValues, minuteValues);
1064
1073
  this.processMinParts();
1065
1074
  this.processMaxParts();
1075
+ this.defaultParts = getClosestValidDate({
1076
+ refParts: todayParts,
1077
+ monthValues,
1078
+ dayValues,
1079
+ yearValues,
1080
+ hourValues,
1081
+ minuteValues,
1082
+ minParts: this.minParts,
1083
+ maxParts: this.maxParts,
1084
+ });
1066
1085
  this.processValue(this.value);
1067
1086
  this.emitStyle();
1068
1087
  }
@@ -0,0 +1,4 @@
1
+ import{__spreadArray}from"tslib";
2
+ /*!
3
+ * (C) Ionic http://ionicframework.com - MIT License
4
+ */import{p as printIonWarning}from"./index-595d62c9.js";var isSameDay=function(e,r){return e.month===r.month&&e.day===r.day&&e.year===r.year};var isBefore=function(e,r){return!!(e.year<r.year||e.year===r.year&&e.month<r.month||e.year===r.year&&e.month===r.month&&e.day!==null&&e.day<r.day)};var isAfter=function(e,r){return!!(e.year>r.year||e.year===r.year&&e.month>r.month||e.year===r.year&&e.month===r.month&&e.day!==null&&e.day>r.day)};var warnIfValueOutOfBounds=function(e,r,n){var a=Array.isArray(e)?e:[e];for(var t=0,i=a;t<i.length;t++){var u=i[t];if(r!==undefined&&isBefore(u,r)||n!==undefined&&isAfter(u,n)){printIonWarning("The value provided to ion-datetime is out of bounds.\n\n"+"Min: ".concat(JSON.stringify(r),"\n")+"Max: ".concat(JSON.stringify(n),"\n")+"Value: ".concat(JSON.stringify(e)));break}}};var isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0};var getHourCycle=function(e,r){if(r!==undefined){return r}var n=new Intl.DateTimeFormat(e,{hour:"numeric"});var a=n.resolvedOptions();if(a.hourCycle!==undefined){return a.hourCycle}var t=new Date("5/18/2021 00:00");var i=n.formatToParts(t);var u=i.find((function(e){return e.type==="hour"}));if(!u){throw new Error("Hour value not found from DateTimeFormat")}switch(u.value){case"0":return"h11";case"12":return"h12";case"00":return"h23";case"24":return"h24";default:throw new Error('Invalid hour cycle "'.concat(r,'"'))}};var is24Hour=function(e){return e==="h23"||e==="h24"};var getNumDaysInMonth=function(e,r){return e===4||e===6||e===9||e===11?30:e===2?isLeapYear(r)?29:28:31};var isMonthFirstLocale=function(e,r){if(r===void 0){r={month:"numeric",year:"numeric"}}var n=new Intl.DateTimeFormat(e,r).formatToParts(new Date);return n[0].type==="month"};var isLocaleDayPeriodRTL=function(e){var r=new Intl.DateTimeFormat(e,{hour:"numeric"}).formatToParts(new Date);return r[0].type==="dayPeriod"};var ISO_8601_REGEXP=/^(\d{4}|[+\-]\d{6})(?:-(\d{2})(?:-(\d{2}))?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/;var TIME_REGEXP=/^((\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/;var convertToArrayOfNumbers=function(e){if(e===undefined){return}var r=e;if(typeof e==="string"){r=e.replace(/\[|\]|\s/g,"").split(",")}var n;if(Array.isArray(r)){n=r.map((function(e){return parseInt(e,10)})).filter(isFinite)}else{n=[r]}return n};var getPartsFromCalendarDay=function(e){return{month:parseInt(e.getAttribute("data-month"),10),day:parseInt(e.getAttribute("data-day"),10),year:parseInt(e.getAttribute("data-year"),10),dayOfWeek:parseInt(e.getAttribute("data-day-of-week"),10)}};function parseDate(e){if(Array.isArray(e)){var r=[];for(var n=0,a=e;n<a.length;n++){var t=a[n];var i=parseDate(t);if(!i){return undefined}r.push(i)}return r}var u=null;if(e!=null&&e!==""){u=TIME_REGEXP.exec(e);if(u){u.unshift(undefined,undefined);u[2]=u[3]=undefined}else{u=ISO_8601_REGEXP.exec(e)}}if(u===null){printIonWarning("Unable to parse date string: ".concat(e,". Please provide a valid ISO 8601 datetime string."));return undefined}for(var o=1;o<8;o++){u[o]=u[o]!==undefined?parseInt(u[o],10):undefined}return{year:u[1],month:u[2],day:u[3],hour:u[4],minute:u[5],ampm:u[4]<12?"am":"pm"}}var clampDate=function(e,r,n){if(r&&isBefore(e,r)){return r}else if(n&&isAfter(e,n)){return n}return e};var parseAmPm=function(e){return e>=12?"pm":"am"};var parseMaxParts=function(e,r){var n=parseDate(e);if(n===undefined){return}var a=n.month,t=n.day,i=n.year,u=n.hour,o=n.minute;var d=i!==null&&i!==void 0?i:r.year;var f=a!==null&&a!==void 0?a:12;return{month:f,day:t!==null&&t!==void 0?t:getNumDaysInMonth(f,d),year:d,hour:u!==null&&u!==void 0?u:23,minute:o!==null&&o!==void 0?o:59}};var parseMinParts=function(e,r){var n=parseDate(e);if(n===undefined){return}var a=n.month,t=n.day,i=n.year,u=n.hour,o=n.minute;return{month:a!==null&&a!==void 0?a:1,day:t!==null&&t!==void 0?t:1,year:i!==null&&i!==void 0?i:r.year,hour:u!==null&&u!==void 0?u:0,minute:o!==null&&o!==void 0?o:0}};var twoDigit=function(e){return("0"+(e!==undefined?Math.abs(e):"0")).slice(-2)};var fourDigit=function(e){return("000"+(e!==undefined?Math.abs(e):"0")).slice(-4)};function convertDataToISO(e){if(Array.isArray(e)){return e.map((function(e){return convertDataToISO(e)}))}var r="";if(e.year!==undefined){r=fourDigit(e.year);if(e.month!==undefined){r+="-"+twoDigit(e.month);if(e.day!==undefined){r+="-"+twoDigit(e.day);if(e.hour!==undefined){r+="T".concat(twoDigit(e.hour),":").concat(twoDigit(e.minute),":00")}}}}else if(e.hour!==undefined){r=twoDigit(e.hour)+":"+twoDigit(e.minute)}return r}var convert12HourTo24Hour=function(e,r){if(r===undefined){return e}if(r==="am"){if(e===12){return 0}return e}if(e===12){return 12}return e+12};var getStartOfWeek=function(e){var r=e.dayOfWeek;if(r===null||r===undefined){throw new Error("No day of week provided")}return subtractDays(e,r)};var getEndOfWeek=function(e){var r=e.dayOfWeek;if(r===null||r===undefined){throw new Error("No day of week provided")}return addDays(e,6-r)};var getNextDay=function(e){return addDays(e,1)};var getPreviousDay=function(e){return subtractDays(e,1)};var getPreviousWeek=function(e){return subtractDays(e,7)};var getNextWeek=function(e){return addDays(e,7)};var subtractDays=function(e,r){var n=e.month,a=e.day,t=e.year;if(a===null){throw new Error("No day provided")}var i={month:n,day:a,year:t};i.day=a-r;if(i.day<1){i.month-=1}if(i.month<1){i.month=12;i.year-=1}if(i.day<1){var u=getNumDaysInMonth(i.month,i.year);i.day=u+i.day}return i};var addDays=function(e,r){var n=e.month,a=e.day,t=e.year;if(a===null){throw new Error("No day provided")}var i={month:n,day:a,year:t};var u=getNumDaysInMonth(n,t);i.day=a+r;if(i.day>u){i.day-=u;i.month+=1}if(i.month>12){i.month=1;i.year+=1}return i};var getPreviousMonth=function(e){var r=e.month===1?12:e.month-1;var n=e.month===1?e.year-1:e.year;var a=getNumDaysInMonth(r,n);var t=a<e.day?a:e.day;return{month:r,year:n,day:t}};var getNextMonth=function(e){var r=e.month===12?1:e.month+1;var n=e.month===12?e.year+1:e.year;var a=getNumDaysInMonth(r,n);var t=a<e.day?a:e.day;return{month:r,year:n,day:t}};var changeYear=function(e,r){var n=e.month;var a=e.year+r;var t=getNumDaysInMonth(n,a);var i=t<e.day?t:e.day;return{month:n,year:a,day:i}};var getPreviousYear=function(e){return changeYear(e,-1)};var getNextYear=function(e){return changeYear(e,1)};var getInternalHourValue=function(e,r,n){if(r){return e}return convert12HourTo24Hour(e,n)};var calculateHourFromAMPM=function(e,r){var n=e.ampm,a=e.hour;var t=a;if(n==="am"&&r==="pm"){t=convert12HourTo24Hour(t,"pm")}else if(n==="pm"&&r==="am"){t=Math.abs(t-12)}return t};var validateParts=function(e,r,n){var a=e.month,t=e.day,i=e.year;var u=clampDate(Object.assign({},e),r,n);var o=getNumDaysInMonth(a,i);if(t!==null&&o<t){u.day=o}if(r!==undefined&&isSameDay(u,r)){if(u.hour!==undefined&&r.hour!==undefined){if(u.hour<r.hour){u.hour=r.hour;u.minute=r.minute}else if(u.hour===r.hour&&u.minute!==undefined&&r.minute!==undefined&&u.minute<r.minute){u.minute=r.minute}}}if(n!==undefined&&isSameDay(e,n)){if(u.hour!==undefined&&n.hour!==undefined){if(u.hour>n.hour){u.hour=n.hour;u.minute=n.minute}else if(u.hour===n.hour&&u.minute!==undefined&&n.minute!==undefined&&u.minute>n.minute){u.minute=n.minute}}}return u};var getClosestValidDate=function(e){var r=e.refParts,n=e.monthValues,a=e.dayValues,t=e.yearValues,i=e.hourValues,u=e.minuteValues,o=e.minParts,d=e.maxParts;var f=r.hour,v=r.minute,s=r.day,l=r.month,c=r.year;var m=clampDate(Object.assign(Object.assign({},r),{dayOfWeek:undefined}),o,d);if(n!==undefined){m.month=findClosestValue(l,n)}if(s!==null&&a!==undefined){m.day=findClosestValue(s,a)}if(t!==undefined){m.year=findClosestValue(c,t)}if(f!==undefined&&i!==undefined){m.hour=findClosestValue(f,i);m.ampm=parseAmPm(m.hour)}if(v!==undefined&&u!==undefined){m.minute=findClosestValue(v,u)}return m};var findClosestValue=function(e,r){var n=r[0];var a=Math.abs(n-e);for(var t=1;t<r.length;t++){var i=r[t];var u=Math.abs(i-e);if(u<a){n=i;a=u}}return n};var getFormattedDayPeriod=function(e){if(e===undefined){return""}return e.toUpperCase()};var getLocalizedTime=function(e,r,n){var a={hour:r.hour,minute:r.minute};if(a.hour===undefined||a.minute===undefined){return"Invalid Time"}return new Intl.DateTimeFormat(e,{hour:"numeric",minute:"numeric",timeZone:"UTC",hourCycle:n}).format(new Date(convertDataToISO(Object.assign({year:2023,day:1,month:1},a))+"Z"))};var addTimePadding=function(e){var r=e.toString();if(r.length>1){return r}return"0".concat(r)};var getFormattedHour=function(e,r){if(e===0){switch(r){case"h11":return"0";case"h12":return"12";case"h23":return"00";case"h24":return"24";default:throw new Error('Invalid hour cycle "'.concat(r,'"'))}}var n=is24Hour(r);if(n){return addTimePadding(e)}return e.toString()};var generateDayAriaLabel=function(e,r,n){if(n.day===null){return null}var a=getNormalizedDate(n);var t=new Intl.DateTimeFormat(e,{weekday:"long",month:"long",day:"numeric",timeZone:"UTC"}).format(a);return r?"Today, ".concat(t):t};var getMonthAndDay=function(e,r){var n=getNormalizedDate(r);return new Intl.DateTimeFormat(e,{weekday:"short",month:"short",day:"numeric",timeZone:"UTC"}).format(n)};var getMonthAndYear=function(e,r){var n=getNormalizedDate(r);return new Intl.DateTimeFormat(e,{month:"long",year:"numeric",timeZone:"UTC"}).format(n)};var getMonthDayAndYear=function(e,r){return getLocalizedDateTime(e,r,{month:"short",day:"numeric",year:"numeric"})};var getDay=function(e,r){return getLocalizedDateTimeParts(e,r,{day:"numeric"}).find((function(e){return e.type==="day"})).value};var getYear=function(e,r){return getLocalizedDateTime(e,r,{year:"numeric"})};var getNormalizedDate=function(e){var r,n,a;var t=e.hour!==undefined&&e.minute!==undefined?" ".concat(e.hour,":").concat(e.minute):"";return new Date("".concat((r=e.month)!==null&&r!==void 0?r:1,"/").concat((n=e.day)!==null&&n!==void 0?n:1,"/").concat((a=e.year)!==null&&a!==void 0?a:2023).concat(t," GMT+0000"))};var getLocalizedDateTime=function(e,r,n){var a=getNormalizedDate(r);return getDateTimeFormat(e,n).format(a)};var getLocalizedDateTimeParts=function(e,r,n){var a=getNormalizedDate(r);return getDateTimeFormat(e,n).formatToParts(a)};var getDateTimeFormat=function(e,r){return new Intl.DateTimeFormat(e,Object.assign(Object.assign({},r),{timeZone:"UTC"}))};var getTodayLabel=function(e){if("RelativeTimeFormat"in Intl){var r=new Intl.RelativeTimeFormat(e,{numeric:"auto"}).format(0,"day");return r.charAt(0).toUpperCase()+r.slice(1)}else{return"Today"}};var removeDateTzOffset=function(e){var r=e.getTimezoneOffset();e.setMinutes(e.getMinutes()-r);return e};var DATE_AM=removeDateTzOffset(new Date("2022T01:00"));var DATE_PM=removeDateTzOffset(new Date("2022T13:00"));var getLocalizedDayPeriod=function(e,r){var n=r==="am"?DATE_AM:DATE_PM;var a=new Intl.DateTimeFormat(e,{hour:"numeric",timeZone:"UTC"}).formatToParts(n).find((function(e){return e.type==="dayPeriod"}));if(a){return a.value}return getFormattedDayPeriod(r)};var formatValue=function(e){return Array.isArray(e)?e.join(","):e};var getToday=function(){return removeDateTzOffset(new Date).toISOString()};var minutes=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59];var hour11=[0,1,2,3,4,5,6,7,8,9,10,11];var hour12=[0,1,2,3,4,5,6,7,8,9,10,11];var hour23=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23];var hour24=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,0];var getDaysOfWeek=function(e,r,n){if(n===void 0){n=0}var a=r==="ios"?"short":"narrow";var t=new Intl.DateTimeFormat(e,{weekday:a});var i=new Date("11/01/2020");var u=[];for(var o=n;o<n+7;o++){var d=new Date(i);d.setDate(d.getDate()+o);u.push(t.format(d))}return u};var getDaysOfMonth=function(e,r,n){var a=getNumDaysInMonth(e,r);var t=new Date("".concat(e,"/1/").concat(r)).getDay();var i=t>=n?t-(n+1):6-(n-t);var u=[];for(var o=1;o<=a;o++){u.push({day:o,dayOfWeek:(i+o)%7})}for(var o=0;o<=i;o++){u=__spreadArray([{day:null,dayOfWeek:null}],u,true)}return u};var getHourData=function(e){switch(e){case"h11":return hour11;case"h12":return hour12;case"h23":return hour23;case"h24":return hour24;default:throw new Error('Invalid hour cycle "'.concat(e,'"'))}};var generateTime=function(e,r,n,a,t,i,u){if(n===void 0){n="h12"}var o=getHourCycle(e,n);var d=is24Hour(o);var f=getHourData(o);var v=minutes;var s=true;var l=true;if(i){f=f.filter((function(e){return i.includes(e)}))}if(u){v=v.filter((function(e){return u.includes(e)}))}if(a){if(isSameDay(r,a)){if(a.hour!==undefined){f=f.filter((function(e){var n=r.ampm==="pm"?(e+12)%24:e;return(d?e:n)>=a.hour}));s=a.hour<13}if(a.minute!==undefined){var c=false;if(a.hour!==undefined&&r.hour!==undefined){if(r.hour>a.hour){c=true}}v=v.filter((function(e){if(c){return true}return e>=a.minute}))}}else if(isBefore(r,a)){f=[];v=[];s=l=false}}if(t){if(isSameDay(r,t)){if(t.hour!==undefined){f=f.filter((function(e){var n=r.ampm==="pm"?(e+12)%24:e;return(d?e:n)<=t.hour}));l=t.hour>=12}if(t.minute!==undefined&&r.hour===t.hour){v=v.filter((function(e){return e<=t.minute}))}}else if(isAfter(r,t)){f=[];v=[];s=l=false}}return{hours:f,minutes:v,am:s,pm:l}};var generateMonths=function(e,r){var n={month:e.month,year:e.year,day:e.day};if(r!==undefined&&(e.month!==r.month||e.year!==r.year)){var a={month:r.month,year:r.year,day:r.day};var t=isBefore(a,n);return t?[a,n,getNextMonth(e)]:[getPreviousMonth(e),n,a]}return[getPreviousMonth(e),n,getNextMonth(e)]};var getMonthColumnData=function(e,r,n,a,t,i){if(i===void 0){i={month:"long"}}var u=r.year;var o=[];if(t!==undefined){var d=t;if((a===null||a===void 0?void 0:a.month)!==undefined){d=d.filter((function(e){return e<=a.month}))}if((n===null||n===void 0?void 0:n.month)!==undefined){d=d.filter((function(e){return e>=n.month}))}d.forEach((function(r){var n=new Date("".concat(r,"/1/").concat(u," GMT+0000"));var a=new Intl.DateTimeFormat(e,Object.assign(Object.assign({},i),{timeZone:"UTC"})).format(n);o.push({text:a,value:r})}))}else{var f=a&&a.year===u?a.month:12;var v=n&&n.year===u?n.month:1;for(var s=v;s<=f;s++){var l=new Date("".concat(s,"/1/").concat(u," GMT+0000"));var c=new Intl.DateTimeFormat(e,Object.assign(Object.assign({},i),{timeZone:"UTC"})).format(l);o.push({text:c,value:s})}}return o};var getDayColumnData=function(e,r,n,a,t,i){if(i===void 0){i={day:"numeric"}}var u=r.month,o=r.year;var d=[];var f=getNumDaysInMonth(u,o);var v=(a===null||a===void 0?void 0:a.day)!==null&&(a===null||a===void 0?void 0:a.day)!==undefined&&a.year===o&&a.month===u?a.day:f;var s=(n===null||n===void 0?void 0:n.day)!==null&&(n===null||n===void 0?void 0:n.day)!==undefined&&n.year===o&&n.month===u?n.day:1;if(t!==undefined){var l=t;l=l.filter((function(e){return e>=s&&e<=v}));l.forEach((function(r){var n=new Date("".concat(u,"/").concat(r,"/").concat(o," GMT+0000"));var a=new Intl.DateTimeFormat(e,Object.assign(Object.assign({},i),{timeZone:"UTC"})).format(n);d.push({text:a,value:r})}))}else{for(var c=s;c<=v;c++){var m=new Date("".concat(u,"/").concat(c,"/").concat(o," GMT+0000"));var y=new Intl.DateTimeFormat(e,Object.assign(Object.assign({},i),{timeZone:"UTC"})).format(m);d.push({text:y,value:c})}}return d};var getYearColumnData=function(e,r,n,a,t){var i,u;var o=[];if(t!==undefined){o=t;if((a===null||a===void 0?void 0:a.year)!==undefined){o=o.filter((function(e){return e<=a.year}))}if((n===null||n===void 0?void 0:n.year)!==undefined){o=o.filter((function(e){return e>=n.year}))}}else{var d=r.year;var f=(i=a===null||a===void 0?void 0:a.year)!==null&&i!==void 0?i:d;var v=(u=n===null||n===void 0?void 0:n.year)!==null&&u!==void 0?u:d-100;for(var s=v;s<=f;s++){o.push(s)}}return o.map((function(n){return{text:getYear(e,{year:n,month:r.month,day:r.day}),value:n}}))};var getAllMonthsInRange=function(e,r){if(e.month===r.month&&e.year===r.year){return[e]}return __spreadArray([e],getAllMonthsInRange(getNextMonth(e),r),true)};var getCombinedDateColumnData=function(e,r,n,a,t,i){var u=[];var o=[];var d=getAllMonthsInRange(n,a);if(i){d=d.filter((function(e){var r=e.month;return i.includes(r)}))}d.forEach((function(i){var d={month:i.month,day:null,year:i.year};var f=getDayColumnData(e,d,n,a,t,{month:"short",day:"numeric",weekday:"short"});var v=[];var s=[];f.forEach((function(n){var a=isSameDay(Object.assign(Object.assign({},d),{day:n.value}),r);s.push({text:a?getTodayLabel(e):n.text,value:"".concat(d.year,"-").concat(d.month,"-").concat(n.value)});v.push({month:d.month,year:d.year,day:n.value})}));o=__spreadArray(__spreadArray([],o,true),v,true);u=__spreadArray(__spreadArray([],u,true),s,true)}));return{parts:o,items:u}};var getTimeColumnsData=function(e,r,n,a,t,i,u){var o=getHourCycle(e,n);var d=is24Hour(o);var f=generateTime(e,r,o,a,t,i,u),v=f.hours,s=f.minutes,l=f.am,c=f.pm;var m=v.map((function(e){return{text:getFormattedHour(e,o),value:getInternalHourValue(e,d,r.ampm)}}));var y=s.map((function(e){return{text:addTimePadding(e),value:e}}));var g=[];if(l&&!d){g.push({text:getLocalizedDayPeriod(e,"am"),value:"am"})}if(c&&!d){g.push({text:getLocalizedDayPeriod(e,"pm"),value:"pm"})}return{minutesData:y,hoursData:m,dayPeriodData:g}};export{getDayColumnData as A,getYearColumnData as B,isMonthFirstLocale as C,getTimeColumnsData as D,isLocaleDayPeriodRTL as E,getDaysOfWeek as F,getMonthAndYear as G,getDaysOfMonth as H,generateMonths as I,getHourCycle as J,getLocalizedTime as K,getMonthAndDay as L,formatValue as M,getNextYear as N,getPreviousYear as O,clampDate as P,parseAmPm as Q,calculateHourFromAMPM as R,getLocalizedDateTime as S,getMonthDayAndYear as T,getDay as a,isAfter as b,isSameDay as c,getPreviousMonth as d,getNextMonth as e,getPartsFromCalendarDay as f,generateDayAriaLabel as g,getEndOfWeek as h,isBefore as i,getStartOfWeek as j,getPreviousDay as k,getNextDay as l,getPreviousWeek as m,getNextWeek as n,parseMaxParts as o,parseMinParts as p,parseDate as q,convertToArrayOfNumbers as r,convertDataToISO as s,getToday as t,getClosestValidDate as u,validateParts as v,warnIfValueOutOfBounds as w,getNumDaysInMonth as x,getCombinedDateColumnData as y,getMonthColumnData as z};
@@ -1,4 +1,4 @@
1
1
  import{__awaiter,__generator,__spreadArray}from"tslib";
2
2
  /*!
3
3
  * (C) Ionic http://ionicframework.com - MIT License
4
- */import{r as registerInstance,h,H as Host,f as getElement,d as createEvent}from"./index-4392ebcb.js";import{r as raf,t as transitionEndAsync,a as addEventListener,b as removeEventListener,g as getElementRoot}from"./helpers-3379ba19.js";import{l as chevronDown}from"./index-c132c5f1.js";import{c as config,b as getIonMode}from"./ionic-global-7efdecd0.js";import{p as printIonWarning}from"./index-595d62c9.js";var accordionIosCss=":host{display:block;position:relative;width:100%;background-color:var(--ion-background-color, #ffffff);overflow:hidden;z-index:0}:host(.accordion-expanding) ::slotted(ion-item[slot=header]),:host(.accordion-expanded) ::slotted(ion-item[slot=header]){--border-width:0px}:host(.accordion-animated){-webkit-transition:all 300ms cubic-bezier(0.25, 0.8, 0.5, 1);transition:all 300ms cubic-bezier(0.25, 0.8, 0.5, 1)}:host(.accordion-animated) #content{-webkit-transition:max-height 300ms cubic-bezier(0.25, 0.8, 0.5, 1);transition:max-height 300ms cubic-bezier(0.25, 0.8, 0.5, 1)}#content{overflow:hidden;will-change:max-height}:host(.accordion-collapsing) #content{max-height:0 !important}:host(.accordion-collapsed) #content{display:none}:host(.accordion-expanding) #content{max-height:0}:host(.accordion-expanding) #content-wrapper{overflow:auto}:host(.accordion-disabled) #header,:host(.accordion-readonly) #header,:host(.accordion-disabled) #content,:host(.accordion-readonly) #content{pointer-events:none}:host(.accordion-disabled) #header,:host(.accordion-disabled) #content{opacity:0.4}@media (prefers-reduced-motion: reduce){:host,#content{-webkit-transition:none !important;transition:none !important}}:host(.accordion-next) ::slotted(ion-item[slot=header]){--border-width:0.55px 0px 0.55px 0px}";var accordionMdCss=":host{display:block;position:relative;width:100%;background-color:var(--ion-background-color, #ffffff);overflow:hidden;z-index:0}:host(.accordion-expanding) ::slotted(ion-item[slot=header]),:host(.accordion-expanded) ::slotted(ion-item[slot=header]){--border-width:0px}:host(.accordion-animated){-webkit-transition:all 300ms cubic-bezier(0.25, 0.8, 0.5, 1);transition:all 300ms cubic-bezier(0.25, 0.8, 0.5, 1)}:host(.accordion-animated) #content{-webkit-transition:max-height 300ms cubic-bezier(0.25, 0.8, 0.5, 1);transition:max-height 300ms cubic-bezier(0.25, 0.8, 0.5, 1)}#content{overflow:hidden;will-change:max-height}:host(.accordion-collapsing) #content{max-height:0 !important}:host(.accordion-collapsed) #content{display:none}:host(.accordion-expanding) #content{max-height:0}:host(.accordion-expanding) #content-wrapper{overflow:auto}:host(.accordion-disabled) #header,:host(.accordion-readonly) #header,:host(.accordion-disabled) #content,:host(.accordion-readonly) #content{pointer-events:none}:host(.accordion-disabled) #header,:host(.accordion-disabled) #content{opacity:0.4}@media (prefers-reduced-motion: reduce){:host,#content{-webkit-transition:none !important;transition:none !important}}";var Accordion=function(){function n(n){var t=this;registerInstance(this,n);this.updateListener=function(){return t.updateState(false)};this.setItemDefaults=function(){var n=t.getSlottedHeaderIonItem();if(!n){return}n.button=true;n.detail=false;if(n.lines===undefined){n.lines="full"}};this.getSlottedHeaderIonItem=function(){var n=t.headerEl;if(!n){return}var i=n.querySelector("slot");if(!i){return}if(i.assignedElements===undefined)return;return i.assignedElements().find((function(n){return n.tagName==="ION-ITEM"}))};this.setAria=function(n){if(n===void 0){n=false}var i=t.getSlottedHeaderIonItem();if(!i){return}var o=getElementRoot(i);var r=o.querySelector("button");if(!r){return}r.setAttribute("aria-expanded","".concat(n))};this.slotToggleIcon=function(){var n=t.getSlottedHeaderIonItem();if(!n){return}var i=t,o=i.toggleIconSlot,r=i.toggleIcon;var e=n.querySelector(".ion-accordion-toggle-icon");if(e){return}var a=document.createElement("ion-icon");a.slot=o;a.lazy=false;a.classList.add("ion-accordion-toggle-icon");a.icon=r;a.setAttribute("aria-hidden","true");n.appendChild(a)};this.expandAccordion=function(n){if(n===void 0){n=false}var i=t,o=i.contentEl,r=i.contentElWrapper;if(n||o===undefined||r===undefined){t.state=4;return}if(t.state===4){return}if(t.currentRaf!==undefined){cancelAnimationFrame(t.currentRaf)}if(t.shouldAnimate()){raf((function(){t.state=8;t.currentRaf=raf((function(){return __awaiter(t,void 0,void 0,(function(){var n,t;return __generator(this,(function(i){switch(i.label){case 0:n=r.offsetHeight;t=transitionEndAsync(o,2e3);o.style.setProperty("max-height","".concat(n,"px"));return[4,t];case 1:i.sent();this.state=4;o.style.removeProperty("max-height");return[2]}}))}))}))}))}else{t.state=4}};this.collapseAccordion=function(n){if(n===void 0){n=false}var i=t.contentEl;if(n||i===undefined){t.state=1;return}if(t.state===1){return}if(t.currentRaf!==undefined){cancelAnimationFrame(t.currentRaf)}if(t.shouldAnimate()){t.currentRaf=raf((function(){return __awaiter(t,void 0,void 0,(function(){var n;var t=this;return __generator(this,(function(o){n=i.offsetHeight;i.style.setProperty("max-height","".concat(n,"px"));raf((function(){return __awaiter(t,void 0,void 0,(function(){var n;return __generator(this,(function(t){switch(t.label){case 0:n=transitionEndAsync(i,2e3);this.state=2;return[4,n];case 1:t.sent();this.state=1;i.style.removeProperty("max-height");return[2]}}))}))}));return[2]}))}))}))}else{t.state=1}};this.shouldAnimate=function(){if(typeof window==="undefined"){return false}var n=matchMedia("(prefers-reduced-motion: reduce)").matches;if(n){return false}var i=config.get("animated",true);if(!i){return false}if(t.accordionGroupEl&&!t.accordionGroupEl.animated){return false}return true};this.updateState=function(n){if(n===void 0){n=false}return __awaiter(t,void 0,void 0,(function(){var t,i,o,r,e,a,s,d;return __generator(this,(function(c){t=this.accordionGroupEl;i=this.value;if(!t){return[2]}o=t.value;r=Array.isArray(o)?o.includes(i):o===i;if(r){this.expandAccordion(n);this.isNext=this.isPrevious=false}else{this.collapseAccordion(n);e=this.getNextSibling();a=e===null||e===void 0?void 0:e.value;if(a!==undefined){this.isPrevious=Array.isArray(o)?o.includes(a):o===a}s=this.getPreviousSibling();d=s===null||s===void 0?void 0:s.value;if(d!==undefined){this.isNext=Array.isArray(o)?o.includes(d):o===d}}return[2]}))}))};this.getNextSibling=function(){if(!t.el){return}var n=t.el.nextElementSibling;if((n===null||n===void 0?void 0:n.tagName)!=="ION-ACCORDION"){return}return n};this.getPreviousSibling=function(){if(!t.el){return}var n=t.el.previousElementSibling;if((n===null||n===void 0?void 0:n.tagName)!=="ION-ACCORDION"){return}return n};this.state=1;this.isNext=false;this.isPrevious=false;this.value="ion-accordion-".concat(accordionIds++);this.disabled=false;this.readonly=false;this.toggleIcon=chevronDown;this.toggleIconSlot="end"}n.prototype.valueChanged=function(){this.updateState()};n.prototype.connectedCallback=function(){var n;var t=this.accordionGroupEl=(n=this.el)===null||n===void 0?void 0:n.closest("ion-accordion-group");if(t){this.updateState(true);addEventListener(t,"ionValueChange",this.updateListener)}};n.prototype.disconnectedCallback=function(){var n=this.accordionGroupEl;if(n){removeEventListener(n,"ionValueChange",this.updateListener)}};n.prototype.componentDidLoad=function(){var n=this;this.setItemDefaults();this.slotToggleIcon();raf((function(){var t=n.state===4||n.state===8;n.setAria(t)}))};n.prototype.toggleExpanded=function(){var n=this,t=n.accordionGroupEl,i=n.value,o=n.state;if(t){var r=o===1||o===2;t.requestAccordionToggle(i,r)}};n.prototype.render=function(){var n;var t=this;var i=this,o=i.disabled,r=i.readonly;var e=getIonMode(this);var a=this.state===4||this.state===8;var s=a?"header expanded":"header";var d=a?"content expanded":"content";this.setAria(a);return h(Host,{class:(n={},n[e]=true,n["accordion-expanding"]=this.state===8,n["accordion-expanded"]=this.state===4,n["accordion-collapsing"]=this.state===2,n["accordion-collapsed"]=this.state===1,n["accordion-next"]=this.isNext,n["accordion-previous"]=this.isPrevious,n["accordion-disabled"]=o,n["accordion-readonly"]=r,n["accordion-animated"]=this.shouldAnimate(),n)},h("div",{onClick:function(){return t.toggleExpanded()},id:"header",part:s,"aria-controls":"content",ref:function(n){return t.headerEl=n}},h("slot",{name:"header"})),h("div",{id:"content",part:d,role:"region","aria-labelledby":"header",ref:function(n){return t.contentEl=n}},h("div",{id:"content-wrapper",ref:function(n){return t.contentElWrapper=n}},h("slot",{name:"content"}))))};Object.defineProperty(n,"delegatesFocus",{get:function(){return true},enumerable:false,configurable:true});Object.defineProperty(n.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(n,"watchers",{get:function(){return{value:["valueChanged"]}},enumerable:false,configurable:true});return n}();var accordionIds=0;Accordion.style={ios:accordionIosCss,md:accordionMdCss};var accordionGroupIosCss=":host{display:block}:host(.accordion-group-expand-inset){-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:16px;margin-inline-end:16px;margin-top:16px;margin-bottom:16px}:host(.accordion-group-expand-inset) ::slotted(ion-accordion.accordion-expanding),:host(.accordion-group-expand-inset) ::slotted(ion-accordion.accordion-expanded){border-bottom:none}";var accordionGroupMdCss=":host{display:block}:host(.accordion-group-expand-inset){-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:16px;margin-inline-end:16px;margin-top:16px;margin-bottom:16px}:host(.accordion-group-expand-inset) ::slotted(ion-accordion){-webkit-box-shadow:0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12);box-shadow:0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12)}:host(.accordion-group-expand-inset) ::slotted(ion-accordion.accordion-expanding),:host(.accordion-group-expand-inset) ::slotted(ion-accordion.accordion-expanded){margin-left:0;margin-right:0;margin-top:16px;margin-bottom:16px;border-radius:6px}:host(.accordion-group-expand-inset) ::slotted(ion-accordion.accordion-previous){border-bottom-right-radius:6px;border-bottom-left-radius:6px}:host-context([dir=rtl]):host(.accordion-group-expand-inset) ::slotted(ion-accordion.accordion-previous),:host-context([dir=rtl]).accordion-group-expand-inset ::slotted(ion-accordion.accordion-previous){border-bottom-right-radius:6px;border-bottom-left-radius:6px}@supports selector(:dir(rtl)){:host(.accordion-group-expand-inset:dir(rtl)) ::slotted(ion-accordion.accordion-previous){border-bottom-right-radius:6px;border-bottom-left-radius:6px}}:host(.accordion-group-expand-inset) ::slotted(ion-accordion.accordion-next){border-top-left-radius:6px;border-top-right-radius:6px}:host-context([dir=rtl]):host(.accordion-group-expand-inset) ::slotted(ion-accordion.accordion-next),:host-context([dir=rtl]).accordion-group-expand-inset ::slotted(ion-accordion.accordion-next){border-top-left-radius:6px;border-top-right-radius:6px}@supports selector(:dir(rtl)){:host(.accordion-group-expand-inset:dir(rtl)) ::slotted(ion-accordion.accordion-next){border-top-left-radius:6px;border-top-right-radius:6px}}:host(.accordion-group-expand-inset) ::slotted(ion-accordion):first-of-type{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}";var AccordionGroup=function(){function n(n){registerInstance(this,n);this.ionChange=createEvent(this,"ionChange",7);this.ionValueChange=createEvent(this,"ionValueChange",7);this.animated=true;this.multiple=undefined;this.value=undefined;this.disabled=false;this.readonly=false;this.expand="compact"}n.prototype.valueChanged=function(){var n=this,t=n.value,i=n.multiple;if(!i&&Array.isArray(t)){printIonWarning('ion-accordion-group was passed an array of values, but multiple="false". This is incorrect usage and may result in unexpected behaviors. To dismiss this warning, pass a string to the "value" property when multiple="false".\n\n Value Passed: ['.concat(t.map((function(n){return"'".concat(n,"'")})).join(", "),"]\n"),this.el)}this.ionValueChange.emit({value:this.value})};n.prototype.disabledChanged=function(){return __awaiter(this,void 0,void 0,(function(){var n,t,i,o,r;return __generator(this,(function(e){switch(e.label){case 0:n=this.disabled;return[4,this.getAccordions()];case 1:t=e.sent();for(i=0,o=t;i<o.length;i++){r=o[i];r.disabled=n}return[2]}}))}))};n.prototype.readonlyChanged=function(){return __awaiter(this,void 0,void 0,(function(){var n,t,i,o,r;return __generator(this,(function(e){switch(e.label){case 0:n=this.readonly;return[4,this.getAccordions()];case 1:t=e.sent();for(i=0,o=t;i<o.length;i++){r=o[i];r.readonly=n}return[2]}}))}))};n.prototype.onKeydown=function(n){return __awaiter(this,void 0,void 0,(function(){var t,i,o,r,e,a,s;return __generator(this,(function(d){switch(d.label){case 0:t=document.activeElement;if(!t){return[2]}i=t.closest('ion-accordion [slot="header"]');if(!i){return[2]}o=t.tagName==="ION-ACCORDION"?t:t.closest("ion-accordion");if(!o){return[2]}r=o.closest("ion-accordion-group");if(r!==this.el){return[2]}return[4,this.getAccordions()];case 1:e=d.sent();a=e.findIndex((function(n){return n===o}));if(a===-1){return[2]}if(n.key==="ArrowDown"){s=this.findNextAccordion(e,a)}else if(n.key==="ArrowUp"){s=this.findPreviousAccordion(e,a)}else if(n.key==="Home"){s=e[0]}else if(n.key==="End"){s=e[e.length-1]}if(s!==undefined&&s!==t){s.focus()}return[2]}}))}))};n.prototype.componentDidLoad=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){if(this.disabled){this.disabledChanged()}if(this.readonly){this.readonlyChanged()}this.valueChanged();return[2]}))}))};n.prototype.setValue=function(n){var t=this.value=n;this.ionChange.emit({value:t})};n.prototype.requestAccordionToggle=function(n,t){return __awaiter(this,void 0,void 0,(function(){var i,o,r,e,a,s,d,c,s,d;return __generator(this,(function(u){i=this,o=i.multiple,r=i.value,e=i.readonly,a=i.disabled;if(e||a){return[2]}if(t){if(o){s=r!==null&&r!==void 0?r:[];d=Array.isArray(s)?s:[s];c=d.find((function(t){return t===n}));if(c===undefined&&n!==undefined){this.setValue(__spreadArray(__spreadArray([],d,true),[n],false))}}else{this.setValue(n)}}else{if(o){s=r!==null&&r!==void 0?r:[];d=Array.isArray(s)?s:[s];this.setValue(d.filter((function(t){return t!==n})))}else{this.setValue(undefined)}}return[2]}))}))};n.prototype.findNextAccordion=function(n,t){var i=n[t+1];if(i===undefined){return n[0]}return i};n.prototype.findPreviousAccordion=function(n,t){var i=n[t-1];if(i===undefined){return n[n.length-1]}return i};n.prototype.getAccordions=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){return[2,Array.from(this.el.querySelectorAll(":scope > ion-accordion"))]}))}))};n.prototype.render=function(){var n;var t=this,i=t.disabled,o=t.readonly,r=t.expand;var e=getIonMode(this);return h(Host,{class:(n={},n[e]=true,n["accordion-group-disabled"]=i,n["accordion-group-readonly"]=o,n["accordion-group-expand-".concat(r)]=true,n),role:"presentation"},h("slot",null))};Object.defineProperty(n.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(n,"watchers",{get:function(){return{value:["valueChanged"],disabled:["disabledChanged"],readonly:["readonlyChanged"]}},enumerable:false,configurable:true});return n}();AccordionGroup.style={ios:accordionGroupIosCss,md:accordionGroupMdCss};export{Accordion as ion_accordion,AccordionGroup as ion_accordion_group};
4
+ */import{r as registerInstance,h,H as Host,f as getElement,d as createEvent}from"./index-4392ebcb.js";import{r as raf,t as transitionEndAsync,a as addEventListener,b as removeEventListener,g as getElementRoot}from"./helpers-3379ba19.js";import{l as chevronDown}from"./index-c132c5f1.js";import{c as config,b as getIonMode}from"./ionic-global-7efdecd0.js";import{p as printIonWarning}from"./index-595d62c9.js";var accordionIosCss=":host{display:block;position:relative;width:100%;background-color:var(--ion-background-color, #ffffff);overflow:hidden;z-index:0}:host(.accordion-expanding) ::slotted(ion-item[slot=header]),:host(.accordion-expanded) ::slotted(ion-item[slot=header]){--border-width:0px}:host(.accordion-animated){-webkit-transition:all 300ms cubic-bezier(0.25, 0.8, 0.5, 1);transition:all 300ms cubic-bezier(0.25, 0.8, 0.5, 1)}:host(.accordion-animated) #content{-webkit-transition:max-height 300ms cubic-bezier(0.25, 0.8, 0.5, 1);transition:max-height 300ms cubic-bezier(0.25, 0.8, 0.5, 1)}#content{overflow:hidden;will-change:max-height}:host(.accordion-collapsing) #content{max-height:0 !important}:host(.accordion-collapsed) #content{display:none}:host(.accordion-expanding) #content{max-height:0}:host(.accordion-expanding) #content-wrapper{overflow:auto}:host(.accordion-disabled) #header,:host(.accordion-readonly) #header,:host(.accordion-disabled) #content,:host(.accordion-readonly) #content{pointer-events:none}:host(.accordion-disabled) #header,:host(.accordion-disabled) #content{opacity:0.4}@media (prefers-reduced-motion: reduce){:host,#content{-webkit-transition:none !important;transition:none !important}}:host(.accordion-next) ::slotted(ion-item[slot=header]){--border-width:0.55px 0px 0.55px 0px}";var accordionMdCss=":host{display:block;position:relative;width:100%;background-color:var(--ion-background-color, #ffffff);overflow:hidden;z-index:0}:host(.accordion-expanding) ::slotted(ion-item[slot=header]),:host(.accordion-expanded) ::slotted(ion-item[slot=header]){--border-width:0px}:host(.accordion-animated){-webkit-transition:all 300ms cubic-bezier(0.25, 0.8, 0.5, 1);transition:all 300ms cubic-bezier(0.25, 0.8, 0.5, 1)}:host(.accordion-animated) #content{-webkit-transition:max-height 300ms cubic-bezier(0.25, 0.8, 0.5, 1);transition:max-height 300ms cubic-bezier(0.25, 0.8, 0.5, 1)}#content{overflow:hidden;will-change:max-height}:host(.accordion-collapsing) #content{max-height:0 !important}:host(.accordion-collapsed) #content{display:none}:host(.accordion-expanding) #content{max-height:0}:host(.accordion-expanding) #content-wrapper{overflow:auto}:host(.accordion-disabled) #header,:host(.accordion-readonly) #header,:host(.accordion-disabled) #content,:host(.accordion-readonly) #content{pointer-events:none}:host(.accordion-disabled) #header,:host(.accordion-disabled) #content{opacity:0.4}@media (prefers-reduced-motion: reduce){:host,#content{-webkit-transition:none !important;transition:none !important}}";var Accordion=function(){function n(n){var t=this;registerInstance(this,n);this.updateListener=function(){return t.updateState(false)};this.setItemDefaults=function(){var n=t.getSlottedHeaderIonItem();if(!n){return}n.button=true;n.detail=false;if(n.lines===undefined){n.lines="full"}};this.getSlottedHeaderIonItem=function(){var n=t.headerEl;if(!n){return}var i=n.querySelector("slot");if(!i){return}if(i.assignedElements===undefined)return;return i.assignedElements().find((function(n){return n.tagName==="ION-ITEM"}))};this.setAria=function(n){if(n===void 0){n=false}var i=t.getSlottedHeaderIonItem();if(!i){return}var o=getElementRoot(i);var r=o.querySelector("button");if(!r){return}r.setAttribute("aria-expanded","".concat(n))};this.slotToggleIcon=function(){var n=t.getSlottedHeaderIonItem();if(!n){return}var i=t,o=i.toggleIconSlot,r=i.toggleIcon;var e=n.querySelector(".ion-accordion-toggle-icon");if(e){return}var a=document.createElement("ion-icon");a.slot=o;a.lazy=false;a.classList.add("ion-accordion-toggle-icon");a.icon=r;a.setAttribute("aria-hidden","true");n.appendChild(a)};this.expandAccordion=function(n){if(n===void 0){n=false}var i=t,o=i.contentEl,r=i.contentElWrapper;if(n||o===undefined||r===undefined){t.state=4;return}if(t.state===4){return}if(t.currentRaf!==undefined){cancelAnimationFrame(t.currentRaf)}if(t.shouldAnimate()){raf((function(){t.state=8;t.currentRaf=raf((function(){return __awaiter(t,void 0,void 0,(function(){var n,t;return __generator(this,(function(i){switch(i.label){case 0:n=r.offsetHeight;t=transitionEndAsync(o,2e3);o.style.setProperty("max-height","".concat(n,"px"));return[4,t];case 1:i.sent();this.state=4;o.style.removeProperty("max-height");return[2]}}))}))}))}))}else{t.state=4}};this.collapseAccordion=function(n){if(n===void 0){n=false}var i=t.contentEl;if(n||i===undefined){t.state=1;return}if(t.state===1){return}if(t.currentRaf!==undefined){cancelAnimationFrame(t.currentRaf)}if(t.shouldAnimate()){t.currentRaf=raf((function(){return __awaiter(t,void 0,void 0,(function(){var n;var t=this;return __generator(this,(function(o){n=i.offsetHeight;i.style.setProperty("max-height","".concat(n,"px"));raf((function(){return __awaiter(t,void 0,void 0,(function(){var n;return __generator(this,(function(t){switch(t.label){case 0:n=transitionEndAsync(i,2e3);this.state=2;return[4,n];case 1:t.sent();this.state=1;i.style.removeProperty("max-height");return[2]}}))}))}));return[2]}))}))}))}else{t.state=1}};this.shouldAnimate=function(){if(typeof window==="undefined"){return false}var n=matchMedia("(prefers-reduced-motion: reduce)").matches;if(n){return false}var i=config.get("animated",true);if(!i){return false}if(t.accordionGroupEl&&!t.accordionGroupEl.animated){return false}return true};this.updateState=function(n){if(n===void 0){n=false}return __awaiter(t,void 0,void 0,(function(){var t,i,o,r,e,a,s,d;return __generator(this,(function(c){t=this.accordionGroupEl;i=this.value;if(!t){return[2]}o=t.value;r=Array.isArray(o)?o.includes(i):o===i;if(r){this.expandAccordion(n);this.isNext=this.isPrevious=false}else{this.collapseAccordion(n);e=this.getNextSibling();a=e===null||e===void 0?void 0:e.value;if(a!==undefined){this.isPrevious=Array.isArray(o)?o.includes(a):o===a}s=this.getPreviousSibling();d=s===null||s===void 0?void 0:s.value;if(d!==undefined){this.isNext=Array.isArray(o)?o.includes(d):o===d}}return[2]}))}))};this.getNextSibling=function(){if(!t.el){return}var n=t.el.nextElementSibling;if((n===null||n===void 0?void 0:n.tagName)!=="ION-ACCORDION"){return}return n};this.getPreviousSibling=function(){if(!t.el){return}var n=t.el.previousElementSibling;if((n===null||n===void 0?void 0:n.tagName)!=="ION-ACCORDION"){return}return n};this.state=1;this.isNext=false;this.isPrevious=false;this.value="ion-accordion-".concat(accordionIds++);this.disabled=false;this.readonly=false;this.toggleIcon=chevronDown;this.toggleIconSlot="end"}n.prototype.valueChanged=function(){this.updateState()};n.prototype.connectedCallback=function(){var n;var t=this.accordionGroupEl=(n=this.el)===null||n===void 0?void 0:n.closest("ion-accordion-group");if(t){this.updateState(true);addEventListener(t,"ionValueChange",this.updateListener)}};n.prototype.disconnectedCallback=function(){var n=this.accordionGroupEl;if(n){removeEventListener(n,"ionValueChange",this.updateListener)}};n.prototype.componentDidLoad=function(){var n=this;this.setItemDefaults();this.slotToggleIcon();raf((function(){var t=n.state===4||n.state===8;n.setAria(t)}))};n.prototype.toggleExpanded=function(){var n=this,t=n.accordionGroupEl,i=n.value,o=n.state;if(t){var r=o===1||o===2;t.requestAccordionToggle(i,r)}};n.prototype.render=function(){var n;var t=this;var i=this,o=i.disabled,r=i.readonly;var e=getIonMode(this);var a=this.state===4||this.state===8;var s=a?"header expanded":"header";var d=a?"content expanded":"content";this.setAria(a);return h(Host,{class:(n={},n[e]=true,n["accordion-expanding"]=this.state===8,n["accordion-expanded"]=this.state===4,n["accordion-collapsing"]=this.state===2,n["accordion-collapsed"]=this.state===1,n["accordion-next"]=this.isNext,n["accordion-previous"]=this.isPrevious,n["accordion-disabled"]=o,n["accordion-readonly"]=r,n["accordion-animated"]=this.shouldAnimate(),n)},h("div",{onClick:function(){return t.toggleExpanded()},id:"header",part:s,"aria-controls":"content",ref:function(n){return t.headerEl=n}},h("slot",{name:"header"})),h("div",{id:"content",part:d,role:"region","aria-labelledby":"header",ref:function(n){return t.contentEl=n}},h("div",{id:"content-wrapper",ref:function(n){return t.contentElWrapper=n}},h("slot",{name:"content"}))))};Object.defineProperty(n,"delegatesFocus",{get:function(){return true},enumerable:false,configurable:true});Object.defineProperty(n.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(n,"watchers",{get:function(){return{value:["valueChanged"]}},enumerable:false,configurable:true});return n}();var accordionIds=0;Accordion.style={ios:accordionIosCss,md:accordionMdCss};var accordionGroupIosCss=":host{display:block}:host(.accordion-group-expand-inset){-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:16px;margin-inline-end:16px;margin-top:16px;margin-bottom:16px}:host(.accordion-group-expand-inset) ::slotted(ion-accordion.accordion-expanding),:host(.accordion-group-expand-inset) ::slotted(ion-accordion.accordion-expanded){border-bottom:none}";var accordionGroupMdCss=":host{display:block}:host(.accordion-group-expand-inset){-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:16px;margin-inline-end:16px;margin-top:16px;margin-bottom:16px}:host(.accordion-group-expand-inset) ::slotted(ion-accordion){-webkit-box-shadow:0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12);box-shadow:0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12)}:host(.accordion-group-expand-inset) ::slotted(ion-accordion.accordion-expanding),:host(.accordion-group-expand-inset) ::slotted(ion-accordion.accordion-expanded){margin-left:0;margin-right:0;margin-top:16px;margin-bottom:16px;border-radius:6px}:host(.accordion-group-expand-inset) ::slotted(ion-accordion.accordion-previous){border-bottom-right-radius:6px;border-bottom-left-radius:6px}:host-context([dir=rtl]):host(.accordion-group-expand-inset) ::slotted(ion-accordion.accordion-previous),:host-context([dir=rtl]).accordion-group-expand-inset ::slotted(ion-accordion.accordion-previous){border-bottom-right-radius:6px;border-bottom-left-radius:6px}@supports selector(:dir(rtl)){:host(.accordion-group-expand-inset:dir(rtl)) ::slotted(ion-accordion.accordion-previous){border-bottom-right-radius:6px;border-bottom-left-radius:6px}}:host(.accordion-group-expand-inset) ::slotted(ion-accordion.accordion-next){border-top-left-radius:6px;border-top-right-radius:6px}:host-context([dir=rtl]):host(.accordion-group-expand-inset) ::slotted(ion-accordion.accordion-next),:host-context([dir=rtl]).accordion-group-expand-inset ::slotted(ion-accordion.accordion-next){border-top-left-radius:6px;border-top-right-radius:6px}@supports selector(:dir(rtl)){:host(.accordion-group-expand-inset:dir(rtl)) ::slotted(ion-accordion.accordion-next){border-top-left-radius:6px;border-top-right-radius:6px}}:host(.accordion-group-expand-inset) ::slotted(ion-accordion):first-of-type{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}";var AccordionGroup=function(){function n(n){registerInstance(this,n);this.ionChange=createEvent(this,"ionChange",7);this.ionValueChange=createEvent(this,"ionValueChange",7);this.animated=true;this.multiple=undefined;this.value=undefined;this.disabled=false;this.readonly=false;this.expand="compact"}n.prototype.valueChanged=function(){var n=this,t=n.value,i=n.multiple;if(!i&&Array.isArray(t)){printIonWarning('ion-accordion-group was passed an array of values, but multiple="false". This is incorrect usage and may result in unexpected behaviors. To dismiss this warning, pass a string to the "value" property when multiple="false".\n\n Value Passed: ['.concat(t.map((function(n){return"'".concat(n,"'")})).join(", "),"]\n"),this.el)}this.ionValueChange.emit({value:this.value})};n.prototype.disabledChanged=function(){return __awaiter(this,void 0,void 0,(function(){var n,t,i,o,r;return __generator(this,(function(e){switch(e.label){case 0:n=this.disabled;return[4,this.getAccordions()];case 1:t=e.sent();for(i=0,o=t;i<o.length;i++){r=o[i];r.disabled=n}return[2]}}))}))};n.prototype.readonlyChanged=function(){return __awaiter(this,void 0,void 0,(function(){var n,t,i,o,r;return __generator(this,(function(e){switch(e.label){case 0:n=this.readonly;return[4,this.getAccordions()];case 1:t=e.sent();for(i=0,o=t;i<o.length;i++){r=o[i];r.readonly=n}return[2]}}))}))};n.prototype.onKeydown=function(n){return __awaiter(this,void 0,void 0,(function(){var t,i,o,r,e,a,s;return __generator(this,(function(d){switch(d.label){case 0:t=document.activeElement;if(!t){return[2]}i=t.closest('ion-accordion [slot="header"]');if(!i){return[2]}o=t.tagName==="ION-ACCORDION"?t:t.closest("ion-accordion");if(!o){return[2]}r=o.closest("ion-accordion-group");if(r!==this.el){return[2]}return[4,this.getAccordions()];case 1:e=d.sent();a=e.findIndex((function(n){return n===o}));if(a===-1){return[2]}if(n.key==="ArrowDown"){s=this.findNextAccordion(e,a)}else if(n.key==="ArrowUp"){s=this.findPreviousAccordion(e,a)}else if(n.key==="Home"){s=e[0]}else if(n.key==="End"){s=e[e.length-1]}if(s!==undefined&&s!==t){s.focus()}return[2]}}))}))};n.prototype.componentDidLoad=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){if(this.disabled){this.disabledChanged()}if(this.readonly){this.readonlyChanged()}return[2]}))}))};n.prototype.setValue=function(n){var t=this.value=n;this.ionChange.emit({value:t})};n.prototype.requestAccordionToggle=function(n,t){return __awaiter(this,void 0,void 0,(function(){var i,o,r,e,a,s,d,c,s,d;return __generator(this,(function(u){i=this,o=i.multiple,r=i.value,e=i.readonly,a=i.disabled;if(e||a){return[2]}if(t){if(o){s=r!==null&&r!==void 0?r:[];d=Array.isArray(s)?s:[s];c=d.find((function(t){return t===n}));if(c===undefined&&n!==undefined){this.setValue(__spreadArray(__spreadArray([],d,true),[n],false))}}else{this.setValue(n)}}else{if(o){s=r!==null&&r!==void 0?r:[];d=Array.isArray(s)?s:[s];this.setValue(d.filter((function(t){return t!==n})))}else{this.setValue(undefined)}}return[2]}))}))};n.prototype.findNextAccordion=function(n,t){var i=n[t+1];if(i===undefined){return n[0]}return i};n.prototype.findPreviousAccordion=function(n,t){var i=n[t-1];if(i===undefined){return n[n.length-1]}return i};n.prototype.getAccordions=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){return[2,Array.from(this.el.querySelectorAll(":scope > ion-accordion"))]}))}))};n.prototype.render=function(){var n;var t=this,i=t.disabled,o=t.readonly,r=t.expand;var e=getIonMode(this);return h(Host,{class:(n={},n[e]=true,n["accordion-group-disabled"]=i,n["accordion-group-readonly"]=o,n["accordion-group-expand-".concat(r)]=true,n),role:"presentation"},h("slot",null))};Object.defineProperty(n.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(n,"watchers",{get:function(){return{value:["valueChanged"],disabled:["disabledChanged"],readonly:["readonlyChanged"]}},enumerable:false,configurable:true});return n}();AccordionGroup.style={ios:accordionGroupIosCss,md:accordionGroupMdCss};export{Accordion as ion_accordion,AccordionGroup as ion_accordion_group};
@@ -1,4 +1,4 @@
1
1
  import{__awaiter,__generator}from"tslib";
2
2
  /*!
3
3
  * (C) Ionic http://ionicframework.com - MIT License
4
- */import{r as registerInstance,h,H as Host,f as getElement}from"./index-4392ebcb.js";import{a as addEventListener,c as componentOnReady}from"./helpers-3379ba19.js";import{a as printIonError}from"./index-595d62c9.js";import{c as createColorClasses}from"./theme-17531cdf.js";import{b as getIonMode}from"./ionic-global-7efdecd0.js";import{q as parseDate,t as getToday,J as getHourCycle,S as getLocalizedDateTime,G as getMonthAndYear,K as getLocalizedTime,T as getMonthDayAndYear}from"./data-44d9e816.js";var iosDatetimeButtonCss=":host{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}:host button{border-radius:8px;-webkit-padding-start:12px;padding-inline-start:12px;-webkit-padding-end:12px;padding-inline-end:12px;padding-top:6px;padding-bottom:6px;-webkit-margin-start:2px;margin-inline-start:2px;-webkit-margin-end:2px;margin-inline-end:2px;margin-top:0px;margin-bottom:0px;position:relative;-webkit-transition:150ms color ease-in-out;transition:150ms color ease-in-out;border:none;background:var(--ion-color-step-300, #edeef0);color:var(--ion-text-color, #000);font-family:inherit;font-size:1rem;cursor:pointer;overflow:hidden;-webkit-appearance:none;-moz-appearance:none;appearance:none}:host(.time-active) #time-button,:host(.date-active) #date-button{color:var(--ion-color-base)}:host(.datetime-button-disabled){pointer-events:none}:host(.datetime-button-disabled) button{opacity:0.4}";var mdDatetimeButtonCss=":host{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}:host button{border-radius:8px;-webkit-padding-start:12px;padding-inline-start:12px;-webkit-padding-end:12px;padding-inline-end:12px;padding-top:6px;padding-bottom:6px;-webkit-margin-start:2px;margin-inline-start:2px;-webkit-margin-end:2px;margin-inline-end:2px;margin-top:0px;margin-bottom:0px;position:relative;-webkit-transition:150ms color ease-in-out;transition:150ms color ease-in-out;border:none;background:var(--ion-color-step-300, #edeef0);color:var(--ion-text-color, #000);font-family:inherit;font-size:1rem;cursor:pointer;overflow:hidden;-webkit-appearance:none;-moz-appearance:none;appearance:none}:host(.time-active) #time-button,:host(.date-active) #date-button{color:var(--ion-color-base)}:host(.datetime-button-disabled){pointer-events:none}:host(.datetime-button-disabled) button{opacity:0.4}";var DatetimeButton=function(){function e(e){var t=this;registerInstance(this,e);this.datetimeEl=null;this.overlayEl=null;this.getParsedDateValues=function(e){if(e===undefined||e===null){return[]}if(Array.isArray(e)){return e}return[e]};this.setDateTimeText=function(){var e=t,n=e.datetimeEl,i=e.datetimePresentation;if(!n){return}var a=n.value,r=n.locale,o=n.hourCycle,s=n.preferWheel,d=n.multiple,c=n.titleSelectedDatesFormatter;var u=t.getParsedDateValues(a);var m=parseDate(u.length>0?u:[getToday()]);if(!m){return}var l=m[0];var p=getHourCycle(r,o);t.dateText=t.timeText=undefined;switch(i){case"date-time":case"time-date":var f=getMonthDayAndYear(r,l);var h=getLocalizedTime(r,l,p);if(s){t.dateText="".concat(f," ").concat(h)}else{t.dateText=f;t.timeText=h}break;case"date":if(d&&u.length!==1){var b="".concat(u.length," days");if(c!==undefined){try{b=c(u)}catch(e){printIonError("Exception in provided `titleSelectedDatesFormatter`: ",e)}}t.dateText=b}else{t.dateText=getMonthDayAndYear(r,l)}break;case"time":t.timeText=getLocalizedTime(r,l,p);break;case"month-year":t.dateText=getMonthAndYear(r,l);break;case"month":t.dateText=getLocalizedDateTime(r,l,{month:"long"});break;case"year":t.dateText=getLocalizedDateTime(r,l,{year:"numeric"});break}};this.waitForDatetimeChanges=function(){return __awaiter(t,void 0,void 0,(function(){var e;return __generator(this,(function(t){e=this.datetimeEl;if(!e){return[2,Promise.resolve()]}return[2,new Promise((function(t){addEventListener(e,"ionRender",t,{once:true})}))]}))}))};this.handleDateClick=function(e){return __awaiter(t,void 0,void 0,(function(){var t,n,i,a,r;return __generator(this,(function(o){t=this,n=t.datetimeEl,i=t.datetimePresentation;if(!n){return[2]}a=false;switch(i){case"date-time":case"time-date":r=n.presentation!=="date";if(!n.preferWheel&&r){n.presentation="date";a=true}break}this.selectedButton="date";this.presentOverlay(e,a,this.dateTargetEl);return[2]}))}))};this.handleTimeClick=function(e){var n=t,i=n.datetimeEl,a=n.datetimePresentation;if(!i){return}var r=false;switch(a){case"date-time":case"time-date":var o=i.presentation!=="time";if(o){i.presentation="time";r=true}break}t.selectedButton="time";t.presentOverlay(e,r,t.timeTargetEl)};this.presentOverlay=function(e,n,i){return __awaiter(t,void 0,void 0,(function(){var t;return __generator(this,(function(a){switch(a.label){case 0:t=this.overlayEl;if(!t){return[2]}if(!(t.tagName==="ION-POPOVER"))return[3,3];if(!n)return[3,2];return[4,this.waitForDatetimeChanges()];case 1:a.sent();a.label=2;case 2:t.present(Object.assign(Object.assign({},e),{detail:{ionShadowTarget:i}}));return[3,4];case 3:t.present();a.label=4;case 4:return[2]}}))}))};this.datetimePresentation="date-time";this.dateText=undefined;this.timeText=undefined;this.datetimeActive=false;this.selectedButton=undefined;this.color="primary";this.disabled=false;this.datetime=undefined}e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n,i;var a=this;return __generator(this,(function(r){e=this.datetime;if(!e){printIonError("An ID associated with an ion-datetime instance is required for ion-datetime-button to function properly.",this.el);return[2]}t=this.datetimeEl=document.getElementById(e);if(!t){printIonError("No ion-datetime instance found for ID '".concat(e,"'."),this.el);return[2]}if(t.tagName!=="ION-DATETIME"){printIonError("Expected an ion-datetime instance for ID '".concat(e,"' but received '").concat(t.tagName.toLowerCase(),"' instead."),t);return[2]}n=new IntersectionObserver((function(e){var t=e[0];a.datetimeActive=t.isIntersecting}),{threshold:.01});n.observe(t);i=this.overlayEl=t.closest("ion-modal, ion-popover");if(i){i.classList.add("ion-datetime-button-overlay")}componentOnReady(t,(function(){var e=a.datetimePresentation=t.presentation||"date-time";a.setDateTimeText();addEventListener(t,"ionValueChange",a.setDateTimeText);switch(e){case"date-time":case"date":case"month-year":case"month":case"year":a.selectedButton="date";break;case"time-date":case"time":a.selectedButton="time";break}}));return[2]}))}))};e.prototype.render=function(){var e;var t=this;var n=this,i=n.color,a=n.dateText,r=n.timeText,o=n.selectedButton,s=n.datetimeActive,d=n.disabled;var c=getIonMode(this);return h(Host,{class:createColorClasses(i,(e={},e[c]=true,e["".concat(o,"-active")]=s,e["datetime-button-disabled"]=d,e))},a&&h("button",{class:"ion-activatable",id:"date-button","aria-expanded":s?"true":"false",onClick:this.handleDateClick,disabled:d,part:"native",ref:function(e){return t.dateTargetEl=e}},h("slot",{name:"date-target"},a),c==="md"&&h("ion-ripple-effect",null)),r&&h("button",{class:"ion-activatable",id:"time-button","aria-expanded":s?"true":"false",onClick:this.handleTimeClick,disabled:d,part:"native",ref:function(e){return t.timeTargetEl=e}},h("slot",{name:"time-target"},r),c==="md"&&h("ion-ripple-effect",null)))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();DatetimeButton.style={ios:iosDatetimeButtonCss,md:mdDatetimeButtonCss};export{DatetimeButton as ion_datetime_button};
4
+ */import{r as registerInstance,h,H as Host,f as getElement}from"./index-4392ebcb.js";import{a as addEventListener,c as componentOnReady}from"./helpers-3379ba19.js";import{a as printIonError}from"./index-595d62c9.js";import{c as createColorClasses}from"./theme-17531cdf.js";import{b as getIonMode}from"./ionic-global-7efdecd0.js";import{q as parseDate,t as getToday,J as getHourCycle,S as getLocalizedDateTime,G as getMonthAndYear,K as getLocalizedTime,T as getMonthDayAndYear}from"./data-b0787d87.js";var iosDatetimeButtonCss=":host{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}:host button{border-radius:8px;-webkit-padding-start:12px;padding-inline-start:12px;-webkit-padding-end:12px;padding-inline-end:12px;padding-top:6px;padding-bottom:6px;-webkit-margin-start:2px;margin-inline-start:2px;-webkit-margin-end:2px;margin-inline-end:2px;margin-top:0px;margin-bottom:0px;position:relative;-webkit-transition:150ms color ease-in-out;transition:150ms color ease-in-out;border:none;background:var(--ion-color-step-300, #edeef0);color:var(--ion-text-color, #000);font-family:inherit;font-size:1rem;cursor:pointer;overflow:hidden;-webkit-appearance:none;-moz-appearance:none;appearance:none}:host(.time-active) #time-button,:host(.date-active) #date-button{color:var(--ion-color-base)}:host(.datetime-button-disabled){pointer-events:none}:host(.datetime-button-disabled) button{opacity:0.4}";var mdDatetimeButtonCss=":host{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}:host button{border-radius:8px;-webkit-padding-start:12px;padding-inline-start:12px;-webkit-padding-end:12px;padding-inline-end:12px;padding-top:6px;padding-bottom:6px;-webkit-margin-start:2px;margin-inline-start:2px;-webkit-margin-end:2px;margin-inline-end:2px;margin-top:0px;margin-bottom:0px;position:relative;-webkit-transition:150ms color ease-in-out;transition:150ms color ease-in-out;border:none;background:var(--ion-color-step-300, #edeef0);color:var(--ion-text-color, #000);font-family:inherit;font-size:1rem;cursor:pointer;overflow:hidden;-webkit-appearance:none;-moz-appearance:none;appearance:none}:host(.time-active) #time-button,:host(.date-active) #date-button{color:var(--ion-color-base)}:host(.datetime-button-disabled){pointer-events:none}:host(.datetime-button-disabled) button{opacity:0.4}";var DatetimeButton=function(){function e(e){var t=this;registerInstance(this,e);this.datetimeEl=null;this.overlayEl=null;this.getParsedDateValues=function(e){if(e===undefined||e===null){return[]}if(Array.isArray(e)){return e}return[e]};this.setDateTimeText=function(){var e=t,n=e.datetimeEl,i=e.datetimePresentation;if(!n){return}var a=n.value,r=n.locale,o=n.hourCycle,s=n.preferWheel,d=n.multiple,c=n.titleSelectedDatesFormatter;var u=t.getParsedDateValues(a);var m=parseDate(u.length>0?u:[getToday()]);if(!m){return}var l=m[0];var p=getHourCycle(r,o);t.dateText=t.timeText=undefined;switch(i){case"date-time":case"time-date":var f=getMonthDayAndYear(r,l);var h=getLocalizedTime(r,l,p);if(s){t.dateText="".concat(f," ").concat(h)}else{t.dateText=f;t.timeText=h}break;case"date":if(d&&u.length!==1){var b="".concat(u.length," days");if(c!==undefined){try{b=c(u)}catch(e){printIonError("Exception in provided `titleSelectedDatesFormatter`: ",e)}}t.dateText=b}else{t.dateText=getMonthDayAndYear(r,l)}break;case"time":t.timeText=getLocalizedTime(r,l,p);break;case"month-year":t.dateText=getMonthAndYear(r,l);break;case"month":t.dateText=getLocalizedDateTime(r,l,{month:"long"});break;case"year":t.dateText=getLocalizedDateTime(r,l,{year:"numeric"});break}};this.waitForDatetimeChanges=function(){return __awaiter(t,void 0,void 0,(function(){var e;return __generator(this,(function(t){e=this.datetimeEl;if(!e){return[2,Promise.resolve()]}return[2,new Promise((function(t){addEventListener(e,"ionRender",t,{once:true})}))]}))}))};this.handleDateClick=function(e){return __awaiter(t,void 0,void 0,(function(){var t,n,i,a,r;return __generator(this,(function(o){t=this,n=t.datetimeEl,i=t.datetimePresentation;if(!n){return[2]}a=false;switch(i){case"date-time":case"time-date":r=n.presentation!=="date";if(!n.preferWheel&&r){n.presentation="date";a=true}break}this.selectedButton="date";this.presentOverlay(e,a,this.dateTargetEl);return[2]}))}))};this.handleTimeClick=function(e){var n=t,i=n.datetimeEl,a=n.datetimePresentation;if(!i){return}var r=false;switch(a){case"date-time":case"time-date":var o=i.presentation!=="time";if(o){i.presentation="time";r=true}break}t.selectedButton="time";t.presentOverlay(e,r,t.timeTargetEl)};this.presentOverlay=function(e,n,i){return __awaiter(t,void 0,void 0,(function(){var t;return __generator(this,(function(a){switch(a.label){case 0:t=this.overlayEl;if(!t){return[2]}if(!(t.tagName==="ION-POPOVER"))return[3,3];if(!n)return[3,2];return[4,this.waitForDatetimeChanges()];case 1:a.sent();a.label=2;case 2:t.present(Object.assign(Object.assign({},e),{detail:{ionShadowTarget:i}}));return[3,4];case 3:t.present();a.label=4;case 4:return[2]}}))}))};this.datetimePresentation="date-time";this.dateText=undefined;this.timeText=undefined;this.datetimeActive=false;this.selectedButton=undefined;this.color="primary";this.disabled=false;this.datetime=undefined}e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n,i;var a=this;return __generator(this,(function(r){e=this.datetime;if(!e){printIonError("An ID associated with an ion-datetime instance is required for ion-datetime-button to function properly.",this.el);return[2]}t=this.datetimeEl=document.getElementById(e);if(!t){printIonError("No ion-datetime instance found for ID '".concat(e,"'."),this.el);return[2]}if(t.tagName!=="ION-DATETIME"){printIonError("Expected an ion-datetime instance for ID '".concat(e,"' but received '").concat(t.tagName.toLowerCase(),"' instead."),t);return[2]}n=new IntersectionObserver((function(e){var t=e[0];a.datetimeActive=t.isIntersecting}),{threshold:.01});n.observe(t);i=this.overlayEl=t.closest("ion-modal, ion-popover");if(i){i.classList.add("ion-datetime-button-overlay")}componentOnReady(t,(function(){var e=a.datetimePresentation=t.presentation||"date-time";a.setDateTimeText();addEventListener(t,"ionValueChange",a.setDateTimeText);switch(e){case"date-time":case"date":case"month-year":case"month":case"year":a.selectedButton="date";break;case"time-date":case"time":a.selectedButton="time";break}}));return[2]}))}))};e.prototype.render=function(){var e;var t=this;var n=this,i=n.color,a=n.dateText,r=n.timeText,o=n.selectedButton,s=n.datetimeActive,d=n.disabled;var c=getIonMode(this);return h(Host,{class:createColorClasses(i,(e={},e[c]=true,e["".concat(o,"-active")]=s,e["datetime-button-disabled"]=d,e))},a&&h("button",{class:"ion-activatable",id:"date-button","aria-expanded":s?"true":"false",onClick:this.handleDateClick,disabled:d,part:"native",ref:function(e){return t.dateTargetEl=e}},h("slot",{name:"date-target"},a),c==="md"&&h("ion-ripple-effect",null)),r&&h("button",{class:"ion-activatable",id:"time-button","aria-expanded":s?"true":"false",onClick:this.handleTimeClick,disabled:d,part:"native",ref:function(e){return t.timeTargetEl=e}},h("slot",{name:"time-target"},r),c==="md"&&h("ion-ripple-effect",null)))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();DatetimeButton.style={ios:iosDatetimeButtonCss,md:mdDatetimeButtonCss};export{DatetimeButton as ion_datetime_button};