@carbon/styles 1.30.0 → 1.31.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.
@@ -106,6 +106,10 @@
106
106
  white-space: nowrap;
107
107
  }
108
108
 
109
+ .#{$prefix}--menu-item__shortcut {
110
+ display: flex;
111
+ }
112
+
109
113
  .#{$prefix}--menu--with-icons > .#{$prefix}--menu-item,
110
114
  .#{$prefix}--menu--with-icons
111
115
  > .#{$prefix}--menu-item-group
@@ -47,6 +47,10 @@
47
47
  }
48
48
  }
49
49
 
50
+ .#{$prefix}--overflow-menu > :first-child {
51
+ margin-block-start: 0;
52
+ }
53
+
50
54
  .#{$prefix}--overflow-menu--sm {
51
55
  width: rem(32px);
52
56
  height: rem(32px);
@@ -217,6 +217,11 @@
217
217
  background-color $duration-fast-02 motion(standard, productive);
218
218
  }
219
219
 
220
+ .#{$prefix}--pagination__button > svg,
221
+ .#{$prefix}--btn--ghost.#{$prefix}--pagination__button > svg {
222
+ margin-block-start: 0;
223
+ }
224
+
220
225
  .#{$prefix}--pagination--sm .#{$prefix}--pagination__button,
221
226
  .#{$prefix}--pagination--sm
222
227
  .#{$prefix}--btn--ghost.#{$prefix}--pagination__button {
@@ -14,6 +14,7 @@
14
14
  @use '../../utilities/focus-outline' as *;
15
15
  @use '../../utilities/' as *;
16
16
  @use '../../utilities/convert' as *;
17
+ @use '../../utilities/layout';
17
18
 
18
19
  /// The Popover component is used for triggering a pop-up next to a trigger
19
20
  /// element, typically a button, in a given direction. It is made up of several
@@ -332,6 +332,13 @@ $icon-tab-size: custom-property.get-var('icon-tab-size', rem(40px));
332
332
  }
333
333
  }
334
334
 
335
+ .#{$prefix}--tabs__nav-item--icon-left {
336
+ display: flex;
337
+ align-items: center;
338
+ padding-right: $spacing-03;
339
+ margin-top: -2px;
340
+ }
341
+
335
342
  &.#{$prefix}--tabs--contained .#{$prefix}--tabs__nav-item--icon {
336
343
  padding-left: $spacing-05;
337
344
  }
@@ -13,6 +13,7 @@
13
13
  @use '../../utilities/component-tokens' as *;
14
14
  @use '../../utilities/convert' as *;
15
15
  @use '../../utilities/high-contrast-mode' as *;
16
+ @use '../../utilities/layout';
16
17
  @use '../../spacing' as *;
17
18
  @use './tokens' as *;
18
19
  @use './mixins' as *;
@@ -23,6 +24,20 @@
23
24
  /// @group tag
24
25
  @mixin tag {
25
26
  .#{$prefix}--tag {
27
+ @include layout.redefine-tokens(
28
+ (
29
+ size: (
30
+ height: (
31
+ xs: rem(18px),
32
+ sm: rem(18px),
33
+ md: rem(24px),
34
+ ),
35
+ ),
36
+ )
37
+ );
38
+
39
+ @include layout.use('size', $default: 'md', $min: 'sm', $max: 'md');
40
+
26
41
  @include type-style('label-01');
27
42
  @include tag-theme($tag-background-gray, $tag-color-gray, $tag-hover-gray);
28
43
 
@@ -31,13 +46,13 @@
31
46
  min-width: rem(32px);
32
47
  // restricts size of contained elements
33
48
  max-width: 100%;
34
- min-height: rem(24px);
49
+ min-height: layout.size('height');
35
50
  align-items: center;
36
51
  justify-content: center;
37
- padding: $spacing-02 $spacing-03;
38
52
  margin: $spacing-02;
39
53
  border-radius: rem(15px);
40
54
  cursor: default;
55
+ padding-inline: $spacing-03;
41
56
  vertical-align: middle;
42
57
  word-break: break-word;
43
58
 
@@ -166,8 +181,8 @@
166
181
 
167
182
  .#{$prefix}--tag__close-icon {
168
183
  display: flex;
169
- width: rem(24px);
170
- height: rem(24px);
184
+ width: layout.size('height');
185
+ height: layout.size('height');
171
186
  flex-shrink: 0;
172
187
  align-items: center;
173
188
  justify-content: center;
@@ -225,19 +240,11 @@
225
240
  fill: $icon-disabled;
226
241
  }
227
242
 
228
- // small tags
229
- .#{$prefix}--tag--sm {
230
- min-height: rem(18px);
231
- padding: 0 $spacing-03;
232
- }
233
-
234
243
  .#{$prefix}--tag--sm.#{$prefix}--tag--filter {
235
244
  padding-right: 0;
236
245
  }
237
246
 
238
247
  .#{$prefix}--tag--sm .#{$prefix}--tag__close-icon {
239
- width: rem(18px);
240
- height: rem(18px);
241
248
  margin-left: rem(5px);
242
249
  }
243
250
 
@@ -21,6 +21,7 @@
21
21
  @use '../../utilities/skeleton' as *;
22
22
  @use '../../utilities/high-contrast-mode' as *;
23
23
  @use '../../utilities/convert' as *;
24
+ @use '../../utilities/layout';
24
25
 
25
26
  @use '../../utilities/focus-outline' as *;
26
27
  @use '../../utilities/button-reset';
@@ -31,13 +32,16 @@
31
32
  /// @group text-input
32
33
  @mixin text-input {
33
34
  .#{$prefix}--text-input {
35
+ @include layout.use('size', $default: 'md', $min: 'sm', $max: 'lg');
36
+ @include layout.use('density', $default: 'normal');
37
+
34
38
  @include reset;
35
39
  @include type-style('body-compact-01');
36
40
  @include focus-outline('reset');
37
41
 
38
42
  width: 100%;
39
- height: rem(40px);
40
- padding: 0 $spacing-05;
43
+ height: layout.size('height');
44
+ padding: 0 layout.density('padding-inline');
41
45
  border: none;
42
46
  border-bottom: 1px solid $border-strong;
43
47
  background-color: $field;
@@ -56,14 +60,6 @@
56
60
  }
57
61
  }
58
62
 
59
- .#{$prefix}--text-input--lg {
60
- height: rem(48px);
61
- }
62
-
63
- .#{$prefix}--text-input--sm {
64
- height: rem(32px);
65
- }
66
-
67
63
  .#{$prefix}--password-input {
68
64
  padding-right: $spacing-08;
69
65
  }
@@ -32,10 +32,22 @@
32
32
  }
33
33
 
34
34
  .#{$prefix}--time-picker__input {
35
+ position: relative;
35
36
  display: flex;
36
37
  flex-direction: column;
37
38
  }
38
39
 
40
+ .#{$prefix}--time-picker__error__icon {
41
+ position: absolute;
42
+ top: 50%;
43
+ right: 1rem;
44
+ display: flex;
45
+ height: 100%;
46
+ place-items: center;
47
+ // top/transform used to center invalid icon in IE11
48
+ transform: translateY(-50%);
49
+ }
50
+
39
51
  .#{$prefix}--time-picker .#{$prefix}--select-input {
40
52
  width: auto;
41
53
  min-width: auto;
@@ -60,6 +72,10 @@
60
72
  }
61
73
  }
62
74
 
75
+ .#{$prefix}--time-picker__input-field-error {
76
+ width: 6.175rem;
77
+ }
78
+
63
79
  // V11: Possibly deprecate
64
80
  .#{$prefix}--time-picker--light .#{$prefix}--select-input {
65
81
  background-color: $field-02;
@@ -48,6 +48,10 @@
48
48
  }
49
49
  }
50
50
 
51
+ .#{$prefix}--header__action > :first-child {
52
+ margin-block-start: 0;
53
+ }
54
+
51
55
  .#{$prefix}--header__action
52
56
  > svg.#{$prefix}--navigation-menu-panel-collapse-icon,
53
57
  .#{$prefix}--header__action--active
@@ -68,9 +68,6 @@
68
68
  width: 0;
69
69
  }
70
70
 
71
- .#{$prefix}--side-nav.#{$prefix}--side-nav--rail:not(
72
- .#{$prefix}--side-nav--fixed
73
- ):hover,
74
71
  .#{$prefix}--side-nav--expanded {
75
72
  width: mini-units(32);
76
73
  }
@@ -13,6 +13,7 @@
13
13
  @forward 'hide-at-breakpoint';
14
14
  @forward 'high-contrast-mode';
15
15
  @forward 'keyframes';
16
+ @forward 'layout';
16
17
  @forward 'placeholder-colors';
17
18
  @forward 'rotate';
18
19
  @forward 'skeleton';
@@ -0,0 +1,134 @@
1
+ //
2
+ // Copyright IBM Corp. 2023
3
+ //
4
+ // This source code is licensed under the Apache-2.0 license found in the
5
+ // LICENSE file in the root directory of this source tree.
6
+ //
7
+
8
+ @use 'sass:map';
9
+
10
+ @use '../config';
11
+ @use '../spacing' as *;
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
+
34
+ /// Enables the use of contextual layout tokens within a component. This mixin should be
35
+ /// included on the outermost selector of the component.
36
+ /// @param {String} $group - The layout group to use for this component
37
+ /// @param {String} $default - The default step if the component is not within a layout
38
+ /// @param {String} $min - The minimum step supported by this component (optional)
39
+ /// @param {String} $max - The maximum step supported by this component (optional)
40
+ /// @example @include use('size', $default: 'md', $min: 'sm', $max: 'lg')
41
+ /// @group utilities
42
+ /// @access public
43
+ @mixin use($group, $default, $min: null, $max: null) {
44
+ $properties: map.get($tokens, $group);
45
+
46
+ @each $property, $steps in $properties {
47
+ $minValue: custom-property.get-var('layout-#{$group}-#{$property}-min');
48
+ @if $min {
49
+ $minValue: max(
50
+ $minValue,
51
+ custom-property.get-var('layout-#{$group}-#{$property}-#{$min}')
52
+ );
53
+ }
54
+
55
+ $maxValue: custom-property.get-var('layout-#{$group}-#{$property}-max');
56
+ @if $max {
57
+ $maxValue: min(
58
+ $maxValue,
59
+ custom-property.get-var('layout-#{$group}-#{$property}-#{$max}')
60
+ );
61
+ }
62
+
63
+ $value: clamp(
64
+ $minValue,
65
+ custom-property.get-var(
66
+ 'layout-#{$group}-#{$property}',
67
+ custom-property.get-var('layout-#{$group}-#{$property}-#{$default}')
68
+ ),
69
+ $maxValue
70
+ );
71
+
72
+ @include custom-property.declaration(
73
+ 'layout-#{$group}-#{$property}-local',
74
+ $value
75
+ );
76
+ }
77
+ }
78
+
79
+ /// Allows to redefine any token values of the layout module in case a component is using
80
+ /// non-standard values and should still participate in the layout context
81
+ /// @param {Map} $overrides - The map of overrides. Must follow ( group: ( property: ( step: value ) ) )
82
+ /// @example @include redefine-tokens(( size: ( height: ( sm: 1.125rem, md: 1.5rem ) ) ))
83
+ /// @group utilities
84
+ /// @access public
85
+ @mixin redefine-tokens($overrides) {
86
+ @each $group, $properties in $overrides {
87
+ @each $property, $steps in $properties {
88
+ @each $step, $value in $steps {
89
+ @include custom-property.declaration(
90
+ 'layout-#{$group}-#{$property}-#{$step}',
91
+ $value
92
+ );
93
+
94
+ .#{config.$prefix}--layout--#{$group}-#{$step} & {
95
+ $token: custom-property.get-var(
96
+ 'layout-#{$group}-#{$property}-#{$step}'
97
+ );
98
+ @include custom-property.declaration(
99
+ 'layout-#{$group}-#{$property}',
100
+ $token
101
+ );
102
+ }
103
+ }
104
+ }
105
+ }
106
+ }
107
+
108
+ /// Internal base function for retrieving a property from a layout group.
109
+ /// @param {String} $group - The group name as defined in the $tokens
110
+ /// @param {String} $property - The property name
111
+ /// @example @include -group('size', $property)
112
+ /// @group utilities
113
+ /// @access private
114
+ @function -group($group, $property) {
115
+ @return custom-property.get-var('layout-#{$group}-#{$property}-local');
116
+ }
117
+
118
+ /// Retrieves the current value for a property token in the layout size.
119
+ /// @param {String} $property - The property name
120
+ /// @example height: size('height');
121
+ /// @group utilities
122
+ /// @access public
123
+ @function size($property) {
124
+ @return -group('size', $property);
125
+ }
126
+
127
+ /// Retrieves the current value for a property token in the layout density.
128
+ /// @param {String} $property - The property name
129
+ /// @example padding-inline: density('padding-inline');
130
+ /// @group utilities
131
+ /// @access public
132
+ @function density($property) {
133
+ @return -group('density', $property);
134
+ }