fds-vue-core 6.2.12 → 7.0.1
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/fds-vue-core.cjs.js +124 -83
- package/dist/fds-vue-core.cjs.js.map +1 -1
- package/dist/fds-vue-core.es.js +125 -84
- package/dist/fds-vue-core.es.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/components/Blocks/FdsBlockAlert/FdsBlockAlert.stories.ts +0 -3
- package/src/components/Blocks/FdsBlockAlert/FdsBlockAlert.vue +5 -4
- package/src/components/Blocks/FdsBlockAlert/types.ts +0 -1
- package/src/components/FdsModal/FdsModal.stories.ts +0 -4
- package/src/components/FdsModal/FdsModal.vue +3 -2
- package/src/components/FdsModal/types.ts +0 -1
- package/src/components/FdsPagination/FdsPagination.vue +7 -6
- package/src/components/FdsPagination/types.ts +0 -1
- package/src/components/FdsSearchSelect/FdsSearchSelect.stories.ts +1 -8
- package/src/components/FdsSearchSelect/FdsSearchSelect.vue +0 -2
- package/src/components/FdsSearchSelect/types.ts +0 -1
- package/src/components/FdsSearchSelectPro/FdsSearchSelectPro.stories.ts +2 -9
- package/src/components/FdsSearchSelectPro/FdsSearchSelectPro.vue +12 -7
- package/src/components/FdsSearchSelectPro/types.ts +1 -3
- package/src/components/FdsSearchSelectPro/useSearchSelectProItems.ts +8 -5
- package/src/components/Form/FdsInput/FdsInput.stories.ts +0 -6
- package/src/components/Form/FdsInput/FdsInput.vue +6 -5
- package/src/components/Form/FdsInput/types.ts +0 -1
- package/src/components/Typography/FdsListHeading/FdsListHeading.stories.ts +0 -3
- package/src/components/Typography/FdsListHeading/FdsListHeading.vue +4 -3
- package/src/components/Typography/FdsListHeading/types.ts +0 -1
- package/src/lang/en.json +18 -0
- package/src/lang/sv.json +18 -0
package/dist/fds-vue-core.cjs.js
CHANGED
|
@@ -36,6 +36,84 @@ function useHasSlot(name = "default") {
|
|
|
36
36
|
return vnodes.some((vnode) => vnode.type !== vue.Comment);
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
|
+
const en = {
|
|
40
|
+
"FdsBlockAlert.close": "Close",
|
|
41
|
+
"FdsBlockAlert.showLess": "Show less",
|
|
42
|
+
"FdsBlockAlert.showMore": "Show more",
|
|
43
|
+
"FdsInput.clearInput": "Clear input",
|
|
44
|
+
"FdsInput.hidePassword": "Hide",
|
|
45
|
+
"FdsInput.openDatePicker": "Open date picker",
|
|
46
|
+
"FdsInput.showPassword": "Show",
|
|
47
|
+
"FdsListHeading.loading": "Loading...",
|
|
48
|
+
"FdsListHeading.separator": "of",
|
|
49
|
+
"FdsModal.closeModal": "Close modal window",
|
|
50
|
+
"FdsPagination.currentPage": "Current page",
|
|
51
|
+
"FdsPagination.firstPage": "Go to first page",
|
|
52
|
+
"FdsPagination.lastPage": "Go to last page",
|
|
53
|
+
"FdsPagination.nextPage": "Go to next page",
|
|
54
|
+
"FdsPagination.previousPage": "Go to previous page",
|
|
55
|
+
"FdsSearchSelectPro.loadingMore": "Loading more...",
|
|
56
|
+
"FdsSearchSelectPro.showMore": "Show more",
|
|
57
|
+
"FdsSearchSelectPro.unspecified": "Unspecified",
|
|
58
|
+
"FdsWeekCalendar.nextWeek": "Next week",
|
|
59
|
+
"FdsWeekCalendar.previousWeek": "Previous week",
|
|
60
|
+
"FdsWeekCalendar.today": "Today",
|
|
61
|
+
"FdsWeekCalendar.week": "week"
|
|
62
|
+
};
|
|
63
|
+
const sv = {
|
|
64
|
+
"FdsBlockAlert.close": "Stäng",
|
|
65
|
+
"FdsBlockAlert.showLess": "Visa mindre",
|
|
66
|
+
"FdsBlockAlert.showMore": "Visa mer",
|
|
67
|
+
"FdsInput.clearInput": "Rensa input",
|
|
68
|
+
"FdsInput.hidePassword": "Dölj",
|
|
69
|
+
"FdsInput.openDatePicker": "Öppna datumväljare",
|
|
70
|
+
"FdsInput.showPassword": "Visa",
|
|
71
|
+
"FdsListHeading.loading": "Laddar...",
|
|
72
|
+
"FdsListHeading.separator": "av",
|
|
73
|
+
"FdsModal.closeModal": "Stäng dialogruta",
|
|
74
|
+
"FdsPagination.currentPage": "Aktuell sida",
|
|
75
|
+
"FdsPagination.firstPage": "Gå till första sidan",
|
|
76
|
+
"FdsPagination.lastPage": "Gå till sista sidan",
|
|
77
|
+
"FdsPagination.nextPage": "Gå till nästa sida",
|
|
78
|
+
"FdsPagination.previousPage": "Gå till föregående sida",
|
|
79
|
+
"FdsSearchSelectPro.loadingMore": "Hämtar fler...",
|
|
80
|
+
"FdsSearchSelectPro.showMore": "Visa fler",
|
|
81
|
+
"FdsSearchSelectPro.unspecified": "Ospecificerat",
|
|
82
|
+
"FdsWeekCalendar.nextWeek": "Nästa vecka",
|
|
83
|
+
"FdsWeekCalendar.previousWeek": "Föregående vecka",
|
|
84
|
+
"FdsWeekCalendar.today": "Idag",
|
|
85
|
+
"FdsWeekCalendar.week": "vecka"
|
|
86
|
+
};
|
|
87
|
+
const FDS_VUE_CORE_I18N_KEY = /* @__PURE__ */ Symbol("fds-vue-core:i18n");
|
|
88
|
+
const translations = {
|
|
89
|
+
en,
|
|
90
|
+
sv
|
|
91
|
+
};
|
|
92
|
+
const useFdsI18n = () => {
|
|
93
|
+
const i18n = vue.inject(FDS_VUE_CORE_I18N_KEY, void 0);
|
|
94
|
+
const locale = vue.computed(() => {
|
|
95
|
+
const locale2 = i18n?.global?.locale ?? i18n?.locale;
|
|
96
|
+
if (typeof locale2 === "string") return locale2;
|
|
97
|
+
if (locale2 && typeof locale2 === "object" && "value" in locale2 && typeof locale2.value === "string") {
|
|
98
|
+
return locale2.value;
|
|
99
|
+
}
|
|
100
|
+
return "sv-SE";
|
|
101
|
+
});
|
|
102
|
+
const activeLanguage = vue.computed(() => locale.value.toLowerCase().split("-")[0]);
|
|
103
|
+
const dictionary = vue.computed(() => {
|
|
104
|
+
const currentDictionary = translations[activeLanguage.value];
|
|
105
|
+
return currentDictionary ?? translations.sv;
|
|
106
|
+
});
|
|
107
|
+
const t = (key) => {
|
|
108
|
+
const value = dictionary.value[key];
|
|
109
|
+
return typeof value === "string" ? value : "";
|
|
110
|
+
};
|
|
111
|
+
return {
|
|
112
|
+
i18n,
|
|
113
|
+
locale,
|
|
114
|
+
t
|
|
115
|
+
};
|
|
116
|
+
};
|
|
39
117
|
const icons = {
|
|
40
118
|
addCircle: () => `
|
|
41
119
|
<svg viewBox="0 0 24 24" width="24" height="24" xmlns="http://www.w3.org/2000/svg">
|
|
@@ -654,7 +732,6 @@ const _sfc_main$H = /* @__PURE__ */ vue.defineComponent({
|
|
|
654
732
|
collapsable: { type: Boolean, default: false },
|
|
655
733
|
expanded: { type: Boolean, default: false },
|
|
656
734
|
heading: { default: void 0 },
|
|
657
|
-
locale: { default: "sv" },
|
|
658
735
|
icon: {},
|
|
659
736
|
dataTestid: { default: void 0 }
|
|
660
737
|
},
|
|
@@ -662,12 +739,13 @@ const _sfc_main$H = /* @__PURE__ */ vue.defineComponent({
|
|
|
662
739
|
setup(__props, { emit: __emit }) {
|
|
663
740
|
const props = __props;
|
|
664
741
|
const { id } = useAttrsWithDefaults(props);
|
|
742
|
+
const { t } = useFdsI18n();
|
|
665
743
|
const emit = __emit;
|
|
666
744
|
const isExpanded = vue.ref(props.expanded);
|
|
667
745
|
const isVisible = vue.ref(props.visible);
|
|
668
|
-
const expandLabel = vue.computed(() =>
|
|
669
|
-
const collapseLabel = vue.computed(() =>
|
|
670
|
-
const closeLabel = vue.computed(() =>
|
|
746
|
+
const expandLabel = vue.computed(() => t("FdsBlockAlert.showMore"));
|
|
747
|
+
const collapseLabel = vue.computed(() => t("FdsBlockAlert.showLess"));
|
|
748
|
+
const closeLabel = vue.computed(() => t("FdsBlockAlert.close"));
|
|
671
749
|
const hasSlot = useHasSlot();
|
|
672
750
|
vue.watch(
|
|
673
751
|
() => props.visible,
|
|
@@ -1016,7 +1094,7 @@ const _hoisted_10$3 = { class: "flex items-start justify-between gap-4" };
|
|
|
1016
1094
|
const _hoisted_11$3 = { class: "flex items-center gap-3" };
|
|
1017
1095
|
const _hoisted_12$2 = { class: "m-0 text-base font-main font-bold tracking-wide" };
|
|
1018
1096
|
const _hoisted_13$2 = { class: "flex items-start gap-3" };
|
|
1019
|
-
const _hoisted_14$
|
|
1097
|
+
const _hoisted_14$2 = { class: "mb-0-last-child" };
|
|
1020
1098
|
const smallIconSize = 24;
|
|
1021
1099
|
const largeIconSize = 48;
|
|
1022
1100
|
const _sfc_main$D = /* @__PURE__ */ vue.defineComponent({
|
|
@@ -1090,7 +1168,7 @@ const _sfc_main$D = /* @__PURE__ */ vue.defineComponent({
|
|
|
1090
1168
|
])
|
|
1091
1169
|
])
|
|
1092
1170
|
], 2)) : vue.createCommentVNode("", true),
|
|
1093
|
-
vue.createElementVNode("div", _hoisted_14$
|
|
1171
|
+
vue.createElementVNode("div", _hoisted_14$2, [
|
|
1094
1172
|
vue.renderSlot(_ctx.$slots, "default")
|
|
1095
1173
|
])
|
|
1096
1174
|
]))
|
|
@@ -4928,7 +5006,6 @@ const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
|
|
|
4928
5006
|
movable: { type: Boolean, default: false },
|
|
4929
5007
|
resizable: { type: Boolean, default: false },
|
|
4930
5008
|
info: { default: void 0 },
|
|
4931
|
-
locale: { default: "sv" },
|
|
4932
5009
|
dataTestid: { default: void 0 },
|
|
4933
5010
|
onClose: {}
|
|
4934
5011
|
},
|
|
@@ -4940,6 +5017,7 @@ const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
|
|
|
4940
5017
|
let cleanupFocusTrap = null;
|
|
4941
5018
|
const previouslyFocusedElement = vue.ref(null);
|
|
4942
5019
|
const hasFooterSlot = useHasSlot("modal-footer");
|
|
5020
|
+
const { t } = useFdsI18n();
|
|
4943
5021
|
const modalInnerRef = vue.ref(null);
|
|
4944
5022
|
const {
|
|
4945
5023
|
isCustomPositioned,
|
|
@@ -4993,7 +5071,7 @@ const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
|
|
|
4993
5071
|
"fill-yellow-600": props.info === "warning"
|
|
4994
5072
|
}
|
|
4995
5073
|
]);
|
|
4996
|
-
const closeLabel = vue.computed(() =>
|
|
5074
|
+
const closeLabel = vue.computed(() => t("FdsModal.closeModal"));
|
|
4997
5075
|
const footerClasses = vue.computed(() => [
|
|
4998
5076
|
"mt-6 flex flex-col gap-4 left-0 right-0",
|
|
4999
5077
|
{
|
|
@@ -8484,7 +8562,6 @@ const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
|
|
|
8484
8562
|
invalidMessage: {},
|
|
8485
8563
|
labelLeft: { type: Boolean, default: false },
|
|
8486
8564
|
clearButton: { type: Boolean, default: false },
|
|
8487
|
-
locale: { default: "sv" },
|
|
8488
8565
|
mask: { default: void 0 },
|
|
8489
8566
|
modelValue: {},
|
|
8490
8567
|
value: { default: void 0 },
|
|
@@ -8526,6 +8603,7 @@ const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
|
|
|
8526
8603
|
const props = __props;
|
|
8527
8604
|
const emit = __emit;
|
|
8528
8605
|
const { id, type, maxlength, attrs } = useAttrsWithDefaults(props);
|
|
8606
|
+
const { t } = useFdsI18n();
|
|
8529
8607
|
const inputType = vue.computed(() => type.value ?? props.type ?? "text");
|
|
8530
8608
|
const autoId = `fds-input-${Math.random().toString(36).slice(2, 9)}`;
|
|
8531
8609
|
const inputId = vue.computed(() => id.value ?? autoId);
|
|
@@ -8554,10 +8632,10 @@ const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
|
|
|
8554
8632
|
"data-testid": props.dataTestid ?? void 0
|
|
8555
8633
|
};
|
|
8556
8634
|
});
|
|
8557
|
-
const clearButtonLabel = vue.computed(() =>
|
|
8558
|
-
const passwordButtonShowLabel = vue.computed(() =>
|
|
8559
|
-
const passwordButtonHideLabel = vue.computed(() =>
|
|
8560
|
-
const dateButtonLabel = vue.computed(() =>
|
|
8635
|
+
const clearButtonLabel = vue.computed(() => t("FdsInput.clearInput"));
|
|
8636
|
+
const passwordButtonShowLabel = vue.computed(() => t("FdsInput.showPassword"));
|
|
8637
|
+
const passwordButtonHideLabel = vue.computed(() => t("FdsInput.hidePassword"));
|
|
8638
|
+
const dateButtonLabel = vue.computed(() => t("FdsInput.openDatePicker"));
|
|
8561
8639
|
const showInvalidMessage = vue.computed(() => props.valid === false && !props.optional && props.invalidMessage);
|
|
8562
8640
|
const isInvalid = vue.computed(() => props.valid === false && !props.optional && !props.disabled);
|
|
8563
8641
|
const isValid2 = vue.computed(() => props.valid === true);
|
|
@@ -9002,7 +9080,7 @@ const _hoisted_13$1 = {
|
|
|
9002
9080
|
key: 1,
|
|
9003
9081
|
class: "max-h-72 overflow-auto border border-gray-200 rounded-md"
|
|
9004
9082
|
};
|
|
9005
|
-
const _hoisted_14 = { class: "w-full text-left text-xs border-collapse" };
|
|
9083
|
+
const _hoisted_14$1 = { class: "w-full text-left text-xs border-collapse" };
|
|
9006
9084
|
const _hoisted_15 = ["onClick"];
|
|
9007
9085
|
const _hoisted_16 = { class: "py-1.5 px-3 font-mono break-all" };
|
|
9008
9086
|
const _hoisted_17 = { class: "py-1.5 px-3 font-mono whitespace-pre-wrap break-all" };
|
|
@@ -9344,7 +9422,7 @@ const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
|
|
|
9344
9422
|
}, {
|
|
9345
9423
|
default: vue.withCtx(() => [
|
|
9346
9424
|
!sessionStorageEntries.value.length ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_12$1, "Inga värden i sessionStorage.")) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_13$1, [
|
|
9347
|
-
vue.createElementVNode("table", _hoisted_14, [
|
|
9425
|
+
vue.createElementVNode("table", _hoisted_14$1, [
|
|
9348
9426
|
_cache[15] || (_cache[15] = vue.createElementVNode("thead", { class: "bg-gray-50" }, [
|
|
9349
9427
|
vue.createElementVNode("tr", null, [
|
|
9350
9428
|
vue.createElementVNode("th", { class: "py-2 px-3 font-semibold" }, "Nyckel"),
|
|
@@ -9690,7 +9768,6 @@ const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
|
|
|
9690
9768
|
current: {},
|
|
9691
9769
|
max: {},
|
|
9692
9770
|
loading: { type: Boolean, default: false },
|
|
9693
|
-
locale: { default: "sv" },
|
|
9694
9771
|
dataTestid: { default: void 0 },
|
|
9695
9772
|
onPaginate: {}
|
|
9696
9773
|
},
|
|
@@ -9698,6 +9775,7 @@ const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
|
|
|
9698
9775
|
setup(__props, { emit: __emit }) {
|
|
9699
9776
|
const props = __props;
|
|
9700
9777
|
const { id } = useAttrsWithDefaults(props);
|
|
9778
|
+
const { t } = useFdsI18n();
|
|
9701
9779
|
const emit = __emit;
|
|
9702
9780
|
const loadingIndicator = vue.ref("");
|
|
9703
9781
|
const internalValue = vue.ref(props.current);
|
|
@@ -9711,11 +9789,11 @@ const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
|
|
|
9711
9789
|
return attrs;
|
|
9712
9790
|
});
|
|
9713
9791
|
const inputValue = vue.computed(() => String(internalValue.value));
|
|
9714
|
-
const nextPageLabel = vue.computed(() =>
|
|
9715
|
-
const prevPageLabel = vue.computed(() =>
|
|
9716
|
-
const firstPageLabel = vue.computed(() =>
|
|
9717
|
-
const lastPageLabel = vue.computed(() =>
|
|
9718
|
-
const inputAriaLabel = vue.computed(() =>
|
|
9792
|
+
const nextPageLabel = vue.computed(() => t("FdsPagination.nextPage"));
|
|
9793
|
+
const prevPageLabel = vue.computed(() => t("FdsPagination.previousPage"));
|
|
9794
|
+
const firstPageLabel = vue.computed(() => t("FdsPagination.firstPage"));
|
|
9795
|
+
const lastPageLabel = vue.computed(() => t("FdsPagination.lastPage"));
|
|
9796
|
+
const inputAriaLabel = vue.computed(() => t("FdsPagination.currentPage"));
|
|
9719
9797
|
vue.watch(
|
|
9720
9798
|
() => props.current,
|
|
9721
9799
|
(newValue) => {
|
|
@@ -10131,7 +10209,6 @@ const _sfc_main$k = /* @__PURE__ */ vue.defineComponent({
|
|
|
10131
10209
|
borderless: { type: Boolean, default: false },
|
|
10132
10210
|
marginless: { type: Boolean, default: false },
|
|
10133
10211
|
maxListHeight: { default: void 0 },
|
|
10134
|
-
locale: { default: "sv" },
|
|
10135
10212
|
clearTrigger: { type: Boolean, default: false },
|
|
10136
10213
|
dataTestid: { default: void 0 },
|
|
10137
10214
|
onChange: {},
|
|
@@ -10532,7 +10609,6 @@ const _sfc_main$k = /* @__PURE__ */ vue.defineComponent({
|
|
|
10532
10609
|
valid: valid.value,
|
|
10533
10610
|
invalidMessage: __props.invalidMessage,
|
|
10534
10611
|
disabled: __props.disabled,
|
|
10535
|
-
locale: __props.locale,
|
|
10536
10612
|
type: "search",
|
|
10537
10613
|
value: searchTerm.value,
|
|
10538
10614
|
id: inputId,
|
|
@@ -10543,7 +10619,7 @@ const _sfc_main$k = /* @__PURE__ */ vue.defineComponent({
|
|
|
10543
10619
|
searchIcon: !__props.disabled && !hasInputValue.value,
|
|
10544
10620
|
onInput: handleInput,
|
|
10545
10621
|
onClearInput: handleClear
|
|
10546
|
-
}), null, 16, ["label", "meta", "labelLeft", "valid", "invalidMessage", "disabled", "
|
|
10622
|
+
}), null, 16, ["label", "meta", "labelLeft", "valid", "invalidMessage", "disabled", "value", "clearButton", "mask", "searchIcon"])
|
|
10547
10623
|
])
|
|
10548
10624
|
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$7, [
|
|
10549
10625
|
vue.createElementVNode("div", _hoisted_5$7, vue.toDisplayString(__props.singleItemLabel), 1),
|
|
@@ -10943,9 +11019,11 @@ const useSearchSelectProItems = ({
|
|
|
10943
11019
|
isMultiple,
|
|
10944
11020
|
isPid
|
|
10945
11021
|
}) => {
|
|
11022
|
+
const { locale: activeLocale, t } = useFdsI18n();
|
|
10946
11023
|
const matchingItems = vue.ref([]);
|
|
10947
11024
|
const displayedItems = vue.ref([]);
|
|
10948
11025
|
const visibleItemsLimit = vue.ref(props.maxItems && props.maxItems > 0 ? props.maxItems : null);
|
|
11026
|
+
const resolvedLocale = vue.computed(() => activeLocale.value.toLowerCase().startsWith("en") ? "en" : "sv");
|
|
10949
11027
|
const toStableValue = (value) => {
|
|
10950
11028
|
if (Array.isArray(value)) {
|
|
10951
11029
|
return value.map((item) => toStableValue(item));
|
|
@@ -11021,7 +11099,7 @@ const useSearchSelectProItems = ({
|
|
|
11021
11099
|
const reorderExplicitDividerGroups = (items, locale) => {
|
|
11022
11100
|
const dividerLabelField = searchFields.value[0] ?? "label";
|
|
11023
11101
|
const unspecifiedGroupKey = "__UNSPECIFIED__";
|
|
11024
|
-
const defaultUnspecifiedLabel =
|
|
11102
|
+
const defaultUnspecifiedLabel = t("FdsSearchSelectPro.unspecified");
|
|
11025
11103
|
const unspecifiedLabel = String(props.unspecifiedLabel ?? "").trim() || defaultUnspecifiedLabel;
|
|
11026
11104
|
const isUnspecifiedDividerLabel = (raw) => {
|
|
11027
11105
|
const trimmed = raw.trim();
|
|
@@ -11029,7 +11107,7 @@ const useSearchSelectProItems = ({
|
|
|
11029
11107
|
const lower = trimmed.toLowerCase();
|
|
11030
11108
|
if (lower === unspecifiedGroupKey.toLowerCase()) return true;
|
|
11031
11109
|
const candidates = new Set(
|
|
11032
|
-
[unspecifiedLabel, defaultUnspecifiedLabel
|
|
11110
|
+
[unspecifiedLabel, defaultUnspecifiedLabel].map((s) => s.trim().toLowerCase()).filter(Boolean)
|
|
11033
11111
|
);
|
|
11034
11112
|
return candidates.has(lower);
|
|
11035
11113
|
};
|
|
@@ -11075,13 +11153,13 @@ const useSearchSelectProItems = ({
|
|
|
11075
11153
|
const dividerField2 = props.dividerField ?? "isDivider";
|
|
11076
11154
|
const hasExplicitDividers = baseItems.some((item) => item[dividerField2] === true || item.type === "divider");
|
|
11077
11155
|
if (!hasExplicitDividers) return baseItems;
|
|
11078
|
-
const locale2 =
|
|
11156
|
+
const locale2 = resolvedLocale.value;
|
|
11079
11157
|
return reorderExplicitDividerGroups(baseItems, locale2);
|
|
11080
11158
|
}
|
|
11081
11159
|
const dividerField = props.dividerField ?? "isDivider";
|
|
11082
11160
|
const levelField = props.levelField ?? "level";
|
|
11083
|
-
const locale =
|
|
11084
|
-
const defaultUnspecifiedLabel =
|
|
11161
|
+
const locale = resolvedLocale.value;
|
|
11162
|
+
const defaultUnspecifiedLabel = t("FdsSearchSelectPro.unspecified");
|
|
11085
11163
|
const unspecifiedLabel = String(props.unspecifiedLabel ?? "").trim() || defaultUnspecifiedLabel;
|
|
11086
11164
|
const grouped = /* @__PURE__ */ new Map();
|
|
11087
11165
|
const groupLabels = /* @__PURE__ */ new Map();
|
|
@@ -11282,6 +11360,7 @@ const _hoisted_12 = {
|
|
|
11282
11360
|
class: "block m-0 list-none p-0"
|
|
11283
11361
|
};
|
|
11284
11362
|
const _hoisted_13 = { class: "p-3 flex items-center gap-2" };
|
|
11363
|
+
const _hoisted_14 = { key: 0 };
|
|
11285
11364
|
const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
|
|
11286
11365
|
__name: "FdsSearchSelectPro",
|
|
11287
11366
|
props: {
|
|
@@ -11325,7 +11404,6 @@ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
|
|
|
11325
11404
|
invalidMessage: { default: "" },
|
|
11326
11405
|
noResultPrompt: { default: "" },
|
|
11327
11406
|
maxListHeight: { default: void 0 },
|
|
11328
|
-
locale: { default: "sv" },
|
|
11329
11407
|
unspecifiedLabel: { default: void 0 },
|
|
11330
11408
|
dataTestid: { default: void 0 },
|
|
11331
11409
|
onChange: {},
|
|
@@ -11340,6 +11418,7 @@ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
|
|
|
11340
11418
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
11341
11419
|
const props = __props;
|
|
11342
11420
|
const searchFields = vue.computed(() => props.searchFields ?? []);
|
|
11421
|
+
const { t } = useFdsI18n();
|
|
11343
11422
|
const emit = __emit;
|
|
11344
11423
|
const dropdownVisible = vue.ref(false);
|
|
11345
11424
|
const searchTerm = vue.ref("");
|
|
@@ -11447,8 +11526,8 @@ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
|
|
|
11447
11526
|
});
|
|
11448
11527
|
};
|
|
11449
11528
|
const hasInputValue = vue.computed(() => searchTerm.value.length > 0);
|
|
11450
|
-
const resolvedLoadMoreLabel = vue.computed(() =>
|
|
11451
|
-
const resolvedLoadingMoreLabel = vue.computed(() =>
|
|
11529
|
+
const resolvedLoadMoreLabel = vue.computed(() => t("FdsSearchSelectPro.showMore"));
|
|
11530
|
+
const resolvedLoadingMoreLabel = vue.computed(() => t("FdsSearchSelectPro.loadingMore"));
|
|
11452
11531
|
const displayInputValue = vue.computed(() => {
|
|
11453
11532
|
if (!inputHasFocus.value && !hasSelection.value && !searchTerm.value.length && props.displayValue) {
|
|
11454
11533
|
return props.displayValue;
|
|
@@ -11523,12 +11602,16 @@ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
|
|
|
11523
11602
|
};
|
|
11524
11603
|
let changeTimeout = null;
|
|
11525
11604
|
let inputTimeout = null;
|
|
11605
|
+
const isDebouncingChange = vue.ref(false);
|
|
11606
|
+
const isSearching = vue.computed(() => isDebouncingChange.value || props.loading);
|
|
11526
11607
|
const debouncedEmitChange = (value) => {
|
|
11527
11608
|
if (changeTimeout) clearTimeout(changeTimeout);
|
|
11528
11609
|
const delay = Math.max(0, props.debounceMs ?? 500);
|
|
11610
|
+
isDebouncingChange.value = true;
|
|
11529
11611
|
changeTimeout = setTimeout(() => {
|
|
11530
11612
|
const formattedValue = formatPidWithDash(value);
|
|
11531
11613
|
emit("change", formattedValue);
|
|
11614
|
+
isDebouncingChange.value = false;
|
|
11532
11615
|
}, delay);
|
|
11533
11616
|
};
|
|
11534
11617
|
const debouncedEmitInput = (ev) => {
|
|
@@ -11872,6 +11955,7 @@ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
|
|
|
11872
11955
|
window.removeEventListener("mouseup", onClickOutside);
|
|
11873
11956
|
if (changeTimeout) clearTimeout(changeTimeout);
|
|
11874
11957
|
if (inputTimeout) clearTimeout(inputTimeout);
|
|
11958
|
+
isDebouncingChange.value = false;
|
|
11875
11959
|
const input = getInputElement();
|
|
11876
11960
|
if (input) {
|
|
11877
11961
|
input.removeEventListener("keydown", handleInputKeyDown);
|
|
@@ -11933,7 +12017,6 @@ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
|
|
|
11933
12017
|
valid: valid.value,
|
|
11934
12018
|
invalidMessage: __props.invalidMessage,
|
|
11935
12019
|
disabled: __props.disabled,
|
|
11936
|
-
locale: __props.locale,
|
|
11937
12020
|
type: "search",
|
|
11938
12021
|
value: displayInputValue.value,
|
|
11939
12022
|
id: inputId,
|
|
@@ -11944,7 +12027,7 @@ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
|
|
|
11944
12027
|
searchIcon: !__props.disabled && inputHasFocus.value && !hasInputValue.value && !hasSelection.value,
|
|
11945
12028
|
onInput: handleInput,
|
|
11946
12029
|
onClearInput: handleClear
|
|
11947
|
-
}), null, 16, ["label", "meta", "labelLeft", "valid", "invalidMessage", "disabled", "
|
|
12030
|
+
}), null, 16, ["label", "meta", "labelLeft", "valid", "invalidMessage", "disabled", "value", "clearButton", "mask", "searchIcon"])
|
|
11948
12031
|
])
|
|
11949
12032
|
]),
|
|
11950
12033
|
dropdownVisible.value && !__props.disabled ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
@@ -11966,7 +12049,7 @@ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
|
|
|
11966
12049
|
]),
|
|
11967
12050
|
_: 1
|
|
11968
12051
|
}),
|
|
11969
|
-
|
|
12052
|
+
isSearching.value ? (vue.openBlock(), vue.createBlock(_sfc_main$B, {
|
|
11970
12053
|
key: 0,
|
|
11971
12054
|
color: "blue",
|
|
11972
12055
|
size: "20px"
|
|
@@ -12072,9 +12155,9 @@ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
|
|
|
12072
12155
|
], 32)
|
|
12073
12156
|
], 64)) : (vue.openBlock(), vue.createElementBlock("ul", _hoisted_12, [
|
|
12074
12157
|
vue.createElementVNode("li", _hoisted_13, [
|
|
12075
|
-
vue.
|
|
12076
|
-
|
|
12077
|
-
key:
|
|
12158
|
+
!isSearching.value ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_14, vue.toDisplayString(__props.noResultPrompt), 1)) : vue.createCommentVNode("", true),
|
|
12159
|
+
isSearching.value ? (vue.openBlock(), vue.createBlock(_sfc_main$B, {
|
|
12160
|
+
key: 1,
|
|
12078
12161
|
color: "blue",
|
|
12079
12162
|
size: "20px"
|
|
12080
12163
|
})) : vue.createCommentVNode("", true)
|
|
@@ -14630,48 +14713,6 @@ function subDays(date, amount, options) {
|
|
|
14630
14713
|
function subWeeks(date, amount, options) {
|
|
14631
14714
|
return addWeeks(date, -1, options);
|
|
14632
14715
|
}
|
|
14633
|
-
const en = {
|
|
14634
|
-
"FdsWeekCalendar.nextWeek": "Next week",
|
|
14635
|
-
"FdsWeekCalendar.previousWeek": "Previous week",
|
|
14636
|
-
"FdsWeekCalendar.today": "Today",
|
|
14637
|
-
"FdsWeekCalendar.week": "week"
|
|
14638
|
-
};
|
|
14639
|
-
const sv = {
|
|
14640
|
-
"FdsWeekCalendar.nextWeek": "Nästa vecka",
|
|
14641
|
-
"FdsWeekCalendar.previousWeek": "Föregående vecka",
|
|
14642
|
-
"FdsWeekCalendar.today": "Idag",
|
|
14643
|
-
"FdsWeekCalendar.week": "vecka"
|
|
14644
|
-
};
|
|
14645
|
-
const FDS_VUE_CORE_I18N_KEY = /* @__PURE__ */ Symbol("fds-vue-core:i18n");
|
|
14646
|
-
const translations = {
|
|
14647
|
-
en,
|
|
14648
|
-
sv
|
|
14649
|
-
};
|
|
14650
|
-
const useFdsI18n = () => {
|
|
14651
|
-
const i18n = vue.inject(FDS_VUE_CORE_I18N_KEY, void 0);
|
|
14652
|
-
const locale = vue.computed(() => {
|
|
14653
|
-
const locale2 = i18n?.global?.locale ?? i18n?.locale;
|
|
14654
|
-
if (typeof locale2 === "string") return locale2;
|
|
14655
|
-
if (locale2 && typeof locale2 === "object" && "value" in locale2 && typeof locale2.value === "string") {
|
|
14656
|
-
return locale2.value;
|
|
14657
|
-
}
|
|
14658
|
-
return "sv-SE";
|
|
14659
|
-
});
|
|
14660
|
-
const activeLanguage = vue.computed(() => locale.value.toLowerCase().split("-")[0]);
|
|
14661
|
-
const dictionary = vue.computed(() => {
|
|
14662
|
-
const currentDictionary = translations[activeLanguage.value];
|
|
14663
|
-
return currentDictionary ?? translations.sv;
|
|
14664
|
-
});
|
|
14665
|
-
const t = (key) => {
|
|
14666
|
-
const value = dictionary.value[key];
|
|
14667
|
-
return typeof value === "string" ? value : "";
|
|
14668
|
-
};
|
|
14669
|
-
return {
|
|
14670
|
-
i18n,
|
|
14671
|
-
locale,
|
|
14672
|
-
t
|
|
14673
|
-
};
|
|
14674
|
-
};
|
|
14675
14716
|
const capitalizeFirstLetter$1 = (value) => {
|
|
14676
14717
|
if (!value) return value;
|
|
14677
14718
|
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
@@ -16064,12 +16105,12 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
16064
16105
|
total: {},
|
|
16065
16106
|
unfiltered: {},
|
|
16066
16107
|
text: {},
|
|
16067
|
-
language: { default: "sv" },
|
|
16068
16108
|
dataTestid: { default: void 0 }
|
|
16069
16109
|
},
|
|
16070
16110
|
setup(__props) {
|
|
16071
16111
|
const props = __props;
|
|
16072
16112
|
const attrs = vue.useAttrs();
|
|
16113
|
+
const { t } = useFdsI18n();
|
|
16073
16114
|
const consumerClass = vue.computed(() => classValueToString(attrs.class));
|
|
16074
16115
|
const rootAttrs = vue.computed(() => {
|
|
16075
16116
|
const result = { ...attrs };
|
|
@@ -16079,7 +16120,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
16079
16120
|
}
|
|
16080
16121
|
return result;
|
|
16081
16122
|
});
|
|
16082
|
-
const separatorText = () =>
|
|
16123
|
+
const separatorText = () => t("FdsListHeading.separator");
|
|
16083
16124
|
const headingText = vue.computed(() => {
|
|
16084
16125
|
if (!props.total) {
|
|
16085
16126
|
let result = "0";
|
|
@@ -16101,7 +16142,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
16101
16142
|
if (props.loadingText && props.loadingText.length > 0) {
|
|
16102
16143
|
return props.loadingText;
|
|
16103
16144
|
}
|
|
16104
|
-
return
|
|
16145
|
+
return t("FdsListHeading.loading");
|
|
16105
16146
|
};
|
|
16106
16147
|
const wrapperClasses = vue.computed(() => {
|
|
16107
16148
|
const baseClasses = "inline-block mb-3 h-7 font-bold text-xl";
|