@bbl-digital/snorre 4.0.10 → 4.0.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. package/dist/bundle.js +118 -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/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/private/ButtonOrLink.js +5 -4
  28. package/lib/core/Alert/index.d.ts +1 -2
  29. package/lib/core/Alert/index.d.ts.map +1 -1
  30. package/lib/core/Alert/index.js +1 -1
  31. package/lib/core/AppLoader/index.d.ts +1 -2
  32. package/lib/core/AppLoader/index.d.ts.map +1 -1
  33. package/lib/core/AppLoader/index.js +1 -1
  34. package/lib/core/Autocomplete/styles.d.ts +1 -39
  35. package/lib/core/Autocomplete/styles.d.ts.map +1 -1
  36. package/lib/core/Banner/Banner.stories.d.ts +1 -0
  37. package/lib/core/Banner/Banner.stories.d.ts.map +1 -1
  38. package/lib/core/Banner/Banner.stories.js +17 -0
  39. package/lib/core/Banner/index.d.ts +1 -2
  40. package/lib/core/Banner/index.d.ts.map +1 -1
  41. package/lib/core/Banner/index.js +1 -1
  42. package/lib/core/Box/Box.stories.d.ts +14 -39
  43. package/lib/core/Box/Box.stories.d.ts.map +1 -1
  44. package/lib/core/Box/Box.stories.js +32 -31
  45. package/lib/core/Box/index.d.ts +1 -1
  46. package/lib/core/Box/index.d.ts.map +1 -1
  47. package/lib/core/Box/index.js +10 -3
  48. package/lib/core/Box/styles.d.ts +1 -39
  49. package/lib/core/Box/styles.d.ts.map +1 -1
  50. package/lib/core/Button/index.d.ts +3 -4
  51. package/lib/core/Button/index.d.ts.map +1 -1
  52. package/lib/core/Button/index.js +3 -2
  53. package/lib/core/Card/Card.stories.d.ts +10 -24
  54. package/lib/core/Card/Card.stories.d.ts.map +1 -1
  55. package/lib/core/Card/Card.stories.js +8 -7
  56. package/lib/core/Card/index.d.ts +1 -1
  57. package/lib/core/Card/index.d.ts.map +1 -1
  58. package/lib/core/Card/index.js +1 -0
  59. package/lib/core/Checkbox/Checkbox.stories.d.ts +10 -23
  60. package/lib/core/Checkbox/Checkbox.stories.d.ts.map +1 -1
  61. package/lib/core/Checkbox/Checkbox.stories.js +22 -22
  62. package/lib/core/CollapseList/CollapseList.stories.d.ts +7 -11
  63. package/lib/core/CollapseList/CollapseList.stories.d.ts.map +1 -1
  64. package/lib/core/CollapseList/CollapseList.stories.js +36 -28
  65. package/lib/core/CollapseList/Item.d.ts +4 -4
  66. package/lib/core/CollapseList/Item.d.ts.map +1 -1
  67. package/lib/core/CollapseList/Item.js +36 -3
  68. package/lib/core/CollapseList/index.d.ts +1 -1
  69. package/lib/core/CollapseList/index.d.ts.map +1 -1
  70. package/lib/core/CollapseList/index.js +3 -1
  71. package/lib/core/CollapseList/styles.d.ts +1 -39
  72. package/lib/core/CollapseList/styles.d.ts.map +1 -1
  73. package/lib/core/CommentsTimeline/CommentLine/index.d.ts +1 -1
  74. package/lib/core/CommentsTimeline/CommentLine/index.d.ts.map +1 -1
  75. package/lib/core/CommentsTimeline/CommentLine/index.js +13 -4
  76. package/lib/core/CommentsTimeline/CommentsTimeline.stories.d.ts +7 -11
  77. package/lib/core/CommentsTimeline/CommentsTimeline.stories.d.ts.map +1 -1
  78. package/lib/core/CommentsTimeline/CommentsTimeline.stories.js +67 -62
  79. package/lib/core/CommentsTimeline/index.d.ts.map +1 -1
  80. package/lib/core/CommentsTimeline/index.js +2 -0
  81. package/lib/core/CustomText/CustomText.stories.d.ts +9 -19
  82. package/lib/core/CustomText/CustomText.stories.d.ts.map +1 -1
  83. package/lib/core/CustomText/CustomText.stories.js +12 -12
  84. package/lib/core/CustomText/index.d.ts.map +1 -1
  85. package/lib/core/CustomText/index.js +4 -1
  86. package/lib/core/Dropdown/Dropdown.stories.d.ts +10 -23
  87. package/lib/core/Dropdown/Dropdown.stories.d.ts.map +1 -1
  88. package/lib/core/Dropdown/Dropdown.stories.js +16 -15
  89. package/lib/core/Dropdown/index.d.ts +1 -1
  90. package/lib/core/Dropdown/index.d.ts.map +1 -1
  91. package/lib/core/Dropdown/index.js +18 -0
  92. package/lib/core/FileInput/styles.d.ts +1 -39
  93. package/lib/core/FileInput/styles.d.ts.map +1 -1
  94. package/lib/core/Header/index.d.ts +3 -1
  95. package/lib/core/Header/index.d.ts.map +1 -1
  96. package/lib/core/Header/index.js +2 -1
  97. package/lib/core/Header/styles.d.ts +1 -1
  98. package/lib/core/Header/styles.d.ts.map +1 -1
  99. package/lib/core/Header/styles.js +7 -7
  100. package/lib/core/InfoButton/styles.d.ts +1 -39
  101. package/lib/core/InfoButton/styles.d.ts.map +1 -1
  102. package/lib/core/Modal/index.d.ts +1 -2
  103. package/lib/core/Modal/index.d.ts.map +1 -1
  104. package/lib/core/Modal/index.js +1 -1
  105. package/lib/core/Modal/styles.d.ts +1 -1
  106. package/lib/core/Modal/styles.d.ts.map +1 -1
  107. package/lib/core/Modal/styles.js +9 -9
  108. package/lib/core/Text/index.d.ts +2 -1
  109. package/lib/core/Text/index.d.ts.map +1 -1
  110. package/lib/core/Text/index.js +3 -1
  111. package/lib/core/private/ButtonOrLink.d.ts +2 -3
  112. package/lib/core/private/ButtonOrLink.d.ts.map +1 -1
  113. package/lib/core/private/ButtonOrLink.js +5 -4
  114. package/lib/index.d.ts +0 -1
  115. package/lib/index.d.ts.map +1 -1
  116. package/lib/layout/Footer/FooterButton/styles.d.ts +1 -1
  117. package/lib/layout/Footer/FooterLink/styles.d.ts +1 -1
  118. package/lib/layout/Menu/MenuTop/styles.d.ts +1 -1
  119. package/package.json +1 -1
  120. package/esm/core/Autocomplete/utils/useHandleOptionsHeight.js +0 -16
  121. package/esm/core/CheckboxController/index.js +0 -22
  122. package/esm/core/Datepicker/yearMonthForm.js +0 -56
  123. package/esm/core/EditorOld/config.js +0 -69
  124. package/esm/core/EditorOld/index.js +0 -147
  125. package/esm/core/EditorOld/styles.js +0 -65
  126. package/esm/core/ImageCarousel/index.js +0 -70
  127. package/esm/core/ImageCarousel/styles.js +0 -58
  128. package/esm/enums/ModifierKey.js +0 -13
  129. package/lib/core/Autocomplete/utils/useHandleOptionsHeight.d.ts +0 -7
  130. package/lib/core/Autocomplete/utils/useHandleOptionsHeight.d.ts.map +0 -1
  131. package/lib/core/Autocomplete/utils/useHandleOptionsHeight.js +0 -16
  132. package/lib/core/CheckboxController/index.d.ts +0 -1
  133. package/lib/core/CheckboxController/index.d.ts.map +0 -1
  134. package/lib/core/CheckboxController/index.js +0 -22
  135. package/lib/core/Datepicker/yearMonthForm.d.ts +0 -10
  136. package/lib/core/Datepicker/yearMonthForm.d.ts.map +0 -1
  137. package/lib/core/Datepicker/yearMonthForm.js +0 -56
  138. package/lib/core/EditorOld/config.d.ts +0 -56
  139. package/lib/core/EditorOld/config.d.ts.map +0 -1
  140. package/lib/core/EditorOld/config.js +0 -69
  141. package/lib/core/EditorOld/index.d.ts +0 -39
  142. package/lib/core/EditorOld/index.d.ts.map +0 -1
  143. package/lib/core/EditorOld/index.js +0 -147
  144. package/lib/core/EditorOld/styles.d.ts +0 -23
  145. package/lib/core/EditorOld/styles.d.ts.map +0 -1
  146. package/lib/core/EditorOld/styles.js +0 -65
  147. package/lib/core/ImageCarousel/index.d.ts +0 -11
  148. package/lib/core/ImageCarousel/index.d.ts.map +0 -1
  149. package/lib/core/ImageCarousel/index.js +0 -70
  150. package/lib/core/ImageCarousel/styles.d.ts +0 -26
  151. package/lib/core/ImageCarousel/styles.d.ts.map +0 -1
  152. package/lib/core/ImageCarousel/styles.js +0 -58
  153. package/lib/enums/ModifierKey.d.ts +0 -12
  154. package/lib/enums/ModifierKey.d.ts.map +0 -1
  155. package/lib/enums/ModifierKey.js +0 -13
@@ -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
  };
@@ -1,20 +1,10 @@
1
- /// <reference types="react" />
2
- declare const _default;
3
- export default _default;
4
- export declare const Html: {
5
- render: () => import("react").JSX.Element;
6
- name: string;
7
- };
8
- export declare const Plain: {
9
- render: () => import("react").JSX.Element;
10
- name: string;
11
- };
12
- export declare const Loading: {
13
- render: () => import("react").JSX.Element;
14
- name: string;
15
- };
16
- export declare const LoadingCenter: {
17
- render: () => import("react").JSX.Element;
18
- name: string;
19
- };
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import CustomText from '.';
3
+ declare const meta: Meta<typeof CustomText>;
4
+ export default meta;
5
+ declare type Story = StoryObj<typeof CustomText>;
6
+ export declare const Html: Story;
7
+ export declare const Plain: Story;
8
+ export declare const Loading: Story;
9
+ export declare const LoadingCenter: Story;
20
10
  //# sourceMappingURL=CustomText.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CustomText.stories.d.ts","sourceRoot":"","sources":["../../../src/packages/core/CustomText/CustomText.stories.tsx"],"names":[],"mappings":";;AAGA,wBAGS;AAET,eAAO,MAAM,IAAI;;;CAKhB,CAAA;AAED,eAAO,MAAM,KAAK;;;CAGjB,CAAA;AAED,eAAO,MAAM,OAAO;;;CAGnB,CAAA;AAED,eAAO,MAAM,aAAa;;;CAGzB,CAAA"}
1
+ {"version":3,"file":"CustomText.stories.d.ts","sourceRoot":"","sources":["../../../src/packages/core/CustomText/CustomText.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,UAAU,MAAM,GAAG,CAAA;AAE1B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,UAAU,CAGjC,CAAA;AAED,eAAe,IAAI,CAAA;AAEnB,aAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,UAAU,CAAC,CAAA;AAExC,eAAO,MAAM,IAAI,EAAE,KAKlB,CAAA;AAED,eAAO,MAAM,KAAK,EAAE,KAKnB,CAAA;AAED,eAAO,MAAM,OAAO,EAAE,KAMrB,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,KAO3B,CAAA"}
@@ -1,33 +1,33 @@
1
1
  import CustomText from '.';
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- export default {
2
+ const meta = {
4
3
  title: 'Core/CustomText',
5
4
  component: CustomText
6
5
  };
6
+ export default meta;
7
7
  export const Html = {
8
- render: () => /*#__PURE__*/_jsx(CustomText, {
9
- text: "<ul><li>Html</li><li><strong>Text</strong></li></ul>"
10
- }),
8
+ args: {
9
+ text: '<ul><li>Html</li><li><strong>Text</strong></li></ul>'
10
+ },
11
11
  name: 'Html'
12
12
  };
13
13
  export const Plain = {
14
- render: () => /*#__PURE__*/_jsx(CustomText, {
15
- text: "Supports plain text with\\r linebreak"
16
- }),
14
+ args: {
15
+ text: 'Supports plain text with\r linebreak'
16
+ },
17
17
  name: 'Plain'
18
18
  };
19
19
  export const Loading = {
20
- render: () => /*#__PURE__*/_jsx(CustomText, {
20
+ args: {
21
21
  loading: true,
22
22
  lines: 3
23
- }),
23
+ },
24
24
  name: 'Loading'
25
25
  };
26
26
  export const LoadingCenter = {
27
- render: () => /*#__PURE__*/_jsx(CustomText, {
27
+ args: {
28
28
  loading: true,
29
29
  lines: 3,
30
30
  centerloader: true
31
- }),
31
+ },
32
32
  name: 'Loading center'
33
33
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packages/core/CustomText/index.tsx"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,UAAU,MAAM;IACd,uBAAuB;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kCAAkC;IAClC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,qFAAqF;IACrF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,0BAA0B;IAC1B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,8BAA8B;IAC9B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,mCAAmC;IACnC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,2BAA2B;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,CAuBhC,CAAA;AAED,eAAe,UAAU,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packages/core/CustomText/index.tsx"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,UAAU,MAAM;IACd,uBAAuB;IACvB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,kCAAkC;IAClC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,qFAAqF;IACrF,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,sCAAsC;IACtC,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,0BAA0B;IAC1B,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,8BAA8B;IAC9B,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,mCAAmC;IACnC,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,2BAA2B;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,gEAAgE;IAChE,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,CAyBhC,CAAA;AAED,eAAe,UAAU,CAAA"}
@@ -12,10 +12,13 @@ const CustomText = props => {
12
12
  const lines = props.lines ? props.lines : 1;
13
13
  const skeletonRows = [];
14
14
  for (var i = 0; i < lines; i++) {
15
- skeletonRows.push(_jsx(Skeleton, {}, i));
15
+ skeletonRows.push(_jsx(Skeleton, {
16
+ "aria-hidden": "true"
17
+ }, i));
16
18
  }
17
19
  return _jsx(Wrapper, {
18
20
  css: () => props.centerloader && center,
21
+ "aria-busy": "true",
19
22
  children: skeletonRows
20
23
  });
21
24
  }