@khanacademy/wonder-blocks-grid 1.0.27 → 1.0.28

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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,6 @@
1
+ # @khanacademy/wonder-blocks-grid
2
+
3
+ ## 1.0.28
4
+ ### Patch Changes
5
+
6
+ - @khanacademy/wonder-blocks-core@4.2.1
package/dist/es/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Component, createElement, Children } from 'react';
1
+ import * as React from 'react';
2
2
  import { MediaLayout, queryMatchesSize, Strut } from '@khanacademy/wonder-blocks-layout';
3
3
  import { View } from '@khanacademy/wonder-blocks-core';
4
4
  import { StyleSheet } from 'aphrodite';
@@ -48,7 +48,7 @@ const flexBasis = size => {
48
48
  * `cols` props then the component will only be shown at those grid sizes and
49
49
  * using the specified column width.
50
50
  */
51
- class Cell extends Component {
51
+ class Cell extends React.Component {
52
52
  static isClassOf(instance) {
53
53
  return instance && instance.type && instance.type.__IS_CELL__;
54
54
  }
@@ -89,7 +89,7 @@ class Cell extends Component {
89
89
  children,
90
90
  style
91
91
  } = this.props;
92
- return /*#__PURE__*/createElement(MediaLayout, null, ({
92
+ return /*#__PURE__*/React.createElement(MediaLayout, null, ({
93
93
  mediaSize,
94
94
  mediaSpec
95
95
  }) => {
@@ -137,7 +137,7 @@ class Cell extends Component {
137
137
  }) : children; // Render a fixed-width cell (flex-basis: size, flex-shrink: 0)
138
138
  // that matches the intended width of the cell
139
139
 
140
- return /*#__PURE__*/createElement(View, {
140
+ return /*#__PURE__*/React.createElement(View, {
141
141
  style: [styles.cellFixed, flexBasis(calcWidth), style]
142
142
  }, contents);
143
143
  });
@@ -165,9 +165,9 @@ Cell.__IS_CELL__ = true;
165
165
  * grid sizes. If you specify the `small`, `medium`, or `large`
166
166
  * props then the component will only be shown at those grid sizes.
167
167
  */
168
- class Gutter extends Component {
168
+ class Gutter extends React.Component {
169
169
  render() {
170
- return /*#__PURE__*/createElement(MediaLayout, null, ({
170
+ return /*#__PURE__*/React.createElement(MediaLayout, null, ({
171
171
  mediaSize,
172
172
  mediaSpec
173
173
  }) => {
@@ -185,7 +185,7 @@ class Gutter extends Component {
185
185
  return null;
186
186
  }
187
187
 
188
- return /*#__PURE__*/createElement(Strut, {
188
+ return /*#__PURE__*/React.createElement(Strut, {
189
189
  size: gutterWidth
190
190
  });
191
191
  });
@@ -214,13 +214,13 @@ Gutter.defaultProps = {
214
214
  * grid sizes. If you specify the `small`, `medium`, or `large`
215
215
  * props then the component will only be shown at those grid sizes.
216
216
  */
217
- class Row extends Component {
217
+ class Row extends React.Component {
218
218
  render() {
219
219
  const {
220
220
  style,
221
221
  children
222
222
  } = this.props;
223
- return /*#__PURE__*/createElement(MediaLayout, null, ({
223
+ return /*#__PURE__*/React.createElement(MediaLayout, null, ({
224
224
  mediaSize,
225
225
  mediaSpec
226
226
  }) => {
@@ -247,24 +247,24 @@ class Row extends Component {
247
247
  mediaSize,
248
248
  totalColumns
249
249
  }) : children;
250
- const filteredContents = Children.toArray(contents) // Go through all of the contents and pre-emptively remove anything
250
+ const filteredContents = React.Children.toArray(contents) // Go through all of the contents and pre-emptively remove anything
251
251
  // that shouldn't be rendered.
252
252
  .filter( // Flow doesn't let us check .type on a non-null React.Node so
253
253
  // we have to cast it to any.
254
254
  item => Cell.isClassOf(item) ? Cell.shouldDisplay(item.props, mediaSize) : true) // Intersperse Gutter elements between the cells.
255
- .reduce((acc, elem, index) => [].concat(acc, [elem, /*#__PURE__*/createElement(Gutter, {
255
+ .reduce((acc, elem, index) => [].concat(acc, [elem, /*#__PURE__*/React.createElement(Gutter, {
256
256
  key: `gutter-${index}`
257
257
  })]), []) // We only want gutters between each cell in the row. The reduce
258
258
  // adds a gutter after every cell so we need to remove the last
259
259
  // element which is an unnecessary gutteer.
260
260
  .slice(0, -1);
261
- return /*#__PURE__*/createElement(View, {
261
+ return /*#__PURE__*/React.createElement(View, {
262
262
  style: [styles.row, !!maxWidth && styles.rowMaxWidth, !!maxWidth && {
263
263
  maxWidth
264
264
  }, style]
265
- }, /*#__PURE__*/createElement(Strut, {
265
+ }, /*#__PURE__*/React.createElement(Strut, {
266
266
  size: marginWidth
267
- }), filteredContents, /*#__PURE__*/createElement(Strut, {
267
+ }), filteredContents, /*#__PURE__*/React.createElement(Strut, {
268
268
  size: marginWidth
269
269
  }));
270
270
  });