@majapisoftwares/ui 4.3.1 → 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} onChange={onChange} 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
@@ -39,7 +39,7 @@ function MultiSelectInput({ options, value, onChange, emptyLabel = "None", ref,
39
39
  <DropdownMenu.Item onClick={() => setInnerValue([])}>
40
40
  {emptyLabel}
41
41
  </DropdownMenu.Item>
42
- {options.map((option) => (<DropdownMenu.CheckboxItem key={option.name} checked={innerValue?.includes(option.value)} onClick={() => setInnerValue(xor(value, [option.value]))}>
42
+ {options.map((option) => (<DropdownMenu.CheckboxItem key={option.name} checked={innerValue?.includes(option.value)} onClick={() => setInnerValue(xor(innerValue, [option.value]))}>
43
43
  {option.name}
44
44
  </DropdownMenu.CheckboxItem>))}
45
45
  </DropdownMenu.Content>
@@ -14,7 +14,7 @@ function SelectInput({ options, onChange, ref, placeholder, inputClassName, valu
14
14
  value: innerValue,
15
15
  onValueChange: setInnerValue,
16
16
  }}>
17
- <Select.Trigger placeholder={placeholder} buttonClassName={clsx("bg-white dark:hover:bg-zinc-700/70 dark:bg-zinc-800 w-full justify-between", inputClassName)}/>
17
+ <Select.Trigger placeholder={placeholder} buttonClassName={clsx("bg-white dark:hover:bg-zinc-700/70 dark:bg-zinc-800 w-full justify-between min-h-[38px]", inputClassName)}/>
18
18
  <Select.Content>
19
19
  {options?.map((option) => (<Select.Item key={option.value} value={option.value}>
20
20
  {option.name}
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.1"
7
+ "version": "4.3.3"
8
8
  }