fds-vue-core 8.2.3 → 8.3.0
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/components.d.ts +2 -0
- package/dist/components/FdsSearchSelect/FdsSearchSelect.vue.d.ts +3 -5
- package/dist/components/FdsSearchSelectPro/FdsSearchSelectPro.vue.d.ts +3 -5
- package/dist/components/Form/FdsInput/FdsInput.vue.d.ts +2 -3
- package/dist/components/Form/FdsInput/types.d.ts +0 -2
- package/dist/components/Form/FdsPhonenumber/FdsPhonenumber.vue.d.ts +0 -3
- package/dist/components/Form/FdsPhonenumber/normalizePhoneInput.d.ts +7 -0
- package/dist/components/Form/FdsPhonenumber/phoneMask.d.ts +2 -0
- package/dist/components/Form/FdsPhonenumber/types.d.ts +1 -1
- package/dist/components/Form/FdsSsn/FdsSsn.vue.d.ts +33 -0
- package/dist/components/Form/FdsSsn/ssnMask.d.ts +19 -0
- package/dist/components/Form/FdsSsn/types.d.ts +24 -0
- package/dist/fds-vue-core.cjs.js +937 -448
- 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 +938 -449
- package/dist/fds-vue-core.es.js.map +1 -1
- package/dist/helpers/validateSsn.d.ts +16 -0
- package/dist/index.d.ts +5 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +2 -1
- package/src/components/Form/FdsInput/FdsInput.stories.ts +1 -7
- package/src/components/Form/FdsInput/FdsInput.vue +41 -163
- package/src/components/Form/FdsInput/types.ts +0 -2
- package/src/components/Form/FdsPhonenumber/FdsPhonenumber.vue +30 -9
- package/src/components/Form/FdsPhonenumber/normalizePhoneInput.ts +88 -0
- package/src/components/Form/FdsPhonenumber/phoneMask.ts +28 -0
- package/src/components/Form/FdsPhonenumber/types.ts +0 -3
- package/src/components/Form/FdsSsn/FdsSsn.stories.ts +131 -0
- package/src/components/Form/FdsSsn/FdsSsn.vue +133 -0
- package/src/components/Form/FdsSsn/ssnMask.ts +20 -0
- package/src/components/Form/FdsSsn/types.ts +36 -0
- package/src/helpers/validateSsn.ts +63 -0
- package/src/index.ts +16 -0
- package/src/lang/en.json +2 -0
- package/src/lang/sv.json +2 -0
package/components.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ import type { FdsInputProps } from './src/components/Form/FdsInput/types'
|
|
|
32
32
|
import type { FdsRadioProps } from './src/components/Form/FdsRadio/types'
|
|
33
33
|
import type { FdsSelectProps } from './src/components/Form/FdsSelect/types'
|
|
34
34
|
import type { FdsPhonenumberEmits, FdsPhonenumberProps } from './src/components/Form/FdsPhonenumber/types'
|
|
35
|
+
import type { FdsSsnEmits, FdsSsnProps } from './src/components/Form/FdsSsn/types'
|
|
35
36
|
import type { FdsTextareaEmits, FdsTextareaProps } from './src/components/Form/FdsTextarea/types'
|
|
36
37
|
import type { FdsTableProps } from './src/components/Table/FdsTable/types'
|
|
37
38
|
import type { FdsTableHeadProps } from './src/components/Table/FdsTableHead/types'
|
|
@@ -64,6 +65,7 @@ declare module 'vue' {
|
|
|
64
65
|
FdsCheckbox: DefineComponent<FdsCheckboxProps>
|
|
65
66
|
FdsTextarea: DefineComponent<FdsTextareaProps, {}, {}, {}, {}, {}, {}, FdsTextareaEmits>
|
|
66
67
|
FdsPhonenumber: DefineComponent<FdsPhonenumberProps, {}, {}, {}, {}, {}, {}, FdsPhonenumberEmits>
|
|
68
|
+
FdsSsn: DefineComponent<FdsSsnProps, {}, {}, {}, {}, {}, {}, FdsSsnEmits>
|
|
67
69
|
FdsSelect: DefineComponent<FdsSelectProps>
|
|
68
70
|
FdsTable: DefineComponent<FdsTableProps>
|
|
69
71
|
FdsTableHead: DefineComponent<FdsTableHeadProps>
|
|
@@ -52,9 +52,9 @@ declare const _default: import('vue').DefineComponent<FdsSearchSelectProps, {
|
|
|
52
52
|
} & import('../..').FdsInputProps> & Readonly<{
|
|
53
53
|
onInput?: ((ev: Event) => any) | undefined;
|
|
54
54
|
onBlur?: ((ev: FocusEvent) => any) | undefined;
|
|
55
|
-
onChange?: ((ev: Event) => any) | undefined;
|
|
56
55
|
onKeyup?: ((ev: KeyboardEvent) => any) | undefined;
|
|
57
56
|
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
57
|
+
onAutocomplete?: ((ev: Event) => any) | undefined;
|
|
58
58
|
onClearInput?: (() => any) | undefined;
|
|
59
59
|
"onUpdate:value"?: ((value: string) => any) | undefined;
|
|
60
60
|
"onKeyup.enter"?: ((ev: KeyboardEvent) => any) | undefined;
|
|
@@ -63,8 +63,8 @@ declare const _default: import('vue').DefineComponent<FdsSearchSelectProps, {
|
|
|
63
63
|
} & {
|
|
64
64
|
input: (ev: Event) => any;
|
|
65
65
|
blur: (ev: FocusEvent) => any;
|
|
66
|
-
change: (ev: Event) => any;
|
|
67
66
|
keyup: (ev: KeyboardEvent) => any;
|
|
67
|
+
autocomplete: (ev: Event) => any;
|
|
68
68
|
clearInput: () => any;
|
|
69
69
|
"update:value": (value: string) => any;
|
|
70
70
|
"keyup.enter": (ev: KeyboardEvent) => any;
|
|
@@ -83,7 +83,6 @@ declare const _default: import('vue').DefineComponent<FdsSearchSelectProps, {
|
|
|
83
83
|
optional: boolean;
|
|
84
84
|
labelLeft: boolean;
|
|
85
85
|
clearButton: boolean;
|
|
86
|
-
displayChar: string;
|
|
87
86
|
ariaLabel: string;
|
|
88
87
|
maskOptions: {
|
|
89
88
|
lazy?: boolean;
|
|
@@ -107,9 +106,9 @@ declare const _default: import('vue').DefineComponent<FdsSearchSelectProps, {
|
|
|
107
106
|
} & import('../..').FdsInputProps> & Readonly<{
|
|
108
107
|
onInput?: ((ev: Event) => any) | undefined;
|
|
109
108
|
onBlur?: ((ev: FocusEvent) => any) | undefined;
|
|
110
|
-
onChange?: ((ev: Event) => any) | undefined;
|
|
111
109
|
onKeyup?: ((ev: KeyboardEvent) => any) | undefined;
|
|
112
110
|
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
111
|
+
onAutocomplete?: ((ev: Event) => any) | undefined;
|
|
113
112
|
onClearInput?: (() => any) | undefined;
|
|
114
113
|
"onUpdate:value"?: ((value: string) => any) | undefined;
|
|
115
114
|
"onKeyup.enter"?: ((ev: KeyboardEvent) => any) | undefined;
|
|
@@ -128,7 +127,6 @@ declare const _default: import('vue').DefineComponent<FdsSearchSelectProps, {
|
|
|
128
127
|
optional: boolean;
|
|
129
128
|
labelLeft: boolean;
|
|
130
129
|
clearButton: boolean;
|
|
131
|
-
displayChar: string;
|
|
132
130
|
ariaLabel: string;
|
|
133
131
|
maskOptions: {
|
|
134
132
|
lazy?: boolean;
|
|
@@ -73,9 +73,9 @@ declare const _default: import('vue').DefineComponent<FdsSearchSelectProProps, {
|
|
|
73
73
|
} & import('../..').FdsInputProps> & Readonly<{
|
|
74
74
|
onInput?: ((ev: Event) => any) | undefined;
|
|
75
75
|
onBlur?: ((ev: FocusEvent) => any) | undefined;
|
|
76
|
-
onChange?: ((ev: Event) => any) | undefined;
|
|
77
76
|
onKeyup?: ((ev: KeyboardEvent) => any) | undefined;
|
|
78
77
|
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
78
|
+
onAutocomplete?: ((ev: Event) => any) | undefined;
|
|
79
79
|
onClearInput?: (() => any) | undefined;
|
|
80
80
|
"onUpdate:value"?: ((value: string) => any) | undefined;
|
|
81
81
|
"onKeyup.enter"?: ((ev: KeyboardEvent) => any) | undefined;
|
|
@@ -84,8 +84,8 @@ declare const _default: import('vue').DefineComponent<FdsSearchSelectProProps, {
|
|
|
84
84
|
} & {
|
|
85
85
|
input: (ev: Event) => any;
|
|
86
86
|
blur: (ev: FocusEvent) => any;
|
|
87
|
-
change: (ev: Event) => any;
|
|
88
87
|
keyup: (ev: KeyboardEvent) => any;
|
|
88
|
+
autocomplete: (ev: Event) => any;
|
|
89
89
|
clearInput: () => any;
|
|
90
90
|
"update:value": (value: string) => any;
|
|
91
91
|
"keyup.enter": (ev: KeyboardEvent) => any;
|
|
@@ -104,7 +104,6 @@ declare const _default: import('vue').DefineComponent<FdsSearchSelectProProps, {
|
|
|
104
104
|
optional: boolean;
|
|
105
105
|
labelLeft: boolean;
|
|
106
106
|
clearButton: boolean;
|
|
107
|
-
displayChar: string;
|
|
108
107
|
ariaLabel: string;
|
|
109
108
|
maskOptions: {
|
|
110
109
|
lazy?: boolean;
|
|
@@ -128,9 +127,9 @@ declare const _default: import('vue').DefineComponent<FdsSearchSelectProProps, {
|
|
|
128
127
|
} & import('../..').FdsInputProps> & Readonly<{
|
|
129
128
|
onInput?: ((ev: Event) => any) | undefined;
|
|
130
129
|
onBlur?: ((ev: FocusEvent) => any) | undefined;
|
|
131
|
-
onChange?: ((ev: Event) => any) | undefined;
|
|
132
130
|
onKeyup?: ((ev: KeyboardEvent) => any) | undefined;
|
|
133
131
|
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
132
|
+
onAutocomplete?: ((ev: Event) => any) | undefined;
|
|
134
133
|
onClearInput?: (() => any) | undefined;
|
|
135
134
|
"onUpdate:value"?: ((value: string) => any) | undefined;
|
|
136
135
|
"onKeyup.enter"?: ((ev: KeyboardEvent) => any) | undefined;
|
|
@@ -149,7 +148,6 @@ declare const _default: import('vue').DefineComponent<FdsSearchSelectProProps, {
|
|
|
149
148
|
optional: boolean;
|
|
150
149
|
labelLeft: boolean;
|
|
151
150
|
clearButton: boolean;
|
|
152
|
-
displayChar: string;
|
|
153
151
|
ariaLabel: string;
|
|
154
152
|
maskOptions: {
|
|
155
153
|
lazy?: boolean;
|
|
@@ -8,17 +8,17 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {}, {},
|
|
|
8
8
|
} & {
|
|
9
9
|
input: (ev: Event) => any;
|
|
10
10
|
blur: (ev: FocusEvent) => any;
|
|
11
|
-
change: (ev: Event) => any;
|
|
12
11
|
keyup: (ev: KeyboardEvent) => any;
|
|
12
|
+
autocomplete: (ev: Event) => any;
|
|
13
13
|
clearInput: () => any;
|
|
14
14
|
"update:value": (value: string) => any;
|
|
15
15
|
"keyup.enter": (ev: KeyboardEvent) => any;
|
|
16
16
|
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
17
17
|
onInput?: ((ev: Event) => any) | undefined;
|
|
18
18
|
onBlur?: ((ev: FocusEvent) => any) | undefined;
|
|
19
|
-
onChange?: ((ev: Event) => any) | undefined;
|
|
20
19
|
onKeyup?: ((ev: KeyboardEvent) => any) | undefined;
|
|
21
20
|
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
21
|
+
onAutocomplete?: ((ev: Event) => any) | undefined;
|
|
22
22
|
onClearInput?: (() => any) | undefined;
|
|
23
23
|
"onUpdate:value"?: ((value: string) => any) | undefined;
|
|
24
24
|
"onKeyup.enter"?: ((ev: KeyboardEvent) => any) | undefined;
|
|
@@ -37,7 +37,6 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {}, {},
|
|
|
37
37
|
optional: boolean;
|
|
38
38
|
labelLeft: boolean;
|
|
39
39
|
clearButton: boolean;
|
|
40
|
-
displayChar: string;
|
|
41
40
|
ariaLabel: string;
|
|
42
41
|
maskOptions: {
|
|
43
42
|
lazy?: boolean;
|
|
@@ -9,8 +9,6 @@ export interface FdsInputProps {
|
|
|
9
9
|
labelLeft?: boolean;
|
|
10
10
|
clearButton?: boolean;
|
|
11
11
|
mask?: string | RegExp | Array<string | RegExp>;
|
|
12
|
-
/** Character shown for unfilled mask positions while typing (maps to IMask placeholderChar). */
|
|
13
|
-
displayChar?: string;
|
|
14
12
|
modelValue?: string;
|
|
15
13
|
value?: string;
|
|
16
14
|
type?: string;
|
|
@@ -24,18 +24,15 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {}, {},
|
|
|
24
24
|
id: string;
|
|
25
25
|
name: string;
|
|
26
26
|
placeholder: string;
|
|
27
|
-
maxlength: number;
|
|
28
27
|
dataTestid: string;
|
|
29
28
|
label: string;
|
|
30
29
|
meta: string;
|
|
31
|
-
pattern: string;
|
|
32
30
|
autofocus: boolean;
|
|
33
31
|
locale: string;
|
|
34
32
|
inputClass: string;
|
|
35
33
|
valid: boolean | null;
|
|
36
34
|
optional: boolean;
|
|
37
35
|
invalidMessage: string;
|
|
38
|
-
minlength: number;
|
|
39
36
|
autocomplete: string;
|
|
40
37
|
readonly: boolean;
|
|
41
38
|
defaultCountry: string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Whether the value likely contains a country calling code or international formatting. */
|
|
2
|
+
export declare const shouldNormalizePhoneInput: (value: string, countryIso2: string) => boolean;
|
|
3
|
+
/**
|
|
4
|
+
* Converts international/autocomplete values to national digits for the IMask field.
|
|
5
|
+
* IMask reapplies spacing from the country mask.
|
|
6
|
+
*/
|
|
7
|
+
export declare const normalizeNationalPhoneInput: (value: string, countryIso2: string) => string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FdsInputProps } from '../FdsInput/types';
|
|
2
2
|
import { CountryPhoneOption } from './countries';
|
|
3
|
-
type FdsPhonenumberInputPassthroughProps = Pick<FdsInputProps, 'id' | 'autocomplete' | 'required' | 'placeholder' | '
|
|
3
|
+
type FdsPhonenumberInputPassthroughProps = Pick<FdsInputProps, 'id' | 'autocomplete' | 'required' | 'placeholder' | 'name' | 'autofocus' | 'readonly'>;
|
|
4
4
|
export interface FdsPhonenumberProps extends FdsPhonenumberInputPassthroughProps {
|
|
5
5
|
label?: string;
|
|
6
6
|
meta?: string;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { FdsSsnProps } from './types';
|
|
2
|
+
type __VLS_Props = FdsSsnProps;
|
|
3
|
+
type __VLS_PublicProps = {
|
|
4
|
+
modelValue?: string;
|
|
5
|
+
} & __VLS_Props;
|
|
6
|
+
declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
7
|
+
blur: (ev: FocusEvent) => any;
|
|
8
|
+
"update:modelValue": (...args: unknown[]) => any;
|
|
9
|
+
valid: (value: boolean | null) => any;
|
|
10
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
11
|
+
onBlur?: ((ev: FocusEvent) => any) | undefined;
|
|
12
|
+
"onUpdate:modelValue"?: ((...args: unknown[]) => any) | undefined;
|
|
13
|
+
onValid?: ((value: boolean | null) => any) | undefined;
|
|
14
|
+
}>, {
|
|
15
|
+
disabled: boolean;
|
|
16
|
+
required: boolean;
|
|
17
|
+
id: string;
|
|
18
|
+
name: string;
|
|
19
|
+
placeholder: string;
|
|
20
|
+
dataTestid: string;
|
|
21
|
+
label: string;
|
|
22
|
+
meta: string;
|
|
23
|
+
autofocus: boolean;
|
|
24
|
+
inputClass: string | Record<string, boolean> | Array<string | Record<string, boolean>>;
|
|
25
|
+
valid: boolean | null;
|
|
26
|
+
optional: boolean;
|
|
27
|
+
invalidMessage: string;
|
|
28
|
+
autocomplete: string;
|
|
29
|
+
readonly: boolean;
|
|
30
|
+
allowCoordinationNumber: boolean;
|
|
31
|
+
allowInterimNumber: boolean;
|
|
32
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
33
|
+
export default _default;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** IMask pattern for ÅÅÅÅMMDDKKKK (12 digits, no separator). */
|
|
2
|
+
export declare const SSN_MASK = "000000000000";
|
|
3
|
+
/** Alphanumeric mask when interim numbers (letters in num part) are allowed. */
|
|
4
|
+
export declare const SSN_INTERIM_MASK = "XXXXXXXXXXXX";
|
|
5
|
+
export declare const SSN_INTERIM_MASK_OPTIONS: {
|
|
6
|
+
readonly lazy: true;
|
|
7
|
+
readonly definitions: {
|
|
8
|
+
readonly X: RegExp;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export declare function getSsnMask(allowInterimNumber: boolean): string;
|
|
12
|
+
export declare function getSsnMaskOptions(allowInterimNumber: boolean): {
|
|
13
|
+
readonly lazy: true;
|
|
14
|
+
readonly definitions: {
|
|
15
|
+
readonly X: RegExp;
|
|
16
|
+
};
|
|
17
|
+
} | {
|
|
18
|
+
lazy: boolean;
|
|
19
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { FdsInputProps } from '../FdsInput/types';
|
|
2
|
+
type FdsSsnInputPassthroughProps = Pick<FdsInputProps, 'id' | 'autocomplete' | 'required' | 'placeholder' | 'name' | 'autofocus' | 'readonly' | 'inputClass'>;
|
|
3
|
+
export interface FdsSsnProps extends FdsSsnInputPassthroughProps {
|
|
4
|
+
label?: string;
|
|
5
|
+
meta?: string;
|
|
6
|
+
optional?: boolean;
|
|
7
|
+
valid?: boolean | null;
|
|
8
|
+
invalidMessage?: string;
|
|
9
|
+
/** Personnummer as shown in the input (12 characters, no separator). */
|
|
10
|
+
modelValue?: string;
|
|
11
|
+
allowCoordinationNumber?: boolean;
|
|
12
|
+
allowInterimNumber?: boolean;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
dataTestid?: string;
|
|
15
|
+
onValid?: ((value: boolean | null) => void) | Array<(value: boolean | null) => void>;
|
|
16
|
+
onBlur?: ((event: FocusEvent) => void) | Array<(event: FocusEvent) => void>;
|
|
17
|
+
'onUpdate:modelValue'?: ((value: string) => void) | Array<(value: string) => void>;
|
|
18
|
+
}
|
|
19
|
+
export interface FdsSsnEmits {
|
|
20
|
+
'update:modelValue': [value: string];
|
|
21
|
+
valid: [value: boolean | null];
|
|
22
|
+
blur: [ev: FocusEvent];
|
|
23
|
+
}
|
|
24
|
+
export {};
|