@micromag/element-stack 0.3.423 → 0.3.430
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/assets/css/styles.css +2 -2
- package/es/index.js +1 -2
- package/lib/index.js +27 -38
- package/package.json +9 -3
package/assets/css/styles.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
.micromag-element-stack-spacer-container{-ms-flex-positive:1;flex-grow:1}.micromag-element-stack-spacer-container.micromag-element-stack-spacer-hasSize{-ms-flex-positive:0;flex-grow:0}
|
|
2
|
-
.micromag-element-stack-container{display:-ms-flexbox;display:flex}
|
|
1
|
+
.micromag-element-stack-spacer-container{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1}.micromag-element-stack-spacer-container.micromag-element-stack-spacer-hasSize{-webkit-box-flex:0;-ms-flex-positive:0;flex-grow:0}
|
|
2
|
+
.micromag-element-stack-container{display:-webkit-box;display:-ms-flexbox;display:flex}
|
package/es/index.js
CHANGED
|
@@ -59,14 +59,13 @@ var defaultProps$3 = {
|
|
|
59
59
|
className: null
|
|
60
60
|
};
|
|
61
61
|
function Spacer(_ref) {
|
|
62
|
-
var _ref2;
|
|
63
62
|
var size = _ref.size,
|
|
64
63
|
minSize = _ref.minSize,
|
|
65
64
|
maxSize = _ref.maxSize,
|
|
66
65
|
className = _ref.className;
|
|
67
66
|
var direction = useStackDirection();
|
|
68
67
|
return /*#__PURE__*/React.createElement("div", {
|
|
69
|
-
className: classNames([styles$1.container, (
|
|
68
|
+
className: classNames([styles$1.container, _defineProperty(_defineProperty({}, styles$1.hasSize, size !== null), className, className !== null)]),
|
|
70
69
|
style: {
|
|
71
70
|
width: direction === 'horizontal' ? size : null,
|
|
72
71
|
minWidth: direction === 'horizontal' ? minSize : null,
|
package/lib/index.js
CHANGED
|
@@ -11,18 +11,8 @@ var isString = require('lodash/isString');
|
|
|
11
11
|
var PropTypes = require('prop-types');
|
|
12
12
|
var core = require('@micromag/core');
|
|
13
13
|
|
|
14
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
15
|
-
|
|
16
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
17
|
-
var _toConsumableArray__default = /*#__PURE__*/_interopDefaultLegacy(_toConsumableArray);
|
|
18
|
-
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
19
|
-
var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
20
|
-
var isNumber__default = /*#__PURE__*/_interopDefaultLegacy(isNumber);
|
|
21
|
-
var isString__default = /*#__PURE__*/_interopDefaultLegacy(isString);
|
|
22
|
-
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
23
|
-
|
|
24
14
|
/* eslint-disable react/jsx-props-no-spreading */
|
|
25
|
-
var StackContext = /*#__PURE__*/
|
|
15
|
+
var StackContext = /*#__PURE__*/React.createContext({
|
|
26
16
|
direction: 'horizontal'
|
|
27
17
|
});
|
|
28
18
|
var useStack = function useStack() {
|
|
@@ -34,8 +24,8 @@ var useStackDirection = function useStackDirection() {
|
|
|
34
24
|
return direction;
|
|
35
25
|
};
|
|
36
26
|
var propTypes$4 = {
|
|
37
|
-
children:
|
|
38
|
-
direction:
|
|
27
|
+
children: PropTypes.node.isRequired,
|
|
28
|
+
direction: PropTypes.oneOf(['vertical', 'horizontal'])
|
|
39
29
|
};
|
|
40
30
|
var defaultProps$4 = {
|
|
41
31
|
direction: 'vertical'
|
|
@@ -51,7 +41,7 @@ function StackProvider(_ref) {
|
|
|
51
41
|
direction: direction
|
|
52
42
|
};
|
|
53
43
|
}, [direction]);
|
|
54
|
-
return /*#__PURE__*/
|
|
44
|
+
return /*#__PURE__*/React.createElement(StackContext.Provider, {
|
|
55
45
|
value: value
|
|
56
46
|
}, children);
|
|
57
47
|
}
|
|
@@ -61,10 +51,10 @@ StackProvider.defaultProps = defaultProps$4;
|
|
|
61
51
|
var styles$1 = {"container":"micromag-element-stack-spacer-container","hasSize":"micromag-element-stack-spacer-hasSize"};
|
|
62
52
|
|
|
63
53
|
var propTypes$3 = {
|
|
64
|
-
size:
|
|
65
|
-
minSize:
|
|
66
|
-
maxSize:
|
|
67
|
-
className:
|
|
54
|
+
size: PropTypes.number,
|
|
55
|
+
minSize: PropTypes.number,
|
|
56
|
+
maxSize: PropTypes.number,
|
|
57
|
+
className: PropTypes.string
|
|
68
58
|
};
|
|
69
59
|
var defaultProps$3 = {
|
|
70
60
|
size: null,
|
|
@@ -73,14 +63,13 @@ var defaultProps$3 = {
|
|
|
73
63
|
className: null
|
|
74
64
|
};
|
|
75
65
|
function Spacer(_ref) {
|
|
76
|
-
var _ref2;
|
|
77
66
|
var size = _ref.size,
|
|
78
67
|
minSize = _ref.minSize,
|
|
79
68
|
maxSize = _ref.maxSize,
|
|
80
69
|
className = _ref.className;
|
|
81
70
|
var direction = useStackDirection();
|
|
82
|
-
return /*#__PURE__*/
|
|
83
|
-
className:
|
|
71
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
72
|
+
className: classNames([styles$1.container, _defineProperty(_defineProperty({}, styles$1.hasSize, size !== null), className, className !== null)]),
|
|
84
73
|
style: {
|
|
85
74
|
width: direction === 'horizontal' ? size : null,
|
|
86
75
|
minWidth: direction === 'horizontal' ? minSize : null,
|
|
@@ -101,12 +90,12 @@ var propTypes$2 = {
|
|
|
101
90
|
direction: core.PropTypes.stackDirection,
|
|
102
91
|
align: core.PropTypes.stackAlign,
|
|
103
92
|
spacing: core.PropTypes.stackSpacing,
|
|
104
|
-
reverse:
|
|
105
|
-
size:
|
|
106
|
-
minSize:
|
|
107
|
-
maxSize:
|
|
108
|
-
className:
|
|
109
|
-
children:
|
|
93
|
+
reverse: PropTypes.bool,
|
|
94
|
+
size: PropTypes.number,
|
|
95
|
+
minSize: PropTypes.number,
|
|
96
|
+
maxSize: PropTypes.number,
|
|
97
|
+
className: PropTypes.string,
|
|
98
|
+
children: PropTypes.node
|
|
110
99
|
};
|
|
111
100
|
var defaultProps$2 = {
|
|
112
101
|
direction: 'horizontal',
|
|
@@ -131,13 +120,13 @@ function Stack(_ref) {
|
|
|
131
120
|
children = _ref.children;
|
|
132
121
|
var flexDirection = (direction === 'vertical' ? 'column' : 'row') + (reverse ? '-reverse' : '');
|
|
133
122
|
var alignItems = align === 'center' ? align : "flex-".concat(align);
|
|
134
|
-
var justifyContent =
|
|
135
|
-
var space =
|
|
123
|
+
var justifyContent = isString(spacing) ? "space-".concat(spacing) : null;
|
|
124
|
+
var space = isNumber(spacing) ? spacing : null;
|
|
136
125
|
var lastIndex = children !== null && children.length ? children.length - 1 : null;
|
|
137
|
-
return /*#__PURE__*/
|
|
126
|
+
return /*#__PURE__*/React.createElement(StackProvider, {
|
|
138
127
|
direction: direction
|
|
139
|
-
}, /*#__PURE__*/
|
|
140
|
-
className:
|
|
128
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
129
|
+
className: classNames([styles.container, _defineProperty({}, className, className !== null)]),
|
|
141
130
|
style: {
|
|
142
131
|
flexDirection: flexDirection,
|
|
143
132
|
alignItems: alignItems,
|
|
@@ -149,11 +138,11 @@ function Stack(_ref) {
|
|
|
149
138
|
minHeight: direction === 'vertical' ? minSize : null,
|
|
150
139
|
maxHeight: direction === 'vertical' ? maxSize : null
|
|
151
140
|
}
|
|
152
|
-
},
|
|
153
|
-
return child.type !== Spacer && space !== null && index < lastIndex ? [].concat(
|
|
141
|
+
}, React.Children.toArray(children).reduce(function (allChildren, child, index) {
|
|
142
|
+
return child.type !== Spacer && space !== null && index < lastIndex ? [].concat(_toConsumableArray(allChildren), [child, /*#__PURE__*/React.createElement(Spacer, {
|
|
154
143
|
key: "spacer-".concat(index),
|
|
155
144
|
size: space
|
|
156
|
-
})]) : [].concat(
|
|
145
|
+
})]) : [].concat(_toConsumableArray(allChildren), [child]);
|
|
157
146
|
}, [])));
|
|
158
147
|
}
|
|
159
148
|
Stack.propTypes = propTypes$2;
|
|
@@ -163,7 +152,7 @@ Stack.defaultProps = defaultProps$2;
|
|
|
163
152
|
var propTypes$1 = {};
|
|
164
153
|
var defaultProps$1 = {};
|
|
165
154
|
function HStack(props) {
|
|
166
|
-
return /*#__PURE__*/
|
|
155
|
+
return /*#__PURE__*/React.createElement(Stack, Object.assign({}, props, {
|
|
167
156
|
direction: "horizontal"
|
|
168
157
|
}));
|
|
169
158
|
}
|
|
@@ -174,7 +163,7 @@ HStack.defaultProps = defaultProps$1;
|
|
|
174
163
|
var propTypes = {};
|
|
175
164
|
var defaultProps = {};
|
|
176
165
|
function VStack(props) {
|
|
177
|
-
return /*#__PURE__*/
|
|
166
|
+
return /*#__PURE__*/React.createElement(Stack, Object.assign({}, props, {
|
|
178
167
|
direction: "vertical"
|
|
179
168
|
}));
|
|
180
169
|
}
|
|
@@ -185,6 +174,6 @@ exports.HStack = HStack;
|
|
|
185
174
|
exports.Spacer = Spacer;
|
|
186
175
|
exports.StackProvider = StackProvider;
|
|
187
176
|
exports.VStack = VStack;
|
|
188
|
-
exports
|
|
177
|
+
exports.default = Stack;
|
|
189
178
|
exports.useStack = useStack;
|
|
190
179
|
exports.useStackDirection = useStackDirection;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/element-stack",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.430",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -32,6 +32,12 @@
|
|
|
32
32
|
"license": "ISC",
|
|
33
33
|
"main": "lib/index.js",
|
|
34
34
|
"module": "es/index.js",
|
|
35
|
+
"exports": {
|
|
36
|
+
".": {
|
|
37
|
+
"require": "./lib/index.js",
|
|
38
|
+
"import": "./es/index.js"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
35
41
|
"files": [
|
|
36
42
|
"lib",
|
|
37
43
|
"es",
|
|
@@ -50,7 +56,7 @@
|
|
|
50
56
|
},
|
|
51
57
|
"dependencies": {
|
|
52
58
|
"@babel/runtime": "^7.13.10",
|
|
53
|
-
"@micromag/core": "^0.3.
|
|
59
|
+
"@micromag/core": "^0.3.430",
|
|
54
60
|
"change-case": "^4.1.2",
|
|
55
61
|
"classnames": "^2.2.6",
|
|
56
62
|
"lodash": "^4.17.21",
|
|
@@ -62,5 +68,5 @@
|
|
|
62
68
|
"access": "public",
|
|
63
69
|
"registry": "https://registry.npmjs.org/"
|
|
64
70
|
},
|
|
65
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "da790d76dba9d8e308d9f9c4e51d93a4a0e012a9"
|
|
66
72
|
}
|