@vygruppen/spor-react 4.1.0 → 4.1.1

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/index.js CHANGED
@@ -1128,1757 +1128,6 @@ var init_card = __esm({
1128
1128
  init_Card();
1129
1129
  }
1130
1130
  });
1131
- function $458b0a5536c1a7cf$export$40bfa8c7b0832715(value, defaultValue, onChange) {
1132
- let [stateValue, setStateValue] = (React69.useState)(value || defaultValue);
1133
- let isControlledRef = (React69.useRef)(value !== void 0);
1134
- let isControlled = value !== void 0;
1135
- (React69.useEffect)(() => {
1136
- let wasControlled = isControlledRef.current;
1137
- if (wasControlled !== isControlled)
1138
- console.warn(`WARN: A component changed from ${wasControlled ? "controlled" : "uncontrolled"} to ${isControlled ? "controlled" : "uncontrolled"}.`);
1139
- isControlledRef.current = isControlled;
1140
- }, [
1141
- isControlled
1142
- ]);
1143
- let currentValue = isControlled ? value : stateValue;
1144
- let setValue = (React69.useCallback)((value2, ...args) => {
1145
- let onChangeCaller = (value3, ...onChangeArgs) => {
1146
- if (onChange) {
1147
- if (!Object.is(currentValue, value3))
1148
- onChange(value3, ...onChangeArgs);
1149
- }
1150
- if (!isControlled)
1151
- currentValue = value3;
1152
- };
1153
- if (typeof value2 === "function") {
1154
- console.warn("We can not support a function callback. See Github Issues for details https://github.com/adobe/react-spectrum/issues/2320");
1155
- let updateFunction = (oldValue, ...functionArgs) => {
1156
- let interceptedValue = value2(isControlled ? currentValue : oldValue, ...functionArgs);
1157
- onChangeCaller(interceptedValue, ...args);
1158
- if (!isControlled)
1159
- return interceptedValue;
1160
- return oldValue;
1161
- };
1162
- setStateValue(updateFunction);
1163
- } else {
1164
- if (!isControlled)
1165
- setStateValue(value2);
1166
- onChangeCaller(value2, ...args);
1167
- }
1168
- }, [
1169
- isControlled,
1170
- currentValue,
1171
- onChange
1172
- ]);
1173
- return [
1174
- currentValue,
1175
- setValue
1176
- ];
1177
- }
1178
- var init_import = __esm({
1179
- "../../node_modules/@react-stately/utils/dist/import.mjs"() {
1180
- }
1181
- });
1182
- function $fc909762b330b746$export$61c6a8c84e605fb6(props) {
1183
- let [isOpen, setOpen] = ($458b0a5536c1a7cf$export$40bfa8c7b0832715)(props.isOpen, props.defaultOpen || false, props.onOpenChange);
1184
- const open = (React69.useCallback)(() => {
1185
- setOpen(true);
1186
- }, [
1187
- setOpen
1188
- ]);
1189
- const close = (React69.useCallback)(() => {
1190
- setOpen(false);
1191
- }, [
1192
- setOpen
1193
- ]);
1194
- const toggle = (React69.useCallback)(() => {
1195
- setOpen(!isOpen);
1196
- }, [
1197
- setOpen,
1198
- isOpen
1199
- ]);
1200
- return {
1201
- isOpen,
1202
- setOpen,
1203
- open,
1204
- close,
1205
- toggle
1206
- };
1207
- }
1208
- var init_import2 = __esm({
1209
- "../../node_modules/@react-stately/overlays/dist/import.mjs"() {
1210
- init_import();
1211
- }
1212
- });
1213
-
1214
- // ../../node_modules/@internationalized/string/dist/import.mjs
1215
- function $5b160d28a433310d$var$getStringsForLocale(locale, strings, defaultLocale = "en-US") {
1216
- if (strings[locale])
1217
- return strings[locale];
1218
- let language = $5b160d28a433310d$var$getLanguage(locale);
1219
- if (strings[language])
1220
- return strings[language];
1221
- for (let key in strings) {
1222
- if (key.startsWith(language + "-"))
1223
- return strings[key];
1224
- }
1225
- return strings[defaultLocale];
1226
- }
1227
- function $5b160d28a433310d$var$getLanguage(locale) {
1228
- if (Intl.Locale)
1229
- return new Intl.Locale(locale).language;
1230
- return locale.split("-")[0];
1231
- }
1232
- var $5b160d28a433310d$export$c17fa47878dc55b6;
1233
- var init_import3 = __esm({
1234
- "../../node_modules/@internationalized/string/dist/import.mjs"() {
1235
- $5b160d28a433310d$export$c17fa47878dc55b6 = class {
1236
- /** Returns a localized string for the given key and locale. */
1237
- getStringForLocale(key, locale) {
1238
- let strings = this.strings[locale];
1239
- if (!strings) {
1240
- strings = $5b160d28a433310d$var$getStringsForLocale(locale, this.strings, this.defaultLocale);
1241
- this.strings[locale] = strings;
1242
- }
1243
- let string = strings[key];
1244
- if (!string)
1245
- throw new Error(`Could not find intl message ${key} in ${locale} locale`);
1246
- return string;
1247
- }
1248
- constructor(messages, defaultLocale = "en-US") {
1249
- this.strings = {
1250
- ...messages
1251
- };
1252
- this.defaultLocale = defaultLocale;
1253
- }
1254
- };
1255
- }
1256
- });
1257
- function $35a22f14a1f04b11$export$eac50920cf2fd59a(value, minValue, maxValue) {
1258
- return value != null && (minValue != null && value.compare(minValue) < 0 || maxValue != null && value.compare(maxValue) > 0);
1259
- }
1260
- function $35a22f14a1f04b11$export$7e319ea407e63bc0(fieldOptions, options) {
1261
- let defaultFieldOptions = options.shouldForceLeadingZeros ? $35a22f14a1f04b11$var$TWO_DIGIT_FIELD_OPTIONS : $35a22f14a1f04b11$var$DEFAULT_FIELD_OPTIONS;
1262
- fieldOptions = {
1263
- ...defaultFieldOptions,
1264
- ...fieldOptions
1265
- };
1266
- let granularity = options.granularity || "minute";
1267
- let keys = Object.keys(fieldOptions);
1268
- var _options_maxGranularity;
1269
- let startIdx = keys.indexOf((_options_maxGranularity = options.maxGranularity) !== null && _options_maxGranularity !== void 0 ? _options_maxGranularity : "year");
1270
- if (startIdx < 0)
1271
- startIdx = 0;
1272
- let endIdx = keys.indexOf(granularity);
1273
- if (endIdx < 0)
1274
- endIdx = 2;
1275
- if (startIdx > endIdx)
1276
- throw new Error("maxGranularity must be greater than granularity");
1277
- let opts = keys.slice(startIdx, endIdx + 1).reduce((opts2, key) => {
1278
- opts2[key] = fieldOptions[key];
1279
- return opts2;
1280
- }, {});
1281
- if (options.hourCycle != null)
1282
- opts.hour12 = options.hourCycle === 12;
1283
- opts.timeZone = options.timeZone || "UTC";
1284
- let hasTime = granularity === "hour" || granularity === "minute" || granularity === "second";
1285
- if (hasTime && options.timeZone && !options.hideTimeZone)
1286
- opts.timeZoneName = "short";
1287
- if (options.showEra && startIdx === 0)
1288
- opts.era = "short";
1289
- return opts;
1290
- }
1291
- function $35a22f14a1f04b11$export$c5221a78ef73c5e9(placeholderValue) {
1292
- if (placeholderValue && "hour" in placeholderValue)
1293
- return placeholderValue;
1294
- return new (date.Time)();
1295
- }
1296
- function $35a22f14a1f04b11$export$61a490a80c552550(value, calendar) {
1297
- if (value === null)
1298
- return null;
1299
- if (!value)
1300
- return void 0;
1301
- return (date.toCalendar)(value, calendar);
1302
- }
1303
- function $35a22f14a1f04b11$export$66aa2b09de4b1ea5(placeholderValue, granularity, calendar, timeZone) {
1304
- if (placeholderValue)
1305
- return $35a22f14a1f04b11$export$61a490a80c552550(placeholderValue, calendar);
1306
- let date$1 = (date.toCalendar)((date.now)(timeZone).set({
1307
- hour: 0,
1308
- minute: 0,
1309
- second: 0,
1310
- millisecond: 0
1311
- }), calendar);
1312
- if (granularity === "year" || granularity === "month" || granularity === "day")
1313
- return (date.toCalendarDate)(date$1);
1314
- if (!timeZone)
1315
- return (date.toCalendarDateTime)(date$1);
1316
- return date$1;
1317
- }
1318
- function $35a22f14a1f04b11$export$2440da353cedad43(v, granularity) {
1319
- let defaultTimeZone = v && "timeZone" in v ? v.timeZone : void 0;
1320
- let defaultGranularity = v && "minute" in v ? "minute" : "day";
1321
- if (v && granularity && !(granularity in v))
1322
- throw new Error("Invalid granularity " + granularity + " for value " + v.toString());
1323
- let [lastValue, setLastValue] = (React69.useState)([
1324
- defaultGranularity,
1325
- defaultTimeZone
1326
- ]);
1327
- if (v && (lastValue[0] !== defaultGranularity || lastValue[1] !== defaultTimeZone))
1328
- setLastValue([
1329
- defaultGranularity,
1330
- defaultTimeZone
1331
- ]);
1332
- if (!granularity)
1333
- granularity = v ? defaultGranularity : lastValue[0];
1334
- let timeZone = v ? defaultTimeZone : lastValue[1];
1335
- return [
1336
- granularity,
1337
- timeZone
1338
- ];
1339
- }
1340
- function $ab5bf3f618090389$export$87194bb378cc3ac2(props) {
1341
- var _props_isDateUnavailable;
1342
- let overlayState = ($fc909762b330b746$export$61c6a8c84e605fb6)(props);
1343
- let [value, setValue] = ($458b0a5536c1a7cf$export$40bfa8c7b0832715)(props.value, props.defaultValue || null, props.onChange);
1344
- let v = value || props.placeholderValue;
1345
- let [granularity, defaultTimeZone] = ($35a22f14a1f04b11$export$2440da353cedad43)(v, props.granularity);
1346
- let dateValue = value != null ? value.toDate(defaultTimeZone !== null && defaultTimeZone !== void 0 ? defaultTimeZone : "UTC") : null;
1347
- let hasTime = granularity === "hour" || granularity === "minute" || granularity === "second";
1348
- var _props_shouldCloseOnSelect;
1349
- let shouldCloseOnSelect = (_props_shouldCloseOnSelect = props.shouldCloseOnSelect) !== null && _props_shouldCloseOnSelect !== void 0 ? _props_shouldCloseOnSelect : true;
1350
- let [selectedDate, setSelectedDate] = (React69.useState)(null);
1351
- let [selectedTime, setSelectedTime] = (React69.useState)(null);
1352
- if (value) {
1353
- selectedDate = value;
1354
- if ("hour" in value)
1355
- selectedTime = value;
1356
- }
1357
- if (v && !(granularity in v))
1358
- throw new Error("Invalid granularity " + granularity + " for value " + v.toString());
1359
- let commitValue = (date$1, time) => {
1360
- setValue("timeZone" in time ? time.set((date.toCalendarDate)(date$1)) : (date.toCalendarDateTime)(date$1, time));
1361
- setSelectedDate(null);
1362
- setSelectedTime(null);
1363
- };
1364
- let selectDate = (newValue) => {
1365
- let shouldClose = typeof shouldCloseOnSelect === "function" ? shouldCloseOnSelect() : shouldCloseOnSelect;
1366
- if (hasTime) {
1367
- if (selectedTime || shouldClose)
1368
- commitValue(newValue, selectedTime || ($35a22f14a1f04b11$export$c5221a78ef73c5e9)(props.placeholderValue));
1369
- else
1370
- setSelectedDate(newValue);
1371
- } else
1372
- setValue(newValue);
1373
- if (shouldClose)
1374
- overlayState.setOpen(false);
1375
- };
1376
- let selectTime = (newValue) => {
1377
- if (selectedDate && newValue)
1378
- commitValue(selectedDate, newValue);
1379
- else
1380
- setSelectedTime(newValue);
1381
- };
1382
- let validationState = props.validationState || (($35a22f14a1f04b11$export$eac50920cf2fd59a)(value, props.minValue, props.maxValue) ? "invalid" : null) || (value && ((_props_isDateUnavailable = props.isDateUnavailable) === null || _props_isDateUnavailable === void 0 ? void 0 : _props_isDateUnavailable.call(props, value)) ? "invalid" : null);
1383
- return {
1384
- value,
1385
- setValue,
1386
- dateValue: selectedDate,
1387
- timeValue: selectedTime,
1388
- setDateValue: selectDate,
1389
- setTimeValue: selectTime,
1390
- granularity,
1391
- hasTime,
1392
- ...overlayState,
1393
- setOpen(isOpen) {
1394
- if (!isOpen && !value && selectedDate && hasTime)
1395
- commitValue(selectedDate, selectedTime || ($35a22f14a1f04b11$export$c5221a78ef73c5e9)(props.placeholderValue));
1396
- overlayState.setOpen(isOpen);
1397
- },
1398
- validationState,
1399
- formatValue(locale, fieldOptions) {
1400
- if (!dateValue)
1401
- return "";
1402
- let formatOptions = ($35a22f14a1f04b11$export$7e319ea407e63bc0)(fieldOptions, {
1403
- granularity,
1404
- timeZone: defaultTimeZone,
1405
- hideTimeZone: props.hideTimeZone,
1406
- hourCycle: props.hourCycle,
1407
- showEra: value.calendar.identifier === "gregory" && value.era === "BC"
1408
- });
1409
- let formatter = new (date.DateFormatter)(locale, formatOptions);
1410
- return formatter.format(dateValue);
1411
- }
1412
- };
1413
- }
1414
- function $3e3ed55ab2966714$export$d3f5c5e0a5023fa0(field, value, locale) {
1415
- if (field === "era" || field === "dayPeriod")
1416
- return value;
1417
- if (field === "year" || field === "month" || field === "day")
1418
- return $3e3ed55ab2966714$var$placeholders.getStringForLocale(field, locale);
1419
- return "\u2013\u2013";
1420
- }
1421
- function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
1422
- let { locale, createCalendar: createCalendar4, hideTimeZone, isDisabled, isReadOnly, isRequired } = props;
1423
- let v = props.value || props.defaultValue || props.placeholderValue;
1424
- let [granularity, defaultTimeZone] = ($35a22f14a1f04b11$export$2440da353cedad43)(v, props.granularity);
1425
- let timeZone = defaultTimeZone || "UTC";
1426
- if (v && !(granularity in v))
1427
- throw new Error("Invalid granularity " + granularity + " for value " + v.toString());
1428
- let defaultFormatter = (React69.useMemo)(() => new (date.DateFormatter)(locale), [
1429
- locale
1430
- ]);
1431
- let calendar = (React69.useMemo)(() => createCalendar4(defaultFormatter.resolvedOptions().calendar), [
1432
- createCalendar4,
1433
- defaultFormatter
1434
- ]);
1435
- let [value, setDate] = ($458b0a5536c1a7cf$export$40bfa8c7b0832715)(props.value, props.defaultValue, props.onChange);
1436
- let calendarValue = (React69.useMemo)(() => ($35a22f14a1f04b11$export$61a490a80c552550)(value, calendar), [
1437
- value,
1438
- calendar
1439
- ]);
1440
- let [placeholderDate, setPlaceholderDate] = (React69.useState)(() => ($35a22f14a1f04b11$export$66aa2b09de4b1ea5)(props.placeholderValue, granularity, calendar, defaultTimeZone));
1441
- let val = calendarValue || placeholderDate;
1442
- let showEra = calendar.identifier === "gregory" && val.era === "BC";
1443
- var _props_maxGranularity;
1444
- let formatOpts = (React69.useMemo)(() => ({
1445
- granularity,
1446
- maxGranularity: (_props_maxGranularity = props.maxGranularity) !== null && _props_maxGranularity !== void 0 ? _props_maxGranularity : "year",
1447
- timeZone: defaultTimeZone,
1448
- hideTimeZone,
1449
- hourCycle: props.hourCycle,
1450
- showEra,
1451
- shouldForceLeadingZeros: props.shouldForceLeadingZeros
1452
- }), [
1453
- props.maxGranularity,
1454
- granularity,
1455
- props.hourCycle,
1456
- props.shouldForceLeadingZeros,
1457
- defaultTimeZone,
1458
- hideTimeZone,
1459
- showEra
1460
- ]);
1461
- let opts = (React69.useMemo)(() => ($35a22f14a1f04b11$export$7e319ea407e63bc0)({}, formatOpts), [
1462
- formatOpts
1463
- ]);
1464
- let dateFormatter = (React69.useMemo)(() => new (date.DateFormatter)(locale, opts), [
1465
- locale,
1466
- opts
1467
- ]);
1468
- let resolvedOptions = (React69.useMemo)(() => dateFormatter.resolvedOptions(), [
1469
- dateFormatter
1470
- ]);
1471
- let allSegments = (React69.useMemo)(() => dateFormatter.formatToParts(/* @__PURE__ */ new Date()).filter((seg) => $3c0fc76039f1c516$var$EDITABLE_SEGMENTS[seg.type]).reduce((p, seg) => (p[seg.type] = true, p), {}), [
1472
- dateFormatter
1473
- ]);
1474
- let [validSegments, setValidSegments] = (React69.useState)(() => props.value || props.defaultValue ? {
1475
- ...allSegments
1476
- } : {});
1477
- let clearedSegment = (React69.useRef)();
1478
- let lastCalendarIdentifier = (React69.useRef)(calendar.identifier);
1479
- (React69.useEffect)(() => {
1480
- if (calendar.identifier !== lastCalendarIdentifier.current) {
1481
- lastCalendarIdentifier.current = calendar.identifier;
1482
- setPlaceholderDate((placeholder) => Object.keys(validSegments).length > 0 ? (date.toCalendar)(placeholder, calendar) : ($35a22f14a1f04b11$export$66aa2b09de4b1ea5)(props.placeholderValue, granularity, calendar, defaultTimeZone));
1483
- }
1484
- }, [
1485
- calendar,
1486
- granularity,
1487
- validSegments,
1488
- defaultTimeZone,
1489
- props.placeholderValue
1490
- ]);
1491
- if (value && Object.keys(validSegments).length < Object.keys(allSegments).length) {
1492
- validSegments = {
1493
- ...allSegments
1494
- };
1495
- setValidSegments(validSegments);
1496
- }
1497
- if (value == null && Object.keys(validSegments).length === Object.keys(allSegments).length) {
1498
- validSegments = {};
1499
- setValidSegments(validSegments);
1500
- setPlaceholderDate(($35a22f14a1f04b11$export$66aa2b09de4b1ea5)(props.placeholderValue, granularity, calendar, defaultTimeZone));
1501
- }
1502
- let displayValue = calendarValue && Object.keys(validSegments).length >= Object.keys(allSegments).length ? calendarValue : placeholderDate;
1503
- let setValue = (newValue) => {
1504
- if (props.isDisabled || props.isReadOnly)
1505
- return;
1506
- let validKeys = Object.keys(validSegments);
1507
- let allKeys = Object.keys(allSegments);
1508
- if (newValue == null) {
1509
- setDate(null);
1510
- setPlaceholderDate(($35a22f14a1f04b11$export$66aa2b09de4b1ea5)(props.placeholderValue, granularity, calendar, defaultTimeZone));
1511
- setValidSegments({});
1512
- } else if (validKeys.length >= allKeys.length || validKeys.length === allKeys.length - 1 && allSegments.dayPeriod && !validSegments.dayPeriod && clearedSegment.current !== "dayPeriod") {
1513
- newValue = (date.toCalendar)(newValue, (v === null || v === void 0 ? void 0 : v.calendar) || new (date.GregorianCalendar)());
1514
- setDate(newValue);
1515
- } else
1516
- setPlaceholderDate(newValue);
1517
- clearedSegment.current = null;
1518
- };
1519
- let dateValue = (React69.useMemo)(() => displayValue.toDate(timeZone), [
1520
- displayValue,
1521
- timeZone
1522
- ]);
1523
- let segments = (React69.useMemo)(() => dateFormatter.formatToParts(dateValue).map((segment) => {
1524
- let isEditable = $3c0fc76039f1c516$var$EDITABLE_SEGMENTS[segment.type];
1525
- if (segment.type === "era" && calendar.getEras().length === 1)
1526
- isEditable = false;
1527
- let isPlaceholder = $3c0fc76039f1c516$var$EDITABLE_SEGMENTS[segment.type] && !validSegments[segment.type];
1528
- let placeholder = $3c0fc76039f1c516$var$EDITABLE_SEGMENTS[segment.type] ? ($3e3ed55ab2966714$export$d3f5c5e0a5023fa0)(segment.type, segment.value, locale) : null;
1529
- return {
1530
- type: $3c0fc76039f1c516$var$TYPE_MAPPING[segment.type] || segment.type,
1531
- text: isPlaceholder ? placeholder : segment.value,
1532
- ...$3c0fc76039f1c516$var$getSegmentLimits(displayValue, segment.type, resolvedOptions),
1533
- isPlaceholder,
1534
- placeholder,
1535
- isEditable
1536
- };
1537
- }), [
1538
- dateValue,
1539
- validSegments,
1540
- dateFormatter,
1541
- resolvedOptions,
1542
- displayValue,
1543
- calendar,
1544
- locale
1545
- ]);
1546
- if (allSegments.era && validSegments.year && !validSegments.era) {
1547
- validSegments.era = true;
1548
- setValidSegments({
1549
- ...validSegments
1550
- });
1551
- } else if (!allSegments.era && validSegments.era) {
1552
- delete validSegments.era;
1553
- setValidSegments({
1554
- ...validSegments
1555
- });
1556
- }
1557
- let markValid = (part) => {
1558
- validSegments[part] = true;
1559
- if (part === "year" && allSegments.era)
1560
- validSegments.era = true;
1561
- setValidSegments({
1562
- ...validSegments
1563
- });
1564
- };
1565
- let adjustSegment = (type, amount) => {
1566
- if (!validSegments[type]) {
1567
- markValid(type);
1568
- let validKeys = Object.keys(validSegments);
1569
- let allKeys = Object.keys(allSegments);
1570
- if (validKeys.length >= allKeys.length || validKeys.length === allKeys.length - 1 && allSegments.dayPeriod && !validSegments.dayPeriod)
1571
- setValue(displayValue);
1572
- } else
1573
- setValue($3c0fc76039f1c516$var$addSegment(displayValue, type, amount, resolvedOptions));
1574
- };
1575
- let validationState = props.validationState || (($35a22f14a1f04b11$export$eac50920cf2fd59a)(calendarValue, props.minValue, props.maxValue) ? "invalid" : null);
1576
- var _props_maxGranularity1;
1577
- return {
1578
- value: calendarValue,
1579
- dateValue,
1580
- calendar,
1581
- setValue,
1582
- segments,
1583
- dateFormatter,
1584
- validationState,
1585
- granularity,
1586
- maxGranularity: (_props_maxGranularity1 = props.maxGranularity) !== null && _props_maxGranularity1 !== void 0 ? _props_maxGranularity1 : "year",
1587
- isDisabled,
1588
- isReadOnly,
1589
- isRequired,
1590
- increment(part) {
1591
- adjustSegment(part, 1);
1592
- },
1593
- decrement(part) {
1594
- adjustSegment(part, -1);
1595
- },
1596
- incrementPage(part) {
1597
- adjustSegment(part, $3c0fc76039f1c516$var$PAGE_STEP[part] || 1);
1598
- },
1599
- decrementPage(part) {
1600
- adjustSegment(part, -($3c0fc76039f1c516$var$PAGE_STEP[part] || 1));
1601
- },
1602
- setSegment(part, v2) {
1603
- markValid(part);
1604
- setValue($3c0fc76039f1c516$var$setSegment(displayValue, part, v2, resolvedOptions));
1605
- },
1606
- confirmPlaceholder() {
1607
- if (props.isDisabled || props.isReadOnly)
1608
- return;
1609
- let validKeys = Object.keys(validSegments);
1610
- let allKeys = Object.keys(allSegments);
1611
- if (validKeys.length === allKeys.length - 1 && allSegments.dayPeriod && !validSegments.dayPeriod) {
1612
- validSegments = {
1613
- ...allSegments
1614
- };
1615
- setValidSegments(validSegments);
1616
- setValue(displayValue.copy());
1617
- }
1618
- },
1619
- clearSegment(part) {
1620
- delete validSegments[part];
1621
- clearedSegment.current = part;
1622
- setValidSegments({
1623
- ...validSegments
1624
- });
1625
- let placeholder = ($35a22f14a1f04b11$export$66aa2b09de4b1ea5)(props.placeholderValue, granularity, calendar, defaultTimeZone);
1626
- let value2 = displayValue;
1627
- if (part === "dayPeriod" && "hour" in displayValue && "hour" in placeholder) {
1628
- let isPM = displayValue.hour >= 12;
1629
- let shouldBePM = placeholder.hour >= 12;
1630
- if (isPM && !shouldBePM)
1631
- value2 = displayValue.set({
1632
- hour: displayValue.hour - 12
1633
- });
1634
- else if (!isPM && shouldBePM)
1635
- value2 = displayValue.set({
1636
- hour: displayValue.hour + 12
1637
- });
1638
- } else if (part in displayValue)
1639
- value2 = displayValue.set({
1640
- [part]: placeholder[part]
1641
- });
1642
- setDate(null);
1643
- setValue(value2);
1644
- },
1645
- formatValue(fieldOptions) {
1646
- if (!calendarValue)
1647
- return "";
1648
- let formatOptions = ($35a22f14a1f04b11$export$7e319ea407e63bc0)(fieldOptions, formatOpts);
1649
- let formatter = new (date.DateFormatter)(locale, formatOptions);
1650
- return formatter.format(dateValue);
1651
- }
1652
- };
1653
- }
1654
- function $3c0fc76039f1c516$var$getSegmentLimits(date$1, type, options) {
1655
- switch (type) {
1656
- case "era": {
1657
- let eras = date$1.calendar.getEras();
1658
- return {
1659
- value: eras.indexOf(date$1.era),
1660
- minValue: 0,
1661
- maxValue: eras.length - 1
1662
- };
1663
- }
1664
- case "year":
1665
- return {
1666
- value: date$1.year,
1667
- minValue: 1,
1668
- maxValue: date$1.calendar.getYearsInEra(date$1)
1669
- };
1670
- case "month":
1671
- return {
1672
- value: date$1.month,
1673
- minValue: (date.getMinimumMonthInYear)(date$1),
1674
- maxValue: date$1.calendar.getMonthsInYear(date$1)
1675
- };
1676
- case "day":
1677
- return {
1678
- value: date$1.day,
1679
- minValue: (date.getMinimumDayInMonth)(date$1),
1680
- maxValue: date$1.calendar.getDaysInMonth(date$1)
1681
- };
1682
- }
1683
- if ("hour" in date$1)
1684
- switch (type) {
1685
- case "dayPeriod":
1686
- return {
1687
- value: date$1.hour >= 12 ? 12 : 0,
1688
- minValue: 0,
1689
- maxValue: 12
1690
- };
1691
- case "hour":
1692
- if (options.hour12) {
1693
- let isPM = date$1.hour >= 12;
1694
- return {
1695
- value: date$1.hour,
1696
- minValue: isPM ? 12 : 0,
1697
- maxValue: isPM ? 23 : 11
1698
- };
1699
- }
1700
- return {
1701
- value: date$1.hour,
1702
- minValue: 0,
1703
- maxValue: 23
1704
- };
1705
- case "minute":
1706
- return {
1707
- value: date$1.minute,
1708
- minValue: 0,
1709
- maxValue: 59
1710
- };
1711
- case "second":
1712
- return {
1713
- value: date$1.second,
1714
- minValue: 0,
1715
- maxValue: 59
1716
- };
1717
- }
1718
- return {};
1719
- }
1720
- function $3c0fc76039f1c516$var$addSegment(value, part, amount, options) {
1721
- switch (part) {
1722
- case "era":
1723
- case "year":
1724
- case "month":
1725
- case "day":
1726
- return value.cycle(part, amount, {
1727
- round: part === "year"
1728
- });
1729
- }
1730
- if ("hour" in value)
1731
- switch (part) {
1732
- case "dayPeriod": {
1733
- let hours = value.hour;
1734
- let isPM = hours >= 12;
1735
- return value.set({
1736
- hour: isPM ? hours - 12 : hours + 12
1737
- });
1738
- }
1739
- case "hour":
1740
- case "minute":
1741
- case "second":
1742
- return value.cycle(part, amount, {
1743
- round: part !== "hour",
1744
- hourCycle: options.hour12 ? 12 : 24
1745
- });
1746
- }
1747
- }
1748
- function $3c0fc76039f1c516$var$setSegment(value, part, segmentValue, options) {
1749
- switch (part) {
1750
- case "day":
1751
- case "month":
1752
- case "year":
1753
- case "era":
1754
- return value.set({
1755
- [part]: segmentValue
1756
- });
1757
- }
1758
- if ("hour" in value)
1759
- switch (part) {
1760
- case "dayPeriod": {
1761
- let hours = value.hour;
1762
- let wasPM = hours >= 12;
1763
- let isPM = segmentValue >= 12;
1764
- if (isPM === wasPM)
1765
- return value;
1766
- return value.set({
1767
- hour: wasPM ? hours - 12 : hours + 12
1768
- });
1769
- }
1770
- case "hour":
1771
- if (options.hour12) {
1772
- let hours = value.hour;
1773
- let wasPM = hours >= 12;
1774
- if (!wasPM && segmentValue === 12)
1775
- segmentValue = 0;
1776
- if (wasPM && segmentValue < 12)
1777
- segmentValue += 12;
1778
- }
1779
- case "minute":
1780
- case "second":
1781
- return value.set({
1782
- [part]: segmentValue
1783
- });
1784
- }
1785
- }
1786
- function $93c38a5e28be6249$export$e50a61c1de9f574(props) {
1787
- var _props_isDateUnavailable, _props_isDateUnavailable1;
1788
- let overlayState = ($fc909762b330b746$export$61c6a8c84e605fb6)(props);
1789
- let [controlledValue, setControlledValue] = ($458b0a5536c1a7cf$export$40bfa8c7b0832715)(props.value, props.defaultValue || null, props.onChange);
1790
- let [placeholderValue, setPlaceholderValue] = (React69.useState)(() => controlledValue || {
1791
- start: null,
1792
- end: null
1793
- });
1794
- if (controlledValue == null && placeholderValue.start && placeholderValue.end) {
1795
- placeholderValue = {
1796
- start: null,
1797
- end: null
1798
- };
1799
- setPlaceholderValue(placeholderValue);
1800
- }
1801
- let value = controlledValue || placeholderValue;
1802
- let setValue = (value2) => {
1803
- setPlaceholderValue(value2);
1804
- if ((value2 === null || value2 === void 0 ? void 0 : value2.start) && value2.end)
1805
- setControlledValue(value2);
1806
- else
1807
- setControlledValue(null);
1808
- };
1809
- let v = (value === null || value === void 0 ? void 0 : value.start) || (value === null || value === void 0 ? void 0 : value.end) || props.placeholderValue;
1810
- let [granularity] = ($35a22f14a1f04b11$export$2440da353cedad43)(v, props.granularity);
1811
- let hasTime = granularity === "hour" || granularity === "minute" || granularity === "second";
1812
- var _props_shouldCloseOnSelect;
1813
- let shouldCloseOnSelect = (_props_shouldCloseOnSelect = props.shouldCloseOnSelect) !== null && _props_shouldCloseOnSelect !== void 0 ? _props_shouldCloseOnSelect : true;
1814
- let [dateRange, setSelectedDateRange] = (React69.useState)(null);
1815
- let [timeRange, setSelectedTimeRange] = (React69.useState)(null);
1816
- if (value && value.start && value.end) {
1817
- dateRange = value;
1818
- if ("hour" in value.start)
1819
- timeRange = value;
1820
- }
1821
- let commitValue = (dateRange2, timeRange2) => {
1822
- setValue({
1823
- start: "timeZone" in timeRange2.start ? timeRange2.start.set((date.toCalendarDate)(dateRange2.start)) : (date.toCalendarDateTime)(dateRange2.start, timeRange2.start),
1824
- end: "timeZone" in timeRange2.end ? timeRange2.end.set((date.toCalendarDate)(dateRange2.end)) : (date.toCalendarDateTime)(dateRange2.end, timeRange2.end)
1825
- });
1826
- setSelectedDateRange(null);
1827
- setSelectedTimeRange(null);
1828
- };
1829
- let setDateRange = (range) => {
1830
- let shouldClose = typeof shouldCloseOnSelect === "function" ? shouldCloseOnSelect() : shouldCloseOnSelect;
1831
- if (hasTime) {
1832
- if (shouldClose || range.start && range.end && (timeRange === null || timeRange === void 0 ? void 0 : timeRange.start) && (timeRange === null || timeRange === void 0 ? void 0 : timeRange.end))
1833
- commitValue(range, {
1834
- start: (timeRange === null || timeRange === void 0 ? void 0 : timeRange.start) || ($35a22f14a1f04b11$export$c5221a78ef73c5e9)(props.placeholderValue),
1835
- end: (timeRange === null || timeRange === void 0 ? void 0 : timeRange.end) || ($35a22f14a1f04b11$export$c5221a78ef73c5e9)(props.placeholderValue)
1836
- });
1837
- else
1838
- setSelectedDateRange(range);
1839
- } else if (range.start && range.end)
1840
- setValue(range);
1841
- else
1842
- setSelectedDateRange(range);
1843
- if (shouldClose)
1844
- overlayState.setOpen(false);
1845
- };
1846
- let setTimeRange = (range) => {
1847
- if ((dateRange === null || dateRange === void 0 ? void 0 : dateRange.start) && (dateRange === null || dateRange === void 0 ? void 0 : dateRange.end) && range.start && range.end)
1848
- commitValue(dateRange, range);
1849
- else
1850
- setSelectedTimeRange(range);
1851
- };
1852
- let validationState = props.validationState || (value != null && (($35a22f14a1f04b11$export$eac50920cf2fd59a)(value.start, props.minValue, props.maxValue) || ($35a22f14a1f04b11$export$eac50920cf2fd59a)(value.end, props.minValue, props.maxValue) || value.end != null && value.start != null && value.end.compare(value.start) < 0 || (value === null || value === void 0 ? void 0 : value.start) && ((_props_isDateUnavailable = props.isDateUnavailable) === null || _props_isDateUnavailable === void 0 ? void 0 : _props_isDateUnavailable.call(props, value.start)) || (value === null || value === void 0 ? void 0 : value.end) && ((_props_isDateUnavailable1 = props.isDateUnavailable) === null || _props_isDateUnavailable1 === void 0 ? void 0 : _props_isDateUnavailable1.call(props, value.end))) ? "invalid" : null);
1853
- return {
1854
- value,
1855
- setValue,
1856
- dateRange,
1857
- timeRange,
1858
- granularity,
1859
- hasTime,
1860
- setDate(part, date) {
1861
- setDateRange({
1862
- ...dateRange,
1863
- [part]: date
1864
- });
1865
- },
1866
- setTime(part, time) {
1867
- setTimeRange({
1868
- ...timeRange,
1869
- [part]: time
1870
- });
1871
- },
1872
- setDateTime(part, dateTime) {
1873
- setValue({
1874
- ...value,
1875
- [part]: dateTime
1876
- });
1877
- },
1878
- setDateRange,
1879
- setTimeRange,
1880
- ...overlayState,
1881
- setOpen(isOpen) {
1882
- if (!isOpen && !((value === null || value === void 0 ? void 0 : value.start) && (value === null || value === void 0 ? void 0 : value.end)) && (dateRange === null || dateRange === void 0 ? void 0 : dateRange.start) && (dateRange === null || dateRange === void 0 ? void 0 : dateRange.end) && hasTime)
1883
- commitValue(dateRange, {
1884
- start: (timeRange === null || timeRange === void 0 ? void 0 : timeRange.start) || ($35a22f14a1f04b11$export$c5221a78ef73c5e9)(props.placeholderValue),
1885
- end: (timeRange === null || timeRange === void 0 ? void 0 : timeRange.end) || ($35a22f14a1f04b11$export$c5221a78ef73c5e9)(props.placeholderValue)
1886
- });
1887
- overlayState.setOpen(isOpen);
1888
- },
1889
- validationState,
1890
- formatValue(locale, fieldOptions) {
1891
- if (!value || !value.start || !value.end)
1892
- return null;
1893
- let startTimeZone = "timeZone" in value.start ? value.start.timeZone : void 0;
1894
- let startGranularity = props.granularity || (value.start && "minute" in value.start ? "minute" : "day");
1895
- let endTimeZone = "timeZone" in value.end ? value.end.timeZone : void 0;
1896
- let endGranularity = props.granularity || (value.end && "minute" in value.end ? "minute" : "day");
1897
- let startOptions = ($35a22f14a1f04b11$export$7e319ea407e63bc0)(fieldOptions, {
1898
- granularity: startGranularity,
1899
- timeZone: startTimeZone,
1900
- hideTimeZone: props.hideTimeZone,
1901
- hourCycle: props.hourCycle,
1902
- showEra: value.start.calendar.identifier === "gregory" && value.start.era === "BC" || value.end.calendar.identifier === "gregory" && value.end.era === "BC"
1903
- });
1904
- let startDate = value.start.toDate(startTimeZone || "UTC");
1905
- let endDate = value.end.toDate(endTimeZone || "UTC");
1906
- let startFormatter = new (date.DateFormatter)(locale, startOptions);
1907
- let endFormatter;
1908
- if (startTimeZone === endTimeZone && startGranularity === endGranularity && value.start.compare(value.end) !== 0) {
1909
- try {
1910
- let parts14 = startFormatter.formatRangeToParts(startDate, endDate);
1911
- let separatorIndex = -1;
1912
- for (let i = 0; i < parts14.length; i++) {
1913
- let part = parts14[i];
1914
- if (part.source === "shared" && part.type === "literal")
1915
- separatorIndex = i;
1916
- else if (part.source === "endRange")
1917
- break;
1918
- }
1919
- let start = "";
1920
- let end = "";
1921
- for (let i = 0; i < parts14.length; i++) {
1922
- if (i < separatorIndex)
1923
- start += parts14[i].value;
1924
- else if (i > separatorIndex)
1925
- end += parts14[i].value;
1926
- }
1927
- return {
1928
- start,
1929
- end
1930
- };
1931
- } catch (e) {
1932
- }
1933
- endFormatter = startFormatter;
1934
- } else {
1935
- let endOptions = ($35a22f14a1f04b11$export$7e319ea407e63bc0)(fieldOptions, {
1936
- granularity: endGranularity,
1937
- timeZone: endTimeZone,
1938
- hideTimeZone: props.hideTimeZone,
1939
- hourCycle: props.hourCycle
1940
- });
1941
- endFormatter = new (date.DateFormatter)(locale, endOptions);
1942
- }
1943
- return {
1944
- start: startFormatter.format(startDate),
1945
- end: endFormatter.format(endDate)
1946
- };
1947
- }
1948
- };
1949
- }
1950
- var $35a22f14a1f04b11$var$DEFAULT_FIELD_OPTIONS, $35a22f14a1f04b11$var$TWO_DIGIT_FIELD_OPTIONS, $3e3ed55ab2966714$var$placeholders, $3c0fc76039f1c516$var$EDITABLE_SEGMENTS, $3c0fc76039f1c516$var$PAGE_STEP, $3c0fc76039f1c516$var$TYPE_MAPPING;
1951
- var init_import4 = __esm({
1952
- "../../node_modules/@react-stately/datepicker/dist/import.mjs"() {
1953
- init_import2();
1954
- init_import();
1955
- init_import3();
1956
- $35a22f14a1f04b11$var$DEFAULT_FIELD_OPTIONS = {
1957
- year: "numeric",
1958
- month: "numeric",
1959
- day: "numeric",
1960
- hour: "numeric",
1961
- minute: "2-digit",
1962
- second: "2-digit"
1963
- };
1964
- $35a22f14a1f04b11$var$TWO_DIGIT_FIELD_OPTIONS = {
1965
- year: "numeric",
1966
- month: "2-digit",
1967
- day: "2-digit",
1968
- hour: "2-digit",
1969
- minute: "2-digit",
1970
- second: "2-digit"
1971
- };
1972
- $3e3ed55ab2966714$var$placeholders = new ($5b160d28a433310d$export$c17fa47878dc55b6)({
1973
- ach: {
1974
- year: "mwaka",
1975
- month: "dwe",
1976
- day: "nino"
1977
- },
1978
- af: {
1979
- year: "jjjj",
1980
- month: "mm",
1981
- day: "dd"
1982
- },
1983
- am: {
1984
- year: "\u12D3\u12D3\u12D3\u12D3",
1985
- month: "\u121A\u121C",
1986
- day: "\u1240\u1240"
1987
- },
1988
- an: {
1989
- year: "aaaa",
1990
- month: "mm",
1991
- day: "dd"
1992
- },
1993
- ar: {
1994
- year: "\u0633\u0646\u0629",
1995
- month: "\u0634\u0647\u0631",
1996
- day: "\u064A\u0648\u0645"
1997
- },
1998
- ast: {
1999
- year: "aaaa",
2000
- month: "mm",
2001
- day: "dd"
2002
- },
2003
- az: {
2004
- year: "iiii",
2005
- month: "aa",
2006
- day: "gg"
2007
- },
2008
- be: {
2009
- year: "\u0433\u0433\u0433\u0433",
2010
- month: "\u043C\u043C",
2011
- day: "\u0434\u0434"
2012
- },
2013
- bg: {
2014
- year: "\u0433\u0433\u0433\u0433",
2015
- month: "\u043C\u043C",
2016
- day: "\u0434\u0434"
2017
- },
2018
- bn: {
2019
- year: "yyyy",
2020
- month: "\u09AE\u09BF\u09AE\u09BF",
2021
- day: "dd"
2022
- },
2023
- br: {
2024
- year: "bbbb",
2025
- month: "mm",
2026
- day: "dd"
2027
- },
2028
- bs: {
2029
- year: "gggg",
2030
- month: "mm",
2031
- day: "dd"
2032
- },
2033
- ca: {
2034
- year: "aaaa",
2035
- month: "mm",
2036
- day: "dd"
2037
- },
2038
- cak: {
2039
- year: "jjjj",
2040
- month: "ii",
2041
- day: "q'q'"
2042
- },
2043
- ckb: {
2044
- year: "\u0633\u0627\u06B5",
2045
- month: "\u0645\u0627\u0646\u06AF",
2046
- day: "\u0695\u06C6\u0698"
2047
- },
2048
- cs: {
2049
- year: "rrrr",
2050
- month: "mm",
2051
- day: "dd"
2052
- },
2053
- cy: {
2054
- year: "bbbb",
2055
- month: "mm",
2056
- day: "dd"
2057
- },
2058
- da: {
2059
- year: "\xE5\xE5\xE5\xE5",
2060
- month: "mm",
2061
- day: "dd"
2062
- },
2063
- de: {
2064
- year: "jjjj",
2065
- month: "mm",
2066
- day: "tt"
2067
- },
2068
- dsb: {
2069
- year: "llll",
2070
- month: "mm",
2071
- day: "\u017A\u017A"
2072
- },
2073
- el: {
2074
- year: "\u03B5\u03B5\u03B5\u03B5",
2075
- month: "\u03BC\u03BC",
2076
- day: "\u03B7\u03B7"
2077
- },
2078
- en: {
2079
- year: "yyyy",
2080
- month: "mm",
2081
- day: "dd"
2082
- },
2083
- eo: {
2084
- year: "jjjj",
2085
- month: "mm",
2086
- day: "tt"
2087
- },
2088
- es: {
2089
- year: "aaaa",
2090
- month: "mm",
2091
- day: "dd"
2092
- },
2093
- et: {
2094
- year: "aaaa",
2095
- month: "kk",
2096
- day: "pp"
2097
- },
2098
- eu: {
2099
- year: "uuuu",
2100
- month: "hh",
2101
- day: "ee"
2102
- },
2103
- fa: {
2104
- year: "\u0633\u0627\u0644",
2105
- month: "\u0645\u0627\u0647",
2106
- day: "\u0631\u0648\u0632"
2107
- },
2108
- ff: {
2109
- year: "hhhh",
2110
- month: "ll",
2111
- day: "\xF1\xF1"
2112
- },
2113
- fi: {
2114
- year: "vvvv",
2115
- month: "kk",
2116
- day: "pp"
2117
- },
2118
- fr: {
2119
- year: "aaaa",
2120
- month: "mm",
2121
- day: "jj"
2122
- },
2123
- fy: {
2124
- year: "jjjj",
2125
- month: "mm",
2126
- day: "dd"
2127
- },
2128
- ga: {
2129
- year: "bbbb",
2130
- month: "mm",
2131
- day: "ll"
2132
- },
2133
- gd: {
2134
- year: "bbbb",
2135
- month: "mm",
2136
- day: "ll"
2137
- },
2138
- gl: {
2139
- year: "aaaa",
2140
- month: "mm",
2141
- day: "dd"
2142
- },
2143
- he: {
2144
- year: "\u05E9\u05E0\u05D4",
2145
- month: "\u05D7\u05D5\u05D3\u05E9",
2146
- day: "\u05D9\u05D5\u05DD"
2147
- },
2148
- hr: {
2149
- year: "gggg",
2150
- month: "mm",
2151
- day: "dd"
2152
- },
2153
- hsb: {
2154
- year: "llll",
2155
- month: "mm",
2156
- day: "dd"
2157
- },
2158
- hu: {
2159
- year: "\xE9\xE9\xE9\xE9",
2160
- month: "hh",
2161
- day: "nn"
2162
- },
2163
- ia: {
2164
- year: "aaaa",
2165
- month: "mm",
2166
- day: "dd"
2167
- },
2168
- id: {
2169
- year: "tttt",
2170
- month: "bb",
2171
- day: "hh"
2172
- },
2173
- it: {
2174
- year: "aaaa",
2175
- month: "mm",
2176
- day: "gg"
2177
- },
2178
- ja: {
2179
- year: " \u5E74 ",
2180
- month: "\u6708",
2181
- day: "\u65E5"
2182
- },
2183
- ka: {
2184
- year: "\u10EC\u10EC\u10EC\u10EC",
2185
- month: "\u10D7\u10D7",
2186
- day: "\u10E0\u10E0"
2187
- },
2188
- kk: {
2189
- year: "\u0436\u0436\u0436\u0436",
2190
- month: "\u0430\u0430",
2191
- day: "\u043A\u043A"
2192
- },
2193
- kn: {
2194
- year: "\u0CB5\u0CB5\u0CB5\u0CB5",
2195
- month: "\u0CAE\u0CBF\u0CAE\u0CC0",
2196
- day: "\u0CA6\u0CBF\u0CA6\u0CBF"
2197
- },
2198
- ko: {
2199
- year: "\uC5F0\uB3C4",
2200
- month: "\uC6D4",
2201
- day: "\uC77C"
2202
- },
2203
- lb: {
2204
- year: "jjjj",
2205
- month: "mm",
2206
- day: "dd"
2207
- },
2208
- lo: {
2209
- year: "\u0E9B\u0E9B\u0E9B\u0E9B",
2210
- month: "\u0E94\u0E94",
2211
- day: "\u0EA7\u0EA7"
2212
- },
2213
- lt: {
2214
- year: "mmmm",
2215
- month: "mm",
2216
- day: "dd"
2217
- },
2218
- lv: {
2219
- year: "gggg",
2220
- month: "mm",
2221
- day: "dd"
2222
- },
2223
- meh: {
2224
- year: "aaaa",
2225
- month: "mm",
2226
- day: "dd"
2227
- },
2228
- ml: {
2229
- year: "\u0D35\u0D7C\u0D37\u0D02",
2230
- month: "\u0D2E\u0D3E\u0D38\u0D02",
2231
- day: "\u0D24\u0D40\u0D2F\u0D24\u0D3F"
2232
- },
2233
- ms: {
2234
- year: "tttt",
2235
- month: "mm",
2236
- day: "hh"
2237
- },
2238
- nl: {
2239
- year: "jjjj",
2240
- month: "mm",
2241
- day: "dd"
2242
- },
2243
- nn: {
2244
- year: "\xE5\xE5\xE5\xE5",
2245
- month: "mm",
2246
- day: "dd"
2247
- },
2248
- no: {
2249
- year: "\xE5\xE5\xE5\xE5",
2250
- month: "mm",
2251
- day: "dd"
2252
- },
2253
- oc: {
2254
- year: "aaaa",
2255
- month: "mm",
2256
- day: "jj"
2257
- },
2258
- pl: {
2259
- year: "rrrr",
2260
- month: "mm",
2261
- day: "dd"
2262
- },
2263
- pt: {
2264
- year: "aaaa",
2265
- month: "mm",
2266
- day: "dd"
2267
- },
2268
- rm: {
2269
- year: "oooo",
2270
- month: "mm",
2271
- day: "dd"
2272
- },
2273
- ro: {
2274
- year: "aaaa",
2275
- month: "ll",
2276
- day: "zz"
2277
- },
2278
- ru: {
2279
- year: "\u0433\u0433\u0433\u0433",
2280
- month: "\u043C\u043C",
2281
- day: "\u0434\u0434"
2282
- },
2283
- sc: {
2284
- year: "aaaa",
2285
- month: "mm",
2286
- day: "dd"
2287
- },
2288
- scn: {
2289
- year: "aaaa",
2290
- month: "mm",
2291
- day: "jj"
2292
- },
2293
- sk: {
2294
- year: "rrrr",
2295
- month: "mm",
2296
- day: "dd"
2297
- },
2298
- sl: {
2299
- year: "llll",
2300
- month: "mm",
2301
- day: "dd"
2302
- },
2303
- sr: {
2304
- year: "\u0433\u0433\u0433\u0433",
2305
- month: "\u043C\u043C",
2306
- day: "\u0434\u0434"
2307
- },
2308
- sv: {
2309
- year: "\xE5\xE5\xE5\xE5",
2310
- month: "mm",
2311
- day: "dd"
2312
- },
2313
- szl: {
2314
- year: "rrrr",
2315
- month: "mm",
2316
- day: "dd"
2317
- },
2318
- tg: {
2319
- year: "\u0441\u0441\u0441\u0441",
2320
- month: "\u043C\u043C",
2321
- day: "\u0440\u0440"
2322
- },
2323
- th: {
2324
- year: "\u0E1B\u0E1B\u0E1B\u0E1B",
2325
- month: "\u0E14\u0E14",
2326
- day: "\u0E27\u0E27"
2327
- },
2328
- tr: {
2329
- year: "yyyy",
2330
- month: "aa",
2331
- day: "gg"
2332
- },
2333
- uk: {
2334
- year: "\u0440\u0440\u0440\u0440",
2335
- month: "\u043C\u043C",
2336
- day: "\u0434\u0434"
2337
- },
2338
- "zh-CN": {
2339
- year: "\u5E74",
2340
- month: "\u6708",
2341
- day: "\u65E5"
2342
- },
2343
- "zh-TW": {
2344
- year: "\u5E74",
2345
- month: "\u6708",
2346
- day: "\u65E5"
2347
- }
2348
- }, "en");
2349
- $3c0fc76039f1c516$var$EDITABLE_SEGMENTS = {
2350
- year: true,
2351
- month: true,
2352
- day: true,
2353
- hour: true,
2354
- minute: true,
2355
- second: true,
2356
- dayPeriod: true,
2357
- era: true
2358
- };
2359
- $3c0fc76039f1c516$var$PAGE_STEP = {
2360
- year: 5,
2361
- month: 2,
2362
- day: 7,
2363
- hour: 2,
2364
- minute: 15,
2365
- second: 15
2366
- };
2367
- $3c0fc76039f1c516$var$TYPE_MAPPING = {
2368
- dayperiod: "dayPeriod"
2369
- };
2370
- }
2371
- });
2372
- function $f62d864046160412$export$eac50920cf2fd59a(date, minValue, maxValue) {
2373
- return minValue != null && date.compare(minValue) < 0 || maxValue != null && date.compare(maxValue) > 0;
2374
- }
2375
- function $f62d864046160412$export$f4a51ff076cc9a09(date, duration, locale, minValue, maxValue) {
2376
- let halfDuration = {};
2377
- for (let key in duration) {
2378
- halfDuration[key] = Math.floor(duration[key] / 2);
2379
- if (halfDuration[key] > 0 && duration[key] % 2 === 0)
2380
- halfDuration[key]--;
2381
- }
2382
- let aligned = $f62d864046160412$export$144a00ba6044eb9(date, duration, locale).subtract(halfDuration);
2383
- return $f62d864046160412$export$5bb865b12696a77d(date, aligned, duration, locale, minValue, maxValue);
2384
- }
2385
- function $f62d864046160412$export$144a00ba6044eb9(date$1, duration, locale, minValue, maxValue) {
2386
- let aligned = date$1;
2387
- if (duration.years)
2388
- aligned = (date.startOfYear)(date$1);
2389
- else if (duration.months)
2390
- aligned = (date.startOfMonth)(date$1);
2391
- else if (duration.weeks)
2392
- aligned = (date.startOfWeek)(date$1, locale);
2393
- return $f62d864046160412$export$5bb865b12696a77d(date$1, aligned, duration, locale, minValue, maxValue);
2394
- }
2395
- function $f62d864046160412$export$530edbfc915b2b04(date, duration, locale, minValue, maxValue) {
2396
- let d = {
2397
- ...duration
2398
- };
2399
- if (duration.days)
2400
- d.days--;
2401
- else if (duration.weeks)
2402
- d.weeks--;
2403
- else if (duration.months)
2404
- d.months--;
2405
- else if (duration.years)
2406
- d.years--;
2407
- let aligned = $f62d864046160412$export$144a00ba6044eb9(date, duration, locale).subtract(d);
2408
- return $f62d864046160412$export$5bb865b12696a77d(date, aligned, duration, locale, minValue, maxValue);
2409
- }
2410
- function $f62d864046160412$export$5bb865b12696a77d(date$1, aligned, duration, locale, minValue, maxValue) {
2411
- if (minValue && date$1.compare(minValue) >= 0)
2412
- aligned = (date.maxDate)(aligned, $f62d864046160412$export$144a00ba6044eb9((date.toCalendarDate)(minValue), duration, locale));
2413
- if (maxValue && date$1.compare(maxValue) <= 0)
2414
- aligned = (date.minDate)(aligned, $f62d864046160412$export$530edbfc915b2b04((date.toCalendarDate)(maxValue), duration, locale));
2415
- return aligned;
2416
- }
2417
- function $f62d864046160412$export$4f5203c0d889109e(date$1, minValue, maxValue) {
2418
- if (minValue)
2419
- date$1 = (date.maxDate)(date$1, (date.toCalendarDate)(minValue));
2420
- if (maxValue)
2421
- date$1 = (date.minDate)(date$1, (date.toCalendarDate)(maxValue));
2422
- return date$1;
2423
- }
2424
- function $f62d864046160412$export$a1d3911297b952d7(date, minValue, isDateUnavailable) {
2425
- if (!isDateUnavailable)
2426
- return date;
2427
- while (date.compare(minValue) >= 0 && isDateUnavailable(date))
2428
- date = date.subtract({
2429
- days: 1
2430
- });
2431
- if (date.compare(minValue) >= 0)
2432
- return date;
2433
- }
2434
- function $131cf43a05231e1e$export$6d095e787d2b5e1f(props) {
2435
- let defaultFormatter = (React69.useMemo)(() => new (date.DateFormatter)(props.locale), [
2436
- props.locale
2437
- ]);
2438
- let resolvedOptions = (React69.useMemo)(() => defaultFormatter.resolvedOptions(), [
2439
- defaultFormatter
2440
- ]);
2441
- let { locale, createCalendar: createCalendar4, visibleDuration = {
2442
- months: 1
2443
- }, minValue, maxValue, selectionAlignment, isDateUnavailable, pageBehavior = "visible" } = props;
2444
- let calendar = (React69.useMemo)(() => createCalendar4(resolvedOptions.calendar), [
2445
- createCalendar4,
2446
- resolvedOptions.calendar
2447
- ]);
2448
- let [value, setControlledValue] = ($458b0a5536c1a7cf$export$40bfa8c7b0832715)(props.value, props.defaultValue, props.onChange);
2449
- let calendarDateValue = (React69.useMemo)(() => value ? (date.toCalendar)((date.toCalendarDate)(value), calendar) : null, [
2450
- value,
2451
- calendar
2452
- ]);
2453
- let timeZone = (React69.useMemo)(() => value && "timeZone" in value ? value.timeZone : resolvedOptions.timeZone, [
2454
- value,
2455
- resolvedOptions.timeZone
2456
- ]);
2457
- let focusedCalendarDate = (React69.useMemo)(() => props.focusedValue ? ($f62d864046160412$export$4f5203c0d889109e)((date.toCalendar)((date.toCalendarDate)(props.focusedValue), calendar), minValue, maxValue) : void 0, [
2458
- props.focusedValue,
2459
- calendar,
2460
- minValue,
2461
- maxValue
2462
- ]);
2463
- let defaultFocusedCalendarDate = (React69.useMemo)(() => ($f62d864046160412$export$4f5203c0d889109e)(props.defaultFocusedValue ? (date.toCalendar)((date.toCalendarDate)(props.defaultFocusedValue), calendar) : calendarDateValue || (date.toCalendar)((date.today)(timeZone), calendar), minValue, maxValue), [
2464
- props.defaultFocusedValue,
2465
- calendarDateValue,
2466
- timeZone,
2467
- calendar,
2468
- minValue,
2469
- maxValue
2470
- ]);
2471
- let [focusedDate, setFocusedDate] = ($458b0a5536c1a7cf$export$40bfa8c7b0832715)(focusedCalendarDate, defaultFocusedCalendarDate, props.onFocusChange);
2472
- let [startDate, setStartDate] = (React69.useState)(() => {
2473
- switch (selectionAlignment) {
2474
- case "start":
2475
- return ($f62d864046160412$export$144a00ba6044eb9)(focusedDate, visibleDuration, locale, minValue, maxValue);
2476
- case "end":
2477
- return ($f62d864046160412$export$530edbfc915b2b04)(focusedDate, visibleDuration, locale, minValue, maxValue);
2478
- case "center":
2479
- default:
2480
- return ($f62d864046160412$export$f4a51ff076cc9a09)(focusedDate, visibleDuration, locale, minValue, maxValue);
2481
- }
2482
- });
2483
- let [isFocused, setFocused] = (React69.useState)(props.autoFocus || false);
2484
- let endDate = (React69.useMemo)(() => {
2485
- let duration = {
2486
- ...visibleDuration
2487
- };
2488
- if (duration.days)
2489
- duration.days--;
2490
- else
2491
- duration.days = -1;
2492
- return startDate.add(duration);
2493
- }, [
2494
- startDate,
2495
- visibleDuration
2496
- ]);
2497
- let [lastCalendarIdentifier, setLastCalendarIdentifier] = (React69.useState)(calendar.identifier);
2498
- if (calendar.identifier !== lastCalendarIdentifier) {
2499
- let newFocusedDate = (date.toCalendar)(focusedDate, calendar);
2500
- setStartDate(($f62d864046160412$export$f4a51ff076cc9a09)(newFocusedDate, visibleDuration, locale, minValue, maxValue));
2501
- setFocusedDate(newFocusedDate);
2502
- setLastCalendarIdentifier(calendar.identifier);
2503
- }
2504
- if (($f62d864046160412$export$eac50920cf2fd59a)(focusedDate, minValue, maxValue))
2505
- setFocusedDate(($f62d864046160412$export$4f5203c0d889109e)(focusedDate, minValue, maxValue));
2506
- else if (focusedDate.compare(startDate) < 0)
2507
- setStartDate(($f62d864046160412$export$530edbfc915b2b04)(focusedDate, visibleDuration, locale, minValue, maxValue));
2508
- else if (focusedDate.compare(endDate) > 0)
2509
- setStartDate(($f62d864046160412$export$144a00ba6044eb9)(focusedDate, visibleDuration, locale, minValue, maxValue));
2510
- function focusCell(date) {
2511
- date = ($f62d864046160412$export$4f5203c0d889109e)(date, minValue, maxValue);
2512
- setFocusedDate(date);
2513
- }
2514
- function setValue(newValue) {
2515
- if (!props.isDisabled && !props.isReadOnly) {
2516
- newValue = ($f62d864046160412$export$4f5203c0d889109e)(newValue, minValue, maxValue);
2517
- newValue = ($f62d864046160412$export$a1d3911297b952d7)(newValue, startDate, isDateUnavailable);
2518
- if (!newValue)
2519
- return;
2520
- newValue = (date.toCalendar)(newValue, (value === null || value === void 0 ? void 0 : value.calendar) || new (date.GregorianCalendar)());
2521
- if (value && "hour" in value)
2522
- setControlledValue(value.set(newValue));
2523
- else
2524
- setControlledValue(newValue);
2525
- }
2526
- }
2527
- let isUnavailable = (React69.useMemo)(() => {
2528
- if (!calendarDateValue)
2529
- return false;
2530
- if (isDateUnavailable && isDateUnavailable(calendarDateValue))
2531
- return true;
2532
- return ($f62d864046160412$export$eac50920cf2fd59a)(calendarDateValue, minValue, maxValue);
2533
- }, [
2534
- calendarDateValue,
2535
- isDateUnavailable,
2536
- minValue,
2537
- maxValue
2538
- ]);
2539
- let validationState = props.validationState || (isUnavailable ? "invalid" : null);
2540
- let pageDuration = (React69.useMemo)(() => {
2541
- if (pageBehavior === "visible")
2542
- return visibleDuration;
2543
- return $131cf43a05231e1e$var$unitDuration(visibleDuration);
2544
- }, [
2545
- pageBehavior,
2546
- visibleDuration
2547
- ]);
2548
- return {
2549
- isDisabled: props.isDisabled,
2550
- isReadOnly: props.isReadOnly,
2551
- value: calendarDateValue,
2552
- setValue,
2553
- visibleRange: {
2554
- start: startDate,
2555
- end: endDate
2556
- },
2557
- minValue,
2558
- maxValue,
2559
- focusedDate,
2560
- timeZone,
2561
- validationState,
2562
- setFocusedDate(date) {
2563
- focusCell(date);
2564
- setFocused(true);
2565
- },
2566
- focusNextDay() {
2567
- focusCell(focusedDate.add({
2568
- days: 1
2569
- }));
2570
- },
2571
- focusPreviousDay() {
2572
- focusCell(focusedDate.subtract({
2573
- days: 1
2574
- }));
2575
- },
2576
- focusNextRow() {
2577
- if (visibleDuration.days)
2578
- this.focusNextPage();
2579
- else if (visibleDuration.weeks || visibleDuration.months || visibleDuration.years)
2580
- focusCell(focusedDate.add({
2581
- weeks: 1
2582
- }));
2583
- },
2584
- focusPreviousRow() {
2585
- if (visibleDuration.days)
2586
- this.focusPreviousPage();
2587
- else if (visibleDuration.weeks || visibleDuration.months || visibleDuration.years)
2588
- focusCell(focusedDate.subtract({
2589
- weeks: 1
2590
- }));
2591
- },
2592
- focusNextPage() {
2593
- let start = startDate.add(pageDuration);
2594
- setFocusedDate(($f62d864046160412$export$4f5203c0d889109e)(focusedDate.add(pageDuration), minValue, maxValue));
2595
- setStartDate(($f62d864046160412$export$144a00ba6044eb9)(($f62d864046160412$export$5bb865b12696a77d)(focusedDate, start, pageDuration, locale, minValue, maxValue), pageDuration, locale));
2596
- },
2597
- focusPreviousPage() {
2598
- let start = startDate.subtract(pageDuration);
2599
- setFocusedDate(($f62d864046160412$export$4f5203c0d889109e)(focusedDate.subtract(pageDuration), minValue, maxValue));
2600
- setStartDate(($f62d864046160412$export$144a00ba6044eb9)(($f62d864046160412$export$5bb865b12696a77d)(focusedDate, start, pageDuration, locale, minValue, maxValue), pageDuration, locale));
2601
- },
2602
- focusSectionStart() {
2603
- if (visibleDuration.days)
2604
- focusCell(startDate);
2605
- else if (visibleDuration.weeks)
2606
- focusCell((date.startOfWeek)(focusedDate, locale));
2607
- else if (visibleDuration.months || visibleDuration.years)
2608
- focusCell((date.startOfMonth)(focusedDate));
2609
- },
2610
- focusSectionEnd() {
2611
- if (visibleDuration.days)
2612
- focusCell(endDate);
2613
- else if (visibleDuration.weeks)
2614
- focusCell((date.endOfWeek)(focusedDate, locale));
2615
- else if (visibleDuration.months || visibleDuration.years)
2616
- focusCell((date.endOfMonth)(focusedDate));
2617
- },
2618
- focusNextSection(larger) {
2619
- if (!larger && !visibleDuration.days) {
2620
- focusCell(focusedDate.add($131cf43a05231e1e$var$unitDuration(visibleDuration)));
2621
- return;
2622
- }
2623
- if (visibleDuration.days)
2624
- this.focusNextPage();
2625
- else if (visibleDuration.weeks)
2626
- focusCell(focusedDate.add({
2627
- months: 1
2628
- }));
2629
- else if (visibleDuration.months || visibleDuration.years)
2630
- focusCell(focusedDate.add({
2631
- years: 1
2632
- }));
2633
- },
2634
- focusPreviousSection(larger) {
2635
- if (!larger && !visibleDuration.days) {
2636
- focusCell(focusedDate.subtract($131cf43a05231e1e$var$unitDuration(visibleDuration)));
2637
- return;
2638
- }
2639
- if (visibleDuration.days)
2640
- this.focusPreviousPage();
2641
- else if (visibleDuration.weeks)
2642
- focusCell(focusedDate.subtract({
2643
- months: 1
2644
- }));
2645
- else if (visibleDuration.months || visibleDuration.years)
2646
- focusCell(focusedDate.subtract({
2647
- years: 1
2648
- }));
2649
- },
2650
- selectFocusedDate() {
2651
- setValue(focusedDate);
2652
- },
2653
- selectDate(date) {
2654
- setValue(date);
2655
- },
2656
- isFocused,
2657
- setFocused,
2658
- isInvalid(date) {
2659
- return ($f62d864046160412$export$eac50920cf2fd59a)(date, minValue, maxValue);
2660
- },
2661
- isSelected(date$1) {
2662
- return calendarDateValue != null && (date.isSameDay)(date$1, calendarDateValue) && !this.isCellDisabled(date$1) && !this.isCellUnavailable(date$1);
2663
- },
2664
- isCellFocused(date$1) {
2665
- return isFocused && focusedDate && (date.isSameDay)(date$1, focusedDate);
2666
- },
2667
- isCellDisabled(date) {
2668
- return props.isDisabled || date.compare(startDate) < 0 || date.compare(endDate) > 0 || this.isInvalid(date, minValue, maxValue);
2669
- },
2670
- isCellUnavailable(date) {
2671
- return props.isDateUnavailable && props.isDateUnavailable(date);
2672
- },
2673
- isPreviousVisibleRangeInvalid() {
2674
- let prev = startDate.subtract({
2675
- days: 1
2676
- });
2677
- return (date.isSameDay)(prev, startDate) || this.isInvalid(prev, minValue, maxValue);
2678
- },
2679
- isNextVisibleRangeInvalid() {
2680
- let next = endDate.add({
2681
- days: 1
2682
- });
2683
- return (date.isSameDay)(next, endDate) || this.isInvalid(next, minValue, maxValue);
2684
- },
2685
- getDatesInWeek(weekIndex, from = startDate) {
2686
- let date$1 = from.add({
2687
- weeks: weekIndex
2688
- });
2689
- let dates = [];
2690
- date$1 = (date.startOfWeek)(date$1, locale);
2691
- let dayOfWeek = (date.getDayOfWeek)(date$1, locale);
2692
- for (let i = 0; i < dayOfWeek; i++)
2693
- dates.push(null);
2694
- while (dates.length < 7) {
2695
- dates.push(date$1);
2696
- let nextDate = date$1.add({
2697
- days: 1
2698
- });
2699
- if ((date.isSameDay)(date$1, nextDate))
2700
- break;
2701
- date$1 = nextDate;
2702
- }
2703
- while (dates.length < 7)
2704
- dates.push(null);
2705
- return dates;
2706
- }
2707
- };
2708
- }
2709
- function $131cf43a05231e1e$var$unitDuration(duration) {
2710
- let unit = {
2711
- ...duration
2712
- };
2713
- for (let key in duration)
2714
- unit[key] = 1;
2715
- return unit;
2716
- }
2717
- function $9a36b6ba2fb1a7c5$export$9a987164d97ecc90(props) {
2718
- let { value: valueProp, defaultValue, onChange, createCalendar: createCalendar4, locale, visibleDuration = {
2719
- months: 1
2720
- }, minValue, maxValue, ...calendarProps } = props;
2721
- let [value, setValue] = ($458b0a5536c1a7cf$export$40bfa8c7b0832715)(valueProp, defaultValue || null, onChange);
2722
- let [anchorDate, setAnchorDateState] = (React69.useState)(null);
2723
- let alignment = "center";
2724
- if (value && value.start && value.end) {
2725
- let start = ($f62d864046160412$export$f4a51ff076cc9a09)((date.toCalendarDate)(value.start), visibleDuration, locale, minValue, maxValue);
2726
- let end = start.add(visibleDuration).subtract({
2727
- days: 1
2728
- });
2729
- if (value.end.compare(end) > 0)
2730
- alignment = "start";
2731
- }
2732
- let availableRangeRef = (React69.useRef)(null);
2733
- let [availableRange, setAvailableRange] = (React69.useState)(null);
2734
- let min = (React69.useMemo)(() => {
2735
- return (date.maxDate)(minValue, availableRange === null || availableRange === void 0 ? void 0 : availableRange.start);
2736
- }, [
2737
- minValue,
2738
- availableRange
2739
- ]);
2740
- let max = (React69.useMemo)(() => {
2741
- return (date.minDate)(maxValue, availableRange === null || availableRange === void 0 ? void 0 : availableRange.end);
2742
- }, [
2743
- maxValue,
2744
- availableRange
2745
- ]);
2746
- let calendar = ($131cf43a05231e1e$export$6d095e787d2b5e1f)({
2747
- ...calendarProps,
2748
- value: value && value.start,
2749
- createCalendar: createCalendar4,
2750
- locale,
2751
- visibleDuration,
2752
- minValue: min,
2753
- maxValue: max,
2754
- selectionAlignment: alignment
2755
- });
2756
- let updateAvailableRange = (date) => {
2757
- if (date && props.isDateUnavailable && !props.allowsNonContiguousRanges) {
2758
- availableRangeRef.current = {
2759
- start: $9a36b6ba2fb1a7c5$var$nextUnavailableDate(date, calendar, -1),
2760
- end: $9a36b6ba2fb1a7c5$var$nextUnavailableDate(date, calendar, 1)
2761
- };
2762
- setAvailableRange(availableRangeRef.current);
2763
- } else {
2764
- availableRangeRef.current = null;
2765
- setAvailableRange(null);
2766
- }
2767
- };
2768
- let [lastVisibleRange, setLastVisibleRange] = (React69.useState)(calendar.visibleRange);
2769
- if (!(date.isEqualDay)(calendar.visibleRange.start, lastVisibleRange.start) || !(date.isEqualDay)(calendar.visibleRange.end, lastVisibleRange.end)) {
2770
- updateAvailableRange(anchorDate);
2771
- setLastVisibleRange(calendar.visibleRange);
2772
- }
2773
- let setAnchorDate = (date) => {
2774
- if (date) {
2775
- setAnchorDateState(date);
2776
- updateAvailableRange(date);
2777
- } else {
2778
- setAnchorDateState(null);
2779
- updateAvailableRange(null);
2780
- }
2781
- };
2782
- let highlightedRange = anchorDate ? $9a36b6ba2fb1a7c5$var$makeRange(anchorDate, calendar.focusedDate) : value && $9a36b6ba2fb1a7c5$var$makeRange(value.start, value.end);
2783
- let selectDate = (date) => {
2784
- if (props.isReadOnly)
2785
- return;
2786
- date = ($f62d864046160412$export$4f5203c0d889109e)(date, min, max);
2787
- date = ($f62d864046160412$export$a1d3911297b952d7)(date, calendar.visibleRange.start, props.isDateUnavailable);
2788
- if (!date)
2789
- return;
2790
- if (!anchorDate)
2791
- setAnchorDate(date);
2792
- else {
2793
- let range = $9a36b6ba2fb1a7c5$var$makeRange(anchorDate, date);
2794
- setValue({
2795
- start: $9a36b6ba2fb1a7c5$var$convertValue(range.start, value === null || value === void 0 ? void 0 : value.start),
2796
- end: $9a36b6ba2fb1a7c5$var$convertValue(range.end, value === null || value === void 0 ? void 0 : value.end)
2797
- });
2798
- setAnchorDate(null);
2799
- }
2800
- };
2801
- let [isDragging, setDragging] = (React69.useState)(false);
2802
- let { isDateUnavailable } = props;
2803
- let isInvalidSelection = (React69.useMemo)(() => {
2804
- if (!value || anchorDate)
2805
- return false;
2806
- if (isDateUnavailable && (isDateUnavailable(value.start) || isDateUnavailable(value.end)))
2807
- return true;
2808
- return ($f62d864046160412$export$eac50920cf2fd59a)(value.start, minValue, maxValue) || ($f62d864046160412$export$eac50920cf2fd59a)(value.end, minValue, maxValue);
2809
- }, [
2810
- isDateUnavailable,
2811
- value,
2812
- anchorDate,
2813
- minValue,
2814
- maxValue
2815
- ]);
2816
- let validationState = props.validationState || (isInvalidSelection ? "invalid" : null);
2817
- return {
2818
- ...calendar,
2819
- value,
2820
- setValue,
2821
- anchorDate,
2822
- setAnchorDate,
2823
- highlightedRange,
2824
- validationState,
2825
- selectFocusedDate() {
2826
- selectDate(calendar.focusedDate);
2827
- },
2828
- selectDate,
2829
- highlightDate(date) {
2830
- if (anchorDate)
2831
- calendar.setFocusedDate(date);
2832
- },
2833
- isSelected(date) {
2834
- return highlightedRange && date.compare(highlightedRange.start) >= 0 && date.compare(highlightedRange.end) <= 0 && !calendar.isCellDisabled(date) && !calendar.isCellUnavailable(date);
2835
- },
2836
- isInvalid(date) {
2837
- var _availableRangeRef_current, _availableRangeRef_current1;
2838
- return calendar.isInvalid(date) || ($f62d864046160412$export$eac50920cf2fd59a)(date, (_availableRangeRef_current = availableRangeRef.current) === null || _availableRangeRef_current === void 0 ? void 0 : _availableRangeRef_current.start, (_availableRangeRef_current1 = availableRangeRef.current) === null || _availableRangeRef_current1 === void 0 ? void 0 : _availableRangeRef_current1.end);
2839
- },
2840
- isDragging,
2841
- setDragging
2842
- };
2843
- }
2844
- function $9a36b6ba2fb1a7c5$var$makeRange(start, end) {
2845
- if (!start || !end)
2846
- return null;
2847
- if (end.compare(start) < 0)
2848
- [start, end] = [
2849
- end,
2850
- start
2851
- ];
2852
- return {
2853
- start: (date.toCalendarDate)(start),
2854
- end: (date.toCalendarDate)(end)
2855
- };
2856
- }
2857
- function $9a36b6ba2fb1a7c5$var$convertValue(newValue, oldValue) {
2858
- newValue = (date.toCalendar)(newValue, (oldValue === null || oldValue === void 0 ? void 0 : oldValue.calendar) || new (date.GregorianCalendar)());
2859
- if (oldValue && "hour" in oldValue)
2860
- return oldValue.set(newValue);
2861
- return newValue;
2862
- }
2863
- function $9a36b6ba2fb1a7c5$var$nextUnavailableDate(anchorDate, state2, dir) {
2864
- let nextDate = anchorDate.add({
2865
- days: dir
2866
- });
2867
- while ((dir < 0 ? nextDate.compare(state2.visibleRange.start) >= 0 : nextDate.compare(state2.visibleRange.end) <= 0) && !state2.isCellUnavailable(nextDate))
2868
- nextDate = nextDate.add({
2869
- days: dir
2870
- });
2871
- if (state2.isCellUnavailable(nextDate))
2872
- return nextDate.add({
2873
- days: -dir
2874
- });
2875
- return null;
2876
- }
2877
- var init_import5 = __esm({
2878
- "../../node_modules/@react-stately/calendar/dist/import.mjs"() {
2879
- init_import();
2880
- }
2881
- });
2882
1131
  exports.Badge = void 0;
2883
1132
  var init_Badge = __esm({
2884
1133
  "src/typography/Badge.tsx"() {
@@ -3253,7 +1502,7 @@ function Calendar({
3253
1502
  }) {
3254
1503
  const { t: t2 } = useTranslation();
3255
1504
  const locale = useCurrentLocale();
3256
- const state2 = $131cf43a05231e1e$export$6d095e787d2b5e1f({
1505
+ const state2 = reactStately.useCalendarState({
3257
1506
  ...props,
3258
1507
  locale,
3259
1508
  createCalendar: date.createCalendar
@@ -3266,11 +1515,10 @@ function Calendar({
3266
1515
  var texts8;
3267
1516
  var init_Calendar = __esm({
3268
1517
  "src/datepicker/Calendar.tsx"() {
3269
- init_import5();
1518
+ init_i18n();
3270
1519
  init_CalendarGrid();
3271
1520
  init_CalendarHeader();
3272
1521
  init_utils();
3273
- init_i18n();
3274
1522
  texts8 = createTexts({
3275
1523
  calendar: {
3276
1524
  nb: "Kalender",
@@ -3374,7 +1622,6 @@ function createCalendar2(identifier) {
3374
1622
  var DateField;
3375
1623
  var init_DateField = __esm({
3376
1624
  "src/datepicker/DateField.tsx"() {
3377
- init_import4();
3378
1625
  init_DateTimeSegment();
3379
1626
  init_utils();
3380
1627
  DateField = React69.forwardRef(
@@ -3382,7 +1629,7 @@ var init_DateField = __esm({
3382
1629
  var _a6;
3383
1630
  const locale = useCurrentLocale();
3384
1631
  const styles3 = react.useMultiStyleConfig("Datepicker", {});
3385
- const state2 = $3c0fc76039f1c516$export$60e84778edff6d26({
1632
+ const state2 = reactStately.useDateFieldState({
3386
1633
  ...props,
3387
1634
  locale,
3388
1635
  createCalendar: createCalendar2
@@ -3450,7 +1697,6 @@ var init_StyledField = __esm({
3450
1697
  exports.DatePicker = void 0;
3451
1698
  var init_DatePicker = __esm({
3452
1699
  "src/datepicker/DatePicker.tsx"() {
3453
- init_import4();
3454
1700
  init_src();
3455
1701
  init_Calendar();
3456
1702
  init_CalendarTriggerButton();
@@ -3468,7 +1714,7 @@ var init_DatePicker = __esm({
3468
1714
  ...props
3469
1715
  }, externalRef) => {
3470
1716
  const formControlProps = react.useFormControlContext();
3471
- const state2 = $ab5bf3f618090389$export$87194bb378cc3ac2({
1717
+ const state2 = reactStately.useDatePickerState({
3472
1718
  ...props,
3473
1719
  shouldCloseOnSelect: true,
3474
1720
  errorMessage,
@@ -3556,7 +1802,7 @@ var init_DatePicker = __esm({
3556
1802
  });
3557
1803
  function RangeCalendar(props) {
3558
1804
  const locale = useCurrentLocale();
3559
- const state2 = $9a36b6ba2fb1a7c5$export$9a987164d97ecc90({
1805
+ const state2 = reactStately.useRangeCalendarState({
3560
1806
  ...props,
3561
1807
  visibleDuration: { months: 2 },
3562
1808
  locale,
@@ -3575,7 +1821,6 @@ function RangeCalendar(props) {
3575
1821
  }
3576
1822
  var init_RangeCalendar = __esm({
3577
1823
  "src/datepicker/RangeCalendar.tsx"() {
3578
- init_import5();
3579
1824
  init_CalendarGrid();
3580
1825
  init_CalendarHeader();
3581
1826
  init_utils();
@@ -3590,7 +1835,7 @@ function DateRangePicker({
3590
1835
  ...props
3591
1836
  }) {
3592
1837
  const formControlProps = react.useFormControlContext();
3593
- const state2 = $93c38a5e28be6249$export$e50a61c1de9f574({
1838
+ const state2 = reactStately.useDateRangePickerState({
3594
1839
  ...props,
3595
1840
  shouldCloseOnSelect: true,
3596
1841
  isRequired: props.isRequired ?? (formControlProps == null ? void 0 : formControlProps.isRequired),
@@ -3672,7 +1917,6 @@ function DateRangePicker({
3672
1917
  }
3673
1918
  var init_DateRangePicker = __esm({
3674
1919
  "src/datepicker/DateRangePicker.tsx"() {
3675
- init_import4();
3676
1920
  init_CalendarTriggerButton();
3677
1921
  init_DateField();
3678
1922
  init_RangeCalendar();