vlite3 1.0.1 → 1.0.2
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/components/Badge.vue.js +1 -1
- package/components/Clock/Clock.vue.d.ts +33 -0
- package/components/Clock/Clock.vue.js +51 -0
- package/components/Clock/Clock.vue2.js +4 -0
- package/components/Clock/index.d.ts +1 -0
- package/components/OTPInput/OTPInput.vue.d.ts +4 -0
- package/components/OTPInput/OTPInput.vue.js +71 -59
- package/index.d.ts +1 -0
- package/index.js +7 -5
- package/package.json +1 -1
package/components/Badge.vue.js
CHANGED
|
@@ -10,7 +10,7 @@ const p = /* @__PURE__ */ b({
|
|
|
10
10
|
setup(o) {
|
|
11
11
|
const e = o, s = a(() => {
|
|
12
12
|
const r = {
|
|
13
|
-
xs: "px-1.5 h-
|
|
13
|
+
xs: "px-1.5 h-4 text-[9px] leading-none",
|
|
14
14
|
sm: "px-2 h-6 text-xs font-medium",
|
|
15
15
|
md: "px-2.5 h-7 text-xs font-semibold",
|
|
16
16
|
lg: "px-3 h-8 text-sm font-semibold"
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
/** dayjs-compatible format string for the time portion. Default: 'hh:mm:ss A' */
|
|
3
|
+
timeFormat?: string;
|
|
4
|
+
/** dayjs-compatible format string for the date portion. Default: 'dddd, MMMM D, YYYY' */
|
|
5
|
+
dateFormat?: string;
|
|
6
|
+
/** Whether to render the time heading. Default: true */
|
|
7
|
+
showTime?: boolean;
|
|
8
|
+
/** Whether to render the date paragraph. Default: true */
|
|
9
|
+
showDate?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Milliseconds between each clock tick.
|
|
12
|
+
* Reactive — changing this prop will immediately restart the interval.
|
|
13
|
+
* Default: 1000
|
|
14
|
+
*/
|
|
15
|
+
tickInterval?: number;
|
|
16
|
+
/** Additional Tailwind/CSS classes applied to the time <h2> element */
|
|
17
|
+
timeClass?: string;
|
|
18
|
+
/** Additional Tailwind/CSS classes applied to the date <p> element */
|
|
19
|
+
dateClass?: string;
|
|
20
|
+
/** Additional Tailwind/CSS classes applied to the root wrapper <div> */
|
|
21
|
+
wrapperClass?: string;
|
|
22
|
+
};
|
|
23
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
24
|
+
wrapperClass: string;
|
|
25
|
+
timeFormat: string;
|
|
26
|
+
dateFormat: string;
|
|
27
|
+
showTime: boolean;
|
|
28
|
+
showDate: boolean;
|
|
29
|
+
tickInterval: number;
|
|
30
|
+
timeClass: string;
|
|
31
|
+
dateClass: string;
|
|
32
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
33
|
+
export default _default;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { defineComponent as h, ref as w, watch as x, onMounted as k, onUnmounted as C, computed as i, openBlock as r, createElementBlock as n, normalizeClass as s, toDisplayString as d, createCommentVNode as u } from "vue";
|
|
2
|
+
import c from "dayjs";
|
|
3
|
+
const D = /* @__PURE__ */ h({
|
|
4
|
+
__name: "Clock",
|
|
5
|
+
props: {
|
|
6
|
+
timeFormat: { default: "hh:mm:ss A" },
|
|
7
|
+
dateFormat: { default: "dddd, MMMM D, YYYY" },
|
|
8
|
+
showTime: { type: Boolean, default: !0 },
|
|
9
|
+
showDate: { type: Boolean, default: !0 },
|
|
10
|
+
tickInterval: { default: 1e3 },
|
|
11
|
+
timeClass: { default: "" },
|
|
12
|
+
dateClass: { default: "" },
|
|
13
|
+
wrapperClass: { default: "" }
|
|
14
|
+
},
|
|
15
|
+
setup(t) {
|
|
16
|
+
const a = t, o = w(/* @__PURE__ */ new Date());
|
|
17
|
+
let e;
|
|
18
|
+
function m(l) {
|
|
19
|
+
e !== void 0 && clearInterval(e), e = setInterval(() => {
|
|
20
|
+
o.value = /* @__PURE__ */ new Date();
|
|
21
|
+
}, l);
|
|
22
|
+
}
|
|
23
|
+
x(
|
|
24
|
+
() => a.tickInterval,
|
|
25
|
+
(l) => {
|
|
26
|
+
m(l);
|
|
27
|
+
}
|
|
28
|
+
), k(() => {
|
|
29
|
+
m(a.tickInterval);
|
|
30
|
+
}), C(() => {
|
|
31
|
+
e !== void 0 && clearInterval(e);
|
|
32
|
+
});
|
|
33
|
+
const f = i(() => c(o.value).format(a.timeFormat)), v = i(() => c(o.value).format(a.dateFormat));
|
|
34
|
+
return (l, p) => (r(), n("div", {
|
|
35
|
+
class: s(["flex flex-col items-center z-10 w-full", t.wrapperClass]),
|
|
36
|
+
style: { "will-change": "transform", contain: "layout style" }
|
|
37
|
+
}, [
|
|
38
|
+
t.showTime ? (r(), n("h2", {
|
|
39
|
+
key: 0,
|
|
40
|
+
class: s(["text-5xl md:text-6xl font-extralight text-foreground tracking-tight tabular-nums", t.timeClass])
|
|
41
|
+
}, d(f.value), 3)) : u("", !0),
|
|
42
|
+
t.showDate ? (r(), n("p", {
|
|
43
|
+
key: 1,
|
|
44
|
+
class: s(["text-fs-1 font-normal text-muted-foreground mt-3.5 tracking-wide", t.dateClass])
|
|
45
|
+
}, d(v.value), 3)) : u("", !0)
|
|
46
|
+
], 2));
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
export {
|
|
50
|
+
D as default
|
|
51
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Clock } from './Clock.vue';
|
|
@@ -9,6 +9,8 @@ interface Props {
|
|
|
9
9
|
variant?: 'solid' | 'outline' | 'ghost';
|
|
10
10
|
attached?: boolean;
|
|
11
11
|
size?: 'sm' | 'md' | 'lg';
|
|
12
|
+
mask?: boolean;
|
|
13
|
+
fluid?: boolean;
|
|
12
14
|
}
|
|
13
15
|
declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
14
16
|
change: (value: string) => any;
|
|
@@ -21,6 +23,7 @@ declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, imp
|
|
|
21
23
|
}>, {
|
|
22
24
|
length: number;
|
|
23
25
|
type: "text" | "number";
|
|
26
|
+
mask: boolean;
|
|
24
27
|
variant: "solid" | "outline" | "ghost";
|
|
25
28
|
size: "sm" | "md" | "lg";
|
|
26
29
|
error: boolean;
|
|
@@ -29,5 +32,6 @@ declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, imp
|
|
|
29
32
|
modelValue: string;
|
|
30
33
|
autofocus: boolean;
|
|
31
34
|
attached: boolean;
|
|
35
|
+
fluid: boolean;
|
|
32
36
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
|
|
33
37
|
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
const
|
|
1
|
+
import { defineComponent as C, ref as v, watch as M, onMounted as V, nextTick as A, computed as m, openBlock as g, createElementBlock as h, normalizeClass as y, Fragment as E, renderList as F } from "vue";
|
|
2
|
+
const K = ["value", "type", "inputmode", "disabled", "placeholder", "onInput", "onKeydown"], T = /* @__PURE__ */ C({
|
|
3
3
|
__name: "OTPInput",
|
|
4
4
|
props: {
|
|
5
5
|
length: { default: 6 },
|
|
@@ -11,29 +11,31 @@ const F = ["value", "type", "disabled", "placeholder", "onInput", "onKeydown"],
|
|
|
11
11
|
placeholder: { default: "" },
|
|
12
12
|
variant: { default: "outline" },
|
|
13
13
|
attached: { type: Boolean, default: !1 },
|
|
14
|
-
size: { default: "md" }
|
|
14
|
+
size: { default: "md" },
|
|
15
|
+
mask: { type: Boolean, default: !1 },
|
|
16
|
+
fluid: { type: Boolean, default: !1 }
|
|
15
17
|
},
|
|
16
18
|
emits: ["update:modelValue", "complete", "change"],
|
|
17
|
-
setup(
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
() =>
|
|
21
|
-
(
|
|
22
|
-
const e =
|
|
19
|
+
setup(d, { emit: b }) {
|
|
20
|
+
const t = d, p = b, s = v([]), r = v(new Array(t.length).fill(""));
|
|
21
|
+
M(
|
|
22
|
+
() => t.modelValue,
|
|
23
|
+
(l) => {
|
|
24
|
+
const e = l || "", a = e.split("").slice(0, t.length);
|
|
23
25
|
if (r.value.join("") !== e) {
|
|
24
|
-
const o = new Array(
|
|
25
|
-
|
|
26
|
+
const o = new Array(t.length).fill("");
|
|
27
|
+
a.forEach((u, i) => o[i] = u), r.value = o;
|
|
26
28
|
}
|
|
27
29
|
},
|
|
28
30
|
{ immediate: !0 }
|
|
29
31
|
);
|
|
30
32
|
const c = () => {
|
|
31
|
-
const
|
|
32
|
-
p("update:modelValue",
|
|
33
|
-
},
|
|
34
|
-
let n =
|
|
35
|
-
if (
|
|
36
|
-
r.value[e] = n, c(), e <
|
|
33
|
+
const l = r.value.join("");
|
|
34
|
+
p("update:modelValue", l), p("change", l), l.length === t.length && p("complete", l);
|
|
35
|
+
}, w = (l, e) => {
|
|
36
|
+
let n = l.target.value;
|
|
37
|
+
if (t.type === "number" && (n = n.replace(/\D/g, "")), n.length === 1) {
|
|
38
|
+
r.value[e] = n, c(), e < t.length - 1 && s.value[e + 1]?.focus();
|
|
37
39
|
return;
|
|
38
40
|
}
|
|
39
41
|
if (!n) {
|
|
@@ -41,75 +43,85 @@ const F = ["value", "type", "disabled", "placeholder", "onInput", "onKeydown"],
|
|
|
41
43
|
return;
|
|
42
44
|
}
|
|
43
45
|
if (n.length > 1) {
|
|
44
|
-
const o = n.split("").slice(0,
|
|
45
|
-
o.forEach((i,
|
|
46
|
-
e +
|
|
46
|
+
const o = n.split("").slice(0, t.length - e);
|
|
47
|
+
o.forEach((i, f) => {
|
|
48
|
+
e + f < t.length && (r.value[e + f] = i);
|
|
47
49
|
}), c();
|
|
48
|
-
const u = Math.min(e + o.length,
|
|
50
|
+
const u = Math.min(e + o.length, t.length - 1);
|
|
49
51
|
s.value[u]?.focus();
|
|
50
52
|
}
|
|
51
|
-
},
|
|
52
|
-
const
|
|
53
|
-
if (
|
|
54
|
-
r.value[e] || (
|
|
53
|
+
}, D = (l, e) => {
|
|
54
|
+
const a = l.key;
|
|
55
|
+
if (a === "Backspace") {
|
|
56
|
+
r.value[e] || (l.preventDefault(), e > 0 && (r.value[e - 1] = "", s.value[e - 1]?.focus(), c()));
|
|
55
57
|
return;
|
|
56
58
|
}
|
|
57
|
-
|
|
58
|
-
},
|
|
59
|
-
|
|
60
|
-
const e =
|
|
59
|
+
a === "ArrowLeft" && (l.preventDefault(), e > 0 && s.value[e - 1]?.focus()), a === "ArrowRight" && (l.preventDefault(), e < t.length - 1 && s.value[e + 1]?.focus());
|
|
60
|
+
}, k = (l) => {
|
|
61
|
+
l.preventDefault();
|
|
62
|
+
const e = l.clipboardData?.getData("text/plain");
|
|
61
63
|
if (!e) return;
|
|
62
|
-
let
|
|
63
|
-
|
|
64
|
-
const n =
|
|
65
|
-
n.forEach((i,
|
|
66
|
-
o[
|
|
64
|
+
let a = e.trim();
|
|
65
|
+
t.type === "number" && (a = a.replace(/\D/g, ""));
|
|
66
|
+
const n = a.split("").slice(0, t.length), o = [...r.value];
|
|
67
|
+
n.forEach((i, f) => {
|
|
68
|
+
o[f] = i;
|
|
67
69
|
}), r.value = o, c();
|
|
68
|
-
const u = Math.min(n.length,
|
|
70
|
+
const u = Math.min(n.length, t.length - 1);
|
|
69
71
|
s.value[u]?.focus();
|
|
70
|
-
},
|
|
71
|
-
|
|
72
|
+
}, B = (l, e) => {
|
|
73
|
+
l && (s.value[e] = l);
|
|
72
74
|
};
|
|
73
|
-
|
|
74
|
-
|
|
75
|
+
V(() => {
|
|
76
|
+
t.autofocus && A(() => {
|
|
75
77
|
s.value[0]?.focus();
|
|
76
78
|
});
|
|
77
79
|
});
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
+
const I = m(() => t.mask ? "password" : t.type === "number" ? "tel" : "text"), j = m(() => {
|
|
81
|
+
if (!t.mask)
|
|
82
|
+
return t.type === "number" ? "numeric" : void 0;
|
|
83
|
+
}), x = m(() => {
|
|
84
|
+
const l = t.attached ? "-space-x-px" : "gap-2", e = t.fluid ? "w-full" : "";
|
|
85
|
+
return ["flex items-center", l, e].filter(Boolean).join(" ");
|
|
86
|
+
}), z = (l) => {
|
|
87
|
+
const e = "text-center font-medium transition-all focus:outline-none focus:z-10 disabled:opacity-50 disabled:cursor-not-allowed placeholder:text-muted-foreground", a = t.fluid ? {
|
|
88
|
+
sm: "flex-1 min-w-0 h-8 text-sm",
|
|
89
|
+
md: "flex-1 min-w-0 h-10 text-lg",
|
|
90
|
+
lg: "flex-1 min-w-0 h-12 text-xl"
|
|
91
|
+
} : {
|
|
80
92
|
sm: "w-8 h-8 text-sm",
|
|
81
93
|
md: "w-10 h-10 text-lg",
|
|
82
94
|
lg: "w-12 h-12 text-xl"
|
|
83
95
|
}, n = {
|
|
84
96
|
solid: "bg-muted border border-transparent focus:border-primary focus:ring-2 focus:ring-primary",
|
|
85
97
|
outline: "border border-input focus:border-primary focus:ring-2 focus:ring-primary",
|
|
86
|
-
ghost: "bg-transparent border border-transparent hover:bg-accent focus:
|
|
87
|
-
}, o =
|
|
98
|
+
ghost: "bg-transparent border border-transparent hover:bg-accent focus:border-primary focus:ring-2 focus:ring-primary"
|
|
99
|
+
}, o = t.error ? "border-destructive focus:ring-destructive text-destructive" : "";
|
|
88
100
|
let u = "rounded-md";
|
|
89
|
-
return
|
|
101
|
+
return t.attached && (l === 0 ? u = "rounded-l-md rounded-r-none" : l === t.length - 1 ? u = "rounded-r-md rounded-l-none" : u = "rounded-none"), [e, a[t.size], n[t.variant], o, u].join(" ");
|
|
90
102
|
};
|
|
91
|
-
return (
|
|
92
|
-
class:
|
|
103
|
+
return (l, e) => (g(), h("div", {
|
|
104
|
+
class: y(x.value)
|
|
93
105
|
}, [
|
|
94
|
-
(g(!0),
|
|
106
|
+
(g(!0), h(E, null, F(t.length, (a, n) => (g(), h("input", {
|
|
95
107
|
key: n,
|
|
96
108
|
ref_for: !0,
|
|
97
|
-
ref: (o) =>
|
|
109
|
+
ref: (o) => B(o, n),
|
|
98
110
|
value: r.value[n],
|
|
99
|
-
type:
|
|
100
|
-
inputmode:
|
|
111
|
+
type: I.value,
|
|
112
|
+
inputmode: j.value,
|
|
101
113
|
maxlength: 1,
|
|
102
|
-
disabled:
|
|
103
|
-
placeholder:
|
|
104
|
-
class:
|
|
105
|
-
onInput: (o) =>
|
|
106
|
-
onKeydown: (o) =>
|
|
107
|
-
onPaste:
|
|
108
|
-
onFocus: e[0] || (e[0] = (o) =>
|
|
109
|
-
}, null, 42,
|
|
114
|
+
disabled: d.disabled,
|
|
115
|
+
placeholder: d.placeholder,
|
|
116
|
+
class: y(z(n)),
|
|
117
|
+
onInput: (o) => w(o, n),
|
|
118
|
+
onKeydown: (o) => D(o, n),
|
|
119
|
+
onPaste: k,
|
|
120
|
+
onFocus: e[0] || (e[0] = (o) => l.$emit("update:modelValue", r.value.join("")))
|
|
121
|
+
}, null, 42, K))), 128))
|
|
110
122
|
], 2));
|
|
111
123
|
}
|
|
112
124
|
});
|
|
113
125
|
export {
|
|
114
|
-
|
|
126
|
+
T as default
|
|
115
127
|
};
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -118,7 +118,8 @@ import { default as Qt } from "./components/StatusChip/StatusChip.vue.js";
|
|
|
118
118
|
import { STATUS_MAP as qt, normalizeStatus as Wt, resolveStatus as Xt } from "./components/StatusChip/status-map.js";
|
|
119
119
|
import { default as Jt } from "./components/Price/Price.vue.js";
|
|
120
120
|
import { default as ea } from "./components/DateTime/DateTime.vue.js";
|
|
121
|
-
import {
|
|
121
|
+
import { default as ra } from "./components/Clock/Clock.vue.js";
|
|
122
|
+
import { VLITE_CONFIG_KEY as aa, configState as fa, updateConfig as ma, useVLiteConfig as la } from "./core/config.js";
|
|
122
123
|
export {
|
|
123
124
|
E as $t,
|
|
124
125
|
Fo as Accordion,
|
|
@@ -140,6 +141,7 @@ export {
|
|
|
140
141
|
nt as CheckBox,
|
|
141
142
|
L as Chip,
|
|
142
143
|
yo as ChoiceBox,
|
|
144
|
+
ra as Clock,
|
|
143
145
|
yt as ColorPicker,
|
|
144
146
|
Ot as CommandPaletteContent,
|
|
145
147
|
Mt as ConfirmationModal,
|
|
@@ -218,12 +220,12 @@ export {
|
|
|
218
220
|
Mr as TimelineItem,
|
|
219
221
|
Rt as ToastNotification,
|
|
220
222
|
xt as Tooltip,
|
|
221
|
-
|
|
223
|
+
aa as VLITE_CONFIG_KEY,
|
|
222
224
|
fo as Workbook,
|
|
223
225
|
we as barcodesConstants,
|
|
224
226
|
p as camelCase,
|
|
225
227
|
d as capitalize,
|
|
226
|
-
|
|
228
|
+
fa as configState,
|
|
227
229
|
Fr as configure,
|
|
228
230
|
u as copyToClipboard,
|
|
229
231
|
Ht as createVLite,
|
|
@@ -259,7 +261,7 @@ export {
|
|
|
259
261
|
F as throttle,
|
|
260
262
|
Br as toast,
|
|
261
263
|
v as truncate,
|
|
262
|
-
|
|
264
|
+
ma as updateConfig,
|
|
263
265
|
Sr as useAdvancedKeyStroke,
|
|
264
266
|
Ye as useDropdownIds,
|
|
265
267
|
Ve as useDropdownSelection,
|
|
@@ -271,6 +273,6 @@ export {
|
|
|
271
273
|
kr as useNotifications,
|
|
272
274
|
Vo as useTheme,
|
|
273
275
|
oo as useTreeSelection,
|
|
274
|
-
|
|
276
|
+
la as useVLiteConfig,
|
|
275
277
|
Cr as vScrollReveal
|
|
276
278
|
};
|