@ntbjs/react-components 0.0.1-beta.8 → 1.0.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.
@@ -0,0 +1,43 @@
1
+ 'use strict';
2
+
3
+ var defaultTheme = require('./defaultTheme-870f7df1.js');
4
+ var React = require('react');
5
+ var styled = require('styled-components');
6
+
7
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
+
9
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
10
+ var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
11
+
12
+ var _templateObject, _templateObject2;
13
+ var ActionButton$1 = styled__default['default'].button.attrs(defaultTheme.applyDefaultTheme)(_templateObject || (_templateObject = defaultTheme._taggedTemplateLiteral(["\n display: inline-flex;\n justify-content: center;\n align-items: center;\n border-radius: 50%;\n height: 40px;\n width: 40px;\n border: 0;\n color: inherit;\n background-color: transparent;\n ", "\n background-position: center;\n background-repeat: no-repeat;\n background-size: 0 0;\n transition: background-size 250ms ease;\n cursor: pointer;\n\n ", "\n\n &:disabled {\n opacity: 0.5;\n color: inherit;\n cursor: not-allowed;\n }\n\n svg {\n width: 100%;\n max-height: 20px;\n max-width: 20px;\n pointer-events: none;\n transition: color 250ms;\n }\n"])), function (props) {
14
+ return props.theme.themeProp('background-image', "radial-gradient(circle at center, ".concat(props.theme.getColor('gray-600'), " 50%, transparent 50%)"), "radial-gradient(circle at center, ".concat(props.theme.getColor('gray-200'), " 50%, transparent 50%)"));
15
+ }, function (props) {
16
+ return styled.css(_templateObject2 || (_templateObject2 = defaultTheme._taggedTemplateLiteral(["\n ", ":not(:disabled) {\n background-size: 200% 200%;\n\n svg {\n ", ";\n }\n }\n "])), props.active ? '' : ':hover', function (props) {
17
+ return props.theme.themeProp('color', props.theme.getColor('gray-100'), props.theme.getColor('gray-700'));
18
+ });
19
+ });
20
+
21
+ var ActionButton = React__default['default'].forwardRef(function ActionButton(_ref, forwardedRef) {
22
+ var icon = _ref.icon,
23
+ disabled = _ref.disabled,
24
+ active = _ref.active,
25
+ onClick = _ref.onClick,
26
+ props = defaultTheme._objectWithoutProperties(_ref, ["icon", "disabled", "active", "onClick"]);
27
+
28
+ return React__default['default'].createElement(ActionButton$1, defaultTheme._extends({
29
+ ref: forwardedRef,
30
+ disabled: disabled,
31
+ active: active,
32
+ onClick: onClick
33
+ }, props), icon);
34
+ });
35
+ ActionButton.propTypes = process.env.NODE_ENV !== "production" ? {
36
+ icon: defaultTheme.PropTypes.element.isRequired,
37
+ disabled: defaultTheme.PropTypes.bool,
38
+ active: defaultTheme.PropTypes.bool,
39
+ onClick: defaultTheme.PropTypes.func
40
+ } : {};
41
+ ActionButton.defaultProps = {};
42
+
43
+ exports.ActionButton = ActionButton;