@vygruppen/spor-react 4.0.3 → 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/.turbo/turbo-build.log +9 -11
- package/CHANGELOG.md +26 -0
- package/dist/{CountryCodeSelect-RUH47EQH.mjs → CountryCodeSelect-7MAIS4VT.mjs} +1 -1
- package/dist/{chunk-XT6QVKN5.mjs → chunk-U2IWIWOD.mjs} +152 -1953
- package/dist/index.d.mts +17 -93
- package/dist/index.d.ts +17 -93
- package/dist/index.js +151 -1980
- package/dist/index.mjs +1 -1
- package/package.json +3 -3
- package/src/accordion/Accordion.test.tsx +1 -1
- package/src/accordion/Accordion.tsx +1 -1
- package/src/accordion/AccordionContext.tsx +1 -1
- package/src/accordion/Expandable.tsx +6 -6
- package/src/alert/BaseAlert.test.tsx +5 -5
- package/src/alert/BaseAlert.tsx +5 -1
- package/src/alert/ClosableAlert.test.tsx +3 -3
- package/src/alert/ExpandableAlert.test.tsx +5 -5
- package/src/button/Button.test.tsx +1 -1
- package/src/button/Button.tsx +1 -1
- package/src/button/CloseButton.tsx +1 -1
- package/src/button/FloatingActionButton.tsx +5 -5
- package/src/button/IconButton.tsx +1 -1
- package/src/card/Card.tsx +3 -2
- package/src/card/index.tsx +1 -1
- package/src/datepicker/Calendar.tsx +9 -9
- package/src/datepicker/CalendarCell.tsx +9 -8
- package/src/datepicker/CalendarGrid.tsx +9 -9
- package/src/datepicker/CalendarHeader.tsx +2 -2
- package/src/datepicker/CalendarTriggerButton.tsx +5 -10
- package/src/datepicker/DateField.tsx +3 -3
- package/src/datepicker/DatePicker.tsx +6 -6
- package/src/datepicker/DateRangePicker.tsx +1 -1
- package/src/datepicker/DateTimeSegment.tsx +2 -2
- package/src/datepicker/RangeCalendar.tsx +8 -5
- package/src/datepicker/StyledField.tsx +2 -6
- package/src/datepicker/TimePicker.test.tsx +4 -4
- package/src/datepicker/TimePicker.tsx +5 -5
- package/src/index.tsx +0 -1
- package/src/input/CardSelect.tsx +3 -3
- package/src/input/Combobox.tsx +1 -1
- package/src/input/CountryCodeSelect.tsx +1 -1
- package/src/input/FormErrorMessage.tsx +1 -1
- package/src/input/InfoSelect.tsx +1 -1
- package/src/input/Input.tsx +1 -1
- package/src/input/InputElement.tsx +2 -2
- package/src/input/ListBox.tsx +3 -3
- package/src/input/NativeSelect.tsx +1 -1
- package/src/input/PasswordInput.tsx +1 -1
- package/src/input/PhoneNumberInput.tsx +13 -4
- package/src/input/Popover.tsx +4 -4
- package/src/input/RadioGroup.tsx +1 -1
- package/src/input/SearchInput.tsx +1 -1
- package/src/input/Switch.tsx +1 -1
- package/src/layout/Stack.tsx +1 -1
- package/src/linjetag/TravelTag.tsx +2 -2
- package/src/link/TextLink.tsx +1 -1
- package/src/list/index.tsx +0 -1
- package/src/loader/DarkSpinner.tsx +2 -4
- package/src/loader/SkeletonText.tsx +6 -3
- package/src/loader/useRotatingLabel.tsx +2 -2
- package/src/media-controller/index.test.tsx +6 -6
- package/src/modal/Drawer.tsx +2 -4
- package/src/modal/ModalHeader.tsx +1 -1
- package/src/provider/index.tsx +1 -1
- package/src/stepper/Stepper.tsx +10 -6
- package/src/stepper/StepperContext.tsx +7 -7
- package/src/stepper/StepperStep.tsx +56 -16
- package/src/theme/components/button.ts +25 -44
- package/src/theme/components/card.ts +7 -1
- package/src/theme/components/close-button.ts +3 -1
- package/src/theme/components/datepicker.ts +2 -2
- package/src/theme/components/divider.ts +17 -17
- package/src/theme/components/fab.ts +16 -13
- package/src/theme/components/info-tag.ts +7 -8
- package/src/theme/components/input.ts +4 -2
- package/src/theme/components/line-icon.ts +1 -2
- package/src/theme/components/media-controller-button.ts +1 -1
- package/src/theme/components/popover.ts +1 -2
- package/src/theme/components/select.ts +4 -4
- package/src/theme/components/stepper.ts +8 -155
- package/src/theme/components/switch.ts +9 -9
- package/src/theme/components/table.ts +3 -3
- package/src/theme/components/tabs.ts +24 -18
- package/src/theme/components/textarea.ts +1 -1
- package/src/theme/components/travel-tag.ts +2 -2
- package/src/theme/foundations/spacing.ts +1 -1
- package/src/theme/foundations/styles.ts +10 -10
- package/src/theme/utils/box-shadow-utils.ts +2 -2
- package/src/toast/ActionToast.test.tsx +1 -1
- package/src/toast/BaseToast.test.tsx +3 -3
- package/src/toast/ClosableToast.test.tsx +1 -1
- package/src/toast/index.tsx +1 -1
- package/src/toast/useToast.tsx +3 -3
- package/src/typography/Badge.tsx +1 -1
- package/src/typography/Text.tsx +1 -1
- package/tsconfig.json +1 -1
@@ -4,15 +4,15 @@ import tokens10__default from '@vygruppen/spor-design-tokens';
|
|
4
4
|
import * as tokens10 from '@vygruppen/spor-design-tokens';
|
5
5
|
export { tokens10 as tokens };
|
6
6
|
import * as React69 from 'react';
|
7
|
-
import React69__default, { createContext, useEffect, forwardRef as forwardRef$1, useRef, useState, useId, Suspense,
|
7
|
+
import React69__default, { createContext, useEffect, forwardRef as forwardRef$1, useRef, useState, useId, Suspense, useContext, useCallback, useMemo } from 'react';
|
8
8
|
import { CloseFill30Icon, CloseFill24Icon, CloseFill18Icon, CalendarOutline24Icon, CloseOutline24Icon, SearchOutline24Icon, InformationFill24Icon, InformationFill18Icon, WarningFill24Icon, WarningFill18Icon, ErrorFill24Icon, ErrorFill18Icon, LinkOutOutline24Icon, DropdownRightFill18Icon, DropdownLeftFill18Icon, DropdownDownFill18Icon, DropdownDownFill24Icon, DropdownUpFill24Icon, ArrowRightFill18Icon, DropdownLeftFill24Icon, ArrowLeftOutline24Icon, ArrowRightOutline24Icon, ErrorOutline24Icon, AltTransportOutline24Icon, WarningOutline24Icon, SuccessOutline24Icon, InformationOutline24Icon, TrainFill18Icon, TrainFill24Icon, TrainFill30Icon, ExpressBusFill18Icon, ExpressBusFill24Icon, ExpressBusFill30Icon, BusFill18Icon, BusFill24Icon, BusFill30Icon, FerryFill18Icon, FerryFill24Icon, FerryFill30Icon, SubwayFill18Icon, SubwayFill24Icon, SubwayFill30Icon, TramFill18Icon, TramFill24Icon, TramFill30Icon, AltTransportFill18Icon, AltTransportFill24Icon, AltTransportFill30Icon, WalkFill18Icon, WalkFill24Icon, WalkFill30Icon } from '@vygruppen/spor-icon-react';
|
9
9
|
import { inlineLoaderColorData, spinnerColorData, contentLoaderData, fullScreenLoaderWhiteData, inlineLoaderDarkData, fullScreenLoaderBlackData, inlineLoaderLightData, spinnerLightData, spinnerDarkData } from '@vygruppen/spor-loader';
|
10
10
|
import { useLottie } from 'lottie-react';
|
11
11
|
import { useDateSegment, useDateField, useDatePicker, I18nProvider, usePopover, DismissButton, Overlay, useOverlayTrigger, useButton, useProgressBar, useCalendar, useDateRangePicker, useDialog, useFilter, useComboBox, useListBox, useOption, useListBoxSection, useSelect, HiddenSelect, useCalendarGrid, useRangeCalendar, useTimeField, useCalendarCell } from 'react-aria';
|
12
12
|
import { motion } from 'framer-motion';
|
13
|
-
import {
|
13
|
+
import { createCalendar, GregorianCalendar, parseTime, endOfMonth, getWeeksInMonth, getLocalTimeZone, isSameMonth, isToday } from '@internationalized/date';
|
14
14
|
export { Time } from '@internationalized/date';
|
15
|
-
import { useOverlayTriggerState, Item, useTimeFieldState, useComboBoxState, useSelectState } from 'react-stately';
|
15
|
+
import { useDateFieldState, useDatePickerState, useOverlayTriggerState, Item, useCalendarState, useDateRangePickerState, useTimeFieldState, useComboBoxState, useSelectState, useRangeCalendarState } from 'react-stately';
|
16
16
|
export { Item, Section } from 'react-stately';
|
17
17
|
import { useSwipeable } from 'react-swipeable';
|
18
18
|
import { Global, keyframes } from '@emotion/react';
|
@@ -1439,7 +1439,11 @@ var texts5 = createTexts({
|
|
1439
1439
|
en: "Alternative transport"
|
1440
1440
|
}
|
1441
1441
|
});
|
1442
|
-
var BaseAlert = ({
|
1442
|
+
var BaseAlert = ({
|
1443
|
+
variant,
|
1444
|
+
children,
|
1445
|
+
...boxProps
|
1446
|
+
}) => {
|
1443
1447
|
const styles3 = useMultiStyleConfig("Alert", { variant });
|
1444
1448
|
return /* @__PURE__ */ React69__default.createElement(Box, { __css: styles3.container, ...boxProps }, children);
|
1445
1449
|
};
|
@@ -1547,1734 +1551,6 @@ var Card = forwardRef(
|
|
1547
1551
|
return /* @__PURE__ */ React69__default.createElement(Box, { __css: styles3, ...props, ref }, children);
|
1548
1552
|
}
|
1549
1553
|
);
|
1550
|
-
function $458b0a5536c1a7cf$export$40bfa8c7b0832715(value, defaultValue, onChange) {
|
1551
|
-
let [stateValue, setStateValue] = (useState)(value || defaultValue);
|
1552
|
-
let isControlledRef = (useRef)(value !== void 0);
|
1553
|
-
let isControlled = value !== void 0;
|
1554
|
-
(useEffect)(() => {
|
1555
|
-
let wasControlled = isControlledRef.current;
|
1556
|
-
if (wasControlled !== isControlled)
|
1557
|
-
console.warn(`WARN: A component changed from ${wasControlled ? "controlled" : "uncontrolled"} to ${isControlled ? "controlled" : "uncontrolled"}.`);
|
1558
|
-
isControlledRef.current = isControlled;
|
1559
|
-
}, [
|
1560
|
-
isControlled
|
1561
|
-
]);
|
1562
|
-
let currentValue = isControlled ? value : stateValue;
|
1563
|
-
let setValue = (useCallback)((value2, ...args) => {
|
1564
|
-
let onChangeCaller = (value3, ...onChangeArgs) => {
|
1565
|
-
if (onChange) {
|
1566
|
-
if (!Object.is(currentValue, value3))
|
1567
|
-
onChange(value3, ...onChangeArgs);
|
1568
|
-
}
|
1569
|
-
if (!isControlled)
|
1570
|
-
currentValue = value3;
|
1571
|
-
};
|
1572
|
-
if (typeof value2 === "function") {
|
1573
|
-
console.warn("We can not support a function callback. See Github Issues for details https://github.com/adobe/react-spectrum/issues/2320");
|
1574
|
-
let updateFunction = (oldValue, ...functionArgs) => {
|
1575
|
-
let interceptedValue = value2(isControlled ? currentValue : oldValue, ...functionArgs);
|
1576
|
-
onChangeCaller(interceptedValue, ...args);
|
1577
|
-
if (!isControlled)
|
1578
|
-
return interceptedValue;
|
1579
|
-
return oldValue;
|
1580
|
-
};
|
1581
|
-
setStateValue(updateFunction);
|
1582
|
-
} else {
|
1583
|
-
if (!isControlled)
|
1584
|
-
setStateValue(value2);
|
1585
|
-
onChangeCaller(value2, ...args);
|
1586
|
-
}
|
1587
|
-
}, [
|
1588
|
-
isControlled,
|
1589
|
-
currentValue,
|
1590
|
-
onChange
|
1591
|
-
]);
|
1592
|
-
return [
|
1593
|
-
currentValue,
|
1594
|
-
setValue
|
1595
|
-
];
|
1596
|
-
}
|
1597
|
-
|
1598
|
-
// ../../node_modules/@react-stately/overlays/dist/import.mjs
|
1599
|
-
function $fc909762b330b746$export$61c6a8c84e605fb6(props) {
|
1600
|
-
let [isOpen, setOpen] = ($458b0a5536c1a7cf$export$40bfa8c7b0832715)(props.isOpen, props.defaultOpen || false, props.onOpenChange);
|
1601
|
-
const open = (useCallback)(() => {
|
1602
|
-
setOpen(true);
|
1603
|
-
}, [
|
1604
|
-
setOpen
|
1605
|
-
]);
|
1606
|
-
const close = (useCallback)(() => {
|
1607
|
-
setOpen(false);
|
1608
|
-
}, [
|
1609
|
-
setOpen
|
1610
|
-
]);
|
1611
|
-
const toggle = (useCallback)(() => {
|
1612
|
-
setOpen(!isOpen);
|
1613
|
-
}, [
|
1614
|
-
setOpen,
|
1615
|
-
isOpen
|
1616
|
-
]);
|
1617
|
-
return {
|
1618
|
-
isOpen,
|
1619
|
-
setOpen,
|
1620
|
-
open,
|
1621
|
-
close,
|
1622
|
-
toggle
|
1623
|
-
};
|
1624
|
-
}
|
1625
|
-
|
1626
|
-
// ../../node_modules/@internationalized/string/dist/import.mjs
|
1627
|
-
var $5b160d28a433310d$export$c17fa47878dc55b6 = class {
|
1628
|
-
/** Returns a localized string for the given key and locale. */
|
1629
|
-
getStringForLocale(key, locale) {
|
1630
|
-
let strings = this.strings[locale];
|
1631
|
-
if (!strings) {
|
1632
|
-
strings = $5b160d28a433310d$var$getStringsForLocale(locale, this.strings, this.defaultLocale);
|
1633
|
-
this.strings[locale] = strings;
|
1634
|
-
}
|
1635
|
-
let string = strings[key];
|
1636
|
-
if (!string)
|
1637
|
-
throw new Error(`Could not find intl message ${key} in ${locale} locale`);
|
1638
|
-
return string;
|
1639
|
-
}
|
1640
|
-
constructor(messages, defaultLocale = "en-US") {
|
1641
|
-
this.strings = {
|
1642
|
-
...messages
|
1643
|
-
};
|
1644
|
-
this.defaultLocale = defaultLocale;
|
1645
|
-
}
|
1646
|
-
};
|
1647
|
-
function $5b160d28a433310d$var$getStringsForLocale(locale, strings, defaultLocale = "en-US") {
|
1648
|
-
if (strings[locale])
|
1649
|
-
return strings[locale];
|
1650
|
-
let language = $5b160d28a433310d$var$getLanguage(locale);
|
1651
|
-
if (strings[language])
|
1652
|
-
return strings[language];
|
1653
|
-
for (let key in strings) {
|
1654
|
-
if (key.startsWith(language + "-"))
|
1655
|
-
return strings[key];
|
1656
|
-
}
|
1657
|
-
return strings[defaultLocale];
|
1658
|
-
}
|
1659
|
-
function $5b160d28a433310d$var$getLanguage(locale) {
|
1660
|
-
if (Intl.Locale)
|
1661
|
-
return new Intl.Locale(locale).language;
|
1662
|
-
return locale.split("-")[0];
|
1663
|
-
}
|
1664
|
-
|
1665
|
-
// ../../node_modules/@react-stately/datepicker/dist/import.mjs
|
1666
|
-
function $35a22f14a1f04b11$export$eac50920cf2fd59a(value, minValue, maxValue) {
|
1667
|
-
return value != null && (minValue != null && value.compare(minValue) < 0 || maxValue != null && value.compare(maxValue) > 0);
|
1668
|
-
}
|
1669
|
-
var $35a22f14a1f04b11$var$DEFAULT_FIELD_OPTIONS = {
|
1670
|
-
year: "numeric",
|
1671
|
-
month: "numeric",
|
1672
|
-
day: "numeric",
|
1673
|
-
hour: "numeric",
|
1674
|
-
minute: "2-digit",
|
1675
|
-
second: "2-digit"
|
1676
|
-
};
|
1677
|
-
var $35a22f14a1f04b11$var$TWO_DIGIT_FIELD_OPTIONS = {
|
1678
|
-
year: "numeric",
|
1679
|
-
month: "2-digit",
|
1680
|
-
day: "2-digit",
|
1681
|
-
hour: "2-digit",
|
1682
|
-
minute: "2-digit",
|
1683
|
-
second: "2-digit"
|
1684
|
-
};
|
1685
|
-
function $35a22f14a1f04b11$export$7e319ea407e63bc0(fieldOptions, options) {
|
1686
|
-
let defaultFieldOptions = options.shouldForceLeadingZeros ? $35a22f14a1f04b11$var$TWO_DIGIT_FIELD_OPTIONS : $35a22f14a1f04b11$var$DEFAULT_FIELD_OPTIONS;
|
1687
|
-
fieldOptions = {
|
1688
|
-
...defaultFieldOptions,
|
1689
|
-
...fieldOptions
|
1690
|
-
};
|
1691
|
-
let granularity = options.granularity || "minute";
|
1692
|
-
let keys = Object.keys(fieldOptions);
|
1693
|
-
var _options_maxGranularity;
|
1694
|
-
let startIdx = keys.indexOf((_options_maxGranularity = options.maxGranularity) !== null && _options_maxGranularity !== void 0 ? _options_maxGranularity : "year");
|
1695
|
-
if (startIdx < 0)
|
1696
|
-
startIdx = 0;
|
1697
|
-
let endIdx = keys.indexOf(granularity);
|
1698
|
-
if (endIdx < 0)
|
1699
|
-
endIdx = 2;
|
1700
|
-
if (startIdx > endIdx)
|
1701
|
-
throw new Error("maxGranularity must be greater than granularity");
|
1702
|
-
let opts = keys.slice(startIdx, endIdx + 1).reduce((opts2, key) => {
|
1703
|
-
opts2[key] = fieldOptions[key];
|
1704
|
-
return opts2;
|
1705
|
-
}, {});
|
1706
|
-
if (options.hourCycle != null)
|
1707
|
-
opts.hour12 = options.hourCycle === 12;
|
1708
|
-
opts.timeZone = options.timeZone || "UTC";
|
1709
|
-
let hasTime = granularity === "hour" || granularity === "minute" || granularity === "second";
|
1710
|
-
if (hasTime && options.timeZone && !options.hideTimeZone)
|
1711
|
-
opts.timeZoneName = "short";
|
1712
|
-
if (options.showEra && startIdx === 0)
|
1713
|
-
opts.era = "short";
|
1714
|
-
return opts;
|
1715
|
-
}
|
1716
|
-
function $35a22f14a1f04b11$export$c5221a78ef73c5e9(placeholderValue) {
|
1717
|
-
if (placeholderValue && "hour" in placeholderValue)
|
1718
|
-
return placeholderValue;
|
1719
|
-
return new (Time)();
|
1720
|
-
}
|
1721
|
-
function $35a22f14a1f04b11$export$61a490a80c552550(value, calendar) {
|
1722
|
-
if (value === null)
|
1723
|
-
return null;
|
1724
|
-
if (!value)
|
1725
|
-
return void 0;
|
1726
|
-
return (toCalendar)(value, calendar);
|
1727
|
-
}
|
1728
|
-
function $35a22f14a1f04b11$export$66aa2b09de4b1ea5(placeholderValue, granularity, calendar, timeZone) {
|
1729
|
-
if (placeholderValue)
|
1730
|
-
return $35a22f14a1f04b11$export$61a490a80c552550(placeholderValue, calendar);
|
1731
|
-
let date = (toCalendar)((now)(timeZone).set({
|
1732
|
-
hour: 0,
|
1733
|
-
minute: 0,
|
1734
|
-
second: 0,
|
1735
|
-
millisecond: 0
|
1736
|
-
}), calendar);
|
1737
|
-
if (granularity === "year" || granularity === "month" || granularity === "day")
|
1738
|
-
return (toCalendarDate)(date);
|
1739
|
-
if (!timeZone)
|
1740
|
-
return (toCalendarDateTime)(date);
|
1741
|
-
return date;
|
1742
|
-
}
|
1743
|
-
function $35a22f14a1f04b11$export$2440da353cedad43(v, granularity) {
|
1744
|
-
let defaultTimeZone = v && "timeZone" in v ? v.timeZone : void 0;
|
1745
|
-
let defaultGranularity = v && "minute" in v ? "minute" : "day";
|
1746
|
-
if (v && granularity && !(granularity in v))
|
1747
|
-
throw new Error("Invalid granularity " + granularity + " for value " + v.toString());
|
1748
|
-
let [lastValue, setLastValue] = (useState)([
|
1749
|
-
defaultGranularity,
|
1750
|
-
defaultTimeZone
|
1751
|
-
]);
|
1752
|
-
if (v && (lastValue[0] !== defaultGranularity || lastValue[1] !== defaultTimeZone))
|
1753
|
-
setLastValue([
|
1754
|
-
defaultGranularity,
|
1755
|
-
defaultTimeZone
|
1756
|
-
]);
|
1757
|
-
if (!granularity)
|
1758
|
-
granularity = v ? defaultGranularity : lastValue[0];
|
1759
|
-
let timeZone = v ? defaultTimeZone : lastValue[1];
|
1760
|
-
return [
|
1761
|
-
granularity,
|
1762
|
-
timeZone
|
1763
|
-
];
|
1764
|
-
}
|
1765
|
-
function $ab5bf3f618090389$export$87194bb378cc3ac2(props) {
|
1766
|
-
var _props_isDateUnavailable;
|
1767
|
-
let overlayState = ($fc909762b330b746$export$61c6a8c84e605fb6)(props);
|
1768
|
-
let [value, setValue] = ($458b0a5536c1a7cf$export$40bfa8c7b0832715)(props.value, props.defaultValue || null, props.onChange);
|
1769
|
-
let v = value || props.placeholderValue;
|
1770
|
-
let [granularity, defaultTimeZone] = ($35a22f14a1f04b11$export$2440da353cedad43)(v, props.granularity);
|
1771
|
-
let dateValue = value != null ? value.toDate(defaultTimeZone !== null && defaultTimeZone !== void 0 ? defaultTimeZone : "UTC") : null;
|
1772
|
-
let hasTime = granularity === "hour" || granularity === "minute" || granularity === "second";
|
1773
|
-
var _props_shouldCloseOnSelect;
|
1774
|
-
let shouldCloseOnSelect = (_props_shouldCloseOnSelect = props.shouldCloseOnSelect) !== null && _props_shouldCloseOnSelect !== void 0 ? _props_shouldCloseOnSelect : true;
|
1775
|
-
let [selectedDate, setSelectedDate] = (useState)(null);
|
1776
|
-
let [selectedTime, setSelectedTime] = (useState)(null);
|
1777
|
-
if (value) {
|
1778
|
-
selectedDate = value;
|
1779
|
-
if ("hour" in value)
|
1780
|
-
selectedTime = value;
|
1781
|
-
}
|
1782
|
-
if (v && !(granularity in v))
|
1783
|
-
throw new Error("Invalid granularity " + granularity + " for value " + v.toString());
|
1784
|
-
let commitValue = (date, time) => {
|
1785
|
-
setValue("timeZone" in time ? time.set((toCalendarDate)(date)) : (toCalendarDateTime)(date, time));
|
1786
|
-
setSelectedDate(null);
|
1787
|
-
setSelectedTime(null);
|
1788
|
-
};
|
1789
|
-
let selectDate = (newValue) => {
|
1790
|
-
let shouldClose = typeof shouldCloseOnSelect === "function" ? shouldCloseOnSelect() : shouldCloseOnSelect;
|
1791
|
-
if (hasTime) {
|
1792
|
-
if (selectedTime || shouldClose)
|
1793
|
-
commitValue(newValue, selectedTime || ($35a22f14a1f04b11$export$c5221a78ef73c5e9)(props.placeholderValue));
|
1794
|
-
else
|
1795
|
-
setSelectedDate(newValue);
|
1796
|
-
} else
|
1797
|
-
setValue(newValue);
|
1798
|
-
if (shouldClose)
|
1799
|
-
overlayState.setOpen(false);
|
1800
|
-
};
|
1801
|
-
let selectTime = (newValue) => {
|
1802
|
-
if (selectedDate && newValue)
|
1803
|
-
commitValue(selectedDate, newValue);
|
1804
|
-
else
|
1805
|
-
setSelectedTime(newValue);
|
1806
|
-
};
|
1807
|
-
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);
|
1808
|
-
return {
|
1809
|
-
value,
|
1810
|
-
setValue,
|
1811
|
-
dateValue: selectedDate,
|
1812
|
-
timeValue: selectedTime,
|
1813
|
-
setDateValue: selectDate,
|
1814
|
-
setTimeValue: selectTime,
|
1815
|
-
granularity,
|
1816
|
-
hasTime,
|
1817
|
-
...overlayState,
|
1818
|
-
setOpen(isOpen) {
|
1819
|
-
if (!isOpen && !value && selectedDate && hasTime)
|
1820
|
-
commitValue(selectedDate, selectedTime || ($35a22f14a1f04b11$export$c5221a78ef73c5e9)(props.placeholderValue));
|
1821
|
-
overlayState.setOpen(isOpen);
|
1822
|
-
},
|
1823
|
-
validationState,
|
1824
|
-
formatValue(locale, fieldOptions) {
|
1825
|
-
if (!dateValue)
|
1826
|
-
return "";
|
1827
|
-
let formatOptions = ($35a22f14a1f04b11$export$7e319ea407e63bc0)(fieldOptions, {
|
1828
|
-
granularity,
|
1829
|
-
timeZone: defaultTimeZone,
|
1830
|
-
hideTimeZone: props.hideTimeZone,
|
1831
|
-
hourCycle: props.hourCycle,
|
1832
|
-
showEra: value.calendar.identifier === "gregory" && value.era === "BC"
|
1833
|
-
});
|
1834
|
-
let formatter = new (DateFormatter)(locale, formatOptions);
|
1835
|
-
return formatter.format(dateValue);
|
1836
|
-
}
|
1837
|
-
};
|
1838
|
-
}
|
1839
|
-
var $3e3ed55ab2966714$var$placeholders = new ($5b160d28a433310d$export$c17fa47878dc55b6)({
|
1840
|
-
ach: {
|
1841
|
-
year: "mwaka",
|
1842
|
-
month: "dwe",
|
1843
|
-
day: "nino"
|
1844
|
-
},
|
1845
|
-
af: {
|
1846
|
-
year: "jjjj",
|
1847
|
-
month: "mm",
|
1848
|
-
day: "dd"
|
1849
|
-
},
|
1850
|
-
am: {
|
1851
|
-
year: "\u12D3\u12D3\u12D3\u12D3",
|
1852
|
-
month: "\u121A\u121C",
|
1853
|
-
day: "\u1240\u1240"
|
1854
|
-
},
|
1855
|
-
an: {
|
1856
|
-
year: "aaaa",
|
1857
|
-
month: "mm",
|
1858
|
-
day: "dd"
|
1859
|
-
},
|
1860
|
-
ar: {
|
1861
|
-
year: "\u0633\u0646\u0629",
|
1862
|
-
month: "\u0634\u0647\u0631",
|
1863
|
-
day: "\u064A\u0648\u0645"
|
1864
|
-
},
|
1865
|
-
ast: {
|
1866
|
-
year: "aaaa",
|
1867
|
-
month: "mm",
|
1868
|
-
day: "dd"
|
1869
|
-
},
|
1870
|
-
az: {
|
1871
|
-
year: "iiii",
|
1872
|
-
month: "aa",
|
1873
|
-
day: "gg"
|
1874
|
-
},
|
1875
|
-
be: {
|
1876
|
-
year: "\u0433\u0433\u0433\u0433",
|
1877
|
-
month: "\u043C\u043C",
|
1878
|
-
day: "\u0434\u0434"
|
1879
|
-
},
|
1880
|
-
bg: {
|
1881
|
-
year: "\u0433\u0433\u0433\u0433",
|
1882
|
-
month: "\u043C\u043C",
|
1883
|
-
day: "\u0434\u0434"
|
1884
|
-
},
|
1885
|
-
bn: {
|
1886
|
-
year: "yyyy",
|
1887
|
-
month: "\u09AE\u09BF\u09AE\u09BF",
|
1888
|
-
day: "dd"
|
1889
|
-
},
|
1890
|
-
br: {
|
1891
|
-
year: "bbbb",
|
1892
|
-
month: "mm",
|
1893
|
-
day: "dd"
|
1894
|
-
},
|
1895
|
-
bs: {
|
1896
|
-
year: "gggg",
|
1897
|
-
month: "mm",
|
1898
|
-
day: "dd"
|
1899
|
-
},
|
1900
|
-
ca: {
|
1901
|
-
year: "aaaa",
|
1902
|
-
month: "mm",
|
1903
|
-
day: "dd"
|
1904
|
-
},
|
1905
|
-
cak: {
|
1906
|
-
year: "jjjj",
|
1907
|
-
month: "ii",
|
1908
|
-
day: "q'q'"
|
1909
|
-
},
|
1910
|
-
ckb: {
|
1911
|
-
year: "\u0633\u0627\u06B5",
|
1912
|
-
month: "\u0645\u0627\u0646\u06AF",
|
1913
|
-
day: "\u0695\u06C6\u0698"
|
1914
|
-
},
|
1915
|
-
cs: {
|
1916
|
-
year: "rrrr",
|
1917
|
-
month: "mm",
|
1918
|
-
day: "dd"
|
1919
|
-
},
|
1920
|
-
cy: {
|
1921
|
-
year: "bbbb",
|
1922
|
-
month: "mm",
|
1923
|
-
day: "dd"
|
1924
|
-
},
|
1925
|
-
da: {
|
1926
|
-
year: "\xE5\xE5\xE5\xE5",
|
1927
|
-
month: "mm",
|
1928
|
-
day: "dd"
|
1929
|
-
},
|
1930
|
-
de: {
|
1931
|
-
year: "jjjj",
|
1932
|
-
month: "mm",
|
1933
|
-
day: "tt"
|
1934
|
-
},
|
1935
|
-
dsb: {
|
1936
|
-
year: "llll",
|
1937
|
-
month: "mm",
|
1938
|
-
day: "\u017A\u017A"
|
1939
|
-
},
|
1940
|
-
el: {
|
1941
|
-
year: "\u03B5\u03B5\u03B5\u03B5",
|
1942
|
-
month: "\u03BC\u03BC",
|
1943
|
-
day: "\u03B7\u03B7"
|
1944
|
-
},
|
1945
|
-
en: {
|
1946
|
-
year: "yyyy",
|
1947
|
-
month: "mm",
|
1948
|
-
day: "dd"
|
1949
|
-
},
|
1950
|
-
eo: {
|
1951
|
-
year: "jjjj",
|
1952
|
-
month: "mm",
|
1953
|
-
day: "tt"
|
1954
|
-
},
|
1955
|
-
es: {
|
1956
|
-
year: "aaaa",
|
1957
|
-
month: "mm",
|
1958
|
-
day: "dd"
|
1959
|
-
},
|
1960
|
-
et: {
|
1961
|
-
year: "aaaa",
|
1962
|
-
month: "kk",
|
1963
|
-
day: "pp"
|
1964
|
-
},
|
1965
|
-
eu: {
|
1966
|
-
year: "uuuu",
|
1967
|
-
month: "hh",
|
1968
|
-
day: "ee"
|
1969
|
-
},
|
1970
|
-
fa: {
|
1971
|
-
year: "\u0633\u0627\u0644",
|
1972
|
-
month: "\u0645\u0627\u0647",
|
1973
|
-
day: "\u0631\u0648\u0632"
|
1974
|
-
},
|
1975
|
-
ff: {
|
1976
|
-
year: "hhhh",
|
1977
|
-
month: "ll",
|
1978
|
-
day: "\xF1\xF1"
|
1979
|
-
},
|
1980
|
-
fi: {
|
1981
|
-
year: "vvvv",
|
1982
|
-
month: "kk",
|
1983
|
-
day: "pp"
|
1984
|
-
},
|
1985
|
-
fr: {
|
1986
|
-
year: "aaaa",
|
1987
|
-
month: "mm",
|
1988
|
-
day: "jj"
|
1989
|
-
},
|
1990
|
-
fy: {
|
1991
|
-
year: "jjjj",
|
1992
|
-
month: "mm",
|
1993
|
-
day: "dd"
|
1994
|
-
},
|
1995
|
-
ga: {
|
1996
|
-
year: "bbbb",
|
1997
|
-
month: "mm",
|
1998
|
-
day: "ll"
|
1999
|
-
},
|
2000
|
-
gd: {
|
2001
|
-
year: "bbbb",
|
2002
|
-
month: "mm",
|
2003
|
-
day: "ll"
|
2004
|
-
},
|
2005
|
-
gl: {
|
2006
|
-
year: "aaaa",
|
2007
|
-
month: "mm",
|
2008
|
-
day: "dd"
|
2009
|
-
},
|
2010
|
-
he: {
|
2011
|
-
year: "\u05E9\u05E0\u05D4",
|
2012
|
-
month: "\u05D7\u05D5\u05D3\u05E9",
|
2013
|
-
day: "\u05D9\u05D5\u05DD"
|
2014
|
-
},
|
2015
|
-
hr: {
|
2016
|
-
year: "gggg",
|
2017
|
-
month: "mm",
|
2018
|
-
day: "dd"
|
2019
|
-
},
|
2020
|
-
hsb: {
|
2021
|
-
year: "llll",
|
2022
|
-
month: "mm",
|
2023
|
-
day: "dd"
|
2024
|
-
},
|
2025
|
-
hu: {
|
2026
|
-
year: "\xE9\xE9\xE9\xE9",
|
2027
|
-
month: "hh",
|
2028
|
-
day: "nn"
|
2029
|
-
},
|
2030
|
-
ia: {
|
2031
|
-
year: "aaaa",
|
2032
|
-
month: "mm",
|
2033
|
-
day: "dd"
|
2034
|
-
},
|
2035
|
-
id: {
|
2036
|
-
year: "tttt",
|
2037
|
-
month: "bb",
|
2038
|
-
day: "hh"
|
2039
|
-
},
|
2040
|
-
it: {
|
2041
|
-
year: "aaaa",
|
2042
|
-
month: "mm",
|
2043
|
-
day: "gg"
|
2044
|
-
},
|
2045
|
-
ja: {
|
2046
|
-
year: " \u5E74 ",
|
2047
|
-
month: "\u6708",
|
2048
|
-
day: "\u65E5"
|
2049
|
-
},
|
2050
|
-
ka: {
|
2051
|
-
year: "\u10EC\u10EC\u10EC\u10EC",
|
2052
|
-
month: "\u10D7\u10D7",
|
2053
|
-
day: "\u10E0\u10E0"
|
2054
|
-
},
|
2055
|
-
kk: {
|
2056
|
-
year: "\u0436\u0436\u0436\u0436",
|
2057
|
-
month: "\u0430\u0430",
|
2058
|
-
day: "\u043A\u043A"
|
2059
|
-
},
|
2060
|
-
kn: {
|
2061
|
-
year: "\u0CB5\u0CB5\u0CB5\u0CB5",
|
2062
|
-
month: "\u0CAE\u0CBF\u0CAE\u0CC0",
|
2063
|
-
day: "\u0CA6\u0CBF\u0CA6\u0CBF"
|
2064
|
-
},
|
2065
|
-
ko: {
|
2066
|
-
year: "\uC5F0\uB3C4",
|
2067
|
-
month: "\uC6D4",
|
2068
|
-
day: "\uC77C"
|
2069
|
-
},
|
2070
|
-
lb: {
|
2071
|
-
year: "jjjj",
|
2072
|
-
month: "mm",
|
2073
|
-
day: "dd"
|
2074
|
-
},
|
2075
|
-
lo: {
|
2076
|
-
year: "\u0E9B\u0E9B\u0E9B\u0E9B",
|
2077
|
-
month: "\u0E94\u0E94",
|
2078
|
-
day: "\u0EA7\u0EA7"
|
2079
|
-
},
|
2080
|
-
lt: {
|
2081
|
-
year: "mmmm",
|
2082
|
-
month: "mm",
|
2083
|
-
day: "dd"
|
2084
|
-
},
|
2085
|
-
lv: {
|
2086
|
-
year: "gggg",
|
2087
|
-
month: "mm",
|
2088
|
-
day: "dd"
|
2089
|
-
},
|
2090
|
-
meh: {
|
2091
|
-
year: "aaaa",
|
2092
|
-
month: "mm",
|
2093
|
-
day: "dd"
|
2094
|
-
},
|
2095
|
-
ml: {
|
2096
|
-
year: "\u0D35\u0D7C\u0D37\u0D02",
|
2097
|
-
month: "\u0D2E\u0D3E\u0D38\u0D02",
|
2098
|
-
day: "\u0D24\u0D40\u0D2F\u0D24\u0D3F"
|
2099
|
-
},
|
2100
|
-
ms: {
|
2101
|
-
year: "tttt",
|
2102
|
-
month: "mm",
|
2103
|
-
day: "hh"
|
2104
|
-
},
|
2105
|
-
nl: {
|
2106
|
-
year: "jjjj",
|
2107
|
-
month: "mm",
|
2108
|
-
day: "dd"
|
2109
|
-
},
|
2110
|
-
nn: {
|
2111
|
-
year: "\xE5\xE5\xE5\xE5",
|
2112
|
-
month: "mm",
|
2113
|
-
day: "dd"
|
2114
|
-
},
|
2115
|
-
no: {
|
2116
|
-
year: "\xE5\xE5\xE5\xE5",
|
2117
|
-
month: "mm",
|
2118
|
-
day: "dd"
|
2119
|
-
},
|
2120
|
-
oc: {
|
2121
|
-
year: "aaaa",
|
2122
|
-
month: "mm",
|
2123
|
-
day: "jj"
|
2124
|
-
},
|
2125
|
-
pl: {
|
2126
|
-
year: "rrrr",
|
2127
|
-
month: "mm",
|
2128
|
-
day: "dd"
|
2129
|
-
},
|
2130
|
-
pt: {
|
2131
|
-
year: "aaaa",
|
2132
|
-
month: "mm",
|
2133
|
-
day: "dd"
|
2134
|
-
},
|
2135
|
-
rm: {
|
2136
|
-
year: "oooo",
|
2137
|
-
month: "mm",
|
2138
|
-
day: "dd"
|
2139
|
-
},
|
2140
|
-
ro: {
|
2141
|
-
year: "aaaa",
|
2142
|
-
month: "ll",
|
2143
|
-
day: "zz"
|
2144
|
-
},
|
2145
|
-
ru: {
|
2146
|
-
year: "\u0433\u0433\u0433\u0433",
|
2147
|
-
month: "\u043C\u043C",
|
2148
|
-
day: "\u0434\u0434"
|
2149
|
-
},
|
2150
|
-
sc: {
|
2151
|
-
year: "aaaa",
|
2152
|
-
month: "mm",
|
2153
|
-
day: "dd"
|
2154
|
-
},
|
2155
|
-
scn: {
|
2156
|
-
year: "aaaa",
|
2157
|
-
month: "mm",
|
2158
|
-
day: "jj"
|
2159
|
-
},
|
2160
|
-
sk: {
|
2161
|
-
year: "rrrr",
|
2162
|
-
month: "mm",
|
2163
|
-
day: "dd"
|
2164
|
-
},
|
2165
|
-
sl: {
|
2166
|
-
year: "llll",
|
2167
|
-
month: "mm",
|
2168
|
-
day: "dd"
|
2169
|
-
},
|
2170
|
-
sr: {
|
2171
|
-
year: "\u0433\u0433\u0433\u0433",
|
2172
|
-
month: "\u043C\u043C",
|
2173
|
-
day: "\u0434\u0434"
|
2174
|
-
},
|
2175
|
-
sv: {
|
2176
|
-
year: "\xE5\xE5\xE5\xE5",
|
2177
|
-
month: "mm",
|
2178
|
-
day: "dd"
|
2179
|
-
},
|
2180
|
-
szl: {
|
2181
|
-
year: "rrrr",
|
2182
|
-
month: "mm",
|
2183
|
-
day: "dd"
|
2184
|
-
},
|
2185
|
-
tg: {
|
2186
|
-
year: "\u0441\u0441\u0441\u0441",
|
2187
|
-
month: "\u043C\u043C",
|
2188
|
-
day: "\u0440\u0440"
|
2189
|
-
},
|
2190
|
-
th: {
|
2191
|
-
year: "\u0E1B\u0E1B\u0E1B\u0E1B",
|
2192
|
-
month: "\u0E14\u0E14",
|
2193
|
-
day: "\u0E27\u0E27"
|
2194
|
-
},
|
2195
|
-
tr: {
|
2196
|
-
year: "yyyy",
|
2197
|
-
month: "aa",
|
2198
|
-
day: "gg"
|
2199
|
-
},
|
2200
|
-
uk: {
|
2201
|
-
year: "\u0440\u0440\u0440\u0440",
|
2202
|
-
month: "\u043C\u043C",
|
2203
|
-
day: "\u0434\u0434"
|
2204
|
-
},
|
2205
|
-
"zh-CN": {
|
2206
|
-
year: "\u5E74",
|
2207
|
-
month: "\u6708",
|
2208
|
-
day: "\u65E5"
|
2209
|
-
},
|
2210
|
-
"zh-TW": {
|
2211
|
-
year: "\u5E74",
|
2212
|
-
month: "\u6708",
|
2213
|
-
day: "\u65E5"
|
2214
|
-
}
|
2215
|
-
}, "en");
|
2216
|
-
function $3e3ed55ab2966714$export$d3f5c5e0a5023fa0(field, value, locale) {
|
2217
|
-
if (field === "era" || field === "dayPeriod")
|
2218
|
-
return value;
|
2219
|
-
if (field === "year" || field === "month" || field === "day")
|
2220
|
-
return $3e3ed55ab2966714$var$placeholders.getStringForLocale(field, locale);
|
2221
|
-
return "\u2013\u2013";
|
2222
|
-
}
|
2223
|
-
var $3c0fc76039f1c516$var$EDITABLE_SEGMENTS = {
|
2224
|
-
year: true,
|
2225
|
-
month: true,
|
2226
|
-
day: true,
|
2227
|
-
hour: true,
|
2228
|
-
minute: true,
|
2229
|
-
second: true,
|
2230
|
-
dayPeriod: true,
|
2231
|
-
era: true
|
2232
|
-
};
|
2233
|
-
var $3c0fc76039f1c516$var$PAGE_STEP = {
|
2234
|
-
year: 5,
|
2235
|
-
month: 2,
|
2236
|
-
day: 7,
|
2237
|
-
hour: 2,
|
2238
|
-
minute: 15,
|
2239
|
-
second: 15
|
2240
|
-
};
|
2241
|
-
var $3c0fc76039f1c516$var$TYPE_MAPPING = {
|
2242
|
-
dayperiod: "dayPeriod"
|
2243
|
-
};
|
2244
|
-
function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
|
2245
|
-
let { locale, createCalendar: createCalendar4, hideTimeZone, isDisabled, isReadOnly, isRequired } = props;
|
2246
|
-
let v = props.value || props.defaultValue || props.placeholderValue;
|
2247
|
-
let [granularity, defaultTimeZone] = ($35a22f14a1f04b11$export$2440da353cedad43)(v, props.granularity);
|
2248
|
-
let timeZone = defaultTimeZone || "UTC";
|
2249
|
-
if (v && !(granularity in v))
|
2250
|
-
throw new Error("Invalid granularity " + granularity + " for value " + v.toString());
|
2251
|
-
let defaultFormatter = (useMemo)(() => new (DateFormatter)(locale), [
|
2252
|
-
locale
|
2253
|
-
]);
|
2254
|
-
let calendar = (useMemo)(() => createCalendar4(defaultFormatter.resolvedOptions().calendar), [
|
2255
|
-
createCalendar4,
|
2256
|
-
defaultFormatter
|
2257
|
-
]);
|
2258
|
-
let [value, setDate] = ($458b0a5536c1a7cf$export$40bfa8c7b0832715)(props.value, props.defaultValue, props.onChange);
|
2259
|
-
let calendarValue = (useMemo)(() => ($35a22f14a1f04b11$export$61a490a80c552550)(value, calendar), [
|
2260
|
-
value,
|
2261
|
-
calendar
|
2262
|
-
]);
|
2263
|
-
let [placeholderDate, setPlaceholderDate] = (useState)(() => ($35a22f14a1f04b11$export$66aa2b09de4b1ea5)(props.placeholderValue, granularity, calendar, defaultTimeZone));
|
2264
|
-
let val = calendarValue || placeholderDate;
|
2265
|
-
let showEra = calendar.identifier === "gregory" && val.era === "BC";
|
2266
|
-
var _props_maxGranularity;
|
2267
|
-
let formatOpts = (useMemo)(() => ({
|
2268
|
-
granularity,
|
2269
|
-
maxGranularity: (_props_maxGranularity = props.maxGranularity) !== null && _props_maxGranularity !== void 0 ? _props_maxGranularity : "year",
|
2270
|
-
timeZone: defaultTimeZone,
|
2271
|
-
hideTimeZone,
|
2272
|
-
hourCycle: props.hourCycle,
|
2273
|
-
showEra,
|
2274
|
-
shouldForceLeadingZeros: props.shouldForceLeadingZeros
|
2275
|
-
}), [
|
2276
|
-
props.maxGranularity,
|
2277
|
-
granularity,
|
2278
|
-
props.hourCycle,
|
2279
|
-
props.shouldForceLeadingZeros,
|
2280
|
-
defaultTimeZone,
|
2281
|
-
hideTimeZone,
|
2282
|
-
showEra
|
2283
|
-
]);
|
2284
|
-
let opts = (useMemo)(() => ($35a22f14a1f04b11$export$7e319ea407e63bc0)({}, formatOpts), [
|
2285
|
-
formatOpts
|
2286
|
-
]);
|
2287
|
-
let dateFormatter = (useMemo)(() => new (DateFormatter)(locale, opts), [
|
2288
|
-
locale,
|
2289
|
-
opts
|
2290
|
-
]);
|
2291
|
-
let resolvedOptions = (useMemo)(() => dateFormatter.resolvedOptions(), [
|
2292
|
-
dateFormatter
|
2293
|
-
]);
|
2294
|
-
let allSegments = (useMemo)(() => dateFormatter.formatToParts(/* @__PURE__ */ new Date()).filter((seg) => $3c0fc76039f1c516$var$EDITABLE_SEGMENTS[seg.type]).reduce((p, seg) => (p[seg.type] = true, p), {}), [
|
2295
|
-
dateFormatter
|
2296
|
-
]);
|
2297
|
-
let [validSegments, setValidSegments] = (useState)(() => props.value || props.defaultValue ? {
|
2298
|
-
...allSegments
|
2299
|
-
} : {});
|
2300
|
-
let clearedSegment = (useRef)();
|
2301
|
-
let lastCalendarIdentifier = (useRef)(calendar.identifier);
|
2302
|
-
(useEffect)(() => {
|
2303
|
-
if (calendar.identifier !== lastCalendarIdentifier.current) {
|
2304
|
-
lastCalendarIdentifier.current = calendar.identifier;
|
2305
|
-
setPlaceholderDate((placeholder) => Object.keys(validSegments).length > 0 ? (toCalendar)(placeholder, calendar) : ($35a22f14a1f04b11$export$66aa2b09de4b1ea5)(props.placeholderValue, granularity, calendar, defaultTimeZone));
|
2306
|
-
}
|
2307
|
-
}, [
|
2308
|
-
calendar,
|
2309
|
-
granularity,
|
2310
|
-
validSegments,
|
2311
|
-
defaultTimeZone,
|
2312
|
-
props.placeholderValue
|
2313
|
-
]);
|
2314
|
-
if (value && Object.keys(validSegments).length < Object.keys(allSegments).length) {
|
2315
|
-
validSegments = {
|
2316
|
-
...allSegments
|
2317
|
-
};
|
2318
|
-
setValidSegments(validSegments);
|
2319
|
-
}
|
2320
|
-
if (value == null && Object.keys(validSegments).length === Object.keys(allSegments).length) {
|
2321
|
-
validSegments = {};
|
2322
|
-
setValidSegments(validSegments);
|
2323
|
-
setPlaceholderDate(($35a22f14a1f04b11$export$66aa2b09de4b1ea5)(props.placeholderValue, granularity, calendar, defaultTimeZone));
|
2324
|
-
}
|
2325
|
-
let displayValue = calendarValue && Object.keys(validSegments).length >= Object.keys(allSegments).length ? calendarValue : placeholderDate;
|
2326
|
-
let setValue = (newValue) => {
|
2327
|
-
if (props.isDisabled || props.isReadOnly)
|
2328
|
-
return;
|
2329
|
-
let validKeys = Object.keys(validSegments);
|
2330
|
-
let allKeys = Object.keys(allSegments);
|
2331
|
-
if (newValue == null) {
|
2332
|
-
setDate(null);
|
2333
|
-
setPlaceholderDate(($35a22f14a1f04b11$export$66aa2b09de4b1ea5)(props.placeholderValue, granularity, calendar, defaultTimeZone));
|
2334
|
-
setValidSegments({});
|
2335
|
-
} else if (validKeys.length >= allKeys.length || validKeys.length === allKeys.length - 1 && allSegments.dayPeriod && !validSegments.dayPeriod && clearedSegment.current !== "dayPeriod") {
|
2336
|
-
newValue = (toCalendar)(newValue, (v === null || v === void 0 ? void 0 : v.calendar) || new (GregorianCalendar)());
|
2337
|
-
setDate(newValue);
|
2338
|
-
} else
|
2339
|
-
setPlaceholderDate(newValue);
|
2340
|
-
clearedSegment.current = null;
|
2341
|
-
};
|
2342
|
-
let dateValue = (useMemo)(() => displayValue.toDate(timeZone), [
|
2343
|
-
displayValue,
|
2344
|
-
timeZone
|
2345
|
-
]);
|
2346
|
-
let segments = (useMemo)(() => dateFormatter.formatToParts(dateValue).map((segment) => {
|
2347
|
-
let isEditable = $3c0fc76039f1c516$var$EDITABLE_SEGMENTS[segment.type];
|
2348
|
-
if (segment.type === "era" && calendar.getEras().length === 1)
|
2349
|
-
isEditable = false;
|
2350
|
-
let isPlaceholder = $3c0fc76039f1c516$var$EDITABLE_SEGMENTS[segment.type] && !validSegments[segment.type];
|
2351
|
-
let placeholder = $3c0fc76039f1c516$var$EDITABLE_SEGMENTS[segment.type] ? ($3e3ed55ab2966714$export$d3f5c5e0a5023fa0)(segment.type, segment.value, locale) : null;
|
2352
|
-
return {
|
2353
|
-
type: $3c0fc76039f1c516$var$TYPE_MAPPING[segment.type] || segment.type,
|
2354
|
-
text: isPlaceholder ? placeholder : segment.value,
|
2355
|
-
...$3c0fc76039f1c516$var$getSegmentLimits(displayValue, segment.type, resolvedOptions),
|
2356
|
-
isPlaceholder,
|
2357
|
-
placeholder,
|
2358
|
-
isEditable
|
2359
|
-
};
|
2360
|
-
}), [
|
2361
|
-
dateValue,
|
2362
|
-
validSegments,
|
2363
|
-
dateFormatter,
|
2364
|
-
resolvedOptions,
|
2365
|
-
displayValue,
|
2366
|
-
calendar,
|
2367
|
-
locale
|
2368
|
-
]);
|
2369
|
-
if (allSegments.era && validSegments.year && !validSegments.era) {
|
2370
|
-
validSegments.era = true;
|
2371
|
-
setValidSegments({
|
2372
|
-
...validSegments
|
2373
|
-
});
|
2374
|
-
} else if (!allSegments.era && validSegments.era) {
|
2375
|
-
delete validSegments.era;
|
2376
|
-
setValidSegments({
|
2377
|
-
...validSegments
|
2378
|
-
});
|
2379
|
-
}
|
2380
|
-
let markValid = (part) => {
|
2381
|
-
validSegments[part] = true;
|
2382
|
-
if (part === "year" && allSegments.era)
|
2383
|
-
validSegments.era = true;
|
2384
|
-
setValidSegments({
|
2385
|
-
...validSegments
|
2386
|
-
});
|
2387
|
-
};
|
2388
|
-
let adjustSegment = (type, amount) => {
|
2389
|
-
if (!validSegments[type]) {
|
2390
|
-
markValid(type);
|
2391
|
-
let validKeys = Object.keys(validSegments);
|
2392
|
-
let allKeys = Object.keys(allSegments);
|
2393
|
-
if (validKeys.length >= allKeys.length || validKeys.length === allKeys.length - 1 && allSegments.dayPeriod && !validSegments.dayPeriod)
|
2394
|
-
setValue(displayValue);
|
2395
|
-
} else
|
2396
|
-
setValue($3c0fc76039f1c516$var$addSegment(displayValue, type, amount, resolvedOptions));
|
2397
|
-
};
|
2398
|
-
let validationState = props.validationState || (($35a22f14a1f04b11$export$eac50920cf2fd59a)(calendarValue, props.minValue, props.maxValue) ? "invalid" : null);
|
2399
|
-
var _props_maxGranularity1;
|
2400
|
-
return {
|
2401
|
-
value: calendarValue,
|
2402
|
-
dateValue,
|
2403
|
-
calendar,
|
2404
|
-
setValue,
|
2405
|
-
segments,
|
2406
|
-
dateFormatter,
|
2407
|
-
validationState,
|
2408
|
-
granularity,
|
2409
|
-
maxGranularity: (_props_maxGranularity1 = props.maxGranularity) !== null && _props_maxGranularity1 !== void 0 ? _props_maxGranularity1 : "year",
|
2410
|
-
isDisabled,
|
2411
|
-
isReadOnly,
|
2412
|
-
isRequired,
|
2413
|
-
increment(part) {
|
2414
|
-
adjustSegment(part, 1);
|
2415
|
-
},
|
2416
|
-
decrement(part) {
|
2417
|
-
adjustSegment(part, -1);
|
2418
|
-
},
|
2419
|
-
incrementPage(part) {
|
2420
|
-
adjustSegment(part, $3c0fc76039f1c516$var$PAGE_STEP[part] || 1);
|
2421
|
-
},
|
2422
|
-
decrementPage(part) {
|
2423
|
-
adjustSegment(part, -($3c0fc76039f1c516$var$PAGE_STEP[part] || 1));
|
2424
|
-
},
|
2425
|
-
setSegment(part, v2) {
|
2426
|
-
markValid(part);
|
2427
|
-
setValue($3c0fc76039f1c516$var$setSegment(displayValue, part, v2, resolvedOptions));
|
2428
|
-
},
|
2429
|
-
confirmPlaceholder() {
|
2430
|
-
if (props.isDisabled || props.isReadOnly)
|
2431
|
-
return;
|
2432
|
-
let validKeys = Object.keys(validSegments);
|
2433
|
-
let allKeys = Object.keys(allSegments);
|
2434
|
-
if (validKeys.length === allKeys.length - 1 && allSegments.dayPeriod && !validSegments.dayPeriod) {
|
2435
|
-
validSegments = {
|
2436
|
-
...allSegments
|
2437
|
-
};
|
2438
|
-
setValidSegments(validSegments);
|
2439
|
-
setValue(displayValue.copy());
|
2440
|
-
}
|
2441
|
-
},
|
2442
|
-
clearSegment(part) {
|
2443
|
-
delete validSegments[part];
|
2444
|
-
clearedSegment.current = part;
|
2445
|
-
setValidSegments({
|
2446
|
-
...validSegments
|
2447
|
-
});
|
2448
|
-
let placeholder = ($35a22f14a1f04b11$export$66aa2b09de4b1ea5)(props.placeholderValue, granularity, calendar, defaultTimeZone);
|
2449
|
-
let value2 = displayValue;
|
2450
|
-
if (part === "dayPeriod" && "hour" in displayValue && "hour" in placeholder) {
|
2451
|
-
let isPM = displayValue.hour >= 12;
|
2452
|
-
let shouldBePM = placeholder.hour >= 12;
|
2453
|
-
if (isPM && !shouldBePM)
|
2454
|
-
value2 = displayValue.set({
|
2455
|
-
hour: displayValue.hour - 12
|
2456
|
-
});
|
2457
|
-
else if (!isPM && shouldBePM)
|
2458
|
-
value2 = displayValue.set({
|
2459
|
-
hour: displayValue.hour + 12
|
2460
|
-
});
|
2461
|
-
} else if (part in displayValue)
|
2462
|
-
value2 = displayValue.set({
|
2463
|
-
[part]: placeholder[part]
|
2464
|
-
});
|
2465
|
-
setDate(null);
|
2466
|
-
setValue(value2);
|
2467
|
-
},
|
2468
|
-
formatValue(fieldOptions) {
|
2469
|
-
if (!calendarValue)
|
2470
|
-
return "";
|
2471
|
-
let formatOptions = ($35a22f14a1f04b11$export$7e319ea407e63bc0)(fieldOptions, formatOpts);
|
2472
|
-
let formatter = new (DateFormatter)(locale, formatOptions);
|
2473
|
-
return formatter.format(dateValue);
|
2474
|
-
}
|
2475
|
-
};
|
2476
|
-
}
|
2477
|
-
function $3c0fc76039f1c516$var$getSegmentLimits(date, type, options) {
|
2478
|
-
switch (type) {
|
2479
|
-
case "era": {
|
2480
|
-
let eras = date.calendar.getEras();
|
2481
|
-
return {
|
2482
|
-
value: eras.indexOf(date.era),
|
2483
|
-
minValue: 0,
|
2484
|
-
maxValue: eras.length - 1
|
2485
|
-
};
|
2486
|
-
}
|
2487
|
-
case "year":
|
2488
|
-
return {
|
2489
|
-
value: date.year,
|
2490
|
-
minValue: 1,
|
2491
|
-
maxValue: date.calendar.getYearsInEra(date)
|
2492
|
-
};
|
2493
|
-
case "month":
|
2494
|
-
return {
|
2495
|
-
value: date.month,
|
2496
|
-
minValue: (getMinimumMonthInYear)(date),
|
2497
|
-
maxValue: date.calendar.getMonthsInYear(date)
|
2498
|
-
};
|
2499
|
-
case "day":
|
2500
|
-
return {
|
2501
|
-
value: date.day,
|
2502
|
-
minValue: (getMinimumDayInMonth)(date),
|
2503
|
-
maxValue: date.calendar.getDaysInMonth(date)
|
2504
|
-
};
|
2505
|
-
}
|
2506
|
-
if ("hour" in date)
|
2507
|
-
switch (type) {
|
2508
|
-
case "dayPeriod":
|
2509
|
-
return {
|
2510
|
-
value: date.hour >= 12 ? 12 : 0,
|
2511
|
-
minValue: 0,
|
2512
|
-
maxValue: 12
|
2513
|
-
};
|
2514
|
-
case "hour":
|
2515
|
-
if (options.hour12) {
|
2516
|
-
let isPM = date.hour >= 12;
|
2517
|
-
return {
|
2518
|
-
value: date.hour,
|
2519
|
-
minValue: isPM ? 12 : 0,
|
2520
|
-
maxValue: isPM ? 23 : 11
|
2521
|
-
};
|
2522
|
-
}
|
2523
|
-
return {
|
2524
|
-
value: date.hour,
|
2525
|
-
minValue: 0,
|
2526
|
-
maxValue: 23
|
2527
|
-
};
|
2528
|
-
case "minute":
|
2529
|
-
return {
|
2530
|
-
value: date.minute,
|
2531
|
-
minValue: 0,
|
2532
|
-
maxValue: 59
|
2533
|
-
};
|
2534
|
-
case "second":
|
2535
|
-
return {
|
2536
|
-
value: date.second,
|
2537
|
-
minValue: 0,
|
2538
|
-
maxValue: 59
|
2539
|
-
};
|
2540
|
-
}
|
2541
|
-
return {};
|
2542
|
-
}
|
2543
|
-
function $3c0fc76039f1c516$var$addSegment(value, part, amount, options) {
|
2544
|
-
switch (part) {
|
2545
|
-
case "era":
|
2546
|
-
case "year":
|
2547
|
-
case "month":
|
2548
|
-
case "day":
|
2549
|
-
return value.cycle(part, amount, {
|
2550
|
-
round: part === "year"
|
2551
|
-
});
|
2552
|
-
}
|
2553
|
-
if ("hour" in value)
|
2554
|
-
switch (part) {
|
2555
|
-
case "dayPeriod": {
|
2556
|
-
let hours = value.hour;
|
2557
|
-
let isPM = hours >= 12;
|
2558
|
-
return value.set({
|
2559
|
-
hour: isPM ? hours - 12 : hours + 12
|
2560
|
-
});
|
2561
|
-
}
|
2562
|
-
case "hour":
|
2563
|
-
case "minute":
|
2564
|
-
case "second":
|
2565
|
-
return value.cycle(part, amount, {
|
2566
|
-
round: part !== "hour",
|
2567
|
-
hourCycle: options.hour12 ? 12 : 24
|
2568
|
-
});
|
2569
|
-
}
|
2570
|
-
}
|
2571
|
-
function $3c0fc76039f1c516$var$setSegment(value, part, segmentValue, options) {
|
2572
|
-
switch (part) {
|
2573
|
-
case "day":
|
2574
|
-
case "month":
|
2575
|
-
case "year":
|
2576
|
-
case "era":
|
2577
|
-
return value.set({
|
2578
|
-
[part]: segmentValue
|
2579
|
-
});
|
2580
|
-
}
|
2581
|
-
if ("hour" in value)
|
2582
|
-
switch (part) {
|
2583
|
-
case "dayPeriod": {
|
2584
|
-
let hours = value.hour;
|
2585
|
-
let wasPM = hours >= 12;
|
2586
|
-
let isPM = segmentValue >= 12;
|
2587
|
-
if (isPM === wasPM)
|
2588
|
-
return value;
|
2589
|
-
return value.set({
|
2590
|
-
hour: wasPM ? hours - 12 : hours + 12
|
2591
|
-
});
|
2592
|
-
}
|
2593
|
-
case "hour":
|
2594
|
-
if (options.hour12) {
|
2595
|
-
let hours = value.hour;
|
2596
|
-
let wasPM = hours >= 12;
|
2597
|
-
if (!wasPM && segmentValue === 12)
|
2598
|
-
segmentValue = 0;
|
2599
|
-
if (wasPM && segmentValue < 12)
|
2600
|
-
segmentValue += 12;
|
2601
|
-
}
|
2602
|
-
case "minute":
|
2603
|
-
case "second":
|
2604
|
-
return value.set({
|
2605
|
-
[part]: segmentValue
|
2606
|
-
});
|
2607
|
-
}
|
2608
|
-
}
|
2609
|
-
function $93c38a5e28be6249$export$e50a61c1de9f574(props) {
|
2610
|
-
var _props_isDateUnavailable, _props_isDateUnavailable1;
|
2611
|
-
let overlayState = ($fc909762b330b746$export$61c6a8c84e605fb6)(props);
|
2612
|
-
let [controlledValue, setControlledValue] = ($458b0a5536c1a7cf$export$40bfa8c7b0832715)(props.value, props.defaultValue || null, props.onChange);
|
2613
|
-
let [placeholderValue, setPlaceholderValue] = (useState)(() => controlledValue || {
|
2614
|
-
start: null,
|
2615
|
-
end: null
|
2616
|
-
});
|
2617
|
-
if (controlledValue == null && placeholderValue.start && placeholderValue.end) {
|
2618
|
-
placeholderValue = {
|
2619
|
-
start: null,
|
2620
|
-
end: null
|
2621
|
-
};
|
2622
|
-
setPlaceholderValue(placeholderValue);
|
2623
|
-
}
|
2624
|
-
let value = controlledValue || placeholderValue;
|
2625
|
-
let setValue = (value2) => {
|
2626
|
-
setPlaceholderValue(value2);
|
2627
|
-
if ((value2 === null || value2 === void 0 ? void 0 : value2.start) && value2.end)
|
2628
|
-
setControlledValue(value2);
|
2629
|
-
else
|
2630
|
-
setControlledValue(null);
|
2631
|
-
};
|
2632
|
-
let v = (value === null || value === void 0 ? void 0 : value.start) || (value === null || value === void 0 ? void 0 : value.end) || props.placeholderValue;
|
2633
|
-
let [granularity] = ($35a22f14a1f04b11$export$2440da353cedad43)(v, props.granularity);
|
2634
|
-
let hasTime = granularity === "hour" || granularity === "minute" || granularity === "second";
|
2635
|
-
var _props_shouldCloseOnSelect;
|
2636
|
-
let shouldCloseOnSelect = (_props_shouldCloseOnSelect = props.shouldCloseOnSelect) !== null && _props_shouldCloseOnSelect !== void 0 ? _props_shouldCloseOnSelect : true;
|
2637
|
-
let [dateRange, setSelectedDateRange] = (useState)(null);
|
2638
|
-
let [timeRange, setSelectedTimeRange] = (useState)(null);
|
2639
|
-
if (value && value.start && value.end) {
|
2640
|
-
dateRange = value;
|
2641
|
-
if ("hour" in value.start)
|
2642
|
-
timeRange = value;
|
2643
|
-
}
|
2644
|
-
let commitValue = (dateRange2, timeRange2) => {
|
2645
|
-
setValue({
|
2646
|
-
start: "timeZone" in timeRange2.start ? timeRange2.start.set((toCalendarDate)(dateRange2.start)) : (toCalendarDateTime)(dateRange2.start, timeRange2.start),
|
2647
|
-
end: "timeZone" in timeRange2.end ? timeRange2.end.set((toCalendarDate)(dateRange2.end)) : (toCalendarDateTime)(dateRange2.end, timeRange2.end)
|
2648
|
-
});
|
2649
|
-
setSelectedDateRange(null);
|
2650
|
-
setSelectedTimeRange(null);
|
2651
|
-
};
|
2652
|
-
let setDateRange = (range) => {
|
2653
|
-
let shouldClose = typeof shouldCloseOnSelect === "function" ? shouldCloseOnSelect() : shouldCloseOnSelect;
|
2654
|
-
if (hasTime) {
|
2655
|
-
if (shouldClose || range.start && range.end && (timeRange === null || timeRange === void 0 ? void 0 : timeRange.start) && (timeRange === null || timeRange === void 0 ? void 0 : timeRange.end))
|
2656
|
-
commitValue(range, {
|
2657
|
-
start: (timeRange === null || timeRange === void 0 ? void 0 : timeRange.start) || ($35a22f14a1f04b11$export$c5221a78ef73c5e9)(props.placeholderValue),
|
2658
|
-
end: (timeRange === null || timeRange === void 0 ? void 0 : timeRange.end) || ($35a22f14a1f04b11$export$c5221a78ef73c5e9)(props.placeholderValue)
|
2659
|
-
});
|
2660
|
-
else
|
2661
|
-
setSelectedDateRange(range);
|
2662
|
-
} else if (range.start && range.end)
|
2663
|
-
setValue(range);
|
2664
|
-
else
|
2665
|
-
setSelectedDateRange(range);
|
2666
|
-
if (shouldClose)
|
2667
|
-
overlayState.setOpen(false);
|
2668
|
-
};
|
2669
|
-
let setTimeRange = (range) => {
|
2670
|
-
if ((dateRange === null || dateRange === void 0 ? void 0 : dateRange.start) && (dateRange === null || dateRange === void 0 ? void 0 : dateRange.end) && range.start && range.end)
|
2671
|
-
commitValue(dateRange, range);
|
2672
|
-
else
|
2673
|
-
setSelectedTimeRange(range);
|
2674
|
-
};
|
2675
|
-
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);
|
2676
|
-
return {
|
2677
|
-
value,
|
2678
|
-
setValue,
|
2679
|
-
dateRange,
|
2680
|
-
timeRange,
|
2681
|
-
granularity,
|
2682
|
-
hasTime,
|
2683
|
-
setDate(part, date) {
|
2684
|
-
setDateRange({
|
2685
|
-
...dateRange,
|
2686
|
-
[part]: date
|
2687
|
-
});
|
2688
|
-
},
|
2689
|
-
setTime(part, time) {
|
2690
|
-
setTimeRange({
|
2691
|
-
...timeRange,
|
2692
|
-
[part]: time
|
2693
|
-
});
|
2694
|
-
},
|
2695
|
-
setDateTime(part, dateTime) {
|
2696
|
-
setValue({
|
2697
|
-
...value,
|
2698
|
-
[part]: dateTime
|
2699
|
-
});
|
2700
|
-
},
|
2701
|
-
setDateRange,
|
2702
|
-
setTimeRange,
|
2703
|
-
...overlayState,
|
2704
|
-
setOpen(isOpen) {
|
2705
|
-
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)
|
2706
|
-
commitValue(dateRange, {
|
2707
|
-
start: (timeRange === null || timeRange === void 0 ? void 0 : timeRange.start) || ($35a22f14a1f04b11$export$c5221a78ef73c5e9)(props.placeholderValue),
|
2708
|
-
end: (timeRange === null || timeRange === void 0 ? void 0 : timeRange.end) || ($35a22f14a1f04b11$export$c5221a78ef73c5e9)(props.placeholderValue)
|
2709
|
-
});
|
2710
|
-
overlayState.setOpen(isOpen);
|
2711
|
-
},
|
2712
|
-
validationState,
|
2713
|
-
formatValue(locale, fieldOptions) {
|
2714
|
-
if (!value || !value.start || !value.end)
|
2715
|
-
return null;
|
2716
|
-
let startTimeZone = "timeZone" in value.start ? value.start.timeZone : void 0;
|
2717
|
-
let startGranularity = props.granularity || (value.start && "minute" in value.start ? "minute" : "day");
|
2718
|
-
let endTimeZone = "timeZone" in value.end ? value.end.timeZone : void 0;
|
2719
|
-
let endGranularity = props.granularity || (value.end && "minute" in value.end ? "minute" : "day");
|
2720
|
-
let startOptions = ($35a22f14a1f04b11$export$7e319ea407e63bc0)(fieldOptions, {
|
2721
|
-
granularity: startGranularity,
|
2722
|
-
timeZone: startTimeZone,
|
2723
|
-
hideTimeZone: props.hideTimeZone,
|
2724
|
-
hourCycle: props.hourCycle,
|
2725
|
-
showEra: value.start.calendar.identifier === "gregory" && value.start.era === "BC" || value.end.calendar.identifier === "gregory" && value.end.era === "BC"
|
2726
|
-
});
|
2727
|
-
let startDate = value.start.toDate(startTimeZone || "UTC");
|
2728
|
-
let endDate = value.end.toDate(endTimeZone || "UTC");
|
2729
|
-
let startFormatter = new (DateFormatter)(locale, startOptions);
|
2730
|
-
let endFormatter;
|
2731
|
-
if (startTimeZone === endTimeZone && startGranularity === endGranularity && value.start.compare(value.end) !== 0) {
|
2732
|
-
try {
|
2733
|
-
let parts14 = startFormatter.formatRangeToParts(startDate, endDate);
|
2734
|
-
let separatorIndex = -1;
|
2735
|
-
for (let i = 0; i < parts14.length; i++) {
|
2736
|
-
let part = parts14[i];
|
2737
|
-
if (part.source === "shared" && part.type === "literal")
|
2738
|
-
separatorIndex = i;
|
2739
|
-
else if (part.source === "endRange")
|
2740
|
-
break;
|
2741
|
-
}
|
2742
|
-
let start = "";
|
2743
|
-
let end = "";
|
2744
|
-
for (let i = 0; i < parts14.length; i++) {
|
2745
|
-
if (i < separatorIndex)
|
2746
|
-
start += parts14[i].value;
|
2747
|
-
else if (i > separatorIndex)
|
2748
|
-
end += parts14[i].value;
|
2749
|
-
}
|
2750
|
-
return {
|
2751
|
-
start,
|
2752
|
-
end
|
2753
|
-
};
|
2754
|
-
} catch (e) {
|
2755
|
-
}
|
2756
|
-
endFormatter = startFormatter;
|
2757
|
-
} else {
|
2758
|
-
let endOptions = ($35a22f14a1f04b11$export$7e319ea407e63bc0)(fieldOptions, {
|
2759
|
-
granularity: endGranularity,
|
2760
|
-
timeZone: endTimeZone,
|
2761
|
-
hideTimeZone: props.hideTimeZone,
|
2762
|
-
hourCycle: props.hourCycle
|
2763
|
-
});
|
2764
|
-
endFormatter = new (DateFormatter)(locale, endOptions);
|
2765
|
-
}
|
2766
|
-
return {
|
2767
|
-
start: startFormatter.format(startDate),
|
2768
|
-
end: endFormatter.format(endDate)
|
2769
|
-
};
|
2770
|
-
}
|
2771
|
-
};
|
2772
|
-
}
|
2773
|
-
function $f62d864046160412$export$eac50920cf2fd59a(date, minValue, maxValue) {
|
2774
|
-
return minValue != null && date.compare(minValue) < 0 || maxValue != null && date.compare(maxValue) > 0;
|
2775
|
-
}
|
2776
|
-
function $f62d864046160412$export$f4a51ff076cc9a09(date, duration, locale, minValue, maxValue) {
|
2777
|
-
let halfDuration = {};
|
2778
|
-
for (let key in duration) {
|
2779
|
-
halfDuration[key] = Math.floor(duration[key] / 2);
|
2780
|
-
if (halfDuration[key] > 0 && duration[key] % 2 === 0)
|
2781
|
-
halfDuration[key]--;
|
2782
|
-
}
|
2783
|
-
let aligned = $f62d864046160412$export$144a00ba6044eb9(date, duration, locale).subtract(halfDuration);
|
2784
|
-
return $f62d864046160412$export$5bb865b12696a77d(date, aligned, duration, locale, minValue, maxValue);
|
2785
|
-
}
|
2786
|
-
function $f62d864046160412$export$144a00ba6044eb9(date, duration, locale, minValue, maxValue) {
|
2787
|
-
let aligned = date;
|
2788
|
-
if (duration.years)
|
2789
|
-
aligned = (startOfYear)(date);
|
2790
|
-
else if (duration.months)
|
2791
|
-
aligned = (startOfMonth)(date);
|
2792
|
-
else if (duration.weeks)
|
2793
|
-
aligned = (startOfWeek)(date, locale);
|
2794
|
-
return $f62d864046160412$export$5bb865b12696a77d(date, aligned, duration, locale, minValue, maxValue);
|
2795
|
-
}
|
2796
|
-
function $f62d864046160412$export$530edbfc915b2b04(date, duration, locale, minValue, maxValue) {
|
2797
|
-
let d = {
|
2798
|
-
...duration
|
2799
|
-
};
|
2800
|
-
if (duration.days)
|
2801
|
-
d.days--;
|
2802
|
-
else if (duration.weeks)
|
2803
|
-
d.weeks--;
|
2804
|
-
else if (duration.months)
|
2805
|
-
d.months--;
|
2806
|
-
else if (duration.years)
|
2807
|
-
d.years--;
|
2808
|
-
let aligned = $f62d864046160412$export$144a00ba6044eb9(date, duration, locale).subtract(d);
|
2809
|
-
return $f62d864046160412$export$5bb865b12696a77d(date, aligned, duration, locale, minValue, maxValue);
|
2810
|
-
}
|
2811
|
-
function $f62d864046160412$export$5bb865b12696a77d(date, aligned, duration, locale, minValue, maxValue) {
|
2812
|
-
if (minValue && date.compare(minValue) >= 0)
|
2813
|
-
aligned = (maxDate)(aligned, $f62d864046160412$export$144a00ba6044eb9((toCalendarDate)(minValue), duration, locale));
|
2814
|
-
if (maxValue && date.compare(maxValue) <= 0)
|
2815
|
-
aligned = (minDate)(aligned, $f62d864046160412$export$530edbfc915b2b04((toCalendarDate)(maxValue), duration, locale));
|
2816
|
-
return aligned;
|
2817
|
-
}
|
2818
|
-
function $f62d864046160412$export$4f5203c0d889109e(date, minValue, maxValue) {
|
2819
|
-
if (minValue)
|
2820
|
-
date = (maxDate)(date, (toCalendarDate)(minValue));
|
2821
|
-
if (maxValue)
|
2822
|
-
date = (minDate)(date, (toCalendarDate)(maxValue));
|
2823
|
-
return date;
|
2824
|
-
}
|
2825
|
-
function $f62d864046160412$export$a1d3911297b952d7(date, minValue, isDateUnavailable) {
|
2826
|
-
if (!isDateUnavailable)
|
2827
|
-
return date;
|
2828
|
-
while (date.compare(minValue) >= 0 && isDateUnavailable(date))
|
2829
|
-
date = date.subtract({
|
2830
|
-
days: 1
|
2831
|
-
});
|
2832
|
-
if (date.compare(minValue) >= 0)
|
2833
|
-
return date;
|
2834
|
-
}
|
2835
|
-
function $131cf43a05231e1e$export$6d095e787d2b5e1f(props) {
|
2836
|
-
let defaultFormatter = (useMemo)(() => new (DateFormatter)(props.locale), [
|
2837
|
-
props.locale
|
2838
|
-
]);
|
2839
|
-
let resolvedOptions = (useMemo)(() => defaultFormatter.resolvedOptions(), [
|
2840
|
-
defaultFormatter
|
2841
|
-
]);
|
2842
|
-
let { locale, createCalendar: createCalendar4, visibleDuration = {
|
2843
|
-
months: 1
|
2844
|
-
}, minValue, maxValue, selectionAlignment, isDateUnavailable, pageBehavior = "visible" } = props;
|
2845
|
-
let calendar = (useMemo)(() => createCalendar4(resolvedOptions.calendar), [
|
2846
|
-
createCalendar4,
|
2847
|
-
resolvedOptions.calendar
|
2848
|
-
]);
|
2849
|
-
let [value, setControlledValue] = ($458b0a5536c1a7cf$export$40bfa8c7b0832715)(props.value, props.defaultValue, props.onChange);
|
2850
|
-
let calendarDateValue = (useMemo)(() => value ? (toCalendar)((toCalendarDate)(value), calendar) : null, [
|
2851
|
-
value,
|
2852
|
-
calendar
|
2853
|
-
]);
|
2854
|
-
let timeZone = (useMemo)(() => value && "timeZone" in value ? value.timeZone : resolvedOptions.timeZone, [
|
2855
|
-
value,
|
2856
|
-
resolvedOptions.timeZone
|
2857
|
-
]);
|
2858
|
-
let focusedCalendarDate = (useMemo)(() => props.focusedValue ? ($f62d864046160412$export$4f5203c0d889109e)((toCalendar)((toCalendarDate)(props.focusedValue), calendar), minValue, maxValue) : void 0, [
|
2859
|
-
props.focusedValue,
|
2860
|
-
calendar,
|
2861
|
-
minValue,
|
2862
|
-
maxValue
|
2863
|
-
]);
|
2864
|
-
let defaultFocusedCalendarDate = (useMemo)(() => ($f62d864046160412$export$4f5203c0d889109e)(props.defaultFocusedValue ? (toCalendar)((toCalendarDate)(props.defaultFocusedValue), calendar) : calendarDateValue || (toCalendar)((today)(timeZone), calendar), minValue, maxValue), [
|
2865
|
-
props.defaultFocusedValue,
|
2866
|
-
calendarDateValue,
|
2867
|
-
timeZone,
|
2868
|
-
calendar,
|
2869
|
-
minValue,
|
2870
|
-
maxValue
|
2871
|
-
]);
|
2872
|
-
let [focusedDate, setFocusedDate] = ($458b0a5536c1a7cf$export$40bfa8c7b0832715)(focusedCalendarDate, defaultFocusedCalendarDate, props.onFocusChange);
|
2873
|
-
let [startDate, setStartDate] = (useState)(() => {
|
2874
|
-
switch (selectionAlignment) {
|
2875
|
-
case "start":
|
2876
|
-
return ($f62d864046160412$export$144a00ba6044eb9)(focusedDate, visibleDuration, locale, minValue, maxValue);
|
2877
|
-
case "end":
|
2878
|
-
return ($f62d864046160412$export$530edbfc915b2b04)(focusedDate, visibleDuration, locale, minValue, maxValue);
|
2879
|
-
case "center":
|
2880
|
-
default:
|
2881
|
-
return ($f62d864046160412$export$f4a51ff076cc9a09)(focusedDate, visibleDuration, locale, minValue, maxValue);
|
2882
|
-
}
|
2883
|
-
});
|
2884
|
-
let [isFocused, setFocused] = (useState)(props.autoFocus || false);
|
2885
|
-
let endDate = (useMemo)(() => {
|
2886
|
-
let duration = {
|
2887
|
-
...visibleDuration
|
2888
|
-
};
|
2889
|
-
if (duration.days)
|
2890
|
-
duration.days--;
|
2891
|
-
else
|
2892
|
-
duration.days = -1;
|
2893
|
-
return startDate.add(duration);
|
2894
|
-
}, [
|
2895
|
-
startDate,
|
2896
|
-
visibleDuration
|
2897
|
-
]);
|
2898
|
-
let [lastCalendarIdentifier, setLastCalendarIdentifier] = (useState)(calendar.identifier);
|
2899
|
-
if (calendar.identifier !== lastCalendarIdentifier) {
|
2900
|
-
let newFocusedDate = (toCalendar)(focusedDate, calendar);
|
2901
|
-
setStartDate(($f62d864046160412$export$f4a51ff076cc9a09)(newFocusedDate, visibleDuration, locale, minValue, maxValue));
|
2902
|
-
setFocusedDate(newFocusedDate);
|
2903
|
-
setLastCalendarIdentifier(calendar.identifier);
|
2904
|
-
}
|
2905
|
-
if (($f62d864046160412$export$eac50920cf2fd59a)(focusedDate, minValue, maxValue))
|
2906
|
-
setFocusedDate(($f62d864046160412$export$4f5203c0d889109e)(focusedDate, minValue, maxValue));
|
2907
|
-
else if (focusedDate.compare(startDate) < 0)
|
2908
|
-
setStartDate(($f62d864046160412$export$530edbfc915b2b04)(focusedDate, visibleDuration, locale, minValue, maxValue));
|
2909
|
-
else if (focusedDate.compare(endDate) > 0)
|
2910
|
-
setStartDate(($f62d864046160412$export$144a00ba6044eb9)(focusedDate, visibleDuration, locale, minValue, maxValue));
|
2911
|
-
function focusCell(date) {
|
2912
|
-
date = ($f62d864046160412$export$4f5203c0d889109e)(date, minValue, maxValue);
|
2913
|
-
setFocusedDate(date);
|
2914
|
-
}
|
2915
|
-
function setValue(newValue) {
|
2916
|
-
if (!props.isDisabled && !props.isReadOnly) {
|
2917
|
-
newValue = ($f62d864046160412$export$4f5203c0d889109e)(newValue, minValue, maxValue);
|
2918
|
-
newValue = ($f62d864046160412$export$a1d3911297b952d7)(newValue, startDate, isDateUnavailable);
|
2919
|
-
if (!newValue)
|
2920
|
-
return;
|
2921
|
-
newValue = (toCalendar)(newValue, (value === null || value === void 0 ? void 0 : value.calendar) || new (GregorianCalendar)());
|
2922
|
-
if (value && "hour" in value)
|
2923
|
-
setControlledValue(value.set(newValue));
|
2924
|
-
else
|
2925
|
-
setControlledValue(newValue);
|
2926
|
-
}
|
2927
|
-
}
|
2928
|
-
let isUnavailable = (useMemo)(() => {
|
2929
|
-
if (!calendarDateValue)
|
2930
|
-
return false;
|
2931
|
-
if (isDateUnavailable && isDateUnavailable(calendarDateValue))
|
2932
|
-
return true;
|
2933
|
-
return ($f62d864046160412$export$eac50920cf2fd59a)(calendarDateValue, minValue, maxValue);
|
2934
|
-
}, [
|
2935
|
-
calendarDateValue,
|
2936
|
-
isDateUnavailable,
|
2937
|
-
minValue,
|
2938
|
-
maxValue
|
2939
|
-
]);
|
2940
|
-
let validationState = props.validationState || (isUnavailable ? "invalid" : null);
|
2941
|
-
let pageDuration = (useMemo)(() => {
|
2942
|
-
if (pageBehavior === "visible")
|
2943
|
-
return visibleDuration;
|
2944
|
-
return $131cf43a05231e1e$var$unitDuration(visibleDuration);
|
2945
|
-
}, [
|
2946
|
-
pageBehavior,
|
2947
|
-
visibleDuration
|
2948
|
-
]);
|
2949
|
-
return {
|
2950
|
-
isDisabled: props.isDisabled,
|
2951
|
-
isReadOnly: props.isReadOnly,
|
2952
|
-
value: calendarDateValue,
|
2953
|
-
setValue,
|
2954
|
-
visibleRange: {
|
2955
|
-
start: startDate,
|
2956
|
-
end: endDate
|
2957
|
-
},
|
2958
|
-
minValue,
|
2959
|
-
maxValue,
|
2960
|
-
focusedDate,
|
2961
|
-
timeZone,
|
2962
|
-
validationState,
|
2963
|
-
setFocusedDate(date) {
|
2964
|
-
focusCell(date);
|
2965
|
-
setFocused(true);
|
2966
|
-
},
|
2967
|
-
focusNextDay() {
|
2968
|
-
focusCell(focusedDate.add({
|
2969
|
-
days: 1
|
2970
|
-
}));
|
2971
|
-
},
|
2972
|
-
focusPreviousDay() {
|
2973
|
-
focusCell(focusedDate.subtract({
|
2974
|
-
days: 1
|
2975
|
-
}));
|
2976
|
-
},
|
2977
|
-
focusNextRow() {
|
2978
|
-
if (visibleDuration.days)
|
2979
|
-
this.focusNextPage();
|
2980
|
-
else if (visibleDuration.weeks || visibleDuration.months || visibleDuration.years)
|
2981
|
-
focusCell(focusedDate.add({
|
2982
|
-
weeks: 1
|
2983
|
-
}));
|
2984
|
-
},
|
2985
|
-
focusPreviousRow() {
|
2986
|
-
if (visibleDuration.days)
|
2987
|
-
this.focusPreviousPage();
|
2988
|
-
else if (visibleDuration.weeks || visibleDuration.months || visibleDuration.years)
|
2989
|
-
focusCell(focusedDate.subtract({
|
2990
|
-
weeks: 1
|
2991
|
-
}));
|
2992
|
-
},
|
2993
|
-
focusNextPage() {
|
2994
|
-
let start = startDate.add(pageDuration);
|
2995
|
-
setFocusedDate(($f62d864046160412$export$4f5203c0d889109e)(focusedDate.add(pageDuration), minValue, maxValue));
|
2996
|
-
setStartDate(($f62d864046160412$export$144a00ba6044eb9)(($f62d864046160412$export$5bb865b12696a77d)(focusedDate, start, pageDuration, locale, minValue, maxValue), pageDuration, locale));
|
2997
|
-
},
|
2998
|
-
focusPreviousPage() {
|
2999
|
-
let start = startDate.subtract(pageDuration);
|
3000
|
-
setFocusedDate(($f62d864046160412$export$4f5203c0d889109e)(focusedDate.subtract(pageDuration), minValue, maxValue));
|
3001
|
-
setStartDate(($f62d864046160412$export$144a00ba6044eb9)(($f62d864046160412$export$5bb865b12696a77d)(focusedDate, start, pageDuration, locale, minValue, maxValue), pageDuration, locale));
|
3002
|
-
},
|
3003
|
-
focusSectionStart() {
|
3004
|
-
if (visibleDuration.days)
|
3005
|
-
focusCell(startDate);
|
3006
|
-
else if (visibleDuration.weeks)
|
3007
|
-
focusCell((startOfWeek)(focusedDate, locale));
|
3008
|
-
else if (visibleDuration.months || visibleDuration.years)
|
3009
|
-
focusCell((startOfMonth)(focusedDate));
|
3010
|
-
},
|
3011
|
-
focusSectionEnd() {
|
3012
|
-
if (visibleDuration.days)
|
3013
|
-
focusCell(endDate);
|
3014
|
-
else if (visibleDuration.weeks)
|
3015
|
-
focusCell((endOfWeek)(focusedDate, locale));
|
3016
|
-
else if (visibleDuration.months || visibleDuration.years)
|
3017
|
-
focusCell((endOfMonth)(focusedDate));
|
3018
|
-
},
|
3019
|
-
focusNextSection(larger) {
|
3020
|
-
if (!larger && !visibleDuration.days) {
|
3021
|
-
focusCell(focusedDate.add($131cf43a05231e1e$var$unitDuration(visibleDuration)));
|
3022
|
-
return;
|
3023
|
-
}
|
3024
|
-
if (visibleDuration.days)
|
3025
|
-
this.focusNextPage();
|
3026
|
-
else if (visibleDuration.weeks)
|
3027
|
-
focusCell(focusedDate.add({
|
3028
|
-
months: 1
|
3029
|
-
}));
|
3030
|
-
else if (visibleDuration.months || visibleDuration.years)
|
3031
|
-
focusCell(focusedDate.add({
|
3032
|
-
years: 1
|
3033
|
-
}));
|
3034
|
-
},
|
3035
|
-
focusPreviousSection(larger) {
|
3036
|
-
if (!larger && !visibleDuration.days) {
|
3037
|
-
focusCell(focusedDate.subtract($131cf43a05231e1e$var$unitDuration(visibleDuration)));
|
3038
|
-
return;
|
3039
|
-
}
|
3040
|
-
if (visibleDuration.days)
|
3041
|
-
this.focusPreviousPage();
|
3042
|
-
else if (visibleDuration.weeks)
|
3043
|
-
focusCell(focusedDate.subtract({
|
3044
|
-
months: 1
|
3045
|
-
}));
|
3046
|
-
else if (visibleDuration.months || visibleDuration.years)
|
3047
|
-
focusCell(focusedDate.subtract({
|
3048
|
-
years: 1
|
3049
|
-
}));
|
3050
|
-
},
|
3051
|
-
selectFocusedDate() {
|
3052
|
-
setValue(focusedDate);
|
3053
|
-
},
|
3054
|
-
selectDate(date) {
|
3055
|
-
setValue(date);
|
3056
|
-
},
|
3057
|
-
isFocused,
|
3058
|
-
setFocused,
|
3059
|
-
isInvalid(date) {
|
3060
|
-
return ($f62d864046160412$export$eac50920cf2fd59a)(date, minValue, maxValue);
|
3061
|
-
},
|
3062
|
-
isSelected(date) {
|
3063
|
-
return calendarDateValue != null && (isSameDay)(date, calendarDateValue) && !this.isCellDisabled(date) && !this.isCellUnavailable(date);
|
3064
|
-
},
|
3065
|
-
isCellFocused(date) {
|
3066
|
-
return isFocused && focusedDate && (isSameDay)(date, focusedDate);
|
3067
|
-
},
|
3068
|
-
isCellDisabled(date) {
|
3069
|
-
return props.isDisabled || date.compare(startDate) < 0 || date.compare(endDate) > 0 || this.isInvalid(date, minValue, maxValue);
|
3070
|
-
},
|
3071
|
-
isCellUnavailable(date) {
|
3072
|
-
return props.isDateUnavailable && props.isDateUnavailable(date);
|
3073
|
-
},
|
3074
|
-
isPreviousVisibleRangeInvalid() {
|
3075
|
-
let prev = startDate.subtract({
|
3076
|
-
days: 1
|
3077
|
-
});
|
3078
|
-
return (isSameDay)(prev, startDate) || this.isInvalid(prev, minValue, maxValue);
|
3079
|
-
},
|
3080
|
-
isNextVisibleRangeInvalid() {
|
3081
|
-
let next = endDate.add({
|
3082
|
-
days: 1
|
3083
|
-
});
|
3084
|
-
return (isSameDay)(next, endDate) || this.isInvalid(next, minValue, maxValue);
|
3085
|
-
},
|
3086
|
-
getDatesInWeek(weekIndex, from = startDate) {
|
3087
|
-
let date = from.add({
|
3088
|
-
weeks: weekIndex
|
3089
|
-
});
|
3090
|
-
let dates = [];
|
3091
|
-
date = (startOfWeek)(date, locale);
|
3092
|
-
let dayOfWeek = (getDayOfWeek)(date, locale);
|
3093
|
-
for (let i = 0; i < dayOfWeek; i++)
|
3094
|
-
dates.push(null);
|
3095
|
-
while (dates.length < 7) {
|
3096
|
-
dates.push(date);
|
3097
|
-
let nextDate = date.add({
|
3098
|
-
days: 1
|
3099
|
-
});
|
3100
|
-
if ((isSameDay)(date, nextDate))
|
3101
|
-
break;
|
3102
|
-
date = nextDate;
|
3103
|
-
}
|
3104
|
-
while (dates.length < 7)
|
3105
|
-
dates.push(null);
|
3106
|
-
return dates;
|
3107
|
-
}
|
3108
|
-
};
|
3109
|
-
}
|
3110
|
-
function $131cf43a05231e1e$var$unitDuration(duration) {
|
3111
|
-
let unit = {
|
3112
|
-
...duration
|
3113
|
-
};
|
3114
|
-
for (let key in duration)
|
3115
|
-
unit[key] = 1;
|
3116
|
-
return unit;
|
3117
|
-
}
|
3118
|
-
function $9a36b6ba2fb1a7c5$export$9a987164d97ecc90(props) {
|
3119
|
-
let { value: valueProp, defaultValue, onChange, createCalendar: createCalendar4, locale, visibleDuration = {
|
3120
|
-
months: 1
|
3121
|
-
}, minValue, maxValue, ...calendarProps } = props;
|
3122
|
-
let [value, setValue] = ($458b0a5536c1a7cf$export$40bfa8c7b0832715)(valueProp, defaultValue || null, onChange);
|
3123
|
-
let [anchorDate, setAnchorDateState] = (useState)(null);
|
3124
|
-
let alignment = "center";
|
3125
|
-
if (value && value.start && value.end) {
|
3126
|
-
let start = ($f62d864046160412$export$f4a51ff076cc9a09)((toCalendarDate)(value.start), visibleDuration, locale, minValue, maxValue);
|
3127
|
-
let end = start.add(visibleDuration).subtract({
|
3128
|
-
days: 1
|
3129
|
-
});
|
3130
|
-
if (value.end.compare(end) > 0)
|
3131
|
-
alignment = "start";
|
3132
|
-
}
|
3133
|
-
let availableRangeRef = (useRef)(null);
|
3134
|
-
let [availableRange, setAvailableRange] = (useState)(null);
|
3135
|
-
let min = (useMemo)(() => {
|
3136
|
-
return (maxDate)(minValue, availableRange === null || availableRange === void 0 ? void 0 : availableRange.start);
|
3137
|
-
}, [
|
3138
|
-
minValue,
|
3139
|
-
availableRange
|
3140
|
-
]);
|
3141
|
-
let max = (useMemo)(() => {
|
3142
|
-
return (minDate)(maxValue, availableRange === null || availableRange === void 0 ? void 0 : availableRange.end);
|
3143
|
-
}, [
|
3144
|
-
maxValue,
|
3145
|
-
availableRange
|
3146
|
-
]);
|
3147
|
-
let calendar = ($131cf43a05231e1e$export$6d095e787d2b5e1f)({
|
3148
|
-
...calendarProps,
|
3149
|
-
value: value && value.start,
|
3150
|
-
createCalendar: createCalendar4,
|
3151
|
-
locale,
|
3152
|
-
visibleDuration,
|
3153
|
-
minValue: min,
|
3154
|
-
maxValue: max,
|
3155
|
-
selectionAlignment: alignment
|
3156
|
-
});
|
3157
|
-
let updateAvailableRange = (date) => {
|
3158
|
-
if (date && props.isDateUnavailable && !props.allowsNonContiguousRanges) {
|
3159
|
-
availableRangeRef.current = {
|
3160
|
-
start: $9a36b6ba2fb1a7c5$var$nextUnavailableDate(date, calendar, -1),
|
3161
|
-
end: $9a36b6ba2fb1a7c5$var$nextUnavailableDate(date, calendar, 1)
|
3162
|
-
};
|
3163
|
-
setAvailableRange(availableRangeRef.current);
|
3164
|
-
} else {
|
3165
|
-
availableRangeRef.current = null;
|
3166
|
-
setAvailableRange(null);
|
3167
|
-
}
|
3168
|
-
};
|
3169
|
-
let [lastVisibleRange, setLastVisibleRange] = (useState)(calendar.visibleRange);
|
3170
|
-
if (!(isEqualDay)(calendar.visibleRange.start, lastVisibleRange.start) || !(isEqualDay)(calendar.visibleRange.end, lastVisibleRange.end)) {
|
3171
|
-
updateAvailableRange(anchorDate);
|
3172
|
-
setLastVisibleRange(calendar.visibleRange);
|
3173
|
-
}
|
3174
|
-
let setAnchorDate = (date) => {
|
3175
|
-
if (date) {
|
3176
|
-
setAnchorDateState(date);
|
3177
|
-
updateAvailableRange(date);
|
3178
|
-
} else {
|
3179
|
-
setAnchorDateState(null);
|
3180
|
-
updateAvailableRange(null);
|
3181
|
-
}
|
3182
|
-
};
|
3183
|
-
let highlightedRange = anchorDate ? $9a36b6ba2fb1a7c5$var$makeRange(anchorDate, calendar.focusedDate) : value && $9a36b6ba2fb1a7c5$var$makeRange(value.start, value.end);
|
3184
|
-
let selectDate = (date) => {
|
3185
|
-
if (props.isReadOnly)
|
3186
|
-
return;
|
3187
|
-
date = ($f62d864046160412$export$4f5203c0d889109e)(date, min, max);
|
3188
|
-
date = ($f62d864046160412$export$a1d3911297b952d7)(date, calendar.visibleRange.start, props.isDateUnavailable);
|
3189
|
-
if (!date)
|
3190
|
-
return;
|
3191
|
-
if (!anchorDate)
|
3192
|
-
setAnchorDate(date);
|
3193
|
-
else {
|
3194
|
-
let range = $9a36b6ba2fb1a7c5$var$makeRange(anchorDate, date);
|
3195
|
-
setValue({
|
3196
|
-
start: $9a36b6ba2fb1a7c5$var$convertValue(range.start, value === null || value === void 0 ? void 0 : value.start),
|
3197
|
-
end: $9a36b6ba2fb1a7c5$var$convertValue(range.end, value === null || value === void 0 ? void 0 : value.end)
|
3198
|
-
});
|
3199
|
-
setAnchorDate(null);
|
3200
|
-
}
|
3201
|
-
};
|
3202
|
-
let [isDragging, setDragging] = (useState)(false);
|
3203
|
-
let { isDateUnavailable } = props;
|
3204
|
-
let isInvalidSelection = (useMemo)(() => {
|
3205
|
-
if (!value || anchorDate)
|
3206
|
-
return false;
|
3207
|
-
if (isDateUnavailable && (isDateUnavailable(value.start) || isDateUnavailable(value.end)))
|
3208
|
-
return true;
|
3209
|
-
return ($f62d864046160412$export$eac50920cf2fd59a)(value.start, minValue, maxValue) || ($f62d864046160412$export$eac50920cf2fd59a)(value.end, minValue, maxValue);
|
3210
|
-
}, [
|
3211
|
-
isDateUnavailable,
|
3212
|
-
value,
|
3213
|
-
anchorDate,
|
3214
|
-
minValue,
|
3215
|
-
maxValue
|
3216
|
-
]);
|
3217
|
-
let validationState = props.validationState || (isInvalidSelection ? "invalid" : null);
|
3218
|
-
return {
|
3219
|
-
...calendar,
|
3220
|
-
value,
|
3221
|
-
setValue,
|
3222
|
-
anchorDate,
|
3223
|
-
setAnchorDate,
|
3224
|
-
highlightedRange,
|
3225
|
-
validationState,
|
3226
|
-
selectFocusedDate() {
|
3227
|
-
selectDate(calendar.focusedDate);
|
3228
|
-
},
|
3229
|
-
selectDate,
|
3230
|
-
highlightDate(date) {
|
3231
|
-
if (anchorDate)
|
3232
|
-
calendar.setFocusedDate(date);
|
3233
|
-
},
|
3234
|
-
isSelected(date) {
|
3235
|
-
return highlightedRange && date.compare(highlightedRange.start) >= 0 && date.compare(highlightedRange.end) <= 0 && !calendar.isCellDisabled(date) && !calendar.isCellUnavailable(date);
|
3236
|
-
},
|
3237
|
-
isInvalid(date) {
|
3238
|
-
var _availableRangeRef_current, _availableRangeRef_current1;
|
3239
|
-
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);
|
3240
|
-
},
|
3241
|
-
isDragging,
|
3242
|
-
setDragging
|
3243
|
-
};
|
3244
|
-
}
|
3245
|
-
function $9a36b6ba2fb1a7c5$var$makeRange(start, end) {
|
3246
|
-
if (!start || !end)
|
3247
|
-
return null;
|
3248
|
-
if (end.compare(start) < 0)
|
3249
|
-
[start, end] = [
|
3250
|
-
end,
|
3251
|
-
start
|
3252
|
-
];
|
3253
|
-
return {
|
3254
|
-
start: (toCalendarDate)(start),
|
3255
|
-
end: (toCalendarDate)(end)
|
3256
|
-
};
|
3257
|
-
}
|
3258
|
-
function $9a36b6ba2fb1a7c5$var$convertValue(newValue, oldValue) {
|
3259
|
-
newValue = (toCalendar)(newValue, (oldValue === null || oldValue === void 0 ? void 0 : oldValue.calendar) || new (GregorianCalendar)());
|
3260
|
-
if (oldValue && "hour" in oldValue)
|
3261
|
-
return oldValue.set(newValue);
|
3262
|
-
return newValue;
|
3263
|
-
}
|
3264
|
-
function $9a36b6ba2fb1a7c5$var$nextUnavailableDate(anchorDate, state2, dir) {
|
3265
|
-
let nextDate = anchorDate.add({
|
3266
|
-
days: dir
|
3267
|
-
});
|
3268
|
-
while ((dir < 0 ? nextDate.compare(state2.visibleRange.start) >= 0 : nextDate.compare(state2.visibleRange.end) <= 0) && !state2.isCellUnavailable(nextDate))
|
3269
|
-
nextDate = nextDate.add({
|
3270
|
-
days: dir
|
3271
|
-
});
|
3272
|
-
if (state2.isCellUnavailable(nextDate))
|
3273
|
-
return nextDate.add({
|
3274
|
-
days: -dir
|
3275
|
-
});
|
3276
|
-
return null;
|
3277
|
-
}
|
3278
1554
|
var Badge = forwardRef(
|
3279
1555
|
({ icon, colorScheme = "grey", children, ...props }, ref) => {
|
3280
1556
|
return /* @__PURE__ */ React69__default.createElement(
|
@@ -3303,7 +1579,12 @@ var Text4 = forwardRef(
|
|
3303
1579
|
return /* @__PURE__ */ React69__default.createElement(Text, { ...props, textStyle: variant, ref });
|
3304
1580
|
}
|
3305
1581
|
);
|
3306
|
-
function CalendarCell({
|
1582
|
+
function CalendarCell({
|
1583
|
+
state: state2,
|
1584
|
+
date,
|
1585
|
+
currentMonth,
|
1586
|
+
variant
|
1587
|
+
}) {
|
3307
1588
|
const ref = useRef(null);
|
3308
1589
|
const {
|
3309
1590
|
cellProps,
|
@@ -3405,7 +1686,11 @@ var weekDays = {
|
|
3405
1686
|
sv: ["M\xE5", "Ti", "On", "To", "Fr", "L\xF6", "S\xF6"],
|
3406
1687
|
en: ["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"]
|
3407
1688
|
};
|
3408
|
-
function CalendarGrid({
|
1689
|
+
function CalendarGrid({
|
1690
|
+
state: state2,
|
1691
|
+
variant,
|
1692
|
+
offset = {}
|
1693
|
+
}) {
|
3409
1694
|
const { language } = useTranslation();
|
3410
1695
|
const locale = useCurrentLocale();
|
3411
1696
|
const startDate = state2.visibleRange.start.add(offset);
|
@@ -3574,10 +1859,14 @@ var texts7 = createTexts({
|
|
3574
1859
|
});
|
3575
1860
|
|
3576
1861
|
// src/datepicker/Calendar.tsx
|
3577
|
-
function Calendar({
|
1862
|
+
function Calendar({
|
1863
|
+
showYearNavigation,
|
1864
|
+
variant,
|
1865
|
+
...props
|
1866
|
+
}) {
|
3578
1867
|
const { t: t2 } = useTranslation();
|
3579
1868
|
const locale = useCurrentLocale();
|
3580
|
-
const state2 =
|
1869
|
+
const state2 = useCalendarState({
|
3581
1870
|
...props,
|
3582
1871
|
locale,
|
3583
1872
|
createCalendar
|
@@ -3681,7 +1970,7 @@ var DateField = forwardRef$1(
|
|
3681
1970
|
var _a6;
|
3682
1971
|
const locale = useCurrentLocale();
|
3683
1972
|
const styles3 = useMultiStyleConfig("Datepicker", {});
|
3684
|
-
const state2 =
|
1973
|
+
const state2 = useDateFieldState({
|
3685
1974
|
...props,
|
3686
1975
|
locale,
|
3687
1976
|
createCalendar: createCalendar2
|
@@ -3752,7 +2041,7 @@ var DatePicker = forwardRef$1(
|
|
3752
2041
|
...props
|
3753
2042
|
}, externalRef) => {
|
3754
2043
|
const formControlProps = useFormControlContext();
|
3755
|
-
const state2 =
|
2044
|
+
const state2 = useDatePickerState({
|
3756
2045
|
...props,
|
3757
2046
|
shouldCloseOnSelect: true,
|
3758
2047
|
errorMessage,
|
@@ -3838,7 +2127,7 @@ var DatePicker = forwardRef$1(
|
|
3838
2127
|
);
|
3839
2128
|
function RangeCalendar(props) {
|
3840
2129
|
const locale = useCurrentLocale();
|
3841
|
-
const state2 =
|
2130
|
+
const state2 = useRangeCalendarState({
|
3842
2131
|
...props,
|
3843
2132
|
visibleDuration: { months: 2 },
|
3844
2133
|
locale,
|
@@ -3846,7 +2135,14 @@ function RangeCalendar(props) {
|
|
3846
2135
|
});
|
3847
2136
|
const ref = useRef(null);
|
3848
2137
|
const { calendarProps, title } = useRangeCalendar(props, state2, ref);
|
3849
|
-
return /* @__PURE__ */ React69__default.createElement(Box, { ...calendarProps, ref }, /* @__PURE__ */ React69__default.createElement(CalendarHeader, { state: state2, title }), /* @__PURE__ */ React69__default.createElement(Box, { display: "flex", gap: "8" }, /* @__PURE__ */ React69__default.createElement(CalendarGrid, { variant: props.variant, state: state2 }), /* @__PURE__ */ React69__default.createElement(
|
2138
|
+
return /* @__PURE__ */ React69__default.createElement(Box, { ...calendarProps, ref }, /* @__PURE__ */ React69__default.createElement(CalendarHeader, { state: state2, title }), /* @__PURE__ */ React69__default.createElement(Box, { display: "flex", gap: "8" }, /* @__PURE__ */ React69__default.createElement(CalendarGrid, { variant: props.variant, state: state2 }), /* @__PURE__ */ React69__default.createElement(
|
2139
|
+
CalendarGrid,
|
2140
|
+
{
|
2141
|
+
variant: props.variant,
|
2142
|
+
state: state2,
|
2143
|
+
offset: { months: 1 }
|
2144
|
+
}
|
2145
|
+
)));
|
3850
2146
|
}
|
3851
2147
|
|
3852
2148
|
// src/datepicker/DateRangePicker.tsx
|
@@ -3859,7 +2155,7 @@ function DateRangePicker({
|
|
3859
2155
|
...props
|
3860
2156
|
}) {
|
3861
2157
|
const formControlProps = useFormControlContext();
|
3862
|
-
const state2 =
|
2158
|
+
const state2 = useDateRangePickerState({
|
3863
2159
|
...props,
|
3864
2160
|
shouldCloseOnSelect: true,
|
3865
2161
|
isRequired: props.isRequired ?? (formControlProps == null ? void 0 : formControlProps.isRequired),
|
@@ -5046,8 +3342,15 @@ var texts13 = createTexts({
|
|
5046
3342
|
}
|
5047
3343
|
});
|
5048
3344
|
var PhoneNumberInput = forwardRef(
|
5049
|
-
({
|
3345
|
+
({
|
3346
|
+
label: externalLabel,
|
3347
|
+
name,
|
3348
|
+
value: externalValue,
|
3349
|
+
onChange: externalOnChange,
|
3350
|
+
...boxProps
|
3351
|
+
}, ref) => {
|
5050
3352
|
const { t: t2 } = useTranslation();
|
3353
|
+
const label = externalLabel ?? t2(texts14.phoneNumber);
|
5051
3354
|
const [value, onChange] = useControllableState({
|
5052
3355
|
value: externalValue,
|
5053
3356
|
onChange: externalOnChange,
|
@@ -5089,7 +3392,7 @@ var PhoneNumberInput = forwardRef(
|
|
5089
3392
|
{
|
5090
3393
|
ref,
|
5091
3394
|
type: "tel",
|
5092
|
-
label
|
3395
|
+
label,
|
5093
3396
|
value: value.nationalNumber,
|
5094
3397
|
name: name ? `${name}-phone-number` : "phone-number",
|
5095
3398
|
onChange: (e) => {
|
@@ -5113,7 +3416,7 @@ var texts14 = createTexts({
|
|
5113
3416
|
sv: "Telefonnummer"
|
5114
3417
|
}
|
5115
3418
|
});
|
5116
|
-
var LazyCountryCodeSelect = React69__default.lazy(() => import('./CountryCodeSelect-
|
3419
|
+
var LazyCountryCodeSelect = React69__default.lazy(() => import('./CountryCodeSelect-7MAIS4VT.mjs'));
|
5117
3420
|
var Radio = forwardRef((props, ref) => {
|
5118
3421
|
return /* @__PURE__ */ React69__default.createElement(Radio$1, { ...props, ref });
|
5119
3422
|
});
|
@@ -5866,13 +4169,13 @@ var StepperProvider = ({
|
|
5866
4169
|
activeStep,
|
5867
4170
|
children,
|
5868
4171
|
onClick,
|
5869
|
-
|
5870
|
-
|
4172
|
+
numberOfSteps,
|
4173
|
+
variant
|
5871
4174
|
}) => {
|
5872
4175
|
return /* @__PURE__ */ React69__default.createElement(
|
5873
4176
|
StepperContext.Provider,
|
5874
4177
|
{
|
5875
|
-
value: { activeStep, onClick,
|
4178
|
+
value: { activeStep, onClick, numberOfSteps, variant }
|
5876
4179
|
},
|
5877
4180
|
children
|
5878
4181
|
);
|
@@ -5894,9 +4197,9 @@ var Stepper = ({
|
|
5894
4197
|
steps,
|
5895
4198
|
activeStep: activeStepAsStringOrNumber,
|
5896
4199
|
title,
|
5897
|
-
|
4200
|
+
variant
|
5898
4201
|
}) => {
|
5899
|
-
const style = useMultiStyleConfig("Stepper", {
|
4202
|
+
const style = useMultiStyleConfig("Stepper", { variant });
|
5900
4203
|
const numberOfSteps = steps.length;
|
5901
4204
|
const activeStep = Number(activeStepAsStringOrNumber);
|
5902
4205
|
const { t: t2 } = useTranslation();
|
@@ -5905,7 +4208,7 @@ var Stepper = ({
|
|
5905
4208
|
{
|
5906
4209
|
onClick,
|
5907
4210
|
activeStep,
|
5908
|
-
|
4211
|
+
variant,
|
5909
4212
|
numberOfSteps
|
5910
4213
|
},
|
5911
4214
|
/* @__PURE__ */ React69__default.createElement(Box, { __css: style.container }, /* @__PURE__ */ React69__default.createElement(Box, { __css: style.innerContainer }, /* @__PURE__ */ React69__default.createElement(HStack, null, activeStep > 1 && /* @__PURE__ */ React69__default.createElement(
|
@@ -5924,8 +4227,16 @@ var Stepper = ({
|
|
5924
4227
|
triggerElement: /* @__PURE__ */ React69__default.createElement(Box, { as: "button", __css: style.stepCounter }, t2(texts21.stepsOf(activeStep, numberOfSteps))),
|
5925
4228
|
borderRadius: "xs"
|
5926
4229
|
},
|
5927
|
-
steps.map((step, index) => /* @__PURE__ */ React69__default.createElement(
|
5928
|
-
|
4230
|
+
steps.map((step, index) => /* @__PURE__ */ React69__default.createElement(
|
4231
|
+
StepperStep,
|
4232
|
+
{
|
4233
|
+
key: step,
|
4234
|
+
stepNumber: index + 1,
|
4235
|
+
variant
|
4236
|
+
},
|
4237
|
+
step
|
4238
|
+
))
|
4239
|
+
)), title && /* @__PURE__ */ React69__default.createElement(Box, { as: "h3", __css: style.title }, title)), /* @__PURE__ */ React69__default.createElement(Flex, { justifyContent: "center", display: ["none", "flex"] }, steps.map((step, index) => /* @__PURE__ */ React69__default.createElement(StepperStep, { key: index, stepNumber: index + 1, variant }, step))))
|
5929
4240
|
));
|
5930
4241
|
};
|
5931
4242
|
var texts21 = createTexts({
|
@@ -5942,28 +4253,57 @@ var texts21 = createTexts({
|
|
5942
4253
|
en: "Back"
|
5943
4254
|
}
|
5944
4255
|
});
|
5945
|
-
var StepperStep = ({
|
5946
|
-
|
5947
|
-
|
4256
|
+
var StepperStep = ({
|
4257
|
+
children,
|
4258
|
+
stepNumber,
|
4259
|
+
variant
|
4260
|
+
}) => {
|
4261
|
+
const { activeStep, onClick } = useStepper();
|
4262
|
+
const state2 = getState(stepNumber, activeStep);
|
5948
4263
|
const style = useMultiStyleConfig("Stepper", {
|
5949
|
-
|
5950
|
-
|
4264
|
+
state: state2,
|
4265
|
+
variant
|
5951
4266
|
});
|
4267
|
+
const adjustedProps = getButtonStylesForState(state2);
|
5952
4268
|
return /* @__PURE__ */ React69__default.createElement(Box, { __css: style.stepContainer }, stepNumber > 1 && /* @__PURE__ */ React69__default.createElement(DropdownRightFill18Icon, { marginX: 5, display: ["none", "block"] }), /* @__PURE__ */ React69__default.createElement(
|
5953
|
-
|
4269
|
+
Button,
|
5954
4270
|
{
|
5955
|
-
|
5956
|
-
|
5957
|
-
|
5958
|
-
type: "button",
|
5959
|
-
disabled: variant === "disabled" || variant === "active",
|
4271
|
+
size: "xs",
|
4272
|
+
variant: state2 === "active" ? "primary" : state2 === "completed" ? "additional" : "ghost",
|
4273
|
+
...adjustedProps,
|
5960
4274
|
onClick: () => onClick(stepNumber)
|
5961
4275
|
},
|
5962
|
-
|
5963
|
-
/* @__PURE__ */ React69__default.createElement(Box, { __css: style.stepTitle }, children)
|
4276
|
+
children
|
5964
4277
|
));
|
5965
4278
|
};
|
5966
|
-
var
|
4279
|
+
var getButtonStylesForState = (state2) => {
|
4280
|
+
switch (state2) {
|
4281
|
+
case "active":
|
4282
|
+
return {
|
4283
|
+
_hover: {},
|
4284
|
+
boxShadow: "none",
|
4285
|
+
_focus: {},
|
4286
|
+
_active: {},
|
4287
|
+
cursor: "auto"
|
4288
|
+
};
|
4289
|
+
case "completed":
|
4290
|
+
return {
|
4291
|
+
boxShadow: "none"
|
4292
|
+
};
|
4293
|
+
case "disabled":
|
4294
|
+
return {
|
4295
|
+
_disabled: {},
|
4296
|
+
_hover: {},
|
4297
|
+
_focus: {},
|
4298
|
+
_active: {},
|
4299
|
+
color: "dimGrey",
|
4300
|
+
cursor: "auto"
|
4301
|
+
};
|
4302
|
+
default:
|
4303
|
+
return {};
|
4304
|
+
}
|
4305
|
+
};
|
4306
|
+
var getState = (stepNumber, activeStep) => {
|
5967
4307
|
if (stepNumber < activeStep) {
|
5968
4308
|
return "completed";
|
5969
4309
|
}
|
@@ -11456,30 +9796,11 @@ var config6 = defineStyleConfig$1({
|
|
11456
9796
|
}
|
11457
9797
|
},
|
11458
9798
|
variants: {
|
11459
|
-
control: (props) => ({
|
11460
|
-
backgroundColor: mode("darkTeal", "mint")(props),
|
11461
|
-
color: mode("white", "darkTeal")(props),
|
11462
|
-
...focusVisible({
|
11463
|
-
focus: {
|
11464
|
-
boxShadow: `inset 0 0 0 4px ${mode(
|
11465
|
-
colors.darkTeal,
|
11466
|
-
colors.seaMist
|
11467
|
-
)(props)}, inset 0 0 0 6px currentColor`
|
11468
|
-
},
|
11469
|
-
notFocus: { boxShadow: "none" }
|
11470
|
-
}),
|
11471
|
-
_hover: {
|
11472
|
-
backgroundColor: mode("night", "coralGreen")(props)
|
11473
|
-
},
|
11474
|
-
_active: {
|
11475
|
-
backgroundColor: mode("pine", "white")(props)
|
11476
|
-
}
|
11477
|
-
}),
|
11478
9799
|
primary: (props) => ({
|
11479
9800
|
// FIXME: Update to use a global defined background color for darkMode whenever it is available.
|
11480
9801
|
// hardcoded background color as alpha-"hack" below is not feasible for dark mode with solid background color
|
11481
|
-
backgroundColor: "primaryGreen",
|
11482
|
-
color: "white",
|
9802
|
+
backgroundColor: mode("primaryGreen", "coralGreen")(props),
|
9803
|
+
color: mode("white", "darkTeal")(props),
|
11483
9804
|
...focusVisible({
|
11484
9805
|
focus: {
|
11485
9806
|
boxShadow: `inset 0 0 0 2px ${mode(
|
@@ -11493,28 +9814,28 @@ var config6 = defineStyleConfig$1({
|
|
11493
9814
|
notFocus: { boxShadow: "none" }
|
11494
9815
|
}),
|
11495
9816
|
_hover: {
|
11496
|
-
backgroundColor: "
|
9817
|
+
backgroundColor: mode("darkTeal", "blueGreen")(props)
|
11497
9818
|
},
|
11498
9819
|
_active: {
|
11499
|
-
backgroundColor: "
|
9820
|
+
backgroundColor: mode("greenHaze", "seaMist")(props)
|
11500
9821
|
}
|
11501
9822
|
}),
|
11502
9823
|
secondary: (props) => ({
|
11503
9824
|
// FIXME: Update to use global defined background color for darkMode whenever it is available instead of alpha
|
11504
|
-
backgroundColor: mode("seaMist", "
|
9825
|
+
backgroundColor: mode("seaMist", "primaryGreen")(props),
|
11505
9826
|
color: mode("darkTeal", "white")(props),
|
11506
9827
|
// order is important here for now while we do not have global defined background color for darkMode
|
11507
9828
|
_hover: {
|
11508
|
-
backgroundColor: mode("coralGreen", "
|
9829
|
+
backgroundColor: mode("coralGreen", "greenHaze")(props)
|
11509
9830
|
},
|
11510
9831
|
...focusVisible({
|
11511
9832
|
focus: {
|
11512
9833
|
boxShadow: `inset 0 0 0 2px ${mode(
|
11513
9834
|
colors.greenHaze,
|
11514
|
-
colors.
|
9835
|
+
colors.primaryGreen
|
11515
9836
|
)(props)}, inset 0 0 0 4px ${mode(
|
11516
9837
|
colors.white,
|
11517
|
-
colors.
|
9838
|
+
colors.darkTeal
|
11518
9839
|
)(props)}`,
|
11519
9840
|
_hover: {
|
11520
9841
|
boxShadow: `inset 0 0 0 2px ${mode(
|
@@ -11531,7 +9852,7 @@ var config6 = defineStyleConfig$1({
|
|
11531
9852
|
}
|
11532
9853
|
}),
|
11533
9854
|
_active: {
|
11534
|
-
backgroundColor: mode("mint", "
|
9855
|
+
backgroundColor: mode("mint", "darkTeal")(props),
|
11535
9856
|
boxShadow: `inset 0 0 0 2px ${mode(
|
11536
9857
|
colors.greenHaze,
|
11537
9858
|
colors.azure
|
@@ -11550,7 +9871,7 @@ var config6 = defineStyleConfig$1({
|
|
11550
9871
|
}
|
11551
9872
|
}
|
11552
9873
|
}),
|
11553
|
-
|
9874
|
+
tertiary: (props) => ({
|
11554
9875
|
backgroundColor: "transparent",
|
11555
9876
|
color: mode("darkGrey", "white")(props),
|
11556
9877
|
fontWeight: "normal",
|
@@ -11562,7 +9883,7 @@ var config6 = defineStyleConfig$1({
|
|
11562
9883
|
focus: {
|
11563
9884
|
boxShadow: getBoxShadowString({
|
11564
9885
|
borderWidth: 2,
|
11565
|
-
borderColor: "
|
9886
|
+
borderColor: "azure"
|
11566
9887
|
})
|
11567
9888
|
},
|
11568
9889
|
notFocus: {
|
@@ -11599,13 +9920,13 @@ var config6 = defineStyleConfig$1({
|
|
11599
9920
|
}
|
11600
9921
|
}),
|
11601
9922
|
_hover: {
|
11602
|
-
backgroundColor: mode("seaMist", "
|
9923
|
+
backgroundColor: mode("seaMist", "whiteAlpha.200")(props),
|
11603
9924
|
_disabled: {
|
11604
9925
|
color: "blackAlpha.300"
|
11605
9926
|
}
|
11606
9927
|
},
|
11607
9928
|
_active: {
|
11608
|
-
backgroundColor: mode("mint", "whiteAlpha.
|
9929
|
+
backgroundColor: mode("mint", "whiteAlpha.100")(props)
|
11609
9930
|
}
|
11610
9931
|
}),
|
11611
9932
|
floating: (props) => ({
|
@@ -11615,7 +9936,7 @@ var config6 = defineStyleConfig$1({
|
|
11615
9936
|
baseShadow: "sm"
|
11616
9937
|
}),
|
11617
9938
|
_active: {
|
11618
|
-
backgroundColor: mode("mint", "whiteAlpha.
|
9939
|
+
backgroundColor: mode("mint", "whiteAlpha.400")(props)
|
11619
9940
|
},
|
11620
9941
|
_hover: {
|
11621
9942
|
backgroundColor: mode("white", "whiteAlpha.200")(props),
|
@@ -11742,6 +10063,11 @@ var getColorSchemeBaseProps = (props) => {
|
|
11742
10063
|
backgroundColor: "seaMist"
|
11743
10064
|
};
|
11744
10065
|
}
|
10066
|
+
case "red": {
|
10067
|
+
return {
|
10068
|
+
backgroundColor: "pink"
|
10069
|
+
};
|
10070
|
+
}
|
11745
10071
|
default:
|
11746
10072
|
return {
|
11747
10073
|
backgroundColor: ((_a6 = colors[colorScheme]) == null ? void 0 : _a6[100]) ?? "platinum"
|
@@ -12170,7 +10496,9 @@ var config11 = defineStyleConfig$1({
|
|
12170
10496
|
...focusVisible({
|
12171
10497
|
focus: {
|
12172
10498
|
outline: "none",
|
12173
|
-
boxShadow: getBoxShadowString({
|
10499
|
+
boxShadow: getBoxShadowString({
|
10500
|
+
borderColor: mode("greenHaze", "azure")(props)
|
10501
|
+
}),
|
12174
10502
|
outlineOffset: "2px"
|
12175
10503
|
},
|
12176
10504
|
notFocus: {
|
@@ -12802,7 +11130,10 @@ var config15 = helpers8.defineMultiStyleConfig({
|
|
12802
11130
|
},
|
12803
11131
|
_hover: {
|
12804
11132
|
backgroundColor: mode("white", "transparent")(props),
|
12805
|
-
boxShadow: mode(
|
11133
|
+
boxShadow: mode(
|
11134
|
+
`inset 0 0 0 2px ${props.theme.colors.darkGrey}`,
|
11135
|
+
`inset 0 0 0 2px ${props.theme.colors.white}`
|
11136
|
+
)(props),
|
12806
11137
|
color: mode("darkGrey", "white")(props)
|
12807
11138
|
},
|
12808
11139
|
...focusVisible({
|
@@ -13352,7 +11683,7 @@ var config20 = helpers12.defineMultiStyleConfig({
|
|
13352
11683
|
size: "md"
|
13353
11684
|
},
|
13354
11685
|
variants: {
|
13355
|
-
|
11686
|
+
walk: (props) => ({
|
13356
11687
|
iconContainer: {
|
13357
11688
|
backgroundColor: mode("white", "transparent")(props),
|
13358
11689
|
boxShadow: mode(
|
@@ -13403,7 +11734,9 @@ var config21 = helpers13.defineMultiStyleConfig({
|
|
13403
11734
|
})
|
13404
11735
|
},
|
13405
11736
|
notFocus: {
|
13406
|
-
boxShadow: getBoxShadowString({
|
11737
|
+
boxShadow: getBoxShadowString({
|
11738
|
+
borderColor: mode("darkGrey", "white")(props)
|
11739
|
+
})
|
13407
11740
|
}
|
13408
11741
|
}),
|
13409
11742
|
_disabled: {
|
@@ -14169,7 +12502,6 @@ var helpers21 = createMultiStyleConfigHelpers$1(parts13.keys);
|
|
14169
12502
|
var config31 = helpers21.defineMultiStyleConfig({
|
14170
12503
|
baseStyle: (props) => ({
|
14171
12504
|
root: {
|
14172
|
-
backgroundColor: getRootBackgroundColor(props),
|
14173
12505
|
display: "flex",
|
14174
12506
|
alignItems: "center",
|
14175
12507
|
justifyContent: ["space-between", "center"],
|
@@ -14187,8 +12519,7 @@ var config31 = helpers21.defineMultiStyleConfig({
|
|
14187
12519
|
overflow: "hidden",
|
14188
12520
|
display: ["flex", "none"],
|
14189
12521
|
alignItems: "center",
|
14190
|
-
justifyContent: "space-between"
|
14191
|
-
color: getColor5(props)
|
12522
|
+
justifyContent: "space-between"
|
14192
12523
|
},
|
14193
12524
|
backButton: {
|
14194
12525
|
borderRadius: "xs",
|
@@ -14205,170 +12536,32 @@ var config31 = helpers21.defineMultiStyleConfig({
|
|
14205
12536
|
ml: 2,
|
14206
12537
|
textAlign: "right"
|
14207
12538
|
},
|
14208
|
-
stepCounter: {
|
14209
|
-
whiteSpace: "nowrap",
|
14210
|
-
textDecoration: "underline"
|
14211
|
-
},
|
14212
12539
|
stepContainer: {
|
14213
12540
|
display: "flex",
|
14214
12541
|
alignItems: "center"
|
14215
12542
|
},
|
14216
|
-
stepButton: {
|
14217
|
-
color: "inherit",
|
14218
|
-
display: "flex",
|
14219
|
-
alignItems: "center",
|
14220
|
-
padding: 1,
|
14221
|
-
borderRadius: "xs"
|
14222
|
-
},
|
14223
|
-
stepNumber: {
|
14224
|
-
borderRadius: "round",
|
14225
|
-
border: "sm",
|
14226
|
-
borderColor: "currentColor",
|
14227
|
-
width: 4,
|
14228
|
-
height: 4,
|
14229
|
-
mr: 1,
|
14230
|
-
display: "flex",
|
14231
|
-
alignItems: "center",
|
14232
|
-
justifyContent: "center",
|
14233
|
-
fontSize: ["mobile.xs", "desktop.xs"]
|
14234
|
-
},
|
14235
12543
|
stepTitle: {
|
14236
12544
|
textStyle: "sm",
|
14237
12545
|
whiteSpace: "nowrap"
|
14238
12546
|
}
|
14239
12547
|
}),
|
14240
12548
|
variants: {
|
14241
|
-
|
14242
|
-
|
14243
|
-
|
14244
|
-
},
|
14245
|
-
stepButton: {
|
14246
|
-
_hover: getHoverStyles(props),
|
14247
|
-
_focus: getFocusStyles(props),
|
14248
|
-
"&:focus:not(:focus-visible)": {
|
14249
|
-
boxShadow: "none"
|
14250
|
-
},
|
14251
|
-
_focusVisible: getFocusStyles(props),
|
14252
|
-
_active: getActiveStyles(props)
|
14253
|
-
}
|
14254
|
-
}),
|
14255
|
-
active: (props) => ({
|
14256
|
-
stepContainer: {
|
14257
|
-
color: getColor5(props)
|
14258
|
-
},
|
14259
|
-
stepButton: {
|
14260
|
-
pointerEvents: "none"
|
14261
|
-
},
|
14262
|
-
stepNumber: getStepNumberStyles(props),
|
14263
|
-
stepTitle: {
|
14264
|
-
fontWeight: "bold"
|
12549
|
+
base: (props) => ({
|
12550
|
+
root: {
|
12551
|
+
backgroundColor: "transparent"
|
14265
12552
|
}
|
14266
12553
|
}),
|
14267
|
-
|
14268
|
-
|
14269
|
-
|
14270
|
-
},
|
14271
|
-
stepButton: {
|
14272
|
-
pointerEvents: "none"
|
12554
|
+
accent: (props) => ({
|
12555
|
+
root: {
|
12556
|
+
backgroundColor: mode("seaMist", "pine")(props)
|
14273
12557
|
}
|
14274
12558
|
})
|
14275
12559
|
},
|
14276
12560
|
defaultProps: {
|
14277
|
-
|
12561
|
+
variant: "base"
|
14278
12562
|
}
|
14279
12563
|
});
|
14280
12564
|
var stepper_default = config31;
|
14281
|
-
var getRootBackgroundColor = (props) => {
|
14282
|
-
switch (props.colorScheme) {
|
14283
|
-
case "light":
|
14284
|
-
return "white";
|
14285
|
-
case "dark":
|
14286
|
-
return "darkTeal";
|
14287
|
-
case "green":
|
14288
|
-
default:
|
14289
|
-
return "seaMist";
|
14290
|
-
}
|
14291
|
-
};
|
14292
|
-
var getColor5 = (props) => {
|
14293
|
-
switch (props.colorScheme) {
|
14294
|
-
case "light":
|
14295
|
-
return mode("darkGrey", "white")(props);
|
14296
|
-
case "dark":
|
14297
|
-
return "white";
|
14298
|
-
case "green":
|
14299
|
-
default:
|
14300
|
-
return mode("darkTeal", "white")(props);
|
14301
|
-
}
|
14302
|
-
};
|
14303
|
-
var getStepNumberStyles = (props) => {
|
14304
|
-
switch (props.colorScheme) {
|
14305
|
-
case "dark":
|
14306
|
-
return {
|
14307
|
-
backgroundColor: "white",
|
14308
|
-
color: "darkTeal"
|
14309
|
-
};
|
14310
|
-
case "light":
|
14311
|
-
case "green":
|
14312
|
-
default:
|
14313
|
-
return {
|
14314
|
-
backgroundColor: mode("darkTeal", "white")(props),
|
14315
|
-
color: mode("white", "darkTeal")(props)
|
14316
|
-
};
|
14317
|
-
}
|
14318
|
-
};
|
14319
|
-
var getDisabledColor = (props) => {
|
14320
|
-
switch (props.colorScheme) {
|
14321
|
-
case "dark":
|
14322
|
-
return "whiteAlpha.400";
|
14323
|
-
case "green":
|
14324
|
-
return "dimGrey";
|
14325
|
-
case "light":
|
14326
|
-
default:
|
14327
|
-
return "osloGrey";
|
14328
|
-
}
|
14329
|
-
};
|
14330
|
-
var getHoverStyles = (props) => {
|
14331
|
-
switch (props.colorScheme) {
|
14332
|
-
case "dark":
|
14333
|
-
return { backgroundColor: "pine" };
|
14334
|
-
case "green":
|
14335
|
-
return {
|
14336
|
-
backgroundColor: mode("coralGreen", "primaryGreen")(props)
|
14337
|
-
};
|
14338
|
-
case "light":
|
14339
|
-
default:
|
14340
|
-
return {
|
14341
|
-
backgroundColor: mode("seaMist", "primaryGreen")(props)
|
14342
|
-
};
|
14343
|
-
}
|
14344
|
-
};
|
14345
|
-
var getFocusStyles = (props) => {
|
14346
|
-
switch (props.colorScheme) {
|
14347
|
-
case "dark":
|
14348
|
-
return {
|
14349
|
-
outline: "none",
|
14350
|
-
boxShadow: `inset 0 0 0 2px ${props.theme.colors.white}`
|
14351
|
-
};
|
14352
|
-
case "light":
|
14353
|
-
case "green":
|
14354
|
-
default:
|
14355
|
-
return {
|
14356
|
-
outline: "none",
|
14357
|
-
boxShadow: `inset 0 0 0 2px ${props.theme.colors.greenHaze}`
|
14358
|
-
};
|
14359
|
-
}
|
14360
|
-
};
|
14361
|
-
var getActiveStyles = (props) => {
|
14362
|
-
switch (props.colorScheme) {
|
14363
|
-
case "light":
|
14364
|
-
return { backgroundColor: "mint" };
|
14365
|
-
case "dark":
|
14366
|
-
return { backgroundColor: "celadon" };
|
14367
|
-
case "green":
|
14368
|
-
default:
|
14369
|
-
return { color: "azure", backgroundColor: "transparent" };
|
14370
|
-
}
|
14371
|
-
};
|
14372
12565
|
var $width2 = cssVar$1("switch-track-width");
|
14373
12566
|
var $height3 = cssVar$1("switch-track-height");
|
14374
12567
|
var $diff2 = cssVar$1("switch-track-diff");
|
@@ -14977,7 +13170,10 @@ var getTabColorSchemeHoverProps = (props) => {
|
|
14977
13170
|
};
|
14978
13171
|
case "base":
|
14979
13172
|
return {
|
14980
|
-
boxShadow: mode(
|
13173
|
+
boxShadow: mode(
|
13174
|
+
`inset 0 0 0 2px ${props.theme.colors.darkGrey}`,
|
13175
|
+
`inset 0 0 0 2px ${props.theme.colors.white}`
|
13176
|
+
)(props),
|
14981
13177
|
color: mode("darkGrey", "white")(props)
|
14982
13178
|
};
|
14983
13179
|
case "accent":
|
@@ -15076,7 +13272,10 @@ var getTablistColorSchemeProps = (props) => {
|
|
15076
13272
|
return {
|
15077
13273
|
backgroundColor: mode("white", "transparent")(props),
|
15078
13274
|
color: "darkGrey",
|
15079
|
-
boxShadow: mode(
|
13275
|
+
boxShadow: mode(
|
13276
|
+
`inset 0 0 0 1px ${props.theme.colors.blackAlpha["400"]}`,
|
13277
|
+
`inset 0 0 0 1px ${props.theme.colors.whiteAlpha["400"]}`
|
13278
|
+
)(props)
|
15080
13279
|
};
|
15081
13280
|
case "accent":
|
15082
13281
|
return {
|