@micromag/element-stack 0.3.311 → 0.3.318
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 +16 -24
- package/lib/index.js +16 -24
- package/package.json +4 -4
package/assets/css/styles.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
.micromag-element-stack-spacer-container{-
|
|
2
|
-
.micromag-element-stack-container{display:-
|
|
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}
|
package/es/index.js
CHANGED
|
@@ -16,8 +16,7 @@ var useStack = function useStack() {
|
|
|
16
16
|
};
|
|
17
17
|
var useStackDirection = function useStackDirection() {
|
|
18
18
|
var _useContext = useContext(StackContext),
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
direction = _useContext.direction;
|
|
21
20
|
return direction;
|
|
22
21
|
};
|
|
23
22
|
var propTypes$4 = {
|
|
@@ -26,11 +25,13 @@ var propTypes$4 = {
|
|
|
26
25
|
};
|
|
27
26
|
var defaultProps$4 = {
|
|
28
27
|
direction: 'vertical'
|
|
29
|
-
};
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
// Note: this is done to avoid excessive renders on the screens that use the context
|
|
30
31
|
|
|
31
32
|
function StackProvider(_ref) {
|
|
32
33
|
var direction = _ref.direction,
|
|
33
|
-
|
|
34
|
+
children = _ref.children;
|
|
34
35
|
var value = useMemo(function () {
|
|
35
36
|
return {
|
|
36
37
|
direction: direction
|
|
@@ -57,14 +58,12 @@ var defaultProps$3 = {
|
|
|
57
58
|
maxSize: null,
|
|
58
59
|
className: null
|
|
59
60
|
};
|
|
60
|
-
|
|
61
61
|
function Spacer(_ref) {
|
|
62
62
|
var _ref2;
|
|
63
|
-
|
|
64
63
|
var size = _ref.size,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
minSize = _ref.minSize,
|
|
65
|
+
maxSize = _ref.maxSize,
|
|
66
|
+
className = _ref.className;
|
|
68
67
|
var direction = useStackDirection();
|
|
69
68
|
return /*#__PURE__*/React.createElement("div", {
|
|
70
69
|
className: classNames([styles$1.container, (_ref2 = {}, _defineProperty(_ref2, styles$1.hasSize, size !== null), _defineProperty(_ref2, className, className !== null), _ref2)]),
|
|
@@ -78,7 +77,6 @@ function Spacer(_ref) {
|
|
|
78
77
|
}
|
|
79
78
|
});
|
|
80
79
|
}
|
|
81
|
-
|
|
82
80
|
Spacer.propTypes = propTypes$3;
|
|
83
81
|
Spacer.defaultProps = defaultProps$3;
|
|
84
82
|
Spacer.withoutTransitionsWrapper = true;
|
|
@@ -107,17 +105,16 @@ var defaultProps$2 = {
|
|
|
107
105
|
className: null,
|
|
108
106
|
children: null
|
|
109
107
|
};
|
|
110
|
-
|
|
111
108
|
function Stack(_ref) {
|
|
112
109
|
var direction = _ref.direction,
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
110
|
+
align = _ref.align,
|
|
111
|
+
spacing = _ref.spacing,
|
|
112
|
+
reverse = _ref.reverse,
|
|
113
|
+
size = _ref.size,
|
|
114
|
+
minSize = _ref.minSize,
|
|
115
|
+
maxSize = _ref.maxSize,
|
|
116
|
+
className = _ref.className,
|
|
117
|
+
children = _ref.children;
|
|
121
118
|
var flexDirection = (direction === 'vertical' ? 'column' : 'row') + (reverse ? '-reverse' : '');
|
|
122
119
|
var alignItems = align === 'center' ? align : "flex-".concat(align);
|
|
123
120
|
var justifyContent = isString(spacing) ? "space-".concat(spacing) : null;
|
|
@@ -145,33 +142,28 @@ function Stack(_ref) {
|
|
|
145
142
|
})]) : [].concat(_toConsumableArray(allChildren), [child]);
|
|
146
143
|
}, [])));
|
|
147
144
|
}
|
|
148
|
-
|
|
149
145
|
Stack.propTypes = propTypes$2;
|
|
150
146
|
Stack.defaultProps = defaultProps$2;
|
|
151
147
|
|
|
152
148
|
/* eslint-disable react/jsx-props-no-spreading */
|
|
153
149
|
var propTypes$1 = {};
|
|
154
150
|
var defaultProps$1 = {};
|
|
155
|
-
|
|
156
151
|
function HStack(props) {
|
|
157
152
|
return /*#__PURE__*/React.createElement(Stack, Object.assign({}, props, {
|
|
158
153
|
direction: "horizontal"
|
|
159
154
|
}));
|
|
160
155
|
}
|
|
161
|
-
|
|
162
156
|
HStack.propTypes = propTypes$1;
|
|
163
157
|
HStack.defaultProps = defaultProps$1;
|
|
164
158
|
|
|
165
159
|
/* eslint-disable react/jsx-props-no-spreading */
|
|
166
160
|
var propTypes = {};
|
|
167
161
|
var defaultProps = {};
|
|
168
|
-
|
|
169
162
|
function VStack(props) {
|
|
170
163
|
return /*#__PURE__*/React.createElement(Stack, Object.assign({}, props, {
|
|
171
164
|
direction: "vertical"
|
|
172
165
|
}));
|
|
173
166
|
}
|
|
174
|
-
|
|
175
167
|
VStack.propTypes = propTypes;
|
|
176
168
|
VStack.defaultProps = defaultProps;
|
|
177
169
|
|
package/lib/index.js
CHANGED
|
@@ -30,8 +30,7 @@ var useStack = function useStack() {
|
|
|
30
30
|
};
|
|
31
31
|
var useStackDirection = function useStackDirection() {
|
|
32
32
|
var _useContext = React.useContext(StackContext),
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
direction = _useContext.direction;
|
|
35
34
|
return direction;
|
|
36
35
|
};
|
|
37
36
|
var propTypes$4 = {
|
|
@@ -40,11 +39,13 @@ var propTypes$4 = {
|
|
|
40
39
|
};
|
|
41
40
|
var defaultProps$4 = {
|
|
42
41
|
direction: 'vertical'
|
|
43
|
-
};
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// Note: this is done to avoid excessive renders on the screens that use the context
|
|
44
45
|
|
|
45
46
|
function StackProvider(_ref) {
|
|
46
47
|
var direction = _ref.direction,
|
|
47
|
-
|
|
48
|
+
children = _ref.children;
|
|
48
49
|
var value = React.useMemo(function () {
|
|
49
50
|
return {
|
|
50
51
|
direction: direction
|
|
@@ -71,14 +72,12 @@ var defaultProps$3 = {
|
|
|
71
72
|
maxSize: null,
|
|
72
73
|
className: null
|
|
73
74
|
};
|
|
74
|
-
|
|
75
75
|
function Spacer(_ref) {
|
|
76
76
|
var _ref2;
|
|
77
|
-
|
|
78
77
|
var size = _ref.size,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
minSize = _ref.minSize,
|
|
79
|
+
maxSize = _ref.maxSize,
|
|
80
|
+
className = _ref.className;
|
|
82
81
|
var direction = useStackDirection();
|
|
83
82
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
84
83
|
className: classNames__default["default"]([styles$1.container, (_ref2 = {}, _defineProperty__default["default"](_ref2, styles$1.hasSize, size !== null), _defineProperty__default["default"](_ref2, className, className !== null), _ref2)]),
|
|
@@ -92,7 +91,6 @@ function Spacer(_ref) {
|
|
|
92
91
|
}
|
|
93
92
|
});
|
|
94
93
|
}
|
|
95
|
-
|
|
96
94
|
Spacer.propTypes = propTypes$3;
|
|
97
95
|
Spacer.defaultProps = defaultProps$3;
|
|
98
96
|
Spacer.withoutTransitionsWrapper = true;
|
|
@@ -121,17 +119,16 @@ var defaultProps$2 = {
|
|
|
121
119
|
className: null,
|
|
122
120
|
children: null
|
|
123
121
|
};
|
|
124
|
-
|
|
125
122
|
function Stack(_ref) {
|
|
126
123
|
var direction = _ref.direction,
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
124
|
+
align = _ref.align,
|
|
125
|
+
spacing = _ref.spacing,
|
|
126
|
+
reverse = _ref.reverse,
|
|
127
|
+
size = _ref.size,
|
|
128
|
+
minSize = _ref.minSize,
|
|
129
|
+
maxSize = _ref.maxSize,
|
|
130
|
+
className = _ref.className,
|
|
131
|
+
children = _ref.children;
|
|
135
132
|
var flexDirection = (direction === 'vertical' ? 'column' : 'row') + (reverse ? '-reverse' : '');
|
|
136
133
|
var alignItems = align === 'center' ? align : "flex-".concat(align);
|
|
137
134
|
var justifyContent = isString__default["default"](spacing) ? "space-".concat(spacing) : null;
|
|
@@ -159,33 +156,28 @@ function Stack(_ref) {
|
|
|
159
156
|
})]) : [].concat(_toConsumableArray__default["default"](allChildren), [child]);
|
|
160
157
|
}, [])));
|
|
161
158
|
}
|
|
162
|
-
|
|
163
159
|
Stack.propTypes = propTypes$2;
|
|
164
160
|
Stack.defaultProps = defaultProps$2;
|
|
165
161
|
|
|
166
162
|
/* eslint-disable react/jsx-props-no-spreading */
|
|
167
163
|
var propTypes$1 = {};
|
|
168
164
|
var defaultProps$1 = {};
|
|
169
|
-
|
|
170
165
|
function HStack(props) {
|
|
171
166
|
return /*#__PURE__*/React__default["default"].createElement(Stack, Object.assign({}, props, {
|
|
172
167
|
direction: "horizontal"
|
|
173
168
|
}));
|
|
174
169
|
}
|
|
175
|
-
|
|
176
170
|
HStack.propTypes = propTypes$1;
|
|
177
171
|
HStack.defaultProps = defaultProps$1;
|
|
178
172
|
|
|
179
173
|
/* eslint-disable react/jsx-props-no-spreading */
|
|
180
174
|
var propTypes = {};
|
|
181
175
|
var defaultProps = {};
|
|
182
|
-
|
|
183
176
|
function VStack(props) {
|
|
184
177
|
return /*#__PURE__*/React__default["default"].createElement(Stack, Object.assign({}, props, {
|
|
185
178
|
direction: "vertical"
|
|
186
179
|
}));
|
|
187
180
|
}
|
|
188
|
-
|
|
189
181
|
VStack.propTypes = propTypes;
|
|
190
182
|
VStack.defaultProps = defaultProps;
|
|
191
183
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/element-stack",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.318",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -49,16 +49,16 @@
|
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@babel/runtime": "^7.13.10",
|
|
52
|
-
"@micromag/core": "^0.3.
|
|
52
|
+
"@micromag/core": "^0.3.318",
|
|
53
53
|
"change-case": "^4.1.2",
|
|
54
54
|
"classnames": "^2.2.6",
|
|
55
55
|
"lodash": "^4.17.21",
|
|
56
56
|
"prop-types": "^15.7.2",
|
|
57
57
|
"react-intl": "^5.12.1",
|
|
58
|
-
"uuid": "^
|
|
58
|
+
"uuid": "^9.0.0"
|
|
59
59
|
},
|
|
60
60
|
"publishConfig": {
|
|
61
61
|
"access": "public"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "7d1a296e0c0d410e1225279e1f19e3a7715bfa96"
|
|
64
64
|
}
|