@memobit/libs 3.8.0 → 3.8.2
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.
- package/dist/components/Calendar/Calendar2.js +59 -57
- package/dist/components/DatePicker/DatePicker.css +1 -1
- package/dist/components/DatePicker/DatePicker2.js +51 -49
- package/dist/helpers/VersionInfo.js +1 -1
- package/dist/memobit-icons.json +2 -0
- package/dist/version.js +2 -2
- package/dist/version.json +4 -4
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import './Calendar.css';
|
|
2
|
-
import { Tooltip as
|
|
3
|
-
import { addMonths as H,
|
|
2
|
+
import { Tooltip as _ } from "../Tooltip/Tooltip2.js";
|
|
3
|
+
import { addMonths as H, formatDate as ue, getMonthMatrix as _e, isAfter as he, isBefore as A, isSameDay as h, isToday as me, isWeekend as fe } from "../../helpers/Datetime.js";
|
|
4
4
|
/* empty css */
|
|
5
|
-
import { useMemo as
|
|
6
|
-
import { Fragment as V, jsx as n, jsxs as
|
|
7
|
-
var d = 12,
|
|
5
|
+
import { useMemo as ye, useState as M } from "react";
|
|
6
|
+
import { Fragment as V, jsx as n, jsxs as m } from "react/jsx-runtime";
|
|
7
|
+
var d = 12, S = [
|
|
8
8
|
"January",
|
|
9
9
|
"February",
|
|
10
10
|
"March",
|
|
@@ -17,7 +17,7 @@ var d = 12, T = [
|
|
|
17
17
|
"October",
|
|
18
18
|
"November",
|
|
19
19
|
"December"
|
|
20
|
-
],
|
|
20
|
+
], ge = [
|
|
21
21
|
"Sun",
|
|
22
22
|
"Mon",
|
|
23
23
|
"Tue",
|
|
@@ -25,7 +25,7 @@ var d = 12, T = [
|
|
|
25
25
|
"Thu",
|
|
26
26
|
"Fri",
|
|
27
27
|
"Sat"
|
|
28
|
-
],
|
|
28
|
+
], be = [
|
|
29
29
|
"Mon",
|
|
30
30
|
"Tue",
|
|
31
31
|
"Wed",
|
|
@@ -33,7 +33,7 @@ var d = 12, T = [
|
|
|
33
33
|
"Fri",
|
|
34
34
|
"Sat",
|
|
35
35
|
"Sun"
|
|
36
|
-
],
|
|
36
|
+
], we = ({ value: r, onChange: f, mode: i = "single", minDate: T, maxDate: v, disabledDates: p, firstDayOfWeek: D = 0, showToday: j = !0, yearOnly: R = !1, className: G = "", currentMonth: I, onMonthChange: c, showHeader: F = !0, rangeStart: J, onRangeStartChange: Y }) => {
|
|
37
37
|
const [P, u] = M(() => {
|
|
38
38
|
if (r) {
|
|
39
39
|
if (r instanceof Date) return new Date(r.getFullYear(), r.getMonth(), 1);
|
|
@@ -41,17 +41,17 @@ var d = 12, T = [
|
|
|
41
41
|
if (Array.isArray(r) && r.length > 0) return new Date(r[0].getFullYear(), r[0].getMonth(), 1);
|
|
42
42
|
}
|
|
43
43
|
return new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), 1);
|
|
44
|
-
}), [y, g] = M("days"), [b,
|
|
45
|
-
const e = (
|
|
44
|
+
}), [y, g] = M("days"), [b, k] = M(() => {
|
|
45
|
+
const e = (I ?? P).getFullYear();
|
|
46
46
|
return Math.floor(e / d) * d;
|
|
47
|
-
}), [O, E] = M(null), a =
|
|
47
|
+
}), [O, E] = M(null), a = I ?? P, o = J ?? O, B = ye(() => _e(a.getFullYear(), a.getMonth(), D), [a, D]), W = D === 1 ? be : ge, w = (e) => T && A(e, T) || v && he(e, v) ? !0 : p ? typeof p == "function" ? p(e) : p.some((t) => h(t, e)) : !1, q = (e) => {
|
|
48
48
|
if (!r) return !1;
|
|
49
|
-
if (i === "single" && r instanceof Date) return
|
|
49
|
+
if (i === "single" && r instanceof Date) return h(e, r);
|
|
50
50
|
if (i === "range") {
|
|
51
|
-
if (o) return
|
|
52
|
-
if (r && "start" in r) return
|
|
51
|
+
if (o) return h(e, o);
|
|
52
|
+
if (r && "start" in r) return h(e, r.start) || h(e, r.end);
|
|
53
53
|
}
|
|
54
|
-
return i === "multiple" && Array.isArray(r) ? r.some((t) =>
|
|
54
|
+
return i === "multiple" && Array.isArray(r) ? r.some((t) => h(t, e)) : !1;
|
|
55
55
|
}, z = (e) => {
|
|
56
56
|
if (i === "range" && r && "start" in r) {
|
|
57
57
|
const { start: t, end: l } = r, s = e.getTime();
|
|
@@ -59,24 +59,24 @@ var d = 12, T = [
|
|
|
59
59
|
}
|
|
60
60
|
return !1;
|
|
61
61
|
}, K = (e) => i === "range" && o ? e.getTime() > o.getTime() : !1, L = (e) => e.getMonth() === a.getMonth(), Q = (e) => {
|
|
62
|
-
if (!
|
|
63
|
-
if (i === "single")
|
|
62
|
+
if (!w(e)) {
|
|
63
|
+
if (i === "single") f?.(e);
|
|
64
64
|
else if (i === "range")
|
|
65
65
|
if (!o)
|
|
66
|
-
Y ? Y(e) : (E(e),
|
|
66
|
+
Y ? Y(e) : (E(e), f?.(void 0));
|
|
67
67
|
else {
|
|
68
|
-
const t =
|
|
69
|
-
|
|
68
|
+
const t = A(e, o) ? e : o, l = A(e, o) ? o : e;
|
|
69
|
+
f?.({
|
|
70
70
|
start: t,
|
|
71
71
|
end: l
|
|
72
72
|
}), Y ? Y(null) : E(null);
|
|
73
73
|
}
|
|
74
74
|
else if (i === "multiple") {
|
|
75
|
-
const t = Array.isArray(r) ? r : [], l = t.findIndex((s) =>
|
|
75
|
+
const t = Array.isArray(r) ? r : [], l = t.findIndex((s) => h(s, e));
|
|
76
76
|
if (l >= 0) {
|
|
77
|
-
const s = t.filter((
|
|
78
|
-
|
|
79
|
-
} else
|
|
77
|
+
const s = t.filter((x, N) => N !== l);
|
|
78
|
+
f?.(s.length > 0 ? s : void 0);
|
|
79
|
+
} else f?.([...t, e]);
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
}, U = () => {
|
|
@@ -87,11 +87,11 @@ var d = 12, T = [
|
|
|
87
87
|
c ? c(e) : u(e);
|
|
88
88
|
}, Z = () => {
|
|
89
89
|
const e = /* @__PURE__ */ new Date(), t = new Date(e.getFullYear(), e.getMonth(), 1);
|
|
90
|
-
c ? c(t) : u(t), g("days"), i === "single" &&
|
|
90
|
+
c ? c(t) : u(t), g("days"), i === "single" && f?.(e);
|
|
91
91
|
}, C = () => {
|
|
92
92
|
F && g("months");
|
|
93
93
|
}, $ = () => {
|
|
94
|
-
F && (
|
|
94
|
+
F && (k(Math.floor(a.getFullYear() / d) * d), g("years"));
|
|
95
95
|
}, ee = (e) => {
|
|
96
96
|
const t = new Date(a.getFullYear(), e, 1);
|
|
97
97
|
c ? c(t) : u(t), g("days");
|
|
@@ -99,9 +99,9 @@ var d = 12, T = [
|
|
|
99
99
|
const t = new Date(e, a.getMonth(), 1);
|
|
100
100
|
c ? c(t) : u(t), g("months");
|
|
101
101
|
}, ne = () => {
|
|
102
|
-
|
|
102
|
+
k(b - d);
|
|
103
103
|
}, re = () => {
|
|
104
|
-
|
|
104
|
+
k(b + d);
|
|
105
105
|
}, ae = () => {
|
|
106
106
|
const e = new Date(a.getFullYear() - 1, a.getMonth(), 1);
|
|
107
107
|
c ? c(e) : u(e);
|
|
@@ -114,11 +114,11 @@ var d = 12, T = [
|
|
|
114
114
|
return e;
|
|
115
115
|
}, ce = (e) => {
|
|
116
116
|
const t = ["calendar__day"];
|
|
117
|
-
return L(e) ? (q(e) && t.push("calendar__day--selected"), z(e) && t.push("calendar__day--in-range"), K(e) && t.push("calendar__day--hover-range")) : t.push("calendar__day--other-month"),
|
|
118
|
-
}, ie = () => y === "years" ? /* @__PURE__ */
|
|
117
|
+
return L(e) ? (q(e) && t.push("calendar__day--selected"), z(e) && t.push("calendar__day--in-range"), K(e) && t.push("calendar__day--hover-range")) : t.push("calendar__day--other-month"), me(e) && t.push("calendar__day--today"), fe(e) && t.push("calendar__day--weekend"), w(e) && t.push("calendar__day--disabled"), t.join(" ");
|
|
118
|
+
}, ie = () => y === "years" ? /* @__PURE__ */ m("div", {
|
|
119
119
|
className: "calendar__header",
|
|
120
120
|
children: [
|
|
121
|
-
/* @__PURE__ */ n(
|
|
121
|
+
/* @__PURE__ */ n(_, {
|
|
122
122
|
title: "Previous years",
|
|
123
123
|
children: /* @__PURE__ */ n("button", {
|
|
124
124
|
type: "button",
|
|
@@ -127,7 +127,7 @@ var d = 12, T = [
|
|
|
127
127
|
children: "‹"
|
|
128
128
|
})
|
|
129
129
|
}),
|
|
130
|
-
/* @__PURE__ */
|
|
130
|
+
/* @__PURE__ */ m("div", {
|
|
131
131
|
className: "calendar__month-year",
|
|
132
132
|
children: [
|
|
133
133
|
b,
|
|
@@ -135,7 +135,7 @@ var d = 12, T = [
|
|
|
135
135
|
b + d - 1
|
|
136
136
|
]
|
|
137
137
|
}),
|
|
138
|
-
/* @__PURE__ */ n(
|
|
138
|
+
/* @__PURE__ */ n(_, {
|
|
139
139
|
title: "Next years",
|
|
140
140
|
children: /* @__PURE__ */ n("button", {
|
|
141
141
|
type: "button",
|
|
@@ -145,10 +145,10 @@ var d = 12, T = [
|
|
|
145
145
|
})
|
|
146
146
|
})
|
|
147
147
|
]
|
|
148
|
-
}) : y === "months" ? /* @__PURE__ */
|
|
148
|
+
}) : y === "months" ? /* @__PURE__ */ m("div", {
|
|
149
149
|
className: "calendar__header",
|
|
150
150
|
children: [
|
|
151
|
-
/* @__PURE__ */ n(
|
|
151
|
+
/* @__PURE__ */ n(_, {
|
|
152
152
|
title: "Previous year",
|
|
153
153
|
children: /* @__PURE__ */ n("button", {
|
|
154
154
|
type: "button",
|
|
@@ -163,7 +163,7 @@ var d = 12, T = [
|
|
|
163
163
|
onClick: $,
|
|
164
164
|
children: a.getFullYear()
|
|
165
165
|
}),
|
|
166
|
-
/* @__PURE__ */ n(
|
|
166
|
+
/* @__PURE__ */ n(_, {
|
|
167
167
|
title: "Next year",
|
|
168
168
|
children: /* @__PURE__ */ n("button", {
|
|
169
169
|
type: "button",
|
|
@@ -173,10 +173,10 @@ var d = 12, T = [
|
|
|
173
173
|
})
|
|
174
174
|
})
|
|
175
175
|
]
|
|
176
|
-
}) : /* @__PURE__ */
|
|
176
|
+
}) : /* @__PURE__ */ m("div", {
|
|
177
177
|
className: "calendar__header",
|
|
178
178
|
children: [
|
|
179
|
-
/* @__PURE__ */ n(
|
|
179
|
+
/* @__PURE__ */ n(_, {
|
|
180
180
|
title: "Previous month",
|
|
181
181
|
children: /* @__PURE__ */ n("button", {
|
|
182
182
|
type: "button",
|
|
@@ -187,14 +187,14 @@ var d = 12, T = [
|
|
|
187
187
|
}),
|
|
188
188
|
/* @__PURE__ */ n("div", {
|
|
189
189
|
className: "calendar__month-year",
|
|
190
|
-
children:
|
|
190
|
+
children: R ? /* @__PURE__ */ n("span", {
|
|
191
191
|
className: "calendar__header-label",
|
|
192
|
-
children:
|
|
193
|
-
}) : /* @__PURE__ */
|
|
192
|
+
children: S[a.getMonth()]
|
|
193
|
+
}) : /* @__PURE__ */ m(V, { children: [/* @__PURE__ */ n("button", {
|
|
194
194
|
type: "button",
|
|
195
195
|
className: "calendar__header-button",
|
|
196
196
|
onClick: C,
|
|
197
|
-
children:
|
|
197
|
+
children: S[a.getMonth()]
|
|
198
198
|
}), /* @__PURE__ */ n("button", {
|
|
199
199
|
type: "button",
|
|
200
200
|
className: "calendar__header-button",
|
|
@@ -202,7 +202,7 @@ var d = 12, T = [
|
|
|
202
202
|
children: a.getFullYear()
|
|
203
203
|
})] })
|
|
204
204
|
}),
|
|
205
|
-
/* @__PURE__ */ n(
|
|
205
|
+
/* @__PURE__ */ n(_, {
|
|
206
206
|
title: "Next month",
|
|
207
207
|
children: /* @__PURE__ */ n("button", {
|
|
208
208
|
type: "button",
|
|
@@ -227,22 +227,22 @@ var d = 12, T = [
|
|
|
227
227
|
const e = (/* @__PURE__ */ new Date()).getMonth(), t = (/* @__PURE__ */ new Date()).getFullYear(), l = a.getMonth(), s = a.getFullYear();
|
|
228
228
|
return /* @__PURE__ */ n("div", {
|
|
229
229
|
className: "calendar__months-grid",
|
|
230
|
-
children:
|
|
230
|
+
children: S.map((x, N) => /* @__PURE__ */ n("button", {
|
|
231
231
|
type: "button",
|
|
232
232
|
className: `calendar__month-item ${N === l && s === a.getFullYear() ? "calendar__month-item--selected" : ""} ${N === e && t === a.getFullYear() ? "calendar__month-item--current" : ""}`,
|
|
233
233
|
onClick: () => ee(N),
|
|
234
|
-
children:
|
|
235
|
-
},
|
|
234
|
+
children: x.substring(0, 3)
|
|
235
|
+
}, x))
|
|
236
236
|
});
|
|
237
237
|
};
|
|
238
|
-
return /* @__PURE__ */
|
|
238
|
+
return /* @__PURE__ */ m("div", {
|
|
239
239
|
className: `calendar ${G}`,
|
|
240
240
|
children: [
|
|
241
241
|
F && ie(),
|
|
242
242
|
y === "years" && oe(),
|
|
243
243
|
y === "months" && de(),
|
|
244
|
-
y === "days" && /* @__PURE__ */
|
|
245
|
-
j && !
|
|
244
|
+
y === "days" && /* @__PURE__ */ m(V, { children: [
|
|
245
|
+
j && !R && /* @__PURE__ */ n("div", {
|
|
246
246
|
className: "calendar__today-section",
|
|
247
247
|
children: /* @__PURE__ */ n("button", {
|
|
248
248
|
type: "button",
|
|
@@ -262,13 +262,15 @@ var d = 12, T = [
|
|
|
262
262
|
className: "calendar__days",
|
|
263
263
|
children: B.map((e, t) => /* @__PURE__ */ n("div", {
|
|
264
264
|
className: "calendar__week",
|
|
265
|
-
children: e.map((l, s) => /* @__PURE__ */ n(
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
265
|
+
children: e.map((l, s) => /* @__PURE__ */ n(_, {
|
|
266
|
+
title: ue(l, "DD MMM YYYY"),
|
|
267
|
+
children: /* @__PURE__ */ n("button", {
|
|
268
|
+
type: "button",
|
|
269
|
+
className: ce(l),
|
|
270
|
+
onClick: () => Q(l),
|
|
271
|
+
disabled: w(l),
|
|
272
|
+
children: l.getDate()
|
|
273
|
+
})
|
|
272
274
|
}, s))
|
|
273
275
|
}, t))
|
|
274
276
|
})
|
|
@@ -277,5 +279,5 @@ var d = 12, T = [
|
|
|
277
279
|
});
|
|
278
280
|
};
|
|
279
281
|
export {
|
|
280
|
-
|
|
282
|
+
we as Calendar
|
|
281
283
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
:root{--radius-sm:4px;--radius:8px;--radius-full:9999px;--checkbox-size:18px;--radio-size:18px;--body-background-glow:none;--spacing-1:1px;--spacing-2:2px;--spacing-4:4px;--spacing-6:6px;--spacing-8:8px;--spacing-12:12px;--spacing-16:16px;--spacing-20:20px;--spacing-24:24px;--spacing-32:32px;--spacing-40:40px;--spacing-48:48px;--spacing-60:60px;--spacing-64:64px;--spacing-80:80px;--spacing-100:100px;--spacing-200:200px;--spacing-300:300px;--spacing-400:400px;--font-size-xxs:.625rem;--font-size-xs:.75rem;--font-size-sm:.875rem;--font-size-md:1rem;--font-size-lg:1.25rem;--font-size-xl:1.5rem;--font-size-xxl:2rem;--font-size-xxxl:3rem;--font-family-display:var(--font-family,sans-serif);--font-family-mono:ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;--form-control-font-family:var(--font-family,sans-serif);--font-weight-light:300;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--line-height-none:1;--line-height-tight:1.2;--line-height-normal:1.5;--line-height-loose:1.8;--duration-hover:.2s;--duration-fade:.3s;--duration-slide:.4s;--transition-fast:.15s ease-in-out;--transition-moderate:.3s ease-in-out;--transition-slow:.5s ease-in-out}.datepicker{width:100%;max-width:300px;display:inline-block;position:relative}.datepicker__input{background-color:var(--form-control-background-color);border:var(--spacing-1) solid var(--form-control-border-color);border-radius:var(--radius-sm);color:var(--form-control-color);cursor:pointer;justify-content:space-between;align-items:center;gap:var(--spacing-8);padding:var(--spacing-12);font-size:var(--font-size-sm);line-height:var(--line-height-normal);box-sizing:border-box;transition:border-color .2s,background-color .2s;display:flex}.datepicker__input:hover:not(.datepicker__input--disabled){border-color:var(--form-control-focus-border-color)}.datepicker__input--open{border-color:var(--form-control-focus-border-color);background-color:var(--form-control-focus-background-color)}.datepicker__input--disabled{opacity:.5;cursor:not-allowed}.datepicker__value{font-size:inherit;white-space:nowrap;text-overflow:ellipsis;flex:1;overflow:hidden}.datepicker__value--placeholder{color:var(--form-control-placeholder-color)}.datepicker__actions{align-items:center;gap:var(--spacing-4);display:flex}.datepicker__clear{color:var(--form-control-placeholder-color);cursor:pointer;font-size:var(--font-size-md);background:0 0;border:none;padding:0;line-height:1;transition:color .2s}.datepicker__clear:hover{color:var(--form-control-color)}.datepicker__icon{font-size:var(--font-size-md);line-height:1}.datepicker__dropdown{background-color:var(--calendar-background-color);border:1px solid var(--calendar-border-color);border-radius:var(--radius);padding:var(--spacing-16);box-sizing:border-box;min-width:280px;max-height:calc(100vh - var(--spacing-32));z-index:1100;position:fixed;top:0;left:0;overflow-y:auto;box-shadow:0 4px 12px #00000026}.datepicker__dropdown--inline{margin-top:var(--spacing-12);box-shadow:none;z-index:auto;max-height:none;position:static;overflow:visible}.datepicker__dropdown-close{width:var(--spacing-32);height:var(--spacing-32);
|
|
1
|
+
:root{--radius-sm:4px;--radius:8px;--radius-full:9999px;--checkbox-size:18px;--radio-size:18px;--body-background-glow:none;--spacing-1:1px;--spacing-2:2px;--spacing-4:4px;--spacing-6:6px;--spacing-8:8px;--spacing-12:12px;--spacing-16:16px;--spacing-20:20px;--spacing-24:24px;--spacing-32:32px;--spacing-40:40px;--spacing-48:48px;--spacing-60:60px;--spacing-64:64px;--spacing-80:80px;--spacing-100:100px;--spacing-200:200px;--spacing-300:300px;--spacing-400:400px;--font-size-xxs:.625rem;--font-size-xs:.75rem;--font-size-sm:.875rem;--font-size-md:1rem;--font-size-lg:1.25rem;--font-size-xl:1.5rem;--font-size-xxl:2rem;--font-size-xxxl:3rem;--font-family-display:var(--font-family,sans-serif);--font-family-mono:ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;--form-control-font-family:var(--font-family,sans-serif);--font-weight-light:300;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--line-height-none:1;--line-height-tight:1.2;--line-height-normal:1.5;--line-height-loose:1.8;--duration-hover:.2s;--duration-fade:.3s;--duration-slide:.4s;--transition-fast:.15s ease-in-out;--transition-moderate:.3s ease-in-out;--transition-slow:.5s ease-in-out}.datepicker{width:100%;max-width:300px;display:inline-block;position:relative}.datepicker__input{background-color:var(--form-control-background-color);border:var(--spacing-1) solid var(--form-control-border-color);border-radius:var(--radius-sm);color:var(--form-control-color);cursor:pointer;justify-content:space-between;align-items:center;gap:var(--spacing-8);padding:var(--spacing-12);font-size:var(--font-size-sm);line-height:var(--line-height-normal);box-sizing:border-box;transition:border-color .2s,background-color .2s;display:flex}.datepicker__input:hover:not(.datepicker__input--disabled){border-color:var(--form-control-focus-border-color)}.datepicker__input--open{border-color:var(--form-control-focus-border-color);background-color:var(--form-control-focus-background-color)}.datepicker__input--disabled{opacity:.5;cursor:not-allowed}.datepicker__value{font-size:inherit;white-space:nowrap;text-overflow:ellipsis;flex:1;overflow:hidden}.datepicker__value--placeholder{color:var(--form-control-placeholder-color)}.datepicker__actions{align-items:center;gap:var(--spacing-4);display:flex}.datepicker__clear{color:var(--form-control-placeholder-color);cursor:pointer;font-size:var(--font-size-md);background:0 0;border:none;padding:0;line-height:1;transition:color .2s}.datepicker__clear:hover{color:var(--form-control-color)}.datepicker__icon{font-size:var(--font-size-md);line-height:1}.datepicker__dropdown{gap:var(--spacing-12);background-color:var(--calendar-background-color);border:1px solid var(--calendar-border-color);border-radius:var(--radius);padding:var(--spacing-8) var(--spacing-16) var(--spacing-16);box-sizing:border-box;min-width:280px;max-height:calc(100vh - var(--spacing-32));z-index:1100;flex-direction:column;display:flex;position:fixed;top:0;left:0;overflow-y:auto;box-shadow:0 4px 12px #00000026}.datepicker__dropdown>*{flex-shrink:0}.datepicker__dropdown .calendar{background-color:#0000;border:none;border-radius:0;padding:0}.datepicker__dropdown--inline{margin-top:var(--spacing-12);padding-top:var(--spacing-16);box-shadow:none;z-index:auto;max-height:none;position:static;overflow:visible}.datepicker__dropdown-close{width:var(--spacing-32);height:var(--spacing-32);border-radius:var(--radius-full);color:var(--body-sub-title-color);cursor:pointer;z-index:1;background:0 0;border:none;flex-shrink:0;justify-content:center;align-self:flex-end;align-items:center;transition:color .2s,background-color .2s;display:flex;position:sticky;top:0}.datepicker__dropdown-close:hover{color:var(--body-color);background-color:var(--card-background-accent-color)}.datepicker__time{border-top:1px solid var(--calendar-border-color);padding-top:var(--spacing-16)}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import './DatePicker.css';
|
|
2
2
|
import { Icon as H } from "../Icon/Icon2.js";
|
|
3
|
-
import { Tooltip as
|
|
3
|
+
import { Tooltip as E } from "../Tooltip/Tooltip2.js";
|
|
4
4
|
import { APP_DATE_FORMAT as Z, formatDate as l } from "../../helpers/Datetime.js";
|
|
5
5
|
import { Calendar as O } from "../Calendar/Calendar2.js";
|
|
6
6
|
import { TimePicker as ee } from "../TimePicker/TimePicker2.js";
|
|
7
7
|
/* empty css */
|
|
8
|
-
import { useCallback as te, useEffect as x, useRef as
|
|
9
|
-
import { Fragment as ne, jsx as
|
|
8
|
+
import { useCallback as te, useEffect as x, useRef as L, useState as D } from "react";
|
|
9
|
+
import { Fragment as ne, jsx as r, jsxs as h } from "react/jsx-runtime";
|
|
10
10
|
import { createPortal as re } from "react-dom";
|
|
11
|
-
var me = ({ value: t, onChange: g, mode: s = "single", withTime: f = !1, timeFormat:
|
|
12
|
-
const [
|
|
11
|
+
var me = ({ value: t, onChange: g, mode: s = "single", withTime: f = !1, timeFormat: M = "24h", withSeconds: w = !1, withClock: P = !1, clockSize: I = 208, minuteStep: z = 1, dateFormat: _ = Z, placeholder: F = "Select date...", disabled: b = !1, clearable: j = !0, autoClose: N = !0, alwaysOpen: i = !1, ...C }) => {
|
|
12
|
+
const [B, u] = D(!1), [k, S] = D({
|
|
13
13
|
hours: 0,
|
|
14
14
|
minutes: 0,
|
|
15
15
|
seconds: 0
|
|
16
|
-
}), [
|
|
16
|
+
}), [q, p] = D(null), [y, $] = D({
|
|
17
17
|
position: "fixed",
|
|
18
18
|
visibility: "hidden"
|
|
19
|
-
}), m =
|
|
19
|
+
}), m = L(null), c = L(null);
|
|
20
20
|
x(() => {
|
|
21
21
|
f && t instanceof Date && S({
|
|
22
22
|
hours: t.getHours(),
|
|
@@ -24,26 +24,26 @@ var me = ({ value: t, onChange: g, mode: s = "single", withTime: f = !1, timeFor
|
|
|
24
24
|
seconds: t.getSeconds()
|
|
25
25
|
});
|
|
26
26
|
}, [t, f]);
|
|
27
|
-
const o =
|
|
27
|
+
const o = i ? !b : B;
|
|
28
28
|
x(() => {
|
|
29
|
-
if (
|
|
29
|
+
if (i) return;
|
|
30
30
|
const e = (n) => {
|
|
31
31
|
o && m.current && c.current && !m.current.contains(n.target) && !c.current.contains(n.target) && (p(null), u(!1));
|
|
32
32
|
};
|
|
33
33
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
34
|
-
}, [
|
|
34
|
+
}, [i, o]);
|
|
35
35
|
const a = te(() => {
|
|
36
|
-
if (
|
|
37
|
-
const e = m.current.getBoundingClientRect(), n = c.current.getBoundingClientRect(), d = 16, A = 8,
|
|
36
|
+
if (i || !o || !m.current || !c.current) return;
|
|
37
|
+
const e = m.current.getBoundingClientRect(), n = c.current.getBoundingClientRect(), d = 16, A = 8, T = window.innerHeight - e.bottom - d, U = e.top - d, V = T < n.height && U > n.height ? e.top - n.height - A : e.bottom + A, X = Math.max(d, Math.min(V, window.innerHeight - n.height - d)), Y = Math.max(d, Math.min(e.left, window.innerWidth - n.width - d));
|
|
38
38
|
$({
|
|
39
39
|
position: "fixed",
|
|
40
|
-
top: `${
|
|
41
|
-
left: `${
|
|
40
|
+
top: `${X}px`,
|
|
41
|
+
left: `${Y}px`,
|
|
42
42
|
zIndex: 1100
|
|
43
43
|
});
|
|
44
|
-
}, [
|
|
44
|
+
}, [i, o]);
|
|
45
45
|
x(() => {
|
|
46
|
-
if (
|
|
46
|
+
if (i || !o) {
|
|
47
47
|
$({
|
|
48
48
|
position: "fixed",
|
|
49
49
|
visibility: "hidden"
|
|
@@ -57,48 +57,48 @@ var me = ({ value: t, onChange: g, mode: s = "single", withTime: f = !1, timeFor
|
|
|
57
57
|
cancelAnimationFrame(e), n.disconnect(), window.removeEventListener("resize", a), window.removeEventListener("scroll", a, !0);
|
|
58
58
|
};
|
|
59
59
|
}, [
|
|
60
|
-
|
|
60
|
+
i,
|
|
61
61
|
o,
|
|
62
62
|
a
|
|
63
63
|
]);
|
|
64
|
-
const
|
|
64
|
+
const W = () => {
|
|
65
65
|
if (!t) return "";
|
|
66
66
|
if (s === "single" && t instanceof Date) {
|
|
67
67
|
const e = l(t, _);
|
|
68
68
|
return f ? `${e} ${w ? l(t, "HH:mm:ss") : l(t, "HH:mm")}` : e;
|
|
69
69
|
}
|
|
70
70
|
return s === "range" && t && "start" in t ? `${l(t.start, _)} - ${l(t.end, _)}` : s === "multiple" && Array.isArray(t) ? t.map((e) => l(e, _)).join(", ") : "";
|
|
71
|
-
},
|
|
71
|
+
}, G = (e) => {
|
|
72
72
|
if (!f || !(e instanceof Date)) {
|
|
73
|
-
g?.(e), N && s !== "multiple" && !
|
|
73
|
+
g?.(e), N && s !== "multiple" && !i && u(!1);
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
76
|
const n = new Date(e);
|
|
77
|
-
n.setHours(k.hours, k.minutes, k.seconds), g?.(n), N && !
|
|
78
|
-
},
|
|
77
|
+
n.setHours(k.hours, k.minutes, k.seconds), g?.(n), N && !i && u(!1);
|
|
78
|
+
}, J = (e) => {
|
|
79
79
|
if (S(e), !(t instanceof Date)) return;
|
|
80
80
|
const n = new Date(t);
|
|
81
81
|
n.setHours(e.hours, e.minutes, e.seconds), g?.(n);
|
|
82
|
-
},
|
|
82
|
+
}, K = (e) => {
|
|
83
83
|
e.stopPropagation(), p(null), g?.(void 0);
|
|
84
|
-
},
|
|
84
|
+
}, Q = () => {
|
|
85
85
|
p(null), u(!1);
|
|
86
|
-
}, R =
|
|
86
|
+
}, R = W(), v = () => /* @__PURE__ */ h(ne, { children: [/* @__PURE__ */ r(O, {
|
|
87
87
|
...C,
|
|
88
88
|
mode: s,
|
|
89
89
|
value: t,
|
|
90
|
-
onChange:
|
|
91
|
-
rangeStart: s === "range" ?
|
|
90
|
+
onChange: G,
|
|
91
|
+
rangeStart: s === "range" ? q : C.rangeStart,
|
|
92
92
|
onRangeStartChange: s === "range" ? p : C.onRangeStartChange
|
|
93
|
-
}), f && s === "single" && t instanceof Date && /* @__PURE__ */
|
|
93
|
+
}), f && s === "single" && t instanceof Date && /* @__PURE__ */ r("div", {
|
|
94
94
|
className: "datepicker__time",
|
|
95
|
-
children: /* @__PURE__ */
|
|
96
|
-
clockSize:
|
|
97
|
-
format:
|
|
98
|
-
minuteStep:
|
|
99
|
-
onChange:
|
|
95
|
+
children: /* @__PURE__ */ r(ee, {
|
|
96
|
+
clockSize: I,
|
|
97
|
+
format: M,
|
|
98
|
+
minuteStep: z,
|
|
99
|
+
onChange: J,
|
|
100
100
|
value: k,
|
|
101
|
-
withClock:
|
|
101
|
+
withClock: P,
|
|
102
102
|
withSeconds: w
|
|
103
103
|
})
|
|
104
104
|
})] });
|
|
@@ -108,40 +108,42 @@ var me = ({ value: t, onChange: g, mode: s = "single", withTime: f = !1, timeFor
|
|
|
108
108
|
ref: m,
|
|
109
109
|
className: `datepicker__input ${b ? "datepicker__input--disabled" : ""} ${o ? "datepicker__input--open" : ""}`,
|
|
110
110
|
onClick: () => {
|
|
111
|
-
b ||
|
|
111
|
+
b || i || (o && p(null), u(!o));
|
|
112
112
|
},
|
|
113
|
-
children: [/* @__PURE__ */
|
|
113
|
+
children: [/* @__PURE__ */ r("span", {
|
|
114
114
|
className: `datepicker__value ${R ? "" : "datepicker__value--placeholder"}`,
|
|
115
|
-
children: R ||
|
|
115
|
+
children: R || F
|
|
116
116
|
}), /* @__PURE__ */ h("div", {
|
|
117
117
|
className: "datepicker__actions",
|
|
118
|
-
children: [
|
|
118
|
+
children: [j && R && /* @__PURE__ */ r(E, {
|
|
119
119
|
title: "Clear",
|
|
120
|
-
children: /* @__PURE__ */
|
|
120
|
+
children: /* @__PURE__ */ r("button", {
|
|
121
121
|
type: "button",
|
|
122
122
|
className: "datepicker__clear",
|
|
123
|
-
onClick:
|
|
123
|
+
onClick: K,
|
|
124
124
|
children: "×"
|
|
125
125
|
})
|
|
126
|
-
}), /* @__PURE__ */
|
|
126
|
+
}), /* @__PURE__ */ r("span", {
|
|
127
127
|
className: "datepicker__icon",
|
|
128
|
-
children: /* @__PURE__ */
|
|
128
|
+
children: /* @__PURE__ */ r(H, { name: "calendar" })
|
|
129
129
|
})]
|
|
130
130
|
})]
|
|
131
|
-
}), o && (
|
|
131
|
+
}), o && (i ? /* @__PURE__ */ r("div", {
|
|
132
132
|
ref: c,
|
|
133
133
|
className: "datepicker__dropdown datepicker__dropdown--inline",
|
|
134
134
|
children: v()
|
|
135
135
|
}) : re(/* @__PURE__ */ h("div", {
|
|
136
136
|
ref: c,
|
|
137
137
|
className: "datepicker__dropdown",
|
|
138
|
-
style:
|
|
139
|
-
children: [/* @__PURE__ */
|
|
140
|
-
type: "button",
|
|
141
|
-
className: "datepicker__dropdown-close",
|
|
142
|
-
onClick: K,
|
|
138
|
+
style: y,
|
|
139
|
+
children: [/* @__PURE__ */ r(E, {
|
|
143
140
|
title: "Close",
|
|
144
|
-
children: /* @__PURE__ */
|
|
141
|
+
children: /* @__PURE__ */ r("button", {
|
|
142
|
+
type: "button",
|
|
143
|
+
className: "datepicker__dropdown-close",
|
|
144
|
+
onClick: Q,
|
|
145
|
+
children: /* @__PURE__ */ r(H, { name: "clear" })
|
|
146
|
+
})
|
|
145
147
|
}), v()]
|
|
146
148
|
}), document.body))]
|
|
147
149
|
});
|
package/dist/memobit-icons.json
CHANGED
package/dist/version.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var I = "3.8.
|
|
1
|
+
var I = "3.8.2", B = 493, L = "26077c7", _ = "2026-10-13T14:15:24.319Z", r = "493";
|
|
2
2
|
export {
|
|
3
3
|
_ as LIB_BUILD_DATE,
|
|
4
|
-
|
|
4
|
+
r as LIB_BUILD_ID,
|
|
5
5
|
B as LIB_BUILD_NUMBER,
|
|
6
6
|
L as LIB_COMMIT,
|
|
7
7
|
I as LIB_VERSION
|
package/dist/version.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memobit/libs",
|
|
3
|
-
"version": "3.8.
|
|
3
|
+
"version": "3.8.2",
|
|
4
4
|
"description": "React component library powering the Memobit apps — 100+ components, helpers and hooks. Icons ship as @memobit/icons and themes as @memobit/themes. TypeScript-first, ESM-only, React 19.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|