@vygruppen/spor-react 9.11.4 → 9.13.0

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
1
  import tokens11__default from '@vygruppen/spor-design-tokens';
2
2
  import * as tokens11 from '@vygruppen/spor-design-tokens';
3
3
  export { tokens11 as tokens };
4
- import { forwardRef, Divider as Divider$1, Stack as Stack$1, useMultiStyleConfig, Box, chakra, useStyleConfig, Accordion as Accordion$1, Flex, Checkbox as Checkbox$1, useCheckbox, FormControl as FormControl$1, FormLabel as FormLabel$1, useFormControlContext, InputGroup, InputLeftElement, Input as Input$1, InputRightElement, Select, useDisclosure, Button, useControllableState, Radio as Radio$1, RadioGroup as RadioGroup$1, IconButton as IconButton$1, Switch as Switch$1, Textarea as Textarea$1, Skeleton as Skeleton$1, useButtonGroup, Center, ButtonGroup as ButtonGroup$1, Badge as Badge$1, Code as Code$1, Text, PopoverAnchor, PopoverContent, PopoverArrow, PopoverBody, FocusLock, Popover as Popover$1, PopoverTrigger, Portal, 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, useRadioGroup, AccordionItem, AccordionButton, AccordionIcon, AccordionPanel, Heading, CheckboxGroup as CheckboxGroup$1, List, ListItem, useColorModeValue, useFormControlProps, useFormControl, useColorMode, SkeletonCircle as SkeletonCircle$1, SkeletonText as SkeletonText$1, Breadcrumb as Breadcrumb$1, BreadcrumbItem as BreadcrumbItem$1, BreadcrumbLink as BreadcrumbLink$1, Drawer as Drawer$1, DrawerOverlay, DrawerBody, DrawerHeader, useMediaQuery, DrawerCloseButton, DarkMode, PopoverCloseButton, usePopoverContext, UnorderedList, ChakraProvider, useToast as useToast$1, useInterval } from '@chakra-ui/react';
4
+ import { forwardRef, Divider as Divider$1, Stack as Stack$1, Box, useMultiStyleConfig, chakra, Flex, Checkbox as Checkbox$1, useCheckbox, FormControl as FormControl$1, FormLabel as FormLabel$1, useFormControlContext, InputGroup, InputLeftElement, Input as Input$1, InputRightElement, Select, useDisclosure, Button, useControllableState, Radio as Radio$1, RadioGroup as RadioGroup$1, IconButton as IconButton$1, Switch as Switch$1, Textarea as Textarea$1, useStyleConfig, Accordion as Accordion$1, Skeleton as Skeleton$1, useButtonGroup, Center, ButtonGroup as ButtonGroup$1, Badge as Badge$1, Code as Code$1, Text, PopoverAnchor, PopoverContent, PopoverArrow, PopoverBody, FocusLock, Popover as Popover$1, PopoverTrigger, Portal, 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, Heading, CheckboxGroup as CheckboxGroup$1, List, ListItem, useColorModeValue, useFormControlProps, useFormControl, AccordionItem, AccordionButton, AccordionIcon, AccordionPanel, useColorMode, SkeletonCircle as SkeletonCircle$1, SkeletonText as SkeletonText$1, Breadcrumb as Breadcrumb$1, BreadcrumbItem as BreadcrumbItem$1, BreadcrumbLink as BreadcrumbLink$1, Drawer as Drawer$1, DrawerOverlay, DrawerBody, DrawerHeader, useMediaQuery, DrawerCloseButton, DarkMode, PopoverCloseButton, usePopoverContext, UnorderedList, ChakraProvider, useToast as useToast$1, useInterval } from '@chakra-ui/react';
5
5
  export { AccordionButton, AccordionIcon, AccordionItem, AccordionPanel, Box, Center, Collapse, Container, DarkMode, DrawerBody, DrawerCloseButton, DrawerFooter, DrawerOverlay, Fade, Flex, FormHelperText, Grid, GridItem, HStack, Image, Img, InputGroup, LightMode, ListItem, Modal, ModalBody, ModalCloseButton, ModalContent, ModalFooter, ModalOverlay, OrderedList, Portal, ScaleFade, SimpleGrid, Slide, SlideFade, Spacer, Tab, TabList, TabPanel, TabPanels, TableCaption, Tbody, Td, Tfoot, Th, Thead, Tr, UnorderedList, VStack, Wrap, WrapItem, defineStyleConfig, extendTheme, useBreakpointValue, useClipboard, useColorMode, useColorModePreference, useColorModeValue, useControllableProp, useDisclosure, useMediaQuery, useMergeRefs, useOutsideClick, usePrefersReducedMotion, useTheme, useToken } from '@chakra-ui/react';
6
6
  import * as React87 from 'react';
7
- import React87__default, { useId, createContext, forwardRef as forwardRef$1, useRef, useState, useEffect, Suspense, useContext, useCallback, useMemo, useLayoutEffect } from 'react';
7
+ import React87__default, { forwardRef as forwardRef$1, useRef, useState, useEffect, useId, Suspense, useContext, createContext, useCallback, useMemo, useLayoutEffect } from 'react';
8
8
  import { CloseOutline24Icon, SearchOutline24Icon, CloseFill30Icon, CloseFill24Icon, CloseFill18Icon, CalendarOutline24Icon, InformationFill24Icon, InformationFill18Icon, WarningFill24Icon, WarningFill18Icon, ErrorFill24Icon, ErrorFill18Icon, LinkOutOutline24Icon, DropdownDownFill18Icon, DropdownDownFill24Icon, DropdownUpFill24Icon, DropdownRightFill18Icon, DropdownLeftFill18Icon, Forward15MediaControllerFill30Icon, Backward15MediaControllerFill30Icon, PauseMediaControllerFill24Icon, PlayMediaControllerFill24Icon, NextMediaControllerFill30Icon, PreviousMediaControllerFill30Icon, ArrowRightFill18Icon, ArrowLeftFill24Icon, 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
- import { inlineLoaderColorPrideData, inlineLoaderColorData, spinnerColorPrideData, spinnerColorData, contentLoaderPrideData, contentLoaderData, fullScreenLoaderWhiteData, inlineLoaderDarkData, vyLogoPrideData, fullScreenLoaderBlackData, inlineLoaderLightData, spinnerLightData, spinnerDarkData } from '@vygruppen/spor-loader';
10
- import { useLottie } from 'lottie-react';
11
9
  import { usePopover, DismissButton, Overlay, useOverlayTrigger, useButton, useDateSegment, useDateField, useDatePicker, I18nProvider, useDialog, useFilter, useComboBox, useListBox, useOption, useListBoxSection, useSelect, HiddenSelect, useProgressBar, useCalendar, useDateRangePicker, useCalendarGrid, useRangeCalendar, useTimeField, useCalendarCell } from 'react-aria';
12
10
  import { useOverlayTriggerState, Item, useDateFieldState, useDatePickerState, useComboBoxState, useSelectState, useCalendarState, useDateRangePickerState, useTimeFieldState, useRangeCalendarState } from 'react-stately';
13
11
  export { Item, Section } from 'react-stately';
12
+ import { inlineLoaderColorPrideData, inlineLoaderColorData, spinnerColorPrideData, spinnerColorData, contentLoaderPrideData, contentLoaderData, fullScreenLoaderWhiteData, inlineLoaderDarkData, vyLogoPrideData, fullScreenLoaderBlackData, inlineLoaderLightData, spinnerLightData, spinnerDarkData } from '@vygruppen/spor-loader';
13
+ import { useLottie } from 'lottie-react';
14
14
  import { motion } from 'framer-motion';
15
15
  import { createCalendar, GregorianCalendar, parseTime, endOfMonth, getWeeksInMonth, getLocalTimeZone, isSameMonth, isToday } from '@internationalized/date';
16
16
  export { Time } from '@internationalized/date';
@@ -778,295 +778,6 @@ var Stack = forwardRef(
778
778
  return /* @__PURE__ */ React87__default.createElement(Stack$1, { ...props, direction: flexDirection, ref });
779
779
  }
780
780
  );
781
- var RadioCard = forwardRef(
782
- ({ children, variant = "base", isChecked, onChange, ...props }, ref) => {
783
- const styles3 = useMultiStyleConfig("RadioCard", { variant });
784
- const id = `radio-card-${useId()}`;
785
- const handleChange = (event) => {
786
- onChange && onChange(event);
787
- };
788
- return /* @__PURE__ */ React87__default.createElement(Box, { as: "label", htmlFor: id, "aria-label": String(children), ref }, /* @__PURE__ */ React87__default.createElement(
789
- chakra.input,
790
- {
791
- type: "radio",
792
- id,
793
- checked: isChecked,
794
- onChange: handleChange,
795
- ...props,
796
- sx: styles3.radioInput
797
- }
798
- ), /* @__PURE__ */ React87__default.createElement(
799
- Box,
800
- {
801
- ...props,
802
- __css: {
803
- ...styles3.container,
804
- ...isChecked && styles3.checked
805
- }
806
- },
807
- children
808
- ));
809
- }
810
- );
811
- var RadioCardGroup = ({
812
- children,
813
- name,
814
- direction: direction2 = "row",
815
- onChange,
816
- defaultValue,
817
- variant = "base",
818
- ...props
819
- }) => {
820
- const { getRootProps, getRadioProps } = useRadioGroup({
821
- defaultValue,
822
- name,
823
- onChange,
824
- ...props
825
- });
826
- const rootProps = getRootProps();
827
- return /* @__PURE__ */ React87__default.createElement(Stack$1, { direction: direction2, ...rootProps }, recursiveMap(children, (child) => {
828
- if (child.type === RadioCard) {
829
- const radioProps = getRadioProps({ value: child.props.value });
830
- const variantValue = variant;
831
- return React87__default.cloneElement(
832
- child,
833
- {
834
- ...radioProps,
835
- variant: variantValue,
836
- ...props
837
- }
838
- );
839
- }
840
- return child;
841
- }));
842
- };
843
- function recursiveMap(children, fn) {
844
- return React87__default.Children.map(children, (child) => {
845
- if (React87__default.isValidElement(child) && child.props.children) {
846
- child = React87__default.cloneElement(child, {
847
- children: recursiveMap(child.props.children, fn)
848
- });
849
- }
850
- if (React87__default.isValidElement(child)) {
851
- return fn(child);
852
- }
853
- return child;
854
- });
855
- }
856
- var StaticCard = forwardRef(
857
- ({ colorScheme = "white", children, ...props }, ref) => {
858
- const styles3 = useStyleConfig("StaticCard", {
859
- colorScheme
860
- });
861
- return /* @__PURE__ */ React87__default.createElement(Box, { __css: styles3, ...props, ref }, children);
862
- }
863
- );
864
- var PressableCard = forwardRef(
865
- ({ children, variant = "floating", ...props }, ref) => {
866
- const styles3 = useStyleConfig("PressableCard", {
867
- variant
868
- });
869
- return /* @__PURE__ */ React87__default.createElement(Box, { __css: styles3, ...props, ref }, children);
870
- }
871
- );
872
- var AccordionContext = React87__default.createContext(null);
873
- var AccordionProvider = ({
874
- size: size2,
875
- ...props
876
- }) => {
877
- return /* @__PURE__ */ React87__default.createElement(AccordionContext.Provider, { value: { size: size2 }, ...props });
878
- };
879
- var useAccordionContext = () => {
880
- const context = React87__default.useContext(AccordionContext);
881
- if (context === null) {
882
- throw new Error(
883
- "useAccordionContext must be used within AccordionProvider"
884
- );
885
- }
886
- return context;
887
- };
888
- var Accordion = forwardRef(
889
- ({ children, spacing: spacing3 = 2, ...props }, ref) => {
890
- const defaultIndex = typeof props.defaultIndex === "number" && props.allowMultiple ? [props.defaultIndex] : props.defaultIndex;
891
- return /* @__PURE__ */ React87__default.createElement(AccordionProvider, { size: props.size }, /* @__PURE__ */ React87__default.createElement(
892
- Accordion$1,
893
- {
894
- ...props,
895
- ref,
896
- defaultIndex
897
- },
898
- /* @__PURE__ */ React87__default.createElement(Stack, { spacing: spacing3 }, children)
899
- ));
900
- }
901
- );
902
- var Expandable = ({
903
- children,
904
- headingLevel,
905
- title,
906
- leftIcon,
907
- size: size2 = "md",
908
- defaultOpen,
909
- isOpen,
910
- onChange = () => {
911
- },
912
- ...rest
913
- }) => {
914
- return /* @__PURE__ */ React87__default.createElement(
915
- Accordion,
916
- {
917
- ...rest,
918
- index: isOpen ? 0 : void 0,
919
- defaultIndex: defaultOpen ? 0 : void 0,
920
- allowMultiple: true,
921
- size: size2,
922
- onChange: (expandedIndex) => onChange(expandedIndex === 0)
923
- },
924
- /* @__PURE__ */ React87__default.createElement(
925
- ExpandableItem,
926
- {
927
- headingLevel,
928
- title,
929
- leftIcon
930
- },
931
- children
932
- )
933
- );
934
- };
935
- var ExpandableItem = ({
936
- children,
937
- title,
938
- headingLevel = "h3",
939
- leftIcon,
940
- ...rest
941
- }) => {
942
- const { size: size2 } = useAccordionContext();
943
- warnAboutMismatchingIcon({ icon: leftIcon, size: size2 });
944
- return /* @__PURE__ */ React87__default.createElement(AccordionItem, { ...rest }, /* @__PURE__ */ React87__default.createElement(Box, { as: headingLevel }, /* @__PURE__ */ React87__default.createElement(AccordionButton, null, /* @__PURE__ */ React87__default.createElement(Flex, { alignItems: "center" }, leftIcon && /* @__PURE__ */ React87__default.createElement(Box, { marginRight: 1 }, leftIcon), title), /* @__PURE__ */ React87__default.createElement(AccordionIcon, null))), /* @__PURE__ */ React87__default.createElement(AccordionPanel, null, children));
945
- };
946
- var warnAboutMismatchingIcon = ({ icon, size: size2 }) => {
947
- var _a6, _b5;
948
- if (process.env.NODE_ENV !== "production") {
949
- const displayName = (_b5 = (_a6 = icon == null ? void 0 : icon.type) == null ? void 0 : _a6.render) == null ? void 0 : _b5.displayName;
950
- if (!displayName) {
951
- return;
952
- }
953
- if (displayName.includes("Fill")) {
954
- console.warn(
955
- `You passed a filled icon. This component requires outlined icons. You passed ${displayName}, replace it with ${displayName.replace(
956
- "Fill",
957
- "Outline"
958
- )}.`
959
- );
960
- return;
961
- }
962
- if (size2 === "lg" && !displayName.includes("30Icon")) {
963
- console.warn(
964
- `The icon you passed was of the wrong size for the lg size. You passed ${displayName}, replace it with ${displayName.replace(
965
- /(\d{2})Icon/,
966
- "30Icon"
967
- )}.`
968
- );
969
- return;
970
- }
971
- if (["md"].includes(size2) && !displayName.includes("24Icon")) {
972
- console.warn(
973
- `The icon you passed was of the wrong size for the ${size2} size. You passed ${displayName}, replace it with ${displayName.replace(
974
- /(\d{2})Icon/,
975
- "24Icon"
976
- )}.`
977
- );
978
- }
979
- }
980
- };
981
- var Language = /* @__PURE__ */ ((Language3) => {
982
- Language3["NorwegianBokmal"] = "nb";
983
- Language3["NorwegianNynorsk"] = "nn";
984
- Language3["Swedish"] = "sv";
985
- Language3["English"] = "en";
986
- return Language3;
987
- })(Language || {});
988
- var LanguageContext = createContext(void 0);
989
- function LanguageProvider({
990
- language,
991
- children
992
- }) {
993
- return /* @__PURE__ */ React87__default.createElement(LanguageContext.Provider, { value: language }, children);
994
- }
995
- function useLanguage() {
996
- const language = useContext(LanguageContext);
997
- if (!language) {
998
- throw new Error("Please wrap your application in a LanguageProvider");
999
- }
1000
- return language;
1001
- }
1002
- function useTranslation() {
1003
- const language = useLanguage();
1004
- const t2 = (text) => {
1005
- return text[language];
1006
- };
1007
- return { t: t2, language };
1008
- }
1009
- function createTexts(texts28) {
1010
- return texts28;
1011
- }
1012
- var hydrating = true;
1013
- function useHydrated() {
1014
- let [hydrated, setHydrated] = useState(() => !hydrating);
1015
- useEffect(function hydrate() {
1016
- hydrating = false;
1017
- setHydrated(true);
1018
- }, []);
1019
- return hydrated;
1020
- }
1021
-
1022
- // src/loader/ClientOnly.tsx
1023
- var ClientOnly = ({ children, fallback = null }) => {
1024
- const isHydrated = useHydrated();
1025
- return /* @__PURE__ */ React87__default.createElement(React87__default.Fragment, null, isHydrated ? children() : fallback);
1026
- };
1027
- function Lottie({ animationData }) {
1028
- const { View } = useLottie({ animationData, loop: true });
1029
- return /* @__PURE__ */ React87__default.createElement(React87__default.Fragment, null, View);
1030
- }
1031
- var PrideContext = createContext(void 0);
1032
- var PrideProvider = ({
1033
- children
1034
- }) => {
1035
- const isBrowser2 = typeof window !== "undefined";
1036
- const key = "spor__isPride";
1037
- const [isPride, setIsPride] = useState(() => {
1038
- if (isBrowser2) {
1039
- const savedState = localStorage.getItem(key);
1040
- return savedState ? JSON.parse(savedState) : true;
1041
- }
1042
- return true;
1043
- });
1044
- const togglePride = () => {
1045
- setIsPride((prev) => {
1046
- const newState = !prev;
1047
- if (isBrowser2) {
1048
- localStorage.setItem(key, JSON.stringify(newState));
1049
- }
1050
- return newState;
1051
- });
1052
- };
1053
- useEffect(() => {
1054
- if (isBrowser2) {
1055
- const savedState = localStorage.getItem(key);
1056
- if (savedState) {
1057
- setIsPride(JSON.parse(savedState));
1058
- }
1059
- }
1060
- }, [isBrowser2]);
1061
- return /* @__PURE__ */ React87__default.createElement(PrideContext.Provider, { value: { isPride, togglePride } }, children);
1062
- };
1063
- var usePride = () => {
1064
- const context = useContext(PrideContext);
1065
- if (context === void 0) {
1066
- throw new Error("usePride must be used within a PrideProvider");
1067
- }
1068
- return context;
1069
- };
1070
781
  var AttachedInputs = ({
1071
782
  flexDirection = "row",
1072
783
  ...rest
@@ -1991,7 +1702,7 @@ var PhoneNumberInput = forwardRef(
1991
1702
  InfoSelect,
1992
1703
  {
1993
1704
  isLabelSrOnly: true,
1994
- label: "",
1705
+ label: t2(texts4.countryCodeLabel),
1995
1706
  width: "6.25rem",
1996
1707
  height: "100%",
1997
1708
  value: "+47"
@@ -2039,9 +1750,15 @@ var texts4 = createTexts({
2039
1750
  nn: "Telefonnummer",
2040
1751
  en: "Phone number",
2041
1752
  sv: "Telefonnummer"
1753
+ },
1754
+ countryCodeLabel: {
1755
+ nb: "Landskode",
1756
+ nn: "Landskode",
1757
+ en: "Country code",
1758
+ sv: "Landskod"
2042
1759
  }
2043
1760
  });
2044
- var LazyCountryCodeSelect = React87__default.lazy(() => import('./CountryCodeSelect-5Z5ATLWK.mjs'));
1761
+ var LazyCountryCodeSelect = React87__default.lazy(() => import('./CountryCodeSelect-MMRSNFMQ.mjs'));
2045
1762
  var Radio = forwardRef((props, ref) => {
2046
1763
  return /* @__PURE__ */ React87__default.createElement(Radio$1, { ...props, ref });
2047
1764
  });
@@ -2088,95 +1805,409 @@ var SearchInput = forwardRef(
2088
1805
  )));
2089
1806
  }
2090
1807
  );
2091
- var texts5 = createTexts({
2092
- label: {
2093
- nb: "S\xF8k",
2094
- nn: "S\xF8k",
2095
- sv: "S\xF6k",
2096
- en: "Search"
1808
+ var texts5 = createTexts({
1809
+ label: {
1810
+ nb: "S\xF8k",
1811
+ nn: "S\xF8k",
1812
+ sv: "S\xF6k",
1813
+ en: "Search"
1814
+ },
1815
+ reset: {
1816
+ nb: "T\xF8m s\xF8kefeltet",
1817
+ nn: "T\xF8m s\xF8kefelt",
1818
+ sv: "Rensa s\xF6krutan",
1819
+ en: "Reset search field"
1820
+ }
1821
+ });
1822
+ var Switch = forwardRef(
1823
+ ({ size: size2 = "md", ...props }, ref) => {
1824
+ return /* @__PURE__ */ React87__default.createElement(Switch$1, { size: size2, ...props, ref });
1825
+ }
1826
+ );
1827
+ var Textarea = forwardRef((props, ref) => {
1828
+ const {
1829
+ spacingProps,
1830
+ remainingProps: { label, ...rest }
1831
+ } = getSpacingProps(props);
1832
+ const formControlProps = useFormControlContext();
1833
+ const fallbackId = `textarea-${useId()}`;
1834
+ const inputId = props.id ?? (formControlProps == null ? void 0 : formControlProps.id) ?? fallbackId;
1835
+ return /* @__PURE__ */ React87__default.createElement(InputGroup, { position: "relative", ...spacingProps }, /* @__PURE__ */ React87__default.createElement(Textarea$1, { ...rest, id: inputId, ref, placeholder: " " }), label && /* @__PURE__ */ React87__default.createElement(FormLabel$1, { htmlFor: inputId, id: `${inputId}-label` }, label));
1836
+ });
1837
+ function getSpacingProps(props) {
1838
+ const {
1839
+ mt,
1840
+ mr,
1841
+ mb,
1842
+ ml,
1843
+ mx,
1844
+ my,
1845
+ marginTop,
1846
+ marginRight,
1847
+ marginBottom,
1848
+ marginLeft,
1849
+ marginX,
1850
+ marginY,
1851
+ pt,
1852
+ pr,
1853
+ pb,
1854
+ pl,
1855
+ px,
1856
+ py,
1857
+ paddingTop,
1858
+ paddingRight,
1859
+ paddingBottom,
1860
+ paddingLeft,
1861
+ paddingX,
1862
+ paddingY,
1863
+ ...remainingProps
1864
+ } = props;
1865
+ return {
1866
+ spacingProps: {
1867
+ mt,
1868
+ mr,
1869
+ mb,
1870
+ ml,
1871
+ mx,
1872
+ my,
1873
+ marginTop,
1874
+ marginRight,
1875
+ marginBottom,
1876
+ marginLeft,
1877
+ marginX,
1878
+ marginY,
1879
+ pt,
1880
+ pr,
1881
+ pb,
1882
+ pl,
1883
+ px,
1884
+ py,
1885
+ paddingTop,
1886
+ paddingRight,
1887
+ paddingBottom,
1888
+ paddingLeft,
1889
+ paddingX,
1890
+ paddingY
1891
+ },
1892
+ remainingProps
1893
+ };
1894
+ }
1895
+
1896
+ // src/layout/RadioCardGroup.tsx
1897
+ var RadioCardGroupContext = React87__default.createContext(null);
1898
+ var RadioCardGroup = ({
1899
+ children,
1900
+ name,
1901
+ variant = "base",
1902
+ direction: direction2 = "row",
1903
+ groupLabel,
1904
+ defaultValue,
1905
+ ...props
1906
+ }) => {
1907
+ const [selectedValue, setSelectedValue] = useState(
1908
+ defaultValue || ""
1909
+ );
1910
+ const handleChange = (value) => {
1911
+ setSelectedValue(value);
1912
+ };
1913
+ return /* @__PURE__ */ React87__default.createElement(
1914
+ RadioCardGroupContext.Provider,
1915
+ {
1916
+ value: {
1917
+ name,
1918
+ selectedValue,
1919
+ onChange: handleChange,
1920
+ variant,
1921
+ defaultValue: defaultValue || ""
1922
+ }
1923
+ },
1924
+ /* @__PURE__ */ React87__default.createElement(
1925
+ Stack$1,
1926
+ {
1927
+ as: "fieldset",
1928
+ direction: direction2,
1929
+ "aria-labelledby": groupLabel || name,
1930
+ role: "radiogroup",
1931
+ tabIndex: 0,
1932
+ ...props
1933
+ },
1934
+ groupLabel && /* @__PURE__ */ React87__default.createElement(FormLabel, { as: "legend", id: groupLabel }, groupLabel),
1935
+ children
1936
+ )
1937
+ );
1938
+ };
1939
+
1940
+ // src/layout/RadioCard.tsx
1941
+ var RadioCard = forwardRef(
1942
+ ({ children, value = "base", isDisabled, ...props }, ref) => {
1943
+ const context = useContext(RadioCardGroupContext);
1944
+ if (!context) {
1945
+ throw new Error(
1946
+ "RadioCard components must be wrapped in a RadioCardGroup component"
1947
+ );
1948
+ }
1949
+ const { name, selectedValue, onChange, variant } = context;
1950
+ const styles3 = useMultiStyleConfig("RadioCard", { variant });
1951
+ const isChecked = selectedValue === value;
1952
+ const radioCardId = `radio-card-${useId()}`;
1953
+ useEffect(() => {
1954
+ if (isChecked && typeof ref !== "function" && (ref == null ? void 0 : ref.current)) {
1955
+ ref.current.focus();
1956
+ }
1957
+ }, [isChecked]);
1958
+ const handleKeyDown = (event) => {
1959
+ if (event.key === "Enter" || event.key === " ") {
1960
+ onChange(value);
1961
+ }
1962
+ if (event.key === "ArrowRight" || event.key === "ArrowDown" || event.key === "ArrowLeft" || event.key === "ArrowUp") {
1963
+ const nextRadioCard = event.currentTarget.nextElementSibling;
1964
+ nextRadioCard.focus();
1965
+ }
1966
+ };
1967
+ return /* @__PURE__ */ React87__default.createElement(Box, { as: "label", "aria-label": String(children), onKeyDown: handleKeyDown }, /* @__PURE__ */ React87__default.createElement(
1968
+ chakra.input,
1969
+ {
1970
+ type: "radio",
1971
+ id: radioCardId,
1972
+ ref,
1973
+ value,
1974
+ name,
1975
+ checked: isChecked,
1976
+ onChange: () => onChange(value),
1977
+ disabled: isDisabled,
1978
+ __css: styles3.radioInput
1979
+ }
1980
+ ), /* @__PURE__ */ React87__default.createElement(
1981
+ Box,
1982
+ {
1983
+ ...props,
1984
+ tabIndex: 0,
1985
+ ref,
1986
+ role: "radio",
1987
+ "aria-checked": isChecked,
1988
+ "aria-labelledby": radioCardId,
1989
+ __css: { ...styles3.container, ...isChecked && styles3.checked },
1990
+ "data-checked": isChecked,
1991
+ "data-disabled": isDisabled
1992
+ },
1993
+ children
1994
+ ));
1995
+ }
1996
+ );
1997
+ var StaticCard = forwardRef(
1998
+ ({ colorScheme = "white", children, ...props }, ref) => {
1999
+ const styles3 = useStyleConfig("StaticCard", {
2000
+ colorScheme
2001
+ });
2002
+ return /* @__PURE__ */ React87__default.createElement(Box, { __css: styles3, ...props, ref }, children);
2003
+ }
2004
+ );
2005
+ var PressableCard = forwardRef(
2006
+ ({ children, variant = "floating", ...props }, ref) => {
2007
+ const styles3 = useStyleConfig("PressableCard", {
2008
+ variant
2009
+ });
2010
+ return /* @__PURE__ */ React87__default.createElement(Box, { __css: styles3, ...props, ref }, children);
2011
+ }
2012
+ );
2013
+ var AccordionContext = React87__default.createContext(null);
2014
+ var AccordionProvider = ({
2015
+ size: size2,
2016
+ ...props
2017
+ }) => {
2018
+ return /* @__PURE__ */ React87__default.createElement(AccordionContext.Provider, { value: { size: size2 }, ...props });
2019
+ };
2020
+ var useAccordionContext = () => {
2021
+ const context = React87__default.useContext(AccordionContext);
2022
+ if (context === null) {
2023
+ throw new Error(
2024
+ "useAccordionContext must be used within AccordionProvider"
2025
+ );
2026
+ }
2027
+ return context;
2028
+ };
2029
+ var Accordion = forwardRef(
2030
+ ({ children, spacing: spacing3 = 2, ...props }, ref) => {
2031
+ const defaultIndex = typeof props.defaultIndex === "number" && props.allowMultiple ? [props.defaultIndex] : props.defaultIndex;
2032
+ return /* @__PURE__ */ React87__default.createElement(AccordionProvider, { size: props.size }, /* @__PURE__ */ React87__default.createElement(
2033
+ Accordion$1,
2034
+ {
2035
+ ...props,
2036
+ ref,
2037
+ defaultIndex
2038
+ },
2039
+ /* @__PURE__ */ React87__default.createElement(Stack, { spacing: spacing3 }, children)
2040
+ ));
2041
+ }
2042
+ );
2043
+ var Expandable = ({
2044
+ children,
2045
+ headingLevel,
2046
+ title,
2047
+ leftIcon,
2048
+ size: size2 = "md",
2049
+ defaultOpen,
2050
+ isOpen,
2051
+ onChange = () => {
2097
2052
  },
2098
- reset: {
2099
- nb: "T\xF8m s\xF8kefeltet",
2100
- nn: "T\xF8m s\xF8kefelt",
2101
- sv: "Rensa s\xF6krutan",
2102
- en: "Reset search field"
2053
+ ...rest
2054
+ }) => {
2055
+ return /* @__PURE__ */ React87__default.createElement(
2056
+ Accordion,
2057
+ {
2058
+ ...rest,
2059
+ index: isOpen ? 0 : void 0,
2060
+ defaultIndex: defaultOpen ? 0 : void 0,
2061
+ allowMultiple: true,
2062
+ size: size2,
2063
+ onChange: (expandedIndex) => onChange(expandedIndex === 0)
2064
+ },
2065
+ /* @__PURE__ */ React87__default.createElement(
2066
+ ExpandableItem,
2067
+ {
2068
+ headingLevel,
2069
+ title,
2070
+ leftIcon
2071
+ },
2072
+ children
2073
+ )
2074
+ );
2075
+ };
2076
+ var ExpandableItem = ({
2077
+ children,
2078
+ title,
2079
+ headingLevel = "h3",
2080
+ leftIcon,
2081
+ ...rest
2082
+ }) => {
2083
+ const { size: size2 } = useAccordionContext();
2084
+ warnAboutMismatchingIcon({ icon: leftIcon, size: size2 });
2085
+ return /* @__PURE__ */ React87__default.createElement(AccordionItem, { ...rest }, /* @__PURE__ */ React87__default.createElement(Box, { as: headingLevel }, /* @__PURE__ */ React87__default.createElement(AccordionButton, null, /* @__PURE__ */ React87__default.createElement(Flex, { alignItems: "center" }, leftIcon && /* @__PURE__ */ React87__default.createElement(Box, { marginRight: 1 }, leftIcon), title), /* @__PURE__ */ React87__default.createElement(AccordionIcon, null))), /* @__PURE__ */ React87__default.createElement(AccordionPanel, null, children));
2086
+ };
2087
+ var warnAboutMismatchingIcon = ({ icon, size: size2 }) => {
2088
+ var _a6, _b5;
2089
+ if (process.env.NODE_ENV !== "production") {
2090
+ const displayName = (_b5 = (_a6 = icon == null ? void 0 : icon.type) == null ? void 0 : _a6.render) == null ? void 0 : _b5.displayName;
2091
+ if (!displayName) {
2092
+ return;
2093
+ }
2094
+ if (displayName.includes("Fill")) {
2095
+ console.warn(
2096
+ `You passed a filled icon. This component requires outlined icons. You passed ${displayName}, replace it with ${displayName.replace(
2097
+ "Fill",
2098
+ "Outline"
2099
+ )}.`
2100
+ );
2101
+ return;
2102
+ }
2103
+ if (size2 === "lg" && !displayName.includes("30Icon")) {
2104
+ console.warn(
2105
+ `The icon you passed was of the wrong size for the lg size. You passed ${displayName}, replace it with ${displayName.replace(
2106
+ /(\d{2})Icon/,
2107
+ "30Icon"
2108
+ )}.`
2109
+ );
2110
+ return;
2111
+ }
2112
+ if (["md"].includes(size2) && !displayName.includes("24Icon")) {
2113
+ console.warn(
2114
+ `The icon you passed was of the wrong size for the ${size2} size. You passed ${displayName}, replace it with ${displayName.replace(
2115
+ /(\d{2})Icon/,
2116
+ "24Icon"
2117
+ )}.`
2118
+ );
2119
+ }
2103
2120
  }
2104
- });
2105
- var Switch = forwardRef(
2106
- ({ size: size2 = "md", ...props }, ref) => {
2107
- return /* @__PURE__ */ React87__default.createElement(Switch$1, { size: size2, ...props, ref });
2121
+ };
2122
+ var Language = /* @__PURE__ */ ((Language3) => {
2123
+ Language3["NorwegianBokmal"] = "nb";
2124
+ Language3["NorwegianNynorsk"] = "nn";
2125
+ Language3["Swedish"] = "sv";
2126
+ Language3["English"] = "en";
2127
+ return Language3;
2128
+ })(Language || {});
2129
+ var LanguageContext = createContext(void 0);
2130
+ function LanguageProvider({
2131
+ language,
2132
+ children
2133
+ }) {
2134
+ return /* @__PURE__ */ React87__default.createElement(LanguageContext.Provider, { value: language }, children);
2135
+ }
2136
+ function useLanguage() {
2137
+ const language = useContext(LanguageContext);
2138
+ if (!language) {
2139
+ throw new Error("Please wrap your application in a LanguageProvider");
2108
2140
  }
2109
- );
2110
- var Textarea = forwardRef((props, ref) => {
2111
- const {
2112
- spacingProps,
2113
- remainingProps: { label, ...rest }
2114
- } = getSpacingProps(props);
2115
- const formControlProps = useFormControlContext();
2116
- const fallbackId = `textarea-${useId()}`;
2117
- const inputId = props.id ?? (formControlProps == null ? void 0 : formControlProps.id) ?? fallbackId;
2118
- return /* @__PURE__ */ React87__default.createElement(InputGroup, { position: "relative", ...spacingProps }, /* @__PURE__ */ React87__default.createElement(Textarea$1, { ...rest, id: inputId, ref, placeholder: " " }), label && /* @__PURE__ */ React87__default.createElement(FormLabel$1, { htmlFor: inputId, id: `${inputId}-label` }, label));
2119
- });
2120
- function getSpacingProps(props) {
2121
- const {
2122
- mt,
2123
- mr,
2124
- mb,
2125
- ml,
2126
- mx,
2127
- my,
2128
- marginTop,
2129
- marginRight,
2130
- marginBottom,
2131
- marginLeft,
2132
- marginX,
2133
- marginY,
2134
- pt,
2135
- pr,
2136
- pb,
2137
- pl,
2138
- px,
2139
- py,
2140
- paddingTop,
2141
- paddingRight,
2142
- paddingBottom,
2143
- paddingLeft,
2144
- paddingX,
2145
- paddingY,
2146
- ...remainingProps
2147
- } = props;
2148
- return {
2149
- spacingProps: {
2150
- mt,
2151
- mr,
2152
- mb,
2153
- ml,
2154
- mx,
2155
- my,
2156
- marginTop,
2157
- marginRight,
2158
- marginBottom,
2159
- marginLeft,
2160
- marginX,
2161
- marginY,
2162
- pt,
2163
- pr,
2164
- pb,
2165
- pl,
2166
- px,
2167
- py,
2168
- paddingTop,
2169
- paddingRight,
2170
- paddingBottom,
2171
- paddingLeft,
2172
- paddingX,
2173
- paddingY
2174
- },
2175
- remainingProps
2141
+ return language;
2142
+ }
2143
+ function useTranslation() {
2144
+ const language = useLanguage();
2145
+ const t2 = (text) => {
2146
+ return text[language];
2176
2147
  };
2148
+ return { t: t2, language };
2149
+ }
2150
+ function createTexts(texts28) {
2151
+ return texts28;
2152
+ }
2153
+ var hydrating = true;
2154
+ function useHydrated() {
2155
+ let [hydrated, setHydrated] = useState(() => !hydrating);
2156
+ useEffect(function hydrate() {
2157
+ hydrating = false;
2158
+ setHydrated(true);
2159
+ }, []);
2160
+ return hydrated;
2177
2161
  }
2178
2162
 
2179
- // src/pride/TogglePride.tsx
2163
+ // src/loader/ClientOnly.tsx
2164
+ var ClientOnly = ({ children, fallback = null }) => {
2165
+ const isHydrated = useHydrated();
2166
+ return /* @__PURE__ */ React87__default.createElement(React87__default.Fragment, null, isHydrated ? children() : fallback);
2167
+ };
2168
+ function Lottie({ animationData }) {
2169
+ const { View } = useLottie({ animationData, loop: true });
2170
+ return /* @__PURE__ */ React87__default.createElement(React87__default.Fragment, null, View);
2171
+ }
2172
+ var PrideContext = createContext(void 0);
2173
+ var PrideProvider = ({
2174
+ children
2175
+ }) => {
2176
+ const isBrowser2 = typeof window !== "undefined";
2177
+ const key = "spor__isPride";
2178
+ const [isPride, setIsPride] = useState(() => {
2179
+ if (isBrowser2) {
2180
+ const savedState = localStorage.getItem(key);
2181
+ return savedState ? JSON.parse(savedState) : true;
2182
+ }
2183
+ return true;
2184
+ });
2185
+ const togglePride = () => {
2186
+ setIsPride((prev) => {
2187
+ const newState = !prev;
2188
+ if (isBrowser2) {
2189
+ localStorage.setItem(key, JSON.stringify(newState));
2190
+ }
2191
+ return newState;
2192
+ });
2193
+ };
2194
+ useEffect(() => {
2195
+ if (isBrowser2) {
2196
+ const savedState = localStorage.getItem(key);
2197
+ if (savedState) {
2198
+ setIsPride(JSON.parse(savedState));
2199
+ }
2200
+ }
2201
+ }, [isBrowser2]);
2202
+ return /* @__PURE__ */ React87__default.createElement(PrideContext.Provider, { value: { isPride, togglePride } }, children);
2203
+ };
2204
+ var usePride = () => {
2205
+ const context = useContext(PrideContext);
2206
+ if (context === void 0) {
2207
+ throw new Error("usePride must be used within a PrideProvider");
2208
+ }
2209
+ return context;
2210
+ };
2180
2211
  var TogglePride = ({ label }) => {
2181
2212
  const { isPride, togglePride } = usePride();
2182
2213
  return /* @__PURE__ */ React87__default.createElement(FormControl, { display: "flex", alignItems: "center", gap: 3 }, /* @__PURE__ */ React87__default.createElement(FormLabel, { margin: "0" }, label), /* @__PURE__ */ React87__default.createElement(
@@ -13241,7 +13272,6 @@ var helpers24 = createMultiStyleConfigHelpers$1(parts17.keys);
13241
13272
  var config33 = helpers24.defineMultiStyleConfig({
13242
13273
  baseStyle: (props) => ({
13243
13274
  container: {
13244
- appearance: "none",
13245
13275
  border: "none",
13246
13276
  overflow: "hidden",
13247
13277
  fontSize: "inherit",
@@ -13283,6 +13313,9 @@ var config33 = helpers24.defineMultiStyleConfig({
13283
13313
  _active: {
13284
13314
  ...baseBackground("active", props),
13285
13315
  ...baseBorder("active", props)
13316
+ },
13317
+ _focus: {
13318
+ ...outlineBorder("focus", props)
13286
13319
  }
13287
13320
  },
13288
13321
  checked: {
@@ -13292,13 +13325,17 @@ var config33 = helpers24.defineMultiStyleConfig({
13292
13325
  _active: {
13293
13326
  ...baseBackground("active", props),
13294
13327
  ...baseBorder("active", props)
13328
+ },
13329
+ _focus: {
13330
+ outline: "4px solid",
13331
+ outlineStyle: "double",
13332
+ ...outlineBorder("focus", props),
13333
+ outlineOffset: "-1px"
13295
13334
  }
13296
13335
  }
13297
13336
  }),
13298
13337
  floating: (props) => ({
13299
13338
  container: {
13300
- ...baseText("default", props),
13301
- ...baseBackground("default", props),
13302
13339
  ...floatingBackground("default", props),
13303
13340
  ...floatingBorder("default", props),
13304
13341
  boxShadow: "sm",
@@ -13310,16 +13347,25 @@ var config33 = helpers24.defineMultiStyleConfig({
13310
13347
  _active: {
13311
13348
  ...floatingBackground("active", props),
13312
13349
  ...floatingBorder("active", props)
13350
+ },
13351
+ _focus: {
13352
+ ...outlineBorder("focus", props)
13313
13353
  }
13314
13354
  },
13315
13355
  checked: {
13316
- cursor: "normal",
13317
13356
  _hover: {
13318
- ...floatingBorder("hover", props)
13357
+ ...floatingBorder("hover", props),
13358
+ boxShadow: "md"
13319
13359
  },
13320
13360
  _active: {
13321
13361
  ...floatingBackground("active", props),
13322
13362
  ...floatingBorder("active", props)
13363
+ },
13364
+ _focus: {
13365
+ outline: "4px solid",
13366
+ outlineStyle: "double",
13367
+ ...outlineBorder("focus", props),
13368
+ outlineOffset: "-1px"
13323
13369
  }
13324
13370
  }
13325
13371
  })
@@ -14447,4 +14493,4 @@ function slugify(text, maxLength = 50) {
14447
14493
  return text.normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/[\u00C6\u00E6]/g, "ae").replace(/[\u00D8\u00F8]/g, "oe").replace(/[\u00C5\u00E5]/g, "aa").toLowerCase().replace(/\s+/g, "-").replace(/[^\w-]+/g, "").replace(/--+/g, "-").replace(/^-+/, "").replace(/-+$/, "").substring(0, maxLength);
14448
14494
  }
14449
14495
 
14450
- export { Accordion, AttachedInputs, Badge, Brand, Breadcrumb, BreadcrumbItem, BreadcrumbLink, Button2 as Button, ButtonGroup, Card2 as Card, CardSelect, Checkbox, CheckboxGroup, ChoiceChip, ClosableAlert, CloseButton, Code, ColorInlineLoader, ColorSpinner, Combobox, ContentLoader, DarkFullScreenLoader, DarkInlineLoader, DarkSpinner, DatePicker, DateRangePicker, Divider, Drawer, DrawerContent, Expandable, ExpandableAlert, ExpandableItem, FloatingActionButton, FormControl, FormErrorMessage, FormLabel, FullScreenDrawer, Heading2 as Heading, IconButton, InfoSelect, InfoTag, Input, InputLeftElement2 as InputLeftElement, InputRightElement2 as InputRightElement, ItemDescription, ItemLabel, JumpButton, Language, LanguageProvider, LightFullScreenLoader, LightInlineLoader, LightSpinner, LineIcon, ListBox, ModalHeader, NativeSelect, Nudge, NumericStepper, Pagination, PasswordInput, PhoneNumberInput, PlayPauseButton, PressableCard, PrideProvider, ProgressBar, ProgressIndicator, ProgressLoader, Radio, RadioCard, RadioCardGroup, RadioGroup, SearchInput, SimpleDrawer, Skeleton, SkeletonCircle, SkeletonText, SkipButton, SporProvider, Stack, StaticAlert, StaticCard, Stepper, StepperStep, Switch, Table, Tabs, Text4 as Text, TextLink, Textarea, TimePicker, TogglePride, Tooltip, TravelTag, VyLogo, VyLogoDefault, VyLogoPride, WizardNudge, brandTheme, createTexts, fontFaces, slugify, theme, usePride, useSize, useToast, useTranslation };
14496
+ export { Accordion, AttachedInputs, Badge, Brand, Breadcrumb, BreadcrumbItem, BreadcrumbLink, Button2 as Button, ButtonGroup, Card2 as Card, CardSelect, Checkbox, CheckboxGroup, ChoiceChip, ClosableAlert, CloseButton, Code, ColorInlineLoader, ColorSpinner, Combobox, ContentLoader, DarkFullScreenLoader, DarkInlineLoader, DarkSpinner, DatePicker, DateRangePicker, Divider, Drawer, DrawerContent, Expandable, ExpandableAlert, ExpandableItem, FloatingActionButton, FormControl, FormErrorMessage, FormLabel, FullScreenDrawer, Heading2 as Heading, IconButton, InfoSelect, InfoTag, Input, InputLeftElement2 as InputLeftElement, InputRightElement2 as InputRightElement, ItemDescription, ItemLabel, JumpButton, Language, LanguageProvider, LightFullScreenLoader, LightInlineLoader, LightSpinner, LineIcon, ListBox, ModalHeader, NativeSelect, Nudge, NumericStepper, Pagination, PasswordInput, PhoneNumberInput, PlayPauseButton, PressableCard, PrideProvider, ProgressBar, ProgressIndicator, ProgressLoader, Radio, RadioCard, RadioCardGroup, RadioCardGroupContext, RadioGroup, SearchInput, SimpleDrawer, Skeleton, SkeletonCircle, SkeletonText, SkipButton, SporProvider, Stack, StaticAlert, StaticCard, Stepper, StepperStep, Switch, Table, Tabs, Text4 as Text, TextLink, Textarea, TimePicker, TogglePride, Tooltip, TravelTag, VyLogo, VyLogoDefault, VyLogoPride, WizardNudge, brandTheme, createTexts, fontFaces, slugify, theme, usePride, useSize, useToast, useTranslation };