@oneb/ui-vue 0.3.13 → 0.3.15

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 (75) hide show
  1. package/dist/CheckIcon-09b84cf5.cjs +1 -0
  2. package/dist/CheckIcon-f1c94824.js +20 -0
  3. package/dist/ChevronDownIcon-6805ce6c.js +20 -0
  4. package/dist/ChevronDownIcon-6889ac87.cjs +1 -0
  5. package/dist/{ChevronRightIcon-8df1af46.js → ChevronRightIcon-4549a26b.js} +4 -21
  6. package/dist/ChevronRightIcon-7a2f0c20.cjs +1 -0
  7. package/dist/NoSymbolIcon-5d326416.cjs +1 -0
  8. package/dist/NoSymbolIcon-e58a9aee.js +71 -0
  9. package/dist/OneHelpMenu-66a2d4c2.cjs +1 -0
  10. package/dist/OneHelpMenu-d7a39a69.js +856 -0
  11. package/dist/OneMarkdown.vue_vue_type_style_index_0_lang-0ea8fbf8.cjs +1 -0
  12. package/dist/OneMarkdown.vue_vue_type_style_index_0_lang-4ed993c7.js +1 -0
  13. package/dist/{SpinnerIcon-516264ba.js → SpinnerIcon-74648c98.js} +6 -5
  14. package/dist/SpinnerIcon-ccb6f3fc.cjs +1 -0
  15. package/dist/SpinnerIcon.vue_vue_type_style_index_0_lang-0ea8fbf8.cjs +1 -0
  16. package/dist/SpinnerIcon.vue_vue_type_style_index_0_lang-4ed993c7.js +1 -0
  17. package/dist/button/index.cjs +1 -1
  18. package/dist/button/index.js +17 -16
  19. package/dist/buttonGroup/index.cjs +1 -0
  20. package/dist/buttonGroup/index.js +31 -0
  21. package/dist/checkbox/index.cjs +1 -0
  22. package/dist/checkbox/index.js +124 -0
  23. package/dist/collapse/index.cjs +1 -0
  24. package/dist/collapse/index.js +58 -0
  25. package/dist/common/index.cjs +1 -16
  26. package/dist/common/index.js +14 -3120
  27. package/dist/dataTable/index.cjs +1 -1
  28. package/dist/dataTable/index.js +846 -9
  29. package/dist/dropdown/index.cjs +1 -1
  30. package/dist/dropdown/index.js +792 -17
  31. package/dist/entityPicker/index.cjs +1 -0
  32. package/dist/entityPicker/index.js +584 -0
  33. package/dist/errorsPage/index.cjs +1 -0
  34. package/dist/errorsPage/index.js +63 -0
  35. package/dist/floating-ui.dom-2121a4fd.cjs +1 -0
  36. package/dist/floating-ui.dom-4509432e.js +941 -0
  37. package/dist/i18n/index.cjs +1 -0
  38. package/dist/{useI18n-2103b39e.js → i18n/index.js} +4 -4
  39. package/dist/index.cjs +1 -1
  40. package/dist/index.js +114 -10295
  41. package/dist/indicators/index.cjs +1 -0
  42. package/dist/indicators/index.js +84 -0
  43. package/dist/infobox/index.cjs +1 -0
  44. package/dist/infobox/index.js +111 -0
  45. package/dist/label/index.cjs +1 -0
  46. package/dist/label/index.js +47 -0
  47. package/dist/layout/index.cjs +1 -1
  48. package/dist/layout/index.js +115 -109
  49. package/dist/modal/index.cjs +1 -0
  50. package/dist/modal/index.js +41 -0
  51. package/dist/periodPicker/index.cjs +1 -0
  52. package/dist/periodPicker/index.js +1323 -0
  53. package/dist/radio/index.cjs +1 -0
  54. package/dist/radio/index.js +73 -0
  55. package/dist/skeleton/index.cjs +1 -0
  56. package/dist/skeleton/index.js +46 -0
  57. package/dist/style.css +1 -1
  58. package/dist/switch/index.cjs +1 -0
  59. package/dist/switch/index.js +142 -0
  60. package/dist/toast/index.cjs +1 -0
  61. package/dist/toast/index.js +140 -0
  62. package/dist/tooltip/index.cjs +1 -0
  63. package/dist/tooltip/index.js +20 -0
  64. package/dist/useModal-85f57682.js +177 -0
  65. package/dist/useModal-98810f6a.cjs +1 -0
  66. package/package.json +4 -4
  67. package/dist/ChevronRightIcon-6aa413c4.cjs +0 -1
  68. package/dist/OneHelpMenu-8e315cb3.js +0 -1791
  69. package/dist/OneHelpMenu-95ae3d5a.cjs +0 -1
  70. package/dist/SpinnerIcon-01be39fe.cjs +0 -1
  71. package/dist/index-19e93dfb.js +0 -954
  72. package/dist/index-85e729ab.cjs +0 -1
  73. package/dist/index-8b41a099.cjs +0 -1
  74. package/dist/index-98daa7ed.js +0 -862
  75. package/dist/useI18n-bcf9c640.cjs +0 -1
@@ -0,0 +1,1323 @@
1
+ import { openBlock as u, createElementBlock as p, createElementVNode as v, defineComponent as st, computed as f, createBlock as Q, unref as S, withCtx as At, normalizeStyle as xe, Fragment as q, renderList as Z, normalizeClass as c, toDisplayString as O, createCommentVNode as Y, ref as b, watch as ce, nextTick as K, onMounted as Rt, onUnmounted as Lt, withDirectives as he, withKeys as ke, vModelText as Ye, createVNode as J, Teleport as nt } from "vue";
2
+ import { a as Wt, c as Tt, o as qt, f as Ut, s as It } from "../floating-ui.dom-4509432e.js";
3
+ import { DatePicker as Ce } from "v-calendar";
4
+ import { OneButton as Pe } from "../button/index.js";
5
+ import { O as Et, u as Ft } from "../useModal-85f57682.js";
6
+ import { r as rt } from "../CheckIcon-f1c94824.js";
7
+ import { r as jt } from "../XMarkIcon-51ef0691.js";
8
+ import { r as Nt } from "../ChevronDownIcon-6805ce6c.js";
9
+ import { useOnebI18n as dt } from "../i18n/index.js";
10
+ import { _ as pt } from "../_plugin-vue_export-helper-dad06003.js";
11
+ import l from "dayjs";
12
+ import { default as Ka } from "dayjs";
13
+ import Kt from "dayjs/plugin/advancedFormat";
14
+ import Qt from "dayjs/plugin/isoWeek";
15
+ import Ht from "dayjs/plugin/quarterOfYear";
16
+ import Jt from "dayjs/plugin/utc";
17
+ import Xt from "dayjs/plugin/customParseFormat";
18
+ import "../SpinnerIcon-74648c98.js";
19
+ import "../SpinnerIcon.vue_vue_type_style_index_0_lang-4ed993c7.js";
20
+ function Ve(a, o) {
21
+ return u(), p("svg", {
22
+ xmlns: "http://www.w3.org/2000/svg",
23
+ fill: "none",
24
+ viewBox: "0 0 24 24",
25
+ "stroke-width": "1.8",
26
+ stroke: "currentColor",
27
+ "aria-hidden": "true"
28
+ }, [
29
+ v("path", {
30
+ "stroke-linecap": "round",
31
+ "stroke-linejoin": "round",
32
+ d: "M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 012.25-2.25h13.5A2.25 2.25 0 0121 7.5v11.25m-18 0A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75m-18 0v-7.5A2.25 2.25 0 015.25 9h13.5A2.25 2.25 0 0121 11.25v7.5"
33
+ })
34
+ ]);
35
+ }
36
+ function Zt(a, o) {
37
+ return u(), p("svg", {
38
+ xmlns: "http://www.w3.org/2000/svg",
39
+ fill: "none",
40
+ viewBox: "0 0 24 24",
41
+ "stroke-width": "1.8",
42
+ stroke: "currentColor",
43
+ "aria-hidden": "true"
44
+ }, [
45
+ v("path", {
46
+ "stroke-linecap": "round",
47
+ "stroke-linejoin": "round",
48
+ d: "M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z"
49
+ })
50
+ ]);
51
+ }
52
+ const $e = {
53
+ xs: {
54
+ trigger: "h-7 rounded-lg",
55
+ triggerButton: "gap-1.5 px-2 text-[11px]",
56
+ triggerIcon: "w-3.5 h-3.5",
57
+ triggerDivider: "h-4",
58
+ triggerAction: "w-6",
59
+ clearIcon: "w-4 h-4",
60
+ dropdown: "p-2 pt-1.5",
61
+ groupTitle: "text-xs font-semibold",
62
+ groupSubtitle: "text-[10px]",
63
+ presetLabel: "text-[10px]",
64
+ ctaButton: "!h-7 !rounded-lg !text-xs",
65
+ ctaButtonSize: "xs",
66
+ panelGap: "space-y-1.5",
67
+ tabButton: "h-6 rounded-md px-2 text-[11px]",
68
+ navTitle: "text-xs font-semibold",
69
+ actionButton: "!h-7 !rounded-lg !text-xs",
70
+ actionButtonSize: "xs",
71
+ actionGap: "gap-1.5 mt-1.5",
72
+ fastModalSize: "large",
73
+ vars: {
74
+ "--pp-group-padding": "8px",
75
+ "--pp-group-radius": "10px",
76
+ "--pp-group-min-h": "260px",
77
+ "--pp-group-max-h": "340px",
78
+ "--pp-group-list-max-h": "220px",
79
+ "--pp-option-px": "8px",
80
+ "--pp-option-py": "6px",
81
+ "--pp-option-text": "12px",
82
+ "--pp-option-desc": "10px",
83
+ "--pp-nav-size": "24px",
84
+ "--pp-month-h": "36px",
85
+ "--pp-month-text": "12px",
86
+ "--pp-input-h": "28px",
87
+ "--pp-input-text": "12px",
88
+ "--pp-input-px": "8px",
89
+ "--pp-input-radius": "8px",
90
+ "--vc-text-xs": "10px",
91
+ "--vc-text-sm": "11px",
92
+ "--vc-text-base": "13px",
93
+ "--vc-text-lg": "13px",
94
+ "--pp-vc-day-size": "23px",
95
+ "--pp-vc-pane-min-w": "172px",
96
+ "--pp-vc-weeks-min-w": "172px",
97
+ "--pp-vc-weeks-pad": "2px",
98
+ "--pp-vc-arrow-w": "24px",
99
+ "--pp-vc-arrow-h": "25px",
100
+ "--pp-fast-group-pad": "6px 8px",
101
+ "--pp-fast-list-max-h": "380px"
102
+ }
103
+ },
104
+ sm: {
105
+ trigger: "h-8 rounded-lg",
106
+ triggerButton: "gap-1.5 px-2.5 text-xs",
107
+ triggerIcon: "w-3.5 h-3.5",
108
+ triggerDivider: "h-5",
109
+ triggerAction: "w-7",
110
+ clearIcon: "w-4 h-4",
111
+ dropdown: "p-2.5 pt-2",
112
+ groupTitle: "text-sm font-semibold",
113
+ groupSubtitle: "text-xs",
114
+ presetLabel: "text-[11px]",
115
+ ctaButton: "!h-9 !rounded-lg",
116
+ ctaButtonSize: "sm",
117
+ panelGap: "space-y-2.5",
118
+ tabButton: "h-8 rounded-lg px-2.5 text-sm",
119
+ navTitle: "text-sm font-semibold",
120
+ actionButton: "!h-9 !rounded-lg",
121
+ actionButtonSize: "sm",
122
+ actionGap: "gap-2.5 mt-2.5",
123
+ fastModalSize: "large",
124
+ vars: {
125
+ "--pp-group-padding": "10px",
126
+ "--pp-group-radius": "10px",
127
+ "--pp-group-min-h": "290px",
128
+ "--pp-group-max-h": "380px",
129
+ "--pp-group-list-max-h": "250px",
130
+ "--pp-option-px": "10px",
131
+ "--pp-option-py": "6px",
132
+ "--pp-option-text": "14px",
133
+ "--pp-option-desc": "11px",
134
+ "--pp-nav-size": "28px",
135
+ "--pp-month-h": "40px",
136
+ "--pp-month-text": "14px",
137
+ "--pp-input-h": "32px",
138
+ "--pp-input-text": "14px",
139
+ "--pp-input-px": "10px",
140
+ "--pp-input-radius": "8px",
141
+ "--vc-text-xs": "11px",
142
+ "--vc-text-sm": "13px",
143
+ "--vc-text-base": "15px",
144
+ "--vc-text-lg": "15px",
145
+ "--pp-vc-day-size": "26px",
146
+ "--pp-vc-pane-min-w": "188px",
147
+ "--pp-vc-weeks-min-w": "188px",
148
+ "--pp-vc-weeks-pad": "3px",
149
+ "--pp-vc-arrow-w": "26px",
150
+ "--pp-vc-arrow-h": "28px",
151
+ "--pp-fast-group-pad": "6px 10px",
152
+ "--pp-fast-list-max-h": "430px"
153
+ }
154
+ },
155
+ md: {
156
+ trigger: "h-[38px] rounded-[10px]",
157
+ triggerButton: "gap-2 px-3 text-xs",
158
+ triggerIcon: "w-4 h-4",
159
+ triggerDivider: "h-6",
160
+ triggerAction: "w-8",
161
+ clearIcon: "w-5 h-5",
162
+ dropdown: "p-3 pt-2",
163
+ groupTitle: "text-sm font-semibold",
164
+ groupSubtitle: "text-xs",
165
+ presetLabel: "text-[11px]",
166
+ ctaButton: "!h-10 !rounded-[10px]",
167
+ ctaButtonSize: "md",
168
+ panelGap: "space-y-3",
169
+ tabButton: "h-9 rounded-[10px] px-3 text-sm",
170
+ navTitle: "font-semibold",
171
+ actionButton: "!h-10 !rounded-[10px]",
172
+ actionButtonSize: "md",
173
+ actionGap: "gap-3 mt-3",
174
+ fastModalSize: "xl",
175
+ vars: {
176
+ "--pp-group-padding": "12px",
177
+ "--pp-group-radius": "12px",
178
+ "--pp-group-min-h": "320px",
179
+ "--pp-group-max-h": "420px",
180
+ "--pp-group-list-max-h": "280px",
181
+ "--pp-option-px": "12px",
182
+ "--pp-option-py": "8px",
183
+ "--pp-option-text": "14px",
184
+ "--pp-option-desc": "11px",
185
+ "--pp-nav-size": "32px",
186
+ "--pp-month-h": "48px",
187
+ "--pp-month-text": "14px",
188
+ "--pp-input-h": "36px",
189
+ "--pp-input-text": "14px",
190
+ "--pp-input-px": "12px",
191
+ "--pp-input-radius": "10px",
192
+ "--vc-text-xs": "12px",
193
+ "--vc-text-sm": "14px",
194
+ "--vc-text-base": "16px",
195
+ "--vc-text-lg": "18px",
196
+ "--pp-vc-day-size": "28px",
197
+ "--pp-vc-pane-min-w": "208px",
198
+ "--pp-vc-weeks-min-w": "208px",
199
+ "--pp-vc-weeks-pad": "6px",
200
+ "--pp-vc-arrow-w": "28px",
201
+ "--pp-vc-arrow-h": "30px",
202
+ "--pp-fast-group-pad": "8px 12px",
203
+ "--pp-fast-list-max-h": "480px"
204
+ }
205
+ },
206
+ lg: {
207
+ trigger: "h-[46px] rounded-xl",
208
+ triggerButton: "gap-2.5 px-4 text-sm",
209
+ triggerIcon: "w-5 h-5",
210
+ triggerDivider: "h-7",
211
+ triggerAction: "w-10",
212
+ clearIcon: "w-5 h-5",
213
+ dropdown: "p-4 pt-3",
214
+ groupTitle: "text-base font-semibold",
215
+ groupSubtitle: "text-sm",
216
+ presetLabel: "text-xs",
217
+ ctaButton: "!h-12 !rounded-xl",
218
+ ctaButtonSize: "lg",
219
+ panelGap: "space-y-3",
220
+ tabButton: "h-11 rounded-xl px-4 text-base",
221
+ navTitle: "text-lg font-semibold",
222
+ actionButton: "!h-12 !rounded-xl",
223
+ actionButtonSize: "lg",
224
+ actionGap: "gap-4 mt-3",
225
+ fastModalSize: "xl",
226
+ vars: {
227
+ "--pp-group-padding": "14px",
228
+ "--pp-group-radius": "14px",
229
+ "--pp-group-min-h": "360px",
230
+ "--pp-group-max-h": "480px",
231
+ "--pp-group-list-max-h": "320px",
232
+ "--pp-option-px": "14px",
233
+ "--pp-option-py": "10px",
234
+ "--pp-option-text": "16px",
235
+ "--pp-option-desc": "12px",
236
+ "--pp-nav-size": "40px",
237
+ "--pp-month-h": "56px",
238
+ "--pp-month-text": "16px",
239
+ "--pp-input-h": "44px",
240
+ "--pp-input-text": "16px",
241
+ "--pp-input-px": "16px",
242
+ "--pp-input-radius": "12px",
243
+ "--vc-text-xs": "13px",
244
+ "--vc-text-sm": "15px",
245
+ "--vc-text-base": "18px",
246
+ "--vc-text-lg": "21px",
247
+ "--pp-vc-day-size": "34px",
248
+ "--pp-vc-pane-min-w": "254px",
249
+ "--pp-vc-weeks-min-w": "254px",
250
+ "--pp-vc-weeks-pad": "8px",
251
+ "--pp-vc-arrow-w": "34px",
252
+ "--pp-vc-arrow-h": "36px",
253
+ "--pp-fast-group-pad": "10px 14px",
254
+ "--pp-fast-list-max-h": "540px"
255
+ }
256
+ }
257
+ }, we = "manual-date", le = "manual-range", G = "date", ea = "period", P = "range", ta = { class: "fast-picker-group__list" }, aa = ["onClick"], la = { class: "fast-picker-option__label" }, na = {
258
+ key: 0,
259
+ class: "fast-picker-option__description"
260
+ }, ra = /* @__PURE__ */ st({
261
+ __name: "OnePeriodPickerFastModal",
262
+ props: {
263
+ useModal: {},
264
+ groups: {},
265
+ activePresetKey: {},
266
+ t: { type: Function },
267
+ size: {}
268
+ },
269
+ emits: ["select"],
270
+ setup(a) {
271
+ const o = dt(), x = a, r = f(() => x.t ?? o), i = f(() => $e[x.size ?? "md"]), m = f(() => i.value.vars);
272
+ return (s, C) => a.useModal.isOpened.value ? (u(), Q(S(Et), {
273
+ key: 0,
274
+ useModal: a.useModal,
275
+ size: i.value.fastModalSize,
276
+ title: r.value("ui.period_select.Fast periods")
277
+ }, {
278
+ default: At(() => [
279
+ v("div", {
280
+ class: "grid gap-4 grid-cols-1 sm:grid-cols-2 md:grid-cols-3",
281
+ style: xe(m.value)
282
+ }, [
283
+ (u(!0), p(q, null, Z(a.groups, (A) => (u(), p("section", {
284
+ key: A.id,
285
+ class: "fast-picker-group"
286
+ }, [
287
+ v("div", ta, [
288
+ (u(!0), p(q, null, Z(A.options, (_) => (u(), p("div", {
289
+ key: _.key
290
+ }, [
291
+ _.type === "label" ? (u(), p("p", {
292
+ key: 0,
293
+ class: c([i.value.presetLabel, "uppercase tracking-wide text-gray-500 mt-3 mb-1 first:mt-0"])
294
+ }, O(_.label), 3)) : (u(), p("button", {
295
+ key: 1,
296
+ type: "button",
297
+ class: c(["fast-picker-option", { "fast-picker-option--active": a.activePresetKey === _.key }]),
298
+ onClick: (ee) => s.$emit("select", _)
299
+ }, [
300
+ v("span", la, O(_.label), 1),
301
+ _.description ? (u(), p("span", na, O(_.description), 1)) : Y("", !0)
302
+ ], 10, aa))
303
+ ]))), 128))
304
+ ])
305
+ ]))), 128))
306
+ ], 4)
307
+ ]),
308
+ _: 1
309
+ }, 8, ["useModal", "size", "title"])) : Y("", !0);
310
+ }
311
+ });
312
+ const oa = /* @__PURE__ */ pt(ra, [["__scopeId", "data-v-3fbb25c2"]]);
313
+ l.extend(Kt);
314
+ l.extend(Qt);
315
+ l.extend(Ht);
316
+ l.extend(Jt);
317
+ l.extend(Xt);
318
+ const De = (a, o) => o("ui.period_select.date_short", {
319
+ day: a.format("DD"),
320
+ month: o("ui.months_short." + a.month()),
321
+ year: a.format("YYYY")
322
+ }), ot = (a) => {
323
+ if (a == null)
324
+ return null;
325
+ const o = Number(a);
326
+ return Number.isFinite(o) && o > 0 ? o : null;
327
+ }, M = ({
328
+ key: a,
329
+ label: o,
330
+ group: x,
331
+ description: r = null,
332
+ resolveRange: i
333
+ }) => ({
334
+ key: a,
335
+ label: o,
336
+ group: x,
337
+ description: r,
338
+ type: "option",
339
+ resolveRange: i
340
+ }), ut = (a, o, x) => {
341
+ if (a && a > 0 && o && o > 0) {
342
+ const r = l.unix(a).format("DD.MM.YYYY"), i = l.unix(o).format("DD.MM.YYYY");
343
+ return r !== i ? `${r} - ${i}` : r;
344
+ }
345
+ if (a && a > 0)
346
+ return `${x("ui.period_select.From")} ${l.unix(a).format("DD.MM.YYYY")}`;
347
+ if (o && o > 0) {
348
+ if (Math.abs(l.unix(o).diff(l().utc(), "minute")) < 15)
349
+ return x("ui.period_select.until current moment");
350
+ const r = l.unix(o).format("DD.MM.YYYY");
351
+ return r === l().endOf("day").format("DD.MM.YYYY") ? x("ui.period_select.until end of today") : r === l().subtract(1, "d").endOf("day").format("DD.MM.YYYY") ? x("ui.period_select.until end of yesterday") : r === l().endOf("month").format("DD.MM.YYYY") ? x("ui.period_select.until end of month") : r === l().subtract(1, "month").endOf("month").format("DD.MM.YYYY") ? x("ui.period_select.until end of last month") : `${x("ui.period_select.Till")} ${l.unix(o).format("DD.MM.YYYY")}`;
352
+ }
353
+ return "";
354
+ }, ua = (a, o, x) => x === G ? G : x === ea ? P : a != null && o != null ? l.unix(a).isSame(l.unix(o), "day") ? G : P : a != null || o != null ? P : null, it = (a) => [
355
+ // === Date presets (group: 'date') ===
356
+ M({
357
+ key: "until-now",
358
+ label: a("ui.period_select.until current moment"),
359
+ group: "date",
360
+ resolveRange: () => [null, l().unix()]
361
+ }),
362
+ M({
363
+ key: "until-end-today",
364
+ label: a("ui.period_select.until end of today"),
365
+ group: "date",
366
+ resolveRange: () => [null, l().endOf("day").unix()]
367
+ }),
368
+ M({
369
+ key: "until-end-yesterday",
370
+ label: a("ui.period_select.until end of yesterday"),
371
+ group: "date",
372
+ resolveRange: () => [null, l().subtract(1, "day").endOf("day").unix()]
373
+ }),
374
+ M({
375
+ key: "until-end-month",
376
+ label: a("ui.period_select.until end of month"),
377
+ group: "date",
378
+ resolveRange: () => [null, l().endOf("month").unix()]
379
+ }),
380
+ M({
381
+ key: "until-end-last-month",
382
+ label: a("ui.period_select.until end of last month"),
383
+ group: "date",
384
+ resolveRange: () => [null, l().subtract(1, "month").endOf("month").unix()]
385
+ }),
386
+ M({
387
+ key: "today",
388
+ label: a("ui.period_select.Today"),
389
+ group: "date",
390
+ resolveRange: () => [l().startOf("day").unix(), l().endOf("day").unix()]
391
+ }),
392
+ M({
393
+ key: "yesterday",
394
+ label: a("ui.period_select.Yesterday"),
395
+ group: "date",
396
+ resolveRange: () => [
397
+ l().subtract(1, "day").startOf("day").unix(),
398
+ l().subtract(1, "day").endOf("day").unix()
399
+ ]
400
+ }),
401
+ // === Period presets (group: 'period') ===
402
+ M({
403
+ key: "this-week",
404
+ label: a("ui.period_select.This week"),
405
+ group: "period",
406
+ resolveRange: () => [
407
+ l().startOf("isoWeek").startOf("day").unix(),
408
+ l().endOf("isoWeek").endOf("day").unix()
409
+ ]
410
+ }),
411
+ M({
412
+ key: "this-month",
413
+ label: a("ui.period_select.This month"),
414
+ group: "period",
415
+ resolveRange: () => [
416
+ l().startOf("month").startOf("day").unix(),
417
+ l().endOf("month").endOf("day").unix()
418
+ ]
419
+ }),
420
+ M({
421
+ key: "this-quarter",
422
+ label: a("ui.period_select.This quarter"),
423
+ group: "period",
424
+ resolveRange: () => [
425
+ l().startOf("quarter").startOf("day").unix(),
426
+ l().endOf("quarter").endOf("day").unix()
427
+ ]
428
+ }),
429
+ M({
430
+ key: "this-year",
431
+ label: a("ui.period_select.This Year"),
432
+ group: "period",
433
+ resolveRange: () => [
434
+ l().startOf("year").startOf("day").unix(),
435
+ l().endOf("year").endOf("day").unix()
436
+ ]
437
+ }),
438
+ M({
439
+ key: "last-week",
440
+ label: a("ui.period_select.Last week"),
441
+ group: "period",
442
+ resolveRange: () => [
443
+ l().subtract(1, "week").startOf("isoWeek").startOf("day").unix(),
444
+ l().subtract(1, "week").endOf("isoWeek").endOf("day").unix()
445
+ ]
446
+ }),
447
+ M({
448
+ key: "last-month",
449
+ label: a("ui.period_select.Last month"),
450
+ group: "period",
451
+ resolveRange: () => [
452
+ l().subtract(1, "month").startOf("month").startOf("day").unix(),
453
+ l().subtract(1, "month").endOf("month").endOf("day").unix()
454
+ ]
455
+ }),
456
+ M({
457
+ key: "last-quarter",
458
+ label: a("ui.period_select.Last quarter"),
459
+ group: "period",
460
+ resolveRange: () => [
461
+ l().subtract(1, "quarter").startOf("quarter").startOf("day").unix(),
462
+ l().subtract(1, "quarter").endOf("quarter").endOf("day").unix()
463
+ ]
464
+ }),
465
+ M({
466
+ key: "last-year",
467
+ label: a("ui.period_select.Last year"),
468
+ group: "period",
469
+ resolveRange: () => [
470
+ l().subtract(1, "year").startOf("year").startOf("day").unix(),
471
+ l().subtract(1, "year").endOf("year").endOf("day").unix()
472
+ ]
473
+ }),
474
+ M({
475
+ key: "last-two-months",
476
+ label: a("ui.period_select.Last two month"),
477
+ group: "period",
478
+ resolveRange: () => [
479
+ l().subtract(1, "month").startOf("month").startOf("day").unix(),
480
+ l().endOf("month").endOf("day").unix()
481
+ ]
482
+ }),
483
+ M({
484
+ key: "last-three-months",
485
+ label: a("ui.period_select.Last three month"),
486
+ group: "period",
487
+ resolveRange: () => [
488
+ l().subtract(2, "month").startOf("month").startOf("day").unix(),
489
+ l().endOf("month").endOf("day").unix()
490
+ ]
491
+ })
492
+ ], ve = (a, o) => {
493
+ var m;
494
+ const r = {
495
+ day: {
496
+ iterations: 30,
497
+ group: "date",
498
+ buildLabel: (s) => o("ui.period_select.day_label", {
499
+ dayOfWeek: o("ui.days_short." + s.day()),
500
+ day: s.format("D"),
501
+ month: o("ui.months_short." + s.month()),
502
+ year: s.format("YYYY")
503
+ })
504
+ },
505
+ week: {
506
+ iterations: 15,
507
+ group: "period",
508
+ buildLabel: (s) => o("ui.period_select.week_label", { weekNumber: s.format("WW") }),
509
+ buildDescription: (s, C) => o("ui.period_select.week_description", {
510
+ start: De(s, o),
511
+ end: De(C, o)
512
+ }),
513
+ useIsoWeek: !0
514
+ },
515
+ month: {
516
+ iterations: 24,
517
+ group: "period",
518
+ buildLabel: (s) => o("ui.period_select.month_label", {
519
+ month: o("ui.months." + s.month()),
520
+ year: s.format("YYYY")
521
+ })
522
+ },
523
+ quarter: {
524
+ iterations: 8,
525
+ group: "period",
526
+ buildLabel: (s) => o("ui.period_select.quarter_label", {
527
+ year: s.format("YYYY"),
528
+ quarter: s.quarter()
529
+ }),
530
+ buildDescription: (s, C) => o("ui.period_select.quarter_description", {
531
+ start: De(s, o),
532
+ end: De(C, o)
533
+ })
534
+ },
535
+ year: {
536
+ iterations: 7,
537
+ group: "period",
538
+ buildLabel: (s) => s.format("YYYY")
539
+ }
540
+ }[a], i = [];
541
+ for (let s = 0; s < r.iterations; s++) {
542
+ const C = l().subtract(s, a), A = a === "week" && r.useIsoWeek ? C.startOf("isoWeek") : C.startOf(a), _ = a === "week" && r.useIsoWeek ? C.endOf("isoWeek") : C.endOf(a), ee = A.startOf("day").unix(), E = _.endOf("day").unix();
543
+ i.push(
544
+ M({
545
+ key: `${a}-${s}`,
546
+ label: r.buildLabel(A, _),
547
+ description: ((m = r.buildDescription) == null ? void 0 : m.call(r, A, _)) ?? null,
548
+ group: r.group,
549
+ resolveRange: () => [ee, E]
550
+ })
551
+ );
552
+ }
553
+ return i;
554
+ }, ia = (a) => a ? a.includes("today") || a.includes("yesterday") || a.startsWith("day-") ? "day" : a.includes("week") ? "week" : a.includes("month") || a.startsWith("month-") ? "month" : a.includes("quarter") || a.startsWith("quarter-") ? "quarter" : a.includes("year") || a.startsWith("year-") ? "year" : a.startsWith("until-") ? "day" : null : null, X = (a, o) => {
555
+ if (!o)
556
+ return !0;
557
+ const x = ["day", "week", "month", "quarter", "year"], r = x.indexOf(o), i = ia(a);
558
+ return i ? x.indexOf(i) >= r : !0;
559
+ }, fe = (a) => {
560
+ const o = a.replace(/[^0-9]/g, "");
561
+ if (o.length === 8) {
562
+ const x = o.substring(0, 2), r = o.substring(2, 4), i = o.substring(4, 8), m = l(`${i}-${r}-${x}`, "YYYY-MM-DD");
563
+ if (m.isValid())
564
+ return m.format("YYYY-MM-DD");
565
+ }
566
+ return null;
567
+ }, sa = ["placeholder"], da = ["placeholder"], pa = { class: "truncate" }, ca = { class: "flex items-center justify-between pb-2 border-b border-gray-200" }, va = { class: "flex-1 overflow-y-auto pr-1 picker-group__list" }, fa = ["onClick"], xa = { class: "picker-option__label" }, ma = {
568
+ key: 0,
569
+ class: "picker-option__description"
570
+ }, ya = {
571
+ key: 1,
572
+ class: "space-y-2"
573
+ }, ga = { class: "flex items-center justify-between mb-3" }, ba = ["disabled"], ha = {
574
+ key: 0,
575
+ class: "grid grid-cols-2 gap-4"
576
+ }, ka = ["onClick", "onMouseenter"], Ya = ["onClick", "onMouseenter"], wa = {
577
+ key: 0,
578
+ class: "grid gap-3 md:grid-cols-2 w-full text-sm"
579
+ }, Da = { class: "text-gray-500 mb-1" }, Ma = { class: "text-gray-500 mb-1" }, Oa = /* @__PURE__ */ st({
580
+ __name: "OnePeriodPicker",
581
+ props: {
582
+ modelValue: {},
583
+ t: { type: Function, default: void 0 },
584
+ mode: { default: "short" },
585
+ placeholder: { default: void 0 },
586
+ disableDate: { type: [Function, Object, Array], default: void 0 },
587
+ noBorder: { type: Boolean, default: !1 },
588
+ noClear: { type: Boolean, default: !1 },
589
+ hideDayAndWeek: { type: Boolean, default: !1 },
590
+ minGranularity: { default: null },
591
+ asDateString: { type: Boolean, default: !1 },
592
+ size: { default: "md" },
593
+ editable: { type: Boolean, default: !1 },
594
+ hideDatePresets: { type: Boolean, default: !1 },
595
+ dropdownSize: { default: void 0 },
596
+ columns: { default: null }
597
+ },
598
+ emits: ["update:modelValue", "focus"],
599
+ setup(a, { emit: o }) {
600
+ const x = dt(), r = a, i = f(() => r.t ?? x), m = f(() => $e[r.size ?? "md"]), s = f(() => $e[r.dropdownSize ?? r.size ?? "md"]), C = f(() => s.value.vars), A = f(() => r.dropdownSize ?? r.size ?? "md"), _ = f(() => A.value !== "xs" && A.value !== "sm"), ee = o, E = b(null), F = b(null), h = b(!1), V = b(!1), Me = b(!1), w = b(G), $ = b(null), j = b(0), U = b(!1), Ae = b(!1), ne = b(""), re = b(""), R = b(l().format("YYYY-MM-DD")), B = b(void 0), oe = b(""), ue = b(""), I = b(0), z = b(null), Oe = b(null), N = b(null);
601
+ let te = null;
602
+ const ae = b(null), _e = b(!1), Re = b(typeof window < "u" ? window.innerWidth : 1024), ie = f(() => Re.value < 640), me = Ft(), y = f(() => {
603
+ var e, t;
604
+ return (e = r.modelValue) != null && e.start ? l(r.modelValue.start).startOf("day").unix() : ot((t = r.modelValue) == null ? void 0 : t.startUnix);
605
+ }), k = f(() => {
606
+ var e, t;
607
+ return (e = r.modelValue) != null && e.end ? l(r.modelValue.end).endOf("day").unix() : ot((t = r.modelValue) == null ? void 0 : t.endUnix);
608
+ }), Se = f(() => y.value != null || k.value != null), ct = f(
609
+ () => ut(y.value, k.value, i.value) || r.placeholder || i.value("ui.period_select.Select date")
610
+ ), Be = f(() => r.disableDate ?? void 0), vt = f(() => ut(y.value, k.value, i.value) || ""), Le = f(() => `date-${j.value}`), ft = f(() => `range-${j.value}`), We = f(() => r.columns != null ? r.columns : ie.value || w.value !== P || A.value === "xs" || A.value === "sm" ? 1 : 2), ye = f(
611
+ () => !r.minGranularity || r.minGranularity === "day" || r.minGranularity === "week"
612
+ ), xt = f(() => r.minGranularity === "month" ? i.value("ui.period_select.Months") : r.minGranularity === "quarter" ? i.value("ui.period_select.Quarters") : r.minGranularity === "year" ? i.value("ui.period_select.Years") : i.value("ui.period_select.Period group title")), L = f(() => {
613
+ if (!r.minGranularity || r.minGranularity === "day" || r.minGranularity === "week")
614
+ return null;
615
+ if (r.minGranularity === "month" || r.minGranularity === "quarter") {
616
+ const e = [I.value * 2 + 1, I.value * 2], t = r.minGranularity === "month";
617
+ return {
618
+ titleStart: l().subtract(e[0], "year").format("YYYY"),
619
+ titleEnd: l().subtract(e[1], "year").format("YYYY"),
620
+ gridCols: t ? "grid-cols-3" : "grid-cols-2",
621
+ unit: r.minGranularity,
622
+ yearGroups: e.map((n) => ({
623
+ yearLabel: l().subtract(n, "year").format("YYYY"),
624
+ items: t ? Array.from({ length: 12 }, (d, g) => ({
625
+ date: l().subtract(n, "year").month(g),
626
+ label: i.value("ui.months_short." + g)
627
+ })) : Array.from({ length: 4 }, (d, g) => ({
628
+ date: l().subtract(n, "year").quarter(g + 1).startOf("quarter"),
629
+ label: `Q${g + 1}`
630
+ }))
631
+ })),
632
+ flatItems: null
633
+ };
634
+ }
635
+ return {
636
+ titleStart: l().subtract(I.value * 8 + 7, "year").format("YYYY"),
637
+ titleEnd: l().subtract(I.value * 8, "year").format("YYYY"),
638
+ gridCols: "grid-cols-4",
639
+ unit: "year",
640
+ yearGroups: null,
641
+ flatItems: Array.from({ length: 8 }, (e, t) => {
642
+ const n = l().subtract(I.value * 8 + (7 - t), "year");
643
+ return { date: n, label: n.format("YYYY") };
644
+ })
645
+ };
646
+ }), Te = f(() => {
647
+ var e, t;
648
+ return !((e = B.value) != null && e.start) || !((t = B.value) != null && t.end) ? !1 : !l(B.value.end).isBefore(l(B.value.start));
649
+ }), qe = f(() => {
650
+ j.value;
651
+ const e = it(i.value).filter((n) => n.group === "date").filter((n) => X(n.key, r.minGranularity)), t = r.hideDayAndWeek || !X("day-0", r.minGranularity) ? [] : ve("day", i.value);
652
+ return t.length > 0 ? [
653
+ ...e,
654
+ {
655
+ key: "date-history",
656
+ type: "label",
657
+ label: i.value("ui.period_select.Date history label"),
658
+ group: "date"
659
+ },
660
+ ...t
661
+ ] : e;
662
+ }), Ue = f(() => {
663
+ j.value;
664
+ const e = it(i.value).filter((D) => D.group === "period").filter((D) => X(D.key, r.minGranularity)), t = r.hideDayAndWeek || !X("week-0", r.minGranularity) ? [] : ve("week", i.value), n = X("month-0", r.minGranularity) ? ve("month", i.value) : [], d = X("quarter-0", r.minGranularity) ? ve("quarter", i.value) : [], g = X("year-0", r.minGranularity) ? ve("year", i.value) : [];
665
+ return { shortcuts: e, rollingWeek: t, rollingMonth: n, rollingQuarter: d, rollingYear: g };
666
+ }), Ie = f(() => {
667
+ const { shortcuts: e, rollingWeek: t, rollingMonth: n, rollingQuarter: d, rollingYear: g } = Ue.value, D = [...e], T = [
668
+ { items: t, key: "weeks-history", labelKey: "Weeks history label" },
669
+ { items: n, key: "months-history", labelKey: "Months history label" },
670
+ { items: d, key: "quarters-history", labelKey: "Quarters history label" },
671
+ { items: g, key: "years-history", labelKey: "Years history label" }
672
+ ];
673
+ for (const H of T)
674
+ H.items.length > 0 && (D.push({
675
+ key: H.key,
676
+ type: "label",
677
+ label: i.value(`ui.period_select.${H.labelKey}`),
678
+ group: "period"
679
+ }), D.push(...H.items));
680
+ return D;
681
+ }), Ee = f(() => [
682
+ {
683
+ id: "date",
684
+ title: i.value("ui.period_select.Date group title"),
685
+ subtitle: i.value("ui.period_select.Date group subtitle"),
686
+ ctaLabel: i.value("ui.period_select.Select date CTA"),
687
+ options: qe.value
688
+ },
689
+ {
690
+ id: "period",
691
+ title: i.value("ui.period_select.Period group title"),
692
+ subtitle: i.value("ui.period_select.Period group subtitle"),
693
+ ctaLabel: i.value("ui.period_select.Select dates CTA"),
694
+ options: Ie.value
695
+ }
696
+ ]), se = f(
697
+ () => r.hideDatePresets ? Ee.value.filter((e) => e.id !== "date") : Ee.value
698
+ ), mt = f(() => {
699
+ const { shortcuts: e, rollingWeek: t, rollingMonth: n, rollingQuarter: d } = Ue.value, g = [...e];
700
+ t.length > 0 && (g.push({
701
+ key: "weeks-history",
702
+ type: "label",
703
+ label: i.value("ui.period_select.Weeks history label"),
704
+ group: "period"
705
+ }), g.push(...t));
706
+ const D = (T, H, $t) => H.length === 0 ? null : {
707
+ id: T,
708
+ title: "",
709
+ subtitle: "",
710
+ ctaLabel: "",
711
+ options: [
712
+ { key: `${T}-label`, type: "label", label: i.value(`ui.period_select.${$t}`), group: "period" },
713
+ ...H
714
+ ]
715
+ };
716
+ return [
717
+ { id: "presets-weeks", title: "", subtitle: "", ctaLabel: "", options: g },
718
+ D("months", n, "Months history label"),
719
+ D("quarters", d, "Quarters history label")
720
+ ].filter((T) => T != null && T.options.length > 0);
721
+ }), yt = f(() => mt.value), gt = f(() => [
722
+ ...qe.value.filter((e) => e.type === "option"),
723
+ ...Ie.value.filter((e) => e.type === "option")
724
+ ]), bt = f(
725
+ () => V.value && w.value === G || $.value === we
726
+ ), ht = f(
727
+ () => V.value && w.value === P || $.value === le
728
+ ), Fe = () => {
729
+ j.value++;
730
+ }, kt = () => {
731
+ !E.value || !F.value || ie.value || Tt(E.value, F.value, {
732
+ placement: "bottom-start",
733
+ strategy: "fixed",
734
+ middleware: [qt(6), Ut(), It({ padding: 8 })]
735
+ }).then(({ x: e, y: t }) => {
736
+ F.value && Object.assign(F.value.style, {
737
+ left: `${e}px`,
738
+ top: `${t}px`
739
+ });
740
+ });
741
+ }, je = () => {
742
+ te && te(), E.value && F.value && !ie.value && (te = Wt(E.value, F.value, kt));
743
+ }, Ne = () => {
744
+ te && (te(), te = null);
745
+ }, W = (e, t, n = null) => {
746
+ r.asDateString ? ee("update:modelValue", {
747
+ start: e ? l.unix(e).format("YYYY-MM-DD") : null,
748
+ end: t ? l.unix(t).format("YYYY-MM-DD") : null
749
+ }) : ee("update:modelValue", {
750
+ startUnix: e,
751
+ endUnix: t,
752
+ kind: ua(e, t, n)
753
+ });
754
+ }, ge = () => {
755
+ var e, t;
756
+ Me.value = !1, h.value ? h.value = !1 : (U.value = !1, ae.value = r.modelValue ? { ...r.modelValue } : null, h.value = !0, ((e = r.modelValue) == null ? void 0 : e.kind) === G ? (w.value = G, de()) : ((t = r.modelValue) == null ? void 0 : t.kind) === P ? (w.value = P, pe()) : r.asDateString || r.editable ? (w.value = G, de()) : (w.value = P, pe()), V.value = !0, K(() => {
757
+ U.value = !0;
758
+ }));
759
+ }, Yt = () => {
760
+ ee("focus"), h.value || ge();
761
+ }, wt = () => {
762
+ if (se.value.length === 0) {
763
+ ge();
764
+ return;
765
+ }
766
+ Me.value = !0, V.value = !1, h.value || (ae.value = r.modelValue ? { ...r.modelValue } : null), h.value = !h.value, h.value && K(je);
767
+ }, Ke = () => {
768
+ h.value = !1;
769
+ }, Dt = () => {
770
+ W(null, null, null), $.value = null, h.value = !1;
771
+ }, Qe = (e) => {
772
+ if (e.type !== "option" || !e.resolveRange)
773
+ return;
774
+ const [t, n] = e.resolveRange();
775
+ W(t, n, e.group), $.value = e.key, h.value = !1;
776
+ }, Mt = () => {
777
+ h.value = !1, V.value = !1, K(() => {
778
+ ae.value ? W(
779
+ ae.value.startUnix ?? null,
780
+ ae.value.endUnix ?? null,
781
+ ae.value.kind ?? null
782
+ ) : W(null, null, null);
783
+ });
784
+ }, de = () => {
785
+ const e = y.value && k.value && l.unix(y.value).isSame(l.unix(k.value), "day") ? y.value : k.value || y.value || l().unix();
786
+ R.value = e ? l.unix(e).format("YYYY-MM-DD") : l().format("YYYY-MM-DD");
787
+ }, pe = () => {
788
+ y.value || k.value ? B.value = {
789
+ start: y.value ? l.unix(y.value).format("YYYY-MM-DD") : void 0,
790
+ end: k.value ? l.unix(k.value).format("YYYY-MM-DD") : void 0
791
+ } : B.value = void 0, oe.value = y.value ? l.unix(y.value).format("DD.MM.YYYY") : "", ue.value = k.value ? l.unix(k.value).format("DD.MM.YYYY") : "";
792
+ }, He = (e) => {
793
+ w.value !== e && (U.value = !1, w.value = e, e === G ? de() : pe(), K(() => {
794
+ U.value = !0;
795
+ }));
796
+ }, Ot = (e) => {
797
+ U.value = !1, w.value = e, e === G ? de() : pe(), V.value = !0, K(() => {
798
+ U.value = !0;
799
+ });
800
+ }, _t = (e = !0) => {
801
+ if (!R.value)
802
+ return;
803
+ const t = l(R.value);
804
+ t.isValid() && (W(t.startOf("day").unix(), t.endOf("day").unix(), G), $.value = we, e && (h.value = !1));
805
+ }, ze = (e, t) => {
806
+ var n;
807
+ (n = t.target) == null || n.blur();
808
+ }, St = (e) => {
809
+ e && (R.value = e, V.value && _t());
810
+ }, Bt = (e) => {
811
+ if (!e)
812
+ return;
813
+ R.value = e;
814
+ const t = l(e);
815
+ t.isValid() && (ne.value = t.format("DD.MM.YYYY"), W(t.startOf("day").unix(), t.endOf("day").unix(), G));
816
+ }, Je = () => {
817
+ const e = fe(ne.value);
818
+ if (e) {
819
+ R.value = e, j.value++;
820
+ const t = l(e);
821
+ t.isValid() && W(t.startOf("day").unix(), t.endOf("day").unix(), G);
822
+ }
823
+ }, zt = () => {
824
+ _e.value = !0, setTimeout(() => {
825
+ _e.value = !1;
826
+ }, 0);
827
+ }, Xe = () => {
828
+ if (_e.value)
829
+ return;
830
+ const e = re.value.trim(), t = e.split(/\s*-\s*/);
831
+ if (t.length === 2) {
832
+ const d = fe(t[0]), g = fe(t[1]);
833
+ if (d && g) {
834
+ const D = l(d), T = l(g);
835
+ if (D.isValid() && T.isValid() && !T.isBefore(D)) {
836
+ W(D.startOf("day").unix(), T.endOf("day").unix(), P), $.value = le;
837
+ return;
838
+ }
839
+ }
840
+ }
841
+ const n = fe(e);
842
+ if (n) {
843
+ R.value = n, j.value++, $.value = we;
844
+ const d = l(n);
845
+ d.isValid() && W(d.startOf("day").unix(), d.endOf("day").unix(), G);
846
+ }
847
+ }, Gt = () => {
848
+ var e, t;
849
+ !Te.value || !((e = B.value) != null && e.start) || !((t = B.value) != null && t.end) || (W(
850
+ l(B.value.start).startOf("day").unix(),
851
+ l(B.value.end).endOf("day").unix(),
852
+ P
853
+ ), $.value = le, h.value = !1);
854
+ }, be = (e) => {
855
+ const n = fe((e === "start" ? oe : ue).value);
856
+ n && (B.value = { ...B.value || {}, [e]: n });
857
+ }, Ze = (e, t) => {
858
+ if (!z.value)
859
+ z.value = e;
860
+ else {
861
+ const n = z.value.isBefore(e) ? z.value : e, d = z.value.isBefore(e) ? e : z.value;
862
+ W(
863
+ n.startOf(t).startOf("day").unix(),
864
+ d.endOf(t).endOf("day").unix(),
865
+ P
866
+ ), $.value = le, z.value = null, Oe.value = null, h.value = !1;
867
+ }
868
+ }, et = (e, t) => {
869
+ if (z.value && !Oe.value) {
870
+ if (N.value) {
871
+ const n = z.value.isBefore(N.value) ? z.value : N.value, d = z.value.isBefore(N.value) ? N.value : z.value;
872
+ return (e.isSame(n, t) || e.isAfter(n, t)) && (e.isSame(d, t) || e.isBefore(d, t));
873
+ }
874
+ return e.isSame(z.value, t);
875
+ }
876
+ if (y.value && k.value) {
877
+ const n = l.unix(y.value), d = l.unix(k.value);
878
+ return (e.isSame(n, t) || e.isAfter(n, t)) && (e.isSame(d, t) || e.isBefore(d, t));
879
+ }
880
+ return !1;
881
+ }, tt = (e) => {
882
+ z.value && (N.value = e);
883
+ }, at = () => {
884
+ N.value = null;
885
+ }, Ct = () => {
886
+ if (!y.value && !k.value)
887
+ return null;
888
+ const e = gt.value.find((t) => {
889
+ if (!t.resolveRange)
890
+ return !1;
891
+ const [n, d] = t.resolveRange(), g = n == null && y.value == null || n != null && y.value != null && n === y.value, D = d == null && k.value == null || d != null && k.value != null && d === k.value;
892
+ return g && D;
893
+ });
894
+ return e ? e.key : y.value && k.value && l.unix(y.value).isSame(l.unix(k.value), "day") ? we : le;
895
+ }, Pt = () => {
896
+ h.value = !1, me.open();
897
+ }, Vt = (e) => {
898
+ Qe(e), me.close();
899
+ };
900
+ ce(vt, (e) => {
901
+ r.editable && (re.value = e);
902
+ }, { immediate: !0 }), ce(h, (e) => {
903
+ e ? (Fe(), K(je), (!ye.value || se.value.length === 0) && !V.value && (U.value = !1, w.value = P, pe(), V.value = !0, K(() => {
904
+ U.value = !0;
905
+ }))) : (Ne(), U.value = !1, V.value = !1, Me.value = !1, I.value = 0, z.value = null, Oe.value = null, N.value = null);
906
+ }), ce(
907
+ () => [y.value, k.value, j.value],
908
+ () => {
909
+ $.value = Ct();
910
+ },
911
+ { immediate: !0 }
912
+ ), ce(
913
+ () => r.minGranularity,
914
+ () => {
915
+ Fe(), !ye.value && w.value === G && (w.value = P);
916
+ }
917
+ ), ce(B, (e) => {
918
+ e != null && e.start && (oe.value = l(e.start).format("DD.MM.YYYY")), e != null && e.end && (ue.value = l(e.end).format("DD.MM.YYYY"));
919
+ });
920
+ const Ge = () => {
921
+ Re.value = window.innerWidth;
922
+ }, lt = (e) => {
923
+ var t, n;
924
+ h.value && ((t = E.value) != null && t.contains(e.target) || (n = F.value) != null && n.contains(e.target) || Ke());
925
+ };
926
+ return Rt(() => {
927
+ Ge(), window.addEventListener("resize", Ge), document.addEventListener("click", lt), r.mode === "inline" && (de(), y.value && (ne.value = l.unix(y.value).format("DD.MM.YYYY")), K(() => {
928
+ Ae.value = !0;
929
+ }));
930
+ }), Lt(() => {
931
+ Ne(), window.removeEventListener("resize", Ge), document.removeEventListener("click", lt);
932
+ }), (e, t) => (u(), p("div", {
933
+ class: "relative",
934
+ ref_key: "containerRef",
935
+ ref: E,
936
+ style: xe(C.value)
937
+ }, [
938
+ a.mode === "inline" ? (u(), p("div", {
939
+ key: 0,
940
+ class: "one-pp-panel",
941
+ style: xe(C.value)
942
+ }, [
943
+ he(v("input", {
944
+ type: "text",
945
+ "onUpdate:modelValue": t[0] || (t[0] = (n) => ne.value = n),
946
+ onBlur: Je,
947
+ onKeyup: ke(Je, ["enter"]),
948
+ placeholder: a.placeholder || "DD.MM.YYYY",
949
+ class: "manual-input mb-2"
950
+ }, null, 40, sa), [
951
+ [Ye, ne.value]
952
+ ]),
953
+ Ae.value ? (u(), Q(S(Ce), {
954
+ key: Le.value,
955
+ modelValue: R.value,
956
+ "onUpdate:modelValue": [
957
+ t[1] || (t[1] = (n) => R.value = n),
958
+ Bt
959
+ ],
960
+ onDayclick: ze,
961
+ "is-inline": "",
962
+ color: "gray",
963
+ "trim-weeks": "",
964
+ columns: 1,
965
+ rows: 1,
966
+ mode: "date",
967
+ masks: { title: "MMMM YYYY" },
968
+ "disabled-dates": Be.value
969
+ }, null, 8, ["modelValue", "disabled-dates"])) : Y("", !0)
970
+ ], 4)) : (u(), p("div", {
971
+ key: 1,
972
+ class: c(["flex items-center overflow-hidden", [
973
+ m.value.trigger,
974
+ a.editable ? ["border transition-colors", a.noBorder ? "border-transparent focus-within:border-blue-500" : "border-gray-200 focus-within:border-blue-500"] : [{ border: !a.noBorder }, "border-gray-200"]
975
+ ]])
976
+ }, [
977
+ a.editable ? (u(), p("div", {
978
+ key: 0,
979
+ class: c(["flex items-center h-full bg-white flex-1", [m.value.triggerButton]])
980
+ }, [
981
+ v("button", {
982
+ onClick: ge,
983
+ type: "button",
984
+ class: "flex-shrink-0 hover:text-blue-600 transition-colors"
985
+ }, [
986
+ J(S(Ve), {
987
+ class: c([m.value.triggerIcon])
988
+ }, null, 8, ["class"])
989
+ ]),
990
+ he(v("input", {
991
+ type: "text",
992
+ "onUpdate:modelValue": t[2] || (t[2] = (n) => re.value = n),
993
+ onFocus: Yt,
994
+ onBlur: Xe,
995
+ onKeyup: ke(Xe, ["enter"]),
996
+ placeholder: a.placeholder || "DD.MM.YYYY",
997
+ class: c(["w-full bg-transparent outline-none truncate !border-0 !shadow-none !ring-0 !p-0", [Se.value || re.value ? "text-gray-900 font-medium" : "text-gray-600 font-normal"]])
998
+ }, null, 42, da), [
999
+ [Ye, re.value]
1000
+ ])
1001
+ ], 2)) : (u(), p("button", {
1002
+ key: 1,
1003
+ onClick: ge,
1004
+ type: "button",
1005
+ class: c(["flex items-center h-full bg-white hover:bg-gray-50 transition-colors flex-1", [m.value.triggerButton, Se.value ? "text-gray-900 font-medium" : "text-gray-600 font-normal"]])
1006
+ }, [
1007
+ J(S(Ve), {
1008
+ class: c([m.value.triggerIcon, "flex-shrink-0"])
1009
+ }, null, 8, ["class"]),
1010
+ v("span", pa, O(ct.value), 1)
1011
+ ], 2)),
1012
+ a.mode === "short" ? (u(), p(q, { key: 2 }, [
1013
+ v("div", {
1014
+ class: c(["w-px bg-gray-200", m.value.triggerDivider])
1015
+ }, null, 2),
1016
+ v("button", {
1017
+ onClick: wt,
1018
+ type: "button",
1019
+ class: c(["flex items-center justify-center h-full bg-white hover:bg-gray-50 transition-colors", m.value.triggerAction])
1020
+ }, [
1021
+ J(S(Nt), {
1022
+ class: c([m.value.triggerIcon, "text-gray-600"])
1023
+ }, null, 8, ["class"])
1024
+ ], 2)
1025
+ ], 64)) : Y("", !0),
1026
+ a.mode === "full" ? (u(), p(q, { key: 3 }, [
1027
+ v("div", {
1028
+ class: c(["w-px bg-gray-200", m.value.triggerDivider])
1029
+ }, null, 2),
1030
+ v("button", {
1031
+ onClick: Pt,
1032
+ type: "button",
1033
+ class: c(["flex items-center justify-center h-full bg-white hover:bg-gray-50 transition-colors", m.value.triggerAction])
1034
+ }, [
1035
+ J(S(Zt), {
1036
+ class: c([m.value.triggerIcon, "text-gray-600"])
1037
+ }, null, 8, ["class"])
1038
+ ], 2)
1039
+ ], 64)) : Y("", !0),
1040
+ Se.value && !a.noClear ? (u(), p(q, { key: 4 }, [
1041
+ v("div", {
1042
+ class: c(["w-px bg-gray-200", m.value.triggerDivider])
1043
+ }, null, 2),
1044
+ v("button", {
1045
+ onClick: Dt,
1046
+ type: "button",
1047
+ class: c(["flex items-center justify-center h-full bg-white hover:bg-gray-50 transition-colors", m.value.triggerAction])
1048
+ }, [
1049
+ J(S(jt), {
1050
+ class: c([m.value.clearIcon, "text-gray-600"])
1051
+ }, null, 8, ["class"])
1052
+ ], 2)
1053
+ ], 64)) : Y("", !0)
1054
+ ], 2)),
1055
+ (u(), Q(nt, { to: "body" }, [
1056
+ h.value && ie.value ? (u(), p("div", {
1057
+ key: 0,
1058
+ class: "fixed inset-0 z-40 bg-black/20",
1059
+ onClick: Ke
1060
+ })) : Y("", !0)
1061
+ ])),
1062
+ (u(), Q(nt, { to: "body" }, [
1063
+ h.value ? (u(), p("div", {
1064
+ key: 0,
1065
+ ref_key: "dropdownRef",
1066
+ ref: F,
1067
+ class: c(["dropdown-menu bg-white shadow-xl border border-gray-200 z-[9999] overflow-y-auto rounded-t-2xl sm:rounded-lg", [
1068
+ s.value.dropdown,
1069
+ ie.value ? "fixed inset-x-0 bottom-0 max-h-[93vh]" : "fixed max-h-[85vh]"
1070
+ ]]),
1071
+ style: xe(C.value),
1072
+ onMousedown: zt
1073
+ }, [
1074
+ t[15] || (t[15] = v("div", { class: "sm:hidden flex justify-center pb-2" }, [
1075
+ v("div", { class: "w-10 h-1 bg-gray-300 rounded-full" })
1076
+ ], -1)),
1077
+ !V.value && se.value.length > 0 ? (u(), p("div", {
1078
+ key: 0,
1079
+ class: c(["flex flex-col gap-4 w-full", _.value && se.value.length > 1 ? "sm:grid sm:gap-3 sm:grid-cols-2" : ""])
1080
+ }, [
1081
+ (u(!0), p(q, null, Z(se.value, (n) => (u(), p("section", {
1082
+ key: n.id,
1083
+ class: "flex flex-col picker-group"
1084
+ }, [
1085
+ v("div", ca, [
1086
+ v("p", {
1087
+ class: c([s.value.groupTitle, "text-gray-700"])
1088
+ }, O(n.title), 3),
1089
+ v("span", {
1090
+ class: c([s.value.groupSubtitle, "text-gray-500"])
1091
+ }, O(n.subtitle), 3)
1092
+ ]),
1093
+ v("div", va, [
1094
+ (u(!0), p(q, null, Z(n.options, (d) => (u(), p("div", {
1095
+ key: d.key
1096
+ }, [
1097
+ d.type === "label" ? (u(), p("p", {
1098
+ key: 0,
1099
+ class: c([s.value.presetLabel, "uppercase tracking-wide text-gray-500 mt-4 mb-1"])
1100
+ }, O(d.label), 3)) : (u(), p("button", {
1101
+ key: 1,
1102
+ class: c(["picker-option", { "picker-option--active": $.value === d.key }]),
1103
+ onClick: (g) => Qe(d),
1104
+ type: "button"
1105
+ }, [
1106
+ v("span", xa, O(d.label), 1),
1107
+ d.description ? (u(), p("span", ma, O(d.description), 1)) : Y("", !0)
1108
+ ], 10, fa))
1109
+ ]))), 128))
1110
+ ]),
1111
+ J(S(Pe), {
1112
+ class: c(["mt-3 w-full", [s.value.ctaButton, {
1113
+ "picker-cta--active": n.id === "date" ? bt.value : ht.value
1114
+ }]]),
1115
+ size: s.value.ctaButtonSize,
1116
+ variant: n.id === "date" ? "primary" : "secondary",
1117
+ icon: n.id === "date" ? S(Ve) : S(rt),
1118
+ label: n.ctaLabel,
1119
+ onClick: (d) => Ot(n.id === "date" ? "date" : "range")
1120
+ }, null, 8, ["class", "size", "variant", "icon", "label", "onClick"])
1121
+ ]))), 128))
1122
+ ], 2)) : Y("", !0),
1123
+ V.value ? (u(), p("div", {
1124
+ key: 1,
1125
+ class: c(["picker-panel one-pp-panel", s.value.panelGap]),
1126
+ style: xe(C.value)
1127
+ }, [
1128
+ v("div", {
1129
+ class: c(["grid gap-2", ye.value ? "grid-cols-2" : "grid-cols-1"])
1130
+ }, [
1131
+ ye.value ? (u(), p("button", {
1132
+ key: 0,
1133
+ type: "button",
1134
+ class: c(["border font-medium transition-colors", [
1135
+ s.value.tabButton,
1136
+ w.value === "date" ? "border-blue-500 bg-blue-50 text-blue-700" : "border-gray-200 text-gray-700 hover:border-blue-200 hover:text-blue-700"
1137
+ ]]),
1138
+ onClick: t[3] || (t[3] = (n) => He("date"))
1139
+ }, O(i.value("ui.period_select.Date group title")), 3)) : Y("", !0),
1140
+ v("button", {
1141
+ type: "button",
1142
+ class: c(["border font-medium transition-colors", [
1143
+ s.value.tabButton,
1144
+ w.value === "range" ? "border-blue-500 bg-blue-50 text-blue-700" : "border-gray-200 text-gray-700 hover:border-blue-200 hover:text-blue-700"
1145
+ ]]),
1146
+ onClick: t[4] || (t[4] = (n) => He("range"))
1147
+ }, O(xt.value), 3)
1148
+ ], 2),
1149
+ U.value && (!a.minGranularity || a.minGranularity === "day" || a.minGranularity === "week") ? (u(), p(q, { key: 0 }, [
1150
+ w.value === "date" ? (u(), Q(S(Ce), {
1151
+ key: Le.value,
1152
+ modelValue: R.value,
1153
+ "onUpdate:modelValue": [
1154
+ t[5] || (t[5] = (n) => R.value = n),
1155
+ St
1156
+ ],
1157
+ onDayclick: ze,
1158
+ "is-inline": "",
1159
+ color: "gray",
1160
+ "trim-weeks": "",
1161
+ columns: 1,
1162
+ rows: 1,
1163
+ mode: "date",
1164
+ masks: { title: "MMMM YYYY" },
1165
+ "disabled-dates": Be.value
1166
+ }, null, 8, ["modelValue", "disabled-dates"])) : w.value === "range" ? (u(), Q(S(Ce), {
1167
+ key: ft.value,
1168
+ modelValue: B.value,
1169
+ "onUpdate:modelValue": t[6] || (t[6] = (n) => B.value = n),
1170
+ onDayclick: ze,
1171
+ "is-inline": "",
1172
+ "is-range": "",
1173
+ color: "gray",
1174
+ "trim-weeks": "",
1175
+ mode: "date",
1176
+ columns: We.value,
1177
+ rows: 1,
1178
+ masks: { title: "MMMM YYYY" },
1179
+ "disabled-dates": Be.value
1180
+ }, null, 8, ["modelValue", "columns", "disabled-dates"])) : Y("", !0)
1181
+ ], 64)) : L.value ? (u(), p("div", ya, [
1182
+ v("div", ga, [
1183
+ v("button", {
1184
+ onClick: t[7] || (t[7] = (n) => I.value++),
1185
+ type: "button",
1186
+ class: "nav-btn"
1187
+ }, "«"),
1188
+ v("span", {
1189
+ class: c([s.value.navTitle, "text-gray-700"])
1190
+ }, O(L.value.titleStart) + " - " + O(L.value.titleEnd), 3),
1191
+ v("button", {
1192
+ onClick: t[8] || (t[8] = (n) => I.value--),
1193
+ disabled: I.value === 0,
1194
+ type: "button",
1195
+ class: "nav-btn"
1196
+ }, " » ", 8, ba)
1197
+ ]),
1198
+ L.value.yearGroups ? (u(), p("div", ha, [
1199
+ (u(!0), p(q, null, Z(L.value.yearGroups, (n) => (u(), p("div", {
1200
+ key: n.yearLabel,
1201
+ class: "space-y-2"
1202
+ }, [
1203
+ v("div", {
1204
+ class: c([s.value.navTitle, "text-center text-gray-700 py-2"])
1205
+ }, O(n.yearLabel), 3),
1206
+ v("div", {
1207
+ class: c(["grid gap-2", L.value.gridCols])
1208
+ }, [
1209
+ (u(!0), p(q, null, Z(n.items, (d, g) => (u(), p("button", {
1210
+ key: g,
1211
+ type: "button",
1212
+ class: c(["month-btn", et(d.date, L.value.unit) ? "month-btn--active" : ""]),
1213
+ onClick: (D) => Ze(d.date, L.value.unit),
1214
+ onMouseenter: (D) => tt(d.date),
1215
+ onMouseleave: at
1216
+ }, O(d.label), 43, ka))), 128))
1217
+ ], 2)
1218
+ ]))), 128))
1219
+ ])) : L.value.flatItems ? (u(), p("div", {
1220
+ key: 1,
1221
+ class: c(["grid gap-2", L.value.gridCols])
1222
+ }, [
1223
+ (u(!0), p(q, null, Z(L.value.flatItems, (n, d) => (u(), p("button", {
1224
+ key: d,
1225
+ type: "button",
1226
+ class: c(["month-btn", et(n.date, "year") ? "month-btn--active" : ""]),
1227
+ onClick: (g) => Ze(n.date, "year"),
1228
+ onMouseenter: (g) => tt(n.date),
1229
+ onMouseleave: at
1230
+ }, O(n.label), 43, Ya))), 128))
1231
+ ], 2)) : Y("", !0)
1232
+ ])) : Y("", !0),
1233
+ w.value === "range" && (!a.minGranularity || a.minGranularity === "day" || a.minGranularity === "week") ? (u(), p("div", {
1234
+ key: 2,
1235
+ class: c(["border-t border-gray-200", _.value ? "gap-3 pt-3" : "gap-1.5 pt-1.5"])
1236
+ }, [
1237
+ We.value > 1 ? (u(), p("div", wa, [
1238
+ v("div", null, [
1239
+ v("p", Da, O(i.value("ui.period_select.From date")), 1),
1240
+ he(v("input", {
1241
+ type: "text",
1242
+ "onUpdate:modelValue": t[9] || (t[9] = (n) => oe.value = n),
1243
+ onBlur: t[10] || (t[10] = (n) => be("start")),
1244
+ onKeyup: t[11] || (t[11] = ke((n) => be("start"), ["enter"])),
1245
+ placeholder: "DD.MM.YYYY",
1246
+ class: "manual-input"
1247
+ }, null, 544), [
1248
+ [Ye, oe.value]
1249
+ ])
1250
+ ]),
1251
+ v("div", null, [
1252
+ v("p", Ma, O(i.value("ui.period_select.End date")), 1),
1253
+ he(v("input", {
1254
+ type: "text",
1255
+ "onUpdate:modelValue": t[12] || (t[12] = (n) => ue.value = n),
1256
+ onBlur: t[13] || (t[13] = (n) => be("end")),
1257
+ onKeyup: t[14] || (t[14] = ke((n) => be("end"), ["enter"])),
1258
+ placeholder: "DD.MM.YYYY",
1259
+ class: "manual-input"
1260
+ }, null, 544), [
1261
+ [Ye, ue.value]
1262
+ ])
1263
+ ])
1264
+ ])) : Y("", !0),
1265
+ v("div", {
1266
+ class: c(["flex", s.value.actionGap, _.value ? "justify-end" : ""])
1267
+ }, [
1268
+ _.value ? (u(), Q(S(Pe), {
1269
+ key: 0,
1270
+ variant: "secondary",
1271
+ label: i.value("ui.period_select.Cancel"),
1272
+ onClick: Mt,
1273
+ class: c(s.value.actionButton),
1274
+ size: s.value.actionButtonSize
1275
+ }, null, 8, ["label", "class", "size"])) : Y("", !0),
1276
+ J(S(Pe), {
1277
+ variant: "primary",
1278
+ icon: S(rt),
1279
+ label: i.value("ui.period_select.Apply"),
1280
+ onClick: Gt,
1281
+ disabled: !Te.value,
1282
+ class: c(s.value.actionButton),
1283
+ size: s.value.actionButtonSize
1284
+ }, null, 8, ["icon", "label", "disabled", "class", "size"])
1285
+ ], 2)
1286
+ ], 2)) : Y("", !0)
1287
+ ], 6)) : Y("", !0)
1288
+ ], 38)) : Y("", !0)
1289
+ ])),
1290
+ S(me).isOpened.value ? (u(), Q(oa, {
1291
+ key: 2,
1292
+ useModal: S(me),
1293
+ groups: yt.value,
1294
+ activePresetKey: $.value,
1295
+ t: i.value,
1296
+ size: a.size,
1297
+ onSelect: Vt
1298
+ }, null, 8, ["useModal", "groups", "activePresetKey", "t", "size"])) : Y("", !0)
1299
+ ], 4));
1300
+ }
1301
+ });
1302
+ const Fa = /* @__PURE__ */ pt(Oa, [["__scopeId", "data-v-0e53cd81"]]);
1303
+ export {
1304
+ G as DATE_KIND,
1305
+ we as MANUAL_DATE_KEY,
1306
+ le as MANUAL_RANGE_KEY,
1307
+ Fa as OnePeriodPicker,
1308
+ oa as OnePeriodPickerFastModal,
1309
+ ea as PERIOD_KIND,
1310
+ P as RANGE_KIND,
1311
+ M as buildPreset,
1312
+ ve as buildRollingOptions,
1313
+ it as createShortcutPresets,
1314
+ Ka as dayjs,
1315
+ ua as determineKind,
1316
+ De as formatDateShort,
1317
+ ut as formatPeriod,
1318
+ ia as getOptionGranularity,
1319
+ X as isOptionAllowed,
1320
+ fe as parseManualDate,
1321
+ $e as periodPickerSizeConfig,
1322
+ ot as toUnixOrNull
1323
+ };