@carbon/elements 10.54.2 → 11.0.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 (165) hide show
  1. package/package.json +12 -13
  2. package/src/__tests__/__snapshots__/PublicAPI-test.js.snap +44 -130
  3. package/scss/colors/colors.scss +0 -12
  4. package/scss/colors/index.scss +0 -12
  5. package/scss/colors/mixins.scss +0 -1456
  6. package/scss/elements.scss +0 -17
  7. package/scss/grid/12.scss +0 -41
  8. package/scss/grid/_inlined/12.scss +0 -41
  9. package/scss/grid/_inlined/_mixins.import.scss +0 -431
  10. package/scss/grid/_inlined/_mixins.scss +0 -415
  11. package/scss/grid/_inlined/_prefix.scss +0 -12
  12. package/scss/grid/_mixins.import.scss +0 -431
  13. package/scss/grid/_mixins.scss +0 -415
  14. package/scss/grid/_prefix.scss +0 -12
  15. package/scss/grid/grid.scss +0 -10
  16. package/scss/grid/index.scss +0 -10
  17. package/scss/grid/modules/_breakpoint.scss +0 -198
  18. package/scss/grid/modules/_config.scss +0 -94
  19. package/scss/grid/modules/_css-grid.scss +0 -470
  20. package/scss/grid/modules/_flex-grid.scss +0 -363
  21. package/scss/grid/modules/_mixins.scss +0 -336
  22. package/scss/grid/vendor/@carbon/import-once/import-once.scss +0 -27
  23. package/scss/grid/vendor/@carbon/import-once/index.scss +0 -8
  24. package/scss/grid/vendor/@carbon/layout/_breakpoint.scss +0 -246
  25. package/scss/grid/vendor/@carbon/layout/_convert.import.scss +0 -65
  26. package/scss/grid/vendor/@carbon/layout/_convert.scss +0 -54
  27. package/scss/grid/vendor/@carbon/layout/_key-height.import.scss +0 -117
  28. package/scss/grid/vendor/@carbon/layout/_key-height.scss +0 -111
  29. package/scss/grid/vendor/@carbon/layout/_mini-unit.scss +0 -23
  30. package/scss/grid/vendor/@carbon/layout/_spacing.scss +0 -12
  31. package/scss/grid/vendor/@carbon/layout/_utilities.scss +0 -41
  32. package/scss/grid/vendor/@carbon/layout/generated/_container.scss +0 -73
  33. package/scss/grid/vendor/@carbon/layout/generated/_fluid-spacing.scss +0 -61
  34. package/scss/grid/vendor/@carbon/layout/generated/_icon-size.scss +0 -34
  35. package/scss/grid/vendor/@carbon/layout/generated/_layout.scss +0 -97
  36. package/scss/grid/vendor/@carbon/layout/generated/_size.scss +0 -17
  37. package/scss/grid/vendor/@carbon/layout/generated/_spacing.scss +0 -169
  38. package/scss/grid/vendor/@carbon/layout/index.scss +0 -8
  39. package/scss/grid/vendor/@carbon/layout/layout.scss +0 -12
  40. package/scss/grid/vendor/@carbon/layout/modules/_convert.scss +0 -51
  41. package/scss/grid/vendor/@carbon/layout/modules/_spacing.scss +0 -9
  42. package/scss/grid/vendor/@carbon/layout/modules/_utilities.scss +0 -41
  43. package/scss/grid/vendor/@carbon/layout/modules/generated/_fluid-spacing.scss +0 -37
  44. package/scss/grid/vendor/@carbon/layout/modules/generated/_spacing.scss +0 -91
  45. package/scss/icons/icons.scss +0 -10
  46. package/scss/icons/index.scss +0 -8
  47. package/scss/icons/mixins.scss +0 -18
  48. package/scss/import-once/import-once.scss +0 -27
  49. package/scss/import-once/index.scss +0 -8
  50. package/scss/index.scss +0 -15
  51. package/scss/layout/_breakpoint.scss +0 -246
  52. package/scss/layout/_convert.import.scss +0 -65
  53. package/scss/layout/_convert.scss +0 -54
  54. package/scss/layout/_key-height.import.scss +0 -117
  55. package/scss/layout/_key-height.scss +0 -111
  56. package/scss/layout/_mini-unit.scss +0 -23
  57. package/scss/layout/_spacing.scss +0 -12
  58. package/scss/layout/_utilities.scss +0 -41
  59. package/scss/layout/generated/_container.scss +0 -73
  60. package/scss/layout/generated/_fluid-spacing.scss +0 -61
  61. package/scss/layout/generated/_icon-size.scss +0 -34
  62. package/scss/layout/generated/_layout.scss +0 -97
  63. package/scss/layout/generated/_size.scss +0 -17
  64. package/scss/layout/generated/_spacing.scss +0 -169
  65. package/scss/layout/index.scss +0 -8
  66. package/scss/layout/layout.scss +0 -12
  67. package/scss/layout/modules/_convert.scss +0 -51
  68. package/scss/layout/modules/_spacing.scss +0 -9
  69. package/scss/layout/modules/_utilities.scss +0 -41
  70. package/scss/layout/modules/generated/_fluid-spacing.scss +0 -37
  71. package/scss/layout/modules/generated/_spacing.scss +0 -91
  72. package/scss/motion/index.scss +0 -8
  73. package/scss/motion/motion.scss +0 -78
  74. package/scss/themes/_mixins.scss +0 -39
  75. package/scss/themes/_theme-maps.scss +0 -9
  76. package/scss/themes/_tokens.scss +0 -8
  77. package/scss/themes/compat/_themes.scss +0 -8
  78. package/scss/themes/compat/_tokens.scss +0 -8
  79. package/scss/themes/compat/generated/_themes.scss +0 -271
  80. package/scss/themes/compat/generated/_tokens.scss +0 -206
  81. package/scss/themes/generated/_mixins.scss +0 -3622
  82. package/scss/themes/generated/_themes.scss +0 -2955
  83. package/scss/themes/generated/_tokens.scss +0 -3179
  84. package/scss/themes/index.scss +0 -8
  85. package/scss/themes/modules/_config.scss +0 -11
  86. package/scss/themes/modules/_theme.scss +0 -120
  87. package/scss/themes/modules/_themes.scss +0 -8
  88. package/scss/themes/modules/_tokens.scss +0 -8
  89. package/scss/themes/modules/_utilities.scss +0 -18
  90. package/scss/themes/modules/generated/_themes.scss +0 -432
  91. package/scss/themes/modules/generated/_tokens.scss +0 -308
  92. package/scss/themes/themes.scss +0 -10
  93. package/scss/type/_classes.scss +0 -41
  94. package/scss/type/_font-family.scss +0 -70
  95. package/scss/type/_inlined/_classes.scss +0 -41
  96. package/scss/type/_inlined/_font-family.scss +0 -70
  97. package/scss/type/_inlined/_prefix.scss +0 -11
  98. package/scss/type/_inlined/_reset.scss +0 -90
  99. package/scss/type/_inlined/_scale.scss +0 -59
  100. package/scss/type/_inlined/_styles.import.scss +0 -766
  101. package/scss/type/_inlined/_styles.scss +0 -924
  102. package/scss/type/_inlined/font-face/_mono.scss +0 -430
  103. package/scss/type/_inlined/font-face/_sans-condensed.scss +0 -302
  104. package/scss/type/_inlined/font-face/_sans.scss +0 -497
  105. package/scss/type/_inlined/font-face/_serif.scss +0 -430
  106. package/scss/type/_inlined/font-face/_settings.scss +0 -12
  107. package/scss/type/_prefix.scss +0 -11
  108. package/scss/type/_reset.scss +0 -90
  109. package/scss/type/_scale.scss +0 -59
  110. package/scss/type/_styles.import.scss +0 -766
  111. package/scss/type/_styles.scss +0 -924
  112. package/scss/type/font-face/_mono.scss +0 -430
  113. package/scss/type/font-face/_sans-condensed.scss +0 -302
  114. package/scss/type/font-face/_sans.scss +0 -497
  115. package/scss/type/font-face/_serif.scss +0 -430
  116. package/scss/type/font-face/_settings.scss +0 -12
  117. package/scss/type/index.scss +0 -8
  118. package/scss/type/modules/_classes.scss +0 -42
  119. package/scss/type/modules/_default-type.scss +0 -55
  120. package/scss/type/modules/_font-family.scss +0 -104
  121. package/scss/type/modules/_prefix.scss +0 -11
  122. package/scss/type/modules/_reset.scss +0 -44
  123. package/scss/type/modules/_scale.scss +0 -57
  124. package/scss/type/modules/_styles.scss +0 -876
  125. package/scss/type/type.scss +0 -8
  126. package/scss/type/vendor/@carbon/grid/12.scss +0 -41
  127. package/scss/type/vendor/@carbon/grid/_inlined/12.scss +0 -41
  128. package/scss/type/vendor/@carbon/grid/_inlined/_mixins.import.scss +0 -431
  129. package/scss/type/vendor/@carbon/grid/_inlined/_mixins.scss +0 -415
  130. package/scss/type/vendor/@carbon/grid/_inlined/_prefix.scss +0 -12
  131. package/scss/type/vendor/@carbon/grid/_mixins.import.scss +0 -431
  132. package/scss/type/vendor/@carbon/grid/_mixins.scss +0 -415
  133. package/scss/type/vendor/@carbon/grid/_prefix.scss +0 -12
  134. package/scss/type/vendor/@carbon/grid/grid.scss +0 -10
  135. package/scss/type/vendor/@carbon/grid/index.scss +0 -10
  136. package/scss/type/vendor/@carbon/grid/modules/_breakpoint.scss +0 -198
  137. package/scss/type/vendor/@carbon/grid/modules/_config.scss +0 -94
  138. package/scss/type/vendor/@carbon/grid/modules/_css-grid.scss +0 -470
  139. package/scss/type/vendor/@carbon/grid/modules/_flex-grid.scss +0 -363
  140. package/scss/type/vendor/@carbon/grid/modules/_mixins.scss +0 -336
  141. package/scss/type/vendor/@carbon/grid/vendor/@carbon/import-once/import-once.scss +0 -27
  142. package/scss/type/vendor/@carbon/grid/vendor/@carbon/import-once/index.scss +0 -8
  143. package/scss/type/vendor/@carbon/grid/vendor/@carbon/layout/_breakpoint.scss +0 -246
  144. package/scss/type/vendor/@carbon/grid/vendor/@carbon/layout/_convert.import.scss +0 -65
  145. package/scss/type/vendor/@carbon/grid/vendor/@carbon/layout/_convert.scss +0 -54
  146. package/scss/type/vendor/@carbon/grid/vendor/@carbon/layout/_key-height.import.scss +0 -117
  147. package/scss/type/vendor/@carbon/grid/vendor/@carbon/layout/_key-height.scss +0 -111
  148. package/scss/type/vendor/@carbon/grid/vendor/@carbon/layout/_mini-unit.scss +0 -23
  149. package/scss/type/vendor/@carbon/grid/vendor/@carbon/layout/_spacing.scss +0 -12
  150. package/scss/type/vendor/@carbon/grid/vendor/@carbon/layout/_utilities.scss +0 -41
  151. package/scss/type/vendor/@carbon/grid/vendor/@carbon/layout/generated/_container.scss +0 -73
  152. package/scss/type/vendor/@carbon/grid/vendor/@carbon/layout/generated/_fluid-spacing.scss +0 -61
  153. package/scss/type/vendor/@carbon/grid/vendor/@carbon/layout/generated/_icon-size.scss +0 -34
  154. package/scss/type/vendor/@carbon/grid/vendor/@carbon/layout/generated/_layout.scss +0 -97
  155. package/scss/type/vendor/@carbon/grid/vendor/@carbon/layout/generated/_size.scss +0 -17
  156. package/scss/type/vendor/@carbon/grid/vendor/@carbon/layout/generated/_spacing.scss +0 -169
  157. package/scss/type/vendor/@carbon/grid/vendor/@carbon/layout/index.scss +0 -8
  158. package/scss/type/vendor/@carbon/grid/vendor/@carbon/layout/layout.scss +0 -12
  159. package/scss/type/vendor/@carbon/grid/vendor/@carbon/layout/modules/_convert.scss +0 -51
  160. package/scss/type/vendor/@carbon/grid/vendor/@carbon/layout/modules/_spacing.scss +0 -9
  161. package/scss/type/vendor/@carbon/grid/vendor/@carbon/layout/modules/_utilities.scss +0 -41
  162. package/scss/type/vendor/@carbon/grid/vendor/@carbon/layout/modules/generated/_fluid-spacing.scss +0 -37
  163. package/scss/type/vendor/@carbon/grid/vendor/@carbon/layout/modules/generated/_spacing.scss +0 -91
  164. package/scss/type/vendor/@carbon/import-once/import-once.scss +0 -27
  165. package/scss/type/vendor/@carbon/import-once/index.scss +0 -8
@@ -1,415 +0,0 @@
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
- // Compatibility notes
9
- // ------------------------------------------
10
- //
11
- // This file is intended to be consumed and processed with node-sass/libsass.
12
- // Sass language features only available in dart-sass, such as `math.div`,
13
- // should not be used.
14
- //
15
- // The `.import` suffixed version of this file eg. `_filename.import.scss`
16
- // is intended to be compatible with dart-sass.
17
- //
18
- // Styles authored within this file must be duplicated to the corresponding
19
- // compatibility file to ensure we continue to support node-sass and dart-sass
20
- // in v10.
21
-
22
- // Helpers for defining columns, rows, and containers are heavily inspired by,
23
- // and often derived from, bootstrap:
24
- // https://github.com/twbs/bootstrap/blob/v4-dev/scss/mixins/_grid.scss
25
-
26
- @import '../../../../layout/breakpoint';
27
- @import 'prefix';
28
-
29
- // -----------------------------------------------------------------------------
30
- // Columns
31
- // -----------------------------------------------------------------------------
32
-
33
- /// Used to initialize the default properties for a column class, most notably
34
- /// for setting width and default gutters when a column's breakpoint has not been
35
- /// hit yet.
36
- /// @param {Number} $gutter [$carbon--grid-gutter] - The gutter for the grid system
37
- /// @param {Number} $collapsed-gutter [$carbon--grid-gutter--condensed] - The condensed mode gutter
38
- /// @access private
39
- /// @group @carbon/grid
40
- @mixin carbon--make-col-ready(
41
- $gutter: $carbon--grid-gutter,
42
- $condensed-gutter: $carbon--grid-gutter--condensed
43
- ) {
44
- // Prevent columns from becoming too narrow when at smaller grid tiers by
45
- // always setting `width: 100%;`. This works because we use `flex` values
46
- // later on to override this initial width.
47
- width: 100%;
48
- padding-right: ($gutter / 2);
49
- padding-left: ($gutter / 2);
50
-
51
- // For our condensed use-case, our gutters collapse to 2px solid, 1px on each
52
- // side.
53
- .#{$prefix}--row--condensed &,
54
- .#{$prefix}--grid--condensed & {
55
- padding-right: ($condensed-gutter / 2);
56
- padding-left: ($condensed-gutter / 2);
57
- }
58
-
59
- // For our narrow use-case, our container hangs 16px into the gutter
60
- .#{$prefix}--row--narrow &,
61
- .#{$prefix}--grid--narrow & {
62
- padding-right: ($gutter / 2);
63
- padding-left: 0;
64
- }
65
- }
66
-
67
- /// Define the width of the column for a given span and column count.
68
- /// A width of 0 will hide the column entirely.
69
- /// @param {Number} $span - The number of columns covered
70
- /// @param {Number} $columns - The total number of columns available
71
- /// @access private
72
- /// @group @carbon/grid
73
- @mixin carbon--make-col($span, $columns) {
74
- @if $span == 0 {
75
- display: none;
76
- } @else {
77
- // Explicitly include `display: block` to override
78
- display: block;
79
- // Add a `max-width` to ensure content within each column does not blow out
80
- // the width of the column. Applies to IE10+ and Firefox. Chrome and Safari
81
- // do not appear to require this.
82
- max-width: percentage($span / $columns);
83
- flex: 0 0 percentage($span / $columns);
84
- }
85
- }
86
-
87
- /// Create a column offset for a given span and column count.
88
- /// @param {Number} $span - The number of columns the offset should cover
89
- /// @param {Number} $columns - The total number of columns available
90
- /// @access private
91
- /// @group @carbon/grid
92
- @mixin carbon--make-col-offset($span, $columns) {
93
- $offset: $span / $columns;
94
- @if $offset == 0 {
95
- margin-left: 0;
96
- } @else {
97
- margin-left: percentage($offset);
98
- }
99
- }
100
-
101
- /// Output the CSS required for all the columns in a given grid system.
102
- /// @param {Map} $breakpoints [$carbon--grid-breakpoints] - The breakpoints in the grid system
103
- /// @param {Number} $gutter [$carbon--grid-gutter] - The gutter for the grid system
104
- /// @access private
105
- /// @group @carbon/grid
106
- @mixin carbon--make-grid-columns(
107
- $breakpoints: $carbon--grid-breakpoints,
108
- $gutter: $carbon--grid-gutter
109
- ) {
110
- .#{$prefix}--col {
111
- @include carbon--make-col-ready($gutter);
112
- }
113
-
114
- @each $breakpoint in map-keys($breakpoints) {
115
- $infix: carbon--breakpoint-infix($breakpoint);
116
- $columns: map-get(map-get($breakpoints, $breakpoint), columns);
117
-
118
- // Allow columns to stretch full width below their breakpoints
119
- @for $i from 0 through $columns {
120
- .#{$prefix}--col#{$infix}-#{$i} {
121
- @include carbon--make-col-ready($gutter);
122
- }
123
- }
124
-
125
- .#{$prefix}--col#{$infix},
126
- .#{$prefix}--col#{$infix}--auto {
127
- @include carbon--make-col-ready($gutter);
128
- }
129
-
130
- @include carbon--breakpoint($breakpoint, $breakpoints) {
131
- // Provide basic `.col-{bp}` classes for equal-width flexbox columns
132
- .#{$prefix}--col,
133
- .#{$prefix}--col#{$infix} {
134
- max-width: 100%;
135
- flex-basis: 0;
136
- flex-grow: 1;
137
- }
138
-
139
- .#{$prefix}--col--auto,
140
- .#{$prefix}--col#{$infix}--auto {
141
- width: auto;
142
- // Reset earlier grid tiers
143
- max-width: 100%;
144
- flex: 1 0 0%;
145
- }
146
-
147
- @for $i from 0 through $columns {
148
- .#{$prefix}--col#{$infix}-#{$i} {
149
- @include carbon--make-col($i, $columns);
150
- }
151
- }
152
-
153
- @for $i from 0 through ($columns - 1) {
154
- @if not($infix == '') {
155
- .#{$prefix}--offset#{$infix}-#{$i} {
156
- @include carbon--make-col-offset($i, $columns);
157
- }
158
- }
159
- }
160
- }
161
- }
162
- }
163
-
164
- // -----------------------------------------------------------------------------
165
- // Rows
166
- // -----------------------------------------------------------------------------
167
-
168
- /// Define the properties for a selector assigned to a row in the grid system.
169
- /// @param {Number} $gutter [$carbon--grid-gutter] - The gutter in the grid system
170
- /// @access private
171
- /// @group @carbon/grid
172
- @mixin carbon--make-row($gutter: $carbon--grid-gutter) {
173
- display: flex;
174
- flex-wrap: wrap;
175
- margin-right: -1 * $gutter / 2;
176
- margin-left: -1 * $gutter / 2;
177
- }
178
-
179
- // -----------------------------------------------------------------------------
180
- // No gutter
181
- // -----------------------------------------------------------------------------
182
-
183
- /// Add `no-gutter` and `no-gutter--{start,end}` classes to the output CSS. These
184
- /// classes are useful for dropping the gutter in fluid situations.
185
- /// @access private
186
- /// @group @carbon/grid
187
- @mixin carbon--no-gutter {
188
- .#{$prefix}--no-gutter,
189
- .#{$prefix}--row.#{$prefix}--no-gutter [class*='#{$prefix}--col'] {
190
- padding-right: 0;
191
- padding-left: 0;
192
- }
193
-
194
- .#{$prefix}--no-gutter--start,
195
- .#{$prefix}--row.#{$prefix}--no-gutter--start [class*='#{$prefix}--col'] {
196
- padding-left: 0;
197
- }
198
-
199
- .#{$prefix}--no-gutter--end,
200
- .#{$prefix}--row.#{$prefix}--no-gutter--end [class*='#{$prefix}--col'] {
201
- padding-right: 0;
202
- }
203
-
204
- // Deprecated ☠️
205
- .#{$prefix}--no-gutter--left,
206
- .#{$prefix}--row.#{$prefix}--no-gutter--left [class*='#{$prefix}--col'] {
207
- padding-left: 0;
208
- }
209
-
210
- .#{$prefix}--no-gutter--right,
211
- .#{$prefix}--row.#{$prefix}--no-gutter--right [class*='#{$prefix}--col'] {
212
- padding-right: 0;
213
- }
214
- }
215
-
216
- // -----------------------------------------------------------------------------
217
- // Hang
218
- // -----------------------------------------------------------------------------
219
-
220
- /// Add `hang--start` and `hang--end` classes for a given gutter. These classes are
221
- /// used alongside `no-gutter--start` and `no-gutter--end` to "hang" type.
222
- /// @param {Number} $gutter [$carbon--grid-gutter] - The gutter in the grid system
223
- /// @access private
224
- /// @group @carbon/grid
225
- @mixin carbon--hang($gutter: $carbon--grid-gutter) {
226
- .#{$prefix}--hang--start {
227
- padding-left: ($gutter / 2);
228
- }
229
-
230
- .#{$prefix}--hang--end {
231
- padding-right: ($gutter / 2);
232
- }
233
-
234
- // Deprecated ☠️
235
- .#{$prefix}--hang--left {
236
- padding-left: ($gutter / 2);
237
- }
238
-
239
- .#{$prefix}--hang--right {
240
- padding-right: ($gutter / 2);
241
- }
242
- }
243
-
244
- // -----------------------------------------------------------------------------
245
- // Aspect ratio
246
- // -----------------------------------------------------------------------------
247
-
248
- /// The aspect ratios that are used to generate corresponding aspect ratio
249
- /// classes in code
250
- /// @type List
251
- /// @access public
252
- /// @group @carbon/grid
253
- $carbon--aspect-ratios: (
254
- (16, 9),
255
- (9, 16),
256
- (2, 1),
257
- (1, 2),
258
- (4, 3),
259
- (3, 4),
260
- (3, 2),
261
- (2, 3),
262
- (1, 1)
263
- );
264
-
265
- /// Generates the CSS classname utilities for the aspect ratios
266
- ///
267
- /// CSS Tricks article on aspect ratios and all the different ways it can be done.
268
- /// https://css-tricks.com/aspect-ratio-boxes/#article-header-id-6
269
- ///
270
- /// That article references an earlier article on the topic.
271
- /// https://keithjgrant.com/posts/2017/03/aspect-ratios/
272
- ///
273
- /// @param {Number} $width width from an aspect ratio
274
- /// @param {Number} $height height from an aspect ratio
275
- /// @access private
276
- /// @group @carbon/grid
277
- @mixin carbon--aspect-ratio($aspect-ratios: $carbon--aspect-ratios) {
278
- .#{$prefix}--aspect-ratio {
279
- position: relative;
280
- }
281
-
282
- .#{$prefix}--aspect-ratio::before {
283
- width: 1px;
284
- height: 0;
285
- margin-left: -1px;
286
- content: '';
287
- float: left;
288
- }
289
-
290
- .#{$prefix}--aspect-ratio::after {
291
- display: table;
292
- clear: both;
293
- content: '';
294
- }
295
-
296
- @each $aspect-ratio in $aspect-ratios {
297
- $width: nth($aspect-ratio, 1);
298
- $height: nth($aspect-ratio, 2);
299
-
300
- .#{$prefix}--aspect-ratio--#{$width}x#{$height}::before {
301
- padding-top: percentage($height / $width);
302
- }
303
- }
304
-
305
- // leaving here for legacy support
306
- .#{$prefix}--aspect-ratio--object {
307
- position: absolute;
308
- top: 0;
309
- left: 0;
310
- width: 100%;
311
- height: 100%;
312
- }
313
- }
314
-
315
- // -----------------------------------------------------------------------------
316
- // Grid
317
- // -----------------------------------------------------------------------------
318
-
319
- /// Create the container for a grid. Will cause full-bleed for the grid unless
320
- /// max-width properties are added with `make-container-max-widths`
321
- /// @param {Map} $breakpoints [$carbon--grid-breakpoints] - A map of breakpoints where the key is the name
322
- /// @access private
323
- /// @group @carbon/grid
324
- @mixin carbon--make-container($breakpoints: $carbon--grid-breakpoints) {
325
- margin-right: auto;
326
- margin-left: auto;
327
-
328
- @include carbon--set-largest-breakpoint();
329
-
330
- @each $name, $value in $breakpoints {
331
- $prev-breakpoint: map-get($breakpoints, carbon--breakpoint-prev($name));
332
- $margin: map-get($value, margin);
333
-
334
- @if $prev-breakpoint {
335
- $prev-margin: map-get($prev-breakpoint, margin);
336
- @if $prev-margin != $margin {
337
- @include carbon--breakpoint($name) {
338
- padding-right: #{($carbon--grid-gutter / 2) + $margin};
339
- padding-left: #{($carbon--grid-gutter / 2) + $margin};
340
- }
341
- }
342
- } @else {
343
- @include carbon--breakpoint($name) {
344
- padding-right: #{($carbon--grid-gutter / 2) + $margin};
345
- padding-left: #{($carbon--grid-gutter / 2) + $margin};
346
- }
347
- }
348
- }
349
- }
350
-
351
- /// Get the last breakpoint width and set max-width to its value
352
- /// @param {Map} $breakpoints [$carbon--grid-breakpoints] - A map of breakpoints where the key is the name
353
- /// @access private
354
- /// @group @carbon/grid
355
- @mixin carbon--set-largest-breakpoint($breakpoints: $carbon--grid-breakpoints) {
356
- $largest-breakpoint: last-map-item($breakpoints);
357
-
358
- max-width: map-get($largest-breakpoint, 'width');
359
- }
360
-
361
- /// Add in the max-widths for each breakpoint to the container
362
- /// @param {Map} $breakpoints [$carbon--grid-breakpoints] - A map of breakpoints where the key is the name
363
- /// @access private
364
- /// @group @carbon/grid
365
- @mixin carbon--make-container-max-widths(
366
- $breakpoints: $carbon--grid-breakpoints
367
- ) {
368
- @each $name, $value in $breakpoints {
369
- @include carbon--breakpoint($name) {
370
- max-width: map-get($value, width);
371
- }
372
- }
373
- }
374
-
375
- /// Generate the CSS for a grid for the given breakpoints and gutters
376
- /// @param {Map} $breakpoints [$carbon--grid-breakpoints] - The default breakpoints
377
- /// @param {Number} $grid-gutter [$carbon--grid-gutter] - The default gutters
378
- /// @param {Number} $condensed-gutter [$carbon--grid-gutter--condensed] - The condensed mode gutter
379
- /// @access public
380
- /// @group @carbon/grid
381
- @mixin carbon--grid(
382
- $breakpoints: $carbon--grid-breakpoints,
383
- $grid-gutter: $carbon--grid-gutter,
384
- $condensed-gutter: $carbon--grid-gutter--condensed
385
- ) {
386
- .#{$prefix}--grid {
387
- @include carbon--make-container($breakpoints);
388
- }
389
-
390
- @include carbon--largest-breakpoint($breakpoints) {
391
- .#{$prefix}--grid--full-width {
392
- max-width: 100%;
393
- }
394
- }
395
-
396
- .#{$prefix}--row {
397
- @include carbon--make-row();
398
- }
399
-
400
- .#{$prefix}--row-padding [class*='#{$prefix}--col'],
401
- .#{$prefix}--col-padding {
402
- padding-top: $grid-gutter / 2;
403
- padding-bottom: $grid-gutter / 2;
404
- }
405
-
406
- .#{$prefix}--grid--condensed [class*='#{$prefix}--col'] {
407
- padding-top: $condensed-gutter / 2;
408
- padding-bottom: $condensed-gutter / 2;
409
- }
410
-
411
- @include carbon--make-grid-columns($breakpoints, $grid-gutter);
412
- @include carbon--no-gutter();
413
- @include carbon--hang($grid-gutter);
414
- @include carbon--aspect-ratio();
415
- }
@@ -1,12 +0,0 @@
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
- /// Namespace prefix
9
- /// @type String
10
- /// @access public
11
- /// @group @carbon/grid
12
- $prefix: 'bx' !default;
@@ -1,10 +0,0 @@
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
- @import './_inlined/mixins';
9
-
10
- @include carbon--grid();
@@ -1,10 +0,0 @@
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
- @import 'mixins';
9
-
10
- @include carbon--grid();
@@ -1,198 +0,0 @@
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 'sass:list';
9
- @use 'sass:map';
10
- @use 'sass:meta';
11
- @use '../../../../../layout/modules/convert';
12
- @use 'config' as *;
13
-
14
- /// Provide a map and index, and get back the relevant key value
15
- /// @access public
16
- /// @param {Map} $map - Map
17
- /// @param {Integer} $index - Key chain
18
- /// @return {String} Desired value
19
- /// @group @carbon/layout
20
- @function -key-by-index($map, $index) {
21
- $keys: map.keys($map);
22
- @return nth($keys, $index);
23
- }
24
-
25
- /// Get the value of the next breakpoint, or null for the last breakpoint
26
- /// @param {String} $name - The name of the breakpoint
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
28
- /// @param {List} $breakpoint-names [map-keys($breakpoints)] - A list of names from the `$breakpoints` map
29
- /// @return {String}
30
- /// @access public
31
- /// @group @carbon/layout
32
- @function breakpoint-next(
33
- $name,
34
- $breakpoints: $grid-breakpoints,
35
- $breakpoint-names: map.keys($breakpoints)
36
- ) {
37
- $n: list.index($breakpoint-names, $name);
38
- @if $n != null and $n < list.length($breakpoint-names) {
39
- @return list.nth($breakpoint-names, $n + 1);
40
- }
41
- @return null;
42
- }
43
-
44
- /// Get the value of the previous breakpoint, or null for the first breakpoint
45
- /// @param {String} $name - The name of the breakpoint
46
- /// @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
47
- /// @param {List} $breakpoint-names [map-keys($breakpoints)] - A list of names from the `$breakpoints` map
48
- /// @return {String}
49
- /// @access public
50
- /// @group @carbon/layout
51
- @function breakpoint-prev(
52
- $name,
53
- $breakpoints: $grid-breakpoints,
54
- $breakpoint-names: map.keys($breakpoints)
55
- ) {
56
- $n: list.index($breakpoint-names, $name);
57
- @if $n != null and $n > 1 {
58
- @return list.nth($breakpoint-names, $n - 1);
59
- }
60
- @return null;
61
- }
62
-
63
- /// Check to see if the given breakpoint name
64
- /// @param {String} $name - The name of the breakpoint
65
- /// @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
66
- /// @return {Bool}
67
- /// @access public
68
- /// @group @carbon/layout
69
- @function is-smallest-breakpoint($name, $breakpoints: $grid-breakpoints) {
70
- @return list.index(map.keys($breakpoints), $name) == 1;
71
- }
72
-
73
- /// Returns the largest breakpoint name
74
- /// @param {Map} $breakpoints [$grid-breakpoints] - A map of breakpoints where the key is the name
75
- /// @return {String}
76
- /// @access public
77
- /// @group @carbon/layout
78
- @function largest-breakpoint-name($breakpoints: $grid-breakpoints) {
79
- $total-breakpoints: list.length($breakpoints);
80
- @return -key-by-index($breakpoints, $total-breakpoints);
81
- }
82
-
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`.
84
- /// @param {String} $name - The name of the breakpoint
85
- /// @return {String}
86
- /// @access public
87
- /// @group @carbon/layout
88
- @function breakpoint-infix($name) {
89
- @return '-#{$name}';
90
- }
91
-
92
- /// Generate a media query from the width of the given breakpoint to infinity
93
- /// @param {String | Number} $name
94
- /// @param {Map} $breakpoints [$grid-breakpoints] - A map of breakpoints where the key is the name
95
- /// @content
96
- /// @access public
97
- /// @group @carbon/layout
98
- @mixin breakpoint-up($name, $breakpoints: $grid-breakpoints) {
99
- @if meta.type-of($name) == 'number' {
100
- @media (min-width: $name) {
101
- @content;
102
- }
103
- } @else if map.has-key($breakpoints, $name) {
104
- $breakpoint: map.get($breakpoints, $name);
105
- $width: map.get($breakpoint, width);
106
- @if is-smallest-breakpoint($name, $breakpoints) {
107
- @content;
108
- } @else {
109
- @media (min-width: $width) {
110
- @content;
111
- }
112
- }
113
- } @else {
114
- @error 'Unable to find a breakpoint with name `#{$name}`. Expected one of: (#{map.keys($breakpoints)})';
115
- }
116
- }
117
-
118
- /// Generate a media query for the maximum width of the given styles
119
- /// @param {String | Number} $name
120
- /// @param {Map} $breakpoints [$grid-breakpoints] - A map of breakpoints where the key is the name
121
- /// @content
122
- /// @access public
123
- /// @group @carbon/layout
124
- @mixin breakpoint-down($name, $breakpoints: $grid-breakpoints) {
125
- @if meta.type-of($name) == 'number' {
126
- @media (max-width: $name) {
127
- @content;
128
- }
129
- } @else if map.has-key($breakpoints, $name) {
130
- // We borrow this logic from bootstrap for specifying the value of the
131
- // max-width. The maximum width is calculated by finding the breakpoint and
132
- // subtracting .02 from its value. This value is used instead of .01 to
133
- // avoid rounding issues in Safari
134
- // https://github.com/twbs/bootstrap/blob/c5b1919deaf5393fcca9e9b9d7ce9c338160d99d/scss/mixins/_breakpoints.scss#L34-L46
135
- $breakpoint: map.get($breakpoints, $name);
136
- $width: map.get($breakpoint, width) - 0.02;
137
- @media (max-width: $width) {
138
- @content;
139
- }
140
- } @else {
141
- @error 'Unable to find a breakpoint with name `#{$name}`. Expected one of: (#{map.keys($breakpoints)})';
142
- }
143
- }
144
-
145
- /// Generate a media query for the range between the lower and upper breakpoints
146
- /// @param {String | Number} $lower
147
- /// @param {String | Number} $upper
148
- /// @param {Map} $breakpoints [$grid-breakpoints] - A map of breakpoints where the key is the name
149
- /// @content
150
- /// @access public
151
- /// @group @carbon/layout
152
- @mixin breakpoint-between($lower, $upper, $breakpoints: $grid-breakpoints) {
153
- $is-number-lower: meta.type-of($lower) == 'number';
154
- $is-number-upper: meta.type-of($upper) == 'number';
155
- $min: if($is-number-lower, $lower, map.get($breakpoints, $lower));
156
- $max: if($is-number-upper, $upper, map.get($breakpoints, $upper));
157
-
158
- @if $min and $max {
159
- $min-width: if(not $is-number-lower and $min, map.get($min, width), $min);
160
- $max-width: if(not $is-number-upper and $max, map.get($max, width), $max);
161
- @media (min-width: $min-width) and (max-width: $max-width) {
162
- @content;
163
- }
164
- } @else if $min != null and $max == null {
165
- @include breakpoint-up($lower) {
166
- @content;
167
- }
168
- } @else if $min == null and $max != null {
169
- @include breakpoint-down($upper) {
170
- @content;
171
- }
172
- } @else {
173
- @error 'Unable to find a breakpoint to satisfy: (#{$lower},#{$upper}). Expected both to be one of (#{map.keys($breakpoints)}).';
174
- }
175
- }
176
-
177
- /// Generate media query for the largest breakpoint
178
- /// @param {Map} $breakpoints [$grid-breakpoints] - A map of breakpoints where the key is the name
179
- /// @content
180
- /// @access public
181
- /// @group @carbon/layout
182
- @mixin largest-breakpoint($breakpoints: $grid-breakpoints) {
183
- @include breakpoint(largest-breakpoint-name()) {
184
- @content;
185
- }
186
- }
187
-
188
- /// Generate a media query for a given breakpoint
189
- /// @param {String | Number} $name
190
- /// @param {Map} $breakpoints [$grid-breakpoints] - A map of breakpoints where the key is the name
191
- /// @content
192
- /// @access public
193
- /// @group @carbon/layout
194
- @mixin breakpoint($name, $breakpoints: $grid-breakpoints) {
195
- @include breakpoint-up($name, $breakpoints) {
196
- @content;
197
- }
198
- }