@hig/button
Advanced tools
Comparing version 2.0.1 to 3.0.0
@@ -1,2 +0,2 @@ | ||
import React, { Component } from 'react'; | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
@@ -240,106 +240,84 @@ import { css, cx } from 'emotion'; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _this = undefined; | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
var ButtonPresenter = function ButtonPresenter(props) { | ||
var disabled = props.disabled, | ||
hasFocus = props.hasFocus, | ||
hasHover = props.hasHover, | ||
isPressed = props.isPressed, | ||
icon = props.icon, | ||
link = props.link, | ||
onBlur = props.onBlur, | ||
onClick = props.onClick, | ||
onFocus = props.onFocus, | ||
onHover = props.onHover, | ||
onMouseDown = props.onMouseDown, | ||
onMouseEnter = props.onMouseEnter, | ||
onMouseLeave = props.onMouseLeave, | ||
onMouseUp = props.onMouseUp, | ||
customStylesheet = props.stylesheet, | ||
target = props.target, | ||
title = props.title, | ||
type = props.type, | ||
width = props.width, | ||
otherProps = _objectWithoutProperties(props, ["disabled", "hasFocus", "hasHover", "isPressed", "icon", "link", "onBlur", "onClick", "onFocus", "onHover", "onMouseDown", "onMouseEnter", "onMouseLeave", "onMouseUp", "stylesheet", "target", "title", "type", "width"]); | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
var className = otherProps.className, | ||
htmlTabIndex = otherProps.tabIndex; | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var ButtonPresenter = function (_Component) { | ||
_inherits(ButtonPresenter, _Component); | ||
var href = link || undefined; | ||
var tabIndex = disabled ? "-1" : htmlTabIndex || "0"; | ||
var Wrapper = link ? "a" : "button"; | ||
var wrapperTarget = link ? target : undefined; | ||
var iconClassName = createCustomClassNames(className, "icon"); | ||
var iconTextClassName = createCustomClassNames(className, "icon-text"); | ||
function ButtonPresenter() { | ||
_classCallCheck(this, ButtonPresenter); | ||
return React.createElement( | ||
ThemeContext.Consumer, | ||
null, | ||
function (_ref) { | ||
var resolvedRoles = _ref.resolvedRoles, | ||
metadata = _ref.metadata; | ||
return _possibleConstructorReturn(this, (ButtonPresenter.__proto__ || Object.getPrototypeOf(ButtonPresenter)).apply(this, arguments)); | ||
} | ||
var styles = stylesheet({ disabled: disabled, hasFocus: hasFocus, hasHover: hasHover, isPressed: isPressed, type: type, width: width }, resolvedRoles, metadata); | ||
var cssStyles = customStylesheet ? customStylesheet(styles, _this.props, resolvedRoles, metadata) : styles; | ||
_createClass(ButtonPresenter, [{ | ||
key: "render", | ||
value: function render() { | ||
var _this2 = this; | ||
var _props = this.props, | ||
disabled = _props.disabled, | ||
hasFocus = _props.hasFocus, | ||
hasHover = _props.hasHover, | ||
isPressed = _props.isPressed, | ||
icon = _props.icon, | ||
link = _props.link, | ||
onBlur = _props.onBlur, | ||
onClick = _props.onClick, | ||
onFocus = _props.onFocus, | ||
onHover = _props.onHover, | ||
onMouseDown = _props.onMouseDown, | ||
onMouseEnter = _props.onMouseEnter, | ||
onMouseLeave = _props.onMouseLeave, | ||
onMouseUp = _props.onMouseUp, | ||
customStylesheet = _props.stylesheet, | ||
target = _props.target, | ||
title = _props.title, | ||
type = _props.type, | ||
width = _props.width, | ||
otherProps = _objectWithoutProperties(_props, ["disabled", "hasFocus", "hasHover", "isPressed", "icon", "link", "onBlur", "onClick", "onFocus", "onHover", "onMouseDown", "onMouseEnter", "onMouseLeave", "onMouseUp", "stylesheet", "target", "title", "type", "width"]); | ||
var className = otherProps.className, | ||
htmlTabIndex = otherProps.tabIndex; | ||
var href = link || undefined; | ||
var tabIndex = disabled ? "-1" : htmlTabIndex || "0"; | ||
var Wrapper = link ? "a" : "button"; | ||
var wrapperTarget = link ? target : undefined; | ||
var iconClassName = createCustomClassNames(className, "icon"); | ||
var iconTextClassName = createCustomClassNames(className, "icon-text"); | ||
return React.createElement( | ||
ThemeContext.Consumer, | ||
null, | ||
function (_ref) { | ||
var resolvedRoles = _ref.resolvedRoles, | ||
metadata = _ref.metadata; | ||
var styles = stylesheet({ disabled: disabled, hasFocus: hasFocus, hasHover: hasHover, isPressed: isPressed, type: type, width: width }, resolvedRoles, metadata); | ||
var cssStyles = customStylesheet ? customStylesheet(styles, _this2.props, resolvedRoles, metadata) : styles; | ||
return React.createElement( | ||
Wrapper, | ||
_extends$1({}, otherProps, { | ||
className: cx(css(cssStyles.button), className), | ||
href: href, | ||
tabIndex: tabIndex, | ||
target: wrapperTarget, | ||
onBlur: onBlur, | ||
onClick: onClick, | ||
onFocus: onFocus, | ||
onMouseDown: onMouseDown, | ||
onMouseEnter: onMouseEnter, | ||
onMouseLeave: onMouseLeave, | ||
onMouseOver: onHover, | ||
onMouseUp: onMouseUp, | ||
disabled: disabled | ||
}), | ||
icon && React.createElement( | ||
"span", | ||
{ className: cx(css(cssStyles.icon), iconClassName) }, | ||
icon | ||
), | ||
React.createElement( | ||
"span", | ||
{ | ||
className: icon ? cx(css(cssStyles.iconText), iconTextClassName) : "" | ||
}, | ||
title | ||
) | ||
); | ||
} | ||
Wrapper, | ||
_extends$1({}, otherProps, { | ||
className: cx(css(cssStyles.button), className), | ||
href: href, | ||
tabIndex: tabIndex, | ||
target: wrapperTarget, | ||
onBlur: onBlur, | ||
onClick: onClick, | ||
onFocus: onFocus, | ||
onMouseDown: onMouseDown, | ||
onMouseEnter: onMouseEnter, | ||
onMouseLeave: onMouseLeave, | ||
onMouseOver: onHover, | ||
onMouseUp: onMouseUp, | ||
disabled: disabled | ||
}), | ||
icon && React.createElement( | ||
"span", | ||
{ className: cx(css(cssStyles.icon), iconClassName) }, | ||
icon | ||
), | ||
React.createElement( | ||
"span", | ||
{ | ||
className: icon ? cx(css(cssStyles.iconText), iconTextClassName) : "" | ||
}, | ||
title | ||
) | ||
); | ||
} | ||
}]); | ||
); | ||
}; | ||
return ButtonPresenter; | ||
}(Component); | ||
ButtonPresenter.displayName = "ButtonPresenter"; | ||
@@ -515,92 +493,76 @@ ButtonPresenter.propTypes = { | ||
var _createClass$1 = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _objectWithoutProperties$1(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
var Button = function Button(props) { | ||
var disabled = props.disabled, | ||
icon = props.icon, | ||
link = props.link, | ||
onBlur = props.onBlur, | ||
onClick = props.onClick, | ||
onFocus = props.onFocus, | ||
onHover = props.onHover, | ||
onMouseDown = props.onMouseDown, | ||
onMouseEnter = props.onMouseEnter, | ||
onMouseLeave = props.onMouseLeave, | ||
onMouseUp = props.onMouseUp, | ||
stylesheet = props.stylesheet, | ||
target = props.target, | ||
title = props.title, | ||
type = props.type, | ||
width = props.width, | ||
otherProps = _objectWithoutProperties$1(props, ["disabled", "icon", "link", "onBlur", "onClick", "onFocus", "onHover", "onMouseDown", "onMouseEnter", "onMouseLeave", "onMouseUp", "stylesheet", "target", "title", "type", "width"]); | ||
function _possibleConstructorReturn$1(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
return React.createElement( | ||
ControlBehavior, | ||
{ | ||
onBlur: onBlur, | ||
onFocus: onFocus, | ||
onMouseDown: onMouseDown, | ||
onMouseEnter: onMouseEnter, | ||
onMouseLeave: onMouseLeave, | ||
onMouseUp: onMouseUp | ||
}, | ||
function (_ref) { | ||
var hasFocus = _ref.hasFocus, | ||
hasHover = _ref.hasHover, | ||
isPressed = _ref.isPressed, | ||
handleBlur = _ref.onBlur, | ||
handleFocus = _ref.onFocus, | ||
handleMouseDown = _ref.onMouseDown, | ||
handleMouseEnter = _ref.onMouseEnter, | ||
handleMouseLeave = _ref.onMouseLeave, | ||
handleMouseUp = _ref.onMouseUp; | ||
return React.createElement(ButtonPresenter, _extends$2({ | ||
disabled: disabled, | ||
hasFocus: hasFocus, | ||
hasHover: hasHover, | ||
isPressed: isPressed, | ||
icon: icon, | ||
link: link, | ||
onBlur: handleBlur, | ||
onClick: onClick, | ||
onFocus: handleFocus, | ||
onHover: onHover, | ||
onMouseDown: handleMouseDown, | ||
onMouseEnter: handleMouseEnter, | ||
onMouseLeave: handleMouseLeave, | ||
onMouseUp: handleMouseUp, | ||
stylesheet: stylesheet, | ||
target: target, | ||
title: title, | ||
type: type, | ||
width: width | ||
}, otherProps)); | ||
} | ||
); | ||
}; | ||
function _inherits$1(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
Button.displayName = "Button"; | ||
var Button = function (_Component) { | ||
_inherits$1(Button, _Component); | ||
Button.defaultProps = { | ||
disabled: false, | ||
type: types.SOLID, | ||
width: widths.SHRINK | ||
}; | ||
function Button() { | ||
_classCallCheck$1(this, Button); | ||
return _possibleConstructorReturn$1(this, (Button.__proto__ || Object.getPrototypeOf(Button)).apply(this, arguments)); | ||
} | ||
_createClass$1(Button, [{ | ||
key: "render", | ||
value: function render() { | ||
var _props = this.props, | ||
disabled = _props.disabled, | ||
icon = _props.icon, | ||
link = _props.link, | ||
onBlur = _props.onBlur, | ||
onClick = _props.onClick, | ||
onFocus = _props.onFocus, | ||
onHover = _props.onHover, | ||
onMouseDown = _props.onMouseDown, | ||
onMouseEnter = _props.onMouseEnter, | ||
onMouseLeave = _props.onMouseLeave, | ||
onMouseUp = _props.onMouseUp, | ||
stylesheet = _props.stylesheet, | ||
target = _props.target, | ||
title = _props.title, | ||
type = _props.type, | ||
width = _props.width, | ||
otherProps = _objectWithoutProperties$1(_props, ["disabled", "icon", "link", "onBlur", "onClick", "onFocus", "onHover", "onMouseDown", "onMouseEnter", "onMouseLeave", "onMouseUp", "stylesheet", "target", "title", "type", "width"]); | ||
return React.createElement( | ||
ControlBehavior, | ||
{ | ||
onBlur: onBlur, | ||
onFocus: onFocus, | ||
onMouseDown: onMouseDown, | ||
onMouseEnter: onMouseEnter, | ||
onMouseLeave: onMouseLeave, | ||
onMouseUp: onMouseUp | ||
}, | ||
function (_ref) { | ||
var hasFocus = _ref.hasFocus, | ||
hasHover = _ref.hasHover, | ||
isPressed = _ref.isPressed, | ||
handleBlur = _ref.onBlur, | ||
handleFocus = _ref.onFocus, | ||
handleMouseDown = _ref.onMouseDown, | ||
handleMouseEnter = _ref.onMouseEnter, | ||
handleMouseLeave = _ref.onMouseLeave, | ||
handleMouseUp = _ref.onMouseUp; | ||
return React.createElement(ButtonPresenter, _extends$2({ | ||
disabled: disabled, | ||
hasFocus: hasFocus, | ||
hasHover: hasHover, | ||
isPressed: isPressed, | ||
icon: icon, | ||
link: link, | ||
onBlur: handleBlur, | ||
onClick: onClick, | ||
onFocus: handleFocus, | ||
onHover: onHover, | ||
onMouseDown: handleMouseDown, | ||
onMouseEnter: handleMouseEnter, | ||
onMouseLeave: handleMouseLeave, | ||
onMouseUp: handleMouseUp, | ||
stylesheet: stylesheet, | ||
target: target, | ||
title: title, | ||
type: type, | ||
width: width | ||
}, otherProps)); | ||
} | ||
); | ||
} | ||
}]); | ||
return Button; | ||
}(Component); | ||
Button.propTypes = { | ||
@@ -672,7 +634,2 @@ /** | ||
}; | ||
Button.defaultProps = { | ||
disabled: false, | ||
type: types.SOLID, | ||
width: widths.SHRINK | ||
}; | ||
Button.__docgenInfo = { | ||
@@ -679,0 +636,0 @@ "description": "", |
@@ -7,4 +7,3 @@ 'use strict'; | ||
var React = require('react'); | ||
var React__default = _interopDefault(React); | ||
var React = _interopDefault(require('react')); | ||
var PropTypes = _interopDefault(require('prop-types')); | ||
@@ -248,106 +247,84 @@ var emotion = require('emotion'); | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _this = undefined; | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
var ButtonPresenter = function ButtonPresenter(props) { | ||
var disabled = props.disabled, | ||
hasFocus = props.hasFocus, | ||
hasHover = props.hasHover, | ||
isPressed = props.isPressed, | ||
icon = props.icon, | ||
link = props.link, | ||
onBlur = props.onBlur, | ||
onClick = props.onClick, | ||
onFocus = props.onFocus, | ||
onHover = props.onHover, | ||
onMouseDown = props.onMouseDown, | ||
onMouseEnter = props.onMouseEnter, | ||
onMouseLeave = props.onMouseLeave, | ||
onMouseUp = props.onMouseUp, | ||
customStylesheet = props.stylesheet, | ||
target = props.target, | ||
title = props.title, | ||
type = props.type, | ||
width = props.width, | ||
otherProps = _objectWithoutProperties(props, ["disabled", "hasFocus", "hasHover", "isPressed", "icon", "link", "onBlur", "onClick", "onFocus", "onHover", "onMouseDown", "onMouseEnter", "onMouseLeave", "onMouseUp", "stylesheet", "target", "title", "type", "width"]); | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
var className = otherProps.className, | ||
htmlTabIndex = otherProps.tabIndex; | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var ButtonPresenter = function (_Component) { | ||
_inherits(ButtonPresenter, _Component); | ||
var href = link || undefined; | ||
var tabIndex = disabled ? "-1" : htmlTabIndex || "0"; | ||
var Wrapper = link ? "a" : "button"; | ||
var wrapperTarget = link ? target : undefined; | ||
var iconClassName = utils.createCustomClassNames(className, "icon"); | ||
var iconTextClassName = utils.createCustomClassNames(className, "icon-text"); | ||
function ButtonPresenter() { | ||
_classCallCheck(this, ButtonPresenter); | ||
return React.createElement( | ||
themeContext.ThemeContext.Consumer, | ||
null, | ||
function (_ref) { | ||
var resolvedRoles = _ref.resolvedRoles, | ||
metadata = _ref.metadata; | ||
return _possibleConstructorReturn(this, (ButtonPresenter.__proto__ || Object.getPrototypeOf(ButtonPresenter)).apply(this, arguments)); | ||
} | ||
var styles = stylesheet({ disabled: disabled, hasFocus: hasFocus, hasHover: hasHover, isPressed: isPressed, type: type, width: width }, resolvedRoles, metadata); | ||
var cssStyles = customStylesheet ? customStylesheet(styles, _this.props, resolvedRoles, metadata) : styles; | ||
_createClass(ButtonPresenter, [{ | ||
key: "render", | ||
value: function render() { | ||
var _this2 = this; | ||
var _props = this.props, | ||
disabled = _props.disabled, | ||
hasFocus = _props.hasFocus, | ||
hasHover = _props.hasHover, | ||
isPressed = _props.isPressed, | ||
icon = _props.icon, | ||
link = _props.link, | ||
onBlur = _props.onBlur, | ||
onClick = _props.onClick, | ||
onFocus = _props.onFocus, | ||
onHover = _props.onHover, | ||
onMouseDown = _props.onMouseDown, | ||
onMouseEnter = _props.onMouseEnter, | ||
onMouseLeave = _props.onMouseLeave, | ||
onMouseUp = _props.onMouseUp, | ||
customStylesheet = _props.stylesheet, | ||
target = _props.target, | ||
title = _props.title, | ||
type = _props.type, | ||
width = _props.width, | ||
otherProps = _objectWithoutProperties(_props, ["disabled", "hasFocus", "hasHover", "isPressed", "icon", "link", "onBlur", "onClick", "onFocus", "onHover", "onMouseDown", "onMouseEnter", "onMouseLeave", "onMouseUp", "stylesheet", "target", "title", "type", "width"]); | ||
var className = otherProps.className, | ||
htmlTabIndex = otherProps.tabIndex; | ||
var href = link || undefined; | ||
var tabIndex = disabled ? "-1" : htmlTabIndex || "0"; | ||
var Wrapper = link ? "a" : "button"; | ||
var wrapperTarget = link ? target : undefined; | ||
var iconClassName = utils.createCustomClassNames(className, "icon"); | ||
var iconTextClassName = utils.createCustomClassNames(className, "icon-text"); | ||
return React__default.createElement( | ||
themeContext.ThemeContext.Consumer, | ||
null, | ||
function (_ref) { | ||
var resolvedRoles = _ref.resolvedRoles, | ||
metadata = _ref.metadata; | ||
var styles = stylesheet({ disabled: disabled, hasFocus: hasFocus, hasHover: hasHover, isPressed: isPressed, type: type, width: width }, resolvedRoles, metadata); | ||
var cssStyles = customStylesheet ? customStylesheet(styles, _this2.props, resolvedRoles, metadata) : styles; | ||
return React__default.createElement( | ||
Wrapper, | ||
_extends$1({}, otherProps, { | ||
className: emotion.cx(emotion.css(cssStyles.button), className), | ||
href: href, | ||
tabIndex: tabIndex, | ||
target: wrapperTarget, | ||
onBlur: onBlur, | ||
onClick: onClick, | ||
onFocus: onFocus, | ||
onMouseDown: onMouseDown, | ||
onMouseEnter: onMouseEnter, | ||
onMouseLeave: onMouseLeave, | ||
onMouseOver: onHover, | ||
onMouseUp: onMouseUp, | ||
disabled: disabled | ||
}), | ||
icon && React__default.createElement( | ||
"span", | ||
{ className: emotion.cx(emotion.css(cssStyles.icon), iconClassName) }, | ||
icon | ||
), | ||
React__default.createElement( | ||
"span", | ||
{ | ||
className: icon ? emotion.cx(emotion.css(cssStyles.iconText), iconTextClassName) : "" | ||
}, | ||
title | ||
) | ||
); | ||
} | ||
return React.createElement( | ||
Wrapper, | ||
_extends$1({}, otherProps, { | ||
className: emotion.cx(emotion.css(cssStyles.button), className), | ||
href: href, | ||
tabIndex: tabIndex, | ||
target: wrapperTarget, | ||
onBlur: onBlur, | ||
onClick: onClick, | ||
onFocus: onFocus, | ||
onMouseDown: onMouseDown, | ||
onMouseEnter: onMouseEnter, | ||
onMouseLeave: onMouseLeave, | ||
onMouseOver: onHover, | ||
onMouseUp: onMouseUp, | ||
disabled: disabled | ||
}), | ||
icon && React.createElement( | ||
"span", | ||
{ className: emotion.cx(emotion.css(cssStyles.icon), iconClassName) }, | ||
icon | ||
), | ||
React.createElement( | ||
"span", | ||
{ | ||
className: icon ? emotion.cx(emotion.css(cssStyles.iconText), iconTextClassName) : "" | ||
}, | ||
title | ||
) | ||
); | ||
} | ||
}]); | ||
); | ||
}; | ||
return ButtonPresenter; | ||
}(React.Component); | ||
ButtonPresenter.displayName = "ButtonPresenter"; | ||
@@ -523,92 +500,76 @@ ButtonPresenter.propTypes = { | ||
var _createClass$1 = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _objectWithoutProperties$1(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
var Button = function Button(props) { | ||
var disabled = props.disabled, | ||
icon = props.icon, | ||
link = props.link, | ||
onBlur = props.onBlur, | ||
onClick = props.onClick, | ||
onFocus = props.onFocus, | ||
onHover = props.onHover, | ||
onMouseDown = props.onMouseDown, | ||
onMouseEnter = props.onMouseEnter, | ||
onMouseLeave = props.onMouseLeave, | ||
onMouseUp = props.onMouseUp, | ||
stylesheet = props.stylesheet, | ||
target = props.target, | ||
title = props.title, | ||
type = props.type, | ||
width = props.width, | ||
otherProps = _objectWithoutProperties$1(props, ["disabled", "icon", "link", "onBlur", "onClick", "onFocus", "onHover", "onMouseDown", "onMouseEnter", "onMouseLeave", "onMouseUp", "stylesheet", "target", "title", "type", "width"]); | ||
function _possibleConstructorReturn$1(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
return React.createElement( | ||
behaviors.ControlBehavior, | ||
{ | ||
onBlur: onBlur, | ||
onFocus: onFocus, | ||
onMouseDown: onMouseDown, | ||
onMouseEnter: onMouseEnter, | ||
onMouseLeave: onMouseLeave, | ||
onMouseUp: onMouseUp | ||
}, | ||
function (_ref) { | ||
var hasFocus = _ref.hasFocus, | ||
hasHover = _ref.hasHover, | ||
isPressed = _ref.isPressed, | ||
handleBlur = _ref.onBlur, | ||
handleFocus = _ref.onFocus, | ||
handleMouseDown = _ref.onMouseDown, | ||
handleMouseEnter = _ref.onMouseEnter, | ||
handleMouseLeave = _ref.onMouseLeave, | ||
handleMouseUp = _ref.onMouseUp; | ||
return React.createElement(ButtonPresenter, _extends$2({ | ||
disabled: disabled, | ||
hasFocus: hasFocus, | ||
hasHover: hasHover, | ||
isPressed: isPressed, | ||
icon: icon, | ||
link: link, | ||
onBlur: handleBlur, | ||
onClick: onClick, | ||
onFocus: handleFocus, | ||
onHover: onHover, | ||
onMouseDown: handleMouseDown, | ||
onMouseEnter: handleMouseEnter, | ||
onMouseLeave: handleMouseLeave, | ||
onMouseUp: handleMouseUp, | ||
stylesheet: stylesheet, | ||
target: target, | ||
title: title, | ||
type: type, | ||
width: width | ||
}, otherProps)); | ||
} | ||
); | ||
}; | ||
function _inherits$1(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
Button.displayName = "Button"; | ||
var Button = function (_Component) { | ||
_inherits$1(Button, _Component); | ||
Button.defaultProps = { | ||
disabled: false, | ||
type: types.SOLID, | ||
width: widths.SHRINK | ||
}; | ||
function Button() { | ||
_classCallCheck$1(this, Button); | ||
return _possibleConstructorReturn$1(this, (Button.__proto__ || Object.getPrototypeOf(Button)).apply(this, arguments)); | ||
} | ||
_createClass$1(Button, [{ | ||
key: "render", | ||
value: function render() { | ||
var _props = this.props, | ||
disabled = _props.disabled, | ||
icon = _props.icon, | ||
link = _props.link, | ||
onBlur = _props.onBlur, | ||
onClick = _props.onClick, | ||
onFocus = _props.onFocus, | ||
onHover = _props.onHover, | ||
onMouseDown = _props.onMouseDown, | ||
onMouseEnter = _props.onMouseEnter, | ||
onMouseLeave = _props.onMouseLeave, | ||
onMouseUp = _props.onMouseUp, | ||
stylesheet = _props.stylesheet, | ||
target = _props.target, | ||
title = _props.title, | ||
type = _props.type, | ||
width = _props.width, | ||
otherProps = _objectWithoutProperties$1(_props, ["disabled", "icon", "link", "onBlur", "onClick", "onFocus", "onHover", "onMouseDown", "onMouseEnter", "onMouseLeave", "onMouseUp", "stylesheet", "target", "title", "type", "width"]); | ||
return React__default.createElement( | ||
behaviors.ControlBehavior, | ||
{ | ||
onBlur: onBlur, | ||
onFocus: onFocus, | ||
onMouseDown: onMouseDown, | ||
onMouseEnter: onMouseEnter, | ||
onMouseLeave: onMouseLeave, | ||
onMouseUp: onMouseUp | ||
}, | ||
function (_ref) { | ||
var hasFocus = _ref.hasFocus, | ||
hasHover = _ref.hasHover, | ||
isPressed = _ref.isPressed, | ||
handleBlur = _ref.onBlur, | ||
handleFocus = _ref.onFocus, | ||
handleMouseDown = _ref.onMouseDown, | ||
handleMouseEnter = _ref.onMouseEnter, | ||
handleMouseLeave = _ref.onMouseLeave, | ||
handleMouseUp = _ref.onMouseUp; | ||
return React__default.createElement(ButtonPresenter, _extends$2({ | ||
disabled: disabled, | ||
hasFocus: hasFocus, | ||
hasHover: hasHover, | ||
isPressed: isPressed, | ||
icon: icon, | ||
link: link, | ||
onBlur: handleBlur, | ||
onClick: onClick, | ||
onFocus: handleFocus, | ||
onHover: onHover, | ||
onMouseDown: handleMouseDown, | ||
onMouseEnter: handleMouseEnter, | ||
onMouseLeave: handleMouseLeave, | ||
onMouseUp: handleMouseUp, | ||
stylesheet: stylesheet, | ||
target: target, | ||
title: title, | ||
type: type, | ||
width: width | ||
}, otherProps)); | ||
} | ||
); | ||
} | ||
}]); | ||
return Button; | ||
}(React.Component); | ||
Button.propTypes = { | ||
@@ -680,7 +641,2 @@ /** | ||
}; | ||
Button.defaultProps = { | ||
disabled: false, | ||
type: types.SOLID, | ||
width: widths.SHRINK | ||
}; | ||
Button.__docgenInfo = { | ||
@@ -687,0 +643,0 @@ "description": "", |
@@ -0,1 +1,13 @@ | ||
# [@hig/button-v3.0.0](https://github.com/Autodesk/hig/compare/@hig/button@2.0.1...@hig/button@3.0.0) (2022-01-13) | ||
### Code Refactoring | ||
* Major Release - React 17 Upgrade ([2523711](https://github.com/Autodesk/hig/commit/2523711)) | ||
### BREAKING CHANGES | ||
* This release includes upgrading to React 17 and all associated libraries. The components have also had structural changes, utilizing stateless components and hooks. There should be no change in look or behavior of components. The code usage is the same so if you’re already on react 17 you can bump the version directly. If you’re on an old version of react you’ll need to upgrade your project’s react first to 17 and then the HIG components. This upgrade also means no more fixes for the react 15 version but it will still be available for download from NPM. You can fork the repo and make fixes with the older version if there is something critical past this release date. | ||
# [@hig/button-v2.0.1](https://github.com/Autodesk/hig/compare/@hig/button@2.0.0...@hig/button@2.0.1) (2022-01-12) | ||
@@ -2,0 +14,0 @@ |
{ | ||
"name": "@hig/button", | ||
"version": "2.0.1", | ||
"version": "3.0.0", | ||
"description": "HIG Button", | ||
@@ -34,4 +34,4 @@ "author": "Autodesk Inc.", | ||
"@hig/theme-context": "^3.0.3", | ||
"@hig/theme-data": "^2.22.0", | ||
"react": "^15.4.1 || ^16.3.2" | ||
"@hig/theme-data": "^2.22.1", | ||
"react": "^17.0.0" | ||
}, | ||
@@ -38,0 +38,0 @@ "scripts": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
54223
1480