@charlesgomes/leafcode-shared-lib-react 1.0.71 → 1.0.72
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.js +16 -5
- package/dist/index.mjs +16 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -780,6 +780,14 @@ var InputBase3 = ({
|
|
|
780
780
|
if (!defaultValue) return;
|
|
781
781
|
setValue(defaultValue.label ?? defaultValue);
|
|
782
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]);
|
|
783
791
|
const handleScroll = () => {
|
|
784
792
|
if (!listRef.current || !data) return;
|
|
785
793
|
const { scrollTop, clientHeight, scrollHeight } = listRef.current;
|
|
@@ -814,7 +822,9 @@ var InputBase3 = ({
|
|
|
814
822
|
className: "input-wrapper",
|
|
815
823
|
style: styleVars,
|
|
816
824
|
tabIndex: -1,
|
|
817
|
-
onBlur: (e) =>
|
|
825
|
+
onBlur: (e) => {
|
|
826
|
+
e.relatedTarget === null && setIsOpen(false);
|
|
827
|
+
},
|
|
818
828
|
children: [
|
|
819
829
|
label && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
820
830
|
"label",
|
|
@@ -835,10 +845,11 @@ var InputBase3 = ({
|
|
|
835
845
|
placeholder,
|
|
836
846
|
autoComplete: "off",
|
|
837
847
|
className: "input",
|
|
838
|
-
value,
|
|
848
|
+
value: value ?? "",
|
|
839
849
|
onChange: (e) => {
|
|
840
|
-
|
|
841
|
-
|
|
850
|
+
const val = e.target.value;
|
|
851
|
+
setValue(val);
|
|
852
|
+
onChange?.(val);
|
|
842
853
|
setIsOpen(true);
|
|
843
854
|
},
|
|
844
855
|
onFocus: () => setIsOpen(true),
|
|
@@ -853,7 +864,7 @@ var InputBase3 = ({
|
|
|
853
864
|
setValue("");
|
|
854
865
|
setItems([]);
|
|
855
866
|
setPageNumber(1);
|
|
856
|
-
onChange?.(
|
|
867
|
+
onChange?.("");
|
|
857
868
|
onSelect(null);
|
|
858
869
|
},
|
|
859
870
|
className: "dropdown-clear",
|
package/dist/index.mjs
CHANGED
|
@@ -730,6 +730,14 @@ var InputBase3 = ({
|
|
|
730
730
|
if (!defaultValue) return;
|
|
731
731
|
setValue(defaultValue.label ?? defaultValue);
|
|
732
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]);
|
|
733
741
|
const handleScroll = () => {
|
|
734
742
|
if (!listRef.current || !data) return;
|
|
735
743
|
const { scrollTop, clientHeight, scrollHeight } = listRef.current;
|
|
@@ -764,7 +772,9 @@ var InputBase3 = ({
|
|
|
764
772
|
className: "input-wrapper",
|
|
765
773
|
style: styleVars,
|
|
766
774
|
tabIndex: -1,
|
|
767
|
-
onBlur: (e) =>
|
|
775
|
+
onBlur: (e) => {
|
|
776
|
+
e.relatedTarget === null && setIsOpen(false);
|
|
777
|
+
},
|
|
768
778
|
children: [
|
|
769
779
|
label && /* @__PURE__ */ jsx10(
|
|
770
780
|
"label",
|
|
@@ -785,10 +795,11 @@ var InputBase3 = ({
|
|
|
785
795
|
placeholder,
|
|
786
796
|
autoComplete: "off",
|
|
787
797
|
className: "input",
|
|
788
|
-
value,
|
|
798
|
+
value: value ?? "",
|
|
789
799
|
onChange: (e) => {
|
|
790
|
-
|
|
791
|
-
|
|
800
|
+
const val = e.target.value;
|
|
801
|
+
setValue(val);
|
|
802
|
+
onChange?.(val);
|
|
792
803
|
setIsOpen(true);
|
|
793
804
|
},
|
|
794
805
|
onFocus: () => setIsOpen(true),
|
|
@@ -803,7 +814,7 @@ var InputBase3 = ({
|
|
|
803
814
|
setValue("");
|
|
804
815
|
setItems([]);
|
|
805
816
|
setPageNumber(1);
|
|
806
|
-
onChange?.(
|
|
817
|
+
onChange?.("");
|
|
807
818
|
onSelect(null);
|
|
808
819
|
},
|
|
809
820
|
className: "dropdown-clear",
|