@elliemae/ds-grid 2.2.0-alpha.4 → 3.0.0-next.2
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 +86 -76
- package/cjs/GridItem.js +29 -53
- package/cjs/defaultProps.js +9 -37
- package/cjs/index.js +13 -39
- package/cjs/propTypes.js +42 -75
- package/cjs/types.js +2 -27
- package/cjs/utils/constants.js +11 -46
- package/cjs/utils/styles.js +94 -136
- package/esm/Grid.js +70 -42
- package/esm/GridItem.js +21 -24
- package/esm/defaultProps.js +5 -8
- package/esm/index.js +1 -10
- package/esm/propTypes.js +30 -38
- package/esm/types.js +1 -2
- package/esm/utils/constants.js +5 -17
- package/esm/utils/styles.js +84 -107
- package/package.json +3 -6
- package/types/Grid.d.ts +1 -1
- package/types/index.d.ts +5 -1
- package/cjs/Grid.js.map +0 -7
- package/cjs/GridItem.js.map +0 -7
- package/cjs/defaultProps.js.map +0 -7
- package/cjs/index.js.map +0 -7
- package/cjs/propTypes.js.map +0 -7
- package/cjs/types.js.map +0 -7
- package/cjs/utils/constants.js.map +0 -7
- package/cjs/utils/styles.js.map +0 -7
- package/esm/Grid.js.map +0 -7
- package/esm/GridItem.js.map +0 -7
- package/esm/defaultProps.js.map +0 -7
- package/esm/index.js.map +0 -7
- package/esm/propTypes.js.map +0 -7
- package/esm/types.js.map +0 -7
- package/esm/utils/constants.js.map +0 -7
- package/esm/utils/styles.js.map +0 -7
package/cjs/utils/styles.js
CHANGED
|
@@ -1,171 +1,129 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
__export(styles_exports, {
|
|
30
|
-
manageCols: () => manageCols,
|
|
31
|
-
manageRows: () => manageRows,
|
|
32
|
-
manageSpan: () => manageSpan
|
|
33
|
-
});
|
|
34
|
-
var React = __toESM(require("react"));
|
|
35
|
-
var import_ds_system = require("@elliemae/ds-system");
|
|
36
|
-
const manageSpan = import_ds_system.css`
|
|
37
|
-
${({ isSpanParent, span, theme }) => {
|
|
38
|
-
if (!isSpanParent)
|
|
39
|
-
return "";
|
|
40
|
-
if (typeof span === "object") {
|
|
41
|
-
let data = "";
|
|
42
|
-
Object.keys(theme.media).forEach((key) => {
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
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');
|
|
11
|
+
var dsSystem = require('@elliemae/ds-system');
|
|
12
|
+
|
|
13
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
14
|
+
|
|
15
|
+
var _taggedTemplateLiteral__default = /*#__PURE__*/_interopDefaultLegacy(_taggedTemplateLiteral);
|
|
16
|
+
|
|
17
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
18
|
+
const manageSpan = dsSystem.css(_templateObject || (_templateObject = _taggedTemplateLiteral__default["default"](["\n ", "\n"])), _ref => {
|
|
19
|
+
let {
|
|
20
|
+
isSpanParent,
|
|
21
|
+
span,
|
|
22
|
+
theme
|
|
23
|
+
} = _ref;
|
|
24
|
+
if (!isSpanParent) return '';
|
|
25
|
+
|
|
26
|
+
if (typeof span === 'object') {
|
|
27
|
+
let data = '';
|
|
28
|
+
Object.keys(theme.media).forEach(key => {
|
|
43
29
|
if (span[key] && theme.breakpoints[key]) {
|
|
44
|
-
if (key ===
|
|
45
|
-
data +=
|
|
46
|
-
-ms-grid-column: auto / span ${span[key]};
|
|
47
|
-
grid-column: auto / span ${span[key]};
|
|
48
|
-
`;
|
|
30
|
+
if (key === 'small') {
|
|
31
|
+
data += "\n -ms-grid-column: auto / span ".concat(span[key], ";\n grid-column: auto / span ").concat(span[key], ";\n ");
|
|
49
32
|
} else {
|
|
50
|
-
data +=
|
|
51
|
-
-ms-grid-column: auto / span ${span[key]};
|
|
52
|
-
grid-column: auto / span ${span[key]};
|
|
53
|
-
}`;
|
|
33
|
+
data += "@media (min-width: ".concat(theme.breakpoints[key], ") {\n -ms-grid-column: auto / span ").concat(span[key], ";\n grid-column: auto / span ").concat(span[key], ";\n }");
|
|
54
34
|
}
|
|
55
35
|
}
|
|
56
36
|
});
|
|
57
37
|
return data;
|
|
58
38
|
}
|
|
59
|
-
|
|
60
|
-
-ms-grid-column: auto / span
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
39
|
+
|
|
40
|
+
return "\n -ms-grid-column: auto / span ".concat(span, ";\n grid-column: auto / span ").concat(span, ";");
|
|
41
|
+
});
|
|
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 => {
|
|
69
52
|
if (cols[key] && Array.isArray(cols[key])) {
|
|
70
|
-
const mtg =
|
|
71
|
-
const mtgs =
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
grid-template-columns:
|
|
75
|
-
-ms-grid-columns: ${mtgs || "minmax(0px, 1fr)"};
|
|
76
|
-
grid-template-columns: ${mtgs || "auto"};`;
|
|
53
|
+
const mtg = dsSystem.mapTemplateGrid(cols[key]).join(' ');
|
|
54
|
+
const mtgs = dsSystem.mapTemplateGrid(cols[key]).map(c => "minmax(0, ".concat(c, ")")).join(' ');
|
|
55
|
+
|
|
56
|
+
if (key === 'small') {
|
|
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', ";");
|
|
77
58
|
} else {
|
|
78
|
-
data +=
|
|
79
|
-
-ms-grid-columns: ${mtg || "minmax(0px, 1fr)"};
|
|
80
|
-
grid-template-columns: ${mtg || "auto"};
|
|
81
|
-
-ms-grid-columns: ${mtgs || "minmax(0px, 1fr)"};
|
|
82
|
-
grid-template-columns: ${mtgs || "auto"};
|
|
83
|
-
}`;
|
|
59
|
+
data += "@media (min-width: ".concat(theme.breakpoints[key], ") {\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 }");
|
|
84
60
|
}
|
|
85
61
|
} else if (isSpanParent) {
|
|
86
|
-
if (key ===
|
|
87
|
-
data +=
|
|
88
|
-
grid-template-columns: repeat(${cols[key]}, 1fr);`;
|
|
62
|
+
if (key === 'small') {
|
|
63
|
+
data += "-ms-grid-columns: repeat(".concat(cols[key], ", 1fr);\n grid-template-columns: repeat(").concat(cols[key], ", 1fr);");
|
|
89
64
|
} else {
|
|
90
|
-
data +=
|
|
91
|
-
-ms-grid-columns: repeat(${cols[key]}, 1fr);
|
|
92
|
-
grid-template-columns: repeat(${cols[key]}, 1fr);
|
|
93
|
-
}`;
|
|
65
|
+
data += "@media (min-width: ".concat(theme.breakpoints[key], ") {\n -ms-grid-columns: repeat(").concat(cols[key], ", 1fr);\n grid-template-columns: repeat(").concat(cols[key], ", 1fr);\n }");
|
|
94
66
|
}
|
|
95
67
|
}
|
|
96
68
|
});
|
|
97
69
|
return data;
|
|
98
70
|
}
|
|
71
|
+
|
|
99
72
|
if (Array.isArray(cols)) {
|
|
100
|
-
const mtg =
|
|
101
|
-
const mtgs =
|
|
102
|
-
return
|
|
103
|
-
-ms-grid-columns: ${mtg || "minmax(0px, 1fr)"};
|
|
104
|
-
grid-template-columns: ${mtg || "auto"};
|
|
105
|
-
-ms-grid-columns: ${mtgs || "minmax(0px, 1fr)"};
|
|
106
|
-
grid-template-columns: ${mtgs || "auto"};
|
|
107
|
-
`;
|
|
73
|
+
const mtg = dsSystem.mapTemplateGrid(cols).join(' ');
|
|
74
|
+
const mtgs = dsSystem.mapTemplateGrid(cols).map(c => "minmax(0, ".concat(c, ")")).join(' ');
|
|
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 ");
|
|
108
76
|
}
|
|
77
|
+
|
|
109
78
|
if (isSpanParent) {
|
|
110
|
-
return
|
|
111
|
-
-ms-grid-columns: repeat(${cols}, 1fr);
|
|
112
|
-
grid-template-columns: repeat(${cols}, 1fr);`;
|
|
79
|
+
return "\n -ms-grid-columns: repeat(".concat(cols, ", 1fr);\n grid-template-columns: repeat(").concat(cols, ", 1fr);");
|
|
113
80
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
const manageRows =
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
81
|
+
|
|
82
|
+
return '';
|
|
83
|
+
});
|
|
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 => {
|
|
122
94
|
if (rows[key] && Array.isArray(rows[key])) {
|
|
123
|
-
const mtg =
|
|
124
|
-
const mtgs =
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
grid-template-rows:
|
|
128
|
-
-ms-grid-rows: ${mtgs || "minmax(0px, 1fr)"};
|
|
129
|
-
grid-template-rows: ${mtgs || "auto"};`;
|
|
95
|
+
const mtg = dsSystem.mapTemplateGrid(rows[key]).join(' ');
|
|
96
|
+
const mtgs = dsSystem.mapTemplateGrid(rows[key]).map(c => "minmax(0, ".concat(c, ")")).join(' ');
|
|
97
|
+
|
|
98
|
+
if (key === 'small') {
|
|
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', ";");
|
|
130
100
|
} else {
|
|
131
|
-
data +=
|
|
132
|
-
-ms-grid-rows: ${mtg || "minmax(0px, 1fr)"};
|
|
133
|
-
grid-template-rows: ${mtg || "auto"};
|
|
134
|
-
-ms-grid-rows: ${mtgs || "minmax(0px, 1fr)"};
|
|
135
|
-
grid-template-rows: ${mtgs || "auto"};
|
|
136
|
-
}`;
|
|
101
|
+
data += "@media (min-width: ".concat(theme.breakpoints[key], ") {\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 }");
|
|
137
102
|
}
|
|
138
103
|
} else if (isSpanParent) {
|
|
139
|
-
if (key ===
|
|
140
|
-
data +=
|
|
141
|
-
grid-template-rows: repeat(${rows[key]}, 1fr);`;
|
|
104
|
+
if (key === 'small') {
|
|
105
|
+
data += "-ms-grid-rows: repeat(".concat(rows[key], ", 1fr);\n grid-template-rows: repeat(").concat(rows[key], ", 1fr);");
|
|
142
106
|
} else {
|
|
143
|
-
data +=
|
|
144
|
-
-ms-grid-rows: repeat(${rows[key]}, 1fr);
|
|
145
|
-
grid-template-rows: repeat(${rows[key]}, 1fr);
|
|
146
|
-
}`;
|
|
107
|
+
data += "@media (min-width: ".concat(theme.breakpoints[key], ") {\n -ms-grid-rows: repeat(").concat(rows[key], ", 1fr);\n grid-template-rows: repeat(").concat(rows[key], ", 1fr);\n }");
|
|
147
108
|
}
|
|
148
109
|
}
|
|
149
110
|
});
|
|
150
111
|
return data;
|
|
151
112
|
}
|
|
113
|
+
|
|
152
114
|
if (Array.isArray(rows)) {
|
|
153
|
-
const mtg =
|
|
154
|
-
const mtgs =
|
|
155
|
-
return
|
|
156
|
-
-ms-grid-rows: ${mtg || "minmax(0px, 1fr)"};
|
|
157
|
-
grid-template-rows: ${mtg || "auto"};
|
|
158
|
-
-ms-grid-rows: ${mtgs || "minmax(0px, 1fr)"};
|
|
159
|
-
grid-template-rows: ${mtgs || "auto"};
|
|
160
|
-
`;
|
|
115
|
+
const mtg = dsSystem.mapTemplateGrid(rows).join(' ');
|
|
116
|
+
const mtgs = dsSystem.mapTemplateGrid(rows).map(c => "minmax(0, ".concat(c, ")")).join(' ');
|
|
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 ");
|
|
161
118
|
}
|
|
119
|
+
|
|
162
120
|
if (isSpanParent) {
|
|
163
|
-
return
|
|
164
|
-
-ms-grid-rows: repeat(${rows}, 1fr);
|
|
165
|
-
grid-template-rows: repeat(${rows}, 1fr);`;
|
|
121
|
+
return "\n -ms-grid-rows: repeat(".concat(rows, ", 1fr);\n grid-template-rows: repeat(").concat(rows, ", 1fr);");
|
|
166
122
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
123
|
+
|
|
124
|
+
return '';
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
exports.manageCols = manageCols;
|
|
128
|
+
exports.manageRows = manageRows;
|
|
129
|
+
exports.manageSpan = manageSpan;
|
package/esm/Grid.js
CHANGED
|
@@ -1,52 +1,80 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
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';
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import { describe } from 'react-desc';
|
|
12
|
+
import { get } from 'lodash';
|
|
13
|
+
import { fixSpaceGutter } from '@elliemae/ds-system';
|
|
14
|
+
import { propTypes } from './propTypes.js';
|
|
15
|
+
import { GridItem } from './GridItem.js';
|
|
16
|
+
import { defaultProps } from './defaultProps.js';
|
|
17
|
+
import { jsx } from 'react/jsx-runtime';
|
|
18
|
+
|
|
19
|
+
const _excluded = ["rows", "cols", "alignItems", "children", "className", "justify", "gutter", "wrap", "width", "height"];
|
|
20
|
+
|
|
21
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
22
|
+
|
|
23
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
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
|
+
width,
|
|
35
|
+
height
|
|
36
|
+
} = props,
|
|
37
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
38
|
+
|
|
11
39
|
let isSpanParent = true;
|
|
12
|
-
const renderChildren =
|
|
13
|
-
if (get(child,
|
|
14
|
-
const {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
40
|
+
const renderChildren = React.Children.map(children, child => {
|
|
41
|
+
if (get(child, 'child.type.name') === 'Grid' || get(child, 'type.displayName') === 'Grid' || parseInt(get(child, 'props.span', 0), 10) > 0) {
|
|
42
|
+
const {
|
|
43
|
+
width: wc,
|
|
44
|
+
height: hc,
|
|
45
|
+
span
|
|
46
|
+
} = child.props;
|
|
47
|
+
if (!span) isSpanParent = false;
|
|
48
|
+
return /*#__PURE__*/React.cloneElement(child, _objectSpread(_objectSpread({}, child.props), {}, {
|
|
19
49
|
width: fixSpaceGutter(wc),
|
|
20
50
|
height: fixSpaceGutter(hc)
|
|
21
|
-
});
|
|
51
|
+
}));
|
|
22
52
|
}
|
|
53
|
+
|
|
23
54
|
return child;
|
|
24
55
|
});
|
|
25
|
-
return
|
|
26
|
-
alignItems,
|
|
27
|
-
className,
|
|
28
|
-
cols,
|
|
29
|
-
gutter,
|
|
30
|
-
isSpanParent,
|
|
31
|
-
justify,
|
|
32
|
-
rows,
|
|
33
|
-
wrap,
|
|
34
|
-
childNumber:
|
|
35
|
-
ref,
|
|
56
|
+
return /*#__PURE__*/jsx(GridItem, _objectSpread(_objectSpread({
|
|
57
|
+
alignItems: alignItems,
|
|
58
|
+
className: className,
|
|
59
|
+
cols: cols,
|
|
60
|
+
gutter: gutter,
|
|
61
|
+
isSpanParent: isSpanParent,
|
|
62
|
+
justify: justify,
|
|
63
|
+
rows: rows,
|
|
64
|
+
wrap: wrap,
|
|
65
|
+
childNumber: React.Children.count(children),
|
|
66
|
+
ref: ref,
|
|
36
67
|
w: width,
|
|
37
|
-
h: height
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
});
|
|
41
|
-
|
|
68
|
+
h: height
|
|
69
|
+
}, rest), {}, {
|
|
70
|
+
children: renderChildren
|
|
71
|
+
}));
|
|
72
|
+
}); // Since this component is using ForwardRef, we must provide a displayName to avoid 'undefined' name in propsTable.
|
|
73
|
+
|
|
74
|
+
Grid.displayName = 'Grid'; // We should use props helpers to merge default props in the future, right now it causes many issues within Dimsum
|
|
75
|
+
|
|
42
76
|
Grid.defaultProps = defaultProps;
|
|
43
|
-
Grid.propTypes = propTypes;
|
|
44
77
|
const DSGridWithSchema = describe(Grid);
|
|
45
78
|
DSGridWithSchema.propTypes = propTypes;
|
|
46
|
-
|
|
47
|
-
export {
|
|
48
|
-
DSGridWithSchema,
|
|
49
|
-
Grid,
|
|
50
|
-
Grid_default as default
|
|
51
|
-
};
|
|
52
|
-
//# sourceMappingURL=Grid.js.map
|
|
79
|
+
|
|
80
|
+
export { DSGridWithSchema, Grid as default };
|
package/esm/GridItem.js
CHANGED
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
export {
|
|
22
|
-
GridItem
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=GridItem.js.map
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { grids, flexboxes, sizing, space, height, width } from '@xstyled/styled-components';
|
|
3
|
+
import { mapGap } from '@elliemae/ds-system';
|
|
4
|
+
import { manageCols, manageRows, manageSpan } from './utils/styles.js';
|
|
5
|
+
|
|
6
|
+
/* eslint-disable max-lines */
|
|
7
|
+
const GridItem = /*#__PURE__*/styled.div.withConfig({
|
|
8
|
+
componentId: "sc-1ch24x4-0"
|
|
9
|
+
})(["display:grid;display:-ms-grid;column-gap:", ";row-gap:", ";", " ", " ", " ", " ", " ", " ", " ", " ", ""], _ref => {
|
|
10
|
+
let {
|
|
11
|
+
gutter
|
|
12
|
+
} = _ref;
|
|
13
|
+
return mapGap(gutter);
|
|
14
|
+
}, _ref2 => {
|
|
15
|
+
let {
|
|
16
|
+
gutter
|
|
17
|
+
} = _ref2;
|
|
18
|
+
return mapGap(gutter);
|
|
19
|
+
}, grids, flexboxes, sizing, space, height, width, manageCols, manageRows, manageSpan);
|
|
20
|
+
|
|
21
|
+
export { GridItem };
|
package/esm/defaultProps.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
1
|
const defaultProps = {
|
|
3
2
|
rows: [],
|
|
4
3
|
cols: [],
|
|
5
|
-
className:
|
|
6
|
-
justify:
|
|
4
|
+
className: '',
|
|
5
|
+
justify: 'flex-start',
|
|
7
6
|
gutter: 0,
|
|
8
|
-
wrap:
|
|
7
|
+
wrap: 'wrap',
|
|
9
8
|
span: 1
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=defaultProps.js.map
|
|
10
|
+
|
|
11
|
+
export { defaultProps };
|
package/esm/index.js
CHANGED
|
@@ -1,10 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { default as default2, Grid, default as default3, default as default4, DSGridWithSchema } from "./Grid";
|
|
3
|
-
export {
|
|
4
|
-
DSGridWithSchema,
|
|
5
|
-
Grid,
|
|
6
|
-
default3 as GridContainer,
|
|
7
|
-
default4 as GridItem,
|
|
8
|
-
default2 as default
|
|
9
|
-
};
|
|
10
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export { DSGridWithSchema, default as Grid, default as GridContainer, default as GridItem, default } from './Grid.js';
|
package/esm/propTypes.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { PropTypes } from 'react-desc';
|
|
2
|
+
import { alignItemsPlacement, justifyPlacement, wrap } from './utils/constants.js';
|
|
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])),
|
|
@@ -12,39 +12,31 @@ const spanBreakpoints = PropTypes.shape({
|
|
|
12
12
|
large: PropTypes.number
|
|
13
13
|
});
|
|
14
14
|
const propTypes = {
|
|
15
|
-
rows: PropTypes.oneOfType([
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
]).description(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
mt: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description("Grid top margin"),
|
|
41
|
-
mb: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description("Grid bottom margin"),
|
|
42
|
-
pl: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description("Grid left padding."),
|
|
43
|
-
pr: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description("Grid right padding"),
|
|
44
|
-
pt: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description("Grid top padding"),
|
|
45
|
-
pb: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description("Grid bottom padding")
|
|
15
|
+
rows: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), rowColBreakpoints]).description('Row layout cells').defaultValue([]),
|
|
16
|
+
cols: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), rowColBreakpoints]).description('Column layout cells').defaultValue([]),
|
|
17
|
+
span: PropTypes.oneOfType([PropTypes.number, spanBreakpoints]).description('Expands the grid element within columns.'),
|
|
18
|
+
alignItems: PropTypes.oneOf(alignItemsPlacement).description('flex-like align items prop'),
|
|
19
|
+
children: PropTypes.node.description('Children node inside grid cell'),
|
|
20
|
+
className: PropTypes.string.description('CSS class').defaultValue(''),
|
|
21
|
+
justifyContent: PropTypes.oneOf(justifyPlacement).description('flex-like justify prop').defaultValue(justifyPlacement[0]),
|
|
22
|
+
gutter: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Space between cells prop').defaultValue(0),
|
|
23
|
+
wrap: PropTypes.oneOf(wrap).description('Wrap type').defaultValue(wrap[0]),
|
|
24
|
+
height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Grid height.'),
|
|
25
|
+
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Grid width.'),
|
|
26
|
+
p: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Grid padding in all sides.'),
|
|
27
|
+
m: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Grid margin in all sides.'),
|
|
28
|
+
px: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Grid padding in left and right sides.'),
|
|
29
|
+
mx: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Grid margin in left and right sides.'),
|
|
30
|
+
py: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Grid padding in top and bottom sides.'),
|
|
31
|
+
my: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Grid margin in top and bottom sides.'),
|
|
32
|
+
ml: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Grid left margin.'),
|
|
33
|
+
mr: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Grid right margin'),
|
|
34
|
+
mt: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Grid top margin'),
|
|
35
|
+
mb: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Grid bottom margin'),
|
|
36
|
+
pl: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Grid left padding.'),
|
|
37
|
+
pr: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Grid right padding'),
|
|
38
|
+
pt: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Grid top padding'),
|
|
39
|
+
pb: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Grid bottom padding')
|
|
46
40
|
};
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
};
|
|
50
|
-
//# sourceMappingURL=propTypes.js.map
|
|
41
|
+
|
|
42
|
+
export { propTypes };
|
package/esm/types.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=types.js.map
|
|
1
|
+
|
package/esm/utils/constants.js
CHANGED
|
@@ -1,17 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
"space-between",
|
|
7
|
-
"space-around",
|
|
8
|
-
"space-evenly"
|
|
9
|
-
];
|
|
10
|
-
const alignItemsPlacement = ["flex-start", "center", "flex-end", "stretch", "baseline"];
|
|
11
|
-
const wrap = ["wrap", "nowrap", "wrap-reverse"];
|
|
12
|
-
export {
|
|
13
|
-
alignItemsPlacement,
|
|
14
|
-
justifyPlacement,
|
|
15
|
-
wrap
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=constants.js.map
|
|
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
|
+
|
|
5
|
+
export { alignItemsPlacement, justifyPlacement, wrap };
|