@gympass/yoga 7.27.0 → 7.28.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.
package/cjs/Button/web/Button.js
CHANGED
|
@@ -29,6 +29,12 @@ var Button = function Button(_ref) {
|
|
|
29
29
|
Icon = _ref.icon,
|
|
30
30
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
31
31
|
|
|
32
|
+
var finalProps = _extends({}, props);
|
|
33
|
+
|
|
34
|
+
if (props.href) {
|
|
35
|
+
finalProps.as = 'a';
|
|
36
|
+
}
|
|
37
|
+
|
|
32
38
|
return /*#__PURE__*/_react["default"].createElement(_StyledButton["default"], _extends({
|
|
33
39
|
disabled: disabled,
|
|
34
40
|
full: full,
|
|
@@ -36,7 +42,7 @@ var Button = function Button(_ref) {
|
|
|
36
42
|
onClick: onClick,
|
|
37
43
|
small: small,
|
|
38
44
|
secondary: secondary
|
|
39
|
-
},
|
|
45
|
+
}, finalProps), Icon && /*#__PURE__*/_react["default"].createElement(Icon, null), children);
|
|
40
46
|
};
|
|
41
47
|
|
|
42
48
|
Button.propTypes = {
|
|
@@ -49,7 +55,8 @@ Button.propTypes = {
|
|
|
49
55
|
secondary: _propTypes.bool,
|
|
50
56
|
|
|
51
57
|
/** an Icon from yoga-icons package */
|
|
52
|
-
icon: (0, _propTypes.oneOfType)([_propTypes.node, _propTypes.func])
|
|
58
|
+
icon: (0, _propTypes.oneOfType)([_propTypes.node, _propTypes.func]),
|
|
59
|
+
href: _propTypes.string
|
|
53
60
|
};
|
|
54
61
|
Button.defaultProps = {
|
|
55
62
|
children: 'Button',
|
|
@@ -59,7 +66,8 @@ Button.defaultProps = {
|
|
|
59
66
|
onClick: function onClick() {},
|
|
60
67
|
small: false,
|
|
61
68
|
secondary: false,
|
|
62
|
-
icon: undefined
|
|
69
|
+
icon: undefined,
|
|
70
|
+
href: undefined
|
|
63
71
|
};
|
|
64
72
|
Button.displayName = 'Button';
|
|
65
73
|
var _default = Button;
|
package/cjs/Button/web/Link.js
CHANGED
|
@@ -11,7 +11,7 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
|
11
11
|
|
|
12
12
|
var _yogaCommon = require("@gympass/yoga-common");
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _Button = _interopRequireDefault(require("./Button"));
|
|
15
15
|
|
|
16
16
|
var _templateObject;
|
|
17
17
|
|
|
@@ -19,7 +19,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
|
|
|
19
19
|
|
|
20
20
|
function _taggedTemplateLiteralLoose(strings, raw) { if (!raw) { raw = strings.slice(0); } strings.raw = raw; return strings; }
|
|
21
21
|
|
|
22
|
-
var Link = (0, _styledComponents["default"])(
|
|
22
|
+
var Link = (0, _styledComponents["default"])(_Button["default"])(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n ", "\n"])), function (_ref) {
|
|
23
23
|
var full = _ref.full,
|
|
24
24
|
secondary = _ref.secondary,
|
|
25
25
|
button = _ref.theme.yoga.components.button;
|
|
@@ -33,11 +33,13 @@ var ButtonLink = function ButtonLink(props) {
|
|
|
33
33
|
|
|
34
34
|
ButtonLink.propTypes = {
|
|
35
35
|
disabled: _propTypes.bool,
|
|
36
|
-
secondary: _propTypes.bool
|
|
36
|
+
secondary: _propTypes.bool,
|
|
37
|
+
href: _propTypes.string
|
|
37
38
|
};
|
|
38
39
|
ButtonLink.defaultProps = {
|
|
39
40
|
disabled: false,
|
|
40
|
-
secondary: false
|
|
41
|
+
secondary: false,
|
|
42
|
+
href: undefined
|
|
41
43
|
};
|
|
42
44
|
ButtonLink.displayName = 'Button.Link';
|
|
43
45
|
var _default = ButtonLink;
|
|
@@ -18,11 +18,12 @@ var StyledButton = _styledComponents["default"].button(_templateObject || (_temp
|
|
|
18
18
|
small = _ref.small,
|
|
19
19
|
inverted = _ref.inverted,
|
|
20
20
|
secondary = _ref.secondary,
|
|
21
|
+
disabled = _ref.disabled,
|
|
21
22
|
_ref$theme$yoga = _ref.theme.yoga,
|
|
22
23
|
baseFont = _ref$theme$yoga.baseFont,
|
|
23
24
|
button = _ref$theme$yoga.components.button;
|
|
24
25
|
var state = secondary ? 'secondary' : 'primary';
|
|
25
|
-
return "\n display: flex;\n align-items: center;\n justify-content: center;\n\n width: " + (full ? '100%' : 'auto') + ";\n height: " + (small ? button.height.small : button.height["default"]) + "px;\n padding-left: " + (small ? button.padding.small.left : button.padding["default"].left) + "px;\n padding-right: " + (small ? button.padding.small.right : button.padding["default"].right) + "px;\n\n background-color: " + button.types.contained.backgroundColor[state]["default"] + ";\n border: none;\n border-radius: " + button.border.radius + "px;\n color: " + button.types.contained.font["default"].color + ";\n\n font-size: " + (small ? button.font.size.small : button.font.size["default"]) + "px;\n font-weight: " + button.font.weight + ";\n font-family: " + baseFont.family + ";\n letter-spacing: normal;\n line-height: 1;\n text-decoration: none;\n\n svg {\n width: " + (small ? button.icon.size.small : button.icon.size["default"]) + "px;\n height: " + (small ? button.icon.size.small : button.icon.size["default"]) + "px;\n fill: " + button.types.contained.font["default"].color + ";\n margin-right: " + button.icon.margin.right + "px;\n\n transition: fill 0.2s;\n }\n\n &:not([disabled]):hover, &:not([disabled]):focus {\n box-shadow: 0 4px 8px " + (0, _yogaCommon.hexToRgb)(button.types.contained.backgroundColor[state]["default"], 0.45) + ";\n }\n\n &:active {\n background-color: " + button.types.contained.backgroundColor[state].pressed + ";\n color: " + button.types.contained.font.pressed.color + ";\n\n svg {\n fill: " + button.types.contained.font.pressed.color + ";\n }\n }\n\n
|
|
26
|
+
return "\n display: flex;\n align-items: center;\n justify-content: center;\n\n width: " + (full ? '100%' : 'auto') + ";\n height: " + (small ? button.height.small : button.height["default"]) + "px;\n padding-left: " + (small ? button.padding.small.left : button.padding["default"].left) + "px;\n padding-right: " + (small ? button.padding.small.right : button.padding["default"].right) + "px;\n\n background-color: " + button.types.contained.backgroundColor[state]["default"] + ";\n border: none;\n border-radius: " + button.border.radius + "px;\n color: " + button.types.contained.font["default"].color + ";\n\n font-size: " + (small ? button.font.size.small : button.font.size["default"]) + "px;\n font-weight: " + button.font.weight + ";\n font-family: " + baseFont.family + ";\n letter-spacing: normal;\n line-height: 1;\n text-decoration: none;\n\n svg {\n width: " + (small ? button.icon.size.small : button.icon.size["default"]) + "px;\n height: " + (small ? button.icon.size.small : button.icon.size["default"]) + "px;\n fill: " + button.types.contained.font["default"].color + ";\n margin-right: " + button.icon.margin.right + "px;\n\n transition: fill 0.2s;\n }\n\n &:not([disabled]):hover, &:not([disabled]):focus {\n box-shadow: 0 4px 8px " + (0, _yogaCommon.hexToRgb)(button.types.contained.backgroundColor[state]["default"], 0.45) + ";\n }\n\n &:active {\n background-color: " + button.types.contained.backgroundColor[state].pressed + ";\n color: " + button.types.contained.font.pressed.color + ";\n\n svg {\n fill: " + button.types.contained.font.pressed.color + ";\n }\n }\n\n " + (disabled ? "\n \n background-color " + button.types.contained.backgroundColor.disabled + ";\n color: " + button.types.contained.font.disabled.color + ";\n pointer-events: none;\n\n svg {\n fill: " + button.types.contained.font.disabled.color + ";\n }\n\n cursor: not-allowed;\n \n " : '') + "\n \n\n " + (inverted ? "\n background-color: " + button.types.contained.font["default"].color + ";\n color: " + button.types.contained.backgroundColor[state]["default"] + ";\n\n svg {\n fill: " + button.types.contained.backgroundColor[state]["default"] + ";\n }\n\n &:active {\n background-color: " + (0, _yogaCommon.hexToRgb)(button.types.contained.font["default"].color, 0.75) + ";\n color: " + button.types.contained.backgroundColor[state].pressed + ";\n\n svg {\n fill: " + button.types.contained.backgroundColor[state].pressed + ";\n }\n }\n\n &:not([disabled]):hover, &:not([disabled]):focus {\n box-shadow: 0 4px 8px " + (0, _yogaCommon.hexToRgb)(button.types.contained.font["default"].color, 0.45) + ";\n }\n " : '') + "\n ";
|
|
26
27
|
});
|
|
27
28
|
|
|
28
29
|
var _default = StyledButton;
|
package/esm/Button/web/Button.js
CHANGED
|
@@ -5,7 +5,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
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
7
|
import React from 'react';
|
|
8
|
-
import { func, node, oneOfType, bool } from 'prop-types';
|
|
8
|
+
import { func, node, oneOfType, bool, string } from 'prop-types';
|
|
9
9
|
import StyledButton from './StyledButton';
|
|
10
10
|
/** Buttons make common actions more obvious and help users more easily perform them. Buttons use labels and sometimes icons to communicate the action that will occur when the user touches them. */
|
|
11
11
|
|
|
@@ -20,6 +20,12 @@ var Button = function Button(_ref) {
|
|
|
20
20
|
Icon = _ref.icon,
|
|
21
21
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
22
22
|
|
|
23
|
+
var finalProps = _extends({}, props);
|
|
24
|
+
|
|
25
|
+
if (props.href) {
|
|
26
|
+
finalProps.as = 'a';
|
|
27
|
+
}
|
|
28
|
+
|
|
23
29
|
return /*#__PURE__*/React.createElement(StyledButton, _extends({
|
|
24
30
|
disabled: disabled,
|
|
25
31
|
full: full,
|
|
@@ -27,7 +33,7 @@ var Button = function Button(_ref) {
|
|
|
27
33
|
onClick: onClick,
|
|
28
34
|
small: small,
|
|
29
35
|
secondary: secondary
|
|
30
|
-
},
|
|
36
|
+
}, finalProps), Icon && /*#__PURE__*/React.createElement(Icon, null), children);
|
|
31
37
|
};
|
|
32
38
|
|
|
33
39
|
Button.propTypes = {
|
|
@@ -40,7 +46,8 @@ Button.propTypes = {
|
|
|
40
46
|
secondary: bool,
|
|
41
47
|
|
|
42
48
|
/** an Icon from yoga-icons package */
|
|
43
|
-
icon: oneOfType([node, func])
|
|
49
|
+
icon: oneOfType([node, func]),
|
|
50
|
+
href: string
|
|
44
51
|
};
|
|
45
52
|
Button.defaultProps = {
|
|
46
53
|
children: 'Button',
|
|
@@ -50,7 +57,8 @@ Button.defaultProps = {
|
|
|
50
57
|
onClick: function onClick() {},
|
|
51
58
|
small: false,
|
|
52
59
|
secondary: false,
|
|
53
|
-
icon: undefined
|
|
60
|
+
icon: undefined,
|
|
61
|
+
href: undefined
|
|
54
62
|
};
|
|
55
63
|
Button.displayName = 'Button';
|
|
56
64
|
export default Button;
|
package/esm/Button/web/Link.js
CHANGED
|
@@ -3,11 +3,11 @@ var _templateObject;
|
|
|
3
3
|
function _taggedTemplateLiteralLoose(strings, raw) { if (!raw) { raw = strings.slice(0); } strings.raw = raw; return strings; }
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
|
-
import { bool } from 'prop-types';
|
|
6
|
+
import { bool, string } from 'prop-types';
|
|
7
7
|
import styled from 'styled-components';
|
|
8
8
|
import { hexToRgb } from '@gympass/yoga-common';
|
|
9
|
-
import
|
|
10
|
-
var Link = styled(
|
|
9
|
+
import Button from './Button';
|
|
10
|
+
var Link = styled(Button)(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n ", "\n"])), function (_ref) {
|
|
11
11
|
var full = _ref.full,
|
|
12
12
|
secondary = _ref.secondary,
|
|
13
13
|
button = _ref.theme.yoga.components.button;
|
|
@@ -21,11 +21,13 @@ var ButtonLink = function ButtonLink(props) {
|
|
|
21
21
|
|
|
22
22
|
ButtonLink.propTypes = {
|
|
23
23
|
disabled: bool,
|
|
24
|
-
secondary: bool
|
|
24
|
+
secondary: bool,
|
|
25
|
+
href: string
|
|
25
26
|
};
|
|
26
27
|
ButtonLink.defaultProps = {
|
|
27
28
|
disabled: false,
|
|
28
|
-
secondary: false
|
|
29
|
+
secondary: false,
|
|
30
|
+
href: undefined
|
|
29
31
|
};
|
|
30
32
|
ButtonLink.displayName = 'Button.Link';
|
|
31
33
|
export default ButtonLink;
|
|
@@ -9,10 +9,11 @@ var StyledButton = styled.button(_templateObject || (_templateObject = _taggedTe
|
|
|
9
9
|
small = _ref.small,
|
|
10
10
|
inverted = _ref.inverted,
|
|
11
11
|
secondary = _ref.secondary,
|
|
12
|
+
disabled = _ref.disabled,
|
|
12
13
|
_ref$theme$yoga = _ref.theme.yoga,
|
|
13
14
|
baseFont = _ref$theme$yoga.baseFont,
|
|
14
15
|
button = _ref$theme$yoga.components.button;
|
|
15
16
|
var state = secondary ? 'secondary' : 'primary';
|
|
16
|
-
return "\n display: flex;\n align-items: center;\n justify-content: center;\n\n width: " + (full ? '100%' : 'auto') + ";\n height: " + (small ? button.height.small : button.height["default"]) + "px;\n padding-left: " + (small ? button.padding.small.left : button.padding["default"].left) + "px;\n padding-right: " + (small ? button.padding.small.right : button.padding["default"].right) + "px;\n\n background-color: " + button.types.contained.backgroundColor[state]["default"] + ";\n border: none;\n border-radius: " + button.border.radius + "px;\n color: " + button.types.contained.font["default"].color + ";\n\n font-size: " + (small ? button.font.size.small : button.font.size["default"]) + "px;\n font-weight: " + button.font.weight + ";\n font-family: " + baseFont.family + ";\n letter-spacing: normal;\n line-height: 1;\n text-decoration: none;\n\n svg {\n width: " + (small ? button.icon.size.small : button.icon.size["default"]) + "px;\n height: " + (small ? button.icon.size.small : button.icon.size["default"]) + "px;\n fill: " + button.types.contained.font["default"].color + ";\n margin-right: " + button.icon.margin.right + "px;\n\n transition: fill 0.2s;\n }\n\n &:not([disabled]):hover, &:not([disabled]):focus {\n box-shadow: 0 4px 8px " + hexToRgb(button.types.contained.backgroundColor[state]["default"], 0.45) + ";\n }\n\n &:active {\n background-color: " + button.types.contained.backgroundColor[state].pressed + ";\n color: " + button.types.contained.font.pressed.color + ";\n\n svg {\n fill: " + button.types.contained.font.pressed.color + ";\n }\n }\n\n
|
|
17
|
+
return "\n display: flex;\n align-items: center;\n justify-content: center;\n\n width: " + (full ? '100%' : 'auto') + ";\n height: " + (small ? button.height.small : button.height["default"]) + "px;\n padding-left: " + (small ? button.padding.small.left : button.padding["default"].left) + "px;\n padding-right: " + (small ? button.padding.small.right : button.padding["default"].right) + "px;\n\n background-color: " + button.types.contained.backgroundColor[state]["default"] + ";\n border: none;\n border-radius: " + button.border.radius + "px;\n color: " + button.types.contained.font["default"].color + ";\n\n font-size: " + (small ? button.font.size.small : button.font.size["default"]) + "px;\n font-weight: " + button.font.weight + ";\n font-family: " + baseFont.family + ";\n letter-spacing: normal;\n line-height: 1;\n text-decoration: none;\n\n svg {\n width: " + (small ? button.icon.size.small : button.icon.size["default"]) + "px;\n height: " + (small ? button.icon.size.small : button.icon.size["default"]) + "px;\n fill: " + button.types.contained.font["default"].color + ";\n margin-right: " + button.icon.margin.right + "px;\n\n transition: fill 0.2s;\n }\n\n &:not([disabled]):hover, &:not([disabled]):focus {\n box-shadow: 0 4px 8px " + hexToRgb(button.types.contained.backgroundColor[state]["default"], 0.45) + ";\n }\n\n &:active {\n background-color: " + button.types.contained.backgroundColor[state].pressed + ";\n color: " + button.types.contained.font.pressed.color + ";\n\n svg {\n fill: " + button.types.contained.font.pressed.color + ";\n }\n }\n\n " + (disabled ? "\n \n background-color " + button.types.contained.backgroundColor.disabled + ";\n color: " + button.types.contained.font.disabled.color + ";\n pointer-events: none;\n\n svg {\n fill: " + button.types.contained.font.disabled.color + ";\n }\n\n cursor: not-allowed;\n \n " : '') + "\n \n\n " + (inverted ? "\n background-color: " + button.types.contained.font["default"].color + ";\n color: " + button.types.contained.backgroundColor[state]["default"] + ";\n\n svg {\n fill: " + button.types.contained.backgroundColor[state]["default"] + ";\n }\n\n &:active {\n background-color: " + hexToRgb(button.types.contained.font["default"].color, 0.75) + ";\n color: " + button.types.contained.backgroundColor[state].pressed + ";\n\n svg {\n fill: " + button.types.contained.backgroundColor[state].pressed + ";\n }\n }\n\n &:not([disabled]):hover, &:not([disabled]):focus {\n box-shadow: 0 4px 8px " + hexToRgb(button.types.contained.font["default"].color, 0.45) + ";\n }\n " : '') + "\n ";
|
|
17
18
|
});
|
|
18
19
|
export default StyledButton;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gympass/yoga",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.28.0",
|
|
4
4
|
"description": "Gympass component library",
|
|
5
5
|
"main": "./cjs",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"react": ">=16",
|
|
50
50
|
"styled-components": "^4.4.0"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "e12aed14e42d918a0ae19e1ebe3de476214715de",
|
|
53
53
|
"module": "./esm",
|
|
54
54
|
"private": false,
|
|
55
55
|
"react-native": "./cjs/index.native.js"
|