@adyen/adyen-platform-experience-web 1.0.2 → 1.0.3
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/cjs/index.js +2 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/components/internal/Calendar/calendar/facade/Calendar.js +221 -211
- package/dist/es/components/internal/Calendar/calendar/timeframe/frames/MonthFrame.js +103 -94
- package/dist/es/components/internal/Calendar/calendar/timeframe/frames/TimeFrame.js +201 -200
- package/dist/es/components/internal/Calendar/calendar/timerange/presets/lastNDays.js +19 -18
- package/dist/es/components/internal/Calendar/calendar/timerange/presets/shared/offsetMonth.js +18 -17
- package/dist/es/components/internal/Calendar/calendar/timerange/presets/shared/offsetWeek.js +17 -20
- package/dist/es/components/internal/Calendar/calendar/timerange/presets/yearToDate.js +9 -12
- package/dist/es/components/internal/Calendar/calendar/timerange/utils.js +39 -43
- package/dist/es/components/internal/Calendar/calendar/timeslice/TimeSlice.js +10 -10
- package/dist/es/components/internal/Calendar/calendar/timeslice/index.js +25 -26
- package/dist/es/components/internal/Calendar/calendar/utils.js +64 -16
- package/dist/es/components/internal/Calendar/hooks/useCalendar.js +40 -38
- package/dist/es/components/internal/Calendar/hooks/useTimezone.js +2 -2
- package/dist/es/components/internal/DatePicker/DatePicker.js +17 -16
- package/dist/es/components/internal/FilterBar/filters/AmountFilter/AmountFilter.js +14 -14
- package/dist/es/components/internal/FilterBar/filters/AmountFilter/RangeSelection.js +19 -17
- package/dist/es/components/internal/FilterBar/filters/DateFilter/DateFilterCore.js +81 -76
- package/dist/es/core/Http/utils.js +1 -1
- package/dist/es/core/Localization/datetime/restamper/utils.js +26 -26
- package/dist/es/core/core.js +1 -1
- package/dist/es/primitives/time/today/main.js +38 -43
- package/dist/style.css +1 -1
- package/dist/types/components/internal/Calendar/calendar/facade/Calendar.d.ts.map +1 -1
- package/dist/types/components/internal/Calendar/calendar/timeframe/frames/MonthFrame.d.ts +1 -1
- package/dist/types/components/internal/Calendar/calendar/timeframe/frames/MonthFrame.d.ts.map +1 -1
- package/dist/types/components/internal/Calendar/calendar/timeframe/frames/TimeFrame.d.ts +3 -3
- package/dist/types/components/internal/Calendar/calendar/timeframe/frames/TimeFrame.d.ts.map +1 -1
- package/dist/types/components/internal/Calendar/calendar/timeframe/frames/YearFrame.d.ts +1 -1
- package/dist/types/components/internal/Calendar/calendar/timeframe/frames/YearFrame.d.ts.map +1 -1
- package/dist/types/components/internal/Calendar/calendar/timerange/presets/lastNDays.d.ts.map +1 -1
- package/dist/types/components/internal/Calendar/calendar/timerange/presets/shared/offsetMonth.d.ts.map +1 -1
- package/dist/types/components/internal/Calendar/calendar/timerange/presets/shared/offsetWeek.d.ts.map +1 -1
- package/dist/types/components/internal/Calendar/calendar/timerange/presets/yearToDate.d.ts.map +1 -1
- package/dist/types/components/internal/Calendar/calendar/timerange/utils.d.ts +0 -5
- package/dist/types/components/internal/Calendar/calendar/timerange/utils.d.ts.map +1 -1
- package/dist/types/components/internal/Calendar/calendar/timeslice/TimeSlice.d.ts +2 -2
- package/dist/types/components/internal/Calendar/calendar/timeslice/TimeSlice.d.ts.map +1 -1
- package/dist/types/components/internal/Calendar/calendar/timeslice/index.d.ts.map +1 -1
- package/dist/types/components/internal/Calendar/calendar/types.d.ts +6 -1
- package/dist/types/components/internal/Calendar/calendar/types.d.ts.map +1 -1
- package/dist/types/components/internal/Calendar/calendar/utils.d.ts +13 -4
- package/dist/types/components/internal/Calendar/calendar/utils.d.ts.map +1 -1
- package/dist/types/components/internal/Calendar/hooks/useCalendar.d.ts +1 -1
- package/dist/types/components/internal/Calendar/hooks/useCalendar.d.ts.map +1 -1
- package/dist/types/components/internal/Calendar/types.d.ts +1 -0
- package/dist/types/components/internal/Calendar/types.d.ts.map +1 -1
- package/dist/types/components/internal/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/types/components/internal/FilterBar/filters/AmountFilter/RangeSelection.d.ts.map +1 -1
- package/dist/types/components/internal/FilterBar/filters/DateFilter/DateFilterCore.d.ts.map +1 -1
- package/dist/types/core/Localization/datetime/restamper/utils.d.ts.map +1 -1
- package/dist/types/primitives/time/today/main.d.ts.map +1 -1
- package/package.json +2 -1
package/dist/es/components/internal/Calendar/calendar/timerange/presets/shared/offsetWeek.js
CHANGED
|
@@ -1,36 +1,33 @@
|
|
|
1
1
|
import p from "../../factory.js";
|
|
2
|
-
import { offsetsForNDays as
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import { offsetsForNDays as D, getRangeTimestampsContextIntegerPropertyFactory as y, nowTimestamp as F } from "../../utils.js";
|
|
3
|
+
import { startOfWeek as W } from "../../../utils.js";
|
|
4
|
+
import { clamp as g } from "../../../../../../../utils/value/number.js";
|
|
5
|
+
const r = 1, k = D(7), E = y(0, 6, r), T = (s = 0) => {
|
|
6
|
+
const e = ~~g(0, s, 1 / 0) || 0;
|
|
6
7
|
return (n = r) => {
|
|
7
|
-
const
|
|
8
|
-
offsets:
|
|
8
|
+
const a = e ? {
|
|
9
|
+
offsets: k
|
|
9
10
|
} : {
|
|
10
|
-
to:
|
|
11
|
-
}, o =
|
|
11
|
+
to: F
|
|
12
|
+
}, o = E(n);
|
|
12
13
|
return p({
|
|
13
14
|
from: ({
|
|
14
|
-
now:
|
|
15
|
+
now: f,
|
|
16
|
+
timezone: m,
|
|
15
17
|
systemToTimezone: c,
|
|
16
18
|
timezoneToSystem: i
|
|
17
19
|
}) => {
|
|
18
|
-
const t = new Date(
|
|
19
|
-
|
|
20
|
-
const g = e > 1 ? -1 : e < -1 ? 1 : e;
|
|
21
|
-
t.setDate(t.getDate() - g);
|
|
22
|
-
}
|
|
23
|
-
const y = d(o.value, t.getDay()) - s * 7;
|
|
24
|
-
return t.setDate(t.getDate() + y), c(t);
|
|
20
|
+
const t = new Date(i(W(f, m, o.value)));
|
|
21
|
+
return t.setDate(t.getDate() - e * 7), c(t);
|
|
25
22
|
},
|
|
26
|
-
...
|
|
23
|
+
...a
|
|
27
24
|
}, {
|
|
28
25
|
firstWeekDay: o.descriptor
|
|
29
26
|
})();
|
|
30
27
|
};
|
|
31
|
-
},
|
|
28
|
+
}, d = T;
|
|
32
29
|
export {
|
|
33
30
|
r as DEFAULT_FIRST_WEEK_DAY,
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
k as ONE_WEEK_OFFSETS,
|
|
32
|
+
d as default
|
|
36
33
|
};
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import r from "../factory.js";
|
|
2
|
+
import { nowTimestamp as a } from "../utils.js";
|
|
3
|
+
import { startOfYear as e } from "../../utils.js";
|
|
4
|
+
const m = r({
|
|
4
5
|
from: ({
|
|
5
6
|
now: t,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return l(e), e.setFullYear(e.getFullYear() - s), a(e);
|
|
11
|
-
},
|
|
12
|
-
to: n
|
|
13
|
-
}), u = c;
|
|
7
|
+
timezone: o
|
|
8
|
+
}) => e(t, o),
|
|
9
|
+
to: a
|
|
10
|
+
}), i = m;
|
|
14
11
|
export {
|
|
15
|
-
|
|
12
|
+
i as default
|
|
16
13
|
};
|
|
@@ -1,59 +1,55 @@
|
|
|
1
|
-
import { systemToTimezone as
|
|
2
|
-
import { clamp as
|
|
3
|
-
import { enumerable as m, getter as z, hasOwnProperty as
|
|
4
|
-
import { struct as
|
|
5
|
-
import { isUndefined as
|
|
6
|
-
const
|
|
7
|
-
systemToTimezone: m((
|
|
8
|
-
timezoneToSystem: m((
|
|
9
|
-
timezoneOffset: m((
|
|
10
|
-
}),
|
|
11
|
-
const
|
|
12
|
-
let
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
return
|
|
1
|
+
import { systemToTimezone as p, timezoneToSystem as g } from "../../../../../core/Localization/datetime/restamper/utils.js";
|
|
2
|
+
import { clamp as T, isBitSafeInteger as l } from "../../../../../utils/value/number.js";
|
|
3
|
+
import { enumerable as m, getter as z, hasOwnProperty as c } from "../../../../../utils/struct/property.js";
|
|
4
|
+
import { struct as u } from "../../../../../utils/struct/main.js";
|
|
5
|
+
import { isUndefined as d, isNullish as h, isFunction as w } from "../../../../../utils/value/is.js";
|
|
6
|
+
const O = (e) => Object.freeze({
|
|
7
|
+
systemToTimezone: m((t) => p(e, t)),
|
|
8
|
+
timezoneToSystem: m((t) => g(e, t)),
|
|
9
|
+
timezoneOffset: m((t) => e(t).offset)
|
|
10
|
+
}), V = (e, t, o = e) => {
|
|
11
|
+
const a = (n, i) => {
|
|
12
|
+
let s = n;
|
|
13
|
+
h(n) ? s = o : l(n) || (s = i ?? o);
|
|
14
|
+
const r = T(e, s, t);
|
|
15
|
+
return r === s ? r : i ?? o;
|
|
16
16
|
};
|
|
17
17
|
return (n) => {
|
|
18
|
-
const
|
|
19
|
-
let
|
|
20
|
-
return
|
|
21
|
-
value:
|
|
18
|
+
const i = z(() => s);
|
|
19
|
+
let s = a(n);
|
|
20
|
+
return u({
|
|
21
|
+
value: i,
|
|
22
22
|
descriptor: m({
|
|
23
|
-
...
|
|
24
|
-
set(
|
|
25
|
-
const
|
|
26
|
-
|
|
23
|
+
...i,
|
|
24
|
+
set(r) {
|
|
25
|
+
const f = s;
|
|
26
|
+
s = a(r, s), f !== s && (this.now = this.now);
|
|
27
27
|
}
|
|
28
28
|
})
|
|
29
29
|
});
|
|
30
30
|
};
|
|
31
|
-
},
|
|
32
|
-
now:
|
|
33
|
-
}) =>
|
|
34
|
-
const
|
|
35
|
-
return (
|
|
36
|
-
let
|
|
37
|
-
return
|
|
31
|
+
}, x = (e, t) => (o) => w(o) ? o.call(e, t) : o, P = (e) => !c(e, "offsets"), S = (e) => c(e, "from"), j = ({
|
|
32
|
+
now: e
|
|
33
|
+
}) => e, U = (() => {
|
|
34
|
+
const e = /* @__PURE__ */ new Map();
|
|
35
|
+
return (t) => {
|
|
36
|
+
let o = e.get(t);
|
|
37
|
+
return d(o) && (o = Object.freeze([0, 0, t, 0, 0, 0, -1]), e.set(t, o)), o;
|
|
38
38
|
};
|
|
39
|
-
})(),
|
|
39
|
+
})(), W = (e) => {
|
|
40
40
|
try {
|
|
41
|
-
const
|
|
42
|
-
return isNaN(
|
|
41
|
+
const t = e instanceof Date || +e === e ? e : void 0, o = new Date(t).getTime();
|
|
42
|
+
return isNaN(o) ? void 0 : o;
|
|
43
43
|
} catch {
|
|
44
44
|
}
|
|
45
|
-
}
|
|
45
|
+
};
|
|
46
46
|
export {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
O as createRangeTimestampsConfigRestampingContext,
|
|
48
|
+
x as getRangeTimestampsConfigParameterUnwrapper,
|
|
49
|
+
V as getRangeTimestampsContextIntegerPropertyFactory,
|
|
50
50
|
S as isRangeTimestampsConfigWithFromOffsets,
|
|
51
51
|
P as isRangeTimestampsConfigWithoutOffsets,
|
|
52
52
|
j as nowTimestamp,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
c as startOfDay,
|
|
56
|
-
W as startOfMonth,
|
|
57
|
-
B as startOfWeekOffset,
|
|
58
|
-
_ as startOfYear
|
|
53
|
+
U as offsetsForNDays,
|
|
54
|
+
W as parseRangeTimestamp
|
|
59
55
|
};
|
|
@@ -16,27 +16,27 @@ var u = (i, t, s, T) => ({
|
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
import { RANGE_FROM as l, RANGE_TO as d } from "../constants.js";
|
|
19
|
-
import { computeTimestampOffset as o, getEdgesDistance as
|
|
19
|
+
import { computeTimestampOffset as o, getEdgesDistance as _ } from "../utils.js";
|
|
20
20
|
var p, h, m, a, r;
|
|
21
|
-
class
|
|
21
|
+
class w {
|
|
22
22
|
constructor(...t) {
|
|
23
23
|
n(this, p, 1 / 0);
|
|
24
24
|
n(this, h, 1 / 0);
|
|
25
25
|
n(this, m, -1 / 0);
|
|
26
26
|
n(this, a, 0);
|
|
27
27
|
n(this, r, 0);
|
|
28
|
-
if (t.length >=
|
|
29
|
-
let s = new Date(t[
|
|
30
|
-
if (typeof t[
|
|
31
|
-
f(this, m, s || e(this, m)), f(this, h, new Date(t[
|
|
28
|
+
if (t.length >= 3) {
|
|
29
|
+
let s = new Date(t[1]).getTime();
|
|
30
|
+
if (typeof t[2] != "symbol")
|
|
31
|
+
f(this, m, s || e(this, m)), f(this, h, new Date(t[2]).getTime() || e(this, h)), e(this, h) < e(this, m) && ([u(this, h)._, u(this, m)._] = [e(this, m), e(this, h)]), f(this, r, o(e(this, m), t[0])), f(this, a, o(e(this, h), t[0])), f(this, p, _(e(this, m), e(this, h), t[0]) + 1);
|
|
32
32
|
else if (!isNaN(s))
|
|
33
|
-
switch (t[
|
|
33
|
+
switch (t[2]) {
|
|
34
34
|
case d:
|
|
35
|
-
f(this, h, s), f(this, a, o(e(this, h)));
|
|
35
|
+
f(this, h, s), f(this, a, o(e(this, h), t[0]));
|
|
36
36
|
break;
|
|
37
37
|
case l:
|
|
38
38
|
default:
|
|
39
|
-
f(this, m, s), f(this, r, o(e(this, m)));
|
|
39
|
+
f(this, m, s), f(this, r, o(e(this, m), t[0]));
|
|
40
40
|
break;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
@@ -59,5 +59,5 @@ class N {
|
|
|
59
59
|
}
|
|
60
60
|
p = new WeakMap(), h = new WeakMap(), m = new WeakMap(), a = new WeakMap(), r = new WeakMap();
|
|
61
61
|
export {
|
|
62
|
-
|
|
62
|
+
w as default
|
|
63
63
|
};
|
|
@@ -1,33 +1,32 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { RANGE_FROM as
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
to:
|
|
11
|
-
value: t.endTimestamp
|
|
12
|
-
},
|
|
1
|
+
import n from "./TimeSlice.js";
|
|
2
|
+
import { RANGE_FROM as c, RANGE_TO as l } from "../constants.js";
|
|
3
|
+
import { withTimezone as r } from "../utils.js";
|
|
4
|
+
import { struct as f } from "../../../../../utils/struct/main.js";
|
|
5
|
+
import { getter as o } from "../../../../../utils/struct/property.js";
|
|
6
|
+
const m = (...s) => {
|
|
7
|
+
let t = r().tz.current, e = new n(t, ...s);
|
|
8
|
+
return f({
|
|
9
|
+
from: o(() => e.startTimestamp, !1),
|
|
10
|
+
to: o(() => e.endTimestamp, !1),
|
|
13
11
|
offsets: {
|
|
14
|
-
value:
|
|
15
|
-
from:
|
|
16
|
-
|
|
17
|
-
},
|
|
18
|
-
to: {
|
|
19
|
-
value: t.endTimestampOffset
|
|
20
|
-
}
|
|
12
|
+
value: f({
|
|
13
|
+
from: o(() => e.startTimestampOffset, !1),
|
|
14
|
+
to: o(() => e.endTimestampOffset, !1)
|
|
21
15
|
})
|
|
22
16
|
},
|
|
23
|
-
span:
|
|
24
|
-
|
|
17
|
+
span: o(() => e.numberOfMonths, !1),
|
|
18
|
+
timezone: {
|
|
19
|
+
...o(() => t, !1),
|
|
20
|
+
set: (i) => {
|
|
21
|
+
const a = t;
|
|
22
|
+
t = r(i ?? void 0).tz.current, t !== a && (e = new n(t, ...s));
|
|
23
|
+
}
|
|
25
24
|
}
|
|
26
25
|
});
|
|
27
|
-
},
|
|
26
|
+
}, p = m(), N = () => m(Date.now(), c), O = () => m(Date.now(), l), d = (...s) => s.length === 0 ? p : m(...s);
|
|
28
27
|
export {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
p as UNBOUNDED_SLICE,
|
|
29
|
+
d as default,
|
|
30
|
+
N as sinceNow,
|
|
31
|
+
O as untilNow
|
|
33
32
|
};
|
|
@@ -1,20 +1,68 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { BASE_FORMAT_OPTIONS as p, BASE_LOCALE as u } from "../../../../core/Localization/datetime/restamper/constants.js";
|
|
2
|
+
import { DEFAULT_DATETIME_FORMAT as f } from "../../../../core/Localization/constants/localization.js";
|
|
3
|
+
import O from "../../../../core/Localization/datetime/restamper/restamper.js";
|
|
4
|
+
import { timezoneToSystem as E, systemToTimezone as M } from "../../../../core/Localization/datetime/restamper/utils.js";
|
|
5
|
+
import { isInfinity as m, mod as g } from "../../../../utils/value/number.js";
|
|
6
|
+
import { identity as A } from "../../../../utils/common.js";
|
|
7
|
+
import { EMPTY_ARRAY as _, EMPTY_OBJECT as y } from "../../../../utils/value/constants.js";
|
|
8
|
+
import { isUndefined as S } from "../../../../utils/value/is.js";
|
|
9
|
+
const Y = /^(\d{2})\/(\d{2})\/(-?\d+),\s+(\d{2}):(\d{2}):(\d{2}).(\d{3})/, c = (t = A) => (e, o, ...n) => {
|
|
10
|
+
const s = d(o), r = new Date(E(s, e));
|
|
11
|
+
return r.setHours(0, 0, 0, 0), M(s, t(r, ...n));
|
|
12
|
+
}, z = c(), C = c((t) => t.setDate(1)), U = c((t) => t.setMonth(0, 1)), W = c((t, e) => {
|
|
13
|
+
const o = R(t.getDay(), e ?? 0);
|
|
14
|
+
return t.setDate(t.getDate() - o);
|
|
15
|
+
}), I = (t) => (t % 100 ? t % 4 : t % 400) === 0, Z = (t, e, o = 0) => {
|
|
16
|
+
const n = t + o, s = g(n, 12), r = e + Math.floor(n / 12);
|
|
17
|
+
let a = 31;
|
|
18
|
+
switch (s) {
|
|
19
|
+
case 1:
|
|
20
|
+
a = I(r) ? 29 : 28;
|
|
21
|
+
break;
|
|
22
|
+
case 3:
|
|
23
|
+
case 5:
|
|
24
|
+
case 8:
|
|
25
|
+
case 10:
|
|
26
|
+
a = 30;
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
return [a, s, r];
|
|
30
|
+
}, R = (t, e = 0) => (7 - e + t) % 7, j = (t, e) => m(t) ? 0 : t - z(t, e), v = (t) => S(t) ? t : new Date(t), w = (t, e = y) => {
|
|
31
|
+
const o = d(e.timeZone), n = {
|
|
32
|
+
...f,
|
|
33
|
+
...e,
|
|
34
|
+
timeZone: o.tz.current
|
|
13
35
|
};
|
|
36
|
+
return new Date(t).toLocaleDateString(u, n);
|
|
37
|
+
}, i = (t, e) => {
|
|
38
|
+
const o = w(t, {
|
|
39
|
+
...p,
|
|
40
|
+
...f,
|
|
41
|
+
timeZone: e,
|
|
42
|
+
hour12: !1
|
|
43
|
+
}), [, n = "", s = "", r = "", a = "", D = "", T = "", h = ""] = o.match(Y) ?? _;
|
|
44
|
+
return [+r, +n - 1, +s, +a % 24, +D, +T, +h];
|
|
45
|
+
}, G = (t, e, o) => {
|
|
46
|
+
if (m(t) || m(e))
|
|
47
|
+
return 1 / 0;
|
|
48
|
+
const [n, s] = i(t, o), [r, a] = i(e, o);
|
|
49
|
+
return Math.abs(a - s + (r - n) * 12);
|
|
50
|
+
}, d = (() => {
|
|
51
|
+
const t = O();
|
|
52
|
+
return (e) => (t.tz = void 0, t.tz = e, t);
|
|
14
53
|
})();
|
|
15
54
|
export {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
55
|
+
j as computeTimestampOffset,
|
|
56
|
+
v as getDateObjectFromTimestamp,
|
|
57
|
+
G as getEdgesDistance,
|
|
58
|
+
Z as getMonthDays,
|
|
59
|
+
i as getTimezoneDateParts,
|
|
60
|
+
w as getTimezoneDateString,
|
|
61
|
+
R as getWeekDayIndex,
|
|
62
|
+
I as isLeapYear,
|
|
63
|
+
z as startOfDay,
|
|
64
|
+
C as startOfMonth,
|
|
65
|
+
W as startOfWeek,
|
|
66
|
+
U as startOfYear,
|
|
67
|
+
d as withTimezone
|
|
20
68
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
import
|
|
3
|
-
import { getDateObjectFromTimestamp as
|
|
4
|
-
import
|
|
1
|
+
import { useState as J, useMemo as l, useRef as $, useCallback as y, useImperativeHandle as G, useEffect as P } from "../../../../external/preact/hooks/dist/hooks.module.js";
|
|
2
|
+
import Q from "../../../../core/Context/useCoreContext.js";
|
|
3
|
+
import { getDateObjectFromTimestamp as K } from "../calendar/utils.js";
|
|
4
|
+
import U from "../../../../hooks/element/useFocusCursor.js";
|
|
5
5
|
import n from "../calendar/facade/index.js";
|
|
6
6
|
import { EMPTY_OBJECT as u } from "../../../../utils/value/constants.js";
|
|
7
|
-
import { isFunction as
|
|
8
|
-
const
|
|
7
|
+
import { isFunction as L } from "../../../../utils/value/is.js";
|
|
8
|
+
const X = ({
|
|
9
9
|
blocks: a,
|
|
10
10
|
controls: f,
|
|
11
11
|
dynamicBlockRows: m,
|
|
@@ -13,24 +13,25 @@ const Q = ({
|
|
|
13
13
|
highlight: p,
|
|
14
14
|
locale: C,
|
|
15
15
|
onHighlight: s,
|
|
16
|
-
originDate:
|
|
16
|
+
originDate: w,
|
|
17
17
|
renderControl: N,
|
|
18
18
|
sinceDate: E,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
timezone: M,
|
|
20
|
+
trackCurrentDay: T,
|
|
21
|
+
untilDate: d,
|
|
22
|
+
useYearView: b
|
|
23
|
+
}, B) => {
|
|
23
24
|
const {
|
|
24
|
-
i18n:
|
|
25
|
-
} =
|
|
25
|
+
i18n: O
|
|
26
|
+
} = Q(), [R, S] = J(performance.now()), x = l(() => n.slice(E, d), [E, d]), F = $(u), I = l(() => f ?? (L(N) ? n.controls.MINIMAL : n.controls.NONE), [f, N]), k = l(() => p ?? (L(s) ? n.highlight.ONE : n.highlight.NONE), [p, s]), {
|
|
26
27
|
grid: t,
|
|
27
|
-
kill:
|
|
28
|
+
kill: _
|
|
28
29
|
} = l(() => {
|
|
29
30
|
const {
|
|
30
31
|
grid: e,
|
|
31
32
|
kill: r
|
|
32
33
|
} = n(function() {
|
|
33
|
-
|
|
34
|
+
S(performance.now()), F.current = this, !(o === e.highlight.from && h === e.highlight.to) && (o = e.highlight.from, h = e.highlight.to, s == null || s(o, h));
|
|
34
35
|
});
|
|
35
36
|
let {
|
|
36
37
|
from: o,
|
|
@@ -39,9 +40,9 @@ const Q = ({
|
|
|
39
40
|
return e.config.cursorIndex = (i) => {
|
|
40
41
|
let c = i.target;
|
|
41
42
|
for (; c && c !== i.currentTarget; ) {
|
|
42
|
-
const
|
|
43
|
-
if (Number.isFinite(
|
|
44
|
-
return
|
|
43
|
+
const A = Number(c.dataset.cursorPosition);
|
|
44
|
+
if (Number.isFinite(A))
|
|
45
|
+
return A;
|
|
45
46
|
c = c.parentNode;
|
|
46
47
|
}
|
|
47
48
|
}, e.config.shiftFactor = function(i) {
|
|
@@ -51,7 +52,7 @@ const Q = ({
|
|
|
51
52
|
grid: e,
|
|
52
53
|
kill: r
|
|
53
54
|
};
|
|
54
|
-
}, []),
|
|
55
|
+
}, []), j = l(() => {
|
|
55
56
|
const e = (r) => {
|
|
56
57
|
t.cursor(r);
|
|
57
58
|
};
|
|
@@ -63,10 +64,10 @@ const Q = ({
|
|
|
63
64
|
t.cursor(r) && r.preventDefault();
|
|
64
65
|
}
|
|
65
66
|
};
|
|
66
|
-
}, [t]),
|
|
67
|
+
}, [t]), q = U(y((e, r) => {
|
|
67
68
|
r instanceof Element && r.removeAttribute("aria-selected"), e instanceof Element && e.setAttribute("aria-selected", "true");
|
|
68
69
|
}, []));
|
|
69
|
-
return
|
|
70
|
+
return G(B, () => {
|
|
70
71
|
const {
|
|
71
72
|
from: e,
|
|
72
73
|
to: r
|
|
@@ -77,43 +78,44 @@ const Q = ({
|
|
|
77
78
|
},
|
|
78
79
|
get config() {
|
|
79
80
|
return {
|
|
80
|
-
...
|
|
81
|
+
...F.current ?? u
|
|
81
82
|
};
|
|
82
83
|
},
|
|
83
84
|
get from() {
|
|
84
|
-
return
|
|
85
|
+
return K(e);
|
|
85
86
|
},
|
|
86
87
|
set from(o) {
|
|
87
88
|
t != null && t.highlight && o && (t.highlight.from = o.getTime());
|
|
88
89
|
},
|
|
89
90
|
get to() {
|
|
90
|
-
return
|
|
91
|
+
return K(r);
|
|
91
92
|
},
|
|
92
93
|
set to(o) {
|
|
93
94
|
t != null && t.highlight && o && (t.highlight.to = o.getTime());
|
|
94
95
|
}
|
|
95
96
|
};
|
|
96
|
-
}, [t,
|
|
97
|
+
}, [t, R]), P(() => {
|
|
97
98
|
t.config({
|
|
98
99
|
blocks: a,
|
|
99
|
-
controls:
|
|
100
|
+
controls: I,
|
|
100
101
|
firstWeekDay: g,
|
|
101
102
|
fixedBlockHeight: !m,
|
|
102
|
-
highlight:
|
|
103
|
-
locale: C ??
|
|
104
|
-
minified:
|
|
105
|
-
timeslice:
|
|
106
|
-
|
|
103
|
+
highlight: k,
|
|
104
|
+
locale: C ?? O.locale,
|
|
105
|
+
minified: b,
|
|
106
|
+
timeslice: x,
|
|
107
|
+
timezone: M,
|
|
108
|
+
trackCurrentDay: T
|
|
107
109
|
});
|
|
108
|
-
}, [
|
|
109
|
-
const e = [].concat(
|
|
110
|
-
return e[0] && (t.highlight.from = +e[0]), e[1] && (t.highlight.to = +e[1]),
|
|
110
|
+
}, [I, k, a, m, g, t, O, C, x, M, T, b]), P(() => {
|
|
111
|
+
const e = [].concat(w).slice(0, 2).map(Number).filter(Boolean);
|
|
112
|
+
return e[0] && (t.highlight.from = +e[0]), e[1] && (t.highlight.to = +e[1]), _;
|
|
111
113
|
}, []), {
|
|
112
|
-
cursorElementRef:
|
|
113
|
-
cursorRootProps:
|
|
114
|
+
cursorElementRef: q,
|
|
115
|
+
cursorRootProps: j,
|
|
114
116
|
grid: t
|
|
115
117
|
};
|
|
116
|
-
},
|
|
118
|
+
}, v = X;
|
|
117
119
|
export {
|
|
118
|
-
|
|
120
|
+
v as default
|
|
119
121
|
};
|
|
@@ -10,13 +10,13 @@ const {
|
|
|
10
10
|
getTimezoneTime: R,
|
|
11
11
|
getUsedTimezone: U
|
|
12
12
|
} = (() => {
|
|
13
|
-
const n =
|
|
13
|
+
const n = /\d{2}:\d{2}(?=:\d{2}(?:\.\d+)?\s+([AP]M))/i, m = /^GMT|0(?=\d:00)|:00/g, e = M();
|
|
14
14
|
return {
|
|
15
15
|
getTimezoneTime: (t, i = Date.now()) => {
|
|
16
16
|
e.tz = t;
|
|
17
17
|
const {
|
|
18
18
|
formatted: o
|
|
19
|
-
} = e(i), [f = "",
|
|
19
|
+
} = e(i), [f = "", s = ""] = (o == null ? void 0 : o.match(n)) ?? F, u = l(o), z = `${f}${s && ` ${s}`}`, p = E(u).replace(m, "");
|
|
20
20
|
return [z, p];
|
|
21
21
|
},
|
|
22
22
|
getUsedTimezone: (t) => (e.tz = t, e.tz.current)
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import _ from "classnames";
|
|
2
2
|
import { forwardRef as p } from "../../../external/preact/compat/dist/compat.module.js";
|
|
3
|
-
import { useState as
|
|
3
|
+
import { useState as y, useMemo as r, useCallback as N } from "../../../external/preact/hooks/dist/hooks.module.js";
|
|
4
4
|
import O from "../../../core/Context/useCoreContext.js";
|
|
5
5
|
import P from "../Calendar/hooks/useTimezone.js";
|
|
6
|
-
import { DEFAULT_FIRST_WEEK_DAY as
|
|
7
|
-
import
|
|
6
|
+
import { DEFAULT_FIRST_WEEK_DAY as D } from "../Calendar/calendar/timerange/presets/shared/offsetWeek.js";
|
|
7
|
+
import I from "../Calendar/hooks/useCalendarControlsRendering.js";
|
|
8
8
|
import "./DatePicker.scss.js";
|
|
9
9
|
import { jsx as n } from "../../../external/preact/jsx-runtime/dist/jsxRuntime.module.js";
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
10
|
+
import M from "../../../hooks/useReflex/useReflex.js";
|
|
11
|
+
import v from "./components/TimeRangeSelector/TimeRangeSelector.js";
|
|
12
|
+
import x from "../Calendar/Calendar.js";
|
|
13
|
+
import u from "../Calendar/calendar/facade/index.js";
|
|
14
14
|
import { boolOrTrue as E } from "../../../utils/value/bool.js";
|
|
15
15
|
import { EMPTY_OBJECT as S } from "../../../utils/value/constants.js";
|
|
16
16
|
import { noop as A } from "../../../utils/common.js";
|
|
17
|
-
const b = p((e,
|
|
17
|
+
const b = p((e, g) => {
|
|
18
18
|
const {
|
|
19
19
|
i18n: i
|
|
20
|
-
} = O(), [T, k] =
|
|
20
|
+
} = O(), [T, k] = I(e.renderControl), [C, a] = y(performance.now()), t = r(() => E(e.showTimezoneInfo), [e.showTimezoneInfo]), {
|
|
21
21
|
clockTime: m,
|
|
22
22
|
GMTOffset: c
|
|
23
23
|
} = P({
|
|
@@ -30,7 +30,7 @@ const b = p((e, u) => {
|
|
|
30
30
|
offset: c,
|
|
31
31
|
time: m
|
|
32
32
|
}
|
|
33
|
-
} : S, [c, m, t]), o =
|
|
33
|
+
} : S, [c, m, t]), o = M(A, g), R = N(() => {
|
|
34
34
|
var l, s, d, f, h;
|
|
35
35
|
a(performance.now()), (l = o.current) != null && l.from && ((s = o.current) != null && s.to) && ((h = e.onHighlight) == null || h.call(e, +((d = o.current) == null ? void 0 : d.from), +((f = o.current) == null ? void 0 : f.to)));
|
|
36
36
|
}, [a, e.onHighlight]);
|
|
@@ -38,7 +38,7 @@ const b = p((e, u) => {
|
|
|
38
38
|
className: z,
|
|
39
39
|
children: [n("div", {
|
|
40
40
|
className: "adyen-pe-datepicker__selector-container",
|
|
41
|
-
children: n(
|
|
41
|
+
children: n(v, {
|
|
42
42
|
now: e.now,
|
|
43
43
|
calendarRef: o,
|
|
44
44
|
onTimeRangeSelected: e.onPresetOptionSelected,
|
|
@@ -52,16 +52,17 @@ const b = p((e, u) => {
|
|
|
52
52
|
role: "group",
|
|
53
53
|
className: "adyen-pe-datepicker__controls",
|
|
54
54
|
"aria-label": i.get("calendar.controls")
|
|
55
|
-
}), n(
|
|
55
|
+
}), n(x, {
|
|
56
56
|
...e,
|
|
57
57
|
ref: o,
|
|
58
|
-
firstWeekDay:
|
|
58
|
+
firstWeekDay: D,
|
|
59
59
|
dynamicBlockRows: !0,
|
|
60
60
|
onlyCellsWithin: !0,
|
|
61
|
-
controls: e.controls ??
|
|
62
|
-
highlight: e.highlight ??
|
|
61
|
+
controls: e.controls ?? u.controls.MINIMAL,
|
|
62
|
+
highlight: e.highlight ?? u.highlight.MANY,
|
|
63
63
|
onHighlight: R,
|
|
64
|
-
renderControl: T
|
|
64
|
+
renderControl: T,
|
|
65
|
+
trackCurrentDay: !0
|
|
65
66
|
}), t && n("div", {
|
|
66
67
|
className: "adyen-pe-datepicker__timezone",
|
|
67
68
|
children: i.get("calendar.timezone", w)
|