@ftdata/ui 0.0.8 → 0.0.10
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/DoubleList/DoubleList.stories.d.ts +2 -2
- package/dist/components/DoubleList/DoubleList.stories.js +43 -43
- package/dist/components/DoubleList/Row/index.d.ts +4 -0
- package/dist/components/DoubleList/Row/index.js +12 -0
- package/dist/components/DoubleList/Row/style.d.ts +1 -0
- package/dist/components/DoubleList/Row/style.js +31 -0
- package/dist/components/DoubleList/index.js +27 -35
- package/dist/components/DoubleList/style.d.ts +0 -1
- package/dist/components/DoubleList/style.js +2 -31
- package/dist/components/Menu/Menu.stories.d.ts +6 -0
- package/dist/components/Menu/Menu.stories.js +116 -0
- package/dist/components/Menu/index.js +29 -14
- package/dist/components/Menu/styles.d.ts +1 -0
- package/dist/components/Menu/styles.js +44 -28
- package/dist/components/MultiSelect/MultiSelectList/Row/index.d.ts +7 -0
- package/dist/components/MultiSelect/MultiSelectList/Row/index.js +26 -0
- package/dist/components/MultiSelect/MultiSelectList/Row/style.d.ts +6 -0
- package/dist/components/MultiSelect/MultiSelectList/Row/style.js +48 -0
- package/dist/components/MultiSelect/MultiSelectList/index.d.ts +4 -3
- package/dist/components/MultiSelect/MultiSelectList/index.js +51 -41
- package/dist/components/MultiSelect/MultiSelectList/style.d.ts +0 -1
- package/dist/components/MultiSelect/MultiSelectList/style.js +2 -31
- package/dist/components/MultiSelect/helpers/addOption.d.ts +5 -0
- package/dist/components/MultiSelect/helpers/addOption.js +14 -0
- package/dist/components/MultiSelect/helpers/computeUnselected.d.ts +2 -0
- package/dist/components/MultiSelect/helpers/computeUnselected.js +2 -0
- package/dist/components/MultiSelect/helpers/feedbackText.d.ts +5 -0
- package/dist/components/MultiSelect/helpers/feedbackText.js +30 -0
- package/dist/components/MultiSelect/helpers/filterOptions.d.ts +2 -0
- package/dist/components/MultiSelect/helpers/filterOptions.js +5 -0
- package/dist/components/MultiSelect/helpers/removeOptions.d.ts +5 -0
- package/dist/components/MultiSelect/helpers/removeOptions.js +9 -0
- package/dist/components/MultiSelect/index.d.ts +29 -14
- package/dist/components/MultiSelect/index.js +149 -215
- package/dist/components/MultiSelect/styles.d.ts +6 -5
- package/dist/components/MultiSelect/styles.js +20 -66
- package/dist/components/Select/List/Row/index.d.ts +11 -0
- package/dist/components/Select/List/Row/index.js +29 -0
- package/dist/components/{CustomSelect/CustomSelectList → Select/List/Row}/style.d.ts +0 -2
- package/dist/components/{CustomSelect/CustomSelectList → Select/List/Row}/style.js +1 -54
- package/dist/components/Select/List/index.d.ts +12 -0
- package/dist/components/Select/List/index.js +63 -0
- package/dist/components/Select/List/style.d.ts +2 -0
- package/dist/components/Select/List/style.js +56 -0
- package/dist/components/Select/index.d.ts +34 -0
- package/dist/components/{CustomSelect → Select}/index.js +11 -9
- package/dist/components/{CustomSelect → Select}/styles.d.ts +2 -2
- package/dist/components/{CustomSelect → Select}/styles.js +6 -8
- package/dist/components/fields/components/HelpText/index.d.ts +8 -0
- package/dist/components/fields/components/HelpText/index.js +35 -0
- package/dist/components/fields/components/HelpText/modifiers/colors.d.ts +4 -0
- package/dist/components/fields/components/HelpText/modifiers/colors.js +9 -0
- package/dist/components/fields/components/HelpText/styles.d.ts +2 -0
- package/dist/components/fields/components/HelpText/styles.js +19 -0
- package/dist/components/fields/components/Label/index.d.ts +8 -0
- package/dist/components/fields/components/Label/index.js +22 -0
- package/dist/components/fields/components/Label/styles.d.ts +5 -0
- package/dist/components/fields/components/Label/styles.js +28 -0
- package/dist/components/fields/components/RotateButton/index.d.ts +6 -0
- package/dist/components/fields/components/RotateButton/index.js +13 -0
- package/dist/components/fields/components/RotateButton/styles.d.ts +5 -0
- package/dist/components/fields/components/RotateButton/styles.js +10 -0
- package/dist/components/fields/helpers/getFeedbackType.d.ts +2 -0
- package/dist/components/fields/helpers/getFeedbackType.js +11 -0
- package/dist/components/fields/modifiers/color_modifiers.d.ts +2 -0
- package/dist/components/fields/modifiers/color_modifiers.js +7 -0
- package/dist/components/fields/modifiers/inputColorModifier.d.ts +2 -0
- package/dist/components/fields/modifiers/inputColorModifier.js +14 -0
- package/dist/components/fields/modifiers/selectColorModifier.d.ts +2 -0
- package/dist/components/fields/modifiers/selectColorModifier.js +10 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.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 +11 -4
- package/dist/types/feedback.d.ts +1 -0
- package/package.json +2 -2
- package/dist/assets/fonts/Inter-Regular.js +0 -2
- package/dist/components/CustomSelect/CustomSelect.stories.d.ts +0 -73
- package/dist/components/CustomSelect/CustomSelect.stories.js +0 -477
- package/dist/components/CustomSelect/CustomSelectList/index.d.ts +0 -10
- package/dist/components/CustomSelect/CustomSelectList/index.js +0 -66
- package/dist/components/CustomSelect/index.d.ts +0 -30
- package/dist/components/MultiSelect/MultiSelect.stories.d.ts +0 -61
- package/dist/components/MultiSelect/MultiSelect.stories.js +0 -336
- package/dist/static/font/Inter-Regular.ttf +0 -0
- /package/dist/components/MultiSelect/{calcTextSize.d.ts → helpers/calcTextSize.d.ts} +0 -0
- /package/dist/components/MultiSelect/{calcTextSize.js → helpers/calcTextSize.js} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Meta, StoryObj } from
|
|
2
|
-
import FilterList from
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import FilterList from '.';
|
|
3
3
|
/**
|
|
4
4
|
* DoubleList exibe duas listas separadas, permitindo ao usuário visualizar diferentes itens simultaneamente.
|
|
5
5
|
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import index from "./index.js";
|
|
3
3
|
const meta = {
|
|
4
|
-
title:
|
|
4
|
+
title: 'UI/DoubleList',
|
|
5
5
|
component: index,
|
|
6
6
|
tags: [
|
|
7
|
-
|
|
7
|
+
'autodocs'
|
|
8
8
|
],
|
|
9
9
|
decorators: [
|
|
10
10
|
(Story)=>/*#__PURE__*/ jsx("div", {
|
|
11
11
|
style: {
|
|
12
|
-
background:
|
|
13
|
-
width:
|
|
14
|
-
borderRadius:
|
|
15
|
-
display:
|
|
16
|
-
justifyContent:
|
|
17
|
-
alignItems:
|
|
18
|
-
padding:
|
|
12
|
+
background: 'pink',
|
|
13
|
+
width: '32rem',
|
|
14
|
+
borderRadius: '0.5rem',
|
|
15
|
+
display: 'flex',
|
|
16
|
+
justifyContent: 'center',
|
|
17
|
+
alignItems: 'center',
|
|
18
|
+
padding: '1rem'
|
|
19
19
|
},
|
|
20
20
|
children: /*#__PURE__*/ jsx(Story, {})
|
|
21
21
|
})
|
|
22
22
|
],
|
|
23
23
|
parameters: {
|
|
24
|
-
layout:
|
|
24
|
+
layout: 'centered'
|
|
25
25
|
},
|
|
26
26
|
argTypes: {
|
|
27
27
|
total: {
|
|
28
|
-
description:
|
|
28
|
+
description: 'Recebe a quantidade total de intens.'
|
|
29
29
|
},
|
|
30
30
|
options: {
|
|
31
31
|
description: "Recebe um Array de strings que ser\xe3o renderizadas nas listas."
|
|
@@ -34,45 +34,45 @@ const meta = {
|
|
|
34
34
|
description: "Define a quantidade de op\xe7\xf5es que aparecem por vez nas listas."
|
|
35
35
|
},
|
|
36
36
|
title: {
|
|
37
|
-
description:
|
|
37
|
+
description: 'Define o titulo acima do componente.'
|
|
38
38
|
},
|
|
39
39
|
selected: {
|
|
40
|
-
description:
|
|
40
|
+
description: 'Define a quantidade que foi selecionada.'
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
44
|
const DoubleList_stories = meta;
|
|
45
45
|
const placas = [
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
46
|
+
'XJZ874',
|
|
47
|
+
'TRK951',
|
|
48
|
+
'LMP230',
|
|
49
|
+
'QWV615',
|
|
50
|
+
'BNC472',
|
|
51
|
+
'DFT389',
|
|
52
|
+
'GHR526',
|
|
53
|
+
'VXZ731',
|
|
54
|
+
'JFK198',
|
|
55
|
+
'MNL543',
|
|
56
|
+
'ZXC741',
|
|
57
|
+
'PLM852',
|
|
58
|
+
'QWE963',
|
|
59
|
+
'TYU357',
|
|
60
|
+
'BNM147',
|
|
61
|
+
'ASD951',
|
|
62
|
+
'GHJ635',
|
|
63
|
+
'XCV284',
|
|
64
|
+
'LKJ578',
|
|
65
|
+
'POI963',
|
|
66
|
+
'MNB753',
|
|
67
|
+
'WER852',
|
|
68
|
+
'OIU246',
|
|
69
|
+
'YTR159',
|
|
70
|
+
'ZXA6345',
|
|
71
|
+
'QWERTY',
|
|
72
|
+
'PLACAEXEMPLO',
|
|
73
|
+
'EXEMPLO123',
|
|
74
|
+
'TESTEPLACAGRANDETESTEPLACAGRANDETESTEPLACAGRANDE',
|
|
75
|
+
'AB'
|
|
76
76
|
];
|
|
77
77
|
const Default = {
|
|
78
78
|
args: {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { OptionContainer } from "./style.js";
|
|
3
|
+
function Row({ index, style, data }) {
|
|
4
|
+
const label = data[index];
|
|
5
|
+
return /*#__PURE__*/ jsx(OptionContainer, {
|
|
6
|
+
style: style,
|
|
7
|
+
children: /*#__PURE__*/ jsx("span", {
|
|
8
|
+
children: label
|
|
9
|
+
})
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
export { Row as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const OptionContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import styled_components from "styled-components";
|
|
2
|
+
import { COLOR_NEUTRAL_DARKER, COLOR_NEUTRAL_DUSK, COLOR_NEUTRAL_LIGHTER, FONT_FAMILY_01, FONT_WEIGHT_MEDIUM } from "@ftdata/f-tokens";
|
|
3
|
+
const OptionContainer = styled_components.div`
|
|
4
|
+
box-sizing: border-box;
|
|
5
|
+
cursor: pointer;
|
|
6
|
+
display: flex;
|
|
7
|
+
gap: 0.5rem;
|
|
8
|
+
padding: 0.5rem 1rem;
|
|
9
|
+
width: 100%;
|
|
10
|
+
align-items: center;
|
|
11
|
+
|
|
12
|
+
&:hover {
|
|
13
|
+
background-color: ${COLOR_NEUTRAL_LIGHTER};
|
|
14
|
+
|
|
15
|
+
span {
|
|
16
|
+
color: ${COLOR_NEUTRAL_DUSK};
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
span {
|
|
21
|
+
color: ${COLOR_NEUTRAL_DARKER};
|
|
22
|
+
font-size: 0.875rem;
|
|
23
|
+
line-height: 1.25rem;
|
|
24
|
+
font-family: ${FONT_FAMILY_01};
|
|
25
|
+
font-weight: ${FONT_WEIGHT_MEDIUM};
|
|
26
|
+
white-space: nowrap;
|
|
27
|
+
overflow: hidden;
|
|
28
|
+
text-overflow: ellipsis;
|
|
29
|
+
}
|
|
30
|
+
`;
|
|
31
|
+
export { OptionContainer };
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { DoubleListContainer, HeadingContainer, ListContainer, ListsContainer
|
|
4
|
-
|
|
5
|
-
const label = data[index];
|
|
6
|
-
return /*#__PURE__*/ jsx(OptionContainer, {
|
|
7
|
-
style: style,
|
|
8
|
-
children: /*#__PURE__*/ jsx("span", {
|
|
9
|
-
children: label
|
|
10
|
-
})
|
|
11
|
-
});
|
|
12
|
-
};
|
|
2
|
+
import { List } from "react-window";
|
|
3
|
+
import { DoubleListContainer, HeadingContainer, ListContainer, ListsContainer } from "./style.js";
|
|
4
|
+
import Row from "./Row/index.js";
|
|
13
5
|
function DoubleList({ options, listHeight = 5, title, selected, total, ...rest }) {
|
|
14
6
|
const OPTION_SIZE = 36;
|
|
15
7
|
const height = listHeight * OPTION_SIZE;
|
|
@@ -33,33 +25,33 @@ function DoubleList({ options, listHeight = 5, title, selected, total, ...rest }
|
|
|
33
25
|
/*#__PURE__*/ jsxs(ListsContainer, {
|
|
34
26
|
children: [
|
|
35
27
|
/*#__PURE__*/ jsx(ListContainer, {
|
|
36
|
-
children: /*#__PURE__*/ jsx(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
28
|
+
children: /*#__PURE__*/ jsx(List, {
|
|
29
|
+
rowComponent: Row,
|
|
30
|
+
rowCount: firstHalf.length,
|
|
31
|
+
rowHeight: OPTION_SIZE,
|
|
32
|
+
rowProps: {
|
|
33
|
+
data: firstHalf
|
|
34
|
+
},
|
|
35
|
+
style: {
|
|
36
|
+
height: `${height / 16}rem`,
|
|
37
|
+
width: "100%"
|
|
38
|
+
},
|
|
39
|
+
overscanCount: 0
|
|
48
40
|
})
|
|
49
41
|
}),
|
|
50
42
|
/*#__PURE__*/ jsx(ListContainer, {
|
|
51
|
-
children: /*#__PURE__*/ jsx(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
43
|
+
children: /*#__PURE__*/ jsx(List, {
|
|
44
|
+
rowComponent: Row,
|
|
45
|
+
rowCount: secondHalf.length,
|
|
46
|
+
rowHeight: OPTION_SIZE,
|
|
47
|
+
rowProps: {
|
|
48
|
+
data: secondHalf
|
|
49
|
+
},
|
|
50
|
+
style: {
|
|
51
|
+
height: `${height / 16}rem`,
|
|
52
|
+
width: "100%"
|
|
53
|
+
},
|
|
54
|
+
overscanCount: 0
|
|
63
55
|
})
|
|
64
56
|
})
|
|
65
57
|
]
|
|
@@ -2,4 +2,3 @@ export declare const DoubleListContainer: import("styled-components/dist/types")
|
|
|
2
2
|
export declare const HeadingContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
3
3
|
export declare const ListsContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
4
4
|
export declare const ListContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
5
|
-
export declare const OptionContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import styled_components from "styled-components";
|
|
2
|
-
import { COLOR_NEUTRAL_DARKER, COLOR_NEUTRAL_DAY, COLOR_NEUTRAL_DUSK, COLOR_NEUTRAL_LIGHT
|
|
2
|
+
import { COLOR_NEUTRAL_DARKER, COLOR_NEUTRAL_DAY, COLOR_NEUTRAL_DUSK, COLOR_NEUTRAL_LIGHT } from "@ftdata/f-tokens";
|
|
3
3
|
const DoubleListContainer = styled_components.div`
|
|
4
4
|
display: flex;
|
|
5
|
-
background-color: ${COLOR_NEUTRAL_DAY};
|
|
6
5
|
flex-direction: column;
|
|
7
6
|
gap: 0.75rem;
|
|
8
7
|
width: 100%;
|
|
@@ -37,7 +36,6 @@ const ListsContainer = styled_components.div`
|
|
|
37
36
|
}
|
|
38
37
|
`;
|
|
39
38
|
const ListContainer = styled_components.div`
|
|
40
|
-
background-color: ${COLOR_NEUTRAL_DAY};
|
|
41
39
|
display: flex;
|
|
42
40
|
overflow: overlay;
|
|
43
41
|
width: calc(50% - 0.313rem);
|
|
@@ -62,31 +60,4 @@ const ListContainer = styled_components.div`
|
|
|
62
60
|
background-clip: padding-box;
|
|
63
61
|
}
|
|
64
62
|
`;
|
|
65
|
-
|
|
66
|
-
align-items: center;
|
|
67
|
-
background-color: ${COLOR_NEUTRAL_DAY};
|
|
68
|
-
box-sizing: border-box;
|
|
69
|
-
display: inline-flex;
|
|
70
|
-
gap: 0.5rem;
|
|
71
|
-
padding: 0.5rem 0;
|
|
72
|
-
width: 100%;
|
|
73
|
-
overflow: hidden;
|
|
74
|
-
transition: all 0.18s fowards;
|
|
75
|
-
|
|
76
|
-
&:hover {
|
|
77
|
-
background-color: ${COLOR_NEUTRAL_LIGHTER};
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
span {
|
|
81
|
-
font-size: 0.875rem;
|
|
82
|
-
color: ${COLOR_NEUTRAL_DARKER};
|
|
83
|
-
line-height: 1.25rem;
|
|
84
|
-
letter-spacing: 0px;
|
|
85
|
-
max-width: 90%;
|
|
86
|
-
font-weight: 500;
|
|
87
|
-
white-space: nowrap;
|
|
88
|
-
overflow: hidden;
|
|
89
|
-
text-overflow: ellipsis;
|
|
90
|
-
}
|
|
91
|
-
`;
|
|
92
|
-
export { DoubleListContainer, HeadingContainer, ListContainer, ListsContainer, OptionContainer };
|
|
63
|
+
export { DoubleListContainer, HeadingContainer, ListContainer, ListsContainer };
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import index from "./index.js";
|
|
3
|
+
import { Icon } from "@ftdata/f-icons";
|
|
4
|
+
const meta = {
|
|
5
|
+
title: "Components/Menu",
|
|
6
|
+
component: index,
|
|
7
|
+
argTypes: {
|
|
8
|
+
background: {
|
|
9
|
+
control: "color"
|
|
10
|
+
},
|
|
11
|
+
fontcolor: {
|
|
12
|
+
control: "color"
|
|
13
|
+
},
|
|
14
|
+
subMenusBackground: {
|
|
15
|
+
control: "color"
|
|
16
|
+
},
|
|
17
|
+
active: {
|
|
18
|
+
control: "text"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
const Menu_stories = meta;
|
|
23
|
+
const mockLogo = /*#__PURE__*/ jsx(Icon, {
|
|
24
|
+
name: "ui airplay-signal",
|
|
25
|
+
width: "2rem"
|
|
26
|
+
});
|
|
27
|
+
const mockItems = [
|
|
28
|
+
{
|
|
29
|
+
id: 1,
|
|
30
|
+
description: "Dashboard principal",
|
|
31
|
+
endpoint: "/dashboard",
|
|
32
|
+
itens: [
|
|
33
|
+
{
|
|
34
|
+
id: 11,
|
|
35
|
+
description: "Relat\xf3rios",
|
|
36
|
+
endpoint: "/dashboard/reports",
|
|
37
|
+
itens: [
|
|
38
|
+
{
|
|
39
|
+
id: 12,
|
|
40
|
+
description: "Estat\xedsticas",
|
|
41
|
+
endpoint: "/dashboard/statistics",
|
|
42
|
+
itens: [],
|
|
43
|
+
menu_icon: "ui statistics",
|
|
44
|
+
translate_key: "changelog",
|
|
45
|
+
ordenation: 2
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: 12,
|
|
49
|
+
description: "Estat\xedsticas",
|
|
50
|
+
endpoint: "/dashboard/statistics",
|
|
51
|
+
itens: [],
|
|
52
|
+
menu_icon: "ui statistics",
|
|
53
|
+
translate_key: "changelog",
|
|
54
|
+
ordenation: 2
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: 12,
|
|
58
|
+
description: "Estat\xedsticas",
|
|
59
|
+
endpoint: "/dashboard/statistics",
|
|
60
|
+
itens: [],
|
|
61
|
+
menu_icon: "ui statistics",
|
|
62
|
+
translate_key: "changelog",
|
|
63
|
+
ordenation: 2
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
menu_icon: "ui report",
|
|
67
|
+
translate_key: "reports",
|
|
68
|
+
ordenation: 1
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
id: 12,
|
|
72
|
+
description: "Estat\xedsticas",
|
|
73
|
+
endpoint: "/dashboard/statistics",
|
|
74
|
+
itens: [],
|
|
75
|
+
menu_icon: "ui statistics",
|
|
76
|
+
translate_key: "changelog",
|
|
77
|
+
ordenation: 2
|
|
78
|
+
}
|
|
79
|
+
],
|
|
80
|
+
menu_icon: "ui dashboard",
|
|
81
|
+
translate_key: "dashboard",
|
|
82
|
+
ordenation: 1
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
id: 2,
|
|
86
|
+
description: "Configura\xe7\xf5es do sistema",
|
|
87
|
+
endpoint: "/settings",
|
|
88
|
+
itens: [],
|
|
89
|
+
menu_icon: "ui settings",
|
|
90
|
+
translate_key: "settings",
|
|
91
|
+
ordenation: 2
|
|
92
|
+
}
|
|
93
|
+
];
|
|
94
|
+
const mockTranslate = (key)=>{
|
|
95
|
+
const dict = {
|
|
96
|
+
menu: "Menu",
|
|
97
|
+
dashboard: "Dashboard",
|
|
98
|
+
settings: "Configura\xe7\xf5es",
|
|
99
|
+
back: "Voltar",
|
|
100
|
+
reports: "Relat\xf3rios",
|
|
101
|
+
statistics: "Estat\xedsticas"
|
|
102
|
+
};
|
|
103
|
+
return dict[key] || key;
|
|
104
|
+
};
|
|
105
|
+
const Default = {
|
|
106
|
+
args: {
|
|
107
|
+
background: "#222",
|
|
108
|
+
fontcolor: "#fff",
|
|
109
|
+
subMenusBackground: "#333",
|
|
110
|
+
logo: mockLogo,
|
|
111
|
+
items: mockItems,
|
|
112
|
+
translate: mockTranslate,
|
|
113
|
+
active: "dashboard"
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
export { Default, Menu_stories as default };
|
|
@@ -7,14 +7,22 @@ function Menu({ background, fontcolor, subMenusBackground, logo, items, translat
|
|
|
7
7
|
const [expand, setExpand] = useState(false);
|
|
8
8
|
const [submenus, setSubmenus] = useState([]);
|
|
9
9
|
const [isClosingSubmenu, setIsClosingSubmenu] = useState(false);
|
|
10
|
+
const [menuAnimating, setMenuAnimating] = useState(false);
|
|
10
11
|
const menuRef = useRef(null);
|
|
11
12
|
const menus = createMenus(items, translate);
|
|
12
13
|
const toggleMenu = ()=>{
|
|
13
|
-
if (expand)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
if (expand) {
|
|
15
|
+
setMenuAnimating(true);
|
|
16
|
+
setTimeout(()=>{
|
|
17
|
+
setSubmenus([]);
|
|
18
|
+
setExpand(false);
|
|
19
|
+
setMenuAnimating(false);
|
|
20
|
+
}, 120);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
17
23
|
setExpand(true);
|
|
24
|
+
setMenuAnimating(true);
|
|
25
|
+
setTimeout(()=>setMenuAnimating(false), 120);
|
|
18
26
|
};
|
|
19
27
|
const handleClickItem = (event, submenus, callback)=>{
|
|
20
28
|
event.stopPropagation();
|
|
@@ -26,6 +34,10 @@ function Menu({ background, fontcolor, subMenusBackground, logo, items, translat
|
|
|
26
34
|
event.stopPropagation();
|
|
27
35
|
toggleMenu();
|
|
28
36
|
};
|
|
37
|
+
const handleClickAside = (event)=>{
|
|
38
|
+
if (!expand) return void toggleMenu();
|
|
39
|
+
if (event.target === event.currentTarget) toggleMenu();
|
|
40
|
+
};
|
|
29
41
|
const handleClickBack = ()=>{
|
|
30
42
|
setIsClosingSubmenu(true);
|
|
31
43
|
setTimeout(()=>{
|
|
@@ -50,7 +62,7 @@ function Menu({ background, fontcolor, subMenusBackground, logo, items, translat
|
|
|
50
62
|
return /*#__PURE__*/ jsxs(MenuAside, {
|
|
51
63
|
ref: menuRef,
|
|
52
64
|
background: background,
|
|
53
|
-
onClick:
|
|
65
|
+
onClick: handleClickAside,
|
|
54
66
|
$expand: expand,
|
|
55
67
|
children: [
|
|
56
68
|
/*#__PURE__*/ jsxs(MenuHeader, {
|
|
@@ -59,6 +71,7 @@ function Menu({ background, fontcolor, subMenusBackground, logo, items, translat
|
|
|
59
71
|
onClick: handleClickHamburger,
|
|
60
72
|
fontcolor: fontcolor,
|
|
61
73
|
$expand: expand,
|
|
74
|
+
$animating: menuAnimating,
|
|
62
75
|
children: [
|
|
63
76
|
/*#__PURE__*/ jsx("div", {
|
|
64
77
|
children: /*#__PURE__*/ jsx(Icon, {
|
|
@@ -83,6 +96,7 @@ function Menu({ background, fontcolor, subMenusBackground, logo, items, translat
|
|
|
83
96
|
onClick: (event)=>handleClickItem(event, menu.submenus, menu.callback),
|
|
84
97
|
$expand: expand || void 0,
|
|
85
98
|
$active: menu.label === translate(active || ""),
|
|
99
|
+
$animating: menuAnimating,
|
|
86
100
|
children: [
|
|
87
101
|
/*#__PURE__*/ jsx("div", {
|
|
88
102
|
children: menu.icon
|
|
@@ -97,23 +111,24 @@ function Menu({ background, fontcolor, subMenusBackground, logo, items, translat
|
|
|
97
111
|
$isClosing: isClosingSubmenu || void 0,
|
|
98
112
|
background: subMenusBackground,
|
|
99
113
|
children: [
|
|
100
|
-
/*#__PURE__*/
|
|
114
|
+
/*#__PURE__*/ jsxs(SubItemsHeader, {
|
|
101
115
|
fontcolor: fontcolor,
|
|
102
|
-
children:
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
/*#__PURE__*/ jsx(Icon, {
|
|
116
|
+
children: [
|
|
117
|
+
/*#__PURE__*/ jsx("button", {
|
|
118
|
+
onClick: handleClickBack,
|
|
119
|
+
children: /*#__PURE__*/ jsx(Icon, {
|
|
106
120
|
name: "arw arrow-left"
|
|
107
|
-
})
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
121
|
+
})
|
|
122
|
+
}),
|
|
123
|
+
translate("back")
|
|
124
|
+
]
|
|
111
125
|
}),
|
|
112
126
|
/*#__PURE__*/ jsx(SubItemsWrapper, {
|
|
113
127
|
background: subMenusBackground,
|
|
114
128
|
children: submenus.map((submenu, idx)=>/*#__PURE__*/ jsx(SubMenuItem, {
|
|
115
129
|
fontcolor: fontcolor,
|
|
116
130
|
onClick: (event)=>handleClickItem(event, [], submenu.callback),
|
|
131
|
+
$animating: menuAnimating,
|
|
117
132
|
children: submenu.label
|
|
118
133
|
}, `${submenu.label}-${idx}`))
|
|
119
134
|
})
|
|
@@ -4,6 +4,7 @@ interface ICommonProps {
|
|
|
4
4
|
$active?: boolean;
|
|
5
5
|
$expand?: boolean;
|
|
6
6
|
$isClosing?: boolean;
|
|
7
|
+
$animating?: boolean;
|
|
7
8
|
}
|
|
8
9
|
export declare const MenuAside: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, ICommonProps>> & string;
|
|
9
10
|
export declare const MenuHeader: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, ICommonProps>> & string;
|