@ftdata/ui 0.0.7 → 0.0.9
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/assets/fonts/Inter-Italic.js +2 -0
- package/dist/assets/fonts/Inter.js +2 -0
- package/dist/components/Input/index.d.ts +1 -1
- package/dist/components/Menu/index.d.ts +2 -1
- package/dist/components/Menu/index.js +20 -3
- package/dist/components/Menu/styles.js +2 -2
- package/dist/static/font/Inter-Italic.ttf +0 -0
- package/dist/static/font/Inter.ttf +0 -0
- package/dist/style/base.css +9 -1
- package/package.json +1 -1
- package/dist/assets/fonts/Inter-Regular.js +0 -2
- package/dist/static/font/Inter-Regular.ttf +0 -0
|
@@ -6,7 +6,7 @@ export interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
|
6
6
|
helpText?: string;
|
|
7
7
|
success?: boolean;
|
|
8
8
|
width?: string | number;
|
|
9
|
-
icon
|
|
9
|
+
icon?: IconsNames | JSX.Element;
|
|
10
10
|
textField?: string;
|
|
11
11
|
margin?: string;
|
|
12
12
|
required?: boolean;
|
|
@@ -7,6 +7,7 @@ interface MenuProps {
|
|
|
7
7
|
logo: JSX.Element;
|
|
8
8
|
items: MenuItemData[];
|
|
9
9
|
translate: (key: string) => string;
|
|
10
|
+
active?: string;
|
|
10
11
|
}
|
|
11
|
-
export default function Menu({ background, fontcolor, subMenusBackground, logo, items, translate, }: MenuProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export default function Menu({ background, fontcolor, subMenusBackground, logo, items, translate, active, }: MenuProps): import("react/jsx-runtime").JSX.Element;
|
|
12
13
|
export {};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from "react";
|
|
2
|
+
import { useEffect, useRef, useState } from "react";
|
|
3
3
|
import { ContainerLogo, ItemMenu, ItemsContainer, MenuAside, MenuHeader, SubItemsContainer, SubItemsHeader, SubItemsWrapper, SubMenuItem } from "./styles.js";
|
|
4
4
|
import createMenus from "./helpers/createMenus.js";
|
|
5
5
|
import { Icon } from "@ftdata/f-icons";
|
|
6
|
-
function Menu({ background, fontcolor, subMenusBackground, logo, items, translate }) {
|
|
6
|
+
function Menu({ background, fontcolor, subMenusBackground, logo, items, translate, active }) {
|
|
7
7
|
const [expand, setExpand] = useState(false);
|
|
8
8
|
const [submenus, setSubmenus] = useState([]);
|
|
9
9
|
const [isClosingSubmenu, setIsClosingSubmenu] = useState(false);
|
|
10
|
+
const menuRef = useRef(null);
|
|
10
11
|
const menus = createMenus(items, translate);
|
|
11
12
|
const toggleMenu = ()=>{
|
|
12
13
|
if (expand) return void setTimeout(()=>{
|
|
@@ -32,7 +33,22 @@ function Menu({ background, fontcolor, subMenusBackground, logo, items, translat
|
|
|
32
33
|
setIsClosingSubmenu(false);
|
|
33
34
|
}, 400);
|
|
34
35
|
};
|
|
36
|
+
useEffect(()=>{
|
|
37
|
+
const handleClickOutside = (event)=>{
|
|
38
|
+
if (expand && menuRef.current && !menuRef.current.contains(event.target)) {
|
|
39
|
+
setExpand(false);
|
|
40
|
+
setSubmenus([]);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
if (expand) document.addEventListener("mousedown", handleClickOutside);
|
|
44
|
+
return ()=>{
|
|
45
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
46
|
+
};
|
|
47
|
+
}, [
|
|
48
|
+
expand
|
|
49
|
+
]);
|
|
35
50
|
return /*#__PURE__*/ jsxs(MenuAside, {
|
|
51
|
+
ref: menuRef,
|
|
36
52
|
background: background,
|
|
37
53
|
onClick: expand ? ()=>null : toggleMenu,
|
|
38
54
|
$expand: expand,
|
|
@@ -51,7 +67,7 @@ function Menu({ background, fontcolor, subMenusBackground, logo, items, translat
|
|
|
51
67
|
})
|
|
52
68
|
}),
|
|
53
69
|
/*#__PURE__*/ jsx("span", {
|
|
54
|
-
children: translate("
|
|
70
|
+
children: translate("menu")
|
|
55
71
|
})
|
|
56
72
|
]
|
|
57
73
|
}),
|
|
@@ -66,6 +82,7 @@ function Menu({ background, fontcolor, subMenusBackground, logo, items, translat
|
|
|
66
82
|
fontcolor: fontcolor,
|
|
67
83
|
onClick: (event)=>handleClickItem(event, menu.submenus, menu.callback),
|
|
68
84
|
$expand: expand || void 0,
|
|
85
|
+
$active: menu.label === translate(active || ""),
|
|
69
86
|
children: [
|
|
70
87
|
/*#__PURE__*/ jsx("div", {
|
|
71
88
|
children: menu.icon
|
|
@@ -61,7 +61,7 @@ const MenuAside = styled_components.aside`
|
|
|
61
61
|
flex-direction: column;
|
|
62
62
|
gap: 1.5rem;
|
|
63
63
|
height: 100vh;
|
|
64
|
-
padding:
|
|
64
|
+
padding: 0.5rem;
|
|
65
65
|
position: relative;
|
|
66
66
|
transition: width 0.3s ease-in-out;
|
|
67
67
|
width: ${({ $expand })=>$expand ? "18.75rem" : "3.5rem"};
|
|
@@ -86,7 +86,7 @@ const ContainerLogo = styled_components.div`
|
|
|
86
86
|
align-items: center;
|
|
87
87
|
display: flex;
|
|
88
88
|
justify-content: center;
|
|
89
|
-
max-height:
|
|
89
|
+
max-height: 8rem;
|
|
90
90
|
max-width: 100%;
|
|
91
91
|
}
|
|
92
92
|
`;
|
|
Binary file
|
|
Binary file
|
package/dist/style/base.css
CHANGED
|
@@ -219,7 +219,15 @@ body {
|
|
|
219
219
|
|
|
220
220
|
@font-face {
|
|
221
221
|
font-family: Inter;
|
|
222
|
+
src: url(../static/font/Inter.ttf) format("truetype");
|
|
223
|
+
font-weight: 100 900;
|
|
222
224
|
font-style: normal;
|
|
223
|
-
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
@font-face {
|
|
228
|
+
font-family: Inter;
|
|
229
|
+
src: url(../static/font/Inter-Italic.ttf) format("truetype");
|
|
230
|
+
font-weight: 100 900;
|
|
231
|
+
font-style: italic;
|
|
224
232
|
}
|
|
225
233
|
|
package/package.json
CHANGED
|
Binary file
|