@khanacademy/wonder-blocks-button 7.0.8 → 7.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
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.
package/dist/es/index.js CHANGED
@@ -363,7 +363,7 @@ function ButtonIcon({
363
363
  }
364
364
 
365
365
  const _excluded$1 = ["children", "skipClientNav", "color", "disabled", "focused", "hovered", "href", "kind", "labelStyle", "light", "pressed", "size", "style", "testId", "type", "spinner", "startIcon", "endIcon", "id", "waiting"];
366
- const StyledAnchor = addStyle("a");
366
+ const StyledA = addStyle("a");
367
367
  const StyledButton = addStyle("button");
368
368
  const StyledLink = addStyle(Link);
369
369
  const ButtonCore = React.forwardRef(function ButtonCore(props, ref) {
@@ -439,7 +439,7 @@ const ButtonCore = React.forwardRef(function ButtonCore(props, ref) {
439
439
  return router && !skipClientNav && isClientSideUrl(href) ? React.createElement(StyledLink, _extends({}, commonProps, {
440
440
  to: href,
441
441
  ref: ref
442
- }), contents) : React.createElement(StyledAnchor, _extends({}, commonProps, {
442
+ }), contents) : React.createElement(StyledA, _extends({}, commonProps, {
443
443
  href: href,
444
444
  ref: ref
445
445
  }), contents);
package/dist/index.js CHANGED
@@ -14,10 +14,7 @@ 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 _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;
17
+ function _interopNamespaceDefault(e) {
21
18
  var n = Object.create(null);
22
19
  if (e) {
23
20
  Object.keys(e).forEach(function (k) {
@@ -30,14 +27,12 @@ function _interopNamespace(e) {
30
27
  }
31
28
  });
32
29
  }
33
- n["default"] = e;
30
+ n.default = e;
34
31
  return Object.freeze(n);
35
32
  }
36
33
 
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);
34
+ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
35
+ var tokens__namespace = /*#__PURE__*/_interopNamespaceDefault(tokens);
41
36
 
42
37
  const {
43
38
  semanticColor
@@ -46,18 +41,18 @@ const textUnderlineOffset = tokens__namespace.spacing.xxxSmall_4;
46
41
  const theme$1 = {
47
42
  color: {
48
43
  filled: {
49
- progressive: _extends__default["default"]({}, semanticColor.action.filled.progressive, {
44
+ progressive: _extends({}, semanticColor.action.filled.progressive, {
50
45
  disabled: {
51
46
  border: semanticColor.action.disabled.default,
52
47
  background: semanticColor.action.disabled.default,
53
48
  foreground: semanticColor.action.disabled.secondary
54
49
  }
55
50
  }),
56
- progressiveLight: _extends__default["default"]({}, semanticColor.action.outlined.progressive, {
57
- hover: _extends__default["default"]({}, semanticColor.action.outlined.progressive.hover, {
51
+ progressiveLight: _extends({}, semanticColor.action.outlined.progressive, {
52
+ hover: _extends({}, semanticColor.action.outlined.progressive.hover, {
58
53
  border: semanticColor.border.inverse
59
54
  }),
60
- press: _extends__default["default"]({}, semanticColor.action.outlined.progressive.press, {
55
+ press: _extends({}, semanticColor.action.outlined.progressive.press, {
61
56
  border: semanticColor.action.outlined.progressive.press.background
62
57
  }),
63
58
  disabled: {
@@ -66,18 +61,18 @@ const theme$1 = {
66
61
  foreground: semanticColor.action.outlined.progressive.default.foreground
67
62
  }
68
63
  }),
69
- destructive: _extends__default["default"]({}, semanticColor.action.filled.destructive, {
64
+ destructive: _extends({}, semanticColor.action.filled.destructive, {
70
65
  disabled: {
71
66
  border: semanticColor.action.disabled.default,
72
67
  background: semanticColor.action.disabled.default,
73
68
  foreground: semanticColor.action.disabled.secondary
74
69
  }
75
70
  }),
76
- destructiveLight: _extends__default["default"]({}, semanticColor.action.outlined.destructive, {
77
- hover: _extends__default["default"]({}, semanticColor.action.outlined.progressive.hover, {
71
+ destructiveLight: _extends({}, semanticColor.action.outlined.destructive, {
72
+ hover: _extends({}, semanticColor.action.outlined.progressive.hover, {
78
73
  border: semanticColor.border.inverse
79
74
  }),
80
- press: _extends__default["default"]({}, semanticColor.action.outlined.destructive.press, {
75
+ press: _extends({}, semanticColor.action.outlined.destructive.press, {
81
76
  border: semanticColor.action.outlined.destructive.press.background
82
77
  }),
83
78
  disabled: {
@@ -88,11 +83,11 @@ const theme$1 = {
88
83
  })
89
84
  },
90
85
  outlined: {
91
- progressive: _extends__default["default"]({}, semanticColor.action.outlined.progressive, {
92
- default: _extends__default["default"]({}, semanticColor.action.outlined.progressive.default, {
86
+ progressive: _extends({}, semanticColor.action.outlined.progressive, {
87
+ default: _extends({}, semanticColor.action.outlined.progressive.default, {
93
88
  background: "transparent"
94
89
  }),
95
- hover: _extends__default["default"]({}, semanticColor.action.outlined.progressive.hover, {
90
+ hover: _extends({}, semanticColor.action.outlined.progressive.hover, {
96
91
  background: "transparent",
97
92
  icon: "transparent"
98
93
  }),
@@ -125,8 +120,8 @@ const theme$1 = {
125
120
  foreground: tokens__namespace.color.white50
126
121
  }
127
122
  },
128
- destructive: _extends__default["default"]({}, semanticColor.action.outlined.destructive, {
129
- hover: _extends__default["default"]({}, semanticColor.action.outlined.destructive.hover, {
123
+ destructive: _extends({}, semanticColor.action.outlined.destructive, {
124
+ hover: _extends({}, semanticColor.action.outlined.destructive.hover, {
130
125
  background: "transparent",
131
126
  icon: "transparent"
132
127
  }),
@@ -376,13 +371,13 @@ function ButtonIcon({
376
371
  };
377
372
  switch (size) {
378
373
  case "small":
379
- return React__namespace.createElement(wonderBlocksIcon.PhosphorIcon, _extends__default["default"]({}, commonProps, {
374
+ return React__namespace.createElement(wonderBlocksIcon.PhosphorIcon, _extends({}, commonProps, {
380
375
  size: "small",
381
376
  icon: icon
382
377
  }));
383
378
  case "medium":
384
379
  default:
385
- return React__namespace.createElement(wonderBlocksIcon.PhosphorIcon, _extends__default["default"]({}, commonProps, {
380
+ return React__namespace.createElement(wonderBlocksIcon.PhosphorIcon, _extends({}, commonProps, {
386
381
  size: "medium",
387
382
  icon: icon
388
383
  }));
@@ -390,7 +385,7 @@ function ButtonIcon({
390
385
  }
391
386
 
392
387
  const _excluded$1 = ["children", "skipClientNav", "color", "disabled", "focused", "hovered", "href", "kind", "labelStyle", "light", "pressed", "size", "style", "testId", "type", "spinner", "startIcon", "endIcon", "id", "waiting"];
393
- const StyledAnchor = wonderBlocksCore.addStyle("a");
388
+ const StyledA = wonderBlocksCore.addStyle("a");
394
389
  const StyledButton = wonderBlocksCore.addStyle("button");
395
390
  const StyledLink = wonderBlocksCore.addStyle(reactRouterDom.Link);
396
391
  const ButtonCore = React__namespace.forwardRef(function ButtonCore(props, ref) {
@@ -421,11 +416,11 @@ const ButtonCore = React__namespace.forwardRef(function ButtonCore(props, ref) {
421
416
  endIcon,
422
417
  id
423
418
  } = props,
424
- restProps = _objectWithoutPropertiesLoose__default["default"](props, _excluded$1);
419
+ restProps = _objectWithoutPropertiesLoose(props, _excluded$1);
425
420
  const buttonStyles = _generateStyles(color, kind, light, size, theme, themeName);
426
421
  const disabled = spinner || disabledProp;
427
422
  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];
428
- const commonProps = _extends__default["default"]({
423
+ const commonProps = _extends({
429
424
  "data-testid": testId,
430
425
  id: id,
431
426
  role: "button",
@@ -463,15 +458,15 @@ const ButtonCore = React__namespace.forwardRef(function ButtonCore(props, ref) {
463
458
  testId: testId ? `${testId}-end-icon` : undefined
464
459
  })));
465
460
  if (href && !disabled) {
466
- return router && !skipClientNav && wonderBlocksClickable.isClientSideUrl(href) ? React__namespace.createElement(StyledLink, _extends__default["default"]({}, commonProps, {
461
+ return router && !skipClientNav && wonderBlocksClickable.isClientSideUrl(href) ? React__namespace.createElement(StyledLink, _extends({}, commonProps, {
467
462
  to: href,
468
463
  ref: ref
469
- }), contents) : React__namespace.createElement(StyledAnchor, _extends__default["default"]({}, commonProps, {
464
+ }), contents) : React__namespace.createElement(StyledA, _extends({}, commonProps, {
470
465
  href: href,
471
466
  ref: ref
472
467
  }), contents);
473
468
  } else {
474
- return React__namespace.createElement(StyledButton, _extends__default["default"]({
469
+ return React__namespace.createElement(StyledButton, _extends({
475
470
  type: type || "button"
476
471
  }, commonProps, {
477
472
  "aria-disabled": disabled,
@@ -603,7 +598,7 @@ const _generateStyles = (buttonColor = "default", kind, light, size, theme, them
603
598
  background: themeColorAction.disabled.background,
604
599
  color: themeColorAction.disabled.foreground,
605
600
  cursor: "default",
606
- ":focus-visible": _extends__default["default"]({}, focusStyling, {
601
+ ":focus-visible": _extends({}, focusStyling, {
607
602
  outlineColor: themeColorAction.disabled.border
608
603
  })
609
604
  }
@@ -725,11 +720,11 @@ const Button = React__namespace.forwardRef(function Button(props, ref) {
725
720
  disabled = false,
726
721
  spinner = false
727
722
  } = props,
728
- sharedButtonCoreProps = _objectWithoutPropertiesLoose__default["default"](props, _excluded);
723
+ sharedButtonCoreProps = _objectWithoutPropertiesLoose(props, _excluded);
729
724
  const renderClickableBehavior = router => {
730
725
  const ClickableBehavior = wonderBlocksClickable.getClickableBehavior(href, skipClientNav, router);
731
726
  const renderProp = (state, restChildProps) => {
732
- return React__namespace.createElement(ButtonCore, _extends__default["default"]({}, sharedButtonCoreProps, state, restChildProps, {
727
+ return React__namespace.createElement(ButtonCore, _extends({}, sharedButtonCoreProps, state, restChildProps, {
733
728
  disabled: disabled,
734
729
  spinner: spinner || state.waiting,
735
730
  color: color,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@khanacademy/wonder-blocks-button",
3
- "version": "7.0.8",
3
+ "version": "7.1.0",
4
4
  "design": "v1",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -9,21 +9,17 @@
9
9
  "main": "dist/index.js",
10
10
  "module": "dist/es/index.js",
11
11
  "types": "dist/index.d.ts",
12
- "scripts": {
13
- "test": "echo \"Error: no test specified\" && exit 1",
14
- "prepublishOnly": "../../utils/publish/package-pre-publish-check.sh"
15
- },
16
12
  "author": "",
17
13
  "license": "MIT",
18
14
  "dependencies": {
19
- "@babel/runtime": "^7.18.6",
20
- "@khanacademy/wonder-blocks-clickable": "^6.0.0",
21
- "@khanacademy/wonder-blocks-core": "^12.0.0",
22
- "@khanacademy/wonder-blocks-icon": "^5.0.6",
23
- "@khanacademy/wonder-blocks-progress-spinner": "^3.0.8",
24
- "@khanacademy/wonder-blocks-theming": "^3.0.1",
25
- "@khanacademy/wonder-blocks-tokens": "^4.1.0",
26
- "@khanacademy/wonder-blocks-typography": "^3.0.6"
15
+ "@babel/runtime": "^7.24.5",
16
+ "@khanacademy/wonder-blocks-clickable": "6.1.0",
17
+ "@khanacademy/wonder-blocks-core": "12.1.0",
18
+ "@khanacademy/wonder-blocks-icon": "5.1.0",
19
+ "@khanacademy/wonder-blocks-progress-spinner": "3.1.0",
20
+ "@khanacademy/wonder-blocks-theming": "3.1.0",
21
+ "@khanacademy/wonder-blocks-tokens": "4.2.0",
22
+ "@khanacademy/wonder-blocks-typography": "3.1.0"
27
23
  },
28
24
  "peerDependencies": {
29
25
  "aphrodite": "^1.2.5",
@@ -32,6 +28,9 @@
32
28
  "react-router-dom": "5.3.4"
33
29
  },
34
30
  "devDependencies": {
35
- "@khanacademy/wb-dev-build-settings": "^2.0.0"
31
+ "@khanacademy/wb-dev-build-settings": "2.1.0"
32
+ },
33
+ "scripts": {
34
+ "test": "echo \"Error: no test specified\" && exit 1"
36
35
  }
37
36
  }