@synergy-design-system/vue 2.7.1 → 2.7.3
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/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/package.json +2 -2
- 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/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
|
@@ -55,9 +55,17 @@
|
|
|
55
55
|
import { computed, ref } from 'vue';
|
|
56
56
|
import '@synergy-design-system/components/components/select/select.js';
|
|
57
57
|
|
|
58
|
-
import type {
|
|
59
|
-
|
|
60
|
-
} from '@synergy-design-system/components';
|
|
58
|
+
import type { SynChangeEvent } from '@synergy-design-system/components';
|
|
59
|
+
import type { SynClearEvent } from '@synergy-design-system/components';
|
|
60
|
+
import type { SynInputEvent } from '@synergy-design-system/components';
|
|
61
|
+
import type { SynFocusEvent } from '@synergy-design-system/components';
|
|
62
|
+
import type { SynBlurEvent } from '@synergy-design-system/components';
|
|
63
|
+
import type { SynShowEvent } from '@synergy-design-system/components';
|
|
64
|
+
import type { SynAfterShowEvent } from '@synergy-design-system/components';
|
|
65
|
+
import type { SynHideEvent } from '@synergy-design-system/components';
|
|
66
|
+
import type { SynAfterHideEvent } from '@synergy-design-system/components';
|
|
67
|
+
import type { SynInvalidEvent } from '@synergy-design-system/components';
|
|
68
|
+
import type { SynSelect } from '@synergy-design-system/components';
|
|
61
69
|
|
|
62
70
|
// DOM Reference to the element
|
|
63
71
|
const nativeElement = ref<SynSelect>();
|
|
@@ -69,9 +77,9 @@ defineExpose({
|
|
|
69
77
|
// Map attributes
|
|
70
78
|
const props = defineProps<{
|
|
71
79
|
/**
|
|
72
|
-
* The name of the select, submitted as a name/value pair with form data.
|
|
73
|
-
|
|
74
|
-
|
|
80
|
+
* The name of the select, submitted as a name/value pair with form data.
|
|
81
|
+
*/
|
|
82
|
+
name?: SynSelect['name'];
|
|
75
83
|
|
|
76
84
|
/**
|
|
77
85
|
* The current value of the select, submitted as a name/value pair with form data.
|
|
@@ -80,22 +88,22 @@ value attribute will be a space-delimited list of values based on the options se
|
|
|
80
88
|
be an array.
|
|
81
89
|
* **For this reason, values must not contain spaces.**
|
|
82
90
|
*/
|
|
83
|
-
|
|
91
|
+
value?: SynSelect['value'];
|
|
84
92
|
|
|
85
93
|
/**
|
|
86
|
-
* The select's size.
|
|
87
|
-
|
|
88
|
-
|
|
94
|
+
* The select's size.
|
|
95
|
+
*/
|
|
96
|
+
size?: SynSelect['size'];
|
|
89
97
|
|
|
90
98
|
/**
|
|
91
|
-
* Placeholder text to show as a hint when the select is empty.
|
|
92
|
-
|
|
93
|
-
|
|
99
|
+
* Placeholder text to show as a hint when the select is empty.
|
|
100
|
+
*/
|
|
101
|
+
placeholder?: SynSelect['placeholder'];
|
|
94
102
|
|
|
95
103
|
/**
|
|
96
|
-
* Allows more than one option to be selected.
|
|
97
|
-
|
|
98
|
-
|
|
104
|
+
* Allows more than one option to be selected.
|
|
105
|
+
*/
|
|
106
|
+
multiple?: SynSelect['multiple'];
|
|
99
107
|
|
|
100
108
|
/**
|
|
101
109
|
* The maximum number of selected options to show when `multiple` is true.
|
|
@@ -103,50 +111,50 @@ be an array.
|
|
|
103
111
|
indicate the number of additional items that are selected.
|
|
104
112
|
* Set to 0 to remove the limit.
|
|
105
113
|
*/
|
|
106
|
-
|
|
114
|
+
maxOptionsVisible?: SynSelect['maxOptionsVisible'];
|
|
107
115
|
|
|
108
116
|
/**
|
|
109
|
-
* Disables the select control.
|
|
110
|
-
|
|
111
|
-
|
|
117
|
+
* Disables the select control.
|
|
118
|
+
*/
|
|
119
|
+
disabled?: SynSelect['disabled'];
|
|
112
120
|
|
|
113
121
|
/**
|
|
114
|
-
* Adds a clear button when the select is not empty.
|
|
115
|
-
|
|
116
|
-
|
|
122
|
+
* Adds a clear button when the select is not empty.
|
|
123
|
+
*/
|
|
124
|
+
clearable?: SynSelect['clearable'];
|
|
117
125
|
|
|
118
126
|
/**
|
|
119
127
|
* Indicates whether or not the select is open.
|
|
120
128
|
* You can toggle this attribute to show and hide the menu, or you can
|
|
121
129
|
use the `show()` and `hide()` methods and this attribute will reflect the select's open state.
|
|
122
130
|
*/
|
|
123
|
-
|
|
131
|
+
open?: SynSelect['open'];
|
|
124
132
|
|
|
125
133
|
/**
|
|
126
134
|
* Enable this option to prevent the listbox from being clipped when the component is placed inside a container with
|
|
127
135
|
`overflow: auto|scroll`.
|
|
128
136
|
* Hoisting uses a fixed positioning strategy that works in many, but not all, scenarios.
|
|
129
137
|
*/
|
|
130
|
-
|
|
138
|
+
hoist?: SynSelect['hoist'];
|
|
131
139
|
|
|
132
140
|
/**
|
|
133
|
-
* The select's label.
|
|
134
|
-
* If you need to display HTML, use the `label` slot instead.
|
|
135
|
-
|
|
136
|
-
|
|
141
|
+
* The select's label.
|
|
142
|
+
* If you need to display HTML, use the `label` slot instead.
|
|
143
|
+
*/
|
|
144
|
+
label?: SynSelect['label'];
|
|
137
145
|
|
|
138
146
|
/**
|
|
139
147
|
* The preferred placement of the select's menu.
|
|
140
148
|
* Note that the actual placement may vary as needed to keep the listbox
|
|
141
149
|
inside of the viewport.
|
|
142
150
|
*/
|
|
143
|
-
|
|
151
|
+
placement?: SynSelect['placement'];
|
|
144
152
|
|
|
145
153
|
/**
|
|
146
|
-
* The select's help text.
|
|
147
|
-
* If you need to display HTML, use the `help-text` slot instead.
|
|
148
|
-
|
|
149
|
-
|
|
154
|
+
* The select's help text.
|
|
155
|
+
* If you need to display HTML, use the `help-text` slot instead.
|
|
156
|
+
*/
|
|
157
|
+
helpText?: SynSelect['helpText'];
|
|
150
158
|
|
|
151
159
|
/**
|
|
152
160
|
* By default, form controls are associated with the nearest containing `<form>` element.
|
|
@@ -155,12 +163,12 @@ to place the form control outside of a form and associate it with the form that
|
|
|
155
163
|
* The form must be in
|
|
156
164
|
the same document or shadow root for this to work.
|
|
157
165
|
*/
|
|
158
|
-
|
|
166
|
+
form?: SynSelect['form'];
|
|
159
167
|
|
|
160
168
|
/**
|
|
161
|
-
* The select's required attribute.
|
|
162
|
-
|
|
163
|
-
|
|
169
|
+
* The select's required attribute.
|
|
170
|
+
*/
|
|
171
|
+
required?: SynSelect['required'];
|
|
164
172
|
|
|
165
173
|
/**
|
|
166
174
|
* A function that customizes the tags to be rendered when multiple=true.
|
|
@@ -169,11 +177,11 @@ is the current tag's index.
|
|
|
169
177
|
* The function should return either a Lit TemplateResult or a string containing trusted HTML of the symbol to render at
|
|
170
178
|
the specified value.
|
|
171
179
|
*/
|
|
172
|
-
|
|
180
|
+
getTag?: SynSelect['getTag'];
|
|
173
181
|
|
|
174
182
|
/**
|
|
175
|
-
* Support for two way data binding
|
|
176
|
-
|
|
183
|
+
* Support for two way data binding
|
|
184
|
+
*/
|
|
177
185
|
modelValue?: SynSelect['value'];
|
|
178
186
|
}>();
|
|
179
187
|
|
|
@@ -181,67 +189,67 @@ the specified value.
|
|
|
181
189
|
// This is needed because :param="param" also adds an empty attribute
|
|
182
190
|
// when using web-components, which breaks optional arguments like size in SynInput
|
|
183
191
|
// @see https://github.com/vuejs/core/issues/5190#issuecomment-1003112498
|
|
184
|
-
const visibleProps = computed(() =>
|
|
185
|
-
Object
|
|
186
|
-
.entries(props)
|
|
187
|
-
|
|
188
|
-
)
|
|
192
|
+
const visibleProps = computed(() =>
|
|
193
|
+
Object.fromEntries(
|
|
194
|
+
Object.entries(props).filter(([, value]) => typeof value !== 'undefined'),
|
|
195
|
+
),
|
|
196
|
+
);
|
|
189
197
|
|
|
190
198
|
// Map events
|
|
191
199
|
defineEmits<{
|
|
192
200
|
/**
|
|
193
|
-
* Emitted when the control's value changes.
|
|
194
|
-
|
|
201
|
+
* Emitted when the control's value changes.
|
|
202
|
+
*/
|
|
195
203
|
'syn-change': [e: SynChangeEvent];
|
|
196
204
|
|
|
197
205
|
/**
|
|
198
|
-
* Emitted when the control's value is cleared.
|
|
199
|
-
|
|
206
|
+
* Emitted when the control's value is cleared.
|
|
207
|
+
*/
|
|
200
208
|
'syn-clear': [e: SynClearEvent];
|
|
201
209
|
|
|
202
210
|
/**
|
|
203
|
-
* Emitted when the control receives input.
|
|
204
|
-
|
|
211
|
+
* Emitted when the control receives input.
|
|
212
|
+
*/
|
|
205
213
|
'syn-input': [e: SynInputEvent];
|
|
206
214
|
|
|
207
215
|
/**
|
|
208
|
-
* Emitted when the control gains focus.
|
|
209
|
-
|
|
216
|
+
* Emitted when the control gains focus.
|
|
217
|
+
*/
|
|
210
218
|
'syn-focus': [e: SynFocusEvent];
|
|
211
219
|
|
|
212
220
|
/**
|
|
213
|
-
* Emitted when the control loses focus.
|
|
214
|
-
|
|
221
|
+
* Emitted when the control loses focus.
|
|
222
|
+
*/
|
|
215
223
|
'syn-blur': [e: SynBlurEvent];
|
|
216
224
|
|
|
217
225
|
/**
|
|
218
|
-
* Emitted when the select's menu opens.
|
|
219
|
-
|
|
226
|
+
* Emitted when the select's menu opens.
|
|
227
|
+
*/
|
|
220
228
|
'syn-show': [e: SynShowEvent];
|
|
221
229
|
|
|
222
230
|
/**
|
|
223
|
-
* Emitted after the select's menu opens and all animations are complete.
|
|
224
|
-
|
|
231
|
+
* Emitted after the select's menu opens and all animations are complete.
|
|
232
|
+
*/
|
|
225
233
|
'syn-after-show': [e: SynAfterShowEvent];
|
|
226
234
|
|
|
227
235
|
/**
|
|
228
|
-
* Emitted when the select's menu closes.
|
|
229
|
-
|
|
236
|
+
* Emitted when the select's menu closes.
|
|
237
|
+
*/
|
|
230
238
|
'syn-hide': [e: SynHideEvent];
|
|
231
239
|
|
|
232
240
|
/**
|
|
233
|
-
* Emitted after the select's menu closes and all animations are complete.
|
|
234
|
-
|
|
241
|
+
* Emitted after the select's menu closes and all animations are complete.
|
|
242
|
+
*/
|
|
235
243
|
'syn-after-hide': [e: SynAfterHideEvent];
|
|
236
244
|
|
|
237
245
|
/**
|
|
238
|
-
* Emitted when the form control has been checked for validity and its constraints aren't satisfied.
|
|
239
|
-
|
|
246
|
+
* Emitted when the form control has been checked for validity and its constraints aren't satisfied.
|
|
247
|
+
*/
|
|
240
248
|
'syn-invalid': [e: SynInvalidEvent];
|
|
241
249
|
|
|
242
250
|
/**
|
|
243
|
-
* Support for two way data binding
|
|
244
|
-
|
|
251
|
+
* Support for two way data binding
|
|
252
|
+
*/
|
|
245
253
|
'update:modelValue': [newValue: SynSelect['value']];
|
|
246
254
|
}>();
|
|
247
255
|
</script>
|
|
@@ -262,11 +270,11 @@ export type { SynInvalidEvent } from '@synergy-design-system/components';
|
|
|
262
270
|
<template>
|
|
263
271
|
<syn-select
|
|
264
272
|
@syn-change="$emit('syn-change', $event)"
|
|
265
|
-
:value="typeof props.modelValue !== 'undefined' ? props.modelValue : typeof props.value !== 'undefined' ? props.value : undefined"
|
|
266
273
|
@syn-clear="$emit('syn-clear', $event)"
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
274
|
+
@syn-input="
|
|
275
|
+
$emit('update:modelValue', $event.target.value);
|
|
276
|
+
$emit('syn-input', $event);
|
|
277
|
+
"
|
|
270
278
|
@syn-focus="$emit('syn-focus', $event)"
|
|
271
279
|
@syn-blur="$emit('syn-blur', $event)"
|
|
272
280
|
@syn-show="$emit('syn-show', $event)"
|
|
@@ -274,7 +282,15 @@ export type { SynInvalidEvent } from '@synergy-design-system/components';
|
|
|
274
282
|
@syn-hide="$emit('syn-hide', $event)"
|
|
275
283
|
@syn-after-hide="$emit('syn-after-hide', $event)"
|
|
276
284
|
@syn-invalid="$emit('syn-invalid', $event)"
|
|
277
|
-
|
|
278
|
-
|
|
285
|
+
:value="
|
|
286
|
+
typeof props.modelValue !== 'undefined'
|
|
287
|
+
? props.modelValue
|
|
288
|
+
: typeof props.value !== 'undefined'
|
|
289
|
+
? props.value
|
|
290
|
+
: undefined
|
|
291
|
+
"
|
|
292
|
+
v-bind="visibleProps"
|
|
293
|
+
ref="nativeElement">
|
|
294
|
+
<slot></slot>
|
|
279
295
|
</syn-select>
|
|
280
296
|
</template>
|
|
@@ -52,9 +52,11 @@
|
|
|
52
52
|
import { computed, ref } from 'vue';
|
|
53
53
|
import '@synergy-design-system/components/components/side-nav/side-nav.js';
|
|
54
54
|
|
|
55
|
-
import type {
|
|
56
|
-
|
|
57
|
-
} from '@synergy-design-system/components';
|
|
55
|
+
import type { SynShowEvent } from '@synergy-design-system/components';
|
|
56
|
+
import type { SynAfterShowEvent } from '@synergy-design-system/components';
|
|
57
|
+
import type { SynHideEvent } from '@synergy-design-system/components';
|
|
58
|
+
import type { SynAfterHideEvent } from '@synergy-design-system/components';
|
|
59
|
+
import type { SynSideNav } from '@synergy-design-system/components';
|
|
58
60
|
|
|
59
61
|
// DOM Reference to the element
|
|
60
62
|
const nativeElement = ref<SynSideNav>();
|
|
@@ -81,7 +83,7 @@ With `open` will show the whole side-nav with an overlay for touch devices
|
|
|
81
83
|
or without an overlay for non-touch devices.
|
|
82
84
|
Without `open`, the side-nav will only show the prefix of nav-item's.
|
|
83
85
|
*/
|
|
84
|
-
|
|
86
|
+
open?: SynSideNav['open'];
|
|
85
87
|
|
|
86
88
|
/**
|
|
87
89
|
* Use the rail attribute to only show the prefix of navigation items in closed state.
|
|
@@ -91,45 +93,45 @@ On touch devices the navigation opens on click and shows an overlay.
|
|
|
91
93
|
Note: The Rail is only an option if all Navigation Items on the first level have an Icon.
|
|
92
94
|
If this is not the case you should use a burger navigation.
|
|
93
95
|
*/
|
|
94
|
-
|
|
96
|
+
rail?: SynSideNav['rail'];
|
|
95
97
|
|
|
96
98
|
/**
|
|
97
99
|
* By default, the side-nav traps the focus if in non-rail mode and open.
|
|
98
100
|
To disable the focus trapping, set this attribute.
|
|
99
101
|
*/
|
|
100
|
-
|
|
102
|
+
noFocusTrapping?: SynSideNav['noFocusTrapping'];
|
|
101
103
|
}>();
|
|
102
104
|
|
|
103
105
|
// Make sure prop binding only forwards the props that are actually there.
|
|
104
106
|
// This is needed because :param="param" also adds an empty attribute
|
|
105
107
|
// when using web-components, which breaks optional arguments like size in SynInput
|
|
106
108
|
// @see https://github.com/vuejs/core/issues/5190#issuecomment-1003112498
|
|
107
|
-
const visibleProps = computed(() =>
|
|
108
|
-
Object
|
|
109
|
-
.entries(props)
|
|
110
|
-
|
|
111
|
-
)
|
|
109
|
+
const visibleProps = computed(() =>
|
|
110
|
+
Object.fromEntries(
|
|
111
|
+
Object.entries(props).filter(([, value]) => typeof value !== 'undefined'),
|
|
112
|
+
),
|
|
113
|
+
);
|
|
112
114
|
|
|
113
115
|
// Map events
|
|
114
116
|
defineEmits<{
|
|
115
117
|
/**
|
|
116
|
-
* Emitted when the side-nav opens.
|
|
117
|
-
|
|
118
|
+
* Emitted when the side-nav opens.
|
|
119
|
+
*/
|
|
118
120
|
'syn-show': [e: SynShowEvent];
|
|
119
121
|
|
|
120
122
|
/**
|
|
121
|
-
* Emitted after the side-nav opens and all animations are complete.
|
|
122
|
-
|
|
123
|
+
* Emitted after the side-nav opens and all animations are complete.
|
|
124
|
+
*/
|
|
123
125
|
'syn-after-show': [e: SynAfterShowEvent];
|
|
124
126
|
|
|
125
127
|
/**
|
|
126
|
-
* Emitted when the side-nav closes.
|
|
127
|
-
|
|
128
|
+
* Emitted when the side-nav closes.
|
|
129
|
+
*/
|
|
128
130
|
'syn-hide': [e: SynHideEvent];
|
|
129
131
|
|
|
130
132
|
/**
|
|
131
|
-
* Emitted after the side-nav closes and all animations are complete.
|
|
132
|
-
|
|
133
|
+
* Emitted after the side-nav closes and all animations are complete.
|
|
134
|
+
*/
|
|
133
135
|
'syn-after-hide': [e: SynAfterHideEvent];
|
|
134
136
|
}>();
|
|
135
137
|
</script>
|
|
@@ -143,14 +145,12 @@ export type { SynAfterHideEvent } from '@synergy-design-system/components';
|
|
|
143
145
|
|
|
144
146
|
<template>
|
|
145
147
|
<syn-side-nav
|
|
146
|
-
v-bind="visibleProps"
|
|
147
|
-
ref="nativeElement"
|
|
148
148
|
@syn-show="$emit('syn-show', $event)"
|
|
149
149
|
@syn-after-show="$emit('syn-after-show', $event)"
|
|
150
|
-
|
|
151
150
|
@syn-hide="$emit('syn-hide', $event)"
|
|
152
151
|
@syn-after-hide="$emit('syn-after-hide', $event)"
|
|
153
|
-
|
|
154
|
-
|
|
152
|
+
v-bind="visibleProps"
|
|
153
|
+
ref="nativeElement">
|
|
154
|
+
<slot></slot>
|
|
155
155
|
</syn-side-nav>
|
|
156
156
|
</template>
|
|
@@ -33,9 +33,12 @@
|
|
|
33
33
|
import { computed, ref } from 'vue';
|
|
34
34
|
import '@synergy-design-system/components/components/switch/switch.js';
|
|
35
35
|
|
|
36
|
-
import type {
|
|
37
|
-
|
|
38
|
-
} from '@synergy-design-system/components';
|
|
36
|
+
import type { SynBlurEvent } from '@synergy-design-system/components';
|
|
37
|
+
import type { SynChangeEvent } from '@synergy-design-system/components';
|
|
38
|
+
import type { SynInputEvent } from '@synergy-design-system/components';
|
|
39
|
+
import type { SynFocusEvent } from '@synergy-design-system/components';
|
|
40
|
+
import type { SynInvalidEvent } from '@synergy-design-system/components';
|
|
41
|
+
import type { SynSwitch } from '@synergy-design-system/components';
|
|
39
42
|
|
|
40
43
|
// DOM Reference to the element
|
|
41
44
|
const nativeElement = ref<SynSwitch>();
|
|
@@ -46,32 +49,32 @@ defineExpose({
|
|
|
46
49
|
|
|
47
50
|
// Map attributes
|
|
48
51
|
const props = defineProps<{
|
|
49
|
-
|
|
52
|
+
title?: SynSwitch['title'];
|
|
50
53
|
|
|
51
54
|
/**
|
|
52
|
-
* The name of the switch, submitted as a name/value pair with form data.
|
|
53
|
-
|
|
54
|
-
|
|
55
|
+
* The name of the switch, submitted as a name/value pair with form data.
|
|
56
|
+
*/
|
|
57
|
+
name?: SynSwitch['name'];
|
|
55
58
|
|
|
56
59
|
/**
|
|
57
|
-
* The current value of the switch, submitted as a name/value pair with form data.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
+
* The current value of the switch, submitted as a name/value pair with form data.
|
|
61
|
+
*/
|
|
62
|
+
value?: SynSwitch['value'];
|
|
60
63
|
|
|
61
64
|
/**
|
|
62
|
-
* The switch's size.
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
* The switch's size.
|
|
66
|
+
*/
|
|
67
|
+
size?: SynSwitch['size'];
|
|
65
68
|
|
|
66
69
|
/**
|
|
67
|
-
* Disables the switch.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
+
* Disables the switch.
|
|
71
|
+
*/
|
|
72
|
+
disabled?: SynSwitch['disabled'];
|
|
70
73
|
|
|
71
74
|
/**
|
|
72
|
-
* Draws the switch in a checked state.
|
|
73
|
-
|
|
74
|
-
|
|
75
|
+
* Draws the switch in a checked state.
|
|
76
|
+
*/
|
|
77
|
+
checked?: SynSwitch['checked'];
|
|
75
78
|
|
|
76
79
|
/**
|
|
77
80
|
* By default, form controls are associated with the nearest containing `<form>` element.
|
|
@@ -80,22 +83,22 @@ to place the form control outside of a form and associate it with the form that
|
|
|
80
83
|
* The form must be in
|
|
81
84
|
the same document or shadow root for this to work.
|
|
82
85
|
*/
|
|
83
|
-
|
|
86
|
+
form?: SynSwitch['form'];
|
|
84
87
|
|
|
85
88
|
/**
|
|
86
|
-
* Makes the switch a required field.
|
|
87
|
-
|
|
88
|
-
|
|
89
|
+
* Makes the switch a required field.
|
|
90
|
+
*/
|
|
91
|
+
required?: SynSwitch['required'];
|
|
89
92
|
|
|
90
93
|
/**
|
|
91
|
-
* The switch's help text.
|
|
92
|
-
* If you need to display HTML, use the `help-text` slot instead.
|
|
93
|
-
|
|
94
|
-
|
|
94
|
+
* The switch's help text.
|
|
95
|
+
* If you need to display HTML, use the `help-text` slot instead.
|
|
96
|
+
*/
|
|
97
|
+
helpText?: SynSwitch['helpText'];
|
|
95
98
|
|
|
96
99
|
/**
|
|
97
|
-
* Support for two way data binding
|
|
98
|
-
|
|
100
|
+
* Support for two way data binding
|
|
101
|
+
*/
|
|
99
102
|
modelValue?: SynSwitch['checked'];
|
|
100
103
|
}>();
|
|
101
104
|
|
|
@@ -103,42 +106,42 @@ the same document or shadow root for this to work.
|
|
|
103
106
|
// This is needed because :param="param" also adds an empty attribute
|
|
104
107
|
// when using web-components, which breaks optional arguments like size in SynInput
|
|
105
108
|
// @see https://github.com/vuejs/core/issues/5190#issuecomment-1003112498
|
|
106
|
-
const visibleProps = computed(() =>
|
|
107
|
-
Object
|
|
108
|
-
.entries(props)
|
|
109
|
-
|
|
110
|
-
)
|
|
109
|
+
const visibleProps = computed(() =>
|
|
110
|
+
Object.fromEntries(
|
|
111
|
+
Object.entries(props).filter(([, value]) => typeof value !== 'undefined'),
|
|
112
|
+
),
|
|
113
|
+
);
|
|
111
114
|
|
|
112
115
|
// Map events
|
|
113
116
|
defineEmits<{
|
|
114
117
|
/**
|
|
115
|
-
* Emitted when the control loses focus.
|
|
116
|
-
|
|
118
|
+
* Emitted when the control loses focus.
|
|
119
|
+
*/
|
|
117
120
|
'syn-blur': [e: SynBlurEvent];
|
|
118
121
|
|
|
119
122
|
/**
|
|
120
|
-
* Emitted when the control's checked state changes.
|
|
121
|
-
|
|
123
|
+
* Emitted when the control's checked state changes.
|
|
124
|
+
*/
|
|
122
125
|
'syn-change': [e: SynChangeEvent];
|
|
123
126
|
|
|
124
127
|
/**
|
|
125
|
-
* Emitted when the control receives input.
|
|
126
|
-
|
|
128
|
+
* Emitted when the control receives input.
|
|
129
|
+
*/
|
|
127
130
|
'syn-input': [e: SynInputEvent];
|
|
128
131
|
|
|
129
132
|
/**
|
|
130
|
-
* Emitted when the control gains focus.
|
|
131
|
-
|
|
133
|
+
* Emitted when the control gains focus.
|
|
134
|
+
*/
|
|
132
135
|
'syn-focus': [e: SynFocusEvent];
|
|
133
136
|
|
|
134
137
|
/**
|
|
135
|
-
* Emitted when the form control has been checked for validity and its constraints aren't satisfied.
|
|
136
|
-
|
|
138
|
+
* Emitted when the form control has been checked for validity and its constraints aren't satisfied.
|
|
139
|
+
*/
|
|
137
140
|
'syn-invalid': [e: SynInvalidEvent];
|
|
138
141
|
|
|
139
142
|
/**
|
|
140
|
-
* Support for two way data binding
|
|
141
|
-
|
|
143
|
+
* Support for two way data binding
|
|
144
|
+
*/
|
|
142
145
|
'update:modelValue': [newValue: SynSwitch['checked']];
|
|
143
146
|
}>();
|
|
144
147
|
</script>
|
|
@@ -153,15 +156,23 @@ export type { SynInvalidEvent } from '@synergy-design-system/components';
|
|
|
153
156
|
|
|
154
157
|
<template>
|
|
155
158
|
<syn-switch
|
|
156
|
-
v-bind="visibleProps"
|
|
157
|
-
ref="nativeElement"
|
|
158
|
-
:checked="typeof props.modelValue !== 'undefined' ? props.modelValue : typeof props.checked !== 'undefined' ? props.checked : undefined"
|
|
159
159
|
@syn-blur="$emit('syn-blur', $event)"
|
|
160
160
|
@syn-change="$emit('syn-change', $event)"
|
|
161
|
-
@syn-input="
|
|
161
|
+
@syn-input="
|
|
162
|
+
$emit('update:modelValue', $event.target.checked);
|
|
163
|
+
$emit('syn-input', $event);
|
|
164
|
+
"
|
|
162
165
|
@syn-focus="$emit('syn-focus', $event)"
|
|
163
166
|
@syn-invalid="$emit('syn-invalid', $event)"
|
|
164
|
-
|
|
165
|
-
|
|
167
|
+
:checked="
|
|
168
|
+
typeof props.modelValue !== 'undefined'
|
|
169
|
+
? props.modelValue
|
|
170
|
+
: typeof props.checked !== 'undefined'
|
|
171
|
+
? props.checked
|
|
172
|
+
: undefined
|
|
173
|
+
"
|
|
174
|
+
v-bind="visibleProps"
|
|
175
|
+
ref="nativeElement">
|
|
176
|
+
<slot></slot>
|
|
166
177
|
</syn-switch>
|
|
167
178
|
</template>
|