vlite3 0.1.10 → 0.2.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.
Files changed (55) hide show
  1. package/README.md +226 -150
  2. package/components/Button.vue.js +1 -1
  3. package/components/Chip/Chip.vue.js +15 -15
  4. package/components/DataTable/DataTable.vue.js +2 -2
  5. package/components/DataTable/DataTable.vue2.js +41 -39
  6. package/components/DataTable/types.d.ts +1 -0
  7. package/components/DatePicker.vue.d.ts +12 -3
  8. package/components/DatePicker.vue.js +80 -39
  9. package/components/Dropdown/DropdownMenu.vue.js +48 -47
  10. package/components/Form/Form.vue.d.ts +2 -0
  11. package/components/Form/Form.vue.js +2 -2
  12. package/components/Form/Form.vue2.js +104 -101
  13. package/components/Form/FormField.vue.d.ts +4 -0
  14. package/components/Form/FormField.vue.js +248 -148
  15. package/components/Form/FormFields.vue.d.ts +2 -0
  16. package/components/Form/FormFields.vue.js +2 -2
  17. package/components/Form/FormFields.vue2.js +45 -39
  18. package/components/Form/types.d.ts +24 -4
  19. package/components/Form/utils/form.utils.d.ts +5 -1
  20. package/components/Form/utils/form.utils.js +69 -60
  21. package/components/GoogleLogin.vue.d.ts +41 -0
  22. package/components/GoogleLogin.vue.js +60 -0
  23. package/components/GoogleLogin.vue2.js +4 -0
  24. package/components/Input.vue.js +120 -111
  25. package/components/NumberInput.vue.d.ts +38 -0
  26. package/components/NumberInput.vue.js +7 -0
  27. package/components/NumberInput.vue2.js +191 -0
  28. package/components/Pagination/Pagination.vue.d.ts +1 -0
  29. package/components/Pagination/Pagination.vue.js +60 -46
  30. package/components/ProgressBar/ProgressBar.vue.d.ts +12 -0
  31. package/components/ProgressBar/ProgressBar.vue.js +7 -0
  32. package/components/ProgressBar/ProgressBar.vue2.js +158 -0
  33. package/components/ProgressBar/index.d.ts +3 -0
  34. package/components/Spinner/Spinner.vue.d.ts +8 -0
  35. package/components/Spinner/Spinner.vue.js +89 -0
  36. package/components/Spinner/Spinner.vue2.js +4 -0
  37. package/components/Spinner/index.d.ts +2 -0
  38. package/components/Spinner/types.d.ts +9 -0
  39. package/components/Tabes/Tabes.vue.d.ts +3 -1
  40. package/components/Tabes/Tabes.vue.js +103 -44
  41. package/directives/vScrollReveal.d.ts +2 -0
  42. package/directives/vScrollReveal.js +48 -0
  43. package/index.d.ts +8 -0
  44. package/index.js +180 -147
  45. package/package.json +6 -3
  46. package/style.css +56 -4
  47. package/types/form.type.d.ts +2 -2
  48. package/types/progressbar.d.ts +75 -0
  49. package/utils/env.d.ts +14 -0
  50. package/utils/env.js +4 -0
  51. package/utils/functions.d.ts +99 -0
  52. package/utils/functions.js +91 -7
  53. package/utils/index.d.ts +2 -0
  54. package/utils/search.util.d.ts +127 -0
  55. package/utils/search.util.js +363 -0
@@ -1,9 +1,9 @@
1
- import { defineComponent as ee, ref as g, computed as b, watch as p, onMounted as te, openBlock as r, createElementBlock as d, createVNode as C, createSlots as V, withCtx as T, renderSlot as S, createBlock as D, createCommentVNode as I, createElementVNode as n, normalizeClass as B, Fragment as R, renderList as $, normalizeStyle as A, mergeProps as le, toDisplayString as M, createTextVNode as ae, unref as se } from "vue";
1
+ import { defineComponent as ee, ref as g, computed as b, watch as p, onMounted as te, openBlock as n, createElementBlock as i, createVNode as C, createSlots as V, withCtx as T, renderSlot as S, createBlock as D, createCommentVNode as I, createElementVNode as r, normalizeClass as B, Fragment as R, renderList as $, normalizeStyle as A, mergeProps as le, toDisplayString as M, createTextVNode as ae, unref as se } from "vue";
2
2
  import oe from "../Icon.vue.js";
3
- import re from "../CheckBox.vue.js";
4
- import ne from "../Button.vue.js";
5
- import de from "../ConfirmationModal.vue.js";
6
- import ie from "../Pagination/Pagination.vue.js";
3
+ import ne from "../CheckBox.vue.js";
4
+ import re from "../Button.vue.js";
5
+ import ie from "../ConfirmationModal.vue.js";
6
+ import de from "../Pagination/Pagination.vue.js";
7
7
  import ue from "./DataTableHeader.vue.js";
8
8
  import ce from "./DataTableRow.vue.js";
9
9
  import me from "./DataTableToolbar.vue.js";
@@ -35,6 +35,7 @@ const fe = { class: "space-y-4" }, he = { class: "overflow-x-auto w-full" }, ve
35
35
  emptyDescription: { default: "No results found. Try adjusting your filters or search terms." },
36
36
  emptyIcon: { default: "lucide:inbox" },
37
37
  showPagination: { type: Boolean, default: !0 },
38
+ paginationPosition: {},
38
39
  pageInfo: {},
39
40
  itemsPerPage: { default: 10 },
40
41
  itemsPerPageOptions: { default: () => [10, 25, 50, 100] },
@@ -50,7 +51,7 @@ const fe = { class: "space-y-4" }, he = { class: "overflow-x-auto w-full" }, ve
50
51
  },
51
52
  emits: ["change", "select", "rowClick", "update:itemsPerPage", "update:selectedRows", "delete"],
52
53
  setup(a, { emit: U }) {
53
- const O = (e, t) => t.split(".").reduce((s, c) => s?.[c], e), u = (e, t) => O(e, t), l = a, w = U, i = g({ field: "", order: "" }), k = g(l.itemsPerPage), h = g(l.pageInfo?.currentPage || 1), y = g(l.search || ""), P = g(!1), v = g("initial"), L = b(() => l.loading && (v.value === "initial" || v.value === "page"));
54
+ const O = (e, t) => t.split(".").reduce((s, c) => s?.[c], e), u = (e, t) => O(e, t), l = a, w = U, d = g({ field: "", order: "" }), k = g(l.itemsPerPage), h = g(l.pageInfo?.currentPage || 1), y = g(l.search || ""), P = g(!1), v = g("initial"), L = b(() => l.loading && (v.value === "initial" || v.value === "page"));
54
55
  p(
55
56
  () => l.loading,
56
57
  (e, t) => {
@@ -110,7 +111,7 @@ const fe = { class: "space-y-4" }, he = { class: "overflow-x-auto w-full" }, ve
110
111
  };
111
112
  w("select", c), w("update:selectedRows", s);
112
113
  }, H = (e) => {
113
- i.value.field === e ? i.value.order === "asc" ? i.value.order = "desc" : i.value.order === "desc" ? (i.value.order = "", i.value.field = "") : i.value.order = "asc" : (i.value.field = e, i.value.order = "asc"), h.value = 1, v.value = "sort", x();
114
+ d.value.field === e ? d.value.order === "asc" ? d.value.order = "desc" : d.value.order === "desc" ? (d.value.order = "", d.value.field = "") : d.value.order = "asc" : (d.value.field = e, d.value.order = "asc"), h.value = 1, v.value = "sort", x();
114
115
  }, J = (e) => {
115
116
  h.value = e, v.value = "page", x();
116
117
  }, K = (e) => {
@@ -126,7 +127,7 @@ const fe = { class: "space-y-4" }, he = { class: "overflow-x-auto w-full" }, ve
126
127
  page: h.value,
127
128
  limit: k.value
128
129
  },
129
- sorting: { ...i.value },
130
+ sorting: { ...d.value },
130
131
  search: y.value
131
132
  });
132
133
  }, Y = b(() => [
@@ -144,7 +145,7 @@ const fe = { class: "space-y-4" }, he = { class: "overflow-x-auto w-full" }, ve
144
145
  }
145
146
  ), te(() => {
146
147
  x();
147
- }), (e, t) => (r(), d("div", fe, [
148
+ }), (e, t) => (n(), i("div", fe, [
148
149
  C(me, {
149
150
  modelValue: y.value,
150
151
  "onUpdate:modelValue": t[1] || (t[1] = (s) => y.value = s),
@@ -161,7 +162,7 @@ const fe = { class: "space-y-4" }, he = { class: "overflow-x-auto w-full" }, ve
161
162
  e.$slots?.["toolbar-right"] || o.value.size > 0 ? {
162
163
  name: "right",
163
164
  fn: T(() => [
164
- o.value.size > 0 ? (r(), D(ne, {
165
+ o.value.size > 0 ? (n(), D(re, {
165
166
  key: 0,
166
167
  rounded: "full",
167
168
  variant: "ghost",
@@ -174,23 +175,23 @@ const fe = { class: "space-y-4" }, he = { class: "overflow-x-auto w-full" }, ve
174
175
  key: "1"
175
176
  } : void 0
176
177
  ]), 1032, ["modelValue", "show-search", "placeholder"]),
177
- n("div", {
178
+ r("div", {
178
179
  class: B(Y.value)
179
180
  }, [
180
- n("div", he, [
181
- n("table", {
181
+ r("div", he, [
182
+ r("table", {
182
183
  class: B([Z.value, ""])
183
184
  }, [
184
- n("thead", {
185
+ r("thead", {
185
186
  class: B([
186
187
  "[&_tr]:border-b [&_tr]:border-border/70! bg-muted",
187
188
  a.variant === "raised" ? "[&_th:first-child]:rounded-tl-lg [&_th:last-child]:rounded-tr-lg" : ""
188
189
  ])
189
190
  }, [
190
- n("tr", ve, [
191
- a.selectable ? (r(), d("th", ge, [
192
- n("div", pe, [
193
- C(re, {
191
+ r("tr", ve, [
192
+ a.selectable ? (n(), i("th", ge, [
193
+ r("div", pe, [
194
+ C(ne, {
194
195
  "model-value": z.value,
195
196
  indeterminate: E.value,
196
197
  size: "xs",
@@ -198,10 +199,10 @@ const fe = { class: "space-y-4" }, he = { class: "overflow-x-auto w-full" }, ve
198
199
  }, null, 8, ["model-value", "indeterminate"])
199
200
  ])
200
201
  ])) : I("", !0),
201
- (r(!0), d(R, null, $(a.headers, (s) => (r(), D(ue, {
202
+ (n(!0), i(R, null, $(a.headers, (s) => (n(), D(ue, {
202
203
  key: s.field,
203
204
  header: s,
204
- "sort-config": i.value,
205
+ "sort-config": d.value,
205
206
  compact: a.compact,
206
207
  "table-sortable": a.sortable,
207
208
  onSort: H,
@@ -212,28 +213,28 @@ const fe = { class: "space-y-4" }, he = { class: "overflow-x-auto w-full" }, ve
212
213
  }, null, 8, ["header", "sort-config", "compact", "table-sortable", "style"]))), 128))
213
214
  ])
214
215
  ], 2),
215
- n("tbody", we, [
216
- L.value ? (r(!0), d(R, { key: 0 }, $(Math.min(k.value, 15), (s) => (r(), d("tr", {
216
+ r("tbody", we, [
217
+ L.value ? (n(!0), i(R, { key: 0 }, $(Math.min(k.value, 15), (s) => (n(), i("tr", {
217
218
  key: "skeleton-" + s,
218
219
  class: "border-b border-border/50 bg-background transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted"
219
220
  }, [
220
- a.selectable ? (r(), d("td", ye, [...t[4] || (t[4] = [
221
- n("div", { class: "flex items-center justify-center" }, [
222
- n("div", { class: "h-4 w-4 rounded-[4px] bg-muted/50 animate-pulse" })
221
+ a.selectable ? (n(), i("td", ye, [...t[4] || (t[4] = [
222
+ r("div", { class: "flex items-center justify-center" }, [
223
+ r("div", { class: "h-4 w-4 rounded-[4px] bg-muted/50 animate-pulse" })
223
224
  ], -1)
224
225
  ])])) : I("", !0),
225
- (r(!0), d(R, null, $(a.headers, (c) => (r(), d("td", {
226
+ (n(!0), i(R, null, $(a.headers, (c) => (n(), i("td", {
226
227
  key: c.field,
227
228
  class: B(["p-5! align-middle last:pr-6!", [c.hideOnMobile ? "hidden md:table-cell" : ""]])
228
229
  }, [
229
- n("div", {
230
+ r("div", {
230
231
  class: "rounded-md bg-muted/50 animate-pulse h-4 w-full",
231
232
  style: A({
232
233
  width: `${50 + Math.random() * 40}%`
233
234
  })
234
235
  }, null, 4)
235
236
  ], 2))), 128))
236
- ]))), 128)) : a.rows.length > 0 ? (r(!0), d(R, { key: 1 }, $(a.rows, (s, c) => (r(), D(ce, {
237
+ ]))), 128)) : a.rows.length > 0 ? (n(!0), i(R, { key: 1 }, $(a.rows, (s, c) => (n(), D(ce, {
237
238
  key: j(s),
238
239
  row: s,
239
240
  headers: a.headers,
@@ -254,25 +255,25 @@ const fe = { class: "space-y-4" }, he = { class: "overflow-x-auto w-full" }, ve
254
255
  S(e.$slots, m.field, le({ ref_for: !0 }, f), void 0, !0)
255
256
  ])
256
257
  }))
257
- ]), 1032, ["row", "headers", "index", "key-field", "selectable", "is-selected", "hoverable", "striped", "compact"]))), 128)) : (r(), d("tr", be, [
258
- n("td", {
258
+ ]), 1032, ["row", "headers", "index", "key-field", "selectable", "is-selected", "hoverable", "striped", "compact"]))), 128)) : (n(), i("tr", be, [
259
+ r("td", {
259
260
  colspan: a.selectable ? a.headers.length + 1 : a.headers.length,
260
261
  class: "h-96 text-center align-middle hover:bg-transparent"
261
262
  }, [
262
- n("div", Pe, [
263
- n("div", xe, [
263
+ r("div", Pe, [
264
+ r("div", xe, [
264
265
  C(oe, {
265
266
  icon: a.emptyIcon,
266
267
  class: "h-6 w-6 text-muted-foreground/80"
267
268
  }, null, 8, ["icon"])
268
269
  ]),
269
- n("h3", Ce, M(a.emptyTitle), 1),
270
- n("p", Se, [
270
+ r("h3", Ce, M(a.emptyTitle), 1),
271
+ r("p", Se, [
271
272
  S(e.$slots, "empty-description", {}, () => [
272
273
  ae(M(a.emptyDescription), 1)
273
274
  ], !0)
274
275
  ]),
275
- e.$slots["empty-action"] ? (r(), d("div", Ie, [
276
+ e.$slots["empty-action"] ? (n(), i("div", Ie, [
276
277
  S(e.$slots, "empty-action", {}, void 0, !0)
277
278
  ])) : I("", !0)
278
279
  ])
@@ -282,8 +283,8 @@ const fe = { class: "space-y-4" }, he = { class: "overflow-x-auto w-full" }, ve
282
283
  ], 2)
283
284
  ])
284
285
  ], 2),
285
- a.showPagination && a.pageInfo && a.pageInfo.totalItems > 0 ? (r(), d("div", $e, [
286
- C(se(ie), {
286
+ a.showPagination && a.pageInfo && a.pageInfo.totalItems > 0 ? (n(), i("div", $e, [
287
+ C(se(de), {
287
288
  "current-page": h.value,
288
289
  "total-pages": a.pageInfo.totalPages,
289
290
  "show-page-info": !1,
@@ -291,11 +292,12 @@ const fe = { class: "space-y-4" }, he = { class: "overflow-x-auto w-full" }, ve
291
292
  "items-per-page": k.value,
292
293
  "items-per-page-options": a.itemsPerPageOptions,
293
294
  "nav-type": "icon",
295
+ alignment: l.paginationPosition,
294
296
  onChange: J,
295
297
  "onUpdate:itemsPerPage": K
296
- }, null, 8, ["current-page", "total-pages", "show-items-per-page", "items-per-page", "items-per-page-options"])
298
+ }, null, 8, ["current-page", "total-pages", "show-items-per-page", "items-per-page", "items-per-page-options", "alignment"])
297
299
  ])) : I("", !0),
298
- C(de, {
300
+ C(ie, {
299
301
  show: P.value,
300
302
  "onUpdate:show": t[2] || (t[2] = (s) => P.value = s),
301
303
  title: "Confirm Deletion",
@@ -54,6 +54,7 @@ export interface DataTableProps {
54
54
  emptyDescription?: string;
55
55
  emptyIcon?: string;
56
56
  showPagination?: boolean;
57
+ paginationPosition?: 'start' | 'center' | 'end' | 'between';
57
58
  pageInfo?: PageInfo;
58
59
  itemsPerPage?: number;
59
60
  itemsPerPageOptions?: number[];
@@ -6,23 +6,31 @@ type __VLS_Props = {
6
6
  value?: any;
7
7
  mode: DatePickerMode;
8
8
  minDate?: string;
9
+ maxDate?: string;
10
+ disabledDates?: {
11
+ start: string;
12
+ end?: string;
13
+ }[];
9
14
  icon?: string;
10
15
  size?: ButtonSize;
11
16
  variant?: ButtonVariant;
12
17
  btnProps?: any;
13
18
  teleport?: boolean;
14
19
  minuteInterval?: number;
20
+ timeFormat?: '12h' | '24h';
21
+ disabled?: boolean;
22
+ readonly?: boolean;
15
23
  };
16
24
  declare function __VLS_template(): {
17
25
  attrs: Partial<{}>;
18
26
  slots: {
19
27
  default?(_: {
20
28
  value: any;
21
- displayValue: string;
29
+ displayValue: any;
22
30
  }): any;
23
31
  };
24
32
  refs: {};
25
- rootEl: HTMLDivElement;
33
+ rootEl: any;
26
34
  };
27
35
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
28
36
  declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
@@ -34,7 +42,8 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}
34
42
  }>, {
35
43
  teleport: boolean;
36
44
  minuteInterval: number;
37
- }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
45
+ timeFormat: "12h" | "24h";
46
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
38
47
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
39
48
  export default _default;
40
49
  type __VLS_WithTemplateSlots<T, S> = T & {
@@ -1,10 +1,10 @@
1
- import { defineComponent as v, computed as r, openBlock as h, createBlock as g, unref as u, withCtx as m, createElementVNode as p, createVNode as c, renderSlot as V, mergeProps as w } from "vue";
2
- import y from "./Button.vue.js";
3
- import D from "./Dropdown/Dropdown.vue.js";
1
+ import { defineComponent as g, computed as s, openBlock as c, createBlock as f, unref as n, withCtx as m, createElementVNode as D, createVNode as u, renderSlot as w, mergeProps as v } from "vue";
2
+ import b from "./Button.vue.js";
3
+ import V from "./Dropdown/Dropdown.vue.js";
4
4
  import "@iconify/vue";
5
- import x from "v-datepicker-lite";
5
+ import k, { TimePicker as P } from "v-datepicker-lite";
6
6
  import "v-datepicker-lite/style.css";
7
- const P = { class: "min-w-[300px] overflow-hidden" }, N = /* @__PURE__ */ v({
7
+ const z = { class: "overflow-hidden min-w-[300px]" }, $ = /* @__PURE__ */ g({
8
8
  __name: "DatePicker",
9
9
  props: {
10
10
  placeholder: {},
@@ -12,73 +12,114 @@ const P = { class: "min-w-[300px] overflow-hidden" }, N = /* @__PURE__ */ v({
12
12
  value: {},
13
13
  mode: {},
14
14
  minDate: {},
15
+ maxDate: {},
16
+ disabledDates: {},
15
17
  icon: {},
16
18
  size: {},
17
19
  variant: {},
18
20
  btnProps: {},
19
21
  teleport: { type: Boolean, default: !0 },
20
- minuteInterval: { default: 5 }
22
+ minuteInterval: { default: 5 },
23
+ timeFormat: { default: "12h" },
24
+ disabled: { type: Boolean },
25
+ readonly: { type: Boolean }
21
26
  },
22
27
  emits: ["update:modelValue", "change"],
23
- setup(t, { emit: s }) {
24
- const n = t, i = s, a = r({
25
- get: () => n.modelValue ?? n.value,
26
- set: (e) => {
27
- i("update:modelValue", e), i("change", e);
28
+ setup(e, { emit: h }) {
29
+ const l = e, o = h, a = s({
30
+ get: () => l.modelValue ?? l.value,
31
+ set: (t) => {
32
+ o("update:modelValue", t), o("change", t);
28
33
  }
29
- }), d = (e) => e instanceof Date ? e.getHours() !== 0 || e.getMinutes() !== 0 : typeof e == "string" ? e.includes("T") || /\d{2}:\d{2}/.test(e) : !1, l = r(() => {
34
+ }), y = (t) => t instanceof Date ? t.getHours() !== 0 || t.getMinutes() !== 0 : typeof t == "string" ? t.includes("T") || /\d{2}:\d{2}/.test(t) : !1, i = s(() => {
30
35
  if (!a.value) return "";
36
+ if (l.mode === "time") return a.value;
31
37
  try {
32
- const e = new Date(a.value);
33
- if (isNaN(e.getTime())) return String(a.value);
34
- const o = n.mode === "dateTime" && d(a.value);
35
- return e.toLocaleDateString("en-US", {
38
+ const t = new Date(a.value);
39
+ if (isNaN(t.getTime())) return String(a.value);
40
+ const d = l.mode === "dateTime" && y(a.value);
41
+ return t.toLocaleDateString("en-US", {
36
42
  month: "short",
37
43
  day: "numeric",
38
44
  year: "numeric",
39
- ...o ? { hour: "2-digit", minute: "2-digit" } : {}
45
+ ...d ? { hour: "2-digit", minute: "2-digit", hour12: l.timeFormat === "12h" } : {}
40
46
  });
41
47
  } catch {
42
48
  return String(a.value);
43
49
  }
44
- }), f = (e) => {
45
- a.value = e;
50
+ }), r = (t) => {
51
+ a.value = t;
46
52
  };
47
- return (e, o) => (h(), g(u(D), {
53
+ return (t, d) => e.mode !== "time" ? (c(), f(n(V), {
54
+ key: 0,
48
55
  position: "bottom-start",
49
56
  class: "w-full",
50
- teleport: t.teleport
57
+ maxHeight: "max-h-[500px]",
58
+ teleport: e.teleport,
59
+ disabled: e.disabled || e.readonly
51
60
  }, {
52
61
  trigger: m(() => [
53
- V(e.$slots, "default", {
62
+ w(t.$slots, "default", {
54
63
  value: a.value,
55
- displayValue: l.value
64
+ displayValue: i.value
56
65
  }, () => [
57
- c(y, w({
58
- text: l.value || t.placeholder || "Select date",
59
- variant: t.variant || "outline",
60
- size: t.size || "md",
61
- icon: t.icon || "lucide:calendar"
62
- }, t.btnProps, { class: "w-full justify-start text-left font-normal" }), null, 16, ["text", "variant", "size", "icon"])
66
+ u(b, v({
67
+ text: i.value || e.placeholder || "Select date",
68
+ variant: e.variant || "outline",
69
+ size: e.size || "md",
70
+ icon: e.icon || "lucide:calendar",
71
+ disabled: e.disabled
72
+ }, e.btnProps, { class: "w-full justify-start text-left font-normal" }), null, 16, ["text", "variant", "size", "icon", "disabled"])
63
73
  ])
64
74
  ]),
65
75
  default: m(() => [
66
- p("div", P, [
67
- c(u(x), {
76
+ D("div", z, [
77
+ u(n(k), {
68
78
  value: a.value,
69
- mode: t.mode,
70
- "min-date": t.minDate,
79
+ mode: e.mode,
80
+ "min-date": e.minDate,
81
+ "max-date": e.maxDate,
82
+ "disabled-dates": e.disabledDates,
71
83
  class: "w-full",
72
- minuteInterval: t.minuteInterval,
73
- timeFormat: "12h",
74
- onChange: f
75
- }, null, 8, ["value", "mode", "min-date", "minuteInterval"])
84
+ minuteInterval: e.minuteInterval,
85
+ "time-format": "12h",
86
+ disabled: e.disabled,
87
+ readonly: e.readonly,
88
+ onChange: r
89
+ }, null, 8, ["value", "mode", "min-date", "max-date", "disabled-dates", "minuteInterval", "disabled", "readonly"])
76
90
  ])
77
91
  ]),
78
92
  _: 3
79
- }, 8, ["teleport"]));
93
+ }, 8, ["teleport", "disabled"])) : (c(), f(n(P), {
94
+ key: 1,
95
+ "model-value": a.value,
96
+ "onUpdate:modelValue": [
97
+ d[0] || (d[0] = (x) => a.value = x),
98
+ r
99
+ ],
100
+ mode: e.mode,
101
+ "min-date": e.minDate,
102
+ "max-date": e.maxDate,
103
+ "disabled-dates": e.disabledDates,
104
+ class: "w-full",
105
+ minuteInterval: e.minuteInterval,
106
+ "time-format": "12h",
107
+ disabled: e.disabled,
108
+ readonly: e.readonly
109
+ }, {
110
+ default: m(() => [
111
+ u(b, v({
112
+ text: i.value || e.placeholder || "Select date",
113
+ variant: e.variant || "outline",
114
+ size: e.size || "md",
115
+ icon: e.icon || (e.mode === "time" ? "lucide:clock" : "lucide:calendar"),
116
+ disabled: e.disabled
117
+ }, e.btnProps, { class: "w-full justify-start text-left font-normal" }), null, 16, ["text", "variant", "size", "icon", "disabled"])
118
+ ]),
119
+ _: 1
120
+ }, 8, ["model-value", "mode", "min-date", "max-date", "disabled-dates", "minuteInterval", "disabled", "readonly"]));
80
121
  }
81
122
  });
82
123
  export {
83
- N as default
124
+ $ as default
84
125
  };
@@ -1,4 +1,4 @@
1
- import { defineComponent as G, defineAsyncComponent as J, ref as B, computed as I, watch as C, toRef as Q, onMounted as W, onBeforeUnmount as X, openBlock as o, createElementBlock as c, createVNode as p, createCommentVNode as u, renderSlot as v, createElementVNode as g, unref as n, normalizeStyle as Y, normalizeClass as T, createBlock as m, Fragment as N, renderList as Z, withCtx as V, toDisplayString as ee, createSlots as te, mergeProps as le, nextTick as se } from "vue";
1
+ import { defineComponent as G, defineAsyncComponent as J, ref as B, computed as I, watch as C, toRef as Q, onMounted as W, onBeforeUnmount as X, openBlock as o, createElementBlock as c, createVNode as x, createCommentVNode as i, renderSlot as v, unref as n, normalizeStyle as Y, normalizeClass as T, createBlock as m, Fragment as N, renderList as Z, withCtx as V, createElementVNode as p, toDisplayString as ee, createSlots as te, mergeProps as le, nextTick as se } from "vue";
2
2
  import S from "../Icon.vue.js";
3
3
  import oe from "../Input.vue.js";
4
4
  import ne from "./DropdownItem.vue.js";
@@ -22,7 +22,7 @@ const ie = ["dir"], ue = {
22
22
  key: 3,
23
23
  class: "flex justify-center py-2"
24
24
  }, be = {
25
- key: 2,
25
+ key: 3,
26
26
  class: "shrink-0 border-t mt-1 pt-1"
27
27
  }, Ie = /* @__PURE__ */ G({
28
28
  __name: "DropdownMenu",
@@ -45,34 +45,34 @@ const ie = ["dir"], ue = {
45
45
  direction: { default: "ltr" }
46
46
  },
47
47
  emits: ["select", "close", "load-more", "search"],
48
- setup(r, { emit: _ }) {
49
- const j = J(() => import("./Dropdown.vue2.js")), t = r, i = _, M = B(null), f = B(""), { getMenuId: D, getAllRecursiveIds: E } = ae(), P = I(() => t.remote ? t.searchable : t.searchable && (t.options?.length || 0) > 9);
50
- let k = null;
48
+ setup(r, { emit: j }) {
49
+ const D = J(() => import("./Dropdown.vue2.js")), t = r, u = j, $ = B(null), f = B(""), { getMenuId: E, getAllRecursiveIds: P } = ae(), _ = I(() => t.remote ? t.searchable : t.searchable && (t.options?.length || 0) > 9);
50
+ let g = null;
51
51
  C(f, (e) => {
52
- t.remote && (k && clearTimeout(k), k = setTimeout(() => {
53
- e && i("search", e);
52
+ t.remote && (g && clearTimeout(g), g = setTimeout(() => {
53
+ e && u("search", e);
54
54
  }, 100));
55
55
  });
56
56
  const H = (e) => {
57
57
  const s = e.target;
58
- s.scrollTop + s.clientHeight >= s.scrollHeight - 50 && t.hasMore && !t.loading && i("load-more");
59
- }, b = (e, s) => {
60
- e.disabled || i("select", e);
58
+ s.scrollTop + s.clientHeight >= s.scrollHeight - 50 && t.hasMore && !t.loading && u("load-more");
59
+ }, k = (e, s) => {
60
+ e.disabled || u("select", e);
61
61
  }, {
62
62
  focusedIndex: h,
63
- isKeyboardMode: w,
63
+ isKeyboardMode: b,
64
64
  filteredOptions: R,
65
65
  // rename
66
- handleKeyDown: $,
66
+ handleKeyDown: M,
67
67
  handleMouseMove: O,
68
- onMouseEnterItem: x,
68
+ onMouseEnterItem: w,
69
69
  scrollToIndex: z
70
70
  } = ce({
71
71
  options: Q(t, "options"),
72
72
  searchQuery: f,
73
- containerRef: M,
74
- emit: (e, ...s) => i(e, ...s),
75
- handleSelect: (e, s) => b(e)
73
+ containerRef: $,
74
+ emit: (e, ...s) => u(e, ...s),
75
+ handleSelect: (e, s) => k(e)
76
76
  }), y = I(() => t.remote ? f.value ? t.options : t.cachedOptions.length ? t.cachedOptions : t.options : R.value), A = (e) => {
77
77
  if (!(!t.selected || typeof t.selected != "object") && e.key && e.key in t.selected)
78
78
  return t.selected[e.key];
@@ -84,7 +84,7 @@ const ie = ["dir"], ue = {
84
84
  key: s.key,
85
85
  data: s.data
86
86
  };
87
- i("select", l);
87
+ u("select", l);
88
88
  }, U = (e, s) => {
89
89
  let l = s.value;
90
90
  e.key && (l = { [e.key]: l });
@@ -94,7 +94,7 @@ const ie = ["dir"], ue = {
94
94
  data: s.data,
95
95
  key: e.key
96
96
  };
97
- i("select", d);
97
+ u("select", d);
98
98
  }, q = async () => {
99
99
  await se();
100
100
  let e = -1;
@@ -106,15 +106,15 @@ const ie = ["dir"], ue = {
106
106
  h.value = -1;
107
107
  }
108
108
  ), W(() => {
109
- q(), window.addEventListener("keydown", $);
109
+ q(), window.addEventListener("keydown", M);
110
110
  }), X(() => {
111
- window.removeEventListener("keydown", $);
111
+ window.removeEventListener("keydown", M);
112
112
  }), (e, s) => (o(), c("div", {
113
113
  class: "dropdown-menu w-full min-w-[150px] flex flex-col",
114
114
  dir: r.direction
115
115
  }, [
116
- P.value ? (o(), c("div", ue, [
117
- p(oe, {
116
+ _.value ? (o(), c("div", ue, [
117
+ x(oe, {
118
118
  modelValue: f.value,
119
119
  "onUpdate:modelValue": s[0] || (s[0] = (l) => f.value = l),
120
120
  placeholder: "Search...",
@@ -124,13 +124,14 @@ const ie = ["dir"], ue = {
124
124
  variant: "transparent",
125
125
  "show-clear-button": !1
126
126
  }, null, 8, ["modelValue"])
127
- ])) : u("", !0),
127
+ ])) : i("", !0),
128
128
  e.$slots.header ? (o(), c("div", fe, [
129
129
  v(e.$slots, "header")
130
- ])) : u("", !0),
131
- g("div", {
130
+ ])) : i("", !0),
131
+ t?.options.length > 0 || e.$slots.menu ? (o(), c("div", {
132
+ key: 2,
132
133
  ref_key: "containerRef",
133
- ref: M,
134
+ ref: $,
134
135
  tabindex: "0",
135
136
  role: "menu",
136
137
  class: T([
@@ -142,55 +143,55 @@ const ie = ["dir"], ue = {
142
143
  (...l) => n(O) && n(O)(...l)),
143
144
  onScroll: H
144
145
  }, [
145
- y.value.length === 0 && r.options?.length > 0 && !r.loading ? (o(), c("div", me, " No options found ")) : u("", !0),
146
+ y.value.length === 0 && r.options?.length > 0 && !r.loading ? (o(), c("div", me, " No options found ")) : i("", !0),
146
147
  r.layout === "grouped" ? (o(), m(de, {
147
148
  key: 1,
148
149
  options: y.value,
149
150
  selected: r.selected,
150
151
  selectable: r.selectable,
151
152
  columns: r.columns,
152
- onSelect: b
153
+ onSelect: k
153
154
  }, null, 8, ["options", "selected", "selectable", "columns"])) : (o(!0), c(N, { key: 2 }, Z(y.value, (l, d) => (o(), c(N, { key: d }, [
154
155
  l.label === "---" ? (o(), c("div", he)) : l.data?.isBoolean ? (o(), m(re, {
155
156
  key: 1,
156
157
  option: l,
157
158
  value: F(l),
158
- focused: n(w) && n(h) === d,
159
+ focused: n(b) && n(h) === d,
159
160
  onChange: K,
160
- onMouseenter: (a) => n(x)(d)
161
- }, null, 8, ["option", "value", "focused", "onMouseenter"])) : l.children && l.children.length > 0 ? (o(), m(n(j), {
161
+ onMouseenter: (a) => n(w)(d)
162
+ }, null, 8, ["option", "value", "focused", "onMouseenter"])) : l.children && l.children.length > 0 ? (o(), m(n(D), {
162
163
  key: 2,
163
164
  position: l.position || t.nestedPosition,
164
165
  offset: l.offset || t.nestedOffset,
165
166
  class: "w-full",
166
167
  options: l.children,
167
168
  selected: A(l),
168
- menuId: n(D)(l),
169
+ menuId: n(E)(l),
169
170
  nestedPosition: t.nestedPosition,
170
171
  nestedOffset: t.nestedOffset,
171
172
  selectable: t.selectable,
172
- ignoreClickOutside: n(E)(l.children),
173
+ ignoreClickOutside: n(P)(l.children),
173
174
  direction: r.direction,
174
175
  onOnSelect: (a) => U(l, a)
175
176
  }, {
176
177
  trigger: V(() => [
177
- g("div", {
178
+ p("div", {
178
179
  "data-dropdown-item": "",
179
180
  class: T(["relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm font-medium outline-none transition-colors justify-between w-full", [
180
- n(w) && n(h) === d ? "bg-accent text-accent-foreground" : "hover:bg-accent hover:text-accent-foreground",
181
+ n(b) && n(h) === d ? "bg-accent text-accent-foreground" : "hover:bg-accent hover:text-accent-foreground",
181
182
  l.disabled ? "opacity-50 cursor-not-allowed" : ""
182
183
  ]]),
183
- onMouseenter: (a) => n(x)(d)
184
+ onMouseenter: (a) => n(w)(d)
184
185
  }, [
185
- g("div", ve, [
186
+ p("div", ve, [
186
187
  l.icon ? (o(), m(S, {
187
188
  key: 0,
188
189
  icon: l.icon,
189
190
  class: "mr-2 h-4 w-4 shrink-0 mt-0.5"
190
- }, null, 8, ["icon"])) : u("", !0),
191
- g("span", ge, ee(l.label), 1)
191
+ }, null, 8, ["icon"])) : i("", !0),
192
+ p("span", ge, ee(l.label), 1)
192
193
  ]),
193
- p(S, {
194
+ x(S, {
194
195
  icon: r.direction === "rtl" ? "lucide:chevron-left" : "lucide:chevron-right",
195
196
  class: "h-4 w-4 text-muted-foreground shrink-0 ml-2"
196
197
  }, null, 8, ["icon"])
@@ -202,10 +203,10 @@ const ie = ["dir"], ue = {
202
203
  option: l,
203
204
  index: d,
204
205
  selected: L(l),
205
- focused: n(w) && n(h) === d,
206
+ focused: n(b) && n(h) === d,
206
207
  selectable: r.selectable,
207
- onClick: (a) => b(l),
208
- onMouseenter: (a) => n(x)(d)
208
+ onClick: (a) => k(l),
209
+ onMouseenter: (a) => n(w)(d)
209
210
  }, te({ _: 2 }, [
210
211
  e.$slots.item ? {
211
212
  name: "default",
@@ -217,16 +218,16 @@ const ie = ["dir"], ue = {
217
218
  ]), 1032, ["option", "index", "selected", "focused", "selectable", "onClick", "onMouseenter"]))
218
219
  ], 64))), 128)),
219
220
  r.loading ? (o(), c("div", ke, [
220
- p(S, {
221
+ x(S, {
221
222
  icon: "lucide:loader-2",
222
223
  class: "w-4 h-4 animate-spin text-muted-foreground"
223
224
  })
224
- ])) : u("", !0),
225
+ ])) : i("", !0),
225
226
  v(e.$slots, "menu")
226
- ], 38),
227
+ ], 38)) : i("", !0),
227
228
  e.$slots.footer ? (o(), c("div", be, [
228
229
  v(e.$slots, "footer")
229
- ])) : u("", !0)
230
+ ])) : i("", !0)
230
231
  ], 8, ie));
231
232
  }
232
233
  });