@swisspost/design-system-styles 6.3.0 → 6.4.1

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 (54) hide show
  1. package/_svg-icon-map.scss +25 -1
  2. package/basics.css +1 -3
  3. package/components/_index.scss +2 -1
  4. package/components/alert.scss +3 -7
  5. package/components/card.scss +3 -18
  6. package/components/choice-control-card.scss +146 -0
  7. package/components/datatable.scss +6 -9
  8. package/components/datepicker.scss +42 -4
  9. package/components/dropdown.scss +18 -30
  10. package/components/floating-label.scss +6 -5
  11. package/components/form-check.scss +94 -177
  12. package/components/form-select.scss +1 -1
  13. package/components/form-validation.scss +116 -0
  14. package/components/forms.scss +4 -2
  15. package/components/intranet-header/_logo.scss +1 -4
  16. package/components/intranet-header/_nav-overflow.scss +9 -4
  17. package/components/pagination.scss +22 -19
  18. package/components/product-card.scss +6 -1
  19. package/components/stepper.scss +73 -42
  20. package/components/subnavigation.scss +3 -4
  21. package/components/tabs/_tab-title.scss +152 -0
  22. package/components/tabs/_tabs-wrapper.scss +69 -0
  23. package/components/tabs/index.scss +2 -0
  24. package/components/timepicker.scss +1 -5
  25. package/components/toast.scss +6 -2
  26. package/components/topic-teaser.scss +24 -14
  27. package/functions/_icons.scss +10 -0
  28. package/index.css +4 -10
  29. package/intranet.css +4 -10
  30. package/mixins/_animation.scss +1 -0
  31. package/mixins/_button.scss +2 -1
  32. package/mixins/_color.scss +7 -2
  33. package/mixins/_forms.scss +4 -71
  34. package/mixins/_notification.scss +48 -19
  35. package/package.json +15 -14
  36. package/placeholders/_dropdown.scss +0 -3
  37. package/placeholders/_index.scss +0 -1
  38. package/placeholders/_text.scss +4 -4
  39. package/themes/bootstrap/_core.scss +2 -0
  40. package/themes/bootstrap/_overrides-mixins.scss +33 -0
  41. package/themes/bootstrap/_overrides-variables.scss +1 -2
  42. package/variables/_type.scss +1 -0
  43. package/variables/components/_datatable.scss +6 -10
  44. package/variables/components/_form-check.scss +48 -11
  45. package/variables/components/{_form-feedback.scss → _form-validation.scss} +15 -11
  46. package/variables/components/_forms.scss +2 -2
  47. package/variables/components/_index.scss +1 -2
  48. package/variables/components/_notification.scss +4 -1
  49. package/variables/components/_stepper.scss +8 -7
  50. package/variables/components/_topic-teaser.scss +5 -0
  51. package/components/form-feedback.scss +0 -44
  52. package/components/tabs.scss +0 -214
  53. package/placeholders/_notification.scss +0 -13
  54. package/variables/components/_form-switch.scss +0 -38
@@ -1,4 +1,5 @@
1
1
  @use './../mixins/size' as size-mx;
2
+ @use './../mixins/icons' as icons-mx;
2
3
  @use './../mixins/utilities';
3
4
 
4
5
  @use './../variables/spacing';
@@ -35,63 +36,28 @@
35
36
 
36
37
  .stepper-item {
37
38
  counter-increment: step-index;
39
+ position: relative;
38
40
  display: flex;
39
41
  flex-direction: column;
40
-
41
- &:first-child {
42
- justify-self: start;
43
- align-items: start;
44
- transform: translateX(#{-0.5 * stepper.$stepper-indicator-height});
45
- }
46
-
47
- &:last-child {
48
- justify-self: end;
49
- align-items: end;
50
- text-align: right;
51
- margin-right: -0.5 * stepper.$stepper-indicator-height;
52
- }
53
-
54
- &:not(:first-child):not(:last-child) {
55
- grid-column-end: span 2;
56
- align-items: center;
57
- }
58
-
59
- &[aria-current] {
60
- pointer-events: none;
61
- }
42
+ transition: color 250ms;
62
43
 
63
44
  // Stepper indicator styles
64
45
  &::before {
65
46
  content: '';
66
47
  pointer-events: none;
67
- text-align: center;
48
+ display: flex;
49
+ align-items: center;
50
+ justify-content: center;
68
51
  height: stepper.$stepper-indicator-height;
69
52
  width: stepper.$stepper-indicator-height;
70
- line-height: stepper.$stepper-indicator-height - 2 * stepper.$stepper-indicator-border-width;
71
53
  margin-bottom: -1 * stepper.$stepper-indicator-height;
72
54
  color: stepper.$stepper-indicator-color;
73
55
  background-color: stepper.$stepper-indicator-bg;
74
- background-image: stepper.$stepper-indicator-check-icon;
75
- background-size: spacing.$size-large;
76
- background-position: center;
77
- background-repeat: no-repeat;
78
56
  border: stepper.$stepper-indicator-border-width solid stepper.$stepper-indicator-border-color;
79
57
  border-radius: 50%;
80
58
  font-size: stepper.$stepper-indicator-font-size;
81
59
  font-weight: stepper.$stepper-indicator-font-weight;
82
- transition: background 250ms, color 250ms;
83
- }
84
-
85
- &[aria-current]::before,
86
- &[aria-current] ~ &::before {
87
- background-image: none;
88
- content: counter(step-index);
89
- }
90
-
91
- &:hover::before {
92
- color: stepper.$stepper-indicator-hover-color;
93
- background-color: stepper.$stepper-indicator-hover-bg;
94
- background-image: stepper.$stepper-indicator-hover-check-icon;
60
+ transition: background 250ms;
95
61
  }
96
62
 
97
63
  &[aria-current] ~ ::before {
@@ -102,9 +68,75 @@
102
68
  &:is(:focus-visible, :focus-within)::before {
103
69
  outline: stepper.$stepper-indicator-hover-outline;
104
70
  }
71
+
72
+ // Check icon (for completed steps only)
73
+ &::after {
74
+ @include icons-mx.icon(2105);
75
+ content: '';
76
+ position: absolute;
77
+ display: block;
78
+ top: 0.5 * (stepper.$stepper-indicator-height - stepper.$stepper-indicator-check-icon-size);
79
+ height: stepper.$stepper-indicator-check-icon-size;
80
+ width: stepper.$stepper-indicator-check-icon-size;
81
+ }
82
+
83
+ &[aria-current],
84
+ &[aria-current] ~ & {
85
+ pointer-events: none;
86
+
87
+ &::before {
88
+ content: counter(step-index);
89
+ }
90
+
91
+ &::after {
92
+ content: unset;
93
+ }
94
+ }
95
+
96
+ // First stepper item - left aligned
97
+ &:first-child {
98
+ justify-self: start;
99
+ align-items: start;
100
+ transform: translateX(#{-0.5 * stepper.$stepper-indicator-height});
101
+
102
+ &::after {
103
+ left: 0.5 * (stepper.$stepper-indicator-height - stepper.$stepper-indicator-check-icon-size);
104
+ }
105
+ }
106
+
107
+ // Last stepper item - right aligned
108
+ &:last-child {
109
+ justify-self: end;
110
+ align-items: end;
111
+ text-align: right;
112
+ margin-right: -0.5 * stepper.$stepper-indicator-height;
113
+
114
+ &::after {
115
+ right: 0.5 * (stepper.$stepper-indicator-height - stepper.$stepper-indicator-check-icon-size);
116
+ }
117
+ }
118
+
119
+ // Other stepper items - centered
120
+ &:not(:first-child):not(:last-child) {
121
+ grid-column-end: span 2;
122
+ align-items: center;
123
+
124
+ &::after {
125
+ left: calc(50% - #{0.5 * stepper.$stepper-indicator-check-icon-size});
126
+ }
127
+ }
128
+
129
+ &:hover {
130
+ color: stepper.$stepper-indicator-hover-color;
131
+
132
+ &::before {
133
+ background-color: stepper.$stepper-indicator-hover-bg;
134
+ }
135
+ }
105
136
  }
106
137
 
107
138
  .stepper-link {
139
+ z-index: 1;
108
140
  padding-top: stepper.$stepper-indicator-height + stepper.$stepper-link-gap;
109
141
  text-decoration: none;
110
142
  color: stepper.$stepper-link-color;
@@ -155,7 +187,6 @@
155
187
  line-height: calc(#{stepper.$stepper-indicator-height} + 2 * #{spacing.$size-line});
156
188
  color: ButtonText;
157
189
  background-color: ButtonFace;
158
- background-image: stepper.$stepper-indicator-hover-check-icon;
159
190
  border: 0;
160
191
  outline: spacing.$size-line solid VisitedText;
161
192
  outline-offset: -3 * spacing.$size-line;
@@ -3,7 +3,6 @@
3
3
  @use './../lic/bootstrap-license';
4
4
  @use './../themes/bootstrap/core' as *;
5
5
 
6
- @use './../mixins';
7
6
  @use './../mixins/utilities';
8
7
  @use './../functions/utilities' as utility-functions;
9
8
  @use './../variables/components/subnavigation';
@@ -18,7 +17,7 @@ $module-name: 'subnavigation';
18
17
  background-color: subnavigation.$subnavigation-background-color;
19
18
 
20
19
  &::after {
21
- @include mixins.full-width-underscore(
20
+ @include utilities.full-width-underscore(
22
21
  subnavigation.$subnavigation-border-bottom-color,
23
22
  subnavigation.$subnavigation-border-bottom-width
24
23
  );
@@ -96,7 +95,7 @@ $module-name: 'subnavigation';
96
95
  }
97
96
 
98
97
  &:not(.active)::after {
99
- @include mixins.full-width-underscore(
98
+ @include utilities.full-width-underscore(
100
99
  #{subnavigation.$subnavigation-link-underscore-color-hover},
101
100
  #{subnavigation.$subnavigation-link-underscore-height}
102
101
  );
@@ -121,7 +120,7 @@ $module-name: 'subnavigation';
121
120
  font-weight: $font-weight-bold;
122
121
 
123
122
  &::after {
124
- @include mixins.full-width-underscore(
123
+ @include utilities.full-width-underscore(
125
124
  #{subnavigation.$subnavigation-link-underscore-color-active},
126
125
  #{subnavigation.$subnavigation-link-underscore-height}
127
126
  );
@@ -0,0 +1,152 @@
1
+ @forward './../../variables/options';
2
+
3
+ @use './../../mixins/color' as color-mx;
4
+ @use './../../mixins/utilities' as utilities-mx;
5
+ @use './../../variables/color';
6
+ @use './../../variables/spacing';
7
+ @use './../../variables/components/nav';
8
+
9
+ .tab-title {
10
+ display: inline-block;
11
+ position: relative;
12
+ box-sizing: border-box;
13
+ padding: nav.$nav-link-padding;
14
+ transition: background-color 100ms;
15
+ border-right: 1px solid transparent;
16
+ border-left: 1px solid transparent;
17
+ outline-color: currentColor;
18
+ opacity: 0.7;
19
+ color: var(--post-contrast-color);
20
+ text-decoration: none;
21
+
22
+ &:focus {
23
+ background-color: unset;
24
+ color: var(--post-contrast-color);
25
+ }
26
+
27
+ &:hover {
28
+ opacity: 1;
29
+ background-color: nav.$nav-tabs-link-active-bg;
30
+ color: var(--post-contrast-color);
31
+ }
32
+
33
+ // same styles as focus, can't use placeholder here because focus-visible can't be described outside of the support condition
34
+ &:focus-visible {
35
+ outline: transparent;
36
+ opacity: 1;
37
+ background-color: nav.$nav-tabs-link-active-bg;
38
+ color: var(--post-contrast-color);
39
+ box-shadow: none;
40
+
41
+ &::after {
42
+ content: '';
43
+ display: block;
44
+ position: absolute;
45
+ top: nav.$nav-tabs-focus-box-shadow-width;
46
+ right: nav.$nav-tabs-focus-box-shadow-width - 1px;
47
+ bottom: 0;
48
+ left: nav.$nav-tabs-focus-box-shadow-width - 1px;
49
+ box-shadow: nav.$nav-tabs-focus-box-shadow;
50
+ }
51
+ }
52
+
53
+ &.active {
54
+ z-index: 1; // Lift above the line and make focus visible all around
55
+ border-right-color: nav.$nav-tabs-border-color;
56
+ border-left-color: nav.$nav-tabs-border-color;
57
+ opacity: 1;
58
+ background-color: nav.$nav-tabs-link-active-bg;
59
+ color: var(--post-contrast-color);
60
+ font-weight: 700;
61
+
62
+ // Create a line that does not suffer from border corner mitering
63
+ &::before {
64
+ content: '';
65
+ display: block;
66
+ position: absolute;
67
+ top: 0;
68
+ right: -1px;
69
+ left: -1px;
70
+ height: spacing.$size-micro;
71
+ background-color: nav.$nav-tabs-link-active-border-color;
72
+ }
73
+ }
74
+
75
+ // Tabs with dark backgrounds
76
+ @include color-mx.on-dark-background() {
77
+ &:hover {
78
+ background-color: rgba(nav.$nav-tabs-link-active-bg, 0.2);
79
+ }
80
+
81
+ &:focus-visible {
82
+ background-color: rgba(nav.$nav-tabs-link-active-bg, 0.2);
83
+ }
84
+ }
85
+
86
+ @include utilities-mx.high-contrast-mode() {
87
+ opacity: 1;
88
+ border-left-color: Canvas;
89
+ border-right-color: Canvas;
90
+ color: LinkText;
91
+
92
+ &:hover,
93
+ &:focus,
94
+ &:focus-within,
95
+ &:focus-visible {
96
+ outline: spacing.$size-line solid Highlight;
97
+ outline-offset: -(spacing.$size-micro);
98
+ }
99
+
100
+ &.active {
101
+ border-left-color: ButtonText;
102
+ border-right-color: ButtonText;
103
+ color: Highlight;
104
+
105
+ &::before {
106
+ background-color: Highlight;
107
+ }
108
+ }
109
+ }
110
+ }
111
+
112
+ // Careful, this generates a lot of code
113
+ @each $key, $color in color.$background-colors {
114
+ .bg-#{$key} {
115
+ .tab-title {
116
+ background-color: $color;
117
+
118
+ &.active {
119
+ background-color: $color;
120
+ }
121
+ }
122
+
123
+ .nav-item {
124
+ background-color: $color;
125
+ }
126
+ }
127
+ }
128
+
129
+ [class*='bg-'] .tab-title.active {
130
+ &:focus {
131
+ &::after {
132
+ background-color: rgba(255, 255, 255, 0.2);
133
+ }
134
+ }
135
+
136
+ // write supports for selectors this way: https://stackoverflow.com/a/62666132
137
+ // need to include * otherwise it throws build error
138
+ @supports #{'\selector(*:focus-visible)'} {
139
+ &:focus {
140
+ &::after {
141
+ background-color: unset;
142
+ }
143
+ }
144
+
145
+ // same styles as focus, can't use placeholder here because focus-visible can't be described outside of the support condition
146
+ &:focus-visible {
147
+ &::after {
148
+ background-color: rgba(255, 255, 255, 0.2);
149
+ }
150
+ }
151
+ }
152
+ }
@@ -0,0 +1,69 @@
1
+ @forward './../../variables/options';
2
+
3
+ @use './../../mixins/utilities' as utilities-mx;
4
+ @use './../../variables/color';
5
+ @use './../../variables/spacing';
6
+ @use './../../variables/components/nav';
7
+
8
+ .tabs-wrapper {
9
+ position: relative;
10
+ padding-top: spacing.$spacer;
11
+ border: 0;
12
+ background-color: color.$gray-background-light;
13
+
14
+ // Create a line that lies below the active but above the passive elements
15
+ // This way hover works smoothly with the background color
16
+ &::after {
17
+ content: '';
18
+ position: absolute;
19
+ bottom: 0;
20
+ width: 100%;
21
+ height: 1px;
22
+ background-color: nav.$nav-tabs-border-color;
23
+ }
24
+
25
+ // Small hack to save a lot of code and provide a lot of flexibility to tabs coloring
26
+ .tabs {
27
+ background-color: transparent !important;
28
+ }
29
+
30
+ @include utilities-mx.high-contrast-mode() {
31
+ &::after {
32
+ background-color: ButtonBorder;
33
+ }
34
+ }
35
+ }
36
+
37
+ .tabs {
38
+ @include utilities-mx.reset-list;
39
+ display: flex;
40
+ flex-wrap: nowrap;
41
+ overflow-x: auto;
42
+
43
+ /* prevent scroll chaining on x scroll */
44
+ overscroll-behavior-x: contain;
45
+ white-space: nowrap;
46
+
47
+ // Scrolling fix to make the tabs scroll a little more so the right most tab is not
48
+ // flush with the window border
49
+ &::after {
50
+ content: '';
51
+ display: block;
52
+ flex: 1 0 auto;
53
+ width: nav.$nav-link-padding-x;
54
+ }
55
+ }
56
+
57
+ .tab-content {
58
+ padding-top: spacing.$spacer;
59
+ padding-bottom: spacing.$spacer;
60
+ }
61
+
62
+ // Careful, this generates a lot of code
63
+ @each $key, $color in color.$background-colors {
64
+ .bg-#{$key} {
65
+ .tabs-wrapper {
66
+ background-color: $color;
67
+ }
68
+ }
69
+ }
@@ -0,0 +1,2 @@
1
+ @use 'tabs-wrapper';
2
+ @use 'tab-title';
@@ -36,14 +36,10 @@
36
36
 
37
37
  .ngb-tp-chevron {
38
38
  &::before {
39
- @include icon-mixins.pi('2051');
39
+ @include icon-mixins.icon('2051');
40
40
  width: map.get(button.$btn-icon-size-map, 'md');
41
41
  height: map.get(button.$btn-icon-size-map, 'md');
42
42
  transform: none;
43
- border: 0;
44
- background-repeat: no-repeat;
45
- background-position: center center;
46
- background-size: contain;
47
43
  }
48
44
 
49
45
  &.bottom::before {
@@ -5,7 +5,6 @@
5
5
 
6
6
  @use './../mixins/notification' as notification-mx;
7
7
  @use './../placeholders/close' as close-ph;
8
- @use './../placeholders/notification' as notification-ph;
9
8
 
10
9
  @use './../variables/commons';
11
10
  @use './../variables/spacing';
@@ -13,12 +12,17 @@
13
12
 
14
13
  .toast {
15
14
  @include notification-mx.notification-size(toast);
15
+ @include notification-mx.notification-body(toast);
16
16
  @include notification-mx.notification-dismissible(toast, 'toast-close-button');
17
- @extend %notification-body;
18
17
  }
19
18
 
20
19
  .toast-close-button {
21
20
  @extend %btn-close;
21
+
22
+ // Hide ngx-toastr close-button and keep our. Only useful when toast is used programmatically with ngx-toastr.
23
+ > span {
24
+ display: none;
25
+ }
22
26
  }
23
27
 
24
28
  .toast-title {
@@ -4,13 +4,13 @@
4
4
 
5
5
  @use './../themes/bootstrap/core' as *;
6
6
 
7
- @use './../functions/icons';
8
7
  @use './../variables/color';
9
8
  @use './../variables/grid';
10
9
  @use './../variables/spacing';
11
10
  @use './../variables/type';
12
11
  @use './../variables/components/topic-teaser';
13
12
  @use './../mixins/size';
13
+ @use './../mixins/icons' as icons-mx;
14
14
 
15
15
  .topic-teaser {
16
16
  &[class*='bg-'] {
@@ -119,10 +119,14 @@
119
119
  @include make-col($size);
120
120
  }
121
121
  }
122
+ @each $breakpoint, $gap in topic-teaser.$content-gap {
123
+ @include media-breakpoint-up($breakpoint) {
124
+ gap: $gap;
125
+ }
126
+ }
122
127
 
123
128
  @include media-breakpoint-up(rg) {
124
129
  flex-direction: row;
125
- gap: var(--post-gutter-x);
126
130
  }
127
131
  }
128
132
 
@@ -160,27 +164,33 @@
160
164
  display: flex;
161
165
  align-items: center;
162
166
  justify-content: space-between;
163
- padding: 0.75rem 2rem 0.75rem 1rem;
164
- transition: opacity 200ms, background-position 200ms;
167
+ padding: spacing.$size-small-regular spacing.$size-regular;
168
+ transition: opacity 200ms;
165
169
  border: 0;
166
170
  border-top: 1px solid rgba(var(--post-contrast-color-rgb), 0.2);
167
- background-image: url(icons.get-colored-svg-url('2050', color.$white));
168
- background-repeat: no-repeat;
169
- background-position: right 0.75rem center;
170
- background-size: 1rem;
171
171
  text-decoration: none;
172
172
 
173
- &[href]:hover {
174
- background-position: right 0.5rem center;
173
+ &::after {
174
+ @include icons-mx.icon(2050);
175
+ content: '';
176
+ display: inline-block;
177
+ height: spacing.$size-regular;
178
+ width: spacing.$size-regular;
179
+ flex: 0 0 auto;
180
+ transform: translateX(#{spacing.$size-micro});
181
+ transition: transform 200ms;
182
+ }
183
+
184
+ &[href]:hover::after {
185
+ transform: translateX(#{spacing.$size-mini});
175
186
  }
176
187
 
177
188
  @include media-breakpoint-up(lg) {
178
- padding-top: 1.25rem;
179
- padding-bottom: 1.25rem;
189
+ padding-top: spacing.$size-small-large;
190
+ padding-bottom: spacing.$size-small-large;
180
191
  }
181
192
  }
182
193
 
183
194
  .topic-teaser.bg-light .link-list-item > a {
184
- border-top: 1px solid color.$gray-10;
185
- background-image: url(icons.get-colored-svg-url('2050', color.$gray-60));
195
+ border-top-color: color.$gray-10;
186
196
  }
@@ -1,10 +1,20 @@
1
1
  @use 'sass:map';
2
+ @use 'sass:meta';
2
3
 
3
4
  @use './color';
4
5
  @use './utilities';
5
6
  @use './../variables/icons';
6
7
 
7
8
  @function add-fill-color($svg, $color) {
9
+ @if (meta.type-of($color) == string) {
10
+ @return set-svg-properties(
11
+ $svg,
12
+ (
13
+ 'fill': $color,
14
+ )
15
+ );
16
+ }
17
+
8
18
  $opacity: alpha($color);
9
19
  $color: color.get-hex-string($color);
10
20
  $clean-color: utilities.replace('#{$color}', '#', '%23');