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