@synerise/ds-menu 1.4.12 → 1.4.13
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 +4 -0
- package/dist/Elements/Breadcrumb/Breadcrumb.d.ts +3 -3
- package/dist/Elements/Breadcrumb/Breadcrumb.js +53 -74
- package/dist/Elements/Breadcrumb/Breadcrumb.styles.d.ts +10 -10
- package/dist/Elements/Breadcrumb/Breadcrumb.styles.js +45 -60
- package/dist/Elements/Breadcrumb/Breadcrumb.types.d.ts +1 -1
- package/dist/Elements/Breadcrumb/Breadcrumb.types.js +1 -1
- package/dist/Elements/Divider/Divider.d.ts +3 -3
- package/dist/Elements/Divider/Divider.js +8 -9
- package/dist/Elements/Divider/Divider.styles.d.ts +2 -2
- package/dist/Elements/Divider/Divider.styles.js +7 -8
- package/dist/Elements/Header/Header.d.ts +2 -2
- package/dist/Elements/Header/Header.js +15 -15
- package/dist/Elements/Header/Header.styles.d.ts +2 -2
- package/dist/Elements/Header/Header.styles.js +9 -9
- package/dist/Elements/Header/Header.types.js +1 -1
- package/dist/Elements/Item/Danger/Danger.d.ts +2 -3
- package/dist/Elements/Item/Danger/Danger.js +10 -10
- package/dist/Elements/Item/Danger/Danger.styles.d.ts +2 -2
- package/dist/Elements/Item/Danger/Danger.styles.js +28 -33
- package/dist/Elements/Item/MenuItem.d.ts +2 -3
- package/dist/Elements/Item/MenuItem.js +45 -89
- package/dist/Elements/Item/Select/Select.d.ts +2 -3
- package/dist/Elements/Item/Select/Select.js +12 -16
- package/dist/Elements/Item/Select/Select.styles.d.ts +2 -2
- package/dist/Elements/Item/Select/Select.styles.js +13 -18
- package/dist/Elements/Item/SubmenuText/SubmenuText.d.ts +2 -3
- package/dist/Elements/Item/SubmenuText/SubmenuText.js +15 -24
- package/dist/Elements/Item/SubmenuText/SubmenuText.styles.d.ts +3 -3
- package/dist/Elements/Item/SubmenuText/SubmenuText.styles.js +18 -23
- package/dist/Elements/Item/Text/DynamicLabel.d.ts +1 -1
- package/dist/Elements/Item/Text/DynamicLabel.js +15 -10
- package/dist/Elements/Item/Text/Text.const.d.ts +1 -1
- package/dist/Elements/Item/Text/Text.const.js +13 -6
- package/dist/Elements/Item/Text/Text.d.ts +2 -2
- package/dist/Elements/Item/Text/Text.js +131 -196
- package/dist/Elements/Item/Text/Text.styles.d.ts +15 -15
- package/dist/Elements/Item/Text/Text.styles.js +68 -112
- package/dist/Elements/Item/Text/Text.types.d.ts +3 -3
- package/dist/Elements/Item/Text/Text.types.js +1 -1
- package/dist/Elements/SubMenu/SubMenu.d.ts +2 -3
- package/dist/Elements/SubMenu/SubMenu.js +44 -89
- package/dist/Elements/index.js +4 -1
- package/dist/Menu.d.ts +6 -8
- package/dist/Menu.js +71 -136
- package/dist/Menu.styles.d.ts +4 -4
- package/dist/Menu.styles.js +26 -76
- package/dist/Menu.types.d.ts +4 -4
- package/dist/Menu.types.js +22 -22
- package/dist/assets/style/index-tn0RQdqM.css +0 -0
- package/dist/hooks/useTemporaryLabel.d.ts +1 -1
- package/dist/hooks/useTemporaryLabel.js +12 -13
- package/dist/index.js +25 -18
- package/dist/modules.d.js +1 -1
- package/dist/modules.d.ts +0 -0
- package/dist/utils/getCopyConfig.d.ts +2 -2
- package/dist/utils/getCopyConfig.js +21 -17
- package/package.json +11 -10
package/dist/Menu.js
CHANGED
|
@@ -1,146 +1,81 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import { Divider } from './Elements/Divider/Divider';
|
|
15
|
-
import Header from './Elements/Header/Header';
|
|
16
|
-
import MenuItem from './Elements/Item/MenuItem';
|
|
17
|
-
import SubMenuItem from './Elements/SubMenu/SubMenu';
|
|
18
|
-
import * as S from './Menu.styles';
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Component, Children } from "react";
|
|
3
|
+
import { FormattedMessage } from "react-intl";
|
|
4
|
+
import Button from "@synerise/ds-button";
|
|
5
|
+
import Icon, { ArrowUpCircleM, ArrowDownCircleM } from "@synerise/ds-icon";
|
|
6
|
+
import { FloatingDelayGroup } from "@synerise/ds-popover";
|
|
7
|
+
import Tooltip from "@synerise/ds-tooltip";
|
|
8
|
+
import Breadcrumb from "./Elements/Breadcrumb/Breadcrumb.js";
|
|
9
|
+
import { Divider } from "./Elements/Divider/Divider.js";
|
|
10
|
+
import MenuHeader from "./Elements/Header/Header.js";
|
|
11
|
+
import MenuItem from "./Elements/Item/MenuItem.js";
|
|
12
|
+
import SubMenuItem from "./Elements/SubMenu/SubMenu.js";
|
|
13
|
+
import { AntdMenu } from "./Menu.styles.js";
|
|
19
14
|
import "./style/index.css";
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
args[_key] = arguments[_key];
|
|
25
|
-
}
|
|
26
|
-
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
|
|
27
|
-
_this.state = {
|
|
15
|
+
const _Menu = class _Menu extends Component {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
this.state = {
|
|
28
19
|
allItemsVisible: false
|
|
29
20
|
};
|
|
30
|
-
return _this;
|
|
31
21
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
22
|
+
toggleItems() {
|
|
23
|
+
const {
|
|
24
|
+
allItemsVisible
|
|
25
|
+
} = this.state;
|
|
36
26
|
this.setState({
|
|
37
27
|
allItemsVisible: !allItemsVisible
|
|
38
28
|
});
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
_this$props$popoverDe = _this$props.popoverDelay,
|
|
51
|
-
popoverDelay = _this$props$popoverDe === void 0 ? {
|
|
29
|
+
}
|
|
30
|
+
render() {
|
|
31
|
+
const {
|
|
32
|
+
dataSource,
|
|
33
|
+
ordered,
|
|
34
|
+
selectable,
|
|
35
|
+
children,
|
|
36
|
+
showTextTooltip,
|
|
37
|
+
texts,
|
|
38
|
+
maxToShowItems,
|
|
39
|
+
popoverDelay = {
|
|
52
40
|
open: 100,
|
|
53
41
|
close: 400
|
|
54
|
-
} : _this$props$popoverDe,
|
|
55
|
-
rest = _objectWithoutPropertiesLoose(_this$props, _excluded);
|
|
56
|
-
var allItemsVisible = this.state.allItemsVisible;
|
|
57
|
-
var allTexts = _extends({
|
|
58
|
-
showLess: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
59
|
-
id: "DS.MENU.SHOW-LESS",
|
|
60
|
-
defaultMessage: "Show less"
|
|
61
|
-
}),
|
|
62
|
-
showMore: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
63
|
-
id: "DS.MENU.SHOW-MORE",
|
|
64
|
-
defaultMessage: "Show more"
|
|
65
|
-
})
|
|
66
|
-
}, texts);
|
|
67
|
-
var isListTogglable = maxToShowItems !== undefined;
|
|
68
|
-
var isDataSource = dataSource !== undefined;
|
|
69
|
-
var childrenArray = Children.toArray(children);
|
|
70
|
-
var itemsCount = (isDataSource ? dataSource.length : childrenArray.length) || 0;
|
|
71
|
-
var itemsOverLimit = isListTogglable ? itemsCount - maxToShowItems : 0;
|
|
72
|
-
var visibleItems = allItemsVisible || !isListTogglable ? dataSource : dataSource == null ? void 0 : dataSource.slice(0, maxToShowItems);
|
|
73
|
-
var visibleChildren = allItemsVisible || !isListTogglable ? children : childrenArray.slice(0, maxToShowItems);
|
|
74
|
-
var toggleButtonLabel = allItemsVisible ? allTexts.showLess : allTexts.showMore;
|
|
75
|
-
var toggleButton = isListTogglable && itemsOverLimit > 0 && /*#__PURE__*/React.createElement(Button, {
|
|
76
|
-
onClick: function onClick() {
|
|
77
|
-
return _this2.toggleItems();
|
|
78
42
|
},
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
disabled: item.disabled,
|
|
119
|
-
text: showTextTooltip ? /*#__PURE__*/React.createElement(Tooltip, {
|
|
120
|
-
title: item.text
|
|
121
|
-
}, item.text) : item.text,
|
|
122
|
-
description: item.description,
|
|
123
|
-
subMenu: item.subMenu,
|
|
124
|
-
ordered: item.ordered === undefined ? ordered : item.ordered,
|
|
125
|
-
copyable: item.copyable,
|
|
126
|
-
copyHint: item.copyHint,
|
|
127
|
-
copyValue: item.copyValue,
|
|
128
|
-
highlight: item.highlight,
|
|
129
|
-
suffixVisibilityTrigger: item.suffixVisibilityTrigger,
|
|
130
|
-
prefixVisibilityTrigger: item.prefixVisibilityTrigger,
|
|
131
|
-
indentLevel: item.indentLevel || 0,
|
|
132
|
-
type: item.type,
|
|
133
|
-
key: item.key || "" + item.text + index,
|
|
134
|
-
menuItemKey: item.key || "" + item.text + index
|
|
135
|
-
}, rest, item));
|
|
136
|
-
}) : visibleChildren)), toggleButton);
|
|
137
|
-
};
|
|
138
|
-
return Menu;
|
|
139
|
-
}(Component);
|
|
140
|
-
Menu.Item = MenuItem;
|
|
141
|
-
Menu.Breadcrumb = Breadcrumb;
|
|
142
|
-
Menu.Header = Header;
|
|
143
|
-
Menu.ItemGroup = S.AntdMenu.ItemGroup;
|
|
144
|
-
Menu.SubMenu = S.AntdMenu.SubMenu;
|
|
145
|
-
Menu.Divider = Divider;
|
|
146
|
-
export default Menu;
|
|
43
|
+
...rest
|
|
44
|
+
} = this.props;
|
|
45
|
+
const {
|
|
46
|
+
allItemsVisible
|
|
47
|
+
} = this.state;
|
|
48
|
+
const allTexts = {
|
|
49
|
+
showLess: /* @__PURE__ */ jsx(FormattedMessage, { id: "DS.MENU.SHOW-LESS", defaultMessage: "Show less" }),
|
|
50
|
+
showMore: /* @__PURE__ */ jsx(FormattedMessage, { id: "DS.MENU.SHOW-MORE", defaultMessage: "Show more" }),
|
|
51
|
+
...texts
|
|
52
|
+
};
|
|
53
|
+
const isListTogglable = maxToShowItems !== void 0;
|
|
54
|
+
const isDataSource = dataSource !== void 0;
|
|
55
|
+
const childrenArray = Children.toArray(children);
|
|
56
|
+
const itemsCount = (isDataSource ? dataSource.length : childrenArray.length) || 0;
|
|
57
|
+
const itemsOverLimit = isListTogglable ? itemsCount - maxToShowItems : 0;
|
|
58
|
+
const visibleItems = allItemsVisible || !isListTogglable ? dataSource : dataSource?.slice(0, maxToShowItems);
|
|
59
|
+
const visibleChildren = allItemsVisible || !isListTogglable ? children : childrenArray.slice(0, maxToShowItems);
|
|
60
|
+
const toggleButtonLabel = allItemsVisible ? allTexts.showLess : allTexts.showMore;
|
|
61
|
+
const toggleButton = isListTogglable && itemsOverLimit > 0 && /* @__PURE__ */ jsxs(Button, { onClick: () => this.toggleItems(), type: "ghost-primary", mode: "icon-label", children: [
|
|
62
|
+
/* @__PURE__ */ jsx(Icon, { component: allItemsVisible ? /* @__PURE__ */ jsx(ArrowUpCircleM, {}) : /* @__PURE__ */ jsx(ArrowDownCircleM, {}) }),
|
|
63
|
+
toggleButtonLabel
|
|
64
|
+
] });
|
|
65
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
66
|
+
/* @__PURE__ */ jsx(FloatingDelayGroup, { delay: popoverDelay, children: /* @__PURE__ */ jsx(AntdMenu, { ordered, mode: "inline", inlineIndent: ordered ? 20 : 18, ...rest, selectable: selectable === void 0 ? false : selectable, children: isDataSource ? visibleItems?.map((item, index) => item.subMenu ? /* @__PURE__ */ jsx(SubMenuItem, { parent: item.parent, prefixel: item.prefixel, suffixel: item.suffixel, disabled: item.disabled, text: showTextTooltip ? /* @__PURE__ */ jsx(Tooltip, { title: item.text, children: item.text }) : item.text, description: item.description, subMenu: item.subMenu, ordered: item.ordered === void 0 ? ordered : item.ordered, copyable: item.copyable, copyHint: item.copyHint, copyValue: item.copyValue, suffixVisibilityTrigger: item.suffixVisibilityTrigger, prefixVisibilityTrigger: item.prefixVisibilityTrigger, menuItemKey: item.key || `${item.text}${index}`, ...rest, ...item, ItemComponent: MenuItem }, item.key || `${item.text}${index}`) : /* @__PURE__ */ jsx(MenuItem, { className: "ds-menu-item", parent: item.parent, prefixel: item.prefixel, suffixel: item.suffixel, disabled: item.disabled, text: showTextTooltip ? /* @__PURE__ */ jsx(Tooltip, { title: item.text, children: item.text }) : item.text, description: item.description, subMenu: item.subMenu, ordered: item.ordered === void 0 ? ordered : item.ordered, copyable: item.copyable, copyHint: item.copyHint, copyValue: item.copyValue, highlight: item.highlight, suffixVisibilityTrigger: item.suffixVisibilityTrigger, prefixVisibilityTrigger: item.prefixVisibilityTrigger, indentLevel: item.indentLevel || 0, type: item.type, menuItemKey: item.key || `${item.text}${index}`, ...rest, ...item }, item.key || `${item.text}${index}`)) : visibleChildren }) }),
|
|
67
|
+
toggleButton
|
|
68
|
+
] });
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
_Menu.Item = MenuItem;
|
|
72
|
+
_Menu.Breadcrumb = Breadcrumb;
|
|
73
|
+
_Menu.Header = MenuHeader;
|
|
74
|
+
_Menu.ItemGroup = AntdMenu.ItemGroup;
|
|
75
|
+
_Menu.SubMenu = AntdMenu.SubMenu;
|
|
76
|
+
_Menu.Divider = Divider;
|
|
77
|
+
let Menu = _Menu;
|
|
78
|
+
export {
|
|
79
|
+
Menu,
|
|
80
|
+
Menu as default
|
|
81
|
+
};
|
package/dist/Menu.styles.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Menu } from 'antd';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { PropsWithChildren, ReactNode } from 'react';
|
|
3
|
+
import { AntdMenuProps } from './Menu.types';
|
|
4
4
|
type SubMenuProps = PropsWithChildren<{
|
|
5
5
|
ordered?: boolean | undefined;
|
|
6
6
|
disabled?: boolean | undefined;
|
|
@@ -9,6 +9,6 @@ type SubMenuProps = PropsWithChildren<{
|
|
|
9
9
|
title: string | ReactNode;
|
|
10
10
|
tabIndex?: number;
|
|
11
11
|
}>;
|
|
12
|
-
export declare const AntdMenu: import(
|
|
13
|
-
export declare const SubMenuItem: import(
|
|
12
|
+
export declare const AntdMenu: import('styled-components').StyledComponent<typeof Menu, any, AntdMenuProps, never>;
|
|
13
|
+
export declare const SubMenuItem: import('styled-components').StyledComponent<typeof import('antd/lib/menu/SubMenu').default, any, SubMenuProps, never>;
|
|
14
14
|
export {};
|
package/dist/Menu.styles.js
CHANGED
|
@@ -1,82 +1,32 @@
|
|
|
1
|
-
import { Menu } from
|
|
2
|
-
import styled, { css } from
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { Menu } from "antd";
|
|
2
|
+
import styled, { css } from "styled-components";
|
|
3
|
+
const overflowStyles = /* @__PURE__ */ css(["text-overflow:ellipsis;overflow:hidden;white-space:nowrap;"]);
|
|
4
|
+
const arrowDownSvgWithCustomColor = (color) => {
|
|
5
|
+
const colorValueForSvg = color.replace(/#/, "%23");
|
|
6
|
+
const 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>`;
|
|
7
7
|
return iconWithColor;
|
|
8
8
|
};
|
|
9
|
-
|
|
9
|
+
const AntdMenu = /* @__PURE__ */ styled(Menu).withConfig({
|
|
10
10
|
displayName: "Menustyles__AntdMenu",
|
|
11
11
|
componentId: "sc-10eu0qe-0"
|
|
12
|
-
})(["", " ", " > li{> .ant-menu-submenu-title,> .-submenu-title{padding-left:12px !important;}&:not(.ant-menu-submenu){padding-left:12px !important;}}.ant-menu-submenu-title,.-submenu-title{display:flex;", " .ds-submenu-title-wrapper{", " .ds-submenu-title{padding-top:5px;padding-bottom:5px;", "}}}&&& .ant-menu-item-selected,&&& .-item-selected{&:focus:not(:active){color:", ";background:", ";box-shadow:inset 0 0 0 2px ", ";&::before{color:", ";}}}&&{.ant-menu-submenu-open,.-submenu-open{.ant-menu-inline,.-inline,.ant-menu-vertical,.-vertical,.ant-menu-vertical-left,.-vertical-left{border-right-width:0px;margin:8px 0 8px 0;padding-left:24px;}}}", ""],
|
|
13
|
-
|
|
14
|
-
}, function (props) {
|
|
15
|
-
return !!props.ordered && css(["&,ul{counter-reset:custom-counter;li:not(.ds-submenu-title){counter-increment:custom-counter;&::before{content:'0' counter(custom-counter) '. \\a0';line-height:1.39;font-weight:normal;color:", ";}}li.ant-menu-submenu,li.-submenu{&::before{content:'';}}}"], props.theme.palette['grey-500']);
|
|
16
|
-
}, overflowStyles, overflowStyles, overflowStyles, function (props) {
|
|
17
|
-
return props.theme.palette['blue-600'];
|
|
18
|
-
}, function (props) {
|
|
19
|
-
return props.theme.palette['blue-050'];
|
|
20
|
-
}, function (props) {
|
|
21
|
-
return props.theme.palette['blue-600'];
|
|
22
|
-
}, function (props) {
|
|
23
|
-
return props.theme.palette['blue-600'];
|
|
24
|
-
}, function (props) {
|
|
25
|
-
return Boolean(props.asInfoCardContainer) && css(["&&& li.ds-menu-item{padding:0 !important;}"]);
|
|
26
|
-
});
|
|
27
|
-
export var SubMenuItem = styled(Menu.SubMenu).withConfig({
|
|
12
|
+
})(["", " ", " > li{> .ant-menu-submenu-title,> .-submenu-title{padding-left:12px !important;}&:not(.ant-menu-submenu){padding-left:12px !important;}}.ant-menu-submenu-title,.-submenu-title{display:flex;", " .ds-submenu-title-wrapper{", " .ds-submenu-title{padding-top:5px;padding-bottom:5px;", "}}}&&& .ant-menu-item-selected,&&& .-item-selected{&:focus:not(:active){color:", ";background:", ";box-shadow:inset 0 0 0 2px ", ";&::before{color:", ";}}}&&{.ant-menu-submenu-open,.-submenu-open{.ant-menu-inline,.-inline,.ant-menu-vertical,.-vertical,.ant-menu-vertical-left,.-vertical-left{border-right-width:0px;margin:8px 0 8px 0;padding-left:24px;}}}", ""], (props) => Boolean(props.asDropdownMenu) && !props.asInfoCardContainer && css(["&&{padding:8px;width:100%;"]), (props) => !!props.ordered && css(["&,ul{counter-reset:custom-counter;li:not(.ds-submenu-title){counter-increment:custom-counter;&::before{content:'0' counter(custom-counter) '. \\a0';line-height:1.39;font-weight:normal;color:", ";}}li.ant-menu-submenu,li.-submenu{&::before{content:'';}}}"], props.theme.palette["grey-500"]), overflowStyles, overflowStyles, overflowStyles, (props) => props.theme.palette["blue-600"], (props) => props.theme.palette["blue-050"], (props) => props.theme.palette["blue-600"], (props) => props.theme.palette["blue-600"], (props) => Boolean(props.asInfoCardContainer) && css(["&&& li.ds-menu-item{padding:0 !important;}"]));
|
|
13
|
+
const SubMenuItem$1 = /* @__PURE__ */ styled(Menu.SubMenu).withConfig({
|
|
28
14
|
displayName: "Menustyles__SubMenuItem",
|
|
29
15
|
componentId: "sc-10eu0qe-1"
|
|
30
|
-
})(["&&&{color:", ";opacity:", ";cursor:",
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
return props.theme.palette['blue-600'];
|
|
48
|
-
}, function (props) {
|
|
49
|
-
return props.theme.palette['blue-600'];
|
|
50
|
-
}, function (props) {
|
|
51
|
-
return !props.disabled && "\n &:focus {\n > .ant-menu-submenu-title, > .-submenu-title {\n box-shadow: inset 0 0 0 2px " + props.theme.palette['blue-600'] + ";\n }\n }\n ";
|
|
52
|
-
}, function (props) {
|
|
53
|
-
return props.theme.palette['blue-600'];
|
|
54
|
-
}, function (props) {
|
|
55
|
-
return props.theme.palette['grey-700'];
|
|
56
|
-
}, function (props) {
|
|
57
|
-
return props.theme.palette['blue-050'];
|
|
58
|
-
}, function (props) {
|
|
59
|
-
return props.theme.palette['blue-600'];
|
|
60
|
-
}, function (props) {
|
|
61
|
-
return props.theme.palette['blue-050'];
|
|
62
|
-
}, function (props) {
|
|
63
|
-
return props.theme.palette['blue-600'];
|
|
64
|
-
}, function (props) {
|
|
65
|
-
return props.theme.palette['green-600'];
|
|
66
|
-
}, function (props) {
|
|
67
|
-
return props.disabled ? arrowDownSvgWithCustomColor(props.theme.palette['grey-400']) : arrowDownSvgWithCustomColor(props.theme.palette['blue-600']);
|
|
68
|
-
}, function (props) {
|
|
69
|
-
return props.theme.palette['blue-600'];
|
|
70
|
-
}, function (props) {
|
|
71
|
-
return props.theme.palette['grey-050'];
|
|
72
|
-
}, function (props) {
|
|
73
|
-
return arrowDownSvgWithCustomColor(props.theme.palette['grey-400']);
|
|
74
|
-
}, function (props) {
|
|
75
|
-
return arrowDownSvgWithCustomColor(props.theme.palette['blue-600']);
|
|
76
|
-
}, function (props) {
|
|
77
|
-
return arrowDownSvgWithCustomColor(props.theme.palette['blue-600']);
|
|
78
|
-
}, function (props) {
|
|
79
|
-
return props.disabled ? "\n > * {\n pointer-events:none;\n }" : "";
|
|
80
|
-
}, function (props) {
|
|
81
|
-
return !props.disabled && "\n color: " + (props.danger ? props.theme.palette['red-600'] : props.theme.palette['blue-600']) + ";\n background: " + (props.danger ? props.theme.palette['red-050'] : props.theme.palette['grey-050']) + ";\n ";
|
|
82
|
-
});
|
|
16
|
+
})(["&&&{color:", ";opacity:", ";cursor:", ';font-weight:500;border-radius:3px;transition:background-color 0.2s ease-out;&& .ant-menu-submenu-title:hover,&& .-submenu-title:hover{&& > i.ant-menu-submenu-arrow,&& > i.-submenu-arrow{background-image:url("', '");}.ds-submenu-title-wrapper > .ds-submenu-title{color:', ";.ds-menu-prefix{svg{fill:", ";}}}}> .ant-menu-submenu-title,> .-submenu-title{line-height:1.39;height:auto;margin:0;padding-bottom:2px;padding-top:2px;max-width:100%;align-items:center;.ds-submenu-title-wrapper > .ds-submenu-title:focus:not(:active){box-shadow:inset 0 0 0 2px transparent;background:transparent;}", "}.ant-menu-item,.-item{padding-right:5px;padding-left:10px !important;}.ant-menu-title-content{.ant-menu-item,.-item{margin-left:0;}}.ds-menu-prefix{margin-left:0px;}&.ant-menu-item-selected,&.-item-selected{background:inherit;.ant-menu-submenu-title,.-submenu-title{&:focus,&:active{background:", ";&::before{color:", ";}}& > .ds-menu-prefix{svg{fill:", ";}}&::after{content:none;}}}}", " i{right:12px;}> .ant-menu-submenu-title:hover,> .-submenu-title:hover{color:", ";}&&.ant-menu-submenu-open > .ant-menu-submenu-title,&&.-submenu-open > .-submenu-title{&:not(:hover){color:", ";}background:", ";.ds-menu-content-wrapper{color:", ";background:", ";.ds-menu-prefix{svg{fill:", ";}}.ds-check-icon{svg{fill:", ';}}}& > i.ant-menu-submenu-arrow,& > i.-submenu-arrow{transform:rotate(180deg);background-image:url("', '");}}> .ant-menu-submenu-title,> .-submenu-title{border-radius:3px;& > i.ant-menu-submenu-arrow,& > i.-submenu-arrow{transform:rotate(0deg);top:calc(50% - 12px);right:5px;height:24px;width:24px;}& > i.ant-menu-submenu-arrow::after,& > i.-submenu-arrow::after,& > i.ant-menu-submenu-arrow::before,& > i.-submenu-arrow::before{background-image:none;display:none;}&:hover > i.ant-menu-submenu-arrow::after,&:hover > i.-submenu-arrow::after,&:hover > i.ant-menu-submenu-arrow::before,&:hover > i.-submenu-arrow::before{background-image:none;}&:hover{color:', ";background:", ';}& > i.ant-menu-submenu-arrow,& > i.-submenu-arrow{background-image:url("', '");}&:hover > i.ant-menu-submenu-arrow,&:hover > i.-submenu-arrow{background-image:url("', '");}}&&.ant-menu-submenu-open > .ant-menu-submenu-title:hover,&&.-submenu-open > .-submenu-title:hover{& > i.ant-menu-submenu-arrow,& > i.-submenu-arrow{background-image:url("', '");}}> li.ant-menu-submenu,> li.-submenu{&:hover{background:none !important;}}', " > ul{li{i{right:12px;}> .ant-menu-submenu,> .-submenu{&:hover{", "}}}}}"], (props) => props.theme.palette["grey-700"], (props) => props.disabled ? "0.4" : "1", (props) => props.disabled ? "not-allowed" : "pointer", (props) => props.disabled ? arrowDownSvgWithCustomColor(props.theme.palette["grey-400"]) : arrowDownSvgWithCustomColor(props.theme.palette["blue-600"]), (props) => props.theme.palette["blue-600"], (props) => props.theme.palette["blue-600"], (props) => !!props.ordered && css(["&::before{content:'0' counter(custom-counter) '. \\a0';line-height:1.39;font-weight:normal;color:", ";}"], props.theme.palette["grey-500"]), (props) => props.theme.palette["blue-050"], (props) => props.theme.palette["blue-600"], (props) => props.theme.palette["blue-600"], (props) => !props.disabled && `
|
|
17
|
+
&:focus {
|
|
18
|
+
> .ant-menu-submenu-title, > .-submenu-title {
|
|
19
|
+
box-shadow: inset 0 0 0 2px ${props.theme.palette["blue-600"]};
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
`, (props) => props.theme.palette["blue-600"], (props) => props.theme.palette["grey-700"], (props) => props.theme.palette["blue-050"], (props) => props.theme.palette["blue-600"], (props) => props.theme.palette["blue-050"], (props) => props.theme.palette["blue-600"], (props) => props.theme.palette["green-600"], (props) => props.disabled ? arrowDownSvgWithCustomColor(props.theme.palette["grey-400"]) : arrowDownSvgWithCustomColor(props.theme.palette["blue-600"]), (props) => props.theme.palette["blue-600"], (props) => props.theme.palette["grey-050"], (props) => arrowDownSvgWithCustomColor(props.theme.palette["grey-400"]), (props) => arrowDownSvgWithCustomColor(props.theme.palette["blue-600"]), (props) => arrowDownSvgWithCustomColor(props.theme.palette["blue-600"]), (props) => props.disabled ? `
|
|
23
|
+
> * {
|
|
24
|
+
pointer-events:none;
|
|
25
|
+
}` : ``, (props) => !props.disabled && `
|
|
26
|
+
color: ${props.danger ? props.theme.palette["red-600"] : props.theme.palette["blue-600"]};
|
|
27
|
+
background: ${props.danger ? props.theme.palette["red-050"] : props.theme.palette["grey-050"]};
|
|
28
|
+
`);
|
|
29
|
+
export {
|
|
30
|
+
AntdMenu,
|
|
31
|
+
SubMenuItem$1 as SubMenuItem
|
|
32
|
+
};
|
package/dist/Menu.types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { MenuProps } from 'antd/lib/menu';
|
|
2
|
+
import { ReactElement, ReactNode } from 'react';
|
|
3
|
+
import { DelayConfig, LegacyPlacement, PopoverOptions } from '@synerise/ds-popover';
|
|
4
|
+
import { TooltipProps } from '@synerise/ds-tooltip';
|
|
5
5
|
export type MenuTexts = {
|
|
6
6
|
showLess: ReactNode;
|
|
7
7
|
showMore: ReactNode;
|
package/dist/Menu.types.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
return
|
|
5
|
-
}({});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return
|
|
17
|
-
}({});
|
|
18
|
-
export
|
|
19
|
-
ItemSize
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
1
|
+
var VisibilityTrigger = /* @__PURE__ */ ((VisibilityTrigger2) => {
|
|
2
|
+
VisibilityTrigger2["DEFAULT"] = "default";
|
|
3
|
+
VisibilityTrigger2["HOVER"] = "hover";
|
|
4
|
+
return VisibilityTrigger2;
|
|
5
|
+
})(VisibilityTrigger || {});
|
|
6
|
+
var ItemType = /* @__PURE__ */ ((ItemType2) => {
|
|
7
|
+
ItemType2["DEFAULT"] = "default";
|
|
8
|
+
ItemType2["SELECT"] = "select";
|
|
9
|
+
ItemType2["DANGER"] = "danger";
|
|
10
|
+
ItemType2["DIVIDER"] = "divider";
|
|
11
|
+
return ItemType2;
|
|
12
|
+
})(ItemType || {});
|
|
13
|
+
var ItemSize = /* @__PURE__ */ ((ItemSize2) => {
|
|
14
|
+
ItemSize2["DEFAULT"] = "default";
|
|
15
|
+
ItemSize2["LARGE"] = "large";
|
|
16
|
+
return ItemSize2;
|
|
17
|
+
})(ItemSize || {});
|
|
18
|
+
export {
|
|
19
|
+
ItemSize,
|
|
20
|
+
ItemType,
|
|
21
|
+
VisibilityTrigger
|
|
22
|
+
};
|
|
File without changes
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var timer = setTimeout(function () {
|
|
8
|
-
return setTemporaryLabel(false);
|
|
9
|
-
}, duration);
|
|
10
|
-
return function () {
|
|
1
|
+
import { useState, useEffect } from "react";
|
|
2
|
+
const useTemporaryLabel = (duration) => {
|
|
3
|
+
const [temporaryLabel, setTemporaryLabel] = useState(false);
|
|
4
|
+
useEffect(() => {
|
|
5
|
+
const timer = setTimeout(() => setTemporaryLabel(false), duration);
|
|
6
|
+
return () => {
|
|
11
7
|
clearTimeout(timer);
|
|
12
8
|
};
|
|
13
9
|
});
|
|
14
10
|
return {
|
|
15
|
-
temporaryLabel
|
|
16
|
-
setTemporaryLabel
|
|
11
|
+
temporaryLabel,
|
|
12
|
+
setTemporaryLabel
|
|
17
13
|
};
|
|
18
|
-
};
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
useTemporaryLabel
|
|
17
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -1,18 +1,25 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
4
|
-
import * as
|
|
5
|
-
import * as
|
|
6
|
-
import * as
|
|
7
|
-
import * as
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
MenuStyles:
|
|
12
|
-
Breadcrumb:
|
|
13
|
-
Header:
|
|
14
|
-
ItemDanger:
|
|
15
|
-
ItemSelect:
|
|
16
|
-
ItemSubmenuText:
|
|
17
|
-
ItemText:
|
|
18
|
-
};
|
|
1
|
+
import * as Elements_Breadcrumb_Breadcrumb_styles from "./Elements/Breadcrumb/Breadcrumb.styles.js";
|
|
2
|
+
import * as Elements_Header_Header_styles from "./Elements/Header/Header.styles.js";
|
|
3
|
+
import * as Elements_Item_Danger_Danger_styles from "./Elements/Item/Danger/Danger.styles.js";
|
|
4
|
+
import * as Elements_Item_Select_Select_styles from "./Elements/Item/Select/Select.styles.js";
|
|
5
|
+
import * as Elements_Item_SubmenuText_SubmenuText_styles from "./Elements/Item/SubmenuText/SubmenuText.styles.js";
|
|
6
|
+
import * as Elements_Item_Text_Text_styles from "./Elements/Item/Text/Text.styles.js";
|
|
7
|
+
import * as Menu_styles from "./Menu.styles.js";
|
|
8
|
+
import { Menu } from "./Menu.js";
|
|
9
|
+
import { ItemSize, ItemType, VisibilityTrigger } from "./Menu.types.js";
|
|
10
|
+
const MenuStyles = {
|
|
11
|
+
MenuStyles: Menu_styles,
|
|
12
|
+
Breadcrumb: Elements_Breadcrumb_Breadcrumb_styles,
|
|
13
|
+
Header: Elements_Header_Header_styles,
|
|
14
|
+
ItemDanger: Elements_Item_Danger_Danger_styles,
|
|
15
|
+
ItemSelect: Elements_Item_Select_Select_styles,
|
|
16
|
+
ItemSubmenuText: Elements_Item_SubmenuText_SubmenuText_styles,
|
|
17
|
+
ItemText: Elements_Item_Text_Text_styles
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
ItemSize,
|
|
21
|
+
ItemType,
|
|
22
|
+
MenuStyles,
|
|
23
|
+
VisibilityTrigger,
|
|
24
|
+
Menu as default
|
|
25
|
+
};
|
package/dist/modules.d.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "@testing-library/jest-dom";
|
|
File without changes
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MenuItemProps } from '../Menu.types';
|
|
2
2
|
export declare const getCopyConfig: ({ copyable, copyValue, disabled, }: Pick<MenuItemProps, "copyValue" | "copyable" | "disabled">) => {
|
|
3
3
|
delayClickEvent: number | false;
|
|
4
4
|
enabled: boolean | "" | undefined;
|
|
5
5
|
valueToCopy: string | undefined;
|
|
6
|
-
copiedLabel: import(
|
|
6
|
+
copiedLabel: import('react').ReactNode;
|
|
7
7
|
labelTimerReset: number;
|
|
8
8
|
};
|
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
const getCopyConfig = ({
|
|
2
|
+
copyable,
|
|
3
|
+
copyValue,
|
|
4
|
+
disabled
|
|
5
|
+
}) => {
|
|
6
|
+
const DEFAULT_RESET_TIMER = 1e3;
|
|
7
|
+
const DELAY_CLICK_AFTER_COPY_DURATION = 700;
|
|
8
|
+
const enabled = copyable && (copyValue || typeof copyable === "object" && copyable.copyValue) && !disabled;
|
|
9
|
+
const valueToCopy = typeof copyable === "object" ? copyable.copyValue : copyValue;
|
|
10
|
+
const copiedLabel = typeof copyable === "object" ? copyable.copiedLabel : null;
|
|
11
|
+
const labelTimerReset = typeof copyable === "object" && copyable.timeToReset || DEFAULT_RESET_TIMER;
|
|
12
|
+
const delayClickEvent = typeof copyable === "object" && copyable.delayClickEvent !== void 0 ? copyable.delayClickEvent : copyable ? DELAY_CLICK_AFTER_COPY_DURATION : false;
|
|
12
13
|
return {
|
|
13
|
-
delayClickEvent
|
|
14
|
-
enabled
|
|
15
|
-
valueToCopy
|
|
16
|
-
copiedLabel
|
|
17
|
-
labelTimerReset
|
|
14
|
+
delayClickEvent,
|
|
15
|
+
enabled,
|
|
16
|
+
valueToCopy,
|
|
17
|
+
copiedLabel,
|
|
18
|
+
labelTimerReset
|
|
18
19
|
};
|
|
19
|
-
};
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
getCopyConfig
|
|
23
|
+
};
|