@khanacademy/wonder-blocks-icon-button 3.4.4 → 3.4.7

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 CHANGED
@@ -1,5 +1,32 @@
1
1
  # @khanacademy/wonder-blocks-icon-button
2
2
 
3
+ ## 3.4.7
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [5f4a4297]
8
+ - Updated dependencies [2b96fd59]
9
+ - @khanacademy/wonder-blocks-core@4.3.2
10
+ - @khanacademy/wonder-blocks-clickable@2.2.7
11
+ - @khanacademy/wonder-blocks-icon@1.2.28
12
+
13
+ ## 3.4.6
14
+
15
+ ### Patch Changes
16
+
17
+ - @khanacademy/wonder-blocks-clickable@2.2.6
18
+ - @khanacademy/wonder-blocks-core@4.3.1
19
+ - @khanacademy/wonder-blocks-icon@1.2.27
20
+
21
+ ## 3.4.5
22
+
23
+ ### Patch Changes
24
+
25
+ - Updated dependencies [246a921d]
26
+ - @khanacademy/wonder-blocks-core@4.3.0
27
+ - @khanacademy/wonder-blocks-clickable@2.2.5
28
+ - @khanacademy/wonder-blocks-icon@1.2.26
29
+
3
30
  ## 3.4.4
4
31
 
5
32
  ### Patch Changes
package/dist/es/index.js CHANGED
@@ -37,7 +37,7 @@ class IconButtonCore extends React.Component {
37
37
  const buttonStyles = _generateStyles(buttonColor, kind, light);
38
38
 
39
39
  const defaultStyle = [sharedStyles.shared, disabled && sharedStyles.disabled, buttonStyles.default, disabled && buttonStyles.disabled, !disabled && (pressed ? buttonStyles.active : (hovered || focused) && buttonStyles.focus)];
40
- const child = /*#__PURE__*/React.createElement(Icon, {
40
+ const child = React.createElement(Icon, {
41
41
  size: "medium",
42
42
  color: "currentColor",
43
43
  icon: icon
@@ -49,13 +49,13 @@ class IconButtonCore extends React.Component {
49
49
  }, restProps);
50
50
 
51
51
  if (href && !disabled) {
52
- return router && !skipClientNav && isClientSideUrl(href) ? /*#__PURE__*/React.createElement(StyledLink, _extends({}, commonProps, {
52
+ return router && !skipClientNav && isClientSideUrl(href) ? React.createElement(StyledLink, _extends({}, commonProps, {
53
53
  to: href
54
- }), child) : /*#__PURE__*/React.createElement(StyledAnchor, _extends({}, commonProps, {
54
+ }), child) : React.createElement(StyledAnchor, _extends({}, commonProps, {
55
55
  href: href
56
56
  }), child);
57
57
  } else {
58
- return /*#__PURE__*/React.createElement(StyledButton, _extends({
58
+ return React.createElement(StyledButton, _extends({
59
59
  type: "button"
60
60
  }, commonProps, {
61
61
  disabled: disabled
@@ -64,7 +64,7 @@ class IconButtonCore extends React.Component {
64
64
  }
65
65
 
66
66
  render() {
67
- return /*#__PURE__*/React.createElement(__RouterContext.Consumer, null, router => this.renderInner(router));
67
+ return React.createElement(__RouterContext.Consumer, null, router => this.renderInner(router));
68
68
  }
69
69
 
70
70
  }
@@ -84,11 +84,8 @@ const sharedStyles = StyleSheet.create({
84
84
  textDecoration: "none",
85
85
  background: "none",
86
86
  margin: -8,
87
- // This removes the 300ms click delay on mobile browsers by indicating that
88
- // "double-tap to zoom" shouldn't be used on this element.
89
87
  touchAction: "manipulation",
90
88
  ":focus": {
91
- // Mobile: Removes a blue highlight style shown when the user clicks a button
92
89
  WebkitTapHighlightColor: "rgba(0,0,0,0)"
93
90
  }
94
91
  },
@@ -159,43 +156,6 @@ const _generateStyles = (color, kind, light) => {
159
156
 
160
157
  const _excluded = ["onClick", "href", "skipClientNav", "tabIndex", "target"],
161
158
  _excluded2 = ["tabIndex"];
162
-
163
- /**
164
- * An IconButton is a button whose contents are an SVG image.
165
- *
166
- * To use, supply an onClick function, a wonder-blocks icon asset (see
167
- * the Icon section) and an aria-label to describe the button functionality.
168
- * Optionally specify href (URL), clientSideNav, color
169
- * (Wonder Blocks Blue or Red), kind ("primary", "secondary", or "tertiary"),
170
- * light (whether the IconButton will be rendered on a dark background),
171
- * disabled , test ID, and custom styling.
172
- *
173
- * The size of an IconButton matches the size of icon it wraps which is 24x24
174
- * pixels. The focus ring which is displayed on hover and focus is much
175
- * larger but does not affect its size. This matches the behavior of Button.
176
- *
177
- * IconButtons require a certain amount of space between them to ensure the
178
- * focus rings don't overlap. The minimum amount of spacing is 16px, but
179
- * you should refer to the mocks provided by design. Using a Strut in between
180
- * IconButtons is the preferred way to for adding this spacing.
181
- *
182
- * Many layouts require alignment of visual left (or right) side of an
183
- * IconButton. This requires a little bit of pixel nudging since each icon
184
- * as a different amount of internal padding.
185
- *
186
- * See the Toolbar documentation for examples of IconButton use that follow
187
- * the best practices described above.
188
- *
189
- * ```js
190
- * import {icons} from "@khanacademy/wonder-blocks-icon";
191
- *
192
- * <IconButton
193
- * icon={icons.anIcon}
194
- * aria-label="An Icon"
195
- * onClick={(e) => console.log("Hello, world!")}
196
- * />
197
- * ```
198
- */
199
159
  class IconButton extends React.Component {
200
160
  renderClickableBehavior(router) {
201
161
  const _this$props = this.props,
@@ -209,7 +169,7 @@ class IconButton extends React.Component {
209
169
  sharedProps = _objectWithoutPropertiesLoose(_this$props, _excluded);
210
170
 
211
171
  const ClickableBehavior = getClickableBehavior(href, skipClientNav, router);
212
- return /*#__PURE__*/React.createElement(ClickableBehavior, {
172
+ return React.createElement(ClickableBehavior, {
213
173
  disabled: sharedProps.disabled,
214
174
  href: href,
215
175
  onClick: onClick,
@@ -221,20 +181,17 @@ class IconButton extends React.Component {
221
181
  } = _ref,
222
182
  childrenProps = _objectWithoutPropertiesLoose(_ref, _excluded2);
223
183
 
224
- return /*#__PURE__*/React.createElement(IconButtonCore, _extends({}, sharedProps, state, childrenProps, {
184
+ return React.createElement(IconButtonCore, _extends({}, sharedProps, state, childrenProps, {
225
185
  skipClientNav: skipClientNav,
226
186
  href: href,
227
- target: target // If tabIndex is provide to the component we allow
228
- // it to override the tabIndex provide to use by
229
- // ClickableBehavior.
230
- ,
187
+ target: target,
231
188
  tabIndex: tabIndex || clickableTabIndex
232
189
  }));
233
190
  });
234
191
  }
235
192
 
236
193
  render() {
237
- return /*#__PURE__*/React.createElement(__RouterContext.Consumer, null, router => this.renderClickableBehavior(router));
194
+ return React.createElement(__RouterContext.Consumer, null, router => this.renderClickableBehavior(router));
238
195
  }
239
196
 
240
197
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@khanacademy/wonder-blocks-icon-button",
3
- "version": "3.4.4",
3
+ "version": "3.4.7",
4
4
  "design": "v1",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -16,10 +16,10 @@
16
16
  "license": "MIT",
17
17
  "dependencies": {
18
18
  "@babel/runtime": "^7.16.3",
19
- "@khanacademy/wonder-blocks-clickable": "^2.2.4",
19
+ "@khanacademy/wonder-blocks-clickable": "^2.2.7",
20
20
  "@khanacademy/wonder-blocks-color": "^1.1.20",
21
- "@khanacademy/wonder-blocks-core": "^4.2.1",
22
- "@khanacademy/wonder-blocks-icon": "^1.2.25"
21
+ "@khanacademy/wonder-blocks-core": "^4.3.2",
22
+ "@khanacademy/wonder-blocks-icon": "^1.2.28"
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.3.0"
31
+ "wb-dev-build-settings": "^0.4.0"
32
32
  }
33
33
  }
@@ -81,6 +81,8 @@ export type SharedProps = {|
81
81
 
82
82
  /**
83
83
  * A target destination window for a link to open in.
84
+ *
85
+ * TODO(WB-1262): only allow this prop when `href` is also set.t
84
86
  */
85
87
  target?: "_blank",
86
88