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