@khanacademy/wonder-blocks-button 7.1.0 → 7.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 +14 -0
- package/dist/index.js +32 -27
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @khanacademy/wonder-blocks-button
|
|
2
2
|
|
|
3
|
+
## 7.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-progress-spinner@3.1.1
|
|
13
|
+
- @khanacademy/wonder-blocks-theming@3.1.1
|
|
14
|
+
- @khanacademy/wonder-blocks-tokens@4.2.1
|
|
15
|
+
- @khanacademy/wonder-blocks-typography@3.1.1
|
|
16
|
+
|
|
3
17
|
## 7.1.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,10 @@ var wonderBlocksTheming = require('@khanacademy/wonder-blocks-theming');
|
|
|
14
14
|
var tokens = require('@khanacademy/wonder-blocks-tokens');
|
|
15
15
|
var wonderBlocksIcon = require('@khanacademy/wonder-blocks-icon');
|
|
16
16
|
|
|
17
|
-
function
|
|
17
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
18
|
+
|
|
19
|
+
function _interopNamespace(e) {
|
|
20
|
+
if (e && e.__esModule) return e;
|
|
18
21
|
var n = Object.create(null);
|
|
19
22
|
if (e) {
|
|
20
23
|
Object.keys(e).forEach(function (k) {
|
|
@@ -27,12 +30,14 @@ function _interopNamespaceDefault(e) {
|
|
|
27
30
|
}
|
|
28
31
|
});
|
|
29
32
|
}
|
|
30
|
-
n
|
|
33
|
+
n["default"] = e;
|
|
31
34
|
return Object.freeze(n);
|
|
32
35
|
}
|
|
33
36
|
|
|
34
|
-
var
|
|
35
|
-
var
|
|
37
|
+
var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
|
|
38
|
+
var _objectWithoutPropertiesLoose__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutPropertiesLoose);
|
|
39
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
40
|
+
var tokens__namespace = /*#__PURE__*/_interopNamespace(tokens);
|
|
36
41
|
|
|
37
42
|
const {
|
|
38
43
|
semanticColor
|
|
@@ -41,18 +46,18 @@ const textUnderlineOffset = tokens__namespace.spacing.xxxSmall_4;
|
|
|
41
46
|
const theme$1 = {
|
|
42
47
|
color: {
|
|
43
48
|
filled: {
|
|
44
|
-
progressive:
|
|
49
|
+
progressive: _extends__default["default"]({}, semanticColor.action.filled.progressive, {
|
|
45
50
|
disabled: {
|
|
46
51
|
border: semanticColor.action.disabled.default,
|
|
47
52
|
background: semanticColor.action.disabled.default,
|
|
48
53
|
foreground: semanticColor.action.disabled.secondary
|
|
49
54
|
}
|
|
50
55
|
}),
|
|
51
|
-
progressiveLight:
|
|
52
|
-
hover:
|
|
56
|
+
progressiveLight: _extends__default["default"]({}, semanticColor.action.outlined.progressive, {
|
|
57
|
+
hover: _extends__default["default"]({}, semanticColor.action.outlined.progressive.hover, {
|
|
53
58
|
border: semanticColor.border.inverse
|
|
54
59
|
}),
|
|
55
|
-
press:
|
|
60
|
+
press: _extends__default["default"]({}, semanticColor.action.outlined.progressive.press, {
|
|
56
61
|
border: semanticColor.action.outlined.progressive.press.background
|
|
57
62
|
}),
|
|
58
63
|
disabled: {
|
|
@@ -61,18 +66,18 @@ const theme$1 = {
|
|
|
61
66
|
foreground: semanticColor.action.outlined.progressive.default.foreground
|
|
62
67
|
}
|
|
63
68
|
}),
|
|
64
|
-
destructive:
|
|
69
|
+
destructive: _extends__default["default"]({}, semanticColor.action.filled.destructive, {
|
|
65
70
|
disabled: {
|
|
66
71
|
border: semanticColor.action.disabled.default,
|
|
67
72
|
background: semanticColor.action.disabled.default,
|
|
68
73
|
foreground: semanticColor.action.disabled.secondary
|
|
69
74
|
}
|
|
70
75
|
}),
|
|
71
|
-
destructiveLight:
|
|
72
|
-
hover:
|
|
76
|
+
destructiveLight: _extends__default["default"]({}, semanticColor.action.outlined.destructive, {
|
|
77
|
+
hover: _extends__default["default"]({}, semanticColor.action.outlined.progressive.hover, {
|
|
73
78
|
border: semanticColor.border.inverse
|
|
74
79
|
}),
|
|
75
|
-
press:
|
|
80
|
+
press: _extends__default["default"]({}, semanticColor.action.outlined.destructive.press, {
|
|
76
81
|
border: semanticColor.action.outlined.destructive.press.background
|
|
77
82
|
}),
|
|
78
83
|
disabled: {
|
|
@@ -83,11 +88,11 @@ const theme$1 = {
|
|
|
83
88
|
})
|
|
84
89
|
},
|
|
85
90
|
outlined: {
|
|
86
|
-
progressive:
|
|
87
|
-
default:
|
|
91
|
+
progressive: _extends__default["default"]({}, semanticColor.action.outlined.progressive, {
|
|
92
|
+
default: _extends__default["default"]({}, semanticColor.action.outlined.progressive.default, {
|
|
88
93
|
background: "transparent"
|
|
89
94
|
}),
|
|
90
|
-
hover:
|
|
95
|
+
hover: _extends__default["default"]({}, semanticColor.action.outlined.progressive.hover, {
|
|
91
96
|
background: "transparent",
|
|
92
97
|
icon: "transparent"
|
|
93
98
|
}),
|
|
@@ -120,8 +125,8 @@ const theme$1 = {
|
|
|
120
125
|
foreground: tokens__namespace.color.white50
|
|
121
126
|
}
|
|
122
127
|
},
|
|
123
|
-
destructive:
|
|
124
|
-
hover:
|
|
128
|
+
destructive: _extends__default["default"]({}, semanticColor.action.outlined.destructive, {
|
|
129
|
+
hover: _extends__default["default"]({}, semanticColor.action.outlined.destructive.hover, {
|
|
125
130
|
background: "transparent",
|
|
126
131
|
icon: "transparent"
|
|
127
132
|
}),
|
|
@@ -371,13 +376,13 @@ function ButtonIcon({
|
|
|
371
376
|
};
|
|
372
377
|
switch (size) {
|
|
373
378
|
case "small":
|
|
374
|
-
return React__namespace.createElement(wonderBlocksIcon.PhosphorIcon,
|
|
379
|
+
return React__namespace.createElement(wonderBlocksIcon.PhosphorIcon, _extends__default["default"]({}, commonProps, {
|
|
375
380
|
size: "small",
|
|
376
381
|
icon: icon
|
|
377
382
|
}));
|
|
378
383
|
case "medium":
|
|
379
384
|
default:
|
|
380
|
-
return React__namespace.createElement(wonderBlocksIcon.PhosphorIcon,
|
|
385
|
+
return React__namespace.createElement(wonderBlocksIcon.PhosphorIcon, _extends__default["default"]({}, commonProps, {
|
|
381
386
|
size: "medium",
|
|
382
387
|
icon: icon
|
|
383
388
|
}));
|
|
@@ -416,11 +421,11 @@ const ButtonCore = React__namespace.forwardRef(function ButtonCore(props, ref) {
|
|
|
416
421
|
endIcon,
|
|
417
422
|
id
|
|
418
423
|
} = props,
|
|
419
|
-
restProps =
|
|
424
|
+
restProps = _objectWithoutPropertiesLoose__default["default"](props, _excluded$1);
|
|
420
425
|
const buttonStyles = _generateStyles(color, kind, light, size, theme, themeName);
|
|
421
426
|
const disabled = spinner || disabledProp;
|
|
422
427
|
const defaultStyle = [sharedStyles.shared, disabled && sharedStyles.disabled, startIcon && sharedStyles.withStartIcon, endIcon && sharedStyles.withEndIcon, buttonStyles.default, disabled && buttonStyles.disabled, kind !== "tertiary" && !disabled && (pressed ? buttonStyles.pressed : focused && buttonStyles.focused), kind === "tertiary" && !pressed && focused && [buttonStyles.focused, disabled && buttonStyles.disabledFocus], size === "small" && sharedStyles.small, size === "large" && sharedStyles.large];
|
|
423
|
-
const commonProps =
|
|
428
|
+
const commonProps = _extends__default["default"]({
|
|
424
429
|
"data-testid": testId,
|
|
425
430
|
id: id,
|
|
426
431
|
role: "button",
|
|
@@ -458,15 +463,15 @@ const ButtonCore = React__namespace.forwardRef(function ButtonCore(props, ref) {
|
|
|
458
463
|
testId: testId ? `${testId}-end-icon` : undefined
|
|
459
464
|
})));
|
|
460
465
|
if (href && !disabled) {
|
|
461
|
-
return router && !skipClientNav && wonderBlocksClickable.isClientSideUrl(href) ? React__namespace.createElement(StyledLink,
|
|
466
|
+
return router && !skipClientNav && wonderBlocksClickable.isClientSideUrl(href) ? React__namespace.createElement(StyledLink, _extends__default["default"]({}, commonProps, {
|
|
462
467
|
to: href,
|
|
463
468
|
ref: ref
|
|
464
|
-
}), contents) : React__namespace.createElement(StyledA,
|
|
469
|
+
}), contents) : React__namespace.createElement(StyledA, _extends__default["default"]({}, commonProps, {
|
|
465
470
|
href: href,
|
|
466
471
|
ref: ref
|
|
467
472
|
}), contents);
|
|
468
473
|
} else {
|
|
469
|
-
return React__namespace.createElement(StyledButton,
|
|
474
|
+
return React__namespace.createElement(StyledButton, _extends__default["default"]({
|
|
470
475
|
type: type || "button"
|
|
471
476
|
}, commonProps, {
|
|
472
477
|
"aria-disabled": disabled,
|
|
@@ -598,7 +603,7 @@ const _generateStyles = (buttonColor = "default", kind, light, size, theme, them
|
|
|
598
603
|
background: themeColorAction.disabled.background,
|
|
599
604
|
color: themeColorAction.disabled.foreground,
|
|
600
605
|
cursor: "default",
|
|
601
|
-
":focus-visible":
|
|
606
|
+
":focus-visible": _extends__default["default"]({}, focusStyling, {
|
|
602
607
|
outlineColor: themeColorAction.disabled.border
|
|
603
608
|
})
|
|
604
609
|
}
|
|
@@ -720,11 +725,11 @@ const Button = React__namespace.forwardRef(function Button(props, ref) {
|
|
|
720
725
|
disabled = false,
|
|
721
726
|
spinner = false
|
|
722
727
|
} = props,
|
|
723
|
-
sharedButtonCoreProps =
|
|
728
|
+
sharedButtonCoreProps = _objectWithoutPropertiesLoose__default["default"](props, _excluded);
|
|
724
729
|
const renderClickableBehavior = router => {
|
|
725
730
|
const ClickableBehavior = wonderBlocksClickable.getClickableBehavior(href, skipClientNav, router);
|
|
726
731
|
const renderProp = (state, restChildProps) => {
|
|
727
|
-
return React__namespace.createElement(ButtonCore,
|
|
732
|
+
return React__namespace.createElement(ButtonCore, _extends__default["default"]({}, sharedButtonCoreProps, state, restChildProps, {
|
|
728
733
|
disabled: disabled,
|
|
729
734
|
spinner: spinner || state.waiting,
|
|
730
735
|
color: color,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@khanacademy/wonder-blocks-button",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.1.1",
|
|
4
4
|
"design": "v1",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -13,13 +13,13 @@
|
|
|
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-progress-spinner": "3.1.
|
|
20
|
-
"@khanacademy/wonder-blocks-theming": "3.1.
|
|
21
|
-
"@khanacademy/wonder-blocks-tokens": "4.2.
|
|
22
|
-
"@khanacademy/wonder-blocks-typography": "3.1.
|
|
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-progress-spinner": "3.1.1",
|
|
20
|
+
"@khanacademy/wonder-blocks-theming": "3.1.1",
|
|
21
|
+
"@khanacademy/wonder-blocks-tokens": "4.2.1",
|
|
22
|
+
"@khanacademy/wonder-blocks-typography": "3.1.1"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"aphrodite": "^1.2.5",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"react-router-dom": "5.3.4"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@khanacademy/wb-dev-build-settings": "2.1.
|
|
31
|
+
"@khanacademy/wb-dev-build-settings": "2.1.1"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
34
34
|
"test": "echo \"Error: no test specified\" && exit 1"
|