@zohodesk/components 1.2.11 → 1.2.12

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 (35) hide show
  1. package/.cli/propValidation_report.html +1 -1
  2. package/README.md +4 -0
  3. package/coverage/Button/Button.js.html +1 -1
  4. package/coverage/Button/css/Button.module.css.html +1 -1
  5. package/coverage/Button/css/cssJSLogic.js.html +1 -1
  6. package/coverage/Button/css/index.html +1 -1
  7. package/coverage/Button/index.html +1 -1
  8. package/coverage/Button/props/defaultProps.js.html +1 -1
  9. package/coverage/Button/props/index.html +1 -1
  10. package/coverage/Button/props/propTypes.js.html +1 -1
  11. package/coverage/Buttongroup/Buttongroup.js.html +1 -1
  12. package/coverage/Buttongroup/Buttongroup.module.css.html +1 -1
  13. package/coverage/Buttongroup/index.html +1 -1
  14. package/coverage/Buttongroup/props/defaultProps.js.html +1 -1
  15. package/coverage/Buttongroup/props/index.html +1 -1
  16. package/coverage/Buttongroup/props/propTypes.js.html +1 -1
  17. package/coverage/index.html +1 -1
  18. package/coverage/utils/dummyFunction.js.html +1 -1
  19. package/coverage/utils/index.html +1 -1
  20. package/es/v1/Card/index.js +4 -0
  21. package/es/v1/DropDown/DropDown.js +31 -52
  22. package/es/v1/DropDown/DropDownHeading.js +29 -37
  23. package/es/v1/DropDown/DropDownItem.js +38 -58
  24. package/es/v1/DropDown/DropDownSearch.js +41 -49
  25. package/es/v1/DropDown/DropDownSeparator.js +7 -10
  26. package/es/v1/Provider/CssProvider.js +1 -1
  27. package/lib/v1/Card/index.js +37 -0
  28. package/lib/v1/DropDown/DropDown.js +34 -130
  29. package/lib/v1/DropDown/DropDownHeading.js +29 -75
  30. package/lib/v1/DropDown/DropDownItem.js +50 -102
  31. package/lib/v1/DropDown/DropDownSearch.js +50 -89
  32. package/lib/v1/DropDown/DropDownSeparator.js +8 -48
  33. package/lib/v1/Provider/CssProvider.js +1 -1
  34. package/package.json +6 -6
  35. package/result.json +1 -1
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ Object.defineProperty(exports, "Card", {
9
+ enumerable: true,
10
+ get: function get() {
11
+ return _Card["default"];
12
+ }
13
+ });
14
+ Object.defineProperty(exports, "CardContent", {
15
+ enumerable: true,
16
+ get: function get() {
17
+ return _Card.CardContent;
18
+ }
19
+ });
20
+ Object.defineProperty(exports, "CardFooter", {
21
+ enumerable: true,
22
+ get: function get() {
23
+ return _Card.CardFooter;
24
+ }
25
+ });
26
+ Object.defineProperty(exports, "CardHeader", {
27
+ enumerable: true,
28
+ get: function get() {
29
+ return _Card.CardHeader;
30
+ }
31
+ });
32
+
33
+ var _Card = _interopRequireWildcard(require("./Card"));
34
+
35
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
36
+
37
+ 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; }
@@ -5,7 +5,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports["default"] = exports.DropDownTarget = exports.DropDownItemContainer = exports.DropDownContainer = void 0;
8
+ exports.DropDownContainer = DropDownContainer;
9
+ exports.DropDownItemContainer = DropDownItemContainer;
10
+ exports.DropDownTarget = DropDownTarget;
11
+ exports["default"] = DropDown;
9
12
 
10
13
  var _react = _interopRequireDefault(require("react"));
11
14
 
@@ -23,148 +26,49 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
23
26
 
24
27
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
25
28
 
26
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
27
-
28
- 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); } }
29
-
30
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
31
-
32
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
33
-
34
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
35
-
36
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
37
-
38
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
39
-
40
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
41
-
42
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
43
-
44
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
45
-
46
- var DropDown = /*#__PURE__*/function (_React$Component) {
47
- _inherits(DropDown, _React$Component);
48
-
49
- var _super = _createSuper(DropDown);
50
-
51
- function DropDown() {
52
- _classCallCheck(this, DropDown);
53
-
54
- return _super.apply(this, arguments);
55
- }
56
-
57
- _createClass(DropDown, [{
58
- key: "render",
59
- value: function render() {
60
- var children = this.props.children;
61
- return /*#__PURE__*/_react["default"].createElement(_PopOver["default"], this.props, /*#__PURE__*/_react["default"].createElement(_PopOver.PopOverTarget, null, children[0]), /*#__PURE__*/_react["default"].createElement(_PopOver.PopOverContainer, null, children[1]));
62
- }
63
- }]);
64
-
65
- return DropDown;
66
- }(_react["default"].Component);
29
+ function DropDown(props) {
30
+ var children = props.children;
31
+ return /*#__PURE__*/_react["default"].createElement(_PopOver["default"], props, /*#__PURE__*/_react["default"].createElement(_PopOver.PopOverTarget, null, children[0]), /*#__PURE__*/_react["default"].createElement(_PopOver.PopOverContainer, null, children[1]));
32
+ }
67
33
 
68
- exports["default"] = DropDown;
69
34
  DropDown.propTypes = _propTypes.DropDown_propTypes;
70
35
 
71
- var DropDownTarget = /*#__PURE__*/function (_React$Component2) {
72
- _inherits(DropDownTarget, _React$Component2);
73
-
74
- var _super2 = _createSuper(DropDownTarget);
75
-
76
- function DropDownTarget() {
77
- _classCallCheck(this, DropDownTarget);
78
-
79
- return _super2.apply(this, arguments);
80
- }
81
-
82
- _createClass(DropDownTarget, [{
83
- key: "render",
84
- value: function render() {
85
- var children = this.props.children;
86
- return /*#__PURE__*/_react["default"].createElement("div", null, children);
87
- }
88
- }]);
89
-
90
- return DropDownTarget;
91
- }(_react["default"].Component);
36
+ function DropDownTarget(props) {
37
+ var children = props.children;
38
+ return /*#__PURE__*/_react["default"].createElement("div", null, children);
39
+ }
92
40
 
93
- exports.DropDownTarget = DropDownTarget;
94
41
  DropDownTarget.propTypes = _propTypes.DropDownTarget_propTypes;
95
42
 
96
- var DropDownContainer = /*#__PURE__*/function (_React$Component3) {
97
- _inherits(DropDownContainer, _React$Component3);
98
-
99
- var _super3 = _createSuper(DropDownContainer);
100
-
101
- function DropDownContainer() {
102
- _classCallCheck(this, DropDownContainer);
43
+ function DropDownContainer(props) {
44
+ var children = props.children;
45
+ return /*#__PURE__*/_react["default"].createElement("div", null, " ", children, " ");
46
+ }
103
47
 
104
- return _super3.apply(this, arguments);
105
- }
106
-
107
- _createClass(DropDownContainer, [{
108
- key: "render",
109
- value: function render() {
110
- var children = this.props.children;
111
- return /*#__PURE__*/_react["default"].createElement("div", null, " ", children, " ");
112
- }
113
- }]);
114
-
115
- return DropDownContainer;
116
- }(_react["default"].Component);
117
-
118
- exports.DropDownContainer = DropDownContainer;
119
48
  DropDownContainer.propTypes = _propTypes.DropDownContainer_propTypes;
120
49
 
121
- var DropDownItemContainer = /*#__PURE__*/function (_React$Component4) {
122
- _inherits(DropDownItemContainer, _React$Component4);
50
+ function DropDownItemContainer(props) {
51
+ var children = props.children,
52
+ dataId = props.dataId,
53
+ getRef = props.getRef,
54
+ onScroll = props.onScroll;
123
55
 
124
- var _super4 = _createSuper(DropDownItemContainer);
125
-
126
- function DropDownItemContainer(props) {
127
- var _this;
128
-
129
- _classCallCheck(this, DropDownItemContainer);
56
+ function handleScroll(e) {
57
+ onScroll && onScroll(e);
58
+ }
130
59
 
131
- _this = _super4.call(this, props);
132
- _this.getRef = _this.getRef.bind(_assertThisInitialized(_this));
133
- _this.onScroll = _this.onScroll.bind(_assertThisInitialized(_this));
134
- return _this;
60
+ function getReference(ele) {
61
+ getRef && getRef(ele);
135
62
  }
136
63
 
137
- _createClass(DropDownItemContainer, [{
138
- key: "onScroll",
139
- value: function onScroll(e) {
140
- var onScroll = this.props.onScroll;
141
- onScroll && onScroll(e);
142
- }
143
- }, {
144
- key: "getRef",
145
- value: function getRef(ele) {
146
- var getRef = this.props.getRef;
147
- getRef && getRef(ele);
148
- }
149
- }, {
150
- key: "render",
151
- value: function render() {
152
- var _this$props = this.props,
153
- children = _this$props.children,
154
- dataId = _this$props.dataId;
155
- return /*#__PURE__*/_react["default"].createElement("div", {
156
- className: _DropDownModule["default"].listGroup,
157
- onScroll: this.onScroll,
158
- ref: this.getRef,
159
- "data-id": dataId,
160
- "data-test-id": dataId
161
- }, children);
162
- }
163
- }]);
164
-
165
- return DropDownItemContainer;
166
- }(_react["default"].Component);
64
+ return /*#__PURE__*/_react["default"].createElement("div", {
65
+ className: _DropDownModule["default"].listGroup,
66
+ onScroll: handleScroll,
67
+ ref: getReference,
68
+ "data-id": dataId,
69
+ "data-test-id": dataId
70
+ }, children);
71
+ }
167
72
 
168
- exports.DropDownItemContainer = DropDownItemContainer;
169
73
  DropDownItemContainer.propTypes = _propTypes.DropDownItemContainer_propTypes;
170
74
  DropDownItemContainer.defaultProps = _defaultProps.DropDownItemContainer_defaultProps;
@@ -1,11 +1,9 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
- exports["default"] = void 0;
6
+ exports["default"] = DropDownHeading;
9
7
 
10
8
  var _react = _interopRequireDefault(require("react"));
11
9
 
@@ -17,77 +15,33 @@ var _DropDownHeadingModule = _interopRequireDefault(require("../../DropDown/Drop
17
15
 
18
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
19
17
 
20
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
21
-
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); } }
23
-
24
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
25
-
26
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
27
-
28
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
29
-
30
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
31
-
32
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
33
-
34
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
35
-
36
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
18
+ function DropDownHeading(props) {
19
+ var text = props.text,
20
+ _props$title = props.title,
21
+ title = _props$title === void 0 ? text : _props$title,
22
+ children = props.children,
23
+ customClass = props.customClass,
24
+ palette = props.palette,
25
+ htmlId = props.htmlId,
26
+ a11y = props.a11y,
27
+ dataId = props.dataId,
28
+ dataSelectorId = props.dataSelectorId;
29
+ var role = a11y.role,
30
+ ariaLabelledby = a11y.ariaLabelledby,
31
+ ariaLabel = a11y.ariaLabel;
32
+ return /*#__PURE__*/_react["default"].createElement("div", {
33
+ className: "".concat(_DropDownHeadingModule["default"][palette], " ").concat(customClass),
34
+ "data-title": title,
35
+ role: role,
36
+ "aria-labelledby": ariaLabelledby,
37
+ "aria-label": ariaLabel,
38
+ id: htmlId,
39
+ "data-id": dataId,
40
+ "data-test-id": dataId,
41
+ "data-selector-id": dataSelectorId // tabindex='0'
42
+
43
+ }, text, children);
44
+ }
37
45
 
38
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
39
-
40
- var DropDownHeading = /*#__PURE__*/function (_React$Component) {
41
- _inherits(DropDownHeading, _React$Component);
42
-
43
- var _super = _createSuper(DropDownHeading);
44
-
45
- function DropDownHeading() {
46
- _classCallCheck(this, DropDownHeading);
47
-
48
- return _super.apply(this, arguments);
49
- }
50
-
51
- _createClass(DropDownHeading, [{
52
- key: "render",
53
- value: function render() {
54
- var _this$props = this.props,
55
- text = _this$props.text,
56
- _this$props$title = _this$props.title,
57
- title = _this$props$title === void 0 ? text : _this$props$title,
58
- children = _this$props.children,
59
- customClass = _this$props.customClass,
60
- palette = _this$props.palette,
61
- htmlId = _this$props.htmlId,
62
- a11y = _this$props.a11y,
63
- dataId = _this$props.dataId,
64
- dataSelectorId = _this$props.dataSelectorId;
65
- var role = a11y.role,
66
- ariaLabelledby = a11y.ariaLabelledby,
67
- ariaLabel = a11y.ariaLabel;
68
- return /*#__PURE__*/_react["default"].createElement("div", {
69
- className: "".concat(_DropDownHeadingModule["default"][palette], " ").concat(customClass),
70
- "data-title": title,
71
- role: role,
72
- "aria-labelledby": ariaLabelledby,
73
- "aria-label": ariaLabel,
74
- id: htmlId,
75
- "data-id": dataId,
76
- "data-test-id": dataId,
77
- "data-selector-id": dataSelectorId // tabindex='0'
78
-
79
- }, text, children);
80
- }
81
- }]);
82
-
83
- return DropDownHeading;
84
- }(_react["default"].Component);
85
-
86
- exports["default"] = DropDownHeading;
87
46
  DropDownHeading.propTypes = _propTypes.DropDownHeading_propTypes;
88
- DropDownHeading.defaultProps = _defaultProps.DropDownHeading_defaultProps; // if (__DOCS__) {
89
- // DropDownHeading.docs = {
90
- // componentGroup: 'Form Elements',
91
- // folderName: 'Style Guide'
92
- // };
93
- // }
47
+ DropDownHeading.defaultProps = _defaultProps.DropDownHeading_defaultProps;
@@ -5,9 +5,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports["default"] = void 0;
8
+ exports["default"] = DropDownItem;
9
9
 
10
- var _react = _interopRequireDefault(require("react"));
10
+ var _react = _interopRequireWildcard(require("react"));
11
11
 
12
12
  var _propTypes = require("../../DropDown/props/propTypes");
13
13
 
@@ -17,111 +17,59 @@ var _DropDownItemModule = _interopRequireDefault(require("../../DropDown/DropDow
17
17
 
18
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
19
19
 
20
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
21
-
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); } }
23
-
24
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
25
-
26
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
27
-
28
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
29
-
30
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
31
-
32
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
33
-
34
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
35
-
36
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
37
-
38
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
39
-
40
- var DropDownItem = /*#__PURE__*/function (_React$Component) {
41
- _inherits(DropDownItem, _React$Component);
42
-
43
- var _super = _createSuper(DropDownItem);
20
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
21
+
22
+ 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; }
23
+
24
+ function DropDownItem(props) {
25
+ var value = props.value,
26
+ active = props.active,
27
+ children = props.children,
28
+ hightlight = props.hightlight,
29
+ dataId = props.dataId,
30
+ _props$customClass = props.customClass,
31
+ customClass = _props$customClass === void 0 ? '' : _props$customClass,
32
+ index = props.index,
33
+ getRef = props.getRef,
34
+ onClick = props.onClick,
35
+ id = props.id,
36
+ onHover = props.onHover;
37
+ var eleRef = (0, _react.useRef)(null);
38
+
39
+ function getReference(ele) {
40
+ eleRef.current = ele;
41
+ getRef && getRef(ele, index);
42
+ }
44
43
 
45
- function DropDownItem(props) {
46
- var _this;
44
+ function getSelectedElement() {
45
+ return eleRef.current ? eleRef.current : null;
46
+ }
47
47
 
48
- _classCallCheck(this, DropDownItem);
48
+ function handleClick(e) {
49
+ onClick && onClick(id, value, index, e);
50
+ }
49
51
 
50
- _this = _super.call(this, props);
51
- _this.onClick = _this.onClick.bind(_assertThisInitialized(_this));
52
- _this.getRef = _this.getRef.bind(_assertThisInitialized(_this));
53
- _this.getSelectedElement = _this.getSelectedElement.bind(_assertThisInitialized(_this));
54
- _this.onHover = _this.onHover.bind(_assertThisInitialized(_this));
55
- return _this;
52
+ function handleHover(e) {
53
+ onHover && onHover(id, value, index, e);
56
54
  }
57
55
 
58
- _createClass(DropDownItem, [{
59
- key: "getRef",
60
- value: function getRef(ele) {
61
- this.ele = ele;
62
- var _this$props = this.props,
63
- index = _this$props.index,
64
- getRef = _this$props.getRef;
65
- getRef && getRef(ele, index);
66
- }
67
- }, {
68
- key: "getSelectedElement",
69
- value: function getSelectedElement() {
70
- return this.ele ? this.ele : null;
71
- }
72
- }, {
73
- key: "onClick",
74
- value: function onClick(e) {
75
- var _this$props2 = this.props,
76
- onClick = _this$props2.onClick,
77
- id = _this$props2.id,
78
- value = _this$props2.value,
79
- index = _this$props2.index;
80
- onClick && onClick(id, value, index, e);
81
- }
82
- }, {
83
- key: "onHover",
84
- value: function onHover(e) {
85
- var _this$props3 = this.props,
86
- onHover = _this$props3.onHover,
87
- id = _this$props3.id,
88
- value = _this$props3.value,
89
- index = _this$props3.index;
90
- onHover && onHover(id, value, index, e);
91
- }
92
- }, {
93
- key: "render",
94
- value: function render() {
95
- var _this$props4 = this.props,
96
- value = _this$props4.value,
97
- active = _this$props4.active,
98
- children = _this$props4.children,
99
- hightlight = _this$props4.hightlight,
100
- dataId = _this$props4.dataId,
101
- _this$props4$customCl = _this$props4.customClass,
102
- customClass = _this$props4$customCl === void 0 ? '' : _this$props4$customCl;
103
- return /*#__PURE__*/_react["default"].createElement("div", {
104
- className: "".concat(_DropDownItemModule["default"].list, " ").concat(customClass, " ").concat(active ? _DropDownItemModule["default"].listActive : hightlight ? _DropDownItemModule["default"].listHover : '', " ").concat(children && children[1] ? _DropDownItemModule["default"].padding : ''),
105
- onClick: this.onClick,
106
- onMouseOver: this.onHover,
107
- ref: this.getRef,
108
- "data-id": dataId,
109
- "data-test-id": dataId
110
- }, children && children[0] ? /*#__PURE__*/_react["default"].createElement("span", {
111
- className: _DropDownItemModule["default"].children
112
- }, " ", children[0], " ") : children !== undefined ? /*#__PURE__*/_react["default"].createElement("span", {
113
- className: _DropDownItemModule["default"].children
114
- }, " ", children, " ") : null, value ? /*#__PURE__*/_react["default"].createElement("span", {
115
- className: _DropDownItemModule["default"].value
116
- }, value) : '', children && children[1] ? /*#__PURE__*/_react["default"].createElement("span", {
117
- className: _DropDownItemModule["default"].user
118
- }, " ", children[1], " ") : '');
119
- }
120
- }]);
121
-
122
- return DropDownItem;
123
- }(_react["default"].Component);
56
+ return /*#__PURE__*/_react["default"].createElement("div", {
57
+ className: "".concat(_DropDownItemModule["default"].list, " ").concat(customClass, " ").concat(active ? _DropDownItemModule["default"].listActive : hightlight ? _DropDownItemModule["default"].listHover : '', " ").concat(children && children[1] ? _DropDownItemModule["default"].padding : ''),
58
+ onClick: handleClick,
59
+ onMouseOver: handleHover,
60
+ ref: getReference,
61
+ "data-id": dataId,
62
+ "data-test-id": dataId
63
+ }, children && children[0] ? /*#__PURE__*/_react["default"].createElement("span", {
64
+ className: _DropDownItemModule["default"].children
65
+ }, " ", children[0], " ") : children !== undefined ? /*#__PURE__*/_react["default"].createElement("span", {
66
+ className: _DropDownItemModule["default"].children
67
+ }, " ", children, " ") : null, value ? /*#__PURE__*/_react["default"].createElement("span", {
68
+ className: _DropDownItemModule["default"].value
69
+ }, value) : '', children && children[1] ? /*#__PURE__*/_react["default"].createElement("span", {
70
+ className: _DropDownItemModule["default"].user
71
+ }, " ", children[1], " ") : '');
72
+ }
124
73
 
125
- exports["default"] = DropDownItem;
126
74
  DropDownItem.propTypes = _propTypes.DropDownItem_propTypes;
127
75
  DropDownItem.defaultProps = _defaultProps.DropDownItem_defaultProps;