v-datepicker-lite 0.0.3 → 0.0.5

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 (4) hide show
  1. package/README.md +9 -13
  2. package/index.js +328 -316
  3. package/package.json +1 -1
  4. package/style.css +1 -1
package/README.md CHANGED
@@ -191,22 +191,18 @@ Customize the appearance using the following CSS variables defined in `style.css
191
191
 
192
192
  ```css
193
193
  :root {
194
- --date-picker-primary: #4f46e5; /* Primary color for selected items */
195
- --date-picker-primary-fg: #ffffff; /* Foreground color for selected items */
196
- --date-picker-text: #374151; /* Text color */
197
- --date-picker-border: #d1d5db; /* Border color */
198
- --date-picker-secondary: #f7f7f9; /* Secondary background color */
199
- --date-picker-disabled: #9ca3af; /* Disabled item color */
200
- --date-picker-today: #fef3c7; /* Today highlight color */
201
- --date-picker-radius: 0.375em; /* Border radius */
202
- --date-picker-hover: #f3f4f6; /* Hover background color */
194
+ --date-picker-primary: #2d66ed;
195
+ --date-picker-primary-fg: #ffffff;
196
+ --date-picker-text: inherit;
197
+ --date-picker-border: #00000020;
198
+ --date-picker-secondary: #00000010;
199
+ --date-picker-hover: #00000010;
200
+ --date-picker-disabled: #000000b4;
201
+ --date-picker-today: #00000010;
202
+ --date-picker-radius: 0.375em;
203
203
  }
204
204
  ```
205
205
 
206
206
  ## Author
207
207
 
208
208
  [safdar-azeem](https://github.com/safdar-azeem)
209
-
210
- ## License
211
-
212
- MIT
package/index.js CHANGED
@@ -1,30 +1,30 @@
1
- import { defineComponent as I, computed as S, createElementBlock as p, openBlock as v, createElementVNode as h, Fragment as Y, renderList as T, unref as o, toDisplayString as P, normalizeClass as x, ref as F, watch as L, nextTick as G, onMounted as U, createBlock as V, createCommentVNode as N, normalizeStyle as X, createVNode as Z } from "vue";
2
- const R = (t, r = "YYYY-MM-DD") => {
3
- const e = t.getFullYear(), u = String(t.getMonth() + 1).padStart(2, "0"), n = String(t.getDate()).padStart(2, "0"), d = String(t.getHours()).padStart(2, "0"), i = String(t.getMinutes()).padStart(2, "0");
4
- return r.replace("YYYY", e.toString()).replace("MM", u).replace("DD", n).replace("HH", d).replace("mm", i);
1
+ import { defineComponent as q, computed as Y, createElementBlock as D, openBlock as v, createElementVNode as p, Fragment as C, renderList as H, unref as o, toDisplayString as x, normalizeClass as I, ref as N, watch as O, nextTick as B, onMounted as R, createBlock as z, createCommentVNode as G, normalizeStyle as Q, createVNode as X } from "vue";
2
+ const U = (t, r = "YYYY-MM-DD") => {
3
+ const e = t.getFullYear(), u = String(t.getMonth() + 1).padStart(2, "0"), s = String(t.getDate()).padStart(2, "0"), d = String(t.getHours()).padStart(2, "0"), i = String(t.getMinutes()).padStart(2, "0"), a = String(t.getSeconds()).padStart(2, "0"), n = String(t.getMilliseconds()).padStart(3, "0");
4
+ return r.replace("YYYY", e.toString()).replace("MM", u).replace("DD", s).replace("HH", d).replace("mm", i).replace("ss", a).replace("sss", n);
5
5
  }, W = (t) => {
6
6
  if (!t) return null;
7
7
  const r = new Date(t);
8
8
  return isNaN(r.getTime()) ? null : r;
9
- }, q = (t, r) => t.getFullYear() === r.getFullYear() && t.getMonth() === r.getMonth() && t.getDate() === r.getDate(), ee = (t) => {
9
+ }, L = (t, r) => t.getFullYear() === r.getFullYear() && t.getMonth() === r.getMonth() && t.getDate() === r.getDate(), ee = (t) => {
10
10
  const r = new Date(t.getFullYear(), 0, 1), e = (t.getTime() - r.getTime()) / 864e5;
11
11
  return Math.ceil((e + r.getDay() + 1) / 7);
12
- }, E = (t, r) => {
13
- const e = new Date(t, r, 1), n = new Date(t, r + 1, 0).getDate(), d = e.getDay(), i = [], a = /* @__PURE__ */ new Date(), l = r === 0 ? 11 : r - 1, m = r === 0 ? t - 1 : t, D = new Date(m, l + 1, 0).getDate();
12
+ }, Z = (t, r) => {
13
+ const e = new Date(t, r, 1), s = new Date(t, r + 1, 0).getDate(), d = e.getDay(), i = [], a = /* @__PURE__ */ new Date(), n = r === 0 ? 11 : r - 1, m = r === 0 ? t - 1 : t, g = new Date(m, n + 1, 0).getDate();
14
14
  for (let f = d - 1; f >= 0; f--) {
15
- const c = new Date(m, l, D - f);
15
+ const c = new Date(m, n, g - f);
16
16
  i.push({
17
17
  date: c,
18
- day: D - f,
19
- month: l,
18
+ day: g - f,
19
+ month: n,
20
20
  year: m,
21
21
  isCurrentMonth: !1,
22
- isToday: q(c, a),
22
+ isToday: L(c, a),
23
23
  isSelected: !1,
24
24
  isDisabled: !1
25
25
  });
26
26
  }
27
- for (let f = 1; f <= n; f++) {
27
+ for (let f = 1; f <= s; f++) {
28
28
  const c = new Date(t, r, f);
29
29
  i.push({
30
30
  date: c,
@@ -32,30 +32,30 @@ const R = (t, r = "YYYY-MM-DD") => {
32
32
  month: r,
33
33
  year: t,
34
34
  isCurrentMonth: !0,
35
- isToday: q(c, a),
35
+ isToday: L(c, a),
36
36
  isSelected: !1,
37
37
  isDisabled: !1
38
38
  });
39
39
  }
40
- const s = 42 - i.length, M = r === 11 ? 0 : r + 1, k = r === 11 ? t + 1 : t;
41
- for (let f = 1; f <= s; f++) {
42
- const c = new Date(k, M, f);
40
+ const l = 42 - i.length, b = r === 11 ? 0 : r + 1, k = r === 11 ? t + 1 : t;
41
+ for (let f = 1; f <= l; f++) {
42
+ const c = new Date(k, b, f);
43
43
  i.push({
44
44
  date: c,
45
45
  day: f,
46
- month: M,
46
+ month: b,
47
47
  year: k,
48
48
  isCurrentMonth: !1,
49
- isToday: q(c, a),
49
+ isToday: L(c, a),
50
50
  isSelected: !1,
51
51
  isDisabled: !1
52
52
  });
53
53
  }
54
54
  return i;
55
55
  }, te = (t, r) => {
56
- const e = E(t, r), u = [];
57
- for (let n = 0; n < e.length; n += 7) {
58
- const d = e.slice(n, n + 7), i = ee(d[0].date);
56
+ const e = Z(t, r), u = [];
57
+ for (let s = 0; s < e.length; s += 7) {
58
+ const d = e.slice(s, s + 7), i = ee(d[0].date);
59
59
  u.push({
60
60
  weekNumber: i,
61
61
  days: d,
@@ -63,7 +63,7 @@ const R = (t, r = "YYYY-MM-DD") => {
63
63
  });
64
64
  }
65
65
  return u;
66
- }, j = (t) => [
66
+ }, E = (t) => [
67
67
  "January",
68
68
  "February",
69
69
  "March",
@@ -83,9 +83,9 @@ const R = (t, r = "YYYY-MM-DD") => {
83
83
  isSelected: !1,
84
84
  isDisabled: !1
85
85
  })), ae = (t, r, e, u) => {
86
- const n = R(t, "YYYY-MM-DD");
87
- return r && n < r || e && n > e ? !0 : u ? u.some((d) => d.end ? n >= d.start && n <= d.end : n === d.start) : !1;
88
- }, O = [
86
+ const s = U(t, "YYYY-MM-DD");
87
+ return r && s < r || e && s > e ? !0 : u ? u.some((d) => d.end ? s >= d.start && s <= d.end : s === d.start) : !1;
88
+ }, A = [
89
89
  "January",
90
90
  "February",
91
91
  "March",
@@ -98,7 +98,7 @@ const R = (t, r = "YYYY-MM-DD") => {
98
98
  "October",
99
99
  "November",
100
100
  "December"
101
- ], K = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], ne = { class: "date-picker-content" }, le = { class: "date-picker-table" }, se = { class: "date-picker-weekdays-row" }, re = { class: "date-picker-days-body" }, oe = ["onClick", "disabled"], ce = /* @__PURE__ */ I({
101
+ ], j = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], ne = { class: "date-picker-content" }, se = { class: "date-picker-table" }, le = { class: "date-picker-weekdays-row" }, re = { class: "date-picker-days-body" }, oe = ["onClick", "disabled"], ce = /* @__PURE__ */ q({
102
102
  __name: "DateView",
103
103
  props: {
104
104
  currentDate: {},
@@ -109,47 +109,47 @@ const R = (t, r = "YYYY-MM-DD") => {
109
109
  },
110
110
  emits: ["select"],
111
111
  setup(t, { emit: r }) {
112
- const e = t, u = r, n = S(() => E(e.currentDate.getFullYear(), e.currentDate.getMonth()).map((l) => ({
113
- ...l,
114
- isSelected: e.selectedDate ? q(l.date, e.selectedDate) : !1,
115
- isDisabled: ae(l.date, e.minDate, e.maxDate, e.disabledDates)
116
- }))), d = S(() => {
112
+ const e = t, u = r, s = Y(() => Z(e.currentDate.getFullYear(), e.currentDate.getMonth()).map((n) => ({
113
+ ...n,
114
+ isSelected: e.selectedDate ? L(n.date, e.selectedDate) : !1,
115
+ isDisabled: ae(n.date, e.minDate, e.maxDate, e.disabledDates)
116
+ }))), d = Y(() => {
117
117
  const a = [];
118
- for (let l = 0; l < n.value.length; l += 7)
119
- a.push(n.value.slice(l, l + 7));
118
+ for (let n = 0; n < s.value.length; n += 7)
119
+ a.push(s.value.slice(n, n + 7));
120
120
  return a;
121
121
  }), i = (a) => {
122
122
  a.isDisabled || u("select", a.date);
123
123
  };
124
- return (a, l) => (v(), p("div", ne, [
125
- h("table", le, [
126
- h("thead", null, [
127
- h("tr", se, [
128
- (v(!0), p(Y, null, T(o(K), (m) => (v(), p("th", { key: m }, P(m), 1))), 128))
124
+ return (a, n) => (v(), D("div", ne, [
125
+ p("table", se, [
126
+ p("thead", null, [
127
+ p("tr", le, [
128
+ (v(!0), D(C, null, H(o(j), (m) => (v(), D("th", { key: m }, x(m), 1))), 128))
129
129
  ])
130
130
  ]),
131
- h("tbody", re, [
132
- (v(!0), p(Y, null, T(d.value, (m, D) => (v(), p("tr", {
133
- key: D,
131
+ p("tbody", re, [
132
+ (v(!0), D(C, null, H(d.value, (m, g) => (v(), D("tr", {
133
+ key: g,
134
134
  class: "date-picker-week-row"
135
135
  }, [
136
- (v(!0), p(Y, null, T(m, (s) => (v(), p("td", {
137
- key: `${s.year}-${s.month}-${s.day}`,
136
+ (v(!0), D(C, null, H(m, (l) => (v(), D("td", {
137
+ key: `${l.year}-${l.month}-${l.day}`,
138
138
  class: "date-picker-day-cell"
139
139
  }, [
140
- h("button", {
141
- class: x([
140
+ p("button", {
141
+ class: I([
142
142
  "date-picker-day",
143
143
  {
144
- "other-month": !s.isCurrentMonth,
145
- today: s.isToday,
146
- selected: s.isSelected,
147
- disabled: s.isDisabled
144
+ "other-month": !l.isCurrentMonth,
145
+ today: l.isToday,
146
+ selected: l.isSelected,
147
+ disabled: l.isDisabled
148
148
  }
149
149
  ]),
150
- onClick: (M) => i(s),
151
- disabled: s.isDisabled
152
- }, P(s.day), 11, oe)
150
+ onClick: (b) => i(l),
151
+ disabled: l.isDisabled
152
+ }, x(l.day), 11, oe)
153
153
  ]))), 128))
154
154
  ]))), 128))
155
155
  ])
@@ -160,7 +160,7 @@ const R = (t, r = "YYYY-MM-DD") => {
160
160
  class: "date-picker-table date-picker-week-table",
161
161
  cellpadding: "0",
162
162
  cellspacing: "0"
163
- }, de = { class: "date-picker-weekdays-row" }, me = { class: "date-picker-weeks-body" }, ve = ["onClick"], he = { class: "date-picker-week-number-cell" }, pe = { class: "date-picker-week-number" }, ge = /* @__PURE__ */ I({
163
+ }, de = { class: "date-picker-weekdays-row" }, me = { class: "date-picker-weeks-body" }, ve = ["onClick"], he = { class: "date-picker-week-number-cell" }, pe = { class: "date-picker-week-number" }, De = /* @__PURE__ */ q({
164
164
  __name: "WeekView",
165
165
  props: {
166
166
  currentDate: {},
@@ -168,52 +168,52 @@ const R = (t, r = "YYYY-MM-DD") => {
168
168
  },
169
169
  emits: ["select"],
170
170
  setup(t, { emit: r }) {
171
- const e = t, u = r, n = S(() => te(e.currentDate.getFullYear(), e.currentDate.getMonth()).map((a) => {
172
- const l = e.selectedDate ? a.days.some((m) => q(m.date, e.selectedDate)) : !1;
171
+ const e = t, u = r, s = Y(() => te(e.currentDate.getFullYear(), e.currentDate.getMonth()).map((a) => {
172
+ const n = e.selectedDate ? a.days.some((m) => L(m.date, e.selectedDate)) : !1;
173
173
  return {
174
174
  ...a,
175
- isSelected: l
175
+ isSelected: n
176
176
  };
177
177
  })), d = (i) => {
178
- var l;
179
- const a = ((l = i.days.find((m) => m.isCurrentMonth)) == null ? void 0 : l.date) || i.days[0].date;
178
+ var n;
179
+ const a = ((n = i.days.find((m) => m.isCurrentMonth)) == null ? void 0 : n.date) || i.days[0].date;
180
180
  u("select", a);
181
181
  };
182
- return (i, a) => (v(), p("div", ie, [
183
- h("table", ue, [
184
- h("thead", null, [
185
- h("tr", de, [
186
- a[0] || (a[0] = h("th", { class: "date-picker-weekday date-picker-week-header" }, "Wk", -1)),
187
- (v(!0), p(Y, null, T(o(K), (l) => (v(), p("th", { key: l }, P(l), 1))), 128))
182
+ return (i, a) => (v(), D("div", ie, [
183
+ p("table", ue, [
184
+ p("thead", null, [
185
+ p("tr", de, [
186
+ a[0] || (a[0] = p("th", { class: "date-picker-weekday date-picker-week-header" }, "Wk", -1)),
187
+ (v(!0), D(C, null, H(o(j), (n) => (v(), D("th", { key: n }, x(n), 1))), 128))
188
188
  ])
189
189
  ]),
190
- h("tbody", me, [
191
- (v(!0), p(Y, null, T(n.value, (l) => (v(), p("tr", {
192
- key: l.weekNumber,
193
- class: x([
190
+ p("tbody", me, [
191
+ (v(!0), D(C, null, H(s.value, (n) => (v(), D("tr", {
192
+ key: n.weekNumber,
193
+ class: I([
194
194
  "date-picker-week-row",
195
195
  {
196
- selected: l.isSelected
196
+ selected: n.isSelected
197
197
  }
198
198
  ]),
199
- onClick: (m) => d(l)
199
+ onClick: (m) => d(n)
200
200
  }, [
201
- h("td", he, [
202
- h("div", pe, P(l.weekNumber), 1)
201
+ p("td", he, [
202
+ p("div", pe, x(n.weekNumber), 1)
203
203
  ]),
204
- (v(!0), p(Y, null, T(l.days, (m) => (v(), p("td", {
204
+ (v(!0), D(C, null, H(n.days, (m) => (v(), D("td", {
205
205
  key: `${m.year}-${m.month}-${m.day}`,
206
206
  class: "date-picker-day-cell"
207
207
  }, [
208
- h("button", {
209
- class: x([
208
+ p("button", {
209
+ class: I([
210
210
  "date-picker-day",
211
211
  {
212
212
  "other-month": !m.isCurrentMonth,
213
213
  today: m.isToday
214
214
  }
215
215
  ])
216
- }, P(m.day), 3)
216
+ }, x(m.day), 3)
217
217
  ]))), 128))
218
218
  ], 10, ve))), 128))
219
219
  ])
@@ -221,79 +221,79 @@ const R = (t, r = "YYYY-MM-DD") => {
221
221
  ]));
222
222
  }
223
223
  });
224
- function De(t, r = "24h", e = 15, u) {
225
- const n = F(0), d = F(0), i = F([]), a = S(() => r === "12h"), l = () => {
224
+ function ge(t, r = "24h", e = 15, u) {
225
+ const s = N(0), d = N(0), i = N([]), a = Y(() => r === "12h"), n = () => {
226
226
  if (t)
227
- n.value = t.getHours(), d.value = t.getMinutes();
227
+ s.value = t.getHours(), d.value = t.getMinutes();
228
228
  else {
229
229
  const c = /* @__PURE__ */ new Date();
230
- n.value = c.getHours(), d.value = c.getMinutes();
230
+ s.value = c.getHours(), d.value = c.getMinutes();
231
231
  }
232
- D();
232
+ g();
233
233
  }, m = (c) => {
234
- c && (n.value = c.getHours(), d.value = c.getMinutes());
235
- }, D = () => {
236
- const c = [], b = a.value ? 1 : 0;
237
- for (let y = 0; y < (a.value ? 2 : 1); y++) {
238
- const C = a.value ? y === 0 ? " AM" : " PM" : "";
239
- for (let _ = b; _ <= (a.value ? 12 : 23); _++)
240
- for (let g = 0; g < 60; g += e) {
241
- const $ = (a.value, _), H = a.value ? _ === 12 ? y === 0 ? 0 : 12 : _ + y * 12 : _, z = `${String($).padStart(2, "0")}:${String(g).padStart(2, "0")}` + C;
234
+ c && (s.value = c.getHours(), d.value = c.getMinutes());
235
+ }, g = () => {
236
+ const c = [], y = a.value ? 1 : 0;
237
+ for (let M = 0; M < (a.value ? 2 : 1); M++) {
238
+ const P = a.value ? M === 0 ? " AM" : " PM" : "";
239
+ for (let w = y; w <= (a.value ? 12 : 23); w++)
240
+ for (let T = 0; T < 60; T += e) {
241
+ const F = (a.value, w), h = a.value ? w === 12 ? M === 0 ? 0 : 12 : w + M * 12 : w, $ = `${String(F).padStart(2, "0")}:${String(T).padStart(2, "0")}` + P;
242
242
  c.push({
243
- display: z,
244
- value: `${String(H).padStart(2, "0")}:${String(g).padStart(2, "0")}`,
245
- hour: H,
246
- minute: g
243
+ display: $,
244
+ value: `${String(h).padStart(2, "0")}:${String(T).padStart(2, "0")}`,
245
+ hour: h,
246
+ minute: T
247
247
  });
248
248
  }
249
249
  }
250
- a.value ? i.value = c.map((y) => y.display) : i.value = c.map((y) => y.value);
251
- }, s = () => {
250
+ a.value ? i.value = c.map((M) => M.display) : i.value = c.map((M) => M.value);
251
+ }, l = () => {
252
252
  if (a.value) {
253
- const c = n.value === 0 ? 12 : n.value > 12 ? n.value - 12 : n.value, b = n.value < 12 ? " AM" : " PM";
253
+ const c = s.value === 0 ? 12 : s.value > 12 ? s.value - 12 : s.value, y = s.value < 12 ? " AM" : " PM";
254
254
  return `${String(c).padStart(2, "0")}:${String(d.value).padStart(
255
255
  2,
256
256
  "0"
257
- )}${b}`;
257
+ )}${y}`;
258
258
  }
259
- return `${String(n.value).padStart(2, "0")}:${String(d.value).padStart(2, "0")}`;
259
+ return `${String(s.value).padStart(2, "0")}:${String(d.value).padStart(2, "0")}`;
260
260
  };
261
261
  return {
262
- hours: n,
262
+ hours: s,
263
263
  minutes: d,
264
264
  timeOptions: i,
265
265
  is12HourFormat: a,
266
- initializeTime: l,
266
+ initializeTime: n,
267
267
  updateTime: m,
268
- generateTimeOptions: D,
269
- getCurrentTimeString: s,
268
+ generateTimeOptions: g,
269
+ getCurrentTimeString: l,
270
270
  selectTime: (c) => {
271
- let b, y;
271
+ let y, M;
272
272
  if (a.value) {
273
- const [_, g] = c.split(" "), [$, H] = _.split(":");
274
- b = parseInt($), y = parseInt(H), g === "AM" ? b === 12 && (b = 0) : b !== 12 && (b += 12);
273
+ const [w, T] = c.split(" "), [F, h] = w.split(":");
274
+ y = parseInt(F), M = parseInt(h), T === "AM" ? y === 12 && (y = 0) : y !== 12 && (y += 12);
275
275
  } else {
276
- const [_, g] = c.split(":");
277
- b = parseInt(_), y = parseInt(g);
276
+ const [w, T] = c.split(":");
277
+ y = parseInt(w), M = parseInt(T);
278
278
  }
279
- n.value = b, d.value = y;
280
- const C = t ? new Date(t.getTime()) : /* @__PURE__ */ new Date();
281
- C.setHours(b, y, 0, 0), u("update", C);
279
+ s.value = y, d.value = M;
280
+ const P = t ? new Date(t.getTime()) : /* @__PURE__ */ new Date();
281
+ P.setHours(y, M, 0, 0), u("update", P);
282
282
  },
283
283
  scrollToSelected: (c) => {
284
284
  if (!c) return;
285
- const b = i.value.findIndex((y) => y === s());
286
- if (b >= 0) {
287
- const C = c.clientHeight, _ = b * 30 - C / 2 + 30 / 2;
288
- c.scrollTop = Math.max(0, _);
285
+ const y = i.value.findIndex((M) => M === l());
286
+ if (y >= 0) {
287
+ const P = c.clientHeight, w = y * 30 - P / 2 + 30 / 2;
288
+ c.scrollTop = Math.max(0, w);
289
289
  }
290
290
  },
291
291
  onTimeUpdate: (c) => {
292
- n.value = c.getHours(), d.value = c.getMinutes(), u("update", c);
292
+ s.value = c.getHours(), d.value = c.getMinutes(), u("update", c);
293
293
  }
294
294
  };
295
295
  }
296
- const ke = { class: "time-picker-container" }, fe = ["aria-selected", "onClick"], J = /* @__PURE__ */ I({
296
+ const ke = { class: "time-picker-container" }, fe = ["aria-selected", "onClick"], J = /* @__PURE__ */ q({
297
297
  __name: "TimeView",
298
298
  props: {
299
299
  selectedTime: {},
@@ -302,54 +302,56 @@ const ke = { class: "time-picker-container" }, fe = ["aria-selected", "onClick"]
302
302
  },
303
303
  emits: ["update"],
304
304
  setup(t, { emit: r }) {
305
- const e = t, u = r, n = F(null), { timeOptions: d, initializeTime: i, updateTime: a, getCurrentTimeString: l, selectTime: m, scrollToSelected: D } = De(e.selectedTime, e.timeFormat, e.timeInterval, u);
306
- return L(
305
+ const e = t, u = r, s = N(null), { timeOptions: d, initializeTime: i, updateTime: a, getCurrentTimeString: n, selectTime: m, scrollToSelected: g } = ge(e.selectedTime, e.timeFormat, e.timeInterval, u);
306
+ return O(
307
307
  () => e.selectedTime,
308
- (s) => {
309
- a(s), G(() => {
310
- D(n.value);
308
+ (l) => {
309
+ a(l), B(() => {
310
+ g(s.value);
311
311
  });
312
312
  },
313
313
  { immediate: !0 }
314
- ), L(
314
+ ), O(
315
315
  () => e.timeFormat,
316
316
  () => {
317
- i(), G(() => {
318
- D(n.value);
317
+ i(), B(() => {
318
+ g(s.value);
319
319
  });
320
320
  }
321
- ), L(
321
+ ), O(
322
322
  () => e.timeInterval,
323
323
  () => {
324
- i(), G(() => {
325
- D(n.value);
324
+ i(), B(() => {
325
+ g(s.value);
326
326
  });
327
327
  }
328
- ), U(() => {
329
- i(), G(() => {
330
- D(n.value);
328
+ ), R(() => {
329
+ i(), B(() => {
330
+ setTimeout(() => {
331
+ g(s.value);
332
+ }, 3);
331
333
  });
332
- }), (s, M) => (v(), p("div", ke, [
333
- h("div", {
334
+ }), (l, b) => (v(), D("div", ke, [
335
+ p("div", {
334
336
  ref_key: "timeListRef",
335
- ref: n,
337
+ ref: s,
336
338
  class: "time-wheel",
337
339
  role: "listbox",
338
340
  "aria-label": "Time Selection"
339
341
  }, [
340
- (v(!0), p(Y, null, T(o(d), (k) => (v(), p("div", {
342
+ (v(!0), D(C, null, H(o(d), (k) => (v(), D("div", {
341
343
  key: k,
342
- class: x(["time-option", {
343
- selected: k === o(l)()
344
+ class: I(["time-option", {
345
+ selected: k === o(n)()
344
346
  }]),
345
347
  role: "option",
346
- "aria-selected": k === o(l)(),
348
+ "aria-selected": k === o(n)(),
347
349
  onClick: (f) => o(m)(k)
348
- }, P(k), 11, fe))), 128))
350
+ }, x(k), 11, fe))), 128))
349
351
  ], 512)
350
352
  ]));
351
353
  }
352
- }), ye = { class: "year-view-layout" }, be = { class: "years-section" }, _e = { class: "years-list" }, Me = ["onClick"], we = { class: "months-section" }, Se = { class: "date-picker-table date-picker-months-table" }, $e = { class: "date-picker-months-body" }, Ye = ["onClick", "disabled"], Te = /* @__PURE__ */ I({
354
+ }), Me = { class: "year-view-layout" }, ye = { class: "years-section" }, be = { class: "years-list" }, _e = ["onClick"], we = { class: "months-section" }, Se = { class: "date-picker-table date-picker-months-table" }, Ye = { class: "date-picker-months-body" }, $e = ["onClick", "disabled"], Te = /* @__PURE__ */ q({
353
355
  __name: "YearView",
354
356
  props: {
355
357
  currentDate: {},
@@ -357,63 +359,63 @@ const ke = { class: "time-picker-container" }, fe = ["aria-selected", "onClick"]
357
359
  },
358
360
  emits: ["select", "month-select"],
359
361
  setup(t, { emit: r }) {
360
- const e = t, u = r, n = S(() => e.currentDate.getFullYear()), d = S(() => {
361
- var s;
362
- return (s = e.selectedDate) == null ? void 0 : s.getFullYear();
363
- }), i = S(() => {
364
- const s = Math.floor(n.value / 10) * 10;
365
- return Array.from({ length: 12 }, (M, k) => s + k - 1);
366
- }), a = S(() => j(n.value).map((s) => ({
367
- ...s,
368
- isSelected: e.selectedDate ? s.month === e.selectedDate.getMonth() && s.year === e.selectedDate.getFullYear() : !1
369
- }))), l = S(() => {
370
- const s = [];
371
- for (let M = 0; M < a.value.length; M += 3)
372
- s.push(a.value.slice(M, M + 3));
373
- return s;
374
- }), m = (s) => {
375
- u("select", s);
376
- }, D = (s) => {
377
- u("month-select", s.month);
362
+ const e = t, u = r, s = Y(() => e.currentDate.getFullYear()), d = Y(() => {
363
+ var l;
364
+ return (l = e.selectedDate) == null ? void 0 : l.getFullYear();
365
+ }), i = Y(() => {
366
+ const l = Math.floor(s.value / 10) * 10;
367
+ return Array.from({ length: 12 }, (b, k) => l + k - 1);
368
+ }), a = Y(() => E(s.value).map((l) => ({
369
+ ...l,
370
+ isSelected: e.selectedDate ? l.month === e.selectedDate.getMonth() && l.year === e.selectedDate.getFullYear() : !1
371
+ }))), n = Y(() => {
372
+ const l = [];
373
+ for (let b = 0; b < a.value.length; b += 3)
374
+ l.push(a.value.slice(b, b + 3));
375
+ return l;
376
+ }), m = (l) => {
377
+ u("select", l);
378
+ }, g = (l) => {
379
+ u("month-select", l.month);
378
380
  };
379
- return (s, M) => (v(), p("div", ye, [
380
- h("div", be, [
381
- h("div", _e, [
382
- (v(!0), p(Y, null, T(i.value, (k) => (v(), p("button", {
381
+ return (l, b) => (v(), D("div", Me, [
382
+ p("div", ye, [
383
+ p("div", be, [
384
+ (v(!0), D(C, null, H(i.value, (k) => (v(), D("button", {
383
385
  key: k,
384
- class: x([
386
+ class: I([
385
387
  "year-item",
386
388
  {
387
389
  selected: k === d.value,
388
- current: k === n.value
390
+ current: k === s.value
389
391
  }
390
392
  ]),
391
393
  onClick: (f) => m(k)
392
- }, P(k), 11, Me))), 128))
394
+ }, x(k), 11, _e))), 128))
393
395
  ])
394
396
  ]),
395
- h("div", we, [
396
- h("table", Se, [
397
- h("tbody", $e, [
398
- (v(!0), p(Y, null, T(l.value, (k, f) => (v(), p("tr", {
397
+ p("div", we, [
398
+ p("table", Se, [
399
+ p("tbody", Ye, [
400
+ (v(!0), D(C, null, H(n.value, (k, f) => (v(), D("tr", {
399
401
  key: f,
400
402
  class: "date-picker-months-row"
401
403
  }, [
402
- (v(!0), p(Y, null, T(k, (c) => (v(), p("td", {
404
+ (v(!0), D(C, null, H(k, (c) => (v(), D("td", {
403
405
  key: c.month,
404
406
  class: "date-picker-month-cell"
405
407
  }, [
406
- h("button", {
407
- class: x([
408
+ p("button", {
409
+ class: I([
408
410
  "date-picker-month",
409
411
  {
410
412
  selected: c.isSelected,
411
413
  disabled: c.isDisabled
412
414
  }
413
415
  ]),
414
- onClick: (b) => D(c),
416
+ onClick: (y) => g(c),
415
417
  disabled: c.isDisabled
416
- }, P(c.name.substring(0, 3)), 11, Ye)
418
+ }, x(c.name.substring(0, 3)), 11, $e)
417
419
  ]))), 128))
418
420
  ]))), 128))
419
421
  ])
@@ -421,7 +423,7 @@ const ke = { class: "time-picker-container" }, fe = ["aria-selected", "onClick"]
421
423
  ])
422
424
  ]));
423
425
  }
424
- }), Ce = { class: "date-picker-content" }, He = { class: "date-picker-table date-picker-months-table" }, Pe = { class: "date-picker-months-body" }, Fe = ["onClick", "disabled"], xe = /* @__PURE__ */ I({
426
+ }), Ce = { class: "date-picker-content" }, He = { class: "date-picker-table date-picker-months-table" }, Fe = { class: "date-picker-months-body" }, Pe = ["onClick", "disabled"], xe = /* @__PURE__ */ q({
425
427
  __name: "MonthView",
426
428
  props: {
427
429
  currentDate: {},
@@ -429,46 +431,46 @@ const ke = { class: "time-picker-container" }, fe = ["aria-selected", "onClick"]
429
431
  },
430
432
  emits: ["select"],
431
433
  setup(t, { emit: r }) {
432
- const e = t, u = r, n = S(() => j(e.currentDate.getFullYear()).map((l) => ({
433
- ...l,
434
- isSelected: e.selectedDate ? l.month === e.selectedDate.getMonth() && l.year === e.selectedDate.getFullYear() : !1
435
- }))), d = S(() => {
434
+ const e = t, u = r, s = Y(() => E(e.currentDate.getFullYear()).map((n) => ({
435
+ ...n,
436
+ isSelected: e.selectedDate ? n.month === e.selectedDate.getMonth() && n.year === e.selectedDate.getFullYear() : !1
437
+ }))), d = Y(() => {
436
438
  const a = [];
437
- for (let l = 0; l < n.value.length; l += 3)
438
- a.push(n.value.slice(l, l + 3));
439
+ for (let n = 0; n < s.value.length; n += 3)
440
+ a.push(s.value.slice(n, n + 3));
439
441
  return a;
440
442
  }), i = (a) => {
441
443
  u("select", a.month);
442
444
  };
443
- return (a, l) => (v(), p("div", Ce, [
444
- h("table", He, [
445
- h("tbody", Pe, [
446
- (v(!0), p(Y, null, T(d.value, (m, D) => (v(), p("tr", {
447
- key: D,
445
+ return (a, n) => (v(), D("div", Ce, [
446
+ p("table", He, [
447
+ p("tbody", Fe, [
448
+ (v(!0), D(C, null, H(d.value, (m, g) => (v(), D("tr", {
449
+ key: g,
448
450
  class: "date-picker-months-row"
449
451
  }, [
450
- (v(!0), p(Y, null, T(m, (s) => (v(), p("td", {
451
- key: s.month,
452
+ (v(!0), D(C, null, H(m, (l) => (v(), D("td", {
453
+ key: l.month,
452
454
  class: "date-picker-month-cell"
453
455
  }, [
454
- h("button", {
455
- class: x([
456
+ p("button", {
457
+ class: I([
456
458
  "date-picker-month",
457
459
  {
458
- selected: s.isSelected,
459
- disabled: s.isDisabled
460
+ selected: l.isSelected,
461
+ disabled: l.isDisabled
460
462
  }
461
463
  ]),
462
- onClick: (M) => i(s),
463
- disabled: s.isDisabled
464
- }, P(s.name), 11, Fe)
464
+ onClick: (b) => i(l),
465
+ disabled: l.isDisabled
466
+ }, x(l.name), 11, Pe)
465
467
  ]))), 128))
466
468
  ]))), 128))
467
469
  ])
468
470
  ])
469
471
  ]));
470
472
  }
471
- }), Ne = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><g fill="none" fill-rule="evenodd"><path d="M24 0v24H0V0zM12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035q-.016-.005-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.017-.018m.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093q.019.005.029-.008l.004-.014l-.034-.614q-.005-.019-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01z"/><path fill="currentColor" d="M8.293 12.707a1 1 0 0 1 0-1.414l5.657-5.657a1 1 0 1 1 1.414 1.414L10.414 12l4.95 4.95a1 1 0 0 1-1.414 1.414z"/></g></svg>', Ie = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><g fill="none" fill-rule="evenodd"><path d="M24 0v24H0V0zM12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035q-.016-.005-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.017-.018m.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093q.019.005.029-.008l.004-.014l-.034-.614q-.005-.019-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01z"/><path fill="currentColor" d="M15.707 11.293a1 1 0 0 1 0 1.414l-5.657 5.657a1 1 0 1 1-1.414-1.414l4.95-4.95l-4.95-4.95a1 1 0 0 1 1.414-1.414z"/></g></svg>', Ve = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M12 18a6 6 0 1 1 0-12a6 6 0 0 1 0 12m0-1.5a4.5 4.5 0 1 0 0-9a4.5 4.5 0 0 0 0 9"/></svg>', Ge = { class: "date-picker-header" }, qe = ["disabled"], ze = ["innerHTML"], Be = ["innerHTML"], Le = ["disabled"], We = ["innerHTML"], Ae = /* @__PURE__ */ I({
473
+ }), Ne = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><g fill="none" fill-rule="evenodd"><path d="M24 0v24H0V0zM12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035q-.016-.005-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.017-.018m.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093q.019.005.029-.008l.004-.014l-.034-.614q-.005-.019-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01z"/><path fill="currentColor" d="M8.293 12.707a1 1 0 0 1 0-1.414l5.657-5.657a1 1 0 1 1 1.414 1.414L10.414 12l4.95 4.95a1 1 0 0 1-1.414 1.414z"/></g></svg>', Ie = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><g fill="none" fill-rule="evenodd"><path d="M24 0v24H0V0zM12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035q-.016-.005-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.017-.018m.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093q.019.005.029-.008l.004-.014l-.034-.614q-.005-.019-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01z"/><path fill="currentColor" d="M15.707 11.293a1 1 0 0 1 0 1.414l-5.657 5.657a1 1 0 1 1-1.414-1.414l4.95-4.95l-4.95-4.95a1 1 0 0 1 1.414-1.414z"/></g></svg>', Ve = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M12 18a6 6 0 1 1 0-12a6 6 0 0 1 0 12m0-1.5a4.5 4.5 0 1 0 0-9a4.5 4.5 0 0 0 0 9"/></svg>', Ge = { class: "date-picker-header" }, qe = ["disabled"], ze = ["innerHTML"], Be = ["innerHTML"], Le = ["disabled"], Oe = ["innerHTML"], We = /* @__PURE__ */ q({
472
474
  __name: "DatePickerHeader",
473
475
  props: {
474
476
  currentDate: {},
@@ -478,16 +480,16 @@ const ke = { class: "time-picker-container" }, fe = ["aria-selected", "onClick"]
478
480
  },
479
481
  emits: ["prev", "next", "header-click", "current-date"],
480
482
  setup(t, { emit: r }) {
481
- const e = t, u = r, n = S(() => {
482
- const m = e.currentDate.getFullYear(), D = e.currentDate.getMonth();
483
+ const e = t, u = r, s = Y(() => {
484
+ const m = e.currentDate.getFullYear(), g = e.currentDate.getMonth();
483
485
  switch (e.viewMode) {
484
486
  case "date":
485
- return `${O[D]} ${m}`;
487
+ return `${A[g]} ${m}`;
486
488
  case "year":
487
- const s = Math.floor(m / 10) * 10, M = s + 9;
488
- return `${s}–${M}`;
489
+ const l = Math.floor(m / 10) * 10, b = l + 9;
490
+ return `${l}–${b}`;
489
491
  default:
490
- return `${O[D]} ${m}`;
492
+ return `${A[g]} ${m}`;
491
493
  }
492
494
  }), d = () => {
493
495
  u("prev");
@@ -495,77 +497,77 @@ const ke = { class: "time-picker-container" }, fe = ["aria-selected", "onClick"]
495
497
  u("next");
496
498
  }, a = () => {
497
499
  u("header-click");
498
- }, l = () => {
500
+ }, n = () => {
499
501
  u("current-date");
500
502
  };
501
- return (m, D) => (v(), p("div", Ge, [
502
- h("button", {
503
+ return (m, g) => (v(), D("div", Ge, [
504
+ p("button", {
503
505
  class: "date-picker-title",
504
506
  onClick: a,
505
507
  type: "button"
506
- }, P(n.value), 1),
507
- h("button", {
508
+ }, x(s.value), 1),
509
+ p("button", {
508
510
  class: "date-picker-nav-button ml-auto",
509
511
  disabled: !m.canGoPrev,
510
512
  onClick: d,
511
513
  type: "button",
512
514
  "aria-label": "Previous"
513
515
  }, [
514
- h("span", {
516
+ p("span", {
515
517
  class: "date-picker-nav-icon",
516
518
  innerHTML: o(Ne)
517
519
  }, null, 8, ze)
518
520
  ], 8, qe),
519
- h("button", {
521
+ p("button", {
520
522
  class: "date-picker-nav-button",
521
- onClick: l,
523
+ onClick: n,
522
524
  type: "button",
523
525
  "aria-label": "Current Date"
524
526
  }, [
525
- h("span", {
527
+ p("span", {
526
528
  class: "date-picker-nav-icon",
527
529
  innerHTML: o(Ve)
528
530
  }, null, 8, Be)
529
531
  ]),
530
- h("button", {
532
+ p("button", {
531
533
  class: "date-picker-nav-button",
532
534
  disabled: !m.canGoNext,
533
535
  onClick: i,
534
536
  type: "button",
535
537
  "aria-label": "Next"
536
538
  }, [
537
- h("span", {
539
+ p("span", {
538
540
  class: "date-picker-nav-icon",
539
541
  innerHTML: o(Ie)
540
- }, null, 8, We)
542
+ }, null, 8, Oe)
541
543
  ], 8, Le)
542
544
  ]));
543
545
  }
544
546
  });
545
- function Oe(t, r) {
546
- const e = F(/* @__PURE__ */ new Date()), u = F("date"), n = S(() => t.value ? t.value instanceof Date ? t.value : W(t.value) : null), d = S(() => {
547
+ function Ae(t, r) {
548
+ const e = N(/* @__PURE__ */ new Date()), u = N("date"), s = Y(() => t.value ? t.value instanceof Date ? t.value : W(t.value) : null), d = Y(() => {
547
549
  if (!t.minDate) return !0;
548
- const g = W(t.minDate);
549
- if (!g) return !0;
550
- const $ = e.value.getFullYear(), H = e.value.getMonth();
551
- return new Date($, H, 1) > g;
552
- }), i = S(() => {
550
+ const h = W(t.minDate);
551
+ if (!h) return !0;
552
+ const S = e.value.getFullYear(), $ = e.value.getMonth();
553
+ return new Date(S, $, 1) > h;
554
+ }), i = Y(() => {
553
555
  if (!t.maxDate) return !0;
554
- const g = W(t.maxDate);
555
- if (!g) return !0;
556
- const $ = e.value.getFullYear(), H = e.value.getMonth();
557
- return new Date($, H + 1, 0) < g;
556
+ const h = W(t.maxDate);
557
+ if (!h) return !0;
558
+ const S = e.value.getFullYear(), $ = e.value.getMonth();
559
+ return new Date(S, $ + 1, 0) < h;
558
560
  }), a = () => {
559
561
  d.value && (e.value = new Date(e.value.getFullYear(), e.value.getMonth() - 1, 1));
560
- }, l = () => {
562
+ }, n = () => {
561
563
  i.value && (e.value = new Date(e.value.getFullYear(), e.value.getMonth() + 1, 1));
562
564
  }, m = () => {
563
565
  e.value = new Date(e.value.getFullYear() - 1, e.value.getMonth(), 1);
564
- }, D = () => {
566
+ }, g = () => {
565
567
  e.value = new Date(e.value.getFullYear() + 1, e.value.getMonth(), 1);
566
- }, s = () => {
568
+ }, l = () => {
567
569
  e.value = new Date(e.value.getFullYear() - 10, e.value.getMonth(), 1);
568
- }, M = () => {
570
+ }, b = () => {
569
571
  e.value = new Date(e.value.getFullYear() + 10, e.value.getMonth(), 1);
570
572
  }, k = () => {
571
573
  e.value = /* @__PURE__ */ new Date(), u.value = "date";
@@ -578,43 +580,49 @@ function Oe(t, r) {
578
580
  u.value = "date";
579
581
  break;
580
582
  }
581
- }, c = (g) => {
582
- t.mode === "dateTime" && n.value && g.setHours(n.value.getHours(), n.value.getMinutes()), _(g);
583
- }, b = (g) => {
584
- _(g);
585
- }, y = (g) => {
586
- e.value = new Date(e.value.getFullYear(), g, 1), u.value = "date", t.mode === "month" && _(new Date(e.value.getFullYear(), g, 1));
587
- }, C = (g) => {
588
- e.value = new Date(g, e.value.getMonth(), 1), u.value = "date";
589
- }, _ = (g) => {
590
- const $ = typeof t.value == "string" ? R(g, t.format) : g;
591
- r("update:value", $), r("change", $), r("select", $);
583
+ }, c = (h) => {
584
+ t.mode === "dateTime" && s.value && h.setHours(s.value.getHours(), s.value.getMinutes()), F(h);
585
+ }, y = (h) => {
586
+ F(h);
587
+ }, M = (h) => {
588
+ e.value = new Date(e.value.getFullYear(), h, 1), u.value = "date", t.mode === "month" && F(new Date(e.value.getFullYear(), h, 1));
589
+ }, P = (h) => {
590
+ e.value = new Date(h, e.value.getMonth(), 1), u.value = "date";
591
+ }, w = (h) => {
592
+ const S = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?Z?$/, $ = /^\d{4}-\d{2}-\d{2}$/;
593
+ return S.test(h) ? h.includes(".") ? "YYYY-MM-DDTHH:mm:ss.sssZ" : "YYYY-MM-DDTHH:mm:ssZ" : $.test(h) ? "YYYY-MM-DD" : t.format || "YYYY-MM-DD";
594
+ }, T = (h, S) => {
595
+ const $ = w(S);
596
+ return $.includes("T") ? $.includes(".sss") ? h.toISOString() : h.toISOString().replace(/\.\d{3}Z$/, "Z") : U(h, $);
597
+ }, F = (h) => {
598
+ let S;
599
+ typeof t.value == "string" ? S = T(h, t.value) : S = h, r("update:value", S), r("change", S), r("select", S);
592
600
  };
593
601
  return {
594
602
  currentDate: e,
595
603
  viewMode: u,
596
- selectedDate: n,
604
+ selectedDate: s,
597
605
  canGoPrev: d,
598
606
  canGoNext: i,
599
607
  goToPrevMonth: a,
600
- goToNextMonth: l,
608
+ goToNextMonth: n,
601
609
  goToPrevYear: m,
602
- goToNextYear: D,
603
- goToPrevDecade: s,
604
- goToNextDecade: M,
610
+ goToNextYear: g,
611
+ goToPrevDecade: l,
612
+ goToNextDecade: b,
605
613
  goToCurrentDate: k,
606
614
  onHeaderClick: f,
607
615
  onDateSelect: c,
608
- onWeekSelect: b,
609
- onMonthSelect: y,
610
- onYearSelect: C,
611
- emitValue: _
616
+ onWeekSelect: y,
617
+ onMonthSelect: M,
618
+ onYearSelect: P,
619
+ emitValue: F
612
620
  };
613
621
  }
614
- const Je = { class: "date-picker" }, Ue = {
622
+ const Je = { class: "date-picker" }, Re = {
615
623
  key: 0,
616
624
  class: "date-picker-time-section"
617
- }, Ee = /* @__PURE__ */ I({
625
+ }, Ze = /* @__PURE__ */ q({
618
626
  __name: "DatePicker",
619
627
  props: {
620
628
  value: {},
@@ -630,105 +638,109 @@ const Je = { class: "date-picker" }, Ue = {
630
638
  },
631
639
  emits: ["update:value", "change", "select"],
632
640
  setup(t, { emit: r }) {
633
- const e = t, u = r, n = F(null), d = F(0), {
641
+ const e = t, u = r, s = N(null), d = N(0), {
634
642
  currentDate: i,
635
643
  viewMode: a,
636
- selectedDate: l,
644
+ selectedDate: n,
637
645
  canGoPrev: m,
638
- canGoNext: D,
639
- goToPrevMonth: s,
640
- goToNextMonth: M,
646
+ canGoNext: g,
647
+ goToPrevMonth: l,
648
+ goToNextMonth: b,
641
649
  goToPrevYear: k,
642
650
  goToNextYear: f,
643
651
  goToPrevDecade: c,
644
- goToNextDecade: b,
645
- goToCurrentDate: y,
646
- onHeaderClick: C,
647
- onDateSelect: _,
648
- onWeekSelect: g,
649
- onMonthSelect: $,
650
- onYearSelect: H,
651
- emitValue: A
652
- } = Oe(e, u), z = (w) => {
653
- A(w);
652
+ goToNextDecade: y,
653
+ goToCurrentDate: M,
654
+ onHeaderClick: P,
655
+ onDateSelect: w,
656
+ onWeekSelect: T,
657
+ onMonthSelect: F,
658
+ onYearSelect: h,
659
+ emitValue: S
660
+ } = Ae(e, u), $ = (_) => {
661
+ if (e.mode === "dateTime" && n.value) {
662
+ const V = new Date(n.value.getTime());
663
+ V.setHours(_.getHours(), _.getMinutes(), 0, 0), S(V);
664
+ } else
665
+ S(_);
654
666
  };
655
- return U(async () => {
656
- G(() => {
657
- n.value && (d.value = n.value.clientHeight);
667
+ return R(async () => {
668
+ B(() => {
669
+ s.value && (d.value = s.value.clientHeight);
658
670
  });
659
- }), (w, B) => (v(), p("div", Je, [
660
- w.mode !== "time" ? (v(), V(Ae, {
671
+ }), (_, V) => (v(), D("div", Je, [
672
+ _.mode !== "time" ? (v(), z(We, {
661
673
  key: 0,
662
674
  "current-date": o(i),
663
675
  "view-mode": o(a),
664
676
  "can-go-prev": o(m),
665
- "can-go-next": o(D),
666
- onPrev: B[0] || (B[0] = (Q) => o(a) === "year" ? o(c)() : o(a) === "month" ? o(k)() : o(s)()),
667
- onNext: B[1] || (B[1] = (Q) => o(a) === "year" ? o(b)() : o(a) === "month" ? o(f)() : o(M)()),
668
- onHeaderClick: o(C),
669
- onCurrentDate: o(y)
670
- }, null, 8, ["current-date", "view-mode", "can-go-prev", "can-go-next", "onHeaderClick", "onCurrentDate"])) : N("", !0),
671
- h("div", {
672
- class: x({
673
- "date-picker-datetime-layout": w.mode === "dateTime" && o(a) === "date"
677
+ "can-go-next": o(g),
678
+ onPrev: V[0] || (V[0] = (K) => o(a) === "year" ? o(c)() : o(a) === "month" ? o(k)() : o(l)()),
679
+ onNext: V[1] || (V[1] = (K) => o(a) === "year" ? o(y)() : o(a) === "month" ? o(f)() : o(b)()),
680
+ onHeaderClick: o(P),
681
+ onCurrentDate: o(M)
682
+ }, null, 8, ["current-date", "view-mode", "can-go-prev", "can-go-next", "onHeaderClick", "onCurrentDate"])) : G("", !0),
683
+ p("div", {
684
+ class: I({
685
+ "date-picker-datetime-layout": _.mode === "dateTime" && o(a) === "date"
674
686
  }),
675
- style: X({
687
+ style: Q({
676
688
  height: d.value !== 0 ? d.value + "px" : "100%"
677
689
  })
678
690
  }, [
679
- h("div", {
691
+ p("div", {
680
692
  class: "date-picker-date-section",
681
693
  ref_key: "datePickerContent",
682
- ref: n
694
+ ref: s
683
695
  }, [
684
- o(a) === "date" && (w.mode === "date" || w.mode === "dateTime") ? (v(), V(ce, {
696
+ o(a) === "date" && (_.mode === "date" || _.mode === "dateTime") ? (v(), z(ce, {
685
697
  key: 0,
686
698
  "current-date": o(i),
687
- "selected-date": o(l),
688
- "min-date": w.minDate,
689
- "max-date": w.maxDate,
690
- "disabled-dates": w.disabledDates,
691
- onSelect: o(_)
692
- }, null, 8, ["current-date", "selected-date", "min-date", "max-date", "disabled-dates", "onSelect"])) : N("", !0),
693
- w.mode === "week" && o(a) === "date" ? (v(), V(ge, {
699
+ "selected-date": o(n),
700
+ "min-date": _.minDate,
701
+ "max-date": _.maxDate,
702
+ "disabled-dates": _.disabledDates,
703
+ onSelect: o(w)
704
+ }, null, 8, ["current-date", "selected-date", "min-date", "max-date", "disabled-dates", "onSelect"])) : G("", !0),
705
+ _.mode === "week" && o(a) === "date" ? (v(), z(De, {
694
706
  key: 1,
695
707
  "current-date": o(i),
696
- "selected-date": o(l),
697
- onSelect: o(g)
698
- }, null, 8, ["current-date", "selected-date", "onSelect"])) : N("", !0),
699
- o(a) !== "year" && (o(a) === "month" || w.mode === "month") ? (v(), V(xe, {
708
+ "selected-date": o(n),
709
+ onSelect: o(T)
710
+ }, null, 8, ["current-date", "selected-date", "onSelect"])) : G("", !0),
711
+ o(a) !== "year" && (o(a) === "month" || _.mode === "month") ? (v(), z(xe, {
700
712
  key: 2,
701
713
  "current-date": o(i),
702
- "selected-date": o(l),
703
- onSelect: o($)
704
- }, null, 8, ["current-date", "selected-date", "onSelect"])) : N("", !0),
705
- o(a) === "year" ? (v(), V(Te, {
714
+ "selected-date": o(n),
715
+ onSelect: o(F)
716
+ }, null, 8, ["current-date", "selected-date", "onSelect"])) : G("", !0),
717
+ o(a) === "year" ? (v(), z(Te, {
706
718
  key: 3,
707
719
  "current-date": o(i),
708
- "selected-date": o(l),
709
- onSelect: o(H),
710
- onMonthSelect: o($)
711
- }, null, 8, ["current-date", "selected-date", "onSelect", "onMonthSelect"])) : N("", !0)
720
+ "selected-date": o(n),
721
+ onSelect: o(h),
722
+ onMonthSelect: o(F)
723
+ }, null, 8, ["current-date", "selected-date", "onSelect", "onMonthSelect"])) : G("", !0)
712
724
  ], 512),
713
- w.mode === "dateTime" && o(a) === "date" ? (v(), p("div", Ue, [
714
- Z(J, {
715
- "selected-time": o(l),
716
- "time-format": w.timeFormat,
717
- "time-interval": w.timeInterval,
718
- onUpdate: z
725
+ _.mode === "dateTime" && o(a) === "date" ? (v(), D("div", Re, [
726
+ X(J, {
727
+ "selected-time": o(n),
728
+ "time-format": _.timeFormat,
729
+ "time-interval": _.timeInterval,
730
+ onUpdate: $
719
731
  }, null, 8, ["selected-time", "time-format", "time-interval"])
720
- ])) : N("", !0)
732
+ ])) : G("", !0)
721
733
  ], 6),
722
- w.mode === "time" ? (v(), V(J, {
734
+ _.mode === "time" ? (v(), z(J, {
723
735
  key: 1,
724
- "selected-time": o(l),
725
- "time-format": w.timeFormat,
726
- "time-interval": w.timeInterval,
727
- onUpdate: z
728
- }, null, 8, ["selected-time", "time-format", "time-interval"])) : N("", !0)
736
+ "selected-time": o(n),
737
+ "time-format": _.timeFormat,
738
+ "time-interval": _.timeInterval,
739
+ onUpdate: $
740
+ }, null, 8, ["selected-time", "time-format", "time-interval"])) : G("", !0)
729
741
  ]));
730
742
  }
731
743
  });
732
744
  export {
733
- Ee as default
745
+ Ze as default
734
746
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "v-datepicker-lite",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "A lightweight Vue 3 date picker with date, time, date-time, week, and month modes",
5
5
  "type": "module",
6
6
  "author": "safdar-azeem",
package/style.css CHANGED
@@ -1 +1 @@
1
- :root{--date-picker-primary: #4f46e5;--date-picker-primary-fg: #ffffff;--date-picker-text: #374151;--date-picker-border: #00000020;--date-picker-secondary: #f7f7f9;--date-picker-hover: #00000010;--date-picker-disabled: #9ca3af;--date-picker-today: #00000010;--date-picker-radius: .375em}.ml-auto{margin-left:auto}.date-picker{position:relative;display:inline-block;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;font-size:14px;color:var(--date-picker-text)}.date-picker-content{padding:0 .5em .5em}.date-picker-table{width:100%;border-collapse:collapse;border-spacing:0;margin:0}.date-picker-table:not(.date-picker-week-table) .date-picker-day-cell{padding:.13em}td,th{padding:0;margin:0;border:none}.date-picker-weekdays-row th{padding:.6em 0;font-size:.78em}.date-picker-weekday{display:flex;align-items:center;justify-content:center;height:2em;font-size:.75em;font-weight:500;color:var(--date-picker-disabled);padding:.25em}.date-picker-days-body tr{border:none}.date-picker-day{display:flex;align-items:center;justify-content:center;width:100%;height:2em;border:none;background:none;border-radius:var(--date-picker-radius);cursor:pointer;font-size:.95em;color:var(--date-picker-text)}.date-picker-day:hover{background:var(--date-picker-hover)}.date-picker-day.other-month{color:var(--date-picker-disabled)}.date-picker-day.today{background:var(--date-picker-today);font-weight:400}.date-picker-day.selected{background:var(--date-picker-primary);color:var(--date-picker-primary-fg)}.date-picker-day.disabled{color:var(--date-picker-disabled);cursor:not-allowed;opacity:.5}.date-picker-day.disabled:hover{background:none}.date-picker-datetime-layout{display:flex;gap:.65em;width:100%}.date-picker-date-section{flex:1;height:100%}.date-picker-datetime-layout .date-picker-date-section{width:75%}.date-picker-time-section{width:100%;max-width:74px;border-left:1px solid var(--date-picker-border);display:flex;flex-direction:column}.date-picker-time-section .time-picker-container{flex:1;overflow-y:auto}.date-picker-week-table .date-picker-week-row{cursor:pointer}.date-picker-week-table .date-picker-week-row:not(.selected):hover td{background:var(--date-picker-hover)}.date-picker-week-table td{border-radius:0;padding:0}.date-picker-week-table .date-picker-day-cell .date-picker-day{border-radius:0}.date-picker-week-header{text-align:center}.date-picker-week-row .date-picker-week-number-cell{height:90%;padding-right:5px;background:var(--date-picker-secondary);color:var(--date-picker-disabled);border-bottom:1px solid var(--date-picker-border);text-align:center;width:2.5em;font-size:.8em}.date-picker-week-row:last-child .date-picker-week-number-cell{border-bottom:none}.date-picker-week-row.selected .date-picker-day{background:var(--date-picker-primary);color:var(--date-picker-primary-fg)}.date-picker-months-table{width:100%}.date-picker-months-body .date-picker-month-cell{padding:2px}.date-picker-month{display:flex;align-items:center;justify-content:center;width:100%;height:2.5em;border:none;background:none;border-radius:var(--date-picker-radius);cursor:pointer;font-size:inherit;color:var(--date-picker-text)}.date-picker-month:hover{background:var(--date-picker-hover)}.date-picker-month.selected{background:var(--date-picker-primary);color:var(--date-picker-primary-fg)}.year-view-layout{display:flex;gap:1px;height:100%;padding-right:2px}.years-section{width:25%;min-width:60px;max-width:80px;border-right:1px solid var(--date-picker-border);display:flex;flex-direction:column;height:100%}.years-list{display:flex;flex-direction:column;flex:1;overflow-y:auto;overflow-x:hidden}.year-item{display:flex;align-items:center;justify-content:center;padding:.5em;border:none;background:none;cursor:pointer;font-size:.875em;color:var(--date-picker-text);transition:background-color .15s ease;white-space:nowrap;flex-shrink:0}.year-item:hover{background:var(--date-picker-hover)}.year-item.selected{background:var(--date-picker-primary);color:var(--date-picker-primary-fg)}.year-item.current{font-weight:600}.months-section{width:75%;display:flex;flex-direction:column;height:100%}.months-section .date-picker-months-table{overflow:auto;flex:1}.year-view-layout .months-section{padding:5px 3px;height:94.5%}.time-picker-container{height:100%;display:flex;flex-direction:column}.time-wheel{height:100%;overflow-y:auto;-webkit-overflow-scrolling:touch;scroll-behavior:smooth;display:flex;flex-direction:column;border:1px solid var(--date-picker-border);border-radius:var(--date-picker-radius);scrollbar-width:thin;scrollbar-color:var(--date-picker-border) transparent}.time-wheel::-webkit-scrollbar{width:6px}.time-wheel::-webkit-scrollbar-track{background:transparent}.time-wheel::-webkit-scrollbar-thumb{background:var(--date-picker-border);border-radius:3px}.time-wheel::-webkit-scrollbar-thumb:hover{background:var(--date-picker-disabled)}.time-option{height:30px;display:flex;align-items:center;justify-content:center;width:100%;cursor:pointer;font-size:.875em;color:var(--date-picker-text);flex-shrink:0}.time-option:hover{background:var(--date-picker-hover)}.time-option.selected{background:var(--date-picker-primary);color:var(--date-picker-primary-fg);font-weight:500}.date-picker-time-section .time-wheel{border:none;border-radius:0;height:100%;max-height:none}.date-picker-header{display:flex;align-items:center;justify-content:space-between;padding:.45em .4em;gap:.2em;border-bottom:1px solid var(--date-picker-border)}.date-picker-nav-button{display:flex;align-items:center;justify-content:center;width:1.65em;height:1.65em;border:none;background:none;border-radius:var(--date-picker-radius);cursor:pointer;transition:background-color .15s ease;opacity:.7}.date-picker-nav-button:hover:not(:disabled){background:var(--date-picker-hover)}.date-picker-nav-button:disabled{opacity:.5;cursor:not-allowed}.date-picker-nav-icon svg{width:1.3em;height:1.3em;fill:currentColor}.date-picker-title{font-weight:600;font-size:1em;cursor:pointer;padding:.25em .5em;border-radius:var(--date-picker-radius);transition:background-color .15s ease;border:none;background:none;color:inherit}.date-picker-title:hover{background:var(--date-picker-hover)}.date-picker svg{display:flex}
1
+ :root{--date-picker-primary: #2d66ed;--date-picker-primary-fg: #ffffff;--date-picker-text: inherit;--date-picker-border: #00000020;--date-picker-secondary: #00000010;--date-picker-hover: #00000010;--date-picker-disabled: #000000b4;--date-picker-today: #00000010;--date-picker-radius: .375em}.ml-auto{margin-left:auto}.date-picker{position:relative;display:inline-block;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;font-size:14px;color:var(--date-picker-text)}.date-picker-content{padding:0 .5em .5em}.date-picker-table{width:100%;border-collapse:collapse;border-spacing:0;margin:0}.date-picker-table:not(.date-picker-week-table) .date-picker-day-cell{padding:.13em}td,th{padding:0;margin:0;border:none}.date-picker-weekdays-row th{padding:.6em 0;font-size:.78em}.date-picker-weekday{display:flex;align-items:center;justify-content:center;height:2em;font-size:.75em;font-weight:500;opacity:.5;padding:.25em}.date-picker-days-body tr{border:none}.date-picker-day{display:flex;align-items:center;justify-content:center;width:100%;height:2em;border:none;background:none;border-radius:var(--date-picker-radius);cursor:pointer;font-size:.95em;color:var(--date-picker-text)}.date-picker-day:hover{background:var(--date-picker-hover)}.date-picker-day.other-month{opacity:.4}.date-picker-day.today{background:var(--date-picker-today);font-weight:400}.date-picker-day.selected{background:var(--date-picker-primary);color:var(--date-picker-primary-fg)}.date-picker-day.disabled{cursor:not-allowed;opacity:.5}.date-picker-day.disabled:hover{background:none}.date-picker-datetime-layout{display:flex;gap:.65em;width:100%}.date-picker-date-section{flex:1;height:100%}.date-picker-datetime-layout .date-picker-date-section{width:75%}.date-picker-time-section{width:100%;max-width:74px;border-left:1px solid var(--date-picker-border);display:flex;flex-direction:column}.date-picker-time-section .time-picker-container{flex:1;overflow-y:auto}.date-picker-week-table .date-picker-week-row{cursor:pointer}.date-picker-week-table .date-picker-week-row:not(.selected):hover td{background:var(--date-picker-hover)}.date-picker-week-table td{border-radius:0;padding:0}.date-picker-week-table .date-picker-day-cell .date-picker-day{border-radius:0}.date-picker-week-header{text-align:center}.date-picker-week-row .date-picker-week-number-cell{height:90%;padding-right:5px;background:var(--date-picker-secondary);opacity:.7;border-bottom:1px solid var(--date-picker-border);text-align:center;width:2.5em;font-size:.8em}.date-picker-week-row:last-child .date-picker-week-number-cell{border-bottom:none}.date-picker-week-row.selected .date-picker-day{background:var(--date-picker-primary);color:var(--date-picker-primary-fg)}.date-picker-months-table{width:100%}.date-picker-months-body .date-picker-month-cell{padding:2px}.date-picker-month{display:flex;align-items:center;justify-content:center;width:100%;height:2.5em;border:none;background:none;border-radius:var(--date-picker-radius);cursor:pointer;font-size:inherit;color:var(--date-picker-text)}.date-picker-month:hover{background:var(--date-picker-hover)}.date-picker-month.selected{background:var(--date-picker-primary);color:var(--date-picker-primary-fg)}.year-view-layout{display:flex;gap:1px;height:100%;padding-right:2px}.years-section{width:25%;min-width:60px;max-width:80px;border-right:1px solid var(--date-picker-border);display:flex;flex-direction:column;height:100%}.years-list{display:flex;flex-direction:column;flex:1;overflow-y:auto;overflow-x:hidden}.year-item{display:flex;align-items:center;justify-content:center;padding:.5em;border:none;background:none;cursor:pointer;font-size:.875em;color:var(--date-picker-text);transition:background-color .15s ease;white-space:nowrap;flex-shrink:0}.year-item:hover{background:var(--date-picker-hover)}.year-item.selected{background:var(--date-picker-primary);color:var(--date-picker-primary-fg)}.year-item.current{font-weight:600}.months-section{width:75%;display:flex;flex-direction:column;height:100%}.months-section .date-picker-months-table{overflow:auto;flex:1}.year-view-layout .months-section{padding:5px 3px;height:94.5%}.time-picker-container{height:100%;display:flex;flex-direction:column}.time-wheel{height:100%;overflow-y:auto;display:flex;flex-direction:column;border:1px solid var(--date-picker-border);border-radius:var(--date-picker-radius)}.time-option{height:30px;display:flex;align-items:center;justify-content:center;width:100%;cursor:pointer;font-size:.875em;color:var(--date-picker-text);flex-shrink:0}.time-option:hover{background:var(--date-picker-hover)}.time-option.selected{background:var(--date-picker-primary);color:var(--date-picker-primary-fg);font-weight:500}.date-picker-time-section .time-wheel{border:none;border-radius:0;height:100%;max-height:none}.date-picker-header{display:flex;align-items:center;justify-content:space-between;padding:.45em .4em;gap:.2em;border-bottom:1px solid var(--date-picker-border)}.date-picker-nav-button{display:flex;align-items:center;justify-content:center;width:1.65em;height:1.65em;border:none;background:none;border-radius:var(--date-picker-radius);cursor:pointer;transition:background-color .15s ease;opacity:.7}.date-picker-nav-button:hover:not(:disabled){background:var(--date-picker-hover)}.date-picker-nav-button:disabled{opacity:.5;cursor:not-allowed}.date-picker-nav-icon,.date-picker-header *{color:inherit!important}.date-picker-nav-icon svg{width:1.3em;height:1.3em;color:inherit!important;fill:currentColor!important}.date-picker-title{font-weight:600;font-size:1em;cursor:pointer;padding:.25em .5em;border-radius:var(--date-picker-radius);transition:background-color .15s ease;border:none;background:none;color:inherit}.date-picker-title:hover{background:var(--date-picker-hover)}.date-picker svg{display:flex;color:inherit}.date-picker *::-webkit-scrollbar{height:3px;width:3px}.date-picker *::-webkit-scrollbar-track{border-radius:5px;background-color:transparent}.date-picker *::-webkit-scrollbar-track:hover{background-color:transparent}.date-picker *::-webkit-scrollbar-track:active{background-color:transparent}.date-picker *::-webkit-scrollbar-thumb{border-radius:2px;background-color:var(--date-picker-border)}.date-picker *::-webkit-scrollbar-thumb:hover{background-color:var(--date-picker-border)}.date-picker *::-webkit-scrollbar-thumb:active{background-color:var(--date-picker-border)}