@bbl-digital/snorre 4.0.9 → 4.0.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. package/dist/bundle.js +129 -46
  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/Button/index.js +3 -2
  9. package/esm/core/Card/Card.stories.js +8 -7
  10. package/esm/core/Card/index.js +1 -0
  11. package/esm/core/Checkbox/Checkbox.stories.js +22 -22
  12. package/esm/core/CollapseList/CollapseList.stories.js +36 -28
  13. package/esm/core/CollapseList/Item.js +36 -3
  14. package/esm/core/CollapseList/index.js +3 -1
  15. package/esm/core/CommentsTimeline/CommentLine/index.js +13 -4
  16. package/esm/core/CommentsTimeline/CommentsTimeline.stories.js +67 -62
  17. package/esm/core/CommentsTimeline/index.js +2 -0
  18. package/esm/core/CustomText/CustomText.stories.js +12 -12
  19. package/esm/core/CustomText/index.js +4 -1
  20. package/esm/core/Dropdown/Dropdown.stories.js +16 -15
  21. package/esm/core/Dropdown/index.js +18 -0
  22. package/esm/core/Header/index.js +2 -1
  23. package/esm/core/Header/styles.js +7 -7
  24. package/esm/core/Modal/index.js +1 -1
  25. package/esm/core/Modal/styles.js +9 -9
  26. package/esm/core/Text/index.js +3 -1
  27. package/esm/core/Textarea/Textarea.stories.js +26 -19
  28. package/esm/core/Textarea/index.js +4 -2
  29. package/esm/core/Textarea/styles.js +7 -6
  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/Button/index.d.ts +3 -4
  54. package/lib/core/Button/index.d.ts.map +1 -1
  55. package/lib/core/Button/index.js +3 -2
  56. package/lib/core/Card/Card.stories.d.ts +10 -24
  57. package/lib/core/Card/Card.stories.d.ts.map +1 -1
  58. package/lib/core/Card/Card.stories.js +8 -7
  59. package/lib/core/Card/index.d.ts +1 -1
  60. package/lib/core/Card/index.d.ts.map +1 -1
  61. package/lib/core/Card/index.js +1 -0
  62. package/lib/core/Checkbox/Checkbox.stories.d.ts +10 -23
  63. package/lib/core/Checkbox/Checkbox.stories.d.ts.map +1 -1
  64. package/lib/core/Checkbox/Checkbox.stories.js +22 -22
  65. package/lib/core/CollapseList/CollapseList.stories.d.ts +7 -11
  66. package/lib/core/CollapseList/CollapseList.stories.d.ts.map +1 -1
  67. package/lib/core/CollapseList/CollapseList.stories.js +36 -28
  68. package/lib/core/CollapseList/Item.d.ts +4 -4
  69. package/lib/core/CollapseList/Item.d.ts.map +1 -1
  70. package/lib/core/CollapseList/Item.js +36 -3
  71. package/lib/core/CollapseList/index.d.ts +1 -1
  72. package/lib/core/CollapseList/index.d.ts.map +1 -1
  73. package/lib/core/CollapseList/index.js +3 -1
  74. package/lib/core/CollapseList/styles.d.ts +1 -39
  75. package/lib/core/CollapseList/styles.d.ts.map +1 -1
  76. package/lib/core/CommentsTimeline/CommentLine/index.d.ts +1 -1
  77. package/lib/core/CommentsTimeline/CommentLine/index.d.ts.map +1 -1
  78. package/lib/core/CommentsTimeline/CommentLine/index.js +13 -4
  79. package/lib/core/CommentsTimeline/CommentsTimeline.stories.d.ts +7 -11
  80. package/lib/core/CommentsTimeline/CommentsTimeline.stories.d.ts.map +1 -1
  81. package/lib/core/CommentsTimeline/CommentsTimeline.stories.js +67 -62
  82. package/lib/core/CommentsTimeline/index.d.ts.map +1 -1
  83. package/lib/core/CommentsTimeline/index.js +2 -0
  84. package/lib/core/CustomText/CustomText.stories.d.ts +9 -19
  85. package/lib/core/CustomText/CustomText.stories.d.ts.map +1 -1
  86. package/lib/core/CustomText/CustomText.stories.js +12 -12
  87. package/lib/core/CustomText/index.d.ts.map +1 -1
  88. package/lib/core/CustomText/index.js +4 -1
  89. package/lib/core/Dropdown/Dropdown.stories.d.ts +10 -23
  90. package/lib/core/Dropdown/Dropdown.stories.d.ts.map +1 -1
  91. package/lib/core/Dropdown/Dropdown.stories.js +16 -15
  92. package/lib/core/Dropdown/index.d.ts +1 -1
  93. package/lib/core/Dropdown/index.d.ts.map +1 -1
  94. package/lib/core/Dropdown/index.js +18 -0
  95. package/lib/core/FileInput/styles.d.ts +1 -39
  96. package/lib/core/FileInput/styles.d.ts.map +1 -1
  97. package/lib/core/Header/index.d.ts +3 -1
  98. package/lib/core/Header/index.d.ts.map +1 -1
  99. package/lib/core/Header/index.js +2 -1
  100. package/lib/core/Header/styles.d.ts +1 -1
  101. package/lib/core/Header/styles.d.ts.map +1 -1
  102. package/lib/core/Header/styles.js +7 -7
  103. package/lib/core/InfoButton/styles.d.ts +1 -39
  104. package/lib/core/InfoButton/styles.d.ts.map +1 -1
  105. package/lib/core/Modal/index.d.ts +1 -2
  106. package/lib/core/Modal/index.d.ts.map +1 -1
  107. package/lib/core/Modal/index.js +1 -1
  108. package/lib/core/Modal/styles.d.ts +1 -1
  109. package/lib/core/Modal/styles.d.ts.map +1 -1
  110. package/lib/core/Modal/styles.js +9 -9
  111. package/lib/core/Text/index.d.ts +2 -1
  112. package/lib/core/Text/index.d.ts.map +1 -1
  113. package/lib/core/Text/index.js +3 -1
  114. package/lib/core/Textarea/Textarea.stories.d.ts +10 -19
  115. package/lib/core/Textarea/Textarea.stories.d.ts.map +1 -1
  116. package/lib/core/Textarea/Textarea.stories.js +26 -19
  117. package/lib/core/Textarea/index.d.ts +2 -0
  118. package/lib/core/Textarea/index.d.ts.map +1 -1
  119. package/lib/core/Textarea/index.js +4 -2
  120. package/lib/core/Textarea/styles.d.ts +5 -4
  121. package/lib/core/Textarea/styles.d.ts.map +1 -1
  122. package/lib/core/Textarea/styles.js +7 -6
  123. package/lib/core/private/ButtonOrLink.d.ts +2 -3
  124. package/lib/core/private/ButtonOrLink.d.ts.map +1 -1
  125. package/lib/core/private/ButtonOrLink.js +5 -4
  126. package/lib/index.d.ts +0 -1
  127. package/lib/index.d.ts.map +1 -1
  128. package/lib/layout/Footer/FooterButton/styles.d.ts +1 -1
  129. package/lib/layout/Footer/FooterLink/styles.d.ts +1 -1
  130. package/lib/layout/Menu/MenuTop/styles.d.ts +1 -1
  131. package/package.json +1 -1
  132. package/esm/core/Autocomplete/utils/useHandleOptionsHeight.js +0 -16
  133. package/esm/core/CheckboxController/index.js +0 -22
  134. package/esm/core/Datepicker/yearMonthForm.js +0 -56
  135. package/esm/core/EditorOld/config.js +0 -69
  136. package/esm/core/EditorOld/index.js +0 -147
  137. package/esm/core/EditorOld/styles.js +0 -65
  138. package/esm/core/ImageCarousel/index.js +0 -70
  139. package/esm/core/ImageCarousel/styles.js +0 -58
  140. package/esm/enums/ModifierKey.js +0 -13
  141. package/lib/core/Autocomplete/utils/useHandleOptionsHeight.d.ts +0 -7
  142. package/lib/core/Autocomplete/utils/useHandleOptionsHeight.d.ts.map +0 -1
  143. package/lib/core/Autocomplete/utils/useHandleOptionsHeight.js +0 -16
  144. package/lib/core/CheckboxController/index.d.ts +0 -1
  145. package/lib/core/CheckboxController/index.d.ts.map +0 -1
  146. package/lib/core/CheckboxController/index.js +0 -22
  147. package/lib/core/Datepicker/yearMonthForm.d.ts +0 -10
  148. package/lib/core/Datepicker/yearMonthForm.d.ts.map +0 -1
  149. package/lib/core/Datepicker/yearMonthForm.js +0 -56
  150. package/lib/core/EditorOld/config.d.ts +0 -56
  151. package/lib/core/EditorOld/config.d.ts.map +0 -1
  152. package/lib/core/EditorOld/config.js +0 -69
  153. package/lib/core/EditorOld/index.d.ts +0 -39
  154. package/lib/core/EditorOld/index.d.ts.map +0 -1
  155. package/lib/core/EditorOld/index.js +0 -147
  156. package/lib/core/EditorOld/styles.d.ts +0 -23
  157. package/lib/core/EditorOld/styles.d.ts.map +0 -1
  158. package/lib/core/EditorOld/styles.js +0 -65
  159. package/lib/core/ImageCarousel/index.d.ts +0 -11
  160. package/lib/core/ImageCarousel/index.d.ts.map +0 -1
  161. package/lib/core/ImageCarousel/index.js +0 -70
  162. package/lib/core/ImageCarousel/styles.d.ts +0 -26
  163. package/lib/core/ImageCarousel/styles.d.ts.map +0 -1
  164. package/lib/core/ImageCarousel/styles.js +0 -58
  165. package/lib/enums/ModifierKey.d.ts +0 -12
  166. package/lib/enums/ModifierKey.d.ts.map +0 -1
  167. package/lib/enums/ModifierKey.js +0 -13
@@ -1,24 +1,11 @@
1
- /// <reference types="react" />
2
- declare const _default;
3
- export default _default;
4
- export declare const Default: {
5
- render: () => import("react").JSX.Element;
6
- name: string;
7
- };
8
- export declare const WithoutLabel: {
9
- render: () => import("react").JSX.Element;
10
- name: string;
11
- };
12
- export declare const Subtle: {
13
- render: () => import("react").JSX.Element;
14
- name: string;
15
- };
16
- export declare const Checked: {
17
- render: () => import("react").JSX.Element;
18
- name: string;
19
- };
20
- export declare const Disabled: {
21
- render: () => import("react").JSX.Element;
22
- name: string;
23
- };
1
+ import Checkbox from '.';
2
+ import { Meta, StoryObj } from '@storybook/react';
3
+ declare const meta: Meta<typeof Checkbox>;
4
+ export default meta;
5
+ declare type Story = StoryObj<typeof Checkbox>;
6
+ export declare const Default: Story;
7
+ export declare const WithoutLabel: Story;
8
+ export declare const Subtle: Story;
9
+ export declare const Checked: Story;
10
+ export declare const Disabled: Story;
24
11
  //# sourceMappingURL=Checkbox.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.stories.d.ts","sourceRoot":"","sources":["../../../src/packages/core/Checkbox/Checkbox.stories.tsx"],"names":[],"mappings":";;AAGA,wBAGS;AAET,eAAO,MAAM,OAAO;;;CAGnB,CAAA;AAED,eAAO,MAAM,YAAY;;;CAGxB,CAAA;AAED,eAAO,MAAM,MAAM;;;CAOlB,CAAA;AAED,eAAO,MAAM,OAAO;;;CAOnB,CAAA;AAED,eAAO,MAAM,QAAQ;;;CAOpB,CAAA"}
1
+ {"version":3,"file":"Checkbox.stories.d.ts","sourceRoot":"","sources":["../../../src/packages/core/Checkbox/Checkbox.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,GAAG,CAAA;AACxB,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAEjD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,QAAQ,CAG/B,CAAA;AAED,eAAe,IAAI,CAAA;AAEnB,aAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,QAAQ,CAAC,CAAA;AAEtC,eAAO,MAAM,OAAO,EAAE,KAMrB,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,KAK1B,CAAA;AAED,eAAO,MAAM,MAAM,EAAE,KAQpB,CAAA;AAED,eAAO,MAAM,OAAO,EAAE,KAQrB,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAQtB,CAAA"}
@@ -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,12 +1,8 @@
1
- /// <reference types="react" />
2
- declare const _default;
3
- export default _default;
4
- export declare const Default: {
5
- render: () => import("react").JSX.Element;
6
- name: string;
7
- };
8
- export declare const InitialOpen: {
9
- render: () => import("react").JSX.Element;
10
- name: string;
11
- };
1
+ import CollapseList from '.';
2
+ import { Meta, StoryObj } from '@storybook/react';
3
+ declare const meta: Meta<typeof CollapseList>;
4
+ export default meta;
5
+ declare type Story = StoryObj<typeof CollapseList>;
6
+ export declare const Default: Story;
7
+ export declare const InitialOpen: Story;
12
8
  //# sourceMappingURL=CollapseList.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CollapseList.stories.d.ts","sourceRoot":"","sources":["../../../src/packages/core/CollapseList/CollapseList.stories.tsx"],"names":[],"mappings":";;AAKA,wBAGS;AAET,eAAO,MAAM,OAAO;;;CAenB,CAAA;AAED,eAAO,MAAM,WAAW;;;CAYvB,CAAA"}
1
+ {"version":3,"file":"CollapseList.stories.d.ts","sourceRoot":"","sources":["../../../src/packages/core/CollapseList/CollapseList.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,GAAG,CAAA;AAG5B,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAGjD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,YAAY,CAGN,CAAA;AAE9B,eAAe,IAAI,CAAA;AAEnB,aAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,YAAY,CAAC,CAAA;AAE1C,eAAO,MAAM,OAAO,EAAE,KAiBrB,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,KAczB,CAAA"}
@@ -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,9 +1,9 @@
1
- import React, { ReactNode } from 'react';
2
- interface IProps {
1
+ import React, { HTMLAttributes } from 'react';
2
+ interface IProps extends Omit<HTMLAttributes<HTMLDivElement>, 'content'> {
3
3
  /** Content in clickable header */
4
- header: ReactNode;
4
+ header: React.ReactNode;
5
5
  /** Content in collapsable section */
6
- content: ReactNode;
6
+ content: React.ReactNode;
7
7
  /** Set open initially */
8
8
  initialOpen?: boolean;
9
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Item.d.ts","sourceRoot":"","sources":["../../../src/packages/core/CollapseList/Item.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAY,MAAM,OAAO,CAAA;AAKlD,UAAU,MAAM;IACd,kCAAkC;IAClC,MAAM,EAAE,SAAS,CAAC;IAClB,qCAAqC;IACrC,OAAO,EAAE,SAAS,CAAC;IACnB,yBAAyB;IACzB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,QAAA,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,CAsBtC,CAAA;AAED,eAAe,gBAAgB,CAAA"}
1
+ {"version":3,"file":"Item.d.ts","sourceRoot":"","sources":["../../../src/packages/core/CollapseList/Item.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,cAAc,EAKf,MAAM,OAAO,CAAA;AAOd,UAAU,MAAO,SAAQ,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,SAAS,CAAC;IACtE,kCAAkC;IAClC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAA;IACvB,qCAAqC;IACrC,OAAO,EAAE,KAAK,CAAC,SAAS,CAAA;IACxB,yBAAyB;IACzB,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAED,QAAA,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,CAiEtC,CAAA;AAED,eAAe,gBAAgB,CAAA"}
@@ -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
  });
@@ -1,6 +1,6 @@
1
1
  /** @jsxImportSource @emotion/react */
2
2
  import React from 'react';
3
- interface IProps {
3
+ interface IProps extends React.HTMLAttributes<HTMLDivElement> {
4
4
  /** Children */
5
5
  children?: React.ReactNode | React.ReactNode[];
6
6
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packages/core/CollapseList/index.tsx"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,UAAU,MAAM;IACd,eAAe;IACf,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,EAAE,CAAA;CAC/C;AAED,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,CAElC,CAAA;AAED,eAAe,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packages/core/CollapseList/index.tsx"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,UAAU,MAAO,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC3D,eAAe;IACf,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,EAAE,CAAA;CAC/C;AAED,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,CAMlC,CAAA;AAED,eAAe,YAAY,CAAA"}
@@ -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
  };
@@ -1,44 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { IAppTheme } from '../../app-shell/theme';
3
- export declare const CollapseButton: import("@emotion/styled").StyledComponent<import("../../shared/types/Accessibility").AccessibilityProps & {
4
- [prop: string]: unknown;
5
- afterIcon?: import("react").ReactNode;
6
- beforeIcon?: import("react").ReactNode;
7
- children: string | number | boolean | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | import("react").ReactPortal;
8
- disabled?: boolean | undefined;
9
- href?: string | undefined;
10
- loading?: boolean | undefined;
11
- onClick?: ((event: import("react").MouseEvent<import("../private/ButtonOrLink").ButtonOrLinkTypes, MouseEvent>) => void) | undefined;
12
- onMouseUp?: ((event: import("react").MouseEvent<import("../private/ButtonOrLink").ButtonOrLinkTypes, MouseEvent>) => void) | undefined;
13
- onKeyPress?: {
14
- key: string;
15
- action: (event: KeyboardEvent) => void;
16
- } | undefined;
17
- onEnterKeyPress?: ((event: KeyboardEvent) => void) | undefined;
18
- onEscapeKeyPress?: ((event: KeyboardEvent) => void) | undefined;
19
- openInNewWindow?: boolean | undefined;
20
- rel?: string | undefined;
21
- trackingEvent?: string | undefined;
22
- trackingName?: string | undefined;
23
- type?: "button" | "reset" | "submit" | undefined;
24
- target?: string | undefined;
25
- download?: any;
26
- tabIndex?: number | undefined;
27
- } & {
28
- success?: boolean | undefined;
29
- danger?: boolean | undefined;
30
- highlight?: boolean | undefined;
31
- outline?: boolean | undefined;
32
- nostyle?: boolean | undefined;
33
- focusable?: boolean | undefined;
34
- border?: string | undefined;
35
- css?: import("@emotion/utils").SerializedStyles | undefined;
36
- loading?: boolean | undefined;
37
- back?: boolean | undefined;
38
- small?: boolean | undefined;
39
- transparentBg?: boolean | undefined;
40
- tabIndex?: number | undefined;
41
- } & {
3
+ export declare const CollapseButton: import("@emotion/styled").StyledComponent<Omit<import("../Button").IProps, "ref"> & import("react").RefAttributes<HTMLButtonElement> & {
42
4
  theme?: import("@emotion/react").Theme | undefined;
43
5
  }, {}, {}>;
44
6
  export declare const styles: {
@@ -1 +1 @@
1
- {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/packages/core/CollapseList/styles.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAGjD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAM1B,CAAA;AAED,eAAO,MAAM,MAAM;qBACA,SAAS;CAyB3B,CAAA"}
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/packages/core/CollapseList/styles.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAGjD,eAAO,MAAM,cAAc;;UAM1B,CAAA;AAED,eAAO,MAAM,MAAM;qBACA,SAAS;CAyB3B,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- interface IProps {
2
+ interface IProps extends React.HTMLAttributes<HTMLDivElement> {
3
3
  /** Time of comment */
4
4
  time?: string;
5
5
  /** Date of comment */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/packages/core/CommentsTimeline/CommentLine/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAOzB,UAAU,MAAM;IACd,sBAAsB;IACtB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,sBAAsB;IACtB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,mBAAmB;IACnB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACtB,qBAAqB;IACrB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,mBAAmB;IACnB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,gCAAgC;IAChC,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,kBAAkB;IAClB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,iCAAiC;IACjC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,6CAA6C;IAC7C,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAChC;AAED,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,CAsCjC,CAAA;AAED,eAAe,WAAW,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/packages/core/CommentsTimeline/CommentLine/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAOzB,UAAU,MAAO,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC3D,sBAAsB;IACtB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,sBAAsB;IACtB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,mBAAmB;IACnB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACtB,qBAAqB;IACrB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,mBAAmB;IACnB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,gCAAgC;IAChC,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,kBAAkB;IAClB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,iCAAiC;IACjC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,6CAA6C;IAC7C,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAChC;AAED,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,CAgDjC,CAAA;AAED,eAAe,WAAW,CAAA"}
@@ -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,
@@ -1,12 +1,8 @@
1
- /// <reference types="react" />
2
- declare const _default;
3
- export default _default;
4
- export declare const CommentsTimeline: {
5
- render: () => import("react").JSX.Element;
6
- name: string;
7
- };
8
- export declare const CustomContent: {
9
- render: () => import("react").JSX.Element;
10
- name: string;
11
- };
1
+ import CommentsTimelineComponent from '.';
2
+ import { Meta, StoryObj } from '@storybook/react';
3
+ declare const meta: Meta<typeof CommentsTimelineComponent>;
4
+ export default meta;
5
+ declare type Story = StoryObj<typeof CommentsTimelineComponent>;
6
+ export declare const CommentsTimeline: Story;
7
+ export declare const CustomContent: Story;
12
8
  //# sourceMappingURL=CommentsTimeline.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CommentsTimeline.stories.d.ts","sourceRoot":"","sources":["../../../src/packages/core/CommentsTimeline/CommentsTimeline.stories.tsx"],"names":[],"mappings":";;AAMA,wBAGS;AAET,eAAO,MAAM,gBAAgB;;;CA6C5B,CAAA;AAED,eAAO,MAAM,aAAa;;;CAoBzB,CAAA"}
1
+ {"version":3,"file":"CommentsTimeline.stories.d.ts","sourceRoot":"","sources":["../../../src/packages/core/CommentsTimeline/CommentsTimeline.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,MAAM,GAAG,CAAA;AAIzC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAEjD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,yBAAyB,CAGhD,CAAA;AAED,eAAe,IAAI,CAAA;AAEnB,aAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,yBAAyB,CAAC,CAAA;AAEvD,eAAO,MAAM,gBAAgB,EAAE,KA8C9B,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,KAuB3B,CAAA"}
@@ -4,76 +4,81 @@ import IconComment from '../../icons/General/IconComment';
4
4
  import Button from '../Button';
5
5
  import { jsx as _jsx } from "react/jsx-runtime";
6
6
  import { jsxs as _jsxs } from "react/jsx-runtime";
7
- export default {
7
+ const meta = {
8
8
  title: 'Core/CommentsTimeline',
9
9
  component: CommentsTimelineComponent
10
10
  };
11
+ export default meta;
11
12
  export const CommentsTimeline = {
12
- render: () => /*#__PURE__*/_jsxs(CommentsTimelineComponent, {
13
- children: [/*#__PURE__*/_jsx(CommentLine, {
14
- time: "11:40",
15
- date: "20.08.2020",
16
- icon: /*#__PURE__*/_jsx(IconComment, {
17
- primary: true
18
- }),
19
- header: "Test Person",
20
- comment: "This is a comment"
21
- }), /*#__PURE__*/_jsx(CommentLine, {
22
- time: "11:30",
23
- date: "20.08.2020",
24
- icon: /*#__PURE__*/_jsx(IconComment, {
25
- primary: true
26
- }),
27
- header: "Test Person",
28
- comment: "This is a comment"
29
- }), /*#__PURE__*/_jsx(CommentLine, {
30
- time: "11:10",
31
- date: "21.02.2001",
32
- icon: /*#__PURE__*/_jsx(IconComment, {
33
- primary: true
34
- }),
35
- header: "Test Person",
36
- comment: "This is a comment"
37
- }), /*#__PURE__*/_jsx(CommentLine, {
38
- time: "11:40",
39
- date: "22.12.2000",
40
- icon: /*#__PURE__*/_jsx(IconComment, {
41
- primary: true
42
- }),
43
- header: "Kristian Gr\xF8nvold",
44
- comment: "This is a also comment"
45
- }), /*#__PURE__*/_jsx(CommentLine, {
46
- time: "11:40",
47
- date: "22.12.2000",
48
- icon: /*#__PURE__*/_jsx(IconComment, {
49
- primary: true
50
- }),
51
- header: "Kristian Gr\xF8nvold",
52
- comment: "This is an italic comment with extra info",
53
- italic: true,
54
- subtle: true,
55
- commentInfo: "Extra text"
56
- })]
57
- }),
13
+ args: {
14
+ children: /*#__PURE__*/_jsxs(CommentsTimelineComponent, {
15
+ children: [/*#__PURE__*/_jsx(CommentLine, {
16
+ time: "11:40",
17
+ date: "20.08.2020",
18
+ icon: /*#__PURE__*/_jsx(IconComment, {
19
+ primary: true
20
+ }),
21
+ header: "Test Person",
22
+ comment: "This is a comment"
23
+ }), /*#__PURE__*/_jsx(CommentLine, {
24
+ time: "11:30",
25
+ date: "20.08.2020",
26
+ icon: /*#__PURE__*/_jsx(IconComment, {
27
+ primary: true
28
+ }),
29
+ header: "Test Person",
30
+ comment: "This is a comment"
31
+ }), /*#__PURE__*/_jsx(CommentLine, {
32
+ time: "11:10",
33
+ date: "21.02.2001",
34
+ icon: /*#__PURE__*/_jsx(IconComment, {
35
+ primary: true
36
+ }),
37
+ header: "Test Person",
38
+ comment: "This is a comment"
39
+ }), /*#__PURE__*/_jsx(CommentLine, {
40
+ time: "11:40",
41
+ date: "22.12.2000",
42
+ icon: /*#__PURE__*/_jsx(IconComment, {
43
+ primary: true
44
+ }),
45
+ header: "Kristian Gr\xF8nvold",
46
+ comment: "This is a also comment"
47
+ }), /*#__PURE__*/_jsx(CommentLine, {
48
+ time: "11:40",
49
+ date: "22.12.2000",
50
+ icon: /*#__PURE__*/_jsx(IconComment, {
51
+ primary: true
52
+ }),
53
+ header: "Kristian Gr\xF8nvold",
54
+ comment: "This is an italic comment with extra info",
55
+ italic: true,
56
+ subtle: true,
57
+ commentInfo: "Extra text"
58
+ })]
59
+ })
60
+ },
58
61
  name: 'CommentsTimeline'
59
62
  };
60
63
  export const CustomContent = {
61
- render: () => /*#__PURE__*/_jsx(CommentsTimelineComponent, {
62
- children: /*#__PURE__*/_jsx(CommentLine, {
63
- time: "11:40",
64
- date: "20.08.2020",
65
- icon: /*#__PURE__*/_jsx(IconComment, {
66
- primary: true
67
- }),
68
- header: "Test Person",
69
- comment: "This is a comment",
70
- commentInfo: "Comment info",
71
- customContent: /*#__PURE__*/_jsxs("span", {
72
- children: ["This is some custom content where you can add", /*#__PURE__*/_jsx(Button, {
73
- children: "stuff"
74
- })]
64
+ args: {
65
+ children: /*#__PURE__*/_jsx(CommentsTimelineComponent, {
66
+ children: /*#__PURE__*/_jsx(CommentLine, {
67
+ time: "11:40",
68
+ date: "20.08.2020",
69
+ icon: /*#__PURE__*/_jsx(IconComment, {
70
+ primary: true
71
+ }),
72
+ header: "Test Person",
73
+ comment: "This is a comment",
74
+ commentInfo: "Comment info",
75
+ customContent: /*#__PURE__*/_jsxs("span", {
76
+ children: ["This is some custom content where you can add", /*#__PURE__*/_jsx(Button, {
77
+ children: "stuff"
78
+ })]
79
+ })
75
80
  })
76
81
  })
77
- }),
82
+ },
78
83
  name: 'Custom content'
79
84
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packages/core/CommentsTimeline/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,UAAU,MAAM;IACd,eAAe;IACf,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,EAAE,CAAA;CAC/C;AAED,QAAA,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,CAEtC,CAAA;AAED,eAAe,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packages/core/CommentsTimeline/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,UAAU,MAAM;IACd,eAAe;IACf,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,EAAE,CAAA;CAC/C;AAED,QAAA,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,CAMtC,CAAA;AAED,eAAe,gBAAgB,CAAA"}
@@ -5,6 +5,8 @@ const CommentsTimeline = ({
5
5
  children
6
6
  }) => {
7
7
  return /*#__PURE__*/_jsx(Wrapper, {
8
+ "aria-label": "Tidslinje Kommentarer",
9
+ tabIndex: 0,
8
10
  children: children
9
11
  });
10
12
  };