fds-vue-core 7.2.1 → 7.2.3
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 +302 -130
- 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 +302 -130
- 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 +256 -73
- 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,85 @@ 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 dialPreviewCountry = computed(() => {
|
|
18317
|
+
if (showHoverDialPreview.value && hoveredCountry.value) {
|
|
18318
|
+
return hoveredCountry.value;
|
|
18319
|
+
}
|
|
18320
|
+
if (showActiveDialPreview.value && activeCountry.value) {
|
|
18321
|
+
return activeCountry.value;
|
|
18298
18322
|
}
|
|
18299
|
-
|
|
18323
|
+
if (showSelectedDialPreview.value && selectedCountry.value) {
|
|
18324
|
+
return selectedCountry.value;
|
|
18325
|
+
}
|
|
18326
|
+
return null;
|
|
18300
18327
|
});
|
|
18328
|
+
const activeDescendantId = computed(
|
|
18329
|
+
() => activeIndex.value >= 0 ? `fds-phone-country-option-${activeIndex.value}` : void 0
|
|
18330
|
+
);
|
|
18301
18331
|
const inputDataAttrs = computed(() => props.dataTestid ? { "data-testid": props.dataTestid } : {});
|
|
18302
18332
|
const listDataAttrs = computed(() => props.dataTestid ? { "data-testid": `${props.dataTestid}-list` } : {});
|
|
18333
|
+
const dialPreviewClasses = computed(() => [
|
|
18334
|
+
"pointer-events-none absolute inset-0 flex items-center pl-10 pr-10 text-base leading-6 tabular-nums",
|
|
18335
|
+
showHoverDialPreview.value ? "text-gray-900/50" : "text-gray-900"
|
|
18336
|
+
]);
|
|
18303
18337
|
const inputClasses = computed(() => [
|
|
18304
|
-
"block w-full h-12 rounded-md border border-gray-500 py-2 text-base leading-6 tabular-nums",
|
|
18305
|
-
showSelectedPreview.value ? "pl-10 pr-10" : "px-3 pr-10",
|
|
18338
|
+
"block w-full h-12 rounded-md border border-gray-500 py-2 text-base leading-6 tabular-nums px-3 pr-10",
|
|
18306
18339
|
"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",
|
|
18308
|
-
isInvalid.value && "outline-2 -outline-offset-2 outline-red-600"
|
|
18340
|
+
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",
|
|
18341
|
+
isInvalid.value && "outline-2 -outline-offset-2 outline-red-600",
|
|
18342
|
+
hasNoCountryResults.value && "outline-red-600!"
|
|
18343
|
+
]);
|
|
18344
|
+
const arrowButtonClasses = computed(() => [
|
|
18345
|
+
"absolute right-0 top-0 z-10 flex h-12 w-10 items-center justify-center border-0 bg-transparent p-0",
|
|
18346
|
+
props.disabled ? "cursor-not-allowed" : "cursor-pointer"
|
|
18309
18347
|
]);
|
|
18310
18348
|
const arrowClasses = computed(() => [
|
|
18311
|
-
"transition-transform duration-200 ease-in-out",
|
|
18349
|
+
"pointer-events-none transition-transform duration-200 ease-in-out",
|
|
18312
18350
|
{
|
|
18313
18351
|
"fill-gray-500": props.disabled,
|
|
18314
18352
|
"fill-red-600": isInvalid.value && !props.disabled,
|
|
@@ -18316,42 +18354,65 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
18316
18354
|
"rotate-180": dropdownOpen.value && !props.disabled
|
|
18317
18355
|
}
|
|
18318
18356
|
]);
|
|
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() {
|
|
18357
|
+
const openDropdown = () => {
|
|
18338
18358
|
if (props.disabled) {
|
|
18339
18359
|
return;
|
|
18340
18360
|
}
|
|
18341
18361
|
dropdownOpen.value = true;
|
|
18342
18362
|
isFocused.value = true;
|
|
18343
18363
|
searchQuery.value = "";
|
|
18344
|
-
|
|
18345
|
-
}
|
|
18346
|
-
|
|
18364
|
+
activeIndex.value = -1;
|
|
18365
|
+
};
|
|
18366
|
+
const clearHoverPreview = () => {
|
|
18367
|
+
hoveredCountry.value = null;
|
|
18368
|
+
};
|
|
18369
|
+
const clearActiveOption = () => {
|
|
18370
|
+
activeIndex.value = -1;
|
|
18371
|
+
};
|
|
18372
|
+
const setActiveIndex = (index) => {
|
|
18373
|
+
if (!filteredCountries.value.length) {
|
|
18374
|
+
clearActiveOption();
|
|
18375
|
+
return;
|
|
18376
|
+
}
|
|
18377
|
+
activeIndex.value = Math.max(0, Math.min(index, filteredCountries.value.length - 1));
|
|
18378
|
+
};
|
|
18379
|
+
const setActiveIndexToSelectedOrFirst = () => {
|
|
18380
|
+
const selectedIndex = filteredCountries.value.findIndex((option) => option.value === country.value);
|
|
18381
|
+
setActiveIndex(selectedIndex >= 0 ? selectedIndex : 0);
|
|
18382
|
+
};
|
|
18383
|
+
const setActiveIndexToSelectedOrLast = () => {
|
|
18384
|
+
const selectedIndex = filteredCountries.value.findIndex((option) => option.value === country.value);
|
|
18385
|
+
setActiveIndex(selectedIndex >= 0 ? selectedIndex : filteredCountries.value.length - 1);
|
|
18386
|
+
};
|
|
18387
|
+
const onOptionMouseEnter = (option) => {
|
|
18388
|
+
hoveredCountry.value = option;
|
|
18389
|
+
};
|
|
18390
|
+
const onOptionMouseLeave = () => {
|
|
18391
|
+
clearHoverPreview();
|
|
18392
|
+
};
|
|
18393
|
+
const closeDropdown = () => {
|
|
18347
18394
|
dropdownOpen.value = false;
|
|
18348
18395
|
isFocused.value = false;
|
|
18349
18396
|
searchQuery.value = "";
|
|
18350
|
-
|
|
18351
|
-
|
|
18397
|
+
clearHoverPreview();
|
|
18398
|
+
clearActiveOption();
|
|
18399
|
+
};
|
|
18400
|
+
const onInputFocus = () => {
|
|
18352
18401
|
openDropdown();
|
|
18353
|
-
}
|
|
18354
|
-
|
|
18402
|
+
};
|
|
18403
|
+
const onArrowPointerDown = () => {
|
|
18404
|
+
if (props.disabled) {
|
|
18405
|
+
return;
|
|
18406
|
+
}
|
|
18407
|
+
if (dropdownOpen.value) {
|
|
18408
|
+
closeDropdown();
|
|
18409
|
+
inputRef.value?.blur();
|
|
18410
|
+
return;
|
|
18411
|
+
}
|
|
18412
|
+
openDropdown();
|
|
18413
|
+
inputRef.value?.focus();
|
|
18414
|
+
};
|
|
18415
|
+
const onInputBlur = () => {
|
|
18355
18416
|
isFocused.value = false;
|
|
18356
18417
|
window.setTimeout(() => {
|
|
18357
18418
|
if (!dropdownOpen.value) {
|
|
@@ -18359,27 +18420,85 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
18359
18420
|
}
|
|
18360
18421
|
closeDropdown();
|
|
18361
18422
|
}, 120);
|
|
18362
|
-
}
|
|
18363
|
-
|
|
18423
|
+
};
|
|
18424
|
+
const onSearchInput = (event) => {
|
|
18364
18425
|
const target = event.target;
|
|
18365
18426
|
searchQuery.value = target.value;
|
|
18427
|
+
clearActiveOption();
|
|
18366
18428
|
if (!dropdownOpen.value) {
|
|
18367
18429
|
dropdownOpen.value = true;
|
|
18368
18430
|
}
|
|
18369
|
-
}
|
|
18370
|
-
|
|
18431
|
+
};
|
|
18432
|
+
const onInputKeyDown = (event) => {
|
|
18433
|
+
if (props.disabled) {
|
|
18434
|
+
return;
|
|
18435
|
+
}
|
|
18436
|
+
if (event.key === "ArrowDown" && filteredCountries.value.length > 0) {
|
|
18437
|
+
event.preventDefault();
|
|
18438
|
+
clearHoverPreview();
|
|
18439
|
+
if (!dropdownOpen.value) {
|
|
18440
|
+
openDropdown();
|
|
18441
|
+
setActiveIndexToSelectedOrFirst();
|
|
18442
|
+
return;
|
|
18443
|
+
}
|
|
18444
|
+
if (activeIndex.value < 0) {
|
|
18445
|
+
setActiveIndexToSelectedOrFirst();
|
|
18446
|
+
return;
|
|
18447
|
+
}
|
|
18448
|
+
setActiveIndex(activeIndex.value + 1);
|
|
18449
|
+
return;
|
|
18450
|
+
}
|
|
18451
|
+
if (event.key === "ArrowUp" && filteredCountries.value.length > 0) {
|
|
18452
|
+
event.preventDefault();
|
|
18453
|
+
clearHoverPreview();
|
|
18454
|
+
if (!dropdownOpen.value) {
|
|
18455
|
+
openDropdown();
|
|
18456
|
+
setActiveIndexToSelectedOrLast();
|
|
18457
|
+
return;
|
|
18458
|
+
}
|
|
18459
|
+
if (activeIndex.value < 0) {
|
|
18460
|
+
setActiveIndexToSelectedOrLast();
|
|
18461
|
+
return;
|
|
18462
|
+
}
|
|
18463
|
+
setActiveIndex(activeIndex.value - 1);
|
|
18464
|
+
return;
|
|
18465
|
+
}
|
|
18466
|
+
if (event.key === "Enter") {
|
|
18467
|
+
if (!dropdownOpen.value && filteredCountries.value.length > 0) {
|
|
18468
|
+
event.preventDefault();
|
|
18469
|
+
openDropdown();
|
|
18470
|
+
setActiveIndexToSelectedOrFirst();
|
|
18471
|
+
return;
|
|
18472
|
+
}
|
|
18473
|
+
if (dropdownOpen.value && activeCountry.value) {
|
|
18474
|
+
event.preventDefault();
|
|
18475
|
+
selectCountry(activeCountry.value);
|
|
18476
|
+
}
|
|
18477
|
+
return;
|
|
18478
|
+
}
|
|
18479
|
+
if (event.key === "Escape" && dropdownOpen.value) {
|
|
18480
|
+
event.preventDefault();
|
|
18481
|
+
closeDropdown();
|
|
18482
|
+
inputRef.value?.focus();
|
|
18483
|
+
return;
|
|
18484
|
+
}
|
|
18485
|
+
if (event.key === "Tab" && dropdownOpen.value) {
|
|
18486
|
+
closeDropdown();
|
|
18487
|
+
}
|
|
18488
|
+
};
|
|
18489
|
+
const selectCountry = (option) => {
|
|
18371
18490
|
country.value = option.value;
|
|
18372
18491
|
closeDropdown();
|
|
18373
18492
|
inputRef.value?.blur();
|
|
18374
|
-
}
|
|
18375
|
-
|
|
18493
|
+
};
|
|
18494
|
+
const onClickOutside = (event) => {
|
|
18376
18495
|
if (!dropdownOpen.value || !rootRef.value) {
|
|
18377
18496
|
return;
|
|
18378
18497
|
}
|
|
18379
18498
|
if (!rootRef.value.contains(event.target)) {
|
|
18380
18499
|
closeDropdown();
|
|
18381
18500
|
}
|
|
18382
|
-
}
|
|
18501
|
+
};
|
|
18383
18502
|
watch(
|
|
18384
18503
|
() => country.value,
|
|
18385
18504
|
() => {
|
|
@@ -18388,6 +18507,22 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
18388
18507
|
}
|
|
18389
18508
|
}
|
|
18390
18509
|
);
|
|
18510
|
+
watch(filteredCountries, (options) => {
|
|
18511
|
+
if (!options.length) {
|
|
18512
|
+
clearActiveOption();
|
|
18513
|
+
return;
|
|
18514
|
+
}
|
|
18515
|
+
if (activeIndex.value >= options.length) {
|
|
18516
|
+
setActiveIndex(options.length - 1);
|
|
18517
|
+
}
|
|
18518
|
+
});
|
|
18519
|
+
watch(
|
|
18520
|
+
hasNoCountryResults,
|
|
18521
|
+
(value) => {
|
|
18522
|
+
emit("noCountryResults", value);
|
|
18523
|
+
},
|
|
18524
|
+
{ immediate: true }
|
|
18525
|
+
);
|
|
18391
18526
|
onMounted(() => {
|
|
18392
18527
|
window.addEventListener("mousedown", onClickOutside);
|
|
18393
18528
|
});
|
|
@@ -18401,7 +18536,14 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
18401
18536
|
class: normalizeClass(["relative w-32", props.class])
|
|
18402
18537
|
}, [
|
|
18403
18538
|
createElementVNode("div", _hoisted_1$5, [
|
|
18404
|
-
|
|
18539
|
+
!dropdownOpen.value ? (openBlock(), createElementBlock("div", {
|
|
18540
|
+
key: 0,
|
|
18541
|
+
class: normalizeClass(dialPreviewClasses.value),
|
|
18542
|
+
"aria-hidden": "true"
|
|
18543
|
+
}, [
|
|
18544
|
+
createElementVNode("span", _hoisted_2$4, toDisplayString(unref(countryCodeToFlag)(dialPreviewCountry.value?.value ?? "")), 1),
|
|
18545
|
+
createTextVNode(" " + toDisplayString(unref(t)("common.plus")) + toDisplayString(dialPreviewCountry.value?.countryCode ?? ""), 1)
|
|
18546
|
+
], 2)) : createCommentVNode("", true),
|
|
18405
18547
|
createElementVNode("input", mergeProps({
|
|
18406
18548
|
ref_key: "inputRef",
|
|
18407
18549
|
ref: inputRef,
|
|
@@ -18410,58 +18552,78 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
18410
18552
|
role: "combobox",
|
|
18411
18553
|
"aria-expanded": dropdownOpen.value,
|
|
18412
18554
|
"aria-autocomplete": "list",
|
|
18555
|
+
"aria-haspopup": "listbox",
|
|
18413
18556
|
"aria-label": __props.ariaLabel,
|
|
18414
|
-
|
|
18557
|
+
"aria-controls": dropdownOpen.value ? listboxId : void 0,
|
|
18558
|
+
"aria-activedescendant": activeDescendantId.value,
|
|
18559
|
+
value: searchQuery.value,
|
|
18415
18560
|
disabled: __props.disabled,
|
|
18416
18561
|
class: inputClasses.value
|
|
18417
18562
|
}, inputDataAttrs.value, {
|
|
18418
18563
|
onFocus: onInputFocus,
|
|
18419
18564
|
onBlur: onInputBlur,
|
|
18420
|
-
|
|
18421
|
-
|
|
18565
|
+
onKeydown: onInputKeyDown,
|
|
18566
|
+
onInput: onSearchInput
|
|
18422
18567
|
}), null, 16, _hoisted_3$4),
|
|
18423
|
-
createElementVNode("
|
|
18568
|
+
createElementVNode("button", {
|
|
18569
|
+
type: "button",
|
|
18570
|
+
tabindex: "-1",
|
|
18571
|
+
disabled: __props.disabled,
|
|
18572
|
+
class: normalizeClass(arrowButtonClasses.value),
|
|
18573
|
+
"aria-hidden": "true",
|
|
18574
|
+
onMousedown: withModifiers(onArrowPointerDown, ["prevent"])
|
|
18575
|
+
}, [
|
|
18424
18576
|
createVNode(_sfc_main$L, {
|
|
18425
18577
|
name: "arrowDown",
|
|
18426
18578
|
size: 24,
|
|
18427
18579
|
class: normalizeClass(arrowClasses.value)
|
|
18428
18580
|
}, null, 8, ["class"])
|
|
18429
|
-
])
|
|
18581
|
+
], 42, _hoisted_4$4)
|
|
18430
18582
|
]),
|
|
18431
|
-
dropdownOpen.value && !__props.disabled ? (openBlock(), createElementBlock("ul", mergeProps({
|
|
18583
|
+
dropdownOpen.value && !__props.disabled && filteredCountries.value.length > 0 ? (openBlock(), createElementBlock("ul", mergeProps({
|
|
18432
18584
|
key: 0,
|
|
18433
|
-
ref_key: "listRef",
|
|
18434
|
-
ref: listRef,
|
|
18435
18585
|
role: "listbox",
|
|
18436
|
-
|
|
18437
|
-
|
|
18438
|
-
|
|
18439
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(filteredCountries.value, (option) => {
|
|
18586
|
+
id: listboxId,
|
|
18587
|
+
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"
|
|
18588
|
+
}, listDataAttrs.value, { onMouseleave: clearHoverPreview }), [
|
|
18589
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(filteredCountries.value, (option, index) => {
|
|
18440
18590
|
return openBlock(), createElementBlock("li", {
|
|
18441
18591
|
key: option.value,
|
|
18592
|
+
id: `fds-phone-country-option-${index}`,
|
|
18442
18593
|
role: "option",
|
|
18443
|
-
id: `fds-country-${option.value}`,
|
|
18444
18594
|
"aria-selected": option.value === country.value,
|
|
18445
|
-
class: "mb-0 border-b border-gray-100"
|
|
18595
|
+
class: normalizeClass(["mb-0 border-b border-gray-100 hover:bg-blue_t-100 active:bg-blue_t-200 last:border-b-0!", {
|
|
18596
|
+
"border-gray-300": index === lastPrioritizedFilteredIndex.value,
|
|
18597
|
+
"bg-blue_t-100": activeIndex.value === index
|
|
18598
|
+
}])
|
|
18446
18599
|
}, [
|
|
18447
18600
|
createElementVNode("button", {
|
|
18448
18601
|
type: "button",
|
|
18449
|
-
|
|
18450
|
-
|
|
18602
|
+
tabindex: "-1",
|
|
18603
|
+
class: "flex w-full items-center justify-between gap-2 py-4 px-3 text-left cursor-pointer",
|
|
18604
|
+
onMouseenter: ($event) => onOptionMouseEnter(option),
|
|
18605
|
+
onMouseleave: onOptionMouseLeave,
|
|
18606
|
+
onMousedown: _cache[0] || (_cache[0] = withModifiers(() => {
|
|
18607
|
+
}, ["prevent"])),
|
|
18608
|
+
onClick: ($event) => selectCountry(option)
|
|
18451
18609
|
}, [
|
|
18452
|
-
createElementVNode("span",
|
|
18453
|
-
|
|
18454
|
-
|
|
18610
|
+
createElementVNode("span", _hoisted_7$1, [
|
|
18611
|
+
createElementVNode("span", _hoisted_8, [
|
|
18612
|
+
createElementVNode("span", _hoisted_9, toDisplayString(unref(countryCodeToFlag)(option.value)), 1),
|
|
18613
|
+
createTextVNode(" " + toDisplayString(option.countryName), 1)
|
|
18614
|
+
]),
|
|
18615
|
+
createElementVNode("span", _hoisted_10, "(" + toDisplayString(unref(t)("common.plus")) + toDisplayString(option.countryCode) + ")", 1)
|
|
18616
|
+
]),
|
|
18455
18617
|
createElementVNode("span", _hoisted_11, [
|
|
18456
18618
|
option.value === country.value ? (openBlock(), createBlock(_sfc_main$L, {
|
|
18457
18619
|
key: 0,
|
|
18458
18620
|
name: "check",
|
|
18459
|
-
size:
|
|
18621
|
+
size: 24,
|
|
18460
18622
|
class: "fill-green-600"
|
|
18461
18623
|
})) : createCommentVNode("", true)
|
|
18462
18624
|
])
|
|
18463
|
-
], 40,
|
|
18464
|
-
],
|
|
18625
|
+
], 40, _hoisted_6$1)
|
|
18626
|
+
], 10, _hoisted_5$4);
|
|
18465
18627
|
}), 128))
|
|
18466
18628
|
], 16)) : createCommentVNode("", true)
|
|
18467
18629
|
], 2);
|
|
@@ -18547,11 +18709,15 @@ const _hoisted_2$3 = {
|
|
|
18547
18709
|
key: 1,
|
|
18548
18710
|
class: "font-thin mb-1"
|
|
18549
18711
|
};
|
|
18550
|
-
const _hoisted_3$3 = { class: "flex flex-wrap items-start" };
|
|
18712
|
+
const _hoisted_3$3 = { class: "flex flex-wrap items-start gap-x-1" };
|
|
18551
18713
|
const _hoisted_4$3 = {
|
|
18552
18714
|
key: 2,
|
|
18553
18715
|
class: "text-red-700 font-bold mt-1"
|
|
18554
18716
|
};
|
|
18717
|
+
const _hoisted_5$3 = {
|
|
18718
|
+
key: 3,
|
|
18719
|
+
class: "text-red-700 font-bold mt-1"
|
|
18720
|
+
};
|
|
18555
18721
|
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
18556
18722
|
...{
|
|
18557
18723
|
inheritAttrs: false
|
|
@@ -18579,7 +18745,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
18579
18745
|
"country": { default: "SE" },
|
|
18580
18746
|
"countryModifiers": {}
|
|
18581
18747
|
}),
|
|
18582
|
-
emits: /* @__PURE__ */ mergeModels(["update:country", "update:e164", "valid", "blur"], ["update:modelValue", "update:country"]),
|
|
18748
|
+
emits: /* @__PURE__ */ mergeModels(["update:country", "update:e164", "valid", "noCountryResults", "blur"], ["update:modelValue", "update:country"]),
|
|
18583
18749
|
setup(__props, { emit: __emit }) {
|
|
18584
18750
|
const nationalNumber = useModel(__props, "modelValue");
|
|
18585
18751
|
const country = useModel(__props, "country");
|
|
@@ -18588,10 +18754,11 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
18588
18754
|
const { t, locale: fdsLocale } = useFdsI18n();
|
|
18589
18755
|
const resolvedLocale = computed(() => props.locale ?? fdsLocale.value);
|
|
18590
18756
|
const countryItems = computed(() => {
|
|
18591
|
-
const options = props.countries?.length ? props.countries : buildCountryOptions(resolvedLocale.value);
|
|
18757
|
+
const options = props.countries?.length ? props.countries : buildCountryOptions(resolvedLocale.value, props.defaultCountry);
|
|
18592
18758
|
return sortCountryOptionsByName(
|
|
18593
18759
|
options.map((option) => ({ ...option })),
|
|
18594
|
-
resolvedLocale.value
|
|
18760
|
+
resolvedLocale.value,
|
|
18761
|
+
props.defaultCountry
|
|
18595
18762
|
);
|
|
18596
18763
|
});
|
|
18597
18764
|
const phoneValidationOptions = computed(() => ({ numberType: props.numberType }));
|
|
@@ -18606,6 +18773,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
18606
18773
|
const showInvalidMessage = computed(
|
|
18607
18774
|
() => displayValid.value === false && !props.optional && props.invalidMessage && !props.disabled
|
|
18608
18775
|
);
|
|
18776
|
+
const noCountryResults = ref(false);
|
|
18609
18777
|
function runValidation() {
|
|
18610
18778
|
const validationState = getPhoneValidationState(
|
|
18611
18779
|
nationalNumber.value ?? "",
|
|
@@ -18627,6 +18795,10 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
18627
18795
|
runValidation();
|
|
18628
18796
|
emit("blur", ev);
|
|
18629
18797
|
}
|
|
18798
|
+
function onNoCountryResults(value) {
|
|
18799
|
+
noCountryResults.value = value;
|
|
18800
|
+
emit("noCountryResults", value);
|
|
18801
|
+
}
|
|
18630
18802
|
return (_ctx, _cache) => {
|
|
18631
18803
|
return openBlock(), createElementBlock("div", _hoisted_1$4, [
|
|
18632
18804
|
__props.label ? (openBlock(), createElementBlock("label", {
|
|
@@ -18642,10 +18814,10 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
18642
18814
|
valid: displayValid.value,
|
|
18643
18815
|
disabled: __props.disabled,
|
|
18644
18816
|
ariaLabel: unref(t)("FdsPhonenumber.countryCode"),
|
|
18645
|
-
"no-results-label": unref(t)("FdsPhonenumber.noCountryResults"),
|
|
18646
18817
|
"data-testid": __props.dataTestid ? `${__props.dataTestid}-country` : void 0,
|
|
18647
|
-
class: normalizeClass(["mb-0! shrink-0", __props.selectClass ?? ""])
|
|
18648
|
-
|
|
18818
|
+
class: normalizeClass(["mb-0! shrink-0", __props.selectClass ?? ""]),
|
|
18819
|
+
onNoCountryResults
|
|
18820
|
+
}, null, 8, ["modelValue", "items", "valid", "disabled", "ariaLabel", "data-testid", "class"]),
|
|
18649
18821
|
createVNode(_sfc_main$u, {
|
|
18650
18822
|
modelValue: nationalNumber.value,
|
|
18651
18823
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => nationalNumber.value = $event),
|
|
@@ -18656,11 +18828,11 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
18656
18828
|
ariaLabel: unref(t)("FdsPhonenumber.phoneNumber"),
|
|
18657
18829
|
"data-testid": __props.dataTestid ? `${__props.dataTestid}-number` : void 0,
|
|
18658
18830
|
class: normalizeClass(["mb-0! min-w-0 flex-1", __props.inputClass ?? ""]),
|
|
18659
|
-
onBlur: handleBlur
|
|
18660
|
-
inputClass: [" rounded-l-none"]
|
|
18831
|
+
onBlur: handleBlur
|
|
18661
18832
|
}, null, 8, ["modelValue", "valid", "disabled", "optional", "ariaLabel", "data-testid", "class"])
|
|
18662
18833
|
]),
|
|
18663
|
-
|
|
18834
|
+
noCountryResults.value ? (openBlock(), createElementBlock("div", _hoisted_4$3, toDisplayString(unref(t)("FdsPhonenumber.noCountryResults")), 1)) : createCommentVNode("", true),
|
|
18835
|
+
showInvalidMessage.value ? (openBlock(), createElementBlock("div", _hoisted_5$3, toDisplayString(__props.invalidMessage), 1)) : createCommentVNode("", true)
|
|
18664
18836
|
]);
|
|
18665
18837
|
};
|
|
18666
18838
|
}
|