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.
Files changed (234) hide show
  1. package/dist/components/AppFrame/About.js +13 -13
  2. package/dist/components/AppFrame/Anchor.js +7 -7
  3. package/dist/components/AppFrame/AppFrame.js +3 -3
  4. package/dist/components/AppFrame/Help.js +4 -4
  5. package/dist/components/AppFrame/MenuItem.js +17 -26
  6. package/dist/components/AppFrame/Preferences.js +14 -14
  7. package/dist/components/AppFrame/Sidebar.js +6 -6
  8. package/dist/components/AppFrame/Topbar.js +6 -6
  9. package/dist/components/ApplicationModuleLoader.js +3 -2
  10. package/dist/components/Authenticate.js +29 -22
  11. package/dist/components/DropMenu/Menu.js +9 -9
  12. package/dist/components/ErrorPlaceholder.js +8 -24
  13. package/dist/components/Form/Field.js +4 -4
  14. package/dist/components/Form/Inputs/Button.js +2 -2
  15. package/dist/components/Form/Inputs/MultiSelector.js +137 -0
  16. package/dist/components/Form/Inputs/Selector.js +13 -10
  17. package/dist/components/Form/Inputs/index.js +1 -1
  18. package/dist/components/InternetExplorerWarningMessage.js +15 -15
  19. package/dist/components/LoadingIcon.js +38 -17
  20. package/dist/components/MaterialUI/DataDisplay/Modal.js +3 -3
  21. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/Placeholder.js +6 -6
  22. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.js +1 -1
  23. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/TableInfoBar.js +1 -1
  24. package/dist/components/MaterialUI/DataDisplay/SelectionList.js +1 -1
  25. package/dist/components/MaterialUI/DataDisplay/Table.js +2 -1
  26. package/dist/components/MaterialUI/DataDisplay/TableProps.js +3 -1
  27. package/dist/components/MaterialUI/DataDisplay/TransferList.js +1 -1
  28. package/dist/components/MaterialUI/Inputs/CheckboxGroup.js +1 -1
  29. package/dist/components/MaterialUI/Inputs/DatePicker.js +1 -1
  30. package/dist/components/MaterialUI/Inputs/PredefinedElements/SearchControl.js +1 -1
  31. package/dist/components/MaterialUI/Inputs/Select.js +175 -109
  32. package/dist/components/MaterialUI/Inputs/SelectProps.js +11 -1
  33. package/dist/components/MaterialUI/Inputs/Switch.js +1 -1
  34. package/dist/components/MaterialUI/Navigation/DropDownMenu.js +2 -4
  35. package/dist/components/MaterialUI/ScopeSelector/ScopeSelector.js +1 -1
  36. package/dist/components/MaterialUI/ScopeSelector/TreeItem.js +27 -42
  37. package/dist/components/MaterialUI/Surfaces/Paper.js +1 -1
  38. package/dist/components/MaterialUI/Surfaces/SectionExpansionPanel.js +3 -2
  39. package/dist/components/MaterialUI/muiThemes.js +3 -1
  40. package/dist/components/Provision.js +30 -13
  41. package/dist/components/Routing/SegmentPage.js +117 -56
  42. package/dist/components/Scope/ScopeNode.js +62 -57
  43. package/dist/components/Sidepanel.js +59 -23
  44. package/dist/components/Spritesheet.js +35 -17
  45. package/dist/components/Text.js +1 -60
  46. package/dist/components/ToastList.js +95 -64
  47. package/dist/components/Treeview/Branch.js +82 -20
  48. package/dist/components/Treeview/Label.js +108 -31
  49. package/dist/components/Treeview/Leaf.js +56 -12
  50. package/dist/components/Treeview/Node.js +22 -9
  51. package/dist/components/Treeview/index.js +7 -1
  52. package/dist/components/Treeview/settings.js +17 -6
  53. package/dist/{components/Modal/index.js → hooks/useWindowSize.js} +38 -36
  54. package/dist/sharedMessages.js +8 -0
  55. package/dist/utils/index.js +0 -4
  56. package/dist/utils/testUtils.js +1 -12
  57. package/dist/{components/Modal/Background.js → utils/toastHelper.js} +11 -14
  58. package/package.json +2 -2
  59. package/src/components/AppFrame/About.js +13 -13
  60. package/src/components/AppFrame/Anchor.js +7 -7
  61. package/src/components/AppFrame/AppFrame.js +3 -3
  62. package/src/components/AppFrame/Help.js +4 -4
  63. package/src/components/AppFrame/MenuItem.js +15 -23
  64. package/src/components/AppFrame/Preferences.js +14 -14
  65. package/src/components/AppFrame/Sidebar.js +6 -6
  66. package/src/components/AppFrame/Topbar.js +6 -6
  67. package/src/components/ApplicationModuleLoader.js +2 -2
  68. package/src/components/ApplicationModuleLoader.test.js +15 -28
  69. package/src/components/Authenticate.js +21 -23
  70. package/src/components/Authenticate.test.js +19 -27
  71. package/src/components/DropMenu/Menu.js +9 -9
  72. package/src/components/ErrorPlaceholder.js +4 -21
  73. package/src/components/ErrorPlaceholder.test.js +7 -14
  74. package/src/components/Form/Field.js +4 -4
  75. package/src/components/Form/InputField.test.js +2 -1
  76. package/src/components/Form/Inputs/Button.js +2 -2
  77. package/src/components/Form/Inputs/MultiSelector.js +73 -0
  78. package/src/components/Form/Inputs/MultiSelector.test.js +332 -0
  79. package/src/components/Form/Inputs/Selector.js +12 -4
  80. package/src/components/Form/Inputs/Selector.test.js +27 -12
  81. package/src/components/Form/Inputs/index.js +1 -1
  82. package/src/components/InternetExplorerWarningMessage.js +15 -15
  83. package/src/components/Loader.test.js +50 -59
  84. package/src/components/LoadingIcon.js +27 -14
  85. package/src/components/LoadingIcon.test.js +11 -15
  86. package/src/components/MaterialUI/DataDisplay/Modal.js +3 -3
  87. package/src/components/MaterialUI/DataDisplay/PredefinedElements/Placeholder.js +6 -6
  88. package/src/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.js +1 -1
  89. package/src/components/MaterialUI/DataDisplay/PredefinedElements/TableInfoBar.js +1 -1
  90. package/src/components/MaterialUI/DataDisplay/SelectionList.js +1 -1
  91. package/src/components/MaterialUI/DataDisplay/Table.js +6 -1
  92. package/src/components/MaterialUI/DataDisplay/Table.test.js +21 -1
  93. package/src/components/MaterialUI/DataDisplay/TableProps.js +2 -0
  94. package/src/components/MaterialUI/DataDisplay/TableProps.test.js +20 -2
  95. package/src/components/MaterialUI/DataDisplay/TransferList.js +1 -1
  96. package/src/components/MaterialUI/Inputs/CheckboxGroup.js +1 -1
  97. package/src/components/MaterialUI/Inputs/DatePicker.js +1 -1
  98. package/src/components/MaterialUI/Inputs/PredefinedElements/SearchControl.js +1 -1
  99. package/src/components/MaterialUI/Inputs/PredefinedElements/SearchControl.test.js +1 -1
  100. package/src/components/MaterialUI/Inputs/Select.js +143 -83
  101. package/src/components/MaterialUI/Inputs/Select.test.js +199 -14
  102. package/src/components/MaterialUI/Inputs/SelectProps.js +10 -0
  103. package/src/components/MaterialUI/Inputs/SelectProps.test.js +10 -0
  104. package/src/components/MaterialUI/Inputs/Switch.js +1 -1
  105. package/src/components/MaterialUI/Navigation/DropDownMenu.js +2 -2
  106. package/src/components/MaterialUI/Navigation/DropDownMenu.test.js +5 -6
  107. package/src/components/MaterialUI/ScopeSelector/ScopeSelector.js +1 -2
  108. package/src/components/MaterialUI/ScopeSelector/TreeItem.js +8 -31
  109. package/src/components/MaterialUI/Surfaces/Paper.js +1 -1
  110. package/src/components/MaterialUI/Surfaces/SectionExpansionPanel.js +2 -1
  111. package/src/components/MaterialUI/muiThemes.js +4 -1
  112. package/src/components/Navigation/Navigation.test.js +0 -5
  113. package/src/components/Navigation/useNavigationState.test.js +79 -222
  114. package/src/components/Provision.js +36 -42
  115. package/src/components/Provision.test.js +10 -26
  116. package/src/components/Routing/SegmentPage.js +68 -52
  117. package/src/components/Routing/SegmentPage.test.js +4 -12
  118. package/src/components/Scope/ScopeNode.js +44 -55
  119. package/src/components/Scope/ScopeNode.test.js +84 -163
  120. package/src/components/ScopeExtendedConfigurationLoader.test.js +1 -4
  121. package/src/components/Sidepanel.js +38 -32
  122. package/src/components/Sidepanel.test.js +54 -27
  123. package/src/components/Spritesheet.js +23 -21
  124. package/src/components/Spritesheet.test.js +10 -10
  125. package/src/components/Text.js +0 -49
  126. package/src/components/ToastList.js +79 -90
  127. package/src/components/ToastList.test.js +29 -103
  128. package/src/components/Treeview/Branch.js +65 -47
  129. package/src/components/Treeview/Branch.test.js +2 -43
  130. package/src/components/Treeview/Label.js +68 -54
  131. package/src/components/Treeview/Label.test.js +55 -63
  132. package/src/components/Treeview/Leaf.js +41 -22
  133. package/src/components/Treeview/Leaf.test.js +1 -15
  134. package/src/components/Treeview/Node.js +16 -9
  135. package/src/components/Treeview/Node.test.js +269 -200
  136. package/src/components/Treeview/Treeview.test.js +248 -248
  137. package/src/components/Treeview/index.js +6 -0
  138. package/src/components/Treeview/settings.js +10 -6
  139. package/src/hooks/useMultipleFieldEditState.test.js +0 -1
  140. package/src/hooks/useWindowSize.js +39 -0
  141. package/src/hooks/useWindowSize.test.js +68 -0
  142. package/src/sharedMessages.js +8 -0
  143. package/src/translations/en-US.json +2 -0
  144. package/src/translations/fr-CA.json +2 -0
  145. package/src/utils/index.js +0 -4
  146. package/src/utils/testUtils.js +0 -10
  147. package/src/utils/testUtils.test.js +0 -68
  148. package/src/utils/toastHelper.js +8 -0
  149. package/src/utils/toastHelper.test.js +41 -0
  150. package/dist/components/Button.js +0 -70
  151. package/dist/components/CategoryList.js +0 -197
  152. package/dist/components/Checkbox.js +0 -103
  153. package/dist/components/Icon.js +0 -69
  154. package/dist/components/IconButton.js +0 -80
  155. package/dist/components/Input.js +0 -101
  156. package/dist/components/List/DataCell.js +0 -129
  157. package/dist/components/List/HeadCell.js +0 -125
  158. package/dist/components/List/HeadRow.js +0 -73
  159. package/dist/components/List/List.js +0 -274
  160. package/dist/components/List/Row.js +0 -109
  161. package/dist/components/List/enhanceColumnDefs.js +0 -111
  162. package/dist/components/List/index.js +0 -59
  163. package/dist/components/Modal/Dialog.js +0 -75
  164. package/dist/components/Modal/Wrapper.js +0 -69
  165. package/dist/components/MultiSelector.js +0 -187
  166. package/dist/components/Navigation/Bar.js +0 -293
  167. package/dist/components/Navigation/Tab.js +0 -182
  168. package/dist/components/Placeholder.js +0 -114
  169. package/dist/components/Scope/Selector.js +0 -123
  170. package/dist/components/Selector.js +0 -185
  171. package/dist/components/Switch.js +0 -128
  172. package/dist/components/Toolbar.js +0 -227
  173. package/dist/components/Tooltip.js +0 -66
  174. package/dist/getTheme.js +0 -158
  175. package/dist/getThemeOverrides.js +0 -93
  176. package/dist/hocs/withAuthentication.js +0 -72
  177. package/dist/utils/styledPropFuncs.js +0 -88
  178. package/src/components/Button.js +0 -90
  179. package/src/components/Button.test.js +0 -49
  180. package/src/components/CategoryList.js +0 -140
  181. package/src/components/CategoryList.test.js +0 -667
  182. package/src/components/Checkbox.js +0 -63
  183. package/src/components/Checkbox.test.js +0 -122
  184. package/src/components/Icon.js +0 -18
  185. package/src/components/IconButton.js +0 -30
  186. package/src/components/IconButton.test.js +0 -61
  187. package/src/components/Input.js +0 -35
  188. package/src/components/Input.test.js +0 -34
  189. package/src/components/List/DataCell.js +0 -77
  190. package/src/components/List/DataCell.test.js +0 -357
  191. package/src/components/List/HeadCell.js +0 -105
  192. package/src/components/List/HeadCell.test.js +0 -331
  193. package/src/components/List/HeadRow.js +0 -21
  194. package/src/components/List/HeadRow.test.js +0 -27
  195. package/src/components/List/List.js +0 -162
  196. package/src/components/List/List.test.js +0 -705
  197. package/src/components/List/Row.js +0 -72
  198. package/src/components/List/Row.test.js +0 -194
  199. package/src/components/List/enhanceColumnDefs.js +0 -54
  200. package/src/components/List/enhanceColumnDefs.test.js +0 -179
  201. package/src/components/List/index.js +0 -6
  202. package/src/components/Modal/Background.js +0 -10
  203. package/src/components/Modal/Dialog.js +0 -27
  204. package/src/components/Modal/Dialog.test.js +0 -20
  205. package/src/components/Modal/Modal.test.js +0 -52
  206. package/src/components/Modal/Wrapper.js +0 -32
  207. package/src/components/Modal/Wrapper.test.js +0 -55
  208. package/src/components/Modal/index.js +0 -22
  209. package/src/components/MultiSelector.js +0 -104
  210. package/src/components/MultiSelector.test.js +0 -348
  211. package/src/components/Navigation/Bar.js +0 -212
  212. package/src/components/Navigation/Bar.test.js +0 -552
  213. package/src/components/Navigation/Tab.js +0 -156
  214. package/src/components/Navigation/Tab.test.js +0 -404
  215. package/src/components/Placeholder.js +0 -61
  216. package/src/components/Placeholder.test.js +0 -106
  217. package/src/components/Scope/Selector.js +0 -70
  218. package/src/components/Scope/Selector.test.js +0 -138
  219. package/src/components/Selector.js +0 -191
  220. package/src/components/Selector.test.js +0 -157
  221. package/src/components/Switch.js +0 -112
  222. package/src/components/Switch.test.js +0 -130
  223. package/src/components/Text.test.js +0 -132
  224. package/src/components/Toolbar.js +0 -178
  225. package/src/components/Toolbar.test.js +0 -478
  226. package/src/components/Tooltip.js +0 -51
  227. package/src/components/Tooltip.test.js +0 -21
  228. package/src/getTheme.js +0 -103
  229. package/src/getTheme.test.js +0 -92
  230. package/src/getThemeOverrides.js +0 -27
  231. package/src/hocs/withAuthentication.js +0 -18
  232. package/src/hocs/withAuthentication.test.js +0 -120
  233. package/src/utils/styledPropFuncs.js +0 -20
  234. package/src/utils/styledPropFuncs.test.js +0 -166
@@ -1,404 +0,0 @@
1
- import React from "react";
2
- import ReactDOM from "react-dom";
3
- import { act } from "react-dom/test-utils";
4
- import { Provider } from "react-redux";
5
- import { Router, MemoryRouter } from "react-router-dom";
6
- import { IntlProvider } from "react-intl";
7
- import sinon from "sinon";
8
- import { createMemoryHistory } from "history";
9
- import { Ignore } from "unexpected-reaction";
10
- import { getClassSelector, getStyledClassSelector } from "../../utils/testUtils";
11
- import Tab, { PageTab, ModuleTab, TabLink, ModuleIcon, TabText, CloseIcon } from "./Tab";
12
- import { Placeholder } from "../Text";
13
-
14
- describe("Tab", () => {
15
- let history, close;
16
- beforeEach(() => {
17
- history = createMemoryHistory();
18
- close = sinon.spy().named("close");
19
- });
20
-
21
- it("renders a module tab with icon and label", () =>
22
- expect(
23
- <Provider
24
- store={{
25
- subscribe: () => {},
26
- dispatch: () => {},
27
- getState: () => ({}),
28
- }}
29
- >
30
- <Router history={history}>
31
- <IntlProvider locale="en">
32
- <Tab module icon="test" label="A module" href="/Foo/modu" />
33
- </IntlProvider>
34
- </Router>
35
- </Provider>,
36
- "when mounted",
37
- "with event",
38
- {
39
- type: "click",
40
- target: getClassSelector(
41
- <MemoryRouter>
42
- <TabLink to="/" />
43
- </MemoryRouter>,
44
- ),
45
- },
46
- "to satisfy",
47
- <Router history={history}>
48
- <IntlProvider locale="en">
49
- <ModuleTab>
50
- <TabLink to="/Foo/modu">
51
- <ModuleIcon id="test" />
52
- <TabText>A module</TabText>
53
- </TabLink>
54
- </ModuleTab>
55
- </IntlProvider>
56
- </Router>,
57
- ));
58
-
59
- it("renders an active module tab", () =>
60
- expect(
61
- <Provider
62
- store={{
63
- subscribe: () => {},
64
- dispatch: () => {},
65
- getState: () => ({}),
66
- }}
67
- >
68
- <Router history={history}>
69
- <IntlProvider locale="en">
70
- <Tab module active icon="test" label={{ id: "test.module", defaultMessage: "A module" }} href="/Foo/modu" />
71
- </IntlProvider>
72
- </Router>
73
- </Provider>,
74
- "when mounted",
75
- "to satisfy",
76
- <Router history={history}>
77
- <IntlProvider locale="en">
78
- <ModuleTab active>
79
- <TabLink to="/Foo/modu">
80
- <ModuleIcon id="test" />
81
- <TabText>A module</TabText>
82
- </TabLink>
83
- </ModuleTab>
84
- </IntlProvider>
85
- </Router>,
86
- ));
87
-
88
- it("renders an active module tab with a very long label", () => {
89
- // Needs to be fully rendered to work
90
- const root = document.createElement("div");
91
- document.body.append(root);
92
- const history = createMemoryHistory();
93
- sinon.spy(history, "push");
94
- ReactDOM.render(
95
- <Provider
96
- store={{
97
- subscribe: () => {},
98
- dispatch: () => {},
99
- getState: () => ({}),
100
- }}
101
- >
102
- <Router history={history}>
103
- <IntlProvider locale="en">
104
- <Tab
105
- module
106
- mustTruncate={true}
107
- active
108
- icon="test"
109
- label={{ id: "test.module", defaultMessage: "A very long label" }}
110
- href="/Foo/modu"
111
- />
112
- </IntlProvider>
113
- </Router>
114
- </Provider>,
115
- root,
116
- );
117
-
118
- const tab = root.querySelector("*"); // Get the first child
119
- const tabLinkElement = tab.querySelector(getStyledClassSelector(TabLink));
120
- const tabTextElement = tabLinkElement.querySelector(getStyledClassSelector(TabText));
121
-
122
- act(() => {
123
- // XXX: This is a nasty hack of jsdom, and may break unexpectedly
124
- Object.defineProperty(tabTextElement, "offsetWidth", {
125
- value: 10,
126
- writable: true,
127
- });
128
- Object.defineProperty(tabTextElement, "scrollWidth", {
129
- value: 20,
130
- writable: true,
131
- });
132
- window.dispatchEvent(new Event("resize"));
133
- });
134
-
135
- try {
136
- act(() => {});
137
- expect(
138
- tab,
139
- "to satisfy",
140
- <Router history={history}>
141
- <IntlProvider locale="en">
142
- <ModuleTab active>
143
- <TabLink to="/Foo/modu" mustTruncate={true}>
144
- <ModuleIcon id="test" />
145
- <TabText title="A very long label">A very long label</TabText>
146
- </TabLink>
147
- </ModuleTab>
148
- </IntlProvider>
149
- </Router>,
150
- );
151
- } finally {
152
- ReactDOM.unmountComponentAtNode(root);
153
- document.body.removeChild(root);
154
- }
155
- });
156
-
157
- it("renders with a message error", () =>
158
- expect(
159
- <Provider
160
- store={{
161
- subscribe: () => {},
162
- dispatch: () => {},
163
- getState: () => ({}),
164
- }}
165
- >
166
- <Router history={history}>
167
- <IntlProvider locale="en">
168
- <Tab
169
- module
170
- active
171
- icon="test"
172
- label={{ id: "test.module", defaultMessage: "A module {missingValue}" }}
173
- href="/Foo/modu"
174
- />
175
- </IntlProvider>
176
- </Router>
177
- </Provider>,
178
- "when mounted",
179
- "to satisfy",
180
- <Router history={history}>
181
- <IntlProvider locale="en">
182
- <ModuleTab active>
183
- <TabLink to="/Foo/modu">
184
- <ModuleIcon id="test" />
185
- <TabText>
186
- <Placeholder />
187
- </TabText>
188
- </TabLink>
189
- </ModuleTab>
190
- </IntlProvider>
191
- </Router>,
192
- ));
193
-
194
- it("close a tab when scope is not supported", () =>
195
- expect(
196
- <Provider
197
- store={{
198
- subscribe: () => {},
199
- dispatch: () => {},
200
- getState: () => ({}),
201
- }}
202
- >
203
- <Router history={history}>
204
- <IntlProvider locale="en">
205
- <Tab
206
- label={{ id: "test.page", defaultMessage: "A page" }}
207
- href="/Foo/modu"
208
- close={close}
209
- scopeNotSupported
210
- />
211
- </IntlProvider>
212
- </Router>
213
- </Provider>,
214
- "when mounted",
215
- "to satisfy",
216
- <Router history={history}>
217
- <IntlProvider locale="en">
218
- <PageTab hide>
219
- <TabLink to="/Foo/modu">
220
- <TabText>A page</TabText>
221
- <CloseIcon onClick={close} />
222
- </TabLink>
223
- </PageTab>
224
- </IntlProvider>
225
- </Router>,
226
- ).then(() => expect(close, "was called")));
227
-
228
- it("renders a tab outside the current scope", () =>
229
- expect(
230
- <Provider
231
- store={{
232
- subscribe: () => {},
233
- dispatch: () => {},
234
- getState: () => ({}),
235
- }}
236
- >
237
- <Router history={history}>
238
- <IntlProvider locale="en">
239
- <Tab
240
- module
241
- outsideScope
242
- icon="test"
243
- label={{ id: "test.module", defaultMessage: "A module" }}
244
- href="/Foo/modu"
245
- />
246
- </IntlProvider>
247
- </Router>
248
- </Provider>,
249
- "when mounted",
250
- "with event",
251
- {
252
- type: "click",
253
- target: getClassSelector(
254
- <MemoryRouter>
255
- <TabLink to="/" />
256
- </MemoryRouter>,
257
- ),
258
- },
259
- "to satisfy",
260
- <Router history={history}>
261
- <IntlProvider locale="en">
262
- <ModuleTab outsideScope>
263
- <TabLink outsideScope to="/Foo/modu">
264
- <ModuleIcon id="test" />
265
- <TabText>A module</TabText>
266
- </TabLink>
267
- </ModuleTab>
268
- </IntlProvider>
269
- </Router>,
270
- ));
271
-
272
- it("renders a page tab with label and close button", () =>
273
- expect(
274
- <Provider
275
- store={{
276
- subscribe: () => {},
277
- dispatch: () => {},
278
- getState: () => ({}),
279
- }}
280
- >
281
- <Router history={history}>
282
- <IntlProvider locale="en">
283
- <Tab label={{ id: "test.page", defaultMessage: "A page" }} href="/Foo/modu/page" close={close} />
284
- </IntlProvider>
285
- </Router>
286
- </Provider>,
287
- "when mounted",
288
- "to satisfy",
289
- <Router history={history}>
290
- <IntlProvider locale="en">
291
- <PageTab>
292
- <TabLink to="/Foo/modu/page">
293
- <TabText>A page</TabText>
294
- <CloseIcon onClick={close} />
295
- </TabLink>
296
- </PageTab>
297
- </IntlProvider>
298
- </Router>,
299
- ));
300
-
301
- it("renders an active page tab", () =>
302
- expect(
303
- <Provider
304
- store={{
305
- subscribe: () => {},
306
- dispatch: () => {},
307
- getState: () => ({}),
308
- }}
309
- >
310
- <Router history={history}>
311
- <IntlProvider locale="en">
312
- <Tab active href="/Foo/modu/page" />
313
- </IntlProvider>
314
- </Router>
315
- </Provider>,
316
- "when mounted",
317
- "with event",
318
- {
319
- type: "click",
320
- target: getClassSelector(<CloseIcon />),
321
- },
322
- "to satisfy",
323
- <Router history={history}>
324
- <IntlProvider locale="en">
325
- <PageTab active>
326
- <TabLink to="/Foo/modu/page">
327
- <TabText>
328
- <Ignore />
329
- </TabText>
330
- <CloseIcon onClick={expect.it("to be a function")} />
331
- </TabLink>
332
- </PageTab>
333
- </IntlProvider>
334
- </Router>,
335
- ));
336
-
337
- it("curries close handler with tab and mapped href", () =>
338
- expect(
339
- <Provider
340
- store={{
341
- subscribe: () => {},
342
- dispatch: () => {},
343
- getState: () => ({}),
344
- }}
345
- >
346
- <Router history={history}>
347
- <IntlProvider locale="en">
348
- <Tab label="A page" href="/Foo/modu/page/sub" mappedFrom="/Foo/modu/page" close={close} />
349
- </IntlProvider>
350
- </Router>
351
- </Provider>,
352
- "when mounted",
353
- "with event",
354
- {
355
- type: "click",
356
- target: getClassSelector(<CloseIcon />),
357
- },
358
- ).then(() => expect(close, "was called")));
359
- });
360
-
361
- describe("TabText", () => {
362
- let history;
363
- beforeEach(() => {
364
- history = createMemoryHistory();
365
- });
366
-
367
- it("sets css for TabLink without attributes", () =>
368
- expect(
369
- <Provider
370
- store={{
371
- subscribe: () => {},
372
- dispatch: () => {},
373
- getState: () => ({}),
374
- }}
375
- >
376
- <Router history={history}>
377
- <TabLink to="/" />
378
- </Router>
379
- </Provider>,
380
- "when mounted",
381
- "to have style rules satisfying",
382
- expect.it("not to contain", "cursor: not-allowed;").and("not to contain", "max-width: 220px;"),
383
- ));
384
-
385
- it("sets css for TabLink with attributes", () =>
386
- expect(
387
- <Provider
388
- store={{
389
- subscribe: () => {},
390
- dispatch: () => {},
391
- getState: () => ({}),
392
- }}
393
- >
394
- <Router history={history}>
395
- <TabLink to="/" outsideScope={true} mustTruncate={true} />
396
- </Router>
397
- </Provider>,
398
- "when mounted",
399
- "to have style rules satisfying",
400
- "to contain",
401
- "cursor: not-allowed;",
402
- "max-width: 220px;",
403
- ));
404
- });
@@ -1,61 +0,0 @@
1
- import React from "react";
2
- import pt from "prop-types";
3
- import styled, { css, keyframes } from "styled-components";
4
- import Text, { ptLabel } from "./Text";
5
- import Icon from "./Icon";
6
- import { ifFlag } from "../utils";
7
-
8
- const rotate = keyframes`
9
- to { transform: rotate(1turn); }
10
- `;
11
-
12
- export const PlaceholderBox = styled.div`
13
- display: flex;
14
- flex-direction: column;
15
- align-items: center;
16
- margin: auto;
17
- ${ifFlag("warn", "color: #ed2e0b; width: 33%; max-width:540px; text-align:center;", "color: #ababab;")}
18
- `;
19
-
20
- export const PlaceholderIcon = styled(Icon)`
21
- font-size: 140px;
22
-
23
- ${ifFlag(
24
- "animate",
25
- css`
26
- animation: ${rotate} 4s linear infinite;
27
- `,
28
- )};
29
- `;
30
-
31
- export const PlaceholderTitle = styled.div`
32
- margin-top: 5px;
33
- font-size: 2em;
34
- `;
35
- export const PlaceholderSubtitle = styled.div`
36
- font-size: 1.3em;
37
- `;
38
-
39
- const Placeholder = ({ icon, title, subtitle, animate, warn, ...props }) => (
40
- <PlaceholderBox warn={warn} {...props}>
41
- {icon ? <PlaceholderIcon id={icon} animate={animate} /> : null}
42
- {title ? (
43
- <PlaceholderTitle>
44
- <Text message={title} />
45
- </PlaceholderTitle>
46
- ) : null}
47
- {subtitle ? (
48
- <PlaceholderSubtitle>
49
- <Text message={subtitle} />
50
- </PlaceholderSubtitle>
51
- ) : null}
52
- </PlaceholderBox>
53
- );
54
- Placeholder.propTypes = {
55
- icon: pt.string,
56
- title: ptLabel,
57
- subtitle: ptLabel,
58
- animate: pt.bool,
59
- warn: pt.bool,
60
- };
61
- export default Placeholder;
@@ -1,106 +0,0 @@
1
- import React from "react";
2
- import { Provider } from "react-redux";
3
- import { IntlProvider } from "react-intl";
4
- import { spyOnConsole } from "../utils/testUtils";
5
- import Placeholder, { PlaceholderBox, PlaceholderIcon, PlaceholderTitle, PlaceholderSubtitle } from "./Placeholder";
6
-
7
- describe("Placeholder", () => {
8
- spyOnConsole();
9
- it("renders a placeholder with icon, title, and subtitle", () =>
10
- expect(
11
- <Provider
12
- store={{
13
- subscribe: () => {},
14
- dispatch: () => {},
15
- getState: () => ({}),
16
- }}
17
- >
18
- <Placeholder icon="testIcon" title="A title" subtitle="A subtitle" otherProp={true} />
19
- </Provider>,
20
- "when mounted",
21
- "to satisfy",
22
- <PlaceholderBox otherProp={true}>
23
- <PlaceholderIcon id="testIcon" />
24
- <PlaceholderTitle>A title</PlaceholderTitle>
25
- <PlaceholderSubtitle>A subtitle</PlaceholderSubtitle>
26
- </PlaceholderBox>,
27
- ).then(() => expect(console.error, "was not called")));
28
-
29
- it("renders an empty placeholder", () =>
30
- expect(<Placeholder />, "when mounted", "to satisfy", <PlaceholderBox />).then(() =>
31
- expect(console.error, "was not called"),
32
- ));
33
-
34
- it("renders an animated icon", () =>
35
- expect(
36
- <Placeholder icon="testIcon" animate />,
37
- "when mounted",
38
- "to satisfy",
39
- <PlaceholderBox>
40
- <PlaceholderIcon id="testIcon" animate />
41
- </PlaceholderBox>,
42
- ).then(() => expect(console.error, "was not called")));
43
-
44
- it("translates title and subtitle if given message descriptors", () =>
45
- expect(
46
- <Provider
47
- store={{
48
- subscribe: () => {},
49
- dispatch: () => {},
50
- getState: () => ({}),
51
- }}
52
- >
53
- <IntlProvider
54
- locale="en"
55
- messages={{
56
- "test.title": "The title",
57
- "test.subtitle": "The subtitle",
58
- }}
59
- >
60
- <Placeholder
61
- title={{ id: "test.title", defaultMessage: "A default title" }}
62
- subtitle={{
63
- id: "test.subtitle",
64
- defaultMessage: "A default subtitle",
65
- }}
66
- />
67
- </IntlProvider>
68
- </Provider>,
69
- "when mounted",
70
- "to satisfy",
71
- <PlaceholderBox>
72
- <PlaceholderTitle>The title</PlaceholderTitle>
73
- <PlaceholderSubtitle>The subtitle</PlaceholderSubtitle>
74
- </PlaceholderBox>,
75
- ).then(() => expect(console.error, "was not called")));
76
-
77
- it("renders a warning placeholder", () =>
78
- expect(
79
- <Placeholder icon="testIcon" warn />,
80
- "when mounted",
81
- "to satisfy",
82
- <PlaceholderBox warn>
83
- <PlaceholderIcon id="testIcon" />
84
- </PlaceholderBox>,
85
- ).then(() => expect(console.error, "was not called")));
86
- });
87
-
88
- describe("PlaceholderIcon", () => {
89
- it("renders with animation", () =>
90
- expect(
91
- <PlaceholderIcon id="spinner" animate />,
92
- "when mounted",
93
- "to have style rules satisfying",
94
- "to contain",
95
- "animation: ",
96
- ));
97
-
98
- it("renders without animation", () =>
99
- expect(
100
- <PlaceholderIcon id="spinner" />,
101
- "when mounted",
102
- "to have style rules satisfying",
103
- "not to contain",
104
- "animation: ",
105
- ));
106
- });
@@ -1,70 +0,0 @@
1
- import React from "react";
2
- import styled from "styled-components";
3
- import { getThemeProp } from "../../utils";
4
- import Input from "../Input";
5
- import Treeview from "../Treeview";
6
- import ScopeNode from "./ScopeNode";
7
- import Sidepanel from "../Sidepanel";
8
- import withClickOutside from "../../hocs/withClickOutside";
9
- import { useIntl } from "react-intl";
10
- import sharedMessages from "./../../sharedMessages";
11
-
12
- export const Wrapper = withClickOutside(styled.div`
13
- height: 100%;
14
- width: 100%;
15
- user-select: none;
16
- display: flex;
17
- flex-direction: column;
18
- `);
19
-
20
- export const InputBox = styled.div`
21
- border-bottom: 1px solid #666;
22
- `;
23
-
24
- export const SearchInput = styled(Input)`
25
- background-color: transparent;
26
- border-color: ${getThemeProp(["colors", "border"], "#999999")};
27
- color: ${getThemeProp(["colors", "textMedium"], "#999999")};
28
- width: calc(100% - 40px);
29
- margin: 20px;
30
- font-size: 14px;
31
- `;
32
-
33
- export const SelectorPanel = styled(Sidepanel)`
34
- top: 90px;
35
- background-color: ${getThemeProp(["colors", "bgDark"], "#333333")};
36
- color: #fff;
37
- z-index: 1000;
38
- `;
39
-
40
- export const Selector = ({ name, show, reset, getScope, currentScope, defaultNodeState, filter, updateFilter }) => {
41
- const { formatMessage } = useIntl();
42
- return (
43
- <SelectorPanel in={show} width="27vw" timeout={300}>
44
- <Wrapper onClickOutside={reset}>
45
- <InputBox>
46
- <SearchInput
47
- placeholder={formatMessage(sharedMessages.scopeFilterPlaceholder)}
48
- value={filter}
49
- onChange={updateFilter}
50
- />
51
- </InputBox>
52
- <Treeview
53
- {...{
54
- name,
55
- Content: ScopeNode,
56
- rootId: "Global",
57
- getNode: getScope,
58
- selectedNodeId: (currentScope && currentScope.id) || null,
59
- openAll: !!filter,
60
- closeSelector: reset,
61
- dark: true,
62
- defaultNodeState,
63
- }}
64
- />
65
- </Wrapper>
66
- </SelectorPanel>
67
- );
68
- };
69
-
70
- export default Selector;