orc-shared 5.10.1-dev.8 → 5.10.1-dev.9
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/Authenticate.js +41 -17
- package/dist/components/ErrorPlaceholder.js +8 -24
- package/dist/components/{Icon.js → Form/Inputs/MultiSelector.js} +33 -20
- package/dist/components/Form/Inputs/index.js +1 -1
- package/dist/components/LoadingIcon.js +6 -16
- package/dist/components/MaterialUI/Inputs/Select.js +10 -0
- package/dist/components/MaterialUI/Inputs/SelectProps.js +3 -1
- package/dist/components/MaterialUI/Navigation/DropDownMenu.js +2 -4
- package/dist/components/Provision.js +30 -13
- package/dist/components/Routing/SegmentPage.js +115 -56
- package/dist/components/Scope/ScopeNode.js +68 -45
- package/dist/components/Sidepanel.js +57 -23
- package/dist/components/Spritesheet.js +33 -17
- package/dist/components/Text.js +1 -60
- 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 +7 -5
- package/dist/utils/index.js +0 -4
- package/dist/utils/testUtils.js +1 -12
- package/package.json +1 -1
- package/src/components/ApplicationModuleLoader.test.js +14 -27
- package/src/components/Authenticate.js +29 -21
- package/src/components/Authenticate.test.js +18 -27
- package/src/components/ErrorPlaceholder.js +4 -21
- package/src/components/ErrorPlaceholder.test.js +7 -14
- package/src/components/Form/InputField.test.js +2 -1
- package/src/components/Form/Inputs/MultiSelector.js +23 -0
- package/src/components/Form/Inputs/MultiSelector.test.js +112 -0
- package/src/components/Form/Inputs/index.js +1 -1
- package/src/components/Loader.test.js +21 -33
- package/src/components/LoadingIcon.js +2 -15
- package/src/components/LoadingIcon.test.js +2 -20
- package/src/components/MaterialUI/DataDisplay/Table.test.js +1 -1
- package/src/components/MaterialUI/Inputs/Select.js +7 -0
- package/src/components/MaterialUI/Inputs/Select.test.js +45 -0
- package/src/components/MaterialUI/Inputs/SelectProps.js +2 -0
- package/src/components/MaterialUI/Inputs/SelectProps.test.js +2 -0
- package/src/components/MaterialUI/Navigation/DropDownMenu.js +2 -2
- package/src/components/MaterialUI/Navigation/DropDownMenu.test.js +5 -6
- 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 +61 -54
- package/src/components/Scope/ScopeNode.test.js +61 -154
- package/src/components/ScopeExtendedConfigurationLoader.test.js +1 -4
- package/src/components/Sidepanel.js +38 -32
- package/src/components/Sidepanel.test.js +49 -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/Treeview/Branch.js +63 -45
- package/src/components/Treeview/Branch.test.js +21 -24
- package/src/components/Treeview/Label.js +66 -52
- package/src/components/Treeview/Label.test.js +42 -60
- package/src/components/Treeview/Leaf.js +41 -22
- package/src/components/Treeview/Leaf.test.js +15 -10
- 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 +7 -6
- package/src/utils/index.js +0 -4
- package/src/utils/testUtils.js +0 -10
- package/src/utils/testUtils.test.js +0 -68
- package/dist/components/Button.js +0 -70
- package/dist/components/Checkbox.js +0 -103
- package/dist/components/IconButton.js +0 -80
- package/dist/components/Input.js +0 -101
- package/dist/components/Modal/Background.js +0 -55
- package/dist/components/Modal/Dialog.js +0 -75
- package/dist/components/Modal/Wrapper.js +0 -69
- package/dist/components/Modal/index.js +0 -86
- 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 -153
- 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/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/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 -98
- 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,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,98 +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
|
-
prev: "arrow-small-left",
|
|
58
|
-
next: "arrow-small-right",
|
|
59
|
-
menu: "app-list",
|
|
60
|
-
sidebarOpen: "collapse",
|
|
61
|
-
sidebarClosed: "expand",
|
|
62
|
-
close: "close",
|
|
63
|
-
date: "calendar-generic",
|
|
64
|
-
time: "clock",
|
|
65
|
-
backArrow: "arrow-large-left",
|
|
66
|
-
loading: "sync",
|
|
67
|
-
error: "warning",
|
|
68
|
-
reportProblem: "report-problem-triangle",
|
|
69
|
-
},
|
|
70
|
-
fonts: {
|
|
71
|
-
base: "Open Sans, sans-serif",
|
|
72
|
-
header: "Roboto Condensed, sans-serif",
|
|
73
|
-
},
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
const setApplicationColors = theme => {
|
|
77
|
-
if (!theme.colors.application.primary) {
|
|
78
|
-
theme.colors.application.primary = theme.colors.application.base;
|
|
79
|
-
}
|
|
80
|
-
if (!theme.colors.application.highlight) {
|
|
81
|
-
theme.colors.application.highlight = tint(0.86, theme.colors.application.base);
|
|
82
|
-
}
|
|
83
|
-
if (!theme.colors.application.select) {
|
|
84
|
-
theme.colors.application.select = tint(0.7, theme.colors.application.base);
|
|
85
|
-
}
|
|
86
|
-
if (!theme.colors.application.dark) {
|
|
87
|
-
theme.colors.application.dark = shade(0.2, theme.colors.application.base);
|
|
88
|
-
}
|
|
89
|
-
return theme;
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
const appHighlightColor_IS_DEPRECATED = { appHighlightColor: "#ff00ff" };
|
|
93
|
-
|
|
94
|
-
const getTheme = (overrides = {}) => {
|
|
95
|
-
return setApplicationColors(merge({}, baseTheme, overrides, appHighlightColor_IS_DEPRECATED));
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
export default getTheme;
|