@charlesgomes/leafcode-shared-lib-react 1.0.72 → 1.0.73

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.
package/dist/index.d.mts CHANGED
@@ -102,7 +102,7 @@ interface PaginatedResponse$1 {
102
102
  interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
103
103
  name: string;
104
104
  label?: string;
105
- value?: string | number | readonly string[] | undefined;
105
+ value?: string;
106
106
  onChange?: (value: any) => void;
107
107
  onSelect: (item: any) => void;
108
108
  error?: FieldError;
package/dist/index.d.ts CHANGED
@@ -102,7 +102,7 @@ interface PaginatedResponse$1 {
102
102
  interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
103
103
  name: string;
104
104
  label?: string;
105
- value?: string | number | readonly string[] | undefined;
105
+ value?: string;
106
106
  onChange?: (value: any) => void;
107
107
  onSelect: (item: any) => void;
108
108
  error?: FieldError;
package/dist/index.js CHANGED
@@ -723,6 +723,7 @@ var InputBase3 = ({
723
723
  error,
724
724
  onChange,
725
725
  onSelect,
726
+ value,
726
727
  defaultValue,
727
728
  inputAutocompleteActive,
728
729
  queryKey,
@@ -750,7 +751,6 @@ var InputBase3 = ({
750
751
  "--input-height": theme.components.input.sizes.height,
751
752
  "--input-border-radius": theme.components.input.sizes.radius
752
753
  };
753
- const [value, setValue] = (0, import_react12.useState)("");
754
754
  const [items, setItems] = (0, import_react12.useState)([]);
755
755
  const [pageNumber, setPageNumber] = (0, import_react12.useState)(1);
756
756
  const [search, setSearch] = (0, import_react12.useState)("");
@@ -771,23 +771,11 @@ var InputBase3 = ({
771
771
  const debounced = import_lodash2.default.debounce(() => {
772
772
  setPageNumber(1);
773
773
  setItems([]);
774
- setSearch(value);
774
+ setSearch(value ?? "");
775
775
  }, 600);
776
776
  debounced();
777
777
  return () => debounced.cancel();
778
778
  }, [value]);
779
- (0, import_react12.useEffect)(() => {
780
- if (!defaultValue) return;
781
- setValue(defaultValue.label ?? defaultValue);
782
- }, [defaultValue]);
783
- (0, import_react12.useEffect)(() => {
784
- if (typeof rest.value === "string") {
785
- setValue(rest.value);
786
- }
787
- if (rest.value === null || rest.value === void 0) {
788
- setValue("");
789
- }
790
- }, [rest.value]);
791
779
  const handleScroll = () => {
792
780
  if (!listRef.current || !data) return;
793
781
  const { scrollTop, clientHeight, scrollHeight } = listRef.current;
@@ -796,7 +784,7 @@ var InputBase3 = ({
796
784
  }
797
785
  };
798
786
  const handleSelect = (item) => {
799
- setValue(item.nome);
787
+ onChange?.(item.nome);
800
788
  setIsOpen(false);
801
789
  onSelect(item);
802
790
  };
@@ -848,7 +836,6 @@ var InputBase3 = ({
848
836
  value: value ?? "",
849
837
  onChange: (e) => {
850
838
  const val = e.target.value;
851
- setValue(val);
852
839
  onChange?.(val);
853
840
  setIsOpen(true);
854
841
  },
@@ -861,7 +848,6 @@ var InputBase3 = ({
861
848
  {
862
849
  type: "button",
863
850
  onClick: () => {
864
- setValue("");
865
851
  setItems([]);
866
852
  setPageNumber(1);
867
853
  onChange?.("");
package/dist/index.mjs CHANGED
@@ -673,6 +673,7 @@ var InputBase3 = ({
673
673
  error,
674
674
  onChange,
675
675
  onSelect,
676
+ value,
676
677
  defaultValue,
677
678
  inputAutocompleteActive,
678
679
  queryKey,
@@ -700,7 +701,6 @@ var InputBase3 = ({
700
701
  "--input-height": theme.components.input.sizes.height,
701
702
  "--input-border-radius": theme.components.input.sizes.radius
702
703
  };
703
- const [value, setValue] = useState4("");
704
704
  const [items, setItems] = useState4([]);
705
705
  const [pageNumber, setPageNumber] = useState4(1);
706
706
  const [search, setSearch] = useState4("");
@@ -721,23 +721,11 @@ var InputBase3 = ({
721
721
  const debounced = _.debounce(() => {
722
722
  setPageNumber(1);
723
723
  setItems([]);
724
- setSearch(value);
724
+ setSearch(value ?? "");
725
725
  }, 600);
726
726
  debounced();
727
727
  return () => debounced.cancel();
728
728
  }, [value]);
729
- useEffect4(() => {
730
- if (!defaultValue) return;
731
- setValue(defaultValue.label ?? defaultValue);
732
- }, [defaultValue]);
733
- useEffect4(() => {
734
- if (typeof rest.value === "string") {
735
- setValue(rest.value);
736
- }
737
- if (rest.value === null || rest.value === void 0) {
738
- setValue("");
739
- }
740
- }, [rest.value]);
741
729
  const handleScroll = () => {
742
730
  if (!listRef.current || !data) return;
743
731
  const { scrollTop, clientHeight, scrollHeight } = listRef.current;
@@ -746,7 +734,7 @@ var InputBase3 = ({
746
734
  }
747
735
  };
748
736
  const handleSelect = (item) => {
749
- setValue(item.nome);
737
+ onChange?.(item.nome);
750
738
  setIsOpen(false);
751
739
  onSelect(item);
752
740
  };
@@ -798,7 +786,6 @@ var InputBase3 = ({
798
786
  value: value ?? "",
799
787
  onChange: (e) => {
800
788
  const val = e.target.value;
801
- setValue(val);
802
789
  onChange?.(val);
803
790
  setIsOpen(true);
804
791
  },
@@ -811,7 +798,6 @@ var InputBase3 = ({
811
798
  {
812
799
  type: "button",
813
800
  onClick: () => {
814
- setValue("");
815
801
  setItems([]);
816
802
  setPageNumber(1);
817
803
  onChange?.("");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@charlesgomes/leafcode-shared-lib-react",
3
- "version": "1.0.72",
3
+ "version": "1.0.73",
4
4
  "description": "Lib de componentes react",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",