@carbon/element-styles 0.3.15 → 0.4.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.
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
@@ -19,6 +19,7 @@
19
19
  @use "../_layer";
20
20
 
21
21
  @use "../../layout";
22
+ @use "../../utilities/cascade-layer";
22
23
  @use "../../utilities/icons";
23
24
  @use "../../utilities/guards";
24
25
 
@@ -34,206 +35,208 @@ $-default-config: (
34
35
  @mixin styles($config: $config) {
35
36
  $props: map.deep-merge($-default-config, $config);
36
37
 
37
- #{map.get($props, "selector")} {
38
- position: relative;
39
- padding: 0;
40
-
41
- &:modal {
42
- @include layout.size("md");
43
- @include layout.density("normal");
44
- @include layer.styles;
45
-
46
- display: flex;
47
- flex-direction: column;
48
- color: theme.$text-primary;
49
- border: none;
50
- padding-inline: layout.$density--padding;
51
- box-shadow: none;
52
- margin: auto;
53
- box-sizing: border-box;
54
-
55
- &:focus {
56
- @include focus-outline.focus-outline("outline");
57
- }
38
+ @include cascade-layer.wrap {
39
+ #{map.get($props, "selector")} {
40
+ position: relative;
41
+ padding: 0;
58
42
 
59
- @include breakpoint.breakpoint("xlg") {
60
- inline-size: 48%;
61
- }
43
+ &:modal {
44
+ @include layout.size("md");
45
+ @include layout.density("normal");
46
+ @include layer.styles;
47
+
48
+ display: flex;
49
+ flex-direction: column;
50
+ color: theme.$text-primary;
51
+ border: none;
52
+ padding-inline: layout.$density--padding;
53
+ box-shadow: none;
54
+ margin: auto;
55
+ box-sizing: border-box;
56
+
57
+ &:focus {
58
+ @include focus-outline.focus-outline("outline");
59
+ }
62
60
 
63
- @include breakpoint.breakpoint-down("xlg") {
64
- inline-size: 60%;
65
- max-block-size: 84%;
66
- }
61
+ @include breakpoint.breakpoint("xlg") {
62
+ inline-size: 48%;
63
+ }
67
64
 
68
- @include breakpoint.breakpoint-down("lg") {
69
- inline-size: 84%;
70
- max-block-size: 90%;
65
+ @include breakpoint.breakpoint-down("xlg") {
66
+ inline-size: 60%;
67
+ max-block-size: 84%;
68
+ }
69
+
70
+ @include breakpoint.breakpoint-down("lg") {
71
+ inline-size: 84%;
72
+ max-block-size: 90%;
73
+ }
74
+
75
+ @include breakpoint.breakpoint-down("md") {
76
+ inline-size: 100%;
77
+ block-size: 100%;
78
+ max-inline-size: 100dvi;
79
+ max-block-size: 100dvb;
80
+ }
71
81
  }
72
82
 
73
- @include breakpoint.breakpoint-down("md") {
74
- inline-size: 100%;
75
- block-size: 100%;
76
- max-inline-size: 100dvi;
77
- max-block-size: 100dvb;
83
+ &:modal::backdrop {
84
+ background-color: theme.$overlay;
78
85
  }
79
- }
80
86
 
81
- &:modal::backdrop {
82
- background-color: theme.$overlay;
83
- }
87
+ &:modal header {
88
+ @include layout.mode--heading-level-4;
89
+ margin-block: layout.$density--padding;
90
+ margin-inline-end: calc(layout.$size--block-size + spacing.$spacing-05);
91
+ }
84
92
 
85
- &:modal header {
86
- @include layout.mode--heading-level-4;
87
- margin-block: layout.$density--padding;
88
- margin-inline-end: calc(layout.$size--block-size + spacing.$spacing-05);
89
- }
93
+ &:modal footer {
94
+ @include layout.size("xl");
95
+ display: grid;
96
+ grid-template-columns: repeat(4, 1fr);
97
+ margin-inline: calc(layout.$density--padding * -1);
98
+ margin-block-start: spacing.$spacing-09;
99
+ }
90
100
 
91
- &:modal footer {
92
- @include layout.size("xl");
93
- display: grid;
94
- grid-template-columns: repeat(4, 1fr);
95
- margin-inline: calc(layout.$density--padding * -1);
96
- margin-block-start: spacing.$spacing-09;
97
- }
101
+ &:modal:not(:has(footer)) {
102
+ padding-block-end: spacing.$spacing-09;
103
+ }
98
104
 
99
- &:modal:not(:has(footer)) {
100
- padding-block-end: spacing.$spacing-09;
101
- }
105
+ // single button
106
+ &:modal footer > button:only-child {
107
+ grid-column: 3 / span 2;
108
+ @include button.styles(
109
+ (
110
+ selector: "&",
111
+ kind: "primary",
112
+ )
113
+ );
114
+ }
102
115
 
103
- // single button
104
- &:modal footer > button:only-child {
105
- grid-column: 3 / span 2;
106
- @include button.styles(
107
- (
108
- selector: "&",
109
- kind: "primary",
110
- )
111
- );
112
- }
116
+ // two buttons
117
+ &:modal footer > button:first-child:has(+ button:last-child) {
118
+ grid-column: 1 / span 2;
119
+ @include button.styles(
120
+ (
121
+ selector: "&",
122
+ kind: "secondary",
123
+ )
124
+ );
125
+ }
113
126
 
114
- // two buttons
115
- &:modal footer > button:first-child:has(+ button:last-child) {
116
- grid-column: 1 / span 2;
117
- @include button.styles(
118
- (
119
- selector: "&",
120
- kind: "secondary",
121
- )
122
- );
123
- }
127
+ &:modal footer > button:first-child + button:last-child {
128
+ grid-column: 3 / span 2;
129
+ @include button.styles(
130
+ (
131
+ selector: "&",
132
+ kind: "primary",
133
+ )
134
+ );
135
+ }
124
136
 
125
- &:modal footer > button:first-child + button:last-child {
126
- grid-column: 3 / span 2;
127
- @include button.styles(
128
- (
129
- selector: "&",
130
- kind: "primary",
131
- )
132
- );
133
- }
137
+ // three buttons
138
+ &:modal footer > button:first-child:not(:has(+ button:last-child), :last-child) {
139
+ grid-column: 1;
140
+ @include button.styles(
141
+ (
142
+ selector: "&",
143
+ kind: "ghost",
144
+ )
145
+ );
146
+ }
134
147
 
135
- // three buttons
136
- &:modal footer > button:first-child:not(:has(+ button:last-child), :last-child) {
137
- grid-column: 1;
138
- @include button.styles(
139
- (
140
- selector: "&",
141
- kind: "ghost",
142
- )
143
- );
144
- }
148
+ &:modal footer > button:not(:first-child):has(+ button:last-child) {
149
+ grid-column: 3;
150
+ @include button.styles(
151
+ (
152
+ selector: "&",
153
+ kind: "secondary",
154
+ )
155
+ );
156
+ }
145
157
 
146
- &:modal footer > button:not(:first-child):has(+ button:last-child) {
147
- grid-column: 3;
148
- @include button.styles(
149
- (
150
- selector: "&",
151
- kind: "secondary",
152
- )
153
- );
154
- }
158
+ &:modal footer > button:not(:first-child) + button:last-child {
159
+ grid-column: 4;
160
+ @include button.styles(
161
+ (
162
+ selector: "&",
163
+ kind: "primary",
164
+ )
165
+ );
166
+ }
155
167
 
156
- &:modal footer > button:not(:first-child) + button:last-child {
157
- grid-column: 4;
158
- @include button.styles(
159
- (
160
- selector: "&",
161
- kind: "primary",
162
- )
163
- );
164
- }
168
+ // header close button
169
+ &:modal header > button {
170
+ position: absolute;
171
+ inset-block-start: 0;
172
+ inset-inline-end: 0;
173
+ appearance: none;
174
+ box-shadow: none;
175
+ border: none;
176
+ border-radius: 0;
177
+ padding: 0;
178
+ background-color: transparent;
179
+ color: theme.$icon-primary;
180
+ block-size: layout.$size--block-size;
181
+ inline-size: layout.$size--block-size;
182
+ display: flex;
183
+ align-items: center;
184
+ justify-content: center;
185
+ cursor: pointer;
186
+ transition: background-color layout.$mode--transition-duration
187
+ layout.$mode--transition-timing-function;
188
+
189
+ @include guards.hover {
190
+ &:hover {
191
+ background-color: theme.$layer-hover;
192
+ }
193
+ }
165
194
 
166
- // header close button
167
- &:modal header > button {
168
- position: absolute;
169
- inset-block-start: 0;
170
- inset-inline-end: 0;
171
- appearance: none;
172
- box-shadow: none;
173
- border: none;
174
- border-radius: 0;
175
- padding: 0;
176
- background-color: transparent;
177
- color: theme.$icon-primary;
178
- block-size: layout.$size--block-size;
179
- inline-size: layout.$size--block-size;
180
- display: flex;
181
- align-items: center;
182
- justify-content: center;
183
- cursor: pointer;
184
- transition: background-color layout.$mode--transition-duration
185
- layout.$mode--transition-timing-function;
186
-
187
- @include guards.hover {
188
- &:hover {
189
- background-color: theme.$layer-hover;
195
+ &:active {
196
+ background-color: theme.$layer-active;
190
197
  }
191
- }
192
198
 
193
- &:active {
194
- background-color: theme.$layer-active;
199
+ &:focus {
200
+ @include focus-outline.focus-outline("outline");
201
+ }
195
202
  }
196
203
 
197
- &:focus {
198
- @include focus-outline.focus-outline("outline");
204
+ &:modal header > button::after {
205
+ @include icons.close($size: 1.25rem);
206
+ display: block;
207
+ inset: 0;
208
+ content: "";
199
209
  }
200
- }
201
-
202
- &:modal header > button::after {
203
- @include icons.close($size: 1.25rem);
204
- display: block;
205
- inset: 0;
206
- content: "";
207
- }
208
210
 
209
- // entry animation
210
- &[open]:modal {
211
- translate: 0 0;
212
- opacity: 1;
213
- transition-property: opacity;
214
- transition-duration: motion.$duration-moderate-02;
215
- transition-timing-function: layout.$mode--transition-timing-function;
216
-
217
- @include guards.motion {
218
- transition-property: opacity, translate;
211
+ // entry animation
212
+ &[open]:modal {
213
+ translate: 0 0;
214
+ opacity: 1;
215
+ transition-property: opacity;
216
+ transition-duration: motion.$duration-moderate-02;
217
+ transition-timing-function: layout.$mode--transition-timing-function;
218
+
219
+ @include guards.motion {
220
+ transition-property: opacity, translate;
221
+
222
+ @starting-style {
223
+ opacity: 0;
224
+ translate: 0 -1.5rem;
225
+ }
226
+ }
219
227
 
220
228
  @starting-style {
221
229
  opacity: 0;
222
- translate: 0 -1.5rem;
223
230
  }
224
231
  }
225
232
 
226
- @starting-style {
227
- opacity: 0;
228
- }
229
- }
230
-
231
- &[open]:modal::backdrop {
232
- opacity: 1;
233
- transition: inherit;
233
+ &[open]:modal::backdrop {
234
+ opacity: 1;
235
+ transition: inherit;
234
236
 
235
- @starting-style {
236
- opacity: 0;
237
+ @starting-style {
238
+ opacity: 0;
239
+ }
237
240
  }
238
241
  }
239
242
  }
@@ -10,6 +10,7 @@
10
10
  @use "../_labelled-input";
11
11
 
12
12
  @use "../../layout";
13
+ @use "../../utilities/cascade-layer";
13
14
 
14
15
  $config: () !default;
15
16
 
@@ -25,18 +26,20 @@ $-default-config: (
25
26
  @mixin styles($config: $config) {
26
27
  $props: map.deep-merge($-default-config, $config);
27
28
 
28
- #{map.get($props, "selector")} {
29
- @include labelled-input.styles(
30
- (
31
- label: (
32
- selector: "&",
33
- axis: map.get($props, "axis"),
34
- ),
35
- input: (
36
- selector: 'input[type="email"]',
37
- ),
38
- input-invalid-slot: "after",
39
- )
40
- );
29
+ @include cascade-layer.wrap {
30
+ #{map.get($props, "selector")} {
31
+ @include labelled-input.styles(
32
+ (
33
+ label: (
34
+ selector: "&",
35
+ axis: map.get($props, "axis"),
36
+ ),
37
+ input: (
38
+ selector: 'input[type="email"]',
39
+ ),
40
+ input-invalid-slot: "after",
41
+ )
42
+ );
43
+ }
41
44
  }
42
45
  }
@@ -12,6 +12,7 @@
12
12
  @use "../label";
13
13
 
14
14
  @use "../../layout";
15
+ @use "../../utilities/cascade-layer";
15
16
 
16
17
  $config: () !default;
17
18
 
@@ -25,19 +26,21 @@ $-default-config: (
25
26
  @mixin styles($config: $config) {
26
27
  $props: map.deep-merge($-default-config, $config);
27
28
 
28
- #{map.get($props, "selector")} {
29
- border: none;
30
- padding: 0;
31
- margin-block: layout.$mode--margin-block;
32
-
33
- & legend {
34
- @include label.styles(
35
- (
36
- selector: "&",
37
- )
38
- );
29
+ @include cascade-layer.wrap {
30
+ #{map.get($props, "selector")} {
31
+ border: none;
39
32
  padding: 0;
40
- margin-block-end: spacing.$spacing-03;
33
+ margin-block: layout.$mode--margin-block;
34
+
35
+ & legend {
36
+ @include label.styles(
37
+ (
38
+ selector: "&",
39
+ )
40
+ );
41
+ padding: 0;
42
+ margin-block-end: spacing.$spacing-03;
43
+ }
41
44
  }
42
45
  }
43
46
  }
@@ -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;
@@ -27,69 +28,71 @@ $-default-config: (
27
28
  @mixin styles($config: $config) {
28
29
  $props: map.deep-merge($-default-config, $config);
29
30
 
30
- #{map.get($props, "selector")} {
31
- @include layout.mode--heading-compact;
32
- display: flex;
33
- flex-direction: column;
34
- row-gap: spacing.$spacing-03;
31
+ @include cascade-layer.wrap {
32
+ #{map.get($props, "selector")} {
33
+ @include layout.mode--heading-compact;
34
+ display: flex;
35
+ flex-direction: column;
36
+ row-gap: spacing.$spacing-03;
35
37
 
36
- & input[type="file"]:focus {
37
- outline: none;
38
- box-shadow: none;
39
- }
38
+ & input[type="file"]:focus {
39
+ outline: none;
40
+ box-shadow: none;
41
+ }
40
42
 
41
- & input[type="file"]:focus::file-selector-button {
42
- outline: 0.125rem solid theme.$focus;
43
- outline-offset: -0.125rem;
44
- box-shadow: inset 0 0 0 0.1875rem theme.$layer-background;
45
- }
43
+ & input[type="file"]:focus::file-selector-button {
44
+ outline: 0.125rem solid theme.$focus;
45
+ outline-offset: -0.125rem;
46
+ box-shadow: inset 0 0 0 0.1875rem theme.$layer-background;
47
+ }
46
48
 
47
- & input[type="file"]::file-selector-button {
48
- @include layout.mode--body-compact;
49
- appearance: none;
50
- border: none;
51
- box-shadow: none;
52
- border-radius: 0;
53
- text-align: start;
54
- background-color: carbon-button.$button-primary;
55
- color: theme.$text-on-color;
56
- block-size: layout.$size--block-size;
57
- padding-block-start: layout.$size--padding-block-start;
58
- padding-block-end: layout.$size--padding-block-end;
59
- padding-inline-start: layout.$density--padding;
60
- padding-inline-end: calc(layout.$density--padding + 1rem + layout.$density--padding);
61
- cursor: pointer;
62
- transition: background-color layout.$mode--transition-duration
63
- layout.$mode--transition-timing-function;
49
+ & input[type="file"]::file-selector-button {
50
+ @include layout.mode--body-compact;
51
+ appearance: none;
52
+ border: none;
53
+ box-shadow: none;
54
+ border-radius: 0;
55
+ text-align: start;
56
+ background-color: carbon-button.$button-primary;
57
+ color: theme.$text-on-color;
58
+ block-size: layout.$size--block-size;
59
+ padding-block-start: layout.$size--padding-block-start;
60
+ padding-block-end: layout.$size--padding-block-end;
61
+ padding-inline-start: layout.$density--padding;
62
+ padding-inline-end: calc(layout.$density--padding + 1rem + layout.$density--padding);
63
+ cursor: pointer;
64
+ transition: background-color layout.$mode--transition-duration
65
+ layout.$mode--transition-timing-function;
64
66
 
65
- @include guards.hover {
66
- &:hover {
67
- background-color: carbon-button.$button-primary-hover;
67
+ @include guards.hover {
68
+ &:hover {
69
+ background-color: carbon-button.$button-primary-hover;
70
+ }
68
71
  }
69
- }
70
72
 
71
- &:active {
72
- background-color: carbon-button.$button-primary-active;
73
+ &:active {
74
+ background-color: carbon-button.$button-primary-active;
75
+ }
73
76
  }
74
- }
75
77
 
76
- &:has([disabled]) {
77
- color: theme.$text-disabled;
78
- }
79
-
80
- & input[type="file"]:disabled::file-selector-button,
81
- & input[type="file"]:disabled::file-selector-button:active {
82
- cursor: not-allowed;
83
- background-color: carbon-button.$button-disabled;
84
- color: theme.$text-on-color-disabled;
85
- }
78
+ &:has([disabled]) {
79
+ color: theme.$text-disabled;
80
+ }
86
81
 
87
- @include guards.hover {
88
- & input[type="file"]:disabled::file-selector-button:hover {
82
+ & input[type="file"]:disabled::file-selector-button,
83
+ & input[type="file"]:disabled::file-selector-button:active {
89
84
  cursor: not-allowed;
90
85
  background-color: carbon-button.$button-disabled;
91
86
  color: theme.$text-on-color-disabled;
92
87
  }
88
+
89
+ @include guards.hover {
90
+ & input[type="file"]:disabled::file-selector-button:hover {
91
+ cursor: not-allowed;
92
+ background-color: carbon-button.$button-disabled;
93
+ color: theme.$text-on-color-disabled;
94
+ }
95
+ }
93
96
  }
94
97
  }
95
98
  }
@@ -11,6 +11,7 @@
11
11
  @use "@carbon/styles/scss/spacing";
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--body-compact;
29
- color: theme.$text-secondary;
30
- border-block-start: 0.0625rem solid theme.$border-subtle;
31
- padding-inline: spacing.$spacing-07;
32
- padding-block: layout.$density--padding;
28
+ @include cascade-layer.wrap {
29
+ #{map.get($props, "selector")} {
30
+ @include layout.mode--body-compact;
31
+ color: theme.$text-secondary;
32
+ border-block-start: 0.0625rem solid theme.$border-subtle;
33
+ padding-inline: spacing.$spacing-07;
34
+ padding-block: layout.$density--padding;
35
+ }
33
36
  }
34
37
  }