@khanacademy/wonder-blocks-icon-button 6.1.0 → 6.1.1
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/index.js +38 -33
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @khanacademy/wonder-blocks-icon-button
|
|
2
2
|
|
|
3
|
+
## 6.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- ee8d95a: Rollback rollup version from v4 to v2 to prevent an issue with CJS builds in unit tests
|
|
8
|
+
- Updated dependencies [ee8d95a]
|
|
9
|
+
- @khanacademy/wonder-blocks-clickable@6.1.1
|
|
10
|
+
- @khanacademy/wonder-blocks-core@12.1.1
|
|
11
|
+
- @khanacademy/wonder-blocks-icon@5.1.1
|
|
12
|
+
- @khanacademy/wonder-blocks-theming@3.1.1
|
|
13
|
+
- @khanacademy/wonder-blocks-tokens@4.2.1
|
|
14
|
+
|
|
3
15
|
## 6.1.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,10 @@ var wonderBlocksIcon = require('@khanacademy/wonder-blocks-icon');
|
|
|
12
12
|
var wonderBlocksTheming = require('@khanacademy/wonder-blocks-theming');
|
|
13
13
|
var wonderBlocksTokens = require('@khanacademy/wonder-blocks-tokens');
|
|
14
14
|
|
|
15
|
-
function
|
|
15
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
16
|
+
|
|
17
|
+
function _interopNamespace(e) {
|
|
18
|
+
if (e && e.__esModule) return e;
|
|
16
19
|
var n = Object.create(null);
|
|
17
20
|
if (e) {
|
|
18
21
|
Object.keys(e).forEach(function (k) {
|
|
@@ -25,11 +28,13 @@ function _interopNamespaceDefault(e) {
|
|
|
25
28
|
}
|
|
26
29
|
});
|
|
27
30
|
}
|
|
28
|
-
n
|
|
31
|
+
n["default"] = e;
|
|
29
32
|
return Object.freeze(n);
|
|
30
33
|
}
|
|
31
34
|
|
|
32
|
-
var
|
|
35
|
+
var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
|
|
36
|
+
var _objectWithoutPropertiesLoose__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutPropertiesLoose);
|
|
37
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
33
38
|
|
|
34
39
|
const iconSizeForButtonSize = size => {
|
|
35
40
|
switch (size) {
|
|
@@ -60,9 +65,9 @@ const disabledLightStates = {
|
|
|
60
65
|
background: "transparent",
|
|
61
66
|
foreground: wonderBlocksTokens.color.white50
|
|
62
67
|
};
|
|
63
|
-
const baseColorStates =
|
|
64
|
-
progressive:
|
|
65
|
-
default:
|
|
68
|
+
const baseColorStates = _extends__default["default"]({}, wonderBlocksTokens.semanticColor.action.outlined, {
|
|
69
|
+
progressive: _extends__default["default"]({}, wonderBlocksTokens.semanticColor.action.outlined.progressive, {
|
|
70
|
+
default: _extends__default["default"]({}, wonderBlocksTokens.semanticColor.action.outlined.progressive.default, {
|
|
66
71
|
border: "transparent",
|
|
67
72
|
background: "transparent"
|
|
68
73
|
}),
|
|
@@ -72,8 +77,8 @@ const baseColorStates = _extends({}, wonderBlocksTokens.semanticColor.action.out
|
|
|
72
77
|
foreground: wonderBlocksTokens.semanticColor.action.outlined.progressive.press.foreground
|
|
73
78
|
}
|
|
74
79
|
}),
|
|
75
|
-
destructive:
|
|
76
|
-
default:
|
|
80
|
+
destructive: _extends__default["default"]({}, wonderBlocksTokens.semanticColor.action.outlined.destructive, {
|
|
81
|
+
default: _extends__default["default"]({}, wonderBlocksTokens.semanticColor.action.outlined.destructive.default, {
|
|
77
82
|
border: "transparent",
|
|
78
83
|
background: "transparent"
|
|
79
84
|
}),
|
|
@@ -96,7 +101,7 @@ const baseColorStates = _extends({}, wonderBlocksTokens.semanticColor.action.out
|
|
|
96
101
|
});
|
|
97
102
|
const theme$1 = {
|
|
98
103
|
color: {
|
|
99
|
-
primary:
|
|
104
|
+
primary: _extends__default["default"]({}, baseColorStates, {
|
|
100
105
|
progressiveLight: {
|
|
101
106
|
default: {
|
|
102
107
|
border: wonderBlocksTokens.semanticColor.border.inverse,
|
|
@@ -132,26 +137,26 @@ const theme$1 = {
|
|
|
132
137
|
}
|
|
133
138
|
}
|
|
134
139
|
}),
|
|
135
|
-
secondary:
|
|
136
|
-
progressive:
|
|
137
|
-
default:
|
|
140
|
+
secondary: _extends__default["default"]({}, baseColorStates, {
|
|
141
|
+
progressive: _extends__default["default"]({}, baseColorStates.progressive, {
|
|
142
|
+
default: _extends__default["default"]({}, baseColorStates.progressive.default, {
|
|
138
143
|
foreground: wonderBlocksTokens.semanticColor.text.primary
|
|
139
144
|
})
|
|
140
145
|
}),
|
|
141
|
-
destructive:
|
|
142
|
-
default:
|
|
146
|
+
destructive: _extends__default["default"]({}, baseColorStates.destructive, {
|
|
147
|
+
default: _extends__default["default"]({}, baseColorStates.destructive.default, {
|
|
143
148
|
foreground: wonderBlocksTokens.semanticColor.text.primary
|
|
144
149
|
})
|
|
145
150
|
})
|
|
146
151
|
}),
|
|
147
|
-
tertiary:
|
|
148
|
-
progressive:
|
|
149
|
-
default:
|
|
152
|
+
tertiary: _extends__default["default"]({}, baseColorStates, {
|
|
153
|
+
progressive: _extends__default["default"]({}, baseColorStates.progressive, {
|
|
154
|
+
default: _extends__default["default"]({}, baseColorStates.progressive.default, {
|
|
150
155
|
foreground: wonderBlocksTokens.semanticColor.text.secondary
|
|
151
156
|
})
|
|
152
157
|
}),
|
|
153
|
-
destructive:
|
|
154
|
-
default:
|
|
158
|
+
destructive: _extends__default["default"]({}, baseColorStates.destructive, {
|
|
159
|
+
default: _extends__default["default"]({}, baseColorStates.destructive.default, {
|
|
155
160
|
foreground: wonderBlocksTokens.semanticColor.text.secondary
|
|
156
161
|
})
|
|
157
162
|
})
|
|
@@ -276,7 +281,7 @@ const IconButtonCore = React__namespace.forwardRef(function IconButtonCore(props
|
|
|
276
281
|
testId,
|
|
277
282
|
type = "button"
|
|
278
283
|
} = props,
|
|
279
|
-
restProps =
|
|
284
|
+
restProps = _objectWithoutPropertiesLoose__default["default"](props, _excluded$1);
|
|
280
285
|
const {
|
|
281
286
|
theme,
|
|
282
287
|
themeName
|
|
@@ -288,20 +293,20 @@ const IconButtonCore = React__namespace.forwardRef(function IconButtonCore(props
|
|
|
288
293
|
size: size,
|
|
289
294
|
icon: icon
|
|
290
295
|
});
|
|
291
|
-
const commonProps =
|
|
296
|
+
const commonProps = _extends__default["default"]({
|
|
292
297
|
"data-testid": testId,
|
|
293
298
|
style: [defaultStyle, style]
|
|
294
299
|
}, restProps);
|
|
295
300
|
if (href && !disabled) {
|
|
296
|
-
return router && !skipClientNav && wonderBlocksClickable.isClientSideUrl(href) ? React__namespace.createElement(StyledLink,
|
|
301
|
+
return router && !skipClientNav && wonderBlocksClickable.isClientSideUrl(href) ? React__namespace.createElement(StyledLink, _extends__default["default"]({}, commonProps, {
|
|
297
302
|
to: href,
|
|
298
303
|
ref: ref
|
|
299
|
-
}), child) : React__namespace.createElement(StyledA,
|
|
304
|
+
}), child) : React__namespace.createElement(StyledA, _extends__default["default"]({}, commonProps, {
|
|
300
305
|
href: href,
|
|
301
306
|
ref: ref
|
|
302
307
|
}), child);
|
|
303
308
|
} else {
|
|
304
|
-
return React__namespace.createElement(StyledButton,
|
|
309
|
+
return React__namespace.createElement(StyledButton, _extends__default["default"]({
|
|
305
310
|
type: type
|
|
306
311
|
}, commonProps, {
|
|
307
312
|
onClick: disabled ? undefined : restProps.onClick,
|
|
@@ -425,12 +430,12 @@ const _generateStyles = (buttonColor = "default", disabled, kind, light, size, t
|
|
|
425
430
|
const kindOverrides = getStylesByKind(buttonColor, disabled, kind, light, theme);
|
|
426
431
|
const disabledStatesStyles = kindOverrides.disabled;
|
|
427
432
|
const newStyles = {
|
|
428
|
-
default:
|
|
433
|
+
default: _extends__default["default"]({
|
|
429
434
|
height: pixelsForSize,
|
|
430
435
|
width: pixelsForSize,
|
|
431
436
|
borderRadius: theme.border.radius.default
|
|
432
437
|
}, kindOverrides.default, {
|
|
433
|
-
":hover":
|
|
438
|
+
":hover": _extends__default["default"]({
|
|
434
439
|
boxShadow: "none",
|
|
435
440
|
borderRadius: theme.border.radius.default,
|
|
436
441
|
outlineWidth: theme.border.width.default
|
|
@@ -443,26 +448,26 @@ const _generateStyles = (buttonColor = "default", disabled, kind, light, size, t
|
|
|
443
448
|
backgroundColor: "transparent"
|
|
444
449
|
}
|
|
445
450
|
},
|
|
446
|
-
":focus-visible":
|
|
451
|
+
":focus-visible": _extends__default["default"]({
|
|
447
452
|
outlineWidth: theme.border.width.default,
|
|
448
453
|
outlineOffset: 1,
|
|
449
454
|
outlineStyle: "solid",
|
|
450
455
|
borderRadius: theme.border.radius.default
|
|
451
456
|
}, kindOverrides[":focus-visible"]),
|
|
452
|
-
":active":
|
|
457
|
+
":active": _extends__default["default"]({
|
|
453
458
|
outlineWidth: theme.border.width.default,
|
|
454
459
|
outlineOffset: 1,
|
|
455
460
|
outlineStyle: "solid",
|
|
456
461
|
borderRadius: theme.border.radius.default
|
|
457
462
|
}, kindOverrides[":active"])
|
|
458
463
|
}),
|
|
459
|
-
disabled:
|
|
464
|
+
disabled: _extends__default["default"]({
|
|
460
465
|
cursor: "not-allowed"
|
|
461
466
|
}, disabledStatesStyles, {
|
|
462
|
-
":hover":
|
|
467
|
+
":hover": _extends__default["default"]({}, disabledStatesStyles, {
|
|
463
468
|
outline: "none"
|
|
464
469
|
}),
|
|
465
|
-
":active":
|
|
470
|
+
":active": _extends__default["default"]({}, disabledStatesStyles, {
|
|
466
471
|
outline: "none"
|
|
467
472
|
}),
|
|
468
473
|
":focus-visible": disabledStatesStyles
|
|
@@ -486,7 +491,7 @@ const IconButton = React__namespace.forwardRef(function IconButton(props, ref) {
|
|
|
486
491
|
target,
|
|
487
492
|
type
|
|
488
493
|
} = props,
|
|
489
|
-
sharedProps =
|
|
494
|
+
sharedProps = _objectWithoutPropertiesLoose__default["default"](props, _excluded);
|
|
490
495
|
function handleKeyDown(e) {
|
|
491
496
|
const keyCode = e.key;
|
|
492
497
|
if (!href && (keyCode === "Enter" || keyCode === "Space")) {
|
|
@@ -501,7 +506,7 @@ const IconButton = React__namespace.forwardRef(function IconButton(props, ref) {
|
|
|
501
506
|
}
|
|
502
507
|
}
|
|
503
508
|
}
|
|
504
|
-
return React__namespace.createElement(ThemedIconButton, null, React__namespace.createElement(IconButtonCore,
|
|
509
|
+
return React__namespace.createElement(ThemedIconButton, null, React__namespace.createElement(IconButtonCore, _extends__default["default"]({}, sharedProps, {
|
|
505
510
|
color: color,
|
|
506
511
|
disabled: disabled,
|
|
507
512
|
href: href,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@khanacademy/wonder-blocks-icon-button",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.1",
|
|
4
4
|
"design": "v1",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@babel/runtime": "^7.24.5",
|
|
16
|
-
"@khanacademy/wonder-blocks-clickable": "6.1.
|
|
17
|
-
"@khanacademy/wonder-blocks-core": "12.1.
|
|
18
|
-
"@khanacademy/wonder-blocks-icon": "5.1.
|
|
19
|
-
"@khanacademy/wonder-blocks-theming": "3.1.
|
|
20
|
-
"@khanacademy/wonder-blocks-tokens": "4.2.
|
|
16
|
+
"@khanacademy/wonder-blocks-clickable": "6.1.1",
|
|
17
|
+
"@khanacademy/wonder-blocks-core": "12.1.1",
|
|
18
|
+
"@khanacademy/wonder-blocks-icon": "5.1.1",
|
|
19
|
+
"@khanacademy/wonder-blocks-theming": "3.1.1",
|
|
20
|
+
"@khanacademy/wonder-blocks-tokens": "4.2.1"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"aphrodite": "^1.2.5",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"react-router-dom": "5.3.4"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@khanacademy/wb-dev-build-settings": "2.1.
|
|
29
|
+
"@khanacademy/wb-dev-build-settings": "2.1.1"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
32
|
"test": "echo \"Error: no test specified\" && exit 1"
|