orc-shared 5.10.2-dev.4 → 5.99.0-dev.2

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 (226) 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/{IconButton.js → Form/Inputs/MultiSelector.js} +33 -31
  16. package/dist/components/Form/Inputs/index.js +1 -1
  17. package/dist/components/InternetExplorerWarningMessage.js +15 -15
  18. package/dist/components/LoadingIcon.js +38 -17
  19. package/dist/components/MaterialUI/DataDisplay/Modal.js +3 -3
  20. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/Placeholder.js +6 -6
  21. package/dist/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.js +4 -4
  22. package/dist/components/MaterialUI/DataDisplay/SelectionList.js +1 -1
  23. package/dist/components/MaterialUI/DataDisplay/Table.js +2 -1
  24. package/dist/components/MaterialUI/DataDisplay/TableProps.js +3 -1
  25. package/dist/components/MaterialUI/DataDisplay/TransferList.js +1 -1
  26. package/dist/components/MaterialUI/Inputs/CheckboxGroup.js +1 -1
  27. package/dist/components/MaterialUI/Inputs/DatePicker.js +1 -1
  28. package/dist/components/MaterialUI/Inputs/InputBase.js +20 -188
  29. package/dist/components/MaterialUI/Inputs/PredefinedElements/SearchControl.js +1 -1
  30. package/dist/components/MaterialUI/Inputs/Select.js +10 -0
  31. package/dist/components/MaterialUI/Inputs/SelectProps.js +3 -1
  32. package/dist/components/MaterialUI/Inputs/Switch.js +1 -1
  33. package/dist/components/MaterialUI/Navigation/DropDownMenu.js +2 -4
  34. package/dist/components/MaterialUI/ScopeSelector/ScopeSelector.js +1 -1
  35. package/dist/components/MaterialUI/ScopeSelector/TreeItem.js +27 -42
  36. package/dist/components/MaterialUI/Surfaces/Paper.js +1 -1
  37. package/dist/components/MaterialUI/Surfaces/SectionExpansionPanel.js +3 -2
  38. package/dist/components/MaterialUI/muiThemes.js +2 -0
  39. package/dist/components/Provision.js +30 -13
  40. package/dist/components/Routing/SegmentPage.js +115 -56
  41. package/dist/components/Scope/ScopeNode.js +62 -57
  42. package/dist/components/Sidepanel.js +59 -23
  43. package/dist/components/Spritesheet.js +35 -17
  44. package/dist/components/Text.js +1 -60
  45. package/dist/components/ToastList.js +95 -64
  46. package/dist/components/Treeview/Branch.js +82 -20
  47. package/dist/components/Treeview/Label.js +108 -31
  48. package/dist/components/Treeview/Leaf.js +56 -12
  49. package/dist/components/Treeview/Node.js +22 -9
  50. package/dist/components/Treeview/index.js +7 -1
  51. package/dist/components/Treeview/settings.js +17 -6
  52. package/dist/utils/index.js +0 -4
  53. package/dist/utils/testUtils.js +1 -12
  54. package/dist/{components/Modal/Background.js → utils/toastHelper.js} +11 -14
  55. package/package.json +2 -2
  56. package/src/components/AppFrame/About.js +13 -13
  57. package/src/components/AppFrame/Anchor.js +7 -7
  58. package/src/components/AppFrame/AppFrame.js +3 -3
  59. package/src/components/AppFrame/Help.js +4 -4
  60. package/src/components/AppFrame/MenuItem.js +15 -23
  61. package/src/components/AppFrame/Preferences.js +14 -14
  62. package/src/components/AppFrame/Sidebar.js +6 -6
  63. package/src/components/AppFrame/Topbar.js +6 -6
  64. package/src/components/ApplicationModuleLoader.js +2 -2
  65. package/src/components/ApplicationModuleLoader.test.js +15 -28
  66. package/src/components/Authenticate.js +21 -23
  67. package/src/components/Authenticate.test.js +19 -27
  68. package/src/components/DropMenu/Menu.js +9 -9
  69. package/src/components/ErrorPlaceholder.js +4 -21
  70. package/src/components/ErrorPlaceholder.test.js +7 -14
  71. package/src/components/Form/Field.js +4 -4
  72. package/src/components/Form/InputField.test.js +2 -1
  73. package/src/components/Form/Inputs/Button.js +2 -2
  74. package/src/components/Form/Inputs/MultiSelector.js +23 -0
  75. package/src/components/Form/Inputs/MultiSelector.test.js +112 -0
  76. package/src/components/Form/Inputs/index.js +1 -1
  77. package/src/components/InternetExplorerWarningMessage.js +15 -15
  78. package/src/components/Loader.test.js +50 -59
  79. package/src/components/LoadingIcon.js +27 -14
  80. package/src/components/LoadingIcon.test.js +11 -15
  81. package/src/components/MaterialUI/DataDisplay/Modal.js +3 -3
  82. package/src/components/MaterialUI/DataDisplay/PredefinedElements/Placeholder.js +6 -6
  83. package/src/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.js +3 -3
  84. package/src/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.test.js +0 -74
  85. package/src/components/MaterialUI/DataDisplay/PredefinedElements/Translations.test.js +6 -18
  86. package/src/components/MaterialUI/DataDisplay/SelectionList.js +1 -1
  87. package/src/components/MaterialUI/DataDisplay/Table.js +6 -1
  88. package/src/components/MaterialUI/DataDisplay/Table.test.js +21 -1
  89. package/src/components/MaterialUI/DataDisplay/TableProps.js +2 -0
  90. package/src/components/MaterialUI/DataDisplay/TableProps.test.js +20 -2
  91. package/src/components/MaterialUI/DataDisplay/TransferList.js +1 -1
  92. package/src/components/MaterialUI/Inputs/CheckboxGroup.js +1 -1
  93. package/src/components/MaterialUI/Inputs/DatePicker.js +1 -1
  94. package/src/components/MaterialUI/Inputs/InputBase.js +31 -214
  95. package/src/components/MaterialUI/Inputs/InputBase.test.js +1 -460
  96. package/src/components/MaterialUI/Inputs/PredefinedElements/SearchControl.js +1 -1
  97. package/src/components/MaterialUI/Inputs/PredefinedElements/SearchControl.test.js +1 -1
  98. package/src/components/MaterialUI/Inputs/Select.js +7 -0
  99. package/src/components/MaterialUI/Inputs/Select.test.js +45 -0
  100. package/src/components/MaterialUI/Inputs/SelectProps.js +2 -0
  101. package/src/components/MaterialUI/Inputs/SelectProps.test.js +2 -0
  102. package/src/components/MaterialUI/Inputs/Switch.js +1 -1
  103. package/src/components/MaterialUI/Navigation/DropDownMenu.js +2 -2
  104. package/src/components/MaterialUI/Navigation/DropDownMenu.test.js +5 -6
  105. package/src/components/MaterialUI/ScopeSelector/ScopeSelector.js +1 -2
  106. package/src/components/MaterialUI/ScopeSelector/TreeItem.js +8 -31
  107. package/src/components/MaterialUI/Surfaces/Paper.js +1 -1
  108. package/src/components/MaterialUI/Surfaces/SectionExpansionPanel.js +2 -1
  109. package/src/components/MaterialUI/muiThemes.js +3 -0
  110. package/src/components/Navigation/Navigation.test.js +0 -5
  111. package/src/components/Navigation/useNavigationState.test.js +79 -222
  112. package/src/components/Provision.js +36 -42
  113. package/src/components/Provision.test.js +10 -26
  114. package/src/components/Routing/SegmentPage.js +68 -52
  115. package/src/components/Routing/SegmentPage.test.js +4 -12
  116. package/src/components/Scope/ScopeNode.js +44 -55
  117. package/src/components/Scope/ScopeNode.test.js +84 -163
  118. package/src/components/ScopeExtendedConfigurationLoader.test.js +1 -4
  119. package/src/components/Sidepanel.js +38 -32
  120. package/src/components/Sidepanel.test.js +54 -27
  121. package/src/components/Spritesheet.js +23 -21
  122. package/src/components/Spritesheet.test.js +10 -10
  123. package/src/components/Text.js +0 -49
  124. package/src/components/ToastList.js +79 -90
  125. package/src/components/ToastList.test.js +29 -103
  126. package/src/components/Treeview/Branch.js +65 -47
  127. package/src/components/Treeview/Branch.test.js +2 -43
  128. package/src/components/Treeview/Label.js +68 -54
  129. package/src/components/Treeview/Label.test.js +55 -63
  130. package/src/components/Treeview/Leaf.js +41 -22
  131. package/src/components/Treeview/Leaf.test.js +1 -15
  132. package/src/components/Treeview/Node.js +16 -9
  133. package/src/components/Treeview/Node.test.js +269 -200
  134. package/src/components/Treeview/Treeview.test.js +248 -248
  135. package/src/components/Treeview/index.js +6 -0
  136. package/src/components/Treeview/settings.js +10 -6
  137. package/src/utils/index.js +0 -4
  138. package/src/utils/testUtils.js +0 -10
  139. package/src/utils/testUtils.test.js +0 -68
  140. package/src/utils/toastHelper.js +8 -0
  141. package/src/utils/toastHelper.test.js +41 -0
  142. package/dist/components/Button.js +0 -70
  143. package/dist/components/CategoryList.js +0 -197
  144. package/dist/components/Checkbox.js +0 -103
  145. package/dist/components/Icon.js +0 -69
  146. package/dist/components/Input.js +0 -101
  147. package/dist/components/List/DataCell.js +0 -129
  148. package/dist/components/List/HeadCell.js +0 -125
  149. package/dist/components/List/HeadRow.js +0 -73
  150. package/dist/components/List/List.js +0 -274
  151. package/dist/components/List/Row.js +0 -109
  152. package/dist/components/List/enhanceColumnDefs.js +0 -111
  153. package/dist/components/List/index.js +0 -59
  154. package/dist/components/Modal/Dialog.js +0 -75
  155. package/dist/components/Modal/Wrapper.js +0 -69
  156. package/dist/components/Modal/index.js +0 -86
  157. package/dist/components/MultiSelector.js +0 -187
  158. package/dist/components/Navigation/Bar.js +0 -293
  159. package/dist/components/Navigation/Tab.js +0 -182
  160. package/dist/components/Placeholder.js +0 -114
  161. package/dist/components/Scope/Selector.js +0 -123
  162. package/dist/components/Selector.js +0 -185
  163. package/dist/components/Switch.js +0 -128
  164. package/dist/components/Toolbar.js +0 -227
  165. package/dist/components/Tooltip.js +0 -66
  166. package/dist/getTheme.js +0 -158
  167. package/dist/getThemeOverrides.js +0 -93
  168. package/dist/hocs/withAuthentication.js +0 -72
  169. package/dist/utils/styledPropFuncs.js +0 -88
  170. package/src/components/Button.js +0 -90
  171. package/src/components/Button.test.js +0 -49
  172. package/src/components/CategoryList.js +0 -140
  173. package/src/components/CategoryList.test.js +0 -667
  174. package/src/components/Checkbox.js +0 -63
  175. package/src/components/Checkbox.test.js +0 -122
  176. package/src/components/Icon.js +0 -18
  177. package/src/components/IconButton.js +0 -30
  178. package/src/components/IconButton.test.js +0 -61
  179. package/src/components/Input.js +0 -35
  180. package/src/components/Input.test.js +0 -34
  181. package/src/components/List/DataCell.js +0 -77
  182. package/src/components/List/DataCell.test.js +0 -357
  183. package/src/components/List/HeadCell.js +0 -105
  184. package/src/components/List/HeadCell.test.js +0 -331
  185. package/src/components/List/HeadRow.js +0 -21
  186. package/src/components/List/HeadRow.test.js +0 -27
  187. package/src/components/List/List.js +0 -162
  188. package/src/components/List/List.test.js +0 -705
  189. package/src/components/List/Row.js +0 -72
  190. package/src/components/List/Row.test.js +0 -194
  191. package/src/components/List/enhanceColumnDefs.js +0 -54
  192. package/src/components/List/enhanceColumnDefs.test.js +0 -179
  193. package/src/components/List/index.js +0 -6
  194. package/src/components/Modal/Background.js +0 -10
  195. package/src/components/Modal/Dialog.js +0 -27
  196. package/src/components/Modal/Dialog.test.js +0 -20
  197. package/src/components/Modal/Modal.test.js +0 -52
  198. package/src/components/Modal/Wrapper.js +0 -32
  199. package/src/components/Modal/Wrapper.test.js +0 -55
  200. package/src/components/Modal/index.js +0 -22
  201. package/src/components/MultiSelector.js +0 -104
  202. package/src/components/MultiSelector.test.js +0 -348
  203. package/src/components/Navigation/Bar.js +0 -212
  204. package/src/components/Navigation/Bar.test.js +0 -552
  205. package/src/components/Navigation/Tab.js +0 -156
  206. package/src/components/Navigation/Tab.test.js +0 -404
  207. package/src/components/Placeholder.js +0 -61
  208. package/src/components/Placeholder.test.js +0 -106
  209. package/src/components/Scope/Selector.js +0 -70
  210. package/src/components/Scope/Selector.test.js +0 -138
  211. package/src/components/Selector.js +0 -191
  212. package/src/components/Selector.test.js +0 -157
  213. package/src/components/Switch.js +0 -112
  214. package/src/components/Switch.test.js +0 -130
  215. package/src/components/Text.test.js +0 -132
  216. package/src/components/Toolbar.js +0 -178
  217. package/src/components/Toolbar.test.js +0 -478
  218. package/src/components/Tooltip.js +0 -51
  219. package/src/components/Tooltip.test.js +0 -21
  220. package/src/getTheme.js +0 -103
  221. package/src/getTheme.test.js +0 -92
  222. package/src/getThemeOverrides.js +0 -27
  223. package/src/hocs/withAuthentication.js +0 -18
  224. package/src/hocs/withAuthentication.test.js +0 -120
  225. package/src/utils/styledPropFuncs.js +0 -20
  226. package/src/utils/styledPropFuncs.test.js +0 -166
@@ -1,478 +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 IconButton from "./IconButton";
6
- import RadioProps from "./MaterialUI/Inputs/RadioProps";
7
- import {
8
- Bar,
9
- ToolGroup,
10
- ToolbarButton,
11
- ToolbarInput,
12
- Separator,
13
- Spacer,
14
- ToolbarLabel,
15
- ToolbarRadio,
16
- ToolbarRadioWrapper,
17
- toolComponents,
18
- Toolbar,
19
- } from "./Toolbar";
20
-
21
- const {
22
- input: ToolInput,
23
- button: ToolButton,
24
- group: Group,
25
- spacer: ToolSpacer,
26
- separator: ToolSeparator,
27
- label: ToolLabel,
28
- radio: ToolRadio,
29
- } = toolComponents;
30
-
31
- describe("Toolbar", () => {
32
- spyOnConsole();
33
- let toolList;
34
- beforeEach(() => {
35
- toolList = [
36
- {
37
- type: "input",
38
- subType: "search",
39
- key: 0,
40
- onChange: () => {},
41
- value: "search",
42
- },
43
- {
44
- type: "button",
45
- key: 1,
46
- label: { icon: "funnel" },
47
- onClick: () => {},
48
- },
49
- { type: "spacer", key: 2 },
50
- {
51
- type: "group",
52
- key: 3,
53
- tools: [
54
- {
55
- type: "button",
56
- key: 0,
57
- label: { text: "Button" },
58
- onClick: () => {},
59
- },
60
- {
61
- type: "input",
62
- key: 1,
63
- onChange: e => {},
64
- placeholder: "Text",
65
- },
66
- {
67
- type: "button",
68
- key: 2,
69
- label: { text: "Button" },
70
- onClick: () => {},
71
- },
72
- ],
73
- },
74
- {
75
- type: "button",
76
- key: 4,
77
- label: { icon: "eye", text: "Button" },
78
- onClick: () => {},
79
- primary: true,
80
- },
81
- { type: "separator", key: 5 },
82
- {
83
- type: "label",
84
- key: 6,
85
- label: { id: "toolbar.label", defaultMessage: "Label message" },
86
- },
87
- {
88
- type: "button",
89
- key: 7,
90
- label: { text: { id: "toolbar.button", defaultMessage: "Button" } },
91
- onClick: () => {},
92
- },
93
- {
94
- type: "label",
95
- key: 8,
96
- label: "Label message",
97
- },
98
- {
99
- type: "radio",
100
- key: 9,
101
- name: "aRadioName",
102
- label: "aRadioLabel",
103
- value: "option1",
104
- defaultVal: "option1",
105
- update: () => {},
106
- radios: [
107
- { label: "Option 1", value: "option1" },
108
- { label: "Option 2", value: "option2" },
109
- { label: "Option 3", value: "option3" },
110
- ],
111
- error: false,
112
- row: true,
113
- },
114
- ];
115
- });
116
-
117
- it("renders a toolbar", () =>
118
- expect(
119
- <IntlProvider locale="en">
120
- <Toolbar tools={[]} />
121
- </IntlProvider>,
122
- "when mounted",
123
- "to satisfy",
124
- <Bar />,
125
- ).then(() => expect(console.error, "was not called")));
126
-
127
- it("renders tools according to its configuration", () =>
128
- expect(
129
- <Provider
130
- store={{
131
- subscribe: () => {},
132
- dispatch: () => {},
133
- getState: () => ({}),
134
- }}
135
- >
136
- <IntlProvider locale="en">
137
- <Toolbar tools={toolList} />
138
- </IntlProvider>
139
- </Provider>,
140
- "when mounted",
141
- "to satisfy",
142
- <Provider
143
- store={{
144
- subscribe: () => {},
145
- dispatch: () => {},
146
- getState: () => ({}),
147
- }}
148
- >
149
- <IntlProvider locale="en">
150
- <Bar>
151
- <ToolInput type="search" onChange={toolList[0].onChange} value="search" />
152
- <ToolButton onClick={toolList[1].onClick} label={{ icon: "funnel" }} />
153
- <ToolSpacer />
154
- <Group
155
- tools={[
156
- {
157
- type: "button",
158
- key: 0,
159
- label: { text: "Button" },
160
- onClick: toolList[3].tools[0].onClick,
161
- },
162
- {
163
- type: "input",
164
- key: 1,
165
- onChange: toolList[3].tools[1].onChange,
166
- placeholder: "Text",
167
- },
168
- {
169
- type: "button",
170
- key: 2,
171
- label: { text: "Button" },
172
- onClick: toolList[3].tools[2].onClick,
173
- },
174
- ]}
175
- />
176
- <ToolButton onClick={toolList[4].onClick} label={{ icon: "eye", text: "Button" }} primary />
177
- <ToolSeparator />
178
- <ToolLabel label={{ id: "toolbar.label", defaultMessage: "Label message" }} />
179
- <ToolButton
180
- onClick={toolList[7].onClick}
181
- label={{
182
- text: { id: "toolbar.button", defaultMessage: "Button" },
183
- }}
184
- />
185
- <ToolLabel label="Label message" />
186
- <ToolRadio
187
- name="aRadioName"
188
- label="aRadioLabel"
189
- value="option1"
190
- defaultVal="option1"
191
- update={toolList[9].update}
192
- radios={[
193
- { label: "Option 1", value: "option1" },
194
- { label: "Option 2", value: "option2" },
195
- { label: "Option 3", value: "option3" },
196
- ]}
197
- error={false}
198
- row={true}
199
- />
200
- </Bar>
201
- </IntlProvider>
202
- </Provider>,
203
- ).then(() => {
204
- expect(console.error, "was not called");
205
- }));
206
- });
207
-
208
- describe("toolComponents.input", () => {
209
- it("renders a styled input", () =>
210
- expect(
211
- <IntlProvider locale="en">
212
- <ToolInput random={4} oddProp="Test" onChange={jest.fn()} things={{ stuff: "nonsense" }} />
213
- </IntlProvider>,
214
- "when mounted",
215
- "to satisfy",
216
- <IntlProvider locale="en">
217
- <ToolbarInput random={4} oddProp="Test" onChange={jest.fn()} things={{ stuff: "nonsense" }} />
218
- </IntlProvider>,
219
- ));
220
- });
221
-
222
- describe("toolComponents.button", () => {
223
- it("renders a styled empty button", () =>
224
- expect(
225
- <Provider
226
- store={{
227
- subscribe: () => {},
228
- dispatch: () => {},
229
- getState: () => ({}),
230
- }}
231
- >
232
- <ToolButton random={4} />
233
- </Provider>,
234
- "when mounted",
235
- "to satisfy",
236
- <Provider
237
- store={{
238
- subscribe: () => {},
239
- dispatch: () => {},
240
- getState: () => ({}),
241
- }}
242
- >
243
- <ToolbarButton random={4} />
244
- </Provider>,
245
- ));
246
-
247
- it("renders a styled button with icon", () =>
248
- expect(
249
- <Provider
250
- store={{
251
- subscribe: () => {},
252
- dispatch: () => {},
253
- getState: () => ({}),
254
- }}
255
- >
256
- <ToolButton oddProp="Test" label={{ icon: "test" }} />
257
- </Provider>,
258
- "when mounted",
259
- "to satisfy",
260
- <Provider
261
- store={{
262
- subscribe: () => {},
263
- dispatch: () => {},
264
- getState: () => ({}),
265
- }}
266
- >
267
- <ToolbarButton oddProp="Test" icon="test" />
268
- </Provider>,
269
- ));
270
-
271
- it("renders a styled button with text", () =>
272
- expect(
273
- <Provider
274
- store={{
275
- subscribe: () => {},
276
- dispatch: () => {},
277
- getState: () => ({}),
278
- }}
279
- >
280
- <ToolButton onClick={jest.fn()} label={{ text: "A label" }} />
281
- </Provider>,
282
- "when mounted",
283
- "to satisfy",
284
- <Provider
285
- store={{
286
- subscribe: () => {},
287
- dispatch: () => {},
288
- getState: () => ({}),
289
- }}
290
- >
291
- <ToolbarButton onClick={jest.fn()} label="A label" />
292
- </Provider>,
293
- ));
294
-
295
- it("renders a styled button with text and icon", () =>
296
- expect(
297
- <Provider
298
- store={{
299
- subscribe: () => {},
300
- dispatch: () => {},
301
- getState: () => ({}),
302
- }}
303
- >
304
- <ToolButton things={{ stuff: "nonsense" }} label={{ icon: "test", text: "A label" }} />
305
- </Provider>,
306
- "when mounted",
307
- "to satisfy",
308
- <Provider
309
- store={{
310
- subscribe: () => {},
311
- dispatch: () => {},
312
- getState: () => ({}),
313
- }}
314
- >
315
- <ToolbarButton things={{ stuff: "nonsense" }} icon="test" label="A label" />
316
- </Provider>,
317
- ));
318
-
319
- describe("ToolbarButton", () => {
320
- it("renders an IconButton", () =>
321
- expect(
322
- <Provider
323
- store={{
324
- subscribe: () => {},
325
- dispatch: () => {},
326
- getState: () => ({}),
327
- }}
328
- >
329
- <ToolbarButton things={{ stuff: "nonsense" }} icon="test" label="A label" />
330
- </Provider>,
331
- "when mounted",
332
- "to satisfy",
333
- <Provider
334
- store={{
335
- subscribe: () => {},
336
- dispatch: () => {},
337
- getState: () => ({}),
338
- }}
339
- >
340
- <IconButton things={{ stuff: "nonsense" }} icon="test" label="A label" />
341
- </Provider>,
342
- ));
343
- });
344
- });
345
-
346
- describe("toolComponents.group", () => {
347
- let tools;
348
- beforeEach(() => {
349
- tools = [
350
- {
351
- type: "button",
352
- key: 0,
353
- label: { text: "Button" },
354
- onClick: () => {},
355
- },
356
- {
357
- type: "input",
358
- key: 1,
359
- onChange: e => {},
360
- placeholder: "Text",
361
- },
362
- {
363
- type: "button",
364
- key: 2,
365
- label: { text: "Button" },
366
- onClick: () => {},
367
- },
368
- ];
369
- });
370
-
371
- it("renders a styled group", () =>
372
- expect(
373
- <Provider
374
- store={{
375
- subscribe: () => {},
376
- dispatch: () => {},
377
- getState: () => ({}),
378
- }}
379
- >
380
- <IntlProvider locale="en">
381
- <Group tools={tools} />
382
- </IntlProvider>
383
- </Provider>,
384
- "when mounted",
385
- "to satisfy",
386
- <Provider
387
- store={{
388
- subscribe: () => {},
389
- dispatch: () => {},
390
- getState: () => ({}),
391
- }}
392
- >
393
- <ToolGroup>
394
- <ToolButton label={{ text: "Button" }} onClick={tools[0].onClick} />
395
- <IntlProvider locale="en">
396
- <ToolInput onChange={tools[1].onChange} placeholder="Text" />
397
- </IntlProvider>
398
- <ToolButton label={{ text: "Button" }} onClick={tools[2].onClick} />
399
- </ToolGroup>
400
- </Provider>,
401
- ));
402
- });
403
-
404
- describe("toolComponents.spacer", () => {
405
- it("renders a styled spacer", () => expect(<ToolSpacer />, "when mounted", "to satisfy", <Spacer />));
406
- });
407
-
408
- describe("toolComponents.separator", () => {
409
- it("renders a styled separator", () => expect(<ToolSeparator />, "when mounted", "to satisfy", <Separator />));
410
- });
411
-
412
- describe("toolComponents.label", () => {
413
- it("renders a styled label", () =>
414
- expect(
415
- <Provider
416
- store={{
417
- subscribe: () => {},
418
- dispatch: () => {},
419
- getState: () => ({}),
420
- }}
421
- >
422
- <IntlProvider locale="en">
423
- <ToolLabel label={{ id: "toolbar.label", defaultMessage: "A label" }} />
424
- </IntlProvider>
425
- </Provider>,
426
- "when mounted",
427
- "to satisfy",
428
- <ToolbarLabel>A label</ToolbarLabel>,
429
- ));
430
- });
431
-
432
- describe("toolComponents.radio", () => {
433
- let radios, radioProps;
434
- beforeEach(() => {
435
- radios = [
436
- { label: "Option 1", value: "option1" },
437
- { label: "Option 2", value: "option2" },
438
- { label: "Option 3", value: "option3" },
439
- ];
440
-
441
- radioProps = new RadioProps();
442
- radioProps.set(RadioProps.propNames.name, "aRadioName");
443
- radioProps.set(RadioProps.propNames.label, "aRadioLabel");
444
- radioProps.set(RadioProps.propNames.defaultVal, "option1");
445
- radioProps.set(RadioProps.propNames.value, "option1");
446
- radioProps.set(RadioProps.propNames.update, jest.fn());
447
- radioProps.set(RadioProps.propNames.radios, radios);
448
- radioProps.set(RadioProps.propNames.error, false);
449
- radioProps.set(RadioProps.propNames.row, true);
450
- });
451
-
452
- it("renders a styled radio", () =>
453
- expect(
454
- <Provider
455
- store={{
456
- subscribe: () => {},
457
- dispatch: () => {},
458
- getState: () => ({}),
459
- }}
460
- >
461
- <ToolRadio
462
- name="aRadioName"
463
- label="aRadioLabel"
464
- value="option1"
465
- defaultVal="option1"
466
- update={jest.fn()}
467
- radios={radios}
468
- error={false}
469
- row={true}
470
- />
471
- </Provider>,
472
- "when mounted",
473
- "to satisfy",
474
- <ToolbarRadioWrapper>
475
- <ToolbarRadio radioProps={radioProps} />
476
- </ToolbarRadioWrapper>,
477
- ));
478
- });
@@ -1,51 +0,0 @@
1
- import React from "react";
2
- import styled from "styled-components";
3
- import { getThemeProp } from "../utils";
4
- import Text from "./Text";
5
-
6
- export const TooltipBubble = styled.div`
7
- position: absolute;
8
- top: 50%;
9
- right: -10px;
10
- transform: translate(-99999px, -50%);
11
- color: ${getThemeProp(["colors", "text"], "#333333")};
12
- background-color: #fff;
13
- border: 1px solid ${getThemeProp(["colors", "borderLight"], "#cccccc")};
14
- border-radius: 3px;
15
- padding: 0 3px;
16
- transition: transform 0s;
17
- cursor: default;
18
- font-family: ${getThemeProp(["fonts", "base"], "sans-serif")};
19
- text-transform: none;
20
-
21
- *:hover > & {
22
- transform: translate(100%, -50%);
23
- transition: transform 1.5s step-end;
24
- }
25
-
26
- &::before {
27
- content: "";
28
- position: absolute;
29
- top: 4px;
30
- left: -10px;
31
- border: 5px solid transparent;
32
- border-right-color: ${getThemeProp(["colors", "borderLight"], "#cccccc")};
33
- }
34
-
35
- &::after {
36
- content: "";
37
- position: absolute;
38
- top: 4px;
39
- left: -9px;
40
- border: 5px solid transparent;
41
- border-right-color: #ffffff;
42
- }
43
- `;
44
-
45
- const Tooltip = ({ message }) => (
46
- <TooltipBubble>
47
- <Text message={message} />
48
- </TooltipBubble>
49
- );
50
-
51
- export default Tooltip;
@@ -1,21 +0,0 @@
1
- import React from "react";
2
- import { Provider } from "react-redux";
3
- import Tooltip, { TooltipBubble } from "./Tooltip";
4
-
5
- describe("Tooltip", () => {
6
- it("renders a small text message in a popup tip bubble", () =>
7
- expect(
8
- <Provider
9
- store={{
10
- subscribe: () => {},
11
- dispatch: () => {},
12
- getState: () => ({}),
13
- }}
14
- >
15
- <Tooltip message="A tip" />
16
- </Provider>,
17
- "when mounted",
18
- "to satisfy",
19
- <TooltipBubble>A tip</TooltipBubble>,
20
- ));
21
- });
package/src/getTheme.js DELETED
@@ -1,103 +0,0 @@
1
- import "typeface-open-sans";
2
- import "typeface-roboto-condensed";
3
- import { merge } from "lodash";
4
- import { shade, tint } from "polished";
5
-
6
- const baseTheme = {
7
- treeSettings: {
8
- // in px
9
- // How far from parent left edge to vertical branch under it
10
- branchIndent: 14,
11
- // How far from vertical branch to children's left edge
12
- branchLength: 15,
13
- // How far up from bottom edge of node should horizontal branch sit
14
- branchHeight: 20,
15
- },
16
- colors: {
17
- application: {
18
- base: "#cccccc",
19
- },
20
- icon: "#999999",
21
- border: "#999999",
22
- borderLight: "#cccccc",
23
- borderDark: "#3333333",
24
- text: "#333333",
25
- textMedium: "#999999",
26
- textLight: "#cccccc",
27
- textWhite: "#efefef",
28
- bgLight: "#efefef",
29
- bgMedium: "#999999", // Not used
30
- bgDark: "#333333",
31
- error: "#ce4844",
32
- scopeTypes: {
33
- Global: "#fd6b35",
34
- Virtual: "#3b6482",
35
- Sale: "#7db84c",
36
- Dependant: "#999999",
37
- },
38
- toasts: {
39
- error: "#ce4844",
40
- warn: "#f5a623",
41
- confirm: "#22b980",
42
- },
43
- },
44
- icons: {
45
- indicators: {
46
- up: "chevron-up",
47
- down: "dropdown-chevron-down",
48
- right: "dropdown-chevron-right",
49
- more: "arrow-more",
50
- },
51
- scopeTypes: {
52
- Global: "global-scope",
53
- Virtual: "virtual-scope",
54
- Sale: "sales-scope",
55
- Dependant: "dependent-scope",
56
- },
57
- // toast: {
58
- // confirm: "checkmark-circle",
59
- // warn: "warning",
60
- // error: "cross-circle",
61
- // },
62
- prev: "arrow-small-left",
63
- next: "arrow-small-right",
64
- menu: "app-list",
65
- sidebarOpen: "collapse",
66
- sidebarClosed: "expand",
67
- close: "close",
68
- date: "calendar-generic",
69
- time: "clock",
70
- backArrow: "arrow-large-left",
71
- loading: "sync",
72
- error: "warning",
73
- reportProblem: "report-problem-triangle",
74
- },
75
- fonts: {
76
- base: "Open Sans, sans-serif",
77
- header: "Roboto Condensed, sans-serif",
78
- },
79
- };
80
-
81
- const setApplicationColors = theme => {
82
- if (!theme.colors.application.primary) {
83
- theme.colors.application.primary = theme.colors.application.base;
84
- }
85
- if (!theme.colors.application.highlight) {
86
- theme.colors.application.highlight = tint(0.86, theme.colors.application.base);
87
- }
88
- if (!theme.colors.application.select) {
89
- theme.colors.application.select = tint(0.7, theme.colors.application.base);
90
- }
91
- if (!theme.colors.application.dark) {
92
- theme.colors.application.dark = shade(0.2, theme.colors.application.base);
93
- }
94
- return theme;
95
- };
96
-
97
- const appHighlightColor_IS_DEPRECATED = { appHighlightColor: "#ff00ff" };
98
-
99
- const getTheme = (overrides = {}) => {
100
- return setApplicationColors(merge({}, baseTheme, overrides, appHighlightColor_IS_DEPRECATED));
101
- };
102
-
103
- export default getTheme;