fds-vue-core 8.6.2 → 8.6.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/FdsSsn/FdsSsn.vue.d.ts +4 -0
- package/dist/components/Form/FdsSsn/types.d.ts +4 -1
- package/dist/fds-vue-core.cjs.js +46 -28
- 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 +46 -28
- 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/FdsInput/FdsInput.vue +3 -2
- package/src/components/Form/FdsSelect/FdsSelect.vue +1 -1
- package/src/components/Form/FdsSsn/FdsSsn.stories.ts +54 -1
- package/src/components/Form/FdsSsn/FdsSsn.vue +20 -3
- package/src/components/Form/FdsSsn/types.ts +5 -0
- package/src/helpers/validateSsn.ts +1 -1
- package/src/lang/en.json +1 -1
- package/src/lang/sv.json +1 -1
|
@@ -7,16 +7,19 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {}, {},
|
|
|
7
7
|
blur: (ev: FocusEvent) => any;
|
|
8
8
|
"update:modelValue": (...args: unknown[]) => any;
|
|
9
9
|
valid: (value: boolean | null) => any;
|
|
10
|
+
clearInput: () => any;
|
|
10
11
|
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
11
12
|
onBlur?: ((ev: FocusEvent) => any) | undefined;
|
|
12
13
|
"onUpdate:modelValue"?: ((...args: unknown[]) => any) | undefined;
|
|
13
14
|
onValid?: ((value: boolean | null) => any) | undefined;
|
|
15
|
+
onClearInput?: (() => any) | undefined;
|
|
14
16
|
}>, {
|
|
15
17
|
disabled: boolean;
|
|
16
18
|
required: boolean;
|
|
17
19
|
id: string;
|
|
18
20
|
name: string;
|
|
19
21
|
placeholder: string;
|
|
22
|
+
maxlength: number;
|
|
20
23
|
dataTestid: string;
|
|
21
24
|
label: string;
|
|
22
25
|
meta: string;
|
|
@@ -25,6 +28,7 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {}, {},
|
|
|
25
28
|
valid: boolean | null;
|
|
26
29
|
optional: boolean;
|
|
27
30
|
invalidMessage: string;
|
|
31
|
+
clearButton: boolean;
|
|
28
32
|
autocomplete: string;
|
|
29
33
|
readonly: boolean;
|
|
30
34
|
allowCoordinationNumber: boolean;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { FdsInputProps } from '../FdsInput/types';
|
|
2
|
-
type FdsSsnInputPassthroughProps = Pick<FdsInputProps, 'id' | 'autocomplete' | 'required' | 'placeholder' | 'name' | 'autofocus' | 'readonly' | 'inputClass'>;
|
|
2
|
+
type FdsSsnInputPassthroughProps = Pick<FdsInputProps, 'id' | 'autocomplete' | 'required' | 'placeholder' | 'name' | 'autofocus' | 'readonly' | 'inputClass' | 'maxlength' | 'clearButton'>;
|
|
3
3
|
export interface FdsSsnProps extends FdsSsnInputPassthroughProps {
|
|
4
4
|
label?: string;
|
|
5
5
|
meta?: string;
|
|
6
6
|
optional?: boolean;
|
|
7
7
|
valid?: boolean | null;
|
|
8
|
+
/** Error text when invalid. Omit for default; pass `""` to hide the message. */
|
|
8
9
|
invalidMessage?: string;
|
|
9
10
|
/** Personnummer as shown in the input (12 characters, no separator). */
|
|
10
11
|
modelValue?: string;
|
|
@@ -14,11 +15,13 @@ export interface FdsSsnProps extends FdsSsnInputPassthroughProps {
|
|
|
14
15
|
dataTestid?: string;
|
|
15
16
|
onValid?: ((value: boolean | null) => void) | Array<(value: boolean | null) => void>;
|
|
16
17
|
onBlur?: ((event: FocusEvent) => void) | Array<(event: FocusEvent) => void>;
|
|
18
|
+
onClearInput?: (() => void) | Array<() => void>;
|
|
17
19
|
'onUpdate:modelValue'?: ((value: string) => void) | Array<(value: string) => void>;
|
|
18
20
|
}
|
|
19
21
|
export interface FdsSsnEmits {
|
|
20
22
|
'update:modelValue': [value: string];
|
|
21
23
|
valid: [value: boolean | null];
|
|
22
24
|
blur: [ev: FocusEvent];
|
|
25
|
+
clearInput: [];
|
|
23
26
|
}
|
|
24
27
|
export {};
|
package/dist/fds-vue-core.cjs.js
CHANGED
|
@@ -90,7 +90,7 @@ const en = {
|
|
|
90
90
|
"FdsPhonenumber.invalidPhone": "Enter a valid phone number",
|
|
91
91
|
"FdsPhonenumber.noCountryResults": "No country matches your search",
|
|
92
92
|
"FdsPhonenumber.phoneNumber": "Phone number",
|
|
93
|
-
"FdsSsn.invalidSsn": "Enter a valid personal identity number",
|
|
93
|
+
"FdsSsn.invalidSsn": "Enter a valid Swedish personal identity number or coordination number",
|
|
94
94
|
"FdsSsn.label": "Personal identity number",
|
|
95
95
|
"FdsSearchSelectPro.loadingMore": "Loading more...",
|
|
96
96
|
"FdsSearchSelectPro.showMore": "Show more",
|
|
@@ -166,7 +166,7 @@ const sv = {
|
|
|
166
166
|
"FdsPhonenumber.invalidPhone": "Ange ett giltigt telefonnummer",
|
|
167
167
|
"FdsPhonenumber.noCountryResults": "Inget land matchar sökningen",
|
|
168
168
|
"FdsPhonenumber.phoneNumber": "Telefonnummer",
|
|
169
|
-
"FdsSsn.invalidSsn": "Ange ett giltigt personnummer",
|
|
169
|
+
"FdsSsn.invalidSsn": "Ange ett giltigt personnummer eller samordningsnummer",
|
|
170
170
|
"FdsSsn.label": "Personnummer",
|
|
171
171
|
"FdsSearchSelectPro.loadingMore": "Hämtar fler...",
|
|
172
172
|
"FdsSearchSelectPro.showMore": "Visa fler",
|
|
@@ -10223,7 +10223,7 @@ const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
|
|
|
10223
10223
|
});
|
|
10224
10224
|
const _hoisted_1$l = ["for", "id"];
|
|
10225
10225
|
const _hoisted_2$f = { class: "relative" };
|
|
10226
|
-
const _hoisted_3$f = ["type", "required", "disabled", "tabindex", "aria-invalid", "aria-label", "aria-labelledby", "aria-describedby", "autocomplete", "placeholder", "pattern", "searchIcon"];
|
|
10226
|
+
const _hoisted_3$f = ["type", "required", "disabled", "maxlength", "tabindex", "aria-invalid", "aria-label", "aria-labelledby", "aria-describedby", "autocomplete", "placeholder", "pattern", "searchIcon"];
|
|
10227
10227
|
const _hoisted_4$e = {
|
|
10228
10228
|
key: 0,
|
|
10229
10229
|
class: "text-red-700 font-bold mt-1"
|
|
@@ -10372,7 +10372,7 @@ const _sfc_main$t = /* @__PURE__ */ vue.defineComponent({
|
|
|
10372
10372
|
props.inputClass
|
|
10373
10373
|
]);
|
|
10374
10374
|
const inputStyle = vue.computed(() => {
|
|
10375
|
-
if (!maxlength.value) return void 0;
|
|
10375
|
+
if (!maxlength.value || props.inputClass) return void 0;
|
|
10376
10376
|
return {
|
|
10377
10377
|
width: `calc(${maxlength.value}ch + 1.5rem + 0.25rem)`,
|
|
10378
10378
|
maxWidth: "100%"
|
|
@@ -10551,6 +10551,7 @@ const _sfc_main$t = /* @__PURE__ */ vue.defineComponent({
|
|
|
10551
10551
|
type: inputType.value === "password" ? showPassword.value ? "text" : "password" : inputType.value,
|
|
10552
10552
|
required: props.required,
|
|
10553
10553
|
disabled: props.disabled,
|
|
10554
|
+
maxlength: vue.unref(maxlength),
|
|
10554
10555
|
tabindex: props.disabled ? -1 : void 0,
|
|
10555
10556
|
"aria-invalid": props.valid === false ? "true" : void 0,
|
|
10556
10557
|
class: inputClasses.value,
|
|
@@ -10586,7 +10587,7 @@ const _sfc_main$t = /* @__PURE__ */ vue.defineComponent({
|
|
|
10586
10587
|
isInvalid.value ? (vue.openBlock(), vue.createBlock(_sfc_main$P, {
|
|
10587
10588
|
key: 1,
|
|
10588
10589
|
name: "alert",
|
|
10589
|
-
class: "fill-red-
|
|
10590
|
+
class: "fill-red-600"
|
|
10590
10591
|
})) : vue.createCommentVNode("", true),
|
|
10591
10592
|
isValid2.value ? (vue.openBlock(), vue.createBlock(_sfc_main$P, {
|
|
10592
10593
|
key: 2,
|
|
@@ -19987,20 +19988,6 @@ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
|
|
|
19987
19988
|
};
|
|
19988
19989
|
}
|
|
19989
19990
|
});
|
|
19990
|
-
const SSN_MASK = "000000000000";
|
|
19991
|
-
const SSN_INTERIM_MASK = "XXXXXXXXXXXX";
|
|
19992
|
-
const SSN_INTERIM_MASK_OPTIONS = {
|
|
19993
|
-
lazy: true,
|
|
19994
|
-
definitions: {
|
|
19995
|
-
X: /[0-9A-Za-z]/
|
|
19996
|
-
}
|
|
19997
|
-
};
|
|
19998
|
-
function getSsnMask(allowInterimNumber) {
|
|
19999
|
-
return allowInterimNumber ? SSN_INTERIM_MASK : SSN_MASK;
|
|
20000
|
-
}
|
|
20001
|
-
function getSsnMaskOptions(allowInterimNumber) {
|
|
20002
|
-
return allowInterimNumber ? SSN_INTERIM_MASK_OPTIONS : { lazy: true };
|
|
20003
|
-
}
|
|
20004
19991
|
var PersonnummerError = class extends Error {
|
|
20005
19992
|
constructor() {
|
|
20006
19993
|
super("Invalid swedish personal identity number");
|
|
@@ -20303,7 +20290,7 @@ const INVALID_RESULT = {
|
|
|
20303
20290
|
};
|
|
20304
20291
|
const DEFAULT_SSN_VALIDATION_OPTIONS = {
|
|
20305
20292
|
allowCoordinationNumber: true,
|
|
20306
|
-
allowInterimNumber:
|
|
20293
|
+
allowInterimNumber: false
|
|
20307
20294
|
};
|
|
20308
20295
|
function resolveSsnValidationOptions(options) {
|
|
20309
20296
|
return {
|
|
@@ -20335,6 +20322,20 @@ function getSsnValidationState(value, options) {
|
|
|
20335
20322
|
}
|
|
20336
20323
|
return validateSsn(value, options);
|
|
20337
20324
|
}
|
|
20325
|
+
const SSN_MASK = "000000000000";
|
|
20326
|
+
const SSN_INTERIM_MASK = "XXXXXXXXXXXX";
|
|
20327
|
+
const SSN_INTERIM_MASK_OPTIONS = {
|
|
20328
|
+
lazy: true,
|
|
20329
|
+
definitions: {
|
|
20330
|
+
X: /[0-9A-Za-z]/
|
|
20331
|
+
}
|
|
20332
|
+
};
|
|
20333
|
+
function getSsnMask(allowInterimNumber) {
|
|
20334
|
+
return allowInterimNumber ? SSN_INTERIM_MASK : SSN_MASK;
|
|
20335
|
+
}
|
|
20336
|
+
function getSsnMaskOptions(allowInterimNumber) {
|
|
20337
|
+
return allowInterimNumber ? SSN_INTERIM_MASK_OPTIONS : { lazy: true };
|
|
20338
|
+
}
|
|
20338
20339
|
const _hoisted_1$4 = { class: "w-full" };
|
|
20339
20340
|
const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
|
|
20340
20341
|
...{
|
|
@@ -20354,6 +20355,7 @@ const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
|
|
|
20354
20355
|
dataTestid: { default: void 0 },
|
|
20355
20356
|
onValid: {},
|
|
20356
20357
|
onBlur: {},
|
|
20358
|
+
onClearInput: {},
|
|
20357
20359
|
"onUpdate:modelValue": {},
|
|
20358
20360
|
id: { default: void 0 },
|
|
20359
20361
|
autocomplete: { default: "off" },
|
|
@@ -20362,12 +20364,14 @@ const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
|
|
|
20362
20364
|
name: { default: void 0 },
|
|
20363
20365
|
autofocus: { type: Boolean, default: false },
|
|
20364
20366
|
readonly: { type: Boolean, default: false },
|
|
20365
|
-
inputClass: { default: void 0 }
|
|
20367
|
+
inputClass: { default: void 0 },
|
|
20368
|
+
maxlength: { default: void 0 },
|
|
20369
|
+
clearButton: { type: Boolean, default: false }
|
|
20366
20370
|
}, {
|
|
20367
20371
|
"modelValue": { default: "" },
|
|
20368
20372
|
"modelModifiers": {}
|
|
20369
20373
|
}),
|
|
20370
|
-
emits: /* @__PURE__ */ vue.mergeModels(["update:modelValue", "valid", "blur"], ["update:modelValue"]),
|
|
20374
|
+
emits: /* @__PURE__ */ vue.mergeModels(["update:modelValue", "valid", "blur", "clearInput"], ["update:modelValue"]),
|
|
20371
20375
|
setup(__props, { emit: __emit }) {
|
|
20372
20376
|
const modelValue = vue.useModel(__props, "modelValue");
|
|
20373
20377
|
const attrs = vue.useAttrs();
|
|
@@ -20375,9 +20379,12 @@ const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
|
|
|
20375
20379
|
const emit = __emit;
|
|
20376
20380
|
const { t } = useFdsI18n();
|
|
20377
20381
|
const inputAttrs = vue.computed(() => {
|
|
20378
|
-
const { class:
|
|
20382
|
+
const { class: rawClass, style, ...rest } = attrs;
|
|
20379
20383
|
return {
|
|
20380
20384
|
...rest,
|
|
20385
|
+
...rawClass == null ? {} : {
|
|
20386
|
+
class: rawClass
|
|
20387
|
+
},
|
|
20381
20388
|
...style == null ? {} : { style }
|
|
20382
20389
|
};
|
|
20383
20390
|
});
|
|
@@ -20389,8 +20396,11 @@ const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
|
|
|
20389
20396
|
name: props.name,
|
|
20390
20397
|
autofocus: props.autofocus,
|
|
20391
20398
|
readonly: props.readonly,
|
|
20399
|
+
maxlength: props.maxlength,
|
|
20400
|
+
clearButton: props.clearButton,
|
|
20392
20401
|
inputmode: props.allowInterimNumber ? "text" : "numeric",
|
|
20393
|
-
...inputAttrs.value
|
|
20402
|
+
...inputAttrs.value,
|
|
20403
|
+
inputClass: props.inputClass
|
|
20394
20404
|
}));
|
|
20395
20405
|
const validationOptions = vue.computed(
|
|
20396
20406
|
() => ({
|
|
@@ -20434,6 +20444,11 @@ const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
|
|
|
20434
20444
|
runValidation();
|
|
20435
20445
|
emit("blur", ev);
|
|
20436
20446
|
}
|
|
20447
|
+
function handleClearInput() {
|
|
20448
|
+
committedValid.value = null;
|
|
20449
|
+
emit("valid", null);
|
|
20450
|
+
emit("clearInput");
|
|
20451
|
+
}
|
|
20437
20452
|
return (_ctx, _cache) => {
|
|
20438
20453
|
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$4, [
|
|
20439
20454
|
vue.createVNode(_sfc_main$t, vue.mergeProps({
|
|
@@ -20448,9 +20463,12 @@ const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
|
|
|
20448
20463
|
optional: __props.optional,
|
|
20449
20464
|
"invalid-message": resolvedInvalidMessage.value,
|
|
20450
20465
|
ariaLabel: resolvedLabel.value,
|
|
20451
|
-
"data-testid": __props.dataTestid
|
|
20452
|
-
|
|
20453
|
-
|
|
20466
|
+
"data-testid": __props.dataTestid
|
|
20467
|
+
}, forwardedInputProps.value, {
|
|
20468
|
+
"input-class": __props.inputClass,
|
|
20469
|
+
onBlur: handleBlur,
|
|
20470
|
+
onClearInput: handleClearInput
|
|
20471
|
+
}), null, 16, ["model-value", "mask", "mask-options", "label", "meta", "valid", "disabled", "optional", "invalid-message", "ariaLabel", "data-testid", "input-class"])
|
|
20454
20472
|
]);
|
|
20455
20473
|
};
|
|
20456
20474
|
}
|
|
@@ -20588,7 +20606,7 @@ const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
|
|
|
20588
20606
|
size: 24,
|
|
20589
20607
|
class: vue.normalizeClass({
|
|
20590
20608
|
"fill-gray-500": vue.unref(disabled),
|
|
20591
|
-
"fill-red-
|
|
20609
|
+
"fill-red-600": isInvalid.value && !vue.unref(disabled),
|
|
20592
20610
|
"fill-blue-500": !vue.unref(disabled) && !isInvalid.value
|
|
20593
20611
|
})
|
|
20594
20612
|
}, null, 8, ["class"])
|