@zohodesk/components 1.2.4 → 1.2.6

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 (202) hide show
  1. package/README.md +8 -0
  2. package/coverage/Button/Button.js.html +1 -1
  3. package/coverage/Button/css/Button.module.css.html +1 -1
  4. package/coverage/Button/css/cssJSLogic.js.html +1 -1
  5. package/coverage/Button/css/index.html +1 -1
  6. package/coverage/Button/index.html +1 -1
  7. package/coverage/Button/props/defaultProps.js.html +1 -1
  8. package/coverage/Button/props/index.html +1 -1
  9. package/coverage/Button/props/propTypes.js.html +1 -1
  10. package/coverage/Buttongroup/Buttongroup.js.html +1 -1
  11. package/coverage/Buttongroup/Buttongroup.module.css.html +1 -1
  12. package/coverage/Buttongroup/index.html +1 -1
  13. package/coverage/Buttongroup/props/defaultProps.js.html +1 -1
  14. package/coverage/Buttongroup/props/index.html +1 -1
  15. package/coverage/Buttongroup/props/propTypes.js.html +1 -1
  16. package/coverage/index.html +1 -1
  17. package/coverage/utils/dummyFunction.js.html +1 -1
  18. package/coverage/utils/index.html +1 -1
  19. package/es/AppContainer/AppContainer.js +3 -0
  20. package/es/v1/Accordion/Accordion.js +65 -0
  21. package/es/v1/Accordion/AccordionItem.js +57 -0
  22. package/es/v1/Accordion/index.js +2 -0
  23. package/es/v1/Animation/Animation.js +127 -0
  24. package/es/v1/AppContainer/AppContainer.js +137 -0
  25. package/es/v1/Avatar/Avatar.js +189 -0
  26. package/es/v1/AvatarTeam/AvatarTeam.js +70 -0
  27. package/es/v1/Button/Button.js +68 -0
  28. package/es/v1/Buttongroup/Buttongroup.js +31 -0
  29. package/es/v1/Card/Card.js +271 -0
  30. package/es/v1/CheckBox/CheckBox.js +155 -0
  31. package/es/v1/DateTime/CalendarView.js +218 -0
  32. package/es/v1/DateTime/DateTime.js +783 -0
  33. package/es/v1/DateTime/DateTimePopupFooter.js +47 -0
  34. package/es/v1/DateTime/DateTimePopupHeader.js +105 -0
  35. package/es/v1/DateTime/DateWidget.js +1098 -0
  36. package/es/v1/DateTime/DaysRow.js +31 -0
  37. package/es/v1/DateTime/Time.js +166 -0
  38. package/es/v1/DateTime/YearView.js +264 -0
  39. package/es/v1/DateTime/index.js +1 -0
  40. package/es/v1/DropBox/DropBox.js +91 -0
  41. package/es/v1/DropBox/DropBoxElement/DropBoxElement.js +132 -0
  42. package/es/v1/DropDown/DropDown.js +73 -0
  43. package/es/v1/DropDown/DropDownHeading.js +44 -0
  44. package/es/v1/DropDown/DropDownItem.js +76 -0
  45. package/es/v1/DropDown/DropDownSearch.js +63 -0
  46. package/es/v1/DropDown/DropDownSeparator.js +15 -0
  47. package/es/v1/Heading/Heading.js +32 -0
  48. package/es/v1/Label/Label.js +40 -0
  49. package/es/v1/Layout/Box.js +115 -0
  50. package/es/v1/Layout/Container.js +132 -0
  51. package/es/v1/Layout/index.js +2 -0
  52. package/es/v1/ListItem/ListContainer.js +102 -0
  53. package/es/v1/ListItem/ListItem.js +124 -0
  54. package/es/v1/ListItem/ListItemWithAvatar.js +145 -0
  55. package/es/v1/ListItem/ListItemWithCheckBox.js +104 -0
  56. package/es/v1/ListItem/ListItemWithIcon.js +127 -0
  57. package/es/v1/ListItem/ListItemWithRadio.js +105 -0
  58. package/es/v1/ListItem/index.js +6 -0
  59. package/es/v1/Modal/Modal.js +154 -0
  60. package/es/v1/MultiSelect/AdvancedGroupMultiSelect.js +1079 -0
  61. package/es/v1/MultiSelect/AdvancedMultiSelect.js +568 -0
  62. package/es/v1/MultiSelect/EmptyState.js +64 -0
  63. package/es/v1/MultiSelect/MobileHeader/MobileHeader.js +50 -0
  64. package/es/v1/MultiSelect/MultiSelect.js +1120 -0
  65. package/es/v1/MultiSelect/MultiSelectHeader.js +32 -0
  66. package/es/v1/MultiSelect/MultiSelectWithAvatar.js +216 -0
  67. package/es/v1/MultiSelect/SelectedOptions.js +82 -0
  68. package/es/v1/MultiSelect/Suggestions.js +142 -0
  69. package/es/v1/MultiSelect/index.js +4 -0
  70. package/es/v1/PopOver/PopOver.js +211 -0
  71. package/es/v1/Popup/Popup.js +645 -0
  72. package/es/v1/Radio/Radio.js +115 -0
  73. package/es/v1/Responsive/CustomResponsive.js +195 -0
  74. package/es/v1/Responsive/RefWrapper.js +39 -0
  75. package/es/v1/Responsive/ResizeComponent.js +197 -0
  76. package/es/v1/Responsive/ResizeObserver.js +140 -0
  77. package/es/v1/Responsive/Responsive.js +194 -0
  78. package/es/v1/Responsive/index.js +9 -0
  79. package/es/v1/ResponsiveDropBox/ResponsiveDropBox.js +58 -0
  80. package/es/v1/Ribbon/Ribbon.js +33 -0
  81. package/es/v1/RippleEffect/RippleEffect.js +24 -0
  82. package/es/v1/Select/GroupSelect.js +803 -0
  83. package/es/v1/Select/Select.js +969 -0
  84. package/es/v1/Select/SelectWithAvatar.js +344 -0
  85. package/es/v1/Select/SelectWithIcon.js +535 -0
  86. package/es/v1/Select/index.js +4 -0
  87. package/es/v1/Stencils/Stencils.js +26 -0
  88. package/es/v1/Switch/Switch.js +94 -0
  89. package/es/v1/Tab/Tab.js +108 -0
  90. package/es/v1/Tab/TabContent.js +30 -0
  91. package/es/v1/Tab/TabContentWrapper.js +29 -0
  92. package/es/v1/Tab/TabWrapper.js +57 -0
  93. package/es/v1/Tab/Tabs.js +612 -0
  94. package/es/v1/Tab/index.js +5 -0
  95. package/es/v1/Tag/Tag.js +134 -0
  96. package/es/v1/TextBox/TextBox.js +154 -0
  97. package/es/v1/TextBoxIcon/TextBoxIcon.js +158 -0
  98. package/es/v1/Textarea/Textarea.js +102 -0
  99. package/es/v1/Tooltip/Tooltip.js +518 -0
  100. package/es/v1/Typography/Typography.js +38 -0
  101. package/es/v1/Typography/css/Typography.module.css +376 -0
  102. package/es/v1/Typography/css/cssJSLogic.js +46 -0
  103. package/es/v1/Typography/css/letterSpacingMap.js +12 -0
  104. package/es/v1/Typography/props/defaultProps.js +8 -0
  105. package/es/v1/Typography/props/propTypes.js +24 -0
  106. package/es/v1/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +69 -0
  107. package/es/v1/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +100 -0
  108. package/es/v1/semantic/Button/Button.js +53 -0
  109. package/es/v1/semantic/index.js +1 -0
  110. package/lib/AppContainer/AppContainer.js +5 -0
  111. package/lib/v1/Accordion/Accordion.js +96 -0
  112. package/lib/v1/Accordion/AccordionItem.js +68 -0
  113. package/lib/v1/Accordion/index.js +23 -0
  114. package/lib/v1/Animation/Animation.js +143 -0
  115. package/lib/v1/AppContainer/AppContainer.js +209 -0
  116. package/lib/v1/Avatar/Avatar.js +246 -0
  117. package/lib/v1/AvatarTeam/AvatarTeam.js +81 -0
  118. package/lib/v1/Button/Button.js +82 -0
  119. package/lib/v1/Buttongroup/Buttongroup.js +44 -0
  120. package/lib/v1/Card/Card.js +365 -0
  121. package/lib/v1/CheckBox/CheckBox.js +166 -0
  122. package/lib/v1/DateTime/CalendarView.js +285 -0
  123. package/lib/v1/DateTime/DateTime.js +872 -0
  124. package/lib/v1/DateTime/DateTimePopupFooter.js +96 -0
  125. package/lib/v1/DateTime/DateTimePopupHeader.js +166 -0
  126. package/lib/v1/DateTime/DateWidget.js +1125 -0
  127. package/lib/v1/DateTime/DaysRow.js +80 -0
  128. package/lib/v1/DateTime/Time.js +254 -0
  129. package/lib/v1/DateTime/YearView.js +325 -0
  130. package/lib/v1/DateTime/index.js +15 -0
  131. package/lib/v1/DropBox/DropBox.js +119 -0
  132. package/lib/v1/DropBox/DropBoxElement/DropBoxElement.js +145 -0
  133. package/lib/v1/DropDown/DropDown.js +170 -0
  134. package/lib/v1/DropDown/DropDownHeading.js +93 -0
  135. package/lib/v1/DropDown/DropDownItem.js +127 -0
  136. package/lib/v1/DropDown/DropDownSearch.js +113 -0
  137. package/lib/v1/DropDown/DropDownSeparator.js +64 -0
  138. package/lib/v1/Heading/Heading.js +49 -0
  139. package/lib/v1/Label/Label.js +51 -0
  140. package/lib/v1/Layout/Box.js +128 -0
  141. package/lib/v1/Layout/Container.js +145 -0
  142. package/lib/v1/Layout/index.js +23 -0
  143. package/lib/v1/ListItem/ListContainer.js +120 -0
  144. package/lib/v1/ListItem/ListItem.js +138 -0
  145. package/lib/v1/ListItem/ListItemWithAvatar.js +162 -0
  146. package/lib/v1/ListItem/ListItemWithCheckBox.js +125 -0
  147. package/lib/v1/ListItem/ListItemWithIcon.js +143 -0
  148. package/lib/v1/ListItem/ListItemWithRadio.js +126 -0
  149. package/lib/v1/ListItem/index.js +55 -0
  150. package/lib/v1/Modal/Modal.js +212 -0
  151. package/lib/v1/MultiSelect/AdvancedGroupMultiSelect.js +1167 -0
  152. package/lib/v1/MultiSelect/AdvancedMultiSelect.js +634 -0
  153. package/lib/v1/MultiSelect/EmptyState.js +112 -0
  154. package/lib/v1/MultiSelect/MobileHeader/MobileHeader.js +62 -0
  155. package/lib/v1/MultiSelect/MultiSelect.js +1201 -0
  156. package/lib/v1/MultiSelect/MultiSelectHeader.js +78 -0
  157. package/lib/v1/MultiSelect/MultiSelectWithAvatar.js +270 -0
  158. package/lib/v1/MultiSelect/SelectedOptions.js +126 -0
  159. package/lib/v1/MultiSelect/Suggestions.js +195 -0
  160. package/lib/v1/MultiSelect/index.js +39 -0
  161. package/lib/v1/PopOver/PopOver.js +293 -0
  162. package/lib/v1/Popup/Popup.js +715 -0
  163. package/lib/v1/Radio/Radio.js +126 -0
  164. package/lib/v1/Responsive/CustomResponsive.js +242 -0
  165. package/lib/v1/Responsive/RefWrapper.js +57 -0
  166. package/lib/v1/Responsive/ResizeComponent.js +268 -0
  167. package/lib/v1/Responsive/ResizeObserver.js +168 -0
  168. package/lib/v1/Responsive/Responsive.js +274 -0
  169. package/lib/v1/Responsive/index.js +55 -0
  170. package/lib/v1/ResponsiveDropBox/ResponsiveDropBox.js +79 -0
  171. package/lib/v1/Ribbon/Ribbon.js +44 -0
  172. package/lib/v1/RippleEffect/RippleEffect.js +39 -0
  173. package/lib/v1/Select/GroupSelect.js +877 -0
  174. package/lib/v1/Select/Select.js +1013 -0
  175. package/lib/v1/Select/SelectWithAvatar.js +394 -0
  176. package/lib/v1/Select/SelectWithIcon.js +597 -0
  177. package/lib/v1/Select/index.js +39 -0
  178. package/lib/v1/Stencils/Stencils.js +43 -0
  179. package/lib/v1/Switch/Switch.js +108 -0
  180. package/lib/v1/Tab/Tab.js +132 -0
  181. package/lib/v1/Tab/TabContent.js +42 -0
  182. package/lib/v1/Tab/TabContentWrapper.js +42 -0
  183. package/lib/v1/Tab/TabWrapper.js +89 -0
  184. package/lib/v1/Tab/Tabs.js +680 -0
  185. package/lib/v1/Tab/index.js +47 -0
  186. package/lib/v1/Tag/Tag.js +154 -0
  187. package/lib/v1/TextBox/TextBox.js +168 -0
  188. package/lib/v1/TextBoxIcon/TextBoxIcon.js +196 -0
  189. package/lib/v1/Textarea/Textarea.js +118 -0
  190. package/lib/v1/Tooltip/Tooltip.js +586 -0
  191. package/lib/v1/Typography/Typography.js +56 -0
  192. package/lib/v1/Typography/css/Typography.module.css +376 -0
  193. package/lib/v1/Typography/css/cssJSLogic.js +41 -0
  194. package/lib/v1/Typography/css/letterSpacingMap.js +20 -0
  195. package/lib/v1/Typography/props/defaultProps.js +15 -0
  196. package/lib/v1/Typography/props/propTypes.js +35 -0
  197. package/lib/v1/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +90 -0
  198. package/lib/v1/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +126 -0
  199. package/lib/v1/semantic/Button/Button.js +63 -0
  200. package/lib/v1/semantic/index.js +15 -0
  201. package/package.json +1 -1
  202. package/result.json +1 -1
@@ -0,0 +1,597 @@
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
+ exports["default"] = void 0;
9
+
10
+ var _react = _interopRequireWildcard(require("react"));
11
+
12
+ var _defaultProps = require("../../Select/props/defaultProps");
13
+
14
+ var _propTypes = require("../../Select/props/propTypes");
15
+
16
+ var _Popup = _interopRequireDefault(require("../Popup/Popup"));
17
+
18
+ var _TextBoxIcon = _interopRequireDefault(require("../TextBoxIcon/TextBoxIcon"));
19
+
20
+ var _icons = require("@zohodesk/icons");
21
+
22
+ var _ListItemWithIcon = _interopRequireDefault(require("../ListItem/ListItemWithIcon"));
23
+
24
+ var _Card = _interopRequireWildcard(require("../Card/Card"));
25
+
26
+ var _EmptyState = _interopRequireDefault(require("../MultiSelect/EmptyState"));
27
+
28
+ var _Layout = require("../Layout");
29
+
30
+ var _IdProvider = require("../../Provider/IdProvider");
31
+
32
+ var _ResponsiveDropBox = _interopRequireDefault(require("../ResponsiveDropBox/ResponsiveDropBox"));
33
+
34
+ var _CustomResponsive = require("../Responsive/CustomResponsive");
35
+
36
+ var _Loader = _interopRequireDefault(require("@zohodesk/svg/lib/Loader/Loader"));
37
+
38
+ var _Common = require("../../utils/Common.js");
39
+
40
+ var _SelectModule = _interopRequireDefault(require("../../Select/Select.module.css"));
41
+
42
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
43
+
44
+ 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); }
45
+
46
+ 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; }
47
+
48
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
49
+
50
+ 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); } }
51
+
52
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
53
+
54
+ 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); }
55
+
56
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
57
+
58
+ 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); }; }
59
+
60
+ 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); }
61
+
62
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
63
+
64
+ 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; } }
65
+
66
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
67
+
68
+ var SelectWithIcon = /*#__PURE__*/function (_Component) {
69
+ _inherits(SelectWithIcon, _Component);
70
+
71
+ var _super = _createSuper(SelectWithIcon);
72
+
73
+ function SelectWithIcon(props) {
74
+ var _this;
75
+
76
+ _classCallCheck(this, SelectWithIcon);
77
+
78
+ _this = _super.call(this, props);
79
+ _this.state = {
80
+ searchValue: '',
81
+ selectedIndex: 0,
82
+ options: props.options,
83
+ isFetchingOptions: false
84
+ };
85
+ _this._isMounted = false;
86
+ _this.onSearchClear = _this.onSearchClear.bind(_assertThisInitialized(_this));
87
+ _this.onSearch = _this.onSearch.bind(_assertThisInitialized(_this));
88
+ _this.togglePopup = _this.togglePopup.bind(_assertThisInitialized(_this));
89
+ _this.handleChange = _this.handleChange.bind(_assertThisInitialized(_this));
90
+ _this.handleKeyDown = _this.handleKeyDown.bind(_assertThisInitialized(_this));
91
+ _this.handleMouseEnter = _this.handleMouseEnter.bind(_assertThisInitialized(_this));
92
+ _this.scrollContentRef = _this.scrollContentRef.bind(_assertThisInitialized(_this));
93
+ _this.itemRef = _this.itemRef.bind(_assertThisInitialized(_this));
94
+ _this.searchInputRef = _this.searchInputRef.bind(_assertThisInitialized(_this));
95
+ _this.inputRef = _this.inputRef.bind(_assertThisInitialized(_this));
96
+ _this.handleScroll = _this.handleScroll.bind(_assertThisInitialized(_this));
97
+ _this.getNextAriaId = (0, _IdProvider.getUniqueId)(_assertThisInitialized(_this));
98
+ _this.handleGetNextOptions = _this.handleGetNextOptions.bind(_assertThisInitialized(_this));
99
+ _this.handleFetchOptions = _this.handleFetchOptions.bind(_assertThisInitialized(_this));
100
+ return _this;
101
+ }
102
+
103
+ _createClass(SelectWithIcon, [{
104
+ key: "componentDidMount",
105
+ value: function componentDidMount() {
106
+ this._isMounted = true;
107
+ }
108
+ }, {
109
+ key: "componentWillUnmount",
110
+ value: function componentWillUnmount() {
111
+ this._isMounted = false;
112
+ }
113
+ }, {
114
+ key: "inputRef",
115
+ value: function inputRef(el) {
116
+ this.input = el;
117
+ }
118
+ }, {
119
+ key: "itemRef",
120
+ value: function itemRef(ele, index, id) {
121
+ this["suggestion_".concat(id)] = ele;
122
+ }
123
+ }, {
124
+ key: "searchInputRef",
125
+ value: function searchInputRef(el) {
126
+ this.searchInput = el;
127
+ }
128
+ }, {
129
+ key: "scrollContentRef",
130
+ value: function scrollContentRef(el) {
131
+ var isPopupOpen = this.props.isPopupOpen;
132
+
133
+ if (isPopupOpen) {
134
+ this.optionsContainer = el;
135
+ }
136
+ }
137
+ }, {
138
+ key: "handleMouseEnter",
139
+ value: function handleMouseEnter(id, value, index, e) {
140
+ this.setState({
141
+ selectedIndex: index
142
+ });
143
+ }
144
+ }, {
145
+ key: "handleKeyDown",
146
+ value: function handleKeyDown(e) {
147
+ var _this2 = this;
148
+
149
+ var keyCode = e.keyCode;
150
+ var _this$state = this.state,
151
+ selectedIndex = _this$state.selectedIndex,
152
+ options = _this$state.options;
153
+ var _this$props = this.props,
154
+ idKey = _this$props.idKey,
155
+ valueKey = _this$props.valueKey,
156
+ isPopupOpen = _this$props.isPopupOpen,
157
+ selectedId = _this$props.selectedId;
158
+
159
+ if (isPopupOpen && (keyCode === 38 || keyCode === 40) && e.preventDefault) {
160
+ e.preventDefault(); //prevent body scroll
161
+ } else if (!isPopupOpen && (keyCode === 40 || keyCode === 13)) {
162
+ e.preventDefault(); //prevent body scroll
163
+
164
+ this.togglePopup(e);
165
+ options.map(function (list, index) {
166
+ if (list.id === selectedId) {
167
+ _this2.setState({
168
+ selectedIndex: index
169
+ });
170
+ }
171
+ });
172
+ }
173
+
174
+ if (isPopupOpen) {
175
+ switch (keyCode) {
176
+ case 40:
177
+ if (selectedIndex === options.length - 1) {
178
+ this.setState({
179
+ selectedIndex: 0
180
+ });
181
+ } else {
182
+ if (selectedIndex === options.length - 3) {
183
+ this.handleGetNextOptions();
184
+ }
185
+
186
+ this.setState({
187
+ selectedIndex: selectedIndex + 1
188
+ });
189
+ }
190
+
191
+ break;
192
+
193
+ case 38:
194
+ if (selectedIndex === 0) {
195
+ this.setState({
196
+ selectedIndex: options.length - 1
197
+ });
198
+ } else {
199
+ this.setState({
200
+ selectedIndex: selectedIndex - 1
201
+ });
202
+ }
203
+
204
+ break;
205
+
206
+ case 13:
207
+ {
208
+ var option = options[selectedIndex];
209
+ this.handleChange && this.handleChange(option[idKey], option[valueKey], selectedIndex, e);
210
+ break;
211
+ }
212
+ }
213
+ }
214
+ }
215
+ }, {
216
+ key: "componentDidUpdate",
217
+ value: function componentDidUpdate(prevProps) {
218
+ var _this3 = this;
219
+
220
+ var _this$props2 = this.props,
221
+ idKey = _this$props2.idKey,
222
+ isPopupOpen = _this$props2.isPopupOpen,
223
+ needSearch = _this$props2.needSearch;
224
+ var _this$state2 = this.state,
225
+ selectedIndex = _this$state2.selectedIndex,
226
+ options = _this$state2.options;
227
+
228
+ if (prevProps.isPopupOpen != isPopupOpen) {
229
+ setTimeout(function () {
230
+ isPopupOpen ? needSearch ? _this3.searchInput.focus({
231
+ preventScroll: true
232
+ }) : _this3.input.focus({
233
+ preventScroll: true
234
+ }) : _this3.input.focus({
235
+ preventScroll: true
236
+ });
237
+ }, 10);
238
+ }
239
+
240
+ var option = options[selectedIndex];
241
+ var id = option && option[idKey] || {};
242
+ var selSuggestion = this["suggestion_".concat(id)];
243
+
244
+ if (isPopupOpen) {
245
+ this.optionsContainer && (0, _Common.scrollTo)(this.optionsContainer, selSuggestion);
246
+ }
247
+ }
248
+ }, {
249
+ key: "searchList",
250
+ value: function searchList(searchValue) {
251
+ var datas = [];
252
+ var _this$props3 = this.props,
253
+ options = _this$props3.options,
254
+ valueKey = _this$props3.valueKey;
255
+
256
+ if (options.length) {
257
+ datas = options.filter(function (obj) {
258
+ return obj[valueKey].toLowerCase().includes(searchValue.toLowerCase());
259
+ });
260
+ }
261
+
262
+ return datas;
263
+ }
264
+ }, {
265
+ key: "onSearchClear",
266
+ value: function onSearchClear() {
267
+ var options = this.searchList(''); // this.searchInput.focus({preventScroll:false});
268
+
269
+ this.setState({
270
+ searchValue: '',
271
+ options: options
272
+ });
273
+ }
274
+ }, {
275
+ key: "onSearch",
276
+ value: function onSearch(searchValue) {
277
+ var options = this.searchList(searchValue);
278
+ this.setState({
279
+ searchValue: searchValue,
280
+ selectedIndex: -1,
281
+ options: options
282
+ });
283
+ }
284
+ }, {
285
+ key: "togglePopup",
286
+ value: function togglePopup(e) {
287
+ var _this$props4 = this.props,
288
+ togglePopup = _this$props4.togglePopup,
289
+ isReadOnly = _this$props4.isReadOnly,
290
+ boxPosition = _this$props4.boxPosition;
291
+ !isReadOnly && togglePopup(e, boxPosition);
292
+ }
293
+ }, {
294
+ key: "handleChange",
295
+ value: function handleChange(id, value, index, e) {
296
+ var _this$props5 = this.props,
297
+ onChange = _this$props5.onChange,
298
+ isReadOnly = _this$props5.isReadOnly;
299
+ !isReadOnly && onChange && onChange(id, value, index, e);
300
+ this.togglePopup(e);
301
+ }
302
+ }, {
303
+ key: "handleScroll",
304
+ value: function handleScroll(e) {
305
+ var ele = e.target;
306
+ var isScrollReachedBottom = (0, _Common.findScrollEnd)(ele);
307
+ isScrollReachedBottom && this.handleGetNextOptions();
308
+ }
309
+ }, {
310
+ key: "UNSAFE_componentWillReceiveProps",
311
+ value: function UNSAFE_componentWillReceiveProps(nextProps) {
312
+ if (nextProps.options.length != this.props.options.length) {
313
+ this.setState({
314
+ options: nextProps.options
315
+ });
316
+ }
317
+ }
318
+ }, {
319
+ key: "handleGetNextOptions",
320
+ value: function handleGetNextOptions() {
321
+ var _this$props6 = this.props,
322
+ isNextOptions = _this$props6.isNextOptions,
323
+ getNextOptions = _this$props6.getNextOptions;
324
+ var searchValue = this.state.searchValue;
325
+ isNextOptions && getNextOptions && this.handleFetchOptions(getNextOptions, searchValue);
326
+ }
327
+ }, {
328
+ key: "handleFetchOptions",
329
+ value: function handleFetchOptions(APICall) {
330
+ var _this4 = this;
331
+
332
+ var searchValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
333
+ var _this$state$isFetchin = this.state.isFetchingOptions,
334
+ isFetchingOptions = _this$state$isFetchin === void 0 ? false : _this$state$isFetchin;
335
+ var _isMounted = this._isMounted;
336
+
337
+ if (!isFetchingOptions && APICall) {
338
+ this.setState({
339
+ isFetchingOptions: true
340
+ });
341
+
342
+ try {
343
+ return APICall(searchValue).then(function () {
344
+ _isMounted && _this4.setState({
345
+ isFetchingOptions: false
346
+ });
347
+ }, function () {
348
+ _isMounted && _this4.setState({
349
+ isFetchingOptions: false
350
+ });
351
+ });
352
+ } catch (e) {
353
+ _isMounted && this.setState({
354
+ isFetchingOptions: false
355
+ });
356
+ }
357
+ }
358
+ }
359
+ }, {
360
+ key: "responsiveFunc",
361
+ value: function responsiveFunc(_ref) {
362
+ var mediaQueryOR = _ref.mediaQueryOR;
363
+ return {
364
+ tabletMode: mediaQueryOR([{
365
+ maxWidth: 700
366
+ }])
367
+ };
368
+ }
369
+ }, {
370
+ key: "render",
371
+ value: function render() {
372
+ var _this5 = this;
373
+
374
+ var _this$props7 = this.props,
375
+ animationStyle = _this$props7.animationStyle,
376
+ removeClose = _this$props7.removeClose,
377
+ selectedValue = _this$props7.selectedValue,
378
+ searchBoxPlaceHolder = _this$props7.searchBoxPlaceHolder,
379
+ needSearch = _this$props7.needSearch,
380
+ searchEmptyMessage = _this$props7.searchEmptyMessage,
381
+ dataId = _this$props7.dataId,
382
+ maxLength = _this$props7.maxLength,
383
+ isDisabled = _this$props7.isDisabled,
384
+ isReadOnly = _this$props7.isReadOnly,
385
+ placeHolder = _this$props7.placeHolder,
386
+ textBoxSize = _this$props7.textBoxSize,
387
+ textBoxVariant = _this$props7.textBoxVariant,
388
+ selectedId = _this$props7.selectedId,
389
+ isPopupOpen = _this$props7.isPopupOpen,
390
+ isPopupReady = _this$props7.isPopupReady,
391
+ position = _this$props7.position,
392
+ getContainerRef = _this$props7.getContainerRef,
393
+ valueKey = _this$props7.valueKey,
394
+ idKey = _this$props7.idKey,
395
+ needListBorder = _this$props7.needListBorder,
396
+ needTick = _this$props7.needTick,
397
+ size = _this$props7.size,
398
+ borderColor = _this$props7.borderColor,
399
+ title = _this$props7.title,
400
+ className = _this$props7.className,
401
+ needBorder = _this$props7.needBorder,
402
+ searchBoxSize = _this$props7.searchBoxSize,
403
+ getTargetRef = _this$props7.getTargetRef,
404
+ needResponsive = _this$props7.needResponsive,
405
+ boxSize = _this$props7.boxSize,
406
+ dropBoxSize = _this$props7.dropBoxSize,
407
+ emptyMessage = _this$props7.emptyMessage,
408
+ needIcon = _this$props7.needIcon,
409
+ iconName = _this$props7.iconName,
410
+ iconSize = _this$props7.iconSize,
411
+ iconClass = _this$props7.iconClass,
412
+ i18nKeys = _this$props7.i18nKeys,
413
+ htmlId = _this$props7.htmlId,
414
+ isLoading = _this$props7.isLoading,
415
+ dataSelectorId = _this$props7.dataSelectorId;
416
+ i18nKeys = Object.assign({}, i18nKeys, {
417
+ emptyText: i18nKeys.emptyText || emptyMessage,
418
+ searchEmptyText: i18nKeys.searchEmptyText || searchEmptyMessage
419
+ });
420
+ var _this$state3 = this.state,
421
+ searchValue = _this$state3.searchValue,
422
+ selectedIndex = _this$state3.selectedIndex,
423
+ options = _this$state3.options,
424
+ isFetchingOptions = _this$state3.isFetchingOptions;
425
+ var setAriaId = this.getNextAriaId();
426
+ var ariaErrorId = this.getNextAriaId();
427
+ return /*#__PURE__*/_react["default"].createElement("div", {
428
+ className: "".concat(_SelectModule["default"].container, " ").concat(_SelectModule["default"]["box_".concat(size)], " ").concat(isReadOnly ? _SelectModule["default"].readonly : '', " ").concat(borderColor === 'transparent' ? _SelectModule["default"].transparentContainer : ''),
429
+ "data-title": isDisabled ? title : null,
430
+ "data-selector-id": dataSelectorId
431
+ }, /*#__PURE__*/_react["default"].createElement("div", {
432
+ className: "".concat(className ? className : ''),
433
+ onClick: isDisabled || isReadOnly ? null : this.togglePopup,
434
+ ref: getTargetRef,
435
+ "data-id": "".concat(isDisabled ? "".concat(dataId, "_disabled") : isReadOnly ? "".concat(dataId, "_readOnly") : dataId),
436
+ "data-test-id": "".concat(isDisabled ? "".concat(dataId, "_disabled") : isReadOnly ? "".concat(dataId, "_readOnly") : dataId)
437
+ }, /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
438
+ alignBox: "row"
439
+ }, needIcon ? /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
440
+ align: "both",
441
+ className: "".concat(_SelectModule["default"].leftIcon, " ").concat(isDisabled ? _SelectModule["default"].disable : '')
442
+ }, /*#__PURE__*/_react["default"].createElement(_icons.Icon, {
443
+ name: iconName,
444
+ size: iconSize,
445
+ iconClass: iconClass
446
+ })) : null, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
447
+ flexible: true
448
+ }, /*#__PURE__*/_react["default"].createElement(_TextBoxIcon["default"], {
449
+ a11y: {
450
+ role: 'combobox',
451
+ ariaLabel: 'click to select options',
452
+ ariaControls: setAriaId,
453
+ ariaExpanded: !isReadOnly && !isDisabled && isPopupOpen ? true : false,
454
+ ariaHaspopup: true,
455
+ ariaReadonly: true,
456
+ ariaActivedescendant: selectedId,
457
+ ariaOwns: setAriaId
458
+ },
459
+ htmlId: htmlId,
460
+ value: selectedValue,
461
+ isReadOnly: true,
462
+ needReadOnlyStyle: isReadOnly ? true : false,
463
+ dataId: "".concat(dataId, "_textBox"),
464
+ maxLength: maxLength,
465
+ needBorder: needBorder,
466
+ isDisabled: isDisabled,
467
+ placeHolder: placeHolder,
468
+ size: textBoxSize,
469
+ variant: textBoxVariant,
470
+ iconRotated: isPopupOpen,
471
+ inputRef: this.inputRef,
472
+ onKeyDown: this.handleKeyDown,
473
+ isClickable: isReadOnly || isDisabled ? false : true,
474
+ customClass: {
475
+ customTBoxWrap: "".concat(isReadOnly || isDisabled ? '' : _SelectModule["default"].input, " ").concat(needIcon ? _SelectModule["default"].iconSelect : '')
476
+ },
477
+ needEffect: isReadOnly || isDisabled ? false : true,
478
+ borderColor: borderColor,
479
+ autoComplete: false,
480
+ isFocus: isPopupReady
481
+ }, /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
482
+ align: "both",
483
+ dataId: "".concat(dataId, "_downIcon")
484
+ }, /*#__PURE__*/_react["default"].createElement(_icons.Icon, {
485
+ name: "ZD-down",
486
+ size: "7"
487
+ })))))), !isReadOnly && !isDisabled && isPopupOpen ? /*#__PURE__*/_react["default"].createElement(_CustomResponsive.ResponsiveReceiver, {
488
+ query: this.responsiveFunc,
489
+ responsiveId: "Helmet"
490
+ }, function (_ref2) {
491
+ var tabletMode = _ref2.tabletMode;
492
+ return /*#__PURE__*/_react["default"].createElement(_ResponsiveDropBox["default"], {
493
+ animationStyle: animationStyle,
494
+ boxPosition: position,
495
+ isActive: isPopupReady,
496
+ isAnimate: true,
497
+ isArrow: false,
498
+ onClick: removeClose,
499
+ getRef: getContainerRef,
500
+ needResponsive: needResponsive,
501
+ dataId: "".concat(dataId, "_suggestions"),
502
+ size: boxSize,
503
+ isPadding: false,
504
+ isResponsivePadding: true,
505
+ alignBox: "row"
506
+ }, isLoading ? /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
507
+ align: "both",
508
+ className: _SelectModule["default"].loader
509
+ }, /*#__PURE__*/_react["default"].createElement(_Loader["default"], null)) : /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
510
+ flexible: true
511
+ }, /*#__PURE__*/_react["default"].createElement(_Card["default"], {
512
+ onScroll: _this5.handleScroll,
513
+ htmlId: setAriaId,
514
+ a11y: {
515
+ role: 'listbox'
516
+ }
517
+ }, needSearch ? /*#__PURE__*/_react["default"].createElement(_Card.CardHeader, null, /*#__PURE__*/_react["default"].createElement("div", {
518
+ className: "".concat(_SelectModule["default"].search, " ").concat(_SelectModule["default"][size])
519
+ }, /*#__PURE__*/_react["default"].createElement(_TextBoxIcon["default"], {
520
+ onClear: _this5.onSearchClear,
521
+ onChange: _this5.onSearch,
522
+ placeHolder: searchBoxPlaceHolder,
523
+ value: searchValue,
524
+ maxLength: maxLength,
525
+ onKeyDown: _this5.handleKeyDown,
526
+ inputRef: _this5.searchInputRef,
527
+ size: searchBoxSize,
528
+ dataId: "".concat(dataId, "_search"),
529
+ a11y: {
530
+ ariaDescribedby: ariaErrorId
531
+ },
532
+ autoComplete: false
533
+ }))) : null, /*#__PURE__*/_react["default"].createElement(_Card.CardContent, {
534
+ customClass: "".concat(tabletMode ? _SelectModule["default"].responsivedropBoxList : _SelectModule["default"].dropBoxList, " ").concat(!tabletMode && dropBoxSize ? _SelectModule["default"][dropBoxSize] : ''),
535
+ shrink: true,
536
+ eleRef: _this5.scrollContentRef
537
+ }, options.length ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, options.map(function (options, i) {
538
+ var iconName = options.iconName,
539
+ iconSize = options.iconSize,
540
+ iconColor = options.iconColor;
541
+ return /*#__PURE__*/_react["default"].createElement(_ListItemWithIcon["default"], {
542
+ key: options[idKey],
543
+ value: options[valueKey],
544
+ size: "medium",
545
+ onClick: _this5.handleChange,
546
+ id: options[idKey],
547
+ index: i,
548
+ title: options[valueKey],
549
+ palette: "default",
550
+ dataId: options[idKey],
551
+ iconName: iconName,
552
+ iconSize: iconSize,
553
+ iconClass: iconColor,
554
+ active: selectedId === options[idKey],
555
+ needBorder: needListBorder,
556
+ needTick: needTick,
557
+ onMouseEnter: _this5.handleMouseEnter,
558
+ highlight: selectedIndex === i,
559
+ getRef: _this5.itemRef,
560
+ a11y: {
561
+ role: 'option',
562
+ ariaSelected: selectedId === options[idKey],
563
+ ariaLabel: options[valueKey]
564
+ }
565
+ });
566
+ })) : /*#__PURE__*/_react["default"].createElement(_EmptyState["default"], {
567
+ isLoading: isFetchingOptions,
568
+ options: options,
569
+ searchString: searchValue,
570
+ suggestions: options,
571
+ dataId: dataId,
572
+ i18nKeys: i18nKeys,
573
+ htmlId: ariaErrorId
574
+ }), isFetchingOptions && /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
575
+ isCover: false,
576
+ align: "both"
577
+ }, /*#__PURE__*/_react["default"].createElement(_Loader["default"], null))))));
578
+ }) : null);
579
+ }
580
+ }]);
581
+
582
+ return SelectWithIcon;
583
+ }(_react.Component);
584
+
585
+ SelectWithIcon.propTypes = _propTypes.SelectWithIcon_propTypes;
586
+ SelectWithIcon.defaultProps = _defaultProps.SelectWithIcon_defaultProps;
587
+ var SelectWithIconComponent = (0, _Popup["default"])(SelectWithIcon);
588
+ SelectWithIconComponent.defaultProps = SelectWithIcon.defaultProps;
589
+ SelectWithIconComponent.propTypes = SelectWithIcon.propTypes; // if (__DOCS__) {
590
+ // SelectWithIcon.docs = {
591
+ // componentGroup: 'Form Elements',
592
+ // folderName: 'Style Guide'
593
+ // };
594
+ // }
595
+
596
+ var _default = SelectWithIconComponent;
597
+ exports["default"] = _default;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "GroupSelect", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _GroupSelect["default"];
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "Select", {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _Select["default"];
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "SelectWithAvatar", {
19
+ enumerable: true,
20
+ get: function get() {
21
+ return _SelectWithAvatar["default"];
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "SelectWithIcon", {
25
+ enumerable: true,
26
+ get: function get() {
27
+ return _SelectWithIcon["default"];
28
+ }
29
+ });
30
+
31
+ var _Select = _interopRequireDefault(require("./Select"));
32
+
33
+ var _GroupSelect = _interopRequireDefault(require("./GroupSelect"));
34
+
35
+ var _SelectWithAvatar = _interopRequireDefault(require("./SelectWithAvatar"));
36
+
37
+ var _SelectWithIcon = _interopRequireDefault(require("./SelectWithIcon"));
38
+
39
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
@@ -0,0 +1,43 @@
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
+ exports["default"] = void 0;
9
+
10
+ var _react = _interopRequireWildcard(require("react"));
11
+
12
+ var _defaultProps = require("../../Stencils/props/defaultProps");
13
+
14
+ var _propTypes = require("../../Stencils/props/propTypes");
15
+
16
+ var _StencilsModule = _interopRequireDefault(require("../../Stencils/Stencils.module.css"));
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
19
+
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 Stencils(props) {
25
+ var shape = props.shape,
26
+ size = props.size,
27
+ palette = props.palette,
28
+ customClass = props.customClass;
29
+ size = shape === 'rect' ? _StencilsModule["default"][size] : _StencilsModule["default"]["c".concat(size)];
30
+ shape = shape === 'rect' ? _StencilsModule["default"].rectangular : _StencilsModule["default"].circle;
31
+ return /*#__PURE__*/_react["default"].createElement("div", {
32
+ className: "".concat(_StencilsModule["default"].container, " ").concat(shape, " ").concat(size, " ").concat(_StencilsModule["default"][palette], " ").concat(customClass)
33
+ });
34
+ }
35
+
36
+ Stencils.propTypes = _propTypes.propTypes;
37
+ Stencils.defaultProps = _defaultProps.defaultProps;
38
+ var MemoizedStencils = /*#__PURE__*/(0, _react.memo)(Stencils);
39
+ MemoizedStencils.propTypes = _propTypes.propTypes;
40
+ MemoizedStencils.defaultProps = _defaultProps.defaultProps;
41
+ MemoizedStencils.displayName = 'Stencils';
42
+ var _default = MemoizedStencils;
43
+ exports["default"] = _default;