fds-vue-core 6.2.11 → 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 +154 -108
- package/dist/fds-vue-core.cjs.js.map +1 -1
- package/dist/fds-vue-core.es.js +155 -109
- package/dist/fds-vue-core.es.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +4 -4
- 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 +55 -9
- package/src/components/FdsSearchSelectPro/FdsSearchSelectPro.vue +32 -28
- package/src/components/FdsSearchSelectPro/types.ts +1 -3
- package/src/components/FdsSearchSelectPro/useSearchSelectProItems.ts +18 -17
- 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();
|
|
@@ -11266,10 +11344,7 @@ const useSearchSelectProItems = ({
|
|
|
11266
11344
|
const _hoisted_1$a = { class: "relative block" };
|
|
11267
11345
|
const _hoisted_2$7 = { class: "relative" };
|
|
11268
11346
|
const _hoisted_3$7 = { class: "relative" };
|
|
11269
|
-
const _hoisted_4$6 = {
|
|
11270
|
-
key: 0,
|
|
11271
|
-
class: "flex justify-center p-4"
|
|
11272
|
-
};
|
|
11347
|
+
const _hoisted_4$6 = { class: "flex items-center gap-2" };
|
|
11273
11348
|
const _hoisted_5$6 = ["id", "role", "onMouseup"];
|
|
11274
11349
|
const _hoisted_6$4 = ["innerHTML"];
|
|
11275
11350
|
const _hoisted_7$4 = ["onClick"];
|
|
@@ -11281,10 +11356,11 @@ const _hoisted_10 = {
|
|
|
11281
11356
|
};
|
|
11282
11357
|
const _hoisted_11 = ["aria-disabled"];
|
|
11283
11358
|
const _hoisted_12 = {
|
|
11284
|
-
key:
|
|
11359
|
+
key: 1,
|
|
11285
11360
|
class: "block m-0 list-none p-0"
|
|
11286
11361
|
};
|
|
11287
|
-
const _hoisted_13 = { class: "p-3" };
|
|
11362
|
+
const _hoisted_13 = { class: "p-3 flex items-center gap-2" };
|
|
11363
|
+
const _hoisted_14 = { key: 0 };
|
|
11288
11364
|
const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
|
|
11289
11365
|
__name: "FdsSearchSelectPro",
|
|
11290
11366
|
props: {
|
|
@@ -11328,7 +11404,6 @@ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
|
|
|
11328
11404
|
invalidMessage: { default: "" },
|
|
11329
11405
|
noResultPrompt: { default: "" },
|
|
11330
11406
|
maxListHeight: { default: void 0 },
|
|
11331
|
-
locale: { default: "sv" },
|
|
11332
11407
|
unspecifiedLabel: { default: void 0 },
|
|
11333
11408
|
dataTestid: { default: void 0 },
|
|
11334
11409
|
onChange: {},
|
|
@@ -11343,6 +11418,7 @@ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
|
|
|
11343
11418
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
11344
11419
|
const props = __props;
|
|
11345
11420
|
const searchFields = vue.computed(() => props.searchFields ?? []);
|
|
11421
|
+
const { t } = useFdsI18n();
|
|
11346
11422
|
const emit = __emit;
|
|
11347
11423
|
const dropdownVisible = vue.ref(false);
|
|
11348
11424
|
const searchTerm = vue.ref("");
|
|
@@ -11441,17 +11517,17 @@ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
|
|
|
11441
11517
|
if (!dropdownRef.value) return [];
|
|
11442
11518
|
return Array.from(dropdownRef.value.querySelectorAll('input[id^="search-select-radio-"]'));
|
|
11443
11519
|
};
|
|
11444
|
-
const
|
|
11520
|
+
const focusSelectedRadioOrFirst = () => {
|
|
11445
11521
|
vue.nextTick(() => {
|
|
11446
|
-
const
|
|
11447
|
-
if (
|
|
11448
|
-
|
|
11449
|
-
|
|
11522
|
+
const selectableInputs = getSelectableInputs();
|
|
11523
|
+
if (!selectableInputs.length) return;
|
|
11524
|
+
const checkedRadio = selectableInputs.find((input) => input.checked);
|
|
11525
|
+
(checkedRadio ?? selectableInputs[0])?.focus();
|
|
11450
11526
|
});
|
|
11451
11527
|
};
|
|
11452
11528
|
const hasInputValue = vue.computed(() => searchTerm.value.length > 0);
|
|
11453
|
-
const resolvedLoadMoreLabel = vue.computed(() =>
|
|
11454
|
-
const resolvedLoadingMoreLabel = vue.computed(() =>
|
|
11529
|
+
const resolvedLoadMoreLabel = vue.computed(() => t("FdsSearchSelectPro.showMore"));
|
|
11530
|
+
const resolvedLoadingMoreLabel = vue.computed(() => t("FdsSearchSelectPro.loadingMore"));
|
|
11455
11531
|
const displayInputValue = vue.computed(() => {
|
|
11456
11532
|
if (!inputHasFocus.value && !hasSelection.value && !searchTerm.value.length && props.displayValue) {
|
|
11457
11533
|
return props.displayValue;
|
|
@@ -11526,12 +11602,16 @@ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
|
|
|
11526
11602
|
};
|
|
11527
11603
|
let changeTimeout = null;
|
|
11528
11604
|
let inputTimeout = null;
|
|
11605
|
+
const isDebouncingChange = vue.ref(false);
|
|
11606
|
+
const isSearching = vue.computed(() => isDebouncingChange.value || props.loading);
|
|
11529
11607
|
const debouncedEmitChange = (value) => {
|
|
11530
11608
|
if (changeTimeout) clearTimeout(changeTimeout);
|
|
11531
11609
|
const delay = Math.max(0, props.debounceMs ?? 500);
|
|
11610
|
+
isDebouncingChange.value = true;
|
|
11532
11611
|
changeTimeout = setTimeout(() => {
|
|
11533
11612
|
const formattedValue = formatPidWithDash(value);
|
|
11534
11613
|
emit("change", formattedValue);
|
|
11614
|
+
isDebouncingChange.value = false;
|
|
11535
11615
|
}, delay);
|
|
11536
11616
|
};
|
|
11537
11617
|
const debouncedEmitInput = (ev) => {
|
|
@@ -11835,13 +11915,13 @@ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
|
|
|
11835
11915
|
if (!dropdownVisible.value) {
|
|
11836
11916
|
dropdownVisible.value = true;
|
|
11837
11917
|
}
|
|
11838
|
-
|
|
11918
|
+
focusSelectedRadioOrFirst();
|
|
11839
11919
|
return;
|
|
11840
11920
|
}
|
|
11841
11921
|
if (e.key === "Enter" && !dropdownVisible.value && displayedItems.value.length > 0) {
|
|
11842
11922
|
e.preventDefault();
|
|
11843
11923
|
dropdownVisible.value = true;
|
|
11844
|
-
|
|
11924
|
+
focusSelectedRadioOrFirst();
|
|
11845
11925
|
return;
|
|
11846
11926
|
}
|
|
11847
11927
|
if (e.key === "Escape" && dropdownVisible.value) {
|
|
@@ -11875,6 +11955,7 @@ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
|
|
|
11875
11955
|
window.removeEventListener("mouseup", onClickOutside);
|
|
11876
11956
|
if (changeTimeout) clearTimeout(changeTimeout);
|
|
11877
11957
|
if (inputTimeout) clearTimeout(inputTimeout);
|
|
11958
|
+
isDebouncingChange.value = false;
|
|
11878
11959
|
const input = getInputElement();
|
|
11879
11960
|
if (input) {
|
|
11880
11961
|
input.removeEventListener("keydown", handleInputKeyDown);
|
|
@@ -11936,7 +12017,6 @@ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
|
|
|
11936
12017
|
valid: valid.value,
|
|
11937
12018
|
invalidMessage: __props.invalidMessage,
|
|
11938
12019
|
disabled: __props.disabled,
|
|
11939
|
-
locale: __props.locale,
|
|
11940
12020
|
type: "search",
|
|
11941
12021
|
value: displayInputValue.value,
|
|
11942
12022
|
id: inputId,
|
|
@@ -11947,7 +12027,7 @@ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
|
|
|
11947
12027
|
searchIcon: !__props.disabled && inputHasFocus.value && !hasInputValue.value && !hasSelection.value,
|
|
11948
12028
|
onInput: handleInput,
|
|
11949
12029
|
onClearInput: handleClear
|
|
11950
|
-
}), null, 16, ["label", "meta", "labelLeft", "valid", "invalidMessage", "disabled", "
|
|
12030
|
+
}), null, 16, ["label", "meta", "labelLeft", "valid", "invalidMessage", "disabled", "value", "clearButton", "mask", "searchIcon"])
|
|
11951
12031
|
])
|
|
11952
12032
|
]),
|
|
11953
12033
|
dropdownVisible.value && !__props.disabled ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
@@ -11958,26 +12038,27 @@ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
|
|
|
11958
12038
|
style: vue.normalizeStyle(listWrapperStyle.value),
|
|
11959
12039
|
onScrollPassive: handleDropdownScroll
|
|
11960
12040
|
}, [
|
|
11961
|
-
|
|
11962
|
-
vue.createVNode(_sfc_main$B, {
|
|
11963
|
-
color: "blue",
|
|
11964
|
-
size: "48px"
|
|
11965
|
-
})
|
|
11966
|
-
])) : vue.unref(displayedItems) && vue.unref(displayedItems).length ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
|
|
12041
|
+
vue.unref(displayedItems) && vue.unref(displayedItems).length ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
|
|
11967
12042
|
vue.createElementVNode("div", {
|
|
11968
12043
|
class: vue.normalizeClass([headerClasses.value, "flex items-center justify-between gap-3 min-h-[53px]"])
|
|
11969
12044
|
}, [
|
|
11970
|
-
vue.
|
|
11971
|
-
|
|
11972
|
-
vue.
|
|
11973
|
-
|
|
11974
|
-
|
|
11975
|
-
|
|
12045
|
+
vue.createElementVNode("div", _hoisted_4$6, [
|
|
12046
|
+
vue.createVNode(_sfc_main$t, null, {
|
|
12047
|
+
default: vue.withCtx(() => [
|
|
12048
|
+
vue.createTextVNode(vue.toDisplayString(searchTerm.value && searchTerm.value.length ? `${totalMatchingItems.value} ${__props.searchContext.linkWord} ${totalCount.value} ${__props.searchContext.context}` : `${totalCount.value} ${__props.searchContext.context}`), 1)
|
|
12049
|
+
]),
|
|
12050
|
+
_: 1
|
|
12051
|
+
}),
|
|
12052
|
+
isSearching.value ? (vue.openBlock(), vue.createBlock(_sfc_main$B, {
|
|
12053
|
+
key: 0,
|
|
12054
|
+
color: "blue",
|
|
12055
|
+
size: "20px"
|
|
12056
|
+
})) : vue.createCommentVNode("", true)
|
|
12057
|
+
]),
|
|
11976
12058
|
__props.multiple && __props.showSelectedToggle && selectedItems.value.length > 0 ? (vue.openBlock(), vue.createBlock(_sfc_main$j, {
|
|
11977
12059
|
key: 0,
|
|
11978
12060
|
label: `${__props.selectedToggleLabel} (${selectedItems.value.length})`,
|
|
11979
12061
|
checked: showSelectedOnly.value,
|
|
11980
|
-
disablePseudoStates: true,
|
|
11981
12062
|
onChange: handleToggleSelectedOnly
|
|
11982
12063
|
}, null, 8, ["label", "checked"])) : vue.createCommentVNode("", true)
|
|
11983
12064
|
], 2),
|
|
@@ -12072,9 +12153,16 @@ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
|
|
|
12072
12153
|
], 42, _hoisted_11)
|
|
12073
12154
|
])) : vue.createCommentVNode("", true)
|
|
12074
12155
|
], 32)
|
|
12075
|
-
], 64)) :
|
|
12076
|
-
vue.createElementVNode("li", _hoisted_13,
|
|
12077
|
-
|
|
12156
|
+
], 64)) : (vue.openBlock(), vue.createElementBlock("ul", _hoisted_12, [
|
|
12157
|
+
vue.createElementVNode("li", _hoisted_13, [
|
|
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,
|
|
12161
|
+
color: "blue",
|
|
12162
|
+
size: "20px"
|
|
12163
|
+
})) : vue.createCommentVNode("", true)
|
|
12164
|
+
])
|
|
12165
|
+
]))
|
|
12078
12166
|
], 38)) : vue.createCommentVNode("", true)
|
|
12079
12167
|
])
|
|
12080
12168
|
], 16);
|
|
@@ -14625,48 +14713,6 @@ function subDays(date, amount, options) {
|
|
|
14625
14713
|
function subWeeks(date, amount, options) {
|
|
14626
14714
|
return addWeeks(date, -1, options);
|
|
14627
14715
|
}
|
|
14628
|
-
const en = {
|
|
14629
|
-
"FdsWeekCalendar.nextWeek": "Next week",
|
|
14630
|
-
"FdsWeekCalendar.previousWeek": "Previous week",
|
|
14631
|
-
"FdsWeekCalendar.today": "Today",
|
|
14632
|
-
"FdsWeekCalendar.week": "week"
|
|
14633
|
-
};
|
|
14634
|
-
const sv = {
|
|
14635
|
-
"FdsWeekCalendar.nextWeek": "Nästa vecka",
|
|
14636
|
-
"FdsWeekCalendar.previousWeek": "Föregående vecka",
|
|
14637
|
-
"FdsWeekCalendar.today": "Idag",
|
|
14638
|
-
"FdsWeekCalendar.week": "vecka"
|
|
14639
|
-
};
|
|
14640
|
-
const FDS_VUE_CORE_I18N_KEY = /* @__PURE__ */ Symbol("fds-vue-core:i18n");
|
|
14641
|
-
const translations = {
|
|
14642
|
-
en,
|
|
14643
|
-
sv
|
|
14644
|
-
};
|
|
14645
|
-
const useFdsI18n = () => {
|
|
14646
|
-
const i18n = vue.inject(FDS_VUE_CORE_I18N_KEY, void 0);
|
|
14647
|
-
const locale = vue.computed(() => {
|
|
14648
|
-
const locale2 = i18n?.global?.locale ?? i18n?.locale;
|
|
14649
|
-
if (typeof locale2 === "string") return locale2;
|
|
14650
|
-
if (locale2 && typeof locale2 === "object" && "value" in locale2 && typeof locale2.value === "string") {
|
|
14651
|
-
return locale2.value;
|
|
14652
|
-
}
|
|
14653
|
-
return "sv-SE";
|
|
14654
|
-
});
|
|
14655
|
-
const activeLanguage = vue.computed(() => locale.value.toLowerCase().split("-")[0]);
|
|
14656
|
-
const dictionary = vue.computed(() => {
|
|
14657
|
-
const currentDictionary = translations[activeLanguage.value];
|
|
14658
|
-
return currentDictionary ?? translations.sv;
|
|
14659
|
-
});
|
|
14660
|
-
const t = (key) => {
|
|
14661
|
-
const value = dictionary.value[key];
|
|
14662
|
-
return typeof value === "string" ? value : "";
|
|
14663
|
-
};
|
|
14664
|
-
return {
|
|
14665
|
-
i18n,
|
|
14666
|
-
locale,
|
|
14667
|
-
t
|
|
14668
|
-
};
|
|
14669
|
-
};
|
|
14670
14716
|
const capitalizeFirstLetter$1 = (value) => {
|
|
14671
14717
|
if (!value) return value;
|
|
14672
14718
|
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
@@ -16059,12 +16105,12 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
16059
16105
|
total: {},
|
|
16060
16106
|
unfiltered: {},
|
|
16061
16107
|
text: {},
|
|
16062
|
-
language: { default: "sv" },
|
|
16063
16108
|
dataTestid: { default: void 0 }
|
|
16064
16109
|
},
|
|
16065
16110
|
setup(__props) {
|
|
16066
16111
|
const props = __props;
|
|
16067
16112
|
const attrs = vue.useAttrs();
|
|
16113
|
+
const { t } = useFdsI18n();
|
|
16068
16114
|
const consumerClass = vue.computed(() => classValueToString(attrs.class));
|
|
16069
16115
|
const rootAttrs = vue.computed(() => {
|
|
16070
16116
|
const result = { ...attrs };
|
|
@@ -16074,7 +16120,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
16074
16120
|
}
|
|
16075
16121
|
return result;
|
|
16076
16122
|
});
|
|
16077
|
-
const separatorText = () =>
|
|
16123
|
+
const separatorText = () => t("FdsListHeading.separator");
|
|
16078
16124
|
const headingText = vue.computed(() => {
|
|
16079
16125
|
if (!props.total) {
|
|
16080
16126
|
let result = "0";
|
|
@@ -16096,7 +16142,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
16096
16142
|
if (props.loadingText && props.loadingText.length > 0) {
|
|
16097
16143
|
return props.loadingText;
|
|
16098
16144
|
}
|
|
16099
|
-
return
|
|
16145
|
+
return t("FdsListHeading.loading");
|
|
16100
16146
|
};
|
|
16101
16147
|
const wrapperClasses = vue.computed(() => {
|
|
16102
16148
|
const baseClasses = "inline-block mb-3 h-7 font-bold text-xl";
|