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 b, watch as x, computed as m, openBlock as v, createElementBlock as g, normalizeClass as V, normalizeStyle as k, Fragment as M, renderList as P, createCommentVNode as q, createElementVNode as $, mergeProps as D } from "vue";
3
- const E = ["disabled"], F = ["inputmode", "pattern", "required", "value", "onInput", "onKeydown"], K = /* @__PURE__ */ N({
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(u, { emit: i }) {
22
+ setup(i, { emit: f }) {
23
23
  S((e) => ({
24
- "29dc0bd8": C.value
24
+ "2bcaf79e": C.value
25
25
  }));
26
- const a = u, d = i, c = b([]), l = b(/* @__PURE__ */ new Map());
27
- x(
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 = w(e);
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 && f(t);
55
+ p.value = l.value.set(t, o), o && c(t);
56
56
  }
57
- function w(e) {
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), f(n - 1);
69
+ p.value = l.value.set(n, void 0), c(n - 1);
70
70
  }
71
71
  }
72
- function L(e) {
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 y = s ? h(s) : void 0;
83
- y && l.value.set(r, y);
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
- f(s, !1);
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 f(e, t = !0) {
93
+ function c(e, t = !0) {
94
94
  setTimeout(() => {
95
- const o = c.value[e];
96
- e + 1 > a.codeLength || !o || (o.focus(), t && o.select());
95
+ const o = u.value[e];
96
+ e + 1 > a.codeLength || !o || (o.focus(), t && y(e));
97
97
  }, 0);
98
98
  }
99
- const A = m(() => a.error ? "!maz-border-danger" : a.success ? "!maz-border-success" : a.warning ? "!maz-border-warning" : ""), C = m(() => `var(--maz-color-${a.color})`);
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: V(["m-input-code", [e.size ? `--${e.size}` : void 0, a.class]]),
105
+ class: w(["m-input-code", [e.size ? `--${e.size}` : void 0, a.class]]),
102
106
  disabled: e.disabled,
103
- style: k(e.style)
107
+ style: P(e.style)
104
108
  }, [
105
109
  (v(!0), g(
106
- M,
110
+ $,
107
111
  null,
108
- P(e.codeLength, (o) => (v(), g(
112
+ q(e.codeLength, (o) => (v(), g(
109
113
  "div",
110
114
  {
111
115
  key: o,
112
- class: V(["input-wrapper", A.value])
116
+ class: w(["input-wrapper", k.value])
113
117
  },
114
118
  [
115
- q(" eslint-disable-next-line vuejs-accessibility/form-control-has-label "),
116
- $("input", D({
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
- c.value[o - 1] = n;
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
- onPaste: L
133
- }), null, 16, F)
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, E));
146
+ ], 14, F));
142
147
  }
143
- }), T = (u, i) => {
144
- const a = u.__vccOpts || u;
145
- for (const [d, c] of i)
146
- a[d] = c;
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
- }, O = /* @__PURE__ */ T(K, [["__scopeId", "data-v-ee4bab42"]]);
153
+ }, W = /* @__PURE__ */ j(T, [["__scopeId", "data-v-9c290a78"]]);
149
154
  export {
150
- O as default
155
+ W as default
151
156
  };
@@ -1 +1 @@
1
- .m-input-code[data-v-ee4bab42]{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;gap:1em;vertical-align:top}.m-input-code.--mini[data-v-ee4bab42]{font-size:.625rem;line-height:1rem}.m-input-code.--xs[data-v-ee4bab42]{font-size:.75rem;line-height:1rem}.m-input-code.--sm[data-v-ee4bab42]{font-size:.875rem;line-height:1.25rem}.m-input-code.--lg[data-v-ee4bab42]{font-size:1.125rem;line-height:1.75rem}.m-input-code.--xl[data-v-ee4bab42]{font-size:1.25rem;line-height:1.75rem}.m-input-code .input-wrapper[data-v-ee4bab42]{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-ee4bab42]:is([class~=dark] *){border-color:var(--maz-color-bg-lighter);background-color:var(--maz-color-bg-light)}.m-input-code .input-wrapper[data-v-ee4bab42]:focus-within{border-color:var(--29dc0bd8)}.m-input-code .input-wrapper input[data-v-ee4bab42]{height:100%;width:100%;background-color:transparent;text-align:center;font-size:1.5em}.m-input-code .input-wrapper[data-v-ee4bab42]: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-ee4bab42]{cursor:not-allowed;color:var(--maz-color-muted)}
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
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^3.0.0"
6
6
  },
7
- "version": "3.43.2",
7
+ "version": "3.43.3",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "0.6.0",
10
10
  "unbuild": "2.0.0"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maz-ui",
3
- "version": "3.43.2",
3
+ "version": "3.43.3",
4
4
  "description": "A standalone components library for Vue.Js 3 & Nuxt.Js 3",
5
5
  "author": "Louis Mazel <me@loicmazuel.com>",
6
6
  "main": "./modules/index.cjs",