@adyen/bento-vue2 1.62.0 → 1.63.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 +181 -235
  2. package/dist/accordion.js +1 -1
  3. package/dist/action-bar.js +1 -1
  4. package/dist/assets/accordion-item.css +1 -1
  5. package/dist/assets/action-bar.css +1 -1
  6. package/dist/assets/base-modal.css +1 -1
  7. package/dist/assets/card.css +1 -1
  8. package/dist/assets/checkbox-input.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/file-uploader.css +1 -1
  13. package/dist/assets/header-with-views.css +1 -1
  14. package/dist/assets/inspector.css +1 -1
  15. package/dist/assets/listbox-option-tag.css +1 -1
  16. package/dist/assets/menu.css +1 -1
  17. package/dist/assets/modal-fullscreen.css +1 -1
  18. package/dist/assets/popover.css +1 -1
  19. package/dist/assets/sidepanel.css +1 -1
  20. package/dist/assets/use-cached-selected-values.css +1 -1
  21. package/dist/card.js +1 -1
  22. package/dist/checkbox.js +3 -3
  23. package/dist/chunks/{accordion-item.D1t0oHlP.js → accordion-item.BNtdoVto.js} +9 -8
  24. package/dist/chunks/{accordion-item.D1t0oHlP.js.map → accordion-item.BNtdoVto.js.map} +1 -1
  25. package/dist/chunks/{action-bar.whU1em8H.js → action-bar.Dsp7iRxz.js} +2 -2
  26. package/dist/chunks/{action-bar.whU1em8H.js.map → action-bar.Dsp7iRxz.js.map} +1 -1
  27. package/dist/chunks/{button-actions-with-menu.RoaQFPKT.js → button-actions-with-menu.CtW_16tY.js} +2 -2
  28. package/dist/chunks/{button-actions-with-menu.RoaQFPKT.js.map → button-actions-with-menu.CtW_16tY.js.map} +1 -1
  29. package/dist/chunks/{calendar.DoOFNX-Z.js → calendar.DbTC35rM.js} +2 -2
  30. package/dist/chunks/{calendar.DoOFNX-Z.js.map → calendar.DbTC35rM.js.map} +1 -1
  31. package/dist/chunks/card.CypgT0Ji.js +136 -0
  32. package/dist/chunks/card.CypgT0Ji.js.map +1 -0
  33. package/dist/chunks/{checkbox-group.B0IGYf1q.js → checkbox-group.6y92U6AF.js} +2 -2
  34. package/dist/chunks/{checkbox-group.B0IGYf1q.js.map → checkbox-group.6y92U6AF.js.map} +1 -1
  35. package/dist/chunks/checkbox-input.CNWigbX4.js +117 -0
  36. package/dist/chunks/checkbox-input.CNWigbX4.js.map +1 -0
  37. package/dist/chunks/{checkbox.DkCukYh0.js → checkbox.C9nJVvMq.js} +9 -8
  38. package/dist/chunks/{checkbox.DkCukYh0.js.map → checkbox.C9nJVvMq.js.map} +1 -1
  39. package/dist/chunks/chevron-down.eYtgv5ly.js +24 -0
  40. package/dist/chunks/chevron-down.eYtgv5ly.js.map +1 -0
  41. package/dist/chunks/{chevron-left.BS24hEFa.js → chevron-right.C--ZOC9j.js} +5 -5
  42. package/dist/chunks/chevron-right.C--ZOC9j.js.map +1 -0
  43. package/dist/chunks/chevron-up.d8cwIlA_.js +24 -0
  44. package/dist/chunks/chevron-up.d8cwIlA_.js.map +1 -0
  45. package/dist/chunks/{code-snippet.n93oYvH4.js → code-snippet.CBU8Tlbs.js} +2 -2
  46. package/dist/chunks/{code-snippet.n93oYvH4.js.map → code-snippet.CBU8Tlbs.js.map} +1 -1
  47. package/dist/chunks/{dashboard-section.BEw-n-XQ.js → dashboard-section.CspNW0CA.js} +3 -3
  48. package/dist/chunks/{dashboard-section.BEw-n-XQ.js.map → dashboard-section.CspNW0CA.js.map} +1 -1
  49. package/dist/chunks/{data-grid-template.DGFmCUII.js → data-grid-template.BhzgqkZp.js} +3 -3
  50. package/dist/chunks/{data-grid-template.DGFmCUII.js.map → data-grid-template.BhzgqkZp.js.map} +1 -1
  51. package/dist/chunks/{data-grid.BcGRXt9C.js → data-grid.BfsBhYpW.js} +451 -452
  52. package/dist/chunks/data-grid.BfsBhYpW.js.map +1 -0
  53. package/dist/chunks/{date-picker.Dc_HdQnr.js → date-picker.CPQ6WLZE.js} +3 -3
  54. package/dist/chunks/{date-picker.Dc_HdQnr.js.map → date-picker.CPQ6WLZE.js.map} +1 -1
  55. package/dist/chunks/date-range-picker.CNB28UaM.js +1005 -0
  56. package/dist/chunks/date-range-picker.CNB28UaM.js.map +1 -0
  57. package/dist/chunks/{dropdown-default-textbox.7PMxHqoa.js → dropdown-default-textbox.BNuuA4ES.js} +15 -14
  58. package/dist/chunks/{dropdown-default-textbox.7PMxHqoa.js.map → dropdown-default-textbox.BNuuA4ES.js.map} +1 -1
  59. package/dist/chunks/{dropdown-tag.qKSu6xYY.js → dropdown-tag.DmVsDrL_.js} +3 -3
  60. package/dist/chunks/{dropdown-tag.qKSu6xYY.js.map → dropdown-tag.DmVsDrL_.js.map} +1 -1
  61. package/dist/chunks/{dropdown.BNLPzKbr.js → dropdown.B_PWXFtT.js} +3 -3
  62. package/dist/chunks/{dropdown.BNLPzKbr.js.map → dropdown.B_PWXFtT.js.map} +1 -1
  63. package/dist/chunks/es6.n1ewaW31.js.map +1 -1
  64. package/dist/chunks/{filter-bar.TiqZofNt.js → filter-bar.D6HeYnzZ.js} +15 -14
  65. package/dist/chunks/{filter-bar.TiqZofNt.js.map → filter-bar.D6HeYnzZ.js.map} +1 -1
  66. package/dist/chunks/{fixed-scroller.Ctz5dFqz.js → fixed-scroller.XN-jvWqb.js} +12 -12
  67. package/dist/chunks/fixed-scroller.XN-jvWqb.js.map +1 -0
  68. package/dist/chunks/{header-with-views.MFHmiIXb.js → header-with-views.Dkn8IDew.js} +270 -270
  69. package/dist/chunks/header-with-views.Dkn8IDew.js.map +1 -0
  70. package/dist/chunks/{header.B1PrBQG0.js → header.DNzQO7u-.js} +2 -2
  71. package/dist/chunks/{header.B1PrBQG0.js.map → header.DNzQO7u-.js.map} +1 -1
  72. package/dist/chunks/{input-field-password.BlX3Icgt.js → input-field-password.CY3eRVpe.js} +3 -3
  73. package/dist/chunks/{input-field-password.BlX3Icgt.js.map → input-field-password.CY3eRVpe.js.map} +1 -1
  74. package/dist/chunks/{input-field-phone-number.Ofvi2A48.js → input-field-phone-number.CN5qZ0VL.js} +3 -3
  75. package/dist/chunks/{input-field-phone-number.Ofvi2A48.js.map → input-field-phone-number.CN5qZ0VL.js.map} +1 -1
  76. package/dist/chunks/{input-field.Dck9dAeK.js → input-field.DKhsSYF8.js} +2 -2
  77. package/dist/chunks/{input-field.Dck9dAeK.js.map → input-field.DKhsSYF8.js.map} +1 -1
  78. package/dist/chunks/{listbox-option-tag.EzSkn_lM.js → listbox-option-tag.DFmB_TuD.js} +9 -9
  79. package/dist/chunks/listbox-option-tag.DFmB_TuD.js.map +1 -0
  80. package/dist/chunks/menu.W_kuhRKI.js +514 -0
  81. package/dist/chunks/menu.W_kuhRKI.js.map +1 -0
  82. package/dist/chunks/minus-small.DJacLGTw.js +27 -0
  83. package/dist/chunks/minus-small.DJacLGTw.js.map +1 -0
  84. package/dist/chunks/{pagination.BvhUFgsT.js → pagination.DvP8FqiW.js} +2 -2
  85. package/dist/chunks/{pagination.BvhUFgsT.js.map → pagination.DvP8FqiW.js.map} +1 -1
  86. package/dist/chunks/{rich-text-editor.BTJpOiYL.js → rich-text-editor.aSOSl4Rz.js} +2 -2
  87. package/dist/chunks/{rich-text-editor.BTJpOiYL.js.map → rich-text-editor.aSOSl4Rz.js.map} +1 -1
  88. package/dist/chunks/{search-bar.Ch1dLZAb.js → search-bar.Sh4A8UId.js} +3 -3
  89. package/dist/chunks/{search-bar.Ch1dLZAb.js.map → search-bar.Sh4A8UId.js.map} +1 -1
  90. package/dist/chunks/{secondary-nav.DBssP9fQ.js → secondary-nav.BFtGx_IN.js} +2 -2
  91. package/dist/chunks/{secondary-nav.DBssP9fQ.js.map → secondary-nav.BFtGx_IN.js.map} +1 -1
  92. package/dist/chunks/{selection-card-group.CjFm-cAm.js → selection-card-group.CrWy35QU.js} +2 -2
  93. package/dist/chunks/{selection-card-group.CjFm-cAm.js.map → selection-card-group.CrWy35QU.js.map} +1 -1
  94. package/dist/chunks/{tabs.zkTl2PQR.js → tabs.Dx6teJGW.js} +2 -2
  95. package/dist/chunks/{tabs.zkTl2PQR.js.map → tabs.Dx6teJGW.js.map} +1 -1
  96. package/dist/chunks/{tutorial.C9PYfB4z.js → tutorial.BNZh6N3h.js} +2 -2
  97. package/dist/chunks/{tutorial.C9PYfB4z.js.map → tutorial.BNZh6N3h.js.map} +1 -1
  98. package/dist/chunks/{use-cached-selected-values.Da6xbfzO.js → use-cached-selected-values.CDBmVxYM.js} +514 -481
  99. package/dist/chunks/use-cached-selected-values.CDBmVxYM.js.map +1 -0
  100. package/dist/code-snippet.js +1 -1
  101. package/dist/dashboard-template.js +1 -1
  102. package/dist/data-grid-template.js +1 -1
  103. package/dist/data-grid.js +1 -1
  104. package/dist/date-picker.js +2 -2
  105. package/dist/date-range-picker.js +2 -2
  106. package/dist/dropdown.js +4 -4
  107. package/dist/filter-bar.js +1 -1
  108. package/dist/header-with-views.js +1 -1
  109. package/dist/header.js +1 -1
  110. package/dist/index.js +31 -31
  111. package/dist/input-field-password.js +1 -1
  112. package/dist/input-field-phone-number.js +1 -1
  113. package/dist/input-field.js +1 -1
  114. package/dist/internal.js +5 -5
  115. package/dist/menu.js +1 -1
  116. package/dist/pagination.js +1 -1
  117. package/dist/rich-text-editor.js +1 -1
  118. package/dist/search-bar.js +2 -2
  119. package/dist/secondary-nav.js +1 -1
  120. package/dist/selection-card.js +1 -1
  121. package/dist/styles/bento-dark.css +4 -0
  122. package/dist/styles/bento-light.css +4 -0
  123. package/dist/styles/bento.css +4 -0
  124. package/dist/styles/legacy.css +4 -0
  125. package/dist/styles/styleguide.css +4 -0
  126. package/dist/tabs.js +1 -1
  127. package/dist/tutorial.js +1 -1
  128. package/dist/web-types.json +176 -120
  129. package/package.json +7 -7
  130. package/dist/chunks/card.Cu6MicVI.js +0 -123
  131. package/dist/chunks/card.Cu6MicVI.js.map +0 -1
  132. package/dist/chunks/checkbox-input.B-4Rw5mp.js +0 -137
  133. package/dist/chunks/checkbox-input.B-4Rw5mp.js.map +0 -1
  134. package/dist/chunks/chevron-left.BS24hEFa.js.map +0 -1
  135. package/dist/chunks/chevron-up.CHK1E4p9.js +0 -43
  136. package/dist/chunks/chevron-up.CHK1E4p9.js.map +0 -1
  137. package/dist/chunks/data-grid.BcGRXt9C.js.map +0 -1
  138. package/dist/chunks/date-range-picker.D6xJAHoB.js +0 -977
  139. package/dist/chunks/date-range-picker.D6xJAHoB.js.map +0 -1
  140. package/dist/chunks/fixed-scroller.Ctz5dFqz.js.map +0 -1
  141. package/dist/chunks/header-with-views.MFHmiIXb.js.map +0 -1
  142. package/dist/chunks/listbox-option-tag.EzSkn_lM.js.map +0 -1
  143. package/dist/chunks/menu.CTVbNfuo.js +0 -601
  144. package/dist/chunks/menu.CTVbNfuo.js.map +0 -1
  145. package/dist/chunks/use-cached-selected-values.Da6xbfzO.js.map +0 -1
@@ -1,977 +0,0 @@
1
- import { reactive as ce, defineComponent as Pe, computed as y, ref as w, onMounted as Be, toRaw as fe, toRef as be, watch as me } from "vue";
2
- import { B as tt } from "./divider.Cc4JFWG_.js";
3
- import { B as at } from "./popover.B05xkQ4e.js";
4
- import { B as Ne, d as nt } from "./typography.J1v_SPG3.js";
5
- import { D as rt } from "./dropdown-default-textbox.7PMxHqoa.js";
6
- import { r as h, t as $, g as ve } from "./get-date-locale.BN8xEjY0.js";
7
- import { g as te } from "./generate-uid.NJ8tVoha.js";
8
- import { u as pe } from "./i18n.BQkEbtPM.js";
9
- import { t as re, f as ne } from "./date.dYFFEunA.js";
10
- import { e as qe, f as ae, i as P, g as K, h as Ie, j as st, k as Se, l as it, s as ke, m as ot, n as Ee, a as Y, u as lt } from "./calendar.DoOFNX-Z.js";
11
- import { f as he, v as ut, D as S } from "./date-input.BqBdAO1E.js";
12
- import { u as dt } from "./use-form-layout-loading.D3lALhtC.js";
13
- import "./index.Cl4_42j5.js";
14
- import { B as ct } from "./input-field.Dck9dAeK.js";
15
- import { B as Dt } from "./dropdown.BNLPzKbr.js";
16
- import { B as mt } from "./segmented-control.B-uxKqMN.js";
17
- import { d as ue } from "./debounce.DUTu11PS.js";
18
- import { u as ft } from "./use-has-slot.C9lQZ6nz.js";
19
- import { e as B, a as Oe } from "./index.BDuTpjD8.js";
20
- import { n as Le } from "./_plugin-vue2_normalizer.CeySl7Fu.js";
21
- import { B as vt } from "./directive.Cbdox5VL.js";
22
- import { F as pt, E as gt } from "./error-message.BeExHHgv.js";
23
- import { B as yt, c as Tt } from "./button-actions._OIvTdKt.js";
24
- import "../assets/date-range-picker.css";
25
- function Ye(t, e) {
26
- h(2, arguments);
27
- var n = re(e), o = n * 3;
28
- return qe(t, o);
29
- }
30
- function we(t) {
31
- h(1, arguments);
32
- var e = $(t), n = Math.floor(e.getMonth() / 3) + 1;
33
- return n;
34
- }
35
- function Me(t) {
36
- return h(1, arguments), $(t).getFullYear();
37
- }
38
- function Rt(t, e) {
39
- h(2, arguments);
40
- var n = $(t), o = $(e);
41
- return n.getTime() === o.getTime();
42
- }
43
- function _t(t, e) {
44
- h(2, arguments);
45
- var n = ae(t), o = ae(e);
46
- return n.getTime() === o.getTime();
47
- }
48
- function Ce(t) {
49
- h(1, arguments);
50
- var e = $(t);
51
- return e.setMilliseconds(0), e;
52
- }
53
- function Ae(t, e) {
54
- h(2, arguments);
55
- var n = Ce(t), o = Ce(e);
56
- return n.getTime() === o.getTime();
57
- }
58
- function bt(t) {
59
- return h(1, arguments), P(t, Date.now());
60
- }
61
- function It(t, e) {
62
- h(2, arguments);
63
- var n = $(t), o = re(e);
64
- return n.setHours(o), n;
65
- }
66
- function St(t, e) {
67
- h(2, arguments);
68
- var n = $(t), o = re(e);
69
- return n.setMinutes(o), n;
70
- }
71
- function kt(t, e) {
72
- h(2, arguments);
73
- var n = $(t), o = re(e);
74
- return n.setSeconds(o), n;
75
- }
76
- function Et(t, e) {
77
- h(2, arguments);
78
- var n = re(e);
79
- return Ye(t, -n);
80
- }
81
- function W(t) {
82
- if (t == null)
83
- return K(/* @__PURE__ */ new Date());
84
- const [e, n, o] = t.split("-").map((l) => parseInt(l, 10));
85
- return new Date(e, n - 1, o);
86
- }
87
- const ht = ({
88
- firstDayOfWeek: t,
89
- min: e,
90
- max: n
91
- }) => ({ getGranularCalendarLimits: (l) => {
92
- let D = K(e), m = B(n);
93
- if ((l == null ? void 0 : l.type) === "weekly") {
94
- if (l.earliest)
95
- D = K(l.earliest);
96
- else {
97
- const r = Ie(D, { weekStartsOn: t });
98
- P(D, r) || (D = K(st(Se(D, { weekStartsOn: t }), 1)));
99
- }
100
- if (l.latest)
101
- m = B(l.latest);
102
- else {
103
- const r = Se(m, { weekStartsOn: t });
104
- P(m, r) || (m = B(it(Ie(m, { weekStartsOn: t }), 1)));
105
- }
106
- }
107
- if ((l == null ? void 0 : l.type) === "monthly") {
108
- if (l.earliest)
109
- D = K(l.earliest);
110
- else {
111
- const r = ke(D);
112
- P(D, r) || (D = ke(qe(D, 1)));
113
- }
114
- if (l.latest)
115
- m = B(l.latest);
116
- else {
117
- const r = Oe(m);
118
- P(m, r) || (m = Oe(ot(m, 1)));
119
- }
120
- }
121
- if ((l == null ? void 0 : l.type) === "quarterly") {
122
- if (l.earliest)
123
- D = ae(l.earliest);
124
- else {
125
- const r = ae(D);
126
- P(D, r) || (D = ae(Ye(D, 1)));
127
- }
128
- if (l.latest)
129
- m = B(l.latest);
130
- else {
131
- const r = Ee(m);
132
- P(m, r) || (m = Ee(Et(m, 1)));
133
- }
134
- }
135
- return { min: D, max: m };
136
- } }), Ot = () => {
137
- const t = ce({
138
- daily: null,
139
- weekly: null,
140
- monthly: null,
141
- quarterly: null
142
- });
143
- return {
144
- savedRanges: t,
145
- saveRange: (o, l) => {
146
- t[o] = l;
147
- },
148
- resetSavedRanges: () => {
149
- t.daily = null, t.weekly = null, t.monthly = null, t.quarterly = null;
150
- }
151
- };
152
- };
153
- var v = /* @__PURE__ */ ((t) => (t.CUSTOM_RANGE = "custom-range", t.INPUT = "input", t.ERROR = "error", t.FORM_DATE = "form-date", t.START_DATE_SELECTED = "start-date-selected", t))(v || {});
154
- const wt = /[\d]/, Mt = /^\d{2}$/, Ct = /^\d{2}:\d{2}$/, At = (t) => {
155
- const { selectionStart: e } = t.target, n = ["Backspace", "Tab", "ArrowLeft", "ArrowRight"], o = wt.test(t.key) || n.includes(t.key), l = [1, 2, 4, 5].includes(e) && t.key === ":";
156
- !o && !l && t.preventDefault();
157
- }, xe = (t) => {
158
- if (!t)
159
- return t;
160
- let e = t;
161
- if (e.length === 1 && parseInt(t, 10) > 2)
162
- return `0${e}:`;
163
- const [n, o] = e.slice(-2);
164
- return [2, 5].includes(e.length) && o === ":" && (e = `${e.slice(0, e.length - 2)}0${n}`), (Mt.test(e) || Ct.test(e)) && (e += ":"), e;
165
- }, xt = {
166
- "en-US": {
167
- customRange: "Custom range",
168
- daily: "Daily",
169
- dateFrom: "Date from",
170
- dateTo: "Date to",
171
- lastMonth: "Last month",
172
- lastSevenDays: "Last 7 days",
173
- lastThreeMonths: "Last three months",
174
- monthly: "Monthly",
175
- quarterly: "Quarterly",
176
- timeFrom: "Time from",
177
- timeTo: "Time to",
178
- weekly: "Weekly"
179
- },
180
- "ja-JP": {
181
- customRange: "カスタム範囲を選択",
182
- daily: "毎日",
183
- lastMonth: "先月",
184
- lastSevenDays: "過去7日間",
185
- monthly: "毎月",
186
- weekly: "毎週"
187
- },
188
- "pt-BR": {
189
- customRange: "Selecione um intervalo personalizado",
190
- daily: "Diário",
191
- lastMonth: "Último mês",
192
- lastSevenDays: "Últimos 7 dias",
193
- monthly: "Mensal",
194
- weekly: "Semanal"
195
- }
196
- }, Fe = 300, Ue = "customRange", Ft = Pe({
197
- i18n: { messages: xt },
198
- name: "date-range-picker-calendar",
199
- components: {
200
- BentoDropdown: Dt,
201
- BentoInputField: ct,
202
- BentoSegmentedControl: mt,
203
- BentoTypography: Ne,
204
- Calendar: Y
205
- },
206
- props: {
207
- /**
208
- * Allows user to enter time values in the form
209
- */
210
- allowTimeInput: { type: Boolean, default: !1 },
211
- /**
212
- * Ranges form persistance data
213
- */
214
- dateFormData: {
215
- type: Object,
216
- default: () => ({ startDate: void 0, endDate: void 0, startTime: void 0, endTime: void 0 })
217
- },
218
- /**
219
- * Allows you to set the first day of the week. 0 is sunday, 1 is monday, 6 is saturday
220
- */
221
- firstDayOfWeek: Y.props.firstDayOfWeek,
222
- /**
223
- * A list of available granularities.
224
- * If present, the date picker will display a segmented control to change granularity.
225
- */
226
- granularities: {
227
- type: Array,
228
- default: null
229
- },
230
- /**
231
- * Indicate if a date should be disabled or not
232
- */
233
- isDateDisabled: Y.props.isDateDisabled,
234
- /**
235
- * Set a maximum number of dates to be selectable by the range.
236
- */
237
- maxRange: Y.props.maxRange,
238
- /**
239
- * Sets a minimum limit for selectable dates - dates before `min` will not be selectable
240
- */
241
- min: Y.props.min,
242
- /**
243
- * Sets a maximum limit for selectable dates - dates after `max` will not be selectable
244
- */
245
- max: Y.props.max,
246
- /**
247
- * Number of months rendered on pane
248
- */
249
- numberOfMonths: Y.props.numberOfMonths,
250
- /**
251
- * Displays the end date's month when the calendar is opened. Defaults to false i.e. the start date's month is displayed.
252
- */
253
- showEndDateOnOpen: { type: Boolean, default: !1 },
254
- /**
255
- * Enables the custom range selector.
256
- * If provided, must be an array that sets the custom range dropdown items. Items are of the structure:
257
- * `label` - label of custom range item.
258
- * `value` - a unique key of the custom range item.
259
- * `data` - an object `{ startDate: Date; endDate: Date }` to set the date picker range to upon selecting.
260
- */
261
- quickSelectRanges: {
262
- type: Array,
263
- default: void 0
264
- },
265
- /**
266
- * Selected date
267
- */
268
- value: { type: Object, default: void 0 },
269
- /**
270
- * The type of calendar to display. Defaults to showing days.
271
- */
272
- variant: Y.props.variant
273
- },
274
- emits: [
275
- v.CUSTOM_RANGE,
276
- v.INPUT,
277
- v.ERROR,
278
- v.FORM_DATE,
279
- v.START_DATE_SELECTED
280
- ],
281
- setup(t, { emit: e, slots: n }) {
282
- var ye, Te, Re, _e;
283
- const { locale: o, t: l } = pe(), D = ve(), m = y(() => t.variant === "month" ? "monthly" : "daily"), r = ce({
284
- startDate: (ye = t.value) == null ? void 0 : ye.startDate,
285
- endDate: (Te = t.value) == null ? void 0 : Te.endDate,
286
- range: (Re = t.value) == null ? void 0 : Re.range,
287
- ...t.granularities ? {
288
- granularity: ((_e = t.value) == null ? void 0 : _e.granularity) || m.value
289
- } : {}
290
- });
291
- function R(a) {
292
- return a ? new Date(
293
- a.getUTCFullYear(),
294
- a.getUTCMonth(),
295
- a.getUTCDate(),
296
- a.getUTCHours(),
297
- a.getUTCMinutes(),
298
- a.getUTCSeconds()
299
- ) : null;
300
- }
301
- const _ = y(() => {
302
- var a, i;
303
- return (
304
- // eslint-disable-next-line consistent-return
305
- ((i = (a = t == null ? void 0 : t.quickSelectRanges) == null ? void 0 : a.find(({ value: u, data: c }) => {
306
- if (!c.endDate)
307
- return u === r.range || Rt(
308
- R(c.startDate),
309
- R(r.startDate)
310
- ) && bt(r.endDate);
311
- if (t.allowTimeInput)
312
- return Ae(
313
- R(c.startDate),
314
- R(r.startDate)
315
- ) && Ae(R(c.endDate), R(r.endDate));
316
- if (c.endDate)
317
- return P(c.startDate, r.startDate) && P(c.endDate, r.endDate);
318
- })) == null ? void 0 : i.value) ?? Ue
319
- );
320
- }), se = y(() => ({
321
- "b-date-range-picker-calendar__form-input-wrapper": t.allowTimeInput
322
- })), ee = y(() => [
323
- { label: l("customRange"), value: Ue },
324
- ...t.quickSelectRanges ? t.quickSelectRanges : []
325
- ]), p = y(
326
- () => {
327
- var a;
328
- return ((a = t.granularities) == null ? void 0 : a.find(({ type: i }) => i === r.granularity)) || null;
329
- }
330
- ), z = y(
331
- () => {
332
- var a;
333
- return ((a = t.granularities) == null ? void 0 : a.map(({ type: i, disabled: u }) => ({
334
- label: l(i),
335
- value: i,
336
- disabled: u
337
- }))) ?? [];
338
- }
339
- ), { getGranularCalendarLimits: b } = ht(t), g = y(
340
- () => t.granularities ? b(p.value) : { min: K(t.min), max: B(t.max) }
341
- ), {
342
- adjustDateForQuarterly: k,
343
- adjustDateForMonthly: j,
344
- adjustDateForWeekly: J,
345
- adjustStartDateInputForWeekly: M,
346
- adjustEndDateInputForWeekly: f,
347
- adjustStartDateInputForMonthly: C,
348
- adjustEndDateInputForMonthly: A,
349
- adjustStartDateInputForQuarterly: Q,
350
- adjustEndDateInputForQuarterly: De
351
- } = lt(t.firstDayOfWeek), { savedRanges: x, saveRange: ie, resetSavedRanges: F } = Ot(), T = (a) => a ? ne(a, S.NUMERIC_DATE_YEAR_FIRST, {
352
- locale: D[o.value.substring(0, 2)] || D.enUS
353
- }) : "", N = (a) => a ? ne(a, S.HOUR_MINUTE_SECONDS, {
354
- locale: D[o.value.substring(0, 2)] || D.enUS
355
- }) : "", q = w(!1), L = w(!1), G = w(!1), H = w(!1), s = ce({
356
- startDate: t.dateFormData.startDate,
357
- endDate: t.dateFormData.endDate,
358
- startTime: t.dateFormData.startTime,
359
- endTime: t.dateFormData.endTime
360
- }), oe = (a) => /^(?:[01]\d|2[01234]):(?:[012345]\d):(?:[012345]\d)$/.test(a), E = (a, i) => {
361
- if (!i || !oe(i) || t.variant === "month")
362
- return a;
363
- let u = new Date(a);
364
- const [c, I, V] = i.split(":");
365
- return u = It(u, parseInt(c, 10)), u = St(u, parseInt(I, 10)), u = kt(u, parseInt(V, 10)), u;
366
- }, ge = (a) => {
367
- s.startTime = N(K(a.startDate)), s.endTime = N(B(a.endDate)), r.startDate = E(a.startDate, s.startTime), r.endDate = E(a.endDate, s.endTime), r.range = null, t.granularities && F(), e(v.INPUT, {
368
- ...r,
369
- range: _.value
370
- });
371
- }, d = (a) => {
372
- const i = (c) => t.min && c <= t.min || t.max && c >= t.max ? !1 : t.isDateDisabled ? !t.isDateDisabled(c) : !0;
373
- return /^\d{4}-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])$/.test(a) && i(new Date(a));
374
- };
375
- Be(() => {
376
- t.dateFormData.startDate && !d(t.dateFormData.startDate) ? q.value = !0 : (q.value = !1, G.value = !1), t.dateFormData.endDate && !d(t.dateFormData.endDate) ? L.value = !0 : (L.value = !1, H.value = !1);
377
- });
378
- const O = (a) => {
379
- var i;
380
- s.startDate = T(a), s.startTime ? G.value && (s.startTime = (i = t.dateFormData) == null ? void 0 : i.startTime) : s.startTime = N(a), q.value = !1, G.value = !1, e(v.START_DATE_SELECTED, a);
381
- }, X = (a) => {
382
- var i;
383
- s.endDate = T(a), s.endTime ? H.value && (s.endTime = (i = t.dateFormData) == null ? void 0 : i.endTime) : s.endTime = N(B(a)), L.value = !1, H.value = !1;
384
- }, Z = (a) => {
385
- const i = t.value[a];
386
- if (i)
387
- return i;
388
- if (t.dateFormData[a] && d(t.dateFormData[a]))
389
- return new Date(t.dateFormData[a]);
390
- }, $e = ue((a) => {
391
- var i;
392
- if (d(a)) {
393
- let u = a;
394
- switch (q.value = !1, (i = p.value) == null ? void 0 : i.type) {
395
- case "weekly":
396
- u = M(
397
- a,
398
- T,
399
- g.value.min,
400
- g.value.max
401
- ), s.startDate = u;
402
- break;
403
- case "monthly":
404
- u = C(
405
- a,
406
- T,
407
- g.value.min,
408
- g.value.max
409
- ), s.startDate = u;
410
- break;
411
- case "quarterly":
412
- u = Q(
413
- a,
414
- T,
415
- g.value.min,
416
- g.value.max
417
- ), s.startDate = u;
418
- break;
419
- }
420
- const c = W(u);
421
- r.startDate = E(c, s.startTime), r.endDate = E(
422
- W(s.endDate),
423
- s.endTime
424
- ), d(s.endDate) && (r.endDate = E(
425
- W(s.endDate),
426
- s.endTime
427
- ));
428
- const I = Z("endDate");
429
- r.range = null, e(v.FORM_DATE, {
430
- startDate: c,
431
- endDate: I
432
- }), e(v.INPUT, {
433
- ...r,
434
- range: _.value
435
- });
436
- } else
437
- q.value = !0, e(v.ERROR, { ...s });
438
- }, Fe), je = (a) => {
439
- s.startDate = he(a), $e(s.startDate);
440
- }, Qe = ue((a) => {
441
- var i;
442
- if (d(a)) {
443
- let u = a;
444
- switch (L.value = !1, (i = p.value) == null ? void 0 : i.type) {
445
- case "weekly":
446
- u = f(
447
- a,
448
- T,
449
- g.value.min,
450
- g.value.max
451
- ), s.endDate = u;
452
- break;
453
- case "monthly":
454
- u = A(
455
- a,
456
- T,
457
- g.value.min,
458
- g.value.max
459
- ), s.endDate = u;
460
- break;
461
- case "quarterly":
462
- u = De(
463
- a,
464
- T,
465
- g.value.min,
466
- g.value.max
467
- ), s.endDate = u;
468
- break;
469
- }
470
- const c = W(u);
471
- r.endDate = E(c, s.endTime), d(s.startDate) && (r.startDate = E(
472
- W(s.startDate),
473
- s.startTime
474
- ));
475
- const I = Z("startDate");
476
- r.range = null, e(v.FORM_DATE, {
477
- startDate: I,
478
- endDate: c
479
- }), e(v.INPUT, {
480
- ...r,
481
- range: _.value
482
- });
483
- } else
484
- L.value = !0, e(v.ERROR, { ...s });
485
- }, Fe), Ge = (a) => {
486
- s.endDate = he(a), Qe(s.endDate);
487
- }, He = (a) => {
488
- ut(a);
489
- }, Ve = ue((a) => {
490
- if (oe(a)) {
491
- G.value = !1, r.startDate = E(r.startDate, a);
492
- const i = Z("endDate");
493
- e(v.FORM_DATE, {
494
- startDate: new Date(r.startDate),
495
- endDate: i,
496
- startTime: a,
497
- endTime: t.dateFormData.endTime
498
- }), e(v.INPUT, {
499
- ...r,
500
- range: _.value
501
- });
502
- } else
503
- G.value = !0, e(v.ERROR, { ...s });
504
- }), We = ue((a) => {
505
- if (oe(a)) {
506
- H.value = !1, r.endDate = E(r.endDate, a);
507
- const i = Z("startDate");
508
- r.startDate = E(new Date(i), t.dateFormData.startTime), e(v.FORM_DATE, {
509
- startDate: E(new Date(i), t.dateFormData.startTime),
510
- endDate: new Date(r.endDate),
511
- startTime: t.dateFormData.startTime,
512
- endTime: a
513
- }), e(v.INPUT, {
514
- ...r,
515
- range: _.value
516
- });
517
- } else
518
- H.value = !0, e(v.ERROR, { ...s });
519
- }), Ke = (a) => {
520
- s.startTime = xe(a), Ve(s.startTime);
521
- }, ze = (a) => {
522
- s.endTime = xe(a), We(s.endTime);
523
- }, Je = (a) => {
524
- At(a);
525
- }, le = (a, i, u, c) => {
526
- r.startDate = a, r.endDate = i, u && (r.granularity = u), c && (r.range = c);
527
- }, Xe = (a) => {
528
- var u;
529
- const i = (u = t.quickSelectRanges) == null ? void 0 : u.find(({ value: c }) => c === a);
530
- if (i) {
531
- F();
532
- const c = i.data, I = c.endDate || (c.isRelativeToNow ? new Date(Date.now()) : B(new Date(Date.now()))), V = c.isRelativeToNow && c.timeDifference ? new Date(I.getTime() - c.timeDifference) : c.startDate;
533
- s.endDate = T(I), s.startDate = T(V), le(V, I, null, a), t.granularities && (r.granularity = c.granularity || m.value), s.startTime = N(V), s.endTime = N(I), r.startDate = V, r.endDate = I, e(v.CUSTOM_RANGE, {
534
- ...i.data,
535
- startDate: V,
536
- endDate: I,
537
- range: i.value
538
- });
539
- }
540
- }, Ze = {
541
- weekly: J,
542
- monthly: j,
543
- quarterly: k
544
- }, et = (a) => {
545
- const i = r.granularity;
546
- if (r.granularity = a, i && ie(i, structuredClone(fe(r))), r.startDate && r.endDate) {
547
- switch (a) {
548
- case "quarterly":
549
- case "monthly":
550
- case "weekly": {
551
- if (x[a]) {
552
- le(x[a].startDate, x[a].endDate, a);
553
- break;
554
- }
555
- const { startDate: u, endDate: c } = Ze[a](
556
- r.startDate,
557
- r.endDate,
558
- g.value.min,
559
- g.value.max
560
- );
561
- le(u, c, a);
562
- break;
563
- }
564
- case "daily":
565
- x.daily && le(x.daily.startDate, x.daily.endDate, a);
566
- break;
567
- }
568
- s.startDate = T(r.startDate), s.endDate = T(r.endDate), e(v.INPUT, {
569
- ...r,
570
- range: _.value
571
- });
572
- }
573
- };
574
- return {
575
- // Values
576
- internalRangeDate: r,
577
- dateTextInput: s,
578
- endDateError: L,
579
- endTimeError: H,
580
- granularityItems: z,
581
- selectedGranularity: p,
582
- computedMinMax: g,
583
- selectedRangeSelectorValue: _,
584
- startDateError: q,
585
- startTimeError: G,
586
- quickSelectRangeDefaultItems: ee,
587
- formInputWrapperConditionalClasses: se,
588
- // Methods
589
- hasSlot: ft(n),
590
- t: l,
591
- // Events
592
- onDateInput: ge,
593
- onDateInputKeyDown: He,
594
- onEndDateInput: Ge,
595
- onEndDateSelected: X,
596
- onEndTimeInput: ze,
597
- onGranularityInput: et,
598
- onRangeSelectorInput: Xe,
599
- onStartDateInput: je,
600
- onStartDateSelected: O,
601
- onStartTimeInput: Ke,
602
- onTimeInputKeyDown: Je
603
- };
604
- }
605
- });
606
- var Ut = function() {
607
- var e = this, n = e._self._c;
608
- return e._self._setupProxy, n("div", { staticClass: "b-date-range-picker-calendar" }, [n("div", { staticClass: "b-date-range-picker-calendar__form-container" }, [n("div", { staticClass: "b-date-range-picker-calendar__form" }, [e.hasSlot("title") ? [e._t("title")] : e._e(), e.quickSelectRanges ? n("bento-dropdown", { attrs: { "aria-label": e.t("customRange"), items: e.quickSelectRangeDefaultItems, value: e.selectedRangeSelectorValue }, on: { input: e.onRangeSelectorInput } }) : e._e(), e.granularities ? n("bento-segmented-control", { attrs: { items: e.granularityItems, "model-value": e.internalRangeDate.granularity, "full-width": "" }, on: { "update:model-value": e.onGranularityInput } }) : e._e(), n("div", [n("bento-typography", { staticClass: "b-date-range-picker-calendar__label", attrs: { stronger: "", el: "span" } }, [e._v(" From ")]), n("div", { class: e.formInputWrapperConditionalClasses }, [n("bento-input-field", { staticClass: "b-date-range-picker-calendar__form-input", attrs: { "aria-label": e.t("dateFrom"), value: e.dateTextInput.startDate, error: e.startDateError }, on: { input: e.onStartDateInput, keydown: e.onDateInputKeyDown }, scopedSlots: e._u([{ key: "description", fn: function() {
609
- return [e._v("YYYY-MM-DD")];
610
- }, proxy: !0 }]) }), e.allowTimeInput ? n("bento-input-field", { staticClass: "b-date-range-picker-calendar__form-input", attrs: { "aria-label": e.t("timeFrom"), value: e.dateTextInput.startTime, error: e.startTimeError }, on: { input: e.onStartTimeInput, keydown: e.onTimeInputKeyDown }, scopedSlots: e._u([{ key: "description", fn: function() {
611
- return [e._v("HH:MM:SS")];
612
- }, proxy: !0 }], null, !1, 3442289499) }) : e._e()], 1)], 1), n("div", [n("bento-typography", { staticClass: "b-date-range-picker-calendar__label", attrs: { stronger: "", el: "span" } }, [e._v(" To ")]), n("div", { class: e.formInputWrapperConditionalClasses }, [n("bento-input-field", { staticClass: "b-date-range-picker-calendar__form-input", attrs: { "aria-label": e.t("dateTo"), value: e.dateTextInput.endDate, error: e.endDateError }, on: { input: e.onEndDateInput, keydown: e.onDateInputKeyDown }, scopedSlots: e._u([{ key: "description", fn: function() {
613
- return [e._v("YYYY-MM-DD")];
614
- }, proxy: !0 }]) }), e.allowTimeInput ? n("bento-input-field", { staticClass: "b-date-range-picker-calendar__form-input", attrs: { "aria-label": e.t("timeTo"), value: e.dateTextInput.endTime, error: e.endTimeError }, on: { input: e.onEndTimeInput, keydown: e.onTimeInputKeyDown }, scopedSlots: e._u([{ key: "description", fn: function() {
615
- return [e._v("HH:MM:SS")];
616
- }, proxy: !0 }], null, !1, 3442289499) }) : e._e()], 1)], 1)], 2), e.hasSlot("actions") ? n("div", [e._t("actions")], 2) : e._e()]), n("div", { staticClass: "b-date-range-picker-calendar__calendars-container" }, [n("calendar", { attrs: { value: e.internalRangeDate, "first-day-of-week": e.firstDayOfWeek, "is-date-disabled": e.isDateDisabled, "max-range": e.maxRange, min: e.computedMinMax.min, max: e.computedMinMax.max, "number-of-months": e.numberOfMonths, "show-end-date-on-open": e.showEndDateOnOpen, granularity: e.selectedGranularity, variant: e.variant, "is-range": "" }, on: { input: e.onDateInput, "start-date-selected": e.onStartDateSelected, "end-date-selected": e.onEndDateSelected } })], 1)]);
617
- }, Pt = [], Bt = /* @__PURE__ */ Le(
618
- Ft,
619
- Ut,
620
- Pt,
621
- !1,
622
- null,
623
- "3a7fe6bf"
624
- );
625
- const U = Bt.exports, Nt = ({
626
- datePickerValue: t,
627
- isDateIncorrect: e,
628
- quickSelectRanges: n,
629
- isMonthVariant: o
630
- }) => {
631
- var p, z, b, g;
632
- const { locale: l, t: D } = pe(), m = ve(), r = (k) => !!k && !isNaN(k.getTime()), R = (k, j) => r(k) ? ne(k, j, {
633
- locale: m[l.value.substring(0, 2)] || m.enUS
634
- }) : void 0, _ = ce({
635
- startDate: R((p = t.value) == null ? void 0 : p.startDate, S.NUMERIC_DATE_YEAR_FIRST),
636
- endDate: R((z = t.value) == null ? void 0 : z.endDate, S.NUMERIC_DATE_YEAR_FIRST),
637
- startTime: R((b = t.value) == null ? void 0 : b.startDate, S.HOUR_MINUTE_SECONDS),
638
- endTime: R((g = t.value) == null ? void 0 : g.endDate, S.HOUR_MINUTE_SECONDS)
639
- });
640
- return {
641
- // Values
642
- dateDisplayValue: y(() => {
643
- var M;
644
- if (e.value)
645
- return `${_.startDate || ""} - ${_.endDate || ""}`;
646
- if (!t.value || !t.value.startDate && !t.value.endDate)
647
- return D("selectDateRange");
648
- if ((M = n.value) != null && M.length) {
649
- const f = n.value.find(({ value: C }) => {
650
- var A;
651
- return C === ((A = t.value) == null ? void 0 : A.range);
652
- });
653
- if (f)
654
- return f.label;
655
- }
656
- if (t.value.granularity === "quarterly") {
657
- const { startDate: f, endDate: C } = t.value, A = D("quarter", { quarter: we(f), year: Me(f) });
658
- if (_t(f, C))
659
- return A;
660
- const Q = D("quarter", { quarter: we(C), year: Me(C) });
661
- return `${A} - ${Q}`;
662
- }
663
- const { startDate: k, endDate: j } = _, J = o != null && o.value ? S.LONG_MONTH_YEAR : S.FULL_DATE_MONTH_FIRST;
664
- return `${R(W(k), J)} - ${R(
665
- W(j),
666
- J
667
- )}`;
668
- }),
669
- textInputDisplayValue: _,
670
- // Methods
671
- formatTextInputDisplayValue: () => ""
672
- };
673
- };
674
- var de = /* @__PURE__ */ ((t) => (t.INPUT = "input", t))(de || {});
675
- const qt = {
676
- "en-US": {
677
- apply: "Apply",
678
- cancel: "Cancel",
679
- dateRangePicker: "Date range picker {name}",
680
- provideDateInAFormat: "Provide date in a YYYY-MM-DD format",
681
- quarter: "Q{quarter} {year}",
682
- selectDate: "Select a date",
683
- selectDateRange: "Select a date range",
684
- selectedDateIsNotAvailable: "Selected date is not available"
685
- },
686
- "ja-JP": {
687
- apply: "適用",
688
- cancel: "キャンセル",
689
- selectDate: "日付を選択"
690
- },
691
- "pt-BR": {
692
- apply: "Aplicar",
693
- cancel: "Cancelar",
694
- selectDate: "Selecione uma data"
695
- }
696
- }, Lt = Pe({
697
- i18n: { messages: qt },
698
- name: "bento-date-range-picker",
699
- components: {
700
- BentoButtonActions: yt,
701
- BentoDivider: tt,
702
- BentoTypography: Ne,
703
- BentoPopover: at,
704
- DateRangePickerCalendar: U,
705
- DropdownInputDefault: rt,
706
- ErrorMessage: gt,
707
- FieldLabel: pt
708
- },
709
- directives: { BentoClickOutsideDirective: vt },
710
- props: {
711
- /**
712
- * Allows user to enter time values in the form
713
- */
714
- allowTimeInput: { type: Boolean, default: !1 },
715
- /**
716
- * Descriptive supporting text visbile underneath the dropdown.
717
- */
718
- description: { type: String, default: void 0 },
719
- /**
720
- * Disables dropdown functionality.
721
- */
722
- disabled: { type: Boolean, default: !1 },
723
- /**
724
- * Displays component in an error state with an error message
725
- */
726
- errorMessage: { type: String, default: null },
727
- /**
728
- * Allows user to set the first day of the week. 0 is sunday, 1 is monday, 6 is saturday
729
- */
730
- firstDayOfWeek: U.props.firstDayOfWeek,
731
- /**
732
- * A list of available granularities.
733
- * If present, the date picker will display a segmented control to change granularity.
734
- */
735
- granularities: U.props.granularities,
736
- /**
737
- * Indicate if a date should be disabled or not
738
- */
739
- isDateDisabled: U.props.isDateDisabled,
740
- /**
741
- * Text that is displayed as a label above the element.
742
- */
743
- label: { type: String, default: void 0 },
744
- /**
745
- * Upon opening date range picker, end date's month will be pre-selected.
746
- */
747
- showEndDateOnOpen: { type: Boolean, default: !1 },
748
- /**
749
- * Highlights the dropdown is optional.
750
- */
751
- optional: { type: Boolean, default: !1 },
752
- /**
753
- * The Boolean readonly property, when present, makes the element not mutable, meaning the user can not edit the date range picker.
754
- */
755
- readonly: { type: Boolean, default: !1 },
756
- /**
757
- * Highlights the dropdown is required.
758
- */
759
- required: { type: Boolean, default: !1 },
760
- /**
761
- * Adds a info icon next to the label to display the passed tooltip message.
762
- */
763
- tooltipText: { type: String, default: null },
764
- /**
765
- * Enables the range selector.
766
- * If provided, must be an array that sets the custom range dropdown items. Items are of the structure:
767
- * `label` - label of custom range item.
768
- * `value` - a unique key of the custom range item.
769
- * `data` - an object `{ startDate: Date; endDate: Date }` to set the date picker range to upon selecting.
770
- */
771
- quickSelectRanges: {
772
- type: Array,
773
- default: void 0
774
- },
775
- /**
776
- * Set a maximum number of dates to be selectable by the range.
777
- */
778
- maxRange: U.props.maxRange,
779
- /**
780
- * Sets a minimum limit for selectable dates - dates before `min` will not be selectable
781
- */
782
- min: U.props.min,
783
- /**
784
- * Sets a maximum limit for selectable dates - dates after `max` will not be selectable
785
- */
786
- max: U.props.max,
787
- /**
788
- * Number of months rendered on pane
789
- */
790
- numberOfMonths: U.props.numberOfMonths,
791
- /**
792
- * Selected date
793
- */
794
- value: U.props.value,
795
- /**
796
- * The type of calendar to display. Defaults to showing days.
797
- */
798
- variant: {
799
- type: String,
800
- default: void 0
801
- // Default will be set by @/internal/calendar
802
- },
803
- /**
804
- * Enables the date picker selection to persist until it is explicitly applied.
805
- * Displays a set of buttons: Apply and Cancel.
806
- *
807
- * @deprecated This will be the default behaviour in v2.0.0.
808
- */
809
- hasActions: { type: Boolean, default: !1 }
810
- },
811
- emits: [de.INPUT],
812
- setup(t, { emit: e }) {
813
- const { locale: n, t: o } = pe(), l = ve(), D = te("bento-date-range-picker-container"), m = te("bento-date-range-picker-label"), r = te("bento-date-range-picker-description"), R = te("bento-date-range-picker-error"), _ = te("bento-date-range-picker-date-error"), se = y(
814
- () => t.label || o("dateRangePicker", { name: D })
815
- ), ee = y(() => (t == null ? void 0 : t.quickSelectRanges) && t.quickSelectRanges.map((d) => {
816
- const O = d.data.endDate ? void 0 : new Date(Date.now()).getTime() - d.data.startDate.getTime();
817
- return {
818
- ...d,
819
- data: {
820
- ...d.data,
821
- // Adding timeDifference to calculate an up-to-date endDate on range selection
822
- timeDifference: O
823
- }
824
- };
825
- })), p = w(!1), z = w(null), b = w(!1), { isReadOnly: g } = dt(be(t, "readonly"));
826
- me(
827
- () => t.disabled,
828
- () => {
829
- t.disabled && b.value && (b.value = !1);
830
- }
831
- );
832
- const k = y(() => t.hasActions ? !T.value && p.value : p.value), j = y(() => ({
833
- "b-date-range-picker__description--error": !!t.errorMessage || k.value
834
- })), J = y(() => t.variant === "month"), { dateDisplayValue: M, textInputDisplayValue: f } = Nt({
835
- datePickerValue: be(t, "value"),
836
- isDateIncorrect: p,
837
- quickSelectRanges: ee,
838
- isMonthVariant: J
839
- }), C = y(
840
- () => `${t.description ? r : ""} ${t.errorMessage ? R : ""} ${p.value ? _ : ""}`.trim() || null
841
- ), A = y(() => t.allowTimeInput && t.variant !== "month"), Q = () => {
842
- b.value = !1;
843
- }, De = () => {
844
- b.value = !0;
845
- }, x = w(M.value), ie = w(
846
- // textInputDisplayValue is a reactive object
847
- structuredClone(fe(f))
848
- ), F = w(t.value), T = w(!0), N = y(
849
- () => t.hasActions ? ie.value : f
850
- ), q = y(
851
- () => t.hasActions ? x.value : M.value
852
- );
853
- Be(() => {
854
- if (t.hasActions || nt(
855
- 'BentoDateRangePicker "hasActions" property',
856
- `Set the BentoDateRangePicker "hasActions" property true which will display the "Apply" and "Cancel" buttons.
857
- This will be the default behavior in the v2 and "hasActions" will be removed.`,
858
- "2.0.0"
859
- ), t.granularities && t.variant !== "month" && t.granularities.find(({ type: d }) => d === "quarterly"))
860
- throw new Error(
861
- 'Quarterly granularity is only supported by BentoDateRangePicker with variant: "month"'
862
- );
863
- }), me(
864
- () => t.value,
865
- () => {
866
- x.value = M.value, ie.value = structuredClone(fe(f));
867
- }
868
- );
869
- const L = y(() => [
870
- {
871
- title: o("apply"),
872
- event: () => {
873
- e(de.INPUT, F.value), Q(), T.value = !0;
874
- },
875
- disabled: T.value
876
- },
877
- {
878
- title: o("cancel"),
879
- event: Q
880
- }
881
- ]);
882
- return me(F, (d) => {
883
- if (t.hasActions) {
884
- T.value = p.value;
885
- return;
886
- }
887
- e(de.INPUT, d);
888
- }), {
889
- // Refs
890
- inputContainerRef: z,
891
- // Values,
892
- adjustedQuickSelectRanges: ee,
893
- dateDisplayValue: M,
894
- datePickerContainerId: D,
895
- descriptionConditionalClasses: j,
896
- displayedTextInputValue: N,
897
- displayedDateValue: q,
898
- isDateIncorrect: p,
899
- isDateRangePickerOpen: b,
900
- isReadOnly: g,
901
- labelId: m,
902
- descriptionId: r,
903
- dateErrorId: _,
904
- errorId: R,
905
- popoverAriaLabel: se,
906
- shouldDisplayError: k,
907
- ariaDescribedBy: C,
908
- textInputDisplayValue: f,
909
- rangePickerButtonActions: L,
910
- BentoButtonActionsLayout: Tt,
911
- withTimeInput: A,
912
- // Events
913
- closeDateRangePicker: Q,
914
- clearDateRangePickerValue: async () => {
915
- p.value && (p.value = !1), F.value = null;
916
- },
917
- openDateRangePicker: De,
918
- onRangeSelectorInput: (d) => {
919
- if (d) {
920
- const O = (X) => ne(X, S.NUMERIC_DATE_YEAR_FIRST, {
921
- locale: l[n.value.substring(0, 2)] || l.enUS
922
- });
923
- f.startDate = O(d.startDate), f.endDate = O(d.endDate), F.value = d;
924
- }
925
- },
926
- onEnterPressedOverInput: () => {
927
- if (!b.value) {
928
- b.value = !0;
929
- return;
930
- }
931
- p.value || (b.value = !1);
932
- },
933
- onDateRangePickerInput: (d) => {
934
- p.value = !1;
935
- const O = (X, Z) => X ? ne(X, Z, {
936
- locale: l[n.value.substring(0, 2)] || l.enUS
937
- }) : void 0;
938
- f.startDate = O(
939
- d.startDate,
940
- S.NUMERIC_DATE_YEAR_FIRST
941
- ), f.endDate = O(d.endDate, S.NUMERIC_DATE_YEAR_FIRST), f.startTime = O(d.startDate, S.HOUR_MINUTE_SECONDS), f.endTime = O(d.endDate, S.HOUR_MINUTE_SECONDS), F.value = d;
942
- },
943
- onDateRangePickerError: (d) => {
944
- p.value = !0, f.startDate = d.startDate, f.endDate = d.endDate, F.value = { startDate: null, endDate: null };
945
- },
946
- onDateRangePickerFormDateInputUpdate: (d) => {
947
- p.value = !1, d.startTime && (f.startTime = d.startTime), d.endTime && (f.endTime = d.endTime);
948
- },
949
- // Translations
950
- t: o
951
- };
952
- }
953
- });
954
- var Yt = function() {
955
- var e = this, n = e._self._c;
956
- return e._self._setupProxy, n("div", { directives: [{ name: "bento-click-outside-directive", rawName: "v-bento-click-outside-directive", value: e.closeDateRangePicker, expression: "closeDateRangePicker" }], staticClass: "b-date-range-picker" }, [e.label ? n("field-label", { attrs: { id: e.labelId, label: e.label, "tooltip-text": e.tooltipText, optional: e.optional, required: e.required } }) : e._e(), n("div", { on: { keydown: function(o) {
957
- return !o.type.indexOf("key") && e._k(o.keyCode, "enter", 13, o.key, "Enter") ? null : e.onEnterPressedOverInput.apply(null, arguments);
958
- } } }, [n("dropdown-input-default", { ref: "inputContainerRef", attrs: { "always-combobox-is-input": "", ariaControls: e.datePickerContainerId, ariaExpanded: e.isDateRangePickerOpen, "aria-labelledby": e.label ? e.labelId : null, "aria-describedby": e.ariaDescribedBy, disabled: e.disabled, "is-invalid": !!e.errorMessage || e.shouldDisplayError, open: e.isDateRangePickerOpen, "display-value": e.displayedDateValue, readonly: e.isReadOnly }, on: { open: e.openDateRangePicker, clear: e.clearDateRangePickerValue, close: e.closeDateRangePicker } })], 1), e.shouldDisplayError ? n("error-message", { staticClass: "b-date-range-picker__error-message", attrs: { id: e.dateErrorId, "error-message": e.t("provideDateInAFormat") } }) : e._e(), e.errorMessage ? n("error-message", { staticClass: "b-date-range-picker__error-message", attrs: { id: e.errorId, "error-message": e.errorMessage } }) : e._e(), e.description ? n("bento-typography", { staticClass: "b-date-range-picker__description", class: e.descriptionConditionalClasses, attrs: { id: e.descriptionId, el: "span" } }, [e._v(" " + e._s(e.description) + " ")]) : e._e(), e.inputContainerRef ? n("bento-popover", { staticClass: "b-date-range-picker__container", attrs: { id: e.datePickerContainerId, open: e.isDateRangePickerOpen, "target-element": e.inputContainerRef, "disable-focus-trap": !0, "aria-label": e.popoverAriaLabel, position: "bottom-start", "without-space": "", "fit-content": "" } }, [n("date-range-picker-calendar", { attrs: { "allow-time-input": e.withTimeInput, "quick-select-ranges": e.adjustedQuickSelectRanges, value: e.value, "first-day-of-week": e.firstDayOfWeek, granularities: e.granularities, "is-date-disabled": e.isDateDisabled, "max-range": e.maxRange, min: e.min, max: e.max, "number-of-months": e.numberOfMonths, "show-end-date-on-open": e.showEndDateOnOpen, "date-form-data": e.displayedTextInputValue, variant: e.variant }, on: { "custom-range": e.onRangeSelectorInput, input: e.onDateRangePickerInput, error: e.onDateRangePickerError, "form-date": e.onDateRangePickerFormDateInputUpdate }, scopedSlots: e._u([e.hasActions ? { key: "actions", fn: function() {
959
- return [n("bento-divider"), n("div", { staticClass: "b-date-range-picker__footer" }, [n("bento-button-actions", { attrs: { actions: e.rangePickerButtonActions, layout: e.BentoButtonActionsLayout.SPACE_BETWEEN } })], 1)];
960
- }, proxy: !0 } : null], null, !0) })], 1) : e._e()], 1);
961
- }, $t = [], jt = /* @__PURE__ */ Le(
962
- Lt,
963
- Yt,
964
- $t,
965
- !1,
966
- null,
967
- "11efd45e"
968
- );
969
- const ma = jt.exports;
970
- export {
971
- ma as B,
972
- U as D,
973
- de as a,
974
- bt as b,
975
- Rt as i
976
- };
977
- //# sourceMappingURL=date-range-picker.D6xJAHoB.js.map