maz-ui 3.43.2 → 3.43.3
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './assets/MazInputCode.css';
|
|
2
|
-
import { defineComponent as N, useCssVars as S, ref as
|
|
3
|
-
const
|
|
2
|
+
import { defineComponent as N, useCssVars as S, ref as V, watch as M, computed as m, openBlock as v, createElementBlock as g, normalizeClass as w, normalizeStyle as P, Fragment as $, renderList as q, createCommentVNode as x, createElementVNode as D, mergeProps as E } from "vue";
|
|
3
|
+
const F = ["disabled"], K = ["inputmode", "pattern", "required", "value", "onInput", "onKeydown", "onClick"], T = /* @__PURE__ */ N({
|
|
4
4
|
inheritAttrs: !1,
|
|
5
5
|
__name: "MazInputCode",
|
|
6
6
|
props: {
|
|
@@ -19,12 +19,12 @@ const E = ["disabled"], F = ["inputmode", "pattern", "required", "value", "onInp
|
|
|
19
19
|
color: { default: "primary" }
|
|
20
20
|
},
|
|
21
21
|
emits: ["update:model-value", "completed"],
|
|
22
|
-
setup(
|
|
22
|
+
setup(i, { emit: f }) {
|
|
23
23
|
S((e) => ({
|
|
24
|
-
"
|
|
24
|
+
"2bcaf79e": C.value
|
|
25
25
|
}));
|
|
26
|
-
const a =
|
|
27
|
-
|
|
26
|
+
const a = i, d = f, u = V([]), l = V(/* @__PURE__ */ new Map());
|
|
27
|
+
M(
|
|
28
28
|
() => a.modelValue,
|
|
29
29
|
(e, t) => {
|
|
30
30
|
e !== t && (l.value = z());
|
|
@@ -34,7 +34,7 @@ const E = ["disabled"], F = ["inputmode", "pattern", "required", "value", "onInp
|
|
|
34
34
|
const p = m({
|
|
35
35
|
get: () => l.value,
|
|
36
36
|
set: (e) => {
|
|
37
|
-
const t =
|
|
37
|
+
const t = L(e);
|
|
38
38
|
d("update:model-value", t), (t == null ? void 0 : t.toString().length) === a.codeLength && d("completed");
|
|
39
39
|
}
|
|
40
40
|
});
|
|
@@ -52,9 +52,9 @@ const E = ["disabled"], F = ["inputmode", "pattern", "required", "value", "onInp
|
|
|
52
52
|
function I(e, t) {
|
|
53
53
|
var n;
|
|
54
54
|
const o = h((n = e.target) == null ? void 0 : n.value);
|
|
55
|
-
p.value = l.value.set(t, o), o &&
|
|
55
|
+
p.value = l.value.set(t, o), o && c(t);
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function L(e) {
|
|
58
58
|
const t = [...e.values()].join("");
|
|
59
59
|
return a.type === "text" ? t : t && !Number.isNaN(Number(t)) ? Number(t) : void 0;
|
|
60
60
|
}
|
|
@@ -64,12 +64,12 @@ const E = ["disabled"], F = ["inputmode", "pattern", "required", "value", "onInp
|
|
|
64
64
|
}
|
|
65
65
|
function B(e, t) {
|
|
66
66
|
const o = l.value.get(t);
|
|
67
|
-
if (e.key === "Backspace" && !o) {
|
|
67
|
+
if (e.key === "ArrowRight" && c(t), e.key === "ArrowLeft" && c(t - 2), e.key === "Backspace" && !o) {
|
|
68
68
|
const n = t - 1 < 0 ? 0 : t - 1;
|
|
69
|
-
p.value = l.value.set(n, void 0),
|
|
69
|
+
p.value = l.value.set(n, void 0), c(n - 1);
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
function
|
|
72
|
+
function A(e) {
|
|
73
73
|
var n;
|
|
74
74
|
const t = (n = e.clipboardData) == null ? void 0 : n.getData("text");
|
|
75
75
|
if (!t)
|
|
@@ -79,44 +79,48 @@ const E = ["disabled"], F = ["inputmode", "pattern", "required", "value", "onInp
|
|
|
79
79
|
value: [...t.toString()][s] ?? void 0
|
|
80
80
|
}));
|
|
81
81
|
for (const { index: r, value: s } of o) {
|
|
82
|
-
const
|
|
83
|
-
|
|
82
|
+
const b = s ? h(s) : void 0;
|
|
83
|
+
b && l.value.set(r, b);
|
|
84
84
|
}
|
|
85
85
|
setTimeout(() => {
|
|
86
86
|
const r = _(), s = r >= a.codeLength ? a.codeLength - 1 : r;
|
|
87
|
-
|
|
87
|
+
c(s, !1);
|
|
88
88
|
}, 0);
|
|
89
89
|
}
|
|
90
90
|
function _() {
|
|
91
91
|
return [...l.value.values()].filter(Boolean).length;
|
|
92
92
|
}
|
|
93
|
-
function
|
|
93
|
+
function c(e, t = !0) {
|
|
94
94
|
setTimeout(() => {
|
|
95
|
-
const o =
|
|
96
|
-
e + 1 > a.codeLength || !o || (o.focus(), t &&
|
|
95
|
+
const o = u.value[e];
|
|
96
|
+
e + 1 > a.codeLength || !o || (o.focus(), t && y(e));
|
|
97
97
|
}, 0);
|
|
98
98
|
}
|
|
99
|
-
|
|
99
|
+
function y(e) {
|
|
100
|
+
const t = u.value[e];
|
|
101
|
+
e + 1 > a.codeLength || !t || t.select();
|
|
102
|
+
}
|
|
103
|
+
const k = m(() => a.error ? "!maz-border-danger" : a.success ? "!maz-border-success" : a.warning ? "!maz-border-warning" : ""), C = m(() => `var(--maz-color-${a.color})`);
|
|
100
104
|
return (e, t) => (v(), g("fieldset", {
|
|
101
|
-
class:
|
|
105
|
+
class: w(["m-input-code", [e.size ? `--${e.size}` : void 0, a.class]]),
|
|
102
106
|
disabled: e.disabled,
|
|
103
|
-
style:
|
|
107
|
+
style: P(e.style)
|
|
104
108
|
}, [
|
|
105
109
|
(v(!0), g(
|
|
106
|
-
|
|
110
|
+
$,
|
|
107
111
|
null,
|
|
108
|
-
|
|
112
|
+
q(e.codeLength, (o) => (v(), g(
|
|
109
113
|
"div",
|
|
110
114
|
{
|
|
111
115
|
key: o,
|
|
112
|
-
class:
|
|
116
|
+
class: w(["input-wrapper", k.value])
|
|
113
117
|
},
|
|
114
118
|
[
|
|
115
|
-
|
|
116
|
-
|
|
119
|
+
x(" eslint-disable-next-line vuejs-accessibility/form-control-has-label "),
|
|
120
|
+
D("input", E({
|
|
117
121
|
ref_for: !0,
|
|
118
122
|
ref: (n) => {
|
|
119
|
-
|
|
123
|
+
u.value[o - 1] = n;
|
|
120
124
|
},
|
|
121
125
|
type: "text",
|
|
122
126
|
minlength: "1",
|
|
@@ -129,8 +133,9 @@ const E = ["disabled"], F = ["inputmode", "pattern", "required", "value", "onInp
|
|
|
129
133
|
value: p.value.get(o),
|
|
130
134
|
onInput: (n) => I(n, o),
|
|
131
135
|
onKeydown: (n) => B(n, o),
|
|
132
|
-
|
|
133
|
-
|
|
136
|
+
onClick: (n) => y(o - 1),
|
|
137
|
+
onPaste: A
|
|
138
|
+
}), null, 16, K)
|
|
134
139
|
],
|
|
135
140
|
2
|
|
136
141
|
/* CLASS */
|
|
@@ -138,14 +143,14 @@ const E = ["disabled"], F = ["inputmode", "pattern", "required", "value", "onInp
|
|
|
138
143
|
128
|
|
139
144
|
/* KEYED_FRAGMENT */
|
|
140
145
|
))
|
|
141
|
-
], 14,
|
|
146
|
+
], 14, F));
|
|
142
147
|
}
|
|
143
|
-
}),
|
|
144
|
-
const a =
|
|
145
|
-
for (const [d,
|
|
146
|
-
a[d] =
|
|
148
|
+
}), j = (i, f) => {
|
|
149
|
+
const a = i.__vccOpts || i;
|
|
150
|
+
for (const [d, u] of f)
|
|
151
|
+
a[d] = u;
|
|
147
152
|
return a;
|
|
148
|
-
},
|
|
153
|
+
}, W = /* @__PURE__ */ j(T, [["__scopeId", "data-v-9c290a78"]]);
|
|
149
154
|
export {
|
|
150
|
-
|
|
155
|
+
W as default
|
|
151
156
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.m-input-code[data-v-
|
|
1
|
+
.m-input-code[data-v-9c290a78]{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;gap:1em;vertical-align:top}.m-input-code.--mini[data-v-9c290a78]{font-size:.625rem;line-height:1rem}.m-input-code.--xs[data-v-9c290a78]{font-size:.75rem;line-height:1rem}.m-input-code.--sm[data-v-9c290a78]{font-size:.875rem;line-height:1.25rem}.m-input-code.--lg[data-v-9c290a78]{font-size:1.125rem;line-height:1.75rem}.m-input-code.--xl[data-v-9c290a78]{font-size:1.25rem;line-height:1.75rem}.m-input-code .input-wrapper[data-v-9c290a78]{position:relative;height:4em;width:4em;overflow:hidden;border-radius:var(--maz-border-radius);border-width:var(--maz-border-width);border-style:solid;border-color:var(--maz-border-color);-webkit-transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;-webkit-transition-duration:.2s;transition-duration:.2s;-webkit-transition-timing-function:cubic-bezier(.4,0,.2,1);transition-timing-function:cubic-bezier(.4,0,.2,1)}.m-input-code .input-wrapper[data-v-9c290a78]:is([class~=dark] *){border-color:var(--maz-color-bg-lighter);background-color:var(--maz-color-bg-light)}.m-input-code .input-wrapper[data-v-9c290a78]:focus-within{border-color:var(--2bcaf79e)}.m-input-code .input-wrapper input[data-v-9c290a78]{height:100%;width:100%;background-color:transparent;text-align:center;font-size:1.5em}.m-input-code .input-wrapper[data-v-9c290a78]:has(input:disabled){background-color:var(--maz-color-bg-lighter);color:var(--maz-color-muted)}.m-input-code .input-wrapper:has(input:disabled) input[data-v-9c290a78]{cursor:not-allowed;color:var(--maz-color-muted)}
|
package/nuxt/index.json
CHANGED