next-recomponents 2.0.45 → 2.0.46
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 +6 -5
- package/dist/index.mjs +6 -5
- package/package.json +1 -1
- package/src/select/index.tsx +10 -8
package/dist/index.js
CHANGED
|
@@ -36765,12 +36765,12 @@ function Select({
|
|
|
36765
36765
|
}).map((child) => {
|
|
36766
36766
|
return {
|
|
36767
36767
|
value: child.props.value,
|
|
36768
|
-
label: child.props.children
|
|
36768
|
+
label: import_react9.default.Children.toArray(child.props.children).join("")
|
|
36769
36769
|
};
|
|
36770
36770
|
});
|
|
36771
36771
|
setOptions(parsedOptions);
|
|
36772
36772
|
setFiltered(parsedOptions);
|
|
36773
|
-
const value = (props == null ? void 0 : props.value)
|
|
36773
|
+
const value = (props == null ? void 0 : props.value) ? ((_a = parsedOptions.find((opt) => opt.value == props.value)) == null ? void 0 : _a.label) || "" : "";
|
|
36774
36774
|
setInputValue(value);
|
|
36775
36775
|
}, [children]);
|
|
36776
36776
|
(0, import_react9.useEffect)(() => {
|
|
@@ -36798,7 +36798,8 @@ function Select({
|
|
|
36798
36798
|
}
|
|
36799
36799
|
};
|
|
36800
36800
|
const selectOption = (opt) => {
|
|
36801
|
-
|
|
36801
|
+
const v = `${opt.label}`;
|
|
36802
|
+
setInputValue(v);
|
|
36802
36803
|
setIsOpen(false);
|
|
36803
36804
|
};
|
|
36804
36805
|
const containerRef = (0, import_react9.useRef)(null);
|
|
@@ -36816,7 +36817,7 @@ function Select({
|
|
|
36816
36817
|
}
|
|
36817
36818
|
}, [isOpen]);
|
|
36818
36819
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { ref: containerRef, className: "w-full relative my-3", children: [
|
|
36819
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "relative flex items-center border rounded bg-white", children: [
|
|
36820
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "relative flex items-center border rounded bg-white ", children: [
|
|
36820
36821
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
36821
36822
|
"input",
|
|
36822
36823
|
{
|
|
@@ -36877,7 +36878,7 @@ function Select({
|
|
|
36877
36878
|
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CloseIcon, {})
|
|
36878
36879
|
}
|
|
36879
36880
|
),
|
|
36880
|
-
isOpen &&
|
|
36881
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
36881
36882
|
"div",
|
|
36882
36883
|
{
|
|
36883
36884
|
style: { zIndex: 9999999999 },
|
package/dist/index.mjs
CHANGED
|
@@ -36750,12 +36750,12 @@ function Select({
|
|
|
36750
36750
|
}).map((child) => {
|
|
36751
36751
|
return {
|
|
36752
36752
|
value: child.props.value,
|
|
36753
|
-
label: child.props.children
|
|
36753
|
+
label: React5.Children.toArray(child.props.children).join("")
|
|
36754
36754
|
};
|
|
36755
36755
|
});
|
|
36756
36756
|
setOptions(parsedOptions);
|
|
36757
36757
|
setFiltered(parsedOptions);
|
|
36758
|
-
const value = (props == null ? void 0 : props.value)
|
|
36758
|
+
const value = (props == null ? void 0 : props.value) ? ((_a = parsedOptions.find((opt) => opt.value == props.value)) == null ? void 0 : _a.label) || "" : "";
|
|
36759
36759
|
setInputValue(value);
|
|
36760
36760
|
}, [children]);
|
|
36761
36761
|
useEffect5(() => {
|
|
@@ -36783,7 +36783,8 @@ function Select({
|
|
|
36783
36783
|
}
|
|
36784
36784
|
};
|
|
36785
36785
|
const selectOption = (opt) => {
|
|
36786
|
-
|
|
36786
|
+
const v = `${opt.label}`;
|
|
36787
|
+
setInputValue(v);
|
|
36787
36788
|
setIsOpen(false);
|
|
36788
36789
|
};
|
|
36789
36790
|
const containerRef = useRef2(null);
|
|
@@ -36801,7 +36802,7 @@ function Select({
|
|
|
36801
36802
|
}
|
|
36802
36803
|
}, [isOpen]);
|
|
36803
36804
|
return /* @__PURE__ */ jsxs7("div", { ref: containerRef, className: "w-full relative my-3", children: [
|
|
36804
|
-
/* @__PURE__ */ jsxs7("div", { className: "relative flex items-center border rounded bg-white", children: [
|
|
36805
|
+
/* @__PURE__ */ jsxs7("div", { className: "relative flex items-center border rounded bg-white ", children: [
|
|
36805
36806
|
/* @__PURE__ */ jsx10(
|
|
36806
36807
|
"input",
|
|
36807
36808
|
{
|
|
@@ -36862,7 +36863,7 @@ function Select({
|
|
|
36862
36863
|
children: /* @__PURE__ */ jsx10(CloseIcon, {})
|
|
36863
36864
|
}
|
|
36864
36865
|
),
|
|
36865
|
-
isOpen &&
|
|
36866
|
+
isOpen && /* @__PURE__ */ jsx10(
|
|
36866
36867
|
"div",
|
|
36867
36868
|
{
|
|
36868
36869
|
style: { zIndex: 9999999999 },
|
package/package.json
CHANGED
package/src/select/index.tsx
CHANGED
|
@@ -56,14 +56,14 @@ export default function Select({
|
|
|
56
56
|
.map((child: any) => {
|
|
57
57
|
return {
|
|
58
58
|
value: child.props.value,
|
|
59
|
-
label: child.props.children,
|
|
59
|
+
label: React.Children.toArray(child.props.children).join(""),
|
|
60
60
|
};
|
|
61
61
|
});
|
|
62
62
|
setOptions(parsedOptions);
|
|
63
63
|
setFiltered(parsedOptions);
|
|
64
|
-
const value =
|
|
65
|
-
props?.
|
|
66
|
-
|
|
64
|
+
const value = props?.value
|
|
65
|
+
? parsedOptions.find((opt) => opt.value == props.value)?.label || ""
|
|
66
|
+
: "";
|
|
67
67
|
setInputValue(value);
|
|
68
68
|
}, [children]);
|
|
69
69
|
|
|
@@ -97,8 +97,9 @@ export default function Select({
|
|
|
97
97
|
};
|
|
98
98
|
|
|
99
99
|
const selectOption = (opt: { value: string; label: string }) => {
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
const v = `${opt.label}`;
|
|
101
|
+
|
|
102
|
+
setInputValue(v);
|
|
102
103
|
setIsOpen(false);
|
|
103
104
|
};
|
|
104
105
|
|
|
@@ -120,7 +121,7 @@ export default function Select({
|
|
|
120
121
|
}, [isOpen]);
|
|
121
122
|
return (
|
|
122
123
|
<div ref={containerRef} className="w-full relative my-3">
|
|
123
|
-
<div className="relative flex items-center border rounded bg-white">
|
|
124
|
+
<div className="relative flex items-center border rounded bg-white ">
|
|
124
125
|
<input
|
|
125
126
|
autoComplete="off"
|
|
126
127
|
ref={inputRef}
|
|
@@ -162,6 +163,7 @@ export default function Select({
|
|
|
162
163
|
onFocus={() => setIsOpen(true)}
|
|
163
164
|
onKeyDown={handleKeyDown}
|
|
164
165
|
/>
|
|
166
|
+
|
|
165
167
|
{label && (
|
|
166
168
|
<label className="absolute -top-2.5 left-2 text-xs font-bold px-1">
|
|
167
169
|
{label} {props?.required && <span className="text-red-500">*</span>}
|
|
@@ -190,7 +192,7 @@ export default function Select({
|
|
|
190
192
|
<CloseIcon />
|
|
191
193
|
</button>
|
|
192
194
|
)}
|
|
193
|
-
{isOpen &&
|
|
195
|
+
{isOpen && (
|
|
194
196
|
<div
|
|
195
197
|
style={{ zIndex: 9999999999 }}
|
|
196
198
|
className={`absolute w-full border rounded shadow bg-white z-10 max-h-100 top-10 overflow-y-auto ${
|