@vygruppen/spor-react 2.3.4 → 2.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -322,6 +322,7 @@ var init_DarkInlineLoader = __esm({
322
322
  exports.DarkSpinner = void 0;
323
323
  var init_DarkSpinner = __esm({
324
324
  "src/loader/DarkSpinner.tsx"() {
325
+ init_src();
325
326
  init_ClientOnly();
326
327
  init_Lottie();
327
328
  exports.DarkSpinner = ({
@@ -330,7 +331,7 @@ var init_DarkSpinner = __esm({
330
331
  maxWidth,
331
332
  ...props
332
333
  }) => {
333
- return /* @__PURE__ */ React49__namespace.default.createElement(react.Center, { flexDirection: "column", ...props }, /* @__PURE__ */ React49__namespace.default.createElement(react.Box, { width, maxWidth }, /* @__PURE__ */ React49__namespace.default.createElement(ClientOnly, null, () => /* @__PURE__ */ React49__namespace.default.createElement(Lottie, { animationData: sporLoader.spinnerDarkData }))), children && /* @__PURE__ */ React49__namespace.default.createElement(react.Box, { mt: 3, fontWeight: "bold" }, children));
334
+ return /* @__PURE__ */ React49__namespace.default.createElement(react.Center, { flexDirection: "column", ...props }, /* @__PURE__ */ React49__namespace.default.createElement(react.Box, { width, maxWidth }, /* @__PURE__ */ React49__namespace.default.createElement(ClientOnly, null, () => /* @__PURE__ */ React49__namespace.default.createElement(Lottie, { animationData: sporLoader.spinnerDarkData }))), children && /* @__PURE__ */ React49__namespace.default.createElement(react.Box, { marginTop: 3, fontWeight: "bold" }, children));
334
335
  };
335
336
  }
336
337
  });
@@ -3749,6 +3750,39 @@ var init_AttachedInputs = __esm({
3749
3750
  };
3750
3751
  }
3751
3752
  });
3753
+ function Autosuggest({
3754
+ label,
3755
+ fetcher,
3756
+ children,
3757
+ onSelectionChange,
3758
+ ...boxProps
3759
+ }) {
3760
+ const list2 = reactStately.useAsyncList({
3761
+ async load({ filterText }) {
3762
+ return {
3763
+ items: await fetcher(filterText)
3764
+ };
3765
+ }
3766
+ });
3767
+ return /* @__PURE__ */ React49__namespace.default.createElement(
3768
+ Combobox,
3769
+ {
3770
+ label,
3771
+ items: list2.items,
3772
+ inputValue: list2.filterText,
3773
+ onInputChange: list2.setFilterText,
3774
+ isLoading: list2.isLoading,
3775
+ onSelectionChange,
3776
+ ...boxProps
3777
+ },
3778
+ children
3779
+ );
3780
+ }
3781
+ var init_Autosuggest = __esm({
3782
+ "src/input/Autosuggest.tsx"() {
3783
+ init_src();
3784
+ }
3785
+ });
3752
3786
  var Dialog;
3753
3787
  var init_Dialog = __esm({
3754
3788
  "src/input/Dialog.tsx"() {
@@ -3762,38 +3796,41 @@ var init_Dialog = __esm({
3762
3796
  var Popover3;
3763
3797
  var init_Popover = __esm({
3764
3798
  "src/input/Popover.tsx"() {
3765
- Popover3 = ({
3766
- children,
3767
- state: state2,
3768
- triggerRef,
3769
- offset = 0,
3770
- crossOffset = 0,
3771
- placement = "bottom"
3772
- }) => {
3773
- var _a6;
3774
- const popoverRef = React49.useRef(null);
3775
- const { popoverProps, underlayProps } = reactAria.usePopover(
3776
- {
3777
- triggerRef,
3778
- popoverRef,
3779
- offset,
3780
- crossOffset,
3781
- placement
3782
- },
3783
- state2
3784
- );
3785
- return /* @__PURE__ */ React49__namespace.default.createElement(reactAria.Overlay, null, /* @__PURE__ */ React49__namespace.default.createElement(react.Box, { ...underlayProps, position: "fixed", inset: "0" }), /* @__PURE__ */ React49__namespace.default.createElement(
3786
- react.Box,
3787
- {
3788
- ...popoverProps,
3789
- ref: popoverRef,
3790
- minWidth: ((_a6 = triggerRef.current) == null ? void 0 : _a6.clientWidth) ?? "auto"
3791
- },
3792
- /* @__PURE__ */ React49__namespace.default.createElement(reactAria.DismissButton, { onDismiss: state2.close }),
3799
+ Popover3 = React49.forwardRef(
3800
+ ({
3793
3801
  children,
3794
- /* @__PURE__ */ React49__namespace.default.createElement(reactAria.DismissButton, { onDismiss: state2.close })
3795
- ));
3796
- };
3802
+ state: state2,
3803
+ triggerRef,
3804
+ offset = 0,
3805
+ crossOffset = 0,
3806
+ placement = "bottom"
3807
+ }, ref) => {
3808
+ var _a6;
3809
+ const internalRef = React49.useRef(null);
3810
+ const popoverRef = ref ?? internalRef;
3811
+ const { popoverProps, underlayProps } = reactAria.usePopover(
3812
+ {
3813
+ triggerRef,
3814
+ popoverRef,
3815
+ offset,
3816
+ crossOffset,
3817
+ placement
3818
+ },
3819
+ state2
3820
+ );
3821
+ return /* @__PURE__ */ React49__namespace.default.createElement(reactAria.Overlay, null, /* @__PURE__ */ React49__namespace.default.createElement(react.Box, { ...underlayProps, position: "fixed", inset: "0" }), /* @__PURE__ */ React49__namespace.default.createElement(
3822
+ react.Box,
3823
+ {
3824
+ ...popoverProps,
3825
+ ref: popoverRef,
3826
+ minWidth: ((_a6 = triggerRef.current) == null ? void 0 : _a6.clientWidth) ?? "auto"
3827
+ },
3828
+ /* @__PURE__ */ React49__namespace.default.createElement(reactAria.DismissButton, { onDismiss: state2.close }),
3829
+ children,
3830
+ /* @__PURE__ */ React49__namespace.default.createElement(reactAria.DismissButton, { onDismiss: state2.close })
3831
+ ));
3832
+ }
3833
+ );
3797
3834
  }
3798
3835
  });
3799
3836
  function useForceRerender(shouldRerender) {
@@ -4697,6 +4734,418 @@ var init_ChoiceChip = __esm({
4697
4734
  });
4698
4735
  }
4699
4736
  });
4737
+ function Combobox({
4738
+ label,
4739
+ isLoading,
4740
+ leftIcon,
4741
+ rightIcon,
4742
+ borderBottomLeftRadius = "sm",
4743
+ borderBottomRightRadius = "sm",
4744
+ borderTopLeftRadius = "sm",
4745
+ borderTopRightRadius = "sm",
4746
+ marginBottom,
4747
+ marginTop,
4748
+ marginX,
4749
+ marginY,
4750
+ paddingBottom,
4751
+ paddingRight,
4752
+ paddingTop,
4753
+ paddingLeft,
4754
+ paddingX,
4755
+ paddingY,
4756
+ onFocus,
4757
+ ...rest
4758
+ }) {
4759
+ const { contains: contains2 } = reactAria.useFilter({ sensitivity: "base" });
4760
+ const state2 = reactStately.useComboBoxState({
4761
+ ...rest,
4762
+ defaultFilter: contains2
4763
+ });
4764
+ const inputRef = React49.useRef(null);
4765
+ const listBoxRef = React49.useRef(null);
4766
+ const popoverRef = React49.useRef(null);
4767
+ const {
4768
+ inputProps: { size: size2, ...inputProps },
4769
+ listBoxProps
4770
+ } = reactAria.useComboBox(
4771
+ {
4772
+ ...rest,
4773
+ inputRef,
4774
+ listBoxRef,
4775
+ popoverRef
4776
+ },
4777
+ state2
4778
+ );
4779
+ return /* @__PURE__ */ React49__namespace.default.createElement(exports.FormControl, null, /* @__PURE__ */ React49__namespace.default.createElement(
4780
+ exports.Input,
4781
+ {
4782
+ ...inputProps,
4783
+ ref: inputRef,
4784
+ label,
4785
+ onFocus,
4786
+ borderBottomLeftRadius: state2.isOpen ? 0 : borderBottomLeftRadius,
4787
+ borderBottomRightRadius: state2.isOpen ? 0 : borderBottomRightRadius,
4788
+ borderTopLeftRadius,
4789
+ borderTopRightRadius,
4790
+ marginBottom,
4791
+ marginTop,
4792
+ marginX,
4793
+ marginY,
4794
+ paddingBottom,
4795
+ paddingRight,
4796
+ paddingTop,
4797
+ paddingLeft,
4798
+ paddingX,
4799
+ paddingY,
4800
+ leftIcon,
4801
+ rightIcon: isLoading ? /* @__PURE__ */ React49__namespace.default.createElement(
4802
+ exports.ColorSpinner,
4803
+ {
4804
+ width: "1.5rem",
4805
+ alignSelf: "center",
4806
+ css: {
4807
+ div: {
4808
+ display: "flex",
4809
+ alignItems: "center"
4810
+ }
4811
+ }
4812
+ }
4813
+ ) : rightIcon
4814
+ }
4815
+ ), state2.isOpen && /* @__PURE__ */ React49__namespace.default.createElement(
4816
+ Popover3,
4817
+ {
4818
+ state: state2,
4819
+ triggerRef: inputRef,
4820
+ ref: popoverRef,
4821
+ placement: "bottom start"
4822
+ },
4823
+ /* @__PURE__ */ React49__namespace.default.createElement(
4824
+ ListBox,
4825
+ {
4826
+ ...listBoxProps,
4827
+ state: state2,
4828
+ listBoxRef,
4829
+ borderBottomRadius: "sm"
4830
+ },
4831
+ rest.children
4832
+ )
4833
+ ));
4834
+ }
4835
+ var init_Combobox = __esm({
4836
+ "src/input/Combobox.tsx"() {
4837
+ init_src();
4838
+ init_Popover();
4839
+ }
4840
+ });
4841
+ exports.FormControl = void 0;
4842
+ var init_FormControl = __esm({
4843
+ "src/input/FormControl.tsx"() {
4844
+ exports.FormControl = react.forwardRef((props, ref) => {
4845
+ return /* @__PURE__ */ React49__namespace.default.createElement(react.FormControl, { ...props, ref });
4846
+ });
4847
+ }
4848
+ });
4849
+ exports.FormErrorMessage = void 0; var Arrow;
4850
+ var init_FormErrorMessage = __esm({
4851
+ "src/input/FormErrorMessage.tsx"() {
4852
+ exports.FormErrorMessage = ({
4853
+ children,
4854
+ ...boxProps
4855
+ }) => {
4856
+ const formControlContext = react.useFormControlContext();
4857
+ if (!formControlContext) {
4858
+ throw new Error(
4859
+ "FormErrorMessage must be used within a FormControl component"
4860
+ );
4861
+ }
4862
+ if (!formControlContext.isInvalid) {
4863
+ return null;
4864
+ }
4865
+ const { ref, ...errorMessageProps } = formControlContext.getErrorMessageProps();
4866
+ return /* @__PURE__ */ React49__namespace.default.createElement(react.Box, { position: "relative", ref }, /* @__PURE__ */ React49__namespace.default.createElement(
4867
+ react.Box,
4868
+ {
4869
+ borderRadius: "xs",
4870
+ backgroundColor: "lightRed",
4871
+ color: "darkGrey",
4872
+ paddingX: 1.5,
4873
+ paddingY: 1,
4874
+ textStyle: "xs",
4875
+ width: "fit-content",
4876
+ position: "absolute",
4877
+ top: -0.5,
4878
+ left: 3,
4879
+ zIndex: "popover",
4880
+ maxWidth: "50ch",
4881
+ ...errorMessageProps,
4882
+ ...boxProps
4883
+ },
4884
+ /* @__PURE__ */ React49__namespace.default.createElement(Arrow, { position: "absolute", top: "-0.25em", left: "1em" }),
4885
+ children
4886
+ ));
4887
+ };
4888
+ Arrow = (props) => {
4889
+ return /* @__PURE__ */ React49__namespace.default.createElement(
4890
+ react.Box,
4891
+ {
4892
+ ...props,
4893
+ as: "svg",
4894
+ width: "16",
4895
+ height: "16",
4896
+ viewBox: "0 0 16 16",
4897
+ fill: "none",
4898
+ transform: "rotate(45deg)"
4899
+ },
4900
+ /* @__PURE__ */ React49__namespace.default.createElement(
4901
+ react.Box,
4902
+ {
4903
+ as: "path",
4904
+ fill: "lightRed",
4905
+ 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"
4906
+ }
4907
+ )
4908
+ );
4909
+ };
4910
+ }
4911
+ });
4912
+ exports.FormLabel = void 0;
4913
+ var init_FormLabel = __esm({
4914
+ "src/input/FormLabel.tsx"() {
4915
+ exports.FormLabel = react.forwardRef((props, ref) => {
4916
+ return /* @__PURE__ */ React49__namespace.default.createElement(react.FormLabel, { ...props, ref });
4917
+ });
4918
+ }
4919
+ });
4920
+ function ListBox({
4921
+ isLoading,
4922
+ listBoxRef,
4923
+ state: state2,
4924
+ ...props
4925
+ }) {
4926
+ const { listBoxProps } = reactAria.useListBox(props, state2, listBoxRef);
4927
+ const styles2 = react.useMultiStyleConfig("ListBox", {});
4928
+ return /* @__PURE__ */ React49__namespace.default.createElement(
4929
+ react.List,
4930
+ {
4931
+ ...listBoxProps,
4932
+ ref: listBoxRef,
4933
+ sx: styles2.container,
4934
+ "aria-busy": isLoading
4935
+ },
4936
+ Array.from(state2.collection).map(
4937
+ (item) => item.type === "section" ? /* @__PURE__ */ React49__namespace.default.createElement(ListBoxSection, { key: item.key, section: item, state: state2 }) : /* @__PURE__ */ React49__namespace.default.createElement(Option, { key: item.key, item, state: state2 })
4938
+ )
4939
+ );
4940
+ }
4941
+ function ItemLabel({ children }) {
4942
+ let { labelProps } = useOptionContext();
4943
+ const styles2 = react.useMultiStyleConfig("ListBox", {});
4944
+ return /* @__PURE__ */ React49__namespace.default.createElement(react.Box, { ...labelProps, sx: styles2.label }, children);
4945
+ }
4946
+ function ItemDescription({ children }) {
4947
+ let { descriptionProps } = useOptionContext();
4948
+ const styles2 = react.useMultiStyleConfig("ListBox", {});
4949
+ return /* @__PURE__ */ React49__namespace.default.createElement(react.Box, { ...descriptionProps, sx: styles2.description }, children);
4950
+ }
4951
+ function Option({ item, state: state2 }) {
4952
+ const ref = React49.useRef(null);
4953
+ const {
4954
+ optionProps,
4955
+ isSelected,
4956
+ isDisabled,
4957
+ isFocused,
4958
+ labelProps,
4959
+ descriptionProps
4960
+ } = reactAria.useOption({ key: item.key }, state2, ref);
4961
+ const styles2 = react.useMultiStyleConfig("ListBox", {});
4962
+ let dataFields = {};
4963
+ if (isSelected) {
4964
+ dataFields["data-selected"] = true;
4965
+ }
4966
+ if (isDisabled) {
4967
+ dataFields["data-disabled"] = true;
4968
+ }
4969
+ if (isFocused) {
4970
+ dataFields["data-focus"] = true;
4971
+ }
4972
+ return /* @__PURE__ */ React49__namespace.default.createElement(OptionContext.Provider, { value: { labelProps, descriptionProps } }, /* @__PURE__ */ React49__namespace.default.createElement(react.ListItem, { ...optionProps, ...dataFields, ref, sx: styles2.item }, item.rendered));
4973
+ }
4974
+ function ListBoxSection({ section, state: state2 }) {
4975
+ const { itemProps, headingProps, groupProps } = reactAria.useListBoxSection({
4976
+ heading: section.rendered,
4977
+ "aria-label": section["aria-label"]
4978
+ });
4979
+ const isFirstSection = section.key !== state2.collection.getFirstKey();
4980
+ const titleBackgroundColor = react.useColorModeValue("platinum", "dimGrey");
4981
+ const titleColor = react.useColorModeValue("darkGrey", "white");
4982
+ return /* @__PURE__ */ React49__namespace.default.createElement(react.ListItem, { ...itemProps }, section.rendered && /* @__PURE__ */ React49__namespace.default.createElement(
4983
+ react.Box,
4984
+ {
4985
+ textStyle: "xs",
4986
+ backgroundColor: titleBackgroundColor,
4987
+ color: titleColor,
4988
+ paddingX: 3,
4989
+ paddingY: 1,
4990
+ marginTop: isFirstSection ? 0 : 0,
4991
+ ...headingProps
4992
+ },
4993
+ section.rendered
4994
+ ), /* @__PURE__ */ React49__namespace.default.createElement(react.List, { ...groupProps, padding: 0, listStyleType: "none" }, Array.from(state2.collection.getChildren(section.key)).map(
4995
+ (item) => /* @__PURE__ */ React49__namespace.default.createElement(Option, { key: item.key, item, state: state2 })
4996
+ )));
4997
+ }
4998
+ exports.SelectItem = void 0; exports.SelectItemLabel = void 0; exports.SelectItemDescription = void 0; var OptionContext, useOptionContext;
4999
+ var init_ListBox = __esm({
5000
+ "src/input/ListBox.tsx"() {
5001
+ exports.SelectItem = reactStately.Item;
5002
+ exports.SelectItemLabel = ItemLabel;
5003
+ exports.SelectItemDescription = ItemDescription;
5004
+ OptionContext = React49__namespace.default.createContext({
5005
+ labelProps: {},
5006
+ descriptionProps: {}
5007
+ });
5008
+ useOptionContext = () => {
5009
+ return React49.useContext(OptionContext);
5010
+ };
5011
+ }
5012
+ });
5013
+ function InfoSelect({
5014
+ placeholder,
5015
+ width = "100%",
5016
+ height = "auto",
5017
+ onChange,
5018
+ value,
5019
+ isLabelSrOnly,
5020
+ defaultValue,
5021
+ ...props
5022
+ }) {
5023
+ const renamedProps = {
5024
+ onSelectionChange: onChange,
5025
+ selectedKey: value,
5026
+ defaultSelectedKey: defaultValue,
5027
+ ...props
5028
+ };
5029
+ const state2 = reactStately.useSelectState(renamedProps);
5030
+ const triggerRef = React49.useRef(null);
5031
+ const listboxRef = React49.useRef(null);
5032
+ const { labelProps, triggerProps, valueProps, menuProps } = reactAria.useSelect(
5033
+ renamedProps,
5034
+ state2,
5035
+ triggerRef
5036
+ );
5037
+ const styles2 = react.useMultiStyleConfig("InfoSelect", {
5038
+ isOpen: state2.isOpen,
5039
+ isLabelSrOnly
5040
+ });
5041
+ const { buttonProps } = reactAria.useButton(triggerProps, triggerRef);
5042
+ const { t: t2 } = useTranslation();
5043
+ const formControl = react.useFormControlProps(props);
5044
+ return /* @__PURE__ */ React49__namespace.default.createElement(react.Box, { sx: styles2.container }, /* @__PURE__ */ React49__namespace.default.createElement(react.chakra.div, { ...labelProps, sx: styles2.label }, props.label), /* @__PURE__ */ React49__namespace.default.createElement(
5045
+ reactAria.HiddenSelect,
5046
+ {
5047
+ state: state2,
5048
+ triggerRef,
5049
+ label: props.label,
5050
+ name: props.name
5051
+ }
5052
+ ), /* @__PURE__ */ React49__namespace.default.createElement(
5053
+ react.chakra.button,
5054
+ {
5055
+ type: "button",
5056
+ ref: triggerRef,
5057
+ sx: styles2.button,
5058
+ ...buttonProps,
5059
+ width,
5060
+ height,
5061
+ "data-attachable": true,
5062
+ "aria-invalid": formControl.isInvalid,
5063
+ "aria-describedby": formControl["aria-describedby"]
5064
+ },
5065
+ /* @__PURE__ */ React49__namespace.default.createElement(react.Box, { ...valueProps }, state2.selectedItem ? state2.selectedItem.textValue ?? state2.selectedItem.rendered : placeholder ?? t2(texts10.selectAnOption)),
5066
+ /* @__PURE__ */ React49__namespace.default.createElement(react.Box, { sx: styles2.arrowIcon }, state2.isOpen ? /* @__PURE__ */ React49__namespace.default.createElement(sporIconReact.DropdownUpFill24Icon, null) : /* @__PURE__ */ React49__namespace.default.createElement(sporIconReact.DropdownDownFill24Icon, null))
5067
+ ), state2.isOpen && /* @__PURE__ */ React49__namespace.default.createElement(Popover3, { state: state2, triggerRef }, /* @__PURE__ */ React49__namespace.default.createElement(
5068
+ ListBox,
5069
+ {
5070
+ ...menuProps,
5071
+ state: state2,
5072
+ listBoxRef: listboxRef,
5073
+ borderBottomRadius: "sm"
5074
+ },
5075
+ props.children
5076
+ )));
5077
+ }
5078
+ var texts10;
5079
+ var init_InfoSelect = __esm({
5080
+ "src/input/InfoSelect.tsx"() {
5081
+ init_src();
5082
+ init_ListBox();
5083
+ init_Popover();
5084
+ texts10 = createTexts({
5085
+ selectAnOption: {
5086
+ nb: "Velg et alternativ",
5087
+ nn: "Velg eit alternativ",
5088
+ sv: "V\xE4lj ett alternativ",
5089
+ en: "Choose an option"
5090
+ }
5091
+ });
5092
+ }
5093
+ });
5094
+ exports.Input = void 0;
5095
+ var init_Input = __esm({
5096
+ "src/input/Input.tsx"() {
5097
+ exports.Input = react.forwardRef(
5098
+ ({ label, leftIcon, rightIcon, id, ...props }, ref) => {
5099
+ const formControlProps = react.useFormControlContext();
5100
+ const fallbackId = `input-${React49.useId()}`;
5101
+ const inputId = id ?? (formControlProps == null ? void 0 : formControlProps.id) ?? fallbackId;
5102
+ return /* @__PURE__ */ React49__namespace.default.createElement(react.InputGroup, { position: "relative" }, leftIcon && /* @__PURE__ */ React49__namespace.default.createElement(react.InputLeftElement, null, leftIcon), /* @__PURE__ */ React49__namespace.default.createElement(
5103
+ react.Input,
5104
+ {
5105
+ "data-attachable": true,
5106
+ paddingLeft: leftIcon ? 7 : void 0,
5107
+ paddingRight: rightIcon ? 7 : void 0,
5108
+ ...props,
5109
+ id: inputId,
5110
+ ref,
5111
+ placeholder: " "
5112
+ }
5113
+ ), /* @__PURE__ */ React49__namespace.default.createElement(react.FormLabel, { htmlFor: inputId, pointerEvents: "none" }, label), rightIcon && /* @__PURE__ */ React49__namespace.default.createElement(react.InputRightElement, null, rightIcon));
5114
+ }
5115
+ );
5116
+ }
5117
+ });
5118
+ exports.InputLeftElement = void 0; exports.InputRightElement = void 0;
5119
+ var init_InputElement = __esm({
5120
+ "src/input/InputElement.tsx"() {
5121
+ exports.InputLeftElement = react.forwardRef(
5122
+ (props, ref) => /* @__PURE__ */ React49__namespace.default.createElement(react.InputLeftElement, { ...props, ref })
5123
+ );
5124
+ exports.InputRightElement = react.forwardRef(
5125
+ (props, ref) => /* @__PURE__ */ React49__namespace.default.createElement(react.InputRightElement, { ...props, ref })
5126
+ );
5127
+ }
5128
+ });
5129
+ exports.NativeSelect = void 0;
5130
+ var init_NativeSelect = __esm({
5131
+ "src/input/NativeSelect.tsx"() {
5132
+ init_input();
5133
+ exports.NativeSelect = react.forwardRef(
5134
+ ({ label, ...props }, ref) => {
5135
+ const styles2 = react.useMultiStyleConfig("Select", props);
5136
+ return /* @__PURE__ */ React49__namespace.default.createElement(exports.FormControl, null, /* @__PURE__ */ React49__namespace.default.createElement(
5137
+ react.Select,
5138
+ {
5139
+ "data-attachable": true,
5140
+ ...props,
5141
+ rootProps: { __css: styles2.root },
5142
+ ref
5143
+ }
5144
+ ), label && /* @__PURE__ */ React49__namespace.default.createElement(exports.FormLabel, null, label));
5145
+ }
5146
+ );
5147
+ }
5148
+ });
4700
5149
  var colors;
4701
5150
  var init_colors = __esm({
4702
5151
  "src/theme/foundations/colors.ts"() {
@@ -4791,7 +5240,7 @@ function NumericStepper({
4791
5240
  VerySmallButton,
4792
5241
  {
4793
5242
  icon: /* @__PURE__ */ React49__namespace.default.createElement(SubtractIcon, { color: "white" }),
4794
- "aria-label": t2(texts10.decrementButtonAriaLabel),
5243
+ "aria-label": t2(texts11.decrementButtonAriaLabel),
4795
5244
  onClick: () => onChange(value - 1),
4796
5245
  visibility: value <= minValue ? "hidden" : "visible",
4797
5246
  isDisabled: formControlProps.disabled
@@ -4849,14 +5298,14 @@ function NumericStepper({
4849
5298
  VerySmallButton,
4850
5299
  {
4851
5300
  icon: /* @__PURE__ */ React49__namespace.default.createElement(AddIcon, { color: "white" }),
4852
- "aria-label": t2(texts10.incrementButtonAriaLabel),
5301
+ "aria-label": t2(texts11.incrementButtonAriaLabel),
4853
5302
  onClick: () => onChange(value + 1),
4854
5303
  visibility: value >= maxValue ? "hidden" : "visible",
4855
5304
  isDisabled: formControlProps.disabled
4856
5305
  }
4857
5306
  ));
4858
5307
  }
4859
- var VerySmallButton, SubtractIcon, AddIcon, texts10;
5308
+ var VerySmallButton, SubtractIcon, AddIcon, texts11;
4860
5309
  var init_NumericStepper = __esm({
4861
5310
  "src/input/NumericStepper.tsx"() {
4862
5311
  init_src();
@@ -4935,7 +5384,7 @@ var init_NumericStepper = __esm({
4935
5384
  }
4936
5385
  )
4937
5386
  );
4938
- texts10 = createTexts({
5387
+ texts11 = createTexts({
4939
5388
  decrementButtonAriaLabel: {
4940
5389
  nb: "Trekk fra 1",
4941
5390
  en: "Subtract 1",
@@ -4951,270 +5400,6 @@ var init_NumericStepper = __esm({
4951
5400
  });
4952
5401
  }
4953
5402
  });
4954
- exports.FormControl = void 0;
4955
- var init_FormControl = __esm({
4956
- "src/input/FormControl.tsx"() {
4957
- exports.FormControl = react.forwardRef((props, ref) => {
4958
- return /* @__PURE__ */ React49__namespace.default.createElement(react.FormControl, { ...props, ref });
4959
- });
4960
- }
4961
- });
4962
- exports.FormErrorMessage = void 0; var Arrow;
4963
- var init_FormErrorMessage = __esm({
4964
- "src/input/FormErrorMessage.tsx"() {
4965
- exports.FormErrorMessage = ({
4966
- children,
4967
- ...boxProps
4968
- }) => {
4969
- const formControlContext = react.useFormControlContext();
4970
- if (!formControlContext) {
4971
- throw new Error(
4972
- "FormErrorMessage must be used within a FormControl component"
4973
- );
4974
- }
4975
- if (!formControlContext.isInvalid) {
4976
- return null;
4977
- }
4978
- const { ref, ...errorMessageProps } = formControlContext.getErrorMessageProps();
4979
- return /* @__PURE__ */ React49__namespace.default.createElement(react.Box, { position: "relative", ref }, /* @__PURE__ */ React49__namespace.default.createElement(
4980
- react.Box,
4981
- {
4982
- borderRadius: "xs",
4983
- backgroundColor: "lightRed",
4984
- color: "darkGrey",
4985
- paddingX: 1.5,
4986
- paddingY: 1,
4987
- textStyle: "xs",
4988
- width: "fit-content",
4989
- position: "absolute",
4990
- top: -1.5,
4991
- left: 3,
4992
- zIndex: "popover",
4993
- maxWidth: "50ch",
4994
- ...errorMessageProps,
4995
- ...boxProps
4996
- },
4997
- /* @__PURE__ */ React49__namespace.default.createElement(Arrow, { position: "absolute", top: "-0.25em", left: "1em" }),
4998
- children
4999
- ));
5000
- };
5001
- Arrow = (props) => {
5002
- return /* @__PURE__ */ React49__namespace.default.createElement(
5003
- react.Box,
5004
- {
5005
- ...props,
5006
- as: "svg",
5007
- width: "16",
5008
- height: "16",
5009
- viewBox: "0 0 16 16",
5010
- fill: "none",
5011
- transform: "rotate(45deg)"
5012
- },
5013
- /* @__PURE__ */ React49__namespace.default.createElement(
5014
- react.Box,
5015
- {
5016
- as: "path",
5017
- fill: "lightRed",
5018
- 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"
5019
- }
5020
- )
5021
- );
5022
- };
5023
- }
5024
- });
5025
- exports.FormLabel = void 0;
5026
- var init_FormLabel = __esm({
5027
- "src/input/FormLabel.tsx"() {
5028
- exports.FormLabel = react.forwardRef((props, ref) => {
5029
- return /* @__PURE__ */ React49__namespace.default.createElement(react.FormLabel, { ...props, ref });
5030
- });
5031
- }
5032
- });
5033
- function SelectItemLabel({ children }) {
5034
- let { labelProps } = useOptionContext();
5035
- const styles2 = react.useMultiStyleConfig("ListBox", {});
5036
- return /* @__PURE__ */ React49__namespace.default.createElement(react.Box, { ...labelProps, sx: styles2.label }, children);
5037
- }
5038
- function SelectItemDescription({
5039
- children
5040
- }) {
5041
- let { descriptionProps } = useOptionContext();
5042
- const styles2 = react.useMultiStyleConfig("ListBox", {});
5043
- return /* @__PURE__ */ React49__namespace.default.createElement(react.Box, { ...descriptionProps, sx: styles2.description }, children);
5044
- }
5045
- exports.ListBox = void 0; var OptionContext, useOptionContext, Option;
5046
- var init_ListBox = __esm({
5047
- "src/input/ListBox.tsx"() {
5048
- exports.ListBox = react.forwardRef((props, ref) => {
5049
- const { state: state2, listBoxOptions, ...rest } = props;
5050
- const styles2 = react.useMultiStyleConfig("ListBox", {});
5051
- const internalRef = React49.useRef(null);
5052
- const listBoxRef = ref ?? internalRef;
5053
- const { listBoxProps } = reactAria.useListBox(listBoxOptions, state2, listBoxRef);
5054
- return /* @__PURE__ */ React49__namespace.default.createElement(
5055
- react.Box,
5056
- {
5057
- as: "ul",
5058
- ...listBoxProps,
5059
- sx: styles2.container,
5060
- ref: listBoxRef,
5061
- ...rest
5062
- },
5063
- Array.from(state2.collection).map((item) => /* @__PURE__ */ React49__namespace.default.createElement(Option, { key: item.key, item, state: state2 }))
5064
- );
5065
- });
5066
- OptionContext = React49__namespace.default.createContext({
5067
- labelProps: {},
5068
- descriptionProps: {}
5069
- });
5070
- useOptionContext = () => {
5071
- return React49.useContext(OptionContext);
5072
- };
5073
- Option = ({ item, state: state2 }) => {
5074
- const ref = React49.useRef(null);
5075
- const styles2 = react.useMultiStyleConfig("ListBox", {});
5076
- const { optionProps, labelProps, descriptionProps } = reactAria.useOption(
5077
- { key: item.key },
5078
- state2,
5079
- ref
5080
- );
5081
- return /* @__PURE__ */ React49__namespace.default.createElement(react.chakra.li, { ...optionProps, ref, sx: styles2.item }, /* @__PURE__ */ React49__namespace.default.createElement(OptionContext.Provider, { value: { labelProps, descriptionProps } }, item.rendered));
5082
- };
5083
- }
5084
- });
5085
- function InfoSelect({
5086
- placeholder,
5087
- width = "100%",
5088
- height = "auto",
5089
- onChange,
5090
- value,
5091
- isLabelSrOnly,
5092
- defaultValue,
5093
- ...props
5094
- }) {
5095
- const renamedProps = {
5096
- onSelectionChange: onChange,
5097
- selectedKey: value,
5098
- defaultSelectedKey: defaultValue,
5099
- ...props
5100
- };
5101
- const state2 = reactStately.useSelectState(renamedProps);
5102
- const triggerRef = React49.useRef(null);
5103
- const { labelProps, triggerProps, valueProps, menuProps } = reactAria.useSelect(
5104
- renamedProps,
5105
- state2,
5106
- triggerRef
5107
- );
5108
- const styles2 = react.useMultiStyleConfig("InfoSelect", {
5109
- isOpen: state2.isOpen,
5110
- isLabelSrOnly
5111
- });
5112
- const { buttonProps } = reactAria.useButton(triggerProps, triggerRef);
5113
- const { t: t2 } = useTranslation();
5114
- const formControl = react.useFormControlProps(props);
5115
- return /* @__PURE__ */ React49__namespace.default.createElement(react.Box, { sx: styles2.container }, /* @__PURE__ */ React49__namespace.default.createElement(react.chakra.div, { ...labelProps, sx: styles2.label }, props.label), /* @__PURE__ */ React49__namespace.default.createElement(
5116
- reactAria.HiddenSelect,
5117
- {
5118
- state: state2,
5119
- triggerRef,
5120
- label: props.label,
5121
- name: props.name
5122
- }
5123
- ), /* @__PURE__ */ React49__namespace.default.createElement(
5124
- react.chakra.button,
5125
- {
5126
- type: "button",
5127
- ref: triggerRef,
5128
- sx: styles2.button,
5129
- ...buttonProps,
5130
- width,
5131
- height,
5132
- "data-attachable": true,
5133
- "aria-invalid": formControl.isInvalid,
5134
- "aria-describedby": formControl["aria-describedby"]
5135
- },
5136
- /* @__PURE__ */ React49__namespace.default.createElement(react.Box, { ...valueProps }, state2.selectedItem ? state2.selectedItem.textValue ?? state2.selectedItem.rendered : placeholder ?? t2(texts11.selectAnOption)),
5137
- /* @__PURE__ */ React49__namespace.default.createElement(react.Box, { sx: styles2.arrowIcon }, state2.isOpen ? /* @__PURE__ */ React49__namespace.default.createElement(sporIconReact.DropdownUpFill24Icon, null) : /* @__PURE__ */ React49__namespace.default.createElement(sporIconReact.DropdownDownFill24Icon, null))
5138
- ), state2.isOpen && /* @__PURE__ */ React49__namespace.default.createElement(Popover3, { state: state2, triggerRef }, /* @__PURE__ */ React49__namespace.default.createElement(
5139
- exports.ListBox,
5140
- {
5141
- listBoxOptions: menuProps,
5142
- state: state2,
5143
- borderBottomRadius: "sm"
5144
- }
5145
- )));
5146
- }
5147
- var texts11;
5148
- var init_InfoSelect = __esm({
5149
- "src/input/InfoSelect.tsx"() {
5150
- init_src();
5151
- init_ListBox();
5152
- init_Popover();
5153
- texts11 = createTexts({
5154
- selectAnOption: {
5155
- nb: "Velg et alternativ",
5156
- nn: "Velg eit alternativ",
5157
- sv: "V\xE4lj ett alternativ",
5158
- en: "Choose an option"
5159
- }
5160
- });
5161
- }
5162
- });
5163
- exports.Input = void 0;
5164
- var init_Input = __esm({
5165
- "src/input/Input.tsx"() {
5166
- exports.Input = react.forwardRef(
5167
- ({ label, leftIcon, rightIcon, id, ...props }, ref) => {
5168
- const formControlProps = react.useFormControlContext();
5169
- const fallbackId = `input-${React49.useId()}`;
5170
- const inputId = id ?? (formControlProps == null ? void 0 : formControlProps.id) ?? fallbackId;
5171
- return /* @__PURE__ */ React49__namespace.default.createElement(react.InputGroup, { position: "relative" }, leftIcon && /* @__PURE__ */ React49__namespace.default.createElement(react.InputLeftElement, null, leftIcon), /* @__PURE__ */ React49__namespace.default.createElement(
5172
- react.Input,
5173
- {
5174
- "data-attachable": true,
5175
- paddingLeft: leftIcon ? 7 : void 0,
5176
- paddingRight: rightIcon ? 7 : void 0,
5177
- ...props,
5178
- id: inputId,
5179
- ref,
5180
- placeholder: " "
5181
- }
5182
- ), /* @__PURE__ */ React49__namespace.default.createElement(react.FormLabel, { htmlFor: inputId, pointerEvents: "none" }, label), rightIcon && /* @__PURE__ */ React49__namespace.default.createElement(react.InputRightElement, null, rightIcon));
5183
- }
5184
- );
5185
- }
5186
- });
5187
- exports.InputLeftElement = void 0; exports.InputRightElement = void 0;
5188
- var init_InputElement = __esm({
5189
- "src/input/InputElement.tsx"() {
5190
- exports.InputLeftElement = react.forwardRef(
5191
- (props, ref) => /* @__PURE__ */ React49__namespace.default.createElement(react.InputLeftElement, { ...props, ref })
5192
- );
5193
- exports.InputRightElement = react.forwardRef(
5194
- (props, ref) => /* @__PURE__ */ React49__namespace.default.createElement(react.InputRightElement, { ...props, ref })
5195
- );
5196
- }
5197
- });
5198
- exports.NativeSelect = void 0;
5199
- var init_NativeSelect = __esm({
5200
- "src/input/NativeSelect.tsx"() {
5201
- init_input();
5202
- exports.NativeSelect = react.forwardRef(
5203
- ({ label, ...props }, ref) => {
5204
- const styles2 = react.useMultiStyleConfig("Select", props);
5205
- return /* @__PURE__ */ React49__namespace.default.createElement(exports.FormControl, null, /* @__PURE__ */ React49__namespace.default.createElement(
5206
- react.Select,
5207
- {
5208
- "data-attachable": true,
5209
- ...props,
5210
- rootProps: { __css: styles2.root },
5211
- ref
5212
- }
5213
- ), label && /* @__PURE__ */ React49__namespace.default.createElement(exports.FormLabel, null, label));
5214
- }
5215
- );
5216
- }
5217
- });
5218
5403
  exports.PasswordInput = void 0; var texts12;
5219
5404
  var init_PasswordInput = __esm({
5220
5405
  "src/input/PasswordInput.tsx"() {
@@ -11904,7 +12089,7 @@ var init_CountryCodeSelect = __esm({
11904
12089
  items: callingCodes,
11905
12090
  ...props
11906
12091
  },
11907
- (item) => /* @__PURE__ */ React49__namespace.default.createElement(reactStately.Item, { key: item.key }, item.key)
12092
+ (item) => /* @__PURE__ */ React49__namespace.default.createElement(exports.SelectItem, { key: item.key }, item.key)
11908
12093
  );
11909
12094
  };
11910
12095
  CountryCodeSelect_default = CountryCodeSelect;
@@ -11946,7 +12131,7 @@ var init_PhoneNumberInput = __esm({
11946
12131
  height: "100%",
11947
12132
  value: "+47"
11948
12133
  },
11949
- /* @__PURE__ */ React49__namespace.default.createElement(reactStately.Item, { key: "+47" }, "+47")
12134
+ /* @__PURE__ */ React49__namespace.default.createElement(exports.SelectItem, { key: "+47" }, "+47")
11950
12135
  )
11951
12136
  },
11952
12137
  /* @__PURE__ */ React49__namespace.default.createElement(
@@ -12157,11 +12342,12 @@ var init_Textarea = __esm({
12157
12342
  var init_input = __esm({
12158
12343
  "src/input/index.tsx"() {
12159
12344
  init_AttachedInputs();
12345
+ init_Autosuggest();
12160
12346
  init_CardSelect();
12161
12347
  init_Checkbox();
12162
12348
  init_CheckboxGroup();
12163
12349
  init_ChoiceChip();
12164
- init_NumericStepper();
12350
+ init_Combobox();
12165
12351
  init_FormControl();
12166
12352
  init_FormErrorMessage();
12167
12353
  init_FormLabel();
@@ -12170,6 +12356,7 @@ var init_input = __esm({
12170
12356
  init_InputElement();
12171
12357
  init_ListBox();
12172
12358
  init_NativeSelect();
12359
+ init_NumericStepper();
12173
12360
  init_PasswordInput();
12174
12361
  init_PhoneNumberInput();
12175
12362
  init_Radio();
@@ -21009,19 +21196,19 @@ var init_listbox = __esm({
21009
21196
  },
21010
21197
  _focus: {
21011
21198
  outline: "none",
21012
- background: themeTools.mode("mint", "darkTeal")(props)
21199
+ backgroundColor: themeTools.mode("mint", "darkTeal")(props)
21013
21200
  },
21014
21201
  _selected: {
21015
- background: themeTools.mode("pine", "pine")(props),
21202
+ backgroundColor: themeTools.mode("pine", "pine")(props),
21016
21203
  color: themeTools.mode("white", "white")(props)
21017
21204
  }
21018
21205
  },
21019
21206
  label: {},
21020
21207
  description: {
21021
21208
  fontSize: ["mobile.xs", "desktop.xs"],
21022
- color: "dimGrey",
21209
+ color: themeTools.mode("dimGrey", "silver")(props),
21023
21210
  "[aria-selected='true'] &": {
21024
- color: "lightGrey"
21211
+ color: themeTools.mode("lightGrey", "platinum")(props)
21025
21212
  }
21026
21213
  }
21027
21214
  })
@@ -23059,18 +23246,25 @@ Object.defineProperty(exports, 'Time', {
23059
23246
  enumerable: true,
23060
23247
  get: function () { return date.Time; }
23061
23248
  });
23062
- Object.defineProperty(exports, 'SelectItem', {
23249
+ Object.defineProperty(exports, 'Item', {
23063
23250
  enumerable: true,
23064
23251
  get: function () { return reactStately.Item; }
23065
23252
  });
23253
+ Object.defineProperty(exports, 'Section', {
23254
+ enumerable: true,
23255
+ get: function () { return reactStately.Section; }
23256
+ });
23066
23257
  exports.tokens = tokens10__namespace;
23258
+ exports.Autosuggest = Autosuggest;
23259
+ exports.Combobox = Combobox;
23067
23260
  exports.DatePicker = DatePicker;
23068
23261
  exports.DateRangePicker = DateRangePicker;
23069
23262
  exports.DrawerHeader = exports.ModalHeader;
23070
23263
  exports.InfoSelect = InfoSelect;
23264
+ exports.ItemDescription = ItemDescription;
23265
+ exports.ItemLabel = ItemLabel;
23071
23266
  exports.LanguageProvider = LanguageProvider;
23267
+ exports.ListBox = ListBox;
23072
23268
  exports.NumericStepper = NumericStepper;
23073
- exports.SelectItemDescription = SelectItemDescription;
23074
- exports.SelectItemLabel = SelectItemLabel;
23075
23269
  exports.createTexts = createTexts;
23076
23270
  exports.useTranslation = useTranslation;