@elliemae/ds-grid 1.60.0 → 2.0.0-alpha.12
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/cjs/Grid.js +37 -34
- package/cjs/GridItem.js +11 -10
- package/cjs/defaultProps.js +1 -2
- package/cjs/index.js +4 -21
- package/cjs/propTypes.js +7 -8
- package/cjs/types.js +0 -1
- package/cjs/utils/constants.js +3 -4
- package/cjs/utils/styles.js +42 -42
- package/esm/Grid.js +33 -29
- package/esm/GridItem.js +9 -8
- package/esm/defaultProps.js +1 -2
- package/esm/index.js +0 -17
- package/esm/propTypes.js +3 -4
- package/esm/types.js +0 -1
- package/esm/utils/constants.js +3 -4
- package/esm/utils/styles.js +40 -39
- package/package.json +62 -13
- package/types/Grid.d.ts +11 -0
- package/types/GridItem.d.ts +2 -0
- package/types/defaultProps.d.ts +9 -0
- package/types/index.d.ts +5 -0
- package/types/propTypes.d.ts +135 -0
- package/types/tests/DSGrid.events.test.d.ts +1 -0
- package/types/types.d.ts +66 -0
- package/types/utils/constants.d.ts +3 -0
- package/types/utils/styles.d.ts +3 -0
- package/Grid/package.json +0 -10
- package/GridItem/package.json +0 -10
- package/cjs/Grid.js.map +0 -1
- package/cjs/GridItem.js.map +0 -1
- package/cjs/defaultProps.js.map +0 -1
- package/cjs/index.js.map +0 -1
- package/cjs/propTypes.js.map +0 -1
- package/cjs/types.js.map +0 -1
- package/cjs/utils/constants.js.map +0 -1
- package/cjs/utils/styles.js.map +0 -1
- package/defaultProps/package.json +0 -10
- package/esm/Grid.js.map +0 -1
- package/esm/GridItem.js.map +0 -1
- package/esm/defaultProps.js.map +0 -1
- package/esm/index.js.map +0 -1
- package/esm/propTypes.js.map +0 -1
- package/esm/types.js.map +0 -1
- package/esm/utils/constants.js.map +0 -1
- package/esm/utils/styles.js.map +0 -1
- package/propTypes/package.json +0 -10
- package/types/package.json +0 -10
- package/utils/constants/package.json +0 -10
- package/utils/styles/package.json +0 -10
package/cjs/Grid.js
CHANGED
|
@@ -2,9 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var _extends = require('@babel/runtime/helpers/extends');
|
|
6
5
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
7
6
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
7
|
+
require('core-js/modules/esnext.async-iterator.map.js');
|
|
8
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
9
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
10
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
11
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
12
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
13
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
8
14
|
var React = require('react');
|
|
9
15
|
var reactDesc = require('react-desc');
|
|
10
16
|
var lodash = require('lodash');
|
|
@@ -12,45 +18,42 @@ var dsSystem = require('@elliemae/ds-system');
|
|
|
12
18
|
var propTypes = require('./propTypes.js');
|
|
13
19
|
var GridItem = require('./GridItem.js');
|
|
14
20
|
var defaultProps = require('./defaultProps.js');
|
|
15
|
-
require('
|
|
16
|
-
require('styled-components');
|
|
17
|
-
require('styled-system');
|
|
18
|
-
require('./utils/styles.js');
|
|
19
|
-
require('@babel/runtime/helpers/typeof');
|
|
20
|
-
require('@babel/runtime/helpers/taggedTemplateLiteral');
|
|
21
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
21
22
|
|
|
22
23
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
23
24
|
|
|
24
|
-
var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
|
|
25
25
|
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
26
26
|
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
27
27
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
const _excluded = ["rows", "cols", "alignItems", "children", "className", "justify", "gutter", "wrap"];
|
|
30
30
|
|
|
31
31
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
32
32
|
|
|
33
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default[
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
33
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
34
|
+
const Grid = /*#__PURE__*/React__default["default"].forwardRef((props, ref) => {
|
|
35
|
+
const {
|
|
36
|
+
rows,
|
|
37
|
+
cols,
|
|
38
|
+
alignItems,
|
|
39
|
+
children,
|
|
40
|
+
className,
|
|
41
|
+
justify,
|
|
42
|
+
gutter,
|
|
43
|
+
wrap
|
|
44
|
+
} = props,
|
|
45
|
+
rest = _objectWithoutProperties__default["default"](props, _excluded);
|
|
44
46
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
let isSpanParent = true;
|
|
48
|
+
const renderChildren = React__default["default"].Children.map(children, child => {
|
|
47
49
|
if (lodash.get(child, 'child.type.name') === 'Grid' || lodash.get(child, 'type.displayName') === 'Grid' || parseInt(lodash.get(child, 'props.span', 0), 10) > 0) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
const {
|
|
51
|
+
width: wc,
|
|
52
|
+
height: hc,
|
|
53
|
+
span
|
|
54
|
+
} = child.props;
|
|
52
55
|
if (!span) isSpanParent = false;
|
|
53
|
-
return /*#__PURE__*/React__default[
|
|
56
|
+
return /*#__PURE__*/React__default["default"].cloneElement(child, _objectSpread(_objectSpread({}, child.props), {}, {
|
|
54
57
|
width: dsSystem.fixSpaceGutter(wc),
|
|
55
58
|
height: dsSystem.fixSpaceGutter(hc)
|
|
56
59
|
}));
|
|
@@ -58,7 +61,7 @@ var Grid = /*#__PURE__*/React__default['default'].forwardRef(function (props, re
|
|
|
58
61
|
|
|
59
62
|
return child;
|
|
60
63
|
});
|
|
61
|
-
return /*#__PURE__*/
|
|
64
|
+
return /*#__PURE__*/jsxRuntime.jsx(GridItem.GridItem, _objectSpread(_objectSpread({
|
|
62
65
|
alignItems: alignItems,
|
|
63
66
|
className: className,
|
|
64
67
|
cols: cols,
|
|
@@ -67,18 +70,18 @@ var Grid = /*#__PURE__*/React__default['default'].forwardRef(function (props, re
|
|
|
67
70
|
justify: justify,
|
|
68
71
|
rows: rows,
|
|
69
72
|
wrap: wrap,
|
|
70
|
-
childNumber: React__default[
|
|
73
|
+
childNumber: React__default["default"].Children.count(children),
|
|
71
74
|
ref: ref
|
|
72
|
-
}, rest),
|
|
75
|
+
}, rest), {}, {
|
|
76
|
+
children: renderChildren
|
|
77
|
+
}));
|
|
73
78
|
}); // Since this component is using ForwardRef, we must provide a displayName to avoid 'undefined' name in propsTable.
|
|
74
79
|
|
|
75
80
|
Grid.displayName = 'Grid'; // We should use props helpers to merge default props in the future, right now it causes many issues within Dimsum
|
|
76
81
|
|
|
77
82
|
Grid.defaultProps = defaultProps.defaultProps;
|
|
78
|
-
|
|
79
|
-
var DSGridWithSchema = reactDesc.describe(Grid);
|
|
83
|
+
const DSGridWithSchema = reactDesc.describe(Grid);
|
|
80
84
|
DSGridWithSchema.propTypes = propTypes.propTypes;
|
|
81
85
|
|
|
82
86
|
exports.DSGridWithSchema = DSGridWithSchema;
|
|
83
|
-
exports[
|
|
84
|
-
//# sourceMappingURL=Grid.js.map
|
|
87
|
+
exports["default"] = Grid;
|
package/cjs/GridItem.js
CHANGED
|
@@ -5,24 +5,25 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var styled = require('styled-components');
|
|
6
6
|
var styledSystem = require('styled-system');
|
|
7
7
|
var dsSystem = require('@elliemae/ds-system');
|
|
8
|
-
var
|
|
9
|
-
require('@babel/runtime/helpers/typeof');
|
|
10
|
-
require('@babel/runtime/helpers/taggedTemplateLiteral');
|
|
8
|
+
var styles = require('./utils/styles.js');
|
|
11
9
|
|
|
12
10
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
11
|
|
|
14
12
|
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
15
13
|
|
|
16
14
|
/* eslint-disable max-lines */
|
|
17
|
-
|
|
15
|
+
const GridItem = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
18
16
|
componentId: "sc-1ch24x4-0"
|
|
19
|
-
})(["display:grid;display:-ms-grid;column-gap:", ";row-gap:", ";", " ", " ", " ", " ", " ", " ", " ", " ", ""],
|
|
20
|
-
|
|
17
|
+
})(["display:grid;display:-ms-grid;column-gap:", ";row-gap:", ";", " ", " ", " ", " ", " ", " ", " ", " ", ""], _ref => {
|
|
18
|
+
let {
|
|
19
|
+
gutter
|
|
20
|
+
} = _ref;
|
|
21
21
|
return dsSystem.mapGap(gutter);
|
|
22
|
-
},
|
|
23
|
-
|
|
22
|
+
}, _ref2 => {
|
|
23
|
+
let {
|
|
24
|
+
gutter
|
|
25
|
+
} = _ref2;
|
|
24
26
|
return dsSystem.mapGap(gutter);
|
|
25
|
-
}, styledSystem.grid, styledSystem.flexbox, styledSystem.justifyContent, styledSystem.space, styledSystem.height, styledSystem.width,
|
|
27
|
+
}, styledSystem.grid, styledSystem.flexbox, styledSystem.justifyContent, styledSystem.space, styledSystem.height, styledSystem.width, styles.manageCols, styles.manageRows, styles.manageSpan);
|
|
26
28
|
|
|
27
29
|
exports.GridItem = GridItem;
|
|
28
|
-
//# sourceMappingURL=GridItem.js.map
|
package/cjs/defaultProps.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
const defaultProps = {
|
|
6
6
|
rows: [],
|
|
7
7
|
cols: [],
|
|
8
8
|
className: '',
|
|
@@ -13,4 +13,3 @@ var defaultProps = {
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
exports.defaultProps = defaultProps;
|
|
16
|
-
//# sourceMappingURL=defaultProps.js.map
|
package/cjs/index.js
CHANGED
|
@@ -3,28 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var Grid = require('./Grid.js');
|
|
6
|
-
require('@babel/runtime/helpers/extends');
|
|
7
|
-
require('@babel/runtime/helpers/defineProperty');
|
|
8
|
-
require('@babel/runtime/helpers/objectWithoutProperties');
|
|
9
|
-
require('react');
|
|
10
|
-
require('react-desc');
|
|
11
|
-
require('lodash');
|
|
12
|
-
require('@elliemae/ds-system');
|
|
13
|
-
require('./propTypes.js');
|
|
14
|
-
require('./utils/constants.js');
|
|
15
|
-
require('./GridItem.js');
|
|
16
|
-
require('styled-components');
|
|
17
|
-
require('styled-system');
|
|
18
|
-
require('./utils/styles.js');
|
|
19
|
-
require('@babel/runtime/helpers/typeof');
|
|
20
|
-
require('@babel/runtime/helpers/taggedTemplateLiteral');
|
|
21
|
-
require('./defaultProps.js');
|
|
22
6
|
|
|
23
7
|
|
|
24
8
|
|
|
25
9
|
exports.DSGridWithSchema = Grid.DSGridWithSchema;
|
|
26
|
-
exports.Grid = Grid[
|
|
27
|
-
exports.GridContainer = Grid[
|
|
28
|
-
exports.GridItem = Grid[
|
|
29
|
-
exports
|
|
30
|
-
//# sourceMappingURL=index.js.map
|
|
10
|
+
exports.Grid = Grid["default"];
|
|
11
|
+
exports.GridContainer = Grid["default"];
|
|
12
|
+
exports.GridItem = Grid["default"];
|
|
13
|
+
exports["default"] = Grid["default"];
|
package/cjs/propTypes.js
CHANGED
|
@@ -3,28 +3,28 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var reactDesc = require('react-desc');
|
|
6
|
-
var
|
|
6
|
+
var constants = require('./utils/constants.js');
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
const rowColBreakpoints = reactDesc.PropTypes.shape({
|
|
9
9
|
small: reactDesc.PropTypes.arrayOf(reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.number, reactDesc.PropTypes.string])),
|
|
10
10
|
medium: reactDesc.PropTypes.arrayOf(reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.number, reactDesc.PropTypes.string])),
|
|
11
11
|
large: reactDesc.PropTypes.arrayOf(reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.number, reactDesc.PropTypes.string]))
|
|
12
12
|
});
|
|
13
|
-
|
|
13
|
+
const spanBreakpoints = reactDesc.PropTypes.shape({
|
|
14
14
|
small: reactDesc.PropTypes.number,
|
|
15
15
|
medium: reactDesc.PropTypes.number,
|
|
16
16
|
large: reactDesc.PropTypes.number
|
|
17
17
|
});
|
|
18
|
-
|
|
18
|
+
const propTypes = {
|
|
19
19
|
rows: reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.arrayOf(reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.number, reactDesc.PropTypes.string])), rowColBreakpoints]).description('Row layout cells').defaultValue([]),
|
|
20
20
|
cols: reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.arrayOf(reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.number, reactDesc.PropTypes.string])), rowColBreakpoints]).description('Column layout cells').defaultValue([]),
|
|
21
21
|
span: reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.number, spanBreakpoints]).description('Expands the grid element within columns.'),
|
|
22
|
-
alignItems: reactDesc.PropTypes.oneOf(
|
|
22
|
+
alignItems: reactDesc.PropTypes.oneOf(constants.alignItemsPlacement).description('flex-like align items prop'),
|
|
23
23
|
children: reactDesc.PropTypes.node.description('Children node inside grid cell'),
|
|
24
24
|
className: reactDesc.PropTypes.string.description('CSS class').defaultValue(''),
|
|
25
|
-
justifyContent: reactDesc.PropTypes.oneOf(
|
|
25
|
+
justifyContent: reactDesc.PropTypes.oneOf(constants.justifyPlacement).description('flex-like justify prop').defaultValue(constants.justifyPlacement[0]),
|
|
26
26
|
gutter: reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.number, reactDesc.PropTypes.string]).description('Space between cells prop').defaultValue(0),
|
|
27
|
-
wrap: reactDesc.PropTypes.oneOf(
|
|
27
|
+
wrap: reactDesc.PropTypes.oneOf(constants.wrap).description('Wrap type').defaultValue(constants.wrap[0]),
|
|
28
28
|
height: reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.number, reactDesc.PropTypes.string]).description('Grid height.'),
|
|
29
29
|
width: reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.number, reactDesc.PropTypes.string]).description('Grid width.'),
|
|
30
30
|
p: reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.number, reactDesc.PropTypes.string]).description('Grid padding in all sides.'),
|
|
@@ -44,4 +44,3 @@ var propTypes = {
|
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
exports.propTypes = propTypes;
|
|
47
|
-
//# sourceMappingURL=propTypes.js.map
|
package/cjs/types.js
CHANGED
package/cjs/utils/constants.js
CHANGED
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
const justifyPlacement = ['flex-start', 'center', 'flex-end', 'space-between', 'space-around', 'space-evenly'];
|
|
6
|
+
const alignItemsPlacement = ['flex-start', 'center', 'flex-end', 'stretch', 'baseline'];
|
|
7
|
+
const wrap = ['wrap', 'nowrap', 'wrap-reverse'];
|
|
8
8
|
|
|
9
9
|
exports.alignItemsPlacement = alignItemsPlacement;
|
|
10
10
|
exports.justifyPlacement = justifyPlacement;
|
|
11
11
|
exports.wrap = wrap;
|
|
12
|
-
//# sourceMappingURL=constants.js.map
|
package/cjs/utils/styles.js
CHANGED
|
@@ -2,25 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var _typeof = require('@babel/runtime/helpers/typeof');
|
|
6
5
|
var _taggedTemplateLiteral = require('@babel/runtime/helpers/taggedTemplateLiteral');
|
|
6
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
8
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
9
|
+
require('core-js/modules/esnext.async-iterator.map.js');
|
|
10
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
7
11
|
var dsSystem = require('@elliemae/ds-system');
|
|
8
12
|
|
|
9
13
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
14
|
|
|
11
|
-
var _typeof__default = /*#__PURE__*/_interopDefaultLegacy(_typeof);
|
|
12
15
|
var _taggedTemplateLiteral__default = /*#__PURE__*/_interopDefaultLegacy(_taggedTemplateLiteral);
|
|
13
16
|
|
|
14
17
|
var _templateObject, _templateObject2, _templateObject3;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
const manageSpan = dsSystem.css(_templateObject || (_templateObject = _taggedTemplateLiteral__default["default"](["\n ", "\n"])), _ref => {
|
|
19
|
+
let {
|
|
20
|
+
isSpanParent,
|
|
21
|
+
span,
|
|
22
|
+
theme
|
|
23
|
+
} = _ref;
|
|
19
24
|
if (!isSpanParent) return '';
|
|
20
25
|
|
|
21
|
-
if (
|
|
22
|
-
|
|
23
|
-
Object.keys(theme.media).forEach(
|
|
26
|
+
if (typeof span === 'object') {
|
|
27
|
+
let data = '';
|
|
28
|
+
Object.keys(theme.media).forEach(key => {
|
|
24
29
|
if (span[key] && theme.breakpoints[key]) {
|
|
25
30
|
if (key === 'small') {
|
|
26
31
|
data += "\n -ms-grid-column: auto / span ".concat(span[key], ";\n grid-column: auto / span ").concat(span[key], ";\n ");
|
|
@@ -34,19 +39,19 @@ var manageSpan = dsSystem.css(_templateObject || (_templateObject = _taggedTempl
|
|
|
34
39
|
|
|
35
40
|
return "\n -ms-grid-column: auto / span ".concat(span, ";\n grid-column: auto / span ").concat(span, ";");
|
|
36
41
|
});
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
const manageCols = dsSystem.css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral__default["default"](["\n ", "\n"])), _ref2 => {
|
|
43
|
+
let {
|
|
44
|
+
cols,
|
|
45
|
+
theme,
|
|
46
|
+
isSpanParent
|
|
47
|
+
} = _ref2;
|
|
48
|
+
|
|
49
|
+
if (typeof cols === 'object' && !Array.isArray(cols)) {
|
|
50
|
+
let data = '';
|
|
51
|
+
Object.keys(theme.media).forEach(key => {
|
|
45
52
|
if (cols[key] && Array.isArray(cols[key])) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
return "minmax(0, ".concat(c, ")");
|
|
49
|
-
}).join(' ');
|
|
53
|
+
const mtg = dsSystem.mapTemplateGrid(cols[key]).join(' ');
|
|
54
|
+
const mtgs = dsSystem.mapTemplateGrid(cols[key]).map(c => "minmax(0, ".concat(c, ")")).join(' ');
|
|
50
55
|
|
|
51
56
|
if (key === 'small') {
|
|
52
57
|
data += "-ms-grid-columns: ".concat(mtg || 'minmax(0px, 1fr)', ";\n grid-template-columns: ").concat(mtg || 'auto', ";\n -ms-grid-columns: ").concat(mtgs || 'minmax(0px, 1fr)', ";\n grid-template-columns: ").concat(mtgs || 'auto', ";");
|
|
@@ -65,10 +70,8 @@ var manageCols = dsSystem.css(_templateObject2 || (_templateObject2 = _taggedTem
|
|
|
65
70
|
}
|
|
66
71
|
|
|
67
72
|
if (Array.isArray(cols)) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
return "minmax(0, ".concat(c, ")");
|
|
71
|
-
}).join(' ');
|
|
73
|
+
const mtg = dsSystem.mapTemplateGrid(cols).join(' ');
|
|
74
|
+
const mtgs = dsSystem.mapTemplateGrid(cols).map(c => "minmax(0, ".concat(c, ")")).join(' ');
|
|
72
75
|
return "\n -ms-grid-columns: ".concat(mtg || 'minmax(0px, 1fr)', ";\n grid-template-columns: ").concat(mtg || 'auto', ";\n -ms-grid-columns: ").concat(mtgs || 'minmax(0px, 1fr)', ";\n grid-template-columns: ").concat(mtgs || 'auto', ";\n ");
|
|
73
76
|
}
|
|
74
77
|
|
|
@@ -78,19 +81,19 @@ var manageCols = dsSystem.css(_templateObject2 || (_templateObject2 = _taggedTem
|
|
|
78
81
|
|
|
79
82
|
return '';
|
|
80
83
|
});
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
84
|
+
const manageRows = dsSystem.css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral__default["default"](["\n ", "\n"])), _ref3 => {
|
|
85
|
+
let {
|
|
86
|
+
rows,
|
|
87
|
+
theme,
|
|
88
|
+
isSpanParent
|
|
89
|
+
} = _ref3;
|
|
90
|
+
|
|
91
|
+
if (typeof rows === 'object' && !Array.isArray(rows)) {
|
|
92
|
+
let data = '';
|
|
93
|
+
Object.keys(theme.media).forEach(key => {
|
|
89
94
|
if (rows[key] && Array.isArray(rows[key])) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
return "minmax(0, ".concat(c, ")");
|
|
93
|
-
}).join(' ');
|
|
95
|
+
const mtg = dsSystem.mapTemplateGrid(rows[key]).join(' ');
|
|
96
|
+
const mtgs = dsSystem.mapTemplateGrid(rows[key]).map(c => "minmax(0, ".concat(c, ")")).join(' ');
|
|
94
97
|
|
|
95
98
|
if (key === 'small') {
|
|
96
99
|
data += "-ms-grid-rows: ".concat(mtg || 'minmax(0px, 1fr)', ";\n grid-template-rows: ").concat(mtg || 'auto', ";\n -ms-grid-rows: ").concat(mtgs || 'minmax(0px, 1fr)', ";\n grid-template-rows: ").concat(mtgs || 'auto', ";");
|
|
@@ -109,10 +112,8 @@ var manageRows = dsSystem.css(_templateObject3 || (_templateObject3 = _taggedTem
|
|
|
109
112
|
}
|
|
110
113
|
|
|
111
114
|
if (Array.isArray(rows)) {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
return "minmax(0, ".concat(c, ")");
|
|
115
|
-
}).join(' ');
|
|
115
|
+
const mtg = dsSystem.mapTemplateGrid(rows).join(' ');
|
|
116
|
+
const mtgs = dsSystem.mapTemplateGrid(rows).map(c => "minmax(0, ".concat(c, ")")).join(' ');
|
|
116
117
|
return "\n -ms-grid-rows: ".concat(mtg || 'minmax(0px, 1fr)', ";\n grid-template-rows: ").concat(mtg || 'auto', ";\n -ms-grid-rows: ").concat(mtgs || 'minmax(0px, 1fr)', ";\n grid-template-rows: ").concat(mtgs || 'auto', ";\n ");
|
|
117
118
|
}
|
|
118
119
|
|
|
@@ -126,4 +127,3 @@ var manageRows = dsSystem.css(_templateObject3 || (_templateObject3 = _taggedTem
|
|
|
126
127
|
exports.manageCols = manageCols;
|
|
127
128
|
exports.manageRows = manageRows;
|
|
128
129
|
exports.manageSpan = manageSpan;
|
|
129
|
-
//# sourceMappingURL=styles.js.map
|
package/esm/Grid.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import _extends from '@babel/runtime/helpers/esm/extends';
|
|
2
1
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
3
2
|
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
3
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
4
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
5
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
6
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
7
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
8
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
9
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
4
10
|
import React from 'react';
|
|
5
11
|
import { describe } from 'react-desc';
|
|
6
12
|
import { get } from 'lodash';
|
|
@@ -8,36 +14,34 @@ import { fixSpaceGutter } from '@elliemae/ds-system';
|
|
|
8
14
|
import { propTypes } from './propTypes.js';
|
|
9
15
|
import { GridItem } from './GridItem.js';
|
|
10
16
|
import { defaultProps } from './defaultProps.js';
|
|
11
|
-
import '
|
|
12
|
-
import 'styled-components';
|
|
13
|
-
import 'styled-system';
|
|
14
|
-
import './utils/styles.js';
|
|
15
|
-
import '@babel/runtime/helpers/esm/typeof';
|
|
16
|
-
import '@babel/runtime/helpers/esm/taggedTemplateLiteral';
|
|
17
|
+
import { jsx } from 'react/jsx-runtime';
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
const _excluded = ["rows", "cols", "alignItems", "children", "className", "justify", "gutter", "wrap"];
|
|
19
20
|
|
|
20
21
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
21
22
|
|
|
22
23
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
const Grid = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
25
|
+
const {
|
|
26
|
+
rows,
|
|
27
|
+
cols,
|
|
28
|
+
alignItems,
|
|
29
|
+
children,
|
|
30
|
+
className,
|
|
31
|
+
justify,
|
|
32
|
+
gutter,
|
|
33
|
+
wrap
|
|
34
|
+
} = props,
|
|
35
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
33
36
|
|
|
34
|
-
|
|
35
|
-
|
|
37
|
+
let isSpanParent = true;
|
|
38
|
+
const renderChildren = React.Children.map(children, child => {
|
|
36
39
|
if (get(child, 'child.type.name') === 'Grid' || get(child, 'type.displayName') === 'Grid' || parseInt(get(child, 'props.span', 0), 10) > 0) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
const {
|
|
41
|
+
width: wc,
|
|
42
|
+
height: hc,
|
|
43
|
+
span
|
|
44
|
+
} = child.props;
|
|
41
45
|
if (!span) isSpanParent = false;
|
|
42
46
|
return /*#__PURE__*/React.cloneElement(child, _objectSpread(_objectSpread({}, child.props), {}, {
|
|
43
47
|
width: fixSpaceGutter(wc),
|
|
@@ -47,7 +51,7 @@ var Grid = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
47
51
|
|
|
48
52
|
return child;
|
|
49
53
|
});
|
|
50
|
-
return /*#__PURE__*/
|
|
54
|
+
return /*#__PURE__*/jsx(GridItem, _objectSpread(_objectSpread({
|
|
51
55
|
alignItems: alignItems,
|
|
52
56
|
className: className,
|
|
53
57
|
cols: cols,
|
|
@@ -58,15 +62,15 @@ var Grid = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
58
62
|
wrap: wrap,
|
|
59
63
|
childNumber: React.Children.count(children),
|
|
60
64
|
ref: ref
|
|
61
|
-
}, rest),
|
|
65
|
+
}, rest), {}, {
|
|
66
|
+
children: renderChildren
|
|
67
|
+
}));
|
|
62
68
|
}); // Since this component is using ForwardRef, we must provide a displayName to avoid 'undefined' name in propsTable.
|
|
63
69
|
|
|
64
70
|
Grid.displayName = 'Grid'; // We should use props helpers to merge default props in the future, right now it causes many issues within Dimsum
|
|
65
71
|
|
|
66
72
|
Grid.defaultProps = defaultProps;
|
|
67
|
-
|
|
68
|
-
var DSGridWithSchema = describe(Grid);
|
|
73
|
+
const DSGridWithSchema = describe(Grid);
|
|
69
74
|
DSGridWithSchema.propTypes = propTypes;
|
|
70
75
|
|
|
71
76
|
export { DSGridWithSchema, Grid as default };
|
|
72
|
-
//# sourceMappingURL=Grid.js.map
|
package/esm/GridItem.js
CHANGED
|
@@ -2,19 +2,20 @@ import styled from 'styled-components';
|
|
|
2
2
|
import { grid, flexbox, justifyContent, space, height, width } from 'styled-system';
|
|
3
3
|
import { mapGap } from '@elliemae/ds-system';
|
|
4
4
|
import { manageCols, manageRows, manageSpan } from './utils/styles.js';
|
|
5
|
-
import '@babel/runtime/helpers/esm/typeof';
|
|
6
|
-
import '@babel/runtime/helpers/esm/taggedTemplateLiteral';
|
|
7
5
|
|
|
8
6
|
/* eslint-disable max-lines */
|
|
9
|
-
|
|
7
|
+
const GridItem = /*#__PURE__*/styled.div.withConfig({
|
|
10
8
|
componentId: "sc-1ch24x4-0"
|
|
11
|
-
})(["display:grid;display:-ms-grid;column-gap:", ";row-gap:", ";", " ", " ", " ", " ", " ", " ", " ", " ", ""],
|
|
12
|
-
|
|
9
|
+
})(["display:grid;display:-ms-grid;column-gap:", ";row-gap:", ";", " ", " ", " ", " ", " ", " ", " ", " ", ""], _ref => {
|
|
10
|
+
let {
|
|
11
|
+
gutter
|
|
12
|
+
} = _ref;
|
|
13
13
|
return mapGap(gutter);
|
|
14
|
-
},
|
|
15
|
-
|
|
14
|
+
}, _ref2 => {
|
|
15
|
+
let {
|
|
16
|
+
gutter
|
|
17
|
+
} = _ref2;
|
|
16
18
|
return mapGap(gutter);
|
|
17
19
|
}, grid, flexbox, justifyContent, space, height, width, manageCols, manageRows, manageSpan);
|
|
18
20
|
|
|
19
21
|
export { GridItem };
|
|
20
|
-
//# sourceMappingURL=GridItem.js.map
|
package/esm/defaultProps.js
CHANGED
package/esm/index.js
CHANGED
|
@@ -1,18 +1 @@
|
|
|
1
1
|
export { DSGridWithSchema, default as Grid, default as GridContainer, default as GridItem, default } from './Grid.js';
|
|
2
|
-
import '@babel/runtime/helpers/esm/extends';
|
|
3
|
-
import '@babel/runtime/helpers/esm/defineProperty';
|
|
4
|
-
import '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
5
|
-
import 'react';
|
|
6
|
-
import 'react-desc';
|
|
7
|
-
import 'lodash';
|
|
8
|
-
import '@elliemae/ds-system';
|
|
9
|
-
import './propTypes.js';
|
|
10
|
-
import './utils/constants.js';
|
|
11
|
-
import './GridItem.js';
|
|
12
|
-
import 'styled-components';
|
|
13
|
-
import 'styled-system';
|
|
14
|
-
import './utils/styles.js';
|
|
15
|
-
import '@babel/runtime/helpers/esm/typeof';
|
|
16
|
-
import '@babel/runtime/helpers/esm/taggedTemplateLiteral';
|
|
17
|
-
import './defaultProps.js';
|
|
18
|
-
//# sourceMappingURL=index.js.map
|
package/esm/propTypes.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { PropTypes } from 'react-desc';
|
|
2
2
|
import { alignItemsPlacement, justifyPlacement, wrap } from './utils/constants.js';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
const rowColBreakpoints = PropTypes.shape({
|
|
5
5
|
small: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),
|
|
6
6
|
medium: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),
|
|
7
7
|
large: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string]))
|
|
8
8
|
});
|
|
9
|
-
|
|
9
|
+
const spanBreakpoints = PropTypes.shape({
|
|
10
10
|
small: PropTypes.number,
|
|
11
11
|
medium: PropTypes.number,
|
|
12
12
|
large: PropTypes.number
|
|
13
13
|
});
|
|
14
|
-
|
|
14
|
+
const propTypes = {
|
|
15
15
|
rows: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), rowColBreakpoints]).description('Row layout cells').defaultValue([]),
|
|
16
16
|
cols: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), rowColBreakpoints]).description('Column layout cells').defaultValue([]),
|
|
17
17
|
span: PropTypes.oneOfType([PropTypes.number, spanBreakpoints]).description('Expands the grid element within columns.'),
|
|
@@ -40,4 +40,3 @@ var propTypes = {
|
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
export { propTypes };
|
|
43
|
-
//# sourceMappingURL=propTypes.js.map
|
package/esm/types.js
CHANGED
package/esm/utils/constants.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const justifyPlacement = ['flex-start', 'center', 'flex-end', 'space-between', 'space-around', 'space-evenly'];
|
|
2
|
+
const alignItemsPlacement = ['flex-start', 'center', 'flex-end', 'stretch', 'baseline'];
|
|
3
|
+
const wrap = ['wrap', 'nowrap', 'wrap-reverse'];
|
|
4
4
|
|
|
5
5
|
export { alignItemsPlacement, justifyPlacement, wrap };
|
|
6
|
-
//# sourceMappingURL=constants.js.map
|