@norges-domstoler/dds-components 5.2.0-beta.2 → 5.3.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.
Files changed (100) hide show
  1. package/README.md +14 -3
  2. package/dist/cjs/components/DescriptionList/DescriptionList.tokens.d.ts +70 -0
  3. package/dist/cjs/components/InternalHeader/InternalHeader.styles.d.ts +1 -1
  4. package/dist/cjs/components/InternalHeader/InternalHeader.tokens.d.ts +39 -27
  5. package/dist/cjs/components/Modal/Modal.tokens.d.ts +0 -6
  6. package/dist/cjs/components/Modal/ModalBody.d.ts +6 -1
  7. package/dist/cjs/components/OverflowMenu/OverflowMenu.tokens.d.ts +25 -10
  8. package/dist/cjs/components/ScrollableContainer/ScrollableContainer.d.ts +7 -0
  9. package/dist/cjs/components/ScrollableContainer/ScrollableContainer.stories.d.ts +15 -0
  10. package/dist/cjs/components/ScrollableContainer/ScrollableContainer.tokens.d.ts +25 -0
  11. package/dist/cjs/components/ScrollableContainer/Scrollbar.d.ts +7 -0
  12. package/dist/cjs/components/ScrollableContainer/index.d.ts +3 -0
  13. package/dist/cjs/components/ScrollableContainer/scrollbarStyling.d.ts +26 -0
  14. package/dist/cjs/components/Select/Select.tokens.d.ts +0 -3
  15. package/dist/cjs/components/Tooltip/Tooltip.d.ts +1 -1
  16. package/dist/cjs/helpers/styling/index.d.ts +0 -1
  17. package/dist/cjs/icons/tsx/closeSmall.d.ts +2 -0
  18. package/dist/cjs/icons/tsx/index.d.ts +1 -0
  19. package/dist/cjs/index.d.ts +1 -0
  20. package/dist/cjs/index.js +1322 -1100
  21. package/dist/components/Card/CardAccordion/CardAccordion.js +3 -8
  22. package/dist/components/Checkbox/Checkbox.js +3 -7
  23. package/dist/components/Checkbox/CheckboxGroup.js +3 -7
  24. package/dist/components/Datepicker/Datepicker.js +3 -7
  25. package/dist/components/DescriptionList/DescriptionList.js +6 -3
  26. package/dist/components/DescriptionList/DescriptionList.tokens.d.ts +70 -0
  27. package/dist/components/DescriptionList/DescriptionList.tokens.js +60 -0
  28. package/dist/components/DescriptionList/DescriptionListDesc.js +2 -2
  29. package/dist/components/DescriptionList/DescriptionListGroup.js +4 -4
  30. package/dist/components/Drawer/Drawer.js +15 -17
  31. package/dist/components/Drawer/DrawerGroup.js +7 -12
  32. package/dist/components/InternalHeader/InternalHeader.js +2 -2
  33. package/dist/components/InternalHeader/InternalHeader.styles.d.ts +1 -1
  34. package/dist/components/InternalHeader/InternalHeader.styles.js +17 -11
  35. package/dist/components/InternalHeader/InternalHeader.tokens.d.ts +39 -27
  36. package/dist/components/InternalHeader/InternalHeader.tokens.js +48 -80
  37. package/dist/components/InternalHeader/NavigationItem.js +4 -2
  38. package/dist/components/Modal/Modal.js +3 -9
  39. package/dist/components/Modal/Modal.tokens.d.ts +0 -6
  40. package/dist/components/Modal/Modal.tokens.js +0 -10
  41. package/dist/components/Modal/ModalBody.d.ts +6 -1
  42. package/dist/components/Modal/ModalBody.js +13 -13
  43. package/dist/components/OverflowMenu/OverflowMenu.js +6 -4
  44. package/dist/components/OverflowMenu/OverflowMenu.tokens.d.ts +25 -10
  45. package/dist/components/OverflowMenu/OverflowMenu.tokens.js +33 -45
  46. package/dist/components/OverflowMenu/OverflowMenuGroup.js +3 -7
  47. package/dist/components/OverflowMenu/OverflowMenuItem.js +7 -3
  48. package/dist/components/Pagination/Pagination.js +1 -1
  49. package/dist/components/Popover/PopoverGroup.js +3 -7
  50. package/dist/components/RadioButton/RadioButton.js +3 -8
  51. package/dist/components/RadioButton/RadioButtonGroup.js +3 -6
  52. package/dist/components/ScrollableContainer/ScrollableContainer.d.ts +7 -0
  53. package/dist/components/ScrollableContainer/ScrollableContainer.js +47 -0
  54. package/dist/components/ScrollableContainer/ScrollableContainer.stories.d.ts +15 -0
  55. package/dist/components/ScrollableContainer/ScrollableContainer.tokens.d.ts +25 -0
  56. package/dist/components/ScrollableContainer/ScrollableContainer.tokens.js +36 -0
  57. package/dist/components/ScrollableContainer/Scrollbar.d.ts +7 -0
  58. package/dist/components/ScrollableContainer/Scrollbar.js +178 -0
  59. package/dist/components/ScrollableContainer/index.d.ts +3 -0
  60. package/dist/components/ScrollableContainer/scrollbarStyling.d.ts +26 -0
  61. package/dist/components/ScrollableContainer/scrollbarStyling.js +40 -0
  62. package/dist/components/Search/Search.js +3 -7
  63. package/dist/components/Select/Select.js +41 -10
  64. package/dist/components/Select/Select.styles.js +7 -4
  65. package/dist/components/Select/Select.tokens.d.ts +0 -3
  66. package/dist/components/Select/Select.tokens.js +6 -18
  67. package/dist/components/Spinner/Spinner.js +3 -8
  68. package/dist/components/Table/SortCell.js +1 -1
  69. package/dist/components/Table/Table.js +2 -2
  70. package/dist/components/Table/TableWrapper.js +3 -3
  71. package/dist/components/Tabs/TabList.js +4 -7
  72. package/dist/components/Tabs/Tabs.js +11 -13
  73. package/dist/components/TextInput/CharCounter.js +3 -7
  74. package/dist/components/TextInput/TextInput.js +3 -6
  75. package/dist/components/TextInput/TextInput.styles.js +2 -2
  76. package/dist/components/TextInput/TextInput.tokens.js +1 -1
  77. package/dist/components/ToggleButton/ToggleButton.js +3 -7
  78. package/dist/components/ToggleButton/ToggleButtonGroup.js +3 -7
  79. package/dist/components/Tooltip/Tooltip.d.ts +1 -1
  80. package/dist/components/Tooltip/Tooltip.js +10 -14
  81. package/dist/helpers/styling/focusVisible.js +3 -2
  82. package/dist/helpers/styling/index.d.ts +0 -1
  83. package/dist/icons/tsx/closeSmall.d.ts +2 -0
  84. package/dist/icons/tsx/closeSmall.js +25 -0
  85. package/dist/icons/tsx/index.d.ts +1 -0
  86. package/dist/index.d.ts +1 -0
  87. package/dist/index.js +4 -0
  88. package/package.json +2 -4
  89. package/dist/cjs/components/DescriptionList/DescriptionListDesc.tokens.d.ts +0 -7
  90. package/dist/cjs/components/DescriptionList/DescriptionListGroup.tokens.d.ts +0 -4
  91. package/dist/cjs/components/DescriptionList/DescriptionListTerm.tokens.d.ts +0 -13
  92. package/dist/cjs/helpers/styling/scrollbarStyling.d.ts +0 -3
  93. package/dist/components/DescriptionList/DescriptionListDesc.tokens.d.ts +0 -7
  94. package/dist/components/DescriptionList/DescriptionListDesc.tokens.js +0 -22
  95. package/dist/components/DescriptionList/DescriptionListGroup.tokens.d.ts +0 -4
  96. package/dist/components/DescriptionList/DescriptionListGroup.tokens.js +0 -11
  97. package/dist/components/DescriptionList/DescriptionListTerm.tokens.d.ts +0 -13
  98. package/dist/components/DescriptionList/DescriptionListTerm.tokens.js +0 -27
  99. package/dist/helpers/styling/scrollbarStyling.d.ts +0 -3
  100. package/dist/helpers/styling/scrollbarStyling.js +0 -8
@@ -1,7 +1,6 @@
1
- import { slicedToArray as _slicedToArray } from '../../_virtual/_rollupPluginBabelHelpers.js';
2
1
  import { __rest } from 'tslib';
3
2
  import { jsxs, jsx } from 'react/jsx-runtime';
4
- import React, { useState } from 'react';
3
+ import React, { useId } from 'react';
5
4
  import styled from 'styled-components';
6
5
  import { ddsBaseTokens } from '@norges-domstoler/dds-design-tokens';
7
6
  import { spinnerTokens } from './Spinner.tokens.js';
@@ -31,7 +30,6 @@ var Circle = styled.circle.withConfig({
31
30
  var innerAnimationDelay = _ref5.innerAnimationDelay;
32
31
  return innerAnimationDelay;
33
32
  });
34
- var nextUniqueId = 0;
35
33
  function Spinner(props) {
36
34
  var _props$size = props.size,
37
35
  size = _props$size === void 0 ? ddsBaseTokens.iconSizes.DdsIconsizeMedium : _props$size,
@@ -45,11 +43,8 @@ function Spinner(props) {
45
43
  var mountTime = React.useRef(Date.now());
46
44
  var outerAnimationDelay = -(mountTime.current % 2000);
47
45
  var innerAnimationDelay = -(mountTime.current % 1500);
48
-
49
- var _useState = useState("spinnerTitle-".concat(nextUniqueId++)),
50
- _useState2 = _slicedToArray(_useState, 1),
51
- uniqueId = _useState2[0];
52
-
46
+ var generatedId = useId();
47
+ var uniqueId = "".concat(generatedId, "-spinnerTitle");
53
48
  var spinnerProps = Object.assign(Object.assign({}, getBaseHTMLProps(id, className, htmlProps, rest)), {
54
49
  outerAnimationDelay: outerAnimationDelay,
55
50
  size: size
@@ -6,9 +6,9 @@ import { cellTokens } from './Cell.tokens.js';
6
6
  import styled from 'styled-components';
7
7
  import { removeButtonStyling } from '../../helpers/styling/removeButtonStyling.js';
8
8
  import { UnfoldMoreIcon } from '../../icons/tsx/unfoldMore.js';
9
- import { ChevronDownIcon } from '../../icons/tsx/chevronDown.js';
10
9
  import { ChevronUpIcon } from '../../icons/tsx/chevronUp.js';
11
10
  import { Icon } from '../Icon/Icon.js';
11
+ import { ChevronDownIcon } from '../../icons/tsx/chevronDown.js';
12
12
 
13
13
  var SortIcon = styled(Icon).withConfig({
14
14
  displayName: "SortCell__SortIcon",
@@ -4,12 +4,12 @@ import { forwardRef } from 'react';
4
4
  import styled, { css } from 'styled-components';
5
5
  import { cellTokens } from './Cell.tokens.js';
6
6
  import { typographyTokens } from '../Typography/Typography.tokens.js';
7
- import { scrollbarStyling } from '../../helpers/styling/scrollbarStyling.js';
7
+ import { scrollbarStyling } from '../ScrollableContainer/scrollbarStyling.js';
8
8
 
9
9
  var StyledTable = styled.table.withConfig({
10
10
  displayName: "Table__StyledTable",
11
11
  componentId: "sc-bw0w0a-0"
12
- })(["border-spacing:0;border-collapse:collapse;*::selection{", "}", " ", " ", ""], typographyTokens.selection.base, scrollbarStyling, function (_ref) {
12
+ })(["border-spacing:0;border-collapse:collapse;*::selection{", "}", " ", " ", " ", ""], typographyTokens.selection.base, scrollbarStyling.webkit, scrollbarStyling.firefox, function (_ref) {
13
13
  var density = _ref.density;
14
14
  return density && css(["td,th{", "}"], cellTokens.density[density].base);
15
15
  }, function (_ref2) {
@@ -3,15 +3,15 @@ import { __rest } from 'tslib';
3
3
  import { jsx } from 'react/jsx-runtime';
4
4
  import { useState, useRef, useEffect } from 'react';
5
5
  import styled, { css } from 'styled-components';
6
- import { scrollbarStyling } from '../../helpers/styling/scrollbarStyling.js';
6
+ import { scrollbarStyling } from '../ScrollableContainer/scrollbarStyling.js';
7
7
 
8
8
  var Wrapper = styled.div.withConfig({
9
9
  displayName: "TableWrapper__Wrapper",
10
10
  componentId: "sc-eb384b-0"
11
- })(["", " ", ""], function (_ref) {
11
+ })(["", " ", " ", ""], function (_ref) {
12
12
  var overflowX = _ref.overflowX;
13
13
  return overflowX && css(["overflow-x:auto;"]);
14
- }, scrollbarStyling);
14
+ }, scrollbarStyling.webkit, scrollbarStyling.firefox);
15
15
  var TableWrapper = function TableWrapper(_a) {
16
16
  var children = _a.children,
17
17
  rest = __rest(_a, ["children"]);
@@ -1,11 +1,11 @@
1
1
  import { slicedToArray as _slicedToArray } from '../../_virtual/_rollupPluginBabelHelpers.js';
2
2
  import { __rest } from 'tslib';
3
3
  import { jsx } from 'react/jsx-runtime';
4
- import { forwardRef, useState, Children, isValidElement, cloneElement } from 'react';
4
+ import { forwardRef, Children, isValidElement, cloneElement } from 'react';
5
5
  import styled from 'styled-components';
6
6
  import { tabsTokens } from './Tabs.tokens.js';
7
7
  import { useTabsContext } from './Tabs.context.js';
8
- import { scrollbarStyling } from '../../helpers/styling/scrollbarStyling.js';
8
+ import { scrollbarStyling } from '../ScrollableContainer/scrollbarStyling.js';
9
9
  import { useRoveFocus } from '../../hooks/useRoveFocus.js';
10
10
  import { useCombinedRef } from '../../hooks/useCombinedRefs.js';
11
11
  import { useOnKeyDown } from '../../hooks/useOnKeyDown.js';
@@ -14,7 +14,7 @@ import { useOnClickOutside } from '../../hooks/useOnClickOutside.js';
14
14
  var TabRow = styled.div.withConfig({
15
15
  displayName: "TabList__TabRow",
16
16
  componentId: "sc-1ldr0lz-0"
17
- })(["", " ", " scroll-snap-type:x mandatory;@media (prefers-reduced-motion:no-preference){scroll-behavior:smooth;}&:focus-visible{", "}&:focus-visible button{outline:none;}"], tabsTokens.tabList.base, scrollbarStyling, tabsTokens.tabList.focus.base);
17
+ })(["", " ", " ", " scroll-snap-type:x mandatory;@media (prefers-reduced-motion:no-preference){scroll-behavior:smooth;}&:focus-visible{", "}&:focus-visible button{outline:none;}"], tabsTokens.tabList.base, scrollbarStyling.webkit, scrollbarStyling.firefox, tabsTokens.tabList.focus.base);
18
18
  var TabList = /*#__PURE__*/forwardRef(function (_a, ref) {
19
19
  var children = _a.children,
20
20
  id = _a.id,
@@ -30,10 +30,7 @@ var TabList = /*#__PURE__*/forwardRef(function (_a, ref) {
30
30
  tabPanelsRef = _useTabsContext.tabPanelsRef,
31
31
  setHasTabFocus = _useTabsContext.setHasTabFocus;
32
32
 
33
- var _useState = useState(id !== null && id !== void 0 ? id : "".concat(tabsId, "-tablist")),
34
- _useState2 = _slicedToArray(_useState, 1),
35
- uniqueId = _useState2[0];
36
-
33
+ var uniqueId = id !== null && id !== void 0 ? id : "".concat(tabsId, "-tablist");
37
34
  var childrenArray = Children.toArray(children).length;
38
35
 
39
36
  var _useRoveFocus = useRoveFocus(childrenArray, !hasTabFocus, 'row'),
@@ -1,7 +1,7 @@
1
1
  import { slicedToArray as _slicedToArray } from '../../_virtual/_rollupPluginBabelHelpers.js';
2
2
  import { __rest } from 'tslib';
3
3
  import { jsx } from 'react/jsx-runtime';
4
- import { forwardRef, useState, useRef, useEffect } from 'react';
4
+ import { forwardRef, useId, useState, useRef, useEffect } from 'react';
5
5
  import styled from 'styled-components';
6
6
  import { TabsContext } from './Tabs.context.js';
7
7
  import { getBaseHTMLProps } from '../../types/BaseComponentProps.js';
@@ -10,7 +10,6 @@ var Container = styled.div.withConfig({
10
10
  displayName: "Tabs__Container",
11
11
  componentId: "sc-7ta5g2-0"
12
12
  })([""]);
13
- var nextUniqueId = 0;
14
13
  var Tabs = /*#__PURE__*/forwardRef(function (props, ref) {
15
14
  var id = props.id,
16
15
  _props$activeTab = props.activeTab,
@@ -25,19 +24,18 @@ var Tabs = /*#__PURE__*/forwardRef(function (props, ref) {
25
24
  htmlProps = props.htmlProps,
26
25
  rest = __rest(props, ["id", "activeTab", "onChange", "tabContentDirection", "tabWidth", "children", "className", "htmlProps"]);
27
26
 
28
- var _useState = useState(id !== null && id !== void 0 ? id : "tabs-".concat(nextUniqueId++)),
29
- _useState2 = _slicedToArray(_useState, 1),
30
- uniqueId = _useState2[0];
27
+ var generatedId = useId();
28
+ var uniqueId = id !== null && id !== void 0 ? id : "".concat(generatedId, "-tabs");
31
29
 
32
- var _useState3 = useState(activeTab),
33
- _useState4 = _slicedToArray(_useState3, 2),
34
- thisActiveTab = _useState4[0],
35
- setActiveTab = _useState4[1];
30
+ var _useState = useState(activeTab),
31
+ _useState2 = _slicedToArray(_useState, 2),
32
+ thisActiveTab = _useState2[0],
33
+ setActiveTab = _useState2[1];
36
34
 
37
- var _useState5 = useState(false),
38
- _useState6 = _slicedToArray(_useState5, 2),
39
- hasTabFocus = _useState6[0],
40
- setHasTabFocus = _useState6[1];
35
+ var _useState3 = useState(false),
36
+ _useState4 = _slicedToArray(_useState3, 2),
37
+ hasTabFocus = _useState4[0],
38
+ setHasTabFocus = _useState4[1];
41
39
 
42
40
  var tabListRef = useRef(null);
43
41
  var tabPanelsRef = useRef(null);
@@ -1,7 +1,6 @@
1
- import { slicedToArray as _slicedToArray } from '../../_virtual/_rollupPluginBabelHelpers.js';
2
1
  import { __rest } from 'tslib';
3
2
  import { jsxs } from 'react/jsx-runtime';
4
- import { useState } from 'react';
3
+ import { useId } from 'react';
5
4
  import styled from 'styled-components';
6
5
  import { charCounterTokens } from './CharCounter.tokens.js';
7
6
  import { Typography } from '../Typography/Typography.js';
@@ -11,7 +10,6 @@ var Wrapper = styled(Typography).withConfig({
11
10
  displayName: "CharCounter__Wrapper",
12
11
  componentId: "sc-qty1z2-0"
13
12
  })(["margin-left:auto;", ""], charCounterTokens.base);
14
- var nextUniqueId = 0;
15
13
 
16
14
  function CharCounter(props) {
17
15
  var current = props.current,
@@ -21,10 +19,8 @@ function CharCounter(props) {
21
19
  htmlProps = props.htmlProps,
22
20
  rest = __rest(props, ["current", "max", "id", "className", "htmlProps"]);
23
21
 
24
- var _useState = useState(id !== null && id !== void 0 ? id : "characterCounter-".concat(nextUniqueId++)),
25
- _useState2 = _slicedToArray(_useState, 1),
26
- uniqueId = _useState2[0];
27
-
22
+ var generatedId = useId();
23
+ var uniqueId = id !== null && id !== void 0 ? id : "".concat(generatedId, "-characterCounter");
28
24
  return jsxs(Wrapper, Object.assign({}, getBaseHTMLProps(uniqueId, className, htmlProps, rest), {
29
25
  forwardedAs: "div",
30
26
  typographyType: "supportingStyleHelperText01",
@@ -1,7 +1,7 @@
1
1
  import { slicedToArray as _slicedToArray } from '../../_virtual/_rollupPluginBabelHelpers.js';
2
2
  import { __rest } from 'tslib';
3
3
  import { jsxs, jsx } from 'react/jsx-runtime';
4
- import { forwardRef, useRef, useState, useEffect } from 'react';
4
+ import { forwardRef, useRef, useState, useEffect, useId } from 'react';
5
5
  import { textInputTokens } from './TextInput.tokens.js';
6
6
  import CharCounter from './CharCounter.js';
7
7
  import { TextArea, Label, MessageContainer } from './TextInput.styles.js';
@@ -10,7 +10,6 @@ import { derivativeIdGenerator, spaceSeparatedIdListGenerator } from '../../util
10
10
  import { RequiredMarker } from '../../helpers/RequiredMarker/RequiredMarker.js';
11
11
  import { InputMessage } from '../InputMessage/InputMessage.js';
12
12
 
13
- var nextUniqueId = 0;
14
13
  var TextInput = /*#__PURE__*/forwardRef(function (_a, ref) {
15
14
  var label = _a.label,
16
15
  disabled = _a.disabled,
@@ -64,10 +63,8 @@ var TextInput = /*#__PURE__*/forwardRef(function (_a, ref) {
64
63
  }
65
64
  };
66
65
 
67
- var _useState3 = useState(id !== null && id !== void 0 ? id : "textInput-".concat(nextUniqueId++)),
68
- _useState4 = _slicedToArray(_useState3, 1),
69
- uniqueId = _useState4[0];
70
-
66
+ var generatedId = useId();
67
+ var uniqueId = id !== null && id !== void 0 ? id : "".concat(generatedId, "-textInput");
71
68
  var hasErrorMessage = !!errorMessage;
72
69
  var hasTip = !!tip;
73
70
  var hasLabel = !!label;
@@ -1,13 +1,13 @@
1
1
  import styled, { css } from 'styled-components';
2
2
  import { textInputTokens } from './TextInput.tokens.js';
3
3
  import { StatefulInput, Label as Label$1 } from '../../helpers/Input/Input.styles.js';
4
- import { scrollbarStyling } from '../../helpers/styling/scrollbarStyling.js';
4
+ import { scrollbarStyling } from '../ScrollableContainer/scrollbarStyling.js';
5
5
  import { inputTokens } from '../../helpers/Input/Input.tokens.js';
6
6
 
7
7
  var TextArea = styled(StatefulInput).withConfig({
8
8
  displayName: "TextInputstyles__TextArea",
9
9
  componentId: "sc-165zflr-0"
10
- })(["", " ", " ", " &:hover:enabled:read-write ~ label{background-color:", ";}"], scrollbarStyling, textInputTokens.multiline.base, function (_ref) {
10
+ })(["", " ", " ", " ", " &:hover:enabled:read-write ~ label{background-color:", ";}"], scrollbarStyling.webkit, scrollbarStyling.firefox, textInputTokens.multiline.base, function (_ref) {
11
11
  var hasLabel = _ref.hasLabel;
12
12
  return css(["", ""], textInputTokens.multiline[hasLabel].base);
13
13
  }, function (_ref2) {
@@ -1,5 +1,5 @@
1
1
  import { ddsBaseTokens, ddsReferenceTokens } from '@norges-domstoler/dds-design-tokens';
2
- import { scrollbarWidthNumberPx } from '../../helpers/styling/scrollbarStyling.js';
2
+ import { scrollbarWidthNumberPx } from '../ScrollableContainer/ScrollableContainer.tokens.js';
3
3
 
4
4
  var Colors = ddsBaseTokens.colors,
5
5
  Spacing = ddsBaseTokens.spacing;
@@ -1,7 +1,6 @@
1
- import { slicedToArray as _slicedToArray } from '../../_virtual/_rollupPluginBabelHelpers.js';
2
1
  import { __rest } from 'tslib';
3
2
  import { jsxs, jsx } from 'react/jsx-runtime';
4
- import { forwardRef, useState } from 'react';
3
+ import { forwardRef, useId } from 'react';
5
4
  import styled from 'styled-components';
6
5
  import { buttonTokens } from '../Button/Button.tokens.js';
7
6
  import { typographyTokens } from '../Typography/Typography.tokens.js';
@@ -23,7 +22,6 @@ var Container = styled.label.withConfig({
23
22
  displayName: "ToggleButton__Container",
24
23
  componentId: "sc-ya01sa-2"
25
24
  })(["width:fit-content;", ":checked + ", "{", "}", ":checked + ", ":hover{", "}", ":focus-visible + ", "{", "}"], Input, Content, toggleButtonTokens.checked.base, Input, Content, toggleButtonTokens.checked.hover.base, Input, Content, toggleButtonTokens.focus.base);
26
- var nextUniqueId = 0;
27
25
  var ToggleButton = /*#__PURE__*/forwardRef(function (_a, ref) {
28
26
  var id = _a.id,
29
27
  label = _a.label,
@@ -32,10 +30,8 @@ var ToggleButton = /*#__PURE__*/forwardRef(function (_a, ref) {
32
30
  htmlProps = _a.htmlProps,
33
31
  rest = __rest(_a, ["id", "label", "icon", "className", "htmlProps"]);
34
32
 
35
- var _useState = useState(id !== null && id !== void 0 ? id : "toggleButton-".concat(nextUniqueId++)),
36
- _useState2 = _slicedToArray(_useState, 1),
37
- uniqueId = _useState2[0];
38
-
33
+ var generatedId = useId();
34
+ var uniqueId = id !== null && id !== void 0 ? id : "".concat(generatedId, "-toggleButton");
39
35
  var inputProps = Object.assign(Object.assign({}, getBaseHTMLProps(uniqueId, className, htmlProps, rest)), {
40
36
  ref: ref,
41
37
  type: 'checkbox'
@@ -1,7 +1,6 @@
1
- import { slicedToArray as _slicedToArray } from '../../_virtual/_rollupPluginBabelHelpers.js';
2
1
  import { __rest } from 'tslib';
3
2
  import { jsxs, jsx } from 'react/jsx-runtime';
4
- import { useState } from 'react';
3
+ import { useId } from 'react';
5
4
  import styled, { css } from 'styled-components';
6
5
  import { toggleButtonTokens } from './ToggleButton.tokens.js';
7
6
  import { getBaseHTMLProps } from '../../types/BaseComponentProps.js';
@@ -18,7 +17,6 @@ var Container = styled.div.withConfig({
18
17
  displayName: "ToggleButtonGroup__Container",
19
18
  componentId: "sc-14ijdag-1"
20
19
  })(["", ""], toggleButtonTokens.container.base);
21
- var nextUniqueId = 0;
22
20
  var ToggleButtonGroup = function ToggleButtonGroup(props) {
23
21
  var children = props.children,
24
22
  _props$direction = props.direction,
@@ -30,10 +28,8 @@ var ToggleButtonGroup = function ToggleButtonGroup(props) {
30
28
  htmlProps = props.htmlProps,
31
29
  rest = __rest(props, ["children", "direction", "label", "labelId", "id", "className", "htmlProps"]);
32
30
 
33
- var _useState = useState(labelId !== null && labelId !== void 0 ? labelId : "ToggleButtonGroupLabel-".concat(nextUniqueId++)),
34
- _useState2 = _slicedToArray(_useState, 1),
35
- uniqueLabelId = _useState2[0];
36
-
31
+ var generatedId = useId();
32
+ var uniqueLabelId = labelId !== null && labelId !== void 0 ? labelId : "".concat(generatedId, "-ToggleButtonGroupLabel");
37
33
  var groupProps = {
38
34
  direction: direction
39
35
  };
@@ -16,7 +16,7 @@ export declare type TooltipProps = BaseComponentProps<HTMLDivElement, {
16
16
  tooltipId?: string;
17
17
  } & PickedHTMLAttributes, Omit<HTMLAttributes<HTMLDivElement>, 'children' | keyof PickedHTMLAttributes>>;
18
18
  export declare const Tooltip: React.ForwardRefExoticComponent<{
19
- htmlProps?: Omit<React.HTMLAttributes<HTMLDivElement>, "style" | "onMouseLeave" | "onMouseOver" | "children"> | undefined;
19
+ htmlProps?: Omit<React.HTMLAttributes<HTMLDivElement>, "style" | "onMouseLeave" | "onMouseOver" | "children"> | undefined; /**`id` for tooltip. */
20
20
  } & Pick<Omit<React.HTMLAttributes<HTMLDivElement>, "style" | "onMouseLeave" | "onMouseOver" | "children">, "className" | "id"> & {
21
21
  /**Innhold i tooltip. */
22
22
  text: string;
@@ -1,7 +1,7 @@
1
1
  import { slicedToArray as _slicedToArray } from '../../_virtual/_rollupPluginBabelHelpers.js';
2
2
  import { __rest } from 'tslib';
3
3
  import { jsxs, jsx } from 'react/jsx-runtime';
4
- import { forwardRef, useState, useEffect, Children, isValidElement, cloneElement } from 'react';
4
+ import { forwardRef, useId, useState, useEffect, Children, isValidElement, cloneElement } from 'react';
5
5
  import { Container, TooltipWrapper, ArrowWrapper, SvgArrow } from './Tooltip.styles.js';
6
6
  import { tooltipTokens } from './Tooltip.tokens.js';
7
7
  import { useFloatPosition } from '../../hooks/useFloatPosition.js';
@@ -10,7 +10,6 @@ import { useOnKeyDown } from '../../hooks/useOnKeyDown.js';
10
10
  import { combineHandlers } from '../../utils/combineHandlers.js';
11
11
  import { getBaseHTMLProps } from '../../types/BaseComponentProps.js';
12
12
 
13
- var nextUniqueId = 0;
14
13
  var Tooltip = /*#__PURE__*/forwardRef(function (props, ref) {
15
14
  var text = props.text,
16
15
  _props$placement = props.placement,
@@ -27,21 +26,18 @@ var Tooltip = /*#__PURE__*/forwardRef(function (props, ref) {
27
26
  htmlProps = props.htmlProps,
28
27
  rest = __rest(props, ["text", "placement", "children", "tooltipId", "delay", "style", "onMouseLeave", "onMouseOver", "id", "className", "htmlProps"]);
29
28
 
30
- var uniqueId = nextUniqueId++;
29
+ var generatedId = useId();
30
+ var uniqueTooltipId = tooltipId !== null && tooltipId !== void 0 ? tooltipId : "".concat(generatedId, "-tooltip");
31
31
 
32
- var _useState = useState(tooltipId !== null && tooltipId !== void 0 ? tooltipId : "tooltip-".concat(uniqueId)),
33
- _useState2 = _slicedToArray(_useState, 1),
34
- uniqueTooltipId = _useState2[0];
32
+ var _useState = useState(false),
33
+ _useState2 = _slicedToArray(_useState, 2),
34
+ open = _useState2[0],
35
+ setOpen = _useState2[1];
35
36
 
36
- var _useState3 = useState(false),
37
+ var _useState3 = useState(null),
37
38
  _useState4 = _slicedToArray(_useState3, 2),
38
- open = _useState4[0],
39
- setOpen = _useState4[1];
40
-
41
- var _useState5 = useState(null),
42
- _useState6 = _slicedToArray(_useState5, 2),
43
- arrowElement = _useState6[0],
44
- setArrowElement = _useState6[1];
39
+ arrowElement = _useState4[0],
40
+ setArrowElement = _useState4[1];
45
41
 
46
42
  var _useFloatPosition = useFloatPosition(arrowElement, placement),
47
43
  reference = _useFloatPosition.reference,
@@ -1,8 +1,9 @@
1
1
  import { ddsBaseTokens } from '@norges-domstoler/dds-design-tokens';
2
2
 
3
3
  var Border = ddsBaseTokens.border,
4
- Colors = ddsBaseTokens.colors;
5
- var outlineOffset = '2px';
4
+ Colors = ddsBaseTokens.colors,
5
+ spacing = ddsBaseTokens.spacing;
6
+ var outlineOffset = spacing.SizesDdsSpacingLocalX0125;
6
7
  var focusVisible = {
7
8
  outline: "".concat(Border.BordersDdsBorderFocusBaseStrokeWeight, " ").concat(Border.BordersDdsBorderFocusBaseStroke, " solid"),
8
9
  outlineOffset: outlineOffset
@@ -5,4 +5,3 @@ export * from './hover';
5
5
  export * from './focus';
6
6
  export * from './danger';
7
7
  export * from './hideInput';
8
- export * from './scrollbarStyling';
@@ -0,0 +1,2 @@
1
+ import { SvgProps } from '../utils/propTypes';
2
+ export declare function CloseSmallIcon(props: SvgProps): JSX.Element;
@@ -0,0 +1,25 @@
1
+ import { __rest } from 'tslib';
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
3
+ import { StyledSvg } from '../utils/StyledSvg.js';
4
+
5
+ function CloseSmallIcon(props) {
6
+ var title = props.title,
7
+ rest = __rest(props, ["title"]);
8
+
9
+ return jsxs(StyledSvg, Object.assign({
10
+ width: 24,
11
+ height: 24,
12
+ fill: "currentColor"
13
+ }, rest, {
14
+ xmlns: "http://www.w3.org/2000/svg",
15
+ viewBox: "0 0 24 24"
16
+ }, {
17
+ children: [title && jsx("title", {
18
+ children: title
19
+ }), jsx("path", {
20
+ d: "M7.293 8.707l1.414-1.414L12 10.586l3.293-3.293 1.414 1.414L13.414 12l3.293 3.293-1.414 1.414L12 13.414l-3.293 3.293-1.414-1.414L10.586 12 7.293 8.707z"
21
+ })]
22
+ }));
23
+ }
24
+
25
+ export { CloseSmallIcon };
@@ -28,6 +28,7 @@ export * from './chevronLeft';
28
28
  export * from './chevronRight';
29
29
  export * from './chevronUp';
30
30
  export * from './close';
31
+ export * from './closeSmall';
31
32
  export * from './closeCircled';
32
33
  export * from './cloud';
33
34
  export * from './collapse';
package/dist/index.d.ts CHANGED
@@ -33,5 +33,6 @@ export * from './components/Tabs';
33
33
  export * from './components/Tag';
34
34
  export * from './components/Chip';
35
35
  export * from './components/VisuallyHidden';
36
+ export * from './components/ScrollableContainer';
36
37
  export * from './icons/tsx';
37
38
  export * from './components/Stepper';
package/dist/index.js CHANGED
@@ -59,6 +59,9 @@ export { Tag } from './components/Tag/Tag.js';
59
59
  export { Chip } from './components/Chip/Chip.js';
60
60
  export { ChipGroup } from './components/Chip/ChipGroup.js';
61
61
  export { VisuallyHidden } from './components/VisuallyHidden/VisuallyHidden.js';
62
+ export { Scrollbar } from './components/ScrollableContainer/Scrollbar.js';
63
+ export { ScrollableContainer } from './components/ScrollableContainer/ScrollableContainer.js';
64
+ export { scrollbarStyling } from './components/ScrollableContainer/scrollbarStyling.js';
62
65
  export { AppsIcon } from './icons/tsx/apps.js';
63
66
  export { ArchiveIcon } from './icons/tsx/archive.js';
64
67
  export { ArrowDownIcon } from './icons/tsx/arrowDown.js';
@@ -89,6 +92,7 @@ export { ChevronLeftIcon } from './icons/tsx/chevronLeft.js';
89
92
  export { ChevronRightIcon } from './icons/tsx/chevronRight.js';
90
93
  export { ChevronUpIcon } from './icons/tsx/chevronUp.js';
91
94
  export { CloseIcon } from './icons/tsx/close.js';
95
+ export { CloseSmallIcon } from './icons/tsx/closeSmall.js';
92
96
  export { CloseCircledIcon } from './icons/tsx/closeCircled.js';
93
97
  export { CloudIcon } from './icons/tsx/cloud.js';
94
98
  export { CollapseIcon } from './icons/tsx/collapse.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@norges-domstoler/dds-components",
3
- "version": "5.2.0-beta.2",
3
+ "version": "5.3.1",
4
4
  "description": "React components used in Elsa - domstolenes designsystem",
5
5
  "author": "Elsa team",
6
6
  "license": "MIT",
@@ -80,7 +80,7 @@
80
80
  "eslint-plugin-react": "^7.30.1",
81
81
  "eslint-plugin-storybook": "^0.6.4",
82
82
  "jest": "^28.1.3",
83
- "jest-environment-jsdom": "^28.1.3",
83
+ "jest-environment-jsdom": "^29.0.1",
84
84
  "react": "^18.2.0",
85
85
  "react-dom": "^18.2.0",
86
86
  "rollup": "^2.78.1",
@@ -116,8 +116,6 @@
116
116
  }
117
117
  },
118
118
  "dependencies": {
119
- "@emotion/react": "^11.10.0",
120
- "@emotion/styled": "^11.10.0",
121
119
  "@floating-ui/react-dom": "^1.0.0",
122
120
  "focus-visible": "^5.2.0",
123
121
  "react-select": "^5.4.0",
@@ -1,7 +0,0 @@
1
- import { CSSObject } from 'styled-components';
2
- export declare const descriptionListDescTokens: {
3
- base: CSSObject;
4
- icon: {
5
- base: CSSObject;
6
- };
7
- };
@@ -1,4 +0,0 @@
1
- import { CSSObject } from 'styled-components';
2
- export declare const descriptionListGroupTokens: {
3
- base: CSSObject;
4
- };
@@ -1,13 +0,0 @@
1
- import { CSSObject } from 'styled-components';
2
- export declare const descriptionListTermTokens: {
3
- appearance: {
4
- small: {
5
- base: CSSObject;
6
- };
7
- bold: {
8
- base: CSSObject;
9
- };
10
- };
11
- unwrappedTopAndBottomSpace: string;
12
- unwrappedBetweenSpace: string;
13
- };
@@ -1,3 +0,0 @@
1
- export declare const scrollbarWidthNumberPx = 10;
2
- export declare const scrollbarWidth: string;
3
- export declare const scrollbarStyling: import("styled-components").FlattenSimpleInterpolation;
@@ -1,7 +0,0 @@
1
- import { CSSObject } from 'styled-components';
2
- export declare const descriptionListDescTokens: {
3
- base: CSSObject;
4
- icon: {
5
- base: CSSObject;
6
- };
7
- };
@@ -1,22 +0,0 @@
1
- import { ddsBaseTokens, ddsReferenceTokens } from '@norges-domstoler/dds-design-tokens';
2
-
3
- var spacing = ddsBaseTokens.spacing,
4
- fontPackages = ddsBaseTokens.fontPackages;
5
- var textDefault = ddsReferenceTokens.textDefault;
6
- var base = Object.assign(Object.assign({}, fontPackages.body_sans_03.base), {
7
- display: 'flex',
8
- alignItems: 'center',
9
- gap: spacing.SizesDdsSpacingLocalX025,
10
- color: textDefault.textColor
11
- });
12
- var iconBase = {
13
- marginRight: spacing.SizesDdsSpacingLocalX025
14
- };
15
- var descriptionListDescTokens = {
16
- base: base,
17
- icon: {
18
- base: iconBase
19
- }
20
- };
21
-
22
- export { descriptionListDescTokens };
@@ -1,4 +0,0 @@
1
- import { CSSObject } from 'styled-components';
2
- export declare const descriptionListGroupTokens: {
3
- base: CSSObject;
4
- };
@@ -1,11 +0,0 @@
1
- import { ddsBaseTokens } from '@norges-domstoler/dds-design-tokens';
2
-
3
- var Spacing = ddsBaseTokens.spacing;
4
- var base = {
5
- margin: Spacing.SizesDdsSpacingLocalX2
6
- };
7
- var descriptionListGroupTokens = {
8
- base: base
9
- };
10
-
11
- export { descriptionListGroupTokens };
@@ -1,13 +0,0 @@
1
- import { CSSObject } from 'styled-components';
2
- export declare const descriptionListTermTokens: {
3
- appearance: {
4
- small: {
5
- base: CSSObject;
6
- };
7
- bold: {
8
- base: CSSObject;
9
- };
10
- };
11
- unwrappedTopAndBottomSpace: string;
12
- unwrappedBetweenSpace: string;
13
- };
@@ -1,27 +0,0 @@
1
- import { ddsBaseTokens, ddsReferenceTokens } from '@norges-domstoler/dds-design-tokens';
2
- import { typographyTokens } from '../Typography/Typography.tokens.js';
3
-
4
- var Spacing = ddsBaseTokens.spacing,
5
- FontPackages = ddsBaseTokens.fontPackages,
6
- Colors = ddsBaseTokens.colors;
7
- var textDefault = ddsReferenceTokens.textDefault;
8
- var boldBase = Object.assign(Object.assign(Object.assign({}, FontPackages.body_sans_03.base), typographyTokens.style.bold.base), {
9
- color: textDefault.textColor
10
- });
11
- var smallBase = Object.assign(Object.assign({}, FontPackages.body_sans_01.base), {
12
- color: Colors.DdsColorNeutralsGray7
13
- });
14
- var descriptionListTermTokens = {
15
- appearance: {
16
- small: {
17
- base: smallBase
18
- },
19
- bold: {
20
- base: boldBase
21
- }
22
- },
23
- unwrappedTopAndBottomSpace: Spacing.SizesDdsSpacingLocalX1,
24
- unwrappedBetweenSpace: Spacing.SizesDdsSpacingLocalX2
25
- };
26
-
27
- export { descriptionListTermTokens };
@@ -1,3 +0,0 @@
1
- export declare const scrollbarWidthNumberPx = 10;
2
- export declare const scrollbarWidth: string;
3
- export declare const scrollbarStyling: import("styled-components").FlattenSimpleInterpolation;
@@ -1,8 +0,0 @@
1
- import { css } from 'styled-components';
2
- import { ddsBaseTokens } from '@norges-domstoler/dds-design-tokens';
3
-
4
- var scrollbarWidthNumberPx = 10;
5
- var scrollbarWidth = "".concat(scrollbarWidthNumberPx, "px");
6
- var scrollbarStyling = css(["&::-webkit-scrollbar{width:", ";height:", ";}&::-webkit-scrollbar-track{background:transparent;border-radius:100px;}&::-webkit-scrollbar-thumb{background:", ";border-radius:100px;}&::-webkit-scrollbar-thumb:hover{background:", ";}scrollbar-color:", " transparent;scrollbar-width:thin;"], scrollbarWidth, scrollbarWidth, ddsBaseTokens.colors.DdsColorPrimaryDarkest.slice(0, -2) + '0.35)', ddsBaseTokens.colors.DdsColorPrimaryDarkest.slice(0, -2) + '0.5)', ddsBaseTokens.colors.DdsColorPrimaryDarkest.slice(0, -2) + '0.35)');
7
-
8
- export { scrollbarStyling, scrollbarWidth, scrollbarWidthNumberPx };