@swisspost/design-system-styles 6.2.6 → 6.4.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 (52) hide show
  1. package/_svg-icon-map.scss +27 -1
  2. package/basics.css +3 -1
  3. package/components/_index.scss +2 -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/choice-control-card.scss +146 -0
  8. package/components/close.scss +12 -23
  9. package/components/datepicker.scss +30 -2
  10. package/components/dropdown.scss +43 -8
  11. package/components/form-check.scss +5 -5
  12. package/components/form-textarea.scss +12 -0
  13. package/components/modal.scss +20 -12
  14. package/components/stepper.scss +3 -7
  15. package/components/tabs/_tab-title.scss +152 -0
  16. package/components/tabs/_tabs-wrapper.scss +69 -0
  17. package/components/tabs/index.scss +2 -0
  18. package/components/toast.scss +65 -129
  19. package/components/type.scss +4 -0
  20. package/components/utilities.scss +2 -12
  21. package/functions/_icons.scss +16 -2
  22. package/index.css +8 -16
  23. package/intranet.css +9 -17
  24. package/mixins/_button.scss +1 -1
  25. package/mixins/_color.scss +16 -0
  26. package/mixins/_forms.scss +0 -1
  27. package/mixins/_icons.scss +11 -3
  28. package/mixins/_index.scss +4 -0
  29. package/mixins/_notification.scss +112 -0
  30. package/package.json +13 -12
  31. package/placeholders/_close.scss +33 -0
  32. package/placeholders/_index.scss +1 -1
  33. package/placeholders/_notification.scss +13 -0
  34. package/placeholders/badge.scss +0 -4
  35. package/schematics/migrations/general/classes/rtl.js +25 -13
  36. package/schematics/migrations/general/classes/rtl.js.map +1 -1
  37. package/themes/bootstrap/_overrides-variables.scss +2 -3
  38. package/variables/_commons.scss +1 -1
  39. package/variables/_icons.scss +1 -0
  40. package/variables/_type.scss +1 -0
  41. package/variables/components/_accordion.scss +32 -14
  42. package/variables/components/_badge.scss +2 -2
  43. package/variables/components/_button.scss +18 -8
  44. package/variables/components/_close.scss +8 -4
  45. package/variables/components/_index.scss +2 -3
  46. package/variables/components/{_modals.scss → _modal.scss} +3 -3
  47. package/variables/components/_notification.scss +84 -0
  48. package/variables/components/_stepper.scss +3 -3
  49. package/components/tabs.scss +0 -214
  50. package/placeholders/_notifications.scss +0 -128
  51. package/variables/components/_alert.scss +0 -51
  52. package/variables/components/_toasts.scss +0 -18
@@ -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
 
@@ -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');
@@ -46,7 +56,7 @@
46
56
  @return $svg;
47
57
  }
48
58
 
49
- @function get-colored-svg-url($icon-name, $color) {
59
+ @function get-svg-url($icon-name) {
50
60
  $svg-url: '';
51
61
 
52
62
  @if (map.has-key(icons.$svg-icon-map, #{$icon-name})) {
@@ -59,7 +69,11 @@
59
69
  @error "Icon '#{$icon-name}' does not exist.";
60
70
  }
61
71
 
62
- @return add-fill-color($svg-url, $color);
72
+ @return $svg-url;
73
+ }
74
+
75
+ @function get-colored-svg-url($icon-name, $color) {
76
+ @return add-fill-color(get-svg-url($icon-name), $color);
63
77
  }
64
78
 
65
79
  @function get-pre-colored-svg-url($icon-name) {