@khanacademy/wonder-blocks-icon-button 3.4.21 → 3.4.22

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/dist/index.js CHANGED
@@ -1,7 +1,5 @@
1
1
  'use strict';
2
2
 
3
- var _extends = require('@babel/runtime/helpers/extends');
4
- var _objectWithoutPropertiesLoose = require('@babel/runtime/helpers/objectWithoutPropertiesLoose');
5
3
  var React = require('react');
6
4
  var reactRouter = require('react-router');
7
5
  var wonderBlocksClickable = require('@khanacademy/wonder-blocks-clickable');
@@ -14,88 +12,131 @@ var Icon = require('@khanacademy/wonder-blocks-icon');
14
12
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
15
13
 
16
14
  function _interopNamespace(e) {
17
- if (e && e.__esModule) return e;
18
- var n = Object.create(null);
19
- if (e) {
20
- Object.keys(e).forEach(function (k) {
21
- if (k !== 'default') {
22
- var d = Object.getOwnPropertyDescriptor(e, k);
23
- Object.defineProperty(n, k, d.get ? d : {
24
- enumerable: true,
25
- get: function () { return e[k]; }
26
- });
27
- }
15
+ if (e && e.__esModule) return e;
16
+ var n = Object.create(null);
17
+ if (e) {
18
+ Object.keys(e).forEach(function (k) {
19
+ if (k !== 'default') {
20
+ var d = Object.getOwnPropertyDescriptor(e, k);
21
+ Object.defineProperty(n, k, d.get ? d : {
22
+ enumerable: true,
23
+ get: function () { return e[k]; }
28
24
  });
29
- }
30
- n["default"] = e;
31
- return Object.freeze(n);
25
+ }
26
+ });
27
+ }
28
+ n["default"] = e;
29
+ return Object.freeze(n);
32
30
  }
33
31
 
34
- var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
35
- var _objectWithoutPropertiesLoose__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutPropertiesLoose);
36
32
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
37
33
  var Color__default = /*#__PURE__*/_interopDefaultLegacy(Color);
38
34
  var Icon__default = /*#__PURE__*/_interopDefaultLegacy(Icon);
39
35
 
36
+ function _objectDestructuringEmpty(obj) {
37
+ if (obj == null) throw new TypeError("Cannot destructure " + obj);
38
+ }
39
+
40
+ function _extends() {
41
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
42
+ for (var i = 1; i < arguments.length; i++) {
43
+ var source = arguments[i];
44
+ for (var key in source) {
45
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
46
+ target[key] = source[key];
47
+ }
48
+ }
49
+ }
50
+ return target;
51
+ };
52
+ return _extends.apply(this, arguments);
53
+ }
54
+
55
+ function _objectWithoutPropertiesLoose(source, excluded) {
56
+ if (source == null) return {};
57
+ var target = {};
58
+ var sourceKeys = Object.keys(source);
59
+ var key, i;
60
+ for (i = 0; i < sourceKeys.length; i++) {
61
+ key = sourceKeys[i];
62
+ if (excluded.indexOf(key) >= 0) continue;
63
+ target[key] = source[key];
64
+ }
65
+ return target;
66
+ }
67
+
68
+ function _setPrototypeOf(o, p) {
69
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
70
+ o.__proto__ = p;
71
+ return o;
72
+ };
73
+ return _setPrototypeOf(o, p);
74
+ }
75
+
76
+ function _inheritsLoose(subClass, superClass) {
77
+ subClass.prototype = Object.create(superClass.prototype);
78
+ subClass.prototype.constructor = subClass;
79
+ _setPrototypeOf(subClass, superClass);
80
+ }
81
+
40
82
  const _excluded$1 = ["skipClientNav", "color", "disabled", "focused", "hovered", "href", "icon", "kind", "light", "pressed", "style", "testId", "waiting"];
41
83
  const StyledAnchor = wonderBlocksCore.addStyle("a");
42
84
  const StyledButton = wonderBlocksCore.addStyle("button");
43
85
  const StyledLink = wonderBlocksCore.addStyle(reactRouterDom.Link);
44
- class IconButtonCore extends React__namespace.Component {
45
- renderInner(router) {
86
+ let IconButtonCore = function (_React$Component) {
87
+ _inheritsLoose(IconButtonCore, _React$Component);
88
+ function IconButtonCore() {
89
+ return _React$Component.apply(this, arguments) || this;
90
+ }
91
+ var _proto = IconButtonCore.prototype;
92
+ _proto.renderInner = function renderInner(router) {
46
93
  const _this$props = this.props,
47
- {
48
- skipClientNav,
49
- color,
50
- disabled,
51
- focused,
52
- hovered,
53
- href,
54
- icon,
55
- kind,
56
- light,
57
- pressed,
58
- style,
59
- testId
60
- } = _this$props,
61
- restProps = _objectWithoutPropertiesLoose__default["default"](_this$props, _excluded$1);
62
-
94
+ {
95
+ skipClientNav,
96
+ color,
97
+ disabled,
98
+ focused,
99
+ hovered,
100
+ href,
101
+ icon,
102
+ kind,
103
+ light,
104
+ pressed,
105
+ style,
106
+ testId
107
+ } = _this$props,
108
+ restProps = _objectWithoutPropertiesLoose(_this$props, _excluded$1);
63
109
  const buttonColor = color === "destructive" ? Color.SemanticColor.controlDestructive : Color.SemanticColor.controlDefault;
64
-
65
110
  const buttonStyles = _generateStyles(buttonColor, kind, light);
66
-
67
111
  const defaultStyle = [sharedStyles.shared, disabled && sharedStyles.disabled, buttonStyles.default, disabled && buttonStyles.disabled, !disabled && (pressed ? buttonStyles.active : (hovered || focused) && buttonStyles.focus)];
68
112
  const child = React__namespace.createElement(Icon__default["default"], {
69
113
  size: "medium",
70
114
  color: "currentColor",
71
115
  icon: icon
72
116
  });
73
-
74
- const commonProps = _extends__default["default"]({
117
+ const commonProps = _extends({
75
118
  "data-test-id": testId,
76
119
  style: [defaultStyle, style]
77
120
  }, restProps);
78
-
79
121
  if (href && !disabled) {
80
- return router && !skipClientNav && wonderBlocksClickable.isClientSideUrl(href) ? React__namespace.createElement(StyledLink, _extends__default["default"]({}, commonProps, {
122
+ return router && !skipClientNav && wonderBlocksClickable.isClientSideUrl(href) ? React__namespace.createElement(StyledLink, _extends({}, commonProps, {
81
123
  to: href
82
- }), child) : React__namespace.createElement(StyledAnchor, _extends__default["default"]({}, commonProps, {
124
+ }), child) : React__namespace.createElement(StyledAnchor, _extends({}, commonProps, {
83
125
  href: href
84
126
  }), child);
85
127
  } else {
86
- return React__namespace.createElement(StyledButton, _extends__default["default"]({
128
+ return React__namespace.createElement(StyledButton, _extends({
87
129
  type: "button"
88
130
  }, commonProps, {
89
131
  disabled: disabled
90
132
  }), child);
91
133
  }
92
- }
93
-
94
- render() {
134
+ };
135
+ _proto.render = function render() {
95
136
  return React__namespace.createElement(reactRouter.__RouterContext.Consumer, null, router => this.renderInner(router));
96
- }
97
-
98
- }
137
+ };
138
+ return IconButtonCore;
139
+ }(React__namespace.Component);
99
140
  const sharedStyles = aphrodite.StyleSheet.create({
100
141
  shared: {
101
142
  position: "relative",
@@ -122,18 +163,14 @@ const sharedStyles = aphrodite.StyleSheet.create({
122
163
  }
123
164
  });
124
165
  const styles = {};
125
-
126
166
  const _generateStyles = (color, kind, light) => {
127
167
  const buttonType = color + kind + light.toString();
128
-
129
168
  if (styles[buttonType]) {
130
169
  return styles[buttonType];
131
170
  }
132
-
133
171
  if (light && kind !== "primary") {
134
172
  throw new Error("Light is only supported for primary IconButtons");
135
173
  }
136
-
137
174
  const {
138
175
  white,
139
176
  offBlack32,
@@ -161,7 +198,6 @@ const _generateStyles = (color, kind, light) => {
161
198
  cursor: "default"
162
199
  }
163
200
  };
164
-
165
201
  if (kind === "primary") {
166
202
  newStyles["default"] = {
167
203
  color: light ? white : color
@@ -177,24 +213,27 @@ const _generateStyles = (color, kind, light) => {
177
213
  } else {
178
214
  throw new Error("IconButton kind not recognized");
179
215
  }
180
-
181
216
  styles[buttonType] = aphrodite.StyleSheet.create(newStyles);
182
217
  return styles[buttonType];
183
218
  };
184
219
 
185
220
  const _excluded = ["onClick", "href", "skipClientNav", "tabIndex", "target"];
186
- class IconButton extends React__namespace.Component {
187
- renderClickableBehavior(router) {
221
+ let IconButton = function (_React$Component) {
222
+ _inheritsLoose(IconButton, _React$Component);
223
+ function IconButton() {
224
+ return _React$Component.apply(this, arguments) || this;
225
+ }
226
+ var _proto = IconButton.prototype;
227
+ _proto.renderClickableBehavior = function renderClickableBehavior(router) {
188
228
  const _this$props = this.props,
189
- {
190
- onClick,
191
- href,
192
- skipClientNav,
193
- tabIndex,
194
- target
195
- } = _this$props,
196
- sharedProps = _objectWithoutPropertiesLoose__default["default"](_this$props, _excluded);
197
-
229
+ {
230
+ onClick,
231
+ href,
232
+ skipClientNav,
233
+ tabIndex,
234
+ target
235
+ } = _this$props,
236
+ sharedProps = _objectWithoutPropertiesLoose(_this$props, _excluded);
198
237
  const ClickableBehavior = wonderBlocksClickable.getClickableBehavior(href, skipClientNav, router);
199
238
  return React__namespace.createElement(ClickableBehavior, {
200
239
  disabled: sharedProps.disabled,
@@ -203,22 +242,20 @@ class IconButton extends React__namespace.Component {
203
242
  role: "button",
204
243
  target: target
205
244
  }, (state, _ref) => {
206
- let childrenProps = _extends__default["default"]({}, _ref);
207
-
208
- return React__namespace.createElement(IconButtonCore, _extends__default["default"]({}, sharedProps, state, childrenProps, {
245
+ let childrenProps = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
246
+ return React__namespace.createElement(IconButtonCore, _extends({}, sharedProps, state, childrenProps, {
209
247
  skipClientNav: skipClientNav,
210
248
  href: href,
211
249
  target: target,
212
250
  tabIndex: tabIndex
213
251
  }));
214
252
  });
215
- }
216
-
217
- render() {
253
+ };
254
+ _proto.render = function render() {
218
255
  return React__namespace.createElement(reactRouter.__RouterContext.Consumer, null, router => this.renderClickableBehavior(router));
219
- }
220
-
221
- }
256
+ };
257
+ return IconButton;
258
+ }(React__namespace.Component);
222
259
  IconButton.defaultProps = {
223
260
  color: "default",
224
261
  kind: "primary",
@@ -1,2 +1,9 @@
1
- // @flow
2
- export * from "../src/index";
1
+ /**
2
+ * Flowtype definitions for index
3
+ * Generated by Flowgen from a Typescript Definition
4
+ * Flowgen v1.21.0
5
+ * @flow
6
+ */
7
+
8
+ import IconButton from "./components/icon-button";
9
+ declare export { IconButton as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@khanacademy/wonder-blocks-icon-button",
3
- "version": "3.4.21",
3
+ "version": "3.4.22",
4
4
  "design": "v1",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -8,7 +8,7 @@
8
8
  "description": "",
9
9
  "main": "dist/index.js",
10
10
  "module": "dist/es/index.js",
11
- "source": "src/index.js",
11
+ "types": "dist/index.d.ts",
12
12
  "scripts": {
13
13
  "test": "echo \"Error: no test specified\" && exit 1"
14
14
  },
@@ -16,10 +16,10 @@
16
16
  "license": "MIT",
17
17
  "dependencies": {
18
18
  "@babel/runtime": "^7.18.6",
19
- "@khanacademy/wonder-blocks-clickable": "^2.4.5",
20
- "@khanacademy/wonder-blocks-color": "^1.2.1",
21
- "@khanacademy/wonder-blocks-core": "^4.7.0",
22
- "@khanacademy/wonder-blocks-icon": "^1.2.37"
19
+ "@khanacademy/wonder-blocks-clickable": "^2.4.6",
20
+ "@khanacademy/wonder-blocks-color": "^1.2.2",
21
+ "@khanacademy/wonder-blocks-core": "^4.8.0",
22
+ "@khanacademy/wonder-blocks-icon": "^1.2.38"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "aphrodite": "^1.2.5",
@@ -28,6 +28,6 @@
28
28
  "react-router-dom": "5.3.0"
29
29
  },
30
30
  "devDependencies": {
31
- "wb-dev-build-settings": "^0.7.1"
31
+ "wb-dev-build-settings": "^0.7.2"
32
32
  }
33
33
  }
@@ -1,6 +1,5 @@
1
- // @flow
2
- import React from "react";
3
- import renderer from "react-test-renderer";
1
+ import * as React from "react";
2
+ import * as renderer from "react-test-renderer";
4
3
 
5
4
  import {icons} from "@khanacademy/wonder-blocks-icon";
6
5
 
@@ -19,12 +18,12 @@ const defaultHandlers = {
19
18
  onKeyUp: () => void 0,
20
19
  onFocus: () => void 0,
21
20
  onBlur: () => void 0,
22
- };
21
+ } as const;
23
22
 
24
23
  describe("IconButtonCore", () => {
25
- for (const kind of ["primary", "secondary", "tertiary"]) {
26
- for (const color of ["default", "destructive"]) {
27
- for (const size of ["default", "small"]) {
24
+ for (const kind of ["primary", "secondary", "tertiary"] as const) {
25
+ for (const color of ["default", "destructive"] as const) {
26
+ for (const size of ["default", "small"] as const) {
28
27
  for (const light of kind === "primary"
29
28
  ? [true, false]
30
29
  : [false]) {
@@ -33,7 +32,7 @@ describe("IconButtonCore", () => {
33
32
  "focused",
34
33
  "hovered",
35
34
  "pressed",
36
- ]) {
35
+ ] as const) {
37
36
  const disabled = state === "disabled";
38
37
  const stateProps = {
39
38
  disabled,
@@ -41,7 +40,7 @@ describe("IconButtonCore", () => {
41
40
  hovered: state === "hovered",
42
41
  pressed: state === "pressed",
43
42
  waiting: false,
44
- };
43
+ } as const;
45
44
  test(`kind:${kind} color:${color} size:${size} light:${String(
46
45
  light,
47
46
  )} ${state}`, () => {
@@ -1,4 +1,3 @@
1
- // @flow
2
1
  import * as React from "react";
3
2
  import {render, screen} from "@testing-library/react";
4
3
  import userEvent from "@testing-library/user-event";
@@ -13,7 +12,9 @@ describe("IconButton", () => {
13
12
  const {location} = window;
14
13
 
15
14
  beforeAll(() => {
15
+ // @ts-expect-error [FEI-5019] - TS2790 - The operand of a 'delete' operator must be optional.
16
16
  delete window.location;
17
+ // @ts-expect-error [FEI-5019] - TS2740 - Type '{ assign: Mock<any, any, any>; }' is missing the following properties from type 'Location': ancestorOrigins, hash, host, hostname, and 8 more.
17
18
  window.location = {assign: jest.fn()};
18
19
  });
19
20
 
@@ -1,4 +1,3 @@
1
- // @flow
2
1
  import * as React from "react";
3
2
  import {StyleSheet} from "aphrodite";
4
3
  import {Link} from "react-router-dom";
@@ -19,26 +18,24 @@ import type {
19
18
  } from "@khanacademy/wonder-blocks-clickable";
20
19
  import type {SharedProps} from "./icon-button";
21
20
 
22
- type Props = {|
23
- ...SharedProps,
24
- ...ChildrenProps,
25
- ...ClickableState,
26
-
27
- /**
28
- * URL to navigate to.
29
- *
30
- * Used to determine whether to render an `<a>` or `<button>` tag. Also
31
- * passed in as the `<a>` tag's `href` if present.
32
- */
33
- href?: string,
34
- |};
21
+ type Props = SharedProps &
22
+ ChildrenProps &
23
+ ClickableState & {
24
+ /**
25
+ * URL to navigate to.
26
+ *
27
+ * Used to determine whether to render an `<a>` or `<button>` tag. Also
28
+ * passed in as the `<a>` tag's `href` if present.
29
+ */
30
+ href?: string;
31
+ };
35
32
 
36
33
  const StyledAnchor = addStyle("a");
37
34
  const StyledButton = addStyle("button");
38
35
  const StyledLink = addStyle(Link);
39
36
 
40
37
  export default class IconButtonCore extends React.Component<Props> {
41
- renderInner(router: any): React.Node {
38
+ renderInner(router: any): React.ReactNode {
42
39
  const {
43
40
  skipClientNav,
44
41
  color,
@@ -80,7 +77,7 @@ export default class IconButtonCore extends React.Component<Props> {
80
77
  "data-test-id": testId,
81
78
  style: [defaultStyle, style],
82
79
  ...restProps,
83
- };
80
+ } as const;
84
81
 
85
82
  if (href && !disabled) {
86
83
  return router && !skipClientNav && isClientSideUrl(href) ? (
@@ -105,7 +102,7 @@ export default class IconButtonCore extends React.Component<Props> {
105
102
  }
106
103
  }
107
104
 
108
- render(): React.Node {
105
+ render(): React.ReactElement {
109
106
  return (
110
107
  <__RouterContext.Consumer>
111
108
  {(router) => this.renderInner(router)}
@@ -143,9 +140,13 @@ const sharedStyles = StyleSheet.create({
143
140
  },
144
141
  });
145
142
 
146
- const styles = {};
143
+ const styles: Record<string, any> = {};
147
144
 
148
- const _generateStyles = (color, kind, light) => {
145
+ const _generateStyles = (
146
+ color: string,
147
+ kind: "primary" | "secondary" | "tertiary",
148
+ light: boolean,
149
+ ) => {
149
150
  const buttonType = color + kind + light.toString();
150
151
  if (styles[buttonType]) {
151
152
  return styles[buttonType];
@@ -181,16 +182,19 @@ const _generateStyles = (color, kind, light) => {
181
182
  color: light ? mix(fade(white, 0.32), color) : offBlack32,
182
183
  cursor: "default",
183
184
  },
184
- };
185
+ } as const;
185
186
  if (kind === "primary") {
187
+ // @ts-expect-error [FEI-5019] - TS2540 - Cannot assign to 'default' because it is a read-only property.
186
188
  newStyles["default"] = {
187
189
  color: light ? white : color,
188
190
  };
189
191
  } else if (kind === "secondary") {
192
+ // @ts-expect-error [FEI-5019] - TS2540 - Cannot assign to 'default' because it is a read-only property.
190
193
  newStyles["default"] = {
191
194
  color: offBlack,
192
195
  };
193
196
  } else if (kind === "tertiary") {
197
+ // @ts-expect-error [FEI-5019] - TS2540 - Cannot assign to 'default' because it is a read-only property.
194
198
  newStyles["default"] = {
195
199
  color: offBlack64,
196
200
  };
@@ -1,4 +1,3 @@
1
- // @flow
2
1
  import * as React from "react";
3
2
  import {__RouterContext} from "react-router";
4
3
 
@@ -7,20 +6,16 @@ import type {IconAsset} from "@khanacademy/wonder-blocks-icon";
7
6
  import type {AriaProps, StyleType} from "@khanacademy/wonder-blocks-core";
8
7
  import IconButtonCore from "./icon-button-core";
9
8
 
10
- export type SharedProps = {|
11
- ...$Rest<AriaProps, {|"aria-disabled": "true" | "false" | void|}>,
12
-
9
+ export type SharedProps = Partial<Omit<AriaProps, "aria-disabled">> & {
13
10
  /**
14
11
  * A Wonder Blocks icon asset, an object specifing paths for one or more of
15
12
  * the following sizes: small, medium, large, xlarge.
16
13
  */
17
- icon: IconAsset,
18
-
14
+ icon: IconAsset;
19
15
  /**
20
16
  * The color of the icon button, either blue or red.
21
17
  */
22
- color: "default" | "destructive",
23
-
18
+ color: "default" | "destructive";
24
19
  /**
25
20
  * The kind of the icon button, either primary, secondary, or tertiary.
26
21
  *
@@ -31,27 +26,23 @@ export type SharedProps = {|
31
26
  *
32
27
  * In the hover/focus/press states, all variants have a border.
33
28
  */
34
- kind: "primary" | "secondary" | "tertiary",
35
-
29
+ kind: "primary" | "secondary" | "tertiary";
36
30
  /**
37
31
  * Whether the icon button is on a dark/colored background.
38
32
  */
39
- light: boolean,
40
-
33
+ light: boolean;
41
34
  /**
42
35
  * Whether the icon button is disabled.
43
36
  */
44
- disabled: boolean,
45
-
37
+ disabled: boolean;
46
38
  /**
47
39
  * Test ID used for e2e testing.
48
40
  */
49
- testId?: string,
50
-
41
+ testId?: string;
51
42
  /**
52
43
  * Optional custom styles.
53
44
  */
54
- style?: StyleType,
45
+ style?: StyleType;
55
46
  // TODO(yejia): use this if ADR #47 has been implemented
56
47
  /*
57
48
  style?: Style<Exact<{
@@ -65,8 +56,7 @@ export type SharedProps = {|
65
56
  /**
66
57
  * Adds CSS classes to the IconButton.
67
58
  */
68
- className?: string,
69
-
59
+ className?: string;
70
60
  // NOTE(jeresig): Currently React Docgen (used by Styleguidist) doesn't
71
61
  // support ... inside of an exact object type. Thus we had to move the
72
62
  // following propers into this SharedProps, even though they should be
@@ -77,27 +67,23 @@ export type SharedProps = {|
77
67
  *
78
68
  * Note: Either href or onClick must be defined
79
69
  */
80
- href?: string,
81
-
70
+ href?: string;
82
71
  // TODO(WB-1262): only allow this prop when `href` is also set.
83
72
  /**
84
73
  * A target destination window for a link to open in.
85
74
  */
86
- target?: "_blank",
87
-
75
+ target?: "_blank";
88
76
  /**
89
77
  * Specifies the type of relationship between the current document and the
90
78
  * linked document. Should only be used when `href` is specified. This
91
79
  * defaults to "noopener noreferrer" when `target="_blank"`, but can be
92
80
  * overridden by setting this prop to something else.
93
81
  */
94
- rel?: string,
95
-
82
+ rel?: string;
96
83
  /**
97
84
  * Set the tabindex attribute on the rendered element.
98
85
  */
99
- tabIndex?: number,
100
-
86
+ tabIndex?: number;
101
87
  /**
102
88
  * Whether to avoid using client-side navigation.
103
89
  *
@@ -110,8 +96,7 @@ export type SharedProps = {|
110
96
  * https://khanacademy.org/math/algebra/eval-exprs will trigger a full
111
97
  * page reload.
112
98
  */
113
- skipClientNav?: boolean,
114
-
99
+ skipClientNav?: boolean;
115
100
  /**
116
101
  * Function to call when button is clicked.
117
102
  *
@@ -124,15 +109,15 @@ export type SharedProps = {|
124
109
  * Note: onClick is optional if href is present, but must be defined if
125
110
  * href is not
126
111
  */
127
- onClick?: (e: SyntheticEvent<>) => mixed,
128
- |};
112
+ onClick?: (e: React.SyntheticEvent) => unknown;
113
+ };
129
114
 
130
- type DefaultProps = {|
131
- color: $PropertyType<SharedProps, "color">,
132
- kind: $PropertyType<SharedProps, "kind">,
133
- light: $PropertyType<SharedProps, "light">,
134
- disabled: $PropertyType<SharedProps, "disabled">,
135
- |};
115
+ type DefaultProps = {
116
+ color: SharedProps["color"];
117
+ kind: SharedProps["kind"];
118
+ light: SharedProps["light"];
119
+ disabled: SharedProps["disabled"];
120
+ };
136
121
 
137
122
  /**
138
123
  * An IconButton is a button whose contents are an SVG image.
@@ -179,7 +164,7 @@ export default class IconButton extends React.Component<SharedProps> {
179
164
  disabled: false,
180
165
  };
181
166
 
182
- renderClickableBehavior(router: any): React.Node {
167
+ renderClickableBehavior(router: any): React.ReactNode {
183
168
  const {onClick, href, skipClientNav, tabIndex, target, ...sharedProps} =
184
169
  this.props;
185
170
 
@@ -214,7 +199,7 @@ export default class IconButton extends React.Component<SharedProps> {
214
199
  );
215
200
  }
216
201
 
217
- render(): React.Node {
202
+ render(): React.ReactElement {
218
203
  return (
219
204
  <__RouterContext.Consumer>
220
205
  {(router) => this.renderClickableBehavior(router)}
@@ -1,4 +1,3 @@
1
- // @flow
2
1
  import IconButton from "./components/icon-button";
3
2
 
4
3
  export {IconButton as default};
package/tsconfig.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "exclude": ["dist"],
3
+ "extends": "../tsconfig-shared.json",
4
+ "compilerOptions": {
5
+ "outDir": "./dist",
6
+ "rootDir": "src",
7
+ },
8
+ "references": [
9
+ {"path": "../wonder-blocks-clickable"},
10
+ {"path": "../wonder-blocks-color"},
11
+ {"path": "../wonder-blocks-core"},
12
+ {"path": "../wonder-blocks-icon"},
13
+ {"path": "../../utils"},
14
+ ]
15
+ }