@7pmlabs/design-system 0.8.2 → 1.0.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 (74) hide show
  1. package/dist/design-system.mjs +16 -16
  2. package/dist/design-system100.mjs +68 -6
  3. package/dist/design-system100.mjs.map +1 -1
  4. package/dist/design-system101.mjs +6 -67
  5. package/dist/design-system101.mjs.map +1 -1
  6. package/dist/design-system117.mjs +1 -1
  7. package/dist/design-system14.mjs +23 -17
  8. package/dist/design-system14.mjs.map +1 -1
  9. package/dist/design-system15.mjs +60 -25
  10. package/dist/design-system15.mjs.map +1 -1
  11. package/dist/design-system16.mjs +269 -53
  12. package/dist/design-system16.mjs.map +1 -1
  13. package/dist/design-system17.mjs +107 -263
  14. package/dist/design-system17.mjs.map +1 -1
  15. package/dist/design-system18.mjs +112 -112
  16. package/dist/design-system18.mjs.map +1 -1
  17. package/dist/design-system19.mjs +193 -113
  18. package/dist/design-system19.mjs.map +1 -1
  19. package/dist/design-system20.mjs +62 -188
  20. package/dist/design-system20.mjs.map +1 -1
  21. package/dist/design-system21.mjs +38 -69
  22. package/dist/design-system21.mjs.map +1 -1
  23. package/dist/design-system22.mjs +38 -34
  24. package/dist/design-system22.mjs.map +1 -1
  25. package/dist/design-system23.mjs +133 -42
  26. package/dist/design-system23.mjs.map +1 -1
  27. package/dist/design-system24.mjs +550 -129
  28. package/dist/design-system24.mjs.map +1 -1
  29. package/dist/design-system25.mjs +5 -562
  30. package/dist/design-system25.mjs.map +1 -1
  31. package/dist/design-system26.mjs +6 -5
  32. package/dist/design-system26.mjs.map +1 -1
  33. package/dist/design-system27.mjs +4 -5
  34. package/dist/design-system27.mjs.map +1 -1
  35. package/dist/design-system28.mjs +10 -5
  36. package/dist/design-system28.mjs.map +1 -1
  37. package/dist/design-system29.mjs +23 -10
  38. package/dist/design-system29.mjs.map +1 -1
  39. package/dist/design-system40.mjs +63 -45
  40. package/dist/design-system40.mjs.map +1 -1
  41. package/dist/design-system57.mjs +64 -37
  42. package/dist/design-system57.mjs.map +1 -1
  43. package/dist/design-system62.mjs +1 -1
  44. package/dist/design-system63.mjs +1 -1
  45. package/dist/design-system68.mjs +1 -1
  46. package/dist/design-system69.mjs +1 -1
  47. package/dist/design-system70.mjs +1 -1
  48. package/dist/design-system71.mjs +1 -1
  49. package/dist/design-system72.mjs +1 -1
  50. package/dist/design-system74.mjs +1 -1
  51. package/dist/design-system78.mjs +1 -1
  52. package/dist/design-system79.mjs +2 -2
  53. package/dist/design-system81.mjs +1 -1
  54. package/dist/design-system85.mjs +2 -2
  55. package/dist/design-system88.mjs +2 -2
  56. package/dist/design-system92.mjs +1 -1
  57. package/dist/design-system93.mjs +1 -1
  58. package/dist/design-system94.mjs +1 -1
  59. package/dist/design-system99.mjs +62 -63
  60. package/dist/design-system99.mjs.map +1 -1
  61. package/dist/style.css +1 -1
  62. package/dist/types/components/BCheckbox.vue.d.ts +31 -1
  63. package/dist/types/components/BCurrencyField.vue.d.ts +4 -4
  64. package/dist/types/components/BDatePicker/BDatePicker.vue.d.ts +3 -3
  65. package/dist/types/components/BImagePicker/BImagePicker.vue.d.ts +1 -1
  66. package/dist/types/components/BMultiSelect.vue.d.ts +2 -2
  67. package/dist/types/components/BOtpField/BOtpField.vue.d.ts +2 -2
  68. package/dist/types/components/BRadio.vue.d.ts +1 -1
  69. package/dist/types/components/BSelect.vue.d.ts +2 -2
  70. package/dist/types/components/BTextField.vue.d.ts +3 -3
  71. package/dist/types/components/BTextarea.vue.d.ts +3 -3
  72. package/dist/types/components/BToast/BToastItem.vue.d.ts +6 -1
  73. package/dist/types/types/components/BToast.d.ts +1 -0
  74. package/package.json +1 -1
@@ -1,144 +1,565 @@
1
- import { defineComponent as x, ref as n, computed as w, onMounted as z, nextTick as N, onUnmounted as V, openBlock as d, createElementBlock as u, createElementVNode as o, normalizeClass as g, Fragment as y, renderList as D, renderSlot as f, toDisplayString as R, createVNode as B, withDirectives as $, vShow as C, createBlock as I, Teleport as T, createCommentVNode as F } from "vue";
2
- import E from "./design-system105.mjs";
3
- import P from "./design-system98.mjs";
4
- const U = ["href", "title"], j = {
5
- "aria-hidden": "true",
6
- class: "ds-pl-2"
7
- }, q = ["id"], A = ["href", "title"], G = {
8
- key: 0,
9
- "aria-hidden": "true",
10
- class: "ds-pl-2"
11
- }, Q = /* @__PURE__ */ x({
12
- __name: "BBreadcrumb",
1
+ import { defineComponent as ia, ref as i, computed as M, watch as _, nextTick as Fe, onMounted as ca, onBeforeUnmount as va, openBlock as C, createElementBlock as U, createElementVNode as R, createVNode as S, normalizeClass as ie, withKeys as fa, withDirectives as ma, withCtx as ce, createTextVNode as ve, toDisplayString as fe, unref as B, createBlock as E, createCommentVNode as K, Fragment as ha, vShow as ga } from "vue";
2
+ import Re from "./design-system10.mjs";
3
+ import pa from "./design-system14.mjs";
4
+ import { useValidationField as ka } from "./design-system3.mjs";
5
+ import Da from "./design-system29.mjs";
6
+ import { useI18n as ya } from "./design-system49.mjs";
7
+ import { lockScrollBody as ba, ensureVisiblePosition as wa, unlockScrollBody as Be, resetPosition as Te } from "./design-system6.mjs";
8
+ import q from "./design-system104.mjs";
9
+ import { isISO8601 as Ie } from "./design-system48.mjs";
10
+ import Ma from "./design-system106.mjs";
11
+ import Ca from "./design-system107.mjs";
12
+ import Va from "./design-system108.mjs";
13
+ import _a from "./design-system109.mjs";
14
+ import Ya from "./design-system110.mjs";
15
+ import Sa from "./design-system111.mjs";
16
+ import { useDate as Pa } from "./design-system2.mjs";
17
+ import xa from "./design-system112.mjs";
18
+ import Fa from "./design-system113.mjs";
19
+ import { useBreakpoints as Ra, breakpointsTailwind as Ba } from "./design-system114.mjs";
20
+ import { BDatePickerView as k } from "./design-system5.mjs";
21
+ import Ta from "./design-system98.mjs";
22
+ import T from "./design-system103.mjs";
23
+ import w from "./design-system115.mjs";
24
+ const Ia = { class: "b-date-picker" }, $a = { class: "ds-relative" }, Na = ["id", "disabled", "placeholder", "value"], Oa = ["id", "disabled", "placeholder"], Ea = { class: "ds-mt-1 ds-grid ds-w-80 ds-gap-5 ds-rounded-lg ds-bg-white ds-p-3 ds-shadow-2xl" }, qa = { class: "ds-flex ds-w-full ds-items-center ds-justify-between" }, La = { class: "ds-grid ds-w-full ds-grid-cols-2 ds-gap-2" }, ft = /* @__PURE__ */ ia({
25
+ __name: "BDatePicker",
13
26
  props: {
14
- items: { default: () => [] }
27
+ inputId: { default: "" },
28
+ modelValue: { default: void 0 },
29
+ label: { default: "" },
30
+ validationRules: { default: void 0 },
31
+ placeholder: { default: "" },
32
+ required: { type: Boolean, default: !1 },
33
+ requiredErrorMessage: { default: "" },
34
+ disabled: { type: Boolean, default: !1 },
35
+ inputCssClass: { default: "" },
36
+ minDate: { default: void 0 },
37
+ maxDate: { default: void 0 },
38
+ range: { type: Boolean, default: !1 },
39
+ hideDetails: { type: Boolean, default: !1 },
40
+ view: { default: k.Dates }
15
41
  },
16
- setup(M) {
17
- const O = M, i = n(!1), c = n(null), h = n(null), v = n(null), m = n(null), l = n([]), k = new ResizeObserver(() => {
18
- if (l.value.length <= 1)
42
+ emits: ["update:modelValue"],
43
+ setup($e, { emit: Ne }) {
44
+ const t = $e, Oe = Ne;
45
+ let c;
46
+ const D = new Date(
47
+ (/* @__PURE__ */ new Date()).getFullYear(),
48
+ (/* @__PURE__ */ new Date()).getMonth(),
49
+ (/* @__PURE__ */ new Date()).getDate()
50
+ ), me = Ra(Ba).greaterOrEqual("sm"), { t: W, locale: G } = ya(), { formatMonthYear: Ee, formatDate: L, dateFormat: qe, convertToDate: Le } = Pa(), u = i({}), n = i([]), P = i({
51
+ year: D.getFullYear(),
52
+ month: D.getMonth()
53
+ }), s = i({
54
+ year: D.getFullYear(),
55
+ month: D.getMonth()
56
+ }), y = i(!1), g = i(t.view), I = i(null), x = i(null), he = i(null), J = i(null), F = i([]), Q = i([]), $ = i([]), j = i(""), ge = i(!1), pe = i(!1), v = M(() => d(t.minDate)), f = M(() => d(t.maxDate)), je = {
57
+ validateRule: (e) => !!e,
58
+ errorMessage: () => t.requiredErrorMessage || W("ds.global.field_required")
59
+ }, H = M(() => t.inputId || `id-${Ta()}`), r = M({
60
+ get() {
61
+ return t.modelValue;
62
+ },
63
+ set(e) {
64
+ Oe("update:modelValue", e);
65
+ }
66
+ }), He = M(
67
+ () => {
68
+ var e;
69
+ return (e = t.modelValue) == null ? void 0 : e.map(
70
+ (a) => L(typeof a == "string" ? new Date(a) : a)
71
+ ).join(" - ");
72
+ }
73
+ ), ze = M(() => {
74
+ let e = [];
75
+ return t.required && e.push(je), t.validationRules && (e = e.concat(t.validationRules)), e.length ? e : void 0;
76
+ }), { validate: Ae, validationResult: X } = ka(
77
+ H.value,
78
+ r,
79
+ ze.value
80
+ ), ke = M(() => [
81
+ "ds-border ds-rounded-lg ds-block ds-w-full ds-text-sm ds-px-3 ds-h-[40px] ds-transition-all ds-ease-in-out",
82
+ {
83
+ "ds-cursor-not-allowed ds-bg-[#f2f2f2] ds-text-black/[0.4]": t.disabled,
84
+ "ds-text-black/[0.85]": !t.disabled,
85
+ "ds-border-error focus:ds-ring-1 focus:ds-ring-error": !X.value.valid,
86
+ "ds-border-black/[0.1] focus:ds-border-focus focus:ds-ring-1 focus:ds-ring-focus": X.value.valid,
87
+ "!ds-border-focus ds-ring-1 ds-ring-focus": y.value
88
+ },
89
+ t.inputCssClass
90
+ ]), De = M(() => {
91
+ const e = {
92
+ mask: q.MaskedDate,
93
+ pattern: qe.value,
94
+ lazy: !0,
95
+ format: (a) => L(a),
96
+ parse: (a) => Le(a),
97
+ blocks: {
98
+ YYYY: {
99
+ mask: q.MaskedRange,
100
+ from: 1,
101
+ to: 9999
102
+ },
103
+ MM: {
104
+ mask: q.MaskedRange,
105
+ from: 1,
106
+ to: 12
107
+ },
108
+ DD: {
109
+ mask: q.MaskedRange,
110
+ from: 1,
111
+ to: 31
112
+ }
113
+ }
114
+ };
115
+ return v.value && (e.min = v.value), f.value && (e.max = f.value), e;
116
+ }), z = M(() => ({
117
+ [k.Years]: {
118
+ handleClickPreview: ea,
119
+ handleClickNext: aa
120
+ },
121
+ [k.Months]: {
122
+ handleClickPreview: ta,
123
+ handleClickNext: la,
124
+ handleClickHeading: Ke
125
+ },
126
+ [k.Dates]: {
127
+ handleClickPreview: sa,
128
+ handleClickNext: na,
129
+ handleClickHeading: Ue
130
+ }
131
+ }));
132
+ _(G, () => {
133
+ c && (c.off("accept", re), c.off("complete", de), c.updateOptions(De.value), Z(), c.on("accept", re), c.on("complete", de));
134
+ }), _(
135
+ () => t.minDate,
136
+ () => {
137
+ if (t.range) {
138
+ const e = r.value;
139
+ e.length > 0 && ye(e[0]);
140
+ } else {
141
+ const e = r.value;
142
+ ye(e);
143
+ }
144
+ b();
145
+ }
146
+ ), _(
147
+ () => t.maxDate,
148
+ () => {
149
+ if (t.range) {
150
+ const e = r.value;
151
+ e.length > 1 && ee(e[1]), e.length > 0 && ee(e[0]);
152
+ } else {
153
+ const e = r.value;
154
+ ee(e);
155
+ }
156
+ b();
157
+ }
158
+ ), _(
159
+ () => t.range,
160
+ (e) => {
161
+ e || Fe(() => {
162
+ Pe();
163
+ }), u.value = {}, n.value = [];
164
+ }
165
+ ), _(
166
+ () => t.view,
167
+ (e) => {
168
+ g.value = e;
169
+ }
170
+ ), _(me, () => {
171
+ y.value = !1;
172
+ }), _(y, (e) => {
173
+ e ? (ba(), t.range ? n.value = r.value ? be(r.value) : [] : u.value = r.value ? p(r.value) : {}, s.value = Y(P.value), Fe(() => {
174
+ me.value ? wa(I.value, x.value) : document.body.append(x.value);
175
+ })) : (Be(), Te(I.value, x.value));
176
+ }), _(
177
+ () => t.modelValue,
178
+ (e) => {
179
+ if (ae(e))
180
+ if (t.range) {
181
+ const a = e;
182
+ n.value = e ? be(a) : [], P.value = e ? p(a[1], !0) : {}, s.value = e ? p(a[1], !0) : {};
183
+ } else {
184
+ const a = e;
185
+ u.value = e ? p(a) : {}, P.value = e ? p(a, !0) : {}, s.value = e ? p(a, !0) : {};
186
+ }
187
+ !t.range && ae(ue()) && Z();
188
+ }
189
+ );
190
+ const Z = () => {
191
+ const e = d(t.modelValue);
192
+ c.value = e ? L(e) : "";
193
+ }, N = (e) => typeof t.modelValue == "string" ? e.toISOString() : e, ye = (e) => {
194
+ const a = d(e);
195
+ v.value && a && v.value > a && (r.value = void 0);
196
+ }, ee = (e) => {
197
+ const a = d(e);
198
+ f.value && a && f.value < a && (r.value = void 0);
199
+ }, d = (e) => {
200
+ switch (typeof e) {
201
+ case "object":
202
+ return e;
203
+ case "string":
204
+ return Ie(e) ? new Date(e) : void 0;
205
+ }
206
+ return e;
207
+ }, Ue = () => {
208
+ O(), g.value = k.Months;
209
+ }, Ke = () => {
210
+ A(), g.value = k.Years;
211
+ }, ae = (e) => {
212
+ var l, m;
213
+ return (t.range ? [
214
+ !T(t.modelValue) && T(e),
215
+ !T(e) && T(t.modelValue),
216
+ !T(t.modelValue) && !T(e) && t.modelValue.some(
217
+ (h, o) => {
218
+ var V, xe;
219
+ return ((V = d(h)) == null ? void 0 : V.getTime()) !== ((xe = d(e[o])) == null ? void 0 : xe.getTime());
220
+ }
221
+ )
222
+ ] : [
223
+ !t.modelValue && e,
224
+ !e && t.modelValue,
225
+ t.modelValue && e && ((l = d(t.modelValue)) == null ? void 0 : l.getTime()) !== ((m = d(e)) == null ? void 0 : m.getTime())
226
+ ]).some((h) => h);
227
+ }, We = () => {
228
+ y.value = !1;
229
+ }, Ge = () => {
230
+ y.value = !1, t.range ? n.value.length === 2 ? r.value = [
231
+ N(
232
+ new Date(
233
+ n.value[0].year,
234
+ n.value[0].month,
235
+ n.value[0].date
236
+ )
237
+ ),
238
+ N(
239
+ new Date(
240
+ n.value[1].year,
241
+ n.value[1].month,
242
+ n.value[1].date
243
+ )
244
+ )
245
+ ] : r.value = void 0 : !w(u.value.year) && !w(u.value.month) && !w(u.value.date) ? r.value = N(
246
+ new Date(
247
+ u.value.year,
248
+ u.value.month,
249
+ u.value.date
250
+ )
251
+ ) : r.value = void 0, P.value = Y(s.value);
252
+ }, Y = (e, a) => ({
253
+ year: e.year,
254
+ month: e.month,
255
+ date: a ? void 0 : e.date
256
+ }), p = (e, a) => ({
257
+ year: d(e).getFullYear(),
258
+ month: d(e).getMonth(),
259
+ date: a ? void 0 : d(e).getDate()
260
+ }), be = (e, a) => [
261
+ {
262
+ year: d(e[0]).getFullYear(),
263
+ month: d(e[0]).getMonth(),
264
+ date: a ? void 0 : d(e[0]).getDate()
265
+ },
266
+ {
267
+ year: d(e[1]).getFullYear(),
268
+ month: d(e[1]).getMonth(),
269
+ date: a ? void 0 : d(e[1]).getDate()
270
+ }
271
+ ], Je = (e) => {
272
+ s.value = Y(e), O(), g.value = k.Months;
273
+ }, Qe = (e) => {
274
+ s.value = Y(e), b(), g.value = k.Dates;
275
+ }, Xe = (e) => {
276
+ e.year === u.value.year && e.month === u.value.month && e.date === u.value.date ? u.value = Y({}) : (u.value = Y(e), s.value = Y(e, !0), b());
277
+ }, Ze = ({ year: e, month: a, date: l }) => {
278
+ const m = n.value.length;
279
+ if (m === 0)
280
+ n.value.push({ year: e, month: a, date: l });
281
+ else if (m === 1) {
282
+ const h = n.value.findIndex(
283
+ (o) => o.year === e && o.month === a && o.date === l
284
+ );
285
+ h !== -1 ? n.value.splice(h, 1) : new Date(e, a, l) > new Date(
286
+ n.value[0].year,
287
+ n.value[0].month,
288
+ n.value[0].date
289
+ ) ? n.value.push({ year: e, month: a, date: l }) : n.value.unshift({ year: e, month: a, date: l });
290
+ } else if (m === 2) {
291
+ const h = n.value.findIndex(
292
+ (o) => o.year === e && o.month === a && o.date === l
293
+ );
294
+ h !== -1 ? n.value.splice(h, 1) : (n.value = [], n.value.push({ year: e, month: a, date: l }));
295
+ }
296
+ s.value = {
297
+ year: e,
298
+ month: a
299
+ }, b();
300
+ }, ea = () => {
301
+ we(-1), A();
302
+ }, aa = () => {
303
+ we(1), A();
304
+ }, we = (e) => {
305
+ w(s.value.year) || (s.value.year += e * 10);
306
+ }, ta = () => {
307
+ Me(-1), O();
308
+ }, la = () => {
309
+ Me(1), O();
310
+ }, Me = (e) => {
311
+ w(s.value.year) || (s.value.year += e);
312
+ }, sa = () => {
313
+ Ce(-1), b();
314
+ }, na = () => {
315
+ Ce(1), b();
316
+ }, Ce = (e) => {
317
+ w(s.value.month) || (s.value.month += e);
318
+ }, oa = () => {
319
+ y.value = !0;
320
+ }, Ve = () => {
321
+ t.disabled || (y.value = !y.value);
322
+ }, te = (e) => (v.value ? v.value.getFullYear() > e : !1) || (f.value ? e > f.value.getFullYear() : !1), ua = (e, a) => (v.value ? v.value.getFullYear() === e && v.value.getMonth() > a || v.value.getFullYear() > e : !1) || (f.value ? f.value.getFullYear() === e && f.value.getMonth() < a || f.value.getFullYear() < e : !1), le = (e) => (v.value ? v.value > e : !1) || (f.value ? e > f.value : !1), se = (e, a) => new Date(e, a, 1), ne = (e, a) => new Date(e, a + 1, 0), A = () => {
323
+ if ($.value = [], w(s.value.year))
19
324
  return;
20
- const s = c.value.clientWidth, a = v.value[0].clientWidth;
21
- for (let e = 1; e < l.value.length && l.value.reduce(
22
- (t, r) => r.hidden ? t : t + r.width,
23
- 0
24
- ) + a > s; e++)
25
- l.value[e].hidden = !0;
26
- for (let e = l.value.length - 1; e >= 1; e--)
27
- if (l.value[e].hidden)
28
- if (l.value.reduce(
29
- (t, r) => r.hidden ? t : t + r.width,
30
- 0
31
- ) + l.value[e].width + a <= s)
32
- l.value[e].hidden = !1;
33
- else
34
- break;
35
- }), p = w(() => l.value.some((s) => s.hidden)), b = w(() => `menu-id-${P()}`), L = () => {
36
- i.value = !i.value;
37
- }, W = () => {
38
- document.addEventListener("click", _);
39
- }, S = () => {
40
- document.removeEventListener("click", _);
41
- }, _ = (s) => {
42
- [v.value[0], m.value[0]].some((t) => s.composedPath().includes(t)) || (i.value = !1);
43
- };
44
- return z(() => {
45
- W(), k.observe(c.value), l.value = O.items.map(
46
- (s) => ({
47
- ...s,
48
- hidden: !1,
49
- width: 0
50
- })
51
- ), N(() => {
52
- l.value.forEach((s, a) => {
53
- s.width = h.value[a].clientWidth;
325
+ const e = s.value.year.toString().slice(0, -1), a = +`${e}0`, l = +`${e}9`;
326
+ $.value.push({
327
+ year: a - 1,
328
+ secondary: !0,
329
+ disabled: te(a - 1)
330
+ });
331
+ for (let o = a; o <= l; o++)
332
+ $.value.push({
333
+ year: o,
334
+ disabled: te(o)
54
335
  });
336
+ $.value.push({
337
+ year: l + 1,
338
+ secondary: !0,
339
+ disabled: te(l + 1)
340
+ }), j.value = `${e}0 - ${e}9`;
341
+ const m = se(a, 0), h = ne(l, 11);
342
+ oe(m, h);
343
+ }, O = () => {
344
+ if (Q.value = [], w(s.value.year))
345
+ return;
346
+ for (let l = 0; l < 12; l++)
347
+ Q.value.push({
348
+ year: s.value.year,
349
+ month: l,
350
+ disabled: ua(s.value.year, l)
351
+ });
352
+ j.value = s.value.year.toString();
353
+ const e = se(s.value.year, 0), a = ne(s.value.year, 11);
354
+ oe(e, a);
355
+ }, b = () => {
356
+ if (F.value = [], w(s.value.year) || w(s.value.month))
357
+ return;
358
+ const e = se(
359
+ s.value.year,
360
+ s.value.month
361
+ ), a = ne(
362
+ s.value.year,
363
+ s.value.month
364
+ ), l = structuredClone(e);
365
+ let m = l.getDay() === 0 ? 6 : l.getDay() - 1;
366
+ for (; m > 0; ) {
367
+ const o = structuredClone(l);
368
+ o.setDate(-(m - 1)), F.value.push({
369
+ date: o.getDate(),
370
+ month: o.getMonth(),
371
+ year: o.getFullYear(),
372
+ secondary: !0,
373
+ disabled: le(o)
374
+ }), m--;
375
+ }
376
+ for (; l <= a; )
377
+ F.value.push({
378
+ date: l.getDate(),
379
+ month: l.getMonth(),
380
+ year: l.getFullYear(),
381
+ disabled: le(l)
382
+ }), l.setDate(l.getDate() + 1);
383
+ const h = l.getDay() === 0 ? 1 : 7 - l.getDay() + 1;
384
+ if (h < 6) {
385
+ let o = 1;
386
+ const V = structuredClone(l);
387
+ for (; o <= h; )
388
+ V.setDate(o), F.value.push({
389
+ date: V.getDate(),
390
+ month: V.getMonth(),
391
+ year: V.getFullYear(),
392
+ secondary: !0,
393
+ disabled: le(V)
394
+ }), o++;
395
+ }
396
+ j.value = Ee(
397
+ new Date(s.value.year, s.value.month, 1)
398
+ ).toString(), oe(e, a);
399
+ }, oe = (e, a) => {
400
+ ge.value = v.value ? v.value >= e : !1, pe.value = f.value ? f.value <= a : !1;
401
+ }, ue = () => {
402
+ const e = c.value.split("/"), a = {
403
+ "vi-VN": `${e[2]}-${e[1]}-${e[0]}`,
404
+ "en-US": `${e[2]}-${e[0]}-${e[1]}`
405
+ };
406
+ return Ie(a[G.value]) ? new Date(a[G.value]) : void 0;
407
+ }, re = () => {
408
+ c.unmaskedValue || (r.value = void 0, u.value = {
409
+ year: D.getFullYear(),
410
+ month: D.getMonth()
55
411
  });
56
- }), V(() => {
57
- S(), k.unobserve(c.value);
58
- }), (s, a) => (d(), u("nav", null, [
59
- o("ol", {
60
- ref_key: "ulRef",
61
- ref: c,
62
- class: g([{ collapsed: p.value }, "ds-relative ds-flex"])
412
+ }, de = () => {
413
+ const e = ue();
414
+ e ? (r.value = N(e), u.value = p(e), P.value = p(e, !0), s.value = p(e, !0), b()) : (r.value = void 0, u.value = {
415
+ year: D.getFullYear(),
416
+ month: D.getMonth()
417
+ });
418
+ }, ra = () => {
419
+ const e = ue();
420
+ Ae(), ae(e) && (e ? (r.value = N(e), P.value = p(e, !0), u.value = p(e), s.value = p(e, !0), b()) : (r.value = void 0, u.value = {
421
+ year: D.getFullYear(),
422
+ month: D.getMonth()
423
+ }));
424
+ }, _e = (e) => {
425
+ [I.value, x.value].some((m) => e.composedPath().includes(m)) || Se();
426
+ }, Ye = (e) => {
427
+ e.key === "Escape" && Se();
428
+ }, Se = () => {
429
+ var e, a;
430
+ y.value = !1, (e = he.value) == null || e.blur(), (a = J.value) == null || a.blur();
431
+ }, Pe = () => {
432
+ c = q(J.value, De.value), Z(), c.on("accept", re), c.on("complete", de);
433
+ }, da = () => {
434
+ c && c.destroy();
435
+ };
436
+ return (() => {
437
+ A(), O(), b();
438
+ })(), ca(() => {
439
+ t.range || Pe(), document.addEventListener("click", _e), document.addEventListener("keydown", Ye);
440
+ }), va(() => {
441
+ da(), Be(), Te(I.value, x.value), document.removeEventListener("keydown", Ye), document.removeEventListener("click", _e);
442
+ }), (e, a) => (C(), U("div", Ia, [
443
+ R("div", {
444
+ ref_key: "datePickerRef",
445
+ ref: I
63
446
  }, [
64
- (d(!0), u(y, null, D(l.value, (e, t) => {
65
- var r;
66
- return d(), u(y, {
67
- key: `item${e.text}`
68
- }, [
69
- t === 0 ? (d(), u("li", {
70
- key: 0,
71
- ref_for: !0,
72
- ref_key: "liRefs",
73
- ref: h,
74
- class: "ds-whitespace-nowrap ds-text-black/[0.85]"
75
- }, [
76
- f(s.$slots, `item-${t}`, { item: e }, () => [
77
- o("a", {
78
- href: e.href,
79
- title: e.href,
80
- class: "ds-transition-colors hover:ds-text-primary-t"
81
- }, R(e.text), 9, U)
82
- ]),
83
- o("span", j, [
84
- f(s.$slots, `separator-${t}`, { item: e }, () => [
85
- B(E)
86
- ])
87
- ]),
88
- o("div", {
89
- ref_for: !0,
90
- ref_key: "ellipsisRefs",
91
- ref: v,
92
- class: "ds-inline-block"
93
- }, [
94
- $(o("button", {
95
- class: g([{ "ds-bg-slate-50": i.value }, "ds-ml-2 ds-rounded-lg ds-bg-slate-100 ds-px-2 ds-text-primary-t ds-transition-colors hover:ds-bg-slate-50"]),
96
- onClick: L
97
- }, " ... ", 2), [
98
- [C, p.value]
447
+ S(pa, {
448
+ id: H.value,
449
+ label: e.label,
450
+ required: e.required
451
+ }, null, 8, ["id", "label", "required"]),
452
+ R("div", $a, [
453
+ t.range ? (C(), U("input", {
454
+ key: 0,
455
+ id: H.value,
456
+ ref_key: "datePickerInputRef",
457
+ ref: he,
458
+ class: ie([ke.value, "ds-drop-shadow-light"]),
459
+ disabled: e.disabled,
460
+ placeholder: e.placeholder,
461
+ value: He.value,
462
+ readonly: "",
463
+ onFocus: oa
464
+ }, null, 42, Na)) : (C(), U("input", {
465
+ key: 1,
466
+ id: H.value,
467
+ ref_key: "datePickerInputMaskRef",
468
+ ref: J,
469
+ class: ie([ke.value, "ds-drop-shadow-light"]),
470
+ disabled: e.disabled,
471
+ placeholder: e.placeholder,
472
+ onBlur: ra
473
+ }, null, 42, Oa)),
474
+ S(Sa, {
475
+ disabled: t.disabled,
476
+ onClick: Ve,
477
+ onKeyup: fa(Ve, ["enter"])
478
+ }, null, 8, ["disabled"])
479
+ ]),
480
+ ma(R("div", {
481
+ ref_key: "datePickerMenuRef",
482
+ ref: x,
483
+ class: "b-date-picker__menu sm:ds-items-[unset] sm:ds-justify-[unset] ds-fixed ds-left-0 ds-top-0 ds-z-100 ds-flex ds-h-full ds-w-full ds-items-center ds-justify-center ds-bg-black/65 ds-backdrop-blur-sm sm:ds-absolute sm:ds-left-[unset] sm:ds-top-[unset] sm:ds-z-50 sm:ds-block sm:ds-h-auto sm:ds-w-auto sm:ds-bg-transparent sm:ds-backdrop-blur-none"
484
+ }, [
485
+ R("div", Ea, [
486
+ R("div", qa, [
487
+ S(Va, {
488
+ disabled: ge.value,
489
+ onClick: a[0] || (a[0] = (l) => z.value[g.value].handleClickPreview())
490
+ }, null, 8, ["disabled"]),
491
+ S(Ya, {
492
+ class: ie({
493
+ "ds-cursor-pointer hover:ds-bg-blue-light focus-visible:ds-bg-blue-light": z.value[g.value].handleClickHeading
494
+ }),
495
+ onClick: z.value[g.value].handleClickHeading
496
+ }, {
497
+ default: ce(() => [
498
+ ve(fe(j.value), 1)
99
499
  ]),
100
- $(o("ol", {
101
- id: b.value,
102
- ref_for: !0,
103
- ref_key: "ellipsisMenuRefs",
104
- ref: m,
105
- class: "ds-absolute ds-mt-1 ds-space-y-2 ds-rounded-lg ds-bg-white ds-p-4 ds-shadow"
106
- }, null, 8, q), [
107
- [C, p.value && i.value]
108
- ])
109
- ], 512)
110
- ], 512)) : (d(), I(T, {
500
+ _: 1
501
+ }, 8, ["class", "onClick"]),
502
+ S(_a, {
503
+ disabled: pe.value,
504
+ onClick: a[1] || (a[1] = (l) => z.value[g.value].handleClickNext())
505
+ }, null, 8, ["disabled"])
506
+ ]),
507
+ g.value === B(k).Years ? (C(), E(xa, {
508
+ key: 0,
509
+ year: u.value,
510
+ years: $.value,
511
+ "onSelect:year": Je
512
+ }, null, 8, ["year", "years"])) : K("", !0),
513
+ g.value === B(k).Months ? (C(), E(Ca, {
111
514
  key: 1,
112
- disabled: !e.hidden,
113
- to: `#${b.value}`
114
- }, [
115
- o("li", {
116
- ref_for: !0,
117
- ref_key: "liRefs",
118
- ref: h,
119
- class: "ds-whitespace-nowrap ds-pl-2 ds-text-black/[0.85]"
120
- }, [
121
- f(s.$slots, `item-${t}`, { item: e }, () => [
122
- o("a", {
123
- href: e.href,
124
- title: e.href,
125
- class: "ds-transition-colors hover:ds-text-primary-t"
126
- }, R(e.text), 9, A)
515
+ month: u.value,
516
+ months: Q.value,
517
+ "onSelect:month": Qe
518
+ }, null, 8, ["month", "months"])) : K("", !0),
519
+ g.value === B(k).Dates ? (C(), U(ha, { key: 2 }, [
520
+ t.range ? (C(), E(Fa, {
521
+ key: 0,
522
+ "date-range": n.value,
523
+ dates: F.value,
524
+ "onSelect:date": Ze
525
+ }, null, 8, ["date-range", "dates"])) : (C(), E(Ma, {
526
+ key: 1,
527
+ date: u.value,
528
+ dates: F.value,
529
+ "onSelect:date": Xe
530
+ }, null, 8, ["date", "dates"]))
531
+ ], 64)) : K("", !0),
532
+ R("div", La, [
533
+ S(Re, { onClick: We }, {
534
+ default: ce(() => [
535
+ ve(fe(B(W)("ds.components.base.date_picker.buttons.cancel")), 1)
536
+ ]),
537
+ _: 1
538
+ }),
539
+ S(Re, {
540
+ type: "primary",
541
+ onClick: Ge
542
+ }, {
543
+ default: ce(() => [
544
+ ve(fe(B(W)("ds.components.base.date_picker.buttons.confirm")), 1)
127
545
  ]),
128
- t < ((r = s.items) == null ? void 0 : r.length) - 1 ? (d(), u("span", G, [
129
- f(s.$slots, `separator-${t}`, { item: e }, () => [
130
- B(E)
131
- ])
132
- ])) : F("", !0)
133
- ], 512)
134
- ], 8, ["disabled", "to"]))
135
- ], 64);
136
- }), 128))
137
- ], 2)
546
+ _: 1
547
+ })
548
+ ])
549
+ ])
550
+ ], 512), [
551
+ [ga, y.value]
552
+ ])
553
+ ], 512),
554
+ e.hideDetails ? K("", !0) : (C(), E(Da, {
555
+ key: 0,
556
+ "error-message": B(X).errorMessage(),
557
+ class: "ds-mt-1"
558
+ }, null, 8, ["error-message"]))
138
559
  ]));
139
560
  }
140
561
  });
141
562
  export {
142
- Q as default
563
+ ft as default
143
564
  };
144
565
  //# sourceMappingURL=design-system24.mjs.map