vlite3 0.9.12 → 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/README.md +50 -55
- 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/CommandPalette/CommandPaletteContent.vue2.js +1 -1
- package/components/CommandPalette/{CommandPaletteItem.vue2.js → CommandPaletteItem.vue.js} +1 -1
- package/components/DatePicker.vue.js +87 -50
- package/components/NavbarCommandPalette.vue.js +1 -1
- 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/README.md
CHANGED
|
@@ -224,84 +224,73 @@ Override these variables in `:root` or within a `.dark` class (when using class-
|
|
|
224
224
|
|
|
225
225
|
### Extended Color Variants
|
|
226
226
|
|
|
227
|
-
For more complex components, vlite3 provides extended variants for main semantic colors (`primary`, `danger`, `warning`, `info`, `success`). These
|
|
227
|
+
For more complex components, **vlite3** provides extended variants for main semantic colors (`primary`, `danger`, `warning`, `info`, `success`). These help create nuanced UIs with subtle backgrounds, hover states, and accessible text.
|
|
228
228
|
|
|
229
|
-
|
|
230
|
-
| ----------- | --------------------------- | ----------------- |
|
|
231
|
-
| **Primary** | `--color-primary-light`<br> |
|
|
232
|
-
|
|
233
|
-
<br>`--color-primary-dark`<br>
|
|
234
|
-
|
|
235
|
-
<br>`--color-primary-fg`<br>
|
|
236
|
-
|
|
237
|
-
<br>`--color-primary-fg-light` | **Light**: Subtle background (e.g., 10% opacity).<br>
|
|
238
|
-
|
|
239
|
-
<br>**Dark**: Hover state for the main color.<br>
|
|
240
|
-
|
|
241
|
-
<br>**Fg**: Text color on top of the _main_ color.<br>
|
|
242
|
-
|
|
243
|
-
<br>**Fg-Light**: Text color on top of the _light_ variant. |
|
|
244
|
-
| **Danger** | `--color-danger-light`<br>
|
|
245
|
-
|
|
246
|
-
<br>`--color-danger-dark`<br>
|
|
247
|
-
|
|
248
|
-
<br>`--color-danger-fg`<br>
|
|
249
|
-
|
|
250
|
-
<br>`--color-danger-fg-light` | **Light**: Error backgrounds (alerts).<br>
|
|
251
|
-
|
|
252
|
-
<br>**Dark**: Hover state for destructive buttons.<br>
|
|
253
|
-
|
|
254
|
-
<br>**Fg**: Text on destructive buttons.<br>
|
|
255
|
-
|
|
256
|
-
<br>**Fg-Light**: Text on error alerts. |
|
|
257
|
-
| **Warning** | `--color-warning-light`<br>
|
|
258
|
-
|
|
259
|
-
<br>`--color-warning-dark`<br>
|
|
260
|
-
|
|
261
|
-
<br>`--color-warning-fg`<br>
|
|
262
|
-
|
|
263
|
-
<br>`--color-warning-fg-light` | **Light**: Warning backgrounds.<br>
|
|
229
|
+
---
|
|
264
230
|
|
|
265
|
-
|
|
231
|
+
#### Primary
|
|
266
232
|
|
|
267
|
-
|
|
233
|
+
| Variable | Description |
|
|
234
|
+
| -------------------------- | -------------------------------------- |
|
|
235
|
+
| `--color-primary-light` | Subtle background (e.g., 10% opacity) |
|
|
236
|
+
| `--color-primary-dark` | Hover state for the main color |
|
|
237
|
+
| `--color-primary-fg` | Text color on top of the main color |
|
|
238
|
+
| `--color-primary-fg-light` | Text color on top of the light variant |
|
|
268
239
|
|
|
269
|
-
|
|
270
|
-
| **Success** | `--color-success-light`<br>
|
|
240
|
+
---
|
|
271
241
|
|
|
272
|
-
|
|
242
|
+
#### Danger
|
|
273
243
|
|
|
274
|
-
|
|
244
|
+
| Variable | Description |
|
|
245
|
+
| ------------------------- | ----------------------------------- |
|
|
246
|
+
| `--color-danger-light` | Error backgrounds (alerts) |
|
|
247
|
+
| `--color-danger-dark` | Hover state for destructive buttons |
|
|
248
|
+
| `--color-danger-fg` | Text on destructive buttons |
|
|
249
|
+
| `--color-danger-fg-light` | Text on error alerts |
|
|
275
250
|
|
|
276
|
-
|
|
251
|
+
---
|
|
277
252
|
|
|
278
|
-
|
|
253
|
+
#### Warning
|
|
279
254
|
|
|
280
|
-
|
|
255
|
+
| Variable | Description |
|
|
256
|
+
| -------------------------- | ----------------------------------- |
|
|
257
|
+
| `--color-warning-light` | Warning backgrounds |
|
|
258
|
+
| `--color-warning-dark` | Active or emphasized warning states |
|
|
259
|
+
| `--color-warning-fg` | Text on warning badges |
|
|
260
|
+
| `--color-warning-fg-light` | Text on warning backgrounds |
|
|
281
261
|
|
|
282
|
-
|
|
283
|
-
| **Info** | `--color-info-light`<br>
|
|
262
|
+
---
|
|
284
263
|
|
|
285
|
-
|
|
264
|
+
#### Success
|
|
286
265
|
|
|
287
|
-
|
|
266
|
+
| Variable | Description |
|
|
267
|
+
| -------------------------- | ------------------------------- |
|
|
268
|
+
| `--color-success-light` | Success backgrounds (toasts) |
|
|
269
|
+
| `--color-success-dark` | Hover or active success actions |
|
|
270
|
+
| `--color-success-fg` | Text on success buttons |
|
|
271
|
+
| `--color-success-fg-light` | Text on success backgrounds |
|
|
288
272
|
|
|
289
|
-
|
|
273
|
+
---
|
|
290
274
|
|
|
291
|
-
|
|
275
|
+
#### Info
|
|
292
276
|
|
|
293
|
-
|
|
277
|
+
| Variable | Description |
|
|
278
|
+
| ----------------------- | ---------------------------- |
|
|
279
|
+
| `--color-info-light` | Info backgrounds |
|
|
280
|
+
| `--color-info-dark` | Hover or active info actions |
|
|
281
|
+
| `--color-info-fg` | Text on info buttons |
|
|
282
|
+
| `--color-info-fg-light` | Text on info backgrounds |
|
|
294
283
|
|
|
295
|
-
|
|
284
|
+
---
|
|
296
285
|
|
|
297
|
-
|
|
286
|
+
### Example Usage
|
|
298
287
|
|
|
299
288
|
```html
|
|
300
289
|
<div class="bg-success-light text-success-fg-light border border-success/20">
|
|
301
290
|
Operation Completed
|
|
302
291
|
</div>
|
|
303
292
|
|
|
304
|
-
<button class="bg-danger text-danger-fg hover:bg-
|
|
293
|
+
<button class="bg-danger text-danger-fg hover:bg-dang
|
|
305
294
|
```
|
|
306
295
|
|
|
307
296
|
### Additional Colors
|
|
@@ -404,16 +393,19 @@ Follow these rules strictly to ensure visual consistency and predictable styling
|
|
|
404
393
|
- [x] **Label**
|
|
405
394
|
- [x] **Badge**
|
|
406
395
|
- [x] **Chip**
|
|
396
|
+
- [x] **StatusChip**
|
|
407
397
|
- [x] **Logo**
|
|
408
398
|
- [x] **Navbar**
|
|
409
399
|
- [x] **SidebarMenu**
|
|
410
400
|
- [x] **SidePanel**
|
|
411
401
|
- [x] **Breadcrumb**
|
|
412
402
|
- [x] **List**
|
|
403
|
+
- [x] **AttachmentsList**
|
|
413
404
|
- [x] **Masonry Grid**
|
|
414
405
|
- [x] **Stats**
|
|
415
406
|
- [x] **ThemeToggle**
|
|
416
407
|
- [x] **Screen**
|
|
408
|
+
- [x] **ChatInterface**
|
|
417
409
|
|
|
418
410
|
### Inputs & Forms
|
|
419
411
|
|
|
@@ -454,11 +446,14 @@ Follow these rules strictly to ensure visual consistency and predictable styling
|
|
|
454
446
|
- [x] **Tabes**
|
|
455
447
|
- [x] **Masonry**
|
|
456
448
|
- [x] **Stats**
|
|
449
|
+
- [x] **Price**
|
|
450
|
+
- [x] **Date**
|
|
457
451
|
|
|
458
452
|
### Feedback & Overlays
|
|
459
453
|
|
|
460
454
|
- [x] **Alert**
|
|
461
455
|
- [x] **Modal**
|
|
456
|
+
- [x] **Empty**
|
|
462
457
|
- [x] **ConfirmationModal**
|
|
463
458
|
- [x] **ToastNotification**
|
|
464
459
|
- [x] **Tooltip**
|
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';
|
|
@@ -4,7 +4,7 @@ import k from "../Icon.vue.js";
|
|
|
4
4
|
import { $t as E } from "../../utils/i18n.js";
|
|
5
5
|
import { useCommandPaletteItems as Y } from "./useCommandPaletteItems.js";
|
|
6
6
|
import { useCommandPaletteNav as Z } from "./useCommandPaletteNav.js";
|
|
7
|
-
import ee from "./CommandPaletteItem.
|
|
7
|
+
import ee from "./CommandPaletteItem.vue.js";
|
|
8
8
|
const te = { class: "command-palette-content flex flex-col w-full h-full max-h-[70vh]" }, oe = { class: "flex items-center gap-3 px-4 py-3 border-b border-border/60 shrink-0" }, se = ["placeholder"], ne = ["aria-label"], re = {
|
|
9
9
|
key: 0,
|
|
10
10
|
class: "flex flex-col items-center justify-center py-14 px-6 text-center select-none",
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { defineComponent as z, computed as m, openBlock as x, createBlock as k, unref as D, withCtx as h, createElementVNode as L, createVNode as g, renderSlot as B, mergeProps as P } from "vue";
|
|
2
|
+
import V from "./Button.vue.js";
|
|
3
|
+
import U from "./Dropdown/Dropdown.vue.js";
|
|
4
4
|
import "@iconify/vue";
|
|
5
|
-
import { $t as
|
|
5
|
+
import { $t as I } from "../utils/i18n.js";
|
|
6
6
|
/* empty css */
|
|
7
7
|
/* empty css */
|
|
8
8
|
import j, { TimePicker as C } from "v-datepicker-lite";
|
|
9
9
|
import "v-datepicker-lite/style.css";
|
|
10
|
-
const
|
|
10
|
+
const F = { class: "overflow-hidden min-w-[300px]" }, G = /* @__PURE__ */ z({
|
|
11
11
|
__name: "DatePicker",
|
|
12
12
|
props: {
|
|
13
13
|
placeholder: {},
|
|
@@ -29,34 +29,53 @@ const U = { class: "overflow-hidden min-w-[300px]" }, G = /* @__PURE__ */ T({
|
|
|
29
29
|
readonly: { type: Boolean }
|
|
30
30
|
},
|
|
31
31
|
emits: ["update:modelValue", "change"],
|
|
32
|
-
setup(t, { emit:
|
|
33
|
-
const
|
|
34
|
-
get: () =>
|
|
32
|
+
setup(t, { emit: N }) {
|
|
33
|
+
const r = t, y = N, a = m({
|
|
34
|
+
get: () => r.modelValue ?? r.value,
|
|
35
35
|
set: (e) => {
|
|
36
|
-
|
|
36
|
+
y("update:modelValue", e), y("change", e);
|
|
37
37
|
}
|
|
38
|
-
}),
|
|
38
|
+
}), T = (e) => e instanceof Date ? e.getHours() !== 0 || e.getMinutes() !== 0 : typeof e == "string" ? e.includes("T") || /\d{2}:\d{2}/.test(e) : !1, u = (e) => {
|
|
39
|
+
if (!e) return null;
|
|
40
|
+
if (e instanceof Date)
|
|
41
|
+
return isNaN(e.getTime()) ? null : new Date(e.getFullYear(), e.getMonth(), e.getDate());
|
|
42
|
+
if (typeof e == "string") {
|
|
43
|
+
if (/^\d{4}-\d{2}-\d{2}$/.test(e)) {
|
|
44
|
+
const [l, d, o] = e.split("-").map(Number);
|
|
45
|
+
return new Date(l, d - 1, o);
|
|
46
|
+
}
|
|
47
|
+
if (e.includes("T")) {
|
|
48
|
+
const l = e.split("T")[0], [d, o, s] = l.split("-").map(Number);
|
|
49
|
+
return new Date(d, o - 1, s);
|
|
50
|
+
}
|
|
51
|
+
const i = new Date(e);
|
|
52
|
+
return isNaN(i.getTime()) ? null : i;
|
|
53
|
+
}
|
|
54
|
+
return null;
|
|
55
|
+
}, c = (e) => {
|
|
56
|
+
const n = e.getFullYear(), i = String(e.getMonth() + 1).padStart(2, "0"), l = String(e.getDate()).padStart(2, "0");
|
|
57
|
+
return `${n}-${i}-${l}`;
|
|
58
|
+
}, b = (e) => {
|
|
39
59
|
try {
|
|
40
60
|
if (e && typeof e == "object") {
|
|
41
|
-
const
|
|
42
|
-
if (
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
45
|
-
return { startDate: y, endDate: g };
|
|
61
|
+
const d = e.startDate || e.start, o = e.endDate || e.end;
|
|
62
|
+
if (d && o) {
|
|
63
|
+
const s = u(d), w = u(o);
|
|
64
|
+
if (s && w) return { startDate: s, endDate: w };
|
|
46
65
|
}
|
|
47
66
|
}
|
|
48
|
-
const n =
|
|
49
|
-
if (
|
|
50
|
-
const i = new Date(n),
|
|
51
|
-
return
|
|
67
|
+
const n = u(e);
|
|
68
|
+
if (!n) return null;
|
|
69
|
+
const i = new Date(n), l = new Date(n);
|
|
70
|
+
return l.setDate(i.getDate() + 6), { startDate: i, endDate: l };
|
|
52
71
|
} catch {
|
|
53
72
|
return null;
|
|
54
73
|
}
|
|
55
|
-
},
|
|
74
|
+
}, f = m(() => {
|
|
56
75
|
if (!a.value) return "";
|
|
57
|
-
if (
|
|
58
|
-
if (
|
|
59
|
-
const e =
|
|
76
|
+
if (r.mode === "time") return a.value;
|
|
77
|
+
if (r.mode === "week") {
|
|
78
|
+
const e = b(a.value);
|
|
60
79
|
if (!e) return "";
|
|
61
80
|
const n = e.startDate.toLocaleDateString("en-US", {
|
|
62
81
|
month: "short",
|
|
@@ -70,34 +89,52 @@ const U = { class: "overflow-hidden min-w-[300px]" }, G = /* @__PURE__ */ T({
|
|
|
70
89
|
return `${n} - ${i}`;
|
|
71
90
|
}
|
|
72
91
|
try {
|
|
92
|
+
if (r.mode === "date" || r.mode === "month") {
|
|
93
|
+
const i = u(a.value);
|
|
94
|
+
return i ? i.toLocaleDateString("en-US", {
|
|
95
|
+
month: "short",
|
|
96
|
+
day: "numeric",
|
|
97
|
+
year: "numeric"
|
|
98
|
+
}) : String(a.value);
|
|
99
|
+
}
|
|
73
100
|
const e = new Date(a.value);
|
|
74
101
|
if (isNaN(e.getTime())) return String(a.value);
|
|
75
|
-
const n =
|
|
102
|
+
const n = r.mode === "dateTime" && T(a.value);
|
|
76
103
|
return e.toLocaleDateString("en-US", {
|
|
77
104
|
month: "short",
|
|
78
105
|
day: "numeric",
|
|
79
106
|
year: "numeric",
|
|
80
|
-
...n ? { hour: "2-digit", minute: "2-digit", hour12:
|
|
107
|
+
...n ? { hour: "2-digit", minute: "2-digit", hour12: r.timeFormat === "12h" } : {}
|
|
81
108
|
});
|
|
82
109
|
} catch {
|
|
83
110
|
return String(a.value);
|
|
84
111
|
}
|
|
85
|
-
}),
|
|
86
|
-
if (
|
|
87
|
-
if (
|
|
88
|
-
const e =
|
|
112
|
+
}), v = m(() => {
|
|
113
|
+
if (r.placeholderI18n) return I(r.placeholderI18n);
|
|
114
|
+
if (r.placeholder !== void 0) return r.placeholder;
|
|
115
|
+
const e = I("vlite.datePicker.placeholder");
|
|
89
116
|
return e !== "vlite.datePicker.placeholder" ? e : "Select date";
|
|
90
|
-
}),
|
|
91
|
-
if (
|
|
92
|
-
const n =
|
|
117
|
+
}), S = (e) => {
|
|
118
|
+
if (r.mode === "week") {
|
|
119
|
+
const n = b(e);
|
|
120
|
+
if (n) {
|
|
121
|
+
a.value = {
|
|
122
|
+
startDate: c(n.startDate),
|
|
123
|
+
endDate: c(n.endDate)
|
|
124
|
+
};
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
if (r.mode === "date" || r.mode === "month") {
|
|
129
|
+
const n = u(e);
|
|
93
130
|
if (n) {
|
|
94
|
-
a.value =
|
|
131
|
+
a.value = c(n);
|
|
95
132
|
return;
|
|
96
133
|
}
|
|
97
134
|
}
|
|
98
135
|
a.value = e;
|
|
99
|
-
},
|
|
100
|
-
return (e, n) => t.mode !== "time" ? (x(),
|
|
136
|
+
}, $ = m(() => r.mode === "week" && a.value && typeof a.value == "object" && (a.value.startDate || a.value.start) || a.value);
|
|
137
|
+
return (e, n) => t.mode !== "time" ? (x(), k(D(U), {
|
|
101
138
|
key: 0,
|
|
102
139
|
position: "bottom-start",
|
|
103
140
|
class: "w-full",
|
|
@@ -105,13 +142,13 @@ const U = { class: "overflow-hidden min-w-[300px]" }, G = /* @__PURE__ */ T({
|
|
|
105
142
|
teleport: t.teleport,
|
|
106
143
|
disabled: t.disabled || t.readonly
|
|
107
144
|
}, {
|
|
108
|
-
trigger:
|
|
109
|
-
|
|
145
|
+
trigger: h(() => [
|
|
146
|
+
B(e.$slots, "default", {
|
|
110
147
|
value: a.value,
|
|
111
|
-
displayValue:
|
|
148
|
+
displayValue: f.value
|
|
112
149
|
}, () => [
|
|
113
|
-
|
|
114
|
-
text:
|
|
150
|
+
g(V, P({
|
|
151
|
+
text: f.value?.replace("-", "—") || v.value,
|
|
115
152
|
variant: t.variant || "outline",
|
|
116
153
|
size: t.size || "md",
|
|
117
154
|
icon: t.icon || "lucide:calendar",
|
|
@@ -119,10 +156,10 @@ const U = { class: "overflow-hidden min-w-[300px]" }, G = /* @__PURE__ */ T({
|
|
|
119
156
|
}, t.btnProps, { class: "w-full justify-start text-left font-normal" }), null, 16, ["text", "variant", "size", "icon", "disabled"])
|
|
120
157
|
])
|
|
121
158
|
]),
|
|
122
|
-
default:
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
value:
|
|
159
|
+
default: h(() => [
|
|
160
|
+
L("div", F, [
|
|
161
|
+
g(D(j), {
|
|
162
|
+
value: $.value,
|
|
126
163
|
mode: t.mode,
|
|
127
164
|
"min-date": t.minDate,
|
|
128
165
|
"max-date": t.maxDate,
|
|
@@ -132,17 +169,17 @@ const U = { class: "overflow-hidden min-w-[300px]" }, G = /* @__PURE__ */ T({
|
|
|
132
169
|
"time-format": "12h",
|
|
133
170
|
disabled: t.disabled,
|
|
134
171
|
readonly: t.readonly,
|
|
135
|
-
onChange:
|
|
172
|
+
onChange: S
|
|
136
173
|
}, null, 8, ["value", "mode", "min-date", "max-date", "disabled-dates", "minuteInterval", "disabled", "readonly"])
|
|
137
174
|
])
|
|
138
175
|
]),
|
|
139
176
|
_: 3
|
|
140
|
-
}, 8, ["teleport", "disabled"])) : (x(),
|
|
177
|
+
}, 8, ["teleport", "disabled"])) : (x(), k(D(C), {
|
|
141
178
|
key: 1,
|
|
142
179
|
"model-value": a.value,
|
|
143
180
|
"onUpdate:modelValue": [
|
|
144
181
|
n[0] || (n[0] = (i) => a.value = i),
|
|
145
|
-
|
|
182
|
+
S
|
|
146
183
|
],
|
|
147
184
|
mode: t.mode,
|
|
148
185
|
"min-date": t.minDate,
|
|
@@ -154,9 +191,9 @@ const U = { class: "overflow-hidden min-w-[300px]" }, G = /* @__PURE__ */ T({
|
|
|
154
191
|
disabled: t.disabled,
|
|
155
192
|
readonly: t.readonly
|
|
156
193
|
}, {
|
|
157
|
-
default:
|
|
158
|
-
|
|
159
|
-
text:
|
|
194
|
+
default: h(() => [
|
|
195
|
+
g(V, P({
|
|
196
|
+
text: f.value || v.value,
|
|
160
197
|
variant: t.variant || "outline",
|
|
161
198
|
size: t.size || "md",
|
|
162
199
|
icon: t.icon || (t.mode === "time" ? "lucide:clock" : "lucide:calendar"),
|
|
@@ -3,7 +3,7 @@ import L from "./Icon.vue.js";
|
|
|
3
3
|
import v from "./Modal.vue.js";
|
|
4
4
|
import N from "./CommandPalette/CommandPaletteContent.vue.js";
|
|
5
5
|
import { $t as R } from "../utils/i18n.js";
|
|
6
|
-
/* empty css
|
|
6
|
+
/* empty css */
|
|
7
7
|
const U = { class: "block truncate -text-fs-1.5" }, V = { class: "ml-auto inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded text-[10px] font-mono font-medium border border-border/80 bg-background text-muted-foreground ml-1" }, q = /* @__PURE__ */ x({
|
|
8
8
|
__name: "NavbarCommandPalette",
|
|
9
9
|
props: {
|
|
@@ -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
|
};
|