@occmundial/occ-atomic 1.21.3 → 1.22.1

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,3 +1,25 @@
1
+ ## [1.22.1](https://github.com/occmundial/occ-atomic/compare/v1.22.0...v1.22.1) (2022-11-10)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Add testid in render props ([d55d31e](https://github.com/occmundial/occ-atomic/commit/d55d31e737799916afe9705239fb48b9a840654b))
7
+ * Indentation navicon ([0d98ca6](https://github.com/occmundial/occ-atomic/commit/0d98ca68b4ca7c67155a04acaf8f80f8318954a2))
8
+
9
+ # [1.22.0](https://github.com/occmundial/occ-atomic/compare/v1.21.3...v1.22.0) (2022-11-09)
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * Indentation tabs to spaces ([bf7bdf8](https://github.com/occmundial/occ-atomic/commit/bf7bdf82ef1cf5b69ad46d5c6e1eae01f0544a02))
15
+ * Remove unnecessary classname in droplist ([6f6bd6a](https://github.com/occmundial/occ-atomic/commit/6f6bd6ad6f9fed0d534f9d30ff748ac1b6e5d866))
16
+
17
+
18
+ ### Features
19
+
20
+ * Add testid prop to button, modal and textfield ([86a8155](https://github.com/occmundial/occ-atomic/commit/86a8155ff1ae202c88bc558502912968ebe8a04a))
21
+ * Add testid prop to checkbox, droplist and navitem/icon/tab ([7087d67](https://github.com/occmundial/occ-atomic/commit/7087d67e1977167a384a366cb11036919b3c9572))
22
+
1
23
  ## [1.21.3](https://github.com/occmundial/occ-atomic/compare/v1.21.2...v1.21.3) (2022-08-23)
2
24
 
3
25
 
@@ -242,7 +242,8 @@ Autocomplete.propTypes = {
242
242
  valueProp: _propTypes["default"].string,
243
243
  className: _propTypes["default"].string,
244
244
  inputClassName: _propTypes["default"].string,
245
- disabled: _propTypes["default"].bool
245
+ disabled: _propTypes["default"].bool,
246
+ testId: _propTypes["default"].string
246
247
  }).isRequired,
247
248
 
248
249
  /** Object with the props for the Droplist component. Check their descriptions in the Droplist docs. */
@@ -256,7 +257,8 @@ Autocomplete.propTypes = {
256
257
  groupNameKey: _propTypes["default"].string,
257
258
  groupItemsKey: _propTypes["default"].string,
258
259
  className: _propTypes["default"].string,
259
- filter: _propTypes["default"].bool
260
+ filter: _propTypes["default"].bool,
261
+ testId: _propTypes["default"].string
260
262
  }).isRequired,
261
263
 
262
264
  /** Function to call on change (TextField). */
@@ -69,7 +69,8 @@ var Button = /*#__PURE__*/function (_React$Component) {
69
69
  iconRight = _this$props.iconRight,
70
70
  round = _this$props.round,
71
71
  style = _this$props.style,
72
- loading = _this$props.loading;
72
+ loading = _this$props.loading,
73
+ testId = _this$props.testId;
73
74
  var classNames = classes.btn;
74
75
  if (theme) classNames += " ".concat(classes[theme]);
75
76
  if (loading) classNames += " ".concat(classes.loading);
@@ -105,14 +106,16 @@ var Button = /*#__PURE__*/function (_React$Component) {
105
106
  rel: rel,
106
107
  onClick: !disabled ? onClick : null,
107
108
  id: id,
108
- style: style
109
+ style: style,
110
+ "data-testid": testId
109
111
  }, content, loadingLayer);
110
112
  } else {
111
113
  return /*#__PURE__*/_react["default"].createElement("button", {
112
114
  className: classNames,
113
115
  onClick: !disabled ? onClick : null,
114
116
  id: id,
115
- style: style
117
+ style: style,
118
+ "data-testid": testId
116
119
  }, content, loadingLayer);
117
120
  }
118
121
  }
@@ -168,7 +171,10 @@ Button.propTypes = {
168
171
  rel: _propTypes["default"].string,
169
172
  id: _propTypes["default"].string,
170
173
  className: _propTypes["default"].string,
171
- style: _propTypes["default"].object
174
+ style: _propTypes["default"].object,
175
+
176
+ /** The testId property adds the data attribute data-testid to the main element and should be used for testing only. */
177
+ testId: _propTypes["default"].string
172
178
  };
173
179
  var _default = Button;
174
180
  exports["default"] = _default;
@@ -15,6 +15,8 @@ var _Text = _interopRequireDefault(require("../Text"));
15
15
 
16
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
17
17
 
18
+ function _extends() { _extends = Object.assign || 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); }
19
+
18
20
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
19
21
 
20
22
  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); } }
@@ -94,14 +96,18 @@ var Checkbox = /*#__PURE__*/function (_React$Component) {
94
96
  id = _this$props2.id,
95
97
  className = _this$props2.className,
96
98
  style = _this$props2.style,
97
- trk = _this$props2.trk;
99
+ trk = _this$props2.trk,
100
+ testId = _this$props2.testId;
98
101
  var iconClass = undetermined ? " ".concat(classes.undetermined) : value ? " ".concat(classes.active) : '';
99
- return /*#__PURE__*/_react["default"].createElement("div", {
102
+ return /*#__PURE__*/_react["default"].createElement("div", _extends({
100
103
  id: id,
101
104
  className: "".concat(classes.cont).concat(iconClass).concat(disabled ? " ".concat(classes.disabled) : '').concat(className ? " ".concat(className) : ''),
102
105
  onClick: this.toggle,
103
- style: style
104
- }, /*#__PURE__*/_react["default"].createElement("div", {
106
+ style: style,
107
+ "data-testid": testId
108
+ }, testId && {
109
+ 'data-value': value ? 1 : 0
110
+ }), /*#__PURE__*/_react["default"].createElement("div", {
105
111
  className: classes.check,
106
112
  id: trk
107
113
  }), label && /*#__PURE__*/_react["default"].createElement(_Text["default"], {
@@ -146,7 +152,10 @@ Checkbox.propTypes = {
146
152
  trk: _propTypes["default"].string,
147
153
  id: _propTypes["default"].string,
148
154
  className: _propTypes["default"].string,
149
- style: _propTypes["default"].object
155
+ style: _propTypes["default"].object,
156
+
157
+ /** The testId property adds the data attribute data-testid to the main element and should be used for testing only. */
158
+ testId: _propTypes["default"].string
150
159
  };
151
160
  var _default = Checkbox;
152
161
  exports["default"] = _default;
@@ -29,6 +29,8 @@ var _iconSizes = _interopRequireDefault(require("../subatomic/iconSizes"));
29
29
 
30
30
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
31
31
 
32
+ function _extends() { _extends = Object.assign || 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); }
33
+
32
34
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
33
35
 
34
36
  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); } }
@@ -403,13 +405,14 @@ var Droplist = /*#__PURE__*/function (_React$Component) {
403
405
  itemIdKey = _this$props5.itemIdKey,
404
406
  itemTextKey = _this$props5.itemTextKey,
405
407
  itemTextRightKey = _this$props5.itemTextRightKey,
406
- term = _this$props5.term;
408
+ term = _this$props5.term,
409
+ testId = _this$props5.testId;
407
410
  var itemsDOM = items.map(function (item, i) {
408
411
  var index = (0, _functions.compareText)(item[itemTextKey], term);
409
412
 
410
413
  if (index >= 0) {
411
414
  var text = (0, _functions.separateText)(item[itemTextKey], index, term);
412
- return /*#__PURE__*/_react["default"].createElement("div", {
415
+ return /*#__PURE__*/_react["default"].createElement("div", _extends({
413
416
  key: item[itemIdKey],
414
417
  onClick: !item.disabled ? function (e) {
415
418
  return _this4.onClick(item, e);
@@ -421,7 +424,9 @@ var Droplist = /*#__PURE__*/function (_React$Component) {
421
424
  return _this4.onMouseUp(item, e);
422
425
  },
423
426
  className: "".concat(classes.item).concat(selectedGroup && currentItem === i ? " ".concat(classes.onFocus) : '').concat(!item.disabled ? " ".concat(classes.itemPointer) : '')
424
- }, /*#__PURE__*/_react["default"].createElement("div", null, item.iconName && /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
427
+ }, testId && {
428
+ 'data-testid': "".concat(testId, "__droplist-item-").concat(item[itemIdKey])
429
+ }), /*#__PURE__*/_react["default"].createElement("div", null, item.iconName && /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
425
430
  iconName: item.iconName,
426
431
  width: iconSmall,
427
432
  height: iconSmall,
@@ -447,7 +452,7 @@ var Droplist = /*#__PURE__*/function (_React$Component) {
447
452
  low: true
448
453
  }, item[itemTextRightKey])));
449
454
  } else {
450
- return /*#__PURE__*/_react["default"].createElement("div", {
455
+ return /*#__PURE__*/_react["default"].createElement("div", _extends({
451
456
  key: item[itemIdKey],
452
457
  onClick: function onClick(e) {
453
458
  return _this4.onClick(item, e);
@@ -459,12 +464,13 @@ var Droplist = /*#__PURE__*/function (_React$Component) {
459
464
  return _this4.onMouseUp(item, e);
460
465
  },
461
466
  className: "".concat(classes.item).concat(selectedGroup && currentItem === i ? " ".concat(classes.onFocus) : '')
462
- }, /*#__PURE__*/_react["default"].createElement("div", null, item.iconName && /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
467
+ }, testId && {
468
+ 'data-testid': "".concat(testId, "__droplist-item-").concat(item[itemIdKey])
469
+ }), /*#__PURE__*/_react["default"].createElement("div", null, item.iconName && /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
463
470
  iconName: item.iconName,
464
471
  width: 14,
465
472
  height: 14,
466
473
  display: "inline-block",
467
- className: classes.dsfsdf,
468
474
  colors: [inkLighter]
469
475
  }), /*#__PURE__*/_react["default"].createElement(_Text["default"], null, item[itemTextKey], item.extraText && /*#__PURE__*/_react["default"].createElement(_Text["default"], {
470
476
  tag: "span",
@@ -576,7 +582,10 @@ Droplist.propTypes = {
576
582
  isOnFocus: _propTypes["default"].bool,
577
583
  id: _propTypes["default"].string,
578
584
  className: _propTypes["default"].string,
579
- style: _propTypes["default"].object
585
+ style: _propTypes["default"].object,
586
+
587
+ /** The testId property adds the data attribute data-testid to the main element and should be used for testing only. */
588
+ testId: _propTypes["default"].string
580
589
  };
581
590
  var _default = Droplist;
582
591
  exports["default"] = _default;
@@ -27,6 +27,8 @@ var _grid = _interopRequireDefault(require("../subatomic/grid"));
27
27
 
28
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
29
29
 
30
+ function _extends() { _extends = Object.assign || 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); }
31
+
30
32
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
31
33
 
32
34
  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); } }
@@ -50,8 +52,8 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
50
52
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
51
53
 
52
54
  /**
53
- * The Modal component is rendered in any given container, avoiding z-index an position conflicts. Your application must have the logic to show or hide the Modal component.
54
- */
55
+ * The Modal component is rendered in any given container, avoiding z-index an position conflicts. Your application must have the logic to show or hide the Modal component.
56
+ */
55
57
  var Modal = /*#__PURE__*/function (_React$Component) {
56
58
  _inherits(Modal, _React$Component);
57
59
 
@@ -118,11 +120,14 @@ var Modal = /*#__PURE__*/function (_React$Component) {
118
120
  imgTop = _this$props.imgTop,
119
121
  imgLeft = _this$props.imgLeft,
120
122
  onTransitionEnd = _this$props.onTransitionEnd,
121
- fullSize = _this$props.fullSize;
123
+ fullSize = _this$props.fullSize,
124
+ testId = _this$props.testId;
122
125
 
123
- var closeButton = /*#__PURE__*/_react["default"].createElement("div", {
126
+ var closeButton = /*#__PURE__*/_react["default"].createElement("div", _extends({
124
127
  className: classes.closeIcon
125
- }, /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
128
+ }, testId && {
129
+ 'data-testid': "".concat(testId, "__container-close-icon")
130
+ }), /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
126
131
  iconName: "close",
127
132
  width: 24,
128
133
  height: 24,
@@ -173,7 +178,7 @@ var Modal = /*#__PURE__*/function (_React$Component) {
173
178
  className: classes.content
174
179
  }, children), mainBtn && /*#__PURE__*/_react["default"].createElement("div", {
175
180
  className: classes.bottom
176
- }, secBtn && /*#__PURE__*/_react["default"].createElement(_Button["default"], {
181
+ }, secBtn && /*#__PURE__*/_react["default"].createElement(_Button["default"], _extends({
177
182
  theme: "ghostGrey",
178
183
  className: classes.secBtn,
179
184
  onClick: secBtn.onClick,
@@ -182,7 +187,9 @@ var Modal = /*#__PURE__*/function (_React$Component) {
182
187
  loading: secBtn.loading,
183
188
  disabled: secBtn.disabled,
184
189
  id: secBtn.id
185
- }, secBtn.text), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
190
+ }, testId && {
191
+ 'data-testid': "".concat(testId, "__button_secondary")
192
+ }), secBtn.text), /*#__PURE__*/_react["default"].createElement(_Button["default"], _extends({
186
193
  className: classes.mainBtn,
187
194
  onClick: mainBtn.onClick,
188
195
  href: mainBtn.href,
@@ -190,7 +197,9 @@ var Modal = /*#__PURE__*/function (_React$Component) {
190
197
  loading: mainBtn.loading,
191
198
  disabled: mainBtn.disabled,
192
199
  id: mainBtn.id
193
- }, mainBtn.text))))))));
200
+ }, testId && {
201
+ 'data-testid': "".concat(testId, "__button_main")
202
+ }), mainBtn.text))))))));
194
203
  }
195
204
  }]);
196
205
 
@@ -263,7 +272,10 @@ Modal.propTypes = {
263
272
  onTransitionEnd: _propTypes["default"].func,
264
273
 
265
274
  /** Boolean value to make full size the Modal component in mobile size. */
266
- fullSize: _propTypes["default"].bool
275
+ fullSize: _propTypes["default"].bool,
276
+
277
+ /** The testId property adds the data attribute data-testid to the main element and should be used for testing only. */
278
+ testId: _propTypes["default"].string
267
279
  };
268
280
  var _default = Modal;
269
281
  exports["default"] = _default;
@@ -57,10 +57,12 @@ var NavIcon = /*#__PURE__*/function (_React$Component) {
57
57
  label = _this$props.label,
58
58
  onClick = _this$props.onClick,
59
59
  direction = _this$props.direction,
60
- className = _this$props.className;
60
+ className = _this$props.className,
61
+ testId = _this$props.testId;
61
62
  return /*#__PURE__*/_react["default"].createElement("div", {
62
63
  className: "".concat(classes.cont).concat(selected ? " ".concat(classes.selected) : '').concat(className ? " ".concat(className) : ''),
63
- onClick: onClick
64
+ onClick: onClick,
65
+ "data-testid": testId
64
66
  }, /*#__PURE__*/_react["default"].createElement(_Flexbox["default"], {
65
67
  display: "flex",
66
68
  direction: direction,
@@ -89,7 +91,10 @@ NavIcon.propTypes = {
89
91
  width: _propTypes["default"].number,
90
92
  showBar: _propTypes["default"].bool,
91
93
  direction: _propTypes["default"].oneOf(['col', 'row']),
92
- className: _propTypes["default"].string
94
+ className: _propTypes["default"].string,
95
+
96
+ /** The testId property adds the data attribute data-testid to the main element and should be used for testing only. */
97
+ testId: _propTypes["default"].string
93
98
  };
94
99
  var _default = NavIcon;
95
100
  exports["default"] = _default;
@@ -64,14 +64,17 @@ var NavItem = /*#__PURE__*/function (_React$Component) {
64
64
  notification = _this$props.notification,
65
65
  white = _this$props.white,
66
66
  small = _this$props.small,
67
- className = _this$props.className;
67
+ className = _this$props.className,
68
+ testId = _this$props.testId;
68
69
  var AnchorTag = customComponent ? customComponent : 'a';
69
70
  return /*#__PURE__*/_react["default"].createElement(AnchorTag, _extends({
70
71
  className: "".concat(classes.link).concat(className ? " ".concat(className) : ''),
71
72
  href: !selected ? link : null,
72
73
  onClick: !selected ? onClick : null,
73
74
  target: target
74
- }, customComponent && customProps), /*#__PURE__*/_react["default"].createElement(_Text["default"], {
75
+ }, customComponent && customProps, {
76
+ "data-testid": testId
77
+ }), /*#__PURE__*/_react["default"].createElement(_Text["default"], {
75
78
  tag: "span",
76
79
  white: white,
77
80
  small: small,
@@ -115,7 +118,10 @@ NavItem.propTypes = {
115
118
 
116
119
  /** Custom properties to apply directly to the custom component. */
117
120
  customProps: _propTypes["default"].object,
118
- className: _propTypes["default"].string
121
+ className: _propTypes["default"].string,
122
+
123
+ /** The testId property adds the data attribute data-testid to the main element and should be used for testing only. */
124
+ testId: _propTypes["default"].string
119
125
  };
120
126
  var _default = NavItem;
121
127
  exports["default"] = _default;
@@ -266,7 +266,8 @@ var positionPropTypes = _propTypes["default"].arrayOf(_propTypes["default"].shap
266
266
  link: _propTypes["default"].string,
267
267
  theme: _propTypes["default"].oneOf(['primary', 'secondary', 'tertiary', 'tertiaryWhite', 'ghostPink', 'ghostGrey', 'ghostWhite']),
268
268
  iconName: _propTypes["default"].string,
269
- custom: _propTypes["default"].node
269
+ custom: _propTypes["default"].node,
270
+ testId: _propTypes["default"].string
270
271
  }));
271
272
 
272
273
  NavTab.propTypes = {
@@ -230,9 +230,9 @@ var TextField = /*#__PURE__*/function (_React$Component) {
230
230
  if (searchField && iconName) className += " ".concat(classes.searchFieldHasIcon);
231
231
  if (clear) className += " ".concat(classes.hasClear);
232
232
  if (alignRight) className += " ".concat(classes.alignRight);
233
- if (type == "select") className += " ".concat(classes.select);
234
- if (type == "textarea") className += " ".concat(classes.textarea);
235
- if (type == "password") className += " ".concat(classes.hasPass);
233
+ if (type == 'select') className += " ".concat(classes.select);
234
+ if (type == 'textarea') className += " ".concat(classes.textarea);
235
+ if (type == 'password') className += " ".concat(classes.hasPass);
236
236
  if (hjWhitelist) className += ' data-hj-whitelist';
237
237
  if (inputClassName) className += " ".concat(inputClassName);
238
238
  return className;
@@ -293,9 +293,10 @@ var TextField = /*#__PURE__*/function (_React$Component) {
293
293
  inputMode = _this$props9.inputMode,
294
294
  disableAutoComplete = _this$props9.disableAutoComplete,
295
295
  pattern = _this$props9.pattern,
296
- searchField = _this$props9.searchField;
296
+ searchField = _this$props9.searchField,
297
+ testId = _this$props9.testId;
297
298
  var realStatus = status;
298
- var InputType = type == "select" ? "select" : type == "textarea" ? "textarea" : "input";
299
+ var InputType = type == 'select' ? 'select' : type == 'textarea' ? 'textarea' : 'input';
299
300
  var errorStatus = meta && meta.error && (meta.touched || allowError) || error && (touched || allowError) && !passIconBeingClicked;
300
301
  if (disabled) realStatus = 'disabled';else if (status != 'focus' && errorStatus) realStatus = 'error';else if (status !== 'focus' && searchField && value) realStatus = 'filled';
301
302
  var element, passIcon;
@@ -315,11 +316,12 @@ var TextField = /*#__PURE__*/function (_React$Component) {
315
316
  },
316
317
  required: required,
317
318
  pattern: pattern,
318
- inputMode: inputMode
319
+ inputMode: inputMode,
320
+ 'data-testid': testId
319
321
  };
320
322
 
321
323
  if (disabled) {
322
- if (type == "select") {
324
+ if (type == 'select') {
323
325
  var selectedOption = options.filter(function (option) {
324
326
  return option.value == value;
325
327
  });
@@ -350,7 +352,7 @@ var TextField = /*#__PURE__*/function (_React$Component) {
350
352
  height: _iconSizes["default"].small,
351
353
  colors: [_colors["default"].grey200]
352
354
  }));
353
- } else if (type == "select") {
355
+ } else if (type == 'select') {
354
356
  element = /*#__PURE__*/_react["default"].createElement(InputType, commonProps, /*#__PURE__*/_react["default"].createElement("option", {
355
357
  value: "",
356
358
  disabled: true,
@@ -362,18 +364,22 @@ var TextField = /*#__PURE__*/function (_React$Component) {
362
364
  label: item.label,
363
365
  disabled: item.disabled
364
366
  }, item.options.map(function (option) {
365
- return /*#__PURE__*/_react["default"].createElement("option", {
367
+ return /*#__PURE__*/_react["default"].createElement("option", _extends({
366
368
  key: option.value,
367
369
  value: option.value,
368
370
  disabled: option.disabled
369
- }, option.label);
371
+ }, testId && {
372
+ 'data-testid': "".concat(testId, "__item-").concat(item.value)
373
+ }), option.label);
370
374
  }));
371
375
  } else {
372
- return /*#__PURE__*/_react["default"].createElement("option", {
376
+ return /*#__PURE__*/_react["default"].createElement("option", _extends({
373
377
  key: item.value,
374
378
  value: item.value,
375
379
  disabled: item.disabled
376
- }, item.label);
380
+ }, testId && {
381
+ 'data-testid': "".concat(testId, "__item-").concat(item.value)
382
+ }), item.label);
377
383
  }
378
384
  }));
379
385
  } else if (mask) {
@@ -399,7 +405,7 @@ var TextField = /*#__PURE__*/function (_React$Component) {
399
405
  onMouseOut: this.outOfPassIcon,
400
406
  className: classes.passIcon
401
407
  }, /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
402
- iconName: showPass ? "eye" : "eyeClosed",
408
+ iconName: showPass ? 'eye' : 'eyeClosed',
403
409
  width: _iconSizes["default"].small,
404
410
  height: _iconSizes["default"].small,
405
411
  colors: showPass ? [_colors["default"].grey900] : [_colors["default"].grey400]
@@ -428,10 +434,12 @@ var TextField = /*#__PURE__*/function (_React$Component) {
428
434
  width: _iconSizes["default"].small,
429
435
  height: _iconSizes["default"].small,
430
436
  colors: disabled ? [_colors["default"].grey200] : [_colors["default"].grey900]
431
- })), type == 'password' && passIcon, value && clear && /*#__PURE__*/_react["default"].createElement("div", {
437
+ })), type == 'password' && passIcon, value && clear && /*#__PURE__*/_react["default"].createElement("div", _extends({
432
438
  onClick: this.onClear,
433
439
  className: classes.clear
434
- }, /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
440
+ }, testId && {
441
+ 'data-testid': "".concat(testId, "__container-close-icon")
442
+ }), /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
435
443
  iconName: "close",
436
444
  width: _iconSizes["default"].small,
437
445
  height: _iconSizes["default"].small
@@ -444,7 +452,7 @@ var TextField = /*#__PURE__*/function (_React$Component) {
444
452
  width: _iconSizes["default"].tiny,
445
453
  height: _iconSizes["default"].tiny,
446
454
  className: classes.errorIcon
447
- }) : null, " ", assistiveText), counter && maxLength && /*#__PURE__*/_react["default"].createElement("label", {
455
+ }) : null, ' ', assistiveText), counter && maxLength && /*#__PURE__*/_react["default"].createElement("label", {
448
456
  className: "".concat(classes.label, " ").concat(classes.right, " ").concat(classes.counter)
449
457
  }, value.length, " / ", maxLength)));
450
458
  }
@@ -576,7 +584,10 @@ TextField.propTypes = {
576
584
  pattern: _propTypes["default"].string,
577
585
 
578
586
  /** Size of the TextField. */
579
- searchField: _propTypes["default"].bool
587
+ searchField: _propTypes["default"].bool,
588
+
589
+ /** The testId property adds the data attribute data-testid to the main element and should be used for testing only. */
590
+ testId: _propTypes["default"].string
580
591
  };
581
592
  var _default = TextField;
582
593
  exports["default"] = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@occmundial/occ-atomic",
3
- "version": "1.21.3",
3
+ "version": "1.22.1",
4
4
  "description": "Collection of shareable styled React components for OCC applications.",
5
5
  "homepage": "http://occmundial.github.io/occ-atomic",
6
6
  "main": "build/index.js",