@carbon/styles 1.98.0 → 1.99.0-rc.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.
@@ -19,36 +19,176 @@
19
19
  @use '../../utilities/focus-outline' as *;
20
20
  @use './tokens' as *;
21
21
 
22
- /// Inline notification styles
22
+ /// Inline notification base styles
23
23
  /// @access public
24
24
  /// @group notification
25
- @mixin inline-notification {
26
- .#{$prefix}--inline-notification {
27
- @include reset;
25
+ @mixin inline-notification-base {
26
+ @include reset;
28
27
 
29
- position: relative;
30
- display: flex;
31
- flex-wrap: wrap;
32
- block-size: auto;
28
+ position: relative;
29
+ display: flex;
30
+ flex-wrap: wrap;
31
+ block-size: auto;
33
32
 
34
- color: $text-inverse;
35
- inline-size: 100%;
36
- max-inline-size: convert.to-rem(288px);
37
- min-block-size: convert.to-rem(48px);
38
- min-inline-size: convert.to-rem(288px);
33
+ color: $text-inverse;
34
+ inline-size: 100%;
35
+ max-inline-size: convert.to-rem(288px);
36
+ min-block-size: convert.to-rem(48px);
37
+ min-inline-size: convert.to-rem(288px);
39
38
 
40
- @include breakpoint(md) {
41
- flex-wrap: nowrap;
42
- max-inline-size: convert.to-rem(608px);
43
- }
39
+ @include breakpoint(md) {
40
+ flex-wrap: nowrap;
41
+ max-inline-size: convert.to-rem(608px);
42
+ }
44
43
 
45
- @include breakpoint(lg) {
46
- max-inline-size: convert.to-rem(736px);
47
- }
44
+ @include breakpoint(lg) {
45
+ max-inline-size: convert.to-rem(736px);
46
+ }
48
47
 
49
- @include breakpoint(max) {
50
- max-inline-size: convert.to-rem(832px);
51
- }
48
+ @include breakpoint(max) {
49
+ max-inline-size: convert.to-rem(832px);
50
+ }
51
+ }
52
+
53
+ /// Inline notification low contrast ::before styles
54
+ /// @access public
55
+ /// @group notification
56
+ @mixin inline-notification-low-contrast-before {
57
+ position: absolute;
58
+ box-sizing: border-box;
59
+ border-width: 1px 1px 1px 0;
60
+ border-style: solid;
61
+ block-size: 100%;
62
+ content: '';
63
+ filter: opacity(0.4);
64
+ inline-size: 100%;
65
+ inset-block-start: 0;
66
+ inset-inline-start: 0;
67
+ pointer-events: none;
68
+ }
69
+
70
+ /// Inline notification low-contrast error variant styles
71
+ /// @access public
72
+ /// @group notification
73
+ @mixin inline-notification-low-contrast-error {
74
+ @include notification--experimental(
75
+ $support-error,
76
+ $notification-background-error
77
+ );
78
+
79
+ &::before {
80
+ border-color: $support-error;
81
+ }
82
+ }
83
+
84
+ /// Inline notification low-contrast success variant styles
85
+ /// @access public
86
+ /// @group notification
87
+ @mixin inline-notification-low-contrast-success {
88
+ @include notification--experimental(
89
+ $support-success,
90
+ $notification-background-success
91
+ );
92
+
93
+ &::before {
94
+ border-color: $support-success;
95
+ }
96
+ }
97
+
98
+ /// Inline notification low-contrast info variant styles
99
+ /// @access public
100
+ /// @group notification
101
+ @mixin inline-notification-low-contrast-info {
102
+ @include notification--experimental(
103
+ $support-info,
104
+ $notification-background-info
105
+ );
106
+
107
+ &::before {
108
+ border-color: $support-info;
109
+ }
110
+ }
111
+
112
+ /// Inline notification low-contrast warning variant styles
113
+ /// @access public
114
+ /// @group notification
115
+ @mixin inline-notification-low-contrast-warning {
116
+ @include notification--experimental(
117
+ $support-warning,
118
+ $notification-background-warning
119
+ );
120
+
121
+ &::before {
122
+ border-color: $support-warning;
123
+ }
124
+ }
125
+
126
+ /// Inline notification low-contrast base styles
127
+ /// @access public
128
+ /// @group notification
129
+ @mixin inline-notification-low-contrast-base {
130
+ color: $text-primary;
131
+
132
+ .#{$prefix}--inline-notification__close-button:focus {
133
+ @include focus-outline('outline');
134
+ }
135
+
136
+ .#{$prefix}--inline-notification__close-button
137
+ .#{$prefix}--inline-notification__close-icon {
138
+ fill: $icon-primary;
139
+ }
140
+
141
+ &::before {
142
+ @include inline-notification-low-contrast-before;
143
+ }
144
+ }
145
+
146
+ /// Inline notification error variant base styles
147
+ /// @access public
148
+ /// @group notification
149
+ @mixin inline-notification-error-base {
150
+ @include notification--experimental(
151
+ $support-error-inverse,
152
+ $background-inverse
153
+ );
154
+ }
155
+
156
+ /// Inline notification success variant base styles
157
+ /// @access public
158
+ /// @group notification
159
+ @mixin inline-notification-success-base {
160
+ @include notification--experimental(
161
+ $support-success-inverse,
162
+ $background-inverse
163
+ );
164
+ }
165
+
166
+ /// Inline notification info variant base styles
167
+ /// @access public
168
+ /// @group notification
169
+ @mixin inline-notification-info-base {
170
+ @include notification--experimental(
171
+ $support-info-inverse,
172
+ $background-inverse
173
+ );
174
+ }
175
+
176
+ /// Inline notification warning variant base styles
177
+ /// @access public
178
+ /// @group notification
179
+ @mixin inline-notification-warning-base {
180
+ @include notification--experimental(
181
+ $support-warning-inverse,
182
+ $background-inverse
183
+ );
184
+ }
185
+
186
+ /// Inline notification styles
187
+ /// @access public
188
+ /// @group notification
189
+ @mixin inline-notification {
190
+ .#{$prefix}--inline-notification {
191
+ @include inline-notification-base;
52
192
  }
53
193
 
54
194
  .#{$prefix}--inline-notification:not(
@@ -76,97 +216,43 @@
76
216
  }
77
217
 
78
218
  .#{$prefix}--inline-notification--low-contrast {
79
- color: $text-primary;
80
-
81
- &::before {
82
- position: absolute;
83
- box-sizing: border-box;
84
- border-width: 1px 1px 1px 0;
85
- border-style: solid;
86
- block-size: 100%;
87
- content: '';
88
- filter: opacity(0.4);
89
- inline-size: 100%;
90
- inset-block-start: 0;
91
- inset-inline-start: 0;
92
- pointer-events: none;
93
- }
219
+ @include inline-notification-low-contrast-base;
94
220
  }
95
221
 
96
222
  .#{$prefix}--inline-notification--error {
97
- @include notification--experimental(
98
- $support-error-inverse,
99
- $background-inverse
100
- );
223
+ @include inline-notification-error-base;
101
224
  }
102
225
 
103
226
  .#{$prefix}--inline-notification--low-contrast.#{$prefix}--inline-notification--error {
104
- @include notification--experimental(
105
- $support-error,
106
- $notification-background-error
107
- );
108
-
109
- &::before {
110
- border-color: $support-error;
111
- }
227
+ @include inline-notification-low-contrast-error;
112
228
  }
113
229
 
114
230
  .#{$prefix}--inline-notification--success {
115
- @include notification--experimental(
116
- $support-success-inverse,
117
- $background-inverse
118
- );
231
+ @include inline-notification-success-base;
119
232
  }
120
233
 
121
234
  .#{$prefix}--inline-notification--low-contrast.#{$prefix}--inline-notification--success {
122
- @include notification--experimental(
123
- $support-success,
124
- $notification-background-success
125
- );
126
-
127
- &::before {
128
- border-color: $support-success;
129
- }
235
+ @include inline-notification-low-contrast-success;
130
236
  }
131
237
 
132
238
  .#{$prefix}--inline-notification--info,
133
239
  .#{$prefix}--inline-notification--info-square {
134
- @include notification--experimental(
135
- $support-info-inverse,
136
- $background-inverse
137
- );
240
+ @include inline-notification-info-base;
138
241
  }
139
242
 
140
243
  .#{$prefix}--inline-notification--low-contrast.#{$prefix}--inline-notification--info,
141
244
  .#{$prefix}--inline-notification--low-contrast.#{$prefix}--inline-notification--info-square {
142
- @include notification--experimental(
143
- $support-info,
144
- $notification-background-info
145
- );
146
-
147
- &::before {
148
- border-color: $support-info;
149
- }
245
+ @include inline-notification-low-contrast-info;
150
246
  }
151
247
 
152
248
  .#{$prefix}--inline-notification--warning,
153
249
  .#{$prefix}--inline-notification--warning-alt {
154
- @include notification--experimental(
155
- $support-warning-inverse,
156
- $background-inverse
157
- );
250
+ @include inline-notification-warning-base;
158
251
  }
159
252
 
160
253
  .#{$prefix}--inline-notification--low-contrast.#{$prefix}--inline-notification--warning,
161
254
  .#{$prefix}--inline-notification--low-contrast.#{$prefix}--inline-notification--warning-alt {
162
- @include notification--experimental(
163
- $support-warning,
164
- $notification-background-warning
165
- );
166
-
167
- &::before {
168
- border-color: $support-warning;
169
- }
255
+ @include inline-notification-low-contrast-warning;
170
256
  }
171
257
 
172
258
  .#{$prefix}--inline-notification--warning
@@ -295,17 +381,6 @@
295
381
  }
296
382
  }
297
383
 
298
- .#{$prefix}--inline-notification--low-contrast
299
- .#{$prefix}--inline-notification__close-button:focus {
300
- @include focus-outline('outline');
301
- }
302
-
303
- .#{$prefix}--inline-notification--low-contrast
304
- .#{$prefix}--inline-notification__close-button
305
- .#{$prefix}--inline-notification__close-icon {
306
- fill: $icon-primary;
307
- }
308
-
309
384
  // Windows HCM fix
310
385
 
311
386
  .#{$prefix}--inline-notification {
@@ -21,23 +21,131 @@
21
21
  @use '../../utilities/focus-outline' as *;
22
22
  @use './tokens' as *;
23
23
 
24
+ /// Toast notification base styles
25
+ /// @access public
26
+ /// @group notification
27
+ @mixin toast-notification-base {
28
+ @include reset;
29
+
30
+ display: flex;
31
+ block-size: auto;
32
+ box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.2);
33
+ color: $text-inverse;
34
+ inline-size: convert.to-rem(288px);
35
+ padding-inline-start: convert.to-rem(13px);
36
+
37
+ @include breakpoint(max) {
38
+ inline-size: convert.to-rem(352px);
39
+ }
40
+ }
41
+
42
+ /// Toast notification low-contrast base styles
43
+ /// @access public
44
+ /// @group notification
45
+ @mixin toast-notification-low-contrast-base {
46
+ color: $text-primary;
47
+
48
+ .#{$prefix}--toast-notification__subtitle,
49
+ .#{$prefix}--toast-notification__caption {
50
+ color: $text-primary;
51
+ }
52
+
53
+ .#{$prefix}--toast-notification__close-button
54
+ .#{$prefix}--toast-notification__close-icon {
55
+ fill: $icon-primary;
56
+ }
57
+
58
+ .#{$prefix}--toast-notification__close-button:focus {
59
+ @include focus-outline('outline');
60
+ }
61
+ }
62
+
63
+ /// Toast notification error variant base styles
64
+ /// @access public
65
+ /// @group notification
66
+ @mixin toast-notification-error-base {
67
+ @include notification--experimental(
68
+ $support-error-inverse,
69
+ $background-inverse
70
+ );
71
+ }
72
+
73
+ /// Toast notification success variant base styles
74
+ /// @access public
75
+ /// @group notification
76
+ @mixin toast-notification-success-base {
77
+ @include notification--experimental(
78
+ $support-success-inverse,
79
+ $background-inverse
80
+ );
81
+ }
82
+
83
+ /// Toast notification info variant base styles
84
+ /// @access public
85
+ /// @group notification
86
+ @mixin toast-notification-info-base {
87
+ @include notification--experimental(
88
+ $support-info-inverse,
89
+ $background-inverse
90
+ );
91
+ }
92
+
93
+ /// Toast notification warning variant base styles
94
+ /// @access public
95
+ /// @group notification
96
+ @mixin toast-notification-warning-base {
97
+ @include notification--experimental(
98
+ $support-warning-inverse,
99
+ $background-inverse
100
+ );
101
+ }
102
+
103
+ /// Toast notification low-contrast error variant styles
104
+ /// @access public
105
+ /// @group notification
106
+ @mixin toast-notification-low-contrast-error {
107
+ @include notification--experimental(
108
+ $support-error,
109
+ $notification-background-error
110
+ );
111
+ }
112
+
113
+ /// Toast notification low-contrast success variant styles
114
+ /// @access public
115
+ /// @group notification
116
+ @mixin toast-notification-low-contrast-success {
117
+ @include notification--experimental(
118
+ $support-success,
119
+ $notification-background-success
120
+ );
121
+ }
122
+
123
+ /// Toast notification low-contrast info variant styles
124
+ /// @access public
125
+ /// @group notification
126
+ @mixin toast-notification-low-contrast-info {
127
+ @include notification--experimental(
128
+ $support-info,
129
+ $notification-background-info
130
+ );
131
+ }
132
+
133
+ /// Toast notification low-contrast warning variant styles
134
+ /// @access public
135
+ /// @group notification
136
+ @mixin toast-notification-low-contrast-warning {
137
+ @include notification--experimental(
138
+ $support-warning,
139
+ $notification-background-warning
140
+ );
141
+ }
142
+
24
143
  /// Toast notification styles
25
144
  /// @access public
26
145
  /// @group notification
27
146
  @mixin toast-notification {
28
147
  .#{$prefix}--toast-notification {
29
- @include reset;
30
-
31
- display: flex;
32
- block-size: auto;
33
- box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.2);
34
- color: $text-inverse;
35
- inline-size: convert.to-rem(288px);
36
- padding-inline-start: convert.to-rem(13px);
37
-
38
- @include breakpoint(max) {
39
- inline-size: convert.to-rem(352px);
40
- }
148
+ @include toast-notification-base;
41
149
  }
42
150
 
43
151
  .#{$prefix}--toast-notification:not(
@@ -65,67 +173,43 @@
65
173
  }
66
174
 
67
175
  .#{$prefix}--toast-notification--low-contrast {
68
- color: $text-primary;
176
+ @include toast-notification-low-contrast-base;
69
177
  }
70
178
 
71
179
  .#{$prefix}--toast-notification--error {
72
- @include notification--experimental(
73
- $support-error-inverse,
74
- $background-inverse
75
- );
180
+ @include toast-notification-error-base;
76
181
  }
77
182
 
78
183
  .#{$prefix}--toast-notification--low-contrast.#{$prefix}--toast-notification--error {
79
- @include notification--experimental(
80
- $support-error,
81
- $notification-background-error
82
- );
184
+ @include toast-notification-low-contrast-error;
83
185
  }
84
186
 
85
187
  .#{$prefix}--toast-notification--success {
86
- @include notification--experimental(
87
- $support-success-inverse,
88
- $background-inverse
89
- );
188
+ @include toast-notification-success-base;
90
189
  }
91
190
 
92
191
  .#{$prefix}--toast-notification--low-contrast.#{$prefix}--toast-notification--success {
93
- @include notification--experimental(
94
- $support-success,
95
- $notification-background-success
96
- );
192
+ @include toast-notification-low-contrast-success;
97
193
  }
98
194
 
99
195
  .#{$prefix}--toast-notification--info,
100
196
  .#{$prefix}--toast-notification--info-square {
101
- @include notification--experimental(
102
- $support-info-inverse,
103
- $background-inverse
104
- );
197
+ @include toast-notification-info-base;
105
198
  }
106
199
 
107
200
  .#{$prefix}--toast-notification--low-contrast.#{$prefix}--toast-notification--info,
108
201
  .#{$prefix}--toast-notification--low-contrast.#{$prefix}--toast-notification--info-square {
109
- @include notification--experimental(
110
- $support-info,
111
- $notification-background-info
112
- );
202
+ @include toast-notification-low-contrast-info;
113
203
  }
114
204
 
115
205
  .#{$prefix}--toast-notification--warning,
116
206
  .#{$prefix}--toast-notification--warning-alt {
117
- @include notification--experimental(
118
- $support-warning-inverse,
119
- $background-inverse
120
- );
207
+ @include toast-notification-warning-base;
121
208
  }
122
209
 
123
210
  .#{$prefix}--toast-notification--low-contrast.#{$prefix}--toast-notification--warning,
124
211
  .#{$prefix}--toast-notification--low-contrast.#{$prefix}--toast-notification--warning-alt {
125
- @include notification--experimental(
126
- $support-warning,
127
- $notification-background-warning
128
- );
212
+ @include toast-notification-low-contrast-warning;
129
213
  }
130
214
 
131
215
  .#{$prefix}--toast-notification--warning
@@ -179,17 +263,6 @@
179
263
  }
180
264
  }
181
265
 
182
- .#{$prefix}--toast-notification--low-contrast
183
- .#{$prefix}--toast-notification__close-button:focus {
184
- @include focus-outline('outline');
185
- }
186
-
187
- .#{$prefix}--toast-notification--low-contrast
188
- .#{$prefix}--toast-notification__close-button
189
- .#{$prefix}--toast-notification__close-icon {
190
- fill: $icon-primary;
191
- }
192
-
193
266
  .#{$prefix}--toast-notification__title {
194
267
  @include type-style('heading-compact-01');
195
268
 
@@ -206,11 +279,6 @@
206
279
  word-break: break-word;
207
280
  }
208
281
 
209
- .#{$prefix}--toast-notification--low-contrast
210
- .#{$prefix}--toast-notification__subtitle {
211
- color: $text-primary;
212
- }
213
-
214
282
  .#{$prefix}--toast-notification__caption {
215
283
  @include type-style('body-compact-01');
216
284
 
@@ -218,11 +286,6 @@
218
286
  padding-block-start: $spacing-03;
219
287
  }
220
288
 
221
- .#{$prefix}--toast-notification--low-contrast
222
- .#{$prefix}--toast-notification__caption {
223
- color: $text-primary;
224
- }
225
-
226
289
  // Windows HCM fix
227
290
 
228
291
  .#{$prefix}--toast-notification {
@@ -85,6 +85,50 @@ $popover-caret-height: custom-property.get-var(
85
85
  convert.to-rem(6px)
86
86
  );
87
87
 
88
+ /// Mixin for applying base popover styles
89
+ @mixin popover-base {
90
+ position: absolute;
91
+ z-index: z('floating');
92
+ inset: 0;
93
+ pointer-events: none;
94
+ }
95
+
96
+ /// Mixin for applying base highcontrast popover styles
97
+ @mixin popover-highcontrast-base {
98
+ @include custom-property.declaration(
99
+ 'popover-background-color',
100
+ theme.$background-inverse
101
+ );
102
+ @include custom-property.declaration(
103
+ 'popover-text-color',
104
+ theme.$text-inverse
105
+ );
106
+ }
107
+
108
+ /// Mixin for applying popover tab-tip button styles
109
+ @mixin popover-tab-tip-button {
110
+ @include button-reset.reset;
111
+
112
+ position: relative;
113
+ display: inline-flex;
114
+ align-items: center;
115
+ justify-content: center;
116
+ block-size: convert.to-rem(32px);
117
+ inline-size: convert.to-rem(32px);
118
+
119
+ &:focus {
120
+ @include focus-outline('outline');
121
+ }
122
+
123
+ &:hover {
124
+ background-color: theme.$layer-hover;
125
+ }
126
+
127
+ svg {
128
+ fill: theme.$icon-primary;
129
+ }
130
+ }
131
+
88
132
  @mixin popover {
89
133
  // Container
90
134
  .#{$prefix}--popover-container {
@@ -102,14 +146,7 @@ $popover-caret-height: custom-property.get-var(
102
146
 
103
147
  // High contrast modifier
104
148
  .#{$prefix}--popover--high-contrast .#{$prefix}--popover {
105
- @include custom-property.declaration(
106
- 'popover-background-color',
107
- theme.$background-inverse
108
- );
109
- @include custom-property.declaration(
110
- 'popover-text-color',
111
- theme.$text-inverse
112
- );
149
+ @include popover-highcontrast-base;
113
150
  }
114
151
 
115
152
  // Drop shadow modifier
@@ -135,10 +172,7 @@ $popover-caret-height: custom-property.get-var(
135
172
 
136
173
  // Popover, this element contains both the caret and the popover content
137
174
  .#{$prefix}--popover {
138
- position: absolute;
139
- z-index: z('floating');
140
- inset: 0;
141
- pointer-events: none;
175
+ @include popover-base;
142
176
  }
143
177
 
144
178
  // Popover content
@@ -1417,22 +1451,7 @@ $popover-caret-height: custom-property.get-var(
1417
1451
  }
1418
1452
 
1419
1453
  .#{$prefix}--popover--tab-tip__button {
1420
- @include button-reset.reset;
1421
-
1422
- position: relative;
1423
- display: inline-flex;
1424
- align-items: center;
1425
- justify-content: center;
1426
- block-size: convert.to-rem(32px);
1427
- inline-size: convert.to-rem(32px);
1428
-
1429
- &:focus {
1430
- @include focus-outline('outline');
1431
- }
1432
-
1433
- &:hover {
1434
- background-color: theme.$layer-hover;
1435
- }
1454
+ @include popover-tab-tip-button;
1436
1455
  }
1437
1456
 
1438
1457
  .#{$prefix}--popover--tab-tip.#{$prefix}--popover--open
@@ -298,7 +298,10 @@
298
298
  .#{$prefix}--tree-node__label .#{$prefix}--popover-container {
299
299
  inline-size: 100%;
300
300
  }
301
- .#{$prefix}--tooltip-trigger__wrapper .#{$prefix}--btn--ghost:focus {
301
+ .#{$prefix}--tree
302
+ .#{$prefix}--tree-node__label
303
+ .#{$prefix}--tooltip-trigger__wrapper
304
+ .#{$prefix}--btn--ghost:focus {
302
305
  box-shadow: none;
303
306
  outline: 2px solid $focus;
304
307
  }