@teselagen/ui 0.4.9 → 0.4.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CollapsibleCard/index.d.ts +12 -11
- package/InfoHelper/index.d.ts +19 -6
- package/Loading/index.d.ts +13 -12
- package/Timeline/index.d.ts +1 -10
- package/index.cjs.js +1044 -1086
- package/index.es.js +215 -257
- package/package.json +1 -2
- package/src/CollapsibleCard/index.js +56 -80
- package/src/InfoHelper/index.js +70 -75
- package/src/Loading/index.js +60 -64
- package/src/Timeline/index.js +7 -15
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teselagen/ui",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.10",
|
|
4
4
|
"main": "./src/index.js",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -38,7 +38,6 @@
|
|
|
38
38
|
"mock-fs": "5.2.0",
|
|
39
39
|
"nanoid": "^4.0.0",
|
|
40
40
|
"papaparse": "^5.3.2",
|
|
41
|
-
"prop-types": "^15.6.2",
|
|
42
41
|
"qs": "^6.9.6",
|
|
43
42
|
"react-color": "^2.19.3",
|
|
44
43
|
"react-dropzone": "^11.4.2",
|
|
@@ -1,92 +1,68 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useState } from "react";
|
|
2
2
|
import { Button, Classes, Icon } from "@blueprintjs/core";
|
|
3
3
|
import classNames from "classnames";
|
|
4
4
|
import "./style.css";
|
|
5
5
|
|
|
6
|
-
export default
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
export default function CollapsibleCard({
|
|
7
|
+
title,
|
|
8
|
+
icon,
|
|
9
|
+
openTitleElements,
|
|
10
|
+
noCard = false,
|
|
11
|
+
className,
|
|
12
|
+
style,
|
|
13
|
+
children,
|
|
14
|
+
initialClosed = false,
|
|
15
|
+
toggle,
|
|
16
|
+
isOpen
|
|
17
|
+
}) {
|
|
18
|
+
let [open, setOpen] = useState(!initialClosed);
|
|
19
|
+
if (isOpen !== undefined) open = isOpen;
|
|
17
20
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
toggleCardInfo = () => {
|
|
23
|
-
if (this.props.toggle) this.props.toggle();
|
|
21
|
+
const toggleCardInfo = () => {
|
|
22
|
+
if (toggle) toggle();
|
|
24
23
|
else {
|
|
25
|
-
|
|
26
|
-
open: !this.state.open
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
getIsOpen = () => {
|
|
32
|
-
if (this.props.isOpen !== undefined) {
|
|
33
|
-
return this.props.isOpen;
|
|
34
|
-
} else {
|
|
35
|
-
return this.state.open;
|
|
24
|
+
setOpen(!open);
|
|
36
25
|
}
|
|
37
26
|
};
|
|
38
27
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
<div>{open && openTitleElements}</div>
|
|
75
|
-
</div>
|
|
76
|
-
<div>
|
|
77
|
-
<Button
|
|
78
|
-
icon={open ? "minimize" : "maximize"}
|
|
79
|
-
className={classNames(
|
|
80
|
-
Classes.MINIMAL,
|
|
81
|
-
"info-btn",
|
|
82
|
-
"tg-collapse-toggle"
|
|
83
|
-
)}
|
|
84
|
-
onClick={this.toggleCardInfo}
|
|
85
|
-
/>
|
|
86
|
-
</div>
|
|
28
|
+
return (
|
|
29
|
+
<div
|
|
30
|
+
className={classNames({ "tg-card": !noCard, open }, className)}
|
|
31
|
+
style={{
|
|
32
|
+
paddingTop: 10,
|
|
33
|
+
paddingBottom: 10,
|
|
34
|
+
paddingLeft: 15,
|
|
35
|
+
paddingRight: 15,
|
|
36
|
+
...style
|
|
37
|
+
}}
|
|
38
|
+
>
|
|
39
|
+
<div className="tg-card-header" style={{ marginBottom: 8 }}>
|
|
40
|
+
<div className="tg-card-header-title">
|
|
41
|
+
{icon && <Icon icon={icon} />}
|
|
42
|
+
<h6
|
|
43
|
+
style={{
|
|
44
|
+
marginBottom: 0,
|
|
45
|
+
marginRight: 10,
|
|
46
|
+
marginLeft: 10
|
|
47
|
+
}}
|
|
48
|
+
>
|
|
49
|
+
{title}
|
|
50
|
+
</h6>
|
|
51
|
+
<div>{open && openTitleElements}</div>
|
|
52
|
+
</div>
|
|
53
|
+
<div>
|
|
54
|
+
<Button
|
|
55
|
+
icon={open ? "minimize" : "maximize"}
|
|
56
|
+
className={classNames(
|
|
57
|
+
Classes.MINIMAL,
|
|
58
|
+
"info-btn",
|
|
59
|
+
"tg-collapse-toggle"
|
|
60
|
+
)}
|
|
61
|
+
onClick={toggleCardInfo}
|
|
62
|
+
/>
|
|
87
63
|
</div>
|
|
88
|
-
{open && this.renderOpenCard()}
|
|
89
64
|
</div>
|
|
90
|
-
|
|
91
|
-
|
|
65
|
+
{open && children}
|
|
66
|
+
</div>
|
|
67
|
+
);
|
|
92
68
|
}
|
package/src/InfoHelper/index.js
CHANGED
|
@@ -1,83 +1,78 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from "react";
|
|
2
2
|
import { Popover, Button, Tooltip, Icon } from "@blueprintjs/core";
|
|
3
3
|
import classnames from "classnames";
|
|
4
4
|
import "./style.css";
|
|
5
5
|
import { popoverOverflowModifiers } from "..";
|
|
6
6
|
|
|
7
|
-
export default
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
};
|
|
33
|
-
if (!isButton) iconProps.iconSize = size;
|
|
7
|
+
export default ({
|
|
8
|
+
className,
|
|
9
|
+
content,
|
|
10
|
+
children,
|
|
11
|
+
icon = "info-sign",
|
|
12
|
+
isPopover,
|
|
13
|
+
isButton,
|
|
14
|
+
size,
|
|
15
|
+
isInline,
|
|
16
|
+
clickable,
|
|
17
|
+
color,
|
|
18
|
+
noMarginTop,
|
|
19
|
+
popoverProps = {},
|
|
20
|
+
disabled,
|
|
21
|
+
displayToSide,
|
|
22
|
+
style,
|
|
23
|
+
...rest
|
|
24
|
+
}) => {
|
|
25
|
+
const IconToUse = isButton ? Button : Icon;
|
|
26
|
+
const iconProps = {
|
|
27
|
+
icon,
|
|
28
|
+
color,
|
|
29
|
+
disabled
|
|
30
|
+
};
|
|
31
|
+
if (!isButton) iconProps.iconSize = size;
|
|
34
32
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
<
|
|
51
|
-
{
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
</span>
|
|
55
|
-
</React.Fragment>
|
|
56
|
-
);
|
|
57
|
-
} else if (isPopover) {
|
|
58
|
-
toReturn = <Popover {...toolTipOrPopoverProps} target={IconInner} />;
|
|
59
|
-
} else {
|
|
60
|
-
toReturn = <Tooltip {...toolTipOrPopoverProps} target={IconInner} />;
|
|
61
|
-
}
|
|
62
|
-
const El = isInline ? "span" : "div";
|
|
63
|
-
return (
|
|
64
|
-
<El
|
|
65
|
-
style={{
|
|
66
|
-
...(clickable ? { cursor: "pointer" } : {}),
|
|
67
|
-
...(isInline ? {} : { display: "flex" }),
|
|
68
|
-
...style
|
|
69
|
-
}}
|
|
70
|
-
className={classnames(
|
|
71
|
-
"info-helper-wrapper",
|
|
72
|
-
{
|
|
73
|
-
"info-helper-wrapper-noMarginTop": noMarginTop,
|
|
74
|
-
"info-helper-clickable": isPopover
|
|
75
|
-
},
|
|
76
|
-
className
|
|
77
|
-
)}
|
|
78
|
-
>
|
|
79
|
-
{toReturn}
|
|
80
|
-
</El>
|
|
33
|
+
const IconInner = <IconToUse {...iconProps} {...rest} />;
|
|
34
|
+
let toReturn;
|
|
35
|
+
const toolTipOrPopoverProps = {
|
|
36
|
+
disabled:
|
|
37
|
+
disabled ||
|
|
38
|
+
(!isPopover && window.Cypress && !window.Cypress.allowInfoHelperTooltips),
|
|
39
|
+
popoverClassName: "tg-info-helper-popover bp3-tooltip",
|
|
40
|
+
content: content || children,
|
|
41
|
+
modifiers: popoverOverflowModifiers,
|
|
42
|
+
...popoverProps
|
|
43
|
+
};
|
|
44
|
+
if (displayToSide) {
|
|
45
|
+
toReturn = (
|
|
46
|
+
<React.Fragment>
|
|
47
|
+
{IconInner}
|
|
48
|
+
<span style={{ paddingLeft: 5, fontStyle: "italic" }}>
|
|
49
|
+
{content || children}
|
|
50
|
+
</span>
|
|
51
|
+
</React.Fragment>
|
|
81
52
|
);
|
|
53
|
+
} else if (isPopover) {
|
|
54
|
+
toReturn = <Popover {...toolTipOrPopoverProps} target={IconInner} />;
|
|
55
|
+
} else {
|
|
56
|
+
toReturn = <Tooltip {...toolTipOrPopoverProps} target={IconInner} />;
|
|
82
57
|
}
|
|
83
|
-
|
|
58
|
+
const El = isInline ? "span" : "div";
|
|
59
|
+
return (
|
|
60
|
+
<El
|
|
61
|
+
style={{
|
|
62
|
+
...(clickable ? { cursor: "pointer" } : {}),
|
|
63
|
+
...(isInline ? {} : { display: "flex" }),
|
|
64
|
+
...style
|
|
65
|
+
}}
|
|
66
|
+
className={classnames(
|
|
67
|
+
"info-helper-wrapper",
|
|
68
|
+
{
|
|
69
|
+
"info-helper-wrapper-noMarginTop": noMarginTop,
|
|
70
|
+
"info-helper-clickable": isPopover
|
|
71
|
+
},
|
|
72
|
+
className
|
|
73
|
+
)}
|
|
74
|
+
>
|
|
75
|
+
{toReturn}
|
|
76
|
+
</El>
|
|
77
|
+
);
|
|
78
|
+
};
|
package/src/Loading/index.js
CHANGED
|
@@ -1,74 +1,70 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useState, useEffect } from "react";
|
|
2
2
|
import DNALoader from "../DNALoader";
|
|
3
3
|
import "./style.css";
|
|
4
4
|
import { BounceLoader } from "@teselagen/bounce-loader";
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
const Loading = ({
|
|
7
|
+
loading,
|
|
8
|
+
style: userStyle,
|
|
9
|
+
className,
|
|
10
|
+
containerStyle = {},
|
|
11
|
+
children,
|
|
12
|
+
displayInstantly = false,
|
|
13
|
+
bounce = false,
|
|
14
|
+
withTimeout,
|
|
15
|
+
inDialog,
|
|
16
|
+
centeredInPage
|
|
17
|
+
}) => {
|
|
18
|
+
const [longerThan200MS, setLongerThan200MS] = useState(false);
|
|
10
19
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
longerThan200MS: true
|
|
15
|
-
});
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
const timeoutId = setTimeout(() => {
|
|
22
|
+
setLongerThan200MS(true);
|
|
16
23
|
}, 200);
|
|
17
|
-
}
|
|
18
24
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
render() {
|
|
24
|
-
const {
|
|
25
|
-
loading,
|
|
26
|
-
style: userStyle,
|
|
27
|
-
className,
|
|
28
|
-
containerStyle = {},
|
|
29
|
-
children,
|
|
30
|
-
displayInstantly = false,
|
|
31
|
-
bounce = false,
|
|
32
|
-
withTimeout,
|
|
33
|
-
inDialog,
|
|
34
|
-
centeredInPage
|
|
35
|
-
} = this.props;
|
|
36
|
-
const { longerThan200MS } = this.state;
|
|
37
|
-
const style = {
|
|
38
|
-
...userStyle,
|
|
39
|
-
...(inDialog && { minHeight: 120 })
|
|
25
|
+
return () => {
|
|
26
|
+
clearTimeout(timeoutId);
|
|
40
27
|
};
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
width: undefined,
|
|
58
|
-
zIndex: 20,
|
|
59
|
-
height: 10,
|
|
60
|
-
position: "fixed",
|
|
61
|
-
top: "50%",
|
|
62
|
-
left: "50%",
|
|
63
|
-
transform: "translate(-50%, 0)"
|
|
64
|
-
})
|
|
65
|
-
}}
|
|
66
|
-
>
|
|
67
|
-
<LoaderComp style={style} className={className} />
|
|
68
|
-
</div>
|
|
69
|
-
);
|
|
70
|
-
} else {
|
|
71
|
-
return children || null;
|
|
28
|
+
}, []);
|
|
29
|
+
|
|
30
|
+
const style = {
|
|
31
|
+
...userStyle,
|
|
32
|
+
...(inDialog && { minHeight: 120 })
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const LoaderComp = bounce || inDialog ? BounceLoader : DNALoader;
|
|
36
|
+
|
|
37
|
+
if (loading || !children) {
|
|
38
|
+
if (
|
|
39
|
+
!displayInstantly &&
|
|
40
|
+
!longerThan200MS &&
|
|
41
|
+
((!bounce && !inDialog) || withTimeout)
|
|
42
|
+
) {
|
|
43
|
+
return <div />;
|
|
72
44
|
}
|
|
45
|
+
return (
|
|
46
|
+
<div
|
|
47
|
+
className="tg-loader-container tg-flex justify-center align-center"
|
|
48
|
+
style={{
|
|
49
|
+
width: "100%",
|
|
50
|
+
...containerStyle,
|
|
51
|
+
...(centeredInPage && {
|
|
52
|
+
width: undefined,
|
|
53
|
+
zIndex: 20,
|
|
54
|
+
height: 10,
|
|
55
|
+
position: "fixed",
|
|
56
|
+
top: "50%",
|
|
57
|
+
left: "50%",
|
|
58
|
+
transform: "translate(-50%, 0)"
|
|
59
|
+
})
|
|
60
|
+
}}
|
|
61
|
+
>
|
|
62
|
+
<LoaderComp style={style} className={className} />
|
|
63
|
+
</div>
|
|
64
|
+
);
|
|
65
|
+
} else {
|
|
66
|
+
return children || null;
|
|
73
67
|
}
|
|
74
|
-
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export default Loading;
|
package/src/Timeline/index.js
CHANGED
|
@@ -1,20 +1,12 @@
|
|
|
1
|
-
import React, { Component } from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
1
|
import "./style.css";
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
<div className="tg-timeline">
|
|
13
|
-
{this.props.children.length > 1 && <div className="tg-timeline-line" />}
|
|
14
|
-
{this.props.children}
|
|
15
|
-
</div>
|
|
16
|
-
);
|
|
17
|
-
}
|
|
3
|
+
function Timeline(props) {
|
|
4
|
+
return (
|
|
5
|
+
<div className="tg-timeline">
|
|
6
|
+
{props.children.length > 1 && <div className="tg-timeline-line" />}
|
|
7
|
+
{props.children}
|
|
8
|
+
</div>
|
|
9
|
+
);
|
|
18
10
|
}
|
|
19
11
|
|
|
20
12
|
export { default as TimelineEvent } from "./TimelineEvent";
|