@instructure/ui-flex 11.7.3 → 11.7.4-pr-snapshot-1781695314229
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/LICENSE.md +1 -0
- package/{lib/Flex/v1/props.js → babel.config.cjs} +12 -7
- package/es/Flex/v1/Item/index.js +3 -3
- package/es/Flex/v1/index.js +5 -5
- package/es/Flex/v2/Item/index.js +3 -3
- package/es/Flex/v2/index.js +4 -4
- package/es/exports/a.js +2 -1
- package/es/exports/b.js +2 -1
- package/package.json +11 -16
- package/src/Flex/v1/Item/index.tsx +3 -2
- package/src/Flex/v1/index.tsx +5 -4
- package/src/Flex/v2/Item/index.tsx +3 -2
- package/src/Flex/v2/index.tsx +4 -3
- package/src/exports/a.ts +1 -1
- package/src/exports/b.ts +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Flex/v1/Item/index.d.ts +1 -0
- package/types/Flex/v1/Item/index.d.ts.map +1 -1
- package/types/Flex/v1/index.d.ts +2 -1
- package/types/Flex/v1/index.d.ts.map +1 -1
- package/types/Flex/v2/Item/index.d.ts +1 -0
- package/types/Flex/v2/Item/index.d.ts.map +1 -1
- package/types/Flex/v2/index.d.ts +2 -1
- package/types/Flex/v2/index.d.ts.map +1 -1
- package/types/exports/a.d.ts +1 -1
- package/types/exports/a.d.ts.map +1 -1
- package/types/exports/b.d.ts +1 -1
- package/types/exports/b.d.ts.map +1 -1
- package/lib/Flex/v1/Item/index.js +0 -104
- package/lib/Flex/v1/Item/props.js +0 -31
- package/lib/Flex/v1/Item/styles.js +0 -76
- package/lib/Flex/v1/index.js +0 -138
- package/lib/Flex/v1/styles.js +0 -105
- package/lib/Flex/v1/theme.js +0 -50
- package/lib/Flex/v2/Item/index.js +0 -104
- package/lib/Flex/v2/Item/props.js +0 -31
- package/lib/Flex/v2/Item/styles.js +0 -76
- package/lib/Flex/v2/index.js +0 -137
- package/lib/Flex/v2/props.js +0 -31
- package/lib/Flex/v2/styles.js +0 -109
- package/lib/exports/a.js +0 -18
- package/lib/exports/b.js +0 -18
- package/lib/package.json +0 -1
|
@@ -1,104 +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 _latest = require("@instructure/ui-view/latest");
|
|
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;
|
|
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 = class Item extends _react.Component {
|
|
46
|
-
static displayName = "Item";
|
|
47
|
-
static componentId = 'Flex.Item';
|
|
48
|
-
componentDidMount() {
|
|
49
|
-
this.props.makeStyles?.();
|
|
50
|
-
}
|
|
51
|
-
componentDidUpdate() {
|
|
52
|
-
this.props.makeStyles?.();
|
|
53
|
-
}
|
|
54
|
-
static allowedProps = _props.allowedProps;
|
|
55
|
-
static defaultProps = {
|
|
56
|
-
as: 'span',
|
|
57
|
-
shouldGrow: false,
|
|
58
|
-
shouldShrink: false
|
|
59
|
-
};
|
|
60
|
-
ref = null;
|
|
61
|
-
handleRef = el => {
|
|
62
|
-
const {
|
|
63
|
-
elementRef
|
|
64
|
-
} = this.props;
|
|
65
|
-
this.ref = el;
|
|
66
|
-
if (typeof elementRef === 'function') {
|
|
67
|
-
elementRef(el);
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
render() {
|
|
71
|
-
const props = (0, _omitProps.omitProps)(this.props, Item.allowedProps);
|
|
72
|
-
const {
|
|
73
|
-
as,
|
|
74
|
-
children,
|
|
75
|
-
withVisualDebug,
|
|
76
|
-
textAlign,
|
|
77
|
-
size,
|
|
78
|
-
direction,
|
|
79
|
-
margin,
|
|
80
|
-
padding,
|
|
81
|
-
overflowX,
|
|
82
|
-
overflowY,
|
|
83
|
-
styles
|
|
84
|
-
} = this.props;
|
|
85
|
-
const dirColumn = direction === 'column';
|
|
86
|
-
const dirRow = direction === 'row';
|
|
87
|
-
return (0, _jsxRuntime.jsx)(_latest.View, {
|
|
88
|
-
...props,
|
|
89
|
-
css: styles?.flexItem,
|
|
90
|
-
elementRef: this.handleRef,
|
|
91
|
-
as: as,
|
|
92
|
-
minHeight: dirColumn ? size : undefined,
|
|
93
|
-
minWidth: dirRow ? size : undefined,
|
|
94
|
-
textAlign: textAlign,
|
|
95
|
-
margin: margin,
|
|
96
|
-
padding: padding,
|
|
97
|
-
overflowX: overflowX,
|
|
98
|
-
overflowY: overflowY || (dirColumn ? 'auto' : 'visible'),
|
|
99
|
-
withVisualDebug: withVisualDebug,
|
|
100
|
-
children: children
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
}) || _class);
|
|
104
|
-
var _default = exports.default = Item;
|
|
@@ -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'];
|
|
@@ -1,76 +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 {
|
|
43
|
-
shouldGrow,
|
|
44
|
-
shouldShrink,
|
|
45
|
-
align,
|
|
46
|
-
size,
|
|
47
|
-
order
|
|
48
|
-
} = props;
|
|
49
|
-
const alignSelfValues = {
|
|
50
|
-
start: 'flex-start',
|
|
51
|
-
end: 'flex-end',
|
|
52
|
-
center: 'center',
|
|
53
|
-
stretch: 'stretch'
|
|
54
|
-
};
|
|
55
|
-
return {
|
|
56
|
-
flexItem: {
|
|
57
|
-
label: 'flexItem',
|
|
58
|
-
boxSizing: 'border-box',
|
|
59
|
-
minWidth: '0.0625rem',
|
|
60
|
-
flexBasis: size,
|
|
61
|
-
...(order !== undefined ? {
|
|
62
|
-
order
|
|
63
|
-
} : {}),
|
|
64
|
-
// initial value is 1, but we want 0 as our default,
|
|
65
|
-
// so users can opt in to shrink like they do grow
|
|
66
|
-
flexShrink: shouldShrink ? 1 : 0,
|
|
67
|
-
...(shouldGrow && {
|
|
68
|
-
flexGrow: 1
|
|
69
|
-
}),
|
|
70
|
-
...(align && {
|
|
71
|
-
alignSelf: alignSelfValues[align]
|
|
72
|
-
})
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
};
|
|
76
|
-
var _default = exports.default = generateStyle;
|
package/lib/Flex/v2/index.js
DELETED
|
@@ -1,137 +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 _latest = require("@instructure/ui-view/latest");
|
|
21
|
-
var _emotion = require("@instructure/emotion");
|
|
22
|
-
var _Item = require("./Item");
|
|
23
|
-
var _styles = _interopRequireDefault(require("./styles"));
|
|
24
|
-
var _props = require("./props");
|
|
25
|
-
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
26
|
-
var _dec, _class;
|
|
27
|
-
/*
|
|
28
|
-
* The MIT License (MIT)
|
|
29
|
-
*
|
|
30
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
31
|
-
*
|
|
32
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
33
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
34
|
-
* in the Software without restriction, including without limitation the rights
|
|
35
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
36
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
37
|
-
* furnished to do so, subject to the following conditions:
|
|
38
|
-
*
|
|
39
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
40
|
-
* copies or substantial portions of the Software.
|
|
41
|
-
*
|
|
42
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
43
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
44
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
45
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
46
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
47
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
48
|
-
* SOFTWARE.
|
|
49
|
-
*/
|
|
50
|
-
/**
|
|
51
|
-
---
|
|
52
|
-
category: components
|
|
53
|
-
---
|
|
54
|
-
@module Flex
|
|
55
|
-
**/
|
|
56
|
-
let Flex = exports.Flex = (_dec = (0, _emotion.withStyleNew)(_styles.default), _dec(_class = class Flex extends _react.Component {
|
|
57
|
-
static displayName = "Flex";
|
|
58
|
-
static componentId = 'Flex';
|
|
59
|
-
componentDidMount() {
|
|
60
|
-
this.props.makeStyles?.();
|
|
61
|
-
}
|
|
62
|
-
componentDidUpdate() {
|
|
63
|
-
this.props.makeStyles?.();
|
|
64
|
-
}
|
|
65
|
-
static Item = _Item.Item;
|
|
66
|
-
static allowedProps = _props.allowedProps;
|
|
67
|
-
static defaultProps = {
|
|
68
|
-
as: 'span',
|
|
69
|
-
direction: 'row',
|
|
70
|
-
justifyItems: 'start',
|
|
71
|
-
display: 'flex',
|
|
72
|
-
withVisualDebug: false,
|
|
73
|
-
wrap: 'no-wrap',
|
|
74
|
-
gap: 'none'
|
|
75
|
-
};
|
|
76
|
-
ref = null;
|
|
77
|
-
handleRef = el => {
|
|
78
|
-
const {
|
|
79
|
-
elementRef
|
|
80
|
-
} = this.props;
|
|
81
|
-
this.ref = el;
|
|
82
|
-
if (typeof elementRef === 'function') {
|
|
83
|
-
elementRef(el);
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
renderChildren(children) {
|
|
87
|
-
// TODO this might fail if children are () => ReactNode
|
|
88
|
-
return _react.Children.map(children, child => {
|
|
89
|
-
if (!child) {
|
|
90
|
-
return null;
|
|
91
|
-
}
|
|
92
|
-
return (0, _matchComponentTypes.matchComponentTypes)(child, ['Item']) ? (0, _safeCloneElement.safeCloneElement)(child, {
|
|
93
|
-
// child withVisualDebug prop should override parent
|
|
94
|
-
withVisualDebug: this.props.withVisualDebug,
|
|
95
|
-
...child.props,
|
|
96
|
-
direction: this.props.direction.replace(/-reverse/, '')
|
|
97
|
-
}) : child;
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
render() {
|
|
101
|
-
const {
|
|
102
|
-
as,
|
|
103
|
-
withVisualDebug,
|
|
104
|
-
height,
|
|
105
|
-
display,
|
|
106
|
-
margin,
|
|
107
|
-
padding,
|
|
108
|
-
textAlign,
|
|
109
|
-
width,
|
|
110
|
-
styles,
|
|
111
|
-
gap,
|
|
112
|
-
wrap
|
|
113
|
-
} = this.props;
|
|
114
|
-
const children = (0, _callRenderProp.callRenderProp)(this.props.children);
|
|
115
|
-
const gapValuesArray = gap?.split(' ');
|
|
116
|
-
if (gapValuesArray.length > 1 && wrap === 'no-wrap') {}
|
|
117
|
-
if (children && _react.Children.count(children) > 0) {
|
|
118
|
-
return (0, _jsxRuntime.jsx)(_latest.View, {
|
|
119
|
-
...(0, _passthroughProps.passthroughProps)(this.props),
|
|
120
|
-
css: styles?.flex,
|
|
121
|
-
elementRef: this.handleRef,
|
|
122
|
-
as: as,
|
|
123
|
-
display: display,
|
|
124
|
-
width: width,
|
|
125
|
-
height: height,
|
|
126
|
-
margin: margin,
|
|
127
|
-
padding: padding,
|
|
128
|
-
textAlign: textAlign,
|
|
129
|
-
withVisualDebug: withVisualDebug,
|
|
130
|
-
children: this.renderChildren(children)
|
|
131
|
-
});
|
|
132
|
-
} else {
|
|
133
|
-
return null;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}) || _class);
|
|
137
|
-
var _default = exports.default = Flex;
|
package/lib/Flex/v2/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', 'height', 'width', 'margin', 'padding', 'display', 'textAlign', 'direction', 'alignItems', 'justifyItems', 'wrap', 'withVisualDebug'];
|
package/lib/Flex/v2/styles.js
DELETED
|
@@ -1,109 +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, sharedTokens) => {
|
|
48
|
-
const {
|
|
49
|
-
justifyItems,
|
|
50
|
-
wrap,
|
|
51
|
-
direction,
|
|
52
|
-
gap
|
|
53
|
-
} = props;
|
|
54
|
-
|
|
55
|
-
// align-items css prop
|
|
56
|
-
// When flex direction is row, 'center' is the most useful default because it
|
|
57
|
-
// vertically aligns Items. For column direction, though, we want 'stretch'.
|
|
58
|
-
const alignItems = props.alignItems || (direction === 'column' || direction === 'column-reverse' ? 'stretch' : 'center');
|
|
59
|
-
const alignItemsValues = {
|
|
60
|
-
center: 'center',
|
|
61
|
-
start: 'flex-start',
|
|
62
|
-
end: 'flex-end',
|
|
63
|
-
stretch: 'stretch'
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
// justify-content css prop
|
|
67
|
-
const justifyItemsValues = {
|
|
68
|
-
start: 'flex-start',
|
|
69
|
-
end: 'flex-end',
|
|
70
|
-
center: 'center',
|
|
71
|
-
'space-around': 'space-around',
|
|
72
|
-
'space-between': 'space-between'
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
// wrap css prop
|
|
76
|
-
const wrapValues = {
|
|
77
|
-
wrap: 'wrap',
|
|
78
|
-
'wrap-reverse': 'wrap-reverse',
|
|
79
|
-
'no-wrap': undefined
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
// flex-direction css props
|
|
83
|
-
const flexDirectionValues = {
|
|
84
|
-
column: 'column',
|
|
85
|
-
'column-reverse': 'column-reverse',
|
|
86
|
-
row: 'row',
|
|
87
|
-
'row-reverse': 'row-reverse'
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
// gap css prop
|
|
91
|
-
const gapValues = (0, _emotion.makeThemeVars)('gap', {
|
|
92
|
-
...sharedTokens.spacing,
|
|
93
|
-
...sharedTokens.legacy.spacing
|
|
94
|
-
});
|
|
95
|
-
const getGapValue = (gap, values) => (0, _emotion.getShorthandPropValue)('Flex', values, gap, 'gap');
|
|
96
|
-
return {
|
|
97
|
-
flex: {
|
|
98
|
-
label: 'flex',
|
|
99
|
-
fontFamily: componentTheme.fontFamily,
|
|
100
|
-
boxSizing: 'border-box',
|
|
101
|
-
alignItems: alignItemsValues[alignItems],
|
|
102
|
-
justifyContent: justifyItemsValues[justifyItems],
|
|
103
|
-
flexWrap: wrapValues[wrap],
|
|
104
|
-
flexDirection: flexDirectionValues[direction],
|
|
105
|
-
gap: getGapValue(gap, gapValues)
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
};
|
|
109
|
-
var _default = exports.default = generateStyle;
|
package/lib/exports/a.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 _v.Flex;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "FlexItem", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _v.FlexItem;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
var _v = require("../Flex/v1");
|
package/lib/exports/b.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 _v.Flex;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "FlexItem", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _v.FlexItem;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
var _v = require("../Flex/v2");
|
package/lib/package.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"type":"commonjs"}
|