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.
@@ -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-5 text-[10.5px] leading-none",
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,4 @@
1
+ import f from "./Clock.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -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 j, ref as h, watch as z, onMounted as C, nextTick as V, computed as A, openBlock as g, createElementBlock as m, normalizeClass as v, Fragment as E, renderList as M } from "vue";
2
- const F = ["value", "type", "disabled", "placeholder", "onInput", "onKeydown"], P = /* @__PURE__ */ j({
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(f, { emit: b }) {
18
- const a = f, p = b, s = h([]), r = h(new Array(a.length).fill(""));
19
- z(
20
- () => a.modelValue,
21
- (t) => {
22
- const e = t || "", l = e.split("").slice(0, a.length);
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(a.length).fill("");
25
- l.forEach((u, i) => o[i] = u), r.value = o;
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 t = r.value.join("");
32
- p("update:modelValue", t), p("change", t), t.length === a.length && p("complete", t);
33
- }, y = (t, e) => {
34
- let n = t.target.value;
35
- if (a.type === "number" && (n = n.replace(/\D/g, "")), n.length === 1) {
36
- r.value[e] = n, c(), e < a.length - 1 && s.value[e + 1]?.focus();
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, a.length - e);
45
- o.forEach((i, d) => {
46
- e + d < a.length && (r.value[e + d] = i);
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, a.length - 1);
50
+ const u = Math.min(e + o.length, t.length - 1);
49
51
  s.value[u]?.focus();
50
52
  }
51
- }, w = (t, e) => {
52
- const l = t.key;
53
- if (l === "Backspace") {
54
- r.value[e] || (t.preventDefault(), e > 0 && (r.value[e - 1] = "", s.value[e - 1]?.focus(), c()));
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
- l === "ArrowLeft" && (t.preventDefault(), e > 0 && s.value[e - 1]?.focus()), l === "ArrowRight" && (t.preventDefault(), e < a.length - 1 && s.value[e + 1]?.focus());
58
- }, D = (t) => {
59
- t.preventDefault();
60
- const e = t.clipboardData?.getData("text/plain");
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 l = e.trim();
63
- a.type === "number" && (l = l.replace(/\D/g, ""));
64
- const n = l.split("").slice(0, a.length), o = [...r.value];
65
- n.forEach((i, d) => {
66
- o[d] = i;
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, a.length - 1);
70
+ const u = Math.min(n.length, t.length - 1);
69
71
  s.value[u]?.focus();
70
- }, k = (t, e) => {
71
- t && (s.value[e] = t);
72
+ }, B = (l, e) => {
73
+ l && (s.value[e] = l);
72
74
  };
73
- C(() => {
74
- a.autofocus && V(() => {
75
+ V(() => {
76
+ t.autofocus && A(() => {
75
77
  s.value[0]?.focus();
76
78
  });
77
79
  });
78
- const B = A(() => ["flex items-center", a.attached ? "-space-x-px" : "gap-2"].join(" ")), I = (t) => {
79
- 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", l = {
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:focus:border-primary focus:ring-2 focus:ring-primary"
87
- }, o = a.error ? "border-destructive focus:ring-destructive text-destructive" : "";
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 a.attached && (t === 0 ? u = "rounded-l-md rounded-r-none" : t === a.length - 1 ? u = "rounded-r-md rounded-l-none" : u = "rounded-none"), [e, l[a.size], n[a.variant], o, u].join(" ");
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 (t, e) => (g(), m("div", {
92
- class: v(B.value)
103
+ return (l, e) => (g(), h("div", {
104
+ class: y(x.value)
93
105
  }, [
94
- (g(!0), m(E, null, M(a.length, (l, n) => (g(), m("input", {
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) => k(o, n),
109
+ ref: (o) => B(o, n),
98
110
  value: r.value[n],
99
- type: f.type === "number" ? "tel" : "text",
100
- inputmode: "numeric",
111
+ type: I.value,
112
+ inputmode: j.value,
101
113
  maxlength: 1,
102
- disabled: f.disabled,
103
- placeholder: f.placeholder,
104
- class: v(I(n)),
105
- onInput: (o) => y(o, n),
106
- onKeydown: (o) => w(o, n),
107
- onPaste: D,
108
- onFocus: e[0] || (e[0] = (o) => t.$emit("update:modelValue", r.value.join("")))
109
- }, null, 42, F))), 128))
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
- P as default
126
+ T as default
115
127
  };
package/index.d.ts CHANGED
@@ -76,4 +76,5 @@ export { GoogleSignInPlugin };
76
76
  export * from './components/StatusChip';
77
77
  export * from './components/Price';
78
78
  export * from './components/DateTime';
79
+ export * from './components/Clock';
79
80
  export * from './core/config.ts';
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 { VLITE_CONFIG_KEY as ra, configState as ta, updateConfig as aa, useVLiteConfig as fa } from "./core/config.js";
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
- ra as VLITE_CONFIG_KEY,
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
- ta as configState,
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
- aa as updateConfig,
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
- fa as useVLiteConfig,
276
+ la as useVLiteConfig,
275
277
  Cr as vScrollReveal
276
278
  };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "private": false,
4
4
  "description": "A Vue 3 UI component library built with Tailwind CSS.",
5
5
  "license": "MIT",
6
- "version": "1.0.1",
6
+ "version": "1.0.2",
7
7
  "type": "module",
8
8
  "main": "index.js",
9
9
  "module": "index.js",