orc-shared 5.10.2 → 5.99.0-dev.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/dist/components/AppFrame/About.js +13 -13
- package/dist/components/AppFrame/Anchor.js +7 -7
- package/dist/components/AppFrame/AppFrame.js +3 -3
- package/dist/components/AppFrame/Help.js +4 -4
- package/dist/components/AppFrame/MenuItem.js +17 -26
- package/dist/components/AppFrame/Preferences.js +14 -14
- package/dist/components/AppFrame/Sidebar.js +6 -6
- package/dist/components/AppFrame/Topbar.js +6 -6
- package/dist/components/ApplicationModuleLoader.js +3 -2
- package/dist/components/Authenticate.js +29 -22
- package/dist/components/DropMenu/Menu.js +9 -9
- package/dist/components/ErrorPlaceholder.js +8 -24
- package/dist/components/Form/Field.js +4 -4
- package/dist/components/Form/Inputs/Button.js +2 -2
- package/dist/components/Form/Inputs/MultiSelector.js +137 -0
- package/dist/components/Form/Inputs/Selector.js +13 -10
- package/dist/components/Form/Inputs/index.js +1 -1
- package/dist/components/InternetExplorerWarningMessage.js +15 -15
- package/dist/components/LoadingIcon.js +38 -17
- package/dist/components/MaterialUI/DataDisplay/Modal.js +3 -3
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/Placeholder.js +6 -6
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/TableInfoBar.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/SelectionList.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/Table.js +2 -1
- package/dist/components/MaterialUI/DataDisplay/TableProps.js +3 -1
- package/dist/components/MaterialUI/DataDisplay/TransferList.js +1 -1
- package/dist/components/MaterialUI/Inputs/CheckboxGroup.js +1 -1
- package/dist/components/MaterialUI/Inputs/DatePicker.js +1 -1
- package/dist/components/MaterialUI/Inputs/PredefinedElements/SearchControl.js +1 -1
- package/dist/components/MaterialUI/Inputs/Select.js +175 -109
- package/dist/components/MaterialUI/Inputs/SelectProps.js +11 -1
- package/dist/components/MaterialUI/Inputs/Switch.js +1 -1
- package/dist/components/MaterialUI/Navigation/DropDownMenu.js +2 -4
- package/dist/components/MaterialUI/ScopeSelector/ScopeSelector.js +1 -1
- package/dist/components/MaterialUI/ScopeSelector/TreeItem.js +27 -42
- package/dist/components/MaterialUI/Surfaces/Paper.js +1 -1
- package/dist/components/MaterialUI/Surfaces/SectionExpansionPanel.js +3 -2
- package/dist/components/MaterialUI/muiThemes.js +3 -1
- package/dist/components/Provision.js +30 -13
- package/dist/components/Routing/SegmentPage.js +117 -56
- package/dist/components/Scope/ScopeNode.js +62 -57
- package/dist/components/Sidepanel.js +59 -23
- package/dist/components/Spritesheet.js +35 -17
- package/dist/components/Text.js +1 -60
- package/dist/components/ToastList.js +95 -64
- package/dist/components/Treeview/Branch.js +82 -20
- package/dist/components/Treeview/Label.js +108 -31
- package/dist/components/Treeview/Leaf.js +56 -12
- package/dist/components/Treeview/Node.js +22 -9
- package/dist/components/Treeview/index.js +7 -1
- package/dist/components/Treeview/settings.js +17 -6
- package/dist/{components/Modal/index.js → hooks/useWindowSize.js} +38 -36
- package/dist/sharedMessages.js +8 -0
- package/dist/utils/index.js +0 -4
- package/dist/utils/testUtils.js +1 -12
- package/dist/{components/Modal/Background.js → utils/toastHelper.js} +11 -14
- package/package.json +2 -2
- package/src/components/AppFrame/About.js +13 -13
- package/src/components/AppFrame/Anchor.js +7 -7
- package/src/components/AppFrame/AppFrame.js +3 -3
- package/src/components/AppFrame/Help.js +4 -4
- package/src/components/AppFrame/MenuItem.js +15 -23
- package/src/components/AppFrame/Preferences.js +14 -14
- package/src/components/AppFrame/Sidebar.js +6 -6
- package/src/components/AppFrame/Topbar.js +6 -6
- package/src/components/ApplicationModuleLoader.js +2 -2
- package/src/components/ApplicationModuleLoader.test.js +15 -28
- package/src/components/Authenticate.js +21 -23
- package/src/components/Authenticate.test.js +19 -27
- package/src/components/DropMenu/Menu.js +9 -9
- package/src/components/ErrorPlaceholder.js +4 -21
- package/src/components/ErrorPlaceholder.test.js +7 -14
- package/src/components/Form/Field.js +4 -4
- package/src/components/Form/InputField.test.js +2 -1
- package/src/components/Form/Inputs/Button.js +2 -2
- package/src/components/Form/Inputs/MultiSelector.js +73 -0
- package/src/components/Form/Inputs/MultiSelector.test.js +332 -0
- package/src/components/Form/Inputs/Selector.js +12 -4
- package/src/components/Form/Inputs/Selector.test.js +27 -12
- package/src/components/Form/Inputs/index.js +1 -1
- package/src/components/InternetExplorerWarningMessage.js +15 -15
- package/src/components/Loader.test.js +50 -59
- package/src/components/LoadingIcon.js +27 -14
- package/src/components/LoadingIcon.test.js +11 -15
- package/src/components/MaterialUI/DataDisplay/Modal.js +3 -3
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/Placeholder.js +6 -6
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.js +1 -1
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/TableInfoBar.js +1 -1
- package/src/components/MaterialUI/DataDisplay/SelectionList.js +1 -1
- package/src/components/MaterialUI/DataDisplay/Table.js +6 -1
- package/src/components/MaterialUI/DataDisplay/Table.test.js +21 -1
- package/src/components/MaterialUI/DataDisplay/TableProps.js +2 -0
- package/src/components/MaterialUI/DataDisplay/TableProps.test.js +20 -2
- package/src/components/MaterialUI/DataDisplay/TransferList.js +1 -1
- package/src/components/MaterialUI/Inputs/CheckboxGroup.js +1 -1
- package/src/components/MaterialUI/Inputs/DatePicker.js +1 -1
- package/src/components/MaterialUI/Inputs/PredefinedElements/SearchControl.js +1 -1
- package/src/components/MaterialUI/Inputs/PredefinedElements/SearchControl.test.js +1 -1
- package/src/components/MaterialUI/Inputs/Select.js +143 -83
- package/src/components/MaterialUI/Inputs/Select.test.js +199 -14
- package/src/components/MaterialUI/Inputs/SelectProps.js +10 -0
- package/src/components/MaterialUI/Inputs/SelectProps.test.js +10 -0
- package/src/components/MaterialUI/Inputs/Switch.js +1 -1
- package/src/components/MaterialUI/Navigation/DropDownMenu.js +2 -2
- package/src/components/MaterialUI/Navigation/DropDownMenu.test.js +5 -6
- package/src/components/MaterialUI/ScopeSelector/ScopeSelector.js +1 -2
- package/src/components/MaterialUI/ScopeSelector/TreeItem.js +8 -31
- package/src/components/MaterialUI/Surfaces/Paper.js +1 -1
- package/src/components/MaterialUI/Surfaces/SectionExpansionPanel.js +2 -1
- package/src/components/MaterialUI/muiThemes.js +4 -1
- package/src/components/Navigation/Navigation.test.js +0 -5
- package/src/components/Navigation/useNavigationState.test.js +79 -222
- package/src/components/Provision.js +36 -42
- package/src/components/Provision.test.js +10 -26
- package/src/components/Routing/SegmentPage.js +68 -52
- package/src/components/Routing/SegmentPage.test.js +4 -12
- package/src/components/Scope/ScopeNode.js +44 -55
- package/src/components/Scope/ScopeNode.test.js +84 -163
- package/src/components/ScopeExtendedConfigurationLoader.test.js +1 -4
- package/src/components/Sidepanel.js +38 -32
- package/src/components/Sidepanel.test.js +54 -27
- package/src/components/Spritesheet.js +23 -21
- package/src/components/Spritesheet.test.js +10 -10
- package/src/components/Text.js +0 -49
- package/src/components/ToastList.js +79 -90
- package/src/components/ToastList.test.js +29 -103
- package/src/components/Treeview/Branch.js +65 -47
- package/src/components/Treeview/Branch.test.js +2 -43
- package/src/components/Treeview/Label.js +68 -54
- package/src/components/Treeview/Label.test.js +55 -63
- package/src/components/Treeview/Leaf.js +41 -22
- package/src/components/Treeview/Leaf.test.js +1 -15
- package/src/components/Treeview/Node.js +16 -9
- package/src/components/Treeview/Node.test.js +269 -200
- package/src/components/Treeview/Treeview.test.js +248 -248
- package/src/components/Treeview/index.js +6 -0
- package/src/components/Treeview/settings.js +10 -6
- package/src/hooks/useMultipleFieldEditState.test.js +0 -1
- package/src/hooks/useWindowSize.js +39 -0
- package/src/hooks/useWindowSize.test.js +68 -0
- package/src/sharedMessages.js +8 -0
- package/src/translations/en-US.json +2 -0
- package/src/translations/fr-CA.json +2 -0
- package/src/utils/index.js +0 -4
- package/src/utils/testUtils.js +0 -10
- package/src/utils/testUtils.test.js +0 -68
- package/src/utils/toastHelper.js +8 -0
- package/src/utils/toastHelper.test.js +41 -0
- package/dist/components/Button.js +0 -70
- package/dist/components/CategoryList.js +0 -197
- package/dist/components/Checkbox.js +0 -103
- package/dist/components/Icon.js +0 -69
- package/dist/components/IconButton.js +0 -80
- package/dist/components/Input.js +0 -101
- package/dist/components/List/DataCell.js +0 -129
- package/dist/components/List/HeadCell.js +0 -125
- package/dist/components/List/HeadRow.js +0 -73
- package/dist/components/List/List.js +0 -274
- package/dist/components/List/Row.js +0 -109
- package/dist/components/List/enhanceColumnDefs.js +0 -111
- package/dist/components/List/index.js +0 -59
- package/dist/components/Modal/Dialog.js +0 -75
- package/dist/components/Modal/Wrapper.js +0 -69
- package/dist/components/MultiSelector.js +0 -187
- package/dist/components/Navigation/Bar.js +0 -293
- package/dist/components/Navigation/Tab.js +0 -182
- package/dist/components/Placeholder.js +0 -114
- package/dist/components/Scope/Selector.js +0 -123
- package/dist/components/Selector.js +0 -185
- package/dist/components/Switch.js +0 -128
- package/dist/components/Toolbar.js +0 -227
- package/dist/components/Tooltip.js +0 -66
- package/dist/getTheme.js +0 -158
- package/dist/getThemeOverrides.js +0 -93
- package/dist/hocs/withAuthentication.js +0 -72
- package/dist/utils/styledPropFuncs.js +0 -88
- package/src/components/Button.js +0 -90
- package/src/components/Button.test.js +0 -49
- package/src/components/CategoryList.js +0 -140
- package/src/components/CategoryList.test.js +0 -667
- package/src/components/Checkbox.js +0 -63
- package/src/components/Checkbox.test.js +0 -122
- package/src/components/Icon.js +0 -18
- package/src/components/IconButton.js +0 -30
- package/src/components/IconButton.test.js +0 -61
- package/src/components/Input.js +0 -35
- package/src/components/Input.test.js +0 -34
- package/src/components/List/DataCell.js +0 -77
- package/src/components/List/DataCell.test.js +0 -357
- package/src/components/List/HeadCell.js +0 -105
- package/src/components/List/HeadCell.test.js +0 -331
- package/src/components/List/HeadRow.js +0 -21
- package/src/components/List/HeadRow.test.js +0 -27
- package/src/components/List/List.js +0 -162
- package/src/components/List/List.test.js +0 -705
- package/src/components/List/Row.js +0 -72
- package/src/components/List/Row.test.js +0 -194
- package/src/components/List/enhanceColumnDefs.js +0 -54
- package/src/components/List/enhanceColumnDefs.test.js +0 -179
- package/src/components/List/index.js +0 -6
- package/src/components/Modal/Background.js +0 -10
- package/src/components/Modal/Dialog.js +0 -27
- package/src/components/Modal/Dialog.test.js +0 -20
- package/src/components/Modal/Modal.test.js +0 -52
- package/src/components/Modal/Wrapper.js +0 -32
- package/src/components/Modal/Wrapper.test.js +0 -55
- package/src/components/Modal/index.js +0 -22
- package/src/components/MultiSelector.js +0 -104
- package/src/components/MultiSelector.test.js +0 -348
- package/src/components/Navigation/Bar.js +0 -212
- package/src/components/Navigation/Bar.test.js +0 -552
- package/src/components/Navigation/Tab.js +0 -156
- package/src/components/Navigation/Tab.test.js +0 -404
- package/src/components/Placeholder.js +0 -61
- package/src/components/Placeholder.test.js +0 -106
- package/src/components/Scope/Selector.js +0 -70
- package/src/components/Scope/Selector.test.js +0 -138
- package/src/components/Selector.js +0 -191
- package/src/components/Selector.test.js +0 -157
- package/src/components/Switch.js +0 -112
- package/src/components/Switch.test.js +0 -130
- package/src/components/Text.test.js +0 -132
- package/src/components/Toolbar.js +0 -178
- package/src/components/Toolbar.test.js +0 -478
- package/src/components/Tooltip.js +0 -51
- package/src/components/Tooltip.test.js +0 -21
- package/src/getTheme.js +0 -103
- package/src/getTheme.test.js +0 -92
- package/src/getThemeOverrides.js +0 -27
- package/src/hocs/withAuthentication.js +0 -18
- package/src/hocs/withAuthentication.test.js +0 -120
- package/src/utils/styledPropFuncs.js +0 -20
- package/src/utils/styledPropFuncs.test.js +0 -166
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import styled from "styled-components";
|
|
3
|
-
import transition from "styled-transition-group";
|
|
4
|
-
import { TransitionGroup } from "react-transition-group";
|
|
5
2
|
import ReactDOM from "react-dom";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import
|
|
3
|
+
import { FormattedMessage } from "react-intl";
|
|
4
|
+
import { makeStyles } from "@material-ui/core/styles";
|
|
5
|
+
import Icon from "./MaterialUI/DataDisplay/Icon";
|
|
6
|
+
import { getToastColor } from "../utils/toastHelper";
|
|
7
|
+
import { CSSTransition, TransitionGroup } from "react-transition-group";
|
|
10
8
|
|
|
11
9
|
const portal = document.getElementById("toast") || document.createElement("div");
|
|
12
10
|
/* istanbul ignore else */
|
|
@@ -15,100 +13,91 @@ if (!portal.parent) {
|
|
|
15
13
|
document.body.appendChild(portal);
|
|
16
14
|
}
|
|
17
15
|
|
|
18
|
-
const
|
|
16
|
+
const useStyles = makeStyles(theme => ({
|
|
17
|
+
toastBox: props => {
|
|
18
|
+
const toastColor = getToastColor(theme, props.toastType);
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
return {
|
|
21
|
+
display: "flex",
|
|
22
|
+
width: theme.spacing(39),
|
|
23
|
+
marginTop: theme.spacing(1),
|
|
24
|
+
padding: theme.spacing(1.7),
|
|
25
|
+
borderRadius: theme.spacing(0.5),
|
|
26
|
+
fontSize: theme.spacing(1.4),
|
|
27
|
+
color: "white",
|
|
28
|
+
backgroundColor: toastColor,
|
|
29
|
+
zIndex: 10000,
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
&:enter {
|
|
37
|
-
transform: translateX(200%);
|
|
38
|
-
}
|
|
39
|
-
&:enter-active {
|
|
40
|
-
transform: translateX(0);
|
|
41
|
-
transition: transform ${toastTransitionTime}ms ease-out;
|
|
42
|
-
}
|
|
43
|
-
&:exit {
|
|
44
|
-
transform-origin: top;
|
|
45
|
-
transform: scale(1,1);
|
|
46
|
-
}
|
|
47
|
-
&:exit ~ & {
|
|
48
|
-
transform: translateY(0);
|
|
49
|
-
}
|
|
50
|
-
&:exit-active {
|
|
51
|
-
transform: scale(1, 0.001);
|
|
52
|
-
transition: transform ${toastTransitionTime}ms ease-out;
|
|
53
|
-
}
|
|
54
|
-
&:exit-active ~ & {
|
|
55
|
-
transition: transform ${toastTransitionTime}ms ease-out;
|
|
56
|
-
transform: translateY(-100%);
|
|
57
|
-
}
|
|
58
|
-
`;
|
|
59
|
-
ToastBox.defaultProps = {
|
|
60
|
-
timeout: toastTransitionTime,
|
|
61
|
-
unmountOnExit: true,
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
export const ToastIcon = styled(Icon).attrs(props => ({
|
|
65
|
-
id: getThemeProp(["icons", "toast", props => props.type], "bubble-chat-2")(props),
|
|
66
|
-
}))`
|
|
67
|
-
font-size: 20px;
|
|
68
|
-
margin-right: 16px;
|
|
69
|
-
stroke-width: 2px;
|
|
70
|
-
`;
|
|
31
|
+
"& > *": {
|
|
32
|
+
marginTop: "auto",
|
|
33
|
+
marginBottom: "auto",
|
|
34
|
+
},
|
|
71
35
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
36
|
+
"&.enter": {
|
|
37
|
+
transform: "translateX(200%)",
|
|
38
|
+
},
|
|
39
|
+
"&.enter-active": {
|
|
40
|
+
transform: "translateX(0)",
|
|
41
|
+
transition: "transform 300ms ease-out",
|
|
42
|
+
},
|
|
43
|
+
"&.exit": {
|
|
44
|
+
transformOrigin: "top",
|
|
45
|
+
transform: "scale(1,1)",
|
|
46
|
+
},
|
|
47
|
+
"&.exit ~ &": {
|
|
48
|
+
transform: "translateY(0)",
|
|
49
|
+
},
|
|
50
|
+
"&.exit-active": {
|
|
51
|
+
transform: "scale(1, 0.001)",
|
|
52
|
+
transition: "transform 300ms ease-out",
|
|
53
|
+
},
|
|
54
|
+
"&.exit-active ~ &": {
|
|
55
|
+
transition: "transform 300ms ease-out",
|
|
56
|
+
transform: "translateY(-100%)",
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
listWrapper: {
|
|
61
|
+
position: "absolute",
|
|
62
|
+
top: theme.spacing(4),
|
|
63
|
+
right: theme.spacing(1.6),
|
|
64
|
+
display: "flex",
|
|
65
|
+
flexDirection: "column",
|
|
66
|
+
},
|
|
67
|
+
closeIcon: {
|
|
68
|
+
padding: theme.spacing(0.2),
|
|
69
|
+
borderRadius: theme.spacing(0.2),
|
|
70
|
+
strokeWidth: theme.spacing(0.2),
|
|
71
|
+
cursor: "pointer",
|
|
72
|
+
marginLeft: "auto",
|
|
73
|
+
fontSize: theme.spacing(2),
|
|
74
|
+
},
|
|
75
|
+
}));
|
|
82
76
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
`;
|
|
77
|
+
export const Toast = ({ message = "[No message]", type = "", closeFunc, ...props }) => {
|
|
78
|
+
const classes = useStyles({ toastType: type });
|
|
87
79
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
80
|
+
return (
|
|
81
|
+
<CSSTransition in={props.in} timeout={300} unmountOnExit>
|
|
82
|
+
<div className={classes.toastBox}>
|
|
83
|
+
<span>{typeof message === "string" ? message : <FormattedMessage {...message} />}</span>
|
|
84
|
+
{closeFunc ? <Icon id="close" className={classes.closeIcon} onClick={closeFunc} /> : null}
|
|
85
|
+
</div>
|
|
86
|
+
</CSSTransition>
|
|
87
|
+
);
|
|
88
|
+
};
|
|
95
89
|
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
top: 40px;
|
|
99
|
-
right: 16px;
|
|
100
|
-
display: flex;
|
|
101
|
-
flex-direction: column;
|
|
102
|
-
`;
|
|
90
|
+
export const ToastList = ({ toasts }) => {
|
|
91
|
+
const classes = useStyles();
|
|
103
92
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
<ListWrapper>
|
|
93
|
+
return ReactDOM.createPortal(
|
|
94
|
+
<TransitionGroup className={classes.listWrapper}>
|
|
107
95
|
{toasts.map((props, idx) => (
|
|
108
96
|
<Toast key={"toast" + idx} {...props} />
|
|
109
97
|
))}
|
|
110
|
-
</
|
|
98
|
+
</TransitionGroup>,
|
|
111
99
|
portal,
|
|
112
100
|
);
|
|
101
|
+
};
|
|
113
102
|
|
|
114
103
|
export default ToastList;
|
|
@@ -3,10 +3,9 @@ import ReactDOM from "react-dom";
|
|
|
3
3
|
import { Provider } from "react-redux";
|
|
4
4
|
import { IntlProvider } from "react-intl";
|
|
5
5
|
import { Ignore } from "unexpected-reaction";
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import FullToastList, { Toast, ToastBox, ToastIcon, CloseIcon } from "./ToastList";
|
|
6
|
+
import Icon from "./MaterialUI/DataDisplay/Icon";
|
|
7
|
+
import FullToastList, { Toast } from "./ToastList";
|
|
8
|
+
import { CSSTransition } from "react-transition-group";
|
|
10
9
|
|
|
11
10
|
class RenderToast extends React.Component {
|
|
12
11
|
render() {
|
|
@@ -47,10 +46,11 @@ describe("ToastList", () => {
|
|
|
47
46
|
return expect(
|
|
48
47
|
toastRoot,
|
|
49
48
|
"to contain",
|
|
50
|
-
<
|
|
51
|
-
<
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
<CSSTransition in>
|
|
50
|
+
<div>
|
|
51
|
+
<span>[No message]</span>
|
|
52
|
+
</div>
|
|
53
|
+
</CSSTransition>,
|
|
54
54
|
);
|
|
55
55
|
});
|
|
56
56
|
});
|
|
@@ -70,10 +70,11 @@ describe("Toast", () => {
|
|
|
70
70
|
</Provider>,
|
|
71
71
|
"when mounted",
|
|
72
72
|
"to satisfy",
|
|
73
|
-
<
|
|
74
|
-
<
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
<CSSTransition in>
|
|
74
|
+
<div>
|
|
75
|
+
<span>this is a toast</span>
|
|
76
|
+
</div>
|
|
77
|
+
</CSSTransition>,
|
|
77
78
|
));
|
|
78
79
|
|
|
79
80
|
it("shows a translated message", () =>
|
|
@@ -91,10 +92,11 @@ describe("Toast", () => {
|
|
|
91
92
|
</Provider>,
|
|
92
93
|
"when mounted",
|
|
93
94
|
"to satisfy",
|
|
94
|
-
<
|
|
95
|
-
<
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
<CSSTransition in>
|
|
96
|
+
<div>
|
|
97
|
+
<span>This is a toast</span>
|
|
98
|
+
</div>
|
|
99
|
+
</CSSTransition>,
|
|
98
100
|
));
|
|
99
101
|
|
|
100
102
|
it("shows an icon", () =>
|
|
@@ -110,10 +112,11 @@ describe("Toast", () => {
|
|
|
110
112
|
</Provider>,
|
|
111
113
|
"when mounted",
|
|
112
114
|
"to satisfy",
|
|
113
|
-
<
|
|
114
|
-
<
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
<CSSTransition in>
|
|
116
|
+
<div>
|
|
117
|
+
<Ignore />
|
|
118
|
+
</div>
|
|
119
|
+
</CSSTransition>,
|
|
117
120
|
));
|
|
118
121
|
|
|
119
122
|
it("shows a close icon if a close function is given", () =>
|
|
@@ -129,88 +132,11 @@ describe("Toast", () => {
|
|
|
129
132
|
</Provider>,
|
|
130
133
|
"when mounted",
|
|
131
134
|
"to satisfy",
|
|
132
|
-
<
|
|
133
|
-
<
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
135
|
+
<CSSTransition in>
|
|
136
|
+
<div>
|
|
137
|
+
<Ignore />
|
|
138
|
+
<Icon id="close" onClick={expect.it("to be a function")} />
|
|
139
|
+
</div>
|
|
140
|
+
</CSSTransition>,
|
|
137
141
|
));
|
|
138
|
-
|
|
139
|
-
describe("with types", () => {
|
|
140
|
-
let theme;
|
|
141
|
-
beforeEach(() => {
|
|
142
|
-
theme = {
|
|
143
|
-
colors: {
|
|
144
|
-
toasts: {
|
|
145
|
-
test: "#ff0000",
|
|
146
|
-
},
|
|
147
|
-
},
|
|
148
|
-
icons: {
|
|
149
|
-
toast: {
|
|
150
|
-
test: "test-icon",
|
|
151
|
-
},
|
|
152
|
-
},
|
|
153
|
-
};
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
it("renders a default type", () =>
|
|
157
|
-
expect(
|
|
158
|
-
<Provider
|
|
159
|
-
store={{
|
|
160
|
-
subscribe: () => {},
|
|
161
|
-
dispatch: () => {},
|
|
162
|
-
getState: () => ({}),
|
|
163
|
-
}}
|
|
164
|
-
>
|
|
165
|
-
<ThemeProvider theme={theme}>
|
|
166
|
-
<Toast in />
|
|
167
|
-
</ThemeProvider>
|
|
168
|
-
</Provider>,
|
|
169
|
-
"when mounted",
|
|
170
|
-
"to have style rules satisfying",
|
|
171
|
-
"to contain",
|
|
172
|
-
"background-color: #999;",
|
|
173
|
-
).and("when mounted", "to contain", <Icon id="bubble-chat-2" />));
|
|
174
|
-
|
|
175
|
-
it("renders a set type", () =>
|
|
176
|
-
expect(
|
|
177
|
-
<Provider
|
|
178
|
-
store={{
|
|
179
|
-
subscribe: () => {},
|
|
180
|
-
dispatch: () => {},
|
|
181
|
-
getState: () => ({}),
|
|
182
|
-
}}
|
|
183
|
-
>
|
|
184
|
-
<ThemeProvider theme={theme}>
|
|
185
|
-
<Toast in type="test" />
|
|
186
|
-
</ThemeProvider>
|
|
187
|
-
</Provider>,
|
|
188
|
-
"when mounted",
|
|
189
|
-
"to have style rules satisfying",
|
|
190
|
-
"to contain",
|
|
191
|
-
"background-color: #ff0000;",
|
|
192
|
-
).and("when mounted", "to contain", <Icon id="test-icon" />));
|
|
193
|
-
|
|
194
|
-
it("darkens close icon background on hover", () =>
|
|
195
|
-
expect(
|
|
196
|
-
<ThemeProvider theme={theme}>
|
|
197
|
-
<CloseIcon type="" />
|
|
198
|
-
</ThemeProvider>,
|
|
199
|
-
"when mounted",
|
|
200
|
-
"to have style rules satisfying",
|
|
201
|
-
"to contain",
|
|
202
|
-
":hover {background-color: " + shade(0.3, "#999") + ";}",
|
|
203
|
-
));
|
|
204
|
-
|
|
205
|
-
it("darkens close icon background on hover with set type", () =>
|
|
206
|
-
expect(
|
|
207
|
-
<ThemeProvider theme={theme}>
|
|
208
|
-
<CloseIcon type="test" />
|
|
209
|
-
</ThemeProvider>,
|
|
210
|
-
"when mounted",
|
|
211
|
-
"to have style rules satisfying",
|
|
212
|
-
"to contain",
|
|
213
|
-
":hover {background-color: " + shade(0.3, "#ff0000") + ";}",
|
|
214
|
-
));
|
|
215
|
-
});
|
|
216
142
|
});
|
|
@@ -1,47 +1,65 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { makeStyles } from "@material-ui/core/styles";
|
|
3
|
+
import { branchIndentSpacing, branchLengthSpacing, branchHeightSpacing } from "./settings";
|
|
4
|
+
import classNames from "classnames";
|
|
5
|
+
|
|
6
|
+
const useStyles = makeStyles(theme => {
|
|
7
|
+
const base = {
|
|
8
|
+
margin: 0,
|
|
9
|
+
fontSize: theme.spacing(1.3),
|
|
10
|
+
listStyleType: "none",
|
|
11
|
+
borderWidth: 0,
|
|
12
|
+
borderStyle: "solid",
|
|
13
|
+
borderColor: "#666",
|
|
14
|
+
position: "relative",
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
branch: props => ({
|
|
19
|
+
...base,
|
|
20
|
+
marginLeft: `${theme.spacing(branchIndentSpacing)}`,
|
|
21
|
+
padding: "0",
|
|
22
|
+
paddingLeft: `${theme.spacing(branchLengthSpacing)}`,
|
|
23
|
+
borderLeftWidth: theme.spacing(0.1),
|
|
24
|
+
|
|
25
|
+
"&:last-child::after": {
|
|
26
|
+
/* blocker - hides lowest part of vertical branch */
|
|
27
|
+
content: '""',
|
|
28
|
+
backgroundColor: props.dark ? theme.palette.grey.dark : "#fff",
|
|
29
|
+
position: "absolute",
|
|
30
|
+
left: `-${theme.spacing(branchIndentSpacing + branchLengthSpacing + 0.2)}`,
|
|
31
|
+
bottom: 0,
|
|
32
|
+
top: `-${theme.spacing(branchHeightSpacing)}`,
|
|
33
|
+
width: theme.spacing(0.1),
|
|
34
|
+
},
|
|
35
|
+
}),
|
|
36
|
+
wrapper: {
|
|
37
|
+
...base,
|
|
38
|
+
overflowY: "auto",
|
|
39
|
+
overflowX: "hidden",
|
|
40
|
+
marginLeft: 0,
|
|
41
|
+
padding: `${theme.spacing(branchLengthSpacing - 0.5)}`,
|
|
42
|
+
|
|
43
|
+
"& > $branch": {
|
|
44
|
+
/* First Branch immediately under Wrapper needs margin adjusted to look right */
|
|
45
|
+
marginLeft: `${theme.spacing(branchIndentSpacing * 1.5)}`,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
export const Branch = ({ dark, branchClassName, children }) => {
|
|
52
|
+
const classes = useStyles({ dark });
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<ul className={classNames(classes.branch, branchClassName)} data-qa="branch">
|
|
56
|
+
{children}
|
|
57
|
+
</ul>
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export const Wrapper = ({ children }) => {
|
|
62
|
+
const classes = useStyles();
|
|
63
|
+
|
|
64
|
+
return <ul className={classes.wrapper}>{children}</ul>;
|
|
65
|
+
};
|
|
@@ -1,49 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { Branch
|
|
2
|
+
import { Branch } from "./Branch";
|
|
3
3
|
|
|
4
4
|
describe("Branch", () => {
|
|
5
5
|
it("renders a <ul>", () => expect(<Branch />, "when mounted", "to satisfy", <ul />));
|
|
6
6
|
|
|
7
|
-
it("
|
|
8
|
-
expect(
|
|
9
|
-
<Branch
|
|
10
|
-
theme={{
|
|
11
|
-
treeSettings: {
|
|
12
|
-
branchIndent: 10,
|
|
13
|
-
branchLength: 12,
|
|
14
|
-
branchHeight: 14,
|
|
15
|
-
},
|
|
16
|
-
}}
|
|
17
|
-
/>,
|
|
18
|
-
"when mounted",
|
|
19
|
-
"to have style rules satisfying",
|
|
20
|
-
expect
|
|
21
|
-
.it("to contain", "margin-left: 10px;")
|
|
22
|
-
.and("to contain", "padding-left: 12px;")
|
|
23
|
-
.and("to match", /:last-child::after {[^}]*left: -24px;[^}]*}/)
|
|
24
|
-
.and("to match", /:last-child::after {[^}]*top: -14px;[^}]*}/),
|
|
25
|
-
));
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
describe("Wrapper", () => {
|
|
29
|
-
it("renders a <ul>", () => expect(<Wrapper />, "when mounted", "to satisfy", <ul />));
|
|
30
|
-
|
|
31
|
-
it("sets styling for showing the root of a tree structure", () =>
|
|
32
|
-
expect(
|
|
33
|
-
<Wrapper
|
|
34
|
-
theme={{
|
|
35
|
-
treeSettings: {
|
|
36
|
-
branchIndent: 10,
|
|
37
|
-
branchLength: 12,
|
|
38
|
-
branchHeight: 14,
|
|
39
|
-
},
|
|
40
|
-
}}
|
|
41
|
-
/>,
|
|
42
|
-
"when mounted",
|
|
43
|
-
"to have style rules satisfying",
|
|
44
|
-
expect
|
|
45
|
-
.it("to contain", "margin-left: 0;")
|
|
46
|
-
.and("to contain", "padding: 7px;")
|
|
47
|
-
.and("to contain", "> ." + Branch.styledComponentId + " {margin-left: 15px;}"),
|
|
48
|
-
));
|
|
7
|
+
it("renders a dark <ul>", () => expect(<Branch dark />, "when mounted", "to satisfy", <ul />));
|
|
49
8
|
});
|
|
@@ -1,54 +1,68 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { makeStyles } from "@material-ui/core/styles";
|
|
3
|
+
import Icon from "../MaterialUI/DataDisplay/Icon";
|
|
4
|
+
import { branchLengthSpacing } from "./settings";
|
|
5
|
+
import classNames from "classnames";
|
|
6
|
+
|
|
7
|
+
const useStyles = makeStyles(theme => ({
|
|
8
|
+
beforeIndicator: {
|
|
9
|
+
backgroundColor: "#666",
|
|
10
|
+
marginLeft: `-${theme.spacing(branchLengthSpacing + 0.1)}`,
|
|
11
|
+
width: `${theme.spacing(branchLengthSpacing + 0.1)}`,
|
|
12
|
+
height: theme.spacing(0.1),
|
|
13
|
+
zIndex: 99,
|
|
14
|
+
position: "absolute",
|
|
15
|
+
},
|
|
16
|
+
nonIndicator: {
|
|
17
|
+
height: theme.spacing(0.1),
|
|
18
|
+
width: `${theme.spacing(branchLengthSpacing + 2.1)}`,
|
|
19
|
+
margin: `auto 0 auto -${theme.spacing(branchLengthSpacing + 0.1)}`,
|
|
20
|
+
backgroundColor: "#666",
|
|
21
|
+
alignSelf: "stretch",
|
|
22
|
+
flex: "0 0 auto",
|
|
23
|
+
zIndex: 99,
|
|
24
|
+
},
|
|
25
|
+
label: props => ({
|
|
26
|
+
cursor: "pointer",
|
|
27
|
+
flexGrow: 1,
|
|
28
|
+
width: "100%",
|
|
29
|
+
backgroundColor: props.isSelectedNode ? "#222" : undefined,
|
|
30
|
+
border: props.isSelectedNode ? `1px solid ${theme.palette.grey.borders}` : undefined,
|
|
31
|
+
}),
|
|
32
|
+
indicator: props => ({
|
|
33
|
+
fontSize: theme.spacing(1),
|
|
34
|
+
padding: theme.spacing(1, 0, 1, 1),
|
|
35
|
+
cursor: "pointer",
|
|
36
|
+
flex: "0 0 auto",
|
|
37
|
+
color: props.open
|
|
38
|
+
? props.dark
|
|
39
|
+
? theme.palette.primary.light
|
|
40
|
+
: theme.palette.text.primary
|
|
41
|
+
: theme.palette.primary.main,
|
|
42
|
+
}),
|
|
43
|
+
}));
|
|
44
|
+
|
|
45
|
+
export const BeforeIndicator = ({ children }) => {
|
|
46
|
+
const classes = useStyles();
|
|
47
|
+
|
|
48
|
+
return <div className={classes.beforeIndicator}>{children}</div>;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const NonIndicator = ({ children }) => {
|
|
52
|
+
const classes = useStyles();
|
|
53
|
+
|
|
54
|
+
return <div className={classes.nonIndicator}>{children}</div>;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const Label = ({ isSelectedNode, labelClassName, children }) => {
|
|
58
|
+
const classes = useStyles({ isSelectedNode });
|
|
59
|
+
|
|
60
|
+
return <div className={classNames(classes.label, labelClassName)}>{children}</div>;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export const Indicator = ({ open, dark, onClick }) => {
|
|
64
|
+
const classes = useStyles({ open, dark });
|
|
65
|
+
const iconId = open ? "dropdown-chevron-down" : "dropdown-chevron-right";
|
|
66
|
+
|
|
67
|
+
return <Icon id={iconId} className={classes.indicator} onClick={onClick} data-qa="indicator" />;
|
|
68
|
+
};
|