@khanacademy/wonder-blocks-button 6.3.5 → 6.3.6
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/es/index.js +2 -28
- package/dist/index.js +29 -51
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @khanacademy/wonder-blocks-button
|
|
2
2
|
|
|
3
|
+
## 6.3.6
|
|
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-progress-spinner@2.1.4
|
|
13
|
+
- @khanacademy/wonder-blocks-theming@2.0.3
|
|
14
|
+
- @khanacademy/wonder-blocks-tokens@1.3.1
|
|
15
|
+
- @khanacademy/wonder-blocks-typography@2.1.14
|
|
16
|
+
|
|
3
17
|
## 6.3.5
|
|
4
18
|
|
|
5
19
|
### 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 { __RouterContext } from 'react-router';
|
|
3
5
|
import { isClientSideUrl, getClickableBehavior } from '@khanacademy/wonder-blocks-clickable';
|
|
@@ -10,34 +12,6 @@ import { mergeTheme, createThemeContext, ThemeSwitcherContext, useScopedTheme, u
|
|
|
10
12
|
import * as tokens from '@khanacademy/wonder-blocks-tokens';
|
|
11
13
|
import { PhosphorIcon } from '@khanacademy/wonder-blocks-icon';
|
|
12
14
|
|
|
13
|
-
function _extends() {
|
|
14
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
15
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
16
|
-
var source = arguments[i];
|
|
17
|
-
for (var key in source) {
|
|
18
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
19
|
-
target[key] = source[key];
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return target;
|
|
24
|
-
};
|
|
25
|
-
return _extends.apply(this, arguments);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
29
|
-
if (source == null) return {};
|
|
30
|
-
var target = {};
|
|
31
|
-
var sourceKeys = Object.keys(source);
|
|
32
|
-
var key, i;
|
|
33
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
34
|
-
key = sourceKeys[i];
|
|
35
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
36
|
-
target[key] = source[key];
|
|
37
|
-
}
|
|
38
|
-
return target;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
15
|
const theme$1 = {
|
|
42
16
|
color: {
|
|
43
17
|
bg: {
|
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 reactRouter = require('react-router');
|
|
5
7
|
var wonderBlocksClickable = require('@khanacademy/wonder-blocks-clickable');
|
|
@@ -12,55 +14,31 @@ var wonderBlocksTheming = require('@khanacademy/wonder-blocks-theming');
|
|
|
12
14
|
var tokens = require('@khanacademy/wonder-blocks-tokens');
|
|
13
15
|
var wonderBlocksIcon = require('@khanacademy/wonder-blocks-icon');
|
|
14
16
|
|
|
17
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
18
|
+
|
|
15
19
|
function _interopNamespace(e) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
if (e && e.__esModule) return e;
|
|
21
|
+
var n = Object.create(null);
|
|
22
|
+
if (e) {
|
|
23
|
+
Object.keys(e).forEach(function (k) {
|
|
24
|
+
if (k !== 'default') {
|
|
25
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
26
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function () { return e[k]; }
|
|
29
|
+
});
|
|
30
|
+
}
|
|
25
31
|
});
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
n["default"] = e;
|
|
30
|
-
return Object.freeze(n);
|
|
32
|
+
}
|
|
33
|
+
n["default"] = e;
|
|
34
|
+
return Object.freeze(n);
|
|
31
35
|
}
|
|
32
36
|
|
|
37
|
+
var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
|
|
38
|
+
var _objectWithoutPropertiesLoose__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutPropertiesLoose);
|
|
33
39
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
34
40
|
var tokens__namespace = /*#__PURE__*/_interopNamespace(tokens);
|
|
35
41
|
|
|
36
|
-
function _extends() {
|
|
37
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
38
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
39
|
-
var source = arguments[i];
|
|
40
|
-
for (var key in source) {
|
|
41
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
42
|
-
target[key] = source[key];
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return target;
|
|
47
|
-
};
|
|
48
|
-
return _extends.apply(this, arguments);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
52
|
-
if (source == null) return {};
|
|
53
|
-
var target = {};
|
|
54
|
-
var sourceKeys = Object.keys(source);
|
|
55
|
-
var key, i;
|
|
56
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
57
|
-
key = sourceKeys[i];
|
|
58
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
59
|
-
target[key] = source[key];
|
|
60
|
-
}
|
|
61
|
-
return target;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
42
|
const theme$1 = {
|
|
65
43
|
color: {
|
|
66
44
|
bg: {
|
|
@@ -246,13 +224,13 @@ function ButtonIcon({
|
|
|
246
224
|
};
|
|
247
225
|
switch (size) {
|
|
248
226
|
case "small":
|
|
249
|
-
return React__namespace.createElement(wonderBlocksIcon.PhosphorIcon,
|
|
227
|
+
return React__namespace.createElement(wonderBlocksIcon.PhosphorIcon, _extends__default["default"]({}, commonProps, {
|
|
250
228
|
size: "small",
|
|
251
229
|
icon: icon
|
|
252
230
|
}));
|
|
253
231
|
case "medium":
|
|
254
232
|
default:
|
|
255
|
-
return React__namespace.createElement(wonderBlocksIcon.PhosphorIcon,
|
|
233
|
+
return React__namespace.createElement(wonderBlocksIcon.PhosphorIcon, _extends__default["default"]({}, commonProps, {
|
|
256
234
|
size: "medium",
|
|
257
235
|
icon: icon
|
|
258
236
|
}));
|
|
@@ -291,11 +269,11 @@ const ButtonCore = React__namespace.forwardRef(function ButtonCore(props, ref) {
|
|
|
291
269
|
endIcon,
|
|
292
270
|
id
|
|
293
271
|
} = props,
|
|
294
|
-
restProps =
|
|
272
|
+
restProps = _objectWithoutPropertiesLoose__default["default"](props, _excluded$1);
|
|
295
273
|
const buttonStyles = _generateStyles(color, kind, light, size, theme, themeName);
|
|
296
274
|
const disabled = spinner || disabledProp;
|
|
297
275
|
const defaultStyle = [sharedStyles.shared, disabled && sharedStyles.disabled, startIcon && sharedStyles.withStartIcon, endIcon && sharedStyles.withEndIcon, buttonStyles.default, disabled && buttonStyles.disabled, kind !== "tertiary" && !disabled && (pressed ? buttonStyles.active : (hovered || focused) && buttonStyles.focus), kind === "tertiary" && !pressed && focused && [buttonStyles.focus, disabled && buttonStyles.disabledFocus], size === "small" && sharedStyles.small, size === "large" && sharedStyles.large];
|
|
298
|
-
const commonProps =
|
|
276
|
+
const commonProps = _extends__default["default"]({
|
|
299
277
|
"data-testid": testId,
|
|
300
278
|
id: id,
|
|
301
279
|
role: "button",
|
|
@@ -333,15 +311,15 @@ const ButtonCore = React__namespace.forwardRef(function ButtonCore(props, ref) {
|
|
|
333
311
|
testId: testId ? `${testId}-end-icon` : undefined
|
|
334
312
|
})));
|
|
335
313
|
if (href && !disabled) {
|
|
336
|
-
return router && !skipClientNav && wonderBlocksClickable.isClientSideUrl(href) ? React__namespace.createElement(StyledLink,
|
|
314
|
+
return router && !skipClientNav && wonderBlocksClickable.isClientSideUrl(href) ? React__namespace.createElement(StyledLink, _extends__default["default"]({}, commonProps, {
|
|
337
315
|
to: href,
|
|
338
316
|
ref: ref
|
|
339
|
-
}), contents) : React__namespace.createElement(StyledAnchor,
|
|
317
|
+
}), contents) : React__namespace.createElement(StyledAnchor, _extends__default["default"]({}, commonProps, {
|
|
340
318
|
href: href,
|
|
341
319
|
ref: ref
|
|
342
320
|
}), contents);
|
|
343
321
|
} else {
|
|
344
|
-
return React__namespace.createElement(StyledButton,
|
|
322
|
+
return React__namespace.createElement(StyledButton, _extends__default["default"]({
|
|
345
323
|
type: type || "button"
|
|
346
324
|
}, commonProps, {
|
|
347
325
|
"aria-disabled": disabled,
|
|
@@ -577,11 +555,11 @@ const Button = React__namespace.forwardRef(function Button(props, ref) {
|
|
|
577
555
|
disabled = false,
|
|
578
556
|
spinner = false
|
|
579
557
|
} = props,
|
|
580
|
-
sharedButtonCoreProps =
|
|
558
|
+
sharedButtonCoreProps = _objectWithoutPropertiesLoose__default["default"](props, _excluded);
|
|
581
559
|
const renderClickableBehavior = router => {
|
|
582
560
|
const ClickableBehavior = wonderBlocksClickable.getClickableBehavior(href, skipClientNav, router);
|
|
583
561
|
const renderProp = (state, restChildProps) => {
|
|
584
|
-
return React__namespace.createElement(ButtonCore,
|
|
562
|
+
return React__namespace.createElement(ButtonCore, _extends__default["default"]({}, sharedButtonCoreProps, state, restChildProps, {
|
|
585
563
|
disabled: disabled,
|
|
586
564
|
spinner: spinner || state.waiting,
|
|
587
565
|
color: color,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@khanacademy/wonder-blocks-button",
|
|
3
|
-
"version": "6.3.
|
|
3
|
+
"version": "6.3.6",
|
|
4
4
|
"design": "v1",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -16,13 +16,13 @@
|
|
|
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-progress-spinner": "^2.1.
|
|
23
|
-
"@khanacademy/wonder-blocks-theming": "^2.0.
|
|
24
|
-
"@khanacademy/wonder-blocks-tokens": "^1.3.
|
|
25
|
-
"@khanacademy/wonder-blocks-typography": "^2.1.
|
|
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-progress-spinner": "^2.1.4",
|
|
23
|
+
"@khanacademy/wonder-blocks-theming": "^2.0.3",
|
|
24
|
+
"@khanacademy/wonder-blocks-tokens": "^1.3.1",
|
|
25
|
+
"@khanacademy/wonder-blocks-typography": "^2.1.14"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"aphrodite": "^1.2.5",
|
|
@@ -31,6 +31,6 @@
|
|
|
31
31
|
"react-router-dom": "5.3.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@khanacademy/wb-dev-build-settings": "^1.0.
|
|
34
|
+
"@khanacademy/wb-dev-build-settings": "^1.0.1"
|
|
35
35
|
}
|
|
36
36
|
}
|