@carbon/element-styles 0.3.15 → 0.3.16-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.
Files changed (79) hide show
  1. package/README.md +21 -0
  2. package/css/prebuilt/editorial.css +1 -1
  3. package/css/prebuilt/expressive.css +1 -1
  4. package/css/prebuilt/productive.css +1 -1
  5. package/package.json +2 -2
  6. package/scss/_config.scss +9 -0
  7. package/scss/elements/_heading/index.scss +7 -4
  8. package/scss/elements/_input/index.scss +50 -47
  9. package/scss/elements/_labelled-input/index.scss +44 -41
  10. package/scss/elements/_layer/index.scss +17 -14
  11. package/scss/elements/abbreviation/index.scss +7 -4
  12. package/scss/elements/address/index.scss +7 -4
  13. package/scss/elements/anchor/index.scss +33 -30
  14. package/scss/elements/block-quotation/index.scss +30 -27
  15. package/scss/elements/body/index.scss +7 -4
  16. package/scss/elements/bold-text/index.scss +5 -2
  17. package/scss/elements/button/index.scss +183 -180
  18. package/scss/elements/checkbox/index.scss +40 -37
  19. package/scss/elements/code/index.scss +9 -6
  20. package/scss/elements/color-input/index.scss +70 -67
  21. package/scss/elements/combo-box/index.scss +35 -32
  22. package/scss/elements/date-input/index.scss +24 -21
  23. package/scss/elements/date-time-input/index.scss +24 -21
  24. package/scss/elements/deleted-text/index.scss +8 -5
  25. package/scss/elements/description-list/index.scss +17 -14
  26. package/scss/elements/details/index.scss +53 -48
  27. package/scss/elements/dialog/index.scss +173 -170
  28. package/scss/elements/email-input/index.scss +16 -13
  29. package/scss/elements/fieldset/index.scss +15 -12
  30. package/scss/elements/file-input/index.scss +53 -50
  31. package/scss/elements/footer/index.scss +9 -6
  32. package/scss/elements/header-navigation/index.scss +101 -98
  33. package/scss/elements/heading-level-1/index.scss +6 -3
  34. package/scss/elements/heading-level-2/index.scss +6 -3
  35. package/scss/elements/heading-level-3/index.scss +6 -3
  36. package/scss/elements/heading-level-4/index.scss +6 -3
  37. package/scss/elements/heading-level-5/index.scss +6 -3
  38. package/scss/elements/heading-level-6/index.scss +6 -3
  39. package/scss/elements/horizontal-rule/index.scss +12 -9
  40. package/scss/elements/image/index.scss +6 -2
  41. package/scss/elements/inline-loading/index.scss +34 -31
  42. package/scss/elements/inline-quotation/index.scss +6 -3
  43. package/scss/elements/inserted-text/index.scss +9 -6
  44. package/scss/elements/italic-text/index.scss +5 -2
  45. package/scss/elements/keyboard-input/index.scss +9 -6
  46. package/scss/elements/label/index.scss +22 -19
  47. package/scss/elements/main/index.scss +7 -4
  48. package/scss/elements/marked-text/index.scss +7 -4
  49. package/scss/elements/menu/index.scss +71 -64
  50. package/scss/elements/meter/index.scss +45 -42
  51. package/scss/elements/number-input/index.scss +16 -12
  52. package/scss/elements/ordered-list/index.scss +25 -22
  53. package/scss/elements/paragraph/index.scss +8 -5
  54. package/scss/elements/password-input/index.scss +17 -13
  55. package/scss/elements/popover/index.scss +75 -72
  56. package/scss/elements/preformatted/index.scss +18 -15
  57. package/scss/elements/progress-bar/index.scss +71 -68
  58. package/scss/elements/radio-button/index.scss +35 -32
  59. package/scss/elements/range-input/index.scss +42 -39
  60. package/scss/elements/search-input/index.scss +21 -18
  61. package/scss/elements/select/index.scss +36 -33
  62. package/scss/elements/side-navigation/index.scss +141 -137
  63. package/scss/elements/small-text/index.scss +7 -4
  64. package/scss/elements/table/index.scss +93 -90
  65. package/scss/elements/tabs/index.scss +155 -152
  66. package/scss/elements/telephone-number-input/index.scss +16 -13
  67. package/scss/elements/text-area/index.scss +21 -18
  68. package/scss/elements/text-input/index.scss +16 -13
  69. package/scss/elements/tile/index.scss +49 -45
  70. package/scss/elements/time-input/index.scss +24 -21
  71. package/scss/elements/toggle/index.scss +71 -68
  72. package/scss/elements/tooltip/index.scss +16 -13
  73. package/scss/elements/tree-view/index.scss +86 -82
  74. package/scss/elements/unordered-list/index.scss +21 -18
  75. package/scss/elements/url-input/index.scss +16 -13
  76. package/scss/prebuilt/editorial/_elements.scss +37 -33
  77. package/scss/prebuilt/expressive/_elements.scss +75 -71
  78. package/scss/prebuilt/productive/_elements.scss +71 -67
  79. package/scss/utilities/_cascade-layer.scss +33 -0
@@ -13,6 +13,7 @@
13
13
  @use "@carbon/styles/scss/components/button/tokens" as carbon-button;
14
14
 
15
15
  @use "../../layout";
16
+ @use "../../utilities/cascade-layer";
16
17
  @use "../../utilities/guards";
17
18
 
18
19
  $config: () !default;
@@ -29,242 +30,244 @@ $-default-config: (
29
30
  @mixin styles($config: $config) {
30
31
  $props: map.deep-merge($-default-config, $config);
31
32
 
32
- #{map.get($props, "selector")} {
33
- @include layout.mode--body-compact;
34
- appearance: none;
35
- border: none;
36
- box-shadow: none;
37
- border-radius: 0;
38
- text-align: start;
39
- display: flex;
40
- block-size: layout.$size--block-size;
41
- padding-block-start: layout.$size--padding-block-start;
42
- padding-block-end: layout.$size--padding-block-end;
43
- padding-inline-start: layout.$density--padding;
44
- padding-inline-end: calc(layout.$density--padding + 1rem + layout.$density--padding);
45
- cursor: pointer;
46
- transition-property: color, background-color;
47
- transition-duration: layout.$mode--transition-duration;
48
- transition-timing-function: layout.$mode--transition-timing-function;
49
-
50
- &:focus {
51
- outline: 0.125rem solid theme.$focus;
52
- outline-offset: -0.125rem;
53
- box-shadow: inset 0 0 0 0.1875rem theme.$layer-background;
54
- }
55
-
56
- &:disabled {
57
- cursor: not-allowed;
58
- }
59
-
60
- & > svg {
61
- fill: currentColor;
62
- block-size: 1rem;
63
- inline-size: 1rem;
64
- translate: 0 0.125rem;
65
- }
66
-
67
- &:has(> svg:not(:only-child)) {
68
- padding-inline-end: layout.$density--padding;
33
+ @include cascade-layer.wrap {
34
+ #{map.get($props, "selector")} {
35
+ @include layout.mode--body-compact;
36
+ appearance: none;
37
+ border: none;
38
+ box-shadow: none;
39
+ border-radius: 0;
40
+ text-align: start;
41
+ display: flex;
42
+ block-size: layout.$size--block-size;
43
+ padding-block-start: layout.$size--padding-block-start;
44
+ padding-block-end: layout.$size--padding-block-end;
45
+ padding-inline-start: layout.$density--padding;
46
+ padding-inline-end: calc(layout.$density--padding + 1rem + layout.$density--padding);
47
+ cursor: pointer;
48
+ transition-property: color, background-color;
49
+ transition-duration: layout.$mode--transition-duration;
50
+ transition-timing-function: layout.$mode--transition-timing-function;
69
51
 
70
- & > svg {
71
- margin-inline-start: layout.$density--padding;
52
+ &:focus {
53
+ outline: 0.125rem solid theme.$focus;
54
+ outline-offset: -0.125rem;
55
+ box-shadow: inset 0 0 0 0.1875rem theme.$layer-background;
72
56
  }
73
- }
74
57
 
75
- &:has(> svg:only-child),
76
- &:has(> svg:first-child + [popover="hint"]:last-child) {
77
- padding-inline: unset;
78
- aspect-ratio: 1;
79
- justify-content: center;
58
+ &:disabled {
59
+ cursor: not-allowed;
60
+ }
80
61
 
81
62
  & > svg {
82
- margin-inline: 0;
63
+ fill: currentColor;
64
+ block-size: 1rem;
65
+ inline-size: 1rem;
66
+ translate: 0 0.125rem;
83
67
  }
84
- }
85
68
 
86
- @if map.get($props, "kind") == "primary" {
87
- background-color: carbon-button.$button-primary;
88
- color: theme.$text-on-color;
69
+ &:has(> svg:not(:only-child)) {
70
+ padding-inline-end: layout.$density--padding;
89
71
 
90
- @include guards.hover {
91
- &:enabled:hover {
92
- background-color: carbon-button.$button-primary-hover;
72
+ & > svg {
73
+ margin-inline-start: layout.$density--padding;
93
74
  }
94
75
  }
95
76
 
96
- &:active {
97
- background-color: carbon-button.$button-primary-active;
98
- }
77
+ &:has(> svg:only-child),
78
+ &:has(> svg:first-child + [popover="hint"]:last-child) {
79
+ padding-inline: unset;
80
+ aspect-ratio: 1;
81
+ justify-content: center;
99
82
 
100
- &:disabled {
101
- background-color: carbon-button.$button-disabled;
102
- color: theme.$text-on-color-disabled;
83
+ & > svg {
84
+ margin-inline: 0;
85
+ }
103
86
  }
104
- }
105
87
 
106
- @if map.get($props, "kind") == "secondary" {
107
- background-color: carbon-button.$button-secondary;
108
- color: theme.$text-on-color;
88
+ @if map.get($props, "kind") == "primary" {
89
+ background-color: carbon-button.$button-primary;
90
+ color: theme.$text-on-color;
109
91
 
110
- @include guards.hover {
111
- &:enabled:hover {
112
- background-color: carbon-button.$button-secondary-hover;
92
+ @include guards.hover {
93
+ &:enabled:hover {
94
+ background-color: carbon-button.$button-primary-hover;
95
+ }
113
96
  }
114
- }
115
97
 
116
- &:enabled:active {
117
- background-color: carbon-button.$button-secondary-active;
118
- }
98
+ &:active {
99
+ background-color: carbon-button.$button-primary-active;
100
+ }
119
101
 
120
- &:disabled {
121
- background-color: carbon-button.$button-disabled;
122
- color: theme.$text-on-color-disabled;
102
+ &:disabled {
103
+ background-color: carbon-button.$button-disabled;
104
+ color: theme.$text-on-color-disabled;
105
+ }
123
106
  }
124
- }
125
107
 
126
- @if map.get($props, "kind") == "tertiary" {
127
- background-color: transparent;
128
- color: carbon-button.$button-tertiary;
129
- outline: 0.0625rem solid carbon-button.$button-tertiary;
130
- outline-offset: -0.0625rem;
108
+ @if map.get($props, "kind") == "secondary" {
109
+ background-color: carbon-button.$button-secondary;
110
+ color: theme.$text-on-color;
131
111
 
132
- @include guards.hover {
133
- &:enabled:hover {
134
- color: theme.$text-inverse;
135
- background-color: carbon-button.$button-tertiary-hover;
112
+ @include guards.hover {
113
+ &:enabled:hover {
114
+ background-color: carbon-button.$button-secondary-hover;
115
+ }
136
116
  }
137
- }
138
117
 
139
- &:focus {
140
- color: theme.$text-inverse;
141
- background-color: carbon-button.$button-tertiary;
142
- }
118
+ &:enabled:active {
119
+ background-color: carbon-button.$button-secondary-active;
120
+ }
143
121
 
144
- &:enabled:active {
145
- background-color: carbon-button.$button-tertiary-active;
122
+ &:disabled {
123
+ background-color: carbon-button.$button-disabled;
124
+ color: theme.$text-on-color-disabled;
125
+ }
146
126
  }
147
127
 
148
- &:disabled {
149
- outline-color: carbon-button.$button-disabled;
150
- color: theme.$text-disabled;
151
- }
152
- }
128
+ @if map.get($props, "kind") == "tertiary" {
129
+ background-color: transparent;
130
+ color: carbon-button.$button-tertiary;
131
+ outline: 0.0625rem solid carbon-button.$button-tertiary;
132
+ outline-offset: -0.0625rem;
133
+
134
+ @include guards.hover {
135
+ &:enabled:hover {
136
+ color: theme.$text-inverse;
137
+ background-color: carbon-button.$button-tertiary-hover;
138
+ }
139
+ }
153
140
 
154
- @if map.get($props, "kind") == "ghost" {
155
- background-color: transparent;
156
- color: theme.$link-primary;
157
- padding-inline-end: layout.$density--padding;
141
+ &:focus {
142
+ color: theme.$text-inverse;
143
+ background-color: carbon-button.$button-tertiary;
144
+ }
158
145
 
159
- @include guards.hover {
160
- &:enabled:hover {
161
- color: theme.$link-primary-hover;
162
- background-color: theme.$layer-hover;
146
+ &:enabled:active {
147
+ background-color: carbon-button.$button-tertiary-active;
163
148
  }
164
- }
165
149
 
166
- &:enabled:active {
167
- background-color: theme.$layer-active;
150
+ &:disabled {
151
+ outline-color: carbon-button.$button-disabled;
152
+ color: theme.$text-disabled;
153
+ }
168
154
  }
169
155
 
170
- &:disabled {
171
- color: theme.$text-disabled;
172
- }
156
+ @if map.get($props, "kind") == "ghost" {
157
+ background-color: transparent;
158
+ color: theme.$link-primary;
159
+ padding-inline-end: layout.$density--padding;
173
160
 
174
- &:has(> svg:not(:only-child)) > svg {
175
- margin-inline-start: spacing.$spacing-03;
176
- }
161
+ @include guards.hover {
162
+ &:enabled:hover {
163
+ color: theme.$link-primary-hover;
164
+ background-color: theme.$layer-hover;
165
+ }
166
+ }
177
167
 
178
- & > svg:only-child,
179
- & > svg:first-child:has(+ [popover="hint"]:last-child) {
180
- color: theme.$icon-primary;
181
- }
168
+ &:enabled:active {
169
+ background-color: theme.$layer-active;
170
+ }
182
171
 
183
- &:disabled > svg:only-child,
184
- &:disabled > svg:first-child:has(+ [popover="hint"]:last-child) {
185
- color: theme.$icon-disabled;
186
- }
172
+ &:disabled {
173
+ color: theme.$text-disabled;
174
+ }
187
175
 
188
- &[aria-pressed="true"]:has(> svg:only-child),
189
- &[aria-pressed="true"]:has(> svg:first-child + [popover="hint"]:last-child) {
190
- background-color: theme.$background-selected;
191
- }
192
- }
176
+ &:has(> svg:not(:only-child)) > svg {
177
+ margin-inline-start: spacing.$spacing-03;
178
+ }
193
179
 
194
- @if map.get($props, "kind") == "danger--primary" {
195
- background-color: carbon-button.$button-danger-primary;
196
- color: theme.$text-on-color;
180
+ & > svg:only-child,
181
+ & > svg:first-child:has(+ [popover="hint"]:last-child) {
182
+ color: theme.$icon-primary;
183
+ }
197
184
 
198
- @include guards.hover {
199
- &:enabled:hover {
200
- background-color: carbon-button.$button-danger-hover;
185
+ &:disabled > svg:only-child,
186
+ &:disabled > svg:first-child:has(+ [popover="hint"]:last-child) {
187
+ color: theme.$icon-disabled;
201
188
  }
202
- }
203
189
 
204
- &:enabled:active {
205
- background-color: carbon-button.$button-danger-active;
190
+ &[aria-pressed="true"]:has(> svg:only-child),
191
+ &[aria-pressed="true"]:has(> svg:first-child + [popover="hint"]:last-child) {
192
+ background-color: theme.$background-selected;
193
+ }
206
194
  }
207
195
 
208
- &:disabled {
209
- background-color: carbon-button.$button-disabled;
210
- color: theme.$text-on-color-disabled;
211
- }
212
- }
196
+ @if map.get($props, "kind") == "danger--primary" {
197
+ background-color: carbon-button.$button-danger-primary;
198
+ color: theme.$text-on-color;
213
199
 
214
- @if map.get($props, "kind") == "danger--tertiary" {
215
- background-color: transparent;
216
- color: carbon-button.$button-danger-secondary;
217
- outline: 0.0625rem solid carbon-button.$button-danger-secondary;
218
- outline-offset: -0.0625rem;
200
+ @include guards.hover {
201
+ &:enabled:hover {
202
+ background-color: carbon-button.$button-danger-hover;
203
+ }
204
+ }
219
205
 
220
- @include guards.hover {
221
- &:enabled:hover {
222
- color: theme.$text-on-color;
223
- background-color: carbon-button.$button-danger-hover;
224
- outline-color: carbon-button.$button-danger-hover;
206
+ &:enabled:active {
207
+ background-color: carbon-button.$button-danger-active;
225
208
  }
226
- }
227
209
 
228
- &:focus {
229
- color: theme.$text-on-color;
230
- background-color: carbon-button.$button-danger-primary;
210
+ &:disabled {
211
+ background-color: carbon-button.$button-disabled;
212
+ color: theme.$text-on-color-disabled;
213
+ }
231
214
  }
232
215
 
233
- &:enabled:active {
234
- background-color: carbon-button.$button-danger-active;
235
- outline-color: carbon-button.$button-danger-active;
236
- }
216
+ @if map.get($props, "kind") == "danger--tertiary" {
217
+ background-color: transparent;
218
+ color: carbon-button.$button-danger-secondary;
219
+ outline: 0.0625rem solid carbon-button.$button-danger-secondary;
220
+ outline-offset: -0.0625rem;
221
+
222
+ @include guards.hover {
223
+ &:enabled:hover {
224
+ color: theme.$text-on-color;
225
+ background-color: carbon-button.$button-danger-hover;
226
+ outline-color: carbon-button.$button-danger-hover;
227
+ }
228
+ }
237
229
 
238
- &:disabled {
239
- outline-color: carbon-button.$button-disabled;
240
- color: theme.$text-disabled;
241
- }
242
- }
230
+ &:focus {
231
+ color: theme.$text-on-color;
232
+ background-color: carbon-button.$button-danger-primary;
233
+ }
243
234
 
244
- @if map.get($props, "kind") == "danger--ghost" {
245
- background-color: transparent;
246
- color: carbon-button.$button-danger-secondary;
247
- padding-inline-end: layout.$density--padding;
235
+ &:enabled:active {
236
+ background-color: carbon-button.$button-danger-active;
237
+ outline-color: carbon-button.$button-danger-active;
238
+ }
248
239
 
249
- @include guards.hover {
250
- &:enabled:hover {
251
- color: theme.$text-on-color;
252
- background-color: carbon-button.$button-danger-hover;
253
- outline-color: carbon-button.$button-danger-hover;
240
+ &:disabled {
241
+ outline-color: carbon-button.$button-disabled;
242
+ color: theme.$text-disabled;
254
243
  }
255
244
  }
256
245
 
257
- &:enabled:active {
258
- background-color: carbon-button.$button-danger-active;
259
- outline-color: carbon-button.$button-danger-active;
260
- }
246
+ @if map.get($props, "kind") == "danger--ghost" {
247
+ background-color: transparent;
248
+ color: carbon-button.$button-danger-secondary;
249
+ padding-inline-end: layout.$density--padding;
250
+
251
+ @include guards.hover {
252
+ &:enabled:hover {
253
+ color: theme.$text-on-color;
254
+ background-color: carbon-button.$button-danger-hover;
255
+ outline-color: carbon-button.$button-danger-hover;
256
+ }
257
+ }
261
258
 
262
- &:disabled {
263
- color: theme.$text-disabled;
264
- }
259
+ &:enabled:active {
260
+ background-color: carbon-button.$button-danger-active;
261
+ outline-color: carbon-button.$button-danger-active;
262
+ }
265
263
 
266
- &:has(> svg:not(:only-child)) > svg {
267
- margin-inline-start: spacing.$spacing-03;
264
+ &:disabled {
265
+ color: theme.$text-disabled;
266
+ }
267
+
268
+ &:has(> svg:not(:only-child)) > svg {
269
+ margin-inline-start: spacing.$spacing-03;
270
+ }
268
271
  }
269
272
  }
270
273
  }
@@ -14,6 +14,7 @@
14
14
  @use "../label";
15
15
 
16
16
  @use "../../layout";
17
+ @use "../../utilities/cascade-layer";
17
18
  @use "../../utilities/icons";
18
19
 
19
20
  $config: () !default;
@@ -28,50 +29,52 @@ $-default-config: (
28
29
  @mixin styles($config: $config) {
29
30
  $props: map.deep-merge($-default-config, $config);
30
31
 
31
- #{map.get($props, "selector")} {
32
- @include label.styles(
33
- (
34
- selector: "&",
35
- axis: "inline",
36
- )
37
- );
32
+ @include cascade-layer.wrap {
33
+ #{map.get($props, "selector")} {
34
+ @include label.styles(
35
+ (
36
+ selector: "&",
37
+ axis: "inline",
38
+ )
39
+ );
38
40
 
39
- justify-content: start;
40
- cursor: pointer;
41
+ justify-content: start;
42
+ cursor: pointer;
41
43
 
42
- & input[type="checkbox"] {
43
- grid-column: 1;
44
- position: relative;
45
- appearance: none;
46
- border: none;
47
- block-size: 1rem;
48
- inline-size: 1rem;
49
- color: theme.$icon-primary;
50
- border-radius: 0.125rem;
44
+ & input[type="checkbox"] {
45
+ grid-column: 1;
46
+ position: relative;
47
+ appearance: none;
48
+ border: none;
49
+ block-size: 1rem;
50
+ inline-size: 1rem;
51
+ color: theme.$icon-primary;
52
+ border-radius: 0.125rem;
51
53
 
52
- &:focus {
53
- @include focus-outline.focus-outline("outline");
54
- outline-offset: 0.125rem;
55
- }
54
+ &:focus {
55
+ @include focus-outline.focus-outline("outline");
56
+ outline-offset: 0.125rem;
57
+ }
56
58
 
57
- &:disabled {
58
- color: theme.$icon-disabled;
59
- }
59
+ &:disabled {
60
+ color: theme.$icon-disabled;
61
+ }
60
62
 
61
- &::before {
62
- content: "";
63
- position: absolute;
64
- inset: 0;
65
- @include icons.checkbox;
66
- scale: 1.25;
67
- }
63
+ &::before {
64
+ content: "";
65
+ position: absolute;
66
+ inset: 0;
67
+ @include icons.checkbox;
68
+ scale: 1.25;
69
+ }
68
70
 
69
- &:checked::before {
70
- @include icons.checkbox--checked--filled;
71
- }
71
+ &:checked::before {
72
+ @include icons.checkbox--checked--filled;
73
+ }
72
74
 
73
- &:indeterminate::before {
74
- @include icons.checkbox--indeterminate--filled;
75
+ &:indeterminate::before {
76
+ @include icons.checkbox--indeterminate--filled;
77
+ }
75
78
  }
76
79
  }
77
80
  }
@@ -11,6 +11,7 @@
11
11
  @use "@carbon/styles/scss/theme";
12
12
 
13
13
  @use "../../layout";
14
+ @use "../../utilities/cascade-layer";
14
15
 
15
16
  $config: () !default;
16
17
 
@@ -24,11 +25,13 @@ $-default-config: (
24
25
  @mixin styles($config: $config) {
25
26
  $props: map.deep-merge($-default-config, $config);
26
27
 
27
- #{map.get($props, "selector")} {
28
- @include layout.mode--code;
29
- background-color: theme.$layer;
30
- padding-inline: spacing.$spacing-01;
31
- border-radius: 0.0625rem;
32
- box-shadow: 0 0 0 0.125rem theme.$layer;
28
+ @include cascade-layer.wrap {
29
+ #{map.get($props, "selector")} {
30
+ @include layout.mode--code;
31
+ background-color: theme.$layer;
32
+ padding-inline: spacing.$spacing-01;
33
+ border-radius: 0.0625rem;
34
+ box-shadow: 0 0 0 0.125rem theme.$layer;
35
+ }
33
36
  }
34
37
  }