@mekari/pixel3-date-picker 0.0.3-dev.0 → 0.1.0

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 (79) hide show
  1. package/dist/calendar-panel.d.mts +12 -6
  2. package/dist/calendar-panel.d.ts +12 -6
  3. package/dist/calendar-panel.js +163 -85
  4. package/dist/calendar-panel.mjs +14 -13
  5. package/dist/{chunk-EYTJIMSM.mjs → chunk-26K3LMTE.mjs} +32 -11
  6. package/dist/{chunk-5PISTT2K.mjs → chunk-5MFHZK63.mjs} +4 -4
  7. package/dist/{chunk-XQLKPPRN.mjs → chunk-5VRVDIXN.mjs} +47 -0
  8. package/dist/{chunk-NU6HYEPT.mjs → chunk-64EO4HV7.mjs} +1 -1
  9. package/dist/{chunk-ZS4JQRK3.mjs → chunk-7CLF67SP.mjs} +1 -1
  10. package/dist/{chunk-NIUQXHGQ.mjs → chunk-E5BRVBZ2.mjs} +19 -1
  11. package/dist/{chunk-KTADGCWP.mjs → chunk-FPRON3EM.mjs} +14 -14
  12. package/dist/chunk-IRNTTSB7.mjs +144 -0
  13. package/dist/chunk-KTYQJMW4.mjs +35 -0
  14. package/dist/chunk-MO5D3TCF.mjs +113 -0
  15. package/dist/{chunk-HJ4V3PM6.mjs → chunk-O43S64IA.mjs} +4 -4
  16. package/dist/{chunk-NVULZQVI.mjs → chunk-OMV7LXBW.mjs} +1 -1
  17. package/dist/chunk-OYJNIILC.mjs +40 -0
  18. package/dist/{chunk-3RCUXNBN.mjs → chunk-P7JOEQIL.mjs} +9 -6
  19. package/dist/{chunk-26Y3AVJW.mjs → chunk-U7O52D6B.mjs} +13 -1
  20. package/dist/{chunk-JZ2KFYWF.mjs → chunk-WK62QUOT.mjs} +1 -1
  21. package/dist/components/calendar/index.js +83 -51
  22. package/dist/components/calendar/index.mjs +8 -7
  23. package/dist/components/calendar/table-date.js +51 -19
  24. package/dist/components/calendar/table-date.mjs +5 -4
  25. package/dist/components/calendar/table-month.js +48 -16
  26. package/dist/components/calendar/table-month.mjs +6 -5
  27. package/dist/components/calendar/table-year.js +48 -16
  28. package/dist/components/calendar/table-year.mjs +6 -5
  29. package/dist/components/parts/index.d.mts +1 -0
  30. package/dist/components/parts/index.d.ts +1 -0
  31. package/dist/components/parts/index.js +34 -0
  32. package/dist/components/parts/index.mjs +7 -3
  33. package/dist/components/parts/time.d.mts +32 -0
  34. package/dist/components/parts/time.d.ts +32 -0
  35. package/dist/components/parts/time.js +59 -0
  36. package/dist/components/parts/time.mjs +7 -0
  37. package/dist/composables/useCalendar.d.mts +8 -1
  38. package/dist/composables/useCalendar.d.ts +8 -1
  39. package/dist/composables/useCalendar.mjs +2 -2
  40. package/dist/composables/useCalendarRange.mjs +2 -2
  41. package/dist/composables/useTime.d.mts +96 -0
  42. package/dist/composables/useTime.d.ts +96 -0
  43. package/dist/composables/useTime.js +185 -0
  44. package/dist/composables/useTime.mjs +9 -0
  45. package/dist/date-picker.d.mts +91 -3
  46. package/dist/date-picker.d.ts +91 -3
  47. package/dist/date-picker.js +487 -118
  48. package/dist/date-picker.mjs +19 -15
  49. package/dist/index.d.mts +7 -0
  50. package/dist/index.d.ts +7 -0
  51. package/dist/index.js +487 -118
  52. package/dist/index.mjs +19 -15
  53. package/dist/metafile-cjs.json +1 -1
  54. package/dist/metafile-esm.json +1 -1
  55. package/dist/modules/date-picker.hooks.js +3 -0
  56. package/dist/modules/date-picker.hooks.mjs +4 -4
  57. package/dist/modules/date-picker.locales.mjs +2 -2
  58. package/dist/modules/date-picker.props.d.mts +83 -4
  59. package/dist/modules/date-picker.props.d.ts +83 -4
  60. package/dist/modules/date-picker.props.js +50 -2
  61. package/dist/modules/date-picker.props.mjs +5 -3
  62. package/dist/time-panel.d.mts +98 -0
  63. package/dist/time-panel.d.ts +98 -0
  64. package/dist/time-panel.js +665 -0
  65. package/dist/time-panel.mjs +18 -0
  66. package/dist/utils/base.d.mts +3 -1
  67. package/dist/utils/base.d.ts +3 -1
  68. package/dist/utils/base.js +20 -0
  69. package/dist/utils/base.mjs +5 -1
  70. package/dist/utils/date.d.mts +2 -1
  71. package/dist/utils/date.d.ts +2 -1
  72. package/dist/utils/date.js +13 -0
  73. package/dist/utils/date.mjs +3 -1
  74. package/dist/utils/dom.d.mts +18 -0
  75. package/dist/utils/dom.d.ts +18 -0
  76. package/dist/utils/dom.js +62 -0
  77. package/dist/utils/dom.mjs +9 -0
  78. package/package.json +6 -6
  79. /package/dist/{chunk-FTR7OMCT.mjs → chunk-MRP3X6QP.mjs} +0 -0
@@ -24,19 +24,19 @@ __export(date_picker_exports, {
24
24
  MpDatePicker: () => MpDatePicker
25
25
  });
26
26
  module.exports = __toCommonJS(date_picker_exports);
27
- var import_vue20 = require("vue");
28
- var import_vue21 = require("vue");
27
+ var import_vue25 = require("vue");
28
+ var import_vue26 = require("vue");
29
29
  var import_pixel3_input = require("@mekari/pixel3-input");
30
30
  var import_pixel3_popover = require("@mekari/pixel3-popover");
31
31
  var import_pixel3_icon = require("@mekari/pixel3-icon");
32
32
 
33
33
  // src/calendar-panel.tsx
34
- var import_vue17 = require("vue");
35
- var import_vue18 = require("vue");
34
+ var import_vue19 = require("vue");
35
+ var import_vue20 = require("vue");
36
36
 
37
37
  // src/components/calendar/table-date.tsx
38
- var import_vue9 = require("vue");
39
- var import_vue10 = require("vue");
38
+ var import_vue11 = require("vue");
39
+ var import_vue12 = require("vue");
40
40
  var import_pixel3_button = require("@mekari/pixel3-button");
41
41
 
42
42
  // src/components/parts/date.tsx
@@ -161,6 +161,38 @@ var YearItem = (0, import_vue8.defineComponent)({
161
161
  }
162
162
  });
163
163
 
164
+ // src/components/parts/time.tsx
165
+ var import_vue9 = require("vue");
166
+ var import_vue10 = require("vue");
167
+ var import_recipes5 = require("@mekari/pixel3-styled-system/recipes");
168
+ var TimeItem = (0, import_vue10.defineComponent)({
169
+ name: "TimeItem",
170
+ props: {
171
+ status: {
172
+ type: String,
173
+ default: "default"
174
+ },
175
+ isDisabled: {
176
+ type: Boolean,
177
+ default: false
178
+ }
179
+ },
180
+ setup(props, {
181
+ slots
182
+ }) {
183
+ return () => {
184
+ const classes = (0, import_recipes5.timeItemRecipe)({
185
+ status: props.status
186
+ });
187
+ return (0, import_vue9.createVNode)("button", {
188
+ "disabled": props.isDisabled,
189
+ "data-status": props.status,
190
+ "class": classes
191
+ }, [slots.default()]);
192
+ };
193
+ }
194
+ });
195
+
164
196
  // src/utils/base.ts
165
197
  function chunk(arr, size) {
166
198
  if (!Array.isArray(arr)) {
@@ -197,10 +229,26 @@ var assign = /* @__PURE__ */ __name((initial, override) => {
197
229
  };
198
230
  }, {});
199
231
  }, "assign");
232
+ function padNumber(value) {
233
+ value = parseInt(value, 10);
234
+ return value < 10 ? `0${value}` : `${value}`;
235
+ }
236
+ __name(padNumber, "padNumber");
237
+ function generateOptions(length, step) {
238
+ if (step <= 0) {
239
+ step = 1;
240
+ }
241
+ const arr = [];
242
+ for (let i = 0; i < length; i += step) {
243
+ arr.push(i);
244
+ }
245
+ return arr;
246
+ }
247
+ __name(generateOptions, "generateOptions");
200
248
 
201
249
  // src/components/calendar/table-date.tsx
202
- var import_recipes5 = require("@mekari/pixel3-styled-system/recipes");
203
- var TableDate = (0, import_vue10.defineComponent)({
250
+ var import_recipes6 = require("@mekari/pixel3-styled-system/recipes");
251
+ var TableDate = (0, import_vue12.defineComponent)({
204
252
  name: "TableDate",
205
253
  props: {
206
254
  days: {
@@ -245,8 +293,8 @@ var TableDate = (0, import_vue10.defineComponent)({
245
293
  dateItemRoot,
246
294
  dateItemWrapper,
247
295
  shortcutLabelWrapper
248
- } = (0, import_recipes5.tableDateSlotRecipe)();
249
- const getDates = (0, import_vue10.computed)(() => {
296
+ } = (0, import_recipes6.tableDateSlotRecipe)();
297
+ const getDates = (0, import_vue12.computed)(() => {
250
298
  return chunk(props.dates, 7);
251
299
  });
252
300
  function onNextButton() {
@@ -290,39 +338,39 @@ var TableDate = (0, import_vue10.defineComponent)({
290
338
  }
291
339
  __name(getDateAttrs, "getDateAttrs");
292
340
  return () => {
293
- return (0, import_vue9.createVNode)("div", null, [(0, import_vue9.createVNode)("div", {
341
+ return (0, import_vue11.createVNode)("div", null, [(0, import_vue11.createVNode)("div", {
294
342
  "data-pixel-parts": "Header",
295
343
  "class": headerRoot
296
- }, [(0, import_vue9.createVNode)(import_pixel3_button.MpButton, {
344
+ }, [(0, import_vue11.createVNode)(import_pixel3_button.MpButton, {
297
345
  "left-icon": "chevrons-left",
298
346
  "variant": "ghost",
299
347
  "size": "sm",
300
348
  "onClick": onPreviousButton
301
- }, null), (0, import_vue9.createVNode)("button", {
349
+ }, null), (0, import_vue11.createVNode)("button", {
302
350
  "class": headerLabel,
303
351
  "onClick": () => emit("clickHeaderLabel")
304
- }, [props.headerLabel]), (0, import_vue9.createVNode)(import_pixel3_button.MpButton, {
352
+ }, [props.headerLabel]), (0, import_vue11.createVNode)(import_pixel3_button.MpButton, {
305
353
  "right-icon": "chevrons-right",
306
354
  "variant": "ghost",
307
355
  "size": "sm",
308
356
  "onClick": onNextButton
309
- }, null)]), (0, import_vue9.createVNode)("div", {
357
+ }, null)]), (0, import_vue11.createVNode)("div", {
310
358
  "data-pixel-parts": "Content",
311
359
  "class": dayWrapper
312
- }, [props.days.map((day) => (0, import_vue9.createVNode)(Day, null, {
313
- default: () => [(0, import_vue9.createTextVNode)(" "), day, (0, import_vue9.createTextVNode)(" ")]
314
- }))]), (0, import_vue9.createVNode)("div", {
360
+ }, [props.days.map((day) => (0, import_vue11.createVNode)(Day, null, {
361
+ default: () => [(0, import_vue11.createTextVNode)(" "), day, (0, import_vue11.createTextVNode)(" ")]
362
+ }))]), (0, import_vue11.createVNode)("div", {
315
363
  "data-pixel-parts": "Content",
316
364
  "class": dateItemRoot
317
- }, [getDates.value.map((dates, index) => (0, import_vue9.createVNode)("div", {
365
+ }, [getDates.value.map((dates, index) => (0, import_vue11.createVNode)("div", {
318
366
  "class": dateItemWrapper,
319
367
  "data-row-index": index
320
- }, [dates.map((date) => (0, import_vue9.createVNode)(Date2, getDateAttrs(date), {
321
- default: () => [(0, import_vue9.createTextVNode)(" "), date.getDate(), (0, import_vue9.createTextVNode)(" ")]
322
- }))]))]), props.isShowShortcut && (0, import_vue9.createVNode)("div", {
368
+ }, [dates.map((date) => (0, import_vue11.createVNode)(Date2, getDateAttrs(date), {
369
+ default: () => [(0, import_vue11.createTextVNode)(" "), date.getDate(), (0, import_vue11.createTextVNode)(" ")]
370
+ }))]))]), props.isShowShortcut && (0, import_vue11.createVNode)("div", {
323
371
  "data-pixel-parts": "Shortcut",
324
372
  "class": shortcutLabelWrapper
325
- }, [(0, import_vue9.createVNode)(import_pixel3_button.MpButton, {
373
+ }, [(0, import_vue11.createVNode)(import_pixel3_button.MpButton, {
326
374
  "variant": "ghost",
327
375
  "onClick": onSelectToday
328
376
  }, {
@@ -333,8 +381,8 @@ var TableDate = (0, import_vue10.defineComponent)({
333
381
  });
334
382
 
335
383
  // src/components/calendar/table-month.tsx
336
- var import_vue11 = require("vue");
337
- var import_vue12 = require("vue");
384
+ var import_vue13 = require("vue");
385
+ var import_vue14 = require("vue");
338
386
  var import_pixel3_button2 = require("@mekari/pixel3-button");
339
387
 
340
388
  // src/utils/date.ts
@@ -422,8 +470,8 @@ function isDateBetween(date, min, max) {
422
470
  __name(isDateBetween, "isDateBetween");
423
471
 
424
472
  // src/components/calendar/table-month.tsx
425
- var import_recipes6 = require("@mekari/pixel3-styled-system/recipes");
426
- var TableMonth = (0, import_vue12.defineComponent)({
473
+ var import_recipes7 = require("@mekari/pixel3-styled-system/recipes");
474
+ var TableMonth = (0, import_vue14.defineComponent)({
427
475
  name: "TableMonth",
428
476
  props: {
429
477
  calendar: {
@@ -461,11 +509,11 @@ var TableMonth = (0, import_vue12.defineComponent)({
461
509
  monthItemRoot,
462
510
  monthItemWrapper,
463
511
  shortcutLabelWrapper
464
- } = (0, import_recipes6.tableMonthSlotRecipe)();
465
- const getMonths = (0, import_vue12.computed)(() => {
512
+ } = (0, import_recipes7.tableMonthSlotRecipe)();
513
+ const getMonths = (0, import_vue14.computed)(() => {
466
514
  return chunk(props.months, 3);
467
515
  });
468
- const getCalendarYear = (0, import_vue12.computed)(() => props.calendar.getFullYear());
516
+ const getCalendarYear = (0, import_vue14.computed)(() => props.calendar.getFullYear());
469
517
  function onNextButton() {
470
518
  emit("next");
471
519
  }
@@ -497,33 +545,33 @@ var TableMonth = (0, import_vue12.defineComponent)({
497
545
  }
498
546
  __name(getMonthAttrs, "getMonthAttrs");
499
547
  return () => {
500
- return (0, import_vue11.createVNode)("div", null, [(0, import_vue11.createVNode)("div", {
548
+ return (0, import_vue13.createVNode)("div", null, [(0, import_vue13.createVNode)("div", {
501
549
  "data-pixel-parts": "Header",
502
550
  "class": headerRoot
503
- }, [(0, import_vue11.createVNode)(import_pixel3_button2.MpButton, {
551
+ }, [(0, import_vue13.createVNode)(import_pixel3_button2.MpButton, {
504
552
  "left-icon": "chevrons-left",
505
553
  "variant": "ghost",
506
554
  "size": "sm",
507
555
  "onClick": onPreviousButton
508
- }, null), (0, import_vue11.createVNode)("button", {
556
+ }, null), (0, import_vue13.createVNode)("button", {
509
557
  "class": headerLabel,
510
558
  "onClick": () => emit("clickHeaderLabel")
511
- }, [props.headerLabel]), (0, import_vue11.createVNode)(import_pixel3_button2.MpButton, {
559
+ }, [props.headerLabel]), (0, import_vue13.createVNode)(import_pixel3_button2.MpButton, {
512
560
  "right-icon": "chevrons-right",
513
561
  "variant": "ghost",
514
562
  "size": "sm",
515
563
  "onClick": onNextButton
516
- }, null)]), (0, import_vue11.createVNode)("div", {
564
+ }, null)]), (0, import_vue13.createVNode)("div", {
517
565
  "data-pixel-parts": "Content",
518
566
  "class": monthItemRoot
519
- }, [getMonths.value.map((data) => (0, import_vue11.createVNode)("div", {
567
+ }, [getMonths.value.map((data) => (0, import_vue13.createVNode)("div", {
520
568
  "class": monthItemWrapper
521
- }, [data.map((month) => (0, import_vue11.createVNode)(Month, getMonthAttrs(month.month), {
569
+ }, [data.map((month) => (0, import_vue13.createVNode)(Month, getMonthAttrs(month.month), {
522
570
  default: () => [" ", month.text, " "]
523
- }))]))]), props.isShowShortcut && (0, import_vue11.createVNode)("div", {
571
+ }))]))]), props.isShowShortcut && (0, import_vue13.createVNode)("div", {
524
572
  "data-pixel-parts": "Shortcut",
525
573
  "class": shortcutLabelWrapper
526
- }, [(0, import_vue11.createVNode)(import_pixel3_button2.MpButton, {
574
+ }, [(0, import_vue13.createVNode)(import_pixel3_button2.MpButton, {
527
575
  "variant": "ghost",
528
576
  "onClick": () => onSelectMonth((/* @__PURE__ */ new Date()).getMonth(), getCalendarYear.value)
529
577
  }, {
@@ -534,11 +582,11 @@ var TableMonth = (0, import_vue12.defineComponent)({
534
582
  });
535
583
 
536
584
  // src/components/calendar/table-year.tsx
537
- var import_vue13 = require("vue");
538
- var import_vue14 = require("vue");
585
+ var import_vue15 = require("vue");
586
+ var import_vue16 = require("vue");
539
587
  var import_pixel3_button3 = require("@mekari/pixel3-button");
540
- var import_recipes7 = require("@mekari/pixel3-styled-system/recipes");
541
- var TableYear = (0, import_vue14.defineComponent)({
588
+ var import_recipes8 = require("@mekari/pixel3-styled-system/recipes");
589
+ var TableYear = (0, import_vue16.defineComponent)({
542
590
  name: "TableYear",
543
591
  props: {
544
592
  years: {
@@ -572,8 +620,8 @@ var TableYear = (0, import_vue14.defineComponent)({
572
620
  yearItemRoot,
573
621
  yearItemWrapper,
574
622
  shortcutLabelWrapper
575
- } = (0, import_recipes7.tableYearSlotRecipe)();
576
- const getYears = (0, import_vue14.computed)(() => {
623
+ } = (0, import_recipes8.tableYearSlotRecipe)();
624
+ const getYears = (0, import_vue16.computed)(() => {
577
625
  return chunk(props.years, 4);
578
626
  });
579
627
  function onNextButton() {
@@ -609,30 +657,30 @@ var TableYear = (0, import_vue14.defineComponent)({
609
657
  }
610
658
  __name(getMonthAttrs, "getMonthAttrs");
611
659
  return () => {
612
- return (0, import_vue13.createVNode)("div", null, [(0, import_vue13.createVNode)("div", {
660
+ return (0, import_vue15.createVNode)("div", null, [(0, import_vue15.createVNode)("div", {
613
661
  "data-pixel-parts": "Header",
614
662
  "class": headerRoot
615
- }, [(0, import_vue13.createVNode)(import_pixel3_button3.MpButton, {
663
+ }, [(0, import_vue15.createVNode)(import_pixel3_button3.MpButton, {
616
664
  "left-icon": "chevrons-left",
617
665
  "variant": "ghost",
618
666
  "size": "sm",
619
667
  "onClick": onPreviousButton
620
- }, null), (0, import_vue13.createVNode)("button", {
668
+ }, null), (0, import_vue15.createVNode)("button", {
621
669
  "class": headerLabel
622
- }, [props.headerLabel]), (0, import_vue13.createVNode)(import_pixel3_button3.MpButton, {
670
+ }, [props.headerLabel]), (0, import_vue15.createVNode)(import_pixel3_button3.MpButton, {
623
671
  "right-icon": "chevrons-right",
624
672
  "variant": "ghost",
625
673
  "size": "sm",
626
674
  "onClick": onNextButton
627
- }, null)]), (0, import_vue13.createVNode)("div", {
675
+ }, null)]), (0, import_vue15.createVNode)("div", {
628
676
  "class": yearItemRoot
629
- }, [getYears.value.map((data) => (0, import_vue13.createVNode)("div", {
677
+ }, [getYears.value.map((data) => (0, import_vue15.createVNode)("div", {
630
678
  "class": yearItemWrapper
631
- }, [data.map((year) => (0, import_vue13.createVNode)(YearItem, getMonthAttrs(year), {
632
- default: () => [(0, import_vue13.createTextVNode)(" "), year, (0, import_vue13.createTextVNode)(" ")]
633
- }))]))]), props.isShowShortcut && (0, import_vue13.createVNode)("div", {
679
+ }, [data.map((year) => (0, import_vue15.createVNode)(YearItem, getMonthAttrs(year), {
680
+ default: () => [(0, import_vue15.createTextVNode)(" "), year, (0, import_vue15.createTextVNode)(" ")]
681
+ }))]))]), props.isShowShortcut && (0, import_vue15.createVNode)("div", {
634
682
  "class": shortcutLabelWrapper
635
- }, [(0, import_vue13.createVNode)(import_pixel3_button3.MpButton, {
683
+ }, [(0, import_vue15.createVNode)(import_pixel3_button3.MpButton, {
636
684
  "variant": "ghost",
637
685
  "onClick": () => onSelectYear((/* @__PURE__ */ new Date()).getFullYear())
638
686
  }, {
@@ -646,11 +694,11 @@ var TableYear = (0, import_vue14.defineComponent)({
646
694
  var import_date_fns3 = require("date-fns");
647
695
 
648
696
  // src/composables/useCalendar.ts
649
- var import_vue15 = require("vue");
697
+ var import_vue17 = require("vue");
650
698
  var import_date_fns2 = require("date-fns");
651
699
  function useCalendar(date, locale2) {
652
- const currentDate = (0, import_vue15.ref)(isValidDate(date) ? date : /* @__PURE__ */ new Date());
653
- const currentPanel = (0, import_vue15.ref)("date");
700
+ const currentDate = (0, import_vue17.ref)(isValidDate(date) ? date : /* @__PURE__ */ new Date());
701
+ const currentPanel = (0, import_vue17.ref)("date");
654
702
  const nextMonth = /* @__PURE__ */ __name(() => {
655
703
  currentDate.value = getNextMonth(currentDate.value);
656
704
  }, "nextMonth");
@@ -669,7 +717,7 @@ function useCalendar(date, locale2) {
669
717
  const changeMonth = /* @__PURE__ */ __name((month) => {
670
718
  currentDate.value = (0, import_date_fns2.setMonth)(currentDate.value, month);
671
719
  }, "changeMonth");
672
- const getSplitDates = (0, import_vue15.computed)(() => {
720
+ const getSplitDates = (0, import_vue17.computed)(() => {
673
721
  return {
674
722
  day: currentDate.value.getDay(),
675
723
  month: currentDate.value.getMonth(),
@@ -677,7 +725,7 @@ function useCalendar(date, locale2) {
677
725
  monthLabel: locale2.value.months[currentDate.value.getMonth()]
678
726
  };
679
727
  });
680
- const getDates = (0, import_vue15.computed)(() => {
728
+ const getDates = (0, import_vue17.computed)(() => {
681
729
  const {
682
730
  year,
683
731
  month
@@ -689,7 +737,7 @@ function useCalendar(date, locale2) {
689
737
  });
690
738
  return arr;
691
739
  });
692
- const getMonths = (0, import_vue15.computed)(() => {
740
+ const getMonths = (0, import_vue17.computed)(() => {
693
741
  const monthsLocale = locale2.value.formatLocale.monthsShort || locale2.value.months;
694
742
  const months = monthsLocale.map((text, month) => {
695
743
  return {
@@ -699,7 +747,7 @@ function useCalendar(date, locale2) {
699
747
  });
700
748
  return months;
701
749
  });
702
- const getYears = (0, import_vue15.computed)(() => {
750
+ const getYears = (0, import_vue17.computed)(() => {
703
751
  const {
704
752
  year
705
753
  } = getSplitDates.value;
@@ -710,7 +758,7 @@ function useCalendar(date, locale2) {
710
758
  }
711
759
  return years;
712
760
  });
713
- const getLabel = (0, import_vue15.computed)(() => {
761
+ const getLabel = (0, import_vue17.computed)(() => {
714
762
  const {
715
763
  year,
716
764
  monthLabel
@@ -752,22 +800,22 @@ function useCalendar(date, locale2) {
752
800
  __name(useCalendar, "useCalendar");
753
801
 
754
802
  // src/composables/useCalendarRange.ts
755
- var import_vue16 = require("vue");
803
+ var import_vue18 = require("vue");
756
804
  function useCalendarRange(props) {
757
805
  const leftCalendar = startOfMonth(/* @__PURE__ */ new Date());
758
806
  const rightCalendar = startOfMonth(getNextMonth(/* @__PURE__ */ new Date()));
759
- const startDate = (0, import_vue16.ref)(props.modelValue[0]);
760
- const endDate = (0, import_vue16.ref)(props.modelValue[1]);
761
- const hoveredDate = (0, import_vue16.ref)();
762
- const calendars = (0, import_vue16.ref)([leftCalendar, rightCalendar]);
763
- const getCurrentDates = (0, import_vue16.computed)(() => {
807
+ const startDate = (0, import_vue18.ref)(props.modelValue[0]);
808
+ const endDate = (0, import_vue18.ref)(props.modelValue[1]);
809
+ const hoveredDate = (0, import_vue18.ref)();
810
+ const calendars = (0, import_vue18.ref)([leftCalendar, rightCalendar]);
811
+ const getCurrentDates = (0, import_vue18.computed)(() => {
764
812
  if (startDate.value && !endDate.value)
765
813
  return [startDate.value];
766
814
  if (startDate.value && endDate.value)
767
815
  return [startDate.value, endDate.value];
768
816
  return [];
769
817
  });
770
- const calendarMinDiff = (0, import_vue16.computed)(() => {
818
+ const calendarMinDiff = (0, import_vue18.computed)(() => {
771
819
  const map = {
772
820
  date: 1,
773
821
  // type:date min 1 month
@@ -778,7 +826,7 @@ function useCalendarRange(props) {
778
826
  };
779
827
  return map[props.type] || map.date;
780
828
  });
781
- const calendarMaxDiff = (0, import_vue16.computed)(() => Infinity);
829
+ const calendarMaxDiff = (0, import_vue18.computed)(() => Infinity);
782
830
  function setStartDate(date) {
783
831
  startDate.value = date;
784
832
  }
@@ -868,6 +916,51 @@ function useCalendarRange(props) {
868
916
  __name(useCalendarRange, "useCalendarRange");
869
917
 
870
918
  // src/modules/date-picker.props.ts
919
+ var timePanelProps = {
920
+ modelValue: {
921
+ type: Date
922
+ },
923
+ defaultDate: {
924
+ type: Date,
925
+ default() {
926
+ const date = /* @__PURE__ */ new Date();
927
+ date.setHours(0, 0, 0, 0);
928
+ return date;
929
+ }
930
+ },
931
+ isShowHour: {
932
+ type: Boolean,
933
+ default: true
934
+ },
935
+ isShowMinute: {
936
+ type: Boolean,
937
+ default: true
938
+ },
939
+ isShowSecond: {
940
+ type: Boolean,
941
+ default: true
942
+ },
943
+ hourStep: {
944
+ type: Number,
945
+ default: 1
946
+ },
947
+ minuteStep: {
948
+ type: Number,
949
+ default: 1
950
+ },
951
+ secondStep: {
952
+ type: Number,
953
+ default: 1
954
+ },
955
+ isUse12h: {
956
+ type: Boolean,
957
+ default: false
958
+ },
959
+ disabledTime: {
960
+ type: Function,
961
+ default: () => false
962
+ }
963
+ };
871
964
  var calendarPanelProps = {
872
965
  modelValue: {
873
966
  type: Date
@@ -932,6 +1025,7 @@ var calendarPanelRangeProps = {
932
1025
  }
933
1026
  };
934
1027
  var datePickerProps = {
1028
+ ...timePanelProps,
935
1029
  id: {
936
1030
  type: String
937
1031
  },
@@ -1058,8 +1152,8 @@ function getLocale(config) {
1058
1152
  __name(getLocale, "getLocale");
1059
1153
 
1060
1154
  // src/calendar-panel.tsx
1061
- var import_recipes8 = require("@mekari/pixel3-styled-system/recipes");
1062
- var CalendarPanel = (0, import_vue18.defineComponent)({
1155
+ var import_recipes9 = require("@mekari/pixel3-styled-system/recipes");
1156
+ var CalendarPanel = (0, import_vue20.defineComponent)({
1063
1157
  name: "CalendarPanel",
1064
1158
  props: calendarPanelProps,
1065
1159
  emits: ["update:modelValue", "mouseEnter", "mouseLeave", "updateCalendar"],
@@ -1069,7 +1163,7 @@ var CalendarPanel = (0, import_vue18.defineComponent)({
1069
1163
  const {
1070
1164
  locale: locale2
1071
1165
  } = useDatePickerContext();
1072
- const restValue = (0, import_vue18.ref)(props.modelValue);
1166
+ const restValue = (0, import_vue20.ref)(props.modelValue);
1073
1167
  const {
1074
1168
  currentDate: currentPanelDate,
1075
1169
  currentPanel,
@@ -1188,31 +1282,31 @@ var CalendarPanel = (0, import_vue18.defineComponent)({
1188
1282
  }
1189
1283
  }
1190
1284
  __name(initCalendar, "initCalendar");
1191
- (0, import_vue18.watch)(() => props.modelValue, (newValue) => {
1285
+ (0, import_vue20.watch)(() => props.modelValue, (newValue) => {
1192
1286
  if (newValue)
1193
1287
  restValue.value = newValue;
1194
1288
  }, {
1195
1289
  immediate: true
1196
1290
  });
1197
- (0, import_vue18.watch)(() => props.type, (newValue) => {
1291
+ (0, import_vue20.watch)(() => props.type, (newValue) => {
1198
1292
  if (newValue)
1199
1293
  currentPanel.value = newValue;
1200
1294
  }, {
1201
1295
  immediate: true
1202
1296
  });
1203
- (0, import_vue18.watch)(() => currentPanelDate.value, (newValue) => {
1297
+ (0, import_vue20.watch)(() => currentPanelDate.value, (newValue) => {
1204
1298
  if (newValue) {
1205
1299
  emit("updateCalendar", newValue);
1206
1300
  }
1207
1301
  });
1208
- (0, import_vue18.watch)(() => props.calendar, () => {
1302
+ (0, import_vue20.watch)(() => props.calendar, () => {
1209
1303
  initCalendar();
1210
1304
  }, {
1211
1305
  immediate: true
1212
1306
  });
1213
1307
  return () => {
1214
1308
  if (currentPanel.value === "date") {
1215
- return (0, import_vue17.createVNode)(TableDate, {
1309
+ return (0, import_vue19.createVNode)(TableDate, {
1216
1310
  "days": locale2.value.days,
1217
1311
  "dates": getDates.value,
1218
1312
  "headerLabel": getLabel.value,
@@ -1229,7 +1323,7 @@ var CalendarPanel = (0, import_vue18.defineComponent)({
1229
1323
  }, null);
1230
1324
  }
1231
1325
  if (currentPanel.value === "month") {
1232
- return (0, import_vue17.createVNode)(TableMonth, {
1326
+ return (0, import_vue19.createVNode)(TableMonth, {
1233
1327
  "calendar": currentPanelDate.value,
1234
1328
  "months": getMonths.value,
1235
1329
  "headerLabel": getLabel.value,
@@ -1245,7 +1339,7 @@ var CalendarPanel = (0, import_vue18.defineComponent)({
1245
1339
  }, null);
1246
1340
  }
1247
1341
  if (currentPanel.value === "year") {
1248
- return (0, import_vue17.createVNode)(TableYear, {
1342
+ return (0, import_vue19.createVNode)(TableYear, {
1249
1343
  "years": getYears.value,
1250
1344
  "headerLabel": getLabel.value,
1251
1345
  "shortcutLabel": locale2.value.thisYearText,
@@ -1261,7 +1355,7 @@ var CalendarPanel = (0, import_vue18.defineComponent)({
1261
1355
  };
1262
1356
  }
1263
1357
  });
1264
- var CalendarPanelRange = (0, import_vue18.defineComponent)({
1358
+ var CalendarPanelRange = (0, import_vue20.defineComponent)({
1265
1359
  name: "CalendarPanelRange",
1266
1360
  props: calendarPanelRangeProps,
1267
1361
  emits: ["update:modelValue"],
@@ -1468,7 +1562,7 @@ var CalendarPanelRange = (0, import_vue18.defineComponent)({
1468
1562
  __name(getYearStatus, "getYearStatus");
1469
1563
  return () => {
1470
1564
  const isWeekAndBiweek = props.type === "week" || props.type === "biweek";
1471
- const classes = isWeekAndBiweek ? "" : (0, import_recipes8.calendarPanelRangeRecipe)();
1565
+ const classes = isWeekAndBiweek ? "" : (0, import_recipes9.calendarPanelRangeRecipe)();
1472
1566
  const calendarPanelAttrs = {
1473
1567
  isRange: true,
1474
1568
  type: props.type,
@@ -1481,51 +1575,305 @@ var CalendarPanelRange = (0, import_vue18.defineComponent)({
1481
1575
  onMouseEnter: (date) => setHoveredDate(date),
1482
1576
  onMouseLeave: () => setHoveredDate(void 0)
1483
1577
  };
1484
- const leftNode = (0, import_vue17.createVNode)(CalendarPanel, (0, import_vue17.mergeProps)({
1578
+ const leftNode = (0, import_vue19.createVNode)(CalendarPanel, (0, import_vue19.mergeProps)({
1485
1579
  "data-pixel-parts": "CalendarPanelLeft"
1486
1580
  }, calendarPanelAttrs, {
1487
1581
  "onUpdateCalendar": (value) => updateStartCalendar(value),
1488
1582
  "calendar": calendars.value[0]
1489
1583
  }), null);
1490
- const rightNode = props.isInline ? "" : (0, import_vue17.createVNode)(CalendarPanel, (0, import_vue17.mergeProps)({
1584
+ const rightNode = props.isInline ? "" : (0, import_vue19.createVNode)(CalendarPanel, (0, import_vue19.mergeProps)({
1491
1585
  "data-pixel-parts": "CalendarPanelRight"
1492
1586
  }, calendarPanelAttrs, {
1493
1587
  "style": "margin-left: 16px;",
1494
1588
  "onUpdateCalendar": (value) => updateEndCalendar(value),
1495
1589
  "calendar": calendars.value[1]
1496
1590
  }), null);
1497
- const weekAndBiweekNode = (0, import_vue17.createVNode)(CalendarPanel, (0, import_vue17.mergeProps)({
1591
+ const weekAndBiweekNode = (0, import_vue19.createVNode)(CalendarPanel, (0, import_vue19.mergeProps)({
1498
1592
  "data-pixel-parts": "CalendarPanel"
1499
1593
  }, calendarPanelAttrs, {
1500
1594
  "onUpdateCalendar": (value) => updateStartCalendar(value),
1501
1595
  "calendar": props.modelValue[0],
1502
1596
  "type": "date"
1503
1597
  }), null);
1504
- return (0, import_vue17.createVNode)("div", {
1598
+ return (0, import_vue19.createVNode)("div", {
1505
1599
  "class": classes
1506
1600
  }, [isWeekAndBiweek ? weekAndBiweekNode : [leftNode, rightNode]]);
1507
1601
  };
1508
1602
  }
1509
1603
  });
1510
1604
 
1605
+ // src/time-panel.tsx
1606
+ var import_vue22 = require("vue");
1607
+ var import_vue23 = require("vue");
1608
+ var import_css = require("@mekari/pixel3-styled-system/css");
1609
+
1610
+ // src/composables/useTime.ts
1611
+ var import_vue21 = require("vue");
1612
+ function useTime(props) {
1613
+ const innerValue = (0, import_vue21.ref)(props.modelValue);
1614
+ const innerDateValue = (0, import_vue21.computed)(() => isValidDate(props.modelValue) ? props.modelValue : props.defaultDate);
1615
+ const columns = (0, import_vue21.computed)(() => {
1616
+ const cols = [];
1617
+ if (props.isShowHour)
1618
+ cols.push({
1619
+ type: "hour",
1620
+ list: getHoursList()
1621
+ });
1622
+ if (props.isShowMinute)
1623
+ cols.push({
1624
+ type: "minute",
1625
+ list: getMinutesList()
1626
+ });
1627
+ if (props.isShowSecond)
1628
+ cols.push({
1629
+ type: "second",
1630
+ list: getSecondsList()
1631
+ });
1632
+ if (props.isUse12h)
1633
+ cols.push({
1634
+ type: "ampm",
1635
+ list: getAMPMList()
1636
+ });
1637
+ return cols.filter((v) => v.list.length > 0);
1638
+ });
1639
+ function getHoursList() {
1640
+ return generateOptions(props.isUse12h ? 12 : 24, props.hourStep).map((num) => {
1641
+ const innerDate = new Date(innerDateValue.value);
1642
+ let text = padNumber(num);
1643
+ if (props.isUse12h) {
1644
+ if (num === 0) {
1645
+ text = "12";
1646
+ }
1647
+ if (innerDate.getHours() >= 12) {
1648
+ num += 12;
1649
+ }
1650
+ }
1651
+ const value = innerDate.setHours(num);
1652
+ return {
1653
+ value,
1654
+ text
1655
+ };
1656
+ });
1657
+ }
1658
+ __name(getHoursList, "getHoursList");
1659
+ function getMinutesList() {
1660
+ return generateOptions(60, props.minuteStep).map((num) => {
1661
+ const value = new Date(innerDateValue.value).setMinutes(num);
1662
+ return {
1663
+ value,
1664
+ text: padNumber(num)
1665
+ };
1666
+ });
1667
+ }
1668
+ __name(getMinutesList, "getMinutesList");
1669
+ function getSecondsList() {
1670
+ return generateOptions(60, props.secondStep).map((num) => {
1671
+ const value = new Date(innerDateValue.value).setSeconds(num);
1672
+ return {
1673
+ value,
1674
+ text: padNumber(num)
1675
+ };
1676
+ });
1677
+ }
1678
+ __name(getSecondsList, "getSecondsList");
1679
+ function getAMPMList() {
1680
+ return ["AM", "PM"].map((text, i) => {
1681
+ const innerDate = new Date(innerDateValue.value);
1682
+ const value = innerDate.setHours(innerDate.getHours() % 12 + i * 12);
1683
+ return {
1684
+ text,
1685
+ value
1686
+ };
1687
+ });
1688
+ }
1689
+ __name(getAMPMList, "getAMPMList");
1690
+ function isDisabledTime(value) {
1691
+ return props.disabledTime(new Date(value));
1692
+ }
1693
+ __name(isDisabledTime, "isDisabledTime");
1694
+ function isDisabledHour(date) {
1695
+ const value = new Date(date);
1696
+ return isDisabledTime(value) && isDisabledTime(value.setMinutes(0, 0, 0)) && isDisabledTime(value.setMinutes(59, 59, 999));
1697
+ }
1698
+ __name(isDisabledHour, "isDisabledHour");
1699
+ function isDisabledMinute(date) {
1700
+ const value = new Date(date);
1701
+ return isDisabledTime(value) && isDisabledTime(value.setSeconds(0, 0)) && isDisabledTime(value.setSeconds(59, 999));
1702
+ }
1703
+ __name(isDisabledMinute, "isDisabledMinute");
1704
+ function isDisabledAMPM(date) {
1705
+ const value = new Date(date);
1706
+ const minHour = value.getHours() < 12 ? 0 : 12;
1707
+ const maxHour = minHour + 11;
1708
+ return isDisabledTime(value) && isDisabledTime(value.setHours(minHour, 0, 0, 0)) && isDisabledTime(value.setHours(maxHour, 59, 59, 999));
1709
+ }
1710
+ __name(isDisabledAMPM, "isDisabledAMPM");
1711
+ function isDisabled(date, type) {
1712
+ if (type === "hour") {
1713
+ return isDisabledHour(date);
1714
+ }
1715
+ if (type === "minute") {
1716
+ return isDisabledMinute(date);
1717
+ }
1718
+ if (type === "ampm") {
1719
+ return isDisabledAMPM(date);
1720
+ }
1721
+ return isDisabledTime(date);
1722
+ }
1723
+ __name(isDisabled, "isDisabled");
1724
+ return {
1725
+ innerValue,
1726
+ columns,
1727
+ getHoursList,
1728
+ getMinutesList,
1729
+ getSecondsList,
1730
+ getAMPMList,
1731
+ isDisabledTime,
1732
+ isDisabledHour,
1733
+ isDisabledMinute,
1734
+ isDisabledAMPM,
1735
+ isDisabled
1736
+ };
1737
+ }
1738
+ __name(useTime, "useTime");
1739
+
1740
+ // src/utils/dom.ts
1741
+ function getScrollParent(node, until = document.body) {
1742
+ if (!node || node === until) {
1743
+ return null;
1744
+ }
1745
+ const style = /* @__PURE__ */ __name((value, prop) => getComputedStyle(value, null).getPropertyValue(prop), "style");
1746
+ const regex = /(auto|scroll)/;
1747
+ const scroll = regex.test(style(node, "overflow") + style(node, "overflow-y") + style(node, "overflow-x"));
1748
+ return scroll ? node : getScrollParent(node.parentElement, until);
1749
+ }
1750
+ __name(getScrollParent, "getScrollParent");
1751
+ function scrollTo(element, to, duration = 0) {
1752
+ if (duration <= 0) {
1753
+ requestAnimationFrame(() => {
1754
+ element.scrollTop = to;
1755
+ });
1756
+ return;
1757
+ }
1758
+ const difference = to - element.scrollTop;
1759
+ const tick = difference / duration * 10;
1760
+ requestAnimationFrame(() => {
1761
+ const scrollTop = element.scrollTop + tick;
1762
+ if (scrollTop >= to) {
1763
+ element.scrollTop = to;
1764
+ return;
1765
+ }
1766
+ element.scrollTop = scrollTop;
1767
+ scrollTo(element, to, duration - 10);
1768
+ });
1769
+ }
1770
+ __name(scrollTo, "scrollTo");
1771
+
1772
+ // src/time-panel.tsx
1773
+ var TimePanel = (0, import_vue23.defineComponent)({
1774
+ name: "MpTimePanel",
1775
+ props: timePanelProps,
1776
+ emits: ["update:modelValue"],
1777
+ setup(props, {
1778
+ emit
1779
+ }) {
1780
+ const columnNode = (0, import_vue23.ref)();
1781
+ const {
1782
+ innerValue,
1783
+ columns,
1784
+ isDisabled
1785
+ } = useTime(props);
1786
+ function handleSelectTime(col, item) {
1787
+ const date = new Date(item.value);
1788
+ innerValue.value = date;
1789
+ emit("update:modelValue", date);
1790
+ (0, import_vue23.nextTick)(() => handleScrollToSelected());
1791
+ }
1792
+ __name(handleSelectTime, "handleSelectTime");
1793
+ function getTimeStatus(value, type) {
1794
+ var _a;
1795
+ const cellDate = new Date(value);
1796
+ if (isDisabled(value, type)) {
1797
+ return "disabled";
1798
+ }
1799
+ if (cellDate.getTime() === ((_a = innerValue.value) == null ? void 0 : _a.getTime()) && isValidDate(innerValue.value)) {
1800
+ return "selected";
1801
+ }
1802
+ return "default";
1803
+ }
1804
+ __name(getTimeStatus, "getTimeStatus");
1805
+ function getTimeAttrs(value, type) {
1806
+ const status = getTimeStatus(value, type);
1807
+ return {
1808
+ status,
1809
+ isDisabled: status === "disabled" || void 0,
1810
+ "data-selected": status === "selected" || void 0
1811
+ };
1812
+ }
1813
+ __name(getTimeAttrs, "getTimeAttrs");
1814
+ function handleScrollToSelected(duration = 0) {
1815
+ var _a;
1816
+ const elements = (_a = columnNode.value) == null ? void 0 : _a.querySelectorAll("[data-selected=true]");
1817
+ elements == null ? void 0 : elements.forEach((element) => {
1818
+ const scrollElement = getScrollParent(element, columnNode.value);
1819
+ if (scrollElement) {
1820
+ const to = element.offsetTop - 10;
1821
+ scrollTo(scrollElement, to, duration);
1822
+ }
1823
+ });
1824
+ }
1825
+ __name(handleScrollToSelected, "handleScrollToSelected");
1826
+ (0, import_vue23.onMounted)(() => {
1827
+ (0, import_vue23.nextTick)(() => handleScrollToSelected(0));
1828
+ });
1829
+ return () => {
1830
+ return (0, import_vue22.createVNode)("div", {
1831
+ "ref": columnNode,
1832
+ "class": (0, import_css.css)({
1833
+ display: "flex",
1834
+ flexDirection: "row",
1835
+ gap: "0.5"
1836
+ })
1837
+ }, [columns.value.map((col, colIndex) => (0, import_vue22.createVNode)("ul", {
1838
+ "data-index": colIndex,
1839
+ "data-type": col.type,
1840
+ "class": (0, import_css.css)({
1841
+ display: "flex",
1842
+ flexDirection: "column",
1843
+ height: "224px",
1844
+ overflowY: "scroll",
1845
+ overflowX: "hidden",
1846
+ py: "10px"
1847
+ })
1848
+ }, [col.list.map((item, itemIndex) => (0, import_vue22.createVNode)("li", {
1849
+ "onClick": () => handleSelectTime(col, item)
1850
+ }, [(0, import_vue22.createVNode)(TimeItem, (0, import_vue22.mergeProps)({
1851
+ "data-index": itemIndex
1852
+ }, getTimeAttrs(item.value, col.type)), {
1853
+ default: () => [item.text]
1854
+ })]))]))]);
1855
+ };
1856
+ }
1857
+ });
1858
+
1511
1859
  // src/modules/date-picker.hooks.ts
1512
- var import_vue19 = require("vue");
1860
+ var import_vue24 = require("vue");
1513
1861
  var import_pixel3_utils2 = require("@mekari/pixel3-utils");
1514
1862
  var import_date_format_parse = require("date-format-parse");
1515
1863
  function useDatePicker(props, emit) {
1516
1864
  const getId = props.id || (0, import_pixel3_utils2.getUniqueId)("", "datepicker").value;
1517
- const currentLabel = (0, import_vue19.ref)("");
1518
- const isOutside = (0, import_vue19.ref)(true);
1519
- const isPopoverOpen = (0, import_vue19.ref)(false);
1520
- const isInnerInvalid = (0, import_vue19.ref)(false);
1521
- const userInput = (0, import_vue19.ref)(null);
1522
- const innerValueDate = (0, import_vue19.ref)();
1523
- const isUseRange = (0, import_vue19.computed)(() => {
1865
+ const currentLabel = (0, import_vue24.ref)("");
1866
+ const isOutside = (0, import_vue24.ref)(true);
1867
+ const isPopoverOpen = (0, import_vue24.ref)(false);
1868
+ const isInnerInvalid = (0, import_vue24.ref)(false);
1869
+ const userInput = (0, import_vue24.ref)(null);
1870
+ const innerValueDate = (0, import_vue24.ref)();
1871
+ const isUseRange = (0, import_vue24.computed)(() => {
1524
1872
  if (props.isRange || props.type === "biweek" || props.type === "week")
1525
1873
  return true;
1526
1874
  return false;
1527
1875
  });
1528
- const innerFormat = (0, import_vue19.computed)(() => {
1876
+ const innerFormat = (0, import_vue24.computed)(() => {
1529
1877
  const format2 = {
1530
1878
  date: "DD-MM-YYYY",
1531
1879
  datetime: "DD-MM-YYYY HH:mm:ss",
@@ -1537,7 +1885,7 @@ function useDatePicker(props, emit) {
1537
1885
  };
1538
1886
  return props.format || format2[props.type] || format2.date;
1539
1887
  });
1540
- const innerValue = (0, import_vue19.computed)(() => {
1888
+ const innerValue = (0, import_vue24.computed)(() => {
1541
1889
  if (isUseRange.value) {
1542
1890
  if (isValidRangeDate(props.modelValue)) {
1543
1891
  const startDate = valueToDate(props.modelValue[0]);
@@ -1548,7 +1896,7 @@ function useDatePicker(props, emit) {
1548
1896
  }
1549
1897
  return valueToDate(props.modelValue);
1550
1898
  });
1551
- const text = (0, import_vue19.computed)(() => {
1899
+ const text = (0, import_vue24.computed)(() => {
1552
1900
  if (userInput.value !== null)
1553
1901
  return userInput.value;
1554
1902
  if (!innerValue.value)
@@ -1565,7 +1913,7 @@ function useDatePicker(props, emit) {
1565
1913
  }
1566
1914
  return formatDate(innerValue.value);
1567
1915
  });
1568
- const locale2 = (0, import_vue19.computed)(() => {
1916
+ const locale2 = (0, import_vue24.computed)(() => {
1569
1917
  if (isObject(props.lang)) {
1570
1918
  return getLocale(props.lang);
1571
1919
  }
@@ -1624,7 +1972,8 @@ function useDatePicker(props, emit) {
1624
1972
  }
1625
1973
  if (isValidValueAndNotDisabled(date)) {
1626
1974
  innerValueDate.value = date;
1627
- (0, import_vue19.nextTick)(() => {
1975
+ onEmitModelValue(innerValueDate.value);
1976
+ (0, import_vue24.nextTick)(() => {
1628
1977
  isOutside.value = true;
1629
1978
  isInnerInvalid.value = false;
1630
1979
  onBlur();
@@ -1647,7 +1996,9 @@ function useDatePicker(props, emit) {
1647
1996
  } else {
1648
1997
  emit("update:modelValue", dateToValue(new Date(value)));
1649
1998
  }
1650
- (0, import_vue19.nextTick)(() => {
1999
+ if (props.type === "time")
2000
+ return;
2001
+ (0, import_vue24.nextTick)(() => {
1651
2002
  isOutside.value = true;
1652
2003
  onBlur();
1653
2004
  });
@@ -1749,12 +2100,12 @@ function useDatePicker(props, emit) {
1749
2100
  __name(useDatePicker, "useDatePicker");
1750
2101
 
1751
2102
  // src/date-picker.tsx
1752
- var import_recipes9 = require("@mekari/pixel3-styled-system/recipes");
2103
+ var import_recipes10 = require("@mekari/pixel3-styled-system/recipes");
1753
2104
  function _isSlot(s) {
1754
- return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !(0, import_vue20.isVNode)(s);
2105
+ return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !(0, import_vue25.isVNode)(s);
1755
2106
  }
1756
2107
  __name(_isSlot, "_isSlot");
1757
- var MpDatePicker = (0, import_vue21.defineComponent)({
2108
+ var MpDatePicker = (0, import_vue26.defineComponent)({
1758
2109
  name: "MpDatePicker",
1759
2110
  props: datePickerProps,
1760
2111
  emits: ["update:modelValue", "error"],
@@ -1774,7 +2125,8 @@ var MpDatePicker = (0, import_vue21.defineComponent)({
1774
2125
  onBlur,
1775
2126
  onClear,
1776
2127
  onInputChange,
1777
- onEmitModelValue
2128
+ onEmitModelValue,
2129
+ handleForceFocusToInput
1778
2130
  } = useDatePicker(props, emit);
1779
2131
  DatePickerProvider({
1780
2132
  rootProps: props,
@@ -1784,9 +2136,11 @@ var MpDatePicker = (0, import_vue21.defineComponent)({
1784
2136
  const {
1785
2137
  root,
1786
2138
  popoverContent
1787
- } = (0, import_recipes9.datePickerSlotRecipe)();
1788
- const inputNode = (0, import_vue20.createVNode)(import_pixel3_input.MpInputGroup, null, {
1789
- default: () => [(0, import_vue20.createVNode)(import_pixel3_input.MpInput, {
2139
+ } = (0, import_recipes10.datePickerSlotRecipe)({
2140
+ variant: props.type === "time" ? "time" : "date"
2141
+ });
2142
+ const inputNode = (0, import_vue25.createVNode)(import_pixel3_input.MpInputGroup, null, {
2143
+ default: () => [(0, import_vue25.createVNode)(import_pixel3_input.MpInput, {
1790
2144
  "id": getId,
1791
2145
  "placeholder": props.placeholder,
1792
2146
  "isClearable": props.isClearable,
@@ -1805,10 +2159,12 @@ var MpDatePicker = (0, import_vue21.defineComponent)({
1805
2159
  const target = e.target;
1806
2160
  target.focus();
1807
2161
  }
1808
- }, null), (0, import_vue20.createVNode)(import_pixel3_input.MpInputRightAddon, null, {
1809
- default: () => [(0, import_vue20.createVNode)(import_pixel3_icon.MpIcon, {
1810
- "name": "calendar"
1811
- }, null)]
2162
+ }, null), (0, import_vue25.createVNode)(import_pixel3_input.MpInputRightAddon, null, {
2163
+ default: () => [(0, import_vue25.createVNode)("div", {
2164
+ "onClick": () => handleForceFocusToInput()
2165
+ }, [(0, import_vue25.createVNode)(import_pixel3_icon.MpIcon, {
2166
+ "name": props.type === "time" ? "time" : "calendar"
2167
+ }, null)])]
1812
2168
  })]
1813
2169
  });
1814
2170
  const calendarPanelAttrs = {
@@ -1819,21 +2175,34 @@ var MpDatePicker = (0, import_vue21.defineComponent)({
1819
2175
  disabledMonth: props.disabledMonth,
1820
2176
  disabledYear: props.disabledYear
1821
2177
  };
1822
- const panelNode = isUseRange.value ? (0, import_vue20.createVNode)(CalendarPanelRange, (0, import_vue20.mergeProps)(calendarPanelAttrs, {
2178
+ const datePanelNode = isUseRange.value ? (0, import_vue25.createVNode)(CalendarPanelRange, (0, import_vue25.mergeProps)(calendarPanelAttrs, {
1823
2179
  "modelValue": innerValue.value
1824
- }), null) : (0, import_vue20.createVNode)(CalendarPanel, (0, import_vue20.mergeProps)(calendarPanelAttrs, {
2180
+ }), null) : (0, import_vue25.createVNode)(CalendarPanel, (0, import_vue25.mergeProps)(calendarPanelAttrs, {
1825
2181
  "modelValue": innerValue.value
1826
2182
  }), null);
1827
- const withPopover = (0, import_vue20.createVNode)(import_pixel3_popover.MpPopover, {
2183
+ const timePanelNode = (0, import_vue25.createVNode)(TimePanel, {
2184
+ "modelValue": innerValue.value,
2185
+ "onUpdate:modelValue": onEmitModelValue,
2186
+ "disabledTime": props.disabledTime,
2187
+ "isShowHour": props.isShowHour,
2188
+ "isShowMinute": props.isShowMinute,
2189
+ "isShowSecond": props.isShowSecond,
2190
+ "hourStep": props.hourStep,
2191
+ "minuteStep": props.minuteStep,
2192
+ "secondStep": props.minuteStep,
2193
+ "isUse12h": props.isUse12h
2194
+ }, null);
2195
+ const panelNode = props.type === "time" ? timePanelNode : datePanelNode;
2196
+ const withPopover = (0, import_vue25.createVNode)(import_pixel3_popover.MpPopover, {
1828
2197
  "id": getId,
1829
2198
  "isManual": true,
1830
2199
  "isOpen": isPopoverOpen.value,
1831
2200
  "isKeepAlive": props.isKeepAlive,
1832
2201
  "usePortal": props.usePortal
1833
2202
  }, {
1834
- default: () => [(0, import_vue20.createVNode)(import_pixel3_popover.MpPopoverTrigger, null, _isSlot(inputNode) ? inputNode : {
2203
+ default: () => [(0, import_vue25.createVNode)(import_pixel3_popover.MpPopoverTrigger, null, _isSlot(inputNode) ? inputNode : {
1835
2204
  default: () => [inputNode]
1836
- }), (0, import_vue20.createVNode)(import_pixel3_popover.MpPopoverContent, {
2205
+ }), (0, import_vue25.createVNode)(import_pixel3_popover.MpPopoverContent, {
1837
2206
  "class": popoverContent,
1838
2207
  "style": {
1839
2208
  width: props.isRange ? "590px" : ""
@@ -1844,7 +2213,7 @@ var MpDatePicker = (0, import_vue21.defineComponent)({
1844
2213
  default: () => [panelNode]
1845
2214
  })]
1846
2215
  });
1847
- return (0, import_vue20.createVNode)("div", {
2216
+ return (0, import_vue25.createVNode)("div", {
1848
2217
  "class": root,
1849
2218
  "onMouseenter": () => isOutside.value = false,
1850
2219
  "onMouseleave": () => isOutside.value = true