@occmundial/occ-atomic 1.27.0 → 1.29.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/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ # [1.29.0](https://github.com/occmundial/occ-atomic/compare/v1.28.0...v1.29.0) (2023-04-12)
2
+
3
+
4
+ ### Features
5
+
6
+ * Add testid to slidetoggle and add data value to radio component ([253690f](https://github.com/occmundial/occ-atomic/commit/253690f1e8bc9fc7a0a82a4430b9e74712be84ba))
7
+ * Update radio data value condition ([b501a24](https://github.com/occmundial/occ-atomic/commit/b501a2450cbb40cdb6ab6e13c637281c84ad7840))
8
+
9
+ # [1.28.0](https://github.com/occmundial/occ-atomic/compare/v1.27.0...v1.28.0) (2023-02-16)
10
+
11
+
12
+ ### Features
13
+
14
+ * Add missing index ([b506269](https://github.com/occmundial/occ-atomic/commit/b506269f8f86a9a4d2d8e65ba5443b178e7c3692))
15
+
1
16
  # [1.27.0](https://github.com/occmundial/occ-atomic/compare/v1.26.0...v1.27.0) (2023-02-16)
2
17
 
3
18
 
@@ -24,7 +24,7 @@ var Group = function Group(_ref) {
24
24
  return /*#__PURE__*/_react["default"].createElement("button", {
25
25
  key: item.id,
26
26
  id: idPrefix ? "".concat(idPrefix).concat(item.id) : null,
27
- "data-testid": testId ? "".concat(testId).concat(item.id) : null,
27
+ "data-testid": testId ? "".concat(testId).concat(index) : null,
28
28
  className: "".concat(classes.pill).concat(selected == item.id ? " ".concat(classes.selected) : item.disabled ? " ".concat(classes.disabled) : ''),
29
29
  onClick: selected != item.id ? function () {
30
30
  onSelect(item.id, index);
@@ -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); } }
@@ -89,16 +91,19 @@ var Radio = /*#__PURE__*/function (_React$Component) {
89
91
  return /*#__PURE__*/_react["default"].createElement("div", {
90
92
  id: id
91
93
  }, options.map(function (option) {
92
- return /*#__PURE__*/_react["default"].createElement("div", {
94
+ return /*#__PURE__*/_react["default"].createElement("div", _extends({
93
95
  id: option.trk,
94
- "data-testid": option.testId,
95
96
  key: option.value,
97
+ "data-testid": option.testId
98
+ }, option.testId && {
99
+ 'data-value': selected == option.value ? 1 : 0
100
+ }, {
96
101
  className: "".concat(classes.cont).concat(selected == option.value ? " ".concat(classes.active) : '').concat(option.disabled ? " ".concat(classes.disabled) : '').concat(className ? " ".concat(className) : ''),
97
102
  onClick: function onClick() {
98
103
  _this2.onChange(option);
99
104
  },
100
105
  style: style
101
- }, /*#__PURE__*/_react["default"].createElement("div", {
106
+ }), /*#__PURE__*/_react["default"].createElement("div", {
102
107
  className: classes.radio,
103
108
  id: option.trk
104
109
  }), option.label && /*#__PURE__*/_react["default"].createElement(_Text["default"], {
@@ -134,6 +139,9 @@ Radio.propTypes = {
134
139
  label: _propTypes["default"].string,
135
140
  right: _propTypes["default"].string,
136
141
  trk: _propTypes["default"].string,
142
+
143
+ /** The testId property adds the data attribute data-testid to
144
+ * the main element and should be used for testing only. */
137
145
  testId: _propTypes["default"].string
138
146
  })),
139
147
 
@@ -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); } }
@@ -89,17 +91,21 @@ var SlideToggle = /*#__PURE__*/function (_React$Component) {
89
91
  className = _this$props2.className,
90
92
  style = _this$props2.style,
91
93
  name = _this$props2.name,
92
- trk = _this$props2.trk;
94
+ trk = _this$props2.trk,
95
+ testId = _this$props2.testId;
93
96
  return /*#__PURE__*/_react["default"].createElement("div", {
94
97
  id: id,
95
98
  className: "".concat(classes.cont).concat(disabled ? " ".concat(classes.disabled) : '').concat(className ? " ".concat(className) : ''),
96
99
  style: style
97
- }, /*#__PURE__*/_react["default"].createElement("div", {
100
+ }, /*#__PURE__*/_react["default"].createElement("div", _extends({
98
101
  id: trk,
99
102
  name: name,
100
103
  className: "".concat(classes["switch"]).concat(value ? " ".concat(classes.checked) : ''),
101
- onClick: this.toggle
102
- }, /*#__PURE__*/_react["default"].createElement("span", {
104
+ onClick: this.toggle,
105
+ "data-testid": testId
106
+ }, testId && {
107
+ 'data-value': value ? 1 : 0
108
+ }), /*#__PURE__*/_react["default"].createElement("span", {
103
109
  className: classes.slider
104
110
  }, /*#__PURE__*/_react["default"].createElement("span", {
105
111
  className: classes.icon
@@ -135,7 +141,11 @@ SlideToggle.propTypes = {
135
141
  trk: _propTypes["default"].string,
136
142
  id: _propTypes["default"].string,
137
143
  className: _propTypes["default"].string,
138
- style: _propTypes["default"].object
144
+ style: _propTypes["default"].object,
145
+
146
+ /** The testId property adds the data attribute data-testid to
147
+ * the main element and should be used for testing only. */
148
+ testId: _propTypes["default"].string
139
149
  };
140
150
  var _default = SlideToggle;
141
151
  exports["default"] = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@occmundial/occ-atomic",
3
- "version": "1.27.0",
3
+ "version": "1.29.0",
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",