@swisspost/design-system-styles 7.0.0 → 7.2.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.
Files changed (43) hide show
  1. package/_svg-icon-map.scss +15 -1
  2. package/basics.css +1 -1
  3. package/components/_index.scss +2 -2
  4. package/components/button-group.scss +7 -20
  5. package/components/button.scss +74 -27
  6. package/components/card-control.scss +322 -0
  7. package/components/datepicker.scss +26 -22
  8. package/components/floating-label.scss +73 -10
  9. package/components/form-check.scss +1 -2
  10. package/components/form-range.scss +1 -13
  11. package/components/form-select.scss +0 -2
  12. package/components/form-textarea.scss +10 -5
  13. package/components/form-validation.scss +51 -26
  14. package/components/forms.scss +40 -2
  15. package/components/intranet-header/_language-chooser.scss +1 -4
  16. package/components/intranet-header/_top-navigation.scss +0 -23
  17. package/components/reboot.scss +3 -0
  18. package/components/sizing.scss +2 -2
  19. package/components/spinner.scss +6 -12
  20. package/components/stepper.scss +283 -138
  21. package/components/tabs/_tab-title.scss +1 -1
  22. package/components/topic-teaser.scss +1 -2
  23. package/components/utilities.scss +0 -2
  24. package/functions/_color.scss +1 -1
  25. package/functions/_list.scss +2 -1
  26. package/functions/_sizing.scss +2 -2
  27. package/functions/_utilities.scss +3 -3
  28. package/index.css +3 -3
  29. package/intranet.css +3 -3
  30. package/mixins/_animation.scss +3 -6
  31. package/mixins/_button.scss +1 -2
  32. package/mixins/_form-checks.scss +3 -12
  33. package/mixins/_forms.scss +1 -1
  34. package/mixins/_utilities.scss +10 -0
  35. package/package.json +15 -11
  36. package/variables/components/_accordion.scss +3 -6
  37. package/variables/components/_button.scss +4 -4
  38. package/variables/components/_close.scss +2 -4
  39. package/variables/components/_form-select.scss +10 -26
  40. package/variables/components/_form-validation.scss +10 -11
  41. package/variables/components/_forms.scss +27 -12
  42. package/variables/components/_stepper.scss +25 -14
  43. package/components/choice-control-card.scss +0 -148
@@ -9,9 +9,9 @@
9
9
  @use 'button';
10
10
  @use 'button-group';
11
11
  @use 'card';
12
- @use 'chip';
13
- @use 'choice-control-card';
12
+ @use 'card-control';
14
13
  @use 'carousel';
14
+ @use 'chip';
15
15
  @use 'close';
16
16
  @use 'elevation';
17
17
  @use 'error-container';
@@ -6,31 +6,21 @@
6
6
 
7
7
  @use './../mixins/utilities';
8
8
  @use './../variables/color';
9
+ @use './../variables/spacing';
9
10
  @use './../variables/components/button';
10
11
  @use './../variables/components/forms';
11
12
 
12
13
  .btn-group {
13
14
  max-width: 100%;
15
+ flex-wrap: wrap;
16
+ row-gap: spacing.$size-micro;
17
+ padding-inline-start: button.$btn-border-width;
14
18
 
15
19
  > .btn {
16
20
  white-space: normal;
17
21
  cursor: pointer;
18
-
19
- // added a transition delay on the "z-index" so the button only moves back after all other transitions
20
- z-index: 0;
21
- transition:
22
- z-index 0s ease (0.5 * button.$btn-transition-duration),
23
- button.$btn-transition;
24
-
25
- @include utilities.high-contrast-mode() {
26
- transition: none !important;
27
- }
28
- }
29
-
30
- > .btn:hover {
31
- // remove the transition delay on the "z-index" for all raised states so the button moves forward before other transitions
32
- z-index: 2 !important;
33
- transition: button.$btn-transition;
22
+ flex: 0 1 auto;
23
+ margin-inline-start: -1 * button.$btn-border-width;
34
24
  }
35
25
 
36
26
  > .btn-secondary {
@@ -52,8 +42,5 @@
52
42
  position: absolute;
53
43
  clip: rect(0, 0, 0, 0);
54
44
  pointer-events: none;
55
-
56
- &:is(:focus-visible, :focus-within, .pretend-focus) + .btn {
57
- outline: forms.$input-focus-outline-thickness solid var(--post-contrast-color);
58
- }
45
+ @include utilities.focus-style('+ .btn');
59
46
  }
@@ -9,7 +9,7 @@
9
9
  @use './../variables/type';
10
10
  @use './../variables/spacing';
11
11
  @use './../mixins/color' as color-mx;
12
- @use './../mixins/icons';
12
+ @use './../mixins/icons' as icon-mx;
13
13
  @use './../mixins/utilities';
14
14
  @use './../mixins/forms';
15
15
  @use './../mixins/button' as button-mx;
@@ -138,22 +138,48 @@
138
138
  }
139
139
 
140
140
  // Animated
141
+
142
+ .btn-animated,
143
+ .btn-animated-start {
144
+ &:not(.btn-link, .btn-tertiary) {
145
+ &::after {
146
+ @include icon-mx.icon(2111);
147
+ content: '';
148
+ display: block;
149
+ height: 2em;
150
+ width: 2em;
151
+ position: absolute;
152
+ transition:
153
+ opacity 250ms,
154
+ transform 250ms;
155
+ opacity: 0;
156
+ }
157
+
158
+ > span {
159
+ transition: transform 250ms;
160
+ }
161
+
162
+ @media (prefers-reduced-motion: no-preference) {
163
+ @include utilities.not-disabled-focus-hover() {
164
+ &::after {
165
+ transform: translateX(0);
166
+ opacity: 1;
167
+ }
168
+ }
169
+
170
+ > span {
171
+ // Initially transform to place text in the right rendering context for a smooth animation
172
+ transform: translateX(0);
173
+ }
174
+ }
175
+ }
176
+ }
177
+
141
178
  .btn-animated:not(.btn-link, .btn-tertiary) {
142
179
  &::after {
143
- content: '';
144
- position: absolute;
145
- right: button.$btn-padding-x-md - button.$btn-animation-distance-md;
146
- width: 0.625em;
147
- height: 0.625em;
148
- transform: rotateZ(315deg)
149
- translate(button.$btn-border-width * -1, button.$btn-border-width * -1);
150
- transform-origin: center center;
151
- transition:
152
- opacity 250ms,
153
- transform 250ms;
154
- border-right: button.$btn-border-width solid currentColor;
155
- border-bottom: button.$btn-border-width solid currentColor;
156
- opacity: 0;
180
+ right: button.$btn-padding-x-md - button.$btn-animation-distance-md -
181
+ (math.div(button.$btn-font-size-md * 2, 3));
182
+ transform: translateX(button.$btn-border-width * -1);
157
183
  }
158
184
 
159
185
  @each $size in button.$btn-non-default-sizes {
@@ -161,14 +187,11 @@
161
187
  right: map.get(button.$btn-padding-x-map, $size) - map.get(
162
188
  button.$btn-animation-distance-map,
163
189
  $size
164
- );
190
+ ) -
191
+ (math.div(map.get(button.$btn-font-size-map, $size) * 2, 3));
165
192
  }
166
193
  }
167
194
 
168
- > span {
169
- transition: transform 250ms;
170
- }
171
-
172
195
  // Only animate when user prefers to see animations
173
196
  @media (prefers-reduced-motion: no-preference) {
174
197
  @include utilities.not-disabled-focus-hover() {
@@ -181,16 +204,40 @@
181
204
  transform: translateX(map.get(button.$btn-animation-distance-map, $size) * -1);
182
205
  }
183
206
  }
207
+ }
208
+ }
209
+ }
184
210
 
185
- &::after {
186
- transform: rotateZ(315deg) translate(0, 0);
187
- opacity: 1;
188
- }
211
+ .btn-animated-start:not(.btn-link, .btn-tertiary) {
212
+ &::after {
213
+ @include icon-mx.icon(2110);
214
+ left: button.$btn-padding-x-md - button.$btn-animation-distance-md -
215
+ (math.div(button.$btn-font-size-md * 2, 3));
216
+ transform: translateX(button.$btn-border-width);
217
+ }
218
+
219
+ @each $size in button.$btn-non-default-sizes {
220
+ &.btn-#{$size}::after {
221
+ left: map.get(button.$btn-padding-x-map, $size) - map.get(
222
+ button.$btn-animation-distance-map,
223
+ $size
224
+ ) -
225
+ (math.div(map.get(button.$btn-font-size-map, $size) * 2, 3));
189
226
  }
227
+ }
190
228
 
191
- > span {
192
- // Initially transform to place text in the right rendering context for a smooth animation
193
- transform: translateX(0);
229
+ // Only animate when user prefers to see animations
230
+ @media (prefers-reduced-motion: no-preference) {
231
+ @include utilities.not-disabled-focus-hover() {
232
+ > span {
233
+ transform: translateX(map.get(button.$btn-animation-distance-map, md));
234
+ }
235
+
236
+ @each $size in button.$btn-non-default-sizes {
237
+ &.btn-#{$size} > span {
238
+ transform: translateX(map.get(button.$btn-animation-distance-map, $size));
239
+ }
240
+ }
194
241
  }
195
242
  }
196
243
  }
@@ -0,0 +1,322 @@
1
+ @use '../variables/color';
2
+ @use '../variables/commons';
3
+ @use '../variables/spacing';
4
+ @use '../variables/components/forms';
5
+ @use '../variables/components/form-check';
6
+ @use '../mixins/utilities';
7
+
8
+ /*
9
+ * There are a whole bunch of !important statments in this file.
10
+ * They are necessary and should not be removed, because we need to override the .form-check styles here.
11
+ */
12
+
13
+ fieldset {
14
+ .radio-button-card,
15
+ .checkbox-button-card {
16
+ &:not(:last-child) {
17
+ margin-bottom: spacing.$size-regular;
18
+ }
19
+ }
20
+ }
21
+
22
+ .radio-button-card,
23
+ .checkbox-button-card {
24
+ --post-card-control-border-color: #{color.$gray-60};
25
+ --post-card-control-bg: #{color.$white};
26
+ --post-card-control-color: #{color.$gray-80};
27
+ --post-card-control-input-border-color: #{color.$gray-80};
28
+ --post-card-control-input-bg: #{color.$white};
29
+
30
+ display: grid;
31
+ grid-template: 'input label icon' 'input content content' / min-content auto min-content;
32
+ gap: 0 spacing.$size-mini;
33
+ position: relative;
34
+ padding: spacing.$size-regular;
35
+ width: 100%;
36
+ background-color: var(--post-card-control-bg);
37
+ border: spacing.$size-line solid var(--post-card-control-border-color);
38
+ border-radius: commons.$border-radius;
39
+ color: var(--post-card-control-color);
40
+ cursor: pointer;
41
+
42
+ input.form-check-input[type] {
43
+ grid-area: input;
44
+ position: relative;
45
+ z-index: 2;
46
+ margin: spacing.$size-micro 0;
47
+ background-color: var(--post-card-control-input-bg) !important;
48
+ border-color: var(--post-card-control-input-border-color) !important;
49
+ color: var(--post-card-control-input-border-color) !important;
50
+ cursor: inherit;
51
+ transition: none;
52
+
53
+ &:focus,
54
+ &:focus-visible {
55
+ box-shadow: none;
56
+ }
57
+
58
+ ~ label.form-check-label {
59
+ color: inherit !important;
60
+ }
61
+ }
62
+
63
+ label.form-check-label {
64
+ grid-area: label;
65
+ margin: spacing.$size-micro 0;
66
+ padding: 0;
67
+ border-radius: inherit;
68
+ transition: none;
69
+
70
+ &::before {
71
+ display: block;
72
+ content: '';
73
+ position: absolute;
74
+ inset: spacing.$size-line * -1;
75
+ border-radius: inherit;
76
+ }
77
+
78
+ > * {
79
+ display: block;
80
+ // Lift content above the :before element to make it selectable
81
+ position: relative;
82
+ z-index: 2;
83
+ }
84
+
85
+ &:not(:has(+ post-icon)) {
86
+ grid-area: 1 / label / 1 / icon;
87
+ }
88
+ }
89
+
90
+ .card-control--content {
91
+ grid-area: content;
92
+ }
93
+
94
+ post-icon {
95
+ grid-area: icon;
96
+ width: spacing.$size-big;
97
+ height: spacing.$size-big;
98
+ pointer-events: none;
99
+ }
100
+
101
+ &:where(:not(:has(input:disabled)), :not(.disabled)) {
102
+ &:where(:has(input:checked), .checked) {
103
+ --post-card-control-border-color: #{color.$black};
104
+ --post-card-control-bg: #{color.$yellow};
105
+ }
106
+
107
+ &:where(:has(input:invalid), :has(input[aria-invalid]), :has(input.is-invalid), .is-invalid) {
108
+ --post-card-control-border-color: #{color.$error};
109
+ --post-card-control-color: #{color.$error};
110
+ --post-card-control-input-border-color: #{color.$error};
111
+ }
112
+
113
+ &:where(:hover) {
114
+ --post-card-control-border-color: #{color.$gray-80};
115
+ --post-card-control-bg: #{color.$gray-60};
116
+ --post-card-control-color: #{color.$white};
117
+ --post-card-control-input-border-color: #{color.$black};
118
+ }
119
+
120
+ input:focus-visible ~ label::before {
121
+ outline-offset: forms.$input-focus-outline-thickness;
122
+ outline: forms.$input-focus-outline-thickness solid commons.$outline-color;
123
+ }
124
+ }
125
+
126
+ &:where(:has(input:disabled), .disabled) {
127
+ --post-card-control-border-color: #{color.$gray-60};
128
+ --post-card-control-bg: transparent;
129
+ --post-card-control-color: #{color.$gray-60};
130
+ --post-card-control-input-border-color: #{color.$gray-60};
131
+ --post-card-control-input-bg: transparent;
132
+
133
+ border-style: dashed;
134
+ text-decoration: line-through;
135
+ cursor: default;
136
+
137
+ input.form-check-input[type] {
138
+ border: 0 none;
139
+ padding: form-check.$form-check-input-border-width;
140
+ }
141
+ }
142
+
143
+ @include utilities.high-contrast-mode() {
144
+ --post-card-control-border-color: FieldText;
145
+ --post-card-control-bg: Field;
146
+ --post-card-control-color: FieldText;
147
+ --post-card-control-input-border-color: FieldText;
148
+ --post-card-control-input-bg: Field;
149
+
150
+ outline: spacing.$size-line solid Field;
151
+ outline-offset: spacing.$size-line * -2;
152
+
153
+ input.form-check-input[type] {
154
+ outline: spacing.$size-line solid Field;
155
+ background-color: Field !important;
156
+
157
+ &::after {
158
+ border-color: Field !important;
159
+ }
160
+ }
161
+
162
+ label.form-check-label,
163
+ .card-control--content {
164
+ background-color: var(--post-card-control-bg) !important;
165
+ }
166
+
167
+ &:where(:not(:has(input:disabled)), :not(.disabled)) {
168
+ &:where(:has(input:checked), .checked) {
169
+ --post-card-control-border-color: FieldText;
170
+ --post-card-control-bg: SelectedItem;
171
+ --post-card-control-color: SelectedItemText;
172
+ --post-card-control-input-border-color: FieldText;
173
+
174
+ input.form-check-input[type] {
175
+ &::after {
176
+ background-color: FieldText !important;
177
+ }
178
+ }
179
+ }
180
+
181
+ &:where(:hover) {
182
+ --post-card-control-border-color: Highlight;
183
+ --post-card-control-bg: Field;
184
+ --post-card-control-color: FieldText;
185
+ --post-card-control-input-border-color: Highlight;
186
+ }
187
+ }
188
+
189
+ &:where(:has(input:disabled), .disabled) {
190
+ --post-card-control-border-color: GrayText;
191
+ --post-card-control-bg: Field;
192
+ --post-card-control-color: FieldText;
193
+ --post-card-control-input-border-color: GrayText;
194
+ --post-card-control-input-bg: Field;
195
+
196
+ &:where(:has(input:checked), .checked) {
197
+ --post-card-control-bg: SelectedItem;
198
+ --post-card-control-color: SelectedItemText;
199
+
200
+ position: relative;
201
+ background-color: Field;
202
+
203
+ &::before {
204
+ display: block;
205
+ content: '';
206
+ position: absolute;
207
+ inset: spacing.$size-line;
208
+ background-color: SelectedItem;
209
+ z-index: 1;
210
+ }
211
+
212
+ > * {
213
+ position: relative;
214
+ z-index: 2;
215
+ }
216
+
217
+ input.form-check-input[type] {
218
+ &::after {
219
+ background-color: FieldText !important;
220
+ }
221
+ }
222
+ }
223
+ }
224
+ }
225
+ }
226
+
227
+ @each $bg in color.$dark-backgrounds {
228
+ #{$bg} {
229
+ .radio-button-card,
230
+ .checkbox-button-card {
231
+ --post-card-control-border-color: #{color.$white};
232
+ --post-card-control-bg: transparent;
233
+ --post-card-control-color: #{color.$white};
234
+ --post-card-control-input-border-color: #{color.$white};
235
+ --post-card-control-input-bg: transparent;
236
+
237
+ &:where(:not(:has(input:disabled)), :not(.disabled)) {
238
+ &:where(:has(input:checked), .checked) {
239
+ --post-card-control-border-color: #{color.$yellow};
240
+ --post-card-control-bg: #{color.$yellow};
241
+ --post-card-control-color: #{color.$gray-80};
242
+ --post-card-control-input-border-color: #{color.$gray-80};
243
+ --post-card-control-input-bg: #{color.$white};
244
+ }
245
+
246
+ &:where(
247
+ :has(input:invalid),
248
+ :has(input[aria-invalid]),
249
+ :has(input.is-invalid),
250
+ .is-invalid
251
+ ) {
252
+ --post-card-control-border-color: #{color.$error};
253
+ --post-card-control-bg: #{color.$error-background};
254
+ --post-card-control-color: #{color.$error};
255
+ --post-card-control-input-border-color: #{color.$error};
256
+ --post-card-control-input-bg: #{color.$white};
257
+
258
+ &:where(:has(input:checked), .checked) {
259
+ --post-card-control-bg: #{color.$yellow};
260
+ }
261
+ }
262
+
263
+ &:where(:hover) {
264
+ --post-card-control-border-color: #{color.$black};
265
+ --post-card-control-bg: #{color.$gray-20};
266
+ --post-card-control-color: #{color.$black};
267
+ --post-card-control-input-border-color: #{color.$black};
268
+ --post-card-control-input-bg: #{color.$white};
269
+ }
270
+
271
+ input:focus-visible ~ label::before {
272
+ outline-color: color.$white;
273
+ }
274
+ }
275
+
276
+ &:where(:has(input:disabled), .disabled) {
277
+ --post-card-control-border-color: color.$white-alpha-80;
278
+ --post-card-control-bg: transparent;
279
+ --post-card-control-color: color.$white-alpha-80;
280
+ --post-card-control-input-border-color: color.$white-alpha-80;
281
+ --post-card-control-input-bg: transparent;
282
+ }
283
+
284
+ @include utilities.high-contrast-mode() {
285
+ --post-card-control-border-color: FieldText;
286
+ --post-card-control-bg: Field;
287
+ --post-card-control-color: FieldText;
288
+ --post-card-control-input-border-color: FieldText;
289
+ --post-card-control-input-bg: Field;
290
+
291
+ &:where(:not(:has(input:disabled)), :not(.disabled)) {
292
+ &:where(:has(input:checked), .checked) {
293
+ --post-card-control-border-color: FieldText;
294
+ --post-card-control-bg: SelectedItem;
295
+ --post-card-control-color: SelectedItemText;
296
+ --post-card-control-input-border-color: FieldText;
297
+ }
298
+
299
+ &:where(:hover) {
300
+ --post-card-control-border-color: Highlight;
301
+ --post-card-control-bg: Field;
302
+ --post-card-control-color: FieldText;
303
+ --post-card-control-input-border-color: Highlight;
304
+ }
305
+ }
306
+
307
+ &:where(:has(input:disabled), .disabled) {
308
+ --post-card-control-border-color: GrayText;
309
+ --post-card-control-bg: Field;
310
+ --post-card-control-color: FieldText;
311
+ --post-card-control-input-border-color: GrayText;
312
+ --post-card-control-input-bg: Field;
313
+
314
+ &:where(:has(input:checked), .checked) {
315
+ --post-card-control-bg: SelectedItem;
316
+ --post-card-control-color: SelectedItemText;
317
+ }
318
+ }
319
+ }
320
+ }
321
+ }
322
+ }
@@ -5,7 +5,9 @@
5
5
  @use './../variables/components/datepicker';
6
6
  @use './../variables/components/forms';
7
7
  @use './../variables/commons';
8
+ @use './../variables/spacing';
8
9
  @use './../mixins/icons' as icons-mx;
10
+ @use './../mixins/utilities';
9
11
 
10
12
  @use './../themes/bootstrap/core' as b;
11
13
 
@@ -20,6 +22,10 @@ ngb-datepicker.dropdown-menu {
20
22
 
21
23
  ngb-datepicker-navigation {
22
24
  justify-content: space-between;
25
+
26
+ button.ngb-dp-arrow-btn {
27
+ @include utilities.focus-style();
28
+ }
23
29
  }
24
30
 
25
31
  ngb-datepicker-navigation-select.ngb-dp-navigation-select {
@@ -30,12 +36,6 @@ ngb-datepicker-navigation-select.ngb-dp-navigation-select {
30
36
  border: 0;
31
37
  background-position: right;
32
38
 
33
- &:focus {
34
- border-radius: commons.$border-radius;
35
- background-color: transparent;
36
- box-shadow: inset 0 0 0 commons.$border-thick color.$black;
37
- }
38
-
39
39
  + select {
40
40
  margin-left: 0.5rem;
41
41
  }
@@ -94,12 +94,20 @@ span.ngb-dp-navigation-chevron {
94
94
  &.hidden {
95
95
  flex-grow: 1;
96
96
  }
97
- }
98
97
 
99
- .ngb-dp-day > .btn-light {
100
- width: 40px !important;
101
- height: 40px !important;
102
- line-height: 40px;
98
+ @include utilities.focus-style() {
99
+ border-radius: commons.$border-radius;
100
+ }
101
+
102
+ > [ngbDatepickerDayView] {
103
+ width: 40px !important;
104
+ height: 40px !important;
105
+ line-height: 40px;
106
+
107
+ &.active:not(.bg-primary) {
108
+ outline: none;
109
+ }
110
+ }
103
111
  }
104
112
 
105
113
  .ngb-dp-day > .text-white {
@@ -149,17 +157,9 @@ span.ngb-dp-navigation-chevron {
149
157
  height: datepicker.$ngb-dp-icon-size;
150
158
  transform: none;
151
159
  }
152
- }
153
160
 
154
- .form-control-sm ~ .ngb-dp-open {
155
- height: forms.$input-height-inner-sm;
156
- width: forms.$input-height-inner-sm;
157
-
158
- .pi-3203,
159
- .pi-calendar,
160
- post-icon {
161
- width: datepicker.$ngb-dp-icon-size-sm;
162
- height: datepicker.$ngb-dp-icon-size-sm;
161
+ @include utilities.focus-style() {
162
+ border-radius: commons.$border-radius;
163
163
  }
164
164
  }
165
165
 
@@ -170,7 +170,7 @@ span.ngb-dp-navigation-chevron {
170
170
 
171
171
  .form-floating > .ngb-dp-open,
172
172
  .form-control-lg ~ .ngb-dp-open {
173
- height: forms.$input-height-inner-lg;
173
+ height: calc(#{forms.$form-floating-height} - #{forms.$input-border-width * 2});
174
174
  width: forms.$input-height-inner-lg;
175
175
 
176
176
  .pi-3203,
@@ -181,6 +181,10 @@ span.ngb-dp-navigation-chevron {
181
181
  }
182
182
  }
183
183
 
184
+ .form-control-sm ~ .ngb-dp-open {
185
+ height: calc(#{forms.$form-floating-label-height-sm} - #{forms.$input-border-width * 2});
186
+ }
187
+
184
188
  input[ngbDatepicker] {
185
189
  // Hide the x on IE/Edge input fields
186
190
  &::-ms-clear {