react-core-ts 1.3.31 → 1.3.33
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 +5 -2
- package/dist/AutoCompleteWithSelectedList.js.map +1 -1
- package/dist/AutoCompleteWithTreeStructure.js +7 -4
- package/dist/AutoCompleteWithTreeStructure.js.map +1 -1
- package/dist/commontypes.d.ts +1 -1
- package/dist/styles/components/autocomplete.css +5 -2
- package/dist/styles/styles/components/autocomplete.css +624 -0
- package/dist/styles/styles/components/selectedautocomplete.css +130 -0
- package/dist/styles/styles/components/tooltip.css +496 -0
- package/dist/styles/styles/components/treedropdown.css +63 -0
- package/dist/styles/styles/global.css +8 -0
- package/package.json +1 -1
- package/src/AutoCompleteWithSelectedList.tsx +6 -11
- package/src/AutoCompleteWithTreeStructure.tsx +9 -13
- package/src/commontypes.ts +1 -1
- package/src/styles/components/autocomplete.css +5 -2
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
forwardRef,
|
|
3
|
-
useCallback,
|
|
4
|
-
useEffect,
|
|
5
|
-
useImperativeHandle,
|
|
6
|
-
useRef,
|
|
7
|
-
useState,
|
|
8
|
-
} from 'react';
|
|
1
|
+
import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
9
2
|
import ReactDOM from 'react-dom';
|
|
10
3
|
|
|
11
4
|
import { AutoSuggestionInputProps, TabPops, ValueProps } from './commontypes';
|
|
@@ -73,9 +66,9 @@ const AutoCompleteWithSelectedList = forwardRef<
|
|
|
73
66
|
const dropdownRef = useRef<HTMLDivElement>(null);
|
|
74
67
|
const dropdownSelectedRef = useRef<HTMLDivElement>(null);
|
|
75
68
|
const tabRef = useRef<HTMLUListElement>(null);
|
|
69
|
+
const dropLevelRef = useRef<string>('bottom');
|
|
76
70
|
// State Hooks Section
|
|
77
71
|
const [isInitialRender, setIsInitialRender] = useState(true);
|
|
78
|
-
|
|
79
72
|
const [inputValue, setInputValue] = useState<string>(value);
|
|
80
73
|
const [searchValue, setSearchValue] = useState<string>('');
|
|
81
74
|
const [searchOldValue, setSearchOldValue] = useState<string>('');
|
|
@@ -121,9 +114,11 @@ const AutoCompleteWithSelectedList = forwardRef<
|
|
|
121
114
|
if (tabRef?.current) dropdownHeight += tabRef?.current?.clientHeight;
|
|
122
115
|
}
|
|
123
116
|
if (spaceBelow >= dropdownHeight) {
|
|
117
|
+
dropLevelRef.current = 'bottom';
|
|
124
118
|
dropdownPosition.top =
|
|
125
119
|
inputRect.top + window.scrollY + inputRect.height;
|
|
126
120
|
} else {
|
|
121
|
+
dropLevelRef.current = 'top';
|
|
127
122
|
dropdownPosition.top =
|
|
128
123
|
inputRect.top + window.scrollY - dropdownHeight + 73 + topMargin;
|
|
129
124
|
}
|
|
@@ -514,8 +509,8 @@ const AutoCompleteWithSelectedList = forwardRef<
|
|
|
514
509
|
);
|
|
515
510
|
};
|
|
516
511
|
useEffect(() => {
|
|
517
|
-
handleUpdateParent?.(dropOpen)
|
|
518
|
-
}, [dropOpen]);
|
|
512
|
+
handleUpdateParent?.(dropOpen, dropLevelRef.current)
|
|
513
|
+
}, [dropOpen, dropLevelRef.current]);
|
|
519
514
|
return (
|
|
520
515
|
<div className={fullWidth ? 'fullWidth' : 'autoWidth'} ref={dropdownRef}>
|
|
521
516
|
{label && (
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
forwardRef,
|
|
3
|
-
useCallback,
|
|
4
|
-
useEffect,
|
|
5
|
-
useImperativeHandle,
|
|
6
|
-
useRef,
|
|
7
|
-
useState,
|
|
8
|
-
} from 'react';
|
|
1
|
+
import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
9
2
|
import ReactDOM from 'react-dom';
|
|
10
3
|
|
|
11
4
|
import { AutoSuggestionInputProps } from './commontypes';
|
|
@@ -80,7 +73,7 @@ const AutoCompleteWithTreeStructure = forwardRef<
|
|
|
80
73
|
const [dropDownData, setDropDownData] = useState<ValueProps[]>(data);
|
|
81
74
|
const inputRef = useRef(null);
|
|
82
75
|
const dropRef = useRef(null);
|
|
83
|
-
|
|
76
|
+
const dropLevelRef = useRef<string>('bottom');
|
|
84
77
|
useEffect(() => {
|
|
85
78
|
if (data) {
|
|
86
79
|
if (flatArray) {
|
|
@@ -91,6 +84,7 @@ const AutoCompleteWithTreeStructure = forwardRef<
|
|
|
91
84
|
}
|
|
92
85
|
}, [data, dropOpen]);
|
|
93
86
|
useImperativeHandle(ref, () => inputRef.current);
|
|
87
|
+
|
|
94
88
|
const [dropdownStyle, setDropdownStyle] = useState({
|
|
95
89
|
top: 0,
|
|
96
90
|
left: 0,
|
|
@@ -113,9 +107,11 @@ const AutoCompleteWithTreeStructure = forwardRef<
|
|
|
113
107
|
if (spaceBelow >= dropdownHeight) {
|
|
114
108
|
dropdownPosition.top =
|
|
115
109
|
inputRect.top + window.scrollY + inputRect.height;
|
|
110
|
+
dropLevelRef.current = 'bottom';
|
|
116
111
|
} else {
|
|
117
112
|
dropdownPosition.top =
|
|
118
113
|
inputRect.top + window.scrollY - dropdownHeight + 73;
|
|
114
|
+
dropLevelRef.current = 'top';
|
|
119
115
|
}
|
|
120
116
|
|
|
121
117
|
setDropdownStyle({
|
|
@@ -210,8 +206,8 @@ const AutoCompleteWithTreeStructure = forwardRef<
|
|
|
210
206
|
}
|
|
211
207
|
};
|
|
212
208
|
useEffect(() => {
|
|
213
|
-
handleUpdateParent?.(dropOpen)
|
|
214
|
-
}, [dropOpen]);
|
|
209
|
+
handleUpdateParent?.(dropOpen, dropLevelRef.current)
|
|
210
|
+
}, [dropOpen, dropLevelRef.current]);
|
|
215
211
|
const generateClassName = useCallback(() => {
|
|
216
212
|
return `qbs-textfield-default ${className} ${
|
|
217
213
|
errors && errors?.message ? 'textfield-error' : 'tree-textfield'
|
|
@@ -576,7 +572,7 @@ const AutoCompleteWithTreeStructure = forwardRef<
|
|
|
576
572
|
<ul
|
|
577
573
|
ref={dropRef}
|
|
578
574
|
style={{ ...dropdownStyle, minHeight: 192 }}
|
|
579
|
-
className={`qbs-autocomplete-suggestions
|
|
575
|
+
className={`qbs-autocomplete-suggestions `}
|
|
580
576
|
>
|
|
581
577
|
{type == 'auto_suggestion' && !expandable && (
|
|
582
578
|
<div
|
|
@@ -600,7 +596,7 @@ const AutoCompleteWithTreeStructure = forwardRef<
|
|
|
600
596
|
gap: isTreeDropdown ? '8px' : '0',
|
|
601
597
|
minHeight: isTreeDropdown ? '184px' : '0',
|
|
602
598
|
}}
|
|
603
|
-
className={`qbs-autocomplete-suggestions-sub `}
|
|
599
|
+
className={`qbs-autocomplete-suggestions-sub padding-class `}
|
|
604
600
|
>
|
|
605
601
|
{dropDownData?.length > 0 ? (
|
|
606
602
|
dropDownData.map((suggestion: any, idx: number) => (
|
package/src/commontypes.ts
CHANGED
|
@@ -63,7 +63,7 @@ export interface AutoSuggestionInputProps {
|
|
|
63
63
|
currentTab?: number; // current active tab
|
|
64
64
|
selectedLabel?: string; // Able to change the "Item selected" label
|
|
65
65
|
viewMode?: boolean; // show only selected items
|
|
66
|
-
handleUpdateParent?: (val:boolean) => void;
|
|
66
|
+
handleUpdateParent?: (val: boolean, level?: string) => void;
|
|
67
67
|
}
|
|
68
68
|
export interface IconsProps {
|
|
69
69
|
name: any;
|
|
@@ -236,7 +236,7 @@ body * {
|
|
|
236
236
|
overflow: hidden;
|
|
237
237
|
}
|
|
238
238
|
.qbs-expandable-container .qbs-textfield-expandable::after {
|
|
239
|
-
content: attr(data-value)
|
|
239
|
+
content: attr(data-value) ' ';
|
|
240
240
|
visibility: hidden;
|
|
241
241
|
white-space: pre;
|
|
242
242
|
grid-area: 1 / 2;
|
|
@@ -315,6 +315,9 @@ body * {
|
|
|
315
315
|
flex-direction: column;
|
|
316
316
|
gap: 4px;
|
|
317
317
|
}
|
|
318
|
+
.padding-class {
|
|
319
|
+
padding: 12px !important;
|
|
320
|
+
}
|
|
318
321
|
.qbs-autocomplete-listitem-container {
|
|
319
322
|
display: flex;
|
|
320
323
|
align-items: center;
|
|
@@ -598,7 +601,7 @@ span.dropdown-search-icon {
|
|
|
598
601
|
|
|
599
602
|
.qbs-table-tooltip .tooltiptext::after,
|
|
600
603
|
.tooltiptext::after {
|
|
601
|
-
content:
|
|
604
|
+
content: '';
|
|
602
605
|
position: absolute;
|
|
603
606
|
border-width: 5px;
|
|
604
607
|
border-style: solid;
|