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