@norges-domstoler/dds-components 18.1.0 → 18.3.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
@@ -29,8 +29,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
29
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
30
 
31
31
  // src/index.ts
32
- var src_exports = {};
33
- __export(src_exports, {
32
+ var index_exports = {};
33
+ __export(index_exports, {
34
34
  Accordion: () => Accordion,
35
35
  AccordionBody: () => AccordionBody,
36
36
  AccordionHeader: () => AccordionHeader,
@@ -301,6 +301,7 @@ __export(src_exports, {
301
301
  TimePicker: () => TimePicker,
302
302
  TingrettIcon: () => TingrettIcon,
303
303
  TipIcon: () => TipIcon,
304
+ Toggle: () => Toggle,
304
305
  ToggleBar: () => ToggleBar,
305
306
  ToggleButton: () => ToggleButton,
306
307
  ToggleButtonGroup: () => ToggleButtonGroup,
@@ -378,7 +379,7 @@ __export(src_exports, {
378
379
  useTheme: () => useTheme,
379
380
  visibilityTransition: () => visibilityTransition
380
381
  });
381
- module.exports = __toCommonJS(src_exports);
382
+ module.exports = __toCommonJS(index_exports);
382
383
 
383
384
  // src/components/Typography/typographyStyles.module.css
384
385
  var typographyStyles_default = {
@@ -470,6 +471,8 @@ var import_react2 = require("react");
470
471
  // src/components/helpers/Backdrop/Backdrop.module.css
471
472
  var Backdrop_default = {
472
473
  backdrop: "Backdrop_backdrop",
474
+ drawer: "Backdrop_drawer",
475
+ modal: "Backdrop_modal",
473
476
  "backdrop--visible": "Backdrop_backdrop--visible",
474
477
  "backdrop--hidden": "Backdrop_backdrop--hidden"
475
478
  };
@@ -662,13 +665,17 @@ function useElementHeight(element) {
662
665
  // src/components/helpers/Backdrop/Backdrop.tsx
663
666
  var import_jsx_runtime2 = require("react/jsx-runtime");
664
667
  var Backdrop = (0, import_react2.forwardRef)(
665
- ({ isMounted, ...props }, ref) => {
668
+ ({ isMounted, zIndex, ...props }, ref) => {
666
669
  const isMountedCn = isMounted ? "visible" : "hidden";
667
670
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
668
671
  "div",
669
672
  {
670
673
  ref,
671
- className: cn(Backdrop_default.backdrop, Backdrop_default[`backdrop--${isMountedCn}`]),
674
+ className: cn(
675
+ Backdrop_default.backdrop,
676
+ Backdrop_default[zIndex],
677
+ Backdrop_default[`backdrop--${isMountedCn}`]
678
+ ),
672
679
  ...props
673
680
  }
674
681
  );
@@ -2928,7 +2935,7 @@ function useReturnFocusOnBlur(active, onBlur, triggerElement) {
2928
2935
  // src/hooks/useRoveFocus.tsx
2929
2936
  var import_react22 = require("react");
2930
2937
  var isKeyboardEvent = (e) => e.key !== void 0;
2931
- function useRoveFocus(size2, active, direction = "column") {
2938
+ function useRoveFocus(size2, active, direction = "column", noWrap) {
2932
2939
  const [currentFocusIndex, setCurrentFocusIndex] = (0, import_react22.useState)(-1);
2933
2940
  const nextKey = direction === "row" ? "ArrowRight" : "ArrowDown";
2934
2941
  const previousKey = direction === "row" ? "ArrowLeft" : "ArrowUp";
@@ -2937,16 +2944,19 @@ function useRoveFocus(size2, active, direction = "column") {
2937
2944
  if (!size2 || !isKeyboardEvent(e)) return;
2938
2945
  if (e.key === nextKey) {
2939
2946
  e.preventDefault();
2940
- setCurrentFocusIndex((prev) => prev === size2 - 1 ? 0 : prev + 1);
2947
+ setCurrentFocusIndex((prev) => {
2948
+ if (prev === size2 - 1) return noWrap ? prev : 0;
2949
+ return prev + 1;
2950
+ });
2941
2951
  } else if (e.key === previousKey) {
2942
2952
  e.preventDefault();
2943
2953
  setCurrentFocusIndex((prev) => {
2944
- if (prev === -1 || prev === 0) return size2 - 1;
2954
+ if (prev === -1 || prev === 0) return noWrap ? prev : size2 - 1;
2945
2955
  return prev - 1;
2946
2956
  });
2947
2957
  }
2948
2958
  },
2949
- [size2, setCurrentFocusIndex]
2959
+ [size2, setCurrentFocusIndex, direction, noWrap]
2950
2960
  );
2951
2961
  (0, import_react22.useEffect)(() => {
2952
2962
  if (!active) {
@@ -3705,6 +3715,8 @@ var OverflowMenu_default = {
3705
3715
  container: "OverflowMenu_container",
3706
3716
  list: "OverflowMenu_list",
3707
3717
  list__item: "OverflowMenu_list__item",
3718
+ default: "OverflowMenu_default",
3719
+ danger: "OverflowMenu_danger",
3708
3720
  "list__item--link": "OverflowMenu_list__item--link",
3709
3721
  icon: "OverflowMenu_icon",
3710
3722
  divider: "OverflowMenu_divider",
@@ -3801,7 +3813,15 @@ OverflowMenu.displayName = "OverflowMenu";
3801
3813
  var import_react35 = require("react");
3802
3814
  var import_jsx_runtime187 = require("react/jsx-runtime");
3803
3815
  var OverflowMenuButton = (0, import_react35.forwardRef)((props, ref) => {
3804
- const { id, icon, children, className, onClick, ...rest } = props;
3816
+ const {
3817
+ id,
3818
+ icon,
3819
+ children,
3820
+ className,
3821
+ onClick,
3822
+ purpose = "default",
3823
+ ...rest
3824
+ } = props;
3805
3825
  const itemRef = (0, import_react35.useRef)(null);
3806
3826
  const combinedRef = useCombinedRef(ref, itemRef);
3807
3827
  const { onToggle, onClose, registerItem, unregisterItem, focusedRef } = useOverflowMenu();
@@ -3818,6 +3838,7 @@ var OverflowMenuButton = (0, import_react35.forwardRef)((props, ref) => {
3818
3838
  className: cn(
3819
3839
  className,
3820
3840
  OverflowMenu_default.list__item,
3841
+ OverflowMenu_default[purpose],
3821
3842
  typographyStyles_default["body-small"],
3822
3843
  OverflowMenu_default["list__item--link"],
3823
3844
  focus_default["focusable--inset"]
@@ -3842,7 +3863,16 @@ OverflowMenuButton.displayName = "OverflowMenuButton";
3842
3863
  var import_react36 = require("react");
3843
3864
  var import_jsx_runtime188 = require("react/jsx-runtime");
3844
3865
  var OverflowMenuLink = (0, import_react36.forwardRef)((props, ref) => {
3845
- const { id, href, icon, className, onClick, children, ...rest } = props;
3866
+ const {
3867
+ id,
3868
+ href,
3869
+ icon,
3870
+ className,
3871
+ onClick,
3872
+ children,
3873
+ purpose = "default",
3874
+ ...rest
3875
+ } = props;
3846
3876
  const itemRef = (0, import_react36.useRef)(null);
3847
3877
  const combinedRef = useCombinedRef(ref, itemRef);
3848
3878
  const { onToggle, onClose, registerItem, unregisterItem, focusedRef } = useOverflowMenu();
@@ -3859,6 +3889,7 @@ var OverflowMenuLink = (0, import_react36.forwardRef)((props, ref) => {
3859
3889
  className: cn(
3860
3890
  className,
3861
3891
  OverflowMenu_default.list__item,
3892
+ OverflowMenu_default[purpose],
3862
3893
  typographyStyles_default["body-small"],
3863
3894
  OverflowMenu_default["list__item--link"],
3864
3895
  focus_default["focusable--inset"]
@@ -3946,7 +3977,7 @@ var OverflowMenuList = (0, import_react39.forwardRef)((props, ref) => {
3946
3977
  var import_react40 = require("react");
3947
3978
  var import_jsx_runtime192 = require("react/jsx-runtime");
3948
3979
  var OverflowMenuSpan = (0, import_react40.forwardRef)((props, ref) => {
3949
- const { icon, children, className, ...rest } = props;
3980
+ const { icon, children, className, purpose = "default", ...rest } = props;
3950
3981
  return /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)(
3951
3982
  "span",
3952
3983
  {
@@ -3954,6 +3985,7 @@ var OverflowMenuSpan = (0, import_react40.forwardRef)((props, ref) => {
3954
3985
  className: cn(
3955
3986
  className,
3956
3987
  OverflowMenu_default.list__item,
3988
+ OverflowMenu_default[purpose],
3957
3989
  typographyStyles_default["body-small"]
3958
3990
  ),
3959
3991
  ...rest,
@@ -5669,7 +5701,16 @@ var Drawer = (0, import_react72.forwardRef)((props, ref) => {
5669
5701
  ]
5670
5702
  }
5671
5703
  );
5672
- const component = withBackdrop ? /* @__PURE__ */ (0, import_jsx_runtime225.jsx)(Backdrop, { isMounted, ref: backdropRef, onClick: onBackdropClick, children: drawer }) : drawer;
5704
+ const component = withBackdrop ? /* @__PURE__ */ (0, import_jsx_runtime225.jsx)(
5705
+ Backdrop,
5706
+ {
5707
+ zIndex: "drawer",
5708
+ isMounted,
5709
+ ref: backdropRef,
5710
+ onClick: onBackdropClick,
5711
+ children: drawer
5712
+ }
5713
+ ) : drawer;
5673
5714
  return (isOpen || hasTransitionedIn) && portalTarget ? (0, import_react_dom2.createPortal)(component, portalTarget) : null;
5674
5715
  });
5675
5716
  Drawer.displayName = "Drawer";
@@ -6277,59 +6318,63 @@ var Tooltip = (0, import_react79.forwardRef)(
6277
6318
  "aria-describedby": uniqueTooltipId
6278
6319
  })
6279
6320
  );
6280
- const containerProps = {
6281
- ...getBaseHTMLProps(id, cn(className, Tooltip_default.container), htmlProps, rest),
6282
- style,
6283
- onMouseLeave: combineHandlers(closeTooltip, onMouseLeave),
6284
- onMouseOver: combineHandlers(openTooltip, onMouseOver)
6285
- };
6286
- const wrapperProps = {
6287
- id: uniqueTooltipId,
6288
- ref: combinedRef,
6289
- role: "tooltip",
6290
- "aria-hidden": !open,
6291
- open: open && inView,
6292
- style: { ...positionStyles.floating }
6293
- };
6294
6321
  const openCn = open && inView ? "open" : "closed";
6295
- return /* @__PURE__ */ (0, import_jsx_runtime233.jsxs)("div", { ...containerProps, children: [
6296
- anchorElement,
6297
- /* @__PURE__ */ (0, import_jsx_runtime233.jsxs)(
6298
- Paper,
6299
- {
6300
- ...wrapperProps,
6301
- elevation: 1,
6302
- border: "subtle",
6303
- className: cn(
6304
- Tooltip_default.paper,
6305
- typographyStyles_default["body-medium"],
6306
- utilStyles_default["visibility-transition"],
6307
- utilStyles_default[`visibility-transition--${openCn}`]
6308
- ),
6309
- children: [
6310
- text,
6311
- /* @__PURE__ */ (0, import_jsx_runtime233.jsx)("div", { ref: setArrowElement, style: positionStyles.arrow, children: /* @__PURE__ */ (0, import_jsx_runtime233.jsxs)("svg", { width: "36", height: "9", children: [
6312
- /* @__PURE__ */ (0, import_jsx_runtime233.jsx)(
6313
- "path",
6314
- {
6315
- d: "M16.586 6.586L10 0h16.154a.373.373 0 00-.263.11l-6.477 6.476a2 2 0 01-2.828 0z",
6316
- className: Tooltip_default["svg-arrow__background"]
6317
- }
6322
+ return /* @__PURE__ */ (0, import_jsx_runtime233.jsxs)(
6323
+ "div",
6324
+ {
6325
+ ...getBaseHTMLProps(
6326
+ id,
6327
+ cn(className, Tooltip_default.container),
6328
+ htmlProps,
6329
+ rest
6330
+ ),
6331
+ style,
6332
+ onMouseLeave: combineHandlers(closeTooltip, onMouseLeave),
6333
+ onMouseOver: combineHandlers(openTooltip, onMouseOver),
6334
+ children: [
6335
+ anchorElement,
6336
+ /* @__PURE__ */ (0, import_jsx_runtime233.jsxs)(
6337
+ Paper,
6338
+ {
6339
+ id: uniqueTooltipId,
6340
+ ref: combinedRef,
6341
+ role: "tooltip",
6342
+ "aria-hidden": !open,
6343
+ style: { ...positionStyles.floating },
6344
+ elevation: 1,
6345
+ border: "subtle",
6346
+ className: cn(
6347
+ Tooltip_default.paper,
6348
+ typographyStyles_default["body-medium"],
6349
+ utilStyles_default["visibility-transition"],
6350
+ utilStyles_default[`visibility-transition--${openCn}`]
6318
6351
  ),
6319
- /* @__PURE__ */ (0, import_jsx_runtime233.jsx)(
6320
- "path",
6321
- {
6322
- fillRule: "evenodd",
6323
- clipRule: "evenodd",
6324
- d: "M26.5.5l-6.732 6.94a2.5 2.5 0 01-3.536 0L9.5.5H11l5.94 6.232a1.5 1.5 0 002.12 0L25 .5h1.5z",
6325
- className: Tooltip_default["svg-arrow__border"]
6326
- }
6327
- )
6328
- ] }) })
6329
- ]
6330
- }
6331
- )
6332
- ] });
6352
+ children: [
6353
+ text,
6354
+ /* @__PURE__ */ (0, import_jsx_runtime233.jsx)("div", { ref: setArrowElement, style: positionStyles.arrow, children: /* @__PURE__ */ (0, import_jsx_runtime233.jsxs)("svg", { width: "36", height: "9", children: [
6355
+ /* @__PURE__ */ (0, import_jsx_runtime233.jsx)(
6356
+ "path",
6357
+ {
6358
+ d: "M16.586 6.586L10 0h16.154a.373.373 0 00-.263.11l-6.477 6.476a2 2 0 01-2.828 0z",
6359
+ className: Tooltip_default["svg-arrow__background"]
6360
+ }
6361
+ ),
6362
+ /* @__PURE__ */ (0, import_jsx_runtime233.jsx)(
6363
+ "path",
6364
+ {
6365
+ fillRule: "evenodd",
6366
+ clipRule: "evenodd",
6367
+ d: "M26.5.5l-6.732 6.94a2.5 2.5 0 01-3.536 0L9.5.5H11l5.94 6.232a1.5 1.5 0 002.12 0L25 .5h1.5z",
6368
+ className: Tooltip_default["svg-arrow__border"]
6369
+ }
6370
+ )
6371
+ ] }) })
6372
+ ]
6373
+ }
6374
+ )
6375
+ ]
6376
+ }
6377
+ );
6333
6378
  }
6334
6379
  );
6335
6380
  Tooltip.displayName = "Tooltip";
@@ -6959,7 +7004,15 @@ var FileUploader = (props) => {
6959
7004
  style: { ...style, width },
6960
7005
  ...rest,
6961
7006
  children: [
6962
- hasLabel && /* @__PURE__ */ (0, import_jsx_runtime239.jsx)(Label, { id: labelId, showRequiredStyling: showRequiredMarker, children: label }),
7007
+ hasLabel && /* @__PURE__ */ (0, import_jsx_runtime239.jsx)(
7008
+ Label,
7009
+ {
7010
+ id: labelId,
7011
+ showRequiredStyling: showRequiredMarker,
7012
+ htmlFor: inputId,
7013
+ children: label
7014
+ }
7015
+ ),
6963
7016
  hasTip && /* @__PURE__ */ (0, import_jsx_runtime239.jsx)(InputMessage, { id: tipId, message: tip, messageType: "tip" }),
6964
7017
  withDragAndDrop ? /* @__PURE__ */ (0, import_jsx_runtime239.jsxs)(
6965
7018
  "div",
@@ -8113,6 +8166,7 @@ var Modal = (0, import_react104.forwardRef)((props, ref) => {
8113
8166
  /* @__PURE__ */ (0, import_jsx_runtime263.jsx)(
8114
8167
  Backdrop,
8115
8168
  {
8169
+ zIndex: "modal",
8116
8170
  isMounted: isOpen && hasTransitionedIn,
8117
8171
  ref: backdropRef,
8118
8172
  onClick: onBackdropClick,
@@ -9780,7 +9834,7 @@ var getCallingCode = (s) => {
9780
9834
  };
9781
9835
 
9782
9836
  // src/components/Popover/Popover.tsx
9783
- var import_react111 = require("react");
9837
+ var import_react112 = require("react");
9784
9838
 
9785
9839
  // src/components/Popover/Popover.module.css
9786
9840
  var Popover_default = {
@@ -9790,9 +9844,14 @@ var Popover_default = {
9790
9844
  "close-button": "Popover_close-button"
9791
9845
  };
9792
9846
 
9847
+ // src/components/Popover/Popover.context.tsx
9848
+ var import_react111 = require("react");
9849
+ var PopoverContext = (0, import_react111.createContext)({});
9850
+ var usePopoverContext = () => (0, import_react111.useContext)(PopoverContext);
9851
+
9793
9852
  // src/components/Popover/Popover.tsx
9794
9853
  var import_jsx_runtime271 = require("react/jsx-runtime");
9795
- var Popover = (0, import_react111.forwardRef)(
9854
+ var Popover = (0, import_react112.forwardRef)(
9796
9855
  (props, ref) => {
9797
9856
  const {
9798
9857
  title,
@@ -9807,17 +9866,12 @@ var Popover = (0, import_react111.forwardRef)(
9807
9866
  offset = 8,
9808
9867
  sizeProps,
9809
9868
  returnFocusOnBlur = true,
9810
- id,
9811
9869
  className,
9812
9870
  htmlProps = {},
9813
9871
  ...rest
9814
9872
  } = props;
9815
9873
  const hasTransitionedIn = useMountTransition(isOpen, 400);
9816
- const { refs, styles: floatingStyles } = useFloatPosition(null, {
9817
- placement,
9818
- offset
9819
- });
9820
- refs.setReference(anchorElement || null);
9874
+ const { floatStyling, setFloatOptions, floatingRef, popoverId } = usePopoverContext();
9821
9875
  const popoverRef = useReturnFocusOnBlur(
9822
9876
  isOpen && hasTransitionedIn && returnFocusOnBlur,
9823
9877
  () => {
@@ -9826,23 +9880,27 @@ var Popover = (0, import_react111.forwardRef)(
9826
9880
  },
9827
9881
  anchorElement && anchorElement
9828
9882
  );
9829
- const multiRef = useCombinedRef(ref, popoverRef, refs.setFloating);
9883
+ const multiRef = useCombinedRef(ref, popoverRef, floatingRef);
9884
+ (0, import_react112.useEffect)(() => {
9885
+ setFloatOptions && setFloatOptions({ placement, offset });
9886
+ }, []);
9830
9887
  const elements = [popoverRef.current];
9831
9888
  if (anchorElement) elements.push(anchorElement);
9832
9889
  const hasTitle = !!title;
9833
9890
  useOnClickOutside(elements, () => {
9834
9891
  if (isOpen) onClose && onClose();
9835
9892
  });
9893
+ const openCn = hasTransitionedIn && isOpen ? "open" : "closed";
9836
9894
  return isOpen || hasTransitionedIn ? /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)(
9837
9895
  Paper,
9838
9896
  {
9839
9897
  ...getBaseHTMLProps(
9840
- id,
9898
+ popoverId,
9841
9899
  cn(
9842
9900
  className,
9843
9901
  Popover_default.container,
9844
9902
  utilStyles_default["visibility-transition"],
9845
- hasTransitionedIn && isOpen ? utilStyles_default["visibility-transition--open"] : utilStyles_default["visibility-transition--closed"],
9903
+ utilStyles_default[`visibility-transition--${openCn}`],
9846
9904
  focus_default.focusable
9847
9905
  ),
9848
9906
  htmlProps,
@@ -9850,7 +9908,11 @@ var Popover = (0, import_react111.forwardRef)(
9850
9908
  ),
9851
9909
  ref: multiRef,
9852
9910
  tabIndex: -1,
9853
- style: { ...htmlProps.style, ...floatingStyles.floating, ...sizeProps },
9911
+ style: {
9912
+ ...htmlProps.style,
9913
+ ...floatStyling,
9914
+ ...sizeProps
9915
+ },
9854
9916
  role: "dialog",
9855
9917
  elevation: 3,
9856
9918
  border: "subtle",
@@ -9882,7 +9944,7 @@ var Popover = (0, import_react111.forwardRef)(
9882
9944
  Popover.displayName = "Popover";
9883
9945
 
9884
9946
  // src/components/Popover/PopoverGroup.tsx
9885
- var import_react112 = require("react");
9947
+ var import_react113 = require("react");
9886
9948
  var import_jsx_runtime272 = require("react/jsx-runtime");
9887
9949
  var PopoverGroup = ({
9888
9950
  isOpen = false,
@@ -9891,9 +9953,11 @@ var PopoverGroup = ({
9891
9953
  children,
9892
9954
  popoverId
9893
9955
  }) => {
9894
- const [open, setOpen] = (0, import_react112.useState)(isOpen);
9895
- const generatedId = (0, import_react112.useId)();
9956
+ const [open, setOpen] = (0, import_react113.useState)(isOpen);
9957
+ const generatedId = (0, import_react113.useId)();
9896
9958
  const uniquePopoverId = popoverId != null ? popoverId : `${generatedId}-popover`;
9959
+ const [floatOptions, setFloatOptions] = (0, import_react113.useState)();
9960
+ const { refs, styles: positionStyles } = useFloatPosition(null, floatOptions);
9897
9961
  const handleOnCloseButtonClick = () => {
9898
9962
  setOpen(false);
9899
9963
  onCloseButtonClick && onCloseButtonClick();
@@ -9902,8 +9966,9 @@ var PopoverGroup = ({
9902
9966
  setOpen(!open);
9903
9967
  onTriggerClick && onTriggerClick();
9904
9968
  };
9905
- const buttonRef = (0, import_react112.useRef)(null);
9906
- const popoverRef = (0, import_react112.useRef)(null);
9969
+ const buttonRef = (0, import_react113.useRef)(null);
9970
+ const anchorRef = refs.setReference;
9971
+ const combinedRef = useCombinedRef(buttonRef, anchorRef);
9907
9972
  useOnKeyDown(["Esc", "Escape"], () => {
9908
9973
  var _a;
9909
9974
  if (open) {
@@ -9912,38 +9977,48 @@ var PopoverGroup = ({
9912
9977
  }
9913
9978
  });
9914
9979
  const handleClose = () => setOpen(false);
9915
- const Children8 = import_react112.Children.map(children, (child, childIndex) => {
9916
- return (0, import_react112.isValidElement)(child) && (childIndex === 0 ? (0, import_react112.cloneElement)(child, {
9980
+ const isAnchorChild = (i) => i === 0;
9981
+ const Children8 = import_react113.Children.map(children, (child, childIndex) => {
9982
+ return (0, import_react113.isValidElement)(child) && (isAnchorChild(childIndex) ? (0, import_react113.cloneElement)(child, {
9917
9983
  "aria-haspopup": "dialog",
9918
9984
  "aria-controls": uniquePopoverId,
9919
9985
  "aria-expanded": open,
9920
9986
  onClick: handleOnTriggerClick,
9921
- ref: buttonRef
9922
- }) : (0, import_react112.cloneElement)(child, {
9987
+ ref: combinedRef
9988
+ }) : (0, import_react113.cloneElement)(child, {
9923
9989
  isOpen: open,
9924
9990
  "aria-hidden": !open,
9925
- id: uniquePopoverId,
9926
9991
  onCloseButtonClick: handleOnCloseButtonClick,
9927
9992
  anchorElement: buttonRef.current,
9928
- ref: popoverRef,
9929
9993
  onClose: handleClose
9930
9994
  }));
9931
9995
  });
9932
- return /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(import_jsx_runtime272.Fragment, { children: Children8 });
9996
+ return /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
9997
+ PopoverContext.Provider,
9998
+ {
9999
+ value: {
10000
+ floatStyling: positionStyles.floating,
10001
+ setFloatOptions,
10002
+ floatingRef: refs.setFloating,
10003
+ popoverId: uniquePopoverId
10004
+ },
10005
+ children: Children8
10006
+ }
10007
+ );
9933
10008
  };
9934
10009
  PopoverGroup.displayName = "PopoverGroup";
9935
10010
 
9936
10011
  // src/components/ProgressTracker/ProgressTracker.tsx
9937
- var import_react115 = require("react");
10012
+ var import_react116 = require("react");
9938
10013
 
9939
10014
  // src/components/ProgressTracker/ProgressTracker.context.tsx
9940
- var import_react113 = require("react");
9941
- var ProgressTrackerContext = (0, import_react113.createContext)(
10015
+ var import_react114 = require("react");
10016
+ var ProgressTrackerContext = (0, import_react114.createContext)(
9942
10017
  {
9943
10018
  activeStep: 0
9944
10019
  }
9945
10020
  );
9946
- var useProgressTrackerContext = () => (0, import_react113.useContext)(ProgressTrackerContext);
10021
+ var useProgressTrackerContext = () => (0, import_react114.useContext)(ProgressTrackerContext);
9947
10022
 
9948
10023
  // src/components/ProgressTracker/ProgressTracker.module.css
9949
10024
  var ProgressTracker_default = {
@@ -9967,7 +10042,7 @@ var ProgressTracker_default = {
9967
10042
  };
9968
10043
 
9969
10044
  // src/components/ProgressTracker/ProgressTrackerItem.tsx
9970
- var import_react114 = require("react");
10045
+ var import_react115 = require("react");
9971
10046
  var import_jsx_runtime273 = require("react/jsx-runtime");
9972
10047
  var toItemState = (active, completed, disabled) => {
9973
10048
  if (disabled) {
@@ -10009,7 +10084,7 @@ var ProgressTrackerItem = (props) => {
10009
10084
  handleStepChange && handleStepChange(index);
10010
10085
  }
10011
10086
  };
10012
- const stepNumberContent = (0, import_react114.useMemo)(() => {
10087
+ const stepNumberContent = (0, import_react115.useMemo)(() => {
10013
10088
  if (completed) {
10014
10089
  return /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(Icon, { icon: CheckIcon, iconSize: "small" });
10015
10090
  }
@@ -10077,7 +10152,7 @@ ProgressTrackerItem.displayName = "ProgressTracker.Item";
10077
10152
  // src/components/ProgressTracker/ProgressTracker.tsx
10078
10153
  var import_jsx_runtime274 = require("react/jsx-runtime");
10079
10154
  var ProgressTracker = (() => {
10080
- const Res = (0, import_react115.forwardRef)((props, ref) => {
10155
+ const Res = (0, import_react116.forwardRef)((props, ref) => {
10081
10156
  const {
10082
10157
  id,
10083
10158
  activeStep = 0,
@@ -10087,12 +10162,12 @@ var ProgressTracker = (() => {
10087
10162
  htmlProps,
10088
10163
  ...rest
10089
10164
  } = props;
10090
- const [thisActiveStep, setActiveStep] = (0, import_react115.useState)(activeStep);
10165
+ const [thisActiveStep, setActiveStep] = (0, import_react116.useState)(activeStep);
10091
10166
  const handleChange = (step) => {
10092
10167
  setActiveStep(step);
10093
10168
  onStepChange && onStepChange(step);
10094
10169
  };
10095
- (0, import_react115.useEffect)(() => {
10170
+ (0, import_react116.useEffect)(() => {
10096
10171
  if (activeStep !== void 0 && activeStep != thisActiveStep) {
10097
10172
  setActiveStep(activeStep);
10098
10173
  }
@@ -10101,7 +10176,7 @@ var ProgressTracker = (() => {
10101
10176
  ...getBaseHTMLProps(id, className, htmlProps, rest),
10102
10177
  ref
10103
10178
  };
10104
- const steps = (0, import_react115.useMemo)(() => {
10179
+ const steps = (0, import_react116.useMemo)(() => {
10105
10180
  const validChildren = removeInvalidChildren(children);
10106
10181
  const itemsWithIndex = passIndexPropToProgressTrackerItem(validChildren);
10107
10182
  const itemsWithConnectorsBetween = intersperseItemsWithConnector(itemsWithIndex);
@@ -10123,29 +10198,29 @@ var ProgressTracker = (() => {
10123
10198
  return Res;
10124
10199
  })();
10125
10200
  function removeInvalidChildren(children) {
10126
- return import_react115.Children.toArray(children).filter(import_react115.isValidElement);
10201
+ return import_react116.Children.toArray(children).filter(import_react116.isValidElement);
10127
10202
  }
10128
10203
  function passIndexPropToProgressTrackerItem(children) {
10129
- return import_react115.Children.map(
10204
+ return import_react116.Children.map(
10130
10205
  children,
10131
- (item, index) => (0, import_react115.cloneElement)(item, {
10206
+ (item, index) => (0, import_react116.cloneElement)(item, {
10132
10207
  ...item.props,
10133
10208
  index
10134
10209
  })
10135
10210
  );
10136
10211
  }
10137
- var intersperseItemsWithConnector = (children) => import_react115.Children.map(children, (child, index) => {
10212
+ var intersperseItemsWithConnector = (children) => import_react116.Children.map(children, (child, index) => {
10138
10213
  if (index === 0) {
10139
10214
  return child;
10140
10215
  }
10141
- return /* @__PURE__ */ (0, import_jsx_runtime274.jsxs)(import_react115.Fragment, { children: [
10216
+ return /* @__PURE__ */ (0, import_jsx_runtime274.jsxs)(import_react116.Fragment, { children: [
10142
10217
  /* @__PURE__ */ (0, import_jsx_runtime274.jsx)("div", { "aria-hidden": true, className: ProgressTracker_default.connector }),
10143
10218
  child
10144
10219
  ] }, index);
10145
10220
  });
10146
10221
 
10147
10222
  // src/components/ProgressBar/ProgressBar.tsx
10148
- var import_react116 = require("react");
10223
+ var import_react117 = require("react");
10149
10224
 
10150
10225
  // src/components/ProgressBar/ProgressBar.module.css
10151
10226
  var ProgressBar_default = {
@@ -10162,7 +10237,7 @@ var ProgressBar_default = {
10162
10237
 
10163
10238
  // src/components/ProgressBar/ProgressBar.tsx
10164
10239
  var import_jsx_runtime275 = require("react/jsx-runtime");
10165
- var ProgressBar = (0, import_react116.forwardRef)(
10240
+ var ProgressBar = (0, import_react117.forwardRef)(
10166
10241
  (props, ref) => {
10167
10242
  const {
10168
10243
  label,
@@ -10178,7 +10253,7 @@ var ProgressBar = (0, import_react116.forwardRef)(
10178
10253
  style,
10179
10254
  ...rest
10180
10255
  } = props;
10181
- const generatedId = (0, import_react116.useId)();
10256
+ const generatedId = (0, import_react117.useId)();
10182
10257
  const uniqueId = id != null ? id : `${generatedId}-searchInput`;
10183
10258
  const hasErrorMessage = !!errorMessage;
10184
10259
  const hasTip = !!tip;
@@ -10241,13 +10316,13 @@ var ProgressBar = (0, import_react116.forwardRef)(
10241
10316
  ProgressBar.displayName = "ProgressBar";
10242
10317
 
10243
10318
  // src/components/Search/Search.tsx
10244
- var import_react120 = require("react");
10319
+ var import_react121 = require("react");
10245
10320
 
10246
10321
  // src/components/Search/AutocompleteSearch.context.tsx
10247
- var import_react117 = require("react");
10248
- var AutocompleteSearchContext = (0, import_react117.createContext)({});
10322
+ var import_react118 = require("react");
10323
+ var AutocompleteSearchContext = (0, import_react118.createContext)({});
10249
10324
  var useAutocompleteSearch = () => {
10250
- return (0, import_react117.useContext)(AutocompleteSearchContext);
10325
+ return (0, import_react118.useContext)(AutocompleteSearchContext);
10251
10326
  };
10252
10327
 
10253
10328
  // src/components/Search/Search.module.css
@@ -10297,16 +10372,16 @@ function createEmptyChangeEvent(inputElementId) {
10297
10372
  }
10298
10373
 
10299
10374
  // src/components/Search/SearchSuggestions.tsx
10300
- var import_react119 = require("react");
10375
+ var import_react120 = require("react");
10301
10376
 
10302
10377
  // src/components/Search/SearchSuggestionItem.tsx
10303
- var import_react118 = require("react");
10378
+ var import_react119 = require("react");
10304
10379
  var import_jsx_runtime276 = require("react/jsx-runtime");
10305
- var SearchSuggestionItem = (0, import_react118.forwardRef)((props, ref) => {
10380
+ var SearchSuggestionItem = (0, import_react119.forwardRef)((props, ref) => {
10306
10381
  const { focus, className, ...rest } = props;
10307
- const itemRef = (0, import_react118.useRef)(null);
10382
+ const itemRef = (0, import_react119.useRef)(null);
10308
10383
  const combinedRef = useCombinedRef(ref, itemRef);
10309
- (0, import_react118.useEffect)(() => {
10384
+ (0, import_react119.useEffect)(() => {
10310
10385
  var _a;
10311
10386
  if (focus) {
10312
10387
  (_a = itemRef.current) == null ? void 0 : _a.focus();
@@ -10332,7 +10407,7 @@ SearchSuggestionItem.displayName = "SearchSuggestionItem";
10332
10407
 
10333
10408
  // src/components/Search/SearchSuggestions.tsx
10334
10409
  var import_jsx_runtime277 = require("react/jsx-runtime");
10335
- var SearchSuggestions = (0, import_react119.forwardRef)((props, ref) => {
10410
+ var SearchSuggestions = (0, import_react120.forwardRef)((props, ref) => {
10336
10411
  const {
10337
10412
  id,
10338
10413
  searchId,
@@ -10422,7 +10497,7 @@ var getIconSize2 = (size2) => {
10422
10497
  return "small";
10423
10498
  }
10424
10499
  };
10425
- var Search = (0, import_react120.forwardRef)(
10500
+ var Search = (0, import_react121.forwardRef)(
10426
10501
  ({
10427
10502
  componentSize = "medium",
10428
10503
  buttonProps,
@@ -10438,7 +10513,7 @@ var Search = (0, import_react120.forwardRef)(
10438
10513
  ...rest
10439
10514
  }, ref) => {
10440
10515
  var _a;
10441
- const generatedId = (0, import_react120.useId)();
10516
+ const generatedId = (0, import_react121.useId)();
10442
10517
  const uniqueId = id != null ? id : `${generatedId}-searchInput`;
10443
10518
  const hasLabel = !!label;
10444
10519
  const tipId = derivativeIdGenerator(uniqueId, "tip");
@@ -10447,7 +10522,7 @@ var Search = (0, import_react120.forwardRef)(
10447
10522
  uniqueId,
10448
10523
  "suggestions-description"
10449
10524
  );
10450
- const [hasValue, setHasValue] = (0, import_react120.useState)(!!value);
10525
+ const [hasValue, setHasValue] = (0, import_react121.useState)(!!value);
10451
10526
  const context = useAutocompleteSearch();
10452
10527
  const combinedRef = context.inputRef ? useCombinedRef(context.inputRef, ref) : ref;
10453
10528
  const handleChange = (e) => {
@@ -10564,7 +10639,7 @@ var Search = (0, import_react120.forwardRef)(
10564
10639
  Search.displayName = "Search";
10565
10640
 
10566
10641
  // src/components/Search/SearchAutocompleteWrapper.tsx
10567
- var import_react121 = require("react");
10642
+ var import_react122 = require("react");
10568
10643
  var import_jsx_runtime279 = require("react/jsx-runtime");
10569
10644
  var SearchAutocompleteWrapper = (props) => {
10570
10645
  const {
@@ -10576,12 +10651,12 @@ var SearchAutocompleteWrapper = (props) => {
10576
10651
  onSuggestionSelection,
10577
10652
  children
10578
10653
  } = props;
10579
- const [inputValue, setInputValue] = (0, import_react121.useState)(value != null ? value : "");
10580
- const [suggestions, setSuggestions] = (0, import_react121.useState)([]);
10581
- const [showSuggestions, setShowSuggestions] = (0, import_react121.useState)(false);
10654
+ const [inputValue, setInputValue] = (0, import_react122.useState)(value != null ? value : "");
10655
+ const [suggestions, setSuggestions] = (0, import_react122.useState)([]);
10656
+ const [showSuggestions, setShowSuggestions] = (0, import_react122.useState)(false);
10582
10657
  const closeSuggestions = () => showSuggestions === true && setShowSuggestions(false);
10583
10658
  const openSuggestions = () => showSuggestions === false && setShowSuggestions(true);
10584
- (0, import_react121.useEffect)(() => {
10659
+ (0, import_react122.useEffect)(() => {
10585
10660
  if (suggestions.length > 0) {
10586
10661
  openSuggestions();
10587
10662
  } else {
@@ -10626,8 +10701,8 @@ var SearchAutocompleteWrapper = (props) => {
10626
10701
  const handleSetInputValue = (value2) => {
10627
10702
  setInputValue(value2 != null ? value2 : "");
10628
10703
  };
10629
- const inputRef = (0, import_react121.useRef)(null);
10630
- const suggestionsRef = (0, import_react121.useRef)(null);
10704
+ const inputRef = (0, import_react122.useRef)(null);
10705
+ const suggestionsRef = (0, import_react122.useRef)(null);
10631
10706
  useOnClickOutside([inputRef.current, suggestionsRef.current], () => {
10632
10707
  closeSuggestions();
10633
10708
  });
@@ -10651,17 +10726,17 @@ Search2.AutocompleteWrapper = SearchAutocompleteWrapper;
10651
10726
  Search2.Suggestions = SearchSuggestions;
10652
10727
 
10653
10728
  // src/components/SelectionControl/Checkbox/Checkbox.tsx
10654
- var import_react124 = require("react");
10729
+ var import_react125 = require("react");
10655
10730
 
10656
10731
  // src/components/SelectionControl/Checkbox/CheckboxGroupContext.tsx
10657
- var import_react122 = require("react");
10658
- var CheckboxGroupContext = (0, import_react122.createContext)(null);
10732
+ var import_react123 = require("react");
10733
+ var CheckboxGroupContext = (0, import_react123.createContext)(null);
10659
10734
  var useCheckboxGroup = () => {
10660
- return (0, import_react122.useContext)(CheckboxGroupContext);
10735
+ return (0, import_react123.useContext)(CheckboxGroupContext);
10661
10736
  };
10662
10737
 
10663
10738
  // src/components/SelectionControl/SelectionControl.styles.tsx
10664
- var import_react123 = require("react");
10739
+ var import_react124 = require("react");
10665
10740
 
10666
10741
  // src/components/SelectionControl/SelectionControl.module.css
10667
10742
  var SelectionControl_default = {
@@ -10682,7 +10757,7 @@ var SelectionControl_default = {
10682
10757
 
10683
10758
  // src/components/SelectionControl/SelectionControl.styles.tsx
10684
10759
  var import_jsx_runtime280 = require("react/jsx-runtime");
10685
- var SelectionControl = (0, import_react123.forwardRef)((props, ref) => {
10760
+ var SelectionControl = (0, import_react124.forwardRef)((props, ref) => {
10686
10761
  const { controlType, className, ...rest } = props;
10687
10762
  return /* @__PURE__ */ (0, import_jsx_runtime280.jsx)(
10688
10763
  "span",
@@ -10697,7 +10772,7 @@ var SelectionControl = (0, import_react123.forwardRef)((props, ref) => {
10697
10772
  }
10698
10773
  );
10699
10774
  });
10700
- var Label2 = (0, import_react123.forwardRef)(
10775
+ var Label2 = (0, import_react124.forwardRef)(
10701
10776
  (props, ref) => {
10702
10777
  const {
10703
10778
  disabled,
@@ -10740,7 +10815,7 @@ var selectionControlTypographyProps = {
10740
10815
 
10741
10816
  // src/components/SelectionControl/Checkbox/Checkbox.tsx
10742
10817
  var import_jsx_runtime281 = require("react/jsx-runtime");
10743
- var Checkbox = (0, import_react124.forwardRef)(
10818
+ var Checkbox = (0, import_react125.forwardRef)(
10744
10819
  (props, ref) => {
10745
10820
  const {
10746
10821
  id,
@@ -10755,7 +10830,7 @@ var Checkbox = (0, import_react124.forwardRef)(
10755
10830
  htmlProps = {},
10756
10831
  ...rest
10757
10832
  } = props;
10758
- const generatedId = (0, import_react124.useId)();
10833
+ const generatedId = (0, import_react125.useId)();
10759
10834
  const uniqueId = id != null ? id : `${generatedId}-checkbox`;
10760
10835
  const checkboxGroup = useCheckboxGroup();
10761
10836
  const hasLabel = !!label;
@@ -10825,7 +10900,7 @@ var Checkbox = (0, import_react124.forwardRef)(
10825
10900
  Checkbox.displayName = "Checkbox";
10826
10901
 
10827
10902
  // src/components/SelectionControl/Checkbox/CheckboxGroup.tsx
10828
- var import_react125 = require("react");
10903
+ var import_react126 = require("react");
10829
10904
  var import_jsx_runtime282 = require("react/jsx-runtime");
10830
10905
  var CheckboxGroup = (props) => {
10831
10906
  const {
@@ -10844,7 +10919,7 @@ var CheckboxGroup = (props) => {
10844
10919
  ...rest
10845
10920
  } = props;
10846
10921
  const { "aria-required": ariaRequired } = htmlProps;
10847
- const generatedId = (0, import_react125.useId)();
10922
+ const generatedId = (0, import_react126.useId)();
10848
10923
  const uniqueGroupId = groupId != null ? groupId : `${generatedId}-checkboxGroup`;
10849
10924
  const hasErrorMessage = !!errorMessage;
10850
10925
  const showRequiredMarker = required || ariaRequired;
@@ -10902,13 +10977,13 @@ var CheckboxGroup = (props) => {
10902
10977
  CheckboxGroup.displayName = "CheckboxGroup";
10903
10978
 
10904
10979
  // src/components/SelectionControl/RadioButton/RadioButton.tsx
10905
- var import_react127 = require("react");
10980
+ var import_react128 = require("react");
10906
10981
 
10907
10982
  // src/components/SelectionControl/RadioButton/RadioButtonGroupContext.tsx
10908
- var import_react126 = require("react");
10909
- var RadioButtonGroupContext = (0, import_react126.createContext)(null);
10983
+ var import_react127 = require("react");
10984
+ var RadioButtonGroupContext = (0, import_react127.createContext)(null);
10910
10985
  var useRadioButtonGroup = () => {
10911
- return (0, import_react126.useContext)(RadioButtonGroupContext);
10986
+ return (0, import_react127.useContext)(RadioButtonGroupContext);
10912
10987
  };
10913
10988
 
10914
10989
  // src/components/SelectionControl/RadioButton/RadioButton.tsx
@@ -10927,7 +11002,7 @@ var getIsChecked = ({
10927
11002
  }
10928
11003
  return !!value;
10929
11004
  };
10930
- var RadioButton = (0, import_react127.forwardRef)(
11005
+ var RadioButton = (0, import_react128.forwardRef)(
10931
11006
  (props, ref) => {
10932
11007
  const {
10933
11008
  id,
@@ -10951,7 +11026,7 @@ var RadioButton = (0, import_react127.forwardRef)(
10951
11026
  style,
10952
11027
  ...restHtmlProps
10953
11028
  } = htmlProps;
10954
- const generatedId = (0, import_react127.useId)();
11029
+ const generatedId = (0, import_react128.useId)();
10955
11030
  const uniqueId = id != null ? id : `${generatedId}-radioButton`;
10956
11031
  const hasLabel = !!label;
10957
11032
  const radioButtonGroup = useRadioButtonGroup();
@@ -11021,7 +11096,7 @@ var RadioButton = (0, import_react127.forwardRef)(
11021
11096
  RadioButton.displayName = "RadioButton";
11022
11097
 
11023
11098
  // src/components/SelectionControl/RadioButton/RadioButtonGroup.tsx
11024
- var import_react128 = require("react");
11099
+ var import_react129 = require("react");
11025
11100
  var import_jsx_runtime284 = require("react/jsx-runtime");
11026
11101
  var RadioButtonGroupInner = (props, ref) => {
11027
11102
  const {
@@ -11044,10 +11119,10 @@ var RadioButtonGroupInner = (props, ref) => {
11044
11119
  ...rest
11045
11120
  } = props;
11046
11121
  const { "aria-required": ariaRequired = false } = htmlProps;
11047
- const [uncontrolledValue, setUncontrolledValue] = (0, import_react128.useState)(
11122
+ const [uncontrolledValue, setUncontrolledValue] = (0, import_react129.useState)(
11048
11123
  defaultValue
11049
11124
  );
11050
- const generatedId = (0, import_react128.useId)();
11125
+ const generatedId = (0, import_react129.useId)();
11051
11126
  const uniqueGroupId = groupId != null ? groupId : `${generatedId}-radioButtonGroup`;
11052
11127
  const isControlled = value !== void 0;
11053
11128
  const groupValue = isControlled ? value : uncontrolledValue;
@@ -11118,11 +11193,11 @@ var RadioButtonGroupInner = (props, ref) => {
11118
11193
  }
11119
11194
  );
11120
11195
  };
11121
- var RadioButtonGroup = (0, import_react128.forwardRef)(RadioButtonGroupInner);
11196
+ var RadioButtonGroup = (0, import_react129.forwardRef)(RadioButtonGroupInner);
11122
11197
  RadioButtonGroup.displayName = "RadioButtonGroup";
11123
11198
 
11124
11199
  // src/components/Skeleton/Skeleton.tsx
11125
- var import_react129 = require("react");
11200
+ var import_react130 = require("react");
11126
11201
 
11127
11202
  // src/components/Skeleton/Skeleton.module.css
11128
11203
  var Skeleton_default = {
@@ -11132,7 +11207,7 @@ var Skeleton_default = {
11132
11207
 
11133
11208
  // src/components/Skeleton/Skeleton.tsx
11134
11209
  var import_jsx_runtime285 = require("react/jsx-runtime");
11135
- var Skeleton = (0, import_react129.forwardRef)(
11210
+ var Skeleton = (0, import_react130.forwardRef)(
11136
11211
  (props, ref) => {
11137
11212
  const {
11138
11213
  width,
@@ -11156,7 +11231,7 @@ var Skeleton = (0, import_react129.forwardRef)(
11156
11231
  Skeleton.displayName = "Skeleton";
11157
11232
 
11158
11233
  // src/components/SkipToContent/SkipToContent.tsx
11159
- var import_react130 = require("react");
11234
+ var import_react131 = require("react");
11160
11235
 
11161
11236
  // src/components/SkipToContent/SkipToContent.module.css
11162
11237
  var SkipToContent_default = {
@@ -11165,7 +11240,7 @@ var SkipToContent_default = {
11165
11240
 
11166
11241
  // src/components/SkipToContent/SkipToContent.tsx
11167
11242
  var import_jsx_runtime286 = require("react/jsx-runtime");
11168
- var SkipToContent = (0, import_react130.forwardRef)(
11243
+ var SkipToContent = (0, import_react131.forwardRef)(
11169
11244
  (props, ref) => {
11170
11245
  const {
11171
11246
  text = "Til hovedinnhold",
@@ -11193,7 +11268,7 @@ var SkipToContent = (0, import_react130.forwardRef)(
11193
11268
  SkipToContent.displayName = "SkipToContent";
11194
11269
 
11195
11270
  // src/components/SplitButton/SplitButton.tsx
11196
- var import_react131 = require("react");
11271
+ var import_react132 = require("react");
11197
11272
 
11198
11273
  // src/components/SplitButton/SplitButton.module.css
11199
11274
  var SplitButton_default = {
@@ -11205,7 +11280,7 @@ var SplitButton_default = {
11205
11280
 
11206
11281
  // src/components/SplitButton/SplitButton.tsx
11207
11282
  var import_jsx_runtime287 = require("react/jsx-runtime");
11208
- var SplitButton = (0, import_react131.forwardRef)(
11283
+ var SplitButton = (0, import_react132.forwardRef)(
11209
11284
  (props, ref) => {
11210
11285
  const {
11211
11286
  size: size2,
@@ -11215,7 +11290,7 @@ var SplitButton = (0, import_react131.forwardRef)(
11215
11290
  className,
11216
11291
  ...rest
11217
11292
  } = props;
11218
- const [isOpen, setIsOpen] = (0, import_react131.useState)(false);
11293
+ const [isOpen, setIsOpen] = (0, import_react132.useState)(false);
11219
11294
  const buttonStyleProps = {
11220
11295
  purpose,
11221
11296
  size: size2
@@ -11252,20 +11327,20 @@ var SplitButton = (0, import_react131.forwardRef)(
11252
11327
  SplitButton.displayName = "SplitButton";
11253
11328
 
11254
11329
  // src/components/Table/collapsible/CollapsibleRow.tsx
11255
- var import_react141 = require("react");
11330
+ var import_react142 = require("react");
11256
11331
 
11257
11332
  // src/components/Table/collapsible/Table.context.tsx
11258
- var import_react132 = require("react");
11259
- var CollapsibleTableContext = (0, import_react132.createContext)({
11333
+ var import_react133 = require("react");
11334
+ var CollapsibleTableContext = (0, import_react133.createContext)({
11260
11335
  headerValues: [],
11261
11336
  definingColumnIndex: [0]
11262
11337
  });
11263
- var useCollapsibleTableContext = () => (0, import_react132.useContext)(CollapsibleTableContext);
11338
+ var useCollapsibleTableContext = () => (0, import_react133.useContext)(CollapsibleTableContext);
11264
11339
 
11265
11340
  // src/components/Table/normal/Body.tsx
11266
- var import_react133 = require("react");
11341
+ var import_react134 = require("react");
11267
11342
  var import_jsx_runtime288 = require("react/jsx-runtime");
11268
- var Body = (0, import_react133.forwardRef)(
11343
+ var Body = (0, import_react134.forwardRef)(
11269
11344
  (props, ref) => {
11270
11345
  return /* @__PURE__ */ (0, import_jsx_runtime288.jsx)("tbody", { ref, ...props });
11271
11346
  }
@@ -11273,20 +11348,20 @@ var Body = (0, import_react133.forwardRef)(
11273
11348
  Body.displayName = "Table.Body";
11274
11349
 
11275
11350
  // src/components/Table/normal/Cell.tsx
11276
- var import_react135 = require("react");
11351
+ var import_react136 = require("react");
11277
11352
 
11278
11353
  // src/components/Table/normal/Head.tsx
11279
- var import_react134 = require("react");
11354
+ var import_react135 = require("react");
11280
11355
  var import_jsx_runtime289 = require("react/jsx-runtime");
11281
- var Head = (0, import_react134.forwardRef)(
11356
+ var Head = (0, import_react135.forwardRef)(
11282
11357
  ({ children, ...rest }, ref) => {
11283
11358
  return /* @__PURE__ */ (0, import_jsx_runtime289.jsx)("thead", { ref, ...rest, children: /* @__PURE__ */ (0, import_jsx_runtime289.jsx)(HeadContext.Provider, { value: true, children }) });
11284
11359
  }
11285
11360
  );
11286
11361
  Head.displayName = "Table.Head";
11287
- var HeadContext = (0, import_react134.createContext)(false);
11362
+ var HeadContext = (0, import_react135.createContext)(false);
11288
11363
  function useIsInTableHead() {
11289
- const isInTableHead = (0, import_react134.useContext)(HeadContext);
11364
+ const isInTableHead = (0, import_react135.useContext)(HeadContext);
11290
11365
  return isInTableHead;
11291
11366
  }
11292
11367
 
@@ -11317,7 +11392,7 @@ var Table_default = {
11317
11392
 
11318
11393
  // src/components/Table/normal/Cell.tsx
11319
11394
  var import_jsx_runtime290 = require("react/jsx-runtime");
11320
- var Cell = (0, import_react135.forwardRef)(
11395
+ var Cell = (0, import_react136.forwardRef)(
11321
11396
  ({
11322
11397
  children,
11323
11398
  type: _type,
@@ -11356,9 +11431,9 @@ var Cell = (0, import_react135.forwardRef)(
11356
11431
  Cell.displayName = "Table.Cell";
11357
11432
 
11358
11433
  // src/components/Table/normal/Foot.tsx
11359
- var import_react136 = require("react");
11434
+ var import_react137 = require("react");
11360
11435
  var import_jsx_runtime291 = require("react/jsx-runtime");
11361
- var Foot = (0, import_react136.forwardRef)(
11436
+ var Foot = (0, import_react137.forwardRef)(
11362
11437
  (props, ref) => {
11363
11438
  return /* @__PURE__ */ (0, import_jsx_runtime291.jsx)("tfoot", { ref, ...props });
11364
11439
  }
@@ -11366,9 +11441,9 @@ var Foot = (0, import_react136.forwardRef)(
11366
11441
  Foot.displayName = "Table.Foot";
11367
11442
 
11368
11443
  // src/components/Table/normal/Row.tsx
11369
- var import_react137 = require("react");
11444
+ var import_react138 = require("react");
11370
11445
  var import_jsx_runtime292 = require("react/jsx-runtime");
11371
- var Row = (0, import_react137.forwardRef)(
11446
+ var Row = (0, import_react138.forwardRef)(
11372
11447
  ({ type: _type, mode = "normal", hoverable, selected, className, ...rest }, ref) => {
11373
11448
  const isInHeader = useIsInTableHead();
11374
11449
  const type = _type != null ? _type : isInHeader ? "head" : "body";
@@ -11394,7 +11469,7 @@ var Row = (0, import_react137.forwardRef)(
11394
11469
  Row.displayName = "Table.Row";
11395
11470
 
11396
11471
  // src/components/Table/normal/SortCell.tsx
11397
- var import_react138 = require("react");
11472
+ var import_react139 = require("react");
11398
11473
  var import_jsx_runtime293 = require("react/jsx-runtime");
11399
11474
  var makeSortIcon = (isSorted, sortOrder) => {
11400
11475
  if (!isSorted || !sortOrder) {
@@ -11402,7 +11477,7 @@ var makeSortIcon = (isSorted, sortOrder) => {
11402
11477
  }
11403
11478
  return sortOrder === "ascending" ? /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(Icon, { icon: ChevronDownIcon, iconSize: "inherit" }) : /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(Icon, { icon: ChevronUpIcon, iconSize: "inherit" });
11404
11479
  };
11405
- var SortCell = (0, import_react138.forwardRef)(
11480
+ var SortCell = (0, import_react139.forwardRef)(
11406
11481
  ({ isSorted, sortOrder, onClick, children, ...rest }, ref) => /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(
11407
11482
  Cell,
11408
11483
  {
@@ -11434,9 +11509,9 @@ var SortCell = (0, import_react138.forwardRef)(
11434
11509
  SortCell.displayName = "Table.SortCell";
11435
11510
 
11436
11511
  // src/components/Table/normal/Table.tsx
11437
- var import_react139 = require("react");
11512
+ var import_react140 = require("react");
11438
11513
  var import_jsx_runtime294 = require("react/jsx-runtime");
11439
- var Table = (0, import_react139.forwardRef)(
11514
+ var Table = (0, import_react140.forwardRef)(
11440
11515
  ({
11441
11516
  size: size2 = "medium",
11442
11517
  stickyHeader,
@@ -11466,25 +11541,28 @@ var Table = (0, import_react139.forwardRef)(
11466
11541
  Table.displayName = "Table";
11467
11542
 
11468
11543
  // src/components/Table/normal/TableWrapper.tsx
11469
- var import_react140 = require("react");
11544
+ var import_react141 = require("react");
11470
11545
  var import_jsx_runtime295 = require("react/jsx-runtime");
11471
11546
  var TableWrapper = ({ className, ...rest }) => {
11472
- const [overflowX, setOverflowX] = (0, import_react140.useState)(false);
11473
- const [windowWidth, setWindowWidth] = (0, import_react140.useState)(window.innerWidth);
11547
+ const themeContext = (0, import_react141.useContext)(ThemeContext);
11548
+ const container = themeContext == null ? void 0 : themeContext.el;
11549
+ const containerWidth = container ? container.clientWidth : 0;
11550
+ const [overflowX, setOverflowX] = (0, import_react141.useState)(false);
11551
+ const [themeContainerWidth, setThemeContainerWidth] = (0, import_react141.useState)(containerWidth);
11474
11552
  function isOverflowingX(event) {
11475
11553
  return event.offsetWidth < event.scrollWidth;
11476
11554
  }
11477
- const wrapperRef = (0, import_react140.useRef)(null);
11478
- (0, import_react140.useEffect)(() => {
11555
+ const wrapperRef = (0, import_react141.useRef)(null);
11556
+ (0, import_react141.useEffect)(() => {
11479
11557
  if ((wrapperRef == null ? void 0 : wrapperRef.current) && isOverflowingX(wrapperRef.current)) {
11480
11558
  setOverflowX(true);
11481
11559
  return;
11482
11560
  }
11483
11561
  setOverflowX(false);
11484
- }, [windowWidth]);
11485
- (0, import_react140.useEffect)(() => {
11562
+ }, [themeContainerWidth]);
11563
+ (0, import_react141.useEffect)(() => {
11486
11564
  function handleResize() {
11487
- setWindowWidth(window.innerWidth);
11565
+ setThemeContainerWidth(containerWidth);
11488
11566
  }
11489
11567
  window.addEventListener("resize", handleResize);
11490
11568
  return () => window.removeEventListener("resize", handleResize);
@@ -11517,7 +11595,7 @@ Table2.Foot = Foot;
11517
11595
 
11518
11596
  // src/components/Table/collapsible/CollapsibleRow.tsx
11519
11597
  var import_jsx_runtime296 = require("react/jsx-runtime");
11520
- var CollapsibleRow = (0, import_react141.forwardRef)(
11598
+ var CollapsibleRow = (0, import_react142.forwardRef)(
11521
11599
  ({
11522
11600
  type: _type,
11523
11601
  className,
@@ -11530,8 +11608,8 @@ var CollapsibleRow = (0, import_react141.forwardRef)(
11530
11608
  const isInHead = useIsInTableHead();
11531
11609
  const type = _type != null ? _type : isInHead ? "head" : "body";
11532
11610
  const { isCollapsed, headerValues, definingColumnIndex } = useCollapsibleTableContext();
11533
- const [childrenCollapsed, setChildrenCollapsed] = (0, import_react141.useState)(true);
11534
- (0, import_react141.useEffect)(() => {
11611
+ const [childrenCollapsed, setChildrenCollapsed] = (0, import_react142.useState)(true);
11612
+ (0, import_react142.useEffect)(() => {
11535
11613
  !isCollapsed && setChildrenCollapsed(true);
11536
11614
  }, [isCollapsed]);
11537
11615
  const rowProps = (isOpenCollapsibleHeader) => {
@@ -11549,7 +11627,7 @@ var CollapsibleRow = (0, import_react141.forwardRef)(
11549
11627
  const collapsedHeaderValues = headerValues.filter(
11550
11628
  (column, index) => definingColumnIndex.indexOf(index) === -1
11551
11629
  );
11552
- const childrenArray = import_react141.Children.toArray(children);
11630
+ const childrenArray = import_react142.Children.toArray(children);
11553
11631
  const collapsedChildren = childrenArray.filter(
11554
11632
  (column, index) => definingColumnIndex.indexOf(index) === -1
11555
11633
  );
@@ -11558,9 +11636,9 @@ var CollapsibleRow = (0, import_react141.forwardRef)(
11558
11636
  const collapsedRenderedChildren = isCollapsed && collapsedHeaderValues.length > 0 ? collapsedChildren.map(function(child, index) {
11559
11637
  const id = derivativeIdGenerator(prefix2, index.toString());
11560
11638
  collapsibleIds.push(id);
11561
- return /* @__PURE__ */ (0, import_jsx_runtime296.jsxs)(import_react141.Fragment, { children: [
11639
+ return /* @__PURE__ */ (0, import_jsx_runtime296.jsxs)(import_react142.Fragment, { children: [
11562
11640
  /* @__PURE__ */ (0, import_jsx_runtime296.jsx)(DescriptionListTerm, { children: collapsedHeaderValues[index].content }),
11563
- (0, import_react141.isValidElement)(child) && (0, import_react141.cloneElement)(child, {
11641
+ (0, import_react142.isValidElement)(child) && (0, import_react142.cloneElement)(child, {
11564
11642
  collapsibleProps: { isCollapsibleChild: true }
11565
11643
  })
11566
11644
  ] }, `DL-${index}`);
@@ -11620,9 +11698,9 @@ var CollapsibleRow = (0, import_react141.forwardRef)(
11620
11698
  CollapsibleRow.displayName = "CollapsibleTable.Row";
11621
11699
 
11622
11700
  // src/components/Table/collapsible/CollapsibleTable.tsx
11623
- var import_react142 = require("react");
11701
+ var import_react143 = require("react");
11624
11702
  var import_jsx_runtime297 = require("react/jsx-runtime");
11625
- var CollapsibleTable = (0, import_react142.forwardRef)((props, ref) => {
11703
+ var CollapsibleTable = (0, import_react143.forwardRef)((props, ref) => {
11626
11704
  const {
11627
11705
  isCollapsed,
11628
11706
  headerValues,
@@ -11648,11 +11726,11 @@ var CollapsibleTable2 = CollapsibleTable;
11648
11726
  CollapsibleTable2.Row = CollapsibleRow;
11649
11727
 
11650
11728
  // src/components/Tabs/Tabs.tsx
11651
- var import_react144 = require("react");
11729
+ var import_react145 = require("react");
11652
11730
 
11653
11731
  // src/components/Tabs/Tabs.context.tsx
11654
- var import_react143 = require("react");
11655
- var TabsContext = (0, import_react143.createContext)({
11732
+ var import_react144 = require("react");
11733
+ var TabsContext = (0, import_react144.createContext)({
11656
11734
  activeTab: 0,
11657
11735
  tabsId: "",
11658
11736
  handleTabChange: () => null,
@@ -11662,7 +11740,7 @@ var TabsContext = (0, import_react143.createContext)({
11662
11740
  setHasTabFocus: () => null,
11663
11741
  tabContentDirection: "row"
11664
11742
  });
11665
- var useTabsContext = () => (0, import_react143.useContext)(TabsContext);
11743
+ var useTabsContext = () => (0, import_react144.useContext)(TabsContext);
11666
11744
 
11667
11745
  // src/components/Tabs/Tabs.module.css
11668
11746
  var Tabs_default = {
@@ -11679,7 +11757,7 @@ var Tabs_default = {
11679
11757
 
11680
11758
  // src/components/Tabs/Tabs.tsx
11681
11759
  var import_jsx_runtime298 = require("react/jsx-runtime");
11682
- var Tabs = (0, import_react144.forwardRef)((props, ref) => {
11760
+ var Tabs = (0, import_react145.forwardRef)((props, ref) => {
11683
11761
  const {
11684
11762
  id,
11685
11763
  activeTab,
@@ -11691,17 +11769,17 @@ var Tabs = (0, import_react144.forwardRef)((props, ref) => {
11691
11769
  htmlProps,
11692
11770
  ...rest
11693
11771
  } = props;
11694
- const generatedId = (0, import_react144.useId)();
11772
+ const generatedId = (0, import_react145.useId)();
11695
11773
  const uniqueId = id != null ? id : `${generatedId}-tabs`;
11696
- const [thisActiveTab, setActiveTab] = (0, import_react144.useState)(activeTab != null ? activeTab : 0);
11697
- const [hasTabFocus, setHasTabFocus] = (0, import_react144.useState)(false);
11698
- const tabListRef = (0, import_react144.useRef)(null);
11699
- const tabPanelsRef = (0, import_react144.useRef)(null);
11774
+ const [thisActiveTab, setActiveTab] = (0, import_react145.useState)(activeTab != null ? activeTab : 0);
11775
+ const [hasTabFocus, setHasTabFocus] = (0, import_react145.useState)(false);
11776
+ const tabListRef = (0, import_react145.useRef)(null);
11777
+ const tabPanelsRef = (0, import_react145.useRef)(null);
11700
11778
  const handleTabChange = (index) => {
11701
11779
  setActiveTab(index);
11702
11780
  onChange && onChange(index);
11703
11781
  };
11704
- (0, import_react144.useEffect)(() => {
11782
+ (0, import_react145.useEffect)(() => {
11705
11783
  if (activeTab !== void 0 && activeTab !== thisActiveTab) {
11706
11784
  setActiveTab(activeTab);
11707
11785
  }
@@ -11743,12 +11821,12 @@ var Tabs = (0, import_react144.forwardRef)((props, ref) => {
11743
11821
  Tabs.displayName = "Tabs";
11744
11822
 
11745
11823
  // src/components/Tabs/Tab.tsx
11746
- var import_react146 = require("react");
11824
+ var import_react147 = require("react");
11747
11825
 
11748
11826
  // src/components/Tabs/TabWidthContext.tsx
11749
- var import_react145 = require("react");
11827
+ var import_react146 = require("react");
11750
11828
  var import_jsx_runtime299 = require("react/jsx-runtime");
11751
- var TabContext = (0, import_react145.createContext)(null);
11829
+ var TabContext = (0, import_react146.createContext)(null);
11752
11830
  function TabWidthContextProvider({
11753
11831
  children,
11754
11832
  onChangeWidths
@@ -11777,8 +11855,8 @@ function TabWidthContextProvider({
11777
11855
  );
11778
11856
  }
11779
11857
  function useSetTabWidth(index, width) {
11780
- const context = (0, import_react145.useContext)(TabContext);
11781
- (0, import_react145.useLayoutEffect)(() => {
11858
+ const context = (0, import_react146.useContext)(TabContext);
11859
+ (0, import_react146.useLayoutEffect)(() => {
11782
11860
  context == null ? void 0 : context.updateWidth(index, width);
11783
11861
  return () => context == null ? void 0 : context.removeTab(index);
11784
11862
  }, [index, width]);
@@ -11786,7 +11864,7 @@ function useSetTabWidth(index, width) {
11786
11864
 
11787
11865
  // src/components/Tabs/Tab.tsx
11788
11866
  var import_jsx_runtime300 = require("react/jsx-runtime");
11789
- var Tab = (0, import_react146.forwardRef)((props, ref) => {
11867
+ var Tab = (0, import_react147.forwardRef)((props, ref) => {
11790
11868
  const {
11791
11869
  active = false,
11792
11870
  icon,
@@ -11803,16 +11881,16 @@ var Tab = (0, import_react146.forwardRef)((props, ref) => {
11803
11881
  ...rest
11804
11882
  } = props;
11805
11883
  useSetTabWidth(index, width);
11806
- const itemRef = (0, import_react146.useRef)(null);
11884
+ const itemRef = (0, import_react147.useRef)(null);
11807
11885
  const combinedRef = useCombinedRef(ref, itemRef);
11808
11886
  const { tabContentDirection } = useTabsContext();
11809
- (0, import_react146.useEffect)(() => {
11887
+ (0, import_react147.useEffect)(() => {
11810
11888
  var _a;
11811
11889
  if (focus) {
11812
11890
  (_a = itemRef.current) == null ? void 0 : _a.focus();
11813
11891
  }
11814
11892
  }, [focus]);
11815
- const handleSelect = (0, import_react146.useCallback)(() => {
11893
+ const handleSelect = (0, import_react147.useCallback)(() => {
11816
11894
  if (setFocus && index) {
11817
11895
  setFocus(index);
11818
11896
  }
@@ -11857,9 +11935,9 @@ var Tab = (0, import_react146.forwardRef)((props, ref) => {
11857
11935
  Tab.displayName = "Tab";
11858
11936
 
11859
11937
  // src/components/Tabs/TabList.tsx
11860
- var import_react147 = require("react");
11938
+ var import_react148 = require("react");
11861
11939
  var import_jsx_runtime301 = require("react/jsx-runtime");
11862
- var TabList = (0, import_react147.forwardRef)(
11940
+ var TabList = (0, import_react148.forwardRef)(
11863
11941
  ({ children, id, style, onFocus, ...rest }, ref) => {
11864
11942
  const {
11865
11943
  activeTab,
@@ -11870,11 +11948,11 @@ var TabList = (0, import_react147.forwardRef)(
11870
11948
  setHasTabFocus
11871
11949
  } = useTabsContext();
11872
11950
  const uniqueId = id != null ? id : `${tabsId}-tablist`;
11873
- const childrenArray = import_react147.Children.toArray(children).length;
11951
+ const childrenArray = import_react148.Children.toArray(children).length;
11874
11952
  const [focus, setFocus] = useRoveFocus(childrenArray, hasTabFocus, "row");
11875
11953
  const combinedRef = useCombinedRef(ref, tabListRef);
11876
- const tabListChildren = import_react147.Children.map(children, (child, index) => {
11877
- return (0, import_react147.isValidElement)(child) && (0, import_react147.cloneElement)(child, {
11954
+ const tabListChildren = import_react148.Children.map(children, (child, index) => {
11955
+ return (0, import_react148.isValidElement)(child) && (0, import_react148.cloneElement)(child, {
11878
11956
  id: `${tabsId}-tab-${index}`,
11879
11957
  "aria-controls": `${tabsId}-panel-${index}`,
11880
11958
  active: activeTab === index,
@@ -11884,7 +11962,7 @@ var TabList = (0, import_react147.forwardRef)(
11884
11962
  onClick: () => handleTabChange(index)
11885
11963
  });
11886
11964
  });
11887
- const [widths, setWidths] = (0, import_react147.useState)([]);
11965
+ const [widths, setWidths] = (0, import_react148.useState)([]);
11888
11966
  const handleOnFocus = (event) => {
11889
11967
  setHasTabFocus(true);
11890
11968
  onFocus && onFocus(event);
@@ -11928,9 +12006,9 @@ var TabList = (0, import_react147.forwardRef)(
11928
12006
  TabList.displayName = "TabList";
11929
12007
 
11930
12008
  // src/components/Tabs/TabPanel.tsx
11931
- var import_react148 = require("react");
12009
+ var import_react149 = require("react");
11932
12010
  var import_jsx_runtime302 = require("react/jsx-runtime");
11933
- var TabPanel = (0, import_react148.forwardRef)(
12011
+ var TabPanel = (0, import_react149.forwardRef)(
11934
12012
  ({ active = false, children, id, className, htmlProps, ...rest }, ref) => {
11935
12013
  return /* @__PURE__ */ (0, import_jsx_runtime302.jsx)(
11936
12014
  "div",
@@ -11953,15 +12031,15 @@ var TabPanel = (0, import_react148.forwardRef)(
11953
12031
  TabPanel.displayName = "TabPanel";
11954
12032
 
11955
12033
  // src/components/Tabs/TabPanels.tsx
11956
- var import_react149 = require("react");
12034
+ var import_react150 = require("react");
11957
12035
  var import_jsx_runtime303 = require("react/jsx-runtime");
11958
- var TabPanels = (0, import_react149.forwardRef)(
12036
+ var TabPanels = (0, import_react150.forwardRef)(
11959
12037
  ({ children, ...rest }, ref) => {
11960
12038
  const { activeTab, tabsId, tabPanelsRef } = useTabsContext();
11961
12039
  const combinedRef = useCombinedRef(ref, tabPanelsRef);
11962
- const panelChildren = import_react149.Children.map(children, (child, index) => {
12040
+ const panelChildren = import_react150.Children.map(children, (child, index) => {
11963
12041
  const active = index === activeTab;
11964
- return (0, import_react149.isValidElement)(child) && (0, import_react149.cloneElement)(child, {
12042
+ return (0, import_react150.isValidElement)(child) && (0, import_react150.cloneElement)(child, {
11965
12043
  id: `${tabsId}-panel-${index}`,
11966
12044
  "aria-labelledby": `${tabsId}-tab-${index}`,
11967
12045
  active,
@@ -11974,7 +12052,7 @@ var TabPanels = (0, import_react149.forwardRef)(
11974
12052
  TabPanels.displayName = "TabPanels";
11975
12053
 
11976
12054
  // src/components/Tag/Tag.tsx
11977
- var import_react150 = require("react");
12055
+ var import_react151 = require("react");
11978
12056
 
11979
12057
  // src/components/Tag/Tag.module.css
11980
12058
  var Tag_default = {
@@ -12001,7 +12079,7 @@ var icons3 = {
12001
12079
  success: CheckCircledIcon,
12002
12080
  default: void 0
12003
12081
  };
12004
- var Tag = (0, import_react150.forwardRef)((props, ref) => {
12082
+ var Tag = (0, import_react151.forwardRef)((props, ref) => {
12005
12083
  const {
12006
12084
  text,
12007
12085
  purpose = "default",
@@ -12040,7 +12118,7 @@ var Tag = (0, import_react150.forwardRef)((props, ref) => {
12040
12118
  Tag.displayName = "Tag";
12041
12119
 
12042
12120
  // src/components/TextInput/TextInput.tsx
12043
- var import_react151 = require("react");
12121
+ var import_react152 = require("react");
12044
12122
 
12045
12123
  // src/components/TextInput/TextInput.module.css
12046
12124
  var TextInput_default = {
@@ -12067,7 +12145,7 @@ var TextInput_default = {
12067
12145
 
12068
12146
  // src/components/TextInput/TextInput.tsx
12069
12147
  var import_jsx_runtime305 = require("react/jsx-runtime");
12070
- var TextInput = (0, import_react151.forwardRef)(
12148
+ var TextInput = (0, import_react152.forwardRef)(
12071
12149
  ({
12072
12150
  label,
12073
12151
  disabled,
@@ -12093,14 +12171,14 @@ var TextInput = (0, import_react151.forwardRef)(
12093
12171
  suffix,
12094
12172
  ...rest
12095
12173
  }, ref) => {
12096
- const [text, setText] = (0, import_react151.useState)(
12174
+ const [text, setText] = (0, import_react152.useState)(
12097
12175
  getDefaultText(value, defaultValue)
12098
12176
  );
12099
- const prefixRef = (0, import_react151.useRef)(null);
12100
- const suffixRef = (0, import_react151.useRef)(null);
12101
- const [prefixLength, setPrefixLength] = (0, import_react151.useState)(0);
12102
- const [suffixLength, setSuffixLength] = (0, import_react151.useState)(0);
12103
- (0, import_react151.useLayoutEffect)(() => {
12177
+ const prefixRef = (0, import_react152.useRef)(null);
12178
+ const suffixRef = (0, import_react152.useRef)(null);
12179
+ const [prefixLength, setPrefixLength] = (0, import_react152.useState)(0);
12180
+ const [suffixLength, setSuffixLength] = (0, import_react152.useState)(0);
12181
+ (0, import_react152.useLayoutEffect)(() => {
12104
12182
  if (prefixRef.current) {
12105
12183
  setPrefixLength(prefixRef.current.offsetWidth);
12106
12184
  }
@@ -12114,7 +12192,7 @@ var TextInput = (0, import_react151.forwardRef)(
12114
12192
  onChange(event);
12115
12193
  }
12116
12194
  };
12117
- const generatedId = (0, import_react151.useId)();
12195
+ const generatedId = (0, import_react152.useId)();
12118
12196
  const uniqueId = id != null ? id : `${generatedId}-textInput`;
12119
12197
  const hasErrorMessage = !!errorMessage;
12120
12198
  const hasTip = !!tip;
@@ -12293,15 +12371,129 @@ var TextInput = (0, import_react151.forwardRef)(
12293
12371
  );
12294
12372
  TextInput.displayName = "TextInput";
12295
12373
 
12296
- // src/components/ToggleBar/ToggleBar.tsx
12374
+ // src/components/Toggle/Toggle.tsx
12297
12375
  var import_react153 = require("react");
12298
12376
 
12377
+ // src/components/Toggle/Toggle.module.css
12378
+ var Toggle_default = {
12379
+ label: "Toggle_label",
12380
+ track: "Toggle_track",
12381
+ thumb: "Toggle_thumb",
12382
+ checkmark: "Toggle_checkmark",
12383
+ "labeltext--readonly": "Toggle_labeltext--readonly",
12384
+ "icon--read-only": "Toggle_icon--read-only",
12385
+ medium: "Toggle_medium",
12386
+ large: "Toggle_large",
12387
+ "label--is-loading": "Toggle_label--is-loading",
12388
+ "label--disabled": "Toggle_label--disabled",
12389
+ "label--read-only": "Toggle_label--read-only"
12390
+ };
12391
+
12392
+ // src/components/Toggle/Toggle.tsx
12393
+ var import_jsx_runtime306 = require("react/jsx-runtime");
12394
+ var Toggle = (0, import_react153.forwardRef)(
12395
+ ({
12396
+ id,
12397
+ children,
12398
+ size: size2 = "medium",
12399
+ checked: checkedProp,
12400
+ defaultChecked,
12401
+ onChange,
12402
+ disabled,
12403
+ readOnly,
12404
+ isLoading,
12405
+ className,
12406
+ htmlProps = {},
12407
+ ...rest
12408
+ }, ref) => {
12409
+ const generatedId = (0, import_react153.useId)();
12410
+ const uniqueId = id != null ? id : `${generatedId}-toggle`;
12411
+ const iconSize = size2 === "large" ? "medium" : "small";
12412
+ const [checked, setChecked] = useControllableState({
12413
+ value: checkedProp,
12414
+ defaultValue: defaultChecked != null ? defaultChecked : false,
12415
+ onChange
12416
+ });
12417
+ return /* @__PURE__ */ (0, import_jsx_runtime306.jsxs)(
12418
+ "label",
12419
+ {
12420
+ htmlFor: uniqueId,
12421
+ className: cn(
12422
+ Toggle_default.label,
12423
+ Toggle_default[size2],
12424
+ isLoading && Toggle_default["label--is-loading"],
12425
+ disabled && Toggle_default["label--disabled"],
12426
+ readOnly && Toggle_default["label--read-only"]
12427
+ ),
12428
+ children: [
12429
+ /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(
12430
+ "input",
12431
+ {
12432
+ ...getBaseHTMLProps(
12433
+ uniqueId,
12434
+ cn(
12435
+ className,
12436
+ focus_default["focusable-sibling"],
12437
+ utilStyles_default["hide-input"]
12438
+ ),
12439
+ htmlProps,
12440
+ rest
12441
+ ),
12442
+ ref,
12443
+ type: "checkbox",
12444
+ checked,
12445
+ onChange: (e) => setChecked(e.target.checked),
12446
+ disabled,
12447
+ "aria-disabled": isLoading,
12448
+ "aria-readonly": readOnly,
12449
+ onKeyDown: readOnlyKeyDownHandler(
12450
+ "selectionControl",
12451
+ readOnly || isLoading,
12452
+ htmlProps.onKeyDown
12453
+ ),
12454
+ onClick: readOnlyClickHandler(
12455
+ readOnly || isLoading,
12456
+ htmlProps.onClick
12457
+ )
12458
+ }
12459
+ ),
12460
+ /* @__PURE__ */ (0, import_jsx_runtime306.jsx)("span", { className: cn(Toggle_default.track, focus_default["focus-styled-sibling"]), children: /* @__PURE__ */ (0, import_jsx_runtime306.jsx)("span", { className: Toggle_default.thumb, children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(Spinner, { size: `var(--dds-icon-size-${size2})` }) : /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(
12461
+ Icon,
12462
+ {
12463
+ className: Toggle_default.checkmark,
12464
+ icon: CheckIcon,
12465
+ iconSize
12466
+ }
12467
+ ) }) }),
12468
+ /* @__PURE__ */ (0, import_jsx_runtime306.jsxs)("span", { className: cn(readOnly && Toggle_default["labeltext--readonly"]), children: [
12469
+ readOnly && /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(
12470
+ Icon,
12471
+ {
12472
+ icon: LockIcon,
12473
+ iconSize: "small",
12474
+ className: Toggle_default["icon--read-only"]
12475
+ }
12476
+ ),
12477
+ children,
12478
+ " ",
12479
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(VisuallyHidden, { as: "span", children: "Innlastning p\xE5g\xE5r" })
12480
+ ] })
12481
+ ]
12482
+ }
12483
+ );
12484
+ }
12485
+ );
12486
+ Toggle.displayName = "Toggle";
12487
+
12488
+ // src/components/ToggleBar/ToggleBar.tsx
12489
+ var import_react155 = require("react");
12490
+
12299
12491
  // src/components/ToggleBar/ToggleBar.context.tsx
12300
- var import_react152 = require("react");
12301
- var ToggleBarContext = (0, import_react152.createContext)({
12492
+ var import_react154 = require("react");
12493
+ var ToggleBarContext = (0, import_react154.createContext)({
12302
12494
  size: "medium"
12303
12495
  });
12304
- var useToggleBarContext = () => (0, import_react152.useContext)(ToggleBarContext);
12496
+ var useToggleBarContext = () => (0, import_react154.useContext)(ToggleBarContext);
12305
12497
 
12306
12498
  // src/components/ToggleBar/ToggleBar.module.css
12307
12499
  var ToggleBar_default = {
@@ -12320,7 +12512,7 @@ var ToggleBar_default = {
12320
12512
  };
12321
12513
 
12322
12514
  // src/components/ToggleBar/ToggleBar.tsx
12323
- var import_jsx_runtime306 = require("react/jsx-runtime");
12515
+ var import_jsx_runtime307 = require("react/jsx-runtime");
12324
12516
  var ToggleBar = (props) => {
12325
12517
  const {
12326
12518
  children,
@@ -12335,15 +12527,15 @@ var ToggleBar = (props) => {
12335
12527
  id,
12336
12528
  ...rest
12337
12529
  } = props;
12338
- const generatedId = (0, import_react153.useId)();
12530
+ const generatedId = (0, import_react155.useId)();
12339
12531
  const uniqueId = id != null ? id : `${generatedId}-ToggleBar`;
12340
- const [groupValue, setGroupValue] = (0, import_react153.useState)(value);
12532
+ const [groupValue, setGroupValue] = (0, import_react155.useState)(value);
12341
12533
  const handleChange = combineHandlers(
12342
12534
  (e) => setGroupValue(e.target.value),
12343
12535
  (e) => onChange && onChange(e, e.target.value)
12344
12536
  );
12345
12537
  const labelId = label && `${uniqueId}-label`;
12346
- return /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(
12538
+ return /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(
12347
12539
  ToggleBarContext.Provider,
12348
12540
  {
12349
12541
  value: {
@@ -12352,7 +12544,7 @@ var ToggleBar = (props) => {
12352
12544
  name,
12353
12545
  value: groupValue
12354
12546
  },
12355
- children: /* @__PURE__ */ (0, import_jsx_runtime306.jsxs)(
12547
+ children: /* @__PURE__ */ (0, import_jsx_runtime307.jsxs)(
12356
12548
  "div",
12357
12549
  {
12358
12550
  ...getBaseHTMLProps(
@@ -12365,8 +12557,8 @@ var ToggleBar = (props) => {
12365
12557
  role: "radiogroup",
12366
12558
  "aria-labelledby": labelId != null ? labelId : htmlProps == null ? void 0 : htmlProps["aria-labelledby"],
12367
12559
  children: [
12368
- label && /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(Typography, { id: labelId, as: "span", typographyType: "labelMedium", children: label }),
12369
- /* @__PURE__ */ (0, import_jsx_runtime306.jsx)("div", { className: ToggleBar_default.bar, children })
12560
+ label && /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(Typography, { id: labelId, as: "span", typographyType: "labelMedium", children: label }),
12561
+ /* @__PURE__ */ (0, import_jsx_runtime307.jsx)("div", { className: ToggleBar_default.bar, children })
12370
12562
  ]
12371
12563
  }
12372
12564
  )
@@ -12376,8 +12568,8 @@ var ToggleBar = (props) => {
12376
12568
  ToggleBar.displayName = "ToggleBar";
12377
12569
 
12378
12570
  // src/components/ToggleBar/ToggleRadio.tsx
12379
- var import_react154 = require("react");
12380
- var import_jsx_runtime307 = require("react/jsx-runtime");
12571
+ var import_react156 = require("react");
12572
+ var import_jsx_runtime308 = require("react/jsx-runtime");
12381
12573
  var typographyTypes4 = {
12382
12574
  large: "bodyLarge",
12383
12575
  medium: "bodyMedium",
@@ -12394,7 +12586,7 @@ var calculateChecked = (value, group, checked) => {
12394
12586
  }
12395
12587
  return !!value;
12396
12588
  };
12397
- var ToggleRadio = (0, import_react154.forwardRef)(
12589
+ var ToggleRadio = (0, import_react156.forwardRef)(
12398
12590
  (props, ref) => {
12399
12591
  const {
12400
12592
  value,
@@ -12410,7 +12602,7 @@ var ToggleRadio = (0, import_react154.forwardRef)(
12410
12602
  id,
12411
12603
  ...rest
12412
12604
  } = props;
12413
- const generatedId = (0, import_react154.useId)();
12605
+ const generatedId = (0, import_react156.useId)();
12414
12606
  const uniqueId = id != null ? id : `${generatedId}-ToggleRadio`;
12415
12607
  const group = useToggleBarContext();
12416
12608
  const handleChange = (event) => {
@@ -12418,8 +12610,8 @@ var ToggleRadio = (0, import_react154.forwardRef)(
12418
12610
  (group == null ? void 0 : group.onChange) && group.onChange(event);
12419
12611
  };
12420
12612
  const contentTypeCn = label ? "with-text" : "just-icon";
12421
- return /* @__PURE__ */ (0, import_jsx_runtime307.jsxs)("label", { htmlFor: uniqueId, className: ToggleBar_default.label, children: [
12422
- /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(
12613
+ return /* @__PURE__ */ (0, import_jsx_runtime308.jsxs)("label", { htmlFor: uniqueId, className: ToggleBar_default.label, children: [
12614
+ /* @__PURE__ */ (0, import_jsx_runtime308.jsx)(
12423
12615
  "input",
12424
12616
  {
12425
12617
  ...getBaseHTMLProps(
@@ -12442,7 +12634,7 @@ var ToggleRadio = (0, import_react154.forwardRef)(
12442
12634
  "aria-labelledby": ariaLabelledBy
12443
12635
  }
12444
12636
  ),
12445
- /* @__PURE__ */ (0, import_jsx_runtime307.jsxs)(
12637
+ /* @__PURE__ */ (0, import_jsx_runtime308.jsxs)(
12446
12638
  Typography,
12447
12639
  {
12448
12640
  as: "span",
@@ -12453,8 +12645,8 @@ var ToggleRadio = (0, import_react154.forwardRef)(
12453
12645
  focus_default["focus-styled-sibling"]
12454
12646
  ),
12455
12647
  children: [
12456
- icon && /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(Icon, { icon, iconSize: "inherit" }),
12457
- label && /* @__PURE__ */ (0, import_jsx_runtime307.jsx)("span", { children: label })
12648
+ icon && /* @__PURE__ */ (0, import_jsx_runtime308.jsx)(Icon, { icon, iconSize: "inherit" }),
12649
+ label && /* @__PURE__ */ (0, import_jsx_runtime308.jsx)("span", { children: label })
12458
12650
  ]
12459
12651
  }
12460
12652
  )
@@ -12464,7 +12656,7 @@ var ToggleRadio = (0, import_react154.forwardRef)(
12464
12656
  ToggleRadio.displayName = "ToggleRadio";
12465
12657
 
12466
12658
  // src/components/ToggleButton/ToggleButton.tsx
12467
- var import_react155 = require("react");
12659
+ var import_react157 = require("react");
12468
12660
 
12469
12661
  // src/components/ToggleButton/ToggleButton.module.css
12470
12662
  var ToggleButton_default = {
@@ -12474,18 +12666,20 @@ var ToggleButton_default = {
12474
12666
  "group--column": "ToggleButton_group--column",
12475
12667
  container: "ToggleButton_container",
12476
12668
  content: "ToggleButton_content",
12669
+ small: "ToggleButton_small",
12670
+ xsmall: "ToggleButton_xsmall",
12477
12671
  "content--with-icon": "ToggleButton_content--with-icon"
12478
12672
  };
12479
12673
 
12480
12674
  // src/components/ToggleButton/ToggleButton.tsx
12481
- var import_jsx_runtime308 = require("react/jsx-runtime");
12482
- var ToggleButton = (0, import_react155.forwardRef)(
12483
- ({ id, label, icon, className, htmlProps, ...rest }, ref) => {
12484
- const generatedId = (0, import_react155.useId)();
12675
+ var import_jsx_runtime309 = require("react/jsx-runtime");
12676
+ var ToggleButton = (0, import_react157.forwardRef)(
12677
+ ({ id, label, icon, size: size2 = "small", className, htmlProps, ...rest }, ref) => {
12678
+ const generatedId = (0, import_react157.useId)();
12485
12679
  const uniqueId = id != null ? id : `${generatedId}-toggleButton`;
12486
12680
  const hasIcon = !!icon;
12487
- return /* @__PURE__ */ (0, import_jsx_runtime308.jsxs)("label", { htmlFor: uniqueId, className: ToggleButton_default.container, children: [
12488
- /* @__PURE__ */ (0, import_jsx_runtime308.jsx)(
12681
+ return /* @__PURE__ */ (0, import_jsx_runtime309.jsxs)("label", { htmlFor: uniqueId, className: ToggleButton_default.container, children: [
12682
+ /* @__PURE__ */ (0, import_jsx_runtime309.jsx)(
12489
12683
  "input",
12490
12684
  {
12491
12685
  ...getBaseHTMLProps(
@@ -12502,17 +12696,18 @@ var ToggleButton = (0, import_react155.forwardRef)(
12502
12696
  type: "checkbox"
12503
12697
  }
12504
12698
  ),
12505
- /* @__PURE__ */ (0, import_jsx_runtime308.jsxs)(
12699
+ /* @__PURE__ */ (0, import_jsx_runtime309.jsxs)(
12506
12700
  "span",
12507
12701
  {
12508
12702
  className: cn(
12509
12703
  ToggleButton_default.content,
12704
+ ToggleButton_default[size2],
12510
12705
  hasIcon && ToggleButton_default["content--with-icon"],
12511
- typographyStyles_default["body-small"],
12706
+ typographyStyles_default[`body-${size2}`],
12512
12707
  focus_default["focus-styled-sibling"]
12513
12708
  ),
12514
12709
  children: [
12515
- hasIcon && /* @__PURE__ */ (0, import_jsx_runtime308.jsx)(Icon, { icon, iconSize: "inherit" }),
12710
+ hasIcon && /* @__PURE__ */ (0, import_jsx_runtime309.jsx)(Icon, { icon, iconSize: "inherit" }),
12516
12711
  " ",
12517
12712
  label
12518
12713
  ]
@@ -12524,8 +12719,8 @@ var ToggleButton = (0, import_react155.forwardRef)(
12524
12719
  ToggleButton.displayName = "ToggleButton";
12525
12720
 
12526
12721
  // src/components/ToggleButton/ToggleButtonGroup.tsx
12527
- var import_react156 = require("react");
12528
- var import_jsx_runtime309 = require("react/jsx-runtime");
12722
+ var import_react158 = require("react");
12723
+ var import_jsx_runtime310 = require("react/jsx-runtime");
12529
12724
  var ToggleButtonGroup = (props) => {
12530
12725
  const {
12531
12726
  children,
@@ -12537,9 +12732,9 @@ var ToggleButtonGroup = (props) => {
12537
12732
  htmlProps,
12538
12733
  ...rest
12539
12734
  } = props;
12540
- const generatedId = (0, import_react156.useId)();
12735
+ const generatedId = (0, import_react158.useId)();
12541
12736
  const uniqueLabelId = labelId != null ? labelId : `${generatedId}-ToggleButtonGroupLabel`;
12542
- return /* @__PURE__ */ (0, import_jsx_runtime309.jsxs)(
12737
+ return /* @__PURE__ */ (0, import_jsx_runtime310.jsxs)(
12543
12738
  "div",
12544
12739
  {
12545
12740
  ...getBaseHTMLProps(
@@ -12551,8 +12746,8 @@ var ToggleButtonGroup = (props) => {
12551
12746
  role: "group",
12552
12747
  "aria-labelledby": label ? uniqueLabelId : void 0,
12553
12748
  children: [
12554
- !!label && /* @__PURE__ */ (0, import_jsx_runtime309.jsx)(Typography, { as: "span", typographyType: "labelMedium", id: uniqueLabelId, children: label }),
12555
- /* @__PURE__ */ (0, import_jsx_runtime309.jsx)("div", { className: cn(ToggleButton_default.group, ToggleButton_default[`group--${direction}`]), children })
12749
+ !!label && /* @__PURE__ */ (0, import_jsx_runtime310.jsx)(Typography, { as: "span", typographyType: "labelMedium", id: uniqueLabelId, children: label }),
12750
+ /* @__PURE__ */ (0, import_jsx_runtime310.jsx)("div", { className: cn(ToggleButton_default.group, ToggleButton_default[`group--${direction}`]), children })
12556
12751
  ]
12557
12752
  }
12558
12753
  );
@@ -12830,6 +13025,7 @@ ToggleButtonGroup.displayName = "ToggleButtonGroup";
12830
13025
  TimePicker,
12831
13026
  TingrettIcon,
12832
13027
  TipIcon,
13028
+ Toggle,
12833
13029
  ToggleBar,
12834
13030
  ToggleButton,
12835
13031
  ToggleButtonGroup,