@instructure/ui-flex 8.8.1-snapshot.8 → 8.9.1
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 +10 -0
- package/es/Flex/Item/index.js +4 -85
- package/es/Flex/Item/props.js +102 -0
- package/es/Flex/index.js +5 -92
- package/es/Flex/props.js +105 -0
- package/lib/Flex/Item/index.js +4 -85
- package/lib/Flex/Item/props.js +114 -0
- package/lib/Flex/index.js +5 -92
- package/lib/Flex/props.js +117 -0
- package/package.json +10 -11
- package/src/Flex/Item/index.tsx +7 -73
- package/src/Flex/Item/props.ts +137 -0
- package/src/Flex/Item/styles.ts +1 -1
- package/src/Flex/__examples__/Flex.examples.tsx +1 -1
- package/src/Flex/index.tsx +8 -93
- package/src/Flex/props.ts +150 -0
- package/src/Flex/styles.ts +1 -1
- package/src/index.ts +2 -2
- package/types/Flex/Item/index.d.ts +33 -66
- package/types/Flex/Item/index.d.ts.map +1 -1
- package/types/Flex/Item/props.d.ts +27 -0
- package/types/Flex/Item/props.d.ts.map +1 -0
- package/types/Flex/Item/styles.d.ts +1 -1
- package/types/Flex/__examples__/Flex.examples.d.ts +1 -1
- package/types/Flex/index.d.ts +33 -75
- package/types/Flex/index.d.ts.map +1 -1
- package/types/Flex/props.d.ts +27 -0
- package/types/Flex/props.d.ts.map +1 -0
- package/types/Flex/styles.d.ts +1 -1
- package/types/index.d.ts +2 -2
- package/LICENSE.md +0 -27
- package/es/Flex/Item/types.js +0 -1
- package/es/Flex/types.js +0 -1
- package/lib/Flex/Item/types.js +0 -1
- package/lib/Flex/types.js +0 -1
- package/src/Flex/Item/types.ts +0 -44
- package/src/Flex/types.ts +0 -45
- package/types/Flex/Item/types.d.ts +0 -20
- package/types/Flex/Item/types.d.ts.map +0 -1
- package/types/Flex/types.d.ts +0 -21
- package/types/Flex/types.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [8.9.1](https://github.com/instructure/instructure-ui/compare/v8.9.0...v8.9.1) (2021-09-16)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-flex
|
|
9
|
+
|
|
10
|
+
# [8.9.0](https://github.com/instructure/instructure-ui/compare/v8.8.0...v8.9.0) (2021-09-15)
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- fix shared-types TS errors ([7b83164](https://github.com/instructure/instructure-ui/commit/7b83164f4c5872f3a217e010563f59bf584ae4fc))
|
|
15
|
+
|
|
6
16
|
# [8.8.0](https://github.com/instructure/instructure-ui/compare/v8.7.0...v8.8.0) (2021-08-27)
|
|
7
17
|
|
|
8
18
|
**Note:** Version bump only for package @instructure/ui-flex
|
package/es/Flex/Item/index.js
CHANGED
|
@@ -26,11 +26,11 @@ var _dec, _class, _class2, _temp;
|
|
|
26
26
|
|
|
27
27
|
/** @jsx jsx */
|
|
28
28
|
import { Component } from 'react';
|
|
29
|
-
import PropTypes from 'prop-types';
|
|
30
29
|
import { omitProps } from '@instructure/ui-react-utils';
|
|
31
30
|
import { View } from '@instructure/ui-view';
|
|
32
|
-
import { withStyle, jsx
|
|
31
|
+
import { withStyle, jsx } from '@instructure/emotion';
|
|
33
32
|
import generateStyle from './styles';
|
|
33
|
+
import { propTypes, allowedProps } from './props';
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
---
|
|
@@ -46,8 +46,6 @@ let Item = (_dec = withStyle(generateStyle), _dec(_class = (_temp = _class2 = cl
|
|
|
46
46
|
componentDidUpdate() {
|
|
47
47
|
this.props.makeStyles();
|
|
48
48
|
}
|
|
49
|
-
/* eslint-disable react/require-default-props */
|
|
50
|
-
|
|
51
49
|
|
|
52
50
|
render() {
|
|
53
51
|
const props = omitProps(this.props, Item.propTypes);
|
|
@@ -67,7 +65,7 @@ let Item = (_dec = withStyle(generateStyle), _dec(_class = (_temp = _class2 = cl
|
|
|
67
65
|
const dirColumn = direction === 'column';
|
|
68
66
|
const dirRow = direction === 'row';
|
|
69
67
|
return jsx(View, Object.assign({}, props, {
|
|
70
|
-
css: styles.flexItem,
|
|
68
|
+
css: styles === null || styles === void 0 ? void 0 : styles.flexItem,
|
|
71
69
|
elementRef: elementRef,
|
|
72
70
|
as: as,
|
|
73
71
|
minHeight: dirColumn ? size : void 0,
|
|
@@ -81,86 +79,7 @@ let Item = (_dec = withStyle(generateStyle), _dec(_class = (_temp = _class2 = cl
|
|
|
81
79
|
}), children);
|
|
82
80
|
}
|
|
83
81
|
|
|
84
|
-
}, _class2.displayName = "Item", _class2.componentId = 'Flex.Item', _class2.propTypes = {
|
|
85
|
-
// eslint-disable-next-line react/require-default-props
|
|
86
|
-
makeStyles: PropTypes.func,
|
|
87
|
-
// eslint-disable-next-line react/require-default-props
|
|
88
|
-
styles: PropTypes.object,
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* The children to render inside the Item`
|
|
92
|
-
*/
|
|
93
|
-
children: PropTypes.node,
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* the element type to render as
|
|
97
|
-
*/
|
|
98
|
-
as: PropTypes.elementType,
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* provides a reference to the underlying html root element
|
|
102
|
-
*/
|
|
103
|
-
elementRef: PropTypes.func,
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
107
|
-
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
108
|
-
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
109
|
-
*/
|
|
110
|
-
margin: ThemeablePropTypes.spacing,
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Valid values are `0`, `none`, `xxx-small`, `xx-small`, `x-small`,
|
|
114
|
-
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
115
|
-
* familiar CSS-like shorthand. For example: `padding="small x-large large"`.
|
|
116
|
-
*/
|
|
117
|
-
padding: ThemeablePropTypes.spacing,
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* overrides the parent Flex's alignItems prop, if needed
|
|
121
|
-
*/
|
|
122
|
-
align: PropTypes.oneOf(['center', 'start', 'end', 'stretch']),
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Inherits from the parent Flex component
|
|
126
|
-
*/
|
|
127
|
-
direction: PropTypes.oneOf(['row', 'column']),
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Designates the text alignment inside the Item
|
|
131
|
-
*/
|
|
132
|
-
textAlign: PropTypes.oneOf(['start', 'center', 'end']),
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Handles horizontal overflow
|
|
136
|
-
*/
|
|
137
|
-
overflowX: PropTypes.oneOf(['auto', 'hidden', 'visible']),
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Handles vertical overflow
|
|
141
|
-
*/
|
|
142
|
-
overflowY: PropTypes.oneOf(['auto', 'hidden', 'visible']),
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Should the FlexItem grow to fill any available space?
|
|
146
|
-
*/
|
|
147
|
-
shouldGrow: PropTypes.bool,
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Should the FlexItem shrink (stopping at its `size`)?
|
|
151
|
-
*/
|
|
152
|
-
shouldShrink: PropTypes.bool,
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Sets the base size of the FlexItem (width if direction is `row`; height if direction is `column`)
|
|
156
|
-
*/
|
|
157
|
-
size: PropTypes.string,
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Places dashed lines around the component's borders to help debug your layout
|
|
161
|
-
*/
|
|
162
|
-
withVisualDebug: PropTypes.bool
|
|
163
|
-
}, _class2.defaultProps = {
|
|
82
|
+
}, _class2.displayName = "Item", _class2.componentId = 'Flex.Item', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
164
83
|
as: 'span',
|
|
165
84
|
elementRef: el => {},
|
|
166
85
|
shouldGrow: false,
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
import PropTypes from 'prop-types';
|
|
25
|
+
import { ThemeablePropTypes } from '@instructure/emotion';
|
|
26
|
+
const propTypes = {
|
|
27
|
+
/**
|
|
28
|
+
* The children to render inside the Item`
|
|
29
|
+
*/
|
|
30
|
+
children: PropTypes.node,
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* the element type to render as
|
|
34
|
+
*/
|
|
35
|
+
as: PropTypes.elementType,
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* provides a reference to the underlying html root element
|
|
39
|
+
*/
|
|
40
|
+
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
|
+
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
|
+
padding: ThemeablePropTypes.spacing,
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* overrides the parent Flex's alignItems prop, if needed
|
|
58
|
+
*/
|
|
59
|
+
align: PropTypes.oneOf(['center', 'start', 'end', 'stretch']),
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Inherits from the parent Flex component
|
|
63
|
+
*/
|
|
64
|
+
direction: PropTypes.oneOf(['row', 'column']),
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Designates the text alignment inside the Item
|
|
68
|
+
*/
|
|
69
|
+
textAlign: PropTypes.oneOf(['start', 'center', 'end']),
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Handles horizontal overflow
|
|
73
|
+
*/
|
|
74
|
+
overflowX: PropTypes.oneOf(['auto', 'hidden', 'visible']),
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Handles vertical overflow
|
|
78
|
+
*/
|
|
79
|
+
overflowY: PropTypes.oneOf(['auto', 'hidden', 'visible']),
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Should the FlexItem grow to fill any available space?
|
|
83
|
+
*/
|
|
84
|
+
shouldGrow: PropTypes.bool,
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Should the FlexItem shrink (stopping at its `size`)?
|
|
88
|
+
*/
|
|
89
|
+
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
|
+
size: PropTypes.string,
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Places dashed lines around the component's borders to help debug your layout
|
|
98
|
+
*/
|
|
99
|
+
withVisualDebug: PropTypes.bool
|
|
100
|
+
};
|
|
101
|
+
const allowedProps = ['children', 'as', 'elementRef', 'margin', 'padding', 'align', 'direction', 'textAlign', 'overflowX', 'overflowY', 'shouldGrow', 'shouldShrink', 'size', 'withVisualDebug'];
|
|
102
|
+
export { propTypes, allowedProps };
|
package/es/Flex/index.js
CHANGED
|
@@ -26,13 +26,13 @@ var _dec, _class, _class2, _temp;
|
|
|
26
26
|
|
|
27
27
|
/** @jsx jsx */
|
|
28
28
|
import { Children, Component } from 'react';
|
|
29
|
-
import PropTypes from 'prop-types';
|
|
30
29
|
import { safeCloneElement, passthroughProps, matchComponentTypes, callRenderProp } from '@instructure/ui-react-utils';
|
|
31
30
|
import { View } from '@instructure/ui-view';
|
|
32
|
-
import { withStyle, jsx
|
|
31
|
+
import { withStyle, jsx } from '@instructure/emotion';
|
|
33
32
|
import { Item } from './Item';
|
|
34
33
|
import generateStyle from './styles';
|
|
35
34
|
import generateComponentTheme from './theme';
|
|
35
|
+
import { propTypes, allowedProps } from './props';
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
---
|
|
@@ -82,7 +82,7 @@ let Flex = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class
|
|
|
82
82
|
|
|
83
83
|
if (children && Children.count(children) > 0) {
|
|
84
84
|
return jsx(View, Object.assign({}, passthroughProps(this.props), {
|
|
85
|
-
css: styles.flex,
|
|
85
|
+
css: styles === null || styles === void 0 ? void 0 : styles.flex,
|
|
86
86
|
elementRef: elementRef,
|
|
87
87
|
as: as,
|
|
88
88
|
display: display,
|
|
@@ -98,88 +98,7 @@ let Flex = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class
|
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
}, _class2.displayName = "Flex", _class2.componentId = 'Flex', _class2.Item = Item, _class2.propTypes = {
|
|
102
|
-
/**
|
|
103
|
-
* It's recommended that you use `Flex.Item` for children, but you can also pass any markup or a function
|
|
104
|
-
* returning markup. Note that if you do not use `Flex.Item`, the `withVisualDebug` and `direction` props
|
|
105
|
-
* will not automatically be set on the children.
|
|
106
|
-
*/
|
|
107
|
-
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* the element type to render as
|
|
111
|
-
*/
|
|
112
|
-
as: PropTypes.elementType,
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* provides a reference to the underlying html root element
|
|
116
|
-
*/
|
|
117
|
-
elementRef: PropTypes.func,
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Sets the height of the component's container (optional)
|
|
121
|
-
*/
|
|
122
|
-
height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Sets the width of the component's container (optional)
|
|
126
|
-
*/
|
|
127
|
-
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
131
|
-
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
132
|
-
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
133
|
-
*/
|
|
134
|
-
margin: ThemeablePropTypes.spacing,
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Valid values are `0`, `none`, `xxx-small`, `xx-small`, `x-small`,
|
|
138
|
-
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
139
|
-
* familiar CSS-like shorthand. For example: `padding="small x-large large"`.
|
|
140
|
-
*/
|
|
141
|
-
padding: ThemeablePropTypes.spacing,
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Sets the CSS display rule for the component's container
|
|
145
|
-
*/
|
|
146
|
-
display: PropTypes.oneOf(['flex', 'inline-flex']),
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* Designates the text alignment
|
|
150
|
-
*/
|
|
151
|
-
textAlign: PropTypes.oneOf(['start', 'center', 'end']),
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* Sets the flex-direction to row (horizontal) or column (vertical)
|
|
155
|
-
*/
|
|
156
|
-
direction: PropTypes.oneOf(['row', 'column', 'row-reverse', 'column-reverse']),
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Aligns Flex.Items on the vertical axis (horizontal if direction is column)
|
|
160
|
-
*/
|
|
161
|
-
alignItems: PropTypes.oneOf(['center', 'start', 'end', 'stretch']),
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* Aligns Flex.Items on the horizontal axis (vertical if direction is column)
|
|
165
|
-
*/
|
|
166
|
-
justifyItems: PropTypes.oneOf(['center', 'start', 'end', 'space-around', 'space-between']),
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* Determines if the Flex.Items should wrap when they exceed their container's width
|
|
170
|
-
*/
|
|
171
|
-
wrap: PropTypes.oneOf(['wrap', 'no-wrap', 'wrap-reverse']),
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Activate a dotted outline around the component to make building your
|
|
175
|
-
* layout easier
|
|
176
|
-
*/
|
|
177
|
-
withVisualDebug: PropTypes.bool,
|
|
178
|
-
// eslint-disable-next-line react/require-default-props
|
|
179
|
-
makeStyles: PropTypes.func,
|
|
180
|
-
// eslint-disable-next-line react/require-default-props
|
|
181
|
-
styles: PropTypes.object
|
|
182
|
-
}, _class2.defaultProps = {
|
|
101
|
+
}, _class2.displayName = "Flex", _class2.componentId = 'Flex', _class2.Item = Item, _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
183
102
|
children: null,
|
|
184
103
|
as: 'span',
|
|
185
104
|
elementRef: el => {},
|
|
@@ -187,13 +106,7 @@ let Flex = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class
|
|
|
187
106
|
justifyItems: 'start',
|
|
188
107
|
display: 'flex',
|
|
189
108
|
withVisualDebug: false,
|
|
190
|
-
wrap: 'no-wrap'
|
|
191
|
-
width: void 0,
|
|
192
|
-
height: void 0,
|
|
193
|
-
padding: void 0,
|
|
194
|
-
margin: void 0,
|
|
195
|
-
alignItems: void 0,
|
|
196
|
-
textAlign: void 0
|
|
109
|
+
wrap: 'no-wrap'
|
|
197
110
|
}, _temp)) || _class);
|
|
198
111
|
export default Flex;
|
|
199
112
|
export { Flex, Item as FlexItem };
|
package/es/Flex/props.js
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
import PropTypes from 'prop-types';
|
|
25
|
+
import { ThemeablePropTypes } from '@instructure/emotion';
|
|
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
|
+
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* the element type to render as
|
|
36
|
+
*/
|
|
37
|
+
as: PropTypes.elementType,
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* provides a reference to the underlying html root element
|
|
41
|
+
*/
|
|
42
|
+
elementRef: PropTypes.func,
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Sets the height of the component's container (optional)
|
|
46
|
+
*/
|
|
47
|
+
height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Sets the width of the component's container (optional)
|
|
51
|
+
*/
|
|
52
|
+
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
|
+
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
|
+
padding: ThemeablePropTypes.spacing,
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Sets the CSS display rule for the component's container
|
|
70
|
+
*/
|
|
71
|
+
display: PropTypes.oneOf(['flex', 'inline-flex']),
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Designates the text alignment
|
|
75
|
+
*/
|
|
76
|
+
textAlign: PropTypes.oneOf(['start', 'center', 'end']),
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Sets the flex-direction to row (horizontal) or column (vertical)
|
|
80
|
+
*/
|
|
81
|
+
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
|
+
alignItems: PropTypes.oneOf(['center', 'start', 'end', 'stretch']),
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Aligns Flex.Items on the horizontal axis (vertical if direction is column)
|
|
90
|
+
*/
|
|
91
|
+
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
|
+
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
|
+
withVisualDebug: PropTypes.bool
|
|
103
|
+
};
|
|
104
|
+
const allowedProps = ['children', 'as', 'elementRef', 'height', 'width', 'margin', 'padding', 'display', 'textAlign', 'direction', 'alignItems', 'justifyItems', 'wrap', 'withVisualDebug'];
|
|
105
|
+
export { propTypes, allowedProps };
|