@zendeskgarden/react-buttons 8.59.1 → 8.60.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/dist/index.cjs.js CHANGED
@@ -61,7 +61,7 @@ const SIZE = ['small', 'medium', 'large'];
61
61
  const COMPONENT_ID$5 = 'buttons.button_group_view';
62
62
  const StyledButtonGroup = styled__default["default"].div.attrs({
63
63
  'data-garden-id': COMPONENT_ID$5,
64
- 'data-garden-version': '8.59.1'
64
+ 'data-garden-version': '8.60.0'
65
65
  }).withConfig({
66
66
  displayName: "StyledButtonGroup",
67
67
  componentId: "sc-1fbpzef-0"
@@ -90,7 +90,7 @@ const StyledIcon = styled__default["default"](_ref => {
90
90
  return React__default["default"].cloneElement(React.Children.only(children), props);
91
91
  }).attrs({
92
92
  'data-garden-id': COMPONENT_ID$4,
93
- 'data-garden-version': '8.59.1'
93
+ 'data-garden-version': '8.60.0'
94
94
  }).withConfig({
95
95
  displayName: "StyledIcon",
96
96
  componentId: "sc-19meqgg-0"
@@ -189,7 +189,7 @@ const sizeStyles = props => {
189
189
  };
190
190
  const StyledButton = styled__default["default"].button.attrs(props => ({
191
191
  'data-garden-id': COMPONENT_ID$3,
192
- 'data-garden-version': '8.59.1',
192
+ 'data-garden-version': '8.60.0',
193
193
  type: props.type || 'button'
194
194
  })).withConfig({
195
195
  displayName: "StyledButton",
@@ -202,7 +202,7 @@ StyledButton.defaultProps = {
202
202
  const COMPONENT_ID$2 = 'buttons.anchor';
203
203
  const StyledAnchor = styled__default["default"](StyledButton).attrs(props => ({
204
204
  'data-garden-id': COMPONENT_ID$2,
205
- 'data-garden-version': '8.59.1',
205
+ 'data-garden-version': '8.60.0',
206
206
  as: 'a',
207
207
  dir: props.theme.rtl ? 'rtl' : undefined,
208
208
  isLink: true,
@@ -239,7 +239,7 @@ var SvgNewWindowStroke = function SvgNewWindowStroke(props) {
239
239
  const COMPONENT_ID$1 = 'buttons.external_icon';
240
240
  const StyledExternalIcon = styled__default["default"](SvgNewWindowStroke).attrs({
241
241
  'data-garden-id': COMPONENT_ID$1,
242
- 'data-garden-version': '8.59.1'
242
+ 'data-garden-version': '8.60.0'
243
243
  }).withConfig({
244
244
  displayName: "StyledExternalIcon",
245
245
  componentId: "sc-16oz07e-0"
@@ -266,7 +266,7 @@ const iconStyles = props => {
266
266
  };
267
267
  const StyledIconButton = styled__default["default"](StyledButton).attrs({
268
268
  'data-garden-id': COMPONENT_ID,
269
- 'data-garden-version': '8.59.1'
269
+ 'data-garden-version': '8.60.0'
270
270
  }).withConfig({
271
271
  displayName: "StyledIconButton",
272
272
  componentId: "sc-1t0ughp-0"
@@ -343,6 +343,7 @@ const Anchor = React.forwardRef((_ref, ref) => {
343
343
  let {
344
344
  children,
345
345
  isExternal,
346
+ externalIconLabel,
346
347
  ...otherProps
347
348
  } = _ref;
348
349
  let anchorProps = otherProps;
@@ -353,14 +354,25 @@ const Anchor = React.forwardRef((_ref, ref) => {
353
354
  ...anchorProps
354
355
  };
355
356
  }
357
+ const checkProps = isExternal ? {
358
+ externalIconLabel
359
+ } : {
360
+ noIconLabel: 'true'
361
+ };
362
+ const iconAriaLabel = reactTheming.useText(Anchor, checkProps, isExternal ? 'externalIconLabel' : 'noIconLabel', '(opens in a new tab)');
356
363
  return React__default["default"].createElement(StyledAnchor, _extends$2({
357
364
  ref: ref
358
- }, anchorProps), children, isExternal && React__default["default"].createElement(StyledExternalIcon, null));
365
+ }, anchorProps), children, isExternal && React__default["default"].createElement(StyledExternalIcon, {
366
+ role: "img",
367
+ "aria-label": iconAriaLabel,
368
+ "aria-hidden": undefined
369
+ }));
359
370
  });
360
371
  Anchor.displayName = 'Anchor';
361
372
  Anchor.propTypes = {
362
373
  isExternal: PropTypes__default["default"].bool,
363
- isDanger: PropTypes__default["default"].bool
374
+ isDanger: PropTypes__default["default"].bool,
375
+ externalIconLabel: PropTypes__default["default"].string
364
376
  };
365
377
 
366
378
  const ButtonGroup = React.forwardRef((_ref, ref) => {
package/dist/index.esm.js CHANGED
@@ -9,7 +9,7 @@ import * as React from 'react';
9
9
  import React__default, { Children, createContext, useContext, forwardRef, useMemo } from 'react';
10
10
  import PropTypes from 'prop-types';
11
11
  import styled, { css } from 'styled-components';
12
- import { retrieveComponentStyles, DEFAULT_THEME, getColor } from '@zendeskgarden/react-theming';
12
+ import { retrieveComponentStyles, DEFAULT_THEME, getColor, useText } from '@zendeskgarden/react-theming';
13
13
  import { rgba, math, em } from 'polished';
14
14
  import { useButtonGroup } from '@zendeskgarden/container-buttongroup';
15
15
 
@@ -33,7 +33,7 @@ const SIZE = ['small', 'medium', 'large'];
33
33
  const COMPONENT_ID$5 = 'buttons.button_group_view';
34
34
  const StyledButtonGroup = styled.div.attrs({
35
35
  'data-garden-id': COMPONENT_ID$5,
36
- 'data-garden-version': '8.59.1'
36
+ 'data-garden-version': '8.60.0'
37
37
  }).withConfig({
38
38
  displayName: "StyledButtonGroup",
39
39
  componentId: "sc-1fbpzef-0"
@@ -62,7 +62,7 @@ const StyledIcon = styled(_ref => {
62
62
  return React__default.cloneElement(Children.only(children), props);
63
63
  }).attrs({
64
64
  'data-garden-id': COMPONENT_ID$4,
65
- 'data-garden-version': '8.59.1'
65
+ 'data-garden-version': '8.60.0'
66
66
  }).withConfig({
67
67
  displayName: "StyledIcon",
68
68
  componentId: "sc-19meqgg-0"
@@ -161,7 +161,7 @@ const sizeStyles = props => {
161
161
  };
162
162
  const StyledButton = styled.button.attrs(props => ({
163
163
  'data-garden-id': COMPONENT_ID$3,
164
- 'data-garden-version': '8.59.1',
164
+ 'data-garden-version': '8.60.0',
165
165
  type: props.type || 'button'
166
166
  })).withConfig({
167
167
  displayName: "StyledButton",
@@ -174,7 +174,7 @@ StyledButton.defaultProps = {
174
174
  const COMPONENT_ID$2 = 'buttons.anchor';
175
175
  const StyledAnchor = styled(StyledButton).attrs(props => ({
176
176
  'data-garden-id': COMPONENT_ID$2,
177
- 'data-garden-version': '8.59.1',
177
+ 'data-garden-version': '8.60.0',
178
178
  as: 'a',
179
179
  dir: props.theme.rtl ? 'rtl' : undefined,
180
180
  isLink: true,
@@ -211,7 +211,7 @@ var SvgNewWindowStroke = function SvgNewWindowStroke(props) {
211
211
  const COMPONENT_ID$1 = 'buttons.external_icon';
212
212
  const StyledExternalIcon = styled(SvgNewWindowStroke).attrs({
213
213
  'data-garden-id': COMPONENT_ID$1,
214
- 'data-garden-version': '8.59.1'
214
+ 'data-garden-version': '8.60.0'
215
215
  }).withConfig({
216
216
  displayName: "StyledExternalIcon",
217
217
  componentId: "sc-16oz07e-0"
@@ -238,7 +238,7 @@ const iconStyles = props => {
238
238
  };
239
239
  const StyledIconButton = styled(StyledButton).attrs({
240
240
  'data-garden-id': COMPONENT_ID,
241
- 'data-garden-version': '8.59.1'
241
+ 'data-garden-version': '8.60.0'
242
242
  }).withConfig({
243
243
  displayName: "StyledIconButton",
244
244
  componentId: "sc-1t0ughp-0"
@@ -315,6 +315,7 @@ const Anchor = forwardRef((_ref, ref) => {
315
315
  let {
316
316
  children,
317
317
  isExternal,
318
+ externalIconLabel,
318
319
  ...otherProps
319
320
  } = _ref;
320
321
  let anchorProps = otherProps;
@@ -325,14 +326,25 @@ const Anchor = forwardRef((_ref, ref) => {
325
326
  ...anchorProps
326
327
  };
327
328
  }
329
+ const checkProps = isExternal ? {
330
+ externalIconLabel
331
+ } : {
332
+ noIconLabel: 'true'
333
+ };
334
+ const iconAriaLabel = useText(Anchor, checkProps, isExternal ? 'externalIconLabel' : 'noIconLabel', '(opens in a new tab)');
328
335
  return React__default.createElement(StyledAnchor, _extends$2({
329
336
  ref: ref
330
- }, anchorProps), children, isExternal && React__default.createElement(StyledExternalIcon, null));
337
+ }, anchorProps), children, isExternal && React__default.createElement(StyledExternalIcon, {
338
+ role: "img",
339
+ "aria-label": iconAriaLabel,
340
+ "aria-hidden": undefined
341
+ }));
331
342
  });
332
343
  Anchor.displayName = 'Anchor';
333
344
  Anchor.propTypes = {
334
345
  isExternal: PropTypes.bool,
335
- isDanger: PropTypes.bool
346
+ isDanger: PropTypes.bool,
347
+ externalIconLabel: PropTypes.string
336
348
  };
337
349
 
338
350
  const ButtonGroup = forwardRef((_ref, ref) => {
@@ -50,6 +50,11 @@ export interface IAnchorProps extends Pick<IButtonProps, 'isDanger'>, AnchorHTML
50
50
  * safe [cross-origin destination link](https://web.dev/external-anchors-use-rel-noopener/).
51
51
  **/
52
52
  isExternal?: boolean;
53
+ /**
54
+ * Allows a customized/translated text label to be passed to the external link icon,
55
+ * making that icon accessible to assistive technology
56
+ **/
57
+ externalIconLabel?: string;
53
58
  }
54
59
  export interface IButtonGroupProps extends HTMLAttributes<HTMLDivElement> {
55
60
  /** Defines the currently selected button in the group */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zendeskgarden/react-buttons",
3
- "version": "8.59.1",
3
+ "version": "8.60.0",
4
4
  "description": "Components relating to buttons in the Garden Design System",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Zendesk Garden <garden@zendesk.com>",
@@ -33,7 +33,7 @@
33
33
  "styled-components": "^4.2.0 || ^5.0.0"
34
34
  },
35
35
  "devDependencies": {
36
- "@zendeskgarden/react-theming": "^8.59.1",
36
+ "@zendeskgarden/react-theming": "^8.60.0",
37
37
  "@zendeskgarden/svg-icons": "6.33.0"
38
38
  },
39
39
  "keywords": [
@@ -46,5 +46,5 @@
46
46
  "access": "public"
47
47
  },
48
48
  "zendeskgarden:src": "src/index.ts",
49
- "gitHead": "023c569e38e4d97264ef871bf7a9aa8b0d16b0aa"
49
+ "gitHead": "8adf13e61f58a64a0ba06794c0362f665e846fe9"
50
50
  }