fds-vue-core 7.2.3 → 7.2.4
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 +10 -0
- package/dist/components/Form/FdsPhonenumber/types.d.ts +10 -2
- package/dist/fds-vue-core.cjs.js +54 -12
- package/dist/fds-vue-core.cjs.js.map +1 -1
- package/dist/fds-vue-core.es.js +55 -13
- 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/Form/FdsPhonenumber/FdsPhonenumber.vue +49 -6
- package/src/components/Form/FdsPhonenumber/types.ts +14 -2
- package/src/lang/en.json +1 -0
- package/src/lang/sv.json +1 -0
package/dist/fds-vue-core.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useAttrs, computed, useSlots, Comment, inject, defineComponent, openBlock, createElementBlock, mergeProps, createBlock, ref, watch, createElementVNode, normalizeClass, unref, createVNode, toDisplayString, createCommentVNode, renderSlot, withCtx, createTextVNode, withDirectives, vShow, resolveDynamicComponent, normalizeStyle, onMounted, onUnmounted, onBeforeUnmount, Fragment, renderList, nextTick, Teleport, withModifiers, useModel, mergeModels, provide, getCurrentInstance, vModelText, withKeys, vModelCheckbox, watchEffect, reactive, resolveComponent, Transition, normalizeProps, guardReactiveProps, vModelSelect } from "vue";
|
|
1
|
+
import { useAttrs, computed, useSlots, Comment, inject, defineComponent, openBlock, createElementBlock, mergeProps, createBlock, ref, watch, createElementVNode, normalizeClass, unref, createVNode, toDisplayString, createCommentVNode, renderSlot, withCtx, createTextVNode, withDirectives, vShow, resolveDynamicComponent, normalizeStyle, onMounted, onUnmounted, onBeforeUnmount, Fragment, renderList, nextTick, Teleport, withModifiers, useModel, mergeModels, provide, getCurrentInstance, vModelText, withKeys, vModelCheckbox, watchEffect, reactive, resolveComponent, Transition, normalizeProps, guardReactiveProps, isRef, vModelSelect } from "vue";
|
|
2
2
|
function useAttrsWithDefaults(props) {
|
|
3
3
|
const attrs = useAttrs();
|
|
4
4
|
return {
|
|
@@ -80,6 +80,7 @@ const en = {
|
|
|
80
80
|
"FdsPagination.nextPage": "Go to next page",
|
|
81
81
|
"FdsPagination.previousPage": "Go to previous page",
|
|
82
82
|
"FdsPhonenumber.countryCode": "Country code",
|
|
83
|
+
"FdsPhonenumber.invalidPhone": "Enter a valid phone number",
|
|
83
84
|
"FdsPhonenumber.noCountryResults": "No country matches your search",
|
|
84
85
|
"FdsPhonenumber.phoneNumber": "Phone number",
|
|
85
86
|
"FdsSearchSelectPro.loadingMore": "Loading more...",
|
|
@@ -146,6 +147,7 @@ const sv = {
|
|
|
146
147
|
"FdsPagination.nextPage": "Gå till nästa sida",
|
|
147
148
|
"FdsPagination.previousPage": "Gå till föregående sida",
|
|
148
149
|
"FdsPhonenumber.countryCode": "Landskod",
|
|
150
|
+
"FdsPhonenumber.invalidPhone": "Ange ett giltigt telefonnummer",
|
|
149
151
|
"FdsPhonenumber.noCountryResults": "Inget land matchar sökningen",
|
|
150
152
|
"FdsPhonenumber.phoneNumber": "Telefonnummer",
|
|
151
153
|
"FdsSearchSelectPro.loadingMore": "Hämtar fler...",
|
|
@@ -18738,7 +18740,22 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
18738
18740
|
disabled: { type: Boolean, default: false },
|
|
18739
18741
|
dataTestid: { default: void 0 },
|
|
18740
18742
|
selectClass: { default: void 0 },
|
|
18741
|
-
inputClass: { default: void 0 }
|
|
18743
|
+
inputClass: { default: void 0 },
|
|
18744
|
+
onValid: {},
|
|
18745
|
+
onNoCountryResults: {},
|
|
18746
|
+
onBlur: {},
|
|
18747
|
+
"onUpdate:e164": {},
|
|
18748
|
+
"onUpdate:country": {},
|
|
18749
|
+
id: { default: void 0 },
|
|
18750
|
+
autocomplete: { default: "tel" },
|
|
18751
|
+
required: { type: Boolean, default: false },
|
|
18752
|
+
placeholder: { default: void 0 },
|
|
18753
|
+
maxlength: { default: void 0 },
|
|
18754
|
+
minlength: { default: void 0 },
|
|
18755
|
+
name: { default: void 0 },
|
|
18756
|
+
autofocus: { type: Boolean, default: false },
|
|
18757
|
+
readonly: { type: Boolean, default: false },
|
|
18758
|
+
pattern: { default: void 0 }
|
|
18742
18759
|
}, {
|
|
18743
18760
|
"modelValue": { default: "" },
|
|
18744
18761
|
"modelModifiers": {},
|
|
@@ -18747,12 +18764,33 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
18747
18764
|
}),
|
|
18748
18765
|
emits: /* @__PURE__ */ mergeModels(["update:country", "update:e164", "valid", "noCountryResults", "blur"], ["update:modelValue", "update:country"]),
|
|
18749
18766
|
setup(__props, { emit: __emit }) {
|
|
18750
|
-
const nationalNumber = useModel(__props, "modelValue");
|
|
18767
|
+
const [nationalNumber, modelModifiers] = useModel(__props, "modelValue");
|
|
18751
18768
|
const country = useModel(__props, "country");
|
|
18769
|
+
const attrs = useAttrs();
|
|
18752
18770
|
const props = __props;
|
|
18753
18771
|
const emit = __emit;
|
|
18754
18772
|
const { t, locale: fdsLocale } = useFdsI18n();
|
|
18755
18773
|
const resolvedLocale = computed(() => props.locale ?? fdsLocale.value);
|
|
18774
|
+
const inputAttrs = computed(() => {
|
|
18775
|
+
const { class: _class, style, ...rest } = attrs;
|
|
18776
|
+
return {
|
|
18777
|
+
...rest,
|
|
18778
|
+
...style == null ? {} : { style }
|
|
18779
|
+
};
|
|
18780
|
+
});
|
|
18781
|
+
const forwardedInputProps = computed(() => ({
|
|
18782
|
+
id: props.id,
|
|
18783
|
+
autocomplete: props.autocomplete,
|
|
18784
|
+
required: props.required,
|
|
18785
|
+
placeholder: props.placeholder,
|
|
18786
|
+
maxlength: props.maxlength,
|
|
18787
|
+
minlength: props.minlength,
|
|
18788
|
+
name: props.name,
|
|
18789
|
+
autofocus: props.autofocus,
|
|
18790
|
+
readonly: props.readonly,
|
|
18791
|
+
pattern: props.pattern,
|
|
18792
|
+
...inputAttrs.value
|
|
18793
|
+
}));
|
|
18756
18794
|
const countryItems = computed(() => {
|
|
18757
18795
|
const options = props.countries?.length ? props.countries : buildCountryOptions(resolvedLocale.value, props.defaultCountry);
|
|
18758
18796
|
return sortCountryOptionsByName(
|
|
@@ -18763,6 +18801,10 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
18763
18801
|
});
|
|
18764
18802
|
const phoneValidationOptions = computed(() => ({ numberType: props.numberType }));
|
|
18765
18803
|
const committedValid = ref(null);
|
|
18804
|
+
const resolvedLabel = computed(() => props.label === void 0 ? t("FdsPhonenumber.phoneNumber") : props.label);
|
|
18805
|
+
const resolvedInvalidMessage = computed(
|
|
18806
|
+
() => props.invalidMessage === void 0 ? t("FdsPhonenumber.invalidPhone") : props.invalidMessage
|
|
18807
|
+
);
|
|
18766
18808
|
const displayValid = computed(() => {
|
|
18767
18809
|
if (props.valid === false) return false;
|
|
18768
18810
|
if (props.valid === true) return true;
|
|
@@ -18771,7 +18813,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
18771
18813
|
return props.valid;
|
|
18772
18814
|
});
|
|
18773
18815
|
const showInvalidMessage = computed(
|
|
18774
|
-
() => displayValid.value === false && !props.optional &&
|
|
18816
|
+
() => displayValid.value === false && !props.optional && !!resolvedInvalidMessage.value && !props.disabled
|
|
18775
18817
|
);
|
|
18776
18818
|
const noCountryResults = ref(false);
|
|
18777
18819
|
function runValidation() {
|
|
@@ -18801,10 +18843,10 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
18801
18843
|
}
|
|
18802
18844
|
return (_ctx, _cache) => {
|
|
18803
18845
|
return openBlock(), createElementBlock("div", _hoisted_1$4, [
|
|
18804
|
-
|
|
18846
|
+
resolvedLabel.value ? (openBlock(), createElementBlock("label", {
|
|
18805
18847
|
key: 0,
|
|
18806
18848
|
class: normalizeClass(["block font-bold text-gray-900 cursor-pointer", { "mb-0": __props.meta, "mb-1": !__props.meta }])
|
|
18807
|
-
}, toDisplayString(
|
|
18849
|
+
}, toDisplayString(resolvedLabel.value), 3)) : createCommentVNode("", true),
|
|
18808
18850
|
__props.meta ? (openBlock(), createElementBlock("div", _hoisted_2$3, toDisplayString(__props.meta), 1)) : createCommentVNode("", true),
|
|
18809
18851
|
createElementVNode("div", _hoisted_3$3, [
|
|
18810
18852
|
createVNode(_sfc_main$b, {
|
|
@@ -18818,21 +18860,21 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
18818
18860
|
class: normalizeClass(["mb-0! shrink-0", __props.selectClass ?? ""]),
|
|
18819
18861
|
onNoCountryResults
|
|
18820
18862
|
}, null, 8, ["modelValue", "items", "valid", "disabled", "ariaLabel", "data-testid", "class"]),
|
|
18821
|
-
createVNode(_sfc_main$u, {
|
|
18822
|
-
modelValue: nationalNumber
|
|
18823
|
-
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => nationalNumber.value = $event),
|
|
18863
|
+
createVNode(_sfc_main$u, mergeProps({
|
|
18864
|
+
modelValue: unref(nationalNumber),
|
|
18865
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(nationalNumber) ? nationalNumber.value = $event : null),
|
|
18866
|
+
modelModifiers: unref(modelModifiers),
|
|
18824
18867
|
type: "tel",
|
|
18825
18868
|
valid: displayValid.value,
|
|
18826
18869
|
disabled: __props.disabled,
|
|
18827
18870
|
optional: __props.optional,
|
|
18828
18871
|
ariaLabel: unref(t)("FdsPhonenumber.phoneNumber"),
|
|
18829
18872
|
"data-testid": __props.dataTestid ? `${__props.dataTestid}-number` : void 0,
|
|
18830
|
-
class:
|
|
18831
|
-
|
|
18832
|
-
}, null, 8, ["modelValue", "valid", "disabled", "optional", "ariaLabel", "data-testid", "class"])
|
|
18873
|
+
class: ["mb-0! min-w-0 flex-1", __props.inputClass ?? ""]
|
|
18874
|
+
}, forwardedInputProps.value, { onBlur: handleBlur }), null, 16, ["modelValue", "modelModifiers", "valid", "disabled", "optional", "ariaLabel", "data-testid", "class"])
|
|
18833
18875
|
]),
|
|
18834
18876
|
noCountryResults.value ? (openBlock(), createElementBlock("div", _hoisted_4$3, toDisplayString(unref(t)("FdsPhonenumber.noCountryResults")), 1)) : createCommentVNode("", true),
|
|
18835
|
-
showInvalidMessage.value ? (openBlock(), createElementBlock("div", _hoisted_5$3, toDisplayString(
|
|
18877
|
+
showInvalidMessage.value ? (openBlock(), createElementBlock("div", _hoisted_5$3, toDisplayString(resolvedInvalidMessage.value), 1)) : createCommentVNode("", true)
|
|
18836
18878
|
]);
|
|
18837
18879
|
};
|
|
18838
18880
|
}
|