react-core-ts 1.9.5 → 1.9.6
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.
- package/dist/AutoCompleteWithSelectedList.js +23 -13
- package/dist/AutoCompleteWithSelectedList.js.map +1 -1
- package/dist/ExpandableAutoComplete.js +19 -11
- package/dist/ExpandableAutoComplete.js.map +1 -1
- package/dist/styles/styles/components/autocomplete.css +699 -0
- package/dist/styles/styles/components/selectedautocomplete.css +168 -0
- package/dist/styles/styles/components/tooltip.css +497 -0
- package/dist/styles/styles/components/treedropdown.css +97 -0
- package/dist/styles/styles/global.css +8 -0
- package/package.json +1 -1
- package/src/AutoCompleteWithSelectedList.tsx +26 -18
- package/src/ExpandableAutoComplete.tsx +19 -12
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
.qbs-tree-list-container {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
}
|
|
5
|
+
.qbs-tree-list-container-sub {
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: row;
|
|
8
|
+
align-items: flex-start;
|
|
9
|
+
gap: 7px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.qbs-tree-list-container-sub .no-children {
|
|
13
|
+
margin-left: 1.75rem; /* Corresponds to ml-7 in Tailwind */
|
|
14
|
+
}
|
|
15
|
+
.qbs-tree-list-container-sub-icon {
|
|
16
|
+
margin-top: 0.25rem; /* Corresponds to mt-1 in Tailwind */
|
|
17
|
+
cursor: pointer;
|
|
18
|
+
padding-top: 0.5rem; /* Corresponds to py-2 in Tailwind */
|
|
19
|
+
padding-bottom: 0.5rem;
|
|
20
|
+
transition: transform 0.3s ease; /* Smooth rotation transition */
|
|
21
|
+
color: #003c71;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.qbs-tree-list-container-sub-icon.expanded {
|
|
25
|
+
transform: rotate(90deg); /* Corresponds to rotate-90 in Tailwind */
|
|
26
|
+
}
|
|
27
|
+
.qbs-tree-list-container-sub-container {
|
|
28
|
+
display: flex;
|
|
29
|
+
gap: 15px; /* Corresponds to gap-2 in Tailwind */
|
|
30
|
+
padding: 0.5rem; /* Corresponds to p-2 in Tailwind */
|
|
31
|
+
flex-direction: row; /* Corresponds to flex-row in Tailwind */
|
|
32
|
+
width: 100%; /* Corresponds to w-full in Tailwind */
|
|
33
|
+
color: #3d414a;
|
|
34
|
+
}
|
|
35
|
+
.qbs-tree-list-container-sub-container-hideicon {
|
|
36
|
+
display: flex;
|
|
37
|
+
gap: 6px; /* Corresponds to gap-2 in Tailwind */
|
|
38
|
+
padding: 0.5rem; /* Corresponds to p-2 in Tailwind */
|
|
39
|
+
flex-direction: row; /* Corresponds to flex-row in Tailwind */
|
|
40
|
+
width: 100%; /* Corresponds to w-full in Tailwind */
|
|
41
|
+
color: #3d414a;
|
|
42
|
+
}
|
|
43
|
+
.qbs-tree-list-container-sub-container-hideicon:hover {
|
|
44
|
+
color: #003c71;
|
|
45
|
+
background-color: rgba(141, 194, 240, 0.15) !important;
|
|
46
|
+
}
|
|
47
|
+
.qbs-tree-list-container-sub-container:hover {
|
|
48
|
+
color: #003c71;
|
|
49
|
+
background-color: rgba(141, 194, 240, 0.15) !important;
|
|
50
|
+
}
|
|
51
|
+
.qbs-tree-list-container-sub-container.qbs-expanded-child {
|
|
52
|
+
color: #003c71;
|
|
53
|
+
}
|
|
54
|
+
.qbs-tree-list-container-sub-text.qbs-expanded-child {
|
|
55
|
+
color: #003c71;
|
|
56
|
+
}
|
|
57
|
+
.qbs-tree-list-container-sub-text:hover {
|
|
58
|
+
color: #003c71;
|
|
59
|
+
/* background-color: rgba(141, 194, 240, 0.15) !important; */
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.qbs-tree-list-container-sub-container.checked,
|
|
63
|
+
.qbs-tree-list-container-sub-container-hideicon.checked {
|
|
64
|
+
color: #003c71;
|
|
65
|
+
background-color: rgba(
|
|
66
|
+
141,
|
|
67
|
+
194,
|
|
68
|
+
240,
|
|
69
|
+
0.15
|
|
70
|
+
) !important; /* Corresponds to bg-green-200 in Tailwind */
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.marginLeft {
|
|
74
|
+
margin-left: 28px; /* Corresponds to ml-2 in Tailwind */
|
|
75
|
+
}
|
|
76
|
+
.lightmarginLeft {
|
|
77
|
+
margin-left: 19px; /* Corresponds to ml-2 in Tailwind */
|
|
78
|
+
}
|
|
79
|
+
.qbs-tree-list-container-sub- {
|
|
80
|
+
line-height: 18px; /* Corresponds to leading-[18px] in Tailwind */
|
|
81
|
+
font-size: 0.875rem; /* Corresponds to text-sm in Tailwind (14px) */
|
|
82
|
+
}
|
|
83
|
+
.qbs-tree-list-container-child {
|
|
84
|
+
margin-left: 1rem; /* Corresponds to ml-4 in Tailwind */
|
|
85
|
+
margin-top: 0.5rem; /* Corresponds to mt-2 in Tailwind */
|
|
86
|
+
display: flex; /* Corresponds to flex in Tailwind */
|
|
87
|
+
flex-direction: column; /* Corresponds to flex-col in Tailwind */
|
|
88
|
+
gap: 0.5rem; /* Corresponds to gap-2 in Tailwind */
|
|
89
|
+
}
|
|
90
|
+
.qbs-tree-list-container-sub-text {
|
|
91
|
+
line-height: 18px; /* Corresponds to leading-[18px] in Tailwind */
|
|
92
|
+
font-size: 14px; /* Corresponds to text-sm in Tailwind (14px) */
|
|
93
|
+
font-weight: 500;
|
|
94
|
+
letter-spacing: 0.28px;
|
|
95
|
+
font-family: 'Noto Sans';
|
|
96
|
+
/* color: #3d414a; */
|
|
97
|
+
}
|
package/package.json
CHANGED
|
@@ -115,7 +115,6 @@ const AutoCompleteWithSelectedList = forwardRef<
|
|
|
115
115
|
const [refetchData, setRefetchData] = useState(false);
|
|
116
116
|
const [allDataLoaded, setAllDataLoaded] = useState(false);
|
|
117
117
|
|
|
118
|
-
|
|
119
118
|
let originalOverflow = '';
|
|
120
119
|
let hasScrollbar = false;
|
|
121
120
|
|
|
@@ -148,7 +147,12 @@ const AutoCompleteWithSelectedList = forwardRef<
|
|
|
148
147
|
|
|
149
148
|
setSelHeight(defaultHeight);
|
|
150
149
|
} else if (spaceAbove >= dropdownHeight) {
|
|
151
|
-
|
|
150
|
+
let sHeight = tabInlineSearch ? 73 : 113;
|
|
151
|
+
sHeight =
|
|
152
|
+
sHeight -
|
|
153
|
+
(filteredData?.length > 0 && enableSelectAll && isMultiple
|
|
154
|
+
? 32
|
|
155
|
+
: 0);
|
|
152
156
|
dropLevelRef.current = 'top';
|
|
153
157
|
dropdownPosition.top =
|
|
154
158
|
inputRect.top +
|
|
@@ -299,7 +303,7 @@ const AutoCompleteWithSelectedList = forwardRef<
|
|
|
299
303
|
const trimStart = value.trimStart();
|
|
300
304
|
setSearchValue(trimStart);
|
|
301
305
|
handleChangeWithDebounce(trimStart);
|
|
302
|
-
setAllDataLoaded(false)
|
|
306
|
+
setAllDataLoaded(false);
|
|
303
307
|
};
|
|
304
308
|
|
|
305
309
|
const handleClear = () => {
|
|
@@ -319,6 +323,7 @@ const AutoCompleteWithSelectedList = forwardRef<
|
|
|
319
323
|
setShowAllSelected(false);
|
|
320
324
|
setSearchValue('');
|
|
321
325
|
if (isMultiple) onChange([]);
|
|
326
|
+
if (async) resetSuggections?.();
|
|
322
327
|
else onChange({ [descId]: '', [desc]: '' });
|
|
323
328
|
};
|
|
324
329
|
|
|
@@ -333,18 +338,6 @@ const AutoCompleteWithSelectedList = forwardRef<
|
|
|
333
338
|
});
|
|
334
339
|
};
|
|
335
340
|
|
|
336
|
-
useEffect(() => {
|
|
337
|
-
if (isInitialRender) {
|
|
338
|
-
setIsInitialRender(false);
|
|
339
|
-
} else {
|
|
340
|
-
onChange(selectedItems);
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
adjustDropdownPosition();
|
|
344
|
-
setTimeout(() => {
|
|
345
|
-
adjustDropdownPosition();
|
|
346
|
-
}, 200);
|
|
347
|
-
}, [selectedItems]);
|
|
348
341
|
const uniqueDropArrowId = `${name}-drop-arrow-selected-list-icon`;
|
|
349
342
|
useEffect(() => {
|
|
350
343
|
const handleClickOutside = (event: any) => {
|
|
@@ -412,6 +405,19 @@ const AutoCompleteWithSelectedList = forwardRef<
|
|
|
412
405
|
matchFromStart
|
|
413
406
|
);
|
|
414
407
|
|
|
408
|
+
useEffect(() => {
|
|
409
|
+
if (isInitialRender) {
|
|
410
|
+
setIsInitialRender(false);
|
|
411
|
+
} else {
|
|
412
|
+
onChange(selectedItems);
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
adjustDropdownPosition();
|
|
416
|
+
setTimeout(() => {
|
|
417
|
+
adjustDropdownPosition();
|
|
418
|
+
}, 200);
|
|
419
|
+
}, [selectedItems, filteredData]);
|
|
420
|
+
|
|
415
421
|
useEffect(() => {
|
|
416
422
|
// Handle keyboard navigation
|
|
417
423
|
const handleKeyDown = (e: any) => {
|
|
@@ -477,7 +483,9 @@ const AutoCompleteWithSelectedList = forwardRef<
|
|
|
477
483
|
): boolean => {
|
|
478
484
|
if (Array.isArray(selectedItems)) {
|
|
479
485
|
return selectedItems.some(
|
|
480
|
-
(selectedItem) =>
|
|
486
|
+
(selectedItem) =>
|
|
487
|
+
selectedItem[desc] === item[desc] ||
|
|
488
|
+
selectedItem[descId] === item[descId]
|
|
481
489
|
);
|
|
482
490
|
} else {
|
|
483
491
|
return item[desc] === selectedItems || item[descId] === selectedItems;
|
|
@@ -705,11 +713,11 @@ const AutoCompleteWithSelectedList = forwardRef<
|
|
|
705
713
|
if (autoDropdown && (inputValue === '' || inputValue.trim() === '')) {
|
|
706
714
|
handlePickSuggestions('*', 1);
|
|
707
715
|
setRefetchData(false);
|
|
708
|
-
setAllDataLoaded(true)
|
|
716
|
+
setAllDataLoaded(true);
|
|
709
717
|
} else if (!refetchData && inputValue !== '') {
|
|
710
718
|
handlePickSuggestions(inputValue, 1);
|
|
711
719
|
setRefetchData(true);
|
|
712
|
-
setAllDataLoaded(false)
|
|
720
|
+
setAllDataLoaded(false);
|
|
713
721
|
}
|
|
714
722
|
}
|
|
715
723
|
};
|
|
@@ -14,7 +14,7 @@ import InputActions from './components/InputActions';
|
|
|
14
14
|
import { useSuggestions } from './utilities/autosuggestions';
|
|
15
15
|
import { debounce } from './utilities/debounce';
|
|
16
16
|
import { deepEqual } from './utilities/deepEqual';
|
|
17
|
-
import { default as Tooltip } from './utilities/
|
|
17
|
+
import { default as Tooltip } from './utilities/NewTooltip';
|
|
18
18
|
import { filterSuggestions } from './utilities/filterSuggestions';
|
|
19
19
|
import { AllDropArrow, Search, Spinner } from './utilities/icons';
|
|
20
20
|
|
|
@@ -108,11 +108,16 @@ const ExpandableAutoComplete = forwardRef<
|
|
|
108
108
|
const spaceBelow = window.innerHeight - inputRect.bottom;
|
|
109
109
|
const spaceAbove = inputRect.top + window.scrollY;
|
|
110
110
|
|
|
111
|
-
|
|
111
|
+
let dropdownHeight = 275; // Assume a fixed height or calculate based on content
|
|
112
112
|
if (spaceBelow >= dropdownHeight) {
|
|
113
113
|
dropdownPosition.top =
|
|
114
114
|
inputRect.top + window.scrollY + inputRect.height;
|
|
115
115
|
} else {
|
|
116
|
+
dropdownHeight =
|
|
117
|
+
dropdownHeight +
|
|
118
|
+
(filteredData?.length > 0 && enableSelectAll && isMultiple
|
|
119
|
+
? 32
|
|
120
|
+
: 0);
|
|
116
121
|
dropdownPosition.top =
|
|
117
122
|
inputRect.top + window.scrollY - dropdownHeight + 73;
|
|
118
123
|
}
|
|
@@ -123,15 +128,6 @@ const ExpandableAutoComplete = forwardRef<
|
|
|
123
128
|
}
|
|
124
129
|
};
|
|
125
130
|
|
|
126
|
-
useEffect(() => {
|
|
127
|
-
window.addEventListener('resize', adjustDropdownPosition);
|
|
128
|
-
adjustDropdownPosition();
|
|
129
|
-
|
|
130
|
-
return () => {
|
|
131
|
-
window.removeEventListener('resize', adjustDropdownPosition);
|
|
132
|
-
};
|
|
133
|
-
}, [dropOpen, selectedItems]);
|
|
134
|
-
|
|
135
131
|
const { suggestions, isLoading, handlePickSuggestions } = useSuggestions(
|
|
136
132
|
getData,
|
|
137
133
|
data,
|
|
@@ -327,6 +323,15 @@ const ExpandableAutoComplete = forwardRef<
|
|
|
327
323
|
matchFromStart
|
|
328
324
|
);
|
|
329
325
|
|
|
326
|
+
useEffect(() => {
|
|
327
|
+
window.addEventListener('resize', adjustDropdownPosition);
|
|
328
|
+
adjustDropdownPosition();
|
|
329
|
+
|
|
330
|
+
return () => {
|
|
331
|
+
window.removeEventListener('resize', adjustDropdownPosition);
|
|
332
|
+
};
|
|
333
|
+
}, [dropOpen, selectedItems, filteredData]);
|
|
334
|
+
|
|
330
335
|
useEffect(() => {
|
|
331
336
|
// Handle keyboard navigation
|
|
332
337
|
const handleKeyDown = (e: any) => {
|
|
@@ -391,7 +396,9 @@ const ExpandableAutoComplete = forwardRef<
|
|
|
391
396
|
): boolean => {
|
|
392
397
|
if (Array.isArray(selectedItems)) {
|
|
393
398
|
return selectedItems.some(
|
|
394
|
-
(selectedItem) =>
|
|
399
|
+
(selectedItem) =>
|
|
400
|
+
selectedItem[desc] === item[desc] ||
|
|
401
|
+
selectedItem[descId] === item[descId]
|
|
395
402
|
);
|
|
396
403
|
} else {
|
|
397
404
|
return item[desc] === selectedItems || item[descId] === selectedItems;
|