@adyen/bento-vue2 1.2.0 → 1.3.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 (227) hide show
  1. package/README.md +60 -29
  2. package/dist/@types/components.d.ts +12 -0
  3. package/dist/@types/packages/vue2/src/components/button/components/loading-button/loading-button.vue.d.ts +3 -3
  4. package/dist/@types/packages/vue2/src/components/checkbox/components/checkbox-group/checkbox-group.vue.d.ts +76 -30
  5. package/dist/@types/packages/vue2/src/components/country/composables/index.d.ts +0 -1
  6. package/dist/@types/packages/vue2/src/components/country/country.vue.d.ts +1 -2
  7. package/dist/@types/packages/vue2/src/components/date-picker/date-picker.vue.d.ts +11 -1
  8. package/dist/@types/packages/vue2/src/components/date-range-picker/date-range-picker.vue.d.ts +11 -1
  9. package/dist/@types/packages/vue2/src/components/dropdown/components/variants/dropdown-avatar/dropdown-avatar.vue.d.ts +1 -1
  10. package/dist/@types/packages/vue2/src/components/dropdown/components/variants/dropdown-country/dropdown-country.vue.d.ts +1 -1
  11. package/dist/@types/packages/vue2/src/components/dropdown/components/variants/dropdown-currency/dropdown-currency.vue.d.ts +1 -1
  12. package/dist/@types/packages/vue2/src/components/dropdown/components/variants/dropdown-payment-method/dropdown-payment-method.vue.d.ts +1 -1
  13. package/dist/@types/packages/vue2/src/components/dropdown/components/variants/dropdown-tag/dropdown-tag.vue.d.ts +1 -1
  14. package/dist/@types/packages/vue2/src/components/dropdown/dropdown.vue.d.ts +2 -1
  15. package/dist/@types/packages/vue2/src/components/filter-bar/components/date-range-filter/date-range-filter.vue.d.ts +0 -2
  16. package/dist/@types/packages/vue2/src/components/form-layout/components/form-layout-field-tip/form-layout-field-tip.vue.d.ts +10 -0
  17. package/dist/@types/packages/vue2/src/components/form-layout/components/form-layout-field-tip/index.d.ts +1 -0
  18. package/dist/@types/packages/vue2/src/components/form-layout/components/form-layout-group/composable/use-form-layout-group-percentage.d.ts +3 -0
  19. package/dist/@types/packages/vue2/src/components/form-layout/components/form-layout-group/form-layout-group.types.d.ts +1 -0
  20. package/dist/@types/packages/vue2/src/components/form-layout/components/form-layout-group/form-layout-group.vue.d.ts +23 -0
  21. package/dist/@types/packages/vue2/src/components/form-layout/components/form-layout-group/index.d.ts +1 -0
  22. package/dist/@types/packages/vue2/src/components/form-layout/components/form-layout-title/form-layout-title.vue.d.ts +33 -0
  23. package/dist/@types/packages/vue2/src/components/form-layout/components/form-layout-title/index.d.ts +1 -0
  24. package/dist/@types/packages/vue2/src/components/form-layout/components/index.d.ts +3 -0
  25. package/dist/@types/packages/vue2/src/components/form-layout/form-layout.types.d.ts +1 -0
  26. package/dist/@types/packages/vue2/src/components/form-layout/form-layout.vue.d.ts +33 -0
  27. package/dist/@types/packages/vue2/src/components/form-layout/index.d.ts +2 -0
  28. package/dist/@types/packages/vue2/src/components/input-field/input-field.vue.d.ts +2 -1
  29. package/dist/@types/packages/vue2/src/components/internal/controls-group/controls-group.vue.d.ts +53 -22
  30. package/dist/@types/packages/vue2/src/components/modal/components/base-modal/__mocks__/base-modal.vue.d.ts +3 -3
  31. package/dist/@types/packages/vue2/src/components/modal/components/base-modal/base-modal.vue.d.ts +51 -44
  32. package/dist/@types/packages/vue2/src/components/modal/components/modal-default/modal-default.vue.d.ts +3 -3
  33. package/dist/@types/packages/vue2/src/components/modal/modal.vue.d.ts +4 -12
  34. package/dist/@types/packages/vue2/src/components/radio-group/radio-group.vue.d.ts +50 -4
  35. package/dist/@types/packages/vue2/src/components/search-bar/search-bar.vue.d.ts +2 -1
  36. package/dist/@types/packages/vue2/src/components/sidepanel/components/sidepanel-page.vue.d.ts +68 -0
  37. package/dist/@types/packages/vue2/src/components/sidepanel/index.d.ts +3 -0
  38. package/dist/@types/packages/vue2/src/components/sidepanel/sidepanel.keys.d.ts +2 -0
  39. package/dist/@types/packages/vue2/src/components/sidepanel/sidepanel.types.d.ts +21 -0
  40. package/dist/@types/packages/vue2/src/components/sidepanel/sidepanel.vue.d.ts +43 -0
  41. package/dist/@types/packages/vue2/src/components/tabs/tabs.types.d.ts +1 -1
  42. package/dist/@types/packages/vue2/src/components/textarea/textarea.vue.d.ts +2 -1
  43. package/dist/@types/packages/vue2/src/components/timeline/timeline.types.d.ts +1 -1
  44. package/dist/@types/packages/vue2/src/composables/index.d.ts +1 -0
  45. package/dist/@types/packages/vue2/src/composables/use-form-layout-loading/use-form-layout-loading.d.ts +4 -0
  46. package/dist/@types/packages/vue2/src/index.d.ts +2 -0
  47. package/dist/@types/packages/vue2/src/types/utils-events.d.ts +0 -1
  48. package/dist/@types/packages/vue2/src/utils/ts/dev-environment.d.ts +1 -0
  49. package/dist/accordion.js +1 -1
  50. package/dist/alert.js +3 -3
  51. package/dist/assets/arrow-left.css +1 -0
  52. package/dist/assets/base-button.css +1 -1
  53. package/dist/assets/button.css +1 -1
  54. package/dist/assets/calendar.css +1 -1
  55. package/dist/assets/checkbox.css +1 -1
  56. package/dist/assets/controls-group.css +1 -1
  57. package/dist/assets/copy.css +1 -1
  58. package/dist/assets/dropdown-default-textbox.css +1 -1
  59. package/dist/assets/dropdown.css +1 -1
  60. package/dist/assets/error-message.css +1 -1
  61. package/dist/assets/footer-actions.css +1 -0
  62. package/dist/assets/grid-layout.css +1 -1
  63. package/dist/assets/index.css +1 -1
  64. package/dist/assets/index10.css +1 -1
  65. package/dist/assets/index11.css +1 -1
  66. package/dist/assets/index12.css +1 -1
  67. package/dist/assets/index13.css +1 -1
  68. package/dist/assets/index14.css +1 -1
  69. package/dist/assets/index15.css +1 -1
  70. package/dist/assets/index16.css +1 -1
  71. package/dist/assets/index17.css +1 -1
  72. package/dist/assets/index18.css +1 -1
  73. package/dist/assets/index19.css +1 -1
  74. package/dist/assets/index2.css +1 -1
  75. package/dist/assets/index20.css +1 -1
  76. package/dist/assets/index21.css +1 -1
  77. package/dist/assets/index22.css +1 -1
  78. package/dist/assets/index23.css +1 -1
  79. package/dist/assets/index24.css +1 -1
  80. package/dist/assets/index25.css +1 -1
  81. package/dist/assets/index26.css +1 -1
  82. package/dist/assets/index27.css +1 -1
  83. package/dist/assets/index28.css +1 -1
  84. package/dist/assets/index29.css +1 -1
  85. package/dist/assets/index3.css +1 -1
  86. package/dist/assets/index30.css +1 -1
  87. package/dist/assets/index31.css +1 -1
  88. package/dist/assets/index32.css +1 -1
  89. package/dist/assets/index33.css +1 -1
  90. package/dist/assets/index34.css +1 -1
  91. package/dist/assets/index35.css +1 -1
  92. package/dist/assets/index36.css +1 -1
  93. package/dist/assets/index37.css +1 -1
  94. package/dist/assets/index38.css +1 -1
  95. package/dist/assets/index39.css +1 -1
  96. package/dist/assets/index4.css +1 -1
  97. package/dist/assets/index40.css +1 -0
  98. package/dist/assets/index41.css +1 -0
  99. package/dist/assets/index5.css +1 -1
  100. package/dist/assets/index6.css +1 -1
  101. package/dist/assets/index7.css +1 -1
  102. package/dist/assets/index8.css +1 -1
  103. package/dist/assets/index9.css +1 -1
  104. package/dist/assets/listbox-option-tag.css +1 -1
  105. package/dist/assets/listbox.css +1 -1
  106. package/dist/assets/loading-button.css +1 -1
  107. package/dist/assets/tooltip.css +1 -1
  108. package/dist/avatar-image.js +1 -1
  109. package/dist/badge.js +1 -1
  110. package/dist/button.js +3 -3
  111. package/dist/card.js +3 -3
  112. package/dist/checkbox.js +93 -84
  113. package/dist/checkbox.js.map +1 -1
  114. package/dist/chunks/arrow-left.1d5d08bd.js +26 -0
  115. package/dist/chunks/arrow-left.1d5d08bd.js.map +1 -0
  116. package/dist/chunks/{base-button.d4487ac9.js → base-button.98379576.js} +2 -2
  117. package/dist/chunks/{base-button.d4487ac9.js.map → base-button.98379576.js.map} +1 -1
  118. package/dist/chunks/{button-actions.cf73ed47.js → button-actions.bd397c79.js} +2 -2
  119. package/dist/chunks/{button-actions.cf73ed47.js.map → button-actions.bd397c79.js.map} +1 -1
  120. package/dist/chunks/{button.c27a7ce2.js → button.d0c9527d.js} +2 -2
  121. package/dist/chunks/{button.c27a7ce2.js.map → button.d0c9527d.js.map} +1 -1
  122. package/dist/chunks/{calendar.8f50a65a.js → calendar.0ae43a96.js} +6 -6
  123. package/dist/chunks/calendar.0ae43a96.js.map +1 -0
  124. package/dist/chunks/{checkbox.c06daf12.js → checkbox.f8457c93.js} +3 -3
  125. package/dist/chunks/{checkbox.c06daf12.js.map → checkbox.f8457c93.js.map} +1 -1
  126. package/dist/chunks/controls-group.b827382b.js +87 -0
  127. package/dist/chunks/controls-group.b827382b.js.map +1 -0
  128. package/dist/chunks/{copy.b62beae5.js → copy.5a4cbd4d.js} +3 -3
  129. package/dist/chunks/{copy.b62beae5.js.map → copy.5a4cbd4d.js.map} +1 -1
  130. package/dist/chunks/{dropdown-default-textbox.a5eca928.js → dropdown-default-textbox.819e43f7.js} +32 -30
  131. package/dist/chunks/dropdown-default-textbox.819e43f7.js.map +1 -0
  132. package/dist/chunks/{dropdown.368486b1.js → dropdown.c05678d0.js} +142 -139
  133. package/dist/chunks/dropdown.c05678d0.js.map +1 -0
  134. package/dist/chunks/{error-message.a581a172.js → error-message.0433b539.js} +2 -2
  135. package/dist/chunks/{error-message.a581a172.js.map → error-message.0433b539.js.map} +1 -1
  136. package/dist/chunks/footer-actions.67642347.js +98 -0
  137. package/dist/chunks/footer-actions.67642347.js.map +1 -0
  138. package/dist/chunks/form-layout.types.a7a1438d.js +5 -0
  139. package/dist/chunks/form-layout.types.a7a1438d.js.map +1 -0
  140. package/dist/chunks/{index.3b6fc08a.js → index.0cf00b47.js} +6 -6
  141. package/dist/chunks/{index.3b6fc08a.js.map → index.0cf00b47.js.map} +1 -1
  142. package/dist/chunks/{index.f0d99471.js → index.10aaf539.js} +198 -192
  143. package/dist/chunks/{index.f0d99471.js.map → index.10aaf539.js.map} +1 -1
  144. package/dist/chunks/{index.ad39b625.js → index.133e4da0.js} +2 -2
  145. package/dist/chunks/{index.ad39b625.js.map → index.133e4da0.js.map} +1 -1
  146. package/dist/chunks/{index.175f9e2d.js → index.56858f4e.js} +15 -14
  147. package/dist/chunks/index.56858f4e.js.map +1 -0
  148. package/dist/chunks/{index.d07f9800.js → index.73d50fa6.js} +2 -2
  149. package/dist/chunks/{index.d07f9800.js.map → index.73d50fa6.js.map} +1 -1
  150. package/dist/chunks/{index.3dfea3bd.js → index.f0f8ed98.js} +3 -3
  151. package/dist/chunks/{index.3dfea3bd.js.map → index.f0f8ed98.js.map} +1 -1
  152. package/dist/chunks/{listbox-option-tag.c7e9a228.js → listbox-option-tag.8d6cccac.js} +3 -3
  153. package/dist/chunks/{listbox-option-tag.c7e9a228.js.map → listbox-option-tag.8d6cccac.js.map} +1 -1
  154. package/dist/chunks/{listbox.f51e92cd.js → listbox.116ed0c1.js} +177 -177
  155. package/dist/chunks/listbox.116ed0c1.js.map +1 -0
  156. package/dist/chunks/{loading-button.6d34f66f.js → loading-button.1c201f87.js} +10 -10
  157. package/dist/chunks/loading-button.1c201f87.js.map +1 -0
  158. package/dist/chunks/{tooltip.9af34fba.js → tooltip.2aff4fa6.js} +2 -2
  159. package/dist/chunks/tooltip.2aff4fa6.js.map +1 -0
  160. package/dist/chunks/use-form-layout-loading.d03e5d48.js +12 -0
  161. package/dist/chunks/use-form-layout-loading.d03e5d48.js.map +1 -0
  162. package/dist/code-snippet.js +6 -6
  163. package/dist/code-snippet.js.map +1 -1
  164. package/dist/country.js +149 -174
  165. package/dist/country.js.map +1 -1
  166. package/dist/currency.js +1 -1
  167. package/dist/data-grid.js +482 -499
  168. package/dist/data-grid.js.map +1 -1
  169. package/dist/date-picker.js +80 -74
  170. package/dist/date-picker.js.map +1 -1
  171. package/dist/date-range-picker.js +2 -2
  172. package/dist/date.js +1 -1
  173. package/dist/divider.js +1 -1
  174. package/dist/dropdown.js +72 -67
  175. package/dist/dropdown.js.map +1 -1
  176. package/dist/filter-bar.js +268 -265
  177. package/dist/filter-bar.js.map +1 -1
  178. package/dist/focus-trap.js +1 -1
  179. package/dist/form-layout.js +174 -0
  180. package/dist/form-layout.js.map +1 -0
  181. package/dist/header.js +3 -3
  182. package/dist/index.js +164 -155
  183. package/dist/index.js.map +1 -1
  184. package/dist/info-icon.js +2 -2
  185. package/dist/input-field.js +69 -67
  186. package/dist/input-field.js.map +1 -1
  187. package/dist/internal.js +6 -6
  188. package/dist/link.js +2 -2
  189. package/dist/loading-indicator.js +1 -1
  190. package/dist/menu.js +4 -4
  191. package/dist/modal.js +203 -324
  192. package/dist/modal.js.map +1 -1
  193. package/dist/pagination.js +4 -4
  194. package/dist/payment-method.js +2 -2
  195. package/dist/popover.js +4 -4
  196. package/dist/popper-container.js +2 -2
  197. package/dist/radio-group.js +97 -99
  198. package/dist/radio-group.js.map +1 -1
  199. package/dist/search-bar.js +2 -2
  200. package/dist/segmented-control.js +4 -4
  201. package/dist/sidepanel.js +218 -0
  202. package/dist/sidepanel.js.map +1 -0
  203. package/dist/status.js +2 -2
  204. package/dist/structured-list.js +1 -1
  205. package/dist/summary-grid.js +3 -3
  206. package/dist/tabs.js +3 -3
  207. package/dist/tabs.js.map +1 -1
  208. package/dist/tag.js +3 -3
  209. package/dist/textarea.js +84 -82
  210. package/dist/textarea.js.map +1 -1
  211. package/dist/timeline.js +23 -23
  212. package/dist/timeline.js.map +1 -1
  213. package/dist/toast.js +2 -2
  214. package/dist/toggle.js +2 -2
  215. package/dist/typography.js +1 -1
  216. package/dist/web-types.json +455 -73
  217. package/package.json +10 -8
  218. package/dist/@types/packages/vue2/src/components/country/composables/useCountryFlag.d.ts +0 -2
  219. package/dist/chunks/calendar.8f50a65a.js.map +0 -1
  220. package/dist/chunks/controls-group.9d58a091.js +0 -64
  221. package/dist/chunks/controls-group.9d58a091.js.map +0 -1
  222. package/dist/chunks/dropdown-default-textbox.a5eca928.js.map +0 -1
  223. package/dist/chunks/dropdown.368486b1.js.map +0 -1
  224. package/dist/chunks/index.175f9e2d.js.map +0 -1
  225. package/dist/chunks/listbox.f51e92cd.js.map +0 -1
  226. package/dist/chunks/loading-button.6d34f66f.js.map +0 -1
  227. package/dist/chunks/tooltip.9af34fba.js.map +0 -1
@@ -1,36 +1,37 @@
1
- import { ref as u, computed as p, defineComponent as M, watch as q, toRef as F, nextTick as T } from "vue";
2
- import { c as Y } from "./chunks/dropdown-default-textbox.a5eca928.js";
3
- import { BentoPopover as L, BentoPopoverPositions as W } from "./popover.js";
4
- import { g as d } from "./chunks/unique-id.a2a2b458.js";
5
- import { B as $, a as K, b as j } from "./chunks/index.175f9e2d.js";
6
- import { u as x } from "./chunks/i18n.155748d6.js";
7
- import { f as E } from "./chunks/index.d07f9800.js";
8
- import { e as _, d as z, f as G } from "./chunks/index.f55fdc32.js";
9
- import { D as B, v as H, f as J } from "./chunks/date-input.9186a0bf.js";
10
- import { d as Q } from "./chunks/debounce.f8d92e44.js";
11
- import { C as k } from "./chunks/calendar.8f50a65a.js";
12
- import { b as Se } from "./chunks/calendar.8f50a65a.js";
13
- import { E as X } from "./chunks/error-message.a581a172.js";
14
- import { B as Z } from "./chunks/directive.0408e565.js";
15
- import { n as ee } from "./chunks/_plugin-vue2_normalizer.71e2aa87.js";
16
- import "./assets/index21.css";
17
- var i = /* @__PURE__ */ ((a) => (a.INPUT = "input", a))(i || {});
18
- const ae = ({ datePickerValue: a, isDateIncorrect: e }) => {
19
- const { locale: t, t: n } = x(), f = { de: z, enUS: _, fr: G }, l = u(null);
1
+ import { ref as u, computed as p, defineComponent as q, toRef as T, watch as L, nextTick as B } from "vue";
2
+ import { c as Y } from "./chunks/dropdown-default-textbox.819e43f7.js";
3
+ import { BentoPopover as W, BentoPopoverPositions as $ } from "./popover.js";
4
+ import { g as c } from "./chunks/unique-id.a2a2b458.js";
5
+ import { B as K, a as j, b as z } from "./chunks/index.56858f4e.js";
6
+ import { u as O } from "./chunks/i18n.155748d6.js";
7
+ import { f as E } from "./chunks/index.73d50fa6.js";
8
+ import { e as _, d as G, f as H } from "./chunks/index.f55fdc32.js";
9
+ import { D as x, v as J, f as Q } from "./chunks/date-input.9186a0bf.js";
10
+ import { d as X } from "./chunks/debounce.f8d92e44.js";
11
+ import { u as Z } from "./chunks/use-form-layout-loading.d03e5d48.js";
12
+ import { C as k } from "./chunks/calendar.0ae43a96.js";
13
+ import { b as Re } from "./chunks/calendar.0ae43a96.js";
14
+ import { E as ee } from "./chunks/error-message.0433b539.js";
15
+ import { B as ae } from "./chunks/directive.0408e565.js";
16
+ import { n as te } from "./chunks/_plugin-vue2_normalizer.71e2aa87.js";
17
+ import "./assets/index8.css";
18
+ var l = /* @__PURE__ */ ((a) => (a.INPUT = "input", a))(l || {});
19
+ const re = ({ datePickerValue: a, isDateIncorrect: e }) => {
20
+ const { locale: t, t: n } = O(), f = { de: G, enUS: _, fr: H }, i = u(null);
20
21
  return {
21
22
  // Values
22
- dateDisplayValue: p(() => e.value ? l.value : a.value ? E(a.value, B.FULL_DATE, {
23
+ dateDisplayValue: p(() => e.value ? i.value : a.value ? E(a.value, x.FULL_DATE, {
23
24
  locale: f[t.value.substring(0, 2)] || _
24
25
  }) : n("selectDate")),
25
- textInputValue: l,
26
+ textInputValue: i,
26
27
  // Methods
27
28
  formatTextInputDisplayValue: (D = a.value) => {
28
- e.value || (l.value = D ? E(D, B.NUMERIC_DATE_YEAR_FIRST, {
29
+ e.value || (i.value = D ? E(D, x.NUMERIC_DATE_YEAR_FIRST, {
29
30
  locale: f[t.value.substring(0, 2)] || _
30
31
  }) : null);
31
32
  }
32
33
  };
33
- }, te = {
34
+ }, ne = {
34
35
  "en-US": {
35
36
  optional: "optional",
36
37
  required: "required",
@@ -40,17 +41,17 @@ const ae = ({ datePickerValue: a, isDateIncorrect: e }) => {
40
41
  selectedDateIsNotAvailable: "Selected date is not available",
41
42
  datePicker: "Date picker"
42
43
  }
43
- }, re = 1e3, ne = M({
44
- i18n: { messages: te },
44
+ }, oe = 1e3, le = q({
45
+ i18n: { messages: ne },
45
46
  name: "bento-date-picker",
46
47
  components: {
47
- BentoTypography: $,
48
- BentoPopover: L,
48
+ BentoTypography: K,
49
+ BentoPopover: W,
49
50
  Calendar: k,
50
- ErrorMessage: X,
51
+ ErrorMessage: ee,
51
52
  DropdownInputDefault: Y
52
53
  },
53
- directives: { BentoClickOutsideDirective: Z },
54
+ directives: { BentoClickOutsideDirective: ae },
54
55
  props: {
55
56
  /**
56
57
  * Descriptive supporting text visbile underneath the dropdown.
@@ -80,6 +81,10 @@ const ae = ({ datePickerValue: a, isDateIncorrect: e }) => {
80
81
  * Highlights the dropdown is optional.
81
82
  */
82
83
  optional: { type: Boolean, default: !1 },
84
+ /**
85
+ * The Boolean readonly property, when present, makes the element not mutable, meaning the user can not edit the date picker.
86
+ */
87
+ readonly: { type: Boolean, default: !1 },
83
88
  /**
84
89
  * Highlights the dropdown is required.
85
90
  */
@@ -89,97 +94,98 @@ const ae = ({ datePickerValue: a, isDateIncorrect: e }) => {
89
94
  */
90
95
  value: { type: [Date, Object], default: null }
91
96
  },
92
- emits: [i.INPUT],
97
+ emits: [l.INPUT],
93
98
  setup(a, { emit: e }) {
94
- const { t } = x(), n = d("bento-date-picker-container"), f = d("bento-date-picker-label"), l = d("bento-date-picker-description"), b = d("bento-date-picker-error"), v = d("bento-date-picker-date-error"), D = p(() => a.label || t("datePicker", { name: n })), g = u(null), S = u(null), o = u(!1), s = u(!1);
95
- q(
99
+ const { t } = O(), n = c("bento-date-picker-container"), f = c("bento-date-picker-label"), i = c("bento-date-picker-description"), m = c("bento-date-picker-error"), y = c("bento-date-picker-date-error"), D = p(() => a.label || t("datePicker", { name: n })), g = u(null), S = u(null), o = u(!1), s = u(!1), { isReadOnly: h } = Z(T(a, "readonly"));
100
+ L(
96
101
  () => a.disabled,
97
102
  (r) => {
98
103
  r && s.value && (s.value = !1);
99
104
  }
100
105
  );
101
- const { dateDisplayValue: O, textInputValue: c, formatTextInputDisplayValue: I } = ae({
102
- datePickerValue: F(a, "value"),
106
+ const { dateDisplayValue: R, textInputValue: d, formatTextInputDisplayValue: I } = re({
107
+ datePickerValue: T(a, "value"),
103
108
  isDateIncorrect: o
104
- }), m = p(() => a.isDateDisabled && a.isDateDisabled(new Date(c.value)) ? t("selectedDateIsNotAvailable") : o.value ? t("provideDateInAFormat") : null), h = p(() => ({
105
- "b-date-picker__description--error": a.errorMessage || m.value
106
- })), w = p(
107
- () => `${a.description ? l : ""} ${a.errorMessage ? b : ""} ${m.value ? v : ""}`.trim() || null
108
- ), N = (r) => a.isDateDisabled ? !a.isDateDisabled(r) : !0, P = () => {
109
+ }), v = p(() => a.isDateDisabled && a.isDateDisabled(new Date(d.value)) ? t("selectedDateIsNotAvailable") : o.value ? t("provideDateInAFormat") : null), w = p(() => ({
110
+ "b-date-picker__description--error": a.errorMessage || v.value
111
+ })), N = p(
112
+ () => `${a.description ? i : ""} ${a.errorMessage ? m : ""} ${v.value ? y : ""}`.trim() || null
113
+ ), V = (r) => a.isDateDisabled ? !a.isDateDisabled(r) : !0, P = () => {
109
114
  s.value = !1;
110
115
  }, C = () => {
111
116
  s.value = !0, I();
112
- }, R = (r) => {
113
- o.value = !1, P(), e(i.INPUT, r);
114
- }, V = async () => {
115
- o.value && (o.value = !1, c.value = null), e(i.INPUT, null);
116
117
  }, A = (r) => {
117
- H(r);
118
- }, U = Q((r) => {
118
+ o.value = !1, P(), e(l.INPUT, r);
119
+ }, U = async () => {
120
+ o.value && (o.value = !1, d.value = null), e(l.INPUT, null);
121
+ }, M = (r) => {
122
+ J(r);
123
+ }, F = X((r) => {
119
124
  if (r.length < 10)
120
125
  return;
121
- /^\d{4}-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])$/.test(r) && N(new Date(r)) ? (o.value = !1, e(i.INPUT, new Date(r))) : r && (o.value = !0, e(i.INPUT, null));
122
- }, re);
126
+ /^\d{4}-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])$/.test(r) && V(new Date(r)) ? (o.value = !1, e(l.INPUT, new Date(r))) : r && (o.value = !0, e(l.INPUT, null));
127
+ }, oe);
123
128
  return {
124
129
  // Refs
125
130
  inputContainerRef: S,
126
131
  calendarContainerRef: g,
127
132
  // Values,
128
- dateDisplayValue: O,
133
+ dateDisplayValue: R,
129
134
  datePickerContainerId: n,
130
- descriptionConditionalClasses: h,
135
+ descriptionConditionalClasses: w,
131
136
  isDateIncorrect: o,
132
137
  isDatePickerOpen: s,
133
- dateErrorText: m,
138
+ isReadOnly: h,
139
+ dateErrorText: v,
134
140
  labelId: f,
135
- descriptionId: l,
136
- errorId: b,
137
- dateErrorId: v,
141
+ descriptionId: i,
142
+ errorId: m,
143
+ dateErrorId: y,
138
144
  popoverAriaLabel: D,
139
- ariaDescribedBy: w,
140
- textInputValue: c,
145
+ ariaDescribedBy: N,
146
+ textInputValue: d,
141
147
  // Enums
142
- BentoTypographyElement: K,
143
- BentoTypographyVariant: j,
144
- BentoPopoverPositions: W,
148
+ BentoTypographyElement: j,
149
+ BentoTypographyVariant: z,
150
+ BentoPopoverPositions: $,
145
151
  // Events
146
152
  closeDatePicker: P,
147
- clearDatePickerValue: V,
148
- onDateSelected: R,
153
+ clearDatePickerValue: U,
154
+ onDateSelected: A,
149
155
  openDatePicker: C,
150
- onDateKeyDown: A,
156
+ onDateKeyDown: M,
151
157
  onDateInputChange: (r) => {
152
- c.value = J(r), U(c.value);
158
+ d.value = Q(r), F(d.value);
153
159
  },
154
160
  // Keyboard navigation
155
161
  onSpaceBarOrEnter: async (r) => {
156
- var y;
157
- s.value || (r.preventDefault(), C(), await T(), a.value || (I(/* @__PURE__ */ new Date()), e(i.INPUT, /* @__PURE__ */ new Date()), await T()), (y = g.value) == null || y.$refs.calendarRef[0].focusOnDate(a.value));
162
+ var b;
163
+ s.value || (r.preventDefault(), C(), await B(), a.value || (I(/* @__PURE__ */ new Date()), e(l.INPUT, /* @__PURE__ */ new Date()), await B()), (b = g.value) == null || b.$refs.calendarRef[0].focusOnDate(a.value));
158
164
  }
159
165
  };
160
166
  }
161
167
  });
162
- var oe = function() {
168
+ var ie = function() {
163
169
  var e = this, t = e._self._c;
164
170
  return e._self._setupProxy, t("div", { directives: [{ name: "bento-click-outside-directive", rawName: "v-bento-click-outside-directive", value: e.closeDatePicker, expression: "closeDatePicker" }], staticClass: "b-date-picker", on: { "!keydown": [function(n) {
165
171
  return !n.type.indexOf("key") && e._k(n.keyCode, "space", 32, n.key, [" ", "Spacebar"]) ? null : e.onSpaceBarOrEnter.apply(null, arguments);
166
172
  }, function(n) {
167
173
  return !n.type.indexOf("key") && e._k(n.keyCode, "enter", 13, n.key, "Enter") ? null : e.onSpaceBarOrEnter.apply(null, arguments);
168
- }] } }, [e.label ? t("div", { staticClass: "b-date-picker__label", attrs: { id: e.labelId } }, [t("bento-typography", { attrs: { el: e.BentoTypographyElement.SPAN, stronger: "" } }, [e._v(e._s(e.label))]), e.optional ? t("bento-typography", { staticClass: "b-date-picker__label-requirement", attrs: { el: e.BentoTypographyElement.SPAN } }, [e._v(" (" + e._s(e.$t("optional")) + ") ")]) : e._e(), e.required ? t("bento-typography", { staticClass: "b-date-picker__label-requirement", attrs: { el: e.BentoTypographyElement.SPAN } }, [e._v(" (" + e._s(e.$t("required")) + ") ")]) : e._e()], 1) : e._e(), t("div", [t("dropdown-input-default", { ref: "inputContainerRef", attrs: { ariaControls: e.datePickerContainerId, ariaExpanded: e.isDatePickerOpen, "aria-labelledby": e.label ? e.labelId : null, "aria-describedby": e.ariaDescribedBy, disabled: e.disabled, "dynamic-filtering": "", "is-invalid": !!e.errorMessage || !!e.dateErrorText, open: e.isDatePickerOpen, value: e.textInputValue, "display-value": e.dateDisplayValue, "debounce-time": 0 }, on: { input: e.onDateInputChange, open: e.openDatePicker, keydown: e.onDateKeyDown, clear: e.clearDatePickerValue, close: e.closeDatePicker } })], 1), e.dateErrorText ? t("error-message", { staticClass: "b-date-picker__error-message", attrs: { id: e.dateErrorId, "error-message": e.dateErrorText } }) : e._e(), e.errorMessage ? t("error-message", { staticClass: "b-date-picker__error-message", attrs: { id: e.errorId, "error-message": e.errorMessage } }) : e._e(), e.description ? t("bento-typography", { staticClass: "b-date-picker__description", class: e.descriptionConditionalClasses, attrs: { el: e.BentoTypographyElement.SPAN } }, [e._v(" " + e._s(e.description) + " ")]) : e._e(), e.inputContainerRef ? t("bento-popover", { staticClass: "b-date-picker__container", attrs: { id: e.datePickerContainerId, role: "dialog", open: e.isDatePickerOpen, "target-element": e.inputContainerRef, "disable-focus-trap": !0, "aria-label": e.popoverAriaLabel, "aria-modal": !0, position: e.BentoPopoverPositions.BOTTOM_START, "fit-content": "" } }, [t("calendar", { ref: "calendarContainerRef", attrs: { "first-day-of-week": e.firstDayOfWeek, "is-date-disabled": e.isDateDisabled, "number-of-months": 1, value: e.value }, on: { input: e.onDateSelected } })], 1) : e._e()], 1);
169
- }, ie = [], le = /* @__PURE__ */ ee(
170
- ne,
171
- oe,
174
+ }] } }, [e.label ? t("div", { staticClass: "b-date-picker__label", attrs: { id: e.labelId } }, [t("bento-typography", { attrs: { el: e.BentoTypographyElement.SPAN, stronger: "" } }, [e._v(e._s(e.label))]), e.optional ? t("bento-typography", { staticClass: "b-date-picker__label-requirement", attrs: { el: e.BentoTypographyElement.SPAN } }, [e._v(" (" + e._s(e.$t("optional")) + ") ")]) : e._e(), e.required ? t("bento-typography", { staticClass: "b-date-picker__label-requirement", attrs: { el: e.BentoTypographyElement.SPAN } }, [e._v(" (" + e._s(e.$t("required")) + ") ")]) : e._e()], 1) : e._e(), t("div", [t("dropdown-input-default", { ref: "inputContainerRef", attrs: { ariaControls: e.datePickerContainerId, ariaExpanded: e.isDatePickerOpen, "aria-labelledby": e.label ? e.labelId : null, "aria-describedby": e.ariaDescribedBy, disabled: e.disabled, "dynamic-filtering": "", "is-invalid": !!e.errorMessage || !!e.dateErrorText, open: e.isDatePickerOpen, value: e.textInputValue, "display-value": e.dateDisplayValue, "debounce-time": 0, readonly: e.isReadOnly }, on: { input: e.onDateInputChange, open: e.openDatePicker, keydown: e.onDateKeyDown, clear: e.clearDatePickerValue, close: e.closeDatePicker } })], 1), e.dateErrorText ? t("error-message", { staticClass: "b-date-picker__error-message", attrs: { id: e.dateErrorId, "error-message": e.dateErrorText } }) : e._e(), e.errorMessage ? t("error-message", { staticClass: "b-date-picker__error-message", attrs: { id: e.errorId, "error-message": e.errorMessage } }) : e._e(), e.description ? t("bento-typography", { staticClass: "b-date-picker__description", class: e.descriptionConditionalClasses, attrs: { el: e.BentoTypographyElement.SPAN } }, [e._v(" " + e._s(e.description) + " ")]) : e._e(), e.inputContainerRef ? t("bento-popover", { staticClass: "b-date-picker__container", attrs: { id: e.datePickerContainerId, role: "dialog", open: e.isDatePickerOpen, "target-element": e.inputContainerRef, "disable-focus-trap": !0, "aria-label": e.popoverAriaLabel, "aria-modal": !0, position: e.BentoPopoverPositions.BOTTOM_START, "fit-content": "" } }, [t("calendar", { ref: "calendarContainerRef", attrs: { "first-day-of-week": e.firstDayOfWeek, "is-date-disabled": e.isDateDisabled, "number-of-months": 1, value: e.value }, on: { input: e.onDateSelected } })], 1) : e._e()], 1);
175
+ }, se = [], de = /* @__PURE__ */ te(
176
+ le,
172
177
  ie,
178
+ se,
173
179
  !1,
174
180
  null,
175
- "b198028b",
181
+ "a6d9e3d8",
176
182
  null,
177
183
  null
178
184
  );
179
- const Te = le.exports;
185
+ const xe = de.exports;
180
186
  export {
181
- Te as BentoDatePicker,
182
- i as BentoDatePickerEvent,
183
- Se as BentoDatePickerFirstDayOfWeek
187
+ xe as BentoDatePicker,
188
+ l as BentoDatePickerEvent,
189
+ Re as BentoDatePickerFirstDayOfWeek
184
190
  };
185
191
  //# sourceMappingURL=date-picker.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"date-picker.js","sources":["../src/components/date-picker/date-picker.types.ts","../src/components/date-picker/composables/use-date-picker-single-calendar-text.ts","../src/components/date-picker/date-picker.vue"],"sourcesContent":["export { CalendarFirstDayOfWeek as BentoDatePickerFirstDayOfWeek } from '@/internal';\nexport type {\n CalendarIsDateDisabled as BentoDatePickerIsDateDisabled,\n CalendarSingleDateValue as BentoDatePickerValue,\n} from '@/internal';\n\nexport enum BentoDatePickerEvent {\n INPUT = 'input',\n}\n","import { computed, ref } from 'vue';\nimport { de, enUS, fr } from 'date-fns/locale';\nimport { useI18n } from '@/utils/ts/i18n';\nimport { UseDateDisplayText } from './use-date-picker-single-calendar-text.types';\nimport { DateFormat } from '@/types';\nimport format from 'date-fns/format';\n\n/**\n * Composable that sets and formats the date to be displayed in the input box of a Single Date Picker\n * @param {Ref<Date>} option.datePickerValue Ref to the datePickerValue set in the DatePicker component\n * @param {Ref<boolean>} option.isDateIncorrect Indicates if the date is correct or not\n */\nexport const useDatePickerSingleCalendarText: UseDateDisplayText<Date> = ({ datePickerValue, isDateIncorrect }) => {\n const { locale, t } = useI18n();\n const locales = { de, enUS, fr };\n\n const textInputValue = ref(null);\n\n const dateDisplayValue = computed(() => {\n // Display incorrect date when there's an error with the input\n if (isDateIncorrect.value) {\n return textInputValue.value;\n }\n\n // Display \"Select a date\" when there's no date selected or input\n if (!datePickerValue.value) {\n return t('selectDate') as string;\n }\n\n // Display the date in format \"dd MMM, yyyy (25 Jun, 2023)\" if there's a valid date selected\n return format(datePickerValue.value as Date, DateFormat.FULL_DATE, {\n locale: locales[locale.value.substring(0, 2)] || enUS,\n });\n });\n\n /**\n * Formats the \"dateToFormat\" date value with the yyyy-MM-dd format and sets it as \"formatTextInputDisplayValue\" value\n * @param {DATE} dateToFormat - Date to be assigned and formatted\n */\n const formatTextInputDisplayValue = (dateToFormat: Date = datePickerValue.value) => {\n // If date is incorrect, leave the textInputValue intact\n if (isDateIncorrect.value) {\n return;\n }\n\n textInputValue.value = dateToFormat\n ? format(dateToFormat, DateFormat.NUMERIC_DATE_YEAR_FIRST, {\n locale: locales[locale.value.substring(0, 2)] || enUS,\n })\n : null;\n };\n\n return {\n // Values\n dateDisplayValue,\n textInputValue,\n\n // Methods\n formatTextInputDisplayValue,\n };\n};\n","<!-- TODO: Remove aria props as these are part of JSX elements /vue/types/jsx.d.ts -->\n<!-- eslint-disable vue/attribute-hyphenation -->\n<template>\n <div\n v-bento-click-outside-directive=\"closeDatePicker\"\n class=\"b-date-picker\"\n @keydown.space.capture=\"onSpaceBarOrEnter\"\n @keydown.enter.capture=\"onSpaceBarOrEnter\"\n >\n <!-- Label -->\n <div v-if=\"label\" :id=\"labelId\" class=\"b-date-picker__label\">\n <bento-typography :el=\"BentoTypographyElement.SPAN\" stronger>{{ label }}</bento-typography>\n <bento-typography\n v-if=\"optional\"\n class=\"b-date-picker__label-requirement\"\n :el=\"BentoTypographyElement.SPAN\"\n >\n ({{ $t('optional') }})\n </bento-typography>\n <bento-typography\n v-if=\"required\"\n class=\"b-date-picker__label-requirement\"\n :el=\"BentoTypographyElement.SPAN\"\n >\n ({{ $t('required') }})\n </bento-typography>\n </div>\n\n <!-- Input -->\n <div>\n <dropdown-input-default\n ref=\"inputContainerRef\"\n :ariaControls=\"datePickerContainerId\"\n :ariaExpanded=\"isDatePickerOpen\"\n :aria-labelledby=\"label ? labelId : null\"\n :aria-describedby=\"ariaDescribedBy\"\n :disabled=\"disabled\"\n dynamic-filtering\n :is-invalid=\"!!errorMessage || !!dateErrorText\"\n :open=\"isDatePickerOpen\"\n :value=\"textInputValue\"\n :display-value=\"dateDisplayValue\"\n :debounce-time=\"0\"\n @input=\"onDateInputChange\"\n @open=\"openDatePicker\"\n @keydown=\"onDateKeyDown\"\n @clear=\"clearDatePickerValue\"\n @close=\"closeDatePicker\"\n />\n </div>\n\n <!-- Error Messages -->\n <error-message\n v-if=\"dateErrorText\"\n :id=\"dateErrorId\"\n :error-message=\"dateErrorText\"\n class=\"b-date-picker__error-message\"\n />\n <error-message\n v-if=\"errorMessage\"\n :id=\"errorId\"\n :error-message=\"errorMessage\"\n class=\"b-date-picker__error-message\"\n />\n\n <!-- Description -->\n <bento-typography\n v-if=\"description\"\n class=\"b-date-picker__description\"\n :class=\"descriptionConditionalClasses\"\n :el=\"BentoTypographyElement.SPAN\"\n >\n {{ description }}\n </bento-typography>\n\n <!-- Calendar container -->\n <bento-popover\n v-if=\"inputContainerRef\"\n :id=\"datePickerContainerId\"\n class=\"b-date-picker__container\"\n role=\"dialog\"\n :open=\"isDatePickerOpen\"\n :target-element=\"inputContainerRef\"\n :disable-focus-trap=\"true\"\n :aria-label=\"popoverAriaLabel\"\n :aria-modal=\"true\"\n :position=\"BentoPopoverPositions.BOTTOM_START\"\n fit-content\n >\n <calendar\n ref=\"calendarContainerRef\"\n :first-day-of-week=\"firstDayOfWeek\"\n :is-date-disabled=\"isDateDisabled\"\n :number-of-months=\"1\"\n :value=\"value\"\n @input=\"onDateSelected\"\n />\n </bento-popover>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent, nextTick, PropType, Ref, ref, toRef, watch } from 'vue';\n import { BentoClickOutsideDirective } from '@/directives';\n import { BentoDatePickerEvent, BentoDatePickerValue } from './date-picker.types';\n import { Calendar, ErrorMessage } from '@/internal';\n import { DropdownInputDefault } from '@/components/dropdown/components';\n import { BentoPopover, BentoPopoverPositions } from '@/components/popover';\n import { generateUid } from '@/utils/ts/unique-id';\n import { BentoTypography, BentoTypographyElement, BentoTypographyVariant } from '../typography';\n import { useDatePickerSingleCalendarText } from './composables/use-date-picker-single-calendar-text';\n import { formatDateInputValue, validateDateInput } from '@/utils/ts/date-input';\n import { useI18n } from '@/utils/ts/i18n';\n import { debounce } from '@/utils/ts/debounce';\n\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n const DEBOUNCE_TIME = 1000;\n\n /**\n * Date picker selector.\n *\n * @example\n * import { BentoDatePicker } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoDatePicker },\n * template: `\n * <bento-date-picker\n * label=\"Label\"\n * description=\"Supporting text\"\n * required\n * optional\n * disabled\n * @input=\"onDateChanged\"\n * v-model=\"selectedDate\"\n * />\n * `,\n * setup() {\n * const selectedDate = ref(new Date()); // reactive({ startDate: new Date(), endDate: new Date() })\n * return {\n * selectedDate,\n * }\n * }\n * }\n */\n export default defineComponent({\n i18n: { messages },\n name: 'bento-date-picker',\n components: {\n BentoTypography,\n BentoPopover,\n Calendar,\n ErrorMessage,\n DropdownInputDefault,\n },\n directives: { BentoClickOutsideDirective },\n props: {\n /**\n * Descriptive supporting text visbile underneath the dropdown.\n */\n description: { type: String, default: undefined },\n\n /**\n * Disables dropdown functionality.\n */\n disabled: { type: Boolean, default: false },\n\n /**\n * Displays component in an error state with an error message\n */\n errorMessage: { type: String, default: null },\n\n /**\n * Allows you to set the first day of the week. 0 is sunday, 1 is monday, 6 is saturday\n */\n firstDayOfWeek: Calendar.props.firstDayOfWeek,\n\n /**\n * Indicate if a date should be disabled or not\n */\n isDateDisabled: Calendar.props.isDateDisabled,\n\n /**\n * Text that is displayed as a label above the element.\n */\n label: { type: String, default: undefined },\n\n /**\n * Highlights the dropdown is optional.\n */\n optional: { type: Boolean, default: false },\n\n /**\n * Highlights the dropdown is required.\n */\n required: { type: Boolean, default: false },\n\n /**\n * Selected date\n */\n value: { type: [Date, Object] as PropType<BentoDatePickerValue>, default: null },\n },\n emits: [BentoDatePickerEvent.INPUT],\n setup(props, { emit }) {\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n const datePickerContainerId = generateUid('bento-date-picker-container');\n const labelId = generateUid('bento-date-picker-label');\n const descriptionId = generateUid('bento-date-picker-description');\n const errorId = generateUid('bento-date-picker-error');\n const dateErrorId = generateUid('bento-date-picker-date-error');\n const popoverAriaLabel = computed(() => props.label || t('datePicker', { name: datePickerContainerId }));\n\n // Refs\n const calendarContainerRef = ref(null);\n const inputContainerRef = ref(null);\n\n // Values\n const isDateIncorrect = ref(false);\n const isDatePickerOpen = ref(false);\n\n watch(\n () => props.disabled,\n disabled => {\n // Close date picker popover if it's opened when it's disabled\n if (disabled && isDatePickerOpen.value) {\n isDatePickerOpen.value = false;\n }\n }\n );\n\n const { dateDisplayValue, textInputValue, formatTextInputDisplayValue } = useDatePickerSingleCalendarText({\n datePickerValue: toRef(props, 'value') as Ref<Date>,\n isDateIncorrect,\n });\n\n const dateErrorText = computed(() => {\n if (props.isDateDisabled && props.isDateDisabled(new Date(textInputValue.value))) {\n return t('selectedDateIsNotAvailable');\n }\n\n return isDateIncorrect.value ? t('provideDateInAFormat') : null;\n });\n\n const descriptionConditionalClasses = computed(() => ({\n 'b-date-picker__description--error': props.errorMessage || dateErrorText.value,\n }));\n\n const ariaDescribedBy = computed(\n () =>\n `${props.description ? descriptionId : ''} ${props.errorMessage ? errorId : ''} ${\n dateErrorText.value ? dateErrorId : ''\n }`.trim() || null\n );\n\n const isDateEnabled = (date: Date) => {\n // Check if function is set, otherwise all dates are enabled\n if (props.isDateDisabled) {\n return !props.isDateDisabled(date);\n }\n\n return true;\n };\n\n const closeDatePicker = () => {\n isDatePickerOpen.value = false;\n };\n\n const openDatePicker = () => {\n isDatePickerOpen.value = true;\n\n formatTextInputDisplayValue();\n };\n\n const onDateSelected = (selectedDate: Date) => {\n // Reset the error state when a valid date is selected\n isDateIncorrect.value = false;\n\n closeDatePicker();\n emit(BentoDatePickerEvent.INPUT, selectedDate);\n };\n\n const clearDatePickerValue = async () => {\n if (isDateIncorrect.value) {\n isDateIncorrect.value = false;\n textInputValue.value = null;\n }\n emit(BentoDatePickerEvent.INPUT, null);\n };\n\n const onDateKeyDown = (event: KeyboardEvent) => {\n validateDateInput(event);\n };\n\n const validateDate = debounce((stringDate: string) => {\n // Validate only if the date is complete\n if (stringDate.length < 10) {\n return;\n }\n\n // Checks for YYYY-MM-DD format\n const dateRegex = /^\\d{4}-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])$/;\n const isValidDate = dateRegex.test(stringDate) && isDateEnabled(new Date(stringDate));\n if (isValidDate) {\n isDateIncorrect.value = false;\n emit(BentoDatePickerEvent.INPUT, new Date(stringDate));\n } else if (stringDate) {\n // Only set to true if the value exists (not null/undefined)\n isDateIncorrect.value = true;\n emit(BentoDatePickerEvent.INPUT, null);\n }\n }, DEBOUNCE_TIME);\n\n const onDateInputChange = (stringDate: string) => {\n textInputValue.value = formatDateInputValue(stringDate);\n validateDate(textInputValue.value);\n };\n\n /**\n * Space bar and Enter keyDown event handler.\n *\n * * Opens the date picker dialog on the first keydown.\n * * Move focus to selected date, i.e., the date displayed in the date input text field. If no date has been selected, places focus on the current date.\n * @param {KeyboardEvent} event Event being triggered\n */\n const onSpaceBarOrEnter = async (event: KeyboardEvent) => {\n if (isDatePickerOpen.value) {\n return;\n }\n event.preventDefault();\n\n openDatePicker();\n\n // Wait for the date picker dialog to open\n await nextTick();\n\n // Set current date (today) if no date is selected\n if (!props.value) {\n // Format the opened date picker date to YYYY-MM-DD\n formatTextInputDisplayValue(new Date());\n emit(BentoDatePickerEvent.INPUT, new Date());\n\n // Wait for new value to be set with the emit\n await nextTick();\n }\n\n // Focus on date\n calendarContainerRef.value?.$refs.calendarRef[0].focusOnDate(props.value);\n };\n\n return {\n // Refs\n inputContainerRef,\n calendarContainerRef,\n\n // Values,\n dateDisplayValue,\n datePickerContainerId,\n descriptionConditionalClasses,\n isDateIncorrect,\n isDatePickerOpen,\n dateErrorText,\n labelId,\n descriptionId,\n errorId,\n dateErrorId,\n popoverAriaLabel,\n ariaDescribedBy,\n textInputValue,\n\n // Enums\n BentoTypographyElement,\n BentoTypographyVariant,\n BentoPopoverPositions,\n\n // Events\n closeDatePicker,\n clearDatePickerValue,\n onDateSelected,\n openDatePicker,\n onDateKeyDown,\n onDateInputChange,\n\n // Keyboard navigation\n onSpaceBarOrEnter,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./date-picker.scss\" />\n"],"names":["BentoDatePickerEvent","BentoDatePickerEvent2","useDatePickerSingleCalendarText","datePickerValue","isDateIncorrect","locale","t","useI18n","locales","de","enUS","fr","textInputValue","ref","computed","format","DateFormat","dateToFormat","DEBOUNCE_TIME","_sfc_main","defineComponent","messages","BentoTypography","BentoPopover","Calendar","ErrorMessage","DropdownInputDefault","BentoClickOutsideDirective","props","emit","datePickerContainerId","generateUid","labelId","descriptionId","errorId","dateErrorId","popoverAriaLabel","calendarContainerRef","inputContainerRef","isDatePickerOpen","watch","disabled","dateDisplayValue","formatTextInputDisplayValue","toRef","dateErrorText","descriptionConditionalClasses","ariaDescribedBy","isDateEnabled","date","closeDatePicker","openDatePicker","onDateSelected","selectedDate","clearDatePickerValue","onDateKeyDown","event","validateDateInput","validateDate","debounce","stringDate","BentoTypographyElement","BentoTypographyVariant","BentoPopoverPositions","formatDateInputValue","nextTick","_a"],"mappings":";;;;;;;;;;;;;;;;AAMY,IAAAA,IAAA,kBAAAC,OACRA,EAAA,QAAA,SADQA,IAAAD,KAAA,CAAA,CAAA;ACML,MAAAE,KAAA,CAAA,EAAA,iBAAAC,GAAA,iBAAAC,EAAA,MAAA;AACH,QAAA,EAAA,QAAAC,GAAA,GAAAC,EAAA,IAAAC,EAAA,GACAC,IAAA,EAAA,IAAAC,GAAA,MAAAC,GAAA,IAAAC,EAAA,GAEAC,IAAAC,EAAA,IAAA;AAoCA,SAAA;AAAA;AAAA,IAAO,kBAlCPC,EAAA,MAEIV,EAAA,QACIQ,EAAA,QAIJT,EAAA,QAKAY,EAAAZ,EAAA,OAAAa,EAAA,WAAA;AAAA,MAAmE,QAAAR,EAAAH,EAAA,MAAA,UAAA,GAAA,CAAA,CAAA,KAAAK;AAAA,IACd,CAAA,IALjDJ,EAAA,YAAA,CAMH;AAAA,IAsBD,gBAAAM;AAAA;AAAA,IACA,6BAhBJ,CAAAK,IAAAd,EAAA,UAAA;AAEI,MAAAC,EAAA,UAIAQ,EAAA,QAAAK,IAAAF,EAAAE,GAAAD,EAAA,yBAAA;AAAA,QAC+D,QAAAR,EAAAH,EAAA,MAAA,UAAA,GAAA,CAAA,CAAA,KAAAK;AAAA,MACJ,CAAA,IAAA;AAAA,IAErD;AAAA,EASN;AAER;;;;;;;;;;GC0DAQ,KAAA,KA6BAC,KAAAC,EAAA;AAAA,EAAA,MAAA,EAAA,UAAAC,GAAA;AAAA,EACA,MAAA;AAAA,EACA,YAAA;AAAA,IACA,iBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,UAAAC;AAAA,IACA,cAAAC;AAAA,IACA,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AA,OAAA,IAAA,KAAA4D,CAAA,CAAA,KAAAA,MAGAxD,EAAA,QAAA,IACAyB,EAAA7B,EAAA,OAAA,IAAA;AAAA,IACA,GAAAkB,EAAA;AAwCA,WAAA;AAAA;AAAA,MAAA,mBAAAoB;AAAA,MAEA,sBAAAD;AAAA;AAAA,MACA,kBAAAK;AAAA,MAGA,uBAAAZ;AAAA,MACA,+BAAAgB;AAAA,MACA,iBAAA1C;AAAA,MACA,kBAAAmC;AAAA,MACA,eAAAM;AAAA,MACA,SAAAb;AAAA,MACA,eAAAC;AAAA,MACA,SAAAC;AAAA,MACA,aAAAC;AAAA,MACA,kBAAAC;AAAA,MACA,iBAAAW;AAAA,MACA,gBAAAnC;AAAA;AAAA,MACA,wBAAAiD;AAAA,MAGA,wBAAAC;AAAA,MACA,uBAAAC;AAAA;AAAA,MACA,iBAAAb;AAAA,MAGA,sBAAAI;AAAA,MACA,gBAAAF;AAAA,MACA,gBAAAD;AAAA,MACA,eAAAI;AAAA,MACA,mBAnEA,CAAAK,MAAA;AACA,QAAAhD,EAAA,QAAAoD,EAAAJ,CAAA,GACAF,EAAA9C,EAAA,KAAA;AAAA,MAAA;AAAA;AAAA,MAkEA,mBAxDA,OAAA4C,MAAA;;AACA,QAAAjB,EAAA,UAGAiB,EAAA,eAAA,GAEAL,EAAA,GAGA,MAAAc,EAAA,GAGArC,EAAA,UAEAe,EAAA,oBAAA,KAAA,CAAA,GACAd,EAAA7B,EAAA,OAAA,oBAAA,KAAA,CAAA,GAGA,MAAAiE,EAAA,KAIAC,IAAA7B,EAAA,UAAA,QAAA6B,EAAA,MAAA,YAAA,GAAA,YAAAtC,EAAA;AAAA,MAAA;AAAA,IAqCA;AAAA,EACA;AAEA,CAAA;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"date-picker.js","sources":["../src/components/date-picker/date-picker.types.ts","../src/components/date-picker/composables/use-date-picker-single-calendar-text.ts","../src/components/date-picker/date-picker.vue"],"sourcesContent":["export { CalendarFirstDayOfWeek as BentoDatePickerFirstDayOfWeek } from '@/internal';\nexport type {\n CalendarIsDateDisabled as BentoDatePickerIsDateDisabled,\n CalendarSingleDateValue as BentoDatePickerValue,\n} from '@/internal';\n\nexport enum BentoDatePickerEvent {\n INPUT = 'input',\n}\n","import { computed, ref } from 'vue';\nimport { de, enUS, fr } from 'date-fns/locale';\nimport { useI18n } from '@/utils/ts/i18n';\nimport { UseDateDisplayText } from './use-date-picker-single-calendar-text.types';\nimport { DateFormat } from '@/types';\nimport format from 'date-fns/format';\n\n/**\n * Composable that sets and formats the date to be displayed in the input box of a Single Date Picker\n * @param {Ref<Date>} option.datePickerValue Ref to the datePickerValue set in the DatePicker component\n * @param {Ref<boolean>} option.isDateIncorrect Indicates if the date is correct or not\n */\nexport const useDatePickerSingleCalendarText: UseDateDisplayText<Date> = ({ datePickerValue, isDateIncorrect }) => {\n const { locale, t } = useI18n();\n const locales = { de, enUS, fr };\n\n const textInputValue = ref(null);\n\n const dateDisplayValue = computed(() => {\n // Display incorrect date when there's an error with the input\n if (isDateIncorrect.value) {\n return textInputValue.value;\n }\n\n // Display \"Select a date\" when there's no date selected or input\n if (!datePickerValue.value) {\n return t('selectDate') as string;\n }\n\n // Display the date in format \"dd MMM, yyyy (25 Jun, 2023)\" if there's a valid date selected\n return format(datePickerValue.value as Date, DateFormat.FULL_DATE, {\n locale: locales[locale.value.substring(0, 2)] || enUS,\n });\n });\n\n /**\n * Formats the \"dateToFormat\" date value with the yyyy-MM-dd format and sets it as \"formatTextInputDisplayValue\" value\n * @param {DATE} dateToFormat - Date to be assigned and formatted\n */\n const formatTextInputDisplayValue = (dateToFormat: Date = datePickerValue.value) => {\n // If date is incorrect, leave the textInputValue intact\n if (isDateIncorrect.value) {\n return;\n }\n\n textInputValue.value = dateToFormat\n ? format(dateToFormat, DateFormat.NUMERIC_DATE_YEAR_FIRST, {\n locale: locales[locale.value.substring(0, 2)] || enUS,\n })\n : null;\n };\n\n return {\n // Values\n dateDisplayValue,\n textInputValue,\n\n // Methods\n formatTextInputDisplayValue,\n };\n};\n","<!-- TODO: Remove aria props as these are part of JSX elements /vue/types/jsx.d.ts -->\n<!-- eslint-disable vue/attribute-hyphenation -->\n<template>\n <div\n v-bento-click-outside-directive=\"closeDatePicker\"\n class=\"b-date-picker\"\n @keydown.space.capture=\"onSpaceBarOrEnter\"\n @keydown.enter.capture=\"onSpaceBarOrEnter\"\n >\n <!-- Label -->\n <div v-if=\"label\" :id=\"labelId\" class=\"b-date-picker__label\">\n <bento-typography :el=\"BentoTypographyElement.SPAN\" stronger>{{ label }}</bento-typography>\n <bento-typography\n v-if=\"optional\"\n class=\"b-date-picker__label-requirement\"\n :el=\"BentoTypographyElement.SPAN\"\n >\n ({{ $t('optional') }})\n </bento-typography>\n <bento-typography\n v-if=\"required\"\n class=\"b-date-picker__label-requirement\"\n :el=\"BentoTypographyElement.SPAN\"\n >\n ({{ $t('required') }})\n </bento-typography>\n </div>\n\n <!-- Input -->\n <div>\n <dropdown-input-default\n ref=\"inputContainerRef\"\n :ariaControls=\"datePickerContainerId\"\n :ariaExpanded=\"isDatePickerOpen\"\n :aria-labelledby=\"label ? labelId : null\"\n :aria-describedby=\"ariaDescribedBy\"\n :disabled=\"disabled\"\n dynamic-filtering\n :is-invalid=\"!!errorMessage || !!dateErrorText\"\n :open=\"isDatePickerOpen\"\n :value=\"textInputValue\"\n :display-value=\"dateDisplayValue\"\n :debounce-time=\"0\"\n :readonly=\"isReadOnly\"\n @input=\"onDateInputChange\"\n @open=\"openDatePicker\"\n @keydown=\"onDateKeyDown\"\n @clear=\"clearDatePickerValue\"\n @close=\"closeDatePicker\"\n />\n </div>\n\n <!-- Error Messages -->\n <error-message\n v-if=\"dateErrorText\"\n :id=\"dateErrorId\"\n :error-message=\"dateErrorText\"\n class=\"b-date-picker__error-message\"\n />\n <error-message\n v-if=\"errorMessage\"\n :id=\"errorId\"\n :error-message=\"errorMessage\"\n class=\"b-date-picker__error-message\"\n />\n\n <!-- Description -->\n <bento-typography\n v-if=\"description\"\n class=\"b-date-picker__description\"\n :class=\"descriptionConditionalClasses\"\n :el=\"BentoTypographyElement.SPAN\"\n >\n {{ description }}\n </bento-typography>\n\n <!-- Calendar container -->\n <bento-popover\n v-if=\"inputContainerRef\"\n :id=\"datePickerContainerId\"\n class=\"b-date-picker__container\"\n role=\"dialog\"\n :open=\"isDatePickerOpen\"\n :target-element=\"inputContainerRef\"\n :disable-focus-trap=\"true\"\n :aria-label=\"popoverAriaLabel\"\n :aria-modal=\"true\"\n :position=\"BentoPopoverPositions.BOTTOM_START\"\n fit-content\n >\n <calendar\n ref=\"calendarContainerRef\"\n :first-day-of-week=\"firstDayOfWeek\"\n :is-date-disabled=\"isDateDisabled\"\n :number-of-months=\"1\"\n :value=\"value\"\n @input=\"onDateSelected\"\n />\n </bento-popover>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent, nextTick, PropType, Ref, ref, toRef, watch } from 'vue';\n import { BentoClickOutsideDirective } from '@/directives';\n import { BentoDatePickerEvent, BentoDatePickerValue } from './date-picker.types';\n import { Calendar, ErrorMessage } from '@/internal';\n import { DropdownInputDefault } from '@/components/dropdown/components';\n import { BentoPopover, BentoPopoverPositions } from '@/components/popover';\n import { generateUid } from '@/utils/ts/unique-id';\n import { BentoTypography, BentoTypographyElement, BentoTypographyVariant } from '../typography';\n import { useDatePickerSingleCalendarText } from './composables/use-date-picker-single-calendar-text';\n import { formatDateInputValue, validateDateInput } from '@/utils/ts/date-input';\n import { useI18n } from '@/utils/ts/i18n';\n import { debounce } from '@/utils/ts/debounce';\n import { useFormLayoutFieldLoading } from '@/composables';\n\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n const DEBOUNCE_TIME = 1000;\n\n /**\n * Date picker selector.\n *\n * @example\n * import { BentoDatePicker } from '@adyen/bento-vue2';\n *\n * export default {\n * components: { BentoDatePicker },\n * template: `\n * <bento-date-picker\n * label=\"Label\"\n * description=\"Supporting text\"\n * required\n * optional\n * disabled\n * @input=\"onDateChanged\"\n * v-model=\"selectedDate\"\n * />\n * `,\n * setup() {\n * const selectedDate = ref(new Date()); // reactive({ startDate: new Date(), endDate: new Date() })\n * return {\n * selectedDate,\n * }\n * }\n * }\n */\n export default defineComponent({\n i18n: { messages },\n name: 'bento-date-picker',\n components: {\n BentoTypography,\n BentoPopover,\n Calendar,\n ErrorMessage,\n DropdownInputDefault,\n },\n directives: { BentoClickOutsideDirective },\n props: {\n /**\n * Descriptive supporting text visbile underneath the dropdown.\n */\n description: { type: String, default: undefined },\n\n /**\n * Disables dropdown functionality.\n */\n disabled: { type: Boolean, default: false },\n\n /**\n * Displays component in an error state with an error message\n */\n errorMessage: { type: String, default: null },\n\n /**\n * Allows you to set the first day of the week. 0 is sunday, 1 is monday, 6 is saturday\n */\n firstDayOfWeek: Calendar.props.firstDayOfWeek,\n\n /**\n * Indicate if a date should be disabled or not\n */\n isDateDisabled: Calendar.props.isDateDisabled,\n\n /**\n * Text that is displayed as a label above the element.\n */\n label: { type: String, default: undefined },\n\n /**\n * Highlights the dropdown is optional.\n */\n optional: { type: Boolean, default: false },\n\n /**\n * The Boolean readonly property, when present, makes the element not mutable, meaning the user can not edit the date picker.\n */\n readonly: { type: Boolean, default: false },\n\n /**\n * Highlights the dropdown is required.\n */\n required: { type: Boolean, default: false },\n\n /**\n * Selected date\n */\n value: { type: [Date, Object] as PropType<BentoDatePickerValue>, default: null },\n },\n emits: [BentoDatePickerEvent.INPUT],\n setup(props, { emit }) {\n const { t } = useI18n<{ message: MessageSchema }>({ messages });\n const datePickerContainerId = generateUid('bento-date-picker-container');\n const labelId = generateUid('bento-date-picker-label');\n const descriptionId = generateUid('bento-date-picker-description');\n const errorId = generateUid('bento-date-picker-error');\n const dateErrorId = generateUid('bento-date-picker-date-error');\n const popoverAriaLabel = computed(() => props.label || t('datePicker', { name: datePickerContainerId }));\n\n // Refs\n const calendarContainerRef = ref(null);\n const inputContainerRef = ref(null);\n\n // Values\n const isDateIncorrect = ref(false);\n const isDatePickerOpen = ref(false);\n const { isReadOnly } = useFormLayoutFieldLoading(toRef(props, 'readonly'));\n\n watch(\n () => props.disabled,\n disabled => {\n // Close date picker popover if it's opened when it's disabled\n if (disabled && isDatePickerOpen.value) {\n isDatePickerOpen.value = false;\n }\n }\n );\n\n const { dateDisplayValue, textInputValue, formatTextInputDisplayValue } = useDatePickerSingleCalendarText({\n datePickerValue: toRef(props, 'value') as Ref<Date>,\n isDateIncorrect,\n });\n\n const dateErrorText = computed(() => {\n if (props.isDateDisabled && props.isDateDisabled(new Date(textInputValue.value))) {\n return t('selectedDateIsNotAvailable');\n }\n\n return isDateIncorrect.value ? t('provideDateInAFormat') : null;\n });\n\n const descriptionConditionalClasses = computed(() => ({\n 'b-date-picker__description--error': props.errorMessage || dateErrorText.value,\n }));\n\n const ariaDescribedBy = computed(\n () =>\n `${props.description ? descriptionId : ''} ${props.errorMessage ? errorId : ''} ${\n dateErrorText.value ? dateErrorId : ''\n }`.trim() || null\n );\n\n const isDateEnabled = (date: Date) => {\n // Check if function is set, otherwise all dates are enabled\n if (props.isDateDisabled) {\n return !props.isDateDisabled(date);\n }\n\n return true;\n };\n\n const closeDatePicker = () => {\n isDatePickerOpen.value = false;\n };\n\n const openDatePicker = () => {\n isDatePickerOpen.value = true;\n\n formatTextInputDisplayValue();\n };\n\n const onDateSelected = (selectedDate: Date) => {\n // Reset the error state when a valid date is selected\n isDateIncorrect.value = false;\n\n closeDatePicker();\n emit(BentoDatePickerEvent.INPUT, selectedDate);\n };\n\n const clearDatePickerValue = async () => {\n if (isDateIncorrect.value) {\n isDateIncorrect.value = false;\n textInputValue.value = null;\n }\n emit(BentoDatePickerEvent.INPUT, null);\n };\n\n const onDateKeyDown = (event: KeyboardEvent) => {\n validateDateInput(event);\n };\n\n const validateDate = debounce((stringDate: string) => {\n // Validate only if the date is complete\n if (stringDate.length < 10) {\n return;\n }\n\n // Checks for YYYY-MM-DD format\n const dateRegex = /^\\d{4}-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])$/;\n const isValidDate = dateRegex.test(stringDate) && isDateEnabled(new Date(stringDate));\n if (isValidDate) {\n isDateIncorrect.value = false;\n emit(BentoDatePickerEvent.INPUT, new Date(stringDate));\n } else if (stringDate) {\n // Only set to true if the value exists (not null/undefined)\n isDateIncorrect.value = true;\n emit(BentoDatePickerEvent.INPUT, null);\n }\n }, DEBOUNCE_TIME);\n\n const onDateInputChange = (stringDate: string) => {\n textInputValue.value = formatDateInputValue(stringDate);\n validateDate(textInputValue.value);\n };\n\n /**\n * Space bar and Enter keyDown event handler.\n *\n * * Opens the date picker dialog on the first keydown.\n * * Move focus to selected date, i.e., the date displayed in the date input text field. If no date has been selected, places focus on the current date.\n * @param {KeyboardEvent} event Event being triggered\n */\n const onSpaceBarOrEnter = async (event: KeyboardEvent) => {\n if (isDatePickerOpen.value) {\n return;\n }\n event.preventDefault();\n\n openDatePicker();\n\n // Wait for the date picker dialog to open\n await nextTick();\n\n // Set current date (today) if no date is selected\n if (!props.value) {\n // Format the opened date picker date to YYYY-MM-DD\n formatTextInputDisplayValue(new Date());\n emit(BentoDatePickerEvent.INPUT, new Date());\n\n // Wait for new value to be set with the emit\n await nextTick();\n }\n\n // Focus on date\n calendarContainerRef.value?.$refs.calendarRef[0].focusOnDate(props.value);\n };\n\n return {\n // Refs\n inputContainerRef,\n calendarContainerRef,\n\n // Values,\n dateDisplayValue,\n datePickerContainerId,\n descriptionConditionalClasses,\n isDateIncorrect,\n isDatePickerOpen,\n isReadOnly,\n dateErrorText,\n labelId,\n descriptionId,\n errorId,\n dateErrorId,\n popoverAriaLabel,\n ariaDescribedBy,\n textInputValue,\n\n // Enums\n BentoTypographyElement,\n BentoTypographyVariant,\n BentoPopoverPositions,\n\n // Events\n closeDatePicker,\n clearDatePickerValue,\n onDateSelected,\n openDatePicker,\n onDateKeyDown,\n onDateInputChange,\n\n // Keyboard navigation\n onSpaceBarOrEnter,\n };\n },\n });\n</script>\n\n<style lang=\"scss\" scoped src=\"./date-picker.scss\" />\n"],"names":["BentoDatePickerEvent","BentoDatePickerEvent2","useDatePickerSingleCalendarText","datePickerValue","isDateIncorrect","locale","t","useI18n","locales","de","enUS","fr","textInputValue","ref","computed","format","DateFormat","dateToFormat","DEBOUNCE_TIME","_sfc_main","defineComponent","messages","BentoTypography","BentoPopover","Calendar","ErrorMessage","DropdownInputDefault","BentoClickOutsideDirective","props","emit","datePickerContainerId","generateUid","labelId","descriptionId","errorId","dateErrorId","popoverAriaLabel","calendarContainerRef","inputContainerRef","isDatePickerOpen","isReadOnly","useFormLayoutFieldLoading","toRef","watch","disabled","dateDisplayValue","formatTextInputDisplayValue","dateErrorText","descriptionConditionalClasses","ariaDescribedBy","isDateEnabled","date","closeDatePicker","openDatePicker","onDateSelected","selectedDate","clearDatePickerValue","onDateKeyDown","event","validateDateInput","validateDate","debounce","stringDate","BentoTypographyElement","BentoTypographyVariant","BentoPopoverPositions","formatDateInputValue","nextTick","_a"],"mappings":";;;;;;;;;;;;;;;;;AAMY,IAAAA,IAAA,kBAAAC,OACRA,EAAA,QAAA,SADQA,IAAAD,KAAA,CAAA,CAAA;ACML,MAAAE,KAAA,CAAA,EAAA,iBAAAC,GAAA,iBAAAC,EAAA,MAAA;AACH,QAAA,EAAA,QAAAC,GAAA,GAAAC,EAAA,IAAAC,EAAA,GACAC,IAAA,EAAA,IAAAC,GAAA,MAAAC,GAAA,IAAAC,EAAA,GAEAC,IAAAC,EAAA,IAAA;AAoCA,SAAA;AAAA;AAAA,IAAO,kBAlCPC,EAAA,MAEIV,EAAA,QACIQ,EAAA,QAIJT,EAAA,QAKAY,EAAAZ,EAAA,OAAAa,EAAA,WAAA;AAAA,MAAmE,QAAAR,EAAAH,EAAA,MAAA,UAAA,GAAA,CAAA,CAAA,KAAAK;AAAA,IACd,CAAA,IALjDJ,EAAA,YAAA,CAMH;AAAA,IAsBD,gBAAAM;AAAA;AAAA,IACA,6BAhBJ,CAAAK,IAAAd,EAAA,UA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AAA,GACAF,EAAAhD,EAAA,KAAA;AAAA,MAAA;AAAA;AAAA,MAmEA,mBAzDA,OAAA8C,MAAA;;AACA,QAAAnB,EAAA,UAGAmB,EAAA,eAAA,GAEAL,EAAA,GAGA,MAAAc,EAAA,GAGAvC,EAAA,UAEAkB,EAAA,oBAAA,KAAA,CAAA,GACAjB,EAAA7B,EAAA,OAAA,oBAAA,KAAA,CAAA,GAGA,MAAAmE,EAAA,KAIAC,IAAA/B,EAAA,UAAA,QAAA+B,EAAA,MAAA,YAAA,GAAA,YAAAxC,EAAA;AAAA,MAAA;AAAA,IAsCA;AAAA,EACA;AAEA,CAAA;;;;;;;;;;;;;;;;;;;"}
@@ -1,5 +1,5 @@
1
- import { B as t, a as r } from "./chunks/index.f0d99471.js";
2
- import { b as o } from "./chunks/calendar.8f50a65a.js";
1
+ import { B as t, a as r } from "./chunks/index.10aaf539.js";
2
+ import { b as o } from "./chunks/calendar.0ae43a96.js";
3
3
  export {
4
4
  t as BentoDateRangePicker,
5
5
  r as BentoDateRangePickerEvent,
package/dist/date.js CHANGED
@@ -1,4 +1,4 @@
1
- import { B as e, a as o } from "./chunks/index.d07f9800.js";
1
+ import { B as e, a as o } from "./chunks/index.73d50fa6.js";
2
2
  export {
3
3
  e as BentoDate,
4
4
  o as BentoDateFormat
package/dist/divider.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { defineComponent as i, computed as n } from "vue";
2
2
  import { n as s } from "./chunks/_plugin-vue2_normalizer.71e2aa87.js";
3
- import "./assets/index26.css";
3
+ import "./assets/index10.css";
4
4
  const _ = i({
5
5
  name: "bento-divider",
6
6
  setup(a, { attrs: e }) {