orc-shared 5.10.2-dev.1 → 5.99.0-dev.1

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.
Files changed (177) hide show
  1. package/dist/components/AppFrame/MenuItem.js +3 -12
  2. package/dist/components/ApplicationModuleLoader.js +3 -2
  3. package/dist/components/Authenticate.js +29 -22
  4. package/dist/components/ErrorPlaceholder.js +8 -24
  5. package/dist/components/{IconButton.js → Form/Inputs/MultiSelector.js} +33 -31
  6. package/dist/components/Form/Inputs/index.js +1 -1
  7. package/dist/components/LoadingIcon.js +38 -17
  8. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.js +3 -3
  9. package/dist/components/MaterialUI/DataDisplay/Table.js +2 -1
  10. package/dist/components/MaterialUI/DataDisplay/TableProps.js +3 -1
  11. package/dist/components/MaterialUI/Inputs/Select.js +10 -0
  12. package/dist/components/MaterialUI/Inputs/SelectProps.js +3 -1
  13. package/dist/components/MaterialUI/Navigation/DropDownMenu.js +2 -4
  14. package/dist/components/MaterialUI/Surfaces/SectionExpansionPanel.js +3 -2
  15. package/dist/components/MaterialUI/muiThemes.js +2 -0
  16. package/dist/components/Provision.js +30 -13
  17. package/dist/components/Routing/SegmentPage.js +115 -56
  18. package/dist/components/Scope/ScopeNode.js +64 -57
  19. package/dist/components/Sidepanel.js +57 -23
  20. package/dist/components/Spritesheet.js +33 -17
  21. package/dist/components/Text.js +1 -60
  22. package/dist/components/ToastList.js +95 -64
  23. package/dist/components/Treeview/Branch.js +82 -20
  24. package/dist/components/Treeview/Label.js +108 -31
  25. package/dist/components/Treeview/Leaf.js +56 -12
  26. package/dist/components/Treeview/Node.js +22 -9
  27. package/dist/components/Treeview/index.js +7 -1
  28. package/dist/components/Treeview/settings.js +7 -5
  29. package/dist/utils/index.js +0 -4
  30. package/dist/utils/testUtils.js +1 -12
  31. package/dist/{components/Modal/Background.js → utils/toastHelper.js} +11 -14
  32. package/package.json +2 -2
  33. package/src/components/AppFrame/MenuItem.js +1 -9
  34. package/src/components/ApplicationModuleLoader.js +2 -2
  35. package/src/components/ApplicationModuleLoader.test.js +15 -28
  36. package/src/components/Authenticate.js +21 -23
  37. package/src/components/Authenticate.test.js +19 -27
  38. package/src/components/ErrorPlaceholder.js +4 -21
  39. package/src/components/ErrorPlaceholder.test.js +7 -14
  40. package/src/components/Form/InputField.test.js +2 -1
  41. package/src/components/Form/Inputs/MultiSelector.js +23 -0
  42. package/src/components/Form/Inputs/MultiSelector.test.js +112 -0
  43. package/src/components/Form/Inputs/index.js +1 -1
  44. package/src/components/Loader.test.js +50 -59
  45. package/src/components/LoadingIcon.js +27 -14
  46. package/src/components/LoadingIcon.test.js +11 -15
  47. package/src/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.js +2 -2
  48. package/src/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.test.js +0 -74
  49. package/src/components/MaterialUI/DataDisplay/Table.js +6 -1
  50. package/src/components/MaterialUI/DataDisplay/Table.test.js +21 -1
  51. package/src/components/MaterialUI/DataDisplay/TableProps.js +2 -0
  52. package/src/components/MaterialUI/DataDisplay/TableProps.test.js +20 -2
  53. package/src/components/MaterialUI/Inputs/Select.js +7 -0
  54. package/src/components/MaterialUI/Inputs/Select.test.js +45 -0
  55. package/src/components/MaterialUI/Inputs/SelectProps.js +2 -0
  56. package/src/components/MaterialUI/Inputs/SelectProps.test.js +2 -0
  57. package/src/components/MaterialUI/Navigation/DropDownMenu.js +2 -2
  58. package/src/components/MaterialUI/Navigation/DropDownMenu.test.js +5 -6
  59. package/src/components/MaterialUI/Surfaces/SectionExpansionPanel.js +2 -1
  60. package/src/components/MaterialUI/muiThemes.js +3 -0
  61. package/src/components/Navigation/Navigation.test.js +0 -5
  62. package/src/components/Navigation/useNavigationState.test.js +79 -222
  63. package/src/components/Provision.js +36 -42
  64. package/src/components/Provision.test.js +10 -26
  65. package/src/components/Routing/SegmentPage.js +68 -52
  66. package/src/components/Routing/SegmentPage.test.js +4 -12
  67. package/src/components/Scope/ScopeNode.js +45 -55
  68. package/src/components/Scope/ScopeNode.test.js +84 -163
  69. package/src/components/ScopeExtendedConfigurationLoader.test.js +1 -4
  70. package/src/components/Sidepanel.js +38 -32
  71. package/src/components/Sidepanel.test.js +49 -27
  72. package/src/components/Spritesheet.js +23 -21
  73. package/src/components/Spritesheet.test.js +10 -10
  74. package/src/components/Text.js +0 -49
  75. package/src/components/ToastList.js +79 -90
  76. package/src/components/ToastList.test.js +29 -103
  77. package/src/components/Treeview/Branch.js +63 -45
  78. package/src/components/Treeview/Branch.test.js +21 -24
  79. package/src/components/Treeview/Label.js +66 -52
  80. package/src/components/Treeview/Label.test.js +42 -60
  81. package/src/components/Treeview/Leaf.js +41 -22
  82. package/src/components/Treeview/Leaf.test.js +15 -10
  83. package/src/components/Treeview/Node.js +16 -9
  84. package/src/components/Treeview/Node.test.js +269 -200
  85. package/src/components/Treeview/Treeview.test.js +248 -248
  86. package/src/components/Treeview/index.js +6 -0
  87. package/src/components/Treeview/settings.js +7 -6
  88. package/src/utils/index.js +0 -4
  89. package/src/utils/testUtils.js +0 -10
  90. package/src/utils/testUtils.test.js +0 -68
  91. package/src/utils/toastHelper.js +8 -0
  92. package/src/utils/toastHelper.test.js +41 -0
  93. package/dist/components/Button.js +0 -70
  94. package/dist/components/CategoryList.js +0 -197
  95. package/dist/components/Checkbox.js +0 -103
  96. package/dist/components/Icon.js +0 -69
  97. package/dist/components/Input.js +0 -101
  98. package/dist/components/List/DataCell.js +0 -129
  99. package/dist/components/List/HeadCell.js +0 -125
  100. package/dist/components/List/HeadRow.js +0 -73
  101. package/dist/components/List/List.js +0 -274
  102. package/dist/components/List/Row.js +0 -109
  103. package/dist/components/List/enhanceColumnDefs.js +0 -111
  104. package/dist/components/List/index.js +0 -59
  105. package/dist/components/Modal/Dialog.js +0 -75
  106. package/dist/components/Modal/Wrapper.js +0 -69
  107. package/dist/components/Modal/index.js +0 -86
  108. package/dist/components/MultiSelector.js +0 -187
  109. package/dist/components/Navigation/Bar.js +0 -293
  110. package/dist/components/Navigation/Tab.js +0 -182
  111. package/dist/components/Placeholder.js +0 -114
  112. package/dist/components/Scope/Selector.js +0 -123
  113. package/dist/components/Selector.js +0 -185
  114. package/dist/components/Switch.js +0 -128
  115. package/dist/components/Toolbar.js +0 -227
  116. package/dist/components/Tooltip.js +0 -66
  117. package/dist/getTheme.js +0 -158
  118. package/dist/getThemeOverrides.js +0 -93
  119. package/dist/hocs/withAuthentication.js +0 -72
  120. package/dist/utils/styledPropFuncs.js +0 -88
  121. package/src/components/Button.js +0 -90
  122. package/src/components/Button.test.js +0 -49
  123. package/src/components/CategoryList.js +0 -140
  124. package/src/components/CategoryList.test.js +0 -667
  125. package/src/components/Checkbox.js +0 -63
  126. package/src/components/Checkbox.test.js +0 -122
  127. package/src/components/Icon.js +0 -18
  128. package/src/components/IconButton.js +0 -30
  129. package/src/components/IconButton.test.js +0 -61
  130. package/src/components/Input.js +0 -35
  131. package/src/components/Input.test.js +0 -34
  132. package/src/components/List/DataCell.js +0 -77
  133. package/src/components/List/DataCell.test.js +0 -357
  134. package/src/components/List/HeadCell.js +0 -105
  135. package/src/components/List/HeadCell.test.js +0 -331
  136. package/src/components/List/HeadRow.js +0 -21
  137. package/src/components/List/HeadRow.test.js +0 -27
  138. package/src/components/List/List.js +0 -162
  139. package/src/components/List/List.test.js +0 -705
  140. package/src/components/List/Row.js +0 -72
  141. package/src/components/List/Row.test.js +0 -194
  142. package/src/components/List/enhanceColumnDefs.js +0 -54
  143. package/src/components/List/enhanceColumnDefs.test.js +0 -179
  144. package/src/components/List/index.js +0 -6
  145. package/src/components/Modal/Background.js +0 -10
  146. package/src/components/Modal/Dialog.js +0 -27
  147. package/src/components/Modal/Dialog.test.js +0 -20
  148. package/src/components/Modal/Modal.test.js +0 -52
  149. package/src/components/Modal/Wrapper.js +0 -32
  150. package/src/components/Modal/Wrapper.test.js +0 -55
  151. package/src/components/Modal/index.js +0 -22
  152. package/src/components/MultiSelector.js +0 -104
  153. package/src/components/MultiSelector.test.js +0 -348
  154. package/src/components/Navigation/Bar.js +0 -212
  155. package/src/components/Navigation/Bar.test.js +0 -552
  156. package/src/components/Navigation/Tab.js +0 -156
  157. package/src/components/Navigation/Tab.test.js +0 -404
  158. package/src/components/Placeholder.js +0 -61
  159. package/src/components/Placeholder.test.js +0 -106
  160. package/src/components/Scope/Selector.js +0 -70
  161. package/src/components/Scope/Selector.test.js +0 -138
  162. package/src/components/Selector.js +0 -191
  163. package/src/components/Selector.test.js +0 -157
  164. package/src/components/Switch.js +0 -112
  165. package/src/components/Switch.test.js +0 -130
  166. package/src/components/Text.test.js +0 -132
  167. package/src/components/Toolbar.js +0 -178
  168. package/src/components/Toolbar.test.js +0 -478
  169. package/src/components/Tooltip.js +0 -51
  170. package/src/components/Tooltip.test.js +0 -21
  171. package/src/getTheme.js +0 -103
  172. package/src/getTheme.test.js +0 -92
  173. package/src/getThemeOverrides.js +0 -27
  174. package/src/hocs/withAuthentication.js +0 -18
  175. package/src/hocs/withAuthentication.test.js +0 -120
  176. package/src/utils/styledPropFuncs.js +0 -20
  177. package/src/utils/styledPropFuncs.test.js +0 -166
@@ -1,72 +1,50 @@
1
1
  import React from "react";
2
+ import { MuiThemeProvider } from "@material-ui/core";
2
3
  import { Label, Indicator, BeforeIndicator, NonIndicator } from "./Label";
3
- import Icon from "../Icon";
4
+ import Icon from "../MaterialUI/DataDisplay/Icon";
5
+ import { createMuiTheme } from "../../utils/testUtils";
6
+
7
+ const theme = createMuiTheme();
4
8
 
5
9
  describe("Indicator", () => {
6
10
  it("renders a closed arrow icon", () =>
7
- expect(<Indicator />, "when mounted", "to satisfy", <Icon id="chevron-right" />));
11
+ expect(<Indicator />, "when mounted", "to satisfy", <Icon id="dropdown-chevron-right" />));
8
12
 
9
13
  it("renders an open arrow icon", () =>
10
- expect(<Indicator open />, "when mounted", "to satisfy", <Icon id="chevron-down" />));
14
+ expect(<Indicator open />, "when mounted", "to satisfy", <Icon id="dropdown-chevron-down" />));
11
15
 
12
16
  it("renders closed arrows in highlight color", () =>
13
- expect(<Indicator />, "when mounted", "to have style rules satisfying", "to contain", "color: #ffffff;"));
17
+ expect(
18
+ <MuiThemeProvider theme={theme}>
19
+ <Indicator />
20
+ </MuiThemeProvider>,
21
+ "when mounted",
22
+ "to have style rules satisfying",
23
+ "to contain",
24
+ "color: #333;",
25
+ ));
14
26
 
15
27
  it("renders open arrows in dark grey", () =>
16
- expect(<Indicator open />, "when mounted", "to have style rules satisfying", "to contain", "color: #333333;"));
28
+ expect(
29
+ <MuiThemeProvider theme={theme}>
30
+ <Indicator open />
31
+ </MuiThemeProvider>,
32
+ "when mounted",
33
+ "to have style rules satisfying",
34
+ "to contain",
35
+ "color: #333;",
36
+ ));
17
37
 
18
38
  it("renders open arrows in light grey when dark", () =>
19
- expect(<Indicator open dark />, "when mounted", "to have style rules satisfying", "to contain", "color: #cccccc;"));
20
-
21
- describe("with theme", () => {
22
- let theme;
23
- beforeEach(() => {
24
- theme = {
25
- colors: { application: { base: "red" } },
26
- icons: {
27
- indicators: {
28
- up: "arrow-up",
29
- down: "arrow-down",
30
- right: "arrow-right",
31
- left: "arrow-left",
32
- },
33
- },
34
- };
35
- });
36
-
37
- it("renders a closed arrow icon", () =>
38
- expect(<Indicator theme={theme} />, "when mounted", "to satisfy", <Icon id="arrow-right" />));
39
-
40
- it("renders an open arrow icon", () =>
41
- expect(<Indicator theme={theme} open />, "when mounted", "to satisfy", <Icon id="arrow-down" />));
42
-
43
- it("renders closed arrows in highlight color", () =>
44
- expect(
45
- <Indicator theme={theme} />,
46
- "when mounted",
47
- "to have style rules satisfying",
48
- "to contain",
49
- "color: red;",
50
- ));
51
-
52
- it("renders open arrows in dark grey", () =>
53
- expect(
54
- <Indicator theme={theme} open />,
55
- "when mounted",
56
- "to have style rules satisfying",
57
- "to contain",
58
- "color: #333333;",
59
- ));
60
-
61
- it("renders open arrows in light grey when dark", () =>
62
- expect(
63
- <Indicator theme={theme} open dark />,
64
- "when mounted",
65
- "to have style rules satisfying",
66
- "to contain",
67
- "color: #cccccc;",
68
- ));
69
- });
39
+ expect(
40
+ <MuiThemeProvider theme={theme}>
41
+ <Indicator open dark />
42
+ </MuiThemeProvider>,
43
+ "when mounted",
44
+ "to have style rules satisfying",
45
+ "to contain",
46
+ "color: #CCC;",
47
+ ));
70
48
  });
71
49
 
72
50
  describe("BeforeIndicator", () => {
@@ -90,17 +68,21 @@ describe("Label", () => {
90
68
 
91
69
  it("renders a label without border", () =>
92
70
  expect(
93
- <Label />,
71
+ <MuiThemeProvider theme={theme}>
72
+ <Label />
73
+ </MuiThemeProvider>,
94
74
  "when mounted",
95
75
  "to have style rules satisfying",
96
- expect.it("not to contain", "background-color: #222;").and("not to contain", "border: 1px solid #0F4E66"),
76
+ expect.it("not to contain", "background-color: #222;").and("not to contain", "border: 1px solid #CCC"),
97
77
  ));
98
78
 
99
79
  it("renders a label with border", () =>
100
80
  expect(
101
- <Label isSelectedNode={true} />,
81
+ <MuiThemeProvider theme={theme}>
82
+ <Label isSelectedNode={true} />
83
+ </MuiThemeProvider>,
102
84
  "when mounted",
103
85
  "to have style rules satisfying",
104
- expect.it("to contain", "background-color: #222;").and("to contain", "border: 1px solid #0F4E66"),
86
+ expect.it("to contain", "background-color: #222;").and("to contain", "border: 1px solid #CCC"),
105
87
  ));
106
88
  });
@@ -1,24 +1,43 @@
1
- import styled from "styled-components";
2
- import { ifFlag, getThemeProp } from "../../utils";
3
- import { branchLength, branchHeight } from "./settings";
1
+ import React from "react";
2
+ import { makeStyles } from "@material-ui/core/styles";
3
+ import { branchLength } from "./settings";
4
+ import classNames from "classnames";
4
5
 
5
- export const Root = styled.li`
6
- position: relative;
7
- display: flex;
8
- align-items: center;
9
- `;
6
+ const useStyles = makeStyles(theme => ({
7
+ root: {
8
+ position: "relative",
9
+ display: "flex",
10
+ alignItems: "center",
11
+ },
12
+ leaf: props => ({
13
+ "&:last-child::after": {
14
+ /* blocker - hides lowest part of vertical branch */
15
+ content: '""',
16
+ backgroundColor: props.dark ? theme.palette.grey.dark : "#fff",
17
+ position: "absolute",
18
+ top: "calc(50%)",
19
+ left: `-${branchLength + 1}px`,
20
+ bottom: 0,
21
+ width: "1px",
22
+ height: "50%",
23
+ },
24
+ }),
25
+ }));
10
26
 
11
- export const Leaf = styled(Root)`
12
- &:last-child::after {
13
- /* blocker - hides lowest part of vertical branch */
14
- content: " ";
15
- background-color: ${ifFlag("dark", getThemeProp(["colors", "bgDark"], "#333333"), "#fff")};
16
- position: absolute;
17
- top: calc(50%);
18
- left: -${props => branchLength(props) + 1}px;
19
- bottom: 0;
20
- height: ${branchHeight}px;
21
- width: 1px;
22
- height: 50%;
23
- }
24
- `;
27
+ export const Root = ({ dark, leafClassName, children }) => {
28
+ const classes = useStyles({ dark });
29
+
30
+ return (
31
+ <li className={classNames(classes.root, classes.leaf, leafClassName)} data-qa="leaf">
32
+ {children}
33
+ </li>
34
+ );
35
+ };
36
+
37
+ export const Leaf = ({ dark, leafClassName, children }) => {
38
+ return (
39
+ <Root leafClassName={leafClassName} dark={dark}>
40
+ {children}
41
+ </Root>
42
+ );
43
+ };
@@ -1,4 +1,5 @@
1
1
  import React from "react";
2
+ import { createMuiTheme, TestWrapper } from "../../utils/testUtils";
2
3
  import { Root, Leaf } from "./Leaf";
3
4
 
4
5
  describe("Root", () => {
@@ -6,21 +7,25 @@ describe("Root", () => {
6
7
  });
7
8
 
8
9
  describe("Leaf", () => {
10
+ const theme = createMuiTheme();
11
+
9
12
  it("renders a <li>", () => expect(<Leaf />, "when mounted", "to satisfy", <li />));
10
13
 
11
14
  it("sets styling for a branch structure", () =>
12
15
  expect(
13
- <Leaf
14
- theme={{
15
- treeSettings: {
16
- branchIndent: 10,
17
- branchLength: 12,
18
- branchHeight: 14,
19
- },
20
- }}
21
- />,
16
+ <Leaf />,
17
+ "when mounted",
18
+ "to have style rules satisfying",
19
+ expect.it("to match", /:last-child::after {[^}]*left: -16px;[^}]*}/),
20
+ ));
21
+
22
+ it("sets styling for a dark theme", () =>
23
+ expect(
24
+ <TestWrapper muiThemeProvider={{ theme }}>
25
+ <Leaf dark />
26
+ </TestWrapper>,
22
27
  "when mounted",
23
28
  "to have style rules satisfying",
24
- expect.it("to match", /:last-child::after {[^}]*left: -13px;[^}]*}/),
29
+ expect.it("to match", /:last-child::after {[^}]*background-color: #333;[^}]*}/),
25
30
  ));
26
31
  });
@@ -6,8 +6,8 @@ import { safeGet, stripKey } from "../../utils";
6
6
 
7
7
  export const TreeContext = React.createContext();
8
8
 
9
- export const LeafNode = ({ dark, isSelectedNode, ...nodeData }) => (
10
- <Leaf dark={dark}>
9
+ export const LeafNode = ({ dark, isSelectedNode, labelClassName, leafClassName, ...nodeData }) => (
10
+ <Leaf dark={dark} leafClassName={leafClassName}>
11
11
  <TreeContext.Consumer>
12
12
  {({ Content, nodeState, updateNodeState, dark, otherProps }) => {
13
13
  const toggle = () => updateNodeState({ ...nodeState, [nodeData.id]: !nodeData.open });
@@ -18,7 +18,7 @@ export const LeafNode = ({ dark, isSelectedNode, ...nodeData }) => (
18
18
  ) : (
19
19
  <NonIndicator />
20
20
  )}
21
- <Label isSelectedNode={isSelectedNode}>
21
+ <Label isSelectedNode={isSelectedNode} labelClassName={labelClassName}>
22
22
  <Content {...stripKey("children", nodeData)} {...otherProps} />
23
23
  </Label>
24
24
  </React.Fragment>
@@ -29,9 +29,9 @@ export const LeafNode = ({ dark, isSelectedNode, ...nodeData }) => (
29
29
  );
30
30
  LeafNode.displayName = "LeafNode";
31
31
 
32
- export const RootNode = ({ isSelectedNode, ...nodeData }) => (
32
+ export const RootNode = ({ isSelectedNode, labelClassName, ...nodeData }) => (
33
33
  <Root>
34
- <Label isSelectedNode={isSelectedNode}>
34
+ <Label isSelectedNode={isSelectedNode} labelClassName={labelClassName}>
35
35
  <TreeContext.Consumer>
36
36
  {({ Content, otherProps }) => <Content {...stripKey("children", nodeData)} {...otherProps} />}
37
37
  </TreeContext.Consumer>
@@ -42,7 +42,7 @@ RootNode.displayName = "RootNode";
42
42
 
43
43
  export const Node = ({ root, id }) => (
44
44
  <TreeContext.Consumer>
45
- {({ openAll, getNode, selectedNodeId, nodeState, dark }) => {
45
+ {({ openAll, getNode, selectedNodeId, nodeState, dark, labelClassName, leafClassName, branchClassName }) => {
46
46
  const nodeData = getNode(id);
47
47
  if (!nodeData) return null;
48
48
  const isSelectedNode = selectedNodeId === id;
@@ -51,12 +51,19 @@ export const Node = ({ root, id }) => (
51
51
  return (
52
52
  <React.Fragment>
53
53
  {root ? (
54
- <RootNode {...nodeData} isSelectedNode={isSelectedNode} />
54
+ <RootNode {...nodeData} isSelectedNode={isSelectedNode} labelClassName={labelClassName} />
55
55
  ) : (
56
- <LeafNode {...nodeData} open={open} dark={dark} isSelectedNode={isSelectedNode} />
56
+ <LeafNode
57
+ {...nodeData}
58
+ open={open}
59
+ dark={dark}
60
+ isSelectedNode={isSelectedNode}
61
+ labelClassName={labelClassName}
62
+ leafClassName={leafClassName}
63
+ />
57
64
  )}
58
65
  {open && safeGet(nodeData, "children", "length") ? (
59
- <Branch dark={dark}>
66
+ <Branch dark={dark} branchClassName={branchClassName}>
60
67
  {nodeData.children.map(id => (
61
68
  <Node key={id} id={id} />
62
69
  ))}