@swisspost/design-system-styles 6.2.5 → 6.3.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 (45) hide show
  1. package/_svg-icon-map.scss +8 -4
  2. package/basics.css +3 -1
  3. package/components/_index.scss +1 -0
  4. package/components/accordion.scss +70 -57
  5. package/components/alert.scss +84 -158
  6. package/components/badge.scss +0 -1
  7. package/components/button.scss +13 -18
  8. package/components/close.scss +12 -23
  9. package/components/form-textarea.scss +12 -0
  10. package/components/modal.scss +20 -12
  11. package/components/stepper.scss +3 -7
  12. package/components/toast.scss +65 -129
  13. package/components/type.scss +4 -0
  14. package/components/utilities.scss +2 -12
  15. package/functions/_icons.scss +6 -2
  16. package/index.css +8 -16
  17. package/intranet.css +9 -17
  18. package/mixins/_button.scss +5 -2
  19. package/mixins/_color.scss +16 -0
  20. package/mixins/_icons.scss +11 -3
  21. package/mixins/_index.scss +4 -0
  22. package/mixins/_notification.scss +112 -0
  23. package/package.json +13 -13
  24. package/placeholders/_button.scss +17 -5
  25. package/placeholders/_close.scss +33 -0
  26. package/placeholders/_index.scss +1 -1
  27. package/placeholders/_notification.scss +13 -0
  28. package/placeholders/badge.scss +0 -4
  29. package/schematics/migrations/general/classes/rtl.js +25 -13
  30. package/schematics/migrations/general/classes/rtl.js.map +1 -1
  31. package/themes/bootstrap/_overrides-variables.scss +2 -3
  32. package/variables/_commons.scss +1 -1
  33. package/variables/_icons.scss +1 -0
  34. package/variables/_type.scss +1 -0
  35. package/variables/components/_accordion.scss +32 -14
  36. package/variables/components/_badge.scss +2 -2
  37. package/variables/components/_button.scss +22 -12
  38. package/variables/components/_close.scss +8 -4
  39. package/variables/components/_index.scss +2 -3
  40. package/variables/components/{_modals.scss → _modal.scss} +3 -3
  41. package/variables/components/_notification.scss +84 -0
  42. package/variables/components/_stepper.scss +3 -3
  43. package/placeholders/_notifications.scss +0 -128
  44. package/variables/components/_alert.scss +0 -51
  45. package/variables/components/_toasts.scss +0 -18
@@ -2,16 +2,16 @@
2
2
 
3
3
  @use './../lic/bootstrap-license';
4
4
  @use './../themes/bootstrap/modal' as bm;
5
- @use './../themes/bootstrap/close' as bc;
6
5
  @use './../themes/bootstrap/core' as *;
7
6
 
8
- @use './../mixins/icons' as icon-mixin;
9
7
  @use './../mixins/scroll-shadows' as scroll-shadows-mixin;
10
- @use './../variables';
8
+
9
+ @use './../variables/commons';
10
+ @use './../variables/components/modal';
11
11
 
12
12
  .modal-content {
13
13
  border: 0;
14
- box-shadow: variables.$box-shadow;
14
+ box-shadow: commons.$box-shadow;
15
15
  }
16
16
 
17
17
  post-ngb-modal-content {
@@ -20,8 +20,8 @@ post-ngb-modal-content {
20
20
  }
21
21
 
22
22
  .modal-body {
23
- @include scroll-shadows-mixin.scroll-shadows-y(variables.$modal-content-bg);
24
- padding: variables.$modal-body-padding;
23
+ @include scroll-shadows-mixin.scroll-shadows-y(modal.$modal-content-bg);
24
+ padding: modal.$modal-body-padding;
25
25
  overflow-y: auto;
26
26
  }
27
27
 
@@ -30,6 +30,14 @@ post-ngb-modal-content {
30
30
  border: 0;
31
31
  }
32
32
 
33
+ .modal-header .btn-close {
34
+ position: absolute;
35
+ top: 0;
36
+ right: 0;
37
+ padding: 0;
38
+ margin: modal.$modal-btn-close-margin;
39
+ }
40
+
33
41
  .modal-title:focus {
34
42
  outline: none; // Removes focus styles when you manually set focus to title with ngbAutofocus https://ng-github.io/#/components/modal/examples#focus
35
43
  }
@@ -37,26 +45,26 @@ post-ngb-modal-content {
37
45
  @include media-breakpoint-up(sm) {
38
46
  post-ngb-modal-content {
39
47
  // prevents the modal from exceeding the height of the screen
40
- max-height: calc(100vh - #{2 * variables.$modal-dialog-margin-y-sm-up});
48
+ max-height: calc(100vh - #{2 * modal.$modal-dialog-margin-y-sm-up});
41
49
  }
42
50
 
43
51
  // Right and left margins are set to "auto" from the sm breakpoint
44
52
  // Paddings below ensure minimal margins on medium screens
45
53
  .modal-dialog {
46
- padding-right: variables.$modal-dialog-margin;
47
- padding-left: variables.$modal-dialog-margin;
54
+ padding-right: modal.$modal-dialog-margin;
55
+ padding-left: modal.$modal-dialog-margin;
48
56
  }
49
57
  }
50
58
 
51
59
  @include media-breakpoint-down(sm) {
52
60
  post-ngb-modal-content {
53
61
  // make the modal cover the full height available on small screens
54
- height: calc(100vh - #{2 * variables.$modal-dialog-margin});
62
+ height: calc(100vh - #{2 * modal.$modal-dialog-margin});
55
63
  }
56
64
 
57
65
  .modal-body,
58
66
  .modal-header {
59
- padding-right: variables.$modal-header-padding-y;
60
- padding-left: variables.$modal-header-padding-y;
67
+ padding-right: modal.$modal-header-padding-y;
68
+ padding-left: modal.$modal-header-padding-y;
61
69
  }
62
70
  }
@@ -109,6 +109,7 @@
109
109
  text-decoration: none;
110
110
  color: stepper.$stepper-link-color;
111
111
  transition: color 250ms;
112
+ text-align: center;
112
113
 
113
114
  .stepper-item[aria-current] > & {
114
115
  color: stepper.$stepper-link-current-color;
@@ -116,7 +117,8 @@
116
117
  font-weight: stepper.$stepper-link-current-font-weight;
117
118
  }
118
119
 
119
- &:hover {
120
+ @at-root a:hover#{&},
121
+ :focus-visible#{&} {
120
122
  color: stepper.$stepper-link-hover-color;
121
123
  }
122
124
 
@@ -127,12 +129,6 @@
127
129
 
128
130
  @include media-breakpoint-down(rg) {
129
131
  .stepper-item {
130
- &[aria-current] .stepper-link {
131
- position: absolute;
132
- bottom: 0;
133
- left: 0;
134
- }
135
-
136
132
  &:not([aria-current]) .stepper-link {
137
133
  overflow: hidden;
138
134
  white-space: nowrap;
@@ -3,27 +3,81 @@
3
3
  @use './../lic/bootstrap-license';
4
4
  @use './../themes/bootstrap/core' as *;
5
5
 
6
- @use './../variables/components/toasts';
7
- @use './../variables/components/alert';
8
- @use './../components/close';
9
- @use './../functions/color' as color-fn;
10
- @use './../functions/contrast' as contrast-fn;
11
- @use './../placeholders/color' as color-ph;
12
- @use './../placeholders/notifications';
6
+ @use './../mixins/notification' as notification-mx;
7
+ @use './../placeholders/close' as close-ph;
8
+ @use './../placeholders/notification' as notification-ph;
9
+
10
+ @use './../variables/commons';
11
+ @use './../variables/spacing';
12
+ @use './../variables/components/notification';
13
+
14
+ .toast {
15
+ @include notification-mx.notification-size(toast);
16
+ @include notification-mx.notification-dismissible(toast, 'toast-close-button');
17
+ @extend %notification-body;
18
+ }
19
+
20
+ .toast-close-button {
21
+ @extend %btn-close;
22
+ }
23
+
24
+ .toast-title {
25
+ @include notification-mx.notification-heading(toast);
26
+ }
27
+
28
+ @each $name, $color, $icon in notification.$notification-variants {
29
+ $selector: '.toast-#{$name}';
30
+
31
+ // the .toast-error class is needed because it is automatically added by the ngx-toastr library
32
+ @if $name == 'danger' {
33
+ $selector: '#{$selector}, .toast-error';
34
+ }
35
+
36
+ #{$selector} {
37
+ @include notification-mx.notification-variant($color, $icon);
38
+ }
39
+ }
13
40
 
14
41
  // Positioning
42
+ .toast-container {
43
+ position: fixed;
44
+ z-index: commons.$zindex-alert;
45
+ display: flex;
46
+ flex-direction: column;
47
+ pointer-events: none;
48
+
49
+ .toast {
50
+ width: 25rem;
51
+ }
52
+
53
+ @include media-breakpoint-down(md) {
54
+ .toast {
55
+ max-width: 25rem;
56
+ }
57
+ }
58
+
59
+ @include media-breakpoint-down(md) {
60
+ right: spacing.$spacer;
61
+ left: spacing.$spacer;
62
+
63
+ .toast {
64
+ width: 100%;
65
+ }
66
+ }
67
+ }
68
+
15
69
  .toast-top-center,
16
70
  .toast-top-full-width,
17
71
  .toast-top-left,
18
72
  .toast-top-right {
19
- top: alert.$alert-margin;
73
+ top: spacing.$spacer;
20
74
  }
21
75
 
22
76
  .toast-bottom-center,
23
77
  .toast-bottom-full-width,
24
78
  .toast-bottom-right,
25
79
  .toast-bottom-left {
26
- bottom: alert.$alert-margin;
80
+ bottom: spacing.$spacer;
27
81
  }
28
82
 
29
83
  .toast-top-left,
@@ -31,7 +85,7 @@
31
85
  .toast-top-full-width,
32
86
  .toast-bottom-full-width,
33
87
  .toast-center-left {
34
- left: alert.$alert-margin;
88
+ left: spacing.$spacer;
35
89
  }
36
90
 
37
91
  .toast-top-right,
@@ -39,7 +93,7 @@
39
93
  .toast-top-full-width,
40
94
  .toast-bottom-full-width,
41
95
  .toast-center-right {
42
- right: alert.$alert-margin;
96
+ right: spacing.$spacer;
43
97
  }
44
98
 
45
99
  .toast-top-center,
@@ -66,121 +120,3 @@
66
120
  width: 100% !important;
67
121
  }
68
122
  }
69
-
70
- // Base styling
71
- .toast-container {
72
- @extend %notification-container;
73
- position: fixed;
74
- pointer-events: none;
75
-
76
- * {
77
- box-sizing: border-box;
78
- }
79
- }
80
-
81
- .toast {
82
- $effective-line-height: (alert.$alert-line-height * alert.$alert-font-size-small);
83
-
84
- @extend %notification;
85
-
86
- display: flex !important; // Needs to be important to override display styling by the ngx-toaster
87
- width: alert.$alert-toast-width;
88
-
89
- min-height: 2 * alert.$alert-toast-padding-y + 2 * $effective-line-height;
90
-
91
- padding: alert.$alert-toast-padding-y alert.$alert-toast-padding-x;
92
- padding-left: (alert.$alert-toast-padding-x * 2 + alert.$alert-toast-icon-size);
93
-
94
- overflow: hidden;
95
- background-position: alert.$alert-toast-padding-x center;
96
-
97
- background-size: alert.$alert-toast-icon-size;
98
- font-size: alert.$alert-font-size-small;
99
- pointer-events: auto;
100
-
101
- &.no-icon {
102
- padding-left: alert.$alert-toast-padding-x;
103
- }
104
-
105
- &:hover {
106
- opacity: 1;
107
- box-shadow: alert.$alert-toast-box-shadow-hover;
108
- cursor: pointer;
109
- }
110
-
111
- .toast-close-button {
112
- @extend %notification-close;
113
-
114
- padding: alert.$alert-toast-padding-y alert.$alert-toast-padding-x;
115
- }
116
-
117
- .toast-close-button,
118
- .btn-close {
119
- ~ .toast-message,
120
- ~ .toast-title {
121
- padding-right: calc(#{alert.$alert-toast-padding-x} + #{alert.$alert-close-icon-size});
122
- }
123
-
124
- + .toast-message {
125
- font-weight: bold;
126
- }
127
- }
128
- }
129
-
130
- .toast-title {
131
- @extend %notification-title;
132
-
133
- font-size: alert.$alert-font-size-small;
134
- }
135
-
136
- .toast-message {
137
- font-size: alert.$alert-font-size-small;
138
- word-wrap: break-word;
139
-
140
- a:hover {
141
- text-decoration: none;
142
- }
143
- }
144
-
145
- /* stylelint-disable */
146
- .toast-close-button {
147
- @extend .btn-close;
148
- }
149
- /* stylelint-enable */
150
-
151
- // Variants
152
-
153
- @each $name, $color, $icon in alert.$alert-list {
154
- .toast-#{$name} {
155
- --post-bg-rgb: #{color-fn.rgb-values($color)};
156
- @extend %notification-#{$name};
157
-
158
- @if (contrast-fn.light-or-dark($color) == 'dark') {
159
- @extend %color-background-dark-variables;
160
- } @else {
161
- @extend %color-background-light-variables;
162
- }
163
-
164
- .toast-close-button,
165
- .btn-close {
166
- @extend %notification-#{$name}-close;
167
- }
168
- }
169
- }
170
-
171
- // Responsive Design
172
- @include media-breakpoint-down(md) {
173
- .toast-container .toast {
174
- width: alert.$alert-toast-width-small-breakpoint;
175
- }
176
- }
177
- @include media-breakpoint-down(sm) {
178
- .toast-container {
179
- right: alert.$alert-margin;
180
- left: alert.$alert-margin;
181
-
182
- .toast {
183
- width: 100%;
184
- }
185
- }
186
- }
@@ -114,3 +114,7 @@ code {
114
114
  color: inherit;
115
115
  font-size: inherit;
116
116
  }
117
+
118
+ hr {
119
+ border-block-start-color: rgba(var(--post-contrast-color-rgb), 0.1);
120
+ }
@@ -6,13 +6,11 @@
6
6
  @use './../lic/bootstrap-license';
7
7
  @use './../themes/bootstrap/core' as *;
8
8
  @use './../themes/bootstrap/utilities' as bu; // TODO: Move Design System utilities to utilities folder.
9
+ @use './../mixins/color' as color-mx;
9
10
  @use './../mixins/utilities';
10
11
  @use './../variables/color';
11
12
  @use './../variables/spacing';
12
13
  @use './../variables/grid';
13
- @use './../functions/color' as color-fn;
14
- @use './../functions/contrast' as contrast-fn;
15
- @use './../placeholders/color' as color-ph;
16
14
 
17
15
  .bold {
18
16
  font-weight: 700;
@@ -66,15 +64,7 @@ span.spacer {
66
64
  // Background Utility
67
65
  @each $name, $color in color.$background-colors {
68
66
  .bg-#{$name} {
69
- --post-bg-rgb: #{color-fn.rgb-values($color)};
70
-
71
- @extend %color-background-rgba;
72
-
73
- @if (contrast-fn.light-or-dark($color) == 'dark') {
74
- @extend %color-background-dark-variables;
75
- } @else {
76
- @extend %color-background-light-variables;
77
- }
67
+ @include color-mx.colored-background($color);
78
68
  }
79
69
  }
80
70
 
@@ -46,7 +46,7 @@
46
46
  @return $svg;
47
47
  }
48
48
 
49
- @function get-colored-svg-url($icon-name, $color) {
49
+ @function get-svg-url($icon-name) {
50
50
  $svg-url: '';
51
51
 
52
52
  @if (map.has-key(icons.$svg-icon-map, #{$icon-name})) {
@@ -59,7 +59,11 @@
59
59
  @error "Icon '#{$icon-name}' does not exist.";
60
60
  }
61
61
 
62
- @return add-fill-color($svg-url, $color);
62
+ @return $svg-url;
63
+ }
64
+
65
+ @function get-colored-svg-url($icon-name, $color) {
66
+ @return add-fill-color(get-svg-url($icon-name), $color);
63
67
  }
64
68
 
65
69
  @function get-pre-colored-svg-url($icon-name) {