@ionic/core 8.5.2-nightly.20250326 → 8.5.2

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.
@@ -1429,7 +1429,7 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
1429
1429
  const activePart = this.getActivePartsWithFallback();
1430
1430
  return (h("ion-picker-column", { "aria-label": "Select an hour", color: this.color, disabled: disabled, value: activePart.hour, numericInput: true, onIonChange: (ev) => {
1431
1431
  this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { hour: ev.detail.value }));
1432
- this.setActiveParts(Object.assign(Object.assign({}, activePart), { hour: ev.detail.value }));
1432
+ this.setActiveParts(Object.assign(Object.assign({}, this.getActivePartsWithFallback()), { hour: ev.detail.value }));
1433
1433
  ev.stopPropagation();
1434
1434
  } }, hoursData.map((hour) => (h("ion-picker-column-option", { part: hour.value === activePart.hour ? `${WHEEL_ITEM_PART} ${WHEEL_ITEM_ACTIVE_PART}` : WHEEL_ITEM_PART, key: hour.value, disabled: hour.disabled, value: hour.value }, hour.text)))));
1435
1435
  }
@@ -1440,7 +1440,7 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
1440
1440
  const activePart = this.getActivePartsWithFallback();
1441
1441
  return (h("ion-picker-column", { "aria-label": "Select a minute", color: this.color, disabled: disabled, value: activePart.minute, numericInput: true, onIonChange: (ev) => {
1442
1442
  this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { minute: ev.detail.value }));
1443
- this.setActiveParts(Object.assign(Object.assign({}, activePart), { minute: ev.detail.value }));
1443
+ this.setActiveParts(Object.assign(Object.assign({}, this.getActivePartsWithFallback()), { minute: ev.detail.value }));
1444
1444
  ev.stopPropagation();
1445
1445
  } }, minutesData.map((minute) => (h("ion-picker-column-option", { part: minute.value === activePart.minute ? `${WHEEL_ITEM_PART} ${WHEEL_ITEM_ACTIVE_PART}` : WHEEL_ITEM_PART, key: minute.value, disabled: minute.disabled, value: minute.value }, minute.text)))));
1446
1446
  }
@@ -1454,7 +1454,7 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
1454
1454
  return (h("ion-picker-column", { "aria-label": "Select a day period", style: isDayPeriodRTL ? { order: '-1' } : {}, color: this.color, disabled: disabled, value: activePart.ampm, onIonChange: (ev) => {
1455
1455
  const hour = calculateHourFromAMPM(workingParts, ev.detail.value);
1456
1456
  this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { ampm: ev.detail.value, hour }));
1457
- this.setActiveParts(Object.assign(Object.assign({}, activePart), { ampm: ev.detail.value, hour }));
1457
+ this.setActiveParts(Object.assign(Object.assign({}, this.getActivePartsWithFallback()), { ampm: ev.detail.value, hour }));
1458
1458
  ev.stopPropagation();
1459
1459
  } }, dayPeriodData.map((dayPeriod) => (h("ion-picker-column-option", { part: dayPeriod.value === activePart.ampm ? `${WHEEL_ITEM_PART} ${WHEEL_ITEM_ACTIVE_PART}` : WHEEL_ITEM_PART, key: dayPeriod.value, disabled: dayPeriod.disabled, value: dayPeriod.value }, dayPeriod.text)))));
1460
1460
  }
@@ -1761,7 +1761,7 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
1761
1761
  const hasDatePresentation = presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
1762
1762
  const hasWheelVariant = hasDatePresentation && preferWheel;
1763
1763
  renderHiddenInput(true, el, name, formatValue(value), disabled);
1764
- return (h(Host, { key: '7afbb1a7e6c78389b4588999779e5c90e010e85d', "aria-disabled": disabled ? 'true' : null, onFocus: this.onFocus, onBlur: this.onBlur, class: Object.assign({}, createColorClasses(color, {
1764
+ return (h(Host, { key: '08d429533a09c600b936ad1e022658051c765595', "aria-disabled": disabled ? 'true' : null, onFocus: this.onFocus, onBlur: this.onBlur, class: Object.assign({}, createColorClasses(color, {
1765
1765
  [mode]: true,
1766
1766
  ['datetime-readonly']: readonly,
1767
1767
  ['datetime-disabled']: disabled,
@@ -1771,7 +1771,7 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
1771
1771
  [`datetime-size-${size}`]: true,
1772
1772
  [`datetime-prefer-wheel`]: hasWheelVariant,
1773
1773
  [`datetime-grid`]: isGridStyle,
1774
- })) }, h("div", { key: '297c458d4d17154cb297e2ef5926505bcb2d1fce', class: "intersection-tracker", ref: (el) => (this.intersectionTrackerRef = el) }), this.renderDatetime(mode)));
1774
+ })) }, h("div", { key: 'f4ff0fcd1e059767a7ef14fcc76ebfd55d23a97b', class: "intersection-tracker", ref: (el) => (this.intersectionTrackerRef = el) }), this.renderDatetime(mode)));
1775
1775
  }
1776
1776
  get el() { return this; }
1777
1777
  static get watchers() { return {
@@ -321,13 +321,59 @@ const Picker = /*@__PURE__*/ proxyCustomElement(class Picker extends HTMLElement
321
321
  * or trailing zeros when looking at the item text.
322
322
  */
323
323
  this.searchColumn = (colEl, value, zeroBehavior = 'start') => {
324
+ if (!value) {
325
+ return false;
326
+ }
324
327
  const behavior = zeroBehavior === 'start' ? /^0+/ : /0$/;
328
+ value = value.replace(behavior, '');
325
329
  const option = Array.from(colEl.querySelectorAll('ion-picker-column-option')).find((el) => {
326
330
  return el.disabled !== true && el.textContent.replace(behavior, '') === value;
327
331
  });
328
332
  if (option) {
329
333
  colEl.setValue(option.value);
330
334
  }
335
+ return !!option;
336
+ };
337
+ /**
338
+ * Attempts to intelligently search the first and second
339
+ * column as if they're number columns for the provided numbers
340
+ * where the first two numbers are the first column
341
+ * and the last 2 are the last column. Tries to allow for the first
342
+ * number to be ignored for situations where typos occurred.
343
+ */
344
+ this.multiColumnSearch = (firstColumn, secondColumn, input) => {
345
+ if (input.length === 0) {
346
+ return;
347
+ }
348
+ const inputArray = input.split('');
349
+ const hourValue = inputArray.slice(0, 2).join('');
350
+ // Try to find a match for the first two digits in the first column
351
+ const foundHour = this.searchColumn(firstColumn, hourValue);
352
+ // If we have more than 2 digits and found a match for hours,
353
+ // use the remaining digits for the second column (minutes)
354
+ if (inputArray.length > 2 && foundHour) {
355
+ const minuteValue = inputArray.slice(2, 4).join('');
356
+ this.searchColumn(secondColumn, minuteValue);
357
+ }
358
+ // If we couldn't find a match for the two-digit hour, try single digit approaches
359
+ else if (!foundHour && inputArray.length >= 1) {
360
+ // First try the first digit as a single-digit hour
361
+ let singleDigitHour = inputArray[0];
362
+ let singleDigitFound = this.searchColumn(firstColumn, singleDigitHour);
363
+ // If that didn't work, try the second digit as a single-digit hour
364
+ // (handles case where user made a typo in the first digit, or they typed over themselves)
365
+ if (!singleDigitFound) {
366
+ inputArray.shift();
367
+ singleDigitHour = inputArray[0];
368
+ singleDigitFound = this.searchColumn(firstColumn, singleDigitHour);
369
+ }
370
+ // If we found a single-digit hour and have remaining digits,
371
+ // use up to 2 of the remaining digits for the second column
372
+ if (singleDigitFound && inputArray.length > 1) {
373
+ const remainingDigits = inputArray.slice(1, 3).join('');
374
+ this.searchColumn(secondColumn, remainingDigits);
375
+ }
376
+ }
331
377
  };
332
378
  this.selectMultiColumn = () => {
333
379
  const { inputEl, el } = this;
@@ -338,82 +384,13 @@ const Picker = /*@__PURE__*/ proxyCustomElement(class Picker extends HTMLElement
338
384
  const firstColumn = numericPickers[0];
339
385
  const lastColumn = numericPickers[1];
340
386
  let value = inputEl.value;
341
- let minuteValue;
342
- switch (value.length) {
343
- case 1:
344
- this.searchColumn(firstColumn, value);
345
- break;
346
- case 2:
347
- /**
348
- * If the first character is `0` or `1` it is
349
- * possible that users are trying to type `09`
350
- * or `11` into the hour field, so we should look
351
- * at that first.
352
- */
353
- const firstCharacter = inputEl.value.substring(0, 1);
354
- value = firstCharacter === '0' || firstCharacter === '1' ? inputEl.value : firstCharacter;
355
- this.searchColumn(firstColumn, value);
356
- /**
357
- * If only checked the first value,
358
- * we can check the second value
359
- * for a match in the minutes column
360
- */
361
- if (value.length === 1) {
362
- minuteValue = inputEl.value.substring(inputEl.value.length - 1);
363
- this.searchColumn(lastColumn, minuteValue, 'end');
364
- }
365
- break;
366
- case 3:
367
- /**
368
- * If the first character is `0` or `1` it is
369
- * possible that users are trying to type `09`
370
- * or `11` into the hour field, so we should look
371
- * at that first.
372
- */
373
- const firstCharacterAgain = inputEl.value.substring(0, 1);
374
- value =
375
- firstCharacterAgain === '0' || firstCharacterAgain === '1'
376
- ? inputEl.value.substring(0, 2)
377
- : firstCharacterAgain;
378
- this.searchColumn(firstColumn, value);
379
- /**
380
- * If only checked the first value,
381
- * we can check the second value
382
- * for a match in the minutes column
383
- */
384
- minuteValue = value.length === 1 ? inputEl.value.substring(1) : inputEl.value.substring(2);
385
- this.searchColumn(lastColumn, minuteValue, 'end');
386
- break;
387
- case 4:
388
- /**
389
- * If the first character is `0` or `1` it is
390
- * possible that users are trying to type `09`
391
- * or `11` into the hour field, so we should look
392
- * at that first.
393
- */
394
- const firstCharacterAgainAgain = inputEl.value.substring(0, 1);
395
- value =
396
- firstCharacterAgainAgain === '0' || firstCharacterAgainAgain === '1'
397
- ? inputEl.value.substring(0, 2)
398
- : firstCharacterAgainAgain;
399
- this.searchColumn(firstColumn, value);
400
- /**
401
- * If only checked the first value,
402
- * we can check the second value
403
- * for a match in the minutes column
404
- */
405
- const minuteValueAgain = value.length === 1
406
- ? inputEl.value.substring(1, inputEl.value.length)
407
- : inputEl.value.substring(2, inputEl.value.length);
408
- this.searchColumn(lastColumn, minuteValueAgain, 'end');
409
- break;
410
- default:
411
- const startIndex = inputEl.value.length - 4;
412
- const newString = inputEl.value.substring(startIndex);
413
- inputEl.value = newString;
414
- this.selectMultiColumn();
415
- break;
387
+ if (value.length > 4) {
388
+ const startIndex = inputEl.value.length - 4;
389
+ const newString = inputEl.value.substring(startIndex);
390
+ inputEl.value = newString;
391
+ value = newString;
416
392
  }
393
+ this.multiColumnSearch(firstColumn, lastColumn, value);
417
394
  };
418
395
  /**
419
396
  * Searches the value of the active column
@@ -482,7 +459,7 @@ const Picker = /*@__PURE__*/ proxyCustomElement(class Picker extends HTMLElement
482
459
  this.emitInputModeChange();
483
460
  }
484
461
  render() {
485
- return (h(Host, { key: 'f92214a09dc85b65873676f40fde2b802960e704', onPointerDown: (ev) => this.onPointerDown(ev), onClick: () => this.onClick() }, h("input", { key: '6da37f75aca4ea1c9cb3bc733ebda2116279f313', "aria-hidden": "true", tabindex: -1, inputmode: "numeric", type: "number", onKeyDown: (ev) => {
462
+ return (h(Host, { key: '28f81e4ed44a633178561757c5199c2c98f94b74', onPointerDown: (ev) => this.onPointerDown(ev), onClick: () => this.onClick() }, h("input", { key: 'abb3d1ad25ef63856af7804111175a4d50008bc0', "aria-hidden": "true", tabindex: -1, inputmode: "numeric", type: "number", onKeyDown: (ev) => {
486
463
  var _a;
487
464
  /**
488
465
  * The "Enter" key represents
@@ -497,7 +474,7 @@ const Picker = /*@__PURE__*/ proxyCustomElement(class Picker extends HTMLElement
497
474
  if (ev.key === 'Enter') {
498
475
  (_a = this.inputEl) === null || _a === void 0 ? void 0 : _a.blur();
499
476
  }
500
- }, ref: (el) => (this.inputEl = el), onInput: () => this.onInputChange(), onBlur: () => this.exitInputMode() }), h("div", { key: '298e99d83dd3f5bf2798150bab0bb4024af472fa', class: "picker-before" }), h("div", { key: 'ea578f04eb562a4dc6d6cc92de133dcb9fb7f42a', class: "picker-after" }), h("div", { key: '84567824956dfe967992a629904836ba8b75b3ec', class: "picker-highlight", ref: (el) => (this.highlightEl = el) }), h("slot", { key: 'df81f8fb90e1f649b608328034528f5c31c70c3b' })));
477
+ }, ref: (el) => (this.inputEl = el), onInput: () => this.onInputChange(), onBlur: () => this.exitInputMode() }), h("div", { key: '334a5abdc02e6b127c57177f626d7e4ff5526183', class: "picker-before" }), h("div", { key: 'ffd6271931129e88fc7c820e919d684899e420c5', class: "picker-after" }), h("div", { key: '78d1d95fd09e04f154ea59f24a1cece72c47ed7b', class: "picker-highlight", ref: (el) => (this.highlightEl = el) }), h("slot", { key: '0bd5b9f875d3c71f6cbbde2054baeb1b0a2e8cd5' })));
501
478
  }
502
479
  get el() { return this; }
503
480
  static get style() { return {
@@ -1431,7 +1431,7 @@ const Datetime = class {
1431
1431
  const activePart = this.getActivePartsWithFallback();
1432
1432
  return (index$1.h("ion-picker-column", { "aria-label": "Select an hour", color: this.color, disabled: disabled, value: activePart.hour, numericInput: true, onIonChange: (ev) => {
1433
1433
  this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { hour: ev.detail.value }));
1434
- this.setActiveParts(Object.assign(Object.assign({}, activePart), { hour: ev.detail.value }));
1434
+ this.setActiveParts(Object.assign(Object.assign({}, this.getActivePartsWithFallback()), { hour: ev.detail.value }));
1435
1435
  ev.stopPropagation();
1436
1436
  } }, hoursData.map((hour) => (index$1.h("ion-picker-column-option", { part: hour.value === activePart.hour ? `${WHEEL_ITEM_PART} ${WHEEL_ITEM_ACTIVE_PART}` : WHEEL_ITEM_PART, key: hour.value, disabled: hour.disabled, value: hour.value }, hour.text)))));
1437
1437
  }
@@ -1442,7 +1442,7 @@ const Datetime = class {
1442
1442
  const activePart = this.getActivePartsWithFallback();
1443
1443
  return (index$1.h("ion-picker-column", { "aria-label": "Select a minute", color: this.color, disabled: disabled, value: activePart.minute, numericInput: true, onIonChange: (ev) => {
1444
1444
  this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { minute: ev.detail.value }));
1445
- this.setActiveParts(Object.assign(Object.assign({}, activePart), { minute: ev.detail.value }));
1445
+ this.setActiveParts(Object.assign(Object.assign({}, this.getActivePartsWithFallback()), { minute: ev.detail.value }));
1446
1446
  ev.stopPropagation();
1447
1447
  } }, minutesData.map((minute) => (index$1.h("ion-picker-column-option", { part: minute.value === activePart.minute ? `${WHEEL_ITEM_PART} ${WHEEL_ITEM_ACTIVE_PART}` : WHEEL_ITEM_PART, key: minute.value, disabled: minute.disabled, value: minute.value }, minute.text)))));
1448
1448
  }
@@ -1456,7 +1456,7 @@ const Datetime = class {
1456
1456
  return (index$1.h("ion-picker-column", { "aria-label": "Select a day period", style: isDayPeriodRTL ? { order: '-1' } : {}, color: this.color, disabled: disabled, value: activePart.ampm, onIonChange: (ev) => {
1457
1457
  const hour = data.calculateHourFromAMPM(workingParts, ev.detail.value);
1458
1458
  this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { ampm: ev.detail.value, hour }));
1459
- this.setActiveParts(Object.assign(Object.assign({}, activePart), { ampm: ev.detail.value, hour }));
1459
+ this.setActiveParts(Object.assign(Object.assign({}, this.getActivePartsWithFallback()), { ampm: ev.detail.value, hour }));
1460
1460
  ev.stopPropagation();
1461
1461
  } }, dayPeriodData.map((dayPeriod) => (index$1.h("ion-picker-column-option", { part: dayPeriod.value === activePart.ampm ? `${WHEEL_ITEM_PART} ${WHEEL_ITEM_ACTIVE_PART}` : WHEEL_ITEM_PART, key: dayPeriod.value, disabled: dayPeriod.disabled, value: dayPeriod.value }, dayPeriod.text)))));
1462
1462
  }
@@ -1763,7 +1763,7 @@ const Datetime = class {
1763
1763
  const hasDatePresentation = presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
1764
1764
  const hasWheelVariant = hasDatePresentation && preferWheel;
1765
1765
  helpers.renderHiddenInput(true, el, name, data.formatValue(value), disabled);
1766
- return (index$1.h(index$1.Host, { key: '7afbb1a7e6c78389b4588999779e5c90e010e85d', "aria-disabled": disabled ? 'true' : null, onFocus: this.onFocus, onBlur: this.onBlur, class: Object.assign({}, theme.createColorClasses(color, {
1766
+ return (index$1.h(index$1.Host, { key: '08d429533a09c600b936ad1e022658051c765595', "aria-disabled": disabled ? 'true' : null, onFocus: this.onFocus, onBlur: this.onBlur, class: Object.assign({}, theme.createColorClasses(color, {
1767
1767
  [mode]: true,
1768
1768
  ['datetime-readonly']: readonly,
1769
1769
  ['datetime-disabled']: disabled,
@@ -1773,7 +1773,7 @@ const Datetime = class {
1773
1773
  [`datetime-size-${size}`]: true,
1774
1774
  [`datetime-prefer-wheel`]: hasWheelVariant,
1775
1775
  [`datetime-grid`]: isGridStyle,
1776
- })) }, index$1.h("div", { key: '297c458d4d17154cb297e2ef5926505bcb2d1fce', class: "intersection-tracker", ref: (el) => (this.intersectionTrackerRef = el) }), this.renderDatetime(mode)));
1776
+ })) }, index$1.h("div", { key: 'f4ff0fcd1e059767a7ef14fcc76ebfd55d23a97b', class: "intersection-tracker", ref: (el) => (this.intersectionTrackerRef = el) }), this.renderDatetime(mode)));
1777
1777
  }
1778
1778
  get el() { return index$1.getElement(this); }
1779
1779
  static get watchers() { return {
@@ -323,13 +323,59 @@ const Picker = class {
323
323
  * or trailing zeros when looking at the item text.
324
324
  */
325
325
  this.searchColumn = (colEl, value, zeroBehavior = 'start') => {
326
+ if (!value) {
327
+ return false;
328
+ }
326
329
  const behavior = zeroBehavior === 'start' ? /^0+/ : /0$/;
330
+ value = value.replace(behavior, '');
327
331
  const option = Array.from(colEl.querySelectorAll('ion-picker-column-option')).find((el) => {
328
332
  return el.disabled !== true && el.textContent.replace(behavior, '') === value;
329
333
  });
330
334
  if (option) {
331
335
  colEl.setValue(option.value);
332
336
  }
337
+ return !!option;
338
+ };
339
+ /**
340
+ * Attempts to intelligently search the first and second
341
+ * column as if they're number columns for the provided numbers
342
+ * where the first two numbers are the first column
343
+ * and the last 2 are the last column. Tries to allow for the first
344
+ * number to be ignored for situations where typos occurred.
345
+ */
346
+ this.multiColumnSearch = (firstColumn, secondColumn, input) => {
347
+ if (input.length === 0) {
348
+ return;
349
+ }
350
+ const inputArray = input.split('');
351
+ const hourValue = inputArray.slice(0, 2).join('');
352
+ // Try to find a match for the first two digits in the first column
353
+ const foundHour = this.searchColumn(firstColumn, hourValue);
354
+ // If we have more than 2 digits and found a match for hours,
355
+ // use the remaining digits for the second column (minutes)
356
+ if (inputArray.length > 2 && foundHour) {
357
+ const minuteValue = inputArray.slice(2, 4).join('');
358
+ this.searchColumn(secondColumn, minuteValue);
359
+ }
360
+ // If we couldn't find a match for the two-digit hour, try single digit approaches
361
+ else if (!foundHour && inputArray.length >= 1) {
362
+ // First try the first digit as a single-digit hour
363
+ let singleDigitHour = inputArray[0];
364
+ let singleDigitFound = this.searchColumn(firstColumn, singleDigitHour);
365
+ // If that didn't work, try the second digit as a single-digit hour
366
+ // (handles case where user made a typo in the first digit, or they typed over themselves)
367
+ if (!singleDigitFound) {
368
+ inputArray.shift();
369
+ singleDigitHour = inputArray[0];
370
+ singleDigitFound = this.searchColumn(firstColumn, singleDigitHour);
371
+ }
372
+ // If we found a single-digit hour and have remaining digits,
373
+ // use up to 2 of the remaining digits for the second column
374
+ if (singleDigitFound && inputArray.length > 1) {
375
+ const remainingDigits = inputArray.slice(1, 3).join('');
376
+ this.searchColumn(secondColumn, remainingDigits);
377
+ }
378
+ }
333
379
  };
334
380
  this.selectMultiColumn = () => {
335
381
  const { inputEl, el } = this;
@@ -340,82 +386,13 @@ const Picker = class {
340
386
  const firstColumn = numericPickers[0];
341
387
  const lastColumn = numericPickers[1];
342
388
  let value = inputEl.value;
343
- let minuteValue;
344
- switch (value.length) {
345
- case 1:
346
- this.searchColumn(firstColumn, value);
347
- break;
348
- case 2:
349
- /**
350
- * If the first character is `0` or `1` it is
351
- * possible that users are trying to type `09`
352
- * or `11` into the hour field, so we should look
353
- * at that first.
354
- */
355
- const firstCharacter = inputEl.value.substring(0, 1);
356
- value = firstCharacter === '0' || firstCharacter === '1' ? inputEl.value : firstCharacter;
357
- this.searchColumn(firstColumn, value);
358
- /**
359
- * If only checked the first value,
360
- * we can check the second value
361
- * for a match in the minutes column
362
- */
363
- if (value.length === 1) {
364
- minuteValue = inputEl.value.substring(inputEl.value.length - 1);
365
- this.searchColumn(lastColumn, minuteValue, 'end');
366
- }
367
- break;
368
- case 3:
369
- /**
370
- * If the first character is `0` or `1` it is
371
- * possible that users are trying to type `09`
372
- * or `11` into the hour field, so we should look
373
- * at that first.
374
- */
375
- const firstCharacterAgain = inputEl.value.substring(0, 1);
376
- value =
377
- firstCharacterAgain === '0' || firstCharacterAgain === '1'
378
- ? inputEl.value.substring(0, 2)
379
- : firstCharacterAgain;
380
- this.searchColumn(firstColumn, value);
381
- /**
382
- * If only checked the first value,
383
- * we can check the second value
384
- * for a match in the minutes column
385
- */
386
- minuteValue = value.length === 1 ? inputEl.value.substring(1) : inputEl.value.substring(2);
387
- this.searchColumn(lastColumn, minuteValue, 'end');
388
- break;
389
- case 4:
390
- /**
391
- * If the first character is `0` or `1` it is
392
- * possible that users are trying to type `09`
393
- * or `11` into the hour field, so we should look
394
- * at that first.
395
- */
396
- const firstCharacterAgainAgain = inputEl.value.substring(0, 1);
397
- value =
398
- firstCharacterAgainAgain === '0' || firstCharacterAgainAgain === '1'
399
- ? inputEl.value.substring(0, 2)
400
- : firstCharacterAgainAgain;
401
- this.searchColumn(firstColumn, value);
402
- /**
403
- * If only checked the first value,
404
- * we can check the second value
405
- * for a match in the minutes column
406
- */
407
- const minuteValueAgain = value.length === 1
408
- ? inputEl.value.substring(1, inputEl.value.length)
409
- : inputEl.value.substring(2, inputEl.value.length);
410
- this.searchColumn(lastColumn, minuteValueAgain, 'end');
411
- break;
412
- default:
413
- const startIndex = inputEl.value.length - 4;
414
- const newString = inputEl.value.substring(startIndex);
415
- inputEl.value = newString;
416
- this.selectMultiColumn();
417
- break;
389
+ if (value.length > 4) {
390
+ const startIndex = inputEl.value.length - 4;
391
+ const newString = inputEl.value.substring(startIndex);
392
+ inputEl.value = newString;
393
+ value = newString;
418
394
  }
395
+ this.multiColumnSearch(firstColumn, lastColumn, value);
419
396
  };
420
397
  /**
421
398
  * Searches the value of the active column
@@ -484,7 +461,7 @@ const Picker = class {
484
461
  this.emitInputModeChange();
485
462
  }
486
463
  render() {
487
- return (index.h(index.Host, { key: 'f92214a09dc85b65873676f40fde2b802960e704', onPointerDown: (ev) => this.onPointerDown(ev), onClick: () => this.onClick() }, index.h("input", { key: '6da37f75aca4ea1c9cb3bc733ebda2116279f313', "aria-hidden": "true", tabindex: -1, inputmode: "numeric", type: "number", onKeyDown: (ev) => {
464
+ return (index.h(index.Host, { key: '28f81e4ed44a633178561757c5199c2c98f94b74', onPointerDown: (ev) => this.onPointerDown(ev), onClick: () => this.onClick() }, index.h("input", { key: 'abb3d1ad25ef63856af7804111175a4d50008bc0', "aria-hidden": "true", tabindex: -1, inputmode: "numeric", type: "number", onKeyDown: (ev) => {
488
465
  var _a;
489
466
  /**
490
467
  * The "Enter" key represents
@@ -499,7 +476,7 @@ const Picker = class {
499
476
  if (ev.key === 'Enter') {
500
477
  (_a = this.inputEl) === null || _a === void 0 ? void 0 : _a.blur();
501
478
  }
502
- }, ref: (el) => (this.inputEl = el), onInput: () => this.onInputChange(), onBlur: () => this.exitInputMode() }), index.h("div", { key: '298e99d83dd3f5bf2798150bab0bb4024af472fa', class: "picker-before" }), index.h("div", { key: 'ea578f04eb562a4dc6d6cc92de133dcb9fb7f42a', class: "picker-after" }), index.h("div", { key: '84567824956dfe967992a629904836ba8b75b3ec', class: "picker-highlight", ref: (el) => (this.highlightEl = el) }), index.h("slot", { key: 'df81f8fb90e1f649b608328034528f5c31c70c3b' })));
479
+ }, ref: (el) => (this.inputEl = el), onInput: () => this.onInputChange(), onBlur: () => this.exitInputMode() }), index.h("div", { key: '334a5abdc02e6b127c57177f626d7e4ff5526183', class: "picker-before" }), index.h("div", { key: 'ffd6271931129e88fc7c820e919d684899e420c5', class: "picker-after" }), index.h("div", { key: '78d1d95fd09e04f154ea59f24a1cece72c47ed7b', class: "picker-highlight", ref: (el) => (this.highlightEl = el) }), index.h("slot", { key: '0bd5b9f875d3c71f6cbbde2054baeb1b0a2e8cd5' })));
503
480
  }
504
481
  get el() { return index.getElement(this); }
505
482
  };
@@ -1225,7 +1225,7 @@ export class Datetime {
1225
1225
  const activePart = this.getActivePartsWithFallback();
1226
1226
  return (h("ion-picker-column", { "aria-label": "Select an hour", color: this.color, disabled: disabled, value: activePart.hour, numericInput: true, onIonChange: (ev) => {
1227
1227
  this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { hour: ev.detail.value }));
1228
- this.setActiveParts(Object.assign(Object.assign({}, activePart), { hour: ev.detail.value }));
1228
+ this.setActiveParts(Object.assign(Object.assign({}, this.getActivePartsWithFallback()), { hour: ev.detail.value }));
1229
1229
  ev.stopPropagation();
1230
1230
  } }, hoursData.map((hour) => (h("ion-picker-column-option", { part: hour.value === activePart.hour ? `${WHEEL_ITEM_PART} ${WHEEL_ITEM_ACTIVE_PART}` : WHEEL_ITEM_PART, key: hour.value, disabled: hour.disabled, value: hour.value }, hour.text)))));
1231
1231
  }
@@ -1236,7 +1236,7 @@ export class Datetime {
1236
1236
  const activePart = this.getActivePartsWithFallback();
1237
1237
  return (h("ion-picker-column", { "aria-label": "Select a minute", color: this.color, disabled: disabled, value: activePart.minute, numericInput: true, onIonChange: (ev) => {
1238
1238
  this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { minute: ev.detail.value }));
1239
- this.setActiveParts(Object.assign(Object.assign({}, activePart), { minute: ev.detail.value }));
1239
+ this.setActiveParts(Object.assign(Object.assign({}, this.getActivePartsWithFallback()), { minute: ev.detail.value }));
1240
1240
  ev.stopPropagation();
1241
1241
  } }, minutesData.map((minute) => (h("ion-picker-column-option", { part: minute.value === activePart.minute ? `${WHEEL_ITEM_PART} ${WHEEL_ITEM_ACTIVE_PART}` : WHEEL_ITEM_PART, key: minute.value, disabled: minute.disabled, value: minute.value }, minute.text)))));
1242
1242
  }
@@ -1250,7 +1250,7 @@ export class Datetime {
1250
1250
  return (h("ion-picker-column", { "aria-label": "Select a day period", style: isDayPeriodRTL ? { order: '-1' } : {}, color: this.color, disabled: disabled, value: activePart.ampm, onIonChange: (ev) => {
1251
1251
  const hour = calculateHourFromAMPM(workingParts, ev.detail.value);
1252
1252
  this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { ampm: ev.detail.value, hour }));
1253
- this.setActiveParts(Object.assign(Object.assign({}, activePart), { ampm: ev.detail.value, hour }));
1253
+ this.setActiveParts(Object.assign(Object.assign({}, this.getActivePartsWithFallback()), { ampm: ev.detail.value, hour }));
1254
1254
  ev.stopPropagation();
1255
1255
  } }, dayPeriodData.map((dayPeriod) => (h("ion-picker-column-option", { part: dayPeriod.value === activePart.ampm ? `${WHEEL_ITEM_PART} ${WHEEL_ITEM_ACTIVE_PART}` : WHEEL_ITEM_PART, key: dayPeriod.value, disabled: dayPeriod.disabled, value: dayPeriod.value }, dayPeriod.text)))));
1256
1256
  }
@@ -1557,7 +1557,7 @@ export class Datetime {
1557
1557
  const hasDatePresentation = presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
1558
1558
  const hasWheelVariant = hasDatePresentation && preferWheel;
1559
1559
  renderHiddenInput(true, el, name, formatValue(value), disabled);
1560
- return (h(Host, { key: '7afbb1a7e6c78389b4588999779e5c90e010e85d', "aria-disabled": disabled ? 'true' : null, onFocus: this.onFocus, onBlur: this.onBlur, class: Object.assign({}, createColorClasses(color, {
1560
+ return (h(Host, { key: '08d429533a09c600b936ad1e022658051c765595', "aria-disabled": disabled ? 'true' : null, onFocus: this.onFocus, onBlur: this.onBlur, class: Object.assign({}, createColorClasses(color, {
1561
1561
  [mode]: true,
1562
1562
  ['datetime-readonly']: readonly,
1563
1563
  ['datetime-disabled']: disabled,
@@ -1567,7 +1567,7 @@ export class Datetime {
1567
1567
  [`datetime-size-${size}`]: true,
1568
1568
  [`datetime-prefer-wheel`]: hasWheelVariant,
1569
1569
  [`datetime-grid`]: isGridStyle,
1570
- })) }, h("div", { key: '297c458d4d17154cb297e2ef5926505bcb2d1fce', class: "intersection-tracker", ref: (el) => (this.intersectionTrackerRef = el) }), this.renderDatetime(mode)));
1570
+ })) }, h("div", { key: 'f4ff0fcd1e059767a7ef14fcc76ebfd55d23a97b', class: "intersection-tracker", ref: (el) => (this.intersectionTrackerRef = el) }), this.renderDatetime(mode)));
1571
1571
  }
1572
1572
  static get is() { return "ion-datetime"; }
1573
1573
  static get encapsulation() { return "shadow"; }
@@ -313,13 +313,59 @@ export class Picker {
313
313
  * or trailing zeros when looking at the item text.
314
314
  */
315
315
  this.searchColumn = (colEl, value, zeroBehavior = 'start') => {
316
+ if (!value) {
317
+ return false;
318
+ }
316
319
  const behavior = zeroBehavior === 'start' ? /^0+/ : /0$/;
320
+ value = value.replace(behavior, '');
317
321
  const option = Array.from(colEl.querySelectorAll('ion-picker-column-option')).find((el) => {
318
322
  return el.disabled !== true && el.textContent.replace(behavior, '') === value;
319
323
  });
320
324
  if (option) {
321
325
  colEl.setValue(option.value);
322
326
  }
327
+ return !!option;
328
+ };
329
+ /**
330
+ * Attempts to intelligently search the first and second
331
+ * column as if they're number columns for the provided numbers
332
+ * where the first two numbers are the first column
333
+ * and the last 2 are the last column. Tries to allow for the first
334
+ * number to be ignored for situations where typos occurred.
335
+ */
336
+ this.multiColumnSearch = (firstColumn, secondColumn, input) => {
337
+ if (input.length === 0) {
338
+ return;
339
+ }
340
+ const inputArray = input.split('');
341
+ const hourValue = inputArray.slice(0, 2).join('');
342
+ // Try to find a match for the first two digits in the first column
343
+ const foundHour = this.searchColumn(firstColumn, hourValue);
344
+ // If we have more than 2 digits and found a match for hours,
345
+ // use the remaining digits for the second column (minutes)
346
+ if (inputArray.length > 2 && foundHour) {
347
+ const minuteValue = inputArray.slice(2, 4).join('');
348
+ this.searchColumn(secondColumn, minuteValue);
349
+ }
350
+ // If we couldn't find a match for the two-digit hour, try single digit approaches
351
+ else if (!foundHour && inputArray.length >= 1) {
352
+ // First try the first digit as a single-digit hour
353
+ let singleDigitHour = inputArray[0];
354
+ let singleDigitFound = this.searchColumn(firstColumn, singleDigitHour);
355
+ // If that didn't work, try the second digit as a single-digit hour
356
+ // (handles case where user made a typo in the first digit, or they typed over themselves)
357
+ if (!singleDigitFound) {
358
+ inputArray.shift();
359
+ singleDigitHour = inputArray[0];
360
+ singleDigitFound = this.searchColumn(firstColumn, singleDigitHour);
361
+ }
362
+ // If we found a single-digit hour and have remaining digits,
363
+ // use up to 2 of the remaining digits for the second column
364
+ if (singleDigitFound && inputArray.length > 1) {
365
+ const remainingDigits = inputArray.slice(1, 3).join('');
366
+ this.searchColumn(secondColumn, remainingDigits);
367
+ }
368
+ }
323
369
  };
324
370
  this.selectMultiColumn = () => {
325
371
  const { inputEl, el } = this;
@@ -330,82 +376,13 @@ export class Picker {
330
376
  const firstColumn = numericPickers[0];
331
377
  const lastColumn = numericPickers[1];
332
378
  let value = inputEl.value;
333
- let minuteValue;
334
- switch (value.length) {
335
- case 1:
336
- this.searchColumn(firstColumn, value);
337
- break;
338
- case 2:
339
- /**
340
- * If the first character is `0` or `1` it is
341
- * possible that users are trying to type `09`
342
- * or `11` into the hour field, so we should look
343
- * at that first.
344
- */
345
- const firstCharacter = inputEl.value.substring(0, 1);
346
- value = firstCharacter === '0' || firstCharacter === '1' ? inputEl.value : firstCharacter;
347
- this.searchColumn(firstColumn, value);
348
- /**
349
- * If only checked the first value,
350
- * we can check the second value
351
- * for a match in the minutes column
352
- */
353
- if (value.length === 1) {
354
- minuteValue = inputEl.value.substring(inputEl.value.length - 1);
355
- this.searchColumn(lastColumn, minuteValue, 'end');
356
- }
357
- break;
358
- case 3:
359
- /**
360
- * If the first character is `0` or `1` it is
361
- * possible that users are trying to type `09`
362
- * or `11` into the hour field, so we should look
363
- * at that first.
364
- */
365
- const firstCharacterAgain = inputEl.value.substring(0, 1);
366
- value =
367
- firstCharacterAgain === '0' || firstCharacterAgain === '1'
368
- ? inputEl.value.substring(0, 2)
369
- : firstCharacterAgain;
370
- this.searchColumn(firstColumn, value);
371
- /**
372
- * If only checked the first value,
373
- * we can check the second value
374
- * for a match in the minutes column
375
- */
376
- minuteValue = value.length === 1 ? inputEl.value.substring(1) : inputEl.value.substring(2);
377
- this.searchColumn(lastColumn, minuteValue, 'end');
378
- break;
379
- case 4:
380
- /**
381
- * If the first character is `0` or `1` it is
382
- * possible that users are trying to type `09`
383
- * or `11` into the hour field, so we should look
384
- * at that first.
385
- */
386
- const firstCharacterAgainAgain = inputEl.value.substring(0, 1);
387
- value =
388
- firstCharacterAgainAgain === '0' || firstCharacterAgainAgain === '1'
389
- ? inputEl.value.substring(0, 2)
390
- : firstCharacterAgainAgain;
391
- this.searchColumn(firstColumn, value);
392
- /**
393
- * If only checked the first value,
394
- * we can check the second value
395
- * for a match in the minutes column
396
- */
397
- const minuteValueAgain = value.length === 1
398
- ? inputEl.value.substring(1, inputEl.value.length)
399
- : inputEl.value.substring(2, inputEl.value.length);
400
- this.searchColumn(lastColumn, minuteValueAgain, 'end');
401
- break;
402
- default:
403
- const startIndex = inputEl.value.length - 4;
404
- const newString = inputEl.value.substring(startIndex);
405
- inputEl.value = newString;
406
- this.selectMultiColumn();
407
- break;
379
+ if (value.length > 4) {
380
+ const startIndex = inputEl.value.length - 4;
381
+ const newString = inputEl.value.substring(startIndex);
382
+ inputEl.value = newString;
383
+ value = newString;
408
384
  }
385
+ this.multiColumnSearch(firstColumn, lastColumn, value);
409
386
  };
410
387
  /**
411
388
  * Searches the value of the active column
@@ -474,7 +451,7 @@ export class Picker {
474
451
  this.emitInputModeChange();
475
452
  }
476
453
  render() {
477
- return (h(Host, { key: 'f92214a09dc85b65873676f40fde2b802960e704', onPointerDown: (ev) => this.onPointerDown(ev), onClick: () => this.onClick() }, h("input", { key: '6da37f75aca4ea1c9cb3bc733ebda2116279f313', "aria-hidden": "true", tabindex: -1, inputmode: "numeric", type: "number", onKeyDown: (ev) => {
454
+ return (h(Host, { key: '28f81e4ed44a633178561757c5199c2c98f94b74', onPointerDown: (ev) => this.onPointerDown(ev), onClick: () => this.onClick() }, h("input", { key: 'abb3d1ad25ef63856af7804111175a4d50008bc0', "aria-hidden": "true", tabindex: -1, inputmode: "numeric", type: "number", onKeyDown: (ev) => {
478
455
  var _a;
479
456
  /**
480
457
  * The "Enter" key represents
@@ -489,7 +466,7 @@ export class Picker {
489
466
  if (ev.key === 'Enter') {
490
467
  (_a = this.inputEl) === null || _a === void 0 ? void 0 : _a.blur();
491
468
  }
492
- }, ref: (el) => (this.inputEl = el), onInput: () => this.onInputChange(), onBlur: () => this.exitInputMode() }), h("div", { key: '298e99d83dd3f5bf2798150bab0bb4024af472fa', class: "picker-before" }), h("div", { key: 'ea578f04eb562a4dc6d6cc92de133dcb9fb7f42a', class: "picker-after" }), h("div", { key: '84567824956dfe967992a629904836ba8b75b3ec', class: "picker-highlight", ref: (el) => (this.highlightEl = el) }), h("slot", { key: 'df81f8fb90e1f649b608328034528f5c31c70c3b' })));
469
+ }, ref: (el) => (this.inputEl = el), onInput: () => this.onInputChange(), onBlur: () => this.exitInputMode() }), h("div", { key: '334a5abdc02e6b127c57177f626d7e4ff5526183', class: "picker-before" }), h("div", { key: 'ffd6271931129e88fc7c820e919d684899e420c5', class: "picker-after" }), h("div", { key: '78d1d95fd09e04f154ea59f24a1cece72c47ed7b', class: "picker-highlight", ref: (el) => (this.highlightEl = el) }), h("slot", { key: '0bd5b9f875d3c71f6cbbde2054baeb1b0a2e8cd5' })));
493
470
  }
494
471
  static get is() { return "ion-picker"; }
495
472
  static get encapsulation() { return "shadow"; }