tenjin-ui-kit 0.3.70 → 0.3.72-dev

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 (203) hide show
  1. package/common/hooks/apiHooks.js +155 -0
  2. package/common/hooks/newApiHook.js +188 -0
  3. package/{dist/common → common}/utils/security/index.js +2 -2
  4. package/{dist/common → common}/utils/security/securityConfig.js +1 -2
  5. package/components/Canvas.js +330 -0
  6. package/components/DragBox/index.js +40 -0
  7. package/components/InputWithChip/index.js +294 -0
  8. package/{dist/components → components}/RightContext/index.js +19 -28
  9. package/components/WorkFlow.js +42 -0
  10. package/components/WorkFlowBuilder.js +115 -0
  11. package/components/alert/Style.js +20 -0
  12. package/components/alert/index.js +67 -0
  13. package/{dist/components → components}/attachment/index.js +21 -28
  14. package/{dist/components → components}/authenticationProvider/AuthError.js +3 -4
  15. package/{dist/components → components}/authenticationProvider/AuthLoader.js +3 -4
  16. package/components/authenticationProvider/index.js +110 -0
  17. package/{dist/components → components}/avatar/index.js +13 -14
  18. package/components/avatar/styles.js +91 -0
  19. package/components/breadCrumbs/index.js +169 -0
  20. package/{dist/components → components}/breadCrumbs/style.js +1 -4
  21. package/{dist/components → components}/browsingTestCaseLayout/DetailsViewLayout/DetailsViewContent/index.js +5 -6
  22. package/{dist/components → components}/browsingTestCaseLayout/DetailsViewLayout/DetailsViewContent/style.js +5 -8
  23. package/{dist/components → components}/browsingTestCaseLayout/DetailsViewLayout/DetailsViewHeader/index.js +4 -5
  24. package/{dist/components → components}/browsingTestCaseLayout/TreeViewLayout/TreeViewContent/Index.js +4 -5
  25. package/{dist/components → components}/browsingTestCaseLayout/TreeViewLayout/TreeViewHeader/Index.js +5 -6
  26. package/components/browsingTestCaseLayout/TreeViewLayout/TreeViewHeader/style.js +23 -0
  27. package/{dist/components → components}/browsingTestCaseLayout/index.js +25 -30
  28. package/components/button/index.js +133 -0
  29. package/{dist/components → components}/chatBotModal/index.js +36 -45
  30. package/components/checkBox/index.js +29 -0
  31. package/{dist/components → components}/combobox/index.js +51 -72
  32. package/components/divider/index.js +37 -0
  33. package/{dist/components → components}/editableField/index.js +19 -28
  34. package/{dist/components → components}/error/index.js +6 -12
  35. package/components/errorBoundary/index.js +140 -0
  36. package/components/fileUploader/index.js +151 -0
  37. package/components/fileUploader/style.js +57 -0
  38. package/components/filter/ValueSelector.js +333 -0
  39. package/{dist/components → components}/filter/index.js +26 -33
  40. package/{dist/components → components}/iconButton/index.js +3 -4
  41. package/components/input/index.js +167 -0
  42. package/components/layout/index.js +94 -0
  43. package/components/layout/main/index.js +24 -0
  44. package/components/layout/main/style.js +19 -0
  45. package/{dist/components → components}/layout/pageContent/index.js +6 -7
  46. package/components/layout/sidebar/FlatMenu.js +64 -0
  47. package/components/layout/sidebar/GroupedIconMenu.js +233 -0
  48. package/components/layout/sidebar/GroupedMenu.js +57 -0
  49. package/components/layout/sidebar/ProjectMenu.js +223 -0
  50. package/components/layout/sidebar/index.js +88 -0
  51. package/components/layout/sidebar/style.js +149 -0
  52. package/components/layout/topBar/ProjectTopbar.js +388 -0
  53. package/components/layout/topBar/UserAvatar.js +138 -0
  54. package/components/layout/topBar/index.js +121 -0
  55. package/{dist/components → components}/loader/index.js +9 -12
  56. package/components/menu/index.js +71 -0
  57. package/{dist/components → components}/modal/Modal.js +5 -6
  58. package/components/modal/index.js +88 -0
  59. package/components/modal/style.js +65 -0
  60. package/components/optionMenu/index.js +105 -0
  61. package/components/pagination/index.js +114 -0
  62. package/components/pagination/style.js +33 -0
  63. package/components/paginationUpdated/index.js +74 -0
  64. package/components/paper/index.js +43 -0
  65. package/components/paper/style.js +31 -0
  66. package/components/reactSelect/index.js +195 -0
  67. package/components/reactSelect/style.js +130 -0
  68. package/components/richTextEditor/index.js +64 -0
  69. package/components/select/GroupedSelect.js +167 -0
  70. package/components/select/SimpleSelect.js +184 -0
  71. package/{dist/components → components}/select/index.js +38 -54
  72. package/components/simpleSelect/index.js +53 -0
  73. package/{dist/components → components}/sort/index.js +19 -22
  74. package/{dist/components → components}/switch/index.js +10 -11
  75. package/components/switch/style.js +39 -0
  76. package/{dist/components → components}/switch/switch.js +17 -23
  77. package/components/table/ReactTable.js +101 -0
  78. package/components/table/SimpleTable.js +117 -0
  79. package/components/table/index.js +381 -0
  80. package/components/text/index.js +65 -0
  81. package/{dist/components → components}/timeStamp/index.js +4 -6
  82. package/components/timeStamp/style.js +20 -0
  83. package/components/topBar/index.js +169 -0
  84. package/{dist/components → components}/tree/index.js +29 -47
  85. package/components/tree/style.js +29 -0
  86. package/components/valuePicker/ValueSelector.js +205 -0
  87. package/{dist/components → components}/valuePicker/index.js +19 -26
  88. package/{dist/components → components}/wrapperLayout/layout/index.js +4 -5
  89. package/{dist/components → components}/wrapperLayout/main/index.js +4 -5
  90. package/{dist/components → components}/wrapperLayout/main/pageContainer/index.js +4 -5
  91. package/components/wrapperLayout/main/sideBar/index.js +272 -0
  92. package/components/wrapperLayout/main/sideBar/style.js +190 -0
  93. package/{dist/components → components}/wrapperLayout/topBar/UserAvatar.js +4 -5
  94. package/components/wrapperLayout/topBar/avatar.js +55 -0
  95. package/components/wrapperLayout/topBar/index.js +196 -0
  96. package/{dist/components → components}/wrapperLayout/topBar/menuIcon.js +4 -5
  97. package/components/wrapperLayout/topBar/style.js +74 -0
  98. package/http/index.js +133 -0
  99. package/{dist/index.js → index.js} +53 -55
  100. package/package.json +5 -3
  101. package/{dist/templates → templates}/listPage/index.js +36 -57
  102. package/{dist/themes → themes}/default.js +5 -7
  103. package/{dist/themes → themes}/defaultSmall.js +2 -3
  104. package/{dist/themes → themes}/responsiveTheme.js +6 -8
  105. package/.dockerignore +0 -6
  106. package/.storybook/main.js +0 -16
  107. package/.storybook/preview.js +0 -11
  108. package/Dockerfile +0 -17
  109. package/Jenkinsfile +0 -66
  110. package/build/asset-manifest.json +0 -16
  111. package/build/favicon.ico +0 -0
  112. package/build/index.html +0 -1
  113. package/build/logo192.png +0 -0
  114. package/build/logo512.png +0 -0
  115. package/build/manifest.json +0 -25
  116. package/build/robots.txt +0 -3
  117. package/build/static/css/main.522396f6.css +0 -2
  118. package/build/static/css/main.522396f6.css.map +0 -1
  119. package/build/static/js/787.18cf14d0.chunk.js +0 -2
  120. package/build/static/js/787.18cf14d0.chunk.js.map +0 -1
  121. package/build/static/js/main.d71fecac.js +0 -3
  122. package/build/static/js/main.d71fecac.js.LICENSE.txt +0 -50
  123. package/build/static/js/main.d71fecac.js.map +0 -1
  124. package/build/static/media/logo.6ce24c58023cc2f8fd88fe9d219db6c6.svg +0 -1
  125. package/build/tenjinLogo.png +0 -0
  126. package/dist/common/hooks/apiHooks.js +0 -223
  127. package/dist/common/hooks/newApiHook.js +0 -270
  128. package/dist/components/Canvas.js +0 -254
  129. package/dist/components/DragBox/index.js +0 -45
  130. package/dist/components/InputWithChip/index.js +0 -187
  131. package/dist/components/WorkFlow.js +0 -47
  132. package/dist/components/WorkFlowBuilder.js +0 -130
  133. package/dist/components/alert/Style.js +0 -23
  134. package/dist/components/alert/index.js +0 -69
  135. package/dist/components/authenticationProvider/index.js +0 -166
  136. package/dist/components/avatar/styles.js +0 -94
  137. package/dist/components/breadCrumbs/index.js +0 -180
  138. package/dist/components/browsingTestCaseLayout/TreeViewLayout/TreeViewHeader/style.js +0 -26
  139. package/dist/components/button/index.js +0 -140
  140. package/dist/components/checkBox/index.js +0 -30
  141. package/dist/components/divider/index.js +0 -41
  142. package/dist/components/errorBoundary/index.js +0 -160
  143. package/dist/components/fileUploader/index.js +0 -156
  144. package/dist/components/fileUploader/style.js +0 -60
  145. package/dist/components/filter/ValueSelector.js +0 -405
  146. package/dist/components/input/index.js +0 -174
  147. package/dist/components/layout/index.js +0 -98
  148. package/dist/components/layout/main/index.js +0 -27
  149. package/dist/components/layout/main/style.js +0 -22
  150. package/dist/components/layout/sidebar/FlatMenu.js +0 -64
  151. package/dist/components/layout/sidebar/GroupedIconMenu.js +0 -246
  152. package/dist/components/layout/sidebar/GroupedMenu.js +0 -67
  153. package/dist/components/layout/sidebar/ProjectMenu.js +0 -230
  154. package/dist/components/layout/sidebar/index.js +0 -91
  155. package/dist/components/layout/sidebar/style.js +0 -154
  156. package/dist/components/layout/topBar/ProjectTopbar.js +0 -338
  157. package/dist/components/layout/topBar/UserAvatar.js +0 -145
  158. package/dist/components/layout/topBar/index.js +0 -132
  159. package/dist/components/menu/index.js +0 -80
  160. package/dist/components/modal/index.js +0 -91
  161. package/dist/components/modal/style.js +0 -68
  162. package/dist/components/optionMenu/index.js +0 -112
  163. package/dist/components/pagination/index.js +0 -129
  164. package/dist/components/pagination/style.js +0 -36
  165. package/dist/components/paginationUpdated/index.js +0 -75
  166. package/dist/components/paper/index.js +0 -44
  167. package/dist/components/paper/style.js +0 -34
  168. package/dist/components/reactSelect/index.js +0 -212
  169. package/dist/components/reactSelect/style.js +0 -163
  170. package/dist/components/richTextEditor/index.js +0 -83
  171. package/dist/components/select/GroupedSelect.js +0 -183
  172. package/dist/components/select/SimpleSelect.js +0 -212
  173. package/dist/components/simpleSelect/index.js +0 -56
  174. package/dist/components/switch/style.js +0 -42
  175. package/dist/components/table/ReactTable.js +0 -118
  176. package/dist/components/table/SimpleTable.js +0 -136
  177. package/dist/components/table/index.js +0 -256
  178. package/dist/components/text/index.js +0 -67
  179. package/dist/components/timeStamp/style.js +0 -23
  180. package/dist/components/topBar/index.js +0 -176
  181. package/dist/components/tree/style.js +0 -32
  182. package/dist/components/valuePicker/ValueSelector.js +0 -273
  183. package/dist/components/wrapperLayout/main/sideBar/index.js +0 -262
  184. package/dist/components/wrapperLayout/main/sideBar/style.js +0 -196
  185. package/dist/components/wrapperLayout/topBar/avatar.js +0 -57
  186. package/dist/components/wrapperLayout/topBar/index.js +0 -182
  187. package/dist/components/wrapperLayout/topBar/style.js +0 -77
  188. package/dist/http/index.js +0 -226
  189. package/public/favicon.ico +0 -0
  190. package/public/index.html +0 -43
  191. package/public/logo192.png +0 -0
  192. package/public/logo512.png +0 -0
  193. package/public/manifest.json +0 -25
  194. package/public/robots.txt +0 -3
  195. package/public/tenjinLogo.png +0 -0
  196. /package/{dist/assets → assets}/images/MicrosoftTeams-image (1).png +0 -0
  197. /package/{dist/assets → assets}/images/tenjin-4.0-logo.png +0 -0
  198. /package/{dist/components → components}/RightContext/index.css +0 -0
  199. /package/{dist/components → components}/browsingTestCaseLayout/style.css +0 -0
  200. /package/{dist/components → components}/errorBoundary/Error.jpg +0 -0
  201. /package/{dist/components → components}/iconButton/style.js +0 -0
  202. /package/{dist/components → components}/richTextEditor/style.js +0 -0
  203. /package/{dist/components → components}/wrapperLayout/layout/style.js +0 -0
@@ -0,0 +1,167 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var React = _interopRequireWildcard(require("react"));
8
+ var _FormControl = _interopRequireDefault(require("@mui/material/FormControl"));
9
+ var _fa = require("react-icons/fa");
10
+ var _reactDom = require("react-dom");
11
+ 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(); }
17
+ 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 => {
25
+ var _options$find, _Object$entries;
26
+ let options = _ref.options,
27
+ onChange = _ref.onChange,
28
+ propValue = _ref.value,
29
+ defaultValue = _ref.defaultValue,
30
+ fullWidth = _ref.fullWidth,
31
+ rest = _objectWithoutProperties(_ref, _excluded);
32
+ const triggerRef = React.useRef(null);
33
+ const _React$useState = React.useState(""),
34
+ _React$useState2 = _slicedToArray(_React$useState, 2),
35
+ searchTerm = _React$useState2[0],
36
+ setSearchTerm = _React$useState2[1];
37
+ const _React$useState3 = React.useState(false),
38
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
39
+ isDropdownOpen = _React$useState4[0],
40
+ setIsDropdownOpen = _React$useState4[1];
41
+ const _React$useState5 = React.useState(propValue || defaultValue),
42
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
43
+ value = _React$useState6[0],
44
+ setValue = _React$useState6[1];
45
+ const _React$useState7 = React.useState(null),
46
+ _React$useState8 = _slicedToArray(_React$useState7, 2),
47
+ hoveredOption = _React$useState8[0],
48
+ setHoveredOption = _React$useState8[1];
49
+ const groupOptionsByPageTitle = options => {
50
+ const grouped = {};
51
+ options.forEach(option => {
52
+ var _grouped$option$pageT;
53
+ if (!grouped[option === null || option === void 0 ? void 0 : option.pageTitle]) {
54
+ grouped[option === null || option === void 0 ? void 0 : option.pageTitle] = [];
55
+ }
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);
57
+ });
58
+ return grouped;
59
+ };
60
+ const handleSearchChange = event => {
61
+ setSearchTerm(event.target.value);
62
+ };
63
+ const filteredOptions = options.filter(option => {
64
+ 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));
66
+ });
67
+ const groupedOptions = groupOptionsByPageTitle(filteredOptions);
68
+ const toggleDropdown = () => {
69
+ setIsDropdownOpen(prev => !prev);
70
+ };
71
+ const handleOptionClick = selectedValue => {
72
+ setValue(selectedValue);
73
+ setIsDropdownOpen(false);
74
+ onChange({
75
+ target: {
76
+ value: selectedValue
77
+ }
78
+ });
79
+ };
80
+ const handleCloseDropdown = () => {
81
+ setIsDropdownOpen(false);
82
+ };
83
+ return /*#__PURE__*/React.createElement(_FormControl.default, _extends({
84
+ sx: {
85
+ width: fullWidth ? "100%" : 200
86
+ }
87
+ }, rest), /*#__PURE__*/React.createElement("div", {
88
+ style: {
89
+ position: "relative",
90
+ width: "100%"
91
+ },
92
+ ref: triggerRef
93
+ }, /*#__PURE__*/React.createElement("div", {
94
+ onClick: toggleDropdown,
95
+ style: {
96
+ padding: "8px 10px",
97
+ border: "1px solid #ccc",
98
+ borderRadius: "4px",
99
+ cursor: "pointer",
100
+ display: "flex",
101
+ alignItems: "center",
102
+ justifyContent: "space-between"
103
+ }
104
+ }, /*#__PURE__*/React.createElement("div", {
105
+ style: {
106
+ flexGrow: 1
107
+ }
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", {
109
+ style: {
110
+ position: "absolute",
111
+ top: "".concat(triggerRef.current.getBoundingClientRect().bottom + 8, "px"),
112
+ left: "".concat(triggerRef.current.getBoundingClientRect().left, "px"),
113
+ width: "".concat(triggerRef.current.offsetWidth, "px"),
114
+ backgroundColor: "#fff",
115
+ border: "1px solid #ccc",
116
+ borderRadius: "4px",
117
+ boxShadow: "0px 4px 6px rgba(0, 0, 0, 0.1)",
118
+ maxHeight: "200px",
119
+ overflowY: "auto",
120
+ zIndex: 2000
121
+ }
122
+ }, /*#__PURE__*/React.createElement("div", {
123
+ style: {
124
+ padding: "10px"
125
+ }
126
+ }, /*#__PURE__*/React.createElement("input", {
127
+ type: "text",
128
+ placeholder: "Search...",
129
+ value: searchTerm,
130
+ onChange: handleSearchChange,
131
+ style: {
132
+ paddingLeft: "2.5rem",
133
+ background: 'white url("https://static.thenounproject.com/png/101791-200.png") no-repeat left',
134
+ backgroundPosition: "0.875rem center",
135
+ backgroundSize: "1.125rem",
136
+ height: "2.188rem",
137
+ margin: 0,
138
+ width: "100%",
139
+ border: "1px solid #949494",
140
+ borderRadius: "4px"
141
+ }
142
+ }), (_Object$entries = Object.entries(groupedOptions)) === null || _Object$entries === void 0 ? void 0 : _Object$entries.map(_ref2 => {
143
+ let _ref3 = _slicedToArray(_ref2, 2),
144
+ pageTitle = _ref3[0],
145
+ options = _ref3[1];
146
+ return /*#__PURE__*/React.createElement("div", {
147
+ key: pageTitle
148
+ }, /*#__PURE__*/React.createElement(_text.default, {
149
+ style: {
150
+ padding: "5px 10px"
151
+ // backgroundColor: "#f5f5f5",
152
+ },
153
+ 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)));
165
+ }))), document.body));
166
+ };
167
+ var _default = exports.default = GroupedSelect;
@@ -0,0 +1,184 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _material = require("@mui/material");
8
+ var _react = _interopRequireWildcard(require("react"));
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(); }
15
+ 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,
24
+ errorMessage = _ref.errorMessage,
25
+ error = _ref.error,
26
+ fullWidth = _ref.fullWidth,
27
+ isDisabled = _ref.isDisabled,
28
+ label = _ref.label,
29
+ isRequired = _ref.isRequired,
30
+ helperText = _ref.helperText,
31
+ isSearch = _ref.isSearch,
32
+ isClearOption = _ref.isClearOption,
33
+ loading = _ref.loading,
34
+ isSort = _ref.isSort,
35
+ placeholder = _ref.placeholder,
36
+ 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
40
+
41
+ const _useState = (0, _react.useState)(""),
42
+ _useState2 = _slicedToArray(_useState, 2),
43
+ searchText = _useState2[0],
44
+ setSearchText = _useState2[1];
45
+ const _useState3 = (0, _react.useState)(false),
46
+ _useState4 = _slicedToArray(_useState3, 2),
47
+ noDataAvailable = _useState4[0],
48
+ setNoDataAvailable = _useState4[1];
49
+ const validateChildren = (type, searchText) => {
50
+ if (typeof type !== "object") {
51
+ return typeof type === "string" && type.toLowerCase().indexOf(searchText.toLowerCase()) > -1;
52
+ }
53
+ if (typeof type.props === "object" && Array.isArray(type.props.children)) {
54
+ return type.props.children.some(data => validateChildren(data, searchText));
55
+ }
56
+ return false;
57
+ };
58
+ const containsText = (text, searchText) => {
59
+ if (typeof text === "string" && typeof searchText === "string") {
60
+ return text.toLowerCase().indexOf(searchText.toLowerCase()) > -1;
61
+ }
62
+ if (typeof text === "object" && text.props && Array.isArray(text.props.children)) {
63
+ return text.props.children.some(data => validateChildren(data, searchText));
64
+ }
65
+ return false;
66
+ };
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));
69
+ if (isSearch) {
70
+ setNoDataAvailable((filteredOptions === null || filteredOptions === void 0 ? void 0 : filteredOptions.length) === 0);
71
+ }
72
+
73
+ // const sortedOptions = filteredOptions?.sort((a, b) =>
74
+ // a?.label?.localeCompare(b.label)
75
+ // );
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);
79
+ return labelA.localeCompare(labelB);
80
+ });
81
+ 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;
87
+ }
88
+ }
89
+ return "";
90
+ }
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
+ }));
95
+ // eslint-disable-next-line react-hooks/exhaustive-deps
96
+ }, [options, searchText, isSearch]);
97
+ const recommendedOptions = isSearch ? displayedOptions : options;
98
+ let typingTimer;
99
+ const handleKeyDown = e => {
100
+ clearTimeout(typingTimer);
101
+ if (e.key !== "Escape") {
102
+ if (e.key !== "ArrowDown" && e.key !== "ArrowUp") {
103
+ e.stopPropagation();
104
+ }
105
+ typingTimer = setTimeout(() => {
106
+ clearTimeout(typingTimer);
107
+ }, 500);
108
+ }
109
+ };
110
+ return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_material.FormControl, {
111
+ sx: {
112
+ minWidth: 120
113
+ },
114
+ fullWidth: fullWidth,
115
+ disabled: isDisabled,
116
+ error: error,
117
+ style: {
118
+ margin: "0rem !important"
119
+ }
120
+ }, label && /*#__PURE__*/_react.default.createElement(_material.FormLabel, {
121
+ htmlFor: "my-input",
122
+ sx: {
123
+ fontSize: "0.8rem",
124
+ fontWeight: 500,
125
+ paddingBottom: "0.2rem"
126
+ }
127
+ }, /*#__PURE__*/_react.default.createElement(_text.default, null, label, isRequired ? /*#__PURE__*/_react.default.createElement("span", {
128
+ style: {
129
+ color: "red"
130
+ }
131
+ }, " * ") : "")), /*#__PURE__*/_react.default.createElement(_material.Select, _extends({}, rest, {
132
+ fullWidth: true,
133
+ onClose: () => setSearchText(""),
134
+ MenuProps: {
135
+ PaperProps: {
136
+ style: {
137
+ maxHeight: "12.5rem"
138
+ }
139
+ }
140
+ }
141
+ }), isSearch && /*#__PURE__*/_react.default.createElement("input", {
142
+ id: "search-box",
143
+ type: "text",
144
+ autoFocus: true,
145
+ style: {
146
+ paddingLeft: "2.5rem",
147
+ background: 'white url("https://static.thenounproject.com/png/101791-200.png") no-repeat left',
148
+ backgroundPosition: "0.875rem center",
149
+ backgroundSize: "1.125rem",
150
+ position: "sticky",
151
+ top: 0,
152
+ zIndex: 9999,
153
+ backgroundColor: "white !important",
154
+ height: "2.188rem",
155
+ margin: 0,
156
+ width: "100%",
157
+ border: "1px solid #949494",
158
+ borderRadius: "4px"
159
+ },
160
+ placeholder: "Type to search...",
161
+ onChange: e => setSearchText(e.target.value),
162
+ onKeyDown: handleKeyDown
163
+ }), isClearOption && !loading && /*#__PURE__*/_react.default.createElement(_material.MenuItem, {
164
+ value: ""
165
+ }, /*#__PURE__*/_react.default.createElement("em", {
166
+ style: {
167
+ color: "#888"
168
+ }
169
+ }, "Clear the option")), loading ? /*#__PURE__*/_react.default.createElement(_text.default, {
170
+ variant: "span",
171
+ color: "secondary",
172
+ sx: {
173
+ fontStyle: "italic",
174
+ display: "flex",
175
+ padding: "0.5rem 0rem 0rem 1rem"
176
+ }
177
+ }, "Fetching Options...") : noDataAvailable ? /*#__PURE__*/_react.default.createElement(_material.MenuItem, {
178
+ 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)));
183
+ };
184
+ var _default = exports.default = SimpleSelect;
@@ -1,6 +1,5 @@
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
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
@@ -12,15 +11,14 @@ var _CheckBox = _interopRequireDefault(require("@mui/icons-material/CheckBox"));
12
11
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
12
  var _responsiveTheme = _interopRequireDefault(require("../../themes/responsiveTheme"));
14
13
  var _text = _interopRequireDefault(require("../text"));
15
- var _excluded = ["options", "isMulti", "checkBox", "defaultValue", "value", "onChange", "placeholder", "label", "fullWidth", "error", "helperText", "blueTheme", "isRequired", "isDisabled"];
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
- 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); }
18
- 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; }
19
- 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); }
20
- 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; }
21
- 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; }
22
- var ReactSelect = function ReactSelect(props) {
23
- var options = props.options,
14
+ const _excluded = ["options", "isMulti", "checkBox", "defaultValue", "value", "onChange", "placeholder", "label", "fullWidth", "error", "helperText", "blueTheme", "isRequired", "isDisabled"];
15
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
16
+ 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); }
17
+ 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); }
18
+ 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; }
19
+ 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; }
20
+ const ReactSelect = props => {
21
+ const options = props.options,
24
22
  isMulti = props.isMulti,
25
23
  checkBox = props.checkBox,
26
24
  defaultValue = props.defaultValue,
@@ -35,10 +33,10 @@ var ReactSelect = function ReactSelect(props) {
35
33
  isRequired = props.isRequired,
36
34
  isDisabled = props.isDisabled,
37
35
  rest = _objectWithoutProperties(props, _excluded);
38
- var icon = /*#__PURE__*/_react.default.createElement(_CheckBoxOutlineBlank.default, {
36
+ const icon = /*#__PURE__*/_react.default.createElement(_CheckBoxOutlineBlank.default, {
39
37
  fontSize: "small"
40
38
  });
41
- var checkedIcon = /*#__PURE__*/_react.default.createElement(_CheckBox.default, {
39
+ const checkedIcon = /*#__PURE__*/_react.default.createElement(_CheckBox.default, {
42
40
  fontSize: "small"
43
41
  });
44
42
  return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_material.FormControl, {
@@ -70,14 +68,12 @@ var ReactSelect = function ReactSelect(props) {
70
68
  options: options
71
69
  // disableCloseOnSelect
72
70
  ,
73
- getOptionLabel: function getOptionLabel(option) {
74
- return option === null || option === void 0 ? void 0 : option.label;
75
- },
71
+ getOptionLabel: option => option === null || option === void 0 ? void 0 : option.label,
76
72
  value: value,
77
73
  onChange: onChange,
78
74
  defaultValue: [options[1]],
79
- renderOption: function renderOption(props, option, _ref) {
80
- var selected = _ref.selected;
75
+ renderOption: (props, option, _ref) => {
76
+ let selected = _ref.selected;
81
77
  return /*#__PURE__*/_react.default.createElement("li", props, /*#__PURE__*/_react.default.createElement(_material.Checkbox, {
82
78
  icon: icon,
83
79
  checkedIcon: checkedIcon,
@@ -87,12 +83,10 @@ var ReactSelect = function ReactSelect(props) {
87
83
  checked: selected
88
84
  }), /*#__PURE__*/_react.default.createElement(_text.default, null, option === null || option === void 0 ? void 0 : option.label));
89
85
  },
90
- renderInput: function renderInput(params) {
91
- return /*#__PURE__*/_react.default.createElement(_material.TextField, _extends({}, params, {
92
- placeholder: placeholder,
93
- helperText: helperText
94
- }));
95
- }
86
+ renderInput: params => /*#__PURE__*/_react.default.createElement(_material.TextField, _extends({}, params, {
87
+ placeholder: placeholder,
88
+ helperText: helperText
89
+ }))
96
90
  })), !checkBox && !blueTheme && /*#__PURE__*/_react.default.createElement(_material.Autocomplete, _extends({}, rest, {
97
91
  filterSelectedOptions: true,
98
92
  disabled: isDisabled,
@@ -100,9 +94,7 @@ var ReactSelect = function ReactSelect(props) {
100
94
  options: options
101
95
  // disableCloseOnSelect
102
96
  ,
103
- getOptionLabel: function getOptionLabel(option) {
104
- return option.label ? option.label : "";
105
- },
97
+ getOptionLabel: option => option.label ? option.label : "",
106
98
  value: value,
107
99
  defaultValue: [defaultValue],
108
100
  onChange: onChange,
@@ -115,16 +107,14 @@ var ReactSelect = function ReactSelect(props) {
115
107
  color: isDisabled && "#000000"
116
108
  }
117
109
  },
118
- renderInput: function renderInput(params) {
119
- return /*#__PURE__*/_react.default.createElement(_material.TextField, _extends({
120
- error: error
121
- }, params, {
122
- variant: "outlined",
123
- fullWidth: true,
124
- placeholder: placeholder,
125
- helperText: helperText
126
- }));
127
- }
110
+ renderInput: params => /*#__PURE__*/_react.default.createElement(_material.TextField, _extends({
111
+ error: error
112
+ }, params, {
113
+ variant: "outlined",
114
+ fullWidth: true,
115
+ placeholder: placeholder,
116
+ helperText: helperText
117
+ }))
128
118
  })), blueTheme && /*#__PURE__*/_react.default.createElement(_material.Grid, {
129
119
  container: true,
130
120
  sx: {
@@ -146,8 +136,8 @@ var ReactSelect = function ReactSelect(props) {
146
136
  color: "#F4F7FC"
147
137
  }
148
138
  },
149
- PaperComponent: function PaperComponent(_ref2) {
150
- var children = _ref2.children;
139
+ PaperComponent: _ref2 => {
140
+ let children = _ref2.children;
151
141
  return /*#__PURE__*/_react.default.createElement(_material.Paper, {
152
142
  style: {
153
143
  background: "#6e6ba1",
@@ -164,26 +154,21 @@ var ReactSelect = function ReactSelect(props) {
164
154
  filterSelectedOptions: true
165
155
  // disableCloseOnSelect
166
156
  ,
167
- getOptionLabel: function getOptionLabel(option) {
168
- return option.label;
169
- },
157
+ getOptionLabel: option => option.label,
170
158
  value: value,
171
159
  defaultValue: [defaultValue],
172
160
  onChange: onChange,
173
- renderInput: function renderInput(params) {
174
- return /*#__PURE__*/_react.default.createElement(_material.TextField, _extends({
175
- error: error
176
- }, params, {
177
- variant: "outlined",
178
- fullWidth: true,
179
- placeholder: placeholder,
180
- helperText: helperText
181
- }));
182
- }
161
+ renderInput: params => /*#__PURE__*/_react.default.createElement(_material.TextField, _extends({
162
+ error: error
163
+ }, params, {
164
+ variant: "outlined",
165
+ fullWidth: true,
166
+ placeholder: placeholder,
167
+ helperText: helperText
168
+ }))
183
169
  // sx={{ }}
184
170
  })))));
185
171
  };
186
-
187
172
  ReactSelect.propTypes = {
188
173
  value: _propTypes.default.string,
189
174
  className: _propTypes.default.string,
@@ -213,5 +198,4 @@ ReactSelect.defaultProps = {
213
198
  isSearch: false,
214
199
  loading: false
215
200
  };
216
- var _default = ReactSelect;
217
- exports.default = _default;
201
+ var _default = exports.default = ReactSelect;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _material = require("@mui/material");
8
+ var _text = _interopRequireDefault(require("../text"));
9
+ const _excluded = ["options", "errorMessage", "error", "fullWidth", "isDisabled", "label", "isRequired"];
10
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
+ 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); }
12
+ 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; }
13
+ 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; }
14
+ const SimpleSelect = _ref => {
15
+ let options = _ref.options,
16
+ errorMessage = _ref.errorMessage,
17
+ error = _ref.error,
18
+ fullWidth = _ref.fullWidth,
19
+ isDisabled = _ref.isDisabled,
20
+ label = _ref.label,
21
+ isRequired = _ref.isRequired,
22
+ rest = _objectWithoutProperties(_ref, _excluded);
23
+ console.log(errorMessage, error, "error");
24
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(_material.FormControl, {
25
+ sx: {
26
+ m: 1,
27
+ minWidth: 120
28
+ },
29
+ fullWidth: fullWidth,
30
+ disabled: isDisabled,
31
+ error: error,
32
+ style: {
33
+ margin: "0rem !important"
34
+ }
35
+ }, label && /*#__PURE__*/React.createElement(_material.FormLabel, {
36
+ htmlFor: "my-input",
37
+ sx: {
38
+ fontSize: "0.8rem",
39
+ fontWeight: 500,
40
+ paddingBottom: "0.2rem"
41
+ }
42
+ }, /*#__PURE__*/React.createElement(_text.default, null, label, isRequired ? /*#__PURE__*/React.createElement("span", {
43
+ style: {
44
+ color: "red"
45
+ }
46
+ }, " * ") : "")), /*#__PURE__*/React.createElement(_material.Select, _extends({}, rest, {
47
+ fullWidth: true
48
+ }), options.map(option => /*#__PURE__*/React.createElement(_material.MenuItem, {
49
+ key: option.value,
50
+ value: option.value
51
+ }, option.label))), error && /*#__PURE__*/React.createElement(_material.FormHelperText, null, errorMessage)));
52
+ };
53
+ var _default = exports.default = SimpleSelect;