react-core-ts 1.3.37 → 1.3.39

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.
@@ -1,12 +1,12 @@
1
- import React, { useCallback, useEffect, useRef, useState } from "react";
2
- import { FieldErrors } from "react-hook-form";
1
+ import React, { useCallback, useEffect, useRef, useState } from 'react';
2
+ import { FieldErrors } from 'react-hook-form';
3
3
 
4
- import CustomIcons from "./components/customIcons";
5
- import Spinner from "./components/loader/Spinner";
6
- import Portal from "./components/portal";
7
- import { debounce } from "./utilities/debounce";
8
- import { applyPositionClass } from "./utilities/getPosition";
9
- import { DropArrow } from "./utilities/icons";
4
+ import CustomIcons from './components/customIcons';
5
+ import Spinner from './components/loader/Spinner';
6
+ import Portal from './components/portal';
7
+ import { debounce } from './utilities/debounce';
8
+ import { applyPositionClass } from './utilities/getPosition';
9
+ import { DropArrow } from './utilities/icons';
10
10
 
11
11
  type valueProps = {
12
12
  id?: string | number;
@@ -30,7 +30,7 @@ interface AutoSuggestionInputProps {
30
30
  value?: valueProps;
31
31
  onChange: (value?: valueProps) => void;
32
32
  data?: any[];
33
- type?: "custom_select" | "auto_complete" | "custom_search_select";
33
+ type?: 'custom_select' | 'auto_complete' | 'custom_search_select';
34
34
  placeholder?: string;
35
35
  getData?: ((key?: string) => Promise<any>) | ((key?: string) => any);
36
36
  errors?: FieldErrors;
@@ -66,7 +66,7 @@ const ModernAutoComplete: React.FC<AutoSuggestionInputProps> = ({
66
66
  placeholder,
67
67
  id,
68
68
  className: propsClassName,
69
- type = "custom_select",
69
+ type = 'custom_select',
70
70
  readOnly,
71
71
  disabled = false,
72
72
  value,
@@ -83,7 +83,7 @@ const ModernAutoComplete: React.FC<AutoSuggestionInputProps> = ({
83
83
  labelTitle,
84
84
  isModern = true,
85
85
  }) => {
86
- const [inputValue, setInputValue] = useState<any>(value?.name ?? "");
86
+ const [inputValue, setInputValue] = useState<any>(value?.name ?? '');
87
87
  const [isHovered, setIsHovered] = useState<boolean>(false);
88
88
  const [isLoading, setIsLoading] = useState<boolean>(false);
89
89
  const [dropOpen, setDropOpen] = useState<boolean>(false);
@@ -118,8 +118,8 @@ const ModernAutoComplete: React.FC<AutoSuggestionInputProps> = ({
118
118
  ) => {
119
119
  return substring &&
120
120
  mainString &&
121
- typeof mainString === "string" &&
122
- typeof subString === "string"
121
+ typeof mainString === 'string' &&
122
+ typeof subString === 'string'
123
123
  ? mainString
124
124
  .toString()
125
125
  .toLowerCase()
@@ -134,13 +134,13 @@ const ModernAutoComplete: React.FC<AutoSuggestionInputProps> = ({
134
134
  return (
135
135
  checkIncludesIfExists(mainString, subString) ||
136
136
  (!!checkParams &&
137
- ((checkArrayContains(checkParams, "param1") &&
137
+ ((checkArrayContains(checkParams, 'param1') &&
138
138
  checkIncludesIfExists(param1, subString)) ||
139
- (checkArrayContains(checkParams, "param2") &&
139
+ (checkArrayContains(checkParams, 'param2') &&
140
140
  checkIncludesIfExists(param2, subString)) ||
141
- (checkArrayContains(checkParams, "param3") &&
141
+ (checkArrayContains(checkParams, 'param3') &&
142
142
  checkIncludesIfExists(param3, subString)) ||
143
- (checkArrayContains(checkParams, "param4") &&
143
+ (checkArrayContains(checkParams, 'param4') &&
144
144
  checkIncludesIfExists(param4, subString))))
145
145
  );
146
146
  };
@@ -152,8 +152,8 @@ const ModernAutoComplete: React.FC<AutoSuggestionInputProps> = ({
152
152
  setInputValue(value);
153
153
  handleValChange(value);
154
154
  if (!value) {
155
- setInputValue("");
156
- onChange({ id: undefined, name: "", from: 2 });
155
+ setInputValue('');
156
+ onChange({ id: undefined, name: '', from: 2 });
157
157
  }
158
158
  };
159
159
 
@@ -161,11 +161,11 @@ const ModernAutoComplete: React.FC<AutoSuggestionInputProps> = ({
161
161
  debounce(
162
162
  (value: string) => {
163
163
  setDropOpen(true);
164
- onChange({ id: undefined, name: "", from: 1 });
165
- if (value.trim() === "" && type === "auto_complete") {
164
+ onChange({ id: undefined, name: '', from: 1 });
165
+ if (value.trim() === '' && type === 'auto_complete') {
166
166
  setSuggestions([]);
167
167
  if (autoFilter) {
168
- handleDropData("*");
168
+ handleDropData('*');
169
169
  } else {
170
170
  setDropOpen(false);
171
171
  }
@@ -181,11 +181,11 @@ const ModernAutoComplete: React.FC<AutoSuggestionInputProps> = ({
181
181
  []
182
182
  );
183
183
  const handleDropData = (value?: string) => {
184
- if (type === "auto_complete") {
184
+ if (type === 'auto_complete') {
185
185
  if (isStaticList) {
186
186
  loadStaticData();
187
187
  const filteredData =
188
- value && value !== "*"
188
+ value && value !== '*'
189
189
  ? data?.filter((item) =>
190
190
  checkIncludes(
191
191
  item.name,
@@ -199,13 +199,13 @@ const ModernAutoComplete: React.FC<AutoSuggestionInputProps> = ({
199
199
  setSuggestions(filteredData);
200
200
  } else handlePickSuggestions(value);
201
201
  } else if (
202
- (type === "custom_select" || type === "custom_search_select") &&
202
+ (type === 'custom_select' || type === 'custom_search_select') &&
203
203
  (!data || data?.length === 0)
204
204
  ) {
205
205
  handlePickSuggestions();
206
- } else if (type === "custom_search_select" && data && data?.length > 0) {
206
+ } else if (type === 'custom_search_select' && data && data?.length > 0) {
207
207
  const filteredData =
208
- value && value !== "*"
208
+ value && value !== '*'
209
209
  ? data.filter((item) =>
210
210
  checkIncludes(
211
211
  item.name,
@@ -235,10 +235,10 @@ const ModernAutoComplete: React.FC<AutoSuggestionInputProps> = ({
235
235
  const onLabelClick = () => {
236
236
  if (!isDisabled) {
237
237
  inputRef?.current?.focus();
238
- if (autoFilter && inputValue === "") {
239
- handleValChange("*");
238
+ if (autoFilter && inputValue === '') {
239
+ handleValChange('*');
240
240
  } else if (
241
- (type === "custom_select" || type === "custom_search_select") &&
241
+ (type === 'custom_select' || type === 'custom_search_select') &&
242
242
  data &&
243
243
  data?.length > 0
244
244
  ) {
@@ -265,8 +265,8 @@ const ModernAutoComplete: React.FC<AutoSuggestionInputProps> = ({
265
265
  if (getData) {
266
266
  try {
267
267
  setIsLoading(true);
268
- handlePickSuggestions("*");
269
- const fetchedSuggestions = await getData?.("*");
268
+ handlePickSuggestions('*');
269
+ const fetchedSuggestions = await getData?.('*');
270
270
  fetchedSuggestions?.forEach((element: any) => {
271
271
  data?.push(element);
272
272
  });
@@ -278,9 +278,9 @@ const ModernAutoComplete: React.FC<AutoSuggestionInputProps> = ({
278
278
  }
279
279
  };
280
280
  useEffect(() => {
281
- document.addEventListener("click", handleClickOutside);
281
+ document.addEventListener('click', handleClickOutside);
282
282
  return () => {
283
- document.removeEventListener("click", handleClickOutside);
283
+ document.removeEventListener('click', handleClickOutside);
284
284
  };
285
285
  }, []);
286
286
 
@@ -291,10 +291,10 @@ const ModernAutoComplete: React.FC<AutoSuggestionInputProps> = ({
291
291
  }, [autoFocus]);
292
292
  const onInputFocus = () => {
293
293
  if (!isDisabled) {
294
- if (autoFilter && inputValue === "") {
295
- handleValChange("*");
294
+ if (autoFilter && inputValue === '') {
295
+ handleValChange('*');
296
296
  } else if (
297
- (type === "custom_select" || type === "custom_search_select") &&
297
+ (type === 'custom_select' || type === 'custom_search_select') &&
298
298
  data &&
299
299
  data?.length > 0
300
300
  ) {
@@ -313,14 +313,14 @@ const ModernAutoComplete: React.FC<AutoSuggestionInputProps> = ({
313
313
  name: suggestion.name,
314
314
  ...(suggestion?.label ? { label: suggestion?.label } : {}),
315
315
  });
316
- if (type !== "custom_select") setInputValue(suggestion.name);
316
+ if (type !== 'custom_select') setInputValue(suggestion.name);
317
317
  setDropOpen(false);
318
318
  };
319
319
  const handleOpen = (e: any) => {
320
320
  if (!suggestions || suggestions?.length === 0) handleDropData();
321
321
  if (!isLoading) {
322
322
  setDropOpen(!dropOpen);
323
- if (type !== "custom_select") setInputValue("");
323
+ if (type !== 'custom_select') setInputValue('');
324
324
  }
325
325
  };
326
326
 
@@ -330,27 +330,27 @@ const ModernAutoComplete: React.FC<AutoSuggestionInputProps> = ({
330
330
 
331
331
  useEffect(() => {
332
332
  if (!insideOpen) {
333
- window.addEventListener("scroll", handleScroll);
333
+ window.addEventListener('scroll', handleScroll);
334
334
 
335
- const mainElement = document.querySelector("main");
336
- mainElement?.addEventListener("scroll", handleScroll);
335
+ const mainElement = document.querySelector('main');
336
+ mainElement?.addEventListener('scroll', handleScroll);
337
337
 
338
338
  const gridElements = document.querySelectorAll(
339
- ".k-grid-content, .overflow-auto, .overflow-y-auto, .overflow-x-auto"
339
+ '.k-grid-content, .overflow-auto, .overflow-y-auto, .overflow-x-auto'
340
340
  );
341
341
  gridElements.forEach((gridElement: any) => {
342
- gridElement.addEventListener("scroll", handleScroll);
342
+ gridElement.addEventListener('scroll', handleScroll);
343
343
  });
344
- window.addEventListener("resize", getDropPosition);
344
+ window.addEventListener('resize', getDropPosition);
345
345
  getDropPosition();
346
346
  return () => {
347
- window.removeEventListener("scroll", handleScroll);
348
- const mainElement = document.querySelector("main");
349
- mainElement?.removeEventListener("scroll", handleScroll);
350
- window.addEventListener("resize", getDropPosition);
351
- const gridElements = document.querySelectorAll(".k-grid-content");
347
+ window.removeEventListener('scroll', handleScroll);
348
+ const mainElement = document.querySelector('main');
349
+ mainElement?.removeEventListener('scroll', handleScroll);
350
+ window.addEventListener('resize', getDropPosition);
351
+ const gridElements = document.querySelectorAll('.k-grid-content');
352
352
  gridElements.forEach((gridElement: any) => {
353
- gridElement.removeEventListener("scroll", handleScroll);
353
+ gridElement.removeEventListener('scroll', handleScroll);
354
354
  });
355
355
  };
356
356
  }
@@ -358,13 +358,13 @@ const ModernAutoComplete: React.FC<AutoSuggestionInputProps> = ({
358
358
 
359
359
  const handleClear = () => {
360
360
  setDropOpen(false);
361
- setInputValue("");
362
- onChange({ id: undefined, name: "", from: 3 });
361
+ setInputValue('');
362
+ onChange({ id: undefined, name: '', from: 3 });
363
363
  onLabelClick();
364
364
  };
365
365
 
366
366
  useEffect(() => {
367
- setInputValue(value?.name ?? "");
367
+ setInputValue(value?.name ?? '');
368
368
  }, [value?.name]);
369
369
 
370
370
  useEffect(() => {
@@ -372,7 +372,7 @@ const ModernAutoComplete: React.FC<AutoSuggestionInputProps> = ({
372
372
  }, [data]);
373
373
 
374
374
  const getErrors = (err: any) => {
375
- let errMsg = "";
375
+ let errMsg = '';
376
376
  if (err.message) {
377
377
  errMsg = err?.message;
378
378
  } else if (err?.id?.message) {
@@ -383,59 +383,59 @@ const ModernAutoComplete: React.FC<AutoSuggestionInputProps> = ({
383
383
  return errMsg;
384
384
  };
385
385
  const generateClassName = (
386
- type: "input" | "label" | "message" | "adorement"
386
+ type: 'input' | 'label' | 'message' | 'adorement'
387
387
  ): string => {
388
388
  let className = propsClassName;
389
389
  switch (type) {
390
- case "input":
390
+ case 'input':
391
391
  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 ${
392
392
  label && isModern
393
- ? "placeholder-transparent"
394
- : "focus:placeholder-grey-secondary placeholder-input-label"
393
+ ? 'placeholder-transparent'
394
+ : 'focus:placeholder-grey-secondary placeholder-input-label'
395
395
  } focus:placeholder-grey-secondary`;
396
396
 
397
397
  if (errors && errors[name]) {
398
398
  className +=
399
- " border-[#FDA29B] focus:border-error-[#FDA29B] focus:ring-[#FDA29B] focus:ring-3 focus:outline-[#FDA29B] input-outline";
399
+ ' border-[#FDA29B] focus:border-error-[#FDA29B] focus:ring-[#FDA29B] focus:ring-3 focus:outline-[#FDA29B] input-outline';
400
400
  } else {
401
401
  className +=
402
- " text-grey-dark border-input-light focus:border-blue-navy focus:outline-none focus:ring-0";
402
+ ' text-grey-dark border-input-light focus:border-blue-navy focus:outline-none focus:ring-0';
403
403
  }
404
404
 
405
405
  break;
406
- case "label":
406
+ case 'label':
407
407
  className += ` modern-input-label peer-focus:modern-input-peer-focus-label-size
408
408
  ${
409
409
  isDisabled
410
- ? "cursor-pointer"
411
- : "cursor-text peer-focus:cursor-pointer"
410
+ ? 'cursor-pointer'
411
+ : 'cursor-text peer-focus:cursor-pointer'
412
412
  } ${
413
- !isDisabled || !checkIsEmptyField()
414
- ? "active-input-label-bg"
415
- : isDisabled && !checkIsEmptyField()
416
- ? "disabled-input-label-bg"
417
- : ""
413
+ isDisabled && !checkIsEmptyField()
414
+ ? 'disabled-input-label-bg'
415
+ : !isDisabled || !checkIsEmptyField()
416
+ ? 'active-input-label-bg'
417
+ : ''
418
418
  } 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 ${
419
419
  isDisabled
420
- ? "cursor-pointer"
421
- : "cursor-text peer-focus:cursor-pointer"
420
+ ? 'cursor-pointer'
421
+ : 'cursor-text peer-focus:cursor-pointer'
422
422
  }
423
423
  ${
424
424
  checkIsEmptyField()
425
- ? "modern-input-label-size"
426
- : "modern-input-peer-focus-label-size"
425
+ ? 'modern-input-label-size'
426
+ : 'modern-input-peer-focus-label-size'
427
427
  }`;
428
428
  if (errors && errors[name]) {
429
- className += " text-error-light ";
429
+ className += ' text-error-light ';
430
430
  } else {
431
- className += " text-grey-dark peer-focus:text-blue-navy";
431
+ className += ' text-grey-dark peer-focus:text-blue-navy';
432
432
  }
433
433
  break;
434
- case "message":
435
- className = " text-error-icon ";
434
+ case 'message':
435
+ className = ' text-error-icon ';
436
436
  break;
437
- case "adorement":
438
- className += " absolute right-0 adorement gap-1 flex items-center ";
437
+ case 'adorement':
438
+ className += ' absolute right-0 adorement gap-1 flex items-center ';
439
439
  break;
440
440
  default:
441
441
  break;
@@ -460,27 +460,27 @@ const ModernAutoComplete: React.FC<AutoSuggestionInputProps> = ({
460
460
  // return 'bottom'
461
461
  // }
462
462
  const filteredData =
463
- inputValue !== "*" && type !== "custom_select" && !noLocalFilter
463
+ inputValue !== '*' && type !== 'custom_select' && !noLocalFilter
464
464
  ? suggestions?.filter((item: valueProps) =>
465
465
  checkIncludes(
466
466
  item.name,
467
467
  inputValue,
468
- item.param1 ?? "",
469
- item.param2 ?? "",
470
- item.param3 ?? "",
471
- item.param4 ?? ""
468
+ item.param1 ?? '',
469
+ item.param2 ?? '',
470
+ item.param3 ?? '',
471
+ item.param4 ?? ''
472
472
  )
473
473
  )
474
474
  : suggestions;
475
475
 
476
476
  const handleError = (data: any) => {
477
477
  if (
478
- getErrors(data[name]) === "required" ||
479
- getErrors(data[name]) === "Required"
478
+ getErrors(data[name]) === 'required' ||
479
+ getErrors(data[name]) === 'Required'
480
480
  ) {
481
481
  return `${label ?? labelTitle} is ${getErrors(data[name])}`;
482
482
  } else {
483
- return getErrors(data[name]) ?? "";
483
+ return getErrors(data[name]) ?? '';
484
484
  }
485
485
  };
486
486
 
@@ -542,8 +542,8 @@ const ModernAutoComplete: React.FC<AutoSuggestionInputProps> = ({
542
542
  <li
543
543
  className={`${
544
544
  value?.id === suggestion?.id
545
- ? "bg-blue-navy text-white"
546
- : "hover:bg-table-hover"
545
+ ? 'bg-blue-navy text-white'
546
+ : 'hover:bg-table-hover'
547
547
  } cursor-pointer p-1 text-xxs ps-3.5 pl-[10px]`}
548
548
  key={suggestion?.id}
549
549
  data-testid={suggestion.name}
@@ -591,7 +591,7 @@ const ModernAutoComplete: React.FC<AutoSuggestionInputProps> = ({
591
591
  useEffect(() => {
592
592
  const shouldShowClose =
593
593
  value?.name &&
594
- (value?.id || String(value?.id) === "0") &&
594
+ (value?.id || String(value?.id) === '0') &&
595
595
  !disabled &&
596
596
  !readOnly &&
597
597
  isClose;
@@ -603,19 +603,25 @@ const ModernAutoComplete: React.FC<AutoSuggestionInputProps> = ({
603
603
  // Check if input content overflows
604
604
  const checkOverflow = () => {
605
605
  if (inputRef.current) {
606
- const { scrollWidth, clientWidth } = inputRef.current;
607
- setShowTooltip(scrollWidth > clientWidth);
606
+ const { scrollWidth, clientWidth, value } = inputRef.current;
607
+ // Check for overflow only when there's content
608
+ console.log(scrollWidth, clientWidth);
609
+ if (value.trim() !== '') {
610
+ setShowTooltip(scrollWidth > clientWidth + 2);
611
+ } else {
612
+ setShowTooltip(false); // No tooltip for empty input
613
+ }
608
614
  }
609
615
  };
610
616
 
611
617
  if (inputRef.current) {
612
- inputRef.current.addEventListener("input", checkOverflow);
618
+ inputRef.current.addEventListener('input', checkOverflow);
613
619
  checkOverflow(); // Initial check
614
620
  }
615
621
 
616
622
  return () => {
617
623
  if (inputRef.current) {
618
- inputRef.current.removeEventListener("input", checkOverflow);
624
+ inputRef.current.removeEventListener('input', checkOverflow);
619
625
  }
620
626
  };
621
627
  }, [inputValue]);
@@ -629,7 +635,7 @@ const ModernAutoComplete: React.FC<AutoSuggestionInputProps> = ({
629
635
  };
630
636
  return (
631
637
  <div
632
- className={` flex-grow ${fullWidth ? "w-full" : "w-auto"}`}
638
+ className={` flex-grow ${fullWidth ? 'w-full' : 'w-auto'}`}
633
639
  ref={dropdownref}
634
640
  >
635
641
  {label && !isModern && (
@@ -644,12 +650,12 @@ const ModernAutoComplete: React.FC<AutoSuggestionInputProps> = ({
644
650
  {isHovered && errors && errors[name] && (
645
651
  <span className="tooltip">{handleError(errors)} </span>
646
652
  )}
647
- {tooltipIsHovered && showToolTip && !dropOpen && (
653
+ {tooltipIsHovered && showToolTip && !dropOpen && inputValue && (
648
654
  <div className={`tooltip-info`}>{inputValue}</div>
649
655
  )}
650
656
 
651
657
  <div
652
- className={`flex relative ${fullWidth ? "w-full" : "w-auto"}`}
658
+ className={`flex relative ${fullWidth ? 'w-full' : 'w-auto'}`}
653
659
  style={{ width: width }}
654
660
  >
655
661
  <div
@@ -660,8 +666,8 @@ const ModernAutoComplete: React.FC<AutoSuggestionInputProps> = ({
660
666
  <input
661
667
  id={id}
662
668
  type="text"
663
- readOnly={readOnly ?? type === "custom_select"}
664
- value={inputValue ? inputValue : ""}
669
+ readOnly={readOnly ?? type === 'custom_select'}
670
+ value={inputValue ? inputValue : ''}
665
671
  onBlur={handleClearInputValue}
666
672
  disabled={disabled}
667
673
  ref={inputRef}
@@ -680,18 +686,18 @@ const ModernAutoComplete: React.FC<AutoSuggestionInputProps> = ({
680
686
  }
681
687
  : {}),
682
688
  }}
683
- className={` ${generateClassName("input")}`}
689
+ className={` ${generateClassName('input')}`}
684
690
  onChange={handleChange}
685
691
  placeholder={
686
- type === "auto_complete"
692
+ type === 'auto_complete'
687
693
  ? placeholder && isCustomPlaceholder
688
694
  ? placeholder
689
- : "Type to search"
690
- : placeholder ?? "--Select--"
695
+ : 'Type to search'
696
+ : placeholder ?? '--Select--'
691
697
  }
692
698
  onFocus={onInputFocus}
693
699
  onClick={(e) => {
694
- if (type === "custom_select") {
700
+ if (type === 'custom_select') {
695
701
  setDropOpen(!dropOpen);
696
702
  handleOpen(e);
697
703
  } else {
@@ -703,9 +709,9 @@ const ModernAutoComplete: React.FC<AutoSuggestionInputProps> = ({
703
709
  <label
704
710
  htmlFor={id}
705
711
  onClick={() => onLabelClick()}
706
- className={generateClassName("label")}
712
+ className={generateClassName('label')}
707
713
  >
708
- {label ? label : ""}
714
+ {label ? label : ''}
709
715
  {required ? <span className="text-error"> *</span> : <></>}
710
716
  </label>
711
717
  )}
@@ -714,9 +720,9 @@ const ModernAutoComplete: React.FC<AutoSuggestionInputProps> = ({
714
720
  <div
715
721
  ref={adorementRef}
716
722
  className={`${generateClassName(
717
- "adorement"
723
+ 'adorement'
718
724
  )} qbs-autocomplete-adorement mr-[1px] ${
719
- isLoading ? "bg-white" : ""
725
+ isLoading ? 'bg-white' : ''
720
726
  }`}
721
727
  >
722
728
  {showClose && (
@@ -730,7 +736,7 @@ const ModernAutoComplete: React.FC<AutoSuggestionInputProps> = ({
730
736
  </button>
731
737
  )}
732
738
  {isLoading && <Spinner />}
733
- {type !== "auto_complete" && !disabled && !readOnly && (
739
+ {type !== 'auto_complete' && !disabled && !readOnly && (
734
740
  <button
735
741
  disabled={disabled ?? readOnly}
736
742
  onClick={(e) => handleOpen(e)}
@@ -750,7 +756,7 @@ const ModernAutoComplete: React.FC<AutoSuggestionInputProps> = ({
750
756
  {errors && errors[name] && (
751
757
  <div
752
758
  className={` text-error-label relative cursor-pointer ${generateClassName(
753
- "message"
759
+ 'message'
754
760
  )}`}
755
761
  onMouseEnter={() => setIsHovered(true)}
756
762
  onMouseLeave={() => setIsHovered(false)}
@@ -124,10 +124,10 @@ const ModernTextArea: React.FC<TextAreaProps> = ({
124
124
  ? 'cursor-pointer'
125
125
  : 'cursor-text peer-focus:cursor-pointer'
126
126
  } ${
127
- !isDisabled || !checkIsEmptyField()
128
- ? 'active-input-label-bg'
129
- : isDisabled && !checkIsEmptyField()
127
+ isDisabled && !checkIsEmptyField()
130
128
  ? 'disabled-input-label-bg'
129
+ : !isDisabled || !checkIsEmptyField()
130
+ ? 'active-input-label-bg'
131
131
  : ''
132
132
  } ${
133
133
  checkIsEmptyField()
@@ -140,11 +140,11 @@ const TextField: React.FC<TextFieldProps> = ({
140
140
  peer-focus:-translate-y-4 start-[14px] rtl:peer-focus:translate-x-1/4 rtl:peer-focus:left-auto ${
141
141
  isDisabled ? 'cursor-pointer' : 'cursor-text peer-focus:cursor-pointer'
142
142
  } ${
143
- !isDisabled || !checkIsEmptyField()
144
- ? 'active-input-label-bg'
145
- : isDisabled && !checkIsEmptyField()
143
+ isDisabled && !checkIsEmptyField()
146
144
  ? 'disabled-input-label-bg'
147
- : ''
145
+ : !isDisabled || !checkIsEmptyField()
146
+ ? 'active-input-label-bg'
147
+ : ''
148
148
  } ${
149
149
  checkIsEmptyField()
150
150
  ? 'modern-input-label-size'