@dhis2-ui/menu 10.16.3-alpha.1 → 10.16.4
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/flyout-menu/features/position/index.js +4 -8
- package/build/cjs/flyout-menu/flyout-menu.js +10 -12
- package/build/cjs/flyout-menu/flyout-menu.prod.stories.js +6 -8
- package/build/cjs/menu/helpers.js +1 -1
- package/build/cjs/menu/menu.js +7 -9
- package/build/cjs/menu/use-menu.js +2 -2
- package/build/cjs/menu-divider/menu-divider.js +13 -16
- package/build/cjs/menu-item/menu-item.js +40 -45
- package/build/cjs/menu-item/menu-item.prod.stories.js +1 -2
- package/build/cjs/menu-section-header/menu-section-header.js +19 -22
- package/build/cjs/menu-section-header/menu-section-header.prod.stories.js +8 -11
- package/build/es/flyout-menu/features/position/index.js +4 -8
- package/build/es/flyout-menu/flyout-menu.js +9 -10
- package/build/es/flyout-menu/flyout-menu.prod.stories.js +5 -6
- package/build/es/menu/helpers.js +1 -1
- package/build/es/menu/menu.js +6 -7
- package/build/es/menu/use-menu.js +2 -2
- package/build/es/menu-divider/menu-divider.js +13 -16
- package/build/es/menu-item/menu-item.js +39 -43
- package/build/es/menu-section-header/menu-section-header.js +19 -22
- package/build/es/menu-section-header/menu-section-header.prod.stories.js +8 -11
- package/package.json +8 -8
|
@@ -15,20 +15,17 @@ const CLOSE_TO_DELTA = 1;
|
|
|
15
15
|
cy.get('[data-test="dhis2-uicore-menuitem"]').click();
|
|
16
16
|
});
|
|
17
17
|
(0, _cypressCucumberPreprocessor.Then)('the right of the MenuItem is aligned with the left of the SubMenu', () => {
|
|
18
|
-
getMenuItemAndSubMenuRects().should(
|
|
19
|
-
let [menuItemRect, subMenuRect] = _ref;
|
|
18
|
+
getMenuItemAndSubMenuRects().should(([menuItemRect, subMenuRect]) => {
|
|
20
19
|
expect(menuItemRect.right).to.closeTo(subMenuRect.left, CLOSE_TO_DELTA);
|
|
21
20
|
});
|
|
22
21
|
});
|
|
23
22
|
(0, _cypressCucumberPreprocessor.Then)('the left of the MenuItem is aligned with the right of the SubMenu', () => {
|
|
24
|
-
getMenuItemAndSubMenuRects().should(
|
|
25
|
-
let [menuItemRect, subMenuRect] = _ref2;
|
|
23
|
+
getMenuItemAndSubMenuRects().should(([menuItemRect, subMenuRect]) => {
|
|
26
24
|
expect(menuItemRect.left).to.closeTo(subMenuRect.right, CLOSE_TO_DELTA);
|
|
27
25
|
});
|
|
28
26
|
});
|
|
29
27
|
(0, _cypressCucumberPreprocessor.Then)('the SubMenu is rendered on top of the MenuItem', () => {
|
|
30
|
-
getMenuItemAndSubMenuRects().should(
|
|
31
|
-
let [menuItemRect, subMenuRect] = _ref3;
|
|
28
|
+
getMenuItemAndSubMenuRects().should(([menuItemRect, subMenuRect]) => {
|
|
32
29
|
expect(subMenuRect.left).to.be.at.most(menuItemRect.right);
|
|
33
30
|
expect(subMenuRect.right).to.be.at.least(menuItemRect.left);
|
|
34
31
|
expect(subMenuRect.top).to.be.at.most(menuItemRect.bottom);
|
|
@@ -36,8 +33,7 @@ const CLOSE_TO_DELTA = 1;
|
|
|
36
33
|
});
|
|
37
34
|
});
|
|
38
35
|
(0, _cypressCucumberPreprocessor.Then)('the top of the MenuItem is aligned with the top of the SubMenu wrapper', () => {
|
|
39
|
-
cy.getPositionsBySelectors('[data-test="dhis2-uicore-menuitem"]', '[data-test="dhis2-uicore-popper"]').should(
|
|
40
|
-
let [menuItemRect, popperRect] = _ref4;
|
|
36
|
+
cy.getPositionsBySelectors('[data-test="dhis2-uicore-menuitem"]', '[data-test="dhis2-uicore-popper"]').should(([menuItemRect, popperRect]) => {
|
|
41
37
|
expect(menuItemRect.top).to.closeTo(popperRect.top, CLOSE_TO_DELTA);
|
|
42
38
|
});
|
|
43
39
|
});
|
|
@@ -9,19 +9,17 @@ var _uiConstants = require("@dhis2/ui-constants");
|
|
|
9
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _index = require("../menu/index.js");
|
|
12
|
-
function
|
|
13
|
-
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; }
|
|
12
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
14
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
-
const FlyoutMenu =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
} = _ref;
|
|
14
|
+
const FlyoutMenu = ({
|
|
15
|
+
children,
|
|
16
|
+
className,
|
|
17
|
+
dataTest = 'dhis2-uicore-menu',
|
|
18
|
+
dense,
|
|
19
|
+
maxHeight = 'auto',
|
|
20
|
+
maxWidth = '380px',
|
|
21
|
+
closeMenu
|
|
22
|
+
}) => {
|
|
25
23
|
const [openedSubMenu, setOpenedSubMenu] = (0, _react.useState)(null);
|
|
26
24
|
const toggleSubMenu = index => {
|
|
27
25
|
const toggleValue = index === openedSubMenu ? null : index;
|
|
@@ -10,8 +10,7 @@ var _menu = require("@dhis2-ui/menu");
|
|
|
10
10
|
var _popper = require("@dhis2-ui/popper");
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _flyoutMenu = require("./flyout-menu.js");
|
|
13
|
-
function
|
|
14
|
-
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; }
|
|
13
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
15
14
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
16
15
|
const description = `
|
|
17
16
|
Use menus to provide access to options and actions where space is limited and displaying all the options would be impractical. For example, providing access to a range of actions for every dashboard item displayed. Containing all those actions in menus keeps the page manageable.
|
|
@@ -218,12 +217,11 @@ DropDownMenu.parameters = {
|
|
|
218
217
|
const WithCustomMenuItem = args => {
|
|
219
218
|
// You should not create custom components in the render cycle
|
|
220
219
|
// this is just for demo purposes
|
|
221
|
-
const PopupWindowMenuItem =
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
} = _ref;
|
|
220
|
+
const PopupWindowMenuItem = ({
|
|
221
|
+
to,
|
|
222
|
+
children,
|
|
223
|
+
...rest
|
|
224
|
+
}) => {
|
|
227
225
|
const HEIGHT = 1000;
|
|
228
226
|
const WIDTH = 1400;
|
|
229
227
|
const centerY = (window.screen.height - HEIGHT) / 2;
|
|
@@ -36,6 +36,6 @@ const getFocusableItemsIndices = elements => {
|
|
|
36
36
|
exports.getFocusableItemsIndices = getFocusableItemsIndices;
|
|
37
37
|
const hasMenuItemRole = component => {
|
|
38
38
|
var _component$props;
|
|
39
|
-
return isMenuItem(component === null || component === void 0
|
|
39
|
+
return isMenuItem(component === null || component === void 0 || (_component$props = component.props) === null || _component$props === void 0 ? void 0 : _component$props['role']);
|
|
40
40
|
};
|
|
41
41
|
exports.hasMenuItemRole = hasMenuItemRole;
|
package/build/cjs/menu/menu.js
CHANGED
|
@@ -9,16 +9,14 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _helpers = require("./helpers.js");
|
|
11
11
|
var _useMenu = require("./use-menu.js");
|
|
12
|
-
function
|
|
13
|
-
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; }
|
|
12
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
14
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
-
const Menu =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
} = _ref;
|
|
14
|
+
const Menu = ({
|
|
15
|
+
children,
|
|
16
|
+
className,
|
|
17
|
+
dataTest = 'dhis2-uicore-menulist',
|
|
18
|
+
dense
|
|
19
|
+
}) => {
|
|
22
20
|
const {
|
|
23
21
|
menuRef,
|
|
24
22
|
focusedIndex
|
|
@@ -49,9 +49,9 @@ const useMenuNavigation = children => {
|
|
|
49
49
|
case 'Enter':
|
|
50
50
|
case ' ':
|
|
51
51
|
if (event.target.nodeName === 'LI') {
|
|
52
|
-
var _event$target$childre
|
|
52
|
+
var _event$target$childre;
|
|
53
53
|
event.preventDefault();
|
|
54
|
-
(_event$target$childre = event.target.children) === null || _event$target$childre === void 0
|
|
54
|
+
(_event$target$childre = event.target.children) === null || _event$target$childre === void 0 || (_event$target$childre = _event$target$childre[0]) === null || _event$target$childre === void 0 || _event$target$childre.click();
|
|
55
55
|
}
|
|
56
56
|
break;
|
|
57
57
|
default:
|
|
@@ -10,22 +10,19 @@ var _divider = require("@dhis2-ui/divider");
|
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
var _react = _interopRequireDefault(require("react"));
|
|
12
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
-
const MenuDivider =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
dynamic: [_uiConstants.colors.white]
|
|
27
|
-
}, [`li.__jsx-style-dynamic-selector{list-style:none;background-color:${_uiConstants.colors.white};-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;padding:0;line-height:0;}`]));
|
|
28
|
-
};
|
|
13
|
+
const MenuDivider = ({
|
|
14
|
+
className,
|
|
15
|
+
dataTest = 'dhis2-uicore-menudivider',
|
|
16
|
+
dense
|
|
17
|
+
}) => /*#__PURE__*/_react.default.createElement("li", {
|
|
18
|
+
"data-test": dataTest,
|
|
19
|
+
className: _style.default.dynamic([["591815244", [_uiConstants.colors.white]]]) + " " + (className || "")
|
|
20
|
+
}, /*#__PURE__*/_react.default.createElement(_divider.Divider, {
|
|
21
|
+
dense: dense
|
|
22
|
+
}), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
23
|
+
id: "591815244",
|
|
24
|
+
dynamic: [_uiConstants.colors.white]
|
|
25
|
+
}, [`li.__jsx-style-dynamic-selector{list-style:none;background-color:${_uiConstants.colors.white};-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;padding:0;line-height:0;}`]));
|
|
29
26
|
exports.MenuDivider = MenuDivider;
|
|
30
27
|
MenuDivider.propTypes = {
|
|
31
28
|
className: _propTypes.default.string,
|
|
@@ -13,53 +13,48 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
13
13
|
var _react = _interopRequireWildcard(require("react"));
|
|
14
14
|
var _index = require("../flyout-menu/index.js");
|
|
15
15
|
var _menuItemStyles = _interopRequireDefault(require("./menu-item.styles.js"));
|
|
16
|
-
function
|
|
17
|
-
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; }
|
|
16
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
18
17
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
18
|
const isModifiedEvent = evt => evt.metaKey || evt.altKey || evt.ctrlKey || evt.shiftKey;
|
|
20
|
-
const createOnClickHandler =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
const createOnClickHandler = ({
|
|
20
|
+
onClick,
|
|
21
|
+
toggleSubMenu,
|
|
22
|
+
isLink,
|
|
23
|
+
value
|
|
24
|
+
}) => evt => {
|
|
25
|
+
if (isLink && isModifiedEvent(evt) || !(onClick || toggleSubMenu)) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
evt.preventDefault();
|
|
29
|
+
evt.stopPropagation();
|
|
30
|
+
onClick && onClick({
|
|
25
31
|
value
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
if (isLink && isModifiedEvent(evt) || !(onClick || toggleSubMenu)) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
evt.preventDefault();
|
|
32
|
-
evt.stopPropagation();
|
|
33
|
-
onClick && onClick({
|
|
34
|
-
value
|
|
35
|
-
}, evt);
|
|
36
|
-
toggleSubMenu && toggleSubMenu();
|
|
37
|
-
};
|
|
32
|
+
}, evt);
|
|
33
|
+
toggleSubMenu && toggleSubMenu();
|
|
38
34
|
};
|
|
39
|
-
const MenuItem =
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
} = _ref2;
|
|
35
|
+
const MenuItem = ({
|
|
36
|
+
href,
|
|
37
|
+
onClick,
|
|
38
|
+
children,
|
|
39
|
+
target,
|
|
40
|
+
icon,
|
|
41
|
+
className,
|
|
42
|
+
destructive,
|
|
43
|
+
disabled,
|
|
44
|
+
dense,
|
|
45
|
+
active,
|
|
46
|
+
dataTest = 'dhis2-uicore-menuitem',
|
|
47
|
+
chevron,
|
|
48
|
+
value,
|
|
49
|
+
label,
|
|
50
|
+
ariaLabel,
|
|
51
|
+
showSubMenu,
|
|
52
|
+
toggleSubMenu,
|
|
53
|
+
suffix,
|
|
54
|
+
checkbox,
|
|
55
|
+
checked,
|
|
56
|
+
tabIndex
|
|
57
|
+
}) => {
|
|
63
58
|
const menuItemRef = (0, _react.useRef)();
|
|
64
59
|
const [openSubMenus, setOpenSubMenus] = (0, _react.useState)([]);
|
|
65
60
|
(0, _react.useEffect)(() => {
|
|
@@ -87,8 +82,8 @@ const MenuItem = _ref2 => {
|
|
|
87
82
|
case 'Escape':
|
|
88
83
|
// close flyout menu
|
|
89
84
|
event.preventDefault();
|
|
90
|
-
(_openSubMenus = openSubMenus[openSubMenus.length - 1]) === null || _openSubMenus === void 0
|
|
91
|
-
(_openSubMenus2 = openSubMenus[openSubMenus.length - 1]) === null || _openSubMenus2 === void 0
|
|
85
|
+
(_openSubMenus = openSubMenus[openSubMenus.length - 1]) === null || _openSubMenus === void 0 || _openSubMenus.focus();
|
|
86
|
+
(_openSubMenus2 = openSubMenus[openSubMenus.length - 1]) === null || _openSubMenus2 === void 0 || _openSubMenus2.children[0].click();
|
|
92
87
|
break;
|
|
93
88
|
}
|
|
94
89
|
};
|
|
@@ -10,8 +10,7 @@ var _uiIcons = require("@dhis2/ui-icons");
|
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _index = require("../index.js");
|
|
12
12
|
var _menuItem = require("./menu-item.js");
|
|
13
|
-
function
|
|
14
|
-
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; }
|
|
13
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
15
14
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
16
15
|
const description = `
|
|
17
16
|
Menu Items are intended to be children of Menu and Flyout Menu components. They can be nested to create submenus.
|
|
@@ -11,28 +11,25 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
12
|
var _react = _interopRequireDefault(require("react"));
|
|
13
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
-
const MenuSectionHeader =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
dynamic: [_uiConstants.colors.white, _uiConstants.spacers.dp8, _uiConstants.spacers.dp16, _uiConstants.spacers.dp8, _uiConstants.spacers.dp16, _uiConstants.colors.grey700, _uiConstants.spacers.dp8, _uiConstants.spacers.dp12, _uiConstants.spacers.dp4, _uiConstants.spacers.dp12]
|
|
34
|
-
}, [`li.__jsx-style-dynamic-selector{list-style:none;background-color:${_uiConstants.colors.white};-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;padding:0;line-height:0;}`, `h6.__jsx-style-dynamic-selector{margin:0;padding:${_uiConstants.spacers.dp8} ${_uiConstants.spacers.dp16} ${_uiConstants.spacers.dp8} ${_uiConstants.spacers.dp16};font-size:13px;line-height:16px;font-weight:500;color:${_uiConstants.colors.grey700};}`, `li.dense.__jsx-style-dynamic-selector h6.__jsx-style-dynamic-selector{padding:${_uiConstants.spacers.dp8} ${_uiConstants.spacers.dp12} ${_uiConstants.spacers.dp4} ${_uiConstants.spacers.dp12};}`]));
|
|
35
|
-
};
|
|
14
|
+
const MenuSectionHeader = ({
|
|
15
|
+
className,
|
|
16
|
+
dataTest = 'dhis2-uicore-menusectionheader',
|
|
17
|
+
dense,
|
|
18
|
+
hideDivider,
|
|
19
|
+
label
|
|
20
|
+
}) => /*#__PURE__*/_react.default.createElement("li", {
|
|
21
|
+
"data-test": dataTest,
|
|
22
|
+
className: _style.default.dynamic([["1160864328", [_uiConstants.colors.white, _uiConstants.spacers.dp8, _uiConstants.spacers.dp16, _uiConstants.spacers.dp8, _uiConstants.spacers.dp16, _uiConstants.colors.grey700, _uiConstants.spacers.dp8, _uiConstants.spacers.dp12, _uiConstants.spacers.dp4, _uiConstants.spacers.dp12]]]) + " " + ((0, _classnames.default)(className, {
|
|
23
|
+
dense
|
|
24
|
+
}) || "")
|
|
25
|
+
}, !hideDivider && /*#__PURE__*/_react.default.createElement(_divider.Divider, {
|
|
26
|
+
dense: dense
|
|
27
|
+
}), /*#__PURE__*/_react.default.createElement("h6", {
|
|
28
|
+
className: _style.default.dynamic([["1160864328", [_uiConstants.colors.white, _uiConstants.spacers.dp8, _uiConstants.spacers.dp16, _uiConstants.spacers.dp8, _uiConstants.spacers.dp16, _uiConstants.colors.grey700, _uiConstants.spacers.dp8, _uiConstants.spacers.dp12, _uiConstants.spacers.dp4, _uiConstants.spacers.dp12]]])
|
|
29
|
+
}, label), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
30
|
+
id: "1160864328",
|
|
31
|
+
dynamic: [_uiConstants.colors.white, _uiConstants.spacers.dp8, _uiConstants.spacers.dp16, _uiConstants.spacers.dp8, _uiConstants.spacers.dp16, _uiConstants.colors.grey700, _uiConstants.spacers.dp8, _uiConstants.spacers.dp12, _uiConstants.spacers.dp4, _uiConstants.spacers.dp12]
|
|
32
|
+
}, [`li.__jsx-style-dynamic-selector{list-style:none;background-color:${_uiConstants.colors.white};-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;padding:0;line-height:0;}`, `h6.__jsx-style-dynamic-selector{margin:0;padding:${_uiConstants.spacers.dp8} ${_uiConstants.spacers.dp16} ${_uiConstants.spacers.dp8} ${_uiConstants.spacers.dp16};font-size:13px;line-height:16px;font-weight:500;color:${_uiConstants.colors.grey700};}`, `li.dense.__jsx-style-dynamic-selector h6.__jsx-style-dynamic-selector{padding:${_uiConstants.spacers.dp8} ${_uiConstants.spacers.dp12} ${_uiConstants.spacers.dp4} ${_uiConstants.spacers.dp12};}`]));
|
|
36
33
|
exports.MenuSectionHeader = MenuSectionHeader;
|
|
37
34
|
MenuSectionHeader.propTypes = {
|
|
38
35
|
className: _propTypes.default.string,
|
|
@@ -30,17 +30,14 @@ var _default = exports.default = {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
|
-
const Template =
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
label: "Menu item below"
|
|
42
|
-
}));
|
|
43
|
-
};
|
|
33
|
+
const Template = ({
|
|
34
|
+
menuArgs,
|
|
35
|
+
...args
|
|
36
|
+
}) => /*#__PURE__*/_react.default.createElement(_index.Menu, menuArgs, /*#__PURE__*/_react.default.createElement(_index.MenuItem, {
|
|
37
|
+
label: "Menu item above"
|
|
38
|
+
}), /*#__PURE__*/_react.default.createElement(_menuSectionHeader.MenuSectionHeader, args), /*#__PURE__*/_react.default.createElement(_index.MenuItem, {
|
|
39
|
+
label: "Menu item below"
|
|
40
|
+
}));
|
|
44
41
|
Template.propTypes = {
|
|
45
42
|
menuArgs: _propTypes.default.shape()
|
|
46
43
|
};
|
|
@@ -13,20 +13,17 @@ When('the user clicks on the MenuItem', () => {
|
|
|
13
13
|
cy.get('[data-test="dhis2-uicore-menuitem"]').click();
|
|
14
14
|
});
|
|
15
15
|
Then('the right of the MenuItem is aligned with the left of the SubMenu', () => {
|
|
16
|
-
getMenuItemAndSubMenuRects().should(
|
|
17
|
-
let [menuItemRect, subMenuRect] = _ref;
|
|
16
|
+
getMenuItemAndSubMenuRects().should(([menuItemRect, subMenuRect]) => {
|
|
18
17
|
expect(menuItemRect.right).to.closeTo(subMenuRect.left, CLOSE_TO_DELTA);
|
|
19
18
|
});
|
|
20
19
|
});
|
|
21
20
|
Then('the left of the MenuItem is aligned with the right of the SubMenu', () => {
|
|
22
|
-
getMenuItemAndSubMenuRects().should(
|
|
23
|
-
let [menuItemRect, subMenuRect] = _ref2;
|
|
21
|
+
getMenuItemAndSubMenuRects().should(([menuItemRect, subMenuRect]) => {
|
|
24
22
|
expect(menuItemRect.left).to.closeTo(subMenuRect.right, CLOSE_TO_DELTA);
|
|
25
23
|
});
|
|
26
24
|
});
|
|
27
25
|
Then('the SubMenu is rendered on top of the MenuItem', () => {
|
|
28
|
-
getMenuItemAndSubMenuRects().should(
|
|
29
|
-
let [menuItemRect, subMenuRect] = _ref3;
|
|
26
|
+
getMenuItemAndSubMenuRects().should(([menuItemRect, subMenuRect]) => {
|
|
30
27
|
expect(subMenuRect.left).to.be.at.most(menuItemRect.right);
|
|
31
28
|
expect(subMenuRect.right).to.be.at.least(menuItemRect.left);
|
|
32
29
|
expect(subMenuRect.top).to.be.at.most(menuItemRect.bottom);
|
|
@@ -34,8 +31,7 @@ Then('the SubMenu is rendered on top of the MenuItem', () => {
|
|
|
34
31
|
});
|
|
35
32
|
});
|
|
36
33
|
Then('the top of the MenuItem is aligned with the top of the SubMenu wrapper', () => {
|
|
37
|
-
cy.getPositionsBySelectors('[data-test="dhis2-uicore-menuitem"]', '[data-test="dhis2-uicore-popper"]').should(
|
|
38
|
-
let [menuItemRect, popperRect] = _ref4;
|
|
34
|
+
cy.getPositionsBySelectors('[data-test="dhis2-uicore-menuitem"]', '[data-test="dhis2-uicore-popper"]').should(([menuItemRect, popperRect]) => {
|
|
39
35
|
expect(menuItemRect.top).to.closeTo(popperRect.top, CLOSE_TO_DELTA);
|
|
40
36
|
});
|
|
41
37
|
});
|
|
@@ -3,16 +3,15 @@ import { colors, elevations, spacers } from '@dhis2/ui-constants';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import React, { Children, cloneElement, isValidElement, useEffect, useRef, useState } from 'react';
|
|
5
5
|
import { Menu } from '../menu/index.js';
|
|
6
|
-
const FlyoutMenu =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
} = _ref;
|
|
6
|
+
const FlyoutMenu = ({
|
|
7
|
+
children,
|
|
8
|
+
className,
|
|
9
|
+
dataTest = 'dhis2-uicore-menu',
|
|
10
|
+
dense,
|
|
11
|
+
maxHeight = 'auto',
|
|
12
|
+
maxWidth = '380px',
|
|
13
|
+
closeMenu
|
|
14
|
+
}) => {
|
|
16
15
|
const [openedSubMenu, setOpenedSubMenu] = useState(null);
|
|
17
16
|
const toggleSubMenu = index => {
|
|
18
17
|
const toggleValue = index === openedSubMenu ? null : index;
|
|
@@ -204,12 +204,11 @@ DropDownMenu.parameters = {
|
|
|
204
204
|
export const WithCustomMenuItem = args => {
|
|
205
205
|
// You should not create custom components in the render cycle
|
|
206
206
|
// this is just for demo purposes
|
|
207
|
-
const PopupWindowMenuItem =
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
} = _ref;
|
|
207
|
+
const PopupWindowMenuItem = ({
|
|
208
|
+
to,
|
|
209
|
+
children,
|
|
210
|
+
...rest
|
|
211
|
+
}) => {
|
|
213
212
|
const HEIGHT = 1000;
|
|
214
213
|
const WIDTH = 1400;
|
|
215
214
|
const centerY = (window.screen.height - HEIGHT) / 2;
|
package/build/es/menu/helpers.js
CHANGED
|
@@ -29,5 +29,5 @@ export const getFocusableItemsIndices = elements => {
|
|
|
29
29
|
};
|
|
30
30
|
export const hasMenuItemRole = component => {
|
|
31
31
|
var _component$props;
|
|
32
|
-
return isMenuItem(component === null || component === void 0
|
|
32
|
+
return isMenuItem(component === null || component === void 0 || (_component$props = component.props) === null || _component$props === void 0 ? void 0 : _component$props['role']);
|
|
33
33
|
};
|
package/build/es/menu/menu.js
CHANGED
|
@@ -3,13 +3,12 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import React, { Children, cloneElement, isValidElement, useMemo } from 'react';
|
|
4
4
|
import { hasMenuItemRole } from './helpers.js';
|
|
5
5
|
import { useMenuNavigation } from './use-menu.js';
|
|
6
|
-
const Menu =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
} = _ref;
|
|
6
|
+
const Menu = ({
|
|
7
|
+
children,
|
|
8
|
+
className,
|
|
9
|
+
dataTest = 'dhis2-uicore-menulist',
|
|
10
|
+
dense
|
|
11
|
+
}) => {
|
|
13
12
|
const {
|
|
14
13
|
menuRef,
|
|
15
14
|
focusedIndex
|
|
@@ -43,9 +43,9 @@ export const useMenuNavigation = children => {
|
|
|
43
43
|
case 'Enter':
|
|
44
44
|
case ' ':
|
|
45
45
|
if (event.target.nodeName === 'LI') {
|
|
46
|
-
var _event$target$childre
|
|
46
|
+
var _event$target$childre;
|
|
47
47
|
event.preventDefault();
|
|
48
|
-
(_event$target$childre = event.target.children) === null || _event$target$childre === void 0
|
|
48
|
+
(_event$target$childre = event.target.children) === null || _event$target$childre === void 0 || (_event$target$childre = _event$target$childre[0]) === null || _event$target$childre === void 0 || _event$target$childre.click();
|
|
49
49
|
}
|
|
50
50
|
break;
|
|
51
51
|
default:
|
|
@@ -3,22 +3,19 @@ import { colors } from '@dhis2/ui-constants';
|
|
|
3
3
|
import { Divider } from '@dhis2-ui/divider';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import React from 'react';
|
|
6
|
-
const MenuDivider =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
dynamic: [colors.white]
|
|
20
|
-
}, [`li.__jsx-style-dynamic-selector{list-style:none;background-color:${colors.white};-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;padding:0;line-height:0;}`]));
|
|
21
|
-
};
|
|
6
|
+
const MenuDivider = ({
|
|
7
|
+
className,
|
|
8
|
+
dataTest = 'dhis2-uicore-menudivider',
|
|
9
|
+
dense
|
|
10
|
+
}) => /*#__PURE__*/React.createElement("li", {
|
|
11
|
+
"data-test": dataTest,
|
|
12
|
+
className: _JSXStyle.dynamic([["591815244", [colors.white]]]) + " " + (className || "")
|
|
13
|
+
}, /*#__PURE__*/React.createElement(Divider, {
|
|
14
|
+
dense: dense
|
|
15
|
+
}), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
16
|
+
id: "591815244",
|
|
17
|
+
dynamic: [colors.white]
|
|
18
|
+
}, [`li.__jsx-style-dynamic-selector{list-style:none;background-color:${colors.white};-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;padding:0;line-height:0;}`]));
|
|
22
19
|
MenuDivider.propTypes = {
|
|
23
20
|
className: PropTypes.string,
|
|
24
21
|
dataTest: PropTypes.string,
|
|
@@ -8,49 +8,45 @@ import React, { useEffect, useRef, useState, useMemo } from 'react';
|
|
|
8
8
|
import { FlyoutMenu } from '../flyout-menu/index.js';
|
|
9
9
|
import styles from './menu-item.styles.js';
|
|
10
10
|
const isModifiedEvent = evt => evt.metaKey || evt.altKey || evt.ctrlKey || evt.shiftKey;
|
|
11
|
-
const createOnClickHandler =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
const createOnClickHandler = ({
|
|
12
|
+
onClick,
|
|
13
|
+
toggleSubMenu,
|
|
14
|
+
isLink,
|
|
15
|
+
value
|
|
16
|
+
}) => evt => {
|
|
17
|
+
if (isLink && isModifiedEvent(evt) || !(onClick || toggleSubMenu)) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
evt.preventDefault();
|
|
21
|
+
evt.stopPropagation();
|
|
22
|
+
onClick && onClick({
|
|
16
23
|
value
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
if (isLink && isModifiedEvent(evt) || !(onClick || toggleSubMenu)) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
evt.preventDefault();
|
|
23
|
-
evt.stopPropagation();
|
|
24
|
-
onClick && onClick({
|
|
25
|
-
value
|
|
26
|
-
}, evt);
|
|
27
|
-
toggleSubMenu && toggleSubMenu();
|
|
28
|
-
};
|
|
24
|
+
}, evt);
|
|
25
|
+
toggleSubMenu && toggleSubMenu();
|
|
29
26
|
};
|
|
30
|
-
const MenuItem =
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
} = _ref2;
|
|
27
|
+
const MenuItem = ({
|
|
28
|
+
href,
|
|
29
|
+
onClick,
|
|
30
|
+
children,
|
|
31
|
+
target,
|
|
32
|
+
icon,
|
|
33
|
+
className,
|
|
34
|
+
destructive,
|
|
35
|
+
disabled,
|
|
36
|
+
dense,
|
|
37
|
+
active,
|
|
38
|
+
dataTest = 'dhis2-uicore-menuitem',
|
|
39
|
+
chevron,
|
|
40
|
+
value,
|
|
41
|
+
label,
|
|
42
|
+
ariaLabel,
|
|
43
|
+
showSubMenu,
|
|
44
|
+
toggleSubMenu,
|
|
45
|
+
suffix,
|
|
46
|
+
checkbox,
|
|
47
|
+
checked,
|
|
48
|
+
tabIndex
|
|
49
|
+
}) => {
|
|
54
50
|
const menuItemRef = useRef();
|
|
55
51
|
const [openSubMenus, setOpenSubMenus] = useState([]);
|
|
56
52
|
useEffect(() => {
|
|
@@ -78,8 +74,8 @@ const MenuItem = _ref2 => {
|
|
|
78
74
|
case 'Escape':
|
|
79
75
|
// close flyout menu
|
|
80
76
|
event.preventDefault();
|
|
81
|
-
(_openSubMenus = openSubMenus[openSubMenus.length - 1]) === null || _openSubMenus === void 0
|
|
82
|
-
(_openSubMenus2 = openSubMenus[openSubMenus.length - 1]) === null || _openSubMenus2 === void 0
|
|
77
|
+
(_openSubMenus = openSubMenus[openSubMenus.length - 1]) === null || _openSubMenus === void 0 || _openSubMenus.focus();
|
|
78
|
+
(_openSubMenus2 = openSubMenus[openSubMenus.length - 1]) === null || _openSubMenus2 === void 0 || _openSubMenus2.children[0].click();
|
|
83
79
|
break;
|
|
84
80
|
}
|
|
85
81
|
};
|
|
@@ -4,28 +4,25 @@ import { Divider } from '@dhis2-ui/divider';
|
|
|
4
4
|
import cx from 'classnames';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import React from 'react';
|
|
7
|
-
const MenuSectionHeader =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
dynamic: [colors.white, spacers.dp8, spacers.dp16, spacers.dp8, spacers.dp16, colors.grey700, spacers.dp8, spacers.dp12, spacers.dp4, spacers.dp12]
|
|
27
|
-
}, [`li.__jsx-style-dynamic-selector{list-style:none;background-color:${colors.white};-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;padding:0;line-height:0;}`, `h6.__jsx-style-dynamic-selector{margin:0;padding:${spacers.dp8} ${spacers.dp16} ${spacers.dp8} ${spacers.dp16};font-size:13px;line-height:16px;font-weight:500;color:${colors.grey700};}`, `li.dense.__jsx-style-dynamic-selector h6.__jsx-style-dynamic-selector{padding:${spacers.dp8} ${spacers.dp12} ${spacers.dp4} ${spacers.dp12};}`]));
|
|
28
|
-
};
|
|
7
|
+
const MenuSectionHeader = ({
|
|
8
|
+
className,
|
|
9
|
+
dataTest = 'dhis2-uicore-menusectionheader',
|
|
10
|
+
dense,
|
|
11
|
+
hideDivider,
|
|
12
|
+
label
|
|
13
|
+
}) => /*#__PURE__*/React.createElement("li", {
|
|
14
|
+
"data-test": dataTest,
|
|
15
|
+
className: _JSXStyle.dynamic([["1160864328", [colors.white, spacers.dp8, spacers.dp16, spacers.dp8, spacers.dp16, colors.grey700, spacers.dp8, spacers.dp12, spacers.dp4, spacers.dp12]]]) + " " + (cx(className, {
|
|
16
|
+
dense
|
|
17
|
+
}) || "")
|
|
18
|
+
}, !hideDivider && /*#__PURE__*/React.createElement(Divider, {
|
|
19
|
+
dense: dense
|
|
20
|
+
}), /*#__PURE__*/React.createElement("h6", {
|
|
21
|
+
className: _JSXStyle.dynamic([["1160864328", [colors.white, spacers.dp8, spacers.dp16, spacers.dp8, spacers.dp16, colors.grey700, spacers.dp8, spacers.dp12, spacers.dp4, spacers.dp12]]])
|
|
22
|
+
}, label), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
23
|
+
id: "1160864328",
|
|
24
|
+
dynamic: [colors.white, spacers.dp8, spacers.dp16, spacers.dp8, spacers.dp16, colors.grey700, spacers.dp8, spacers.dp12, spacers.dp4, spacers.dp12]
|
|
25
|
+
}, [`li.__jsx-style-dynamic-selector{list-style:none;background-color:${colors.white};-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;padding:0;line-height:0;}`, `h6.__jsx-style-dynamic-selector{margin:0;padding:${spacers.dp8} ${spacers.dp16} ${spacers.dp8} ${spacers.dp16};font-size:13px;line-height:16px;font-weight:500;color:${colors.grey700};}`, `li.dense.__jsx-style-dynamic-selector h6.__jsx-style-dynamic-selector{padding:${spacers.dp8} ${spacers.dp12} ${spacers.dp4} ${spacers.dp12};}`]));
|
|
29
26
|
MenuSectionHeader.propTypes = {
|
|
30
27
|
className: PropTypes.string,
|
|
31
28
|
dataTest: PropTypes.string,
|
|
@@ -23,17 +23,14 @@ export default {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
|
-
const Template =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
label: "Menu item below"
|
|
35
|
-
}));
|
|
36
|
-
};
|
|
26
|
+
const Template = ({
|
|
27
|
+
menuArgs,
|
|
28
|
+
...args
|
|
29
|
+
}) => /*#__PURE__*/React.createElement(Menu, menuArgs, /*#__PURE__*/React.createElement(MenuItem, {
|
|
30
|
+
label: "Menu item above"
|
|
31
|
+
}), /*#__PURE__*/React.createElement(MenuSectionHeader, args), /*#__PURE__*/React.createElement(MenuItem, {
|
|
32
|
+
label: "Menu item below"
|
|
33
|
+
}));
|
|
37
34
|
Template.propTypes = {
|
|
38
35
|
menuArgs: PropTypes.shape()
|
|
39
36
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dhis2-ui/menu",
|
|
3
|
-
"version": "10.16.
|
|
3
|
+
"version": "10.16.4",
|
|
4
4
|
"description": "UI Menu",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -33,13 +33,13 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@dhis2/prop-types": "^3.1.2",
|
|
36
|
-
"@dhis2-ui/card": "10.16.
|
|
37
|
-
"@dhis2-ui/divider": "10.16.
|
|
38
|
-
"@dhis2-ui/layer": "10.16.
|
|
39
|
-
"@dhis2-ui/popper": "10.16.
|
|
40
|
-
"@dhis2-ui/portal": "10.16.
|
|
41
|
-
"@dhis2/ui-constants": "10.16.
|
|
42
|
-
"@dhis2/ui-icons": "10.16.
|
|
36
|
+
"@dhis2-ui/card": "10.16.4",
|
|
37
|
+
"@dhis2-ui/divider": "10.16.4",
|
|
38
|
+
"@dhis2-ui/layer": "10.16.4",
|
|
39
|
+
"@dhis2-ui/popper": "10.16.4",
|
|
40
|
+
"@dhis2-ui/portal": "10.16.4",
|
|
41
|
+
"@dhis2/ui-constants": "10.16.4",
|
|
42
|
+
"@dhis2/ui-icons": "10.16.4",
|
|
43
43
|
"classnames": "^2.3.1",
|
|
44
44
|
"prop-types": "^15.7.2"
|
|
45
45
|
},
|