@norges-domstoler/dds-components 11.0.0 → 11.1.1

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.
@@ -0,0 +1 @@
1
+ export declare function useElementHeight(element: HTMLDivElement | null): number | null;
@@ -3,10 +3,18 @@ export type DescriptionListAppearance = 'small' | 'bold';
3
3
  export type DescriptionListProps = BaseComponentPropsWithChildren<HTMLDListElement, {
4
4
  /**Påvirker tekst styling. */
5
5
  appearance?: DescriptionListAppearance;
6
+ /**Setter flex-direction. NB! Fungerer kun ved bruk av `DescriptionListGroup` som barn av `DescriptionList`.
7
+ * @default "column"
8
+ */
9
+ direction?: 'row' | 'column';
6
10
  }>;
7
11
  export declare const DescriptionList: import("react").ForwardRefExoticComponent<Pick<import("react").HTMLAttributes<HTMLDListElement>, "id" | "className"> & {
8
12
  /**Påvirker tekst styling. */
9
13
  appearance?: DescriptionListAppearance | undefined;
14
+ /**Setter flex-direction. NB! Fungerer kun ved bruk av `DescriptionListGroup` som barn av `DescriptionList`.
15
+ * @default "column"
16
+ */
17
+ direction?: "row" | "column" | undefined;
10
18
  } & {
11
19
  children?: import("react").ReactNode;
12
20
  } & {
@@ -3,6 +3,7 @@ declare const _default: {
3
3
  title: string;
4
4
  component: import("react").ForwardRefExoticComponent<Pick<import("react").HTMLAttributes<HTMLDListElement>, "id" | "className"> & {
5
5
  appearance?: import("./DescriptionList").DescriptionListAppearance | undefined;
6
+ direction?: "row" | "column" | undefined;
6
7
  } & {
7
8
  children?: import("react").ReactNode;
8
9
  } & {
@@ -14,4 +15,4 @@ export declare const Overview: () => JSX.Element;
14
15
  export declare const Default: (args: DescriptionListProps) => JSX.Element;
15
16
  export declare const Group: (args: DescriptionListProps) => JSX.Element;
16
17
  export declare const WithIcon: (args: DescriptionListProps) => JSX.Element;
17
- export declare const ColumnExample: (args: DescriptionListProps) => JSX.Element;
18
+ export declare const RowDirectionExample: (args: DescriptionListProps) => JSX.Element;
@@ -31,6 +31,9 @@ export declare const descriptionListTokens: {
31
31
  beforeNextTerm: {
32
32
  marginTop: string;
33
33
  };
34
+ rowDirection: {
35
+ columnGap: string;
36
+ };
34
37
  };
35
38
  group: {
36
39
  base: {
@@ -3,10 +3,18 @@ import { BaseComponentPropsWithChildren } from '../../types';
3
3
  export type DescriptionListGroupProps = BaseComponentPropsWithChildren<HTMLDivElement, {
4
4
  /**Custom margin. */
5
5
  margin?: Property.Margin<string>;
6
+ /**Custom min-width. */
7
+ minWidth?: Property.MinWidth<string>;
8
+ /**Custom max-width. */
9
+ maxWidth?: Property.MaxWidth<string>;
6
10
  }>;
7
11
  export declare const DescriptionListGroup: import("react").ForwardRefExoticComponent<Pick<import("react").HTMLAttributes<HTMLDivElement>, "id" | "className"> & {
8
12
  /**Custom margin. */
9
13
  margin?: Property.Margin<string> | undefined;
14
+ /**Custom min-width. */
15
+ minWidth?: Property.MinWidth<string> | undefined;
16
+ /**Custom max-width. */
17
+ maxWidth?: Property.MaxWidth<string> | undefined;
10
18
  } & {
11
19
  children?: import("react").ReactNode;
12
20
  } & {
@@ -12,5 +12,5 @@ export declare const InputMessage: import("react").ForwardRefExoticComponent<Pic
12
12
  /** Formålet med meldingen. Påvirker styling. */
13
13
  messageType: InputMessageType;
14
14
  } & {
15
- htmlProps?: import("react").HTMLAttributes<HTMLDivElement> | undefined; /** Meldingen som vises til brukeren. */
15
+ htmlProps?: import("react").HTMLAttributes<HTMLDivElement> | undefined;
16
16
  } & import("react").RefAttributes<HTMLDivElement>>;
package/dist/cjs/index.js CHANGED
@@ -2069,7 +2069,7 @@ var InputMessageWrapper = styled__default.default.div.withConfig({
2069
2069
  componentId: "sc-c954fy-0"
2070
2070
  })(["display:flex;width:fit-content;word-break:break-word;max-width:100%;", " svg{margin-top:", ";}"], function (_ref) {
2071
2071
  var messageType = _ref.messageType;
2072
- return messageType === 'tip' ? styled.css(["background-color:", ";"], inputMessageTokens.message.tip.backgroundColor) : messageType === 'error' ? styled.css(["color:", ";background-color:", ";padding:", ";gap:", ";"], inputMessageTokens.message.error.color, inputMessageTokens.message.error.backgroundColor, inputMessageTokens.message.error.padding, inputMessageTokens.message.error.gap) : '';
2072
+ return messageType === 'error' ? styled.css(["color:", ";background-color:", ";padding:", ";gap:", ";"], inputMessageTokens.message.error.color, inputMessageTokens.message.error.backgroundColor, inputMessageTokens.message.error.padding, inputMessageTokens.message.error.gap) : '';
2073
2073
  }, inputMessageTokens.icon.marginTop);
2074
2074
  var InputMessage = /*#__PURE__*/React.forwardRef(function (props, ref) {
2075
2075
  var message = props.message,
@@ -6399,6 +6399,9 @@ var desc$1 = {
6399
6399
  var list$7 = {
6400
6400
  beforeNextTerm: {
6401
6401
  marginTop: spacing$n.SizesDdsSpacingLocalX2
6402
+ },
6403
+ rowDirection: {
6404
+ columnGap: spacing$n.SizesDdsSpacingLocalX2
6402
6405
  }
6403
6406
  };
6404
6407
  var group$2 = {
@@ -6419,20 +6422,27 @@ var term = descriptionListTokens.term,
6419
6422
  var DList = styled__default.default.dl.withConfig({
6420
6423
  displayName: "DescriptionList__DList",
6421
6424
  componentId: "sc-1ob73hm-0"
6422
- })(["margin:0;*::selection{", "}", " & > dt:first-of-type{margin-top:", ";}& > dd:last-child{margin-bottom:", ";}dd + dt{margin-top:", ";}"], selection, function (_ref) {
6425
+ })(["margin:0;*::selection{", "}", " display:flex;flex-direction:column;&:not(:has(> dt):has(> dd)){flex-direction:", ";}flex-wrap:wrap;column-gap:", ";row-gap:0;& > dt:first-of-type{margin-top:", ";}& > dd:last-child{margin-bottom:", ";}dd + dt{margin-top:", ";}"], selection, function (_ref) {
6423
6426
  var appearance = _ref.appearance;
6424
6427
  return appearance && styled.css(["dt{color:", ";", " ", "}"], term.appearance[appearance].color, getFontStyling(termTypographyTypes[appearance]), appearance === 'bold' && styled.css(["font-weight:600;"]));
6425
- }, term.firstOfType.marginTop, desc.lastChild.marginBottom, list$6.beforeNextTerm.marginTop);
6428
+ }, function (_ref2) {
6429
+ var _ref2$direction = _ref2.direction,
6430
+ direction = _ref2$direction === void 0 ? 'column' : _ref2$direction;
6431
+ return direction;
6432
+ }, list$6.rowDirection.columnGap, term.firstOfType.marginTop, desc.lastChild.marginBottom, list$6.beforeNextTerm.marginTop);
6426
6433
  var DescriptionList = /*#__PURE__*/React.forwardRef(function (props, ref) {
6427
6434
  var _props$appearance = props.appearance,
6428
6435
  appearance = _props$appearance === void 0 ? 'bold' : _props$appearance,
6436
+ _props$direction = props.direction,
6437
+ direction = _props$direction === void 0 ? 'column' : _props$direction,
6429
6438
  children = props.children,
6430
6439
  id = props.id,
6431
6440
  className = props.className,
6432
6441
  htmlProps = props.htmlProps,
6433
- rest = tslib.__rest(props, ["appearance", "children", "id", "className", "htmlProps"]);
6442
+ rest = tslib.__rest(props, ["appearance", "direction", "children", "id", "className", "htmlProps"]);
6434
6443
  var dListProps = Object.assign(Object.assign({}, getBaseHTMLProps(id, className, htmlProps, rest)), {
6435
6444
  appearance: appearance,
6445
+ direction: direction,
6436
6446
  ref: ref
6437
6447
  });
6438
6448
  return jsxRuntime.jsx(DList, Object.assign({}, dListProps, {
@@ -6480,21 +6490,31 @@ var DescriptionListDesc = /*#__PURE__*/React.forwardRef(function (props, ref) {
6480
6490
  var DListGroup = styled__default.default.div.withConfig({
6481
6491
  displayName: "DescriptionListGroup__DListGroup",
6482
6492
  componentId: "sc-jkdc0o-0"
6483
- })(["margin:", ";"], function (_ref) {
6493
+ })(["margin:", ";", " ", ""], function (_ref) {
6484
6494
  var margin = _ref.margin;
6485
6495
  return margin ? margin : descriptionListTokens.group.base.margin;
6496
+ }, function (_ref2) {
6497
+ var minWidth = _ref2.minWidth;
6498
+ return minWidth && "min-width: ".concat(minWidth);
6499
+ }, function (_ref3) {
6500
+ var maxWidth = _ref3.maxWidth;
6501
+ return maxWidth && "max-width: ".concat(maxWidth);
6486
6502
  });
6487
6503
  var DescriptionListGroup = /*#__PURE__*/React.forwardRef(function (props, ref) {
6488
6504
  var children = props.children,
6489
6505
  margin = props.margin,
6506
+ minWidth = props.minWidth,
6507
+ maxWidth = props.maxWidth,
6490
6508
  id = props.id,
6491
6509
  className = props.className,
6492
6510
  htmlProps = props.htmlProps,
6493
- rest = tslib.__rest(props, ["children", "margin", "id", "className", "htmlProps"]);
6511
+ rest = tslib.__rest(props, ["children", "margin", "minWidth", "maxWidth", "id", "className", "htmlProps"]);
6494
6512
  var dListGroupProps = Object.assign(Object.assign({}, getBaseHTMLProps(id, className, htmlProps, rest)), {
6495
6513
  children: children,
6496
6514
  ref: ref,
6497
- margin: margin
6515
+ margin: margin,
6516
+ minWidth: minWidth,
6517
+ maxWidth: maxWidth
6498
6518
  });
6499
6519
  return jsxRuntime.jsx(DListGroup, Object.assign({}, dListGroupProps, {
6500
6520
  children: children
@@ -7535,7 +7555,25 @@ var useIsMounted = function useIsMounted() {
7535
7555
  }, []);
7536
7556
  };
7537
7557
 
7538
- var expandingAnimation = styled.css(["@media (prefers-reduced-motion:no-preference){transition:padding 0.2s,visibility 0.3s,max-height 0.2s cubic-bezier(0.4,0,0.2,1);}"]);
7558
+ function useElementHeight(element) {
7559
+ var _useState = React.useState(null),
7560
+ _useState2 = _slicedToArray(_useState, 2),
7561
+ height = _useState2[0],
7562
+ setHeight = _useState2[1];
7563
+ React.useEffect(function () {
7564
+ if (!element) return;
7565
+ var resizeObserver = new ResizeObserver(function () {
7566
+ setHeight(element.offsetHeight);
7567
+ });
7568
+ resizeObserver.observe(element);
7569
+ return function () {
7570
+ return resizeObserver.disconnect();
7571
+ };
7572
+ }, [element]);
7573
+ return height;
7574
+ }
7575
+
7576
+ var expandingAnimation = styled.css(["@media (prefers-reduced-motion:no-preference){transition:height 0.2s cubic-bezier(0.4,0,0.2,1);}"]);
7539
7577
  function getPadding(props) {
7540
7578
  var padding = props.padding;
7541
7579
  return padding || cardAccordionTokens.body.padding;
@@ -7543,28 +7581,20 @@ function getPadding(props) {
7543
7581
  var Body = styled__default.default.div.withConfig({
7544
7582
  displayName: "CardAccordionBody__Body",
7545
7583
  componentId: "sc-igsnpx-0"
7546
- })(["@media (prefers-reduced-motion:no-preference){", "}padding:", ";", " ", " ", ""], function (_ref) {
7584
+ })(["@media (prefers-reduced-motion:no-preference){", "}", " height:", "px;overflow:hidden;"], function (_ref) {
7547
7585
  var animate = _ref.animate;
7548
7586
  return animate && expandingAnimation;
7549
- }, getPadding, getFontStyling(typographyTypes$3.body), function (_ref2) {
7550
- var paddingTop = _ref2.paddingTop;
7551
- return paddingTop && styled.css(["padding-top:", ";"], paddingTop);
7552
- }, function (_ref3) {
7553
- var isExpanded = _ref3.isExpanded;
7554
- return !isExpanded && styled.css(["padding-top:0;padding-bottom:0;"]);
7587
+ }, getFontStyling(typographyTypes$3.body), function (_ref2) {
7588
+ var height = _ref2.height,
7589
+ isExpanded = _ref2.isExpanded;
7590
+ return isExpanded ? height : 0;
7555
7591
  });
7556
7592
  var BodyContainer = styled__default.default.div.withConfig({
7557
7593
  displayName: "CardAccordionBody__BodyContainer",
7558
7594
  componentId: "sc-igsnpx-1"
7559
- })(["", " overflow:hidden;visibility:", ";max-height:", "px;"], function (_ref4) {
7560
- var animate = _ref4.animate;
7561
- return animate && expandingAnimation;
7562
- }, function (_ref5) {
7563
- var isExpanded = _ref5.isExpanded;
7564
- return isExpanded ? 'visible' : 'hidden';
7565
- }, function (_ref6) {
7566
- var maxHeight = _ref6.maxHeight;
7567
- return maxHeight ? maxHeight : 0;
7595
+ })(["padding:", ";", ""], getPadding, function (_ref3) {
7596
+ var paddingTop = _ref3.paddingTop;
7597
+ return paddingTop && styled.css(["padding-top:", ";"], paddingTop);
7568
7598
  });
7569
7599
  var CardAccordionBody = /*#__PURE__*/React.forwardRef(function (props, ref) {
7570
7600
  var children = props.children,
@@ -7573,20 +7603,24 @@ var CardAccordionBody = /*#__PURE__*/React.forwardRef(function (props, ref) {
7573
7603
  id = props.id,
7574
7604
  className = props.className,
7575
7605
  htmlProps = props.htmlProps,
7576
- rest = tslib.__rest(props, ["children", "isExpanded", "headerId", "id", "className", "htmlProps"]);
7606
+ padding = props.padding,
7607
+ paddingTop = props.paddingTop,
7608
+ rest = tslib.__rest(props, ["children", "isExpanded", "headerId", "id", "className", "htmlProps", "padding", "paddingTop"]);
7577
7609
  var bodyRef = React.useRef(null);
7578
- var isMounted = useIsMounted();
7579
7610
  var _useState = React.useState(false),
7580
7611
  _useState2 = _slicedToArray(_useState, 2),
7581
7612
  animate = _useState2[0],
7582
7613
  setAnimate = _useState2[1];
7583
- var _useState3 = React.useState(0),
7614
+ var isMounted = useIsMounted();
7615
+ var height = useElementHeight(bodyRef.current);
7616
+ var _useState3 = React.useState(null),
7584
7617
  _useState4 = _slicedToArray(_useState3, 2),
7585
- maxHeight = _useState4[0],
7586
- setMaxHeight = _useState4[1];
7618
+ initialExpandedHeight = _useState4[0],
7619
+ setIntialExpandedHeight = _useState4[1];
7587
7620
  React.useLayoutEffect(function () {
7621
+ // For å unngå initiell animasjon dersom Accordion er satt til å være åpen som default.
7588
7622
  if (bodyRef.current && isExpanded) {
7589
- setMaxHeight(bodyRef.current.scrollHeight);
7623
+ setIntialExpandedHeight(bodyRef.current.scrollHeight);
7590
7624
  }
7591
7625
  }, []);
7592
7626
  React.useEffect(function () {
@@ -7594,22 +7628,17 @@ var CardAccordionBody = /*#__PURE__*/React.forwardRef(function (props, ref) {
7594
7628
  setAnimate(true);
7595
7629
  }
7596
7630
  }, [isMounted]);
7597
- React.useEffect(function () {
7598
- if (!isExpanded) {
7599
- setMaxHeight(0);
7600
- } else if (bodyRef && bodyRef.current) {
7601
- setMaxHeight(bodyRef.current.scrollHeight);
7602
- }
7603
- }, [isExpanded]);
7604
7631
  var bodyProps = Object.assign(Object.assign({}, getBaseHTMLProps(id, className, htmlProps, rest)), {
7605
7632
  ref: ref,
7606
7633
  isExpanded: isExpanded,
7607
- role: 'region'
7634
+ role: 'region',
7635
+ height: height || initialExpandedHeight || 0
7608
7636
  });
7609
7637
  var bodyContainerProps = {
7610
7638
  ref: bodyRef,
7611
- maxHeight: maxHeight,
7612
- isExpanded: isExpanded
7639
+ isExpanded: isExpanded,
7640
+ padding: padding,
7641
+ paddingTop: paddingTop
7613
7642
  };
7614
7643
  return jsxRuntime.jsx(Body, Object.assign({}, bodyProps, {
7615
7644
  animate: animate,
@@ -7,8 +7,9 @@ import useIsMounted from '../../../hooks/useIsMounted.js';
7
7
  import { getBaseHTMLProps } from '../../../types/BaseComponentProps.js';
8
8
  import { getFontStyling } from '../../Typography/Typography.utils.js';
9
9
  import { cardAccordionTokens, typographyTypes } from './CardAccordion.tokens.js';
10
+ import { useElementHeight } from './useElementHeight.js';
10
11
 
11
- var expandingAnimation = css(["@media (prefers-reduced-motion:no-preference){transition:padding 0.2s,visibility 0.3s,max-height 0.2s cubic-bezier(0.4,0,0.2,1);}"]);
12
+ var expandingAnimation = css(["@media (prefers-reduced-motion:no-preference){transition:height 0.2s cubic-bezier(0.4,0,0.2,1);}"]);
12
13
  function getPadding(props) {
13
14
  var padding = props.padding;
14
15
  return padding || cardAccordionTokens.body.padding;
@@ -16,28 +17,20 @@ function getPadding(props) {
16
17
  var Body = styled.div.withConfig({
17
18
  displayName: "CardAccordionBody__Body",
18
19
  componentId: "sc-igsnpx-0"
19
- })(["@media (prefers-reduced-motion:no-preference){", "}padding:", ";", " ", " ", ""], function (_ref) {
20
+ })(["@media (prefers-reduced-motion:no-preference){", "}", " height:", "px;overflow:hidden;"], function (_ref) {
20
21
  var animate = _ref.animate;
21
22
  return animate && expandingAnimation;
22
- }, getPadding, getFontStyling(typographyTypes.body), function (_ref2) {
23
- var paddingTop = _ref2.paddingTop;
24
- return paddingTop && css(["padding-top:", ";"], paddingTop);
25
- }, function (_ref3) {
26
- var isExpanded = _ref3.isExpanded;
27
- return !isExpanded && css(["padding-top:0;padding-bottom:0;"]);
23
+ }, getFontStyling(typographyTypes.body), function (_ref2) {
24
+ var height = _ref2.height,
25
+ isExpanded = _ref2.isExpanded;
26
+ return isExpanded ? height : 0;
28
27
  });
29
28
  var BodyContainer = styled.div.withConfig({
30
29
  displayName: "CardAccordionBody__BodyContainer",
31
30
  componentId: "sc-igsnpx-1"
32
- })(["", " overflow:hidden;visibility:", ";max-height:", "px;"], function (_ref4) {
33
- var animate = _ref4.animate;
34
- return animate && expandingAnimation;
35
- }, function (_ref5) {
36
- var isExpanded = _ref5.isExpanded;
37
- return isExpanded ? 'visible' : 'hidden';
38
- }, function (_ref6) {
39
- var maxHeight = _ref6.maxHeight;
40
- return maxHeight ? maxHeight : 0;
31
+ })(["padding:", ";", ""], getPadding, function (_ref3) {
32
+ var paddingTop = _ref3.paddingTop;
33
+ return paddingTop && css(["padding-top:", ";"], paddingTop);
41
34
  });
42
35
  var CardAccordionBody = /*#__PURE__*/forwardRef(function (props, ref) {
43
36
  var children = props.children,
@@ -46,20 +39,24 @@ var CardAccordionBody = /*#__PURE__*/forwardRef(function (props, ref) {
46
39
  id = props.id,
47
40
  className = props.className,
48
41
  htmlProps = props.htmlProps,
49
- rest = __rest(props, ["children", "isExpanded", "headerId", "id", "className", "htmlProps"]);
42
+ padding = props.padding,
43
+ paddingTop = props.paddingTop,
44
+ rest = __rest(props, ["children", "isExpanded", "headerId", "id", "className", "htmlProps", "padding", "paddingTop"]);
50
45
  var bodyRef = useRef(null);
51
- var isMounted = useIsMounted();
52
46
  var _useState = useState(false),
53
47
  _useState2 = _slicedToArray(_useState, 2),
54
48
  animate = _useState2[0],
55
49
  setAnimate = _useState2[1];
56
- var _useState3 = useState(0),
50
+ var isMounted = useIsMounted();
51
+ var height = useElementHeight(bodyRef.current);
52
+ var _useState3 = useState(null),
57
53
  _useState4 = _slicedToArray(_useState3, 2),
58
- maxHeight = _useState4[0],
59
- setMaxHeight = _useState4[1];
54
+ initialExpandedHeight = _useState4[0],
55
+ setIntialExpandedHeight = _useState4[1];
60
56
  useLayoutEffect(function () {
57
+ // For å unngå initiell animasjon dersom Accordion er satt til å være åpen som default.
61
58
  if (bodyRef.current && isExpanded) {
62
- setMaxHeight(bodyRef.current.scrollHeight);
59
+ setIntialExpandedHeight(bodyRef.current.scrollHeight);
63
60
  }
64
61
  }, []);
65
62
  useEffect(function () {
@@ -67,22 +64,17 @@ var CardAccordionBody = /*#__PURE__*/forwardRef(function (props, ref) {
67
64
  setAnimate(true);
68
65
  }
69
66
  }, [isMounted]);
70
- useEffect(function () {
71
- if (!isExpanded) {
72
- setMaxHeight(0);
73
- } else if (bodyRef && bodyRef.current) {
74
- setMaxHeight(bodyRef.current.scrollHeight);
75
- }
76
- }, [isExpanded]);
77
67
  var bodyProps = Object.assign(Object.assign({}, getBaseHTMLProps(id, className, htmlProps, rest)), {
78
68
  ref: ref,
79
69
  isExpanded: isExpanded,
80
- role: 'region'
70
+ role: 'region',
71
+ height: height || initialExpandedHeight || 0
81
72
  });
82
73
  var bodyContainerProps = {
83
74
  ref: bodyRef,
84
- maxHeight: maxHeight,
85
- isExpanded: isExpanded
75
+ isExpanded: isExpanded,
76
+ padding: padding,
77
+ paddingTop: paddingTop
86
78
  };
87
79
  return jsx(Body, Object.assign({}, bodyProps, {
88
80
  animate: animate,
@@ -0,0 +1 @@
1
+ export declare function useElementHeight(element: HTMLDivElement | null): number | null;
@@ -0,0 +1,22 @@
1
+ import { slicedToArray as _slicedToArray } from '../../../_virtual/_rollupPluginBabelHelpers.js';
2
+ import { useState, useEffect } from 'react';
3
+
4
+ function useElementHeight(element) {
5
+ var _useState = useState(null),
6
+ _useState2 = _slicedToArray(_useState, 2),
7
+ height = _useState2[0],
8
+ setHeight = _useState2[1];
9
+ useEffect(function () {
10
+ if (!element) return;
11
+ var resizeObserver = new ResizeObserver(function () {
12
+ setHeight(element.offsetHeight);
13
+ });
14
+ resizeObserver.observe(element);
15
+ return function () {
16
+ return resizeObserver.disconnect();
17
+ };
18
+ }, [element]);
19
+ return height;
20
+ }
21
+
22
+ export { useElementHeight };
@@ -3,10 +3,18 @@ export type DescriptionListAppearance = 'small' | 'bold';
3
3
  export type DescriptionListProps = BaseComponentPropsWithChildren<HTMLDListElement, {
4
4
  /**Påvirker tekst styling. */
5
5
  appearance?: DescriptionListAppearance;
6
+ /**Setter flex-direction. NB! Fungerer kun ved bruk av `DescriptionListGroup` som barn av `DescriptionList`.
7
+ * @default "column"
8
+ */
9
+ direction?: 'row' | 'column';
6
10
  }>;
7
11
  export declare const DescriptionList: import("react").ForwardRefExoticComponent<Pick<import("react").HTMLAttributes<HTMLDListElement>, "id" | "className"> & {
8
12
  /**Påvirker tekst styling. */
9
13
  appearance?: DescriptionListAppearance | undefined;
14
+ /**Setter flex-direction. NB! Fungerer kun ved bruk av `DescriptionListGroup` som barn av `DescriptionList`.
15
+ * @default "column"
16
+ */
17
+ direction?: "row" | "column" | undefined;
10
18
  } & {
11
19
  children?: import("react").ReactNode;
12
20
  } & {
@@ -17,20 +17,27 @@ var term = descriptionListTokens.term,
17
17
  var DList = styled.dl.withConfig({
18
18
  displayName: "DescriptionList__DList",
19
19
  componentId: "sc-1ob73hm-0"
20
- })(["margin:0;*::selection{", "}", " & > dt:first-of-type{margin-top:", ";}& > dd:last-child{margin-bottom:", ";}dd + dt{margin-top:", ";}"], selection, function (_ref) {
20
+ })(["margin:0;*::selection{", "}", " display:flex;flex-direction:column;&:not(:has(> dt):has(> dd)){flex-direction:", ";}flex-wrap:wrap;column-gap:", ";row-gap:0;& > dt:first-of-type{margin-top:", ";}& > dd:last-child{margin-bottom:", ";}dd + dt{margin-top:", ";}"], selection, function (_ref) {
21
21
  var appearance = _ref.appearance;
22
22
  return appearance && css(["dt{color:", ";", " ", "}"], term.appearance[appearance].color, getFontStyling(termTypographyTypes[appearance]), appearance === 'bold' && css(["font-weight:600;"]));
23
- }, term.firstOfType.marginTop, desc.lastChild.marginBottom, list.beforeNextTerm.marginTop);
23
+ }, function (_ref2) {
24
+ var _ref2$direction = _ref2.direction,
25
+ direction = _ref2$direction === void 0 ? 'column' : _ref2$direction;
26
+ return direction;
27
+ }, list.rowDirection.columnGap, term.firstOfType.marginTop, desc.lastChild.marginBottom, list.beforeNextTerm.marginTop);
24
28
  var DescriptionList = /*#__PURE__*/forwardRef(function (props, ref) {
25
29
  var _props$appearance = props.appearance,
26
30
  appearance = _props$appearance === void 0 ? 'bold' : _props$appearance,
31
+ _props$direction = props.direction,
32
+ direction = _props$direction === void 0 ? 'column' : _props$direction,
27
33
  children = props.children,
28
34
  id = props.id,
29
35
  className = props.className,
30
36
  htmlProps = props.htmlProps,
31
- rest = __rest(props, ["appearance", "children", "id", "className", "htmlProps"]);
37
+ rest = __rest(props, ["appearance", "direction", "children", "id", "className", "htmlProps"]);
32
38
  var dListProps = Object.assign(Object.assign({}, getBaseHTMLProps(id, className, htmlProps, rest)), {
33
39
  appearance: appearance,
40
+ direction: direction,
34
41
  ref: ref
35
42
  });
36
43
  return jsx(DList, Object.assign({}, dListProps, {
@@ -3,6 +3,7 @@ declare const _default: {
3
3
  title: string;
4
4
  component: import("react").ForwardRefExoticComponent<Pick<import("react").HTMLAttributes<HTMLDListElement>, "id" | "className"> & {
5
5
  appearance?: import("./DescriptionList").DescriptionListAppearance | undefined;
6
+ direction?: "row" | "column" | undefined;
6
7
  } & {
7
8
  children?: import("react").ReactNode;
8
9
  } & {
@@ -14,4 +15,4 @@ export declare const Overview: () => JSX.Element;
14
15
  export declare const Default: (args: DescriptionListProps) => JSX.Element;
15
16
  export declare const Group: (args: DescriptionListProps) => JSX.Element;
16
17
  export declare const WithIcon: (args: DescriptionListProps) => JSX.Element;
17
- export declare const ColumnExample: (args: DescriptionListProps) => JSX.Element;
18
+ export declare const RowDirectionExample: (args: DescriptionListProps) => JSX.Element;
@@ -31,6 +31,9 @@ export declare const descriptionListTokens: {
31
31
  beforeNextTerm: {
32
32
  marginTop: string;
33
33
  };
34
+ rowDirection: {
35
+ columnGap: string;
36
+ };
34
37
  };
35
38
  group: {
36
39
  base: {
@@ -32,6 +32,9 @@ var desc = {
32
32
  var list = {
33
33
  beforeNextTerm: {
34
34
  marginTop: spacing.SizesDdsSpacingLocalX2
35
+ },
36
+ rowDirection: {
37
+ columnGap: spacing.SizesDdsSpacingLocalX2
35
38
  }
36
39
  };
37
40
  var group = {
@@ -3,10 +3,18 @@ import { BaseComponentPropsWithChildren } from '../../types';
3
3
  export type DescriptionListGroupProps = BaseComponentPropsWithChildren<HTMLDivElement, {
4
4
  /**Custom margin. */
5
5
  margin?: Property.Margin<string>;
6
+ /**Custom min-width. */
7
+ minWidth?: Property.MinWidth<string>;
8
+ /**Custom max-width. */
9
+ maxWidth?: Property.MaxWidth<string>;
6
10
  }>;
7
11
  export declare const DescriptionListGroup: import("react").ForwardRefExoticComponent<Pick<import("react").HTMLAttributes<HTMLDivElement>, "id" | "className"> & {
8
12
  /**Custom margin. */
9
13
  margin?: Property.Margin<string> | undefined;
14
+ /**Custom min-width. */
15
+ minWidth?: Property.MinWidth<string> | undefined;
16
+ /**Custom max-width. */
17
+ maxWidth?: Property.MaxWidth<string> | undefined;
10
18
  } & {
11
19
  children?: import("react").ReactNode;
12
20
  } & {
@@ -8,21 +8,31 @@ import { getBaseHTMLProps } from '../../types/BaseComponentProps.js';
8
8
  var DListGroup = styled.div.withConfig({
9
9
  displayName: "DescriptionListGroup__DListGroup",
10
10
  componentId: "sc-jkdc0o-0"
11
- })(["margin:", ";"], function (_ref) {
11
+ })(["margin:", ";", " ", ""], function (_ref) {
12
12
  var margin = _ref.margin;
13
13
  return margin ? margin : descriptionListTokens.group.base.margin;
14
+ }, function (_ref2) {
15
+ var minWidth = _ref2.minWidth;
16
+ return minWidth && "min-width: ".concat(minWidth);
17
+ }, function (_ref3) {
18
+ var maxWidth = _ref3.maxWidth;
19
+ return maxWidth && "max-width: ".concat(maxWidth);
14
20
  });
15
21
  var DescriptionListGroup = /*#__PURE__*/forwardRef(function (props, ref) {
16
22
  var children = props.children,
17
23
  margin = props.margin,
24
+ minWidth = props.minWidth,
25
+ maxWidth = props.maxWidth,
18
26
  id = props.id,
19
27
  className = props.className,
20
28
  htmlProps = props.htmlProps,
21
- rest = __rest(props, ["children", "margin", "id", "className", "htmlProps"]);
29
+ rest = __rest(props, ["children", "margin", "minWidth", "maxWidth", "id", "className", "htmlProps"]);
22
30
  var dListGroupProps = Object.assign(Object.assign({}, getBaseHTMLProps(id, className, htmlProps, rest)), {
23
31
  children: children,
24
32
  ref: ref,
25
- margin: margin
33
+ margin: margin,
34
+ minWidth: minWidth,
35
+ maxWidth: maxWidth
26
36
  });
27
37
  return jsx(DListGroup, Object.assign({}, dListGroupProps, {
28
38
  children: children
@@ -12,5 +12,5 @@ export declare const InputMessage: import("react").ForwardRefExoticComponent<Pic
12
12
  /** Formålet med meldingen. Påvirker styling. */
13
13
  messageType: InputMessageType;
14
14
  } & {
15
- htmlProps?: import("react").HTMLAttributes<HTMLDivElement> | undefined; /** Meldingen som vises til brukeren. */
15
+ htmlProps?: import("react").HTMLAttributes<HTMLDivElement> | undefined;
16
16
  } & import("react").RefAttributes<HTMLDivElement>>;
@@ -22,7 +22,7 @@ var InputMessageWrapper = styled.div.withConfig({
22
22
  componentId: "sc-c954fy-0"
23
23
  })(["display:flex;width:fit-content;word-break:break-word;max-width:100%;", " svg{margin-top:", ";}"], function (_ref) {
24
24
  var messageType = _ref.messageType;
25
- return messageType === 'tip' ? css(["background-color:", ";"], inputMessageTokens.message.tip.backgroundColor) : messageType === 'error' ? css(["color:", ";background-color:", ";padding:", ";gap:", ";"], inputMessageTokens.message.error.color, inputMessageTokens.message.error.backgroundColor, inputMessageTokens.message.error.padding, inputMessageTokens.message.error.gap) : '';
25
+ return messageType === 'error' ? css(["color:", ";background-color:", ";padding:", ";gap:", ";"], inputMessageTokens.message.error.color, inputMessageTokens.message.error.backgroundColor, inputMessageTokens.message.error.padding, inputMessageTokens.message.error.gap) : '';
26
26
  }, inputMessageTokens.icon.marginTop);
27
27
  var InputMessage = /*#__PURE__*/forwardRef(function (props, ref) {
28
28
  var message = props.message,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@norges-domstoler/dds-components",
3
- "version": "11.0.0",
3
+ "version": "11.1.1",
4
4
  "description": "React components used in Elsa - domstolenes designsystem",
5
5
  "author": "Elsa team",
6
6
  "license": "MIT",