@adyen/bento-vue3 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 (223) hide show
  1. package/dist/@types/components.d.ts +12 -0
  2. package/dist/@types/packages/vue2/src/components/button/components/loading-button/loading-button.vue.d.ts +3 -3
  3. package/dist/@types/packages/vue2/src/components/checkbox/components/checkbox-group/checkbox-group.vue.d.ts +76 -30
  4. package/dist/@types/packages/vue2/src/components/country/composables/index.d.ts +0 -1
  5. package/dist/@types/packages/vue2/src/components/country/country.vue.d.ts +1 -2
  6. package/dist/@types/packages/vue2/src/components/date-picker/date-picker.vue.d.ts +11 -1
  7. package/dist/@types/packages/vue2/src/components/date-range-picker/date-range-picker.vue.d.ts +11 -1
  8. package/dist/@types/packages/vue2/src/components/dropdown/dropdown.vue.d.ts +2 -1
  9. package/dist/@types/packages/vue2/src/components/filter-bar/components/date-range-filter/date-range-filter.vue.d.ts +0 -2
  10. package/dist/@types/packages/vue2/src/components/form-layout/components/form-layout-field-tip/form-layout-field-tip.vue.d.ts +10 -0
  11. package/dist/@types/packages/vue2/src/components/form-layout/components/form-layout-field-tip/index.d.ts +1 -0
  12. package/dist/@types/packages/vue2/src/components/form-layout/components/form-layout-group/composable/use-form-layout-group-percentage.d.ts +3 -0
  13. package/dist/@types/packages/vue2/src/components/form-layout/components/form-layout-group/form-layout-group.types.d.ts +1 -0
  14. package/dist/@types/packages/vue2/src/components/form-layout/components/form-layout-group/form-layout-group.vue.d.ts +23 -0
  15. package/dist/@types/packages/vue2/src/components/form-layout/components/form-layout-group/index.d.ts +1 -0
  16. package/dist/@types/packages/vue2/src/components/form-layout/components/form-layout-title/form-layout-title.vue.d.ts +33 -0
  17. package/dist/@types/packages/vue2/src/components/form-layout/components/form-layout-title/index.d.ts +1 -0
  18. package/dist/@types/packages/vue2/src/components/form-layout/components/index.d.ts +3 -0
  19. package/dist/@types/packages/vue2/src/components/form-layout/form-layout.types.d.ts +1 -0
  20. package/dist/@types/packages/vue2/src/components/form-layout/form-layout.vue.d.ts +33 -0
  21. package/dist/@types/packages/vue2/src/components/form-layout/index.d.ts +2 -0
  22. package/dist/@types/packages/vue2/src/components/input-field/input-field.vue.d.ts +2 -1
  23. package/dist/@types/packages/vue2/src/components/internal/controls-group/controls-group.vue.d.ts +53 -22
  24. package/dist/@types/packages/vue2/src/components/modal/components/base-modal/__mocks__/base-modal.vue.d.ts +3 -3
  25. package/dist/@types/packages/vue2/src/components/modal/components/base-modal/base-modal.vue.d.ts +51 -44
  26. package/dist/@types/packages/vue2/src/components/modal/components/modal-default/modal-default.vue.d.ts +3 -3
  27. package/dist/@types/packages/vue2/src/components/modal/modal.vue.d.ts +4 -12
  28. package/dist/@types/packages/vue2/src/components/radio-group/radio-group.vue.d.ts +50 -4
  29. package/dist/@types/packages/vue2/src/components/search-bar/search-bar.vue.d.ts +5 -3
  30. package/dist/@types/packages/vue2/src/components/sidepanel/components/sidepanel-page.vue.d.ts +68 -0
  31. package/dist/@types/packages/vue2/src/components/sidepanel/index.d.ts +3 -0
  32. package/dist/@types/packages/vue2/src/components/sidepanel/sidepanel.keys.d.ts +2 -0
  33. package/dist/@types/packages/vue2/src/components/sidepanel/sidepanel.types.d.ts +21 -0
  34. package/dist/@types/packages/vue2/src/components/sidepanel/sidepanel.vue.d.ts +46 -0
  35. package/dist/@types/packages/vue2/src/components/tabs/tabs.types.d.ts +1 -1
  36. package/dist/@types/packages/vue2/src/components/textarea/textarea.vue.d.ts +2 -1
  37. package/dist/@types/packages/vue2/src/components/timeline/timeline.types.d.ts +1 -1
  38. package/dist/@types/packages/vue2/src/composables/index.d.ts +1 -0
  39. package/dist/@types/packages/vue2/src/composables/use-form-layout-loading/use-form-layout-loading.d.ts +4 -0
  40. package/dist/@types/packages/vue2/src/index.d.ts +2 -0
  41. package/dist/@types/packages/vue2/src/utils/ts/dev-environment.d.ts +1 -0
  42. package/dist/accordion.js +1 -1
  43. package/dist/alert.js +3 -3
  44. package/dist/assets/arrow-left.css +1 -0
  45. package/dist/assets/base-button.css +1 -1
  46. package/dist/assets/button.css +1 -1
  47. package/dist/assets/calendar.css +1 -1
  48. package/dist/assets/checkbox.css +1 -1
  49. package/dist/assets/controls-group.css +1 -1
  50. package/dist/assets/copy.css +1 -1
  51. package/dist/assets/dropdown-default-textbox.css +1 -1
  52. package/dist/assets/dropdown.css +1 -1
  53. package/dist/assets/error-message.css +1 -1
  54. package/dist/assets/footer-actions.css +1 -0
  55. package/dist/assets/grid-layout.css +1 -1
  56. package/dist/assets/index.css +1 -1
  57. package/dist/assets/index10.css +1 -1
  58. package/dist/assets/index11.css +1 -1
  59. package/dist/assets/index12.css +1 -1
  60. package/dist/assets/index13.css +1 -1
  61. package/dist/assets/index14.css +1 -1
  62. package/dist/assets/index15.css +1 -1
  63. package/dist/assets/index16.css +1 -1
  64. package/dist/assets/index17.css +1 -1
  65. package/dist/assets/index18.css +1 -1
  66. package/dist/assets/index19.css +1 -1
  67. package/dist/assets/index2.css +1 -1
  68. package/dist/assets/index20.css +1 -1
  69. package/dist/assets/index21.css +1 -1
  70. package/dist/assets/index22.css +1 -1
  71. package/dist/assets/index23.css +1 -1
  72. package/dist/assets/index24.css +1 -1
  73. package/dist/assets/index25.css +1 -1
  74. package/dist/assets/index26.css +1 -1
  75. package/dist/assets/index27.css +1 -1
  76. package/dist/assets/index28.css +1 -1
  77. package/dist/assets/index29.css +1 -1
  78. package/dist/assets/index3.css +1 -1
  79. package/dist/assets/index30.css +1 -1
  80. package/dist/assets/index31.css +1 -1
  81. package/dist/assets/index32.css +1 -1
  82. package/dist/assets/index33.css +1 -1
  83. package/dist/assets/index34.css +1 -1
  84. package/dist/assets/index35.css +1 -1
  85. package/dist/assets/index36.css +1 -1
  86. package/dist/assets/index37.css +1 -1
  87. package/dist/assets/index38.css +1 -1
  88. package/dist/assets/index39.css +1 -1
  89. package/dist/assets/index4.css +1 -1
  90. package/dist/assets/index40.css +1 -1
  91. package/dist/assets/index41.css +1 -0
  92. package/dist/assets/index42.css +1 -0
  93. package/dist/assets/index5.css +1 -1
  94. package/dist/assets/index6.css +1 -1
  95. package/dist/assets/index7.css +1 -1
  96. package/dist/assets/index8.css +1 -1
  97. package/dist/assets/index9.css +1 -1
  98. package/dist/assets/listbox-option-tag.css +1 -1
  99. package/dist/assets/listbox.css +1 -1
  100. package/dist/assets/loading-button.css +1 -1
  101. package/dist/assets/tooltip.css +1 -1
  102. package/dist/avatar-image.js +1 -1
  103. package/dist/badge.js +1 -1
  104. package/dist/button.js +3 -3
  105. package/dist/card.js +3 -3
  106. package/dist/checkbox.js +111 -97
  107. package/dist/checkbox.js.map +1 -1
  108. package/dist/chunks/arrow-left.cdbcc128.js +30 -0
  109. package/dist/chunks/arrow-left.cdbcc128.js.map +1 -0
  110. package/dist/chunks/{base-button.4a56c2fb.js → base-button.20be08da.js} +2 -2
  111. package/dist/chunks/{base-button.4a56c2fb.js.map → base-button.20be08da.js.map} +1 -1
  112. package/dist/chunks/{button-actions.a6e541ad.js → button-actions.54e28e75.js} +2 -2
  113. package/dist/chunks/{button-actions.a6e541ad.js.map → button-actions.54e28e75.js.map} +1 -1
  114. package/dist/chunks/{button.1f630b6e.js → button.e1c39f66.js} +2 -2
  115. package/dist/chunks/{button.1f630b6e.js.map → button.e1c39f66.js.map} +1 -1
  116. package/dist/chunks/{calendar.08885a56.js → calendar.09b683b3.js} +6 -6
  117. package/dist/chunks/calendar.09b683b3.js.map +1 -0
  118. package/dist/chunks/{checkbox.cfb8b8df.js → checkbox.a404069b.js} +3 -3
  119. package/dist/chunks/{checkbox.cfb8b8df.js.map → checkbox.a404069b.js.map} +1 -1
  120. package/dist/chunks/controls-group.60fb2a86.js +136 -0
  121. package/dist/chunks/controls-group.60fb2a86.js.map +1 -0
  122. package/dist/chunks/{copy.1ce0203e.js → copy.2cf5e6c3.js} +3 -3
  123. package/dist/chunks/{copy.1ce0203e.js.map → copy.2cf5e6c3.js.map} +1 -1
  124. package/dist/chunks/{dropdown-default-textbox.dd77bb42.js → dropdown-default-textbox.203e747f.js} +54 -51
  125. package/dist/chunks/dropdown-default-textbox.203e747f.js.map +1 -0
  126. package/dist/chunks/{dropdown.f9997464.js → dropdown.8b415aac.js} +188 -185
  127. package/dist/chunks/dropdown.8b415aac.js.map +1 -0
  128. package/dist/chunks/{error-message.b88bb75a.js → error-message.ddfe8ea5.js} +2 -2
  129. package/dist/chunks/{error-message.b88bb75a.js.map → error-message.ddfe8ea5.js.map} +1 -1
  130. package/dist/chunks/footer-actions.0f640f87.js +106 -0
  131. package/dist/chunks/footer-actions.0f640f87.js.map +1 -0
  132. package/dist/chunks/form-layout.types.a7a1438d.js +5 -0
  133. package/dist/chunks/form-layout.types.a7a1438d.js.map +1 -0
  134. package/dist/chunks/{index.361c61d3.js → index.13949709.js} +2 -2
  135. package/dist/chunks/{index.361c61d3.js.map → index.13949709.js.map} +1 -1
  136. package/dist/chunks/index.222d29b0.js +120 -0
  137. package/dist/chunks/index.222d29b0.js.map +1 -0
  138. package/dist/chunks/{index.64b7b3cc.js → index.3da90517.js} +6 -6
  139. package/dist/chunks/{index.64b7b3cc.js.map → index.3da90517.js.map} +1 -1
  140. package/dist/chunks/{index.96001b1d.js → index.aa34e363.js} +3 -3
  141. package/dist/chunks/{index.96001b1d.js.map → index.aa34e363.js.map} +1 -1
  142. package/dist/chunks/{index.b46a5047.js → index.c9225c3b.js} +260 -253
  143. package/dist/chunks/{index.b46a5047.js.map → index.c9225c3b.js.map} +1 -1
  144. package/dist/chunks/{index.7dd953ea.js → index.d27367cd.js} +2 -2
  145. package/dist/chunks/{index.7dd953ea.js.map → index.d27367cd.js.map} +1 -1
  146. package/dist/chunks/{listbox-option-tag.73661a5d.js → listbox-option-tag.5ae8b79b.js} +3 -3
  147. package/dist/chunks/{listbox-option-tag.73661a5d.js.map → listbox-option-tag.5ae8b79b.js.map} +1 -1
  148. package/dist/chunks/{listbox.7b5e0eee.js → listbox.0c7c4e5e.js} +339 -339
  149. package/dist/chunks/listbox.0c7c4e5e.js.map +1 -0
  150. package/dist/chunks/loading-button.61d8ebe5.js +109 -0
  151. package/dist/chunks/loading-button.61d8ebe5.js.map +1 -0
  152. package/dist/chunks/{tooltip.53290a34.js → tooltip.835d9b52.js} +2 -2
  153. package/dist/chunks/tooltip.835d9b52.js.map +1 -0
  154. package/dist/chunks/use-form-layout-loading.d03e5d48.js +12 -0
  155. package/dist/chunks/use-form-layout-loading.d03e5d48.js.map +1 -0
  156. package/dist/code-snippet.js +6 -6
  157. package/dist/code-snippet.js.map +1 -1
  158. package/dist/country.js +559 -595
  159. package/dist/country.js.map +1 -1
  160. package/dist/currency.js +1 -1
  161. package/dist/data-grid.js +682 -702
  162. package/dist/data-grid.js.map +1 -1
  163. package/dist/date-picker.js +82 -75
  164. package/dist/date-picker.js.map +1 -1
  165. package/dist/date-range-picker.js +2 -2
  166. package/dist/date.js +1 -1
  167. package/dist/divider.js +1 -1
  168. package/dist/dropdown.js +67 -62
  169. package/dist/dropdown.js.map +1 -1
  170. package/dist/filter-bar.js +446 -442
  171. package/dist/filter-bar.js.map +1 -1
  172. package/dist/focus-trap.js +1 -1
  173. package/dist/form-layout.js +188 -0
  174. package/dist/form-layout.js.map +1 -0
  175. package/dist/header.js +3 -3
  176. package/dist/index.js +191 -187
  177. package/dist/index.js.map +1 -1
  178. package/dist/info-icon.js +2 -2
  179. package/dist/input-field.js +123 -121
  180. package/dist/input-field.js.map +1 -1
  181. package/dist/internal.js +6 -6
  182. package/dist/link.js +2 -2
  183. package/dist/loading-indicator.js +1 -1
  184. package/dist/menu.js +4 -4
  185. package/dist/modal.js +266 -397
  186. package/dist/modal.js.map +1 -1
  187. package/dist/pagination.js +4 -4
  188. package/dist/payment-method.js +2 -2
  189. package/dist/popover.js +4 -4
  190. package/dist/popper-container.js +2 -2
  191. package/dist/radio-group.js +127 -124
  192. package/dist/radio-group.js.map +1 -1
  193. package/dist/search-bar.js +2 -2
  194. package/dist/segmented-control.js +4 -4
  195. package/dist/sidepanel.js +279 -0
  196. package/dist/sidepanel.js.map +1 -0
  197. package/dist/status.js +2 -2
  198. package/dist/structured-list.js +1 -1
  199. package/dist/summary-grid.js +3 -3
  200. package/dist/tabs.js +7 -7
  201. package/dist/tabs.js.map +1 -1
  202. package/dist/tag.js +3 -3
  203. package/dist/textarea.js +97 -95
  204. package/dist/textarea.js.map +1 -1
  205. package/dist/timeline.js +8 -8
  206. package/dist/timeline.js.map +1 -1
  207. package/dist/toast.js +3 -3
  208. package/dist/toggle.js +2 -2
  209. package/dist/typography.js +1 -1
  210. package/dist/web-types.json +1 -1
  211. package/package.json +14 -7
  212. package/dist/@types/packages/vue2/src/components/country/composables/useCountryFlag.d.ts +0 -2
  213. package/dist/chunks/calendar.08885a56.js.map +0 -1
  214. package/dist/chunks/controls-group.806da9bd.js +0 -75
  215. package/dist/chunks/controls-group.806da9bd.js.map +0 -1
  216. package/dist/chunks/dropdown-default-textbox.dd77bb42.js.map +0 -1
  217. package/dist/chunks/dropdown.f9997464.js.map +0 -1
  218. package/dist/chunks/index.ebf5f6cf.js +0 -119
  219. package/dist/chunks/index.ebf5f6cf.js.map +0 -1
  220. package/dist/chunks/listbox.7b5e0eee.js.map +0 -1
  221. package/dist/chunks/loading-button.426d89b9.js +0 -113
  222. package/dist/chunks/loading-button.426d89b9.js.map +0 -1
  223. package/dist/chunks/tooltip.53290a34.js.map +0 -1
@@ -1,36 +1,37 @@
1
- import { ref as g, computed as I, defineComponent as J, watch as Q, toRef as X, nextTick as R, resolveComponent as v, resolveDirective as Z, withDirectives as x, openBlock as l, createElementBlock as A, withKeys as U, createVNode as O, withCtx as y, createTextVNode as C, toDisplayString as B, createBlock as c, createCommentVNode as u, createElementVNode as ee, normalizeClass as ae } from "vue";
2
- import { B as te } from "./chunks/directive.0408e565.js";
3
- import { c as re } from "./chunks/dropdown-default-textbox.dd77bb42.js";
4
- import { BentoPopover as ne, BentoPopoverPositions as oe } from "./popover.js";
1
+ import { ref as g, computed as I, defineComponent as X, toRef as _, watch as Z, nextTick as A, resolveComponent as v, resolveDirective as x, withDirectives as ee, openBlock as l, createElementBlock as U, withKeys as M, createVNode as S, withCtx as y, createTextVNode as C, toDisplayString as B, createBlock as c, createCommentVNode as u, createElementVNode as ae, normalizeClass as te } from "vue";
2
+ import { B as re } from "./chunks/directive.0408e565.js";
3
+ import { BentoPopover as oe, BentoPopoverPositions as ne } from "./popover.js";
5
4
  import { g as k } from "./chunks/unique-id.a2a2b458.js";
6
- import { B as le, a as ie, b as se } from "./chunks/index.ebf5f6cf.js";
5
+ import { B as le, a as ie, b as se } from "./chunks/index.222d29b0.js";
7
6
  import { u as K } from "./chunks/i18n.6c402773.js";
8
- import { D as M, v as de, f as ue } from "./chunks/date-input.9186a0bf.js";
9
- import { f as $ } from "./chunks/index.7dd953ea.js";
7
+ import { D as $, v as de, f as ue } from "./chunks/date-input.9186a0bf.js";
8
+ import { f as q } from "./chunks/index.d27367cd.js";
10
9
  import { e as w, d as pe, f as ce } from "./chunks/index.f55fdc32.js";
11
10
  import { d as fe } from "./chunks/debounce.f8d92e44.js";
12
- import { C as N } from "./chunks/calendar.08885a56.js";
13
- import { b as Ye } from "./chunks/calendar.08885a56.js";
14
- import { E as De } from "./chunks/error-message.b88bb75a.js";
15
- import { _ as me } from "./chunks/_plugin-vue_export-helper.dad06003.js";
16
- import "./assets/index18.css";
11
+ import { u as De } from "./chunks/use-form-layout-loading.d03e5d48.js";
12
+ import { C as N } from "./chunks/calendar.09b683b3.js";
13
+ import { b as je } from "./chunks/calendar.09b683b3.js";
14
+ import { c as me } from "./chunks/dropdown-default-textbox.203e747f.js";
15
+ import { E as be } from "./chunks/error-message.ddfe8ea5.js";
16
+ import { _ as ve } from "./chunks/_plugin-vue_export-helper.dad06003.js";
17
+ import "./assets/index27.css";
17
18
  var p = /* @__PURE__ */ ((e) => (e.INPUT = "input", e))(p || {});
18
- const be = ({ datePickerValue: e, isDateIncorrect: t }) => {
19
+ const ye = ({ datePickerValue: e, isDateIncorrect: t }) => {
19
20
  const { locale: i, t: f } = K(), D = { de: pe, enUS: w, fr: ce }, s = g(null);
20
21
  return {
21
22
  // Values
22
- dateDisplayValue: I(() => t.value ? s.value : e.value ? $(e.value, M.FULL_DATE, {
23
+ dateDisplayValue: I(() => t.value ? s.value : e.value ? q(e.value, $.FULL_DATE, {
23
24
  locale: D[i.value.substring(0, 2)] || w
24
25
  }) : f("selectDate")),
25
26
  textInputValue: s,
26
27
  // Methods
27
28
  formatTextInputDisplayValue: (d = e.value) => {
28
- t.value || (s.value = d ? $(d, M.NUMERIC_DATE_YEAR_FIRST, {
29
+ t.value || (s.value = d ? q(d, $.NUMERIC_DATE_YEAR_FIRST, {
29
30
  locale: D[i.value.substring(0, 2)] || w
30
31
  }) : null);
31
32
  }
32
33
  };
33
- }, q = {
34
+ }, F = {
34
35
  "en-US": {
35
36
  optional: "optional",
36
37
  required: "required",
@@ -40,17 +41,17 @@ const be = ({ datePickerValue: e, isDateIncorrect: t }) => {
40
41
  selectedDateIsNotAvailable: "Selected date is not available",
41
42
  datePicker: "Date picker"
42
43
  }
43
- }, ve = 1e3, ye = J({
44
- i18n: { messages: q },
44
+ }, ke = 1e3, ge = X({
45
+ i18n: { messages: F },
45
46
  name: "bento-date-picker",
46
47
  components: {
47
48
  BentoTypography: le,
48
- BentoPopover: ne,
49
+ BentoPopover: oe,
49
50
  Calendar: N,
50
- ErrorMessage: De,
51
- DropdownInputDefault: re
51
+ ErrorMessage: be,
52
+ DropdownInputDefault: me
52
53
  },
53
- directives: { BentoClickOutsideDirective: te },
54
+ directives: { BentoClickOutsideDirective: re },
54
55
  props: {
55
56
  /**
56
57
  * Descriptive supporting text visbile underneath the dropdown.
@@ -80,6 +81,10 @@ const be = ({ datePickerValue: e, isDateIncorrect: t }) => {
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
  */
@@ -91,90 +96,91 @@ const be = ({ datePickerValue: e, isDateIncorrect: t }) => {
91
96
  },
92
97
  emits: [p.INPUT],
93
98
  setup(e, { emit: t }) {
94
- const { t: i } = K({ messages: q }), f = k("bento-date-picker-container"), D = k("bento-date-picker-label"), s = k("bento-date-picker-description"), o = k("bento-date-picker-error"), m = k("bento-date-picker-date-error"), d = I(() => e.label || i("datePicker", { name: f })), P = g(null), E = g(null), r = g(!1), n = g(!1);
95
- Q(
99
+ const { t: i } = K({ messages: F }), f = k("bento-date-picker-container"), D = k("bento-date-picker-label"), s = k("bento-date-picker-description"), n = k("bento-date-picker-error"), m = k("bento-date-picker-date-error"), d = I(() => e.label || i("datePicker", { name: f })), P = g(null), E = g(null), r = g(!1), o = g(!1), { isReadOnly: L } = De(_(e, "readonly"));
100
+ Z(
96
101
  () => e.disabled,
97
102
  (a) => {
98
- a && n.value && (n.value = !1);
103
+ a && o.value && (o.value = !1);
99
104
  }
100
105
  );
101
- const { dateDisplayValue: F, textInputValue: b, formatTextInputDisplayValue: V } = be({
102
- datePickerValue: X(e, "value"),
106
+ const { dateDisplayValue: Y, textInputValue: b, formatTextInputDisplayValue: V } = ye({
107
+ datePickerValue: _(e, "value"),
103
108
  isDateIncorrect: r
104
- }), T = I(() => e.isDateDisabled && e.isDateDisabled(new Date(b.value)) ? i("selectedDateIsNotAvailable") : r.value ? i("provideDateInAFormat") : null), Y = I(() => ({
109
+ }), T = I(() => e.isDateDisabled && e.isDateDisabled(new Date(b.value)) ? i("selectedDateIsNotAvailable") : r.value ? i("provideDateInAFormat") : null), W = I(() => ({
105
110
  "b-date-picker__description--error": e.errorMessage || T.value
106
- })), L = I(
107
- () => `${e.description ? s : ""} ${e.errorMessage ? o : ""} ${T.value ? m : ""}`.trim() || null
108
- ), W = (a) => e.isDateDisabled ? !e.isDateDisabled(a) : !0, h = () => {
109
- n.value = !1;
110
- }, _ = () => {
111
- n.value = !0, V();
112
- }, j = (a) => {
113
- r.value = !1, h(), t(p.INPUT, a);
114
- }, z = async () => {
115
- r.value && (r.value = !1, b.value = null), t(p.INPUT, null);
111
+ })), j = I(
112
+ () => `${e.description ? s : ""} ${e.errorMessage ? n : ""} ${T.value ? m : ""}`.trim() || null
113
+ ), z = (a) => e.isDateDisabled ? !e.isDateDisabled(a) : !0, R = () => {
114
+ o.value = !1;
115
+ }, h = () => {
116
+ o.value = !0, V();
116
117
  }, G = (a) => {
118
+ r.value = !1, R(), t(p.INPUT, a);
119
+ }, H = async () => {
120
+ r.value && (r.value = !1, b.value = null), t(p.INPUT, null);
121
+ }, J = (a) => {
117
122
  de(a);
118
- }, H = fe((a) => {
123
+ }, Q = fe((a) => {
119
124
  if (a.length < 10)
120
125
  return;
121
- /^\d{4}-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])$/.test(a) && W(new Date(a)) ? (r.value = !1, t(p.INPUT, new Date(a))) : a && (r.value = !0, t(p.INPUT, null));
122
- }, ve);
126
+ /^\d{4}-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])$/.test(a) && z(new Date(a)) ? (r.value = !1, t(p.INPUT, new Date(a))) : a && (r.value = !0, t(p.INPUT, null));
127
+ }, ke);
123
128
  return {
124
129
  // Refs
125
130
  inputContainerRef: E,
126
131
  calendarContainerRef: P,
127
132
  // Values,
128
- dateDisplayValue: F,
133
+ dateDisplayValue: Y,
129
134
  datePickerContainerId: f,
130
- descriptionConditionalClasses: Y,
135
+ descriptionConditionalClasses: W,
131
136
  isDateIncorrect: r,
132
- isDatePickerOpen: n,
137
+ isDatePickerOpen: o,
138
+ isReadOnly: L,
133
139
  dateErrorText: T,
134
140
  labelId: D,
135
141
  descriptionId: s,
136
- errorId: o,
142
+ errorId: n,
137
143
  dateErrorId: m,
138
144
  popoverAriaLabel: d,
139
- ariaDescribedBy: L,
145
+ ariaDescribedBy: j,
140
146
  textInputValue: b,
141
147
  // Enums
142
148
  BentoTypographyElement: ie,
143
149
  BentoTypographyVariant: se,
144
- BentoPopoverPositions: oe,
150
+ BentoPopoverPositions: ne,
145
151
  // Events
146
- closeDatePicker: h,
147
- clearDatePickerValue: z,
148
- onDateSelected: j,
149
- openDatePicker: _,
150
- onDateKeyDown: G,
152
+ closeDatePicker: R,
153
+ clearDatePickerValue: H,
154
+ onDateSelected: G,
155
+ openDatePicker: h,
156
+ onDateKeyDown: J,
151
157
  onDateInputChange: (a) => {
152
- b.value = ue(a), H(b.value);
158
+ b.value = ue(a), Q(b.value);
153
159
  },
154
160
  // Keyboard navigation
155
161
  onSpaceBarOrEnter: async (a) => {
156
- var S;
157
- n.value || (a.preventDefault(), _(), await R(), e.value || (V(/* @__PURE__ */ new Date()), t(p.INPUT, /* @__PURE__ */ new Date()), await R()), (S = P.value) == null || S.$refs.calendarRef[0].focusOnDate(e.value));
162
+ var O;
163
+ o.value || (a.preventDefault(), h(), await A(), e.value || (V(/* @__PURE__ */ new Date()), t(p.INPUT, /* @__PURE__ */ new Date()), await A()), (O = P.value) == null || O.$refs.calendarRef[0].focusOnDate(e.value));
158
164
  }
159
165
  };
160
166
  }
161
167
  });
162
- const ke = ["id"];
163
- function ge(e, t, i, f, D, s) {
164
- const o = v("bento-typography"), m = v("dropdown-input-default"), d = v("error-message"), P = v("calendar"), E = v("bento-popover"), r = Z("bento-click-outside-directive");
165
- return x((l(), A("div", {
168
+ const Ie = ["id"];
169
+ function Pe(e, t, i, f, D, s) {
170
+ const n = v("bento-typography"), m = v("dropdown-input-default"), d = v("error-message"), P = v("calendar"), E = v("bento-popover"), r = x("bento-click-outside-directive");
171
+ return ee((l(), U("div", {
166
172
  class: "b-date-picker",
167
173
  onKeydownCapture: [
168
- t[0] || (t[0] = U((...n) => e.onSpaceBarOrEnter && e.onSpaceBarOrEnter(...n), ["space"])),
169
- t[1] || (t[1] = U((...n) => e.onSpaceBarOrEnter && e.onSpaceBarOrEnter(...n), ["enter"]))
174
+ t[0] || (t[0] = M((...o) => e.onSpaceBarOrEnter && e.onSpaceBarOrEnter(...o), ["space"])),
175
+ t[1] || (t[1] = M((...o) => e.onSpaceBarOrEnter && e.onSpaceBarOrEnter(...o), ["enter"]))
170
176
  ]
171
177
  }, [
172
- e.label ? (l(), A("div", {
178
+ e.label ? (l(), U("div", {
173
179
  key: 0,
174
180
  id: e.labelId,
175
181
  class: "b-date-picker__label"
176
182
  }, [
177
- O(o, {
183
+ S(n, {
178
184
  el: e.BentoTypographyElement.SPAN,
179
185
  stronger: ""
180
186
  }, {
@@ -183,7 +189,7 @@ function ge(e, t, i, f, D, s) {
183
189
  ]),
184
190
  _: 1
185
191
  }, 8, ["el"]),
186
- e.optional ? (l(), c(o, {
192
+ e.optional ? (l(), c(n, {
187
193
  key: 0,
188
194
  class: "b-date-picker__label-requirement",
189
195
  el: e.BentoTypographyElement.SPAN
@@ -193,7 +199,7 @@ function ge(e, t, i, f, D, s) {
193
199
  ]),
194
200
  _: 1
195
201
  }, 8, ["el"])) : u("", !0),
196
- e.required ? (l(), c(o, {
202
+ e.required ? (l(), c(n, {
197
203
  key: 1,
198
204
  class: "b-date-picker__label-requirement",
199
205
  el: e.BentoTypographyElement.SPAN
@@ -203,9 +209,9 @@ function ge(e, t, i, f, D, s) {
203
209
  ]),
204
210
  _: 1
205
211
  }, 8, ["el"])) : u("", !0)
206
- ], 8, ke)) : u("", !0),
207
- ee("div", null, [
208
- O(m, {
212
+ ], 8, Ie)) : u("", !0),
213
+ ae("div", null, [
214
+ S(m, {
209
215
  ref: "inputContainerRef",
210
216
  ariaControls: e.datePickerContainerId,
211
217
  ariaExpanded: e.isDatePickerOpen,
@@ -218,12 +224,13 @@ function ge(e, t, i, f, D, s) {
218
224
  value: e.textInputValue,
219
225
  "display-value": e.dateDisplayValue,
220
226
  "debounce-time": 0,
227
+ readonly: e.isReadOnly,
221
228
  onInput: e.onDateInputChange,
222
229
  onOpen: e.openDatePicker,
223
230
  onKeydown: e.onDateKeyDown,
224
231
  onClear: e.clearDatePickerValue,
225
232
  onClose: e.closeDatePicker
226
- }, null, 8, ["ariaControls", "ariaExpanded", "aria-labelledby", "aria-describedby", "disabled", "is-invalid", "open", "value", "display-value", "onInput", "onOpen", "onKeydown", "onClear", "onClose"])
233
+ }, null, 8, ["ariaControls", "ariaExpanded", "aria-labelledby", "aria-describedby", "disabled", "is-invalid", "open", "value", "display-value", "readonly", "onInput", "onOpen", "onKeydown", "onClear", "onClose"])
227
234
  ]),
228
235
  e.dateErrorText ? (l(), c(d, {
229
236
  key: 1,
@@ -237,9 +244,9 @@ function ge(e, t, i, f, D, s) {
237
244
  "error-message": e.errorMessage,
238
245
  class: "b-date-picker__error-message"
239
246
  }, null, 8, ["id", "error-message"])) : u("", !0),
240
- e.description ? (l(), c(o, {
247
+ e.description ? (l(), c(n, {
241
248
  key: 3,
242
- class: ae(["b-date-picker__description", e.descriptionConditionalClasses]),
249
+ class: te(["b-date-picker__description", e.descriptionConditionalClasses]),
243
250
  el: e.BentoTypographyElement.SPAN
244
251
  }, {
245
252
  default: y(() => [
@@ -261,7 +268,7 @@ function ge(e, t, i, f, D, s) {
261
268
  "fit-content": ""
262
269
  }, {
263
270
  default: y(() => [
264
- O(P, {
271
+ S(P, {
265
272
  ref: "calendarContainerRef",
266
273
  "first-day-of-week": e.firstDayOfWeek,
267
274
  "is-date-disabled": e.isDateDisabled,
@@ -276,10 +283,10 @@ function ge(e, t, i, f, D, s) {
276
283
  [r, e.closeDatePicker]
277
284
  ]);
278
285
  }
279
- const $e = /* @__PURE__ */ me(ye, [["render", ge], ["__scopeId", "data-v-6d23530a"]]);
286
+ const Ke = /* @__PURE__ */ ve(ge, [["render", Pe], ["__scopeId", "data-v-58b84747"]]);
280
287
  export {
281
- $e as BentoDatePicker,
288
+ Ke as BentoDatePicker,
282
289
  p as BentoDatePickerEvent,
283
- Ye as BentoDatePickerFirstDayOfWeek
290
+ je as BentoDatePickerFirstDayOfWeek
284
291
  };
285
292
  //# sourceMappingURL=date-picker.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"date-picker.js","sources":["../../vue2/src/components/date-picker/date-picker.types.ts","../../vue2/src/components/date-picker/composables/use-date-picker-single-calendar-text.ts","../../vue2/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","_ctx","createCommentVNode","openBlock","createBlock","_component_bento_typography","_hoisted_1","createElementVNode","createVNode","_component_dropdown_input_default","_component_error_message","normalizeClass","_component_bento_popover","withCtx","_component_calendar"],"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,IAAA,MAAAC,GAAA,IAAAC,GAAA,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,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AA;AAAA,UACmB,oBAAAA,EAAA;AAAA,UACP,oBAAA;AAAA,UACL,OAAAA,EAAA;AAAA;;;;;;;;;;"}
1
+ {"version":3,"file":"date-picker.js","sources":["../../vue2/src/components/date-picker/date-picker.types.ts","../../vue2/src/components/date-picker/composables/use-date-picker-single-calendar-text.ts","../../vue2/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","_ctx","createCommentVNode","openBlock","createBlock","_component_bento_typography","_hoisted_1","createElementVNode","createVNode","_component_dropdown_input_default","_component_error_message","normalizeClass","_component_bento_popover","withCtx","_component_calendar"],"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,IAAA,MA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AAA;AAAA;;;;IAKX,GAAA,GAAA,CAAA,SAAA,IAAA,CAAA,KAAAC,EAAA,IAAA,EAAA;AAAA,IAoBMD,EAAA,qBAAAE,EAAA,GAAAC,EAAAQ,GAAA;AAAA,MAnBc,KAAA;AAAA,MACrB,IAAAX,EAAA;AAAA,MACA,OAAA;AAAA,MACE,MAAA;AAAA,MACN,MAAAA,EAAA;AAAA,MACA,kBAAAA,EAAA;AAAA,MACY,sBAAA;AAAA,MACI,cAAAA,EAAA;AAAA,MACN,cAAA;AAAA,MACA,UAAAA,EAAA,sBAAA;AAAA;;MAGH,SAAAY,EAAA,MAAA;AAAA,QAAAL,EAAAM,GAAA;AAAA,UACgB,KAAA;AAAA,UACnB,qBAAAb,EAAA;AAAA,UACmB,oBAAAA,EAAA;AAAA,UACP,oBAAA;AAAA,UACL,OAAAA,EAAA;AAAA;;;;;;;;;;"}
@@ -1,5 +1,5 @@
1
- import { B as t, a as r } from "./chunks/index.b46a5047.js";
2
- import { b as o } from "./chunks/calendar.08885a56.js";
1
+ import { B as t, a as r } from "./chunks/index.c9225c3b.js";
2
+ import { b as o } from "./chunks/calendar.09b683b3.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.7dd953ea.js";
1
+ import { B as e, a as o } from "./chunks/index.d27367cd.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 o, openBlock as s, createElementBlock as n } from "vue";
2
2
  import { _ } from "./chunks/_plugin-vue_export-helper.dad06003.js";
3
- import "./assets/index.css";
3
+ import "./assets/index23.css";
4
4
  const d = i({
5
5
  name: "bento-divider",
6
6
  setup(t, { attrs: r }) {