@khanacademy/wonder-blocks-button
Advanced tools
Comparing version 2.5.0 to 2.5.1
@@ -132,2 +132,15 @@ import { createElement, Fragment, Component } from 'react'; | ||
function _isNativeReflectConstruct() { | ||
if (typeof Reflect === "undefined" || !Reflect.construct) return false; | ||
if (Reflect.construct.sham) return false; | ||
if (typeof Proxy === "function") return true; | ||
try { | ||
Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); | ||
return true; | ||
} catch (e) { | ||
return false; | ||
} | ||
} | ||
function _objectWithoutPropertiesLoose(source, excluded) { | ||
@@ -185,2 +198,21 @@ if (source == null) return {}; | ||
function _createSuper(Derived) { | ||
var hasNativeReflectConstruct = _isNativeReflectConstruct(); | ||
return function _createSuperInternal() { | ||
var Super = _getPrototypeOf(Derived), | ||
result; | ||
if (hasNativeReflectConstruct) { | ||
var NewTarget = _getPrototypeOf(this).constructor; | ||
result = Reflect.construct(Super, arguments, NewTarget); | ||
} else { | ||
result = Super.apply(this, arguments); | ||
} | ||
return _possibleConstructorReturn(this, result); | ||
}; | ||
} | ||
var StyledAnchor = addStyle("a"); | ||
@@ -193,6 +225,8 @@ var StyledButton = addStyle("button"); | ||
var _super = _createSuper(ButtonCore); | ||
function ButtonCore() { | ||
_classCallCheck(this, ButtonCore); | ||
return _possibleConstructorReturn(this, _getPrototypeOf(ButtonCore).apply(this, arguments)); | ||
return _super.apply(this, arguments); | ||
} | ||
@@ -240,6 +274,6 @@ | ||
var Label = size === "small" ? LabelSmall : LabelLarge; | ||
var label = createElement(Label, { | ||
var label = /*#__PURE__*/createElement(Label, { | ||
style: [sharedStyles.text, icon && sharedStyles.textWithIcon, spinner && sharedStyles.hiddenText, kind === "tertiary" && sharedStyles.textWithFocus, // apply focus effect on the label instead | ||
kind === "tertiary" && !disabled && (pressed ? buttonStyles.active : (hovered || focused) && buttonStyles.focus)] | ||
}, icon && createElement(Icon, { | ||
}, icon && /*#__PURE__*/createElement(Icon, { | ||
size: size, | ||
@@ -250,3 +284,3 @@ color: "currentColor", | ||
}), children); | ||
var contents = createElement(Fragment, null, label, spinner && createElement(CircularSpinner, { | ||
var contents = /*#__PURE__*/createElement(Fragment, null, label, spinner && /*#__PURE__*/createElement(CircularSpinner, { | ||
style: sharedStyles.spinner, | ||
@@ -261,9 +295,9 @@ size: { | ||
if (href && !disabled) { | ||
return router && !skipClientNav ? createElement(StyledLink, _extends({}, commonProps, { | ||
return router && !skipClientNav ? /*#__PURE__*/createElement(StyledLink, _extends({}, commonProps, { | ||
to: href | ||
}), contents) : createElement(StyledAnchor, _extends({}, commonProps, { | ||
}), contents) : /*#__PURE__*/createElement(StyledAnchor, _extends({}, commonProps, { | ||
href: href | ||
}), contents); | ||
} else { | ||
return createElement(StyledButton, _extends({ | ||
return /*#__PURE__*/createElement(StyledButton, _extends({ | ||
type: "button" | ||
@@ -491,6 +525,8 @@ }, commonProps, { | ||
var _super = _createSuper(Button); | ||
function Button() { | ||
_classCallCheck(this, Button); | ||
return _possibleConstructorReturn(this, _getPrototypeOf(Button).apply(this, arguments)); | ||
return _super.apply(this, arguments); | ||
} | ||
@@ -511,3 +547,3 @@ | ||
var ClickableBehavior = getClickableBehavior(href, skipClientNav, this.context.router); | ||
return createElement(ClickableBehavior, { | ||
return /*#__PURE__*/createElement(ClickableBehavior, { | ||
disabled: spinner || disabled, | ||
@@ -518,3 +554,3 @@ href: href, | ||
}, function (state, handlers) { | ||
return createElement(ButtonCore, _extends({}, sharedProps, state, handlers, { | ||
return /*#__PURE__*/createElement(ButtonCore, _extends({}, sharedProps, state, handlers, { | ||
disabled: disabled, | ||
@@ -521,0 +557,0 @@ spinner: spinner, |
@@ -212,2 +212,8 @@ module.exports = | ||
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 _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
@@ -217,8 +223,6 @@ | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } | ||
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; } | ||
@@ -243,6 +247,8 @@ | ||
var _super = _createSuper(ButtonCore); | ||
function ButtonCore() { | ||
_classCallCheck(this, ButtonCore); | ||
return _possibleConstructorReturn(this, _getPrototypeOf(ButtonCore).apply(this, arguments)); | ||
return _super.apply(this, arguments); | ||
} | ||
@@ -290,6 +296,6 @@ | ||
var Label = size === "small" ? wonder_blocks_typography_["LabelSmall"] : wonder_blocks_typography_["LabelLarge"]; | ||
var label = external_react_["createElement"](Label, { | ||
var label = /*#__PURE__*/external_react_["createElement"](Label, { | ||
style: [sharedStyles.text, icon && sharedStyles.textWithIcon, spinner && sharedStyles.hiddenText, kind === "tertiary" && sharedStyles.textWithFocus, // apply focus effect on the label instead | ||
kind === "tertiary" && !disabled && (pressed ? buttonStyles.active : (hovered || focused) && buttonStyles.focus)] | ||
}, icon && external_react_["createElement"](wonder_blocks_icon_default.a, { | ||
}, icon && /*#__PURE__*/external_react_["createElement"](wonder_blocks_icon_default.a, { | ||
size: size, | ||
@@ -300,3 +306,3 @@ color: "currentColor", | ||
}), children); | ||
var contents = external_react_["createElement"](external_react_["Fragment"], null, label, spinner && external_react_["createElement"](wonder_blocks_progress_spinner_["CircularSpinner"], { | ||
var contents = /*#__PURE__*/external_react_["createElement"](external_react_["Fragment"], null, label, spinner && /*#__PURE__*/external_react_["createElement"](wonder_blocks_progress_spinner_["CircularSpinner"], { | ||
style: sharedStyles.spinner, | ||
@@ -311,9 +317,9 @@ size: { | ||
if (href && !disabled) { | ||
return router && !skipClientNav ? external_react_["createElement"](StyledLink, _extends({}, commonProps, { | ||
return router && !skipClientNav ? /*#__PURE__*/external_react_["createElement"](StyledLink, _extends({}, commonProps, { | ||
to: href | ||
}), contents) : external_react_["createElement"](StyledAnchor, _extends({}, commonProps, { | ||
}), contents) : /*#__PURE__*/external_react_["createElement"](StyledAnchor, _extends({}, commonProps, { | ||
href: href | ||
}), contents); | ||
} else { | ||
return external_react_["createElement"](StyledButton, _extends({ | ||
return /*#__PURE__*/external_react_["createElement"](StyledButton, _extends({ | ||
type: "button" | ||
@@ -537,2 +543,8 @@ }, commonProps, { | ||
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_createSuper(Derived) { var hasNativeReflectConstruct = button_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = button_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = button_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return button_possibleConstructorReturn(this, result); }; } | ||
function button_possibleConstructorReturn(self, call) { if (call && (button_typeof(call) === "object" || typeof call === "function")) { return call; } return button_assertThisInitialized(self); } | ||
@@ -542,8 +554,6 @@ | ||
function button_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } | ||
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; } | ||
@@ -576,6 +586,8 @@ | ||
var _super = button_createSuper(Button); | ||
function Button() { | ||
button_classCallCheck(this, Button); | ||
return button_possibleConstructorReturn(this, button_getPrototypeOf(Button).apply(this, arguments)); | ||
return _super.apply(this, arguments); | ||
} | ||
@@ -596,3 +608,3 @@ | ||
var ClickableBehavior = Object(wonder_blocks_core_["getClickableBehavior"])(href, skipClientNav, this.context.router); | ||
return external_react_["createElement"](ClickableBehavior, { | ||
return /*#__PURE__*/external_react_["createElement"](ClickableBehavior, { | ||
disabled: spinner || disabled, | ||
@@ -603,3 +615,3 @@ href: href, | ||
}, function (state, handlers) { | ||
return external_react_["createElement"](button_core_ButtonCore, button_extends({}, sharedProps, state, handlers, { | ||
return /*#__PURE__*/external_react_["createElement"](button_core_ButtonCore, button_extends({}, sharedProps, state, handlers, { | ||
disabled: disabled, | ||
@@ -606,0 +618,0 @@ spinner: spinner, |
{ | ||
"name": "@khanacademy/wonder-blocks-button", | ||
"version": "2.5.0", | ||
"version": "2.5.1", | ||
"design": "v1", | ||
@@ -18,8 +18,8 @@ "publishConfig": { | ||
"dependencies": { | ||
"@khanacademy/wonder-blocks-color": "^1.1.11", | ||
"@khanacademy/wonder-blocks-core": "^2.5.1", | ||
"@khanacademy/wonder-blocks-icon": "^1.2.7", | ||
"@khanacademy/wonder-blocks-progress-spinner": "^1.1.11", | ||
"@khanacademy/wonder-blocks-spacing": "^2.1.11", | ||
"@khanacademy/wonder-blocks-typography": "^1.1.11" | ||
"@khanacademy/wonder-blocks-color": "^1.1.12", | ||
"@khanacademy/wonder-blocks-core": "^2.5.2", | ||
"@khanacademy/wonder-blocks-icon": "^1.2.8", | ||
"@khanacademy/wonder-blocks-progress-spinner": "^1.1.12", | ||
"@khanacademy/wonder-blocks-spacing": "^2.1.12", | ||
"@khanacademy/wonder-blocks-typography": "^1.1.12" | ||
}, | ||
@@ -35,3 +35,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "3c6c92225a4eba049ead8d78e2d3eb648e5b16ab" | ||
"gitHead": "a2b5548f5d7db108c39961071d081ec5d96fa88f" | ||
} |
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
412430
2485