@adyen/bento-vue3 1.76.2 → 1.77.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 (145) hide show
  1. package/dist/@types/index.d.ts +216 -33
  2. package/dist/assets/accordion-item.css +1 -1
  3. package/dist/assets/action-bar.css +1 -1
  4. package/dist/assets/base-modal.css +1 -1
  5. package/dist/assets/button-actions.css +1 -1
  6. package/dist/assets/card.css +1 -1
  7. package/dist/assets/data-grid.css +1 -1
  8. package/dist/assets/date-picker.css +1 -1
  9. package/dist/assets/date-range-picker.css +1 -1
  10. package/dist/assets/dialog-page.css +1 -1
  11. package/dist/assets/dropdown-default-textbox.css +1 -1
  12. package/dist/assets/dropdown-tag.css +1 -1
  13. package/dist/assets/dropdown.css +1 -1
  14. package/dist/assets/file-uploader.css +1 -1
  15. package/dist/assets/filter-bar.css +1 -1
  16. package/dist/assets/input-field-phone-number.css +1 -1
  17. package/dist/assets/input-field.css +1 -1
  18. package/dist/assets/inspector.css +1 -1
  19. package/dist/assets/modal-fullscreen.css +1 -1
  20. package/dist/assets/pagination.css +1 -1
  21. package/dist/assets/payment-method.css +1 -1
  22. package/dist/assets/secondary-nav.css +1 -1
  23. package/dist/assets/sidepanel.css +1 -1
  24. package/dist/assets/tag.css +1 -1
  25. package/dist/assets/textarea.css +1 -1
  26. package/dist/assets/timeline-item.css +1 -1
  27. package/dist/checkbox.js +2 -2
  28. package/dist/chunks/{checkbox-group.8ebmaHsA.js → checkbox-group.COUx8Ne8.js} +2 -2
  29. package/dist/chunks/{checkbox-group.8ebmaHsA.js.map → checkbox-group.COUx8Ne8.js.map} +1 -1
  30. package/dist/chunks/{checkbox.BI0dqARY.js → checkbox.SffuKyNj.js} +3 -3
  31. package/dist/chunks/{checkbox.BI0dqARY.js.map → checkbox.SffuKyNj.js.map} +1 -1
  32. package/dist/chunks/{code-snippet.Bjf1ma1L.js → code-snippet.ByoBEM00.js} +2 -2
  33. package/dist/chunks/{code-snippet.Bjf1ma1L.js.map → code-snippet.ByoBEM00.js.map} +1 -1
  34. package/dist/chunks/{currency.CBZMwm21.js → currency.WmvQjX7l.js} +2 -2
  35. package/dist/chunks/{currency.CBZMwm21.js.map → currency.WmvQjX7l.js.map} +1 -1
  36. package/dist/chunks/{data-grid.VBEJO94f.js → data-grid.CMIG82Xt.js} +7 -7
  37. package/dist/chunks/{data-grid.VBEJO94f.js.map → data-grid.CMIG82Xt.js.map} +1 -1
  38. package/dist/chunks/date-picker.CsGq3iSK.js +244 -0
  39. package/dist/chunks/date-picker.CsGq3iSK.js.map +1 -0
  40. package/dist/chunks/date-picker.types.Ckt7zxGy.js +5 -0
  41. package/dist/chunks/date-picker.types.Ckt7zxGy.js.map +1 -0
  42. package/dist/chunks/date-range-picker.C19CWG27.js +1149 -0
  43. package/dist/chunks/date-range-picker.C19CWG27.js.map +1 -0
  44. package/dist/chunks/{dropdown-default-textbox.MkU0tMf1.js → dropdown-default-textbox._KEBXjKT.js} +88 -86
  45. package/dist/chunks/dropdown-default-textbox._KEBXjKT.js.map +1 -0
  46. package/dist/chunks/dropdown-tag.B90dpg8J.js +301 -0
  47. package/dist/chunks/dropdown-tag.B90dpg8J.js.map +1 -0
  48. package/dist/chunks/dropdown.DYDHM__3.js +833 -0
  49. package/dist/chunks/{dropdown.KStrJVoP.js.map → dropdown.DYDHM__3.js.map} +1 -1
  50. package/dist/chunks/es6.MoTTyETW.js.map +1 -1
  51. package/dist/chunks/{file-uploader.By0MTfKk.js → file-uploader.BDXQ7Ccv.js} +416 -415
  52. package/dist/chunks/{file-uploader.By0MTfKk.js.map → file-uploader.BDXQ7Ccv.js.map} +1 -1
  53. package/dist/chunks/{filter-bar.JXmlFnHV.js → filter-bar.CmF92iAr.js} +303 -303
  54. package/dist/chunks/filter-bar.CmF92iAr.js.map +1 -0
  55. package/dist/chunks/form-field.BBqLu-vs.js +10 -0
  56. package/dist/chunks/form-field.BBqLu-vs.js.map +1 -0
  57. package/dist/chunks/get-slot-text.CQRAP2_q.js +12 -0
  58. package/dist/chunks/get-slot-text.CQRAP2_q.js.map +1 -0
  59. package/dist/chunks/{header-with-views.Dg2usaMY.js → header-with-views.xPfeOz0Y.js} +3 -3
  60. package/dist/chunks/{header-with-views.Dg2usaMY.js.map → header-with-views.xPfeOz0Y.js.map} +1 -1
  61. package/dist/chunks/{input-field-password.B6nJ7ygZ.js → input-field-password.BZBYVyAb.js} +3 -3
  62. package/dist/chunks/{input-field-password.B6nJ7ygZ.js.map → input-field-password.BZBYVyAb.js.map} +1 -1
  63. package/dist/chunks/{input-field-phone-number.D_UBAN2s.js → input-field-phone-number.a8Mw5PAW.js} +5 -5
  64. package/dist/chunks/{input-field-phone-number.D_UBAN2s.js.map → input-field-phone-number.a8Mw5PAW.js.map} +1 -1
  65. package/dist/chunks/{input-field.C29FCI4j.js → input-field.CYGGIK48.js} +48 -48
  66. package/dist/chunks/input-field.CYGGIK48.js.map +1 -0
  67. package/dist/chunks/{listbox-option-tag.uHSB7MO6.js → listbox-option-tag.Cwe9Bn-R.js} +2 -2
  68. package/dist/chunks/{listbox-option-tag.uHSB7MO6.js.map → listbox-option-tag.Cwe9Bn-R.js.map} +1 -1
  69. package/dist/chunks/{pagination.BaBWNlIF.js → pagination.CYdGcyMA.js} +49 -49
  70. package/dist/chunks/pagination.CYdGcyMA.js.map +1 -0
  71. package/dist/chunks/{payment-method.CDnn1bjo.js → payment-method.D6PeTYWq.js} +45 -42
  72. package/dist/chunks/payment-method.D6PeTYWq.js.map +1 -0
  73. package/dist/chunks/payment-method.types.BqtH7RM2.js.map +1 -1
  74. package/dist/chunks/{radio-group.DWNqrkZ3.js → radio-group.B_8R6vGx.js} +3 -3
  75. package/dist/chunks/{radio-group.DWNqrkZ3.js.map → radio-group.B_8R6vGx.js.map} +1 -1
  76. package/dist/chunks/{rich-text-editor.Bh7KS617.js → rich-text-editor.B6Ftqv55.js} +2 -2
  77. package/dist/chunks/{rich-text-editor.Bh7KS617.js.map → rich-text-editor.B6Ftqv55.js.map} +1 -1
  78. package/dist/chunks/{search-bar.RS02IcLc.js → search-bar.D3Ri_RUK.js} +3 -3
  79. package/dist/chunks/{search-bar.RS02IcLc.js.map → search-bar.D3Ri_RUK.js.map} +1 -1
  80. package/dist/chunks/{secondary-nav.DXsgUTqk.js → secondary-nav.CAb20jWW.js} +24 -24
  81. package/dist/chunks/secondary-nav.CAb20jWW.js.map +1 -0
  82. package/dist/chunks/{summary-grid.types.ByQ4u19J.js → summary-grid.types.cE1fyLvC.js} +2 -2
  83. package/dist/chunks/{summary-grid.types.ByQ4u19J.js.map → summary-grid.types.cE1fyLvC.js.map} +1 -1
  84. package/dist/chunks/tag.CjaB9DxL.js +57 -0
  85. package/dist/chunks/tag.CjaB9DxL.js.map +1 -0
  86. package/dist/chunks/textarea.C_gnXj6b.js +254 -0
  87. package/dist/chunks/textarea.C_gnXj6b.js.map +1 -0
  88. package/dist/chunks/{timeline-item.DNjubXL2.js → timeline-item.rSY0Xce3.js} +48 -48
  89. package/dist/chunks/timeline-item.rSY0Xce3.js.map +1 -0
  90. package/dist/chunks/{toggle.Dd_NA8eH.js → toggle.BHCUjMpp.js} +2 -2
  91. package/dist/chunks/{toggle.Dd_NA8eH.js.map → toggle.BHCUjMpp.js.map} +1 -1
  92. package/dist/code-snippet.js +1 -1
  93. package/dist/currency.js +1 -1
  94. package/dist/data-grid.js +1 -1
  95. package/dist/date-picker.js +7 -6
  96. package/dist/date-picker.js.map +1 -1
  97. package/dist/date-range-picker.js +1 -1
  98. package/dist/dropdown.js +3 -3
  99. package/dist/file-uploader.js +1 -1
  100. package/dist/filter-bar.js +1 -1
  101. package/dist/header-with-views.js +1 -1
  102. package/dist/index.js +246 -245
  103. package/dist/index.js.map +1 -1
  104. package/dist/input-field-password.js +1 -1
  105. package/dist/input-field-phone-number.js +1 -1
  106. package/dist/input-field.js +1 -1
  107. package/dist/internal.js +1 -1
  108. package/dist/pagination.js +1 -1
  109. package/dist/payment-method.js +1 -1
  110. package/dist/radio-group.js +1 -1
  111. package/dist/rich-text-editor.js +1 -1
  112. package/dist/search-bar.js +2 -2
  113. package/dist/secondary-nav.js +1 -1
  114. package/dist/styles/bento-dark.css +4 -0
  115. package/dist/styles/bento-light.css +4 -0
  116. package/dist/styles/bento.css +4 -0
  117. package/dist/styles/legacy.css +4 -0
  118. package/dist/styles/styleguide.css +4 -0
  119. package/dist/summary-grid.js +1 -1
  120. package/dist/tag.js +1 -1
  121. package/dist/textarea.js +1 -1
  122. package/dist/timeline.js +1 -1
  123. package/dist/toggle.js +1 -1
  124. package/dist/web-types.json +1 -1
  125. package/package.json +5 -5
  126. package/dist/chunks/date-picker.OI-sQ232.js +0 -234
  127. package/dist/chunks/date-picker.OI-sQ232.js.map +0 -1
  128. package/dist/chunks/date-range-picker.D7IwIR5V.js +0 -1114
  129. package/dist/chunks/date-range-picker.D7IwIR5V.js.map +0 -1
  130. package/dist/chunks/dropdown-default-textbox.MkU0tMf1.js.map +0 -1
  131. package/dist/chunks/dropdown-tag.DFeoXIgH.js +0 -242
  132. package/dist/chunks/dropdown-tag.DFeoXIgH.js.map +0 -1
  133. package/dist/chunks/dropdown.KStrJVoP.js +0 -825
  134. package/dist/chunks/filter-bar.JXmlFnHV.js.map +0 -1
  135. package/dist/chunks/get-slot-text.DQlZEsId.js +0 -12
  136. package/dist/chunks/get-slot-text.DQlZEsId.js.map +0 -1
  137. package/dist/chunks/input-field.C29FCI4j.js.map +0 -1
  138. package/dist/chunks/pagination.BaBWNlIF.js.map +0 -1
  139. package/dist/chunks/payment-method.CDnn1bjo.js.map +0 -1
  140. package/dist/chunks/secondary-nav.DXsgUTqk.js.map +0 -1
  141. package/dist/chunks/tag.CEmpyuYX.js +0 -50
  142. package/dist/chunks/tag.CEmpyuYX.js.map +0 -1
  143. package/dist/chunks/textarea.C1jkfowf.js +0 -246
  144. package/dist/chunks/textarea.C1jkfowf.js.map +0 -1
  145. package/dist/chunks/timeline-item.DNjubXL2.js.map +0 -1
@@ -1,234 +0,0 @@
1
- import { ref as m, computed as D, defineComponent as ae, toRef as N, watch as te, withDirectives as le, createElementBlock as re, openBlock as v, withKeys as _, createBlock as I, createCommentVNode as g, createElementVNode as oe, unref as t, createVNode as L, normalizeClass as ne, withCtx as M, createTextVNode as ie, toDisplayString as se, nextTick as ue } from "vue";
2
- import { f as V, s as K, b as de } from "./calendar.Tm7Cvpwu.js";
3
- import { h as ce } from "./button-actions.BQ3AFQqt.js";
4
- import { B as pe } from "./typography.yBEME_Gu.js";
5
- import { D as fe } from "./dropdown-default-textbox.MkU0tMf1.js";
6
- import { d as ve } from "./debounce.DUTu11PS.js";
7
- import { D as O, v as me, f as De } from "./date-format.B8RU7D42.js";
8
- import { g as C } from "./generate-uid.NJ8tVoha.js";
9
- import { u as $ } from "./index.pdBj0KQU.js";
10
- import { g as be } from "./differenceInMonths.C8FyCrav.js";
11
- import { u as ye } from "./use-form-layout-loading.D3lALhtC.js";
12
- import { B as ke } from "./directive.Cbdox5VL.js";
13
- import { F as Ie, E as Y } from "./field-label.C97CrBI_.js";
14
- import { _ as ge } from "./_plugin-vue_export-helper.CHgC5LLL.js";
15
- import "../assets/date-picker.css";
16
- const R = {
17
- "en-US": {
18
- datePicker: "Date picker",
19
- provideDateInAFormat: "Provide date in a YYYY-MM-DD format",
20
- selectDate: "Select a date",
21
- selectDateRange: "Select a date range",
22
- selectedDateIsNotAvailable: "Selected date is not available"
23
- },
24
- "ja-JP": {
25
- datePicker: "日付ピッカー",
26
- selectDate: "日付を選択"
27
- },
28
- "pt-BR": {
29
- datePicker: "Seletor de datas",
30
- selectDate: "Selecione uma data"
31
- }
32
- }, Ce = ({
33
- datePickerValue: r,
34
- isDateIncorrect: E,
35
- isMonthVariant: s,
36
- placeholder: a
37
- }) => {
38
- var y;
39
- const { locale: o, t: b } = $({ messages: R }), n = be(), p = m((y = r.value) == null ? void 0 : y.toDateString());
40
- return {
41
- // Values
42
- dateDisplayValue: D(() => {
43
- var i;
44
- return E.value ? p.value : r.value ? V(
45
- r.value,
46
- s != null && s.value ? O.LONG_MONTH_YEAR : O.FULL_DATE,
47
- {
48
- locale: n[(i = o.value) == null ? void 0 : i.substring(0, 2)] || n.enUS
49
- }
50
- ) : (a == null ? void 0 : a.value) || b("selectDate");
51
- }),
52
- textInputValue: p,
53
- // Methods
54
- formatTextInputDisplayValue: (i = r.value) => {
55
- var f;
56
- if (E.value)
57
- return;
58
- const T = s != null && s.value ? K(i) : i;
59
- p.value = i ? V(T, O.NUMERIC_DATE_YEAR_FIRST, {
60
- locale: n[(f = o.value) == null ? void 0 : f.substring(0, 2)] || n.enUS
61
- }) : null;
62
- }
63
- };
64
- };
65
- var c = /* @__PURE__ */ ((r) => (r.INPUT = "input", r))(c || {});
66
- const Ee = {
67
- i18n: { messages: R },
68
- name: "bento-date-picker"
69
- }, Te = /* @__PURE__ */ ae({
70
- ...Ee,
71
- props: {
72
- defaultDisplayMonth: { default: null },
73
- firstDayOfWeek: { default: 1 },
74
- isDateDisabled: { default: void 0 },
75
- min: { default: null },
76
- max: { default: null },
77
- value: { default: null },
78
- variant: { default: void 0 },
79
- description: { default: void 0 },
80
- disabled: { type: Boolean, default: !1 },
81
- errorMessage: { default: null },
82
- label: { default: void 0 },
83
- optional: { type: Boolean, default: !1 },
84
- placeholder: { default: null },
85
- readonly: { type: Boolean, default: !1 },
86
- required: { type: Boolean, default: !1 },
87
- tooltipText: { default: null }
88
- },
89
- emits: [c.INPUT],
90
- setup(r, { emit: E }) {
91
- const a = r, o = E, { t: b } = $({ messages: R }), n = C("bento-date-picker-container"), p = C("bento-date-picker-label"), U = C("bento-date-picker-description"), w = C("bento-date-picker-error"), y = C("bento-date-picker-date-error"), i = D(() => a.label || b("datePicker", { name: n })), T = m(null), f = m(null), u = m(!1), l = m(!1), S = m(void 0), { isReadOnly: q } = ye(N(a, "readonly"));
92
- te(
93
- () => a.disabled,
94
- (e) => {
95
- e && l.value && (l.value = !1);
96
- }
97
- );
98
- const W = D(() => a.variant === "month"), { dateDisplayValue: j, textInputValue: d, formatTextInputDisplayValue: x } = Ce({
99
- datePickerValue: N(a, "value"),
100
- isDateIncorrect: u,
101
- isMonthVariant: W,
102
- placeholder: N(a, "placeholder")
103
- }), k = D(() => a.isDateDisabled && d.value && a.isDateDisabled(new Date(d.value)) && !l.value ? b("selectedDateIsNotAvailable") : u.value ? b("provideDateInAFormat") : null), z = D(() => ({
104
- "b-date-picker__description--error": a.errorMessage || k.value
105
- })), G = D(
106
- () => `${a.description ? U : ""} ${a.errorMessage ? w : ""} ${k.value ? y : ""}`.trim() || null
107
- ), H = (e) => a.min && e <= a.min || a.max && e >= a.max ? !1 : a.isDateDisabled ? !a.isDateDisabled(e) : !0, P = () => {
108
- l.value = !1;
109
- }, A = () => {
110
- l.value = !0, x();
111
- }, J = (e) => {
112
- u.value = !1, P(), o(c.INPUT, e);
113
- }, Q = async () => {
114
- u.value && (u.value = !1, d.value = null), o(c.INPUT, null);
115
- }, X = (e) => {
116
- me(e);
117
- }, F = (e) => {
118
- if (e.length < 10)
119
- return;
120
- /^\d{4}-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])$/.test(e) && H(new Date(e)) ? (u.value = !1, o(c.INPUT, new Date(e))) : e && (u.value = !0, o(c.INPUT, null));
121
- }, Z = ve(F, 1e3), ee = (e) => {
122
- d.value = De(e), l.value ? Z(d.value) : F(d.value);
123
- }, h = async (e) => {
124
- var B;
125
- l.value || (e.preventDefault(), A(), await ue(), a.value || (x(/* @__PURE__ */ new Date()), o(c.INPUT, /* @__PURE__ */ new Date())), S.value = ((B = T.value) == null ? void 0 : B.$refs.calendarRef[0].focusOnDate(
126
- a.variant === "month" ? K(a.value) : a.value,
127
- !0
128
- )) ?? void 0);
129
- };
130
- return (e, B) => le((v(), re("div", {
131
- class: "b-date-picker",
132
- onKeydownCapture: [
133
- _(h, ["space"]),
134
- _(h, ["enter"])
135
- ]
136
- }, [
137
- e.label ? (v(), I(t(Ie), {
138
- key: 0,
139
- id: t(p),
140
- label: e.label,
141
- "tooltip-text": e.tooltipText,
142
- optional: e.optional,
143
- required: e.required
144
- }, null, 8, ["id", "label", "tooltip-text", "optional", "required"])) : g("", !0),
145
- oe("div", null, [
146
- L(t(fe), {
147
- ref_key: "inputContainerRef",
148
- ref: f,
149
- "always-combobox-is-input": "",
150
- ariaControls: t(n),
151
- ariaExpanded: l.value,
152
- "aria-labelledby": e.label ? t(p) : null,
153
- "aria-describedby": G.value,
154
- disabled: e.disabled,
155
- "dynamic-filtering": "",
156
- "is-invalid": !!e.errorMessage || !!k.value,
157
- open: l.value,
158
- value: t(d),
159
- "display-value": t(j),
160
- "debounce-time": 0,
161
- readonly: t(q),
162
- onInput: ee,
163
- onOpen: A,
164
- onKeydown: X,
165
- onClear: Q,
166
- onClose: P
167
- }, null, 8, ["ariaControls", "ariaExpanded", "aria-labelledby", "aria-describedby", "disabled", "is-invalid", "open", "value", "display-value", "readonly"])
168
- ]),
169
- k.value ? (v(), I(t(Y), {
170
- key: 1,
171
- id: t(y),
172
- "error-message": k.value,
173
- class: "b-date-picker__error-message"
174
- }, null, 8, ["id", "error-message"])) : g("", !0),
175
- e.errorMessage ? (v(), I(t(Y), {
176
- key: 2,
177
- id: t(w),
178
- "error-message": e.errorMessage,
179
- class: "b-date-picker__error-message"
180
- }, null, 8, ["id", "error-message"])) : g("", !0),
181
- e.description ? (v(), I(t(pe), {
182
- key: 3,
183
- class: ne(["b-date-picker__description", z.value]),
184
- el: "span"
185
- }, {
186
- default: M(() => [
187
- ie(se(e.description), 1)
188
- ]),
189
- _: 1
190
- }, 8, ["class"])) : g("", !0),
191
- f.value ? (v(), I(t(ce), {
192
- key: 4,
193
- id: t(n),
194
- class: "b-date-picker__container",
195
- role: "dialog",
196
- open: l.value,
197
- "target-element": f.value,
198
- "aria-label": i.value,
199
- "aria-modal": !0,
200
- position: "bottom-start",
201
- "fit-content": "",
202
- "trap-all": "",
203
- "trap-all-options": {
204
- initialFocus: S.value
205
- },
206
- onKeydown: _(P, ["esc", "native"])
207
- }, {
208
- default: M(() => [
209
- L(t(de), {
210
- ref_key: "calendarContainerRef",
211
- ref: T,
212
- "default-display-month": e.defaultDisplayMonth,
213
- "first-day-of-week": e.firstDayOfWeek,
214
- "is-date-disabled": e.isDateDisabled,
215
- "number-of-months": 1,
216
- value: e.value,
217
- min: e.min,
218
- max: e.max,
219
- variant: e.variant,
220
- onInput: J
221
- }, null, 8, ["default-display-month", "first-day-of-week", "is-date-disabled", "value", "min", "max", "variant"])
222
- ]),
223
- _: 1
224
- }, 8, ["id", "open", "target-element", "aria-label", "trap-all-options"])) : g("", !0)
225
- ], 32)), [
226
- [t(ke), P]
227
- ]);
228
- }
229
- }), Ve = /* @__PURE__ */ ge(Te, [["__scopeId", "data-v-726bce96"]]);
230
- export {
231
- Ve as B,
232
- c as a
233
- };
234
- //# sourceMappingURL=date-picker.OI-sQ232.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"date-picker.OI-sQ232.js","sources":["../../../vue2/src/components/date-picker/composables/use-date-picker-single-calendar-text.ts","../../../vue2/src/components/date-picker/date-picker.types.ts","../../../vue2/src/components/date-picker/date-picker.vue"],"sourcesContent":["import { computed, ref } from 'vue';\nimport { useI18n } from '@/utils/ts/i18n';\nimport { type UseDateDisplayText } from './use-date-picker-single-calendar-text.types';\nimport { DateFormat } from '@/types/date-format';\nimport { getDateLocale } from '@/utils/ts/get-date-locale/get-date-locale';\nimport { format } from 'date-fns/format';\nimport { startOfMonth } from 'date-fns/startOfMonth';\nimport messages from '../messages.json';\n\ntype MessageSchema = (typeof messages)['en-US'];\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 * @param {?Ref<boolean>} option.isMonthVariant Indicates if the date picker has variant \"month\"\n */\nexport const useDatePickerSingleCalendarText: UseDateDisplayText<Date> = ({\n datePickerValue,\n isDateIncorrect,\n isMonthVariant,\n placeholder,\n}) => {\n const { locale, t } = useI18n<{ message: MessageSchema }>({ messages });\n const locales = getDateLocale();\n\n const textInputValue = ref(datePickerValue.value?.toDateString());\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 placeholder?.value || (t('selectDate') as string);\n }\n\n // Display the date in format \"dd MMM, yyyy (25 Jun, 2023)\" or \"MMMM yyyy (June 2023)\"\n // if there's a valid date selected\n return format(\n datePickerValue.value,\n isMonthVariant?.value ? DateFormat.LONG_MONTH_YEAR : DateFormat.FULL_DATE,\n {\n locale: locales[locale.value?.substring(0, 2)] || locales.enUS,\n }\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 const date = isMonthVariant?.value ? startOfMonth(dateToFormat) : dateToFormat;\n textInputValue.value = dateToFormat\n ? format(date, DateFormat.NUMERIC_DATE_YEAR_FIRST, {\n locale: locales[locale.value?.substring(0, 2)] || locales.enUS,\n })\n : null;\n };\n\n return {\n // Values\n dateDisplayValue,\n textInputValue,\n\n // Methods\n formatTextInputDisplayValue,\n };\n};\n","import type { FormField } from '../../types/form-field';\nimport {\n CalendarFirstDayOfWeek as BentoDatePickerFirstDayOfWeek,\n type CalendarIsDateDisabled as BentoDatePickerIsDateDisabled,\n type CalendarSingleDateValue as BentoDatePickerValue,\n CalendarVariant as BentoDatePickerVariant,\n} from '@/internal';\n\nexport {\n BentoDatePickerFirstDayOfWeek,\n type BentoDatePickerIsDateDisabled,\n type BentoDatePickerValue,\n BentoDatePickerVariant,\n};\n\nexport enum BentoDatePickerEvent {\n INPUT = 'input',\n}\n\nexport interface BentoDatePickerProps extends FormField {\n /**\n * Default start date for the calendar pane.\n * Expected format: YYYY-MM-DD\n * @default null\n */\n defaultDisplayMonth?: string | null;\n\n /**\n * Allows you to set the first day of the week. 0 is sunday, 1 is monday, 6 is saturday\n * @default 1\n */\n firstDayOfWeek?: BentoDatePickerFirstDayOfWeek;\n\n /**\n * Indicate if a date should be disabled or not\n */\n isDateDisabled?: BentoDatePickerIsDateDisabled;\n\n /**\n * Sets a minimum limit for selectable dates - dates before `min` will not be selectable\n * @default null\n */\n min?: Date | null;\n\n /**\n * Sets a maximum limit for selectable dates - dates after `max` will not be selectable\n * @default null\n */\n max?: Date | null;\n\n /**\n * Selected date\n * @default null\n */\n value?: BentoDatePickerValue | null;\n\n /**\n * The type of calendar to display. Defaults to showing days.\n */\n variant?: `${BentoDatePickerVariant}`;\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 <field-label\n v-if=\"label\"\n :id=\"labelId\"\n :label=\"label\"\n :tooltip-text=\"tooltipText\"\n :optional=\"optional\"\n :required=\"required\"\n />\n\n <!-- Input -->\n <div>\n <dropdown-input-default\n ref=\"inputContainerRef\"\n always-combobox-is-input\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=\"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 :aria-label=\"popoverAriaLabel\"\n :aria-modal=\"true\"\n position=\"bottom-start\"\n fit-content\n trap-all\n :trap-all-options=\"{\n initialFocus: initialFocusOnDatePickerOpen,\n }\"\n @keydown.esc.native=\"closeDatePicker\"\n >\n <calendar\n ref=\"calendarContainerRef\"\n :default-display-month=\"defaultDisplayMonth\"\n :first-day-of-week=\"firstDayOfWeek\"\n :is-date-disabled=\"isDateDisabled\"\n :number-of-months=\"1\"\n :value=\"value\"\n :min=\"min\"\n :max=\"max\"\n :variant=\"variant\"\n @input=\"onDateSelected\"\n />\n </bento-popover>\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import { computed, nextTick, type Ref, ref, toRef, watch } from 'vue';\n import { startOfMonth } from 'date-fns/startOfMonth';\n\n // Components\n import { BentoPopover } from '@/components/popover';\n import { BentoTypography } from '../typography';\n import { Calendar, ErrorMessage, FieldLabel } from '@/internal';\n import { DropdownInputDefault } from '@/components/dropdown/components';\n\n // Utils\n import { debounce } from '@/utils/ts/debounce';\n import { formatDateInputValue, validateDateInput } from '@/utils/ts/date-input';\n import { generateUid } from '@/core/utils/ts';\n import { useI18n } from '@/utils/ts/i18n';\n\n // Composables\n import { useDatePickerSingleCalendarText } from './composables/use-date-picker-single-calendar-text';\n import { useFormLayoutFieldLoading } from '@/composables';\n\n // Directive\n import { BentoClickOutsideDirective as vBentoClickOutsideDirective } from '@/directives';\n\n // Types\n import { BentoDatePickerEvent, type BentoDatePickerProps } from './date-picker.types';\n\n import messages from './messages.json';\n\n type MessageSchema = (typeof messages)['en-US'];\n const DEBOUNCE_TIME = 1000;\n\n const props = withDefaults(defineProps<BentoDatePickerProps>(), {\n defaultDisplayMonth: null,\n description: undefined,\n disabled: false,\n errorMessage: null,\n firstDayOfWeek: 1, // Monday\n isDateDisabled: undefined,\n label: undefined,\n max: null,\n min: null,\n optional: false,\n placeholder: null,\n readonly: false,\n required: false,\n tooltipText: null,\n value: null,\n variant: undefined, // Default will be set by @/internal/calendar\n });\n\n const emit = defineEmits([BentoDatePickerEvent.INPUT]);\n\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 initialFocusOnDatePickerOpen = ref(undefined);\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 isMonthVariant = computed(() => props.variant === 'month');\n\n const { dateDisplayValue, textInputValue, formatTextInputDisplayValue } = useDatePickerSingleCalendarText({\n datePickerValue: toRef(props, 'value') as Ref<Date>,\n isDateIncorrect,\n isMonthVariant,\n placeholder: toRef(props, 'placeholder'),\n });\n\n const dateErrorText = computed(() => {\n if (\n props.isDateDisabled &&\n textInputValue.value &&\n props.isDateDisabled(new Date(textInputValue.value)) &&\n !isDatePickerOpen.value\n ) {\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 date is between min/max bounds, if there are any\n if ((props.min && date <= props.min) || (props.max && date >= props.max)) {\n return false;\n }\n\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 = (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 };\n\n const validateDateDebounced = debounce(validateDate, DEBOUNCE_TIME);\n\n const onDateInputChange = (stringDate: string) => {\n textInputValue.value = formatDateInputValue(stringDate);\n // If we are closing the date picker, we should validate (and emit date inputs) immediately so the user doesn't have to wait for the debounce time.\n if (isDatePickerOpen.value) {\n validateDateDebounced(textInputValue.value);\n } else {\n validateDate(textInputValue.value);\n }\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\n // Set initial focus\n initialFocusOnDatePickerOpen.value =\n calendarContainerRef.value?.$refs.calendarRef[0].focusOnDate(\n props.variant === 'month' ? startOfMonth(props.value) : props.value,\n true\n ) ?? undefined;\n };\n</script>\n\n<script lang=\"ts\">\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 {\n i18n: { messages },\n name: 'bento-date-picker',\n };\n</script>\n\n<style lang=\"scss\" scoped src=\"./date-picker.scss\" />\n"],"names":["useDatePickerSingleCalendarText","datePickerValue","isDateIncorrect","isMonthVariant","placeholder","locale","t","useI18n","messages","locales","getDateLocale","textInputValue","ref","_a","computed","format","DateFormat","dateToFormat","date","startOfMonth","BentoDatePickerEvent","BentoDatePickerEvent2","__default__","props","__props","emit","__emit","datePickerContainerId","generateUid","labelId","descriptionId","errorId","dateErrorId","popoverAriaLabel","calendarContainerRef","inputContainerRef","isDatePickerOpen","initialFocusOnDatePickerOpen","isReadOnly","useFormLayoutFieldLoading","toRef","watch","disabled","dateDisplayValue","formatTextInputDisplayValue","dateErrorText","descriptionConditionalClasses","ariaDescribedBy","isDateEnabled","closeDatePicker","openDatePicker","onDateSelected","selectedDate","clearDatePickerValue","onDateKeyDown","event","validateDateInput","validateDate","stringDate","validateDateDebounced","debounce","onDateInputChange","formatDateInputValue","onSpaceBarOrEnter","nextTick"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiBOA,KAAA,CAAA;AAAA,EAAmE,iBAAAC;AAAA,EACtE,iBAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,aAAAC;AAEJ,MAAA;;AACI,QAAA,EAAA,QAAAC,GAAA,GAAAC,EAAA,IAAAC,EAAA,EAAA,UAAAC,EAAA,CAAA,GACAC,IAAAC,GAAA,GAEAC,IAAAC,GAAAC,IAAAZ,EAAA,UAAA,gBAAAY,EAAA,cAAA;AA0CA,SAAA;AAAA;AAAA,IAAO,kBAxCPC,EAAA,MAAA;;AAEI,aAAAZ,EAAA,QACIS,EAAA,QAIJV,EAAA,QAMAc;AAAA,QAAOd,EAAA;AAAA,QACaE,KAAA,QAAAA,EAAA,QAAAa,EAAA,kBAAAA,EAAA;AAAA,QACgD;AAAA,UAChE,QAAAP,GAAAI,IAAAR,EAAA,UAAA,gBAAAQ,EAAA,UAAA,GAAA,EAAA,KAAAJ,EAAA;AAAA,QAC8D;AAAA,MAC9D,KAVAL,KAAA,gBAAAA,EA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