@synergy-design-system/vue 2.11.7 → 2.12.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/dist/components/SynVueValidate.vue.d.ts +99 -0
- package/dist/components/SynVueValidate.vue.js +35 -0
- package/dist/components/SynVueValidate.vue2.js +4 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -1
- package/package.json +3 -3
- package/src/components/SynVueValidate.vue +98 -0
- package/src/index.ts +1 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { SynValidate } from '@synergy-design-system/components';
|
|
2
|
+
declare function __VLS_template(): {
|
|
3
|
+
slots: {
|
|
4
|
+
default?(_: {}): any;
|
|
5
|
+
};
|
|
6
|
+
refs: {
|
|
7
|
+
nativeElement: unknown;
|
|
8
|
+
};
|
|
9
|
+
attrs: Partial<{}>;
|
|
10
|
+
};
|
|
11
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
12
|
+
declare const __VLS_component: import('vue').DefineComponent<{
|
|
13
|
+
/**
|
|
14
|
+
* The variant that should be used to show validation alerts.
|
|
15
|
+
|
|
16
|
+
The following variants are supported:
|
|
17
|
+
- **native** (default): Uses the native browser validation, usually a browser tooltip.
|
|
18
|
+
- **inline**: Show the validation message underneath the element, using a `<syn-alert>`
|
|
19
|
+
*/
|
|
20
|
+
variant?: SynValidate["variant"];
|
|
21
|
+
/**
|
|
22
|
+
* Do not show the error icon when using the inline variant validation
|
|
23
|
+
*/
|
|
24
|
+
hideIcon?: SynValidate["hideIcon"];
|
|
25
|
+
/**
|
|
26
|
+
* Defines the events that trigger the validation.
|
|
27
|
+
`invalid` will always automatically be included.
|
|
28
|
+
You may also use the `live` keyword to validate on every input change.
|
|
29
|
+
`live` will make sure to listen to the `invalid`, `input` and `blur` events.
|
|
30
|
+
|
|
31
|
+
Please have a look at the [documentation for native form validation](https://developer.mozilla.org/en-US/docs/Learn/Forms/Form_validation)
|
|
32
|
+
and [the use of form invalid events](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/invalid_event) for further information.
|
|
33
|
+
*/
|
|
34
|
+
on?: SynValidate["on"];
|
|
35
|
+
/**
|
|
36
|
+
* Custom validation message to be displayed when the input is invalid.
|
|
37
|
+
Will override the default browser validation message.
|
|
38
|
+
Set to an empty string to reset the validation message.
|
|
39
|
+
*/
|
|
40
|
+
customValidationMessage?: SynValidate["customValidationMessage"];
|
|
41
|
+
/**
|
|
42
|
+
* Set this to true to validate the input immediately when it is rendered.
|
|
43
|
+
Best used with a `variant` of `inline`.
|
|
44
|
+
When setting eager, the input will not be focused automatically.
|
|
45
|
+
|
|
46
|
+
When using a `variant` of `native` the browser will focus
|
|
47
|
+
the last eager field as it is using a tooltip.
|
|
48
|
+
In this case it is better to just provide one eager field.
|
|
49
|
+
*/
|
|
50
|
+
eager?: SynValidate["eager"];
|
|
51
|
+
}, {
|
|
52
|
+
nativeElement: import('vue').Ref<SynValidate | undefined, SynValidate | undefined>;
|
|
53
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{
|
|
54
|
+
/**
|
|
55
|
+
* The variant that should be used to show validation alerts.
|
|
56
|
+
|
|
57
|
+
The following variants are supported:
|
|
58
|
+
- **native** (default): Uses the native browser validation, usually a browser tooltip.
|
|
59
|
+
- **inline**: Show the validation message underneath the element, using a `<syn-alert>`
|
|
60
|
+
*/
|
|
61
|
+
variant?: SynValidate["variant"];
|
|
62
|
+
/**
|
|
63
|
+
* Do not show the error icon when using the inline variant validation
|
|
64
|
+
*/
|
|
65
|
+
hideIcon?: SynValidate["hideIcon"];
|
|
66
|
+
/**
|
|
67
|
+
* Defines the events that trigger the validation.
|
|
68
|
+
`invalid` will always automatically be included.
|
|
69
|
+
You may also use the `live` keyword to validate on every input change.
|
|
70
|
+
`live` will make sure to listen to the `invalid`, `input` and `blur` events.
|
|
71
|
+
|
|
72
|
+
Please have a look at the [documentation for native form validation](https://developer.mozilla.org/en-US/docs/Learn/Forms/Form_validation)
|
|
73
|
+
and [the use of form invalid events](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/invalid_event) for further information.
|
|
74
|
+
*/
|
|
75
|
+
on?: SynValidate["on"];
|
|
76
|
+
/**
|
|
77
|
+
* Custom validation message to be displayed when the input is invalid.
|
|
78
|
+
Will override the default browser validation message.
|
|
79
|
+
Set to an empty string to reset the validation message.
|
|
80
|
+
*/
|
|
81
|
+
customValidationMessage?: SynValidate["customValidationMessage"];
|
|
82
|
+
/**
|
|
83
|
+
* Set this to true to validate the input immediately when it is rendered.
|
|
84
|
+
Best used with a `variant` of `inline`.
|
|
85
|
+
When setting eager, the input will not be focused automatically.
|
|
86
|
+
|
|
87
|
+
When using a `variant` of `native` the browser will focus
|
|
88
|
+
the last eager field as it is using a tooltip.
|
|
89
|
+
In this case it is better to just provide one eager field.
|
|
90
|
+
*/
|
|
91
|
+
eager?: SynValidate["eager"];
|
|
92
|
+
}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
93
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
94
|
+
export default _default;
|
|
95
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
96
|
+
new (): {
|
|
97
|
+
$slots: S;
|
|
98
|
+
};
|
|
99
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { defineComponent, ref, computed, openBlock, createElementBlock, mergeProps, renderSlot } from "vue";
|
|
2
|
+
import "@synergy-design-system/components/components/validate/validate.js";
|
|
3
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
4
|
+
__name: "SynVueValidate",
|
|
5
|
+
props: {
|
|
6
|
+
variant: {},
|
|
7
|
+
hideIcon: {},
|
|
8
|
+
on: {},
|
|
9
|
+
customValidationMessage: {},
|
|
10
|
+
eager: {}
|
|
11
|
+
},
|
|
12
|
+
setup(__props, { expose: __expose }) {
|
|
13
|
+
const nativeElement = ref();
|
|
14
|
+
__expose({
|
|
15
|
+
nativeElement
|
|
16
|
+
});
|
|
17
|
+
const props = __props;
|
|
18
|
+
const visibleProps = computed(
|
|
19
|
+
() => Object.fromEntries(
|
|
20
|
+
Object.entries(props).filter(([, value]) => typeof value !== "undefined")
|
|
21
|
+
)
|
|
22
|
+
);
|
|
23
|
+
return (_ctx, _cache) => {
|
|
24
|
+
return openBlock(), createElementBlock("syn-validate", mergeProps(visibleProps.value, {
|
|
25
|
+
ref_key: "nativeElement",
|
|
26
|
+
ref: nativeElement
|
|
27
|
+
}), [
|
|
28
|
+
renderSlot(_ctx.$slots, "default")
|
|
29
|
+
], 16);
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
export {
|
|
34
|
+
_sfc_main as default
|
|
35
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -43,3 +43,4 @@ export { default as SynVueTabPanel } from './components/SynVueTabPanel.vue';
|
|
|
43
43
|
export { default as SynVueTag } from './components/SynVueTag.vue';
|
|
44
44
|
export { default as SynVueTextarea } from './components/SynVueTextarea.vue';
|
|
45
45
|
export { default as SynVueTooltip } from './components/SynVueTooltip.vue';
|
|
46
|
+
export { default as SynVueValidate } from './components/SynVueValidate.vue';
|
package/dist/index.js
CHANGED
|
@@ -43,6 +43,7 @@ import { default as default43 } from "./components/SynVueTabPanel.vue.js";
|
|
|
43
43
|
import { default as default44 } from "./components/SynVueTag.vue.js";
|
|
44
44
|
import { default as default45 } from "./components/SynVueTextarea.vue.js";
|
|
45
45
|
import { default as default46 } from "./components/SynVueTooltip.vue.js";
|
|
46
|
+
import { default as default47 } from "./components/SynVueValidate.vue.js";
|
|
46
47
|
export {
|
|
47
48
|
default2 as SynVueAccordion,
|
|
48
49
|
default3 as SynVueAlert,
|
|
@@ -88,5 +89,6 @@ export {
|
|
|
88
89
|
default43 as SynVueTabPanel,
|
|
89
90
|
default44 as SynVueTag,
|
|
90
91
|
default45 as SynVueTextarea,
|
|
91
|
-
default46 as SynVueTooltip
|
|
92
|
+
default46 as SynVueTooltip,
|
|
93
|
+
default47 as SynVueValidate
|
|
92
94
|
};
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"url": "https://www.sick.com"
|
|
5
5
|
},
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@synergy-design-system/components": "^2.
|
|
7
|
+
"@synergy-design-system/components": "^2.12.0"
|
|
8
8
|
},
|
|
9
9
|
"description": "Vue3 wrappers for the Synergy Design System",
|
|
10
10
|
"exports": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"directory": "packages/vue"
|
|
41
41
|
},
|
|
42
42
|
"type": "module",
|
|
43
|
-
"version": "2.
|
|
43
|
+
"version": "2.12.0",
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@vitejs/plugin-vue": "^5.1.4",
|
|
46
46
|
"@vue/tsconfig": "^0.5.1",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"vue": "^3.5.12"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"@synergy-design-system/tokens": "^2.
|
|
53
|
+
"@synergy-design-system/tokens": "^2.14.0"
|
|
54
54
|
},
|
|
55
55
|
"scripts": {
|
|
56
56
|
"_build": "vite build"
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
// ---------------------------------------------------------------------
|
|
3
|
+
// 🔒 AUTOGENERATED @synergy-design-system/vue wrappers for @synergy-design-system/components
|
|
4
|
+
// Please do not edit this file directly!
|
|
5
|
+
// It will get recreated when running pnpm build.
|
|
6
|
+
// ---------------------------------------------------------------------
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @summary Validate provides form field validation messages in a unified way.
|
|
10
|
+
* It does this by using [the native browser validation](https://developer.mozilla.org/en-US/docs/Learn/Forms/Form_validation)
|
|
11
|
+
* and showing the validation message in a consistent, user defined way.
|
|
12
|
+
*
|
|
13
|
+
* @dependency syn-alert
|
|
14
|
+
*
|
|
15
|
+
* @slot - The form field that should be validated.
|
|
16
|
+
* Avoid slotting in more than one element, as subsequent ones will be ignored.
|
|
17
|
+
*
|
|
18
|
+
* @csspart base - The component's base wrapper.
|
|
19
|
+
* @csspart input-wrapper - The container that wraps the form field.
|
|
20
|
+
* @csspart alert - The syn-alert that is shown when the variant is set to "inline".
|
|
21
|
+
* @csspart alert__base - The container that wraps the alert.
|
|
22
|
+
* @csspart alert__message - The container that wraps the alert message.
|
|
23
|
+
* @csspart alert__icon - The container that wraps the alert icon.
|
|
24
|
+
*/
|
|
25
|
+
import { computed, ref } from 'vue';
|
|
26
|
+
import '@synergy-design-system/components/components/validate/validate.js';
|
|
27
|
+
|
|
28
|
+
import type { SynValidate } from '@synergy-design-system/components';
|
|
29
|
+
|
|
30
|
+
// DOM Reference to the element
|
|
31
|
+
const nativeElement = ref<SynValidate>();
|
|
32
|
+
|
|
33
|
+
defineExpose({
|
|
34
|
+
nativeElement,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// Map attributes
|
|
38
|
+
const props = defineProps<{
|
|
39
|
+
/**
|
|
40
|
+
* The variant that should be used to show validation alerts.
|
|
41
|
+
|
|
42
|
+
The following variants are supported:
|
|
43
|
+
- **native** (default): Uses the native browser validation, usually a browser tooltip.
|
|
44
|
+
- **inline**: Show the validation message underneath the element, using a `<syn-alert>`
|
|
45
|
+
*/
|
|
46
|
+
variant?: SynValidate['variant'];
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Do not show the error icon when using the inline variant validation
|
|
50
|
+
*/
|
|
51
|
+
hideIcon?: SynValidate['hideIcon'];
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Defines the events that trigger the validation.
|
|
55
|
+
`invalid` will always automatically be included.
|
|
56
|
+
You may also use the `live` keyword to validate on every input change.
|
|
57
|
+
`live` will make sure to listen to the `invalid`, `input` and `blur` events.
|
|
58
|
+
|
|
59
|
+
Please have a look at the [documentation for native form validation](https://developer.mozilla.org/en-US/docs/Learn/Forms/Form_validation)
|
|
60
|
+
and [the use of form invalid events](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/invalid_event) for further information.
|
|
61
|
+
*/
|
|
62
|
+
on?: SynValidate['on'];
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Custom validation message to be displayed when the input is invalid.
|
|
66
|
+
Will override the default browser validation message.
|
|
67
|
+
Set to an empty string to reset the validation message.
|
|
68
|
+
*/
|
|
69
|
+
customValidationMessage?: SynValidate['customValidationMessage'];
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Set this to true to validate the input immediately when it is rendered.
|
|
73
|
+
Best used with a `variant` of `inline`.
|
|
74
|
+
When setting eager, the input will not be focused automatically.
|
|
75
|
+
|
|
76
|
+
When using a `variant` of `native` the browser will focus
|
|
77
|
+
the last eager field as it is using a tooltip.
|
|
78
|
+
In this case it is better to just provide one eager field.
|
|
79
|
+
*/
|
|
80
|
+
eager?: SynValidate['eager'];
|
|
81
|
+
}>();
|
|
82
|
+
|
|
83
|
+
// Make sure prop binding only forwards the props that are actually there.
|
|
84
|
+
// This is needed because :param="param" also adds an empty attribute
|
|
85
|
+
// when using web-components, which breaks optional arguments like size in SynInput
|
|
86
|
+
// @see https://github.com/vuejs/core/issues/5190#issuecomment-1003112498
|
|
87
|
+
const visibleProps = computed(() =>
|
|
88
|
+
Object.fromEntries(
|
|
89
|
+
Object.entries(props).filter(([, value]) => typeof value !== 'undefined'),
|
|
90
|
+
),
|
|
91
|
+
);
|
|
92
|
+
</script>
|
|
93
|
+
|
|
94
|
+
<template>
|
|
95
|
+
<syn-validate v-bind="visibleProps" ref="nativeElement">
|
|
96
|
+
<slot></slot>
|
|
97
|
+
</syn-validate>
|
|
98
|
+
</template>
|
package/src/index.ts
CHANGED
|
@@ -48,3 +48,4 @@ export { default as SynVueTabPanel } from './components/SynVueTabPanel.vue';
|
|
|
48
48
|
export { default as SynVueTag } from './components/SynVueTag.vue';
|
|
49
49
|
export { default as SynVueTextarea } from './components/SynVueTextarea.vue';
|
|
50
50
|
export { default as SynVueTooltip } from './components/SynVueTooltip.vue';
|
|
51
|
+
export { default as SynVueValidate } from './components/SynVueValidate.vue';
|