@vygruppen/spor-react 3.0.2 → 3.0.4
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 +8 -8
- package/CHANGELOG.md +14 -0
- package/dist/{CountryCodeSelect-QGMCRWO6.mjs → CountryCodeSelect-PXKYFQHM.mjs} +1 -1
- package/dist/{chunk-CIZ54LAU.mjs → chunk-ETCK74GR.mjs} +301 -203
- package/dist/index.d.ts +6 -6
- package/dist/index.js +305 -208
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/src/datepicker/DateField.tsx +47 -27
- package/src/datepicker/DatePicker.tsx +122 -107
- package/src/datepicker/DateTimeSegment.tsx +41 -32
- package/src/datepicker/TimeField.tsx +1 -0
- package/src/input/Combobox.tsx +10 -1
- package/src/input/Popover.tsx +23 -1
- package/src/theme/components/datepicker.ts +1 -0
@@ -1,16 +1,16 @@
|
|
1
|
-
import { forwardRef, Accordion as Accordion$1, Skeleton as Skeleton$1, useButtonGroup, Button as Button$1, Box, Center, ButtonGroup as ButtonGroup$1, IconButton as IconButton$1, Stack as Stack$1, useStyleConfig, Badge as Badge$1, Code as Code$1, Text, useFormControlContext,
|
1
|
+
import { forwardRef, Accordion as Accordion$1, Skeleton as Skeleton$1, useButtonGroup, Button as Button$1, Box, Center, ButtonGroup as ButtonGroup$1, IconButton as IconButton$1, Stack as Stack$1, useStyleConfig, Badge as Badge$1, Code as Code$1, Text, useMultiStyleConfig, FormLabel, Flex, useFormControlContext, useBreakpointValue, Popover, InputGroup, PopoverAnchor, Portal, PopoverContent, PopoverArrow, PopoverBody, chakra, Checkbox as Checkbox$1, useCheckbox, FormControl as FormControl$1, InputLeftElement, Input as Input$1, InputRightElement, Select, useDisclosure, useControllableState, Radio as Radio$1, RadioGroup as RadioGroup$1, Switch as Switch$1, Textarea as Textarea$1, Link, ModalHeader as ModalHeader$1, useModalContext, DrawerContent as DrawerContent$1, Tabs as Tabs$1, Table as Table$1, defineStyleConfig as defineStyleConfig$1, createMultiStyleConfigHelpers as createMultiStyleConfigHelpers$1, AccordionItem, AccordionButton, AccordionIcon, AccordionPanel, SkeletonCircle as SkeletonCircle$1, SkeletonText as SkeletonText$1, Heading as Heading$1, CheckboxGroup as CheckboxGroup$1, useOutsideClick, List, ListItem, useColorModeValue, useFormControlProps, useFormControl, Drawer as Drawer$1, DrawerOverlay, DrawerCloseButton, DrawerBody, usePopoverContext, DarkMode, PopoverTrigger, PopoverCloseButton, ChakraProvider, HStack, useToast as useToast$1, useInterval } from '@chakra-ui/react';
|
2
2
|
export { AccordionButton, AccordionIcon, AccordionItem, AccordionPanel, Box, Center, Collapse, Container, DarkMode, DrawerBody, DrawerCloseButton, DrawerFooter, DrawerOverlay, Fade, Flex, FormHelperText, Grid, GridItem, HStack, Image, Img, InputGroup, LightMode, Modal, ModalBody, ModalCloseButton, ModalContent, ModalFooter, ModalOverlay, Popover, PopoverAnchor, PopoverArrow, PopoverBody, PopoverCloseButton, PopoverContent, PopoverFooter, PopoverHeader, PopoverTrigger, ScaleFade, SimpleGrid, Slide, SlideFade, Spacer, Tab, TabList, TabPanel, TabPanels, TableCaption, Tbody, Td, Tfoot, Th, Thead, Tr, VStack, Wrap, WrapItem, extendTheme, useBreakpointValue, useClipboard, useColorMode, useColorModePreference, useColorModeValue, useControllableProp, useDisclosure, useMediaQuery, useMergeRefs, useOutsideClick, usePrefersReducedMotion, useTheme, useToken } from '@chakra-ui/react';
|
3
3
|
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 React49 from 'react';
|
7
|
-
import React49__default, { createContext, forwardRef as forwardRef$1, useRef, useState, useEffect, useId, Suspense, useContext, useCallback
|
8
|
-
import { CloseFill30Icon, CloseFill24Icon, CloseFill18Icon, CloseOutline24Icon, SearchOutline24Icon, InformationFill24Icon, InformationFill18Icon, WarningFill24Icon, WarningFill18Icon, ErrorFill24Icon, ErrorFill18Icon, LinkOutOutline24Icon,
|
7
|
+
import React49__default, { createContext, forwardRef as forwardRef$1, useRef, useState, useEffect, useId, Suspense, useMemo, useContext, useCallback } from 'react';
|
8
|
+
import { CloseFill30Icon, CloseFill24Icon, CloseFill18Icon, CalendarOutline24Icon, CloseOutline24Icon, SearchOutline24Icon, InformationFill24Icon, InformationFill18Icon, WarningFill24Icon, WarningFill18Icon, ErrorFill24Icon, ErrorFill18Icon, LinkOutOutline24Icon, DropdownLeftFill24Icon, DropdownRightFill24Icon, DropdownDownFill18Icon, DropdownDownFill24Icon, DropdownUpFill24Icon, ArrowRightFill18Icon, DropdownRightFill18Icon, 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, spinnerDarkData, fullScreenLoaderBlackData, inlineLoaderLightData, spinnerLightData } from '@vygruppen/spor-loader';
|
10
10
|
import { useLottie } from 'lottie-react';
|
11
|
-
import { usePopover, Overlay, DismissButton, useOverlayTrigger, useButton, useProgressBar,
|
11
|
+
import { useDateSegment, useDateField, useDatePicker, I18nProvider, usePopover, Overlay, DismissButton, 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 { DateFormatter,
|
13
|
+
import { DateFormatter, toCalendar, getMinimumDayInMonth, getMinimumMonthInYear, createCalendar, GregorianCalendar, Time, now, toCalendarDate, toCalendarDateTime, today, startOfWeek, startOfMonth, endOfWeek, endOfMonth, isSameDay, getDayOfWeek, parseTime, getWeeksInMonth, getLocalTimeZone, startOfYear, maxDate, minDate, isEqualDay, isSameMonth, isToday } from '@internationalized/date';
|
14
14
|
export { Time } from '@internationalized/date';
|
15
15
|
import { useOverlayTriggerState, Item, useTimeFieldState, useComboBoxState, useSelectState } from 'react-stately';
|
16
16
|
export { Item, Section } from 'react-stately';
|
@@ -1533,26 +1533,30 @@ var Card = forwardRef(
|
|
1533
1533
|
);
|
1534
1534
|
function $458b0a5536c1a7cf$export$40bfa8c7b0832715(value, defaultValue, onChange) {
|
1535
1535
|
let [stateValue, setStateValue] = (useState)(value || defaultValue);
|
1536
|
-
let
|
1537
|
-
let wasControlled = ref.current;
|
1536
|
+
let isControlledRef = (useRef)(value !== void 0);
|
1538
1537
|
let isControlled = value !== void 0;
|
1539
|
-
|
1540
|
-
|
1541
|
-
|
1542
|
-
|
1538
|
+
(useEffect)(() => {
|
1539
|
+
let wasControlled = isControlledRef.current;
|
1540
|
+
if (wasControlled !== isControlled)
|
1541
|
+
console.warn(`WARN: A component changed from ${wasControlled ? "controlled" : "uncontrolled"} to ${isControlled ? "controlled" : "uncontrolled"}.`);
|
1542
|
+
isControlledRef.current = isControlled;
|
1543
|
+
}, [
|
1544
|
+
isControlled
|
1545
|
+
]);
|
1546
|
+
let currentValue = isControlled ? value : stateValue;
|
1543
1547
|
let setValue = (useCallback)((value2, ...args) => {
|
1544
1548
|
let onChangeCaller = (value3, ...onChangeArgs) => {
|
1545
1549
|
if (onChange) {
|
1546
|
-
if (!Object.is(
|
1550
|
+
if (!Object.is(currentValue, value3))
|
1547
1551
|
onChange(value3, ...onChangeArgs);
|
1548
1552
|
}
|
1549
1553
|
if (!isControlled)
|
1550
|
-
|
1554
|
+
currentValue = value3;
|
1551
1555
|
};
|
1552
1556
|
if (typeof value2 === "function") {
|
1553
1557
|
console.warn("We can not support a function callback. See Github Issues for details https://github.com/adobe/react-spectrum/issues/2320");
|
1554
1558
|
let updateFunction = (oldValue, ...functionArgs) => {
|
1555
|
-
let interceptedValue = value2(isControlled ?
|
1559
|
+
let interceptedValue = value2(isControlled ? currentValue : oldValue, ...functionArgs);
|
1556
1560
|
onChangeCaller(interceptedValue, ...args);
|
1557
1561
|
if (!isControlled)
|
1558
1562
|
return interceptedValue;
|
@@ -1566,14 +1570,11 @@ function $458b0a5536c1a7cf$export$40bfa8c7b0832715(value, defaultValue, onChange
|
|
1566
1570
|
}
|
1567
1571
|
}, [
|
1568
1572
|
isControlled,
|
1573
|
+
currentValue,
|
1569
1574
|
onChange
|
1570
1575
|
]);
|
1571
|
-
if (isControlled)
|
1572
|
-
stateRef.current = value;
|
1573
|
-
else
|
1574
|
-
value = stateValue;
|
1575
1576
|
return [
|
1576
|
-
|
1577
|
+
currentValue,
|
1577
1578
|
setValue
|
1578
1579
|
];
|
1579
1580
|
}
|
@@ -1581,18 +1582,28 @@ function $458b0a5536c1a7cf$export$40bfa8c7b0832715(value, defaultValue, onChange
|
|
1581
1582
|
// ../../node_modules/@react-stately/overlays/dist/import.mjs
|
1582
1583
|
function $fc909762b330b746$export$61c6a8c84e605fb6(props) {
|
1583
1584
|
let [isOpen, setOpen] = ($458b0a5536c1a7cf$export$40bfa8c7b0832715)(props.isOpen, props.defaultOpen || false, props.onOpenChange);
|
1585
|
+
const open = (useCallback)(() => {
|
1586
|
+
setOpen(true);
|
1587
|
+
}, [
|
1588
|
+
setOpen
|
1589
|
+
]);
|
1590
|
+
const close = (useCallback)(() => {
|
1591
|
+
setOpen(false);
|
1592
|
+
}, [
|
1593
|
+
setOpen
|
1594
|
+
]);
|
1595
|
+
const toggle = (useCallback)(() => {
|
1596
|
+
setOpen(!isOpen);
|
1597
|
+
}, [
|
1598
|
+
setOpen,
|
1599
|
+
isOpen
|
1600
|
+
]);
|
1584
1601
|
return {
|
1585
1602
|
isOpen,
|
1586
1603
|
setOpen,
|
1587
|
-
open
|
1588
|
-
|
1589
|
-
|
1590
|
-
close() {
|
1591
|
-
setOpen(false);
|
1592
|
-
},
|
1593
|
-
toggle() {
|
1594
|
-
setOpen(!isOpen);
|
1595
|
-
}
|
1604
|
+
open,
|
1605
|
+
close,
|
1606
|
+
toggle
|
1596
1607
|
};
|
1597
1608
|
}
|
1598
1609
|
|
@@ -1647,9 +1658,18 @@ var $35a22f14a1f04b11$var$DEFAULT_FIELD_OPTIONS = {
|
|
1647
1658
|
minute: "2-digit",
|
1648
1659
|
second: "2-digit"
|
1649
1660
|
};
|
1661
|
+
var $35a22f14a1f04b11$var$TWO_DIGIT_FIELD_OPTIONS = {
|
1662
|
+
year: "numeric",
|
1663
|
+
month: "2-digit",
|
1664
|
+
day: "2-digit",
|
1665
|
+
hour: "2-digit",
|
1666
|
+
minute: "2-digit",
|
1667
|
+
second: "2-digit"
|
1668
|
+
};
|
1650
1669
|
function $35a22f14a1f04b11$export$7e319ea407e63bc0(fieldOptions, options) {
|
1670
|
+
let defaultFieldOptions = options.shouldForceLeadingZeros ? $35a22f14a1f04b11$var$TWO_DIGIT_FIELD_OPTIONS : $35a22f14a1f04b11$var$DEFAULT_FIELD_OPTIONS;
|
1651
1671
|
fieldOptions = {
|
1652
|
-
|
1672
|
+
...defaultFieldOptions,
|
1653
1673
|
...fieldOptions
|
1654
1674
|
};
|
1655
1675
|
let granularity = options.granularity || "minute";
|
@@ -1705,17 +1725,25 @@ function $35a22f14a1f04b11$export$66aa2b09de4b1ea5(placeholderValue, granularity
|
|
1705
1725
|
return date;
|
1706
1726
|
}
|
1707
1727
|
function $35a22f14a1f04b11$export$2440da353cedad43(v, granularity) {
|
1708
|
-
let lastValue = (useRef)(v);
|
1709
|
-
if (v)
|
1710
|
-
lastValue.current = v;
|
1711
|
-
v = lastValue.current;
|
1712
1728
|
let defaultTimeZone = v && "timeZone" in v ? v.timeZone : void 0;
|
1713
|
-
|
1714
|
-
if (v && !(granularity in v))
|
1729
|
+
let defaultGranularity = v && "minute" in v ? "minute" : "day";
|
1730
|
+
if (v && granularity && !(granularity in v))
|
1715
1731
|
throw new Error("Invalid granularity " + granularity + " for value " + v.toString());
|
1732
|
+
let [lastValue, setLastValue] = (useState)([
|
1733
|
+
defaultGranularity,
|
1734
|
+
defaultTimeZone
|
1735
|
+
]);
|
1736
|
+
if (v && (lastValue[0] !== defaultGranularity || lastValue[1] !== defaultTimeZone))
|
1737
|
+
setLastValue([
|
1738
|
+
defaultGranularity,
|
1739
|
+
defaultTimeZone
|
1740
|
+
]);
|
1741
|
+
if (!granularity)
|
1742
|
+
granularity = v ? defaultGranularity : lastValue[0];
|
1743
|
+
let timeZone = v ? defaultTimeZone : lastValue[1];
|
1716
1744
|
return [
|
1717
1745
|
granularity,
|
1718
|
-
|
1746
|
+
timeZone
|
1719
1747
|
];
|
1720
1748
|
}
|
1721
1749
|
function $ab5bf3f618090389$export$87194bb378cc3ac2(props) {
|
@@ -1755,7 +1783,7 @@ function $ab5bf3f618090389$export$87194bb378cc3ac2(props) {
|
|
1755
1783
|
overlayState.setOpen(false);
|
1756
1784
|
};
|
1757
1785
|
let selectTime = (newValue) => {
|
1758
|
-
if (selectedDate)
|
1786
|
+
if (selectedDate && newValue)
|
1759
1787
|
commitValue(selectedDate, newValue);
|
1760
1788
|
else
|
1761
1789
|
setSelectedTime(newValue);
|
@@ -2226,11 +2254,13 @@ function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
|
|
2226
2254
|
timeZone: defaultTimeZone,
|
2227
2255
|
hideTimeZone,
|
2228
2256
|
hourCycle: props.hourCycle,
|
2229
|
-
showEra
|
2257
|
+
showEra,
|
2258
|
+
shouldForceLeadingZeros: props.shouldForceLeadingZeros
|
2230
2259
|
}), [
|
2231
2260
|
props.maxGranularity,
|
2232
2261
|
granularity,
|
2233
2262
|
props.hourCycle,
|
2263
|
+
props.shouldForceLeadingZeros,
|
2234
2264
|
defaultTimeZone,
|
2235
2265
|
hideTimeZone,
|
2236
2266
|
showEra
|
@@ -2535,11 +2565,11 @@ function $3c0fc76039f1c516$var$setSegment(value, part, segmentValue, options) {
|
|
2535
2565
|
}
|
2536
2566
|
case "hour":
|
2537
2567
|
if (options.hour12) {
|
2538
|
-
let
|
2539
|
-
let
|
2540
|
-
if (!
|
2568
|
+
let hours = value.hour;
|
2569
|
+
let wasPM = hours >= 12;
|
2570
|
+
if (!wasPM && segmentValue === 12)
|
2541
2571
|
segmentValue = 0;
|
2542
|
-
if (
|
2572
|
+
if (wasPM && segmentValue < 12)
|
2543
2573
|
segmentValue += 12;
|
2544
2574
|
}
|
2545
2575
|
case "minute":
|
@@ -2684,11 +2714,11 @@ function $93c38a5e28be6249$export$e50a61c1de9f574(props) {
|
|
2684
2714
|
}
|
2685
2715
|
let start = "";
|
2686
2716
|
let end = "";
|
2687
|
-
for (let
|
2688
|
-
if (
|
2689
|
-
start += parts14[
|
2690
|
-
else if (
|
2691
|
-
end += parts14[
|
2717
|
+
for (let i = 0; i < parts14.length; i++) {
|
2718
|
+
if (i < separatorIndex)
|
2719
|
+
start += parts14[i].value;
|
2720
|
+
else if (i > separatorIndex)
|
2721
|
+
end += parts14[i].value;
|
2692
2722
|
}
|
2693
2723
|
return {
|
2694
2724
|
start,
|
@@ -2784,7 +2814,7 @@ function $131cf43a05231e1e$export$6d095e787d2b5e1f(props) {
|
|
2784
2814
|
]);
|
2785
2815
|
let { locale, createCalendar: createCalendar4, visibleDuration = {
|
2786
2816
|
months: 1
|
2787
|
-
}, minValue, maxValue, selectionAlignment, isDateUnavailable } = props;
|
2817
|
+
}, minValue, maxValue, selectionAlignment, isDateUnavailable, pageBehavior = "visible" } = props;
|
2788
2818
|
let calendar = (useMemo)(() => createCalendar4(resolvedOptions.calendar), [
|
2789
2819
|
createCalendar4,
|
2790
2820
|
resolvedOptions.calendar
|
@@ -2838,12 +2868,12 @@ function $131cf43a05231e1e$export$6d095e787d2b5e1f(props) {
|
|
2838
2868
|
startDate,
|
2839
2869
|
visibleDuration
|
2840
2870
|
]);
|
2841
|
-
let lastCalendarIdentifier = (
|
2842
|
-
if (calendar.identifier !== lastCalendarIdentifier
|
2871
|
+
let [lastCalendarIdentifier, setLastCalendarIdentifier] = (useState)(calendar.identifier);
|
2872
|
+
if (calendar.identifier !== lastCalendarIdentifier) {
|
2843
2873
|
let newFocusedDate = (toCalendar)(focusedDate, calendar);
|
2844
2874
|
setStartDate(($f62d864046160412$export$f4a51ff076cc9a09)(newFocusedDate, visibleDuration, locale, minValue, maxValue));
|
2845
2875
|
setFocusedDate(newFocusedDate);
|
2846
|
-
|
2876
|
+
setLastCalendarIdentifier(calendar.identifier);
|
2847
2877
|
}
|
2848
2878
|
if (($f62d864046160412$export$eac50920cf2fd59a)(focusedDate, minValue, maxValue))
|
2849
2879
|
setFocusedDate(($f62d864046160412$export$4f5203c0d889109e)(focusedDate, minValue, maxValue));
|
@@ -2881,6 +2911,14 @@ function $131cf43a05231e1e$export$6d095e787d2b5e1f(props) {
|
|
2881
2911
|
maxValue
|
2882
2912
|
]);
|
2883
2913
|
let validationState = props.validationState || (isUnavailable ? "invalid" : null);
|
2914
|
+
let pageDuration = (useMemo)(() => {
|
2915
|
+
if (pageBehavior === "visible")
|
2916
|
+
return visibleDuration;
|
2917
|
+
return $131cf43a05231e1e$var$unitDuration(visibleDuration);
|
2918
|
+
}, [
|
2919
|
+
pageBehavior,
|
2920
|
+
visibleDuration
|
2921
|
+
]);
|
2884
2922
|
return {
|
2885
2923
|
isDisabled: props.isDisabled,
|
2886
2924
|
isReadOnly: props.isReadOnly,
|
@@ -2926,14 +2964,14 @@ function $131cf43a05231e1e$export$6d095e787d2b5e1f(props) {
|
|
2926
2964
|
}));
|
2927
2965
|
},
|
2928
2966
|
focusNextPage() {
|
2929
|
-
let start = startDate.add(
|
2930
|
-
setFocusedDate(($f62d864046160412$export$4f5203c0d889109e)(focusedDate.add(
|
2931
|
-
setStartDate(($f62d864046160412$export$144a00ba6044eb9)(($f62d864046160412$export$5bb865b12696a77d)(focusedDate, start,
|
2967
|
+
let start = startDate.add(pageDuration);
|
2968
|
+
setFocusedDate(($f62d864046160412$export$4f5203c0d889109e)(focusedDate.add(pageDuration), minValue, maxValue));
|
2969
|
+
setStartDate(($f62d864046160412$export$144a00ba6044eb9)(($f62d864046160412$export$5bb865b12696a77d)(focusedDate, start, pageDuration, locale, minValue, maxValue), pageDuration, locale));
|
2932
2970
|
},
|
2933
2971
|
focusPreviousPage() {
|
2934
|
-
let start = startDate.subtract(
|
2935
|
-
setFocusedDate(($f62d864046160412$export$4f5203c0d889109e)(focusedDate.subtract(
|
2936
|
-
setStartDate(($f62d864046160412$export$144a00ba6044eb9)(($f62d864046160412$export$5bb865b12696a77d)(focusedDate, start,
|
2972
|
+
let start = startDate.subtract(pageDuration);
|
2973
|
+
setFocusedDate(($f62d864046160412$export$4f5203c0d889109e)(focusedDate.subtract(pageDuration), minValue, maxValue));
|
2974
|
+
setStartDate(($f62d864046160412$export$144a00ba6044eb9)(($f62d864046160412$export$5bb865b12696a77d)(focusedDate, start, pageDuration, locale, minValue, maxValue), pageDuration, locale));
|
2937
2975
|
},
|
2938
2976
|
focusSectionStart() {
|
2939
2977
|
if (visibleDuration.days)
|
@@ -3101,10 +3139,10 @@ function $9a36b6ba2fb1a7c5$export$9a987164d97ecc90(props) {
|
|
3101
3139
|
setAvailableRange(null);
|
3102
3140
|
}
|
3103
3141
|
};
|
3104
|
-
let lastVisibleRange = (
|
3105
|
-
if (!(isEqualDay)(calendar.visibleRange.start, lastVisibleRange.
|
3142
|
+
let [lastVisibleRange, setLastVisibleRange] = (useState)(calendar.visibleRange);
|
3143
|
+
if (!(isEqualDay)(calendar.visibleRange.start, lastVisibleRange.start) || !(isEqualDay)(calendar.visibleRange.end, lastVisibleRange.end)) {
|
3106
3144
|
updateAvailableRange(anchorDate);
|
3107
|
-
|
3145
|
+
setLastVisibleRange(calendar.visibleRange);
|
3108
3146
|
}
|
3109
3147
|
let setAnchorDate = (date) => {
|
3110
3148
|
if (date) {
|
@@ -3526,37 +3564,44 @@ var texts8 = createTexts({
|
|
3526
3564
|
en: "Open calendar"
|
3527
3565
|
}
|
3528
3566
|
});
|
3529
|
-
var DateTimeSegment = (
|
3530
|
-
|
3531
|
-
|
3532
|
-
|
3533
|
-
|
3534
|
-
|
3535
|
-
|
3536
|
-
|
3537
|
-
|
3538
|
-
{
|
3539
|
-
|
3540
|
-
|
3541
|
-
|
3542
|
-
|
3543
|
-
|
3544
|
-
|
3567
|
+
var DateTimeSegment = forwardRef$1(
|
3568
|
+
({ segment, state: state2 }, externalRef) => {
|
3569
|
+
const internalRef = useRef(null);
|
3570
|
+
const ref = externalRef ?? internalRef;
|
3571
|
+
const { segmentProps } = useDateSegment(
|
3572
|
+
segment,
|
3573
|
+
state2,
|
3574
|
+
ref
|
3575
|
+
);
|
3576
|
+
const styles2 = useMultiStyleConfig("Datepicker", {
|
3577
|
+
isPlaceholder: segment.isPlaceholder,
|
3578
|
+
isEditable: segment.isEditable
|
3579
|
+
});
|
3580
|
+
return /* @__PURE__ */ React49__default.createElement(
|
3581
|
+
Box,
|
3582
|
+
{
|
3583
|
+
...segmentProps,
|
3584
|
+
ref,
|
3585
|
+
style: {
|
3586
|
+
...segmentProps.style,
|
3587
|
+
fontVariantNumeric: "tabular-nums",
|
3588
|
+
boxSizing: "content-box"
|
3589
|
+
},
|
3590
|
+
paddingX: "1px",
|
3591
|
+
textAlign: "end",
|
3592
|
+
outline: "none",
|
3593
|
+
borderRadius: "xs",
|
3594
|
+
fontSize: "mobile.md",
|
3595
|
+
sx: styles2.dateTimeSegment,
|
3596
|
+
_focus: {
|
3597
|
+
backgroundColor: "darkTeal",
|
3598
|
+
color: "white"
|
3599
|
+
}
|
3545
3600
|
},
|
3546
|
-
|
3547
|
-
|
3548
|
-
|
3549
|
-
|
3550
|
-
fontSize: "mobile.md",
|
3551
|
-
sx: styles2.dateTimeSegment,
|
3552
|
-
_focus: {
|
3553
|
-
backgroundColor: "darkTeal",
|
3554
|
-
color: "white"
|
3555
|
-
}
|
3556
|
-
},
|
3557
|
-
isPaddable(segment.type) ? segment.text.padStart(2, "0") : segment.text
|
3558
|
-
);
|
3559
|
-
};
|
3601
|
+
isPaddable(segment.type) ? segment.text.padStart(2, "0") : segment.text
|
3602
|
+
);
|
3603
|
+
}
|
3604
|
+
);
|
3560
3605
|
var isPaddable = (segmentType) => segmentType === "month" || segmentType === "day" || segmentType === "hour" || segmentType === "minute" || segmentType === "second";
|
3561
3606
|
|
3562
3607
|
// src/datepicker/DateField.tsx
|
@@ -3568,19 +3613,49 @@ function createCalendar2(identifier) {
|
|
3568
3613
|
throw new Error(`Unsupported calendar ${identifier}`);
|
3569
3614
|
}
|
3570
3615
|
}
|
3571
|
-
|
3572
|
-
|
3573
|
-
|
3574
|
-
|
3575
|
-
|
3576
|
-
|
3577
|
-
|
3578
|
-
|
3579
|
-
|
3580
|
-
|
3581
|
-
|
3582
|
-
|
3583
|
-
}
|
3616
|
+
var DateField = forwardRef$1(
|
3617
|
+
(props, externalRef) => {
|
3618
|
+
var _a6;
|
3619
|
+
const locale = useCurrentLocale();
|
3620
|
+
const styles2 = useMultiStyleConfig("Datepicker", {});
|
3621
|
+
const state2 = $3c0fc76039f1c516$export$60e84778edff6d26({
|
3622
|
+
...props,
|
3623
|
+
locale,
|
3624
|
+
createCalendar: createCalendar2
|
3625
|
+
});
|
3626
|
+
const internalRef = useRef(null);
|
3627
|
+
const ref = externalRef ?? internalRef;
|
3628
|
+
const { fieldProps, labelProps } = useDateField(
|
3629
|
+
props,
|
3630
|
+
state2,
|
3631
|
+
ref
|
3632
|
+
);
|
3633
|
+
return /* @__PURE__ */ React49__default.createElement(Box, { minWidth: "6rem", width: "100%" }, props.label && /* @__PURE__ */ React49__default.createElement(
|
3634
|
+
FormLabel,
|
3635
|
+
{
|
3636
|
+
...props.labelProps,
|
3637
|
+
...labelProps,
|
3638
|
+
sx: styles2.inputLabel
|
3639
|
+
},
|
3640
|
+
props.label
|
3641
|
+
), /* @__PURE__ */ React49__default.createElement(Flex, { ...fieldProps }, state2.segments.map((segment, i) => /* @__PURE__ */ React49__default.createElement(
|
3642
|
+
DateTimeSegment,
|
3643
|
+
{
|
3644
|
+
ref: i === 0 ? ref : void 0,
|
3645
|
+
key: i,
|
3646
|
+
segment,
|
3647
|
+
state: state2
|
3648
|
+
}
|
3649
|
+
))), /* @__PURE__ */ React49__default.createElement(
|
3650
|
+
"input",
|
3651
|
+
{
|
3652
|
+
type: "hidden",
|
3653
|
+
value: (_a6 = state2.value) == null ? void 0 : _a6.toString(),
|
3654
|
+
name: props.name
|
3655
|
+
}
|
3656
|
+
));
|
3657
|
+
}
|
3658
|
+
);
|
3584
3659
|
var StyledField = forwardRef(
|
3585
3660
|
({ children, variant, ...otherProps }, ref) => {
|
3586
3661
|
const { isInvalid } = useFormControlContext() ?? {
|
@@ -3601,106 +3676,114 @@ var StyledField = forwardRef(
|
|
3601
3676
|
);
|
3602
3677
|
|
3603
3678
|
// src/datepicker/DatePicker.tsx
|
3604
|
-
|
3605
|
-
|
3606
|
-
|
3607
|
-
minHeight,
|
3608
|
-
showYearNavigation,
|
3609
|
-
width = "auto",
|
3610
|
-
...props
|
3611
|
-
}) {
|
3612
|
-
const formControlProps = useFormControlContext();
|
3613
|
-
const state2 = $ab5bf3f618090389$export$87194bb378cc3ac2({
|
3614
|
-
...props,
|
3615
|
-
shouldCloseOnSelect: true,
|
3679
|
+
var DatePicker = forwardRef$1(
|
3680
|
+
({
|
3681
|
+
variant,
|
3616
3682
|
errorMessage,
|
3617
|
-
|
3618
|
-
|
3619
|
-
|
3620
|
-
|
3621
|
-
|
3622
|
-
|
3623
|
-
|
3624
|
-
|
3625
|
-
|
3626
|
-
|
3627
|
-
|
3628
|
-
|
3629
|
-
|
3630
|
-
|
3631
|
-
|
3632
|
-
|
3633
|
-
|
3634
|
-
|
3635
|
-
|
3636
|
-
|
3637
|
-
|
3638
|
-
|
3639
|
-
|
3640
|
-
|
3641
|
-
|
3642
|
-
|
3643
|
-
|
3644
|
-
|
3645
|
-
|
3646
|
-
|
3647
|
-
{
|
3648
|
-
|
3649
|
-
|
3650
|
-
|
3651
|
-
|
3652
|
-
}
|
3653
|
-
|
3654
|
-
|
3683
|
+
minHeight,
|
3684
|
+
showYearNavigation,
|
3685
|
+
width = "auto",
|
3686
|
+
...props
|
3687
|
+
}, externalRef) => {
|
3688
|
+
const formControlProps = useFormControlContext();
|
3689
|
+
const state2 = $ab5bf3f618090389$export$87194bb378cc3ac2({
|
3690
|
+
...props,
|
3691
|
+
shouldCloseOnSelect: true,
|
3692
|
+
errorMessage,
|
3693
|
+
isRequired: props.isRequired ?? (formControlProps == null ? void 0 : formControlProps.isRequired),
|
3694
|
+
validationState: (formControlProps == null ? void 0 : formControlProps.isInvalid) ? "invalid" : "valid"
|
3695
|
+
});
|
3696
|
+
const internalRef = useRef(null);
|
3697
|
+
const ref = externalRef ?? internalRef;
|
3698
|
+
const {
|
3699
|
+
groupProps,
|
3700
|
+
labelProps,
|
3701
|
+
fieldProps,
|
3702
|
+
buttonProps,
|
3703
|
+
dialogProps,
|
3704
|
+
calendarProps,
|
3705
|
+
errorMessageProps
|
3706
|
+
} = useDatePicker(
|
3707
|
+
props,
|
3708
|
+
state2,
|
3709
|
+
ref
|
3710
|
+
);
|
3711
|
+
const responsiveVariant = useBreakpointValue(typeof variant === "string" ? [variant] : variant) ?? "simple";
|
3712
|
+
const locale = useCurrentLocale();
|
3713
|
+
const handleEnterClick = (e) => {
|
3714
|
+
if (responsiveVariant === "simple" && e.key === "Enter" && !state2.isOpen) {
|
3715
|
+
e.stopPropagation();
|
3716
|
+
state2.setOpen(true);
|
3717
|
+
}
|
3718
|
+
};
|
3719
|
+
const onFieldClick = () => {
|
3720
|
+
if (!hasTrigger) {
|
3721
|
+
state2.setOpen(true);
|
3722
|
+
}
|
3723
|
+
};
|
3724
|
+
const hasTrigger = responsiveVariant === "with-trigger";
|
3725
|
+
const styles2 = useMultiStyleConfig("Datepicker", {});
|
3726
|
+
return /* @__PURE__ */ React49__default.createElement(I18nProvider, { locale }, /* @__PURE__ */ React49__default.createElement(
|
3727
|
+
Box,
|
3655
3728
|
{
|
3656
|
-
|
3657
|
-
|
3658
|
-
|
3659
|
-
|
3660
|
-
|
3661
|
-
|
3662
|
-
|
3663
|
-
},
|
3664
|
-
/* @__PURE__ */ React49__default.createElement(InputGroup, { ...groupProps, ref, display: "inline-flex" }, /* @__PURE__ */ React49__default.createElement(PopoverAnchor, null, /* @__PURE__ */ React49__default.createElement(
|
3665
|
-
StyledField,
|
3729
|
+
position: "relative",
|
3730
|
+
display: "inline-flex",
|
3731
|
+
flexDirection: "column",
|
3732
|
+
width
|
3733
|
+
},
|
3734
|
+
/* @__PURE__ */ React49__default.createElement(
|
3735
|
+
Popover,
|
3666
3736
|
{
|
3667
|
-
|
3668
|
-
|
3669
|
-
|
3670
|
-
|
3671
|
-
|
3737
|
+
...dialogProps,
|
3738
|
+
isOpen: state2.isOpen,
|
3739
|
+
onClose: state2.close,
|
3740
|
+
onOpen: state2.open,
|
3741
|
+
closeOnBlur: true,
|
3742
|
+
closeOnEsc: true,
|
3743
|
+
returnFocusOnClose: true
|
3672
3744
|
},
|
3673
|
-
|
3674
|
-
|
3675
|
-
DateField,
|
3745
|
+
/* @__PURE__ */ React49__default.createElement(InputGroup, { ...groupProps, display: "inline-flex" }, /* @__PURE__ */ React49__default.createElement(PopoverAnchor, null, /* @__PURE__ */ React49__default.createElement(
|
3746
|
+
StyledField,
|
3676
3747
|
{
|
3677
|
-
|
3678
|
-
|
3679
|
-
|
3680
|
-
|
3681
|
-
|
3682
|
-
|
3683
|
-
|
3684
|
-
|
3685
|
-
|
3686
|
-
|
3687
|
-
|
3688
|
-
|
3689
|
-
|
3690
|
-
|
3691
|
-
|
3692
|
-
|
3693
|
-
|
3694
|
-
|
3748
|
+
variant: responsiveVariant,
|
3749
|
+
onClick: onFieldClick,
|
3750
|
+
onKeyPress: handleEnterClick,
|
3751
|
+
paddingX: 3,
|
3752
|
+
minHeight
|
3753
|
+
},
|
3754
|
+
!hasTrigger && /* @__PURE__ */ React49__default.createElement(CalendarOutline24Icon, { marginRight: 2, alignSelf: "center" }),
|
3755
|
+
/* @__PURE__ */ React49__default.createElement(
|
3756
|
+
DateField,
|
3757
|
+
{
|
3758
|
+
label: props.label,
|
3759
|
+
labelProps,
|
3760
|
+
name: props.name,
|
3761
|
+
ref,
|
3762
|
+
...fieldProps
|
3763
|
+
}
|
3764
|
+
)
|
3765
|
+
)), hasTrigger && /* @__PURE__ */ React49__default.createElement(CalendarTriggerButton, { ...buttonProps })),
|
3766
|
+
/* @__PURE__ */ React49__default.createElement(FormErrorMessage, { ...errorMessageProps }, errorMessage),
|
3767
|
+
state2.isOpen && !props.isDisabled && /* @__PURE__ */ React49__default.createElement(Portal, null, /* @__PURE__ */ React49__default.createElement(
|
3768
|
+
PopoverContent,
|
3695
3769
|
{
|
3696
|
-
|
3697
|
-
|
3698
|
-
|
3770
|
+
color: "darkGrey",
|
3771
|
+
boxShadow: "md",
|
3772
|
+
sx: styles2.calendar
|
3773
|
+
},
|
3774
|
+
/* @__PURE__ */ React49__default.createElement(PopoverArrow, { sx: styles2.arrow }),
|
3775
|
+
/* @__PURE__ */ React49__default.createElement(PopoverBody, null, /* @__PURE__ */ React49__default.createElement(
|
3776
|
+
Calendar,
|
3777
|
+
{
|
3778
|
+
...calendarProps,
|
3779
|
+
showYearNavigation
|
3780
|
+
}
|
3781
|
+
))
|
3699
3782
|
))
|
3700
|
-
)
|
3701
|
-
)
|
3702
|
-
|
3703
|
-
|
3783
|
+
)
|
3784
|
+
));
|
3785
|
+
}
|
3786
|
+
);
|
3704
3787
|
function RangeCalendar(props) {
|
3705
3788
|
const locale = useCurrentLocale();
|
3706
3789
|
const state2 = $9a36b6ba2fb1a7c5$export$9a987164d97ecc90({
|
@@ -3828,7 +3911,8 @@ var TimeField = ({ state: state2, ...props }) => {
|
|
3828
3911
|
...labelProps,
|
3829
3912
|
htmlFor: fieldProps.id,
|
3830
3913
|
marginBottom: 0,
|
3831
|
-
fontSize: "mobile.xs"
|
3914
|
+
fontSize: "mobile.xs",
|
3915
|
+
cursor: "text"
|
3832
3916
|
},
|
3833
3917
|
props.label
|
3834
3918
|
), /* @__PURE__ */ React49__default.createElement(Flex, { ...fieldProps, ref }, state2.segments.map((segment) => /* @__PURE__ */ React49__default.createElement(DateTimeSegment, { key: segment.type, segment, state: state2 }))), /* @__PURE__ */ React49__default.createElement(
|
@@ -4031,7 +4115,10 @@ var Popover3 = forwardRef$1(
|
|
4031
4115
|
triggerRef,
|
4032
4116
|
offset = 0,
|
4033
4117
|
crossOffset = 0,
|
4034
|
-
placement = "bottom"
|
4118
|
+
placement = "bottom",
|
4119
|
+
shouldFlip = false,
|
4120
|
+
isNonModal = false,
|
4121
|
+
hasBackdrop = true
|
4035
4122
|
}, ref) => {
|
4036
4123
|
var _a6;
|
4037
4124
|
const internalRef = useRef(null);
|
@@ -4042,11 +4129,13 @@ var Popover3 = forwardRef$1(
|
|
4042
4129
|
popoverRef,
|
4043
4130
|
offset,
|
4044
4131
|
crossOffset,
|
4045
|
-
placement
|
4132
|
+
placement,
|
4133
|
+
shouldFlip,
|
4134
|
+
isNonModal
|
4046
4135
|
},
|
4047
4136
|
state2
|
4048
4137
|
);
|
4049
|
-
return /* @__PURE__ */ React49__default.createElement(Overlay, null, /* @__PURE__ */ React49__default.createElement(Box, { ...underlayProps, position: "fixed", inset: "0" }), /* @__PURE__ */ React49__default.createElement(
|
4138
|
+
return /* @__PURE__ */ React49__default.createElement(Overlay, null, hasBackdrop && /* @__PURE__ */ React49__default.createElement(Box, { ...underlayProps, position: "fixed", inset: "0" }), /* @__PURE__ */ React49__default.createElement(
|
4050
4139
|
Box,
|
4051
4140
|
{
|
4052
4141
|
...popoverProps,
|
@@ -4227,6 +4316,11 @@ function Combobox({
|
|
4227
4316
|
shouldCloseOnBlur: true,
|
4228
4317
|
label
|
4229
4318
|
});
|
4319
|
+
useOutsideClick({
|
4320
|
+
ref: listBoxRef,
|
4321
|
+
handler: state2.close,
|
4322
|
+
enabled: true
|
4323
|
+
});
|
4230
4324
|
const {
|
4231
4325
|
inputProps: { size: size2, ...inputProps },
|
4232
4326
|
listBoxProps
|
@@ -4267,6 +4361,7 @@ function Combobox({
|
|
4267
4361
|
{
|
4268
4362
|
width: "1.5rem",
|
4269
4363
|
alignSelf: "center",
|
4364
|
+
paddingRight,
|
4270
4365
|
css: {
|
4271
4366
|
div: {
|
4272
4367
|
display: "flex",
|
@@ -4282,7 +4377,9 @@ function Combobox({
|
|
4282
4377
|
state: state2,
|
4283
4378
|
triggerRef: inputRef,
|
4284
4379
|
ref: popoverRef,
|
4285
|
-
placement: "bottom start"
|
4380
|
+
placement: "bottom start",
|
4381
|
+
shouldFlip: false,
|
4382
|
+
hasBackdrop: false
|
4286
4383
|
},
|
4287
4384
|
/* @__PURE__ */ React49__default.createElement(
|
4288
4385
|
ListBox,
|
@@ -4928,7 +5025,7 @@ var texts13 = createTexts({
|
|
4928
5025
|
sv: "Telefonnummer"
|
4929
5026
|
}
|
4930
5027
|
});
|
4931
|
-
var LazyCountryCodeSelect = React49__default.lazy(() => import('./CountryCodeSelect-
|
5028
|
+
var LazyCountryCodeSelect = React49__default.lazy(() => import('./CountryCodeSelect-PXKYFQHM.mjs'));
|
4932
5029
|
var Radio = forwardRef((props, ref) => {
|
4933
5030
|
return /* @__PURE__ */ React49__default.createElement(Radio$1, { ...props, ref });
|
4934
5031
|
});
|
@@ -11907,7 +12004,8 @@ var config13 = helpers6.defineMultiStyleConfig({
|
|
11907
12004
|
inputLabel: {
|
11908
12005
|
fontSize: "mobile.xs",
|
11909
12006
|
color: mode("darkGrey", "white")(props),
|
11910
|
-
margin: 0
|
12007
|
+
margin: 0,
|
12008
|
+
cursor: "text"
|
11911
12009
|
},
|
11912
12010
|
dateTimeSegment: {
|
11913
12011
|
color: mode(
|