orc-shared 5.10.2 → 5.99.0-dev.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AppFrame/About.js +13 -13
- package/dist/components/AppFrame/Anchor.js +7 -7
- package/dist/components/AppFrame/AppFrame.js +3 -3
- package/dist/components/AppFrame/Help.js +4 -4
- package/dist/components/AppFrame/MenuItem.js +17 -26
- package/dist/components/AppFrame/Preferences.js +14 -14
- package/dist/components/AppFrame/Sidebar.js +6 -6
- package/dist/components/AppFrame/Topbar.js +6 -6
- package/dist/components/ApplicationModuleLoader.js +3 -2
- package/dist/components/Authenticate.js +29 -22
- package/dist/components/DropMenu/Menu.js +9 -9
- package/dist/components/ErrorPlaceholder.js +8 -24
- package/dist/components/Form/Field.js +4 -4
- package/dist/components/Form/Inputs/Button.js +2 -2
- package/dist/components/Form/Inputs/MultiSelector.js +137 -0
- package/dist/components/Form/Inputs/Selector.js +13 -10
- package/dist/components/Form/Inputs/index.js +1 -1
- package/dist/components/InternetExplorerWarningMessage.js +15 -15
- package/dist/components/LoadingIcon.js +38 -17
- package/dist/components/MaterialUI/DataDisplay/Modal.js +3 -3
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/Placeholder.js +6 -6
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/TableInfoBar.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/SelectionList.js +1 -1
- package/dist/components/MaterialUI/DataDisplay/Table.js +2 -1
- package/dist/components/MaterialUI/DataDisplay/TableProps.js +3 -1
- package/dist/components/MaterialUI/DataDisplay/TransferList.js +1 -1
- package/dist/components/MaterialUI/Inputs/CheckboxGroup.js +1 -1
- package/dist/components/MaterialUI/Inputs/DatePicker.js +1 -1
- package/dist/components/MaterialUI/Inputs/PredefinedElements/SearchControl.js +1 -1
- package/dist/components/MaterialUI/Inputs/Select.js +175 -109
- package/dist/components/MaterialUI/Inputs/SelectProps.js +11 -1
- package/dist/components/MaterialUI/Inputs/Switch.js +1 -1
- package/dist/components/MaterialUI/Navigation/DropDownMenu.js +2 -4
- package/dist/components/MaterialUI/ScopeSelector/ScopeSelector.js +1 -1
- package/dist/components/MaterialUI/ScopeSelector/TreeItem.js +27 -42
- package/dist/components/MaterialUI/Surfaces/Paper.js +1 -1
- package/dist/components/MaterialUI/Surfaces/SectionExpansionPanel.js +3 -2
- package/dist/components/MaterialUI/muiThemes.js +3 -1
- package/dist/components/Provision.js +30 -13
- package/dist/components/Routing/SegmentPage.js +117 -56
- package/dist/components/Scope/ScopeNode.js +62 -57
- package/dist/components/Sidepanel.js +59 -23
- package/dist/components/Spritesheet.js +35 -17
- package/dist/components/Text.js +1 -60
- package/dist/components/ToastList.js +95 -64
- package/dist/components/Treeview/Branch.js +82 -20
- package/dist/components/Treeview/Label.js +108 -31
- package/dist/components/Treeview/Leaf.js +56 -12
- package/dist/components/Treeview/Node.js +22 -9
- package/dist/components/Treeview/index.js +7 -1
- package/dist/components/Treeview/settings.js +17 -6
- package/dist/{components/Modal/index.js → hooks/useWindowSize.js} +38 -36
- package/dist/sharedMessages.js +8 -0
- package/dist/utils/index.js +0 -4
- package/dist/utils/testUtils.js +1 -12
- package/dist/{components/Modal/Background.js → utils/toastHelper.js} +11 -14
- package/package.json +2 -2
- package/src/components/AppFrame/About.js +13 -13
- package/src/components/AppFrame/Anchor.js +7 -7
- package/src/components/AppFrame/AppFrame.js +3 -3
- package/src/components/AppFrame/Help.js +4 -4
- package/src/components/AppFrame/MenuItem.js +15 -23
- package/src/components/AppFrame/Preferences.js +14 -14
- package/src/components/AppFrame/Sidebar.js +6 -6
- package/src/components/AppFrame/Topbar.js +6 -6
- package/src/components/ApplicationModuleLoader.js +2 -2
- package/src/components/ApplicationModuleLoader.test.js +15 -28
- package/src/components/Authenticate.js +21 -23
- package/src/components/Authenticate.test.js +19 -27
- package/src/components/DropMenu/Menu.js +9 -9
- package/src/components/ErrorPlaceholder.js +4 -21
- package/src/components/ErrorPlaceholder.test.js +7 -14
- package/src/components/Form/Field.js +4 -4
- package/src/components/Form/InputField.test.js +2 -1
- package/src/components/Form/Inputs/Button.js +2 -2
- package/src/components/Form/Inputs/MultiSelector.js +73 -0
- package/src/components/Form/Inputs/MultiSelector.test.js +332 -0
- package/src/components/Form/Inputs/Selector.js +12 -4
- package/src/components/Form/Inputs/Selector.test.js +27 -12
- package/src/components/Form/Inputs/index.js +1 -1
- package/src/components/InternetExplorerWarningMessage.js +15 -15
- package/src/components/Loader.test.js +50 -59
- package/src/components/LoadingIcon.js +27 -14
- package/src/components/LoadingIcon.test.js +11 -15
- package/src/components/MaterialUI/DataDisplay/Modal.js +3 -3
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/Placeholder.js +6 -6
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/StepperModal.js +1 -1
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/TableInfoBar.js +1 -1
- package/src/components/MaterialUI/DataDisplay/SelectionList.js +1 -1
- package/src/components/MaterialUI/DataDisplay/Table.js +6 -1
- package/src/components/MaterialUI/DataDisplay/Table.test.js +21 -1
- package/src/components/MaterialUI/DataDisplay/TableProps.js +2 -0
- package/src/components/MaterialUI/DataDisplay/TableProps.test.js +20 -2
- package/src/components/MaterialUI/DataDisplay/TransferList.js +1 -1
- package/src/components/MaterialUI/Inputs/CheckboxGroup.js +1 -1
- package/src/components/MaterialUI/Inputs/DatePicker.js +1 -1
- package/src/components/MaterialUI/Inputs/PredefinedElements/SearchControl.js +1 -1
- package/src/components/MaterialUI/Inputs/PredefinedElements/SearchControl.test.js +1 -1
- package/src/components/MaterialUI/Inputs/Select.js +143 -83
- package/src/components/MaterialUI/Inputs/Select.test.js +199 -14
- package/src/components/MaterialUI/Inputs/SelectProps.js +10 -0
- package/src/components/MaterialUI/Inputs/SelectProps.test.js +10 -0
- package/src/components/MaterialUI/Inputs/Switch.js +1 -1
- package/src/components/MaterialUI/Navigation/DropDownMenu.js +2 -2
- package/src/components/MaterialUI/Navigation/DropDownMenu.test.js +5 -6
- package/src/components/MaterialUI/ScopeSelector/ScopeSelector.js +1 -2
- package/src/components/MaterialUI/ScopeSelector/TreeItem.js +8 -31
- package/src/components/MaterialUI/Surfaces/Paper.js +1 -1
- package/src/components/MaterialUI/Surfaces/SectionExpansionPanel.js +2 -1
- package/src/components/MaterialUI/muiThemes.js +4 -1
- package/src/components/Navigation/Navigation.test.js +0 -5
- package/src/components/Navigation/useNavigationState.test.js +79 -222
- package/src/components/Provision.js +36 -42
- package/src/components/Provision.test.js +10 -26
- package/src/components/Routing/SegmentPage.js +68 -52
- package/src/components/Routing/SegmentPage.test.js +4 -12
- package/src/components/Scope/ScopeNode.js +44 -55
- package/src/components/Scope/ScopeNode.test.js +84 -163
- package/src/components/ScopeExtendedConfigurationLoader.test.js +1 -4
- package/src/components/Sidepanel.js +38 -32
- package/src/components/Sidepanel.test.js +54 -27
- package/src/components/Spritesheet.js +23 -21
- package/src/components/Spritesheet.test.js +10 -10
- package/src/components/Text.js +0 -49
- package/src/components/ToastList.js +79 -90
- package/src/components/ToastList.test.js +29 -103
- package/src/components/Treeview/Branch.js +65 -47
- package/src/components/Treeview/Branch.test.js +2 -43
- package/src/components/Treeview/Label.js +68 -54
- package/src/components/Treeview/Label.test.js +55 -63
- package/src/components/Treeview/Leaf.js +41 -22
- package/src/components/Treeview/Leaf.test.js +1 -15
- package/src/components/Treeview/Node.js +16 -9
- package/src/components/Treeview/Node.test.js +269 -200
- package/src/components/Treeview/Treeview.test.js +248 -248
- package/src/components/Treeview/index.js +6 -0
- package/src/components/Treeview/settings.js +10 -6
- package/src/hooks/useMultipleFieldEditState.test.js +0 -1
- package/src/hooks/useWindowSize.js +39 -0
- package/src/hooks/useWindowSize.test.js +68 -0
- package/src/sharedMessages.js +8 -0
- package/src/translations/en-US.json +2 -0
- package/src/translations/fr-CA.json +2 -0
- package/src/utils/index.js +0 -4
- package/src/utils/testUtils.js +0 -10
- package/src/utils/testUtils.test.js +0 -68
- package/src/utils/toastHelper.js +8 -0
- package/src/utils/toastHelper.test.js +41 -0
- package/dist/components/Button.js +0 -70
- package/dist/components/CategoryList.js +0 -197
- package/dist/components/Checkbox.js +0 -103
- package/dist/components/Icon.js +0 -69
- package/dist/components/IconButton.js +0 -80
- package/dist/components/Input.js +0 -101
- package/dist/components/List/DataCell.js +0 -129
- package/dist/components/List/HeadCell.js +0 -125
- package/dist/components/List/HeadRow.js +0 -73
- package/dist/components/List/List.js +0 -274
- package/dist/components/List/Row.js +0 -109
- package/dist/components/List/enhanceColumnDefs.js +0 -111
- package/dist/components/List/index.js +0 -59
- package/dist/components/Modal/Dialog.js +0 -75
- package/dist/components/Modal/Wrapper.js +0 -69
- package/dist/components/MultiSelector.js +0 -187
- package/dist/components/Navigation/Bar.js +0 -293
- package/dist/components/Navigation/Tab.js +0 -182
- package/dist/components/Placeholder.js +0 -114
- package/dist/components/Scope/Selector.js +0 -123
- package/dist/components/Selector.js +0 -185
- package/dist/components/Switch.js +0 -128
- package/dist/components/Toolbar.js +0 -227
- package/dist/components/Tooltip.js +0 -66
- package/dist/getTheme.js +0 -158
- package/dist/getThemeOverrides.js +0 -93
- package/dist/hocs/withAuthentication.js +0 -72
- package/dist/utils/styledPropFuncs.js +0 -88
- package/src/components/Button.js +0 -90
- package/src/components/Button.test.js +0 -49
- package/src/components/CategoryList.js +0 -140
- package/src/components/CategoryList.test.js +0 -667
- package/src/components/Checkbox.js +0 -63
- package/src/components/Checkbox.test.js +0 -122
- package/src/components/Icon.js +0 -18
- package/src/components/IconButton.js +0 -30
- package/src/components/IconButton.test.js +0 -61
- package/src/components/Input.js +0 -35
- package/src/components/Input.test.js +0 -34
- package/src/components/List/DataCell.js +0 -77
- package/src/components/List/DataCell.test.js +0 -357
- package/src/components/List/HeadCell.js +0 -105
- package/src/components/List/HeadCell.test.js +0 -331
- package/src/components/List/HeadRow.js +0 -21
- package/src/components/List/HeadRow.test.js +0 -27
- package/src/components/List/List.js +0 -162
- package/src/components/List/List.test.js +0 -705
- package/src/components/List/Row.js +0 -72
- package/src/components/List/Row.test.js +0 -194
- package/src/components/List/enhanceColumnDefs.js +0 -54
- package/src/components/List/enhanceColumnDefs.test.js +0 -179
- package/src/components/List/index.js +0 -6
- package/src/components/Modal/Background.js +0 -10
- package/src/components/Modal/Dialog.js +0 -27
- package/src/components/Modal/Dialog.test.js +0 -20
- package/src/components/Modal/Modal.test.js +0 -52
- package/src/components/Modal/Wrapper.js +0 -32
- package/src/components/Modal/Wrapper.test.js +0 -55
- package/src/components/Modal/index.js +0 -22
- package/src/components/MultiSelector.js +0 -104
- package/src/components/MultiSelector.test.js +0 -348
- package/src/components/Navigation/Bar.js +0 -212
- package/src/components/Navigation/Bar.test.js +0 -552
- package/src/components/Navigation/Tab.js +0 -156
- package/src/components/Navigation/Tab.test.js +0 -404
- package/src/components/Placeholder.js +0 -61
- package/src/components/Placeholder.test.js +0 -106
- package/src/components/Scope/Selector.js +0 -70
- package/src/components/Scope/Selector.test.js +0 -138
- package/src/components/Selector.js +0 -191
- package/src/components/Selector.test.js +0 -157
- package/src/components/Switch.js +0 -112
- package/src/components/Switch.test.js +0 -130
- package/src/components/Text.test.js +0 -132
- package/src/components/Toolbar.js +0 -178
- package/src/components/Toolbar.test.js +0 -478
- package/src/components/Tooltip.js +0 -51
- package/src/components/Tooltip.test.js +0 -21
- package/src/getTheme.js +0 -103
- package/src/getTheme.test.js +0 -92
- package/src/getThemeOverrides.js +0 -27
- package/src/hocs/withAuthentication.js +0 -18
- package/src/hocs/withAuthentication.test.js +0 -120
- package/src/utils/styledPropFuncs.js +0 -20
- package/src/utils/styledPropFuncs.test.js +0 -166
|
@@ -18,6 +18,9 @@ export const Treeview = ({
|
|
|
18
18
|
openAll,
|
|
19
19
|
name,
|
|
20
20
|
defaultNodeState = {},
|
|
21
|
+
labelClassName,
|
|
22
|
+
leafClassName,
|
|
23
|
+
branchClassName,
|
|
21
24
|
...otherProps
|
|
22
25
|
}) => {
|
|
23
26
|
const [viewState, updateViewState] = useViewState(name);
|
|
@@ -34,6 +37,9 @@ export const Treeview = ({
|
|
|
34
37
|
selectedNodeId,
|
|
35
38
|
nodeState,
|
|
36
39
|
updateNodeState,
|
|
40
|
+
labelClassName,
|
|
41
|
+
leafClassName,
|
|
42
|
+
branchClassName,
|
|
37
43
|
otherProps,
|
|
38
44
|
}}
|
|
39
45
|
>
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export const
|
|
5
|
-
|
|
6
|
-
export const
|
|
1
|
+
// in px
|
|
2
|
+
// How far from parent left edge to vertical branch under it
|
|
3
|
+
export const branchIndent = 14;
|
|
4
|
+
export const branchIndentSpacing = 1.4;
|
|
5
|
+
// How far from vertical branch to children's left edge
|
|
6
|
+
export const branchLength = 15;
|
|
7
|
+
export const branchLengthSpacing = 1.5;
|
|
8
|
+
// How far up from bottom edge of node should horizontal branch sit
|
|
9
|
+
export const branchHeight = 20;
|
|
10
|
+
export const branchHeightSpacing = 2;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
|
|
3
|
+
export const useWindowSize = () => {
|
|
4
|
+
const [windowSize, setWindowSize] = useState({
|
|
5
|
+
innerWidth: window.innerWidth,
|
|
6
|
+
innerHeight: window.innerHeight,
|
|
7
|
+
outerWidth: window.outerWidth,
|
|
8
|
+
outerHeight: window.outerHeight,
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
const handleResize = () => {
|
|
13
|
+
const haveChanged =
|
|
14
|
+
windowSize.innerWidth !== window.innerWidth ||
|
|
15
|
+
windowSize.innerHeight !== window.innerHeight ||
|
|
16
|
+
windowSize.outerWidth !== window.outerWidth ||
|
|
17
|
+
windowSize.outerHeight !== window.outerHeight;
|
|
18
|
+
|
|
19
|
+
if (haveChanged) {
|
|
20
|
+
setWindowSize({
|
|
21
|
+
innerWidth: window.innerWidth,
|
|
22
|
+
innerHeight: window.innerHeight,
|
|
23
|
+
outerWidth: window.outerWidth,
|
|
24
|
+
outerHeight: window.outerHeight,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
handleResize();
|
|
30
|
+
|
|
31
|
+
window.addEventListener("resize", handleResize);
|
|
32
|
+
|
|
33
|
+
return () => window.removeEventListener("resize", handleResize);
|
|
34
|
+
}, [windowSize]);
|
|
35
|
+
|
|
36
|
+
return windowSize;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default useWindowSize;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import useWindowSize from "./useWindowSize";
|
|
3
|
+
import { mount, unmount, act } from "unexpected-reaction";
|
|
4
|
+
|
|
5
|
+
let renderingCount = 0;
|
|
6
|
+
|
|
7
|
+
const TestComp = () => {
|
|
8
|
+
const windowSize = useWindowSize();
|
|
9
|
+
|
|
10
|
+
const allDimensions = `${windowSize.innerWidth},${windowSize.innerHeight},${windowSize.outerWidth},${windowSize.outerHeight},${++renderingCount}`;
|
|
11
|
+
|
|
12
|
+
return <div>{allDimensions}</div>;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
function setViewport(width, height) {
|
|
16
|
+
Object.defineProperty(window, "innerWidth", { configurable: true, value: width });
|
|
17
|
+
Object.defineProperty(window, "innerHeight", { configurable: true, value: height });
|
|
18
|
+
Object.defineProperty(window, "outerWidth", { configurable: true, value: width + 20 });
|
|
19
|
+
Object.defineProperty(window, "outerHeight", { configurable: true, value: height + 25 });
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
describe("useWindowSize", () => {
|
|
23
|
+
let element = null;
|
|
24
|
+
|
|
25
|
+
beforeEach(() => {
|
|
26
|
+
renderingCount = 0;
|
|
27
|
+
setViewport(1440, 720);
|
|
28
|
+
window.dispatchEvent(new Event("resize"));
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
afterEach(() => {
|
|
32
|
+
if (element !== null) {
|
|
33
|
+
unmount(element);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it("display window dimensions properly after first render", () => {
|
|
38
|
+
element = mount(<TestComp />);
|
|
39
|
+
|
|
40
|
+
expect(element, "to satisfy", <div>1440,720,1460,745,1</div>);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it("display window dimensions properly after resize event", () => {
|
|
44
|
+
element = mount(<TestComp />);
|
|
45
|
+
|
|
46
|
+
expect(element, "to satisfy", <div>1440,720,1460,745,1</div>);
|
|
47
|
+
|
|
48
|
+
act(() => {
|
|
49
|
+
setViewport(843, 487);
|
|
50
|
+
window.dispatchEvent(new Event("resize"));
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
expect(element, "to satisfy", <div>843,487,863,512,2</div>);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it("display window dimensions properly after resize event with unchanged dimensions", () => {
|
|
57
|
+
element = mount(<TestComp />);
|
|
58
|
+
|
|
59
|
+
expect(element, "to satisfy", <div>1440,720,1460,745,1</div>);
|
|
60
|
+
|
|
61
|
+
act(() => {
|
|
62
|
+
setViewport(1440, 720);
|
|
63
|
+
window.dispatchEvent(new Event("resize"));
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
expect(element, "to satisfy", <div>1440,720,1460,745,1</div>);
|
|
67
|
+
});
|
|
68
|
+
});
|
package/src/sharedMessages.js
CHANGED
|
@@ -483,6 +483,14 @@ const sharedMessages = defineMessages({
|
|
|
483
483
|
id: "orc-shared.december",
|
|
484
484
|
defaultMessage: "December",
|
|
485
485
|
},
|
|
486
|
+
selectAll: {
|
|
487
|
+
id: "orc-shared.selectAll",
|
|
488
|
+
defaultMessage: "Select All",
|
|
489
|
+
},
|
|
490
|
+
clear: {
|
|
491
|
+
id: "orc-shared.clear",
|
|
492
|
+
defaultMessage: "Clear",
|
|
493
|
+
},
|
|
486
494
|
});
|
|
487
495
|
|
|
488
496
|
export default sharedMessages;
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"orc-shared.ccDescription": "The API-first commerce platform that makes omnichannel retail work.",
|
|
15
15
|
"orc-shared.ccName": "Orckestra Commerce Cloud",
|
|
16
16
|
"orc-shared.ccVersion": "Commerce Cloud {version}",
|
|
17
|
+
"orc-shared.clear": "Clear",
|
|
17
18
|
"orc-shared.close": "Close",
|
|
18
19
|
"orc-shared.confirmation": "Confirmation",
|
|
19
20
|
"orc-shared.copyright": "© {year} Orckestra Technologies Inc.",
|
|
@@ -90,6 +91,7 @@
|
|
|
90
91
|
"orc-shared.scopeChangeWithUnsavedDataTitle": "Confirm scope change without saving data",
|
|
91
92
|
"orc-shared.scopeFilterPlaceholder": "Type a scope name",
|
|
92
93
|
"orc-shared.search": "Search",
|
|
94
|
+
"orc-shared.selectAll": "Select All",
|
|
93
95
|
"orc-shared.september": "September",
|
|
94
96
|
"orc-shared.septemberShort": "Sep",
|
|
95
97
|
"orc-shared.shared": "Shared",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"orc-shared.ccDescription": "La plateforme de commerce « API-first » qui rend le commerce de détail omnicanal fluide.",
|
|
15
15
|
"orc-shared.ccName": "Orckestra Commerce Cloud",
|
|
16
16
|
"orc-shared.ccVersion": "Commerce Cloud {version}",
|
|
17
|
+
"orc-shared.clear": "Effacer",
|
|
17
18
|
"orc-shared.close": "Fermer",
|
|
18
19
|
"orc-shared.confirmation": "Confirmation",
|
|
19
20
|
"orc-shared.copyright": "© {year} Technologies Orckestra Inc.",
|
|
@@ -90,6 +91,7 @@
|
|
|
90
91
|
"orc-shared.scopeChangeWithUnsavedDataTitle": "Confirmation du changement de Scope sans sauvegarde",
|
|
91
92
|
"orc-shared.scopeFilterPlaceholder": "Entrez un nom de Scope",
|
|
92
93
|
"orc-shared.search": "Recherche",
|
|
94
|
+
"orc-shared.selectAll": "Tout sélectionner",
|
|
93
95
|
"orc-shared.september": "septembre",
|
|
94
96
|
"orc-shared.septemberShort": "sept.",
|
|
95
97
|
"orc-shared.shared": "Partagé",
|
package/src/utils/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import safeGet from "./safeGet";
|
|
2
|
-
import { getThemeProp, ifFlag, switchEnum } from "./styledPropFuncs";
|
|
3
2
|
import unwrapImmutable from "./unwrapImmutable";
|
|
4
3
|
import logPass from "./logPass";
|
|
5
4
|
import normalizeForSearch from "./normalizeForSearch";
|
|
@@ -18,8 +17,6 @@ export {
|
|
|
18
17
|
debounce,
|
|
19
18
|
flatten,
|
|
20
19
|
flattenObj,
|
|
21
|
-
getThemeProp,
|
|
22
|
-
ifFlag,
|
|
23
20
|
insertIcons,
|
|
24
21
|
loadConfig,
|
|
25
22
|
logPass,
|
|
@@ -30,6 +27,5 @@ export {
|
|
|
30
27
|
setTranslationWithFallbackValue,
|
|
31
28
|
setTranslationWithFallbackField,
|
|
32
29
|
stripKey,
|
|
33
|
-
switchEnum,
|
|
34
30
|
unwrapImmutable,
|
|
35
31
|
};
|
package/src/utils/testUtils.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { isStyledComponent } from "styled-components";
|
|
3
2
|
import { mount } from "unexpected-reaction";
|
|
4
3
|
import { Ignore } from "unexpected-reaction";
|
|
5
4
|
import createThemes from "./../components/MaterialUI/muiThemes";
|
|
@@ -56,15 +55,6 @@ export const getClassSelector = (elm, index, container) => {
|
|
|
56
55
|
}
|
|
57
56
|
};
|
|
58
57
|
|
|
59
|
-
export const getStyledClassSelector = elm => {
|
|
60
|
-
const component = elm.type || elm;
|
|
61
|
-
if (!isStyledComponent(component)) {
|
|
62
|
-
throw new Error("<" + (component.name || component) + " /> is not a styled component");
|
|
63
|
-
}
|
|
64
|
-
// Styled component toString() function returns a stable class name
|
|
65
|
-
return component.toString();
|
|
66
|
-
};
|
|
67
|
-
|
|
68
58
|
export const firstItemComparator = (a, b) => (a[0] > b[0] ? 1 : a[0] < b[0] ? -1 : 0);
|
|
69
59
|
|
|
70
60
|
export const PropStruct = React.forwardRef((props, ref) => (
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import styled from "styled-components";
|
|
3
2
|
import { defineMessages } from "react-intl";
|
|
4
3
|
import {
|
|
5
4
|
getElmClasses,
|
|
6
5
|
getClassName,
|
|
7
|
-
getStyledClassSelector,
|
|
8
6
|
getClassSelector,
|
|
9
7
|
PropStruct,
|
|
10
8
|
firstItemComparator,
|
|
@@ -28,13 +26,6 @@ class TestComp2 extends React.Component {
|
|
|
28
26
|
}
|
|
29
27
|
|
|
30
28
|
describe("class name helpers", () => {
|
|
31
|
-
const TestStyled = styled.div`
|
|
32
|
-
color: red;
|
|
33
|
-
`;
|
|
34
|
-
const DerivedTestStyled = styled(TestStyled)`
|
|
35
|
-
color: blue;
|
|
36
|
-
`;
|
|
37
|
-
|
|
38
29
|
spyOnConsole(["error"]);
|
|
39
30
|
|
|
40
31
|
describe("getElmClasses", () => {
|
|
@@ -44,16 +35,6 @@ describe("class name helpers", () => {
|
|
|
44
35
|
it("works with svg elements", () =>
|
|
45
36
|
expect(getElmClasses, "when called with", [<svg className="foo bar" />], "to equal", ["foo", "bar"]));
|
|
46
37
|
|
|
47
|
-
it("works with styled components", () =>
|
|
48
|
-
expect(
|
|
49
|
-
getElmClasses,
|
|
50
|
-
"when called with",
|
|
51
|
-
[<TestStyled />],
|
|
52
|
-
"to have an item satisfying",
|
|
53
|
-
"to match",
|
|
54
|
-
/__TestStyled-/,
|
|
55
|
-
));
|
|
56
|
-
|
|
57
38
|
it("throws an error if no class found on DOM element", () =>
|
|
58
39
|
expect(
|
|
59
40
|
() => expect(getElmClasses, "when called with", [<div />]),
|
|
@@ -94,9 +75,6 @@ describe("class name helpers", () => {
|
|
|
94
75
|
it("works with svg elements", () =>
|
|
95
76
|
expect(getClassName, "when called with", [<svg className="foo bar" />], "to equal", "foo"));
|
|
96
77
|
|
|
97
|
-
it("works with styled components", () =>
|
|
98
|
-
expect(getClassName, "when called with", [<TestStyled />], "to match", /__TestStyled-/));
|
|
99
|
-
|
|
100
78
|
it("can use a custom container element type", () => {
|
|
101
79
|
expect(getClassName(<td className="foo bar" />, 0, "tr"), "to equal", "foo");
|
|
102
80
|
expect(console.error, "was not called");
|
|
@@ -116,9 +94,6 @@ describe("class name helpers", () => {
|
|
|
116
94
|
it("works with svg elements", () =>
|
|
117
95
|
expect(getClassSelector, "when called with", [<svg className="foo bar" />], "to equal", ".foo"));
|
|
118
96
|
|
|
119
|
-
it("works with styled components", () =>
|
|
120
|
-
expect(getClassSelector, "when called with", [<TestStyled />], "to match", /^\.\S*__TestStyled-/));
|
|
121
|
-
|
|
122
97
|
it("can make a selector targeting all classes", () =>
|
|
123
98
|
expect(getClassSelector, "when called with", [<TestComp className="foo bar" />, -1], "to equal", ".foo.bar"));
|
|
124
99
|
|
|
@@ -127,49 +102,6 @@ describe("class name helpers", () => {
|
|
|
127
102
|
expect(console.error, "was not called");
|
|
128
103
|
});
|
|
129
104
|
});
|
|
130
|
-
|
|
131
|
-
describe("getStyledClassSelector", () => {
|
|
132
|
-
it("creates a selector for a styled component", () =>
|
|
133
|
-
expect(
|
|
134
|
-
getStyledClassSelector,
|
|
135
|
-
"when called with",
|
|
136
|
-
[<TestStyled />],
|
|
137
|
-
"to match",
|
|
138
|
-
/.*__TestStyled-sc-[0-9a-zA-Z]{6}-[0-9]/,
|
|
139
|
-
));
|
|
140
|
-
|
|
141
|
-
it("can use the component function without rendering", () =>
|
|
142
|
-
expect(
|
|
143
|
-
getStyledClassSelector,
|
|
144
|
-
"when called with",
|
|
145
|
-
[TestStyled],
|
|
146
|
-
"to match",
|
|
147
|
-
/.*__TestStyled-sc-[0-9a-zA-Z]{6}-[0-9]/,
|
|
148
|
-
));
|
|
149
|
-
|
|
150
|
-
it("finds the most specific class name", () =>
|
|
151
|
-
expect(
|
|
152
|
-
getStyledClassSelector,
|
|
153
|
-
"when called with",
|
|
154
|
-
[<DerivedTestStyled />],
|
|
155
|
-
"to match",
|
|
156
|
-
/.*__DerivedTestStyled-sc-[0-9a-zA-Z]{6}-[0-9]/,
|
|
157
|
-
));
|
|
158
|
-
|
|
159
|
-
it("throws an error if not given a non-styled component", () =>
|
|
160
|
-
expect(
|
|
161
|
-
() => expect(getStyledClassSelector, "when called with", [<TestComp />]),
|
|
162
|
-
"to throw",
|
|
163
|
-
"<TestComp /> is not a styled component",
|
|
164
|
-
));
|
|
165
|
-
|
|
166
|
-
it("throws an error if not given a DOM primitive", () =>
|
|
167
|
-
expect(
|
|
168
|
-
() => expect(getStyledClassSelector, "when called with", [<div />]),
|
|
169
|
-
"to throw",
|
|
170
|
-
"<div /> is not a styled component",
|
|
171
|
-
));
|
|
172
|
-
});
|
|
173
105
|
});
|
|
174
106
|
|
|
175
107
|
describe("PropStruct", () => {
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { getToastColor } from "./toastHelper";
|
|
2
|
+
|
|
3
|
+
describe("getToastColor", () => {
|
|
4
|
+
const theme = {
|
|
5
|
+
palette: {
|
|
6
|
+
error: {
|
|
7
|
+
main: "#FF0000",
|
|
8
|
+
},
|
|
9
|
+
warning: {
|
|
10
|
+
main: "#FFA500",
|
|
11
|
+
},
|
|
12
|
+
success: {
|
|
13
|
+
main: "#00FF00",
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
it("should return error color", () => {
|
|
19
|
+
const toastColor = getToastColor(theme, "error");
|
|
20
|
+
|
|
21
|
+
return expect(toastColor, "to be", "#FF0000");
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it("should return warning color", () => {
|
|
25
|
+
const toastColor = getToastColor(theme, "warn");
|
|
26
|
+
|
|
27
|
+
return expect(toastColor, "to be", "#FFA500");
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it("should return success color", () => {
|
|
31
|
+
const toastColor = getToastColor(theme, "confirm");
|
|
32
|
+
|
|
33
|
+
return expect(toastColor, "to be", "#00FF00");
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it("should return default color", () => {
|
|
37
|
+
const toastColor = getToastColor(theme, "test");
|
|
38
|
+
|
|
39
|
+
return expect(toastColor, "to be", "red");
|
|
40
|
+
});
|
|
41
|
+
});
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.default = void 0;
|
|
5
|
-
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
6
|
-
var _utils = require("../utils");
|
|
7
|
-
var _polished = require("polished");
|
|
8
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
9
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
10
|
-
(function () {
|
|
11
|
-
var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
|
|
12
|
-
enterModule && enterModule(module);
|
|
13
|
-
})();
|
|
14
|
-
(function () {
|
|
15
|
-
var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
|
|
16
|
-
enterModule && enterModule(module);
|
|
17
|
-
})();
|
|
18
|
-
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
|
|
19
|
-
return a;
|
|
20
|
-
};
|
|
21
|
-
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
|
|
22
|
-
return a;
|
|
23
|
-
};
|
|
24
|
-
var borderColor = function borderColor(base) {
|
|
25
|
-
return (0, _utils.ifFlag)("primary", (0, _utils.getThemeProp)(["colors", "application", "base"], base), base);
|
|
26
|
-
};
|
|
27
|
-
var background = (0, _utils.ifFlag)("primary", (0, _utils.ifFlag)("active", (0, _styledComponents.css)(["color:#fff;background-image:linear-gradient( ", ",", " );&:enabled:active{background-image:none;background-color:#fff;color:", ";}"], (0, _utils.getThemeProp)(["colors", "application", "base"], "#333", function (color) {
|
|
28
|
-
return (0, _polished.tint)(0.05, color);
|
|
29
|
-
}), (0, _utils.getThemeProp)(["colors", "application", "base"], "#333"), (0, _utils.getThemeProp)(["colors", "application", "base"], "#333")), (0, _styledComponents.css)(["color:", ";background-image:none;background-color:#fff;&:enabled:active{color:#fff;background-image:linear-gradient( ", ",", " );}"], (0, _utils.getThemeProp)(["colors", "application", "base"], "#333"), (0, _utils.getThemeProp)(["colors", "application", "base"], "#333", function (color) {
|
|
30
|
-
return (0, _polished.tint)(0.05, color);
|
|
31
|
-
}), (0, _utils.getThemeProp)(["colors", "application", "base"], "#333"))), (0, _utils.ifFlag)("active", (0, _styledComponents.css)(["background-image:none;background-color:", ";&:enabled:active{background-color:#f7f7f7;}"], (0, _utils.getThemeProp)(["colors", "bgLight"], "#efefef")), (0, _styledComponents.css)(["background-image:none;background-color:#f7f7f7;&:enabled:active{background-color:", ";}"], (0, _utils.getThemeProp)(["colors", "bgLight"], "#efefef"))));
|
|
32
|
-
var Button = _styledComponents.default.button.withConfig({
|
|
33
|
-
displayName: "Button",
|
|
34
|
-
componentId: "sc-1rffh1n-0"
|
|
35
|
-
})(["display:inline-block;margin:0;font-weight:400;text-align:center;vertical-align:middle;cursor:pointer;white-space:nowrap;padding:6px 10px;font-size:13px;line-height:1.42857;border-radius:4px;user-select:none;height:30px;border:1px solid ", ";outline:none;font-family:", ";text-transform:uppercase;min-width:50px;box-shadow:0 1px 1px 0 rgba(0,0,0,0.1);", ";&:enabled:active,&:enabled:focus,&:enabled:hover{border-color:", ";box-shadow:0 0 4px #4fa1f0;outline:none;}&:disabled{opacity:0.6;cursor:default;}"], borderColor((0, _utils.getThemeProp)(["colors", "borderLight"], "#cccccc")), (0, _utils.getThemeProp)(["fonts", "header"], "sans-serif"), background, borderColor("#4fa1f0"));
|
|
36
|
-
var _default = Button;
|
|
37
|
-
var _default2 = _default;
|
|
38
|
-
var _default3 = exports.default = _default2;
|
|
39
|
-
;
|
|
40
|
-
(function () {
|
|
41
|
-
var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
|
|
42
|
-
if (!reactHotLoader) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
reactHotLoader.register(borderColor, "borderColor", "/home/vsts/work/1/s/src/components/Button.js");
|
|
46
|
-
reactHotLoader.register(background, "background", "/home/vsts/work/1/s/src/components/Button.js");
|
|
47
|
-
reactHotLoader.register(Button, "Button", "/home/vsts/work/1/s/src/components/Button.js");
|
|
48
|
-
reactHotLoader.register(_default, "default", "/home/vsts/work/1/s/src/components/Button.js");
|
|
49
|
-
})();
|
|
50
|
-
;
|
|
51
|
-
(function () {
|
|
52
|
-
var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
|
|
53
|
-
leaveModule && leaveModule(module);
|
|
54
|
-
})();
|
|
55
|
-
;
|
|
56
|
-
(function () {
|
|
57
|
-
var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
|
|
58
|
-
if (!reactHotLoader) {
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
reactHotLoader.register(borderColor, "borderColor", "/home/vsts/work/1/s/src/components/Button.js");
|
|
62
|
-
reactHotLoader.register(background, "background", "/home/vsts/work/1/s/src/components/Button.js");
|
|
63
|
-
reactHotLoader.register(Button, "Button", "/home/vsts/work/1/s/src/components/Button.js");
|
|
64
|
-
reactHotLoader.register(_default2, "default", "/home/vsts/work/1/s/src/components/Button.js");
|
|
65
|
-
})();
|
|
66
|
-
;
|
|
67
|
-
(function () {
|
|
68
|
-
var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
|
|
69
|
-
leaveModule && leaveModule(module);
|
|
70
|
-
})();
|