@instructure/ui-flex 8.13.0 → 8.13.1-snapshot.10
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/LICENSE.md +27 -0
- package/es/Flex/Item/index.js +19 -15
- package/es/Flex/Item/props.js +0 -59
- package/es/Flex/Item/styles.js +1 -1
- package/es/Flex/index.js +24 -20
- package/es/Flex/props.js +0 -62
- package/lib/Flex/Item/index.js +19 -15
- package/lib/Flex/Item/props.js +0 -59
- package/lib/Flex/Item/styles.js +1 -1
- package/lib/Flex/index.js +26 -20
- package/lib/Flex/props.js +0 -62
- package/package.json +11 -10
- package/src/Flex/Item/index.tsx +3 -6
- package/src/Flex/Item/props.ts +54 -41
- package/src/Flex/Item/styles.ts +1 -2
- package/src/Flex/index.tsx +14 -15
- package/src/Flex/props.ts +66 -50
- package/types/Flex/Item/index.d.ts +1 -1
- package/types/Flex/Item/index.d.ts.map +1 -1
- package/types/Flex/Item/props.d.ts +46 -0
- package/types/Flex/Item/props.d.ts.map +1 -1
- package/types/Flex/Item/styles.d.ts +1 -1
- package/types/Flex/Item/styles.d.ts.map +1 -1
- package/types/Flex/index.d.ts +8 -19
- package/types/Flex/index.d.ts.map +1 -1
- package/types/Flex/props.d.ts +53 -2
- package/types/Flex/props.d.ts.map +1 -1
package/LICENSE.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: The MIT License (MIT)
|
|
3
|
+
category: Getting Started
|
|
4
|
+
order: 9
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# The MIT License (MIT)
|
|
8
|
+
|
|
9
|
+
Copyright (c) 2015 Instructure, Inc.
|
|
10
|
+
|
|
11
|
+
**Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
in the Software without restriction, including without limitation the rights
|
|
14
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
furnished to do so, subject to the following conditions.**
|
|
17
|
+
|
|
18
|
+
The above copyright notice and this permission notice shall be included in all
|
|
19
|
+
copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
+
SOFTWARE.
|
package/es/Flex/Item/index.js
CHANGED
|
@@ -37,6 +37,7 @@ import { propTypes, allowedProps } from './props';
|
|
|
37
37
|
parent: Flex
|
|
38
38
|
id: Flex.Item
|
|
39
39
|
---
|
|
40
|
+
@tsProps
|
|
40
41
|
**/
|
|
41
42
|
let Item = (_dec = withStyle(generateStyle, null), _dec(_class = (_temp = _class2 = class Item extends Component {
|
|
42
43
|
constructor() {
|
|
@@ -54,27 +55,31 @@ let Item = (_dec = withStyle(generateStyle, null), _dec(_class = (_temp = _class
|
|
|
54
55
|
}
|
|
55
56
|
|
|
56
57
|
componentDidMount() {
|
|
57
|
-
|
|
58
|
+
var _this$props$makeStyle, _this$props;
|
|
59
|
+
|
|
60
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
58
61
|
}
|
|
59
62
|
|
|
60
63
|
componentDidUpdate() {
|
|
61
|
-
|
|
64
|
+
var _this$props$makeStyle2, _this$props2;
|
|
65
|
+
|
|
66
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
62
67
|
}
|
|
63
68
|
|
|
64
69
|
render() {
|
|
65
70
|
const props = omitProps(this.props, Item.allowedProps);
|
|
66
|
-
const _this$
|
|
67
|
-
as = _this$
|
|
68
|
-
children = _this$
|
|
69
|
-
withVisualDebug = _this$
|
|
70
|
-
textAlign = _this$
|
|
71
|
-
size = _this$
|
|
72
|
-
direction = _this$
|
|
73
|
-
margin = _this$
|
|
74
|
-
padding = _this$
|
|
75
|
-
overflowX = _this$
|
|
76
|
-
overflowY = _this$
|
|
77
|
-
styles = _this$
|
|
71
|
+
const _this$props3 = this.props,
|
|
72
|
+
as = _this$props3.as,
|
|
73
|
+
children = _this$props3.children,
|
|
74
|
+
withVisualDebug = _this$props3.withVisualDebug,
|
|
75
|
+
textAlign = _this$props3.textAlign,
|
|
76
|
+
size = _this$props3.size,
|
|
77
|
+
direction = _this$props3.direction,
|
|
78
|
+
margin = _this$props3.margin,
|
|
79
|
+
padding = _this$props3.padding,
|
|
80
|
+
overflowX = _this$props3.overflowX,
|
|
81
|
+
overflowY = _this$props3.overflowY,
|
|
82
|
+
styles = _this$props3.styles;
|
|
78
83
|
const dirColumn = direction === 'column';
|
|
79
84
|
const dirRow = direction === 'row';
|
|
80
85
|
return jsx(View, Object.assign({}, props, {
|
|
@@ -94,7 +99,6 @@ let Item = (_dec = withStyle(generateStyle, null), _dec(_class = (_temp = _class
|
|
|
94
99
|
|
|
95
100
|
}, _class2.displayName = "Item", _class2.componentId = 'Flex.Item', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
96
101
|
as: 'span',
|
|
97
|
-
elementRef: el => {},
|
|
98
102
|
shouldGrow: false,
|
|
99
103
|
shouldShrink: false
|
|
100
104
|
}, _temp)) || _class);
|
package/es/Flex/Item/props.js
CHANGED
|
@@ -24,78 +24,19 @@
|
|
|
24
24
|
import PropTypes from 'prop-types';
|
|
25
25
|
import { ThemeablePropTypes } from '@instructure/emotion';
|
|
26
26
|
const propTypes = {
|
|
27
|
-
/**
|
|
28
|
-
* The children to render inside the Item`
|
|
29
|
-
*/
|
|
30
27
|
children: PropTypes.node,
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* the element type to render as
|
|
34
|
-
*/
|
|
35
28
|
as: PropTypes.elementType,
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* provides a reference to the underlying html root element
|
|
39
|
-
*/
|
|
40
29
|
elementRef: PropTypes.func,
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
44
|
-
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
45
|
-
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
46
|
-
*/
|
|
47
30
|
margin: ThemeablePropTypes.spacing,
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Valid values are `0`, `none`, `xxx-small`, `xx-small`, `x-small`,
|
|
51
|
-
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
52
|
-
* familiar CSS-like shorthand. For example: `padding="small x-large large"`.
|
|
53
|
-
*/
|
|
54
31
|
padding: ThemeablePropTypes.spacing,
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* overrides the parent Flex's alignItems prop, if needed
|
|
58
|
-
*/
|
|
59
32
|
align: PropTypes.oneOf(['center', 'start', 'end', 'stretch']),
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Inherits from the parent Flex component
|
|
63
|
-
*/
|
|
64
33
|
direction: PropTypes.oneOf(['row', 'column']),
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Designates the text alignment inside the Item
|
|
68
|
-
*/
|
|
69
34
|
textAlign: PropTypes.oneOf(['start', 'center', 'end']),
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Handles horizontal overflow
|
|
73
|
-
*/
|
|
74
35
|
overflowX: PropTypes.oneOf(['auto', 'hidden', 'visible']),
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Handles vertical overflow
|
|
78
|
-
*/
|
|
79
36
|
overflowY: PropTypes.oneOf(['auto', 'hidden', 'visible']),
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Should the FlexItem grow to fill any available space?
|
|
83
|
-
*/
|
|
84
37
|
shouldGrow: PropTypes.bool,
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Should the FlexItem shrink (stopping at its `size`)?
|
|
88
|
-
*/
|
|
89
38
|
shouldShrink: PropTypes.bool,
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Sets the base size of the FlexItem (width if direction is `row`; height if direction is `column`)
|
|
93
|
-
*/
|
|
94
39
|
size: PropTypes.string,
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Places dashed lines around the component's borders to help debug your layout
|
|
98
|
-
*/
|
|
99
40
|
withVisualDebug: PropTypes.bool
|
|
100
41
|
};
|
|
101
42
|
const allowedProps = ['children', 'as', 'elementRef', 'margin', 'padding', 'align', 'direction', 'textAlign', 'overflowX', 'overflowY', 'shouldGrow', 'shouldShrink', 'size', 'withVisualDebug'];
|
package/es/Flex/Item/styles.js
CHANGED
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
* @param {Object} state the state of the component, the style is applied to
|
|
33
33
|
* @return {Object} The final style object, which will be used in the component
|
|
34
34
|
*/
|
|
35
|
-
const generateStyle = (
|
|
35
|
+
const generateStyle = (_componentTheme, props) => {
|
|
36
36
|
const shouldGrow = props.shouldGrow,
|
|
37
37
|
shouldShrink = props.shouldShrink,
|
|
38
38
|
align = props.align,
|
package/es/Flex/index.js
CHANGED
|
@@ -25,7 +25,7 @@ var _dec, _class, _class2, _temp;
|
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
27
|
/** @jsx jsx */
|
|
28
|
-
import { Children, Component } from 'react';
|
|
28
|
+
import React, { Children, Component } from 'react';
|
|
29
29
|
import { safeCloneElement, passthroughProps, matchComponentTypes, callRenderProp } from '@instructure/ui-react-utils';
|
|
30
30
|
import { View } from '@instructure/ui-view';
|
|
31
31
|
import { withStyle, jsx } from '@instructure/emotion';
|
|
@@ -39,10 +39,11 @@ import { propTypes, allowedProps } from './props';
|
|
|
39
39
|
category: components
|
|
40
40
|
---
|
|
41
41
|
@module Flex
|
|
42
|
+
@tsProps
|
|
42
43
|
**/
|
|
43
44
|
let Flex = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = class Flex extends Component {
|
|
44
|
-
constructor(
|
|
45
|
-
super(
|
|
45
|
+
constructor() {
|
|
46
|
+
super(...arguments);
|
|
46
47
|
this.ref = null;
|
|
47
48
|
|
|
48
49
|
this.handleRef = el => {
|
|
@@ -53,12 +54,18 @@ let Flex = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class
|
|
|
53
54
|
elementRef(el);
|
|
54
55
|
}
|
|
55
56
|
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
componentDidMount() {
|
|
60
|
+
var _this$props$makeStyle, _this$props;
|
|
56
61
|
|
|
57
|
-
props.makeStyles();
|
|
62
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
58
63
|
}
|
|
59
64
|
|
|
60
65
|
componentDidUpdate() {
|
|
61
|
-
|
|
66
|
+
var _this$props$makeStyle2, _this$props2;
|
|
67
|
+
|
|
68
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
62
69
|
}
|
|
63
70
|
|
|
64
71
|
renderChildren(children) {
|
|
@@ -68,26 +75,25 @@ let Flex = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class
|
|
|
68
75
|
}
|
|
69
76
|
|
|
70
77
|
return matchComponentTypes(child, ['Item']) ? safeCloneElement(child, {
|
|
78
|
+
// child withVisualDebug prop should override parent
|
|
71
79
|
withVisualDebug: this.props.withVisualDebug,
|
|
72
|
-
...child.props
|
|
73
|
-
/* child withVisualDebug prop should override parent */
|
|
74
|
-
,
|
|
80
|
+
...child.props,
|
|
75
81
|
direction: this.props.direction.replace(/-reverse/, '')
|
|
76
82
|
}) : child;
|
|
77
83
|
});
|
|
78
84
|
}
|
|
79
85
|
|
|
80
86
|
render() {
|
|
81
|
-
const _this$
|
|
82
|
-
as = _this$
|
|
83
|
-
withVisualDebug = _this$
|
|
84
|
-
height = _this$
|
|
85
|
-
display = _this$
|
|
86
|
-
margin = _this$
|
|
87
|
-
padding = _this$
|
|
88
|
-
textAlign = _this$
|
|
89
|
-
width = _this$
|
|
90
|
-
styles = _this$
|
|
87
|
+
const _this$props3 = this.props,
|
|
88
|
+
as = _this$props3.as,
|
|
89
|
+
withVisualDebug = _this$props3.withVisualDebug,
|
|
90
|
+
height = _this$props3.height,
|
|
91
|
+
display = _this$props3.display,
|
|
92
|
+
margin = _this$props3.margin,
|
|
93
|
+
padding = _this$props3.padding,
|
|
94
|
+
textAlign = _this$props3.textAlign,
|
|
95
|
+
width = _this$props3.width,
|
|
96
|
+
styles = _this$props3.styles;
|
|
91
97
|
const children = callRenderProp(this.props.children);
|
|
92
98
|
|
|
93
99
|
if (children && Children.count(children) > 0) {
|
|
@@ -109,9 +115,7 @@ let Flex = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class
|
|
|
109
115
|
}
|
|
110
116
|
|
|
111
117
|
}, _class2.displayName = "Flex", _class2.componentId = 'Flex', _class2.Item = Item, _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
112
|
-
children: null,
|
|
113
118
|
as: 'span',
|
|
114
|
-
elementRef: el => {},
|
|
115
119
|
direction: 'row',
|
|
116
120
|
justifyItems: 'start',
|
|
117
121
|
display: 'flex',
|
package/es/Flex/props.js
CHANGED
|
@@ -24,81 +24,19 @@
|
|
|
24
24
|
import PropTypes from 'prop-types';
|
|
25
25
|
import { ThemeablePropTypes } from '@instructure/emotion';
|
|
26
26
|
const propTypes = {
|
|
27
|
-
/**
|
|
28
|
-
* It's recommended that you use `Flex.Item` for children, but you can also pass any markup or a function
|
|
29
|
-
* returning markup. Note that if you do not use `Flex.Item`, the `withVisualDebug` and `direction` props
|
|
30
|
-
* will not automatically be set on the children.
|
|
31
|
-
*/
|
|
32
27
|
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* the element type to render as
|
|
36
|
-
*/
|
|
37
28
|
as: PropTypes.elementType,
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* provides a reference to the underlying html root element
|
|
41
|
-
*/
|
|
42
29
|
elementRef: PropTypes.func,
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Sets the height of the component's container (optional)
|
|
46
|
-
*/
|
|
47
30
|
height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Sets the width of the component's container (optional)
|
|
51
|
-
*/
|
|
52
31
|
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
56
|
-
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
57
|
-
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
58
|
-
*/
|
|
59
32
|
margin: ThemeablePropTypes.spacing,
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Valid values are `0`, `none`, `xxx-small`, `xx-small`, `x-small`,
|
|
63
|
-
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
64
|
-
* familiar CSS-like shorthand. For example: `padding="small x-large large"`.
|
|
65
|
-
*/
|
|
66
33
|
padding: ThemeablePropTypes.spacing,
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Sets the CSS display rule for the component's container
|
|
70
|
-
*/
|
|
71
34
|
display: PropTypes.oneOf(['flex', 'inline-flex']),
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Designates the text alignment
|
|
75
|
-
*/
|
|
76
35
|
textAlign: PropTypes.oneOf(['start', 'center', 'end']),
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Sets the flex-direction to row (horizontal) or column (vertical)
|
|
80
|
-
*/
|
|
81
36
|
direction: PropTypes.oneOf(['row', 'column', 'row-reverse', 'column-reverse']),
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Aligns Flex.Items on the vertical axis (horizontal if direction is column)
|
|
85
|
-
*/
|
|
86
37
|
alignItems: PropTypes.oneOf(['center', 'start', 'end', 'stretch']),
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Aligns Flex.Items on the horizontal axis (vertical if direction is column)
|
|
90
|
-
*/
|
|
91
38
|
justifyItems: PropTypes.oneOf(['center', 'start', 'end', 'space-around', 'space-between']),
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Determines if the Flex.Items should wrap when they exceed their container's width
|
|
95
|
-
*/
|
|
96
39
|
wrap: PropTypes.oneOf(['wrap', 'no-wrap', 'wrap-reverse']),
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Activate a dotted outline around the component to make building your
|
|
100
|
-
* layout easier
|
|
101
|
-
*/
|
|
102
40
|
withVisualDebug: PropTypes.bool
|
|
103
41
|
};
|
|
104
42
|
const allowedProps = ['children', 'as', 'elementRef', 'height', 'width', 'margin', 'padding', 'display', 'textAlign', 'direction', 'alignItems', 'justifyItems', 'wrap', 'withVisualDebug'];
|
package/lib/Flex/Item/index.js
CHANGED
|
@@ -26,6 +26,7 @@ var _dec, _class, _class2, _temp;
|
|
|
26
26
|
parent: Flex
|
|
27
27
|
id: Flex.Item
|
|
28
28
|
---
|
|
29
|
+
@tsProps
|
|
29
30
|
**/
|
|
30
31
|
let Item = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec(_class = (_temp = _class2 = class Item extends _react.Component {
|
|
31
32
|
constructor() {
|
|
@@ -43,27 +44,31 @@ let Item = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec(_class =
|
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
componentDidMount() {
|
|
46
|
-
|
|
47
|
+
var _this$props$makeStyle, _this$props;
|
|
48
|
+
|
|
49
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
47
50
|
}
|
|
48
51
|
|
|
49
52
|
componentDidUpdate() {
|
|
50
|
-
|
|
53
|
+
var _this$props$makeStyle2, _this$props2;
|
|
54
|
+
|
|
55
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
51
56
|
}
|
|
52
57
|
|
|
53
58
|
render() {
|
|
54
59
|
const props = (0, _omitProps.omitProps)(this.props, Item.allowedProps);
|
|
55
|
-
const _this$
|
|
56
|
-
as = _this$
|
|
57
|
-
children = _this$
|
|
58
|
-
withVisualDebug = _this$
|
|
59
|
-
textAlign = _this$
|
|
60
|
-
size = _this$
|
|
61
|
-
direction = _this$
|
|
62
|
-
margin = _this$
|
|
63
|
-
padding = _this$
|
|
64
|
-
overflowX = _this$
|
|
65
|
-
overflowY = _this$
|
|
66
|
-
styles = _this$
|
|
60
|
+
const _this$props3 = this.props,
|
|
61
|
+
as = _this$props3.as,
|
|
62
|
+
children = _this$props3.children,
|
|
63
|
+
withVisualDebug = _this$props3.withVisualDebug,
|
|
64
|
+
textAlign = _this$props3.textAlign,
|
|
65
|
+
size = _this$props3.size,
|
|
66
|
+
direction = _this$props3.direction,
|
|
67
|
+
margin = _this$props3.margin,
|
|
68
|
+
padding = _this$props3.padding,
|
|
69
|
+
overflowX = _this$props3.overflowX,
|
|
70
|
+
overflowY = _this$props3.overflowY,
|
|
71
|
+
styles = _this$props3.styles;
|
|
67
72
|
const dirColumn = direction === 'column';
|
|
68
73
|
const dirRow = direction === 'row';
|
|
69
74
|
return (0, _emotion.jsx)(_View.View, Object.assign({}, props, {
|
|
@@ -83,7 +88,6 @@ let Item = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec(_class =
|
|
|
83
88
|
|
|
84
89
|
}, _class2.displayName = "Item", _class2.componentId = 'Flex.Item', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
|
|
85
90
|
as: 'span',
|
|
86
|
-
elementRef: el => {},
|
|
87
91
|
shouldGrow: false,
|
|
88
92
|
shouldShrink: false
|
|
89
93
|
}, _temp)) || _class);
|
package/lib/Flex/Item/props.js
CHANGED
|
@@ -35,78 +35,19 @@ var _emotion = require("@instructure/emotion");
|
|
|
35
35
|
* SOFTWARE.
|
|
36
36
|
*/
|
|
37
37
|
const propTypes = {
|
|
38
|
-
/**
|
|
39
|
-
* The children to render inside the Item`
|
|
40
|
-
*/
|
|
41
38
|
children: _propTypes.default.node,
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* the element type to render as
|
|
45
|
-
*/
|
|
46
39
|
as: _propTypes.default.elementType,
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* provides a reference to the underlying html root element
|
|
50
|
-
*/
|
|
51
40
|
elementRef: _propTypes.default.func,
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
55
|
-
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
56
|
-
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
57
|
-
*/
|
|
58
41
|
margin: _emotion.ThemeablePropTypes.spacing,
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Valid values are `0`, `none`, `xxx-small`, `xx-small`, `x-small`,
|
|
62
|
-
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
63
|
-
* familiar CSS-like shorthand. For example: `padding="small x-large large"`.
|
|
64
|
-
*/
|
|
65
42
|
padding: _emotion.ThemeablePropTypes.spacing,
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* overrides the parent Flex's alignItems prop, if needed
|
|
69
|
-
*/
|
|
70
43
|
align: _propTypes.default.oneOf(['center', 'start', 'end', 'stretch']),
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Inherits from the parent Flex component
|
|
74
|
-
*/
|
|
75
44
|
direction: _propTypes.default.oneOf(['row', 'column']),
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Designates the text alignment inside the Item
|
|
79
|
-
*/
|
|
80
45
|
textAlign: _propTypes.default.oneOf(['start', 'center', 'end']),
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Handles horizontal overflow
|
|
84
|
-
*/
|
|
85
46
|
overflowX: _propTypes.default.oneOf(['auto', 'hidden', 'visible']),
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Handles vertical overflow
|
|
89
|
-
*/
|
|
90
47
|
overflowY: _propTypes.default.oneOf(['auto', 'hidden', 'visible']),
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Should the FlexItem grow to fill any available space?
|
|
94
|
-
*/
|
|
95
48
|
shouldGrow: _propTypes.default.bool,
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Should the FlexItem shrink (stopping at its `size`)?
|
|
99
|
-
*/
|
|
100
49
|
shouldShrink: _propTypes.default.bool,
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Sets the base size of the FlexItem (width if direction is `row`; height if direction is `column`)
|
|
104
|
-
*/
|
|
105
50
|
size: _propTypes.default.string,
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Places dashed lines around the component's borders to help debug your layout
|
|
109
|
-
*/
|
|
110
51
|
withVisualDebug: _propTypes.default.bool
|
|
111
52
|
};
|
|
112
53
|
exports.propTypes = propTypes;
|
package/lib/Flex/Item/styles.js
CHANGED
|
@@ -39,7 +39,7 @@ exports.default = void 0;
|
|
|
39
39
|
* @param {Object} state the state of the component, the style is applied to
|
|
40
40
|
* @return {Object} The final style object, which will be used in the component
|
|
41
41
|
*/
|
|
42
|
-
const generateStyle = (
|
|
42
|
+
const generateStyle = (_componentTheme, props) => {
|
|
43
43
|
const shouldGrow = props.shouldGrow,
|
|
44
44
|
shouldShrink = props.shouldShrink,
|
|
45
45
|
align = props.align,
|
package/lib/Flex/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
|
|
3
5
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
6
|
|
|
5
7
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -14,7 +16,7 @@ Object.defineProperty(exports, "FlexItem", {
|
|
|
14
16
|
});
|
|
15
17
|
exports.default = void 0;
|
|
16
18
|
|
|
17
|
-
var _react = require("react");
|
|
19
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
18
20
|
|
|
19
21
|
var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
|
|
20
22
|
|
|
@@ -43,10 +45,11 @@ var _dec, _class, _class2, _temp;
|
|
|
43
45
|
category: components
|
|
44
46
|
---
|
|
45
47
|
@module Flex
|
|
48
|
+
@tsProps
|
|
46
49
|
**/
|
|
47
50
|
let Flex = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_temp = _class2 = class Flex extends _react.Component {
|
|
48
|
-
constructor(
|
|
49
|
-
super(
|
|
51
|
+
constructor() {
|
|
52
|
+
super(...arguments);
|
|
50
53
|
this.ref = null;
|
|
51
54
|
|
|
52
55
|
this.handleRef = el => {
|
|
@@ -57,12 +60,18 @@ let Flex = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
|
|
|
57
60
|
elementRef(el);
|
|
58
61
|
}
|
|
59
62
|
};
|
|
63
|
+
}
|
|
60
64
|
|
|
61
|
-
|
|
65
|
+
componentDidMount() {
|
|
66
|
+
var _this$props$makeStyle, _this$props;
|
|
67
|
+
|
|
68
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
62
69
|
}
|
|
63
70
|
|
|
64
71
|
componentDidUpdate() {
|
|
65
|
-
|
|
72
|
+
var _this$props$makeStyle2, _this$props2;
|
|
73
|
+
|
|
74
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
66
75
|
}
|
|
67
76
|
|
|
68
77
|
renderChildren(children) {
|
|
@@ -72,26 +81,25 @@ let Flex = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
|
|
|
72
81
|
}
|
|
73
82
|
|
|
74
83
|
return (0, _matchComponentTypes.matchComponentTypes)(child, ['Item']) ? (0, _safeCloneElement.safeCloneElement)(child, {
|
|
84
|
+
// child withVisualDebug prop should override parent
|
|
75
85
|
withVisualDebug: this.props.withVisualDebug,
|
|
76
|
-
...child.props
|
|
77
|
-
/* child withVisualDebug prop should override parent */
|
|
78
|
-
,
|
|
86
|
+
...child.props,
|
|
79
87
|
direction: this.props.direction.replace(/-reverse/, '')
|
|
80
88
|
}) : child;
|
|
81
89
|
});
|
|
82
90
|
}
|
|
83
91
|
|
|
84
92
|
render() {
|
|
85
|
-
const _this$
|
|
86
|
-
as = _this$
|
|
87
|
-
withVisualDebug = _this$
|
|
88
|
-
height = _this$
|
|
89
|
-
display = _this$
|
|
90
|
-
margin = _this$
|
|
91
|
-
padding = _this$
|
|
92
|
-
textAlign = _this$
|
|
93
|
-
width = _this$
|
|
94
|
-
styles = _this$
|
|
93
|
+
const _this$props3 = this.props,
|
|
94
|
+
as = _this$props3.as,
|
|
95
|
+
withVisualDebug = _this$props3.withVisualDebug,
|
|
96
|
+
height = _this$props3.height,
|
|
97
|
+
display = _this$props3.display,
|
|
98
|
+
margin = _this$props3.margin,
|
|
99
|
+
padding = _this$props3.padding,
|
|
100
|
+
textAlign = _this$props3.textAlign,
|
|
101
|
+
width = _this$props3.width,
|
|
102
|
+
styles = _this$props3.styles;
|
|
95
103
|
const children = (0, _callRenderProp.callRenderProp)(this.props.children);
|
|
96
104
|
|
|
97
105
|
if (children && _react.Children.count(children) > 0) {
|
|
@@ -113,9 +121,7 @@ let Flex = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
|
|
|
113
121
|
}
|
|
114
122
|
|
|
115
123
|
}, _class2.displayName = "Flex", _class2.componentId = 'Flex', _class2.Item = _Item.Item, _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
|
|
116
|
-
children: null,
|
|
117
124
|
as: 'span',
|
|
118
|
-
elementRef: el => {},
|
|
119
125
|
direction: 'row',
|
|
120
126
|
justifyItems: 'start',
|
|
121
127
|
display: 'flex',
|