@carbon/charts 0.41.46 → 0.41.50

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 (248) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/build/demo/data/combo.d.ts +0 -11
  3. package/build/demo/data/index.d.ts +23 -17
  4. package/build/demo/data/wordcloud.d.ts +14 -0
  5. package/build/src/charts/index.d.ts +1 -0
  6. package/build/src/charts/wordcloud.d.ts +6 -0
  7. package/build/src/components/graphs/wordcloud.d.ts +10 -0
  8. package/build/src/components/index.d.ts +1 -0
  9. package/build/src/configuration.d.ts +2 -1
  10. package/build/src/interfaces/charts.d.ts +23 -0
  11. package/build/src/interfaces/events.d.ts +9 -0
  12. package/bundle.js +1 -1
  13. package/charts/index.d.ts +1 -0
  14. package/charts/index.js +1 -0
  15. package/charts/index.js.map +1 -1
  16. package/charts/wordcloud.d.ts +6 -0
  17. package/charts/wordcloud.js +46 -0
  18. package/charts/wordcloud.js.map +1 -0
  19. package/components/essentials/tooltip-axis.js +1 -1
  20. package/components/essentials/tooltip-axis.js.map +1 -1
  21. package/components/graphs/area.js +11 -2
  22. package/components/graphs/area.js.map +1 -1
  23. package/components/graphs/boxplot.js +2 -2
  24. package/components/graphs/boxplot.js.map +1 -1
  25. package/components/graphs/wordcloud.d.ts +10 -0
  26. package/components/graphs/wordcloud.js +229 -0
  27. package/components/graphs/wordcloud.js.map +1 -0
  28. package/components/index.d.ts +1 -0
  29. package/components/index.js +1 -0
  30. package/components/index.js.map +1 -1
  31. package/configuration.d.ts +2 -1
  32. package/configuration.js +22 -0
  33. package/configuration.js.map +1 -1
  34. package/demo/data/bundle.js +1 -1
  35. package/demo/data/combo.d.ts +0 -11
  36. package/demo/data/combo.js +0 -11
  37. package/demo/data/combo.js.map +1 -1
  38. package/demo/data/index.d.ts +23 -17
  39. package/demo/data/index.js +107 -50
  40. package/demo/data/index.js.map +1 -1
  41. package/demo/data/wordcloud.d.ts +14 -0
  42. package/demo/data/wordcloud.js +105 -0
  43. package/demo/data/wordcloud.js.map +1 -0
  44. package/demo/styles.css +2824 -28
  45. package/demo/styles.css.map +1 -1
  46. package/demo/styles.min.css +1 -1
  47. package/demo/styles.min.css.map +1 -1
  48. package/demo/tsconfig.tsbuildinfo +31 -17
  49. package/interfaces/charts.d.ts +23 -0
  50. package/interfaces/charts.js.map +1 -1
  51. package/interfaces/events.d.ts +9 -0
  52. package/interfaces/events.js +10 -0
  53. package/interfaces/events.js.map +1 -1
  54. package/package.json +8 -7
  55. package/styles/_type.scss +4 -2
  56. package/styles/graphs/_wordcloud.scss +7 -0
  57. package/styles/graphs/index.scss +1 -0
  58. package/styles/vendor/@carbon/colors/README.md +4 -3
  59. package/styles/vendor/@carbon/colors/es/index.js +13 -12
  60. package/styles/vendor/@carbon/colors/lib/index.js +98 -93
  61. package/styles/vendor/@carbon/colors/package.json +14 -10
  62. package/styles/vendor/@carbon/colors/scss/colors.scss +1 -1
  63. package/styles/vendor/@carbon/colors/scss/index.scss +1 -1
  64. package/styles/vendor/@carbon/colors/scss/mixins.scss +33 -13
  65. package/styles/vendor/@carbon/colors/umd/index.js +99 -94
  66. package/styles/vendor/@carbon/elements/README.md +0 -6
  67. package/styles/vendor/@carbon/elements/es/index.js +4 -11
  68. package/styles/vendor/@carbon/elements/lib/index.js +959 -13
  69. package/styles/vendor/@carbon/elements/package.json +17 -13
  70. package/styles/vendor/@carbon/elements/scss/colors/colors.scss +1 -1
  71. package/styles/vendor/@carbon/elements/scss/colors/index.scss +1 -1
  72. package/styles/vendor/@carbon/elements/scss/colors/mixins.scss +33 -13
  73. package/styles/vendor/@carbon/elements/scss/grid/_inlined/_mixins.scss +82 -22
  74. package/styles/vendor/@carbon/elements/scss/grid/_mixins.scss +82 -22
  75. package/styles/vendor/@carbon/elements/scss/grid/modules/_breakpoint.scss +266 -0
  76. package/styles/vendor/@carbon/{themes/node_modules/@carbon/colors/scss/colors.scss → elements/scss/grid/modules/_config.scss} +6 -6
  77. package/styles/vendor/@carbon/elements/scss/grid/modules/_css-grid.scss +350 -0
  78. package/styles/vendor/@carbon/elements/scss/grid/modules/_mixins.scss +323 -0
  79. package/styles/vendor/@carbon/elements/scss/grid/vendor/@carbon/layout/_breakpoint.scss +8 -3
  80. package/styles/vendor/@carbon/elements/scss/grid/vendor/@carbon/layout/modules/_breakpoint.scss +232 -0
  81. package/styles/vendor/@carbon/elements/scss/grid/vendor/@carbon/layout/modules/_convert.scss +40 -0
  82. package/styles/vendor/@carbon/elements/scss/grid/vendor/@carbon/layout/modules/_spacing.scss +9 -0
  83. package/styles/vendor/@carbon/elements/scss/grid/vendor/@carbon/layout/modules/_utilities.scss +41 -0
  84. package/styles/vendor/@carbon/elements/scss/grid/vendor/@carbon/layout/modules/generated/_fluid-spacing.scss +37 -0
  85. package/styles/vendor/@carbon/elements/scss/grid/vendor/@carbon/layout/modules/generated/_spacing.scss +85 -0
  86. package/styles/vendor/@carbon/elements/scss/layout/_breakpoint.scss +8 -3
  87. package/styles/vendor/@carbon/elements/scss/layout/modules/_breakpoint.scss +232 -0
  88. package/styles/vendor/@carbon/elements/scss/layout/modules/_convert.scss +40 -0
  89. package/styles/vendor/@carbon/elements/scss/layout/modules/_spacing.scss +9 -0
  90. package/styles/vendor/@carbon/elements/scss/layout/modules/_utilities.scss +41 -0
  91. package/styles/vendor/@carbon/elements/scss/layout/modules/generated/_fluid-spacing.scss +37 -0
  92. package/styles/vendor/@carbon/elements/scss/layout/modules/generated/_spacing.scss +85 -0
  93. package/styles/vendor/@carbon/elements/scss/motion/motion.scss +24 -0
  94. package/styles/vendor/@carbon/elements/scss/themes/generated/_mixins.scss +643 -138
  95. package/styles/vendor/@carbon/elements/scss/themes/generated/_themes.scss +154 -77
  96. package/styles/vendor/@carbon/elements/scss/themes/generated/_tokens.scss +157 -75
  97. package/styles/vendor/@carbon/elements/scss/themes/modules/_theme.scss +50 -0
  98. package/styles/vendor/@carbon/elements/scss/themes/modules/_themes.scss +8 -0
  99. package/styles/vendor/@carbon/elements/scss/themes/modules/_utilities.scss +18 -0
  100. package/styles/vendor/@carbon/elements/scss/themes/modules/generated/_themes.scss +247 -0
  101. package/styles/vendor/@carbon/elements/scss/type/_font-family.scss +2 -2
  102. package/styles/vendor/@carbon/elements/scss/type/_inlined/_font-family.scss +2 -2
  103. package/styles/vendor/@carbon/elements/scss/type/_inlined/_reset.scss +9 -3
  104. package/styles/vendor/@carbon/elements/scss/type/_inlined/_scale.scss +2 -2
  105. package/styles/vendor/@carbon/elements/scss/type/_inlined/_styles.scss +60 -57
  106. package/styles/vendor/@carbon/elements/scss/type/_inlined/font-face/_mono.scss +72 -72
  107. package/styles/vendor/@carbon/elements/scss/type/_inlined/font-face/_sans-condensed.scss +302 -0
  108. package/styles/vendor/@carbon/elements/scss/type/_inlined/font-face/_sans.scss +84 -84
  109. package/styles/vendor/@carbon/elements/scss/type/_inlined/font-face/_serif.scss +72 -72
  110. package/styles/vendor/@carbon/elements/scss/type/_reset.scss +9 -3
  111. package/styles/vendor/@carbon/elements/scss/type/_scale.scss +2 -2
  112. package/styles/vendor/@carbon/elements/scss/type/_styles.scss +60 -57
  113. package/styles/vendor/@carbon/elements/scss/type/font-face/_mono.scss +72 -72
  114. package/styles/vendor/@carbon/elements/scss/type/font-face/_sans-condensed.scss +302 -0
  115. package/styles/vendor/@carbon/elements/scss/type/font-face/_sans.scss +84 -84
  116. package/styles/vendor/@carbon/elements/scss/type/font-face/_serif.scss +72 -72
  117. package/styles/vendor/@carbon/elements/scss/type/modules/_classes.scss +42 -0
  118. package/styles/vendor/@carbon/elements/scss/type/modules/_font-family.scss +70 -0
  119. package/styles/vendor/@carbon/elements/scss/type/modules/_prefix.scss +11 -0
  120. package/styles/vendor/@carbon/elements/scss/type/modules/_reset.scss +92 -0
  121. package/styles/vendor/@carbon/elements/scss/type/modules/_scale.scss +56 -0
  122. package/styles/vendor/@carbon/elements/scss/type/modules/_styles.scss +713 -0
  123. package/styles/vendor/@carbon/elements/scss/type/vendor/@carbon/layout/_breakpoint.scss +8 -3
  124. package/styles/vendor/@carbon/elements/scss/type/vendor/@carbon/layout/modules/_breakpoint.scss +232 -0
  125. package/styles/vendor/@carbon/elements/scss/type/vendor/@carbon/layout/modules/_convert.scss +40 -0
  126. package/styles/vendor/@carbon/elements/scss/type/vendor/@carbon/layout/modules/_spacing.scss +9 -0
  127. package/styles/vendor/@carbon/elements/scss/type/vendor/@carbon/layout/modules/_utilities.scss +41 -0
  128. package/styles/vendor/@carbon/elements/scss/type/vendor/@carbon/layout/modules/generated/_fluid-spacing.scss +37 -0
  129. package/styles/vendor/@carbon/elements/scss/type/vendor/@carbon/layout/modules/generated/_spacing.scss +85 -0
  130. package/styles/vendor/@carbon/elements/src/__tests__/PublicAPI-test.js +12 -0
  131. package/styles/vendor/@carbon/elements/src/__tests__/__snapshots__/PublicAPI-test.js.snap +306 -0
  132. package/styles/vendor/@carbon/elements/src/index.js +166 -4
  133. package/styles/vendor/@carbon/elements/umd/index.js +961 -17
  134. package/styles/vendor/@carbon/layout/README.md +0 -6
  135. package/styles/vendor/@carbon/layout/es/index.js +1 -1
  136. package/styles/vendor/@carbon/{themes/node_modules/@carbon/colors/scss → layout}/index.scss +5 -6
  137. package/styles/vendor/@carbon/layout/lib/index.js +30 -30
  138. package/styles/vendor/@carbon/layout/package.json +14 -10
  139. package/styles/vendor/@carbon/layout/scss/_breakpoint.scss +8 -3
  140. package/styles/vendor/@carbon/layout/scss/modules/_breakpoint.scss +232 -0
  141. package/styles/vendor/@carbon/layout/scss/modules/_convert.scss +40 -0
  142. package/styles/vendor/@carbon/layout/scss/modules/_spacing.scss +9 -0
  143. package/styles/vendor/@carbon/layout/scss/modules/_utilities.scss +41 -0
  144. package/styles/vendor/@carbon/layout/scss/modules/generated/_fluid-spacing.scss +37 -0
  145. package/styles/vendor/@carbon/layout/scss/modules/generated/_spacing.scss +85 -0
  146. package/styles/vendor/@carbon/layout/umd/index.js +31 -31
  147. package/styles/vendor/@carbon/motion/README.md +0 -6
  148. package/styles/vendor/@carbon/motion/es/index.js +8 -1
  149. package/styles/vendor/@carbon/motion/index.scss +56 -0
  150. package/styles/vendor/@carbon/motion/lib/index.js +14 -0
  151. package/styles/vendor/@carbon/motion/package.json +10 -6
  152. package/styles/vendor/@carbon/motion/scss/motion.scss +24 -0
  153. package/styles/vendor/@carbon/motion/src/index.js +16 -0
  154. package/styles/vendor/@carbon/motion/umd/index.js +15 -1
  155. package/styles/vendor/@carbon/themes/README.md +5 -4
  156. package/styles/vendor/@carbon/themes/es/index.js +719 -57
  157. package/styles/vendor/@carbon/themes/index.scss +9 -0
  158. package/styles/vendor/@carbon/themes/lib/index.js +1297 -251
  159. package/styles/vendor/@carbon/themes/metadata.yml +3 -0
  160. package/styles/vendor/@carbon/themes/package.json +23 -14
  161. package/styles/vendor/@carbon/themes/scss/_mixins.scss +27 -146
  162. package/styles/vendor/@carbon/themes/scss/_theme-maps.scss +3 -263
  163. package/styles/vendor/@carbon/themes/scss/_tokens.scss +2 -297
  164. package/styles/vendor/@carbon/themes/scss/generated/_mixins.scss +1851 -0
  165. package/styles/vendor/@carbon/themes/scss/generated/_themes.scss +1534 -0
  166. package/styles/vendor/@carbon/themes/scss/generated/_tokens.scss +1757 -0
  167. package/styles/vendor/@carbon/themes/scss/modules/_theme.scss +50 -0
  168. package/styles/vendor/@carbon/themes/scss/modules/_themes.scss +8 -0
  169. package/styles/vendor/@carbon/themes/scss/modules/_utilities.scss +18 -0
  170. package/styles/vendor/@carbon/themes/scss/modules/generated/_themes.scss +247 -0
  171. package/styles/vendor/@carbon/themes/scss/themes.scss +3 -2
  172. package/styles/vendor/@carbon/themes/src/g10.js +97 -5
  173. package/styles/vendor/@carbon/themes/src/g100.js +96 -4
  174. package/styles/vendor/@carbon/themes/src/g90.js +98 -6
  175. package/styles/vendor/@carbon/themes/src/index.js +5 -3
  176. package/styles/vendor/@carbon/themes/src/tokens.js +112 -2
  177. package/styles/vendor/@carbon/themes/src/tools.js +25 -0
  178. package/styles/vendor/@carbon/themes/src/v9.js +181 -0
  179. package/styles/vendor/@carbon/themes/src/white.js +98 -3
  180. package/styles/vendor/@carbon/themes/umd/index.js +1297 -254
  181. package/styles/vendor/@carbon/type/README.md +0 -6
  182. package/styles/vendor/@carbon/type/es/index.js +111 -82
  183. package/styles/vendor/@carbon/type/lib/index.js +132 -103
  184. package/styles/vendor/@carbon/type/package.json +12 -8
  185. package/styles/vendor/@carbon/type/scss/_font-family.scss +2 -2
  186. package/styles/vendor/@carbon/type/scss/_inlined/_font-family.scss +2 -2
  187. package/styles/vendor/@carbon/type/scss/_inlined/_reset.scss +9 -3
  188. package/styles/vendor/@carbon/type/scss/_inlined/_scale.scss +2 -2
  189. package/styles/vendor/@carbon/type/scss/_inlined/_styles.scss +60 -57
  190. package/styles/vendor/@carbon/type/scss/_inlined/font-face/_mono.scss +72 -72
  191. package/styles/vendor/@carbon/type/scss/_inlined/font-face/_sans-condensed.scss +302 -0
  192. package/styles/vendor/@carbon/type/scss/_inlined/font-face/_sans.scss +84 -84
  193. package/styles/vendor/@carbon/type/scss/_inlined/font-face/_serif.scss +72 -72
  194. package/styles/vendor/@carbon/type/scss/_reset.scss +9 -3
  195. package/styles/vendor/@carbon/type/scss/_scale.scss +2 -2
  196. package/styles/vendor/@carbon/type/scss/_styles.scss +60 -57
  197. package/styles/vendor/@carbon/type/scss/font-face/_mono.scss +72 -72
  198. package/styles/vendor/@carbon/type/scss/font-face/_sans-condensed.scss +302 -0
  199. package/styles/vendor/@carbon/type/scss/font-face/_sans.scss +84 -84
  200. package/styles/vendor/@carbon/type/scss/font-face/_serif.scss +72 -72
  201. package/styles/vendor/@carbon/type/scss/modules/_classes.scss +42 -0
  202. package/styles/vendor/@carbon/type/scss/modules/_font-family.scss +70 -0
  203. package/styles/vendor/@carbon/type/scss/modules/_prefix.scss +11 -0
  204. package/styles/vendor/@carbon/type/scss/modules/_reset.scss +92 -0
  205. package/styles/vendor/@carbon/type/scss/modules/_scale.scss +56 -0
  206. package/styles/vendor/@carbon/type/scss/modules/_styles.scss +713 -0
  207. package/styles/vendor/@carbon/type/scss/vendor/@carbon/layout/_breakpoint.scss +8 -3
  208. package/styles/vendor/@carbon/type/scss/vendor/@carbon/layout/modules/_breakpoint.scss +232 -0
  209. package/styles/vendor/@carbon/type/scss/vendor/@carbon/layout/modules/_convert.scss +40 -0
  210. package/styles/vendor/@carbon/type/scss/vendor/@carbon/layout/modules/_spacing.scss +9 -0
  211. package/styles/vendor/@carbon/type/scss/vendor/@carbon/layout/modules/_utilities.scss +41 -0
  212. package/styles/vendor/@carbon/type/scss/vendor/@carbon/layout/modules/generated/_fluid-spacing.scss +37 -0
  213. package/styles/vendor/@carbon/type/scss/vendor/@carbon/layout/modules/generated/_spacing.scss +85 -0
  214. package/styles/vendor/@carbon/type/src/__tests__/__snapshots__/styles-test.js.snap +32 -34
  215. package/styles/vendor/@carbon/type/src/__tests__/exports-test.js +1 -1
  216. package/styles/vendor/@carbon/type/src/__tests__/fluid-test.js +26 -26
  217. package/styles/vendor/@carbon/type/src/__tests__/styles-test.js +1 -1
  218. package/styles/vendor/@carbon/type/src/__tests__/tokens-test.js +2 -2
  219. package/styles/vendor/@carbon/type/src/fluid.js +1 -1
  220. package/styles/vendor/@carbon/type/src/index.js +1 -1
  221. package/styles/vendor/@carbon/type/src/styles.js +65 -64
  222. package/styles/vendor/@carbon/type/src/tokens.js +64 -31
  223. package/styles/vendor/@carbon/type/umd/index.js +134 -105
  224. package/styles-g10.css +570 -2
  225. package/styles-g10.css.map +1 -1
  226. package/styles-g10.min.css +1 -1
  227. package/styles-g10.min.css.map +1 -1
  228. package/styles-g100.css +574 -6
  229. package/styles-g100.css.map +1 -1
  230. package/styles-g100.min.css +1 -1
  231. package/styles-g100.min.css.map +1 -1
  232. package/styles-g90.css +574 -6
  233. package/styles-g90.css.map +1 -1
  234. package/styles-g90.min.css +1 -1
  235. package/styles-g90.min.css.map +1 -1
  236. package/styles.css +570 -2
  237. package/styles.css.map +1 -1
  238. package/styles.min.css +1 -1
  239. package/styles.min.css.map +1 -1
  240. package/tsconfig.tsbuildinfo +65 -15
  241. package/styles/vendor/@carbon/layout/docs/sass.md +0 -1899
  242. package/styles/vendor/@carbon/themes/node_modules/@carbon/colors/LICENSE +0 -201
  243. package/styles/vendor/@carbon/themes/node_modules/@carbon/colors/README.md +0 -154
  244. package/styles/vendor/@carbon/themes/node_modules/@carbon/colors/es/index.js +0 -287
  245. package/styles/vendor/@carbon/themes/node_modules/@carbon/colors/lib/index.js +0 -410
  246. package/styles/vendor/@carbon/themes/node_modules/@carbon/colors/package.json +0 -51
  247. package/styles/vendor/@carbon/themes/node_modules/@carbon/colors/scss/mixins.scss +0 -646
  248. package/styles/vendor/@carbon/themes/node_modules/@carbon/colors/umd/index.js +0 -416
@@ -0,0 +1,323 @@
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 'config' as *;
9
+ @use 'breakpoint' as *;
10
+
11
+ // -----------------------------------------------------------------------------
12
+ // Columns
13
+ // -----------------------------------------------------------------------------
14
+
15
+ /// Used to initialize the default properties for a column class, most notably
16
+ /// for setting width and default gutters when a column's breakpoint has not been
17
+ /// hit yet.
18
+ /// @param {Number} $gutter [$grid-gutter] - The gutter for the grid system
19
+ /// @param {Number} $collapsed-gutter [$grid-gutter--condensed] - The condensed mode gutter
20
+ /// @access private
21
+ /// @group @carbon/grid
22
+ @mixin -make-col-ready(
23
+ $gutter: $grid-gutter,
24
+ $condensed-gutter: $grid-gutter--condensed
25
+ ) {
26
+ // Prevent columns from becoming too narrow when at smaller grid tiers by
27
+ // always setting `width: 100%;`. This works because we use `flex` values
28
+ // later on to override this initial width.
29
+ width: 100%;
30
+ padding-right: ($gutter / 2);
31
+ padding-left: ($gutter / 2);
32
+
33
+ // For our condensed use-case, our gutters collapse to 2px solid, 1px on each
34
+ // side.
35
+ .#{$prefix}--row--condensed &,
36
+ .#{$prefix}--grid--condensed & {
37
+ padding-right: ($condensed-gutter / 2);
38
+ padding-left: ($condensed-gutter / 2);
39
+ }
40
+
41
+ // For our narrow use-case, our container hangs 16px into the gutter
42
+ .#{$prefix}--row--narrow &,
43
+ .#{$prefix}--grid--narrow & {
44
+ padding-right: ($gutter / 2);
45
+ padding-left: 0;
46
+ }
47
+ }
48
+
49
+ /// Define the width of the column for a given span and column count.
50
+ /// A width of 0 will hide the column entirely.
51
+ /// @param {Number} $span - The number of columns covered
52
+ /// @param {Number} $columns - The total number of columns available
53
+ /// @access private
54
+ /// @group @carbon/grid
55
+ @mixin -make-col($span, $columns) {
56
+ @if $span == 0 {
57
+ display: none;
58
+ } @else {
59
+ // Explicitly include `display: block` to override
60
+ display: block;
61
+ flex: 0 0 percentage($span / $columns);
62
+ // Add a `max-width` to ensure content within each column does not blow out
63
+ // the width of the column. Applies to IE10+ and Firefox. Chrome and Safari
64
+ // do not appear to require this.
65
+ max-width: percentage($span / $columns);
66
+ }
67
+ }
68
+
69
+ /// Create a column offset for a given span and column count.
70
+ /// @param {Number} $span - The number of columns the offset should cover
71
+ /// @param {Number} $columns - The total number of columns available
72
+ /// @access private
73
+ /// @group @carbon/grid
74
+ @mixin -make-col-offset($span, $columns) {
75
+ $offset: $span / $columns;
76
+ @if $offset == 0 {
77
+ margin-left: 0;
78
+ } @else {
79
+ margin-left: percentage($offset);
80
+ }
81
+ }
82
+
83
+ /// Output the CSS required for all the columns in a given grid system.
84
+ /// @param {Map} $breakpoints [$grid-breakpoints] - The breakpoints in the grid system
85
+ /// @param {Number} $gutter [$grid-gutter] - The gutter for the grid system
86
+ /// @access private
87
+ /// @group @carbon/grid
88
+ @mixin -make-grid-columns(
89
+ $breakpoints: $grid-breakpoints,
90
+ $gutter: $grid-gutter
91
+ ) {
92
+ .#{$prefix}--col {
93
+ @include -make-col-ready($gutter);
94
+ }
95
+
96
+ @each $breakpoint in map-keys($breakpoints) {
97
+ $infix: breakpoint-infix($breakpoint);
98
+ $columns: map-get(map-get($breakpoints, $breakpoint), columns);
99
+
100
+ // Allow columns to stretch full width below their breakpoints
101
+ @for $i from 0 through $columns {
102
+ .#{$prefix}--col#{$infix}-#{$i} {
103
+ @include -make-col-ready($gutter);
104
+ }
105
+ }
106
+
107
+ .#{$prefix}--col#{$infix},
108
+ .#{$prefix}--col#{$infix}--auto {
109
+ @include -make-col-ready($gutter);
110
+ }
111
+
112
+ @include breakpoint($breakpoint, $breakpoints) {
113
+ // Provide basic `.col-{bp}` classes for equal-width flexbox columns
114
+ .#{$prefix}--col,
115
+ .#{$prefix}--col#{$infix} {
116
+ flex-basis: 0;
117
+ flex-grow: 1;
118
+ max-width: 100%;
119
+ }
120
+
121
+ .#{$prefix}--col--auto,
122
+ .#{$prefix}--col#{$infix}--auto {
123
+ flex: 1 0 0%;
124
+ width: auto;
125
+ // Reset earlier grid tiers
126
+ max-width: 100%;
127
+ }
128
+
129
+ @for $i from 0 through $columns {
130
+ .#{$prefix}--col#{$infix}-#{$i} {
131
+ @include -make-col($i, $columns);
132
+ }
133
+ }
134
+
135
+ @for $i from 0 through ($columns - 1) {
136
+ @if not($infix == '') {
137
+ .#{$prefix}--offset#{$infix}-#{$i} {
138
+ @include -make-col-offset($i, $columns);
139
+ }
140
+ }
141
+ }
142
+ }
143
+ }
144
+ }
145
+
146
+ // -----------------------------------------------------------------------------
147
+ // Rows
148
+ // -----------------------------------------------------------------------------
149
+
150
+ /// Define the properties for a selector assigned to a row in the grid system.
151
+ /// @param {Number} $gutter [$grid-gutter] - The gutter in the grid system
152
+ /// @access private
153
+ /// @group @carbon/grid
154
+ @mixin make-row($gutter: $grid-gutter) {
155
+ display: flex;
156
+ flex-wrap: wrap;
157
+ margin-right: -1 * $gutter / 2;
158
+ margin-left: -1 * $gutter / 2;
159
+ }
160
+
161
+ // -----------------------------------------------------------------------------
162
+ // No gutter
163
+ // -----------------------------------------------------------------------------
164
+
165
+ /// Add `no-gutter` and `no-gutter--{start,end}` classes to the output CSS. These
166
+ /// classes are useful for dropping the gutter in fluid situations.
167
+ /// @access private
168
+ /// @group @carbon/grid
169
+ @mixin -no-gutter {
170
+ .#{$prefix}--no-gutter,
171
+ .#{$prefix}--row.#{$prefix}--no-gutter [class*='#{$prefix}--col'] {
172
+ padding-right: 0;
173
+ padding-left: 0;
174
+ }
175
+
176
+ .#{$prefix}--no-gutter--start,
177
+ .#{$prefix}--row.#{$prefix}--no-gutter--start [class*='#{$prefix}--col'] {
178
+ padding-left: 0;
179
+ }
180
+
181
+ .#{$prefix}--no-gutter--end,
182
+ .#{$prefix}--row.#{$prefix}--no-gutter--end [class*='#{$prefix}--col'] {
183
+ padding-right: 0;
184
+ }
185
+
186
+ // Deprecated ☠️
187
+ .#{$prefix}--no-gutter--left,
188
+ .#{$prefix}--row.#{$prefix}--no-gutter--left [class*='#{$prefix}--col'] {
189
+ padding-left: 0;
190
+ }
191
+
192
+ .#{$prefix}--no-gutter--right,
193
+ .#{$prefix}--row.#{$prefix}--no-gutter--right [class*='#{$prefix}--col'] {
194
+ padding-right: 0;
195
+ }
196
+ }
197
+
198
+ // -----------------------------------------------------------------------------
199
+ // Hang
200
+ // -----------------------------------------------------------------------------
201
+
202
+ /// Add `hang--start` and `hang--end` classes for a given gutter. These classes are
203
+ /// used alongside `no-gutter--start` and `no-gutter--end` to "hang" type.
204
+ /// @param {Number} $gutter [$grid-gutter] - The gutter in the grid system
205
+ /// @access private
206
+ /// @group @carbon/grid
207
+ @mixin -hang($gutter: $grid-gutter) {
208
+ .#{$prefix}--hang--start {
209
+ padding-left: ($gutter / 2);
210
+ }
211
+
212
+ .#{$prefix}--hang--end {
213
+ padding-right: ($gutter / 2);
214
+ }
215
+
216
+ // Deprecated ☠️
217
+ .#{$prefix}--hang--left {
218
+ padding-left: ($gutter / 2);
219
+ }
220
+
221
+ .#{$prefix}--hang--right {
222
+ padding-right: ($gutter / 2);
223
+ }
224
+ }
225
+
226
+ // -----------------------------------------------------------------------------
227
+ // Grid
228
+ // -----------------------------------------------------------------------------
229
+
230
+ /// Create the container for a grid. Will cause full-bleed for the grid unless
231
+ /// max-width properties are added with `-make-container-max-widths`
232
+ /// @param {Map} $breakpoints [$grid-breakpoints] - A map of breakpoints where the key is the name
233
+ /// @access private
234
+ /// @group @carbon/grid
235
+ @mixin -make-container($breakpoints: $grid-breakpoints) {
236
+ margin-right: auto;
237
+ margin-left: auto;
238
+
239
+ @include -set-largest-breakpoint();
240
+
241
+ @each $name, $value in $breakpoints {
242
+ $prev-breakpoint: map-get($breakpoints, breakpoint-prev($name));
243
+ $margin: map-get($value, margin);
244
+
245
+ @if $prev-breakpoint {
246
+ $prev-margin: map-get($prev-breakpoint, margin);
247
+ @if $prev-margin != $margin {
248
+ @include breakpoint($name) {
249
+ padding-right: #{($grid-gutter / 2) + $margin};
250
+ padding-left: #{($grid-gutter / 2) + $margin};
251
+ }
252
+ }
253
+ } @else {
254
+ @include breakpoint($name) {
255
+ padding-right: #{($grid-gutter / 2) + $margin};
256
+ padding-left: #{($grid-gutter / 2) + $margin};
257
+ }
258
+ }
259
+ }
260
+ }
261
+
262
+ /// Get the last breakpoint width and set max-width to its value
263
+ /// @param {Map} $breakpoints [$grid-breakpoints] - A map of breakpoints where the key is the name
264
+ /// @access private
265
+ /// @group @carbon/grid
266
+ @mixin -set-largest-breakpoint($breakpoints: $grid-breakpoints) {
267
+ $largest-breakpoint: last-map-item($breakpoints);
268
+
269
+ max-width: map-get($largest-breakpoint, 'width');
270
+ }
271
+
272
+ /// Add in the max-widths for each breakpoint to the container
273
+ /// @param {Map} $breakpoints [$grid-breakpoints] - A map of breakpoints where the key is the name
274
+ /// @access private
275
+ /// @group @carbon/grid
276
+ @mixin -make-container-max-widths($breakpoints: $grid-breakpoints) {
277
+ @each $name, $value in $breakpoints {
278
+ @include breakpoint($name) {
279
+ max-width: map-get($value, width);
280
+ }
281
+ }
282
+ }
283
+
284
+ /// Generate the CSS for a grid for the given breakpoints and gutters
285
+ /// @param {Map} $breakpoints [$grid-breakpoints] - The default breakpoints
286
+ /// @param {Number} $grid-gutter [$grid-gutter] - The default gutters
287
+ /// @param {Number} $condensed-gutter [$grid-gutter--condensed] - The condensed mode gutter
288
+ /// @access public
289
+ /// @group @carbon/grid
290
+ @mixin grid(
291
+ $breakpoints: $grid-breakpoints,
292
+ $grid-gutter: $grid-gutter,
293
+ $condensed-gutter: $grid-gutter--condensed
294
+ ) {
295
+ .#{$prefix}--grid {
296
+ @include -make-container($breakpoints);
297
+ }
298
+
299
+ @include largest-breakpoint($breakpoints) {
300
+ .#{$prefix}--grid--full-width {
301
+ max-width: 100%;
302
+ }
303
+ }
304
+
305
+ .#{$prefix}--row {
306
+ @include make-row();
307
+ }
308
+
309
+ .#{$prefix}--row-padding [class*='#{$prefix}--col'],
310
+ .#{$prefix}--col-padding {
311
+ padding-top: $grid-gutter / 2;
312
+ padding-bottom: $grid-gutter / 2;
313
+ }
314
+
315
+ .#{$prefix}--grid--condensed [class*='#{$prefix}--col'] {
316
+ padding-top: $condensed-gutter / 2;
317
+ padding-bottom: $condensed-gutter / 2;
318
+ }
319
+
320
+ @include -make-grid-columns($breakpoints, $grid-gutter);
321
+ @include -no-gutter();
322
+ @include -hang($grid-gutter);
323
+ }
@@ -19,7 +19,7 @@ $carbon--grid-gutter: carbon--rem(32px);
19
19
  /// @type Number
20
20
  /// @access public
21
21
  /// @group @carbon/layout
22
- $carbon--grid-gutter--condensed: carbon--rem(2px);
22
+ $carbon--grid-gutter--condensed: carbon--rem(1px);
23
23
 
24
24
  // Initial map of our breakpoints and their values
25
25
  /// @type Map
@@ -125,7 +125,7 @@ $carbon--grid-breakpoints: (
125
125
  @return '-#{$name}';
126
126
  }
127
127
 
128
- /// Generate a media query up to the width of the given breakpoint name
128
+ /// Generate a media query from the width of the given breakpoint to infinity
129
129
  /// @param {String | Number} $name
130
130
  /// @param {Map} $breakpoints [$carbon--grid-breakpoints] - A map of breakpoints where the key is the name
131
131
  /// @content
@@ -163,8 +163,13 @@ $carbon--grid-breakpoints: (
163
163
  @content;
164
164
  }
165
165
  } @else if map-has-key($breakpoints, $name) {
166
+ // We borrow this logic from bootstrap for specifying the value of the
167
+ // max-width. The maximum width is calculated by finding the breakpoint and
168
+ // subtracting .02 from its value. This value is used instead of .01 to
169
+ // avoid rounding issues in Safari
170
+ // https://github.com/twbs/bootstrap/blob/c5b1919deaf5393fcca9e9b9d7ce9c338160d99d/scss/mixins/_breakpoints.scss#L34-L46
166
171
  $breakpoint: map-get($breakpoints, $name);
167
- $width: map-get($breakpoint, width);
172
+ $width: map-get($breakpoint, width) - 0.02;
168
173
  @media (max-width: $width) {
169
174
  @content;
170
175
  }
@@ -0,0 +1,232 @@
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
+ // https://github.com/twbs/bootstrap/blob/v4-dev/scss/mixins/_breakpoints.scss
9
+ @use 'sass:list';
10
+ @use 'sass:map';
11
+ @use 'sass:meta';
12
+ @use 'convert';
13
+ @use 'utilities';
14
+
15
+ /// Carbon gutter size in rem
16
+ /// @type Number
17
+ /// @access public
18
+ /// @group @carbon/layout
19
+ $grid-gutter: convert.rem(32px);
20
+
21
+ /// Carbon condensed gutter size in rem
22
+ /// @type Number
23
+ /// @access public
24
+ /// @group @carbon/layout
25
+ $grid-gutter--condensed: convert.rem(1px);
26
+
27
+ // Initial map of our breakpoints and their values
28
+ /// @type Map
29
+ /// @access public
30
+ /// @group @carbon/layout
31
+ $grid-breakpoints: (
32
+ sm: (
33
+ columns: 4,
34
+ margin: 0,
35
+ width: convert.rem(320px),
36
+ ),
37
+ md: (
38
+ columns: 8,
39
+ margin: convert.rem(16px),
40
+ width: convert.rem(672px),
41
+ ),
42
+ lg: (
43
+ columns: 16,
44
+ margin: convert.rem(16px),
45
+ width: convert.rem(1056px),
46
+ ),
47
+ xlg: (
48
+ columns: 16,
49
+ margin: convert.rem(16px),
50
+ width: convert.rem(1312px),
51
+ ),
52
+ max: (
53
+ columns: 16,
54
+ margin: convert.rem(24px),
55
+ width: convert.rem(1584px),
56
+ ),
57
+ ) !default;
58
+
59
+ /// Get the value of the next breakpoint, or null for the last breakpoint
60
+ /// @param {String} $name - The name of the brekapoint
61
+ /// @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
62
+ /// @param {List} $breakpoint-names [map-keys($breakpoints)] - A list of names from the `$breakpoints` map
63
+ /// @return {String}
64
+ /// @access public
65
+ /// @group @carbon/layout
66
+ @function breakpoint-next(
67
+ $name,
68
+ $breakpoints: $grid-breakpoints,
69
+ $breakpoint-names: map.keys($breakpoints)
70
+ ) {
71
+ $n: list.index($breakpoint-names, $name);
72
+ @if $n != null and $n < list.length($breakpoint-names) {
73
+ @return list.nth($breakpoint-names, $n + 1);
74
+ }
75
+ @return null;
76
+ }
77
+
78
+ /// Get the value of the previous breakpoint, or null for the first breakpoint
79
+ /// @param {String} $name - The name of the brekapoint
80
+ /// @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
81
+ /// @param {List} $breakpoint-names [map-keys($breakpoints)] - A list of names from the `$breakpoints` map
82
+ /// @return {String}
83
+ /// @access public
84
+ /// @group @carbon/layout
85
+ @function breakpoint-prev(
86
+ $name,
87
+ $breakpoints: $grid-breakpoints,
88
+ $breakpoint-names: map.keys($breakpoints)
89
+ ) {
90
+ $n: list.index($breakpoint-names, $name);
91
+ @if $n != null and $n > 1 {
92
+ @return list.nth($breakpoint-names, $n - 1);
93
+ }
94
+ @return null;
95
+ }
96
+
97
+ /// Check to see if the given breakpoint name
98
+ /// @param {String} $name - The name of the brekapoint
99
+ /// @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
100
+ /// @return {Bool}
101
+ /// @access public
102
+ /// @group @carbon/layout
103
+ @function is-smallest-breakpoint($name, $breakpoints: $grid-breakpoints) {
104
+ @return list.index(map.keys($breakpoints), $name) == 1;
105
+ }
106
+
107
+ /// Returns the largest breakpoint name
108
+ /// @param {Map} $breakpoints [$grid-breakpoints] - A map of breakpoints where the key is the name
109
+ /// @return {String}
110
+ /// @access public
111
+ /// @group @carbon/layout
112
+ @function largest-breakpoint-name($breakpoints: $grid-breakpoints) {
113
+ $total-breakpoints: list.length($breakpoints);
114
+ @return key-by-index($breakpoints, $total-breakpoints);
115
+ }
116
+
117
+ /// Get the infix for a given breakpoint in a list of breakpoints. Usesful for generate the size part in a selector, for example: `.prefix--col-sm-2`.
118
+ /// @param {String} $name - The name of the breakpoint
119
+ /// @return {String}
120
+ /// @access public
121
+ /// @group @carbon/layout
122
+ @function breakpoint-infix($name) {
123
+ @return '-#{$name}';
124
+ }
125
+
126
+ /// Generate a media query from the width of the given breakpoint to infinity
127
+ /// @param {String | Number} $name
128
+ /// @param {Map} $breakpoints [$grid-breakpoints] - A map of breakpoints where the key is the name
129
+ /// @content
130
+ /// @access public
131
+ /// @group @carbon/layout
132
+ @mixin breakpoint-up($name, $breakpoints: $grid-breakpoints) {
133
+ @if meta.type-of($name) == 'number' {
134
+ @media (min-width: $name) {
135
+ @content;
136
+ }
137
+ } @else if map.has-key($breakpoints, $name) {
138
+ $breakpoint: map.get($breakpoints, $name);
139
+ $width: map.get($breakpoint, width);
140
+ @if is-smallest-breakpoint($name, $breakpoints) {
141
+ @content;
142
+ } @else {
143
+ @media (min-width: $width) {
144
+ @content;
145
+ }
146
+ }
147
+ } @else {
148
+ @error 'Unable to find a breakpoint with name `#{$name}`. Expected one of: (#{map.keys($breakpoints)})';
149
+ }
150
+ }
151
+
152
+ /// Generate a media query for the maximum width of the given styles
153
+ /// @param {String | Number} $name
154
+ /// @param {Map} $breakpoints [$grid-breakpoints] - A map of breakpoints where the key is the name
155
+ /// @content
156
+ /// @access public
157
+ /// @group @carbon/layout
158
+ @mixin breakpoint-down($name, $breakpoints: $grid-breakpoints) {
159
+ @if meta.type-of($name) == 'number' {
160
+ @media (max-width: $name) {
161
+ @content;
162
+ }
163
+ } @else if map.has-key($breakpoints, $name) {
164
+ // We borrow this logic from bootstrap for specifying the value of the
165
+ // max-width. The maximum width is calculated by finding the breakpoint and
166
+ // subtracting .02 from its value. This value is used instead of .01 to
167
+ // avoid rounding issues in Safari
168
+ // https://github.com/twbs/bootstrap/blob/c5b1919deaf5393fcca9e9b9d7ce9c338160d99d/scss/mixins/_breakpoints.scss#L34-L46
169
+ $breakpoint: map.get($breakpoints, $name);
170
+ $width: map.get($breakpoint, width) - 0.02;
171
+ @media (max-width: $width) {
172
+ @content;
173
+ }
174
+ } @else {
175
+ @error 'Unable to find a breakpoint with name `#{$name}`. Expected one of: (#{map.keys($breakpoints)})';
176
+ }
177
+ }
178
+
179
+ /// Generate a media query for the range between the lower and upper breakpoints
180
+ /// @param {String | Number} $lower
181
+ /// @param {String | Number} $upper
182
+ /// @param {Map} $breakpoints [$grid-breakpoints] - A map of breakpoints where the key is the name
183
+ /// @content
184
+ /// @access public
185
+ /// @group @carbon/layout
186
+ @mixin breakpoint-between($lower, $upper, $breakpoints: $grid-breakpoints) {
187
+ $is-number-lower: meta.type-of($lower) == 'number';
188
+ $is-number-upper: meta.type-of($upper) == 'number';
189
+ $min: if($is-number-lower, $lower, map.get($breakpoints, $lower));
190
+ $max: if($is-number-upper, $upper, map.get($breakpoints, $upper));
191
+
192
+ @if $min and $max {
193
+ $min-width: if(not $is-number-lower and $min, map.get($min, width), $min);
194
+ $max-width: if(not $is-number-upper and $max, map.get($max, width), $max);
195
+ @media (min-width: $min-width) and (max-width: $max-width) {
196
+ @content;
197
+ }
198
+ } @else if $min != null and $max == null {
199
+ @include breakpoint-up($lower) {
200
+ @content;
201
+ }
202
+ } @else if $min == null and $max != null {
203
+ @include breakpoint-down($upper) {
204
+ @content;
205
+ }
206
+ } @else {
207
+ @error 'Unable to find a breakpoint to satisfy: (#{$lower},#{$upper}). Expected both to be one of (#{map.keys($breakpoints)}).';
208
+ }
209
+ }
210
+
211
+ /// Generate media query for the largest breakpoint
212
+ /// @param {Map} $breakpoints [$grid-breakpoints] - A map of breakpoints where the key is the name
213
+ /// @content
214
+ /// @access public
215
+ /// @group @carbon/layout
216
+ @mixin largest-breakpoint($breakpoints: $grid-breakpoints) {
217
+ @include breakpoint(largest-breakpoint-name()) {
218
+ @content;
219
+ }
220
+ }
221
+
222
+ /// Generate a media query for a given breakpoint
223
+ /// @param {String | Number} $name
224
+ /// @param {Map} $breakpoints [$grid-breakpoints] - A map of breakpoints where the key is the name
225
+ /// @content
226
+ /// @access public
227
+ /// @group @carbon/layout
228
+ @mixin breakpoint($name, $breakpoints: $grid-breakpoints) {
229
+ @include breakpoint-up($name, $breakpoints) {
230
+ @content;
231
+ }
232
+ }
@@ -0,0 +1,40 @@
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
+ /// Default font size
9
+ /// @type Number
10
+ /// @access public
11
+ /// @group @carbon/layout
12
+ $base-font-size: 16px !default;
13
+
14
+ /// Convert a given px unit to a rem unit
15
+ /// @param {Number} $px - Number with px unit
16
+ /// @return {Number} Number with rem unit
17
+ /// @access public
18
+ /// @group @carbon/layout
19
+ @function rem($px) {
20
+ @if unit($px) != 'px' {
21
+ // TODO: update to @error in v11
22
+ @warn "Expected argument $px to be of type `px`, instead received: `#{unit($px)}`";
23
+ }
24
+
25
+ @return ($px / $base-font-size) * 1rem;
26
+ }
27
+
28
+ /// Convert a given px unit to a em unit
29
+ /// @param {Number} $px - Number with px unit
30
+ /// @return {Number} Number with em unit
31
+ /// @access public
32
+ /// @group @carbon/layout
33
+ @function em($px) {
34
+ @if unit($px) != 'px' {
35
+ // TODO: update to @error in v11
36
+ @warn "Expected argument $px to be of type `px`, instead received: `#{unit($px)}`";
37
+ }
38
+
39
+ @return ($px / $base-font-size) * 1em;
40
+ }
@@ -0,0 +1,9 @@
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
+ @forward './generated/fluid-spacing';
9
+ @forward './generated/spacing';
@@ -0,0 +1,41 @@
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
+ /// Map deep get
9
+ /// @author Hugo Giraudel
10
+ /// @access public
11
+ /// @param {Map} $map - Map
12
+ /// @param {Arglist} $keys - Key chain
13
+ /// @return {*} Desired value
14
+ /// @group @carbon/layout
15
+ @function map-deep-get($map, $keys...) {
16
+ @each $key in $keys {
17
+ $map: map-get($map, $key);
18
+ }
19
+ @return $map;
20
+ }
21
+
22
+ /// Provide a map and index, and get back the relevant key value
23
+ /// @access public
24
+ /// @param {Map} $map - Map
25
+ /// @param {Integer} $index - Key chain
26
+ /// @return {String} Desired value
27
+ /// @group @carbon/layout
28
+ @function key-by-index($map, $index) {
29
+ $keys: map-keys($map);
30
+ @return nth($keys, $index);
31
+ }
32
+
33
+ /// Pass in a map, and get the last one in the list back
34
+ /// @access public
35
+ /// @param {Map} $map - Map
36
+ /// @return {*} Desired value
37
+ /// @group @carbon/layout
38
+ @function last-map-item($map) {
39
+ $total-length: length($map);
40
+ @return map-get($map, carbon--key-by-index($map, $total-length));
41
+ }