@majapisoftwares/ui 4.3.3 → 4.3.5

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, emptyClassName, ...props }: Omit<InputProps<undefined>, "value"> & {
3
+ declare function MultiSelectInput({ options, value, onChange, emptyLabel, ref, badgeClassName, name, onValueChange, inputClassName, emptyClassName, noneLabel, ...props }: Omit<InputProps<undefined>, "value"> & {
4
4
  options: {
5
5
  value: string;
6
6
  name: string;
@@ -10,6 +10,7 @@ declare function MultiSelectInput({ options, value, onChange, emptyLabel, ref, b
10
10
  emptyLabel?: string;
11
11
  badgeClassName?: string;
12
12
  emptyClassName?: string;
13
+ noneLabel?: string;
13
14
  }): import("react").JSX.Element;
14
15
  export type MultiSelectInputProps = ComponentProps<typeof MultiSelectInput>;
15
16
  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, emptyClassName, ...props }) {
10
+ function MultiSelectInput({ options, value, onChange, emptyLabel = "None", ref, badgeClassName, name, onValueChange, inputClassName, emptyClassName, noneLabel = "None", ...props }) {
11
11
  const { innerRef, innerValue, setInnerValue } = useInputRefValue({
12
12
  value,
13
13
  ref,
@@ -19,7 +19,7 @@ function MultiSelectInput({ options, value, onChange, emptyLabel = "None", ref,
19
19
  if (onValueChange) {
20
20
  onValueChange(innerValue || []);
21
21
  }
22
- }, [innerValue]);
22
+ }, [{ innerValue }]);
23
23
  emptyClassName = isEmpty
24
24
  ? clsx("text-zinc-500 dark:text-zinc-500", emptyClassName)
25
25
  : "p-1.5";
@@ -37,7 +37,7 @@ function MultiSelectInput({ options, value, onChange, emptyLabel = "None", ref,
37
37
  </DropdownMenu.Trigger>
38
38
  <DropdownMenu.Content>
39
39
  <DropdownMenu.Item onClick={() => setInnerValue([])}>
40
- {emptyLabel}
40
+ {noneLabel}
41
41
  </DropdownMenu.Item>
42
42
  {options.map((option) => (<DropdownMenu.CheckboxItem key={option.name} checked={innerValue?.includes(option.value)} onClick={() => setInnerValue(xor(innerValue, [option.value]))}>
43
43
  {option.name}
@@ -42,7 +42,7 @@ export default function useInputRefValue({ value, ref, name, onChange, }) {
42
42
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
43
43
  });
44
44
  }
45
- }, [innerValue]);
45
+ }, [{ innerValue }]);
46
46
  return {
47
47
  innerRef,
48
48
  innerValue,
package/package.json CHANGED
@@ -4,5 +4,5 @@
4
4
  "type": "git",
5
5
  "url": "https://github.com/majapisoftwares/ui.git"
6
6
  },
7
- "version": "4.3.3"
7
+ "version": "4.3.5"
8
8
  }