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