Skip to content

Commit b29b3b3

Browse files
abbeyhrttay1orjoneskodiakhq[bot]
authored
feat(themes): generate notification tokens (#12344)
* chore: check in progress * chore: check in progress * feat(themes): generate button tokens * fix(react): remove unnecessary files and lint errors * chore(project): update snapshots * chore(react): check in progress * feat(themes): generate component tokens for tag * chore(themes): update snapshots * feat(themes): generate component tokens for notification * fix(styles): use tokens in all variants * test(snaps): update Co-authored-by: Taylor Jones <[email protected]> Co-authored-by: Taylor Jones <[email protected]> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
1 parent 1b78794 commit b29b3b3

File tree

8 files changed

+312
-42
lines changed

8 files changed

+312
-42
lines changed

packages/elements/src/__tests__/__snapshots__/PublicAPI-test.js.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ Array [
206206
"moderate01",
207207
"moderate02",
208208
"motion",
209+
"notificationTokens",
209210
"orange",
210211
"orange40",
211212
"orange60",

packages/styles/scss/components/notification/_tokens.scss

Lines changed: 150 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -13,106 +13,123 @@
1313
@use '../../themes';
1414
@use '../../theme';
1515
@use '../../utilities/component-tokens';
16+
@use '@carbon/themes/scss/component-tokens' as notification;
17+
1618
@use '../button/tokens' as button-tokens;
1719

1820
$notification-background-error: (
19-
fallback: colors.$red-10,
21+
fallback: map.get(notification.$notification-background-error, white-theme),
2022
values: (
2123
(
2224
theme: themes.$white,
23-
value: colors.$red-10,
25+
value: map.get(notification.$notification-background-error, white-theme),
2426
),
2527
(
2628
theme: themes.$g10,
27-
value: colors.$red-10,
29+
value: map.get(notification.$notification-background-error, g-10),
2830
),
2931
(
3032
theme: themes.$g90,
31-
value: colors.$gray-80,
33+
value: map.get(notification.$notification-background-error, g-90),
3234
),
3335
(
3436
theme: themes.$g100,
35-
value: colors.$gray-90,
37+
value: map.get(notification.$notification-background-error, g-100),
3638
),
3739
),
3840
) !default;
3941

4042
$notification-background-success: (
41-
fallback: colors.$green-10,
43+
fallback: map.get(notification.$notification-background-success, white-theme),
4244
values: (
4345
(
4446
theme: themes.$white,
45-
value: colors.$green-10,
47+
value: map.get(notification.$notification-background-success, white-theme),
4648
),
4749
(
4850
theme: themes.$g10,
49-
value: colors.$green-10,
51+
value: map.get(notification.$notification-background-success, g-10),
5052
),
5153
(
5254
theme: themes.$g90,
53-
value: colors.$gray-80,
55+
value: map.get(notification.$notification-background-success, g-90),
5456
),
5557
(
5658
theme: themes.$g100,
57-
value: colors.$gray-90,
59+
value: map.get(notification.$notification-background-success, g-100),
5860
),
5961
),
6062
) !default;
6163

6264
$notification-background-info: (
63-
fallback: colors.$blue-10,
65+
fallback: map.get(notification.$notification-background-info, white-theme),
6466
values: (
6567
(
6668
theme: themes.$white,
67-
value: colors.$blue-10,
69+
value: map.get(notification.$notification-background-info, white-theme),
6870
),
6971
(
7072
theme: themes.$g10,
71-
value: colors.$blue-10,
73+
value: map.get(notification.$notification-background-info, g-10),
7274
),
7375
(
7476
theme: themes.$g90,
75-
value: colors.$gray-80,
77+
value: map.get(notification.$notification-background-info, g-90),
7678
),
7779
(
7880
theme: themes.$g100,
79-
value: colors.$gray-90,
81+
value: map.get(notification.$notification-background-info, g-100),
8082
),
8183
),
8284
) !default;
8385

8486
$notification-background-warning: (
85-
fallback: color.mix(colors.$yellow-30, colors.$white-0, 15%),
87+
fallback:
88+
color.mix(
89+
map.get(notification.$color-map, yellow-30),
90+
map.get(notification.$color-map, white-0),
91+
15%
92+
),
8693
values: (
8794
(
8895
theme: themes.$white,
89-
value: color.mix(colors.$yellow-30, colors.$white-0, 15%),
96+
value:
97+
color.mix(
98+
map.get(notification.$color-map, yellow-30),
99+
map.get(notification.$color-map, white-0),
100+
15%
101+
),
90102
),
91103
(
92104
theme: themes.$g10,
93-
value: color.mix(colors.$yellow-30, colors.$white-0, 15%),
105+
value:
106+
color.mix(
107+
map.get(notification.$color-map, yellow-30),
108+
map.get(notification.$color-map, white-0),
109+
15%
110+
),
94111
),
95112
(
96113
theme: themes.$g90,
97-
value: colors.$gray-80,
114+
value: map.get(notification.$notification-background-warning, g-90),
98115
),
99116
(
100117
theme: themes.$g100,
101-
value: colors.$gray-90,
118+
value: map.get(notification.$notification-background-warning, g-100),
102119
),
103120
),
104121
) !default;
105122

106123
$notification-action-hover: (
107-
fallback: colors.$white-0,
124+
fallback: map.get(notification.$notification-background-info, white-theme),
108125
values: (
109126
(
110127
theme: themes.$white,
111-
value: colors.$white-0,
128+
value: map.get(notification.$notification-background-info, white-theme),
112129
),
113130
(
114131
theme: themes.$g10,
115-
value: colors.$white-0,
132+
value: map.get(notification.$notification-background-info, g-10),
116133
),
117134
(
118135
theme: themes.$g90,
@@ -127,70 +144,161 @@ $notification-action-hover: (
127144

128145
$notification-action-tertiary-inverse: (
129146
fallback: map.get(button-tokens.$button-tokens, button-tertiary, fallback),
130-
values:
131-
component-tokens.get-inverse-theme-values(
132-
map.get(button-tokens.$button-tokens, button-tertiary)
147+
values: (
148+
(
149+
theme: themes.$white,
150+
value:
151+
map.get(notification.$notification-action-tertiary-inverse, white-theme),
152+
),
153+
(
154+
theme: themes.$g10,
155+
value: map.get(notification.$notification-action-tertiary-inverse, g-10),
156+
),
157+
(
158+
theme: themes.$g90,
159+
value: map.get(notification.$notification-action-tertiary-inverse, g-90),
133160
),
161+
(
162+
theme: themes.$g100,
163+
value: map.get(notification.$notification-action-tertiary-inverse, g-100),
164+
),
165+
),
134166
) !default;
135167

136168
$notification-action-tertiary-inverse-active: (
137169
fallback:
138170
map.get(button-tokens.$button-tokens, button-tertiary-active, fallback),
139-
values:
140-
component-tokens.get-inverse-theme-values(
141-
map.get(button-tokens.$button-tokens, button-tertiary-active)
171+
values: (
172+
(
173+
theme: themes.$white,
174+
value:
175+
map.get(
176+
notification.$notification-action-tertiary-inverse-active,
177+
white-theme
178+
),
179+
),
180+
(
181+
theme: themes.$g10,
182+
value:
183+
map.get(notification.$notification-action-tertiary-inverse-active, g-10),
184+
),
185+
(
186+
theme: themes.$g90,
187+
value:
188+
map.get(notification.$notification-action-tertiary-inverse-active, g-90),
189+
),
190+
(
191+
theme: themes.$g100,
192+
value:
193+
map.get(
194+
notification.$notification-action-tertiary-inverse-active,
195+
g-100
196+
),
142197
),
198+
),
143199
) !default;
144200

145201
$notification-action-tertiary-inverse-hover: (
146202
fallback:
147203
map.get(button-tokens.$button-tokens, button-tertiary-hover, fallback),
148-
values:
149-
component-tokens.get-inverse-theme-values(
150-
map.get(button-tokens.$button-tokens, button-tertiary-hover)
204+
values: (
205+
(
206+
theme: themes.$white,
207+
value:
208+
map.get(
209+
notification.$notification-action-tertiary-inverse-hover,
210+
white-theme
211+
),
212+
),
213+
(
214+
theme: themes.$g10,
215+
value:
216+
map.get(notification.$notification-action-tertiary-inverse-hover, g-10),
151217
),
218+
(
219+
theme: themes.$g90,
220+
value:
221+
map.get(notification.$notification-action-tertiary-inverse-hover, g-90),
222+
),
223+
(
224+
theme: themes.$g100,
225+
value:
226+
map.get(notification.$notification-action-tertiary-inverse-hover, g-100),
227+
),
228+
),
152229
) !default;
153230

154231
$notification-action-tertiary-inverse-text: (
155-
fallback: map.get(themes.$white, text-inverse),
232+
fallback:
233+
map.get(
234+
notification.$notification-action-tertiary-inverse-text,
235+
white-theme
236+
),
156237
values: (
157238
(
158239
theme: themes.$white,
159-
value: map.get(themes.$g100, text-inverse),
240+
value:
241+
map.get(
242+
notification.$notification-action-tertiary-inverse-text,
243+
white-theme
244+
),
160245
),
161246
(
162247
theme: themes.$g10,
163-
value: map.get(themes.$g90, text-inverse),
248+
value:
249+
map.get(notification.$notification-action-tertiary-inverse-text, g-10),
164250
),
165251
(
166252
theme: themes.$g90,
167-
value: map.get(themes.$g10, text-inverse),
253+
value:
254+
map.get(notification.$notification-action-tertiary-inverse-text, g-90),
168255
),
169256
(
170257
theme: themes.$g100,
171-
value: map.get(themes.$white, text-inverse),
258+
value:
259+
map.get(notification.$notification-action-tertiary-inverse-text, g-100),
172260
),
173261
),
174262
) !default;
175263

176264
$notification-action-tertiary-inverse-text-on-color-disabled: (
177-
fallback: map.get(themes.$white, text-on-color-disabled),
265+
fallback:
266+
map.get(
267+
notification.$notification-action-tertiary-inverse-text-on-color-disabled,
268+
white-theme
269+
),
178270
values: (
179271
(
180272
theme: themes.$white,
181-
value: map.get(themes.$g100, text-on-color-disabled),
273+
value:
274+
map.get(
275+
notification.$notification-action-tertiary-inverse-text-on-color-disabled,
276+
white-theme
277+
),
182278
),
183279
(
184280
theme: themes.$g10,
185-
value: map.get(themes.$g90, text-on-color-disabled),
281+
value:
282+
map.get(
283+
notification.$notification-action-tertiary-inverse-text-on-color-disabled,
284+
g-10
285+
),
186286
),
187287
(
188288
theme: themes.$g90,
189-
value: map.get(themes.$g10, text-on-color-disabled),
289+
value:
290+
map.get(
291+
notification.$notification-action-tertiary-inverse-text-on-color-disabled,
292+
g-90
293+
),
190294
),
191295
(
192296
theme: themes.$g100,
193-
value: map.get(themes.$white, text-on-color-disabled),
297+
value:
298+
map.get(
299+
notification.$notification-action-tertiary-inverse-text-on-color-disabled,
300+
g-100
301+
),
194302
),
195303
),
196304
) !default;

packages/themes/scss/_component-tokens.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77

88
@forward 'generated/button-tokens';
99
@forward 'generated/tag-tokens';
10+
@forward 'generated/notification-tokens';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * as notificationTokens from './tokens';

0 commit comments

Comments
 (0)