@norges-domstoler/dds-components 15.2.1 → 15.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.mjs CHANGED
@@ -5033,7 +5033,7 @@ var Breadcrumb = forwardRef14(
5033
5033
  Breadcrumb.displayName = "Breadcrumb";
5034
5034
 
5035
5035
  // src/components/Breadcrumbs/Breadcrumbs.tsx
5036
- import { Children as Children2, forwardRef as forwardRef15 } from "react";
5036
+ import { Children as Children2, forwardRef as forwardRef15, isValidElement as isValidElement2 } from "react";
5037
5037
  import styled24 from "styled-components";
5038
5038
 
5039
5039
  // src/components/Breadcrumbs/Breadcrumb.tokens.tsx
@@ -5044,7 +5044,10 @@ var icon2 = {
5044
5044
  color: colors12.DdsColorInteractiveBase
5045
5045
  };
5046
5046
  var listItem = {
5047
- gap: spacing11.SizesDdsSpacingX05
5047
+ gap: spacing11.SizesDdsSpacingX05,
5048
+ notSmallScreen: {
5049
+ padding: `${spacing11.SizesDdsSpacingX0125} 0`
5050
+ }
5048
5051
  };
5049
5052
  var list = {
5050
5053
  gap: spacing11.SizesDdsSpacingX05
@@ -5056,7 +5059,7 @@ var breadcrumbTokens = {
5056
5059
  };
5057
5060
 
5058
5061
  // src/components/Breadcrumbs/Breadcrumbs.tsx
5059
- import { jsx as jsx184, jsxs as jsxs29 } from "react/jsx-runtime";
5062
+ import { Fragment as Fragment5, jsx as jsx184, jsxs as jsxs29 } from "react/jsx-runtime";
5060
5063
  var { icon: icon3, list: list2, listItem: listItem2 } = breadcrumbTokens;
5061
5064
  var List = styled24.ol`
5062
5065
  ${removeListStyling}
@@ -5066,11 +5069,14 @@ var List = styled24.ol`
5066
5069
  gap: ${list2.gap};
5067
5070
  `;
5068
5071
  List.displayName = "List";
5069
- var ListItem = styled24.li`
5072
+ var ListItem = styled24.li.withConfig({
5073
+ shouldForwardProp: (prop) => prop !== "smallScreen"
5074
+ })`
5070
5075
  align-items: center;
5071
5076
  display: flex;
5072
5077
  gap: ${listItem2.gap};
5073
5078
  ${getFontStyling(typographyType2)}
5079
+ padding: ${({ smallScreen }) => smallScreen ? "0" : listItem2.notSmallScreen.padding};
5074
5080
  `;
5075
5081
  ListItem.displayName = "ListItem";
5076
5082
  var StyledIcon = styled24(Icon)`
@@ -5078,21 +5084,51 @@ var StyledIcon = styled24(Icon)`
5078
5084
  `;
5079
5085
  var Breadcrumbs = forwardRef15(
5080
5086
  (props, ref) => {
5081
- const { children, id, className, htmlProps, ...rest } = props;
5087
+ const { children, smallScreen, id, className, htmlProps, ...rest } = props;
5088
+ const chevronIcon = /* @__PURE__ */ jsx184(StyledIcon, { iconSize: "inherit", icon: ChevronRightIcon });
5082
5089
  const childrenArray = Children2.toArray(children);
5083
5090
  const breadcrumbChildren = childrenArray.map((item, index) => {
5084
- return /* @__PURE__ */ jsxs29(ListItem, { children: [
5085
- index !== 0 && /* @__PURE__ */ jsx184(StyledIcon, { icon: ChevronRightIcon }),
5091
+ return /* @__PURE__ */ jsxs29(ListItem, { smallScreen, children: [
5092
+ index !== 0 && chevronIcon,
5086
5093
  item
5087
5094
  ] }, `breadcrumb-${index}`);
5088
5095
  });
5096
+ const breadcrumbChildrenTruncated = childrenArray.length > 2 ? childrenArray.slice(1, childrenArray.length - 1).map((item) => {
5097
+ if (isValidElement2(item))
5098
+ return {
5099
+ title: item.props.children,
5100
+ href: item.props.href
5101
+ };
5102
+ }).filter((item) => item) : [];
5103
+ const breadcrumbChildrenSmallScreen = /* @__PURE__ */ jsxs29(Fragment5, { children: [
5104
+ /* @__PURE__ */ jsx184(ListItem, { smallScreen, children: childrenArray[0] }),
5105
+ breadcrumbChildrenTruncated.length > 0 && /* @__PURE__ */ jsxs29(ListItem, { smallScreen, children: [
5106
+ chevronIcon,
5107
+ /* @__PURE__ */ jsxs29(OverflowMenuGroup, { children: [
5108
+ /* @__PURE__ */ jsx184(
5109
+ Button,
5110
+ {
5111
+ size: "tiny",
5112
+ icon: MoreHorizontalIcon,
5113
+ appearance: "borderless",
5114
+ "aria-label": `Vis br\xF8dsmulesti br\xF8dsmule 2 ${breadcrumbChildrenTruncated.length > 1 && `til ${breadcrumbChildren.length - 1}`}`
5115
+ }
5116
+ ),
5117
+ /* @__PURE__ */ jsx184(OverflowMenu, { items: breadcrumbChildrenTruncated })
5118
+ ] })
5119
+ ] }),
5120
+ /* @__PURE__ */ jsxs29(ListItem, { smallScreen, children: [
5121
+ chevronIcon,
5122
+ childrenArray[childrenArray.length - 1]
5123
+ ] })
5124
+ ] });
5089
5125
  return /* @__PURE__ */ jsx184(
5090
5126
  "nav",
5091
5127
  {
5092
5128
  ...getBaseHTMLProps(id, className, htmlProps, rest),
5093
5129
  ref,
5094
5130
  "aria-label": "br\xF8dsmulesti",
5095
- children: /* @__PURE__ */ jsx184(List, { children: breadcrumbChildren })
5131
+ children: /* @__PURE__ */ jsx184(List, { children: smallScreen ? breadcrumbChildrenSmallScreen : breadcrumbChildren })
5096
5132
  }
5097
5133
  );
5098
5134
  }
@@ -6955,12 +6991,12 @@ Drawer.displayName = "Drawer";
6955
6991
  import {
6956
6992
  Children as ReactChildren2,
6957
6993
  cloneElement as cloneElement2,
6958
- isValidElement as isValidElement2,
6994
+ isValidElement as isValidElement3,
6959
6995
  useId as useId6,
6960
6996
  useRef as useRef18,
6961
6997
  useState as useState11
6962
6998
  } from "react";
6963
- import { Fragment as Fragment5, jsxs as jsxs39 } from "react/jsx-runtime";
6999
+ import { Fragment as Fragment6, jsxs as jsxs39 } from "react/jsx-runtime";
6964
7000
  var DrawerGroup = ({
6965
7001
  children,
6966
7002
  drawerId,
@@ -6982,7 +7018,7 @@ var DrawerGroup = ({
6982
7018
  onClose && onClose();
6983
7019
  };
6984
7020
  const Children9 = ReactChildren2.map(children, (child, childIndex) => {
6985
- return isValidElement2(child) && (childIndex === 0 ? cloneElement2(child, {
7021
+ return isValidElement3(child) && (childIndex === 0 ? cloneElement2(child, {
6986
7022
  "aria-haspopup": "dialog",
6987
7023
  "aria-controls": uniqueDrawerId,
6988
7024
  "aria-expanded": !closed,
@@ -6995,7 +7031,7 @@ var DrawerGroup = ({
6995
7031
  onClose: handleClose
6996
7032
  }));
6997
7033
  });
6998
- return /* @__PURE__ */ jsxs39(Fragment5, { children: [
7034
+ return /* @__PURE__ */ jsxs39(Fragment6, { children: [
6999
7035
  " ",
7000
7036
  Children9,
7001
7037
  " "
@@ -7484,7 +7520,7 @@ import {
7484
7520
  Children as ReactChildren3,
7485
7521
  cloneElement as cloneElement3,
7486
7522
  forwardRef as forwardRef33,
7487
- isValidElement as isValidElement3,
7523
+ isValidElement as isValidElement4,
7488
7524
  useEffect as useEffect19,
7489
7525
  useId as useId9,
7490
7526
  useRef as useRef21,
@@ -7614,7 +7650,7 @@ var Tooltip = forwardRef33(
7614
7650
  };
7615
7651
  const anchorProps = children.props;
7616
7652
  const anchorElement = ReactChildren3.only(
7617
- isValidElement3(children) && cloneElement3(children, {
7653
+ isValidElement4(children) && cloneElement3(children, {
7618
7654
  ref: refs.setReference,
7619
7655
  onFocus: combineHandlers(openTooltip, anchorProps.onFocus),
7620
7656
  onBlur: combineHandlers(closeTooltip, anchorProps.onBlur),
@@ -8683,10 +8719,10 @@ import { forwardRef as forwardRef36, useRef as useRef24 } from "react";
8683
8719
  import {
8684
8720
  Children as Children4,
8685
8721
  cloneElement as cloneElement4,
8686
- isValidElement as isValidElement4,
8722
+ isValidElement as isValidElement5,
8687
8723
  useState as useState17
8688
8724
  } from "react";
8689
- import { Fragment as Fragment6, jsx as jsx222 } from "react/jsx-runtime";
8725
+ import { Fragment as Fragment7, jsx as jsx222 } from "react/jsx-runtime";
8690
8726
  var InlineEdit = (props) => {
8691
8727
  const {
8692
8728
  emptiable,
@@ -8727,7 +8763,7 @@ var InlineEdit = (props) => {
8727
8763
  useOnKeyDown(["Escape"], () => onExitHandler());
8728
8764
  useOnClickOutside(inputRef.current, () => onExitHandler());
8729
8765
  const inputChild = Children4.only(
8730
- isValidElement4(children) && cloneElement4(children, {
8766
+ isValidElement5(children) && cloneElement4(children, {
8731
8767
  onChange: onChangeHandler,
8732
8768
  onBlur: onBlurHandler,
8733
8769
  onFocus: onFocusHandler,
@@ -8736,7 +8772,7 @@ var InlineEdit = (props) => {
8736
8772
  emptiable
8737
8773
  })
8738
8774
  );
8739
- return /* @__PURE__ */ jsx222(Fragment6, { children: inputChild });
8775
+ return /* @__PURE__ */ jsx222(Fragment7, { children: inputChild });
8740
8776
  };
8741
8777
  InlineEdit.displayName = "InlineEdit";
8742
8778
 
@@ -9481,7 +9517,7 @@ var localMessageTokens = {
9481
9517
  };
9482
9518
 
9483
9519
  // src/components/LocalMessage/LocalMessage.tsx
9484
- import { Fragment as Fragment7, jsx as jsx231, jsxs as jsxs53 } from "react/jsx-runtime";
9520
+ import { Fragment as Fragment8, jsx as jsx231, jsxs as jsxs53 } from "react/jsx-runtime";
9485
9521
  var { container: container10, content: content4, icon: icon6, purposeVariants: purposeVariants3 } = localMessageTokens;
9486
9522
  var Container8 = styled63.div.withConfig({
9487
9523
  shouldForwardProp: (prop) => {
@@ -9570,7 +9606,7 @@ var LocalMessage = forwardRef42(
9570
9606
  ref
9571
9607
  };
9572
9608
  if (isClosed) {
9573
- return /* @__PURE__ */ jsx231(Fragment7, {});
9609
+ return /* @__PURE__ */ jsx231(Fragment8, {});
9574
9610
  }
9575
9611
  return /* @__PURE__ */ jsxs53(Container8, { ...containerProps, children: [
9576
9612
  /* @__PURE__ */ jsx231(
@@ -10813,12 +10849,12 @@ Popover.displayName = "Popover";
10813
10849
  import {
10814
10850
  Children as ReactChildren4,
10815
10851
  cloneElement as cloneElement5,
10816
- isValidElement as isValidElement5,
10852
+ isValidElement as isValidElement6,
10817
10853
  useId as useId15,
10818
10854
  useRef as useRef28,
10819
10855
  useState as useState21
10820
10856
  } from "react";
10821
- import { Fragment as Fragment8, jsx as jsx239 } from "react/jsx-runtime";
10857
+ import { Fragment as Fragment9, jsx as jsx239 } from "react/jsx-runtime";
10822
10858
  var PopoverGroup = ({
10823
10859
  isOpen = false,
10824
10860
  onCloseButtonClick,
@@ -10848,7 +10884,7 @@ var PopoverGroup = ({
10848
10884
  });
10849
10885
  const handleClose = () => setOpen(false);
10850
10886
  const Children9 = ReactChildren4.map(children, (child, childIndex) => {
10851
- return isValidElement5(child) && (childIndex === 0 ? cloneElement5(child, {
10887
+ return isValidElement6(child) && (childIndex === 0 ? cloneElement5(child, {
10852
10888
  "aria-haspopup": "dialog",
10853
10889
  "aria-controls": uniquePopoverId,
10854
10890
  "aria-expanded": open,
@@ -10864,17 +10900,17 @@ var PopoverGroup = ({
10864
10900
  onClose: handleClose
10865
10901
  }));
10866
10902
  });
10867
- return /* @__PURE__ */ jsx239(Fragment8, { children: Children9 });
10903
+ return /* @__PURE__ */ jsx239(Fragment9, { children: Children9 });
10868
10904
  };
10869
10905
  PopoverGroup.displayName = "PopoverGroup";
10870
10906
 
10871
10907
  // src/components/ProgressTracker/ProgressTracker.tsx
10872
10908
  import {
10873
10909
  Children as Children5,
10874
- Fragment as Fragment9,
10910
+ Fragment as Fragment10,
10875
10911
  cloneElement as cloneElement6,
10876
10912
  forwardRef as forwardRef49,
10877
- isValidElement as isValidElement6,
10913
+ isValidElement as isValidElement7,
10878
10914
  useEffect as useEffect23,
10879
10915
  useMemo as useMemo3,
10880
10916
  useState as useState22
@@ -11197,7 +11233,7 @@ var ProgressTracker = (() => {
11197
11233
  return Res;
11198
11234
  })();
11199
11235
  function removeInvalidChildren(children) {
11200
- return Children5.toArray(children).filter(isValidElement6);
11236
+ return Children5.toArray(children).filter(isValidElement7);
11201
11237
  }
11202
11238
  function passIndexPropToProgressTrackerItem(children) {
11203
11239
  return Children5.map(
@@ -11212,7 +11248,7 @@ var intersperseItemsWithConnector = (children) => Children5.map(children, (child
11212
11248
  if (index === 0) {
11213
11249
  return child;
11214
11250
  }
11215
- return /* @__PURE__ */ jsxs60(Fragment9, { children: [
11251
+ return /* @__PURE__ */ jsxs60(Fragment10, { children: [
11216
11252
  /* @__PURE__ */ jsx241(ProgressTrackerConnector, { "aria-hidden": true }),
11217
11253
  child
11218
11254
  ] }, index);
@@ -11433,7 +11469,7 @@ var SearchSuggestions = forwardRef50((props, ref) => {
11433
11469
  SearchSuggestions.displayName = "SearchSuggestions";
11434
11470
 
11435
11471
  // src/components/Search/Search.tsx
11436
- import { Fragment as Fragment10, jsx as jsx243, jsxs as jsxs62 } from "react/jsx-runtime";
11472
+ import { Fragment as Fragment11, jsx as jsx243, jsxs as jsxs62 } from "react/jsx-runtime";
11437
11473
  var { input: input4, outerContainer: outerContainer6, horisontalContainer: horisontalContainer2, searchIcon: searchIcon2, clearButton: clearButton2 } = searchTokens;
11438
11474
  var getIconSize = (size2) => {
11439
11475
  switch (size2) {
@@ -11578,7 +11614,7 @@ var Search = forwardRef51(
11578
11614
  role: hasSuggestions ? "combobox" : void 0
11579
11615
  }
11580
11616
  ),
11581
- hasSuggestions && /* @__PURE__ */ jsxs62(Fragment10, { children: [
11617
+ hasSuggestions && /* @__PURE__ */ jsxs62(Fragment11, { children: [
11582
11618
  /* @__PURE__ */ jsx243(
11583
11619
  SearchSuggestions,
11584
11620
  {
@@ -12516,10 +12552,10 @@ SplitButton.displayName = "SplitButton";
12516
12552
  // src/components/Table/collapsible/CollapsibleRow.tsx
12517
12553
  import {
12518
12554
  Children as Children6,
12519
- Fragment as Fragment11,
12555
+ Fragment as Fragment12,
12520
12556
  cloneElement as cloneElement7,
12521
12557
  forwardRef as forwardRef64,
12522
- isValidElement as isValidElement7,
12558
+ isValidElement as isValidElement8,
12523
12559
  useEffect as useEffect26,
12524
12560
  useState as useState28
12525
12561
  } from "react";
@@ -12947,7 +12983,7 @@ Table2.Row = Row;
12947
12983
  Table2.Foot = Foot;
12948
12984
 
12949
12985
  // src/components/Table/collapsible/CollapsibleRow.tsx
12950
- import { Fragment as Fragment12, jsx as jsx259, jsxs as jsxs69 } from "react/jsx-runtime";
12986
+ import { Fragment as Fragment13, jsx as jsx259, jsxs as jsxs69 } from "react/jsx-runtime";
12951
12987
  var { collapseButton: collapseButton2 } = tableTokens;
12952
12988
  var CollapseButton = styled86.button`
12953
12989
  ${removeButtonStyling}
@@ -12997,9 +13033,9 @@ var CollapsibleRow = forwardRef64(
12997
13033
  const collapsedRenderedChildren = isCollapsed && collapsedHeaderValues.length > 0 ? collapsedChildren.map(function(child, index) {
12998
13034
  const id = derivativeIdGenerator(prefix2, index.toString());
12999
13035
  collapsibleIds.push(id);
13000
- return /* @__PURE__ */ jsxs69(Fragment11, { children: [
13036
+ return /* @__PURE__ */ jsxs69(Fragment12, { children: [
13001
13037
  /* @__PURE__ */ jsx259(DescriptionListTerm, { children: collapsedHeaderValues[index].content }),
13002
- isValidElement7(child) && cloneElement7(child, {
13038
+ isValidElement8(child) && cloneElement7(child, {
13003
13039
  collapsibleProps: { isCollapsibleChild: true }
13004
13040
  })
13005
13041
  ] }, `DL-${index}`);
@@ -13011,7 +13047,7 @@ var CollapsibleRow = forwardRef64(
13011
13047
  const headerRow = () => {
13012
13048
  if (type !== "head" || !isCollapsed)
13013
13049
  return null;
13014
- return /* @__PURE__ */ jsx259(StyledRow, { ref, type, ...rowProps, children: /* @__PURE__ */ jsxs69(Fragment12, { children: [
13050
+ return /* @__PURE__ */ jsx259(StyledRow, { ref, type, ...rowProps, children: /* @__PURE__ */ jsxs69(Fragment13, { children: [
13015
13051
  definingColumnCells,
13016
13052
  /* @__PURE__ */ jsxs69(Table2.Cell, { type: "head", layout: "center", children: [
13017
13053
  "Utvid",
@@ -13052,9 +13088,9 @@ var CollapsibleRow = forwardRef64(
13052
13088
  }
13053
13089
  );
13054
13090
  };
13055
- return isCollapsed && collapsedRenderedChildren && collapsedRenderedChildren.length > 0 ? /* @__PURE__ */ jsxs69(Fragment12, { children: [
13091
+ return isCollapsed && collapsedRenderedChildren && collapsedRenderedChildren.length > 0 ? /* @__PURE__ */ jsxs69(Fragment13, { children: [
13056
13092
  headerRow(),
13057
- type === "body" && /* @__PURE__ */ jsxs69(Fragment12, { children: [
13093
+ type === "body" && /* @__PURE__ */ jsxs69(Fragment13, { children: [
13058
13094
  rowWithChevron(),
13059
13095
  childrenCollapsed ? null : collapsedRows
13060
13096
  ] })
@@ -13385,7 +13421,7 @@ import {
13385
13421
  Children as Children7,
13386
13422
  cloneElement as cloneElement8,
13387
13423
  forwardRef as forwardRef68,
13388
- isValidElement as isValidElement8,
13424
+ isValidElement as isValidElement9,
13389
13425
  useState as useState30
13390
13426
  } from "react";
13391
13427
  import styled90, { css as css40 } from "styled-components";
@@ -13432,7 +13468,7 @@ var TabList = forwardRef68(
13432
13468
  const [focus, setFocus] = useRoveFocus(childrenArray, hasTabFocus, "row");
13433
13469
  const combinedRef = useCombinedRef(ref, tabListRef);
13434
13470
  const tabListChildren = Children7.map(children, (child, index) => {
13435
- return isValidElement8(child) && cloneElement8(child, {
13471
+ return isValidElement9(child) && cloneElement8(child, {
13436
13472
  id: `${tabsId}-tab-${index}`,
13437
13473
  "aria-controls": `${tabsId}-panel-${index}`,
13438
13474
  active: activeTab === index,
@@ -13515,7 +13551,7 @@ import {
13515
13551
  Children as Children8,
13516
13552
  cloneElement as cloneElement9,
13517
13553
  forwardRef as forwardRef70,
13518
- isValidElement as isValidElement9
13554
+ isValidElement as isValidElement10
13519
13555
  } from "react";
13520
13556
  import { jsx as jsx266 } from "react/jsx-runtime";
13521
13557
  var TabPanels = forwardRef70(
@@ -13524,7 +13560,7 @@ var TabPanels = forwardRef70(
13524
13560
  const combinedRef = useCombinedRef(ref, tabPanelsRef);
13525
13561
  const panelChildren = Children8.map(children, (child, index) => {
13526
13562
  const active = index === activeTab;
13527
- return isValidElement9(child) && cloneElement9(child, {
13563
+ return isValidElement10(child) && cloneElement9(child, {
13528
13564
  id: `${tabsId}-panel-${index}`,
13529
13565
  "aria-labelledby": `${tabsId}-tab-${index}`,
13530
13566
  active,