@gympass/yoga 7.82.1 → 7.83.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.
|
@@ -34,35 +34,45 @@ var List = _styledComponents["default"].ul(_templateObject2 || (_templateObject2
|
|
|
34
34
|
|
|
35
35
|
exports.List = List;
|
|
36
36
|
|
|
37
|
-
var IconWrapper = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n display: flex;\n margin-right: ", "px;\n"])), cardweb.plan.list.item.icon.margin.right)
|
|
37
|
+
var IconWrapper = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n margin-right: ", "px;\n min-height: ", "px;\n"])), cardweb.plan.list.item.icon.margin.right, function (props) {
|
|
38
|
+
return props.theme.yoga.spacing.medium;
|
|
39
|
+
});
|
|
38
40
|
|
|
39
41
|
var Item = _styledComponents["default"].li(_templateObject4 || (_templateObject4 = _taggedTemplateLiteralLoose(["\n :not(:last-child) {\n margin-bottom: ", "px;\n }\n"])), card.plan.list.item.margin.bottom);
|
|
40
42
|
|
|
41
|
-
var Wrapper = (0, _styledComponents["default"])(_Box["default"])(_templateObject5 || (_templateObject5 = _taggedTemplateLiteralLoose(["\n display: flex;\n
|
|
43
|
+
var Wrapper = (0, _styledComponents["default"])(_Box["default"])(_templateObject5 || (_templateObject5 = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n min-width: 0;\n\n ", "\n\n svg {\n flex-shrink: 0;\n }\n"])), function (props) {
|
|
42
44
|
return props.as === 'button' && (0, _styledComponents.css)(_templateObject6 || (_templateObject6 = _taggedTemplateLiteralLoose(["\n border: none;\n padding: 0;\n background: transparent;\n cursor: pointer;\n "])));
|
|
43
45
|
});
|
|
44
|
-
var ItemText = (0, _styledComponents["default"])(_Text["default"].Small)(_templateObject7 || (_templateObject7 = _taggedTemplateLiteralLoose(["\n display: inline-block;\n height: 100%;\n vertical-align: middle;\n\n color: ", ";\n\n ", "\n"])), card.plan.list.item.font.color,
|
|
46
|
+
var ItemText = (0, _styledComponents["default"])(_Text["default"].Small)(_templateObject7 || (_templateObject7 = _taggedTemplateLiteralLoose(["\n display: inline-block;\n height: 100%;\n vertical-align: middle;\n\n color: ", ";\n\n ", "\n"])), card.plan.list.item.font.color, function (props) {
|
|
47
|
+
return props.truncate && truncateStyle;
|
|
48
|
+
});
|
|
45
49
|
|
|
46
50
|
var Button = _styledComponents["default"].button(_templateObject8 || (_templateObject8 = _taggedTemplateLiteralLoose(["\n display: block;\n padding: 0;\n margin-top: ", "px;\n\n width: 100%;\n\n letter-spacing: normal;\n\n background-color: transparent;\n border: none;\n\n font-family: ", ";\n font-size: ", "px;\n font-weight: ", ";\n color: ", ";\n\n cursor: pointer;\n text-decoration: none;\n text-align: left;\n outline: none;\n\n ", "\n"])), card.plan.list.button.margin.top, _themeReader["default"].baseFont.family, card.plan.list.button.font.size, card.plan.list.button.font.weight, card.plan.list.button.font.color, truncateStyle);
|
|
47
51
|
|
|
48
|
-
var ListItem = (0, _styledComponents.withTheme)(function (
|
|
49
|
-
var text =
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
var ListItem = (0, _styledComponents.withTheme)(function (props) {
|
|
53
|
+
var text = props.text,
|
|
54
|
+
truncate = props.truncate,
|
|
55
|
+
Icon = props.icon,
|
|
56
|
+
buttonProps = props.buttonProps,
|
|
57
|
+
yogaTheme = props.theme,
|
|
58
|
+
children = props.children,
|
|
59
|
+
onClick = props.onClick;
|
|
54
60
|
var wrapperProps = onClick ? {
|
|
55
61
|
as: 'button',
|
|
56
62
|
type: 'button',
|
|
57
63
|
onClick: onClick
|
|
58
64
|
} : {};
|
|
59
|
-
return /*#__PURE__*/_react["default"].createElement(Item, null, /*#__PURE__*/_react["default"].createElement(Wrapper, wrapperProps,
|
|
65
|
+
return /*#__PURE__*/_react["default"].createElement(Item, null, /*#__PURE__*/_react["default"].createElement(Wrapper, wrapperProps, /*#__PURE__*/_react["default"].createElement(_Box["default"], {
|
|
66
|
+
display: "flex",
|
|
67
|
+
alignItems: "flex-start"
|
|
68
|
+
}, Icon && /*#__PURE__*/_react["default"].createElement(IconWrapper, null, /*#__PURE__*/(0, _react.isValidElement)(Icon) ? Icon : /*#__PURE__*/_react["default"].createElement(Icon, {
|
|
60
69
|
width: 16,
|
|
61
70
|
height: 16,
|
|
62
71
|
fill: yogaTheme.yoga.colors.text.primary
|
|
63
72
|
})), /*#__PURE__*/_react["default"].createElement(ItemText, {
|
|
64
|
-
as: "span"
|
|
65
|
-
|
|
73
|
+
as: "span",
|
|
74
|
+
truncate: truncate
|
|
75
|
+
}, text)), children), Boolean(Object.keys(buttonProps).length) && /*#__PURE__*/_react["default"].createElement(Button, buttonProps));
|
|
66
76
|
});
|
|
67
77
|
exports.ListItem = ListItem;
|
|
68
78
|
List.displayName = 'PlanCard.List';
|
|
@@ -79,10 +89,14 @@ ListItem.propTypes = {
|
|
|
79
89
|
buttonProps: (0, _propTypes.shape)({}),
|
|
80
90
|
|
|
81
91
|
/** if provided makes the item clickable */
|
|
82
|
-
onClick: _propTypes.func
|
|
92
|
+
onClick: _propTypes.func,
|
|
93
|
+
children: _propTypes.node,
|
|
94
|
+
truncate: _propTypes.bool
|
|
83
95
|
};
|
|
84
96
|
ListItem.defaultProps = {
|
|
97
|
+
truncate: true,
|
|
85
98
|
icon: undefined,
|
|
86
99
|
buttonProps: {},
|
|
87
|
-
onClick: undefined
|
|
100
|
+
onClick: undefined,
|
|
101
|
+
children: undefined
|
|
88
102
|
};
|
|
@@ -4,7 +4,7 @@ function _taggedTemplateLiteralLoose(strings, raw) { if (!raw) { raw = strings.s
|
|
|
4
4
|
|
|
5
5
|
import React, { isValidElement } from 'react';
|
|
6
6
|
import styled, { css, withTheme } from 'styled-components';
|
|
7
|
-
import { string, node, shape, oneOfType, func } from 'prop-types';
|
|
7
|
+
import { string, node, shape, oneOfType, func, bool } from 'prop-types';
|
|
8
8
|
import Text from '../../../Text';
|
|
9
9
|
import theme from '../../../Theme/helpers/themeReader';
|
|
10
10
|
import Box from '../../../Box';
|
|
@@ -13,31 +13,41 @@ var _theme$components = theme.components,
|
|
|
13
13
|
cardweb = _theme$components.cardweb;
|
|
14
14
|
var truncateStyle = css(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n"])));
|
|
15
15
|
var List = styled.ul(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n margin: ", "px 0 0;\n padding: 0;\n\n list-style: none;\n"])), cardweb.plan.list.margin.top);
|
|
16
|
-
var IconWrapper = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n display: flex;\n margin-right: ", "px;\n"])), cardweb.plan.list.item.icon.margin.right)
|
|
16
|
+
var IconWrapper = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n margin-right: ", "px;\n min-height: ", "px;\n"])), cardweb.plan.list.item.icon.margin.right, function (props) {
|
|
17
|
+
return props.theme.yoga.spacing.medium;
|
|
18
|
+
});
|
|
17
19
|
var Item = styled.li(_templateObject4 || (_templateObject4 = _taggedTemplateLiteralLoose(["\n :not(:last-child) {\n margin-bottom: ", "px;\n }\n"])), card.plan.list.item.margin.bottom);
|
|
18
|
-
var Wrapper = styled(Box)(_templateObject5 || (_templateObject5 = _taggedTemplateLiteralLoose(["\n display: flex;\n
|
|
20
|
+
var Wrapper = styled(Box)(_templateObject5 || (_templateObject5 = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n min-width: 0;\n\n ", "\n\n svg {\n flex-shrink: 0;\n }\n"])), function (props) {
|
|
19
21
|
return props.as === 'button' && css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteralLoose(["\n border: none;\n padding: 0;\n background: transparent;\n cursor: pointer;\n "])));
|
|
20
22
|
});
|
|
21
|
-
var ItemText = styled(Text.Small)(_templateObject7 || (_templateObject7 = _taggedTemplateLiteralLoose(["\n display: inline-block;\n height: 100%;\n vertical-align: middle;\n\n color: ", ";\n\n ", "\n"])), card.plan.list.item.font.color,
|
|
23
|
+
var ItemText = styled(Text.Small)(_templateObject7 || (_templateObject7 = _taggedTemplateLiteralLoose(["\n display: inline-block;\n height: 100%;\n vertical-align: middle;\n\n color: ", ";\n\n ", "\n"])), card.plan.list.item.font.color, function (props) {
|
|
24
|
+
return props.truncate && truncateStyle;
|
|
25
|
+
});
|
|
22
26
|
var Button = styled.button(_templateObject8 || (_templateObject8 = _taggedTemplateLiteralLoose(["\n display: block;\n padding: 0;\n margin-top: ", "px;\n\n width: 100%;\n\n letter-spacing: normal;\n\n background-color: transparent;\n border: none;\n\n font-family: ", ";\n font-size: ", "px;\n font-weight: ", ";\n color: ", ";\n\n cursor: pointer;\n text-decoration: none;\n text-align: left;\n outline: none;\n\n ", "\n"])), card.plan.list.button.margin.top, theme.baseFont.family, card.plan.list.button.font.size, card.plan.list.button.font.weight, card.plan.list.button.font.color, truncateStyle);
|
|
23
|
-
var ListItem = withTheme(function (
|
|
24
|
-
var text =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
var ListItem = withTheme(function (props) {
|
|
28
|
+
var text = props.text,
|
|
29
|
+
truncate = props.truncate,
|
|
30
|
+
Icon = props.icon,
|
|
31
|
+
buttonProps = props.buttonProps,
|
|
32
|
+
yogaTheme = props.theme,
|
|
33
|
+
children = props.children,
|
|
34
|
+
onClick = props.onClick;
|
|
29
35
|
var wrapperProps = onClick ? {
|
|
30
36
|
as: 'button',
|
|
31
37
|
type: 'button',
|
|
32
38
|
onClick: onClick
|
|
33
39
|
} : {};
|
|
34
|
-
return /*#__PURE__*/React.createElement(Item, null, /*#__PURE__*/React.createElement(Wrapper, wrapperProps,
|
|
40
|
+
return /*#__PURE__*/React.createElement(Item, null, /*#__PURE__*/React.createElement(Wrapper, wrapperProps, /*#__PURE__*/React.createElement(Box, {
|
|
41
|
+
display: "flex",
|
|
42
|
+
alignItems: "flex-start"
|
|
43
|
+
}, Icon && /*#__PURE__*/React.createElement(IconWrapper, null, /*#__PURE__*/isValidElement(Icon) ? Icon : /*#__PURE__*/React.createElement(Icon, {
|
|
35
44
|
width: 16,
|
|
36
45
|
height: 16,
|
|
37
46
|
fill: yogaTheme.yoga.colors.text.primary
|
|
38
47
|
})), /*#__PURE__*/React.createElement(ItemText, {
|
|
39
|
-
as: "span"
|
|
40
|
-
|
|
48
|
+
as: "span",
|
|
49
|
+
truncate: truncate
|
|
50
|
+
}, text)), children), Boolean(Object.keys(buttonProps).length) && /*#__PURE__*/React.createElement(Button, buttonProps));
|
|
41
51
|
});
|
|
42
52
|
List.displayName = 'PlanCard.List';
|
|
43
53
|
ListItem.displayName = 'PlanCard.ListItem';
|
|
@@ -53,11 +63,15 @@ ListItem.propTypes = {
|
|
|
53
63
|
buttonProps: shape({}),
|
|
54
64
|
|
|
55
65
|
/** if provided makes the item clickable */
|
|
56
|
-
onClick: func
|
|
66
|
+
onClick: func,
|
|
67
|
+
children: node,
|
|
68
|
+
truncate: bool
|
|
57
69
|
};
|
|
58
70
|
ListItem.defaultProps = {
|
|
71
|
+
truncate: true,
|
|
59
72
|
icon: undefined,
|
|
60
73
|
buttonProps: {},
|
|
61
|
-
onClick: undefined
|
|
74
|
+
onClick: undefined,
|
|
75
|
+
children: undefined
|
|
62
76
|
};
|
|
63
77
|
export { List, ListItem };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
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); }
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { render, screen } from '@testing-library/react';
|
|
5
|
+
import ThemeProvider from '../../../Theme';
|
|
6
|
+
import { ListItem } from './List';
|
|
7
|
+
var text = '2.900 gyms and studios';
|
|
8
|
+
|
|
9
|
+
function setup(props) {
|
|
10
|
+
render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(ListItem, _extends({
|
|
11
|
+
text: text
|
|
12
|
+
}, props))));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
describe('<ListItem />', function () {
|
|
16
|
+
it('should display text truncated', function () {
|
|
17
|
+
setup();
|
|
18
|
+
expect(screen.getByText(text)).toMatchSnapshot();
|
|
19
|
+
});
|
|
20
|
+
it('should not display text truncated when truncate prop is false', function () {
|
|
21
|
+
setup({
|
|
22
|
+
truncate: false
|
|
23
|
+
});
|
|
24
|
+
expect(screen.getByText(text)).toMatchSnapshot();
|
|
25
|
+
});
|
|
26
|
+
it('should display children element', function () {
|
|
27
|
+
setup({
|
|
28
|
+
children: /*#__PURE__*/React.createElement("ul", null)
|
|
29
|
+
});
|
|
30
|
+
expect(screen.getByRole('list')).toBeInTheDocument();
|
|
31
|
+
});
|
|
32
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gympass/yoga",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.83.0",
|
|
4
4
|
"description": "Gympass component library",
|
|
5
5
|
"main": "./cjs",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"react-native": "0.72.3",
|
|
56
56
|
"styled-components": "^4.4.0"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "7877b5478680fe119d49c0527d8400cac17de572",
|
|
59
59
|
"module": "./esm",
|
|
60
60
|
"types": "./typings/index.d.ts",
|
|
61
61
|
"private": false,
|