@khanacademy/wonder-blocks-icon-button 5.3.2 → 5.3.3
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 +12 -0
- package/dist/es/index.js +2 -28
- package/dist/index.js +32 -54
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @khanacademy/wonder-blocks-icon-button
|
|
2
2
|
|
|
3
|
+
## 5.3.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 559e82d5: Update to build tooling, generating smaller output
|
|
8
|
+
- Updated dependencies [559e82d5]
|
|
9
|
+
- @khanacademy/wonder-blocks-clickable@4.2.5
|
|
10
|
+
- @khanacademy/wonder-blocks-core@6.4.3
|
|
11
|
+
- @khanacademy/wonder-blocks-icon@4.1.3
|
|
12
|
+
- @khanacademy/wonder-blocks-theming@2.0.3
|
|
13
|
+
- @khanacademy/wonder-blocks-tokens@1.3.1
|
|
14
|
+
|
|
3
15
|
## 5.3.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/es/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import _extends from '@babel/runtime/helpers/extends';
|
|
2
|
+
import _objectWithoutPropertiesLoose from '@babel/runtime/helpers/objectWithoutPropertiesLoose';
|
|
1
3
|
import * as React from 'react';
|
|
2
4
|
import { StyleSheet } from 'aphrodite';
|
|
3
5
|
import { Link } from 'react-router-dom';
|
|
@@ -8,34 +10,6 @@ import { PhosphorIcon } from '@khanacademy/wonder-blocks-icon';
|
|
|
8
10
|
import { mergeTheme, createThemeContext, ThemeSwitcherContext, useScopedTheme } from '@khanacademy/wonder-blocks-theming';
|
|
9
11
|
import * as tokens from '@khanacademy/wonder-blocks-tokens';
|
|
10
12
|
|
|
11
|
-
function _extends() {
|
|
12
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
13
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
14
|
-
var source = arguments[i];
|
|
15
|
-
for (var key in source) {
|
|
16
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
17
|
-
target[key] = source[key];
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return target;
|
|
22
|
-
};
|
|
23
|
-
return _extends.apply(this, arguments);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
27
|
-
if (source == null) return {};
|
|
28
|
-
var target = {};
|
|
29
|
-
var sourceKeys = Object.keys(source);
|
|
30
|
-
var key, i;
|
|
31
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
32
|
-
key = sourceKeys[i];
|
|
33
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
34
|
-
target[key] = source[key];
|
|
35
|
-
}
|
|
36
|
-
return target;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
13
|
const iconSizeForButtonSize = size => {
|
|
40
14
|
switch (size) {
|
|
41
15
|
case "xsmall":
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var _extends = require('@babel/runtime/helpers/extends');
|
|
4
|
+
var _objectWithoutPropertiesLoose = require('@babel/runtime/helpers/objectWithoutPropertiesLoose');
|
|
3
5
|
var React = require('react');
|
|
4
6
|
var aphrodite = require('aphrodite');
|
|
5
7
|
var reactRouterDom = require('react-router-dom');
|
|
@@ -10,55 +12,31 @@ var wonderBlocksIcon = require('@khanacademy/wonder-blocks-icon');
|
|
|
10
12
|
var wonderBlocksTheming = require('@khanacademy/wonder-blocks-theming');
|
|
11
13
|
var tokens = require('@khanacademy/wonder-blocks-tokens');
|
|
12
14
|
|
|
15
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
16
|
+
|
|
13
17
|
function _interopNamespace(e) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
if (e && e.__esModule) return e;
|
|
19
|
+
var n = Object.create(null);
|
|
20
|
+
if (e) {
|
|
21
|
+
Object.keys(e).forEach(function (k) {
|
|
22
|
+
if (k !== 'default') {
|
|
23
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
24
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () { return e[k]; }
|
|
27
|
+
});
|
|
28
|
+
}
|
|
23
29
|
});
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
n["default"] = e;
|
|
28
|
-
return Object.freeze(n);
|
|
30
|
+
}
|
|
31
|
+
n["default"] = e;
|
|
32
|
+
return Object.freeze(n);
|
|
29
33
|
}
|
|
30
34
|
|
|
35
|
+
var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
|
|
36
|
+
var _objectWithoutPropertiesLoose__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutPropertiesLoose);
|
|
31
37
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
32
38
|
var tokens__namespace = /*#__PURE__*/_interopNamespace(tokens);
|
|
33
39
|
|
|
34
|
-
function _extends() {
|
|
35
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
36
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
37
|
-
var source = arguments[i];
|
|
38
|
-
for (var key in source) {
|
|
39
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
40
|
-
target[key] = source[key];
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return target;
|
|
45
|
-
};
|
|
46
|
-
return _extends.apply(this, arguments);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
50
|
-
if (source == null) return {};
|
|
51
|
-
var target = {};
|
|
52
|
-
var sourceKeys = Object.keys(source);
|
|
53
|
-
var key, i;
|
|
54
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
55
|
-
key = sourceKeys[i];
|
|
56
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
57
|
-
target[key] = source[key];
|
|
58
|
-
}
|
|
59
|
-
return target;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
40
|
const iconSizeForButtonSize = size => {
|
|
63
41
|
switch (size) {
|
|
64
42
|
case "xsmall":
|
|
@@ -264,7 +242,7 @@ const IconButtonCore = React__namespace.forwardRef(function IconButtonCore(props
|
|
|
264
242
|
style,
|
|
265
243
|
testId
|
|
266
244
|
} = props,
|
|
267
|
-
restProps =
|
|
245
|
+
restProps = _objectWithoutPropertiesLoose__default["default"](props, _excluded$1);
|
|
268
246
|
const {
|
|
269
247
|
theme,
|
|
270
248
|
themeName
|
|
@@ -276,20 +254,20 @@ const IconButtonCore = React__namespace.forwardRef(function IconButtonCore(props
|
|
|
276
254
|
size: size,
|
|
277
255
|
icon: icon
|
|
278
256
|
});
|
|
279
|
-
const commonProps =
|
|
257
|
+
const commonProps = _extends__default["default"]({
|
|
280
258
|
"data-testid": testId,
|
|
281
259
|
style: [defaultStyle, style]
|
|
282
260
|
}, restProps);
|
|
283
261
|
if (href && !disabled) {
|
|
284
|
-
return router && !skipClientNav && wonderBlocksClickable.isClientSideUrl(href) ? React__namespace.createElement(StyledLink,
|
|
262
|
+
return router && !skipClientNav && wonderBlocksClickable.isClientSideUrl(href) ? React__namespace.createElement(StyledLink, _extends__default["default"]({}, commonProps, {
|
|
285
263
|
to: href,
|
|
286
264
|
ref: ref
|
|
287
|
-
}), child) : React__namespace.createElement(StyledAnchor,
|
|
265
|
+
}), child) : React__namespace.createElement(StyledAnchor, _extends__default["default"]({}, commonProps, {
|
|
288
266
|
href: href,
|
|
289
267
|
ref: ref
|
|
290
268
|
}), child);
|
|
291
269
|
} else {
|
|
292
|
-
return React__namespace.createElement(StyledButton,
|
|
270
|
+
return React__namespace.createElement(StyledButton, _extends__default["default"]({
|
|
293
271
|
type: "button"
|
|
294
272
|
}, commonProps, {
|
|
295
273
|
onClick: disabled ? undefined : restProps.onClick,
|
|
@@ -395,7 +373,7 @@ const _generateStyles = (buttonColor = "default", kind, light, size, theme, them
|
|
|
395
373
|
width: pixelsForSize,
|
|
396
374
|
color: defaultColor,
|
|
397
375
|
borderRadius: theme.border.radius.default,
|
|
398
|
-
":hover":
|
|
376
|
+
":hover": _extends__default["default"]({
|
|
399
377
|
boxShadow: "none",
|
|
400
378
|
color: defaultStrokeColor,
|
|
401
379
|
borderRadius: theme.border.radius.default,
|
|
@@ -417,7 +395,7 @@ const _generateStyles = (buttonColor = "default", kind, light, size, theme, them
|
|
|
417
395
|
":focus:not(:focus-visible)": {
|
|
418
396
|
boxShadow: "none"
|
|
419
397
|
},
|
|
420
|
-
":focus-visible":
|
|
398
|
+
":focus-visible": _extends__default["default"]({
|
|
421
399
|
boxShadow: "none",
|
|
422
400
|
outlineWidth: theme.border.width.default,
|
|
423
401
|
outlineColor: defaultStrokeColor,
|
|
@@ -425,7 +403,7 @@ const _generateStyles = (buttonColor = "default", kind, light, size, theme, them
|
|
|
425
403
|
outlineStyle: "solid",
|
|
426
404
|
borderRadius: theme.border.radius.default
|
|
427
405
|
}, kindOverrides[":focus-visible"]),
|
|
428
|
-
":active":
|
|
406
|
+
":active": _extends__default["default"]({
|
|
429
407
|
color: light ? activeInverseColor : activeColor,
|
|
430
408
|
outlineWidth: theme.border.width.default,
|
|
431
409
|
outlineColor: light ? activeInverseColor : activeColor,
|
|
@@ -437,10 +415,10 @@ const _generateStyles = (buttonColor = "default", kind, light, size, theme, them
|
|
|
437
415
|
disabled: {
|
|
438
416
|
color: disabledStrokeColor,
|
|
439
417
|
cursor: "not-allowed",
|
|
440
|
-
":hover":
|
|
418
|
+
":hover": _extends__default["default"]({}, disabledStatesStyles, {
|
|
441
419
|
outline: "none"
|
|
442
420
|
}),
|
|
443
|
-
":active":
|
|
421
|
+
":active": _extends__default["default"]({}, disabledStatesStyles, {
|
|
444
422
|
outline: "none"
|
|
445
423
|
}),
|
|
446
424
|
":focus": {
|
|
@@ -470,7 +448,7 @@ const IconButton = React__namespace.forwardRef(function IconButton(props, ref) {
|
|
|
470
448
|
tabIndex,
|
|
471
449
|
target
|
|
472
450
|
} = props,
|
|
473
|
-
sharedProps =
|
|
451
|
+
sharedProps = _objectWithoutPropertiesLoose__default["default"](props, _excluded);
|
|
474
452
|
function handleKeyDown(e) {
|
|
475
453
|
const keyCode = e.key;
|
|
476
454
|
if (!href && (keyCode === "Enter" || keyCode === "Space")) {
|
|
@@ -485,7 +463,7 @@ const IconButton = React__namespace.forwardRef(function IconButton(props, ref) {
|
|
|
485
463
|
}
|
|
486
464
|
}
|
|
487
465
|
}
|
|
488
|
-
return React__namespace.createElement(ThemedIconButton, null, React__namespace.createElement(IconButtonCore,
|
|
466
|
+
return React__namespace.createElement(ThemedIconButton, null, React__namespace.createElement(IconButtonCore, _extends__default["default"]({}, sharedProps, {
|
|
489
467
|
color: color,
|
|
490
468
|
disabled: disabled,
|
|
491
469
|
href: href,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@khanacademy/wonder-blocks-icon-button",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.3",
|
|
4
4
|
"design": "v1",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
"license": "MIT",
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@babel/runtime": "^7.18.6",
|
|
19
|
-
"@khanacademy/wonder-blocks-clickable": "^4.2.
|
|
20
|
-
"@khanacademy/wonder-blocks-core": "^6.4.
|
|
21
|
-
"@khanacademy/wonder-blocks-icon": "^4.1.
|
|
22
|
-
"@khanacademy/wonder-blocks-theming": "^2.0.
|
|
23
|
-
"@khanacademy/wonder-blocks-tokens": "^1.3.
|
|
19
|
+
"@khanacademy/wonder-blocks-clickable": "^4.2.5",
|
|
20
|
+
"@khanacademy/wonder-blocks-core": "^6.4.3",
|
|
21
|
+
"@khanacademy/wonder-blocks-icon": "^4.1.3",
|
|
22
|
+
"@khanacademy/wonder-blocks-theming": "^2.0.3",
|
|
23
|
+
"@khanacademy/wonder-blocks-tokens": "^1.3.1"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"aphrodite": "^1.2.5",
|
|
@@ -29,6 +29,6 @@
|
|
|
29
29
|
"react-router-dom": "5.3.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@khanacademy/wb-dev-build-settings": "^1.0.
|
|
32
|
+
"@khanacademy/wb-dev-build-settings": "^1.0.1"
|
|
33
33
|
}
|
|
34
34
|
}
|