@gympass/yoga 7.66.1 → 7.67.0
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.
|
@@ -17,7 +17,7 @@ var _Text = _interopRequireDefault(require("../../Text"));
|
|
|
17
17
|
|
|
18
18
|
var _StyledFeedback = require("./StyledFeedback");
|
|
19
19
|
|
|
20
|
-
var _excluded = ["variant", "title", "description", "children"];
|
|
20
|
+
var _excluded = ["variant", "title", "description", "children", "center"];
|
|
21
21
|
|
|
22
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
23
23
|
|
|
@@ -50,6 +50,7 @@ function Feedback(_ref) {
|
|
|
50
50
|
title = _ref.title,
|
|
51
51
|
description = _ref.description,
|
|
52
52
|
children = _ref.children,
|
|
53
|
+
center = _ref.center,
|
|
53
54
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
54
55
|
|
|
55
56
|
var iconProps = VARIANT_ICONS[variant];
|
|
@@ -67,15 +68,16 @@ function Feedback(_ref) {
|
|
|
67
68
|
}
|
|
68
69
|
|
|
69
70
|
defineCompoundComponents();
|
|
70
|
-
return /*#__PURE__*/_react["default"].createElement(_Box["default"], {
|
|
71
|
-
ph: "medium",
|
|
72
|
-
pv: "xxlarge",
|
|
73
|
-
minHeight: "100%",
|
|
74
|
-
width: "100%",
|
|
71
|
+
return /*#__PURE__*/_react["default"].createElement(_Box["default"], _extends({
|
|
75
72
|
display: "flex",
|
|
76
73
|
alignItems: "flex-end",
|
|
77
|
-
bg: "white"
|
|
78
|
-
|
|
74
|
+
bg: "white",
|
|
75
|
+
width: "100%"
|
|
76
|
+
}, center && {
|
|
77
|
+
ph: 'medium',
|
|
78
|
+
pv: 'xxlarge',
|
|
79
|
+
minHeight: '100%'
|
|
80
|
+
}), /*#__PURE__*/_react["default"].createElement(_StyledFeedback.Content, props, /*#__PURE__*/_react["default"].createElement(_Icon["default"], _extends({}, iconProps, {
|
|
79
81
|
size: ICON_SIZE,
|
|
80
82
|
mb: "large",
|
|
81
83
|
"data-testid": "feedback-icon"
|
|
@@ -91,11 +93,15 @@ Feedback.propTypes = {
|
|
|
91
93
|
variant: (0, _propTypes.oneOf)(Object.keys(VARIANT_ICONS)).isRequired,
|
|
92
94
|
title: _propTypes.string,
|
|
93
95
|
description: _propTypes.string.isRequired,
|
|
94
|
-
children: (0, _propTypes.oneOfType)([(0, _propTypes.arrayOf)(_propTypes.node), _propTypes.node])
|
|
96
|
+
children: (0, _propTypes.oneOfType)([(0, _propTypes.arrayOf)(_propTypes.node), _propTypes.node]),
|
|
97
|
+
|
|
98
|
+
/** Center the component vertically */
|
|
99
|
+
center: _propTypes.bool
|
|
95
100
|
};
|
|
96
101
|
Feedback.defaultProps = {
|
|
97
102
|
title: undefined,
|
|
98
|
-
children: undefined
|
|
103
|
+
children: undefined,
|
|
104
|
+
center: true
|
|
99
105
|
};
|
|
100
106
|
var _default = Feedback;
|
|
101
107
|
exports["default"] = _default;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
var _excluded = ["variant", "title", "description", "children"];
|
|
1
|
+
var _excluded = ["variant", "title", "description", "children", "center"];
|
|
2
2
|
|
|
3
3
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
4
|
|
|
5
5
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
6
6
|
|
|
7
|
-
import { arrayOf, node, oneOf, oneOfType, string } from 'prop-types';
|
|
7
|
+
import { arrayOf, node, oneOf, oneOfType, string, bool } from 'prop-types';
|
|
8
8
|
import React from 'react';
|
|
9
9
|
import { CheckedFull, AlertCircle, AlertTriangle } from '@gympass/yoga-icons';
|
|
10
10
|
import Icon from '../../Icon';
|
|
@@ -36,6 +36,7 @@ function Feedback(_ref) {
|
|
|
36
36
|
title = _ref.title,
|
|
37
37
|
description = _ref.description,
|
|
38
38
|
children = _ref.children,
|
|
39
|
+
center = _ref.center,
|
|
39
40
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
40
41
|
|
|
41
42
|
var iconProps = VARIANT_ICONS[variant];
|
|
@@ -52,15 +53,16 @@ function Feedback(_ref) {
|
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
defineCompoundComponents();
|
|
55
|
-
return /*#__PURE__*/React.createElement(Box, {
|
|
56
|
-
ph: "medium",
|
|
57
|
-
pv: "xxlarge",
|
|
58
|
-
minHeight: "100%",
|
|
59
|
-
width: "100%",
|
|
56
|
+
return /*#__PURE__*/React.createElement(Box, _extends({
|
|
60
57
|
display: "flex",
|
|
61
58
|
alignItems: "flex-end",
|
|
62
|
-
bg: "white"
|
|
63
|
-
|
|
59
|
+
bg: "white",
|
|
60
|
+
width: "100%"
|
|
61
|
+
}, center && {
|
|
62
|
+
ph: 'medium',
|
|
63
|
+
pv: 'xxlarge',
|
|
64
|
+
minHeight: '100%'
|
|
65
|
+
}), /*#__PURE__*/React.createElement(Content, props, /*#__PURE__*/React.createElement(Icon, _extends({}, iconProps, {
|
|
64
66
|
size: ICON_SIZE,
|
|
65
67
|
mb: "large",
|
|
66
68
|
"data-testid": "feedback-icon"
|
|
@@ -76,10 +78,14 @@ Feedback.propTypes = {
|
|
|
76
78
|
variant: oneOf(Object.keys(VARIANT_ICONS)).isRequired,
|
|
77
79
|
title: string,
|
|
78
80
|
description: string.isRequired,
|
|
79
|
-
children: oneOfType([arrayOf(node), node])
|
|
81
|
+
children: oneOfType([arrayOf(node), node]),
|
|
82
|
+
|
|
83
|
+
/** Center the component vertically */
|
|
84
|
+
center: bool
|
|
80
85
|
};
|
|
81
86
|
Feedback.defaultProps = {
|
|
82
87
|
title: undefined,
|
|
83
|
-
children: undefined
|
|
88
|
+
children: undefined,
|
|
89
|
+
center: true
|
|
84
90
|
};
|
|
85
91
|
export default Feedback;
|
|
@@ -50,33 +50,44 @@ describe('<Feedback />', function () {
|
|
|
50
50
|
name: 'Cancel'
|
|
51
51
|
})).toBeTruthy();
|
|
52
52
|
});
|
|
53
|
-
it('should render
|
|
53
|
+
it('should render correctly when not centered vertically', function () {
|
|
54
54
|
var _renderWithTheme4 = renderWithTheme( /*#__PURE__*/React.createElement(Feedback, {
|
|
55
|
+
variant: "success",
|
|
56
|
+
title: title,
|
|
57
|
+
description: description,
|
|
58
|
+
center: false
|
|
59
|
+
})),
|
|
60
|
+
baseElement = _renderWithTheme4.baseElement;
|
|
61
|
+
|
|
62
|
+
expect(baseElement).toMatchSnapshot();
|
|
63
|
+
});
|
|
64
|
+
it('should render the icon for success variant', function () {
|
|
65
|
+
var _renderWithTheme5 = renderWithTheme( /*#__PURE__*/React.createElement(Feedback, {
|
|
55
66
|
variant: "success",
|
|
56
67
|
title: title,
|
|
57
68
|
description: description
|
|
58
69
|
})),
|
|
59
|
-
getByTestId =
|
|
70
|
+
getByTestId = _renderWithTheme5.getByTestId;
|
|
60
71
|
|
|
61
72
|
expect(getByTestId('feedback-icon')).toMatchSnapshot();
|
|
62
73
|
});
|
|
63
74
|
it('should render the icon for informative variant', function () {
|
|
64
|
-
var
|
|
75
|
+
var _renderWithTheme6 = renderWithTheme( /*#__PURE__*/React.createElement(Feedback, {
|
|
65
76
|
variant: "informative",
|
|
66
77
|
title: title,
|
|
67
78
|
description: description
|
|
68
79
|
})),
|
|
69
|
-
getByTestId =
|
|
80
|
+
getByTestId = _renderWithTheme6.getByTestId;
|
|
70
81
|
|
|
71
82
|
expect(getByTestId('feedback-icon')).toMatchSnapshot();
|
|
72
83
|
});
|
|
73
84
|
it('should render the icon for attention variant', function () {
|
|
74
|
-
var
|
|
85
|
+
var _renderWithTheme7 = renderWithTheme( /*#__PURE__*/React.createElement(Feedback, {
|
|
75
86
|
variant: "attention",
|
|
76
87
|
title: title,
|
|
77
88
|
description: description
|
|
78
89
|
})),
|
|
79
|
-
getByTestId =
|
|
90
|
+
getByTestId = _renderWithTheme7.getByTestId;
|
|
80
91
|
|
|
81
92
|
expect(getByTestId('feedback-icon')).toMatchSnapshot();
|
|
82
93
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gympass/yoga",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.67.0",
|
|
4
4
|
"description": "Gympass component library",
|
|
5
5
|
"main": "./cjs",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"react": ">=16",
|
|
54
54
|
"styled-components": "^4.4.0"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "82246210f3de6802ce64c94ca6599082d2dc06fc",
|
|
57
57
|
"module": "./esm",
|
|
58
58
|
"private": false,
|
|
59
59
|
"react-native": "./cjs/index.native.js"
|