@zohodesk/components 1.2.38 → 1.2.40

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.
Files changed (46) hide show
  1. package/.cli/propValidation_report.html +1 -1
  2. package/README.md +10 -0
  3. package/es/Provider/LibraryContext.js +15 -3
  4. package/es/Provider/LibraryContextInit.js +1 -1
  5. package/es/Radio/Radio.js +3 -2
  6. package/es/Radio/props/propTypes.js +2 -1
  7. package/es/Select/props/propTypes.js +1 -0
  8. package/es/Tag/Tag.js +3 -1
  9. package/es/Tag/__tests__/Tag.spec.js +10 -0
  10. package/es/Tag/__tests__/__snapshots__/Tag.spec.js.snap +20 -0
  11. package/es/Tag/props/defaultProps.js +1 -0
  12. package/es/Tag/props/propTypes.js +1 -0
  13. package/es/TextBoxIcon/TextBoxIcon.js +10 -1
  14. package/es/TextBoxIcon/props/defaultProps.js +1 -0
  15. package/es/TextBoxIcon/props/propTypes.js +1 -0
  16. package/es/v1/Select/Select.js +3 -1
  17. package/es/v1/Select/props/propTypes.js +1 -0
  18. package/es/v1/Tag/Tag.js +3 -1
  19. package/es/v1/Tag/props/defaultProps.js +1 -0
  20. package/es/v1/Tag/props/propTypes.js +1 -0
  21. package/es/v1/TextBoxIcon/TextBoxIcon.js +9 -1
  22. package/es/v1/TextBoxIcon/props/defaultProps.js +1 -0
  23. package/es/v1/TextBoxIcon/props/propTypes.js +1 -0
  24. package/lib/Provider/LibraryContext.js +15 -5
  25. package/lib/Provider/LibraryContextInit.js +1 -1
  26. package/lib/Radio/Radio.js +3 -2
  27. package/lib/Radio/props/propTypes.js +2 -1
  28. package/lib/Select/props/propTypes.js +1 -0
  29. package/lib/Tag/Tag.js +5 -2
  30. package/lib/Tag/__tests__/Tag.spec.js +10 -0
  31. package/lib/Tag/__tests__/__snapshots__/Tag.spec.js.snap +20 -0
  32. package/lib/Tag/props/defaultProps.js +1 -0
  33. package/lib/Tag/props/propTypes.js +1 -0
  34. package/lib/TextBoxIcon/TextBoxIcon.js +11 -1
  35. package/lib/TextBoxIcon/props/defaultProps.js +1 -0
  36. package/lib/TextBoxIcon/props/propTypes.js +1 -0
  37. package/lib/v1/Select/Select.js +4 -2
  38. package/lib/v1/Select/props/propTypes.js +1 -0
  39. package/lib/v1/Tag/Tag.js +5 -2
  40. package/lib/v1/Tag/props/defaultProps.js +1 -0
  41. package/lib/v1/Tag/props/propTypes.js +1 -0
  42. package/lib/v1/TextBoxIcon/TextBoxIcon.js +9 -1
  43. package/lib/v1/TextBoxIcon/props/defaultProps.js +1 -0
  44. package/lib/v1/TextBoxIcon/props/propTypes.js +1 -0
  45. package/package.json +3 -2
  46. package/result.json +1 -1
package/README.md CHANGED
@@ -32,6 +32,16 @@ In this Package, we Provide Some Basic Components to Build Web App
32
32
  - TextBoxIcon
33
33
  - Tooltip
34
34
 
35
+ # 1.2.40
36
+
37
+ - **Radio** - renderRightPlaceholderNode prop supported
38
+
39
+ # 1.2.39
40
+
41
+ - **LibraryContext** - coloredTagVariant, hasTagColorInheritedToText properties added
42
+ - **Tag** - customAttributes prop supported
43
+ - **TextBoxIcon** - needInputFocusOnParentClick prop supported
44
+
35
45
  # 1.2.38
36
46
 
37
47
  - **renderRightPlaceholderNode**
@@ -5,13 +5,17 @@ import { getLibraryConfig } from "./Config";
5
5
 
6
6
  const LibraryContextProvider = _ref => {
7
7
  let {
8
- isReducedMotion = getLibraryConfig('isReducedMotion'),
9
- direction = getLibraryConfig('direction'),
8
+ isReducedMotion,
9
+ direction,
10
+ coloredTagVariant,
11
+ hasTagColorInheritedToText,
10
12
  children
11
13
  } = _ref;
12
14
  const [value, setValue] = useState({
13
15
  isReducedMotion,
14
- direction
16
+ direction,
17
+ coloredTagVariant,
18
+ hasTagColorInheritedToText
15
19
  });
16
20
 
17
21
  function setGlobalContext(key, data) {
@@ -32,6 +36,14 @@ const LibraryContextProvider = _ref => {
32
36
  LibraryContextProvider.propTypes = {
33
37
  children: PropTypes.node.isRequired,
34
38
  isReducedMotion: PropTypes.bool,
39
+ coloredTagVariant: PropTypes.oneOf(['bold', 'subtle', 'minimal']),
40
+ hasTagColorInheritedToText: PropTypes.bool,
35
41
  direction: PropTypes.string
36
42
  };
43
+ LibraryContextProvider.defaultProps = {
44
+ isReducedMotion: getLibraryConfig('isReducedMotion'),
45
+ direction: getLibraryConfig('direction'),
46
+ coloredTagVariant: 'bold',
47
+ hasTagColorInheritedToText: true
48
+ };
37
49
  export default LibraryContextProvider;
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
- const LibraryContext = /*#__PURE__*/React.createContext();
2
+ const LibraryContext = /*#__PURE__*/React.createContext({});
3
3
  export default LibraryContext;
package/es/Radio/Radio.js CHANGED
@@ -49,7 +49,8 @@ export default class Radio extends React.Component {
49
49
  customClass,
50
50
  customProps,
51
51
  children,
52
- a11y
52
+ a11y,
53
+ renderRightPlaceholderNode
53
54
  } = this.props;
54
55
  let {
55
56
  customRadioWrap = '',
@@ -127,7 +128,7 @@ export default class Radio extends React.Component {
127
128
  customClass: `${checked && active ? `${style[`${palette}checkedActive`]}` : ''}
128
129
  ${style[`${palette}Label`]} ${accessMode} ${customLabel}`,
129
130
  ...LabelProps
130
- })), children);
131
+ })), children, renderRightPlaceholderNode ? renderRightPlaceholderNode : null);
131
132
  }
132
133
 
133
134
  }
@@ -36,5 +36,6 @@ export const propTypes = {
36
36
  }),
37
37
  children: PropTypes.node,
38
38
  onChange: PropTypes.func,
39
- text: PropTypes.string
39
+ text: PropTypes.string,
40
+ renderRightPlaceholderNode: PropTypes.node
40
41
  };
@@ -80,6 +80,7 @@ export const Select_propTypes = {
80
80
  iconOnHover: PropTypes.bool,
81
81
  customProps: PropTypes.shape({
82
82
  TextBoxProps: PropTypes.object,
83
+ TextBoxIconProps: PropTypes.object,
83
84
  DropdownSearchTextBoxProps: PropTypes.object,
84
85
  listItemProps: PropTypes.object,
85
86
  SuggestionsProps: PropTypes.object
package/es/Tag/Tag.js CHANGED
@@ -80,6 +80,7 @@ export default class Tag extends PureComponent {
80
80
  tooltip,
81
81
  avatarPalette,
82
82
  customClass,
83
+ customAttributes,
83
84
  a11y,
84
85
  needEffect,
85
86
  isReadOnly
@@ -105,7 +106,8 @@ export default class Tag extends PureComponent {
105
106
  "data-title": tooltip ? tooltip : text,
106
107
  tabIndex: disabled ? '-1' : '0',
107
108
  "aria-labelledby": getAriaId,
108
- "data-selector-id": dataSelectorId
109
+ "data-selector-id": dataSelectorId,
110
+ ...customAttributes
109
111
  }, hasAvatar ? /*#__PURE__*/React.createElement("div", {
110
112
  className: style.avatar
111
113
  }, /*#__PURE__*/React.createElement(Avatar, {
@@ -232,4 +232,14 @@ describe('Tag component', () => {
232
232
  }));
233
233
  expect(asFragment()).toMatchSnapshot();
234
234
  });
235
+ test('rendering with customAttributes prop', () => {
236
+ const {
237
+ asFragment
238
+ } = render( /*#__PURE__*/React.createElement(Tag, {
239
+ customAttributes: {
240
+ 'data-custom-attribute': 'true'
241
+ }
242
+ }));
243
+ expect(asFragment()).toMatchSnapshot();
244
+ });
235
245
  });
@@ -3052,3 +3052,23 @@ exports[`Tag component rendering the Custom class 1`] = `
3052
3052
  </div>
3053
3053
  </DocumentFragment>
3054
3054
  `;
3055
+
3056
+ exports[`Tag component rendering with customAttributes prop 1`] = `
3057
+ <DocumentFragment>
3058
+ <div
3059
+ aria-labelledby="1"
3060
+ class="container effect medium lgRadius default "
3061
+ data-custom-attribute="true"
3062
+ data-id="tag_Tag"
3063
+ data-selector-id="tag"
3064
+ data-test-id="tag_Tag"
3065
+ tabindex="0"
3066
+ >
3067
+ <div
3068
+ aria-hidden="true"
3069
+ class="text mediumtext"
3070
+ id="1"
3071
+ />
3072
+ </div>
3073
+ </DocumentFragment>
3074
+ `;
@@ -7,6 +7,7 @@ export const defaultProps = {
7
7
  size: 'medium',
8
8
  dataId: 'tag',
9
9
  customClass: {},
10
+ customAttributes: {},
10
11
  a11y: {},
11
12
  needEffect: true,
12
13
  isReadOnly: false,
@@ -26,6 +26,7 @@ export const propTypes = {
26
26
  customTagIcon: PropTypes.string,
27
27
  customAvatar: PropTypes.string
28
28
  }),
29
+ customAttributes: PropTypes.object,
29
30
  a11y: PropTypes.shape({
30
31
  clearLabel: PropTypes.string
31
32
  }),
@@ -18,6 +18,7 @@ export default class TextBoxIcon extends React.Component {
18
18
  this.handleBlur = this.handleBlur.bind(this);
19
19
  this.handleRef = this.handleRef.bind(this);
20
20
  this.handleClear = this.handleClear.bind(this);
21
+ this.handleInputFocusOnClick = this.handleInputFocusOnClick.bind(this);
21
22
  }
22
23
 
23
24
  handleRef(ele) {
@@ -63,6 +64,12 @@ export default class TextBoxIcon extends React.Component {
63
64
  onBlur && onBlur(e);
64
65
  }
65
66
 
67
+ handleInputFocusOnClick() {
68
+ this.inputEle && this.inputEle.focus({
69
+ preventScroll: true
70
+ });
71
+ }
72
+
66
73
  render() {
67
74
  const {
68
75
  type,
@@ -101,6 +108,7 @@ export default class TextBoxIcon extends React.Component {
101
108
  onClearMouseDown,
102
109
  isScrollPrevent,
103
110
  customProps,
111
+ needInputFocusOnWrapperClick,
104
112
  renderRightPlaceholderNode
105
113
  } = this.props;
106
114
  const {
@@ -123,7 +131,8 @@ export default class TextBoxIcon extends React.Component {
123
131
  isCover: false,
124
132
  className: `${style.container} ${isDisabled ? style.disabled : isReadOnly ? needEffect ? style.effect : style.readonly : style.effect} ${isActive || isFocus ? style.effectFocused : ''} ${customTBoxWrap} ${iconOnHover && (isReadOnly || isDisabled) ? style.iconOnHoverReadonly : iconOnHover && !(isReadOnly || isDisabled) ? style.iconOnHoverStyle : ''}`,
125
133
  dataSelectorId: dataSelectorId,
126
- "data-title": isDisabled ? title : null
134
+ "data-title": isDisabled ? title : null,
135
+ onClick: needInputFocusOnWrapperClick && !isDisabled ? this.handleInputFocusOnClick : null
127
136
  }, /*#__PURE__*/React.createElement(Box, {
128
137
  flexible: true
129
138
  }, /*#__PURE__*/React.createElement(TextBox, { ...this.props,
@@ -10,6 +10,7 @@ export const defaultProps = {
10
10
  needReadOnlyStyle: true,
11
11
  isClickable: false,
12
12
  needEffect: true,
13
+ needInputFocusOnWrapperClick: false,
13
14
  dataId: 'textBoxIcon',
14
15
  borderColor: 'default',
15
16
  showClearIcon: false,
@@ -20,6 +20,7 @@ export const propTypes = { ...TextBox_propTypes,
20
20
  needBorder: PropTypes.bool,
21
21
  needEffect: PropTypes.bool,
22
22
  needReadOnlyStyle: PropTypes.bool,
23
+ needInputFocusOnWrapperClick: PropTypes.bool,
23
24
  onBlur: PropTypes.func,
24
25
  onChange: PropTypes.func,
25
26
  onClear: PropTypes.func,
@@ -750,6 +750,7 @@ export class SelectComponent extends Component {
750
750
  let ariaErrorId = this.getNextAriaId();
751
751
  let {
752
752
  TextBoxProps = {},
753
+ TextBoxIconProps = {},
753
754
  DropdownSearchTextBoxProps = {},
754
755
  SuggestionsProps = {}
755
756
  } = customProps;
@@ -805,7 +806,8 @@ export class SelectComponent extends Component {
805
806
  'data-title': title || selected,
806
807
  ...TextBoxProps
807
808
  }
808
- }
809
+ },
810
+ ...TextBoxIconProps
809
811
  }, /*#__PURE__*/React.createElement(Container, {
810
812
  alignBox: "row",
811
813
  align: "both"
@@ -80,6 +80,7 @@ export const Select_propTypes = {
80
80
  iconOnHover: PropTypes.bool,
81
81
  customProps: PropTypes.shape({
82
82
  TextBoxProps: PropTypes.object,
83
+ TextBoxIconProps: PropTypes.object,
83
84
  DropdownSearchTextBoxProps: PropTypes.object,
84
85
  listItemProps: PropTypes.object,
85
86
  SuggestionsProps: PropTypes.object
package/es/v1/Tag/Tag.js CHANGED
@@ -41,6 +41,7 @@ function Tag(props) {
41
41
  tooltip,
42
42
  avatarPalette,
43
43
  customClass,
44
+ customAttributes,
44
45
  a11y,
45
46
  needEffect,
46
47
  isReadOnly,
@@ -90,7 +91,8 @@ function Tag(props) {
90
91
  "data-title": tooltip ? tooltip : text,
91
92
  tabIndex: disabled ? '-1' : '0',
92
93
  "aria-labelledby": getAriaId,
93
- "data-selector-id": dataSelectorId
94
+ "data-selector-id": dataSelectorId,
95
+ ...customAttributes
94
96
  }, hasAvatar ? /*#__PURE__*/React.createElement("div", {
95
97
  className: style.avatar
96
98
  }, /*#__PURE__*/React.createElement(Avatar, {
@@ -7,6 +7,7 @@ export const defaultProps = {
7
7
  size: 'medium',
8
8
  dataId: 'tag',
9
9
  customClass: {},
10
+ customAttributes: {},
10
11
  a11y: {},
11
12
  needEffect: true,
12
13
  isReadOnly: false,
@@ -26,6 +26,7 @@ export const propTypes = {
26
26
  customTagIcon: PropTypes.string,
27
27
  customAvatar: PropTypes.string
28
28
  }),
29
+ customAttributes: PropTypes.object,
29
30
  a11y: PropTypes.shape({
30
31
  clearLabel: PropTypes.string
31
32
  }),
@@ -48,6 +48,7 @@ export default function TextBoxIcon(props) {
48
48
  inputRef,
49
49
  onFocus,
50
50
  onBlur,
51
+ needInputFocusOnWrapperClick,
51
52
  isScrollPrevent
52
53
  } = props;
53
54
  const {
@@ -88,12 +89,19 @@ export default function TextBoxIcon(props) {
88
89
  onBlur && onBlur(e);
89
90
  };
90
91
 
92
+ const handleInputFocusOnClick = () => {
93
+ inputEle.current && inputEle.current.focus({
94
+ preventScroll: true
95
+ });
96
+ };
97
+
91
98
  return /*#__PURE__*/React.createElement(Container, {
92
99
  alignBox: "row",
93
100
  isCover: false,
94
101
  className: `${style.container} ${isDisabled ? style.disabled : isReadOnly ? needEffect ? style.effect : style.readonly : style.effect} ${isActive || isFocus ? style.effectFocused : ''} ${customTBoxWrap} ${iconOnHover && (isReadOnly || isDisabled) ? style.iconOnHoverReadonly : iconOnHover && !(isReadOnly || isDisabled) ? style.iconOnHoverStyle : ''}`,
95
102
  dataSelectorId: dataSelectorId,
96
- "data-title": isDisabled ? title : null
103
+ "data-title": isDisabled ? title : null,
104
+ onClick: needInputFocusOnWrapperClick && !isDisabled ? handleInputFocusOnClick : null
97
105
  }, /*#__PURE__*/React.createElement(Box, {
98
106
  flexible: true
99
107
  }, /*#__PURE__*/React.createElement(TextBox, { ...props,
@@ -8,6 +8,7 @@ export const defaultProps = {
8
8
  type: 'text',
9
9
  variant: 'default',
10
10
  needReadOnlyStyle: true,
11
+ needInputFocusOnWrapperClick: false,
11
12
  isClickable: false,
12
13
  needEffect: true,
13
14
  dataId: 'textBoxIcon',
@@ -20,6 +20,7 @@ export const propTypes = { ...TextBox_propTypes,
20
20
  needBorder: PropTypes.bool,
21
21
  needEffect: PropTypes.bool,
22
22
  needReadOnlyStyle: PropTypes.bool,
23
+ needInputFocusOnWrapperClick: PropTypes.bool,
23
24
  onBlur: PropTypes.func,
24
25
  onChange: PropTypes.func,
25
26
  onClear: PropTypes.func,
@@ -40,15 +40,17 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
40
40
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
41
41
 
42
42
  var LibraryContextProvider = function LibraryContextProvider(_ref) {
43
- var _ref$isReducedMotion = _ref.isReducedMotion,
44
- isReducedMotion = _ref$isReducedMotion === void 0 ? (0, _Config.getLibraryConfig)('isReducedMotion') : _ref$isReducedMotion,
45
- _ref$direction = _ref.direction,
46
- direction = _ref$direction === void 0 ? (0, _Config.getLibraryConfig)('direction') : _ref$direction,
43
+ var isReducedMotion = _ref.isReducedMotion,
44
+ direction = _ref.direction,
45
+ coloredTagVariant = _ref.coloredTagVariant,
46
+ hasTagColorInheritedToText = _ref.hasTagColorInheritedToText,
47
47
  children = _ref.children;
48
48
 
49
49
  var _useState = (0, _react.useState)({
50
50
  isReducedMotion: isReducedMotion,
51
- direction: direction
51
+ direction: direction,
52
+ coloredTagVariant: coloredTagVariant,
53
+ hasTagColorInheritedToText: hasTagColorInheritedToText
52
54
  }),
53
55
  _useState2 = _slicedToArray(_useState, 2),
54
56
  value = _useState2[0],
@@ -70,7 +72,15 @@ var LibraryContextProvider = function LibraryContextProvider(_ref) {
70
72
  LibraryContextProvider.propTypes = {
71
73
  children: _propTypes["default"].node.isRequired,
72
74
  isReducedMotion: _propTypes["default"].bool,
75
+ coloredTagVariant: _propTypes["default"].oneOf(['bold', 'subtle', 'minimal']),
76
+ hasTagColorInheritedToText: _propTypes["default"].bool,
73
77
  direction: _propTypes["default"].string
74
78
  };
79
+ LibraryContextProvider.defaultProps = {
80
+ isReducedMotion: (0, _Config.getLibraryConfig)('isReducedMotion'),
81
+ direction: (0, _Config.getLibraryConfig)('direction'),
82
+ coloredTagVariant: 'bold',
83
+ hasTagColorInheritedToText: true
84
+ };
75
85
  var _default = LibraryContextProvider;
76
86
  exports["default"] = _default;
@@ -9,7 +9,7 @@ var _react = _interopRequireDefault(require("react"));
9
9
 
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
11
 
12
- var LibraryContext = /*#__PURE__*/_react["default"].createContext();
12
+ var LibraryContext = /*#__PURE__*/_react["default"].createContext({});
13
13
 
14
14
  var _default = LibraryContext;
15
15
  exports["default"] = _default;
@@ -98,7 +98,8 @@ var Radio = /*#__PURE__*/function (_React$Component) {
98
98
  customClass = _this$props3.customClass,
99
99
  customProps = _this$props3.customProps,
100
100
  children = _this$props3.children,
101
- a11y = _this$props3.a11y;
101
+ a11y = _this$props3.a11y,
102
+ renderRightPlaceholderNode = _this$props3.renderRightPlaceholderNode;
102
103
  var _customClass$customRa = customClass.customRadioWrap,
103
104
  customRadioWrap = _customClass$customRa === void 0 ? '' : _customClass$customRa,
104
105
  _customClass$customRa2 = customClass.customRadio,
@@ -173,7 +174,7 @@ var Radio = /*#__PURE__*/function (_React$Component) {
173
174
  variant: variant,
174
175
  title: toolTip ? toolTip : text,
175
176
  customClass: "".concat(checked && active ? "".concat(_RadioModule["default"]["".concat(palette, "checkedActive")]) : '', " \n ").concat(_RadioModule["default"]["".concat(palette, "Label")], " ").concat(accessMode, " ").concat(customLabel)
176
- }, LabelProps))), children);
177
+ }, LabelProps))), children, renderRightPlaceholderNode ? renderRightPlaceholderNode : null);
177
178
  }
178
179
  }]);
179
180
 
@@ -46,6 +46,7 @@ var propTypes = {
46
46
  }),
47
47
  children: _propTypes["default"].node,
48
48
  onChange: _propTypes["default"].func,
49
- text: _propTypes["default"].string
49
+ text: _propTypes["default"].string,
50
+ renderRightPlaceholderNode: _propTypes["default"].node
50
51
  };
51
52
  exports.propTypes = propTypes;
@@ -96,6 +96,7 @@ var Select_propTypes = {
96
96
  iconOnHover: _propTypes["default"].bool,
97
97
  customProps: _propTypes["default"].shape({
98
98
  TextBoxProps: _propTypes["default"].object,
99
+ TextBoxIconProps: _propTypes["default"].object,
99
100
  DropdownSearchTextBoxProps: _propTypes["default"].object,
100
101
  listItemProps: _propTypes["default"].object,
101
102
  SuggestionsProps: _propTypes["default"].object
package/lib/Tag/Tag.js CHANGED
@@ -31,6 +31,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
31
31
 
32
32
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
33
33
 
34
+ 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); }
35
+
34
36
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
35
37
 
36
38
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
@@ -135,6 +137,7 @@ var Tag = /*#__PURE__*/function (_PureComponent) {
135
137
  tooltip = _this$props4.tooltip,
136
138
  avatarPalette = _this$props4.avatarPalette,
137
139
  customClass = _this$props4.customClass,
140
+ customAttributes = _this$props4.customAttributes,
138
141
  a11y = _this$props4.a11y,
139
142
  needEffect = _this$props4.needEffect,
140
143
  isReadOnly = _this$props4.isReadOnly;
@@ -151,7 +154,7 @@ var Tag = /*#__PURE__*/function (_PureComponent) {
151
154
  var _a11y$clearLabel = a11y.clearLabel,
152
155
  clearLabel = _a11y$clearLabel === void 0 ? 'Delete' : _a11y$clearLabel;
153
156
  var isDarkPalette = palette === 'dark';
154
- return /*#__PURE__*/_react["default"].createElement("div", {
157
+ return /*#__PURE__*/_react["default"].createElement("div", _extends({
155
158
  className: "".concat(_TagModule["default"].container, " ").concat(needEffect && !isReadOnly ? _TagModule["default"].effect : _TagModule["default"].readonly, " ").concat(active ? "".concat(_TagModule["default"].selected, " ").concat(_TagModule["default"]["active".concat(palette)]) : '', " ").concat(onRemove ? active ? "".concat(_TagModule["default"]["active".concat(size, "Effect")]) : '' : '', " ").concat(_TagModule["default"][size], " ").concat(rounded ? _TagModule["default"].lgRadius : _TagModule["default"].smRadius, " ").concat(_TagModule["default"][palette], " ").concat(disabled ? _TagModule["default"].disabled : '', " ").concat(onSelectTag ? _TagModule["default"].pointer : '', " ").concat(customTag),
156
159
  "data-id": active ? "".concat(dataId, "_TagSelected") : "".concat(dataId, "_Tag"),
157
160
  "data-test-id": active ? "".concat(dataId, "_TagSelected") : "".concat(dataId, "_Tag"),
@@ -161,7 +164,7 @@ var Tag = /*#__PURE__*/function (_PureComponent) {
161
164
  tabIndex: disabled ? '-1' : '0',
162
165
  "aria-labelledby": getAriaId,
163
166
  "data-selector-id": dataSelectorId
164
- }, hasAvatar ? /*#__PURE__*/_react["default"].createElement("div", {
167
+ }, customAttributes), hasAvatar ? /*#__PURE__*/_react["default"].createElement("div", {
165
168
  className: _TagModule["default"].avatar
166
169
  }, /*#__PURE__*/_react["default"].createElement(_Avatar["default"], {
167
170
  palette: isDarkPalette ? 'info' : avatarPalette,
@@ -249,4 +249,14 @@ describe('Tag component', function () {
249
249
 
250
250
  expect(asFragment()).toMatchSnapshot();
251
251
  });
252
+ test('rendering with customAttributes prop', function () {
253
+ var _render24 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Tag["default"], {
254
+ customAttributes: {
255
+ 'data-custom-attribute': 'true'
256
+ }
257
+ })),
258
+ asFragment = _render24.asFragment;
259
+
260
+ expect(asFragment()).toMatchSnapshot();
261
+ });
252
262
  });
@@ -3052,3 +3052,23 @@ exports[`Tag component rendering the Custom class 1`] = `
3052
3052
  </div>
3053
3053
  </DocumentFragment>
3054
3054
  `;
3055
+
3056
+ exports[`Tag component rendering with customAttributes prop 1`] = `
3057
+ <DocumentFragment>
3058
+ <div
3059
+ aria-labelledby="1"
3060
+ class="container effect medium lgRadius default "
3061
+ data-custom-attribute="true"
3062
+ data-id="tag_Tag"
3063
+ data-selector-id="tag"
3064
+ data-test-id="tag_Tag"
3065
+ tabindex="0"
3066
+ >
3067
+ <div
3068
+ aria-hidden="true"
3069
+ class="text mediumtext"
3070
+ id="1"
3071
+ />
3072
+ </div>
3073
+ </DocumentFragment>
3074
+ `;
@@ -13,6 +13,7 @@ var defaultProps = {
13
13
  size: 'medium',
14
14
  dataId: 'tag',
15
15
  customClass: {},
16
+ customAttributes: {},
16
17
  a11y: {},
17
18
  needEffect: true,
18
19
  isReadOnly: false,
@@ -36,6 +36,7 @@ var propTypes = {
36
36
  customTagIcon: _propTypes["default"].string,
37
37
  customAvatar: _propTypes["default"].string
38
38
  }),
39
+ customAttributes: _propTypes["default"].object,
39
40
  a11y: _propTypes["default"].shape({
40
41
  clearLabel: _propTypes["default"].string
41
42
  }),
@@ -66,6 +66,7 @@ var TextBoxIcon = /*#__PURE__*/function (_React$Component) {
66
66
  _this.handleBlur = _this.handleBlur.bind(_assertThisInitialized(_this));
67
67
  _this.handleRef = _this.handleRef.bind(_assertThisInitialized(_this));
68
68
  _this.handleClear = _this.handleClear.bind(_assertThisInitialized(_this));
69
+ _this.handleInputFocusOnClick = _this.handleInputFocusOnClick.bind(_assertThisInitialized(_this));
69
70
  return _this;
70
71
  }
71
72
 
@@ -109,6 +110,13 @@ var TextBoxIcon = /*#__PURE__*/function (_React$Component) {
109
110
  });
110
111
  onBlur && onBlur(e);
111
112
  }
113
+ }, {
114
+ key: "handleInputFocusOnClick",
115
+ value: function handleInputFocusOnClick() {
116
+ this.inputEle && this.inputEle.focus({
117
+ preventScroll: true
118
+ });
119
+ }
112
120
  }, {
113
121
  key: "render",
114
122
  value: function render() {
@@ -149,6 +157,7 @@ var TextBoxIcon = /*#__PURE__*/function (_React$Component) {
149
157
  onClearMouseDown = _this$props2.onClearMouseDown,
150
158
  isScrollPrevent = _this$props2.isScrollPrevent,
151
159
  customProps = _this$props2.customProps,
160
+ needInputFocusOnWrapperClick = _this$props2.needInputFocusOnWrapperClick,
152
161
  renderRightPlaceholderNode = _this$props2.renderRightPlaceholderNode;
153
162
  var isActive = this.state.isActive;
154
163
  var _customClass$customTB = customClass.customTBoxWrap,
@@ -168,7 +177,8 @@ var TextBoxIcon = /*#__PURE__*/function (_React$Component) {
168
177
  isCover: false,
169
178
  className: "".concat(_TextBoxIconModule["default"].container, " ").concat(isDisabled ? _TextBoxIconModule["default"].disabled : isReadOnly ? needEffect ? _TextBoxIconModule["default"].effect : _TextBoxIconModule["default"].readonly : _TextBoxIconModule["default"].effect, " ").concat(isActive || isFocus ? _TextBoxIconModule["default"].effectFocused : '', " ").concat(customTBoxWrap, " ").concat(iconOnHover && (isReadOnly || isDisabled) ? _TextBoxIconModule["default"].iconOnHoverReadonly : iconOnHover && !(isReadOnly || isDisabled) ? _TextBoxIconModule["default"].iconOnHoverStyle : ''),
170
179
  dataSelectorId: dataSelectorId,
171
- "data-title": isDisabled ? title : null
180
+ "data-title": isDisabled ? title : null,
181
+ onClick: needInputFocusOnWrapperClick && !isDisabled ? this.handleInputFocusOnClick : null
172
182
  }, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
173
183
  flexible: true
174
184
  }, /*#__PURE__*/_react["default"].createElement(_TextBox["default"], _extends({}, this.props, {
@@ -16,6 +16,7 @@ var defaultProps = {
16
16
  needReadOnlyStyle: true,
17
17
  isClickable: false,
18
18
  needEffect: true,
19
+ needInputFocusOnWrapperClick: false,
19
20
  dataId: 'textBoxIcon',
20
21
  borderColor: 'default',
21
22
  showClearIcon: false,
@@ -37,6 +37,7 @@ var propTypes = _objectSpread(_objectSpread({}, _propTypes2.propTypes), {}, {
37
37
  needBorder: _propTypes["default"].bool,
38
38
  needEffect: _propTypes["default"].bool,
39
39
  needReadOnlyStyle: _propTypes["default"].bool,
40
+ needInputFocusOnWrapperClick: _propTypes["default"].bool,
40
41
  onBlur: _propTypes["default"].func,
41
42
  onChange: _propTypes["default"].func,
42
43
  onClear: _propTypes["default"].func,
@@ -798,6 +798,8 @@ var SelectComponent = /*#__PURE__*/function (_Component) {
798
798
  var ariaErrorId = this.getNextAriaId();
799
799
  var _customProps$TextBoxP = customProps.TextBoxProps,
800
800
  TextBoxProps = _customProps$TextBoxP === void 0 ? {} : _customProps$TextBoxP,
801
+ _customProps$TextBoxI = customProps.TextBoxIconProps,
802
+ TextBoxIconProps = _customProps$TextBoxI === void 0 ? {} : _customProps$TextBoxI,
801
803
  _customProps$Dropdown = customProps.DropdownSearchTextBoxProps,
802
804
  DropdownSearchTextBoxProps = _customProps$Dropdown === void 0 ? {} : _customProps$Dropdown,
803
805
  _customProps$Suggesti = customProps.SuggestionsProps,
@@ -812,7 +814,7 @@ var SelectComponent = /*#__PURE__*/function (_Component) {
812
814
  ref: getTargetRef,
813
815
  "data-id": "".concat(isDisabled ? "".concat(dataId, "_disabled") : isReadOnly ? "".concat(dataId, "_readOnly") : dataId),
814
816
  "data-test-id": "".concat(isDisabled ? "".concat(dataId, "_disabled") : isReadOnly ? "".concat(dataId, "_readOnly") : dataId)
815
- }, needSelectDownIcon ? /*#__PURE__*/_react["default"].createElement(_TextBoxIcon["default"], {
817
+ }, needSelectDownIcon ? /*#__PURE__*/_react["default"].createElement(_TextBoxIcon["default"], _extends({
816
818
  a11y: {
817
819
  role: 'Menuitem',
818
820
  ariaLabel: TextBox_ally_label,
@@ -854,7 +856,7 @@ var SelectComponent = /*#__PURE__*/function (_Component) {
854
856
  'data-title': title || selected
855
857
  }, TextBoxProps)
856
858
  }
857
- }, /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
859
+ }, TextBoxIconProps), /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
858
860
  alignBox: "row",
859
861
  align: "both"
860
862
  }, children ? /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
@@ -96,6 +96,7 @@ var Select_propTypes = {
96
96
  iconOnHover: _propTypes["default"].bool,
97
97
  customProps: _propTypes["default"].shape({
98
98
  TextBoxProps: _propTypes["default"].object,
99
+ TextBoxIconProps: _propTypes["default"].object,
99
100
  DropdownSearchTextBoxProps: _propTypes["default"].object,
100
101
  listItemProps: _propTypes["default"].object,
101
102
  SuggestionsProps: _propTypes["default"].object