@carbon/styles 1.31.1 → 1.32.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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@carbon/styles",
3
3
  "description": "Styles for the Carbon Design System",
4
- "version": "1.31.1",
4
+ "version": "1.32.0-rc.0",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
@@ -59,5 +59,5 @@
59
59
  "scss/**/*.css",
60
60
  "css/**/*.css"
61
61
  ],
62
- "gitHead": "4d5dedb5de37b8c55b004c787146b4df6f218670"
62
+ "gitHead": "fe40fbf428231bd35f6bc8cc871ea09c7afa5051"
63
63
  }
package/scss/_layout.scss CHANGED
@@ -11,10 +11,29 @@
11
11
  @use './config' as *;
12
12
  @use './utilities/custom-property';
13
13
  @use './utilities/convert' as *;
14
- @use './utilities/layout' as *;
14
+ @use './spacing' as *;
15
+
16
+ $layout-tokens: (
17
+ size: (
18
+ height: (
19
+ xs: rem(24px),
20
+ sm: rem(32px),
21
+ md: rem(40px),
22
+ lg: rem(48px),
23
+ xl: rem(64px),
24
+ 2xl: rem(80px),
25
+ ),
26
+ ),
27
+ density: (
28
+ padding-inline: (
29
+ condensed: $spacing-03,
30
+ normal: $spacing-05,
31
+ ),
32
+ ),
33
+ );
15
34
 
16
35
  :root {
17
- @each $group, $properties in $tokens {
36
+ @each $group, $properties in $layout-tokens {
18
37
  @each $property, $steps in $properties {
19
38
  @each $step, $value in $steps {
20
39
  @include custom-property.declaration(
@@ -39,7 +58,7 @@
39
58
  }
40
59
  }
41
60
 
42
- @each $group, $properties in $tokens {
61
+ @each $group, $properties in $layout-tokens {
43
62
  @each $property, $steps in $properties {
44
63
  @each $step, $value in $steps {
45
64
  .#{$prefix}--layout--#{$group}-#{$step} {
@@ -56,7 +75,7 @@
56
75
  );
57
76
  }
58
77
 
59
- .#{$prefix}--layout-constraint--#{$group}\:default-#{$step} {
78
+ .#{$prefix}--layout-constraint--#{$group}__default-#{$step} {
60
79
  @include custom-property.declaration(
61
80
  'layout-#{$group}-#{$property}',
62
81
  custom-property.get-var(
@@ -70,7 +89,7 @@
70
89
  }
71
90
 
72
91
  @each $constraint in ('min', 'max') {
73
- .#{$prefix}--layout-constraint--#{$group}\:#{$constraint}-#{$step} {
92
+ .#{$prefix}--layout-constraint--#{$group}__#{$constraint}-#{$step} {
74
93
  @include custom-property.declaration(
75
94
  'layout-#{$group}-#{$property}-#{$constraint}',
76
95
  custom-property.get-var(
@@ -156,6 +156,7 @@
156
156
  );
157
157
 
158
158
  > :first-child {
159
+ min-width: rem(16px);
159
160
  margin-block-start: rem(1px);
160
161
  }
161
162
 
@@ -5,6 +5,8 @@
5
5
  // LICENSE file in the root directory of this source tree.
6
6
  //
7
7
 
8
+ @use 'sass:map';
9
+
8
10
  @use 'vars' as *;
9
11
  @use '../../config' as *;
10
12
  @use '../../motion' as *;
@@ -21,10 +23,16 @@ $button-focus-color: custom-property.get-var('button-focus-color', $focus);
21
23
 
22
24
  @mixin button-base {
23
25
  // https://caniuse.com/mdn-css_types_length_lh
24
- --temp-1lh: (var(--#{$prefix}-body-compact-01-line-height) * 1em);
26
+ --temp-1lh: (
27
+ #{custom-property.get-var(
28
+ 'body-compact-01-line-height',
29
+ map.get($body-compact-01, line-height)
30
+ )} * 1em
31
+ );
25
32
  // -1px to compensate for border width
26
33
  --temp-padding-block-max: calc(
27
- (var(--#{$prefix}-layout-size-height-lg) - var(--temp-1lh)) / 2 - #{rem(1px)}
34
+ (#{custom-property.get-var('layout-size-height-lg')} - var(--temp-1lh)) / 2 -
35
+ #{rem(1px)}
28
36
  );
29
37
 
30
38
  @include component-reset.reset;
@@ -5,7 +5,7 @@
5
5
  // LICENSE file in the root directory of this source tree.
6
6
  //
7
7
 
8
- @use 'sass:list';
8
+ @use 'sass:map';
9
9
 
10
10
  @use '../../config' as *;
11
11
  @use '../../motion' as *;
@@ -15,6 +15,7 @@
15
15
  @use '../../utilities/button-reset';
16
16
  @use '../../utilities/convert' as *;
17
17
  @use '../../utilities/focus-outline' as *;
18
+ @use '../../utilities/custom-property';
18
19
  @use '../../utilities/layout';
19
20
 
20
21
  /// Contained List styles
@@ -26,6 +27,11 @@
26
27
  @include layout.use('density', $default: 'normal');
27
28
  }
28
29
 
30
+ .#{$prefix}--contained-list > ul {
31
+ padding: 0;
32
+ margin: 0;
33
+ }
34
+
29
35
  .#{$prefix}--contained-list__header {
30
36
  position: sticky;
31
37
  z-index: 1;
@@ -126,12 +132,17 @@
126
132
 
127
133
  .#{$prefix}--contained-list-item {
128
134
  position: relative;
135
+ list-style: none;
129
136
  }
130
137
 
131
138
  .#{$prefix}--contained-list-item:not(:first-of-type) {
132
139
  margin-top: -1px;
133
140
  }
134
141
 
142
+ .#{$prefix}--contained-list-item__content {
143
+ box-sizing: border-box;
144
+ }
145
+
135
146
  .#{$prefix}--contained-list-item--clickable
136
147
  .#{$prefix}--contained-list-item__content {
137
148
  @include button-reset.reset;
@@ -145,7 +156,12 @@
145
156
  .#{$prefix}--contained-list-item--clickable
146
157
  .#{$prefix}--contained-list-item__content {
147
158
  // https://caniuse.com/mdn-css_types_length_lh
148
- --temp-1lh: (var(--#{$prefix}-body-01-line-height) * 1em);
159
+ --temp-1lh: (
160
+ #{custom-property.get-var(
161
+ 'body-01-line-height',
162
+ map.get($body-01, line-height)
163
+ )} * 1em
164
+ );
149
165
 
150
166
  @include type-style('body-01');
151
167
 
@@ -197,11 +213,8 @@
197
213
  @include focus-outline('outline');
198
214
 
199
215
  position: absolute;
200
- top: 0;
201
- right: 0;
202
- bottom: 0;
203
- left: 0;
204
216
  content: '';
217
+ inset: 0;
205
218
  }
206
219
 
207
220
  .#{$prefix}--contained-list-item--with-action
@@ -13,7 +13,6 @@
13
13
  @use '../../../utilities/button-reset';
14
14
  @use '../../../utilities/convert' as *;
15
15
  @use '../../../utilities/focus-outline' as *;
16
- @use '../../button/vars' as *;
17
16
 
18
17
  /// Data table action styles
19
18
  /// @access public
@@ -411,7 +410,8 @@
411
410
  }
412
411
 
413
412
  .#{$prefix}--action-list .#{$prefix}--btn {
414
- padding: $button-padding-ghost;
413
+ padding-right: $spacing-05;
414
+ padding-left: $spacing-05;
415
415
  color: $text-on-color;
416
416
  white-space: nowrap;
417
417
  }
@@ -58,35 +58,26 @@
58
58
  }
59
59
 
60
60
  .#{$prefix}--search--fluid .#{$prefix}--search-magnifier-icon {
61
- top: auto;
62
- right: 1rem;
63
- bottom: rem(13px);
64
- left: auto;
61
+ inset: auto 1rem rem(13px) auto;
65
62
  transform: none;
66
63
  }
67
64
 
68
65
  .#{$prefix}--search--fluid .#{$prefix}--search-close {
69
- top: auto;
70
- right: rem(48px);
71
- bottom: 0;
72
- left: auto;
73
66
  width: rem(40px);
74
67
  height: rem(40px);
75
68
  border: none;
69
+ inset: auto rem(48px) 0 auto;
76
70
  transition: background-color $duration-fast-01 motion(standard, productive);
77
71
  }
78
72
 
79
73
  .#{$prefix}--search--fluid .#{$prefix}--search-close::before {
80
74
  position: absolute;
81
- top: auto;
82
- right: rem(-1px);
83
- bottom: rem(14px);
84
- left: auto;
85
75
  display: block;
86
76
  width: rem(1px);
87
77
  height: 1rem;
88
78
  background: $border-subtle;
89
79
  content: '';
80
+ inset: auto rem(-1px) rem(14px) auto;
90
81
  }
91
82
 
92
83
  .#{$prefix}--search--fluid
@@ -315,7 +315,8 @@
315
315
 
316
316
  /* Tertiary action button when not inline (toast) */
317
317
  .#{$prefix}--actionable-notification__action-button.#{$prefix}--btn--tertiary {
318
- padding: 0 $spacing-05;
318
+ padding-right: $spacing-05;
319
+ padding-left: $spacing-05;
319
320
  margin-bottom: $spacing-05;
320
321
 
321
322
  // Button should be left aligned with text.
@@ -110,11 +110,8 @@ $popover-caret-height: custom-property.get-var(
110
110
  .#{$prefix}--popover {
111
111
  position: absolute;
112
112
  z-index: z('floating');
113
- top: 0;
114
- right: 0;
115
- bottom: 0;
116
- left: 0;
117
113
  filter: $popover-drop-shadow;
114
+ inset: 0;
118
115
  pointer-events: none;
119
116
  }
120
117
 
@@ -68,10 +68,6 @@
68
68
  .#{$prefix}--progress-bar--indeterminate
69
69
  .#{$prefix}--progress-bar__track::after {
70
70
  position: absolute;
71
- top: 0;
72
- right: 0;
73
- bottom: 0;
74
- left: 0;
75
71
  animation-duration: 1400ms;
76
72
  animation-iteration-count: infinite;
77
73
  animation-name: progress-bar-indeterminate;
@@ -84,6 +80,7 @@
84
80
  background-position-x: 0%;
85
81
  background-size: 200% 100%;
86
82
  content: '';
83
+ inset: 0;
87
84
  }
88
85
 
89
86
  .#{$prefix}--progress-bar__helper-text {
@@ -16,6 +16,10 @@
16
16
  @use '../../utilities/focus-outline' as *;
17
17
  @use '../../utilities/high-contrast-mode' as *;
18
18
  @use '../../utilities/visually-hidden' as *;
19
+ @use '../../utilities/layout';
20
+
21
+ // padding + icon size (1rem) + padding
22
+ $-icon-container-size: calc(#{layout.density('padding-inline')} * 2 + 1rem);
19
23
 
20
24
  /// Tile styles
21
25
  /// @access public
@@ -26,11 +30,13 @@
26
30
  }
27
31
 
28
32
  .#{$prefix}--tile {
33
+ @include layout.use('density', $default: 'normal');
34
+
29
35
  position: relative;
30
36
  display: block;
31
37
  min-width: 8rem;
32
38
  min-height: 4rem;
33
- padding: $spacing-05;
39
+ padding: layout.density('padding-inline');
34
40
  background-color: $layer;
35
41
  outline: 2px solid transparent;
36
42
  outline-offset: -2px;
@@ -99,7 +105,6 @@
99
105
  .#{$prefix}--tile--clickable.#{$prefix}--link--disabled,
100
106
  .#{$prefix}--tile--clickable:hover.#{$prefix}--link--disabled {
101
107
  display: block;
102
- padding: $spacing-05;
103
108
  background-color: $layer;
104
109
  color: $text-disabled;
105
110
  cursor: not-allowed;
@@ -116,8 +121,8 @@
116
121
  .#{$prefix}--tile--clickable.#{$prefix}--link--disabled
117
122
  .#{$prefix}--tile--disabled-icon {
118
123
  position: absolute;
119
- right: 1rem;
120
- bottom: 1rem;
124
+ right: layout.density('padding-inline');
125
+ bottom: layout.density('padding-inline');
121
126
  }
122
127
 
123
128
  .#{$prefix}--tile--clickable .#{$prefix}--tile--icon {
@@ -135,8 +140,8 @@
135
140
  }
136
141
 
137
142
  .#{$prefix}--tile--selectable {
138
- padding-right: $spacing-09;
139
143
  border: 1px solid transparent;
144
+ padding-inline-end: $-icon-container-size;
140
145
 
141
146
  @if (
142
147
  enabled('enable-experimental-tile-contrast') or
@@ -148,8 +153,8 @@
148
153
 
149
154
  .#{$prefix}--tile__checkmark {
150
155
  position: absolute;
151
- top: 1rem;
152
- right: 1rem;
156
+ top: layout.density('padding-inline');
157
+ right: layout.density('padding-inline');
153
158
  height: 1rem;
154
159
  border: none;
155
160
  background: transparent;
@@ -175,8 +180,8 @@
175
180
  right: 0;
176
181
  bottom: 0;
177
182
  display: flex;
178
- width: $spacing-09;
179
- height: $spacing-09;
183
+ width: $-icon-container-size;
184
+ height: $-icon-container-size;
180
185
  align-items: center;
181
186
  justify-content: center;
182
187
 
@@ -205,8 +210,8 @@
205
210
  right: 0;
206
211
  bottom: 0;
207
212
  display: flex;
208
- width: $spacing-09;
209
- height: $spacing-09;
213
+ width: $-icon-container-size;
214
+ height: $-icon-container-size;
210
215
  align-items: center;
211
216
  justify-content: center;
212
217
 
@@ -77,10 +77,8 @@
77
77
  .#{$prefix}--toggle__button:focus
78
78
  + .#{$prefix}--toggle__label
79
79
  .#{$prefix}--toggle__switch,
80
- .#{$prefix}--toggle__button:not(:disabled):active
81
- + .#{$prefix}--toggle__label
82
- .#{$prefix}--toggle__switch,
83
- .#{$prefix}--toggle:active .#{$prefix}--toggle__switch {
80
+ .#{$prefix}--toggle:not(.#{$prefix}--toggle--disabled):active
81
+ .#{$prefix}--toggle__switch {
84
82
  box-shadow: 0 0 0 1px $focus-inset, 0 0 0 3px $focus;
85
83
  }
86
84
 
@@ -192,10 +190,30 @@
192
190
  .#{$prefix}--toggle__button:focus
193
191
  + .#{$prefix}--toggle__label
194
192
  .#{$prefix}--toggle__switch,
195
- .#{$prefix}--toggle__button:not(:disabled):active
196
- + .#{$prefix}--toggle__label
197
- .#{$prefix}--toggle__switch,
198
- .#{$prefix}--toggle:active .#{$prefix}--toggle__switch {
193
+ .#{$prefix}--toggle:not(.#{$prefix}--toggle--disabled):active
194
+ .#{$prefix}--toggle__switch {
199
195
  @include high-contrast-mode('focus');
200
196
  }
197
+
198
+ // Skeleton state
199
+ .#{$prefix}--toggle--skeleton {
200
+ display: flex;
201
+ align-items: center;
202
+ }
203
+
204
+ .#{$prefix}--toggle--skeleton .#{$prefix}--toggle__skeleton-circle {
205
+ @include circular-skeleton;
206
+
207
+ width: rem(18px);
208
+ height: rem(18px);
209
+ border-radius: 50%;
210
+ }
211
+
212
+ .#{$prefix}--toggle--skeleton .#{$prefix}--toggle__skeleton-rectangle {
213
+ @include skeleton;
214
+
215
+ width: rem(24px);
216
+ height: rem(8px);
217
+ margin-left: rem(8px);
218
+ }
201
219
  }
@@ -48,6 +48,10 @@
48
48
  }
49
49
  }
50
50
 
51
+ .#{$prefix}--header__global .#{$prefix}--popover {
52
+ z-index: z('header') + 1;
53
+ }
54
+
51
55
  .#{$prefix}--header__action > :first-child {
52
56
  margin-block-start: 0;
53
57
  }
@@ -8,28 +8,8 @@
8
8
  @use 'sass:map';
9
9
 
10
10
  @use '../config';
11
- @use '../spacing' as *;
11
+ @use '../layout' as *;
12
12
  @use './custom-property';
13
- @use './convert' as *;
14
-
15
- $tokens: (
16
- size: (
17
- height: (
18
- xs: rem(24px),
19
- sm: rem(32px),
20
- md: rem(40px),
21
- lg: rem(48px),
22
- xl: rem(64px),
23
- 2xl: rem(80px),
24
- ),
25
- ),
26
- density: (
27
- padding-inline: (
28
- condensed: $spacing-03,
29
- normal: $spacing-05,
30
- ),
31
- ),
32
- );
33
13
 
34
14
  /// Enables the use of contextual layout tokens within a component. This mixin should be
35
15
  /// included on the outermost selector of the component.
@@ -41,7 +21,7 @@ $tokens: (
41
21
  /// @group utilities
42
22
  /// @access public
43
23
  @mixin use($group, $default, $min: null, $max: null) {
44
- $properties: map.get($tokens, $group);
24
+ $properties: map.get($layout-tokens, $group);
45
25
 
46
26
  @each $property, $steps in $properties {
47
27
  $minValue: custom-property.get-var('layout-#{$group}-#{$property}-min');
@@ -106,7 +86,7 @@ $tokens: (
106
86
  }
107
87
 
108
88
  /// Internal base function for retrieving a property from a layout group.
109
- /// @param {String} $group - The group name as defined in the $tokens
89
+ /// @param {String} $group - The group name as defined in the $layout-tokens
110
90
  /// @param {String} $property - The property name
111
91
  /// @example @include -group('size', $property)
112
92
  /// @group utilities
@@ -42,3 +42,28 @@
42
42
  }
43
43
  }
44
44
  }
45
+
46
+ /// Circular Skeleton loading animation
47
+ /// @access public
48
+ /// @example @include circular-skeleton;
49
+ /// @group utilities
50
+ @mixin circular-skeleton {
51
+ position: relative;
52
+ overflow: hidden;
53
+ background: $skeleton-background;
54
+ border-radius: 50%;
55
+
56
+ &::before {
57
+ position: absolute;
58
+ width: 200%;
59
+ height: 100%;
60
+ animation: 3000ms ease-in-out skeleton infinite;
61
+ background: $skeleton-element;
62
+ content: '';
63
+ will-change: transform-origin, transform, opacity;
64
+
65
+ @media (prefers-reduced-motion: reduce) {
66
+ animation: none;
67
+ }
68
+ }
69
+ }