@synergy-design-system/mcp 2.6.1 → 2.7.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/CHANGELOG.md +22 -0
- package/dist/utilities/storybook/scraper.js +14 -3
- package/metadata/checksum.txt +1 -1
- package/metadata/packages/components/components/syn-checkbox/component.angular.ts +13 -0
- package/metadata/packages/components/components/syn-checkbox/component.styles.ts +99 -39
- package/metadata/packages/components/components/syn-checkbox/component.ts +13 -10
- package/metadata/packages/components/components/syn-checkbox/component.vue +5 -0
- package/metadata/packages/components/components/syn-combobox/component.angular.ts +13 -0
- package/metadata/packages/components/components/syn-combobox/component.styles.ts +216 -193
- package/metadata/packages/components/components/syn-combobox/component.ts +68 -39
- package/metadata/packages/components/components/syn-combobox/component.vue +5 -0
- package/metadata/packages/components/components/syn-file/component.angular.ts +13 -0
- package/metadata/packages/components/components/syn-file/component.styles.ts +20 -3
- package/metadata/packages/components/components/syn-file/component.ts +19 -5
- package/metadata/packages/components/components/syn-file/component.vue +5 -0
- package/metadata/packages/components/components/syn-input/component.ts +1 -2
- package/metadata/packages/components/components/syn-radio/component.angular.ts +13 -0
- package/metadata/packages/components/components/syn-radio/component.styles.ts +91 -29
- package/metadata/packages/components/components/syn-radio/component.ts +19 -10
- package/metadata/packages/components/components/syn-radio/component.vue +5 -0
- package/metadata/packages/components/components/syn-radio-group/component.styles.ts +30 -9
- package/metadata/packages/components/components/syn-radio-group/component.ts +61 -32
- package/metadata/packages/components/components/syn-range/component.angular.ts +13 -0
- package/metadata/packages/components/components/syn-range/component.styles.ts +27 -3
- package/metadata/packages/components/components/syn-range/component.ts +17 -5
- package/metadata/packages/components/components/syn-range/component.vue +5 -0
- package/metadata/packages/components/components/syn-select/component.angular.ts +13 -0
- package/metadata/packages/components/components/syn-select/component.styles.ts +222 -151
- package/metadata/packages/components/components/syn-select/component.ts +30 -15
- package/metadata/packages/components/components/syn-select/component.vue +5 -0
- package/metadata/packages/components/components/syn-switch/component.angular.ts +13 -0
- package/metadata/packages/components/components/syn-switch/component.styles.ts +145 -63
- package/metadata/packages/components/components/syn-switch/component.ts +16 -4
- package/metadata/packages/components/components/syn-switch/component.vue +5 -0
- package/metadata/packages/components/components/syn-textarea/component.styles.ts +55 -27
- package/metadata/packages/components/components/syn-textarea/component.ts +1 -3
- package/metadata/packages/components/static/CHANGELOG.md +27 -0
- package/metadata/packages/tokens/CHANGELOG.md +22 -0
- package/metadata/packages/tokens/dark.css +7 -1
- package/metadata/packages/tokens/index.js +31 -1
- package/metadata/packages/tokens/light.css +7 -1
- package/metadata/packages/tokens/sick2018_dark.css +7 -1
- package/metadata/packages/tokens/sick2018_light.css +7 -1
- package/metadata/packages/tokens/sick2025_dark.css +7 -1
- package/metadata/packages/tokens/sick2025_light.css +7 -1
- package/metadata/static/components/syn-checkbox/docs.md +36 -0
- package/metadata/static/components/syn-combobox/docs.md +138 -0
- package/metadata/static/components/syn-file/docs.md +24 -0
- package/metadata/static/components/syn-input/docs.md +1 -1
- package/metadata/static/components/syn-radio/docs.md +21 -0
- package/metadata/static/components/syn-radio-group/docs.md +46 -0
- package/metadata/static/components/syn-range/docs.md +19 -0
- package/metadata/static/components/syn-select/docs.md +81 -0
- package/metadata/static/components/syn-switch/docs.md +22 -0
- package/metadata/static/components/syn-textarea/docs.md +1 -1
- package/metadata/static/components/syn-tooltip/docs.md +73 -0
- package/package.json +4 -4
- package/metadata/packages/components/components/syn-checkbox/component.custom.styles.ts +0 -86
- package/metadata/packages/components/components/syn-combobox/component.custom.styles.ts +0 -122
- package/metadata/packages/components/components/syn-radio/component.custom.styles.ts +0 -86
- package/metadata/packages/components/components/syn-radio-group/component.custom.styles.ts +0 -25
- package/metadata/packages/components/components/syn-select/component.custom.styles.ts +0 -175
- package/metadata/packages/components/components/syn-switch/component.custom.styles.ts +0 -141
- package/metadata/packages/components/components/syn-textarea/component.custom.styles.ts +0 -48
|
@@ -2,165 +2,247 @@
|
|
|
2
2
|
import { css } from 'lit';
|
|
3
3
|
|
|
4
4
|
export default css`
|
|
5
|
-
|
|
5
|
+
/* stylelint-disable no-descending-specificity */
|
|
6
6
|
:host {
|
|
7
7
|
display: inline-block;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
:host([size='small']) {
|
|
11
|
-
--height: var(--syn-
|
|
12
|
-
--thumb-size:
|
|
13
|
-
--width:
|
|
11
|
+
--height: var(--syn-switch-height-small);
|
|
12
|
+
--thumb-size: var(--syn-toggle-size-small);
|
|
13
|
+
--width: var(--syn-switch-width-small);
|
|
14
14
|
|
|
15
15
|
font-size: var(--syn-input-font-size-small);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
:host([size='medium']) {
|
|
19
|
-
--height: var(--syn-
|
|
20
|
-
--thumb-size:
|
|
21
|
-
--width:
|
|
19
|
+
--height: var(--syn-switch-height-medium);
|
|
20
|
+
--thumb-size: var(--syn-toggle-size-medium);
|
|
21
|
+
--width: var(--syn-switch-width-medium);
|
|
22
22
|
|
|
23
23
|
font-size: var(--syn-input-font-size-medium);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
:host([size='large']) {
|
|
27
|
-
--height: var(--syn-
|
|
28
|
-
--thumb-size:
|
|
29
|
-
--width:
|
|
27
|
+
--height: var(--syn-switch-height-large);
|
|
28
|
+
--thumb-size: var(--syn-toggle-size-large);
|
|
29
|
+
--width: var(--syn-switch-width-large);
|
|
30
30
|
|
|
31
31
|
font-size: var(--syn-input-font-size-large);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
.switch {
|
|
35
|
-
position: relative;
|
|
36
|
-
display: inline-flex;
|
|
37
35
|
align-items: center;
|
|
36
|
+
color: var(--syn-input-label-color);
|
|
37
|
+
cursor: pointer;
|
|
38
|
+
display: inline-flex;
|
|
38
39
|
font-family: var(--syn-input-font-family);
|
|
39
40
|
font-size: inherit;
|
|
40
41
|
font-weight: var(--syn-input-font-weight);
|
|
41
|
-
|
|
42
|
+
position: relative;
|
|
42
43
|
vertical-align: middle;
|
|
43
|
-
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.switch.switch--small {
|
|
47
|
+
padding: var(--syn-spacing-2x-small) 0;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.switch.switch--medium {
|
|
51
|
+
padding: var(--syn-spacing-2x-small) 0;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.switch.switch--large {
|
|
55
|
+
padding: var(--syn-spacing-3x-small) 0;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* Hint: can be removed, if the padding stylings for sizes from above are removed */
|
|
59
|
+
.form-control--has-help-text .switch {
|
|
60
|
+
padding-bottom: 0;
|
|
44
61
|
}
|
|
45
62
|
|
|
46
63
|
.switch__control {
|
|
47
|
-
flex: 0 0 auto;
|
|
48
|
-
position: relative;
|
|
49
|
-
display: inline-flex;
|
|
50
64
|
align-items: center;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
height: var(--height);
|
|
54
|
-
background-color: var(--syn-color-neutral-400);
|
|
55
|
-
border: solid var(--syn-input-border-width) var(--syn-color-neutral-400);
|
|
65
|
+
background-color: var(--syn-input-icon-icon-clearable-color);
|
|
66
|
+
border: solid var(--syn-border-width-medium) var(--syn-input-icon-icon-clearable-color);
|
|
56
67
|
border-radius: var(--height);
|
|
68
|
+
display: inline-flex;
|
|
69
|
+
flex: 0 0 auto;
|
|
70
|
+
height: var(--height);
|
|
71
|
+
justify-content: center;
|
|
72
|
+
position: relative;
|
|
57
73
|
transition:
|
|
58
74
|
var(--syn-transition-fast) border-color,
|
|
59
75
|
var(--syn-transition-fast) background-color;
|
|
76
|
+
width: var(--width);
|
|
60
77
|
}
|
|
61
78
|
|
|
62
79
|
.switch__control .switch__thumb {
|
|
63
|
-
width: var(--thumb-size);
|
|
64
|
-
height: var(--thumb-size);
|
|
65
80
|
background-color: var(--syn-color-neutral-0);
|
|
81
|
+
border: none;
|
|
66
82
|
border-radius: 50%;
|
|
67
|
-
|
|
68
|
-
translate: calc((var(--width) - var(--height)) / -2);
|
|
83
|
+
height: var(--thumb-size);
|
|
69
84
|
transition:
|
|
70
85
|
var(--syn-transition-fast) translate ease,
|
|
71
86
|
var(--syn-transition-fast) background-color,
|
|
72
87
|
var(--syn-transition-fast) border-color,
|
|
73
88
|
var(--syn-transition-fast) box-shadow;
|
|
89
|
+
translate: calc((var(--width) - var(--height)) / -2);
|
|
90
|
+
width: var(--thumb-size);
|
|
74
91
|
}
|
|
75
92
|
|
|
76
93
|
.switch__input {
|
|
77
|
-
|
|
94
|
+
margin: 0;
|
|
78
95
|
opacity: 0;
|
|
79
96
|
padding: 0;
|
|
80
|
-
margin: 0;
|
|
81
97
|
pointer-events: none;
|
|
98
|
+
position: absolute;
|
|
82
99
|
}
|
|
83
100
|
|
|
84
101
|
/* Hover */
|
|
85
|
-
.switch:not(.switch--checked):not(.switch--disabled)
|
|
86
|
-
background-color: var(--syn-color-
|
|
87
|
-
border-color: var(--syn-color-
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
.switch:not(.switch--checked):not(.switch--disabled) .switch__control:hover .switch__thumb {
|
|
91
|
-
background-color: var(--syn-color-neutral-0);
|
|
92
|
-
border-color: var(--syn-color-neutral-400);
|
|
102
|
+
.switch:not(.switch--checked):not(.switch--disabled):not(.switch--readonly):hover .switch__control {
|
|
103
|
+
background-color: var(--syn-input-icon-icon-clearable-color-hover);
|
|
104
|
+
border-color: var(--syn-input-icon-icon-clearable-color-hover);
|
|
93
105
|
}
|
|
94
106
|
|
|
95
107
|
/* Focus */
|
|
96
|
-
.switch:not(.switch--checked):not(.switch--disabled) .switch__input:focus-visible ~ .switch__control {
|
|
97
|
-
background-color: var(--syn-
|
|
98
|
-
border-color: var(--syn-
|
|
108
|
+
.switch:not(.switch--checked):not(.switch--disabled):not(.switch--readonly) .switch__input:focus-visible ~ .switch__control {
|
|
109
|
+
background-color: var(--syn-input-icon-icon-clearable-color);
|
|
110
|
+
border-color: var(--syn-input-icon-icon-clearable-color);
|
|
111
|
+
outline: var(--syn-focus-ring);
|
|
112
|
+
outline-offset: var(--syn-focus-ring-offset);
|
|
99
113
|
}
|
|
100
114
|
|
|
101
|
-
.switch:not(.switch--checked):not(.switch--disabled) .switch__input:focus-visible ~ .switch__control .switch__thumb {
|
|
115
|
+
.switch:not(.switch--checked):not(.switch--disabled):not(.switch--readonly) .switch__input:focus-visible ~ .switch__control .switch__thumb {
|
|
102
116
|
background-color: var(--syn-color-neutral-0);
|
|
103
|
-
|
|
104
|
-
outline: var(--syn-focus-ring);
|
|
105
|
-
outline-offset: var(--syn-focus-ring-offset);
|
|
117
|
+
outline: none;
|
|
106
118
|
}
|
|
107
119
|
|
|
108
120
|
/* Checked */
|
|
109
121
|
.switch--checked .switch__control {
|
|
110
|
-
background-color: var(--syn-
|
|
111
|
-
border-color: var(--syn-
|
|
122
|
+
background-color: var(--syn-interactive-emphasis-color);
|
|
123
|
+
border-color: var(--syn-interactive-emphasis-color);
|
|
112
124
|
}
|
|
113
125
|
|
|
114
126
|
.switch--checked .switch__control .switch__thumb {
|
|
115
127
|
background-color: var(--syn-color-neutral-0);
|
|
116
|
-
border-color: var(--syn-color-primary-600);
|
|
117
128
|
translate: calc((var(--width) - var(--height)) / 2);
|
|
118
129
|
}
|
|
119
130
|
|
|
120
131
|
/* Checked + hover */
|
|
121
|
-
.switch.switch--checked:not(.switch--disabled)
|
|
122
|
-
background-color: var(--syn-color-
|
|
123
|
-
border-color: var(--syn-color-
|
|
132
|
+
.switch.switch--checked:not(.switch--disabled):not(.switch--readonly):hover .switch__control {
|
|
133
|
+
background-color: var(--syn-interactive-emphasis-color-hover);
|
|
134
|
+
border-color: var(--syn-interactive-emphasis-color-hover);
|
|
124
135
|
}
|
|
125
136
|
|
|
126
|
-
.switch.switch--checked:not(.switch--disabled)
|
|
137
|
+
.switch.switch--checked:not(.switch--disabled):not(.switch--readonly):hover .switch__control .switch__thumb {
|
|
127
138
|
background-color: var(--syn-color-neutral-0);
|
|
128
|
-
border-color: var(--syn-color-primary-600);
|
|
129
139
|
}
|
|
130
140
|
|
|
131
141
|
/* Checked + focus */
|
|
132
|
-
.switch.switch--checked:not(.switch--disabled) .switch__input:focus-visible ~ .switch__control {
|
|
133
|
-
background-color: var(--syn-
|
|
134
|
-
border-color: var(--syn-
|
|
142
|
+
.switch.switch--checked:not(.switch--disabled):not(.switch--readonly) .switch__input:focus-visible ~ .switch__control {
|
|
143
|
+
background-color: var(--syn-interactive-emphasis-color);
|
|
144
|
+
border-color: var(--syn-interactive-emphasis-color);
|
|
145
|
+
outline: var(--syn-focus-ring);
|
|
146
|
+
outline-offset: var(--syn-focus-ring-offset);
|
|
135
147
|
}
|
|
136
148
|
|
|
137
|
-
.switch.switch--checked:not(.switch--disabled) .switch__input:focus-visible ~ .switch__control .switch__thumb {
|
|
149
|
+
.switch.switch--checked:not(.switch--disabled):not(.switch--readonly) .switch__input:focus-visible ~ .switch__control .switch__thumb {
|
|
138
150
|
background-color: var(--syn-color-neutral-0);
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
151
|
+
outline: none;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/*
|
|
155
|
+
* #443: Add active styles
|
|
156
|
+
* The checked and unchecked states have different active colors
|
|
157
|
+
* Note the fallback is defined to match the hover color.
|
|
158
|
+
* This is done to make sure no active state is shown at all if no active color is defined.
|
|
159
|
+
* Still better than showing one for the unchecked state but not for the checked state.
|
|
160
|
+
*/
|
|
161
|
+
.switch:not(.switch--checked):not(.switch--disabled):not(.switch--readonly):active .switch__control {
|
|
162
|
+
background: var(--syn-input-icon-icon-clearable-color-active);
|
|
163
|
+
border-color: var(--syn-input-icon-icon-clearable-color-active);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.switch.switch--checked:not(.switch--disabled):not(.switch--readonly):active .switch__control {
|
|
167
|
+
background: var(--syn-interactive-emphasis-color-active);
|
|
168
|
+
border-color: var(--syn-interactive-emphasis-color-active);
|
|
142
169
|
}
|
|
143
170
|
|
|
144
|
-
|
|
171
|
+
/** #429: Use token for opacity */
|
|
145
172
|
.switch--disabled {
|
|
146
|
-
opacity: 0.5;
|
|
147
173
|
cursor: not-allowed;
|
|
174
|
+
opacity: var(--syn-input-disabled-opacity);
|
|
148
175
|
}
|
|
149
176
|
|
|
150
177
|
.switch__label {
|
|
151
178
|
display: inline-block;
|
|
152
179
|
line-height: var(--height);
|
|
153
|
-
margin-inline-start:
|
|
180
|
+
margin-inline-start: var(--syn-spacing-x-small);
|
|
154
181
|
user-select: none;
|
|
155
|
-
-webkit-user-select: none;
|
|
156
182
|
}
|
|
157
183
|
|
|
158
184
|
:host([required]) .switch__label::after {
|
|
159
|
-
content: var(--syn-input-required-content);
|
|
160
185
|
color: var(--syn-input-required-content-color);
|
|
186
|
+
content: var(--syn-input-required-content);
|
|
161
187
|
margin-inline-start: var(--syn-input-required-content-offset);
|
|
162
188
|
}
|
|
163
189
|
|
|
190
|
+
:host([data-user-invalid]) .switch:not(.switch--checked):not(.switch--disabled):not(.switch--readonly) .switch__control {
|
|
191
|
+
background-color: var(--syn-input-border-color-focus-error);
|
|
192
|
+
border-color: var(--syn-input-border-color-focus-error);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
:host([data-user-invalid]) .switch:not(.switch--checked):not(.switch--disabled):not(.switch--readonly):hover .switch__control {
|
|
196
|
+
background-color: var(--syn-input-border-color-hover);
|
|
197
|
+
border-color: var(--syn-input-border-color-hover);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* #1178: Readonly state
|
|
202
|
+
*/
|
|
203
|
+
.switch.switch--readonly {
|
|
204
|
+
cursor: default;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.switch.switch--readonly .switch__label {
|
|
208
|
+
user-select: auto;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.switch.switch--readonly .switch__control {
|
|
212
|
+
background: var(--syn-readonly-background-color);
|
|
213
|
+
border-color: var(--syn-readonly-background-color);
|
|
214
|
+
cursor: default;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.switch.switch--readonly:hover .switch__control {
|
|
218
|
+
background: var(--syn-input-readonly-background-color-hover);
|
|
219
|
+
border-color: var(--syn-input-readonly-background-color-hover);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.switch.switch--readonly .switch__input:focus ~ .switch__control {
|
|
223
|
+
outline: var(--syn-focus-ring);
|
|
224
|
+
outline-offset: var(--syn-focus-ring-offset);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.switch.switch--readonly .switch__control .switch__thumb {
|
|
228
|
+
background: var(--syn-readonly-indicator-color);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/* Override base styles to remove outline from thumb for readonly switches */
|
|
232
|
+
.switch.switch--readonly .switch__input:focus-visible ~ .switch__control .switch__thumb {
|
|
233
|
+
outline: none;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.switch.switch--readonly.switch--checked .switch__input:focus-visible ~ .switch__control .switch__thumb {
|
|
237
|
+
outline: none !important;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/* Focus override */
|
|
241
|
+
.switch.switch--readonly .switch__input:focus-visible ~ .switch__control {
|
|
242
|
+
background-color: var(--syn-readonly-background-color);
|
|
243
|
+
border-color: var(--syn-readonly-background-color);
|
|
244
|
+
}
|
|
245
|
+
|
|
164
246
|
@media (forced-colors: active) {
|
|
165
247
|
.switch.switch--checked:not(.switch--disabled) .switch__control:hover .switch__thumb,
|
|
166
248
|
.switch--checked .switch__control .switch__thumb {
|
|
@@ -10,10 +10,8 @@ import { property, query, state } from 'lit/decorators.js';
|
|
|
10
10
|
import { watch } from '../../internal/watch.js';
|
|
11
11
|
import componentStyles from '../../styles/component.styles.js';
|
|
12
12
|
import formControlStyles from '../../styles/form-control.styles.js';
|
|
13
|
-
import formControlCustomStyles from '../../styles/form-control.custom.styles.js';
|
|
14
13
|
import SynergyElement from '../../internal/synergy-element.js';
|
|
15
14
|
import styles from './switch.styles.js';
|
|
16
|
-
import customStyles from './switch.custom.styles.js';
|
|
17
15
|
import type { CSSResultGroup } from 'lit';
|
|
18
16
|
import type { SynergyFormControl } from '../../internal/synergy-element.js';
|
|
19
17
|
import { enableDefaultSettings } from '../../utilities/defaultSettings/decorator.js';
|
|
@@ -45,7 +43,7 @@ import { enableDefaultSettings } from '../../utilities/defaultSettings/decorator
|
|
|
45
43
|
*/
|
|
46
44
|
@enableDefaultSettings('SynSwitch')
|
|
47
45
|
export default class SynSwitch extends SynergyElement implements SynergyFormControl {
|
|
48
|
-
static styles: CSSResultGroup = [componentStyles, formControlStyles, styles
|
|
46
|
+
static styles: CSSResultGroup = [componentStyles, formControlStyles, styles];
|
|
49
47
|
|
|
50
48
|
private readonly formControlController = new FormControlController(this, {
|
|
51
49
|
value: (control: SynSwitch) => (control.checked ? control.value || 'on' : undefined),
|
|
@@ -71,6 +69,9 @@ export default class SynSwitch extends SynergyElement implements SynergyFormCont
|
|
|
71
69
|
/** Disables the switch. */
|
|
72
70
|
@property({ type: Boolean, reflect: true }) disabled = false;
|
|
73
71
|
|
|
72
|
+
/** Sets the switch to a readonly state. */
|
|
73
|
+
@property({ type: Boolean, reflect: true }) readonly = false;
|
|
74
|
+
|
|
74
75
|
/** Draws the switch in a checked state. */
|
|
75
76
|
@property({ type: Boolean, reflect: true }) checked = false;
|
|
76
77
|
|
|
@@ -118,7 +119,12 @@ export default class SynSwitch extends SynergyElement implements SynergyFormCont
|
|
|
118
119
|
this.formControlController.emitInvalidEvent(event);
|
|
119
120
|
}
|
|
120
121
|
|
|
121
|
-
private handleClick() {
|
|
122
|
+
private handleClick(e: MouseEvent) {
|
|
123
|
+
if (this.readonly) {
|
|
124
|
+
e.preventDefault();
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
|
|
122
128
|
this.checked = !this.checked;
|
|
123
129
|
this.emit('syn-change');
|
|
124
130
|
}
|
|
@@ -129,6 +135,10 @@ export default class SynSwitch extends SynergyElement implements SynergyFormCont
|
|
|
129
135
|
}
|
|
130
136
|
|
|
131
137
|
private handleKeyDown(event: KeyboardEvent) {
|
|
138
|
+
if (this.readonly) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
|
|
132
142
|
if (event.key === 'ArrowLeft') {
|
|
133
143
|
event.preventDefault();
|
|
134
144
|
this.checked = false;
|
|
@@ -212,6 +222,7 @@ export default class SynSwitch extends SynergyElement implements SynergyFormCont
|
|
|
212
222
|
switch: true,
|
|
213
223
|
'switch--checked': this.checked,
|
|
214
224
|
'switch--disabled': this.disabled,
|
|
225
|
+
'switch--readonly': this.readonly,
|
|
215
226
|
'switch--focused': this.hasFocus,
|
|
216
227
|
'switch--small': this.size === 'small',
|
|
217
228
|
'switch--medium': this.size === 'medium',
|
|
@@ -226,6 +237,7 @@ export default class SynSwitch extends SynergyElement implements SynergyFormCont
|
|
|
226
237
|
value=${ifDefined(this.value)}
|
|
227
238
|
.checked=${live(this.checked)}
|
|
228
239
|
.disabled=${this.disabled}
|
|
240
|
+
.readOnly=${this.readonly}
|
|
229
241
|
.required=${this.required}
|
|
230
242
|
role="switch"
|
|
231
243
|
aria-checked=${this.checked ? 'true' : 'false'}
|
|
@@ -1,28 +1,29 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
1
|
import { css } from 'lit';
|
|
3
2
|
|
|
4
3
|
export default css`
|
|
5
|
-
|
|
4
|
+
/* stylelint-disable no-descending-specificity */
|
|
5
|
+
/* stylelint-disable plugin/no-unsupported-browser-features */
|
|
6
|
+
/* stylelint-disable property-no-vendor-prefix */
|
|
6
7
|
:host {
|
|
7
8
|
display: block;
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
.textarea {
|
|
11
|
-
display: grid;
|
|
12
12
|
align-items: center;
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
cursor: text;
|
|
14
|
+
display: grid;
|
|
15
15
|
font-family: var(--syn-input-font-family);
|
|
16
16
|
font-weight: var(--syn-input-font-weight);
|
|
17
|
-
line-height: var(--syn-line-height-normal);
|
|
18
17
|
letter-spacing: var(--syn-input-letter-spacing);
|
|
19
|
-
|
|
18
|
+
line-height: var(--syn-line-height-normal);
|
|
19
|
+
position: relative;
|
|
20
20
|
transition:
|
|
21
21
|
var(--syn-transition-fast) color,
|
|
22
22
|
var(--syn-transition-fast) border,
|
|
23
23
|
var(--syn-transition-fast) box-shadow,
|
|
24
24
|
var(--syn-transition-fast) background-color;
|
|
25
|
-
|
|
25
|
+
vertical-align: middle;
|
|
26
|
+
width: 100%;
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
/* Standard textareas */
|
|
@@ -35,6 +36,7 @@ export default css`
|
|
|
35
36
|
background-color: var(--syn-input-background-color-hover);
|
|
36
37
|
border-color: var(--syn-input-border-color-hover);
|
|
37
38
|
}
|
|
39
|
+
|
|
38
40
|
.textarea--standard:hover:not(.textarea--disabled) .textarea__control {
|
|
39
41
|
color: var(--syn-input-color-hover);
|
|
40
42
|
}
|
|
@@ -42,8 +44,8 @@ export default css`
|
|
|
42
44
|
.textarea--standard.textarea--focused:not(.textarea--disabled) {
|
|
43
45
|
background-color: var(--syn-input-background-color-focus);
|
|
44
46
|
border-color: var(--syn-input-border-color-focus);
|
|
45
|
-
color: var(--syn-input-color-focus);
|
|
46
47
|
box-shadow: 0 0 0 var(--syn-focus-ring-width) var(--syn-input-focus-ring-color);
|
|
48
|
+
color: var(--syn-input-color-focus);
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
.textarea--standard.textarea--focused:not(.textarea--disabled) .textarea__control {
|
|
@@ -53,8 +55,8 @@ export default css`
|
|
|
53
55
|
.textarea--standard.textarea--disabled {
|
|
54
56
|
background-color: var(--syn-input-background-color-disabled);
|
|
55
57
|
border-color: var(--syn-input-border-color-disabled);
|
|
56
|
-
opacity: 0.5;
|
|
57
58
|
cursor: not-allowed;
|
|
59
|
+
opacity: var(--syn-input-disabled-opacity); /* #429: Use token for opacity */
|
|
58
60
|
}
|
|
59
61
|
|
|
60
62
|
.textarea__control,
|
|
@@ -63,9 +65,9 @@ export default css`
|
|
|
63
65
|
}
|
|
64
66
|
|
|
65
67
|
.textarea__size-adjuster {
|
|
66
|
-
visibility: hidden;
|
|
67
|
-
pointer-events: none;
|
|
68
68
|
opacity: 0;
|
|
69
|
+
pointer-events: none;
|
|
70
|
+
visibility: hidden;
|
|
69
71
|
}
|
|
70
72
|
|
|
71
73
|
.textarea--standard.textarea--disabled .textarea__control {
|
|
@@ -78,8 +80,8 @@ export default css`
|
|
|
78
80
|
|
|
79
81
|
/* Readonly textareas */
|
|
80
82
|
.textarea--readonly {
|
|
81
|
-
border: none;
|
|
82
83
|
background-color: var(--syn-input-readonly-background-color);
|
|
84
|
+
border: none;
|
|
83
85
|
color: var(--syn-input-color);
|
|
84
86
|
}
|
|
85
87
|
|
|
@@ -95,21 +97,29 @@ export default css`
|
|
|
95
97
|
|
|
96
98
|
.textarea--readonly.textarea--disabled {
|
|
97
99
|
background-color: var(--syn-input-readonly-background-color-disabled);
|
|
98
|
-
opacity: 0.5;
|
|
99
100
|
cursor: not-allowed;
|
|
101
|
+
opacity: var(--syn-input-disabled-opacity);
|
|
100
102
|
}
|
|
101
103
|
|
|
102
104
|
.textarea__control {
|
|
105
|
+
-webkit-appearance: none;
|
|
106
|
+
appearance: none;
|
|
107
|
+
background: none;
|
|
108
|
+
border: none;
|
|
109
|
+
box-shadow: none;
|
|
110
|
+
color: var(--syn-input-color);
|
|
111
|
+
cursor: inherit;
|
|
103
112
|
font-family: inherit;
|
|
104
113
|
font-size: inherit;
|
|
105
114
|
font-weight: inherit;
|
|
106
115
|
line-height: 1.4;
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
116
|
+
|
|
117
|
+
/*
|
|
118
|
+
Unfortunately we need to add a small margin to the textarea control. This is needed for the new sick 2025 theme,
|
|
119
|
+
as because of the big border-radius the resize icon will otherwise overlap with the border
|
|
120
|
+
This added margin needs to be subtracted from the padding of the textarea
|
|
121
|
+
*/
|
|
122
|
+
margin: var(--syn-spacing-3x-small);
|
|
113
123
|
}
|
|
114
124
|
|
|
115
125
|
.textarea__control::-webkit-search-decoration,
|
|
@@ -117,12 +127,13 @@ export default css`
|
|
|
117
127
|
.textarea__control::-webkit-search-results-button,
|
|
118
128
|
.textarea__control::-webkit-search-results-decoration {
|
|
119
129
|
-webkit-appearance: none;
|
|
130
|
+
appearance: none;
|
|
120
131
|
}
|
|
121
132
|
|
|
122
133
|
.textarea__control::placeholder {
|
|
123
134
|
color: var(--syn-input-placeholder-color);
|
|
124
|
-
user-select: none;
|
|
125
135
|
-webkit-user-select: none;
|
|
136
|
+
user-select: none;
|
|
126
137
|
}
|
|
127
138
|
|
|
128
139
|
.textarea__control:focus {
|
|
@@ -132,14 +143,17 @@ export default css`
|
|
|
132
143
|
/*
|
|
133
144
|
* Size modifiers
|
|
134
145
|
*/
|
|
135
|
-
|
|
136
146
|
.textarea--small {
|
|
137
147
|
border-radius: var(--syn-input-border-radius-small);
|
|
138
148
|
font-size: var(--syn-input-font-size-small);
|
|
139
149
|
}
|
|
140
150
|
|
|
141
151
|
.textarea--small .textarea__control {
|
|
142
|
-
|
|
152
|
+
/* TODO: Wait for Design response, how to handle this left / right spacing. Design has "--syn-input-spacing-medium" for all sizes,
|
|
153
|
+
but we have different (coming from shoelace) */
|
|
154
|
+
|
|
155
|
+
/* We need to subtract the added margin of the textarea control from the padding */
|
|
156
|
+
padding: calc(var(--syn-spacing-x-small) - var(--syn-spacing-3x-small)) calc(var(--syn-input-spacing-small) - var(--syn-spacing-3x-small));
|
|
143
157
|
}
|
|
144
158
|
|
|
145
159
|
.textarea--medium {
|
|
@@ -148,7 +162,8 @@ export default css`
|
|
|
148
162
|
}
|
|
149
163
|
|
|
150
164
|
.textarea--medium .textarea__control {
|
|
151
|
-
padding
|
|
165
|
+
/* We need to subtract the added margin of the textarea control from the padding */
|
|
166
|
+
padding: calc(var(--syn-spacing-x-small) - var(--syn-spacing-3x-small)) calc(var(--syn-input-spacing-medium) - var(--syn-spacing-3x-small));
|
|
152
167
|
}
|
|
153
168
|
|
|
154
169
|
.textarea--large {
|
|
@@ -157,13 +172,16 @@ export default css`
|
|
|
157
172
|
}
|
|
158
173
|
|
|
159
174
|
.textarea--large .textarea__control {
|
|
160
|
-
|
|
175
|
+
/* TODO: Wait for Design response, how to handle this left / right spacing. Design has "--syn-input-spacing-medium" for all sizes,
|
|
176
|
+
but we have different (coming from shoelace) */
|
|
177
|
+
|
|
178
|
+
/* We need to subtract the added margin of the textarea control from the padding */
|
|
179
|
+
padding: calc(var(--syn-spacing-x-small) - var(--syn-spacing-3x-small)) calc(var(--syn-input-spacing-large) - var(--syn-spacing-3x-small));
|
|
161
180
|
}
|
|
162
181
|
|
|
163
182
|
/*
|
|
164
183
|
* Resize types
|
|
165
184
|
*/
|
|
166
|
-
|
|
167
185
|
.textarea--resize-none .textarea__control {
|
|
168
186
|
resize: none;
|
|
169
187
|
}
|
|
@@ -174,7 +192,17 @@ export default css`
|
|
|
174
192
|
|
|
175
193
|
.textarea--resize-auto .textarea__control {
|
|
176
194
|
height: auto;
|
|
177
|
-
resize: none;
|
|
178
195
|
overflow-y: hidden;
|
|
196
|
+
resize: none;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/* Validation */
|
|
200
|
+
:host([data-user-invalid]) .textarea--standard {
|
|
201
|
+
border-color: var(--syn-input-border-color-focus-error);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
:host([data-user-invalid]) .textarea--standard.textarea--focused:not(.textarea--disabled) {
|
|
205
|
+
border-color: var(--syn-input-border-color-focus-error);
|
|
206
|
+
box-shadow: 0 0 0 var(--syn-focus-ring-width) var(--syn-input-focus-ring-error);
|
|
179
207
|
}
|
|
180
208
|
`;
|
|
@@ -10,10 +10,8 @@ import { property, query, state } from 'lit/decorators.js';
|
|
|
10
10
|
import { watch } from '../../internal/watch.js';
|
|
11
11
|
import componentStyles from '../../styles/component.styles.js';
|
|
12
12
|
import formControlStyles from '../../styles/form-control.styles.js';
|
|
13
|
-
import formControlCustomStyles from '../../styles/form-control.custom.styles.js';
|
|
14
13
|
import SynergyElement from '../../internal/synergy-element.js';
|
|
15
14
|
import styles from './textarea.styles.js';
|
|
16
|
-
import customStyles from './textarea.custom.styles.js';
|
|
17
15
|
import type { CSSResultGroup } from 'lit';
|
|
18
16
|
import type { SynergyFormControl } from '../../internal/synergy-element.js';
|
|
19
17
|
import { enableDefaultSettings } from '../../utilities/defaultSettings/decorator.js';
|
|
@@ -42,7 +40,7 @@ import { enableDefaultSettings } from '../../utilities/defaultSettings/decorator
|
|
|
42
40
|
*/
|
|
43
41
|
@enableDefaultSettings('SynTextarea')
|
|
44
42
|
export default class SynTextarea extends SynergyElement implements SynergyFormControl {
|
|
45
|
-
static styles: CSSResultGroup = [componentStyles, formControlStyles, styles
|
|
43
|
+
static styles: CSSResultGroup = [componentStyles, formControlStyles, styles];
|
|
46
44
|
|
|
47
45
|
private readonly formControlController = new FormControlController(this, {
|
|
48
46
|
assumeInteractionOn: ['syn-blur', 'syn-input']
|
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#1189](https://github.com/synergy-design-system/synergy-design-system/pull/1189) [`a4f49ac`](https://github.com/synergy-design-system/synergy-design-system/commit/a4f49ac79a660ef5b8d1b380fe9fcd2159dc9b78) Thanks [@schilchSICKAG](https://github.com/schilchSICKAG)! - Released on: 2026-02-26
|
|
8
|
+
|
|
9
|
+
feat: ✨ Added readonly for various form fields (#1171, #1172, #1173, #1174, #1175, #1176, #1177, #1178)
|
|
10
|
+
|
|
11
|
+
Applies to:
|
|
12
|
+
- `<syn-checkbox>`
|
|
13
|
+
- `<syn-combobox>`
|
|
14
|
+
- `<syn-file>`
|
|
15
|
+
- `<syn-radio>`
|
|
16
|
+
- `<syn-radio-group>`
|
|
17
|
+
- `<syn-range>`
|
|
18
|
+
- `<syn-select>`
|
|
19
|
+
- `<syn-switch>`
|
|
20
|
+
|
|
21
|
+
Form elements now support being displayed as `readonly` fields.
|
|
22
|
+
|
|
23
|
+
Field marked `readonly` may receive focus, but their value cannot be changed by customer inputs.
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- Updated dependencies [[`a4f49ac`](https://github.com/synergy-design-system/synergy-design-system/commit/a4f49ac79a660ef5b8d1b380fe9fcd2159dc9b78)]:
|
|
28
|
+
- @synergy-design-system/tokens@3.5.0
|
|
29
|
+
|
|
3
30
|
## 3.4.1
|
|
4
31
|
|
|
5
32
|
### Patch Changes
|
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#1189](https://github.com/synergy-design-system/synergy-design-system/pull/1189) [`a4f49ac`](https://github.com/synergy-design-system/synergy-design-system/commit/a4f49ac79a660ef5b8d1b380fe9fcd2159dc9b78) Thanks [@schilchSICKAG](https://github.com/schilchSICKAG)! - Released on: 2026-02-26
|
|
8
|
+
|
|
9
|
+
feat: ✨ Added readonly for various form fields (#1171, #1172, #1173, #1174, #1175, #1176, #1177, #1178)
|
|
10
|
+
|
|
11
|
+
Applies to:
|
|
12
|
+
- `<syn-checkbox>`
|
|
13
|
+
- `<syn-combobox>`
|
|
14
|
+
- `<syn-file>`
|
|
15
|
+
- `<syn-radio>`
|
|
16
|
+
- `<syn-radio-group>`
|
|
17
|
+
- `<syn-range>`
|
|
18
|
+
- `<syn-select>`
|
|
19
|
+
- `<syn-switch>`
|
|
20
|
+
|
|
21
|
+
Form elements now support being displayed as `readonly` fields.
|
|
22
|
+
|
|
23
|
+
Field marked `readonly` may receive focus, but their value cannot be changed by customer inputs.
|
|
24
|
+
|
|
3
25
|
## 3.4.1
|
|
4
26
|
|
|
5
27
|
## 3.4.0
|