@vygruppen/spor-react 2.3.4 → 2.4.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,19 +1,19 @@
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, useFormControl, useColorModeValue, useFormControlProps, 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, 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, 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, useRef, useState, useEffect, useId, Suspense, useCallback, useContext, useMemo } from 'react';
7
+ import React49__default, { createContext, forwardRef as forwardRef$1, useRef, useState, useEffect, useId, Suspense, useContext, useCallback, useMemo } from 'react';
8
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';
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 { useOverlayTrigger, useButton, useListBox, useOption, useProgressBar, useDatePicker, I18nProvider, useDateRangePicker, useDialog, usePopover, Overlay, DismissButton, useSelect, HiddenSelect, useCalendar, useDateField, useRangeCalendar, useTimeField, useCalendarGrid, useDateSegment, useCalendarCell } from 'react-aria';
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';
12
12
  import { motion } from 'framer-motion';
13
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';
14
14
  export { Time } from '@internationalized/date';
15
- import { useOverlayTriggerState, Item, useTimeFieldState, useSelectState } from 'react-stately';
16
- export { Item } from 'react-stately';
15
+ import { useOverlayTriggerState, useTimeFieldState, useAsyncList, useComboBoxState, Item, useSelectState } from 'react-stately';
16
+ export { Item, Section } from 'react-stately';
17
17
  import { useSwipeable } from 'react-swipeable';
18
18
  import { Global, keyframes } from '@emotion/react';
19
19
  import { cssVar as cssVar$1, calc as calc$1, mode, getColor, anatomy as anatomy$1, orient, transparentize, generateStripe, randomColor, isDark } from '@chakra-ui/theme-tools';
@@ -950,7 +950,7 @@ var DarkSpinner = ({
950
950
  maxWidth,
951
951
  ...props
952
952
  }) => {
953
- return /* @__PURE__ */ React49__default.createElement(Center, { flexDirection: "column", ...props }, /* @__PURE__ */ React49__default.createElement(Box, { width, maxWidth }, /* @__PURE__ */ React49__default.createElement(ClientOnly, null, () => /* @__PURE__ */ React49__default.createElement(Lottie, { animationData: spinnerDarkData }))), children && /* @__PURE__ */ React49__default.createElement(Box, { mt: 3, fontWeight: "bold" }, children));
953
+ return /* @__PURE__ */ React49__default.createElement(Center, { flexDirection: "column", ...props }, /* @__PURE__ */ React49__default.createElement(Box, { width, maxWidth }, /* @__PURE__ */ React49__default.createElement(ClientOnly, null, () => /* @__PURE__ */ React49__default.createElement(Lottie, { animationData: spinnerDarkData }))), children && /* @__PURE__ */ React49__default.createElement(Box, { marginTop: 3, fontWeight: "bold" }, children));
954
954
  };
955
955
  var LightFullScreenLoader = ({
956
956
  width,
@@ -4019,43 +4019,72 @@ var AttachedInputs = ({
4019
4019
  }
4020
4020
  );
4021
4021
  };
4022
+ function Autosuggest({
4023
+ label,
4024
+ fetcher,
4025
+ children,
4026
+ onSelectionChange
4027
+ }) {
4028
+ const list2 = useAsyncList({
4029
+ async load({ filterText }) {
4030
+ return {
4031
+ items: await fetcher(filterText)
4032
+ };
4033
+ }
4034
+ });
4035
+ return /* @__PURE__ */ React49__default.createElement(
4036
+ Combobox,
4037
+ {
4038
+ label,
4039
+ items: list2.items,
4040
+ inputValue: list2.filterText,
4041
+ onInputChange: list2.setFilterText,
4042
+ isLoading: list2.isLoading,
4043
+ onSelectionChange
4044
+ },
4045
+ children
4046
+ );
4047
+ }
4022
4048
  var Dialog = ({ title, children, ...props }) => {
4023
4049
  const ref = useRef(null);
4024
4050
  const { dialogProps, titleProps } = useDialog(props, ref);
4025
4051
  return /* @__PURE__ */ React49__default.createElement(Box, { ...dialogProps, ref, outline: "none" }, title && /* @__PURE__ */ React49__default.createElement(Heading$1, { as: "h3", ...titleProps }, title), children);
4026
4052
  };
4027
- var Popover3 = ({
4028
- children,
4029
- state: state2,
4030
- triggerRef,
4031
- offset = 0,
4032
- crossOffset = 0,
4033
- placement = "bottom"
4034
- }) => {
4035
- var _a6;
4036
- const popoverRef = useRef(null);
4037
- const { popoverProps, underlayProps } = usePopover(
4038
- {
4039
- triggerRef,
4040
- popoverRef,
4041
- offset,
4042
- crossOffset,
4043
- placement
4044
- },
4045
- state2
4046
- );
4047
- return /* @__PURE__ */ React49__default.createElement(Overlay, null, /* @__PURE__ */ React49__default.createElement(Box, { ...underlayProps, position: "fixed", inset: "0" }), /* @__PURE__ */ React49__default.createElement(
4048
- Box,
4049
- {
4050
- ...popoverProps,
4051
- ref: popoverRef,
4052
- minWidth: ((_a6 = triggerRef.current) == null ? void 0 : _a6.clientWidth) ?? "auto"
4053
- },
4054
- /* @__PURE__ */ React49__default.createElement(DismissButton, { onDismiss: state2.close }),
4053
+ var Popover3 = forwardRef$1(
4054
+ ({
4055
4055
  children,
4056
- /* @__PURE__ */ React49__default.createElement(DismissButton, { onDismiss: state2.close })
4057
- ));
4058
- };
4056
+ state: state2,
4057
+ triggerRef,
4058
+ offset = 0,
4059
+ crossOffset = 0,
4060
+ placement = "bottom"
4061
+ }, ref) => {
4062
+ var _a6;
4063
+ const internalRef = useRef(null);
4064
+ const popoverRef = ref ?? internalRef;
4065
+ const { popoverProps, underlayProps } = usePopover(
4066
+ {
4067
+ triggerRef,
4068
+ popoverRef,
4069
+ offset,
4070
+ crossOffset,
4071
+ placement
4072
+ },
4073
+ state2
4074
+ );
4075
+ return /* @__PURE__ */ React49__default.createElement(Overlay, null, /* @__PURE__ */ React49__default.createElement(Box, { ...underlayProps, position: "fixed", inset: "0" }), /* @__PURE__ */ React49__default.createElement(
4076
+ Box,
4077
+ {
4078
+ ...popoverProps,
4079
+ ref: popoverRef,
4080
+ minWidth: ((_a6 = triggerRef.current) == null ? void 0 : _a6.clientWidth) ?? "auto"
4081
+ },
4082
+ /* @__PURE__ */ React49__default.createElement(DismissButton, { onDismiss: state2.close }),
4083
+ children,
4084
+ /* @__PURE__ */ React49__default.createElement(DismissButton, { onDismiss: state2.close })
4085
+ ));
4086
+ }
4087
+ );
4059
4088
 
4060
4089
  // src/input/CardSelect.tsx
4061
4090
  var CardSelect = forwardRef(
@@ -4188,6 +4217,336 @@ var ChoiceChip = forwardRef((props, ref) => {
4188
4217
  )
4189
4218
  );
4190
4219
  });
4220
+ function Combobox({
4221
+ label,
4222
+ isLoading,
4223
+ ...rest
4224
+ }) {
4225
+ const { contains: contains2 } = useFilter({ sensitivity: "base" });
4226
+ const state2 = useComboBoxState({
4227
+ ...rest,
4228
+ defaultFilter: contains2
4229
+ });
4230
+ const inputRef = useRef(null);
4231
+ const listBoxRef = useRef(null);
4232
+ const popoverRef = useRef(null);
4233
+ const {
4234
+ inputProps: { size: size2, ...inputProps },
4235
+ listBoxProps
4236
+ } = useComboBox(
4237
+ {
4238
+ ...rest,
4239
+ inputRef,
4240
+ listBoxRef,
4241
+ popoverRef
4242
+ },
4243
+ state2
4244
+ );
4245
+ return /* @__PURE__ */ React49__default.createElement(FormControl, null, /* @__PURE__ */ React49__default.createElement(
4246
+ Input,
4247
+ {
4248
+ ...inputProps,
4249
+ ref: inputRef,
4250
+ label,
4251
+ borderBottomRadius: state2.isOpen ? 0 : "sm",
4252
+ rightIcon: isLoading ? /* @__PURE__ */ React49__default.createElement(
4253
+ ColorSpinner,
4254
+ {
4255
+ width: "1.5rem",
4256
+ alignSelf: "center",
4257
+ css: {
4258
+ div: {
4259
+ display: "flex",
4260
+ alignItems: "center"
4261
+ }
4262
+ }
4263
+ }
4264
+ ) : void 0
4265
+ }
4266
+ ), state2.isOpen && /* @__PURE__ */ React49__default.createElement(
4267
+ Popover3,
4268
+ {
4269
+ state: state2,
4270
+ triggerRef: inputRef,
4271
+ ref: popoverRef,
4272
+ placement: "bottom start"
4273
+ },
4274
+ /* @__PURE__ */ React49__default.createElement(
4275
+ ListBox,
4276
+ {
4277
+ ...listBoxProps,
4278
+ state: state2,
4279
+ listBoxRef,
4280
+ borderBottomRadius: "sm"
4281
+ },
4282
+ rest.children
4283
+ )
4284
+ ));
4285
+ }
4286
+ var FormControl = forwardRef((props, ref) => {
4287
+ return /* @__PURE__ */ React49__default.createElement(FormControl$1, { ...props, ref });
4288
+ });
4289
+ var FormErrorMessage = ({
4290
+ children,
4291
+ ...boxProps
4292
+ }) => {
4293
+ const formControlContext = useFormControlContext();
4294
+ if (!formControlContext) {
4295
+ throw new Error(
4296
+ "FormErrorMessage must be used within a FormControl component"
4297
+ );
4298
+ }
4299
+ if (!formControlContext.isInvalid) {
4300
+ return null;
4301
+ }
4302
+ const { ref, ...errorMessageProps } = formControlContext.getErrorMessageProps();
4303
+ return /* @__PURE__ */ React49__default.createElement(Box, { position: "relative", ref }, /* @__PURE__ */ React49__default.createElement(
4304
+ Box,
4305
+ {
4306
+ borderRadius: "xs",
4307
+ backgroundColor: "lightRed",
4308
+ color: "darkGrey",
4309
+ paddingX: 1.5,
4310
+ paddingY: 1,
4311
+ textStyle: "xs",
4312
+ width: "fit-content",
4313
+ position: "absolute",
4314
+ top: -0.5,
4315
+ left: 3,
4316
+ zIndex: "popover",
4317
+ maxWidth: "50ch",
4318
+ ...errorMessageProps,
4319
+ ...boxProps
4320
+ },
4321
+ /* @__PURE__ */ React49__default.createElement(Arrow, { position: "absolute", top: "-0.25em", left: "1em" }),
4322
+ children
4323
+ ));
4324
+ };
4325
+ var Arrow = (props) => {
4326
+ return /* @__PURE__ */ React49__default.createElement(
4327
+ Box,
4328
+ {
4329
+ ...props,
4330
+ as: "svg",
4331
+ width: "16",
4332
+ height: "16",
4333
+ viewBox: "0 0 16 16",
4334
+ fill: "none",
4335
+ transform: "rotate(45deg)"
4336
+ },
4337
+ /* @__PURE__ */ React49__default.createElement(
4338
+ Box,
4339
+ {
4340
+ as: "path",
4341
+ fill: "lightRed",
4342
+ d: "M 0\n 0 Q 2.4 6 0 12 Q 6 9.6 12 12 Q 9.6 6 12 0 Q 6 2.4 0 0 z"
4343
+ }
4344
+ )
4345
+ );
4346
+ };
4347
+ var FormLabel3 = forwardRef((props, ref) => {
4348
+ return /* @__PURE__ */ React49__default.createElement(FormLabel, { ...props, ref });
4349
+ });
4350
+ var SelectItem = Item;
4351
+ function ListBox({
4352
+ isLoading,
4353
+ listBoxRef,
4354
+ state: state2,
4355
+ ...props
4356
+ }) {
4357
+ const { listBoxProps } = useListBox(props, state2, listBoxRef);
4358
+ const styles2 = useMultiStyleConfig("ListBox", {});
4359
+ return /* @__PURE__ */ React49__default.createElement(
4360
+ List,
4361
+ {
4362
+ ...listBoxProps,
4363
+ ref: listBoxRef,
4364
+ sx: styles2.container,
4365
+ "aria-busy": isLoading
4366
+ },
4367
+ [...state2.collection].map(
4368
+ (item) => item.type === "section" ? /* @__PURE__ */ React49__default.createElement(ListBoxSection, { key: item.key, section: item, state: state2 }) : /* @__PURE__ */ React49__default.createElement(Option, { key: item.key, item, state: state2 })
4369
+ )
4370
+ );
4371
+ }
4372
+ function ItemLabel({ children }) {
4373
+ let { labelProps } = useOptionContext();
4374
+ const styles2 = useMultiStyleConfig("ListBox", {});
4375
+ return /* @__PURE__ */ React49__default.createElement(Box, { ...labelProps, sx: styles2.label }, children);
4376
+ }
4377
+ var SelectItemLabel = ItemLabel;
4378
+ function ItemDescription({ children }) {
4379
+ let { descriptionProps } = useOptionContext();
4380
+ const styles2 = useMultiStyleConfig("ListBox", {});
4381
+ return /* @__PURE__ */ React49__default.createElement(Box, { ...descriptionProps, sx: styles2.description }, children);
4382
+ }
4383
+ var SelectItemDescription = ItemDescription;
4384
+ function Option({ item, state: state2 }) {
4385
+ const ref = useRef(null);
4386
+ const {
4387
+ optionProps,
4388
+ isSelected,
4389
+ isDisabled,
4390
+ isFocused,
4391
+ labelProps,
4392
+ descriptionProps
4393
+ } = useOption({ key: item.key }, state2, ref);
4394
+ const styles2 = useMultiStyleConfig("ListBox", {});
4395
+ let dataFields = {};
4396
+ if (isSelected) {
4397
+ dataFields["data-selected"] = true;
4398
+ }
4399
+ if (isDisabled) {
4400
+ dataFields["data-disabled"] = true;
4401
+ }
4402
+ if (isFocused) {
4403
+ dataFields["data-focus"] = true;
4404
+ }
4405
+ return /* @__PURE__ */ React49__default.createElement(OptionContext.Provider, { value: { labelProps, descriptionProps } }, /* @__PURE__ */ React49__default.createElement(ListItem, { ...optionProps, ...dataFields, ref, sx: styles2.item }, item.rendered));
4406
+ }
4407
+ var OptionContext = React49__default.createContext({
4408
+ labelProps: {},
4409
+ descriptionProps: {}
4410
+ });
4411
+ var useOptionContext = () => {
4412
+ return useContext(OptionContext);
4413
+ };
4414
+ function ListBoxSection({ section, state: state2 }) {
4415
+ const { itemProps, headingProps, groupProps } = useListBoxSection({
4416
+ heading: section.rendered,
4417
+ "aria-label": section["aria-label"]
4418
+ });
4419
+ const isFirstSection = section.key !== state2.collection.getFirstKey();
4420
+ const titleBackgroundColor = useColorModeValue("platinum", "dimGrey");
4421
+ const titleColor = useColorModeValue("darkGrey", "white");
4422
+ return /* @__PURE__ */ React49__default.createElement(ListItem, { ...itemProps }, section.rendered && /* @__PURE__ */ React49__default.createElement(
4423
+ Box,
4424
+ {
4425
+ textStyle: "xs",
4426
+ backgroundColor: titleBackgroundColor,
4427
+ color: titleColor,
4428
+ paddingX: 3,
4429
+ paddingY: 1,
4430
+ marginTop: isFirstSection ? 0 : 0,
4431
+ ...headingProps
4432
+ },
4433
+ section.rendered
4434
+ ), /* @__PURE__ */ React49__default.createElement(List, { ...groupProps, padding: 0, listStyleType: "none" }, [...state2.collection.getChildren(section.key)].map((item) => /* @__PURE__ */ React49__default.createElement(Option, { key: item.key, item, state: state2 }))));
4435
+ }
4436
+
4437
+ // src/input/InfoSelect.tsx
4438
+ function InfoSelect({
4439
+ placeholder,
4440
+ width = "100%",
4441
+ height = "auto",
4442
+ onChange,
4443
+ value,
4444
+ isLabelSrOnly,
4445
+ defaultValue,
4446
+ ...props
4447
+ }) {
4448
+ const renamedProps = {
4449
+ onSelectionChange: onChange,
4450
+ selectedKey: value,
4451
+ defaultSelectedKey: defaultValue,
4452
+ ...props
4453
+ };
4454
+ const state2 = useSelectState(renamedProps);
4455
+ const triggerRef = useRef(null);
4456
+ const listboxRef = useRef(null);
4457
+ const { labelProps, triggerProps, valueProps, menuProps } = useSelect(
4458
+ renamedProps,
4459
+ state2,
4460
+ triggerRef
4461
+ );
4462
+ const styles2 = useMultiStyleConfig("InfoSelect", {
4463
+ isOpen: state2.isOpen,
4464
+ isLabelSrOnly
4465
+ });
4466
+ const { buttonProps } = useButton(triggerProps, triggerRef);
4467
+ const { t: t2 } = useTranslation();
4468
+ const formControl = useFormControlProps(props);
4469
+ return /* @__PURE__ */ React49__default.createElement(Box, { sx: styles2.container }, /* @__PURE__ */ React49__default.createElement(chakra.div, { ...labelProps, sx: styles2.label }, props.label), /* @__PURE__ */ React49__default.createElement(
4470
+ HiddenSelect,
4471
+ {
4472
+ state: state2,
4473
+ triggerRef,
4474
+ label: props.label,
4475
+ name: props.name
4476
+ }
4477
+ ), /* @__PURE__ */ React49__default.createElement(
4478
+ chakra.button,
4479
+ {
4480
+ type: "button",
4481
+ ref: triggerRef,
4482
+ sx: styles2.button,
4483
+ ...buttonProps,
4484
+ width,
4485
+ height,
4486
+ "data-attachable": true,
4487
+ "aria-invalid": formControl.isInvalid,
4488
+ "aria-describedby": formControl["aria-describedby"]
4489
+ },
4490
+ /* @__PURE__ */ React49__default.createElement(Box, { ...valueProps }, state2.selectedItem ? state2.selectedItem.textValue ?? state2.selectedItem.rendered : placeholder ?? t2(texts10.selectAnOption)),
4491
+ /* @__PURE__ */ React49__default.createElement(Box, { sx: styles2.arrowIcon }, state2.isOpen ? /* @__PURE__ */ React49__default.createElement(DropdownUpFill24Icon, null) : /* @__PURE__ */ React49__default.createElement(DropdownDownFill24Icon, null))
4492
+ ), state2.isOpen && /* @__PURE__ */ React49__default.createElement(Popover3, { state: state2, triggerRef }, /* @__PURE__ */ React49__default.createElement(
4493
+ ListBox,
4494
+ {
4495
+ ...menuProps,
4496
+ state: state2,
4497
+ listBoxRef: listboxRef,
4498
+ borderBottomRadius: "sm"
4499
+ },
4500
+ props.children
4501
+ )));
4502
+ }
4503
+ var texts10 = createTexts({
4504
+ selectAnOption: {
4505
+ nb: "Velg et alternativ",
4506
+ nn: "Velg eit alternativ",
4507
+ sv: "V\xE4lj ett alternativ",
4508
+ en: "Choose an option"
4509
+ }
4510
+ });
4511
+ var Input = forwardRef(
4512
+ ({ label, leftIcon, rightIcon, id, ...props }, ref) => {
4513
+ const formControlProps = useFormControlContext();
4514
+ const fallbackId = `input-${useId()}`;
4515
+ const inputId = id ?? (formControlProps == null ? void 0 : formControlProps.id) ?? fallbackId;
4516
+ return /* @__PURE__ */ React49__default.createElement(InputGroup, { position: "relative" }, leftIcon && /* @__PURE__ */ React49__default.createElement(InputLeftElement, null, leftIcon), /* @__PURE__ */ React49__default.createElement(
4517
+ Input$1,
4518
+ {
4519
+ "data-attachable": true,
4520
+ paddingLeft: leftIcon ? 7 : void 0,
4521
+ paddingRight: rightIcon ? 7 : void 0,
4522
+ ...props,
4523
+ id: inputId,
4524
+ ref,
4525
+ placeholder: " "
4526
+ }
4527
+ ), /* @__PURE__ */ React49__default.createElement(FormLabel, { htmlFor: inputId, pointerEvents: "none" }, label), rightIcon && /* @__PURE__ */ React49__default.createElement(InputRightElement, null, rightIcon));
4528
+ }
4529
+ );
4530
+ var InputLeftElement2 = forwardRef(
4531
+ (props, ref) => /* @__PURE__ */ React49__default.createElement(InputLeftElement, { ...props, ref })
4532
+ );
4533
+ var InputRightElement2 = forwardRef(
4534
+ (props, ref) => /* @__PURE__ */ React49__default.createElement(InputRightElement, { ...props, ref })
4535
+ );
4536
+ var NativeSelect = forwardRef(
4537
+ ({ label, ...props }, ref) => {
4538
+ const styles2 = useMultiStyleConfig("Select", props);
4539
+ return /* @__PURE__ */ React49__default.createElement(FormControl, null, /* @__PURE__ */ React49__default.createElement(
4540
+ Select,
4541
+ {
4542
+ "data-attachable": true,
4543
+ ...props,
4544
+ rootProps: { __css: styles2.root },
4545
+ ref
4546
+ }
4547
+ ), label && /* @__PURE__ */ React49__default.createElement(FormLabel3, null, label));
4548
+ }
4549
+ );
4191
4550
  var colors = {
4192
4551
  ...tokens10__default.color.alias,
4193
4552
  ...tokens10__default.color.palette,
@@ -4262,7 +4621,7 @@ function NumericStepper({
4262
4621
  VerySmallButton,
4263
4622
  {
4264
4623
  icon: /* @__PURE__ */ React49__default.createElement(SubtractIcon, { color: "white" }),
4265
- "aria-label": t2(texts10.decrementButtonAriaLabel),
4624
+ "aria-label": t2(texts11.decrementButtonAriaLabel),
4266
4625
  onClick: () => onChange(value - 1),
4267
4626
  visibility: value <= minValue ? "hidden" : "visible",
4268
4627
  isDisabled: formControlProps.disabled
@@ -4320,7 +4679,7 @@ function NumericStepper({
4320
4679
  VerySmallButton,
4321
4680
  {
4322
4681
  icon: /* @__PURE__ */ React49__default.createElement(AddIcon, { color: "white" }),
4323
- "aria-label": t2(texts10.incrementButtonAriaLabel),
4682
+ "aria-label": t2(texts11.incrementButtonAriaLabel),
4324
4683
  onClick: () => onChange(value + 1),
4325
4684
  visibility: value >= maxValue ? "hidden" : "visible",
4326
4685
  isDisabled: formControlProps.disabled
@@ -4400,7 +4759,7 @@ var AddIcon = (props) => /* @__PURE__ */ React49__default.createElement(
4400
4759
  }
4401
4760
  )
4402
4761
  );
4403
- var texts10 = createTexts({
4762
+ var texts11 = createTexts({
4404
4763
  decrementButtonAriaLabel: {
4405
4764
  nb: "Trekk fra 1",
4406
4765
  en: "Subtract 1",
@@ -4414,228 +4773,6 @@ var texts10 = createTexts({
4414
4773
  sv: "L\xE4gg till 1"
4415
4774
  }
4416
4775
  });
4417
- var FormControl = forwardRef((props, ref) => {
4418
- return /* @__PURE__ */ React49__default.createElement(FormControl$1, { ...props, ref });
4419
- });
4420
- var FormErrorMessage = ({
4421
- children,
4422
- ...boxProps
4423
- }) => {
4424
- const formControlContext = useFormControlContext();
4425
- if (!formControlContext) {
4426
- throw new Error(
4427
- "FormErrorMessage must be used within a FormControl component"
4428
- );
4429
- }
4430
- if (!formControlContext.isInvalid) {
4431
- return null;
4432
- }
4433
- const { ref, ...errorMessageProps } = formControlContext.getErrorMessageProps();
4434
- return /* @__PURE__ */ React49__default.createElement(Box, { position: "relative", ref }, /* @__PURE__ */ React49__default.createElement(
4435
- Box,
4436
- {
4437
- borderRadius: "xs",
4438
- backgroundColor: "lightRed",
4439
- color: "darkGrey",
4440
- paddingX: 1.5,
4441
- paddingY: 1,
4442
- textStyle: "xs",
4443
- width: "fit-content",
4444
- position: "absolute",
4445
- top: -1.5,
4446
- left: 3,
4447
- zIndex: "popover",
4448
- maxWidth: "50ch",
4449
- ...errorMessageProps,
4450
- ...boxProps
4451
- },
4452
- /* @__PURE__ */ React49__default.createElement(Arrow, { position: "absolute", top: "-0.25em", left: "1em" }),
4453
- children
4454
- ));
4455
- };
4456
- var Arrow = (props) => {
4457
- return /* @__PURE__ */ React49__default.createElement(
4458
- Box,
4459
- {
4460
- ...props,
4461
- as: "svg",
4462
- width: "16",
4463
- height: "16",
4464
- viewBox: "0 0 16 16",
4465
- fill: "none",
4466
- transform: "rotate(45deg)"
4467
- },
4468
- /* @__PURE__ */ React49__default.createElement(
4469
- Box,
4470
- {
4471
- as: "path",
4472
- fill: "lightRed",
4473
- d: "M 0\n 0 Q 2.4 6 0 12 Q 6 9.6 12 12 Q 9.6 6 12 0 Q 6 2.4 0 0 z"
4474
- }
4475
- )
4476
- );
4477
- };
4478
- var FormLabel3 = forwardRef((props, ref) => {
4479
- return /* @__PURE__ */ React49__default.createElement(FormLabel, { ...props, ref });
4480
- });
4481
- var ListBox = forwardRef((props, ref) => {
4482
- const { state: state2, listBoxOptions, ...rest } = props;
4483
- const styles2 = useMultiStyleConfig("ListBox", {});
4484
- const internalRef = useRef(null);
4485
- const listBoxRef = ref ?? internalRef;
4486
- const { listBoxProps } = useListBox(listBoxOptions, state2, listBoxRef);
4487
- return /* @__PURE__ */ React49__default.createElement(
4488
- Box,
4489
- {
4490
- as: "ul",
4491
- ...listBoxProps,
4492
- sx: styles2.container,
4493
- ref: listBoxRef,
4494
- ...rest
4495
- },
4496
- Array.from(state2.collection).map((item) => /* @__PURE__ */ React49__default.createElement(Option, { key: item.key, item, state: state2 }))
4497
- );
4498
- });
4499
- var OptionContext = React49__default.createContext({
4500
- labelProps: {},
4501
- descriptionProps: {}
4502
- });
4503
- var useOptionContext = () => {
4504
- return useContext(OptionContext);
4505
- };
4506
- var Option = ({ item, state: state2 }) => {
4507
- const ref = useRef(null);
4508
- const styles2 = useMultiStyleConfig("ListBox", {});
4509
- const { optionProps, labelProps, descriptionProps } = useOption(
4510
- { key: item.key },
4511
- state2,
4512
- ref
4513
- );
4514
- return /* @__PURE__ */ React49__default.createElement(chakra.li, { ...optionProps, ref, sx: styles2.item }, /* @__PURE__ */ React49__default.createElement(OptionContext.Provider, { value: { labelProps, descriptionProps } }, item.rendered));
4515
- };
4516
- function SelectItemLabel({ children }) {
4517
- let { labelProps } = useOptionContext();
4518
- const styles2 = useMultiStyleConfig("ListBox", {});
4519
- return /* @__PURE__ */ React49__default.createElement(Box, { ...labelProps, sx: styles2.label }, children);
4520
- }
4521
- function SelectItemDescription({
4522
- children
4523
- }) {
4524
- let { descriptionProps } = useOptionContext();
4525
- const styles2 = useMultiStyleConfig("ListBox", {});
4526
- return /* @__PURE__ */ React49__default.createElement(Box, { ...descriptionProps, sx: styles2.description }, children);
4527
- }
4528
-
4529
- // src/input/InfoSelect.tsx
4530
- function InfoSelect({
4531
- placeholder,
4532
- width = "100%",
4533
- height = "auto",
4534
- onChange,
4535
- value,
4536
- isLabelSrOnly,
4537
- defaultValue,
4538
- ...props
4539
- }) {
4540
- const renamedProps = {
4541
- onSelectionChange: onChange,
4542
- selectedKey: value,
4543
- defaultSelectedKey: defaultValue,
4544
- ...props
4545
- };
4546
- const state2 = useSelectState(renamedProps);
4547
- const triggerRef = useRef(null);
4548
- const { labelProps, triggerProps, valueProps, menuProps } = useSelect(
4549
- renamedProps,
4550
- state2,
4551
- triggerRef
4552
- );
4553
- const styles2 = useMultiStyleConfig("InfoSelect", {
4554
- isOpen: state2.isOpen,
4555
- isLabelSrOnly
4556
- });
4557
- const { buttonProps } = useButton(triggerProps, triggerRef);
4558
- const { t: t2 } = useTranslation();
4559
- const formControl = useFormControlProps(props);
4560
- return /* @__PURE__ */ React49__default.createElement(Box, { sx: styles2.container }, /* @__PURE__ */ React49__default.createElement(chakra.div, { ...labelProps, sx: styles2.label }, props.label), /* @__PURE__ */ React49__default.createElement(
4561
- HiddenSelect,
4562
- {
4563
- state: state2,
4564
- triggerRef,
4565
- label: props.label,
4566
- name: props.name
4567
- }
4568
- ), /* @__PURE__ */ React49__default.createElement(
4569
- chakra.button,
4570
- {
4571
- type: "button",
4572
- ref: triggerRef,
4573
- sx: styles2.button,
4574
- ...buttonProps,
4575
- width,
4576
- height,
4577
- "data-attachable": true,
4578
- "aria-invalid": formControl.isInvalid,
4579
- "aria-describedby": formControl["aria-describedby"]
4580
- },
4581
- /* @__PURE__ */ React49__default.createElement(Box, { ...valueProps }, state2.selectedItem ? state2.selectedItem.textValue ?? state2.selectedItem.rendered : placeholder ?? t2(texts11.selectAnOption)),
4582
- /* @__PURE__ */ React49__default.createElement(Box, { sx: styles2.arrowIcon }, state2.isOpen ? /* @__PURE__ */ React49__default.createElement(DropdownUpFill24Icon, null) : /* @__PURE__ */ React49__default.createElement(DropdownDownFill24Icon, null))
4583
- ), state2.isOpen && /* @__PURE__ */ React49__default.createElement(Popover3, { state: state2, triggerRef }, /* @__PURE__ */ React49__default.createElement(
4584
- ListBox,
4585
- {
4586
- listBoxOptions: menuProps,
4587
- state: state2,
4588
- borderBottomRadius: "sm"
4589
- }
4590
- )));
4591
- }
4592
- var texts11 = createTexts({
4593
- selectAnOption: {
4594
- nb: "Velg et alternativ",
4595
- nn: "Velg eit alternativ",
4596
- sv: "V\xE4lj ett alternativ",
4597
- en: "Choose an option"
4598
- }
4599
- });
4600
- var Input = forwardRef(
4601
- ({ label, leftIcon, rightIcon, id, ...props }, ref) => {
4602
- const formControlProps = useFormControlContext();
4603
- const fallbackId = `input-${useId()}`;
4604
- const inputId = id ?? (formControlProps == null ? void 0 : formControlProps.id) ?? fallbackId;
4605
- return /* @__PURE__ */ React49__default.createElement(InputGroup, { position: "relative" }, leftIcon && /* @__PURE__ */ React49__default.createElement(InputLeftElement, null, leftIcon), /* @__PURE__ */ React49__default.createElement(
4606
- Input$1,
4607
- {
4608
- "data-attachable": true,
4609
- paddingLeft: leftIcon ? 7 : void 0,
4610
- paddingRight: rightIcon ? 7 : void 0,
4611
- ...props,
4612
- id: inputId,
4613
- ref,
4614
- placeholder: " "
4615
- }
4616
- ), /* @__PURE__ */ React49__default.createElement(FormLabel, { htmlFor: inputId, pointerEvents: "none" }, label), rightIcon && /* @__PURE__ */ React49__default.createElement(InputRightElement, null, rightIcon));
4617
- }
4618
- );
4619
- var InputLeftElement2 = forwardRef(
4620
- (props, ref) => /* @__PURE__ */ React49__default.createElement(InputLeftElement, { ...props, ref })
4621
- );
4622
- var InputRightElement2 = forwardRef(
4623
- (props, ref) => /* @__PURE__ */ React49__default.createElement(InputRightElement, { ...props, ref })
4624
- );
4625
- var NativeSelect = forwardRef(
4626
- ({ label, ...props }, ref) => {
4627
- const styles2 = useMultiStyleConfig("Select", props);
4628
- return /* @__PURE__ */ React49__default.createElement(FormControl, null, /* @__PURE__ */ React49__default.createElement(
4629
- Select,
4630
- {
4631
- "data-attachable": true,
4632
- ...props,
4633
- rootProps: { __css: styles2.root },
4634
- ref
4635
- }
4636
- ), label && /* @__PURE__ */ React49__default.createElement(FormLabel3, null, label));
4637
- }
4638
- );
4639
4776
  var PasswordInput = forwardRef(
4640
4777
  ({ leftIcon, id, label, ...props }, ref) => {
4641
4778
  const { isOpen: isShowingPassword, onToggle } = useDisclosure();
@@ -4705,7 +4842,7 @@ var PhoneNumberInput = forwardRef(
4705
4842
  height: "100%",
4706
4843
  value: "+47"
4707
4844
  },
4708
- /* @__PURE__ */ React49__default.createElement(Item, { key: "+47" }, "+47")
4845
+ /* @__PURE__ */ React49__default.createElement(SelectItem, { key: "+47" }, "+47")
4709
4846
  )
4710
4847
  },
4711
4848
  /* @__PURE__ */ React49__default.createElement(
@@ -4750,7 +4887,7 @@ var texts13 = createTexts({
4750
4887
  sv: "Telefonnummer"
4751
4888
  }
4752
4889
  });
4753
- var LazyCountryCodeSelect = React49__default.lazy(() => import('./CountryCodeSelect-WGG2Z3VI.mjs'));
4890
+ var LazyCountryCodeSelect = React49__default.lazy(() => import('./CountryCodeSelect-5DBHKSF3.mjs'));
4754
4891
  var Radio = forwardRef((props, ref) => {
4755
4892
  return /* @__PURE__ */ React49__default.createElement(Radio$1, { ...props, ref });
4756
4893
  });
@@ -12873,19 +13010,19 @@ var config24 = helpers15.defineMultiStyleConfig({
12873
13010
  },
12874
13011
  _focus: {
12875
13012
  outline: "none",
12876
- background: mode("mint", "darkTeal")(props)
13013
+ backgroundColor: mode("mint", "darkTeal")(props)
12877
13014
  },
12878
13015
  _selected: {
12879
- background: mode("pine", "pine")(props),
13016
+ backgroundColor: mode("pine", "pine")(props),
12880
13017
  color: mode("white", "white")(props)
12881
13018
  }
12882
13019
  },
12883
13020
  label: {},
12884
13021
  description: {
12885
13022
  fontSize: ["mobile.xs", "desktop.xs"],
12886
- color: "dimGrey",
13023
+ color: mode("dimGrey", "silver")(props),
12887
13024
  "[aria-selected='true'] &": {
12888
- color: "lightGrey"
13025
+ color: mode("lightGrey", "platinum")(props)
12889
13026
  }
12890
13027
  }
12891
13028
  })
@@ -14378,4 +14515,4 @@ var getToastComponent = (opts) => {
14378
14515
  return ({ id }) => /* @__PURE__ */ React49__default.createElement(BaseToast, { id, variant: opts.variant }, opts.text);
14379
14516
  };
14380
14517
 
14381
- export { Accordion, AttachedInputs, Badge, Button, ButtonGroup, Card, CardSelect, Checkbox, CheckboxGroup, ChoiceChip, ClosableAlert, CloseButton, Code, ColorInlineLoader, ColorSpinner, ContentLoader, DarkFullScreenLoader, DarkInlineLoader, DarkSpinner, DatePicker, DateRangePicker, Divider, Drawer, DrawerContent, Expandable, ExpandableAlert, ExpandableItem, FloatingActionButton, FormControl, FormErrorMessage, FormLabel3 as FormLabel, Heading, IconButton, InfoSelect, InfoTag, Input, InputLeftElement2 as InputLeftElement, InputRightElement2 as InputRightElement, JumpButton, Language, LanguageProvider, LightFullScreenLoader, LightInlineLoader, LightSpinner, LineIcon, ListBox, ModalHeader, NativeSelect, NumericStepper, PasswordInput, PhoneNumberInput, PlayPauseButton, PopoverWizardBody, ProgressBar, ProgressLoader, Radio, RadioGroup, SearchInput, SelectItemDescription, SelectItemLabel, SimpleDrawer, SimplePopover, Skeleton, SkeletonCircle, SkeletonText, SkipButton, SporProvider, Stack, StaticAlert, Stepper, StepperStep, Switch, Table, Tabs, Text4 as Text, TextLink, Textarea, TimePicker, TravelTag, VyLogo, WizardPopover, createTexts, fontFaces, theme, useToast, useTranslation };
14518
+ export { Accordion, AttachedInputs, Autosuggest, Badge, Button, ButtonGroup, 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, FormLabel3 as FormLabel, Heading, IconButton, InfoSelect, InfoTag, Input, InputLeftElement2 as InputLeftElement, InputRightElement2 as InputRightElement, ItemDescription, ItemLabel, JumpButton, Language, LanguageProvider, LightFullScreenLoader, LightInlineLoader, LightSpinner, LineIcon, ListBox, ModalHeader, NativeSelect, NumericStepper, PasswordInput, PhoneNumberInput, PlayPauseButton, PopoverWizardBody, ProgressBar, ProgressLoader, Radio, RadioGroup, SearchInput, SelectItem, SelectItemDescription, SelectItemLabel, SimpleDrawer, SimplePopover, Skeleton, SkeletonCircle, SkeletonText, SkipButton, SporProvider, Stack, StaticAlert, Stepper, StepperStep, Switch, Table, Tabs, Text4 as Text, TextLink, Textarea, TimePicker, TravelTag, VyLogo, WizardPopover, createTexts, fontFaces, theme, useToast, useTranslation };