@synerise/ds-menu 0.20.5 → 0.20.7
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/CHANGELOG.md +16 -0
- package/dist/Elements/Breadcrumb/Breadcrumb.js +11 -32
- package/dist/Elements/Breadcrumb/Breadcrumb.styles.js +6 -10
- package/dist/Elements/Header/Header.js +1 -3
- package/dist/Elements/Item/Danger/Danger.js +1 -6
- package/dist/Elements/Item/Danger/Danger.styles.js +4 -7
- package/dist/Elements/Item/MenuItem.js +18 -27
- package/dist/Elements/Item/MenuItem.types.js +0 -3
- package/dist/Elements/Item/Select/Select.js +2 -8
- package/dist/Elements/Item/Select/Select.styles.js +4 -7
- package/dist/Elements/Item/SubmenuText/SubmenuText.js +5 -11
- package/dist/Elements/Item/SubmenuText/SubmenuText.styles.js +7 -10
- package/dist/Elements/Item/Text/Text.js +35 -58
- package/dist/Elements/Item/Text/Text.styles.js +0 -9
- package/dist/Elements/SubMenu/SubMenu.js +21 -32
- package/dist/Menu.js +8 -38
- package/dist/Menu.styles.js +0 -2
- package/dist/Menu.types.js +0 -1
- package/dist/utils.js +1 -0
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.20.7](https://github.com/Synerise/synerise-design/compare/@synerise/ds-menu@0.20.6...@synerise/ds-menu@0.20.7) (2024-11-28)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-menu
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [0.20.6](https://github.com/Synerise/synerise-design/compare/@synerise/ds-menu@0.20.5...@synerise/ds-menu@0.20.6) (2024-11-21)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @synerise/ds-menu
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
## [0.20.5](https://github.com/Synerise/synerise-design/compare/@synerise/ds-menu@0.20.4...@synerise/ds-menu@0.20.5) (2024-11-12)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @synerise/ds-menu
|
|
@@ -1,44 +1,35 @@
|
|
|
1
1
|
var _excluded = ["path", "disabled", "highlight", "description", "onPathClick", "compact", "startWithArrow", "gradientOverlap", "highlightActivePath"];
|
|
2
|
-
|
|
3
2
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
-
|
|
5
3
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
6
|
-
|
|
7
4
|
import React from 'react';
|
|
8
5
|
import Icon, { AngleRightS } from '@synerise/ds-icon';
|
|
9
6
|
import { theme } from '@synerise/ds-core';
|
|
10
7
|
import { escapeRegEx } from '@synerise/ds-utils';
|
|
11
8
|
import * as S from './Breadcrumb.styles';
|
|
12
|
-
|
|
13
9
|
var Breadcrumb = function Breadcrumb(_ref) {
|
|
14
10
|
var path = _ref.path,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
11
|
+
disabled = _ref.disabled,
|
|
12
|
+
highlight = _ref.highlight,
|
|
13
|
+
description = _ref.description,
|
|
14
|
+
onPathClick = _ref.onPathClick,
|
|
15
|
+
compact = _ref.compact,
|
|
16
|
+
startWithArrow = _ref.startWithArrow,
|
|
17
|
+
gradientOverlap = _ref.gradientOverlap,
|
|
18
|
+
highlightActivePath = _ref.highlightActivePath,
|
|
19
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
25
20
|
var prefixel = rest.prefixel;
|
|
26
21
|
var breadcrumbsArray = [].concat(path);
|
|
27
22
|
var pathToDisplay = compact ? breadcrumbsArray.reverse() : breadcrumbsArray;
|
|
28
23
|
var contentRef = React.useRef(null);
|
|
29
|
-
|
|
30
24
|
var _React$useState = React.useState(false),
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
gradient = _React$useState[0],
|
|
26
|
+
setGradient = _React$useState[1];
|
|
34
27
|
var renderWithHighlighting = React.useCallback(function (name) {
|
|
35
28
|
if (highlight && typeof name === 'string') {
|
|
36
29
|
var index = name.toLocaleLowerCase().indexOf(highlight.toLocaleLowerCase());
|
|
37
|
-
|
|
38
30
|
if (index === -1) {
|
|
39
31
|
return name;
|
|
40
32
|
}
|
|
41
|
-
|
|
42
33
|
var escapedHighlight = escapeRegEx(highlight);
|
|
43
34
|
var startOfQuery = name.toLowerCase().search(escapedHighlight.toLowerCase());
|
|
44
35
|
var endOfQuery = startOfQuery + highlight.length;
|
|
@@ -48,48 +39,37 @@ var Breadcrumb = function Breadcrumb(_ref) {
|
|
|
48
39
|
}, name.substring(startOfQuery, endOfQuery)), name.substring(endOfQuery, name.length)];
|
|
49
40
|
return resultArray;
|
|
50
41
|
}
|
|
51
|
-
|
|
52
42
|
return name;
|
|
53
43
|
}, [highlight]);
|
|
54
44
|
var attachActiveClassName = React.useCallback(function (index) {
|
|
55
45
|
if (compact) {
|
|
56
46
|
return !!highlightActivePath && index === 0 ? 'active' : '';
|
|
57
47
|
}
|
|
58
|
-
|
|
59
48
|
return !!highlightActivePath && index === path.length - 1 ? 'active' : '';
|
|
60
49
|
}, [highlightActivePath, path, compact]);
|
|
61
|
-
|
|
62
50
|
var shouldRenderArrow = function shouldRenderArrow(breadCrumbPath, index) {
|
|
63
51
|
if (!breadCrumbPath || !breadCrumbPath.length) {
|
|
64
52
|
return false;
|
|
65
53
|
}
|
|
66
|
-
|
|
67
54
|
var nextBreadcrumb = breadCrumbPath[index + 1];
|
|
68
|
-
|
|
69
55
|
if (!nextBreadcrumb) {
|
|
70
56
|
return !!startWithArrow;
|
|
71
57
|
}
|
|
72
|
-
|
|
73
58
|
return true;
|
|
74
59
|
};
|
|
75
|
-
|
|
76
60
|
var shouldHaveArrowPlaceholder = function shouldHaveArrowPlaceholder(index) {
|
|
77
61
|
if (compact) {
|
|
78
62
|
return startWithArrow || index < path.length - 1 && path.length > 1;
|
|
79
63
|
}
|
|
80
|
-
|
|
81
64
|
return startWithArrow || path.length > 1 || index > 0;
|
|
82
65
|
};
|
|
83
|
-
|
|
84
66
|
var isOverflown = function isOverflown(elementRef) {
|
|
85
67
|
if (elementRef !== null && elementRef.current !== null) {
|
|
86
68
|
var element = elementRef.current;
|
|
87
69
|
return element.scrollWidth > element.clientWidth;
|
|
88
70
|
}
|
|
89
|
-
|
|
90
71
|
return false;
|
|
91
72
|
};
|
|
92
|
-
|
|
93
73
|
React.useEffect(function () {
|
|
94
74
|
var shouldRenderGradientOverlap = gradientOverlap && isOverflown(contentRef);
|
|
95
75
|
setGradient(!!shouldRenderGradientOverlap);
|
|
@@ -127,5 +107,4 @@ var Breadcrumb = function Breadcrumb(_ref) {
|
|
|
127
107
|
);
|
|
128
108
|
}))));
|
|
129
109
|
};
|
|
130
|
-
|
|
131
110
|
export default Breadcrumb;
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
var _excluded = ["children", "disabled", "onPathClick", "compact"];
|
|
2
|
-
|
|
3
2
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
-
|
|
5
3
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
6
|
-
|
|
7
4
|
import React from 'react';
|
|
8
5
|
import styled, { css } from 'styled-components';
|
|
9
6
|
import Text from '../Item/Text/Text';
|
|
10
|
-
import { PrefixelWrapper } from '../Item/Text/Text.styles';
|
|
7
|
+
import { PrefixelWrapper } from '../Item/Text/Text.styles';
|
|
11
8
|
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
12
10
|
var NOOP = function NOOP() {};
|
|
13
|
-
|
|
14
11
|
export var ArrowRight = styled.div.withConfig({
|
|
15
12
|
displayName: "Breadcrumbstyles__ArrowRight",
|
|
16
13
|
componentId: "gvmxah-0"
|
|
@@ -50,11 +47,10 @@ export var disableDefaultClickingStyles = function disableDefaultClickingStyles(
|
|
|
50
47
|
};
|
|
51
48
|
export var Breadcrumb = styled(function (_ref) {
|
|
52
49
|
var children = _ref.children,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
50
|
+
disabled = _ref.disabled,
|
|
51
|
+
onPathClick = _ref.onPathClick,
|
|
52
|
+
compact = _ref.compact,
|
|
53
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
58
54
|
return (
|
|
59
55
|
/*#__PURE__*/
|
|
60
56
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
@@ -2,10 +2,9 @@ import React from 'react';
|
|
|
2
2
|
import Tooltip from '@synerise/ds-tooltip/dist/Tooltip';
|
|
3
3
|
import Icon, { InfoFillS } from '@synerise/ds-icon';
|
|
4
4
|
import * as S from './Header.styles';
|
|
5
|
-
|
|
6
5
|
var MenuHeader = function MenuHeader(_ref) {
|
|
7
6
|
var headerText = _ref.headerText,
|
|
8
|
-
|
|
7
|
+
tooltip = _ref.tooltip;
|
|
9
8
|
return /*#__PURE__*/React.createElement(S.MenuHeader, null, headerText, tooltip && /*#__PURE__*/React.createElement(Tooltip, {
|
|
10
9
|
type: "default",
|
|
11
10
|
trigger: "hover",
|
|
@@ -14,5 +13,4 @@ var MenuHeader = function MenuHeader(_ref) {
|
|
|
14
13
|
component: /*#__PURE__*/React.createElement(InfoFillS, null)
|
|
15
14
|
}))));
|
|
16
15
|
};
|
|
17
|
-
|
|
18
16
|
export default MenuHeader;
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
var _excluded = ["children"];
|
|
2
|
-
|
|
3
2
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
4
|
-
|
|
5
3
|
import React from 'react';
|
|
6
4
|
import '@synerise/ds-core/dist/js/style';
|
|
7
5
|
import * as S from './Danger.styles';
|
|
8
|
-
|
|
9
6
|
var Danger = function Danger(props) {
|
|
10
7
|
var children = props.children,
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded);
|
|
13
9
|
return /*#__PURE__*/React.createElement(S.DangerItem, rest, children);
|
|
14
10
|
};
|
|
15
|
-
|
|
16
11
|
export default Danger;
|
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
var _excluded = ["children", "disabled"];
|
|
2
|
-
|
|
3
2
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
-
|
|
5
3
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
6
|
-
|
|
7
4
|
import styled from 'styled-components';
|
|
8
5
|
import React from 'react';
|
|
9
6
|
import { IconContainer } from '@synerise/ds-icon';
|
|
10
7
|
import Text from '../Text/Text';
|
|
11
|
-
import { ContentWrapper, PrefixelWrapper } from '../Text/Text.styles';
|
|
8
|
+
import { ContentWrapper, PrefixelWrapper } from '../Text/Text.styles';
|
|
12
9
|
|
|
10
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
13
11
|
export var DangerItem = styled(function (_ref) {
|
|
14
12
|
var children = _ref.children,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
disabled = _ref.disabled,
|
|
14
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
18
15
|
return (
|
|
19
16
|
/*#__PURE__*/
|
|
20
17
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
var _excluded = ["prefixel", "suffixel", "ordered", "disabled", "danger", "text", "description", "subMenu", "children", "type", "indentLevel", "timeToHideTooltip", "onItemHover", "onClick", "menuItemKey", "onTitleClick"];
|
|
2
|
-
|
|
3
2
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
-
|
|
5
3
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
6
|
-
|
|
7
4
|
import React from 'react';
|
|
8
5
|
import '@synerise/ds-core/dist/js/style';
|
|
9
6
|
import { ItemType } from './MenuItem.types';
|
|
@@ -11,29 +8,28 @@ import SubMenuItem from '../SubMenu/SubMenu';
|
|
|
11
8
|
import Text from './Text/Text';
|
|
12
9
|
import Select from './Select/Select';
|
|
13
10
|
import Danger from './Danger/Danger';
|
|
14
|
-
import { MenuDivider } from '../../Menu.styles';
|
|
11
|
+
import { MenuDivider } from '../../Menu.styles';
|
|
15
12
|
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
16
14
|
var NOOP = function NOOP() {};
|
|
17
|
-
|
|
18
15
|
var MenuItem = function MenuItem(props) {
|
|
19
16
|
var prefixel = props.prefixel,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
17
|
+
suffixel = props.suffixel,
|
|
18
|
+
ordered = props.ordered,
|
|
19
|
+
disabled = props.disabled,
|
|
20
|
+
danger = props.danger,
|
|
21
|
+
text = props.text,
|
|
22
|
+
description = props.description,
|
|
23
|
+
subMenu = props.subMenu,
|
|
24
|
+
children = props.children,
|
|
25
|
+
type = props.type,
|
|
26
|
+
indentLevel = props.indentLevel,
|
|
27
|
+
timeToHideTooltip = props.timeToHideTooltip,
|
|
28
|
+
onItemHover = props.onItemHover,
|
|
29
|
+
_onClick = props.onClick,
|
|
30
|
+
menuItemKey = props.menuItemKey,
|
|
31
|
+
onTitleClick = props.onTitleClick,
|
|
32
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded);
|
|
37
33
|
if (subMenu) {
|
|
38
34
|
return /*#__PURE__*/React.createElement(SubMenuItem, _extends({
|
|
39
35
|
prefixel: prefixel,
|
|
@@ -54,7 +50,6 @@ var MenuItem = function MenuItem(props) {
|
|
|
54
50
|
onTitleClick: onTitleClick
|
|
55
51
|
}, rest));
|
|
56
52
|
}
|
|
57
|
-
|
|
58
53
|
switch (type) {
|
|
59
54
|
case ItemType.SELECT:
|
|
60
55
|
return /*#__PURE__*/React.createElement(Select, _extends({
|
|
@@ -70,7 +65,6 @@ var MenuItem = function MenuItem(props) {
|
|
|
70
65
|
_onClick && _onClick(menuInfo);
|
|
71
66
|
}
|
|
72
67
|
}, rest), text || children);
|
|
73
|
-
|
|
74
68
|
case ItemType.DANGER:
|
|
75
69
|
return /*#__PURE__*/React.createElement(Danger, _extends({
|
|
76
70
|
ordered: ordered,
|
|
@@ -85,12 +79,10 @@ var MenuItem = function MenuItem(props) {
|
|
|
85
79
|
_onClick && _onClick(menuInfo);
|
|
86
80
|
}
|
|
87
81
|
}, rest), text || children);
|
|
88
|
-
|
|
89
82
|
case ItemType.DIVIDER:
|
|
90
83
|
return /*#__PURE__*/React.createElement(MenuDivider, {
|
|
91
84
|
level: rest.level
|
|
92
85
|
});
|
|
93
|
-
|
|
94
86
|
default:
|
|
95
87
|
return /*#__PURE__*/React.createElement(Text, _extends({
|
|
96
88
|
ordered: ordered,
|
|
@@ -109,5 +101,4 @@ var MenuItem = function MenuItem(props) {
|
|
|
109
101
|
}, rest), text || children);
|
|
110
102
|
}
|
|
111
103
|
};
|
|
112
|
-
|
|
113
104
|
export default MenuItem;
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
export var ItemType;
|
|
2
|
-
|
|
3
2
|
(function (ItemType) {
|
|
4
3
|
ItemType["DEFAULT"] = "default";
|
|
5
4
|
ItemType["SELECT"] = "select";
|
|
6
5
|
ItemType["DANGER"] = "danger";
|
|
7
6
|
ItemType["DIVIDER"] = "divider";
|
|
8
7
|
})(ItemType || (ItemType = {}));
|
|
9
|
-
|
|
10
8
|
export var ItemSize;
|
|
11
|
-
|
|
12
9
|
(function (ItemSize) {
|
|
13
10
|
ItemSize["DEFAULT"] = "default";
|
|
14
11
|
ItemSize["LARGE"] = "large";
|
|
@@ -1,23 +1,17 @@
|
|
|
1
1
|
var _excluded = ["disabled", "children"];
|
|
2
|
-
|
|
3
2
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
-
|
|
5
3
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
6
|
-
|
|
7
4
|
import React from 'react';
|
|
8
5
|
import { v4 as uuid } from 'uuid';
|
|
9
6
|
import '@synerise/ds-core/dist/js/style';
|
|
10
7
|
import * as S from './Select.styles';
|
|
11
|
-
|
|
12
8
|
var Select = function Select(props) {
|
|
13
9
|
var disabled = props.disabled,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
children = props.children,
|
|
11
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded);
|
|
17
12
|
return /*#__PURE__*/React.createElement(S.SelectItem, _extends({
|
|
18
13
|
key: uuid(),
|
|
19
14
|
disabled: disabled
|
|
20
15
|
}, rest), children);
|
|
21
16
|
};
|
|
22
|
-
|
|
23
17
|
export default Select;
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
var _excluded = ["children", "disabled"];
|
|
2
|
-
|
|
3
2
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
-
|
|
5
3
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
6
|
-
|
|
7
4
|
import styled from 'styled-components';
|
|
8
5
|
import React from 'react';
|
|
9
6
|
import { SuffixWraper } from '../Text/Text.styles';
|
|
10
|
-
import Text from '../Text/Text';
|
|
7
|
+
import Text from '../Text/Text';
|
|
11
8
|
|
|
9
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
12
10
|
export var SelectItem = styled(function (_ref) {
|
|
13
11
|
var children = _ref.children,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
disabled = _ref.disabled,
|
|
13
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
17
14
|
return (
|
|
18
15
|
/*#__PURE__*/
|
|
19
16
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
@@ -1,22 +1,17 @@
|
|
|
1
1
|
var _excluded = ["disabled", "children", "prefixel", "suffixel", "key"];
|
|
2
|
-
|
|
3
2
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
-
|
|
5
3
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
6
|
-
|
|
7
4
|
import React from 'react';
|
|
8
5
|
import { v4 as uuid } from 'uuid';
|
|
9
6
|
import '@synerise/ds-core/dist/js/style';
|
|
10
7
|
import * as S from './SubmenuText.styles';
|
|
11
|
-
|
|
12
8
|
var SubmenuText = function SubmenuText(props) {
|
|
13
9
|
var disabled = props.disabled,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
10
|
+
children = props.children,
|
|
11
|
+
prefixel = props.prefixel,
|
|
12
|
+
suffixel = props.suffixel,
|
|
13
|
+
key = props.key,
|
|
14
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded);
|
|
20
15
|
return /*#__PURE__*/React.createElement(S.SubtitleItemWrapper, {
|
|
21
16
|
className: "ds-submenu-title-wrapper"
|
|
22
17
|
}, /*#__PURE__*/React.createElement(S.SubmenuText, _extends({
|
|
@@ -27,5 +22,4 @@ var SubmenuText = function SubmenuText(props) {
|
|
|
27
22
|
className: "ds-submenu-title"
|
|
28
23
|
}, rest), children));
|
|
29
24
|
};
|
|
30
|
-
|
|
31
25
|
export default SubmenuText;
|
|
@@ -1,27 +1,24 @@
|
|
|
1
1
|
var _excluded = ["children", "disabled", "childrenCollapsed"];
|
|
2
|
-
|
|
3
2
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
-
|
|
5
3
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
6
|
-
|
|
7
4
|
import styled from 'styled-components';
|
|
8
5
|
import React from 'react';
|
|
9
6
|
import { ContentWrapper } from '../Text/Text.styles';
|
|
10
|
-
import Text from '../Text/Text';
|
|
7
|
+
import Text from '../Text/Text';
|
|
11
8
|
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
12
10
|
var NOOP = function NOOP() {};
|
|
13
|
-
|
|
14
11
|
export var SubtitleItemWrapper = styled.ul.withConfig({
|
|
15
12
|
displayName: "SubmenuTextstyles__SubtitleItemWrapper",
|
|
16
13
|
componentId: "dxm3s9-0"
|
|
17
|
-
})(["display:flex;flex:1;"]);
|
|
14
|
+
})(["display:flex;flex:1;"]);
|
|
18
15
|
|
|
16
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
19
17
|
export var SubmenuText = styled(function (_ref) {
|
|
20
18
|
var children = _ref.children,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
disabled = _ref.disabled,
|
|
20
|
+
childrenCollapsed = _ref.childrenCollapsed,
|
|
21
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
25
22
|
return (
|
|
26
23
|
/*#__PURE__*/
|
|
27
24
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
var _excluded = ["parent", "disabled", "prefixel", "suffixel", "danger", "children", "description", "copyable", "copyHint", "copyValue", "copyTooltip", "timeToHideTooltip", "highlight", "style", "prefixVisibilityTrigger", "suffixVisibilityTrigger", "indentLevel", "ordered", "onClick", "checked", "tooltipProps", "hoverTooltipProps", "renderHoverTooltip", "size", "onItemHover"];
|
|
2
|
-
|
|
3
2
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
4
|
-
|
|
5
3
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
6
|
-
|
|
7
4
|
import React from 'react';
|
|
8
5
|
import "rc-trigger/assets/index.css";
|
|
9
6
|
import classNames from 'classnames';
|
|
@@ -17,30 +14,26 @@ import { theme } from '@synerise/ds-core';
|
|
|
17
14
|
import * as S from './Text.styles';
|
|
18
15
|
import { triggerPlacements } from '../../../utils';
|
|
19
16
|
import { VisibilityTrigger } from '../../../Menu.types';
|
|
20
|
-
|
|
21
17
|
var renderAddon = function renderAddon(addon) {
|
|
22
18
|
for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
23
19
|
params[_key - 1] = arguments[_key];
|
|
24
20
|
}
|
|
25
|
-
|
|
26
21
|
return addon instanceof Function ? addon.apply(void 0, params) : addon;
|
|
27
22
|
};
|
|
28
|
-
|
|
29
23
|
function WithHoverTooltip(_ref) {
|
|
30
24
|
var _hoverTooltipProps$de;
|
|
31
|
-
|
|
32
25
|
var hoverTooltipProps = _ref.hoverTooltipProps,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
26
|
+
renderHoverTooltip = _ref.renderHoverTooltip,
|
|
27
|
+
children = _ref.children,
|
|
28
|
+
style = _ref.style;
|
|
36
29
|
var dsTheme = useTheme();
|
|
37
30
|
var zIndex = parseInt(dsTheme.variables['zindex-tooltip'], 10);
|
|
38
31
|
var cancelBubblingEvent = React.useCallback(function () {
|
|
39
32
|
return function (ev) {
|
|
40
33
|
ev.stopPropagation();
|
|
41
34
|
};
|
|
42
|
-
}, []);
|
|
43
|
-
|
|
35
|
+
}, []);
|
|
36
|
+
// onKeyDown is used to disallow propagating key events to tooltip's container element
|
|
44
37
|
return (
|
|
45
38
|
/*#__PURE__*/
|
|
46
39
|
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
@@ -64,44 +57,40 @@ function WithHoverTooltip(_ref) {
|
|
|
64
57
|
}, children)))
|
|
65
58
|
);
|
|
66
59
|
}
|
|
67
|
-
|
|
68
60
|
var Text = function Text(_ref2) {
|
|
69
61
|
var parent = _ref2.parent,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
62
|
+
disabled = _ref2.disabled,
|
|
63
|
+
prefixel = _ref2.prefixel,
|
|
64
|
+
suffixel = _ref2.suffixel,
|
|
65
|
+
danger = _ref2.danger,
|
|
66
|
+
children = _ref2.children,
|
|
67
|
+
description = _ref2.description,
|
|
68
|
+
copyable = _ref2.copyable,
|
|
69
|
+
copyHint = _ref2.copyHint,
|
|
70
|
+
copyValue = _ref2.copyValue,
|
|
71
|
+
copyTooltip = _ref2.copyTooltip,
|
|
72
|
+
timeToHideTooltip = _ref2.timeToHideTooltip,
|
|
73
|
+
highlight = _ref2.highlight,
|
|
74
|
+
style = _ref2.style,
|
|
75
|
+
prefixVisibilityTrigger = _ref2.prefixVisibilityTrigger,
|
|
76
|
+
suffixVisibilityTrigger = _ref2.suffixVisibilityTrigger,
|
|
77
|
+
indentLevel = _ref2.indentLevel,
|
|
78
|
+
ordered = _ref2.ordered,
|
|
79
|
+
onClick = _ref2.onClick,
|
|
80
|
+
checked = _ref2.checked,
|
|
81
|
+
tooltipProps = _ref2.tooltipProps,
|
|
82
|
+
hoverTooltipProps = _ref2.hoverTooltipProps,
|
|
83
|
+
renderHoverTooltip = _ref2.renderHoverTooltip,
|
|
84
|
+
_ref2$size = _ref2.size,
|
|
85
|
+
size = _ref2$size === void 0 ? 'default' : _ref2$size,
|
|
86
|
+
onItemHover = _ref2.onItemHover,
|
|
87
|
+
rest = _objectWithoutPropertiesLoose(_ref2, _excluded);
|
|
97
88
|
var _React$useState = React.useState(false),
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
89
|
+
hovered = _React$useState[0],
|
|
90
|
+
setHovered = _React$useState[1];
|
|
101
91
|
var _React$useState2 = React.useState(false),
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
92
|
+
clicked = _React$useState2[0],
|
|
93
|
+
setClicked = _React$useState2[1];
|
|
105
94
|
var canCopyToClipboard = copyable && copyHint && copyValue && !disabled;
|
|
106
95
|
var showSuffixOnHover = suffixVisibilityTrigger === VisibilityTrigger.HOVER;
|
|
107
96
|
var showPrefixOnHover = prefixVisibilityTrigger === VisibilityTrigger.HOVER;
|
|
@@ -111,15 +100,12 @@ var Text = function Text(_ref2) {
|
|
|
111
100
|
var prefixElement = React.useMemo(function () {
|
|
112
101
|
return renderAddon(prefixel, hovered);
|
|
113
102
|
}, [prefixel, hovered]);
|
|
114
|
-
|
|
115
103
|
var renderChildren = function renderChildren() {
|
|
116
104
|
if (highlight && typeof children === 'string') {
|
|
117
105
|
var index = children.toLocaleLowerCase().indexOf(highlight.toLocaleLowerCase());
|
|
118
|
-
|
|
119
106
|
if (index === -1) {
|
|
120
107
|
return children;
|
|
121
108
|
}
|
|
122
|
-
|
|
123
109
|
var escapedHighlight = escapeRegEx(highlight);
|
|
124
110
|
var startOfQuery = children.toLowerCase().search(escapedHighlight.toLowerCase());
|
|
125
111
|
var endOfQuery = startOfQuery + highlight.length;
|
|
@@ -129,29 +115,23 @@ var Text = function Text(_ref2) {
|
|
|
129
115
|
}, children.substring(startOfQuery, endOfQuery)), children.substring(endOfQuery, children.length)];
|
|
130
116
|
return resultArray;
|
|
131
117
|
}
|
|
132
|
-
|
|
133
118
|
return children;
|
|
134
119
|
};
|
|
135
|
-
|
|
136
120
|
var shouldRenderSuffix = React.useMemo(function () {
|
|
137
121
|
if (showSuffixOnHover) {
|
|
138
122
|
return (!!suffixElement || !!checked) && hovered;
|
|
139
123
|
}
|
|
140
|
-
|
|
141
124
|
return !!suffixElement || !!checked;
|
|
142
125
|
}, [showSuffixOnHover, suffixElement, checked, hovered]);
|
|
143
126
|
var shouldRenderPrefix = React.useMemo(function () {
|
|
144
127
|
if (showPrefixOnHover) {
|
|
145
128
|
return !!prefixElement && hovered;
|
|
146
129
|
}
|
|
147
|
-
|
|
148
130
|
return !!prefixElement;
|
|
149
131
|
}, [showPrefixOnHover, prefixElement, hovered]);
|
|
150
|
-
|
|
151
132
|
var renderPrefixElement = function renderPrefixElement(isHover) {
|
|
152
133
|
return prefixel instanceof Function ? prefixel(isHover) : prefixel;
|
|
153
134
|
};
|
|
154
|
-
|
|
155
135
|
var className = React.useMemo(function () {
|
|
156
136
|
return classNames('ds-menu-item', rest.className, size);
|
|
157
137
|
}, [rest.className, size]);
|
|
@@ -209,7 +189,6 @@ var Text = function Text(_ref2) {
|
|
|
209
189
|
component: /*#__PURE__*/React.createElement(CheckS, null),
|
|
210
190
|
color: theme.palette["green-600"]
|
|
211
191
|
}), suffixElement)))));
|
|
212
|
-
|
|
213
192
|
if (renderHoverTooltip) {
|
|
214
193
|
return /*#__PURE__*/React.createElement(WithHoverTooltip, {
|
|
215
194
|
hoverTooltipProps: hoverTooltipProps,
|
|
@@ -217,8 +196,6 @@ var Text = function Text(_ref2) {
|
|
|
217
196
|
style: style
|
|
218
197
|
}, element);
|
|
219
198
|
}
|
|
220
|
-
|
|
221
199
|
return element;
|
|
222
200
|
};
|
|
223
|
-
|
|
224
201
|
export default Text;
|
|
@@ -4,20 +4,16 @@ import { IconContainer } from '@synerise/ds-icon';
|
|
|
4
4
|
import { ItemSize } from '../MenuItem.types';
|
|
5
5
|
var INDENT_LEVEL_STEP = 16;
|
|
6
6
|
var TRANSITION_FN = '0.2s ease-out';
|
|
7
|
-
|
|
8
7
|
var calculateIndent = function calculateIndent(indentLevel) {
|
|
9
8
|
var indentLevelPadding = indentLevel && Number(indentLevel) > 0 ? indentLevel * INDENT_LEVEL_STEP : 0;
|
|
10
9
|
return indentLevelPadding;
|
|
11
10
|
};
|
|
12
|
-
|
|
13
11
|
var hiddenElementStyle = function hiddenElementStyle() {
|
|
14
12
|
return css(["opacity:0;pointer-events:none;"]);
|
|
15
13
|
};
|
|
16
|
-
|
|
17
14
|
var visibleElementStyle = function visibleElementStyle() {
|
|
18
15
|
return css(["opacity:1;pointer-events:all;"]);
|
|
19
16
|
};
|
|
20
|
-
|
|
21
17
|
export var ArrowRight = styled.div.withConfig({
|
|
22
18
|
displayName: "Textstyles__ArrowRight",
|
|
23
19
|
componentId: "dgb761-0"
|
|
@@ -38,23 +34,18 @@ export var PrefixelWrapper = styled.div.withConfig({
|
|
|
38
34
|
}, TRANSITION_FN, function (props) {
|
|
39
35
|
return !!props.disabled && "svg {fill: " + props.theme.palette['grey-600'] + "};";
|
|
40
36
|
});
|
|
41
|
-
|
|
42
37
|
var disableOrdering = function disableOrdering() {
|
|
43
38
|
return css(["&::before{content:none;}"]);
|
|
44
39
|
};
|
|
45
|
-
|
|
46
40
|
var applySizeStyles = function applySizeStyles(props) {
|
|
47
41
|
if (props.size === ItemSize.LARGE) {
|
|
48
42
|
return css(["&.large{min-height:50px;}"]);
|
|
49
43
|
}
|
|
50
|
-
|
|
51
44
|
if (props.size === ItemSize.DEFAULT && !props.description) {
|
|
52
45
|
return css(["&.default{max-height:32px;}"]);
|
|
53
46
|
}
|
|
54
|
-
|
|
55
47
|
return css([""]);
|
|
56
48
|
};
|
|
57
|
-
|
|
58
49
|
export var Wrapper = styled(MenuItem).withConfig({
|
|
59
50
|
displayName: "Textstyles__Wrapper",
|
|
60
51
|
componentId: "dgb761-3"
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
var _excluded = ["text", "prefixel", "suffixel", "subMenu", "disabled", "danger", "ordered", "onTitleClick", "menuItemKey", "selectedKeys", "suffixVisibilityTrigger", "prefixVisibilityTrigger", "size", "description"];
|
|
2
|
-
|
|
3
2
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
-
|
|
5
3
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
6
|
-
|
|
7
4
|
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
|
8
|
-
|
|
9
5
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
10
|
-
|
|
11
6
|
import React from 'react';
|
|
12
7
|
import { v4 as uuid } from 'uuid';
|
|
13
8
|
import classNames from 'classnames';
|
|
@@ -15,41 +10,35 @@ import '@synerise/ds-core/dist/js/style';
|
|
|
15
10
|
import * as S from '../../Menu.styles';
|
|
16
11
|
import MenuItem from '../Item/MenuItem';
|
|
17
12
|
import SubmenuText from '../Item/SubmenuText/SubmenuText';
|
|
18
|
-
|
|
19
13
|
var SubMenuItem = /*#__PURE__*/function (_React$PureComponent) {
|
|
20
14
|
function SubMenuItem(props) {
|
|
21
15
|
var _this;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
_this = _React$PureComponent.call(this, props) || this;
|
|
17
|
+
// eslint-disable-next-line react/state-in-constructor
|
|
25
18
|
_this.state = {
|
|
26
19
|
uuidKey: uuid()
|
|
27
20
|
};
|
|
28
21
|
return _this;
|
|
29
22
|
}
|
|
30
|
-
|
|
31
23
|
_inheritsLoose(SubMenuItem, _React$PureComponent);
|
|
32
|
-
|
|
33
24
|
var _proto = SubMenuItem.prototype;
|
|
34
|
-
|
|
35
25
|
_proto.render = function render() {
|
|
36
26
|
var _this$props = this.props,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
27
|
+
text = _this$props.text,
|
|
28
|
+
prefixel = _this$props.prefixel,
|
|
29
|
+
suffixel = _this$props.suffixel,
|
|
30
|
+
subMenu = _this$props.subMenu,
|
|
31
|
+
disabled = _this$props.disabled,
|
|
32
|
+
danger = _this$props.danger,
|
|
33
|
+
ordered = _this$props.ordered,
|
|
34
|
+
onTitleClick = _this$props.onTitleClick,
|
|
35
|
+
menuItemKey = _this$props.menuItemKey,
|
|
36
|
+
selectedKeys = _this$props.selectedKeys,
|
|
37
|
+
suffixVisibilityTrigger = _this$props.suffixVisibilityTrigger,
|
|
38
|
+
prefixVisibilityTrigger = _this$props.prefixVisibilityTrigger,
|
|
39
|
+
size = _this$props.size,
|
|
40
|
+
description = _this$props.description,
|
|
41
|
+
rest = _objectWithoutPropertiesLoose(_this$props, _excluded);
|
|
53
42
|
var uuidKey = this.state.uuidKey;
|
|
54
43
|
return /*#__PURE__*/React.createElement(S.SubMenuItem, _extends({
|
|
55
44
|
title: /*#__PURE__*/React.createElement(SubmenuText, {
|
|
@@ -73,7 +62,8 @@ var SubMenuItem = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
73
62
|
className: classNames('ds-menu-item', {
|
|
74
63
|
'ant-menu-item-selected': !!menuItemKey && !!selectedKeys && selectedKeys.includes(menuItemKey)
|
|
75
64
|
})
|
|
76
|
-
}), Boolean(subMenu) &&
|
|
65
|
+
}), Boolean(subMenu) &&
|
|
66
|
+
// @ts-ignore */
|
|
77
67
|
subMenu.map(function (subItem, index) {
|
|
78
68
|
return /*#__PURE__*/React.createElement(MenuItem, _extends({
|
|
79
69
|
parent: subItem.parent,
|
|
@@ -86,7 +76,8 @@ var SubMenuItem = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
86
76
|
ordered: subItem.ordered === undefined ? ordered : subItem.ordered,
|
|
87
77
|
description: subItem.description,
|
|
88
78
|
suffixVisibilityTrigger: subItem.suffixVisibilityTrigger,
|
|
89
|
-
prefixVisibilityTrigger: subItem.prefixVisibilityTrigger
|
|
79
|
+
prefixVisibilityTrigger: subItem.prefixVisibilityTrigger
|
|
80
|
+
// eslint-disable-next-line react/jsx-handler-names
|
|
90
81
|
,
|
|
91
82
|
onClick: function onClick() {
|
|
92
83
|
subItem.onClick && subItem.onClick(subItem);
|
|
@@ -98,8 +89,6 @@ var SubMenuItem = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
98
89
|
}, subItem));
|
|
99
90
|
}));
|
|
100
91
|
};
|
|
101
|
-
|
|
102
92
|
return SubMenuItem;
|
|
103
93
|
}(React.PureComponent);
|
|
104
|
-
|
|
105
94
|
export default SubMenuItem;
|
package/dist/Menu.js
CHANGED
|
@@ -1,23 +1,13 @@
|
|
|
1
1
|
var _excluded = ["dataSource", "ordered", "selectable", "children", "showTextTooltip", "texts", "maxToShowItems"];
|
|
2
|
-
|
|
3
2
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
-
|
|
5
3
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
6
|
-
|
|
7
4
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
8
|
-
|
|
9
5
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
10
|
-
|
|
11
6
|
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
|
12
|
-
|
|
13
7
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
14
|
-
|
|
15
8
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
16
|
-
|
|
17
9
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
18
|
-
|
|
19
10
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
20
|
-
|
|
21
11
|
import React, { Children, Component } from 'react';
|
|
22
12
|
import Button from '@synerise/ds-button';
|
|
23
13
|
import Icon, { ArrowDownCircleM, ArrowUpCircleM } from '@synerise/ds-icon';
|
|
@@ -33,46 +23,35 @@ import Header from './Elements/Header/Header';
|
|
|
33
23
|
export var Menu = /*#__PURE__*/function (_Component) {
|
|
34
24
|
function Menu() {
|
|
35
25
|
var _this;
|
|
36
|
-
|
|
37
26
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
38
27
|
args[_key] = arguments[_key];
|
|
39
28
|
}
|
|
40
|
-
|
|
41
29
|
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
|
|
42
|
-
|
|
43
30
|
_defineProperty(_this, "state", {
|
|
44
31
|
allItemsVisible: false
|
|
45
32
|
});
|
|
46
|
-
|
|
47
33
|
return _this;
|
|
48
34
|
}
|
|
49
|
-
|
|
50
35
|
_inheritsLoose(Menu, _Component);
|
|
51
|
-
|
|
52
36
|
var _proto = Menu.prototype;
|
|
53
|
-
|
|
54
37
|
_proto.toggleItems = function toggleItems() {
|
|
55
38
|
var allItemsVisible = this.state.allItemsVisible;
|
|
56
39
|
this.setState({
|
|
57
40
|
allItemsVisible: !allItemsVisible
|
|
58
41
|
});
|
|
59
42
|
};
|
|
60
|
-
|
|
61
43
|
_proto.render = function render() {
|
|
62
44
|
var _this2 = this;
|
|
63
|
-
|
|
64
45
|
var _this$props = this.props,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
46
|
+
dataSource = _this$props.dataSource,
|
|
47
|
+
ordered = _this$props.ordered,
|
|
48
|
+
selectable = _this$props.selectable,
|
|
49
|
+
children = _this$props.children,
|
|
50
|
+
showTextTooltip = _this$props.showTextTooltip,
|
|
51
|
+
texts = _this$props.texts,
|
|
52
|
+
maxToShowItems = _this$props.maxToShowItems,
|
|
53
|
+
rest = _objectWithoutPropertiesLoose(_this$props, _excluded);
|
|
74
54
|
var allItemsVisible = this.state.allItemsVisible;
|
|
75
|
-
|
|
76
55
|
var allTexts = _objectSpread({
|
|
77
56
|
showLess: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
78
57
|
id: "DS.MENU.SHOW-LESS",
|
|
@@ -83,7 +62,6 @@ export var Menu = /*#__PURE__*/function (_Component) {
|
|
|
83
62
|
defaultMessage: "Show more"
|
|
84
63
|
})
|
|
85
64
|
}, texts);
|
|
86
|
-
|
|
87
65
|
var isListTogglable = maxToShowItems !== undefined;
|
|
88
66
|
var isDataSource = dataSource !== undefined;
|
|
89
67
|
var childrenArray = Children.toArray(children);
|
|
@@ -153,20 +131,12 @@ export var Menu = /*#__PURE__*/function (_Component) {
|
|
|
153
131
|
}, rest, item));
|
|
154
132
|
}) : visibleChildren), toggleButton);
|
|
155
133
|
};
|
|
156
|
-
|
|
157
134
|
return Menu;
|
|
158
135
|
}(Component);
|
|
159
|
-
|
|
160
136
|
_defineProperty(Menu, "Item", MenuItem);
|
|
161
|
-
|
|
162
137
|
_defineProperty(Menu, "Breadcrumb", Breadcrumb);
|
|
163
|
-
|
|
164
138
|
_defineProperty(Menu, "Header", Header);
|
|
165
|
-
|
|
166
139
|
_defineProperty(Menu, "ItemGroup", S.AntdMenu.ItemGroup);
|
|
167
|
-
|
|
168
140
|
_defineProperty(Menu, "SubMenu", S.AntdMenu.SubMenu);
|
|
169
|
-
|
|
170
141
|
_defineProperty(Menu, "Divider", S.MenuDivider);
|
|
171
|
-
|
|
172
142
|
export default Menu;
|
package/dist/Menu.styles.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import styled, { css } from 'styled-components';
|
|
2
2
|
import { Menu } from 'antd';
|
|
3
3
|
var overflowStyles = css(["text-overflow:ellipsis;overflow:hidden;white-space:nowrap;"]);
|
|
4
|
-
|
|
5
4
|
var arrowDownSvgWithCustomColor = function arrowDownSvgWithCustomColor(color) {
|
|
6
5
|
var colorValueForSvg = color.replace(/#/, '%23');
|
|
7
6
|
var iconWithColor = "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' >/><path fill='none' d='M0 0h24v24H0z' /><path style='fill: " + colorValueForSvg + ";' d='M14.71973,9.84473,12,12.56445,9.28027,9.84473a.74992.74992,0,0,0-1.06054,1.06054l3.25,3.25a.74971.74971,0,0,0,1.06054,0l3.25-3.25a.74992.74992,0,0,0-1.06054-1.06054Z'/></svg>";
|
|
8
7
|
return iconWithColor;
|
|
9
8
|
};
|
|
10
|
-
|
|
11
9
|
export var MenuDivider = styled.div.withConfig({
|
|
12
10
|
displayName: "Menustyles__MenuDivider",
|
|
13
11
|
componentId: "sc-10eu0qe-0"
|
package/dist/Menu.types.js
CHANGED
package/dist/utils.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-menu",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.7",
|
|
4
4
|
"description": "Menu UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
],
|
|
35
35
|
"types": "dist/index.d.ts",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@synerise/ds-button": "^0.21.
|
|
38
|
-
"@synerise/ds-icon": "^0.
|
|
39
|
-
"@synerise/ds-tooltip": "^0.14.
|
|
40
|
-
"@synerise/ds-utils": "^0.31.
|
|
37
|
+
"@synerise/ds-button": "^0.21.20",
|
|
38
|
+
"@synerise/ds-icon": "^0.67.1",
|
|
39
|
+
"@synerise/ds-tooltip": "^0.14.50",
|
|
40
|
+
"@synerise/ds-utils": "^0.31.2",
|
|
41
41
|
"classnames": "2.3.2",
|
|
42
42
|
"copy-to-clipboard": "^3.3.1",
|
|
43
43
|
"rc-menu": "8.10.7",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"react": ">=16.9.0 <= 17.0.2",
|
|
51
51
|
"styled-components": "^5.0.1"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "4a56ee7ef816c22341ce704154dc7aa65b7d1dcc"
|
|
54
54
|
}
|