maz-ui 3.28.8 → 3.29.0

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.
@@ -0,0 +1,153 @@
1
+ import { type PropType } from 'vue';
2
+ import type { Color } from './types';
3
+ export type { Color } from './types';
4
+ declare const _default: import("vue").DefineComponent<{
5
+ style: {
6
+ type: PropType<import("vue").StyleValue>;
7
+ default: undefined;
8
+ };
9
+ class: {
10
+ type: PropType<any>;
11
+ default: undefined;
12
+ };
13
+ /** Is v-model */
14
+ modelValue: {
15
+ type: PropType<string | number>;
16
+ default: undefined;
17
+ };
18
+ /** Choose the length of the code */
19
+ codeLength: {
20
+ type: NumberConstructor;
21
+ default: number;
22
+ };
23
+ /** Is the returned type (number works only when accept-alpha is not enable) */
24
+ type: {
25
+ type: PropType<"number" | "text">;
26
+ default: string;
27
+ };
28
+ /** Turn it to true to accept alpha charac */
29
+ acceptAlpha: {
30
+ type: BooleanConstructor;
31
+ default: boolean;
32
+ };
33
+ /** make inputs required */
34
+ required: {
35
+ type: BooleanConstructor;
36
+ default: boolean;
37
+ };
38
+ /** make inputs required */
39
+ disabled: {
40
+ type: BooleanConstructor;
41
+ default: boolean;
42
+ };
43
+ /** When is `true` the input has the error style (danger color) */
44
+ error: {
45
+ type: BooleanConstructor;
46
+ default: boolean;
47
+ };
48
+ /** When is `true` the input has the success style (success color) */
49
+ success: {
50
+ type: BooleanConstructor;
51
+ default: boolean;
52
+ };
53
+ /** When is `true` the input has the warning style (warning color) */
54
+ warning: {
55
+ type: BooleanConstructor;
56
+ default: boolean;
57
+ };
58
+ /** Predefined size of component */
59
+ size: {
60
+ type: PropType<"sm" | "md" | "lg">;
61
+ default: string;
62
+ };
63
+ /** Color of component */
64
+ color: {
65
+ type: PropType<Color>;
66
+ default: string;
67
+ };
68
+ }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
69
+ "update:model-value": (...args: any[]) => void;
70
+ completed: (...args: any[]) => void;
71
+ }, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
72
+ style: {
73
+ type: PropType<import("vue").StyleValue>;
74
+ default: undefined;
75
+ };
76
+ class: {
77
+ type: PropType<any>;
78
+ default: undefined;
79
+ };
80
+ /** Is v-model */
81
+ modelValue: {
82
+ type: PropType<string | number>;
83
+ default: undefined;
84
+ };
85
+ /** Choose the length of the code */
86
+ codeLength: {
87
+ type: NumberConstructor;
88
+ default: number;
89
+ };
90
+ /** Is the returned type (number works only when accept-alpha is not enable) */
91
+ type: {
92
+ type: PropType<"number" | "text">;
93
+ default: string;
94
+ };
95
+ /** Turn it to true to accept alpha charac */
96
+ acceptAlpha: {
97
+ type: BooleanConstructor;
98
+ default: boolean;
99
+ };
100
+ /** make inputs required */
101
+ required: {
102
+ type: BooleanConstructor;
103
+ default: boolean;
104
+ };
105
+ /** make inputs required */
106
+ disabled: {
107
+ type: BooleanConstructor;
108
+ default: boolean;
109
+ };
110
+ /** When is `true` the input has the error style (danger color) */
111
+ error: {
112
+ type: BooleanConstructor;
113
+ default: boolean;
114
+ };
115
+ /** When is `true` the input has the success style (success color) */
116
+ success: {
117
+ type: BooleanConstructor;
118
+ default: boolean;
119
+ };
120
+ /** When is `true` the input has the warning style (warning color) */
121
+ warning: {
122
+ type: BooleanConstructor;
123
+ default: boolean;
124
+ };
125
+ /** Predefined size of component */
126
+ size: {
127
+ type: PropType<"sm" | "md" | "lg">;
128
+ default: string;
129
+ };
130
+ /** Color of component */
131
+ color: {
132
+ type: PropType<Color>;
133
+ default: string;
134
+ };
135
+ }>> & {
136
+ "onUpdate:model-value"?: ((...args: any[]) => any) | undefined;
137
+ onCompleted?: ((...args: any[]) => any) | undefined;
138
+ }, {
139
+ success: boolean;
140
+ warning: boolean;
141
+ size: "sm" | "md" | "lg";
142
+ color: Color;
143
+ type: "number" | "text";
144
+ style: import("vue").StyleValue;
145
+ class: any;
146
+ disabled: boolean;
147
+ required: boolean;
148
+ error: boolean;
149
+ modelValue: string | number;
150
+ codeLength: number;
151
+ acceptAlpha: boolean;
152
+ }, {}>;
153
+ export default _default;
@@ -0,0 +1,189 @@
1
+ import "./assets/MazInputCode.css";
2
+ import { defineComponent as N, useCssVars as C, ref as b, watch as k, computed as m, openBlock as g, createElementBlock as v, normalizeClass as V, normalizeStyle as M, Fragment as P, renderList as j, createCommentVNode as q, createElementVNode as O, mergeProps as $ } from "vue";
3
+ const D = ["disabled"], E = ["inputmode", "pattern", "required", "value", "onInput", "onKeydown"], F = /* @__PURE__ */ N({
4
+ inheritAttrs: !1,
5
+ __name: "MazInputCode",
6
+ props: {
7
+ style: {
8
+ type: [String, Array, Object],
9
+ default: void 0
10
+ },
11
+ class: {
12
+ type: [String, Array, Object],
13
+ default: void 0
14
+ },
15
+ /** Is v-model */
16
+ modelValue: {
17
+ type: [String, Number],
18
+ default: void 0
19
+ },
20
+ /** Choose the length of the code */
21
+ codeLength: { type: Number, default: 4 },
22
+ /** Is the returned type (number works only when accept-alpha is not enable) */
23
+ type: {
24
+ type: String,
25
+ default: "text"
26
+ },
27
+ /** Turn it to true to accept alpha charac */
28
+ acceptAlpha: { type: Boolean, default: !1 },
29
+ /** make inputs required */
30
+ required: { type: Boolean, default: !1 },
31
+ /** make inputs required */
32
+ disabled: { type: Boolean, default: !1 },
33
+ /** When is `true` the input has the error style (danger color) */
34
+ error: { type: Boolean, default: !1 },
35
+ /** When is `true` the input has the success style (success color) */
36
+ success: { type: Boolean, default: !1 },
37
+ /** When is `true` the input has the warning style (warning color) */
38
+ warning: { type: Boolean, default: !1 },
39
+ /** Predefined size of component */
40
+ size: {
41
+ type: String,
42
+ default: "md"
43
+ },
44
+ /** Color of component */
45
+ color: {
46
+ type: String,
47
+ default: "primary"
48
+ }
49
+ },
50
+ emits: [
51
+ /**
52
+ * update the model
53
+ */
54
+ "update:model-value",
55
+ /**
56
+ * Emitted when all inputs are set.
57
+ */
58
+ "completed"
59
+ ],
60
+ setup(l, { emit: d }) {
61
+ C((t) => ({
62
+ "6bdbc0e0": L.value
63
+ }));
64
+ const a = l, c = d, i = b([]), r = b(/* @__PURE__ */ new Map());
65
+ k(
66
+ () => a.modelValue,
67
+ (t, e) => {
68
+ t !== e && (r.value = x());
69
+ },
70
+ { immediate: !0 }
71
+ );
72
+ const f = m({
73
+ get: () => r.value,
74
+ set: (t) => {
75
+ const e = I(t);
76
+ c("update:model-value", e), (e == null ? void 0 : e.toString().length) === a.codeLength && c("completed");
77
+ }
78
+ });
79
+ function x(t = a.modelValue) {
80
+ const e = /* @__PURE__ */ new Map();
81
+ for (const n of Array.from({ length: a.codeLength }, (o, u) => u))
82
+ if (t === void 0)
83
+ e.set(n + 1, void 0);
84
+ else {
85
+ const o = [...t.toString()];
86
+ e.set(n + 1, o[n]);
87
+ }
88
+ return e;
89
+ }
90
+ function z(t, e) {
91
+ var o;
92
+ const n = y((o = t.target) == null ? void 0 : o.value);
93
+ f.value = r.value.set(e, n), n && p(e);
94
+ }
95
+ function I(t) {
96
+ const e = [...t.values()].join("");
97
+ return a.type === "text" ? e : e && !Number.isNaN(Number(e)) ? Number(e) : void 0;
98
+ }
99
+ function y(t) {
100
+ var e;
101
+ return (e = a.acceptAlpha ? t.match(/^[\w.]$/i) : t.match(/\d+/g)) == null ? void 0 : e.toString();
102
+ }
103
+ function S(t, e) {
104
+ const n = r.value.get(e);
105
+ if (t.key === "Backspace" && !n) {
106
+ const o = e - 1 < 0 ? 0 : e - 1;
107
+ f.value = r.value.set(o, void 0), p(o - 1);
108
+ }
109
+ }
110
+ function w(t) {
111
+ var o;
112
+ const e = (o = t.clipboardData) == null ? void 0 : o.getData("text");
113
+ if (!e)
114
+ return;
115
+ const n = Array.from({ length: a.codeLength }, (u, s) => ({
116
+ index: s + 1,
117
+ value: [...e.toString()][s] ?? void 0
118
+ }));
119
+ for (const { index: u, value: s } of n) {
120
+ const h = s ? y(s) : void 0;
121
+ h && r.value.set(u, h);
122
+ }
123
+ setTimeout(() => {
124
+ const u = A(), s = u >= a.codeLength ? a.codeLength - 1 : u;
125
+ p(s, !1);
126
+ }, 0);
127
+ }
128
+ function A() {
129
+ return [...r.value.values()].filter(Boolean).length;
130
+ }
131
+ function p(t, e = !0) {
132
+ setTimeout(() => {
133
+ const n = i.value[t];
134
+ t + 1 > a.codeLength || !n || (n.focus(), e && n.select());
135
+ }, 0);
136
+ }
137
+ const B = m(() => a.error ? "!maz-border-danger" : a.success ? "!maz-border-success" : a.warning ? "!maz-border-warning" : ""), L = m(() => `var(--maz-color-${a.color})`);
138
+ return (t, e) => (g(), v("fieldset", {
139
+ class: V(["m-input-code", [l.size ? `--${l.size}` : void 0]]),
140
+ disabled: l.disabled,
141
+ style: M(l.style)
142
+ }, [
143
+ (g(!0), v(
144
+ P,
145
+ null,
146
+ j(l.codeLength, (n) => (g(), v(
147
+ "div",
148
+ {
149
+ key: n,
150
+ class: V(["input-wrapper", B.value])
151
+ },
152
+ [
153
+ q(" eslint-disable-next-line vuejs-accessibility/form-control-has-label "),
154
+ O("input", $({
155
+ ref_for: !0,
156
+ ref: (o) => {
157
+ i.value[n - 1] = o;
158
+ },
159
+ type: "text",
160
+ minlength: "1",
161
+ maxlength: "1",
162
+ inputmode: l.acceptAlpha ? "text" : "numeric",
163
+ pattern: l.acceptAlpha ? "[a-zA-Z0-9]{1}" : "[0-9]{1}",
164
+ autocomplete: "do-not-autofill",
165
+ required: l.required
166
+ }, t.$attrs, {
167
+ value: f.value.get(n),
168
+ onInput: (o) => z(o, n),
169
+ onKeydown: (o) => S(o, n),
170
+ onPaste: w
171
+ }), null, 16, E)
172
+ ],
173
+ 2
174
+ /* CLASS */
175
+ ))),
176
+ 128
177
+ /* KEYED_FRAGMENT */
178
+ ))
179
+ ], 14, D));
180
+ }
181
+ }), K = (l, d) => {
182
+ const a = l.__vccOpts || l;
183
+ for (const [c, i] of d)
184
+ a[c] = i;
185
+ return a;
186
+ }, W = /* @__PURE__ */ K(F, [["__scopeId", "data-v-4e98f6f7"]]);
187
+ export {
188
+ W as default
189
+ };
@@ -1,4 +1,4 @@
1
- import { M as f } from "./chunks/MazInputTags-kDTfYnsu.mjs";
1
+ import { M as f } from "./chunks/MazInputTags-NVpcRBJU.mjs";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -17,7 +17,7 @@ const j = ["disabled", "onClick"], U = /* @__PURE__ */ $({
17
17
  },
18
18
  setup(a) {
19
19
  const { currentTab: t, updateCurrentTab: o } = R("maz-tabs");
20
- function u(e) {
20
+ function c(e) {
21
21
  o(e), n.persistent && z(e);
22
22
  }
23
23
  const n = a, _ = b(), p = b([]);
@@ -27,7 +27,7 @@ const j = ["disabled", "onClick"], U = /* @__PURE__ */ $({
27
27
  }) {
28
28
  p.value[r] = e && "$el" in e ? e.$el : e;
29
29
  }
30
- const c = y(
30
+ const u = y(
31
31
  () => n.items.map((e) => ({
32
32
  label: typeof e == "string" ? e : e.label,
33
33
  disabled: typeof e == "string" ? !1 : e.disabled ?? !1
@@ -46,8 +46,8 @@ const j = ["disabled", "onClick"], U = /* @__PURE__ */ $({
46
46
  return r ? {} : t.value === e ? "color: var(--maz-color-text)" : "color: var(--maz-color-muted)";
47
47
  }
48
48
  B(() => {
49
- (t.value < 1 || t.value > c.value.length) && console.error(
50
- `[maz-ui](MazTabsBar) The model-value should be between 1 and ${c.value.length}`
49
+ (t.value < 1 || t.value > u.value.length) && console.error(
50
+ `[maz-ui](MazTabsBar) The model-value should be between 1 and ${u.value.length}`
51
51
  );
52
52
  });
53
53
  function S() {
@@ -59,7 +59,7 @@ const j = ["disabled", "onClick"], U = /* @__PURE__ */ $({
59
59
  r.searchParams.set(n.queryParam, String(e)), window.history.replaceState({}, document.title, r.toString());
60
60
  }
61
61
  return M(async () => {
62
- n.persistent && o(S() ?? t.value ?? 1);
62
+ n.persistent && o(S() || t.value || 1);
63
63
  }), (e, r) => (f(), d(
64
64
  "div",
65
65
  {
@@ -83,14 +83,14 @@ const j = ["disabled", "onClick"], U = /* @__PURE__ */ $({
83
83
  (f(!0), d(
84
84
  C,
85
85
  null,
86
- q(c.value, ({ label: i, disabled: l }, s) => (f(), d("button", {
86
+ q(u.value, ({ label: i, disabled: l }, s) => (f(), d("button", {
87
87
  key: s,
88
88
  ref_for: !0,
89
89
  ref: (m) => g({ mazBtn: m, index: s }),
90
90
  class: v([{ "--active": E(t) === s, "--disabled": l }, "m-tabs-bar__item"]),
91
91
  disabled: l,
92
92
  style: h(w(s + 1, l)),
93
- onClick: (m) => l ? void 0 : u(s + 1)
93
+ onClick: (m) => l ? void 0 : c(s + 1)
94
94
  }, L(i), 15, j))),
95
95
  128
96
96
  /* KEYED_FRAGMENT */
@@ -102,10 +102,10 @@ const j = ["disabled", "onClick"], U = /* @__PURE__ */ $({
102
102
  }
103
103
  }), V = (a, t) => {
104
104
  const o = a.__vccOpts || a;
105
- for (const [u, n] of t)
106
- o[u] = n;
105
+ for (const [c, n] of t)
106
+ o[c] = n;
107
107
  return o;
108
- }, H = /* @__PURE__ */ V(U, [["__scopeId", "data-v-3fd30089"]]);
108
+ }, H = /* @__PURE__ */ V(U, [["__scopeId", "data-v-25e7a5dc"]]);
109
109
  export {
110
110
  H as default
111
111
  };