@tecsinapse/cortex-react 2.2.0-beta.1 → 2.2.0-beta.3
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.
|
@@ -23,7 +23,9 @@ const Autocomplete = ({
|
|
|
23
23
|
setInputValue,
|
|
24
24
|
label,
|
|
25
25
|
onChange,
|
|
26
|
-
|
|
26
|
+
onSelect,
|
|
27
|
+
disabled,
|
|
28
|
+
options
|
|
27
29
|
}) => {
|
|
28
30
|
const [triggerWidth, setTriggerWidth] = React.useState();
|
|
29
31
|
const [selectedValue, setSelectedValue] = React.useState({
|
|
@@ -43,6 +45,7 @@ const Autocomplete = ({
|
|
|
43
45
|
}
|
|
44
46
|
setInputValue("");
|
|
45
47
|
setOpen(false);
|
|
48
|
+
onSelect(option);
|
|
46
49
|
};
|
|
47
50
|
const handleChange = (event) => {
|
|
48
51
|
onChange(event);
|
|
@@ -85,7 +88,7 @@ const Autocomplete = ({
|
|
|
85
88
|
width: triggerWidth ? `${triggerWidth}px` : "auto"
|
|
86
89
|
},
|
|
87
90
|
initialFocus: -1,
|
|
88
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full flex flex-col overflow-y-auto", children: filteredOptions.map((op) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
91
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full flex flex-col overflow-y-auto", children: (options ?? filteredOptions ?? []).map((op) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
89
92
|
"div",
|
|
90
93
|
{
|
|
91
94
|
className: "flex w-full h-[3rem] items-center gap-centi p-centi cursor-pointer hover:bg-secondary-xlight bg-inherit",
|
|
@@ -21,7 +21,9 @@ const Autocomplete = ({
|
|
|
21
21
|
setInputValue,
|
|
22
22
|
label,
|
|
23
23
|
onChange,
|
|
24
|
-
|
|
24
|
+
onSelect,
|
|
25
|
+
disabled,
|
|
26
|
+
options
|
|
25
27
|
}) => {
|
|
26
28
|
const [triggerWidth, setTriggerWidth] = useState();
|
|
27
29
|
const [selectedValue, setSelectedValue] = useState({
|
|
@@ -41,6 +43,7 @@ const Autocomplete = ({
|
|
|
41
43
|
}
|
|
42
44
|
setInputValue("");
|
|
43
45
|
setOpen(false);
|
|
46
|
+
onSelect(option);
|
|
44
47
|
};
|
|
45
48
|
const handleChange = (event) => {
|
|
46
49
|
onChange(event);
|
|
@@ -83,7 +86,7 @@ const Autocomplete = ({
|
|
|
83
86
|
width: triggerWidth ? `${triggerWidth}px` : "auto"
|
|
84
87
|
},
|
|
85
88
|
initialFocus: -1,
|
|
86
|
-
children: /* @__PURE__ */ jsx("div", { className: "w-full flex flex-col overflow-y-auto", children: filteredOptions.map((op) => /* @__PURE__ */ jsx(
|
|
89
|
+
children: /* @__PURE__ */ jsx("div", { className: "w-full flex flex-col overflow-y-auto", children: (options ?? filteredOptions ?? []).map((op) => /* @__PURE__ */ jsx(
|
|
87
90
|
"div",
|
|
88
91
|
{
|
|
89
92
|
className: "flex w-full h-[3rem] items-center gap-centi p-centi cursor-pointer hover:bg-secondary-xlight bg-inherit",
|
|
@@ -3,9 +3,15 @@ interface AutocompleteProps {
|
|
|
3
3
|
inputValue: string;
|
|
4
4
|
setInputValue: React.Dispatch<React.SetStateAction<string>>;
|
|
5
5
|
onChange: ChangeEventHandler<HTMLInputElement>;
|
|
6
|
+
onSelect: (option: Option) => void;
|
|
6
7
|
label?: string;
|
|
7
8
|
placeholder?: string;
|
|
8
9
|
disabled?: boolean;
|
|
10
|
+
options: Option[];
|
|
9
11
|
}
|
|
10
|
-
|
|
12
|
+
interface Option {
|
|
13
|
+
label: string;
|
|
14
|
+
value: string;
|
|
15
|
+
}
|
|
16
|
+
export declare const Autocomplete: ({ inputValue, setInputValue, label, onChange, onSelect, disabled, options, }: AutocompleteProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
17
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tecsinapse/cortex-react",
|
|
3
|
-
"version": "2.2.0-beta.
|
|
3
|
+
"version": "2.2.0-beta.3",
|
|
4
4
|
"description": "React components based in @tecsinapse/cortex-core",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"react-icons": ">=5.2.0",
|
|
49
49
|
"tailwindcss": "^4.1.16"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "a8768e0f4e02c8b8c0494f0741284d21c2eb0e4b"
|
|
52
52
|
}
|