@carbon/type 10.41.0 → 10.43.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 (51) hide show
  1. package/es/index.js +73 -2
  2. package/lib/index.js +169 -98
  3. package/package.json +5 -5
  4. package/scss/_inlined/_reset.scss +1 -1
  5. package/scss/_inlined/_scale.scss +1 -1
  6. package/scss/_inlined/_styles.import.scss +3 -3
  7. package/scss/_inlined/_styles.scss +1 -1
  8. package/scss/_styles.import.scss +3 -3
  9. package/scss/modules/_font-family.scss +13 -11
  10. package/scss/modules/_scale.scss +2 -1
  11. package/scss/modules/_styles.scss +7 -11
  12. package/scss/vendor/@carbon/grid/12.scss +41 -0
  13. package/scss/vendor/@carbon/grid/_inlined/12.scss +41 -0
  14. package/scss/vendor/@carbon/grid/_inlined/_mixins.import.scss +431 -0
  15. package/scss/vendor/@carbon/grid/_inlined/_mixins.scss +415 -0
  16. package/scss/vendor/@carbon/grid/_inlined/_prefix.scss +12 -0
  17. package/scss/vendor/@carbon/grid/_mixins.import.scss +431 -0
  18. package/scss/vendor/@carbon/grid/_mixins.scss +415 -0
  19. package/scss/vendor/@carbon/grid/_prefix.scss +12 -0
  20. package/scss/vendor/@carbon/grid/grid.scss +10 -0
  21. package/scss/vendor/@carbon/grid/index.scss +10 -0
  22. package/scss/vendor/@carbon/{layout → grid}/modules/_breakpoint.scss +11 -45
  23. package/scss/vendor/@carbon/grid/modules/_config.scss +94 -0
  24. package/scss/vendor/@carbon/grid/modules/_css-grid.scss +470 -0
  25. package/scss/vendor/@carbon/grid/modules/_flex-grid.scss +363 -0
  26. package/scss/vendor/@carbon/grid/modules/_mixins.scss +336 -0
  27. package/scss/vendor/@carbon/grid/vendor/@carbon/import-once/import-once.scss +27 -0
  28. package/scss/vendor/@carbon/grid/vendor/@carbon/import-once/index.scss +8 -0
  29. package/scss/vendor/@carbon/{layout → grid/vendor/@carbon/layout}/_breakpoint.scss +0 -0
  30. package/scss/vendor/@carbon/{layout → grid/vendor/@carbon/layout}/_convert.import.scss +0 -0
  31. package/scss/vendor/@carbon/{layout → grid/vendor/@carbon/layout}/_convert.scss +0 -0
  32. package/scss/vendor/@carbon/{layout → grid/vendor/@carbon/layout}/_key-height.import.scss +2 -2
  33. package/scss/vendor/@carbon/{layout → grid/vendor/@carbon/layout}/_key-height.scss +0 -0
  34. package/scss/vendor/@carbon/{layout → grid/vendor/@carbon/layout}/_mini-unit.scss +0 -0
  35. package/scss/vendor/@carbon/{layout → grid/vendor/@carbon/layout}/_spacing.scss +0 -0
  36. package/scss/vendor/@carbon/{layout → grid/vendor/@carbon/layout}/_utilities.scss +0 -0
  37. package/scss/vendor/@carbon/{layout → grid/vendor/@carbon/layout}/generated/_container.scss +0 -0
  38. package/scss/vendor/@carbon/{layout → grid/vendor/@carbon/layout}/generated/_fluid-spacing.scss +0 -0
  39. package/scss/vendor/@carbon/{layout → grid/vendor/@carbon/layout}/generated/_icon-size.scss +0 -0
  40. package/scss/vendor/@carbon/{layout → grid/vendor/@carbon/layout}/generated/_layout.scss +0 -0
  41. package/scss/vendor/@carbon/{layout → grid/vendor/@carbon/layout}/generated/_size.scss +0 -0
  42. package/scss/vendor/@carbon/{layout → grid/vendor/@carbon/layout}/generated/_spacing.scss +0 -0
  43. package/scss/vendor/@carbon/{layout → grid/vendor/@carbon/layout}/index.scss +0 -0
  44. package/scss/vendor/@carbon/{layout → grid/vendor/@carbon/layout}/layout.scss +0 -0
  45. package/scss/vendor/@carbon/{layout → grid/vendor/@carbon/layout}/modules/_convert.scss +0 -0
  46. package/scss/vendor/@carbon/{layout → grid/vendor/@carbon/layout}/modules/_spacing.scss +0 -0
  47. package/scss/vendor/@carbon/{layout → grid/vendor/@carbon/layout}/modules/_utilities.scss +3 -3
  48. package/scss/vendor/@carbon/{layout → grid/vendor/@carbon/layout}/modules/generated/_fluid-spacing.scss +0 -0
  49. package/scss/vendor/@carbon/{layout → grid/vendor/@carbon/layout}/modules/generated/_spacing.scss +0 -0
  50. package/scss/vendor/@carbon/import-once/import-once.scss +1 -1
  51. package/umd/index.js +173 -100
@@ -0,0 +1,415 @@
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 '../vendor/@carbon/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
+ }
@@ -0,0 +1,12 @@
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;