@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/lib/v1/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
  /*
35
37
  * eslint css-modules/no-unused-class: [2, { markAsUsed: ['small', 'medium',
36
38
  * 'closedanger', 'closeprimary', 'default', 'danger', 'secondary',
@@ -63,6 +65,7 @@ function Tag(props) {
63
65
  tooltip = props.tooltip,
64
66
  avatarPalette = props.avatarPalette,
65
67
  customClass = props.customClass,
68
+ customAttributes = props.customAttributes,
66
69
  a11y = props.a11y,
67
70
  needEffect = props.needEffect,
68
71
  isReadOnly = props.isReadOnly,
@@ -101,7 +104,7 @@ function Tag(props) {
101
104
  var _a11y$clearLabel = a11y.clearLabel,
102
105
  clearLabel = _a11y$clearLabel === void 0 ? 'Delete' : _a11y$clearLabel;
103
106
  var isDarkPalette = palette === 'dark';
104
- return /*#__PURE__*/_react["default"].createElement("div", {
107
+ return /*#__PURE__*/_react["default"].createElement("div", _extends({
105
108
  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),
106
109
  "data-id": active ? "".concat(dataId, "_TagSelected") : "".concat(dataId, "_Tag"),
107
110
  "data-test-id": active ? "".concat(dataId, "_TagSelected") : "".concat(dataId, "_Tag"),
@@ -111,7 +114,7 @@ function Tag(props) {
111
114
  tabIndex: disabled ? '-1' : '0',
112
115
  "aria-labelledby": getAriaId,
113
116
  "data-selector-id": dataSelectorId
114
- }, hasAvatar ? /*#__PURE__*/_react["default"].createElement("div", {
117
+ }, customAttributes), hasAvatar ? /*#__PURE__*/_react["default"].createElement("div", {
115
118
  className: _TagModule["default"].avatar
116
119
  }, /*#__PURE__*/_react["default"].createElement(_Avatar["default"], {
117
120
  palette: isDarkPalette ? 'info' : avatarPalette,
@@ -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
  }),
@@ -83,6 +83,7 @@ function TextBoxIcon(props) {
83
83
  inputRef = props.inputRef,
84
84
  onFocus = props.onFocus,
85
85
  onBlur = props.onBlur,
86
+ needInputFocusOnWrapperClick = props.needInputFocusOnWrapperClick,
86
87
  isScrollPrevent = props.isScrollPrevent;
87
88
  var _customClass$customTB = customClass.customTBoxWrap,
88
89
  customTBoxWrap = _customClass$customTB === void 0 ? '' : _customClass$customTB,
@@ -127,12 +128,19 @@ function TextBoxIcon(props) {
127
128
  onBlur && onBlur(e);
128
129
  };
129
130
 
131
+ var handleInputFocusOnClick = function handleInputFocusOnClick() {
132
+ inputEle.current && inputEle.current.focus({
133
+ preventScroll: true
134
+ });
135
+ };
136
+
130
137
  return /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
131
138
  alignBox: "row",
132
139
  isCover: false,
133
140
  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 : ''),
134
141
  dataSelectorId: dataSelectorId,
135
- "data-title": isDisabled ? title : null
142
+ "data-title": isDisabled ? title : null,
143
+ onClick: needInputFocusOnWrapperClick && !isDisabled ? handleInputFocusOnClick : null
136
144
  }, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
137
145
  flexible: true
138
146
  }, /*#__PURE__*/_react["default"].createElement(_TextBox["default"], _extends({}, props, {
@@ -14,6 +14,7 @@ var defaultProps = {
14
14
  type: 'text',
15
15
  variant: 'default',
16
16
  needReadOnlyStyle: true,
17
+ needInputFocusOnWrapperClick: false,
17
18
  isClickable: false,
18
19
  needEffect: true,
19
20
  dataId: 'textBoxIcon',
@@ -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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/components",
3
- "version": "1.2.38",
3
+ "version": "1.2.40",
4
4
  "main": "es/index.js",
5
5
  "module": "es/index.js",
6
6
  "private": false,
@@ -42,7 +42,8 @@
42
42
  "postpublish": "node postPublish.js",
43
43
  "report": "react-cli publish:report",
44
44
  "test": "react-cli test",
45
- "snap-update": "npm run test -- -u",
45
+ "test-clean": "react-cli clean coverage",
46
+ "snap-update": "npm run test-clean && npm run test -- -u",
46
47
  "sstest": "npm run init && react-cli sstest",
47
48
  "build:external": "npm run clean && npm run init && npm run docsjs:build && npm run build:externalDocCopy && react-cli build:component:umd && npm run externalDocHTMLChange",
48
49
  "download": "react-cli clean ./node_modules ./package-lock.json && npm install",