@adyen/bento-vue3 1.66.0 → 1.68.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 (188) hide show
  1. package/dist/@types/index.d.ts +2017 -2206
  2. package/dist/action-bar.js +1 -1
  3. package/dist/assets/accordion-item.css +1 -1
  4. package/dist/assets/action-bar.css +1 -1
  5. package/dist/assets/base-modal.css +1 -1
  6. package/dist/assets/button-actions.css +1 -1
  7. package/dist/assets/card.css +1 -1
  8. package/dist/assets/checkbox.css +1 -1
  9. package/dist/assets/data-grid.css +1 -1
  10. package/dist/assets/date-range-picker.css +1 -1
  11. package/dist/assets/dialog-page.css +1 -1
  12. package/dist/assets/dropdown-default-textbox.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/footer-actions.css +1 -1
  17. package/dist/assets/header-meta.css +1 -0
  18. package/dist/assets/header-with-views.css +1 -1
  19. package/dist/assets/header.css +1 -1
  20. package/dist/assets/input-field-password.css +1 -1
  21. package/dist/assets/input-field-phone-number.css +1 -1
  22. package/dist/assets/input-field.css +1 -1
  23. package/dist/assets/inspector.css +1 -1
  24. package/dist/assets/menu.css +1 -1
  25. package/dist/assets/modal-fullscreen.css +1 -1
  26. package/dist/assets/popover.css +1 -1
  27. package/dist/assets/sidepanel.css +1 -1
  28. package/dist/assets/summary-grid.css +1 -1
  29. package/dist/assets/textarea.css +1 -1
  30. package/dist/assets/use-cached-selected-values.css +1 -1
  31. package/dist/button.js +1 -1
  32. package/dist/card.js +1 -1
  33. package/dist/checkbox.js +2 -2
  34. package/dist/chunks/{action-bar.OzhLTUKc.js → action-bar.C93kgr7l.js} +4 -4
  35. package/dist/chunks/{action-bar.OzhLTUKc.js.map → action-bar.C93kgr7l.js.map} +1 -1
  36. package/dist/chunks/{base-modal.CCwWuH6k.js → base-modal.C3_r3rmc.js} +120 -183
  37. package/dist/chunks/base-modal.C3_r3rmc.js.map +1 -0
  38. package/dist/chunks/{button-actions-with-menu.xZYmwO7S.js → button-actions-with-menu.DUccmaB2.js} +3 -3
  39. package/dist/chunks/{button-actions-with-menu.xZYmwO7S.js.map → button-actions-with-menu.DUccmaB2.js.map} +1 -1
  40. package/dist/chunks/{button-actions.D1pXI1AJ.js → button-actions.CZdO9YOk.js} +7 -7
  41. package/dist/chunks/button-actions.CZdO9YOk.js.map +1 -0
  42. package/dist/chunks/{card.DiBtLuRU.js → card.CS34Mi_G.js} +2 -2
  43. package/dist/chunks/{card.DiBtLuRU.js.map → card.CS34Mi_G.js.map} +1 -1
  44. package/dist/chunks/{checkbox-group.Dc5Olq0c.js → checkbox-group.JRo6xNpe.js} +2 -2
  45. package/dist/chunks/{checkbox-group.Dc5Olq0c.js.map → checkbox-group.JRo6xNpe.js.map} +1 -1
  46. package/dist/chunks/{checkbox.fkPJvdUo.js → checkbox.DGrG3GN1.js} +70 -67
  47. package/dist/chunks/checkbox.DGrG3GN1.js.map +1 -0
  48. package/dist/chunks/{code-snippet.DPIhpuKa.js → code-snippet.aucmPbLw.js} +3 -3
  49. package/dist/chunks/{code-snippet.DPIhpuKa.js.map → code-snippet.aucmPbLw.js.map} +1 -1
  50. package/dist/chunks/{country.BhAcCmRx.js → country.Q95voxeL.js} +2 -2
  51. package/dist/chunks/{country.BhAcCmRx.js.map → country.Q95voxeL.js.map} +1 -1
  52. package/dist/chunks/{dashboard-section.BmtN9b0B.js → dashboard-section.CUcq2ahu.js} +2 -2
  53. package/dist/chunks/{dashboard-section.BmtN9b0B.js.map → dashboard-section.CUcq2ahu.js.map} +1 -1
  54. package/dist/chunks/{dashed-underline.ywc0ydgS.js → dashed-underline.DkzQkpaf.js} +2 -2
  55. package/dist/chunks/{dashed-underline.ywc0ydgS.js.map → dashed-underline.DkzQkpaf.js.map} +1 -1
  56. package/dist/chunks/{data-grid-template.DAuqLhPI.js → data-grid-template.CDsV2GFG.js} +2 -2
  57. package/dist/chunks/{data-grid-template.DAuqLhPI.js.map → data-grid-template.CDsV2GFG.js.map} +1 -1
  58. package/dist/chunks/data-grid.BJHcfrTG.js +3861 -0
  59. package/dist/chunks/data-grid.BJHcfrTG.js.map +1 -0
  60. package/dist/chunks/{date-picker.Bk4FNLyR.js → date-picker.DgpMAGYp.js} +3 -3
  61. package/dist/chunks/{date-picker.Bk4FNLyR.js.map → date-picker.DgpMAGYp.js.map} +1 -1
  62. package/dist/chunks/date-range-picker.Bxa_f6Q0.js +1225 -0
  63. package/dist/chunks/date-range-picker.Bxa_f6Q0.js.map +1 -0
  64. package/dist/chunks/{dropdown-default-textbox.B05elQig.js → dropdown-default-textbox.Ce5D3ipi.js} +40 -39
  65. package/dist/chunks/dropdown-default-textbox.Ce5D3ipi.js.map +1 -0
  66. package/dist/chunks/dropdown-tag.AV8Pi1SS.js +230 -0
  67. package/dist/chunks/dropdown-tag.AV8Pi1SS.js.map +1 -0
  68. package/dist/chunks/dropdown.CJBk1euy.js +814 -0
  69. package/dist/chunks/dropdown.CJBk1euy.js.map +1 -0
  70. package/dist/chunks/es6.n1ewaW31.js.map +1 -1
  71. package/dist/chunks/{filter-bar.BxfaFHTk.js → filter-bar.6D-9UEng.js} +848 -833
  72. package/dist/chunks/filter-bar.6D-9UEng.js.map +1 -0
  73. package/dist/chunks/{footer-actions.vQ4flLqU.js → footer-actions.Bje-DDqw.js} +2 -2
  74. package/dist/chunks/{footer-actions.vQ4flLqU.js.map → footer-actions.Bje-DDqw.js.map} +1 -1
  75. package/dist/chunks/header-meta.Yt43-cUI.js +234 -0
  76. package/dist/chunks/header-meta.Yt43-cUI.js.map +1 -0
  77. package/dist/chunks/{header-with-views.COrWDbtU.js → header-with-views.DbBUHvvE.js} +959 -923
  78. package/dist/chunks/header-with-views.DbBUHvvE.js.map +1 -0
  79. package/dist/chunks/header.wiq0wlgm.js +141 -0
  80. package/dist/chunks/header.wiq0wlgm.js.map +1 -0
  81. package/dist/chunks/{input-field-password.XrXAnMpT.js → input-field-password.Cr3A_4n0.js} +86 -85
  82. package/dist/chunks/input-field-password.Cr3A_4n0.js.map +1 -0
  83. package/dist/chunks/{input-field-phone-number.CNurVdiF.js → input-field-phone-number.DZp5IzU3.js} +548 -532
  84. package/dist/chunks/{input-field-phone-number.CNurVdiF.js.map → input-field-phone-number.DZp5IzU3.js.map} +1 -1
  85. package/dist/chunks/input-field.CmV2d_Zc.js +304 -0
  86. package/dist/chunks/input-field.CmV2d_Zc.js.map +1 -0
  87. package/dist/chunks/{menu.CiyYOoKd.js → menu.C-3obPGl.js} +182 -180
  88. package/dist/chunks/{menu.CiyYOoKd.js.map → menu.C-3obPGl.js.map} +1 -1
  89. package/dist/chunks/{modal-fullscreen.CuL9oSAq.js → modal-fullscreen.DBTnoSX9.js} +90 -77
  90. package/dist/chunks/modal-fullscreen.DBTnoSX9.js.map +1 -0
  91. package/dist/chunks/{modal.vue_vue_type_script_setup_true_lang.LnD61fHp.js → modal.vue_vue_type_script_setup_true_lang.Cd-mQUJ8.js} +10 -10
  92. package/dist/chunks/{modal.vue_vue_type_script_setup_true_lang.LnD61fHp.js.map → modal.vue_vue_type_script_setup_true_lang.Cd-mQUJ8.js.map} +1 -1
  93. package/dist/chunks/{pagination._rYMF2W_.js → pagination.DLYrWpKr.js} +2 -2
  94. package/dist/chunks/{pagination._rYMF2W_.js.map → pagination.DLYrWpKr.js.map} +1 -1
  95. package/dist/chunks/popover.DYgCCUCJ.js +200 -0
  96. package/dist/chunks/popover.DYgCCUCJ.js.map +1 -0
  97. package/dist/chunks/popover.types.V8old-GW.js +6 -0
  98. package/dist/chunks/popover.types.V8old-GW.js.map +1 -0
  99. package/dist/chunks/promo-banner.CQp3z2CP.js.map +1 -1
  100. package/dist/chunks/{rich-text-editor.RD8aCPTi.js → rich-text-editor.Dx78coVL.js} +5 -4
  101. package/dist/chunks/{rich-text-editor.RD8aCPTi.js.map → rich-text-editor.Dx78coVL.js.map} +1 -1
  102. package/dist/chunks/{search-bar.i7BY4IGB.js → search-bar.CpQ_MEVj.js} +3 -3
  103. package/dist/chunks/{search-bar.i7BY4IGB.js.map → search-bar.CpQ_MEVj.js.map} +1 -1
  104. package/dist/chunks/{secondary-nav.DkRQsIx7.js → secondary-nav.RTBLEukC.js} +2 -2
  105. package/dist/chunks/{secondary-nav.DkRQsIx7.js.map → secondary-nav.RTBLEukC.js.map} +1 -1
  106. package/dist/chunks/{sidepanel.CTIjklfG.js → sidepanel.DPN__L3Q.js} +2 -2
  107. package/dist/chunks/{sidepanel.CTIjklfG.js.map → sidepanel.DPN__L3Q.js.map} +1 -1
  108. package/dist/chunks/{summary-grid.types.BTr6x5cg.js → summary-grid.types.CjbbSZBJ.js} +4 -4
  109. package/dist/chunks/summary-grid.types.CjbbSZBJ.js.map +1 -0
  110. package/dist/chunks/{textarea.DXSe9MHH.js → textarea.BBhN67-I.js} +41 -40
  111. package/dist/chunks/textarea.BBhN67-I.js.map +1 -0
  112. package/dist/chunks/{timeline-item.Coz_LRD3.js → timeline-item.CuCII37W.js} +3 -3
  113. package/dist/chunks/{timeline-item.Coz_LRD3.js.map → timeline-item.CuCII37W.js.map} +1 -1
  114. package/dist/chunks/{tutorial.vue_vue_type_script_setup_true_lang.E8oBlhrC.js → tutorial.vue_vue_type_script_setup_true_lang.nYHtTHqy.js} +28 -27
  115. package/dist/chunks/{tutorial.vue_vue_type_script_setup_true_lang.E8oBlhrC.js.map → tutorial.vue_vue_type_script_setup_true_lang.nYHtTHqy.js.map} +1 -1
  116. package/dist/chunks/{use-cached-selected-values.rqtiP4Nd.js → use-cached-selected-values.Dyoz6cUK.js} +591 -571
  117. package/dist/chunks/use-cached-selected-values.Dyoz6cUK.js.map +1 -0
  118. package/dist/chunks/{use-country-items.4kZgVg_l.js → use-country-items.Duh4bMqW.js} +2 -2
  119. package/dist/chunks/{use-country-items.4kZgVg_l.js.map → use-country-items.Duh4bMqW.js.map} +1 -1
  120. package/dist/chunks/{use-country-phon-code.DVgE19zT.js → use-country-phon-code.BOaJ9PDl.js} +507 -498
  121. package/dist/chunks/{use-country-phon-code.DVgE19zT.js.map → use-country-phon-code.BOaJ9PDl.js.map} +1 -1
  122. package/dist/code-snippet.js +1 -1
  123. package/dist/country.js +2 -2
  124. package/dist/dashboard-template.js +1 -1
  125. package/dist/dashed-underline.js +1 -1
  126. package/dist/data-grid-template.js +1 -1
  127. package/dist/data-grid.js +1 -1
  128. package/dist/date-picker.js +1 -1
  129. package/dist/date-range-picker.js +1 -1
  130. package/dist/dropdown.js +4 -4
  131. package/dist/filter-bar.js +1 -1
  132. package/dist/header-with-views.js +1 -1
  133. package/dist/header.js +1 -1
  134. package/dist/index.js +157 -156
  135. package/dist/index.js.map +1 -1
  136. package/dist/input-field-password.js +1 -1
  137. package/dist/input-field-phone-number.js +1 -1
  138. package/dist/input-field.js +1 -1
  139. package/dist/internal.js +15 -14
  140. package/dist/menu.js +1 -1
  141. package/dist/modal-fullscreen.js +1 -1
  142. package/dist/modal.js +11 -11
  143. package/dist/pagination.js +1 -1
  144. package/dist/popover.js +3 -2
  145. package/dist/popover.js.map +1 -1
  146. package/dist/rich-text-editor.js +1 -1
  147. package/dist/search-bar.js +2 -2
  148. package/dist/secondary-nav.js +1 -1
  149. package/dist/sidepanel.js +1 -1
  150. package/dist/styles/bento-dark.css +10 -2
  151. package/dist/styles/bento-light.css +10 -2
  152. package/dist/styles/bento.css +10 -2
  153. package/dist/styles/legacy.css +10 -2
  154. package/dist/styles/styleguide.css +10 -2
  155. package/dist/summary-grid.js +1 -1
  156. package/dist/textarea.js +1 -1
  157. package/dist/timeline.js +1 -1
  158. package/dist/tutorial.js +1 -1
  159. package/dist/web-types.json +1 -1
  160. package/package.json +23 -6
  161. package/dist/assets/info-icon-with-popover.css +0 -1
  162. package/dist/chunks/base-modal.CCwWuH6k.js.map +0 -1
  163. package/dist/chunks/button-actions.D1pXI1AJ.js.map +0 -1
  164. package/dist/chunks/checkbox.fkPJvdUo.js.map +0 -1
  165. package/dist/chunks/data-grid.BrYCmbPR.js +0 -3779
  166. package/dist/chunks/data-grid.BrYCmbPR.js.map +0 -1
  167. package/dist/chunks/date-range-picker.-YsRuGmp.js +0 -1208
  168. package/dist/chunks/date-range-picker.-YsRuGmp.js.map +0 -1
  169. package/dist/chunks/dropdown-default-textbox.B05elQig.js.map +0 -1
  170. package/dist/chunks/dropdown-tag.BUDNO3d0.js +0 -202
  171. package/dist/chunks/dropdown-tag.BUDNO3d0.js.map +0 -1
  172. package/dist/chunks/dropdown.usAqDecC.js +0 -957
  173. package/dist/chunks/dropdown.usAqDecC.js.map +0 -1
  174. package/dist/chunks/filter-bar.BxfaFHTk.js.map +0 -1
  175. package/dist/chunks/header-with-views.COrWDbtU.js.map +0 -1
  176. package/dist/chunks/header.DAEUKoX5.js +0 -254
  177. package/dist/chunks/header.DAEUKoX5.js.map +0 -1
  178. package/dist/chunks/info-icon-with-popover.Duk1tj5G.js +0 -97
  179. package/dist/chunks/info-icon-with-popover.Duk1tj5G.js.map +0 -1
  180. package/dist/chunks/input-field-password.XrXAnMpT.js.map +0 -1
  181. package/dist/chunks/input-field.EOIwm2tq.js +0 -298
  182. package/dist/chunks/input-field.EOIwm2tq.js.map +0 -1
  183. package/dist/chunks/modal-fullscreen.CuL9oSAq.js.map +0 -1
  184. package/dist/chunks/popover.maCMPyz8.js +0 -350
  185. package/dist/chunks/popover.maCMPyz8.js.map +0 -1
  186. package/dist/chunks/summary-grid.types.BTr6x5cg.js.map +0 -1
  187. package/dist/chunks/textarea.DXSe9MHH.js.map +0 -1
  188. package/dist/chunks/use-cached-selected-values.rqtiP4Nd.js.map +0 -1
@@ -1,1208 +0,0 @@
1
- import { reactive as Ie, defineComponent as Xe, ref as M, computed as b, onMounted as Ze, toRaw as Ee, resolveComponent as O, createElementBlock as he, openBlock as C, createElementVNode as Y, createCommentVNode as U, renderSlot as Fe, createBlock as K, createVNode as j, withCtx as Q, createTextVNode as le, normalizeClass as we, toRef as Ne, watch as ke, resolveDirective as vt, withDirectives as gt, withKeys as yt, toDisplayString as Tt, createSlots as bt } from "vue";
2
- import { B as Rt } from "./divider.qUOSAbU6.js";
3
- import { B as It } from "./popover.maCMPyz8.js";
4
- import { B as xe, d as St } from "./typography.DN5eC5ch.js";
5
- import { e as N, a as Be, g as Oe } from "./get-date-locale.CAyOIbcp.js";
6
- import { g as De } from "./generate-uid.NJ8tVoha.js";
7
- import { u as Me } from "./i18n.B6g5VX0q.js";
8
- import { e as et, t as pe, g as fe, i as V, h as ue, j as Pe, k as kt, l as qe, m as Et, s as $e, n as ht, o as Le, a as X, u as wt, f as me } from "./calendar._oPk_A1C.js";
9
- import { f as Ye, v as Ot, D as k } from "./date-input.BqBdAO1E.js";
10
- import { r as A, t as Z } from "./index.BrH1t1iu.js";
11
- import { u as Mt } from "./use-form-layout-loading.D3lALhtC.js";
12
- import { B as Ct } from "./directive.Cbdox5VL.js";
13
- import "./events.FNmSWp_P.js";
14
- import { B as At } from "./input-field.EOIwm2tq.js";
15
- import { B as _t } from "./dropdown.usAqDecC.js";
16
- import { B as Ut } from "./segmented-control.5-vlm8Gt.js";
17
- import { d as Te } from "./debounce.DUTu11PS.js";
18
- import { u as Ft } from "./use-has-slot.B7eQSabc.js";
19
- import { _ as tt } from "./_plugin-vue_export-helper.CHgC5LLL.js";
20
- import { D as Nt } from "./dropdown-default-textbox.B05elQig.js";
21
- import { F as Bt, E as Pt } from "./error-message.DHMHq9bR.js";
22
- import { B as qt, c as $t } from "./button-actions.D1pXI1AJ.js";
23
- import "../assets/date-range-picker.css";
24
- function at(e, a) {
25
- A(2, arguments);
26
- var l = pe(a), u = l * 3;
27
- return et(e, u);
28
- }
29
- function Qe(e) {
30
- A(1, arguments);
31
- var a = Z(e), l = Math.floor(a.getMonth() / 3) + 1;
32
- return l;
33
- }
34
- function Ve(e) {
35
- return A(1, arguments), Z(e).getFullYear();
36
- }
37
- function be(e, a) {
38
- A(2, arguments);
39
- var l = Z(e), u = Z(a);
40
- return l.getTime() === u.getTime();
41
- }
42
- function Lt(e, a) {
43
- A(2, arguments);
44
- var l = fe(e), u = fe(a);
45
- return l.getTime() === u.getTime();
46
- }
47
- function Ke(e) {
48
- A(1, arguments);
49
- var a = Z(e);
50
- return a.setMilliseconds(0), a;
51
- }
52
- function je(e, a) {
53
- A(2, arguments);
54
- var l = Ke(e), u = Ke(a);
55
- return l.getTime() === u.getTime();
56
- }
57
- function Yt(e) {
58
- return A(1, arguments), V(e, Date.now());
59
- }
60
- function Qt(e, a) {
61
- A(2, arguments);
62
- var l = Z(e), u = pe(a);
63
- return l.setHours(u), l;
64
- }
65
- function Vt(e, a) {
66
- A(2, arguments);
67
- var l = Z(e), u = pe(a);
68
- return l.setMinutes(u), l;
69
- }
70
- function Kt(e, a) {
71
- A(2, arguments);
72
- var l = Z(e), u = pe(a);
73
- return l.setSeconds(u), l;
74
- }
75
- function jt(e, a) {
76
- A(2, arguments);
77
- var l = pe(a);
78
- return at(e, -l);
79
- }
80
- function ie(e) {
81
- if (e == null)
82
- return ue(/* @__PURE__ */ new Date());
83
- const [a, l, u] = e.split("-").map((o) => parseInt(o, 10));
84
- return new Date(a, l - 1, u);
85
- }
86
- const Gt = ({
87
- firstDayOfWeek: e,
88
- min: a,
89
- max: l
90
- }) => ({ getGranularCalendarLimits: (o) => {
91
- let c = ue(a), D = N(l);
92
- if ((o == null ? void 0 : o.type) === "weekly") {
93
- if (o.earliest)
94
- c = ue(o.earliest);
95
- else {
96
- const g = Pe(c, { weekStartsOn: e });
97
- V(c, g) || (c = ue(kt(qe(c, { weekStartsOn: e }), 1)));
98
- }
99
- if (o.latest)
100
- D = N(o.latest);
101
- else {
102
- const g = qe(D, { weekStartsOn: e });
103
- V(D, g) || (D = N(Et(Pe(D, { weekStartsOn: e }), 1)));
104
- }
105
- }
106
- if ((o == null ? void 0 : o.type) === "monthly") {
107
- if (o.earliest)
108
- c = ue(o.earliest);
109
- else {
110
- const g = $e(c);
111
- V(c, g) || (c = $e(et(c, 1)));
112
- }
113
- if (o.latest)
114
- D = N(o.latest);
115
- else {
116
- const g = Be(D);
117
- V(D, g) || (D = Be(ht(D, 1)));
118
- }
119
- }
120
- if ((o == null ? void 0 : o.type) === "quarterly") {
121
- if (o.earliest)
122
- c = fe(o.earliest);
123
- else {
124
- const g = fe(c);
125
- V(c, g) || (c = fe(at(c, 1)));
126
- }
127
- if (o.latest)
128
- D = N(o.latest);
129
- else {
130
- const g = Le(D);
131
- V(D, g) || (D = Le(jt(D, 1)));
132
- }
133
- }
134
- return { min: c, max: D };
135
- } }), Ht = () => {
136
- const e = Ie({
137
- daily: null,
138
- weekly: null,
139
- monthly: null,
140
- quarterly: null
141
- });
142
- return {
143
- savedRanges: e,
144
- saveRange: (u, o) => {
145
- e[u] = o;
146
- },
147
- resetSavedRanges: () => {
148
- e.daily = null, e.weekly = null, e.monthly = null, e.quarterly = null;
149
- }
150
- };
151
- };
152
- var y = /* @__PURE__ */ ((e) => (e.CUSTOM_RANGE = "custom-range", e.INPUT = "input", e.ERROR = "error", e.FORM_DATE = "form-date", e.START_DATE_SELECTED = "start-date-selected", e))(y || {});
153
- const Wt = /[\d]/, zt = /^\d{2}$/, Jt = /^\d{2}:\d{2}$/, Xt = (e) => {
154
- const { selectionStart: a } = e.target, l = ["Backspace", "Tab", "ArrowLeft", "ArrowRight"], u = Wt.test(e.key) || l.includes(e.key), o = [1, 2, 4, 5].includes(a) && e.key === ":";
155
- !u && !o && e.preventDefault();
156
- }, Ge = (e) => {
157
- if (!e)
158
- return e;
159
- let a = e;
160
- if (a.length === 1 && parseInt(e, 10) > 2)
161
- return `0${a}:`;
162
- const [l, u] = a.slice(-2);
163
- return [2, 5].includes(a.length) && u === ":" && (a = `${a.slice(0, a.length - 2)}0${l}`), (zt.test(a) || Jt.test(a)) && (a += ":"), a;
164
- }, He = {
165
- "en-US": {
166
- customRange: "Custom range",
167
- daily: "Daily",
168
- dateFrom: "Date from",
169
- dateTo: "Date to",
170
- lastMonth: "Last month",
171
- lastSevenDays: "Last 7 days",
172
- lastThreeMonths: "Last three months",
173
- monthly: "Monthly",
174
- quarterly: "Quarterly",
175
- timeFrom: "Time from",
176
- timeTo: "Time to",
177
- weekly: "Weekly"
178
- },
179
- "ja-JP": {
180
- customRange: "カスタム範囲を選択",
181
- daily: "毎日",
182
- lastMonth: "先月",
183
- lastSevenDays: "過去7日間",
184
- monthly: "毎月",
185
- weekly: "毎週"
186
- },
187
- "pt-BR": {
188
- customRange: "Selecione um intervalo personalizado",
189
- daily: "Diário",
190
- lastMonth: "Último mês",
191
- lastSevenDays: "Últimos 7 dias",
192
- monthly: "Mensal",
193
- weekly: "Semanal"
194
- }
195
- }, We = 300, ze = "customRange", Zt = Xe({
196
- i18n: { messages: He },
197
- name: "date-range-picker-calendar",
198
- components: {
199
- BentoDropdown: _t,
200
- BentoInputField: At,
201
- BentoSegmentedControl: Ut,
202
- BentoTypography: xe,
203
- Calendar: X
204
- },
205
- props: {
206
- /**
207
- * Allows user to enter time values in the form
208
- */
209
- allowTimeInput: { type: Boolean, default: !1 },
210
- /**
211
- * Ranges form persistance data
212
- */
213
- dateFormData: {
214
- type: Object,
215
- default: () => ({ startDate: void 0, endDate: void 0, startTime: void 0, endTime: void 0 })
216
- },
217
- /**
218
- * Allows you to set the first day of the week. 0 is sunday, 1 is monday, 6 is saturday
219
- */
220
- firstDayOfWeek: X.props.firstDayOfWeek,
221
- /**
222
- * A list of available granularities.
223
- * If present, the date picker will display a segmented control to change granularity.
224
- */
225
- granularities: {
226
- type: Array,
227
- default: null
228
- },
229
- /**
230
- * Indicate if a date should be disabled or not
231
- */
232
- isDateDisabled: X.props.isDateDisabled,
233
- /**
234
- * Set a maximum number of dates to be selectable by the range.
235
- */
236
- maxRange: X.props.maxRange,
237
- /**
238
- * Sets a minimum limit for selectable dates - dates before `min` will not be selectable
239
- */
240
- min: X.props.min,
241
- /**
242
- * Sets a maximum limit for selectable dates - dates after `max` will not be selectable
243
- */
244
- max: X.props.max,
245
- /**
246
- * Number of months rendered on pane
247
- */
248
- numberOfMonths: X.props.numberOfMonths,
249
- /**
250
- * Displays the end date's month when the calendar is opened. Defaults to false i.e. the start date's month is displayed.
251
- */
252
- showEndDateOnOpen: { type: Boolean, default: !1 },
253
- /**
254
- * Enables the custom range selector.
255
- * If provided, must be an array that sets the custom range dropdown items. Items are of the structure:
256
- * `label` - label of custom range item.
257
- * `value` - a unique key of the custom range item.
258
- * `data` - an object `{ startDate: Date; endDate: Date }` to set the date picker range to upon selecting.
259
- */
260
- quickSelectRanges: {
261
- type: Array,
262
- default: void 0
263
- },
264
- /**
265
- * Selected date
266
- */
267
- value: { type: Object, default: void 0 },
268
- /**
269
- * The type of calendar to display. Defaults to showing days.
270
- */
271
- variant: X.props.variant
272
- },
273
- emits: [
274
- y.CUSTOM_RANGE,
275
- y.INPUT,
276
- y.ERROR,
277
- y.FORM_DATE,
278
- y.START_DATE_SELECTED
279
- ],
280
- setup(e, { emit: a, slots: l }) {
281
- var Ce, Ae, _e, Ue;
282
- const { locale: u, t: o } = Me({ messages: He }), c = Oe(), D = M({}), g = b(() => e.variant === "month" ? "monthly" : "daily"), n = Ie({
283
- startDate: (Ce = e.value) == null ? void 0 : Ce.startDate,
284
- endDate: (Ae = e.value) == null ? void 0 : Ae.endDate,
285
- range: (_e = e.value) == null ? void 0 : _e.range,
286
- ...e.granularities ? {
287
- granularity: ((Ue = e.value) == null ? void 0 : Ue.granularity) || g.value
288
- } : {}
289
- });
290
- function f(t) {
291
- return t ? new Date(
292
- t.getUTCFullYear(),
293
- t.getUTCMonth(),
294
- t.getUTCDate(),
295
- t.getUTCHours(),
296
- t.getUTCMinutes(),
297
- t.getUTCSeconds()
298
- ) : null;
299
- }
300
- const E = b(() => {
301
- var t, s;
302
- return (
303
- // eslint-disable-next-line consistent-return
304
- ((s = (t = e == null ? void 0 : e.quickSelectRanges) == null ? void 0 : t.find(({ value: i, data: d }) => {
305
- var I;
306
- if (!d.endDate) {
307
- if (d.isRelativeToNow) {
308
- const w = (I = D.value) == null ? void 0 : I[i];
309
- return w ? be(
310
- f(w.startDate),
311
- f(n.startDate)
312
- ) && be(
313
- f(w.endDate),
314
- f(n.endDate)
315
- ) : (
316
- // If not stored calculated dates, fall back to comparing the quick select item's value
317
- // with the internal range's stored range identifier.
318
- i === n.range
319
- );
320
- }
321
- return be(
322
- f(d.startDate),
323
- f(n.startDate)
324
- ) && be(
325
- f(n.endDate),
326
- f(N(n.endDate))
327
- ) && Yt(f(n.endDate));
328
- }
329
- if (e.allowTimeInput)
330
- return je(
331
- f(d.startDate),
332
- f(n.startDate)
333
- ) && je(f(d.endDate), f(n.endDate));
334
- if (d.endDate)
335
- return V(d.startDate, n.startDate) && V(d.endDate, n.endDate);
336
- })) == null ? void 0 : s.value) ?? ze
337
- );
338
- }), x = b(() => ({
339
- "b-date-range-picker-calendar__form-input-wrapper": e.allowTimeInput
340
- })), T = b(() => [
341
- { label: o("customRange"), value: ze },
342
- ...e.quickSelectRanges ? e.quickSelectRanges : []
343
- ]), _ = b(
344
- () => {
345
- var t;
346
- return ((t = e.granularities) == null ? void 0 : t.find(({ type: s }) => s === n.granularity)) || null;
347
- }
348
- ), S = b(
349
- () => {
350
- var t;
351
- return ((t = e.granularities) == null ? void 0 : t.map(({ type: s, disabled: i }) => ({
352
- label: o(s),
353
- value: s,
354
- disabled: i
355
- }))) ?? [];
356
- }
357
- ), { getGranularCalendarLimits: G } = Gt(e), p = b(
358
- () => e.granularities ? G(_.value) : { min: ue(e.min), max: N(e.max) }
359
- ), {
360
- adjustDateForQuarterly: ee,
361
- adjustDateForMonthly: de,
362
- adjustDateForWeekly: B,
363
- adjustStartDateInputForWeekly: v,
364
- adjustEndDateInputForWeekly: P,
365
- adjustStartDateInputForMonthly: q,
366
- adjustEndDateInputForMonthly: te,
367
- adjustStartDateInputForQuarterly: Se,
368
- adjustEndDateInputForQuarterly: ve
369
- } = wt(e.firstDayOfWeek), { savedRanges: $, saveRange: H, resetSavedRanges: ae } = Ht(), h = (t) => t ? me(t, k.NUMERIC_DATE_YEAR_FIRST, {
370
- locale: c[u.value.substring(0, 2)] || c.enUS
371
- }) : "", W = (t) => t ? me(t, k.HOUR_MINUTE_SECONDS, {
372
- locale: c[u.value.substring(0, 2)] || c.enUS
373
- }) : "", z = M(!1), ne = M(!1), re = M(!1), oe = M(!1), r = Ie({
374
- startDate: e.dateFormData.startDate,
375
- endDate: e.dateFormData.endDate,
376
- startTime: e.dateFormData.startTime,
377
- endTime: e.dateFormData.endTime
378
- }), ge = (t) => /^(?:[01]\d|2[01234]):(?:[012345]\d):(?:[012345]\d)$/.test(t), F = (t, s) => {
379
- if (!s || !ge(s) || e.variant === "month")
380
- return t;
381
- let i = new Date(t);
382
- const [d, I, w] = s.split(":");
383
- return i = Qt(i, parseInt(d, 10)), i = Vt(i, parseInt(I, 10)), i = Kt(i, parseInt(w, 10)), i;
384
- }, m = (t) => {
385
- r.startTime = W(ue(t.startDate)), r.endTime = W(N(t.endDate)), n.startDate = F(t.startDate, r.startTime), n.endDate = F(t.endDate, r.endTime), n.range = null, e.granularities && ae(), a(y.INPUT, {
386
- ...n,
387
- range: E.value
388
- });
389
- }, R = (t) => {
390
- const s = (d) => e.min && d <= e.min || e.max && d >= e.max ? !1 : e.isDateDisabled ? !e.isDateDisabled(d) : !0;
391
- return /^\d{4}-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])$/.test(t) && s(new Date(t));
392
- };
393
- Ze(() => {
394
- e.dateFormData.startDate && !R(e.dateFormData.startDate) ? z.value = !0 : (z.value = !1, re.value = !1), e.dateFormData.endDate && !R(e.dateFormData.endDate) ? ne.value = !0 : (ne.value = !1, oe.value = !1);
395
- });
396
- const se = (t) => {
397
- var s;
398
- r.startDate = h(t), r.startTime ? re.value && (r.startTime = (s = e.dateFormData) == null ? void 0 : s.startTime) : r.startTime = W(t), z.value = !1, re.value = !1, a(y.START_DATE_SELECTED, t);
399
- }, J = (t) => {
400
- var s;
401
- r.endDate = h(t), r.endTime ? oe.value && (r.endTime = (s = e.dateFormData) == null ? void 0 : s.endTime) : r.endTime = W(N(t)), ne.value = !1, oe.value = !1;
402
- }, ce = (t) => {
403
- const s = e.value[t];
404
- if (s)
405
- return s;
406
- if (e.dateFormData[t] && R(e.dateFormData[t]))
407
- return new Date(e.dateFormData[t]);
408
- }, nt = Te((t) => {
409
- var s;
410
- if (R(t)) {
411
- let i = t;
412
- switch (z.value = !1, (s = _.value) == null ? void 0 : s.type) {
413
- case "weekly":
414
- i = v(
415
- t,
416
- h,
417
- p.value.min,
418
- p.value.max
419
- ), r.startDate = i;
420
- break;
421
- case "monthly":
422
- i = q(
423
- t,
424
- h,
425
- p.value.min,
426
- p.value.max
427
- ), r.startDate = i;
428
- break;
429
- case "quarterly":
430
- i = Se(
431
- t,
432
- h,
433
- p.value.min,
434
- p.value.max
435
- ), r.startDate = i;
436
- break;
437
- }
438
- const d = ie(i);
439
- n.startDate = F(d, r.startTime), n.endDate = F(
440
- ie(r.endDate),
441
- r.endTime
442
- ), R(r.endDate) && (n.endDate = F(
443
- ie(r.endDate),
444
- r.endTime
445
- ));
446
- const I = ce("endDate");
447
- n.range = null, a(y.FORM_DATE, {
448
- startDate: d,
449
- endDate: I
450
- }), a(y.INPUT, {
451
- ...n,
452
- range: E.value
453
- });
454
- } else
455
- z.value = !0, a(y.ERROR, { ...r });
456
- }, We), rt = (t) => {
457
- r.startDate = Ye(t), nt(r.startDate);
458
- }, ot = Te((t) => {
459
- var s;
460
- if (R(t)) {
461
- let i = t;
462
- switch (ne.value = !1, (s = _.value) == null ? void 0 : s.type) {
463
- case "weekly":
464
- i = P(
465
- t,
466
- h,
467
- p.value.min,
468
- p.value.max
469
- ), r.endDate = i;
470
- break;
471
- case "monthly":
472
- i = te(
473
- t,
474
- h,
475
- p.value.min,
476
- p.value.max
477
- ), r.endDate = i;
478
- break;
479
- case "quarterly":
480
- i = ve(
481
- t,
482
- h,
483
- p.value.min,
484
- p.value.max
485
- ), r.endDate = i;
486
- break;
487
- }
488
- const d = ie(i);
489
- n.endDate = F(d, r.endTime), R(r.startDate) && (n.startDate = F(
490
- ie(r.startDate),
491
- r.startTime
492
- ));
493
- const I = ce("startDate");
494
- n.range = null, a(y.FORM_DATE, {
495
- startDate: I,
496
- endDate: d
497
- }), a(y.INPUT, {
498
- ...n,
499
- range: E.value
500
- });
501
- } else
502
- ne.value = !0, a(y.ERROR, { ...r });
503
- }, We), st = (t) => {
504
- r.endDate = Ye(t), ot(r.endDate);
505
- }, lt = (t) => {
506
- Ot(t);
507
- }, it = Te((t) => {
508
- if (ge(t)) {
509
- re.value = !1, n.startDate = F(n.startDate, t);
510
- const s = ce("endDate");
511
- a(y.FORM_DATE, {
512
- startDate: n.startDate,
513
- endDate: s,
514
- startTime: t,
515
- endTime: r.endTime ?? e.dateFormData.endTime
516
- }), a(y.INPUT, {
517
- ...n,
518
- range: E.value
519
- });
520
- } else
521
- re.value = !0, a(y.ERROR, { ...r });
522
- }), ut = Te((t) => {
523
- ge(t) ? (oe.value = !1, n.endDate = F(n.endDate, t), a(y.FORM_DATE, {
524
- startDate: n.startDate,
525
- endDate: n.endDate,
526
- startTime: r.startTime ?? e.dateFormData.startTime,
527
- endTime: t
528
- }), a(y.INPUT, {
529
- ...n,
530
- range: E.value
531
- })) : (oe.value = !0, a(y.ERROR, { ...r }));
532
- }), dt = (t) => {
533
- r.startTime = Ge(t), it(r.startTime);
534
- }, mt = (t) => {
535
- r.endTime = Ge(t), ut(r.endTime);
536
- }, ct = (t) => {
537
- Xt(t);
538
- }, ye = (t, s, i, d) => {
539
- n.startDate = t, n.endDate = s, i && (n.granularity = i), d && (n.range = d);
540
- }, Dt = (t) => {
541
- var i;
542
- const s = (i = e.quickSelectRanges) == null ? void 0 : i.find(({ value: d }) => d === t);
543
- if (s) {
544
- ae();
545
- const d = s.data, I = d.endDate || (d.isRelativeToNow ? new Date(Date.now()) : N(new Date(Date.now()))), w = d.isRelativeToNow && d.timeDifference ? new Date(I.getTime() - d.timeDifference) : d.startDate;
546
- r.endDate = h(I), r.startDate = h(w), ye(w, I, null, t), e.granularities && (n.granularity = d.granularity || g.value), r.startTime = W(w), r.endTime = W(I), n.startDate = w, n.endDate = I, d.isRelativeToNow && (D.value = {
547
- ...D.value,
548
- [t]: {
549
- startDate: w,
550
- endDate: I
551
- }
552
- }), a(y.CUSTOM_RANGE, {
553
- ...s.data,
554
- startDate: w,
555
- endDate: I,
556
- range: s.value
557
- });
558
- }
559
- }, ft = {
560
- weekly: B,
561
- monthly: de,
562
- quarterly: ee
563
- }, pt = (t) => {
564
- const s = n.granularity;
565
- if (n.granularity = t, s && H(s, structuredClone(Ee(n))), n.startDate && n.endDate) {
566
- switch (t) {
567
- case "quarterly":
568
- case "monthly":
569
- case "weekly": {
570
- if ($[t]) {
571
- ye($[t].startDate, $[t].endDate, t);
572
- break;
573
- }
574
- const { startDate: i, endDate: d } = ft[t](
575
- n.startDate,
576
- n.endDate,
577
- p.value.min,
578
- p.value.max
579
- );
580
- ye(i, d, t);
581
- break;
582
- }
583
- case "daily":
584
- $.daily && ye($.daily.startDate, $.daily.endDate, t);
585
- break;
586
- }
587
- r.startDate = h(n.startDate), r.endDate = h(n.endDate), a(y.INPUT, {
588
- ...n,
589
- range: E.value
590
- });
591
- }
592
- };
593
- return {
594
- // Values
595
- internalRangeDate: n,
596
- dateTextInput: r,
597
- endDateError: ne,
598
- endTimeError: oe,
599
- granularityItems: S,
600
- selectedGranularity: _,
601
- computedMinMax: p,
602
- selectedRangeSelectorValue: E,
603
- startDateError: z,
604
- startTimeError: re,
605
- quickSelectRangeDefaultItems: T,
606
- formInputWrapperConditionalClasses: x,
607
- // Methods
608
- hasSlot: Ft(l),
609
- t: o,
610
- // Events
611
- onDateInput: m,
612
- onDateInputKeyDown: lt,
613
- onEndDateInput: st,
614
- onEndDateSelected: J,
615
- onEndTimeInput: mt,
616
- onGranularityInput: pt,
617
- onRangeSelectorInput: Dt,
618
- onStartDateInput: rt,
619
- onStartDateSelected: se,
620
- onStartTimeInput: dt,
621
- onTimeInputKeyDown: ct
622
- };
623
- }
624
- }), xt = { class: "b-date-range-picker-calendar" }, ea = { class: "b-date-range-picker-calendar__form-container" }, ta = { class: "b-date-range-picker-calendar__form" }, aa = { key: 0 }, na = { class: "b-date-range-picker-calendar__calendars-container" };
625
- function ra(e, a, l, u, o, c) {
626
- const D = O("bento-dropdown"), g = O("bento-segmented-control"), n = O("bento-typography"), f = O("bento-input-field"), E = O("calendar");
627
- return C(), he("div", xt, [
628
- Y("div", ea, [
629
- Y("div", ta, [
630
- e.hasSlot("title") ? Fe(e.$slots, "title", { key: 0 }, void 0, !0) : U("", !0),
631
- e.quickSelectRanges ? (C(), K(D, {
632
- key: 1,
633
- "aria-label": e.t("customRange"),
634
- items: e.quickSelectRangeDefaultItems,
635
- value: e.selectedRangeSelectorValue,
636
- onInput: e.onRangeSelectorInput
637
- }, null, 8, ["aria-label", "items", "value", "onInput"])) : U("", !0),
638
- e.granularities ? (C(), K(g, {
639
- key: 2,
640
- items: e.granularityItems,
641
- "model-value": e.internalRangeDate.granularity,
642
- "full-width": "",
643
- "onUpdate:modelValue": e.onGranularityInput
644
- }, null, 8, ["items", "model-value", "onUpdate:modelValue"])) : U("", !0),
645
- Y("div", null, [
646
- j(n, {
647
- stronger: "",
648
- el: "span",
649
- class: "b-date-range-picker-calendar__label"
650
- }, {
651
- default: Q(() => a[0] || (a[0] = [
652
- le(" From ")
653
- ])),
654
- _: 1
655
- }),
656
- Y("div", {
657
- class: we(e.formInputWrapperConditionalClasses)
658
- }, [
659
- j(f, {
660
- "aria-label": e.t("dateFrom"),
661
- value: e.dateTextInput.startDate,
662
- error: e.startDateError,
663
- class: "b-date-range-picker-calendar__form-input",
664
- onInput: e.onStartDateInput,
665
- onKeydown: e.onDateInputKeyDown
666
- }, {
667
- description: Q(() => a[1] || (a[1] = [
668
- le("YYYY-MM-DD")
669
- ])),
670
- _: 1
671
- }, 8, ["aria-label", "value", "error", "onInput", "onKeydown"]),
672
- e.allowTimeInput ? (C(), K(f, {
673
- key: 0,
674
- "aria-label": e.t("timeFrom"),
675
- value: e.dateTextInput.startTime,
676
- error: e.startTimeError,
677
- class: "b-date-range-picker-calendar__form-input",
678
- onInput: e.onStartTimeInput,
679
- onKeydown: e.onTimeInputKeyDown
680
- }, {
681
- description: Q(() => a[2] || (a[2] = [
682
- le("HH:MM:SS")
683
- ])),
684
- _: 1
685
- }, 8, ["aria-label", "value", "error", "onInput", "onKeydown"])) : U("", !0)
686
- ], 2)
687
- ]),
688
- Y("div", null, [
689
- j(n, {
690
- stronger: "",
691
- el: "span",
692
- class: "b-date-range-picker-calendar__label"
693
- }, {
694
- default: Q(() => a[3] || (a[3] = [
695
- le(" To ")
696
- ])),
697
- _: 1
698
- }),
699
- Y("div", {
700
- class: we(e.formInputWrapperConditionalClasses)
701
- }, [
702
- j(f, {
703
- class: "b-date-range-picker-calendar__form-input",
704
- "aria-label": e.t("dateTo"),
705
- value: e.dateTextInput.endDate,
706
- error: e.endDateError,
707
- onInput: e.onEndDateInput,
708
- onKeydown: e.onDateInputKeyDown
709
- }, {
710
- description: Q(() => a[4] || (a[4] = [
711
- le("YYYY-MM-DD")
712
- ])),
713
- _: 1
714
- }, 8, ["aria-label", "value", "error", "onInput", "onKeydown"]),
715
- e.allowTimeInput ? (C(), K(f, {
716
- key: 0,
717
- "aria-label": e.t("timeTo"),
718
- value: e.dateTextInput.endTime,
719
- error: e.endTimeError,
720
- class: "b-date-range-picker-calendar__form-input",
721
- onInput: e.onEndTimeInput,
722
- onKeydown: e.onTimeInputKeyDown
723
- }, {
724
- description: Q(() => a[5] || (a[5] = [
725
- le("HH:MM:SS")
726
- ])),
727
- _: 1
728
- }, 8, ["aria-label", "value", "error", "onInput", "onKeydown"])) : U("", !0)
729
- ], 2)
730
- ])
731
- ]),
732
- e.hasSlot("actions") ? (C(), he("div", aa, [
733
- Fe(e.$slots, "actions", {}, void 0, !0)
734
- ])) : U("", !0)
735
- ]),
736
- Y("div", na, [
737
- j(E, {
738
- value: e.internalRangeDate,
739
- "first-day-of-week": e.firstDayOfWeek,
740
- "is-date-disabled": e.isDateDisabled,
741
- "max-range": e.maxRange,
742
- min: e.computedMinMax.min,
743
- max: e.computedMinMax.max,
744
- "number-of-months": e.numberOfMonths,
745
- "show-end-date-on-open": e.showEndDateOnOpen,
746
- granularity: e.selectedGranularity,
747
- variant: e.variant,
748
- "is-range": "",
749
- onInput: e.onDateInput,
750
- onStartDateSelected: e.onStartDateSelected,
751
- onEndDateSelected: e.onEndDateSelected
752
- }, null, 8, ["value", "first-day-of-week", "is-date-disabled", "max-range", "min", "max", "number-of-months", "show-end-date-on-open", "granularity", "variant", "onInput", "onStartDateSelected", "onEndDateSelected"])
753
- ])
754
- ]);
755
- }
756
- const L = /* @__PURE__ */ tt(Zt, [["render", ra], ["__scopeId", "data-v-99695675"]]), oa = ({
757
- datePickerValue: e,
758
- isDateIncorrect: a,
759
- quickSelectRanges: l,
760
- isMonthVariant: u
761
- }) => {
762
- var T, _, S, G;
763
- const { locale: o, t: c } = Me(), D = Oe(), g = (p) => !!p && !isNaN(p.getTime()), n = (p, ee) => g(p) ? me(p, ee, {
764
- locale: D[o.value.substring(0, 2)] || D.enUS
765
- }) : void 0, f = Ie({
766
- startDate: n((T = e.value) == null ? void 0 : T.startDate, k.NUMERIC_DATE_YEAR_FIRST),
767
- endDate: n((_ = e.value) == null ? void 0 : _.endDate, k.NUMERIC_DATE_YEAR_FIRST),
768
- startTime: n((S = e.value) == null ? void 0 : S.startDate, k.HOUR_MINUTE_SECONDS),
769
- endTime: n((G = e.value) == null ? void 0 : G.endDate, k.HOUR_MINUTE_SECONDS)
770
- });
771
- return {
772
- // Values
773
- dateDisplayValue: b(() => {
774
- var B;
775
- if (a.value)
776
- return `${f.startDate || ""} - ${f.endDate || ""}`;
777
- if (!e.value || !e.value.startDate && !e.value.endDate)
778
- return c("selectDateRange");
779
- if ((B = l.value) != null && B.length) {
780
- const v = l.value.find(({ value: P }) => {
781
- var q;
782
- return P === ((q = e.value) == null ? void 0 : q.range);
783
- });
784
- if (v)
785
- return v.label;
786
- }
787
- if (e.value.granularity === "quarterly") {
788
- const { startDate: v, endDate: P } = e.value, q = c("quarter", { quarter: Qe(v), year: Ve(v) });
789
- if (Lt(v, P))
790
- return q;
791
- const te = c("quarter", { quarter: Qe(P), year: Ve(P) });
792
- return `${q} - ${te}`;
793
- }
794
- const { startDate: p, endDate: ee } = f, de = u != null && u.value ? k.LONG_MONTH_YEAR : k.FULL_DATE_MONTH_FIRST;
795
- return `${n(ie(p), de)} - ${n(
796
- ie(ee),
797
- de
798
- )}`;
799
- }),
800
- textInputDisplayValue: f,
801
- // Methods
802
- formatTextInputDisplayValue: () => ""
803
- };
804
- };
805
- var Re = /* @__PURE__ */ ((e) => (e.INPUT = "input", e))(Re || {});
806
- const Je = {
807
- "en-US": {
808
- apply: "Apply",
809
- cancel: "Cancel",
810
- dateRangePicker: "Date range picker {name}",
811
- provideDateInAFormat: "Provide date in a YYYY-MM-DD format",
812
- quarter: "Q{quarter} {year}",
813
- selectDate: "Select a date",
814
- selectDateRange: "Select a date range",
815
- selectedDateIsNotAvailable: "Selected date is not available"
816
- },
817
- "ja-JP": {
818
- apply: "適用",
819
- cancel: "キャンセル",
820
- selectDate: "日付を選択"
821
- },
822
- "pt-BR": {
823
- apply: "Aplicar",
824
- cancel: "Cancelar",
825
- selectDate: "Selecione uma data"
826
- }
827
- }, sa = Xe({
828
- i18n: { messages: Je },
829
- name: "bento-date-range-picker",
830
- components: {
831
- BentoButtonActions: qt,
832
- BentoDivider: Rt,
833
- BentoTypography: xe,
834
- BentoPopover: It,
835
- DateRangePickerCalendar: L,
836
- DropdownInputDefault: Nt,
837
- ErrorMessage: Pt,
838
- FieldLabel: Bt
839
- },
840
- directives: { BentoClickOutsideDirective: Ct },
841
- props: {
842
- /**
843
- * Allows user to enter time values in the form
844
- */
845
- allowTimeInput: { type: Boolean, default: !1 },
846
- /**
847
- * Descriptive supporting text visbile underneath the dropdown.
848
- */
849
- description: { type: String, default: void 0 },
850
- /**
851
- * Disables dropdown functionality.
852
- */
853
- disabled: { type: Boolean, default: !1 },
854
- /**
855
- * Displays component in an error state with an error message
856
- */
857
- errorMessage: { type: String, default: null },
858
- /**
859
- * Allows user to set the first day of the week. 0 is sunday, 1 is monday, 6 is saturday
860
- */
861
- firstDayOfWeek: L.props.firstDayOfWeek,
862
- /**
863
- * A list of available granularities.
864
- * If present, the date picker will display a segmented control to change granularity.
865
- */
866
- granularities: L.props.granularities,
867
- /**
868
- * Indicate if a date should be disabled or not
869
- */
870
- isDateDisabled: L.props.isDateDisabled,
871
- /**
872
- * Text that is displayed as a label above the element.
873
- */
874
- label: { type: String, default: void 0 },
875
- /**
876
- * Upon opening date range picker, end date's month will be pre-selected.
877
- */
878
- showEndDateOnOpen: { type: Boolean, default: !1 },
879
- /**
880
- * Highlights the dropdown is optional.
881
- */
882
- optional: { type: Boolean, default: !1 },
883
- /**
884
- * The Boolean readonly property, when present, makes the element not mutable, meaning the user can not edit the date range picker.
885
- */
886
- readonly: { type: Boolean, default: !1 },
887
- /**
888
- * Highlights the dropdown is required.
889
- */
890
- required: { type: Boolean, default: !1 },
891
- /**
892
- * Adds a info icon next to the label to display the passed tooltip message.
893
- */
894
- tooltipText: { type: String, default: null },
895
- /**
896
- * Enables the range selector.
897
- * If provided, must be an array that sets the custom range dropdown items. Items are of the structure:
898
- * `label` - label of custom range item.
899
- * `value` - a unique key of the custom range item.
900
- * `data` - an object `{ startDate: Date; endDate: Date }` to set the date picker range to upon selecting.
901
- */
902
- quickSelectRanges: {
903
- type: Array,
904
- default: void 0
905
- },
906
- /**
907
- * Set a maximum number of dates to be selectable by the range.
908
- */
909
- maxRange: L.props.maxRange,
910
- /**
911
- * Sets a minimum limit for selectable dates - dates before `min` will not be selectable
912
- */
913
- min: L.props.min,
914
- /**
915
- * Sets a maximum limit for selectable dates - dates after `max` will not be selectable
916
- */
917
- max: L.props.max,
918
- /**
919
- * Number of months rendered on pane
920
- */
921
- numberOfMonths: L.props.numberOfMonths,
922
- /**
923
- * Selected date
924
- */
925
- value: L.props.value,
926
- /**
927
- * The type of calendar to display. Defaults to showing days.
928
- */
929
- variant: {
930
- type: String,
931
- default: void 0
932
- // Default will be set by @/internal/calendar
933
- },
934
- /**
935
- * Enables the date picker selection to persist until it is explicitly applied.
936
- * Displays a set of buttons: Apply and Cancel.
937
- *
938
- * @deprecated This will be the default behaviour in v2.0.0.
939
- */
940
- hasActions: { type: Boolean, default: !1 }
941
- },
942
- emits: [Re.INPUT],
943
- setup(e, { emit: a }) {
944
- const { locale: l, t: u } = Me({ messages: Je }), o = Oe(), c = De("bento-date-range-picker-container"), D = De("bento-date-range-picker-label"), g = De("bento-date-range-picker-description"), n = De("bento-date-range-picker-error"), f = De("bento-date-range-picker-date-error"), E = b(
945
- () => e.label || u("dateRangePicker", { name: c })
946
- ), x = b(() => (e == null ? void 0 : e.quickSelectRanges) && e.quickSelectRanges.map((m) => {
947
- const R = m.data.endDate ? void 0 : new Date(Date.now()).getTime() - m.data.startDate.getTime();
948
- return {
949
- ...m,
950
- data: {
951
- ...m.data,
952
- // Adding timeDifference to calculate an up-to-date endDate on range selection
953
- timeDifference: R
954
- }
955
- };
956
- })), T = M(!1), _ = M(null), S = M(!1), { isReadOnly: G } = Mt(Ne(e, "readonly"));
957
- ke(
958
- () => e.disabled,
959
- () => {
960
- e.disabled && S.value && (S.value = !1);
961
- }
962
- );
963
- const p = b(() => e.hasActions ? !ae.value && T.value : T.value), ee = b(() => ({
964
- "b-date-range-picker__description--error": !!e.errorMessage || p.value
965
- })), de = b(() => e.variant === "month"), { dateDisplayValue: B, textInputDisplayValue: v } = oa({
966
- datePickerValue: Ne(e, "value"),
967
- isDateIncorrect: T,
968
- quickSelectRanges: x,
969
- isMonthVariant: de
970
- }), P = b(
971
- () => `${e.description ? g : ""} ${e.errorMessage ? n : ""} ${T.value ? f : ""}`.trim() || null
972
- ), q = b(() => e.allowTimeInput && e.variant !== "month"), te = () => {
973
- S.value = !1;
974
- }, Se = () => {
975
- S.value = !0;
976
- }, ve = M(B.value), $ = M(
977
- // textInputDisplayValue is a reactive object
978
- structuredClone(Ee(v))
979
- ), H = M(e.value), ae = M(!0), h = b(
980
- () => e.hasActions ? $.value : v
981
- ), W = b(
982
- () => e.hasActions ? ve.value : B.value
983
- );
984
- Ze(() => {
985
- if (e.hasActions || St(
986
- 'BentoDateRangePicker "hasActions" property',
987
- `Set the BentoDateRangePicker "hasActions" property true which will display the "Apply" and "Cancel" buttons.
988
- This will be the default behavior in the v2 and "hasActions" will be removed.`,
989
- "2.0.0"
990
- ), e.granularities && e.variant !== "month" && e.granularities.find(({ type: m }) => m === "quarterly"))
991
- throw new Error(
992
- 'Quarterly granularity is only supported by BentoDateRangePicker with variant: "month"'
993
- );
994
- }), ke(
995
- () => e.value,
996
- () => {
997
- ve.value = B.value, $.value = structuredClone(Ee(v));
998
- }
999
- );
1000
- const z = b(() => [
1001
- {
1002
- title: u("apply"),
1003
- event: () => {
1004
- a(Re.INPUT, H.value), te(), ae.value = !0;
1005
- },
1006
- disabled: ae.value
1007
- },
1008
- {
1009
- title: u("cancel"),
1010
- event: te
1011
- }
1012
- ]);
1013
- return ke(H, (m) => {
1014
- if (e.hasActions) {
1015
- ae.value = T.value;
1016
- return;
1017
- }
1018
- a(Re.INPUT, m);
1019
- }), {
1020
- // Refs
1021
- inputContainerRef: _,
1022
- // Values,
1023
- adjustedQuickSelectRanges: x,
1024
- dateDisplayValue: B,
1025
- datePickerContainerId: c,
1026
- descriptionConditionalClasses: ee,
1027
- displayedTextInputValue: h,
1028
- displayedDateValue: W,
1029
- isDateIncorrect: T,
1030
- isDateRangePickerOpen: S,
1031
- isReadOnly: G,
1032
- labelId: D,
1033
- descriptionId: g,
1034
- dateErrorId: f,
1035
- errorId: n,
1036
- popoverAriaLabel: E,
1037
- shouldDisplayError: p,
1038
- ariaDescribedBy: P,
1039
- textInputDisplayValue: v,
1040
- rangePickerButtonActions: z,
1041
- BentoButtonActionsLayout: $t,
1042
- withTimeInput: q,
1043
- // Events
1044
- closeDateRangePicker: te,
1045
- clearDateRangePickerValue: async () => {
1046
- T.value && (T.value = !1), H.value = null;
1047
- },
1048
- openDateRangePicker: Se,
1049
- onRangeSelectorInput: (m) => {
1050
- if (m) {
1051
- const R = (J, ce) => J ? me(J, ce, {
1052
- locale: o[l.value.substring(0, 2)] || o.enUS
1053
- }) : void 0, se = (J) => me(J, k.NUMERIC_DATE_YEAR_FIRST, {
1054
- locale: o[l.value.substring(0, 2)] || o.enUS
1055
- });
1056
- v.startDate = se(m.startDate), v.endDate = se(m.endDate), v.startTime = R(
1057
- m.startDate,
1058
- k.HOUR_MINUTE_SECONDS
1059
- ), v.endTime = R(
1060
- m.endDate,
1061
- k.HOUR_MINUTE_SECONDS
1062
- ), H.value = m;
1063
- }
1064
- },
1065
- onEnterPressedOverInput: () => {
1066
- if (!S.value) {
1067
- S.value = !0;
1068
- return;
1069
- }
1070
- T.value || (S.value = !1);
1071
- },
1072
- onDateRangePickerInput: (m) => {
1073
- T.value = !1;
1074
- const R = (se, J) => se ? me(se, J, {
1075
- locale: o[l.value.substring(0, 2)] || o.enUS
1076
- }) : void 0;
1077
- v.startDate = R(
1078
- m.startDate,
1079
- k.NUMERIC_DATE_YEAR_FIRST
1080
- ), v.endDate = R(m.endDate, k.NUMERIC_DATE_YEAR_FIRST), v.startTime = R(m.startDate, k.HOUR_MINUTE_SECONDS), v.endTime = R(m.endDate, k.HOUR_MINUTE_SECONDS), H.value = m;
1081
- },
1082
- onDateRangePickerError: (m) => {
1083
- T.value = !0, v.startDate = m.startDate, v.endDate = m.endDate, H.value = { startDate: null, endDate: null };
1084
- },
1085
- onDateRangePickerFormDateInputUpdate: (m) => {
1086
- T.value = !1, m.startTime && (v.startTime = m.startTime), m.endTime && (v.endTime = m.endTime);
1087
- },
1088
- // Translations
1089
- t: u
1090
- };
1091
- }
1092
- }), la = { class: "b-date-range-picker" }, ia = { class: "b-date-range-picker__footer" };
1093
- function ua(e, a, l, u, o, c) {
1094
- const D = O("field-label"), g = O("dropdown-input-default"), n = O("error-message"), f = O("bento-typography"), E = O("bento-divider"), x = O("bento-button-actions"), T = O("date-range-picker-calendar"), _ = O("bento-popover"), S = vt("bento-click-outside-directive");
1095
- return gt((C(), he("div", la, [
1096
- e.label ? (C(), K(D, {
1097
- key: 0,
1098
- id: e.labelId,
1099
- label: e.label,
1100
- "tooltip-text": e.tooltipText,
1101
- optional: e.optional,
1102
- required: e.required
1103
- }, null, 8, ["id", "label", "tooltip-text", "optional", "required"])) : U("", !0),
1104
- Y("div", {
1105
- onKeydown: a[0] || (a[0] = yt((...G) => e.onEnterPressedOverInput && e.onEnterPressedOverInput(...G), ["enter"]))
1106
- }, [
1107
- j(g, {
1108
- ref: "inputContainerRef",
1109
- "always-combobox-is-input": "",
1110
- ariaControls: e.datePickerContainerId,
1111
- ariaExpanded: e.isDateRangePickerOpen,
1112
- "aria-labelledby": e.label ? e.labelId : null,
1113
- "aria-describedby": e.ariaDescribedBy,
1114
- disabled: e.disabled,
1115
- "is-invalid": !!e.errorMessage || e.shouldDisplayError,
1116
- open: e.isDateRangePickerOpen,
1117
- "display-value": e.displayedDateValue,
1118
- readonly: e.isReadOnly,
1119
- onOpen: e.openDateRangePicker,
1120
- onClear: e.clearDateRangePickerValue,
1121
- onClose: e.closeDateRangePicker
1122
- }, null, 8, ["ariaControls", "ariaExpanded", "aria-labelledby", "aria-describedby", "disabled", "is-invalid", "open", "display-value", "readonly", "onOpen", "onClear", "onClose"])
1123
- ], 32),
1124
- e.shouldDisplayError ? (C(), K(n, {
1125
- key: 1,
1126
- id: e.dateErrorId,
1127
- "error-message": e.t("provideDateInAFormat"),
1128
- class: "b-date-range-picker__error-message"
1129
- }, null, 8, ["id", "error-message"])) : U("", !0),
1130
- e.errorMessage ? (C(), K(n, {
1131
- key: 2,
1132
- id: e.errorId,
1133
- "error-message": e.errorMessage,
1134
- class: "b-date-range-picker__error-message"
1135
- }, null, 8, ["id", "error-message"])) : U("", !0),
1136
- e.description ? (C(), K(f, {
1137
- key: 3,
1138
- id: e.descriptionId,
1139
- class: we(["b-date-range-picker__description", e.descriptionConditionalClasses]),
1140
- el: "span"
1141
- }, {
1142
- default: Q(() => [
1143
- le(Tt(e.description), 1)
1144
- ]),
1145
- _: 1
1146
- }, 8, ["id", "class"])) : U("", !0),
1147
- e.inputContainerRef ? (C(), K(_, {
1148
- key: 4,
1149
- id: e.datePickerContainerId,
1150
- class: "b-date-range-picker__container",
1151
- open: e.isDateRangePickerOpen,
1152
- "target-element": e.inputContainerRef,
1153
- "disable-focus-trap": !0,
1154
- "aria-label": e.popoverAriaLabel,
1155
- position: "bottom-start",
1156
- "without-space": "",
1157
- "fit-content": ""
1158
- }, {
1159
- default: Q(() => [
1160
- j(T, {
1161
- "allow-time-input": e.withTimeInput,
1162
- "quick-select-ranges": e.adjustedQuickSelectRanges,
1163
- value: e.value,
1164
- "first-day-of-week": e.firstDayOfWeek,
1165
- granularities: e.granularities,
1166
- "is-date-disabled": e.isDateDisabled,
1167
- "max-range": e.maxRange,
1168
- min: e.min,
1169
- max: e.max,
1170
- "number-of-months": e.numberOfMonths,
1171
- "show-end-date-on-open": e.showEndDateOnOpen,
1172
- "date-form-data": e.displayedTextInputValue,
1173
- variant: e.variant,
1174
- onCustomRange: e.onRangeSelectorInput,
1175
- onInput: e.onDateRangePickerInput,
1176
- onError: e.onDateRangePickerError,
1177
- onFormDate: e.onDateRangePickerFormDateInputUpdate
1178
- }, bt({ _: 2 }, [
1179
- e.hasActions ? {
1180
- name: "actions",
1181
- fn: Q(() => [
1182
- j(E),
1183
- Y("div", ia, [
1184
- j(x, {
1185
- actions: e.rangePickerButtonActions,
1186
- layout: e.BentoButtonActionsLayout.SPACE_BETWEEN
1187
- }, null, 8, ["actions", "layout"])
1188
- ])
1189
- ]),
1190
- key: "0"
1191
- } : void 0
1192
- ]), 1032, ["allow-time-input", "quick-select-ranges", "value", "first-day-of-week", "granularities", "is-date-disabled", "max-range", "min", "max", "number-of-months", "show-end-date-on-open", "date-form-data", "variant", "onCustomRange", "onInput", "onError", "onFormDate"])
1193
- ]),
1194
- _: 1
1195
- }, 8, ["id", "open", "target-element", "aria-label"])) : U("", !0)
1196
- ])), [
1197
- [S, e.closeDateRangePicker]
1198
- ]);
1199
- }
1200
- const _a = /* @__PURE__ */ tt(sa, [["render", ua], ["__scopeId", "data-v-6a927a91"]]);
1201
- export {
1202
- _a as B,
1203
- L as D,
1204
- Re as a,
1205
- Yt as b,
1206
- be as i
1207
- };
1208
- //# sourceMappingURL=date-range-picker.-YsRuGmp.js.map