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
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.switchEnum = exports.ifFlag = exports.getThemeProp = void 0;
|
|
5
|
-
var _safeGet = _interopRequireDefault(require("./safeGet"));
|
|
6
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
|
-
(function () {
|
|
8
|
-
var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
|
|
9
|
-
enterModule && enterModule(module);
|
|
10
|
-
})();
|
|
11
|
-
(function () {
|
|
12
|
-
var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
|
|
13
|
-
enterModule && enterModule(module);
|
|
14
|
-
})();
|
|
15
|
-
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
|
|
16
|
-
return a;
|
|
17
|
-
};
|
|
18
|
-
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
|
|
19
|
-
return a;
|
|
20
|
-
};
|
|
21
|
-
var feedPropFunc = function feedPropFunc(props) {
|
|
22
|
-
return function (value) {
|
|
23
|
-
return typeof value === "function" ? value(props) : value;
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
/* Safely gets a (potentially nested) theme property, can run a function on the resulting value */
|
|
28
|
-
var getThemeProp = exports.getThemeProp = function getThemeProp(path, defaultValue, func) {
|
|
29
|
-
if (func === void 0) {
|
|
30
|
-
func = function func(x) {
|
|
31
|
-
return x;
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
return function (props) {
|
|
35
|
-
return func(_safeGet.default.apply(void 0, [props, "theme"].concat(path.map(feedPropFunc(props)))) || feedPropFunc(props)(defaultValue));
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
/* Use in styled components to check if a prop has a truthy value and
|
|
40
|
-
return values based on that. */
|
|
41
|
-
var ifFlag = exports.ifFlag = function ifFlag(name, thenVal, elseVal) {
|
|
42
|
-
if (elseVal === void 0) {
|
|
43
|
-
elseVal = "";
|
|
44
|
-
}
|
|
45
|
-
return function (props) {
|
|
46
|
-
return props[name] ? feedPropFunc(props)(thenVal) : feedPropFunc(props)(elseVal);
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
/* Creates a prop function that checks a field against a list of cases,
|
|
51
|
-
and gives back a found case, or a default */
|
|
52
|
-
var switchEnum = exports.switchEnum = function switchEnum(enumField, cases) {
|
|
53
|
-
return function (props) {
|
|
54
|
-
return cases[props[enumField]] || cases["default"];
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
;
|
|
58
|
-
(function () {
|
|
59
|
-
var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
|
|
60
|
-
if (!reactHotLoader) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
reactHotLoader.register(feedPropFunc, "feedPropFunc", "/home/vsts/work/1/s/src/utils/styledPropFuncs.js");
|
|
64
|
-
reactHotLoader.register(getThemeProp, "getThemeProp", "/home/vsts/work/1/s/src/utils/styledPropFuncs.js");
|
|
65
|
-
reactHotLoader.register(ifFlag, "ifFlag", "/home/vsts/work/1/s/src/utils/styledPropFuncs.js");
|
|
66
|
-
reactHotLoader.register(switchEnum, "switchEnum", "/home/vsts/work/1/s/src/utils/styledPropFuncs.js");
|
|
67
|
-
})();
|
|
68
|
-
;
|
|
69
|
-
(function () {
|
|
70
|
-
var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
|
|
71
|
-
leaveModule && leaveModule(module);
|
|
72
|
-
})();
|
|
73
|
-
;
|
|
74
|
-
(function () {
|
|
75
|
-
var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
|
|
76
|
-
if (!reactHotLoader) {
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
reactHotLoader.register(feedPropFunc, "feedPropFunc", "/home/vsts/work/1/s/src/utils/styledPropFuncs.js");
|
|
80
|
-
reactHotLoader.register(getThemeProp, "getThemeProp", "/home/vsts/work/1/s/src/utils/styledPropFuncs.js");
|
|
81
|
-
reactHotLoader.register(ifFlag, "ifFlag", "/home/vsts/work/1/s/src/utils/styledPropFuncs.js");
|
|
82
|
-
reactHotLoader.register(switchEnum, "switchEnum", "/home/vsts/work/1/s/src/utils/styledPropFuncs.js");
|
|
83
|
-
})();
|
|
84
|
-
;
|
|
85
|
-
(function () {
|
|
86
|
-
var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
|
|
87
|
-
leaveModule && leaveModule(module);
|
|
88
|
-
})();
|
package/src/components/Button.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import styled, { css } from "styled-components";
|
|
2
|
-
import { getThemeProp, ifFlag } from "../utils";
|
|
3
|
-
import { tint } from "polished";
|
|
4
|
-
|
|
5
|
-
const borderColor = base => ifFlag("primary", getThemeProp(["colors", "application", "base"], base), base);
|
|
6
|
-
|
|
7
|
-
const background = ifFlag(
|
|
8
|
-
"primary",
|
|
9
|
-
ifFlag(
|
|
10
|
-
"active",
|
|
11
|
-
css`
|
|
12
|
-
color: #fff;
|
|
13
|
-
background-image: linear-gradient(
|
|
14
|
-
${getThemeProp(["colors", "application", "base"], "#333", color => tint(0.05, color))},
|
|
15
|
-
${getThemeProp(["colors", "application", "base"], "#333")}
|
|
16
|
-
);
|
|
17
|
-
&:enabled:active {
|
|
18
|
-
background-image: none;
|
|
19
|
-
background-color: #fff;
|
|
20
|
-
color: ${getThemeProp(["colors", "application", "base"], "#333")};
|
|
21
|
-
}
|
|
22
|
-
`,
|
|
23
|
-
css`
|
|
24
|
-
color: ${getThemeProp(["colors", "application", "base"], "#333")};
|
|
25
|
-
background-image: none;
|
|
26
|
-
background-color: #fff;
|
|
27
|
-
&:enabled:active {
|
|
28
|
-
color: #fff;
|
|
29
|
-
background-image: linear-gradient(
|
|
30
|
-
${getThemeProp(["colors", "application", "base"], "#333", color => tint(0.05, color))},
|
|
31
|
-
${getThemeProp(["colors", "application", "base"], "#333")}
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
`,
|
|
35
|
-
),
|
|
36
|
-
ifFlag(
|
|
37
|
-
"active",
|
|
38
|
-
css`
|
|
39
|
-
background-image: none;
|
|
40
|
-
background-color: ${getThemeProp(["colors", "bgLight"], "#efefef")};
|
|
41
|
-
&:enabled:active {
|
|
42
|
-
background-color: #f7f7f7;
|
|
43
|
-
}
|
|
44
|
-
`,
|
|
45
|
-
css`
|
|
46
|
-
background-image: none;
|
|
47
|
-
background-color: #f7f7f7;
|
|
48
|
-
&:enabled:active {
|
|
49
|
-
background-color: ${getThemeProp(["colors", "bgLight"], "#efefef")};
|
|
50
|
-
}
|
|
51
|
-
`,
|
|
52
|
-
),
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
const Button = styled.button`
|
|
56
|
-
display: inline-block;
|
|
57
|
-
margin: 0;
|
|
58
|
-
font-weight: 400;
|
|
59
|
-
text-align: center;
|
|
60
|
-
vertical-align: middle;
|
|
61
|
-
cursor: pointer;
|
|
62
|
-
white-space: nowrap;
|
|
63
|
-
padding: 6px 10px;
|
|
64
|
-
font-size: 13px;
|
|
65
|
-
line-height: 1.42857;
|
|
66
|
-
border-radius: 4px;
|
|
67
|
-
user-select: none;
|
|
68
|
-
height: 30px;
|
|
69
|
-
border: 1px solid ${borderColor(getThemeProp(["colors", "borderLight"], "#cccccc"))};
|
|
70
|
-
outline: none;
|
|
71
|
-
font-family: ${getThemeProp(["fonts", "header"], "sans-serif")};
|
|
72
|
-
text-transform: uppercase;
|
|
73
|
-
min-width: 50px;
|
|
74
|
-
box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.1);
|
|
75
|
-
${background};
|
|
76
|
-
|
|
77
|
-
&:enabled:active,
|
|
78
|
-
&:enabled:focus,
|
|
79
|
-
&:enabled:hover {
|
|
80
|
-
border-color: ${borderColor("#4fa1f0")};
|
|
81
|
-
box-shadow: 0 0 4px #4fa1f0;
|
|
82
|
-
outline: none;
|
|
83
|
-
}
|
|
84
|
-
&:disabled {
|
|
85
|
-
opacity: 0.6;
|
|
86
|
-
cursor: default;
|
|
87
|
-
}
|
|
88
|
-
`;
|
|
89
|
-
|
|
90
|
-
export default Button;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import Button from "./Button";
|
|
3
|
-
|
|
4
|
-
describe("Button", () => {
|
|
5
|
-
let onClick;
|
|
6
|
-
beforeEach(() => {
|
|
7
|
-
onClick = () => {};
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
it("renders a button", () =>
|
|
11
|
-
expect(
|
|
12
|
-
<Button onClick={onClick}>Label</Button>,
|
|
13
|
-
"when mounted",
|
|
14
|
-
"to satisfy",
|
|
15
|
-
<button onClick={onClick}>Label</button>,
|
|
16
|
-
));
|
|
17
|
-
|
|
18
|
-
it("sets an inactive background-color", () =>
|
|
19
|
-
expect(<Button />, "when mounted", "to have style rules satisfying", "to contain", "background-color: #f7f7f7;"));
|
|
20
|
-
|
|
21
|
-
it("sets an active background-color", () =>
|
|
22
|
-
expect(
|
|
23
|
-
<Button active />,
|
|
24
|
-
"when mounted",
|
|
25
|
-
"to have style rules satisfying",
|
|
26
|
-
"to contain",
|
|
27
|
-
"background-color: #efefef;",
|
|
28
|
-
));
|
|
29
|
-
|
|
30
|
-
describe("primary", () => {
|
|
31
|
-
it("sets an inactive background gradient", () =>
|
|
32
|
-
expect(
|
|
33
|
-
<Button primary />,
|
|
34
|
-
"when mounted",
|
|
35
|
-
"to have style rules satisfying",
|
|
36
|
-
"to contain",
|
|
37
|
-
"background-color: #fff;",
|
|
38
|
-
));
|
|
39
|
-
|
|
40
|
-
it("sets an active background-color", () =>
|
|
41
|
-
expect(
|
|
42
|
-
<Button primary active />,
|
|
43
|
-
"when mounted",
|
|
44
|
-
"to have style rules satisfying",
|
|
45
|
-
"to contain",
|
|
46
|
-
"background-image: linear-gradient( #3d3d3d,#333 )",
|
|
47
|
-
));
|
|
48
|
-
});
|
|
49
|
-
});
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Multiple lists with a single header, aligned with each other
|
|
3
|
-
No virtualization or page loading
|
|
4
|
-
Categories can be folded up to hide content
|
|
5
|
-
Sortable, within categories
|
|
6
|
-
*/
|
|
7
|
-
import React from "react";
|
|
8
|
-
import styled, { css } from "styled-components";
|
|
9
|
-
import { compose, setDisplayName } from "recompose";
|
|
10
|
-
import { safeGet, ifFlag, getThemeProp } from "../utils";
|
|
11
|
-
import withScrollBox from "../hocs/withScrollBox";
|
|
12
|
-
import useViewState from "../hooks/useViewState";
|
|
13
|
-
import Icon from "./Icon";
|
|
14
|
-
import Row from "./List/Row";
|
|
15
|
-
import HeadRow from "./List/HeadRow";
|
|
16
|
-
import { useListState, Table, Placeholder, HEADER_HEIGHT } from "./List/List";
|
|
17
|
-
|
|
18
|
-
const arrayToggle = (array, item) => (array.includes(item) ? array.filter(x => x !== item) : array.concat(item));
|
|
19
|
-
|
|
20
|
-
export const CategoryRow = styled.tr``;
|
|
21
|
-
|
|
22
|
-
export const CategoryHeader = styled.td`
|
|
23
|
-
border: 0 solid ${getThemeProp(["colors", "borderLight"], "#cccccc")};
|
|
24
|
-
border-top-width: 1px;
|
|
25
|
-
tr:first-child & {
|
|
26
|
-
border-top-width: 0;
|
|
27
|
-
}
|
|
28
|
-
tr:last-child & {
|
|
29
|
-
border-bottom-width: 1px;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
position: relative;
|
|
33
|
-
padding: 11px 45px;
|
|
34
|
-
background-color: #f1eae0;
|
|
35
|
-
${ifFlag(
|
|
36
|
-
"closed",
|
|
37
|
-
css`
|
|
38
|
-
border-bottom: 1px solid ${getThemeProp(["colors", "borderLight"], "#cccccc")};
|
|
39
|
-
`,
|
|
40
|
-
)}
|
|
41
|
-
cursor: pointer;
|
|
42
|
-
`;
|
|
43
|
-
|
|
44
|
-
export const CategoryIndicator = styled(Icon).attrs(props => ({
|
|
45
|
-
id: ifFlag(
|
|
46
|
-
"closed",
|
|
47
|
-
getThemeProp(["icons", "indicators", "right"], "chevron-right"),
|
|
48
|
-
getThemeProp(["icons", "indicators", "down"], "chevron-down"),
|
|
49
|
-
)(props),
|
|
50
|
-
}))`
|
|
51
|
-
font-size: 12px;
|
|
52
|
-
position: absolute;
|
|
53
|
-
left: 22px;
|
|
54
|
-
top: 15px;
|
|
55
|
-
`;
|
|
56
|
-
|
|
57
|
-
export const CategoryList = ({
|
|
58
|
-
name,
|
|
59
|
-
columnDefs = [],
|
|
60
|
-
rows = [],
|
|
61
|
-
rowOnClick,
|
|
62
|
-
placeholder,
|
|
63
|
-
keyField = ["id"],
|
|
64
|
-
categoryField = ["category"],
|
|
65
|
-
openAll = false,
|
|
66
|
-
height,
|
|
67
|
-
rowBackgroundGetter = () => {},
|
|
68
|
-
}) => {
|
|
69
|
-
const [enhancedColumnDefs, selection] = useListState(name, columnDefs);
|
|
70
|
-
const [{ closedCategories = [] }, updateViewState] = useViewState(name);
|
|
71
|
-
if (columnDefs.length === 0) return null;
|
|
72
|
-
const rowIds = [],
|
|
73
|
-
rowCategories = {};
|
|
74
|
-
rows.forEach((row, index) => {
|
|
75
|
-
const id = safeGet(row, ...keyField) + ""; // Ensure rowId is string
|
|
76
|
-
const category = safeGet(row, ...categoryField) || "";
|
|
77
|
-
rowIds.push(id);
|
|
78
|
-
if (!rowCategories[category]) {
|
|
79
|
-
rowCategories[category] = [];
|
|
80
|
-
}
|
|
81
|
-
rowCategories[category].push(
|
|
82
|
-
<Row
|
|
83
|
-
columnDefs={enhancedColumnDefs}
|
|
84
|
-
key={id}
|
|
85
|
-
rowId={id}
|
|
86
|
-
row={row}
|
|
87
|
-
rowOnClick={rowOnClick}
|
|
88
|
-
selected={selection.indexOf(id) !== -1}
|
|
89
|
-
bgColor={rowBackgroundGetter(row, index)}
|
|
90
|
-
/>,
|
|
91
|
-
);
|
|
92
|
-
});
|
|
93
|
-
const rowElements = [];
|
|
94
|
-
if (Object.keys(rowCategories).length === 0) {
|
|
95
|
-
if (placeholder) {
|
|
96
|
-
rowElements.push(
|
|
97
|
-
<Placeholder key="placeholder" width={columnDefs.length} height={height - HEADER_HEIGHT}>
|
|
98
|
-
{placeholder}
|
|
99
|
-
</Placeholder>,
|
|
100
|
-
);
|
|
101
|
-
}
|
|
102
|
-
} else {
|
|
103
|
-
Object.entries(rowCategories).forEach(([key, rows]) => {
|
|
104
|
-
const clickHandler = () => updateViewState("closedCategories", arrayToggle(closedCategories, key));
|
|
105
|
-
const closed = !openAll && closedCategories.includes(key);
|
|
106
|
-
rowElements.push(
|
|
107
|
-
<CategoryRow key={"category_" + key}>
|
|
108
|
-
<CategoryHeader
|
|
109
|
-
data-test-id={"category_" + key}
|
|
110
|
-
closed={closed}
|
|
111
|
-
colSpan={columnDefs.length}
|
|
112
|
-
onClick={clickHandler}
|
|
113
|
-
>
|
|
114
|
-
<CategoryIndicator closed={closed} />
|
|
115
|
-
{key}
|
|
116
|
-
</CategoryHeader>
|
|
117
|
-
</CategoryRow>,
|
|
118
|
-
);
|
|
119
|
-
if (!closed) {
|
|
120
|
-
rowElements.push(...rows);
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
return (
|
|
125
|
-
<Table>
|
|
126
|
-
<thead>
|
|
127
|
-
<HeadRow
|
|
128
|
-
columnDefs={enhancedColumnDefs}
|
|
129
|
-
rowIds={rowIds}
|
|
130
|
-
allSelected={rows.length === selection.length && rows.length !== 0}
|
|
131
|
-
/>
|
|
132
|
-
</thead>
|
|
133
|
-
<tbody>{rowElements}</tbody>
|
|
134
|
-
</Table>
|
|
135
|
-
);
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
const StatefulCategoryList = compose(setDisplayName("CategoryList"), withScrollBox)(CategoryList);
|
|
139
|
-
|
|
140
|
-
export default StatefulCategoryList;
|