@norges-domstoler/dds-components 21.0.0 → 21.2.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
@@ -2664,6 +2664,7 @@ var getLiteralScreenSize = (screenSize) => {
2664
2664
  // src/components/helpers/StylelessList/StylelessList.tsx
2665
2665
  import { jsx as jsx176 } from "react/jsx-runtime";
2666
2666
  var StylelessList = ({ className, ...rest }) => /* @__PURE__ */ jsx176("ul", { ...rest, className: cn(className, utilStyles_default["remove-list-styling"]) });
2667
+ var StylelessOList = ({ className, ...rest }) => /* @__PURE__ */ jsx176("ul", { ...rest, className: cn(className, utilStyles_default["remove-list-styling"]) });
2667
2668
 
2668
2669
  // src/components/helpers/styling/utils.ts
2669
2670
  var outlineOffset = "var(--dds-spacing-x0-125)";
@@ -5939,6 +5940,7 @@ var DetailList_default = {
5939
5940
  "list--with-dividers": "DetailList_list--with-dividers",
5940
5941
  row: "DetailList_row",
5941
5942
  "list--striped": "DetailList_list--striped",
5943
+ "list--striped-with-bp": "DetailList_list--striped-with-bp",
5942
5944
  "list--small": "DetailList_list--small",
5943
5945
  cell: "DetailList_cell",
5944
5946
  "list--medium": "DetailList_list--medium",
@@ -5973,7 +5975,8 @@ var DetailList = ({
5973
5975
  DetailList_default.list,
5974
5976
  DetailList_default[`list--${size2}`],
5975
5977
  withDividers && DetailList_default["list--with-dividers"],
5976
- striped && DetailList_default["list--striped"]
5978
+ striped && !smallScreenBreakpoint && DetailList_default["list--striped"],
5979
+ striped && smallScreenBreakpoint && DetailList_default["list--striped-with-bp"]
5977
5980
  ),
5978
5981
  htmlProps,
5979
5982
  rest
@@ -5991,17 +5994,18 @@ DetailListDesc.displayName = "DetailListDesc";
5991
5994
  import { Fragment as Fragment5, jsx as jsx235, jsxs as jsxs46 } from "react/jsx-runtime";
5992
5995
  var DetailListRow = ({ className, ...rest }) => {
5993
5996
  const { smallScreenBreakpoint: bp } = useDetailListContext();
5997
+ const hasBp = !!bp;
5994
5998
  return /* @__PURE__ */ jsxs46(Fragment5, { children: [
5995
5999
  /* @__PURE__ */ jsx235(
5996
6000
  Box,
5997
6001
  {
5998
6002
  display: "table-row",
5999
- hideBelow: bp,
6003
+ hideBelow: hasBp ? bp : void 0,
6000
6004
  className: cn(className, DetailList_default.row),
6001
6005
  ...rest
6002
6006
  }
6003
6007
  ),
6004
- /* @__PURE__ */ jsx235(
6008
+ hasBp && /* @__PURE__ */ jsx235(
6005
6009
  Box,
6006
6010
  {
6007
6011
  display: "flex",
@@ -8182,8 +8186,7 @@ var LocalMessage = ({
8182
8186
  ),
8183
8187
  width,
8184
8188
  display: "grid",
8185
- alignItems: "center",
8186
- padding: "x0.75",
8189
+ padding: "x0.75 x0.75 x0.75 x0.5",
8187
8190
  gap: "x0.5",
8188
8191
  children: [
8189
8192
  /* @__PURE__ */ jsx271(
@@ -8203,7 +8206,7 @@ var LocalMessage = ({
8203
8206
  setClosed(true);
8204
8207
  onClose && onClose();
8205
8208
  },
8206
- size: "small",
8209
+ size: "xsmall",
8207
8210
  "aria-label": "Lukk melding",
8208
8211
  className: LocalMessage_default.container__button
8209
8212
  }
@@ -10240,7 +10243,8 @@ var useProgressTrackerContext = () => useContext18(ProgressTrackerContext);
10240
10243
  // src/components/ProgressTracker/ProgressTracker.module.css
10241
10244
  var ProgressTracker_default = {
10242
10245
  list: "ProgressTracker_list",
10243
- connector: "ProgressTracker_connector",
10246
+ "connector--column": "ProgressTracker_connector--column",
10247
+ "connector--row": "ProgressTracker_connector--row",
10244
10248
  item: "ProgressTracker_item",
10245
10249
  "item-button": "ProgressTracker_item-button",
10246
10250
  "item-number--active-incomplete": "ProgressTracker_item-number--active-incomplete",
@@ -10373,6 +10377,7 @@ var ProgressTracker = (() => {
10373
10377
  id,
10374
10378
  activeStep = 0,
10375
10379
  onStepChange,
10380
+ direction = "column",
10376
10381
  children,
10377
10382
  className,
10378
10383
  htmlProps,
@@ -10391,9 +10396,13 @@ var ProgressTracker = (() => {
10391
10396
  const steps = useMemo3(() => {
10392
10397
  const validChildren = removeInvalidChildren(children);
10393
10398
  const itemsWithIndex = passIndexPropToProgressTrackerItem(validChildren);
10394
- const itemsWithConnectorsBetween = intersperseItemsWithConnector(itemsWithIndex);
10399
+ const itemsWithConnectorsBetween = intersperseItemsWithConnector(
10400
+ itemsWithIndex,
10401
+ direction
10402
+ );
10395
10403
  return itemsWithConnectorsBetween;
10396
10404
  }, [children]);
10405
+ const isRow = direction === "row";
10397
10406
  return /* @__PURE__ */ jsx283(
10398
10407
  ProgressTrackerContext,
10399
10408
  {
@@ -10407,7 +10416,21 @@ var ProgressTracker = (() => {
10407
10416
  role: "group",
10408
10417
  "aria-label": "progress",
10409
10418
  ...getBaseHTMLProps(id, className, htmlProps, rest),
10410
- children: /* @__PURE__ */ jsx283("ol", { className: ProgressTracker_default.list, children: steps })
10419
+ children: /* @__PURE__ */ jsx283(
10420
+ Box,
10421
+ {
10422
+ as: StylelessOList,
10423
+ display: "flex",
10424
+ flexDirection: direction,
10425
+ alignItems: "start",
10426
+ gap: isRow ? "x0.5" : "x0.125",
10427
+ overflowX: isRow ? "auto" : void 0,
10428
+ margin: "0",
10429
+ padding: isRow ? "x0.25" : "0",
10430
+ className: cn(ProgressTracker_default.list, scrollbar),
10431
+ children: steps
10432
+ }
10433
+ )
10411
10434
  }
10412
10435
  )
10413
10436
  }
@@ -10429,12 +10452,12 @@ function passIndexPropToProgressTrackerItem(children) {
10429
10452
  })
10430
10453
  );
10431
10454
  }
10432
- var intersperseItemsWithConnector = (children) => Children3.map(children, (child, index) => {
10455
+ var intersperseItemsWithConnector = (children, direction) => Children3.map(children, (child, index) => {
10433
10456
  if (index === 0) {
10434
10457
  return child;
10435
10458
  }
10436
10459
  return /* @__PURE__ */ jsxs70(Fragment8, { children: [
10437
- /* @__PURE__ */ jsx283("div", { "aria-hidden": true, className: ProgressTracker_default.connector }),
10460
+ /* @__PURE__ */ jsx283("div", { "aria-hidden": true, className: ProgressTracker_default[`connector--${direction}`] }),
10438
10461
  child
10439
10462
  ] }, index);
10440
10463
  });
@@ -10541,17 +10564,11 @@ var useAutocompleteSearch = () => {
10541
10564
 
10542
10565
  // src/components/Search/Search.module.css
10543
10566
  var Search_default = {
10544
- container: "Search_container",
10545
- "input-group": "Search_input-group",
10546
10567
  "with-button-container": "Search_with-button-container",
10547
10568
  input: "Search_input",
10548
- "input--small": "Search_input--small",
10549
- "input--medium": "Search_input--medium",
10550
- "input--large": "Search_input--large",
10551
10569
  "search-icon": "Search_search-icon",
10552
10570
  "clear-button": "Search_clear-button",
10553
- suggestions: "Search_suggestions",
10554
- suggestions__header: "Search_suggestions__header"
10571
+ suggestions: "Search_suggestions"
10555
10572
  };
10556
10573
 
10557
10574
  // src/components/Search/Search.utils.ts
@@ -10657,15 +10674,20 @@ var SearchSuggestions = ({
10657
10674
  ),
10658
10675
  "aria-hidden": !showSuggestions,
10659
10676
  border: "border-default",
10677
+ position: "absolute",
10678
+ top: "100%",
10679
+ width: "100%",
10680
+ maxHeight: "300px",
10681
+ overflowY: "scroll",
10682
+ marginBlock: "x0.25 0",
10660
10683
  children: [
10661
10684
  /* @__PURE__ */ jsx286(
10662
- "span",
10685
+ Box,
10663
10686
  {
10687
+ as: "h2",
10688
+ paddingInline: "0 x1",
10664
10689
  id: suggestionsHeaderId,
10665
- className: cn(
10666
- Search_default.suggestions__header,
10667
- typographyStyles_default["body-xsmall"]
10668
- ),
10690
+ className: typographyStyles_default["body-xsmall"],
10669
10691
  children: "S\xF8keforslag"
10670
10692
  }
10671
10693
  ),
@@ -10702,14 +10724,34 @@ var getIconSize2 = (size2) => {
10702
10724
  return "small";
10703
10725
  }
10704
10726
  };
10727
+ var getPadding = (size2, showIcon) => {
10728
+ const paddingRight = (textSize) => `calc(
10729
+ var(--dds-spacing-x1) + ${textSize} * 1.5 + var(--dds-spacing-x0-5)
10730
+ )`;
10731
+ const paddingLeft = (iconSize) => `calc(
10732
+ var(--dds-spacing-x0-75) + ${iconSize} + var(--dds-spacing-x0-5)
10733
+ )`;
10734
+ const pRSmallButton = paddingRight("0.875rem");
10735
+ const pRMediumButton = paddingRight("1rem");
10736
+ const pLSmallIcon = paddingLeft("var(--dds-icon-size-small)");
10737
+ const pLMediumIcon = paddingLeft("var(--dds-icon-size-medium)");
10738
+ const paddingMap = {
10739
+ large: `x1 ${pRMediumButton} x1 ${showIcon ? pLMediumIcon : "x0.75"}`,
10740
+ medium: `x0.75 ${pRSmallButton} x0.75 ${showIcon ? pLMediumIcon : "x0.75"}`,
10741
+ small: `x0.5 ${pRSmallButton} x0.5 ${showIcon ? pLSmallIcon : "x0.75"}`
10742
+ };
10743
+ return paddingMap[size2];
10744
+ };
10705
10745
  var Search = ({
10706
10746
  componentSize = "medium",
10707
10747
  buttonProps,
10748
+ showIcon = true,
10708
10749
  name,
10709
10750
  label,
10710
10751
  tip,
10711
10752
  id,
10712
10753
  value,
10754
+ width,
10713
10755
  onChange,
10714
10756
  className,
10715
10757
  style,
@@ -10746,85 +10788,98 @@ var Search = ({
10746
10788
  } = buttonProps != null ? buttonProps : {};
10747
10789
  const hasSuggestions = !!context.suggestions;
10748
10790
  const showSearchButton = !!buttonProps && !!onClick;
10749
- return /* @__PURE__ */ jsxs73("div", { className: Search_default.container, children: [
10791
+ const inputGroup = /* @__PURE__ */ jsxs73(
10792
+ HStack,
10793
+ {
10794
+ position: "relative",
10795
+ width: !showSearchButton ? width : void 0,
10796
+ className: !showSearchButton ? className : void 0,
10797
+ children: [
10798
+ showIcon && /* @__PURE__ */ jsx287(
10799
+ Icon,
10800
+ {
10801
+ icon: SearchIcon,
10802
+ iconSize: getIconSize2(componentSize),
10803
+ className: cn(
10804
+ Input_default["input-group__absolute-element"],
10805
+ Search_default["search-icon"]
10806
+ )
10807
+ }
10808
+ ),
10809
+ /* @__PURE__ */ jsx287(
10810
+ Box,
10811
+ {
10812
+ as: Input,
10813
+ ...rest,
10814
+ ref: combinedRef,
10815
+ name,
10816
+ type: "search",
10817
+ id: uniqueId,
10818
+ "aria-describedby": spaceSeparatedIdListGenerator([
10819
+ tip ? tipId : void 0,
10820
+ context.suggestions ? suggestionsDescriptionId : void 0,
10821
+ ariaDescribedby
10822
+ ]),
10823
+ value: (_a = context.inputValue) != null ? _a : value,
10824
+ onChange: handleChange,
10825
+ autoComplete: "off",
10826
+ "aria-autocomplete": hasSuggestions ? "list" : void 0,
10827
+ "aria-controls": hasSuggestions ? suggestionsId : void 0,
10828
+ "aria-expanded": context.showSuggestions,
10829
+ role: hasSuggestions ? "combobox" : void 0,
10830
+ width: "100%",
10831
+ padding: getPadding(componentSize, showIcon),
10832
+ className: cn(
10833
+ Search_default.input,
10834
+ typographyStyles_default[getTypographyCn(typographyTypes2[componentSize])]
10835
+ )
10836
+ }
10837
+ ),
10838
+ hasSuggestions && /* @__PURE__ */ jsxs73(Fragment9, { children: [
10839
+ /* @__PURE__ */ jsx287(
10840
+ SearchSuggestions,
10841
+ {
10842
+ id: suggestionsId,
10843
+ ref: context.suggestionsRef,
10844
+ searchId: uniqueId,
10845
+ onSuggestionClick: context.onSugggestionClick,
10846
+ suggestions: context.suggestions,
10847
+ showSuggestions: context.showSuggestions,
10848
+ componentSize
10849
+ }
10850
+ ),
10851
+ /* @__PURE__ */ jsx287(VisuallyHidden, { id: suggestionsDescriptionId, as: "span", children: "Bla i s\xF8keforslag med piltaster n\xE5r listen er utvidet." })
10852
+ ] }),
10853
+ hasValue && /* @__PURE__ */ jsx287(
10854
+ Button,
10855
+ {
10856
+ icon: CloseSmallIcon,
10857
+ size: componentSize === "large" ? "medium" : "small",
10858
+ purpose: "tertiary",
10859
+ "aria-label": "T\xF8m",
10860
+ onClick: clearInput,
10861
+ className: Search_default["clear-button"]
10862
+ }
10863
+ )
10864
+ ]
10865
+ }
10866
+ );
10867
+ return /* @__PURE__ */ jsxs73(VStack, { gap: "x0.125", children: [
10750
10868
  hasLabel && /* @__PURE__ */ jsx287(Label, { htmlFor: uniqueId, children: label }),
10751
10869
  /* @__PURE__ */ jsxs73("div", { children: [
10752
- /* @__PURE__ */ jsxs73(
10753
- "div",
10870
+ showSearchButton ? /* @__PURE__ */ jsxs73(
10871
+ Grid,
10754
10872
  {
10755
- className: cn(
10756
- className,
10757
- showSearchButton && Search_default["with-button-container"]
10758
- ),
10873
+ className,
10874
+ width,
10875
+ columnGap: "x0.5",
10876
+ rowGap: "0",
10877
+ marginInline: "0",
10878
+ gridTemplateColumns: "1fr auto",
10759
10879
  style,
10760
10880
  children: [
10761
- /* @__PURE__ */ jsxs73("div", { className: Search_default["input-group"], children: [
10762
- /* @__PURE__ */ jsx287(
10763
- Icon,
10764
- {
10765
- icon: SearchIcon,
10766
- iconSize: getIconSize2(componentSize),
10767
- className: cn(
10768
- Input_default["input-group__absolute-element"],
10769
- Search_default["search-icon"]
10770
- )
10771
- }
10772
- ),
10773
- /* @__PURE__ */ jsx287(
10774
- Input,
10775
- {
10776
- ...rest,
10777
- ref: combinedRef,
10778
- name,
10779
- type: "search",
10780
- id: uniqueId,
10781
- "aria-describedby": spaceSeparatedIdListGenerator([
10782
- tip ? tipId : void 0,
10783
- context.suggestions ? suggestionsDescriptionId : void 0,
10784
- ariaDescribedby
10785
- ]),
10786
- value: (_a = context.inputValue) != null ? _a : value,
10787
- onChange: handleChange,
10788
- autoComplete: "off",
10789
- "aria-autocomplete": hasSuggestions ? "list" : void 0,
10790
- "aria-controls": hasSuggestions ? suggestionsId : void 0,
10791
- "aria-expanded": context.showSuggestions,
10792
- role: hasSuggestions ? "combobox" : void 0,
10793
- className: cn(
10794
- Search_default.input,
10795
- Search_default[`input--${componentSize}`],
10796
- typographyStyles_default[getTypographyCn(typographyTypes2[componentSize])]
10797
- )
10798
- }
10799
- ),
10800
- hasSuggestions && /* @__PURE__ */ jsxs73(Fragment9, { children: [
10801
- /* @__PURE__ */ jsx287(
10802
- SearchSuggestions,
10803
- {
10804
- id: suggestionsId,
10805
- ref: context.suggestionsRef,
10806
- searchId: uniqueId,
10807
- onSuggestionClick: context.onSugggestionClick,
10808
- suggestions: context.suggestions,
10809
- showSuggestions: context.showSuggestions,
10810
- componentSize
10811
- }
10812
- ),
10813
- /* @__PURE__ */ jsx287(VisuallyHidden, { id: suggestionsDescriptionId, as: "span", children: "Bla i s\xF8keforslag med piltaster n\xE5r listen er utvidet." })
10814
- ] }),
10815
- hasValue && /* @__PURE__ */ jsx287(
10816
- Button,
10817
- {
10818
- icon: CloseSmallIcon,
10819
- size: componentSize === "large" ? "medium" : "small",
10820
- purpose: "tertiary",
10821
- "aria-label": "T\xF8m",
10822
- onClick: clearInput,
10823
- className: Search_default["clear-button"]
10824
- }
10825
- )
10826
- ] }),
10827
- showSearchButton && /* @__PURE__ */ jsx287(
10881
+ inputGroup,
10882
+ /* @__PURE__ */ jsx287(
10828
10883
  Button,
10829
10884
  {
10830
10885
  size: componentSize,
@@ -10835,7 +10890,7 @@ var Search = ({
10835
10890
  )
10836
10891
  ]
10837
10892
  }
10838
- ),
10893
+ ) : inputGroup,
10839
10894
  renderInputMessage(tip, tipId)
10840
10895
  ] })
10841
10896
  ] });
@@ -12958,6 +13013,7 @@ export {
12958
13013
  StarIcon,
12959
13014
  StatefulInput,
12960
13015
  StylelessList,
13016
+ StylelessOList,
12961
13017
  SvgWrapper,
12962
13018
  SyncIcon,
12963
13019
  Tab,