@elliemae/ds-grid 2.0.0-alpha.1 → 2.0.0-alpha.13
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 +27 -96
- package/cjs/GridItem.js +29 -0
- package/cjs/defaultProps.js +2 -2
- package/cjs/index.js +4 -4
- package/cjs/propTypes.js +46 -0
- package/cjs/types.js +2 -0
- package/cjs/utils/constants.js +11 -0
- package/cjs/utils/styles.js +129 -0
- package/esm/Grid.js +23 -91
- package/esm/GridItem.js +21 -0
- package/esm/defaultProps.js +2 -2
- package/esm/propTypes.js +42 -0
- package/esm/types.js +1 -0
- package/esm/utils/constants.js +5 -0
- package/esm/utils/styles.js +119 -0
- package/package.json +25 -10
- package/types/Grid.d.ts +8 -2
- package/types/GridItem.d.ts +2 -0
- package/types/defaultProps.d.ts +3 -3
- package/types/propTypes.d.ts +135 -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/cjs/ie11.js +0 -32
- package/cjs/package.json +0 -7
- package/cjs/props.js +0 -39
- package/esm/ie11.js +0 -28
- package/esm/package.json +0 -7
- package/esm/props.js +0 -35
- package/types/ie11.d.ts +0 -5
- package/types/props.d.ts +0 -22
package/esm/propTypes.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { PropTypes } from 'react-desc';
|
|
2
|
+
import { alignItemsPlacement, justifyPlacement, wrap } from './utils/constants.js';
|
|
3
|
+
|
|
4
|
+
const rowColBreakpoints = PropTypes.shape({
|
|
5
|
+
small: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),
|
|
6
|
+
medium: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),
|
|
7
|
+
large: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string]))
|
|
8
|
+
});
|
|
9
|
+
const spanBreakpoints = PropTypes.shape({
|
|
10
|
+
small: PropTypes.number,
|
|
11
|
+
medium: PropTypes.number,
|
|
12
|
+
large: PropTypes.number
|
|
13
|
+
});
|
|
14
|
+
const propTypes = {
|
|
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')
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export { propTypes };
|
package/esm/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,5 @@
|
|
|
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 };
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from '@babel/runtime/helpers/esm/taggedTemplateLiteral';
|
|
2
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
4
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
6
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
7
|
+
import { css, mapTemplateGrid } from '@elliemae/ds-system';
|
|
8
|
+
|
|
9
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
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 => {
|
|
21
|
+
if (span[key] && theme.breakpoints[key]) {
|
|
22
|
+
if (key === 'small') {
|
|
23
|
+
data += "\n -ms-grid-column: auto / span ".concat(span[key], ";\n grid-column: auto / span ").concat(span[key], ";\n ");
|
|
24
|
+
} else {
|
|
25
|
+
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 }");
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
return data;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return "\n -ms-grid-column: auto / span ".concat(span, ";\n grid-column: auto / span ").concat(span, ";");
|
|
33
|
+
});
|
|
34
|
+
const manageCols = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", "\n"])), _ref2 => {
|
|
35
|
+
let {
|
|
36
|
+
cols,
|
|
37
|
+
theme,
|
|
38
|
+
isSpanParent
|
|
39
|
+
} = _ref2;
|
|
40
|
+
|
|
41
|
+
if (typeof cols === 'object' && !Array.isArray(cols)) {
|
|
42
|
+
let data = '';
|
|
43
|
+
Object.keys(theme.media).forEach(key => {
|
|
44
|
+
if (cols[key] && Array.isArray(cols[key])) {
|
|
45
|
+
const mtg = mapTemplateGrid(cols[key]).join(' ');
|
|
46
|
+
const mtgs = mapTemplateGrid(cols[key]).map(c => "minmax(0, ".concat(c, ")")).join(' ');
|
|
47
|
+
|
|
48
|
+
if (key === 'small') {
|
|
49
|
+
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', ";");
|
|
50
|
+
} else {
|
|
51
|
+
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 }");
|
|
52
|
+
}
|
|
53
|
+
} else if (isSpanParent) {
|
|
54
|
+
if (key === 'small') {
|
|
55
|
+
data += "-ms-grid-columns: repeat(".concat(cols[key], ", 1fr);\n grid-template-columns: repeat(").concat(cols[key], ", 1fr);");
|
|
56
|
+
} else {
|
|
57
|
+
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 }");
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
return data;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (Array.isArray(cols)) {
|
|
65
|
+
const mtg = mapTemplateGrid(cols).join(' ');
|
|
66
|
+
const mtgs = mapTemplateGrid(cols).map(c => "minmax(0, ".concat(c, ")")).join(' ');
|
|
67
|
+
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 ");
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (isSpanParent) {
|
|
71
|
+
return "\n -ms-grid-columns: repeat(".concat(cols, ", 1fr);\n grid-template-columns: repeat(").concat(cols, ", 1fr);");
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return '';
|
|
75
|
+
});
|
|
76
|
+
const manageRows = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n ", "\n"])), _ref3 => {
|
|
77
|
+
let {
|
|
78
|
+
rows,
|
|
79
|
+
theme,
|
|
80
|
+
isSpanParent
|
|
81
|
+
} = _ref3;
|
|
82
|
+
|
|
83
|
+
if (typeof rows === 'object' && !Array.isArray(rows)) {
|
|
84
|
+
let data = '';
|
|
85
|
+
Object.keys(theme.media).forEach(key => {
|
|
86
|
+
if (rows[key] && Array.isArray(rows[key])) {
|
|
87
|
+
const mtg = mapTemplateGrid(rows[key]).join(' ');
|
|
88
|
+
const mtgs = mapTemplateGrid(rows[key]).map(c => "minmax(0, ".concat(c, ")")).join(' ');
|
|
89
|
+
|
|
90
|
+
if (key === 'small') {
|
|
91
|
+
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', ";");
|
|
92
|
+
} else {
|
|
93
|
+
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 }");
|
|
94
|
+
}
|
|
95
|
+
} else if (isSpanParent) {
|
|
96
|
+
if (key === 'small') {
|
|
97
|
+
data += "-ms-grid-rows: repeat(".concat(rows[key], ", 1fr);\n grid-template-rows: repeat(").concat(rows[key], ", 1fr);");
|
|
98
|
+
} else {
|
|
99
|
+
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 }");
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
return data;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (Array.isArray(rows)) {
|
|
107
|
+
const mtg = mapTemplateGrid(rows).join(' ');
|
|
108
|
+
const mtgs = mapTemplateGrid(rows).map(c => "minmax(0, ".concat(c, ")")).join(' ');
|
|
109
|
+
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 ");
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (isSpanParent) {
|
|
113
|
+
return "\n -ms-grid-rows: repeat(".concat(rows, ", 1fr);\n grid-template-rows: repeat(").concat(rows, ", 1fr);");
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return '';
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
export { manageCols, manageRows, manageSpan };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-grid",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.13",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Grid",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -11,13 +11,25 @@
|
|
|
11
11
|
"import": "./esm/index.js",
|
|
12
12
|
"require": "./cjs/index.js"
|
|
13
13
|
},
|
|
14
|
-
"./
|
|
15
|
-
"import": "./esm/
|
|
16
|
-
"require": "./cjs/
|
|
14
|
+
"./utils/styles": {
|
|
15
|
+
"import": "./esm/utils/styles.js",
|
|
16
|
+
"require": "./cjs/utils/styles.js"
|
|
17
17
|
},
|
|
18
|
-
"./
|
|
19
|
-
"import": "./esm/
|
|
20
|
-
"require": "./cjs/
|
|
18
|
+
"./utils/constants": {
|
|
19
|
+
"import": "./esm/utils/constants.js",
|
|
20
|
+
"require": "./cjs/utils/constants.js"
|
|
21
|
+
},
|
|
22
|
+
"./types": {
|
|
23
|
+
"import": "./esm/types.js",
|
|
24
|
+
"require": "./cjs/types.js"
|
|
25
|
+
},
|
|
26
|
+
"./propTypes": {
|
|
27
|
+
"import": "./esm/propTypes.js",
|
|
28
|
+
"require": "./cjs/propTypes.js"
|
|
29
|
+
},
|
|
30
|
+
"./GridItem": {
|
|
31
|
+
"import": "./esm/GridItem.js",
|
|
32
|
+
"require": "./cjs/GridItem.js"
|
|
21
33
|
},
|
|
22
34
|
"./Grid": {
|
|
23
35
|
"import": "./esm/Grid.js",
|
|
@@ -48,18 +60,21 @@
|
|
|
48
60
|
"build": "node ../../scripts/build/build.js"
|
|
49
61
|
},
|
|
50
62
|
"dependencies": {
|
|
51
|
-
"@elliemae/ds-system": "2.0.0-alpha.
|
|
63
|
+
"@elliemae/ds-system": "2.0.0-alpha.13",
|
|
52
64
|
"react-desc": "~4.1.3"
|
|
53
65
|
},
|
|
54
66
|
"devDependencies": {
|
|
55
|
-
"
|
|
67
|
+
"@testing-library/jest-dom": "~5.15.0",
|
|
68
|
+
"@testing-library/react": "~12.1.2",
|
|
69
|
+
"@testing-library/user-event": "~13.5.0",
|
|
70
|
+
"styled-components": "~5.3.3",
|
|
56
71
|
"styled-system": "~5.1.5"
|
|
57
72
|
},
|
|
58
73
|
"peerDependencies": {
|
|
59
74
|
"lodash": "^4.17.21",
|
|
60
75
|
"react": "^17.0.2",
|
|
61
76
|
"react-dom": "^17.0.2",
|
|
62
|
-
"styled-components": "^5.3.
|
|
77
|
+
"styled-components": "^5.3.3",
|
|
63
78
|
"styled-system": "^5.1.5"
|
|
64
79
|
},
|
|
65
80
|
"publishConfig": {
|
package/types/Grid.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
/// <reference path="../../../../shared/typings/react-desc.d.ts" />
|
|
1
2
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
declare const
|
|
3
|
+
import type { GridPropsT } from './types';
|
|
4
|
+
declare const Grid: React.ForwardRefExoticComponent<GridPropsT & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
declare const DSGridWithSchema: {
|
|
6
|
+
(props?: (GridPropsT & React.RefAttributes<HTMLDivElement>) | undefined): JSX.Element;
|
|
7
|
+
propTypes: unknown;
|
|
8
|
+
toTypescript: () => import("react-desc").TypescriptSchema;
|
|
9
|
+
};
|
|
4
10
|
export default Grid;
|
|
5
11
|
export { DSGridWithSchema };
|
package/types/defaultProps.d.ts
CHANGED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/// <reference path="../../../../shared/typings/react-desc.d.ts" />
|
|
2
|
+
export declare const propTypes: {
|
|
3
|
+
rows: {
|
|
4
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
5
|
+
};
|
|
6
|
+
cols: {
|
|
7
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
8
|
+
};
|
|
9
|
+
span: {
|
|
10
|
+
defaultValue<T = unknown>(arg: T): {
|
|
11
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
12
|
+
};
|
|
13
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
14
|
+
};
|
|
15
|
+
alignItems: {
|
|
16
|
+
defaultValue<T = unknown>(arg: T): {
|
|
17
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
18
|
+
};
|
|
19
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
20
|
+
};
|
|
21
|
+
children: {
|
|
22
|
+
defaultValue<T = unknown>(arg: T): {
|
|
23
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
24
|
+
};
|
|
25
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
26
|
+
};
|
|
27
|
+
className: {
|
|
28
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
29
|
+
};
|
|
30
|
+
justifyContent: {
|
|
31
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
32
|
+
};
|
|
33
|
+
gutter: {
|
|
34
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
35
|
+
};
|
|
36
|
+
wrap: {
|
|
37
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
38
|
+
};
|
|
39
|
+
height: {
|
|
40
|
+
defaultValue<T = unknown>(arg: T): {
|
|
41
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
42
|
+
};
|
|
43
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
44
|
+
};
|
|
45
|
+
width: {
|
|
46
|
+
defaultValue<T = unknown>(arg: T): {
|
|
47
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
48
|
+
};
|
|
49
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
50
|
+
};
|
|
51
|
+
p: {
|
|
52
|
+
defaultValue<T = unknown>(arg: T): {
|
|
53
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
54
|
+
};
|
|
55
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
56
|
+
};
|
|
57
|
+
m: {
|
|
58
|
+
defaultValue<T = unknown>(arg: T): {
|
|
59
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
60
|
+
};
|
|
61
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
62
|
+
};
|
|
63
|
+
px: {
|
|
64
|
+
defaultValue<T = unknown>(arg: T): {
|
|
65
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
66
|
+
};
|
|
67
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
68
|
+
};
|
|
69
|
+
mx: {
|
|
70
|
+
defaultValue<T = unknown>(arg: T): {
|
|
71
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
72
|
+
};
|
|
73
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
74
|
+
};
|
|
75
|
+
py: {
|
|
76
|
+
defaultValue<T = unknown>(arg: T): {
|
|
77
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
78
|
+
};
|
|
79
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
80
|
+
};
|
|
81
|
+
my: {
|
|
82
|
+
defaultValue<T = unknown>(arg: T): {
|
|
83
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
84
|
+
};
|
|
85
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
86
|
+
};
|
|
87
|
+
ml: {
|
|
88
|
+
defaultValue<T = unknown>(arg: T): {
|
|
89
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
90
|
+
};
|
|
91
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
92
|
+
};
|
|
93
|
+
mr: {
|
|
94
|
+
defaultValue<T = unknown>(arg: T): {
|
|
95
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
96
|
+
};
|
|
97
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
98
|
+
};
|
|
99
|
+
mt: {
|
|
100
|
+
defaultValue<T = unknown>(arg: T): {
|
|
101
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
102
|
+
};
|
|
103
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
104
|
+
};
|
|
105
|
+
mb: {
|
|
106
|
+
defaultValue<T = unknown>(arg: T): {
|
|
107
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
108
|
+
};
|
|
109
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
110
|
+
};
|
|
111
|
+
pl: {
|
|
112
|
+
defaultValue<T = unknown>(arg: T): {
|
|
113
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
114
|
+
};
|
|
115
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
116
|
+
};
|
|
117
|
+
pr: {
|
|
118
|
+
defaultValue<T = unknown>(arg: T): {
|
|
119
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
120
|
+
};
|
|
121
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
122
|
+
};
|
|
123
|
+
pt: {
|
|
124
|
+
defaultValue<T = unknown>(arg: T): {
|
|
125
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
126
|
+
};
|
|
127
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
128
|
+
};
|
|
129
|
+
pb: {
|
|
130
|
+
defaultValue<T = unknown>(arg: T): {
|
|
131
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
132
|
+
};
|
|
133
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
134
|
+
};
|
|
135
|
+
};
|
package/types/types.d.ts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { alignItemsPlacement, justifyPlacement, wrap } from './utils/constants';
|
|
3
|
+
interface RowColBreakpoints {
|
|
4
|
+
small?: string | number[];
|
|
5
|
+
medium?: string | number[];
|
|
6
|
+
large?: string | number[];
|
|
7
|
+
}
|
|
8
|
+
interface SpanBreakpoints {
|
|
9
|
+
small?: number;
|
|
10
|
+
medium?: number;
|
|
11
|
+
large?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface GridPropsT {
|
|
14
|
+
height?: string;
|
|
15
|
+
width?: string;
|
|
16
|
+
rows?: string[] | string | number[] | RowColBreakpoints;
|
|
17
|
+
cols?: string[] | string | number[] | RowColBreakpoints;
|
|
18
|
+
justifyContent?: typeof justifyPlacement[number];
|
|
19
|
+
alignItems?: typeof alignItemsPlacement[number];
|
|
20
|
+
children?: React.ReactNode;
|
|
21
|
+
className?: string;
|
|
22
|
+
justify?: typeof justifyPlacement[number];
|
|
23
|
+
gutter?: string | number;
|
|
24
|
+
wrap?: typeof wrap[number];
|
|
25
|
+
span?: number;
|
|
26
|
+
p?: string | number;
|
|
27
|
+
m?: string | number;
|
|
28
|
+
px?: string | number;
|
|
29
|
+
mx?: string | number;
|
|
30
|
+
py?: string | number;
|
|
31
|
+
my?: string | number;
|
|
32
|
+
ml?: string | number;
|
|
33
|
+
mr?: string | number;
|
|
34
|
+
mt?: string | number;
|
|
35
|
+
mb?: string | number;
|
|
36
|
+
pl?: string | number;
|
|
37
|
+
pr?: string | number;
|
|
38
|
+
pt?: string | number;
|
|
39
|
+
pb?: string | number;
|
|
40
|
+
}
|
|
41
|
+
export interface GridPropsWithDefaultT {
|
|
42
|
+
rows: string | number[] | RowColBreakpoints;
|
|
43
|
+
cols: string | number[] | RowColBreakpoints;
|
|
44
|
+
alignItems: typeof alignItemsPlacement[number];
|
|
45
|
+
children?: React.ReactNode;
|
|
46
|
+
className: string;
|
|
47
|
+
justify: typeof justifyPlacement[number];
|
|
48
|
+
gutter: string | number;
|
|
49
|
+
wrap: typeof wrap[number];
|
|
50
|
+
span: number | SpanBreakpoints;
|
|
51
|
+
}
|
|
52
|
+
export interface GridItemPropsT {
|
|
53
|
+
rows: string | number[] | RowColBreakpoints;
|
|
54
|
+
cols: string | number[] | RowColBreakpoints;
|
|
55
|
+
alignItems: typeof alignItemsPlacement[number];
|
|
56
|
+
children: React.ReactElement[];
|
|
57
|
+
className: string;
|
|
58
|
+
justify: typeof justifyPlacement[number];
|
|
59
|
+
gutter: string | number;
|
|
60
|
+
wrap: typeof wrap[number];
|
|
61
|
+
childNumber: number;
|
|
62
|
+
isSpanParent: boolean;
|
|
63
|
+
span?: number | SpanBreakpoints;
|
|
64
|
+
ref: React.ForwardedRef<HTMLDivElement>;
|
|
65
|
+
}
|
|
66
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const justifyPlacement: readonly ["flex-start", "center", "flex-end", "space-between", "space-around", "space-evenly"];
|
|
2
|
+
export declare const alignItemsPlacement: readonly ["flex-start", "center", "flex-end", "stretch", "baseline"];
|
|
3
|
+
export declare const wrap: readonly ["wrap", "nowrap", "wrap-reverse"];
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const manageSpan: import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<import("styled-components").DefaultTheme>>;
|
|
2
|
+
export declare const manageCols: import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<import("styled-components").DefaultTheme>>;
|
|
3
|
+
export declare const manageRows: import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<import("styled-components").DefaultTheme>>;
|
package/cjs/ie11.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var lodash = require('lodash');
|
|
6
|
-
|
|
7
|
-
// m x n items (rows and cols simultaneously)
|
|
8
|
-
|
|
9
|
-
function positionIE11Grid({
|
|
10
|
-
rows,
|
|
11
|
-
cols,
|
|
12
|
-
childNumber
|
|
13
|
-
}) {
|
|
14
|
-
let css = '';
|
|
15
|
-
|
|
16
|
-
if (Array.isArray(rows) && rows.length === 0 || !rows) {
|
|
17
|
-
for (let x = 0; x <= childNumber; x++) {
|
|
18
|
-
// :nth-child() doesn't work in ie11
|
|
19
|
-
css = css.concat(`& > div ${lodash.repeat('+ div ', x)}{ -ms-grid-column: ${x + 1}; } `);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if (Array.isArray(cols) && cols.length === 0 || !cols) {
|
|
24
|
-
for (let x = 0; x <= childNumber; x++) {
|
|
25
|
-
css = css.concat(`& > div ${lodash.repeat('+ div ', x)}{ -ms-grid-row: ${x + 1}; } `);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return css;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
exports.positionIE11Grid = positionIE11Grid;
|
package/cjs/package.json
DELETED
package/cjs/props.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var reactDesc = require('react-desc');
|
|
6
|
-
|
|
7
|
-
const gridProps = {
|
|
8
|
-
/** Row layout cells */
|
|
9
|
-
rows: reactDesc.PropTypes.arrayOf(reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.number, reactDesc.PropTypes.string])).description('Row layout cells'),
|
|
10
|
-
|
|
11
|
-
/** Column layout cells */
|
|
12
|
-
cols: reactDesc.PropTypes.arrayOf(reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.number, reactDesc.PropTypes.string])).description('Column layout cells'),
|
|
13
|
-
|
|
14
|
-
/** Grid span */
|
|
15
|
-
span: reactDesc.PropTypes.number.description('Grid span'),
|
|
16
|
-
|
|
17
|
-
/** flex-like align items prop */
|
|
18
|
-
alignItems: reactDesc.PropTypes.oneOf(['flex-start', 'center', 'flex-end', 'stretch', 'baseline']).description('flex-like align items prop'),
|
|
19
|
-
|
|
20
|
-
/** Children node inside grid cell */
|
|
21
|
-
children: reactDesc.PropTypes.node.description('Children node inside grid cell'),
|
|
22
|
-
|
|
23
|
-
/** CSS class */
|
|
24
|
-
className: reactDesc.PropTypes.string.description('CSS class'),
|
|
25
|
-
|
|
26
|
-
/** flex-like direction prop */
|
|
27
|
-
direction: reactDesc.PropTypes.oneOf(['row', 'row-reverse', 'column', 'column-reverse']).description('flex-like direction prop'),
|
|
28
|
-
|
|
29
|
-
/** flex-like justify prop */
|
|
30
|
-
justify: reactDesc.PropTypes.oneOf(['flex-start', 'center', 'flex-end', 'space-between', 'space-around', 'space-evenly']).description('flex-like justify prop'),
|
|
31
|
-
|
|
32
|
-
/** Space between cells prop */
|
|
33
|
-
gutter: reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.number, reactDesc.PropTypes.string]).description('Space between cells prop'),
|
|
34
|
-
|
|
35
|
-
/** Wrap type */
|
|
36
|
-
wrap: reactDesc.PropTypes.oneOf(['nowrap', 'wrap', 'wrap-reverse']).description('Wrap type')
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
exports.gridProps = gridProps;
|
package/esm/ie11.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { repeat } from 'lodash';
|
|
2
|
-
|
|
3
|
-
// m x n items (rows and cols simultaneously)
|
|
4
|
-
|
|
5
|
-
function positionIE11Grid({
|
|
6
|
-
rows,
|
|
7
|
-
cols,
|
|
8
|
-
childNumber
|
|
9
|
-
}) {
|
|
10
|
-
let css = '';
|
|
11
|
-
|
|
12
|
-
if (Array.isArray(rows) && rows.length === 0 || !rows) {
|
|
13
|
-
for (let x = 0; x <= childNumber; x++) {
|
|
14
|
-
// :nth-child() doesn't work in ie11
|
|
15
|
-
css = css.concat(`& > div ${repeat('+ div ', x)}{ -ms-grid-column: ${x + 1}; } `);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
if (Array.isArray(cols) && cols.length === 0 || !cols) {
|
|
20
|
-
for (let x = 0; x <= childNumber; x++) {
|
|
21
|
-
css = css.concat(`& > div ${repeat('+ div ', x)}{ -ms-grid-row: ${x + 1}; } `);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return css;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export { positionIE11Grid };
|
package/esm/package.json
DELETED
package/esm/props.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { PropTypes } from 'react-desc';
|
|
2
|
-
|
|
3
|
-
const gridProps = {
|
|
4
|
-
/** Row layout cells */
|
|
5
|
-
rows: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])).description('Row layout cells'),
|
|
6
|
-
|
|
7
|
-
/** Column layout cells */
|
|
8
|
-
cols: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])).description('Column layout cells'),
|
|
9
|
-
|
|
10
|
-
/** Grid span */
|
|
11
|
-
span: PropTypes.number.description('Grid span'),
|
|
12
|
-
|
|
13
|
-
/** flex-like align items prop */
|
|
14
|
-
alignItems: PropTypes.oneOf(['flex-start', 'center', 'flex-end', 'stretch', 'baseline']).description('flex-like align items prop'),
|
|
15
|
-
|
|
16
|
-
/** Children node inside grid cell */
|
|
17
|
-
children: PropTypes.node.description('Children node inside grid cell'),
|
|
18
|
-
|
|
19
|
-
/** CSS class */
|
|
20
|
-
className: PropTypes.string.description('CSS class'),
|
|
21
|
-
|
|
22
|
-
/** flex-like direction prop */
|
|
23
|
-
direction: PropTypes.oneOf(['row', 'row-reverse', 'column', 'column-reverse']).description('flex-like direction prop'),
|
|
24
|
-
|
|
25
|
-
/** flex-like justify prop */
|
|
26
|
-
justify: PropTypes.oneOf(['flex-start', 'center', 'flex-end', 'space-between', 'space-around', 'space-evenly']).description('flex-like justify prop'),
|
|
27
|
-
|
|
28
|
-
/** Space between cells prop */
|
|
29
|
-
gutter: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description('Space between cells prop'),
|
|
30
|
-
|
|
31
|
-
/** Wrap type */
|
|
32
|
-
wrap: PropTypes.oneOf(['nowrap', 'wrap', 'wrap-reverse']).description('Wrap type')
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export { gridProps };
|