secure-keypad 1.0.2 → 1.0.4

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 CHANGED
@@ -1,676 +1,66 @@
1
- import Ye, { useRef as fe, useState as H, useMemo as pr, useEffect as Me, useCallback as yr } from "react";
2
- var X = { exports: {} }, U = {};
3
- var $e;
4
- function mr() {
5
- if ($e) return U;
6
- $e = 1;
7
- var d = Ye, u = /* @__PURE__ */ Symbol.for("react.element"), y = /* @__PURE__ */ Symbol.for("react.fragment"), h = Object.prototype.hasOwnProperty, S = d.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, F = { key: !0, ref: !0, __self: !0, __source: !0 };
8
- function P(b, v, k) {
9
- var p, T = {}, x = null, A = null;
10
- k !== void 0 && (x = "" + k), v.key !== void 0 && (x = "" + v.key), v.ref !== void 0 && (A = v.ref);
11
- for (p in v) h.call(v, p) && !F.hasOwnProperty(p) && (T[p] = v[p]);
12
- if (b && b.defaultProps) for (p in v = b.defaultProps, v) T[p] === void 0 && (T[p] = v[p]);
13
- return { $$typeof: u, type: b, key: x, ref: A, props: T, _owner: S.current };
14
- }
15
- return U.Fragment = y, U.jsx = P, U.jsxs = P, U;
16
- }
17
- var L = {};
18
- var We;
19
- function br() {
20
- return We || (We = 1, process.env.NODE_ENV !== "production" && (function() {
21
- var d = Ye, u = /* @__PURE__ */ Symbol.for("react.element"), y = /* @__PURE__ */ Symbol.for("react.portal"), h = /* @__PURE__ */ Symbol.for("react.fragment"), S = /* @__PURE__ */ Symbol.for("react.strict_mode"), F = /* @__PURE__ */ Symbol.for("react.profiler"), P = /* @__PURE__ */ Symbol.for("react.provider"), b = /* @__PURE__ */ Symbol.for("react.context"), v = /* @__PURE__ */ Symbol.for("react.forward_ref"), k = /* @__PURE__ */ Symbol.for("react.suspense"), p = /* @__PURE__ */ Symbol.for("react.suspense_list"), T = /* @__PURE__ */ Symbol.for("react.memo"), x = /* @__PURE__ */ Symbol.for("react.lazy"), A = /* @__PURE__ */ Symbol.for("react.offscreen"), j = Symbol.iterator, Z = "@@iterator";
22
- function Q(e) {
23
- if (e === null || typeof e != "object")
24
- return null;
25
- var r = j && e[j] || e[Z];
26
- return typeof r == "function" ? r : null;
27
- }
28
- var w = d.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
29
- function m(e) {
30
- {
31
- for (var r = arguments.length, t = new Array(r > 1 ? r - 1 : 0), n = 1; n < r; n++)
32
- t[n - 1] = arguments[n];
33
- ee("error", e, t);
34
- }
35
- }
36
- function ee(e, r, t) {
37
- {
38
- var n = w.ReactDebugCurrentFrame, i = n.getStackAddendum();
39
- i !== "" && (r += "%s", t = t.concat([i]));
40
- var s = t.map(function(o) {
41
- return String(o);
42
- });
43
- s.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, s);
44
- }
45
- }
46
- var V = !1, re = !1, l = !1, g = !1, C = !1, N;
47
- N = /* @__PURE__ */ Symbol.for("react.module.reference");
48
- function B(e) {
49
- return !!(typeof e == "string" || typeof e == "function" || e === h || e === F || C || e === S || e === k || e === p || g || e === A || V || re || l || typeof e == "object" && e !== null && (e.$$typeof === x || e.$$typeof === T || e.$$typeof === P || e.$$typeof === b || e.$$typeof === v || // This needs to include all possible module reference object
50
- // types supported by any Flight configuration anywhere since
51
- // we don't know which Flight build this will end up being used
52
- // with.
53
- e.$$typeof === N || e.getModuleId !== void 0));
54
- }
55
- function te(e, r, t) {
56
- var n = e.displayName;
57
- if (n)
58
- return n;
59
- var i = r.displayName || r.name || "";
60
- return i !== "" ? t + "(" + i + ")" : t;
61
- }
62
- function de(e) {
63
- return e.displayName || "Context";
64
- }
65
- function D(e) {
66
- if (e == null)
67
- return null;
68
- if (typeof e.tag == "number" && m("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
69
- return e.displayName || e.name || null;
70
- if (typeof e == "string")
71
- return e;
72
- switch (e) {
73
- case h:
74
- return "Fragment";
75
- case y:
76
- return "Portal";
77
- case F:
78
- return "Profiler";
79
- case S:
80
- return "StrictMode";
81
- case k:
82
- return "Suspense";
83
- case p:
84
- return "SuspenseList";
85
- }
86
- if (typeof e == "object")
87
- switch (e.$$typeof) {
88
- case b:
89
- var r = e;
90
- return de(r) + ".Consumer";
91
- case P:
92
- var t = e;
93
- return de(t._context) + ".Provider";
94
- case v:
95
- return te(e, e.render, "ForwardRef");
96
- case T:
97
- var n = e.displayName || null;
98
- return n !== null ? n : D(e.type) || "Memo";
99
- case x: {
100
- var i = e, s = i._payload, o = i._init;
101
- try {
102
- return D(o(s));
103
- } catch {
104
- return null;
105
- }
106
- }
107
- }
108
- return null;
109
- }
110
- var I = Object.assign, Y = 0, ve, pe, ye, me, be, _e, he;
111
- function ge() {
112
- }
113
- ge.__reactDisabledLog = !0;
114
- function Ke() {
115
- {
116
- if (Y === 0) {
117
- ve = console.log, pe = console.info, ye = console.warn, me = console.error, be = console.group, _e = console.groupCollapsed, he = console.groupEnd;
118
- var e = {
119
- configurable: !0,
120
- enumerable: !0,
121
- value: ge,
122
- writable: !0
123
- };
124
- Object.defineProperties(console, {
125
- info: e,
126
- log: e,
127
- warn: e,
128
- error: e,
129
- group: e,
130
- groupCollapsed: e,
131
- groupEnd: e
132
- });
133
- }
134
- Y++;
135
- }
136
- }
137
- function Ue() {
138
- {
139
- if (Y--, Y === 0) {
140
- var e = {
141
- configurable: !0,
142
- enumerable: !0,
143
- writable: !0
144
- };
145
- Object.defineProperties(console, {
146
- log: I({}, e, {
147
- value: ve
148
- }),
149
- info: I({}, e, {
150
- value: pe
151
- }),
152
- warn: I({}, e, {
153
- value: ye
154
- }),
155
- error: I({}, e, {
156
- value: me
157
- }),
158
- group: I({}, e, {
159
- value: be
160
- }),
161
- groupCollapsed: I({}, e, {
162
- value: _e
163
- }),
164
- groupEnd: I({}, e, {
165
- value: he
166
- })
167
- });
168
- }
169
- Y < 0 && m("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
170
- }
171
- }
172
- var ne = w.ReactCurrentDispatcher, ae;
173
- function J(e, r, t) {
174
- {
175
- if (ae === void 0)
176
- try {
177
- throw Error();
178
- } catch (i) {
179
- var n = i.stack.trim().match(/\n( *(at )?)/);
180
- ae = n && n[1] || "";
181
- }
182
- return `
183
- ` + ae + e;
184
- }
185
- }
186
- var oe = !1, q;
187
- {
188
- var Le = typeof WeakMap == "function" ? WeakMap : Map;
189
- q = new Le();
190
- }
191
- function Ee(e, r) {
192
- if (!e || oe)
193
- return "";
194
- {
195
- var t = q.get(e);
196
- if (t !== void 0)
197
- return t;
198
- }
199
- var n;
200
- oe = !0;
201
- var i = Error.prepareStackTrace;
202
- Error.prepareStackTrace = void 0;
203
- var s;
204
- s = ne.current, ne.current = null, Ke();
205
- try {
206
- if (r) {
207
- var o = function() {
208
- throw Error();
209
- };
210
- if (Object.defineProperty(o.prototype, "props", {
211
- set: function() {
212
- throw Error();
213
- }
214
- }), typeof Reflect == "object" && Reflect.construct) {
215
- try {
216
- Reflect.construct(o, []);
217
- } catch (E) {
218
- n = E;
219
- }
220
- Reflect.construct(e, [], o);
221
- } else {
222
- try {
223
- o.call();
224
- } catch (E) {
225
- n = E;
226
- }
227
- e.call(o.prototype);
228
- }
229
- } else {
230
- try {
231
- throw Error();
232
- } catch (E) {
233
- n = E;
234
- }
235
- e();
236
- }
237
- } catch (E) {
238
- if (E && n && typeof E.stack == "string") {
239
- for (var a = E.stack.split(`
240
- `), _ = n.stack.split(`
241
- `), c = a.length - 1, f = _.length - 1; c >= 1 && f >= 0 && a[c] !== _[f]; )
242
- f--;
243
- for (; c >= 1 && f >= 0; c--, f--)
244
- if (a[c] !== _[f]) {
245
- if (c !== 1 || f !== 1)
246
- do
247
- if (c--, f--, f < 0 || a[c] !== _[f]) {
248
- var R = `
249
- ` + a[c].replace(" at new ", " at ");
250
- return e.displayName && R.includes("<anonymous>") && (R = R.replace("<anonymous>", e.displayName)), typeof e == "function" && q.set(e, R), R;
251
- }
252
- while (c >= 1 && f >= 0);
253
- break;
254
- }
255
- }
256
- } finally {
257
- oe = !1, ne.current = s, Ue(), Error.prepareStackTrace = i;
258
- }
259
- var W = e ? e.displayName || e.name : "", M = W ? J(W) : "";
260
- return typeof e == "function" && q.set(e, M), M;
261
- }
262
- function Ve(e, r, t) {
263
- return Ee(e, !1);
264
- }
265
- function Be(e) {
266
- var r = e.prototype;
267
- return !!(r && r.isReactComponent);
268
- }
269
- function G(e, r, t) {
270
- if (e == null)
271
- return "";
272
- if (typeof e == "function")
273
- return Ee(e, Be(e));
274
- if (typeof e == "string")
275
- return J(e);
276
- switch (e) {
277
- case k:
278
- return J("Suspense");
279
- case p:
280
- return J("SuspenseList");
281
- }
282
- if (typeof e == "object")
283
- switch (e.$$typeof) {
284
- case v:
285
- return Ve(e.render);
286
- case T:
287
- return G(e.type, r, t);
288
- case x: {
289
- var n = e, i = n._payload, s = n._init;
290
- try {
291
- return G(s(i), r, t);
292
- } catch {
293
- }
294
- }
295
- }
296
- return "";
297
- }
298
- var K = Object.prototype.hasOwnProperty, Re = {}, ke = w.ReactDebugCurrentFrame;
299
- function z(e) {
300
- if (e) {
301
- var r = e._owner, t = G(e.type, e._source, r ? r.type : null);
302
- ke.setExtraStackFrame(t);
303
- } else
304
- ke.setExtraStackFrame(null);
305
- }
306
- function Je(e, r, t, n, i) {
307
- {
308
- var s = Function.call.bind(K);
309
- for (var o in e)
310
- if (s(e, o)) {
311
- var a = void 0;
312
- try {
313
- if (typeof e[o] != "function") {
314
- var _ = Error((n || "React class") + ": " + t + " type `" + o + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[o] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
315
- throw _.name = "Invariant Violation", _;
316
- }
317
- a = e[o](r, o, n, t, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
318
- } catch (c) {
319
- a = c;
320
- }
321
- a && !(a instanceof Error) && (z(i), m("%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).", n || "React class", t, o, typeof a), z(null)), a instanceof Error && !(a.message in Re) && (Re[a.message] = !0, z(i), m("Failed %s type: %s", t, a.message), z(null));
322
- }
323
- }
324
- }
325
- var qe = Array.isArray;
326
- function ie(e) {
327
- return qe(e);
328
- }
329
- function Ge(e) {
330
- {
331
- var r = typeof Symbol == "function" && Symbol.toStringTag, t = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
332
- return t;
333
- }
334
- }
335
- function ze(e) {
336
- try {
337
- return Te(e), !1;
338
- } catch {
339
- return !0;
340
- }
341
- }
342
- function Te(e) {
343
- return "" + e;
344
- }
345
- function xe(e) {
346
- if (ze(e))
347
- return m("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ge(e)), Te(e);
348
- }
349
- var Ce = w.ReactCurrentOwner, Xe = {
350
- key: !0,
351
- ref: !0,
352
- __self: !0,
353
- __source: !0
354
- }, Oe, Se;
355
- function He(e) {
356
- if (K.call(e, "ref")) {
357
- var r = Object.getOwnPropertyDescriptor(e, "ref").get;
358
- if (r && r.isReactWarning)
359
- return !1;
360
- }
361
- return e.ref !== void 0;
362
- }
363
- function Ze(e) {
364
- if (K.call(e, "key")) {
365
- var r = Object.getOwnPropertyDescriptor(e, "key").get;
366
- if (r && r.isReactWarning)
367
- return !1;
368
- }
369
- return e.key !== void 0;
370
- }
371
- function Qe(e, r) {
372
- typeof e.ref == "string" && Ce.current;
373
- }
374
- function er(e, r) {
375
- {
376
- var t = function() {
377
- Oe || (Oe = !0, m("%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)", r));
378
- };
379
- t.isReactWarning = !0, Object.defineProperty(e, "key", {
380
- get: t,
381
- configurable: !0
382
- });
383
- }
384
- }
385
- function rr(e, r) {
386
- {
387
- var t = function() {
388
- Se || (Se = !0, m("%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)", r));
389
- };
390
- t.isReactWarning = !0, Object.defineProperty(e, "ref", {
391
- get: t,
392
- configurable: !0
393
- });
394
- }
395
- }
396
- var tr = function(e, r, t, n, i, s, o) {
397
- var a = {
398
- // This tag allows us to uniquely identify this as a React Element
399
- $$typeof: u,
400
- // Built-in properties that belong on the element
401
- type: e,
402
- key: r,
403
- ref: t,
404
- props: o,
405
- // Record the component responsible for creating this element.
406
- _owner: s
407
- };
408
- return a._store = {}, Object.defineProperty(a._store, "validated", {
409
- configurable: !1,
410
- enumerable: !1,
411
- writable: !0,
412
- value: !1
413
- }), Object.defineProperty(a, "_self", {
414
- configurable: !1,
415
- enumerable: !1,
416
- writable: !1,
417
- value: n
418
- }), Object.defineProperty(a, "_source", {
419
- configurable: !1,
420
- enumerable: !1,
421
- writable: !1,
422
- value: i
423
- }), Object.freeze && (Object.freeze(a.props), Object.freeze(a)), a;
424
- };
425
- function nr(e, r, t, n, i) {
426
- {
427
- var s, o = {}, a = null, _ = null;
428
- t !== void 0 && (xe(t), a = "" + t), Ze(r) && (xe(r.key), a = "" + r.key), He(r) && (_ = r.ref, Qe(r, i));
429
- for (s in r)
430
- K.call(r, s) && !Xe.hasOwnProperty(s) && (o[s] = r[s]);
431
- if (e && e.defaultProps) {
432
- var c = e.defaultProps;
433
- for (s in c)
434
- o[s] === void 0 && (o[s] = c[s]);
435
- }
436
- if (a || _) {
437
- var f = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
438
- a && er(o, f), _ && rr(o, f);
439
- }
440
- return tr(e, a, _, i, n, Ce.current, o);
441
- }
442
- }
443
- var ue = w.ReactCurrentOwner, Pe = w.ReactDebugCurrentFrame;
444
- function $(e) {
445
- if (e) {
446
- var r = e._owner, t = G(e.type, e._source, r ? r.type : null);
447
- Pe.setExtraStackFrame(t);
448
- } else
449
- Pe.setExtraStackFrame(null);
450
- }
451
- var se;
452
- se = !1;
453
- function le(e) {
454
- return typeof e == "object" && e !== null && e.$$typeof === u;
455
- }
456
- function je() {
457
- {
458
- if (ue.current) {
459
- var e = D(ue.current.type);
460
- if (e)
461
- return `
462
-
463
- Check the render method of \`` + e + "`.";
464
- }
465
- return "";
466
- }
467
- }
468
- function ar(e) {
469
- return "";
470
- }
471
- var we = {};
472
- function or(e) {
473
- {
474
- var r = je();
475
- if (!r) {
476
- var t = typeof e == "string" ? e : e.displayName || e.name;
477
- t && (r = `
478
-
479
- Check the top-level render call using <` + t + ">.");
480
- }
481
- return r;
482
- }
483
- }
484
- function De(e, r) {
485
- {
486
- if (!e._store || e._store.validated || e.key != null)
487
- return;
488
- e._store.validated = !0;
489
- var t = or(r);
490
- if (we[t])
491
- return;
492
- we[t] = !0;
493
- var n = "";
494
- e && e._owner && e._owner !== ue.current && (n = " It was passed a child from " + D(e._owner.type) + "."), $(e), m('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', t, n), $(null);
495
- }
496
- }
497
- function Fe(e, r) {
498
- {
499
- if (typeof e != "object")
500
- return;
501
- if (ie(e))
502
- for (var t = 0; t < e.length; t++) {
503
- var n = e[t];
504
- le(n) && De(n, r);
505
- }
506
- else if (le(e))
507
- e._store && (e._store.validated = !0);
508
- else if (e) {
509
- var i = Q(e);
510
- if (typeof i == "function" && i !== e.entries)
511
- for (var s = i.call(e), o; !(o = s.next()).done; )
512
- le(o.value) && De(o.value, r);
513
- }
514
- }
515
- }
516
- function ir(e) {
517
- {
518
- var r = e.type;
519
- if (r == null || typeof r == "string")
520
- return;
521
- var t;
522
- if (typeof r == "function")
523
- t = r.propTypes;
524
- else if (typeof r == "object" && (r.$$typeof === v || // Note: Memo only checks outer props here.
525
- // Inner props are checked in the reconciler.
526
- r.$$typeof === T))
527
- t = r.propTypes;
528
- else
529
- return;
530
- if (t) {
531
- var n = D(r);
532
- Je(t, e.props, "prop", n, e);
533
- } else if (r.PropTypes !== void 0 && !se) {
534
- se = !0;
535
- var i = D(r);
536
- m("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", i || "Unknown");
537
- }
538
- typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && m("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
539
- }
540
- }
541
- function ur(e) {
542
- {
543
- for (var r = Object.keys(e.props), t = 0; t < r.length; t++) {
544
- var n = r[t];
545
- if (n !== "children" && n !== "key") {
546
- $(e), m("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", n), $(null);
547
- break;
548
- }
549
- }
550
- e.ref !== null && ($(e), m("Invalid attribute `ref` supplied to `React.Fragment`."), $(null));
551
- }
552
- }
553
- var Ae = {};
554
- function Ie(e, r, t, n, i, s) {
555
- {
556
- var o = B(e);
557
- if (!o) {
558
- var a = "";
559
- (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (a += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
560
- var _ = ar();
561
- _ ? a += _ : a += je();
562
- var c;
563
- e === null ? c = "null" : ie(e) ? c = "array" : e !== void 0 && e.$$typeof === u ? (c = "<" + (D(e.type) || "Unknown") + " />", a = " Did you accidentally export a JSX literal instead of a component?") : c = typeof e, m("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", c, a);
564
- }
565
- var f = nr(e, r, t, i, s);
566
- if (f == null)
567
- return f;
568
- if (o) {
569
- var R = r.children;
570
- if (R !== void 0)
571
- if (n)
572
- if (ie(R)) {
573
- for (var W = 0; W < R.length; W++)
574
- Fe(R[W], e);
575
- Object.freeze && Object.freeze(R);
576
- } else
577
- m("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
578
- else
579
- Fe(R, e);
580
- }
581
- if (K.call(r, "key")) {
582
- var M = D(e), E = Object.keys(r).filter(function(vr) {
583
- return vr !== "key";
584
- }), ce = E.length > 0 ? "{key: someKey, " + E.join(": ..., ") + ": ...}" : "{key: someKey}";
585
- if (!Ae[M + ce]) {
586
- var dr = E.length > 0 ? "{" + E.join(": ..., ") + ": ...}" : "{}";
587
- m(`A props object containing a "key" prop is being spread into JSX:
588
- let props = %s;
589
- <%s {...props} />
590
- React keys must be passed directly to JSX without using spread:
591
- let props = %s;
592
- <%s key={someKey} {...props} />`, ce, M, dr, M), Ae[M + ce] = !0;
593
- }
594
- }
595
- return e === h ? ur(f) : ir(f), f;
596
- }
597
- }
598
- function sr(e, r, t) {
599
- return Ie(e, r, t, !0);
600
- }
601
- function lr(e, r, t) {
602
- return Ie(e, r, t, !1);
603
- }
604
- var cr = lr, fr = sr;
605
- L.Fragment = h, L.jsx = cr, L.jsxs = fr;
606
- })()), L;
607
- }
608
- var Ne;
609
- function _r() {
610
- return Ne || (Ne = 1, process.env.NODE_ENV === "production" ? X.exports = mr() : X.exports = br()), X.exports;
611
- }
612
- var O = _r();
613
- const hr = ({ currentKey: d }) => {
614
- let u;
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ import { useRef as f, useState as d, useMemo as U, useEffect as M, useCallback as P } from "react";
3
+ const w = ({ currentKey: n }) => {
4
+ let e;
615
5
  do
616
- u = Math.floor(Math.random() * 10);
617
- while (u === d);
618
- return { randomKey: u };
6
+ e = Math.floor(Math.random() * 10);
7
+ while (e === n);
8
+ return { randomKey: e };
619
9
  };
620
- function gr(d) {
621
- const u = [...d];
622
- for (let y = u.length - 1; y > 0; y--) {
623
- const h = Math.floor(Math.random() * (y + 1));
624
- [u[y], u[h]] = [u[h], u[y]];
10
+ function A(n) {
11
+ const e = [...n];
12
+ for (let u = e.length - 1; u > 0; u--) {
13
+ const l = Math.floor(Math.random() * (u + 1));
14
+ [e[u], e[l]] = [e[l], e[u]];
625
15
  }
626
- return u;
16
+ return e;
627
17
  }
628
- const Er = 4, Rr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0];
629
- function kr({
630
- numbers: d = Rr,
631
- shuffleKey: u = !1
18
+ const B = 4, I = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0];
19
+ function j({
20
+ numbers: n = I,
21
+ shuffleKey: e = !1
632
22
  } = {}) {
633
- const y = fe(0), [h, S] = H(0);
634
- return { keys: pr(() => {
635
- const b = d.map((p) => ({
23
+ const u = f(0), [l, p] = d(0);
24
+ return { keys: U(() => {
25
+ const a = n.map((c) => ({
636
26
  type: "num",
637
- value: p
638
- })), v = Array.from({ length: 2 }, () => ({ type: "dummy" })), k = [...b, ...v];
639
- return u ? gr(k) : k;
640
- }, [d, u, h]), onDigitPress: () => {
641
- u && (y.current += 1, y.current >= Er && (y.current = 0, S((b) => b + 1)));
27
+ value: c
28
+ })), m = Array.from({ length: 2 }, () => ({ type: "dummy" })), i = [...a, ...m];
29
+ return e ? A(i) : i;
30
+ }, [n, e, l]), onDigitPress: () => {
31
+ e && (u.current += 1, u.current >= B && (u.current = 0, p((a) => a + 1)));
642
32
  } };
643
33
  }
644
- const Tr = ({ onBackspace: d, disabled: u }) => /* @__PURE__ */ O.jsx(
34
+ const F = ({ onBackspace: n, disabled: e }) => /* @__PURE__ */ s(
645
35
  "button",
646
36
  {
647
37
  className: "kp__btn kp__btn-del ",
648
38
  type: "button",
649
- onClick: d,
650
- disabled: u,
39
+ onClick: n,
40
+ disabled: e,
651
41
  children: "⌫"
652
42
  }
653
- ), xr = ({ onClear: d, disabled: u }) => /* @__PURE__ */ O.jsx(
43
+ ), L = ({ onClear: n, disabled: e }) => /* @__PURE__ */ s(
654
44
  "button",
655
45
  {
656
46
  className: "kp__btn kp__btn--clear",
657
47
  type: "button",
658
- onClick: d,
659
- disabled: u,
48
+ onClick: n,
49
+ disabled: e,
660
50
  children: "초기화"
661
51
  },
662
52
  "clear"
663
- ), Cr = ({ onOk: d, disabled: u }) => /* @__PURE__ */ O.jsx(
53
+ ), O = ({ onOk: n, disabled: e }) => /* @__PURE__ */ s(
664
54
  "button",
665
55
  {
666
56
  className: "kp__btn kp__btn--ok",
667
57
  type: "button",
668
- onClick: d,
669
- disabled: u,
58
+ onClick: n,
59
+ disabled: e,
670
60
  children: "확인"
671
61
  },
672
62
  "ok"
673
- ), Or = [
63
+ ), $ = [
674
64
  { type: "num", value: 1 },
675
65
  { type: "num", value: 2 },
676
66
  { type: "num", value: 3 },
@@ -686,85 +76,85 @@ const Tr = ({ onBackspace: d, disabled: u }) => /* @__PURE__ */ O.jsx(
686
76
  { type: "dummy" },
687
77
  { type: "dummy" },
688
78
  { type: "ok" }
689
- ], Pr = ({
690
- mixedKey: d = !1,
691
- shuffleKey: u = !1,
692
- pressCooldown: y = 500,
693
- onPress: h,
694
- onOkClick: S,
695
- onBackspaceClick: F,
696
- onClearClick: P
79
+ ], q = ({
80
+ mixedKey: n = !1,
81
+ shuffleKey: e = !1,
82
+ pressCooldown: u = 500,
83
+ onPress: l,
84
+ onOkClick: p,
85
+ onBackspaceClick: k,
86
+ onClearClick: b
697
87
  }) => {
698
- const [b, v] = H(null), [k, p] = H([]), [T, x] = H(!1), A = fe(0), j = fe(null), Z = (l) => {
699
- const g = l.target.closest("button");
700
- if (!g || g.classList.contains("kp__btn--dummy")) return;
701
- const C = g.dataset.key;
702
- console.log("버튼 눌림: ", C), C != null && (ee(), v(Number(C)));
88
+ const [a, m] = d(null), [i, c] = d([]), [x, _] = d(!1), h = f(0), y = f(null), C = (t) => {
89
+ const r = t.target.closest("button");
90
+ if (!r || r.classList.contains("kp__btn--dummy")) return;
91
+ const o = r.dataset.key;
92
+ console.log("버튼 눌림: ", o), o != null && (D(), m(Number(o)));
703
93
  };
704
- Me(() => () => j.current && clearTimeout(j.current), []);
705
- const Q = (l) => {
706
- x(!0), j.current && clearTimeout(j.current);
707
- const g = Math.max(0, l - Date.now());
708
- j.current = setTimeout(() => {
709
- x(!1);
710
- }, g);
711
- }, w = yr(
712
- (l) => {
713
- const g = Date.now();
714
- if (y > 0 && g < A.current) return;
715
- const C = g + Math.max(0, y);
716
- A.current = C, y > 0 && Q(C);
717
- const { action: N, key: B } = l.currentTarget.dataset, te = N ? { type: N } : { type: "num", value: B != null ? Number(B) : void 0 };
718
- h?.(te);
94
+ M(() => () => y.current && clearTimeout(y.current), []);
95
+ const N = (t) => {
96
+ _(!0), y.current && clearTimeout(y.current);
97
+ const r = Math.max(0, t - Date.now());
98
+ y.current = setTimeout(() => {
99
+ _(!1);
100
+ }, r);
101
+ }, T = P(
102
+ (t) => {
103
+ const r = Date.now();
104
+ if (u > 0 && r < h.current) return;
105
+ const o = r + Math.max(0, u);
106
+ h.current = o, u > 0 && N(o);
107
+ const { action: g, key: K } = t.currentTarget.dataset, S = g ? { type: g } : { type: "num", value: K != null ? Number(K) : void 0 };
108
+ l?.(S);
719
109
  },
720
- [h, y]
721
- ), { keys: m, onDigitPress: ee } = kr({
722
- shuffleKey: u
110
+ [l, u]
111
+ ), { keys: R, onDigitPress: D } = j({
112
+ shuffleKey: e
723
113
  });
724
- let V = 0;
725
- const re = Or.map((l) => {
726
- if (l.type === "num" || l.type === "dummy") {
727
- const g = m[V];
728
- return V += 1, g ?? { type: "dummy" };
114
+ let v = 0;
115
+ const E = $.map((t) => {
116
+ if (t.type === "num" || t.type === "dummy") {
117
+ const r = R[v];
118
+ return v += 1, r ?? { type: "dummy" };
729
119
  }
730
- return l;
120
+ return t;
731
121
  });
732
- return Me(() => {
733
- if (!d || b === null) {
734
- p([]);
122
+ return M(() => {
123
+ if (!n || a === null) {
124
+ c([]);
735
125
  return;
736
126
  }
737
- const { randomKey: l } = hr({});
738
- console.log("버튼 같이 눌림: ", b, l), p([b, l]), setTimeout(() => {
739
- p([]);
127
+ const { randomKey: t } = w({});
128
+ console.log("버튼 같이 눌림: ", a, t), c([a, t]), setTimeout(() => {
129
+ c([]);
740
130
  }, 400);
741
- }, [d, b]), /* @__PURE__ */ O.jsx("div", { className: "kp", children: /* @__PURE__ */ O.jsx("div", { className: "kp__grid", onClick: Z, children: re.map((l, g) => {
742
- if (l.type === "num") {
743
- const C = k.includes(l.value);
744
- return /* @__PURE__ */ O.jsx(
131
+ }, [n, a]), /* @__PURE__ */ s("div", { className: "kp", children: /* @__PURE__ */ s("div", { className: "kp__grid", onClick: C, children: E.map((t, r) => {
132
+ if (t.type === "num") {
133
+ const o = i.includes(t.value);
134
+ return /* @__PURE__ */ s(
745
135
  "button",
746
136
  {
747
137
  className: "kp__btn kp__btn--num",
748
138
  type: "button",
749
- "data-key": l.value,
750
- onClick: w,
751
- disabled: T,
752
- style: C ? {
139
+ "data-key": t.value,
140
+ onClick: T,
141
+ disabled: x,
142
+ style: o ? {
753
143
  background: "var(--blue-weak)",
754
144
  borderColor: "rgba(49,130,246,.75)"
755
145
  } : void 0,
756
- children: l.value
146
+ children: t.value
757
147
  },
758
- `num-${l.value}`
148
+ `num-${t.value}`
759
149
  );
760
150
  }
761
- return l.type === "del" ? /* @__PURE__ */ O.jsx(
762
- Tr,
151
+ return t.type === "del" ? /* @__PURE__ */ s(
152
+ F,
763
153
  {
764
- onBackspace: F,
154
+ onBackspace: k,
765
155
  disabled: !1
766
156
  }
767
- ) : l.type === "ok" ? /* @__PURE__ */ O.jsx(Cr, { onOk: S, disabled: !1 }) : l.type === "clear" ? /* @__PURE__ */ O.jsx(xr, { onClear: P, disabled: !1 }) : l.type === "dummy" ? /* @__PURE__ */ O.jsx(
157
+ ) : t.type === "ok" ? /* @__PURE__ */ s(O, { onOk: p, disabled: !1 }) : t.type === "clear" ? /* @__PURE__ */ s(L, { onClear: b, disabled: !1 }) : t.type === "dummy" ? /* @__PURE__ */ s(
768
158
  "button",
769
159
  {
770
160
  className: "kp__btn kp__btn--dummy",
@@ -772,10 +162,10 @@ const Tr = ({ onBackspace: d, disabled: u }) => /* @__PURE__ */ O.jsx(
772
162
  tabIndex: -1,
773
163
  "aria-hidden": "true"
774
164
  },
775
- `dummy-${g}`
165
+ `dummy-${r}`
776
166
  ) : null;
777
167
  }) }) });
778
168
  };
779
169
  export {
780
- Pr as Keypad
170
+ q as Keypad
781
171
  };
@@ -0,0 +1 @@
1
+ html,body,#root{@apply w-full h-full;}body{margin:0;background:#fff;font-family:system-ui,-apple-system,Segoe UI,Roboto,Noto Sans KR,Arial,Apple SD Gothic Neo,Malgun Gothic,sans-serif}.keypad-page{min-height:100vh;display:grid;place-items:center;padding:22px}:root{--blue: #3182f6;--blue-weak: #eaf3ff;--stroke: #e9ecef;--stroke-2: #e9ecef;--num-bg: #ffffff;--num-tx: #0b1220;--fn-bg: #ffffff;--fn-tx: #0b1220;--radius: 14px;--cell-radius: 0px;--cell-h: 56px;--num-col: minmax(58px, 1fr);--fn-col: 110px;--gap: 0px;--focus: 0 0 0 3px rgba(49, 130, 246, .22)}*{box-sizing:border-box}.kp{width:min(420px,96vw);background:transparent;border:2px solid var(--stroke);border-radius:var(--radius);padding:0;overflow:hidden}.kp__grid{display:grid;grid-template-columns:repeat(4,var(--num-col)) var(--fn-col);grid-auto-rows:var(--cell-h);gap:var(--gap)}button.kp__btn{appearance:none;border:1px solid var(--stroke-2);border-radius:var(--cell-radius);background:var(--num-bg);padding:0 10px;cursor:pointer;font:inherit;display:flex;align-items:center;justify-content:center;-webkit-user-select:none;user-select:none;transition:background .12s ease,border-color .12s ease;color:#0b1220}button.kp__btn:focus-visible{outline:none;box-shadow:var(--focus);border-color:#3182f6b3}.kp__btn--num{font-size:28px;font-weight:900;letter-spacing:.2px;-webkit-tap-highlight-color:transparent}button.kp__btn.kp__btn--num:active{background:#f3f4f6}.kp__btn--fn{background:var(--fn-bg);font-size:18px;font-weight:800;letter-spacing:.2px}.kp__btn--del{display:flex;gap:8px;justify-content:center;background:#fff;border-color:var(--stroke-2)}.kp__btn--del .kp__icon{width:18px;height:18px;flex:0 0 auto;color:#4f8a4b}.kp__btn--del .kp__deltext{display:none}.kp__btn--ok{background:#508c4e!important;color:#fff!important;border-color:var(--stroke-2)!important;font-size:18px;font-weight:900;letter-spacing:.2px;width:auto;height:auto;position:relative;z-index:2}.kp__btn--ok:active{background:#457c44!important}.kp__btn--dummy{pointer-events:none;cursor:default;background:#fff;border:1px solid var(--stroke-2)}.kp__btn--del{grid-column:5;grid-row:1}.kp__btn--clear{grid-column:5;grid-row:2;color:#457c44!important}.kp__btn--ok{grid-column:5;grid-row:3}@media(max-width:380px){:root{--cell-h: 52px;--fn-col: 96px}.kp__btn--num{font-size:26px}}
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "secure-keypad",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "A secure numeric keypad with shuffled keys and anti-spam input protection",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",
8
8
  "exports": {
9
- ".": "./dist/index.js"
9
+ ".": "./dist/index.js",
10
+ "./style.css": "./dist/style.css"
10
11
  },
11
12
  "scripts": {
12
13
  "test": "echo \"Error: no test specified\" && exit 1",