@gympass/yoga 7.85.1 → 7.87.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 +26 -4
- package/cjs/Button/web/Icon.js +17 -7
- package/cjs/Button/web/Link.js +15 -12
- package/cjs/Button/web/Outline.js +2 -1
- package/cjs/Button/web/StyledButton.js +2 -1
- package/cjs/Button/web/Text.js +34 -1
- package/cjs/Spinner/Spinner.theme.js +11 -0
- package/cjs/Spinner/index.js +11 -0
- package/cjs/Spinner/web/Spinner.js +66 -0
- package/cjs/Spinner/web/index.js +11 -0
- package/cjs/Theme/theme/theme.js +3 -0
- package/cjs/index.js +4 -0
- package/esm/Button/web/Button.js +22 -4
- package/esm/Button/web/Button.test.js +1188 -585
- package/esm/Button/web/Icon.js +16 -7
- package/esm/Button/web/Link.js +11 -12
- package/esm/Button/web/Outline.js +2 -1
- package/esm/Button/web/StyledButton.js +2 -1
- package/esm/Button/web/Text.js +28 -1
- package/esm/Spinner/Spinner.theme.js +5 -0
- package/esm/Spinner/index.js +2 -0
- package/esm/Spinner/web/Spinner.js +46 -0
- package/esm/Spinner/web/Spinner.test.js +14 -0
- package/esm/Spinner/web/index.js +2 -0
- package/esm/Theme/theme/theme.js +2 -0
- package/esm/index.js +2 -1
- package/package.json +4 -10
package/cjs/Button/web/Button.js
CHANGED
|
@@ -7,9 +7,15 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
7
7
|
|
|
8
8
|
var _propTypes = require("prop-types");
|
|
9
9
|
|
|
10
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
11
|
+
|
|
10
12
|
var _StyledButton = _interopRequireDefault(require("./StyledButton"));
|
|
11
13
|
|
|
12
|
-
var
|
|
14
|
+
var _Spinner = _interopRequireDefault(require("../../Spinner"));
|
|
15
|
+
|
|
16
|
+
var _excluded = ["children", "onClick", "full", "disabled", "inverted", "small", "secondary", "icon", "isLoading"];
|
|
17
|
+
|
|
18
|
+
var _templateObject;
|
|
13
19
|
|
|
14
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
21
|
|
|
@@ -21,7 +27,12 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
21
27
|
|
|
22
28
|
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; }
|
|
23
29
|
|
|
30
|
+
function _taggedTemplateLiteralLoose(strings, raw) { if (!raw) { raw = strings.slice(0); } strings.raw = raw; return strings; }
|
|
31
|
+
|
|
32
|
+
var SpinnerContainer = _styledComponents["default"].div(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n"])));
|
|
24
33
|
/** 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. */
|
|
34
|
+
|
|
35
|
+
|
|
25
36
|
var Button = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
26
37
|
var children = _ref.children,
|
|
27
38
|
onClick = _ref.onClick,
|
|
@@ -31,6 +42,7 @@ var Button = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
31
42
|
small = _ref.small,
|
|
32
43
|
secondary = _ref.secondary,
|
|
33
44
|
Icon = _ref.icon,
|
|
45
|
+
isLoading = _ref.isLoading,
|
|
34
46
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
35
47
|
|
|
36
48
|
var finalProps = _extends({}, props);
|
|
@@ -41,20 +53,28 @@ var Button = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
41
53
|
|
|
42
54
|
return /*#__PURE__*/_react["default"].createElement(_StyledButton["default"], _extends({
|
|
43
55
|
ref: ref,
|
|
44
|
-
disabled: disabled,
|
|
56
|
+
disabled: disabled || isLoading,
|
|
45
57
|
"aria-disabled": disabled,
|
|
46
58
|
full: full,
|
|
47
59
|
inverted: inverted,
|
|
48
60
|
onClick: onClick,
|
|
49
61
|
small: small,
|
|
50
|
-
secondary: secondary
|
|
51
|
-
|
|
62
|
+
secondary: secondary,
|
|
63
|
+
isLoading: isLoading
|
|
64
|
+
}, finalProps), Icon && /*#__PURE__*/_react["default"].createElement(Icon, {
|
|
65
|
+
role: "img"
|
|
66
|
+
}), children, isLoading && /*#__PURE__*/_react["default"].createElement(SpinnerContainer, null, /*#__PURE__*/_react["default"].createElement(_Spinner["default"], {
|
|
67
|
+
color: "deep",
|
|
68
|
+
size: small ? 'small' : 'medium'
|
|
69
|
+
})));
|
|
52
70
|
});
|
|
53
71
|
Button.propTypes = {
|
|
72
|
+
ariaLabel: _propTypes.string,
|
|
54
73
|
children: _propTypes.node,
|
|
55
74
|
disabled: _propTypes.bool,
|
|
56
75
|
full: _propTypes.bool,
|
|
57
76
|
inverted: _propTypes.bool,
|
|
77
|
+
isLoading: _propTypes.bool,
|
|
58
78
|
onClick: _propTypes.func,
|
|
59
79
|
small: _propTypes.bool,
|
|
60
80
|
secondary: _propTypes.bool,
|
|
@@ -64,10 +84,12 @@ Button.propTypes = {
|
|
|
64
84
|
href: _propTypes.string
|
|
65
85
|
};
|
|
66
86
|
Button.defaultProps = {
|
|
87
|
+
ariaLabel: undefined,
|
|
67
88
|
children: 'Button',
|
|
68
89
|
disabled: undefined,
|
|
69
90
|
full: false,
|
|
70
91
|
inverted: false,
|
|
92
|
+
isLoading: false,
|
|
71
93
|
onClick: function onClick() {},
|
|
72
94
|
small: false,
|
|
73
95
|
secondary: false,
|
package/cjs/Button/web/Icon.js
CHANGED
|
@@ -13,7 +13,9 @@ var _StyledButton = _interopRequireDefault(require("./StyledButton"));
|
|
|
13
13
|
|
|
14
14
|
var _Icon = _interopRequireDefault(require("../../Icon"));
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _Spinner = _interopRequireDefault(require("../../Spinner"));
|
|
17
|
+
|
|
18
|
+
var _excluded = ["icon", "theme", "small", "disabled", "isLoading"];
|
|
17
19
|
|
|
18
20
|
var _templateObject;
|
|
19
21
|
|
|
@@ -39,16 +41,22 @@ var ButtonIcon = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
|
|
|
39
41
|
button = _ref2.theme.yoga.components.button,
|
|
40
42
|
small = _ref2.small,
|
|
41
43
|
disabled = _ref2.disabled,
|
|
44
|
+
isLoading = _ref2.isLoading,
|
|
42
45
|
props = _objectWithoutPropertiesLoose(_ref2, _excluded);
|
|
43
46
|
|
|
44
47
|
return /*#__PURE__*/_react["default"].createElement(IconStyled, _extends({}, props, {
|
|
45
48
|
ref: ref,
|
|
46
49
|
small: small,
|
|
47
|
-
disabled: disabled,
|
|
48
|
-
"aria-disabled": disabled
|
|
49
|
-
|
|
50
|
+
disabled: disabled || isLoading,
|
|
51
|
+
"aria-disabled": disabled,
|
|
52
|
+
isLoading: isLoading
|
|
53
|
+
}), isLoading ? /*#__PURE__*/_react["default"].createElement(_Spinner["default"], {
|
|
54
|
+
color: "deep",
|
|
55
|
+
size: small ? 'small' : 'medium'
|
|
56
|
+
}) : /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
|
50
57
|
as: icon,
|
|
51
|
-
size: small ? button.icon.size.small : button.icon.size["default"]
|
|
58
|
+
size: small ? button.icon.size.small : button.icon.size["default"],
|
|
59
|
+
role: "img"
|
|
52
60
|
}));
|
|
53
61
|
});
|
|
54
62
|
ButtonIcon.propTypes = {
|
|
@@ -56,14 +64,16 @@ ButtonIcon.propTypes = {
|
|
|
56
64
|
disabled: _propTypes.bool,
|
|
57
65
|
secondary: _propTypes.bool,
|
|
58
66
|
inverted: _propTypes.bool,
|
|
59
|
-
icon: (0, _propTypes.oneOfType)([_propTypes.node, _propTypes.func])
|
|
67
|
+
icon: (0, _propTypes.oneOfType)([_propTypes.node, _propTypes.func]),
|
|
68
|
+
isLoading: _propTypes.bool
|
|
60
69
|
};
|
|
61
70
|
ButtonIcon.defaultProps = {
|
|
62
71
|
small: false,
|
|
63
72
|
disabled: undefined,
|
|
64
73
|
secondary: false,
|
|
65
74
|
inverted: false,
|
|
66
|
-
icon: undefined
|
|
75
|
+
icon: undefined,
|
|
76
|
+
isLoading: false
|
|
67
77
|
};
|
|
68
78
|
ButtonIcon.displayName = 'Button.Icon';
|
|
69
79
|
|
package/cjs/Button/web/Link.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports["default"] = void 0;
|
|
5
5
|
|
|
6
|
-
var _react =
|
|
6
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
7
7
|
|
|
8
8
|
var _propTypes = require("prop-types");
|
|
9
9
|
|
|
@@ -13,15 +13,15 @@ var _yogaCommon = require("@gympass/yoga-common");
|
|
|
13
13
|
|
|
14
14
|
var _Button = _interopRequireDefault(require("./Button"));
|
|
15
15
|
|
|
16
|
-
var _excluded = ["disabled"];
|
|
17
|
-
|
|
18
16
|
var _templateObject;
|
|
19
17
|
|
|
20
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
19
|
|
|
22
|
-
function
|
|
20
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
21
|
|
|
24
|
-
function
|
|
22
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
|
+
|
|
24
|
+
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); }
|
|
25
25
|
|
|
26
26
|
function _taggedTemplateLiteralLoose(strings, raw) { if (!raw) { raw = strings.slice(0); } strings.raw = raw; return strings; }
|
|
27
27
|
|
|
@@ -32,17 +32,20 @@ var Link = (0, _styledComponents["default"])(_Button["default"])(_templateObject
|
|
|
32
32
|
var state = secondary ? 'secondary' : 'primary';
|
|
33
33
|
return "\n height: unset;\n padding: 0;\n background-color: unset;\n border: none;\n border-radius: 0;\n color: " + button.types.link.font[state].color + ";\n\n svg {\n margin-right: " + button.types.link.icon.margin.right + "px;\n fill: " + button.types.link.font[state].color + ";\n }\n\n &:disabled,\n &:not([disabled]):hover,\n &:not([disabled]):focus,\n &:not([disabled]):active {\n box-shadow: unset;\n background-color: unset;\n }\n\n &:not([disabled]):hover {\n color: " + (0, _yogaCommon.hexToRgb)(button.types.link.font[state].color, 0.5) + ";\n\n svg {\n fill: " + (0, _yogaCommon.hexToRgb)(button.types.link.font[state].color, 0.5) + ";\n }\n }\n\n &:not([disabled]):focus, &:not([disabled]):active {\n color: " + (0, _yogaCommon.hexToRgb)(button.types.link.font[state].color, 0.75) + ";\n\n svg {\n fill: " + (0, _yogaCommon.hexToRgb)(button.types.link.font[state].color, 0.75) + ";\n }\n }\n\n &:disabled {\n color: " + button.types.link.font.disabled.color + ";\n\n svg {\n fill: " + button.types.link.font.disabled.color + ";\n }\n }\n\n " + (full ? 'width: 100%' : '') + "\n ";
|
|
34
34
|
});
|
|
35
|
+
var ButtonLink = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
|
|
36
|
+
var rest = _extends({}, _ref2);
|
|
35
37
|
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
var props = Object.fromEntries(Object.entries(rest).filter(function (_ref3) {
|
|
39
|
+
var key = _ref3[0];
|
|
40
|
+
return key !== 'isLoading';
|
|
41
|
+
}));
|
|
42
|
+
var disabled = props.disabled;
|
|
40
43
|
return /*#__PURE__*/_react["default"].createElement(Link, _extends({}, props, {
|
|
41
44
|
disabled: disabled,
|
|
42
|
-
"aria-disabled": disabled
|
|
45
|
+
"aria-disabled": disabled,
|
|
46
|
+
ref: ref
|
|
43
47
|
}));
|
|
44
|
-
};
|
|
45
|
-
|
|
48
|
+
});
|
|
46
49
|
ButtonLink.propTypes = {
|
|
47
50
|
disabled: _propTypes.bool,
|
|
48
51
|
secondary: _propTypes.bool,
|
|
@@ -18,11 +18,12 @@ function _taggedTemplateLiteralLoose(strings, raw) { if (!raw) { raw = strings.s
|
|
|
18
18
|
var ButtonOutline = (0, _styledComponents["default"])(_Button["default"])(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n ", "\n"])), function (_ref) {
|
|
19
19
|
var inverted = _ref.inverted,
|
|
20
20
|
secondary = _ref.secondary,
|
|
21
|
+
isLoading = _ref.isLoading,
|
|
21
22
|
_ref$theme$yoga = _ref.theme.yoga,
|
|
22
23
|
white = _ref$theme$yoga.colors.white,
|
|
23
24
|
outline = _ref$theme$yoga.components.button.types.outline;
|
|
24
25
|
var state = secondary ? 'secondary' : 'primary';
|
|
25
|
-
return "\n background-color: " + outline.backgroundColor["default"] + ";\n border: " + outline.border.width + "px solid;\n border-color: " + outline.font["default"][state].color + ";\n color: " + outline.font["default"][state].color + ";\n\n svg {\n fill: " + outline.font["default"][state].color + ";\n }\n\n &:not([disabled]):hover, &:not([disabled]):focus {\n background-color: " + outline.backgroundColor[state].hover + ";\n color: " + outline.font.hover.color + ";\n\n svg {\n fill: " + outline.font.hover.color + ";\n }\n }\n\n &:not([disabled]):active {\n background-color: " + outline.backgroundColor["default"] + ";\n border-color: " + outline.font.pressed[state].color + ";\n color: " + outline.font.pressed[state].color + ";\n box-shadow: none;\n\n svg {\n fill: " + outline.font.pressed[state].color + ";\n }\n }\n\n &:disabled {\n background-color: " + outline.backgroundColor["default"] + ";\n border-color: " + outline.font.disabled.color + ";\n color: " + outline.font.disabled.color + ";\n\n
|
|
26
|
+
return "\n background-color: " + outline.backgroundColor["default"] + ";\n border: " + outline.border.width + "px solid;\n border-color: " + outline.font["default"][state].color + ";\n color: " + outline.font["default"][state].color + ";\n\n svg {\n fill: " + outline.font["default"][state].color + ";\n }\n\n &:not([disabled]):hover, &:not([disabled]):focus {\n background-color: " + outline.backgroundColor[state].hover + ";\n color: " + outline.font.hover.color + ";\n\n svg {\n fill: " + outline.font.hover.color + ";\n }\n }\n\n &:not([disabled]):active {\n background-color: " + outline.backgroundColor["default"] + ";\n border-color: " + outline.font.pressed[state].color + ";\n color: " + outline.font.pressed[state].color + ";\n box-shadow: none;\n\n svg {\n fill: " + outline.font.pressed[state].color + ";\n }\n }\n\n &:disabled {\n background-color: " + outline.backgroundColor["default"] + ";\n border-color: " + outline.font.disabled.color + ";\n color: " + outline.font.disabled.color + ";\n\n svg {\n fill: " + outline.font.disabled.color + ";\n }\n }\n\n " + (inverted ? "\n border-color: " + white + ";\n color: " + white + ";\n\n svg {\n fill: " + white + ";\n }\n\n &:not([disabled]):hover, &:not([disabled]):focus {\n background-color: " + white + ";\n color: " + outline.font["default"][state].color + ";\n\n svg {\n fill: " + outline.font["default"][state].color + ";\n }\n }\n\n &:not([disabled]):active {\n background-color: " + outline.backgroundColor["default"] + ";\n border-color: " + (0, _yogaCommon.hexToRgb)(white, 0.75) + ";\n color: " + (0, _yogaCommon.hexToRgb)(white, 0.75) + ";\n\n svg {\n fill: " + (0, _yogaCommon.hexToRgb)(white, 0.75) + ";\n }\n }\n\n &:disabled {\n border-color: " + outline.font.disabled.color + ";\n color: " + outline.font.disabled.color + ";\n svg {\n fill: " + outline.font.disabled.color + ";\n }\n }\n " : '') + "\n\n " + (isLoading ? "\n &:disabled {\n color: transparent;\n\n svg {\n fill: transparent;\n }\n }\n " : '') + "\n ";
|
|
26
27
|
});
|
|
27
28
|
ButtonOutline.displayName = 'Button.Outline';
|
|
28
29
|
var _default = ButtonOutline;
|
|
@@ -19,11 +19,12 @@ var StyledButton = _styledComponents["default"].button(_templateObject || (_temp
|
|
|
19
19
|
inverted = _ref.inverted,
|
|
20
20
|
secondary = _ref.secondary,
|
|
21
21
|
disabled = _ref.disabled,
|
|
22
|
+
isLoading = _ref.isLoading,
|
|
22
23
|
_ref$theme$yoga = _ref.theme.yoga,
|
|
23
24
|
baseFont = _ref$theme$yoga.baseFont,
|
|
24
25
|
button = _ref$theme$yoga.components.button;
|
|
25
26
|
var state = secondary ? 'secondary' : 'primary';
|
|
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
|
|
27
|
+
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 " + (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\n " + (isLoading ? "\n position: relative;\n color: transparent;\n " : '') + "\n\n " + (isLoading && inverted || isLoading && disabled ? "\n svg {\n fill: transparent;\n }\n " : '') + "\n ";
|
|
27
28
|
});
|
|
28
29
|
|
|
29
30
|
var _default = StyledButton;
|
package/cjs/Button/web/Text.js
CHANGED
|
@@ -3,19 +3,29 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports["default"] = void 0;
|
|
5
5
|
|
|
6
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
7
|
+
|
|
6
8
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
7
9
|
|
|
8
10
|
var _yogaCommon = require("@gympass/yoga-common");
|
|
9
11
|
|
|
12
|
+
var _propTypes = require("prop-types");
|
|
13
|
+
|
|
10
14
|
var _Button = _interopRequireDefault(require("./Button"));
|
|
11
15
|
|
|
12
16
|
var _templateObject;
|
|
13
17
|
|
|
14
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
19
|
|
|
20
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
|
+
|
|
22
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
|
+
|
|
24
|
+
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); }
|
|
25
|
+
|
|
16
26
|
function _taggedTemplateLiteralLoose(strings, raw) { if (!raw) { raw = strings.slice(0); } strings.raw = raw; return strings; }
|
|
17
27
|
|
|
18
|
-
var
|
|
28
|
+
var StyledButton = (0, _styledComponents["default"])(_Button["default"])(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n ", "\n"])), function (_ref) {
|
|
19
29
|
var secondary = _ref.secondary,
|
|
20
30
|
inverted = _ref.inverted,
|
|
21
31
|
_ref$theme$yoga = _ref.theme.yoga,
|
|
@@ -24,6 +34,29 @@ var ButtonText = (0, _styledComponents["default"])(_Button["default"])(_template
|
|
|
24
34
|
var state = secondary ? 'secondary' : 'primary';
|
|
25
35
|
return "\n background-color: " + button.types.text.backgroundColor + ";\n border-color: " + button.types.text.backgroundColor + ";\n color: " + colors[state] + ";\n\n svg {\n fill: " + colors[state] + ";\n }\n\n &:not([disabled]):hover, &:not([disabled]):focus, &:not([disabled]):active {\n background-color: " + button.types.text.backgroundColor + ";\n box-shadow: none;\n }\n\n &:not([disabled]):hover {\n color: " + (0, _yogaCommon.hexToRgb)(colors[state], 0.5) + ";\n svg {\n fill: " + (0, _yogaCommon.hexToRgb)(colors[state], 0.5) + ";\n }\n }\n\n &:not([disabled]):focus, &:not([disabled]):active {\n color: " + (0, _yogaCommon.hexToRgb)(colors[state], 0.75) + ";\n svg {\n fill: " + (0, _yogaCommon.hexToRgb)(colors[state], 0.75) + ";\n }\n }\n\n " + (inverted ? "\n color: " + colors.white + ";\n svg {\n fill: " + colors.white + ";\n }\n\n &:not([disabled]):hover {\n color: " + (0, _yogaCommon.hexToRgb)(colors.white, 0.5) + ";\n svg {\n fill: " + (0, _yogaCommon.hexToRgb)(colors.white, 0.5) + ";\n }\n }\n\n &:not([disabled]):focus, &:not([disabled]):active {\n color: " + (0, _yogaCommon.hexToRgb)(colors.white, 0.75) + ";\n svg {\n fill: " + (0, _yogaCommon.hexToRgb)(colors.white, 0.75) + ";\n }\n }\n " : '') + "\n\n &:disabled {\n background-color: " + button.types.text.backgroundColor + ";\n border-color: " + button.types.text.backgroundColor + ";\n color: " + button.types.text.disabled + ";\n svg {\n fill: " + button.types.text.disabled + ";\n }\n }\n ";
|
|
26
36
|
});
|
|
37
|
+
var ButtonText = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
|
|
38
|
+
var rest = _extends({}, _ref2);
|
|
39
|
+
|
|
40
|
+
var props = Object.fromEntries(Object.entries(rest).filter(function (_ref3) {
|
|
41
|
+
var key = _ref3[0];
|
|
42
|
+
return key !== 'isLoading';
|
|
43
|
+
}));
|
|
44
|
+
var secondary = props.secondary,
|
|
45
|
+
inverted = props.inverted;
|
|
46
|
+
return /*#__PURE__*/_react["default"].createElement(StyledButton, _extends({}, props, {
|
|
47
|
+
secondary: secondary,
|
|
48
|
+
inverted: inverted,
|
|
49
|
+
ref: ref
|
|
50
|
+
}));
|
|
51
|
+
});
|
|
52
|
+
ButtonText.propTypes = {
|
|
53
|
+
inverted: _propTypes.bool,
|
|
54
|
+
secondary: _propTypes.bool
|
|
55
|
+
};
|
|
56
|
+
ButtonText.defaultProps = {
|
|
57
|
+
inverted: false,
|
|
58
|
+
secondary: false
|
|
59
|
+
};
|
|
27
60
|
ButtonText.displayName = 'Button.Text';
|
|
28
61
|
var _default = ButtonText;
|
|
29
62
|
exports["default"] = _default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports["default"] = void 0;
|
|
5
|
+
|
|
6
|
+
var _web = _interopRequireDefault(require("./web"));
|
|
7
|
+
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
9
|
+
|
|
10
|
+
var _default = _web["default"];
|
|
11
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports["default"] = void 0;
|
|
5
|
+
|
|
6
|
+
var _react = _interopRequireDefault(require("react"));
|
|
7
|
+
|
|
8
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = require("prop-types");
|
|
11
|
+
|
|
12
|
+
var _lodash = _interopRequireDefault(require("lodash.get"));
|
|
13
|
+
|
|
14
|
+
var _templateObject;
|
|
15
|
+
|
|
16
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
+
|
|
18
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
+
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
|
+
|
|
22
|
+
function _taggedTemplateLiteralLoose(strings, raw) { if (!raw) { raw = strings.slice(0); } strings.raw = raw; return strings; }
|
|
23
|
+
|
|
24
|
+
var StyledSpinner = _styledComponents["default"].span(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n ", "\n"])), function (_ref) {
|
|
25
|
+
var color = _ref.color,
|
|
26
|
+
size = _ref.size;
|
|
27
|
+
return "\n .spinner {\n display: inline-block;\n width: " + size + "px;\n height: " + size + "px;\n color: " + color + ";\n animation: 1.4s linear 0s infinite normal none running rotation;\n }\n .circular {\n display: block;\n height: 100%;\n width: 100%;\n }\n .path {\n stroke-dasharray: 80px, 200px;\n stroke-dashoffset: 0;\n -webkit-animation: 1.4s ease-in-out 0s infinite normal none running dash;\n animation: 1.6s ease-in-out 0s infinite normal none running dash;\n stroke-linecap: round;\n stroke: " + color + ";\n }\n @keyframes rotation {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n }\n @keyframes dash {\n 0% {\n stroke-dasharray: 1px, 200px;\n stroke-dashoffset: 0;\n }\n 50% {\n stroke-dasharray: 100px, 200px;\n stroke-dashoffset: -15px;\n }\n 100% {\n stroke-dasharray: 100px, 200px;\n stroke-dashoffset: -125px;\n }\n }\n ";
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
var Spinner = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, ref) {
|
|
31
|
+
var size = _ref2.size,
|
|
32
|
+
color = _ref2.color,
|
|
33
|
+
theme = _ref2.theme;
|
|
34
|
+
return /*#__PURE__*/_react["default"].createElement(StyledSpinner, {
|
|
35
|
+
color: (0, _lodash["default"])(theme.yoga.colors, color, color),
|
|
36
|
+
size: (0, _lodash["default"])(theme.yoga.spacing, size, size),
|
|
37
|
+
ref: ref,
|
|
38
|
+
"aria-label": "loading-icon"
|
|
39
|
+
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
40
|
+
className: "spinner"
|
|
41
|
+
}, /*#__PURE__*/_react["default"].createElement("svg", {
|
|
42
|
+
className: "circular",
|
|
43
|
+
viewBox: "22 22 44 44"
|
|
44
|
+
}, /*#__PURE__*/_react["default"].createElement("circle", {
|
|
45
|
+
className: "path",
|
|
46
|
+
fill: "none",
|
|
47
|
+
strokeWidth: "3.6",
|
|
48
|
+
cx: "44",
|
|
49
|
+
cy: "44",
|
|
50
|
+
r: "20.2"
|
|
51
|
+
}))));
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
var commonSizes = ['xxxsmall', 'xxsmall', 'xsmall', 'small', 'medium', 'large', 'xlarge', 'xxlarge', 'xxxlarge', 'huge', 'xhuge'];
|
|
55
|
+
Spinner.propTypes = {
|
|
56
|
+
size: (0, _propTypes.oneOfType)([(0, _propTypes.oneOf)(commonSizes), _propTypes.string, _propTypes.number]),
|
|
57
|
+
color: _propTypes.string
|
|
58
|
+
};
|
|
59
|
+
Spinner.defaultProps = {
|
|
60
|
+
size: 'medium',
|
|
61
|
+
color: 'primary'
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
var _default = (0, _styledComponents.withTheme)(Spinner);
|
|
65
|
+
|
|
66
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports["default"] = void 0;
|
|
5
|
+
|
|
6
|
+
var _Spinner = _interopRequireDefault(require("./Spinner"));
|
|
7
|
+
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
9
|
+
|
|
10
|
+
var _default = _Spinner["default"];
|
|
11
|
+
exports["default"] = _default;
|
package/cjs/Theme/theme/theme.js
CHANGED
|
@@ -71,6 +71,8 @@ var _SliderTheme = _interopRequireDefault(require("./../../Slider/Slider.theme.j
|
|
|
71
71
|
|
|
72
72
|
var _SnackbarTheme = _interopRequireDefault(require("./../../Snackbar/Snackbar.theme.js"));
|
|
73
73
|
|
|
74
|
+
var _SpinnerTheme = _interopRequireDefault(require("./../../Spinner/Spinner.theme.js"));
|
|
75
|
+
|
|
74
76
|
var _StepperTheme = _interopRequireDefault(require("./../../Stepper/Stepper.theme.js"));
|
|
75
77
|
|
|
76
78
|
var _TagTheme = _interopRequireDefault(require("./../../Tag/Tag.theme.js"));
|
|
@@ -117,6 +119,7 @@ var componentThemes = {
|
|
|
117
119
|
Skeleton$Skeleton: _SkeletonTheme["default"],
|
|
118
120
|
Slider$Slider: _SliderTheme["default"],
|
|
119
121
|
Snackbar$Snackbar: _SnackbarTheme["default"],
|
|
122
|
+
Spinner$Spinner: _SpinnerTheme["default"],
|
|
120
123
|
Stepper$Stepper: _StepperTheme["default"],
|
|
121
124
|
Tag$Tag: _TagTheme["default"],
|
|
122
125
|
Text$Text: _TextTheme["default"],
|
package/cjs/index.js
CHANGED
|
@@ -155,6 +155,10 @@ var _Popover = _interopRequireDefault(require("./Popover"));
|
|
|
155
155
|
|
|
156
156
|
exports.Popover = _Popover["default"];
|
|
157
157
|
|
|
158
|
+
var _Spinner = _interopRequireDefault(require("./Spinner"));
|
|
159
|
+
|
|
160
|
+
exports.Spinner = _Spinner["default"];
|
|
161
|
+
|
|
158
162
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
159
163
|
|
|
160
164
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
package/esm/Button/web/Button.js
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
|
-
var _excluded = ["children", "onClick", "full", "disabled", "inverted", "small", "secondary", "icon"];
|
|
1
|
+
var _excluded = ["children", "onClick", "full", "disabled", "inverted", "small", "secondary", "icon", "isLoading"];
|
|
2
|
+
|
|
3
|
+
var _templateObject;
|
|
2
4
|
|
|
3
5
|
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
6
|
|
|
5
7
|
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
8
|
|
|
9
|
+
function _taggedTemplateLiteralLoose(strings, raw) { if (!raw) { raw = strings.slice(0); } strings.raw = raw; return strings; }
|
|
10
|
+
|
|
7
11
|
import React, { forwardRef } from 'react';
|
|
8
12
|
import { func, node, oneOfType, bool, string } from 'prop-types';
|
|
13
|
+
import styled from 'styled-components';
|
|
9
14
|
import StyledButton from './StyledButton';
|
|
15
|
+
import Spinner from '../../Spinner';
|
|
16
|
+
var SpinnerContainer = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n"])));
|
|
10
17
|
/** 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
18
|
|
|
12
19
|
var Button = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
@@ -18,6 +25,7 @@ var Button = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
18
25
|
small = _ref.small,
|
|
19
26
|
secondary = _ref.secondary,
|
|
20
27
|
Icon = _ref.icon,
|
|
28
|
+
isLoading = _ref.isLoading,
|
|
21
29
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
22
30
|
|
|
23
31
|
var finalProps = _extends({}, props);
|
|
@@ -28,20 +36,28 @@ var Button = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
28
36
|
|
|
29
37
|
return /*#__PURE__*/React.createElement(StyledButton, _extends({
|
|
30
38
|
ref: ref,
|
|
31
|
-
disabled: disabled,
|
|
39
|
+
disabled: disabled || isLoading,
|
|
32
40
|
"aria-disabled": disabled,
|
|
33
41
|
full: full,
|
|
34
42
|
inverted: inverted,
|
|
35
43
|
onClick: onClick,
|
|
36
44
|
small: small,
|
|
37
|
-
secondary: secondary
|
|
38
|
-
|
|
45
|
+
secondary: secondary,
|
|
46
|
+
isLoading: isLoading
|
|
47
|
+
}, finalProps), Icon && /*#__PURE__*/React.createElement(Icon, {
|
|
48
|
+
role: "img"
|
|
49
|
+
}), children, isLoading && /*#__PURE__*/React.createElement(SpinnerContainer, null, /*#__PURE__*/React.createElement(Spinner, {
|
|
50
|
+
color: "deep",
|
|
51
|
+
size: small ? 'small' : 'medium'
|
|
52
|
+
})));
|
|
39
53
|
});
|
|
40
54
|
Button.propTypes = {
|
|
55
|
+
ariaLabel: string,
|
|
41
56
|
children: node,
|
|
42
57
|
disabled: bool,
|
|
43
58
|
full: bool,
|
|
44
59
|
inverted: bool,
|
|
60
|
+
isLoading: bool,
|
|
45
61
|
onClick: func,
|
|
46
62
|
small: bool,
|
|
47
63
|
secondary: bool,
|
|
@@ -51,10 +67,12 @@ Button.propTypes = {
|
|
|
51
67
|
href: string
|
|
52
68
|
};
|
|
53
69
|
Button.defaultProps = {
|
|
70
|
+
ariaLabel: undefined,
|
|
54
71
|
children: 'Button',
|
|
55
72
|
disabled: undefined,
|
|
56
73
|
full: false,
|
|
57
74
|
inverted: false,
|
|
75
|
+
isLoading: false,
|
|
58
76
|
onClick: function onClick() {},
|
|
59
77
|
small: false,
|
|
60
78
|
secondary: false,
|