fds-vue-core 8.2.3 → 8.2.4

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.
@@ -9877,13 +9877,13 @@ const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
9877
9877
  }
9878
9878
  });
9879
9879
  const _hoisted_1$j = ["for", "id"];
9880
- const _hoisted_2$f = ["type", "required", "disabled", "tabindex", "aria-invalid", "aria-label", "aria-labelledby", "aria-describedby", "autocomplete", "placeholder", "pattern", "searchIcon"];
9881
- const _hoisted_3$f = { class: "whitespace-pre text-base leading-6 tabular-nums" };
9880
+ const _hoisted_2$f = { class: "relative" };
9881
+ const _hoisted_3$f = ["type", "required", "disabled", "tabindex", "aria-invalid", "aria-label", "aria-labelledby", "aria-describedby", "autocomplete", "placeholder", "pattern", "searchIcon"];
9882
9882
  const _hoisted_4$e = {
9883
9883
  key: 0,
9884
9884
  class: "text-red-700 font-bold mt-1"
9885
9885
  };
9886
- const maskFieldPaddingClasses = "px-3 py-[calc(0.75rem-1px)]";
9886
+ const inputPaddingClasses = "px-3 py-[calc(0.75rem-1px)]";
9887
9887
  const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
9888
9888
  ...{
9889
9889
  inheritAttrs: false
@@ -9900,7 +9900,6 @@ const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
9900
9900
  labelLeft: { type: Boolean, default: false },
9901
9901
  clearButton: { type: Boolean, default: false },
9902
9902
  mask: { default: void 0 },
9903
- displayChar: { default: void 0 },
9904
9903
  modelValue: {},
9905
9904
  value: { default: void 0 },
9906
9905
  type: {},
@@ -9935,7 +9934,7 @@ const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
9935
9934
  "modelValue": { default: void 0, required: false },
9936
9935
  "modelModifiers": {}
9937
9936
  }),
9938
- emits: /* @__PURE__ */ vue.mergeModels(["input", "change", "clearInput", "update:value", "keyup", "keyup.enter", "blur"], ["update:modelValue"]),
9937
+ emits: /* @__PURE__ */ vue.mergeModels(["input", "autocomplete", "clearInput", "update:value", "keyup", "keyup.enter", "blur"], ["update:modelValue"]),
9939
9938
  setup(__props, { emit: __emit }) {
9940
9939
  const modelValue = vue.useModel(__props, "modelValue");
9941
9940
  const props = __props;
@@ -10016,86 +10015,26 @@ const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
10016
10015
  return "pr-40";
10017
10016
  });
10018
10017
  const externalClass = vue.computed(() => props.class ?? attrs.class);
10019
- const maskDisplayValue = vue.ref("");
10020
- const maskPlaceholderChar = vue.ref("");
10021
- const resolvedPlaceholderChar = vue.computed(() => props.displayChar ?? props.maskOptions?.placeholderChar ?? null);
10022
- const useMaskPlaceholderStyle = vue.computed(() => {
10023
- if (!props.mask || !resolvedPlaceholderChar.value) return false;
10024
- const lazy = props.maskOptions?.lazy ?? (props.displayChar ? false : true);
10025
- return !lazy;
10026
- });
10027
- const maskFieldWrapperClasses = vue.computed(() => {
10028
- if (!useMaskPlaceholderStyle.value) return void 0;
10029
- return [
10030
- "rounded-md border border-gray-500 bg-white bg-clip-padding",
10031
- props.disabled && "outline-dashed outline-2 outline-gray-400 cursor-not-allowed border-transparent",
10032
- isInvalid.value ? "outline-2 -outline-offset-2 outline-red-600" : "focus-within:outline-2 focus-within:outline-blue-500 focus-within:outline-offset-0",
10033
- "focus-within:border-transparent"
10034
- ];
10035
- });
10036
- const maskOverlayClasses = vue.computed(() => [
10037
- "pointer-events-none absolute inset-0 z-[3] flex items-center",
10038
- maskFieldPaddingClasses,
10039
- inputPaddingRight.value
10018
+ const inputClasses = vue.computed(() => [
10019
+ "block rounded-md border border-gray-500",
10020
+ maxlength.value ? "" : "w-full",
10021
+ inputPaddingClasses,
10022
+ inputPaddingRight.value,
10023
+ "focus:outline-2 focus:outline-blue-500 -outline-offset-2 focus:border-transparent",
10024
+ showDateIcon.value && "[&::-webkit-calendar-picker-indicator]:opacity-0 [&::-webkit-calendar-picker-indicator]:pointer-events-none",
10025
+ props.disabled ? "text-gray-800 outline-dashed outline-2 outline-gray-400 cursor-not-allowed border-transparent" : "text-gray-900 bg-white",
10026
+ isInvalid.value && "outline-2 outline-red-600",
10027
+ props.inputClass
10040
10028
  ]);
10041
- const maskDisplayChars = vue.computed(() => {
10042
- const display = maskDisplayValue.value;
10043
- const placeholder = maskPlaceholderChar.value || resolvedPlaceholderChar.value;
10044
- if (!display || !placeholder) return [];
10045
- return [...display].map((char) => ({
10046
- char,
10047
- isPlaceholder: char === placeholder
10048
- }));
10049
- });
10050
- function maskCharStyle(isPlaceholder) {
10051
- if (isPlaceholder) {
10052
- return { color: props.disabled ? "var(--color-gray-500)" : "var(--color-gray-400)" };
10053
- }
10054
- return { color: props.disabled ? "var(--color-gray-800)" : "var(--color-gray-900)" };
10055
- }
10056
- const inputClasses = vue.computed(() => {
10057
- const shared = [
10058
- "block rounded-md",
10059
- maxlength.value ? "" : "w-full",
10060
- inputPaddingRight.value,
10061
- showDateIcon.value && "[&::-webkit-calendar-picker-indicator]:opacity-0 [&::-webkit-calendar-picker-indicator]:pointer-events-none",
10062
- props.inputClass
10063
- ];
10064
- if (useMaskPlaceholderStyle.value) {
10065
- return [
10066
- ...shared,
10067
- "relative z-[2] border-0 bg-transparent shadow-none focus:outline-none",
10068
- maskFieldPaddingClasses,
10069
- "text-base leading-6 tabular-nums",
10070
- props.disabled ? "cursor-not-allowed" : ""
10071
- ];
10072
- }
10073
- return [
10074
- ...shared,
10075
- "rounded-md border border-gray-500",
10076
- maskFieldPaddingClasses,
10077
- "focus:outline-2 focus:outline-blue-500 -outline-offset-2 focus:border-transparent",
10078
- props.disabled ? "text-gray-800 outline-dashed outline-2 outline-gray-400 cursor-not-allowed border-transparent" : "text-gray-900 bg-white",
10079
- isInvalid.value && "outline-2 outline-red-600"
10080
- ];
10081
- });
10082
10029
  const inputStyle = vue.computed(() => {
10083
- const size = maxlength.value ? {
10030
+ if (!maxlength.value) return void 0;
10031
+ return {
10084
10032
  width: `calc(${maxlength.value}ch + 1.5rem + 0.25rem)`,
10085
10033
  maxWidth: "100%"
10086
- } : {};
10087
- if (!useMaskPlaceholderStyle.value) {
10088
- return size;
10089
- }
10090
- return {
10091
- ...size,
10092
- color: "transparent",
10093
- WebkitTextFillColor: "transparent",
10094
- caretColor: props.disabled ? "#1f2937" : "#111827"
10095
10034
  };
10096
10035
  });
10097
10036
  const rightIconsContainerClasses = vue.computed(() => [
10098
- "absolute z-10 flex gap-2 top-1/2 -translate-y-1/2 items-center justify-end",
10037
+ "absolute flex gap-2 top-1/2 -translate-y-1/2 items-center justify-end",
10099
10038
  showClearButton.value ? "right-2" : "right-3"
10100
10039
  ]);
10101
10040
  const inputBindings = vue.computed(() => ({
@@ -10115,7 +10054,6 @@ const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
10115
10054
  internalValue.value = "";
10116
10055
  if (maskInstance) {
10117
10056
  maskInstance.value = "";
10118
- vue.nextTick(syncMaskDisplay);
10119
10057
  }
10120
10058
  emit("clearInput");
10121
10059
  }
@@ -10145,57 +10083,25 @@ const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
10145
10083
  }
10146
10084
  const inputRef = vue.ref(null);
10147
10085
  let maskInstance = null;
10148
- function getMaskEmittedValue(instance) {
10149
- if (!instance) return "";
10150
- const raw = String(instance.value ?? "");
10151
- if (!useMaskPlaceholderStyle.value) return raw;
10152
- const placeholder = instance.masked?.placeholderChar ?? resolvedPlaceholderChar.value;
10153
- if (!placeholder) return raw;
10154
- return raw.split(placeholder).join("").replace(/\s+$/, "");
10155
- }
10156
- function syncMaskDisplay() {
10157
- if (!inputRef.value) {
10158
- maskDisplayValue.value = "";
10159
- maskPlaceholderChar.value = "";
10160
- return;
10161
- }
10162
- maskPlaceholderChar.value = maskInstance?.masked?.placeholderChar ?? resolvedPlaceholderChar.value ?? "";
10163
- maskDisplayValue.value = maskInstance?.displayValue ?? inputRef.value.value ?? maskInstance?.value ?? "";
10164
- }
10165
10086
  const createMask2 = () => {
10166
10087
  if (maskInstance) {
10167
10088
  maskInstance.destroy();
10168
10089
  maskInstance = null;
10169
10090
  }
10170
10091
  if (props.mask && inputRef.value) {
10171
- const maskConfig = {
10092
+ maskInstance = IMask(inputRef.value, {
10172
10093
  mask: props.mask,
10173
10094
  ...props.maskOptions,
10174
- ...props.displayChar ? {
10175
- placeholderChar: props.displayChar,
10176
- lazy: props.maskOptions?.lazy ?? false
10177
- } : {}
10178
- };
10179
- maskInstance = IMask(inputRef.value, maskConfig);
10095
+ lazy: props.maskOptions?.lazy ?? true
10096
+ });
10180
10097
  if (internalValue.value) {
10181
10098
  maskInstance.value = internalValue.value;
10182
10099
  }
10183
10100
  maskInstance.on("accept", () => {
10184
10101
  if (maskInstance) {
10185
- internalValue.value = getMaskEmittedValue(maskInstance);
10186
- vue.nextTick(syncMaskDisplay);
10102
+ internalValue.value = maskInstance.value;
10187
10103
  }
10188
10104
  });
10189
- maskInstance.on("complete", () => {
10190
- vue.nextTick(syncMaskDisplay);
10191
- });
10192
- vue.nextTick(() => {
10193
- syncMaskDisplay();
10194
- vue.nextTick(syncMaskDisplay);
10195
- });
10196
- } else {
10197
- maskDisplayValue.value = "";
10198
- maskPlaceholderChar.value = "";
10199
10105
  }
10200
10106
  };
10201
10107
  vue.onMounted(() => {
@@ -10224,7 +10130,7 @@ const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
10224
10130
  return props.meta ? metaId.value : void 0;
10225
10131
  });
10226
10132
  vue.watch(
10227
- () => [props.mask, props.displayChar, props.maskOptions],
10133
+ () => [props.mask, props.maskOptions],
10228
10134
  () => {
10229
10135
  vue.nextTick(() => {
10230
10136
  createMask2();
@@ -10232,13 +10138,23 @@ const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
10232
10138
  },
10233
10139
  { deep: true }
10234
10140
  );
10141
+ function shouldSyncMaskFromModel(newValue, currentMaskedValue) {
10142
+ if (newValue === void 0) {
10143
+ return false;
10144
+ }
10145
+ if (document.activeElement !== inputRef.value) {
10146
+ return true;
10147
+ }
10148
+ const newDigits = String(newValue).replace(/\D/g, "");
10149
+ const currentDigits = String(currentMaskedValue ?? "").replace(/\D/g, "");
10150
+ return newDigits !== currentDigits;
10151
+ }
10235
10152
  vue.watch(
10236
10153
  () => props.value,
10237
10154
  (newValue) => {
10238
- if (maskInstance && newValue !== void 0 && newValue !== getMaskEmittedValue(maskInstance)) {
10239
- if (document.activeElement !== inputRef.value) {
10155
+ if (maskInstance && newValue !== void 0 && newValue !== maskInstance.value) {
10156
+ if (shouldSyncMaskFromModel(newValue, maskInstance.value)) {
10240
10157
  maskInstance.value = newValue;
10241
- vue.nextTick(syncMaskDisplay);
10242
10158
  }
10243
10159
  }
10244
10160
  }
@@ -10246,10 +10162,9 @@ const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
10246
10162
  vue.watch(
10247
10163
  () => modelValue.value,
10248
10164
  (newValue) => {
10249
- if (maskInstance && newValue !== void 0 && newValue !== getMaskEmittedValue(maskInstance)) {
10250
- if (document.activeElement !== inputRef.value) {
10165
+ if (maskInstance && newValue !== void 0 && newValue !== maskInstance.value) {
10166
+ if (shouldSyncMaskFromModel(newValue, maskInstance.value)) {
10251
10167
  maskInstance.value = newValue;
10252
- vue.nextTick(syncMaskDisplay);
10253
10168
  }
10254
10169
  }
10255
10170
  }
@@ -10284,9 +10199,7 @@ const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
10284
10199
  vue.createElementVNode("div", {
10285
10200
  class: vue.normalizeClass({ "flex-1": props.labelLeft })
10286
10201
  }, [
10287
- vue.createElementVNode("div", {
10288
- class: vue.normalizeClass(["relative", maskFieldWrapperClasses.value])
10289
- }, [
10202
+ vue.createElementVNode("div", _hoisted_2$f, [
10290
10203
  vue.createElementVNode("input", vue.mergeProps({
10291
10204
  ref_key: "inputRef",
10292
10205
  ref: inputRef,
@@ -10307,26 +10220,13 @@ const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
10307
10220
  }, inputBindings.value, {
10308
10221
  onInput: handleInputChange,
10309
10222
  onChange: handleInputChange,
10310
- onBlur: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("blur", $event)),
10311
- onKeyup: _cache[1] || (_cache[1] = (ev) => {
10223
+ onAutocomplete: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("autocomplete", $event)),
10224
+ onBlur: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("blur", $event)),
10225
+ onKeyup: _cache[2] || (_cache[2] = (ev) => {
10312
10226
  _ctx.$emit("keyup", ev);
10313
10227
  if (ev.key === "Enter") _ctx.$emit("keyup.enter", ev);
10314
10228
  })
10315
- }), null, 16, _hoisted_2$f),
10316
- useMaskPlaceholderStyle.value ? (vue.openBlock(), vue.createElementBlock("div", {
10317
- key: 0,
10318
- class: vue.normalizeClass(maskOverlayClasses.value),
10319
- "aria-hidden": "true"
10320
- }, [
10321
- vue.createElementVNode("span", _hoisted_3$f, [
10322
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(maskDisplayChars.value, (item, index) => {
10323
- return vue.openBlock(), vue.createElementBlock("span", {
10324
- key: index,
10325
- style: vue.normalizeStyle(maskCharStyle(item.isPlaceholder))
10326
- }, vue.toDisplayString(item.char), 5);
10327
- }), 128))
10328
- ])
10329
- ], 2)) : vue.createCommentVNode("", true),
10229
+ }), null, 16, _hoisted_3$f),
10330
10230
  vue.createElementVNode("div", {
10331
10231
  class: vue.normalizeClass(rightIconsContainerClasses.value)
10332
10232
  }, [
@@ -10368,11 +10268,11 @@ const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
10368
10268
  }, null, 8, ["icon", "text"])) : vue.createCommentVNode("", true)
10369
10269
  ], 2),
10370
10270
  showTodaySuffixInField.value ? (vue.openBlock(), vue.createElementBlock("span", {
10371
- key: 1,
10271
+ key: 0,
10372
10272
  class: vue.normalizeClass(todaySuffixClasses.value),
10373
10273
  style: vue.normalizeStyle(todaySuffixStyle.value)
10374
10274
  }, vue.toDisplayString(todayLabel.value), 7)) : vue.createCommentVNode("", true)
10375
- ], 2)
10275
+ ])
10376
10276
  ], 2)
10377
10277
  ], 2),
10378
10278
  showInvalidMessage.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$e, vue.toDisplayString(props.invalidMessage), 1)) : vue.createCommentVNode("", true)
@@ -18615,6 +18515,11 @@ function parsePhoneNumber$1() {
18615
18515
  function getCountries$1(metadata2) {
18616
18516
  return new Metadata(metadata2).getCountries();
18617
18517
  }
18518
+ function getExampleNumber$1(country, examples2, metadata2) {
18519
+ if (examples2[country]) {
18520
+ return new PhoneNumber$1(country, examples2[country], metadata2);
18521
+ }
18522
+ }
18618
18523
  class PhoneNumber2 extends PhoneNumber$1 {
18619
18524
  constructor(number) {
18620
18525
  super(number, metadata);
@@ -18629,6 +18534,9 @@ function getCountries() {
18629
18534
  function getCountryCallingCode() {
18630
18535
  return withMetadataArgument(getCountryCallingCode$1, arguments);
18631
18536
  }
18537
+ function getExampleNumber() {
18538
+ return withMetadataArgument(getExampleNumber$1, arguments);
18539
+ }
18632
18540
  function resolveDisplayLocale(locale) {
18633
18541
  const trimmed = locale.trim();
18634
18542
  if (!trimmed) {
@@ -18702,6 +18610,90 @@ function filterCountryOptions(options, query) {
18702
18610
  return option.label.toLowerCase().includes(normalizedQuery) || option.countryName.toLowerCase().includes(normalizedQuery) || option.value.toLowerCase().includes(normalizedQuery) || dialCode.includes(normalizedQuery) || `+${dialCode}`.includes(normalizedQuery);
18703
18611
  });
18704
18612
  }
18613
+ const examples = { "AC": "40123", "AD": "312345", "AE": "501234567", "AF": "701234567", "AG": "2684641234", "AI": "2642351234", "AL": "672123456", "AM": "77123456", "AO": "923123456", "AR": "91123456789", "AS": "6847331234", "AT": "664123456", "AU": "412345678", "AW": "5601234", "AX": "412345678", "AZ": "401234567", "BA": "61123456", "BB": "2462501234", "BD": "1812345678", "BE": "450001234", "BF": "70123456", "BG": "43012345", "BH": "36001234", "BI": "79561234", "BJ": "0195123456", "BL": "690001234", "BM": "4413701234", "BN": "7123456", "BO": "71234567", "BQ": "3181234", "BR": "11961234567", "BS": "2423591234", "BT": "17123456", "BW": "71123456", "BY": "294911911", "BZ": "6221234", "CA": "5062345678", "CC": "412345678", "CD": "991234567", "CF": "70012345", "CG": "061234567", "CH": "781234567", "CI": "0123456789", "CK": "71234", "CL": "221234567", "CM": "671234567", "CN": "13123456789", "CO": "3211234567", "CR": "83123456", "CU": "51234567", "CV": "9911234", "CW": "95181234", "CX": "412345678", "CY": "96123456", "CZ": "601123456", "DE": "15123456789", "DJ": "77831001", "DK": "34412345", "DM": "7672251234", "DO": "8092345678", "DZ": "551234567", "EC": "991234567", "EE": "51234567", "EG": "1001234567", "EH": "650123456", "ER": "7123456", "ES": "612345678", "ET": "911234567", "FI": "412345678", "FJ": "7012345", "FK": "51234", "FM": "3501234", "FO": "211234", "FR": "612345678", "GA": "06031234", "GB": "7400123456", "GD": "4734031234", "GE": "555123456", "GF": "694201234", "GG": "7781123456", "GH": "231234567", "GI": "57123456", "GL": "221234", "GM": "3012345", "GN": "601123456", "GP": "690001234", "GQ": "222123456", "GR": "6912345678", "GT": "51234567", "GU": "6713001234", "GW": "955012345", "GY": "6091234", "HK": "51234567", "HN": "91234567", "HR": "921234567", "HT": "34101234", "HU": "201234567", "ID": "812345678", "IE": "850123456", "IL": "502345678", "IM": "7924123456", "IN": "8123456789", "IO": "3801234", "IQ": "7912345678", "IR": "9123456789", "IS": "6111234", "IT": "3123456789", "JE": "7797712345", "JM": "8762101234", "JO": "790123456", "JP": "9012345678", "KE": "712123456", "KG": "700123456", "KH": "91234567", "KI": "72001234", "KM": "3212345", "KN": "8697652917", "KP": "1921234567", "KR": "1020000000", "KW": "50012345", "KY": "3453231234", "KZ": "7710009998", "LA": "2023123456", "LB": "71123456", "LC": "7582845678", "LI": "660234567", "LK": "712345678", "LR": "770123456", "LS": "50123456", "LT": "61234567", "LU": "628123456", "LV": "21234567", "LY": "912345678", "MA": "650123456", "MC": "612345678", "MD": "62112345", "ME": "60123456", "MF": "690001234", "MG": "321234567", "MH": "2351234", "MK": "72345678", "ML": "65012345", "MM": "92123456", "MN": "88123456", "MO": "66123456", "MP": "6702345678", "MQ": "696201234", "MR": "22123456", "MS": "6644923456", "MT": "96961234", "MU": "52512345", "MV": "7712345", "MW": "991234567", "MX": "2221234567", "MY": "123456789", "MZ": "821234567", "NA": "811234567", "NC": "751234", "NE": "93123456", "NF": "381234", "NG": "8021234567", "NI": "81234567", "NL": "612345678", "NO": "40612345", "NP": "9841234567", "NR": "5551234", "NU": "8884012", "NZ": "211234567", "OM": "92123456", "PA": "61234567", "PE": "912345678", "PF": "87123456", "PG": "70123456", "PH": "9051234567", "PK": "3012345678", "PL": "512345678", "PM": "551234", "PR": "7872345678", "PS": "599123456", "PT": "912345678", "PW": "6201234", "PY": "961456789", "QA": "33123456", "RE": "692123456", "RO": "712034567", "RS": "601234567", "RU": "9123456789", "RW": "720123456", "SA": "512345678", "SB": "7421234", "SC": "2510123", "SD": "911231234", "SE": "701234567", "SG": "81234567", "SH": "51234", "SI": "31234567", "SJ": "41234567", "SK": "912123456", "SL": "25123456", "SM": "66661212", "SN": "701234567", "SO": "71123456", "SR": "7412345", "SS": "977123456", "ST": "9812345", "SV": "70123456", "SX": "7215205678", "SY": "944567890", "SZ": "76123456", "TA": "8999", "TC": "6492311234", "TD": "63012345", "TG": "90112345", "TH": "812345678", "TJ": "917123456", "TK": "7290", "TL": "77212345", "TM": "66123456", "TN": "20123456", "TO": "7715123", "TR": "5012345678", "TT": "8682911234", "TV": "901234", "TW": "912345678", "TZ": "621234567", "UA": "501234567", "UG": "712345678", "US": "2015550123", "UY": "94231234", "UZ": "912345678", "VA": "3123456789", "VC": "7844301234", "VE": "4121234567", "VG": "2843001234", "VI": "3406421234", "VN": "912345678", "VU": "5912345", "WF": "821234", "WS": "7212345", "XK": "43201234", "YE": "712345678", "YT": "639012345", "ZA": "711234567", "ZM": "955123456", "ZW": "712345678" };
18614
+ const maskCache = /* @__PURE__ */ new Map();
18615
+ const getPhoneMaskForCountry = (countryIso2) => {
18616
+ const country = countryIso2.trim().toUpperCase();
18617
+ const cached = maskCache.get(country);
18618
+ if (cached) {
18619
+ return cached;
18620
+ }
18621
+ const example = getExampleNumber(country, examples);
18622
+ if (!example) {
18623
+ return void 0;
18624
+ }
18625
+ const groups = example.formatNational().split(/\D+/).filter(Boolean).map((part) => part.length);
18626
+ const mask = groups.map((size) => "0".repeat(size)).join(" ");
18627
+ maskCache.set(country, mask);
18628
+ return mask;
18629
+ };
18630
+ const nationalDigitsForMask = (parsed) => parsed.formatNational().replace(/\D/g, "");
18631
+ const tryParseForCountry = (candidate, country) => {
18632
+ const parsed = parsePhoneNumber(candidate, country) ?? parsePhoneNumber(candidate);
18633
+ if (!parsed?.isValid() || parsed.country !== country) {
18634
+ return void 0;
18635
+ }
18636
+ return parsed;
18637
+ };
18638
+ const shouldNormalizePhoneInput = (value, countryIso2) => {
18639
+ const trimmed = value.trim();
18640
+ if (!trimmed) {
18641
+ return false;
18642
+ }
18643
+ if (trimmed.includes("+") || trimmed.startsWith("00")) {
18644
+ return true;
18645
+ }
18646
+ const digits = trimmed.replace(/\D/g, "");
18647
+ const mask = getPhoneMaskForCountry(countryIso2);
18648
+ if (!mask) {
18649
+ return false;
18650
+ }
18651
+ const maxDigits = (mask.match(/0/g) ?? []).length;
18652
+ if (digits.length > maxDigits) {
18653
+ return true;
18654
+ }
18655
+ try {
18656
+ const callingCode = getCountryCallingCode(countryIso2);
18657
+ if (digits.startsWith(callingCode) && digits.length > maxDigits - 1) {
18658
+ return true;
18659
+ }
18660
+ } catch {
18661
+ return false;
18662
+ }
18663
+ return false;
18664
+ };
18665
+ const normalizeNationalPhoneInput = (value, countryIso2) => {
18666
+ const trimmed = value.trim();
18667
+ if (!trimmed) {
18668
+ return "";
18669
+ }
18670
+ const country = countryIso2.trim().toUpperCase();
18671
+ const digits = trimmed.replace(/\D/g, "");
18672
+ const candidates = /* @__PURE__ */ new Set([trimmed]);
18673
+ if (digits) {
18674
+ candidates.add(digits);
18675
+ candidates.add(`+${digits}`);
18676
+ }
18677
+ for (const candidate of candidates) {
18678
+ const parsed = tryParseForCountry(candidate, country);
18679
+ if (parsed) {
18680
+ return nationalDigitsForMask(parsed);
18681
+ }
18682
+ }
18683
+ try {
18684
+ const callingCode = getCountryCallingCode(country);
18685
+ if (digits.startsWith(callingCode) && digits.length > callingCode.length) {
18686
+ const withoutCode = digits.slice(callingCode.length);
18687
+ const parsed = tryParseForCountry(withoutCode, country) ?? tryParseForCountry(`0${withoutCode}`, country);
18688
+ if (parsed) {
18689
+ return nationalDigitsForMask(parsed);
18690
+ }
18691
+ }
18692
+ } catch {
18693
+ return trimmed;
18694
+ }
18695
+ return trimmed;
18696
+ };
18705
18697
  const _hoisted_1$5 = { class: "relative w-full" };
18706
18698
  const _hoisted_2$4 = { class: "absolute left-3 top-1/2 -translate-y-1/2 text-xl leading-none" };
18707
18699
  const _hoisted_3$4 = ["aria-expanded", "aria-label", "aria-controls", "aria-activedescendant", "value", "disabled"];
@@ -19186,12 +19178,9 @@ const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
19186
19178
  autocomplete: { default: "tel" },
19187
19179
  required: { type: Boolean, default: false },
19188
19180
  placeholder: { default: void 0 },
19189
- maxlength: { default: void 0 },
19190
- minlength: { default: void 0 },
19191
19181
  name: { default: void 0 },
19192
19182
  autofocus: { type: Boolean, default: false },
19193
- readonly: { type: Boolean, default: false },
19194
- pattern: { default: void 0 }
19183
+ readonly: { type: Boolean, default: false }
19195
19184
  }, {
19196
19185
  "modelValue": { default: "" },
19197
19186
  "modelModifiers": {},
@@ -19200,7 +19189,7 @@ const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
19200
19189
  }),
19201
19190
  emits: /* @__PURE__ */ vue.mergeModels(["update:modelValue", "update:country", "update:e164", "valid", "noCountryResults", "blur"], ["update:modelValue", "update:country"]),
19202
19191
  setup(__props, { emit: __emit }) {
19203
- const [nationalNumber, modelModifiers] = vue.useModel(__props, "modelValue");
19192
+ const [nationalNumber] = vue.useModel(__props, "modelValue");
19204
19193
  const country = vue.useModel(__props, "country");
19205
19194
  const attrs = vue.useAttrs();
19206
19195
  const props = __props;
@@ -19219,12 +19208,10 @@ const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
19219
19208
  autocomplete: props.autocomplete,
19220
19209
  required: props.required,
19221
19210
  placeholder: props.placeholder,
19222
- maxlength: props.maxlength,
19223
- minlength: props.minlength,
19224
19211
  name: props.name,
19225
19212
  autofocus: props.autofocus,
19226
19213
  readonly: props.readonly,
19227
- pattern: props.pattern,
19214
+ inputmode: "tel",
19228
19215
  ...inputAttrs.value
19229
19216
  }));
19230
19217
  const countryItems = vue.computed(() => {
@@ -19235,6 +19222,10 @@ const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
19235
19222
  props.defaultCountry
19236
19223
  );
19237
19224
  });
19225
+ const phoneMask = vue.computed(() => getPhoneMaskForCountry(country.value ?? props.defaultCountry));
19226
+ const phoneMaskOptions = vue.computed(() => ({
19227
+ prepare: (value) => applyPhoneNormalization(value, country.value ?? props.defaultCountry)
19228
+ }));
19238
19229
  const committedValid = vue.ref(null);
19239
19230
  const resolvedLabel = vue.computed(() => props.label === void 0 ? t("FdsPhonenumber.phoneNumber") : props.label);
19240
19231
  const resolvedInvalidMessage = vue.computed(
@@ -19258,6 +19249,18 @@ const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
19258
19249
  const result2 = validatePhoneNumber(nationalNumber.value ?? "", country.value ?? "SE");
19259
19250
  emit("update:e164", result2.isValid && result2.phoneNumber ? result2.phoneNumber : "");
19260
19251
  }
19252
+ function applyPhoneNormalization(value, countryCode = country.value ?? props.defaultCountry) {
19253
+ if (!shouldNormalizePhoneInput(value, countryCode)) {
19254
+ return value;
19255
+ }
19256
+ return normalizeNationalPhoneInput(value, countryCode);
19257
+ }
19258
+ vue.watch(nationalNumber, (value) => {
19259
+ const normalized = applyPhoneNormalization(value ?? "");
19260
+ if (normalized !== (value ?? "")) {
19261
+ nationalNumber.value = normalized;
19262
+ }
19263
+ });
19261
19264
  vue.watch(country, () => {
19262
19265
  if (committedValid.value === null) {
19263
19266
  return;
@@ -19265,6 +19268,10 @@ const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
19265
19268
  runValidation();
19266
19269
  });
19267
19270
  function handleBlur(ev) {
19271
+ const normalized = applyPhoneNormalization(nationalNumber.value ?? "");
19272
+ if (normalized !== (nationalNumber.value ?? "")) {
19273
+ nationalNumber.value = normalized;
19274
+ }
19268
19275
  runValidation();
19269
19276
  emit("blur", ev);
19270
19277
  }
@@ -19294,15 +19301,15 @@ const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
19294
19301
  vue.createVNode(_sfc_main$r, vue.mergeProps({
19295
19302
  modelValue: vue.unref(nationalNumber),
19296
19303
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => vue.isRef(nationalNumber) ? nationalNumber.value = $event : null),
19297
- modelModifiers: vue.unref(modelModifiers),
19298
- type: "tel",
19304
+ mask: phoneMask.value,
19305
+ "mask-options": phoneMaskOptions.value,
19299
19306
  valid: displayValid.value,
19300
19307
  disabled: __props.disabled,
19301
19308
  optional: __props.optional,
19302
19309
  ariaLabel: vue.unref(t)("FdsPhonenumber.phoneNumber"),
19303
19310
  "data-testid": __props.dataTestid ? `${__props.dataTestid}-number` : void 0,
19304
19311
  class: ["mb-0! min-w-0 flex-1", __props.inputClass ?? ""]
19305
- }, forwardedInputProps.value, { onBlur: handleBlur }), null, 16, ["modelValue", "modelModifiers", "valid", "disabled", "optional", "ariaLabel", "data-testid", "class"])
19312
+ }, forwardedInputProps.value, { onBlur: handleBlur }), null, 16, ["modelValue", "mask", "mask-options", "valid", "disabled", "optional", "ariaLabel", "data-testid", "class"])
19306
19313
  ]),
19307
19314
  noCountryResults.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$3, vue.toDisplayString(vue.unref(t)("FdsPhonenumber.noCountryResults")), 1)) : vue.createCommentVNode("", true),
19308
19315
  showInvalidMessage.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5$3, vue.toDisplayString(resolvedInvalidMessage.value), 1)) : vue.createCommentVNode("", true)