vlite3 0.5.9 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,24 @@
1
+ import { ButtonSize } from '../types';
2
+ export interface BackButtonProps {
3
+ /** Icon to display, defaults to a left arrow */
4
+ icon?: string;
5
+ /** Button size variant */
6
+ size?: ButtonSize;
7
+ /** Tooltip text shown on hover */
8
+ tooltip?: string;
9
+ /** Custom CSS classes */
10
+ class?: string;
11
+ /**
12
+ * Fallback path when there's no browser history to go back to.
13
+ * Defaults to '/'
14
+ */
15
+ fallback?: string;
16
+ }
17
+ declare const _default: import('vue').DefineComponent<BackButtonProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<BackButtonProps> & Readonly<{}>, {
18
+ size: ButtonSize;
19
+ icon: string;
20
+ class: string;
21
+ fallback: string;
22
+ tooltip: string;
23
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLButtonElement>;
24
+ export default _default;
@@ -0,0 +1,31 @@
1
+ import { defineComponent as l, openBlock as c, createBlock as s, normalizeClass as i } from "vue";
2
+ import { useRouter as n } from "vue-router";
3
+ import r from "./Button.vue.js";
4
+ const p = /* @__PURE__ */ l({
5
+ __name: "BackButton",
6
+ props: {
7
+ icon: { default: "heroicons-solid:arrow-left" },
8
+ size: { default: "sm" },
9
+ tooltip: { default: "Go back" },
10
+ class: { default: "" },
11
+ fallback: { default: "/" }
12
+ },
13
+ setup(o) {
14
+ const t = o, e = n();
15
+ function a() {
16
+ window.history.state?.back ? e.back() : e.push(t.fallback);
17
+ }
18
+ return (f, u) => (c(), s(r, {
19
+ variant: "ghost",
20
+ icon: o.icon,
21
+ size: o.size,
22
+ rounded: "full",
23
+ title: o.tooltip,
24
+ class: i(t.class),
25
+ onClick: a
26
+ }, null, 8, ["icon", "size", "title", "class"]));
27
+ }
28
+ });
29
+ export {
30
+ p as default
31
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./BackButton.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -31,7 +31,7 @@ const V = ["role", "tabindex"], j = {
31
31
  case "small":
32
32
  return "h-5.5 text-[11px] px-2.5 gap-1";
33
33
  case "large":
34
- return "h-8 text-sm px-3 gap-2";
34
+ return "h-7 text-sm px-3 gap-2";
35
35
  default:
36
36
  return "h-6 text-xs px-2.5 gap-1.5";
37
37
  }
@@ -14,6 +14,7 @@ type __VLS_Props = {
14
14
  size?: ButtonSize;
15
15
  variant?: ButtonVariant;
16
16
  showQuickRanges?: boolean;
17
+ triggerClass?: string;
17
18
  };
18
19
  declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
19
20
  change: (...args: any[]) => void;
@@ -6,10 +6,10 @@ import { $t as l } from "../utils/i18n.js";
6
6
  import P from "./Button.vue.js";
7
7
  import p from "v-datepicker-lite";
8
8
  import "v-datepicker-lite/style.css";
9
- const $ = { class: "flex items-center gap-2" }, H = { class: "flex flex-col sm:flex-row bg-background rounded-md" }, Q = {
9
+ const $ = { class: "flex items-center justify-between gap-2 w-full" }, j = { class: "flex flex-col sm:flex-row bg-background rounded-md" }, H = {
10
10
  key: 0,
11
11
  class: "flex flex-col gap-1 sm:pr-3 py-2 sm:border-r border-border max-h-[280px]"
12
- }, j = { class: "flex flex-col sm:flex-row items-center gap-4 py-2 p-3" }, O = { class: "border border-border rounded-md overflow-hidden bg-background" }, I = { class: "flex items-center justify-center shrink-0" }, U = { class: "border border-border rounded-md overflow-hidden bg-background" }, ee = /* @__PURE__ */ V({
12
+ }, Q = { class: "flex flex-col sm:flex-row items-center gap-4 py-2 p-3" }, O = { class: "border border-border rounded-md overflow-hidden bg-background" }, I = { class: "flex items-center justify-center shrink-0" }, U = { class: "border border-border rounded-md overflow-hidden bg-background" }, ee = /* @__PURE__ */ V({
13
13
  __name: "DateRangePicker",
14
14
  props: {
15
15
  modelValue: {},
@@ -21,18 +21,19 @@ const $ = { class: "flex items-center gap-2" }, H = { class: "flex flex-col sm:f
21
21
  readonly: { type: Boolean },
22
22
  size: {},
23
23
  variant: {},
24
- showQuickRanges: { type: Boolean, default: !0 }
24
+ showQuickRanges: { type: Boolean, default: !0 },
25
+ triggerClass: {}
25
26
  },
26
27
  emits: ["update:modelValue", "change"],
27
28
  setup(r, { emit: M }) {
28
- const v = r, D = M, o = w(!1), c = w(0);
29
+ const v = r, b = M, o = w(!1), c = w(0);
29
30
  L(o, (t) => {
30
31
  t && c.value++;
31
32
  });
32
33
  const n = u({
33
34
  get: () => v.modelValue || { start: null, end: null },
34
35
  set: (t) => {
35
- D("update:modelValue", t), D("change", t);
36
+ b("update:modelValue", t), b("change", t);
36
37
  }
37
38
  }), Y = (t) => {
38
39
  n.value = { ...n.value, start: t };
@@ -44,13 +45,13 @@ const $ = { class: "flex items-center gap-2" }, H = { class: "flex flex-col sm:f
44
45
  if (!isNaN(t.getTime())) return t.toISOString();
45
46
  }
46
47
  return v.maxDate;
47
- }), N = u(() => {
48
+ }), C = u(() => {
48
49
  if (n.value.start) {
49
50
  const t = new Date(n.value.start);
50
51
  if (!isNaN(t.getTime())) return t.toISOString();
51
52
  }
52
53
  return v.minDate;
53
- }), b = (t) => {
54
+ }), D = (t) => {
54
55
  if (!t) return "";
55
56
  try {
56
57
  const e = new Date(t);
@@ -58,7 +59,7 @@ const $ = { class: "flex items-center gap-2" }, H = { class: "flex flex-col sm:f
58
59
  } catch {
59
60
  return "";
60
61
  }
61
- }, C = u(() => [
62
+ }, N = u(() => [
62
63
  {
63
64
  label: l("vlite.dateRangePicker.today") !== "vlite.dateRangePicker.today" ? l("vlite.dateRangePicker.today") : "Today",
64
65
  value: "today",
@@ -152,30 +153,30 @@ const $ = { class: "flex items-center gap-2" }, H = { class: "flex flex-col sm:f
152
153
  variant: r.variant || "outline",
153
154
  size: r.size || "md",
154
155
  disabled: r.disabled,
155
- class: k(["w-full sm:min-w-[280px] justify-start text-left font-normal", { "ring-2 ring-ring ring-offset-2": a }])
156
+ class: k(["w-max justify-between text-left font-normal", [r.triggerClass, { "ring-1 ring-ring ring-offset-[1]": a }]])
156
157
  }, {
157
158
  default: y(() => [
158
159
  i("div", $, [
159
160
  i("span", {
160
161
  class: k({ "text-muted-foreground": !n.value.start })
161
- }, R(n.value.start ? b(n.value.start) : r.placeholderStart), 3),
162
+ }, R(n.value.start ? D(n.value.start) : r.placeholderStart), 3),
162
163
  g(f, {
163
164
  icon: "lucide:arrow-right",
164
- class: "w-4 h-4 text-muted-foreground opacity-50 shrink-0"
165
+ class: "w-4 h-4 text-muted-foreground opacity-60 shrink-0"
165
166
  }),
166
167
  i("span", {
167
168
  class: k({ "text-muted-foreground": !n.value.end })
168
- }, R(n.value.end ? b(n.value.end) : r.placeholderEnd), 3)
169
+ }, R(n.value.end ? D(n.value.end) : r.placeholderEnd), 3)
169
170
  ])
170
171
  ]),
171
172
  _: 1
172
173
  }, 8, ["variant", "size", "disabled", "class"])
173
174
  ]),
174
175
  menu: y(() => [
175
- i("div", H, [
176
- r.showQuickRanges ? (d(), x("div", Q, [
176
+ i("div", j, [
177
+ r.showQuickRanges ? (d(), x("div", H, [
177
178
  e[1] || (e[1] = i("div", { class: "text-xs pl-2 pb-2 font-semibold text-muted-foreground uppercase tracking-wider" }, " Quick Ranges ", -1)),
178
- (d(!0), x(z, null, B(C.value, (a) => (d(), m(P, {
179
+ (d(!0), x(z, null, B(N.value, (a) => (d(), m(P, {
179
180
  key: a.value,
180
181
  text: a.label,
181
182
  icon: a.icon,
@@ -185,7 +186,7 @@ const $ = { class: "flex items-center gap-2" }, H = { class: "flex flex-col sm:f
185
186
  onClick: (s) => F(a)
186
187
  }, null, 8, ["text", "icon", "onClick"]))), 128))
187
188
  ])) : E("", !0),
188
- i("div", j, [
189
+ i("div", Q, [
189
190
  i("div", O, [
190
191
  (d(), m(h(p), {
191
192
  key: "start-" + c.value,
@@ -214,7 +215,7 @@ const $ = { class: "flex items-center gap-2" }, H = { class: "flex flex-col sm:f
214
215
  value: n.value.end,
215
216
  onChange: _,
216
217
  mode: "date",
217
- "min-date": N.value,
218
+ "min-date": C.value,
218
219
  "max-date": r.maxDate,
219
220
  disabled: r.disabled,
220
221
  readonly: r.readonly
@@ -1,4 +1,4 @@
1
- import { defineComponent as U, computed as o, markRaw as I, openBlock as r, createBlock as f, mergeProps as u, toHandlers as S, createSlots as N, unref as R, withCtx as n, createVNode as z, createTextVNode as c, toDisplayString as m, createCommentVNode as L, resolveDynamicComponent as B } from "vue";
1
+ import { defineComponent as U, computed as o, markRaw as I, openBlock as r, createBlock as f, mergeProps as s, toHandlers as S, createSlots as N, unref as R, withCtx as n, createVNode as z, createTextVNode as c, toDisplayString as m, createCommentVNode as L, resolveDynamicComponent as B } from "vue";
2
2
  import { isComponent as h, isAddonObject as p } from "./utils/form.utils.js";
3
3
  import O from "../NumberInput.vue.js";
4
4
  import v from "../Button.vue.js";
@@ -15,7 +15,7 @@ import G from "../DatePicker.vue.js";
15
15
  import J from "../ColorPicker/ColorPicker.vue.js";
16
16
  import K from "../IconPicker.vue.js";
17
17
  import M from "./CustomFields.vue.js";
18
- const se = /* @__PURE__ */ U({
18
+ const ue = /* @__PURE__ */ U({
19
19
  __name: "FormField",
20
20
  props: {
21
21
  field: {},
@@ -32,10 +32,10 @@ const se = /* @__PURE__ */ U({
32
32
  },
33
33
  emits: ["change", "addonChange", "addonAction"],
34
34
  setup(l, { emit: $ }) {
35
- const e = l, s = $, d = (t, a) => {
36
- s("change", { value: t, data: a });
35
+ const e = l, u = $, d = (t, a) => {
36
+ u("change", { value: t, data: a });
37
37
  }, w = (t) => {
38
- s("change", { value: t });
38
+ u("change", { value: t });
39
39
  }, C = o(() => {
40
40
  const t = e.field.type;
41
41
  if (h(t))
@@ -111,7 +111,7 @@ const se = /* @__PURE__ */ U({
111
111
  max: e.field.max,
112
112
  step: e.field.props?.step ?? 1,
113
113
  variant: e.field.props?.variant ?? "split",
114
- mode: e.field.props?.mode ?? "outline",
114
+ mode: e.field.props?.mode ?? (e.variant === "transparent" ? "ghost" : "outline"),
115
115
  size: e.size,
116
116
  rounded: e.rounded,
117
117
  placeholder: i,
@@ -232,18 +232,18 @@ const se = /* @__PURE__ */ U({
232
232
  const t = e.field.type;
233
233
  return t === "text" || t === "email" || t === "password" || t === "tel" || t === "url" || t === "search" || !t;
234
234
  }), P = o(() => F.value && A.value), V = (t, a) => {
235
- s("addonChange", t.name, { value: a.value });
235
+ u("addonChange", t.name, { value: a.value });
236
236
  }, k = (t) => {
237
- t.action && s("addonAction", t.action);
237
+ t.action && u("addonAction", t.action);
238
238
  };
239
- return (t, a) => P.value ? (r(), f(g, u({ key: 0 }, {
239
+ return (t, a) => P.value ? (r(), f(g, s({ key: 0 }, {
240
240
  ...b.value,
241
241
  ...l.field?.props || {}
242
242
  }, S(x.value)), N({ _: 2 }, [
243
243
  R(p)(l.field.addonLeft) ? {
244
244
  name: "addon-left",
245
245
  fn: n(() => [
246
- l.field.addonLeft.type === "select" ? (r(), f(y, u({
246
+ l.field.addonLeft.type === "select" ? (r(), f(y, s({
247
247
  key: 0,
248
248
  modelValue: l.field.addonLeft.name ? l.values[l.field.addonLeft.name] : void 0,
249
249
  options: l.field.addonLeft.options || []
@@ -259,7 +259,7 @@ const se = /* @__PURE__ */ U({
259
259
  }, 1024)
260
260
  ]),
261
261
  _: 1
262
- }, 16, ["modelValue", "options"])) : l.field.addonLeft.type === "button" ? (r(), f(v, u({
262
+ }, 16, ["modelValue", "options"])) : l.field.addonLeft.type === "button" ? (r(), f(v, s({
263
263
  key: 1,
264
264
  variant: "outline"
265
265
  }, l.field.addonLeft.props || {}, {
@@ -276,7 +276,7 @@ const se = /* @__PURE__ */ U({
276
276
  R(p)(l.field.addonRight) ? {
277
277
  name: "addon-right",
278
278
  fn: n(() => [
279
- l.field.addonRight.type === "select" ? (r(), f(y, u({
279
+ l.field.addonRight.type === "select" ? (r(), f(y, s({
280
280
  key: 0,
281
281
  modelValue: l.field.addonRight.name ? l.values[l.field.addonRight.name] : void 0,
282
282
  options: l.field.addonRight.options || []
@@ -292,7 +292,7 @@ const se = /* @__PURE__ */ U({
292
292
  }, 1024)
293
293
  ]),
294
294
  _: 1
295
- }, 16, ["modelValue", "options"])) : l.field.addonRight.type === "button" ? (r(), f(v, u({
295
+ }, 16, ["modelValue", "options"])) : l.field.addonRight.type === "button" ? (r(), f(v, s({
296
296
  key: 1,
297
297
  variant: "outline"
298
298
  }, l.field.addonRight.props || {}, {
@@ -306,7 +306,7 @@ const se = /* @__PURE__ */ U({
306
306
  ]),
307
307
  key: "1"
308
308
  } : void 0
309
- ]), 1040)) : (r(), f(B(C.value), u({
309
+ ]), 1040)) : (r(), f(B(C.value), s({
310
310
  key: 1,
311
311
  class: ["switch", "check"].includes(l.field?.type) ? "" : "w-full"
312
312
  }, {
@@ -316,5 +316,5 @@ const se = /* @__PURE__ */ U({
316
316
  }
317
317
  });
318
318
  export {
319
- se as default
319
+ ue as default
320
320
  };