@siemens/element-theme 49.7.0 → 49.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@siemens/element-theme",
3
- "version": "49.7.0",
3
+ "version": "49.8.0",
4
4
  "description": "Element CSS theme.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -358,7 +358,7 @@ $input-height: functions.add(
358
358
  functions.add($input-padding-y * 2, $input-height-border, false)
359
359
  ) !default;
360
360
 
361
- $input-height-inner: functions.subtract($input-height, $input-height-border, false) !default;
361
+ $input-height-inner: functions.subtract($input-height, $input-height-border) !default;
362
362
  // Wrap in parenthesis: `*` binds tighter than `-`, so without them only the border term gets multiplied.
363
363
  // DEPRECATED: Calculate it yourself using $input-height-inner
364
364
  $input-height-inner-half: calc((#{$input-height-inner}) * 0.5) !default;
@@ -389,7 +389,7 @@ $form-feedback-invalid-color: semantic-tokens.$element-text-danger !default;
389
389
  $form-feedback-icon-valid: semantic-tokens.$element-feedback-icon-valid;
390
390
  $form-feedback-icon-invalid: semantic-tokens.$element-feedback-icon-invalid;
391
391
  $form-feedback-icon-warning: semantic-tokens.$element-feedback-icon-warning;
392
-
392
+ $form-feedback-icon-size: 1.25rem;
393
393
  $form-validation-states: (
394
394
  'valid': (
395
395
  'color': null,
@@ -2,6 +2,7 @@
2
2
  @use '../../variables/semantic-tokens';
3
3
  @use '../../variables/spacers';
4
4
  @use '../../variables/utilities';
5
+ @use '../../variables/si-vars';
5
6
  @use '../variables';
6
7
 
7
8
  @use 'sass:map';
@@ -9,9 +10,13 @@
9
10
  :is(.form-control, .form-select) {
10
11
  --border-color: #{semantic-tokens.$element-ui-2};
11
12
  --si-textarea-mask: #{semantic-tokens.$element-base-1};
13
+ // Formula:
14
+ // (1.25rem / 0px) (feedback icon size)
15
+ // + (action-size / 0px) (action-offset includes a padding)
16
+ // + 3px (min padding between input and first action or validation icon)
12
17
  --si-input-padding-inline-end: calc(
13
- var(--si-feedback-icon-offset, 0px) + var(--si-action-icon-offset, 0px) +
14
- #{variables.$input-padding-x}
18
+ var(--si-feedback-icon-size, 0px) + var(--si-action-icon-offset, 0px) +
19
+ #{map.get(spacers.$spacers, 2) - variables.$input-border-width}
15
20
  );
16
21
  display: block;
17
22
  inline-size: 100%;
@@ -30,11 +35,20 @@
30
35
  appearance: none; // Fix appearance for date inputs in Safari
31
36
  background-image: var(--si-feedback-icon, none);
32
37
  background-repeat: no-repeat;
33
- background-size: 1.25rem;
34
- background-position: top 5px right calc(6px + var(--si-action-icon-offset, 0px));
38
+ background-size: variables.$form-feedback-icon-size;
39
+ background-position-y: top
40
+ calc((#{variables.$input-height-inner-half} - (#{variables.$form-feedback-icon-size} * 0.5)));
41
+ background-position-x: right
42
+ calc(
43
+ #{map.get(spacers.$spacers, 2) - variables.$input-border-width} +
44
+ var(--si-action-icon-offset, 0px)
45
+ );
35
46
 
36
47
  @include utilities.rtl {
37
- background-position: top 5px left 6px;
48
+ background-position-x: left
49
+ calc(
50
+ map.get(spacers.$spacers, 1) + var(--si-action-icon-offset, variables.$input-border-width)
51
+ );
38
52
  }
39
53
 
40
54
  &.hide-feedback-icon {
@@ -42,6 +56,14 @@
42
56
  padding-inline-end: variables.$input-padding-x;
43
57
  }
44
58
 
59
+ // When a `.form-control-actions` wrapper is inside the form-control, the
60
+ // wrapper itself reserves space for the validation icon, so the outer
61
+ // form-control must not add extra `padding-inline-end` for it.
62
+ &:has(.form-control-actions) {
63
+ background-image: none;
64
+ --si-input-padding-inline-end: #{map.get(spacers.$spacers, 2) - variables.$input-border-width};
65
+ }
66
+
45
67
  &:autofill {
46
68
  background: semantic-tokens.$element-base-information;
47
69
  }
@@ -101,6 +123,37 @@
101
123
  --input-addon-inset-end: #{map.get(spacers.$spacers, 9)};
102
124
  }
103
125
 
126
+ // Wrapper for trailing actions (buttons, icons, unit labels) inside
127
+ // or alongside a `.form-control`. Sizes itself to match the form-control
128
+ // height, provides consistent inline spacing between the input content,
129
+ // its children and the trailing edge, and reserves room for the validation
130
+ // icon.
131
+ // Paint the validation feedback icon on whichever element owns the trailing
132
+ // space for it: the `.form-control` itself by default, or a
133
+ // `.form-control-actions` wrapper when one is placed inside the form-control.
134
+ .form-control-actions {
135
+ display: inline-flex;
136
+ align-items: center;
137
+ block-size: variables.$input-height-inner;
138
+ padding-inline-start: map.get(spacers.$spacers, 1);
139
+ }
140
+
141
+ .form-control .form-control-actions::before {
142
+ box-sizing: content-box;
143
+ margin-block: auto;
144
+ inline-size: variables.$form-feedback-icon-size;
145
+ block-size: variables.$form-feedback-icon-size;
146
+ padding-inline-end: map.get(spacers.$spacers, 1);
147
+ content: var(--si-feedback-icon, none);
148
+ }
149
+
150
+ .form-control + .form-control-actions {
151
+ position: absolute;
152
+ inset-inline-end: map.get(spacers.$spacers, 2);
153
+ inset-block-start: variables.$input-border-width;
154
+ z-index: 2;
155
+ }
156
+
104
157
  textarea.form-control {
105
158
  min-block-size: variables.$input-height;
106
159
  padding-block: calc(variables.$input-padding-y - 3px);
@@ -119,26 +172,36 @@ select.form-control {
119
172
  }
120
173
 
121
174
  select:is(.form-control, .form-select):not([multiple]) {
175
+ --si-action-icon-offset: 1.25rem;
122
176
  padding-block: variables.$input-padding-y;
123
- padding-inline: map.get(spacers.$spacers, 4) map.get(spacers.$spacers, 8);
124
177
  appearance: none;
125
178
  background-image:
126
179
  var(--si-feedback-icon, none),
127
- url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'><path d='M352.79 203.21a12.45 12.45 0 011.44 15.86l-1.44 1.72-88 88a12.45 12.45 0 01-15.86 1.44l-1.72-1.44-88-88a12.43 12.43 0 0115.86-19l1.72 1.44L256 282.42l79.21-79.21a12.45 12.45 0 0115.86-1.44z'/></svg>");
180
+ url('data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%20512%20512%27%3E%3Cpath%20d%3D%27M256%20329.17c-4.3%200-8.42-1.73-11.43-4.8l-112-114.33c-6.18-6.31-6.08-16.44.23-22.63%206.31-6.18%2016.44-6.08%2022.63.23L256%20290.31l100.57-102.67c6.18-6.31%2016.31-6.42%2022.63-.23%206.31%206.18%206.42%2016.31.23%2022.63l-112%20114.33c-3.01%203.07-7.13%204.8-11.43%204.8%27%2F%3E%3C%2Fsvg%3E');
128
181
  background-repeat: no-repeat;
129
182
  background-position:
130
- right 20px center,
131
- right 2px top 50%;
132
- background-size: 1.25rem, 1.5rem;
183
+ // Formula:
184
+ // + spacer-2(between arrow and input)
185
+ // - border-width
186
+ // + size of dropdown arrow
187
+ // + spacer-1(between arrow and validation)
188
+ right
189
+ calc(
190
+ #{map.get(spacers.$spacers, 2) - variables.$input-border-width +
191
+ map.get(spacers.$spacers, 1)} + #{si-vars.$si-icon-font-size}
192
+ )
193
+ center,
194
+ right map.get(spacers.$spacers, 2) - variables.$input-border-width top 50%;
195
+ background-size: si-vars.$si-icon-font-size, variables.$form-feedback-icon-size;
133
196
 
134
197
  @include utilities.rtl {
135
- background-position: left map.get(spacers.$spacers, 2) top 50%;
198
+ background-position: left map.get(spacers.$spacers, 2) - variables.$input-border-width top 50%;
136
199
  }
137
200
 
138
201
  .app--dark & {
139
202
  background-image:
140
203
  var(--si-feedback-icon, none),
141
- url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'><path fill='white' d='M352.79 203.21a12.45 12.45 0 011.44 15.86l-1.44 1.72-88 88a12.45 12.45 0 01-15.86 1.44l-1.72-1.44-88-88a12.43 12.43 0 0115.86-19l1.72 1.44L256 282.42l79.21-79.21a12.45 12.45 0 0115.86-1.44z'/></svg>");
204
+ url('data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%20512%20512%27%3E%3Cpath%20fill%3D%27white%27%20d%3D%27M256%20329.17c-4.3%200-8.42-1.73-11.43-4.8l-112-114.33c-6.18-6.31-6.08-16.44.23-22.63%206.31-6.18%2016.44-6.08%2022.63.23L256%20290.31l100.57-102.67c6.18-6.31%2016.31-6.42%2022.63-.23%206.31%206.18%206.42%2016.31.23%2022.63l-112%20114.33c-3.01%203.07-7.13%204.8-11.43%204.8%27%2F%3E%3C%2Fsvg%3E');
142
205
  }
143
206
  }
144
207
 
@@ -1,7 +1,7 @@
1
1
  @use '../../variables/spacers';
2
2
  @use '../../variables/typography';
3
+ @use '../../variables/si-vars';
3
4
  @use '../variables';
4
-
5
5
  @use 'sass:map';
6
6
 
7
7
  // Override/enhance the form validation state mixin to also account for class
@@ -43,12 +43,14 @@
43
43
  @mixin form-validation-styles($state, $color, $icon) {
44
44
  @if ($state and $icon) {
45
45
  --si-feedback-icon: #{$icon};
46
+ // TODO: remove with v50
47
+ // DEPRECATED: use --si-feedback-icon-size instead
46
48
  --si-feedback-icon-offset: 1.5rem;
49
+ --si-feedback-icon-size: #{si-vars.$si-icon-font-size};
47
50
  }
48
51
 
49
52
  @if $color {
50
- &:not(.no-validation):not(:hover),
51
- &:not(.no-validation):focus {
53
+ &:not(.no-validation) {
52
54
  --border-color: #{$color};
53
55
  }
54
56
  }
@@ -5,10 +5,8 @@
5
5
  .pill {
6
6
  display: flex;
7
7
  align-items: center;
8
- block-size: 24px;
9
- border-radius: 12px;
10
- background: variables.$element-base-0;
11
- padding-block: map.get(variables.$spacers, 2);
8
+ border-radius: 0.75rem;
9
+ background: var(--filter-pill-background-color, variables.$element-base-0);
12
10
  padding-inline: map.get(variables.$spacers, 4);
13
11
  max-inline-size: 100%;
14
12
 
@@ -23,6 +21,10 @@
23
21
  background: variables.$element-action-secondary-hover;
24
22
  }
25
23
  }
24
+
25
+ :is(.name, .value) {
26
+ padding-block: map.get(variables.$spacers, 2);
27
+ }
26
28
  }
27
29
 
28
30
  .pill-group {
@@ -33,13 +35,13 @@
33
35
  border-radius: 0;
34
36
 
35
37
  &:first-child {
36
- border-start-start-radius: 12px;
37
- border-end-start-radius: 12px;
38
+ border-start-start-radius: 0.75rem;
39
+ border-end-start-radius: 0.75rem;
38
40
  }
39
41
 
40
42
  &:last-child {
41
- border-start-end-radius: 12px;
42
- border-end-end-radius: 12px;
43
+ border-start-end-radius: 0.75rem;
44
+ border-end-end-radius: 0.75rem;
43
45
  }
44
46
  }
45
47
  }