venice-ui 1.0.36 → 1.0.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/DropdownMenu/DropdownMenu.js +70 -0
- package/dist/cjs/components/DropdownMenu/DropdownMenu.styles.js +38 -0
- package/dist/cjs/components/{More → DropdownMenu}/index.js +1 -1
- package/dist/cjs/components/ElementHeader/ElementHeader.js +2 -2
- package/dist/cjs/components/Icons/IconsPath.js +4 -1
- package/dist/cjs/components/Icons/IconsShows.js +18 -0
- package/dist/cjs/components/Icons/index.js +3 -1
- package/dist/cjs/example/ExampleComponent.js +9 -1
- package/dist/cjs/index.js +2 -3
- package/dist/esm/components/DropdownMenu/DropdownMenu.js +43 -0
- package/dist/esm/components/DropdownMenu/DropdownMenu.styles.js +32 -0
- package/dist/esm/components/DropdownMenu/index.js +1 -0
- package/dist/esm/components/ElementHeader/ElementHeader.js +2 -2
- package/dist/esm/components/Icons/IconsPath.js +4 -1
- package/dist/esm/components/Icons/IconsShows.js +11 -0
- package/dist/esm/components/Icons/index.js +1 -0
- package/dist/esm/example/ExampleComponent.js +8 -0
- package/dist/esm/index.js +2 -3
- package/dist/types/components/DropdownMenu/DropdownMenu.d.ts +17 -0
- package/dist/types/components/DropdownMenu/DropdownMenu.styles.d.ts +9 -0
- package/dist/types/components/DropdownMenu/index.d.ts +1 -0
- package/dist/types/components/Icons/IconsPath.d.ts +3 -0
- package/dist/types/components/Icons/IconsShows.d.ts +2 -0
- package/dist/types/components/Icons/index.d.ts +1 -0
- package/dist/types/example/ExampleComponent.d.ts +1 -0
- package/dist/types/index.d.ts +2 -3
- package/package.json +1 -1
- package/dist/cjs/components/ElementSubMenu/ElementSubMenu.js +0 -50
- package/dist/cjs/components/ElementSubMenu/ElementSubMenu.styles.js +0 -13
- package/dist/cjs/components/ElementSubMenu/index.js +0 -17
- package/dist/cjs/components/More/More.js +0 -15
- package/dist/cjs/components/UserMenu/UserMenu.js +0 -22
- package/dist/cjs/components/UserMenu/UserMenu.styles.js +0 -21
- package/dist/cjs/components/UserMenu/index.js +0 -17
- package/dist/esm/components/ElementSubMenu/ElementSubMenu.js +0 -23
- package/dist/esm/components/ElementSubMenu/ElementSubMenu.styles.js +0 -7
- package/dist/esm/components/ElementSubMenu/index.js +0 -1
- package/dist/esm/components/More/More.js +0 -8
- package/dist/esm/components/More/index.js +0 -1
- package/dist/esm/components/UserMenu/UserMenu.js +0 -15
- package/dist/esm/components/UserMenu/UserMenu.styles.js +0 -15
- package/dist/esm/components/UserMenu/index.js +0 -1
- package/dist/types/components/ElementSubMenu/ElementSubMenu.d.ts +0 -11
- package/dist/types/components/ElementSubMenu/ElementSubMenu.styles.d.ts +0 -1
- package/dist/types/components/ElementSubMenu/index.d.ts +0 -1
- package/dist/types/components/More/More.d.ts +0 -9
- package/dist/types/components/More/index.d.ts +0 -1
- package/dist/types/components/UserMenu/UserMenu.d.ts +0 -11
- package/dist/types/components/UserMenu/UserMenu.styles.d.ts +0 -3
- package/dist/types/components/UserMenu/index.d.ts +0 -1
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.DropdownMenu = void 0;
|
|
27
|
+
const common_1 = require("../common");
|
|
28
|
+
const react_1 = __importStar(require("react"));
|
|
29
|
+
const Theme_1 = require("../../Theme");
|
|
30
|
+
const Icons_1 = require("../Icons");
|
|
31
|
+
const DropdownMenu_styles_1 = require("./DropdownMenu.styles");
|
|
32
|
+
const Aligment_1 = require("../Aligment");
|
|
33
|
+
const Typography_1 = require("../Typography");
|
|
34
|
+
const DropdownMenu = ({ size = 'medium', iconName = 'more_vert', color = Theme_1.Theme.colors.primary, iconBackgroundColor = false, header = false, headerTitle, headerSubtitle, footer = false, footerText, footerAction, options, }) => {
|
|
35
|
+
const [open, toogleOpen] = (0, react_1.useState)(false);
|
|
36
|
+
const ref = (0, react_1.useRef)(null);
|
|
37
|
+
const close = () => {
|
|
38
|
+
toogleOpen(false);
|
|
39
|
+
};
|
|
40
|
+
const handleFooterAction = () => {
|
|
41
|
+
footerAction && footerAction();
|
|
42
|
+
close();
|
|
43
|
+
};
|
|
44
|
+
const handleClick = (action) => {
|
|
45
|
+
action();
|
|
46
|
+
close();
|
|
47
|
+
};
|
|
48
|
+
(0, react_1.useEffect)(() => {
|
|
49
|
+
const handleClickOutside = (event) => {
|
|
50
|
+
if (ref.current && !ref.current.contains(event.target)) {
|
|
51
|
+
close();
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
document.addEventListener('click', handleClickOutside, true);
|
|
55
|
+
return () => {
|
|
56
|
+
document.removeEventListener('click', handleClickOutside, true);
|
|
57
|
+
};
|
|
58
|
+
}, [open]);
|
|
59
|
+
return (react_1.default.createElement(DropdownMenu_styles_1.DropdownMenuElement, null,
|
|
60
|
+
react_1.default.createElement(Icons_1.Icon, { name: iconName, onClick: () => toogleOpen(!open), color: color, bgColor: iconBackgroundColor, size: (0, common_1.setIconSize)(size), active: open }),
|
|
61
|
+
open && (react_1.default.createElement(common_1.Panel, { ref: ref, size: size, position: "right" },
|
|
62
|
+
react_1.default.createElement(Aligment_1.Aligment, { hPadding: Theme_1.Theme.padding.m, direction: "column" },
|
|
63
|
+
header && (react_1.default.createElement(DropdownMenu_styles_1.DropdownMenuHeader, null,
|
|
64
|
+
headerTitle && (react_1.default.createElement(Typography_1.TextAccent, { color: Theme_1.Theme.colors.text }, headerTitle)),
|
|
65
|
+
headerSubtitle && (react_1.default.createElement(Typography_1.TextLabel, { color: Theme_1.Theme.colors.text }, headerSubtitle)))),
|
|
66
|
+
react_1.default.createElement(DropdownMenu_styles_1.DropdownMenuContent, null, options &&
|
|
67
|
+
options.map((option) => (react_1.default.createElement(DropdownMenu_styles_1.DropdownMenuOption, { key: option.label, onClick: () => handleClick(option.action) }, option.label)))),
|
|
68
|
+
footer && (react_1.default.createElement(DropdownMenu_styles_1.DropdownMenuFooter, null, footerText && (react_1.default.createElement(Typography_1.Text, { action: true, onClick: handleFooterAction }, footerText)))))))));
|
|
69
|
+
};
|
|
70
|
+
exports.DropdownMenu = DropdownMenu;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.DropdownMenuOption = exports.DropdownMenuContent = exports.DropdownMenuFooter = exports.DropdownMenuHeader = exports.DropdownMenuElement = void 0;
|
|
7
|
+
const polished_1 = require("polished");
|
|
8
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
+
const Theme_1 = require("../../Theme");
|
|
10
|
+
exports.DropdownMenuElement = styled_components_1.default.div `
|
|
11
|
+
position:relative;
|
|
12
|
+
width:auto;
|
|
13
|
+
display: flex;
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
`;
|
|
16
|
+
exports.DropdownMenuHeader = styled_components_1.default.div `
|
|
17
|
+
border-bottom: 1px solid ${Theme_1.Theme.colors.gray_2};
|
|
18
|
+
padding-bottom: ${Theme_1.Theme.padding.m};
|
|
19
|
+
width:100%;
|
|
20
|
+
`;
|
|
21
|
+
exports.DropdownMenuFooter = styled_components_1.default.div `
|
|
22
|
+
border-top: 1px solid ${Theme_1.Theme.colors.gray_2};
|
|
23
|
+
padding-top: ${Theme_1.Theme.padding.m};
|
|
24
|
+
width:100%;
|
|
25
|
+
`;
|
|
26
|
+
exports.DropdownMenuContent = styled_components_1.default.div `
|
|
27
|
+
width:100%;
|
|
28
|
+
`;
|
|
29
|
+
exports.DropdownMenuOption = styled_components_1.default.div `
|
|
30
|
+
padding: ${Theme_1.Theme.padding.s} 0;
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
white-space: nowrap;
|
|
33
|
+
color: ${Theme_1.Theme.colors.text};
|
|
34
|
+
|
|
35
|
+
:hover {
|
|
36
|
+
background-color: ${(0, polished_1.lighten)(0.4, Theme_1.Theme.colors.primary)};
|
|
37
|
+
}
|
|
38
|
+
`;
|
|
@@ -14,4 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./DropdownMenu"), exports);
|
|
@@ -10,7 +10,7 @@ const Aligment_1 = require("../Aligment");
|
|
|
10
10
|
const Typography_1 = require("../Typography");
|
|
11
11
|
const Theme_1 = require("../../Theme");
|
|
12
12
|
const Button_1 = require("../Button");
|
|
13
|
-
const
|
|
13
|
+
const DropdownMenu_1 = require("../DropdownMenu");
|
|
14
14
|
const ElementHeader = ({ title, showTitle = true, moreIcon = false, backIcon = false, closeIcon = true, actionButton = false, actionLabel = '', handleClose, handleClick, handleBack, children, bgColor = Theme_1.Theme.colors.white, options, }) => {
|
|
15
15
|
const leftSide = () => {
|
|
16
16
|
if (showTitle) {
|
|
@@ -29,7 +29,7 @@ const ElementHeader = ({ title, showTitle = true, moreIcon = false, backIcon = f
|
|
|
29
29
|
else if (!closeIcon && actionButton && handleClick) {
|
|
30
30
|
return (react_1.default.createElement(Aligment_1.Aligment, { align: "flex-end", width: "auto" },
|
|
31
31
|
react_1.default.createElement(Button_1.Button, { mode: "inverse", text: actionLabel, onClick: () => handleClick() }),
|
|
32
|
-
moreIcon && options && react_1.default.createElement(
|
|
32
|
+
moreIcon && options && react_1.default.createElement(DropdownMenu_1.DropdownMenu, { options: options })));
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
35
|
return (react_1.default.createElement(Aligment_1.Aligment, { justify: !showTitle && !children ? 'flex-end' : 'space-between', vPadding: Theme_1.Theme.padding.m, hPadding: Theme_1.Theme.padding.l, backgroundColor: bgColor },
|
|
@@ -22,5 +22,8 @@ exports.iconsPath = {
|
|
|
22
22
|
download: "M6 20q-.825 0-1.412-.587Q4 18.825 4 18v-3h2v3h12v-3h2v3q0 .825-.587 1.413Q18.825 20 18 20Zm6-4-5-5 1.4-1.45 2.6 2.6V4h2v8.15l2.6-2.6L17 11Z",
|
|
23
23
|
delete: "M7 21q-.825 0-1.412-.587Q5 19.825 5 19V6H4V4h5V3h6v1h5v2h-1v13q0 .825-.587 1.413Q17.825 21 17 21ZM17 6H7v13h10ZM9 17h2V8H9Zm4 0h2V8h-2ZM7 6v13Z",
|
|
24
24
|
close: "M6.4 19 5 17.6l5.6-5.6L5 6.4 6.4 5l5.6 5.6L17.6 5 19 6.4 13.4 12l5.6 5.6-1.4 1.4-5.6-5.6Z",
|
|
25
|
-
person: "M12 12q-1.65 0-2.825-1.175Q8 9.65 8 8q0-1.65 1.175-2.825Q10.35 4 12 4q1.65 0 2.825 1.175Q16 6.35 16 8q0 1.65-1.175 2.825Q13.65 12 12 12Zm-8 8v-2.8q0-.85.438-1.563.437-.712 1.162-1.087 1.55-.775 3.15-1.163Q10.35 13 12 13t3.25.387q1.6.388 3.15 1.163.725.375 1.162 1.087Q20 16.35 20 17.2V20Zm2-2h12v-.8q0-.275-.137-.5-.138-.225-.363-.35-1.35-.675-2.725-1.013Q13.4 15 12 15t-2.775.337Q7.85 15.675 6.5 16.35q-.225.125-.362.35-.138.225-.138.5Zm6-8q.825 0 1.413-.588Q14 8.825 14 8t-.587-1.412Q12.825 6 12 6q-.825 0-1.412.588Q10 7.175 10 8t.588 1.412Q11.175 10 12 10Zm0-2Zm0 10Z"
|
|
25
|
+
person: "M12 12q-1.65 0-2.825-1.175Q8 9.65 8 8q0-1.65 1.175-2.825Q10.35 4 12 4q1.65 0 2.825 1.175Q16 6.35 16 8q0 1.65-1.175 2.825Q13.65 12 12 12Zm-8 8v-2.8q0-.85.438-1.563.437-.712 1.162-1.087 1.55-.775 3.15-1.163Q10.35 13 12 13t3.25.387q1.6.388 3.15 1.163.725.375 1.162 1.087Q20 16.35 20 17.2V20Zm2-2h12v-.8q0-.275-.137-.5-.138-.225-.363-.35-1.35-.675-2.725-1.013Q13.4 15 12 15t-2.775.337Q7.85 15.675 6.5 16.35q-.225.125-.362.35-.138.225-.138.5Zm6-8q.825 0 1.413-.588Q14 8.825 14 8t-.587-1.412Q12.825 6 12 6q-.825 0-1.412.588Q10 7.175 10 8t.588 1.412Q11.175 10 12 10Zm0-2Zm0 10Z",
|
|
26
|
+
check_circle: "m10.6 16.6 7.05-7.05-1.4-1.4-5.65 5.65-2.85-2.85-1.4 1.4ZM12 22q-2.075 0-3.9-.788-1.825-.787-3.175-2.137-1.35-1.35-2.137-3.175Q2 14.075 2 12t.788-3.9q.787-1.825 2.137-3.175 1.35-1.35 3.175-2.138Q9.925 2 12 2t3.9.787q1.825.788 3.175 2.138 1.35 1.35 2.137 3.175Q22 9.925 22 12t-.788 3.9q-.787 1.825-2.137 3.175-1.35 1.35-3.175 2.137Q14.075 22 12 22Zm0-2q3.35 0 5.675-2.325Q20 15.35 20 12q0-3.35-2.325-5.675Q15.35 4 12 4 8.65 4 6.325 6.325 4 8.65 4 12q0 3.35 2.325 5.675Q8.65 20 12 20Zm0-8Z",
|
|
27
|
+
check_box: "m10.6 16.2 7.05-7.05-1.4-1.4-5.65 5.65-2.85-2.85-1.4 1.4ZM5 21q-.825 0-1.413-.587Q3 19.825 3 19V5q0-.825.587-1.413Q4.175 3 5 3h14q.825 0 1.413.587Q21 4.175 21 5v14q0 .825-.587 1.413Q19.825 21 19 21Zm0-2h14V5H5v14ZM5 5v14V5Z",
|
|
28
|
+
check: "m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4Z"
|
|
26
29
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.IconsShows = void 0;
|
|
7
|
+
const Aligment_1 = require("../Aligment");
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const Icon_1 = require("./Icon");
|
|
10
|
+
const IconsPath_1 = require("./IconsPath");
|
|
11
|
+
const example_1 = require("../../example");
|
|
12
|
+
const IconsShows = () => {
|
|
13
|
+
return (react_1.default.createElement(Aligment_1.Aligment, { gap: 5 },
|
|
14
|
+
react_1.default.createElement(react_1.default.Fragment, null, Object.keys(IconsPath_1.iconsPath).map((iconPath) => (react_1.default.createElement(example_1.IconsShowroom, null,
|
|
15
|
+
react_1.default.createElement(Icon_1.Icon, { name: iconPath, size: 48 }),
|
|
16
|
+
iconPath))))));
|
|
17
|
+
};
|
|
18
|
+
exports.IconsShows = IconsShows;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Icon = void 0;
|
|
3
|
+
exports.iconsPath = exports.Icon = void 0;
|
|
4
4
|
var Icon_1 = require("./Icon");
|
|
5
5
|
Object.defineProperty(exports, "Icon", { enumerable: true, get: function () { return Icon_1.Icon; } });
|
|
6
|
+
var IconsPath_1 = require("./IconsPath");
|
|
7
|
+
Object.defineProperty(exports, "iconsPath", { enumerable: true, get: function () { return IconsPath_1.iconsPath; } });
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ExampleItem = exports.ExampleArea = exports.ExampleAreaTitle = exports.ExampleTableHeader = exports.ExampleTableCell = exports.ExampleTableRow = exports.ExampleTable = exports.ExmpleBlockWrapper = exports.ExmpleBlock = exports.StoryWrapper = void 0;
|
|
6
|
+
exports.IconsShowroom = exports.ExampleItem = exports.ExampleArea = exports.ExampleAreaTitle = exports.ExampleTableHeader = exports.ExampleTableCell = exports.ExampleTableRow = exports.ExampleTable = exports.ExmpleBlockWrapper = exports.ExmpleBlock = exports.StoryWrapper = void 0;
|
|
7
7
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
8
8
|
const Theme_1 = require("../Theme/Theme");
|
|
9
9
|
exports.StoryWrapper = styled_components_1.default.div `
|
|
@@ -53,3 +53,11 @@ exports.ExampleItem = styled_components_1.default.div `
|
|
|
53
53
|
display:flex;
|
|
54
54
|
max-width:300px;
|
|
55
55
|
`;
|
|
56
|
+
exports.IconsShowroom = styled_components_1.default.div `
|
|
57
|
+
display: flex;
|
|
58
|
+
flex-direction:column;
|
|
59
|
+
padding:10px;
|
|
60
|
+
border:1px solid #f3f3f3;
|
|
61
|
+
font-size: 12px;
|
|
62
|
+
text-align:center;
|
|
63
|
+
`;
|
package/dist/cjs/index.js
CHANGED
|
@@ -18,17 +18,16 @@ __exportStar(require("./components/Aligment"), exports);
|
|
|
18
18
|
__exportStar(require("./components/Button"), exports);
|
|
19
19
|
__exportStar(require("./components/Card"), exports);
|
|
20
20
|
__exportStar(require("./components/Dropdown"), exports);
|
|
21
|
+
__exportStar(require("./components/DropdownMenu"), exports);
|
|
21
22
|
__exportStar(require("./components/ElementHeader"), exports);
|
|
22
|
-
__exportStar(require("./components/
|
|
23
|
+
__exportStar(require("./components/DropdownMenu"), exports);
|
|
23
24
|
__exportStar(require("./components/File"), exports);
|
|
24
25
|
__exportStar(require("./components/Icons"), exports);
|
|
25
26
|
__exportStar(require("./components/Input"), exports);
|
|
26
27
|
__exportStar(require("./components/Loader"), exports);
|
|
27
28
|
__exportStar(require("./components/Modal"), exports);
|
|
28
|
-
__exportStar(require("./components/More"), exports);
|
|
29
29
|
__exportStar(require("./components/Section"), exports);
|
|
30
30
|
__exportStar(require("./components/Selector"), exports);
|
|
31
31
|
__exportStar(require("./components/Sidepanel"), exports);
|
|
32
|
-
__exportStar(require("./components/UserMenu"), exports);
|
|
33
32
|
__exportStar(require("./components/Tile"), exports);
|
|
34
33
|
__exportStar(require("./components/Typography"), exports);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Panel, setIconSize } from '../common';
|
|
2
|
+
import React, { useState, useRef, useEffect } from 'react';
|
|
3
|
+
import { Theme } from '../../Theme';
|
|
4
|
+
import { Icon } from '../Icons';
|
|
5
|
+
import { DropdownMenuOption, DropdownMenuElement, DropdownMenuContent, DropdownMenuFooter, DropdownMenuHeader, } from './DropdownMenu.styles';
|
|
6
|
+
import { Aligment } from '../Aligment';
|
|
7
|
+
import { TextAccent, TextLabel, Text } from '../Typography';
|
|
8
|
+
export const DropdownMenu = ({ size = 'medium', iconName = 'more_vert', color = Theme.colors.primary, iconBackgroundColor = false, header = false, headerTitle, headerSubtitle, footer = false, footerText, footerAction, options, }) => {
|
|
9
|
+
const [open, toogleOpen] = useState(false);
|
|
10
|
+
const ref = useRef(null);
|
|
11
|
+
const close = () => {
|
|
12
|
+
toogleOpen(false);
|
|
13
|
+
};
|
|
14
|
+
const handleFooterAction = () => {
|
|
15
|
+
footerAction && footerAction();
|
|
16
|
+
close();
|
|
17
|
+
};
|
|
18
|
+
const handleClick = (action) => {
|
|
19
|
+
action();
|
|
20
|
+
close();
|
|
21
|
+
};
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
const handleClickOutside = (event) => {
|
|
24
|
+
if (ref.current && !ref.current.contains(event.target)) {
|
|
25
|
+
close();
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
document.addEventListener('click', handleClickOutside, true);
|
|
29
|
+
return () => {
|
|
30
|
+
document.removeEventListener('click', handleClickOutside, true);
|
|
31
|
+
};
|
|
32
|
+
}, [open]);
|
|
33
|
+
return (React.createElement(DropdownMenuElement, null,
|
|
34
|
+
React.createElement(Icon, { name: iconName, onClick: () => toogleOpen(!open), color: color, bgColor: iconBackgroundColor, size: setIconSize(size), active: open }),
|
|
35
|
+
open && (React.createElement(Panel, { ref: ref, size: size, position: "right" },
|
|
36
|
+
React.createElement(Aligment, { hPadding: Theme.padding.m, direction: "column" },
|
|
37
|
+
header && (React.createElement(DropdownMenuHeader, null,
|
|
38
|
+
headerTitle && (React.createElement(TextAccent, { color: Theme.colors.text }, headerTitle)),
|
|
39
|
+
headerSubtitle && (React.createElement(TextLabel, { color: Theme.colors.text }, headerSubtitle)))),
|
|
40
|
+
React.createElement(DropdownMenuContent, null, options &&
|
|
41
|
+
options.map((option) => (React.createElement(DropdownMenuOption, { key: option.label, onClick: () => handleClick(option.action) }, option.label)))),
|
|
42
|
+
footer && (React.createElement(DropdownMenuFooter, null, footerText && (React.createElement(Text, { action: true, onClick: handleFooterAction }, footerText)))))))));
|
|
43
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { lighten } from "polished";
|
|
2
|
+
import styled from "styled-components";
|
|
3
|
+
import { Theme } from "../../Theme";
|
|
4
|
+
export const DropdownMenuElement = styled.div `
|
|
5
|
+
position:relative;
|
|
6
|
+
width:auto;
|
|
7
|
+
display: flex;
|
|
8
|
+
box-sizing: border-box;
|
|
9
|
+
`;
|
|
10
|
+
export const DropdownMenuHeader = styled.div `
|
|
11
|
+
border-bottom: 1px solid ${Theme.colors.gray_2};
|
|
12
|
+
padding-bottom: ${Theme.padding.m};
|
|
13
|
+
width:100%;
|
|
14
|
+
`;
|
|
15
|
+
export const DropdownMenuFooter = styled.div `
|
|
16
|
+
border-top: 1px solid ${Theme.colors.gray_2};
|
|
17
|
+
padding-top: ${Theme.padding.m};
|
|
18
|
+
width:100%;
|
|
19
|
+
`;
|
|
20
|
+
export const DropdownMenuContent = styled.div `
|
|
21
|
+
width:100%;
|
|
22
|
+
`;
|
|
23
|
+
export const DropdownMenuOption = styled.div `
|
|
24
|
+
padding: ${Theme.padding.s} 0;
|
|
25
|
+
cursor: pointer;
|
|
26
|
+
white-space: nowrap;
|
|
27
|
+
color: ${Theme.colors.text};
|
|
28
|
+
|
|
29
|
+
:hover {
|
|
30
|
+
background-color: ${lighten(0.4, Theme.colors.primary)};
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './DropdownMenu';
|
|
@@ -4,7 +4,7 @@ import { Aligment } from '../Aligment';
|
|
|
4
4
|
import { TextHeader } from '../Typography';
|
|
5
5
|
import { Theme } from '../../Theme';
|
|
6
6
|
import { Button } from '../Button';
|
|
7
|
-
import {
|
|
7
|
+
import { DropdownMenu } from '../DropdownMenu';
|
|
8
8
|
export const ElementHeader = ({ title, showTitle = true, moreIcon = false, backIcon = false, closeIcon = true, actionButton = false, actionLabel = '', handleClose, handleClick, handleBack, children, bgColor = Theme.colors.white, options, }) => {
|
|
9
9
|
const leftSide = () => {
|
|
10
10
|
if (showTitle) {
|
|
@@ -23,7 +23,7 @@ export const ElementHeader = ({ title, showTitle = true, moreIcon = false, backI
|
|
|
23
23
|
else if (!closeIcon && actionButton && handleClick) {
|
|
24
24
|
return (React.createElement(Aligment, { align: "flex-end", width: "auto" },
|
|
25
25
|
React.createElement(Button, { mode: "inverse", text: actionLabel, onClick: () => handleClick() }),
|
|
26
|
-
moreIcon && options && React.createElement(
|
|
26
|
+
moreIcon && options && React.createElement(DropdownMenu, { options: options })));
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
return (React.createElement(Aligment, { justify: !showTitle && !children ? 'flex-end' : 'space-between', vPadding: Theme.padding.m, hPadding: Theme.padding.l, backgroundColor: bgColor },
|
|
@@ -19,5 +19,8 @@ export const iconsPath = {
|
|
|
19
19
|
download: "M6 20q-.825 0-1.412-.587Q4 18.825 4 18v-3h2v3h12v-3h2v3q0 .825-.587 1.413Q18.825 20 18 20Zm6-4-5-5 1.4-1.45 2.6 2.6V4h2v8.15l2.6-2.6L17 11Z",
|
|
20
20
|
delete: "M7 21q-.825 0-1.412-.587Q5 19.825 5 19V6H4V4h5V3h6v1h5v2h-1v13q0 .825-.587 1.413Q17.825 21 17 21ZM17 6H7v13h10ZM9 17h2V8H9Zm4 0h2V8h-2ZM7 6v13Z",
|
|
21
21
|
close: "M6.4 19 5 17.6l5.6-5.6L5 6.4 6.4 5l5.6 5.6L17.6 5 19 6.4 13.4 12l5.6 5.6-1.4 1.4-5.6-5.6Z",
|
|
22
|
-
person: "M12 12q-1.65 0-2.825-1.175Q8 9.65 8 8q0-1.65 1.175-2.825Q10.35 4 12 4q1.65 0 2.825 1.175Q16 6.35 16 8q0 1.65-1.175 2.825Q13.65 12 12 12Zm-8 8v-2.8q0-.85.438-1.563.437-.712 1.162-1.087 1.55-.775 3.15-1.163Q10.35 13 12 13t3.25.387q1.6.388 3.15 1.163.725.375 1.162 1.087Q20 16.35 20 17.2V20Zm2-2h12v-.8q0-.275-.137-.5-.138-.225-.363-.35-1.35-.675-2.725-1.013Q13.4 15 12 15t-2.775.337Q7.85 15.675 6.5 16.35q-.225.125-.362.35-.138.225-.138.5Zm6-8q.825 0 1.413-.588Q14 8.825 14 8t-.587-1.412Q12.825 6 12 6q-.825 0-1.412.588Q10 7.175 10 8t.588 1.412Q11.175 10 12 10Zm0-2Zm0 10Z"
|
|
22
|
+
person: "M12 12q-1.65 0-2.825-1.175Q8 9.65 8 8q0-1.65 1.175-2.825Q10.35 4 12 4q1.65 0 2.825 1.175Q16 6.35 16 8q0 1.65-1.175 2.825Q13.65 12 12 12Zm-8 8v-2.8q0-.85.438-1.563.437-.712 1.162-1.087 1.55-.775 3.15-1.163Q10.35 13 12 13t3.25.387q1.6.388 3.15 1.163.725.375 1.162 1.087Q20 16.35 20 17.2V20Zm2-2h12v-.8q0-.275-.137-.5-.138-.225-.363-.35-1.35-.675-2.725-1.013Q13.4 15 12 15t-2.775.337Q7.85 15.675 6.5 16.35q-.225.125-.362.35-.138.225-.138.5Zm6-8q.825 0 1.413-.588Q14 8.825 14 8t-.587-1.412Q12.825 6 12 6q-.825 0-1.412.588Q10 7.175 10 8t.588 1.412Q11.175 10 12 10Zm0-2Zm0 10Z",
|
|
23
|
+
check_circle: "m10.6 16.6 7.05-7.05-1.4-1.4-5.65 5.65-2.85-2.85-1.4 1.4ZM12 22q-2.075 0-3.9-.788-1.825-.787-3.175-2.137-1.35-1.35-2.137-3.175Q2 14.075 2 12t.788-3.9q.787-1.825 2.137-3.175 1.35-1.35 3.175-2.138Q9.925 2 12 2t3.9.787q1.825.788 3.175 2.138 1.35 1.35 2.137 3.175Q22 9.925 22 12t-.788 3.9q-.787 1.825-2.137 3.175-1.35 1.35-3.175 2.137Q14.075 22 12 22Zm0-2q3.35 0 5.675-2.325Q20 15.35 20 12q0-3.35-2.325-5.675Q15.35 4 12 4 8.65 4 6.325 6.325 4 8.65 4 12q0 3.35 2.325 5.675Q8.65 20 12 20Zm0-8Z",
|
|
24
|
+
check_box: "m10.6 16.2 7.05-7.05-1.4-1.4-5.65 5.65-2.85-2.85-1.4 1.4ZM5 21q-.825 0-1.413-.587Q3 19.825 3 19V5q0-.825.587-1.413Q4.175 3 5 3h14q.825 0 1.413.587Q21 4.175 21 5v14q0 .825-.587 1.413Q19.825 21 19 21Zm0-2h14V5H5v14ZM5 5v14V5Z",
|
|
25
|
+
check: "m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4Z"
|
|
23
26
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Aligment } from '../Aligment';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Icon } from './Icon';
|
|
4
|
+
import { iconsPath } from './IconsPath';
|
|
5
|
+
import { IconsShowroom } from '../../example';
|
|
6
|
+
export const IconsShows = () => {
|
|
7
|
+
return (React.createElement(Aligment, { gap: 5 },
|
|
8
|
+
React.createElement(React.Fragment, null, Object.keys(iconsPath).map((iconPath) => (React.createElement(IconsShowroom, null,
|
|
9
|
+
React.createElement(Icon, { name: iconPath, size: 48 }),
|
|
10
|
+
iconPath))))));
|
|
11
|
+
};
|
|
@@ -47,3 +47,11 @@ export const ExampleItem = styled.div `
|
|
|
47
47
|
display:flex;
|
|
48
48
|
max-width:300px;
|
|
49
49
|
`;
|
|
50
|
+
export const IconsShowroom = styled.div `
|
|
51
|
+
display: flex;
|
|
52
|
+
flex-direction:column;
|
|
53
|
+
padding:10px;
|
|
54
|
+
border:1px solid #f3f3f3;
|
|
55
|
+
font-size: 12px;
|
|
56
|
+
text-align:center;
|
|
57
|
+
`;
|
package/dist/esm/index.js
CHANGED
|
@@ -2,17 +2,16 @@ export * from './components/Aligment';
|
|
|
2
2
|
export * from './components/Button';
|
|
3
3
|
export * from './components/Card';
|
|
4
4
|
export * from './components/Dropdown';
|
|
5
|
+
export * from './components/DropdownMenu';
|
|
5
6
|
export * from './components/ElementHeader';
|
|
6
|
-
export * from './components/
|
|
7
|
+
export * from './components/DropdownMenu';
|
|
7
8
|
export * from './components/File';
|
|
8
9
|
export * from './components/Icons';
|
|
9
10
|
export * from "./components/Input";
|
|
10
11
|
export * from './components/Loader';
|
|
11
12
|
export * from './components/Modal';
|
|
12
|
-
export * from './components/More';
|
|
13
13
|
export * from './components/Section';
|
|
14
14
|
export * from './components/Selector';
|
|
15
15
|
export * from './components/Sidepanel';
|
|
16
|
-
export * from './components/UserMenu';
|
|
17
16
|
export * from './components/Tile';
|
|
18
17
|
export * from './components/Typography';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { InputSize, IAction } from '../../types';
|
|
3
|
+
interface IDropdownMenuProps {
|
|
4
|
+
size?: InputSize;
|
|
5
|
+
iconName?: string;
|
|
6
|
+
color?: string;
|
|
7
|
+
iconBackgroundColor?: boolean;
|
|
8
|
+
header?: boolean;
|
|
9
|
+
headerTitle?: string;
|
|
10
|
+
headerSubtitle?: string;
|
|
11
|
+
footer?: boolean;
|
|
12
|
+
footerText?: string;
|
|
13
|
+
footerAction?: () => void;
|
|
14
|
+
options: IAction[];
|
|
15
|
+
}
|
|
16
|
+
export declare const DropdownMenu: FC<IDropdownMenuProps>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const DropdownMenuElement: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
2
|
+
export declare const DropdownMenuHeader: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
|
+
export declare const DropdownMenuFooter: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
|
+
export declare const DropdownMenuContent: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
5
|
+
interface IPanelOptionStyle {
|
|
6
|
+
onClick?: any;
|
|
7
|
+
}
|
|
8
|
+
export declare const DropdownMenuOption: import("styled-components").StyledComponent<"div", any, IPanelOptionStyle, never>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './DropdownMenu';
|
|
@@ -16,4 +16,5 @@ export declare const ExampleTableHeader: import("styled-components").StyledCompo
|
|
|
16
16
|
export declare const ExampleAreaTitle: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
17
17
|
export declare const ExampleArea: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
18
18
|
export declare const ExampleItem: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
19
|
+
export declare const IconsShowroom: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
19
20
|
export {};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -2,17 +2,16 @@ export * from './components/Aligment';
|
|
|
2
2
|
export * from './components/Button';
|
|
3
3
|
export * from './components/Card';
|
|
4
4
|
export * from './components/Dropdown';
|
|
5
|
+
export * from './components/DropdownMenu';
|
|
5
6
|
export * from './components/ElementHeader';
|
|
6
|
-
export * from './components/
|
|
7
|
+
export * from './components/DropdownMenu';
|
|
7
8
|
export * from './components/File';
|
|
8
9
|
export * from './components/Icons';
|
|
9
10
|
export * from "./components/Input";
|
|
10
11
|
export * from './components/Loader';
|
|
11
12
|
export * from './components/Modal';
|
|
12
|
-
export * from './components/More';
|
|
13
13
|
export * from './components/Section';
|
|
14
14
|
export * from './components/Selector';
|
|
15
15
|
export * from './components/Sidepanel';
|
|
16
|
-
export * from './components/UserMenu';
|
|
17
16
|
export * from './components/Tile';
|
|
18
17
|
export * from './components/Typography';
|
package/package.json
CHANGED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.ElementSubMenu = void 0;
|
|
27
|
-
const common_1 = require("../common");
|
|
28
|
-
const react_1 = __importStar(require("react"));
|
|
29
|
-
const Theme_1 = require("../../Theme");
|
|
30
|
-
const Icons_1 = require("../Icons");
|
|
31
|
-
const ElementSubMenu_styles_1 = require("./ElementSubMenu.styles");
|
|
32
|
-
const ElementSubMenu = ({ size = 'medium', iconName = 'more_vert', color = Theme_1.Theme.colors.primary, bgColor = false, children }) => {
|
|
33
|
-
const [open, toogleOpen] = (0, react_1.useState)(false);
|
|
34
|
-
const ref = (0, react_1.useRef)(null);
|
|
35
|
-
(0, react_1.useEffect)(() => {
|
|
36
|
-
const handleClickOutside = (event) => {
|
|
37
|
-
if (ref.current && !ref.current.contains(event.target)) {
|
|
38
|
-
toogleOpen(false);
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
document.addEventListener('click', handleClickOutside, true);
|
|
42
|
-
return () => {
|
|
43
|
-
document.removeEventListener('click', handleClickOutside, true);
|
|
44
|
-
};
|
|
45
|
-
}, [open]);
|
|
46
|
-
return (react_1.default.createElement(ElementSubMenu_styles_1.SubMenuElement, null,
|
|
47
|
-
react_1.default.createElement(Icons_1.Icon, { name: iconName, onClick: () => toogleOpen(!open), color: color, bgColor: bgColor, size: (0, common_1.setIconSize)(size), active: open }),
|
|
48
|
-
open && (react_1.default.createElement(common_1.Panel, { ref: ref, size: size, position: "right" }, children))));
|
|
49
|
-
};
|
|
50
|
-
exports.ElementSubMenu = ElementSubMenu;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.SubMenuElement = void 0;
|
|
7
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
|
8
|
-
exports.SubMenuElement = styled_components_1.default.div `
|
|
9
|
-
position:relative;
|
|
10
|
-
width:auto;
|
|
11
|
-
display: flex;
|
|
12
|
-
box-sizing: border-box;
|
|
13
|
-
`;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./ElementSubMenu"), exports);
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.More = void 0;
|
|
7
|
-
const common_1 = require("../common");
|
|
8
|
-
const react_1 = __importDefault(require("react"));
|
|
9
|
-
const ElementSubMenu_1 = require("../ElementSubMenu");
|
|
10
|
-
const More = ({ options, size = 'medium', iconName = 'more_vert', }) => {
|
|
11
|
-
return (react_1.default.createElement(ElementSubMenu_1.ElementSubMenu, { size: size, iconName: iconName },
|
|
12
|
-
react_1.default.createElement(react_1.default.Fragment, null, options &&
|
|
13
|
-
options.map((option) => (react_1.default.createElement(common_1.PanelOption, { key: option.label, onClick: option.action, active: true }, option.label))))));
|
|
14
|
-
};
|
|
15
|
-
exports.More = More;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.UserMenu = void 0;
|
|
7
|
-
const Aligment_1 = require("../Aligment");
|
|
8
|
-
const react_1 = __importDefault(require("react"));
|
|
9
|
-
const Theme_1 = require("../../Theme");
|
|
10
|
-
const ElementSubMenu_1 = require("../ElementSubMenu");
|
|
11
|
-
const UserMenu_styles_1 = require("./UserMenu.styles");
|
|
12
|
-
const Typography_1 = require("../Typography");
|
|
13
|
-
const UserMenu = ({ color = Theme_1.Theme.colors.white, bgColor = true, userName, logoutAction, logoutLabel = "Logout", children }) => {
|
|
14
|
-
return (react_1.default.createElement(ElementSubMenu_1.ElementSubMenu, { size: "small", iconName: "person", color: color, bgColor: bgColor },
|
|
15
|
-
react_1.default.createElement(Aligment_1.Aligment, { hPadding: Theme_1.Theme.padding.m, direction: "column" },
|
|
16
|
-
react_1.default.createElement(UserMenu_styles_1.UserMenuHeader, null,
|
|
17
|
-
react_1.default.createElement(Typography_1.TextAccent, null, userName)),
|
|
18
|
-
react_1.default.createElement(UserMenu_styles_1.UserMenuContent, null, children),
|
|
19
|
-
react_1.default.createElement(UserMenu_styles_1.UserMenuFooter, null,
|
|
20
|
-
react_1.default.createElement(Typography_1.Text, { color: Theme_1.Theme.colors.red, action: true, onClick: logoutAction }, logoutLabel)))));
|
|
21
|
-
};
|
|
22
|
-
exports.UserMenu = UserMenu;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.UserMenuFooter = exports.UserMenuContent = exports.UserMenuHeader = void 0;
|
|
7
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
|
8
|
-
const Theme_1 = require("../../Theme");
|
|
9
|
-
exports.UserMenuHeader = styled_components_1.default.div `
|
|
10
|
-
border-bottom: 1px solid ${Theme_1.Theme.colors.gray_2};
|
|
11
|
-
padding-bottom: ${Theme_1.Theme.padding.s};
|
|
12
|
-
width:100%;
|
|
13
|
-
`;
|
|
14
|
-
exports.UserMenuContent = styled_components_1.default.div `
|
|
15
|
-
padding: ${Theme_1.Theme.padding.s} 0;
|
|
16
|
-
width:100%;
|
|
17
|
-
`;
|
|
18
|
-
exports.UserMenuFooter = styled_components_1.default.div `
|
|
19
|
-
padding-top: ${Theme_1.Theme.padding.s};
|
|
20
|
-
width:100%;
|
|
21
|
-
`;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./UserMenu"), exports);
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Panel, setIconSize } from '../common';
|
|
2
|
-
import React, { useState, useRef, useEffect } from 'react';
|
|
3
|
-
import { Theme } from '../../Theme';
|
|
4
|
-
import { Icon } from '../Icons';
|
|
5
|
-
import { SubMenuElement } from './ElementSubMenu.styles';
|
|
6
|
-
export const ElementSubMenu = ({ size = 'medium', iconName = 'more_vert', color = Theme.colors.primary, bgColor = false, children }) => {
|
|
7
|
-
const [open, toogleOpen] = useState(false);
|
|
8
|
-
const ref = useRef(null);
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
const handleClickOutside = (event) => {
|
|
11
|
-
if (ref.current && !ref.current.contains(event.target)) {
|
|
12
|
-
toogleOpen(false);
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
document.addEventListener('click', handleClickOutside, true);
|
|
16
|
-
return () => {
|
|
17
|
-
document.removeEventListener('click', handleClickOutside, true);
|
|
18
|
-
};
|
|
19
|
-
}, [open]);
|
|
20
|
-
return (React.createElement(SubMenuElement, null,
|
|
21
|
-
React.createElement(Icon, { name: iconName, onClick: () => toogleOpen(!open), color: color, bgColor: bgColor, size: setIconSize(size), active: open }),
|
|
22
|
-
open && (React.createElement(Panel, { ref: ref, size: size, position: "right" }, children))));
|
|
23
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './ElementSubMenu';
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { PanelOption } from '../common';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { ElementSubMenu } from '../ElementSubMenu';
|
|
4
|
-
export const More = ({ options, size = 'medium', iconName = 'more_vert', }) => {
|
|
5
|
-
return (React.createElement(ElementSubMenu, { size: size, iconName: iconName },
|
|
6
|
-
React.createElement(React.Fragment, null, options &&
|
|
7
|
-
options.map((option) => (React.createElement(PanelOption, { key: option.label, onClick: option.action, active: true }, option.label))))));
|
|
8
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './More';
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Aligment } from '../Aligment';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { Theme } from '../../Theme';
|
|
4
|
-
import { ElementSubMenu } from '../ElementSubMenu';
|
|
5
|
-
import { UserMenuHeader, UserMenuFooter, UserMenuContent } from './UserMenu.styles';
|
|
6
|
-
import { TextAccent, Text } from '../Typography';
|
|
7
|
-
export const UserMenu = ({ color = Theme.colors.white, bgColor = true, userName, logoutAction, logoutLabel = "Logout", children }) => {
|
|
8
|
-
return (React.createElement(ElementSubMenu, { size: "small", iconName: "person", color: color, bgColor: bgColor },
|
|
9
|
-
React.createElement(Aligment, { hPadding: Theme.padding.m, direction: "column" },
|
|
10
|
-
React.createElement(UserMenuHeader, null,
|
|
11
|
-
React.createElement(TextAccent, null, userName)),
|
|
12
|
-
React.createElement(UserMenuContent, null, children),
|
|
13
|
-
React.createElement(UserMenuFooter, null,
|
|
14
|
-
React.createElement(Text, { color: Theme.colors.red, action: true, onClick: logoutAction }, logoutLabel)))));
|
|
15
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import styled from "styled-components";
|
|
2
|
-
import { Theme } from "../../Theme";
|
|
3
|
-
export const UserMenuHeader = styled.div `
|
|
4
|
-
border-bottom: 1px solid ${Theme.colors.gray_2};
|
|
5
|
-
padding-bottom: ${Theme.padding.s};
|
|
6
|
-
width:100%;
|
|
7
|
-
`;
|
|
8
|
-
export const UserMenuContent = styled.div `
|
|
9
|
-
padding: ${Theme.padding.s} 0;
|
|
10
|
-
width:100%;
|
|
11
|
-
`;
|
|
12
|
-
export const UserMenuFooter = styled.div `
|
|
13
|
-
padding-top: ${Theme.padding.s};
|
|
14
|
-
width:100%;
|
|
15
|
-
`;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './UserMenu';
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React, { FC } from 'react';
|
|
2
|
-
import { InputSize } from '../../types';
|
|
3
|
-
interface IElementSubMenuProps {
|
|
4
|
-
children: React.ReactNode;
|
|
5
|
-
size?: InputSize;
|
|
6
|
-
iconName?: string;
|
|
7
|
-
color?: string;
|
|
8
|
-
bgColor?: boolean;
|
|
9
|
-
}
|
|
10
|
-
export declare const ElementSubMenu: FC<IElementSubMenuProps>;
|
|
11
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const SubMenuElement: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './ElementSubMenu';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './More';
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React, { FC } from 'react';
|
|
2
|
-
interface IUserMenuProps {
|
|
3
|
-
color?: string;
|
|
4
|
-
bgColor?: boolean;
|
|
5
|
-
userName: string;
|
|
6
|
-
logoutAction: () => void;
|
|
7
|
-
logoutLabel: string;
|
|
8
|
-
children: React.ReactNode;
|
|
9
|
-
}
|
|
10
|
-
export declare const UserMenu: FC<IUserMenuProps>;
|
|
11
|
-
export {};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export declare const UserMenuHeader: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
2
|
-
export declare const UserMenuContent: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
|
-
export declare const UserMenuFooter: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './UserMenu';
|