@valtimo/components 13.39.0 → 13.40.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.
@@ -111,15 +111,93 @@ $darkThemeOverwriteVariables: (
111
111
  @use '@carbon/grid';
112
112
  @include grid.flex-grid();
113
113
 
114
+ /* Extended tag colours, beyond the ten colours Carbon ships for tags. They follow Carbon's own tag
115
+ recipe: in a light theme a tag uses the `20` step of a colour family as background and the `70`
116
+ step as text; in a dark theme the two are swapped. Carbon leaves orange and yellow out of the tag
117
+ component even though both are part of its colour palette, and it has no periwinkle or brown
118
+ family at all — those two therefore reuse the case-widget palette, which is built on the same
119
+ principle.
120
+
121
+ Each entry is emitted as a pair of `--vcds-tag-*` custom properties per theme, the way Carbon
122
+ emits its own `--cds-tag-*` tokens, so the classname stays theme-agnostic. */
123
+ $extendedTagColors: (
124
+ 'orange': (
125
+ light: (
126
+ background: colors.$orange-20,
127
+ text: colors.$orange-70,
128
+ ),
129
+ dark: (
130
+ background: colors.$orange-70,
131
+ text: colors.$orange-20,
132
+ ),
133
+ ),
134
+ 'yellow': (
135
+ light: (
136
+ background: colors.$yellow-20,
137
+ text: colors.$yellow-70,
138
+ ),
139
+ dark: (
140
+ background: colors.$yellow-70,
141
+ text: colors.$yellow-20,
142
+ ),
143
+ ),
144
+ // A paler tint of the same family as `green`, so that the two stay recognisably related while
145
+ // remaining distinguishable side by side.
146
+ 'light-green':
147
+ (
148
+ light: (
149
+ background: colors.$green-10,
150
+ text: colors.$green-70,
151
+ ),
152
+ dark: (
153
+ background: colors.$green-80,
154
+ text: colors.$green-30,
155
+ ),
156
+ ),
157
+ // Periwinkle and brown have no Carbon colour family; these are the case-widget tones.
158
+ 'periwinkle':
159
+ (
160
+ light: (
161
+ background: #d5d3f0,
162
+ text: #1a146a,
163
+ ),
164
+ dark: (
165
+ background: #1a146a,
166
+ text: #d5d3f0,
167
+ ),
168
+ ),
169
+ 'brown': (
170
+ light: (
171
+ background: #ece4d7,
172
+ text: #6e5326,
173
+ ),
174
+ dark: (
175
+ background: #6e5326,
176
+ text: #ece4d7,
177
+ ),
178
+ ),
179
+ );
180
+
181
+ @mixin extended-tag-tokens($variant) {
182
+ @each $tagName, $variants in $extendedTagColors {
183
+ $tokens: map.get($variants, $variant);
184
+
185
+ --vcds-tag-background-#{$tagName}: #{map.get($tokens, background)};
186
+ --vcds-tag-color-#{$tagName}: #{map.get($tokens, text)};
187
+ }
188
+ }
189
+
114
190
  @each $name, $variable in $lightThemeVariables {
115
191
  [data-carbon-theme='#{$name}'] {
116
192
  @include theme.theme($variable, $lightThemeOverwriteVariables);
193
+ @include extended-tag-tokens(light);
117
194
  }
118
195
  }
119
196
 
120
197
  @each $name, $variable in $darkThemeVariables {
121
198
  [data-carbon-theme='#{$name}'] {
122
199
  @include theme.theme($variable, $darkThemeOverwriteVariables);
200
+ @include extended-tag-tokens(dark);
123
201
  }
124
202
  }
125
203
 
@@ -140,33 +218,12 @@ $darkThemeOverwriteVariables: (
140
218
  --vcds-color-10: #e9f6fd;
141
219
  }
142
220
 
143
- /* Extended tag colours, beyond Carbon's built-in tag types, matching the case-widget colour
144
- palette. Registered globally so `<cds-tag [type]="'orange'">` (and periwinkle, yellow, light-green,
145
- brown) can be used anywhere by classname. The light-background / dark-text pairing follows
146
- Carbon's own tag styling. */
147
- .cds--tag--orange {
148
- background-color: colors.$orange-20;
149
- color: colors.$orange-70;
150
- }
151
-
152
- .cds--tag--yellow {
153
- background-color: colors.$yellow-20;
154
- color: colors.$yellow-70;
155
- }
156
-
157
- .cds--tag--light-green {
158
- background-color: colors.$green-20;
159
- color: colors.$green-70;
160
- }
161
-
162
- .cds--tag--periwinkle {
163
- background-color: colors.$purple-20;
164
- color: colors.$purple-70;
165
- }
166
-
167
- /* Brown has no Carbon colour family; use the case-widget "brown" colour so the extended palette has
168
- a warm, gray-free option. */
169
- .cds--tag--brown {
170
- background-color: #ece4d7;
171
- color: #6e5326;
221
+ /* Registered globally so `<cds-tag [type]="'orange'">` (and yellow, light-green, periwinkle, brown)
222
+ can be used anywhere by classname. The colours themselves are defined per theme further up, as
223
+ `--vcds-tag-*` custom properties. */
224
+ @each $tagName, $variants in $extendedTagColors {
225
+ .cds--tag--#{$tagName} {
226
+ background-color: var(--vcds-tag-background-#{$tagName});
227
+ color: var(--vcds-tag-color-#{$tagName});
228
+ }
172
229
  }