tenjin-ui-kit 0.3.69 → 0.3.70

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 (121) hide show
  1. package/build/asset-manifest.json +8 -8
  2. package/build/index.html +1 -1
  3. package/build/static/css/main.522396f6.css +2 -0
  4. package/build/static/css/main.522396f6.css.map +1 -0
  5. package/build/static/js/787.18cf14d0.chunk.js +2 -0
  6. package/build/static/js/787.18cf14d0.chunk.js.map +1 -0
  7. package/build/static/js/main.d71fecac.js +3 -0
  8. package/build/static/js/{main.8abb72fa.js.LICENSE.txt → main.d71fecac.js.LICENSE.txt} +1 -12
  9. package/build/static/js/main.d71fecac.js.map +1 -0
  10. package/dist/common/hooks/apiHooks.js +182 -114
  11. package/dist/common/hooks/newApiHook.js +225 -143
  12. package/dist/common/utils/security/index.js +2 -2
  13. package/dist/common/utils/security/securityConfig.js +2 -1
  14. package/dist/components/Canvas.js +88 -164
  15. package/dist/components/DragBox/index.js +26 -21
  16. package/dist/components/InputWithChip/index.js +57 -164
  17. package/dist/components/RightContext/index.js +28 -19
  18. package/dist/components/WorkFlow.js +23 -18
  19. package/dist/components/WorkFlowBuilder.js +48 -33
  20. package/dist/components/alert/Style.js +14 -11
  21. package/dist/components/alert/index.js +12 -10
  22. package/dist/components/attachment/index.js +28 -21
  23. package/dist/components/authenticationProvider/AuthError.js +4 -3
  24. package/dist/components/authenticationProvider/AuthLoader.js +4 -3
  25. package/dist/components/authenticationProvider/index.js +116 -60
  26. package/dist/components/avatar/index.js +14 -13
  27. package/dist/components/avatar/styles.js +77 -74
  28. package/dist/components/breadCrumbs/index.js +53 -42
  29. package/dist/components/breadCrumbs/style.js +4 -1
  30. package/dist/components/browsingTestCaseLayout/DetailsViewLayout/DetailsViewContent/index.js +6 -5
  31. package/dist/components/browsingTestCaseLayout/DetailsViewLayout/DetailsViewContent/style.js +8 -5
  32. package/dist/components/browsingTestCaseLayout/DetailsViewLayout/DetailsViewHeader/index.js +5 -4
  33. package/dist/components/browsingTestCaseLayout/TreeViewLayout/TreeViewContent/Index.js +5 -4
  34. package/dist/components/browsingTestCaseLayout/TreeViewLayout/TreeViewHeader/Index.js +6 -5
  35. package/dist/components/browsingTestCaseLayout/TreeViewLayout/TreeViewHeader/style.js +19 -16
  36. package/dist/components/browsingTestCaseLayout/index.js +30 -25
  37. package/dist/components/button/index.js +43 -36
  38. package/dist/components/chatBotModal/index.js +45 -36
  39. package/dist/components/checkBox/index.js +9 -8
  40. package/dist/components/combobox/index.js +72 -51
  41. package/dist/components/divider/index.js +18 -14
  42. package/dist/components/editableField/index.js +28 -19
  43. package/dist/components/error/index.js +12 -6
  44. package/dist/components/errorBoundary/index.js +94 -74
  45. package/dist/components/fileUploader/index.js +35 -30
  46. package/dist/components/fileUploader/style.js +49 -46
  47. package/dist/components/filter/ValueSelector.js +207 -135
  48. package/dist/components/filter/index.js +33 -26
  49. package/dist/components/iconButton/index.js +4 -3
  50. package/dist/components/input/index.js +38 -31
  51. package/dist/components/layout/index.js +31 -27
  52. package/dist/components/layout/main/index.js +13 -10
  53. package/dist/components/layout/main/style.js +14 -11
  54. package/dist/components/layout/pageContent/index.js +7 -6
  55. package/dist/components/layout/sidebar/FlatMenu.js +43 -43
  56. package/dist/components/layout/sidebar/GroupedIconMenu.js +108 -95
  57. package/dist/components/layout/sidebar/GroupedMenu.js +48 -38
  58. package/dist/components/layout/sidebar/ProjectMenu.js +116 -109
  59. package/dist/components/layout/sidebar/index.js +18 -15
  60. package/dist/components/layout/sidebar/style.js +143 -138
  61. package/dist/components/layout/topBar/ProjectTopbar.js +98 -81
  62. package/dist/components/layout/topBar/UserAvatar.js +55 -48
  63. package/dist/components/layout/topBar/index.js +33 -22
  64. package/dist/components/loader/index.js +12 -9
  65. package/dist/components/menu/index.js +35 -26
  66. package/dist/components/modal/Modal.js +6 -5
  67. package/dist/components/modal/index.js +13 -10
  68. package/dist/components/modal/style.js +56 -53
  69. package/dist/components/optionMenu/index.js +41 -34
  70. package/dist/components/pagination/index.js +39 -24
  71. package/dist/components/pagination/style.js +28 -25
  72. package/dist/components/paginationUpdated/index.js +16 -14
  73. package/dist/components/paper/index.js +16 -15
  74. package/dist/components/paper/style.js +27 -24
  75. package/dist/components/reactSelect/index.js +63 -46
  76. package/dist/components/reactSelect/style.js +150 -117
  77. package/dist/components/richTextEditor/index.js +44 -25
  78. package/dist/components/select/GroupedSelect.js +61 -45
  79. package/dist/components/select/SimpleSelect.js +78 -50
  80. package/dist/components/select/index.js +54 -38
  81. package/dist/components/simpleSelect/index.js +15 -12
  82. package/dist/components/sort/index.js +22 -19
  83. package/dist/components/switch/index.js +11 -10
  84. package/dist/components/switch/style.js +32 -29
  85. package/dist/components/switch/switch.js +23 -17
  86. package/dist/components/table/ReactTable.js +71 -54
  87. package/dist/components/table/SimpleTable.js +78 -59
  88. package/dist/components/table/index.js +186 -311
  89. package/dist/components/text/index.js +17 -15
  90. package/dist/components/timeStamp/index.js +6 -4
  91. package/dist/components/timeStamp/style.js +15 -12
  92. package/dist/components/topBar/index.js +92 -85
  93. package/dist/components/tree/index.js +47 -29
  94. package/dist/components/tree/style.js +23 -20
  95. package/dist/components/valuePicker/ValueSelector.js +138 -70
  96. package/dist/components/valuePicker/index.js +26 -19
  97. package/dist/components/wrapperLayout/layout/index.js +5 -4
  98. package/dist/components/wrapperLayout/main/index.js +5 -4
  99. package/dist/components/wrapperLayout/main/pageContainer/index.js +5 -4
  100. package/dist/components/wrapperLayout/main/sideBar/index.js +110 -120
  101. package/dist/components/wrapperLayout/main/sideBar/style.js +183 -177
  102. package/dist/components/wrapperLayout/topBar/UserAvatar.js +5 -4
  103. package/dist/components/wrapperLayout/topBar/avatar.js +12 -10
  104. package/dist/components/wrapperLayout/topBar/index.js +97 -111
  105. package/dist/components/wrapperLayout/topBar/menuIcon.js +5 -4
  106. package/dist/components/wrapperLayout/topBar/style.js +64 -61
  107. package/dist/http/index.js +183 -90
  108. package/dist/index.js +55 -53
  109. package/dist/templates/listPage/index.js +57 -36
  110. package/dist/themes/default.js +7 -5
  111. package/dist/themes/defaultSmall.js +3 -2
  112. package/dist/themes/responsiveTheme.js +8 -6
  113. package/package.json +3 -5
  114. package/build/static/css/main.e7366529.css +0 -2
  115. package/build/static/css/main.e7366529.css.map +0 -1
  116. package/build/static/js/453.900c81c3.chunk.js +0 -2
  117. package/build/static/js/453.900c81c3.chunk.js.map +0 -1
  118. package/build/static/js/main.8abb72fa.js +0 -3
  119. package/build/static/js/main.8abb72fa.js.map +0 -1
  120. package/dist/README.md +0 -13
  121. package/dist/package.json +0 -127
@@ -1,28 +1,30 @@
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); }
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports.default = void 0;
7
8
  var _react = _interopRequireWildcard(require("react"));
8
9
  var _rte = require("@mantine/rte");
9
- const _excluded = ["controls", "readOnly"];
10
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
11
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
12
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
13
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
14
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
15
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
16
- function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
17
- function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
18
- const RichTextEditorTest = _ref => {
19
- let _ref$controls = _ref.controls,
10
+ var _excluded = ["controls", "readOnly"];
11
+ 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); }
12
+ 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; }
13
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
14
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
15
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
16
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
17
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
18
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
19
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
20
+ var RichTextEditorTest = function RichTextEditorTest(_ref) {
21
+ var _ref$controls = _ref.controls,
20
22
  controls = _ref$controls === void 0 ? {} : _ref$controls,
21
23
  _ref$readOnly = _ref.readOnly,
22
24
  readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly,
23
25
  props = _objectWithoutProperties(_ref, _excluded);
24
26
  // By default everything is enabled
25
- const defaultControls = {
27
+ var defaultControls = {
26
28
  bold: true,
27
29
  italic: true,
28
30
  underline: true,
@@ -37,22 +39,38 @@ const RichTextEditorTest = _ref => {
37
39
  alignCenter: true,
38
40
  alignRight: true
39
41
  };
40
- const editorControls = (0, _react.useMemo)(() => {
42
+ var editorControls = (0, _react.useMemo)(function () {
41
43
  if (readOnly) {
42
44
  return [];
43
45
  }
44
- const finalControls = _objectSpread(_objectSpread({}, defaultControls), controls);
45
- return [["bold", "italic", "underline"].filter(c => finalControls[c]), ["link", "image"].filter(c => finalControls[c]), ["unorderedList", "orderedList"].filter(c => finalControls[c]), ["h1", "h2", "h3"].filter(c => finalControls[c]), ["alignLeft", "alignCenter", "alignRight"].filter(c => finalControls[c])].filter(group => group.length > 0);
46
+ var finalControls = _objectSpread(_objectSpread({}, defaultControls), controls);
47
+ return [["bold", "italic", "underline"].filter(function (c) {
48
+ return finalControls[c];
49
+ }), ["link", "image"].filter(function (c) {
50
+ return finalControls[c];
51
+ }), ["unorderedList", "orderedList"].filter(function (c) {
52
+ return finalControls[c];
53
+ }), ["h1", "h2", "h3"].filter(function (c) {
54
+ return finalControls[c];
55
+ }), ["alignLeft", "alignCenter", "alignRight"].filter(function (c) {
56
+ return finalControls[c];
57
+ })].filter(function (group) {
58
+ return group.length > 0;
59
+ });
46
60
  }, [controls, readOnly]);
47
- const mentions = (0, _react.useMemo)(() => ({
48
- allowedChars: /^[A-Za-z\sÅÄÖåäö]*$/,
49
- mentionDenotationChars: ["@"],
50
- source: (searchTerm, renderList, mentionChar) => {
51
- const list = mentionChar === "@" ? props.data : "";
52
- const includesSearchTerm = list.filter(item => item.value.toLowerCase().includes(searchTerm && searchTerm.toLowerCase()));
53
- renderList(includesSearchTerm);
54
- }
55
- }), [props.data]);
61
+ var mentions = (0, _react.useMemo)(function () {
62
+ return {
63
+ allowedChars: /^[A-Za-z\sÅÄÖåäö]*$/,
64
+ mentionDenotationChars: ["@"],
65
+ source: function source(searchTerm, renderList, mentionChar) {
66
+ var list = mentionChar === "@" ? props.data : "";
67
+ var includesSearchTerm = list.filter(function (item) {
68
+ return item.value.toLowerCase().includes(searchTerm && searchTerm.toLowerCase());
69
+ });
70
+ renderList(includesSearchTerm);
71
+ }
72
+ };
73
+ }, [props.data]);
56
74
  return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_rte.RichTextEditor, {
57
75
  controls: editorControls,
58
76
  value: props.value,
@@ -61,4 +79,5 @@ const RichTextEditorTest = _ref => {
61
79
  readOnly: readOnly
62
80
  }));
63
81
  };
64
- var _default = exports.default = RichTextEditorTest;
82
+ var _default = RichTextEditorTest;
83
+ exports.default = _default;
@@ -1,5 +1,6 @@
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); }
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
@@ -9,66 +10,69 @@ var _FormControl = _interopRequireDefault(require("@mui/material/FormControl"));
9
10
  var _fa = require("react-icons/fa");
10
11
  var _reactDom = require("react-dom");
11
12
  var _text = _interopRequireDefault(require("../text"));
12
- const _excluded = ["options", "onChange", "value", "defaultValue", "fullWidth"];
13
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
15
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
16
- function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
13
+ var _excluded = ["options", "onChange", "value", "defaultValue", "fullWidth"];
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+ 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); }
16
+ 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; }
17
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
18
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
17
19
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
18
- function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
19
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
20
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
21
- function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
22
- function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
23
- function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
24
- const GroupedSelect = _ref => {
20
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
21
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
22
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
23
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
24
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
25
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
26
+ var GroupedSelect = function GroupedSelect(_ref) {
25
27
  var _options$find, _Object$entries;
26
- let options = _ref.options,
28
+ var options = _ref.options,
27
29
  onChange = _ref.onChange,
28
30
  propValue = _ref.value,
29
31
  defaultValue = _ref.defaultValue,
30
32
  fullWidth = _ref.fullWidth,
31
33
  rest = _objectWithoutProperties(_ref, _excluded);
32
- const triggerRef = React.useRef(null);
33
- const _React$useState = React.useState(""),
34
+ var triggerRef = React.useRef(null);
35
+ var _React$useState = React.useState(""),
34
36
  _React$useState2 = _slicedToArray(_React$useState, 2),
35
37
  searchTerm = _React$useState2[0],
36
38
  setSearchTerm = _React$useState2[1];
37
- const _React$useState3 = React.useState(false),
39
+ var _React$useState3 = React.useState(false),
38
40
  _React$useState4 = _slicedToArray(_React$useState3, 2),
39
41
  isDropdownOpen = _React$useState4[0],
40
42
  setIsDropdownOpen = _React$useState4[1];
41
- const _React$useState5 = React.useState(propValue || defaultValue),
43
+ var _React$useState5 = React.useState(propValue || defaultValue),
42
44
  _React$useState6 = _slicedToArray(_React$useState5, 2),
43
45
  value = _React$useState6[0],
44
46
  setValue = _React$useState6[1];
45
- const _React$useState7 = React.useState(null),
47
+ var _React$useState7 = React.useState(null),
46
48
  _React$useState8 = _slicedToArray(_React$useState7, 2),
47
49
  hoveredOption = _React$useState8[0],
48
50
  setHoveredOption = _React$useState8[1];
49
- const groupOptionsByPageTitle = options => {
50
- const grouped = {};
51
- options.forEach(option => {
51
+ var groupOptionsByPageTitle = function groupOptionsByPageTitle(options) {
52
+ var grouped = {};
53
+ options.forEach(function (option) {
52
54
  var _grouped$option$pageT;
53
55
  if (!grouped[option === null || option === void 0 ? void 0 : option.pageTitle]) {
54
56
  grouped[option === null || option === void 0 ? void 0 : option.pageTitle] = [];
55
57
  }
56
- (_grouped$option$pageT = grouped[option === null || option === void 0 ? void 0 : option.pageTitle]) === null || _grouped$option$pageT === void 0 || _grouped$option$pageT.push(option);
58
+ (_grouped$option$pageT = grouped[option === null || option === void 0 ? void 0 : option.pageTitle]) === null || _grouped$option$pageT === void 0 ? void 0 : _grouped$option$pageT.push(option);
57
59
  });
58
60
  return grouped;
59
61
  };
60
- const handleSearchChange = event => {
62
+ var handleSearchChange = function handleSearchChange(event) {
61
63
  setSearchTerm(event.target.value);
62
64
  };
63
- const filteredOptions = options.filter(option => {
65
+ var filteredOptions = options.filter(function (option) {
64
66
  var _option$label, _option$pageTitle;
65
- return (option === null || option === void 0 || (_option$label = option.label) === null || _option$label === void 0 ? void 0 : _option$label.includes(searchTerm)) || (option === null || option === void 0 || (_option$pageTitle = option.pageTitle) === null || _option$pageTitle === void 0 ? void 0 : _option$pageTitle.includes(searchTerm));
67
+ return (option === null || option === void 0 ? void 0 : (_option$label = option.label) === null || _option$label === void 0 ? void 0 : _option$label.includes(searchTerm)) || (option === null || option === void 0 ? void 0 : (_option$pageTitle = option.pageTitle) === null || _option$pageTitle === void 0 ? void 0 : _option$pageTitle.includes(searchTerm));
66
68
  });
67
- const groupedOptions = groupOptionsByPageTitle(filteredOptions);
68
- const toggleDropdown = () => {
69
- setIsDropdownOpen(prev => !prev);
69
+ var groupedOptions = groupOptionsByPageTitle(filteredOptions);
70
+ var toggleDropdown = function toggleDropdown() {
71
+ setIsDropdownOpen(function (prev) {
72
+ return !prev;
73
+ });
70
74
  };
71
- const handleOptionClick = selectedValue => {
75
+ var handleOptionClick = function handleOptionClick(selectedValue) {
72
76
  setValue(selectedValue);
73
77
  setIsDropdownOpen(false);
74
78
  onChange({
@@ -77,7 +81,7 @@ const GroupedSelect = _ref => {
77
81
  }
78
82
  });
79
83
  };
80
- const handleCloseDropdown = () => {
84
+ var handleCloseDropdown = function handleCloseDropdown() {
81
85
  setIsDropdownOpen(false);
82
86
  };
83
87
  return /*#__PURE__*/React.createElement(_FormControl.default, _extends({
@@ -105,7 +109,9 @@ const GroupedSelect = _ref => {
105
109
  style: {
106
110
  flexGrow: 1
107
111
  }
108
- }, value ? options === null || options === void 0 || (_options$find = options.find(opt => (opt === null || opt === void 0 ? void 0 : opt.id) === value)) === null || _options$find === void 0 ? void 0 : _options$find.label : "Select Option"), /*#__PURE__*/React.createElement("div", null, isDropdownOpen ? /*#__PURE__*/React.createElement(_fa.FaCaretUp, null) : /*#__PURE__*/React.createElement(_fa.FaCaretDown, null)))), isDropdownOpen && /*#__PURE__*/(0, _reactDom.createPortal)(/*#__PURE__*/React.createElement("div", {
112
+ }, value ? options === null || options === void 0 ? void 0 : (_options$find = options.find(function (opt) {
113
+ return (opt === null || opt === void 0 ? void 0 : opt.id) === value;
114
+ })) === null || _options$find === void 0 ? void 0 : _options$find.label : "Select Option"), /*#__PURE__*/React.createElement("div", null, isDropdownOpen ? /*#__PURE__*/React.createElement(_fa.FaCaretUp, null) : /*#__PURE__*/React.createElement(_fa.FaCaretDown, null)))), isDropdownOpen && /*#__PURE__*/(0, _reactDom.createPortal)( /*#__PURE__*/React.createElement("div", {
109
115
  style: {
110
116
  position: "absolute",
111
117
  top: "".concat(triggerRef.current.getBoundingClientRect().bottom + 8, "px"),
@@ -139,8 +145,8 @@ const GroupedSelect = _ref => {
139
145
  border: "1px solid #949494",
140
146
  borderRadius: "4px"
141
147
  }
142
- }), (_Object$entries = Object.entries(groupedOptions)) === null || _Object$entries === void 0 ? void 0 : _Object$entries.map(_ref2 => {
143
- let _ref3 = _slicedToArray(_ref2, 2),
148
+ }), (_Object$entries = Object.entries(groupedOptions)) === null || _Object$entries === void 0 ? void 0 : _Object$entries.map(function (_ref2) {
149
+ var _ref3 = _slicedToArray(_ref2, 2),
144
150
  pageTitle = _ref3[0],
145
151
  options = _ref3[1];
146
152
  return /*#__PURE__*/React.createElement("div", {
@@ -150,18 +156,28 @@ const GroupedSelect = _ref => {
150
156
  padding: "5px 10px"
151
157
  // backgroundColor: "#f5f5f5",
152
158
  },
159
+
153
160
  semibold: true
154
- }, pageTitle !== null && pageTitle !== void 0 ? pageTitle : "N/A"), options.map(option => /*#__PURE__*/React.createElement("div", {
155
- key: option === null || option === void 0 ? void 0 : option.id,
156
- onClick: () => handleOptionClick(option.id),
157
- onMouseEnter: () => setHoveredOption(option.id),
158
- onMouseLeave: () => setHoveredOption(null),
159
- style: {
160
- padding: "8px 24px",
161
- cursor: "pointer",
162
- backgroundColor: value === (option === null || option === void 0 ? void 0 : option.id) ? "#f0f0f7" : hoveredOption === (option === null || option === void 0 ? void 0 : option.id) ? "#f5f5f5" : "transparent"
163
- }
164
- }, option.label)));
161
+ }, pageTitle !== null && pageTitle !== void 0 ? pageTitle : "N/A"), options.map(function (option) {
162
+ return /*#__PURE__*/React.createElement("div", {
163
+ key: option === null || option === void 0 ? void 0 : option.id,
164
+ onClick: function onClick() {
165
+ return handleOptionClick(option.id);
166
+ },
167
+ onMouseEnter: function onMouseEnter() {
168
+ return setHoveredOption(option.id);
169
+ },
170
+ onMouseLeave: function onMouseLeave() {
171
+ return setHoveredOption(null);
172
+ },
173
+ style: {
174
+ padding: "8px 24px",
175
+ cursor: "pointer",
176
+ backgroundColor: value === (option === null || option === void 0 ? void 0 : option.id) ? "#f0f0f7" : hoveredOption === (option === null || option === void 0 ? void 0 : option.id) ? "#f5f5f5" : "transparent"
177
+ }
178
+ }, option.label);
179
+ }));
165
180
  }))), document.body));
166
181
  };
167
- var _default = exports.default = GroupedSelect;
182
+ var _default = GroupedSelect;
183
+ exports.default = _default;
@@ -7,20 +7,24 @@ exports.default = void 0;
7
7
  var _material = require("@mui/material");
8
8
  var _react = _interopRequireWildcard(require("react"));
9
9
  var _text = _interopRequireDefault(require("../text"));
10
- const _excluded = ["options", "errorMessage", "error", "fullWidth", "isDisabled", "label", "isRequired", "helperText", "isSearch", "isClearOption", "loading", "isSort", "placeholder"];
11
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
13
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
14
- function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
10
+ var _excluded = ["options", "errorMessage", "error", "fullWidth", "isDisabled", "label", "isRequired", "helperText", "isSearch", "isClearOption", "loading", "isSort", "placeholder"];
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+ 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); }
13
+ 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; }
14
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
15
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
16
+ 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); }
17
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
15
18
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
16
- function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
17
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
18
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
19
- function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
20
- function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
21
- function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
22
- const SimpleSelect = _ref => {
23
- let options = _ref.options,
19
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
20
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
21
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
22
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
23
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
24
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
25
+ var SimpleSelect = function SimpleSelect(_ref) {
26
+ var _isSort, _isSearch, _isClearOption;
27
+ var options = _ref.options,
24
28
  errorMessage = _ref.errorMessage,
25
29
  error = _ref.error,
26
30
  fullWidth = _ref.fullWidth,
@@ -34,38 +38,44 @@ const SimpleSelect = _ref => {
34
38
  isSort = _ref.isSort,
35
39
  placeholder = _ref.placeholder,
36
40
  rest = _objectWithoutProperties(_ref, _excluded);
37
- isSort = isSort !== null && isSort !== void 0 ? isSort : true; //by default true
38
- isSearch = isSearch !== null && isSearch !== void 0 ? isSearch : true; //by default true
39
- isClearOption = isClearOption !== null && isClearOption !== void 0 ? isClearOption : true; //by default true
41
+ isSort = (_isSort = isSort) !== null && _isSort !== void 0 ? _isSort : true; //by default true
42
+ isSearch = (_isSearch = isSearch) !== null && _isSearch !== void 0 ? _isSearch : true; //by default true
43
+ isClearOption = (_isClearOption = isClearOption) !== null && _isClearOption !== void 0 ? _isClearOption : true; //by default true
40
44
 
41
- const _useState = (0, _react.useState)(""),
45
+ var _useState = (0, _react.useState)(""),
42
46
  _useState2 = _slicedToArray(_useState, 2),
43
47
  searchText = _useState2[0],
44
48
  setSearchText = _useState2[1];
45
- const _useState3 = (0, _react.useState)(false),
49
+ var _useState3 = (0, _react.useState)(false),
46
50
  _useState4 = _slicedToArray(_useState3, 2),
47
51
  noDataAvailable = _useState4[0],
48
52
  setNoDataAvailable = _useState4[1];
49
- const validateChildren = (type, searchText) => {
50
- if (typeof type !== "object") {
53
+ var validateChildren = function validateChildren(type, searchText) {
54
+ if (_typeof(type) !== "object") {
51
55
  return typeof type === "string" && type.toLowerCase().indexOf(searchText.toLowerCase()) > -1;
52
56
  }
53
- if (typeof type.props === "object" && Array.isArray(type.props.children)) {
54
- return type.props.children.some(data => validateChildren(data, searchText));
57
+ if (_typeof(type.props) === "object" && Array.isArray(type.props.children)) {
58
+ return type.props.children.some(function (data) {
59
+ return validateChildren(data, searchText);
60
+ });
55
61
  }
56
62
  return false;
57
63
  };
58
- const containsText = (text, searchText) => {
64
+ var containsText = function containsText(text, searchText) {
59
65
  if (typeof text === "string" && typeof searchText === "string") {
60
66
  return text.toLowerCase().indexOf(searchText.toLowerCase()) > -1;
61
67
  }
62
- if (typeof text === "object" && text.props && Array.isArray(text.props.children)) {
63
- return text.props.children.some(data => validateChildren(data, searchText));
68
+ if (_typeof(text) === "object" && text.props && Array.isArray(text.props.children)) {
69
+ return text.props.children.some(function (data) {
70
+ return validateChildren(data, searchText);
71
+ });
64
72
  }
65
73
  return false;
66
74
  };
67
- const displayedOptions = (0, _react.useMemo)(() => {
68
- const filteredOptions = options === null || options === void 0 ? void 0 : options.filter(option => containsText(option === null || option === void 0 ? void 0 : option.label, searchText));
75
+ var displayedOptions = (0, _react.useMemo)(function () {
76
+ var filteredOptions = options === null || options === void 0 ? void 0 : options.filter(function (option) {
77
+ return containsText(option === null || option === void 0 ? void 0 : option.label, searchText);
78
+ });
69
79
  if (isSearch) {
70
80
  setNoDataAvailable((filteredOptions === null || filteredOptions === void 0 ? void 0 : filteredOptions.length) === 0);
71
81
  }
@@ -73,36 +83,47 @@ const SimpleSelect = _ref => {
73
83
  // const sortedOptions = filteredOptions?.sort((a, b) =>
74
84
  // a?.label?.localeCompare(b.label)
75
85
  // );
76
- const sortedOptions = filteredOptions === null || filteredOptions === void 0 ? void 0 : filteredOptions.slice().sort((a, b) => {
77
- const labelA = typeof a.label === "string" ? a.label : findStringInChildren(a.label.props.children);
78
- const labelB = typeof b.label === "string" ? b.label : findStringInChildren(b.label.props.children);
86
+ var sortedOptions = filteredOptions === null || filteredOptions === void 0 ? void 0 : filteredOptions.slice().sort(function (a, b) {
87
+ var labelA = typeof a.label === "string" ? a.label : findStringInChildren(a.label.props.children);
88
+ var labelB = typeof b.label === "string" ? b.label : findStringInChildren(b.label.props.children);
79
89
  return labelA.localeCompare(labelB);
80
90
  });
81
91
  function findStringInChildren(children) {
82
- for (const child of children) {
83
- if (typeof child === "string") {
84
- return child;
85
- } else if (child.props && typeof child.props.children === "string") {
86
- return child.props.children;
92
+ var _iterator = _createForOfIteratorHelper(children),
93
+ _step;
94
+ try {
95
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
96
+ var child = _step.value;
97
+ if (typeof child === "string") {
98
+ return child;
99
+ } else if (child.props && typeof child.props.children === "string") {
100
+ return child.props.children;
101
+ }
87
102
  }
103
+ } catch (err) {
104
+ _iterator.e(err);
105
+ } finally {
106
+ _iterator.f();
88
107
  }
89
108
  return "";
90
109
  }
91
- return (isSort ? sortedOptions : filteredOptions).map(option => ({
92
- label: option === null || option === void 0 ? void 0 : option.label,
93
- value: option === null || option === void 0 ? void 0 : option.value
94
- }));
110
+ return (isSort ? sortedOptions : filteredOptions).map(function (option) {
111
+ return {
112
+ label: option === null || option === void 0 ? void 0 : option.label,
113
+ value: option === null || option === void 0 ? void 0 : option.value
114
+ };
115
+ });
95
116
  // eslint-disable-next-line react-hooks/exhaustive-deps
96
117
  }, [options, searchText, isSearch]);
97
- const recommendedOptions = isSearch ? displayedOptions : options;
98
- let typingTimer;
99
- const handleKeyDown = e => {
118
+ var recommendedOptions = isSearch ? displayedOptions : options;
119
+ var typingTimer;
120
+ var handleKeyDown = function handleKeyDown(e) {
100
121
  clearTimeout(typingTimer);
101
122
  if (e.key !== "Escape") {
102
123
  if (e.key !== "ArrowDown" && e.key !== "ArrowUp") {
103
124
  e.stopPropagation();
104
125
  }
105
- typingTimer = setTimeout(() => {
126
+ typingTimer = setTimeout(function () {
106
127
  clearTimeout(typingTimer);
107
128
  }, 500);
108
129
  }
@@ -130,7 +151,9 @@ const SimpleSelect = _ref => {
130
151
  }
131
152
  }, " * ") : "")), /*#__PURE__*/_react.default.createElement(_material.Select, _extends({}, rest, {
132
153
  fullWidth: true,
133
- onClose: () => setSearchText(""),
154
+ onClose: function onClose() {
155
+ return setSearchText("");
156
+ },
134
157
  MenuProps: {
135
158
  PaperProps: {
136
159
  style: {
@@ -158,7 +181,9 @@ const SimpleSelect = _ref => {
158
181
  borderRadius: "4px"
159
182
  },
160
183
  placeholder: "Type to search...",
161
- onChange: e => setSearchText(e.target.value),
184
+ onChange: function onChange(e) {
185
+ return setSearchText(e.target.value);
186
+ },
162
187
  onKeyDown: handleKeyDown
163
188
  }), isClearOption && !loading && /*#__PURE__*/_react.default.createElement(_material.MenuItem, {
164
189
  value: ""
@@ -176,9 +201,12 @@ const SimpleSelect = _ref => {
176
201
  }
177
202
  }, "Fetching Options...") : noDataAvailable ? /*#__PURE__*/_react.default.createElement(_material.MenuItem, {
178
203
  disabled: true
179
- }, "No Data Available") : recommendedOptions === null || recommendedOptions === void 0 ? void 0 : recommendedOptions.map(option => /*#__PURE__*/_react.default.createElement(_material.MenuItem, {
180
- key: option.value,
181
- value: option.value
182
- }, option.label))), error && /*#__PURE__*/_react.default.createElement(_material.FormHelperText, null, errorMessage), helperText && /*#__PURE__*/_react.default.createElement(_material.FormHelperText, null, helperText)));
204
+ }, "No Data Available") : recommendedOptions === null || recommendedOptions === void 0 ? void 0 : recommendedOptions.map(function (option) {
205
+ return /*#__PURE__*/_react.default.createElement(_material.MenuItem, {
206
+ key: option.value,
207
+ value: option.value
208
+ }, option.label);
209
+ })), error && /*#__PURE__*/_react.default.createElement(_material.FormHelperText, null, errorMessage), helperText && /*#__PURE__*/_react.default.createElement(_material.FormHelperText, null, helperText)));
183
210
  };
184
- var _default = exports.default = SimpleSelect;
211
+ var _default = SimpleSelect;
212
+ exports.default = _default;