@vygruppen/spor-react 3.0.3 → 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.
@@ -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, useMultiStyleConfig, chakra, Flex, Checkbox as Checkbox$1, useCheckbox, FormControl as FormControl$1, FormLabel, InputGroup, 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, useBreakpointValue, Popover, PopoverAnchor, Portal, PopoverContent, PopoverArrow, PopoverBody, 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';
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, useMemo } from 'react';
8
- import { CloseFill30Icon, CloseFill24Icon, CloseFill18Icon, CloseOutline24Icon, SearchOutline24Icon, InformationFill24Icon, InformationFill18Icon, WarningFill24Icon, WarningFill18Icon, ErrorFill24Icon, ErrorFill18Icon, LinkOutOutline24Icon, CalendarOutline24Icon, DropdownLeftFill24Icon, DropdownRightFill24Icon, DropdownDownFill18Icon, DropdownDownFill24Icon, DropdownUpFill24Icon, ArrowRightFill18Icon, DropdownRightFill18Icon, ErrorOutline24Icon, AltTransportOutline24Icon, WarningOutline24Icon, SuccessOutline24Icon, InformationOutline24Icon, ArrowLeftOutline24Icon, ArrowRightOutline24Icon, 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';
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, useDatePicker, I18nProvider, useDateRangePicker, useDialog, useFilter, useComboBox, useListBox, useOption, useListBoxSection, useSelect, HiddenSelect, useCalendar, useDateField, useRangeCalendar, useTimeField, useCalendarGrid, useDateSegment, useCalendarCell } from 'react-aria';
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, parseTime, createCalendar, Time, toCalendarDate, toCalendarDateTime, toCalendar, getMinimumDayInMonth, getMinimumMonthInYear, today, startOfWeek, startOfMonth, endOfWeek, endOfMonth, isSameDay, getDayOfWeek, maxDate, minDate, isEqualDay, getWeeksInMonth, getLocalTimeZone, GregorianCalendar, now, startOfYear, isSameMonth, isToday } from '@internationalized/date';
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 ref = (useRef)(value !== void 0);
1537
- let wasControlled = ref.current;
1536
+ let isControlledRef = (useRef)(value !== void 0);
1538
1537
  let isControlled = value !== void 0;
1539
- let stateRef = (useRef)(stateValue);
1540
- if (wasControlled !== isControlled)
1541
- console.warn(`WARN: A component changed from ${wasControlled ? "controlled" : "uncontrolled"} to ${isControlled ? "controlled" : "uncontrolled"}.`);
1542
- ref.current = isControlled;
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(stateRef.current, value3))
1550
+ if (!Object.is(currentValue, value3))
1547
1551
  onChange(value3, ...onChangeArgs);
1548
1552
  }
1549
1553
  if (!isControlled)
1550
- stateRef.current = value3;
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 ? stateRef.current : oldValue, ...functionArgs);
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
- value,
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
- setOpen(true);
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
- ...$35a22f14a1f04b11$var$DEFAULT_FIELD_OPTIONS,
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
- granularity = granularity || (v && "minute" in v ? "minute" : "day");
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
- defaultTimeZone
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 hours1 = value.hour;
2539
- let wasPM1 = hours1 >= 12;
2540
- if (!wasPM1 && segmentValue === 12)
2568
+ let hours = value.hour;
2569
+ let wasPM = hours >= 12;
2570
+ if (!wasPM && segmentValue === 12)
2541
2571
  segmentValue = 0;
2542
- if (wasPM1 && segmentValue < 12)
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 i1 = 0; i1 < parts14.length; i1++) {
2688
- if (i1 < separatorIndex)
2689
- start += parts14[i1].value;
2690
- else if (i1 > separatorIndex)
2691
- end += parts14[i1].value;
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 = (useRef)(calendar.identifier);
2842
- if (calendar.identifier !== lastCalendarIdentifier.current) {
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
- lastCalendarIdentifier.current = calendar.identifier;
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(visibleDuration);
2930
- setFocusedDate(($f62d864046160412$export$4f5203c0d889109e)(focusedDate.add(visibleDuration), minValue, maxValue));
2931
- setStartDate(($f62d864046160412$export$144a00ba6044eb9)(($f62d864046160412$export$5bb865b12696a77d)(focusedDate, start, visibleDuration, locale, minValue, maxValue), visibleDuration, locale));
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(visibleDuration);
2935
- setFocusedDate(($f62d864046160412$export$4f5203c0d889109e)(focusedDate.subtract(visibleDuration), minValue, maxValue));
2936
- setStartDate(($f62d864046160412$export$144a00ba6044eb9)(($f62d864046160412$export$5bb865b12696a77d)(focusedDate, start, visibleDuration, locale, minValue, maxValue), visibleDuration, locale));
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 = (useRef)(calendar.visibleRange);
3105
- if (!(isEqualDay)(calendar.visibleRange.start, lastVisibleRange.current.start) || !(isEqualDay)(calendar.visibleRange.end, lastVisibleRange.current.end)) {
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
- lastVisibleRange.current = calendar.visibleRange;
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 = ({ segment, state: state2 }) => {
3530
- const ref = useRef(null);
3531
- const { segmentProps } = useDateSegment(segment, state2, ref);
3532
- const styles2 = useMultiStyleConfig("Datepicker", {
3533
- isPlaceholder: segment.isPlaceholder,
3534
- isEditable: segment.isEditable
3535
- });
3536
- return /* @__PURE__ */ React49__default.createElement(
3537
- Box,
3538
- {
3539
- ...segmentProps,
3540
- ref,
3541
- style: {
3542
- ...segmentProps.style,
3543
- fontVariantNumeric: "tabular-nums",
3544
- boxSizing: "content-box"
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
- paddingX: "1px",
3547
- textAlign: "end",
3548
- outline: "none",
3549
- borderRadius: "xs",
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
- function DateField(props) {
3572
- var _a6;
3573
- const locale = useCurrentLocale();
3574
- const styles2 = useMultiStyleConfig("Datepicker", {});
3575
- const state2 = $3c0fc76039f1c516$export$60e84778edff6d26({
3576
- ...props,
3577
- locale,
3578
- createCalendar: createCalendar2
3579
- });
3580
- const ref = useRef(null);
3581
- const { fieldProps, labelProps } = useDateField(props, state2, ref);
3582
- return /* @__PURE__ */ React49__default.createElement(Box, { minWidth: "6rem", width: "100%" }, props.label && /* @__PURE__ */ React49__default.createElement(FormLabel, { ...props.labelProps, ...labelProps, sx: styles2.inputLabel }, props.label), /* @__PURE__ */ React49__default.createElement(Flex, { ...fieldProps, ref }, state2.segments.map((segment, i) => /* @__PURE__ */ React49__default.createElement(DateTimeSegment, { key: i, segment, state: state2 }))), /* @__PURE__ */ React49__default.createElement("input", { type: "hidden", value: (_a6 = state2.value) == null ? void 0 : _a6.toString(), name: props.name }));
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
- function DatePicker({
3605
- variant,
3606
- errorMessage,
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
- isRequired: props.isRequired ?? (formControlProps == null ? void 0 : formControlProps.isRequired),
3618
- validationState: (formControlProps == null ? void 0 : formControlProps.isInvalid) ? "invalid" : "valid"
3619
- });
3620
- const ref = useRef(null);
3621
- const {
3622
- groupProps,
3623
- labelProps,
3624
- fieldProps,
3625
- buttonProps,
3626
- dialogProps,
3627
- calendarProps,
3628
- errorMessageProps
3629
- } = useDatePicker(props, state2, ref);
3630
- const responsiveVariant = useBreakpointValue(typeof variant === "string" ? [variant] : variant) ?? "simple";
3631
- const locale = useCurrentLocale();
3632
- const handleEnterClick = (e) => {
3633
- if (responsiveVariant === "simple" && e.key === "Enter" && !state2.isOpen) {
3634
- e.stopPropagation();
3635
- state2.setOpen(true);
3636
- }
3637
- };
3638
- const onFieldClick = () => {
3639
- if (!hasTrigger) {
3640
- state2.setOpen(true);
3641
- }
3642
- };
3643
- const hasTrigger = responsiveVariant === "with-trigger";
3644
- const styles2 = useMultiStyleConfig("Datepicker", {});
3645
- return /* @__PURE__ */ React49__default.createElement(I18nProvider, { locale }, /* @__PURE__ */ React49__default.createElement(
3646
- Box,
3647
- {
3648
- position: "relative",
3649
- display: "inline-flex",
3650
- flexDirection: "column",
3651
- width
3652
- },
3653
- /* @__PURE__ */ React49__default.createElement(
3654
- Popover,
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
- ...dialogProps,
3657
- isOpen: state2.isOpen,
3658
- onClose: () => state2.setOpen(false),
3659
- onOpen: () => state2.setOpen(true),
3660
- closeOnBlur: true,
3661
- closeOnEsc: true,
3662
- returnFocusOnClose: true
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
- variant: responsiveVariant,
3668
- onClick: onFieldClick,
3669
- onKeyPress: handleEnterClick,
3670
- paddingX: 3,
3671
- minHeight
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
- !hasTrigger && /* @__PURE__ */ React49__default.createElement(CalendarOutline24Icon, { marginRight: 2, alignSelf: "center" }),
3674
- /* @__PURE__ */ React49__default.createElement(
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
- label: props.label,
3678
- labelProps,
3679
- name: props.name,
3680
- ...fieldProps
3681
- }
3682
- )
3683
- )), hasTrigger && /* @__PURE__ */ React49__default.createElement(CalendarTriggerButton, { ...buttonProps })),
3684
- /* @__PURE__ */ React49__default.createElement(FormErrorMessage, { ...errorMessageProps }, errorMessage),
3685
- state2.isOpen && !props.isDisabled && /* @__PURE__ */ React49__default.createElement(Portal, null, /* @__PURE__ */ React49__default.createElement(
3686
- PopoverContent,
3687
- {
3688
- color: "darkGrey",
3689
- boxShadow: "md",
3690
- sx: styles2.calendar
3691
- },
3692
- /* @__PURE__ */ React49__default.createElement(PopoverArrow, { sx: styles2.arrow }),
3693
- /* @__PURE__ */ React49__default.createElement(PopoverBody, null, /* @__PURE__ */ React49__default.createElement(
3694
- Calendar,
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
- ...calendarProps,
3697
- showYearNavigation
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({
@@ -4034,7 +4117,8 @@ var Popover3 = forwardRef$1(
4034
4117
  crossOffset = 0,
4035
4118
  placement = "bottom",
4036
4119
  shouldFlip = false,
4037
- isNonModal = false
4120
+ isNonModal = false,
4121
+ hasBackdrop = true
4038
4122
  }, ref) => {
4039
4123
  var _a6;
4040
4124
  const internalRef = useRef(null);
@@ -4051,7 +4135,7 @@ var Popover3 = forwardRef$1(
4051
4135
  },
4052
4136
  state2
4053
4137
  );
4054
- 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(
4055
4139
  Box,
4056
4140
  {
4057
4141
  ...popoverProps,
@@ -4294,7 +4378,8 @@ function Combobox({
4294
4378
  triggerRef: inputRef,
4295
4379
  ref: popoverRef,
4296
4380
  placement: "bottom start",
4297
- shouldFlip: false
4381
+ shouldFlip: false,
4382
+ hasBackdrop: false
4298
4383
  },
4299
4384
  /* @__PURE__ */ React49__default.createElement(
4300
4385
  ListBox,
@@ -4940,7 +5025,7 @@ var texts13 = createTexts({
4940
5025
  sv: "Telefonnummer"
4941
5026
  }
4942
5027
  });
4943
- var LazyCountryCodeSelect = React49__default.lazy(() => import('./CountryCodeSelect-7ASYXAQD.mjs'));
5028
+ var LazyCountryCodeSelect = React49__default.lazy(() => import('./CountryCodeSelect-PXKYFQHM.mjs'));
4944
5029
  var Radio = forwardRef((props, ref) => {
4945
5030
  return /* @__PURE__ */ React49__default.createElement(Radio$1, { ...props, ref });
4946
5031
  });