lecom-ui 5.0.0 → 5.0.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.
@@ -13,15 +13,18 @@ const MultiSelect = React.forwardRef(
13
13
  ({
14
14
  options,
15
15
  onValueChange,
16
- defaultValue = [],
16
+ value = [],
17
17
  placeholder = "Select options",
18
18
  maxCount = 3,
19
19
  modalPopover = false,
20
20
  className
21
21
  }, ref) => {
22
22
  const { t } = useTranslation();
23
- const [selectedValues, setSelectedValues] = React.useState(defaultValue);
23
+ const [selectedValues, setSelectedValues] = React.useState(value);
24
24
  const [isPopoverOpen, setIsPopoverOpen] = React.useState(false);
25
+ React.useEffect(() => {
26
+ setSelectedValues(value);
27
+ }, [value]);
25
28
  const handleInputKeyDown = (event) => {
26
29
  if (event.key === "Enter") {
27
30
  setIsPopoverOpen(true);
@@ -33,7 +36,7 @@ const MultiSelect = React.forwardRef(
33
36
  }
34
37
  };
35
38
  const toggleOption = (option) => {
36
- const newSelectedValues = selectedValues.includes(option) ? selectedValues.filter((value) => value !== option) : [...selectedValues, option];
39
+ const newSelectedValues = selectedValues.includes(option) ? selectedValues.filter((value2) => value2 !== option) : [...selectedValues, option];
37
40
  setSelectedValues(newSelectedValues);
38
41
  onValueChange(newSelectedValues);
39
42
  };
@@ -79,15 +82,15 @@ const MultiSelect = React.forwardRef(
79
82
  className
80
83
  )
81
84
  },
82
- selectedValues.length > 0 ? /* @__PURE__ */ React.createElement("div", { className: "flex justify-between items-center w-full" }, /* @__PURE__ */ React.createElement("div", { className: "flex flex-wrap items-center gap-1" }, selectedValues.slice(0, maxCount).map((value) => {
83
- const option = options.find((o) => o.value === value);
84
- return /* @__PURE__ */ React.createElement(Tag, { key: value, color: "blue", className: "focus:ring-0" }, option?.label, /* @__PURE__ */ React.createElement(
85
+ selectedValues.length > 0 ? /* @__PURE__ */ React.createElement("div", { className: "flex justify-between items-center w-full" }, /* @__PURE__ */ React.createElement("div", { className: "flex flex-wrap items-center gap-1" }, selectedValues.slice(0, maxCount).map((value2) => {
86
+ const option = options.find((o) => o.value === value2);
87
+ return /* @__PURE__ */ React.createElement(Tag, { key: value2, color: "blue", className: "focus:ring-0" }, option?.label, /* @__PURE__ */ React.createElement(
85
88
  X,
86
89
  {
87
90
  className: "h-4 w-4 cursor-pointer",
88
91
  onClick: (event) => {
89
92
  event.stopPropagation();
90
- toggleOption(value);
93
+ toggleOption(value2);
91
94
  }
92
95
  }
93
96
  ));
package/dist/index.d.ts CHANGED
@@ -609,9 +609,9 @@ interface HeaderProps extends React$1.HTMLAttributes<HTMLElement>, VariantProps<
609
609
  }
610
610
 
611
611
  declare const inputVariants: (props?: ({
612
- variant?: "filled" | "default" | "borderless" | null | undefined;
613
- size?: "small" | "large" | "default" | null | undefined;
614
- radius?: "small" | "large" | "default" | "full" | null | undefined;
612
+ variant?: "default" | "filled" | "borderless" | null | undefined;
613
+ size?: "default" | "small" | "large" | null | undefined;
614
+ radius?: "default" | "small" | "large" | "full" | null | undefined;
615
615
  } & class_variance_authority_types.ClassProp) | undefined) => string;
616
616
  interface InputProps extends Omit<React$1.InputHTMLAttributes<HTMLInputElement>, 'size' | 'sufix' | 'prefix'>, VariantProps<typeof inputVariants> {
617
617
  sufix?: React$1.ReactNode;
@@ -657,7 +657,7 @@ interface MultiSelectProps extends React$1.ButtonHTMLAttributes<HTMLButtonElemen
657
657
  value: string;
658
658
  }[];
659
659
  onValueChange: (value: string[]) => void;
660
- defaultValue?: string[];
660
+ value?: string[];
661
661
  placeholder?: string;
662
662
  maxCount?: number;
663
663
  modalPopover?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lecom-ui",
3
- "version": "5.0.0",
3
+ "version": "5.0.3",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "dist/index.js",
@@ -29,7 +29,7 @@
29
29
  "@radix-ui/react-dialog": "^1.1.11",
30
30
  "@radix-ui/react-dropdown-menu": "^2.1.4",
31
31
  "@radix-ui/react-label": "^2.1.4",
32
- "@radix-ui/react-popover": "^1.1.4",
32
+ "@radix-ui/react-popover": "^1.1.11",
33
33
  "@radix-ui/react-radio-group": "^1.2.2",
34
34
  "@radix-ui/react-scroll-area": "^1.2.2",
35
35
  "@radix-ui/react-select": "^2.2.2",