@khanacademy/wonder-blocks-clickable
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -7,2 +7,3 @@ // @flow | ||
import type { | ||
AriaProps, | ||
StyleType, | ||
@@ -16,2 +17,9 @@ ClickableRole, | ||
/** | ||
* aria-label should be used when `spinner={true}` to let people using screen | ||
* readers that the action taken by clicking the button will take some | ||
* time to complete. | ||
*/ | ||
...$Rest<AriaProps, {|"aria-disabled": "true" | "false" | void|}>, | ||
/** | ||
* The child of Clickable must be a function which returns the component | ||
@@ -45,2 +53,31 @@ * which should be made Clickable. The function is passed an object with | ||
/** | ||
* An optional id attribute. | ||
*/ | ||
id?: string, | ||
/** | ||
* A target destination window for a link to open in. | ||
*/ | ||
target?: string, | ||
/** | ||
* Specifies the type of relationship between the current document and the | ||
* linked document. Should only be used when `href` is specified. | ||
*/ | ||
rel?: | ||
| "alternate" | ||
| "author" | ||
| "bookmark" | ||
| "external" | ||
| "help" | ||
| "license" | ||
| "next" | ||
| "nofollow" | ||
| "noreferrer" | ||
| "noopener" | ||
| "prev" | ||
| "search" | ||
| "tag", | ||
/** | ||
* The role of the component, can be a role of type ClickableRole | ||
@@ -56,7 +93,2 @@ */ | ||
/** | ||
* Use to label the component | ||
*/ | ||
"aria-label": string, | ||
/** | ||
* Test ID used for e2e testing. | ||
@@ -208,2 +240,5 @@ */ | ||
safeWithNav = undefined, | ||
style, | ||
testId, | ||
...restProps | ||
} = this.props; | ||
@@ -225,6 +260,5 @@ const ClickableBehavior = getClickableBehavior( | ||
this.getCorrectTag(state, { | ||
// eslint-disable-next-line react/prop-types | ||
"aria-label": this.props["aria-label"], | ||
"data-test-id": this.props.testId, | ||
style: [styles.reset, this.props.style], | ||
...restProps, | ||
"data-test-id": testId, | ||
style: [styles.reset, style], | ||
...handlers, | ||
@@ -231,0 +265,0 @@ }) |
@@ -140,2 +140,38 @@ import { createElement, Component } from 'react'; | ||
function _objectWithoutPropertiesLoose(source, excluded) { | ||
if (source == null) return {}; | ||
var target = {}; | ||
var sourceKeys = Object.keys(source); | ||
var key, i; | ||
for (i = 0; i < sourceKeys.length; i++) { | ||
key = sourceKeys[i]; | ||
if (excluded.indexOf(key) >= 0) continue; | ||
target[key] = source[key]; | ||
} | ||
return target; | ||
} | ||
function _objectWithoutProperties(source, excluded) { | ||
if (source == null) return {}; | ||
var target = _objectWithoutPropertiesLoose(source, excluded); | ||
var key, i; | ||
if (Object.getOwnPropertySymbols) { | ||
var sourceSymbolKeys = Object.getOwnPropertySymbols(source); | ||
for (i = 0; i < sourceSymbolKeys.length; i++) { | ||
key = sourceSymbolKeys[i]; | ||
if (excluded.indexOf(key) >= 0) continue; | ||
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; | ||
target[key] = source[key]; | ||
} | ||
} | ||
return target; | ||
} | ||
function _assertThisInitialized(self) { | ||
@@ -260,3 +296,7 @@ if (self === void 0) { | ||
_this$props$safeWithN = _this$props.safeWithNav, | ||
safeWithNav = _this$props$safeWithN === void 0 ? undefined : _this$props$safeWithN; | ||
safeWithNav = _this$props$safeWithN === void 0 ? undefined : _this$props$safeWithN, | ||
style = _this$props.style, | ||
testId = _this$props.testId, | ||
restProps = _objectWithoutProperties(_this$props, ["href", "onClick", "skipClientNav", "beforeNav", "safeWithNav", "style", "testId"]); | ||
var ClickableBehavior = getClickableBehavior(href, skipClientNav, this.context.router); | ||
@@ -269,7 +309,5 @@ return /*#__PURE__*/createElement(ClickableBehavior, { | ||
}, function (state, handlers) { | ||
return _this2.getCorrectTag(state, _objectSpread2({ | ||
// eslint-disable-next-line react/prop-types | ||
"aria-label": _this2.props["aria-label"], | ||
"data-test-id": _this2.props.testId, | ||
style: [styles.reset, _this2.props.style] | ||
return _this2.getCorrectTag(state, _objectSpread2(_objectSpread2({}, restProps), {}, { | ||
"data-test-id": testId, | ||
style: [styles.reset, style] | ||
}, handlers)); | ||
@@ -276,0 +314,0 @@ }); |
@@ -1356,2 +1356,6 @@ module.exports = | ||
function clickable_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } | ||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } | ||
function clickable_extends() { clickable_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 clickable_extends.apply(this, arguments); } | ||
@@ -1470,3 +1474,7 @@ | ||
_this$props$safeWithN = _this$props.safeWithNav, | ||
safeWithNav = _this$props$safeWithN === void 0 ? undefined : _this$props$safeWithN; | ||
safeWithNav = _this$props$safeWithN === void 0 ? undefined : _this$props$safeWithN, | ||
style = _this$props.style, | ||
testId = _this$props.testId, | ||
restProps = clickable_objectWithoutProperties(_this$props, ["href", "onClick", "skipClientNav", "beforeNav", "safeWithNav", "style", "testId"]); | ||
var ClickableBehavior = Object(wonder_blocks_core_["getClickableBehavior"])(href, skipClientNav, this.context.router); | ||
@@ -1479,7 +1487,5 @@ return /*#__PURE__*/external_react_["createElement"](ClickableBehavior, { | ||
}, function (state, handlers) { | ||
return _this2.getCorrectTag(state, _objectSpread({ | ||
// eslint-disable-next-line react/prop-types | ||
"aria-label": _this2.props["aria-label"], | ||
"data-test-id": _this2.props.testId, | ||
style: [styles.reset, _this2.props.style] | ||
return _this2.getCorrectTag(state, _objectSpread(_objectSpread({}, restProps), {}, { | ||
"data-test-id": testId, | ||
style: [styles.reset, style] | ||
}, handlers)); | ||
@@ -1486,0 +1492,0 @@ }); |
{ | ||
"name": "@khanacademy/wonder-blocks-clickable", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"design": "v1", | ||
@@ -32,3 +32,3 @@ "description": "Clickable component for Wonder-Blocks.", | ||
}, | ||
"gitHead": "1acae0028f07078bd0d69261a4ef752958943d5a" | ||
"gitHead": "56683c4c76becee78d40834acd354937e24e8781" | ||
} |
Sorry, the diff of this file is not supported yet
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
105697
2420
6