@elliemae/ds-grid 2.2.0-next.4 → 2.3.0-alpha.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 +76 -86
- package/cjs/Grid.js.map +7 -0
- package/cjs/GridItem.js +53 -29
- package/cjs/GridItem.js.map +7 -0
- package/cjs/defaultProps.js +37 -9
- package/cjs/defaultProps.js.map +7 -0
- package/cjs/index.js +39 -13
- package/cjs/index.js.map +7 -0
- package/cjs/propTypes.js +75 -42
- package/cjs/propTypes.js.map +7 -0
- package/cjs/types.js +27 -2
- package/cjs/types.js.map +7 -0
- package/cjs/utils/constants.js +46 -11
- package/cjs/utils/constants.js.map +7 -0
- package/cjs/utils/styles.js +136 -94
- package/cjs/utils/styles.js.map +7 -0
- package/esm/Grid.js +42 -70
- package/esm/Grid.js.map +7 -0
- package/esm/GridItem.js +24 -21
- package/esm/GridItem.js.map +7 -0
- package/esm/defaultProps.js +8 -5
- package/esm/defaultProps.js.map +7 -0
- package/esm/index.js +10 -1
- package/esm/index.js.map +7 -0
- package/esm/propTypes.js +38 -30
- package/esm/propTypes.js.map +7 -0
- package/esm/types.js +2 -1
- package/esm/types.js.map +7 -0
- package/esm/utils/constants.js +17 -5
- package/esm/utils/constants.js.map +7 -0
- package/esm/utils/styles.js +107 -84
- package/esm/utils/styles.js.map +7 -0
- package/package.json +2 -2
- package/types/Grid.d.ts +2 -2
- package/types/index.d.ts +1 -5
package/esm/propTypes.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { PropTypes } from "react-desc";
|
|
3
|
+
import { alignItemsPlacement, justifyPlacement, wrap } from "./utils/constants";
|
|
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,31 +12,39 @@ 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
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
15
|
+
rows: PropTypes.oneOfType([
|
|
16
|
+
PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),
|
|
17
|
+
rowColBreakpoints
|
|
18
|
+
]).description("Row layout cells").defaultValue([]),
|
|
19
|
+
cols: PropTypes.oneOfType([
|
|
20
|
+
PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),
|
|
21
|
+
rowColBreakpoints
|
|
22
|
+
]).description("Column layout cells").defaultValue([]),
|
|
23
|
+
span: PropTypes.oneOfType([PropTypes.number, spanBreakpoints]).description("Expands the grid element within columns."),
|
|
24
|
+
alignItems: PropTypes.oneOf(alignItemsPlacement).description("flex-like align items prop"),
|
|
25
|
+
children: PropTypes.node.description("Children node inside grid cell"),
|
|
26
|
+
className: PropTypes.string.description("CSS class").defaultValue(""),
|
|
27
|
+
justifyContent: PropTypes.oneOf(justifyPlacement).description("flex-like justify prop").defaultValue(justifyPlacement[0]),
|
|
28
|
+
gutter: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description("Space between cells prop").defaultValue(0),
|
|
29
|
+
wrap: PropTypes.oneOf(wrap).description("Wrap type").defaultValue(wrap[0]),
|
|
30
|
+
height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description("Grid height."),
|
|
31
|
+
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description("Grid width."),
|
|
32
|
+
p: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description("Grid padding in all sides."),
|
|
33
|
+
m: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description("Grid margin in all sides."),
|
|
34
|
+
px: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description("Grid padding in left and right sides."),
|
|
35
|
+
mx: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description("Grid margin in left and right sides."),
|
|
36
|
+
py: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description("Grid padding in top and bottom sides."),
|
|
37
|
+
my: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description("Grid margin in top and bottom sides."),
|
|
38
|
+
ml: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description("Grid left margin."),
|
|
39
|
+
mr: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description("Grid right margin"),
|
|
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")
|
|
40
46
|
};
|
|
41
|
-
|
|
42
|
-
|
|
47
|
+
export {
|
|
48
|
+
propTypes
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=propTypes.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/propTypes.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { PropTypes } from 'react-desc';\nimport { alignItemsPlacement, justifyPlacement, wrap } from './utils/constants';\n\nconst rowColBreakpoints = PropTypes.shape({\n small: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),\n medium: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),\n large: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),\n});\n\nconst spanBreakpoints = PropTypes.shape({\n small: PropTypes.number,\n medium: PropTypes.number,\n large: PropTypes.number,\n});\n\nexport const propTypes = {\n rows: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),\n rowColBreakpoints,\n ])\n .description('Row layout cells')\n .defaultValue([]),\n cols: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),\n rowColBreakpoints,\n ])\n .description('Column layout cells')\n .defaultValue([]),\n span: PropTypes.oneOfType([PropTypes.number, spanBreakpoints]).description(\n 'Expands the grid element within columns.',\n ),\n alignItems: PropTypes.oneOf(alignItemsPlacement).description('flex-like align items prop'),\n children: PropTypes.node.description('Children node inside grid cell'),\n className: PropTypes.string.description('CSS class').defaultValue(''),\n justifyContent: PropTypes.oneOf(justifyPlacement)\n .description('flex-like justify prop')\n .defaultValue(justifyPlacement[0]),\n gutter: PropTypes.oneOfType([PropTypes.number, PropTypes.string])\n .description('Space between cells prop')\n .defaultValue(0),\n wrap: PropTypes.oneOf(wrap).description('Wrap type').defaultValue(wrap[0]),\n height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Grid height.'),\n width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Grid width.'),\n p: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Grid padding in all sides.'),\n m: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Grid margin in all sides.'),\n px: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Grid padding in left and right sides.'),\n mx: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Grid margin in left and right sides.'),\n py: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Grid padding in top and bottom sides.'),\n my: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Grid margin in top and bottom sides.'),\n ml: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Grid left margin.'),\n mr: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Grid right margin'),\n mt: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Grid top margin'),\n mb: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Grid bottom margin'),\n pl: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Grid left padding.'),\n pr: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Grid right padding'),\n pt: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Grid top padding'),\n pb: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Grid bottom padding'),\n};\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;AAEA,MAAM,oBAAoB,UAAU,MAAM;AAAA,EACxC,OAAO,UAAU,QAAQ,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU;AAAA,EAC1E,QAAQ,UAAU,QAAQ,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU;AAAA,EAC3E,OAAO,UAAU,QAAQ,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU;AAAA;AAG5E,MAAM,kBAAkB,UAAU,MAAM;AAAA,EACtC,OAAO,UAAU;AAAA,EACjB,QAAQ,UAAU;AAAA,EAClB,OAAO,UAAU;AAAA;AAGZ,MAAM,YAAY;AAAA,EACvB,MAAM,UAAU,UAAU;AAAA,IACxB,UAAU,QAAQ,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU;AAAA,IAC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U,QAAQ,UAAU,SAAS,YAAY;AAAA,EAC1E,IAAI,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,SAAS,YAAY;AAAA,EAC1E,IAAI,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,SAAS,YAAY;AAAA,EAC1E,IAAI,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,SAAS,YAAY;AAAA,EAC1E,IAAI,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,SAAS,YAAY;AAAA,EAC1E,IAAI,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,SAAS,YAAY;AAAA,EAC1E,IAAI,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,SAAS,YAAY;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/esm/types.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
//# sourceMappingURL=types.js.map
|
package/esm/types.js.map
ADDED
package/esm/utils/constants.js
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
const justifyPlacement = [
|
|
3
|
+
"flex-start",
|
|
4
|
+
"center",
|
|
5
|
+
"flex-end",
|
|
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
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/utils/constants.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const justifyPlacement = [\n 'flex-start',\n 'center',\n 'flex-end',\n 'space-between',\n 'space-around',\n 'space-evenly',\n] as const;\n\nexport const alignItemsPlacement = ['flex-start', 'center', 'flex-end', 'stretch', 'baseline'] as const;\n\nexport const wrap = ['wrap', 'nowrap', 'wrap-reverse'] as const;\n"],
|
|
5
|
+
"mappings": "AAAA;ACAO,MAAM,mBAAmB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAGK,MAAM,sBAAsB,CAAC,cAAc,UAAU,YAAY,WAAW;AAE5E,MAAM,OAAO,CAAC,QAAQ,UAAU;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/esm/utils/styles.js
CHANGED
|
@@ -1,119 +1,142 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const manageSpan = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n"])), _ref => {
|
|
11
|
-
let {
|
|
12
|
-
isSpanParent,
|
|
13
|
-
span,
|
|
14
|
-
theme
|
|
15
|
-
} = _ref;
|
|
16
|
-
if (!isSpanParent) return '';
|
|
17
|
-
|
|
18
|
-
if (typeof span === 'object') {
|
|
19
|
-
let data = '';
|
|
20
|
-
Object.keys(theme.media).forEach(key => {
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { css, mapTemplateGrid } from "@elliemae/ds-system";
|
|
3
|
+
const manageSpan = css`
|
|
4
|
+
${({ isSpanParent, span, theme }) => {
|
|
5
|
+
if (!isSpanParent)
|
|
6
|
+
return "";
|
|
7
|
+
if (typeof span === "object") {
|
|
8
|
+
let data = "";
|
|
9
|
+
Object.keys(theme.media).forEach((key) => {
|
|
21
10
|
if (span[key] && theme.breakpoints[key]) {
|
|
22
|
-
if (key ===
|
|
23
|
-
data +=
|
|
11
|
+
if (key === "small") {
|
|
12
|
+
data += `
|
|
13
|
+
-ms-grid-column: auto / span ${span[key]};
|
|
14
|
+
grid-column: auto / span ${span[key]};
|
|
15
|
+
`;
|
|
24
16
|
} else {
|
|
25
|
-
data +=
|
|
17
|
+
data += `@media (min-width: ${theme.breakpoints[key]}) {
|
|
18
|
+
-ms-grid-column: auto / span ${span[key]};
|
|
19
|
+
grid-column: auto / span ${span[key]};
|
|
20
|
+
}`;
|
|
26
21
|
}
|
|
27
22
|
}
|
|
28
23
|
});
|
|
29
24
|
return data;
|
|
30
25
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if (typeof cols === 'object' && !Array.isArray(cols)) {
|
|
42
|
-
let data = '';
|
|
43
|
-
Object.keys(theme.media).forEach(key => {
|
|
26
|
+
return `
|
|
27
|
+
-ms-grid-column: auto / span ${span};
|
|
28
|
+
grid-column: auto / span ${span};`;
|
|
29
|
+
}}
|
|
30
|
+
`;
|
|
31
|
+
const manageCols = css`
|
|
32
|
+
${({ cols, theme, isSpanParent }) => {
|
|
33
|
+
if (typeof cols === "object" && !Array.isArray(cols)) {
|
|
34
|
+
let data = "";
|
|
35
|
+
Object.keys(theme.media).forEach((key) => {
|
|
44
36
|
if (cols[key] && Array.isArray(cols[key])) {
|
|
45
|
-
const mtg = mapTemplateGrid(cols[key]).join(
|
|
46
|
-
const mtgs = mapTemplateGrid(cols[key]).map(c =>
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
37
|
+
const mtg = mapTemplateGrid(cols[key]).join(" ");
|
|
38
|
+
const mtgs = mapTemplateGrid(cols[key]).map((c) => `minmax(0, ${c})`).join(" ");
|
|
39
|
+
if (key === "small") {
|
|
40
|
+
data += `-ms-grid-columns: ${mtg || "minmax(0px, 1fr)"};
|
|
41
|
+
grid-template-columns: ${mtg || "auto"};
|
|
42
|
+
-ms-grid-columns: ${mtgs || "minmax(0px, 1fr)"};
|
|
43
|
+
grid-template-columns: ${mtgs || "auto"};`;
|
|
50
44
|
} else {
|
|
51
|
-
data +=
|
|
45
|
+
data += `@media (min-width: ${theme.breakpoints[key]}) {
|
|
46
|
+
-ms-grid-columns: ${mtg || "minmax(0px, 1fr)"};
|
|
47
|
+
grid-template-columns: ${mtg || "auto"};
|
|
48
|
+
-ms-grid-columns: ${mtgs || "minmax(0px, 1fr)"};
|
|
49
|
+
grid-template-columns: ${mtgs || "auto"};
|
|
50
|
+
}`;
|
|
52
51
|
}
|
|
53
52
|
} else if (isSpanParent) {
|
|
54
|
-
if (key ===
|
|
55
|
-
data +=
|
|
53
|
+
if (key === "small") {
|
|
54
|
+
data += `-ms-grid-columns: repeat(${cols[key]}, 1fr);
|
|
55
|
+
grid-template-columns: repeat(${cols[key]}, 1fr);`;
|
|
56
56
|
} else {
|
|
57
|
-
data +=
|
|
57
|
+
data += `@media (min-width: ${theme.breakpoints[key]}) {
|
|
58
|
+
-ms-grid-columns: repeat(${cols[key]}, 1fr);
|
|
59
|
+
grid-template-columns: repeat(${cols[key]}, 1fr);
|
|
60
|
+
}`;
|
|
58
61
|
}
|
|
59
62
|
}
|
|
60
63
|
});
|
|
61
64
|
return data;
|
|
62
65
|
}
|
|
63
|
-
|
|
64
66
|
if (Array.isArray(cols)) {
|
|
65
|
-
const mtg = mapTemplateGrid(cols).join(
|
|
66
|
-
const mtgs = mapTemplateGrid(cols).map(c =>
|
|
67
|
-
return
|
|
67
|
+
const mtg = mapTemplateGrid(cols).join(" ");
|
|
68
|
+
const mtgs = mapTemplateGrid(cols).map((c) => `minmax(0, ${c})`).join(" ");
|
|
69
|
+
return `
|
|
70
|
+
-ms-grid-columns: ${mtg || "minmax(0px, 1fr)"};
|
|
71
|
+
grid-template-columns: ${mtg || "auto"};
|
|
72
|
+
-ms-grid-columns: ${mtgs || "minmax(0px, 1fr)"};
|
|
73
|
+
grid-template-columns: ${mtgs || "auto"};
|
|
74
|
+
`;
|
|
68
75
|
}
|
|
69
|
-
|
|
70
76
|
if (isSpanParent) {
|
|
71
|
-
return
|
|
77
|
+
return `
|
|
78
|
+
-ms-grid-columns: repeat(${cols}, 1fr);
|
|
79
|
+
grid-template-columns: repeat(${cols}, 1fr);`;
|
|
72
80
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const manageRows = css
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
} = _ref3;
|
|
82
|
-
|
|
83
|
-
if (typeof rows === 'object' && !Array.isArray(rows)) {
|
|
84
|
-
let data = '';
|
|
85
|
-
Object.keys(theme.media).forEach(key => {
|
|
81
|
+
return "";
|
|
82
|
+
}}
|
|
83
|
+
`;
|
|
84
|
+
const manageRows = css`
|
|
85
|
+
${({ rows, theme, isSpanParent }) => {
|
|
86
|
+
if (typeof rows === "object" && !Array.isArray(rows)) {
|
|
87
|
+
let data = "";
|
|
88
|
+
Object.keys(theme.media).forEach((key) => {
|
|
86
89
|
if (rows[key] && Array.isArray(rows[key])) {
|
|
87
|
-
const mtg = mapTemplateGrid(rows[key]).join(
|
|
88
|
-
const mtgs = mapTemplateGrid(rows[key]).map(c =>
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
const mtg = mapTemplateGrid(rows[key]).join(" ");
|
|
91
|
+
const mtgs = mapTemplateGrid(rows[key]).map((c) => `minmax(0, ${c})`).join(" ");
|
|
92
|
+
if (key === "small") {
|
|
93
|
+
data += `-ms-grid-rows: ${mtg || "minmax(0px, 1fr)"};
|
|
94
|
+
grid-template-rows: ${mtg || "auto"};
|
|
95
|
+
-ms-grid-rows: ${mtgs || "minmax(0px, 1fr)"};
|
|
96
|
+
grid-template-rows: ${mtgs || "auto"};`;
|
|
92
97
|
} else {
|
|
93
|
-
data +=
|
|
98
|
+
data += `@media (min-width: ${theme.breakpoints[key]}) {
|
|
99
|
+
-ms-grid-rows: ${mtg || "minmax(0px, 1fr)"};
|
|
100
|
+
grid-template-rows: ${mtg || "auto"};
|
|
101
|
+
-ms-grid-rows: ${mtgs || "minmax(0px, 1fr)"};
|
|
102
|
+
grid-template-rows: ${mtgs || "auto"};
|
|
103
|
+
}`;
|
|
94
104
|
}
|
|
95
105
|
} else if (isSpanParent) {
|
|
96
|
-
if (key ===
|
|
97
|
-
data +=
|
|
106
|
+
if (key === "small") {
|
|
107
|
+
data += `-ms-grid-rows: repeat(${rows[key]}, 1fr);
|
|
108
|
+
grid-template-rows: repeat(${rows[key]}, 1fr);`;
|
|
98
109
|
} else {
|
|
99
|
-
data +=
|
|
110
|
+
data += `@media (min-width: ${theme.breakpoints[key]}) {
|
|
111
|
+
-ms-grid-rows: repeat(${rows[key]}, 1fr);
|
|
112
|
+
grid-template-rows: repeat(${rows[key]}, 1fr);
|
|
113
|
+
}`;
|
|
100
114
|
}
|
|
101
115
|
}
|
|
102
116
|
});
|
|
103
117
|
return data;
|
|
104
118
|
}
|
|
105
|
-
|
|
106
119
|
if (Array.isArray(rows)) {
|
|
107
|
-
const mtg = mapTemplateGrid(rows).join(
|
|
108
|
-
const mtgs = mapTemplateGrid(rows).map(c =>
|
|
109
|
-
return
|
|
120
|
+
const mtg = mapTemplateGrid(rows).join(" ");
|
|
121
|
+
const mtgs = mapTemplateGrid(rows).map((c) => `minmax(0, ${c})`).join(" ");
|
|
122
|
+
return `
|
|
123
|
+
-ms-grid-rows: ${mtg || "minmax(0px, 1fr)"};
|
|
124
|
+
grid-template-rows: ${mtg || "auto"};
|
|
125
|
+
-ms-grid-rows: ${mtgs || "minmax(0px, 1fr)"};
|
|
126
|
+
grid-template-rows: ${mtgs || "auto"};
|
|
127
|
+
`;
|
|
110
128
|
}
|
|
111
|
-
|
|
112
129
|
if (isSpanParent) {
|
|
113
|
-
return
|
|
130
|
+
return `
|
|
131
|
+
-ms-grid-rows: repeat(${rows}, 1fr);
|
|
132
|
+
grid-template-rows: repeat(${rows}, 1fr);`;
|
|
114
133
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
134
|
+
return "";
|
|
135
|
+
}}
|
|
136
|
+
`;
|
|
137
|
+
export {
|
|
138
|
+
manageCols,
|
|
139
|
+
manageRows,
|
|
140
|
+
manageSpan
|
|
141
|
+
};
|
|
142
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/utils/styles.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\n/* eslint-disable complexity */\nimport { css, mapTemplateGrid } from '@elliemae/ds-system';\n\nexport const manageSpan = css`\n ${({ isSpanParent, span, theme }) => {\n if (!isSpanParent) return '';\n if (typeof span === 'object') {\n let data = '';\n Object.keys(theme.media).forEach((key) => {\n if (span[key] && theme.breakpoints[key]) {\n if (key === 'small') {\n data += `\n -ms-grid-column: auto / span ${span[key]};\n grid-column: auto / span ${span[key]};\n `;\n } else {\n data += `@media (min-width: ${theme.breakpoints[key]}) {\n -ms-grid-column: auto / span ${span[key]};\n grid-column: auto / span ${span[key]};\n }`;\n }\n }\n });\n return data;\n }\n return `\n -ms-grid-column: auto / span ${span};\n grid-column: auto / span ${span};`;\n }}\n`;\n\nexport const manageCols = css`\n ${({ cols, theme, isSpanParent }) => {\n if (typeof cols === 'object' && !Array.isArray(cols)) {\n let data = '';\n Object.keys(theme.media).forEach((key) => {\n if (cols[key] && Array.isArray(cols[key])) {\n const mtg = mapTemplateGrid(cols[key]).join(' ');\n const mtgs = mapTemplateGrid(cols[key])\n .map((c) => `minmax(0, ${c})`)\n .join(' ');\n if (key === 'small') {\n data += `-ms-grid-columns: ${mtg || 'minmax(0px, 1fr)'};\n grid-template-columns: ${mtg || 'auto'};\n -ms-grid-columns: ${mtgs || 'minmax(0px, 1fr)'};\n grid-template-columns: ${mtgs || 'auto'};`;\n } else {\n data += `@media (min-width: ${theme.breakpoints[key]}) {\n -ms-grid-columns: ${mtg || 'minmax(0px, 1fr)'};\n grid-template-columns: ${mtg || 'auto'};\n -ms-grid-columns: ${mtgs || 'minmax(0px, 1fr)'};\n grid-template-columns: ${mtgs || 'auto'};\n }`;\n }\n } else if (isSpanParent) {\n if (key === 'small') {\n data += `-ms-grid-columns: repeat(${cols[key]}, 1fr);\n grid-template-columns: repeat(${cols[key]}, 1fr);`;\n } else {\n data += `@media (min-width: ${theme.breakpoints[key]}) {\n -ms-grid-columns: repeat(${cols[key]}, 1fr);\n grid-template-columns: repeat(${cols[key]}, 1fr);\n }`;\n }\n }\n });\n return data;\n }\n if (Array.isArray(cols)) {\n const mtg = mapTemplateGrid(cols).join(' ');\n const mtgs = mapTemplateGrid(cols)\n .map((c) => `minmax(0, ${c})`)\n .join(' ');\n return `\n -ms-grid-columns: ${mtg || 'minmax(0px, 1fr)'};\n grid-template-columns: ${mtg || 'auto'};\n -ms-grid-columns: ${mtgs || 'minmax(0px, 1fr)'};\n grid-template-columns: ${mtgs || 'auto'};\n `;\n }\n if (isSpanParent) {\n return `\n -ms-grid-columns: repeat(${cols}, 1fr);\n grid-template-columns: repeat(${cols}, 1fr);`;\n }\n return '';\n }}\n`;\n\nexport const manageRows = css`\n ${({ rows, theme, isSpanParent }) => {\n if (typeof rows === 'object' && !Array.isArray(rows)) {\n let data = '';\n Object.keys(theme.media).forEach((key) => {\n if (rows[key] && Array.isArray(rows[key])) {\n const mtg = mapTemplateGrid(rows[key]).join(' ');\n const mtgs = mapTemplateGrid(rows[key])\n .map((c) => `minmax(0, ${c})`)\n .join(' ');\n if (key === 'small') {\n data += `-ms-grid-rows: ${mtg || 'minmax(0px, 1fr)'};\n grid-template-rows: ${mtg || 'auto'};\n -ms-grid-rows: ${mtgs || 'minmax(0px, 1fr)'};\n grid-template-rows: ${mtgs || 'auto'};`;\n } else {\n data += `@media (min-width: ${theme.breakpoints[key]}) {\n -ms-grid-rows: ${mtg || 'minmax(0px, 1fr)'};\n grid-template-rows: ${mtg || 'auto'};\n -ms-grid-rows: ${mtgs || 'minmax(0px, 1fr)'};\n grid-template-rows: ${mtgs || 'auto'};\n }`;\n }\n } else if (isSpanParent) {\n if (key === 'small') {\n data += `-ms-grid-rows: repeat(${rows[key]}, 1fr);\n grid-template-rows: repeat(${rows[key]}, 1fr);`;\n } else {\n data += `@media (min-width: ${theme.breakpoints[key]}) {\n -ms-grid-rows: repeat(${rows[key]}, 1fr);\n grid-template-rows: repeat(${rows[key]}, 1fr);\n }`;\n }\n }\n });\n return data;\n }\n if (Array.isArray(rows)) {\n const mtg = mapTemplateGrid(rows).join(' ');\n const mtgs = mapTemplateGrid(rows)\n .map((c) => `minmax(0, ${c})`)\n .join(' ');\n return `\n -ms-grid-rows: ${mtg || 'minmax(0px, 1fr)'};\n grid-template-rows: ${mtg || 'auto'};\n -ms-grid-rows: ${mtgs || 'minmax(0px, 1fr)'};\n grid-template-rows: ${mtgs || 'auto'};\n `;\n }\n if (isSpanParent) {\n return `\n -ms-grid-rows: repeat(${rows}, 1fr);\n grid-template-rows: repeat(${rows}, 1fr);`;\n }\n return '';\n }}\n`;\n"],
|
|
5
|
+
"mappings": "AAAA;ACEA;AAEO,MAAM,aAAa;AAAA,IACtB,CAAC,EAAE,cAAc,MAAM,YAAY;AACnC,MAAI,CAAC;AAAc,WAAO;AAC1B,MAAI,OAAO,SAAS,UAAU;AAC5B,QAAI,OAAO;AACX,WAAO,KAAK,MAAM,OAAO,QAAQ,CAAC,QAAQ;AACxC,UAAI,KAAK,QAAQ,MAAM,YAAY,MAAM;AACvC,YAAI,QAAQ,SAAS;AACnB,kBAAQ;AAAA,yCACqB,KAAK;AAAA,qCACT,KAAK;AAAA;AAAA,eAEzB;AACL,kBAAQ,sBAAsB,MA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
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-grid",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0-alpha.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Grid",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"build": "node ../../scripts/build/build.js"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@elliemae/ds-system": "2.
|
|
63
|
+
"@elliemae/ds-system": "2.3.0-alpha.2",
|
|
64
64
|
"@xstyled/styled-components": "~3.1.1",
|
|
65
65
|
"react-desc": "~4.1.3"
|
|
66
66
|
},
|
package/types/Grid.d.ts
CHANGED
|
@@ -3,9 +3,9 @@ import React from 'react';
|
|
|
3
3
|
import type { GridPropsT } from './types';
|
|
4
4
|
declare const Grid: React.ForwardRefExoticComponent<GridPropsT & React.RefAttributes<HTMLDivElement>>;
|
|
5
5
|
declare const DSGridWithSchema: {
|
|
6
|
-
(props?:
|
|
6
|
+
(props?: unknown): JSX.Element;
|
|
7
7
|
propTypes: unknown;
|
|
8
8
|
toTypescript: () => import("react-desc").TypescriptSchema;
|
|
9
9
|
};
|
|
10
10
|
export default Grid;
|
|
11
|
-
export { DSGridWithSchema };
|
|
11
|
+
export { DSGridWithSchema, Grid };
|
package/types/index.d.ts
CHANGED
|
@@ -1,5 +1 @@
|
|
|
1
|
-
export { default as
|
|
2
|
-
export { default as GridContainer } from './Grid';
|
|
3
|
-
export { default as GridItem } from './Grid';
|
|
4
|
-
export { DSGridWithSchema } from './Grid';
|
|
5
|
-
export { default } from './Grid';
|
|
1
|
+
export { default, Grid, default as GridContainer, default as GridItem, DSGridWithSchema } from './Grid';
|