@enos5/enos-vue-default 1.7.1 → 1.7.3

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.
@@ -40,6 +40,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
40
40
  type: StringConstructor;
41
41
  default: string;
42
42
  };
43
+ locale: {
44
+ type: StringConstructor;
45
+ default: string;
46
+ };
43
47
  }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
44
48
  "update:modelValue": (...args: any[]) => void;
45
49
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
@@ -82,6 +86,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
82
86
  type: StringConstructor;
83
87
  default: string;
84
88
  };
89
+ locale: {
90
+ type: StringConstructor;
91
+ default: string;
92
+ };
85
93
  }>> & Readonly<{
86
94
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
87
95
  }>, {
@@ -94,4 +102,5 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
94
102
  min: string;
95
103
  minDays: number;
96
104
  maxDays: number;
105
+ locale: string;
97
106
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -173,6 +173,10 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
173
173
  type: StringConstructor;
174
174
  default: string;
175
175
  };
176
+ locale: {
177
+ type: StringConstructor;
178
+ default: string;
179
+ };
176
180
  }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
177
181
  "update:modelValue": (...args: any[]) => void;
178
182
  blur: (...args: any[]) => void;
@@ -345,6 +349,10 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
345
349
  type: StringConstructor;
346
350
  default: string;
347
351
  };
352
+ locale: {
353
+ type: StringConstructor;
354
+ default: string;
355
+ };
348
356
  }>> & Readonly<{
349
357
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
350
358
  onBlur?: ((...args: any[]) => any) | undefined;
@@ -375,6 +383,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
375
383
  min: string;
376
384
  minDays: number;
377
385
  maxDays: number;
386
+ locale: string;
378
387
  currentImageUrl: string;
379
388
  accept: string;
380
389
  currentLabel: string;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import './styles.css';
2
- import { _, a, b, c, d, e, f, g, h, i, j, k, D, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, S, C, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, T, U, V, W, X, Y, Z, $, a0, a1, a2 } from "./plugin-qr9N0w3u.js";
2
+ import { _, a, b, c, d, e, f, g, h, i, j, k, D, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, S, C, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, T, U, V, W, X, Y, Z, $, a0, a1, a2 } from "./plugin-tniGDCqg.js";
3
3
  export {
4
4
  _ as ActionCard,
5
5
  a as ActionMessage,
@@ -1,4 +1,4 @@
1
- import { _, a, b, c, d, e, f, g, h, i, j, k, D, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, S, C, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, T, U, V, W, X, Y, Z, $, a0, a1, a2 } from "./plugin-qr9N0w3u.js";
1
+ import { _, a, b, c, d, e, f, g, h, i, j, k, D, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, S, C, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, T, U, V, W, X, Y, Z, $, a0, a1, a2 } from "./plugin-tniGDCqg.js";
2
2
  export {
3
3
  _ as ActionCard,
4
4
  a as ActionMessage,
@@ -1433,10 +1433,11 @@ const _hoisted_7$6 = { class: "grid grid-cols-7 gap-1 mb-2" };
1433
1433
  const _hoisted_8$4 = { class: "grid grid-cols-7 gap-1" };
1434
1434
  const _hoisted_9$3 = ["disabled", "onClick", "onMouseenter"];
1435
1435
  const _hoisted_10$3 = { class: "mt-4 pt-4 border-t border-neutral-200 dark:border-neutral-800" };
1436
- const _hoisted_11$3 = { class: "text-xs text-neutral-500 dark:text-neutral-400" };
1437
- const _hoisted_12$2 = { key: 0 };
1438
- const _hoisted_13$2 = { key: 1 };
1439
- const _hoisted_14$2 = { key: 2 };
1436
+ const _hoisted_11$3 = { class: "flex items-center justify-between" };
1437
+ const _hoisted_12$2 = { class: "text-xs text-neutral-500 dark:text-neutral-400" };
1438
+ const _hoisted_13$2 = { key: 0 };
1439
+ const _hoisted_14$2 = { key: 1 };
1440
+ const _hoisted_15$2 = { key: 2 };
1440
1441
  const _sfc_main$C = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
1441
1442
  __name: "DateRangeInput",
1442
1443
  props: {
@@ -1470,11 +1471,15 @@ const _sfc_main$C = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
1470
1471
  },
1471
1472
  label: {
1472
1473
  type: String,
1473
- default: "Date Range"
1474
+ default: ""
1474
1475
  },
1475
1476
  placeholder: {
1476
1477
  type: String,
1477
1478
  default: "Select date range"
1479
+ },
1480
+ locale: {
1481
+ type: String,
1482
+ default: "fr-CA"
1478
1483
  }
1479
1484
  },
1480
1485
  emits: ["update:modelValue"],
@@ -1635,6 +1640,14 @@ const _sfc_main$C = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
1635
1640
  }
1636
1641
  }
1637
1642
  };
1643
+ const closeCalendar = (event) => {
1644
+ if (calendarRef.value && !calendarRef.value.contains(event.target) && !inputRef.value.contains(event.target)) {
1645
+ if (startDate.value && !endDate.value) {
1646
+ emit("update:modelValue", { start: "", end: "" });
1647
+ }
1648
+ isOpen.value = false;
1649
+ }
1650
+ };
1638
1651
  const handleDateHover = (date) => {
1639
1652
  if (startDate.value && !endDate.value) {
1640
1653
  hoveredDate.value = date;
@@ -1659,8 +1672,30 @@ const _sfc_main$C = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
1659
1672
  currentMonth.value++;
1660
1673
  }
1661
1674
  };
1662
- const monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
1663
- const dayNames = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
1675
+ const clearSelection = () => {
1676
+ emit("update:modelValue", { start: "", end: "" });
1677
+ isOpen.value = false;
1678
+ };
1679
+ const monthNames = computed(() => {
1680
+ return Array.from({ length: 12 }, (_, i) => {
1681
+ return new Intl.DateTimeFormat(props.locale, { month: "long" }).format(new Date(2e3, i, 1));
1682
+ });
1683
+ });
1684
+ const dayNames = computed(() => {
1685
+ return Array.from({ length: 7 }, (_, i) => {
1686
+ return new Intl.DateTimeFormat(props.locale, { weekday: "short" }).format(new Date(2e3, 0, i + 2));
1687
+ });
1688
+ });
1689
+ watch(isOpen, (newValue) => {
1690
+ if (newValue) {
1691
+ document.addEventListener("click", closeCalendar);
1692
+ } else {
1693
+ document.removeEventListener("click", closeCalendar);
1694
+ }
1695
+ });
1696
+ onUnmounted(() => {
1697
+ document.removeEventListener("click", closeCalendar);
1698
+ });
1664
1699
  return (_ctx, _cache) => {
1665
1700
  return openBlock(), createElementBlock("div", _hoisted_1$q, [
1666
1701
  __props.label ? (openBlock(), createElementBlock("label", _hoisted_2$h, toDisplayString(__props.label), 1)) : createCommentVNode("", true),
@@ -1702,7 +1737,7 @@ const _sfc_main$C = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
1702
1737
  })
1703
1738
  ], -1)
1704
1739
  ])]),
1705
- createElementVNode("div", _hoisted_6$6, toDisplayString(monthNames[currentMonth.value]) + " " + toDisplayString(currentYear.value), 1),
1740
+ createElementVNode("div", _hoisted_6$6, toDisplayString(monthNames.value[currentMonth.value]) + " " + toDisplayString(currentYear.value), 1),
1706
1741
  createElementVNode("button", {
1707
1742
  type: "button",
1708
1743
  class: "p-1 rounded hover:bg-neutral-100 dark:hover:bg-neutral-800 transition-colors",
@@ -1724,12 +1759,12 @@ const _sfc_main$C = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
1724
1759
  ])])
1725
1760
  ]),
1726
1761
  createElementVNode("div", _hoisted_7$6, [
1727
- (openBlock(), createElementBlock(Fragment, null, renderList(dayNames, (day) => {
1728
- return createElementVNode("div", {
1762
+ (openBlock(true), createElementBlock(Fragment, null, renderList(dayNames.value, (day) => {
1763
+ return openBlock(), createElementBlock("div", {
1729
1764
  key: day,
1730
1765
  class: "text-xs font-medium text-neutral-500 dark:text-neutral-400 text-center py-1"
1731
1766
  }, toDisplayString(day), 1);
1732
- }), 64))
1767
+ }), 128))
1733
1768
  ]),
1734
1769
  createElementVNode("div", _hoisted_8$4, [
1735
1770
  (openBlock(true), createElementBlock(Fragment, null, renderList(calendarDays.value, (day) => {
@@ -1752,7 +1787,7 @@ const _sfc_main$C = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
1752
1787
  "rounded-r-full": day.isEndDate && !day.isStartDate,
1753
1788
  "rounded-full": day.isStartDate && day.isEndDate
1754
1789
  }]),
1755
- disabled: !day.isCurrentMonth || day.isDisabled,
1790
+ disabled: day.isDisabled,
1756
1791
  onClick: ($event) => selectDate(day.date),
1757
1792
  onMouseenter: ($event) => handleDateHover(day.date),
1758
1793
  onMouseleave: handleDateLeave
@@ -1762,7 +1797,15 @@ const _sfc_main$C = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
1762
1797
  ]),
1763
1798
  createElementVNode("div", _hoisted_10$3, [
1764
1799
  createElementVNode("div", _hoisted_11$3, [
1765
- startDate.value && endDate.value ? (openBlock(), createElementBlock("div", _hoisted_12$2, " Range: " + toDisplayString(daysBetween.value) + " days ", 1)) : startDate.value ? (openBlock(), createElementBlock("div", _hoisted_13$2, " Select end date ")) : (openBlock(), createElementBlock("div", _hoisted_14$2, " Select start date "))
1800
+ createElementVNode("div", _hoisted_12$2, [
1801
+ startDate.value && endDate.value ? (openBlock(), createElementBlock("div", _hoisted_13$2, " Range: " + toDisplayString(daysBetween.value) + " days ", 1)) : startDate.value ? (openBlock(), createElementBlock("div", _hoisted_14$2, " Select end date ")) : (openBlock(), createElementBlock("div", _hoisted_15$2, " Select start date "))
1802
+ ]),
1803
+ startDate.value || endDate.value ? (openBlock(), createElementBlock("button", {
1804
+ key: 0,
1805
+ type: "button",
1806
+ class: "text-xs text-red-600 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300 transition-colors",
1807
+ onClick: clearSelection
1808
+ }, " Clear ")) : createCommentVNode("", true)
1766
1809
  ])
1767
1810
  ])
1768
1811
  ])
@@ -1771,7 +1814,7 @@ const _sfc_main$C = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
1771
1814
  };
1772
1815
  }
1773
1816
  });
1774
- const DateRangeInput = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__scopeId", "data-v-36446810"]]);
1817
+ const DateRangeInput = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__scopeId", "data-v-43db6d8e"]]);
1775
1818
  const _hoisted_1$p = { class: "relative" };
1776
1819
  const _hoisted_2$g = { class: "absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none" };
1777
1820
  const _hoisted_3$a = ["accept"];
@@ -2213,7 +2256,7 @@ const _sfc_main$w = {
2213
2256
  const _hoisted_1$j = ["for"];
2214
2257
  const _hoisted_2$d = {
2215
2258
  key: 1,
2216
- class: "text-xs text-gray-500 mb-1 block break-all"
2259
+ class: "text-xs text-gray-500 mb-1 block"
2217
2260
  };
2218
2261
  const _hoisted_3$9 = {
2219
2262
  key: 17,
@@ -2390,6 +2433,10 @@ const _sfc_main$v = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
2390
2433
  endLabel: {
2391
2434
  type: String,
2392
2435
  default: "End Date"
2436
+ },
2437
+ locale: {
2438
+ type: String,
2439
+ default: "fr-CA"
2393
2440
  }
2394
2441
  },
2395
2442
  emits: ["update:modelValue", "blur"],
@@ -2571,6 +2618,7 @@ const _sfc_main$v = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
2571
2618
  maxDays: props.maxDays,
2572
2619
  startLabel: props.startLabel,
2573
2620
  endLabel: props.endLabel,
2621
+ locale: props.locale,
2574
2622
  disabled: props.disabled,
2575
2623
  disabledClass: props.disabledClass
2576
2624
  }));
@@ -5276,4 +5324,4 @@ export {
5276
5324
  _sfc_main$A as y,
5277
5325
  _sfc_main$z as z
5278
5326
  };
5279
- //# sourceMappingURL=plugin-qr9N0w3u.js.map
5327
+ //# sourceMappingURL=plugin-tniGDCqg.js.map