@ironsource/shared-ui 2.1.6-test.1 → 2.1.6-test.12

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 (159) hide show
  1. package/AppDropdownTrigger.vue_vue_type_style_index_0_scoped_39c47ad1_lang.css +1 -0
  2. package/AppHeader.vue_vue_type_style_index_0_scoped_538ccdc6_lang.css +1 -0
  3. package/Autocomplete.vue_vue_type_style_index_0_scoped_a7bfd237_lang.css +1 -0
  4. package/CalendarMonth.vue_vue_type_style_index_0_scoped_acd3440c_lang.css +1 -0
  5. package/CalendarMonthV4.vue_vue_type_style_index_0_scoped_b0d3ea50_lang.css +1 -0
  6. package/ChipDropdownTrigger.vue_vue_type_style_index_0_scoped_a8fdae89_lang.css +1 -0
  7. package/DataGrid.vue_vue_type_style_index_0_scoped_6df3b70f_lang.css +1 -0
  8. package/DatePicker.vue_vue_type_style_index_0_scoped_67b44cbe_lang.css +1 -0
  9. package/DatePickerMonth.vue_vue_type_style_index_0_scoped_929d3028_lang.css +1 -0
  10. package/DatePickerMonthV4.vue_vue_type_style_index_0_scoped_11288104_lang.css +1 -0
  11. package/DatePickerV4.vue_vue_type_style_index_0_scoped_be93e5a9_lang.css +1 -0
  12. package/DateRange.vue_vue_type_style_index_0_scoped_70e316e9_lang.css +1 -0
  13. package/DateRangeV4.vue_vue_type_style_index_0_scoped_f6d9f41d_lang.css +1 -0
  14. package/DefaultDropdownTrigger.vue_vue_type_style_index_0_scoped_ad524750_lang.css +1 -0
  15. package/DialogV4.vue_vue_type_style_index_0_scoped_09c488cf_lang.css +1 -0
  16. package/Dropdown.vue_vue_type_style_index_0_scoped_aaa8c4bb_lang.css +1 -0
  17. package/DropdownV4.vue_vue_type_style_index_0_scoped_0363db63_lang.css +1 -0
  18. package/DropdownV4.vue_vue_type_style_index_1_lang.css +1 -1
  19. package/FieldLabel.vue_vue_type_style_index_0_scoped_96ee1c98_lang.css +1 -0
  20. package/{FormCard.vue_vue_type_style_index_0_scoped_ef8b4e81_lang.css → FormCard.vue_vue_type_style_index_0_scoped_52ade67c_lang.css} +1 -1
  21. package/InlineCopy.vue_vue_type_style_index_0_scoped_6a7b3795_lang.css +1 -0
  22. package/MultiBar.vue_vue_type_style_index_0_scoped_71617643_lang.css +1 -0
  23. package/OptionV4.vue_vue_type_style_index_0_scoped_e0c24b6a_lang.css +1 -0
  24. package/TextAreaV4.vue_vue_type_style_index_0_scoped_8199b662_lang.css +1 -0
  25. package/TextField.vue_vue_type_style_index_0_scoped_a6457440_lang.css +1 -0
  26. package/TooltipV4.vue_vue_type_style_index_0_scoped_fcdb9d02_lang.css +1 -0
  27. package/components/appHeader/AppHeader.vue.d.ts +6 -2
  28. package/components/appHeader/AppHeader.vue.js +2 -2
  29. package/components/appHeader/AppHeader.vue2.js +30 -28
  30. package/components/appHeader/index.d.ts +6 -2
  31. package/components/autocomplete/Autocomplete.vue.d.ts +5 -0
  32. package/components/autocomplete/Autocomplete.vue.js +3 -3
  33. package/components/autocomplete/Autocomplete.vue2.js +82 -61
  34. package/components/autocomplete/index.d.ts +20 -1
  35. package/components/datePicker/common/DatePicker.common.d.ts +11 -0
  36. package/components/datePicker/common/DatePicker.common.js +52 -0
  37. package/components/datePicker/common/DatePickerMonth.common.d.ts +85 -0
  38. package/components/datePicker/common/DatePickerMonth.common.js +66 -0
  39. package/components/datePicker/{DatePicker.vue.d.ts → v3/DatePicker.vue.d.ts} +1 -1
  40. package/components/datePicker/v3/DatePicker.vue.js +7 -0
  41. package/components/datePicker/v3/DatePicker.vue2.js +69 -0
  42. package/components/datePicker/v3/DatePickerMonth.vue.js +7 -0
  43. package/components/datePicker/v3/DatePickerMonth.vue2.js +40 -0
  44. package/components/datePicker/{index.d.ts → v3/index.d.ts} +3 -3
  45. package/components/datePicker/v4/DatePickerMonthV4.vue.d.ts +53 -0
  46. package/components/datePicker/v4/DatePickerMonthV4.vue.js +7 -0
  47. package/components/datePicker/v4/DatePickerMonthV4.vue2.js +40 -0
  48. package/components/datePicker/v4/DatePickerV4.vue.d.ts +67 -0
  49. package/components/datePicker/v4/DatePickerV4.vue.js +7 -0
  50. package/components/datePicker/v4/DatePickerV4.vue2.js +73 -0
  51. package/components/datePicker/v4/index.d.ts +184 -0
  52. package/components/datePicker/v4/index.js +6 -0
  53. package/components/dateRange/common/CalendarMonth.common.d.ts +17 -0
  54. package/components/dateRange/common/CalendarMonth.common.js +131 -0
  55. package/components/dateRange/common/DateRange.common.d.ts +47 -0
  56. package/components/dateRange/common/DateRange.common.js +265 -0
  57. package/components/dateRange/common/DateRangePicker.common.d.ts +3 -0
  58. package/components/dateRange/{DateServices.d.ts → common/DateServices.common.d.ts} +1 -0
  59. package/components/dateRange/common/DateServices.common.js +248 -0
  60. package/components/dateRange/{consts.js → common/consts.common.js} +5 -9
  61. package/components/dateRange/{CalendarMonth.vue.d.ts → v3/CalendarMonth.vue.d.ts} +1 -1
  62. package/components/dateRange/v3/CalendarMonth.vue.js +7 -0
  63. package/components/dateRange/v3/CalendarMonth.vue2.js +147 -0
  64. package/components/dateRange/{DateRange.vue.d.ts → v3/DateRange.vue.d.ts} +9 -9
  65. package/components/dateRange/v3/DateRange.vue.js +7 -0
  66. package/components/dateRange/v3/DateRange.vue2.js +226 -0
  67. package/components/dateRange/{DateRangePicker.vue.d.ts → v3/DateRangePicker.vue.d.ts} +9 -9
  68. package/components/dateRange/{index.d.ts → v3/index.d.ts} +21 -21
  69. package/components/dateRange/v4/CalendarMonthV4.vue.d.ts +75 -0
  70. package/components/dateRange/v4/CalendarMonthV4.vue.js +7 -0
  71. package/components/dateRange/v4/CalendarMonthV4.vue2.js +132 -0
  72. package/components/dateRange/v4/DateRangePickerV4.vue.d.ts +115 -0
  73. package/components/dateRange/v4/DateRangeV4.vue.d.ts +127 -0
  74. package/components/dateRange/v4/DateRangeV4.vue.js +7 -0
  75. package/components/dateRange/v4/DateRangeV4.vue2.js +262 -0
  76. package/components/dateRange/v4/index.d.ts +408 -0
  77. package/components/dateRange/v4/index.js +6 -0
  78. package/components/dialog/v4/DialogV4.vue.js +3 -3
  79. package/components/dialog/v4/DialogV4.vue2.js +67 -62
  80. package/components/dropdown/common/Dropdown.common.js +21 -21
  81. package/components/dropdown/v3/Dropdown.vue.d.ts +4 -0
  82. package/components/dropdown/v3/Dropdown.vue.js +4 -4
  83. package/components/dropdown/v3/Dropdown.vue2.js +32 -32
  84. package/components/dropdown/v3/index.d.ts +13 -1
  85. package/components/dropdown/v4/AppDropdownTrigger.vue.d.ts +2 -0
  86. package/components/dropdown/v4/AppDropdownTrigger.vue.js +2 -2
  87. package/components/dropdown/v4/AppDropdownTrigger.vue2.js +16 -16
  88. package/components/dropdown/v4/ChipDropdownTrigger.vue.js +2 -2
  89. package/components/dropdown/v4/ChipDropdownTrigger.vue2.js +1 -1
  90. package/components/dropdown/v4/DefaultDropdownTrigger.vue.js +2 -2
  91. package/components/dropdown/v4/DefaultDropdownTrigger.vue2.js +40 -49
  92. package/components/dropdown/v4/DropdownV4.vue.d.ts +16 -0
  93. package/components/dropdown/v4/DropdownV4.vue.js +3 -3
  94. package/components/dropdown/v4/DropdownV4.vue2.js +140 -128
  95. package/components/dropdown/v4/OptionV4.vue.d.ts +11 -0
  96. package/components/dropdown/v4/OptionV4.vue.js +3 -3
  97. package/components/dropdown/v4/OptionV4.vue2.js +61 -44
  98. package/components/dropdown/v4/index.d.ts +105 -4
  99. package/components/filtersPanel/v3/Filter.d.ts +1 -1
  100. package/components/forms/FormCard.vue.js +2 -2
  101. package/components/forms/FormCard.vue2.js +9 -9
  102. package/components/inlineCopy/InlineCopy.vue.d.ts +6 -2
  103. package/components/inlineCopy/InlineCopy.vue.js +3 -3
  104. package/components/inlineCopy/InlineCopy.vue2.js +23 -22
  105. package/components/inlineCopy/index.d.ts +6 -2
  106. package/components/input/v4/TextField.vue.d.ts +5 -0
  107. package/components/input/v4/TextField.vue.js +2 -2
  108. package/components/input/v4/TextField.vue2.js +43 -43
  109. package/components/input/v4/index.d.ts +20 -1
  110. package/components/multibar/MultiBar.vue.js +3 -3
  111. package/components/multibar/MultiBar.vue2.js +21 -21
  112. package/components/shared/FieldLabel.vue.js +3 -3
  113. package/components/shared/FieldLabel.vue2.js +9 -9
  114. package/components/table/v4/DataGrid.vue.d.ts +4 -0
  115. package/components/table/v4/DataGrid.vue.js +3 -3
  116. package/components/table/v4/DataGrid.vue2.js +147 -147
  117. package/components/table/v4/index.d.ts +14 -2
  118. package/components/textArea/v4/TextAreaV4.vue.js +3 -3
  119. package/components/textArea/v4/TextAreaV4.vue2.js +1 -1
  120. package/components/tooltip/v4/TooltipV4.vue.d.ts +6 -2
  121. package/components/tooltip/v4/TooltipV4.vue.js +2 -2
  122. package/components/tooltip/v4/TooltipV4.vue2.js +21 -19
  123. package/components/tooltip/v4/index.d.ts +17 -5
  124. package/index.d.ts +1512 -34
  125. package/index.js +116 -116
  126. package/package.json +13 -6
  127. package/AppDropdownTrigger.vue_vue_type_style_index_0_scoped_0267d003_lang.css +0 -1
  128. package/AppHeader.vue_vue_type_style_index_0_scoped_c148fc7a_lang.css +0 -1
  129. package/Autocomplete.vue_vue_type_style_index_0_scoped_d2d1dc1d_lang.css +0 -1
  130. package/CalendarMonth.vue_vue_type_style_index_0_scoped_b2206adb_lang.css +0 -1
  131. package/ChipDropdownTrigger.vue_vue_type_style_index_0_scoped_889042cf_lang.css +0 -1
  132. package/DataGrid.vue_vue_type_style_index_0_scoped_c96fba2c_lang.css +0 -1
  133. package/DatePicker.vue_vue_type_style_index_0_scoped_e108ef3b_lang.css +0 -1
  134. package/DatePickerMonth.vue_vue_type_style_index_0_scoped_b171cdab_lang.css +0 -1
  135. package/DateRange.vue_vue_type_style_index_0_scoped_eb5d155e_lang.css +0 -1
  136. package/DefaultDropdownTrigger.vue_vue_type_style_index_0_scoped_c3033d90_lang.css +0 -1
  137. package/DialogV4.vue_vue_type_style_index_0_scoped_c3004ba3_lang.css +0 -1
  138. package/Dropdown.vue_vue_type_style_index_0_scoped_d4f8e790_lang.css +0 -1
  139. package/DropdownV4.vue_vue_type_style_index_0_scoped_bf8e7ff5_lang.css +0 -1
  140. package/FieldLabel.vue_vue_type_style_index_0_scoped_72ab1f25_lang.css +0 -1
  141. package/InlineCopy.vue_vue_type_style_index_0_scoped_ff9f4a0f_lang.css +0 -1
  142. package/MultiBar.vue_vue_type_style_index_0_scoped_b473b35e_lang.css +0 -1
  143. package/OptionV4.vue_vue_type_style_index_0_scoped_b8375219_lang.css +0 -1
  144. package/TextAreaV4.vue_vue_type_style_index_0_scoped_0336a92f_lang.css +0 -1
  145. package/TextField.vue_vue_type_style_index_0_scoped_01778240_lang.css +0 -1
  146. package/TooltipV4.vue_vue_type_style_index_0_scoped_25809092_lang.css +0 -1
  147. package/components/datePicker/DatePicker.vue.js +0 -7
  148. package/components/datePicker/DatePicker.vue2.js +0 -97
  149. package/components/datePicker/DatePickerMonth.vue.js +0 -7
  150. package/components/datePicker/DatePickerMonth.vue2.js +0 -85
  151. package/components/dateRange/CalendarMonth.vue.js +0 -7
  152. package/components/dateRange/CalendarMonth.vue2.js +0 -244
  153. package/components/dateRange/DateRange.vue.js +0 -7
  154. package/components/dateRange/DateRange.vue2.js +0 -417
  155. package/components/dateRange/DateServices.js +0 -245
  156. /package/components/datePicker/{DatePickerMonth.vue.d.ts → v3/DatePickerMonth.vue.d.ts} +0 -0
  157. /package/components/datePicker/{index.js → v3/index.js} +0 -0
  158. /package/components/dateRange/{consts.d.ts → common/consts.common.d.ts} +0 -0
  159. /package/components/dateRange/{index.js → v3/index.js} +0 -0
@@ -1,417 +0,0 @@
1
- import "../../DateRange.vue_vue_type_style_index_0_scoped_eb5d155e_lang.css"; import { defineComponent as Pe, ref as r, computed as Y, onMounted as be, onBeforeMount as xe, onUnmounted as Oe, watch as de, openBlock as D, createElementBlock as C, unref as d, normalizeClass as P, createElementVNode as i, renderSlot as ue, toDisplayString as O, setBlockTracking as q, withDirectives as K, Fragment as J, renderList as Q, createVNode as N, withCtx as A, createTextVNode as B, createCommentVNode as ie, vShow as V, normalizeStyle as Ne } from "vue";
2
- import { onClickOutside as Fe } from "@vueuse/core";
3
- import { useToggle as Le } from "../../composables/useToggle.js";
4
- import Ue from "./CalendarMonth.vue.js";
5
- import p from "./DateServices.js";
6
- import { typeToName as Re, messagePerType as We, presetsList as Ye, formatError as qe, mandatoryValuesError as Ae, navigatePrev as ce, navigateNext as fe } from "./consts.js";
7
- import ve from "../button/v3/Button.vue.js";
8
- import "../button/v3/IconButton.vue.js";
9
- import "../button/v3/ScrollButton.vue.js";
10
- import "../typography/Heading.vue.js";
11
- import me from "../typography/Text.vue.js";
12
- import { min as Be, addDays as ze, format as ge } from "date-fns";
13
- import { DateRangeTestIdModifiers as E } from "../../testids/index.js";
14
- const He = ["id", "data-testid"], je = ["data-testid"], Ge = ["id", "data-testid"], Ke = {
15
- key: 0,
16
- class: "type-picker"
17
- }, Je = ["onClick"], Qe = ["data-testid"], Ve = ["id"], Xe = ["id"], Ze = ["onClick"], _e = { class: "dropdown-rightTriangle" }, et = ["data-testid"], tt = { class: "date-picker-calendar left-box" }, at = { class: "buttons-cover" }, nt = { class: "range" }, pt = /* @__PURE__ */ Pe({
18
- __name: "DateRange",
19
- props: {
20
- range: null,
21
- types: { default: () => ["date"] },
22
- includeToday: { type: Boolean, default: !0 },
23
- allowedDays: { default: null },
24
- maxDaysInRange: { default: null },
25
- datePresetList: { default: "date" },
26
- regex: { default: () => /^(1[0-2]|0?[1-9])\/[\d]{1,2}\/[\d]{4}$/ },
27
- dateFormat: { default: "mm/dd/yyyy" },
28
- uniqueId: { default: Date.now() },
29
- disabled: { type: Boolean, default: !1 },
30
- initialType: { default: null },
31
- openOnTop: { type: Boolean, default: !1 },
32
- showPresets: { type: Boolean, default: !0 },
33
- maxDate: { default: null },
34
- testId: { default: "" }
35
- },
36
- emits: [
37
- "rangeTypeChanged",
38
- "currentDateChanged",
39
- "rangeChanged",
40
- "dateRangePresetNameChanged",
41
- "opened",
42
- "dismissed"
43
- ],
44
- setup(s, { emit: M }) {
45
- const o = s, X = r(null), y = r({ started: !1, date: null }), Z = r(!1), _ = 2, F = r({ from: null, to: null }), u = r({}), m = r([]), $ = r(null), f = r({}), L = r({}), b = r(!1), S = r(null), c = r(null), ee = r("left"), x = r(null), U = r(null), I = r([]), te = r(null), [k] = Le({ initialValue: !1 }), ae = r(null);
46
- Fe(ae, () => {
47
- k.value = !1;
48
- });
49
- const z = (e, t) => {
50
- const a = {
51
- weeks: [],
52
- days: {},
53
- month: e,
54
- year: t
55
- };
56
- let n, l;
57
- const g = new Date(t, e, 1).getDay();
58
- let h = 1;
59
- const v = /* @__PURE__ */ new Date();
60
- v.setHours(0, 0, 0, 0);
61
- const Ie = p.daysInMonth(e, t);
62
- for (let j = 0; j < 6; j++) {
63
- l = [];
64
- for (let G = 0; G < 7; G++)
65
- n = {}, j === 0 && g > 0 && G < g && (n.value = 0), h > Ie && (n.value = 0), !n.value && n.value !== 0 && (n.value = h, h += 1, a.days[n.value] = n, n.date = new Date(t, e, n.value), v < n.date ? n.isFuture = !0 : n.date.getTime() === v.getTime() && (n.isToday = !0, o.includeToday || (n.disabled = !0))), l.push(n);
66
- a.weeks.push(l);
67
- }
68
- return a;
69
- }, R = () => {
70
- let e = p.getCurrentTimeUTC();
71
- if (c.value && c.value.toEnd ? e = c.value.toEnd : o.range && o.range.to && (e = o.range.to), !u.value[`${e.getFullYear().toString()}_${e.getMonth().toString()}`]) {
72
- u.value = {}, m.value = [];
73
- for (let t = 0; t < _; t++) {
74
- const a = new Date(e);
75
- a.setDate(1), a.setMonth(e.getMonth() - t);
76
- const n = `${a.getFullYear().toString()}_${a.getMonth().toString()}`;
77
- u.value[n] = {
78
- parsedMonth: z(a.getMonth(), a.getFullYear()),
79
- order: t
80
- }, m.value.unshift(n);
81
- }
82
- }
83
- }, ne = (e, t) => {
84
- S.value = e;
85
- let a = e;
86
- e === "date" && (a = o.datePresetList), I.value = Ye[a], t && (c.value = {
87
- fromStart: null,
88
- fromEnd: null,
89
- toStart: null,
90
- toEnd: null
91
- }, F.value.from = "", F.value.to = "", y.value = { started: !1, date: null }, f.value = "custom"), M("rangeTypeChanged", S.value);
92
- }, he = (e) => {
93
- f.value = e.id, T($.value[e.id].dates()), R();
94
- }, T = (e, t = !1) => {
95
- let a = e;
96
- return (!e || !e.from && !e.to) && (a = $.value[I.value[0]]), o.maxDaysInRange && (te.value = t ? ze(a.from, o.maxDaysInRange) : null), b.value = !1, !a.from || !a.to || !(a.from instanceof Date) || !(a.to instanceof Date) ? (U.value = qe, b.value = !0, !1) : a.from > a.to ? (U.value = `"From" date can't be bigger than "To" date`, b.value = !0, !1) : (c.value = De(a), F.value.from = ge(
97
- c.value.fromStart,
98
- o.dateFormat
99
- ), F.value.to = ge(c.value.toEnd, o.dateFormat), !0);
100
- }, H = () => {
101
- f.value === "custom" ? x.value = p.getDateRangeString(c.value) : x.value = Ee.value, M("currentDateChanged", x.value);
102
- }, pe = () => {
103
- if (c.value.fromStart == null || c.value.toEnd == null) {
104
- b.value = !0, U.value = Ae;
105
- return;
106
- }
107
- const e = p.getCurrentTimeUTC();
108
- c.value.toEnd > e && (c.value.toEnd = e), H(), L.value = f.value, M("rangeChanged", {
109
- from: c.value.fromStart,
110
- to: c.value.toEnd,
111
- preset: L.value
112
- }), W(!1);
113
- }, ye = (e, t) => e ? ce : t ? fe : null, ke = (e) => {
114
- let t = null, a = null;
115
- const n = _ - 1;
116
- let l = "", w = null, g = null;
117
- switch (e) {
118
- case fe:
119
- Object.keys(u.value).forEach((h) => {
120
- const v = u.value[h];
121
- v.order === 0 && (w = v), v.order === n ? (m.value.splice(
122
- m.value.indexOf(h),
123
- 1
124
- ), delete u.value[h]) : v.order += 1;
125
- }), t = w.parsedMonth.month + 1, a = w.parsedMonth.year, t > 11 && (t = 0, a += 1), l = `${a.toString()}_${t.toString()}`, u.value[l] = {
126
- parsedMonth: z(t, a),
127
- order: 0
128
- }, m.value.push(l);
129
- break;
130
- case ce:
131
- Object.keys(u.value).forEach((h) => {
132
- const v = u.value[h];
133
- v.order === n && (g = v), v.order === 0 ? (m.value.splice(
134
- m.value.indexOf(h),
135
- 1
136
- ), delete u.value[h]) : v.order -= 1;
137
- }), t = g.parsedMonth.month - 1, a = g.parsedMonth.year, t < 0 && (t = 11, a -= 1), l = `${a.toString()}_${t.toString()}`, u.value[l] = {
138
- parsedMonth: z(t, a),
139
- order: n
140
- }, m.value.unshift(l);
141
- break;
142
- }
143
- }, De = (e) => {
144
- let t;
145
- switch (S.value) {
146
- case "week":
147
- t = {
148
- fromStart: p.getFirstDayOfWeek(e.from),
149
- fromEnd: p.getLastDayOfWeek(e.from),
150
- toStart: p.getFirstDayOfWeek(e.to),
151
- toEnd: p.getLastDayOfWeek(e.to)
152
- };
153
- break;
154
- case "month":
155
- t = {
156
- fromStart: new Date(
157
- e.from.getFullYear(),
158
- e.from.getMonth(),
159
- 1
160
- ),
161
- fromEnd: p.getLastDayOfMonth(e.from),
162
- toStart: new Date(
163
- e.to.getFullYear(),
164
- e.to.getMonth(),
165
- 1
166
- ),
167
- toEnd: p.getLastDayOfMonth(e.to)
168
- };
169
- break;
170
- case "date":
171
- default:
172
- t = {
173
- fromStart: e.from,
174
- fromEnd: e.from,
175
- toStart: e.to,
176
- toEnd: e.to
177
- };
178
- break;
179
- }
180
- return t;
181
- }, le = (e, t) => e.getUTCFullYear() === t.getUTCFullYear() && e.getUTCMonth() === t.getUTCMonth() && e.getUTCDate() === t.getUTCDate(), se = (e) => {
182
- let t = !1;
183
- const a = {
184
- from: new Date(e.from),
185
- to: new Date(e.to)
186
- };
187
- a.from.setHours(0, 0, 0, 0), a.to.setHours(0, 0, 0, 0);
188
- const n = I.value.map((l) => l.id);
189
- if (Object.keys($.value).forEach((l) => {
190
- const w = $.value[l];
191
- if (l !== "custom" && !t && n.indexOf(l) !== -1) {
192
- const g = w.dates();
193
- g.from.setHours(0, 0, 0, 0), g.to.setHours(0, 0, 0, 0), le(g.from, a.from) && le(g.to, a.to) && (f.value = l, t = !0);
194
- }
195
- }), t) {
196
- const l = I.value.find(
197
- (w) => w.id === f.value
198
- );
199
- M("dateRangePresetNameChanged", l.name);
200
- } else
201
- M("dateRangePresetNameChanged", null), f.value = "custom";
202
- L.value = f.value;
203
- }, oe = (e, t, a) => {
204
- if (!y.value.started)
205
- f.value = "custom", y.value.started = !0, y.value.date = new Date(a, t, e.value), T(
206
- { from: y.value.date, to: y.value.date },
207
- !0
208
- );
209
- else {
210
- const n = new Date(a, t, e.value), l = y.value.date;
211
- y.value.started = !1, y.value.date = null, n < l ? oe(e, t, a) : T({ from: l, to: n });
212
- }
213
- }, Ce = () => {
214
- const e = X.value.offsetLeft;
215
- return window.innerWidth - e > 930 ? "left" : "right";
216
- }, W = (e = !0) => {
217
- k.value = !k.value, k.value ? (ee.value = Ce(), T(o.range), R(), M("opened")) : (T(o.range), R(), f.value = L.value, e && M("dismissed"));
218
- }, we = () => {
219
- k.value && W();
220
- }, Me = () => {
221
- $.value = p.getPresetsFunctions(o.includeToday), $.value.custom = {
222
- dates: () => o.range
223
- };
224
- }, Te = Y(() => (m.value || []).reduce((e, t) => {
225
- const n = u.value[t].parsedMonth.weeks[u.value[t].parsedMonth.weeks.length - 1].filter(
226
- (l) => l.value !== 0
227
- ).length;
228
- return e && !n;
229
- }, !0)), re = () => {
230
- o.range && (Z.value = !0, ne(o.initialType || o.types[0]), Me(), se(o.range), T(o.range), R(), H());
231
- };
232
- be(() => {
233
- re();
234
- }), xe(() => {
235
- const e = (t) => {
236
- t.key === "Escape" && k.value && we();
237
- };
238
- document.addEventListener("keyup", e), Oe(() => {
239
- document.removeEventListener("keyup", e);
240
- });
241
- }), de(
242
- () => o.range,
243
- (e, t) => {
244
- e && e !== t && (Z.value ? (se(e), T(e), H()) : re());
245
- }
246
- ), de(k, (e) => {
247
- e || (y.value.started = !1);
248
- });
249
- const Ee = Y(() => {
250
- const e = I.value.find(
251
- (t) => t.id === f.value
252
- );
253
- return e ? e.name : "";
254
- }), $e = Y(() => `datepicker${o.uniqueId}`), Se = Y(() => {
255
- const e = [o.maxDate, te.value].filter((t) => t);
256
- return e.length ? Be(e) : null;
257
- });
258
- return (e, t) => (D(), C("div", {
259
- id: d($e),
260
- ref_key: "datePicker",
261
- ref: X,
262
- class: P(["relative-wrap", { "date-range-disabled": s.disabled }]),
263
- "data-testid": `${s.testId}-${d(E).WRAPPER}`
264
- }, [
265
- i("div", {
266
- class: "date-range-field",
267
- "data-testid": `${s.testId}-${d(E).TRIGGER}`,
268
- onClick: t[1] || (t[1] = (a) => W())
269
- }, [
270
- ue(e.$slots, "field", {
271
- currentDate: x.value,
272
- isOpen: d(k)
273
- }, () => [
274
- i("span", null, O(x.value), 1),
275
- t[0] || (q(-1), t[0] = i("div", { class: "small-triangle" }), q(1), t[0])
276
- ], !0)
277
- ], 8, je),
278
- K(i("div", {
279
- id: "datepickerPopup" + s.uniqueId,
280
- ref_key: "popup",
281
- ref: ae,
282
- class: P(["pop-up", [
283
- ee.value,
284
- s.openOnTop ? "open-on-top" : "",
285
- s.showPresets ? "" : "hide-presets"
286
- ]]),
287
- "data-testid": `${s.testId}-${d(E).CONTAINER}`
288
- }, [
289
- s.types.length > 1 ? (D(), C("div", Ke, [
290
- (D(!0), C(J, null, Q(s.types, (a) => (D(), C("span", {
291
- key: a,
292
- class: P(["range-type", { "selected-range-type": S.value === a }]),
293
- onClick: (n) => ne(a, !0)
294
- }, [
295
- N(d(me), { size: "sm" }, {
296
- default: A(() => [
297
- B(O(d(Re)[a]), 1)
298
- ]),
299
- _: 2
300
- }, 1024)
301
- ], 10, Je))), 128))
302
- ])) : ie("", !0),
303
- i("div", {
304
- class: P(["flex", { "pop-up-content": s.types.length > 1 }])
305
- }, [
306
- s.showPresets ? (D(), C("div", {
307
- key: 0,
308
- class: "date-picker-menu",
309
- "data-testid": `${s.testId}-${d(E).MENU}`
310
- }, [
311
- i("div", {
312
- id: "presets" + s.uniqueId,
313
- class: "preset-dropdown"
314
- }, [
315
- i("ul", {
316
- id: "customDropDownList" + s.uniqueId
317
- }, [
318
- (D(!0), C(J, null, Q(I.value, (a) => (D(), C("li", {
319
- key: a.id,
320
- class: P({
321
- "selected-preset-container": f.value === a.id
322
- })
323
- }, [
324
- i("div", {
325
- class: P([{ "selected-preset": f.value === a.id }, "preset-element"]),
326
- onClick: (n) => he(a)
327
- }, [
328
- N(d(me), { size: "sm" }, {
329
- default: A(() => [
330
- B(O(a.name), 1)
331
- ]),
332
- _: 2
333
- }, 1024)
334
- ], 10, Ze),
335
- K(i("div", _e, null, 512), [
336
- [V, a.id === "custom"]
337
- ])
338
- ], 2))), 128))
339
- ], 8, Xe)
340
- ], 8, Ve),
341
- i("div", {
342
- class: "type-message",
343
- "data-testid": `${s.testId}-${d(E).MESSAGE}`
344
- }, O(d(We)[S.value]), 9, et)
345
- ], 8, Qe)) : ie("", !0),
346
- i("div", {
347
- class: "calendar-wrap",
348
- style: Ne({ height: d(Te) ? "336px" : "372px" })
349
- }, [
350
- i("div", tt, [
351
- (D(!0), C(J, null, Q(m.value, (a, n) => (D(), C("div", { key: a }, [
352
- N(Ue, {
353
- id: s.uniqueId,
354
- navigation: ye(
355
- n === 0,
356
- n === m.value.length - 1
357
- ),
358
- year: u.value[a].parsedMonth.year,
359
- days: u.value[a].parsedMonth.days,
360
- weeks: u.value[a].parsedMonth.weeks,
361
- month: u.value[a].parsedMonth.month,
362
- range: c.value,
363
- type: S.value,
364
- "allowed-days": s.allowedDays,
365
- "max-allowed-date": d(Se),
366
- "test-id": `${s.testId}-${n}`,
367
- onSelectionChanged: oe,
368
- onNavigation: ke
369
- }, null, 8, ["id", "navigation", "year", "days", "weeks", "month", "range", "type", "allowed-days", "max-allowed-date", "test-id"])
370
- ]))), 128)),
371
- i("div", at, [
372
- i("div", nt, [
373
- ue(e.$slots, "footer", {}, void 0, !0)
374
- ]),
375
- K(i("div", { class: "error" }, O(U.value), 513), [
376
- [V, b.value]
377
- ]),
378
- t[2] || (q(-1), t[2] = i("div", { class: "buttons" }, [
379
- N(d(ve), {
380
- id: "button-ok" + s.uniqueId,
381
- size: "sm",
382
- class: "primary button small",
383
- "data-testid": `${s.testId}-${d(E).ACTION_APPLY}`,
384
- onClick: (a) => pe()
385
- }, {
386
- default: A(() => [
387
- B(" Apply ")
388
- ]),
389
- _: 1
390
- }, 8, ["id", "data-testid", "onClick"]),
391
- N(d(ve), {
392
- id: "button-cancel" + s.uniqueId,
393
- size: "sm",
394
- theme: "third",
395
- class: "button small border third transparent",
396
- "data-testid": `${s.testId}-${d(E).ACTION_CANCEL}`,
397
- onClick: (a) => W()
398
- }, {
399
- default: A(() => [
400
- B(" Cancel ")
401
- ]),
402
- _: 1
403
- }, 8, ["id", "data-testid", "onClick"])
404
- ]), q(1), t[2])
405
- ])
406
- ])
407
- ], 4)
408
- ], 2)
409
- ], 10, Ge), [
410
- [V, d(k)]
411
- ])
412
- ], 10, He));
413
- }
414
- });
415
- export {
416
- pt as default
417
- };
@@ -1,245 +0,0 @@
1
- import { isSameDay as C, format as l } from "date-fns";
2
- const m = "MMM d, yyyy", u = 7;
3
- class c {
4
- // eslint-disable-next-line class-methods-use-this
5
- getCurrentTimeUTC() {
6
- const n = /* @__PURE__ */ new Date();
7
- return new Date(n.getTime() + n.getTimezoneOffset() * 6e4);
8
- }
9
- // eslint-disable-next-line class-methods-use-this
10
- daysInMonth(n, a) {
11
- return 32 - new Date(a, n, 32).getDate();
12
- }
13
- // eslint-disable-next-line consistent-return
14
- getDateRangeString(n) {
15
- if (C(n.fromStart, n.toEnd))
16
- return l(n.fromStart, m);
17
- if (n.fromStart && n.toEnd)
18
- return `${l(n.fromStart, m)} - ${l(
19
- n.toEnd,
20
- m
21
- )}`;
22
- }
23
- // eslint-disable-next-line class-methods-use-this
24
- getFirstDayOfWeek(n) {
25
- const a = new Date(n), r = a.getDay(), s = a.getDate() - r;
26
- return a.setDate(s), a;
27
- }
28
- getLastDayOfWeek(n) {
29
- let a = new Date(n);
30
- const r = a.getDay(), s = a.getDate() + (6 - r);
31
- a.setDate(s);
32
- const e = this.getCurrentTimeUTC();
33
- return a > e && (a = e), a;
34
- }
35
- getLastDayOfMonth(n) {
36
- const a = this.getCurrentTimeUTC();
37
- let r = new Date(n.getFullYear(), n.getMonth() + 1, 0);
38
- return r > a && (r = a), r;
39
- }
40
- createMonth(n, a, r = !0, t = !0) {
41
- const s = {
42
- weeks: [],
43
- days: {},
44
- month: n,
45
- year: a
46
- };
47
- let e, o;
48
- const T = new Date(a, n, 1).getDay();
49
- let D = 1;
50
- const i = /* @__PURE__ */ new Date();
51
- i.setHours(0, 0, 0, 0);
52
- const g = this.daysInMonth(n, a);
53
- for (let d = 0; d < 6; d++) {
54
- o = [];
55
- for (let f = 0; f < 7; f++)
56
- e = {}, d === 0 && T > 0 && f < T && (e.value = 0), D > g && (e.value = 0), !e.value && e.value !== 0 && (e.value = D, D += 1, s.days[e.value] = e, e.date = new Date(a, n, e.value), i < e.date && t ? e.isFuture = !0 : e.date.getTime() === i.getTime() && (e.isToday = !0, r || (e.disabled = !0))), o.push(e);
57
- s.weeks.push(o);
58
- }
59
- return s;
60
- }
61
- // eslint-disable-next-line class-methods-use-this
62
- getPresetsFunctions(n = !0) {
63
- const a = n, r = this;
64
- return {
65
- today: {
66
- dates() {
67
- const t = {};
68
- return (t.from = r.getCurrentTimeUTC()).setHours(0, 0, 0, 0), (t.to = new Date(t.from)).setHours(23, 59, 59, 0), t;
69
- }
70
- },
71
- yesterday: {
72
- dates() {
73
- const t = {};
74
- return t.from = new Date(
75
- r.getCurrentTimeUTC() - 24 * 3600 * 1e3
76
- ), (t.to = new Date(t.from)).setHours(23, 59, 59, 0), t;
77
- }
78
- },
79
- last7days: {
80
- dates() {
81
- const t = {};
82
- let s = 0, e = 6 * 24 * 3600 * 1e3;
83
- return a || (s = 24 * 3600 * 1e3, e = 7 * 24 * 3600 * 1e3), t.from = new Date(
84
- r.getCurrentTimeUTC() - e
85
- ), t.to = new Date(
86
- r.getCurrentTimeUTC().setHours(23, 59, 59, 0) - s
87
- ), t;
88
- }
89
- },
90
- last14days: {
91
- dates() {
92
- const t = {};
93
- let s = 0, e = 13 * 24 * 3600 * 1e3;
94
- return a || (s = 24 * 3600 * 1e3, e = 14 * 24 * 3600 * 1e3), t.from = new Date(
95
- r.getCurrentTimeUTC() - e
96
- ), t.to = new Date(
97
- r.getCurrentTimeUTC().setHours(23, 59, 59, 0) - s
98
- ), t;
99
- }
100
- },
101
- last30days: {
102
- dates() {
103
- const t = {};
104
- let s = 0, e = 29 * 24 * 3600 * 1e3;
105
- return a || (s = 24 * 3600 * 1e3, e = 30 * 24 * 3600 * 1e3), t.from = new Date(
106
- r.getCurrentTimeUTC() - e
107
- ), t.to = new Date(
108
- r.getCurrentTimeUTC().setHours(23, 59, 59, 0) - s
109
- ), t;
110
- }
111
- },
112
- last31days: {
113
- dates() {
114
- const t = {};
115
- let s = 0, e = 30 * 24 * 3600 * 1e3;
116
- return a || (s = 24 * 3600 * 1e3, e = 31 * 24 * 3600 * 1e3), t.from = new Date(
117
- r.getCurrentTimeUTC() - e
118
- ), t.to = new Date(
119
- r.getCurrentTimeUTC().setHours(23, 59, 59, 0) - s
120
- ), t;
121
- }
122
- },
123
- last60days: {
124
- dates() {
125
- const t = {};
126
- let s = 0, e = 59 * 24 * 3600 * 1e3;
127
- return a || (s = 24 * 3600 * 1e3, e = 60 * 24 * 3600 * 1e3), t.from = new Date(
128
- r.getCurrentTimeUTC() - e
129
- ), t.to = new Date(
130
- r.getCurrentTimeUTC().setHours(23, 59, 59, 0) - s
131
- ), t;
132
- }
133
- },
134
- last90days: {
135
- dates() {
136
- const t = {};
137
- let s = 0, e = 89 * 24 * 3600 * 1e3;
138
- return a || (s = 24 * 3600 * 1e3, e = 90 * 24 * 3600 * 1e3), t.from = new Date(
139
- r.getCurrentTimeUTC() - e
140
- ), t.to = new Date(
141
- r.getCurrentTimeUTC().setHours(23, 59, 59, 0) - s
142
- ), t;
143
- }
144
- },
145
- thisMonth: {
146
- dates() {
147
- const t = {}, s = /* @__PURE__ */ new Date(), e = new Date(s.getFullYear(), s.getMonth(), 1);
148
- if (a)
149
- (t.to = r.getCurrentTimeUTC()).setHours(0, 0, 0, 0);
150
- else {
151
- const o = new Date(
152
- r.getCurrentTimeUTC().setHours(0, 0, 0, 0) - 864e5
153
- );
154
- o < e ? t.to = e : t.to = o;
155
- }
156
- return t.from = e, t;
157
- }
158
- },
159
- lastMonth: {
160
- dates() {
161
- const t = {}, s = /* @__PURE__ */ new Date();
162
- return t.from = new Date(s.getFullYear(), s.getMonth() - 1, 1), t.to = new Date(s.getFullYear(), s.getMonth(), 0), t;
163
- }
164
- },
165
- last4weeks: {
166
- dates() {
167
- const t = {}, s = r.getCurrentTimeUTC(), e = r.getFirstDayOfWeek(s);
168
- return t.from = new Date(
169
- e.setDate(e.getDate() - u * 3)
170
- ), t.to = new Date(s.setHours(23, 59, 59, 0)), t;
171
- }
172
- },
173
- last12weeks: {
174
- dates() {
175
- const t = {}, s = r.getCurrentTimeUTC(), e = r.getFirstDayOfWeek(s);
176
- return t.from = new Date(
177
- e.setDate(e.getDate() - u * 11)
178
- ), t.to = new Date(s.setHours(23, 59, 59, 0)), t;
179
- }
180
- },
181
- last26weeks: {
182
- dates() {
183
- const t = {}, s = r.getCurrentTimeUTC(), e = r.getFirstDayOfWeek(s);
184
- return t.from = new Date(
185
- e.setDate(e.getDate() - u * 25)
186
- ), t.to = new Date(s.setHours(23, 59, 59, 0)), t;
187
- }
188
- },
189
- last52weeks: {
190
- dates() {
191
- const t = {}, s = r.getCurrentTimeUTC(), e = r.getFirstDayOfWeek(s);
192
- return t.from = new Date(
193
- e.setDate(e.getDate() - u * 51)
194
- ), t.to = new Date(s.setHours(23, 59, 59, 0)), t;
195
- }
196
- },
197
- last3months: {
198
- dates() {
199
- const t = {}, s = r.getCurrentTimeUTC(), e = new Date(s.getFullYear(), s.getMonth() - 2, 1);
200
- return (t.to = r.getCurrentTimeUTC()).setHours(0, 0, 0, 0), t.from = e, t;
201
- }
202
- },
203
- last6months: {
204
- dates() {
205
- const t = {}, s = r.getCurrentTimeUTC(), e = new Date(s.getFullYear(), s.getMonth() - 5, 1);
206
- return (t.to = r.getCurrentTimeUTC()).setHours(0, 0, 0, 0), t.from = e, t;
207
- }
208
- },
209
- last12months: {
210
- dates() {
211
- const t = {}, s = r.getCurrentTimeUTC(), e = new Date(
212
- s.getFullYear(),
213
- s.getMonth() - 11,
214
- 1
215
- );
216
- return (t.to = r.getCurrentTimeUTC()).setHours(0, 0, 0, 0), t.from = e, t;
217
- }
218
- },
219
- last24months: {
220
- dates() {
221
- const t = {}, s = r.getCurrentTimeUTC(), e = new Date(
222
- s.getFullYear(),
223
- s.getMonth() - 23,
224
- 1
225
- );
226
- return (t.to = r.getCurrentTimeUTC()).setHours(0, 0, 0, 0), t.from = e, t;
227
- }
228
- },
229
- last36months: {
230
- dates() {
231
- const t = {}, s = r.getCurrentTimeUTC(), e = new Date(
232
- s.getFullYear(),
233
- s.getMonth() - 35,
234
- 1
235
- );
236
- return (t.to = r.getCurrentTimeUTC()).setHours(0, 0, 0, 0), t.from = e, t;
237
- }
238
- }
239
- };
240
- }
241
- }
242
- const h = new c();
243
- export {
244
- h as default
245
- };
File without changes
File without changes