@bbl-digital/snorre 4.0.10 → 4.0.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (166) hide show
  1. package/dist/bundle.js +123 -38
  2. package/esm/core/Alert/index.js +1 -1
  3. package/esm/core/AppLoader/index.js +1 -1
  4. package/esm/core/Banner/Banner.stories.js +17 -0
  5. package/esm/core/Banner/index.js +1 -1
  6. package/esm/core/Box/Box.stories.js +32 -31
  7. package/esm/core/Box/index.js +10 -3
  8. package/esm/core/BoxedTable/TableBody/index.js +10 -0
  9. package/esm/core/BoxedTable/TableBody/styles.js +16 -0
  10. package/esm/core/Button/index.js +3 -2
  11. package/esm/core/Card/Card.stories.js +8 -7
  12. package/esm/core/Card/index.js +1 -0
  13. package/esm/core/Checkbox/Checkbox.stories.js +22 -22
  14. package/esm/core/CollapseList/CollapseList.stories.js +36 -28
  15. package/esm/core/CollapseList/Item.js +36 -3
  16. package/esm/core/CollapseList/index.js +3 -1
  17. package/esm/core/CommentsTimeline/CommentLine/index.js +13 -4
  18. package/esm/core/CommentsTimeline/CommentsTimeline.stories.js +67 -62
  19. package/esm/core/CommentsTimeline/index.js +2 -0
  20. package/esm/core/CustomText/CustomText.stories.js +12 -12
  21. package/esm/core/CustomText/index.js +4 -1
  22. package/esm/core/Dropdown/Dropdown.stories.js +16 -15
  23. package/esm/core/Dropdown/index.js +18 -0
  24. package/esm/core/Header/index.js +2 -1
  25. package/esm/core/Header/styles.js +7 -7
  26. package/esm/core/Input/index.js +5 -0
  27. package/esm/core/Modal/index.js +1 -1
  28. package/esm/core/Modal/styles.js +9 -9
  29. package/esm/core/Text/index.js +3 -1
  30. package/esm/core/private/ButtonOrLink.js +5 -4
  31. package/lib/core/Alert/index.d.ts +1 -2
  32. package/lib/core/Alert/index.d.ts.map +1 -1
  33. package/lib/core/Alert/index.js +1 -1
  34. package/lib/core/AppLoader/index.d.ts +1 -2
  35. package/lib/core/AppLoader/index.d.ts.map +1 -1
  36. package/lib/core/AppLoader/index.js +1 -1
  37. package/lib/core/Autocomplete/styles.d.ts +1 -39
  38. package/lib/core/Autocomplete/styles.d.ts.map +1 -1
  39. package/lib/core/Banner/Banner.stories.d.ts +1 -0
  40. package/lib/core/Banner/Banner.stories.d.ts.map +1 -1
  41. package/lib/core/Banner/Banner.stories.js +17 -0
  42. package/lib/core/Banner/index.d.ts +1 -2
  43. package/lib/core/Banner/index.d.ts.map +1 -1
  44. package/lib/core/Banner/index.js +1 -1
  45. package/lib/core/Box/Box.stories.d.ts +14 -39
  46. package/lib/core/Box/Box.stories.d.ts.map +1 -1
  47. package/lib/core/Box/Box.stories.js +32 -31
  48. package/lib/core/Box/index.d.ts +1 -1
  49. package/lib/core/Box/index.d.ts.map +1 -1
  50. package/lib/core/Box/index.js +10 -3
  51. package/lib/core/Box/styles.d.ts +1 -39
  52. package/lib/core/Box/styles.d.ts.map +1 -1
  53. package/lib/core/BoxedTable/TableBody/index.d.ts +7 -0
  54. package/lib/core/BoxedTable/TableBody/index.d.ts.map +1 -0
  55. package/lib/core/BoxedTable/TableBody/index.js +10 -0
  56. package/lib/core/BoxedTable/TableBody/styles.d.ts +6 -0
  57. package/lib/core/BoxedTable/TableBody/styles.d.ts.map +1 -0
  58. package/lib/core/BoxedTable/TableBody/styles.js +16 -0
  59. package/lib/core/Button/index.d.ts +3 -4
  60. package/lib/core/Button/index.d.ts.map +1 -1
  61. package/lib/core/Button/index.js +3 -2
  62. package/lib/core/Card/Card.stories.d.ts +10 -24
  63. package/lib/core/Card/Card.stories.d.ts.map +1 -1
  64. package/lib/core/Card/Card.stories.js +8 -7
  65. package/lib/core/Card/index.d.ts +1 -1
  66. package/lib/core/Card/index.d.ts.map +1 -1
  67. package/lib/core/Card/index.js +1 -0
  68. package/lib/core/Checkbox/Checkbox.stories.d.ts +10 -23
  69. package/lib/core/Checkbox/Checkbox.stories.d.ts.map +1 -1
  70. package/lib/core/Checkbox/Checkbox.stories.js +22 -22
  71. package/lib/core/CollapseList/CollapseList.stories.d.ts +7 -11
  72. package/lib/core/CollapseList/CollapseList.stories.d.ts.map +1 -1
  73. package/lib/core/CollapseList/CollapseList.stories.js +36 -28
  74. package/lib/core/CollapseList/Item.d.ts +4 -4
  75. package/lib/core/CollapseList/Item.d.ts.map +1 -1
  76. package/lib/core/CollapseList/Item.js +36 -3
  77. package/lib/core/CollapseList/index.d.ts +1 -1
  78. package/lib/core/CollapseList/index.d.ts.map +1 -1
  79. package/lib/core/CollapseList/index.js +3 -1
  80. package/lib/core/CollapseList/styles.d.ts +1 -39
  81. package/lib/core/CollapseList/styles.d.ts.map +1 -1
  82. package/lib/core/CommentsTimeline/CommentLine/index.d.ts +1 -1
  83. package/lib/core/CommentsTimeline/CommentLine/index.d.ts.map +1 -1
  84. package/lib/core/CommentsTimeline/CommentLine/index.js +13 -4
  85. package/lib/core/CommentsTimeline/CommentsTimeline.stories.d.ts +7 -11
  86. package/lib/core/CommentsTimeline/CommentsTimeline.stories.d.ts.map +1 -1
  87. package/lib/core/CommentsTimeline/CommentsTimeline.stories.js +67 -62
  88. package/lib/core/CommentsTimeline/index.d.ts.map +1 -1
  89. package/lib/core/CommentsTimeline/index.js +2 -0
  90. package/lib/core/CustomText/CustomText.stories.d.ts +9 -19
  91. package/lib/core/CustomText/CustomText.stories.d.ts.map +1 -1
  92. package/lib/core/CustomText/CustomText.stories.js +12 -12
  93. package/lib/core/CustomText/index.d.ts.map +1 -1
  94. package/lib/core/CustomText/index.js +4 -1
  95. package/lib/core/Dropdown/Dropdown.stories.d.ts +10 -23
  96. package/lib/core/Dropdown/Dropdown.stories.d.ts.map +1 -1
  97. package/lib/core/Dropdown/Dropdown.stories.js +16 -15
  98. package/lib/core/Dropdown/index.d.ts +1 -1
  99. package/lib/core/Dropdown/index.d.ts.map +1 -1
  100. package/lib/core/Dropdown/index.js +18 -0
  101. package/lib/core/FileInput/styles.d.ts +1 -39
  102. package/lib/core/FileInput/styles.d.ts.map +1 -1
  103. package/lib/core/Header/index.d.ts +3 -1
  104. package/lib/core/Header/index.d.ts.map +1 -1
  105. package/lib/core/Header/index.js +2 -1
  106. package/lib/core/Header/styles.d.ts +1 -1
  107. package/lib/core/Header/styles.d.ts.map +1 -1
  108. package/lib/core/Header/styles.js +7 -7
  109. package/lib/core/InfoButton/styles.d.ts +1 -39
  110. package/lib/core/InfoButton/styles.d.ts.map +1 -1
  111. package/lib/core/Input/index.d.ts.map +1 -1
  112. package/lib/core/Input/index.js +5 -0
  113. package/lib/core/Modal/index.d.ts +1 -2
  114. package/lib/core/Modal/index.d.ts.map +1 -1
  115. package/lib/core/Modal/index.js +1 -1
  116. package/lib/core/Modal/styles.d.ts +1 -1
  117. package/lib/core/Modal/styles.d.ts.map +1 -1
  118. package/lib/core/Modal/styles.js +9 -9
  119. package/lib/core/Text/index.d.ts +2 -1
  120. package/lib/core/Text/index.d.ts.map +1 -1
  121. package/lib/core/Text/index.js +3 -1
  122. package/lib/core/private/ButtonOrLink.d.ts +2 -3
  123. package/lib/core/private/ButtonOrLink.d.ts.map +1 -1
  124. package/lib/core/private/ButtonOrLink.js +5 -4
  125. package/lib/index.d.ts +0 -1
  126. package/lib/index.d.ts.map +1 -1
  127. package/lib/layout/Footer/FooterButton/styles.d.ts +1 -1
  128. package/lib/layout/Footer/FooterLink/styles.d.ts +1 -1
  129. package/lib/layout/Menu/MenuTop/styles.d.ts +1 -1
  130. package/package.json +1 -1
  131. package/esm/core/Autocomplete/utils/useHandleOptionsHeight.js +0 -16
  132. package/esm/core/CheckboxController/index.js +0 -22
  133. package/esm/core/Datepicker/yearMonthForm.js +0 -56
  134. package/esm/core/EditorOld/config.js +0 -69
  135. package/esm/core/EditorOld/index.js +0 -147
  136. package/esm/core/EditorOld/styles.js +0 -65
  137. package/esm/core/ImageCarousel/index.js +0 -70
  138. package/esm/core/ImageCarousel/styles.js +0 -58
  139. package/esm/enums/ModifierKey.js +0 -13
  140. package/lib/core/Autocomplete/utils/useHandleOptionsHeight.d.ts +0 -7
  141. package/lib/core/Autocomplete/utils/useHandleOptionsHeight.d.ts.map +0 -1
  142. package/lib/core/Autocomplete/utils/useHandleOptionsHeight.js +0 -16
  143. package/lib/core/CheckboxController/index.d.ts +0 -1
  144. package/lib/core/CheckboxController/index.d.ts.map +0 -1
  145. package/lib/core/CheckboxController/index.js +0 -22
  146. package/lib/core/Datepicker/yearMonthForm.d.ts +0 -10
  147. package/lib/core/Datepicker/yearMonthForm.d.ts.map +0 -1
  148. package/lib/core/Datepicker/yearMonthForm.js +0 -56
  149. package/lib/core/EditorOld/config.d.ts +0 -56
  150. package/lib/core/EditorOld/config.d.ts.map +0 -1
  151. package/lib/core/EditorOld/config.js +0 -69
  152. package/lib/core/EditorOld/index.d.ts +0 -39
  153. package/lib/core/EditorOld/index.d.ts.map +0 -1
  154. package/lib/core/EditorOld/index.js +0 -147
  155. package/lib/core/EditorOld/styles.d.ts +0 -23
  156. package/lib/core/EditorOld/styles.d.ts.map +0 -1
  157. package/lib/core/EditorOld/styles.js +0 -65
  158. package/lib/core/ImageCarousel/index.d.ts +0 -11
  159. package/lib/core/ImageCarousel/index.d.ts.map +0 -1
  160. package/lib/core/ImageCarousel/index.js +0 -70
  161. package/lib/core/ImageCarousel/styles.d.ts +0 -26
  162. package/lib/core/ImageCarousel/styles.d.ts.map +0 -1
  163. package/lib/core/ImageCarousel/styles.js +0 -58
  164. package/lib/enums/ModifierKey.d.ts +0 -12
  165. package/lib/enums/ModifierKey.d.ts.map +0 -1
  166. package/lib/enums/ModifierKey.js +0 -13
@@ -33,7 +33,6 @@ const Alert = ({
33
33
  return 'Informasjon';
34
34
  };
35
35
  const accessibilityProps = {
36
- role: restProps['role'] || 'alert',
37
36
  'aria-live': ariaLivePolicy,
38
37
  'aria-atomic': restProps['aria-atomic'] || true,
39
38
  'aria-label': restProps['aria-label'] || getDefaultAriaLabel(),
@@ -41,6 +40,7 @@ const Alert = ({
41
40
  'aria-describedby': descriptionId.current
42
41
  };
43
42
  return _jsxs("div", {
43
+ role: "alert",
44
44
  css: theme => [styles.default(theme), success && styles.success(theme), info && styles.info(theme), danger && styles.danger(theme), rounded && styles.rounded, primary && styles.primary(theme), css && css],
45
45
  className: className,
46
46
  ...restProps,
@@ -8,11 +8,11 @@ const AppLoader = ({
8
8
  ...restProps
9
9
  }) => {
10
10
  const accessibilityProps = {
11
- role: restProps['role'] || 'status',
12
11
  'aria-live': restProps['aria-live'] || 'polite',
13
12
  'aria-label': restProps['aria-label'] || 'Laster innhold'
14
13
  };
15
14
  return _jsxs("div", {
15
+ role: "status",
16
16
  css: theme => [styles.default(theme, color)],
17
17
  ...restProps,
18
18
  ...accessibilityProps,
@@ -73,4 +73,21 @@ export const WithoutChildren = {
73
73
  })
74
74
  },
75
75
  name: 'Without children'
76
+ };
77
+ export const WithAriaLabel = {
78
+ args: {
79
+ header: /*#__PURE__*/_jsx(Header, {
80
+ level: 4,
81
+ children: "Title"
82
+ }),
83
+ 'aria-label': 'Title. Some content.',
84
+ children: /*#__PURE__*/_jsx("p", {
85
+ children: "Some content"
86
+ }),
87
+ actionButton: /*#__PURE__*/_jsx(Button, {
88
+ onClick: () => console.log('Hello'),
89
+ children: "Hello I am button"
90
+ })
91
+ },
92
+ name: 'With aria-label'
76
93
  };
@@ -15,7 +15,7 @@ const Banner = ({
15
15
  }) => {
16
16
  const isDefault = !success && !danger && !info;
17
17
  return _jsx(Alert, {
18
- role: "banner",
18
+ "aria-live": "assertive",
19
19
  rounded: true,
20
20
  primary: isDefault,
21
21
  success: success,
@@ -1,89 +1,90 @@
1
1
  import Header from '../Header';
2
2
  import Box from '.';
3
3
  import { jsx as _jsx } from "react/jsx-runtime";
4
- export default {
4
+ const meta = {
5
5
  title: 'Core/Box',
6
6
  component: Box
7
7
  };
8
+ export default meta;
8
9
  export const Default = {
9
- render: () => /*#__PURE__*/_jsx(Box, {
10
- children: "Stuff"
11
- }),
10
+ args: {
11
+ children: 'Stuff'
12
+ },
12
13
  name: 'Default'
13
14
  };
14
15
  export const Collapsable = {
15
- render: () => /*#__PURE__*/_jsx(Box, {
16
+ args: {
16
17
  header: /*#__PURE__*/_jsx(Header, {
17
18
  level: 3,
18
19
  children: "Header"
19
20
  }),
20
21
  collapsable: true,
21
- children: "Stuff"
22
- }),
22
+ children: 'Stuff'
23
+ },
23
24
  name: 'Collapsable'
24
25
  };
25
26
  export const Rounded = {
26
- render: () => /*#__PURE__*/_jsx(Box, {
27
- type: "mysite",
28
- children: "Stuff"
29
- }),
27
+ args: {
28
+ type: 'mysite',
29
+ children: 'Stuff'
30
+ },
30
31
  name: 'Rounded'
31
32
  };
32
33
  export const WithHeader = {
33
- render: () => /*#__PURE__*/_jsx(Box, {
34
+ args: {
34
35
  header: /*#__PURE__*/_jsx(Header, {
35
36
  level: 3,
36
37
  children: "Header"
37
38
  }),
38
- children: "Stuff"
39
- }),
39
+ children: 'Stuff'
40
+ },
40
41
  name: 'With header'
41
42
  };
42
43
  export const WithHeaderAndCollapse = {
43
- render: () => /*#__PURE__*/_jsx(Box, {
44
+ args: {
44
45
  header: /*#__PURE__*/_jsx(Header, {
45
46
  level: 3,
46
47
  children: "Header"
47
48
  }),
48
49
  collapsable: true,
49
- children: "Stuff"
50
- }),
50
+ children: 'Stuff'
51
+ },
51
52
  name: 'With header and collapse'
52
53
  };
53
54
  export const CollapsableMysite = {
54
- render: () => /*#__PURE__*/_jsx(Box, {
55
+ args: {
55
56
  header: /*#__PURE__*/_jsx(Header, {
56
57
  level: 3,
57
58
  children: "Header"
58
59
  }),
59
60
  collapsable: true,
60
- type: "mysite",
61
- children: "Stuff"
62
- }),
61
+ type: 'mysite',
62
+ children: 'Stuff'
63
+ },
63
64
  name: 'Collapsable mysite'
64
65
  };
65
66
  export const Noshadow = {
66
- render: () => /*#__PURE__*/_jsx(Box, {
67
+ args: {
67
68
  noshadow: true,
68
- children: "Stuff"
69
- }),
69
+ children: 'Stuff'
70
+ },
70
71
  name: 'Noshadow'
71
72
  };
72
73
  export const Background = {
73
- render: () => /*#__PURE__*/_jsx(Box, {
74
- background: "#ececec",
75
- children: "Stuff"
76
- }),
74
+ args: {
75
+ background: '#ececec',
76
+ children: 'Stuff'
77
+ },
77
78
  name: 'Background'
78
79
  };
79
80
  export const HideContent = {
80
- render: () => /*#__PURE__*/_jsx(Box, {
81
+ args: {
81
82
  header: /*#__PURE__*/_jsx(Header, {
82
83
  level: 3,
83
84
  children: "Header"
84
85
  }),
85
86
  hideContent: true,
86
- children: "Content"
87
- }),
87
+ children: 'Stuff'
88
+ },
88
89
  name: 'Hide content'
89
90
  };
@@ -28,12 +28,18 @@ const Box = ({
28
28
  const onCollapseIconClicked = e => {
29
29
  setIsOpen(!isOpen);
30
30
  };
31
- const icon = collapseIcon === 'plus/minus' ? isOpen ? _jsx(IconMinus, {}) : _jsx(IconPlus, {}) : _jsx(IconChevronDown, {
31
+ const icon = collapseIcon === 'plus/minus' ? isOpen ? _jsx(IconMinus, {
32
+ "aria-hidden": "true"
33
+ }) : _jsx(IconPlus, {
34
+ "aria-hidden": "true"
35
+ }) : _jsx(IconChevronDown, {
32
36
  flipVertical: isOpen,
33
- size: "14px"
37
+ size: "14px",
38
+ "aria-hidden": "true"
34
39
  });
35
40
  const headerWrapper = collapsable ? _jsx(CollapseButton, {
36
- "aria-label": "Toggle box open close",
41
+ "aria-label": `Toggle box ${isOpen ? 'closed' : 'open'}`,
42
+ "aria-expanded": isOpen,
37
43
  onClick: onCollapseIconClicked,
38
44
  nostyle: true,
39
45
  children: _jsxs(HeaderWrapper, {
@@ -45,6 +51,7 @@ const Box = ({
45
51
  children: header
46
52
  });
47
53
  return _jsxs("div", {
54
+ role: "group",
48
55
  css: theme => [styles.default(theme), css && css, type === 'mysite' && styles.mysite(theme), noshadow && styles.noshadow, background && styles.background(background)],
49
56
  className: className,
50
57
  ...restProps,
@@ -0,0 +1,10 @@
1
+ import { BodyWrapper } from './styles';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ const TableBody = ({
4
+ children
5
+ }) => {
6
+ return /*#__PURE__*/_jsx(BodyWrapper, {
7
+ children: children
8
+ });
9
+ };
10
+ export default TableBody;
@@ -0,0 +1,16 @@
1
+ import _styled from "@emotion/styled/base";
2
+ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
3
+ export const BodyWrapper = /*#__PURE__*/_styled("tbody", process.env.NODE_ENV === "production" ? {
4
+ target: "e1u8g1t20"
5
+ } : {
6
+ target: "e1u8g1t20",
7
+ label: "BodyWrapper"
8
+ })(process.env.NODE_ENV === "production" ? {
9
+ name: "ixi98c",
10
+ styles: "display:flex;flex-direction:column;grid-row-gap:1em"
11
+ } : {
12
+ name: "ixi98c",
13
+ styles: "display:flex;flex-direction:column;grid-row-gap:1em",
14
+ map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9wYWNrYWdlcy9jb3JlL0JveGVkVGFibGUvVGFibGVCb2R5L3N0eWxlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFFdUMiLCJmaWxlIjoiLi4vLi4vLi4vLi4vc3JjL3BhY2thZ2VzL2NvcmUvQm94ZWRUYWJsZS9UYWJsZUJvZHkvc3R5bGVzLnRzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnXG5cbmV4cG9ydCBjb25zdCBCb2R5V3JhcHBlciA9IHN0eWxlZC50Ym9keWBcbiAgZGlzcGxheTogZmxleDtcbiAgZmxleC1kaXJlY3Rpb246IGNvbHVtbjtcbiAgZ3JpZC1yb3ctZ2FwOiAxZW07XG5gXG4iXX0= */",
15
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
16
+ });
@@ -6,7 +6,7 @@ import AppLoader from '../AppLoader';
6
6
  import { useTheme } from '@emotion/react';
7
7
  import IconChevronLeft from '../../icons/General/IconChevronLeft';
8
8
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
9
- const Button = props => {
9
+ const Button = /*#__PURE__*/React.forwardRef((props, ref) => {
10
10
  const {
11
11
  danger,
12
12
  success,
@@ -49,6 +49,7 @@ const Button = props => {
49
49
  tabIndex: tabIndex,
50
50
  disabled: disabled,
51
51
  loading: loading,
52
+ ref: ref,
52
53
  css: theme => [styles.default(theme), outline && styles.outline(theme), danger && styles.danger(theme), success && styles.success(theme), highlight && styles.highlighted, disabled && styles.disabled(theme), (beforeIcon || afterIcon) && styles.icon(theme), beforeIcon && styles.beforeIcon, afterIcon && styles.afterIcon, border && styles.border(border), nostyle && styles.nostyle, loading && styles.loading(theme), back && styles.back(theme), css && css, small && styles.small, danger && outline && styles.dangerOutline(theme), success && outline && styles.successOutline(theme), transparentBg && styles.transparentBg, focusable && styles.focusable],
53
54
  afterIcon: afterIcon,
54
55
  beforeIcon: back ? _jsx(IconChevronLeft, {
@@ -60,5 +61,5 @@ const Button = props => {
60
61
  color: getLoaderColor()
61
62
  }) : props.children
62
63
  });
63
- };
64
+ });
64
65
  export default Button;
@@ -2,21 +2,22 @@ import Card from '.';
2
2
  import Dropdown from '../Dropdown';
3
3
  import { jsx as _jsx } from "react/jsx-runtime";
4
4
  import { jsxs as _jsxs } from "react/jsx-runtime";
5
- export default {
5
+ const meta = {
6
6
  title: 'Core/Card',
7
7
  component: Card
8
8
  };
9
+ export default meta;
9
10
  export const Default = {
10
- render: () => /*#__PURE__*/_jsx(Card, {
11
- children: "Stuff"
12
- }),
11
+ args: {
12
+ children: 'Stuff'
13
+ },
13
14
  name: 'Default'
14
15
  };
15
16
  export const WithHover = {
16
- render: () => /*#__PURE__*/_jsx(Card, {
17
+ args: {
17
18
  withhover: true,
18
- children: "Hover me!"
19
- }),
19
+ children: 'Hover me!'
20
+ },
20
21
  name: 'With hover'
21
22
  };
22
23
  export const WithShadow = {
@@ -20,6 +20,7 @@ const Card = ({
20
20
  onClick: props.onClick,
21
21
  onKeyPress: handleOnKeyPress,
22
22
  className: className,
23
+ ...props,
23
24
  children: props.children
24
25
  });
25
26
  };
@@ -1,43 +1,43 @@
1
1
  import Checkbox from '.';
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- export default {
2
+ const meta = {
4
3
  title: 'Core/Checkbox',
5
4
  component: Checkbox
6
5
  };
6
+ export default meta;
7
7
  export const Default = {
8
- render: () => /*#__PURE__*/_jsx(Checkbox, {
9
- value: "value1",
10
- children: "Option"
11
- }),
8
+ args: {
9
+ value: 'value1',
10
+ children: 'Option'
11
+ },
12
12
  name: 'Default'
13
13
  };
14
14
  export const WithoutLabel = {
15
- render: () => /*#__PURE__*/_jsx(Checkbox, {
16
- value: "value1"
17
- }),
15
+ args: {
16
+ value: 'value1'
17
+ },
18
18
  name: 'Without label'
19
19
  };
20
20
  export const Subtle = {
21
- render: () => /*#__PURE__*/_jsx(Checkbox, {
22
- value: "value1",
23
- type: "subtle",
24
- children: "Option"
25
- }),
21
+ args: {
22
+ value: 'value1',
23
+ type: 'subtle',
24
+ children: 'Option'
25
+ },
26
26
  name: 'Subtle'
27
27
  };
28
28
  export const Checked = {
29
- render: () => /*#__PURE__*/_jsx(Checkbox, {
30
- value: "value1",
29
+ args: {
30
+ value: 'value1',
31
31
  checked: true,
32
- children: "Option"
33
- }),
32
+ children: 'Option'
33
+ },
34
34
  name: 'Checked'
35
35
  };
36
36
  export const Disabled = {
37
- render: () => /*#__PURE__*/_jsx(Checkbox, {
38
- value: "value1",
37
+ args: {
38
+ value: 'value1',
39
39
  disabled: true,
40
- children: "Disabled option"
41
- }),
40
+ children: 'Disabled option'
41
+ },
42
42
  name: 'Disabled'
43
43
  };
@@ -1,43 +1,51 @@
1
1
  import CollapseList from '.';
2
2
  import CollapseListItem from './Item';
3
3
  import Text from '../Text';
4
+ import Header from '../Header';
4
5
  import { jsx as _jsx } from "react/jsx-runtime";
5
6
  import { jsxs as _jsxs } from "react/jsx-runtime";
6
- export default {
7
+ const meta = {
7
8
  title: 'Core/CollapseList',
8
9
  component: CollapseList
9
10
  };
11
+ export default meta;
10
12
  export const Default = {
11
- render: () => /*#__PURE__*/_jsxs(CollapseList, {
12
- children: [/*#__PURE__*/_jsx(CollapseListItem, {
13
- header: /*#__PURE__*/_jsx(Text, {
14
- children: "Header"
15
- }),
16
- content: /*#__PURE__*/_jsx(Text, {
17
- children: "Content"
18
- })
19
- }), /*#__PURE__*/_jsx(CollapseListItem, {
20
- header: /*#__PURE__*/_jsx(Text, {
21
- children: "Item 2"
22
- }),
23
- content: /*#__PURE__*/_jsx(Text, {
24
- children: "Content"
25
- })
26
- })]
27
- }),
13
+ args: {
14
+ children: /*#__PURE__*/_jsxs(CollapseList, {
15
+ children: [/*#__PURE__*/_jsx(CollapseListItem, {
16
+ header: /*#__PURE__*/_jsx(Header, {
17
+ level: 5,
18
+ children: "Header"
19
+ }),
20
+ content: /*#__PURE__*/_jsx(Text, {
21
+ children: "Content"
22
+ })
23
+ }), /*#__PURE__*/_jsx(CollapseListItem, {
24
+ header: /*#__PURE__*/_jsx(Header, {
25
+ level: 5,
26
+ children: "Item 2"
27
+ }),
28
+ content: /*#__PURE__*/_jsx(Text, {
29
+ children: "Content"
30
+ })
31
+ })]
32
+ })
33
+ },
28
34
  name: 'Default'
29
35
  };
30
36
  export const InitialOpen = {
31
- render: () => /*#__PURE__*/_jsx(CollapseList, {
32
- children: /*#__PURE__*/_jsx(CollapseListItem, {
33
- header: /*#__PURE__*/_jsx(Text, {
34
- children: "Header"
35
- }),
36
- content: /*#__PURE__*/_jsx(Text, {
37
- children: "Content"
38
- }),
39
- initialOpen: true
37
+ args: {
38
+ children: /*#__PURE__*/_jsx(CollapseList, {
39
+ children: /*#__PURE__*/_jsx(CollapseListItem, {
40
+ header: /*#__PURE__*/_jsx(Text, {
41
+ children: "Header"
42
+ }),
43
+ content: /*#__PURE__*/_jsx(Text, {
44
+ children: "Content"
45
+ }),
46
+ initialOpen: true
47
+ })
40
48
  })
41
- }),
49
+ },
42
50
  name: 'initialOpen'
43
51
  };
@@ -1,32 +1,65 @@
1
- import React, { useState } from 'react';
1
+ import React, { useMemo, useRef, useState } from 'react';
2
2
  import { CollapseButton } from './styles';
3
3
  import { IconChevronDown } from '../..';
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
5
  import { jsxs as _jsxs } from "react/jsx-runtime";
6
+ const headerTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'Header'];
6
7
  const CollapseListItem = ({
7
8
  header,
8
9
  content,
9
- initialOpen
10
+ initialOpen,
11
+ ...restProps
10
12
  }) => {
11
13
  const [open, setOpen] = useState(initialOpen ? true : false);
14
+ const contentRef = useRef(null);
15
+ const contentId = `content-${Math.random().toString(36).substring(2, 9)}`;
16
+ const tag = useMemo(() => getHtmlTag(header), [header]);
17
+ const isHeadingOrHTMLHeading = headerTags.includes(tag || '');
18
+ function getHtmlTag(node) {
19
+ if ( /*#__PURE__*/React.isValidElement(node)) {
20
+ const element = node;
21
+ if (typeof element.type === 'function') {
22
+ return element.type.name;
23
+ } else if (typeof element.type === 'string') {
24
+ return element.type;
25
+ }
26
+ }
27
+ return null;
28
+ }
12
29
  const toggleOpen = () => {
13
30
  setOpen(!open);
31
+ if (!open && contentRef.current) {
32
+ contentRef.current.focus(); // Optional focus management.
33
+ }
14
34
  };
35
+
15
36
  return /*#__PURE__*/_jsxs("div", {
16
37
  className: "item",
38
+ ...restProps,
39
+ role: restProps['role'] || 'listitem',
17
40
  children: [/*#__PURE__*/_jsx(CollapseButton, {
18
41
  onClick: toggleOpen,
19
42
  nostyle: true,
43
+ "aria-expanded": open,
44
+ "aria-controls": contentId,
45
+ "aria-label": typeof header === 'string' ? `Toggle ${header}` : undefined,
20
46
  children: /*#__PURE__*/_jsxs("div", {
21
47
  className: "header",
48
+ role: !isHeadingOrHTMLHeading ? 'heading' : undefined,
22
49
  children: [header, /*#__PURE__*/_jsx(IconChevronDown, {
23
50
  primary: true,
24
51
  flipVertical: open,
25
52
  size: '14px'
26
53
  })]
27
54
  })
28
- }), open && /*#__PURE__*/_jsx("div", {
55
+ }), open && /*#__PURE__*/_jsx("section", {
56
+ role: "region",
29
57
  className: "content",
58
+ id: contentId,
59
+ "aria-hidden": !open,
60
+ ref: contentRef,
61
+ tabIndex: -1,
62
+ "aria-live": "polite",
30
63
  children: content
31
64
  })]
32
65
  });
@@ -3,10 +3,12 @@ import React from 'react';
3
3
  import { styles } from './styles';
4
4
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
5
5
  const CollapseList = ({
6
- children
6
+ children,
7
+ ...restProps
7
8
  }) => {
8
9
  return _jsx("div", {
9
10
  css: theme => [styles.default(theme)],
11
+ ...restProps,
10
12
  children: children
11
13
  });
12
14
  };
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { DateWrapper, IconWrapper, TextWrapper, Wrapper } from './styles';
3
3
  import { useTheme } from '@emotion/react';
4
4
  import Text from '../../Text';
5
- import { useIsMobile } from '../../..';
5
+ import { Header, useIsMobile } from '../../..';
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
7
  import { jsxs as _jsxs } from "react/jsx-runtime";
8
8
  const CommentLine = ({
@@ -14,13 +14,18 @@ const CommentLine = ({
14
14
  italic,
15
15
  commentInfo,
16
16
  subtle,
17
- customContent
17
+ customContent,
18
+ ...restProps
18
19
  }) => {
19
20
  const theme = useTheme();
20
21
  const isMobile = useIsMobile();
22
+ const ariaLabel = `kommentar ${date} klokken ${time}`;
21
23
  return /*#__PURE__*/_jsxs(Wrapper, {
22
24
  theme: theme,
23
25
  "data-testid": "comment-line",
26
+ role: "article",
27
+ "aria-label": ariaLabel,
28
+ ...restProps,
24
29
  children: [/*#__PURE__*/_jsxs(DateWrapper, {
25
30
  children: [/*#__PURE__*/_jsx(Text, {
26
31
  subtle: true,
@@ -31,15 +36,19 @@ const CommentLine = ({
31
36
  children: date
32
37
  })]
33
38
  }), /*#__PURE__*/_jsx(IconWrapper, {
39
+ "aria-hidden": true,
34
40
  children: icon
35
41
  }), /*#__PURE__*/_jsxs(TextWrapper, {
36
- children: [/*#__PURE__*/_jsx(Text, {
37
- semibold: true,
42
+ tabIndex: 0,
43
+ children: [/*#__PURE__*/_jsx(Header, {
44
+ level: 5,
45
+ size: "16px",
38
46
  children: header
39
47
  }), /*#__PURE__*/_jsx(Text, {
40
48
  italic: italic,
41
49
  subtle: subtle,
42
50
  size: "14px",
51
+ paragraph: true,
43
52
  children: comment
44
53
  }), commentInfo && /*#__PURE__*/_jsx(Text, {
45
54
  italic: true,