@ionic/core 7.5.7-dev.11700601905.13f94170 → 7.5.7-nightly.20231123

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 (54) hide show
  1. package/components/data.js +13 -41
  2. package/components/ion-datetime.js +17 -36
  3. package/components/picker-column-internal.js +12 -7
  4. package/dist/cjs/{data-88d0864d.js → data-c8d21093.js} +13 -41
  5. package/dist/cjs/ion-datetime-button.cjs.entry.js +1 -1
  6. package/dist/cjs/ion-datetime_3.cjs.entry.js +18 -37
  7. package/dist/cjs/ion-picker-column-internal.cjs.entry.js +11 -7
  8. package/dist/cjs/ionic.cjs.js +1 -1
  9. package/dist/cjs/loader.cjs.js +1 -1
  10. package/dist/collection/collection-manifest.json +2 -2
  11. package/dist/collection/components/datetime/datetime.js +17 -36
  12. package/dist/collection/components/datetime/test/disabled/datetime.spec.js +33 -0
  13. package/dist/collection/components/datetime/test/manipulation.spec.js +1 -77
  14. package/dist/collection/components/datetime/utils/manipulation.js +14 -42
  15. package/dist/collection/components/picker-column-internal/picker-column-internal.ios.css +11 -3
  16. package/dist/collection/components/picker-column-internal/picker-column-internal.js +27 -5
  17. package/dist/collection/components/picker-column-internal/picker-column-internal.md.css +11 -3
  18. package/dist/collection/components/picker-column-internal/test/disabled/picker-column-internal.e2e.js +34 -5
  19. package/dist/docs.json +11 -11
  20. package/dist/esm/{data-2b019469.js → data-44d9e816.js} +13 -41
  21. package/dist/esm/ion-datetime-button.entry.js +1 -1
  22. package/dist/esm/ion-datetime_3.entry.js +18 -37
  23. package/dist/esm/ion-picker-column-internal.entry.js +11 -7
  24. package/dist/esm/ionic.js +1 -1
  25. package/dist/esm/loader.js +1 -1
  26. package/dist/esm-es5/data-44d9e816.js +4 -0
  27. package/dist/esm-es5/ion-datetime-button.entry.js +1 -1
  28. package/dist/esm-es5/ion-datetime_3.entry.js +1 -1
  29. package/dist/esm-es5/ion-picker-column-internal.entry.js +1 -1
  30. package/dist/esm-es5/ionic.js +1 -1
  31. package/dist/esm-es5/loader.js +1 -1
  32. package/dist/ionic/ionic.esm.js +1 -1
  33. package/dist/ionic/p-17240d90.js +4 -0
  34. package/dist/ionic/p-29fe18ef.entry.js +4 -0
  35. package/dist/ionic/p-40903d34.system.js +1 -1
  36. package/dist/ionic/{p-2743f9a7.system.entry.js → p-4c80afe1.system.entry.js} +1 -1
  37. package/dist/ionic/p-778af3a7.entry.js +4 -0
  38. package/dist/ionic/{p-c4c7fd8f.entry.js → p-8ad82eb3.entry.js} +1 -1
  39. package/dist/ionic/p-957601e8.system.entry.js +4 -0
  40. package/dist/ionic/p-b8c3f071.system.js +4 -0
  41. package/dist/ionic/p-c56b6570.system.entry.js +4 -0
  42. package/dist/types/components/datetime/utils/manipulation.d.ts +15 -34
  43. package/dist/types/components/picker-column-internal/picker-column-internal.d.ts +4 -0
  44. package/dist/types/components.d.ts +8 -0
  45. package/hydrate/index.js +42 -84
  46. package/package.json +1 -1
  47. package/dist/collection/components/datetime/test/prefer-wheel/datetime.spec.js +0 -27
  48. package/dist/esm-es5/data-2b019469.js +0 -4
  49. package/dist/ionic/p-1108f9bf.system.entry.js +0 -4
  50. package/dist/ionic/p-264c16e9.entry.js +0 -4
  51. package/dist/ionic/p-297741bc.system.js +0 -4
  52. package/dist/ionic/p-4794e0ac.system.entry.js +0 -4
  53. package/dist/ionic/p-4dbac22d.entry.js +0 -4
  54. package/dist/ionic/p-598cdf16.js +0 -4
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * (C) Ionic http://ionicframework.com - MIT License
3
3
  */
4
- import { getPreviousYear, getNextYear, getPreviousMonth, getNextMonth, getPreviousDay, getNextDay, getPreviousWeek, getNextWeek, getEndOfWeek, getStartOfWeek, convert12HourTo24Hour, getInternalHourValue, calculateHourFromAMPM, subtractDays, addDays, validateParts, getClosestValidDate, } from "../utils/manipulation";
4
+ import { getPreviousYear, getNextYear, getPreviousMonth, getNextMonth, getPreviousDay, getNextDay, getPreviousWeek, getNextWeek, getEndOfWeek, getStartOfWeek, convert12HourTo24Hour, getInternalHourValue, calculateHourFromAMPM, subtractDays, addDays, validateParts, } from "../utils/manipulation";
5
5
  describe('addDays()', () => {
6
6
  it('should correctly add days', () => {
7
7
  expect(addDays({
@@ -431,79 +431,3 @@ describe('validateParts()', () => {
431
431
  })).toEqual({ month: 1, day: 1, year: 2022, hour: 9, minute: 30 });
432
432
  });
433
433
  });
434
- describe('getClosestValidDate()', () => {
435
- it('should match a date with only month/day/year', () => {
436
- // October 10, 2023
437
- const refParts = { month: 10, day: 10, year: 2023 };
438
- // April 10, 2021
439
- const minParts = { month: 4, day: 10, year: 2021 };
440
- // September 14, 2021
441
- const maxParts = { month: 9, day: 14, year: 2021 };
442
- // September 4, 2021
443
- const expected = { month: 9, day: 4, year: 2021, dayOfWeek: undefined };
444
- expect(getClosestValidDate({
445
- refParts,
446
- monthValues: [2, 3, 7, 9, 10],
447
- dayValues: [4, 15, 25],
448
- yearValues: [2020, 2021, 2023],
449
- maxParts,
450
- minParts,
451
- })).toEqual(expected);
452
- });
453
- it('should match a date when the reference date is before the min', () => {
454
- // April 2, 2020 3:20 PM
455
- const refParts = { month: 4, day: 2, year: 2020, hour: 15, minute: 20 };
456
- // September 10, 2021 10:10 AM
457
- const minParts = { month: 9, day: 10, year: 2021, hour: 10, minute: 10 };
458
- // September 14, 2021 10:11 AM
459
- const maxParts = { month: 9, day: 14, year: 2021, hour: 10, minute: 11 };
460
- // September 11, 2021 11:15 AM
461
- const expected = {
462
- year: 2021,
463
- day: 11,
464
- month: 9,
465
- hour: 11,
466
- minute: 15,
467
- ampm: 'am',
468
- dayOfWeek: undefined,
469
- };
470
- expect(getClosestValidDate({
471
- refParts,
472
- monthValues: [4, 9, 11],
473
- dayValues: [11, 12, 13, 14],
474
- yearValues: [2020, 2021, 2023],
475
- hourValues: [9, 10, 11],
476
- minuteValues: [11, 12, 13, 14, 15],
477
- maxParts,
478
- minParts,
479
- })).toEqual(expected);
480
- });
481
- it('should match a date when the reference date is before the min', () => {
482
- // April 2, 2020 3:20 PM
483
- const refParts = { month: 4, day: 2, year: 2020, hour: 15, minute: 20 };
484
- // September 10, 2021 10:10 AM
485
- const minParts = { month: 9, day: 10, year: 2021, hour: 10, minute: 10 };
486
- // September 10, 2021 10:15 AM
487
- const maxParts = { month: 9, day: 10, year: 2021, hour: 10, minute: 15 };
488
- // September 10, 2021 10:15 AM
489
- const expected = {
490
- month: 9,
491
- day: 10,
492
- year: 2021,
493
- hour: 10,
494
- minute: 15,
495
- ampm: 'am',
496
- dayOfWeek: undefined,
497
- };
498
- expect(getClosestValidDate({
499
- refParts,
500
- monthValues: [4, 9, 11],
501
- dayValues: [10, 12, 13, 14],
502
- yearValues: [2020, 2021, 2023],
503
- hourValues: [9, 10, 11],
504
- minuteValues: [11, 12, 13, 14, 15],
505
- minParts,
506
- maxParts,
507
- })).toEqual(expected);
508
- });
509
- });
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * (C) Ionic http://ionicframework.com - MIT License
3
3
  */
4
- import { isAfter, isBefore, isSameDay } from "./comparison";
4
+ import { isSameDay } from "./comparison";
5
5
  import { getNumDaysInMonth } from "./helpers";
6
6
  import { clampDate, parseAmPm } from "./parse";
7
7
  const twoDigit = (val) => {
@@ -355,60 +355,32 @@ 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
358
364
  */
359
- export const getClosestValidDate = ({ refParts, monthValues, dayValues, yearValues, hourValues, minuteValues, minParts, maxParts, }) => {
365
+ export const getClosestValidDate = (refParts, monthValues, dayValues, yearValues, hourValues, minuteValues) => {
360
366
  const { hour, minute, day, month, year } = refParts;
361
- const copyParts = clampDate(Object.assign(Object.assign({}, refParts), { dayOfWeek: undefined }), minParts, maxParts);
367
+ const copyParts = Object.assign(Object.assign({}, refParts), { dayOfWeek: undefined });
362
368
  if (monthValues !== undefined) {
363
- // Filters out months that are out of the min/max bounds
364
- const filteredMonths = monthValues.filter((month) => !(minParts !== undefined && month < minParts.month) && !(maxParts !== undefined && month > maxParts.month));
365
- copyParts.month = findClosestValue(month, filteredMonths);
369
+ copyParts.month = findClosestValue(month, monthValues);
366
370
  }
367
371
  // Day is nullable but cannot be undefined
368
372
  if (day !== null && dayValues !== undefined) {
369
- // Filters out days that are out of the min/max bounds
370
- const filteredDays = dayValues.filter((day) => {
371
- if (minParts && isBefore(Object.assign(Object.assign({}, copyParts), { day }), minParts)) {
372
- return false;
373
- }
374
- if (maxParts && isAfter(Object.assign(Object.assign({}, copyParts), { day }), maxParts)) {
375
- return false;
376
- }
377
- return true;
378
- });
379
- copyParts.day = findClosestValue(day, filteredDays);
373
+ copyParts.day = findClosestValue(day, dayValues);
380
374
  }
381
375
  if (yearValues !== undefined) {
382
- // Filters out years that are out of the min/max bounds
383
- const filteredYears = yearValues.filter((year) => !(minParts !== undefined && year < minParts.year) && !(maxParts !== undefined && year > maxParts.year));
384
- copyParts.year = findClosestValue(year, filteredYears);
376
+ copyParts.year = findClosestValue(year, yearValues);
385
377
  }
386
378
  if (hour !== undefined && hourValues !== undefined) {
387
- // Filters out hours that are out of the min/max bounds
388
- const filteredHours = hourValues.filter((hour) => {
389
- if ((minParts === null || minParts === void 0 ? void 0 : minParts.hour) !== undefined && isSameDay(copyParts, minParts) && hour < minParts.hour) {
390
- return false;
391
- }
392
- if ((maxParts === null || maxParts === void 0 ? void 0 : maxParts.hour) !== undefined && isSameDay(copyParts, maxParts) && hour > maxParts.hour) {
393
- return false;
394
- }
395
- return true;
396
- });
397
- copyParts.hour = findClosestValue(hour, filteredHours);
379
+ copyParts.hour = findClosestValue(hour, hourValues);
398
380
  copyParts.ampm = parseAmPm(copyParts.hour);
399
381
  }
400
382
  if (minute !== undefined && minuteValues !== undefined) {
401
- // Filters out minutes that are out of the min/max bounds
402
- const filteredMinutes = minuteValues.filter((minute) => {
403
- if ((minParts === null || minParts === void 0 ? void 0 : minParts.minute) !== undefined && isSameDay(copyParts, minParts) && minute < minParts.minute) {
404
- return false;
405
- }
406
- if ((maxParts === null || maxParts === void 0 ? void 0 : maxParts.minute) !== undefined && isSameDay(copyParts, maxParts) && minute > maxParts.minute) {
407
- return false;
408
- }
409
- return true;
410
- });
411
- copyParts.minute = findClosestValue(minute, filteredMinutes);
383
+ copyParts.minute = findClosestValue(minute, minuteValues);
412
384
  }
413
385
  return copyParts;
414
386
  };
@@ -109,12 +109,20 @@
109
109
  }
110
110
 
111
111
  :host .picker-item-empty,
112
- :host .picker-item.picker-item-disabled {
113
- scroll-snap-align: none;
112
+ :host .picker-item[disabled] {
114
113
  cursor: default;
115
114
  }
116
115
 
117
- :host .picker-item.picker-item-disabled {
116
+ :host .picker-item-empty,
117
+ :host(:not([disabled])) .picker-item[disabled] {
118
+ scroll-snap-align: none;
119
+ }
120
+
121
+ :host([disabled]) {
122
+ overflow-y: hidden;
123
+ }
124
+
125
+ :host .picker-item[disabled] {
118
126
  opacity: 0.4;
119
127
  }
120
128
 
@@ -221,6 +221,7 @@ export class PickerColumnInternal {
221
221
  this.el.classList.remove('picker-column-active');
222
222
  };
223
223
  this.isActive = false;
224
+ this.disabled = false;
224
225
  this.items = [];
225
226
  this.value = undefined;
226
227
  this.color = 'primary';
@@ -318,10 +319,13 @@ export class PickerColumnInternal {
318
319
  }
319
320
  }
320
321
  get activeItem() {
321
- return getElementRoot(this.el).querySelector(`.picker-item[data-value="${this.value}"]:not([disabled])`);
322
+ // If the whole picker column is disabled, the current value should appear active
323
+ // If the current value item is specifically disabled, it should not appear active
324
+ const selector = `.picker-item[data-value="${this.value}"]${this.disabled ? '' : ':not([disabled])'}`;
325
+ return getElementRoot(this.el).querySelector(selector);
322
326
  }
323
327
  render() {
324
- const { items, color, isActive, numericInput } = this;
328
+ const { items, color, disabled: pickerDisabled, isActive, numericInput } = this;
325
329
  const mode = getIonMode(this);
326
330
  /**
327
331
  * exportparts is needed so ion-datetime can expose the parts
@@ -329,11 +333,12 @@ export class PickerColumnInternal {
329
333
  * the attribute can be moved to datetime.tsx and set on every
330
334
  * instance of ion-picker-column-internal there instead.
331
335
  */
332
- return (h(Host, { exportparts: `${PICKER_ITEM_PART}, ${PICKER_ITEM_ACTIVE_PART}`, tabindex: 0, class: createColorClasses(color, {
336
+ return (h(Host, { exportparts: `${PICKER_ITEM_PART}, ${PICKER_ITEM_ACTIVE_PART}`, disabled: pickerDisabled, tabindex: pickerDisabled ? null : 0, class: createColorClasses(color, {
333
337
  [mode]: true,
334
338
  ['picker-column-active']: isActive,
335
339
  ['picker-column-numeric-input']: numericInput,
336
340
  }) }, h("div", { class: "picker-item picker-item-empty", "aria-hidden": "true" }, "\u00A0"), h("div", { class: "picker-item picker-item-empty", "aria-hidden": "true" }, "\u00A0"), h("div", { class: "picker-item picker-item-empty", "aria-hidden": "true" }, "\u00A0"), items.map((item, index) => {
341
+ const isItemDisabled = pickerDisabled || item.disabled || false;
337
342
  {
338
343
  /*
339
344
  Users should be able to tab
@@ -346,10 +351,9 @@ export class PickerColumnInternal {
346
351
  }
347
352
  return (h("button", { tabindex: "-1", class: {
348
353
  'picker-item': true,
349
- 'picker-item-disabled': item.disabled || false,
350
354
  }, "data-value": item.value, "data-index": index, onClick: (ev) => {
351
355
  this.centerPickerItemInView(ev.target, true);
352
- }, disabled: item.disabled, part: PICKER_ITEM_PART }, item.text));
356
+ }, disabled: isItemDisabled, part: PICKER_ITEM_PART }, item.text));
353
357
  }), h("div", { class: "picker-item picker-item-empty", "aria-hidden": "true" }, "\u00A0"), h("div", { class: "picker-item picker-item-empty", "aria-hidden": "true" }, "\u00A0"), h("div", { class: "picker-item picker-item-empty", "aria-hidden": "true" }, "\u00A0")));
354
358
  }
355
359
  static get is() { return "ion-picker-column-internal"; }
@@ -368,6 +372,24 @@ export class PickerColumnInternal {
368
372
  }
369
373
  static get properties() {
370
374
  return {
375
+ "disabled": {
376
+ "type": "boolean",
377
+ "mutable": false,
378
+ "complexType": {
379
+ "original": "boolean",
380
+ "resolved": "boolean",
381
+ "references": {}
382
+ },
383
+ "required": false,
384
+ "optional": false,
385
+ "docs": {
386
+ "tags": [],
387
+ "text": "If `true`, the user cannot interact with the picker."
388
+ },
389
+ "attribute": "disabled",
390
+ "reflect": false,
391
+ "defaultValue": "false"
392
+ },
371
393
  "items": {
372
394
  "type": "unknown",
373
395
  "mutable": false,
@@ -109,12 +109,20 @@
109
109
  }
110
110
 
111
111
  :host .picker-item-empty,
112
- :host .picker-item.picker-item-disabled {
113
- scroll-snap-align: none;
112
+ :host .picker-item[disabled] {
114
113
  cursor: default;
115
114
  }
116
115
 
117
- :host .picker-item.picker-item-disabled {
116
+ :host .picker-item-empty,
117
+ :host(:not([disabled])) .picker-item[disabled] {
118
+ scroll-snap-align: none;
119
+ }
120
+
121
+ :host([disabled]) {
122
+ overflow-y: hidden;
123
+ }
124
+
125
+ :host .picker-item[disabled] {
118
126
  opacity: 0.4;
119
127
  }
120
128
 
@@ -32,7 +32,7 @@ configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
32
32
  * This behavior does not vary across modes/directions.
33
33
  */
34
34
  configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) => {
35
- test.describe(title('picker-column-internal: disabled'), () => {
35
+ test.describe(title('picker-column-internal: disabled items'), () => {
36
36
  test('all picker items should be enabled by default', async ({ page }) => {
37
37
  await page.setContent(`
38
38
  <ion-picker-internal>
@@ -48,7 +48,7 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) =>
48
48
  ]
49
49
  </script>
50
50
  `, config);
51
- const pickerItems = page.locator('ion-picker-column-internal .picker-item:not(.picker-item-empty, .picker-item-disabled)');
51
+ const pickerItems = page.locator('ion-picker-column-internal .picker-item:not(.picker-item-empty, [disabled])');
52
52
  expect(await pickerItems.count()).toBe(3);
53
53
  });
54
54
  test('disabled picker item should not be interactive', async ({ page }) => {
@@ -66,7 +66,7 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) =>
66
66
  ]
67
67
  </script>
68
68
  `, config);
69
- const disabledItem = page.locator('ion-picker-column-internal .picker-item.picker-item-disabled');
69
+ const disabledItem = page.locator('ion-picker-column-internal .picker-item[disabled]');
70
70
  await expect(disabledItem).not.toBeEnabled();
71
71
  });
72
72
  test('disabled picker item should not be considered active', async ({ page }) => {
@@ -106,7 +106,7 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) =>
106
106
  await pickerColumn.evaluate((el) => (el.value = 'b'));
107
107
  await page.waitForChanges();
108
108
  const disabledItem = page.locator('ion-picker-column-internal .picker-item[data-value="b"]');
109
- await expect(disabledItem).toHaveClass(/picker-item-disabled/);
109
+ await expect(disabledItem).toBeDisabled();
110
110
  await expect(disabledItem).not.toHaveClass(/picker-item-active/);
111
111
  });
112
112
  test('defaulting the value to a disabled item should not cause that item to be active', async ({ page }) => {
@@ -126,8 +126,37 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) =>
126
126
  </script>
127
127
  `, config);
128
128
  const disabledItem = page.locator('ion-picker-column-internal .picker-item[data-value="b"]');
129
- await expect(disabledItem).toHaveClass(/picker-item-disabled/);
129
+ await expect(disabledItem).toBeDisabled();
130
130
  await expect(disabledItem).not.toHaveClass(/picker-item-active/);
131
131
  });
132
132
  });
133
133
  });
134
+ /**
135
+ * This behavior does not vary across directions.
136
+ */
137
+ configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
138
+ test.describe(title('picker-column-internal: disabled column rendering'), () => {
139
+ test.beforeEach(async ({ page }) => {
140
+ await page.goto('/src/components/picker-column-internal/test/disabled', config);
141
+ });
142
+ test('disabled column should not have visual regressions', async ({ page }) => {
143
+ const disabledColumn = page.locator('#column-disabled');
144
+ await page.waitForChanges();
145
+ await expect(disabledColumn).toHaveScreenshot(screenshot('picker-internal-disabled-column'));
146
+ });
147
+ });
148
+ });
149
+ /**
150
+ * This behavior does not vary across modes/directions.
151
+ */
152
+ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) => {
153
+ test.describe(title('picker-column-internal: disabled column'), () => {
154
+ test.beforeEach(async ({ page }) => {
155
+ await page.goto('/src/components/picker-column-internal/test/disabled', config);
156
+ });
157
+ test('item in disabled column should not be interactive', async ({ page }) => {
158
+ const secondItem = page.locator('#column-disabled .picker-item:not(.picker-item-empty)').nth(1);
159
+ await expect(secondItem).toBeDisabled();
160
+ });
161
+ });
162
+ });
package/dist/docs.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "timestamp": "2023-11-21T21:26:53",
2
+ "timestamp": "2023-11-23T06:03:10",
3
3
  "compiler": {
4
4
  "name": "@stencil/core",
5
5
  "version": "4.7.2",
@@ -29058,6 +29058,16 @@
29058
29058
  "docstring": "",
29059
29059
  "path": "src/components/datetime/datetime-interface.ts"
29060
29060
  },
29061
+ "src/components/picker-column-internal/picker-column-internal-interfaces.ts::PickerColumnItem": {
29062
+ "declaration": "export interface PickerColumnItem {\n text: string;\n value: string | number;\n disabled?: boolean;\n}",
29063
+ "docstring": "",
29064
+ "path": "src/components/picker-column-internal/picker-column-internal-interfaces.ts"
29065
+ },
29066
+ "src/components/picker-internal/picker-internal-interfaces.ts::PickerInternalChangeEventDetail": {
29067
+ "declaration": "export interface PickerInternalChangeEventDetail {\n useInputMode: boolean;\n inputModeColumn?: HTMLIonPickerColumnInternalElement;\n}",
29068
+ "docstring": "",
29069
+ "path": "src/components/picker-internal/picker-internal-interfaces.ts"
29070
+ },
29061
29071
  "src/components/spinner/spinner-configs.ts::SpinnerTypes": {
29062
29072
  "declaration": "\"bubbles\" | \"circles\" | \"circular\" | \"crescent\" | \"dots\" | \"lines\" | \"lines-small\" | \"lines-sharp\" | \"lines-sharp-small\"",
29063
29073
  "docstring": "",
@@ -29168,16 +29178,6 @@
29168
29178
  "docstring": "",
29169
29179
  "path": "src/components/picker/picker-interface.ts"
29170
29180
  },
29171
- "src/components/picker-column-internal/picker-column-internal-interfaces.ts::PickerColumnItem": {
29172
- "declaration": "export interface PickerColumnItem {\n text: string;\n value: string | number;\n disabled?: boolean;\n}",
29173
- "docstring": "",
29174
- "path": "src/components/picker-column-internal/picker-column-internal-interfaces.ts"
29175
- },
29176
- "src/components/picker-internal/picker-internal-interfaces.ts::PickerInternalChangeEventDetail": {
29177
- "declaration": "export interface PickerInternalChangeEventDetail {\n useInputMode: boolean;\n inputModeColumn?: HTMLIonPickerColumnInternalElement;\n}",
29178
- "docstring": "",
29179
- "path": "src/components/picker-internal/picker-internal-interfaces.ts"
29180
- },
29181
29181
  "src/components/popover/popover-interface.ts::TriggerAction": {
29182
29182
  "declaration": "export type TriggerAction = 'click' | 'hover' | 'context-menu';",
29183
29183
  "docstring": "",
@@ -716,60 +716,32 @@ 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
719
725
  */
720
- const getClosestValidDate = ({ refParts, monthValues, dayValues, yearValues, hourValues, minuteValues, minParts, maxParts, }) => {
726
+ const getClosestValidDate = (refParts, monthValues, dayValues, yearValues, hourValues, minuteValues) => {
721
727
  const { hour, minute, day, month, year } = refParts;
722
- const copyParts = clampDate(Object.assign(Object.assign({}, refParts), { dayOfWeek: undefined }), minParts, maxParts);
728
+ const copyParts = Object.assign(Object.assign({}, refParts), { dayOfWeek: undefined });
723
729
  if (monthValues !== undefined) {
724
- // Filters out months that are out of the min/max bounds
725
- const filteredMonths = monthValues.filter((month) => !(minParts !== undefined && month < minParts.month) && !(maxParts !== undefined && month > maxParts.month));
726
- copyParts.month = findClosestValue(month, filteredMonths);
730
+ copyParts.month = findClosestValue(month, monthValues);
727
731
  }
728
732
  // Day is nullable but cannot be undefined
729
733
  if (day !== null && dayValues !== undefined) {
730
- // Filters out days that are out of the min/max bounds
731
- const filteredDays = dayValues.filter((day) => {
732
- if (minParts && isBefore(Object.assign(Object.assign({}, copyParts), { day }), minParts)) {
733
- return false;
734
- }
735
- if (maxParts && isAfter(Object.assign(Object.assign({}, copyParts), { day }), maxParts)) {
736
- return false;
737
- }
738
- return true;
739
- });
740
- copyParts.day = findClosestValue(day, filteredDays);
734
+ copyParts.day = findClosestValue(day, dayValues);
741
735
  }
742
736
  if (yearValues !== undefined) {
743
- // Filters out years that are out of the min/max bounds
744
- const filteredYears = yearValues.filter((year) => !(minParts !== undefined && year < minParts.year) && !(maxParts !== undefined && year > maxParts.year));
745
- copyParts.year = findClosestValue(year, filteredYears);
737
+ copyParts.year = findClosestValue(year, yearValues);
746
738
  }
747
739
  if (hour !== undefined && hourValues !== undefined) {
748
- // Filters out hours that are out of the min/max bounds
749
- const filteredHours = hourValues.filter((hour) => {
750
- if ((minParts === null || minParts === void 0 ? void 0 : minParts.hour) !== undefined && isSameDay(copyParts, minParts) && hour < minParts.hour) {
751
- return false;
752
- }
753
- if ((maxParts === null || maxParts === void 0 ? void 0 : maxParts.hour) !== undefined && isSameDay(copyParts, maxParts) && hour > maxParts.hour) {
754
- return false;
755
- }
756
- return true;
757
- });
758
- copyParts.hour = findClosestValue(hour, filteredHours);
740
+ copyParts.hour = findClosestValue(hour, hourValues);
759
741
  copyParts.ampm = parseAmPm(copyParts.hour);
760
742
  }
761
743
  if (minute !== undefined && minuteValues !== undefined) {
762
- // Filters out minutes that are out of the min/max bounds
763
- const filteredMinutes = minuteValues.filter((minute) => {
764
- if ((minParts === null || minParts === void 0 ? void 0 : minParts.minute) !== undefined && isSameDay(copyParts, minParts) && minute < minParts.minute) {
765
- return false;
766
- }
767
- if ((maxParts === null || maxParts === void 0 ? void 0 : maxParts.minute) !== undefined && isSameDay(copyParts, maxParts) && minute > maxParts.minute) {
768
- return false;
769
- }
770
- return true;
771
- });
772
- copyParts.minute = findClosestValue(minute, filteredMinutes);
744
+ copyParts.minute = findClosestValue(minute, minuteValues);
773
745
  }
774
746
  return copyParts;
775
747
  };
@@ -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-40e42e7f.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-2b019469.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';
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-40e42e7f.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-2b019469.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';
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-6c9feb7e.js';
15
15
  import { c as createAnimation } from './animation-8aa13916.js';
@@ -862,24 +862,14 @@ 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, preferWheel, workingParts } = this;
865
+ const { isCalendarPicker, activeParts } = 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
- 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
- }
872
+ this.setValue(undefined);
883
873
  }
884
874
  else {
885
875
  this.setValue(convertDataToISO(activeParts));
@@ -1083,18 +1073,9 @@ const Datetime = class {
1083
1073
  const yearValues = (this.parsedYearValues = convertToArrayOfNumbers(this.yearValues));
1084
1074
  const dayValues = (this.parsedDayValues = convertToArrayOfNumbers(this.dayValues));
1085
1075
  const todayParts = (this.todayParts = parseDate(getToday()));
1076
+ this.defaultParts = getClosestValidDate(todayParts, monthValues, dayValues, yearValues, hourValues, minuteValues);
1086
1077
  this.processMinParts();
1087
1078
  this.processMaxParts();
1088
- this.defaultParts = getClosestValidDate({
1089
- refParts: todayParts,
1090
- monthValues,
1091
- dayValues,
1092
- yearValues,
1093
- hourValues,
1094
- minuteValues,
1095
- minParts: this.minParts,
1096
- maxParts: this.maxParts,
1097
- });
1098
1079
  this.processValue(this.value);
1099
1080
  this.emitStyle();
1100
1081
  }
@@ -1162,7 +1143,7 @@ const Datetime = class {
1162
1143
  : this.renderIndividualDatePickerColumns(forcePresentation);
1163
1144
  }
1164
1145
  renderCombinedDatePickerColumn() {
1165
- const { defaultParts, workingParts, locale, minParts, maxParts, todayParts, isDateEnabled } = this;
1146
+ const { defaultParts, disabled, workingParts, locale, minParts, maxParts, todayParts, isDateEnabled } = this;
1166
1147
  const activePart = this.getActivePartsWithFallback();
1167
1148
  /**
1168
1149
  * By default, generate a range of 3 months:
@@ -1213,7 +1194,7 @@ const Datetime = class {
1213
1194
  const todayString = workingParts.day !== null
1214
1195
  ? `${workingParts.year}-${workingParts.month}-${workingParts.day}`
1215
1196
  : `${defaultParts.year}-${defaultParts.month}-${defaultParts.day}`;
1216
- return (h("ion-picker-column-internal", { class: "date-column", color: this.color, items: items, value: todayString, onIonChange: (ev) => {
1197
+ return (h("ion-picker-column-internal", { class: "date-column", color: this.color, disabled: disabled, items: items, value: todayString, onIonChange: (ev) => {
1217
1198
  // TODO(FW-1823) Remove this when iOS 14 support is dropped.
1218
1199
  // Due to a Safari 14 issue we need to destroy
1219
1200
  // the scroll listener before we update state
@@ -1295,9 +1276,9 @@ const Datetime = class {
1295
1276
  if (days.length === 0) {
1296
1277
  return [];
1297
1278
  }
1298
- const { workingParts } = this;
1279
+ const { disabled, workingParts } = this;
1299
1280
  const activePart = this.getActivePartsWithFallback();
1300
- return (h("ion-picker-column-internal", { class: "day-column", color: this.color, items: days, value: (_a = (workingParts.day !== null ? workingParts.day : this.defaultParts.day)) !== null && _a !== void 0 ? _a : undefined, onIonChange: (ev) => {
1281
+ return (h("ion-picker-column-internal", { class: "day-column", color: this.color, disabled: disabled, items: days, value: (_a = (workingParts.day !== null ? workingParts.day : this.defaultParts.day)) !== null && _a !== void 0 ? _a : undefined, onIonChange: (ev) => {
1301
1282
  // TODO(FW-1823) Remove this when iOS 14 support is dropped.
1302
1283
  // Due to a Safari 14 issue we need to destroy
1303
1284
  // the scroll listener before we update state
@@ -1317,9 +1298,9 @@ const Datetime = class {
1317
1298
  if (months.length === 0) {
1318
1299
  return [];
1319
1300
  }
1320
- const { workingParts } = this;
1301
+ const { disabled, workingParts } = this;
1321
1302
  const activePart = this.getActivePartsWithFallback();
1322
- return (h("ion-picker-column-internal", { class: "month-column", color: this.color, items: months, value: workingParts.month, onIonChange: (ev) => {
1303
+ return (h("ion-picker-column-internal", { class: "month-column", color: this.color, disabled: disabled, items: months, value: workingParts.month, onIonChange: (ev) => {
1323
1304
  // TODO(FW-1823) Remove this when iOS 14 support is dropped.
1324
1305
  // Due to a Safari 14 issue we need to destroy
1325
1306
  // the scroll listener before we update state
@@ -1339,9 +1320,9 @@ const Datetime = class {
1339
1320
  if (years.length === 0) {
1340
1321
  return [];
1341
1322
  }
1342
- const { workingParts } = this;
1323
+ const { disabled, workingParts } = this;
1343
1324
  const activePart = this.getActivePartsWithFallback();
1344
- return (h("ion-picker-column-internal", { class: "year-column", color: this.color, items: years, value: workingParts.year, onIonChange: (ev) => {
1325
+ return (h("ion-picker-column-internal", { class: "year-column", color: this.color, disabled: disabled, items: years, value: workingParts.year, onIonChange: (ev) => {
1345
1326
  // TODO(FW-1823) Remove this when iOS 14 support is dropped.
1346
1327
  // Due to a Safari 14 issue we need to destroy
1347
1328
  // the scroll listener before we update state
@@ -1380,35 +1361,35 @@ const Datetime = class {
1380
1361
  ];
1381
1362
  }
1382
1363
  renderHourPickerColumn(hoursData) {
1383
- const { workingParts } = this;
1364
+ const { disabled, workingParts } = this;
1384
1365
  if (hoursData.length === 0)
1385
1366
  return [];
1386
1367
  const activePart = this.getActivePartsWithFallback();
1387
- return (h("ion-picker-column-internal", { color: this.color, value: activePart.hour, items: hoursData, numericInput: true, onIonChange: (ev) => {
1368
+ return (h("ion-picker-column-internal", { color: this.color, disabled: disabled, value: activePart.hour, items: hoursData, numericInput: true, onIonChange: (ev) => {
1388
1369
  this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { hour: ev.detail.value }));
1389
1370
  this.setActiveParts(Object.assign(Object.assign({}, activePart), { hour: ev.detail.value }));
1390
1371
  ev.stopPropagation();
1391
1372
  } }));
1392
1373
  }
1393
1374
  renderMinutePickerColumn(minutesData) {
1394
- const { workingParts } = this;
1375
+ const { disabled, workingParts } = this;
1395
1376
  if (minutesData.length === 0)
1396
1377
  return [];
1397
1378
  const activePart = this.getActivePartsWithFallback();
1398
- return (h("ion-picker-column-internal", { color: this.color, value: activePart.minute, items: minutesData, numericInput: true, onIonChange: (ev) => {
1379
+ return (h("ion-picker-column-internal", { color: this.color, disabled: disabled, value: activePart.minute, items: minutesData, numericInput: true, onIonChange: (ev) => {
1399
1380
  this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { minute: ev.detail.value }));
1400
1381
  this.setActiveParts(Object.assign(Object.assign({}, activePart), { minute: ev.detail.value }));
1401
1382
  ev.stopPropagation();
1402
1383
  } }));
1403
1384
  }
1404
1385
  renderDayPeriodPickerColumn(dayPeriodData) {
1405
- const { workingParts } = this;
1386
+ const { disabled, workingParts } = this;
1406
1387
  if (dayPeriodData.length === 0) {
1407
1388
  return [];
1408
1389
  }
1409
1390
  const activePart = this.getActivePartsWithFallback();
1410
1391
  const isDayPeriodRTL = isLocaleDayPeriodRTL(this.locale);
1411
- return (h("ion-picker-column-internal", { style: isDayPeriodRTL ? { order: '-1' } : {}, color: this.color, value: activePart.ampm, items: dayPeriodData, onIonChange: (ev) => {
1392
+ return (h("ion-picker-column-internal", { style: isDayPeriodRTL ? { order: '-1' } : {}, color: this.color, disabled: disabled, value: activePart.ampm, items: dayPeriodData, onIonChange: (ev) => {
1412
1393
  const hour = calculateHourFromAMPM(workingParts, ev.detail.value);
1413
1394
  this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { ampm: ev.detail.value, hour }));
1414
1395
  this.setActiveParts(Object.assign(Object.assign({}, activePart), { ampm: ev.detail.value, hour }));