@norges-domstoler/dds-components 0.0.0-dev-20250702125907 → 0.0.0-dev-20250703081704

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.d.mts CHANGED
@@ -173,9 +173,7 @@ interface PrimitiveDisplayProps {
173
173
  /** Viser komponenten kun under det angitte brekkpunktet. */
174
174
  showBelow?: Breakpoint;
175
175
  }
176
- type BreakpointBasedProp<T> = {
177
- [k in Breakpoint]?: T;
178
- };
176
+ type BreakpointBasedProp<T> = Partial<Record<Breakpoint, T>>;
179
177
  type ResponsiveProp<T> = T | BreakpointBasedProp<T>;
180
178
  interface PrimitiveLayoutProps {
181
179
  /** CSS `width`. Støtter verdi per brekkpunkt eller samme for alle skjermstørrelser. */
package/dist/index.d.ts CHANGED
@@ -173,9 +173,7 @@ interface PrimitiveDisplayProps {
173
173
  /** Viser komponenten kun under det angitte brekkpunktet. */
174
174
  showBelow?: Breakpoint;
175
175
  }
176
- type BreakpointBasedProp<T> = {
177
- [k in Breakpoint]?: T;
178
- };
176
+ type BreakpointBasedProp<T> = Partial<Record<Breakpoint, T>>;
179
177
  type ResponsiveProp<T> = T | BreakpointBasedProp<T>;
180
178
  interface PrimitiveLayoutProps {
181
179
  /** CSS `width`. Støtter verdi per brekkpunkt eller samme for alle skjermstørrelser. */
package/dist/index.js CHANGED
@@ -608,8 +608,8 @@ var getTextColor = (color) => {
608
608
  // src/utils/combineHandlers.tsx
609
609
  var combineHandlers = (handler1, handler2) => {
610
610
  const callback = (event) => {
611
- handler1 && handler1(event);
612
- handler2 && handler2(event);
611
+ handler1 == null ? void 0 : handler1(event);
612
+ handler2 == null ? void 0 : handler2(event);
613
613
  };
614
614
  return callback;
615
615
  };
@@ -657,7 +657,7 @@ var readOnlyMouseDownHandler = (readOnly, onMouseDown) => {
657
657
  if (readOnly) {
658
658
  evt.preventDefault();
659
659
  evt.target.focus();
660
- } else onMouseDown && onMouseDown(evt);
660
+ } else onMouseDown == null ? void 0 : onMouseDown(evt);
661
661
  };
662
662
  };
663
663
  var readOnlyKeyDownHandler = (type, readOnly, onKeyDown) => {
@@ -670,7 +670,7 @@ var readOnlyKeyDownHandler = (type, readOnly, onKeyDown) => {
670
670
  } else if (type === "selectionControl" && evt.key === " ") {
671
671
  evt.preventDefault();
672
672
  }
673
- } else onKeyDown && onKeyDown(evt);
673
+ } else onKeyDown == null ? void 0 : onKeyDown(evt);
674
674
  };
675
675
  };
676
676
  var readOnlyChangeHandler = (readOnly, onChange) => {
@@ -678,7 +678,7 @@ var readOnlyChangeHandler = (readOnly, onChange) => {
678
678
  if (readOnly) {
679
679
  return;
680
680
  }
681
- onChange && onChange(evt);
681
+ onChange == null ? void 0 : onChange(evt);
682
682
  };
683
683
  };
684
684
  var readOnlyClickHandler = (readOnly, onClick) => {
@@ -687,7 +687,7 @@ var readOnlyClickHandler = (readOnly, onClick) => {
687
687
  evt.preventDefault();
688
688
  return;
689
689
  }
690
- onClick && onClick(evt);
690
+ onClick == null ? void 0 : onClick(evt);
691
691
  };
692
692
  };
693
693
 
@@ -4691,13 +4691,13 @@ var OverflowMenuGroup = ({
4691
4691
  const combinedMenuRef = useCombinedRef(menuRef, floatingRef);
4692
4692
  const handleClose = () => {
4693
4693
  if (isOpen) {
4694
- onClose && onClose();
4694
+ onClose == null ? void 0 : onClose();
4695
4695
  close();
4696
4696
  }
4697
4697
  };
4698
4698
  const handleToggle = () => {
4699
- !isOpen && (onOpen == null ? void 0 : onOpen());
4700
- isOpen && (onClose == null ? void 0 : onClose());
4699
+ if (!isOpen) onOpen == null ? void 0 : onOpen();
4700
+ if (isOpen) onClose == null ? void 0 : onClose();
4701
4701
  toggle();
4702
4702
  };
4703
4703
  useOnClickOutside([menuRef.current, buttonRef.current], () => {
@@ -4706,7 +4706,7 @@ var OverflowMenuGroup = ({
4706
4706
  useOnKeyDown(["Esc", "Escape"], () => {
4707
4707
  var _a;
4708
4708
  if (isOpen) {
4709
- onClose && onClose();
4709
+ onClose == null ? void 0 : onClose();
4710
4710
  close();
4711
4711
  (_a = buttonRef.current) == null ? void 0 : _a.focus();
4712
4712
  }
@@ -5487,7 +5487,7 @@ var RadioButton = ({
5487
5487
  const radioButtonGroup = useRadioButtonGroup();
5488
5488
  const handleChange = (event) => {
5489
5489
  var _a;
5490
- onChange && onChange(event);
5490
+ onChange == null ? void 0 : onChange(event);
5491
5491
  (_a = radioButtonGroup == null ? void 0 : radioButtonGroup.onChange) == null ? void 0 : _a.call(radioButtonGroup, event, event.target.value);
5492
5492
  };
5493
5493
  const describedByIds = [];
@@ -5863,7 +5863,7 @@ var Chip = ({
5863
5863
  const [isOpen, setIsOpen] = (0, import_react35.useState)(true);
5864
5864
  const onClick = () => {
5865
5865
  setIsOpen(false);
5866
- onClose && onClose();
5866
+ onClose == null ? void 0 : onClose();
5867
5867
  };
5868
5868
  return isOpen ? /* @__PURE__ */ (0, import_jsx_runtime221.jsxs)(
5869
5869
  "div",
@@ -7793,7 +7793,9 @@ var Tooltip = ({
7793
7793
  const combinedRef = useCombinedRef(ref, refs.setFloating, tooltipRef);
7794
7794
  const closeWhenNotInView = (entries) => {
7795
7795
  const [entry] = entries;
7796
- entry.isIntersecting ? setInView(true) : setInView(false);
7796
+ if (entry.isIntersecting) {
7797
+ setInView(true);
7798
+ } else setInView(false);
7797
7799
  };
7798
7800
  (0, import_react56.useEffect)(() => {
7799
7801
  const options = {
@@ -7987,26 +7989,26 @@ var Feedback = ({
7987
7989
  const tThumbUpTooltip = thumbUpTooltip != null ? thumbUpTooltip : t(texts11.good);
7988
7990
  const tThumbDownTooltip = thumbDownTooltip != null ? thumbDownTooltip : t(texts11.bad);
7989
7991
  (0, import_react57.useEffect)(() => {
7990
- ratingProp !== void 0 && setRating(ratingProp);
7992
+ if (ratingProp !== void 0) setRating(ratingProp);
7991
7993
  }, [ratingProp]);
7992
7994
  (0, import_react57.useEffect)(() => {
7993
- feedbackTextProp !== void 0 && setFeedbackText(feedbackTextProp);
7995
+ if (feedbackTextProp !== void 0) setFeedbackText(feedbackTextProp);
7994
7996
  }, [feedbackTextProp]);
7995
7997
  (0, import_react57.useEffect)(() => {
7996
- isSubmittedProp !== void 0 && setIsFeedbackSubmitted(isSubmittedProp);
7998
+ if (isSubmittedProp !== void 0) setIsFeedbackSubmitted(isSubmittedProp);
7997
7999
  }, [isSubmittedProp]);
7998
8000
  const handleRatingChange = (newRating) => {
7999
- onRating && onRating(newRating);
8000
- onSubmit && feedbackTextAreaExcluded && onSubmit(newRating, "");
8001
- ratingProp === void 0 && setRating(newRating);
8001
+ onRating == null ? void 0 : onRating(newRating);
8002
+ if (onSubmit && feedbackTextAreaExcluded) onSubmit(newRating, "");
8003
+ if (ratingProp === void 0) setRating(newRating);
8002
8004
  };
8003
8005
  const handleFeedbackTextChange = (newFeedbackText) => {
8004
- onFeedbackTextChange && onFeedbackTextChange(newFeedbackText);
8005
- feedbackTextProp === void 0 && setFeedbackText(newFeedbackText);
8006
+ onFeedbackTextChange == null ? void 0 : onFeedbackTextChange(newFeedbackText);
8007
+ if (feedbackTextProp === void 0) setFeedbackText(newFeedbackText);
8006
8008
  };
8007
8009
  const handleSubmit = () => {
8008
- onSubmit && onSubmit(rating, feedbackText != null ? feedbackText : "");
8009
- isSubmittedProp === void 0 && setIsFeedbackSubmitted(true);
8010
+ onSubmit == null ? void 0 : onSubmit(rating, feedbackText != null ? feedbackText : "");
8011
+ if (isSubmittedProp === void 0) setIsFeedbackSubmitted(true);
8010
8012
  };
8011
8013
  if (rating === null && !isFeedbackSubmitted) {
8012
8014
  return /* @__PURE__ */ (0, import_jsx_runtime253.jsx)(
@@ -8466,11 +8468,9 @@ var useFileUploader = (props) => {
8466
8468
  () => ({
8467
8469
  onBlur: onRootBlur,
8468
8470
  onFocus: onRootFocus,
8469
- // eslint-disable-next-line @typescript-eslint/no-misused-promises
8470
8471
  onDragEnter: onRootDragEnter,
8471
8472
  onDragOver: onRootDragOver,
8472
8473
  onDragLeave: onRootDragLeave,
8473
- // eslint-disable-next-line @typescript-eslint/no-misused-promises
8474
8474
  onDrop: setFiles,
8475
8475
  ref: rootRef
8476
8476
  }),
@@ -8497,7 +8497,6 @@ var useFileUploader = (props) => {
8497
8497
  style: { display: "none" },
8498
8498
  tabIndex: -1,
8499
8499
  ref: inputRef,
8500
- // eslint-disable-next-line @typescript-eslint/no-misused-promises
8501
8500
  onChange: setFiles,
8502
8501
  multiple: !maxFiles || maxFiles > 1,
8503
8502
  ...accept ? { accept: accept.join(",") } : {}
@@ -8806,7 +8805,7 @@ var GlobalMessage = ({
8806
8805
  purpose: "tertiary",
8807
8806
  onClick: () => {
8808
8807
  setClosed(true);
8809
- onClose && onClose();
8808
+ onClose == null ? void 0 : onClose();
8810
8809
  },
8811
8810
  size: "small",
8812
8811
  "aria-label": t(commonTexts.closeMessage)
@@ -9511,7 +9510,7 @@ var LocalMessage = ({
9511
9510
  purpose: "tertiary",
9512
9511
  onClick: () => {
9513
9512
  setClosed(true);
9514
- onClose && onClose();
9513
+ onClose == null ? void 0 : onClose();
9515
9514
  },
9516
9515
  size: "xsmall",
9517
9516
  "aria-label": t(commonTexts.closeMessage),
@@ -10388,7 +10387,7 @@ var Pagination = ({
10388
10387
  const pagesLength = Math.ceil(itemsAmount / itemsPerPage);
10389
10388
  const items = PaginationGenerator(pagesLength, activePage);
10390
10389
  const onPageChange = (event, page) => {
10391
- page && setActivePage(page);
10390
+ if (page) setActivePage(page);
10392
10391
  if (event && onChange) {
10393
10392
  onChange(event, page);
10394
10393
  }
@@ -11433,7 +11432,7 @@ var Popover = ({
11433
11432
  );
11434
11433
  const multiRef = useCombinedRef(ref, popoverRef, floatingRef);
11435
11434
  (0, import_react75.useEffect)(() => {
11436
- setFloatOptions && setFloatOptions({ placement, offset });
11435
+ setFloatOptions == null ? void 0 : setFloatOptions({ placement, offset });
11437
11436
  }, [placement, offset]);
11438
11437
  useOnClickOutside([popoverRef.current, anchorEl], () => {
11439
11438
  if (isOpen && !hasContext) onClose == null ? void 0 : onClose();
@@ -11522,11 +11521,11 @@ var PopoverGroup = ({
11522
11521
  const { refs, styles: positionStyles } = useFloatPosition(null, floatOptions);
11523
11522
  const handleClose = () => {
11524
11523
  setOpen(false);
11525
- onClose && onClose();
11524
+ onClose == null ? void 0 : onClose();
11526
11525
  };
11527
11526
  const handleOpen = () => {
11528
11527
  setOpen(true);
11529
- onOpen && onOpen();
11528
+ onOpen == null ? void 0 : onOpen();
11530
11529
  };
11531
11530
  const handleToggle = () => {
11532
11531
  if (open) {
@@ -11655,8 +11654,8 @@ var ProgressTrackerItem = (props) => {
11655
11654
  const itemState = toItemState(active, completed, disabled);
11656
11655
  const handleClick = () => {
11657
11656
  if (!disabled) {
11658
- onClick && onClick(index);
11659
- handleStepChange && handleStepChange(index);
11657
+ onClick == null ? void 0 : onClick(index);
11658
+ handleStepChange == null ? void 0 : handleStepChange(index);
11660
11659
  }
11661
11660
  };
11662
11661
  const stepNumberContent = (0, import_react78.useMemo)(() => {
@@ -11774,7 +11773,7 @@ var ProgressTracker = (() => {
11774
11773
  const [thisActiveStep, setActiveStep] = (0, import_react79.useState)(activeStep);
11775
11774
  const handleChange = (step) => {
11776
11775
  setActiveStep(step);
11777
- onStepChange && onStepChange(step);
11776
+ onStepChange == null ? void 0 : onStepChange(step);
11778
11777
  };
11779
11778
  (0, import_react79.useEffect)(() => {
11780
11779
  if (activeStep !== void 0 && activeStep != thisActiveStep) {
@@ -12136,9 +12135,10 @@ var Search = ({
12136
12135
  const context = useAutocompleteSearch();
12137
12136
  const combinedRef = context.inputRef ? useCombinedRef(context.inputRef, ref) : ref;
12138
12137
  const handleChange = (e) => {
12138
+ var _a2;
12139
12139
  setHasValue(e.target.value !== "");
12140
- context.onValueChange && context.onValueChange(e);
12141
- onChange && onChange(e);
12140
+ (_a2 = context == null ? void 0 : context.onValueChange) == null ? void 0 : _a2.call(context, e);
12141
+ onChange == null ? void 0 : onChange(e);
12142
12142
  };
12143
12143
  const clearInput = () => {
12144
12144
  const clearChangeEvent = createClearChangeEvent(uniqueId);
@@ -12325,12 +12325,12 @@ var SearchAutocompleteWrapper = (props) => {
12325
12325
  } else {
12326
12326
  setSuggestions([]);
12327
12327
  }
12328
- onChange && onChange(e);
12328
+ onChange == null ? void 0 : onChange(e);
12329
12329
  };
12330
12330
  const handleSuggestionClick = (e) => {
12331
12331
  setSuggestions([]);
12332
12332
  handleSetInputValue(e.target.innerText);
12333
- onSuggestionSelection && onSuggestionSelection();
12333
+ onSuggestionSelection == null ? void 0 : onSuggestionSelection();
12334
12334
  closeSuggestions();
12335
12335
  };
12336
12336
  const handleSetInputValue = (value2) => {
@@ -12752,7 +12752,7 @@ var CollapsibleRow = ({
12752
12752
  const { isCollapsed, headerValues, definingColumnIndex } = useCollapsibleTableContext();
12753
12753
  const [childrenCollapsed, setChildrenCollapsed] = (0, import_react89.useState)(true);
12754
12754
  (0, import_react89.useEffect)(() => {
12755
- !isCollapsed && setChildrenCollapsed(true);
12755
+ if (!isCollapsed) setChildrenCollapsed(true);
12756
12756
  }, [isCollapsed]);
12757
12757
  const rowProps = (isOpenCollapsibleHeader) => {
12758
12758
  return {
@@ -13006,7 +13006,7 @@ var Tabs = ({
13006
13006
  const tabPanelsRef = (0, import_react93.useRef)(null);
13007
13007
  const handleTabChange = (index) => {
13008
13008
  setActiveTab(index);
13009
- onChange && onChange(index);
13009
+ onChange == null ? void 0 : onChange(index);
13010
13010
  };
13011
13011
  (0, import_react93.useEffect)(() => {
13012
13012
  if (activeTab !== void 0 && activeTab !== thisActiveTab) {
@@ -13167,7 +13167,7 @@ var TabList = ({
13167
13167
  const [widths, setWidths] = (0, import_react95.useState)([]);
13168
13168
  const handleOnFocus = (event) => {
13169
13169
  setHasTabFocus(true);
13170
- onFocus && onFocus(event);
13170
+ onFocus == null ? void 0 : onFocus(event);
13171
13171
  };
13172
13172
  const handleOnBlur = (event) => {
13173
13173
  var _a;
@@ -13780,8 +13780,9 @@ var ToggleRadio = ({
13780
13780
  const uniqueId = id != null ? id : `${generatedId}-ToggleRadio`;
13781
13781
  const group = useToggleBarContext();
13782
13782
  const handleChange = (event) => {
13783
- onChange && onChange(event);
13784
- (group == null ? void 0 : group.onChange) && group.onChange(event);
13783
+ var _a;
13784
+ onChange == null ? void 0 : onChange(event);
13785
+ (_a = group == null ? void 0 : group.onChange) == null ? void 0 : _a.call(group, event);
13785
13786
  };
13786
13787
  const contentTypeCn = label ? "with-text" : "just-icon";
13787
13788
  return /* @__PURE__ */ (0, import_jsx_runtime321.jsxs)("label", { htmlFor: uniqueId, className: ToggleBar_default.label, children: [