@synergy-design-system/vue 2.4.2 → 2.5.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/README.md CHANGED
@@ -2,12 +2,16 @@
2
2
 
3
3
  This package provides [vue.js](https://vuejs.org/) wrappers for [Synergy Web Components](https://github.com/synergy-design-system/synergy-design-system/tree/main/packages/components).
4
4
 
5
- This package aims to provide an improved developer experience in Vue applications:
5
+ It aims to provide an improved developer experience in Vue applications:
6
6
 
7
7
  - Provides two way data binding and `v-model`
8
8
  - Autocompletion and Types
9
9
  - Better custom event handling of `synergy` events
10
10
 
11
+ ## Known issues and limitations
12
+
13
+ Got any problems using our Vue wrappers? Please take a look at [our list of known issues and limitations](https://synergy-design-system.github.io/?path=/docs/limitations-vue--docs) before [creating a ticket](https://github.com/synergy-design-system/synergy-design-system/issues/new?assignees=&labels=&projects=&template=generic-bug.md&title=fix%3A+%F0%9F%90%9B+).
14
+
11
15
  ## Getting started
12
16
 
13
17
  ### 1. Package installation
@@ -0,0 +1,215 @@
1
+ import '@synergy-design-system/components/components/file/file.js';
2
+ import type { SynBlurEvent, SynChangeEvent, SynErrorEvent, SynFile, SynFocusEvent, SynInputEvent } from '@synergy-design-system/components';
3
+ export type { SynBlurEvent } from '@synergy-design-system/components';
4
+ export type { SynChangeEvent } from '@synergy-design-system/components';
5
+ export type { SynErrorEvent } from '@synergy-design-system/components';
6
+ export type { SynFocusEvent } from '@synergy-design-system/components';
7
+ export type { SynInputEvent } from '@synergy-design-system/components';
8
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_TypePropsToOption<{
9
+ /**
10
+ * The selected files as a FileList object containing a list of File objects.
11
+ The FileList behaves like an array, so you can get the number of selected files
12
+ via its length property.
13
+ [see MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#getting_information_on_selected_files)
14
+ */
15
+ files?: FileList | null | undefined;
16
+ /**
17
+ * The name of the file control, submitted as a name/value pair with form data.
18
+ */
19
+ name?: string | undefined;
20
+ /**
21
+ * The value of the file control contains a string that represents the path of the selected file.
22
+ If multiple files are selected, the value represents the first file in the list.
23
+ If no file is selected, the value is an empty string.
24
+ Beware that the only valid value when setting a file control is an empty string!
25
+ [see MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#value)
26
+ */
27
+ value?: string | undefined;
28
+ /**
29
+ * The file control's size.
30
+ */
31
+ size?: "medium" | "large" | "small" | undefined;
32
+ /**
33
+ * The file control's label.
34
+ * If you need to display HTML, use the `label` slot instead.
35
+ */
36
+ label?: string | undefined;
37
+ /**
38
+ * The file control's help text.
39
+ If you need to display HTML, use the `help-text` slot instead.
40
+ */
41
+ helpText?: string | undefined;
42
+ /**
43
+ * Disables the file control.
44
+ */
45
+ disabled?: boolean | undefined;
46
+ /**
47
+ * Draw the file control as a drop area
48
+ */
49
+ droparea?: boolean | undefined;
50
+ /**
51
+ * Comma separated list of supported file types
52
+ [see MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept)
53
+ */
54
+ accept?: string | undefined;
55
+ /**
56
+ * Specifies the types of files that the server accepts.
57
+ Can be set either to user or environment.
58
+ Works only when not using a droparea!
59
+ [see MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/capture)
60
+ */
61
+ capture?: "user" | "environment" | undefined;
62
+ /**
63
+ * Indicates whether the user can select more than one file.
64
+ [see MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#multiple)
65
+ */
66
+ multiple?: boolean | undefined;
67
+ /**
68
+ * Indicates that the file control should let the user select directories instead of files.
69
+ When a directory is selected, the directory and its entire hierarchy of contents are included
70
+ in the set of selected items.
71
+ Note: This is a non-standard attribute but is supported in the major browsers.
72
+ [see MDN](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/webkitdirectory)
73
+ */
74
+ webkitdirectory?: boolean | undefined;
75
+ /**
76
+ * By default, form controls are associated with the nearest containing `<form>` element.
77
+ This attribute allows you to place the form control outside of a form and associate it
78
+ with the form that has this `id`.
79
+ * The form must be in the same document
80
+ or shadow root for this to work.
81
+ */
82
+ form?: string | undefined;
83
+ /**
84
+ * Makes the input a required field.
85
+ */
86
+ required?: boolean | undefined;
87
+ /**
88
+ * Suppress the value from being displayed in the file control
89
+ */
90
+ hideValue?: boolean | undefined;
91
+ /**
92
+ * Support for two way data binding
93
+ */
94
+ modelValue?: FileList | null | undefined;
95
+ }>, {
96
+ nativeElement: import("vue").Ref<SynFile | undefined>;
97
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
98
+ "syn-blur": (e: SynBlurEvent) => void;
99
+ "syn-focus": (e: SynFocusEvent) => void;
100
+ "syn-change": (e: SynChangeEvent) => void;
101
+ "syn-input": (e: SynInputEvent) => void;
102
+ "update:modelValue": (newValue: FileList | null) => void;
103
+ "syn-error": (e: SynErrorEvent) => void;
104
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<{
105
+ /**
106
+ * The selected files as a FileList object containing a list of File objects.
107
+ The FileList behaves like an array, so you can get the number of selected files
108
+ via its length property.
109
+ [see MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#getting_information_on_selected_files)
110
+ */
111
+ files?: FileList | null | undefined;
112
+ /**
113
+ * The name of the file control, submitted as a name/value pair with form data.
114
+ */
115
+ name?: string | undefined;
116
+ /**
117
+ * The value of the file control contains a string that represents the path of the selected file.
118
+ If multiple files are selected, the value represents the first file in the list.
119
+ If no file is selected, the value is an empty string.
120
+ Beware that the only valid value when setting a file control is an empty string!
121
+ [see MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#value)
122
+ */
123
+ value?: string | undefined;
124
+ /**
125
+ * The file control's size.
126
+ */
127
+ size?: "medium" | "large" | "small" | undefined;
128
+ /**
129
+ * The file control's label.
130
+ * If you need to display HTML, use the `label` slot instead.
131
+ */
132
+ label?: string | undefined;
133
+ /**
134
+ * The file control's help text.
135
+ If you need to display HTML, use the `help-text` slot instead.
136
+ */
137
+ helpText?: string | undefined;
138
+ /**
139
+ * Disables the file control.
140
+ */
141
+ disabled?: boolean | undefined;
142
+ /**
143
+ * Draw the file control as a drop area
144
+ */
145
+ droparea?: boolean | undefined;
146
+ /**
147
+ * Comma separated list of supported file types
148
+ [see MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept)
149
+ */
150
+ accept?: string | undefined;
151
+ /**
152
+ * Specifies the types of files that the server accepts.
153
+ Can be set either to user or environment.
154
+ Works only when not using a droparea!
155
+ [see MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/capture)
156
+ */
157
+ capture?: "user" | "environment" | undefined;
158
+ /**
159
+ * Indicates whether the user can select more than one file.
160
+ [see MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#multiple)
161
+ */
162
+ multiple?: boolean | undefined;
163
+ /**
164
+ * Indicates that the file control should let the user select directories instead of files.
165
+ When a directory is selected, the directory and its entire hierarchy of contents are included
166
+ in the set of selected items.
167
+ Note: This is a non-standard attribute but is supported in the major browsers.
168
+ [see MDN](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/webkitdirectory)
169
+ */
170
+ webkitdirectory?: boolean | undefined;
171
+ /**
172
+ * By default, form controls are associated with the nearest containing `<form>` element.
173
+ This attribute allows you to place the form control outside of a form and associate it
174
+ with the form that has this `id`.
175
+ * The form must be in the same document
176
+ or shadow root for this to work.
177
+ */
178
+ form?: string | undefined;
179
+ /**
180
+ * Makes the input a required field.
181
+ */
182
+ required?: boolean | undefined;
183
+ /**
184
+ * Suppress the value from being displayed in the file control
185
+ */
186
+ hideValue?: boolean | undefined;
187
+ /**
188
+ * Support for two way data binding
189
+ */
190
+ modelValue?: FileList | null | undefined;
191
+ }>>> & {
192
+ "onSyn-blur"?: ((e: SynBlurEvent) => any) | undefined;
193
+ "onSyn-focus"?: ((e: SynFocusEvent) => any) | undefined;
194
+ "onSyn-change"?: ((e: SynChangeEvent) => any) | undefined;
195
+ "onSyn-input"?: ((e: SynInputEvent) => any) | undefined;
196
+ "onUpdate:modelValue"?: ((newValue: FileList | null) => any) | undefined;
197
+ "onSyn-error"?: ((e: SynErrorEvent) => any) | undefined;
198
+ }, {}, {}>, {
199
+ default?(_: {}): any;
200
+ }>;
201
+ export default _default;
202
+ type __VLS_WithTemplateSlots<T, S> = T & {
203
+ new (): {
204
+ $slots: S;
205
+ };
206
+ };
207
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
208
+ type __VLS_TypePropsToOption<T> = {
209
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
210
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
211
+ } : {
212
+ type: import('vue').PropType<T[K]>;
213
+ required: true;
214
+ };
215
+ };
@@ -27,8 +27,8 @@ declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<{
27
27
  }>, {
28
28
  nativeElement: import("vue").Ref<SynIcon | undefined>;
29
29
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
30
- "syn-load": (e: SynLoadEvent) => void;
31
30
  "syn-error": (e: SynErrorEvent) => void;
31
+ "syn-load": (e: SynLoadEvent) => void;
32
32
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<{
33
33
  /**
34
34
  * The name of the icon to draw.
@@ -52,8 +52,8 @@ declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<{
52
52
  */
53
53
  library?: string | undefined;
54
54
  }>>> & {
55
- "onSyn-load"?: ((e: SynLoadEvent) => any) | undefined;
56
55
  "onSyn-error"?: ((e: SynErrorEvent) => any) | undefined;
56
+ "onSyn-load"?: ((e: SynLoadEvent) => any) | undefined;
57
57
  }, {}, {}>;
58
58
  export default _default;
59
59
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
package/dist/index.d.ts CHANGED
@@ -12,6 +12,7 @@ export { default as SynVueDialog } from "./components/SynVueDialog.vue";
12
12
  export { default as SynVueDivider } from "./components/SynVueDivider.vue";
13
13
  export { default as SynVueDrawer } from "./components/SynVueDrawer.vue";
14
14
  export { default as SynVueDropdown } from "./components/SynVueDropdown.vue";
15
+ export { default as SynVueFile } from "./components/SynVueFile.vue";
15
16
  export { default as SynVueHeader } from "./components/SynVueHeader.vue";
16
17
  export { default as SynVueIcon } from "./components/SynVueIcon.vue";
17
18
  export { default as SynVueIconButton } from "./components/SynVueIconButton.vue";
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.4.2"
7
+ "@synergy-design-system/components": "^2.5.0"
8
8
  },
9
9
  "description": "Vue3 wrappers for the Synergy Design System",
10
10
  "exports": {
@@ -40,12 +40,12 @@
40
40
  "directory": "packages/vue"
41
41
  },
42
42
  "type": "module",
43
- "version": "2.4.2",
43
+ "version": "2.5.0",
44
44
  "devDependencies": {
45
45
  "@vue/tsconfig": "^0.5.1",
46
46
  "vue": "^3.4.24"
47
47
  },
48
48
  "peerDependencies": {
49
- "@synergy-design-system/tokens": "^2.5.0"
49
+ "@synergy-design-system/tokens": "^2.6.0"
50
50
  }
51
51
  }
@@ -0,0 +1,238 @@
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 File controls allow selecting an arbitrary number of files for uploading.
10
+ * @status stable
11
+ *
12
+ * @dependency syn-button
13
+ * @dependency syn-icon
14
+ *
15
+ * @slot label - The file control's label. Alternatively, you can use the `label` attribute.
16
+ * @slot help-text - Text that describes how to use the file control.
17
+ * Alternatively, you can use the `help-text` attribute.
18
+ * @slot droparea-icon - Optional droparea icon to use instead of the default.
19
+ * Works best with `<syn-icon>`.
20
+ * @slot trigger - Optional content to be used as trigger instead of the default content.
21
+ * Opening the file dialog on click and as well as drag and drop will work for this content.
22
+ * Following attributes will no longer work: *label*, *droparea*, *help-text*, *size*,
23
+ * *hide-value*. Also if using the disabled attribute, the disabled styling will not be
24
+ * applied and must be taken care of yourself.
25
+ *
26
+ * @event syn-blur - Emitted when the control loses focus.
27
+ * @event syn-change - Emitted when an alteration to the control's value is committed by the user.
28
+ * @event syn-error - Emitted when multiple files are selected via drag and drop, without
29
+ * the `multiple` property being set.
30
+ * @event syn-focus - Emitted when the control gains focus.
31
+ * @event syn-input - Emitted when the control receives input.
32
+ *
33
+ * @csspart form-control - The form control that wraps the label, input, and help text.
34
+ * @csspart form-control-label - The label's wrapper.
35
+ * @csspart form-control-input - The input's wrapper.
36
+ * @csspart form-control-help-text - The help text's wrapper.
37
+ * @csspart button-wrapper - The wrapper around the button and text value.
38
+ * @csspart button - The syn-button acting as a file input.
39
+ * @csspart button__base - The syn-button's exported `base` part.
40
+ * @csspart value - The chosen files or placeholder text for the file input.
41
+ * @csspart droparea - The element wrapping the drop zone.
42
+ * @csspart droparea-background - The background of the drop zone.
43
+ * @csspart droparea-icon - The container that wraps the icon for the drop zone.
44
+ * @csspart droparea-value - The text for the drop zone.
45
+ * @csspart trigger - The container that wraps the trigger.
46
+ *
47
+ * @animation file.iconDrop - The animation to use for the file icon
48
+ * when a file is dropped
49
+ * @animation file.text.disappear - The disappear animation to use for the file placeholder text
50
+ * when a file is dropped
51
+ * @animation file.text.appear - The appear animation to use for the file placeholder text
52
+ * when a file is dropped
53
+ */
54
+ import { computed, ref } from 'vue';
55
+ import '@synergy-design-system/components/components/file/file.js';
56
+
57
+ import type {
58
+ SynBlurEvent, SynChangeEvent, SynErrorEvent, SynFile, SynFocusEvent, SynInputEvent,
59
+ } from '@synergy-design-system/components';
60
+
61
+ // DOM Reference to the element
62
+ const nativeElement = ref<SynFile>();
63
+
64
+ defineExpose({
65
+ nativeElement,
66
+ });
67
+
68
+ // Map attributes
69
+ const props = defineProps<{
70
+ /**
71
+ * The selected files as a FileList object containing a list of File objects.
72
+ The FileList behaves like an array, so you can get the number of selected files
73
+ via its length property.
74
+ [see MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#getting_information_on_selected_files)
75
+ */
76
+ 'files'?: SynFile['files'];
77
+
78
+ /**
79
+ * The name of the file control, submitted as a name/value pair with form data.
80
+ */
81
+ 'name'?: SynFile['name'];
82
+
83
+ /**
84
+ * The value of the file control contains a string that represents the path of the selected file.
85
+ If multiple files are selected, the value represents the first file in the list.
86
+ If no file is selected, the value is an empty string.
87
+ Beware that the only valid value when setting a file control is an empty string!
88
+ [see MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#value)
89
+ */
90
+ 'value'?: SynFile['value'];
91
+
92
+ /**
93
+ * The file control's size.
94
+ */
95
+ 'size'?: SynFile['size'];
96
+
97
+ /**
98
+ * The file control's label.
99
+ * If you need to display HTML, use the `label` slot instead.
100
+ */
101
+ 'label'?: SynFile['label'];
102
+
103
+ /**
104
+ * The file control's help text.
105
+ If you need to display HTML, use the `help-text` slot instead.
106
+ */
107
+ 'helpText'?: SynFile['helpText'];
108
+
109
+ /**
110
+ * Disables the file control.
111
+ */
112
+ 'disabled'?: SynFile['disabled'];
113
+
114
+ /**
115
+ * Draw the file control as a drop area
116
+ */
117
+ 'droparea'?: SynFile['droparea'];
118
+
119
+ /**
120
+ * Comma separated list of supported file types
121
+ [see MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept)
122
+ */
123
+ 'accept'?: SynFile['accept'];
124
+
125
+ /**
126
+ * Specifies the types of files that the server accepts.
127
+ Can be set either to user or environment.
128
+ Works only when not using a droparea!
129
+ [see MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/capture)
130
+ */
131
+ 'capture'?: SynFile['capture'];
132
+
133
+ /**
134
+ * Indicates whether the user can select more than one file.
135
+ [see MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#multiple)
136
+ */
137
+ 'multiple'?: SynFile['multiple'];
138
+
139
+ /**
140
+ * Indicates that the file control should let the user select directories instead of files.
141
+ When a directory is selected, the directory and its entire hierarchy of contents are included
142
+ in the set of selected items.
143
+ Note: This is a non-standard attribute but is supported in the major browsers.
144
+ [see MDN](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/webkitdirectory)
145
+ */
146
+ 'webkitdirectory'?: SynFile['webkitdirectory'];
147
+
148
+ /**
149
+ * By default, form controls are associated with the nearest containing `<form>` element.
150
+ This attribute allows you to place the form control outside of a form and associate it
151
+ with the form that has this `id`.
152
+ * The form must be in the same document
153
+ or shadow root for this to work.
154
+ */
155
+ 'form'?: SynFile['form'];
156
+
157
+ /**
158
+ * Makes the input a required field.
159
+ */
160
+ 'required'?: SynFile['required'];
161
+
162
+ /**
163
+ * Suppress the value from being displayed in the file control
164
+ */
165
+ 'hideValue'?: SynFile['hideValue'];
166
+
167
+ /**
168
+ * Support for two way data binding
169
+ */
170
+ modelValue?: SynFile['files'];
171
+ }>();
172
+
173
+ // Make sure prop binding only forwards the props that are actually there.
174
+ // This is needed because :param="param" also adds an empty attribute
175
+ // when using web-components, which breaks optional arguments like size in SynInput
176
+ // @see https://github.com/vuejs/core/issues/5190#issuecomment-1003112498
177
+ const visibleProps = computed(() => Object.fromEntries(
178
+ Object
179
+ .entries(props)
180
+ .filter(([, value]) => typeof value !== 'undefined'),
181
+ ));
182
+
183
+ // Map events
184
+ defineEmits<{
185
+ /**
186
+ * Emitted when the control loses focus.
187
+ */
188
+ 'syn-blur': [e: SynBlurEvent];
189
+
190
+ /**
191
+ * Emitted when an alteration to the control's value is committed by the user.
192
+ */
193
+ 'syn-change': [e: SynChangeEvent];
194
+
195
+ /**
196
+ * Emitted when multiple files are selected via drag and drop, without the `multiple` property being set.
197
+ */
198
+ 'syn-error': [e: SynErrorEvent];
199
+
200
+ /**
201
+ * Emitted when the control gains focus.
202
+ */
203
+ 'syn-focus': [e: SynFocusEvent];
204
+
205
+ /**
206
+ * Emitted when the control receives input.
207
+ */
208
+ 'syn-input': [e: SynInputEvent];
209
+
210
+ /**
211
+ * Support for two way data binding
212
+ */
213
+ 'update:modelValue': [newValue: SynFile['files']];
214
+ }>();
215
+ </script>
216
+
217
+ <script lang="ts">
218
+ export type { SynBlurEvent } from '@synergy-design-system/components';
219
+ export type { SynChangeEvent } from '@synergy-design-system/components';
220
+ export type { SynErrorEvent } from '@synergy-design-system/components';
221
+ export type { SynFocusEvent } from '@synergy-design-system/components';
222
+ export type { SynInputEvent } from '@synergy-design-system/components';
223
+ </script>
224
+
225
+ <template>
226
+ <syn-file
227
+ v-bind="visibleProps"
228
+ ref="nativeElement"
229
+ :files="typeof props.modelValue !== 'undefined' ? props.modelValue : typeof props.files !== 'undefined' ? props.files : undefined"
230
+ @syn-blur="$emit('syn-blur', $event)"
231
+ @syn-change="$emit('syn-change', $event)"
232
+ @syn-error="$emit('syn-error', $event)"
233
+ @syn-focus="$emit('syn-focus', $event)"
234
+ @syn-input="$emit('update:modelValue', $event.target.files); $emit('syn-input', $event)"
235
+ >
236
+ <slot />
237
+ </syn-file>
238
+ </template>
package/src/index.js CHANGED
@@ -17,6 +17,7 @@ export { default as SynVueDialog } from './components/SynVueDialog.vue';
17
17
  export { default as SynVueDivider } from './components/SynVueDivider.vue';
18
18
  export { default as SynVueDrawer } from './components/SynVueDrawer.vue';
19
19
  export { default as SynVueDropdown } from './components/SynVueDropdown.vue';
20
+ export { default as SynVueFile } from './components/SynVueFile.vue';
20
21
  export { default as SynVueHeader } from './components/SynVueHeader.vue';
21
22
  export { default as SynVueIcon } from './components/SynVueIcon.vue';
22
23
  export { default as SynVueIconButton } from './components/SynVueIconButton.vue';