@majapisoftwares/ui 4.3.2 → 4.3.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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ComponentProps } from "react";
|
|
2
2
|
import { type InputProps } from "./Input";
|
|
3
|
-
declare function MultiSelectInput({ options, value, onChange, emptyLabel, ref, badgeClassName, name, onValueChange, inputClassName, ...props }: Omit<InputProps<undefined>, "value"> & {
|
|
3
|
+
declare function MultiSelectInput({ options, value, onChange, emptyLabel, ref, badgeClassName, name, onValueChange, inputClassName, emptyClassName, ...props }: Omit<InputProps<undefined>, "value"> & {
|
|
4
4
|
options: {
|
|
5
5
|
value: string;
|
|
6
6
|
name: string;
|
|
@@ -9,6 +9,7 @@ declare function MultiSelectInput({ options, value, onChange, emptyLabel, ref, b
|
|
|
9
9
|
onValueChange?: (value: string[]) => void;
|
|
10
10
|
emptyLabel?: string;
|
|
11
11
|
badgeClassName?: string;
|
|
12
|
+
emptyClassName?: string;
|
|
12
13
|
}): import("react").JSX.Element;
|
|
13
14
|
export type MultiSelectInputProps = ComponentProps<typeof MultiSelectInput>;
|
|
14
15
|
export default MultiSelectInput;
|
|
@@ -7,7 +7,7 @@ import clsx from "../../utils/clsx";
|
|
|
7
7
|
import Badge from "../Badge";
|
|
8
8
|
import useInputRefValue from "./useInputRefValue";
|
|
9
9
|
import { useDeepCompareEffect } from "react-use";
|
|
10
|
-
function MultiSelectInput({ options, value, onChange, emptyLabel = "None", ref, badgeClassName, name, onValueChange, inputClassName, ...props }) {
|
|
10
|
+
function MultiSelectInput({ options, value, onChange, emptyLabel = "None", ref, badgeClassName, name, onValueChange, inputClassName, emptyClassName, ...props }) {
|
|
11
11
|
const { innerRef, innerValue, setInnerValue } = useInputRefValue({
|
|
12
12
|
value,
|
|
13
13
|
ref,
|
|
@@ -20,12 +20,12 @@ function MultiSelectInput({ options, value, onChange, emptyLabel = "None", ref,
|
|
|
20
20
|
onValueChange(innerValue || []);
|
|
21
21
|
}
|
|
22
22
|
}, [innerValue]);
|
|
23
|
+
emptyClassName = isEmpty
|
|
24
|
+
? clsx("text-zinc-500 dark:text-zinc-500", emptyClassName)
|
|
25
|
+
: "p-1.5";
|
|
23
26
|
return (<DropdownMenu.Root>
|
|
24
27
|
<DropdownMenu.Trigger asChild>
|
|
25
|
-
<Input as={Button} {...props} name={name} ref={innerRef} trailing={<ChevronDownIcon className="h-5 w-5 shrink-0"/>} inputClassName={clsx("text-left dark:hover:bg-zinc-700/70 bg-white gap-1.5 flex justify-start flex-wrap",
|
|
26
|
-
"text-zinc-500 dark:text-zinc-500": isEmpty,
|
|
27
|
-
"p-1.5": !isEmpty,
|
|
28
|
-
}, inputClassName)}>
|
|
28
|
+
<Input as={Button} {...props} name={name} ref={innerRef} trailing={<ChevronDownIcon className="h-5 w-5 shrink-0"/>} inputClassName={clsx("text-left dark:hover:bg-zinc-700/70 bg-white gap-1.5 flex justify-start flex-wrap", emptyClassName, inputClassName)}>
|
|
29
29
|
{isEmpty
|
|
30
30
|
? emptyLabel
|
|
31
31
|
: options
|
package/package.json
CHANGED