react-core-ts 1.7.6 → 1.7.8

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.
@@ -26,6 +26,7 @@ interface AutoSuggestionInputProps {
26
26
  autoFocus?: boolean;
27
27
  required?: boolean;
28
28
  shortCode?: string;
29
+ labelCode?: string;
29
30
  hideClear?: boolean;
30
31
  value?: valueProps;
31
32
  onChange: (value?: valueProps) => void;
@@ -64,6 +65,7 @@ const ModernAutoCompleteDropdown: React.FC<AutoSuggestionInputProps> = ({
64
65
  autoFocus,
65
66
  name,
66
67
  shortCode = '',
68
+ labelCode = '',
67
69
  fullWidth,
68
70
  placeholder,
69
71
  id,
@@ -286,6 +288,7 @@ const ModernAutoCompleteDropdown: React.FC<AutoSuggestionInputProps> = ({
286
288
  setIsLoading(false);
287
289
  if (autoDropdown) {
288
290
  setRefetchData(false);
291
+ timerRef.current = 1;
289
292
  }
290
293
  } catch (error) {
291
294
  setIsLoading(false);
@@ -554,7 +557,7 @@ const ModernAutoCompleteDropdown: React.FC<AutoSuggestionInputProps> = ({
554
557
 
555
558
  useEffect(() => {
556
559
  if (
557
- inputValue &&
560
+ (inputValue || autoDropdown) &&
558
561
  filteredData?.length === 0 &&
559
562
  !isLoading &&
560
563
  timerRef.current === 1
@@ -662,6 +665,12 @@ const ModernAutoCompleteDropdown: React.FC<AutoSuggestionInputProps> = ({
662
665
  {suggestion?.label ? suggestion?.label : suggestion.name}
663
666
  </span>
664
667
 
668
+ {labelCode && suggestion?.[labelCode] && (
669
+ <span className="label-code">
670
+ {suggestion?.[labelCode]}
671
+ </span>
672
+ )}
673
+
665
674
  {shortCode && suggestion?.[shortCode] && (
666
675
  <span className="short-code">
667
676
  {suggestion?.[shortCode]}
@@ -845,7 +854,7 @@ const ModernAutoCompleteDropdown: React.FC<AutoSuggestionInputProps> = ({
845
854
  ref={adorementRef}
846
855
  className={`${generateClassName(
847
856
  'adorement'
848
- )} qbs-autocomplete-adorement custom-dorpdown-adorement mr-[1px] ${
857
+ )} qbs-autocomplete-adorement auto-dorpdown-adorement mr-[1px] ${
849
858
  isLoading ? 'bg-white' : ''
850
859
  }`}
851
860
  >
@@ -78,6 +78,7 @@ export interface AutoSuggestionInputProps {
78
78
  filterValue?: any;
79
79
  };
80
80
  shortCode?: string
81
+ labelCode?: string,
81
82
  tabInlineSearch?: boolean // tab dropdown search
82
83
  }
83
84
  export interface IconsProps {
@@ -12,6 +12,7 @@ type ValueProps = {
12
12
  desc: string;
13
13
  hideCheckbox?: boolean;
14
14
  shortCode?: string
15
+ labelCode?: string
15
16
  focusedIndex?: number
16
17
  setItemRef?: (index: number, ref: HTMLDivElement | null) => void
17
18
  };
@@ -27,6 +28,7 @@ const DropdownList: React.FC<ValueProps> = ({
27
28
  desc,
28
29
  hideCheckbox = false,
29
30
  shortCode = '',
31
+ labelCode = '',
30
32
  focusedIndex = 0,
31
33
  setItemRef
32
34
  }) => {
@@ -74,6 +76,7 @@ const DropdownList: React.FC<ValueProps> = ({
74
76
  >
75
77
  {suggestion[desc]}
76
78
  </div>
79
+ {labelCode && suggestion?.[labelCode] && <div className='label-code'>{suggestion?.[labelCode]}</div>}
77
80
  {shortCode && suggestion?.[shortCode] && <div className='short-code'>{suggestion?.[shortCode]}</div>}
78
81
  </div>
79
82
  );
@@ -128,7 +128,7 @@ body * {
128
128
  font-size: 14px;
129
129
  font-weight: 500;
130
130
  line-height: 20px; /* 142.857% */
131
- width: 100%;
131
+ /* width: 100%; */
132
132
  display: flex;
133
133
  align-items: flex-start;
134
134
  gap: 8px;
@@ -650,7 +650,7 @@ span.dropdown-search-icon {
650
650
 
651
651
  .autocomplete-suggections .qbs-autocomplete-suggections-items {
652
652
  display: flex;
653
- justify-content: space-between;
653
+ /* justify-content: space-between; */
654
654
  align-items: center;
655
655
  cursor: pointer;
656
656
  outline: none;
@@ -669,4 +669,16 @@ span.dropdown-search-icon {
669
669
  border: 1px solid #ccc;
670
670
  border-radius: 4px;
671
671
  white-space: nowrap;
672
+ margin-left: auto;
673
+ }
674
+
675
+ .autocomplete-suggections .qbs-autocomplete-suggections-items .label-code,
676
+ .qbs-autocomplete-listitem-container .label-code {
677
+ font-size: 12px;
678
+ background: #f0f0f0;
679
+ padding: 4px 8px;
680
+ border: 1px solid #ccc;
681
+ border-radius: 4px;
682
+ white-space: nowrap;
683
+ margin: 0px 5px;
672
684
  }