react-core-ts 1.9.17 → 2.0.0
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/AutoCompleteWithTabFilter.d.ts +4 -0
- package/dist/AutoCompleteWithTabFilter.js +743 -0
- package/dist/AutoCompleteWithTabFilter.js.map +1 -0
- package/dist/ReactTextField.js +13 -8
- package/dist/ReactTextField.js.map +1 -1
- package/dist/commontypes.d.ts +14 -1
- package/dist/dropdownFilterTabs.d.ts +7 -0
- package/dist/dropdownFilterTabs.js +647 -0
- package/dist/dropdownFilterTabs.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/styles/components/autocomplete.css +18 -0
- package/dist/styles/components/selectedautocomplete.css +11 -0
- package/dist/utilities/icons.d.ts +1 -0
- package/dist/utilities/icons.js +6 -1
- package/dist/utilities/icons.js.map +1 -1
- package/docs/App.tsx +109 -8
- package/package.json +1 -1
- package/src/AutoCompleteWithTabFilter.tsx +1244 -0
- package/src/ReactTextField.tsx +23 -4
- package/src/commontypes.ts +15 -1
- package/src/dropdownFilterTabs.tsx +1002 -0
- package/src/index.tsx +1 -0
- package/src/styles/components/autocomplete.css +18 -0
- package/src/styles/components/selectedautocomplete.css +11 -0
- package/src/utilities/icons.tsx +10 -0
- package/dist/styles/styles/components/autocomplete.css +0 -699
- package/dist/styles/styles/components/selectedautocomplete.css +0 -168
- package/dist/styles/styles/components/tooltip.css +0 -497
- package/dist/styles/styles/components/treedropdown.css +0 -97
- package/dist/styles/styles/global.css +0 -8
package/src/ReactTextField.tsx
CHANGED
|
@@ -47,6 +47,8 @@ const TextField: React.FC<TextFieldProps> = ({
|
|
|
47
47
|
labelTitle,
|
|
48
48
|
hideLabel = false,
|
|
49
49
|
isModern = true,
|
|
50
|
+
enableSearch = false,
|
|
51
|
+
onSearchClick,
|
|
50
52
|
///
|
|
51
53
|
}) => {
|
|
52
54
|
// const [editState, setEditState] = useState<boolean>(false)
|
|
@@ -58,7 +60,7 @@ const TextField: React.FC<TextFieldProps> = ({
|
|
|
58
60
|
const intervalRef = useRef<any>(null);
|
|
59
61
|
const clickTimeoutRef = useRef<any>(null);
|
|
60
62
|
const [isHolding, setIsHolding] = useState<boolean>(false);
|
|
61
|
-
|
|
63
|
+
const searchBtnRef = useRef<HTMLButtonElement>(null);
|
|
62
64
|
const onLabelClick = () => {
|
|
63
65
|
if (!isDisabled) {
|
|
64
66
|
inputRef?.current?.focus();
|
|
@@ -75,7 +77,7 @@ const TextField: React.FC<TextFieldProps> = ({
|
|
|
75
77
|
useEffect(() => {
|
|
76
78
|
const innerwidth = adorementRef.current
|
|
77
79
|
? adorementRef.current.offsetWidth
|
|
78
|
-
: 15;
|
|
80
|
+
: enableSearch ? searchBtnRef.current?.offsetWidth || 38 : 15;
|
|
79
81
|
setWidth(innerwidth);
|
|
80
82
|
}, [adorement, infoTitle, showInfo]);
|
|
81
83
|
const getErrors = (err?: any) => {
|
|
@@ -109,7 +111,7 @@ const TextField: React.FC<TextFieldProps> = ({
|
|
|
109
111
|
};
|
|
110
112
|
const getBg = () => backGround || "bg-transparent"; //added for set background colour according to the form
|
|
111
113
|
const generateClassName = (
|
|
112
|
-
from: "input" | "label" | "message" | "adorement"
|
|
114
|
+
from: "input" | "label" | "message" | "adorement" | "search"
|
|
113
115
|
): string => {
|
|
114
116
|
let className = `${propsClassName} `;
|
|
115
117
|
|
|
@@ -119,7 +121,7 @@ const TextField: React.FC<TextFieldProps> = ({
|
|
|
119
121
|
size === "xxs" ? " text-xxs" : "text-common"
|
|
120
122
|
} text-input-text font-normal ${
|
|
121
123
|
step && adorement ? "px-2.5" : "px-3.5"
|
|
122
|
-
} w-full text-sm text-gray-900 ${getBg()} border appearance-none peer rounded-[4px] disabled:text-input-disabled bg-white disabled:bg-disabled ${
|
|
124
|
+
} ${enableSearch ? "search-btn-input" : ""} w-full text-sm text-gray-900 ${getBg()} border appearance-none peer rounded-[4px] disabled:text-input-disabled bg-white disabled:bg-disabled ${
|
|
123
125
|
hideLabel ? "" : label && isModern ? "placeholder-transparent" : ""
|
|
124
126
|
} focus:placeholder-grey-secondary ${
|
|
125
127
|
adorementPosition === "start" && " !pl-[45px] "
|
|
@@ -166,6 +168,10 @@ const TextField: React.FC<TextFieldProps> = ({
|
|
|
166
168
|
} absolute right-0 adorement gap-1 flex items-center`;
|
|
167
169
|
break;
|
|
168
170
|
|
|
171
|
+
case "search":
|
|
172
|
+
className += `absolute inner-search-button gap-1 flex items-center cursor-pointer`;
|
|
173
|
+
break;
|
|
174
|
+
|
|
169
175
|
default:
|
|
170
176
|
break;
|
|
171
177
|
}
|
|
@@ -350,6 +356,19 @@ const TextField: React.FC<TextFieldProps> = ({
|
|
|
350
356
|
</label>
|
|
351
357
|
)}
|
|
352
358
|
</div>
|
|
359
|
+
{enableSearch && (
|
|
360
|
+
<button
|
|
361
|
+
disabled={disabled ?? readOnly}
|
|
362
|
+
onClick={() => onSearchClick?.(inputRef.current?.value || value || '')}
|
|
363
|
+
className={`${generateClassName("search")}`}
|
|
364
|
+
data-testid="tools-drop-arrow"
|
|
365
|
+
type="button"
|
|
366
|
+
id="search-btn-textfield"
|
|
367
|
+
ref={searchBtnRef}
|
|
368
|
+
>
|
|
369
|
+
<CustomIcons name="search" type="medium" />
|
|
370
|
+
</button>
|
|
371
|
+
)}
|
|
353
372
|
{(adorement ||
|
|
354
373
|
(showInfo && infoTitle) ||
|
|
355
374
|
step ||
|
package/src/commontypes.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FieldErrors, UseFormRegister } from 'react-hook-form';
|
|
2
2
|
|
|
3
3
|
export type ValueProps = {
|
|
4
|
-
[key: string]: string;
|
|
4
|
+
[key: string]: string | number | any;
|
|
5
5
|
};
|
|
6
6
|
export type TabPops = {
|
|
7
7
|
id: number | string;
|
|
@@ -85,6 +85,18 @@ export interface AutoSuggestionInputProps {
|
|
|
85
85
|
matchFromStart?: boolean // match data's from the starting position
|
|
86
86
|
autoDropdown?: boolean; // enable all items list items
|
|
87
87
|
enableSelectAll?: boolean // enable select all option
|
|
88
|
+
|
|
89
|
+
tabName?: string;
|
|
90
|
+
tabDesc?: string;
|
|
91
|
+
tabDescId?: string;
|
|
92
|
+
tabSelectedItems?: any[];
|
|
93
|
+
getTabData?: (key?: string) => Promise<any>;
|
|
94
|
+
tabData?: any[];
|
|
95
|
+
enableToolsTab?: boolean;
|
|
96
|
+
toolTabs?: TabPops[];
|
|
97
|
+
toolTabClearSwitch?: boolean;
|
|
98
|
+
onToolTabChange?: (value?: ValueProps | ValueProps[]) => void;
|
|
99
|
+
autoRefreshMainDropdown?: boolean;
|
|
88
100
|
}
|
|
89
101
|
export interface IconsProps {
|
|
90
102
|
name: any;
|
|
@@ -162,6 +174,8 @@ export interface TextFieldProps {
|
|
|
162
174
|
showInfo?: boolean;
|
|
163
175
|
inputType?: 'text' | 'textarea';
|
|
164
176
|
isModern?: boolean; // added for modern text field
|
|
177
|
+
enableSearch?: boolean; // enable search button in text field
|
|
178
|
+
onSearchClick?: (value: string) => void; // on search click event
|
|
165
179
|
}
|
|
166
180
|
|
|
167
181
|
export interface TextAreaProps {
|