@_nu/react-button
Advanced tools
+11
-0
@@ -6,2 +6,13 @@ # Change Log | ||
| ## [1.4.1](https://github.com/nu-system/react-button/compare/@_nu/react-button@1.4.0...@_nu/react-button@1.4.1) (2020-07-04) | ||
| ### Bug Fixes | ||
| * change component => Component ([dd4b8b8](https://github.com/nu-system/react-button/commit/dd4b8b8846e63447c7c5c15f405eb4b44ece3af0)) | ||
| # [1.4.0](https://github.com/nu-system/react-button/compare/@_nu/react-button@1.3.1...@_nu/react-button@1.4.0) (2020-07-03) | ||
@@ -8,0 +19,0 @@ |
+1
-1
@@ -5,3 +5,3 @@ import * as React from 'react'; | ||
| href?: string; | ||
| component?: React.ReactNode | React.Component; | ||
| Component?: React.ReactNode | React.Component; | ||
| children?: React.ReactNode; | ||
@@ -8,0 +8,0 @@ } |
+11
-11
@@ -7,4 +7,4 @@ function _extends() { _extends = Object.assign || 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); } | ||
| import React from "react"; | ||
| import PropTypes from "prop-types"; | ||
| import React from 'react'; | ||
| import PropTypes from 'prop-types'; | ||
| /** | ||
@@ -16,5 +16,5 @@ * Button | ||
| var NuButton = React.forwardRef(function NuButton(_ref, ref) { | ||
| var component = _ref.component, | ||
| var Component = _ref.Component, | ||
| onBeforeReturn = _ref.onBeforeReturn, | ||
| otherProps = _objectWithoutProperties(_ref, ["component", "onBeforeReturn"]); | ||
| otherProps = _objectWithoutProperties(_ref, ["Component", "onBeforeReturn"]); | ||
@@ -28,15 +28,15 @@ var href = otherProps.href, | ||
| var ComponentTag = component ? component : href ? "a" : "button"; // only button got button type | ||
| var ComponentTag = Component ? Component : href ? 'a' : 'button'; // only button got button type | ||
| if (ComponentTag === "button" && !type) { | ||
| otherProps.type = "button"; | ||
| if (ComponentTag === 'button' && !type) { | ||
| otherProps.type = 'button'; | ||
| } // Got role attr when ComponentTag is not button | ||
| if (ComponentTag !== "button" && !role) { | ||
| otherProps.role = "button"; | ||
| if (ComponentTag !== 'button' && !role) { | ||
| otherProps.role = 'button'; | ||
| } // set the title of button | ||
| if (typeof children === "string" && !title) { | ||
| if (typeof children === 'string' && !title) { | ||
| otherProps.title = children; | ||
@@ -65,4 +65,4 @@ } // on before component return | ||
| /** shell of button */ | ||
| component: PropTypes.oneOfType([PropTypes.node, PropTypes.elementType]) | ||
| Component: PropTypes.oneOfType([PropTypes.node, PropTypes.elementType]) | ||
| }; | ||
| export default NuButton; |
+1
-1
@@ -5,3 +5,3 @@ import * as React from 'react'; | ||
| href?: string; | ||
| component?: React.ReactNode | React.Component; | ||
| Component?: React.ReactNode | React.Component; | ||
| children?: React.ReactNode; | ||
@@ -8,0 +8,0 @@ } |
+9
-9
@@ -25,5 +25,5 @@ "use strict"; | ||
| var NuButton = _react.default.forwardRef(function NuButton(_ref, ref) { | ||
| var component = _ref.component, | ||
| var Component = _ref.Component, | ||
| onBeforeReturn = _ref.onBeforeReturn, | ||
| otherProps = _objectWithoutProperties(_ref, ["component", "onBeforeReturn"]); | ||
| otherProps = _objectWithoutProperties(_ref, ["Component", "onBeforeReturn"]); | ||
@@ -37,15 +37,15 @@ var href = otherProps.href, | ||
| var ComponentTag = component ? component : href ? "a" : "button"; // only button got button type | ||
| var ComponentTag = Component ? Component : href ? 'a' : 'button'; // only button got button type | ||
| if (ComponentTag === "button" && !type) { | ||
| otherProps.type = "button"; | ||
| if (ComponentTag === 'button' && !type) { | ||
| otherProps.type = 'button'; | ||
| } // Got role attr when ComponentTag is not button | ||
| if (ComponentTag !== "button" && !role) { | ||
| otherProps.role = "button"; | ||
| if (ComponentTag !== 'button' && !role) { | ||
| otherProps.role = 'button'; | ||
| } // set the title of button | ||
| if (typeof children === "string" && !title) { | ||
| if (typeof children === 'string' && !title) { | ||
| otherProps.title = children; | ||
@@ -75,5 +75,5 @@ } // on before component return | ||
| /** shell of button */ | ||
| component: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.elementType]) | ||
| Component: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.elementType]) | ||
| }; | ||
| var _default = NuButton; | ||
| exports.default = _default; |
+2
-2
| { | ||
| "name": "@_nu/react-button", | ||
| "version": "1.4.0", | ||
| "version": "1.4.1", | ||
| "description": "No UI dependency Button of react", | ||
@@ -50,3 +50,3 @@ "main": "lib/index.js", | ||
| }, | ||
| "gitHead": "d4e99d9c3c20458f9dbea85346ec2520fe434703" | ||
| "gitHead": "3a0c1bfa5649e05c0883e4464a69f0e74261add8" | ||
| } |
+1
-1
@@ -66,3 +66,3 @@ # Button | ||
| | href | string | ' ' | href for `a` | | ||
| | component | string | func | object | 'button' | tagName | | ||
| | Component | string | func | object | 'button' | tagName | | ||
@@ -69,0 +69,0 @@ ```JSX |
+1
-1
@@ -5,3 +5,3 @@ import * as React from 'react'; | ||
| href?: string; | ||
| component?: React.ReactNode | React.Component; | ||
| Component?: React.ReactNode | React.Component; | ||
| children?: React.ReactNode; | ||
@@ -8,0 +8,0 @@ } |
+14
-11
@@ -1,3 +0,3 @@ | ||
| import React from "react"; | ||
| import PropTypes from "prop-types"; | ||
| import React from 'react'; | ||
| import PropTypes from 'prop-types'; | ||
@@ -8,3 +8,6 @@ /** | ||
| */ | ||
| const NuButton = React.forwardRef(function NuButton({ component, onBeforeReturn, ...otherProps }, ref) { | ||
| const NuButton = React.forwardRef(function NuButton( | ||
| { Component, onBeforeReturn, ...otherProps }, | ||
| ref, | ||
| ) { | ||
| const { href, role, type, children, title } = otherProps; | ||
@@ -14,16 +17,16 @@ | ||
| // or ComponentTag rely on href | ||
| const ComponentTag = component ? component : href ? "a" : "button"; | ||
| const ComponentTag = Component ? Component : href ? 'a' : 'button'; | ||
| // only button got button type | ||
| if (ComponentTag === "button" && !type) { | ||
| otherProps.type = "button"; | ||
| if (ComponentTag === 'button' && !type) { | ||
| otherProps.type = 'button'; | ||
| } | ||
| // Got role attr when ComponentTag is not button | ||
| if (ComponentTag !== "button" && !role) { | ||
| otherProps.role = "button"; | ||
| if (ComponentTag !== 'button' && !role) { | ||
| otherProps.role = 'button'; | ||
| } | ||
| // set the title of button | ||
| if (typeof children === "string" && !title) { | ||
| if (typeof children === 'string' && !title) { | ||
| otherProps.title = children; | ||
@@ -39,3 +42,3 @@ } | ||
| /** on before component return */ | ||
| onBeforeReturn: (props) => props | ||
| onBeforeReturn: (props) => props, | ||
| }; | ||
@@ -49,5 +52,5 @@ | ||
| /** shell of button */ | ||
| component: PropTypes.oneOfType([PropTypes.node, PropTypes.elementType]) | ||
| Component: PropTypes.oneOfType([PropTypes.node, PropTypes.elementType]), | ||
| }; | ||
| export default NuButton; |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
26248
1.12%359
0.84%0
-100%