@synergy-design-system/vue 2.7.2 → 2.8.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/SynVueAccordion.vue.d.ts +12 -12
- package/dist/components/SynVueAlert.vue.d.ts +13 -9
- package/dist/components/SynVueBadge.vue.d.ts +4 -4
- package/dist/components/SynVueBreadcrumbItem.vue.d.ts +12 -12
- package/dist/components/SynVueButton.vue.d.ts +62 -59
- package/dist/components/SynVueCard.vue.d.ts +8 -8
- package/dist/components/SynVueCheckbox.vue.d.ts +40 -35
- package/dist/components/SynVueCombobox.vue.d.ts +232 -0
- package/dist/components/SynVueDetails.vue.d.ts +23 -19
- package/dist/components/SynVueDialog.vue.d.ts +7 -1
- package/dist/components/SynVueDivider.vue.d.ts +4 -4
- package/dist/components/SynVueDrawer.vue.d.ts +11 -5
- package/dist/components/SynVueDropdown.vue.d.ts +21 -17
- package/dist/components/SynVueFile.vue.d.ts +40 -35
- package/dist/components/SynVueHeader.vue.d.ts +10 -7
- package/dist/components/SynVueIcon.vue.d.ts +13 -11
- package/dist/components/SynVueIconButton.vue.d.ts +37 -35
- package/dist/components/SynVueInput.vue.d.ts +115 -109
- package/dist/components/SynVueMenu.vue.d.ts +2 -1
- package/dist/components/SynVueMenuItem.vue.d.ts +24 -24
- package/dist/components/SynVueNavItem.vue.d.ts +13 -9
- package/dist/components/SynVueOptgroup.vue.d.ts +10 -10
- package/dist/components/SynVueOption.vue.d.ts +4 -4
- package/dist/components/SynVuePopup.vue.d.ts +34 -33
- package/dist/components/SynVueProgressBar.vue.d.ts +12 -12
- package/dist/components/SynVueProgressRing.vue.d.ts +8 -8
- package/dist/components/SynVueRadio.vue.d.ts +13 -11
- package/dist/components/SynVueRadioButton.vue.d.ts +17 -15
- package/dist/components/SynVueRadioGroup.vue.d.ts +32 -29
- package/dist/components/SynVueRange.vue.d.ts +57 -51
- package/dist/components/SynVueRangeTick.vue.d.ts +4 -4
- package/dist/components/SynVueSelect.vue.d.ts +55 -45
- package/dist/components/SynVueSideNav.vue.d.ts +5 -1
- package/dist/components/SynVueSwitch.vue.d.ts +40 -35
- package/dist/components/SynVueTab.vue.d.ts +20 -19
- package/dist/components/SynVueTabGroup.vue.d.ts +21 -19
- package/dist/components/SynVueTabPanel.vue.d.ts +8 -8
- package/dist/components/SynVueTag.vue.d.ts +10 -9
- package/dist/components/SynVueTextarea.vue.d.ts +86 -81
- package/dist/components/SynVueTooltip.vue.d.ts +29 -25
- package/dist/index.d.ts +1 -0
- package/package.json +3 -3
- package/src/components/SynVueAccordion.vue +16 -21
- package/src/components/SynVueAlert.vue +29 -29
- package/src/components/SynVueBadge.vue +10 -15
- package/src/components/SynVueBreadcrumb.vue +8 -13
- package/src/components/SynVueBreadcrumbItem.vue +16 -21
- package/src/components/SynVueButton.vue +66 -67
- package/src/components/SynVueButtonGroup.vue +8 -13
- package/src/components/SynVueCard.vue +12 -17
- package/src/components/SynVueCheckbox.vue +64 -53
- package/src/components/SynVueCombobox.vue +295 -0
- package/src/components/SynVueDetails.vue +35 -35
- package/src/components/SynVueDialog.vue +33 -31
- package/src/components/SynVueDivider.vue +9 -14
- package/src/components/SynVueDrawer.vue +37 -35
- package/src/components/SynVueDropdown.vue +37 -37
- package/src/components/SynVueFile.vue +69 -58
- package/src/components/SynVueHeader.vue +23 -24
- package/src/components/SynVueIcon.vue +26 -25
- package/src/components/SynVueIconButton.vue +42 -41
- package/src/components/SynVueInput.vue +123 -111
- package/src/components/SynVueMenu.vue +6 -9
- package/src/components/SynVueMenuItem.vue +24 -29
- package/src/components/SynVueMenuLabel.vue +2 -6
- package/src/components/SynVueNavItem.vue +32 -32
- package/src/components/SynVueOptgroup.vue +14 -19
- package/src/components/SynVueOption.vue +11 -16
- package/src/components/SynVuePopup.vue +51 -52
- package/src/components/SynVuePrioNav.vue +2 -6
- package/src/components/SynVueProgressBar.vue +16 -21
- package/src/components/SynVueProgressRing.vue +13 -18
- package/src/components/SynVueRadio.vue +23 -23
- package/src/components/SynVueRadioButton.vue +26 -26
- package/src/components/SynVueRadioGroup.vue +52 -43
- package/src/components/SynVueRange.vue +77 -65
- package/src/components/SynVueRangeTick.vue +10 -15
- package/src/components/SynVueSelect.vue +90 -74
- package/src/components/SynVueSideNav.vue +24 -24
- package/src/components/SynVueSpinner.vue +1 -5
- package/src/components/SynVueSwitch.vue +63 -52
- package/src/components/SynVueTab.vue +25 -26
- package/src/components/SynVueTabGroup.vue +31 -31
- package/src/components/SynVueTabPanel.vue +13 -18
- package/src/components/SynVueTag.vue +18 -19
- package/src/components/SynVueTextarea.vue +99 -88
- package/src/components/SynVueTooltip.vue +41 -41
- package/src/index.js +1 -0
|
@@ -54,9 +54,12 @@
|
|
|
54
54
|
import { computed, ref } from 'vue';
|
|
55
55
|
import '@synergy-design-system/components/components/file/file.js';
|
|
56
56
|
|
|
57
|
-
import type {
|
|
58
|
-
|
|
59
|
-
} from '@synergy-design-system/components';
|
|
57
|
+
import type { SynBlurEvent } from '@synergy-design-system/components';
|
|
58
|
+
import type { SynChangeEvent } from '@synergy-design-system/components';
|
|
59
|
+
import type { SynErrorEvent } from '@synergy-design-system/components';
|
|
60
|
+
import type { SynFocusEvent } from '@synergy-design-system/components';
|
|
61
|
+
import type { SynInputEvent } from '@synergy-design-system/components';
|
|
62
|
+
import type { SynFile } from '@synergy-design-system/components';
|
|
60
63
|
|
|
61
64
|
// DOM Reference to the element
|
|
62
65
|
const nativeElement = ref<SynFile>();
|
|
@@ -73,12 +76,12 @@ The FileList behaves like an array, so you can get the number of selected files
|
|
|
73
76
|
via its length property.
|
|
74
77
|
[see MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#getting_information_on_selected_files)
|
|
75
78
|
*/
|
|
76
|
-
|
|
79
|
+
files?: SynFile['files'];
|
|
77
80
|
|
|
78
81
|
/**
|
|
79
|
-
* The name of the file control, submitted as a name/value pair with form data.
|
|
80
|
-
|
|
81
|
-
|
|
82
|
+
* The name of the file control, submitted as a name/value pair with form data.
|
|
83
|
+
*/
|
|
84
|
+
name?: SynFile['name'];
|
|
82
85
|
|
|
83
86
|
/**
|
|
84
87
|
* The value of the file control contains a string that represents the path of the selected file.
|
|
@@ -87,40 +90,40 @@ If no file is selected, the value is an empty string.
|
|
|
87
90
|
Beware that the only valid value when setting a file control is an empty string!
|
|
88
91
|
[see MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#value)
|
|
89
92
|
*/
|
|
90
|
-
|
|
93
|
+
value?: SynFile['value'];
|
|
91
94
|
|
|
92
95
|
/**
|
|
93
|
-
* The file control's size.
|
|
94
|
-
|
|
95
|
-
|
|
96
|
+
* The file control's size.
|
|
97
|
+
*/
|
|
98
|
+
size?: SynFile['size'];
|
|
96
99
|
|
|
97
100
|
/**
|
|
98
|
-
* The file control's label.
|
|
99
|
-
* If you need to display HTML, use the `label` slot instead.
|
|
100
|
-
|
|
101
|
-
|
|
101
|
+
* The file control's label.
|
|
102
|
+
* If you need to display HTML, use the `label` slot instead.
|
|
103
|
+
*/
|
|
104
|
+
label?: SynFile['label'];
|
|
102
105
|
|
|
103
106
|
/**
|
|
104
107
|
* The file control's help text.
|
|
105
108
|
If you need to display HTML, use the `help-text` slot instead.
|
|
106
109
|
*/
|
|
107
|
-
|
|
110
|
+
helpText?: SynFile['helpText'];
|
|
108
111
|
|
|
109
112
|
/**
|
|
110
|
-
* Disables the file control.
|
|
111
|
-
|
|
112
|
-
|
|
113
|
+
* Disables the file control.
|
|
114
|
+
*/
|
|
115
|
+
disabled?: SynFile['disabled'];
|
|
113
116
|
|
|
114
117
|
/**
|
|
115
|
-
* Draw the file control as a drop area
|
|
116
|
-
|
|
117
|
-
|
|
118
|
+
* Draw the file control as a drop area
|
|
119
|
+
*/
|
|
120
|
+
droparea?: SynFile['droparea'];
|
|
118
121
|
|
|
119
122
|
/**
|
|
120
123
|
* Comma separated list of supported file types
|
|
121
124
|
[see MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept)
|
|
122
125
|
*/
|
|
123
|
-
|
|
126
|
+
accept?: SynFile['accept'];
|
|
124
127
|
|
|
125
128
|
/**
|
|
126
129
|
* Specifies the types of files that the server accepts.
|
|
@@ -128,13 +131,13 @@ Can be set either to user or environment.
|
|
|
128
131
|
Works only when not using a droparea!
|
|
129
132
|
[see MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/capture)
|
|
130
133
|
*/
|
|
131
|
-
|
|
134
|
+
capture?: SynFile['capture'];
|
|
132
135
|
|
|
133
136
|
/**
|
|
134
137
|
* Indicates whether the user can select more than one file.
|
|
135
138
|
[see MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#multiple)
|
|
136
139
|
*/
|
|
137
|
-
|
|
140
|
+
multiple?: SynFile['multiple'];
|
|
138
141
|
|
|
139
142
|
/**
|
|
140
143
|
* Indicates that the file control should let the user select directories instead of files.
|
|
@@ -143,7 +146,7 @@ in the set of selected items.
|
|
|
143
146
|
Note: This is a non-standard attribute but is supported in the major browsers.
|
|
144
147
|
[see MDN](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/webkitdirectory)
|
|
145
148
|
*/
|
|
146
|
-
|
|
149
|
+
webkitdirectory?: SynFile['webkitdirectory'];
|
|
147
150
|
|
|
148
151
|
/**
|
|
149
152
|
* By default, form controls are associated with the nearest containing `<form>` element.
|
|
@@ -152,21 +155,21 @@ with the form that has this `id`.
|
|
|
152
155
|
* The form must be in the same document
|
|
153
156
|
or shadow root for this to work.
|
|
154
157
|
*/
|
|
155
|
-
|
|
158
|
+
form?: SynFile['form'];
|
|
156
159
|
|
|
157
160
|
/**
|
|
158
|
-
* Makes the input a required field.
|
|
159
|
-
|
|
160
|
-
|
|
161
|
+
* Makes the input a required field.
|
|
162
|
+
*/
|
|
163
|
+
required?: SynFile['required'];
|
|
161
164
|
|
|
162
165
|
/**
|
|
163
|
-
* Suppress the value from being displayed in the file control
|
|
164
|
-
|
|
165
|
-
|
|
166
|
+
* Suppress the value from being displayed in the file control
|
|
167
|
+
*/
|
|
168
|
+
hideValue?: SynFile['hideValue'];
|
|
166
169
|
|
|
167
170
|
/**
|
|
168
|
-
* Support for two way data binding
|
|
169
|
-
|
|
171
|
+
* Support for two way data binding
|
|
172
|
+
*/
|
|
170
173
|
modelValue?: SynFile['files'];
|
|
171
174
|
}>();
|
|
172
175
|
|
|
@@ -174,42 +177,42 @@ or shadow root for this to work.
|
|
|
174
177
|
// This is needed because :param="param" also adds an empty attribute
|
|
175
178
|
// when using web-components, which breaks optional arguments like size in SynInput
|
|
176
179
|
// @see https://github.com/vuejs/core/issues/5190#issuecomment-1003112498
|
|
177
|
-
const visibleProps = computed(() =>
|
|
178
|
-
Object
|
|
179
|
-
.entries(props)
|
|
180
|
-
|
|
181
|
-
)
|
|
180
|
+
const visibleProps = computed(() =>
|
|
181
|
+
Object.fromEntries(
|
|
182
|
+
Object.entries(props).filter(([, value]) => typeof value !== 'undefined'),
|
|
183
|
+
),
|
|
184
|
+
);
|
|
182
185
|
|
|
183
186
|
// Map events
|
|
184
187
|
defineEmits<{
|
|
185
188
|
/**
|
|
186
|
-
* Emitted when the control loses focus.
|
|
187
|
-
|
|
189
|
+
* Emitted when the control loses focus.
|
|
190
|
+
*/
|
|
188
191
|
'syn-blur': [e: SynBlurEvent];
|
|
189
192
|
|
|
190
193
|
/**
|
|
191
|
-
* Emitted when an alteration to the control's value is committed by the user.
|
|
192
|
-
|
|
194
|
+
* Emitted when an alteration to the control's value is committed by the user.
|
|
195
|
+
*/
|
|
193
196
|
'syn-change': [e: SynChangeEvent];
|
|
194
197
|
|
|
195
198
|
/**
|
|
196
|
-
* Emitted when multiple files are selected via drag and drop, without the `multiple` property being set.
|
|
197
|
-
|
|
199
|
+
* Emitted when multiple files are selected via drag and drop, without the `multiple` property being set.
|
|
200
|
+
*/
|
|
198
201
|
'syn-error': [e: SynErrorEvent];
|
|
199
202
|
|
|
200
203
|
/**
|
|
201
|
-
* Emitted when the control gains focus.
|
|
202
|
-
|
|
204
|
+
* Emitted when the control gains focus.
|
|
205
|
+
*/
|
|
203
206
|
'syn-focus': [e: SynFocusEvent];
|
|
204
207
|
|
|
205
208
|
/**
|
|
206
|
-
* Emitted when the control receives input.
|
|
207
|
-
|
|
209
|
+
* Emitted when the control receives input.
|
|
210
|
+
*/
|
|
208
211
|
'syn-input': [e: SynInputEvent];
|
|
209
212
|
|
|
210
213
|
/**
|
|
211
|
-
* Support for two way data binding
|
|
212
|
-
|
|
214
|
+
* Support for two way data binding
|
|
215
|
+
*/
|
|
213
216
|
'update:modelValue': [newValue: SynFile['files']];
|
|
214
217
|
}>();
|
|
215
218
|
</script>
|
|
@@ -224,15 +227,23 @@ export type { SynInputEvent } from '@synergy-design-system/components';
|
|
|
224
227
|
|
|
225
228
|
<template>
|
|
226
229
|
<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
230
|
@syn-blur="$emit('syn-blur', $event)"
|
|
231
231
|
@syn-change="$emit('syn-change', $event)"
|
|
232
232
|
@syn-error="$emit('syn-error', $event)"
|
|
233
233
|
@syn-focus="$emit('syn-focus', $event)"
|
|
234
|
-
@syn-input="
|
|
235
|
-
|
|
236
|
-
|
|
234
|
+
@syn-input="
|
|
235
|
+
$emit('update:modelValue', $event.target.files);
|
|
236
|
+
$emit('syn-input', $event);
|
|
237
|
+
"
|
|
238
|
+
:files="
|
|
239
|
+
typeof props.modelValue !== 'undefined'
|
|
240
|
+
? props.modelValue
|
|
241
|
+
: typeof props.files !== 'undefined'
|
|
242
|
+
? props.files
|
|
243
|
+
: undefined
|
|
244
|
+
"
|
|
245
|
+
v-bind="visibleProps"
|
|
246
|
+
ref="nativeElement">
|
|
247
|
+
<slot></slot>
|
|
237
248
|
</syn-file>
|
|
238
249
|
</template>
|
|
@@ -38,9 +38,10 @@
|
|
|
38
38
|
import { computed, ref } from 'vue';
|
|
39
39
|
import '@synergy-design-system/components/components/header/header.js';
|
|
40
40
|
|
|
41
|
-
import type {
|
|
42
|
-
|
|
43
|
-
} from '@synergy-design-system/components';
|
|
41
|
+
import type { SynBurgerMenuClosedEvent } from '@synergy-design-system/components';
|
|
42
|
+
import type { SynBurgerMenuHiddenEvent } from '@synergy-design-system/components';
|
|
43
|
+
import type { SynBurgerMenuOpenEvent } from '@synergy-design-system/components';
|
|
44
|
+
import type { SynHeader } from '@synergy-design-system/components';
|
|
44
45
|
|
|
45
46
|
// DOM Reference to the element
|
|
46
47
|
const nativeElement = ref<SynHeader>();
|
|
@@ -52,10 +53,10 @@ defineExpose({
|
|
|
52
53
|
// Map attributes
|
|
53
54
|
const props = defineProps<{
|
|
54
55
|
/**
|
|
55
|
-
* The headers label.
|
|
56
|
-
* If you need to display HTML, use the `label` slot instead.
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
* The headers label.
|
|
57
|
+
* If you need to display HTML, use the `label` slot instead.
|
|
58
|
+
*/
|
|
59
|
+
label?: SynHeader['label'];
|
|
59
60
|
|
|
60
61
|
/**
|
|
61
62
|
* Defines the current visibility and icon of the burger-menu icon.
|
|
@@ -65,34 +66,34 @@ The following values can be used:
|
|
|
65
66
|
- open: The burger menu is visible and shows the close icon
|
|
66
67
|
- closed: The burger menu is visible and shows the open icon
|
|
67
68
|
*/
|
|
68
|
-
|
|
69
|
+
burgerMenu?: SynHeader['burgerMenu'];
|
|
69
70
|
}>();
|
|
70
71
|
|
|
71
72
|
// Make sure prop binding only forwards the props that are actually there.
|
|
72
73
|
// This is needed because :param="param" also adds an empty attribute
|
|
73
74
|
// when using web-components, which breaks optional arguments like size in SynInput
|
|
74
75
|
// @see https://github.com/vuejs/core/issues/5190#issuecomment-1003112498
|
|
75
|
-
const visibleProps = computed(() =>
|
|
76
|
-
Object
|
|
77
|
-
.entries(props)
|
|
78
|
-
|
|
79
|
-
)
|
|
76
|
+
const visibleProps = computed(() =>
|
|
77
|
+
Object.fromEntries(
|
|
78
|
+
Object.entries(props).filter(([, value]) => typeof value !== 'undefined'),
|
|
79
|
+
),
|
|
80
|
+
);
|
|
80
81
|
|
|
81
82
|
// Map events
|
|
82
83
|
defineEmits<{
|
|
83
84
|
/**
|
|
84
|
-
* Emitted when the burger menu is toggled to closed
|
|
85
|
-
|
|
85
|
+
* Emitted when the burger menu is toggled to closed
|
|
86
|
+
*/
|
|
86
87
|
'syn-burger-menu-closed': [e: SynBurgerMenuClosedEvent];
|
|
87
88
|
|
|
88
89
|
/**
|
|
89
|
-
* Emitted when the burger menu is toggled to hidden
|
|
90
|
-
|
|
90
|
+
* Emitted when the burger menu is toggled to hidden
|
|
91
|
+
*/
|
|
91
92
|
'syn-burger-menu-hidden': [e: SynBurgerMenuHiddenEvent];
|
|
92
93
|
|
|
93
94
|
/**
|
|
94
|
-
* Emitted when the burger menu is toggled to open
|
|
95
|
-
|
|
95
|
+
* Emitted when the burger menu is toggled to open
|
|
96
|
+
*/
|
|
96
97
|
'syn-burger-menu-open': [e: SynBurgerMenuOpenEvent];
|
|
97
98
|
}>();
|
|
98
99
|
</script>
|
|
@@ -105,13 +106,11 @@ export type { SynBurgerMenuOpenEvent } from '@synergy-design-system/components';
|
|
|
105
106
|
|
|
106
107
|
<template>
|
|
107
108
|
<syn-header
|
|
108
|
-
v-bind="visibleProps"
|
|
109
|
-
ref="nativeElement"
|
|
110
109
|
@syn-burger-menu-closed="$emit('syn-burger-menu-closed', $event)"
|
|
111
|
-
|
|
112
110
|
@syn-burger-menu-hidden="$emit('syn-burger-menu-hidden', $event)"
|
|
113
111
|
@syn-burger-menu-open="$emit('syn-burger-menu-open', $event)"
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
v-bind="visibleProps"
|
|
113
|
+
ref="nativeElement">
|
|
114
|
+
<slot></slot>
|
|
116
115
|
</syn-header>
|
|
117
116
|
</template>
|
|
@@ -20,7 +20,9 @@
|
|
|
20
20
|
import { computed, ref } from 'vue';
|
|
21
21
|
import '@synergy-design-system/components/components/icon/icon.js';
|
|
22
22
|
|
|
23
|
-
import type {
|
|
23
|
+
import type { SynLoadEvent } from '@synergy-design-system/components';
|
|
24
|
+
import type { SynErrorEvent } from '@synergy-design-system/components';
|
|
25
|
+
import type { SynIcon } from '@synergy-design-system/components';
|
|
24
26
|
|
|
25
27
|
// DOM Reference to the element
|
|
26
28
|
const nativeElement = ref<SynIcon>();
|
|
@@ -32,53 +34,53 @@ defineExpose({
|
|
|
32
34
|
// Map attributes
|
|
33
35
|
const props = defineProps<{
|
|
34
36
|
/**
|
|
35
|
-
* The name of the icon to draw.
|
|
36
|
-
* Available names depend on the icon library being used.
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
* The name of the icon to draw.
|
|
38
|
+
* Available names depend on the icon library being used.
|
|
39
|
+
*/
|
|
40
|
+
name?: SynIcon['name'];
|
|
39
41
|
|
|
40
42
|
/**
|
|
41
43
|
* An external URL of an SVG file.
|
|
42
44
|
* Be sure you trust the content you are including, as it will be executed as code and
|
|
43
45
|
can result in XSS attacks.
|
|
44
46
|
*/
|
|
45
|
-
|
|
47
|
+
src?: SynIcon['src'];
|
|
46
48
|
|
|
47
49
|
/**
|
|
48
50
|
* An alternate description to use for assistive devices.
|
|
49
51
|
* If omitted, the icon will be considered presentational and
|
|
50
52
|
ignored by assistive devices.
|
|
51
53
|
*/
|
|
52
|
-
|
|
54
|
+
label?: SynIcon['label'];
|
|
53
55
|
|
|
54
56
|
/**
|
|
55
|
-
* The name of a registered custom icon library.
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
* The name of a registered custom icon library.
|
|
58
|
+
*/
|
|
59
|
+
library?: SynIcon['library'];
|
|
58
60
|
}>();
|
|
59
61
|
|
|
60
62
|
// Make sure prop binding only forwards the props that are actually there.
|
|
61
63
|
// This is needed because :param="param" also adds an empty attribute
|
|
62
64
|
// when using web-components, which breaks optional arguments like size in SynInput
|
|
63
65
|
// @see https://github.com/vuejs/core/issues/5190#issuecomment-1003112498
|
|
64
|
-
const visibleProps = computed(() =>
|
|
65
|
-
Object
|
|
66
|
-
.entries(props)
|
|
67
|
-
|
|
68
|
-
)
|
|
66
|
+
const visibleProps = computed(() =>
|
|
67
|
+
Object.fromEntries(
|
|
68
|
+
Object.entries(props).filter(([, value]) => typeof value !== 'undefined'),
|
|
69
|
+
),
|
|
70
|
+
);
|
|
69
71
|
|
|
70
72
|
// Map events
|
|
71
73
|
defineEmits<{
|
|
72
74
|
/**
|
|
73
|
-
* Emitted when the icon has loaded.
|
|
74
|
-
* When using `spriteSheet: true` this will not emit.
|
|
75
|
-
|
|
75
|
+
* Emitted when the icon has loaded.
|
|
76
|
+
* When using `spriteSheet: true` this will not emit.
|
|
77
|
+
*/
|
|
76
78
|
'syn-load': [e: SynLoadEvent];
|
|
77
79
|
|
|
78
80
|
/**
|
|
79
|
-
* Emitted when the icon fails to load due to an error.
|
|
80
|
-
* When using `spriteSheet: true` this will not emit.
|
|
81
|
-
|
|
81
|
+
* Emitted when the icon fails to load due to an error.
|
|
82
|
+
* When using `spriteSheet: true` this will not emit.
|
|
83
|
+
*/
|
|
82
84
|
'syn-error': [e: SynErrorEvent];
|
|
83
85
|
}>();
|
|
84
86
|
</script>
|
|
@@ -90,10 +92,9 @@ export type { SynErrorEvent } from '@synergy-design-system/components';
|
|
|
90
92
|
|
|
91
93
|
<template>
|
|
92
94
|
<syn-icon
|
|
93
|
-
v-bind="visibleProps"
|
|
94
|
-
ref="nativeElement"
|
|
95
|
-
|
|
96
95
|
@syn-load="$emit('syn-load', $event)"
|
|
97
96
|
@syn-error="$emit('syn-error', $event)"
|
|
98
|
-
|
|
97
|
+
v-bind="visibleProps"
|
|
98
|
+
ref="nativeElement">
|
|
99
|
+
</syn-icon>
|
|
99
100
|
</template>
|
|
@@ -21,7 +21,9 @@
|
|
|
21
21
|
import { computed, ref } from 'vue';
|
|
22
22
|
import '@synergy-design-system/components/components/icon-button/icon-button.js';
|
|
23
23
|
|
|
24
|
-
import type { SynBlurEvent
|
|
24
|
+
import type { SynBlurEvent } from '@synergy-design-system/components';
|
|
25
|
+
import type { SynFocusEvent } from '@synergy-design-system/components';
|
|
26
|
+
import type { SynIconButton } from '@synergy-design-system/components';
|
|
25
27
|
|
|
26
28
|
// DOM Reference to the element
|
|
27
29
|
const nativeElement = ref<SynIconButton>();
|
|
@@ -33,84 +35,84 @@ defineExpose({
|
|
|
33
35
|
// Map attributes
|
|
34
36
|
const props = defineProps<{
|
|
35
37
|
/**
|
|
36
|
-
* The name of the icon to draw.
|
|
37
|
-
* Available names depend on the icon library being used.
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
* The name of the icon to draw.
|
|
39
|
+
* Available names depend on the icon library being used.
|
|
40
|
+
*/
|
|
41
|
+
name?: SynIconButton['name'];
|
|
40
42
|
|
|
41
43
|
/**
|
|
42
|
-
* The name of a registered custom icon library.
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
* The name of a registered custom icon library.
|
|
45
|
+
*/
|
|
46
|
+
library?: SynIconButton['library'];
|
|
45
47
|
|
|
46
48
|
/**
|
|
47
49
|
* An external URL of an SVG file.
|
|
48
50
|
* Be sure you trust the content you are including, as it will be executed as code and
|
|
49
51
|
can result in XSS attacks.
|
|
50
52
|
*/
|
|
51
|
-
|
|
53
|
+
src?: SynIconButton['src'];
|
|
52
54
|
|
|
53
55
|
/**
|
|
54
|
-
* When set, the underlying button will be rendered as an `<a>` with this `href` instead of a `<button>`.
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
* When set, the underlying button will be rendered as an `<a>` with this `href` instead of a `<button>`.
|
|
57
|
+
*/
|
|
58
|
+
href?: SynIconButton['href'];
|
|
57
59
|
|
|
58
60
|
/**
|
|
59
|
-
* Tells the browser where to open the link.
|
|
60
|
-
* Only used when `href` is set.
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
* Tells the browser where to open the link.
|
|
62
|
+
* Only used when `href` is set.
|
|
63
|
+
*/
|
|
64
|
+
target?: SynIconButton['target'];
|
|
63
65
|
|
|
64
66
|
/**
|
|
65
|
-
* Tells the browser to download the linked file as this filename.
|
|
66
|
-
* Only used when `href` is set.
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
* Tells the browser to download the linked file as this filename.
|
|
68
|
+
* Only used when `href` is set.
|
|
69
|
+
*/
|
|
70
|
+
download?: SynIconButton['download'];
|
|
69
71
|
|
|
70
72
|
/**
|
|
71
73
|
* A description that gets read by assistive devices.
|
|
72
74
|
* For optimal accessibility, you should always include a label
|
|
73
75
|
that describes what the icon button does.
|
|
74
76
|
*/
|
|
75
|
-
|
|
77
|
+
label?: SynIconButton['label'];
|
|
76
78
|
|
|
77
79
|
/**
|
|
78
|
-
* The icon button's size.
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
* The icon button's size.
|
|
81
|
+
*/
|
|
82
|
+
size?: SynIconButton['size'];
|
|
81
83
|
|
|
82
84
|
/**
|
|
83
85
|
* The color of the icon button.
|
|
84
86
|
The default "currentColor" makes it possible to easily style the icon button from outside without any CSS variables.
|
|
85
87
|
*/
|
|
86
|
-
|
|
88
|
+
color?: SynIconButton['color'];
|
|
87
89
|
|
|
88
90
|
/**
|
|
89
|
-
* Disables the button.
|
|
90
|
-
|
|
91
|
-
|
|
91
|
+
* Disables the button.
|
|
92
|
+
*/
|
|
93
|
+
disabled?: SynIconButton['disabled'];
|
|
92
94
|
}>();
|
|
93
95
|
|
|
94
96
|
// Make sure prop binding only forwards the props that are actually there.
|
|
95
97
|
// This is needed because :param="param" also adds an empty attribute
|
|
96
98
|
// when using web-components, which breaks optional arguments like size in SynInput
|
|
97
99
|
// @see https://github.com/vuejs/core/issues/5190#issuecomment-1003112498
|
|
98
|
-
const visibleProps = computed(() =>
|
|
99
|
-
Object
|
|
100
|
-
.entries(props)
|
|
101
|
-
|
|
102
|
-
)
|
|
100
|
+
const visibleProps = computed(() =>
|
|
101
|
+
Object.fromEntries(
|
|
102
|
+
Object.entries(props).filter(([, value]) => typeof value !== 'undefined'),
|
|
103
|
+
),
|
|
104
|
+
);
|
|
103
105
|
|
|
104
106
|
// Map events
|
|
105
107
|
defineEmits<{
|
|
106
108
|
/**
|
|
107
|
-
* Emitted when the icon button loses focus.
|
|
108
|
-
|
|
109
|
+
* Emitted when the icon button loses focus.
|
|
110
|
+
*/
|
|
109
111
|
'syn-blur': [e: SynBlurEvent];
|
|
110
112
|
|
|
111
113
|
/**
|
|
112
|
-
* Emitted when the icon button gains focus.
|
|
113
|
-
|
|
114
|
+
* Emitted when the icon button gains focus.
|
|
115
|
+
*/
|
|
114
116
|
'syn-focus': [e: SynFocusEvent];
|
|
115
117
|
}>();
|
|
116
118
|
</script>
|
|
@@ -122,10 +124,9 @@ export type { SynFocusEvent } from '@synergy-design-system/components';
|
|
|
122
124
|
|
|
123
125
|
<template>
|
|
124
126
|
<syn-icon-button
|
|
125
|
-
v-bind="visibleProps"
|
|
126
|
-
ref="nativeElement"
|
|
127
|
-
|
|
128
127
|
@syn-blur="$emit('syn-blur', $event)"
|
|
129
128
|
@syn-focus="$emit('syn-focus', $event)"
|
|
130
|
-
|
|
129
|
+
v-bind="visibleProps"
|
|
130
|
+
ref="nativeElement">
|
|
131
|
+
</syn-icon-button>
|
|
131
132
|
</template>
|