@khanacademy/wonder-blocks-button
Advanced tools
Comparing version 2.2.3 to 2.2.4
@@ -1,2 +0,2 @@ | ||
import { Component, createElement, Fragment } from 'react'; | ||
import { createElement, Component, Fragment } from 'react'; | ||
import { StyleSheet } from 'aphrodite'; | ||
@@ -12,2 +12,24 @@ import { Link } from 'react-router-dom'; | ||
function _classCallCheck(instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
throw new TypeError("Cannot call a class as a 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); | ||
} | ||
} | ||
function _createClass(Constructor, protoProps, staticProps) { | ||
if (protoProps) _defineProperties(Constructor.prototype, protoProps); | ||
if (staticProps) _defineProperties(Constructor, staticProps); | ||
return Constructor; | ||
} | ||
function _defineProperty(obj, key, value) { | ||
@@ -65,2 +87,33 @@ if (key in obj) { | ||
function _inherits(subClass, superClass) { | ||
if (typeof superClass !== "function" && superClass !== null) { | ||
throw new TypeError("Super expression must either be null or a function"); | ||
} | ||
subClass.prototype = Object.create(superClass && superClass.prototype, { | ||
constructor: { | ||
value: subClass, | ||
writable: true, | ||
configurable: true | ||
} | ||
}); | ||
if (superClass) _setPrototypeOf(subClass, superClass); | ||
} | ||
function _getPrototypeOf(o) { | ||
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { | ||
return o.__proto__ || Object.getPrototypeOf(o); | ||
}; | ||
return _getPrototypeOf(o); | ||
} | ||
function _setPrototypeOf(o, p) { | ||
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { | ||
o.__proto__ = p; | ||
return o; | ||
}; | ||
return _setPrototypeOf(o, p); | ||
} | ||
function _objectWithoutPropertiesLoose(source, excluded) { | ||
@@ -102,8 +155,37 @@ if (source == null) return {}; | ||
const StyledAnchor = addStyle("a"); | ||
const StyledButton = addStyle("button"); | ||
const StyledLink = addStyle(Link); | ||
class ButtonCore extends Component { | ||
render() { | ||
const _this$props = this.props, | ||
function _assertThisInitialized(self) { | ||
if (self === void 0) { | ||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | ||
} | ||
return self; | ||
} | ||
function _possibleConstructorReturn(self, call) { | ||
if (call && (typeof call === "object" || typeof call === "function")) { | ||
return call; | ||
} | ||
return _assertThisInitialized(self); | ||
} | ||
var StyledAnchor = addStyle("a"); | ||
var StyledButton = addStyle("button"); | ||
var StyledLink = addStyle(Link); | ||
var ButtonCore = | ||
/*#__PURE__*/ | ||
function (_React$Component) { | ||
_inherits(ButtonCore, _React$Component); | ||
function ButtonCore() { | ||
_classCallCheck(this, ButtonCore); | ||
return _possibleConstructorReturn(this, _getPrototypeOf(ButtonCore).apply(this, arguments)); | ||
} | ||
_createClass(ButtonCore, [{ | ||
key: "render", | ||
value: function render() { | ||
var _this$props = this.props, | ||
children = _this$props.children, | ||
@@ -127,53 +209,55 @@ skipClientNav = _this$props.skipClientNav, | ||
const router = this.context.router; | ||
const buttonColor = color === "destructive" ? SemanticColor.controlDestructive : SemanticColor.controlDefault; | ||
const iconWidth = icon ? (size === "small" ? 16 : 24) + 8 : 0; | ||
var router = this.context.router; | ||
var buttonColor = color === "destructive" ? SemanticColor.controlDestructive : SemanticColor.controlDefault; | ||
var iconWidth = icon ? (size === "small" ? 16 : 24) + 8 : 0; | ||
const buttonStyles = _generateStyles(buttonColor, kind, light, iconWidth); | ||
var buttonStyles = _generateStyles(buttonColor, kind, light, iconWidth); | ||
const disabled = spinner || disabledProp; | ||
const defaultStyle = [sharedStyles.shared, disabled && sharedStyles.disabled, icon && sharedStyles.withIcon, buttonStyles.default, disabled && buttonStyles.disabled, !disabled && (pressed ? buttonStyles.active : (hovered || focused) && buttonStyles.focus), size === "small" && sharedStyles.small]; | ||
var disabled = spinner || disabledProp; | ||
var defaultStyle = [sharedStyles.shared, disabled && sharedStyles.disabled, icon && sharedStyles.withIcon, buttonStyles.default, disabled && buttonStyles.disabled, !disabled && (pressed ? buttonStyles.active : (hovered || focused) && buttonStyles.focus), size === "small" && sharedStyles.small]; | ||
const commonProps = _objectSpread({ | ||
"aria-disabled": disabled ? "true" : undefined, | ||
"aria-label": ariaLabel, | ||
"data-test-id": testId, | ||
role: "button", | ||
style: [defaultStyle, style] | ||
}, handlers); | ||
var commonProps = _objectSpread({ | ||
"aria-disabled": disabled ? "true" : undefined, | ||
"aria-label": ariaLabel, | ||
"data-test-id": testId, | ||
role: "button", | ||
style: [defaultStyle, style] | ||
}, handlers); | ||
const Label = size === "small" ? LabelSmall : LabelLarge; | ||
const label = createElement(Label, { | ||
style: [sharedStyles.text, spinner && sharedStyles.hiddenText] | ||
}, icon && createElement(Icon, { | ||
size: size, | ||
color: "currentColor", | ||
icon: icon, | ||
style: sharedStyles.icon | ||
}), children); | ||
const contents = createElement(Fragment, null, label, spinner && createElement(CircularSpinner, { | ||
style: sharedStyles.spinner, | ||
size: { | ||
medium: "small", | ||
small: "xsmall" | ||
}[size], | ||
light: kind === "primary" | ||
})); | ||
var Label = size === "small" ? LabelSmall : LabelLarge; | ||
var label = createElement(Label, { | ||
style: [sharedStyles.text, spinner && sharedStyles.hiddenText] | ||
}, icon && createElement(Icon, { | ||
size: size, | ||
color: "currentColor", | ||
icon: icon, | ||
style: sharedStyles.icon | ||
}), children); | ||
var contents = createElement(Fragment, null, label, spinner && createElement(CircularSpinner, { | ||
style: sharedStyles.spinner, | ||
size: { | ||
medium: "small", | ||
small: "xsmall" | ||
}[size], | ||
light: kind === "primary" | ||
})); | ||
if (href) { | ||
return router && !skipClientNav ? createElement(StyledLink, _extends({}, commonProps, { | ||
to: href | ||
}), contents) : createElement(StyledAnchor, _extends({}, commonProps, { | ||
href: href | ||
}), contents); | ||
} else { | ||
return createElement(StyledButton, _extends({ | ||
type: "button" | ||
}, commonProps, { | ||
disabled: disabled | ||
}), contents); | ||
if (href) { | ||
return router && !skipClientNav ? createElement(StyledLink, _extends({}, commonProps, { | ||
to: href | ||
}), contents) : createElement(StyledAnchor, _extends({}, commonProps, { | ||
href: href | ||
}), contents); | ||
} else { | ||
return createElement(StyledButton, _extends({ | ||
type: "button" | ||
}, commonProps, { | ||
disabled: disabled | ||
}), contents); | ||
} | ||
} | ||
} | ||
}]); | ||
} | ||
return ButtonCore; | ||
}(Component); | ||
@@ -183,4 +267,3 @@ _defineProperty(ButtonCore, "contextTypes", { | ||
}); | ||
const sharedStyles = StyleSheet.create({ | ||
var sharedStyles = StyleSheet.create({ | ||
shared: { | ||
@@ -237,6 +320,6 @@ position: "relative", | ||
}); | ||
const styles = {}; | ||
var styles = {}; | ||
const _generateStyles = (color, kind, light, iconWidth) => { | ||
const buttonType = color + kind + light.toString() + iconWidth.toString(); | ||
var _generateStyles = function _generateStyles(color, kind, light, iconWidth) { | ||
var buttonType = color + kind + light.toString() + iconWidth.toString(); | ||
@@ -247,10 +330,10 @@ if (styles[buttonType]) { | ||
const white = Color.white, | ||
white64 = Color.white64, | ||
offBlack32 = Color.offBlack32, | ||
offBlack50 = Color.offBlack50, | ||
darkBlue = Color.darkBlue; | ||
const fadedColor = mix(fade(color, 0.32), white); | ||
const activeColor = mix(offBlack32, color); | ||
let newStyles = {}; | ||
var white = Color.white, | ||
white64 = Color.white64, | ||
offBlack32 = Color.offBlack32, | ||
offBlack50 = Color.offBlack50, | ||
darkBlue = Color.darkBlue; | ||
var fadedColor = mix(fade(color, 0.32), white); | ||
var activeColor = mix(offBlack32, color); | ||
var newStyles = {}; | ||
@@ -268,6 +351,6 @@ if (kind === "primary") { | ||
// in the background color not to matter too much. | ||
boxShadow: `0 0 0 1px ${light ? darkBlue : white}, 0 0 0 3px ${light ? white : color}` | ||
boxShadow: "0 0 0 1px ".concat(light ? darkBlue : white, ", 0 0 0 3px ").concat(light ? white : color) | ||
}, | ||
active: { | ||
boxShadow: `0 0 0 1px ${light ? darkBlue : white}, 0 0 0 3px ${light ? fadedColor : activeColor}`, | ||
boxShadow: "0 0 0 1px ".concat(light ? darkBlue : white, ", 0 0 0 3px ").concat(light ? fadedColor : activeColor), | ||
background: light ? fadedColor : activeColor, | ||
@@ -329,3 +412,3 @@ color: light ? activeColor : fadedColor | ||
height: 2, | ||
width: `calc(100% - ${iconWidth}px)`, | ||
width: "calc(100% - ".concat(iconWidth, "px)"), | ||
right: 0, | ||
@@ -343,3 +426,3 @@ bottom: "calc(50% - 11px)", | ||
height: 2, | ||
width: `calc(100% - ${iconWidth}px)`, | ||
width: "calc(100% - ".concat(iconWidth, "px)"), | ||
right: 0, | ||
@@ -381,5 +464,17 @@ bottom: "calc(50% - 11px)", | ||
*/ | ||
class Button extends Component { | ||
render() { | ||
const _this$props = this.props, | ||
var Button = | ||
/*#__PURE__*/ | ||
function (_React$Component) { | ||
_inherits(Button, _React$Component); | ||
function Button() { | ||
_classCallCheck(this, Button); | ||
return _possibleConstructorReturn(this, _getPrototypeOf(Button).apply(this, arguments)); | ||
} | ||
_createClass(Button, [{ | ||
key: "render", | ||
value: function render() { | ||
var _this$props = this.props, | ||
onClick = _this$props.onClick, | ||
@@ -393,19 +488,21 @@ href = _this$props.href, | ||
const ClickableBehavior = getClickableBehavior(href, skipClientNav, this.context.router); | ||
return createElement(ClickableBehavior, { | ||
disabled: spinner || disabled, | ||
href: href, | ||
onClick: onClick, | ||
role: "button" | ||
}, (state, handlers) => { | ||
return createElement(ButtonCore, _extends({}, sharedProps, state, handlers, { | ||
disabled: disabled, | ||
spinner: spinner, | ||
skipClientNav: skipClientNav, | ||
href: href | ||
}), children); | ||
}); | ||
} | ||
var ClickableBehavior = getClickableBehavior(href, skipClientNav, this.context.router); | ||
return createElement(ClickableBehavior, { | ||
disabled: spinner || disabled, | ||
href: href, | ||
onClick: onClick, | ||
role: "button" | ||
}, function (state, handlers) { | ||
return createElement(ButtonCore, _extends({}, sharedProps, state, handlers, { | ||
disabled: disabled, | ||
spinner: spinner, | ||
skipClientNav: skipClientNav, | ||
href: href | ||
}), children); | ||
}); | ||
} | ||
}]); | ||
} | ||
return Button; | ||
}(Component); | ||
@@ -412,0 +509,0 @@ _defineProperty(Button, "defaultProps", { |
@@ -190,2 +190,4 @@ module.exports = | ||
// CONCATENATED MODULE: ./packages/wonder-blocks-button/components/button-core.js | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
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); } | ||
@@ -199,2 +201,18 @@ | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
@@ -212,8 +230,21 @@ | ||
const StyledAnchor = Object(wonder_blocks_core_["addStyle"])("a"); | ||
const StyledButton = Object(wonder_blocks_core_["addStyle"])("button"); | ||
const StyledLink = Object(wonder_blocks_core_["addStyle"])(external_react_router_dom_["Link"]); | ||
class button_core_ButtonCore extends external_react_["Component"] { | ||
render() { | ||
const _this$props = this.props, | ||
var StyledAnchor = Object(wonder_blocks_core_["addStyle"])("a"); | ||
var StyledButton = Object(wonder_blocks_core_["addStyle"])("button"); | ||
var StyledLink = Object(wonder_blocks_core_["addStyle"])(external_react_router_dom_["Link"]); | ||
var button_core_ButtonCore = | ||
/*#__PURE__*/ | ||
function (_React$Component) { | ||
_inherits(ButtonCore, _React$Component); | ||
function ButtonCore() { | ||
_classCallCheck(this, ButtonCore); | ||
return _possibleConstructorReturn(this, _getPrototypeOf(ButtonCore).apply(this, arguments)); | ||
} | ||
_createClass(ButtonCore, [{ | ||
key: "render", | ||
value: function render() { | ||
var _this$props = this.props, | ||
children = _this$props.children, | ||
@@ -237,53 +268,55 @@ skipClientNav = _this$props.skipClientNav, | ||
const router = this.context.router; | ||
const buttonColor = color === "destructive" ? wonder_blocks_color_["SemanticColor"].controlDestructive : wonder_blocks_color_["SemanticColor"].controlDefault; | ||
const iconWidth = icon ? (size === "small" ? 16 : 24) + 8 : 0; | ||
var router = this.context.router; | ||
var buttonColor = color === "destructive" ? wonder_blocks_color_["SemanticColor"].controlDestructive : wonder_blocks_color_["SemanticColor"].controlDefault; | ||
var iconWidth = icon ? (size === "small" ? 16 : 24) + 8 : 0; | ||
const buttonStyles = _generateStyles(buttonColor, kind, light, iconWidth); | ||
var buttonStyles = button_core_generateStyles(buttonColor, kind, light, iconWidth); | ||
const disabled = spinner || disabledProp; | ||
const defaultStyle = [sharedStyles.shared, disabled && sharedStyles.disabled, icon && sharedStyles.withIcon, buttonStyles.default, disabled && buttonStyles.disabled, !disabled && (pressed ? buttonStyles.active : (hovered || focused) && buttonStyles.focus), size === "small" && sharedStyles.small]; | ||
var disabled = spinner || disabledProp; | ||
var defaultStyle = [sharedStyles.shared, disabled && sharedStyles.disabled, icon && sharedStyles.withIcon, buttonStyles.default, disabled && buttonStyles.disabled, !disabled && (pressed ? buttonStyles.active : (hovered || focused) && buttonStyles.focus), size === "small" && sharedStyles.small]; | ||
const commonProps = _objectSpread({ | ||
"aria-disabled": disabled ? "true" : undefined, | ||
"aria-label": ariaLabel, | ||
"data-test-id": testId, | ||
role: "button", | ||
style: [defaultStyle, style] | ||
}, handlers); | ||
var commonProps = _objectSpread({ | ||
"aria-disabled": disabled ? "true" : undefined, | ||
"aria-label": ariaLabel, | ||
"data-test-id": testId, | ||
role: "button", | ||
style: [defaultStyle, style] | ||
}, handlers); | ||
const Label = size === "small" ? wonder_blocks_typography_["LabelSmall"] : wonder_blocks_typography_["LabelLarge"]; | ||
const label = external_react_["createElement"](Label, { | ||
style: [sharedStyles.text, spinner && sharedStyles.hiddenText] | ||
}, icon && external_react_["createElement"](wonder_blocks_icon_default.a, { | ||
size: size, | ||
color: "currentColor", | ||
icon: icon, | ||
style: sharedStyles.icon | ||
}), children); | ||
const contents = external_react_["createElement"](external_react_["Fragment"], null, label, spinner && external_react_["createElement"](wonder_blocks_progress_spinner_["CircularSpinner"], { | ||
style: sharedStyles.spinner, | ||
size: { | ||
medium: "small", | ||
small: "xsmall" | ||
}[size], | ||
light: kind === "primary" | ||
})); | ||
var Label = size === "small" ? wonder_blocks_typography_["LabelSmall"] : wonder_blocks_typography_["LabelLarge"]; | ||
var label = external_react_["createElement"](Label, { | ||
style: [sharedStyles.text, spinner && sharedStyles.hiddenText] | ||
}, icon && external_react_["createElement"](wonder_blocks_icon_default.a, { | ||
size: size, | ||
color: "currentColor", | ||
icon: icon, | ||
style: sharedStyles.icon | ||
}), children); | ||
var contents = external_react_["createElement"](external_react_["Fragment"], null, label, spinner && external_react_["createElement"](wonder_blocks_progress_spinner_["CircularSpinner"], { | ||
style: sharedStyles.spinner, | ||
size: { | ||
medium: "small", | ||
small: "xsmall" | ||
}[size], | ||
light: kind === "primary" | ||
})); | ||
if (href) { | ||
return router && !skipClientNav ? external_react_["createElement"](StyledLink, _extends({}, commonProps, { | ||
to: href | ||
}), contents) : external_react_["createElement"](StyledAnchor, _extends({}, commonProps, { | ||
href: href | ||
}), contents); | ||
} else { | ||
return external_react_["createElement"](StyledButton, _extends({ | ||
type: "button" | ||
}, commonProps, { | ||
disabled: disabled | ||
}), contents); | ||
if (href) { | ||
return router && !skipClientNav ? external_react_["createElement"](StyledLink, _extends({}, commonProps, { | ||
to: href | ||
}), contents) : external_react_["createElement"](StyledAnchor, _extends({}, commonProps, { | ||
href: href | ||
}), contents); | ||
} else { | ||
return external_react_["createElement"](StyledButton, _extends({ | ||
type: "button" | ||
}, commonProps, { | ||
disabled: disabled | ||
}), contents); | ||
} | ||
} | ||
} | ||
}]); | ||
} | ||
return ButtonCore; | ||
}(external_react_["Component"]); | ||
@@ -294,3 +327,4 @@ _defineProperty(button_core_ButtonCore, "contextTypes", { | ||
const sharedStyles = external_aphrodite_["StyleSheet"].create({ | ||
var sharedStyles = external_aphrodite_["StyleSheet"].create({ | ||
shared: { | ||
@@ -347,6 +381,6 @@ position: "relative", | ||
}); | ||
const styles = {}; | ||
var styles = {}; | ||
const _generateStyles = (color, kind, light, iconWidth) => { | ||
const buttonType = color + kind + light.toString() + iconWidth.toString(); | ||
var button_core_generateStyles = function _generateStyles(color, kind, light, iconWidth) { | ||
var buttonType = color + kind + light.toString() + iconWidth.toString(); | ||
@@ -357,10 +391,10 @@ if (styles[buttonType]) { | ||
const white = wonder_blocks_color_default.a.white, | ||
white64 = wonder_blocks_color_default.a.white64, | ||
offBlack32 = wonder_blocks_color_default.a.offBlack32, | ||
offBlack50 = wonder_blocks_color_default.a.offBlack50, | ||
darkBlue = wonder_blocks_color_default.a.darkBlue; | ||
const fadedColor = Object(wonder_blocks_color_["mix"])(Object(wonder_blocks_color_["fade"])(color, 0.32), white); | ||
const activeColor = Object(wonder_blocks_color_["mix"])(offBlack32, color); | ||
let newStyles = {}; | ||
var white = wonder_blocks_color_default.a.white, | ||
white64 = wonder_blocks_color_default.a.white64, | ||
offBlack32 = wonder_blocks_color_default.a.offBlack32, | ||
offBlack50 = wonder_blocks_color_default.a.offBlack50, | ||
darkBlue = wonder_blocks_color_default.a.darkBlue; | ||
var fadedColor = Object(wonder_blocks_color_["mix"])(Object(wonder_blocks_color_["fade"])(color, 0.32), white); | ||
var activeColor = Object(wonder_blocks_color_["mix"])(offBlack32, color); | ||
var newStyles = {}; | ||
@@ -378,6 +412,6 @@ if (kind === "primary") { | ||
// in the background color not to matter too much. | ||
boxShadow: `0 0 0 1px ${light ? darkBlue : white}, 0 0 0 3px ${light ? white : color}` | ||
boxShadow: "0 0 0 1px ".concat(light ? darkBlue : white, ", 0 0 0 3px ").concat(light ? white : color) | ||
}, | ||
active: { | ||
boxShadow: `0 0 0 1px ${light ? darkBlue : white}, 0 0 0 3px ${light ? fadedColor : activeColor}`, | ||
boxShadow: "0 0 0 1px ".concat(light ? darkBlue : white, ", 0 0 0 3px ").concat(light ? fadedColor : activeColor), | ||
background: light ? fadedColor : activeColor, | ||
@@ -439,3 +473,3 @@ color: light ? activeColor : fadedColor | ||
height: 2, | ||
width: `calc(100% - ${iconWidth}px)`, | ||
width: "calc(100% - ".concat(iconWidth, "px)"), | ||
right: 0, | ||
@@ -453,3 +487,3 @@ bottom: "calc(50% - 11px)", | ||
height: 2, | ||
width: `calc(100% - ${iconWidth}px)`, | ||
width: "calc(100% - ".concat(iconWidth, "px)"), | ||
right: 0, | ||
@@ -474,2 +508,4 @@ bottom: "calc(50% - 11px)", | ||
// CONCATENATED MODULE: ./packages/wonder-blocks-button/components/button.js | ||
function button_typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { button_typeof = function _typeof(obj) { return typeof obj; }; } else { button_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return button_typeof(obj); } | ||
function button_extends() { button_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 button_extends.apply(this, arguments); } | ||
@@ -481,2 +517,18 @@ | ||
function button_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function button_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); } } | ||
function button_createClass(Constructor, protoProps, staticProps) { if (protoProps) button_defineProperties(Constructor.prototype, protoProps); if (staticProps) button_defineProperties(Constructor, staticProps); return Constructor; } | ||
function button_possibleConstructorReturn(self, call) { if (call && (button_typeof(call) === "object" || typeof call === "function")) { return call; } return button_assertThisInitialized(self); } | ||
function button_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function button_getPrototypeOf(o) { button_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return button_getPrototypeOf(o); } | ||
function button_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) button_setPrototypeOf(subClass, superClass); } | ||
function button_setPrototypeOf(o, p) { button_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return button_setPrototypeOf(o, p); } | ||
function button_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
@@ -506,5 +558,17 @@ | ||
*/ | ||
class button_Button extends external_react_["Component"] { | ||
render() { | ||
const _this$props = this.props, | ||
var button_Button = | ||
/*#__PURE__*/ | ||
function (_React$Component) { | ||
button_inherits(Button, _React$Component); | ||
function Button() { | ||
button_classCallCheck(this, Button); | ||
return button_possibleConstructorReturn(this, button_getPrototypeOf(Button).apply(this, arguments)); | ||
} | ||
button_createClass(Button, [{ | ||
key: "render", | ||
value: function render() { | ||
var _this$props = this.props, | ||
onClick = _this$props.onClick, | ||
@@ -518,19 +582,21 @@ href = _this$props.href, | ||
const ClickableBehavior = Object(wonder_blocks_core_["getClickableBehavior"])(href, skipClientNav, this.context.router); | ||
return external_react_["createElement"](ClickableBehavior, { | ||
disabled: spinner || disabled, | ||
href: href, | ||
onClick: onClick, | ||
role: "button" | ||
}, (state, handlers) => { | ||
return external_react_["createElement"](button_core_ButtonCore, button_extends({}, sharedProps, state, handlers, { | ||
disabled: disabled, | ||
spinner: spinner, | ||
skipClientNav: skipClientNav, | ||
href: href | ||
}), children); | ||
}); | ||
} | ||
var ClickableBehavior = Object(wonder_blocks_core_["getClickableBehavior"])(href, skipClientNav, this.context.router); | ||
return external_react_["createElement"](ClickableBehavior, { | ||
disabled: spinner || disabled, | ||
href: href, | ||
onClick: onClick, | ||
role: "button" | ||
}, function (state, handlers) { | ||
return external_react_["createElement"](button_core_ButtonCore, button_extends({}, sharedProps, state, handlers, { | ||
disabled: disabled, | ||
spinner: spinner, | ||
skipClientNav: skipClientNav, | ||
href: href | ||
}), children); | ||
}); | ||
} | ||
}]); | ||
} | ||
return Button; | ||
}(external_react_["Component"]); | ||
@@ -550,2 +616,4 @@ button_defineProperty(button_Button, "defaultProps", { | ||
}); | ||
// CONCATENATED MODULE: ./packages/wonder-blocks-button/index.js | ||
@@ -552,0 +620,0 @@ /* concated harmony reexport */__webpack_require__.d(__webpack_exports__, "default", function() { return button_Button; }); |
{ | ||
"name": "@khanacademy/wonder-blocks-button", | ||
"version": "2.2.3", | ||
"version": "2.2.4", | ||
"design": "v1", | ||
@@ -18,8 +18,8 @@ "publishConfig": { | ||
"dependencies": { | ||
"@khanacademy/wonder-blocks-color": "^1.0.12", | ||
"@khanacademy/wonder-blocks-core": "^1.2.5", | ||
"@khanacademy/wonder-blocks-icon": "^1.0.9", | ||
"@khanacademy/wonder-blocks-progress-spinner": "^1.0.9", | ||
"@khanacademy/wonder-blocks-spacing": "^2.0.10", | ||
"@khanacademy/wonder-blocks-typography": "^1.0.12" | ||
"@khanacademy/wonder-blocks-color": "^1.0.13", | ||
"@khanacademy/wonder-blocks-core": "^1.2.6", | ||
"@khanacademy/wonder-blocks-icon": "^1.0.10", | ||
"@khanacademy/wonder-blocks-progress-spinner": "^1.0.10", | ||
"@khanacademy/wonder-blocks-spacing": "^2.0.11", | ||
"@khanacademy/wonder-blocks-typography": "^1.0.13" | ||
}, | ||
@@ -31,3 +31,6 @@ "peerDependencies": { | ||
"react-router-dom": "^4.2.2" | ||
}, | ||
"devDependencies": { | ||
"wb-dev-build-settings": "^0.0.2" | ||
} | ||
} |
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
376534
2171
1