@carbon/elements 10.53.0 → 10.54.1

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.
@@ -9,6 +9,7 @@
9
9
  // and often derived from, bootstrap:
10
10
  // https://github.com/twbs/bootstrap/blob/v4-dev/scss/mixins/_grid.scss
11
11
 
12
+ @use 'sass:list';
12
13
  @use 'sass:meta';
13
14
  @use 'sass:math';
14
15
  @use 'sass:map';
@@ -24,12 +25,12 @@
24
25
  /// for setting width and default gutters when a column's breakpoint has not been
25
26
  /// hit yet.
26
27
  /// @param {Number} $gutter [$grid-gutter] - The gutter for the grid system
27
- /// @param {Number} $collapsed-gutter [$grid-gutter--condensed] - The condensed mode gutter
28
+ /// @param {Number} $collapsed-gutter [$grid-gutter-condensed] - The condensed mode gutter
28
29
  /// @access private
29
30
  /// @group @carbon/grid
30
31
  @mixin -make-col-ready(
31
32
  $gutter: $grid-gutter,
32
- $condensed-gutter: $grid-gutter--condensed
33
+ $condensed-gutter: $grid-gutter-condensed
33
34
  ) {
34
35
  // Prevent columns from becoming too narrow when at smaller grid tiers by
35
36
  // always setting `width: 100%;`. This works because we use `flex` values
@@ -254,7 +255,7 @@
254
255
  margin-right: auto;
255
256
  margin-left: auto;
256
257
 
257
- @include -set-largest-breakpoint();
258
+ @include -set-largest-breakpoint($breakpoints);
258
259
 
259
260
  @each $name, $value in $breakpoints {
260
261
  $prev-breakpoint: map.get($breakpoints, breakpoint-prev($name));
@@ -282,7 +283,7 @@
282
283
  /// @access private
283
284
  /// @group @carbon/grid
284
285
  @mixin -set-largest-breakpoint($breakpoints: $grid-breakpoints) {
285
- $largest-breakpoint: last-map-item($breakpoints);
286
+ $largest-breakpoint: -last-map-item($breakpoints);
286
287
 
287
288
  max-width: map.get($largest-breakpoint, 'width');
288
289
  }
@@ -299,16 +300,37 @@
299
300
  }
300
301
  }
301
302
 
303
+ /// Pass in a map, and get the last one in the list back
304
+ /// @access public
305
+ /// @param {Map} $map - Map
306
+ /// @return {*} Desired value
307
+ /// @group @carbon/layout
308
+ @function -last-map-item($map) {
309
+ $total-length: list.length($map);
310
+ @return map-get($map, -key-by-index($map, $total-length));
311
+ }
312
+
313
+ /// Provide a map and index, and get back the relevant key value
314
+ /// @access public
315
+ /// @param {Map} $map - Map
316
+ /// @param {Integer} $index - Key chain
317
+ /// @return {String} Desired value
318
+ /// @group @carbon/layout
319
+ @function -key-by-index($map, $index) {
320
+ $keys: map.keys($map);
321
+ @return nth($keys, $index);
322
+ }
323
+
302
324
  /// Generate the CSS for a grid for the given breakpoints and gutters
303
325
  /// @param {Map} $breakpoints [$grid-breakpoints] - The default breakpoints
304
326
  /// @param {Number} $grid-gutter [$grid-gutter] - The default gutters
305
- /// @param {Number} $condensed-gutter [$grid-gutter--condensed] - The condensed mode gutter
327
+ /// @param {Number} $condensed-gutter [$grid-gutter-condensed] - The condensed mode gutter
306
328
  /// @access public
307
329
  /// @group @carbon/grid
308
330
  @mixin flex-grid(
309
331
  $breakpoints: $grid-breakpoints,
310
332
  $grid-gutter: $grid-gutter,
311
- $condensed-gutter: $grid-gutter--condensed
333
+ $condensed-gutter: $grid-gutter-condensed
312
334
  ) {
313
335
  .#{$prefix}--grid {
314
336
  @include -make-container($breakpoints);
@@ -339,36 +361,3 @@
339
361
  @include -no-gutter();
340
362
  @include -hang($grid-gutter);
341
363
  }
342
-
343
- @if $flex-grid-columns == 12 {
344
- $flex-12-column-grid: map.merge(
345
- $grid-breakpoints,
346
- (
347
- lg:
348
- map.merge(
349
- map.get($grid-breakpoints, lg),
350
- (
351
- columns: 12,
352
- )
353
- ),
354
- xlg:
355
- map.merge(
356
- map.get($grid-breakpoints, xlg),
357
- (
358
- columns: 12,
359
- )
360
- ),
361
- max:
362
- map.merge(
363
- map.get($grid-breakpoints, max),
364
- (
365
- columns: 12,
366
- )
367
- ),
368
- )
369
- );
370
-
371
- @include flex-grid($breakpoints: $flex-12-column-grid);
372
- } @else {
373
- @include flex-grid();
374
- }
@@ -0,0 +1,55 @@
1
+ //
2
+ // Copyright IBM Corp. 2018, 2018
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 'styles' as *;
9
+
10
+ /// Include default type styles
11
+ /// @access public
12
+ /// @group @carbon/type
13
+ @mixin default-type {
14
+ h1 {
15
+ @include type-style('productive-heading-06');
16
+ }
17
+
18
+ h2 {
19
+ @include type-style('productive-heading-05');
20
+ }
21
+
22
+ h3 {
23
+ @include type-style('productive-heading-04');
24
+ }
25
+
26
+ h4 {
27
+ @include type-style('productive-heading-03');
28
+ }
29
+
30
+ h5 {
31
+ @include type-style('productive-heading-02');
32
+ }
33
+
34
+ h6 {
35
+ @include type-style('productive-heading-01');
36
+ }
37
+
38
+ p {
39
+ @include type-style('body-long-02');
40
+ }
41
+
42
+ a {
43
+ @if meta.global-variable-exists('carbon--theme') and
44
+ map.has-key($carbon--theme, 'link-01')
45
+ {
46
+ color: map.get($carbon--theme, 'link-01');
47
+ } @else {
48
+ color: #0062fe;
49
+ }
50
+ }
51
+
52
+ em {
53
+ font-style: italic;
54
+ }
55
+ }
@@ -9,7 +9,6 @@
9
9
  @use 'sass:meta';
10
10
  @use '@carbon/layout';
11
11
  @use 'font-family' as *;
12
- @use 'styles' as *;
13
12
 
14
13
  /// Include a type reset for a given body and mono font family
15
14
  /// @param {String} $body-font-family [font-family('sans')] - The font family used on the `<body>` element
@@ -43,50 +42,3 @@
43
42
  @include font-weight('semibold');
44
43
  }
45
44
  }
46
-
47
- /// Include default type styles
48
- /// @access public
49
- /// @group @carbon/type
50
- @mixin default-type {
51
- h1 {
52
- @include type-style('productive-heading-06');
53
- }
54
-
55
- h2 {
56
- @include type-style('productive-heading-05');
57
- }
58
-
59
- h3 {
60
- @include type-style('productive-heading-04');
61
- }
62
-
63
- h4 {
64
- @include type-style('productive-heading-03');
65
- }
66
-
67
- h5 {
68
- @include type-style('productive-heading-02');
69
- }
70
-
71
- h6 {
72
- @include type-style('productive-heading-01');
73
- }
74
-
75
- p {
76
- @include type-style('body-long-02');
77
- }
78
-
79
- a {
80
- @if meta.global-variable-exists('carbon--theme') and
81
- map.has-key($carbon--theme, 'link-01')
82
- {
83
- color: map.get($carbon--theme, 'link-01');
84
- } @else {
85
- color: #0062fe;
86
- }
87
- }
88
-
89
- em {
90
- font-style: italic;
91
- }
92
- }
@@ -9,6 +9,7 @@
9
9
 
10
10
  @use 'sass:map';
11
11
  @use 'sass:math';
12
+ @use '../../grid/modules/config' as gridconfig;
12
13
  @use '../../grid/modules/breakpoint' as grid;
13
14
  @use 'font-family';
14
15
  @use 'scale';
@@ -716,7 +717,7 @@ $tokens: (
716
717
  /// @param {Map} $breakpoints [$grid-breakpoints] - Custom breakpoints to use
717
718
  /// @access public
718
719
  /// @group @carbon/type
719
- @mixin fluid-type($type-styles, $breakpoints: grid.$grid-breakpoints) {
720
+ @mixin fluid-type($type-styles, $breakpoints: gridconfig.$grid-breakpoints) {
720
721
  // Include the initial styles for the given token by default without any
721
722
  // media query guard. This includes `font-size` as a fallback in the case
722
723
  // that a browser does not support `calc()`
@@ -745,7 +746,7 @@ $tokens: (
745
746
  @mixin fluid-type-size(
746
747
  $type-styles,
747
748
  $name,
748
- $breakpoints: grid.$grid-breakpoints
749
+ $breakpoints: gridconfig.$grid-breakpoints
749
750
  ) {
750
751
  // Get the information about the breakpoint we're currently working in. Useful
751
752
  // for getting initial width information
@@ -846,7 +847,11 @@ $custom-property-prefix: 'cds' !default;
846
847
  /// @param {Map} $breakpoints [$grid-breakpoints] - Provide a custom breakpoint map to use
847
848
  /// @access public
848
849
  /// @group @carbon/type
849
- @mixin type-style($name, $fluid: false, $breakpoints: grid.$grid-breakpoints) {
850
+ @mixin type-style(
851
+ $name,
852
+ $fluid: false,
853
+ $breakpoints: gridconfig.$grid-breakpoints
854
+ ) {
850
855
  @if not map.has-key($tokens, $name) {
851
856
  @error 'Unable to find a token with the name: `#{$name}`';
852
857
  }
@@ -5,25 +5,11 @@
5
5
  // LICENSE file in the root directory of this source tree.
6
6
  //
7
7
 
8
- // https://github.com/twbs/bootstrap/blob/v4-dev/scss/mixins/_breakpoints.scss
9
8
  @use 'sass:list';
10
9
  @use 'sass:map';
11
10
  @use 'sass:meta';
12
11
  @use '../../../../../layout/modules/convert';
13
-
14
- /// Map deep get
15
- /// @author Hugo Giraudel
16
- /// @access public
17
- /// @param {Map} $map - Map
18
- /// @param {Arglist} $keys - Key chain
19
- /// @return {*} Desired value
20
- /// @group @carbon/layout
21
- @function map-deep-get($map, $keys...) {
22
- @each $key in $keys {
23
- $map: map.get($map, $key);
24
- }
25
- @return $map;
26
- }
12
+ @use 'config' as *;
27
13
 
28
14
  /// Provide a map and index, and get back the relevant key value
29
15
  /// @access public
@@ -31,65 +17,11 @@
31
17
  /// @param {Integer} $index - Key chain
32
18
  /// @return {String} Desired value
33
19
  /// @group @carbon/layout
34
- @function key-by-index($map, $index) {
20
+ @function -key-by-index($map, $index) {
35
21
  $keys: map.keys($map);
36
22
  @return nth($keys, $index);
37
23
  }
38
24
 
39
- /// Pass in a map, and get the last one in the list back
40
- /// @access public
41
- /// @param {Map} $map - Map
42
- /// @return {*} Desired value
43
- /// @group @carbon/layout
44
- @function last-map-item($map) {
45
- $total-length: list.length($map);
46
- @return map-get($map, key-by-index($map, $total-length));
47
- }
48
-
49
- /// Carbon gutter size in rem
50
- /// @type Number
51
- /// @access public
52
- /// @group @carbon/layout
53
- $grid-gutter: convert.rem(32px);
54
-
55
- /// Carbon condensed gutter size in rem
56
- /// @type Number
57
- /// @access public
58
- /// @group @carbon/layout
59
- $grid-gutter--condensed: convert.rem(1px);
60
-
61
- // Initial map of our breakpoints and their values
62
- /// @type Map
63
- /// @access public
64
- /// @group @carbon/layout
65
- $grid-breakpoints: (
66
- sm: (
67
- columns: 4,
68
- margin: 0,
69
- width: convert.rem(320px),
70
- ),
71
- md: (
72
- columns: 8,
73
- margin: convert.rem(16px),
74
- width: convert.rem(672px),
75
- ),
76
- lg: (
77
- columns: 16,
78
- margin: convert.rem(16px),
79
- width: convert.rem(1056px),
80
- ),
81
- xlg: (
82
- columns: 16,
83
- margin: convert.rem(16px),
84
- width: convert.rem(1312px),
85
- ),
86
- max: (
87
- columns: 16,
88
- margin: convert.rem(24px),
89
- width: convert.rem(1584px),
90
- ),
91
- ) !default;
92
-
93
25
  /// Get the value of the next breakpoint, or null for the last breakpoint
94
26
  /// @param {String} $name - The name of the breakpoint
95
27
  /// @param {Map} $breakpoints [$grid-breakpoints] - A map of breakpoints where the key is the name of the breakpoint and the value is the values for the breakpoint
@@ -145,7 +77,7 @@ $grid-breakpoints: (
145
77
  /// @group @carbon/layout
146
78
  @function largest-breakpoint-name($breakpoints: $grid-breakpoints) {
147
79
  $total-breakpoints: list.length($breakpoints);
148
- @return key-by-index($breakpoints, $total-breakpoints);
80
+ @return -key-by-index($breakpoints, $total-breakpoints);
149
81
  }
150
82
 
151
83
  /// Get the infix for a given breakpoint in a list of breakpoints. Useful for generating the size part in a selector, for example: `.prefix--col-sm-2`.
@@ -5,14 +5,90 @@
5
5
  // LICENSE file in the root directory of this source tree.
6
6
  //
7
7
 
8
+ @use 'sass:map';
9
+ @use '../../../../../layout/modules/convert';
10
+
8
11
  /// Namespace prefix
9
12
  /// @type String
10
13
  /// @access public
11
14
  /// @group @carbon/grid
12
- $prefix: 'bx' !default;
15
+ $prefix: 'cds' !default;
13
16
 
14
17
  /// Total columns used in the flex grid
15
18
  /// @type Number
16
19
  /// @access public
17
20
  /// @group @carbon/grid
18
21
  $flex-grid-columns: 16 !default;
22
+
23
+ /// Carbon gutter size in rem
24
+ /// @type Number
25
+ /// @access public
26
+ /// @group @carbon/layout
27
+ $grid-gutter: convert.rem(32px) !default;
28
+
29
+ /// Carbon condensed gutter size in rem
30
+ /// @type Number
31
+ /// @access public
32
+ /// @group @carbon/layout
33
+ $grid-gutter-condensed: convert.rem(1px) !default;
34
+
35
+ // Initial map of our breakpoints and their values
36
+ /// @type Map
37
+ /// @access public
38
+ /// @group @carbon/layout
39
+ $grid-breakpoints: (
40
+ sm: (
41
+ columns: 4,
42
+ margin: 0,
43
+ width: convert.rem(320px),
44
+ ),
45
+ md: (
46
+ columns: 8,
47
+ margin: convert.rem(16px),
48
+ width: convert.rem(672px),
49
+ ),
50
+ lg: (
51
+ columns: 16,
52
+ margin: convert.rem(16px),
53
+ width: convert.rem(1056px),
54
+ ),
55
+ xlg: (
56
+ columns: 16,
57
+ margin: convert.rem(16px),
58
+ width: convert.rem(1312px),
59
+ ),
60
+ max: (
61
+ columns: 16,
62
+ margin: convert.rem(24px),
63
+ width: convert.rem(1584px),
64
+ ),
65
+ ) !default;
66
+
67
+ @if $flex-grid-columns == 12 {
68
+ $grid-breakpoints: map.merge(
69
+ $grid-breakpoints,
70
+ (
71
+ lg:
72
+ map.merge(
73
+ map.get($grid-breakpoints, lg),
74
+ (
75
+ columns: 12,
76
+ )
77
+ ),
78
+ xlg:
79
+ map.merge(
80
+ map.get($grid-breakpoints, xlg),
81
+ (
82
+ columns: 12,
83
+ )
84
+ ),
85
+ max:
86
+ map.merge(
87
+ map.get($grid-breakpoints, max),
88
+ (
89
+ columns: 12,
90
+ )
91
+ ),
92
+ )
93
+ );
94
+ }