@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.
- package/dist/bundle.js +123 -38
- package/esm/core/Alert/index.js +1 -1
- package/esm/core/AppLoader/index.js +1 -1
- package/esm/core/Banner/Banner.stories.js +17 -0
- package/esm/core/Banner/index.js +1 -1
- package/esm/core/Box/Box.stories.js +32 -31
- package/esm/core/Box/index.js +10 -3
- package/esm/core/BoxedTable/TableBody/index.js +10 -0
- package/esm/core/BoxedTable/TableBody/styles.js +16 -0
- package/esm/core/Button/index.js +3 -2
- package/esm/core/Card/Card.stories.js +8 -7
- package/esm/core/Card/index.js +1 -0
- package/esm/core/Checkbox/Checkbox.stories.js +22 -22
- package/esm/core/CollapseList/CollapseList.stories.js +36 -28
- package/esm/core/CollapseList/Item.js +36 -3
- package/esm/core/CollapseList/index.js +3 -1
- package/esm/core/CommentsTimeline/CommentLine/index.js +13 -4
- package/esm/core/CommentsTimeline/CommentsTimeline.stories.js +67 -62
- package/esm/core/CommentsTimeline/index.js +2 -0
- package/esm/core/CustomText/CustomText.stories.js +12 -12
- package/esm/core/CustomText/index.js +4 -1
- package/esm/core/Dropdown/Dropdown.stories.js +16 -15
- package/esm/core/Dropdown/index.js +18 -0
- package/esm/core/Header/index.js +2 -1
- package/esm/core/Header/styles.js +7 -7
- package/esm/core/Input/index.js +5 -0
- package/esm/core/Modal/index.js +1 -1
- package/esm/core/Modal/styles.js +9 -9
- package/esm/core/Text/index.js +3 -1
- package/esm/core/private/ButtonOrLink.js +5 -4
- package/lib/core/Alert/index.d.ts +1 -2
- package/lib/core/Alert/index.d.ts.map +1 -1
- package/lib/core/Alert/index.js +1 -1
- package/lib/core/AppLoader/index.d.ts +1 -2
- package/lib/core/AppLoader/index.d.ts.map +1 -1
- package/lib/core/AppLoader/index.js +1 -1
- package/lib/core/Autocomplete/styles.d.ts +1 -39
- package/lib/core/Autocomplete/styles.d.ts.map +1 -1
- package/lib/core/Banner/Banner.stories.d.ts +1 -0
- package/lib/core/Banner/Banner.stories.d.ts.map +1 -1
- package/lib/core/Banner/Banner.stories.js +17 -0
- package/lib/core/Banner/index.d.ts +1 -2
- package/lib/core/Banner/index.d.ts.map +1 -1
- package/lib/core/Banner/index.js +1 -1
- package/lib/core/Box/Box.stories.d.ts +14 -39
- package/lib/core/Box/Box.stories.d.ts.map +1 -1
- package/lib/core/Box/Box.stories.js +32 -31
- package/lib/core/Box/index.d.ts +1 -1
- package/lib/core/Box/index.d.ts.map +1 -1
- package/lib/core/Box/index.js +10 -3
- package/lib/core/Box/styles.d.ts +1 -39
- package/lib/core/Box/styles.d.ts.map +1 -1
- package/lib/core/BoxedTable/TableBody/index.d.ts +7 -0
- package/lib/core/BoxedTable/TableBody/index.d.ts.map +1 -0
- package/lib/core/BoxedTable/TableBody/index.js +10 -0
- package/lib/core/BoxedTable/TableBody/styles.d.ts +6 -0
- package/lib/core/BoxedTable/TableBody/styles.d.ts.map +1 -0
- package/lib/core/BoxedTable/TableBody/styles.js +16 -0
- package/lib/core/Button/index.d.ts +3 -4
- package/lib/core/Button/index.d.ts.map +1 -1
- package/lib/core/Button/index.js +3 -2
- package/lib/core/Card/Card.stories.d.ts +10 -24
- package/lib/core/Card/Card.stories.d.ts.map +1 -1
- package/lib/core/Card/Card.stories.js +8 -7
- package/lib/core/Card/index.d.ts +1 -1
- package/lib/core/Card/index.d.ts.map +1 -1
- package/lib/core/Card/index.js +1 -0
- package/lib/core/Checkbox/Checkbox.stories.d.ts +10 -23
- package/lib/core/Checkbox/Checkbox.stories.d.ts.map +1 -1
- package/lib/core/Checkbox/Checkbox.stories.js +22 -22
- package/lib/core/CollapseList/CollapseList.stories.d.ts +7 -11
- package/lib/core/CollapseList/CollapseList.stories.d.ts.map +1 -1
- package/lib/core/CollapseList/CollapseList.stories.js +36 -28
- package/lib/core/CollapseList/Item.d.ts +4 -4
- package/lib/core/CollapseList/Item.d.ts.map +1 -1
- package/lib/core/CollapseList/Item.js +36 -3
- package/lib/core/CollapseList/index.d.ts +1 -1
- package/lib/core/CollapseList/index.d.ts.map +1 -1
- package/lib/core/CollapseList/index.js +3 -1
- package/lib/core/CollapseList/styles.d.ts +1 -39
- package/lib/core/CollapseList/styles.d.ts.map +1 -1
- package/lib/core/CommentsTimeline/CommentLine/index.d.ts +1 -1
- package/lib/core/CommentsTimeline/CommentLine/index.d.ts.map +1 -1
- package/lib/core/CommentsTimeline/CommentLine/index.js +13 -4
- package/lib/core/CommentsTimeline/CommentsTimeline.stories.d.ts +7 -11
- package/lib/core/CommentsTimeline/CommentsTimeline.stories.d.ts.map +1 -1
- package/lib/core/CommentsTimeline/CommentsTimeline.stories.js +67 -62
- package/lib/core/CommentsTimeline/index.d.ts.map +1 -1
- package/lib/core/CommentsTimeline/index.js +2 -0
- package/lib/core/CustomText/CustomText.stories.d.ts +9 -19
- package/lib/core/CustomText/CustomText.stories.d.ts.map +1 -1
- package/lib/core/CustomText/CustomText.stories.js +12 -12
- package/lib/core/CustomText/index.d.ts.map +1 -1
- package/lib/core/CustomText/index.js +4 -1
- package/lib/core/Dropdown/Dropdown.stories.d.ts +10 -23
- package/lib/core/Dropdown/Dropdown.stories.d.ts.map +1 -1
- package/lib/core/Dropdown/Dropdown.stories.js +16 -15
- package/lib/core/Dropdown/index.d.ts +1 -1
- package/lib/core/Dropdown/index.d.ts.map +1 -1
- package/lib/core/Dropdown/index.js +18 -0
- package/lib/core/FileInput/styles.d.ts +1 -39
- package/lib/core/FileInput/styles.d.ts.map +1 -1
- package/lib/core/Header/index.d.ts +3 -1
- package/lib/core/Header/index.d.ts.map +1 -1
- package/lib/core/Header/index.js +2 -1
- package/lib/core/Header/styles.d.ts +1 -1
- package/lib/core/Header/styles.d.ts.map +1 -1
- package/lib/core/Header/styles.js +7 -7
- package/lib/core/InfoButton/styles.d.ts +1 -39
- package/lib/core/InfoButton/styles.d.ts.map +1 -1
- package/lib/core/Input/index.d.ts.map +1 -1
- package/lib/core/Input/index.js +5 -0
- package/lib/core/Modal/index.d.ts +1 -2
- package/lib/core/Modal/index.d.ts.map +1 -1
- package/lib/core/Modal/index.js +1 -1
- package/lib/core/Modal/styles.d.ts +1 -1
- package/lib/core/Modal/styles.d.ts.map +1 -1
- package/lib/core/Modal/styles.js +9 -9
- package/lib/core/Text/index.d.ts +2 -1
- package/lib/core/Text/index.d.ts.map +1 -1
- package/lib/core/Text/index.js +3 -1
- package/lib/core/private/ButtonOrLink.d.ts +2 -3
- package/lib/core/private/ButtonOrLink.d.ts.map +1 -1
- package/lib/core/private/ButtonOrLink.js +5 -4
- package/lib/index.d.ts +0 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/layout/Footer/FooterButton/styles.d.ts +1 -1
- package/lib/layout/Footer/FooterLink/styles.d.ts +1 -1
- package/lib/layout/Menu/MenuTop/styles.d.ts +1 -1
- package/package.json +1 -1
- package/esm/core/Autocomplete/utils/useHandleOptionsHeight.js +0 -16
- package/esm/core/CheckboxController/index.js +0 -22
- package/esm/core/Datepicker/yearMonthForm.js +0 -56
- package/esm/core/EditorOld/config.js +0 -69
- package/esm/core/EditorOld/index.js +0 -147
- package/esm/core/EditorOld/styles.js +0 -65
- package/esm/core/ImageCarousel/index.js +0 -70
- package/esm/core/ImageCarousel/styles.js +0 -58
- package/esm/enums/ModifierKey.js +0 -13
- package/lib/core/Autocomplete/utils/useHandleOptionsHeight.d.ts +0 -7
- package/lib/core/Autocomplete/utils/useHandleOptionsHeight.d.ts.map +0 -1
- package/lib/core/Autocomplete/utils/useHandleOptionsHeight.js +0 -16
- package/lib/core/CheckboxController/index.d.ts +0 -1
- package/lib/core/CheckboxController/index.d.ts.map +0 -1
- package/lib/core/CheckboxController/index.js +0 -22
- package/lib/core/Datepicker/yearMonthForm.d.ts +0 -10
- package/lib/core/Datepicker/yearMonthForm.d.ts.map +0 -1
- package/lib/core/Datepicker/yearMonthForm.js +0 -56
- package/lib/core/EditorOld/config.d.ts +0 -56
- package/lib/core/EditorOld/config.d.ts.map +0 -1
- package/lib/core/EditorOld/config.js +0 -69
- package/lib/core/EditorOld/index.d.ts +0 -39
- package/lib/core/EditorOld/index.d.ts.map +0 -1
- package/lib/core/EditorOld/index.js +0 -147
- package/lib/core/EditorOld/styles.d.ts +0 -23
- package/lib/core/EditorOld/styles.d.ts.map +0 -1
- package/lib/core/EditorOld/styles.js +0 -65
- package/lib/core/ImageCarousel/index.d.ts +0 -11
- package/lib/core/ImageCarousel/index.d.ts.map +0 -1
- package/lib/core/ImageCarousel/index.js +0 -70
- package/lib/core/ImageCarousel/styles.d.ts +0 -26
- package/lib/core/ImageCarousel/styles.d.ts.map +0 -1
- package/lib/core/ImageCarousel/styles.js +0 -58
- package/lib/enums/ModifierKey.d.ts +0 -12
- package/lib/enums/ModifierKey.d.ts.map +0 -1
- 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
|
-
|
7
|
+
const meta = {
|
7
8
|
title: 'Core/CollapseList',
|
8
9
|
component: CollapseList
|
9
10
|
};
|
11
|
+
export default meta;
|
10
12
|
export const Default = {
|
11
|
-
|
12
|
-
children:
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
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
|
-
|
32
|
-
children: /*#__PURE__*/_jsx(
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
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, {
|
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":"
|
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("
|
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 +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,
|
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("
|
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
|
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 +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,
|
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
|
-
|
37
|
-
|
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
|
-
|
2
|
-
|
3
|
-
|
4
|
-
export
|
5
|
-
|
6
|
-
|
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":"
|
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
|
-
|
7
|
+
const meta = {
|
8
8
|
title: 'Core/CommentsTimeline',
|
9
9
|
component: CommentsTimelineComponent
|
10
10
|
};
|
11
|
+
export default meta;
|
11
12
|
export const CommentsTimeline = {
|
12
|
-
|
13
|
-
children:
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
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
|
-
|
62
|
-
children: /*#__PURE__*/_jsx(
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
children: "
|
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,
|
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"}
|
@@ -1,20 +1,10 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
export
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
export declare const
|
9
|
-
|
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":"
|
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
|
-
|
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
|
-
|
9
|
-
text:
|
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
|
-
|
15
|
-
text:
|
16
|
-
}
|
14
|
+
args: {
|
15
|
+
text: 'Supports plain text with\r linebreak'
|
16
|
+
},
|
17
17
|
name: 'Plain'
|
18
18
|
};
|
19
19
|
export const Loading = {
|
20
|
-
|
20
|
+
args: {
|
21
21
|
loading: true,
|
22
22
|
lines: 3
|
23
|
-
}
|
23
|
+
},
|
24
24
|
name: 'Loading'
|
25
25
|
};
|
26
26
|
export const LoadingCenter = {
|
27
|
-
|
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,
|
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, {
|
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
|
}
|