@luzmo/lucero 0.0.16 → 0.0.18
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/components/NumberFormatter-DewVDY5w.cjs +18 -0
- package/components/NumberFormatter-DgOUVrge.js +136 -0
- package/components/NumberParser-Dik4a0h-.cjs +18 -0
- package/components/NumberParser-ci9J5EKv.js +173 -0
- package/components/accordion/index.cjs +1 -1
- package/components/accordion/index.js +2 -2
- package/components/action-bar/index.cjs +1 -1
- package/components/action-bar/index.js +2 -2
- package/components/action-button/index.cjs +1 -1
- package/components/action-button/index.js +2 -2
- package/components/action-group/index.js +1 -1
- package/components/action-menu/index.cjs +1 -1
- package/components/action-menu/index.js +3 -3
- package/components/avatar/index.js +1 -1
- package/components/button/index.cjs +1 -1
- package/components/button/index.js +3 -3
- package/components/button-group/index.js +1 -1
- package/components/calendar/calendar.d.ts +218 -0
- package/components/calendar/index.cjs +18 -0
- package/components/calendar/index.d.ts +7 -0
- package/components/calendar/index.js +28 -0
- package/components/checkbox/index.cjs +1 -1
- package/components/checkbox/index.js +2 -2
- package/components/class-map-Buyb1CLm.cjs +22 -0
- package/components/class-map-CJko4aXp.js +51 -0
- package/components/{close-button-DOA-6eL0.cjs → close-button-BQJ2wHkM.cjs} +1 -1
- package/components/{close-button-DU58NTKR.js → close-button-DN2cjFRq.js} +1 -1
- package/components/color-area/index.js +1 -1
- package/components/color-field/index.cjs +1 -1
- package/components/color-field/index.js +2 -2
- package/components/color-handle/index.js +1 -1
- package/components/color-loupe/index.js +1 -1
- package/components/color-menu/index.js +1 -1
- package/components/color-picker/index.js +1 -1
- package/components/color-slider/index.js +1 -1
- package/components/date-time-picker/date-time-picker.d.ts +269 -0
- package/components/date-time-picker/helpers.d.ts +10 -0
- package/components/date-time-picker/index.cjs +105 -0
- package/components/date-time-picker/index.d.ts +7 -0
- package/components/date-time-picker/index.js +1126 -0
- package/components/date-time-picker/segments/date/day-segment.d.ts +9 -0
- package/components/date-time-picker/segments/date/month-segment.d.ts +9 -0
- package/components/date-time-picker/segments/date/year-segment.d.ts +12 -0
- package/components/date-time-picker/segments/date-time-segments.d.ts +35 -0
- package/components/date-time-picker/segments/editable-segment.d.ts +21 -0
- package/components/date-time-picker/segments/literal-segment.d.ts +6 -0
- package/components/date-time-picker/segments/modifiers/clear-modifier.d.ts +5 -0
- package/components/date-time-picker/segments/modifiers/decrement-modifier.d.ts +5 -0
- package/components/date-time-picker/segments/modifiers/increment-modifier.d.ts +5 -0
- package/components/date-time-picker/segments/modifiers/input-modifier.d.ts +13 -0
- package/components/date-time-picker/segments/modifiers/segments-modifier.d.ts +18 -0
- package/components/date-time-picker/segments/segments-factory.d.ts +16 -0
- package/components/date-time-picker/segments/segments-formatter.d.ts +17 -0
- package/components/date-time-picker/segments/time/day-period-segment.d.ts +18 -0
- package/components/date-time-picker/segments/time/hour-segment.d.ts +19 -0
- package/components/date-time-picker/segments/time/millisecond-segment.d.ts +7 -0
- package/components/date-time-picker/segments/time/minute-segment.d.ts +7 -0
- package/components/date-time-picker/segments/time/second-segment.d.ts +7 -0
- package/components/date-time-picker/types.d.ts +41 -0
- package/components/divider/index.js +1 -1
- package/components/field-group/index.js +1 -1
- package/components/field-label/index.js +1 -1
- package/components/icon/index.cjs +1 -1
- package/components/icon/index.js +2 -2
- package/components/index-BziWAe4P.cjs +113 -0
- package/components/index-vWdA-LXe.js +1490 -0
- package/components/index.cjs +1 -1
- package/components/index.js +135 -129
- package/components/infield-button/index.cjs +1 -1
- package/components/infield-button/index.js +2 -2
- package/components/label/index.js +1 -1
- package/components/menu/index.cjs +66 -1
- package/components/menu/index.js +874 -10
- package/components/multi-language-field/index.js +1 -1
- package/components/number-field/index.cjs +6 -6
- package/components/number-field/index.js +128 -394
- package/components/observe-slot-presence-CmVi0zTc.js +68 -0
- package/components/observe-slot-presence-bc9chhsi.cjs +18 -0
- package/components/overlay/index.js +1 -1
- package/components/picker/index.cjs +1 -1
- package/components/picker/index.js +3 -3
- package/components/{picker-C9HmjRgR.js → picker-BxEG2NdV.js} +110 -138
- package/components/picker-DROquiIZ.cjs +123 -0
- package/components/picker-button/index.cjs +37 -0
- package/components/picker-button/index.d.ts +7 -0
- package/components/picker-button/index.js +87 -0
- package/components/picker-button/picker-button.d.ts +21 -0
- package/components/popover/index.js +1 -1
- package/components/progress-circle/index.js +1 -1
- package/components/radio/index.cjs +1 -1
- package/components/radio/index.js +2 -2
- package/components/search/index.cjs +1 -1
- package/components/search/index.js +3 -3
- package/components/slider/index.js +1 -1
- package/components/swatch/index.cjs +1 -1
- package/components/swatch/index.js +2 -2
- package/components/switch/index.cjs +1 -1
- package/components/switch/index.js +2 -2
- package/components/tags/index.cjs +1 -1
- package/components/tags/index.js +2 -2
- package/components/text-field/index.cjs +1 -1
- package/components/text-field/index.js +3 -3
- package/components/text-field-BTnBJoP9.js +314 -0
- package/components/text-field-mxJCYues.cjs +85 -0
- package/components/text-field.module-ColtFhf_.js +21 -0
- package/components/text-field.module-p_VF2tC_.cjs +18 -0
- package/components/toast/index.cjs +1 -1
- package/components/toast/index.js +3 -3
- package/components/tooltip/index.js +1 -1
- package/components/unit-input/index.cjs +1 -1
- package/components/unit-input/index.js +2 -2
- package/custom-elements.json +1 -1
- package/index.d.ts +3 -0
- package/package.json +16 -1
- package/components/index-4SZZSkew.cjs +0 -83
- package/components/index-AM-58E5r.js +0 -936
- package/components/picker-B05XA8I1.cjs +0 -127
- package/components/text-field-5_ev9way.cjs +0 -85
- package/components/text-field-CvKSS59x.js +0 -313
|
@@ -0,0 +1,1490 @@
|
|
|
1
|
+
/*! * Lucero - The design system for Luzmo.
|
|
2
|
+
*
|
|
3
|
+
* Copyright © 2025 Luzmo
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* Lucero (“Luzmo Design System”) must be used according to the Luzmo Terms of Service.
|
|
6
|
+
* This license allows users with a current active Luzmo account to use Lucero.
|
|
7
|
+
* This license terminates automatically if a user no longer has an active Luzmo account.
|
|
8
|
+
* Please view the Luzmo Terms of Service at: https://www.luzmo.com/information-pages/terms-of-use.
|
|
9
|
+
*
|
|
10
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
11
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
12
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
13
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
14
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
15
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
16
|
+
* SOFTWARE.
|
|
17
|
+
* */
|
|
18
|
+
import { $ as de } from "./NumberFormatter-DgOUVrge.js";
|
|
19
|
+
import { a as Be, r as Ae, x as g, n as F } from "./base-CawdqE7p.js";
|
|
20
|
+
import { e as Re } from "./class-map-CJko4aXp.js";
|
|
21
|
+
import { o as Oe } from "./if-defined-BSAr_4u4.js";
|
|
22
|
+
import { S as Pe } from "./sized-mixin-BxMraZLS.js";
|
|
23
|
+
import "./action-button/index.js";
|
|
24
|
+
import "./icon/index.js";
|
|
25
|
+
import { luzmoAngleLeft as We, luzmoAngleRight as Ye } from "@luzmo/icons";
|
|
26
|
+
import { r as D } from "./state-CYxk12SV.js";
|
|
27
|
+
function Z(t, e) {
|
|
28
|
+
return t - e * Math.floor(t / e);
|
|
29
|
+
}
|
|
30
|
+
const ye = 1721426;
|
|
31
|
+
function R(t, e, a, r) {
|
|
32
|
+
e = X(t, e);
|
|
33
|
+
let n = e - 1, o = -2;
|
|
34
|
+
return a <= 2 ? o = 0 : W(e) && (o = -1), ye - 1 + 365 * n + Math.floor(n / 4) - Math.floor(n / 100) + Math.floor(n / 400) + Math.floor((367 * a - 362) / 12 + o + r);
|
|
35
|
+
}
|
|
36
|
+
function W(t) {
|
|
37
|
+
return t % 4 === 0 && (t % 100 !== 0 || t % 400 === 0);
|
|
38
|
+
}
|
|
39
|
+
function X(t, e) {
|
|
40
|
+
return t === "BC" ? 1 - e : e;
|
|
41
|
+
}
|
|
42
|
+
function Ne(t) {
|
|
43
|
+
let e = "AD";
|
|
44
|
+
return t <= 0 && (e = "BC", t = 1 - t), [
|
|
45
|
+
e,
|
|
46
|
+
t
|
|
47
|
+
];
|
|
48
|
+
}
|
|
49
|
+
const Le = {
|
|
50
|
+
standard: [
|
|
51
|
+
31,
|
|
52
|
+
28,
|
|
53
|
+
31,
|
|
54
|
+
30,
|
|
55
|
+
31,
|
|
56
|
+
30,
|
|
57
|
+
31,
|
|
58
|
+
31,
|
|
59
|
+
30,
|
|
60
|
+
31,
|
|
61
|
+
30,
|
|
62
|
+
31
|
|
63
|
+
],
|
|
64
|
+
leapyear: [
|
|
65
|
+
31,
|
|
66
|
+
29,
|
|
67
|
+
31,
|
|
68
|
+
30,
|
|
69
|
+
31,
|
|
70
|
+
30,
|
|
71
|
+
31,
|
|
72
|
+
31,
|
|
73
|
+
30,
|
|
74
|
+
31,
|
|
75
|
+
30,
|
|
76
|
+
31
|
|
77
|
+
]
|
|
78
|
+
};
|
|
79
|
+
class I {
|
|
80
|
+
fromJulianDay(e) {
|
|
81
|
+
let a = e, r = a - ye, n = Math.floor(r / 146097), o = Z(r, 146097), l = Math.floor(o / 36524), d = Z(o, 36524), i = Math.floor(d / 1461), f = Z(d, 1461), M = Math.floor(f / 365), k = n * 400 + l * 100 + i * 4 + M + (l !== 4 && M !== 4 ? 1 : 0), [C, $] = Ne(k), b = a - R(C, $, 1, 1), U = 2;
|
|
82
|
+
a < R(C, $, 3, 1) ? U = 0 : W($) && (U = 1);
|
|
83
|
+
let le = Math.floor(((b + U) * 12 + 373) / 367), Fe = a - R(C, $, le, 1) + 1;
|
|
84
|
+
return new S(C, $, le, Fe);
|
|
85
|
+
}
|
|
86
|
+
toJulianDay(e) {
|
|
87
|
+
return R(e.era, e.year, e.month, e.day);
|
|
88
|
+
}
|
|
89
|
+
getDaysInMonth(e) {
|
|
90
|
+
return Le[W(e.year) ? "leapyear" : "standard"][e.month - 1];
|
|
91
|
+
}
|
|
92
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
93
|
+
getMonthsInYear(e) {
|
|
94
|
+
return 12;
|
|
95
|
+
}
|
|
96
|
+
getDaysInYear(e) {
|
|
97
|
+
return W(e.year) ? 366 : 365;
|
|
98
|
+
}
|
|
99
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
100
|
+
getYearsInEra(e) {
|
|
101
|
+
return 9999;
|
|
102
|
+
}
|
|
103
|
+
getEras() {
|
|
104
|
+
return [
|
|
105
|
+
"BC",
|
|
106
|
+
"AD"
|
|
107
|
+
];
|
|
108
|
+
}
|
|
109
|
+
isInverseEra(e) {
|
|
110
|
+
return e.era === "BC";
|
|
111
|
+
}
|
|
112
|
+
balanceDate(e) {
|
|
113
|
+
e.year <= 0 && (e.era = e.era === "BC" ? "AD" : "BC", e.year = 1 - e.year);
|
|
114
|
+
}
|
|
115
|
+
constructor() {
|
|
116
|
+
this.identifier = "gregory";
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
const He = {
|
|
120
|
+
"001": 1,
|
|
121
|
+
AD: 1,
|
|
122
|
+
AE: 6,
|
|
123
|
+
AF: 6,
|
|
124
|
+
AI: 1,
|
|
125
|
+
AL: 1,
|
|
126
|
+
AM: 1,
|
|
127
|
+
AN: 1,
|
|
128
|
+
AR: 1,
|
|
129
|
+
AT: 1,
|
|
130
|
+
AU: 1,
|
|
131
|
+
AX: 1,
|
|
132
|
+
AZ: 1,
|
|
133
|
+
BA: 1,
|
|
134
|
+
BE: 1,
|
|
135
|
+
BG: 1,
|
|
136
|
+
BH: 6,
|
|
137
|
+
BM: 1,
|
|
138
|
+
BN: 1,
|
|
139
|
+
BY: 1,
|
|
140
|
+
CH: 1,
|
|
141
|
+
CL: 1,
|
|
142
|
+
CM: 1,
|
|
143
|
+
CN: 1,
|
|
144
|
+
CR: 1,
|
|
145
|
+
CY: 1,
|
|
146
|
+
CZ: 1,
|
|
147
|
+
DE: 1,
|
|
148
|
+
DJ: 6,
|
|
149
|
+
DK: 1,
|
|
150
|
+
DZ: 6,
|
|
151
|
+
EC: 1,
|
|
152
|
+
EE: 1,
|
|
153
|
+
EG: 6,
|
|
154
|
+
ES: 1,
|
|
155
|
+
FI: 1,
|
|
156
|
+
FJ: 1,
|
|
157
|
+
FO: 1,
|
|
158
|
+
FR: 1,
|
|
159
|
+
GB: 1,
|
|
160
|
+
GE: 1,
|
|
161
|
+
GF: 1,
|
|
162
|
+
GP: 1,
|
|
163
|
+
GR: 1,
|
|
164
|
+
HR: 1,
|
|
165
|
+
HU: 1,
|
|
166
|
+
IE: 1,
|
|
167
|
+
IQ: 6,
|
|
168
|
+
IR: 6,
|
|
169
|
+
IS: 1,
|
|
170
|
+
IT: 1,
|
|
171
|
+
JO: 6,
|
|
172
|
+
KG: 1,
|
|
173
|
+
KW: 6,
|
|
174
|
+
KZ: 1,
|
|
175
|
+
LB: 1,
|
|
176
|
+
LI: 1,
|
|
177
|
+
LK: 1,
|
|
178
|
+
LT: 1,
|
|
179
|
+
LU: 1,
|
|
180
|
+
LV: 1,
|
|
181
|
+
LY: 6,
|
|
182
|
+
MC: 1,
|
|
183
|
+
MD: 1,
|
|
184
|
+
ME: 1,
|
|
185
|
+
MK: 1,
|
|
186
|
+
MN: 1,
|
|
187
|
+
MQ: 1,
|
|
188
|
+
MV: 5,
|
|
189
|
+
MY: 1,
|
|
190
|
+
NL: 1,
|
|
191
|
+
NO: 1,
|
|
192
|
+
NZ: 1,
|
|
193
|
+
OM: 6,
|
|
194
|
+
PL: 1,
|
|
195
|
+
QA: 6,
|
|
196
|
+
RE: 1,
|
|
197
|
+
RO: 1,
|
|
198
|
+
RS: 1,
|
|
199
|
+
RU: 1,
|
|
200
|
+
SD: 6,
|
|
201
|
+
SE: 1,
|
|
202
|
+
SI: 1,
|
|
203
|
+
SK: 1,
|
|
204
|
+
SM: 1,
|
|
205
|
+
SY: 6,
|
|
206
|
+
TJ: 1,
|
|
207
|
+
TM: 1,
|
|
208
|
+
TR: 1,
|
|
209
|
+
UA: 1,
|
|
210
|
+
UY: 1,
|
|
211
|
+
UZ: 1,
|
|
212
|
+
VA: 1,
|
|
213
|
+
VN: 1,
|
|
214
|
+
XK: 1
|
|
215
|
+
};
|
|
216
|
+
function p(t, e) {
|
|
217
|
+
return e = u(e, t.calendar), t.era === e.era && t.year === e.year && t.month === e.month && t.day === e.day;
|
|
218
|
+
}
|
|
219
|
+
function x(t, e) {
|
|
220
|
+
return e = u(e, t.calendar), t = w(t), e = w(e), t.era === e.era && t.year === e.year && t.month === e.month;
|
|
221
|
+
}
|
|
222
|
+
function Ue(t, e) {
|
|
223
|
+
var a, r, n, o;
|
|
224
|
+
return (o = (n = (a = t.isEqual) === null || a === void 0 ? void 0 : a.call(t, e)) !== null && n !== void 0 ? n : (r = e.isEqual) === null || r === void 0 ? void 0 : r.call(e, t)) !== null && o !== void 0 ? o : t.identifier === e.identifier;
|
|
225
|
+
}
|
|
226
|
+
function me(t, e, a) {
|
|
227
|
+
let r = t.calendar.toJulianDay(t), n = Ke(e), o = Math.ceil(r + 1 - n) % 7;
|
|
228
|
+
return o < 0 && (o += 7), o;
|
|
229
|
+
}
|
|
230
|
+
function Ze(t) {
|
|
231
|
+
return m(Date.now(), t);
|
|
232
|
+
}
|
|
233
|
+
function je(t) {
|
|
234
|
+
return Y(Ze(t));
|
|
235
|
+
}
|
|
236
|
+
function ve(t, e) {
|
|
237
|
+
return t.calendar.toJulianDay(t) - e.calendar.toJulianDay(e);
|
|
238
|
+
}
|
|
239
|
+
function be(t, e) {
|
|
240
|
+
return ie(t) - ie(e);
|
|
241
|
+
}
|
|
242
|
+
function ie(t) {
|
|
243
|
+
return t.hour * 36e5 + t.minute * 6e4 + t.second * 1e3 + t.millisecond;
|
|
244
|
+
}
|
|
245
|
+
let j = null;
|
|
246
|
+
function ee() {
|
|
247
|
+
return j == null && (j = new Intl.DateTimeFormat().resolvedOptions().timeZone), j;
|
|
248
|
+
}
|
|
249
|
+
function w(t) {
|
|
250
|
+
return t.subtract({
|
|
251
|
+
days: t.day - 1
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
function qe(t) {
|
|
255
|
+
return t.add({
|
|
256
|
+
days: t.calendar.getDaysInMonth(t) - t.day
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
function Ft(t) {
|
|
260
|
+
return t.calendar.getMinimumMonthInYear ? t.calendar.getMinimumMonthInYear(t) : 1;
|
|
261
|
+
}
|
|
262
|
+
function Bt(t) {
|
|
263
|
+
return t.calendar.getMinimumDayInMonth ? t.calendar.getMinimumDayInMonth(t) : 1;
|
|
264
|
+
}
|
|
265
|
+
function ce(t, e, a) {
|
|
266
|
+
let r = me(t, e);
|
|
267
|
+
return t.subtract({
|
|
268
|
+
days: r
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
const se = /* @__PURE__ */ new Map();
|
|
272
|
+
function Ge(t) {
|
|
273
|
+
if (Intl.Locale) {
|
|
274
|
+
let a = se.get(t);
|
|
275
|
+
return a || (a = new Intl.Locale(t).maximize().region, a && se.set(t, a)), a;
|
|
276
|
+
}
|
|
277
|
+
let e = t.split("-")[1];
|
|
278
|
+
return e === "u" ? void 0 : e;
|
|
279
|
+
}
|
|
280
|
+
function Ke(t) {
|
|
281
|
+
let e = Ge(t);
|
|
282
|
+
return e && He[e] || 0;
|
|
283
|
+
}
|
|
284
|
+
function Ve(t, e, a) {
|
|
285
|
+
let r = t.calendar.getDaysInMonth(t);
|
|
286
|
+
return Math.ceil((me(w(t), e) + r) / 7);
|
|
287
|
+
}
|
|
288
|
+
function T(t) {
|
|
289
|
+
t = u(t, new I());
|
|
290
|
+
let e = X(t.era, t.year);
|
|
291
|
+
return ge(e, t.month, t.day, t.hour, t.minute, t.second, t.millisecond);
|
|
292
|
+
}
|
|
293
|
+
function ge(t, e, a, r, n, o, l) {
|
|
294
|
+
let d = /* @__PURE__ */ new Date();
|
|
295
|
+
return d.setUTCHours(r, n, o, l), d.setUTCFullYear(t, e - 1, a), d.getTime();
|
|
296
|
+
}
|
|
297
|
+
function V(t, e) {
|
|
298
|
+
if (e === "UTC") return 0;
|
|
299
|
+
if (t > 0 && e === ee()) return new Date(t).getTimezoneOffset() * -6e4;
|
|
300
|
+
let { year: a, month: r, day: n, hour: o, minute: l, second: d } = $e(t, e);
|
|
301
|
+
return ge(a, r, n, o, l, d, 0) - Math.floor(t / 1e3) * 1e3;
|
|
302
|
+
}
|
|
303
|
+
const he = /* @__PURE__ */ new Map();
|
|
304
|
+
function $e(t, e) {
|
|
305
|
+
let a = he.get(e);
|
|
306
|
+
a || (a = new Intl.DateTimeFormat("en-US", {
|
|
307
|
+
timeZone: e,
|
|
308
|
+
hour12: !1,
|
|
309
|
+
era: "short",
|
|
310
|
+
year: "numeric",
|
|
311
|
+
month: "numeric",
|
|
312
|
+
day: "numeric",
|
|
313
|
+
hour: "numeric",
|
|
314
|
+
minute: "numeric",
|
|
315
|
+
second: "numeric"
|
|
316
|
+
}), he.set(e, a));
|
|
317
|
+
let r = a.formatToParts(new Date(t)), n = {};
|
|
318
|
+
for (let o of r) o.type !== "literal" && (n[o.type] = o.value);
|
|
319
|
+
return {
|
|
320
|
+
// Firefox returns B instead of BC... https://bugzilla.mozilla.org/show_bug.cgi?id=1752253
|
|
321
|
+
year: n.era === "BC" || n.era === "B" ? -n.year + 1 : +n.year,
|
|
322
|
+
month: +n.month,
|
|
323
|
+
day: +n.day,
|
|
324
|
+
hour: n.hour === "24" ? 0 : +n.hour,
|
|
325
|
+
minute: +n.minute,
|
|
326
|
+
second: +n.second
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
const ue = 864e5;
|
|
330
|
+
function Je(t, e, a, r) {
|
|
331
|
+
return (a === r ? [
|
|
332
|
+
a
|
|
333
|
+
] : [
|
|
334
|
+
a,
|
|
335
|
+
r
|
|
336
|
+
]).filter((o) => Qe(t, e, o));
|
|
337
|
+
}
|
|
338
|
+
function Qe(t, e, a) {
|
|
339
|
+
let r = $e(a, e);
|
|
340
|
+
return t.year === r.year && t.month === r.month && t.day === r.day && t.hour === r.hour && t.minute === r.minute && t.second === r.second;
|
|
341
|
+
}
|
|
342
|
+
function y(t, e, a = "compatible") {
|
|
343
|
+
let r = _(t);
|
|
344
|
+
if (e === "UTC") return T(r);
|
|
345
|
+
if (e === ee() && a === "compatible") {
|
|
346
|
+
r = u(r, new I());
|
|
347
|
+
let i = /* @__PURE__ */ new Date(), f = X(r.era, r.year);
|
|
348
|
+
return i.setFullYear(f, r.month - 1, r.day), i.setHours(r.hour, r.minute, r.second, r.millisecond), i.getTime();
|
|
349
|
+
}
|
|
350
|
+
let n = T(r), o = V(n - ue, e), l = V(n + ue, e), d = Je(r, e, n - o, n - l);
|
|
351
|
+
if (d.length === 1) return d[0];
|
|
352
|
+
if (d.length > 1) switch (a) {
|
|
353
|
+
// 'compatible' means 'earlier' for "fall back" transitions
|
|
354
|
+
case "compatible":
|
|
355
|
+
case "earlier":
|
|
356
|
+
return d[0];
|
|
357
|
+
case "later":
|
|
358
|
+
return d[d.length - 1];
|
|
359
|
+
case "reject":
|
|
360
|
+
throw new RangeError("Multiple possible absolute times found");
|
|
361
|
+
}
|
|
362
|
+
switch (a) {
|
|
363
|
+
case "earlier":
|
|
364
|
+
return Math.min(n - o, n - l);
|
|
365
|
+
// 'compatible' means 'later' for "spring forward" transitions
|
|
366
|
+
case "compatible":
|
|
367
|
+
case "later":
|
|
368
|
+
return Math.max(n - o, n - l);
|
|
369
|
+
case "reject":
|
|
370
|
+
throw new RangeError("No such absolute time found");
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
function pe(t, e, a = "compatible") {
|
|
374
|
+
return new Date(y(t, e, a));
|
|
375
|
+
}
|
|
376
|
+
function m(t, e) {
|
|
377
|
+
let a = V(t, e), r = new Date(t + a), n = r.getUTCFullYear(), o = r.getUTCMonth() + 1, l = r.getUTCDate(), d = r.getUTCHours(), i = r.getUTCMinutes(), f = r.getUTCSeconds(), M = r.getUTCMilliseconds();
|
|
378
|
+
return new E(n < 1 ? "BC" : "AD", n < 1 ? -n + 1 : n, o, l, e, a, d, i, f, M);
|
|
379
|
+
}
|
|
380
|
+
function Y(t) {
|
|
381
|
+
return new S(t.calendar, t.era, t.year, t.month, t.day);
|
|
382
|
+
}
|
|
383
|
+
function _(t, e) {
|
|
384
|
+
let a = 0, r = 0, n = 0, o = 0;
|
|
385
|
+
if ("timeZone" in t) ({ hour: a, minute: r, second: n, millisecond: o } = t);
|
|
386
|
+
else if ("hour" in t && !e) return t;
|
|
387
|
+
return e && ({ hour: a, minute: r, second: n, millisecond: o } = e), new N(t.calendar, t.era, t.year, t.month, t.day, a, r, n, o);
|
|
388
|
+
}
|
|
389
|
+
function u(t, e) {
|
|
390
|
+
if (Ue(t.calendar, e)) return t;
|
|
391
|
+
let a = e.fromJulianDay(t.calendar.toJulianDay(t)), r = t.copy();
|
|
392
|
+
return r.calendar = e, r.era = a.era, r.year = a.year, r.month = a.month, r.day = a.day, z(r), r;
|
|
393
|
+
}
|
|
394
|
+
function Xe(t, e, a) {
|
|
395
|
+
if (t instanceof E)
|
|
396
|
+
return t.timeZone === e ? t : xe(t, e);
|
|
397
|
+
let r = y(t, e, a);
|
|
398
|
+
return m(r, e);
|
|
399
|
+
}
|
|
400
|
+
function et(t) {
|
|
401
|
+
let e = T(t) - t.offset;
|
|
402
|
+
return new Date(e);
|
|
403
|
+
}
|
|
404
|
+
function xe(t, e) {
|
|
405
|
+
let a = T(t) - t.offset;
|
|
406
|
+
return u(m(a, e), t.calendar);
|
|
407
|
+
}
|
|
408
|
+
const B = 36e5;
|
|
409
|
+
function L(t, e) {
|
|
410
|
+
let a = t.copy(), r = "hour" in a ? Me(a, e) : 0;
|
|
411
|
+
J(a, e.years || 0), a.calendar.balanceYearMonth && a.calendar.balanceYearMonth(a, t), a.month += e.months || 0, Q(a), we(a), a.day += (e.weeks || 0) * 7, a.day += e.days || 0, a.day += r, tt(a), a.calendar.balanceDate && a.calendar.balanceDate(a), a.year < 1 && (a.year = 1, a.month = 1, a.day = 1);
|
|
412
|
+
let n = a.calendar.getYearsInEra(a);
|
|
413
|
+
if (a.year > n) {
|
|
414
|
+
var o, l;
|
|
415
|
+
let i = (o = (l = a.calendar).isInverseEra) === null || o === void 0 ? void 0 : o.call(l, a);
|
|
416
|
+
a.year = n, a.month = i ? 1 : a.calendar.getMonthsInYear(a), a.day = i ? 1 : a.calendar.getDaysInMonth(a);
|
|
417
|
+
}
|
|
418
|
+
a.month < 1 && (a.month = 1, a.day = 1);
|
|
419
|
+
let d = a.calendar.getMonthsInYear(a);
|
|
420
|
+
return a.month > d && (a.month = d, a.day = a.calendar.getDaysInMonth(a)), a.day = Math.max(1, Math.min(a.calendar.getDaysInMonth(a), a.day)), a;
|
|
421
|
+
}
|
|
422
|
+
function J(t, e) {
|
|
423
|
+
var a, r;
|
|
424
|
+
!((a = (r = t.calendar).isInverseEra) === null || a === void 0) && a.call(r, t) && (e = -e), t.year += e;
|
|
425
|
+
}
|
|
426
|
+
function Q(t) {
|
|
427
|
+
for (; t.month < 1; )
|
|
428
|
+
J(t, -1), t.month += t.calendar.getMonthsInYear(t);
|
|
429
|
+
let e = 0;
|
|
430
|
+
for (; t.month > (e = t.calendar.getMonthsInYear(t)); )
|
|
431
|
+
t.month -= e, J(t, 1);
|
|
432
|
+
}
|
|
433
|
+
function tt(t) {
|
|
434
|
+
for (; t.day < 1; )
|
|
435
|
+
t.month--, Q(t), t.day += t.calendar.getDaysInMonth(t);
|
|
436
|
+
for (; t.day > t.calendar.getDaysInMonth(t); )
|
|
437
|
+
t.day -= t.calendar.getDaysInMonth(t), t.month++, Q(t);
|
|
438
|
+
}
|
|
439
|
+
function we(t) {
|
|
440
|
+
t.month = Math.max(1, Math.min(t.calendar.getMonthsInYear(t), t.month)), t.day = Math.max(1, Math.min(t.calendar.getDaysInMonth(t), t.day));
|
|
441
|
+
}
|
|
442
|
+
function z(t) {
|
|
443
|
+
t.calendar.constrainDate && t.calendar.constrainDate(t), t.year = Math.max(1, Math.min(t.calendar.getYearsInEra(t), t.year)), we(t);
|
|
444
|
+
}
|
|
445
|
+
function te(t) {
|
|
446
|
+
let e = {};
|
|
447
|
+
for (let a in t) typeof t[a] == "number" && (e[a] = -t[a]);
|
|
448
|
+
return e;
|
|
449
|
+
}
|
|
450
|
+
function ze(t, e) {
|
|
451
|
+
return L(t, te(e));
|
|
452
|
+
}
|
|
453
|
+
function ae(t, e) {
|
|
454
|
+
let a = t.copy();
|
|
455
|
+
return e.era != null && (a.era = e.era), e.year != null && (a.year = e.year), e.month != null && (a.month = e.month), e.day != null && (a.day = e.day), z(a), a;
|
|
456
|
+
}
|
|
457
|
+
function A(t, e) {
|
|
458
|
+
let a = t.copy();
|
|
459
|
+
return e.hour != null && (a.hour = e.hour), e.minute != null && (a.minute = e.minute), e.second != null && (a.second = e.second), e.millisecond != null && (a.millisecond = e.millisecond), De(a), a;
|
|
460
|
+
}
|
|
461
|
+
function at(t) {
|
|
462
|
+
t.second += Math.floor(t.millisecond / 1e3), t.millisecond = O(t.millisecond, 1e3), t.minute += Math.floor(t.second / 60), t.second = O(t.second, 60), t.hour += Math.floor(t.minute / 60), t.minute = O(t.minute, 60);
|
|
463
|
+
let e = Math.floor(t.hour / 24);
|
|
464
|
+
return t.hour = O(t.hour, 24), e;
|
|
465
|
+
}
|
|
466
|
+
function De(t) {
|
|
467
|
+
t.millisecond = Math.max(0, Math.min(t.millisecond, 1e3)), t.second = Math.max(0, Math.min(t.second, 59)), t.minute = Math.max(0, Math.min(t.minute, 59)), t.hour = Math.max(0, Math.min(t.hour, 23));
|
|
468
|
+
}
|
|
469
|
+
function O(t, e) {
|
|
470
|
+
let a = t % e;
|
|
471
|
+
return a < 0 && (a += e), a;
|
|
472
|
+
}
|
|
473
|
+
function Me(t, e) {
|
|
474
|
+
return t.hour += e.hours || 0, t.minute += e.minutes || 0, t.second += e.seconds || 0, t.millisecond += e.milliseconds || 0, at(t);
|
|
475
|
+
}
|
|
476
|
+
function ke(t, e) {
|
|
477
|
+
let a = t.copy();
|
|
478
|
+
return Me(a, e), a;
|
|
479
|
+
}
|
|
480
|
+
function rt(t, e) {
|
|
481
|
+
return ke(t, te(e));
|
|
482
|
+
}
|
|
483
|
+
function re(t, e, a, r) {
|
|
484
|
+
let n = t.copy();
|
|
485
|
+
switch (e) {
|
|
486
|
+
case "era": {
|
|
487
|
+
let d = t.calendar.getEras(), i = d.indexOf(t.era);
|
|
488
|
+
if (i < 0) throw new Error("Invalid era: " + t.era);
|
|
489
|
+
i = v(i, a, 0, d.length - 1, r == null ? void 0 : r.round), n.era = d[i], z(n);
|
|
490
|
+
break;
|
|
491
|
+
}
|
|
492
|
+
case "year":
|
|
493
|
+
var o, l;
|
|
494
|
+
!((o = (l = n.calendar).isInverseEra) === null || o === void 0) && o.call(l, n) && (a = -a), n.year = v(t.year, a, -1 / 0, 9999, r == null ? void 0 : r.round), n.year === -1 / 0 && (n.year = 1), n.calendar.balanceYearMonth && n.calendar.balanceYearMonth(n, t);
|
|
495
|
+
break;
|
|
496
|
+
case "month":
|
|
497
|
+
n.month = v(t.month, a, 1, t.calendar.getMonthsInYear(t), r == null ? void 0 : r.round);
|
|
498
|
+
break;
|
|
499
|
+
case "day":
|
|
500
|
+
n.day = v(t.day, a, 1, t.calendar.getDaysInMonth(t), r == null ? void 0 : r.round);
|
|
501
|
+
break;
|
|
502
|
+
default:
|
|
503
|
+
throw new Error("Unsupported field " + e);
|
|
504
|
+
}
|
|
505
|
+
return t.calendar.balanceDate && t.calendar.balanceDate(n), z(n), n;
|
|
506
|
+
}
|
|
507
|
+
function ne(t, e, a, r) {
|
|
508
|
+
let n = t.copy();
|
|
509
|
+
switch (e) {
|
|
510
|
+
case "hour": {
|
|
511
|
+
let o = t.hour, l = 0, d = 23;
|
|
512
|
+
if ((r == null ? void 0 : r.hourCycle) === 12) {
|
|
513
|
+
let i = o >= 12;
|
|
514
|
+
l = i ? 12 : 0, d = i ? 23 : 11;
|
|
515
|
+
}
|
|
516
|
+
n.hour = v(o, a, l, d, r == null ? void 0 : r.round);
|
|
517
|
+
break;
|
|
518
|
+
}
|
|
519
|
+
case "minute":
|
|
520
|
+
n.minute = v(t.minute, a, 0, 59, r == null ? void 0 : r.round);
|
|
521
|
+
break;
|
|
522
|
+
case "second":
|
|
523
|
+
n.second = v(t.second, a, 0, 59, r == null ? void 0 : r.round);
|
|
524
|
+
break;
|
|
525
|
+
case "millisecond":
|
|
526
|
+
n.millisecond = v(t.millisecond, a, 0, 999, r == null ? void 0 : r.round);
|
|
527
|
+
break;
|
|
528
|
+
default:
|
|
529
|
+
throw new Error("Unsupported field " + e);
|
|
530
|
+
}
|
|
531
|
+
return n;
|
|
532
|
+
}
|
|
533
|
+
function v(t, e, a, r, n = !1) {
|
|
534
|
+
if (n) {
|
|
535
|
+
t += Math.sign(e), t < a && (t = r);
|
|
536
|
+
let o = Math.abs(e);
|
|
537
|
+
e > 0 ? t = Math.ceil(t / o) * o : t = Math.floor(t / o) * o, t > r && (t = a);
|
|
538
|
+
} else
|
|
539
|
+
t += e, t < a ? t = r - (a - t - 1) : t > r && (t = a + (t - r - 1));
|
|
540
|
+
return t;
|
|
541
|
+
}
|
|
542
|
+
function Ce(t, e) {
|
|
543
|
+
let a;
|
|
544
|
+
if (e.years != null && e.years !== 0 || e.months != null && e.months !== 0 || e.weeks != null && e.weeks !== 0 || e.days != null && e.days !== 0) {
|
|
545
|
+
let n = L(_(t), {
|
|
546
|
+
years: e.years,
|
|
547
|
+
months: e.months,
|
|
548
|
+
weeks: e.weeks,
|
|
549
|
+
days: e.days
|
|
550
|
+
});
|
|
551
|
+
a = y(n, t.timeZone);
|
|
552
|
+
} else
|
|
553
|
+
a = T(t) - t.offset;
|
|
554
|
+
a += e.milliseconds || 0, a += (e.seconds || 0) * 1e3, a += (e.minutes || 0) * 6e4, a += (e.hours || 0) * 36e5;
|
|
555
|
+
let r = m(a, t.timeZone);
|
|
556
|
+
return u(r, t.calendar);
|
|
557
|
+
}
|
|
558
|
+
function nt(t, e) {
|
|
559
|
+
return Ce(t, te(e));
|
|
560
|
+
}
|
|
561
|
+
function ot(t, e, a, r) {
|
|
562
|
+
switch (e) {
|
|
563
|
+
case "hour": {
|
|
564
|
+
let n = 0, o = 23;
|
|
565
|
+
if ((r == null ? void 0 : r.hourCycle) === 12) {
|
|
566
|
+
let b = t.hour >= 12;
|
|
567
|
+
n = b ? 12 : 0, o = b ? 23 : 11;
|
|
568
|
+
}
|
|
569
|
+
let l = _(t), d = u(A(l, {
|
|
570
|
+
hour: n
|
|
571
|
+
}), new I()), i = [
|
|
572
|
+
y(d, t.timeZone, "earlier"),
|
|
573
|
+
y(d, t.timeZone, "later")
|
|
574
|
+
].filter((b) => m(b, t.timeZone).day === d.day)[0], f = u(A(l, {
|
|
575
|
+
hour: o
|
|
576
|
+
}), new I()), M = [
|
|
577
|
+
y(f, t.timeZone, "earlier"),
|
|
578
|
+
y(f, t.timeZone, "later")
|
|
579
|
+
].filter((b) => m(b, t.timeZone).day === f.day).pop(), k = T(t) - t.offset, C = Math.floor(k / B), $ = k % B;
|
|
580
|
+
return k = v(C, a, Math.floor(i / B), Math.floor(M / B), r == null ? void 0 : r.round) * B + $, u(m(k, t.timeZone), t.calendar);
|
|
581
|
+
}
|
|
582
|
+
case "minute":
|
|
583
|
+
case "second":
|
|
584
|
+
case "millisecond":
|
|
585
|
+
return ne(t, e, a, r);
|
|
586
|
+
case "era":
|
|
587
|
+
case "year":
|
|
588
|
+
case "month":
|
|
589
|
+
case "day": {
|
|
590
|
+
let n = re(_(t), e, a, r), o = y(n, t.timeZone);
|
|
591
|
+
return u(m(o, t.timeZone), t.calendar);
|
|
592
|
+
}
|
|
593
|
+
default:
|
|
594
|
+
throw new Error("Unsupported field " + e);
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
function lt(t, e, a) {
|
|
598
|
+
let r = _(t), n = A(ae(r, e), e);
|
|
599
|
+
if (n.compare(r) === 0) return t;
|
|
600
|
+
let o = y(n, t.timeZone, a);
|
|
601
|
+
return u(m(o, t.timeZone), t.calendar);
|
|
602
|
+
}
|
|
603
|
+
const dt = /^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/, it = /^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;
|
|
604
|
+
function P(t) {
|
|
605
|
+
let e = t.match(dt);
|
|
606
|
+
if (!e) throw new Error("Invalid ISO 8601 date string: " + t);
|
|
607
|
+
let a = new S(h(e[1], 0, 9999), h(e[2], 1, 12), 1);
|
|
608
|
+
return a.day = h(e[3], 0, a.calendar.getDaysInMonth(a)), a;
|
|
609
|
+
}
|
|
610
|
+
function At(t, e) {
|
|
611
|
+
let a = t.match(it);
|
|
612
|
+
if (!a) throw new Error("Invalid ISO 8601 date time string: " + t);
|
|
613
|
+
let r = h(a[1], -9999, 9999), n = r < 1 ? "BC" : "AD", o = new E(n, r < 1 ? -r + 1 : r, h(a[2], 1, 12), 1, e, 0, a[4] ? h(a[4], 0, 23) : 0, a[5] ? h(a[5], 0, 59) : 0, a[6] ? h(a[6], 0, 59) : 0, a[7] ? h(a[7], 0, 1 / 0) * 1e3 : 0);
|
|
614
|
+
o.day = h(a[3], 0, o.calendar.getDaysInMonth(o));
|
|
615
|
+
var l;
|
|
616
|
+
return a[8] && (o.offset = h(a[8], -23, 23) * 36e5 + h((l = a[9]) !== null && l !== void 0 ? l : "0", 0, 59) * 6e4), xe(o, e);
|
|
617
|
+
}
|
|
618
|
+
function h(t, e, a) {
|
|
619
|
+
let r = Number(t);
|
|
620
|
+
if (r < e || r > a) throw new RangeError(`Value out of range: ${e} <= ${r} <= ${a}`);
|
|
621
|
+
return r;
|
|
622
|
+
}
|
|
623
|
+
function Ie(t) {
|
|
624
|
+
return `${String(t.hour).padStart(2, "0")}:${String(t.minute).padStart(2, "0")}:${String(t.second).padStart(2, "0")}${t.millisecond ? String(t.millisecond / 1e3).slice(1) : ""}`;
|
|
625
|
+
}
|
|
626
|
+
function Te(t) {
|
|
627
|
+
let e = u(t, new I()), a;
|
|
628
|
+
return e.era === "BC" ? a = e.year === 1 ? "0000" : "-" + String(Math.abs(1 - e.year)).padStart(6, "00") : a = String(e.year).padStart(4, "0"), `${a}-${String(e.month).padStart(2, "0")}-${String(e.day).padStart(2, "0")}`;
|
|
629
|
+
}
|
|
630
|
+
function _e(t) {
|
|
631
|
+
return `${Te(t)}T${Ie(t)}`;
|
|
632
|
+
}
|
|
633
|
+
function ct(t) {
|
|
634
|
+
let e = Math.sign(t) < 0 ? "-" : "+";
|
|
635
|
+
t = Math.abs(t);
|
|
636
|
+
let a = Math.floor(t / 36e5), r = t % 36e5 / 6e4;
|
|
637
|
+
return `${e}${String(a).padStart(2, "0")}:${String(r).padStart(2, "0")}`;
|
|
638
|
+
}
|
|
639
|
+
function st(t) {
|
|
640
|
+
return `${_e(t)}${ct(t.offset)}[${t.timeZone}]`;
|
|
641
|
+
}
|
|
642
|
+
function ht(t, e) {
|
|
643
|
+
if (e.has(t))
|
|
644
|
+
throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
645
|
+
}
|
|
646
|
+
function H(t, e, a) {
|
|
647
|
+
ht(t, e), e.set(t, a);
|
|
648
|
+
}
|
|
649
|
+
function oe(t) {
|
|
650
|
+
let e = typeof t[0] == "object" ? t.shift() : new I(), a;
|
|
651
|
+
if (typeof t[0] == "string") a = t.shift();
|
|
652
|
+
else {
|
|
653
|
+
let l = e.getEras();
|
|
654
|
+
a = l[l.length - 1];
|
|
655
|
+
}
|
|
656
|
+
let r = t.shift(), n = t.shift(), o = t.shift();
|
|
657
|
+
return [
|
|
658
|
+
e,
|
|
659
|
+
a,
|
|
660
|
+
r,
|
|
661
|
+
n,
|
|
662
|
+
o
|
|
663
|
+
];
|
|
664
|
+
}
|
|
665
|
+
var ut = /* @__PURE__ */ new WeakMap();
|
|
666
|
+
class S {
|
|
667
|
+
/** Returns a copy of this date. */
|
|
668
|
+
copy() {
|
|
669
|
+
return this.era ? new S(this.calendar, this.era, this.year, this.month, this.day) : new S(this.calendar, this.year, this.month, this.day);
|
|
670
|
+
}
|
|
671
|
+
/** Returns a new `CalendarDate` with the given duration added to it. */
|
|
672
|
+
add(e) {
|
|
673
|
+
return L(this, e);
|
|
674
|
+
}
|
|
675
|
+
/** Returns a new `CalendarDate` with the given duration subtracted from it. */
|
|
676
|
+
subtract(e) {
|
|
677
|
+
return ze(this, e);
|
|
678
|
+
}
|
|
679
|
+
/** Returns a new `CalendarDate` with the given fields set to the provided values. Other fields will be constrained accordingly. */
|
|
680
|
+
set(e) {
|
|
681
|
+
return ae(this, e);
|
|
682
|
+
}
|
|
683
|
+
/**
|
|
684
|
+
* Returns a new `CalendarDate` with the given field adjusted by a specified amount.
|
|
685
|
+
* When the resulting value reaches the limits of the field, it wraps around.
|
|
686
|
+
*/
|
|
687
|
+
cycle(e, a, r) {
|
|
688
|
+
return re(this, e, a, r);
|
|
689
|
+
}
|
|
690
|
+
/** Converts the date to a native JavaScript Date object, with the time set to midnight in the given time zone. */
|
|
691
|
+
toDate(e) {
|
|
692
|
+
return pe(this, e);
|
|
693
|
+
}
|
|
694
|
+
/** Converts the date to an ISO 8601 formatted string. */
|
|
695
|
+
toString() {
|
|
696
|
+
return Te(this);
|
|
697
|
+
}
|
|
698
|
+
/** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */
|
|
699
|
+
compare(e) {
|
|
700
|
+
return ve(this, e);
|
|
701
|
+
}
|
|
702
|
+
constructor(...e) {
|
|
703
|
+
H(this, ut, {
|
|
704
|
+
writable: !0,
|
|
705
|
+
value: void 0
|
|
706
|
+
});
|
|
707
|
+
let [a, r, n, o, l] = oe(e);
|
|
708
|
+
this.calendar = a, this.era = r, this.year = n, this.month = o, this.day = l, z(this);
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
var ft = /* @__PURE__ */ new WeakMap();
|
|
712
|
+
class Se {
|
|
713
|
+
/** Returns a copy of this time. */
|
|
714
|
+
copy() {
|
|
715
|
+
return new Se(this.hour, this.minute, this.second, this.millisecond);
|
|
716
|
+
}
|
|
717
|
+
/** Returns a new `Time` with the given duration added to it. */
|
|
718
|
+
add(e) {
|
|
719
|
+
return ke(this, e);
|
|
720
|
+
}
|
|
721
|
+
/** Returns a new `Time` with the given duration subtracted from it. */
|
|
722
|
+
subtract(e) {
|
|
723
|
+
return rt(this, e);
|
|
724
|
+
}
|
|
725
|
+
/** Returns a new `Time` with the given fields set to the provided values. Other fields will be constrained accordingly. */
|
|
726
|
+
set(e) {
|
|
727
|
+
return A(this, e);
|
|
728
|
+
}
|
|
729
|
+
/**
|
|
730
|
+
* Returns a new `Time` with the given field adjusted by a specified amount.
|
|
731
|
+
* When the resulting value reaches the limits of the field, it wraps around.
|
|
732
|
+
*/
|
|
733
|
+
cycle(e, a, r) {
|
|
734
|
+
return ne(this, e, a, r);
|
|
735
|
+
}
|
|
736
|
+
/** Converts the time to an ISO 8601 formatted string. */
|
|
737
|
+
toString() {
|
|
738
|
+
return Ie(this);
|
|
739
|
+
}
|
|
740
|
+
/** Compares this time with another. A negative result indicates that this time is before the given one, and a positive time indicates that it is after. */
|
|
741
|
+
compare(e) {
|
|
742
|
+
return be(this, e);
|
|
743
|
+
}
|
|
744
|
+
constructor(e = 0, a = 0, r = 0, n = 0) {
|
|
745
|
+
H(this, ft, {
|
|
746
|
+
writable: !0,
|
|
747
|
+
value: void 0
|
|
748
|
+
}), this.hour = e, this.minute = a, this.second = r, this.millisecond = n, De(this);
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
var yt = /* @__PURE__ */ new WeakMap();
|
|
752
|
+
class N {
|
|
753
|
+
/** Returns a copy of this date. */
|
|
754
|
+
copy() {
|
|
755
|
+
return this.era ? new N(this.calendar, this.era, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond) : new N(this.calendar, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond);
|
|
756
|
+
}
|
|
757
|
+
/** Returns a new `CalendarDateTime` with the given duration added to it. */
|
|
758
|
+
add(e) {
|
|
759
|
+
return L(this, e);
|
|
760
|
+
}
|
|
761
|
+
/** Returns a new `CalendarDateTime` with the given duration subtracted from it. */
|
|
762
|
+
subtract(e) {
|
|
763
|
+
return ze(this, e);
|
|
764
|
+
}
|
|
765
|
+
/** Returns a new `CalendarDateTime` with the given fields set to the provided values. Other fields will be constrained accordingly. */
|
|
766
|
+
set(e) {
|
|
767
|
+
return ae(A(this, e), e);
|
|
768
|
+
}
|
|
769
|
+
/**
|
|
770
|
+
* Returns a new `CalendarDateTime` with the given field adjusted by a specified amount.
|
|
771
|
+
* When the resulting value reaches the limits of the field, it wraps around.
|
|
772
|
+
*/
|
|
773
|
+
cycle(e, a, r) {
|
|
774
|
+
switch (e) {
|
|
775
|
+
case "era":
|
|
776
|
+
case "year":
|
|
777
|
+
case "month":
|
|
778
|
+
case "day":
|
|
779
|
+
return re(this, e, a, r);
|
|
780
|
+
default:
|
|
781
|
+
return ne(this, e, a, r);
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
/** Converts the date to a native JavaScript Date object in the given time zone. */
|
|
785
|
+
toDate(e, a) {
|
|
786
|
+
return pe(this, e, a);
|
|
787
|
+
}
|
|
788
|
+
/** Converts the date to an ISO 8601 formatted string. */
|
|
789
|
+
toString() {
|
|
790
|
+
return _e(this);
|
|
791
|
+
}
|
|
792
|
+
/** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */
|
|
793
|
+
compare(e) {
|
|
794
|
+
let a = ve(this, e);
|
|
795
|
+
return a === 0 ? be(this, _(e)) : a;
|
|
796
|
+
}
|
|
797
|
+
constructor(...e) {
|
|
798
|
+
H(this, yt, {
|
|
799
|
+
writable: !0,
|
|
800
|
+
value: void 0
|
|
801
|
+
});
|
|
802
|
+
let [a, r, n, o, l] = oe(e);
|
|
803
|
+
this.calendar = a, this.era = r, this.year = n, this.month = o, this.day = l, this.hour = e.shift() || 0, this.minute = e.shift() || 0, this.second = e.shift() || 0, this.millisecond = e.shift() || 0, z(this);
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
var mt = /* @__PURE__ */ new WeakMap();
|
|
807
|
+
class E {
|
|
808
|
+
/** Returns a copy of this date. */
|
|
809
|
+
copy() {
|
|
810
|
+
return this.era ? new E(this.calendar, this.era, this.year, this.month, this.day, this.timeZone, this.offset, this.hour, this.minute, this.second, this.millisecond) : new E(this.calendar, this.year, this.month, this.day, this.timeZone, this.offset, this.hour, this.minute, this.second, this.millisecond);
|
|
811
|
+
}
|
|
812
|
+
/** Returns a new `ZonedDateTime` with the given duration added to it. */
|
|
813
|
+
add(e) {
|
|
814
|
+
return Ce(this, e);
|
|
815
|
+
}
|
|
816
|
+
/** Returns a new `ZonedDateTime` with the given duration subtracted from it. */
|
|
817
|
+
subtract(e) {
|
|
818
|
+
return nt(this, e);
|
|
819
|
+
}
|
|
820
|
+
/** Returns a new `ZonedDateTime` with the given fields set to the provided values. Other fields will be constrained accordingly. */
|
|
821
|
+
set(e, a) {
|
|
822
|
+
return lt(this, e, a);
|
|
823
|
+
}
|
|
824
|
+
/**
|
|
825
|
+
* Returns a new `ZonedDateTime` with the given field adjusted by a specified amount.
|
|
826
|
+
* When the resulting value reaches the limits of the field, it wraps around.
|
|
827
|
+
*/
|
|
828
|
+
cycle(e, a, r) {
|
|
829
|
+
return ot(this, e, a, r);
|
|
830
|
+
}
|
|
831
|
+
/** Converts the date to a native JavaScript Date object. */
|
|
832
|
+
toDate() {
|
|
833
|
+
return et(this);
|
|
834
|
+
}
|
|
835
|
+
/** Converts the date to an ISO 8601 formatted string, including the UTC offset and time zone identifier. */
|
|
836
|
+
toString() {
|
|
837
|
+
return st(this);
|
|
838
|
+
}
|
|
839
|
+
/** Converts the date to an ISO 8601 formatted string in UTC. */
|
|
840
|
+
toAbsoluteString() {
|
|
841
|
+
return this.toDate().toISOString();
|
|
842
|
+
}
|
|
843
|
+
/** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */
|
|
844
|
+
compare(e) {
|
|
845
|
+
return this.toDate().getTime() - Xe(e, this.timeZone).toDate().getTime();
|
|
846
|
+
}
|
|
847
|
+
constructor(...e) {
|
|
848
|
+
H(this, mt, {
|
|
849
|
+
writable: !0,
|
|
850
|
+
value: void 0
|
|
851
|
+
});
|
|
852
|
+
let [a, r, n, o, l] = oe(e), d = e.shift(), i = e.shift();
|
|
853
|
+
this.calendar = a, this.era = r, this.year = n, this.month = o, this.day = l, this.timeZone = d, this.offset = i, this.hour = e.shift() || 0, this.minute = e.shift() || 0, this.second = e.shift() || 0, this.millisecond = e.shift() || 0, z(this);
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
let q = /* @__PURE__ */ new Map();
|
|
857
|
+
class vt {
|
|
858
|
+
/** Formats a date as a string according to the locale and format options passed to the constructor. */
|
|
859
|
+
format(e) {
|
|
860
|
+
return this.formatter.format(e);
|
|
861
|
+
}
|
|
862
|
+
/** Formats a date to an array of parts such as separators, numbers, punctuation, and more. */
|
|
863
|
+
formatToParts(e) {
|
|
864
|
+
return this.formatter.formatToParts(e);
|
|
865
|
+
}
|
|
866
|
+
/** Formats a date range as a string. */
|
|
867
|
+
formatRange(e, a) {
|
|
868
|
+
if (typeof this.formatter.formatRange == "function")
|
|
869
|
+
return this.formatter.formatRange(e, a);
|
|
870
|
+
if (a < e) throw new RangeError("End date must be >= start date");
|
|
871
|
+
return `${this.formatter.format(e)} – ${this.formatter.format(a)}`;
|
|
872
|
+
}
|
|
873
|
+
/** Formats a date range as an array of parts. */
|
|
874
|
+
formatRangeToParts(e, a) {
|
|
875
|
+
if (typeof this.formatter.formatRangeToParts == "function")
|
|
876
|
+
return this.formatter.formatRangeToParts(e, a);
|
|
877
|
+
if (a < e) throw new RangeError("End date must be >= start date");
|
|
878
|
+
let r = this.formatter.formatToParts(e), n = this.formatter.formatToParts(a);
|
|
879
|
+
return [
|
|
880
|
+
...r.map((o) => ({
|
|
881
|
+
...o,
|
|
882
|
+
source: "startRange"
|
|
883
|
+
})),
|
|
884
|
+
{
|
|
885
|
+
type: "literal",
|
|
886
|
+
value: " – ",
|
|
887
|
+
source: "shared"
|
|
888
|
+
},
|
|
889
|
+
...n.map((o) => ({
|
|
890
|
+
...o,
|
|
891
|
+
source: "endRange"
|
|
892
|
+
}))
|
|
893
|
+
];
|
|
894
|
+
}
|
|
895
|
+
/** Returns the resolved formatting options based on the values passed to the constructor. */
|
|
896
|
+
resolvedOptions() {
|
|
897
|
+
let e = this.formatter.resolvedOptions();
|
|
898
|
+
return $t() && (this.resolvedHourCycle || (this.resolvedHourCycle = pt(e.locale, this.options)), e.hourCycle = this.resolvedHourCycle, e.hour12 = this.resolvedHourCycle === "h11" || this.resolvedHourCycle === "h12"), e.calendar === "ethiopic-amete-alem" && (e.calendar = "ethioaa"), e;
|
|
899
|
+
}
|
|
900
|
+
constructor(e, a = {}) {
|
|
901
|
+
this.formatter = Ee(e, a), this.options = a;
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
const bt = {
|
|
905
|
+
true: {
|
|
906
|
+
// Only Japanese uses the h11 style for 12 hour time. All others use h12.
|
|
907
|
+
ja: "h11"
|
|
908
|
+
},
|
|
909
|
+
false: {}
|
|
910
|
+
};
|
|
911
|
+
function Ee(t, e = {}) {
|
|
912
|
+
if (typeof e.hour12 == "boolean" && gt()) {
|
|
913
|
+
e = {
|
|
914
|
+
...e
|
|
915
|
+
};
|
|
916
|
+
let n = bt[String(e.hour12)][t.split("-")[0]], o = e.hour12 ? "h12" : "h23";
|
|
917
|
+
e.hourCycle = n ?? o, delete e.hour12;
|
|
918
|
+
}
|
|
919
|
+
let a = t + (e ? Object.entries(e).sort((n, o) => n[0] < o[0] ? -1 : 1).join() : "");
|
|
920
|
+
if (q.has(a)) return q.get(a);
|
|
921
|
+
let r = new Intl.DateTimeFormat(t, e);
|
|
922
|
+
return q.set(a, r), r;
|
|
923
|
+
}
|
|
924
|
+
let G = null;
|
|
925
|
+
function gt() {
|
|
926
|
+
return G == null && (G = new Intl.DateTimeFormat("en-US", {
|
|
927
|
+
hour: "numeric",
|
|
928
|
+
hour12: !1
|
|
929
|
+
}).format(new Date(2020, 2, 3, 0)) === "24"), G;
|
|
930
|
+
}
|
|
931
|
+
let K = null;
|
|
932
|
+
function $t() {
|
|
933
|
+
return K == null && (K = new Intl.DateTimeFormat("fr", {
|
|
934
|
+
hour: "numeric",
|
|
935
|
+
hour12: !1
|
|
936
|
+
}).resolvedOptions().hourCycle === "h12"), K;
|
|
937
|
+
}
|
|
938
|
+
function pt(t, e) {
|
|
939
|
+
if (!e.timeStyle && !e.hour) return;
|
|
940
|
+
t = t.replace(/(-u-)?-nu-[a-zA-Z0-9]+/, ""), t += (t.includes("-u-") ? "" : "-u") + "-nu-latn";
|
|
941
|
+
let a = Ee(t, {
|
|
942
|
+
...e,
|
|
943
|
+
timeZone: void 0
|
|
944
|
+
// use local timezone
|
|
945
|
+
}), r = parseInt(a.formatToParts(new Date(2020, 2, 3, 0)).find((o) => o.type === "hour").value, 10), n = parseInt(a.formatToParts(new Date(2020, 2, 3, 23)).find((o) => o.type === "hour").value, 10);
|
|
946
|
+
if (r === 0 && n === 23) return "h23";
|
|
947
|
+
if (r === 24 && n === 23) return "h24";
|
|
948
|
+
if (r === 0 && n === 11) return "h11";
|
|
949
|
+
if (r === 12 && n === 11) return "h12";
|
|
950
|
+
throw new Error("Unexpected hour cycle result");
|
|
951
|
+
}
|
|
952
|
+
const xt = ':host{inline-size:var(--luzmo-calendar-width, var(--calendar-width));display:inline-block}.header{inline-size:100%;align-items:center;display:flex}.title{color:var(--highcontrast-calendar-date-text-color, var(--luzmo-calendar-date-text-color, var(--calendar-date-text-color)));font-size:var(--luzmo-calendar-title-text-size, var(--calendar-title-text-size));font-weight:var(--luzmo-calendar-title-font-weight, var(--calendar-title-font-weight));line-height:var(--luzmo-calendar-title-height, var(--calendar-title-height));text-align:center;white-space:nowrap;text-overflow:ellipsis;flex-grow:1;order:1;margin:0;overflow:hidden}.nextMonth,.prevMonth{transform:var(--logical-rotation)}.nextMonth:not([disabled]),.prevMonth:not([disabled]){color:var(--highcontrast-calendar-button-icon-color, var(--luzmo-calendar-button-icon-color, var(--calendar-button-icon-color)))}.prevMonth{order:0}.nextMonth{order:2}.dayOfWeek{inline-size:var(--luzmo-calendar-day-width, var(--calendar-day-width));color:var(--highcontrast-calendar-day-title-text-color, var(--luzmo-calendar-day-title-text-color, var(--calendar-day-title-text-color)));font-size:var(--luzmo-calendar-day-title-text-size, var(--calendar-day-title-text-size));font-weight:var(--luzmo-calendar-day-title-text-font-weight, var(--calendar-day-title-text-font-weight));text-transform:uppercase;cursor:default;flex-direction:column;justify-content:flex-end;display:flex;border-block-end:none!important;-webkit-text-decoration:none!important;text-decoration:none!important}:host([title]) .dayOfWeek{text-decoration:underline;letter-spacing:var(--luzmo-calendar-title-text-letter-spacing, var(--calendar-title-text-letter-spacing));border-block-end:none;-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.body{outline:none}.table{table-layout:fixed;border-collapse:collapse;border-spacing:0;-webkit-user-select:none;user-select:none}.table-cell{text-align:center;box-sizing:initial;block-size:var(--luzmo-calendar-day-height, var(--calendar-day-height));inline-size:var(--luzmo-calendar-day-width, var(--calendar-day-width));padding:var(--luzmo-calendar-day-padding, var(--calendar-day-padding));position:relative}.table-cell:focus{outline:0}.date{box-sizing:border-box;block-size:var(--luzmo-calendar-day-height, var(--calendar-day-height));inline-size:var(--luzmo-calendar-day-width, var(--calendar-day-width));margin:var(--luzmo-calendar-day-padding, var(--calendar-day-padding));border-radius:var(--luzmo-calendar-day-border-radius, var(--calendar-day-border-radius));border:var(--luzmo-calendar-day-border-size, var(--calendar-day-border-size)) solid transparent;font-size:var(--luzmo-calendar-day-text-size, var(--calendar-day-text-size));line-height:calc(var(--luzmo-calendar-day-width, var(--calendar-day-width)) - var(--luzmo-calendar-day-border-size, var(--calendar-day-border-size)) * 2);white-space:nowrap;cursor:pointer;display:block;position:absolute;inset-block-start:0;inset-inline-start:0}.date:lang(ja),.date:lang(ko),.date:lang(zh){font-size:var(--luzmo-calendar-day-text-size-han, var(--calendar-day-text-size-han))}.date.is-disabled{cursor:default;pointer-events:none}.date.is-outsideMonth{display:none}.date:before{content:"";box-sizing:border-box;inline-size:var(--luzmo-calendar-day-width, var(--calendar-day-width));block-size:var(--luzmo-calendar-day-height, var(--calendar-day-height));border-radius:var(--luzmo-calendar-day-border-radius, var(--calendar-day-border-radius));border:var(--luzmo-calendar-day-border-size, var(--calendar-day-border-size)) solid transparent;position:absolute;inset-block-start:calc(50% - var(--luzmo-calendar-day-width, var(--calendar-day-width)) / 2);inset-inline-start:calc(50% - var(--luzmo-calendar-day-width, var(--calendar-day-width)) / 2)}.date.is-selected:not(.is-range-selection){font-weight:var(--luzmo-calendar-day-text-font-weight-selected, var(--calendar-day-text-font-weight-selected))}.date.is-selected:not(.is-range-selection):before{display:none}.date.is-today{font-weight:var(--luzmo-calendar-day-today-text-font-weight, var(--calendar-day-today-text-font-weight))}.date.is-range-selection{margin:var(--luzmo-calendar-day-padding, var(--calendar-day-padding)) 0;border-width:var(--luzmo-calendar-border-width-reset, var(--calendar-border-width-reset));line-height:var(--luzmo-calendar-day-height, var(--calendar-day-height));border-radius:var(--luzmo-calendar-border-radius-reset, var(--calendar-border-radius-reset));inline-size:calc(var(--luzmo-calendar-day-width, var(--calendar-day-width)) + var(--luzmo-calendar-day-padding, var(--calendar-day-padding)) * 2)}.date.is-range-selection.is-range-end,.date.is-range-selection.is-range-start,.date.is-range-selection.is-selection-end,.date.is-range-selection.is-selection-start{inline-size:calc(var(--luzmo-calendar-day-width, var(--calendar-day-width)) + var(--luzmo-calendar-day-padding, var(--calendar-day-padding)))}.date.is-range-selection.is-selection-end,.date.is-range-selection.is-selection-start{font-weight:var(--luzmo-calendar-day-text-font-weight-cap-selected, var(--calendar-day-text-font-weight-cap-selected))}.date.is-range-selection.is-selection-end:after,.date.is-range-selection.is-selection-start:after{block-size:var(--luzmo-calendar-day-height, var(--calendar-day-height));inline-size:var(--luzmo-calendar-day-width, var(--calendar-day-width));border-radius:var(--luzmo-calendar-day-width, var(--calendar-day-width));content:"";display:block;position:absolute;inset-block-start:0}.date.is-range-selection.is-range-start,.date.is-range-selection.is-selection-start{border-start-start-radius:var(--luzmo-calendar-day-width, var(--calendar-day-width));border-end-start-radius:var(--luzmo-calendar-day-width, var(--calendar-day-width));margin-inline-start:var(--luzmo-calendar-day-padding, var(--calendar-day-padding));padding-inline-end:var(--luzmo-calendar-day-padding, var(--calendar-day-padding))}.date.is-range-selection.is-range-start:after,.date.is-range-selection.is-range-start:before,.date.is-range-selection.is-selection-start:after,.date.is-range-selection.is-selection-start:before{inset-inline-start:0}.date.is-range-selection.is-range-end,.date.is-range-selection.is-selection-end{border-start-end-radius:var(--luzmo-calendar-day-width, var(--calendar-day-width));border-end-end-radius:var(--luzmo-calendar-day-width, var(--calendar-day-width));margin-inline-end:var(--luzmo-calendar-day-padding, var(--calendar-day-padding));padding-inline-start:var(--luzmo-calendar-day-padding, var(--calendar-day-padding))}.date.is-range-selection.is-range-end:after,.date.is-range-selection.is-range-end:before,.date.is-range-selection.is-selection-end:after,.date.is-range-selection.is-selection-end:before{inset-inline:auto 0}.date.is-range-selection.is-range-start.is-range-end,.date.is-range-selection.is-selection-end.is-range-start,.date.is-range-selection.is-selection-start.is-range-end,.date.is-range-selection.is-selection-start.is-selection-end{inline-size:var(--luzmo-calendar-day-width, var(--calendar-day-width));border-radius:var(--luzmo-calendar-day-width, var(--calendar-day-width))}.date{color:var(--highcontrast-calendar-day-text-color, var(--luzmo-calendar-day-text-color, var(--calendar-day-text-color)))}.date:active{background-color:var(--highcontrast-calendar-day-background-color-down, var(--luzmo-calendar-day-background-color-down, var(--calendar-day-background-color-down)))}.date.is-selected{color:var(--highcontrast-calendar-day-text-color-selected, var(--luzmo-calendar-day-text-color-selected, var(--calendar-day-text-color-selected)));background:var(--highcontrast-calendar-day-background-color-selected, var(--luzmo-calendar-day-background-color-selected, var(--calendar-day-background-color-selected)))}.date.is-selected:not(.is-range-selection){background:var(--highcontrast-calendar-day-background-color-cap-selected, var(--luzmo-calendar-day-background-color-cap-selected, var(--calendar-day-background-color-cap-selected)));color:var(--highcontrast-calendar-day-text-color-cap-selected, var(--luzmo-calendar-day-text-color-cap-selected, var(--calendar-day-text-color-cap-selected)));border-color:var(--highcontrast-calendar-day-border-color-cap-selected, var(--luzmo-calendar-day-border-color-cap-selected, var(--calendar-day-border-color-cap-selected)))}.date.is-today{color:var(--highcontrast-calendar-day-today-text-color, var(--luzmo-calendar-day-today-text-color, var(--calendar-day-today-text-color)));background-color:var(--highcontrast-calendar-day-today-background-color, var(--luzmo-calendar-day-today-background-color, var(--calendar-day-today-background-color)))}.date.is-today,.date.is-today:before{border-color:var(--highcontrast-calendar-day-today-border-color, var(--luzmo-calendar-day-today-border-color, var(--calendar-day-today-border-color)))}@media (hover: hover){.date:hover{color:var(--highcontrast-calendar-day-text-color-hover, var(--luzmo-calendar-day-text-color-hover, var(--calendar-day-text-color-hover)))}.date:hover:not(.is-selection-end,.is-selection-start):before{background:var(--highcontrast-calendar-day-background-color-hover, var(--luzmo-calendar-day-background-color-hover, var(--calendar-day-background-color-hover)))}.date.is-range-selection:hover:before,.date.is-selected:hover:not(.is-selection-end,.is-selection-start):before{background:var(--highcontrast-calendar-day-background-color-selected-hover, var(--luzmo-calendar-day-background-color-selected-hover, var(--calendar-day-background-color-selected-hover)))}.date.is-today.is-selected:not(.is-range-selection):hover:before{background:var(--highcontrast-calendar-day-today-background-color-selected-hover, var(--luzmo-calendar-day-today-background-color-selected-hover, var(--calendar-day-today-background-color-selected-hover)))}}.date.is-today.is-disabled{color:var(--highcontrast-calendar-day-today-text-color-disabled, var(--luzmo-calendar-day-today-text-color-disabled, var(--calendar-day-today-text-color-disabled)))}.date.is-today.is-disabled,.date.is-today.is-disabled:before{border-color:var(--highcontrast-calendar-day-today-border-color-disabled, var(--luzmo-calendar-day-today-border-color-disabled, var(--calendar-day-today-border-color-disabled)))}.table-cell:focus-within .date:not(.is-range-selection){background:var(--highcontrast-calendar-day-background-color-key-focus, var(--luzmo-calendar-day-background-color-key-focus, var(--calendar-day-background-color-key-focus)));color:var(--highcontrast-calendar-day-text-color-key-focus, var(--luzmo-calendar-day-text-color-key-focus, var(--calendar-day-text-color-key-focus)))}.table-cell:focus-within .date.is-selected:not(.is-range-selection),.table-cell:focus-within .date.is-today:not(.is-range-selection),.table-cell:focus-within .date:not(.is-range-selection),.table-cell:focus-within .date:not(.is-range-selection):active{border-color:var(--highcontrast-calendar-day-border-color-key-focus, var(--luzmo-calendar-day-border-color-key-focus, var(--calendar-day-border-color-key-focus)))}.table-cell:focus-within .date.is-selected:not(.is-range-selection),.table-cell:focus-within .date:not(.is-range-selection):active{color:var(--highcontrast-calendar-day-text-color-selected, var(--luzmo-calendar-day-text-color-selected, var(--calendar-day-text-color-selected)));background:var(--highcontrast-calendar-day-background-color-cap-selected, var(--luzmo-calendar-day-background-color-cap-selected, var(--calendar-day-background-color-cap-selected)));border-color:var(--highcontrast-calendar-day-border-color-key-focus, var(--luzmo-calendar-day-border-color-cap-selected-focus, var(--calendar-day-border-color-cap-selected-focus)))}.table-cell:focus-within .date.is-range-selection:before,.table-cell:focus-within .date.is-selected:before{background:var(--highcontrast-calendar-day-background-color-selected-hover, var(--luzmo-calendar-day-background-color-selected-hover, var(--calendar-day-background-color-selected-hover)))}.table-cell:focus-within .date:before{border-color:var(--highcontrast-calendar-day-border-color-key-focus, var(--luzmo-calendar-day-border-color-key-focus, var(--calendar-day-border-color-key-focus)))}.date.is-disabled{color:var(--highcontrast-calendar-day-text-color-disabled, var(--luzmo-calendar-day-text-color-disabled, var(--calendar-day-text-color-disabled)))}.date.is-selection-end,.date.is-selection-start{color:var(--highcontrast-calendar-day-text-color-cap-selected, var(--luzmo-calendar-day-text-color-cap-selected, var(--calendar-day-text-color-cap-selected)))}.date.is-selection-end:after,.date.is-selection-start:after{background-color:var(--highcontrast-calendar-day-background-color-selected, var(--luzmo-calendar-day-background-color-selected, var(--calendar-day-background-color-selected)))}.date.is-selection-end.is-disabled,.date.is-selection-start.is-disabled{color:var(--highcontrast-calendar-day-text-color-disabled, var(--luzmo-calendar-day-text-color-disabled, var(--calendar-day-text-color-disabled)))}@media (forced-colors: active){.nextMonth,.prevMonth{--highcontrast-calendar-button-icon-color: ButtonText}.date{--highcontrast-calendar-day-background-color-cap-selected: Highlight;--highcontrast-calendar-day-background-color-down: ButtonFace;--highcontrast-calendar-day-background-color-hover: Transparent;--highcontrast-calendar-day-background-color-key-focus: ButtonFace;--highcontrast-calendar-day-background-color-selected-hover: Transparent;--highcontrast-calendar-day-background-color-selected: Highlight;--highcontrast-calendar-day-border-color-key-focus: ButtonText;--highcontrast-calendar-day-text-color-cap-selected: HighlightText;--highcontrast-calendar-day-text-color-disabled: GrayText;--highcontrast-calendar-day-text-color-hover: ButtonText;--highcontrast-calendar-day-text-color-key-focus: ButtonText;--highcontrast-calendar-day-text-color-selected: HighlightText;--highcontrast-calendar-day-text-color: CanvasText;--highcontrast-calendar-date-text-color: CanvasText;--highcontrast-calendar-day-title-text-color: CanvasText;--highcontrast-calendar-day-today-background-color-selected-hover: Highlight;--highcontrast-calendar-day-today-border-color-disabled: GrayText;--highcontrast-calendar-day-today-border-color: ButtonText;--highcontrast-calendar-day-today-text-color-disabled: GrayText;--highcontrast-calendar-day-today-text-color: ButtonText;forced-color-adjust:none}.date.is-range-selection.is-today{color:HighlightText}.date.is-range-selection.is-selection-end:after,.date.is-range-selection.is-selection-start:after{content:none}.date.is-disabled.is-range-selection,.date.is-disabled.is-selected{background:Highlight;color:HighlightText}}:host{--calendar-background-color: var(--luzmo-background-color-white)}:host{font-family:var(--luzmo-font-family);--calendar-day-width: var(--luzmo-component-height);--calendar-day-height: var(--luzmo-component-height);--calendar-border-radius-reset: 0;--calendar-border-width-reset: 0;--calendar-day-border-size: var(--luzmo-border-width);--calendar-margin-y: calc(var(--luzmo-spacing) * 3);--calendar-margin-x: var(--luzmo-component-height);--calendar-day-padding: var(--luzmo-spacing-2);--calendar-width: calc( (var(--calendar-day-width) + var(--calendar-day-padding) * 2) * 7 );--calendar-title-text-letter-spacing: .06em;--calendar-day-title-text-font-weight: bold;--calendar-day-title-text-color: var(--luzmo-font-color-disabled);--calendar-title-height: var(--luzmo-component-height);--calendar-title-font-weight: bold;--calendar-title-text-size: var(--luzmo-font-size);--calendar-day-title-text-size: var(--luzmo-font-size);--calendar-day-text-size-han: var(--luzmo-font-size);--calendar-date-text-color: var(--luzmo-font-color);--calendar-day-text-color: var(--luzmo-font-color);--calendar-day-text-size: var(--luzmo-font-size);--calendar-day-border-radius: var(--luzmo-border-radius);--calendar-day-text-color-selected: var(--luzmo-primary-inverse-color);--calendar-day-text-color-hover: var(--luzmo-font-color-hover);--calendar-day-text-color-cap-selected: var(--luzmo-primary-inverse-color);--calendar-day-border-color-cap-selected: var(--luzmo-primary);--calendar-day-border-color-cap-selected-focus: var(--luzmo-primary-focus);--calendar-day-text-font-weight-selected: var(--bold-font-weight);--calendar-day-text-font-weight-cap-selected: var(--bold-font-weight);--calendar-day-today-text-color: var(--luzmo-primary);--calendar-day-today-background-color: var(--luzmo-background-color-hover);--calendar-day-today-text-font-weight: normal;--calendar-day-today-border-color: transparent;--calendar-day-today-text-color-disabled: var(--luzmo-font-color-disabled);--calendar-day-today-border-color-disabled: transparent;--calendar-day-text-color-disabled: var(--luzmo-font-color-disabled);--calendar-day-text-color-key-focus: var(--luzmo-primary-down);--calendar-day-background-color-cap-selected: var(--luzmo-primary);--calendar-button-icon-color: var(--luzmo-font-color)}:host:dir(rtl),:host([dir=rtl]){--logical-rotation: matrix(-1, 0, 0, 1, 0, 0)}:host([size=s]){--calendar-day-width: var(--luzmo-component-height-s);--calendar-day-height: var(--luzmo-component-height-s);--calendar-day-border-radius: var(--luzmo-border-radius-s);--calendar-title-height: var(--luzmo-component-height-s);--calendar-title-text-size: var(--luzmo-font-size-s);--calendar-day-title-text-size: var(--luzmo-font-size-s);--calendar-day-text-size-han: var(--luzmo-font-size-s);--calendar-day-text-size: var(--luzmo-font-size-s)}:host([size=l]){--calendar-day-width: var(--luzmo-component-height-l);--calendar-day-height: var(--luzmo-component-height-l);--calendar-day-border-radius: var(--luzmo-border-radius-l);--calendar-title-height: var(--luzmo-component-height-l);--calendar-title-text-size: var(--luzmo-font-size-l);--calendar-day-title-text-size: var(--luzmo-font-size-l);--calendar-day-text-size-han: var(--luzmo-font-size-l);--calendar-day-text-size: var(--luzmo-font-size-l)}:host([size=xl]){--calendar-day-width: var(--luzmo-component-height-xl);--calendar-day-height: var(--luzmo-component-height-xl);--calendar-day-border-radius: var(--luzmo-border-radius-xl);--calendar-title-height: var(--luzmo-component-height-xl);--calendar-title-text-size: var(--luzmo-font-size-xl);--calendar-day-title-text-size: var(--luzmo-font-size-xl);--calendar-day-text-size-han: var(--luzmo-font-size-xl);--calendar-day-text-size: var(--luzmo-font-size-xl)}.table-cell span[role=button]{border-radius:var(--luzmo-calendar-day-width, var(--calendar-day-width))}';
|
|
953
|
+
var wt = Object.defineProperty, zt = Object.getOwnPropertyDescriptor, s = (t, e, a, r) => {
|
|
954
|
+
for (var n = r > 1 ? void 0 : r ? zt(e, a) : e, o = t.length - 1, l; o >= 0; o--)
|
|
955
|
+
(l = t[o]) && (n = (r ? l(e, a, n) : l(n)) || n);
|
|
956
|
+
return r && n && wt(e, a, n), n;
|
|
957
|
+
};
|
|
958
|
+
const fe = 7;
|
|
959
|
+
class c extends Pe(Be, {
|
|
960
|
+
validSizes: ["s", "m", "l", "xl"],
|
|
961
|
+
noDefaultSize: !0
|
|
962
|
+
}) {
|
|
963
|
+
constructor() {
|
|
964
|
+
super(), this.disabled = !1, this.labels = {
|
|
965
|
+
previous: "Previous",
|
|
966
|
+
next: "Next",
|
|
967
|
+
today: "Today",
|
|
968
|
+
selected: "Selected"
|
|
969
|
+
}, this.currentDate = this.today, this.timeZone = ee(), this.weekdays = [], this.currentMonthDates = [], this._isDateFocusIntent = !1, this.numberFormatter = new de(this._language), this.setNumberFormatter(), this.setWeekdays(), this.setCurrentMonthDates();
|
|
970
|
+
}
|
|
971
|
+
/**
|
|
972
|
+
* The styles of the calendar
|
|
973
|
+
* @internal
|
|
974
|
+
*/
|
|
975
|
+
static get styles() {
|
|
976
|
+
return [Ae(xt)];
|
|
977
|
+
}
|
|
978
|
+
/**
|
|
979
|
+
* The language used to format the dates and weekdays.
|
|
980
|
+
* @internal
|
|
981
|
+
*/
|
|
982
|
+
get _language() {
|
|
983
|
+
try {
|
|
984
|
+
return this.language ? new Intl.Locale(this.language).language : "en";
|
|
985
|
+
} catch {
|
|
986
|
+
return "en";
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
/**
|
|
990
|
+
* The current date in the calendar
|
|
991
|
+
* @internal
|
|
992
|
+
*/
|
|
993
|
+
get today() {
|
|
994
|
+
return je(this.timeZone);
|
|
995
|
+
}
|
|
996
|
+
set isDateFocusIntent(e) {
|
|
997
|
+
this._isDateFocusIntent !== e && (this._isDateFocusIntent = e, this.requestUpdate("isDateFocusIntent", !e));
|
|
998
|
+
}
|
|
999
|
+
/**
|
|
1000
|
+
* @internal
|
|
1001
|
+
*/
|
|
1002
|
+
get isDateFocusIntent() {
|
|
1003
|
+
return this._isDateFocusIntent;
|
|
1004
|
+
}
|
|
1005
|
+
setDateFocusIntent() {
|
|
1006
|
+
this.isDateFocusIntent = !0;
|
|
1007
|
+
}
|
|
1008
|
+
resetDateFocusIntent() {
|
|
1009
|
+
this.isDateFocusIntent = !1;
|
|
1010
|
+
}
|
|
1011
|
+
connectedCallback() {
|
|
1012
|
+
super.connectedCallback(), document.addEventListener("mousedown", this.resetDateFocusIntent);
|
|
1013
|
+
}
|
|
1014
|
+
disconnectedCallback() {
|
|
1015
|
+
super.disconnectedCallback(), document.removeEventListener("mousedown", this.resetDateFocusIntent);
|
|
1016
|
+
}
|
|
1017
|
+
/**
|
|
1018
|
+
* Resets the component's value
|
|
1019
|
+
*/
|
|
1020
|
+
clear() {
|
|
1021
|
+
this._value = void 0;
|
|
1022
|
+
}
|
|
1023
|
+
willUpdate(e) {
|
|
1024
|
+
e.has("language") && (this.setNumberFormatter(), this.setWeekdays(), this.setCurrentMonthDates());
|
|
1025
|
+
const a = e.has("min"), r = e.has("max"), n = e.has("value");
|
|
1026
|
+
(a || r || n) && (this.convertToCalendarDates(), this.checkDatePropsCompliance(a || r), this.updateCurrentDate());
|
|
1027
|
+
const l = e.get("currentDate");
|
|
1028
|
+
e.has("currentDate") && (!l || !x(l, this.currentDate)) && (this.setCurrentMonthDates(), this.setAttribute("aria-label", this.monthAndYear));
|
|
1029
|
+
}
|
|
1030
|
+
updated(e) {
|
|
1031
|
+
e.has("currentDate") && this.isDateFocusIntent && this.focusCurrentDate();
|
|
1032
|
+
}
|
|
1033
|
+
/**
|
|
1034
|
+
* Focuses the tabbable day element in the calendar represented by the current date.
|
|
1035
|
+
* Useful while navigating through the calendar as the focus might be lost when the month changes.
|
|
1036
|
+
*/
|
|
1037
|
+
focusCurrentDate() {
|
|
1038
|
+
var a;
|
|
1039
|
+
const e = (a = this.shadowRoot) == null ? void 0 : a.querySelector(
|
|
1040
|
+
'td span[tabindex="0"]'
|
|
1041
|
+
);
|
|
1042
|
+
e && e.focus();
|
|
1043
|
+
}
|
|
1044
|
+
convertToCalendarDates() {
|
|
1045
|
+
this._min = this.min ? P(this.min) : void 0, this._max = this.max ? P(this.max) : void 0, this._value = this.value ? P(this.value) : void 0;
|
|
1046
|
+
const e = "AD";
|
|
1047
|
+
this._min = this._min && Y(this._min).set({ era: e }), this._max = this._max && Y(this._max).set({ era: e }), this._value = this._value && Y(this._value).set({ era: e });
|
|
1048
|
+
}
|
|
1049
|
+
/**
|
|
1050
|
+
* Validates the component's date properties (min, max and value) compliance with one another.
|
|
1051
|
+
* If the [min, max] constraint interval is invalid, both properties are reset.
|
|
1052
|
+
* If the value is not within the [min, max] (valid) interval, it is reset.
|
|
1053
|
+
*
|
|
1054
|
+
* @param checkInterval - Whether to check the [min, max] interval
|
|
1055
|
+
*/
|
|
1056
|
+
checkDatePropsCompliance(e) {
|
|
1057
|
+
e && this._min && this._max && (this._min.compare(this._max) < 0 || (console.warn && console.warn(
|
|
1058
|
+
this,
|
|
1059
|
+
`<${this.localName}> expects the 'min' to be less than 'max'. Please ensure that 'min' property's date is earlier than 'max' property's date.`
|
|
1060
|
+
), this._min = void 0, this._max = void 0)), this._value && this.isNonCompliantDate(this._value) && (console.warn && console.warn(
|
|
1061
|
+
this,
|
|
1062
|
+
`<${this.localName}> expects the preselected value to comply with the min and max constraints. Please ensure that 'value' property's date is in between the dates for the 'min' and 'max' properties.`
|
|
1063
|
+
), this._value = void 0);
|
|
1064
|
+
}
|
|
1065
|
+
updateCurrentDate() {
|
|
1066
|
+
if (this._value) {
|
|
1067
|
+
this.currentDate = this._value;
|
|
1068
|
+
return;
|
|
1069
|
+
}
|
|
1070
|
+
this.isNonCompliantDate(this.today) ? this._min ? this.currentDate = this._min : this._max && (this.currentDate = this._max) : this.currentDate = this.today;
|
|
1071
|
+
}
|
|
1072
|
+
/**
|
|
1073
|
+
* Whether the date is non-compliant with the min and max constraints
|
|
1074
|
+
*/
|
|
1075
|
+
isNonCompliantDate(e) {
|
|
1076
|
+
return !!(this._min && e.compare(this._min) < 0 || this._max && e.compare(this._max) > 0);
|
|
1077
|
+
}
|
|
1078
|
+
render() {
|
|
1079
|
+
return g` ${this.renderCalendarHeader()}${this.renderCalendarGrid()} `;
|
|
1080
|
+
}
|
|
1081
|
+
/**
|
|
1082
|
+
* The month and year of the calendar
|
|
1083
|
+
* @internal
|
|
1084
|
+
*/
|
|
1085
|
+
get monthAndYear() {
|
|
1086
|
+
return this.formatDate(this.currentDate, {
|
|
1087
|
+
month: "long",
|
|
1088
|
+
year: "numeric"
|
|
1089
|
+
});
|
|
1090
|
+
}
|
|
1091
|
+
renderCalendarHeader() {
|
|
1092
|
+
return g`
|
|
1093
|
+
<div class="header" @focusin=${this.resetDateFocusIntent}>
|
|
1094
|
+
<h2
|
|
1095
|
+
class="title"
|
|
1096
|
+
aria-live="polite"
|
|
1097
|
+
aria-atomic="true"
|
|
1098
|
+
data-test-id="calendar-title"
|
|
1099
|
+
>
|
|
1100
|
+
${this.monthAndYear}
|
|
1101
|
+
</h2>
|
|
1102
|
+
|
|
1103
|
+
<luzmo-action-button
|
|
1104
|
+
quiet
|
|
1105
|
+
size="s"
|
|
1106
|
+
label=${this.labels.previous}
|
|
1107
|
+
class="prevMonth"
|
|
1108
|
+
data-test-id="prev-btn"
|
|
1109
|
+
?disabled=${this.isPreviousMonthDisabled}
|
|
1110
|
+
@click=${this.handlePreviousMonth}
|
|
1111
|
+
>
|
|
1112
|
+
<div slot="icon">
|
|
1113
|
+
<slot name="prev-icon">
|
|
1114
|
+
<luzmo-icon
|
|
1115
|
+
block
|
|
1116
|
+
.size=${this.size}
|
|
1117
|
+
.icon=${We}
|
|
1118
|
+
></luzmo-icon>
|
|
1119
|
+
</slot>
|
|
1120
|
+
</div>
|
|
1121
|
+
</luzmo-action-button>
|
|
1122
|
+
|
|
1123
|
+
<luzmo-action-button
|
|
1124
|
+
quiet
|
|
1125
|
+
size="s"
|
|
1126
|
+
label=${this.labels.next}
|
|
1127
|
+
class="nextMonth"
|
|
1128
|
+
data-test-id="next-btn"
|
|
1129
|
+
?disabled=${this.isNextMonthDisabled}
|
|
1130
|
+
@click=${this.handleNextMonth}
|
|
1131
|
+
>
|
|
1132
|
+
<div slot="icon">
|
|
1133
|
+
<slot name="next-icon">
|
|
1134
|
+
<luzmo-icon
|
|
1135
|
+
block
|
|
1136
|
+
.size=${this.size}
|
|
1137
|
+
.icon=${Ye}
|
|
1138
|
+
></luzmo-icon>
|
|
1139
|
+
</slot>
|
|
1140
|
+
</div>
|
|
1141
|
+
</luzmo-action-button>
|
|
1142
|
+
</div>
|
|
1143
|
+
`;
|
|
1144
|
+
}
|
|
1145
|
+
/**
|
|
1146
|
+
* Whether the previous month is disabled
|
|
1147
|
+
* @internal
|
|
1148
|
+
*/
|
|
1149
|
+
get isPreviousMonthDisabled() {
|
|
1150
|
+
if (this.disabled) return !0;
|
|
1151
|
+
const e = w(this.currentDate), a = e.subtract({ months: 1 });
|
|
1152
|
+
return e.era !== a.era || p(e, a);
|
|
1153
|
+
}
|
|
1154
|
+
/**
|
|
1155
|
+
* Whether the next month is disabled
|
|
1156
|
+
* @internal
|
|
1157
|
+
*/
|
|
1158
|
+
get isNextMonthDisabled() {
|
|
1159
|
+
if (this.disabled) return !0;
|
|
1160
|
+
const e = qe(this.currentDate), a = e.add({ months: 1 });
|
|
1161
|
+
return e.era !== a.era || p(e, a);
|
|
1162
|
+
}
|
|
1163
|
+
handlePreviousMonth() {
|
|
1164
|
+
let e = w(this.currentDate).subtract({
|
|
1165
|
+
months: 1
|
|
1166
|
+
});
|
|
1167
|
+
this._value && x(e, this._value) ? e = this._value : x(e, this.today) && (e = this.today), this.currentDate = e;
|
|
1168
|
+
}
|
|
1169
|
+
handleNextMonth() {
|
|
1170
|
+
let e = w(this.currentDate).add({
|
|
1171
|
+
months: 1
|
|
1172
|
+
});
|
|
1173
|
+
this._value && x(e, this._value) ? e = this._value : x(e, this.today) && (e = this.today), this.currentDate = e;
|
|
1174
|
+
}
|
|
1175
|
+
renderCalendarGrid() {
|
|
1176
|
+
return g`
|
|
1177
|
+
<table
|
|
1178
|
+
role="grid"
|
|
1179
|
+
aria-readonly="true"
|
|
1180
|
+
aria-disabled=${this.disabled}
|
|
1181
|
+
role="presentation"
|
|
1182
|
+
class="table body"
|
|
1183
|
+
@keydown=${this.handleKeydown}
|
|
1184
|
+
>
|
|
1185
|
+
${this.renderCalendarTableHead()} ${this.renderCalendarTableBody()}
|
|
1186
|
+
</table>
|
|
1187
|
+
`;
|
|
1188
|
+
}
|
|
1189
|
+
renderCalendarTableHead() {
|
|
1190
|
+
return g`
|
|
1191
|
+
<thead role="presentation">
|
|
1192
|
+
<tr role="row">
|
|
1193
|
+
${this.renderWeekdayColumns()}
|
|
1194
|
+
</tr>
|
|
1195
|
+
</thead>
|
|
1196
|
+
`;
|
|
1197
|
+
}
|
|
1198
|
+
renderWeekdayColumns() {
|
|
1199
|
+
return this.weekdays.map((e) => this.renderWeekdayColumn(e));
|
|
1200
|
+
}
|
|
1201
|
+
renderWeekdayColumn(e) {
|
|
1202
|
+
return g`
|
|
1203
|
+
<th role="columnheader" scope="col" class="table-cell">
|
|
1204
|
+
<abbr class="dayOfWeek" title=${e.long}> ${e.narrow} </abbr>
|
|
1205
|
+
</th>
|
|
1206
|
+
`;
|
|
1207
|
+
}
|
|
1208
|
+
renderCalendarTableBody() {
|
|
1209
|
+
return g`
|
|
1210
|
+
<tbody role="presentation">
|
|
1211
|
+
${this.renderCalendarWeeks()}
|
|
1212
|
+
</tbody>
|
|
1213
|
+
`;
|
|
1214
|
+
}
|
|
1215
|
+
renderCalendarWeeks() {
|
|
1216
|
+
return this.currentMonthDates.map(
|
|
1217
|
+
(e) => g`
|
|
1218
|
+
<tr role="row">
|
|
1219
|
+
${this.renderDatesInWeek(e)}
|
|
1220
|
+
</tr>
|
|
1221
|
+
`
|
|
1222
|
+
);
|
|
1223
|
+
}
|
|
1224
|
+
renderDatesInWeek(e) {
|
|
1225
|
+
return e.map((a) => this.renderCalendarTableCell(a));
|
|
1226
|
+
}
|
|
1227
|
+
parseDateCellProperties(e) {
|
|
1228
|
+
const a = {
|
|
1229
|
+
isOutsideMonth: !1,
|
|
1230
|
+
isSelected: !1,
|
|
1231
|
+
isToday: !1,
|
|
1232
|
+
isDisabled: !1,
|
|
1233
|
+
isTabbable: !1
|
|
1234
|
+
};
|
|
1235
|
+
return a.isOutsideMonth = e.month !== this.currentDate.month, a.isOutsideMonth || (a.isDisabled = this.disabled || this.isMinLimitReached(e) || this.isMaxLimitReached(e), a.isToday = p(e, this.today), a.isDisabled) || (a.isTabbable = p(e, this.currentDate), a.isSelected = !!(this._value && p(this._value, e))), a;
|
|
1236
|
+
}
|
|
1237
|
+
renderCalendarTableCell(e) {
|
|
1238
|
+
const { isOutsideMonth: a, isSelected: r, isToday: n, isDisabled: o, isTabbable: l } = this.parseDateCellProperties(e), d = {
|
|
1239
|
+
date: !0,
|
|
1240
|
+
"is-outsideMonth": a,
|
|
1241
|
+
"is-selected": r,
|
|
1242
|
+
"is-today": n,
|
|
1243
|
+
"is-disabled": o
|
|
1244
|
+
};
|
|
1245
|
+
let i = "";
|
|
1246
|
+
n ? i = `${this.labels.today}, ` : r && (i = `${this.labels.selected}, `);
|
|
1247
|
+
const f = i + this.formatDate(e, {
|
|
1248
|
+
weekday: "long",
|
|
1249
|
+
year: "numeric",
|
|
1250
|
+
month: "long",
|
|
1251
|
+
day: "numeric"
|
|
1252
|
+
});
|
|
1253
|
+
return g`
|
|
1254
|
+
<td role="gridcell" class="table-cell">
|
|
1255
|
+
<span
|
|
1256
|
+
role="button"
|
|
1257
|
+
tabindex=${Oe(
|
|
1258
|
+
a ? void 0 : l ? "0" : "-1"
|
|
1259
|
+
)}
|
|
1260
|
+
aria-label=${f}
|
|
1261
|
+
aria-disabled=${a || o}
|
|
1262
|
+
data-value=${e.toString()}
|
|
1263
|
+
@mousedown=${this.handleDaySelect}
|
|
1264
|
+
>
|
|
1265
|
+
<span role="presentation" class=${Re(d)}>
|
|
1266
|
+
${this.formatNumber(e.day)}
|
|
1267
|
+
</span>
|
|
1268
|
+
</span>
|
|
1269
|
+
</td>
|
|
1270
|
+
`;
|
|
1271
|
+
}
|
|
1272
|
+
handleKeydown(e) {
|
|
1273
|
+
switch (this.setDateFocusIntent(), e.code) {
|
|
1274
|
+
case "ArrowLeft": {
|
|
1275
|
+
this.moveToPreviousDay();
|
|
1276
|
+
break;
|
|
1277
|
+
}
|
|
1278
|
+
case "ArrowDown": {
|
|
1279
|
+
this.moveToNextWeek();
|
|
1280
|
+
break;
|
|
1281
|
+
}
|
|
1282
|
+
case "ArrowRight": {
|
|
1283
|
+
this.moveToNextDay();
|
|
1284
|
+
break;
|
|
1285
|
+
}
|
|
1286
|
+
case "ArrowUp": {
|
|
1287
|
+
this.moveToPreviousWeek();
|
|
1288
|
+
break;
|
|
1289
|
+
}
|
|
1290
|
+
case "Space":
|
|
1291
|
+
case "Enter": {
|
|
1292
|
+
this.handleDaySelect(e);
|
|
1293
|
+
break;
|
|
1294
|
+
}
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
handleDaySelect(e) {
|
|
1298
|
+
if (this.disabled) {
|
|
1299
|
+
e.preventDefault();
|
|
1300
|
+
return;
|
|
1301
|
+
}
|
|
1302
|
+
const a = e.target.closest(
|
|
1303
|
+
'span[role="button"]'
|
|
1304
|
+
), r = a && a.dataset.value;
|
|
1305
|
+
if (!r) return;
|
|
1306
|
+
const n = P(r);
|
|
1307
|
+
if (this._value && p(this._value, n) || this.isMinLimitReached(n) || this.isMaxLimitReached(n)) {
|
|
1308
|
+
e.preventDefault();
|
|
1309
|
+
return;
|
|
1310
|
+
}
|
|
1311
|
+
this._value = n, this.value = n.toString(), this.dispatchEvent(
|
|
1312
|
+
new CustomEvent("change", {
|
|
1313
|
+
bubbles: !0,
|
|
1314
|
+
composed: !0,
|
|
1315
|
+
cancelable: !0,
|
|
1316
|
+
detail: {
|
|
1317
|
+
value: this.value
|
|
1318
|
+
}
|
|
1319
|
+
})
|
|
1320
|
+
);
|
|
1321
|
+
}
|
|
1322
|
+
moveToPreviousDay() {
|
|
1323
|
+
const e = this.currentDate.subtract({ days: 1 });
|
|
1324
|
+
this.canMoveBackToDate(e) && (this.currentDate = e);
|
|
1325
|
+
}
|
|
1326
|
+
moveToNextDay() {
|
|
1327
|
+
const e = this.currentDate.add({ days: 1 });
|
|
1328
|
+
this.canMoveForwardToDate(e) && (this.currentDate = e);
|
|
1329
|
+
}
|
|
1330
|
+
moveToPreviousWeek() {
|
|
1331
|
+
const e = this.currentDate.subtract({ weeks: 1 });
|
|
1332
|
+
if (this.canMoveBackToDate(e)) {
|
|
1333
|
+
this.currentDate = e;
|
|
1334
|
+
return;
|
|
1335
|
+
}
|
|
1336
|
+
let a = e.add({ days: 1 });
|
|
1337
|
+
for (; !this.canMoveBackToDate(a); )
|
|
1338
|
+
a = a.add({ days: 1 });
|
|
1339
|
+
this.currentDate = a;
|
|
1340
|
+
}
|
|
1341
|
+
moveToNextWeek() {
|
|
1342
|
+
const e = this.currentDate.add({ weeks: 1 });
|
|
1343
|
+
if (this.canMoveForwardToDate(e)) {
|
|
1344
|
+
this.currentDate = e;
|
|
1345
|
+
return;
|
|
1346
|
+
}
|
|
1347
|
+
let a = e.subtract({ days: 1 });
|
|
1348
|
+
for (; !this.canMoveForwardToDate(a); )
|
|
1349
|
+
a = a.subtract({ days: 1 });
|
|
1350
|
+
this.currentDate = a;
|
|
1351
|
+
}
|
|
1352
|
+
canMoveBackToDate(e) {
|
|
1353
|
+
return this.isMinLimitReached(e) ? !1 : x(this.currentDate, e) || !this.isPreviousMonthDisabled;
|
|
1354
|
+
}
|
|
1355
|
+
canMoveForwardToDate(e) {
|
|
1356
|
+
return this.isMaxLimitReached(e) ? !1 : x(this.currentDate, e) || !this.isNextMonthDisabled;
|
|
1357
|
+
}
|
|
1358
|
+
/**
|
|
1359
|
+
* Defines the array with data for the days of the week, starting on the first day of the week according to the
|
|
1360
|
+
* defined location (Sunday, Monday, etc.)
|
|
1361
|
+
*/
|
|
1362
|
+
setWeekdays() {
|
|
1363
|
+
const e = ce(this.currentDate, this._language);
|
|
1364
|
+
this.weekdays = [...Array.from({ length: fe }).keys()].map(
|
|
1365
|
+
(a) => {
|
|
1366
|
+
const r = e.add({ days: a });
|
|
1367
|
+
return {
|
|
1368
|
+
narrow: this.formatDate(r, { weekday: "narrow" }),
|
|
1369
|
+
long: this.formatDate(r, { weekday: "long" })
|
|
1370
|
+
};
|
|
1371
|
+
}
|
|
1372
|
+
);
|
|
1373
|
+
}
|
|
1374
|
+
/**
|
|
1375
|
+
* Defines the 2D-array with the dates of the current month
|
|
1376
|
+
*/
|
|
1377
|
+
setCurrentMonthDates() {
|
|
1378
|
+
const e = Ve(this.currentDate, this._language), a = Array.from({
|
|
1379
|
+
length: e
|
|
1380
|
+
});
|
|
1381
|
+
for (const r of Array.from({ length: e }).keys())
|
|
1382
|
+
a[r] = this.getDatesInWeek(
|
|
1383
|
+
this.currentDate,
|
|
1384
|
+
r
|
|
1385
|
+
);
|
|
1386
|
+
this.currentMonthDates = a;
|
|
1387
|
+
}
|
|
1388
|
+
/**
|
|
1389
|
+
* Returns an array with all days of the week in a specific month, corresponding to the given index,
|
|
1390
|
+
* starting with the first day of the week according to the language
|
|
1391
|
+
*
|
|
1392
|
+
* @param weekIndex - The index of the week
|
|
1393
|
+
*/
|
|
1394
|
+
getDatesInWeek(e, a) {
|
|
1395
|
+
const r = [];
|
|
1396
|
+
let n = ce(
|
|
1397
|
+
w(e).add({
|
|
1398
|
+
weeks: a
|
|
1399
|
+
}),
|
|
1400
|
+
this._language
|
|
1401
|
+
);
|
|
1402
|
+
for (; r.length < fe; ) {
|
|
1403
|
+
r.push(n);
|
|
1404
|
+
const o = n.add({ days: 1 });
|
|
1405
|
+
if (p(n, o)) break;
|
|
1406
|
+
n = o;
|
|
1407
|
+
}
|
|
1408
|
+
return r;
|
|
1409
|
+
}
|
|
1410
|
+
isMinLimitReached(e) {
|
|
1411
|
+
return !!(this._min && e.compare(this._min) < 0);
|
|
1412
|
+
}
|
|
1413
|
+
isMaxLimitReached(e) {
|
|
1414
|
+
return !!(this._max && e.compare(this._max) > 0);
|
|
1415
|
+
}
|
|
1416
|
+
/**
|
|
1417
|
+
* Formats a `CalendarDate` object using the current language and the provided date format options
|
|
1418
|
+
*
|
|
1419
|
+
* @param calendarDate - The `CalendarDate` object that will be formatted
|
|
1420
|
+
* @param options - All date format options that will be used by the formatter
|
|
1421
|
+
*/
|
|
1422
|
+
formatDate(e, a) {
|
|
1423
|
+
return new vt(this._language, a).format(
|
|
1424
|
+
e.toDate(this.timeZone)
|
|
1425
|
+
);
|
|
1426
|
+
}
|
|
1427
|
+
setNumberFormatter() {
|
|
1428
|
+
this.numberFormatter = new de(this._language);
|
|
1429
|
+
}
|
|
1430
|
+
formatNumber(e) {
|
|
1431
|
+
return this.numberFormatter.format(e);
|
|
1432
|
+
}
|
|
1433
|
+
}
|
|
1434
|
+
s([
|
|
1435
|
+
F({ type: String })
|
|
1436
|
+
], c.prototype, "value", 2);
|
|
1437
|
+
s([
|
|
1438
|
+
F({ type: String })
|
|
1439
|
+
], c.prototype, "min", 2);
|
|
1440
|
+
s([
|
|
1441
|
+
F({ type: String })
|
|
1442
|
+
], c.prototype, "max", 2);
|
|
1443
|
+
s([
|
|
1444
|
+
F({ type: Boolean, reflect: !0 })
|
|
1445
|
+
], c.prototype, "disabled", 2);
|
|
1446
|
+
s([
|
|
1447
|
+
F({ type: String, reflect: !0 })
|
|
1448
|
+
], c.prototype, "language", 2);
|
|
1449
|
+
s([
|
|
1450
|
+
F({ type: Object })
|
|
1451
|
+
], c.prototype, "labels", 2);
|
|
1452
|
+
s([
|
|
1453
|
+
D()
|
|
1454
|
+
], c.prototype, "currentDate", 2);
|
|
1455
|
+
s([
|
|
1456
|
+
D()
|
|
1457
|
+
], c.prototype, "_value", 2);
|
|
1458
|
+
s([
|
|
1459
|
+
D()
|
|
1460
|
+
], c.prototype, "_min", 2);
|
|
1461
|
+
s([
|
|
1462
|
+
D()
|
|
1463
|
+
], c.prototype, "_max", 2);
|
|
1464
|
+
s([
|
|
1465
|
+
D()
|
|
1466
|
+
], c.prototype, "weekdays", 2);
|
|
1467
|
+
s([
|
|
1468
|
+
D()
|
|
1469
|
+
], c.prototype, "currentMonthDates", 2);
|
|
1470
|
+
s([
|
|
1471
|
+
D()
|
|
1472
|
+
], c.prototype, "isDateFocusIntent", 1);
|
|
1473
|
+
customElements.get("luzmo-calendar") || customElements.define("luzmo-calendar", c);
|
|
1474
|
+
export {
|
|
1475
|
+
E as $,
|
|
1476
|
+
c as L,
|
|
1477
|
+
N as a,
|
|
1478
|
+
S as b,
|
|
1479
|
+
Bt as c,
|
|
1480
|
+
Ft as d,
|
|
1481
|
+
ee as e,
|
|
1482
|
+
Ze as f,
|
|
1483
|
+
Xe as g,
|
|
1484
|
+
At as h,
|
|
1485
|
+
_ as i,
|
|
1486
|
+
Y as j,
|
|
1487
|
+
P as k,
|
|
1488
|
+
Se as l,
|
|
1489
|
+
vt as m
|
|
1490
|
+
};
|