@fangzsx/component-library 0.0.30 → 0.0.31
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.
|
@@ -47,10 +47,10 @@ function k({
|
|
|
47
47
|
$(() => {
|
|
48
48
|
l && setTimeout(() => f.current?.focus(), 50);
|
|
49
49
|
}, [l]);
|
|
50
|
-
const
|
|
50
|
+
const a = ee(() => {
|
|
51
51
|
const r = o.toLowerCase(), h = R(r);
|
|
52
52
|
return x.filter(
|
|
53
|
-
(
|
|
53
|
+
(c) => c.country.toLowerCase().includes(r) || c.dialCode.includes(r) || R(c.dialCode).includes(h) || c.iso.toLowerCase().includes(r)
|
|
54
54
|
);
|
|
55
55
|
}, [x, o]);
|
|
56
56
|
return !l || !n ? null : /* @__PURE__ */ e(
|
|
@@ -91,8 +91,8 @@ function k({
|
|
|
91
91
|
py: 0.5
|
|
92
92
|
},
|
|
93
93
|
children: [
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
a.length === 0 && /* @__PURE__ */ e(p, { variant: "body2", color: "text.secondary", sx: { px: 2, py: 1 }, children: "No results found" }),
|
|
95
|
+
a.map((r) => /* @__PURE__ */ t(
|
|
96
96
|
V,
|
|
97
97
|
{
|
|
98
98
|
onClick: () => y(r),
|
|
@@ -108,7 +108,7 @@ function k({
|
|
|
108
108
|
),
|
|
109
109
|
C && /* @__PURE__ */ t(p, { variant: "body2", color: "text.secondary", sx: { ml: 1, whiteSpace: "nowrap" }, children: [
|
|
110
110
|
"+",
|
|
111
|
-
r.
|
|
111
|
+
r.dialCode
|
|
112
112
|
] })
|
|
113
113
|
]
|
|
114
114
|
},
|
|
@@ -121,7 +121,7 @@ function k({
|
|
|
121
121
|
}
|
|
122
122
|
);
|
|
123
123
|
}
|
|
124
|
-
function
|
|
124
|
+
function ce(n) {
|
|
125
125
|
const {
|
|
126
126
|
mode: l,
|
|
127
127
|
options: x,
|
|
@@ -132,18 +132,18 @@ function ae(n) {
|
|
|
132
132
|
helperText: C,
|
|
133
133
|
disabled: i = !1,
|
|
134
134
|
renderFlag: u = te
|
|
135
|
-
} = n, [f,
|
|
135
|
+
} = n, [f, a] = v(!1), [r, h] = v(""), [c, E] = v(!1), [b, S] = v(!1), g = D(null), P = (s) => {
|
|
136
136
|
w({
|
|
137
137
|
iso: s.iso,
|
|
138
138
|
country: s.country,
|
|
139
|
-
dialCode: s.
|
|
139
|
+
dialCode: s.dialCode,
|
|
140
140
|
countryCode: s.iso
|
|
141
|
-
}),
|
|
141
|
+
}), a(!1), h("");
|
|
142
142
|
}, I = () => {
|
|
143
|
-
|
|
143
|
+
a(!1), h("");
|
|
144
144
|
};
|
|
145
145
|
if (l === "phone") {
|
|
146
|
-
const { phoneNumber: s, onPhoneChange: q, phoneError: F, phoneHelperText: M } = n, O = F ||
|
|
146
|
+
const { phoneNumber: s, onPhoneChange: q, phoneError: F, phoneHelperText: M } = n, O = F || c && !s.trim(), L = M || (c && !s.trim() ? "Phone number is required" : void 0), W = m || b && !o.iso, A = C || (b && !o.iso ? "Country is required" : void 0);
|
|
147
147
|
return /* @__PURE__ */ t(d, { sx: { position: "relative" }, children: [
|
|
148
148
|
/* @__PURE__ */ t(d, { sx: { display: "flex" }, children: [
|
|
149
149
|
/* @__PURE__ */ t(
|
|
@@ -151,7 +151,7 @@ function ae(n) {
|
|
|
151
151
|
{
|
|
152
152
|
ref: g,
|
|
153
153
|
tabIndex: 0,
|
|
154
|
-
onClick: () => !i &&
|
|
154
|
+
onClick: () => !i && a(!0),
|
|
155
155
|
onBlur: () => S(!0),
|
|
156
156
|
sx: {
|
|
157
157
|
display: "flex",
|
|
@@ -241,7 +241,7 @@ function ae(n) {
|
|
|
241
241
|
{
|
|
242
242
|
ref: g,
|
|
243
243
|
tabIndex: 0,
|
|
244
|
-
onClick: () => !i &&
|
|
244
|
+
onClick: () => !i && a(!0),
|
|
245
245
|
onBlur: () => S(!0),
|
|
246
246
|
sx: {
|
|
247
247
|
display: "flex",
|
|
@@ -291,5 +291,5 @@ function ae(n) {
|
|
|
291
291
|
}
|
|
292
292
|
export {
|
|
293
293
|
re as PH_DEFAULT,
|
|
294
|
-
|
|
294
|
+
ce as PhoneAndCountryDropdown
|
|
295
295
|
};
|