fds-vue-core 8.6.3 → 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 +27 -9
- package/dist/fds-vue-core.cjs.js.map +1 -1
- package/dist/fds-vue-core.es.js +27 -9
- 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 +2 -1
- package/src/components/Form/FdsSsn/FdsSsn.stories.ts +53 -0
- package/src/components/Form/FdsSsn/FdsSsn.vue +19 -2
- package/src/components/Form/FdsSsn/types.ts +5 -0
|
@@ -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
|
@@ -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,
|
|
@@ -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
|
}
|