@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
|
@@ -7,15 +7,15 @@ import { jsx as D } from "../../../../../external/preact/jsx-runtime/dist/jsxRun
|
|
|
7
7
|
import F from "../BaseFilter/BaseFilter.js";
|
|
8
8
|
import { isUndefined as f } from "../../../../../utils/value/is.js";
|
|
9
9
|
import { EMPTY_OBJECT as O } from "../../../../../utils/value/constants.js";
|
|
10
|
-
const
|
|
11
|
-
updateFilters:
|
|
10
|
+
const G = ({
|
|
11
|
+
updateFilters: p,
|
|
12
12
|
selectedCurrencies: t,
|
|
13
13
|
availableCurrencies: m,
|
|
14
14
|
...y
|
|
15
15
|
}) => {
|
|
16
16
|
const {
|
|
17
17
|
i18n: g
|
|
18
|
-
} = B(), [
|
|
18
|
+
} = B(), [h, U] = E(), [$, x] = E(), M = w(() => (t == null ? void 0 : t.length) === 1 || (m == null ? void 0 : m.length) === 1, [m == null ? void 0 : m.length, t == null ? void 0 : t.length]), S = L((n, o) => {
|
|
19
19
|
const A = (t == null ? void 0 : t[0]) || (m == null ? void 0 : m[0]), I = o && A ? {
|
|
20
20
|
style: "currency",
|
|
21
21
|
currency: A,
|
|
@@ -30,26 +30,26 @@ const H = ({
|
|
|
30
30
|
U({
|
|
31
31
|
minAmount: o,
|
|
32
32
|
maxAmount: A
|
|
33
|
-
}), f(o) && f(A) && x(void 0),
|
|
34
|
-
minAmount: f(o) ? void 0 : String(o * T),
|
|
35
|
-
maxAmount: f(A) ? void 0 : String(A * T)
|
|
33
|
+
}), f(o) && f(A) && x(void 0), p({
|
|
34
|
+
minAmount: f(o) ? void 0 : String(Math.round(o * T)),
|
|
35
|
+
maxAmount: f(A) ? void 0 : String(Math.round(A * T))
|
|
36
36
|
});
|
|
37
|
-
}, [
|
|
38
|
-
if (
|
|
37
|
+
}, [p]);
|
|
38
|
+
if (h && (h.minAmount || h.maxAmount)) {
|
|
39
39
|
const {
|
|
40
40
|
minAmount: n,
|
|
41
41
|
maxAmount: o
|
|
42
|
-
} =
|
|
43
|
-
!f(n) && !f(o) && n <= o ? x(`${
|
|
42
|
+
} = h ?? {};
|
|
43
|
+
!f(n) && !f(o) && n <= o ? x(`${S(n, M)} ${g.get("to").toLowerCase()} ${S(o, M)}`) : !f(n) && f(o) && n >= 0 ? x(`${g.get("from")} ${S(n, M)}`) : f(n) && !f(o) ? x(`${g.get("to")} ${S(o, M)}`) : x(void 0);
|
|
44
44
|
}
|
|
45
45
|
return D(F, {
|
|
46
46
|
...y,
|
|
47
|
-
updateFilters:
|
|
47
|
+
updateFilters: p,
|
|
48
48
|
minAmount: y.minAmount,
|
|
49
49
|
maxAmount: y.maxAmount,
|
|
50
50
|
onChange: V,
|
|
51
|
-
value:
|
|
52
|
-
label:
|
|
51
|
+
value: $,
|
|
52
|
+
label: $ || y.label,
|
|
53
53
|
type: "text",
|
|
54
54
|
containerSize: z.MEDIUM,
|
|
55
55
|
selectedCurrencies: t,
|
|
@@ -58,5 +58,5 @@ const H = ({
|
|
|
58
58
|
});
|
|
59
59
|
};
|
|
60
60
|
export {
|
|
61
|
-
|
|
61
|
+
G as AmountFilter
|
|
62
62
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import A from "../../../FormFields/InputBase.js";
|
|
2
2
|
import "./AmountFilter.scss.js";
|
|
3
|
-
import { useState as
|
|
3
|
+
import { useState as g, useCallback as p, useEffect as x, useMemo as b } from "../../../../../external/preact/hooks/dist/hooks.module.js";
|
|
4
4
|
import h from "../../../../../core/Context/useCoreContext.js";
|
|
5
5
|
import { AMOUNT_MULTIPLIER as T } from "./constants.js";
|
|
6
6
|
import { jsx as r } from "../../../../../external/preact/jsx-runtime/dist/jsxRuntime.module.js";
|
|
7
|
-
import { isUndefined as
|
|
7
|
+
import { isUndefined as o } from "../../../../../utils/value/is.js";
|
|
8
8
|
import { CommitAction as F } from "../../../../../hooks/useCommitAction/types.js";
|
|
9
9
|
const R = ({
|
|
10
10
|
onChange: l,
|
|
@@ -12,45 +12,46 @@ const R = ({
|
|
|
12
12
|
onValueUpdated: s,
|
|
13
13
|
selectedCurrencies: I,
|
|
14
14
|
availableCurrencies: M,
|
|
15
|
-
value:
|
|
15
|
+
value: V,
|
|
16
16
|
...m
|
|
17
17
|
}) => {
|
|
18
18
|
const {
|
|
19
19
|
i18n: n
|
|
20
|
-
} = h(), [e, c] =
|
|
20
|
+
} = h(), [e, c] = g(o(m.minAmount) ? void 0 : parseFloat(m.minAmount) / T), [t, d] = g(o(m.maxAmount) ? void 0 : parseFloat(m.maxAmount) / T), v = p(() => {
|
|
21
21
|
l({
|
|
22
22
|
minAmount: e,
|
|
23
23
|
maxAmount: t
|
|
24
24
|
});
|
|
25
|
-
}, [t, e, l]), f =
|
|
25
|
+
}, [t, e, l]), f = p(() => {
|
|
26
26
|
l({
|
|
27
27
|
minAmount: void 0,
|
|
28
28
|
maxAmount: void 0
|
|
29
|
-
}),
|
|
29
|
+
}), d(void 0), c(void 0);
|
|
30
30
|
}, [l]);
|
|
31
31
|
x(() => {
|
|
32
|
-
u === F.APPLY &&
|
|
33
|
-
}, [
|
|
34
|
-
const
|
|
32
|
+
u === F.APPLY && v(), u === F.CLEAR && f();
|
|
33
|
+
}, [v, f, u]);
|
|
34
|
+
const i = b(() => ({
|
|
35
35
|
minAmount: e,
|
|
36
36
|
maxAmount: t
|
|
37
37
|
}), [t, e]);
|
|
38
38
|
return x(() => {
|
|
39
|
-
|
|
40
|
-
}, [
|
|
39
|
+
i.minAmount || i.maxAmount ? s(`${i.minAmount}-${i.maxAmount}`) : s(null);
|
|
40
|
+
}, [i, s]), r("div", {
|
|
41
41
|
className: "adyen-pe-range-selection-filter",
|
|
42
42
|
children: [r("div", {
|
|
43
43
|
className: "adyen-pe-range-selection-filter__input",
|
|
44
44
|
children: [r("label", {
|
|
45
45
|
htmlFor: "minValue",
|
|
46
46
|
children: `${n.get("from")}:`
|
|
47
|
-
}), r(
|
|
47
|
+
}), r(A, {
|
|
48
|
+
"data-testid": "minValueFilter",
|
|
48
49
|
lang: n.locale,
|
|
49
50
|
name: "minValue",
|
|
50
51
|
type: "number",
|
|
51
52
|
value: e,
|
|
52
53
|
onInput: (a) => {
|
|
53
|
-
a.currentTarget && c(a.currentTarget.value !== "" ?
|
|
54
|
+
a.currentTarget && c(a.currentTarget.value !== "" ? a.currentTarget.value : void 0);
|
|
54
55
|
},
|
|
55
56
|
min: 0,
|
|
56
57
|
isInvalid: e ? e < 0 : !1,
|
|
@@ -61,16 +62,17 @@ const R = ({
|
|
|
61
62
|
children: [r("label", {
|
|
62
63
|
htmlFor: "maxValue",
|
|
63
64
|
children: `${n.get("to")}:`
|
|
64
|
-
}), r(
|
|
65
|
+
}), r(A, {
|
|
66
|
+
"data-testid": "maxValueFilter",
|
|
65
67
|
lang: n.locale,
|
|
66
68
|
name: "maxValue",
|
|
67
69
|
type: "number",
|
|
68
70
|
value: t,
|
|
69
71
|
onInput: (a) => {
|
|
70
|
-
a.currentTarget &&
|
|
72
|
+
a.currentTarget && d(a.currentTarget.value !== "" ? a.currentTarget.value : void 0);
|
|
71
73
|
},
|
|
72
74
|
min: e,
|
|
73
|
-
isInvalid: !
|
|
75
|
+
isInvalid: !o(t) && !o(e) && t < e,
|
|
74
76
|
errorMessage: n.get("toValueShouldBeGreaterThanTheFromValue")
|
|
75
77
|
})]
|
|
76
78
|
})]
|
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useState as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import B from "../../../../hooks/useTimezoneAwareDateFormatting.js";
|
|
2
|
+
import { useState as h, useCallback as M, useMemo as T, useEffect as E, useRef as x } from "../../../../../external/preact/hooks/dist/hooks.module.js";
|
|
3
|
+
import { BASE_LOCALE as L } from "../../../../../core/Localization/datetime/restamper/constants.js";
|
|
4
|
+
import k from "../../../../../core/Context/useCoreContext.js";
|
|
5
|
+
import { DateRangeFilterParam as b } from "./types.js";
|
|
5
6
|
import "./DateFilterCore.scss.js";
|
|
6
7
|
import { jsx as S } from "../../../../../external/preact/jsx-runtime/dist/jsxRuntime.module.js";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import { EMPTY_OBJECT as
|
|
10
|
-
import { CommitAction as
|
|
11
|
-
const
|
|
8
|
+
import _ from "../BaseFilter/BaseFilter.js";
|
|
9
|
+
import z from "../../../DatePicker/DatePicker.js";
|
|
10
|
+
import { EMPTY_OBJECT as I } from "../../../../../utils/value/constants.js";
|
|
11
|
+
import { CommitAction as A } from "../../../../../hooks/useCommitAction/types.js";
|
|
12
|
+
const V = {
|
|
12
13
|
month: "short",
|
|
13
14
|
day: "numeric",
|
|
14
15
|
year: "numeric"
|
|
15
|
-
},
|
|
16
|
-
const
|
|
17
|
-
if (
|
|
18
|
-
return `${
|
|
19
|
-
if (
|
|
16
|
+
}, v = (s, e, n, o) => {
|
|
17
|
+
const t = n && e(n), r = o && e(o);
|
|
18
|
+
if (t && r)
|
|
19
|
+
return `${t} - ${r}`;
|
|
20
|
+
if (t)
|
|
20
21
|
return s.get("filter.date.since", {
|
|
21
22
|
values: {
|
|
22
|
-
date:
|
|
23
|
+
date: t
|
|
23
24
|
}
|
|
24
25
|
});
|
|
25
26
|
if (r)
|
|
@@ -28,114 +29,118 @@ const B = {
|
|
|
28
29
|
date: r
|
|
29
30
|
}
|
|
30
31
|
});
|
|
31
|
-
},
|
|
32
|
+
}, i = (s) => {
|
|
32
33
|
try {
|
|
33
34
|
return new Date(s || "").toISOString();
|
|
34
35
|
} catch {
|
|
35
36
|
return "";
|
|
36
37
|
}
|
|
37
|
-
},
|
|
38
|
+
}, Y = (() => {
|
|
38
39
|
const s = ({
|
|
39
|
-
editAction:
|
|
40
|
+
editAction: e,
|
|
40
41
|
from: n,
|
|
41
42
|
to: o,
|
|
42
|
-
now:
|
|
43
|
+
now: t,
|
|
43
44
|
onChange: r,
|
|
44
|
-
onValueUpdated:
|
|
45
|
+
onValueUpdated: F,
|
|
45
46
|
showTimezoneInfo: w,
|
|
46
47
|
selectedPresetOption: f,
|
|
47
|
-
timeRangePresetOptions:
|
|
48
|
+
timeRangePresetOptions: c,
|
|
48
49
|
timezone: D,
|
|
49
|
-
sinceDate:
|
|
50
|
-
untilDate:
|
|
50
|
+
sinceDate: m,
|
|
51
|
+
untilDate: O
|
|
51
52
|
}) => {
|
|
52
53
|
const {
|
|
53
|
-
i18n:
|
|
54
|
-
} =
|
|
54
|
+
i18n: P
|
|
55
|
+
} = k(), {
|
|
55
56
|
fullDateFormat: d
|
|
56
|
-
} =
|
|
57
|
-
|
|
58
|
-
}, [
|
|
59
|
-
return
|
|
60
|
-
var l,
|
|
61
|
-
switch (
|
|
62
|
-
case
|
|
57
|
+
} = B(D), [g, R] = h(f), u = T(() => [new Date(n), new Date(o)], [n, o]), a = x(), y = M((l, C) => {
|
|
58
|
+
F(v(P, d, i(l), i(C)));
|
|
59
|
+
}, [P, d, F]);
|
|
60
|
+
return E(() => {
|
|
61
|
+
var l, C, p;
|
|
62
|
+
switch (e) {
|
|
63
|
+
case A.APPLY:
|
|
63
64
|
r({
|
|
64
|
-
selectedPresetOption:
|
|
65
|
-
[
|
|
66
|
-
[
|
|
65
|
+
selectedPresetOption: g,
|
|
66
|
+
[b.FROM]: i((l = a.current) == null ? void 0 : l.from),
|
|
67
|
+
[b.TO]: i((C = a.current) == null ? void 0 : C.to)
|
|
67
68
|
});
|
|
68
69
|
break;
|
|
69
|
-
case
|
|
70
|
-
(
|
|
70
|
+
case A.CLEAR:
|
|
71
|
+
(p = a.current) == null || p.clear(), r();
|
|
71
72
|
}
|
|
72
|
-
}, [
|
|
73
|
-
ref:
|
|
74
|
-
now:
|
|
73
|
+
}, [e, r, g]), S(z, {
|
|
74
|
+
ref: a,
|
|
75
|
+
now: t,
|
|
75
76
|
originDate: u,
|
|
76
|
-
onHighlight:
|
|
77
|
-
onPresetOptionSelected:
|
|
77
|
+
onHighlight: y,
|
|
78
|
+
onPresetOptionSelected: R,
|
|
78
79
|
selectedPresetOption: f,
|
|
79
|
-
timeRangePresetOptions:
|
|
80
|
+
timeRangePresetOptions: c,
|
|
80
81
|
timezone: D,
|
|
81
82
|
showTimezoneInfo: w,
|
|
82
|
-
sinceDate:
|
|
83
|
-
untilDate:
|
|
83
|
+
sinceDate: i(m),
|
|
84
|
+
untilDate: i(O)
|
|
84
85
|
});
|
|
85
86
|
};
|
|
86
|
-
return (
|
|
87
|
-
...
|
|
87
|
+
return (e) => S(s, {
|
|
88
|
+
...e
|
|
88
89
|
});
|
|
89
|
-
})(),
|
|
90
|
-
function
|
|
90
|
+
})(), $ = (s, e, n) => s.formatRange(e, n);
|
|
91
|
+
function U({
|
|
91
92
|
title: s,
|
|
92
|
-
from:
|
|
93
|
+
from: e,
|
|
93
94
|
to: n,
|
|
94
95
|
selectedPresetOption: o,
|
|
95
|
-
...
|
|
96
|
+
...t
|
|
96
97
|
}) {
|
|
97
98
|
const {
|
|
98
99
|
i18n: r
|
|
99
|
-
} =
|
|
100
|
-
fullDateFormat:
|
|
101
|
-
} =
|
|
100
|
+
} = k(), {
|
|
101
|
+
fullDateFormat: F
|
|
102
|
+
} = B(t.timezone), [w, f] = h(), [c, D] = h(), [m, O] = h(), P = M((u) => {
|
|
102
103
|
const {
|
|
103
|
-
from:
|
|
104
|
-
to:
|
|
104
|
+
from: a,
|
|
105
|
+
to: y,
|
|
105
106
|
selectedPresetOption: l
|
|
106
|
-
} = u ??
|
|
107
|
+
} = u ?? I;
|
|
107
108
|
try {
|
|
108
|
-
f(w ?? l), D(
|
|
109
|
+
f(w ?? l), D(i(c ?? a)), O(i(m ?? y));
|
|
109
110
|
} finally {
|
|
110
|
-
|
|
111
|
-
from:
|
|
112
|
-
to:
|
|
111
|
+
t.onChange({
|
|
112
|
+
from: a,
|
|
113
|
+
to: y,
|
|
113
114
|
selectedPresetOption: l
|
|
114
115
|
});
|
|
115
116
|
}
|
|
116
|
-
}, [w,
|
|
117
|
-
|
|
117
|
+
}, [w, c, m, t]), d = T(() => r.get("rangePreset.custom"), [r]), g = T(() => {
|
|
118
|
+
const u = {
|
|
119
|
+
...V,
|
|
120
|
+
timeZone: t.timezone
|
|
121
|
+
};
|
|
122
|
+
let a = new Intl.DateTimeFormat(L, u);
|
|
118
123
|
try {
|
|
119
|
-
|
|
124
|
+
a = new Intl.DateTimeFormat(r.locale, u);
|
|
120
125
|
} catch {
|
|
121
126
|
}
|
|
122
|
-
return
|
|
123
|
-
}, [r]);
|
|
124
|
-
|
|
125
|
-
const
|
|
126
|
-
return S(
|
|
127
|
-
...
|
|
128
|
-
from:
|
|
127
|
+
return a;
|
|
128
|
+
}, [r, t.timezone]);
|
|
129
|
+
E(() => f(o), [o]), E(() => D(i(e || Date.now())), [e]), E(() => O(i(n || Date.now())), [n]);
|
|
130
|
+
const R = T(() => o === d && c && m ? $(g, new Date(c), new Date(m)) : o ?? t.label, [d, g, c, m, o, t.label]);
|
|
131
|
+
return S(_, {
|
|
132
|
+
...t,
|
|
133
|
+
from: e,
|
|
129
134
|
to: n,
|
|
130
135
|
type: "date",
|
|
131
|
-
label:
|
|
132
|
-
onChange:
|
|
133
|
-
render:
|
|
136
|
+
label: R,
|
|
137
|
+
onChange: P,
|
|
138
|
+
render: Y,
|
|
134
139
|
selectedPresetOption: o,
|
|
135
|
-
value:
|
|
140
|
+
value: v(r, F, e, n),
|
|
136
141
|
withContentPadding: !1
|
|
137
142
|
});
|
|
138
143
|
}
|
|
139
144
|
export {
|
|
140
|
-
|
|
145
|
+
U as default
|
|
141
146
|
};
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { SYSTEM_TIMEZONE_FORMATTER as
|
|
2
|
-
import { EMPTY_ARRAY as
|
|
3
|
-
import { mod as
|
|
4
|
-
const
|
|
1
|
+
import { SYSTEM_TIMEZONE_FORMATTER as n, REGEX_TZ_OFFSET as m } from "./constants.js";
|
|
2
|
+
import { EMPTY_ARRAY as r } from "../../../../utils/value/constants.js";
|
|
3
|
+
import { mod as i } from "../../../../utils/value/number.js";
|
|
4
|
+
const E = /\+(?=-)|([+-]00:00)/g, p = new RegExp("(?<=^\\D?)(\\d)$"), O = ([t, s]) => (Math.abs(t * 60) + s) * (t < 0 ? -1 : 1), S = (t) => Object.freeze([
|
|
5
5
|
Math.floor(t / 60),
|
|
6
6
|
// offset hours
|
|
7
|
-
|
|
7
|
+
i(t, 60)
|
|
8
8
|
// offset minutes
|
|
9
|
-
]),
|
|
10
|
-
var
|
|
11
|
-
const
|
|
12
|
-
return
|
|
13
|
-
},
|
|
14
|
-
var
|
|
15
|
-
const
|
|
16
|
-
return
|
|
17
|
-
},
|
|
9
|
+
]), _ = (t) => parseInt(t, 10) || 0, F = (t) => `GMT+${S(t).map((o) => `${o}`.replace(p, "0$1")).join(":")}`.replace(E, ""), c = (t) => {
|
|
10
|
+
var e;
|
|
11
|
+
const s = ((e = t == null ? void 0 : t.match(m)) == null ? void 0 : e[0].split(":", 2).map(_)) ?? r;
|
|
12
|
+
return O(s.concat(0, 0).slice(0, 2));
|
|
13
|
+
}, R = (t, s = n) => {
|
|
14
|
+
var f;
|
|
15
|
+
const e = c((f = n) == null ? void 0 : f.format(t));
|
|
16
|
+
return c(s == null ? void 0 : s.format(t)) - e;
|
|
17
|
+
}, T = (t, s, e = 1) => {
|
|
18
18
|
const {
|
|
19
19
|
offset: o,
|
|
20
|
-
timestamp:
|
|
21
|
-
} = t(
|
|
22
|
-
return f
|
|
23
|
-
},
|
|
20
|
+
timestamp: f
|
|
21
|
+
} = t(s);
|
|
22
|
+
return f - o * e * 6e4;
|
|
23
|
+
}, g = (t, s) => T(t, s, 1), u = (t, s) => T(t, s, -1);
|
|
24
24
|
export {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
O as computeTimezoneOffsetInMinutes,
|
|
26
|
+
S as computeTimezoneOffsetsFromMinutes,
|
|
27
|
+
F as getGMTSuffixForTimezoneOffset,
|
|
28
|
+
R as getTimezoneOffsetForTimestamp,
|
|
29
|
+
c as getTimezoneOffsetFromFormattedDateString,
|
|
30
|
+
_ as parseTimezoneOffset,
|
|
31
|
+
g as systemToTimezone,
|
|
32
|
+
u as timezoneToSystem
|
|
33
33
|
};
|
package/dist/es/core/core.js
CHANGED
|
@@ -1,60 +1,55 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { createWatchlist as y, isWatchlistUnsubscribeToken as
|
|
1
|
+
import g from "../../../core/Localization/datetime/restamper/restamper.js";
|
|
2
|
+
import { createWatchlist as y, isWatchlistUnsubscribeToken as h } from "../../reactive/watchlist/main.js";
|
|
3
3
|
import { clock as S } from "../clock/main.js";
|
|
4
4
|
import { timezoneToSystem as W, systemToTimezone as b } from "../../../core/Localization/datetime/restamper/utils.js";
|
|
5
5
|
import { isNull as z } from "../../../utils/value/is.js";
|
|
6
|
-
import { struct as
|
|
7
|
-
import { enumerable as
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const t = new Date(
|
|
11
|
-
|
|
12
|
-
const i = e > 1 ? -1 : e < -1 ? 1 : e;
|
|
13
|
-
t.setDate(t.getDate() - i);
|
|
14
|
-
}
|
|
15
|
-
const r = b(s, t.setHours(0, 0, 0, 0)), m = b(s, t.setDate(t.getDate() + 1));
|
|
16
|
-
return [r, m - r];
|
|
6
|
+
import { struct as x } from "../../../utils/struct/main.js";
|
|
7
|
+
import { enumerable as c, getter as N } from "../../../utils/struct/property.js";
|
|
8
|
+
const O = (() => {
|
|
9
|
+
const a = /* @__PURE__ */ new Map(), r = g(), u = (m = Date.now()) => {
|
|
10
|
+
const t = new Date(W(r, m)), e = b(r, t.setHours(0, 0, 0, 0)), s = b(r, t.setDate(t.getDate() + 1));
|
|
11
|
+
return [e, s - e];
|
|
17
12
|
};
|
|
18
|
-
return (
|
|
19
|
-
|
|
20
|
-
const t =
|
|
21
|
-
return
|
|
22
|
-
let
|
|
23
|
-
const
|
|
24
|
-
|
|
13
|
+
return (m) => {
|
|
14
|
+
r.tz = m;
|
|
15
|
+
const t = r.tz.current;
|
|
16
|
+
return a.get(t) ?? (() => {
|
|
17
|
+
let e = null, s = null, o = null;
|
|
18
|
+
const p = () => (r.tz = t, e ?? u()[0]), l = (n = Date.now()) => {
|
|
19
|
+
r.tz = t, [e, s] = u(n);
|
|
25
20
|
}, {
|
|
26
|
-
cancelSubscriptions:
|
|
27
|
-
requestNotification:
|
|
28
|
-
subscribe:
|
|
29
|
-
on:
|
|
21
|
+
cancelSubscriptions: w,
|
|
22
|
+
requestNotification: D,
|
|
23
|
+
subscribe: d,
|
|
24
|
+
on: f
|
|
30
25
|
} = y({
|
|
31
|
-
timestamp:
|
|
26
|
+
timestamp: p
|
|
32
27
|
});
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
if (
|
|
28
|
+
f.resume = () => {
|
|
29
|
+
o = S.subscribe((n) => {
|
|
30
|
+
if (h(n))
|
|
36
31
|
return;
|
|
37
32
|
const {
|
|
38
|
-
now:
|
|
39
|
-
} =
|
|
40
|
-
if (z(
|
|
41
|
-
return i
|
|
42
|
-
|
|
33
|
+
now: i
|
|
34
|
+
} = n;
|
|
35
|
+
if (z(e) || z(s))
|
|
36
|
+
return l(i);
|
|
37
|
+
i - e < s || (l(i), D());
|
|
43
38
|
});
|
|
44
|
-
},
|
|
45
|
-
|
|
39
|
+
}, f.idle = () => {
|
|
40
|
+
o == null || o(), e = s = o = null;
|
|
46
41
|
};
|
|
47
|
-
const
|
|
48
|
-
cancelSubscriptions:
|
|
49
|
-
timestamp:
|
|
50
|
-
timezone:
|
|
51
|
-
subscribe:
|
|
42
|
+
const T = x({
|
|
43
|
+
cancelSubscriptions: c(w),
|
|
44
|
+
timestamp: N(p),
|
|
45
|
+
timezone: c(t),
|
|
46
|
+
subscribe: c(d)
|
|
52
47
|
});
|
|
53
|
-
return
|
|
48
|
+
return a.set(t, T), T;
|
|
54
49
|
})();
|
|
55
50
|
};
|
|
56
|
-
})(), v =
|
|
51
|
+
})(), v = O;
|
|
57
52
|
export {
|
|
58
53
|
v as default,
|
|
59
|
-
|
|
54
|
+
O as today
|
|
60
55
|
};
|