fds-vue-core 7.2.1 → 7.2.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.
- package/dist/components/Form/FdsPhonenumber/FdsPhonenumber.vue.d.ts +2 -0
- package/dist/components/Form/FdsPhonenumber/FdsPhonenumberCountryPicker.vue.d.ts +2 -3
- package/dist/components/Form/FdsPhonenumber/countries.d.ts +5 -3
- package/dist/components/Form/FdsPhonenumber/types.d.ts +1 -0
- package/dist/fds-vue-core.cjs.js +303 -128
- package/dist/fds-vue-core.cjs.js.map +1 -1
- package/dist/fds-vue-core.css +1 -1
- package/dist/fds-vue-core.es.js +303 -128
- package/dist/fds-vue-core.es.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +18 -18
- package/src/components/FdsWizard/FdsWizard.vue +1 -1
- package/src/components/Form/FdsPhonenumber/FdsPhonenumber.stories.ts +1 -1
- package/src/components/Form/FdsPhonenumber/FdsPhonenumber.vue +16 -4
- package/src/components/Form/FdsPhonenumber/FdsPhonenumberCountryPicker.vue +259 -72
- package/src/components/Form/FdsPhonenumber/countries.ts +19 -3
- package/src/components/Form/FdsPhonenumber/types.ts +1 -0
package/dist/fds-vue-core.es.js
CHANGED
|
@@ -828,7 +828,7 @@ const _hoisted_1$y = { class: "flex items-start gap-2" };
|
|
|
828
828
|
const _hoisted_2$q = { class: "h-7 flex items-center" };
|
|
829
829
|
const _hoisted_3$j = { class: "leading-7" };
|
|
830
830
|
const _hoisted_4$h = { class: "relative h-7" };
|
|
831
|
-
const _hoisted_5$
|
|
831
|
+
const _hoisted_5$g = {
|
|
832
832
|
key: 1,
|
|
833
833
|
class: "fds-block-alert-slot mb-0-last-child"
|
|
834
834
|
};
|
|
@@ -919,7 +919,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
|
919
919
|
}), null, 16, ["class"])) : createCommentVNode("", true)
|
|
920
920
|
])
|
|
921
921
|
], 2)) : createCommentVNode("", true),
|
|
922
|
-
isExpanded.value || !__props.collapsable ? (openBlock(), createElementBlock("div", _hoisted_5$
|
|
922
|
+
isExpanded.value || !__props.collapsable ? (openBlock(), createElementBlock("div", _hoisted_5$g, [
|
|
923
923
|
renderSlot(_ctx.$slots, "default")
|
|
924
924
|
])) : createCommentVNode("", true)
|
|
925
925
|
])
|
|
@@ -935,7 +935,7 @@ const _hoisted_2$p = {
|
|
|
935
935
|
};
|
|
936
936
|
const _hoisted_3$i = { class: "flex items-center gap-3" };
|
|
937
937
|
const _hoisted_4$g = { class: "flex items-start gap-3 leading-8" };
|
|
938
|
-
const _hoisted_5$
|
|
938
|
+
const _hoisted_5$f = { class: "mb-0-last-child" };
|
|
939
939
|
const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
940
940
|
__name: "FdsBlockContent",
|
|
941
941
|
props: {
|
|
@@ -990,7 +990,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
|
990
990
|
renderSlot(_ctx.$slots, "headerInfo")
|
|
991
991
|
])
|
|
992
992
|
])) : createCommentVNode("", true),
|
|
993
|
-
createElementVNode("div", _hoisted_5$
|
|
993
|
+
createElementVNode("div", _hoisted_5$f, [
|
|
994
994
|
renderSlot(_ctx.$slots, "default")
|
|
995
995
|
])
|
|
996
996
|
], 16, _hoisted_1$x);
|
|
@@ -1052,7 +1052,7 @@ const _hoisted_2$o = {
|
|
|
1052
1052
|
};
|
|
1053
1053
|
const _hoisted_3$h = { class: "inline-flex items-center" };
|
|
1054
1054
|
const _hoisted_4$f = { class: "flex items-center gap-2" };
|
|
1055
|
-
const _hoisted_5$
|
|
1055
|
+
const _hoisted_5$e = {
|
|
1056
1056
|
key: 0,
|
|
1057
1057
|
class: "w-full flex mt-2"
|
|
1058
1058
|
};
|
|
@@ -1164,7 +1164,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
|
|
|
1164
1164
|
])
|
|
1165
1165
|
])
|
|
1166
1166
|
], 2),
|
|
1167
|
-
unref(hasExtraRowSlot) && !isOpen.value ? (openBlock(), createElementBlock("span", _hoisted_5$
|
|
1167
|
+
unref(hasExtraRowSlot) && !isOpen.value ? (openBlock(), createElementBlock("span", _hoisted_5$e, [
|
|
1168
1168
|
renderSlot(_ctx.$slots, "extra-row")
|
|
1169
1169
|
])) : createCommentVNode("", true)
|
|
1170
1170
|
], 16),
|
|
@@ -1190,7 +1190,7 @@ const _hoisted_4$e = {
|
|
|
1190
1190
|
key: 0,
|
|
1191
1191
|
class: "mb-1"
|
|
1192
1192
|
};
|
|
1193
|
-
const _hoisted_5$
|
|
1193
|
+
const _hoisted_5$d = { class: "flex items-start justify-between gap-4" };
|
|
1194
1194
|
const _hoisted_6$9 = { class: "m-0 text-base font-main font-bold tracking-wide" };
|
|
1195
1195
|
const _hoisted_7$9 = { class: "flex items-start gap-3" };
|
|
1196
1196
|
const _hoisted_8$6 = {
|
|
@@ -1245,7 +1245,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
|
|
|
1245
1245
|
}, null, 8, ["name"]),
|
|
1246
1246
|
createElementVNode("div", _hoisted_3$g, [
|
|
1247
1247
|
__props.heading ? (openBlock(), createElementBlock("div", _hoisted_4$e, [
|
|
1248
|
-
createElementVNode("header", _hoisted_5$
|
|
1248
|
+
createElementVNode("header", _hoisted_5$d, [
|
|
1249
1249
|
createElementVNode("h3", _hoisted_6$9, toDisplayString(__props.heading), 1),
|
|
1250
1250
|
createElementVNode("div", _hoisted_7$9, [
|
|
1251
1251
|
renderSlot(_ctx.$slots, "headerInfo")
|
|
@@ -9442,7 +9442,7 @@ const _hoisted_3$d = {
|
|
|
9442
9442
|
class: "max-h-72 overflow-auto border border-gray-200 rounded-md"
|
|
9443
9443
|
};
|
|
9444
9444
|
const _hoisted_4$c = { class: "w-full text-left text-xs border-collapse" };
|
|
9445
|
-
const _hoisted_5$
|
|
9445
|
+
const _hoisted_5$c = { class: "bg-gray-50" };
|
|
9446
9446
|
const _hoisted_6$8 = { class: "py-2 px-3 font-semibold" };
|
|
9447
9447
|
const _hoisted_7$8 = { class: "py-2 px-3 font-semibold" };
|
|
9448
9448
|
const _hoisted_8$5 = ["onClick"];
|
|
@@ -9757,7 +9757,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
9757
9757
|
default: withCtx(() => [
|
|
9758
9758
|
!localStorageEntries.value.length ? (openBlock(), createElementBlock("div", _hoisted_2$g, toDisplayString(unref(t)("FdsDevModeStorage.empty.localStorage")), 1)) : (openBlock(), createElementBlock("div", _hoisted_3$d, [
|
|
9759
9759
|
createElementVNode("table", _hoisted_4$c, [
|
|
9760
|
-
createElementVNode("thead", _hoisted_5$
|
|
9760
|
+
createElementVNode("thead", _hoisted_5$c, [
|
|
9761
9761
|
createElementVNode("tr", null, [
|
|
9762
9762
|
createElementVNode("th", _hoisted_6$8, toDisplayString(unref(t)("FdsDevModeStorage.keyLabel")), 1),
|
|
9763
9763
|
createElementVNode("th", _hoisted_7$8, toDisplayString(unref(t)("FdsDevModeStorage.valueLabel")), 1)
|
|
@@ -10167,7 +10167,7 @@ const _hoisted_1$h = ["id"];
|
|
|
10167
10167
|
const _hoisted_2$e = { class: "flex items-center justify-start gap-1 w-[100px]" };
|
|
10168
10168
|
const _hoisted_3$c = { class: "flex items-center justify-center w-auto gap-2 order-0 sm:order-0" };
|
|
10169
10169
|
const _hoisted_4$b = { class: "whitespace-nowrap" };
|
|
10170
|
-
const _hoisted_5$
|
|
10170
|
+
const _hoisted_5$b = { class: "flex items-center justify-end gap-1 order-2 sm:order-0 w-[100px]" };
|
|
10171
10171
|
const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
10172
10172
|
__name: "FdsPagination",
|
|
10173
10173
|
props: {
|
|
@@ -10315,7 +10315,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
10315
10315
|
createElementVNode("div", _hoisted_4$b, "/ " + toDisplayString(__props.max), 1)
|
|
10316
10316
|
], 64))
|
|
10317
10317
|
]),
|
|
10318
|
-
createElementVNode("div", _hoisted_5$
|
|
10318
|
+
createElementVNode("div", _hoisted_5$b, [
|
|
10319
10319
|
__props.loading && loadingIndicator.value === "next" ? (openBlock(), createBlock(_sfc_main$D, {
|
|
10320
10320
|
key: 0,
|
|
10321
10321
|
size: "24px",
|
|
@@ -10355,7 +10355,7 @@ const _hoisted_1$g = { class: "inline-flex" };
|
|
|
10355
10355
|
const _hoisted_2$d = ["onKeydown"];
|
|
10356
10356
|
const _hoisted_3$b = ["aria-label"];
|
|
10357
10357
|
const _hoisted_4$a = { class: "mb-1 flex items-start justify-between gap-2" };
|
|
10358
|
-
const _hoisted_5$
|
|
10358
|
+
const _hoisted_5$a = { class: "mb-0! min-w-0 whitespace-normal balance-text pr-2" };
|
|
10359
10359
|
const _hoisted_6$7 = {
|
|
10360
10360
|
key: 1,
|
|
10361
10361
|
class: "flex items-center gap-2"
|
|
@@ -10510,7 +10510,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
10510
10510
|
onClick: closePopover
|
|
10511
10511
|
}, null, 8, ["aria-label"])
|
|
10512
10512
|
]),
|
|
10513
|
-
createElementVNode("p", _hoisted_5$
|
|
10513
|
+
createElementVNode("p", _hoisted_5$a, [
|
|
10514
10514
|
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
10515
10515
|
createTextVNode(toDisplayString(__props.body), 1)
|
|
10516
10516
|
])
|
|
@@ -10613,7 +10613,7 @@ const _hoisted_2$c = {
|
|
|
10613
10613
|
};
|
|
10614
10614
|
const _hoisted_3$a = { class: "relative" };
|
|
10615
10615
|
const _hoisted_4$9 = { key: 1 };
|
|
10616
|
-
const _hoisted_5$
|
|
10616
|
+
const _hoisted_5$9 = { class: "font-bold mb-2 tracking-wide" };
|
|
10617
10617
|
const _hoisted_6$6 = {
|
|
10618
10618
|
key: 0,
|
|
10619
10619
|
class: "flex justify-center p-4"
|
|
@@ -11049,7 +11049,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
11049
11049
|
}), null, 16, ["label", "meta", "labelLeft", "valid", "invalidMessage", "disabled", "value", "clearButton", "mask", "maskOptions", "searchIcon"])
|
|
11050
11050
|
])
|
|
11051
11051
|
])) : (openBlock(), createElementBlock("div", _hoisted_4$9, [
|
|
11052
|
-
createElementVNode("div", _hoisted_5$
|
|
11052
|
+
createElementVNode("div", _hoisted_5$9, toDisplayString(__props.singleItemLabel), 1),
|
|
11053
11053
|
createElementVNode("div", null, toDisplayString(singleItemName.value), 1)
|
|
11054
11054
|
])),
|
|
11055
11055
|
dropdownVisible.value && !singleItemName.value.length && !__props.disabled ? (openBlock(), createElementBlock("div", {
|
|
@@ -11772,7 +11772,7 @@ const _hoisted_1$c = { class: "relative block" };
|
|
|
11772
11772
|
const _hoisted_2$9 = { class: "relative" };
|
|
11773
11773
|
const _hoisted_3$9 = { class: "relative" };
|
|
11774
11774
|
const _hoisted_4$8 = { class: "flex items-center gap-2" };
|
|
11775
|
-
const _hoisted_5$
|
|
11775
|
+
const _hoisted_5$8 = ["id", "role", "onMouseup"];
|
|
11776
11776
|
const _hoisted_6$5 = ["innerHTML"];
|
|
11777
11777
|
const _hoisted_7$5 = ["onClick"];
|
|
11778
11778
|
const _hoisted_8$3 = ["innerHTML"];
|
|
@@ -12574,7 +12574,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
12574
12574
|
_: 2
|
|
12575
12575
|
}, 1032, ["id", "value", "checked", "onChange", "onKeydown"]))
|
|
12576
12576
|
], 14, _hoisted_7$5))
|
|
12577
|
-
], 42, _hoisted_5$
|
|
12577
|
+
], 42, _hoisted_5$8);
|
|
12578
12578
|
}), 128)),
|
|
12579
12579
|
unref(shouldShowLoadMore) ? (openBlock(), createElementBlock("li", _hoisted_10$1, [
|
|
12580
12580
|
createElementVNode("div", {
|
|
@@ -13119,7 +13119,7 @@ const _hoisted_1$b = { class: "flex items-start" };
|
|
|
13119
13119
|
const _hoisted_2$8 = { class: "flex-1 flex" };
|
|
13120
13120
|
const _hoisted_3$8 = ["innerHTML"];
|
|
13121
13121
|
const _hoisted_4$7 = { key: 1 };
|
|
13122
|
-
const _hoisted_5$
|
|
13122
|
+
const _hoisted_5$7 = { key: 0 };
|
|
13123
13123
|
const _hoisted_6$4 = {
|
|
13124
13124
|
key: 2,
|
|
13125
13125
|
class: "items-center max-h-[28px]"
|
|
@@ -13374,7 +13374,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
13374
13374
|
innerHTML: unref(treeState)?.highlightText(__props.title, unref(treeState)?.searchTerm?.value)
|
|
13375
13375
|
}, null, 8, _hoisted_3$8)) : (openBlock(), createElementBlock("span", _hoisted_4$7, toDisplayString(__props.title), 1))
|
|
13376
13376
|
]),
|
|
13377
|
-
childCount.value !== null ? (openBlock(), createElementBlock("span", _hoisted_5$
|
|
13377
|
+
childCount.value !== null ? (openBlock(), createElementBlock("span", _hoisted_5$7, toDisplayString(unref(t)("FdsTreeView.childrenCountPrefix")) + toDisplayString(childCount.value) + ")", 1)) : createCommentVNode("", true)
|
|
13378
13378
|
]),
|
|
13379
13379
|
_: 1
|
|
13380
13380
|
}, 8, ["id", "checked", "indeterminate"])
|
|
@@ -15382,7 +15382,7 @@ const _hoisted_1$7 = { class: "mb-6" };
|
|
|
15382
15382
|
const _hoisted_2$6 = { class: "max-w-[487px]" };
|
|
15383
15383
|
const _hoisted_3$6 = { class: "mb-3 flex w-full flex-row items-center" };
|
|
15384
15384
|
const _hoisted_4$6 = { class: "m-0 font-bold text-gray-800" };
|
|
15385
|
-
const _hoisted_5$
|
|
15385
|
+
const _hoisted_5$6 = { class: "ml-auto flex flex-row justify-end gap-4" };
|
|
15386
15386
|
const _hoisted_6$3 = { class: "relative h-[64px] overflow-hidden" };
|
|
15387
15387
|
const _hoisted_7$3 = {
|
|
15388
15388
|
key: 0,
|
|
@@ -15526,7 +15526,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
15526
15526
|
createElementVNode("div", _hoisted_2$6, [
|
|
15527
15527
|
createElementVNode("div", _hoisted_3$6, [
|
|
15528
15528
|
createElementVNode("p", _hoisted_4$6, toDisplayString(weekText.value), 1),
|
|
15529
|
-
createElementVNode("div", _hoisted_5$
|
|
15529
|
+
createElementVNode("div", _hoisted_5$6, [
|
|
15530
15530
|
createVNode(_sfc_main$K, {
|
|
15531
15531
|
icon: "arrowLeft",
|
|
15532
15532
|
disabled: disableLastWeekInteraction.value,
|
|
@@ -15633,7 +15633,7 @@ const _hoisted_3$5 = {
|
|
|
15633
15633
|
class: "mt-2 mb-0"
|
|
15634
15634
|
};
|
|
15635
15635
|
const _hoisted_4$5 = { class: "h-[2px] absolute top-[22px] left-[50%] bg-white-solid transform -translate-x-1/2 w-[calc(100%-50px)]" };
|
|
15636
|
-
const _hoisted_5$
|
|
15636
|
+
const _hoisted_5$5 = { class: "flex justify-between list-none mb-8 p-0" };
|
|
15637
15637
|
const _hoisted_6$2 = ["onClick", "disabled"];
|
|
15638
15638
|
const _hoisted_7$2 = { key: 0 };
|
|
15639
15639
|
const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
@@ -16030,7 +16030,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
16030
16030
|
style: normalizeStyle({ width: progressWidth.value })
|
|
16031
16031
|
}, null, 4)
|
|
16032
16032
|
]),
|
|
16033
|
-
createElementVNode("div", _hoisted_5$
|
|
16033
|
+
createElementVNode("div", _hoisted_5$5, [
|
|
16034
16034
|
createElementVNode("ol", {
|
|
16035
16035
|
ref_key: "stepperListRef",
|
|
16036
16036
|
ref: stepperListRef,
|
|
@@ -16059,7 +16059,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
16059
16059
|
createElementVNode("span", {
|
|
16060
16060
|
ref_for: true,
|
|
16061
16061
|
ref: (el) => setStepLabelRef(el, visibleIndex),
|
|
16062
|
-
class: normalizeClass(["absolute bottom-0 text-blue-600 font-bold text-sm", { invisible: !showStepLabels.value }])
|
|
16062
|
+
class: normalizeClass(["absolute bottom-0 text-blue-600 font-bold text-sm whitespace-nowrap", { invisible: !showStepLabels.value }])
|
|
16063
16063
|
}, toDisplayString(entry.route.meta.wizard.name), 3)
|
|
16064
16064
|
], 10, _hoisted_6$2)
|
|
16065
16065
|
]);
|
|
@@ -18196,15 +18196,26 @@ function getLocalizedCountryName(iso2, locale) {
|
|
|
18196
18196
|
const displayNames = createCountryDisplayNames(resolveDisplayLocale(locale));
|
|
18197
18197
|
return displayNames?.of(iso2) ?? iso2;
|
|
18198
18198
|
}
|
|
18199
|
-
|
|
18199
|
+
const PRIORITIZED_COUNTRIES = ["SE", "NO", "DK", "FI"];
|
|
18200
|
+
function isPrioritizedCountry(iso2) {
|
|
18201
|
+
return PRIORITIZED_COUNTRIES.includes(iso2);
|
|
18202
|
+
}
|
|
18203
|
+
function sortCountryOptionsByName(options, locale = "sv-SE", _preferredCountry = "SE") {
|
|
18200
18204
|
const sortLocale = resolveDisplayLocale(locale).split(/[-_]/)[0] || "sv";
|
|
18201
18205
|
return [...options].sort((a, b) => {
|
|
18206
|
+
const priorityA = PRIORITIZED_COUNTRIES.indexOf(a.value);
|
|
18207
|
+
const priorityB = PRIORITIZED_COUNTRIES.indexOf(b.value);
|
|
18208
|
+
if (priorityA !== -1 || priorityB !== -1) {
|
|
18209
|
+
if (priorityA === -1) return 1;
|
|
18210
|
+
if (priorityB === -1) return -1;
|
|
18211
|
+
if (priorityA !== priorityB) return priorityA - priorityB;
|
|
18212
|
+
}
|
|
18202
18213
|
const nameA = a.countryName || a.label;
|
|
18203
18214
|
const nameB = b.countryName || b.label;
|
|
18204
18215
|
return nameA.localeCompare(nameB, sortLocale);
|
|
18205
18216
|
});
|
|
18206
18217
|
}
|
|
18207
|
-
function buildCountryOptions(locale = "sv-SE") {
|
|
18218
|
+
function buildCountryOptions(locale = "sv-SE", preferredCountry = "SE") {
|
|
18208
18219
|
const options = getCountries().map((iso2) => {
|
|
18209
18220
|
const countryName = getLocalizedCountryName(iso2, locale);
|
|
18210
18221
|
const countryCode = getCountryCallingCode(iso2);
|
|
@@ -18215,7 +18226,7 @@ function buildCountryOptions(locale = "sv-SE") {
|
|
|
18215
18226
|
countryName
|
|
18216
18227
|
};
|
|
18217
18228
|
});
|
|
18218
|
-
return sortCountryOptionsByName(options, locale);
|
|
18229
|
+
return sortCountryOptionsByName(options, locale, preferredCountry);
|
|
18219
18230
|
}
|
|
18220
18231
|
function countryCodeToFlag(iso2) {
|
|
18221
18232
|
const normalized = iso2.trim().toUpperCase();
|
|
@@ -18237,29 +18248,19 @@ function filterCountryOptions(options, query) {
|
|
|
18237
18248
|
});
|
|
18238
18249
|
}
|
|
18239
18250
|
const _hoisted_1$5 = { class: "relative w-full" };
|
|
18240
|
-
const _hoisted_2$4 = {
|
|
18241
|
-
|
|
18242
|
-
|
|
18243
|
-
|
|
18244
|
-
|
|
18245
|
-
const
|
|
18246
|
-
const
|
|
18247
|
-
const
|
|
18248
|
-
key: 0,
|
|
18249
|
-
class: "px-3 text-sm text-gray-700"
|
|
18250
|
-
};
|
|
18251
|
-
const _hoisted_6$1 = ["id", "aria-selected"];
|
|
18252
|
-
const _hoisted_7$1 = ["onMousedown"];
|
|
18253
|
-
const _hoisted_8 = {
|
|
18251
|
+
const _hoisted_2$4 = { class: "absolute left-3 top-1/2 -translate-y-1/2 text-xl leading-none" };
|
|
18252
|
+
const _hoisted_3$4 = ["aria-expanded", "aria-label", "aria-controls", "aria-activedescendant", "value", "disabled"];
|
|
18253
|
+
const _hoisted_4$4 = ["disabled"];
|
|
18254
|
+
const _hoisted_5$4 = ["id", "aria-selected"];
|
|
18255
|
+
const _hoisted_6$1 = ["onMouseenter", "onClick"];
|
|
18256
|
+
const _hoisted_7$1 = { class: "flex items-center gap-2" };
|
|
18257
|
+
const _hoisted_8 = { class: "flex items-center gap-3" };
|
|
18258
|
+
const _hoisted_9 = {
|
|
18254
18259
|
class: "shrink-0 text-xl leading-none",
|
|
18255
18260
|
"aria-hidden": "true"
|
|
18256
18261
|
};
|
|
18257
|
-
const
|
|
18258
|
-
const
|
|
18259
|
-
const _hoisted_11 = {
|
|
18260
|
-
class: "flex w-5 shrink-0 items-center justify-center",
|
|
18261
|
-
"aria-hidden": "true"
|
|
18262
|
-
};
|
|
18262
|
+
const _hoisted_10 = { class: "text-gray-600" };
|
|
18263
|
+
const _hoisted_11 = { "aria-hidden": "true" };
|
|
18263
18264
|
const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
18264
18265
|
__name: "FdsPhonenumberCountryPicker",
|
|
18265
18266
|
props: /* @__PURE__ */ mergeModels({
|
|
@@ -18267,48 +18268,88 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
18267
18268
|
valid: { type: [Boolean, null], default: void 0 },
|
|
18268
18269
|
disabled: { type: Boolean, default: false },
|
|
18269
18270
|
ariaLabel: { default: void 0 },
|
|
18270
|
-
noResultsLabel: { default: "" },
|
|
18271
18271
|
dataTestid: { default: void 0 },
|
|
18272
18272
|
class: { type: [Boolean, null, String, Object, Array], default: void 0 }
|
|
18273
18273
|
}, {
|
|
18274
18274
|
"modelValue": { required: true },
|
|
18275
18275
|
"modelModifiers": {}
|
|
18276
18276
|
}),
|
|
18277
|
-
emits: ["update:modelValue"],
|
|
18278
|
-
setup(__props) {
|
|
18277
|
+
emits: /* @__PURE__ */ mergeModels(["noCountryResults"], ["update:modelValue"]),
|
|
18278
|
+
setup(__props, { emit: __emit }) {
|
|
18279
18279
|
const { t } = useFdsI18n();
|
|
18280
18280
|
const country = useModel(__props, "modelValue");
|
|
18281
|
+
const emit = __emit;
|
|
18281
18282
|
const props = __props;
|
|
18282
18283
|
const rootRef = ref(null);
|
|
18283
|
-
const listRef = ref(null);
|
|
18284
18284
|
const inputRef = ref(null);
|
|
18285
18285
|
const searchQuery = ref("");
|
|
18286
18286
|
const dropdownOpen = ref(false);
|
|
18287
18287
|
const isFocused = ref(false);
|
|
18288
|
+
const hoveredCountry = ref(null);
|
|
18289
|
+
const activeIndex = ref(-1);
|
|
18290
|
+
const listboxId = `fds-phone-country-listbox-${Math.random().toString(36).slice(2, 9)}`;
|
|
18288
18291
|
const selectedCountry = computed(() => props.items.find((item) => item.value === country.value));
|
|
18289
18292
|
const filteredCountries = computed(() => filterCountryOptions(props.items, searchQuery.value));
|
|
18293
|
+
const lastPrioritizedFilteredIndex = computed(
|
|
18294
|
+
() => filteredCountries.value.reduce(
|
|
18295
|
+
(lastIndex, option, index) => isPrioritizedCountry(option.value) ? index : lastIndex,
|
|
18296
|
+
-1
|
|
18297
|
+
)
|
|
18298
|
+
);
|
|
18299
|
+
const hasNoCountryResults = computed(
|
|
18300
|
+
() => dropdownOpen.value && !props.disabled && searchQuery.value.trim().length > 0 && filteredCountries.value.length === 0
|
|
18301
|
+
);
|
|
18290
18302
|
const isInvalid = computed(() => props.valid === false && !props.disabled);
|
|
18291
|
-
const
|
|
18292
|
-
const
|
|
18293
|
-
|
|
18294
|
-
|
|
18303
|
+
const isSearching = computed(() => searchQuery.value.length > 0);
|
|
18304
|
+
const isHoverPreview = computed(() => !!hoveredCountry.value && dropdownOpen.value);
|
|
18305
|
+
const activeCountry = computed(() => {
|
|
18306
|
+
if (activeIndex.value < 0) {
|
|
18307
|
+
return null;
|
|
18295
18308
|
}
|
|
18296
|
-
|
|
18297
|
-
|
|
18309
|
+
return filteredCountries.value[activeIndex.value] ?? null;
|
|
18310
|
+
});
|
|
18311
|
+
const showSelectedDialPreview = computed(() => !!selectedCountry.value && !isSearching.value && !isHoverPreview.value);
|
|
18312
|
+
const showHoverDialPreview = computed(() => isHoverPreview.value && !!hoveredCountry.value);
|
|
18313
|
+
const showActiveDialPreview = computed(
|
|
18314
|
+
() => !showHoverDialPreview.value && !!activeCountry.value && dropdownOpen.value && !isSearching.value
|
|
18315
|
+
);
|
|
18316
|
+
const showDialPreviewPadding = computed(
|
|
18317
|
+
() => showSelectedDialPreview.value || showHoverDialPreview.value || showActiveDialPreview.value
|
|
18318
|
+
);
|
|
18319
|
+
const dialPreviewCountry = computed(() => {
|
|
18320
|
+
if (showHoverDialPreview.value && hoveredCountry.value) {
|
|
18321
|
+
return hoveredCountry.value;
|
|
18322
|
+
}
|
|
18323
|
+
if (showActiveDialPreview.value && activeCountry.value) {
|
|
18324
|
+
return activeCountry.value;
|
|
18325
|
+
}
|
|
18326
|
+
if (showSelectedDialPreview.value && selectedCountry.value) {
|
|
18327
|
+
return selectedCountry.value;
|
|
18298
18328
|
}
|
|
18299
|
-
return
|
|
18329
|
+
return null;
|
|
18300
18330
|
});
|
|
18331
|
+
const activeDescendantId = computed(
|
|
18332
|
+
() => activeIndex.value >= 0 ? `fds-phone-country-option-${activeIndex.value}` : void 0
|
|
18333
|
+
);
|
|
18301
18334
|
const inputDataAttrs = computed(() => props.dataTestid ? { "data-testid": props.dataTestid } : {});
|
|
18302
18335
|
const listDataAttrs = computed(() => props.dataTestid ? { "data-testid": `${props.dataTestid}-list` } : {});
|
|
18336
|
+
const dialPreviewClasses = computed(() => [
|
|
18337
|
+
"pointer-events-none absolute inset-0 flex items-center pl-10 pr-10 text-base leading-6 tabular-nums",
|
|
18338
|
+
showHoverDialPreview.value ? "text-gray-900/50" : "text-gray-900"
|
|
18339
|
+
]);
|
|
18303
18340
|
const inputClasses = computed(() => [
|
|
18304
18341
|
"block w-full h-12 rounded-md border border-gray-500 py-2 text-base leading-6 tabular-nums",
|
|
18305
|
-
|
|
18342
|
+
showDialPreviewPadding.value ? "pl-10 pr-10" : "px-3 pr-10",
|
|
18306
18343
|
"focus:outline-2 focus:outline-blue-500 -outline-offset-2 focus:border-transparent",
|
|
18307
|
-
props.disabled ? "text-gray-800 outline-dashed outline-2 outline-gray-400 cursor-not-allowed border-transparent bg-gray-50" : "bg-white text-gray-900",
|
|
18344
|
+
props.disabled ? "text-gray-800 outline-dashed outline-2 outline-gray-400 cursor-not-allowed border-transparent bg-gray-50" : "cursor-text bg-white text-gray-900",
|
|
18308
18345
|
isInvalid.value && "outline-2 -outline-offset-2 outline-red-600"
|
|
18309
18346
|
]);
|
|
18347
|
+
const arrowButtonClasses = computed(() => [
|
|
18348
|
+
"absolute right-0 top-0 z-10 flex h-12 w-10 items-center justify-center border-0 bg-transparent p-0",
|
|
18349
|
+
props.disabled ? "cursor-not-allowed" : "cursor-pointer"
|
|
18350
|
+
]);
|
|
18310
18351
|
const arrowClasses = computed(() => [
|
|
18311
|
-
"transition-transform duration-200 ease-in-out",
|
|
18352
|
+
"pointer-events-none transition-transform duration-200 ease-in-out",
|
|
18312
18353
|
{
|
|
18313
18354
|
"fill-gray-500": props.disabled,
|
|
18314
18355
|
"fill-red-600": isInvalid.value && !props.disabled,
|
|
@@ -18316,42 +18357,65 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
18316
18357
|
"rotate-180": dropdownOpen.value && !props.disabled
|
|
18317
18358
|
}
|
|
18318
18359
|
]);
|
|
18319
|
-
|
|
18320
|
-
if (!country.value) {
|
|
18321
|
-
return;
|
|
18322
|
-
}
|
|
18323
|
-
await nextTick();
|
|
18324
|
-
const list = listRef.value;
|
|
18325
|
-
if (!list) {
|
|
18326
|
-
return;
|
|
18327
|
-
}
|
|
18328
|
-
const selected = list.querySelector(`#fds-country-${country.value}`);
|
|
18329
|
-
if (!selected) {
|
|
18330
|
-
return;
|
|
18331
|
-
}
|
|
18332
|
-
const listRect = list.getBoundingClientRect();
|
|
18333
|
-
const itemRect = selected.getBoundingClientRect();
|
|
18334
|
-
const relativeTop = itemRect.top - listRect.top + list.scrollTop;
|
|
18335
|
-
list.scrollTop = relativeTop - (list.clientHeight - selected.offsetHeight) / 2;
|
|
18336
|
-
}
|
|
18337
|
-
async function openDropdown() {
|
|
18360
|
+
const openDropdown = () => {
|
|
18338
18361
|
if (props.disabled) {
|
|
18339
18362
|
return;
|
|
18340
18363
|
}
|
|
18341
18364
|
dropdownOpen.value = true;
|
|
18342
18365
|
isFocused.value = true;
|
|
18343
18366
|
searchQuery.value = "";
|
|
18344
|
-
|
|
18345
|
-
}
|
|
18346
|
-
|
|
18367
|
+
activeIndex.value = -1;
|
|
18368
|
+
};
|
|
18369
|
+
const clearHoverPreview = () => {
|
|
18370
|
+
hoveredCountry.value = null;
|
|
18371
|
+
};
|
|
18372
|
+
const clearActiveOption = () => {
|
|
18373
|
+
activeIndex.value = -1;
|
|
18374
|
+
};
|
|
18375
|
+
const setActiveIndex = (index) => {
|
|
18376
|
+
if (!filteredCountries.value.length) {
|
|
18377
|
+
clearActiveOption();
|
|
18378
|
+
return;
|
|
18379
|
+
}
|
|
18380
|
+
activeIndex.value = Math.max(0, Math.min(index, filteredCountries.value.length - 1));
|
|
18381
|
+
};
|
|
18382
|
+
const setActiveIndexToSelectedOrFirst = () => {
|
|
18383
|
+
const selectedIndex = filteredCountries.value.findIndex((option) => option.value === country.value);
|
|
18384
|
+
setActiveIndex(selectedIndex >= 0 ? selectedIndex : 0);
|
|
18385
|
+
};
|
|
18386
|
+
const setActiveIndexToSelectedOrLast = () => {
|
|
18387
|
+
const selectedIndex = filteredCountries.value.findIndex((option) => option.value === country.value);
|
|
18388
|
+
setActiveIndex(selectedIndex >= 0 ? selectedIndex : filteredCountries.value.length - 1);
|
|
18389
|
+
};
|
|
18390
|
+
const onOptionMouseEnter = (option) => {
|
|
18391
|
+
hoveredCountry.value = option;
|
|
18392
|
+
};
|
|
18393
|
+
const onOptionMouseLeave = () => {
|
|
18394
|
+
clearHoverPreview();
|
|
18395
|
+
};
|
|
18396
|
+
const closeDropdown = () => {
|
|
18347
18397
|
dropdownOpen.value = false;
|
|
18348
18398
|
isFocused.value = false;
|
|
18349
18399
|
searchQuery.value = "";
|
|
18350
|
-
|
|
18351
|
-
|
|
18400
|
+
clearHoverPreview();
|
|
18401
|
+
clearActiveOption();
|
|
18402
|
+
};
|
|
18403
|
+
const onInputFocus = () => {
|
|
18352
18404
|
openDropdown();
|
|
18353
|
-
}
|
|
18354
|
-
|
|
18405
|
+
};
|
|
18406
|
+
const onArrowPointerDown = () => {
|
|
18407
|
+
if (props.disabled) {
|
|
18408
|
+
return;
|
|
18409
|
+
}
|
|
18410
|
+
if (dropdownOpen.value) {
|
|
18411
|
+
closeDropdown();
|
|
18412
|
+
inputRef.value?.blur();
|
|
18413
|
+
return;
|
|
18414
|
+
}
|
|
18415
|
+
openDropdown();
|
|
18416
|
+
inputRef.value?.focus();
|
|
18417
|
+
};
|
|
18418
|
+
const onInputBlur = () => {
|
|
18355
18419
|
isFocused.value = false;
|
|
18356
18420
|
window.setTimeout(() => {
|
|
18357
18421
|
if (!dropdownOpen.value) {
|
|
@@ -18359,27 +18423,85 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
18359
18423
|
}
|
|
18360
18424
|
closeDropdown();
|
|
18361
18425
|
}, 120);
|
|
18362
|
-
}
|
|
18363
|
-
|
|
18426
|
+
};
|
|
18427
|
+
const onSearchInput = (event) => {
|
|
18364
18428
|
const target = event.target;
|
|
18365
18429
|
searchQuery.value = target.value;
|
|
18430
|
+
clearActiveOption();
|
|
18366
18431
|
if (!dropdownOpen.value) {
|
|
18367
18432
|
dropdownOpen.value = true;
|
|
18368
18433
|
}
|
|
18369
|
-
}
|
|
18370
|
-
|
|
18434
|
+
};
|
|
18435
|
+
const onInputKeyDown = (event) => {
|
|
18436
|
+
if (props.disabled) {
|
|
18437
|
+
return;
|
|
18438
|
+
}
|
|
18439
|
+
if (event.key === "ArrowDown" && filteredCountries.value.length > 0) {
|
|
18440
|
+
event.preventDefault();
|
|
18441
|
+
clearHoverPreview();
|
|
18442
|
+
if (!dropdownOpen.value) {
|
|
18443
|
+
openDropdown();
|
|
18444
|
+
setActiveIndexToSelectedOrFirst();
|
|
18445
|
+
return;
|
|
18446
|
+
}
|
|
18447
|
+
if (activeIndex.value < 0) {
|
|
18448
|
+
setActiveIndexToSelectedOrFirst();
|
|
18449
|
+
return;
|
|
18450
|
+
}
|
|
18451
|
+
setActiveIndex(activeIndex.value + 1);
|
|
18452
|
+
return;
|
|
18453
|
+
}
|
|
18454
|
+
if (event.key === "ArrowUp" && filteredCountries.value.length > 0) {
|
|
18455
|
+
event.preventDefault();
|
|
18456
|
+
clearHoverPreview();
|
|
18457
|
+
if (!dropdownOpen.value) {
|
|
18458
|
+
openDropdown();
|
|
18459
|
+
setActiveIndexToSelectedOrLast();
|
|
18460
|
+
return;
|
|
18461
|
+
}
|
|
18462
|
+
if (activeIndex.value < 0) {
|
|
18463
|
+
setActiveIndexToSelectedOrLast();
|
|
18464
|
+
return;
|
|
18465
|
+
}
|
|
18466
|
+
setActiveIndex(activeIndex.value - 1);
|
|
18467
|
+
return;
|
|
18468
|
+
}
|
|
18469
|
+
if (event.key === "Enter") {
|
|
18470
|
+
if (!dropdownOpen.value && filteredCountries.value.length > 0) {
|
|
18471
|
+
event.preventDefault();
|
|
18472
|
+
openDropdown();
|
|
18473
|
+
setActiveIndexToSelectedOrFirst();
|
|
18474
|
+
return;
|
|
18475
|
+
}
|
|
18476
|
+
if (dropdownOpen.value && activeCountry.value) {
|
|
18477
|
+
event.preventDefault();
|
|
18478
|
+
selectCountry(activeCountry.value);
|
|
18479
|
+
}
|
|
18480
|
+
return;
|
|
18481
|
+
}
|
|
18482
|
+
if (event.key === "Escape" && dropdownOpen.value) {
|
|
18483
|
+
event.preventDefault();
|
|
18484
|
+
closeDropdown();
|
|
18485
|
+
inputRef.value?.focus();
|
|
18486
|
+
return;
|
|
18487
|
+
}
|
|
18488
|
+
if (event.key === "Tab" && dropdownOpen.value) {
|
|
18489
|
+
closeDropdown();
|
|
18490
|
+
}
|
|
18491
|
+
};
|
|
18492
|
+
const selectCountry = (option) => {
|
|
18371
18493
|
country.value = option.value;
|
|
18372
18494
|
closeDropdown();
|
|
18373
18495
|
inputRef.value?.blur();
|
|
18374
|
-
}
|
|
18375
|
-
|
|
18496
|
+
};
|
|
18497
|
+
const onClickOutside = (event) => {
|
|
18376
18498
|
if (!dropdownOpen.value || !rootRef.value) {
|
|
18377
18499
|
return;
|
|
18378
18500
|
}
|
|
18379
18501
|
if (!rootRef.value.contains(event.target)) {
|
|
18380
18502
|
closeDropdown();
|
|
18381
18503
|
}
|
|
18382
|
-
}
|
|
18504
|
+
};
|
|
18383
18505
|
watch(
|
|
18384
18506
|
() => country.value,
|
|
18385
18507
|
() => {
|
|
@@ -18388,6 +18510,22 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
18388
18510
|
}
|
|
18389
18511
|
}
|
|
18390
18512
|
);
|
|
18513
|
+
watch(filteredCountries, (options) => {
|
|
18514
|
+
if (!options.length) {
|
|
18515
|
+
clearActiveOption();
|
|
18516
|
+
return;
|
|
18517
|
+
}
|
|
18518
|
+
if (activeIndex.value >= options.length) {
|
|
18519
|
+
setActiveIndex(options.length - 1);
|
|
18520
|
+
}
|
|
18521
|
+
});
|
|
18522
|
+
watch(
|
|
18523
|
+
hasNoCountryResults,
|
|
18524
|
+
(value) => {
|
|
18525
|
+
emit("noCountryResults", value);
|
|
18526
|
+
},
|
|
18527
|
+
{ immediate: true }
|
|
18528
|
+
);
|
|
18391
18529
|
onMounted(() => {
|
|
18392
18530
|
window.addEventListener("mousedown", onClickOutside);
|
|
18393
18531
|
});
|
|
@@ -18401,7 +18539,14 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
18401
18539
|
class: normalizeClass(["relative w-32", props.class])
|
|
18402
18540
|
}, [
|
|
18403
18541
|
createElementVNode("div", _hoisted_1$5, [
|
|
18404
|
-
|
|
18542
|
+
dialPreviewCountry.value ? (openBlock(), createElementBlock("div", {
|
|
18543
|
+
key: 0,
|
|
18544
|
+
class: normalizeClass(dialPreviewClasses.value),
|
|
18545
|
+
"aria-hidden": "true"
|
|
18546
|
+
}, [
|
|
18547
|
+
createElementVNode("span", _hoisted_2$4, toDisplayString(unref(countryCodeToFlag)(dialPreviewCountry.value.value)), 1),
|
|
18548
|
+
createTextVNode(" " + toDisplayString(unref(t)("common.plus")) + toDisplayString(dialPreviewCountry.value.countryCode), 1)
|
|
18549
|
+
], 2)) : createCommentVNode("", true),
|
|
18405
18550
|
createElementVNode("input", mergeProps({
|
|
18406
18551
|
ref_key: "inputRef",
|
|
18407
18552
|
ref: inputRef,
|
|
@@ -18410,58 +18555,78 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
18410
18555
|
role: "combobox",
|
|
18411
18556
|
"aria-expanded": dropdownOpen.value,
|
|
18412
18557
|
"aria-autocomplete": "list",
|
|
18558
|
+
"aria-haspopup": "listbox",
|
|
18413
18559
|
"aria-label": __props.ariaLabel,
|
|
18414
|
-
|
|
18560
|
+
"aria-controls": dropdownOpen.value ? listboxId : void 0,
|
|
18561
|
+
"aria-activedescendant": activeDescendantId.value,
|
|
18562
|
+
value: searchQuery.value,
|
|
18415
18563
|
disabled: __props.disabled,
|
|
18416
18564
|
class: inputClasses.value
|
|
18417
18565
|
}, inputDataAttrs.value, {
|
|
18418
18566
|
onFocus: onInputFocus,
|
|
18419
18567
|
onBlur: onInputBlur,
|
|
18420
|
-
|
|
18421
|
-
|
|
18568
|
+
onKeydown: onInputKeyDown,
|
|
18569
|
+
onInput: onSearchInput
|
|
18422
18570
|
}), null, 16, _hoisted_3$4),
|
|
18423
|
-
createElementVNode("
|
|
18571
|
+
createElementVNode("button", {
|
|
18572
|
+
type: "button",
|
|
18573
|
+
tabindex: "-1",
|
|
18574
|
+
disabled: __props.disabled,
|
|
18575
|
+
class: normalizeClass(arrowButtonClasses.value),
|
|
18576
|
+
"aria-hidden": "true",
|
|
18577
|
+
onMousedown: withModifiers(onArrowPointerDown, ["prevent"])
|
|
18578
|
+
}, [
|
|
18424
18579
|
createVNode(_sfc_main$L, {
|
|
18425
18580
|
name: "arrowDown",
|
|
18426
18581
|
size: 24,
|
|
18427
18582
|
class: normalizeClass(arrowClasses.value)
|
|
18428
18583
|
}, null, 8, ["class"])
|
|
18429
|
-
])
|
|
18584
|
+
], 42, _hoisted_4$4)
|
|
18430
18585
|
]),
|
|
18431
|
-
dropdownOpen.value && !__props.disabled ? (openBlock(), createElementBlock("ul", mergeProps({
|
|
18586
|
+
dropdownOpen.value && !__props.disabled && filteredCountries.value.length > 0 ? (openBlock(), createElementBlock("ul", mergeProps({
|
|
18432
18587
|
key: 0,
|
|
18433
|
-
ref_key: "listRef",
|
|
18434
|
-
ref: listRef,
|
|
18435
18588
|
role: "listbox",
|
|
18436
|
-
|
|
18437
|
-
|
|
18438
|
-
|
|
18439
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(filteredCountries.value, (option) => {
|
|
18589
|
+
id: listboxId,
|
|
18590
|
+
class: "absolute left-0 z-20 mt-1 min-w-[20rem] w-max max-w-[calc(100vw-2rem)] max-h-[280px] overflow-y-auto rounded-md border border-gray-300 bg-white"
|
|
18591
|
+
}, listDataAttrs.value, { onMouseleave: clearHoverPreview }), [
|
|
18592
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(filteredCountries.value, (option, index) => {
|
|
18440
18593
|
return openBlock(), createElementBlock("li", {
|
|
18441
18594
|
key: option.value,
|
|
18595
|
+
id: `fds-phone-country-option-${index}`,
|
|
18442
18596
|
role: "option",
|
|
18443
|
-
id: `fds-country-${option.value}`,
|
|
18444
18597
|
"aria-selected": option.value === country.value,
|
|
18445
|
-
class: "mb-0 border-b border-gray-100"
|
|
18598
|
+
class: normalizeClass(["mb-0 border-b border-gray-100 hover:bg-blue_t-100 active:bg-blue_t-200 last:border-b-0!", {
|
|
18599
|
+
"border-gray-300": index === lastPrioritizedFilteredIndex.value,
|
|
18600
|
+
"bg-blue_t-100": activeIndex.value === index
|
|
18601
|
+
}])
|
|
18446
18602
|
}, [
|
|
18447
18603
|
createElementVNode("button", {
|
|
18448
18604
|
type: "button",
|
|
18449
|
-
|
|
18450
|
-
|
|
18605
|
+
tabindex: "-1",
|
|
18606
|
+
class: "flex w-full items-center justify-between gap-2 py-4 px-3 text-left cursor-pointer",
|
|
18607
|
+
onMouseenter: ($event) => onOptionMouseEnter(option),
|
|
18608
|
+
onMouseleave: onOptionMouseLeave,
|
|
18609
|
+
onMousedown: _cache[0] || (_cache[0] = withModifiers(() => {
|
|
18610
|
+
}, ["prevent"])),
|
|
18611
|
+
onClick: ($event) => selectCountry(option)
|
|
18451
18612
|
}, [
|
|
18452
|
-
createElementVNode("span",
|
|
18453
|
-
|
|
18454
|
-
|
|
18613
|
+
createElementVNode("span", _hoisted_7$1, [
|
|
18614
|
+
createElementVNode("span", _hoisted_8, [
|
|
18615
|
+
createElementVNode("span", _hoisted_9, toDisplayString(unref(countryCodeToFlag)(option.value)), 1),
|
|
18616
|
+
createTextVNode(" " + toDisplayString(option.countryName), 1)
|
|
18617
|
+
]),
|
|
18618
|
+
createElementVNode("span", _hoisted_10, "(" + toDisplayString(unref(t)("common.plus")) + toDisplayString(option.countryCode) + ")", 1)
|
|
18619
|
+
]),
|
|
18455
18620
|
createElementVNode("span", _hoisted_11, [
|
|
18456
18621
|
option.value === country.value ? (openBlock(), createBlock(_sfc_main$L, {
|
|
18457
18622
|
key: 0,
|
|
18458
18623
|
name: "check",
|
|
18459
|
-
size:
|
|
18624
|
+
size: 24,
|
|
18460
18625
|
class: "fill-green-600"
|
|
18461
18626
|
})) : createCommentVNode("", true)
|
|
18462
18627
|
])
|
|
18463
|
-
], 40,
|
|
18464
|
-
],
|
|
18628
|
+
], 40, _hoisted_6$1)
|
|
18629
|
+
], 10, _hoisted_5$4);
|
|
18465
18630
|
}), 128))
|
|
18466
18631
|
], 16)) : createCommentVNode("", true)
|
|
18467
18632
|
], 2);
|
|
@@ -18547,11 +18712,15 @@ const _hoisted_2$3 = {
|
|
|
18547
18712
|
key: 1,
|
|
18548
18713
|
class: "font-thin mb-1"
|
|
18549
18714
|
};
|
|
18550
|
-
const _hoisted_3$3 = { class: "flex flex-wrap items-start" };
|
|
18715
|
+
const _hoisted_3$3 = { class: "flex flex-wrap items-start gap-x-1" };
|
|
18551
18716
|
const _hoisted_4$3 = {
|
|
18552
18717
|
key: 2,
|
|
18553
18718
|
class: "text-red-700 font-bold mt-1"
|
|
18554
18719
|
};
|
|
18720
|
+
const _hoisted_5$3 = {
|
|
18721
|
+
key: 3,
|
|
18722
|
+
class: "text-red-700 font-bold mt-1"
|
|
18723
|
+
};
|
|
18555
18724
|
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
18556
18725
|
...{
|
|
18557
18726
|
inheritAttrs: false
|
|
@@ -18579,7 +18748,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
18579
18748
|
"country": { default: "SE" },
|
|
18580
18749
|
"countryModifiers": {}
|
|
18581
18750
|
}),
|
|
18582
|
-
emits: /* @__PURE__ */ mergeModels(["update:country", "update:e164", "valid", "blur"], ["update:modelValue", "update:country"]),
|
|
18751
|
+
emits: /* @__PURE__ */ mergeModels(["update:country", "update:e164", "valid", "noCountryResults", "blur"], ["update:modelValue", "update:country"]),
|
|
18583
18752
|
setup(__props, { emit: __emit }) {
|
|
18584
18753
|
const nationalNumber = useModel(__props, "modelValue");
|
|
18585
18754
|
const country = useModel(__props, "country");
|
|
@@ -18588,10 +18757,11 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
18588
18757
|
const { t, locale: fdsLocale } = useFdsI18n();
|
|
18589
18758
|
const resolvedLocale = computed(() => props.locale ?? fdsLocale.value);
|
|
18590
18759
|
const countryItems = computed(() => {
|
|
18591
|
-
const options = props.countries?.length ? props.countries : buildCountryOptions(resolvedLocale.value);
|
|
18760
|
+
const options = props.countries?.length ? props.countries : buildCountryOptions(resolvedLocale.value, props.defaultCountry);
|
|
18592
18761
|
return sortCountryOptionsByName(
|
|
18593
18762
|
options.map((option) => ({ ...option })),
|
|
18594
|
-
resolvedLocale.value
|
|
18763
|
+
resolvedLocale.value,
|
|
18764
|
+
props.defaultCountry
|
|
18595
18765
|
);
|
|
18596
18766
|
});
|
|
18597
18767
|
const phoneValidationOptions = computed(() => ({ numberType: props.numberType }));
|
|
@@ -18606,6 +18776,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
18606
18776
|
const showInvalidMessage = computed(
|
|
18607
18777
|
() => displayValid.value === false && !props.optional && props.invalidMessage && !props.disabled
|
|
18608
18778
|
);
|
|
18779
|
+
const noCountryResults = ref(false);
|
|
18609
18780
|
function runValidation() {
|
|
18610
18781
|
const validationState = getPhoneValidationState(
|
|
18611
18782
|
nationalNumber.value ?? "",
|
|
@@ -18627,6 +18798,10 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
18627
18798
|
runValidation();
|
|
18628
18799
|
emit("blur", ev);
|
|
18629
18800
|
}
|
|
18801
|
+
function onNoCountryResults(value) {
|
|
18802
|
+
noCountryResults.value = value;
|
|
18803
|
+
emit("noCountryResults", value);
|
|
18804
|
+
}
|
|
18630
18805
|
return (_ctx, _cache) => {
|
|
18631
18806
|
return openBlock(), createElementBlock("div", _hoisted_1$4, [
|
|
18632
18807
|
__props.label ? (openBlock(), createElementBlock("label", {
|
|
@@ -18642,10 +18817,10 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
18642
18817
|
valid: displayValid.value,
|
|
18643
18818
|
disabled: __props.disabled,
|
|
18644
18819
|
ariaLabel: unref(t)("FdsPhonenumber.countryCode"),
|
|
18645
|
-
"no-results-label": unref(t)("FdsPhonenumber.noCountryResults"),
|
|
18646
18820
|
"data-testid": __props.dataTestid ? `${__props.dataTestid}-country` : void 0,
|
|
18647
|
-
class: normalizeClass(["mb-0! shrink-0", __props.selectClass ?? ""])
|
|
18648
|
-
|
|
18821
|
+
class: normalizeClass(["mb-0! shrink-0", __props.selectClass ?? ""]),
|
|
18822
|
+
onNoCountryResults
|
|
18823
|
+
}, null, 8, ["modelValue", "items", "valid", "disabled", "ariaLabel", "data-testid", "class"]),
|
|
18649
18824
|
createVNode(_sfc_main$u, {
|
|
18650
18825
|
modelValue: nationalNumber.value,
|
|
18651
18826
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => nationalNumber.value = $event),
|
|
@@ -18656,11 +18831,11 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
18656
18831
|
ariaLabel: unref(t)("FdsPhonenumber.phoneNumber"),
|
|
18657
18832
|
"data-testid": __props.dataTestid ? `${__props.dataTestid}-number` : void 0,
|
|
18658
18833
|
class: normalizeClass(["mb-0! min-w-0 flex-1", __props.inputClass ?? ""]),
|
|
18659
|
-
onBlur: handleBlur
|
|
18660
|
-
inputClass: [" rounded-l-none"]
|
|
18834
|
+
onBlur: handleBlur
|
|
18661
18835
|
}, null, 8, ["modelValue", "valid", "disabled", "optional", "ariaLabel", "data-testid", "class"])
|
|
18662
18836
|
]),
|
|
18663
|
-
|
|
18837
|
+
noCountryResults.value ? (openBlock(), createElementBlock("div", _hoisted_4$3, toDisplayString(unref(t)("FdsPhonenumber.noCountryResults")), 1)) : createCommentVNode("", true),
|
|
18838
|
+
showInvalidMessage.value ? (openBlock(), createElementBlock("div", _hoisted_5$3, toDisplayString(__props.invalidMessage), 1)) : createCommentVNode("", true)
|
|
18664
18839
|
]);
|
|
18665
18840
|
};
|
|
18666
18841
|
}
|