@norges-domstoler/dds-components 5.2.0-beta.1 → 5.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.
Files changed (71) hide show
  1. package/README.md +14 -3
  2. package/dist/assets/svg/calendar_today.svg.js +1 -1
  3. package/dist/cjs/components/DescriptionList/DescriptionList.tokens.d.ts +70 -0
  4. package/dist/cjs/components/Modal/Modal.tokens.d.ts +0 -6
  5. package/dist/cjs/components/Modal/ModalBody.d.ts +6 -1
  6. package/dist/cjs/components/ScrollableContainer/ScrollableContainer.d.ts +7 -0
  7. package/dist/cjs/components/ScrollableContainer/ScrollableContainer.stories.d.ts +15 -0
  8. package/dist/cjs/components/ScrollableContainer/ScrollableContainer.tokens.d.ts +25 -0
  9. package/dist/cjs/components/ScrollableContainer/Scrollbar.d.ts +7 -0
  10. package/dist/cjs/components/ScrollableContainer/index.d.ts +3 -0
  11. package/dist/cjs/components/ScrollableContainer/scrollbarStyling.d.ts +26 -0
  12. package/dist/cjs/components/Select/Select.tokens.d.ts +0 -3
  13. package/dist/cjs/helpers/styling/index.d.ts +0 -1
  14. package/dist/cjs/icons/tsx/closeSmall.d.ts +2 -0
  15. package/dist/cjs/icons/tsx/index.d.ts +1 -0
  16. package/dist/cjs/index.d.ts +1 -0
  17. package/dist/cjs/index.js +951 -626
  18. package/dist/components/Datepicker/Datepicker.js +1 -1
  19. package/dist/components/DescriptionList/DescriptionList.js +6 -3
  20. package/dist/components/DescriptionList/DescriptionList.tokens.d.ts +70 -0
  21. package/dist/components/DescriptionList/DescriptionList.tokens.js +60 -0
  22. package/dist/components/DescriptionList/DescriptionListDesc.js +2 -2
  23. package/dist/components/DescriptionList/DescriptionListGroup.js +4 -4
  24. package/dist/components/Drawer/Drawer.js +12 -10
  25. package/dist/components/List/List.js +1 -1
  26. package/dist/components/Modal/Modal.tokens.d.ts +0 -6
  27. package/dist/components/Modal/Modal.tokens.js +0 -10
  28. package/dist/components/Modal/ModalBody.d.ts +6 -1
  29. package/dist/components/Modal/ModalBody.js +13 -13
  30. package/dist/components/OverflowMenu/OverflowMenu.js +3 -3
  31. package/dist/components/Pagination/Pagination.js +1 -1
  32. package/dist/components/ScrollableContainer/ScrollableContainer.d.ts +7 -0
  33. package/dist/components/ScrollableContainer/ScrollableContainer.js +47 -0
  34. package/dist/components/ScrollableContainer/ScrollableContainer.stories.d.ts +15 -0
  35. package/dist/components/ScrollableContainer/ScrollableContainer.tokens.d.ts +25 -0
  36. package/dist/components/ScrollableContainer/ScrollableContainer.tokens.js +36 -0
  37. package/dist/components/ScrollableContainer/Scrollbar.d.ts +7 -0
  38. package/dist/components/ScrollableContainer/Scrollbar.js +178 -0
  39. package/dist/components/ScrollableContainer/index.d.ts +3 -0
  40. package/dist/components/ScrollableContainer/scrollbarStyling.d.ts +26 -0
  41. package/dist/components/ScrollableContainer/scrollbarStyling.js +40 -0
  42. package/dist/components/Select/Select.js +38 -3
  43. package/dist/components/Select/Select.styles.js +7 -4
  44. package/dist/components/Select/Select.tokens.d.ts +0 -3
  45. package/dist/components/Select/Select.tokens.js +6 -18
  46. package/dist/components/Table/SortCell.js +1 -1
  47. package/dist/components/Table/Table.js +2 -2
  48. package/dist/components/Table/TableWrapper.js +3 -3
  49. package/dist/components/Tabs/TabList.js +2 -2
  50. package/dist/components/TextInput/TextInput.styles.js +2 -2
  51. package/dist/components/TextInput/TextInput.tokens.js +1 -1
  52. package/dist/helpers/styling/focusVisible.js +3 -2
  53. package/dist/helpers/styling/index.d.ts +0 -1
  54. package/dist/icons/tsx/closeSmall.d.ts +2 -0
  55. package/dist/icons/tsx/closeSmall.js +25 -0
  56. package/dist/icons/tsx/index.d.ts +1 -0
  57. package/dist/index.d.ts +1 -0
  58. package/dist/index.js +4 -0
  59. package/package.json +2 -4
  60. package/dist/cjs/components/DescriptionList/DescriptionListDesc.tokens.d.ts +0 -7
  61. package/dist/cjs/components/DescriptionList/DescriptionListGroup.tokens.d.ts +0 -4
  62. package/dist/cjs/components/DescriptionList/DescriptionListTerm.tokens.d.ts +0 -13
  63. package/dist/cjs/helpers/styling/scrollbarStyling.d.ts +0 -3
  64. package/dist/components/DescriptionList/DescriptionListDesc.tokens.d.ts +0 -7
  65. package/dist/components/DescriptionList/DescriptionListDesc.tokens.js +0 -22
  66. package/dist/components/DescriptionList/DescriptionListGroup.tokens.d.ts +0 -4
  67. package/dist/components/DescriptionList/DescriptionListGroup.tokens.js +0 -11
  68. package/dist/components/DescriptionList/DescriptionListTerm.tokens.d.ts +0 -13
  69. package/dist/components/DescriptionList/DescriptionListTerm.tokens.js +0 -27
  70. package/dist/helpers/styling/scrollbarStyling.d.ts +0 -3
  71. package/dist/helpers/styling/scrollbarStyling.js +0 -8
@@ -18,7 +18,7 @@ var getWidth = function getWidth(type) {
18
18
  var StyledInput = styled(StatefulInput).withConfig({
19
19
  displayName: "Datepicker__StyledInput",
20
20
  componentId: "sc-1ijxhje-0"
21
- })(["::-webkit-calendar-picker-indicator{background-image:url(\"", "\");", " margin-left:0px;padding:0;top:50%;transform:translate(0,-50%);box-sizing:border-box;}::-webkit-datetime-edit-fields-wrapper{padding:0;}::-webkit-calendar-picker-indicator:focus-visible{", "}::-webkit-inner-spin-button{display:none;}@media (prefers-reduced-motion:no-preference){::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-year-field,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute-field{transition:0.2s;}}::-webkit-datetime-edit-day-field:focus,::-webkit-datetime-edit-month-field:focus,::-webkit-datetime-edit-year-field:focus,::-webkit-datetime-edit-hour-field:focus,::-webkit-datetime-edit-minute-field:focus{", "}"], CalendarIcon, datepickerTokens.calendarIndicator.base, datepickerTokens.calendarIndicator.focus.base, typographyTokens.selection.base);
21
+ })(["&::-webkit-calendar-picker-indicator{background-image:", ";", " margin-left:0px;padding:0;top:50%;transform:translate(0,-50%);box-sizing:border-box;}&::-webkit-datetime-edit-fields-wrapper{padding:0;}&::-webkit-calendar-picker-indicator:focus-visible{", "}&::-webkit-inner-spin-button{display:none;}@media (prefers-reduced-motion:no-preference){::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-year-field,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute-field{transition:0.2s;}}&::-webkit-datetime-edit-day-field:focus,&::-webkit-datetime-edit-month-field:focus,&::-webkit-datetime-edit-year-field:focus,&::-webkit-datetime-edit-hour-field:focus,&::-webkit-datetime-edit-minute-field:focus{", "}"], "url(\"".concat(CalendarIcon, "\")"), datepickerTokens.calendarIndicator.base, datepickerTokens.calendarIndicator.focus.base, typographyTokens.selection.base);
22
22
  var nextUniqueId = 0;
23
23
  var Datepicker = /*#__PURE__*/forwardRef(function (_a, ref) {
24
24
  var id = _a.id,
@@ -3,16 +3,19 @@ import { jsx } from 'react/jsx-runtime';
3
3
  import { forwardRef } from 'react';
4
4
  import styled, { css } from 'styled-components';
5
5
  import { typographyTokens } from '../Typography/Typography.tokens.js';
6
- import { descriptionListTermTokens } from './DescriptionListTerm.tokens.js';
6
+ import { descriptionListTokens } from './DescriptionList.tokens.js';
7
7
  import { getBaseHTMLProps } from '../../types/BaseComponentProps.js';
8
8
 
9
+ var term = descriptionListTokens.term,
10
+ desc = descriptionListTokens.desc,
11
+ list = descriptionListTokens.list;
9
12
  var DList = styled.dl.withConfig({
10
13
  displayName: "DescriptionList__DList",
11
14
  componentId: "sc-1ob73hm-0"
12
15
  })(["margin:0;*::selection{", "}", " & > dt:first-of-type{margin-top:", ";}& > dd:last-child{margin-bottom:", ";}dd + dt{margin-top:", ";}"], typographyTokens.selection.base, function (_ref) {
13
16
  var appearance = _ref.appearance;
14
- return appearance && css(["dt{", "}"], descriptionListTermTokens.appearance[appearance].base);
15
- }, descriptionListTermTokens.unwrappedTopAndBottomSpace, descriptionListTermTokens.unwrappedTopAndBottomSpace, descriptionListTermTokens.unwrappedBetweenSpace);
17
+ return appearance && css(["dt{", " color:", ";line-height:", ";font-size:", ";letter-spacing:", ";font-family:", ";font-weight:", ";font-style:", ";}"], term.appearance[appearance].font, term.appearance[appearance].color, term.appearance[appearance].lineHeight, term.appearance[appearance].fontSize, term.appearance[appearance].letterSpacing, term.appearance[appearance].fontFamily, term.appearance[appearance].fontWeight, term.appearance[appearance].fontStyle);
18
+ }, term.firstOfType.marginTop, desc.lastChild.marginBottom, list.beforeNextTerm.marginTop);
16
19
  var DescriptionList = /*#__PURE__*/forwardRef(function (props, ref) {
17
20
  var _props$appearance = props.appearance,
18
21
  appearance = _props$appearance === void 0 ? 'bold' : _props$appearance,
@@ -0,0 +1,70 @@
1
+ export declare const descriptionListTokens: {
2
+ term: {
3
+ appearance: {
4
+ small: {
5
+ font: {
6
+ lineHeight: any;
7
+ fontSize: string;
8
+ letterSpacing: any;
9
+ fontFamily: any;
10
+ fontWeight: any;
11
+ fontStyle: any;
12
+ };
13
+ color: string;
14
+ lineHeight: any;
15
+ fontSize: string;
16
+ letterSpacing: any;
17
+ fontFamily: any;
18
+ fontWeight: any;
19
+ fontStyle: any;
20
+ };
21
+ bold: {
22
+ font: {
23
+ lineHeight: any;
24
+ fontSize: string;
25
+ letterSpacing: any;
26
+ fontFamily: any;
27
+ fontWeight: any;
28
+ fontStyle: any;
29
+ };
30
+ lineHeight: any;
31
+ fontSize: string;
32
+ letterSpacing: any;
33
+ fontFamily: any;
34
+ fontWeight: number;
35
+ fontStyle: any;
36
+ color: string;
37
+ };
38
+ };
39
+ firstOfType: {
40
+ marginTop: string;
41
+ };
42
+ };
43
+ desc: {
44
+ base: {
45
+ font: {
46
+ lineHeight: any;
47
+ fontSize: string;
48
+ letterSpacing: any;
49
+ fontFamily: any;
50
+ fontWeight: any;
51
+ fontStyle: any;
52
+ };
53
+ gap: string;
54
+ color: string;
55
+ };
56
+ lastChild: {
57
+ marginBottom: string;
58
+ };
59
+ };
60
+ list: {
61
+ beforeNextTerm: {
62
+ marginTop: string;
63
+ };
64
+ };
65
+ group: {
66
+ base: {
67
+ margin: string;
68
+ };
69
+ };
70
+ };
@@ -0,0 +1,60 @@
1
+ import { ddsBaseTokens } from '@norges-domstoler/dds-design-tokens';
2
+
3
+ var spacing = ddsBaseTokens.spacing,
4
+ fontPackages = ddsBaseTokens.fontPackages,
5
+ colors = ddsBaseTokens.colors;
6
+ var term = {
7
+ appearance: {
8
+ small: {
9
+ font: fontPackages.body_sans_01.base,
10
+ color: colors.DdsColorNeutralsGray7,
11
+ lineHeight: fontPackages.body_sans_01.base.lineHeight,
12
+ fontSize: fontPackages.body_sans_01.base.fontSize,
13
+ letterSpacing: fontPackages.body_sans_01.base.letterSpacing,
14
+ fontFamily: fontPackages.body_sans_01.base.fontFamily,
15
+ fontWeight: fontPackages.body_sans_01.base.fontWeight,
16
+ fontStyle: fontPackages.body_sans_01.base.fontStyle
17
+ },
18
+ bold: {
19
+ font: fontPackages.body_sans_03.base,
20
+ lineHeight: fontPackages.body_sans_03.base.lineHeight,
21
+ fontSize: fontPackages.body_sans_03.base.fontSize,
22
+ letterSpacing: fontPackages.body_sans_03.base.letterSpacing,
23
+ fontFamily: fontPackages.body_sans_03.base.fontFamily,
24
+ fontWeight: 600,
25
+ fontStyle: fontPackages.body_sans_03.base.fontStyle,
26
+ color: colors.DdsColorNeutralsGray9
27
+ }
28
+ },
29
+ firstOfType: {
30
+ marginTop: spacing.SizesDdsSpacingLocalX1
31
+ }
32
+ };
33
+ var desc = {
34
+ base: {
35
+ font: fontPackages.body_sans_03.base,
36
+ gap: spacing.SizesDdsSpacingLocalX025,
37
+ color: colors.DdsColorNeutralsGray9
38
+ },
39
+ lastChild: {
40
+ marginBottom: spacing.SizesDdsSpacingLocalX1
41
+ }
42
+ };
43
+ var list = {
44
+ beforeNextTerm: {
45
+ marginTop: spacing.SizesDdsSpacingLocalX2
46
+ }
47
+ };
48
+ var group = {
49
+ base: {
50
+ margin: spacing.SizesDdsSpacingLocalX2
51
+ }
52
+ };
53
+ var descriptionListTokens = {
54
+ term: term,
55
+ desc: desc,
56
+ list: list,
57
+ group: group
58
+ };
59
+
60
+ export { descriptionListTokens };
@@ -2,14 +2,14 @@ import { __rest } from 'tslib';
2
2
  import { jsxs, jsx } from 'react/jsx-runtime';
3
3
  import { forwardRef } from 'react';
4
4
  import styled from 'styled-components';
5
- import { descriptionListDescTokens } from './DescriptionListDesc.tokens.js';
5
+ import { descriptionListTokens } from './DescriptionList.tokens.js';
6
6
  import { getBaseHTMLProps } from '../../types/BaseComponentProps.js';
7
7
  import { Icon } from '../Icon/Icon.js';
8
8
 
9
9
  var DListDesc = styled.dd.withConfig({
10
10
  displayName: "DescriptionListDesc__DListDesc",
11
11
  componentId: "sc-1djcf0s-0"
12
- })(["", " margin-inline-start:0;"], descriptionListDescTokens.base);
12
+ })(["margin-inline-start:0;align-items:center;display:flex;color:", ";", ";gap:", ";"], descriptionListTokens.desc.base.color, descriptionListTokens.desc.base.font, descriptionListTokens.desc.base.gap);
13
13
  var DescriptionListDesc = /*#__PURE__*/forwardRef(function (props, ref) {
14
14
  var children = props.children,
15
15
  icon = props.icon,
@@ -1,16 +1,16 @@
1
1
  import { __rest } from 'tslib';
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
  import { forwardRef } from 'react';
4
- import styled, { css } from 'styled-components';
5
- import { descriptionListGroupTokens } from './DescriptionListGroup.tokens.js';
4
+ import styled from 'styled-components';
5
+ import { descriptionListTokens } from './DescriptionList.tokens.js';
6
6
  import { getBaseHTMLProps } from '../../types/BaseComponentProps.js';
7
7
 
8
8
  var DListGroup = styled.div.withConfig({
9
9
  displayName: "DescriptionListGroup__DListGroup",
10
10
  componentId: "sc-jkdc0o-0"
11
- })(["", " ", ""], descriptionListGroupTokens.base, function (_ref) {
11
+ })(["margin:", ";"], function (_ref) {
12
12
  var margin = _ref.margin;
13
- return margin && css(["margin:", ";"], margin);
13
+ return margin ? margin : descriptionListTokens.group.base.margin;
14
14
  });
15
15
  var DescriptionListGroup = /*#__PURE__*/forwardRef(function (props, ref) {
16
16
  var children = props.children,
@@ -8,13 +8,13 @@ import { drawerTokens } from './Drawer.tokens.js';
8
8
  import { Paper } from '../../helpers/Paper/Paper.js';
9
9
  import { useMountTransition } from '../../hooks/useMountTransition.js';
10
10
  import { focusVisible } from '../../helpers/styling/focusVisible.js';
11
- import { scrollbarStyling } from '../../helpers/styling/scrollbarStyling.js';
12
11
  import { Button } from '../Button/Button.js';
13
12
  import { useFocusTrap } from '../../hooks/useFocusTrap.js';
14
13
  import { useCombinedRef } from '../../hooks/useCombinedRefs.js';
15
14
  import { useOnKeyDown } from '../../hooks/useOnKeyDown.js';
16
15
  import { useOnClickOutside } from '../../hooks/useOnClickOutside.js';
17
16
  import { getBaseHTMLProps } from '../../types/BaseComponentProps.js';
17
+ import { ScrollableContainer } from '../ScrollableContainer/ScrollableContainer.js';
18
18
  import { Typography } from '../Typography/Typography.js';
19
19
  import { CloseIcon } from '../../icons/tsx/close.js';
20
20
 
@@ -35,7 +35,7 @@ var Container = styled(Paper).withConfig({
35
35
  var ContentContainer = styled.div.withConfig({
36
36
  displayName: "Drawer__ContentContainer",
37
37
  componentId: "sc-i9luw3-1"
38
- })(["display:flex;flex-direction:column;overflow-x:auto;", " ", ""], scrollbarStyling, drawerTokens.contentContainer.base);
38
+ })(["display:flex;flex-direction:column;", ""], drawerTokens.contentContainer.base);
39
39
  var HeaderContainer = styled.div.withConfig({
40
40
  displayName: "Drawer__HeaderContainer",
41
41
  componentId: "sc-i9luw3-2"
@@ -98,14 +98,16 @@ var Drawer = /*#__PURE__*/forwardRef(function (props, ref) {
98
98
  id: headerId
99
99
  };
100
100
  return isOpen || hasTransitionedIn ? /*#__PURE__*/createPortal(jsxs(Container, Object.assign({}, containerProps, {
101
- children: [jsxs(ContentContainer, {
102
- children: [hasHeader && jsx(HeaderContainer, Object.assign({}, headerContainerProps, {
103
- children: typeof header === 'string' ? jsx(Typography, Object.assign({
104
- typographyType: "headingSans03"
105
- }, {
106
- children: header
107
- })) : header
108
- })), children]
101
+ children: [jsx(ScrollableContainer, {
102
+ children: jsxs(ContentContainer, {
103
+ children: [hasHeader && jsx(HeaderContainer, Object.assign({}, headerContainerProps, {
104
+ children: typeof header === 'string' ? jsx(Typography, Object.assign({
105
+ typographyType: "headingSans03"
106
+ }, {
107
+ children: header
108
+ })) : header
109
+ })), children]
110
+ })
109
111
  }), jsx(StyledButton, {
110
112
  "data-testid": "drawer-close-btn",
111
113
  size: "small",
@@ -20,7 +20,7 @@ var StyledList = styled.ul.withConfig({
20
20
  return typographyType && css(["", " ul,ol{", "}"], listTokens.sizes[typographyType], listTokens.sizes[typographyType]);
21
21
  }, function (_ref2) {
22
22
  var listType = _ref2.listType;
23
- return listType === 'unordered' ? css(["padding-left:", ";list-style:none;li{position:relative;padding-left:", ";&:before{content:'';display:inline-block;height:1em;width:1em;position:absolute;top:", ";left:0;background-size:contain;background-repeat:no-repeat;background-image:url(\"", "\");}ul > li:before{background-image:url(\"", "\");}ul > li > ul > li:before{background-image:url(\"", "\");}}"], "calc(".concat(ulPaddingLeft, ")"), "calc(".concat(liTextPadding, ")"), "calc((".concat(listItemTokens.base.lineHeight, " / 2) - 0.5em )"), bullet, bulletLvl2, bulletLvl3) : css(["padding-left:", ";& > li > ol{list-style-type:lower-alpha;}& > li > ol > li > ol{list-style-type:lower-roman;}"], listTokens.spaceLeft);
23
+ return listType === 'unordered' ? css(["padding-left:", ";list-style:none;li{position:relative;padding-left:", ";&:before{content:'';display:inline-block;height:1em;width:1em;position:absolute;top:", ";left:0;background-size:contain;background-repeat:no-repeat;background-image:", ";}ul > li:before{background-image:", ";}ul > li > ul > li:before{background-image:", ";}}"], "calc(".concat(ulPaddingLeft, ")"), "calc(".concat(liTextPadding, ")"), "calc((".concat(listItemTokens.base.lineHeight, " / 2) - 0.5em )"), "url(\"".concat(bullet, "\")"), "url(\"".concat(bulletLvl2, "\")"), "url(\"".concat(bulletLvl3, "\")")) : css(["padding-left:", ";& > li > ol{list-style-type:lower-alpha;}& > li > ol > li > ol{list-style-type:lower-roman;}"], listTokens.spaceLeft);
24
24
  });
25
25
  var List = /*#__PURE__*/forwardRef(function (props, ref) {
26
26
  var _props$listType = props.listType,
@@ -10,10 +10,4 @@ export declare const modalTokens: {
10
10
  actionsContainer: {
11
11
  base: CSSObject;
12
12
  };
13
- bodyScrollable: {
14
- base: CSSObject;
15
- focus: {
16
- base: CSSObject;
17
- };
18
- };
19
13
  };
@@ -19,10 +19,6 @@ var actionsContainerBase = {
19
19
  gap: Spacing.SizesDdsSpacingLocalX1
20
20
  };
21
21
  var focusBase = Object.assign({}, focusVisible);
22
- var bodyScrollableBase = {
23
- overflowY: 'auto'
24
- };
25
- var bodyScrollableFocusBase = Object.assign({}, focusVisible);
26
22
  var modalTokens = {
27
23
  base: base,
28
24
  focus: {
@@ -33,12 +29,6 @@ var modalTokens = {
33
29
  },
34
30
  actionsContainer: {
35
31
  base: actionsContainerBase
36
- },
37
- bodyScrollable: {
38
- base: bodyScrollableBase,
39
- focus: {
40
- base: bodyScrollableFocusBase
41
- }
42
32
  }
43
33
  };
44
34
 
@@ -1,13 +1,18 @@
1
1
  import { BaseComponentPropsWithChildren } from '../../types';
2
+ import { Property } from 'csstype';
2
3
  export declare type ModalBodyProps = BaseComponentPropsWithChildren<HTMLDivElement, {
3
4
  /**Gjør at innholdet kan scrolles. Det må eventuelt settes (max)bredde og (max)høyde styling på både denne subkomponenten og `<Modal />`. */
4
5
  scrollable?: boolean;
6
+ /**Høyde på container. */
7
+ height?: Property.Height;
5
8
  }>;
6
9
  export declare const ModalBody: import("react").ForwardRefExoticComponent<{
7
10
  htmlProps?: import("react").HTMLAttributes<HTMLDivElement> | undefined;
8
- } & Pick<import("react").HTMLAttributes<HTMLDivElement>, "className" | "id"> & {
11
+ } & Pick<import("react").HTMLAttributes<HTMLDivElement>, "id" | "className"> & {
9
12
  /**Gjør at innholdet kan scrolles. Det må eventuelt settes (max)bredde og (max)høyde styling på både denne subkomponenten og `<Modal />`. */
10
13
  scrollable?: boolean | undefined;
14
+ /**Høyde på container. */
15
+ height?: Property.Height<0 | (string & {})> | undefined;
11
16
  } & {
12
17
  children?: import("react").ReactNode;
13
18
  } & import("react").RefAttributes<HTMLDivElement>>;
@@ -1,33 +1,33 @@
1
1
  import { __rest } from 'tslib';
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
  import { forwardRef } from 'react';
4
- import styled, { css } from 'styled-components';
5
- import { modalTokens } from './Modal.tokens.js';
6
- import { scrollbarStyling } from '../../helpers/styling/scrollbarStyling.js';
7
- import { focusVisibleTransitionValue } from '../../helpers/styling/focusVisible.js';
4
+ import styled from 'styled-components';
5
+ import { ScrollableContainer } from '../ScrollableContainer/ScrollableContainer.js';
8
6
  import { getBaseHTMLProps } from '../../types/BaseComponentProps.js';
9
7
 
10
8
  var Container = styled.div.withConfig({
11
9
  displayName: "ModalBody__Container",
12
10
  componentId: "sc-134o0zg-0"
13
- })(["", " transition:", ";", ""], scrollbarStyling, focusVisibleTransitionValue, function (_ref) {
14
- var scrollable = _ref.scrollable;
15
- return scrollable && css(["", " &:focus-visible,&.focus-visible{", "}"], modalTokens.bodyScrollable.base, modalTokens.bodyScrollable.focus.base);
16
- });
11
+ })([""]);
17
12
  var ModalBody = /*#__PURE__*/forwardRef(function (props, ref) {
18
13
  var children = props.children,
19
14
  scrollable = props.scrollable,
20
15
  id = props.id,
21
16
  className = props.className,
22
17
  htmlProps = props.htmlProps,
23
- rest = __rest(props, ["children", "scrollable", "id", "className", "htmlProps"]);
18
+ height = props.height,
19
+ rest = __rest(props, ["children", "scrollable", "id", "className", "htmlProps", "height"]);
24
20
 
25
21
  var containerProps = Object.assign(Object.assign({}, getBaseHTMLProps(id, className, htmlProps, rest)), {
26
- ref: ref,
27
- tabIndex: scrollable ? 0 : undefined,
28
- scrollable: scrollable
22
+ ref: ref
29
23
  });
30
- return jsx(Container, Object.assign({}, containerProps, {
24
+ return scrollable ? jsx(Container, Object.assign({}, containerProps, {
25
+ children: jsx(ScrollableContainer, Object.assign({
26
+ contentHeight: height
27
+ }, {
28
+ children: children
29
+ }))
30
+ })) : jsx(Container, Object.assign({}, containerProps, {
31
31
  children: children
32
32
  }));
33
33
  });
@@ -14,17 +14,17 @@ import { useOnKeyDown } from '../../hooks/useOnKeyDown.js';
14
14
  import { useRoveFocus } from '../../hooks/useRoveFocus.js';
15
15
  import { PersonIcon } from '../../icons/tsx/person.js';
16
16
  import { useId } from '../../hooks/useId.js';
17
- import { scrollbarStyling } from '../../helpers/styling/scrollbarStyling.js';
17
+ import { scrollbarStyling } from '../ScrollableContainer/scrollbarStyling.js';
18
18
  import { useCombinedRef } from '../../hooks/useCombinedRefs.js';
19
19
  import { getBaseHTMLProps } from '../../types/BaseComponentProps.js';
20
20
 
21
21
  var Container = styled.div.withConfig({
22
22
  displayName: "OverflowMenu__Container",
23
23
  componentId: "sc-kh744b-0"
24
- })(["box-sizing:border-box;z-index:3;overflow-y:auto;min-width:180px;max-width:300px;", " ", " ", " *::selection{", "}"], function (_ref) {
24
+ })(["box-sizing:border-box;z-index:3;overflow-y:auto;min-width:180px;max-width:300px;", " ", " ", " ", " *::selection{", "}"], function (_ref) {
25
25
  var isOpen = _ref.isOpen;
26
26
  return visibilityTransition(isOpen);
27
- }, overflowMenuTokens.container.base, scrollbarStyling, typographyTokens.selection.base);
27
+ }, overflowMenuTokens.container.base, scrollbarStyling.webkit, scrollbarStyling.firefox, typographyTokens.selection.base);
28
28
  var OverflowMenuList = styled.ul.withConfig({
29
29
  displayName: "OverflowMenu__OverflowMenuList",
30
30
  componentId: "sc-kh744b-1"
@@ -36,7 +36,7 @@ var Container = styled.div.withConfig({
36
36
  componentId: "sc-5ltegq-3"
37
37
  })(["display:inline-flex;gap:", ";", ""], paginationTokens.container.spaceBetweenItems, function (_ref2) {
38
38
  var smallScreen = _ref2.smallScreen;
39
- return smallScreen ? css(["flex-direction:column;align-items:center;"]) : css(["justify-content:space-around;flex-wrap:wrap;"]);
39
+ return smallScreen ? css(["flex-direction:column;align-items:center;"]) : css(["justify-content:space-between;flex-wrap:wrap;"]);
40
40
  });
41
41
  var IndicatorsContainer = styled.div.withConfig({
42
42
  displayName: "Pagination__IndicatorsContainer",
@@ -0,0 +1,7 @@
1
+ import { BaseComponentPropsWithChildren } from '../../types';
2
+ import { Property } from 'csstype';
3
+ export declare type ScrollableContainerProps = BaseComponentPropsWithChildren<HTMLDivElement, {
4
+ /**Høyde på innholdscontainer. */
5
+ contentHeight?: Property.Height;
6
+ }>;
7
+ export declare const ScrollableContainer: (props: ScrollableContainerProps) => JSX.Element;
@@ -0,0 +1,47 @@
1
+ import { __rest } from 'tslib';
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
3
+ import { useRef } from 'react';
4
+ import styled from 'styled-components';
5
+ import { Scrollbar } from './Scrollbar.js';
6
+ import { scrollbarTokens } from './ScrollableContainer.tokens.js';
7
+ import { focusVisibleTransitionValue, focusVisible } from '../../helpers/styling/focusVisible.js';
8
+ import { getBaseHTMLProps } from '../../types/BaseComponentProps.js';
9
+
10
+ var track = scrollbarTokens.track,
11
+ content = scrollbarTokens.content,
12
+ outerContainer = scrollbarTokens.outerContainer;
13
+ var StyledScrollableContainer = styled.div.withConfig({
14
+ displayName: "ScrollableContainer__StyledScrollableContainer",
15
+ componentId: "sc-t0dczu-0"
16
+ })(["grid-template:auto / 1fr ", ";overflow:hidden;position:relative;display:grid;padding:", ";"], track.width, outerContainer.padding);
17
+ var Content = styled.div.withConfig({
18
+ displayName: "ScrollableContainer__Content",
19
+ componentId: "sc-t0dczu-1"
20
+ })(["height:", ";overflow:auto;scrollbar-width:none;::-webkit-scrollbar{display:none;}padding-right:", ";@media (prefers-reduced-motion:no-preference){transition:", ";}:focus-visible,.focus-visible{outline:", ";outline-offset:", ";}"], function (_ref) {
21
+ var height = _ref.height;
22
+ return height;
23
+ }, content.paddingRight, focusVisibleTransitionValue, focusVisible.outline, focusVisible.outlineOffset);
24
+ var ScrollableContainer = function ScrollableContainer(props) {
25
+ var children = props.children,
26
+ id = props.id,
27
+ className = props.className,
28
+ _props$contentHeight = props.contentHeight,
29
+ contentHeight = _props$contentHeight === void 0 ? '90vh' : _props$contentHeight,
30
+ htmlProps = props.htmlProps,
31
+ rest = __rest(props, ["children", "id", "className", "contentHeight", "htmlProps"]);
32
+
33
+ var ref = useRef(null);
34
+ return jsxs(StyledScrollableContainer, Object.assign({}, getBaseHTMLProps(id, className, htmlProps, rest), {
35
+ children: [jsx(Content, Object.assign({
36
+ height: contentHeight,
37
+ ref: ref,
38
+ tabIndex: 0
39
+ }, {
40
+ children: children
41
+ })), jsx(Scrollbar, {
42
+ contentRef: ref
43
+ })]
44
+ }));
45
+ };
46
+
47
+ export { ScrollableContainer };
@@ -0,0 +1,15 @@
1
+ import { ScrollableContainerProps } from '.';
2
+ declare const _default: {
3
+ title: string;
4
+ component: (props: ScrollableContainerProps) => JSX.Element;
5
+ argTypes: {
6
+ contentHeight: {
7
+ control: {
8
+ type: string;
9
+ };
10
+ };
11
+ };
12
+ };
13
+ export default _default;
14
+ export declare const Default: (args: ScrollableContainerProps) => JSX.Element;
15
+ export declare const JustScrollbar: () => JSX.Element;
@@ -0,0 +1,25 @@
1
+ export declare const scrollbarWidthNumberPx = 10;
2
+ export declare const scrollbarTokens: {
3
+ minThumbHeightPx: number;
4
+ track: {
5
+ backgroundColor: string;
6
+ borderRadius: string;
7
+ width: string;
8
+ };
9
+ thumb: {
10
+ base: {
11
+ backgroundColor: string;
12
+ borderRadius: string;
13
+ width: string;
14
+ };
15
+ hover: {
16
+ backgroundColor: string;
17
+ };
18
+ };
19
+ content: {
20
+ paddingRight: string;
21
+ };
22
+ outerContainer: {
23
+ padding: string;
24
+ };
25
+ };
@@ -0,0 +1,36 @@
1
+ import { ddsBaseTokens } from '@norges-domstoler/dds-design-tokens';
2
+
3
+ var scrollbarWidthNumberPx = 10;
4
+ var scrollbarWidth = "".concat(scrollbarWidthNumberPx, "px");
5
+ var colors = ddsBaseTokens.colors,
6
+ spacing = ddsBaseTokens.spacing;
7
+ var track = {
8
+ backgroundColor: 'transparent',
9
+ borderRadius: '100px',
10
+ width: scrollbarWidth
11
+ };
12
+ var thumb = {
13
+ base: {
14
+ backgroundColor: colors.DdsColorPrimaryDarkest.slice(0, -2) + '0.35)',
15
+ borderRadius: '100px',
16
+ width: scrollbarWidth
17
+ },
18
+ hover: {
19
+ backgroundColor: colors.DdsColorPrimaryDarkest.slice(0, -2) + '0.5)'
20
+ }
21
+ };
22
+ var content = {
23
+ paddingRight: spacing.SizesDdsSpacingLocalX05
24
+ };
25
+ var outerContainer = {
26
+ padding: spacing.SizesDdsSpacingLocalX025
27
+ };
28
+ var scrollbarTokens = {
29
+ minThumbHeightPx: 15,
30
+ track: track,
31
+ thumb: thumb,
32
+ content: content,
33
+ outerContainer: outerContainer
34
+ };
35
+
36
+ export { scrollbarTokens, scrollbarWidthNumberPx };
@@ -0,0 +1,7 @@
1
+ import { RefObject } from 'react';
2
+ import { BaseComponentProps } from '../../types';
3
+ export declare type ScrollbarProps = BaseComponentProps<HTMLDivElement, {
4
+ /** Ref til container med innholdet som skal scrolles. */
5
+ contentRef?: RefObject<HTMLDivElement>;
6
+ }>;
7
+ export declare const Scrollbar: (props: ScrollbarProps) => JSX.Element | null;