@vygruppen/spor-react 2.3.3 → 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.
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,37 @@ var init_AttachedInputs = __esm({
3749
3750
  };
3750
3751
  }
3751
3752
  });
3753
+ function Autosuggest({
3754
+ label,
3755
+ fetcher,
3756
+ children,
3757
+ onSelectionChange
3758
+ }) {
3759
+ const list2 = reactStately.useAsyncList({
3760
+ async load({ filterText }) {
3761
+ return {
3762
+ items: await fetcher(filterText)
3763
+ };
3764
+ }
3765
+ });
3766
+ return /* @__PURE__ */ React49__namespace.default.createElement(
3767
+ Combobox,
3768
+ {
3769
+ label,
3770
+ items: list2.items,
3771
+ inputValue: list2.filterText,
3772
+ onInputChange: list2.setFilterText,
3773
+ isLoading: list2.isLoading,
3774
+ onSelectionChange
3775
+ },
3776
+ children
3777
+ );
3778
+ }
3779
+ var init_Autosuggest = __esm({
3780
+ "src/input/Autosuggest.tsx"() {
3781
+ init_src();
3782
+ }
3783
+ });
3752
3784
  var Dialog;
3753
3785
  var init_Dialog = __esm({
3754
3786
  "src/input/Dialog.tsx"() {
@@ -3762,38 +3794,41 @@ var init_Dialog = __esm({
3762
3794
  var Popover3;
3763
3795
  var init_Popover = __esm({
3764
3796
  "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 }),
3797
+ Popover3 = React49.forwardRef(
3798
+ ({
3793
3799
  children,
3794
- /* @__PURE__ */ React49__namespace.default.createElement(reactAria.DismissButton, { onDismiss: state2.close })
3795
- ));
3796
- };
3800
+ state: state2,
3801
+ triggerRef,
3802
+ offset = 0,
3803
+ crossOffset = 0,
3804
+ placement = "bottom"
3805
+ }, ref) => {
3806
+ var _a6;
3807
+ const internalRef = React49.useRef(null);
3808
+ const popoverRef = ref ?? internalRef;
3809
+ const { popoverProps, underlayProps } = reactAria.usePopover(
3810
+ {
3811
+ triggerRef,
3812
+ popoverRef,
3813
+ offset,
3814
+ crossOffset,
3815
+ placement
3816
+ },
3817
+ state2
3818
+ );
3819
+ 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(
3820
+ react.Box,
3821
+ {
3822
+ ...popoverProps,
3823
+ ref: popoverRef,
3824
+ minWidth: ((_a6 = triggerRef.current) == null ? void 0 : _a6.clientWidth) ?? "auto"
3825
+ },
3826
+ /* @__PURE__ */ React49__namespace.default.createElement(reactAria.DismissButton, { onDismiss: state2.close }),
3827
+ children,
3828
+ /* @__PURE__ */ React49__namespace.default.createElement(reactAria.DismissButton, { onDismiss: state2.close })
3829
+ ));
3830
+ }
3831
+ );
3797
3832
  }
3798
3833
  });
3799
3834
  function useForceRerender(shouldRerender) {
@@ -4697,6 +4732,384 @@ var init_ChoiceChip = __esm({
4697
4732
  });
4698
4733
  }
4699
4734
  });
4735
+ function Combobox({
4736
+ label,
4737
+ isLoading,
4738
+ ...rest
4739
+ }) {
4740
+ const { contains: contains2 } = reactAria.useFilter({ sensitivity: "base" });
4741
+ const state2 = reactStately.useComboBoxState({
4742
+ ...rest,
4743
+ defaultFilter: contains2
4744
+ });
4745
+ const inputRef = React49.useRef(null);
4746
+ const listBoxRef = React49.useRef(null);
4747
+ const popoverRef = React49.useRef(null);
4748
+ const {
4749
+ inputProps: { size: size2, ...inputProps },
4750
+ listBoxProps
4751
+ } = reactAria.useComboBox(
4752
+ {
4753
+ ...rest,
4754
+ inputRef,
4755
+ listBoxRef,
4756
+ popoverRef
4757
+ },
4758
+ state2
4759
+ );
4760
+ return /* @__PURE__ */ React49__namespace.default.createElement(exports.FormControl, null, /* @__PURE__ */ React49__namespace.default.createElement(
4761
+ exports.Input,
4762
+ {
4763
+ ...inputProps,
4764
+ ref: inputRef,
4765
+ label,
4766
+ borderBottomRadius: state2.isOpen ? 0 : "sm",
4767
+ rightIcon: isLoading ? /* @__PURE__ */ React49__namespace.default.createElement(
4768
+ exports.ColorSpinner,
4769
+ {
4770
+ width: "1.5rem",
4771
+ alignSelf: "center",
4772
+ css: {
4773
+ div: {
4774
+ display: "flex",
4775
+ alignItems: "center"
4776
+ }
4777
+ }
4778
+ }
4779
+ ) : void 0
4780
+ }
4781
+ ), state2.isOpen && /* @__PURE__ */ React49__namespace.default.createElement(
4782
+ Popover3,
4783
+ {
4784
+ state: state2,
4785
+ triggerRef: inputRef,
4786
+ ref: popoverRef,
4787
+ placement: "bottom start"
4788
+ },
4789
+ /* @__PURE__ */ React49__namespace.default.createElement(
4790
+ ListBox,
4791
+ {
4792
+ ...listBoxProps,
4793
+ state: state2,
4794
+ listBoxRef,
4795
+ borderBottomRadius: "sm"
4796
+ },
4797
+ rest.children
4798
+ )
4799
+ ));
4800
+ }
4801
+ var init_Combobox = __esm({
4802
+ "src/input/Combobox.tsx"() {
4803
+ init_src();
4804
+ init_Popover();
4805
+ }
4806
+ });
4807
+ exports.FormControl = void 0;
4808
+ var init_FormControl = __esm({
4809
+ "src/input/FormControl.tsx"() {
4810
+ exports.FormControl = react.forwardRef((props, ref) => {
4811
+ return /* @__PURE__ */ React49__namespace.default.createElement(react.FormControl, { ...props, ref });
4812
+ });
4813
+ }
4814
+ });
4815
+ exports.FormErrorMessage = void 0; var Arrow;
4816
+ var init_FormErrorMessage = __esm({
4817
+ "src/input/FormErrorMessage.tsx"() {
4818
+ exports.FormErrorMessage = ({
4819
+ children,
4820
+ ...boxProps
4821
+ }) => {
4822
+ const formControlContext = react.useFormControlContext();
4823
+ if (!formControlContext) {
4824
+ throw new Error(
4825
+ "FormErrorMessage must be used within a FormControl component"
4826
+ );
4827
+ }
4828
+ if (!formControlContext.isInvalid) {
4829
+ return null;
4830
+ }
4831
+ const { ref, ...errorMessageProps } = formControlContext.getErrorMessageProps();
4832
+ return /* @__PURE__ */ React49__namespace.default.createElement(react.Box, { position: "relative", ref }, /* @__PURE__ */ React49__namespace.default.createElement(
4833
+ react.Box,
4834
+ {
4835
+ borderRadius: "xs",
4836
+ backgroundColor: "lightRed",
4837
+ color: "darkGrey",
4838
+ paddingX: 1.5,
4839
+ paddingY: 1,
4840
+ textStyle: "xs",
4841
+ width: "fit-content",
4842
+ position: "absolute",
4843
+ top: -0.5,
4844
+ left: 3,
4845
+ zIndex: "popover",
4846
+ maxWidth: "50ch",
4847
+ ...errorMessageProps,
4848
+ ...boxProps
4849
+ },
4850
+ /* @__PURE__ */ React49__namespace.default.createElement(Arrow, { position: "absolute", top: "-0.25em", left: "1em" }),
4851
+ children
4852
+ ));
4853
+ };
4854
+ Arrow = (props) => {
4855
+ return /* @__PURE__ */ React49__namespace.default.createElement(
4856
+ react.Box,
4857
+ {
4858
+ ...props,
4859
+ as: "svg",
4860
+ width: "16",
4861
+ height: "16",
4862
+ viewBox: "0 0 16 16",
4863
+ fill: "none",
4864
+ transform: "rotate(45deg)"
4865
+ },
4866
+ /* @__PURE__ */ React49__namespace.default.createElement(
4867
+ react.Box,
4868
+ {
4869
+ as: "path",
4870
+ fill: "lightRed",
4871
+ 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"
4872
+ }
4873
+ )
4874
+ );
4875
+ };
4876
+ }
4877
+ });
4878
+ exports.FormLabel = void 0;
4879
+ var init_FormLabel = __esm({
4880
+ "src/input/FormLabel.tsx"() {
4881
+ exports.FormLabel = react.forwardRef((props, ref) => {
4882
+ return /* @__PURE__ */ React49__namespace.default.createElement(react.FormLabel, { ...props, ref });
4883
+ });
4884
+ }
4885
+ });
4886
+ function ListBox({
4887
+ isLoading,
4888
+ listBoxRef,
4889
+ state: state2,
4890
+ ...props
4891
+ }) {
4892
+ const { listBoxProps } = reactAria.useListBox(props, state2, listBoxRef);
4893
+ const styles2 = react.useMultiStyleConfig("ListBox", {});
4894
+ return /* @__PURE__ */ React49__namespace.default.createElement(
4895
+ react.List,
4896
+ {
4897
+ ...listBoxProps,
4898
+ ref: listBoxRef,
4899
+ sx: styles2.container,
4900
+ "aria-busy": isLoading
4901
+ },
4902
+ [...state2.collection].map(
4903
+ (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 })
4904
+ )
4905
+ );
4906
+ }
4907
+ function ItemLabel({ children }) {
4908
+ let { labelProps } = useOptionContext();
4909
+ const styles2 = react.useMultiStyleConfig("ListBox", {});
4910
+ return /* @__PURE__ */ React49__namespace.default.createElement(react.Box, { ...labelProps, sx: styles2.label }, children);
4911
+ }
4912
+ function ItemDescription({ children }) {
4913
+ let { descriptionProps } = useOptionContext();
4914
+ const styles2 = react.useMultiStyleConfig("ListBox", {});
4915
+ return /* @__PURE__ */ React49__namespace.default.createElement(react.Box, { ...descriptionProps, sx: styles2.description }, children);
4916
+ }
4917
+ function Option({ item, state: state2 }) {
4918
+ const ref = React49.useRef(null);
4919
+ const {
4920
+ optionProps,
4921
+ isSelected,
4922
+ isDisabled,
4923
+ isFocused,
4924
+ labelProps,
4925
+ descriptionProps
4926
+ } = reactAria.useOption({ key: item.key }, state2, ref);
4927
+ const styles2 = react.useMultiStyleConfig("ListBox", {});
4928
+ let dataFields = {};
4929
+ if (isSelected) {
4930
+ dataFields["data-selected"] = true;
4931
+ }
4932
+ if (isDisabled) {
4933
+ dataFields["data-disabled"] = true;
4934
+ }
4935
+ if (isFocused) {
4936
+ dataFields["data-focus"] = true;
4937
+ }
4938
+ 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));
4939
+ }
4940
+ function ListBoxSection({ section, state: state2 }) {
4941
+ const { itemProps, headingProps, groupProps } = reactAria.useListBoxSection({
4942
+ heading: section.rendered,
4943
+ "aria-label": section["aria-label"]
4944
+ });
4945
+ const isFirstSection = section.key !== state2.collection.getFirstKey();
4946
+ const titleBackgroundColor = react.useColorModeValue("platinum", "dimGrey");
4947
+ const titleColor = react.useColorModeValue("darkGrey", "white");
4948
+ return /* @__PURE__ */ React49__namespace.default.createElement(react.ListItem, { ...itemProps }, section.rendered && /* @__PURE__ */ React49__namespace.default.createElement(
4949
+ react.Box,
4950
+ {
4951
+ textStyle: "xs",
4952
+ backgroundColor: titleBackgroundColor,
4953
+ color: titleColor,
4954
+ paddingX: 3,
4955
+ paddingY: 1,
4956
+ marginTop: isFirstSection ? 0 : 0,
4957
+ ...headingProps
4958
+ },
4959
+ section.rendered
4960
+ ), /* @__PURE__ */ React49__namespace.default.createElement(react.List, { ...groupProps, padding: 0, listStyleType: "none" }, [...state2.collection.getChildren(section.key)].map((item) => /* @__PURE__ */ React49__namespace.default.createElement(Option, { key: item.key, item, state: state2 }))));
4961
+ }
4962
+ exports.SelectItem = void 0; exports.SelectItemLabel = void 0; exports.SelectItemDescription = void 0; var OptionContext, useOptionContext;
4963
+ var init_ListBox = __esm({
4964
+ "src/input/ListBox.tsx"() {
4965
+ exports.SelectItem = reactStately.Item;
4966
+ exports.SelectItemLabel = ItemLabel;
4967
+ exports.SelectItemDescription = ItemDescription;
4968
+ OptionContext = React49__namespace.default.createContext({
4969
+ labelProps: {},
4970
+ descriptionProps: {}
4971
+ });
4972
+ useOptionContext = () => {
4973
+ return React49.useContext(OptionContext);
4974
+ };
4975
+ }
4976
+ });
4977
+ function InfoSelect({
4978
+ placeholder,
4979
+ width = "100%",
4980
+ height = "auto",
4981
+ onChange,
4982
+ value,
4983
+ isLabelSrOnly,
4984
+ defaultValue,
4985
+ ...props
4986
+ }) {
4987
+ const renamedProps = {
4988
+ onSelectionChange: onChange,
4989
+ selectedKey: value,
4990
+ defaultSelectedKey: defaultValue,
4991
+ ...props
4992
+ };
4993
+ const state2 = reactStately.useSelectState(renamedProps);
4994
+ const triggerRef = React49.useRef(null);
4995
+ const listboxRef = React49.useRef(null);
4996
+ const { labelProps, triggerProps, valueProps, menuProps } = reactAria.useSelect(
4997
+ renamedProps,
4998
+ state2,
4999
+ triggerRef
5000
+ );
5001
+ const styles2 = react.useMultiStyleConfig("InfoSelect", {
5002
+ isOpen: state2.isOpen,
5003
+ isLabelSrOnly
5004
+ });
5005
+ const { buttonProps } = reactAria.useButton(triggerProps, triggerRef);
5006
+ const { t: t2 } = useTranslation();
5007
+ const formControl = react.useFormControlProps(props);
5008
+ 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(
5009
+ reactAria.HiddenSelect,
5010
+ {
5011
+ state: state2,
5012
+ triggerRef,
5013
+ label: props.label,
5014
+ name: props.name
5015
+ }
5016
+ ), /* @__PURE__ */ React49__namespace.default.createElement(
5017
+ react.chakra.button,
5018
+ {
5019
+ type: "button",
5020
+ ref: triggerRef,
5021
+ sx: styles2.button,
5022
+ ...buttonProps,
5023
+ width,
5024
+ height,
5025
+ "data-attachable": true,
5026
+ "aria-invalid": formControl.isInvalid,
5027
+ "aria-describedby": formControl["aria-describedby"]
5028
+ },
5029
+ /* @__PURE__ */ React49__namespace.default.createElement(react.Box, { ...valueProps }, state2.selectedItem ? state2.selectedItem.textValue ?? state2.selectedItem.rendered : placeholder ?? t2(texts10.selectAnOption)),
5030
+ /* @__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))
5031
+ ), state2.isOpen && /* @__PURE__ */ React49__namespace.default.createElement(Popover3, { state: state2, triggerRef }, /* @__PURE__ */ React49__namespace.default.createElement(
5032
+ ListBox,
5033
+ {
5034
+ ...menuProps,
5035
+ state: state2,
5036
+ listBoxRef: listboxRef,
5037
+ borderBottomRadius: "sm"
5038
+ },
5039
+ props.children
5040
+ )));
5041
+ }
5042
+ var texts10;
5043
+ var init_InfoSelect = __esm({
5044
+ "src/input/InfoSelect.tsx"() {
5045
+ init_src();
5046
+ init_ListBox();
5047
+ init_Popover();
5048
+ texts10 = createTexts({
5049
+ selectAnOption: {
5050
+ nb: "Velg et alternativ",
5051
+ nn: "Velg eit alternativ",
5052
+ sv: "V\xE4lj ett alternativ",
5053
+ en: "Choose an option"
5054
+ }
5055
+ });
5056
+ }
5057
+ });
5058
+ exports.Input = void 0;
5059
+ var init_Input = __esm({
5060
+ "src/input/Input.tsx"() {
5061
+ exports.Input = react.forwardRef(
5062
+ ({ label, leftIcon, rightIcon, id, ...props }, ref) => {
5063
+ const formControlProps = react.useFormControlContext();
5064
+ const fallbackId = `input-${React49.useId()}`;
5065
+ const inputId = id ?? (formControlProps == null ? void 0 : formControlProps.id) ?? fallbackId;
5066
+ 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(
5067
+ react.Input,
5068
+ {
5069
+ "data-attachable": true,
5070
+ paddingLeft: leftIcon ? 7 : void 0,
5071
+ paddingRight: rightIcon ? 7 : void 0,
5072
+ ...props,
5073
+ id: inputId,
5074
+ ref,
5075
+ placeholder: " "
5076
+ }
5077
+ ), /* @__PURE__ */ React49__namespace.default.createElement(react.FormLabel, { htmlFor: inputId, pointerEvents: "none" }, label), rightIcon && /* @__PURE__ */ React49__namespace.default.createElement(react.InputRightElement, null, rightIcon));
5078
+ }
5079
+ );
5080
+ }
5081
+ });
5082
+ exports.InputLeftElement = void 0; exports.InputRightElement = void 0;
5083
+ var init_InputElement = __esm({
5084
+ "src/input/InputElement.tsx"() {
5085
+ exports.InputLeftElement = react.forwardRef(
5086
+ (props, ref) => /* @__PURE__ */ React49__namespace.default.createElement(react.InputLeftElement, { ...props, ref })
5087
+ );
5088
+ exports.InputRightElement = react.forwardRef(
5089
+ (props, ref) => /* @__PURE__ */ React49__namespace.default.createElement(react.InputRightElement, { ...props, ref })
5090
+ );
5091
+ }
5092
+ });
5093
+ exports.NativeSelect = void 0;
5094
+ var init_NativeSelect = __esm({
5095
+ "src/input/NativeSelect.tsx"() {
5096
+ init_input();
5097
+ exports.NativeSelect = react.forwardRef(
5098
+ ({ label, ...props }, ref) => {
5099
+ const styles2 = react.useMultiStyleConfig("Select", props);
5100
+ return /* @__PURE__ */ React49__namespace.default.createElement(exports.FormControl, null, /* @__PURE__ */ React49__namespace.default.createElement(
5101
+ react.Select,
5102
+ {
5103
+ "data-attachable": true,
5104
+ ...props,
5105
+ rootProps: { __css: styles2.root },
5106
+ ref
5107
+ }
5108
+ ), label && /* @__PURE__ */ React49__namespace.default.createElement(exports.FormLabel, null, label));
5109
+ }
5110
+ );
5111
+ }
5112
+ });
4700
5113
  var colors;
4701
5114
  var init_colors = __esm({
4702
5115
  "src/theme/foundations/colors.ts"() {
@@ -4791,7 +5204,7 @@ function NumericStepper({
4791
5204
  VerySmallButton,
4792
5205
  {
4793
5206
  icon: /* @__PURE__ */ React49__namespace.default.createElement(SubtractIcon, { color: "white" }),
4794
- "aria-label": t2(texts10.decrementButtonAriaLabel),
5207
+ "aria-label": t2(texts11.decrementButtonAriaLabel),
4795
5208
  onClick: () => onChange(value - 1),
4796
5209
  visibility: value <= minValue ? "hidden" : "visible",
4797
5210
  isDisabled: formControlProps.disabled
@@ -4849,14 +5262,14 @@ function NumericStepper({
4849
5262
  VerySmallButton,
4850
5263
  {
4851
5264
  icon: /* @__PURE__ */ React49__namespace.default.createElement(AddIcon, { color: "white" }),
4852
- "aria-label": t2(texts10.incrementButtonAriaLabel),
5265
+ "aria-label": t2(texts11.incrementButtonAriaLabel),
4853
5266
  onClick: () => onChange(value + 1),
4854
5267
  visibility: value >= maxValue ? "hidden" : "visible",
4855
5268
  isDisabled: formControlProps.disabled
4856
5269
  }
4857
5270
  ));
4858
5271
  }
4859
- var VerySmallButton, SubtractIcon, AddIcon, texts10;
5272
+ var VerySmallButton, SubtractIcon, AddIcon, texts11;
4860
5273
  var init_NumericStepper = __esm({
4861
5274
  "src/input/NumericStepper.tsx"() {
4862
5275
  init_src();
@@ -4935,7 +5348,7 @@ var init_NumericStepper = __esm({
4935
5348
  }
4936
5349
  )
4937
5350
  );
4938
- texts10 = createTexts({
5351
+ texts11 = createTexts({
4939
5352
  decrementButtonAriaLabel: {
4940
5353
  nb: "Trekk fra 1",
4941
5354
  en: "Subtract 1",
@@ -4951,270 +5364,6 @@ var init_NumericStepper = __esm({
4951
5364
  });
4952
5365
  }
4953
5366
  });
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
5367
  exports.PasswordInput = void 0; var texts12;
5219
5368
  var init_PasswordInput = __esm({
5220
5369
  "src/input/PasswordInput.tsx"() {
@@ -11904,7 +12053,7 @@ var init_CountryCodeSelect = __esm({
11904
12053
  items: callingCodes,
11905
12054
  ...props
11906
12055
  },
11907
- (item) => /* @__PURE__ */ React49__namespace.default.createElement(reactStately.Item, { key: item.key }, item.key)
12056
+ (item) => /* @__PURE__ */ React49__namespace.default.createElement(exports.SelectItem, { key: item.key }, item.key)
11908
12057
  );
11909
12058
  };
11910
12059
  CountryCodeSelect_default = CountryCodeSelect;
@@ -11946,7 +12095,7 @@ var init_PhoneNumberInput = __esm({
11946
12095
  height: "100%",
11947
12096
  value: "+47"
11948
12097
  },
11949
- /* @__PURE__ */ React49__namespace.default.createElement(reactStately.Item, { key: "+47" }, "+47")
12098
+ /* @__PURE__ */ React49__namespace.default.createElement(exports.SelectItem, { key: "+47" }, "+47")
11950
12099
  )
11951
12100
  },
11952
12101
  /* @__PURE__ */ React49__namespace.default.createElement(
@@ -12157,11 +12306,12 @@ var init_Textarea = __esm({
12157
12306
  var init_input = __esm({
12158
12307
  "src/input/index.tsx"() {
12159
12308
  init_AttachedInputs();
12309
+ init_Autosuggest();
12160
12310
  init_CardSelect();
12161
12311
  init_Checkbox();
12162
12312
  init_CheckboxGroup();
12163
12313
  init_ChoiceChip();
12164
- init_NumericStepper();
12314
+ init_Combobox();
12165
12315
  init_FormControl();
12166
12316
  init_FormErrorMessage();
12167
12317
  init_FormLabel();
@@ -12170,6 +12320,7 @@ var init_input = __esm({
12170
12320
  init_InputElement();
12171
12321
  init_ListBox();
12172
12322
  init_NativeSelect();
12323
+ init_NumericStepper();
12173
12324
  init_PasswordInput();
12174
12325
  init_PhoneNumberInput();
12175
12326
  init_Radio();
@@ -21009,19 +21160,19 @@ var init_listbox = __esm({
21009
21160
  },
21010
21161
  _focus: {
21011
21162
  outline: "none",
21012
- background: themeTools.mode("mint", "darkTeal")(props)
21163
+ backgroundColor: themeTools.mode("mint", "darkTeal")(props)
21013
21164
  },
21014
21165
  _selected: {
21015
- background: themeTools.mode("pine", "pine")(props),
21166
+ backgroundColor: themeTools.mode("pine", "pine")(props),
21016
21167
  color: themeTools.mode("white", "white")(props)
21017
21168
  }
21018
21169
  },
21019
21170
  label: {},
21020
21171
  description: {
21021
21172
  fontSize: ["mobile.xs", "desktop.xs"],
21022
- color: "dimGrey",
21173
+ color: themeTools.mode("dimGrey", "silver")(props),
21023
21174
  "[aria-selected='true'] &": {
21024
- color: "lightGrey"
21175
+ color: themeTools.mode("lightGrey", "platinum")(props)
21025
21176
  }
21026
21177
  }
21027
21178
  })
@@ -23059,18 +23210,25 @@ Object.defineProperty(exports, 'Time', {
23059
23210
  enumerable: true,
23060
23211
  get: function () { return date.Time; }
23061
23212
  });
23062
- Object.defineProperty(exports, 'SelectItem', {
23213
+ Object.defineProperty(exports, 'Item', {
23063
23214
  enumerable: true,
23064
23215
  get: function () { return reactStately.Item; }
23065
23216
  });
23217
+ Object.defineProperty(exports, 'Section', {
23218
+ enumerable: true,
23219
+ get: function () { return reactStately.Section; }
23220
+ });
23066
23221
  exports.tokens = tokens10__namespace;
23222
+ exports.Autosuggest = Autosuggest;
23223
+ exports.Combobox = Combobox;
23067
23224
  exports.DatePicker = DatePicker;
23068
23225
  exports.DateRangePicker = DateRangePicker;
23069
23226
  exports.DrawerHeader = exports.ModalHeader;
23070
23227
  exports.InfoSelect = InfoSelect;
23228
+ exports.ItemDescription = ItemDescription;
23229
+ exports.ItemLabel = ItemLabel;
23071
23230
  exports.LanguageProvider = LanguageProvider;
23231
+ exports.ListBox = ListBox;
23072
23232
  exports.NumericStepper = NumericStepper;
23073
- exports.SelectItemDescription = SelectItemDescription;
23074
- exports.SelectItemLabel = SelectItemLabel;
23075
23233
  exports.createTexts = createTexts;
23076
23234
  exports.useTranslation = useTranslation;