@dhis2/analytics 25.2.3 → 26.0.0
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/build/cjs/__demo__/FileMenu.stories.js +8 -6
- package/build/cjs/__demo__/Toolbar.stories.js +77 -0
- package/build/cjs/components/FileMenu/FileMenu.js +21 -59
- package/build/cjs/components/FileMenu/__tests__/FileMenu.spec.js +318 -194
- package/build/cjs/components/Options/VisualizationOptions.js +3 -1
- package/build/cjs/components/Toolbar/HoverMenuBar/HoverMenuBar.js +107 -0
- package/build/cjs/components/Toolbar/HoverMenuBar/HoverMenuDropdown.js +66 -0
- package/build/cjs/components/Toolbar/HoverMenuBar/HoverMenuList.js +94 -0
- package/build/cjs/components/Toolbar/HoverMenuBar/HoverMenuListItem.js +99 -0
- package/build/cjs/components/Toolbar/HoverMenuBar/HoverMenuListItem.styles.js +13 -0
- package/build/cjs/components/Toolbar/HoverMenuBar/__tests__/HoverMenuBar.spec.js +219 -0
- package/build/cjs/components/Toolbar/HoverMenuBar/__tests__/HoverMenuDropdown.spec.js +23 -0
- package/build/cjs/components/Toolbar/HoverMenuBar/__tests__/HoverMenuList.spec.js +56 -0
- package/build/cjs/components/Toolbar/HoverMenuBar/__tests__/HoverMenuListItem.spec.js +50 -0
- package/build/cjs/components/Toolbar/HoverMenuBar/index.js +37 -0
- package/build/cjs/components/Toolbar/InterpretationsAndDetailsToggler.js +50 -0
- package/build/cjs/components/Toolbar/MenuButton.styles.js +13 -0
- package/build/cjs/components/Toolbar/Toolbar.js +39 -0
- package/build/cjs/components/Toolbar/ToolbarSidebar.js +45 -0
- package/build/cjs/components/Toolbar/UpdateButton.js +57 -0
- package/build/cjs/components/Toolbar/__tests__/InterpretationsAndDetailsToggler.spec.js +50 -0
- package/build/cjs/components/Toolbar/__tests__/Toolbar.spec.js +24 -0
- package/build/cjs/components/Toolbar/__tests__/ToolbarSidebar.spec.js +30 -0
- package/build/cjs/components/Toolbar/__tests__/UpdateButton.spec.js +44 -0
- package/build/cjs/components/Toolbar/index.js +57 -0
- package/build/cjs/index.js +304 -46
- package/build/cjs/locales/en/translations.json +1 -0
- package/build/es/__demo__/FileMenu.stories.js +7 -6
- package/build/es/__demo__/Toolbar.stories.js +69 -0
- package/build/es/components/FileMenu/FileMenu.js +20 -57
- package/build/es/components/FileMenu/__tests__/FileMenu.spec.js +293 -189
- package/build/es/components/Options/VisualizationOptions.js +3 -1
- package/build/es/components/Toolbar/HoverMenuBar/HoverMenuBar.js +90 -0
- package/build/es/components/Toolbar/HoverMenuBar/HoverMenuDropdown.js +44 -0
- package/build/es/components/Toolbar/HoverMenuBar/HoverMenuList.js +75 -0
- package/build/es/components/Toolbar/HoverMenuBar/HoverMenuListItem.js +78 -0
- package/build/es/components/Toolbar/HoverMenuBar/HoverMenuListItem.styles.js +4 -0
- package/build/es/components/Toolbar/HoverMenuBar/__tests__/HoverMenuBar.spec.js +168 -0
- package/build/es/components/Toolbar/HoverMenuBar/__tests__/HoverMenuDropdown.spec.js +16 -0
- package/build/es/components/Toolbar/HoverMenuBar/__tests__/HoverMenuList.spec.js +49 -0
- package/build/es/components/Toolbar/HoverMenuBar/__tests__/HoverMenuListItem.spec.js +41 -0
- package/build/es/components/Toolbar/HoverMenuBar/index.js +4 -0
- package/build/es/components/Toolbar/InterpretationsAndDetailsToggler.js +33 -0
- package/build/es/components/Toolbar/MenuButton.styles.js +4 -0
- package/build/es/components/Toolbar/Toolbar.js +24 -0
- package/build/es/components/Toolbar/ToolbarSidebar.js +29 -0
- package/build/es/components/Toolbar/UpdateButton.js +38 -0
- package/build/es/components/Toolbar/__tests__/InterpretationsAndDetailsToggler.spec.js +43 -0
- package/build/es/components/Toolbar/__tests__/Toolbar.spec.js +17 -0
- package/build/es/components/Toolbar/__tests__/ToolbarSidebar.spec.js +23 -0
- package/build/es/components/Toolbar/__tests__/UpdateButton.spec.js +37 -0
- package/build/es/components/Toolbar/index.js +5 -0
- package/build/es/index.js +1 -0
- package/build/es/locales/en/translations.json +1 -0
- package/package.json +3 -1
- package/CHANGELOG.md +0 -4072
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _enzyme = require("enzyme");
|
|
4
|
+
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
|
|
7
|
+
var _index = require("../index.js");
|
|
8
|
+
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
|
|
11
|
+
describe('<HoverMenuList/>', () => {
|
|
12
|
+
const dataTest = 'test';
|
|
13
|
+
const childNode = 'children';
|
|
14
|
+
it('renders children', () => {
|
|
15
|
+
const wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react.default.createElement(_index.HoverMenuList, null, childNode));
|
|
16
|
+
expect(wrapper.containsMatchingElement(childNode)).toBe(true);
|
|
17
|
+
});
|
|
18
|
+
it('accept a `className` prop', () => {
|
|
19
|
+
const className = 'className';
|
|
20
|
+
const wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react.default.createElement(_index.HoverMenuList, {
|
|
21
|
+
className: className
|
|
22
|
+
}, childNode));
|
|
23
|
+
expect(wrapper.find('ul')).toHaveClassName(className);
|
|
24
|
+
});
|
|
25
|
+
it('accepts a `dataTest` prop', () => {
|
|
26
|
+
const wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react.default.createElement(_index.HoverMenuList, {
|
|
27
|
+
dataTest: dataTest
|
|
28
|
+
}, childNode));
|
|
29
|
+
expect(wrapper.find('ul').prop('data-test')).toBe(dataTest);
|
|
30
|
+
});
|
|
31
|
+
it('accept a `dense` prop', () => {
|
|
32
|
+
const wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react.default.createElement(_index.HoverMenuList, {
|
|
33
|
+
dense: true
|
|
34
|
+
}, /*#__PURE__*/_react.default.createElement(_index.HoverMenuListItem, {
|
|
35
|
+
label: "item 1"
|
|
36
|
+
}), /*#__PURE__*/_react.default.createElement(_index.HoverMenuListItem, {
|
|
37
|
+
label: "item 2"
|
|
38
|
+
})));
|
|
39
|
+
expect(wrapper.find('li').first()).toHaveClassName('dense');
|
|
40
|
+
expect(wrapper.find('li').last()).toHaveClassName('dense');
|
|
41
|
+
});
|
|
42
|
+
it('accept a `maxHeight` prop', () => {
|
|
43
|
+
const maxHeight = '100000px';
|
|
44
|
+
const wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react.default.createElement(_index.HoverMenuList, {
|
|
45
|
+
maxHeight: maxHeight
|
|
46
|
+
}, childNode));
|
|
47
|
+
expect(wrapper.find('style').text()).toContain("max-height: ".concat(maxHeight));
|
|
48
|
+
});
|
|
49
|
+
it('accept a `maxWidth` prop', () => {
|
|
50
|
+
const maxWidth = '100000px';
|
|
51
|
+
const wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react.default.createElement(_index.HoverMenuList, {
|
|
52
|
+
maxWidth: maxWidth
|
|
53
|
+
}, childNode));
|
|
54
|
+
expect(wrapper.find('style').text()).toContain("max-width: ".concat(maxWidth));
|
|
55
|
+
});
|
|
56
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _enzyme = require("enzyme");
|
|
4
|
+
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
|
|
7
|
+
var _index = require("../index.js");
|
|
8
|
+
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
|
|
11
|
+
describe('<HoverMenuListItem/>', () => {
|
|
12
|
+
/* Some of the props for this component are included
|
|
13
|
+
* in the mouse interaction tests for the HoverMenuBar.
|
|
14
|
+
* Only the `className`, `dataTest`, `destructive` and
|
|
15
|
+
* `icon` prop need to be verified here. */
|
|
16
|
+
it('accepts a `className` prop', () => {
|
|
17
|
+
const className = 'className';
|
|
18
|
+
const wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react.default.createElement(_index.HoverMenuListItem, {
|
|
19
|
+
className: className
|
|
20
|
+
}));
|
|
21
|
+
expect(wrapper.find('li')).toHaveClassName(className);
|
|
22
|
+
});
|
|
23
|
+
it('accepts a `dataTest` prop', () => {
|
|
24
|
+
const dataTest = 'test';
|
|
25
|
+
const wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react.default.createElement(_index.HoverMenuListItem, {
|
|
26
|
+
dataTest: dataTest
|
|
27
|
+
}));
|
|
28
|
+
expect(wrapper.find('li').prop('data-test')).toBe(dataTest);
|
|
29
|
+
});
|
|
30
|
+
it('accepts a `destructive` prop', () => {
|
|
31
|
+
const wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react.default.createElement(_index.HoverMenuListItem, {
|
|
32
|
+
destructive: true
|
|
33
|
+
}));
|
|
34
|
+
expect(wrapper.find('li')).toHaveClassName('destructive');
|
|
35
|
+
});
|
|
36
|
+
it('accepts an `icon` prop', () => {
|
|
37
|
+
const iconText = 'I am an icon';
|
|
38
|
+
|
|
39
|
+
const icon = /*#__PURE__*/_react.default.createElement("span", {
|
|
40
|
+
id: "testicon"
|
|
41
|
+
}, iconText);
|
|
42
|
+
|
|
43
|
+
const wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react.default.createElement(_index.HoverMenuListItem, {
|
|
44
|
+
icon: icon
|
|
45
|
+
}));
|
|
46
|
+
expect(wrapper.find('span.icon')).toExist();
|
|
47
|
+
expect(wrapper.find('span#testicon')).toExist();
|
|
48
|
+
expect(wrapper.find('span#testicon').text()).toBe(iconText);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "HoverMenuBar", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _HoverMenuBar.HoverMenuBar;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "HoverMenuDropdown", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _HoverMenuDropdown.HoverMenuDropdown;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "HoverMenuList", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _HoverMenuList.HoverMenuList;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "HoverMenuListItem", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _HoverMenuListItem.HoverMenuListItem;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
var _HoverMenuBar = require("./HoverMenuBar.js");
|
|
32
|
+
|
|
33
|
+
var _HoverMenuDropdown = require("./HoverMenuDropdown.js");
|
|
34
|
+
|
|
35
|
+
var _HoverMenuList = require("./HoverMenuList.js");
|
|
36
|
+
|
|
37
|
+
var _HoverMenuListItem = require("./HoverMenuListItem.js");
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.InterpretationsAndDetailsToggler = void 0;
|
|
7
|
+
|
|
8
|
+
var _style = _interopRequireDefault(require("styled-jsx/style"));
|
|
9
|
+
|
|
10
|
+
var _d2I18n = _interopRequireDefault(require("@dhis2/d2-i18n"));
|
|
11
|
+
|
|
12
|
+
var _ui = require("@dhis2/ui");
|
|
13
|
+
|
|
14
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
+
|
|
16
|
+
var _react = _interopRequireDefault(require("react"));
|
|
17
|
+
|
|
18
|
+
var _MenuButtonStyles = _interopRequireDefault(require("./MenuButton.styles.js"));
|
|
19
|
+
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
+
|
|
22
|
+
const InterpretationsAndDetailsToggler = _ref => {
|
|
23
|
+
let {
|
|
24
|
+
onClick,
|
|
25
|
+
dataTest,
|
|
26
|
+
disabled,
|
|
27
|
+
isShowing
|
|
28
|
+
} = _ref;
|
|
29
|
+
return /*#__PURE__*/_react.default.createElement("button", {
|
|
30
|
+
onClick: onClick,
|
|
31
|
+
disabled: disabled,
|
|
32
|
+
"data-test": dataTest,
|
|
33
|
+
className: "jsx-1238484262 " + "jsx-".concat(_MenuButtonStyles.default.__hash)
|
|
34
|
+
}, isShowing ? /*#__PURE__*/_react.default.createElement(_ui.IconChevronRight24, null) : /*#__PURE__*/_react.default.createElement(_ui.IconChevronLeft24, null), _d2I18n.default.t('Interpretations and details'), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
35
|
+
id: _MenuButtonStyles.default.__hash
|
|
36
|
+
}, _MenuButtonStyles.default), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
37
|
+
id: "1238484262"
|
|
38
|
+
}, ["button.jsx-1238484262{gap:8px;}"]));
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
exports.InterpretationsAndDetailsToggler = InterpretationsAndDetailsToggler;
|
|
42
|
+
InterpretationsAndDetailsToggler.defaultProps = {
|
|
43
|
+
dataTest: 'dhis2-analytics-interpretationsanddetailstoggler'
|
|
44
|
+
};
|
|
45
|
+
InterpretationsAndDetailsToggler.propTypes = {
|
|
46
|
+
onClick: _propTypes.default.func.isRequired,
|
|
47
|
+
dataTest: _propTypes.default.string,
|
|
48
|
+
disabled: _propTypes.default.bool,
|
|
49
|
+
isShowing: _propTypes.default.bool
|
|
50
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _uiConstants = require("@dhis2/ui-constants");
|
|
9
|
+
|
|
10
|
+
const _defaultExport = ["button.jsx-4266781296{all:unset;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;font-size:14px;line-height:14px;padding:0 ".concat(_uiConstants.spacers.dp12, ";color:").concat(_uiConstants.colors.grey900, ";-webkit-transition:background-color 250ms cubic-bezier(0.4,0,0.2,1) 0ms;transition:background-color 250ms cubic-bezier(0.4,0,0.2,1) 0ms;cursor:pointer;}"), "button.jsx-4266781296:hover.jsx-4266781296:enabled,button.jsx-4266781296:active{background-color:".concat(_uiConstants.colors.grey200, ";}"), "button.jsx-4266781296:focus{outline:3px solid ".concat(_uiConstants.theme.focus, ";outline-offset:-3px;}"), "button.jsx-4266781296:focus.jsx-4266781296:not(:focus-visible){outline:none;}", "button.jsx-4266781296:disabled{color:".concat(_uiConstants.colors.grey500, ";cursor:not-allowed;}")];
|
|
11
|
+
_defaultExport.__hash = "4266781296";
|
|
12
|
+
var _default = _defaultExport;
|
|
13
|
+
exports.default = _default;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Toolbar = void 0;
|
|
7
|
+
|
|
8
|
+
var _style = _interopRequireDefault(require("styled-jsx/style"));
|
|
9
|
+
|
|
10
|
+
var _uiConstants = require("@dhis2/ui-constants");
|
|
11
|
+
|
|
12
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
+
|
|
14
|
+
var _react = _interopRequireDefault(require("react"));
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
18
|
+
const Toolbar = _ref => {
|
|
19
|
+
let {
|
|
20
|
+
children,
|
|
21
|
+
dataTest
|
|
22
|
+
} = _ref;
|
|
23
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
24
|
+
"data-test": dataTest,
|
|
25
|
+
className: _style.default.dynamic([["2617706539", [_uiConstants.colors.grey400, _uiConstants.colors.white]]])
|
|
26
|
+
}, children, /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
27
|
+
id: "2617706539",
|
|
28
|
+
dynamic: [_uiConstants.colors.grey400, _uiConstants.colors.white]
|
|
29
|
+
}, ["div.__jsx-style-dynamic-selector{box-sizing:border-box;min-height:32px;max-height:32px;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:stretch;-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch;border-bottom:1px solid ".concat(_uiConstants.colors.grey400, ";background-color:").concat(_uiConstants.colors.white, ";}")]));
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
exports.Toolbar = Toolbar;
|
|
33
|
+
Toolbar.defaultProps = {
|
|
34
|
+
dataTest: 'dhis2-analytics-toolbar'
|
|
35
|
+
};
|
|
36
|
+
Toolbar.propTypes = {
|
|
37
|
+
children: _propTypes.default.node,
|
|
38
|
+
dataTest: _propTypes.default.string
|
|
39
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ToolbarSidebar = void 0;
|
|
7
|
+
|
|
8
|
+
var _style = _interopRequireDefault(require("styled-jsx/style"));
|
|
9
|
+
|
|
10
|
+
var _uiConstants = require("@dhis2/ui-constants");
|
|
11
|
+
|
|
12
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
+
|
|
14
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
+
|
|
16
|
+
var _react = _interopRequireDefault(require("react"));
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
|
|
20
|
+
const ToolbarSidebar = _ref => {
|
|
21
|
+
let {
|
|
22
|
+
children,
|
|
23
|
+
dataTest,
|
|
24
|
+
isHidden
|
|
25
|
+
} = _ref;
|
|
26
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
27
|
+
"data-test": dataTest,
|
|
28
|
+
className: _style.default.dynamic([["1150014343", [_uiConstants.colors.grey400]]]) + " " + ((0, _classnames.default)('container', {
|
|
29
|
+
isHidden
|
|
30
|
+
}) || "")
|
|
31
|
+
}, children, /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
32
|
+
id: "1150014343",
|
|
33
|
+
dynamic: [_uiConstants.colors.grey400]
|
|
34
|
+
}, ["div.__jsx-style-dynamic-selector{width:260px;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:stretch;-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch;border-right:1px solid ".concat(_uiConstants.colors.grey400, ";}"), "div.isHidden.__jsx-style-dynamic-selector{display:none;}"]));
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
exports.ToolbarSidebar = ToolbarSidebar;
|
|
38
|
+
ToolbarSidebar.defaultProps = {
|
|
39
|
+
dataTest: 'dhis2-analytics-toolbarsidebar'
|
|
40
|
+
};
|
|
41
|
+
ToolbarSidebar.propTypes = {
|
|
42
|
+
children: _propTypes.default.node,
|
|
43
|
+
dataTest: _propTypes.default.string,
|
|
44
|
+
isHidden: _propTypes.default.bool
|
|
45
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.UpdateButton = void 0;
|
|
7
|
+
|
|
8
|
+
var _style = _interopRequireDefault(require("styled-jsx/style"));
|
|
9
|
+
|
|
10
|
+
var _loader = require("@dhis2-ui/loader");
|
|
11
|
+
|
|
12
|
+
var _d2I18n = _interopRequireDefault(require("@dhis2/d2-i18n"));
|
|
13
|
+
|
|
14
|
+
var _uiConstants = require("@dhis2/ui-constants");
|
|
15
|
+
|
|
16
|
+
var _uiIcons = require("@dhis2/ui-icons");
|
|
17
|
+
|
|
18
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
19
|
+
|
|
20
|
+
var _react = _interopRequireDefault(require("react"));
|
|
21
|
+
|
|
22
|
+
var _MenuButtonStyles = _interopRequireDefault(require("./MenuButton.styles.js"));
|
|
23
|
+
|
|
24
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
+
|
|
26
|
+
const UpdateButton = _ref => {
|
|
27
|
+
let {
|
|
28
|
+
onClick,
|
|
29
|
+
disabled,
|
|
30
|
+
loading,
|
|
31
|
+
dataTest
|
|
32
|
+
} = _ref;
|
|
33
|
+
return /*#__PURE__*/_react.default.createElement("button", {
|
|
34
|
+
onClick: onClick,
|
|
35
|
+
disabled: disabled,
|
|
36
|
+
"data-test": dataTest,
|
|
37
|
+
className: "jsx-".concat(_MenuButtonStyles.default.__hash) + " " + _style.default.dynamic([["2364287882", [_uiConstants.colors.blue700, _uiConstants.colors.blue100, _uiConstants.colors.blue200]]])
|
|
38
|
+
}, loading ? /*#__PURE__*/_react.default.createElement(_loader.CircularLoader, {
|
|
39
|
+
extrasmall: true
|
|
40
|
+
}) : /*#__PURE__*/_react.default.createElement(_uiIcons.IconSync16, null), _d2I18n.default.t('Update'), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
41
|
+
id: _MenuButtonStyles.default.__hash
|
|
42
|
+
}, _MenuButtonStyles.default), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
43
|
+
id: "2364287882",
|
|
44
|
+
dynamic: [_uiConstants.colors.blue700, _uiConstants.colors.blue100, _uiConstants.colors.blue200]
|
|
45
|
+
}, ["button.__jsx-style-dynamic-selector{gap:8px;color:".concat(_uiConstants.colors.blue700, ";font-weight:500;}"), "button.__jsx-style-dynamic-selector:hover.__jsx-style-dynamic-selector:enabled{background:".concat(_uiConstants.colors.blue100, ";}"), "button.__jsx-style-dynamic-selector:active{background:".concat(_uiConstants.colors.blue200, ";}")]));
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
exports.UpdateButton = UpdateButton;
|
|
49
|
+
UpdateButton.defaultProps = {
|
|
50
|
+
dataTest: 'dhis2-analytics-updatebutton'
|
|
51
|
+
};
|
|
52
|
+
UpdateButton.propTypes = {
|
|
53
|
+
onClick: _propTypes.default.func.isRequired,
|
|
54
|
+
dataTest: _propTypes.default.string,
|
|
55
|
+
disabled: _propTypes.default.bool,
|
|
56
|
+
loading: _propTypes.default.bool
|
|
57
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _enzyme = require("enzyme");
|
|
4
|
+
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
|
|
7
|
+
var _index = require("../index.js");
|
|
8
|
+
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
|
|
11
|
+
describe('<InterpretationsAndDetailsToggler/>', () => {
|
|
12
|
+
const noop = () => {};
|
|
13
|
+
|
|
14
|
+
it('accepts an `onClick` prop', () => {
|
|
15
|
+
const onClick = jest.fn();
|
|
16
|
+
const wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react.default.createElement(_index.InterpretationsAndDetailsToggler, {
|
|
17
|
+
onClick: onClick
|
|
18
|
+
}));
|
|
19
|
+
wrapper.simulate('click');
|
|
20
|
+
expect(onClick).toHaveBeenCalledTimes(1);
|
|
21
|
+
});
|
|
22
|
+
it('accepts a `dataTest` prop', () => {
|
|
23
|
+
const dataTest = 'test';
|
|
24
|
+
const wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react.default.createElement(_index.InterpretationsAndDetailsToggler, {
|
|
25
|
+
onClick: noop,
|
|
26
|
+
dataTest: dataTest
|
|
27
|
+
}));
|
|
28
|
+
expect(wrapper.prop('data-test')).toBe(dataTest);
|
|
29
|
+
});
|
|
30
|
+
it('accepts a `disabled` prop', () => {
|
|
31
|
+
const wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react.default.createElement(_index.InterpretationsAndDetailsToggler, {
|
|
32
|
+
disabled: true,
|
|
33
|
+
onClick: noop
|
|
34
|
+
}));
|
|
35
|
+
expect(wrapper.find('button').prop('disabled')).toEqual(true);
|
|
36
|
+
});
|
|
37
|
+
it('accepts an `isShowing` prop', () => {
|
|
38
|
+
const wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react.default.createElement(_index.InterpretationsAndDetailsToggler, {
|
|
39
|
+
onClick: noop
|
|
40
|
+
}));
|
|
41
|
+
const wrapperWithIsShowing = (0, _enzyme.shallow)( /*#__PURE__*/_react.default.createElement(_index.InterpretationsAndDetailsToggler, {
|
|
42
|
+
isShowing: true,
|
|
43
|
+
onClick: noop
|
|
44
|
+
}));
|
|
45
|
+
expect(wrapper.find('SvgChevronRight24')).toHaveLength(0);
|
|
46
|
+
expect(wrapper.find('SvgChevronLeft24')).toHaveLength(1);
|
|
47
|
+
expect(wrapperWithIsShowing.find('SvgChevronRight24')).toHaveLength(1);
|
|
48
|
+
expect(wrapperWithIsShowing.find('SvgChevronLeft24')).toHaveLength(0);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _enzyme = require("enzyme");
|
|
4
|
+
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
|
|
7
|
+
var _index = require("../index.js");
|
|
8
|
+
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
|
|
11
|
+
describe('<Toolbar/>', () => {
|
|
12
|
+
it('renders children', () => {
|
|
13
|
+
const childNode = 'text node';
|
|
14
|
+
const wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react.default.createElement(_index.Toolbar, null, childNode));
|
|
15
|
+
expect(wrapper.containsMatchingElement(childNode)).toBe(true);
|
|
16
|
+
});
|
|
17
|
+
it('accepts a `dataTest` prop', () => {
|
|
18
|
+
const dataTest = 'test';
|
|
19
|
+
const wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react.default.createElement(_index.Toolbar, {
|
|
20
|
+
dataTest: dataTest
|
|
21
|
+
}));
|
|
22
|
+
expect(wrapper.prop('data-test')).toBe(dataTest);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _enzyme = require("enzyme");
|
|
4
|
+
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
|
|
7
|
+
var _index = require("../index.js");
|
|
8
|
+
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
|
|
11
|
+
describe('<ToolbarSidebar/>', () => {
|
|
12
|
+
it('renders children', () => {
|
|
13
|
+
const childNode = 'text node';
|
|
14
|
+
const wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react.default.createElement(_index.ToolbarSidebar, null, childNode));
|
|
15
|
+
expect(wrapper.containsMatchingElement(childNode)).toBe(true);
|
|
16
|
+
});
|
|
17
|
+
it('accepts a `dataTest` prop', () => {
|
|
18
|
+
const dataTest = 'test';
|
|
19
|
+
const wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react.default.createElement(_index.ToolbarSidebar, {
|
|
20
|
+
dataTest: dataTest
|
|
21
|
+
}));
|
|
22
|
+
expect(wrapper.prop('data-test')).toBe(dataTest);
|
|
23
|
+
});
|
|
24
|
+
it('accepts a `isHidden` prop', () => {
|
|
25
|
+
const wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react.default.createElement(_index.ToolbarSidebar, {
|
|
26
|
+
isHidden: true
|
|
27
|
+
}));
|
|
28
|
+
expect(wrapper.find('div').hasClass('isHidden')).toEqual(true);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _enzyme = require("enzyme");
|
|
4
|
+
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
|
|
7
|
+
var _index = require("../index.js");
|
|
8
|
+
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
|
|
11
|
+
describe('<UpdateButton/>', () => {
|
|
12
|
+
const noop = () => {};
|
|
13
|
+
|
|
14
|
+
it('accepts an `onClick` prop', () => {
|
|
15
|
+
const onClick = jest.fn();
|
|
16
|
+
const wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react.default.createElement(_index.UpdateButton, {
|
|
17
|
+
onClick: onClick
|
|
18
|
+
}));
|
|
19
|
+
wrapper.simulate('click');
|
|
20
|
+
expect(onClick).toHaveBeenCalledTimes(1);
|
|
21
|
+
});
|
|
22
|
+
it('accepts a `dataTest` prop', () => {
|
|
23
|
+
const dataTest = 'test';
|
|
24
|
+
const wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react.default.createElement(_index.UpdateButton, {
|
|
25
|
+
onClick: noop,
|
|
26
|
+
dataTest: dataTest
|
|
27
|
+
}));
|
|
28
|
+
expect(wrapper.prop('data-test')).toBe(dataTest);
|
|
29
|
+
});
|
|
30
|
+
it('accepts a `disabled` prop', () => {
|
|
31
|
+
const wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react.default.createElement(_index.UpdateButton, {
|
|
32
|
+
disabled: true,
|
|
33
|
+
onClick: noop
|
|
34
|
+
}));
|
|
35
|
+
expect(wrapper.find('button').prop('disabled')).toEqual(true);
|
|
36
|
+
});
|
|
37
|
+
it('accepts an `loading` prop', () => {
|
|
38
|
+
const wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react.default.createElement(_index.UpdateButton, {
|
|
39
|
+
onClick: noop,
|
|
40
|
+
loading: true
|
|
41
|
+
}));
|
|
42
|
+
expect(wrapper.find('CircularLoader')).toHaveLength(1);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
InterpretationsAndDetailsToggler: true,
|
|
8
|
+
Toolbar: true,
|
|
9
|
+
ToolbarSidebar: true,
|
|
10
|
+
UpdateButton: true
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "InterpretationsAndDetailsToggler", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _InterpretationsAndDetailsToggler.InterpretationsAndDetailsToggler;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "Toolbar", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _Toolbar.Toolbar;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "ToolbarSidebar", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _ToolbarSidebar.ToolbarSidebar;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "UpdateButton", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _UpdateButton.UpdateButton;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
var _InterpretationsAndDetailsToggler = require("./InterpretationsAndDetailsToggler.js");
|
|
38
|
+
|
|
39
|
+
var _Toolbar = require("./Toolbar.js");
|
|
40
|
+
|
|
41
|
+
var _ToolbarSidebar = require("./ToolbarSidebar.js");
|
|
42
|
+
|
|
43
|
+
var _UpdateButton = require("./UpdateButton.js");
|
|
44
|
+
|
|
45
|
+
var _index = require("./HoverMenuBar/index.js");
|
|
46
|
+
|
|
47
|
+
Object.keys(_index).forEach(function (key) {
|
|
48
|
+
if (key === "default" || key === "__esModule") return;
|
|
49
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
50
|
+
if (key in exports && exports[key] === _index[key]) return;
|
|
51
|
+
Object.defineProperty(exports, key, {
|
|
52
|
+
enumerable: true,
|
|
53
|
+
get: function () {
|
|
54
|
+
return _index[key];
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
});
|