secure-keypad 1.0.8 → 1.0.9

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
@@ -20,15 +20,15 @@ function L({
20
20
  numbers: r = F,
21
21
  shuffleKey: t = !1
22
22
  } = {}) {
23
- const n = k(0), [o, a] = h(0);
23
+ const n = k(0), [o, l] = h(0);
24
24
  return { keys: A(() => {
25
- const l = r.map((c) => ({
25
+ const a = r.map((c) => ({
26
26
  type: "num",
27
27
  value: c
28
- })), b = Array.from({ length: 2 }, () => ({ type: "dummy" })), m = [...l, ...b];
28
+ })), b = Array.from({ length: 2 }, () => ({ type: "dummy" })), m = [...a, ...b];
29
29
  return t ? w(m) : m;
30
30
  }, [r, t, o]), onDigitPress: () => {
31
- t && (n.current += 1, n.current >= I && (n.current = 0, a((l) => l + 1)));
31
+ t && (n.current += 1, n.current >= I && (n.current = 0, l((a) => a + 1)));
32
32
  } };
33
33
  }
34
34
  function G({
@@ -79,11 +79,11 @@ const H = [
79
79
  pressCooldown: n = 500,
80
80
  // 버튼 누른 후 쿨다운 시간 (ms)
81
81
  onPress: o,
82
- onOkClick: a,
82
+ onOkClick: l,
83
83
  onBackspaceClick: p,
84
84
  onClearClick: i
85
85
  }) => {
86
- const [l, b] = h(null), [m, c] = h([]), [v, g] = h(!1), _ = k(0), y = k(null), T = (e) => {
86
+ const [a, b] = h(null), [m, c] = h([]), [v, g] = h(!1), _ = k(0), y = k(null), T = (e) => {
87
87
  const u = e.target.closest("button");
88
88
  if (!u || u.classList.contains("kp__btn--dummy")) return;
89
89
  const s = u.dataset.key;
@@ -103,9 +103,9 @@ const H = [
103
103
  const s = u + Math.max(0, n);
104
104
  _.current = s, n > 0 && N(s);
105
105
  const { action: d, key: x } = e.currentTarget.dataset, $ = d ? { type: d } : { type: "num", value: x != null ? Number(x) : void 0 };
106
- o?.($), d === "del" && p?.(), d === "clear" && i?.(), d === "ok" && a?.();
106
+ o?.($), d === "del" && p?.(), d === "clear" && i?.(), d === "ok" && l?.();
107
107
  },
108
- [o, a, p, i, n]
108
+ [o, l, p, i, n]
109
109
  ), { keys: D, onDigitPress: E } = L({
110
110
  shuffleKey: t
111
111
  });
@@ -118,15 +118,15 @@ const H = [
118
118
  return e;
119
119
  });
120
120
  return M(() => {
121
- if (!r || l === null) {
121
+ if (!r || a === null) {
122
122
  c([]);
123
123
  return;
124
124
  }
125
125
  const { randomKey: e } = j({});
126
- console.log("버튼 같이 눌림: ", l, e), c([l, e]), setTimeout(() => {
126
+ console.log("버튼 같이 눌림: ", a, e), c([a, e]), setTimeout(() => {
127
127
  c([]);
128
128
  }, 400);
129
- }, [r, l]), /* @__PURE__ */ f("div", { className: "kp", children: /* @__PURE__ */ f("div", { className: "kp__grid", onClick: T, children: S.map((e, u) => {
129
+ }, [r, a]), /* @__PURE__ */ f("div", { className: "kp", children: /* @__PURE__ */ f("div", { className: "kp__grid", onClick: T, children: S.map((e, u) => {
130
130
  if (e.type === "num") {
131
131
  const s = m.includes(e.value);
132
132
  return /* @__PURE__ */ f(
@@ -145,7 +145,7 @@ const H = [
145
145
  if (e.type === "del" || e.type === "clear" || e.type === "ok") {
146
146
  const s = G({
147
147
  type: e.type,
148
- onOkClick: a,
148
+ onOkClick: l,
149
149
  onBackspaceClick: p,
150
150
  onClearClick: i
151
151
  });
@@ -179,5 +179,6 @@ const H = [
179
179
  }) }) });
180
180
  };
181
181
  export {
182
- z as Keypad
182
+ z as Keypad,
183
+ z as default
183
184
  };
@@ -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,Apple SD Gothic Neo,Malgun Gothic,Arial,sans-serif;font-weight:500;font-size:20px}.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);padding:0;overflow:hidden}.kp__grid{display:grid;grid-template-columns:repeat(5,1fr) ㄴ;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;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-weight:900;letter-spacing:.2px;-webkit-tap-highlight-color:transparent}button.kp__btn.kp__btn--num:active,.kp__btn--num.mixed{background:#f3f4f6;border-color:#4f8a4b}.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;letter-spacing:.2px;width:auto;height:auto;position:relative;z-index:2}.kp__btn--ok:active{background:#457c44!important;border-color:#4f8a4b}.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;color:#457c44!important}.kp__btn--del:active{background:#f3f4f6!important;border-color:#4f8a4b}.kp__btn--clear{grid-column:5;grid-row:2;color:#457c44!important}.kp__btn--clear:active{background:#f3f4f6!important;border-color:#4f8a4b}.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,6 +1,6 @@
1
1
  {
2
2
  "name": "secure-keypad",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
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",