@_nu/react-button
Advanced tools
+28
-3
@@ -0,17 +1,42 @@ | ||
| # [0.1.0](https://github.com/nu-system/react-button/compare/v0.0.9...v0.1.0) (2020-04-05) | ||
| ### Bug Fixes | ||
| * add test ([7e6c09b](https://github.com/nu-system/react-button/commit/7e6c09bbbccbe9a69ad65b2e92983294867f5d90)) | ||
| ### Features | ||
| * test ([a4179ca](https://github.com/nu-system/react-button/commit/a4179ca4b5c2f81c489b903d8651772ad9609494)) | ||
| * test api ([d20fa3c](https://github.com/nu-system/react-button/commit/d20fa3cbbb9215c767eb0b527d33ba6a72167d84)) | ||
| ## [0.0.9](https://github.com/nu-system/react-button/compare/v0.0.8...v0.0.9) (2020-03-15) | ||
| ### Bug Fixes | ||
| - fix class render way ([e5b4959](https://github.com/nu-system/react-button/commit/e5b49598539c48498a323487d535b9109b4203b9)) | ||
| * fix class render way ([e5b4959](https://github.com/nu-system/react-button/commit/e5b49598539c48498a323487d535b9109b4203b9)) | ||
| ## [0.0.8](https://github.com/nu-system/react-button/compare/v0.0.7...v0.0.8) (2020-03-15) | ||
| ## [0.0.7](https://github.com/nu-system/react-button/compare/e4dae1b172f00b9811e9755d3a49e61e5559d090...v0.0.7) (2020-03-15) | ||
| ### Bug Fixes | ||
| - 修改版本依赖 ([e4dae1b](https://github.com/nu-system/react-button/commit/e4dae1b172f00b9811e9755d3a49e61e5559d090)) | ||
| * 修改版本依赖 ([e4dae1b](https://github.com/nu-system/react-button/commit/e4dae1b172f00b9811e9755d3a49e61e5559d090)) | ||
| ### Features | ||
| - remove ui dependecy of button ([5e96db0](https://github.com/nu-system/react-button/commit/5e96db076c764f7d7fbc38ad820a0ea459a89985)) | ||
| * remove ui dependecy of button ([5e96db0](https://github.com/nu-system/react-button/commit/5e96db076c764f7d7fbc38ad820a0ea459a89985)) | ||
+18
-16
@@ -5,4 +5,4 @@ var _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; }; | ||
| import React, { Fragment } from "react"; | ||
| import PropTypes from "prop-types"; | ||
| import React, { Fragment } from 'react'; | ||
| import PropTypes from 'prop-types'; | ||
@@ -19,5 +19,5 @@ /** | ||
| var arrClassDefault = classDefault && classDefault.split ? classDefault.split(" ") : classDefault || []; | ||
| var arrClassIn = classIn && classIn.split ? classIn.split(" ") : classIn || []; | ||
| var arrClassVariant = ["_fill", "_ghost", "_link"]; | ||
| var arrClassDefault = classDefault && classDefault.split ? classDefault.split(' ') : classDefault || []; | ||
| var arrClassIn = classIn && classIn.split ? classIn.split(' ') : classIn || []; | ||
| var arrClassVariant = ['_fill', '_ghost', '_link']; | ||
| var arrClassNew = []; | ||
@@ -40,3 +40,3 @@ var variantClass = null; | ||
| !!variantClass && arrClassNew.push(variantClass); | ||
| return arrClassNew.join(" "); | ||
| return arrClassNew.join(' '); | ||
| }; | ||
@@ -46,11 +46,11 @@ | ||
| var _ref$className = _ref.className, | ||
| className = _ref$className === undefined ? "" : _ref$className, | ||
| className = _ref$className === undefined ? '' : _ref$className, | ||
| _ref$classNameDefault = _ref.classNameDefault, | ||
| classNameDefault = _ref$classNameDefault === undefined ? "nu_btn _fill" : _ref$classNameDefault, | ||
| classNameDefault = _ref$classNameDefault === undefined ? 'nu_btn _fill' : _ref$classNameDefault, | ||
| _ref$children = _ref.children, | ||
| children = _ref$children === undefined ? null : _ref$children, | ||
| _ref$Component = _ref.Component, | ||
| Component = _ref$Component === undefined ? "button" : _ref$Component, | ||
| Component = _ref$Component === undefined ? null : _ref$Component, | ||
| _ref$ComponentSub = _ref.ComponentSub, | ||
| ComponentSub = _ref$ComponentSub === undefined ? "span" : _ref$ComponentSub, | ||
| ComponentSub = _ref$ComponentSub === undefined ? 'span' : _ref$ComponentSub, | ||
| _ref$href = _ref.href, | ||
@@ -60,12 +60,14 @@ href = _ref$href === undefined ? null : _ref$href, | ||
| disabled = _ref$disabled === undefined ? false : _ref$disabled, | ||
| otherProps = _objectWithoutProperties(_ref, ["className", "classNameDefault", "children", "Component", "ComponentSub", "href", "disabled"]); | ||
| otherProps = _objectWithoutProperties(_ref, ['className', 'classNameDefault', 'children', 'Component', 'ComponentSub', 'href', 'disabled']); | ||
| var ComponentTag = !!href ? "a" : Component; | ||
| // if exist Component use component | ||
| // or ComponentTag rely on href | ||
| var ComponentTag = Component ? Component : !!href ? 'a' : 'button'; | ||
| var classNames = getClassNames(classNameDefault, className); | ||
| // only button got button type | ||
| if (ComponentTag === "button" && !otherProps.type) { | ||
| otherProps.type = "button"; | ||
| if (ComponentTag === 'button' && !otherProps.type) { | ||
| otherProps.type = 'button'; | ||
| } | ||
| // set the title of button | ||
| if (!otherProps.title && typeof children === "string") { | ||
| if (!otherProps.title && typeof children === 'string') { | ||
| otherProps.title = children; | ||
@@ -75,3 +77,3 @@ } | ||
| // subItem | ||
| var ComponentSubTag = ComponentSub && typeof children === "string" ? ComponentSub : Fragment; | ||
| var ComponentSubTag = ComponentSub && typeof children === 'string' ? ComponentSub : Fragment; | ||
@@ -78,0 +80,0 @@ return React.createElement( |
+19
-17
@@ -1,2 +0,2 @@ | ||
| "use strict"; | ||
| 'use strict'; | ||
@@ -8,7 +8,7 @@ exports.__esModule = true; | ||
| var _react = require("react"); | ||
| var _react = require('react'); | ||
| var _react2 = _interopRequireDefault(_react); | ||
| var _propTypes = require("prop-types"); | ||
| var _propTypes = require('prop-types'); | ||
@@ -31,5 +31,5 @@ var _propTypes2 = _interopRequireDefault(_propTypes); | ||
| var arrClassDefault = classDefault && classDefault.split ? classDefault.split(" ") : classDefault || []; | ||
| var arrClassIn = classIn && classIn.split ? classIn.split(" ") : classIn || []; | ||
| var arrClassVariant = ["_fill", "_ghost", "_link"]; | ||
| var arrClassDefault = classDefault && classDefault.split ? classDefault.split(' ') : classDefault || []; | ||
| var arrClassIn = classIn && classIn.split ? classIn.split(' ') : classIn || []; | ||
| var arrClassVariant = ['_fill', '_ghost', '_link']; | ||
| var arrClassNew = []; | ||
@@ -52,3 +52,3 @@ var variantClass = null; | ||
| !!variantClass && arrClassNew.push(variantClass); | ||
| return arrClassNew.join(" "); | ||
| return arrClassNew.join(' '); | ||
| }; | ||
@@ -58,11 +58,11 @@ | ||
| var _ref$className = _ref.className, | ||
| className = _ref$className === undefined ? "" : _ref$className, | ||
| className = _ref$className === undefined ? '' : _ref$className, | ||
| _ref$classNameDefault = _ref.classNameDefault, | ||
| classNameDefault = _ref$classNameDefault === undefined ? "nu_btn _fill" : _ref$classNameDefault, | ||
| classNameDefault = _ref$classNameDefault === undefined ? 'nu_btn _fill' : _ref$classNameDefault, | ||
| _ref$children = _ref.children, | ||
| children = _ref$children === undefined ? null : _ref$children, | ||
| _ref$Component = _ref.Component, | ||
| Component = _ref$Component === undefined ? "button" : _ref$Component, | ||
| Component = _ref$Component === undefined ? null : _ref$Component, | ||
| _ref$ComponentSub = _ref.ComponentSub, | ||
| ComponentSub = _ref$ComponentSub === undefined ? "span" : _ref$ComponentSub, | ||
| ComponentSub = _ref$ComponentSub === undefined ? 'span' : _ref$ComponentSub, | ||
| _ref$href = _ref.href, | ||
@@ -72,12 +72,14 @@ href = _ref$href === undefined ? null : _ref$href, | ||
| disabled = _ref$disabled === undefined ? false : _ref$disabled, | ||
| otherProps = _objectWithoutProperties(_ref, ["className", "classNameDefault", "children", "Component", "ComponentSub", "href", "disabled"]); | ||
| otherProps = _objectWithoutProperties(_ref, ['className', 'classNameDefault', 'children', 'Component', 'ComponentSub', 'href', 'disabled']); | ||
| var ComponentTag = !!href ? "a" : Component; | ||
| // if exist Component use component | ||
| // or ComponentTag rely on href | ||
| var ComponentTag = Component ? Component : !!href ? 'a' : 'button'; | ||
| var classNames = getClassNames(classNameDefault, className); | ||
| // only button got button type | ||
| if (ComponentTag === "button" && !otherProps.type) { | ||
| otherProps.type = "button"; | ||
| if (ComponentTag === 'button' && !otherProps.type) { | ||
| otherProps.type = 'button'; | ||
| } | ||
| // set the title of button | ||
| if (!otherProps.title && typeof children === "string") { | ||
| if (!otherProps.title && typeof children === 'string') { | ||
| otherProps.title = children; | ||
@@ -87,3 +89,3 @@ } | ||
| // subItem | ||
| var ComponentSubTag = ComponentSub && typeof children === "string" ? ComponentSub : _react.Fragment; | ||
| var ComponentSubTag = ComponentSub && typeof children === 'string' ? ComponentSub : _react.Fragment; | ||
@@ -90,0 +92,0 @@ return _react2.default.createElement( |
+3
-3
| { | ||
| "name": "@_nu/react-button", | ||
| "version": "0.1.0", | ||
| "version": "0.1.1", | ||
| "description": "No UI dependency Button of react", | ||
@@ -25,3 +25,3 @@ "main": "lib/index.js", | ||
| "clean": "nwb clean-module && nwb clean-demo", | ||
| "prepublishOnly": "npm run prettier && npm run build", | ||
| "prepublishOnly": "npm run build", | ||
| "start": "nwb serve-react-demo", | ||
@@ -32,3 +32,3 @@ "test": "jest", | ||
| "commitizenInit": "commitizen init cz-conventional-changelog --yarn --dev --exact", | ||
| "prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,md,json}'", | ||
| "prettier": "prettier --write 'src/*.{js,jsx,tsx,ts,less,md,json}'", | ||
| "precommit": "npm run prettier" | ||
@@ -35,0 +35,0 @@ }, |
+1
-1
@@ -121,3 +121,3 @@ # Button | ||
| // Custom | ||
| Button.defaultProps.component = Link; | ||
| Button.defaultProps.Component = Link; | ||
@@ -124,0 +124,0 @@ export default Button; |
16513
4.01%234
1.74%