@instructure/ui-flex 11.6.0 → 11.6.1-pr-snapshot-1779894247159
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 +8 -0
- package/{lib/Flex/props.js → babel.config.cjs} +13 -7
- package/package.json +11 -13
- package/lib/Flex/Item/index.js +0 -102
- package/lib/Flex/Item/props.js +0 -31
- package/lib/Flex/Item/styles.js +0 -74
- package/lib/Flex/index.js +0 -135
- package/lib/Flex/styles.js +0 -103
- package/lib/Flex/theme.js +0 -48
- package/lib/index.js +0 -18
- package/lib/package.json +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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
|
+
## [11.6.1-pr-snapshot-1779894247159](https://github.com/instructure/instructure-ui/compare/v11.6.0...v11.6.1-pr-snapshot-1779894247159) (2026-05-27)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-flex
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
# [11.6.0](https://github.com/instructure/instructure-ui/compare/v11.5.0...v11.6.0) (2026-02-18)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @instructure/ui-flex
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.allowedProps = void 0;
|
|
7
1
|
/*
|
|
8
2
|
* The MIT License (MIT)
|
|
9
3
|
*
|
|
@@ -28,4 +22,16 @@ exports.allowedProps = void 0;
|
|
|
28
22
|
* SOFTWARE.
|
|
29
23
|
*/
|
|
30
24
|
|
|
31
|
-
|
|
25
|
+
module.exports = {
|
|
26
|
+
presets: [
|
|
27
|
+
[
|
|
28
|
+
require('@instructure/ui-babel-preset'),
|
|
29
|
+
{
|
|
30
|
+
coverage: Boolean(process.env.COVERAGE),
|
|
31
|
+
esModules: Boolean(process.env.ES_MODULES),
|
|
32
|
+
removeConsole: process.env.NODE_ENV === 'production',
|
|
33
|
+
transformImports: Boolean(process.env.TRANSFORM_IMPORTS)
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
]
|
|
37
|
+
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-flex",
|
|
3
|
-
"version": "11.6.
|
|
3
|
+
"version": "11.6.1-pr-snapshot-1779894247159",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"description": "A component that makes it easy to align content using flexbox CSS",
|
|
5
6
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
7
|
"module": "./es/index.js",
|
|
7
|
-
"main": "./lib/index.js",
|
|
8
8
|
"types": "./types/index.d.ts",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -15,19 +15,19 @@
|
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@babel/runtime": "^7.27.6",
|
|
18
|
-
"@instructure/console": "11.6.
|
|
19
|
-
"@instructure/
|
|
20
|
-
"@instructure/
|
|
21
|
-
"@instructure/ui-react-utils": "11.6.
|
|
22
|
-
"@instructure/ui-view": "11.6.
|
|
18
|
+
"@instructure/console": "11.6.1-pr-snapshot-1779894247159",
|
|
19
|
+
"@instructure/shared-types": "11.6.1-pr-snapshot-1779894247159",
|
|
20
|
+
"@instructure/emotion": "11.6.1-pr-snapshot-1779894247159",
|
|
21
|
+
"@instructure/ui-react-utils": "11.6.1-pr-snapshot-1779894247159",
|
|
22
|
+
"@instructure/ui-view": "11.6.1-pr-snapshot-1779894247159"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@testing-library/jest-dom": "^6.6.3",
|
|
26
26
|
"@testing-library/react": "15.0.7",
|
|
27
27
|
"vitest": "^3.2.2",
|
|
28
|
-
"@instructure/ui-
|
|
29
|
-
"@instructure/ui-
|
|
30
|
-
"@instructure/ui-
|
|
28
|
+
"@instructure/ui-babel-preset": "11.6.1-pr-snapshot-1779894247159",
|
|
29
|
+
"@instructure/ui-themes": "11.6.1-pr-snapshot-1779894247159",
|
|
30
|
+
"@instructure/ui-axe-check": "11.6.1-pr-snapshot-1779894247159"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"react": ">=18 <=19"
|
|
@@ -40,10 +40,8 @@
|
|
|
40
40
|
".": {
|
|
41
41
|
"types": "./types/index.d.ts",
|
|
42
42
|
"import": "./es/index.js",
|
|
43
|
-
"require": "./lib/index.js",
|
|
44
43
|
"default": "./es/index.js"
|
|
45
44
|
},
|
|
46
|
-
"./lib/*": "./lib/*",
|
|
47
45
|
"./es/*": "./es/*",
|
|
48
46
|
"./types/*": "./types/*",
|
|
49
47
|
"./package.json": "./package.json",
|
|
@@ -53,7 +51,7 @@
|
|
|
53
51
|
"lint": "ui-scripts lint",
|
|
54
52
|
"lint:fix": "ui-scripts lint --fix",
|
|
55
53
|
"clean": "ui-scripts clean",
|
|
56
|
-
"build": "ui-scripts build
|
|
54
|
+
"build": "ui-scripts build",
|
|
57
55
|
"build:watch": "pnpm run ts:check -- --watch & ui-scripts build --watch",
|
|
58
56
|
"build:types": "tsc -p tsconfig.build.json",
|
|
59
57
|
"ts:check": "tsc -p tsconfig.build.json --noEmit --emitDeclarationOnly false"
|
package/lib/Flex/Item/index.js
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = exports.Item = void 0;
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
|
|
10
|
-
var _View = require("@instructure/ui-view/lib/View");
|
|
11
|
-
var _emotion = require("@instructure/emotion");
|
|
12
|
-
var _styles = _interopRequireDefault(require("./styles"));
|
|
13
|
-
var _props = require("./props");
|
|
14
|
-
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
15
|
-
var _dec, _class, _Item;
|
|
16
|
-
/*
|
|
17
|
-
* The MIT License (MIT)
|
|
18
|
-
*
|
|
19
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
20
|
-
*
|
|
21
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
22
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
23
|
-
* in the Software without restriction, including without limitation the rights
|
|
24
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
25
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
26
|
-
* furnished to do so, subject to the following conditions:
|
|
27
|
-
*
|
|
28
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
29
|
-
* copies or substantial portions of the Software.
|
|
30
|
-
*
|
|
31
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
32
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
33
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
34
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
35
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
36
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
37
|
-
* SOFTWARE.
|
|
38
|
-
*/
|
|
39
|
-
/**
|
|
40
|
-
---
|
|
41
|
-
parent: Flex
|
|
42
|
-
id: Flex.Item
|
|
43
|
-
---
|
|
44
|
-
**/
|
|
45
|
-
let Item = exports.Item = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec(_class = (_Item = class Item extends _react.Component {
|
|
46
|
-
constructor(...args) {
|
|
47
|
-
super(...args);
|
|
48
|
-
this.ref = null;
|
|
49
|
-
this.handleRef = el => {
|
|
50
|
-
const elementRef = this.props.elementRef;
|
|
51
|
-
this.ref = el;
|
|
52
|
-
if (typeof elementRef === 'function') {
|
|
53
|
-
elementRef(el);
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
componentDidMount() {
|
|
58
|
-
var _this$props$makeStyle, _this$props;
|
|
59
|
-
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
60
|
-
}
|
|
61
|
-
componentDidUpdate() {
|
|
62
|
-
var _this$props$makeStyle2, _this$props2;
|
|
63
|
-
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
64
|
-
}
|
|
65
|
-
render() {
|
|
66
|
-
const props = (0, _omitProps.omitProps)(this.props, Item.allowedProps);
|
|
67
|
-
const _this$props3 = this.props,
|
|
68
|
-
as = _this$props3.as,
|
|
69
|
-
children = _this$props3.children,
|
|
70
|
-
withVisualDebug = _this$props3.withVisualDebug,
|
|
71
|
-
textAlign = _this$props3.textAlign,
|
|
72
|
-
size = _this$props3.size,
|
|
73
|
-
direction = _this$props3.direction,
|
|
74
|
-
margin = _this$props3.margin,
|
|
75
|
-
padding = _this$props3.padding,
|
|
76
|
-
overflowX = _this$props3.overflowX,
|
|
77
|
-
overflowY = _this$props3.overflowY,
|
|
78
|
-
styles = _this$props3.styles;
|
|
79
|
-
const dirColumn = direction === 'column';
|
|
80
|
-
const dirRow = direction === 'row';
|
|
81
|
-
return (0, _jsxRuntime.jsx)(_View.View, {
|
|
82
|
-
...props,
|
|
83
|
-
css: styles === null || styles === void 0 ? void 0 : styles.flexItem,
|
|
84
|
-
elementRef: this.handleRef,
|
|
85
|
-
as: as,
|
|
86
|
-
minHeight: dirColumn ? size : void 0,
|
|
87
|
-
minWidth: dirRow ? size : void 0,
|
|
88
|
-
textAlign: textAlign,
|
|
89
|
-
margin: margin,
|
|
90
|
-
padding: padding,
|
|
91
|
-
overflowX: overflowX,
|
|
92
|
-
overflowY: overflowY || (dirColumn ? 'auto' : 'visible'),
|
|
93
|
-
withVisualDebug: withVisualDebug,
|
|
94
|
-
children: children
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
}, _Item.displayName = "Item", _Item.componentId = 'Flex.Item', _Item.allowedProps = _props.allowedProps, _Item.defaultProps = {
|
|
98
|
-
as: 'span',
|
|
99
|
-
shouldGrow: false,
|
|
100
|
-
shouldShrink: false
|
|
101
|
-
}, _Item)) || _class);
|
|
102
|
-
var _default = exports.default = Item;
|
package/lib/Flex/Item/props.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.allowedProps = void 0;
|
|
7
|
-
/*
|
|
8
|
-
* The MIT License (MIT)
|
|
9
|
-
*
|
|
10
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
11
|
-
*
|
|
12
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
14
|
-
* in the Software without restriction, including without limitation the rights
|
|
15
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
17
|
-
* furnished to do so, subject to the following conditions:
|
|
18
|
-
*
|
|
19
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
20
|
-
* copies or substantial portions of the Software.
|
|
21
|
-
*
|
|
22
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
-
* SOFTWARE.
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
const allowedProps = exports.allowedProps = ['children', 'as', 'elementRef', 'margin', 'padding', 'align', 'direction', 'textAlign', 'overflowX', 'overflowY', 'shouldGrow', 'shouldShrink', 'size', 'withVisualDebug', 'order'];
|
package/lib/Flex/Item/styles.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
/*
|
|
8
|
-
* The MIT License (MIT)
|
|
9
|
-
*
|
|
10
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
11
|
-
*
|
|
12
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
14
|
-
* in the Software without restriction, including without limitation the rights
|
|
15
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
17
|
-
* furnished to do so, subject to the following conditions:
|
|
18
|
-
*
|
|
19
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
20
|
-
* copies or substantial portions of the Software.
|
|
21
|
-
*
|
|
22
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
-
* SOFTWARE.
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* ---
|
|
33
|
-
* private: true
|
|
34
|
-
* ---
|
|
35
|
-
* Generates the style object from the theme and provided additional information
|
|
36
|
-
* @param {Object} componentTheme The theme variable object.
|
|
37
|
-
* @param {Object} props the props of the component, the style is applied to
|
|
38
|
-
* @param {Object} state the state of the component, the style is applied to
|
|
39
|
-
* @return {Object} The final style object, which will be used in the component
|
|
40
|
-
*/
|
|
41
|
-
const generateStyle = (_componentTheme, props) => {
|
|
42
|
-
const shouldGrow = props.shouldGrow,
|
|
43
|
-
shouldShrink = props.shouldShrink,
|
|
44
|
-
align = props.align,
|
|
45
|
-
size = props.size,
|
|
46
|
-
order = props.order;
|
|
47
|
-
const alignSelfValues = {
|
|
48
|
-
start: 'flex-start',
|
|
49
|
-
end: 'flex-end',
|
|
50
|
-
center: 'center',
|
|
51
|
-
stretch: 'stretch'
|
|
52
|
-
};
|
|
53
|
-
return {
|
|
54
|
-
flexItem: {
|
|
55
|
-
label: 'flexItem',
|
|
56
|
-
boxSizing: 'border-box',
|
|
57
|
-
minWidth: '0.0625rem',
|
|
58
|
-
flexBasis: size,
|
|
59
|
-
...(order !== void 0 ? {
|
|
60
|
-
order
|
|
61
|
-
} : {}),
|
|
62
|
-
// initial value is 1, but we want 0 as our default,
|
|
63
|
-
// so users can opt in to shrink like they do grow
|
|
64
|
-
flexShrink: shouldShrink ? 1 : 0,
|
|
65
|
-
...(shouldGrow && {
|
|
66
|
-
flexGrow: 1
|
|
67
|
-
}),
|
|
68
|
-
...(align && {
|
|
69
|
-
alignSelf: alignSelfValues[align]
|
|
70
|
-
})
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
var _default = exports.default = generateStyle;
|
package/lib/Flex/index.js
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.Flex = void 0;
|
|
8
|
-
Object.defineProperty(exports, "FlexItem", {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
get: function () {
|
|
11
|
-
return _Item.Item;
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
exports.default = void 0;
|
|
15
|
-
var _react = require("react");
|
|
16
|
-
var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
|
|
17
|
-
var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
|
|
18
|
-
var _matchComponentTypes = require("@instructure/ui-react-utils/lib/matchComponentTypes.js");
|
|
19
|
-
var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
|
|
20
|
-
var _View = require("@instructure/ui-view/lib/View");
|
|
21
|
-
var _emotion = require("@instructure/emotion");
|
|
22
|
-
var _Item = require("./Item");
|
|
23
|
-
var _styles = _interopRequireDefault(require("./styles"));
|
|
24
|
-
var _theme = _interopRequireDefault(require("./theme"));
|
|
25
|
-
var _props = require("./props");
|
|
26
|
-
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
27
|
-
var _dec, _class, _Flex;
|
|
28
|
-
/*
|
|
29
|
-
* The MIT License (MIT)
|
|
30
|
-
*
|
|
31
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
32
|
-
*
|
|
33
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
34
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
35
|
-
* in the Software without restriction, including without limitation the rights
|
|
36
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
37
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
38
|
-
* furnished to do so, subject to the following conditions:
|
|
39
|
-
*
|
|
40
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
41
|
-
* copies or substantial portions of the Software.
|
|
42
|
-
*
|
|
43
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
44
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
45
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
46
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
47
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
48
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
49
|
-
* SOFTWARE.
|
|
50
|
-
*/
|
|
51
|
-
/**
|
|
52
|
-
---
|
|
53
|
-
category: components
|
|
54
|
-
---
|
|
55
|
-
@module Flex
|
|
56
|
-
**/
|
|
57
|
-
let Flex = exports.Flex = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_Flex = class Flex extends _react.Component {
|
|
58
|
-
constructor(...args) {
|
|
59
|
-
super(...args);
|
|
60
|
-
this.ref = null;
|
|
61
|
-
this.handleRef = el => {
|
|
62
|
-
const elementRef = this.props.elementRef;
|
|
63
|
-
this.ref = el;
|
|
64
|
-
if (typeof elementRef === 'function') {
|
|
65
|
-
elementRef(el);
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
componentDidMount() {
|
|
70
|
-
var _this$props$makeStyle, _this$props;
|
|
71
|
-
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
72
|
-
}
|
|
73
|
-
componentDidUpdate() {
|
|
74
|
-
var _this$props$makeStyle2, _this$props2;
|
|
75
|
-
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
76
|
-
}
|
|
77
|
-
renderChildren(children) {
|
|
78
|
-
// TODO this might fail if children are () => ReactNode
|
|
79
|
-
return _react.Children.map(children, child => {
|
|
80
|
-
if (!child) {
|
|
81
|
-
return null;
|
|
82
|
-
}
|
|
83
|
-
return (0, _matchComponentTypes.matchComponentTypes)(child, ['Item']) ? (0, _safeCloneElement.safeCloneElement)(child, {
|
|
84
|
-
// child withVisualDebug prop should override parent
|
|
85
|
-
withVisualDebug: this.props.withVisualDebug,
|
|
86
|
-
...child.props,
|
|
87
|
-
direction: this.props.direction.replace(/-reverse/, '')
|
|
88
|
-
}) : child;
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
render() {
|
|
92
|
-
const _this$props3 = this.props,
|
|
93
|
-
as = _this$props3.as,
|
|
94
|
-
withVisualDebug = _this$props3.withVisualDebug,
|
|
95
|
-
height = _this$props3.height,
|
|
96
|
-
display = _this$props3.display,
|
|
97
|
-
margin = _this$props3.margin,
|
|
98
|
-
padding = _this$props3.padding,
|
|
99
|
-
textAlign = _this$props3.textAlign,
|
|
100
|
-
width = _this$props3.width,
|
|
101
|
-
styles = _this$props3.styles,
|
|
102
|
-
gap = _this$props3.gap,
|
|
103
|
-
wrap = _this$props3.wrap;
|
|
104
|
-
const children = (0, _callRenderProp.callRenderProp)(this.props.children);
|
|
105
|
-
const gapValuesArray = gap === null || gap === void 0 ? void 0 : gap.split(' ');
|
|
106
|
-
if (gapValuesArray.length > 1 && wrap === 'no-wrap') {}
|
|
107
|
-
if (children && _react.Children.count(children) > 0) {
|
|
108
|
-
return (0, _jsxRuntime.jsx)(_View.View, {
|
|
109
|
-
...(0, _passthroughProps.passthroughProps)(this.props),
|
|
110
|
-
css: styles === null || styles === void 0 ? void 0 : styles.flex,
|
|
111
|
-
elementRef: this.handleRef,
|
|
112
|
-
as: as,
|
|
113
|
-
display: display,
|
|
114
|
-
width: width,
|
|
115
|
-
height: height,
|
|
116
|
-
margin: margin,
|
|
117
|
-
padding: padding,
|
|
118
|
-
textAlign: textAlign,
|
|
119
|
-
withVisualDebug: withVisualDebug,
|
|
120
|
-
children: this.renderChildren(children)
|
|
121
|
-
});
|
|
122
|
-
} else {
|
|
123
|
-
return null;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}, _Flex.displayName = "Flex", _Flex.componentId = 'Flex', _Flex.Item = _Item.Item, _Flex.allowedProps = _props.allowedProps, _Flex.defaultProps = {
|
|
127
|
-
as: 'span',
|
|
128
|
-
direction: 'row',
|
|
129
|
-
justifyItems: 'start',
|
|
130
|
-
display: 'flex',
|
|
131
|
-
withVisualDebug: false,
|
|
132
|
-
wrap: 'no-wrap',
|
|
133
|
-
gap: 'none'
|
|
134
|
-
}, _Flex)) || _class);
|
|
135
|
-
var _default = exports.default = Flex;
|
package/lib/Flex/styles.js
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _emotion = require("@instructure/emotion");
|
|
8
|
-
/*
|
|
9
|
-
* The MIT License (MIT)
|
|
10
|
-
*
|
|
11
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
12
|
-
*
|
|
13
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
14
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
15
|
-
* in the Software without restriction, including without limitation the rights
|
|
16
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
17
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
18
|
-
* furnished to do so, subject to the following conditions:
|
|
19
|
-
*
|
|
20
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
21
|
-
* copies or substantial portions of the Software.
|
|
22
|
-
*
|
|
23
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
24
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
25
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
26
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
27
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
28
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
29
|
-
* SOFTWARE.
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* ---
|
|
34
|
-
* private: true
|
|
35
|
-
* ---
|
|
36
|
-
* Generates the style object from the theme and provided additional information
|
|
37
|
-
* @param {Object} componentTheme The theme variable object.
|
|
38
|
-
* @param {Object} props the props of the component, the style is applied to
|
|
39
|
-
* @param {string} props.justifyItems
|
|
40
|
-
* @param {string} props.direction
|
|
41
|
-
* @param {string} props.alignItems
|
|
42
|
-
* @param {string} props.wrap
|
|
43
|
-
* @param {Object} state the state of the component, the style is applied to
|
|
44
|
-
* @return {Object} The final style object, which will be used in the component
|
|
45
|
-
*/
|
|
46
|
-
|
|
47
|
-
const generateStyle = (componentTheme, props) => {
|
|
48
|
-
const justifyItems = props.justifyItems,
|
|
49
|
-
wrap = props.wrap,
|
|
50
|
-
direction = props.direction,
|
|
51
|
-
gap = props.gap;
|
|
52
|
-
|
|
53
|
-
// align-items css prop
|
|
54
|
-
// When flex direction is row, 'center' is the most useful default because it
|
|
55
|
-
// vertically aligns Items. For column direction, though, we want 'stretch'.
|
|
56
|
-
const alignItems = props.alignItems || (direction === 'column' || direction === 'column-reverse' ? 'stretch' : 'center');
|
|
57
|
-
const alignItemsValues = {
|
|
58
|
-
center: 'center',
|
|
59
|
-
start: 'flex-start',
|
|
60
|
-
end: 'flex-end',
|
|
61
|
-
stretch: 'stretch'
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
// justify-content css prop
|
|
65
|
-
const justifyItemsValues = {
|
|
66
|
-
start: 'flex-start',
|
|
67
|
-
end: 'flex-end',
|
|
68
|
-
center: 'center',
|
|
69
|
-
'space-around': 'space-around',
|
|
70
|
-
'space-between': 'space-between'
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
// wrap css prop
|
|
74
|
-
const wrapValues = {
|
|
75
|
-
wrap: 'wrap',
|
|
76
|
-
'wrap-reverse': 'wrap-reverse',
|
|
77
|
-
'no-wrap': void 0
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
// flex-direction css props
|
|
81
|
-
const flexDirectionValues = {
|
|
82
|
-
column: 'column',
|
|
83
|
-
'column-reverse': 'column-reverse',
|
|
84
|
-
row: 'row',
|
|
85
|
-
'row-reverse': 'row-reverse'
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
// gap css prop
|
|
89
|
-
const getGapValue = (gap, theme) => (0, _emotion.getShorthandPropValue)('Flex', theme, gap, 'gap');
|
|
90
|
-
return {
|
|
91
|
-
flex: {
|
|
92
|
-
label: 'flex',
|
|
93
|
-
fontFamily: componentTheme.fontFamily,
|
|
94
|
-
boxSizing: 'border-box',
|
|
95
|
-
alignItems: alignItemsValues[alignItems],
|
|
96
|
-
justifyContent: justifyItemsValues[justifyItems],
|
|
97
|
-
flexWrap: wrapValues[wrap],
|
|
98
|
-
flexDirection: flexDirectionValues[direction],
|
|
99
|
-
gap: getGapValue(gap, componentTheme)
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
};
|
|
103
|
-
var _default = exports.default = generateStyle;
|
package/lib/Flex/theme.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _emotion = require("@instructure/emotion");
|
|
8
|
-
/*
|
|
9
|
-
* The MIT License (MIT)
|
|
10
|
-
*
|
|
11
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
12
|
-
*
|
|
13
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
14
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
15
|
-
* in the Software without restriction, including without limitation the rights
|
|
16
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
17
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
18
|
-
* furnished to do so, subject to the following conditions:
|
|
19
|
-
*
|
|
20
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
21
|
-
* copies or substantial portions of the Software.
|
|
22
|
-
*
|
|
23
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
24
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
25
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
26
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
27
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
28
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
29
|
-
* SOFTWARE.
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Generates the theme object for the component from the theme and provided additional information
|
|
34
|
-
* @param {Object} theme The actual theme object.
|
|
35
|
-
* @return {Object} The final theme object with the overrides and component variables
|
|
36
|
-
*/
|
|
37
|
-
const generateComponentTheme = theme => {
|
|
38
|
-
const typography = theme.typography,
|
|
39
|
-
spacing = theme.spacing;
|
|
40
|
-
const componentVariables = {
|
|
41
|
-
fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
|
|
42
|
-
...(0, _emotion.makeThemeVars)('gap', spacing)
|
|
43
|
-
};
|
|
44
|
-
return {
|
|
45
|
-
...componentVariables
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
var _default = exports.default = generateComponentTheme;
|
package/lib/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "Flex", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _Flex.Flex;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "FlexItem", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _Flex.FlexItem;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
var _Flex = require("./Flex");
|
package/lib/package.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"type":"commonjs"}
|