@carbon/styles 1.30.0 → 1.31.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 (31) hide show
  1. package/css/styles.css +403 -188
  2. package/css/styles.min.css +1 -1
  3. package/index.scss +1 -0
  4. package/package.json +10 -10
  5. package/scss/_layout.scss +85 -0
  6. package/scss/_reset.scss +9 -0
  7. package/scss/components/accordion/_accordion.scss +11 -20
  8. package/scss/components/button/_button.scss +25 -58
  9. package/scss/components/button/_mixins.scss +25 -4
  10. package/scss/components/code-snippet/_code-snippet.scss +11 -16
  11. package/scss/components/contained-list/_contained-list.scss +18 -34
  12. package/scss/components/content-switcher/_content-switcher.scss +12 -12
  13. package/scss/components/copy-button/_copy-button.scss +0 -2
  14. package/scss/components/data-table/_data-table.scss +72 -9
  15. package/scss/components/data-table/expandable/_data-table-expandable.scss +32 -2
  16. package/scss/components/data-table/sort/_data-table-sort.scss +33 -0
  17. package/scss/components/form/_form.scss +1 -0
  18. package/scss/components/menu/_menu.scss +4 -0
  19. package/scss/components/overflow-menu/_overflow-menu.scss +4 -0
  20. package/scss/components/pagination/_pagination.scss +5 -0
  21. package/scss/components/popover/_popover.scss +1 -0
  22. package/scss/components/progress-bar/_progress-bar.scss +10 -5
  23. package/scss/components/slider/_slider.scss +1 -1
  24. package/scss/components/tabs/_tabs.scss +7 -1
  25. package/scss/components/tag/_tag.scss +19 -12
  26. package/scss/components/text-input/_text-input.scss +6 -10
  27. package/scss/components/time-picker/_time-picker.scss +16 -0
  28. package/scss/components/ui-shell/header/_header.scss +4 -0
  29. package/scss/components/ui-shell/side-nav/_side-nav.scss +0 -3
  30. package/scss/utilities/_index.scss +1 -0
  31. package/scss/utilities/_layout.scss +134 -0
@@ -123,6 +123,46 @@
123
123
  text-align: left;
124
124
  vertical-align: middle;
125
125
  }
126
+ .#{$prefix}--data-table.#{$prefix}--data-table--top-aligned-body {
127
+ &.#{$prefix}--data-table--lg
128
+ tr:not([data-child-row])
129
+ td:not(.#{$prefix}--table-expand) {
130
+ padding-top: $spacing-05;
131
+ padding-bottom: $spacing-05;
132
+
133
+ &.#{$prefix}--table-column-menu {
134
+ padding-top: $spacing-03;
135
+ }
136
+
137
+ &.#{$prefix}--table-column-checkbox:not(.#{$prefix}--table-column-radio) {
138
+ padding-top: rem(13px);
139
+ }
140
+ }
141
+
142
+ td {
143
+ vertical-align: top;
144
+ }
145
+ }
146
+
147
+ .#{$prefix}--data-table.#{$prefix}--data-table--top-aligned-header {
148
+ &.#{$prefix}--data-table--lg
149
+ th:not(.#{$prefix}--table-expand):not(.#{$prefix}--table-sort__header) {
150
+ padding-top: $spacing-05;
151
+ padding-bottom: $spacing-05;
152
+
153
+ &.#{$prefix}--table-column-menu {
154
+ padding-top: $spacing-03;
155
+ }
156
+
157
+ &.#{$prefix}--table-column-checkbox {
158
+ padding-top: rem(13px);
159
+ }
160
+ }
161
+
162
+ th {
163
+ vertical-align: top;
164
+ }
165
+ }
126
166
 
127
167
  .#{$prefix}--data-table th[align='right'],
128
168
  .#{$prefix}--data-table td[align='right'] {
@@ -495,8 +535,14 @@
495
535
  height: calc(100% + 1px);
496
536
  }
497
537
 
498
- .#{$prefix}--data-table.#{$prefix}--data-table--xs
499
- .#{$prefix}--table-column-checkbox {
538
+ .#{$prefix}--data-table.#{$prefix}--data-table--xs:not(
539
+ .#{$prefix}--data-table--top-aligned-body
540
+ )
541
+ td.#{$prefix}--table-column-checkbox,
542
+ .#{$prefix}--data-table.#{$prefix}--data-table--xs:not(
543
+ .#{$prefix}--data-table--top-aligned-header
544
+ )
545
+ th.#{$prefix}--table-column-checkbox {
500
546
  padding-top: 0;
501
547
  padding-bottom: 0;
502
548
  }
@@ -524,13 +570,21 @@
524
570
  }
525
571
 
526
572
  .#{$prefix}--data-table--sm td,
527
- .#{$prefix}--data-table--sm tbody tr th {
573
+ .#{$prefix}--data-table--sm tbody tr th,
574
+ .#{$prefix}--data-table--sm.#{$prefix}--data-table--top-aligned-header
575
+ th.#{$prefix}--table-column-checkbox {
528
576
  padding-top: rem(7px);
529
577
  padding-bottom: rem(6px);
530
578
  }
531
579
 
532
- .#{$prefix}--data-table.#{$prefix}--data-table--sm
533
- .#{$prefix}--table-column-checkbox {
580
+ .#{$prefix}--data-table.#{$prefix}--data-table--sm:not(
581
+ .#{$prefix}--data-table--top-aligned-body
582
+ )
583
+ td.#{$prefix}--table-column-checkbox,
584
+ .#{$prefix}--data-table.#{$prefix}--data-table--sm:not(
585
+ .#{$prefix}--data-table--top-aligned-header
586
+ )
587
+ th.#{$prefix}--table-column-checkbox {
534
588
  padding-top: rem(3px);
535
589
  padding-bottom: rem(3px);
536
590
  }
@@ -548,7 +602,9 @@
548
602
  height: rem(40px);
549
603
  }
550
604
 
551
- .#{$prefix}--data-table--md .#{$prefix}--table-header-label {
605
+ .#{$prefix}--data-table--md .#{$prefix}--table-header-label,
606
+ .#{$prefix}--data-table--md.#{$prefix}--data-table--top-aligned-header
607
+ th.#{$prefix}--table-column-checkbox {
552
608
  padding-top: rem(7px);
553
609
  padding-bottom: rem(7px);
554
610
  }
@@ -559,8 +615,14 @@
559
615
  padding-bottom: rem(6px);
560
616
  }
561
617
 
562
- .#{$prefix}--data-table.#{$prefix}--data-table--md
563
- .#{$prefix}--table-column-checkbox {
618
+ .#{$prefix}--data-table.#{$prefix}--data-table--md:not(
619
+ .#{$prefix}--data-table--top-aligned-body
620
+ )
621
+ td.#{$prefix}--table-column-checkbox,
622
+ .#{$prefix}--data-table.#{$prefix}--data-table--md:not(
623
+ .#{$prefix}--data-table--top-aligned-header
624
+ )
625
+ th.#{$prefix}--table-column-checkbox {
564
626
  padding-top: rem(3px);
565
627
  padding-bottom: rem(3px);
566
628
  }
@@ -586,7 +648,8 @@
586
648
 
587
649
  .#{$prefix}--data-table--xl td,
588
650
  .#{$prefix}--data-table--xl tbody tr th {
589
- padding-top: 1rem;
651
+ padding-top: $spacing-05;
652
+ padding-bottom: $spacing-05;
590
653
  }
591
654
 
592
655
  .#{$prefix}--data-table--xl th,
@@ -216,10 +216,41 @@
216
216
  height: calc(100% + 1px);
217
217
  align-items: center;
218
218
  justify-content: center;
219
- padding: 0 0.5rem;
219
+ padding: 0 $spacing-03;
220
220
  vertical-align: inherit;
221
221
  }
222
222
 
223
+ .#{$prefix}--data-table--top-aligned-body
224
+ td
225
+ .#{$prefix}--table-expand__button,
226
+ .#{$prefix}--data-table--top-aligned-header
227
+ th
228
+ .#{$prefix}--table-expand__button {
229
+ height: rem(32px);
230
+ align-items: start;
231
+ padding-top: $spacing-03;
232
+ }
233
+
234
+ .#{$prefix}--data-table--top-aligned-body.#{$prefix}--data-table--xs
235
+ td
236
+ .#{$prefix}--table-expand__button,
237
+ .#{$prefix}--data-table--top-aligned-header.#{$prefix}--data-table--xs
238
+ th
239
+ .#{$prefix}--table-expand__button {
240
+ height: rem(24px);
241
+ padding-top: $spacing-02;
242
+ }
243
+
244
+ .#{$prefix}--data-table--top-aligned-body.#{$prefix}--data-table--md
245
+ td
246
+ .#{$prefix}--table-expand__button,
247
+ .#{$prefix}--data-table--top-aligned-header.#{$prefix}--data-table--md
248
+ th
249
+ .#{$prefix}--table-expand__button {
250
+ padding-top: $spacing-03;
251
+ margin-top: -$spacing-02;
252
+ }
253
+
223
254
  .#{$prefix}--table-expand__button:focus {
224
255
  box-shadow: inset 0 0 0 2px $focus;
225
256
  outline: none;
@@ -233,7 +264,6 @@
233
264
 
234
265
  .#{$prefix}--data-table--xl .#{$prefix}--table-expand__button {
235
266
  width: rem(32px);
236
- padding: 0;
237
267
  }
238
268
 
239
269
  // fix expanded parent separating border length
@@ -90,6 +90,39 @@
90
90
  justify-content: space-between;
91
91
  }
92
92
 
93
+ .#{$prefix}--data-table--top-aligned-header th .#{$prefix}--table-sort__flex {
94
+ align-items: start;
95
+ }
96
+
97
+ .#{$prefix}--data-table.#{$prefix}--data-table--top-aligned-header.#{$prefix}--data-table--lg
98
+ th.#{$prefix}--table-sort__header {
99
+ padding-top: $spacing-05;
100
+ }
101
+
102
+ .#{$prefix}--data-table.#{$prefix}--data-table--top-aligned-header.#{$prefix}--data-table--sm
103
+ th.#{$prefix}--table-sort__header
104
+ .#{$prefix}--table-sort__flex
105
+ .#{$prefix}--table-header-label,
106
+ .#{$prefix}--data-table.#{$prefix}--data-table--top-aligned-header.#{$prefix}--data-table--xs
107
+ th.#{$prefix}--table-sort__header
108
+ .#{$prefix}--table-sort__flex
109
+ .#{$prefix}--table-header-label {
110
+ padding-top: 0;
111
+ padding-bottom: 0;
112
+ }
113
+
114
+ .#{$prefix}--data-table.#{$prefix}--data-table--top-aligned-header.#{$prefix}--data-table--sm
115
+ th.#{$prefix}--table-sort__header {
116
+ padding-top: rem(7px);
117
+ padding-bottom: rem(7px);
118
+ }
119
+
120
+ .#{$prefix}--data-table.#{$prefix}--data-table--top-aligned-header.#{$prefix}--data-table--xs
121
+ th.#{$prefix}--table-sort__header {
122
+ padding-top: rem(2px);
123
+ padding-bottom: rem(2px);
124
+ }
125
+
93
126
  .#{$prefix}--data-table--sort:not(.#{$prefix}--data-table--xs):not(
94
127
  .#{$prefix}--data-table--sm
95
128
  ):not(.#{$prefix}--data-table--md):not(.#{$prefix}--data-table--xl)
@@ -140,6 +140,7 @@ $input-label-weight: 400 !default;
140
140
  .#{$prefix}--date-picker-input__wrapper--warn,
141
141
  .#{$prefix}--date-picker-input__wrapper--invalid,
142
142
  .#{$prefix}--time-picker--invalid,
143
+ .#{$prefix}--time-picker--warning,
143
144
  .#{$prefix}--text-input__field-wrapper[data-invalid],
144
145
  .#{$prefix}--text-input__field-wrapper--warning,
145
146
  .#{$prefix}--text-input__field-wrapper--warning > .#{$prefix}--text-input,
@@ -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
@@ -12,19 +12,24 @@
12
12
  @use '../../type' as *;
13
13
  @use '../../utilities/convert' as *;
14
14
  @use '../../utilities/visually-hidden' as *;
15
+ @use '../../utilities/layout';
15
16
 
16
17
  /// Progress Bar styles
17
18
  /// @access public
18
19
  /// @group progress-bar
19
20
  @mixin progress-bar {
21
+ .#{$prefix}--progress-bar {
22
+ @include layout.use('density', $default: 'normal');
23
+ }
24
+
20
25
  .#{$prefix}--progress-bar__label {
21
26
  @include type-style('body-compact-01');
22
27
 
23
28
  display: flex;
24
29
  min-width: rem(48px);
25
30
  justify-content: space-between;
26
- margin-bottom: $spacing-03;
27
31
  color: $text-primary;
32
+ margin-block-end: $spacing-03;
28
33
  }
29
34
 
30
35
  .#{$prefix}--progress-bar__label-text {
@@ -90,7 +95,7 @@
90
95
 
91
96
  .#{$prefix}--progress-bar__status-icon {
92
97
  flex-shrink: 0;
93
- margin-left: $spacing-05;
98
+ margin-inline-start: layout.density('padding-inline');
94
99
  }
95
100
 
96
101
  .#{$prefix}--progress-bar--finished .#{$prefix}--progress-bar__bar,
@@ -122,7 +127,7 @@
122
127
  .#{$prefix}--progress-bar__label {
123
128
  flex-shrink: 1;
124
129
  justify-content: flex-start;
125
- margin-right: 0;
130
+ margin-inline-end: 0;
126
131
  }
127
132
 
128
133
  @keyframes progress-bar-indeterminate {
@@ -144,7 +149,7 @@
144
149
  .#{$prefix}--progress-bar--inline .#{$prefix}--progress-bar__label {
145
150
  flex-shrink: 0;
146
151
  margin-bottom: 0;
147
- margin-inline-end: $spacing-05;
152
+ margin-inline-end: layout.density('padding-inline');
148
153
  }
149
154
 
150
155
  .#{$prefix}--progress-bar--inline .#{$prefix}--progress-bar__track {
@@ -158,6 +163,6 @@
158
163
 
159
164
  .#{$prefix}--progress-bar--indented .#{$prefix}--progress-bar__label,
160
165
  .#{$prefix}--progress-bar--indented .#{$prefix}--progress-bar__helper-text {
161
- padding-inline: $spacing-05;
166
+ padding-inline: layout.density('padding-inline');
162
167
  }
163
168
  }
@@ -46,7 +46,7 @@
46
46
  }
47
47
 
48
48
  .#{$prefix}--slider__range-label {
49
- @include type-style('code-02');
49
+ @include type-style('body-compact-01');
50
50
 
51
51
  color: $text-primary;
52
52
  white-space: nowrap;
@@ -326,12 +326,18 @@ $icon-tab-size: custom-property.get-var('icon-tab-size', rem(40px));
326
326
  .#{$prefix}--tabs__nav-item--close-icon {
327
327
  padding: $spacing-02;
328
328
  margin: -$spacing-02;
329
- cursor: pointer;
330
329
  line-height: 0;
331
330
  pointer-events: auto;
332
331
  }
333
332
  }
334
333
 
334
+ .#{$prefix}--tabs__nav-item--icon-left {
335
+ display: flex;
336
+ align-items: center;
337
+ padding-right: $spacing-03;
338
+ margin-top: -2px;
339
+ }
340
+
335
341
  &.#{$prefix}--tabs--contained .#{$prefix}--tabs__nav-item--icon {
336
342
  padding-left: $spacing-05;
337
343
  }
@@ -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
+ }