@starasia/input 1.0.1 → 1.0.2
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/input.es.js +153 -794
- package/dist/input.umd.js +2 -33
- package/package.json +6 -6
package/dist/input.es.js
CHANGED
|
@@ -1,647 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* @license React
|
|
5
|
-
* react-jsx-runtime.production.min.js
|
|
6
|
-
*
|
|
7
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the MIT license found in the
|
|
10
|
-
* LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/
|
|
12
|
-
var Nr;
|
|
13
|
-
function En() {
|
|
14
|
-
if (Nr)
|
|
15
|
-
return J;
|
|
16
|
-
Nr = 1;
|
|
17
|
-
var t = tr, u = Symbol.for("react.element"), b = Symbol.for("react.fragment"), x = Object.prototype.hasOwnProperty, E = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, d = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
18
|
-
function A(I, l, _) {
|
|
19
|
-
var p, w = {}, T = null, D = null;
|
|
20
|
-
_ !== void 0 && (T = "" + _), l.key !== void 0 && (T = "" + l.key), l.ref !== void 0 && (D = l.ref);
|
|
21
|
-
for (p in l)
|
|
22
|
-
x.call(l, p) && !d.hasOwnProperty(p) && (w[p] = l[p]);
|
|
23
|
-
if (I && I.defaultProps)
|
|
24
|
-
for (p in l = I.defaultProps, l)
|
|
25
|
-
w[p] === void 0 && (w[p] = l[p]);
|
|
26
|
-
return { $$typeof: u, type: I, key: T, ref: D, props: w, _owner: E.current };
|
|
27
|
-
}
|
|
28
|
-
return J.Fragment = b, J.jsx = A, J.jsxs = A, J;
|
|
29
|
-
}
|
|
30
|
-
var G = {};
|
|
31
|
-
/**
|
|
32
|
-
* @license React
|
|
33
|
-
* react-jsx-runtime.development.js
|
|
34
|
-
*
|
|
35
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
36
|
-
*
|
|
37
|
-
* This source code is licensed under the MIT license found in the
|
|
38
|
-
* LICENSE file in the root directory of this source tree.
|
|
39
|
-
*/
|
|
40
|
-
var Wr;
|
|
41
|
-
function wn() {
|
|
42
|
-
return Wr || (Wr = 1, process.env.NODE_ENV !== "production" && function() {
|
|
43
|
-
var t = tr, u = Symbol.for("react.element"), b = Symbol.for("react.portal"), x = Symbol.for("react.fragment"), E = Symbol.for("react.strict_mode"), d = Symbol.for("react.profiler"), A = Symbol.for("react.provider"), I = Symbol.for("react.context"), l = Symbol.for("react.forward_ref"), _ = Symbol.for("react.suspense"), p = Symbol.for("react.suspense_list"), w = Symbol.for("react.memo"), T = Symbol.for("react.lazy"), D = Symbol.for("react.offscreen"), X = Symbol.iterator, N = "@@iterator";
|
|
44
|
-
function ir(r) {
|
|
45
|
-
if (r === null || typeof r != "object")
|
|
46
|
-
return null;
|
|
47
|
-
var n = X && r[X] || r[N];
|
|
48
|
-
return typeof n == "function" ? n : null;
|
|
49
|
-
}
|
|
50
|
-
var c = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
51
|
-
function R(r) {
|
|
52
|
-
{
|
|
53
|
-
for (var n = arguments.length, a = new Array(n > 1 ? n - 1 : 0), e = 1; e < n; e++)
|
|
54
|
-
a[e - 1] = arguments[e];
|
|
55
|
-
W("error", r, a);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
function W(r, n, a) {
|
|
59
|
-
{
|
|
60
|
-
var e = c.ReactDebugCurrentFrame, s = e.getStackAddendum();
|
|
61
|
-
s !== "" && (n += "%s", a = a.concat([s]));
|
|
62
|
-
var f = a.map(function(o) {
|
|
63
|
-
return String(o);
|
|
64
|
-
});
|
|
65
|
-
f.unshift("Warning: " + n), Function.prototype.apply.call(console[r], console, f);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
var F = !1, Y = !1, or = !1, Z = !1, Q = !1, B;
|
|
69
|
-
B = Symbol.for("react.module.reference");
|
|
70
|
-
function sr(r) {
|
|
71
|
-
return !!(typeof r == "string" || typeof r == "function" || r === x || r === d || Q || r === E || r === _ || r === p || Z || r === D || F || Y || or || typeof r == "object" && r !== null && (r.$$typeof === T || r.$$typeof === w || r.$$typeof === A || r.$$typeof === I || r.$$typeof === l || // This needs to include all possible module reference object
|
|
72
|
-
// types supported by any Flight configuration anywhere since
|
|
73
|
-
// we don't know which Flight build this will end up being used
|
|
74
|
-
// with.
|
|
75
|
-
r.$$typeof === B || r.getModuleId !== void 0));
|
|
76
|
-
}
|
|
77
|
-
function ur(r, n, a) {
|
|
78
|
-
var e = r.displayName;
|
|
79
|
-
if (e)
|
|
80
|
-
return e;
|
|
81
|
-
var s = n.displayName || n.name || "";
|
|
82
|
-
return s !== "" ? a + "(" + s + ")" : a;
|
|
83
|
-
}
|
|
84
|
-
function y(r) {
|
|
85
|
-
return r.displayName || "Context";
|
|
86
|
-
}
|
|
87
|
-
function g(r) {
|
|
88
|
-
if (r == null)
|
|
89
|
-
return null;
|
|
90
|
-
if (typeof r.tag == "number" && R("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof r == "function")
|
|
91
|
-
return r.displayName || r.name || null;
|
|
92
|
-
if (typeof r == "string")
|
|
93
|
-
return r;
|
|
94
|
-
switch (r) {
|
|
95
|
-
case x:
|
|
96
|
-
return "Fragment";
|
|
97
|
-
case b:
|
|
98
|
-
return "Portal";
|
|
99
|
-
case d:
|
|
100
|
-
return "Profiler";
|
|
101
|
-
case E:
|
|
102
|
-
return "StrictMode";
|
|
103
|
-
case _:
|
|
104
|
-
return "Suspense";
|
|
105
|
-
case p:
|
|
106
|
-
return "SuspenseList";
|
|
107
|
-
}
|
|
108
|
-
if (typeof r == "object")
|
|
109
|
-
switch (r.$$typeof) {
|
|
110
|
-
case I:
|
|
111
|
-
var n = r;
|
|
112
|
-
return y(n) + ".Consumer";
|
|
113
|
-
case A:
|
|
114
|
-
var a = r;
|
|
115
|
-
return y(a._context) + ".Provider";
|
|
116
|
-
case l:
|
|
117
|
-
return ur(r, r.render, "ForwardRef");
|
|
118
|
-
case w:
|
|
119
|
-
var e = r.displayName || null;
|
|
120
|
-
return e !== null ? e : g(r.type) || "Memo";
|
|
121
|
-
case T: {
|
|
122
|
-
var s = r, f = s._payload, o = s._init;
|
|
123
|
-
try {
|
|
124
|
-
return g(o(f));
|
|
125
|
-
} catch {
|
|
126
|
-
return null;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
return null;
|
|
131
|
-
}
|
|
132
|
-
var m = Object.assign, j = 0, L, O, $, xr, Er, wr, Rr;
|
|
133
|
-
function _r() {
|
|
134
|
-
}
|
|
135
|
-
_r.__reactDisabledLog = !0;
|
|
136
|
-
function Kr() {
|
|
137
|
-
{
|
|
138
|
-
if (j === 0) {
|
|
139
|
-
L = console.log, O = console.info, $ = console.warn, xr = console.error, Er = console.group, wr = console.groupCollapsed, Rr = console.groupEnd;
|
|
140
|
-
var r = {
|
|
141
|
-
configurable: !0,
|
|
142
|
-
enumerable: !0,
|
|
143
|
-
value: _r,
|
|
144
|
-
writable: !0
|
|
145
|
-
};
|
|
146
|
-
Object.defineProperties(console, {
|
|
147
|
-
info: r,
|
|
148
|
-
log: r,
|
|
149
|
-
warn: r,
|
|
150
|
-
error: r,
|
|
151
|
-
group: r,
|
|
152
|
-
groupCollapsed: r,
|
|
153
|
-
groupEnd: r
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
j++;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
function Jr() {
|
|
160
|
-
{
|
|
161
|
-
if (j--, j === 0) {
|
|
162
|
-
var r = {
|
|
163
|
-
configurable: !0,
|
|
164
|
-
enumerable: !0,
|
|
165
|
-
writable: !0
|
|
166
|
-
};
|
|
167
|
-
Object.defineProperties(console, {
|
|
168
|
-
log: m({}, r, {
|
|
169
|
-
value: L
|
|
170
|
-
}),
|
|
171
|
-
info: m({}, r, {
|
|
172
|
-
value: O
|
|
173
|
-
}),
|
|
174
|
-
warn: m({}, r, {
|
|
175
|
-
value: $
|
|
176
|
-
}),
|
|
177
|
-
error: m({}, r, {
|
|
178
|
-
value: xr
|
|
179
|
-
}),
|
|
180
|
-
group: m({}, r, {
|
|
181
|
-
value: Er
|
|
182
|
-
}),
|
|
183
|
-
groupCollapsed: m({}, r, {
|
|
184
|
-
value: wr
|
|
185
|
-
}),
|
|
186
|
-
groupEnd: m({}, r, {
|
|
187
|
-
value: Rr
|
|
188
|
-
})
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
j < 0 && R("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
var lr = c.ReactCurrentDispatcher, cr;
|
|
195
|
-
function rr(r, n, a) {
|
|
196
|
-
{
|
|
197
|
-
if (cr === void 0)
|
|
198
|
-
try {
|
|
199
|
-
throw Error();
|
|
200
|
-
} catch (s) {
|
|
201
|
-
var e = s.stack.trim().match(/\n( *(at )?)/);
|
|
202
|
-
cr = e && e[1] || "";
|
|
203
|
-
}
|
|
204
|
-
return `
|
|
205
|
-
` + cr + r;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
var fr = !1, nr;
|
|
209
|
-
{
|
|
210
|
-
var Gr = typeof WeakMap == "function" ? WeakMap : Map;
|
|
211
|
-
nr = new Gr();
|
|
212
|
-
}
|
|
213
|
-
function Cr(r, n) {
|
|
214
|
-
if (!r || fr)
|
|
215
|
-
return "";
|
|
216
|
-
{
|
|
217
|
-
var a = nr.get(r);
|
|
218
|
-
if (a !== void 0)
|
|
219
|
-
return a;
|
|
220
|
-
}
|
|
221
|
-
var e;
|
|
222
|
-
fr = !0;
|
|
223
|
-
var s = Error.prepareStackTrace;
|
|
224
|
-
Error.prepareStackTrace = void 0;
|
|
225
|
-
var f;
|
|
226
|
-
f = lr.current, lr.current = null, Kr();
|
|
227
|
-
try {
|
|
228
|
-
if (n) {
|
|
229
|
-
var o = function() {
|
|
230
|
-
throw Error();
|
|
231
|
-
};
|
|
232
|
-
if (Object.defineProperty(o.prototype, "props", {
|
|
233
|
-
set: function() {
|
|
234
|
-
throw Error();
|
|
235
|
-
}
|
|
236
|
-
}), typeof Reflect == "object" && Reflect.construct) {
|
|
237
|
-
try {
|
|
238
|
-
Reflect.construct(o, []);
|
|
239
|
-
} catch (k) {
|
|
240
|
-
e = k;
|
|
241
|
-
}
|
|
242
|
-
Reflect.construct(r, [], o);
|
|
243
|
-
} else {
|
|
244
|
-
try {
|
|
245
|
-
o.call();
|
|
246
|
-
} catch (k) {
|
|
247
|
-
e = k;
|
|
248
|
-
}
|
|
249
|
-
r.call(o.prototype);
|
|
250
|
-
}
|
|
251
|
-
} else {
|
|
252
|
-
try {
|
|
253
|
-
throw Error();
|
|
254
|
-
} catch (k) {
|
|
255
|
-
e = k;
|
|
256
|
-
}
|
|
257
|
-
r();
|
|
258
|
-
}
|
|
259
|
-
} catch (k) {
|
|
260
|
-
if (k && e && typeof k.stack == "string") {
|
|
261
|
-
for (var i = k.stack.split(`
|
|
262
|
-
`), C = e.stack.split(`
|
|
263
|
-
`), v = i.length - 1, h = C.length - 1; v >= 1 && h >= 0 && i[v] !== C[h]; )
|
|
264
|
-
h--;
|
|
265
|
-
for (; v >= 1 && h >= 0; v--, h--)
|
|
266
|
-
if (i[v] !== C[h]) {
|
|
267
|
-
if (v !== 1 || h !== 1)
|
|
268
|
-
do
|
|
269
|
-
if (v--, h--, h < 0 || i[v] !== C[h]) {
|
|
270
|
-
var P = `
|
|
271
|
-
` + i[v].replace(" at new ", " at ");
|
|
272
|
-
return r.displayName && P.includes("<anonymous>") && (P = P.replace("<anonymous>", r.displayName)), typeof r == "function" && nr.set(r, P), P;
|
|
273
|
-
}
|
|
274
|
-
while (v >= 1 && h >= 0);
|
|
275
|
-
break;
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
} finally {
|
|
279
|
-
fr = !1, lr.current = f, Jr(), Error.prepareStackTrace = s;
|
|
280
|
-
}
|
|
281
|
-
var z = r ? r.displayName || r.name : "", V = z ? rr(z) : "";
|
|
282
|
-
return typeof r == "function" && nr.set(r, V), V;
|
|
283
|
-
}
|
|
284
|
-
function Hr(r, n, a) {
|
|
285
|
-
return Cr(r, !1);
|
|
286
|
-
}
|
|
287
|
-
function Xr(r) {
|
|
288
|
-
var n = r.prototype;
|
|
289
|
-
return !!(n && n.isReactComponent);
|
|
290
|
-
}
|
|
291
|
-
function ar(r, n, a) {
|
|
292
|
-
if (r == null)
|
|
293
|
-
return "";
|
|
294
|
-
if (typeof r == "function")
|
|
295
|
-
return Cr(r, Xr(r));
|
|
296
|
-
if (typeof r == "string")
|
|
297
|
-
return rr(r);
|
|
298
|
-
switch (r) {
|
|
299
|
-
case _:
|
|
300
|
-
return rr("Suspense");
|
|
301
|
-
case p:
|
|
302
|
-
return rr("SuspenseList");
|
|
303
|
-
}
|
|
304
|
-
if (typeof r == "object")
|
|
305
|
-
switch (r.$$typeof) {
|
|
306
|
-
case l:
|
|
307
|
-
return Hr(r.render);
|
|
308
|
-
case w:
|
|
309
|
-
return ar(r.type, n, a);
|
|
310
|
-
case T: {
|
|
311
|
-
var e = r, s = e._payload, f = e._init;
|
|
312
|
-
try {
|
|
313
|
-
return ar(f(s), n, a);
|
|
314
|
-
} catch {
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
return "";
|
|
319
|
-
}
|
|
320
|
-
var M = Object.prototype.hasOwnProperty, Sr = {}, kr = c.ReactDebugCurrentFrame;
|
|
321
|
-
function er(r) {
|
|
322
|
-
if (r) {
|
|
323
|
-
var n = r._owner, a = ar(r.type, r._source, n ? n.type : null);
|
|
324
|
-
kr.setExtraStackFrame(a);
|
|
325
|
-
} else
|
|
326
|
-
kr.setExtraStackFrame(null);
|
|
327
|
-
}
|
|
328
|
-
function Zr(r, n, a, e, s) {
|
|
329
|
-
{
|
|
330
|
-
var f = Function.call.bind(M);
|
|
331
|
-
for (var o in r)
|
|
332
|
-
if (f(r, o)) {
|
|
333
|
-
var i = void 0;
|
|
334
|
-
try {
|
|
335
|
-
if (typeof r[o] != "function") {
|
|
336
|
-
var C = Error((e || "React class") + ": " + a + " type `" + o + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof r[o] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
337
|
-
throw C.name = "Invariant Violation", C;
|
|
338
|
-
}
|
|
339
|
-
i = r[o](n, o, e, a, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
340
|
-
} catch (v) {
|
|
341
|
-
i = v;
|
|
342
|
-
}
|
|
343
|
-
i && !(i instanceof Error) && (er(s), R("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", e || "React class", a, o, typeof i), er(null)), i instanceof Error && !(i.message in Sr) && (Sr[i.message] = !0, er(s), R("Failed %s type: %s", a, i.message), er(null));
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
var Qr = Array.isArray;
|
|
348
|
-
function dr(r) {
|
|
349
|
-
return Qr(r);
|
|
350
|
-
}
|
|
351
|
-
function rn(r) {
|
|
352
|
-
{
|
|
353
|
-
var n = typeof Symbol == "function" && Symbol.toStringTag, a = n && r[Symbol.toStringTag] || r.constructor.name || "Object";
|
|
354
|
-
return a;
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
function nn(r) {
|
|
358
|
-
try {
|
|
359
|
-
return Tr(r), !1;
|
|
360
|
-
} catch {
|
|
361
|
-
return !0;
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
function Tr(r) {
|
|
365
|
-
return "" + r;
|
|
366
|
-
}
|
|
367
|
-
function jr(r) {
|
|
368
|
-
if (nn(r))
|
|
369
|
-
return R("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", rn(r)), Tr(r);
|
|
370
|
-
}
|
|
371
|
-
var K = c.ReactCurrentOwner, an = {
|
|
372
|
-
key: !0,
|
|
373
|
-
ref: !0,
|
|
374
|
-
__self: !0,
|
|
375
|
-
__source: !0
|
|
376
|
-
}, Or, Pr, pr;
|
|
377
|
-
pr = {};
|
|
378
|
-
function en(r) {
|
|
379
|
-
if (M.call(r, "ref")) {
|
|
380
|
-
var n = Object.getOwnPropertyDescriptor(r, "ref").get;
|
|
381
|
-
if (n && n.isReactWarning)
|
|
382
|
-
return !1;
|
|
383
|
-
}
|
|
384
|
-
return r.ref !== void 0;
|
|
385
|
-
}
|
|
386
|
-
function tn(r) {
|
|
387
|
-
if (M.call(r, "key")) {
|
|
388
|
-
var n = Object.getOwnPropertyDescriptor(r, "key").get;
|
|
389
|
-
if (n && n.isReactWarning)
|
|
390
|
-
return !1;
|
|
391
|
-
}
|
|
392
|
-
return r.key !== void 0;
|
|
393
|
-
}
|
|
394
|
-
function on(r, n) {
|
|
395
|
-
if (typeof r.ref == "string" && K.current && n && K.current.stateNode !== n) {
|
|
396
|
-
var a = g(K.current.type);
|
|
397
|
-
pr[a] || (R('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', g(K.current.type), r.ref), pr[a] = !0);
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
function sn(r, n) {
|
|
401
|
-
{
|
|
402
|
-
var a = function() {
|
|
403
|
-
Or || (Or = !0, R("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", n));
|
|
404
|
-
};
|
|
405
|
-
a.isReactWarning = !0, Object.defineProperty(r, "key", {
|
|
406
|
-
get: a,
|
|
407
|
-
configurable: !0
|
|
408
|
-
});
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
function un(r, n) {
|
|
412
|
-
{
|
|
413
|
-
var a = function() {
|
|
414
|
-
Pr || (Pr = !0, R("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", n));
|
|
415
|
-
};
|
|
416
|
-
a.isReactWarning = !0, Object.defineProperty(r, "ref", {
|
|
417
|
-
get: a,
|
|
418
|
-
configurable: !0
|
|
419
|
-
});
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
var ln = function(r, n, a, e, s, f, o) {
|
|
423
|
-
var i = {
|
|
424
|
-
// This tag allows us to uniquely identify this as a React Element
|
|
425
|
-
$$typeof: u,
|
|
426
|
-
// Built-in properties that belong on the element
|
|
427
|
-
type: r,
|
|
428
|
-
key: n,
|
|
429
|
-
ref: a,
|
|
430
|
-
props: o,
|
|
431
|
-
// Record the component responsible for creating this element.
|
|
432
|
-
_owner: f
|
|
433
|
-
};
|
|
434
|
-
return i._store = {}, Object.defineProperty(i._store, "validated", {
|
|
435
|
-
configurable: !1,
|
|
436
|
-
enumerable: !1,
|
|
437
|
-
writable: !0,
|
|
438
|
-
value: !1
|
|
439
|
-
}), Object.defineProperty(i, "_self", {
|
|
440
|
-
configurable: !1,
|
|
441
|
-
enumerable: !1,
|
|
442
|
-
writable: !1,
|
|
443
|
-
value: e
|
|
444
|
-
}), Object.defineProperty(i, "_source", {
|
|
445
|
-
configurable: !1,
|
|
446
|
-
enumerable: !1,
|
|
447
|
-
writable: !1,
|
|
448
|
-
value: s
|
|
449
|
-
}), Object.freeze && (Object.freeze(i.props), Object.freeze(i)), i;
|
|
450
|
-
};
|
|
451
|
-
function cn(r, n, a, e, s) {
|
|
452
|
-
{
|
|
453
|
-
var f, o = {}, i = null, C = null;
|
|
454
|
-
a !== void 0 && (jr(a), i = "" + a), tn(n) && (jr(n.key), i = "" + n.key), en(n) && (C = n.ref, on(n, s));
|
|
455
|
-
for (f in n)
|
|
456
|
-
M.call(n, f) && !an.hasOwnProperty(f) && (o[f] = n[f]);
|
|
457
|
-
if (r && r.defaultProps) {
|
|
458
|
-
var v = r.defaultProps;
|
|
459
|
-
for (f in v)
|
|
460
|
-
o[f] === void 0 && (o[f] = v[f]);
|
|
461
|
-
}
|
|
462
|
-
if (i || C) {
|
|
463
|
-
var h = typeof r == "function" ? r.displayName || r.name || "Unknown" : r;
|
|
464
|
-
i && sn(o, h), C && un(o, h);
|
|
465
|
-
}
|
|
466
|
-
return ln(r, i, C, s, e, K.current, o);
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
var gr = c.ReactCurrentOwner, Ir = c.ReactDebugCurrentFrame;
|
|
470
|
-
function q(r) {
|
|
471
|
-
if (r) {
|
|
472
|
-
var n = r._owner, a = ar(r.type, r._source, n ? n.type : null);
|
|
473
|
-
Ir.setExtraStackFrame(a);
|
|
474
|
-
} else
|
|
475
|
-
Ir.setExtraStackFrame(null);
|
|
476
|
-
}
|
|
477
|
-
var vr;
|
|
478
|
-
vr = !1;
|
|
479
|
-
function hr(r) {
|
|
480
|
-
return typeof r == "object" && r !== null && r.$$typeof === u;
|
|
481
|
-
}
|
|
482
|
-
function Dr() {
|
|
483
|
-
{
|
|
484
|
-
if (gr.current) {
|
|
485
|
-
var r = g(gr.current.type);
|
|
486
|
-
if (r)
|
|
487
|
-
return `
|
|
488
|
-
|
|
489
|
-
Check the render method of \`` + r + "`.";
|
|
490
|
-
}
|
|
491
|
-
return "";
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
function fn(r) {
|
|
495
|
-
{
|
|
496
|
-
if (r !== void 0) {
|
|
497
|
-
var n = r.fileName.replace(/^.*[\\\/]/, ""), a = r.lineNumber;
|
|
498
|
-
return `
|
|
499
|
-
|
|
500
|
-
Check your code at ` + n + ":" + a + ".";
|
|
501
|
-
}
|
|
502
|
-
return "";
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
var Ar = {};
|
|
506
|
-
function dn(r) {
|
|
507
|
-
{
|
|
508
|
-
var n = Dr();
|
|
509
|
-
if (!n) {
|
|
510
|
-
var a = typeof r == "string" ? r : r.displayName || r.name;
|
|
511
|
-
a && (n = `
|
|
512
|
-
|
|
513
|
-
Check the top-level render call using <` + a + ">.");
|
|
514
|
-
}
|
|
515
|
-
return n;
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
function Fr(r, n) {
|
|
519
|
-
{
|
|
520
|
-
if (!r._store || r._store.validated || r.key != null)
|
|
521
|
-
return;
|
|
522
|
-
r._store.validated = !0;
|
|
523
|
-
var a = dn(n);
|
|
524
|
-
if (Ar[a])
|
|
525
|
-
return;
|
|
526
|
-
Ar[a] = !0;
|
|
527
|
-
var e = "";
|
|
528
|
-
r && r._owner && r._owner !== gr.current && (e = " It was passed a child from " + g(r._owner.type) + "."), q(r), R('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', a, e), q(null);
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
function Lr(r, n) {
|
|
532
|
-
{
|
|
533
|
-
if (typeof r != "object")
|
|
534
|
-
return;
|
|
535
|
-
if (dr(r))
|
|
536
|
-
for (var a = 0; a < r.length; a++) {
|
|
537
|
-
var e = r[a];
|
|
538
|
-
hr(e) && Fr(e, n);
|
|
539
|
-
}
|
|
540
|
-
else if (hr(r))
|
|
541
|
-
r._store && (r._store.validated = !0);
|
|
542
|
-
else if (r) {
|
|
543
|
-
var s = ir(r);
|
|
544
|
-
if (typeof s == "function" && s !== r.entries)
|
|
545
|
-
for (var f = s.call(r), o; !(o = f.next()).done; )
|
|
546
|
-
hr(o.value) && Fr(o.value, n);
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
}
|
|
550
|
-
function pn(r) {
|
|
551
|
-
{
|
|
552
|
-
var n = r.type;
|
|
553
|
-
if (n == null || typeof n == "string")
|
|
554
|
-
return;
|
|
555
|
-
var a;
|
|
556
|
-
if (typeof n == "function")
|
|
557
|
-
a = n.propTypes;
|
|
558
|
-
else if (typeof n == "object" && (n.$$typeof === l || // Note: Memo only checks outer props here.
|
|
559
|
-
// Inner props are checked in the reconciler.
|
|
560
|
-
n.$$typeof === w))
|
|
561
|
-
a = n.propTypes;
|
|
562
|
-
else
|
|
563
|
-
return;
|
|
564
|
-
if (a) {
|
|
565
|
-
var e = g(n);
|
|
566
|
-
Zr(a, r.props, "prop", e, r);
|
|
567
|
-
} else if (n.PropTypes !== void 0 && !vr) {
|
|
568
|
-
vr = !0;
|
|
569
|
-
var s = g(n);
|
|
570
|
-
R("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", s || "Unknown");
|
|
571
|
-
}
|
|
572
|
-
typeof n.getDefaultProps == "function" && !n.getDefaultProps.isReactClassApproved && R("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
function gn(r) {
|
|
576
|
-
{
|
|
577
|
-
for (var n = Object.keys(r.props), a = 0; a < n.length; a++) {
|
|
578
|
-
var e = n[a];
|
|
579
|
-
if (e !== "children" && e !== "key") {
|
|
580
|
-
q(r), R("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", e), q(null);
|
|
581
|
-
break;
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
r.ref !== null && (q(r), R("Invalid attribute `ref` supplied to `React.Fragment`."), q(null));
|
|
585
|
-
}
|
|
586
|
-
}
|
|
587
|
-
var $r = {};
|
|
588
|
-
function Vr(r, n, a, e, s, f) {
|
|
589
|
-
{
|
|
590
|
-
var o = sr(r);
|
|
591
|
-
if (!o) {
|
|
592
|
-
var i = "";
|
|
593
|
-
(r === void 0 || typeof r == "object" && r !== null && Object.keys(r).length === 0) && (i += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
594
|
-
var C = fn(s);
|
|
595
|
-
C ? i += C : i += Dr();
|
|
596
|
-
var v;
|
|
597
|
-
r === null ? v = "null" : dr(r) ? v = "array" : r !== void 0 && r.$$typeof === u ? (v = "<" + (g(r.type) || "Unknown") + " />", i = " Did you accidentally export a JSX literal instead of a component?") : v = typeof r, R("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", v, i);
|
|
598
|
-
}
|
|
599
|
-
var h = cn(r, n, a, s, f);
|
|
600
|
-
if (h == null)
|
|
601
|
-
return h;
|
|
602
|
-
if (o) {
|
|
603
|
-
var P = n.children;
|
|
604
|
-
if (P !== void 0)
|
|
605
|
-
if (e)
|
|
606
|
-
if (dr(P)) {
|
|
607
|
-
for (var z = 0; z < P.length; z++)
|
|
608
|
-
Lr(P[z], r);
|
|
609
|
-
Object.freeze && Object.freeze(P);
|
|
610
|
-
} else
|
|
611
|
-
R("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
612
|
-
else
|
|
613
|
-
Lr(P, r);
|
|
614
|
-
}
|
|
615
|
-
if (M.call(n, "key")) {
|
|
616
|
-
var V = g(r), k = Object.keys(n).filter(function(xn) {
|
|
617
|
-
return xn !== "key";
|
|
618
|
-
}), br = k.length > 0 ? "{key: someKey, " + k.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
619
|
-
if (!$r[V + br]) {
|
|
620
|
-
var mn = k.length > 0 ? "{" + k.join(": ..., ") + ": ...}" : "{}";
|
|
621
|
-
R(`A props object containing a "key" prop is being spread into JSX:
|
|
622
|
-
let props = %s;
|
|
623
|
-
<%s {...props} />
|
|
624
|
-
React keys must be passed directly to JSX without using spread:
|
|
625
|
-
let props = %s;
|
|
626
|
-
<%s key={someKey} {...props} />`, br, V, mn, V), $r[V + br] = !0;
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
return r === x ? gn(h) : pn(h), h;
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
function vn(r, n, a) {
|
|
633
|
-
return Vr(r, n, a, !0);
|
|
634
|
-
}
|
|
635
|
-
function hn(r, n, a) {
|
|
636
|
-
return Vr(r, n, a, !1);
|
|
637
|
-
}
|
|
638
|
-
var bn = hn, yn = vn;
|
|
639
|
-
G.Fragment = x, G.jsx = bn, G.jsxs = yn;
|
|
640
|
-
}()), G;
|
|
641
|
-
}
|
|
642
|
-
process.env.NODE_ENV === "production" ? mr.exports = En() : mr.exports = wn();
|
|
643
|
-
var S = mr.exports;
|
|
644
|
-
const Rn = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap");
|
|
1
|
+
import { jsx as c, jsxs as N } from "react/jsx-runtime";
|
|
2
|
+
import B, { forwardRef as W, useState as w, useRef as A, useEffect as x } from "react";
|
|
3
|
+
const G = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap");
|
|
645
4
|
|
|
646
5
|
* {
|
|
647
6
|
margin: 0;
|
|
@@ -980,35 +339,35 @@ const Rn = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@3
|
|
|
980
339
|
color: var(--starasia-ui-input-placeholder-color);
|
|
981
340
|
font-weight: var(--starasia-ui-fontWeights-normal, 300);
|
|
982
341
|
}
|
|
983
|
-
`,
|
|
984
|
-
if (
|
|
342
|
+
`, P = (a) => {
|
|
343
|
+
if (a === "sm")
|
|
985
344
|
return 16;
|
|
986
|
-
if (
|
|
345
|
+
if (a === "md")
|
|
987
346
|
return 16;
|
|
988
|
-
if (
|
|
347
|
+
if (a === "lg")
|
|
989
348
|
return 20;
|
|
990
|
-
},
|
|
991
|
-
({ options:
|
|
992
|
-
const [
|
|
993
|
-
if (
|
|
994
|
-
const
|
|
995
|
-
|
|
349
|
+
}, T = (a) => a === "default" ? "#939E99" : a === "error" ? "#EF4444" : a === "warning" ? "#EAB308" : "#939E99", j = (a) => a === "default" ? "#939E99" : a === "error" ? "#EF4444" : a === "warning" ? "#EAB308" : "#939E99", J = W(
|
|
350
|
+
({ options: a, value: n, setValue: s, isComponentVisible: o, onOptionChange: e }, i) => {
|
|
351
|
+
const [k, V] = w([]), u = A(null), g = () => {
|
|
352
|
+
if (i != null && i.current && u.current) {
|
|
353
|
+
const h = window.innerHeight, f = i == null ? void 0 : i.current.getBoundingClientRect(), C = u.current.getBoundingClientRect(), m = f.bottom + C.height;
|
|
354
|
+
u.current.style.left = `${f.left}px`, u.current.style.width = `${f.width}px`, m >= h - 10 ? u.current.style.top = `${f.top - C.height - 5}px` : u.current.style.top = `${f.top + f.height}px`;
|
|
996
355
|
}
|
|
997
356
|
};
|
|
998
|
-
return
|
|
999
|
-
window.removeEventListener("scroll",
|
|
1000
|
-
}), [
|
|
1001
|
-
|
|
1002
|
-
}, [
|
|
1003
|
-
|
|
1004
|
-
(
|
|
1005
|
-
(
|
|
357
|
+
return x(() => (window.addEventListener("scroll", g), window.addEventListener("resize", g), () => {
|
|
358
|
+
window.removeEventListener("scroll", g), window.removeEventListener("resize", g);
|
|
359
|
+
}), [i, u]), x(() => {
|
|
360
|
+
g();
|
|
361
|
+
}, [o]), x(() => {
|
|
362
|
+
V(
|
|
363
|
+
(a == null ? void 0 : a.filter(
|
|
364
|
+
(h) => h.toLowerCase().startsWith(n.toLowerCase())
|
|
1006
365
|
)) || []
|
|
1007
366
|
);
|
|
1008
|
-
}, [
|
|
367
|
+
}, [n, a]), /* @__PURE__ */ c(
|
|
1009
368
|
"div",
|
|
1010
369
|
{
|
|
1011
|
-
ref:
|
|
370
|
+
ref: u,
|
|
1012
371
|
style: {
|
|
1013
372
|
position: "fixed",
|
|
1014
373
|
padding: "8px",
|
|
@@ -1019,15 +378,15 @@ const Rn = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@3
|
|
|
1019
378
|
overflow: "auto",
|
|
1020
379
|
zIndex: 5e4
|
|
1021
380
|
},
|
|
1022
|
-
children:
|
|
1023
|
-
(
|
|
381
|
+
children: k == null ? void 0 : k.map(
|
|
382
|
+
(h) => M(h, n, s, e)
|
|
1024
383
|
)
|
|
1025
384
|
}
|
|
1026
385
|
);
|
|
1027
386
|
}
|
|
1028
|
-
),
|
|
1029
|
-
const
|
|
1030
|
-
return /* @__PURE__ */
|
|
387
|
+
), M = (a, n, s, o) => {
|
|
388
|
+
const e = a.toLowerCase().indexOf(n.toLowerCase());
|
|
389
|
+
return /* @__PURE__ */ N(
|
|
1031
390
|
"p",
|
|
1032
391
|
{
|
|
1033
392
|
style: {
|
|
@@ -1038,177 +397,177 @@ const Rn = `@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@3
|
|
|
1038
397
|
cursor: "pointer"
|
|
1039
398
|
},
|
|
1040
399
|
onClick: () => {
|
|
1041
|
-
|
|
400
|
+
s(a), o && o(a);
|
|
1042
401
|
},
|
|
1043
402
|
children: [
|
|
1044
|
-
|
|
1045
|
-
/* @__PURE__ */
|
|
1046
|
-
|
|
403
|
+
a.slice(0, e),
|
|
404
|
+
/* @__PURE__ */ c("span", { style: { color: "#374151" }, children: a.slice(e, e + n.length) }),
|
|
405
|
+
a.slice(e + n.length)
|
|
1047
406
|
]
|
|
1048
407
|
}
|
|
1049
408
|
);
|
|
1050
409
|
};
|
|
1051
|
-
function
|
|
1052
|
-
const [
|
|
1053
|
-
|
|
410
|
+
function Q(a) {
|
|
411
|
+
const [n, s] = w(a), o = A(null), e = (i) => {
|
|
412
|
+
o.current && !o.current.contains(i.target) && s(!1);
|
|
1054
413
|
};
|
|
1055
|
-
return
|
|
1056
|
-
document.removeEventListener("click",
|
|
1057
|
-
}), []), { ref:
|
|
1058
|
-
}
|
|
1059
|
-
const
|
|
1060
|
-
if (!document.getElementById(
|
|
1061
|
-
const
|
|
1062
|
-
|
|
414
|
+
return x(() => (document.addEventListener("click", e, !0), () => {
|
|
415
|
+
document.removeEventListener("click", e, !0);
|
|
416
|
+
}), []), { ref: o, isComponentVisible: n, setIsComponentVisible: s };
|
|
417
|
+
}
|
|
418
|
+
const D = "starasia-input-styles", X = (a) => {
|
|
419
|
+
if (!document.getElementById(D)) {
|
|
420
|
+
const n = document.createElement("style");
|
|
421
|
+
n.id = D, n.textContent = a, document.head.appendChild(n);
|
|
1063
422
|
}
|
|
1064
423
|
};
|
|
1065
|
-
|
|
1066
|
-
function
|
|
1067
|
-
return Number(
|
|
1068
|
-
}
|
|
1069
|
-
const
|
|
1070
|
-
let
|
|
1071
|
-
return
|
|
1072
|
-
},
|
|
1073
|
-
(
|
|
424
|
+
X(G);
|
|
425
|
+
function Z(a) {
|
|
426
|
+
return Number(a.replace(/\./g, ""));
|
|
427
|
+
}
|
|
428
|
+
const z = (a) => {
|
|
429
|
+
let n = a.replace(/[^\d]/g, "");
|
|
430
|
+
return n = n.replace(/^0+(?=\d)/, ""), n.replace(/\B(?=(\d{3})+(?!\d))/g, ".");
|
|
431
|
+
}, ra = W(
|
|
432
|
+
(a, n) => {
|
|
1074
433
|
const {
|
|
1075
|
-
leftIcon:
|
|
1076
|
-
rightIcon:
|
|
1077
|
-
size:
|
|
1078
|
-
status:
|
|
1079
|
-
inputUse:
|
|
1080
|
-
variant:
|
|
1081
|
-
leftAddons:
|
|
1082
|
-
rightAddons:
|
|
1083
|
-
onClickLeftIcon:
|
|
1084
|
-
onClickRightIcon:
|
|
1085
|
-
highlightPlaceholder:
|
|
1086
|
-
currency:
|
|
1087
|
-
fullWidth:
|
|
1088
|
-
options:
|
|
1089
|
-
onOptionChange:
|
|
1090
|
-
...
|
|
1091
|
-
} =
|
|
434
|
+
leftIcon: s,
|
|
435
|
+
rightIcon: o,
|
|
436
|
+
size: e = "md",
|
|
437
|
+
status: i = "default",
|
|
438
|
+
inputUse: k = "icon",
|
|
439
|
+
variant: V = "outline",
|
|
440
|
+
leftAddons: u,
|
|
441
|
+
rightAddons: g,
|
|
442
|
+
onClickLeftIcon: h,
|
|
443
|
+
onClickRightIcon: f,
|
|
444
|
+
highlightPlaceholder: C,
|
|
445
|
+
currency: m,
|
|
446
|
+
fullWidth: O = !1,
|
|
447
|
+
options: E,
|
|
448
|
+
onOptionChange: K,
|
|
449
|
+
...r
|
|
450
|
+
} = a;
|
|
1092
451
|
{
|
|
1093
|
-
const [
|
|
1094
|
-
isComponentVisible:
|
|
1095
|
-
ref:
|
|
1096
|
-
setIsComponentVisible:
|
|
1097
|
-
} =
|
|
1098
|
-
|
|
452
|
+
const [F, L] = w(!0), [b, S] = w(""), [H, R] = w(""), {
|
|
453
|
+
isComponentVisible: q,
|
|
454
|
+
ref: $,
|
|
455
|
+
setIsComponentVisible: U
|
|
456
|
+
} = Q(!1), Y = () => {
|
|
457
|
+
U((t) => !t);
|
|
1099
458
|
};
|
|
1100
|
-
return
|
|
1101
|
-
typeof
|
|
1102
|
-
}, [
|
|
1103
|
-
|
|
1104
|
-
}, [
|
|
459
|
+
return x(() => {
|
|
460
|
+
typeof r.value == "string" && r.value.length || r.defaultValue || typeof r.value == "number" ? L(!1) : L(!0);
|
|
461
|
+
}, [r.value, r.defaultValue]), x(() => {
|
|
462
|
+
S(m ? z(String(r.value)) : r.value || "");
|
|
463
|
+
}, [r]), /* @__PURE__ */ N(
|
|
1105
464
|
"div",
|
|
1106
465
|
{
|
|
1107
|
-
className: `starasia-input-container starasia-input-${
|
|
466
|
+
className: `starasia-input-container starasia-input-${V} starasia-input-container-${i} ${e} `,
|
|
1108
467
|
style: {
|
|
1109
|
-
width:
|
|
468
|
+
width: O ? "auto" : "max-content",
|
|
1110
469
|
position: "relative"
|
|
1111
470
|
},
|
|
1112
|
-
ref:
|
|
1113
|
-
onClick:
|
|
471
|
+
ref: $,
|
|
472
|
+
onClick: Y,
|
|
1114
473
|
children: [
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
width:
|
|
1118
|
-
color:
|
|
1119
|
-
onClick:
|
|
474
|
+
u ? /* @__PURE__ */ c("div", { className: "starasia-input-container-addons-left", children: u }) : null,
|
|
475
|
+
s ? /* @__PURE__ */ c("div", { className: "starasia-input-container-icon-left", children: B.cloneElement(s, {
|
|
476
|
+
width: P(e),
|
|
477
|
+
color: T(r.disabled ? "disable" : i),
|
|
478
|
+
onClick: h,
|
|
1120
479
|
style: {
|
|
1121
|
-
color: `${
|
|
1122
|
-
|
|
480
|
+
color: `${T(
|
|
481
|
+
r.disabled ? "disable" : i
|
|
1123
482
|
)}`
|
|
1124
483
|
}
|
|
1125
484
|
}) }) : null,
|
|
1126
|
-
/* @__PURE__ */
|
|
1127
|
-
/* @__PURE__ */
|
|
485
|
+
/* @__PURE__ */ N("div", { className: "starasia-input-preview-container", children: [
|
|
486
|
+
/* @__PURE__ */ c(
|
|
1128
487
|
"input",
|
|
1129
488
|
{
|
|
1130
489
|
className: "starasia-input",
|
|
1131
|
-
...
|
|
490
|
+
...r,
|
|
1132
491
|
placeholder: "",
|
|
1133
|
-
disabled:
|
|
1134
|
-
ref:
|
|
1135
|
-
onChange: (
|
|
1136
|
-
let
|
|
1137
|
-
const
|
|
1138
|
-
if (
|
|
1139
|
-
if (
|
|
1140
|
-
if (typeof
|
|
1141
|
-
let
|
|
1142
|
-
|
|
1143
|
-
|
|
492
|
+
disabled: i === "disable" ? !0 : r.disabled,
|
|
493
|
+
ref: n,
|
|
494
|
+
onChange: (t) => {
|
|
495
|
+
let d = m ? z(t.target.value) : t.target.value;
|
|
496
|
+
const l = t.target.selectionStart;
|
|
497
|
+
if (m)
|
|
498
|
+
if (H === "Backspace")
|
|
499
|
+
if (typeof l == "number" && b[l] === ".") {
|
|
500
|
+
let v = d.slice(0, l - 1), y = d.slice(
|
|
501
|
+
l,
|
|
502
|
+
d.length
|
|
1144
503
|
);
|
|
1145
|
-
|
|
1146
|
-
const
|
|
504
|
+
d = z(v + y);
|
|
505
|
+
const p = b.length - 1, I = d.length - 1;
|
|
1147
506
|
setTimeout(
|
|
1148
|
-
() =>
|
|
1149
|
-
|
|
1150
|
-
|
|
507
|
+
() => t.target.setSelectionRange(
|
|
508
|
+
l - (p - I) < 0 ? 0 : l - (p - I),
|
|
509
|
+
l - (p - I) < 0 ? 0 : l - (p - I)
|
|
1151
510
|
),
|
|
1152
511
|
0
|
|
1153
512
|
);
|
|
1154
513
|
} else {
|
|
1155
|
-
const
|
|
1156
|
-
let
|
|
514
|
+
const v = b.length - 1, y = d.length - 1;
|
|
515
|
+
let p = l + 1 - (v - y);
|
|
1157
516
|
setTimeout(
|
|
1158
|
-
() =>
|
|
1159
|
-
|
|
1160
|
-
|
|
517
|
+
() => t.target.setSelectionRange(
|
|
518
|
+
p < 0 ? 0 : p,
|
|
519
|
+
p < 0 ? 0 : p
|
|
1161
520
|
),
|
|
1162
521
|
0
|
|
1163
522
|
);
|
|
1164
523
|
}
|
|
1165
524
|
else {
|
|
1166
|
-
const
|
|
525
|
+
const v = b.length - 1, y = d.length - 1;
|
|
1167
526
|
setTimeout(
|
|
1168
|
-
() =>
|
|
1169
|
-
|
|
1170
|
-
|
|
527
|
+
() => t.target.setSelectionRange(
|
|
528
|
+
l + (y - v) - 1,
|
|
529
|
+
l + (y - v) - 1
|
|
1171
530
|
),
|
|
1172
531
|
0
|
|
1173
532
|
);
|
|
1174
533
|
}
|
|
1175
|
-
|
|
1176
|
-
...
|
|
534
|
+
S(d), t.target.value ? L(!1) : L(!0), r.onChange && r.onChange({
|
|
535
|
+
...t,
|
|
1177
536
|
target: {
|
|
1178
|
-
...
|
|
1179
|
-
value:
|
|
1180
|
-
name:
|
|
537
|
+
...t.target,
|
|
538
|
+
value: m ? String(Z(d)) : d,
|
|
539
|
+
name: t.target.name
|
|
1181
540
|
}
|
|
1182
|
-
}),
|
|
541
|
+
}), R("");
|
|
1183
542
|
},
|
|
1184
|
-
value:
|
|
1185
|
-
onKeyDown: (
|
|
1186
|
-
|
|
543
|
+
value: b,
|
|
544
|
+
onKeyDown: (t) => {
|
|
545
|
+
t.key === "Backspace" && R(t.key), r.onKeyDown && r.onKeyDown(t);
|
|
1187
546
|
}
|
|
1188
547
|
}
|
|
1189
548
|
),
|
|
1190
|
-
|
|
549
|
+
F ? _(r.placeholder, C) : null
|
|
1191
550
|
] }),
|
|
1192
|
-
|
|
1193
|
-
width:
|
|
1194
|
-
color:
|
|
1195
|
-
onClick:
|
|
551
|
+
o ? /* @__PURE__ */ c("div", { className: "starasia-input-container-icon-right", children: B.cloneElement(o, {
|
|
552
|
+
width: P(e),
|
|
553
|
+
color: j(r.disabled ? "disable" : i),
|
|
554
|
+
onClick: f,
|
|
1196
555
|
style: {
|
|
1197
|
-
color: `${
|
|
1198
|
-
|
|
556
|
+
color: `${j(
|
|
557
|
+
r.disabled ? "disable" : i
|
|
1199
558
|
)}`
|
|
1200
559
|
}
|
|
1201
560
|
}) }) : null,
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
561
|
+
g ? /* @__PURE__ */ c("div", { className: "starasia-input-container-addons-right", children: g }) : null,
|
|
562
|
+
b && q && (E != null && E.length) ? /* @__PURE__ */ c(
|
|
563
|
+
J,
|
|
1205
564
|
{
|
|
1206
|
-
options:
|
|
1207
|
-
value:
|
|
1208
|
-
setValue:
|
|
1209
|
-
ref:
|
|
1210
|
-
isComponentVisible:
|
|
1211
|
-
onOptionChange:
|
|
565
|
+
options: E,
|
|
566
|
+
value: b,
|
|
567
|
+
setValue: S,
|
|
568
|
+
ref: $,
|
|
569
|
+
isComponentVisible: q,
|
|
570
|
+
onOptionChange: K
|
|
1212
571
|
}
|
|
1213
572
|
) : null
|
|
1214
573
|
]
|
|
@@ -1216,16 +575,16 @@ const yr = (t) => {
|
|
|
1216
575
|
);
|
|
1217
576
|
}
|
|
1218
577
|
}
|
|
1219
|
-
),
|
|
1220
|
-
if (!
|
|
1221
|
-
return /* @__PURE__ */
|
|
1222
|
-
const
|
|
1223
|
-
return
|
|
1224
|
-
|
|
1225
|
-
/* @__PURE__ */
|
|
1226
|
-
|
|
578
|
+
), _ = (a, n) => {
|
|
579
|
+
if (!a || !n)
|
|
580
|
+
return /* @__PURE__ */ c("p", { className: "starasia-input-placeholder", children: a || "" });
|
|
581
|
+
const s = a.toLowerCase().indexOf(n.toLowerCase());
|
|
582
|
+
return s === -1 ? /* @__PURE__ */ c("p", { className: "starasia-input-placeholder", children: a }) : /* @__PURE__ */ N("p", { className: "starasia-input-placeholder", children: [
|
|
583
|
+
a.slice(0, s),
|
|
584
|
+
/* @__PURE__ */ c("span", { className: "starasia-input-placeholder-highlighted", children: a.slice(s, s + n.length) }),
|
|
585
|
+
a.slice(s + n.length)
|
|
1227
586
|
] });
|
|
1228
587
|
};
|
|
1229
588
|
export {
|
|
1230
|
-
|
|
589
|
+
ra as Input
|
|
1231
590
|
};
|
package/dist/input.umd.js
CHANGED
|
@@ -1,35 +1,4 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
* @license React
|
|
3
|
-
* react-jsx-runtime.production.min.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var mr;function Mr(){if(mr)return J;mr=1;var t=d,u=Symbol.for("react.element"),y=Symbol.for("react.fragment"),E=Object.prototype.hasOwnProperty,w=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};function F(D,l,S){var g,R={},j=null,A=null;S!==void 0&&(j=""+S),l.key!==void 0&&(j=""+l.key),l.ref!==void 0&&(A=l.ref);for(g in l)E.call(l,g)&&!p.hasOwnProperty(g)&&(R[g]=l[g]);if(D&&D.defaultProps)for(g in l=D.defaultProps,l)R[g]===void 0&&(R[g]=l[g]);return{$$typeof:u,type:D,key:j,ref:A,props:R,_owner:w.current}}return J.Fragment=y,J.jsx=F,J.jsxs=F,J}var G={};/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react-jsx-runtime.development.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var xr;function Kr(){return xr||(xr=1,process.env.NODE_ENV!=="production"&&function(){var t=d,u=Symbol.for("react.element"),y=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),p=Symbol.for("react.profiler"),F=Symbol.for("react.provider"),D=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),S=Symbol.for("react.suspense"),g=Symbol.for("react.suspense_list"),R=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),A=Symbol.for("react.offscreen"),Z=Symbol.iterator,z="@@iterator";function or(r){if(r===null||typeof r!="object")return null;var n=Z&&r[Z]||r[z];return typeof n=="function"?n:null}var c=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function _(r){{for(var n=arguments.length,a=new Array(n>1?n-1:0),e=1;e<n;e++)a[e-1]=arguments[e];U("error",r,a)}}function U(r,n,a){{var e=c.ReactDebugCurrentFrame,s=e.getStackAddendum();s!==""&&(n+="%s",a=a.concat([s]));var f=a.map(function(o){return String(o)});f.unshift("Warning: "+n),Function.prototype.apply.call(console[r],console,f)}}var L=!1,B=!1,sr=!1,Q=!1,$=!1,H;H=Symbol.for("react.module.reference");function ur(r){return!!(typeof r=="string"||typeof r=="function"||r===E||r===p||$||r===w||r===S||r===g||Q||r===A||L||B||sr||typeof r=="object"&&r!==null&&(r.$$typeof===j||r.$$typeof===R||r.$$typeof===F||r.$$typeof===D||r.$$typeof===l||r.$$typeof===H||r.getModuleId!==void 0))}function lr(r,n,a){var e=r.displayName;if(e)return e;var s=n.displayName||n.name||"";return s!==""?a+"("+s+")":a}function m(r){return r.displayName||"Context"}function v(r){if(r==null)return null;if(typeof r.tag=="number"&&_("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case E:return"Fragment";case y:return"Portal";case p:return"Profiler";case w:return"StrictMode";case S:return"Suspense";case g:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case D:var n=r;return m(n)+".Consumer";case F:var a=r;return m(a._context)+".Provider";case l:return lr(r,r.render,"ForwardRef");case R:var e=r.displayName||null;return e!==null?e:v(r.type)||"Memo";case j:{var s=r,f=s._payload,o=s._init;try{return v(o(f))}catch{return null}}}return null}var x=Object.assign,O=0,V,P,W,Cr,Sr,Tr,kr;function jr(){}jr.__reactDisabledLog=!0;function $r(){{if(O===0){V=console.log,P=console.info,W=console.warn,Cr=console.error,Sr=console.group,Tr=console.groupCollapsed,kr=console.groupEnd;var r={configurable:!0,enumerable:!0,value:jr,writable:!0};Object.defineProperties(console,{info:r,log:r,warn:r,error:r,group:r,groupCollapsed:r,groupEnd:r})}O++}}function rn(){{if(O--,O===0){var r={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:x({},r,{value:V}),info:x({},r,{value:P}),warn:x({},r,{value:W}),error:x({},r,{value:Cr}),group:x({},r,{value:Sr}),groupCollapsed:x({},r,{value:Tr}),groupEnd:x({},r,{value:kr})})}O<0&&_("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var cr=c.ReactCurrentDispatcher,fr;function rr(r,n,a){{if(fr===void 0)try{throw Error()}catch(s){var e=s.stack.trim().match(/\n( *(at )?)/);fr=e&&e[1]||""}return`
|
|
18
|
-
`+fr+r}}var dr=!1,nr;{var nn=typeof WeakMap=="function"?WeakMap:Map;nr=new nn}function Or(r,n){if(!r||dr)return"";{var a=nr.get(r);if(a!==void 0)return a}var e;dr=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var f;f=cr.current,cr.current=null,$r();try{if(n){var o=function(){throw Error()};if(Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(o,[])}catch(k){e=k}Reflect.construct(r,[],o)}else{try{o.call()}catch(k){e=k}r.call(o.prototype)}}else{try{throw Error()}catch(k){e=k}r()}}catch(k){if(k&&e&&typeof k.stack=="string"){for(var i=k.stack.split(`
|
|
19
|
-
`),T=e.stack.split(`
|
|
20
|
-
`),h=i.length-1,b=T.length-1;h>=1&&b>=0&&i[h]!==T[b];)b--;for(;h>=1&&b>=0;h--,b--)if(i[h]!==T[b]){if(h!==1||b!==1)do if(h--,b--,b<0||i[h]!==T[b]){var I=`
|
|
21
|
-
`+i[h].replace(" at new "," at ");return r.displayName&&I.includes("<anonymous>")&&(I=I.replace("<anonymous>",r.displayName)),typeof r=="function"&&nr.set(r,I),I}while(h>=1&&b>=0);break}}}finally{dr=!1,cr.current=f,rn(),Error.prepareStackTrace=s}var K=r?r.displayName||r.name:"",Y=K?rr(K):"";return typeof r=="function"&&nr.set(r,Y),Y}function an(r,n,a){return Or(r,!1)}function en(r){var n=r.prototype;return!!(n&&n.isReactComponent)}function ar(r,n,a){if(r==null)return"";if(typeof r=="function")return Or(r,en(r));if(typeof r=="string")return rr(r);switch(r){case S:return rr("Suspense");case g:return rr("SuspenseList")}if(typeof r=="object")switch(r.$$typeof){case l:return an(r.render);case R:return ar(r.type,n,a);case j:{var e=r,s=e._payload,f=e._init;try{return ar(f(s),n,a)}catch{}}}return""}var X=Object.prototype.hasOwnProperty,Pr={},Ir=c.ReactDebugCurrentFrame;function er(r){if(r){var n=r._owner,a=ar(r.type,r._source,n?n.type:null);Ir.setExtraStackFrame(a)}else Ir.setExtraStackFrame(null)}function tn(r,n,a,e,s){{var f=Function.call.bind(X);for(var o in r)if(f(r,o)){var i=void 0;try{if(typeof r[o]!="function"){var T=Error((e||"React class")+": "+a+" type `"+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof r[o]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw T.name="Invariant Violation",T}i=r[o](n,o,e,a,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(h){i=h}i&&!(i instanceof Error)&&(er(s),_("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",e||"React class",a,o,typeof i),er(null)),i instanceof Error&&!(i.message in Pr)&&(Pr[i.message]=!0,er(s),_("Failed %s type: %s",a,i.message),er(null))}}}var on=Array.isArray;function pr(r){return on(r)}function sn(r){{var n=typeof Symbol=="function"&&Symbol.toStringTag,a=n&&r[Symbol.toStringTag]||r.constructor.name||"Object";return a}}function un(r){try{return Dr(r),!1}catch{return!0}}function Dr(r){return""+r}function Ar(r){if(un(r))return _("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",sn(r)),Dr(r)}var q=c.ReactCurrentOwner,ln={key:!0,ref:!0,__self:!0,__source:!0},Fr,Lr,gr;gr={};function cn(r){if(X.call(r,"ref")){var n=Object.getOwnPropertyDescriptor(r,"ref").get;if(n&&n.isReactWarning)return!1}return r.ref!==void 0}function fn(r){if(X.call(r,"key")){var n=Object.getOwnPropertyDescriptor(r,"key").get;if(n&&n.isReactWarning)return!1}return r.key!==void 0}function dn(r,n){if(typeof r.ref=="string"&&q.current&&n&&q.current.stateNode!==n){var a=v(q.current.type);gr[a]||(_('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',v(q.current.type),r.ref),gr[a]=!0)}}function pn(r,n){{var a=function(){Fr||(Fr=!0,_("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",n))};a.isReactWarning=!0,Object.defineProperty(r,"key",{get:a,configurable:!0})}}function gn(r,n){{var a=function(){Lr||(Lr=!0,_("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",n))};a.isReactWarning=!0,Object.defineProperty(r,"ref",{get:a,configurable:!0})}}var vn=function(r,n,a,e,s,f,o){var i={$$typeof:u,type:r,key:n,ref:a,props:o,_owner:f};return i._store={},Object.defineProperty(i._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(i,"_self",{configurable:!1,enumerable:!1,writable:!1,value:e}),Object.defineProperty(i,"_source",{configurable:!1,enumerable:!1,writable:!1,value:s}),Object.freeze&&(Object.freeze(i.props),Object.freeze(i)),i};function hn(r,n,a,e,s){{var f,o={},i=null,T=null;a!==void 0&&(Ar(a),i=""+a),fn(n)&&(Ar(n.key),i=""+n.key),cn(n)&&(T=n.ref,dn(n,s));for(f in n)X.call(n,f)&&!ln.hasOwnProperty(f)&&(o[f]=n[f]);if(r&&r.defaultProps){var h=r.defaultProps;for(f in h)o[f]===void 0&&(o[f]=h[f])}if(i||T){var b=typeof r=="function"?r.displayName||r.name||"Unknown":r;i&&pn(o,b),T&&gn(o,b)}return vn(r,i,T,s,e,q.current,o)}}var vr=c.ReactCurrentOwner,Vr=c.ReactDebugCurrentFrame;function M(r){if(r){var n=r._owner,a=ar(r.type,r._source,n?n.type:null);Vr.setExtraStackFrame(a)}else Vr.setExtraStackFrame(null)}var hr;hr=!1;function br(r){return typeof r=="object"&&r!==null&&r.$$typeof===u}function Nr(){{if(vr.current){var r=v(vr.current.type);if(r)return`
|
|
22
|
-
|
|
23
|
-
Check the render method of \``+r+"`."}return""}}function bn(r){{if(r!==void 0){var n=r.fileName.replace(/^.*[\\\/]/,""),a=r.lineNumber;return`
|
|
24
|
-
|
|
25
|
-
Check your code at `+n+":"+a+"."}return""}}var Wr={};function yn(r){{var n=Nr();if(!n){var a=typeof r=="string"?r:r.displayName||r.name;a&&(n=`
|
|
26
|
-
|
|
27
|
-
Check the top-level render call using <`+a+">.")}return n}}function Yr(r,n){{if(!r._store||r._store.validated||r.key!=null)return;r._store.validated=!0;var a=yn(n);if(Wr[a])return;Wr[a]=!0;var e="";r&&r._owner&&r._owner!==vr.current&&(e=" It was passed a child from "+v(r._owner.type)+"."),M(r),_('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',a,e),M(null)}}function zr(r,n){{if(typeof r!="object")return;if(pr(r))for(var a=0;a<r.length;a++){var e=r[a];br(e)&&Yr(e,n)}else if(br(r))r._store&&(r._store.validated=!0);else if(r){var s=or(r);if(typeof s=="function"&&s!==r.entries)for(var f=s.call(r),o;!(o=f.next()).done;)br(o.value)&&Yr(o.value,n)}}}function mn(r){{var n=r.type;if(n==null||typeof n=="string")return;var a;if(typeof n=="function")a=n.propTypes;else if(typeof n=="object"&&(n.$$typeof===l||n.$$typeof===R))a=n.propTypes;else return;if(a){var e=v(n);tn(a,r.props,"prop",e,r)}else if(n.PropTypes!==void 0&&!hr){hr=!0;var s=v(n);_("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",s||"Unknown")}typeof n.getDefaultProps=="function"&&!n.getDefaultProps.isReactClassApproved&&_("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function xn(r){{for(var n=Object.keys(r.props),a=0;a<n.length;a++){var e=n[a];if(e!=="children"&&e!=="key"){M(r),_("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",e),M(null);break}}r.ref!==null&&(M(r),_("Invalid attribute `ref` supplied to `React.Fragment`."),M(null))}}var Ur={};function Br(r,n,a,e,s,f){{var o=ur(r);if(!o){var i="";(r===void 0||typeof r=="object"&&r!==null&&Object.keys(r).length===0)&&(i+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var T=bn(s);T?i+=T:i+=Nr();var h;r===null?h="null":pr(r)?h="array":r!==void 0&&r.$$typeof===u?(h="<"+(v(r.type)||"Unknown")+" />",i=" Did you accidentally export a JSX literal instead of a component?"):h=typeof r,_("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",h,i)}var b=hn(r,n,a,s,f);if(b==null)return b;if(o){var I=n.children;if(I!==void 0)if(e)if(pr(I)){for(var K=0;K<I.length;K++)zr(I[K],r);Object.freeze&&Object.freeze(I)}else _("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else zr(I,r)}if(X.call(n,"key")){var Y=v(r),k=Object.keys(n).filter(function(Sn){return Sn!=="key"}),yr=k.length>0?"{key: someKey, "+k.join(": ..., ")+": ...}":"{key: someKey}";if(!Ur[Y+yr]){var Cn=k.length>0?"{"+k.join(": ..., ")+": ...}":"{}";_(`A props object containing a "key" prop is being spread into JSX:
|
|
28
|
-
let props = %s;
|
|
29
|
-
<%s {...props} />
|
|
30
|
-
React keys must be passed directly to JSX without using spread:
|
|
31
|
-
let props = %s;
|
|
32
|
-
<%s key={someKey} {...props} />`,yr,Y,Cn,Y),Ur[Y+yr]=!0}}return r===E?xn(b):mn(b),b}}function En(r,n,a){return Br(r,n,a,!0)}function wn(r,n,a){return Br(r,n,a,!1)}var Rn=wn,_n=En;G.Fragment=E,G.jsx=Rn,G.jsxs=_n}()),G}process.env.NODE_ENV==="production"?tr.exports=Mr():tr.exports=Kr();var C=tr.exports;const Jr=`@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap");
|
|
1
|
+
(function(f,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],i):(f=typeof globalThis<"u"?globalThis:f||self,i(f.Input={},f.jsxRuntime,f.React))})(this,function(f,i,t){"use strict";const D=`@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap");
|
|
33
2
|
|
|
34
3
|
* {
|
|
35
4
|
margin: 0;
|
|
@@ -368,4 +337,4 @@ React keys must be passed directly to JSX without using spread:
|
|
|
368
337
|
color: var(--starasia-ui-input-placeholder-color);
|
|
369
338
|
font-weight: var(--starasia-ui-fontWeights-normal, 300);
|
|
370
339
|
}
|
|
371
|
-
`,
|
|
340
|
+
`,q=n=>{if(n==="sm")return 16;if(n==="md")return 16;if(n==="lg")return 20},z=n=>n==="default"?"#939E99":n==="error"?"#EF4444":n==="warning"?"#EAB308":"#939E99",j=n=>n==="default"?"#939E99":n==="error"?"#EF4444":n==="warning"?"#EAB308":"#939E99",O=t.forwardRef(({options:n,value:a,setValue:o,isComponentVisible:l,onOptionChange:u},e)=>{const[k,V]=t.useState([]),c=t.useRef(null),h=()=>{if(e!=null&&e.current&&c.current){const v=window.innerHeight,b=e==null?void 0:e.current.getBoundingClientRect(),C=c.current.getBoundingClientRect(),m=b.bottom+C.height;c.current.style.left=`${b.left}px`,c.current.style.width=`${b.width}px`,m>=v-10?c.current.style.top=`${b.top-C.height-5}px`:c.current.style.top=`${b.top+b.height}px`}};return t.useEffect(()=>(window.addEventListener("scroll",h),window.addEventListener("resize",h),()=>{window.removeEventListener("scroll",h),window.removeEventListener("resize",h)}),[e,c]),t.useEffect(()=>{h()},[l]),t.useEffect(()=>{V((n==null?void 0:n.filter(v=>v.toLowerCase().startsWith(a.toLowerCase())))||[])},[a,n]),i.jsx("div",{ref:c,style:{position:"fixed",padding:"8px",boxSizing:"border-box",boxShadow:"0px 8px 12px 0px rgba(0, 0, 0, 0.08)",borderRadius:"8px",background:"white",overflow:"auto",zIndex:5e4},children:k==null?void 0:k.map(v=>W(v,a,o,u))})}),W=(n,a,o,l)=>{const u=n.toLowerCase().indexOf(a.toLowerCase());return i.jsxs("p",{style:{fontFamily:"Poppins",color:"#c9cecc",fontWeight:500,padding:"8px 14px",cursor:"pointer"},onClick:()=>{o(n),l&&l(n)},children:[n.slice(0,u),i.jsx("span",{style:{color:"#374151"},children:n.slice(u,u+a.length)}),n.slice(u+a.length)]})};function A(n){const[a,o]=t.useState(n),l=t.useRef(null),u=e=>{l.current&&!l.current.contains(e.target)&&o(!1)};return t.useEffect(()=>(document.addEventListener("click",u,!0),()=>{document.removeEventListener("click",u,!0)}),[]),{ref:l,isComponentVisible:a,setIsComponentVisible:o}}const T="starasia-input-styles";(n=>{if(!document.getElementById(T)){const a=document.createElement("style");a.id=T,a.textContent=n,document.head.appendChild(a)}})(D);function K(n){return Number(n.replace(/\./g,""))}const N=n=>{let a=n.replace(/[^\d]/g,"");return a=a.replace(/^0+(?=\d)/,""),a.replace(/\B(?=(\d{3})+(?!\d))/g,".")},F=t.forwardRef((n,a)=>{const{leftIcon:o,rightIcon:l,size:u="md",status:e="default",inputUse:k="icon",variant:V="outline",leftAddons:c,rightAddons:h,onClickLeftIcon:v,onClickRightIcon:b,highlightPlaceholder:C,currency:m,fullWidth:U=!1,options:S,onOptionChange:M,...r}=n;{const[Y,E]=t.useState(!0),[y,I]=t.useState(""),[G,$]=t.useState(""),{isComponentVisible:B,ref:P,setIsComponentVisible:J}=A(!1),Q=()=>{J(s=>!s)};return t.useEffect(()=>{typeof r.value=="string"&&r.value.length||r.defaultValue||typeof r.value=="number"?E(!1):E(!0)},[r.value,r.defaultValue]),t.useEffect(()=>{I(m?N(String(r.value)):r.value||"")},[r]),i.jsxs("div",{className:`starasia-input-container starasia-input-${V} starasia-input-container-${e} ${u} `,style:{width:U?"auto":"max-content",position:"relative"},ref:P,onClick:Q,children:[c?i.jsx("div",{className:"starasia-input-container-addons-left",children:c}):null,o?i.jsx("div",{className:"starasia-input-container-icon-left",children:t.cloneElement(o,{width:q(u),color:z(r.disabled?"disable":e),onClick:v,style:{color:`${z(r.disabled?"disable":e)}`}})}):null,i.jsxs("div",{className:"starasia-input-preview-container",children:[i.jsx("input",{className:"starasia-input",...r,placeholder:"",disabled:e==="disable"?!0:r.disabled,ref:a,onChange:s=>{let p=m?N(s.target.value):s.target.value;const d=s.target.selectionStart;if(m)if(G==="Backspace")if(typeof d=="number"&&y[d]==="."){let x=p.slice(0,d-1),w=p.slice(d,p.length);p=N(x+w);const g=y.length-1,L=p.length-1;setTimeout(()=>s.target.setSelectionRange(d-(g-L)<0?0:d-(g-L),d-(g-L)<0?0:d-(g-L)),0)}else{const x=y.length-1,w=p.length-1;let g=d+1-(x-w);setTimeout(()=>s.target.setSelectionRange(g<0?0:g,g<0?0:g),0)}else{const x=y.length-1,w=p.length-1;setTimeout(()=>s.target.setSelectionRange(d+(w-x)-1,d+(w-x)-1),0)}I(p),s.target.value?E(!1):E(!0),r.onChange&&r.onChange({...s,target:{...s.target,value:m?String(K(p)):p,name:s.target.name}}),$("")},value:y,onKeyDown:s=>{s.key==="Backspace"&&$(s.key),r.onKeyDown&&r.onKeyDown(s)}}),Y?H(r.placeholder,C):null]}),l?i.jsx("div",{className:"starasia-input-container-icon-right",children:t.cloneElement(l,{width:q(u),color:j(r.disabled?"disable":e),onClick:b,style:{color:`${j(r.disabled?"disable":e)}`}})}):null,h?i.jsx("div",{className:"starasia-input-container-addons-right",children:h}):null,y&&B&&(S!=null&&S.length)?i.jsx(O,{options:S,value:y,setValue:I,ref:P,isComponentVisible:B,onOptionChange:M}):null]})}}),H=(n,a)=>{if(!n||!a)return i.jsx("p",{className:"starasia-input-placeholder",children:n||""});const o=n.toLowerCase().indexOf(a.toLowerCase());return o===-1?i.jsx("p",{className:"starasia-input-placeholder",children:n}):i.jsxs("p",{className:"starasia-input-placeholder",children:[n.slice(0,o),i.jsx("span",{className:"starasia-input-placeholder-highlighted",children:n.slice(o,o+a.length)}),n.slice(o+a.length)]})};f.Input=F,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@starasia/input",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "input component for starasia UI",
|
|
5
5
|
"author": "Prawito Hudoro",
|
|
6
6
|
"main": "dist/input.umd.js",
|
|
@@ -12,10 +12,6 @@
|
|
|
12
12
|
"dist/*.map",
|
|
13
13
|
"dist/*.css"
|
|
14
14
|
],
|
|
15
|
-
"scripts": {
|
|
16
|
-
"dev": "vite --config vite.config.ts --port 3000",
|
|
17
|
-
"build": "vite build --config vite.config.ts"
|
|
18
|
-
},
|
|
19
15
|
"keywords": [],
|
|
20
16
|
"license": "ISC",
|
|
21
17
|
"type": "module",
|
|
@@ -37,5 +33,9 @@
|
|
|
37
33
|
"react-dom": "^18.2.0",
|
|
38
34
|
"@types/react": "^18.2.55",
|
|
39
35
|
"@types/react-dom": "^18.2.19"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"dev": "vite --config vite.config.ts --port 3000",
|
|
39
|
+
"build": "vite build --config vite.config.ts"
|
|
40
40
|
}
|
|
41
|
-
}
|
|
41
|
+
}
|