@khanacademy/wonder-blocks-icon-button 3.4.0 → 3.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# @khanacademy/wonder-blocks-icon-button
|
|
2
|
+
|
|
3
|
+
## 3.4.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [166ecc97]
|
|
8
|
+
- @khanacademy/wonder-blocks-clickable@2.2.4
|
|
9
|
+
|
|
10
|
+
## 3.4.3
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- @khanacademy/wonder-blocks-clickable@2.2.3
|
|
15
|
+
- @khanacademy/wonder-blocks-core@4.2.1
|
|
16
|
+
- @khanacademy/wonder-blocks-icon@1.2.25
|
|
17
|
+
|
|
18
|
+
## 3.4.2
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- Updated dependencies [901bfe82]
|
|
23
|
+
- @khanacademy/wonder-blocks-clickable@2.2.2
|
package/dist/es/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from '@babel/runtime/helpers/extends';
|
|
2
2
|
import _objectWithoutPropertiesLoose from '@babel/runtime/helpers/objectWithoutPropertiesLoose';
|
|
3
|
-
import
|
|
3
|
+
import * as React from 'react';
|
|
4
4
|
import { __RouterContext } from 'react-router';
|
|
5
5
|
import { isClientSideUrl, getClickableBehavior } from '@khanacademy/wonder-blocks-clickable';
|
|
6
6
|
import { StyleSheet } from 'aphrodite';
|
|
@@ -9,11 +9,11 @@ import Color, { SemanticColor, mix, fade } from '@khanacademy/wonder-blocks-colo
|
|
|
9
9
|
import { addStyle } from '@khanacademy/wonder-blocks-core';
|
|
10
10
|
import Icon from '@khanacademy/wonder-blocks-icon';
|
|
11
11
|
|
|
12
|
-
const _excluded = ["skipClientNav", "color", "disabled", "focused", "hovered", "href", "icon", "kind", "light", "pressed", "style", "testId", "waiting"];
|
|
12
|
+
const _excluded$1 = ["skipClientNav", "color", "disabled", "focused", "hovered", "href", "icon", "kind", "light", "pressed", "style", "testId", "waiting"];
|
|
13
13
|
const StyledAnchor = addStyle("a");
|
|
14
14
|
const StyledButton = addStyle("button");
|
|
15
15
|
const StyledLink = addStyle(Link);
|
|
16
|
-
class IconButtonCore extends Component {
|
|
16
|
+
class IconButtonCore extends React.Component {
|
|
17
17
|
renderInner(router) {
|
|
18
18
|
const _this$props = this.props,
|
|
19
19
|
{
|
|
@@ -30,14 +30,14 @@ class IconButtonCore extends Component {
|
|
|
30
30
|
style,
|
|
31
31
|
testId
|
|
32
32
|
} = _this$props,
|
|
33
|
-
restProps = _objectWithoutPropertiesLoose(_this$props, _excluded);
|
|
33
|
+
restProps = _objectWithoutPropertiesLoose(_this$props, _excluded$1);
|
|
34
34
|
|
|
35
35
|
const buttonColor = color === "destructive" ? SemanticColor.controlDestructive : SemanticColor.controlDefault;
|
|
36
36
|
|
|
37
37
|
const buttonStyles = _generateStyles(buttonColor, kind, light);
|
|
38
38
|
|
|
39
39
|
const defaultStyle = [sharedStyles.shared, disabled && sharedStyles.disabled, buttonStyles.default, disabled && buttonStyles.disabled, !disabled && (pressed ? buttonStyles.active : (hovered || focused) && buttonStyles.focus)];
|
|
40
|
-
const child = /*#__PURE__*/createElement(Icon, {
|
|
40
|
+
const child = /*#__PURE__*/React.createElement(Icon, {
|
|
41
41
|
size: "medium",
|
|
42
42
|
color: "currentColor",
|
|
43
43
|
icon: icon
|
|
@@ -49,13 +49,13 @@ class IconButtonCore extends Component {
|
|
|
49
49
|
}, restProps);
|
|
50
50
|
|
|
51
51
|
if (href && !disabled) {
|
|
52
|
-
return router && !skipClientNav && isClientSideUrl(href) ? /*#__PURE__*/createElement(StyledLink, _extends({}, commonProps, {
|
|
52
|
+
return router && !skipClientNav && isClientSideUrl(href) ? /*#__PURE__*/React.createElement(StyledLink, _extends({}, commonProps, {
|
|
53
53
|
to: href
|
|
54
|
-
}), child) : /*#__PURE__*/createElement(StyledAnchor, _extends({}, commonProps, {
|
|
54
|
+
}), child) : /*#__PURE__*/React.createElement(StyledAnchor, _extends({}, commonProps, {
|
|
55
55
|
href: href
|
|
56
56
|
}), child);
|
|
57
57
|
} else {
|
|
58
|
-
return /*#__PURE__*/createElement(StyledButton, _extends({
|
|
58
|
+
return /*#__PURE__*/React.createElement(StyledButton, _extends({
|
|
59
59
|
type: "button"
|
|
60
60
|
}, commonProps, {
|
|
61
61
|
disabled: disabled
|
|
@@ -64,7 +64,7 @@ class IconButtonCore extends Component {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
render() {
|
|
67
|
-
return /*#__PURE__*/createElement(__RouterContext.Consumer, null, router => this.renderInner(router));
|
|
67
|
+
return /*#__PURE__*/React.createElement(__RouterContext.Consumer, null, router => this.renderInner(router));
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
}
|
|
@@ -157,7 +157,7 @@ const _generateStyles = (color, kind, light) => {
|
|
|
157
157
|
return styles[buttonType];
|
|
158
158
|
};
|
|
159
159
|
|
|
160
|
-
const _excluded
|
|
160
|
+
const _excluded = ["onClick", "href", "skipClientNav", "tabIndex", "target"],
|
|
161
161
|
_excluded2 = ["tabIndex"];
|
|
162
162
|
|
|
163
163
|
/**
|
|
@@ -196,7 +196,7 @@ const _excluded$1 = ["onClick", "href", "skipClientNav", "tabIndex", "target"],
|
|
|
196
196
|
* />
|
|
197
197
|
* ```
|
|
198
198
|
*/
|
|
199
|
-
class IconButton extends Component {
|
|
199
|
+
class IconButton extends React.Component {
|
|
200
200
|
renderClickableBehavior(router) {
|
|
201
201
|
const _this$props = this.props,
|
|
202
202
|
{
|
|
@@ -206,10 +206,10 @@ class IconButton extends Component {
|
|
|
206
206
|
tabIndex,
|
|
207
207
|
target
|
|
208
208
|
} = _this$props,
|
|
209
|
-
sharedProps = _objectWithoutPropertiesLoose(_this$props, _excluded
|
|
209
|
+
sharedProps = _objectWithoutPropertiesLoose(_this$props, _excluded);
|
|
210
210
|
|
|
211
211
|
const ClickableBehavior = getClickableBehavior(href, skipClientNav, router);
|
|
212
|
-
return /*#__PURE__*/createElement(ClickableBehavior, {
|
|
212
|
+
return /*#__PURE__*/React.createElement(ClickableBehavior, {
|
|
213
213
|
disabled: sharedProps.disabled,
|
|
214
214
|
href: href,
|
|
215
215
|
onClick: onClick,
|
|
@@ -221,7 +221,7 @@ class IconButton extends Component {
|
|
|
221
221
|
} = _ref,
|
|
222
222
|
childrenProps = _objectWithoutPropertiesLoose(_ref, _excluded2);
|
|
223
223
|
|
|
224
|
-
return /*#__PURE__*/createElement(IconButtonCore, _extends({}, sharedProps, state, childrenProps, {
|
|
224
|
+
return /*#__PURE__*/React.createElement(IconButtonCore, _extends({}, sharedProps, state, childrenProps, {
|
|
225
225
|
skipClientNav: skipClientNav,
|
|
226
226
|
href: href,
|
|
227
227
|
target: target // If tabIndex is provide to the component we allow
|
|
@@ -234,7 +234,7 @@ class IconButton extends Component {
|
|
|
234
234
|
}
|
|
235
235
|
|
|
236
236
|
render() {
|
|
237
|
-
return /*#__PURE__*/createElement(__RouterContext.Consumer, null, router => this.renderClickableBehavior(router));
|
|
237
|
+
return /*#__PURE__*/React.createElement(__RouterContext.Consumer, null, router => this.renderClickableBehavior(router));
|
|
238
238
|
}
|
|
239
239
|
|
|
240
240
|
}
|
|
@@ -245,4 +245,4 @@ IconButton.defaultProps = {
|
|
|
245
245
|
disabled: false
|
|
246
246
|
};
|
|
247
247
|
|
|
248
|
-
export default
|
|
248
|
+
export { IconButton as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@khanacademy/wonder-blocks-icon-button",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.4",
|
|
4
4
|
"design": "v1",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
"author": "",
|
|
16
16
|
"license": "MIT",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@babel/runtime": "^7.
|
|
19
|
-
"@khanacademy/wonder-blocks-clickable": "^2.2.
|
|
20
|
-
"@khanacademy/wonder-blocks-color": "^1.1.
|
|
21
|
-
"@khanacademy/wonder-blocks-core": "^
|
|
22
|
-
"@khanacademy/wonder-blocks-icon": "^1.2.
|
|
18
|
+
"@babel/runtime": "^7.16.3",
|
|
19
|
+
"@khanacademy/wonder-blocks-clickable": "^2.2.4",
|
|
20
|
+
"@khanacademy/wonder-blocks-color": "^1.1.20",
|
|
21
|
+
"@khanacademy/wonder-blocks-core": "^4.2.1",
|
|
22
|
+
"@khanacademy/wonder-blocks-icon": "^1.2.25"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"aphrodite": "^1.2.5",
|
|
@@ -28,7 +28,6 @@
|
|
|
28
28
|
"react-router-dom": "5.3.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"wb-dev-build-settings": "^0.
|
|
32
|
-
}
|
|
33
|
-
"gitHead": "b6193f70c73e70fbaf76bc688dc69a47fb1d0ef3"
|
|
31
|
+
"wb-dev-build-settings": "^0.3.0"
|
|
32
|
+
}
|
|
34
33
|
}
|
|
@@ -335,7 +335,7 @@ exports[`wonder-blocks-icon-button example 1 1`] = `
|
|
|
335
335
|
"width": 40,
|
|
336
336
|
}
|
|
337
337
|
}
|
|
338
|
-
tabIndex={
|
|
338
|
+
tabIndex={0}
|
|
339
339
|
type="button"
|
|
340
340
|
>
|
|
341
341
|
<svg
|
|
@@ -427,7 +427,7 @@ exports[`wonder-blocks-icon-button example 1 1`] = `
|
|
|
427
427
|
"width": 40,
|
|
428
428
|
}
|
|
429
429
|
}
|
|
430
|
-
tabIndex={
|
|
430
|
+
tabIndex={0}
|
|
431
431
|
type="button"
|
|
432
432
|
>
|
|
433
433
|
<svg
|
|
@@ -178,14 +178,8 @@ export default class IconButton extends React.Component<SharedProps> {
|
|
|
178
178
|
};
|
|
179
179
|
|
|
180
180
|
renderClickableBehavior(router: any): React.Node {
|
|
181
|
-
const {
|
|
182
|
-
|
|
183
|
-
href,
|
|
184
|
-
skipClientNav,
|
|
185
|
-
tabIndex,
|
|
186
|
-
target,
|
|
187
|
-
...sharedProps
|
|
188
|
-
} = this.props;
|
|
181
|
+
const {onClick, href, skipClientNav, tabIndex, target, ...sharedProps} =
|
|
182
|
+
this.props;
|
|
189
183
|
|
|
190
184
|
const ClickableBehavior = getClickableBehavior(
|
|
191
185
|
href,
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2018 Khan Academy
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|