@instructure/ui-grid 11.7.3-snapshot-7 → 11.7.3-snapshot-26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -2
- package/es/Grid/v1/index.js +33 -33
- package/es/Grid/v1/styles.js +4 -2
- package/es/Grid/v1/theme.js +7 -5
- package/es/Grid/v2/index.js +33 -33
- package/es/Grid/v2/styles.js +4 -2
- package/es/GridCol/v1/index.js +32 -28
- package/es/GridCol/v1/styles.js +17 -10
- package/es/GridCol/v1/theme.js +7 -5
- package/es/GridCol/v2/index.js +32 -28
- package/es/GridCol/v2/styles.js +17 -10
- package/es/GridRow/v1/index.js +26 -28
- package/es/GridRow/v1/styles.js +9 -7
- package/es/GridRow/v1/theme.js +7 -5
- package/es/GridRow/v2/index.js +26 -28
- package/es/GridRow/v2/styles.js +9 -7
- package/lib/Grid/v1/index.js +33 -33
- package/lib/Grid/v1/styles.js +4 -2
- package/lib/Grid/v1/theme.js +7 -5
- package/lib/Grid/v2/index.js +33 -33
- package/lib/Grid/v2/styles.js +4 -2
- package/lib/GridCol/v1/index.js +32 -28
- package/lib/GridCol/v1/styles.js +17 -10
- package/lib/GridCol/v1/theme.js +7 -5
- package/lib/GridCol/v2/index.js +32 -28
- package/lib/GridCol/v2/styles.js +17 -10
- package/lib/GridRow/v1/index.js +26 -28
- package/lib/GridRow/v1/styles.js +9 -7
- package/lib/GridRow/v1/theme.js +7 -5
- package/lib/GridRow/v2/index.js +26 -28
- package/lib/GridRow/v2/styles.js +9 -7
- package/package.json +11 -11
- package/tsconfig.build.tsbuildinfo +1 -1
package/es/GridRow/v1/theme.js
CHANGED
|
@@ -28,12 +28,14 @@
|
|
|
28
28
|
* @return {Object} The final theme object with the overrides and component variables
|
|
29
29
|
*/
|
|
30
30
|
const generateComponentTheme = theme => {
|
|
31
|
-
const
|
|
32
|
-
|
|
31
|
+
const {
|
|
32
|
+
spacing,
|
|
33
|
+
media
|
|
34
|
+
} = theme;
|
|
33
35
|
const componentVariables = {
|
|
34
|
-
spacingSmall: spacing
|
|
35
|
-
spacingMedium: spacing
|
|
36
|
-
spacingLarge: spacing
|
|
36
|
+
spacingSmall: spacing?.small,
|
|
37
|
+
spacingMedium: spacing?.medium,
|
|
38
|
+
spacingLarge: spacing?.large,
|
|
37
39
|
...media
|
|
38
40
|
};
|
|
39
41
|
return {
|
package/es/GridRow/v2/index.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
const _excluded = ["styles", "makeStyles"],
|
|
3
|
-
_excluded2 = ["styles"];
|
|
4
|
-
var _dec, _class, _GridRow;
|
|
1
|
+
var _dec, _class;
|
|
5
2
|
/*
|
|
6
3
|
* The MIT License (MIT)
|
|
7
4
|
*
|
|
@@ -39,27 +36,30 @@ parent: Grid
|
|
|
39
36
|
id: Grid.Row
|
|
40
37
|
---
|
|
41
38
|
**/
|
|
42
|
-
let GridRow = (_dec = withStyle(generateStyle), _dec(_class =
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
39
|
+
let GridRow = (_dec = withStyle(generateStyle), _dec(_class = class GridRow extends Component {
|
|
40
|
+
static displayName = "GridRow";
|
|
41
|
+
static componentId = 'Grid.Row';
|
|
42
|
+
static allowedProps = allowedProps;
|
|
43
|
+
static defaultProps = {
|
|
44
|
+
children: null,
|
|
45
|
+
isLastRow: false
|
|
46
|
+
};
|
|
47
|
+
ref = null;
|
|
48
|
+
handleRef = el => {
|
|
49
|
+
this.ref = el;
|
|
50
|
+
};
|
|
50
51
|
componentDidMount() {
|
|
51
|
-
|
|
52
|
-
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
52
|
+
this.props.makeStyles?.();
|
|
53
53
|
}
|
|
54
54
|
componentDidUpdate() {
|
|
55
|
-
|
|
56
|
-
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
55
|
+
this.props.makeStyles?.();
|
|
57
56
|
}
|
|
58
57
|
renderChildren() {
|
|
59
|
-
const
|
|
60
|
-
styles
|
|
61
|
-
makeStyles
|
|
62
|
-
props
|
|
58
|
+
const {
|
|
59
|
+
styles,
|
|
60
|
+
makeStyles,
|
|
61
|
+
...props
|
|
62
|
+
} = this.props;
|
|
63
63
|
return Children.map(this.props.children, (child, index) => {
|
|
64
64
|
if (matchComponentTypes(child, [GridCol])) {
|
|
65
65
|
return safeCloneElement(child, {
|
|
@@ -74,20 +74,18 @@ let GridRow = (_dec = withStyle(generateStyle), _dec(_class = (_GridRow = class
|
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
76
|
render() {
|
|
77
|
-
const
|
|
78
|
-
styles
|
|
79
|
-
restProps
|
|
77
|
+
const {
|
|
78
|
+
styles,
|
|
79
|
+
...restProps
|
|
80
|
+
} = this.props;
|
|
80
81
|
const props = omitProps(restProps, GridRow.allowedProps);
|
|
81
82
|
return _jsx("span", {
|
|
82
83
|
...props,
|
|
83
|
-
css: styles
|
|
84
|
+
css: styles?.gridRow,
|
|
84
85
|
ref: this.handleRef,
|
|
85
86
|
children: this.renderChildren()
|
|
86
87
|
});
|
|
87
88
|
}
|
|
88
|
-
}
|
|
89
|
-
children: null,
|
|
90
|
-
isLastRow: false
|
|
91
|
-
}, _GridRow)) || _class);
|
|
89
|
+
}) || _class);
|
|
92
90
|
export default GridRow;
|
|
93
91
|
export { GridRow };
|
package/es/GridRow/v2/styles.js
CHANGED
|
@@ -33,13 +33,15 @@
|
|
|
33
33
|
* @return {Object} The final style object, which will be used in the component
|
|
34
34
|
*/
|
|
35
35
|
const generateStyle = (componentTheme, props) => {
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
const {
|
|
37
|
+
hAlign,
|
|
38
|
+
vAlign,
|
|
39
|
+
rowSpacing,
|
|
40
|
+
colSpacing,
|
|
41
|
+
isLastRow,
|
|
42
|
+
startAt,
|
|
43
|
+
visualDebug
|
|
44
|
+
} = props;
|
|
43
45
|
const getGridRowStyle = () => {
|
|
44
46
|
const hAlignVariants = {
|
|
45
47
|
center: {
|
package/lib/Grid/v1/index.js
CHANGED
|
@@ -18,7 +18,6 @@ Object.defineProperty(exports, "GridRow", {
|
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
20
|
exports.default = void 0;
|
|
21
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
22
21
|
var _react = require("react");
|
|
23
22
|
var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
|
|
24
23
|
var _matchComponentTypes = require("@instructure/ui-react-utils/lib/matchComponentTypes.js");
|
|
@@ -31,9 +30,7 @@ var _styles = _interopRequireDefault(require("./styles"));
|
|
|
31
30
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
32
31
|
var _props = require("./props");
|
|
33
32
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
34
|
-
|
|
35
|
-
_excluded2 = ["styles"];
|
|
36
|
-
var _dec, _class, _Grid;
|
|
33
|
+
var _dec, _class;
|
|
37
34
|
/*
|
|
38
35
|
* The MIT License (MIT)
|
|
39
36
|
*
|
|
@@ -62,27 +59,37 @@ var _dec, _class, _Grid;
|
|
|
62
59
|
category: components
|
|
63
60
|
---
|
|
64
61
|
**/
|
|
65
|
-
let Grid = exports.Grid = (_dec = (0, _emotion.withStyleLegacy)(_styles.default, _theme.default), _dec(_class =
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
62
|
+
let Grid = exports.Grid = (_dec = (0, _emotion.withStyleLegacy)(_styles.default, _theme.default), _dec(_class = class Grid extends _react.Component {
|
|
63
|
+
static displayName = "Grid";
|
|
64
|
+
static componentId = 'Grid';
|
|
65
|
+
static allowedProps = _props.allowedProps;
|
|
66
|
+
static defaultProps = {
|
|
67
|
+
colSpacing: 'medium',
|
|
68
|
+
rowSpacing: 'medium',
|
|
69
|
+
hAlign: 'start',
|
|
70
|
+
startAt: 'small',
|
|
71
|
+
vAlign: 'top',
|
|
72
|
+
visualDebug: false,
|
|
73
|
+
children: null
|
|
74
|
+
};
|
|
75
|
+
static Row = _v.GridRow;
|
|
76
|
+
static Col = _v2.GridCol;
|
|
77
|
+
ref = null;
|
|
78
|
+
handleRef = el => {
|
|
79
|
+
this.ref = el;
|
|
80
|
+
};
|
|
73
81
|
componentDidMount() {
|
|
74
|
-
|
|
75
|
-
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
82
|
+
this.props.makeStyles?.();
|
|
76
83
|
}
|
|
77
84
|
componentDidUpdate() {
|
|
78
|
-
|
|
79
|
-
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
85
|
+
this.props.makeStyles?.();
|
|
80
86
|
}
|
|
81
87
|
renderChildren() {
|
|
82
|
-
const
|
|
83
|
-
styles
|
|
84
|
-
makeStyles
|
|
85
|
-
props
|
|
88
|
+
const {
|
|
89
|
+
styles,
|
|
90
|
+
makeStyles,
|
|
91
|
+
...props
|
|
92
|
+
} = this.props;
|
|
86
93
|
const children = _react.Children.toArray(this.props.children);
|
|
87
94
|
return children.map((child, index) => {
|
|
88
95
|
if ((0, _matchComponentTypes.matchComponentTypes)(child, [_v.GridRow])) {
|
|
@@ -97,24 +104,17 @@ let Grid = exports.Grid = (_dec = (0, _emotion.withStyleLegacy)(_styles.default,
|
|
|
97
104
|
});
|
|
98
105
|
}
|
|
99
106
|
render() {
|
|
100
|
-
const
|
|
101
|
-
styles
|
|
102
|
-
restProps
|
|
107
|
+
const {
|
|
108
|
+
styles,
|
|
109
|
+
...restProps
|
|
110
|
+
} = this.props;
|
|
103
111
|
const props = (0, _omitProps.omitProps)(restProps, Grid.allowedProps);
|
|
104
112
|
return (0, _jsxRuntime.jsx)("span", {
|
|
105
113
|
...props,
|
|
106
|
-
css: styles
|
|
114
|
+
css: styles?.grid,
|
|
107
115
|
ref: this.handleRef,
|
|
108
116
|
children: this.renderChildren()
|
|
109
117
|
});
|
|
110
118
|
}
|
|
111
|
-
}
|
|
112
|
-
colSpacing: 'medium',
|
|
113
|
-
rowSpacing: 'medium',
|
|
114
|
-
hAlign: 'start',
|
|
115
|
-
startAt: 'small',
|
|
116
|
-
vAlign: 'top',
|
|
117
|
-
visualDebug: false,
|
|
118
|
-
children: null
|
|
119
|
-
}, _Grid.Row = _v.GridRow, _Grid.Col = _v2.GridCol, _Grid)) || _class);
|
|
119
|
+
}) || _class);
|
|
120
120
|
var _default = exports.default = Grid;
|
package/lib/Grid/v1/styles.js
CHANGED
|
@@ -39,8 +39,10 @@ exports.default = void 0;
|
|
|
39
39
|
* @return {Object} The final style object, which will be used in the component
|
|
40
40
|
*/
|
|
41
41
|
const generateStyle = (componentTheme, props) => {
|
|
42
|
-
const
|
|
43
|
-
|
|
42
|
+
const {
|
|
43
|
+
startAt,
|
|
44
|
+
visualDebug
|
|
45
|
+
} = props;
|
|
44
46
|
const getStartAtVariants = breakpoint => !!startAt && startAt === breakpoint ? {
|
|
45
47
|
boxSizing: 'border-box'
|
|
46
48
|
} : {};
|
package/lib/Grid/v1/theme.js
CHANGED
|
@@ -34,12 +34,14 @@ exports.default = void 0;
|
|
|
34
34
|
* @return {Object} The final theme object with the overrides and component variables
|
|
35
35
|
*/
|
|
36
36
|
const generateComponentTheme = theme => {
|
|
37
|
-
const
|
|
38
|
-
|
|
37
|
+
const {
|
|
38
|
+
spacing,
|
|
39
|
+
media
|
|
40
|
+
} = theme;
|
|
39
41
|
const componentVariables = {
|
|
40
|
-
spacingSmall: spacing
|
|
41
|
-
spacingMedium: spacing
|
|
42
|
-
spacingLarge: spacing
|
|
42
|
+
spacingSmall: spacing?.small,
|
|
43
|
+
spacingMedium: spacing?.medium,
|
|
44
|
+
spacingLarge: spacing?.large,
|
|
43
45
|
...media
|
|
44
46
|
};
|
|
45
47
|
return {
|
package/lib/Grid/v2/index.js
CHANGED
|
@@ -18,7 +18,6 @@ Object.defineProperty(exports, "GridRow", {
|
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
20
|
exports.default = void 0;
|
|
21
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
22
21
|
var _react = require("react");
|
|
23
22
|
var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
|
|
24
23
|
var _matchComponentTypes = require("@instructure/ui-react-utils/lib/matchComponentTypes.js");
|
|
@@ -30,9 +29,7 @@ var _emotion = require("@instructure/emotion");
|
|
|
30
29
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
31
30
|
var _props = require("./props");
|
|
32
31
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
33
|
-
|
|
34
|
-
_excluded2 = ["styles"];
|
|
35
|
-
var _dec, _class, _Grid;
|
|
32
|
+
var _dec, _class;
|
|
36
33
|
/*
|
|
37
34
|
* The MIT License (MIT)
|
|
38
35
|
*
|
|
@@ -61,27 +58,37 @@ var _dec, _class, _Grid;
|
|
|
61
58
|
category: components
|
|
62
59
|
---
|
|
63
60
|
**/
|
|
64
|
-
let Grid = exports.Grid = (_dec = (0, _emotion.withStyle)(_styles.default), _dec(_class =
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
61
|
+
let Grid = exports.Grid = (_dec = (0, _emotion.withStyle)(_styles.default), _dec(_class = class Grid extends _react.Component {
|
|
62
|
+
static displayName = "Grid";
|
|
63
|
+
static componentId = 'Grid';
|
|
64
|
+
static allowedProps = _props.allowedProps;
|
|
65
|
+
static defaultProps = {
|
|
66
|
+
colSpacing: 'medium',
|
|
67
|
+
rowSpacing: 'medium',
|
|
68
|
+
hAlign: 'start',
|
|
69
|
+
startAt: 'small',
|
|
70
|
+
vAlign: 'top',
|
|
71
|
+
visualDebug: false,
|
|
72
|
+
children: null
|
|
73
|
+
};
|
|
74
|
+
static Row = _v.GridRow;
|
|
75
|
+
static Col = _v2.GridCol;
|
|
76
|
+
ref = null;
|
|
77
|
+
handleRef = el => {
|
|
78
|
+
this.ref = el;
|
|
79
|
+
};
|
|
72
80
|
componentDidMount() {
|
|
73
|
-
|
|
74
|
-
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
81
|
+
this.props.makeStyles?.();
|
|
75
82
|
}
|
|
76
83
|
componentDidUpdate() {
|
|
77
|
-
|
|
78
|
-
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
84
|
+
this.props.makeStyles?.();
|
|
79
85
|
}
|
|
80
86
|
renderChildren() {
|
|
81
|
-
const
|
|
82
|
-
styles
|
|
83
|
-
makeStyles
|
|
84
|
-
props
|
|
87
|
+
const {
|
|
88
|
+
styles,
|
|
89
|
+
makeStyles,
|
|
90
|
+
...props
|
|
91
|
+
} = this.props;
|
|
85
92
|
const children = _react.Children.toArray(this.props.children);
|
|
86
93
|
return children.map((child, index) => {
|
|
87
94
|
if ((0, _matchComponentTypes.matchComponentTypes)(child, [_v.GridRow])) {
|
|
@@ -96,24 +103,17 @@ let Grid = exports.Grid = (_dec = (0, _emotion.withStyle)(_styles.default), _dec
|
|
|
96
103
|
});
|
|
97
104
|
}
|
|
98
105
|
render() {
|
|
99
|
-
const
|
|
100
|
-
styles
|
|
101
|
-
restProps
|
|
106
|
+
const {
|
|
107
|
+
styles,
|
|
108
|
+
...restProps
|
|
109
|
+
} = this.props;
|
|
102
110
|
const props = (0, _omitProps.omitProps)(restProps, Grid.allowedProps);
|
|
103
111
|
return (0, _jsxRuntime.jsx)("span", {
|
|
104
112
|
...props,
|
|
105
|
-
css: styles
|
|
113
|
+
css: styles?.grid,
|
|
106
114
|
ref: this.handleRef,
|
|
107
115
|
children: this.renderChildren()
|
|
108
116
|
});
|
|
109
117
|
}
|
|
110
|
-
}
|
|
111
|
-
colSpacing: 'medium',
|
|
112
|
-
rowSpacing: 'medium',
|
|
113
|
-
hAlign: 'start',
|
|
114
|
-
startAt: 'small',
|
|
115
|
-
vAlign: 'top',
|
|
116
|
-
visualDebug: false,
|
|
117
|
-
children: null
|
|
118
|
-
}, _Grid.Row = _v.GridRow, _Grid.Col = _v2.GridCol, _Grid)) || _class);
|
|
118
|
+
}) || _class);
|
|
119
119
|
var _default = exports.default = Grid;
|
package/lib/Grid/v2/styles.js
CHANGED
|
@@ -39,8 +39,10 @@ exports.default = void 0;
|
|
|
39
39
|
* @return {Object} The final style object, which will be used in the component
|
|
40
40
|
*/
|
|
41
41
|
const generateStyle = (componentTheme, props) => {
|
|
42
|
-
const
|
|
43
|
-
|
|
42
|
+
const {
|
|
43
|
+
startAt,
|
|
44
|
+
visualDebug
|
|
45
|
+
} = props;
|
|
44
46
|
const getStartAtVariants = breakpoint => !!startAt && startAt === breakpoint ? {
|
|
45
47
|
boxSizing: 'border-box'
|
|
46
48
|
} : {};
|
package/lib/GridCol/v1/index.js
CHANGED
|
@@ -13,7 +13,7 @@ var _styles = _interopRequireDefault(require("./styles"));
|
|
|
13
13
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
14
14
|
var _props = require("./props");
|
|
15
15
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
16
|
-
var _dec, _class
|
|
16
|
+
var _dec, _class;
|
|
17
17
|
/*
|
|
18
18
|
* The MIT License (MIT)
|
|
19
19
|
*
|
|
@@ -43,20 +43,30 @@ parent: Grid
|
|
|
43
43
|
id: Grid.Col
|
|
44
44
|
---
|
|
45
45
|
**/
|
|
46
|
-
let GridCol = exports.GridCol = (_dec = (0, _emotion.withStyleLegacy)(_styles.default, _theme.default), _dec(_class =
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
46
|
+
let GridCol = exports.GridCol = (_dec = (0, _emotion.withStyleLegacy)(_styles.default, _theme.default), _dec(_class = class GridCol extends _react.Component {
|
|
47
|
+
static displayName = "GridCol";
|
|
48
|
+
static componentId = 'Grid.Col';
|
|
49
|
+
static allowedProps = _props.allowedProps;
|
|
50
|
+
static defaultProps = {
|
|
51
|
+
textAlign: 'inherit',
|
|
52
|
+
children: null,
|
|
53
|
+
isLastCol: false,
|
|
54
|
+
isLastRow: false
|
|
55
|
+
};
|
|
56
|
+
ref = null;
|
|
57
|
+
handleRef = el => {
|
|
58
|
+
const {
|
|
59
|
+
elementRef
|
|
60
|
+
} = this.props;
|
|
61
|
+
this.ref = el;
|
|
62
|
+
if (typeof elementRef === 'function') {
|
|
63
|
+
elementRef(el);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
58
66
|
widthCheck() {
|
|
59
|
-
const
|
|
67
|
+
const {
|
|
68
|
+
width
|
|
69
|
+
} = this.props;
|
|
60
70
|
let shouldWarn = false;
|
|
61
71
|
if (width) {
|
|
62
72
|
if (typeof width === 'number' && width <= 0) {
|
|
@@ -76,31 +86,25 @@ let GridCol = exports.GridCol = (_dec = (0, _emotion.withStyleLegacy)(_styles.de
|
|
|
76
86
|
}
|
|
77
87
|
}
|
|
78
88
|
componentDidMount() {
|
|
79
|
-
|
|
80
|
-
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
89
|
+
this.props.makeStyles?.();
|
|
81
90
|
this.widthCheck();
|
|
82
91
|
}
|
|
83
92
|
componentDidUpdate() {
|
|
84
|
-
|
|
85
|
-
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
93
|
+
this.props.makeStyles?.();
|
|
86
94
|
this.widthCheck();
|
|
87
95
|
}
|
|
88
96
|
render() {
|
|
89
|
-
const
|
|
90
|
-
children
|
|
91
|
-
styles
|
|
97
|
+
const {
|
|
98
|
+
children,
|
|
99
|
+
styles
|
|
100
|
+
} = this.props;
|
|
92
101
|
const props = (0, _omitProps.omitProps)(this.props, GridCol.allowedProps);
|
|
93
102
|
return (0, _jsxRuntime.jsx)("span", {
|
|
94
103
|
...props,
|
|
95
104
|
ref: this.handleRef,
|
|
96
|
-
css: styles
|
|
105
|
+
css: styles?.gridCol,
|
|
97
106
|
children: children
|
|
98
107
|
});
|
|
99
108
|
}
|
|
100
|
-
}
|
|
101
|
-
textAlign: 'inherit',
|
|
102
|
-
children: null,
|
|
103
|
-
isLastCol: false,
|
|
104
|
-
isLastRow: false
|
|
105
|
-
}, _GridCol)) || _class);
|
|
109
|
+
}) || _class);
|
|
106
110
|
var _default = exports.default = GridCol;
|
package/lib/GridCol/v1/styles.js
CHANGED
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
+
require("core-js/modules/es.array.includes.js");
|
|
7
8
|
/*
|
|
8
9
|
* The MIT License (MIT)
|
|
9
10
|
*
|
|
@@ -39,14 +40,16 @@ exports.default = void 0;
|
|
|
39
40
|
* @return {Object} The final style object, which will be used in the component
|
|
40
41
|
*/
|
|
41
42
|
const generateStyle = (componentTheme, props) => {
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
const {
|
|
44
|
+
vAlign,
|
|
45
|
+
textAlign,
|
|
46
|
+
rowSpacing,
|
|
47
|
+
colSpacing,
|
|
48
|
+
isLastRow,
|
|
49
|
+
isLastCol,
|
|
50
|
+
startAt,
|
|
51
|
+
visualDebug
|
|
52
|
+
} = props;
|
|
50
53
|
const rowSpacingVariants = {
|
|
51
54
|
small: {
|
|
52
55
|
marginBottom: componentTheme.spacingSmall
|
|
@@ -124,7 +127,9 @@ const generateStyle = (componentTheme, props) => {
|
|
|
124
127
|
return enabledBreakpoints().includes(breakpoint);
|
|
125
128
|
};
|
|
126
129
|
const getColSize = breakpoint => {
|
|
127
|
-
let
|
|
130
|
+
let {
|
|
131
|
+
width
|
|
132
|
+
} = props;
|
|
128
133
|
if (!width) return;
|
|
129
134
|
if (width && typeof width === 'object') {
|
|
130
135
|
width = width[breakpoint === 'x-large' ? 'xLarge' : breakpoint];
|
|
@@ -132,7 +137,9 @@ const generateStyle = (componentTheme, props) => {
|
|
|
132
137
|
return width;
|
|
133
138
|
};
|
|
134
139
|
const getColOffset = breakpoint => {
|
|
135
|
-
let
|
|
140
|
+
let {
|
|
141
|
+
offset
|
|
142
|
+
} = props;
|
|
136
143
|
if (!offset) return;
|
|
137
144
|
if (offset && typeof offset === 'object') {
|
|
138
145
|
offset = offset[breakpoint === 'x-large' ? 'xLarge' : breakpoint];
|
package/lib/GridCol/v1/theme.js
CHANGED
|
@@ -34,12 +34,14 @@ exports.default = void 0;
|
|
|
34
34
|
* @return {Object} The final theme object with the overrides and component variables
|
|
35
35
|
*/
|
|
36
36
|
const generateComponentTheme = theme => {
|
|
37
|
-
const
|
|
38
|
-
|
|
37
|
+
const {
|
|
38
|
+
spacing,
|
|
39
|
+
media
|
|
40
|
+
} = theme;
|
|
39
41
|
const componentVariables = {
|
|
40
|
-
spacingSmall: spacing
|
|
41
|
-
spacingMedium: spacing
|
|
42
|
-
spacingLarge: spacing
|
|
42
|
+
spacingSmall: spacing?.small,
|
|
43
|
+
spacingMedium: spacing?.medium,
|
|
44
|
+
spacingLarge: spacing?.large,
|
|
43
45
|
...media
|
|
44
46
|
};
|
|
45
47
|
return {
|
package/lib/GridCol/v2/index.js
CHANGED
|
@@ -12,7 +12,7 @@ var _console = require("@instructure/console");
|
|
|
12
12
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
13
13
|
var _props = require("./props");
|
|
14
14
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
15
|
-
var _dec, _class
|
|
15
|
+
var _dec, _class;
|
|
16
16
|
/*
|
|
17
17
|
* The MIT License (MIT)
|
|
18
18
|
*
|
|
@@ -42,20 +42,30 @@ parent: Grid
|
|
|
42
42
|
id: Grid.Col
|
|
43
43
|
---
|
|
44
44
|
**/
|
|
45
|
-
let GridCol = exports.GridCol = (_dec = (0, _emotion.withStyle)(_styles.default), _dec(_class =
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
45
|
+
let GridCol = exports.GridCol = (_dec = (0, _emotion.withStyle)(_styles.default), _dec(_class = class GridCol extends _react.Component {
|
|
46
|
+
static displayName = "GridCol";
|
|
47
|
+
static componentId = 'Grid.Col';
|
|
48
|
+
static allowedProps = _props.allowedProps;
|
|
49
|
+
static defaultProps = {
|
|
50
|
+
textAlign: 'inherit',
|
|
51
|
+
children: null,
|
|
52
|
+
isLastCol: false,
|
|
53
|
+
isLastRow: false
|
|
54
|
+
};
|
|
55
|
+
ref = null;
|
|
56
|
+
handleRef = el => {
|
|
57
|
+
const {
|
|
58
|
+
elementRef
|
|
59
|
+
} = this.props;
|
|
60
|
+
this.ref = el;
|
|
61
|
+
if (typeof elementRef === 'function') {
|
|
62
|
+
elementRef(el);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
57
65
|
widthCheck() {
|
|
58
|
-
const
|
|
66
|
+
const {
|
|
67
|
+
width
|
|
68
|
+
} = this.props;
|
|
59
69
|
let shouldWarn = false;
|
|
60
70
|
if (width) {
|
|
61
71
|
if (typeof width === 'number' && width <= 0) {
|
|
@@ -75,31 +85,25 @@ let GridCol = exports.GridCol = (_dec = (0, _emotion.withStyle)(_styles.default)
|
|
|
75
85
|
}
|
|
76
86
|
}
|
|
77
87
|
componentDidMount() {
|
|
78
|
-
|
|
79
|
-
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
88
|
+
this.props.makeStyles?.();
|
|
80
89
|
this.widthCheck();
|
|
81
90
|
}
|
|
82
91
|
componentDidUpdate() {
|
|
83
|
-
|
|
84
|
-
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
92
|
+
this.props.makeStyles?.();
|
|
85
93
|
this.widthCheck();
|
|
86
94
|
}
|
|
87
95
|
render() {
|
|
88
|
-
const
|
|
89
|
-
children
|
|
90
|
-
styles
|
|
96
|
+
const {
|
|
97
|
+
children,
|
|
98
|
+
styles
|
|
99
|
+
} = this.props;
|
|
91
100
|
const props = (0, _omitProps.omitProps)(this.props, GridCol.allowedProps);
|
|
92
101
|
return (0, _jsxRuntime.jsx)("span", {
|
|
93
102
|
...props,
|
|
94
103
|
ref: this.handleRef,
|
|
95
|
-
css: styles
|
|
104
|
+
css: styles?.gridCol,
|
|
96
105
|
children: children
|
|
97
106
|
});
|
|
98
107
|
}
|
|
99
|
-
}
|
|
100
|
-
textAlign: 'inherit',
|
|
101
|
-
children: null,
|
|
102
|
-
isLastCol: false,
|
|
103
|
-
isLastRow: false
|
|
104
|
-
}, _GridCol)) || _class);
|
|
108
|
+
}) || _class);
|
|
105
109
|
var _default = exports.default = GridCol;
|