@ionic/core 8.6.4 → 8.6.5-dev.11752243397.18475074

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.
package/hydrate/index.mjs CHANGED
@@ -16980,6 +16980,7 @@ class InputOTP {
16980
16980
  this.isKeyboardNavigation = false;
16981
16981
  this.inputValues = [];
16982
16982
  this.hasFocus = false;
16983
+ this.previousInputValues = [];
16983
16984
  /**
16984
16985
  * Indicates whether and how the text value should be automatically capitalized as it is entered/edited by the user.
16985
16986
  * Available options: `"off"`, `"none"`, `"on"`, `"sentences"`, `"words"`, `"characters"`.
@@ -17080,19 +17081,12 @@ class InputOTP {
17080
17081
  }
17081
17082
  };
17082
17083
  /**
17083
- * Handles keyboard navigation and input for the OTP component.
17084
+ * Handles keyboard navigation for the OTP component.
17084
17085
  *
17085
17086
  * Navigation:
17086
17087
  * - Backspace: Clears current input and moves to previous box if empty
17087
17088
  * - Arrow Left/Right: Moves focus between input boxes
17088
17089
  * - Tab: Allows normal tab navigation between components
17089
- *
17090
- * Input Behavior:
17091
- * - Validates input against the allowed pattern
17092
- * - When entering a key in a filled box:
17093
- * - Shifts existing values right if there is room
17094
- * - Updates the value of the input group
17095
- * - Prevents default behavior to avoid automatic focus shift
17096
17090
  */
17097
17091
  this.onKeyDown = (index) => (event) => {
17098
17092
  const { length } = this;
@@ -17147,69 +17141,132 @@ class InputOTP {
17147
17141
  // Let all tab events proceed normally
17148
17142
  return;
17149
17143
  }
17150
- // If the input box contains a value and the key being
17151
- // entered is a valid key for the input box update the value
17152
- // and shift the values to the right if there is room.
17153
- if (this.inputValues[index] && this.validKeyPattern.test(event.key)) {
17154
- if (!this.inputValues[length - 1]) {
17155
- for (let i = length - 1; i > index; i--) {
17156
- this.inputValues[i] = this.inputValues[i - 1];
17157
- this.inputRefs[i].value = this.inputValues[i] || '';
17158
- }
17159
- }
17160
- this.inputValues[index] = event.key;
17161
- this.inputRefs[index].value = event.key;
17162
- this.updateValue(event);
17163
- // Prevent default to avoid the browser from
17164
- // automatically moving the focus to the next input
17165
- event.preventDefault();
17166
- }
17167
17144
  };
17145
+ /**
17146
+ * Processes all input scenarios for each input box.
17147
+ *
17148
+ * This function manages:
17149
+ * 1. Autofill handling
17150
+ * 2. Input validation
17151
+ * 3. Full selection replacement or typing in an empty box
17152
+ * 4. Inserting in the middle with available space (shifting)
17153
+ * 5. Single character replacement
17154
+ */
17168
17155
  this.onInput = (index) => (event) => {
17156
+ var _a, _b;
17169
17157
  const { length, validKeyPattern } = this;
17170
- const value = event.target.value;
17171
- // If the value is longer than 1 character (autofill), split it into
17172
- // characters and filter out invalid ones
17173
- if (value.length > 1) {
17158
+ const input = event.target;
17159
+ const value = input.value;
17160
+ const previousValue = this.previousInputValues[index] || '';
17161
+ // 1. Autofill handling
17162
+ // If the length of the value increases by more than 1 from the previous
17163
+ // value, treat this as autofill. This is to prevent the case where the
17164
+ // user is typing a single character into an input box containing a value
17165
+ // as that will trigger this function with a value length of 2 characters.
17166
+ const isAutofill = value.length - previousValue.length > 1;
17167
+ if (isAutofill) {
17168
+ // Distribute valid characters across input boxes
17174
17169
  const validChars = value
17175
17170
  .split('')
17176
17171
  .filter((char) => validKeyPattern.test(char))
17177
17172
  .slice(0, length);
17178
- // If there are no valid characters coming from the
17179
- // autofill, all input refs have to be cleared after the
17180
- // browser has finished the autofill behavior
17181
- if (validChars.length === 0) {
17182
- requestAnimationFrame(() => {
17183
- this.inputRefs.forEach((input) => {
17184
- input.value = '';
17185
- });
17186
- });
17173
+ for (let i = 0; i < length; i++) {
17174
+ this.inputValues[i] = validChars[i] || '';
17175
+ if (this.inputRefs[i] != null) {
17176
+ this.inputRefs[i].value = validChars[i] || '';
17177
+ }
17187
17178
  }
17188
- // Update the value of the input group and emit the input change event
17189
- this.value = validChars.join('');
17190
17179
  this.updateValue(event);
17191
- // Focus the first empty input box or the last input box if all boxes
17192
- // are filled after a small delay to ensure the input boxes have been
17193
- // updated before moving the focus
17180
+ // Focus the next empty input or the last one
17194
17181
  setTimeout(() => {
17195
- var _a;
17196
17182
  const nextIndex = validChars.length < length ? validChars.length : length - 1;
17197
- (_a = this.inputRefs[nextIndex]) === null || _a === void 0 ? void 0 : _a.focus();
17183
+ if (this.inputRefs[nextIndex] != null) {
17184
+ this.inputRefs[nextIndex].focus();
17185
+ }
17198
17186
  }, 20);
17187
+ this.previousInputValues = [...this.inputValues];
17199
17188
  return;
17200
17189
  }
17201
- // Only allow input if it matches the pattern
17202
- if (value.length > 0 && !validKeyPattern.test(value)) {
17203
- this.inputRefs[index].value = '';
17204
- this.inputValues[index] = '';
17190
+ // 2. Input validation
17191
+ // If the character entered is invalid (does not match the pattern),
17192
+ // restore the previous value and exit
17193
+ if (value.length > 0 && !validKeyPattern.test(value[value.length - 1])) {
17194
+ input.value = this.inputValues[index] || '';
17195
+ this.previousInputValues[index] = this.inputValues[index] || '';
17196
+ this.previousInputValues = [...this.inputValues];
17205
17197
  return;
17206
17198
  }
17207
- // For single character input, fill the current box
17208
- this.inputValues[index] = value;
17209
- this.updateValue(event);
17210
- if (value.length > 0) {
17199
+ // 3. Full selection replacement or typing in an empty box
17200
+ // If the user selects all text in the input box and types, or if the
17201
+ // input box is empty, replace only this input box. If the box is empty,
17202
+ // move to the next box, otherwise stay focused on this box.
17203
+ const isAllSelected = input.selectionStart === 0 && input.selectionEnd === value.length;
17204
+ const isEmpty = !this.inputValues[index];
17205
+ if (isAllSelected || isEmpty) {
17206
+ this.inputValues[index] = value;
17207
+ input.value = value;
17208
+ this.previousInputValues[index] = value;
17209
+ this.updateValue(event);
17211
17210
  this.focusNext(index);
17211
+ this.previousInputValues = [...this.inputValues];
17212
+ return;
17212
17213
  }
17214
+ // 4. Inserting in the middle with available space (shifting)
17215
+ // If typing in a filled input box and there are empty boxes at the end,
17216
+ // shift all values starting at the current box to the right, and insert
17217
+ // the new character at the current box.
17218
+ const hasAvailableBoxAtEnd = this.inputValues[this.inputValues.length - 1] === '';
17219
+ if (this.inputValues[index] && hasAvailableBoxAtEnd && value.length === 2) {
17220
+ // Get the inserted character (from event or by diffing value/previousValue)
17221
+ let newChar = event.data;
17222
+ if (!newChar) {
17223
+ newChar = value.split('').find((c, i) => c !== previousValue[i]) || value[value.length - 1];
17224
+ }
17225
+ // Validate the new character before shifting
17226
+ if (!validKeyPattern.test(newChar)) {
17227
+ input.value = this.inputValues[index] || '';
17228
+ this.previousInputValues[index] = this.inputValues[index] || '';
17229
+ this.previousInputValues = [...this.inputValues];
17230
+ return;
17231
+ }
17232
+ // Shift values right from the end to the insertion point
17233
+ for (let i = this.inputValues.length - 1; i > index; i--) {
17234
+ this.inputValues[i] = this.inputValues[i - 1];
17235
+ if (this.inputRefs[i] != null) {
17236
+ this.inputRefs[i].value = this.inputValues[i] || '';
17237
+ }
17238
+ }
17239
+ this.inputValues[index] = newChar;
17240
+ if (this.inputRefs[index] != null) {
17241
+ this.inputRefs[index].value = newChar;
17242
+ }
17243
+ this.previousInputValues[index] = newChar;
17244
+ this.updateValue(event);
17245
+ this.previousInputValues = [...this.inputValues];
17246
+ return;
17247
+ }
17248
+ // 5. Single character replacement
17249
+ // Handles replacing a single character in a box containing a value based
17250
+ // on the cursor position. We need the cursor position to determine which
17251
+ // character was the last character typed. For example, if the user types "2"
17252
+ // in an input box with the cursor at the beginning of the value of "6",
17253
+ // the value will be "26", but we want to grab the "2" as the last character
17254
+ // typed.
17255
+ const cursorPos = (_a = input.selectionStart) !== null && _a !== void 0 ? _a : value.length;
17256
+ const newCharIndex = cursorPos - 1;
17257
+ const newChar = (_b = value[newCharIndex]) !== null && _b !== void 0 ? _b : value[0];
17258
+ // Check if the new character is valid before updating the value
17259
+ if (!validKeyPattern.test(newChar)) {
17260
+ input.value = this.inputValues[index] || '';
17261
+ this.previousInputValues[index] = this.inputValues[index] || '';
17262
+ this.previousInputValues = [...this.inputValues];
17263
+ return;
17264
+ }
17265
+ input.value = newChar;
17266
+ this.inputValues[index] = newChar;
17267
+ this.previousInputValues[index] = newChar;
17268
+ this.updateValue(event);
17269
+ this.previousInputValues = [...this.inputValues];
17213
17270
  };
17214
17271
  /**
17215
17272
  * Handles pasting text into the input OTP component.
@@ -17219,7 +17276,7 @@ class InputOTP {
17219
17276
  * the next empty input after pasting.
17220
17277
  */
17221
17278
  this.onPaste = (event) => {
17222
- var _a, _b, _c;
17279
+ var _a, _b;
17223
17280
  const { inputRefs, length, validKeyPattern } = this;
17224
17281
  event.preventDefault();
17225
17282
  const pastedText = (_a = event.clipboardData) === null || _a === void 0 ? void 0 : _a.getData('text');
@@ -17246,13 +17303,8 @@ class InputOTP {
17246
17303
  this.updateValue(event);
17247
17304
  // Focus the next empty input after pasting
17248
17305
  // If all boxes are filled, focus the last input
17249
- const nextEmptyIndex = validChars.length;
17250
- if (nextEmptyIndex < length) {
17251
- (_b = inputRefs[nextEmptyIndex]) === null || _b === void 0 ? void 0 : _b.focus();
17252
- }
17253
- else {
17254
- (_c = inputRefs[length - 1]) === null || _c === void 0 ? void 0 : _c.focus();
17255
- }
17306
+ const nextEmptyIndex = validChars.length < length ? validChars.length : length - 1;
17307
+ (_b = inputRefs[nextEmptyIndex]) === null || _b === void 0 ? void 0 : _b.focus();
17256
17308
  };
17257
17309
  }
17258
17310
  /**
@@ -17391,6 +17443,7 @@ class InputOTP {
17391
17443
  });
17392
17444
  // Update the value without emitting events
17393
17445
  this.value = this.inputValues.join('');
17446
+ this.previousInputValues = [...this.inputValues];
17394
17447
  }
17395
17448
  /**
17396
17449
  * Updates the value of the input group.
@@ -17512,7 +17565,7 @@ class InputOTP {
17512
17565
  const tabbableIndex = this.getTabbableIndex();
17513
17566
  const pattern = this.getPattern();
17514
17567
  const hasDescription = ((_b = (_a = el.querySelector('.input-otp-description')) === null || _a === void 0 ? void 0 : _a.textContent) === null || _b === void 0 ? void 0 : _b.trim()) !== '';
17515
- return (hAsync(Host, { key: 'df8fca036cedea0812185a02e3b655d7d76285e0', class: createColorClasses$1(color, {
17568
+ return (hAsync(Host, { key: '084b4f7d148a55aef6b4b51c11483ee51d70d3bd', class: createColorClasses$1(color, {
17516
17569
  [mode]: true,
17517
17570
  'has-focus': hasFocus,
17518
17571
  [`input-otp-size-${size}`]: true,
@@ -17520,10 +17573,10 @@ class InputOTP {
17520
17573
  [`input-otp-fill-${fill}`]: true,
17521
17574
  'input-otp-disabled': disabled,
17522
17575
  'input-otp-readonly': readonly,
17523
- }) }, hAsync("div", Object.assign({ key: '831be3f939cf037f0eb8d7e37e0afd4ef9a3c2c5', role: "group", "aria-label": "One-time password input", class: "input-otp-group" }, inheritedAttributes), Array.from({ length }).map((_, index) => (hAsync(Fragment, null, hAsync("div", { class: "native-wrapper" }, hAsync("input", { class: "native-input", id: `${inputId}-${index}`, "aria-label": `Input ${index + 1} of ${length}`, type: "text", autoCapitalize: autocapitalize, inputmode: inputmode, pattern: pattern, disabled: disabled, readOnly: readonly, tabIndex: index === tabbableIndex ? 0 : -1, value: inputValues[index] || '', autocomplete: "one-time-code", ref: (el) => (inputRefs[index] = el), onInput: this.onInput(index), onBlur: this.onBlur, onFocus: this.onFocus(index), onKeyDown: this.onKeyDown(index), onPaste: this.onPaste })), this.showSeparator(index) && hAsync("div", { class: "input-otp-separator" }))))), hAsync("div", { key: '5311fedc34f7af3efd5f69e5a3d768055119c4f1', class: {
17576
+ }) }, hAsync("div", Object.assign({ key: '9d797deb7170bf6e4cc1acf70cca0b5d4ef51610', role: "group", "aria-label": "One-time password input", class: "input-otp-group" }, inheritedAttributes), Array.from({ length }).map((_, index) => (hAsync(Fragment, null, hAsync("div", { class: "native-wrapper" }, hAsync("input", { class: "native-input", id: `${inputId}-${index}`, "aria-label": `Input ${index + 1} of ${length}`, type: "text", autoCapitalize: autocapitalize, inputmode: inputmode, pattern: pattern, disabled: disabled, readOnly: readonly, tabIndex: index === tabbableIndex ? 0 : -1, value: inputValues[index] || '', autocomplete: "one-time-code", ref: (el) => (inputRefs[index] = el), onInput: this.onInput(index), onBlur: this.onBlur, onFocus: this.onFocus(index), onKeyDown: this.onKeyDown(index), onPaste: this.onPaste })), this.showSeparator(index) && hAsync("div", { class: "input-otp-separator" }))))), hAsync("div", { key: 'a0463205729699430560032a68ade2e2ffa49b61', class: {
17524
17577
  'input-otp-description': true,
17525
17578
  'input-otp-description-hidden': !hasDescription,
17526
- } }, hAsync("slot", { key: '9e8afa2f7fa76c3092582dc27770fdf565a1b9ba' }))));
17579
+ } }, hAsync("slot", { key: '287fdaf0375cda3dcfafa2762d7daebf6f2bfe68' }))));
17527
17580
  }
17528
17581
  get el() { return getElement(this); }
17529
17582
  static get watchers() { return {
@@ -17554,6 +17607,7 @@ class InputOTP {
17554
17607
  "value": [1032],
17555
17608
  "inputValues": [32],
17556
17609
  "hasFocus": [32],
17610
+ "previousInputValues": [32],
17557
17611
  "setFocus": [64]
17558
17612
  },
17559
17613
  "$listeners$": undefined,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ionic/core",
3
- "version": "8.6.4",
3
+ "version": "8.6.5-dev.11752243397.18475074",
4
4
  "description": "Base components for Ionic",
5
5
  "keywords": [
6
6
  "ionic",
@@ -1,4 +0,0 @@
1
- /*!
2
- * (C) Ionic http://ionicframework.com - MIT License
3
- */
4
- import{r as i,d as o,m as t,e as n,h as p,F as r,j as s,k as e}from"./p-B_U9CtaY.js";import{i as a}from"./p-Do-uqmtX.js";import{i as l}from"./p-C53feagD.js";import{c as d}from"./p-DiVJyqlX.js";const u=class{constructor(t){i(this,t),this.ionInput=o(this,"ionInput",7),this.ionChange=o(this,"ionChange",7),this.ionComplete=o(this,"ionComplete",7),this.ionBlur=o(this,"ionBlur",7),this.ionFocus=o(this,"ionFocus",7),this.inheritedAttributes={},this.inputRefs=[],this.inputId="ion-input-otp-"+c++,this.parsedSeparators=[],this.isKeyboardNavigation=!1,this.inputValues=[],this.hasFocus=!1,this.autocapitalize="off",this.disabled=!1,this.fill="outline",this.length=4,this.readonly=!1,this.shape="round",this.size="medium",this.type="number",this.value="",this.onFocus=i=>o=>{var t;const{inputRefs:n}=this;this.hasFocus||(this.ionFocus.emit(o),this.focusedValue=this.value),this.hasFocus=!0;let p=i;if(!this.isKeyboardNavigation){const o=this.inputValues[i]?i:this.getFirstEmptyIndex();p=-1===o?this.length-1:o,null===(t=this.inputRefs[p])||void 0===t||t.focus()}n.forEach(((i,o)=>{i.tabIndex=o===p?0:-1})),this.isKeyboardNavigation=!1},this.onBlur=i=>{const{inputRefs:o}=this,t=i.relatedTarget;null!=t&&o.includes(t)||(this.hasFocus=!1,this.updateTabIndexes(),this.ionBlur.emit(i),this.focusedValue!==this.value&&this.emitIonChange(i))},this.onKeyDown=i=>o=>{const{length:t}=this,n=l(this.el),p=o.target;if(!(p.selectionStart!==p.selectionEnd||(o.metaKey||o.ctrlKey)&&["a","c","v","x","r","z","y"].includes(o.key.toLowerCase()))){if("Backspace"===o.key)if(this.inputValues[i]){for(let o=i;o<t-1;o++)this.inputValues[o]=this.inputValues[o+1];this.inputValues[t-1]="";for(let i=0;i<t;i++)this.inputRefs[i].value=this.inputValues[i]||"";this.updateValue(o),o.preventDefault()}else!this.inputValues[i]&&i>0&&this.focusPrevious(i);else if("ArrowLeft"===o.key||"ArrowRight"===o.key){this.isKeyboardNavigation=!0,o.preventDefault();const p="ArrowLeft"===o.key;p&&n||!p&&!n?this.inputValues[i]&&i<t-1&&this.focusNext(i):this.focusPrevious(i)}else if("Tab"===o.key)return void(this.isKeyboardNavigation=!0);if(this.inputValues[i]&&this.validKeyPattern.test(o.key)){if(!this.inputValues[t-1])for(let o=t-1;o>i;o--)this.inputValues[o]=this.inputValues[o-1],this.inputRefs[o].value=this.inputValues[o]||"";this.inputValues[i]=o.key,this.inputRefs[i].value=o.key,this.updateValue(o),o.preventDefault()}}},this.onInput=i=>o=>{const{length:t,validKeyPattern:n}=this,p=o.target.value;if(p.length>1){const i=p.split("").filter((i=>n.test(i))).slice(0,t);return 0===i.length&&requestAnimationFrame((()=>{this.inputRefs.forEach((i=>{i.value=""}))})),this.value=i.join(""),this.updateValue(o),void setTimeout((()=>{var o;null===(o=this.inputRefs[i.length<t?i.length:t-1])||void 0===o||o.focus()}),20)}if(p.length>0&&!n.test(p))return this.inputRefs[i].value="",void(this.inputValues[i]="");this.inputValues[i]=p,this.updateValue(o),p.length>0&&this.focusNext(i)},this.onPaste=i=>{var o,t,n;const{inputRefs:p,length:r,validKeyPattern:s}=this;i.preventDefault();const e=null===(o=i.clipboardData)||void 0===o?void 0:o.getData("text");if(!e)return void this.emitIonInput(i);const a=e.split("").filter((i=>s.test(i))).slice(0,r);a.forEach(((i,o)=>{o<r&&(this.inputRefs[o].value=i,this.inputValues[o]=i)})),this.value=a.join(""),this.updateValue(i);const l=a.length;l<r?null===(t=p[l])||void 0===t||t.focus():null===(n=p[r-1])||void 0===n||n.focus()}}async setFocus(i){var o,t;if("number"==typeof i){const t=Math.max(0,Math.min(i,this.length-1));null===(o=this.inputRefs[t])||void 0===o||o.focus()}else{const i=this.getTabbableIndex();null===(t=this.inputRefs[i])||void 0===t||t.focus()}}valueChanged(){this.initializeValues(),this.updateTabIndexes()}processSeparators(){const{separators:i,length:o}=this;if(void 0===i)return void(this.parsedSeparators=[]);if("string"==typeof i&&"all"!==i&&!/^(\d+)(,\d+)*$/.test(i))return t(`[ion-input-otp] - Invalid separators format. Expected a comma-separated list of numbers, an array of numbers, or "all". Received: ${i}`,this.el),void(this.parsedSeparators=[]);let n;n="all"===i?Array.from({length:o-1},((i,o)=>o+1)):Array.isArray(i)?i:i.split(",").map((i=>parseInt(i,10))).filter((i=>!isNaN(i))),n.filter(((i,o)=>n.indexOf(i)!==o)).length>0&&t(`[ion-input-otp] - Duplicate separator positions are not allowed. Received: ${i}`,this.el);const p=n.filter((i=>i>o));p.length>0&&t(`[ion-input-otp] - The following separator positions are greater than the input length (${o}): ${p.join(", ")}. These separators will be ignored.`,this.el),this.parsedSeparators=n.filter((i=>i<=o))}componentWillLoad(){this.inheritedAttributes=a(this.el),this.processSeparators(),this.initializeValues()}componentDidLoad(){this.updateTabIndexes()}get validKeyPattern(){return new RegExp(`^${this.getPattern()}$`,"u")}getPattern(){const{pattern:i,type:o}=this;return i||("number"===o?"[\\p{N}]":"[\\p{L}\\p{N}]")}getInputmode(){const{inputmode:i}=this;return i||("number"==this.type?"numeric":"text")}initializeValues(){this.inputValues=Array(this.length).fill(""),null!=this.value&&0!==String(this.value).length&&(String(this.value).split("").slice(0,this.length).forEach(((i,o)=>{this.validKeyPattern.test(i)&&(this.inputValues[o]=i)})),this.value=this.inputValues.join(""))}updateValue(i){const{inputValues:o,length:t}=this,n=o.join("");this.value=n,this.emitIonInput(i),n.length===t&&this.ionComplete.emit({value:n})}emitIonChange(i){const{value:o}=this,t=null==o?o:o.toString();this.ionChange.emit({value:t,event:i})}emitIonInput(i){const{value:o}=this,t=null==o?o:o.toString();this.ionInput.emit({value:t,event:i})}focusNext(i){var o;const{inputRefs:t,length:n}=this;i<n-1&&(null===(o=t[i+1])||void 0===o||o.focus())}focusPrevious(i){var o;const{inputRefs:t}=this;i>0&&(null===(o=t[i-1])||void 0===o||o.focus())}getFirstEmptyIndex(){var i;const{inputValues:o,length:t}=this;return null!==(i=Array.from({length:t},((i,t)=>o[t]||"")).findIndex((i=>!i||""===i)))&&void 0!==i?i:-1}getTabbableIndex(){const{length:i}=this,o=this.getFirstEmptyIndex();return-1===o?i-1:o}updateTabIndexes(){const{inputRefs:i,inputValues:o,length:t}=this;let n=-1;for(let i=0;i<t;i++)if(!o[i]||""===o[i]){n=i;break}i.forEach(((i,p)=>{const r=-1===n?p===t-1:n===p;i.tabIndex=r?0:-1,i.setAttribute("aria-hidden",o[p]&&""!==o[p]||r?"false":"true")}))}showSeparator(i){const{length:o}=this;return this.parsedSeparators.includes(i+1)&&i<o-1}render(){var i,o;const{autocapitalize:t,color:e,disabled:a,el:l,fill:u,hasFocus:c,inheritedAttributes:h,inputId:g,inputRefs:v,inputValues:m,length:f,readonly:b,shape:x,size:w}=this,k=n(this),y=this.getInputmode(),z=this.getTabbableIndex(),I=this.getPattern(),$=""!==(null===(o=null===(i=l.querySelector(".input-otp-description"))||void 0===i?void 0:i.textContent)||void 0===o?void 0:o.trim());return p(s,{key:"df8fca036cedea0812185a02e3b655d7d76285e0",class:d(e,{[k]:!0,"has-focus":c,[`input-otp-size-${w}`]:!0,[`input-otp-shape-${x}`]:!0,[`input-otp-fill-${u}`]:!0,"input-otp-disabled":a,"input-otp-readonly":b})},p("div",Object.assign({key:"831be3f939cf037f0eb8d7e37e0afd4ef9a3c2c5",role:"group","aria-label":"One-time password input",class:"input-otp-group"},h),Array.from({length:f}).map(((i,o)=>p(r,null,p("div",{class:"native-wrapper"},p("input",{class:"native-input",id:`${g}-${o}`,"aria-label":`Input ${o+1} of ${f}`,type:"text",autoCapitalize:t,inputmode:y,pattern:I,disabled:a,readOnly:b,tabIndex:o===z?0:-1,value:m[o]||"",autocomplete:"one-time-code",ref:i=>v[o]=i,onInput:this.onInput(o),onBlur:this.onBlur,onFocus:this.onFocus(o),onKeyDown:this.onKeyDown(o),onPaste:this.onPaste})),this.showSeparator(o)&&p("div",{class:"input-otp-separator"}))))),p("div",{key:"5311fedc34f7af3efd5f69e5a3d768055119c4f1",class:{"input-otp-description":!0,"input-otp-description-hidden":!$}},p("slot",{key:"9e8afa2f7fa76c3092582dc27770fdf565a1b9ba"})))}get el(){return e(this)}static get watchers(){return{value:["valueChanged"],separators:["processSeparators"],length:["processSeparators"]}}};let c=0;u.style={ios:".sc-ion-input-otp-ios-h{--margin-top:0;--margin-end:0;--margin-bottom:0;--margin-start:0;--padding-top:16px;--padding-end:0;--padding-bottom:16px;--padding-start:0;--color:initial;--min-width:40px;--separator-width:8px;--separator-height:var(--separator-width);--separator-border-radius:999px;--separator-color:var(--ion-color-step-150, var(--ion-background-color-step-150, #d9d9d9));--highlight-color-focused:var(--ion-color-primary, #0054e9);--highlight-color-valid:var(--ion-color-success, #2dd55b);--highlight-color-invalid:var(--ion-color-danger, #c5000f);--highlight-color:var(--highlight-color-focused);display:block;position:relative;font-size:0.875rem}.input-otp-group.sc-ion-input-otp-ios{-webkit-margin-start:var(--margin-start);margin-inline-start:var(--margin-start);-webkit-margin-end:var(--margin-end);margin-inline-end:var(--margin-end);margin-top:var(--margin-top);margin-bottom:var(--margin-bottom);-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}.native-wrapper.sc-ion-input-otp-ios{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;min-width:var(--min-width)}.native-input.sc-ion-input-otp-ios{border-radius:var(--border-radius);width:var(--width);min-width:inherit;height:var(--height);border-width:var(--border-width);border-style:solid;border-color:var(--border-color);background:var(--background);color:var(--color);font-size:inherit;text-align:center;-webkit-appearance:none;-moz-appearance:none;appearance:none}.has-focus.sc-ion-input-otp-ios-h .native-input.sc-ion-input-otp-ios{caret-color:var(--highlight-color)}.input-otp-description.sc-ion-input-otp-ios{color:var(--ion-color-step-700, var(--ion-text-color-step-300, #4d4d4d));font-size:0.75rem;line-height:1.25rem;text-align:center}.input-otp-description-hidden.sc-ion-input-otp-ios{display:none}.input-otp-separator.sc-ion-input-otp-ios{border-radius:var(--separator-border-radius);-ms-flex-negative:0;flex-shrink:0;width:var(--separator-width);height:var(--separator-height);background:var(--separator-color)}.input-otp-size-small.sc-ion-input-otp-ios-h{--width:40px;--height:40px}.input-otp-size-small.sc-ion-input-otp-ios-h .input-otp-group.sc-ion-input-otp-ios{gap:8px}.input-otp-size-medium.sc-ion-input-otp-ios-h{--width:48px;--height:48px}.input-otp-size-large.sc-ion-input-otp-ios-h{--width:56px;--height:56px}.input-otp-size-medium.sc-ion-input-otp-ios-h .input-otp-group.sc-ion-input-otp-ios,.input-otp-size-large.sc-ion-input-otp-ios-h .input-otp-group.sc-ion-input-otp-ios{gap:12px}.input-otp-shape-round.sc-ion-input-otp-ios-h{--border-radius:16px}.input-otp-shape-soft.sc-ion-input-otp-ios-h{--border-radius:8px}.input-otp-shape-rectangular.sc-ion-input-otp-ios-h{--border-radius:0}.input-otp-fill-outline.sc-ion-input-otp-ios-h{--background:none}.input-otp-fill-solid.sc-ion-input-otp-ios-h{--border-color:var(--ion-color-step-50, var(--ion-background-color-step-50, #f2f2f2));--background:var(--ion-color-step-50, var(--ion-background-color-step-50, #f2f2f2))}.input-otp-disabled.sc-ion-input-otp-ios-h{--color:var(--ion-color-step-350, var(--ion-text-color-step-650, #a6a6a6))}.input-otp-fill-outline.input-otp-disabled.sc-ion-input-otp-ios-h{--background:var(--ion-color-step-50, var(--ion-background-color-step-50, #f2f2f2));--border-color:var(--ion-color-step-100, var(--ion-background-color-step-100, #e6e6e6))}.input-otp-disabled.sc-ion-input-otp-ios-h,.input-otp-disabled.sc-ion-input-otp-ios-h .native-input.sc-ion-input-otp-ios:disabled{cursor:not-allowed}.has-focus.sc-ion-input-otp-ios-h .native-input.sc-ion-input-otp-ios:focus{--border-color:var(--highlight-color);outline:none}.input-otp-fill-outline.input-otp-readonly.sc-ion-input-otp-ios-h{--background:var(--ion-color-step-50, var(--ion-background-color-step-50, #f2f2f2))}.input-otp-fill-solid.input-otp-disabled.sc-ion-input-otp-ios-h,.input-otp-fill-solid.input-otp-readonly.sc-ion-input-otp-ios-h{--border-color:var(--ion-color-step-100, var(--ion-background-color-step-100, #e6e6e6));--background:var(--ion-color-step-100, var(--ion-background-color-step-100, #e6e6e6))}.ion-touched.ion-invalid.sc-ion-input-otp-ios-h{--highlight-color:var(--highlight-color-invalid)}.ion-valid.sc-ion-input-otp-ios-h{--highlight-color:var(--highlight-color-valid)}.has-focus.ion-valid.sc-ion-input-otp-ios-h,.ion-touched.ion-invalid.sc-ion-input-otp-ios-h{--border-color:var(--highlight-color)}.ion-color.sc-ion-input-otp-ios-h{--highlight-color-focused:var(--ion-color-base)}.input-otp-fill-outline.ion-color.sc-ion-input-otp-ios-h .native-input.sc-ion-input-otp-ios,.input-otp-fill-solid.ion-color.sc-ion-input-otp-ios-h .native-input.sc-ion-input-otp-ios:focus{border-color:rgba(var(--ion-color-base-rgb), 0.6)}.input-otp-fill-outline.ion-color.ion-invalid.sc-ion-input-otp-ios-h .native-input.sc-ion-input-otp-ios,.input-otp-fill-solid.ion-color.ion-invalid.sc-ion-input-otp-ios-h .native-input.sc-ion-input-otp-ios,.input-otp-fill-outline.ion-color.has-focus.ion-invalid.sc-ion-input-otp-ios-h .native-input.sc-ion-input-otp-ios,.input-otp-fill-solid.ion-color.has-focus.ion-invalid.sc-ion-input-otp-ios-h .native-input.sc-ion-input-otp-ios{border-color:var(--ion-color-danger, #c5000f)}.input-otp-fill-outline.ion-color.ion-valid.sc-ion-input-otp-ios-h .native-input.sc-ion-input-otp-ios,.input-otp-fill-solid.ion-color.ion-valid.sc-ion-input-otp-ios-h .native-input.sc-ion-input-otp-ios,.input-otp-fill-outline.ion-color.has-focus.ion-valid.sc-ion-input-otp-ios-h .native-input.sc-ion-input-otp-ios,.input-otp-fill-solid.ion-color.has-focus.ion-valid.sc-ion-input-otp-ios-h .native-input.sc-ion-input-otp-ios{border-color:var(--ion-color-success, #2dd55b)}.input-otp-fill-outline.input-otp-disabled.ion-color.sc-ion-input-otp-ios-h .native-input.sc-ion-input-otp-ios{border-color:rgba(var(--ion-color-base-rgb), 0.3)}.sc-ion-input-otp-ios-h{--border-width:0.55px}.has-focus.sc-ion-input-otp-ios-h .native-input.sc-ion-input-otp-ios:focus{--border-width:1px}.input-otp-fill-outline.sc-ion-input-otp-ios-h{--border-color:var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-250, var(--ion-background-color-step-250, #c8c7cc))))}",md:".sc-ion-input-otp-md-h{--margin-top:0;--margin-end:0;--margin-bottom:0;--margin-start:0;--padding-top:16px;--padding-end:0;--padding-bottom:16px;--padding-start:0;--color:initial;--min-width:40px;--separator-width:8px;--separator-height:var(--separator-width);--separator-border-radius:999px;--separator-color:var(--ion-color-step-150, var(--ion-background-color-step-150, #d9d9d9));--highlight-color-focused:var(--ion-color-primary, #0054e9);--highlight-color-valid:var(--ion-color-success, #2dd55b);--highlight-color-invalid:var(--ion-color-danger, #c5000f);--highlight-color:var(--highlight-color-focused);display:block;position:relative;font-size:0.875rem}.input-otp-group.sc-ion-input-otp-md{-webkit-margin-start:var(--margin-start);margin-inline-start:var(--margin-start);-webkit-margin-end:var(--margin-end);margin-inline-end:var(--margin-end);margin-top:var(--margin-top);margin-bottom:var(--margin-bottom);-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}.native-wrapper.sc-ion-input-otp-md{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;min-width:var(--min-width)}.native-input.sc-ion-input-otp-md{border-radius:var(--border-radius);width:var(--width);min-width:inherit;height:var(--height);border-width:var(--border-width);border-style:solid;border-color:var(--border-color);background:var(--background);color:var(--color);font-size:inherit;text-align:center;-webkit-appearance:none;-moz-appearance:none;appearance:none}.has-focus.sc-ion-input-otp-md-h .native-input.sc-ion-input-otp-md{caret-color:var(--highlight-color)}.input-otp-description.sc-ion-input-otp-md{color:var(--ion-color-step-700, var(--ion-text-color-step-300, #4d4d4d));font-size:0.75rem;line-height:1.25rem;text-align:center}.input-otp-description-hidden.sc-ion-input-otp-md{display:none}.input-otp-separator.sc-ion-input-otp-md{border-radius:var(--separator-border-radius);-ms-flex-negative:0;flex-shrink:0;width:var(--separator-width);height:var(--separator-height);background:var(--separator-color)}.input-otp-size-small.sc-ion-input-otp-md-h{--width:40px;--height:40px}.input-otp-size-small.sc-ion-input-otp-md-h .input-otp-group.sc-ion-input-otp-md{gap:8px}.input-otp-size-medium.sc-ion-input-otp-md-h{--width:48px;--height:48px}.input-otp-size-large.sc-ion-input-otp-md-h{--width:56px;--height:56px}.input-otp-size-medium.sc-ion-input-otp-md-h .input-otp-group.sc-ion-input-otp-md,.input-otp-size-large.sc-ion-input-otp-md-h .input-otp-group.sc-ion-input-otp-md{gap:12px}.input-otp-shape-round.sc-ion-input-otp-md-h{--border-radius:16px}.input-otp-shape-soft.sc-ion-input-otp-md-h{--border-radius:8px}.input-otp-shape-rectangular.sc-ion-input-otp-md-h{--border-radius:0}.input-otp-fill-outline.sc-ion-input-otp-md-h{--background:none}.input-otp-fill-solid.sc-ion-input-otp-md-h{--border-color:var(--ion-color-step-50, var(--ion-background-color-step-50, #f2f2f2));--background:var(--ion-color-step-50, var(--ion-background-color-step-50, #f2f2f2))}.input-otp-disabled.sc-ion-input-otp-md-h{--color:var(--ion-color-step-350, var(--ion-text-color-step-650, #a6a6a6))}.input-otp-fill-outline.input-otp-disabled.sc-ion-input-otp-md-h{--background:var(--ion-color-step-50, var(--ion-background-color-step-50, #f2f2f2));--border-color:var(--ion-color-step-100, var(--ion-background-color-step-100, #e6e6e6))}.input-otp-disabled.sc-ion-input-otp-md-h,.input-otp-disabled.sc-ion-input-otp-md-h .native-input.sc-ion-input-otp-md:disabled{cursor:not-allowed}.has-focus.sc-ion-input-otp-md-h .native-input.sc-ion-input-otp-md:focus{--border-color:var(--highlight-color);outline:none}.input-otp-fill-outline.input-otp-readonly.sc-ion-input-otp-md-h{--background:var(--ion-color-step-50, var(--ion-background-color-step-50, #f2f2f2))}.input-otp-fill-solid.input-otp-disabled.sc-ion-input-otp-md-h,.input-otp-fill-solid.input-otp-readonly.sc-ion-input-otp-md-h{--border-color:var(--ion-color-step-100, var(--ion-background-color-step-100, #e6e6e6));--background:var(--ion-color-step-100, var(--ion-background-color-step-100, #e6e6e6))}.ion-touched.ion-invalid.sc-ion-input-otp-md-h{--highlight-color:var(--highlight-color-invalid)}.ion-valid.sc-ion-input-otp-md-h{--highlight-color:var(--highlight-color-valid)}.has-focus.ion-valid.sc-ion-input-otp-md-h,.ion-touched.ion-invalid.sc-ion-input-otp-md-h{--border-color:var(--highlight-color)}.ion-color.sc-ion-input-otp-md-h{--highlight-color-focused:var(--ion-color-base)}.input-otp-fill-outline.ion-color.sc-ion-input-otp-md-h .native-input.sc-ion-input-otp-md,.input-otp-fill-solid.ion-color.sc-ion-input-otp-md-h .native-input.sc-ion-input-otp-md:focus{border-color:rgba(var(--ion-color-base-rgb), 0.6)}.input-otp-fill-outline.ion-color.ion-invalid.sc-ion-input-otp-md-h .native-input.sc-ion-input-otp-md,.input-otp-fill-solid.ion-color.ion-invalid.sc-ion-input-otp-md-h .native-input.sc-ion-input-otp-md,.input-otp-fill-outline.ion-color.has-focus.ion-invalid.sc-ion-input-otp-md-h .native-input.sc-ion-input-otp-md,.input-otp-fill-solid.ion-color.has-focus.ion-invalid.sc-ion-input-otp-md-h .native-input.sc-ion-input-otp-md{border-color:var(--ion-color-danger, #c5000f)}.input-otp-fill-outline.ion-color.ion-valid.sc-ion-input-otp-md-h .native-input.sc-ion-input-otp-md,.input-otp-fill-solid.ion-color.ion-valid.sc-ion-input-otp-md-h .native-input.sc-ion-input-otp-md,.input-otp-fill-outline.ion-color.has-focus.ion-valid.sc-ion-input-otp-md-h .native-input.sc-ion-input-otp-md,.input-otp-fill-solid.ion-color.has-focus.ion-valid.sc-ion-input-otp-md-h .native-input.sc-ion-input-otp-md{border-color:var(--ion-color-success, #2dd55b)}.input-otp-fill-outline.input-otp-disabled.ion-color.sc-ion-input-otp-md-h .native-input.sc-ion-input-otp-md{border-color:rgba(var(--ion-color-base-rgb), 0.3)}.sc-ion-input-otp-md-h{--border-width:1px}.has-focus.sc-ion-input-otp-md-h .native-input.sc-ion-input-otp-md:focus{--border-width:2px}.input-otp-fill-outline.sc-ion-input-otp-md-h{--border-color:var(--ion-color-step-300, var(--ion-background-color-step-300, #b3b3b3))}"};export{u as ion_input_otp}