@zendeskgarden/react-tags 8.62.1 → 8.63.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
@@ -7,15 +7,13 @@
7
7
 
8
8
  'use strict';
9
9
 
10
- Object.defineProperty(exports, '__esModule', { value: true });
11
-
12
10
  var React = require('react');
13
11
  var PropTypes = require('prop-types');
14
12
  var styled = require('styled-components');
15
13
  var polished = require('polished');
16
14
  var reactTheming = require('@zendeskgarden/react-theming');
17
15
 
18
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
16
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
19
17
 
20
18
  function _interopNamespace(e) {
21
19
  if (e && e.__esModule) return e;
@@ -31,14 +29,13 @@ function _interopNamespace(e) {
31
29
  }
32
30
  });
33
31
  }
34
- n["default"] = e;
32
+ n.default = e;
35
33
  return Object.freeze(n);
36
34
  }
37
35
 
38
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
39
36
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
40
- var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
41
- var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
37
+ var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
38
+ var styled__default = /*#__PURE__*/_interopDefault(styled);
42
39
 
43
40
  function _extends$1() {
44
41
  _extends$1 = Object.assign ? Object.assign.bind() : function (target) {
@@ -58,15 +55,15 @@ function _extends$1() {
58
55
  const SIZE = ['small', 'medium', 'large'];
59
56
 
60
57
  const COMPONENT_ID$2 = 'tags.avatar';
61
- const StyledAvatar = styled__default["default"](_ref => {
58
+ const StyledAvatar = styled__default.default(_ref => {
62
59
  let {
63
60
  children,
64
61
  ...props
65
62
  } = _ref;
66
- return React__default["default"].cloneElement(React.Children.only(children), props);
63
+ return React__namespace.default.cloneElement(React.Children.only(children), props);
67
64
  }).attrs({
68
65
  'data-garden-id': COMPONENT_ID$2,
69
- 'data-garden-version': '8.62.1'
66
+ 'data-garden-version': '8.63.0'
70
67
  }).withConfig({
71
68
  displayName: "StyledAvatar",
72
69
  componentId: "sc-3kdmgt-0"
@@ -76,14 +73,13 @@ StyledAvatar.defaultProps = {
76
73
  };
77
74
 
78
75
  const COMPONENT_ID$1 = 'tags.close';
79
- const StyledClose = styled__default["default"].div.attrs({
76
+ const StyledClose = styled__default.default.button.attrs({
80
77
  'data-garden-id': COMPONENT_ID$1,
81
- 'data-garden-version': '8.62.1',
82
- 'aria-label': 'Press delete to remove'
78
+ 'data-garden-version': '8.63.0'
83
79
  }).withConfig({
84
80
  displayName: "StyledClose",
85
81
  componentId: "sc-d6lrpn-0"
86
- })(["display:flex;flex-shrink:0;align-items:center;justify-content:center;transition:opacity 0.25s ease-in-out;opacity:0.8;border:0;cursor:pointer;padding:0;font-size:0;&:hover{opacity:0.9;}&:focus{outline:none;}", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$1, props));
82
+ })(["display:flex;flex-shrink:0;align-items:center;justify-content:center;transition:opacity 0.25s ease-in-out;opacity:0.8;border:0;background:transparent;cursor:pointer;padding:0;font-size:0;appearance:none;&:hover{opacity:0.9;}&:focus{outline:none;}", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$1, props));
87
83
  StyledClose.defaultProps = {
88
84
  theme: reactTheming.DEFAULT_THEME
89
85
  };
@@ -159,9 +155,9 @@ const sizeStyles = props => {
159
155
  }
160
156
  return styled.css(["border-radius:", ";padding:0 ", "px;min-width:", ";height:", "px;line-height:", ";font-size:", ";& > *{width:100%;min-width:", ";}& ", "{margin-", ":-", "px;margin-", ":", "px;border-radius:", ";width:", "px;min-width:", "px;height:", "px;}& ", "{margin-", ":-", "px;border-radius:", ";width:", "px;height:", "px;}"], borderRadius, padding, minWidth ? `${minWidth}px` : `calc(${padding * 2}px + 1ch)`, height, reactTheming.getLineHeight(height, fontSize), fontSize, minWidth ? `${minWidth - padding * 2}px` : '1ch', StyledAvatar, props.theme.rtl ? 'right' : 'left', padding - avatarMargin, props.theme.rtl ? 'left' : 'right', avatarTextMargin, avatarBorderRadius, avatarSize, avatarSize, avatarSize, StyledClose, props.theme.rtl ? 'left' : 'right', padding, borderRadius, height, height);
161
157
  };
162
- const StyledTag = styled__default["default"].div.attrs({
158
+ const StyledTag = styled__default.default.div.attrs({
163
159
  'data-garden-id': COMPONENT_ID,
164
- 'data-garden-version': '8.62.1'
160
+ 'data-garden-version': '8.63.0'
165
161
  }).withConfig({
166
162
  displayName: "StyledTag",
167
163
  componentId: "sc-1jvbe03-0"
@@ -172,9 +168,7 @@ StyledTag.defaultProps = {
172
168
  };
173
169
 
174
170
  var _path;
175
-
176
171
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
177
-
178
172
  var SvgXStroke = function SvgXStroke(props) {
179
173
  return /*#__PURE__*/React__namespace.createElement("svg", _extends({
180
174
  xmlns: "http://www.w3.org/2000/svg",
@@ -182,8 +176,7 @@ var SvgXStroke = function SvgXStroke(props) {
182
176
  height: 12,
183
177
  focusable: "false",
184
178
  viewBox: "0 0 12 12",
185
- "aria-hidden": "true",
186
- role: "img"
179
+ "aria-hidden": "true"
187
180
  }, props), _path || (_path = /*#__PURE__*/React__namespace.createElement("path", {
188
181
  stroke: "currentColor",
189
182
  strokeLinecap: "round",
@@ -191,13 +184,20 @@ var SvgXStroke = function SvgXStroke(props) {
191
184
  })));
192
185
  };
193
186
 
194
- const CloseComponent = React.forwardRef((props, ref) => React__default["default"].createElement(StyledClose, _extends$1({
195
- ref: ref
196
- }, props), React__default["default"].createElement(SvgXStroke, null)));
187
+ const CloseComponent = React.forwardRef((props, ref) => {
188
+ const ariaLabel = reactTheming.useText(CloseComponent, props, 'aria-label', 'Remove');
189
+ return React__namespace.default.createElement(StyledClose, _extends$1({
190
+ ref: ref,
191
+ "aria-label": ariaLabel
192
+ }, props, {
193
+ type: "button",
194
+ tabIndex: -1
195
+ }), React__namespace.default.createElement(SvgXStroke, null));
196
+ });
197
197
  CloseComponent.displayName = 'Tag.Close';
198
198
  const Close = CloseComponent;
199
199
 
200
- const AvatarComponent = props => React__default["default"].createElement(StyledAvatar, props);
200
+ const AvatarComponent = props => React__namespace.default.createElement(StyledAvatar, props);
201
201
  AvatarComponent.displayName = 'Tag.Avatar';
202
202
  const Avatar = AvatarComponent;
203
203
 
@@ -207,7 +207,7 @@ const TagComponent = React.forwardRef((_ref, ref) => {
207
207
  hue,
208
208
  ...otherProps
209
209
  } = _ref;
210
- return React__default["default"].createElement(StyledTag, _extends$1({
210
+ return React__namespace.default.createElement(StyledTag, _extends$1({
211
211
  ref: ref,
212
212
  size: size,
213
213
  hue: hue
@@ -215,11 +215,11 @@ const TagComponent = React.forwardRef((_ref, ref) => {
215
215
  });
216
216
  TagComponent.displayName = 'Tag';
217
217
  TagComponent.propTypes = {
218
- size: PropTypes__default["default"].oneOf(SIZE),
219
- hue: PropTypes__default["default"].string,
220
- isPill: PropTypes__default["default"].bool,
221
- isRound: PropTypes__default["default"].bool,
222
- isRegular: PropTypes__default["default"].bool
218
+ size: PropTypes__default.default.oneOf(SIZE),
219
+ hue: PropTypes__default.default.string,
220
+ isPill: PropTypes__default.default.bool,
221
+ isRound: PropTypes__default.default.bool,
222
+ isRegular: PropTypes__default.default.bool
223
223
  };
224
224
  TagComponent.defaultProps = {
225
225
  size: 'medium'
package/dist/index.esm.js CHANGED
@@ -10,7 +10,7 @@ import React__default, { Children, forwardRef } from 'react';
10
10
  import PropTypes from 'prop-types';
11
11
  import styled, { css } from 'styled-components';
12
12
  import { readableColor, math } from 'polished';
13
- import { retrieveComponentStyles, DEFAULT_THEME, getColor, getLineHeight } from '@zendeskgarden/react-theming';
13
+ import { retrieveComponentStyles, DEFAULT_THEME, getColor, getLineHeight, useText } from '@zendeskgarden/react-theming';
14
14
 
15
15
  function _extends$1() {
16
16
  _extends$1 = Object.assign ? Object.assign.bind() : function (target) {
@@ -38,7 +38,7 @@ const StyledAvatar = styled(_ref => {
38
38
  return React__default.cloneElement(Children.only(children), props);
39
39
  }).attrs({
40
40
  'data-garden-id': COMPONENT_ID$2,
41
- 'data-garden-version': '8.62.1'
41
+ 'data-garden-version': '8.63.0'
42
42
  }).withConfig({
43
43
  displayName: "StyledAvatar",
44
44
  componentId: "sc-3kdmgt-0"
@@ -48,14 +48,13 @@ StyledAvatar.defaultProps = {
48
48
  };
49
49
 
50
50
  const COMPONENT_ID$1 = 'tags.close';
51
- const StyledClose = styled.div.attrs({
51
+ const StyledClose = styled.button.attrs({
52
52
  'data-garden-id': COMPONENT_ID$1,
53
- 'data-garden-version': '8.62.1',
54
- 'aria-label': 'Press delete to remove'
53
+ 'data-garden-version': '8.63.0'
55
54
  }).withConfig({
56
55
  displayName: "StyledClose",
57
56
  componentId: "sc-d6lrpn-0"
58
- })(["display:flex;flex-shrink:0;align-items:center;justify-content:center;transition:opacity 0.25s ease-in-out;opacity:0.8;border:0;cursor:pointer;padding:0;font-size:0;&:hover{opacity:0.9;}&:focus{outline:none;}", ";"], props => retrieveComponentStyles(COMPONENT_ID$1, props));
57
+ })(["display:flex;flex-shrink:0;align-items:center;justify-content:center;transition:opacity 0.25s ease-in-out;opacity:0.8;border:0;background:transparent;cursor:pointer;padding:0;font-size:0;appearance:none;&:hover{opacity:0.9;}&:focus{outline:none;}", ";"], props => retrieveComponentStyles(COMPONENT_ID$1, props));
59
58
  StyledClose.defaultProps = {
60
59
  theme: DEFAULT_THEME
61
60
  };
@@ -133,7 +132,7 @@ const sizeStyles = props => {
133
132
  };
134
133
  const StyledTag = styled.div.attrs({
135
134
  'data-garden-id': COMPONENT_ID,
136
- 'data-garden-version': '8.62.1'
135
+ 'data-garden-version': '8.63.0'
137
136
  }).withConfig({
138
137
  displayName: "StyledTag",
139
138
  componentId: "sc-1jvbe03-0"
@@ -144,9 +143,7 @@ StyledTag.defaultProps = {
144
143
  };
145
144
 
146
145
  var _path;
147
-
148
146
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
149
-
150
147
  var SvgXStroke = function SvgXStroke(props) {
151
148
  return /*#__PURE__*/React.createElement("svg", _extends({
152
149
  xmlns: "http://www.w3.org/2000/svg",
@@ -154,8 +151,7 @@ var SvgXStroke = function SvgXStroke(props) {
154
151
  height: 12,
155
152
  focusable: "false",
156
153
  viewBox: "0 0 12 12",
157
- "aria-hidden": "true",
158
- role: "img"
154
+ "aria-hidden": "true"
159
155
  }, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
160
156
  stroke: "currentColor",
161
157
  strokeLinecap: "round",
@@ -163,9 +159,16 @@ var SvgXStroke = function SvgXStroke(props) {
163
159
  })));
164
160
  };
165
161
 
166
- const CloseComponent = forwardRef((props, ref) => React__default.createElement(StyledClose, _extends$1({
167
- ref: ref
168
- }, props), React__default.createElement(SvgXStroke, null)));
162
+ const CloseComponent = forwardRef((props, ref) => {
163
+ const ariaLabel = useText(CloseComponent, props, 'aria-label', 'Remove');
164
+ return React__default.createElement(StyledClose, _extends$1({
165
+ ref: ref,
166
+ "aria-label": ariaLabel
167
+ }, props, {
168
+ type: "button",
169
+ tabIndex: -1
170
+ }), React__default.createElement(SvgXStroke, null));
171
+ });
169
172
  CloseComponent.displayName = 'Tag.Close';
170
173
  const Close = CloseComponent;
171
174
 
@@ -6,6 +6,6 @@
6
6
  */
7
7
  import React from 'react';
8
8
  /**
9
- * @extends HTMLAttributes<HTMLDivElement>
9
+ * @extends HTMLAttributes<HTMLButtonElement>
10
10
  */
11
- export declare const Close: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
11
+ export declare const Close: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>;
@@ -4,4 +4,8 @@
4
4
  * Use of this source code is governed under the Apache License, Version 2.0
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
- export declare const StyledClose: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
7
+ /**
8
+ * 1. <button> element reset
9
+ * 2. text content reset
10
+ */
11
+ export declare const StyledClose: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {}, never>;
@@ -8,7 +8,7 @@ import { HTMLAttributes } from 'react';
8
8
  export declare const SIZE: readonly ["small", "medium", "large"];
9
9
  export interface ITagProps extends HTMLAttributes<HTMLDivElement> {
10
10
  /** Adjusts font size and padding */
11
- size?: typeof SIZE[number];
11
+ size?: (typeof SIZE)[number];
12
12
  /**
13
13
  * Sets the color of the tag. Refer to
14
14
  * [PALETTE](/components/palette#palette)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zendeskgarden/react-tags",
3
- "version": "8.62.1",
3
+ "version": "8.63.0",
4
4
  "description": "Components relating to tags in the Garden Design System",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Zendesk Garden <garden@zendesk.com>",
@@ -21,7 +21,7 @@
21
21
  "sideEffects": false,
22
22
  "types": "dist/typings/index.d.ts",
23
23
  "dependencies": {
24
- "@zendeskgarden/container-utilities": "^0.7.0",
24
+ "@zendeskgarden/container-utilities": "^1.0.0",
25
25
  "polished": "^4.0.0",
26
26
  "prop-types": "^15.5.7"
27
27
  },
@@ -32,7 +32,7 @@
32
32
  "styled-components": "^4.2.0 || ^5.0.0"
33
33
  },
34
34
  "devDependencies": {
35
- "@zendeskgarden/react-theming": "^8.62.1",
35
+ "@zendeskgarden/react-theming": "^8.63.0",
36
36
  "@zendeskgarden/svg-icons": "6.33.0"
37
37
  },
38
38
  "keywords": [
@@ -45,5 +45,5 @@
45
45
  "access": "public"
46
46
  },
47
47
  "zendeskgarden:src": "src/index.ts",
48
- "gitHead": "e84b3603c69975dc0ef30029364da15fc1e4fc03"
48
+ "gitHead": "4b8715305a769881b143c7195c5b31e687422926"
49
49
  }