react-core-ts 2.0.13 → 2.0.14

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.
@@ -69,36 +69,37 @@ var getPosition_1 = require("./utilities/getPosition");
69
69
  var icons_1 = require("./utilities/icons");
70
70
  var ReactAutoCompleteTableView = function (_a) {
71
71
  var _b;
72
- var label = _a.label, onChange = _a.onChange, getData = _a.getData, data = _a.data, errors = _a.errors, _c = _a.required, required = _c === void 0 ? false : _c, autoFocus = _a.autoFocus, name = _a.name, fullWidth = _a.fullWidth, placeholder = _a.placeholder, id = _a.id, propsClassName = _a.className, _d = _a.type, type = _d === void 0 ? "custom_select" : _d, readOnly = _a.readOnly, _e = _a.disabled, disabled = _e === void 0 ? false : _e, value = _a.value, _f = _a.autoFilter, autoFilter = _f === void 0 ? false : _f, _g = _a.insideOpen, insideOpen = _g === void 0 ? false : _g, _h = _a.isClose, isClose = _h === void 0 ? true : _h, _j = _a.noLocalFilter, noLocalFilter = _j === void 0 ? false : _j, _k = _a.isStaticList, isStaticList = _k === void 0 ? false : _k, _l = _a.isCustomPlaceholder, isCustomPlaceholder = _l === void 0 ? false : _l, checkParams = _a.checkParams, width = _a.width, hasParentError = _a.hasParentError, fromPrefix = _a.fromPrefix, labelTitle = _a.labelTitle, _m = _a.isModern, isModern = _m === void 0 ? true : _m, _o = _a.size, size = _o === void 0 ? "md" : _o, _p = _a.dropdownMinWidth, dropdownMinWidth = _p === void 0 ? 200 : _p, _q = _a.tableView, tableView = _q === void 0 ? false : _q, _r = _a.additionalColumns, additionalColumns = _r === void 0 ? [] : _r;
73
- var _s = (0, react_1.useState)((_b = value === null || value === void 0 ? void 0 : value.name) !== null && _b !== void 0 ? _b : ""), inputValue = _s[0], setInputValue = _s[1];
74
- var _t = (0, react_1.useState)(false), isHovered = _t[0], setIsHovered = _t[1];
75
- var _u = (0, react_1.useState)(false), isLoading = _u[0], setIsLoading = _u[1];
76
- var _v = (0, react_1.useState)(false), dropOpen = _v[0], setDropOpen = _v[1];
77
- var _w = (0, react_1.useState)(disabled), isDisabled = _w[0], setIsDisabled = _w[1];
78
- var _x = (0, react_1.useState)(false), showClose = _x[0], setShowClose = _x[1];
79
- var _y = (0, react_1.useState)(false), showToolTip = _y[0], setShowTooltip = _y[1];
80
- var _z = (0, react_1.useState)(false), tooltipIsHovered = _z[0], setTooltipIsHovered = _z[1];
81
- var _0 = (0, react_1.useState)([]), suggestions = _0[0], setSuggestions = _0[1];
72
+ var label = _a.label, onChange = _a.onChange, getData = _a.getData, data = _a.data, errors = _a.errors, _c = _a.required, required = _c === void 0 ? false : _c, autoFocus = _a.autoFocus, name = _a.name, fullWidth = _a.fullWidth, placeholder = _a.placeholder, id = _a.id, propsClassName = _a.className, _d = _a.type, type = _d === void 0 ? 'custom_select' : _d, readOnly = _a.readOnly, _e = _a.disabled, disabled = _e === void 0 ? false : _e, value = _a.value, _f = _a.autoFilter, autoFilter = _f === void 0 ? false : _f, _g = _a.autoDropdown, autoDropdown = _g === void 0 ? true : _g, _h = _a.insideOpen, insideOpen = _h === void 0 ? false : _h, _j = _a.isClose, isClose = _j === void 0 ? true : _j, _k = _a.noLocalFilter, noLocalFilter = _k === void 0 ? false : _k, _l = _a.isStaticList, isStaticList = _l === void 0 ? false : _l, _m = _a.isCustomPlaceholder, isCustomPlaceholder = _m === void 0 ? false : _m, checkParams = _a.checkParams, width = _a.width, hasParentError = _a.hasParentError, fromPrefix = _a.fromPrefix, labelTitle = _a.labelTitle, _o = _a.isModern, isModern = _o === void 0 ? true : _o, _p = _a.size, size = _p === void 0 ? "md" : _p, _q = _a.dropdownMinWidth, dropdownMinWidth = _q === void 0 ? 200 : _q, _r = _a.tableView, tableView = _r === void 0 ? false : _r, _s = _a.additionalColumns, additionalColumns = _s === void 0 ? [] : _s;
73
+ var _t = (0, react_1.useState)((_b = value === null || value === void 0 ? void 0 : value.name) !== null && _b !== void 0 ? _b : ""), inputValue = _t[0], setInputValue = _t[1];
74
+ var _u = (0, react_1.useState)(false), isHovered = _u[0], setIsHovered = _u[1];
75
+ var _v = (0, react_1.useState)(false), isLoading = _v[0], setIsLoading = _v[1];
76
+ var _w = (0, react_1.useState)(false), dropOpen = _w[0], setDropOpen = _w[1];
77
+ var _x = (0, react_1.useState)(disabled), isDisabled = _x[0], setIsDisabled = _x[1];
78
+ var _y = (0, react_1.useState)(false), showClose = _y[0], setShowClose = _y[1];
79
+ var _z = (0, react_1.useState)(false), showToolTip = _z[0], setShowTooltip = _z[1];
80
+ var _0 = (0, react_1.useState)(false), tooltipIsHovered = _0[0], setTooltipIsHovered = _0[1];
81
+ var _1 = (0, react_1.useState)([]), suggestions = _1[0], setSuggestions = _1[1];
82
82
  var inputRef = (0, react_1.useRef)(null);
83
83
  var adorementRef = (0, react_1.useRef)(null);
84
84
  var dropdownref = (0, react_1.useRef)(null);
85
85
  var dropBtnRef = (0, react_1.useRef)(null);
86
86
  var timerRef = (0, react_1.useRef)(0); // To fix the no results found issue on second type
87
- var _1 = (0, react_1.useState)(0), selectedIndex = _1[0], setSelectedIndex = _1[1];
87
+ var _2 = (0, react_1.useState)(0), selectedIndex = _2[0], setSelectedIndex = _2[1];
88
88
  var itemRefs = (0, react_1.useRef)([]);
89
89
  var scrollContainerRef = (0, react_1.useRef)(null);
90
- var _2 = (0, react_1.useState)({
90
+ var _3 = (0, react_1.useState)(false), refetchData = _3[0], setRefetchData = _3[1];
91
+ var _4 = (0, react_1.useState)({
91
92
  top: 0,
92
93
  left: 0,
93
94
  bottom: 0,
94
95
  right: 0,
95
- }), dropPosition = _2[0], setDropPosition = _2[1];
96
+ }), dropPosition = _4[0], setDropPosition = _4[1];
96
97
  var checkIncludes = function (mainString, subString, param1, param2, param3, param4) {
97
98
  var checkIncludesIfExists = function (mainString, substring) {
98
99
  return substring &&
99
100
  mainString &&
100
- typeof mainString === "string" &&
101
- typeof subString === "string"
101
+ typeof mainString === 'string' &&
102
+ typeof subString === 'string'
102
103
  ? mainString
103
104
  .toString()
104
105
  .toLowerCase()
@@ -108,21 +109,21 @@ var ReactAutoCompleteTableView = function (_a) {
108
109
  var checkArrayContains = function (strArray, param) { var _a; return (_a = strArray === null || strArray === void 0 ? void 0 : strArray.includes(param)) !== null && _a !== void 0 ? _a : false; };
109
110
  return (checkIncludesIfExists(mainString, subString) ||
110
111
  (!!checkParams &&
111
- ((checkArrayContains(checkParams, "param1") &&
112
+ ((checkArrayContains(checkParams, 'param1') &&
112
113
  checkIncludesIfExists(param1, subString)) ||
113
- (checkArrayContains(checkParams, "param2") &&
114
+ (checkArrayContains(checkParams, 'param2') &&
114
115
  checkIncludesIfExists(param2, subString)) ||
115
- (checkArrayContains(checkParams, "param3") &&
116
+ (checkArrayContains(checkParams, 'param3') &&
116
117
  checkIncludesIfExists(param3, subString)) ||
117
- (checkArrayContains(checkParams, "param4") &&
118
+ (checkArrayContains(checkParams, 'param4') &&
118
119
  checkIncludesIfExists(param4, subString)))));
119
120
  };
120
121
  var getHeight = function () {
121
122
  switch (size) {
122
- case "sm":
123
- return " h-[34px] ";
123
+ case 'sm':
124
+ return ' h-[34px] ';
124
125
  default:
125
- return " ";
126
+ return ' ';
126
127
  }
127
128
  };
128
129
  var handleChange = function (event) {
@@ -131,17 +132,17 @@ var ReactAutoCompleteTableView = function (_a) {
131
132
  setInputValue(value);
132
133
  handleValChange(value);
133
134
  if (!value) {
134
- setInputValue("");
135
- onChange({ id: undefined, name: "", from: 2 });
135
+ setInputValue('');
136
+ onChange({ id: undefined, name: '', from: 2 });
136
137
  }
137
138
  };
138
139
  var handleValChange = (0, react_1.useCallback)((0, debounce_1.debounce)(function (value) {
139
140
  setDropOpen(true);
140
- onChange({ id: undefined, name: "", from: 1 });
141
- if (value.trim() === "" && type === "auto_complete") {
141
+ onChange({ id: undefined, name: '', from: 1 });
142
+ if (value.trim() === '' && type === 'auto_complete') {
142
143
  setSuggestions([]);
143
144
  if (autoFilter) {
144
- handleDropData("*");
145
+ handleDropData('*');
145
146
  }
146
147
  else {
147
148
  setDropOpen(false);
@@ -155,25 +156,26 @@ var ReactAutoCompleteTableView = function (_a) {
155
156
  }, 200);
156
157
  }, isStaticList ? 0 : 1000), []);
157
158
  var handleDropData = function (value) {
158
- if (type === "auto_complete") {
159
+ if (type === 'auto_complete') {
159
160
  if (isStaticList) {
160
161
  loadStaticData();
161
- var filteredData_1 = value && value !== "*"
162
+ var filteredData_1 = value && value !== '*'
162
163
  ? data === null || data === void 0 ? void 0 : data.filter(function (item) {
163
164
  return checkIncludes(item.name, value, item.param1, item.param2, item.param3);
164
165
  })
165
166
  : data;
166
167
  setSuggestions(filteredData_1);
167
168
  }
168
- else
169
+ else {
169
170
  handlePickSuggestions(value);
171
+ }
170
172
  }
171
- else if ((type === "custom_select" || type === "custom_search_select") &&
173
+ else if ((type === 'custom_select' || type === 'custom_search_select') &&
172
174
  (!data || (data === null || data === void 0 ? void 0 : data.length) === 0)) {
173
175
  handlePickSuggestions();
174
176
  }
175
- else if (type === "custom_search_select" && data && (data === null || data === void 0 ? void 0 : data.length) > 0) {
176
- var filteredData_2 = value && value !== "*"
177
+ else if (type === 'custom_search_select' && data && (data === null || data === void 0 ? void 0 : data.length) > 0) {
178
+ var filteredData_2 = value && value !== '*'
177
179
  ? data.filter(function (item) {
178
180
  return checkIncludes(item.name, value, item.param1, item.param2, item.param3);
179
181
  })
@@ -196,6 +198,9 @@ var ReactAutoCompleteTableView = function (_a) {
196
198
  fetchedSuggestions = _a.sent();
197
199
  setSuggestions(fetchedSuggestions);
198
200
  setIsLoading(false);
201
+ if (autoDropdown) {
202
+ setRefetchData(true);
203
+ }
199
204
  return [3 /*break*/, 4];
200
205
  case 3:
201
206
  error_1 = _a.sent();
@@ -209,10 +214,10 @@ var ReactAutoCompleteTableView = function (_a) {
209
214
  var _a;
210
215
  if (!isDisabled) {
211
216
  (_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
212
- if (autoFilter && inputValue === "") {
213
- handleValChange("*");
217
+ if (autoFilter && inputValue === '') {
218
+ handleValChange('*');
214
219
  }
215
- else if ((type === "custom_select" || type === "custom_search_select") &&
220
+ else if ((type === 'custom_select' || type === 'custom_search_select') &&
216
221
  data &&
217
222
  (data === null || data === void 0 ? void 0 : data.length) > 0) {
218
223
  handleDropData();
@@ -238,21 +243,25 @@ var ReactAutoCompleteTableView = function (_a) {
238
243
  return __generator(this, function (_a) {
239
244
  switch (_a.label) {
240
245
  case 0:
241
- if (!!data) return [3 /*break*/, 4];
246
+ if (!(!data || (refetchData && autoDropdown && !isStaticList))) return [3 /*break*/, 4];
242
247
  data = [];
243
248
  if (!getData) return [3 /*break*/, 4];
244
249
  _a.label = 1;
245
250
  case 1:
246
251
  _a.trys.push([1, 3, , 4]);
247
252
  setIsLoading(true);
248
- handlePickSuggestions("*");
249
- return [4 /*yield*/, (getData === null || getData === void 0 ? void 0 : getData("*"))];
253
+ return [4 /*yield*/, (getData === null || getData === void 0 ? void 0 : getData('*'))];
250
254
  case 2:
251
255
  fetchedSuggestions = _a.sent();
252
256
  fetchedSuggestions === null || fetchedSuggestions === void 0 ? void 0 : fetchedSuggestions.forEach(function (element) {
253
257
  data === null || data === void 0 ? void 0 : data.push(element);
254
258
  });
259
+ setSuggestions(fetchedSuggestions);
255
260
  setIsLoading(false);
261
+ if (autoDropdown) {
262
+ setRefetchData(false);
263
+ timerRef.current = 1;
264
+ }
256
265
  return [3 /*break*/, 4];
257
266
  case 3:
258
267
  error_2 = _a.sent();
@@ -263,9 +272,9 @@ var ReactAutoCompleteTableView = function (_a) {
263
272
  });
264
273
  }); };
265
274
  (0, react_1.useEffect)(function () {
266
- document.addEventListener("click", handleClickOutside);
275
+ document.addEventListener('click', handleClickOutside);
267
276
  return function () {
268
- document.removeEventListener("click", handleClickOutside);
277
+ document.removeEventListener('click', handleClickOutside);
269
278
  };
270
279
  }, []);
271
280
  (0, react_1.useEffect)(function () {
@@ -275,10 +284,10 @@ var ReactAutoCompleteTableView = function (_a) {
275
284
  }, [autoFocus]);
276
285
  var onInputFocus = function () {
277
286
  if (!isDisabled) {
278
- if (autoFilter && inputValue === "") {
279
- handleValChange("*");
287
+ if (autoFilter && inputValue === '') {
288
+ handleValChange('*');
280
289
  }
281
- else if ((type === "custom_select" || type === "custom_search_select") &&
290
+ else if ((type === 'custom_select' || type === 'custom_search_select') &&
282
291
  data &&
283
292
  (data === null || data === void 0 ? void 0 : data.length) > 0) {
284
293
  handleDropData();
@@ -291,20 +300,32 @@ var ReactAutoCompleteTableView = function (_a) {
291
300
  }, [disabled]);
292
301
  var handleSuggestionClick = function (suggestion, index) {
293
302
  onChange(__assign(__assign(__assign({}, suggestion), { id: suggestion === null || suggestion === void 0 ? void 0 : suggestion.id, name: suggestion.name }), ((suggestion === null || suggestion === void 0 ? void 0 : suggestion.label) ? { label: suggestion === null || suggestion === void 0 ? void 0 : suggestion.label } : {})));
294
- if (type !== "custom_select")
303
+ if (type !== 'custom_select')
295
304
  setInputValue(suggestion.name);
296
305
  setDropOpen(false);
297
306
  setSelectedIndex(index);
298
307
  };
299
308
  var handleOpen = function (e) {
300
- if (!suggestions || (suggestions === null || suggestions === void 0 ? void 0 : suggestions.length) === 0) {
309
+ if (!suggestions || (suggestions === null || suggestions === void 0 ? void 0 : suggestions.length) === 0)
301
310
  handleDropData();
302
- return;
311
+ if (!isLoading) {
312
+ setDropOpen(!dropOpen);
313
+ if (type !== 'custom_select')
314
+ setInputValue('');
315
+ }
316
+ };
317
+ var handleOpenDropdown = function (e) {
318
+ if (!suggestions || (suggestions === null || suggestions === void 0 ? void 0 : suggestions.length) === 0 || refetchData) {
319
+ if (autoDropdown && (inputValue === '' || inputValue.trim() === '')) {
320
+ setSuggestions([]);
321
+ loadStaticData();
322
+ }
323
+ else if (!refetchData) {
324
+ handleDropData();
325
+ }
303
326
  }
304
327
  if (!isLoading) {
305
328
  setDropOpen(!dropOpen);
306
- if (type !== "custom_select")
307
- setInputValue("");
308
329
  }
309
330
  };
310
331
  var handleScroll = function () {
@@ -313,43 +334,46 @@ var ReactAutoCompleteTableView = function (_a) {
313
334
  (0, react_1.useEffect)(function () {
314
335
  if (!insideOpen) {
315
336
  setSelectedIndex(0);
316
- window.addEventListener("scroll", handleScroll);
317
- var mainElement = document.querySelector("main");
318
- mainElement === null || mainElement === void 0 ? void 0 : mainElement.addEventListener("scroll", handleScroll);
319
- var gridElements = document.querySelectorAll(".k-grid-content, .overflow-auto, .overflow-y-auto, .overflow-x-auto");
337
+ window.addEventListener('scroll', handleScroll);
338
+ var mainElement = document.querySelector('main');
339
+ mainElement === null || mainElement === void 0 ? void 0 : mainElement.addEventListener('scroll', handleScroll);
340
+ var gridElements = document.querySelectorAll('.k-grid-content, .overflow-auto, .overflow-y-auto, .overflow-x-auto');
320
341
  gridElements.forEach(function (gridElement) {
321
- gridElement.addEventListener("scroll", handleScroll);
342
+ gridElement.addEventListener('scroll', handleScroll);
322
343
  });
323
- window.addEventListener("resize", getDropPosition);
344
+ window.addEventListener('resize', getDropPosition);
324
345
  getDropPosition();
325
346
  return function () {
326
- window.removeEventListener("scroll", handleScroll);
327
- var mainElement = document.querySelector("main");
328
- mainElement === null || mainElement === void 0 ? void 0 : mainElement.removeEventListener("scroll", handleScroll);
329
- window.addEventListener("resize", getDropPosition);
330
- var gridElements = document.querySelectorAll(".k-grid-content");
347
+ window.removeEventListener('scroll', handleScroll);
348
+ var mainElement = document.querySelector('main');
349
+ mainElement === null || mainElement === void 0 ? void 0 : mainElement.removeEventListener('scroll', handleScroll);
350
+ window.addEventListener('resize', getDropPosition);
351
+ var gridElements = document.querySelectorAll('.k-grid-content');
331
352
  gridElements.forEach(function (gridElement) {
332
- gridElement.removeEventListener("scroll", handleScroll);
353
+ gridElement.removeEventListener('scroll', handleScroll);
333
354
  });
334
355
  };
335
356
  }
336
357
  }, [dropOpen]);
337
358
  var handleClear = function () {
338
359
  setDropOpen(false);
339
- setInputValue("");
340
- onChange({ id: undefined, name: "", from: 3 });
360
+ setInputValue('');
361
+ onChange({ id: undefined, name: '', from: 3 });
341
362
  onLabelClick();
363
+ if (autoDropdown) {
364
+ setRefetchData(true);
365
+ }
342
366
  };
343
367
  (0, react_1.useEffect)(function () {
344
368
  var _a;
345
- setInputValue((_a = value === null || value === void 0 ? void 0 : value.name) !== null && _a !== void 0 ? _a : "");
369
+ setInputValue((_a = value === null || value === void 0 ? void 0 : value.name) !== null && _a !== void 0 ? _a : '');
346
370
  }, [value === null || value === void 0 ? void 0 : value.name]);
347
371
  (0, react_1.useEffect)(function () {
348
372
  setSuggestions(data);
349
373
  }, [data]);
350
374
  var getErrors = function (err) {
351
375
  var _a, _b, _c, _d;
352
- var errMsg = "";
376
+ var errMsg = '';
353
377
  if (err.message) {
354
378
  errMsg = err === null || err === void 0 ? void 0 : err.message;
355
379
  }
@@ -364,44 +388,44 @@ var ReactAutoCompleteTableView = function (_a) {
364
388
  var generateClassName = function (type) {
365
389
  var className = propsClassName;
366
390
  switch (type) {
367
- case "input":
391
+ case 'input':
368
392
  className += " block text-common text-input-text font-normal px-3.5 w-full text-sm text-gray-900 bg-transparent border appearance-none peer h-10 rounded-[4px] disabled:text-input-disabled bg-white disabled:bg-disabled ".concat(label && isModern
369
- ? "placeholder-transparent"
370
- : "focus:placeholder-grey-secondary placeholder-input-label", " focus:placeholder-grey-secondary");
393
+ ? 'placeholder-transparent'
394
+ : 'focus:placeholder-grey-secondary placeholder-input-label', " focus:placeholder-grey-secondary");
371
395
  if (errors && errors[name]) {
372
396
  className +=
373
- " border-[#FDA29B] focus:border-error-[#FDA29B] focus:ring-[#FDA29B] focus:ring-3 focus:outline-[#FDA29B] input-outline";
397
+ ' border-[#FDA29B] focus:border-error-[#FDA29B] focus:ring-[#FDA29B] focus:ring-3 focus:outline-[#FDA29B] input-outline';
374
398
  }
375
399
  else {
376
400
  className +=
377
- " text-grey-dark border-input-light focus:border-blue-navy focus:outline-none focus:ring-0";
401
+ ' text-grey-dark border-input-light focus:border-blue-navy focus:outline-none focus:ring-0';
378
402
  }
379
403
  className += getHeight();
380
404
  break;
381
- case "label":
405
+ case 'label':
382
406
  className += " flex modern-input-label-truncate peer-focus:modern-input-peer-focus-label-size \n ".concat(isDisabled
383
- ? "cursor-pointer"
384
- : "cursor-text peer-focus:cursor-pointer", " ").concat(isDisabled && !checkIsEmptyField()
385
- ? "disabled-input-label-bg"
407
+ ? 'cursor-pointer'
408
+ : 'cursor-text peer-focus:cursor-pointer', " ").concat(isDisabled && !checkIsEmptyField()
409
+ ? 'disabled-input-label-bg'
386
410
  : !isDisabled || !checkIsEmptyField()
387
- ? "active-input-label-bg"
388
- : "", " absolute duration-300 transform -translate-y-4 top-2 z-1 origin-[0] px-0 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:-translate-y-4 start-[14px] rtl:peer-focus:translate-x-1/4 rtl:peer-focus:left-auto ").concat(isDisabled
389
- ? "cursor-pointer"
390
- : "cursor-text peer-focus:cursor-pointer", "\n ").concat(checkIsEmptyField()
391
- ? "modern-input-label-size"
392
- : "modern-input-peer-focus-label-size");
411
+ ? 'active-input-label-bg'
412
+ : '', " absolute duration-300 transform -translate-y-4 top-2 z-1 origin-[0] px-0 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:-translate-y-4 start-[14px] rtl:peer-focus:translate-x-1/4 rtl:peer-focus:left-auto ").concat(isDisabled
413
+ ? 'cursor-pointer'
414
+ : 'cursor-text peer-focus:cursor-pointer', "\n ").concat(checkIsEmptyField()
415
+ ? 'modern-input-label-size'
416
+ : 'modern-input-peer-focus-label-size');
393
417
  if (errors && errors[name]) {
394
- className += " text-error-light ";
418
+ className += ' text-error-light ';
395
419
  }
396
420
  else {
397
- className += " text-grey-dark peer-focus:text-blue-navy";
421
+ className += ' text-grey-dark peer-focus:text-blue-navy';
398
422
  }
399
423
  break;
400
- case "message":
401
- className = " text-error-icon ";
424
+ case 'message':
425
+ className = ' text-error-icon ';
402
426
  break;
403
- case "adorement":
404
- className += " absolute right-0 adorement gap-1 flex items-center ";
427
+ case 'adorement':
428
+ className += ' absolute right-0 adorement gap-1 flex items-center ';
405
429
  break;
406
430
  default:
407
431
  break;
@@ -425,28 +449,29 @@ var ReactAutoCompleteTableView = function (_a) {
425
449
  // const getPosition = () => {
426
450
  // return 'bottom'
427
451
  // }
428
- var filteredData = inputValue !== "*" &&
429
- inputValue !== "" &&
430
- type !== "custom_select" &&
452
+ var filteredData = inputValue !== '*' &&
453
+ inputValue !== '' &&
454
+ type !== 'custom_select' &&
431
455
  !noLocalFilter
432
456
  ? suggestions === null || suggestions === void 0 ? void 0 : suggestions.filter(function (item) {
433
457
  var _a, _b, _c, _d;
434
- return checkIncludes(item.name, inputValue, (_a = item.param1) !== null && _a !== void 0 ? _a : "", (_b = item.param2) !== null && _b !== void 0 ? _b : "", (_c = item.param3) !== null && _c !== void 0 ? _c : "", (_d = item.param4) !== null && _d !== void 0 ? _d : "");
458
+ return checkIncludes(item.name, inputValue, (_a = item.param1) !== null && _a !== void 0 ? _a : '', (_b = item.param2) !== null && _b !== void 0 ? _b : '', (_c = item.param3) !== null && _c !== void 0 ? _c : '', (_d = item.param4) !== null && _d !== void 0 ? _d : '');
435
459
  })
436
460
  : suggestions;
437
461
  var handleError = function (data) {
438
462
  var _a;
439
- if (getErrors(data[name]) === "required" ||
440
- getErrors(data[name]) === "Required") {
463
+ if (getErrors(data[name]) === 'required' ||
464
+ getErrors(data[name]) === 'Required') {
441
465
  return "".concat(label !== null && label !== void 0 ? label : labelTitle, " is ").concat(getErrors(data[name]));
442
466
  }
443
467
  else {
444
- return (_a = getErrors(data[name])) !== null && _a !== void 0 ? _a : "";
468
+ return (_a = getErrors(data[name])) !== null && _a !== void 0 ? _a : '';
445
469
  }
446
470
  };
447
471
  var getDropPosition = function () {
448
472
  if (!insideOpen && (inputRef === null || inputRef === void 0 ? void 0 : inputRef.current)) {
449
473
  var dropdownHeight = 200; // Assume the height of the dropdown is 200px, adjust as needed
474
+ var isMobile = window.innerWidth < 768; // Mobile breakpoint
450
475
  var inputRect = inputRef.current.getBoundingClientRect();
451
476
  var spaceBelow = window.innerHeight - (inputRect.bottom + window.scrollY);
452
477
  var spaceAbove = inputRect.top + window.scrollY;
@@ -458,18 +483,62 @@ var ReactAutoCompleteTableView = function (_a) {
458
483
  else {
459
484
  top_1 = inputRect.top + window.scrollY + inputRect.height + 2;
460
485
  }
486
+ var left = inputRect.left + window.scrollX;
487
+ var width_1 = inputRect.width + dropdownMinWidth;
488
+ var viewportWidth = window.innerWidth;
489
+ var viewportRight = window.scrollX + viewportWidth;
490
+ var inputRight = inputRect.right + window.scrollX;
491
+ // Check if dropdown would overflow on the right side
492
+ var dropdownRight = left + width_1;
493
+ var wouldOverflowRight = dropdownRight > viewportRight;
494
+ // If dropdown would overflow on the right (last column scenario), align from right to left
495
+ if (wouldOverflowRight) {
496
+ // Align right edge of dropdown with right edge of input
497
+ // Dropdown extends to the left from the input's right edge
498
+ var padding = isMobile ? 8 : 0;
499
+ left = inputRight - width_1;
500
+ // Ensure dropdown doesn't go off the left edge
501
+ var viewportLeft = window.scrollX + (isMobile ? 8 : 0);
502
+ if (left < viewportLeft) {
503
+ left = viewportLeft;
504
+ // Adjust width to fit within viewport
505
+ width_1 = Math.min(width_1, inputRight - left - padding);
506
+ }
507
+ }
508
+ // Handle mobile view - additional constraints
509
+ if (isMobile) {
510
+ // On mobile, constrain width to viewport with some padding
511
+ var mobilePadding = 16; // 8px padding on each side
512
+ var maxWidth = viewportWidth - mobilePadding;
513
+ // Use the smaller of: calculated width or max mobile width
514
+ width_1 = Math.min(width_1, maxWidth);
515
+ // Adjust left position to prevent overflow
516
+ var rightEdge = left + width_1;
517
+ var mobileViewportRight = window.scrollX + viewportWidth - mobilePadding / 2;
518
+ if (rightEdge > mobileViewportRight) {
519
+ // Align to right edge with padding
520
+ left = mobileViewportRight - width_1;
521
+ }
522
+ // Ensure dropdown doesn't go off the left edge
523
+ var viewportLeft = window.scrollX + mobilePadding / 2;
524
+ if (left < viewportLeft) {
525
+ left = viewportLeft;
526
+ // Adjust width if needed to fit
527
+ width_1 = Math.min(width_1, mobileViewportRight - left);
528
+ }
529
+ }
461
530
  setDropPosition({
462
- left: inputRect.left + window.scrollX,
531
+ left: left,
463
532
  top: top_1,
464
533
  bottom: bottom,
465
- width: inputRect.width + dropdownMinWidth,
534
+ width: width_1,
466
535
  });
467
536
  }
468
537
  return undefined;
469
538
  };
470
- var _3 = (0, react_1.useState)(false), showNoResults = _3[0], setShowNoResults = _3[1];
539
+ var _5 = (0, react_1.useState)(false), showNoResults = _5[0], setShowNoResults = _5[1];
471
540
  (0, react_1.useEffect)(function () {
472
- if (inputValue &&
541
+ if ((inputValue || autoDropdown) &&
473
542
  (filteredData === null || filteredData === void 0 ? void 0 : filteredData.length) === 0 &&
474
543
  !isLoading &&
475
544
  timerRef.current === 1) {
@@ -485,14 +554,14 @@ var ReactAutoCompleteTableView = function (_a) {
485
554
  var handleKeyDown = function (e) {
486
555
  if (!dropOpen)
487
556
  return;
488
- var nextIndex = e.key === "ArrowDown"
557
+ var nextIndex = e.key === 'ArrowDown'
489
558
  ? (selectedIndex + 1) % filteredData.length
490
- : e.key === "ArrowUp"
559
+ : e.key === 'ArrowUp'
491
560
  ? (selectedIndex - 1 + filteredData.length) % filteredData.length
492
561
  : selectedIndex;
493
562
  switch (e.key) {
494
- case "ArrowDown":
495
- case "ArrowUp":
563
+ case 'ArrowDown':
564
+ case 'ArrowUp':
496
565
  e.preventDefault();
497
566
  // Update index first
498
567
  setSelectedIndex(nextIndex);
@@ -514,11 +583,11 @@ var ReactAutoCompleteTableView = function (_a) {
514
583
  }
515
584
  });
516
585
  break;
517
- case "Enter":
586
+ case 'Enter':
518
587
  e.preventDefault();
519
588
  handleSuggestionClick(filteredData[selectedIndex], selectedIndex);
520
589
  break;
521
- case "Escape":
590
+ case 'Escape':
522
591
  e.preventDefault();
523
592
  setDropOpen(false);
524
593
  break;
@@ -527,9 +596,9 @@ var ReactAutoCompleteTableView = function (_a) {
527
596
  }
528
597
  };
529
598
  if ((filteredData === null || filteredData === void 0 ? void 0 : filteredData.length) > 0 && !isLoading) {
530
- window.addEventListener("keydown", handleKeyDown);
599
+ window.addEventListener('keydown', handleKeyDown);
531
600
  return function () {
532
- window.removeEventListener("keydown", handleKeyDown);
601
+ window.removeEventListener('keydown', handleKeyDown);
533
602
  };
534
603
  }
535
604
  }, [
@@ -541,9 +610,9 @@ var ReactAutoCompleteTableView = function (_a) {
541
610
  dropOpen,
542
611
  ]);
543
612
  var setDropDown = function () {
544
- return (((filteredData === null || filteredData === void 0 ? void 0 : filteredData.length) > 0 || showNoResults) && ((0, jsx_runtime_1.jsx)("div", __assign({ className: "autocomplete-suggections absolute bg-white shadow-gray-300 shadow-md border border-grey-light z-50 mt-9", style: dropPosition }, { children: (0, jsx_runtime_1.jsx)("ul", __assign({ className: "h-auto max-h-40 overflow-auto w-full ".concat(tableView ? '' : 'py-1.5'), ref: scrollContainerRef }, { children: (filteredData === null || filteredData === void 0 ? void 0 : filteredData.length) > 0 ? ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: filteredData.map(function (suggestion, index) { return ((0, jsx_runtime_1.jsx)("li", __assign({ className: "".concat((value === null || value === void 0 ? void 0 : value.id) === (suggestion === null || suggestion === void 0 ? void 0 : suggestion.id)
545
- ? "bg-blue-navy text-white"
546
- : "".concat(index === selectedIndex ? "is-selected" : "", " hover:bg-table-hover"), " cursor-pointer text-xxs qbs-autocomplete-suggections-items ").concat(tableView
613
+ return (((filteredData === null || filteredData === void 0 ? void 0 : filteredData.length) > 0 || showNoResults) && ((0, jsx_runtime_1.jsx)("div", __assign({ style: dropPosition, className: "autocomplete-suggections autocomplete-suggections-tableview absolute bg-white shadow-gray-300 shadow-md border border-grey-light z-50 mt-9" }, { children: (0, jsx_runtime_1.jsx)("ul", __assign({ className: "h-auto max-h-40 overflow-auto w-full ".concat(tableView ? '' : 'py-1.5'), ref: scrollContainerRef }, { children: (filteredData === null || filteredData === void 0 ? void 0 : filteredData.length) > 0 ? ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: filteredData.map(function (suggestion, index) { return ((0, jsx_runtime_1.jsx)("li", __assign({ className: "".concat((value === null || value === void 0 ? void 0 : value.id) === (suggestion === null || suggestion === void 0 ? void 0 : suggestion.id)
614
+ ? 'bg-blue-navy text-white'
615
+ : "".concat(index === selectedIndex ? 'is-selected' : '', " hover:bg-table-hover"), " cursor-pointer text-xxs qbs-autocomplete-suggections-items ").concat(tableView
547
616
  ? "border-b border-grey-light last:border-b-0"
548
617
  : "p-1 ps-3.5 pl-[10px]"), "data-testid": suggestion.name, onClick: function () { return handleSuggestionClick(suggestion, index); }, tabIndex: index, ref: function (el) { return (itemRefs.current[index] = el); } }, { children: (0, jsx_runtime_1.jsx)("ul", __assign({ className: "flex items-stretch w-full list-none p-0 m-0" }, { children: (function () {
549
618
  // Sort columns by order if specified, otherwise maintain array order
@@ -559,10 +628,9 @@ var ReactAutoCompleteTableView = function (_a) {
559
628
  var columnsAfter = sortedColumns.filter(function (col) { return col.order === undefined || col.order >= 0; });
560
629
  // Determine if first column needs a separator
561
630
  var hasColumnsAfter = columnsAfter.length > 0;
562
- var hasColumnsBefore = columnsBefore.length > 0;
563
631
  return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [columnsBefore.map(function (column, colIndex) {
564
632
  var hasValue = suggestion === null || suggestion === void 0 ? void 0 : suggestion[column.key];
565
- var isLastBefore = colIndex === columnsBefore.length - 1 && !hasColumnsAfter;
633
+ var isLastBefore = false;
566
634
  return hasValue ? ((0, jsx_runtime_1.jsx)("li", __assign({ className: "".concat(column.width ? 'flex-shrink-0' : 'flex-1', " min-w-0 px-3 ").concat(tableView ? 'py-2' : '', " ").concat(!isLastBefore ? 'border-r border-grey-light' : '', " break-words flex flex-col"), style: column.width ? { width: "".concat(column.width, "px") } : undefined }, { children: (0, jsx_runtime_1.jsx)("span", __assign({ className: "block whitespace-normal" }, { children: suggestion === null || suggestion === void 0 ? void 0 : suggestion[column.key] })) }), column.key)) : null;
567
635
  }), (0, jsx_runtime_1.jsx)("li", __assign({ className: "flex-1 min-w-0 px-3 ".concat(tableView ? 'py-2' : '', " ").concat(hasColumnsAfter ? 'border-r border-grey-light' : '', " break-words flex flex-col") }, { children: (0, jsx_runtime_1.jsx)("span", __assign({ className: "block whitespace-normal" }, { children: (suggestion === null || suggestion === void 0 ? void 0 : suggestion.label) ? suggestion === null || suggestion === void 0 ? void 0 : suggestion.label : suggestion.name })) })), columnsAfter.map(function (column, colIndex) {
568
636
  var hasValue = suggestion === null || suggestion === void 0 ? void 0 : suggestion[column.key];
@@ -591,7 +659,7 @@ var ReactAutoCompleteTableView = function (_a) {
591
659
  }, [isHovered]);
592
660
  (0, react_1.useEffect)(function () {
593
661
  var shouldShowClose = (value === null || value === void 0 ? void 0 : value.name) &&
594
- ((value === null || value === void 0 ? void 0 : value.id) || String(value === null || value === void 0 ? void 0 : value.id) === "0") &&
662
+ ((value === null || value === void 0 ? void 0 : value.id) || String(value === null || value === void 0 ? void 0 : value.id) === '0') &&
595
663
  !disabled &&
596
664
  !readOnly &&
597
665
  isClose;
@@ -605,7 +673,7 @@ var ReactAutoCompleteTableView = function (_a) {
605
673
  if (inputRef.current) {
606
674
  var _a = inputRef.current, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth, value_1 = _a.value;
607
675
  // Check for overflow only when there's content
608
- if (value_1.trim() !== "") {
676
+ if (value_1.trim() !== '') {
609
677
  setShowTooltip(scrollWidth > clientWidth + 2);
610
678
  }
611
679
  else {
@@ -614,12 +682,12 @@ var ReactAutoCompleteTableView = function (_a) {
614
682
  }
615
683
  };
616
684
  if (inputRef.current) {
617
- inputRef.current.addEventListener("input", checkOverflow);
685
+ inputRef.current.addEventListener('input', checkOverflow);
618
686
  checkOverflow(); // Initial check
619
687
  }
620
688
  return function () {
621
689
  if (inputRef.current) {
622
- inputRef.current.removeEventListener("input", checkOverflow);
690
+ inputRef.current.removeEventListener('input', checkOverflow);
623
691
  }
624
692
  };
625
693
  }, [inputValue]);
@@ -629,25 +697,28 @@ var ReactAutoCompleteTableView = function (_a) {
629
697
  var handleMouseLeave = function () {
630
698
  setTooltipIsHovered(false);
631
699
  };
632
- return ((0, jsx_runtime_1.jsxs)("div", __assign({ id: id ? "autocomplete-container-".concat(id) : "autocomplete-container-".concat(name), className: " flex-grow ".concat(fullWidth ? "w-full" : "w-auto"), ref: dropdownref }, { children: [label && !isModern && ((0, jsx_runtime_1.jsx)("div", __assign({ className: "mb-3" }, { children: (0, jsx_runtime_1.jsxs)("label", __assign({ className: "text-xs font-medium" }, { children: [label, required ? (0, jsx_runtime_1.jsx)("span", __assign({ className: "text-error" }, { children: " *" })) : (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {})] })) }))), (0, jsx_runtime_1.jsxs)("div", __assign({ className: "tooltip-container" }, { children: [isHovered && errors && errors[name] && ((0, jsx_runtime_1.jsxs)("span", __assign({ className: "tooltip" }, { children: [handleError(errors), " "] }))), tooltipIsHovered && showToolTip && !dropOpen && inputValue && ((0, jsx_runtime_1.jsx)("div", __assign({ className: "tooltip-info" }, { children: inputValue }))), (0, jsx_runtime_1.jsxs)("div", __assign({ className: "flex relative ".concat(fullWidth ? "w-full" : "w-auto"), style: { width: width } }, { children: [(0, jsx_runtime_1.jsxs)("div", __assign({ className: "relative w-full", onMouseEnter: function () { return handleMouseEnter(); }, onMouseLeave: function () { return handleMouseLeave(); } }, { children: [(0, jsx_runtime_1.jsx)("input", { type: "text", readOnly: readOnly !== null && readOnly !== void 0 ? readOnly : type === "custom_select", value: inputValue ? inputValue : "", onBlur: handleClearInputValue, autoComplete: "off", disabled: disabled, ref: inputRef, id: id ? "custom-autocomplete-".concat(id) : "custom-autocomplete-".concat(name), "data-testid": "custom-autocomplete", "aria-describedby": id, style: __assign({ paddingRight: getInnerWidth() }, (fromPrefix
700
+ return ((0, jsx_runtime_1.jsxs)("div", __assign({ id: id ? "autocomplete-container-".concat(id) : "autocomplete-container-".concat(name), className: " flex-grow ".concat(fullWidth ? 'w-full' : 'w-auto'), ref: dropdownref }, { children: [label && !isModern && ((0, jsx_runtime_1.jsx)("div", __assign({ className: "mb-3" }, { children: (0, jsx_runtime_1.jsxs)("label", __assign({ className: "text-xs font-medium" }, { children: [label, required ? (0, jsx_runtime_1.jsx)("span", __assign({ className: "text-error" }, { children: " *" })) : (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {})] })) }))), (0, jsx_runtime_1.jsxs)("div", __assign({ className: "tooltip-container" }, { children: [isHovered && errors && errors[name] && ((0, jsx_runtime_1.jsxs)("span", __assign({ className: "tooltip" }, { children: [handleError(errors), " "] }))), tooltipIsHovered && showToolTip && !dropOpen && inputValue && ((0, jsx_runtime_1.jsx)("div", __assign({ className: "tooltip-info" }, { children: inputValue }))), (0, jsx_runtime_1.jsxs)("div", __assign({ className: "flex relative ".concat(fullWidth ? 'w-full' : 'w-auto'), style: { width: width } }, { children: [(0, jsx_runtime_1.jsxs)("div", __assign({ className: "relative w-full", onMouseEnter: function () { return handleMouseEnter(); }, onMouseLeave: function () { return handleMouseLeave(); } }, { children: [(0, jsx_runtime_1.jsx)("input", { type: "text", readOnly: readOnly !== null && readOnly !== void 0 ? readOnly : type === 'custom_select', value: inputValue ? inputValue : '', onBlur: handleClearInputValue, autoComplete: "off", disabled: disabled, ref: inputRef, id: id ? "custom-autocomplete-".concat(id) : "custom-autocomplete-".concat(name), "data-testid": "custom-autocomplete", "aria-describedby": id, style: __assign({ paddingRight: getInnerWidth() }, (fromPrefix
633
701
  ? {
634
702
  borderRight: getBorderRight(),
635
703
  borderTopRightRadius: 0,
636
704
  borderBottomRightRadius: 0,
637
705
  }
638
- : {})), className: " ".concat(generateClassName("input")), onChange: handleChange, placeholder: type === "auto_complete"
706
+ : {})), className: " ".concat(generateClassName('input')), onChange: handleChange, placeholder: type === 'auto_complete'
639
707
  ? placeholder && isCustomPlaceholder
640
708
  ? placeholder
641
- : "Type to search"
642
- : placeholder !== null && placeholder !== void 0 ? placeholder : "--Select--", onFocus: onInputFocus, onClick: function (e) {
643
- if (type === "custom_select") {
709
+ : 'Type to search'
710
+ : placeholder !== null && placeholder !== void 0 ? placeholder : '--Select--', onFocus: onInputFocus, onClick: function (e) {
711
+ if (type === 'custom_select') {
644
712
  setDropOpen(!dropOpen);
645
713
  handleOpen(e);
646
714
  }
647
715
  else {
648
- setDropOpen(!dropOpen);
716
+ if (dropOpen || (filteredData === null || filteredData === void 0 ? void 0 : filteredData.length) > 0)
717
+ setDropOpen(!dropOpen);
649
718
  }
650
- } }), isModern && ((0, jsx_runtime_1.jsxs)("label", __assign({ htmlFor: id, onClick: function () { return onLabelClick(); }, className: generateClassName("label") }, { children: [label ? (0, jsx_runtime_1.jsx)("span", __assign({ className: "truncate" }, { children: label })) : "", required ? (0, jsx_runtime_1.jsx)("span", __assign({ className: "text-error" }, { children: " *" })) : (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {})] })))] })), (0, jsx_runtime_1.jsx)("div", __assign({ className: "flex items-center justify-center " }, { children: (0, jsx_runtime_1.jsxs)("div", __assign({ ref: adorementRef, className: "".concat(generateClassName("adorement"), " qbs-autocomplete-adorement custom-dorpdown-adorement mr-[1px] ").concat(isLoading ? "bg-white" : "") }, { children: [showClose && ((0, jsx_runtime_1.jsx)("button", __assign({ onClick: function () { return handleClear(); }, className: " text-table-bodyColor text-[#667085]", "aria-label": "close", type: "button", id: "autocomplete-close-icon" }, { children: (0, jsx_runtime_1.jsx)(customIcons_1.default, { name: "close", type: "large-m" }) }))), isLoading && (0, jsx_runtime_1.jsx)(Spinner_1.default, {}), type !== "auto_complete" && !disabled && !readOnly && ((0, jsx_runtime_1.jsx)("button", __assign({ disabled: disabled !== null && disabled !== void 0 ? disabled : readOnly, onClick: function (e) { return handleOpen(e); }, onBlur: handleClose, className: " text-[#667085] focus-visible:outline-slate-100", "data-testid": "drop-arrow", type: "button", id: "autocomplete-drop-icon", ref: dropBtnRef }, { children: !dropOpen ? ((0, jsx_runtime_1.jsx)(icons_1.DropArrow, { uniqueDropArrowId: "drop-arrow-icon" })) : ((0, jsx_runtime_1.jsx)(icons_1.DropArrow, { className: "rotate-180", uniqueDropArrowId: "drop-arrow-icon" })) }))), errors && errors[name] && ((0, jsx_runtime_1.jsx)("div", __assign({ className: " text-error-label relative cursor-pointer ".concat(generateClassName("message")), onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); } }, { children: (0, jsx_runtime_1.jsx)(customIcons_1.default, { name: "alert", type: "medium" }) })))] })) })), dropOpen && (!isLoading || (filteredData === null || filteredData === void 0 ? void 0 : filteredData.length) > 0) && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: insideOpen ? setDropDown() : (0, jsx_runtime_1.jsx)(portal_1.default, { children: setDropDown() }) }))] }))] }))] })));
719
+ } }), isModern && ((0, jsx_runtime_1.jsxs)("label", __assign({ htmlFor: id, onClick: function () { return onLabelClick(); }, className: generateClassName('label') }, { children: [label ? (0, jsx_runtime_1.jsx)("span", __assign({ className: "truncate" }, { children: label })) : '', required ? (0, jsx_runtime_1.jsx)("span", __assign({ className: "text-error" }, { children: " *" })) : (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {})] })))] })), (0, jsx_runtime_1.jsx)("div", __assign({ className: "flex items-center justify-center autocomplete-adorement-wrapper" }, { children: (0, jsx_runtime_1.jsxs)("div", __assign({ ref: adorementRef, className: "".concat(generateClassName('adorement'), " qbs-autocomplete-adorement auto-dorpdown-adorement mr-[1px] ").concat(isLoading ? 'bg-white' : '') }, { children: [showClose && ((0, jsx_runtime_1.jsx)("button", __assign({ onClick: function () { return handleClear(); }, className: " text-table-bodyColor text-[#667085]", "aria-label": "close", type: "button", id: "autocomplete-close-icon" }, { children: (0, jsx_runtime_1.jsx)(customIcons_1.default, { name: "close", type: "large-m" }) }))), isLoading && (0, jsx_runtime_1.jsx)(Spinner_1.default, {}), (type !== 'auto_complete' || autoDropdown) &&
720
+ !disabled &&
721
+ !readOnly && ((0, jsx_runtime_1.jsx)("button", __assign({ disabled: disabled !== null && disabled !== void 0 ? disabled : readOnly, onClick: function (e) { return handleOpenDropdown(e); }, onBlur: handleClose, className: " text-[#667085] focus-visible:outline-slate-100", "data-testid": "drop-arrow", type: "button", id: "autocomplete-drop-icon", ref: dropBtnRef }, { children: !dropOpen ? (autoDropdown ? ((0, jsx_runtime_1.jsx)(icons_1.AllDropArrow, { type: "down", uniqueId: "all-dropdow-arrow-icon", className: "all-dropdow-arrow-icon" })) : ((0, jsx_runtime_1.jsx)(icons_1.DropArrow, { uniqueDropArrowId: "drop-arrow-icon" }))) : autoDropdown ? ((0, jsx_runtime_1.jsx)(icons_1.AllDropArrow, { type: "up", uniqueId: "all-dropdow-arrow-icon", className: "all-dropdow-arrow-icon" })) : ((0, jsx_runtime_1.jsx)(icons_1.DropArrow, { className: "rotate-180", uniqueDropArrowId: "drop-arrow-icon" })) }))), errors && errors[name] && ((0, jsx_runtime_1.jsx)("div", __assign({ className: " text-error-label relative cursor-pointer ".concat(generateClassName('message')), onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); } }, { children: (0, jsx_runtime_1.jsx)(customIcons_1.default, { name: "alert", type: "medium" }) })))] })) })), dropOpen && (!isLoading || (filteredData === null || filteredData === void 0 ? void 0 : filteredData.length) > 0) && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: insideOpen ? setDropDown() : (0, jsx_runtime_1.jsx)(portal_1.default, { children: setDropDown() }) }))] }))] }))] })));
651
722
  };
652
723
  exports.default = ReactAutoCompleteTableView;
653
724
  //# sourceMappingURL=ReactAutoCompleteTableView.js.map