@n3/react-button
Advanced tools
| ## 0.1.1 (27 марта 2020) | ||
| ### Улучшения | ||
| * forwardRef |
+8
-12
| import _extends from "@babel/runtime/helpers/extends"; | ||
| import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; | ||
| import React, { memo, useCallback } from 'react'; | ||
| import React, { memo, useCallback, forwardRef } from 'react'; | ||
| import PropTypes from 'prop-types'; | ||
@@ -56,7 +56,2 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; | ||
| /** | ||
| * Передать ли disabled отрендеренному компоненту кнопки | ||
| */ | ||
| setDisabledProp: PropTypes.bool, | ||
| /** | ||
| * Не отображать закругления слева | ||
@@ -95,3 +90,2 @@ */ | ||
| pressed: false, | ||
| setDisabledProp: true, | ||
| flatLeft: false, | ||
@@ -104,7 +98,7 @@ flatRight: false, | ||
| }; | ||
| var loadingIcon = React.createElement(StyledLoader, null, React.createElement(FontAwesomeIcon, { | ||
| var loadingIcon = /*#__PURE__*/React.createElement(StyledLoader, null, /*#__PURE__*/React.createElement(FontAwesomeIcon, { | ||
| icon: "spinner", | ||
| pulse: true | ||
| })); | ||
| var Button = memo(function (_ref) { | ||
| var Button = memo(forwardRef(function (_ref, ref) { | ||
| var color = _ref.color, | ||
@@ -133,5 +127,7 @@ size = _ref.size, | ||
| return React.createElement(ButtonComponent, rest); | ||
| return /*#__PURE__*/React.createElement(ButtonComponent, _extends({ | ||
| ref: ref | ||
| }, rest)); | ||
| }, [ButtonComponent]); | ||
| return React.createElement(StyledButton, _extends({ | ||
| return /*#__PURE__*/React.createElement(StyledButton, _extends({ | ||
| as: as, | ||
@@ -149,3 +145,3 @@ color: color, | ||
| }, componentProps), loading && loadingIcon, children); | ||
| }); | ||
| })); | ||
| Button.displayName = 'Button'; | ||
@@ -152,0 +148,0 @@ Button.propTypes = buttonPropTypes; |
+7
-11
@@ -85,7 +85,2 @@ "use strict"; | ||
| /** | ||
| * Передать ли disabled отрендеренному компоненту кнопки | ||
| */ | ||
| setDisabledProp: _propTypes.default.bool, | ||
| /** | ||
| * Не отображать закругления слева | ||
@@ -125,3 +120,2 @@ */ | ||
| pressed: false, | ||
| setDisabledProp: true, | ||
| flatLeft: false, | ||
@@ -135,3 +129,3 @@ flatRight: false, | ||
| var loadingIcon = _react.default.createElement(_style.StyledLoader, null, _react.default.createElement(_reactFontawesome.FontAwesomeIcon, { | ||
| var loadingIcon = /*#__PURE__*/_react.default.createElement(_style.StyledLoader, null, /*#__PURE__*/_react.default.createElement(_reactFontawesome.FontAwesomeIcon, { | ||
| icon: "spinner", | ||
@@ -141,3 +135,3 @@ pulse: true | ||
| var Button = (0, _react.memo)(function (_ref) { | ||
| var Button = (0, _react.memo)((0, _react.forwardRef)(function (_ref, ref) { | ||
| var color = _ref.color, | ||
@@ -165,5 +159,7 @@ size = _ref.size, | ||
| rest = (0, _objectWithoutProperties2.default)(_ref2, ["color", "size", "isLoading", "isPressed", "isFlatLeft", "isFlatRight", "isOnlyIcon"]); | ||
| return _react.default.createElement(ButtonComponent, rest); | ||
| return /*#__PURE__*/_react.default.createElement(ButtonComponent, (0, _extends2.default)({ | ||
| ref: ref | ||
| }, rest)); | ||
| }, [ButtonComponent]); | ||
| return _react.default.createElement(_style.StyledButton, (0, _extends2.default)({ | ||
| return /*#__PURE__*/_react.default.createElement(_style.StyledButton, (0, _extends2.default)({ | ||
| as: as, | ||
@@ -181,3 +177,3 @@ color: color, | ||
| }, componentProps), loading && loadingIcon, children); | ||
| }); | ||
| })); | ||
| Button.displayName = 'Button'; | ||
@@ -184,0 +180,0 @@ Button.propTypes = buttonPropTypes; |
+3
-3
| { | ||
| "name": "@n3/react-button", | ||
| "version": "0.1.0", | ||
| "version": "0.1.1", | ||
| "description": "Button component for react applications based on @n3/kit", | ||
@@ -25,6 +25,6 @@ "main": "lib/index.js", | ||
| "dependencies": { | ||
| "@babel/runtime": "^7.8.4", | ||
| "@babel/runtime": "^7.9.2", | ||
| "@fortawesome/fontawesome-svg-core": "^1.2.27", | ||
| "@fortawesome/free-solid-svg-icons": "^5.12.1", | ||
| "@fortawesome/react-fontawesome": "^0.1.8", | ||
| "@fortawesome/react-fontawesome": "^0.1.9", | ||
| "@n3/css-base": "^0.1.0", | ||
@@ -31,0 +31,0 @@ "prop-types": "^15.7.2", |
+0
-1
@@ -26,3 +26,2 @@ # @n3/react-button | ||
| | pressed | | bool | `false` | Кнопка зажата | | ||
| | setDisabledProp | | bool | `true` | Передать ли disabled отрендеренному компоненту кнопки | | ||
| | flatLeft | | bool | `false` | Не отображать закругления слева | | ||
@@ -29,0 +28,0 @@ | flatRight | | bool | `false` | Не отображать закругления справа | |
17
6.25%40502
-0.43%736
-0.81%52
-1.89%