pentatrion-design 0.0.17 → 0.0.18
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.
|
@@ -7,15 +7,11 @@ export interface AutocompleteProps<O extends OptionLike = Option> {
|
|
|
7
7
|
className?: string;
|
|
8
8
|
icon?: boolean | ReactNode;
|
|
9
9
|
color?: ThemeColor;
|
|
10
|
-
/**
|
|
11
|
-
* render suffix only if selection
|
|
12
|
-
* ex: add contextuel buttons associated to selection
|
|
13
|
-
*/
|
|
14
|
-
selectionSuffix?: ReactNode;
|
|
15
10
|
/**
|
|
16
11
|
* render suffix only if selection and searchValue is empty
|
|
17
12
|
*/
|
|
18
13
|
noSearchSuffix?: ReactNode;
|
|
14
|
+
suffix?: ReactNode;
|
|
19
15
|
placement?: Placement;
|
|
20
16
|
placeholder?: string;
|
|
21
17
|
/**
|
|
@@ -11,7 +11,7 @@ import { Button } from "../button";
|
|
|
11
11
|
import { Dialog } from "../dialog";
|
|
12
12
|
import { Loader } from "../loader";
|
|
13
13
|
import { inputConfig } from "../input/Input";
|
|
14
|
-
export const Autocomplete = forwardRef(function Autocomplete({ className, icon = true, color = "yellow",
|
|
14
|
+
export const Autocomplete = forwardRef(function Autocomplete({ className, icon = true, color = "yellow", noSearchSuffix, suffix, placement = "bottom", placeholder = "Search...", selection = null, onChangeSelection, autocompleteOptionComponent, loading = false, clearSearchButton = false, searchValue, onChangeSearchValue, options, selectOnFocus = true, readOnly = false, }, inputRef) {
|
|
15
15
|
const [isOpen, setIsOpen] = useState(false);
|
|
16
16
|
const [activeIndex, setActiveIndex] = useState(null);
|
|
17
17
|
const onChangeSearchValueStable = useEventCallback(onChangeSearchValue);
|
|
@@ -121,7 +121,7 @@ export const Autocomplete = forwardRef(function Autocomplete({ className, icon =
|
|
|
121
121
|
handleSelect(activeIndex);
|
|
122
122
|
}
|
|
123
123
|
},
|
|
124
|
-
}) }), _jsxs("div", { className: "relative flex-center", children: [
|
|
124
|
+
}) }), _jsxs("div", { className: "relative flex-center", children: [suffix, showClearSearchButton && (_jsx(Button, { withRipple: false, icon: true, color: "gray", variant: "text", onClick: () => {
|
|
125
125
|
setIsOpen(false);
|
|
126
126
|
onChangeSelectionStable(null);
|
|
127
127
|
setActiveIndex(null);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AutocompleteProps } from "./Autocomplete";
|
|
2
2
|
import { OptionLike, Option } from "../select";
|
|
3
|
-
interface Props<O extends OptionLike = Option> extends Pick<AutocompleteProps<O>, "className" | "icon" | "color" | "
|
|
3
|
+
interface Props<O extends OptionLike = Option> extends Pick<AutocompleteProps<O>, "className" | "icon" | "color" | "suffix" | "noSearchSuffix" | "placement" | "placeholder" | "selection" | "onChangeSelection" | "autocompleteOptionComponent" | "loading" | "clearSearchButton" | "readOnly"> {
|
|
4
4
|
onChangeSearchValueCallback: (searchValue: string) => Promise<O[]>;
|
|
5
5
|
debounce?: number;
|
|
6
6
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AutocompleteProps } from "./Autocomplete";
|
|
2
2
|
import { Option, OptionLike } from "../select";
|
|
3
|
-
interface Props<O extends OptionLike = Option> extends Pick<AutocompleteProps<O>, "className" | "icon" | "color" | "placement" | "placeholder" | "selection" | "onChangeSelection" | "autocompleteOptionComponent" | "options" | "selection" | "readOnly"> {
|
|
3
|
+
interface Props<O extends OptionLike = Option> extends Pick<AutocompleteProps<O>, "className" | "icon" | "color" | "suffix" | "noSearchSuffix" | "placement" | "placeholder" | "selection" | "onChangeSelection" | "autocompleteOptionComponent" | "options" | "selection" | "readOnly"> {
|
|
4
4
|
}
|
|
5
5
|
export declare function SimpleAutocomplete<O extends OptionLike = Option>({ options, selection, onChangeSelection, ...rest }: Props<O>): import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
export {};
|