@omniumretail/component-library 1.0.37 → 1.0.39
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/bundle.js +148 -5
- package/dist/main.css +216 -0
- package/dist/types/components/AnalyticsBar/AnalyticsBar.stories.d.ts +5 -0
- package/dist/types/components/AnalyticsBar/helpers/codeMutation.d.ts +4 -0
- package/dist/types/components/AnalyticsBar/index.d.ts +2 -0
- package/dist/types/components/AnalyticsBar/interfaces/analyticsBar.d.ts +12 -0
- package/dist/types/components/CategoryResponse/CategoryResponse.stories.d.ts +4 -0
- package/dist/types/components/CategoryResponse/evaluationOptions.d.ts +10 -0
- package/dist/types/components/CategoryResponse/index.d.ts +9 -0
- package/dist/types/components/Menu/Menu.stories.d.ts +5 -0
- package/dist/types/components/Menu/helpers/codeMutation.d.ts +4 -0
- package/dist/types/components/Menu/index.d.ts +3 -0
- package/dist/types/components/index.d.ts +2 -0
- package/dist/types/constants/translationHelper.d.ts +2 -0
- package/package.json +1 -1
- package/src/components/AnalyticsBar/AnalyticsBar.stories.tsx +180 -0
- package/src/components/AnalyticsBar/helpers/codeMutation.tsx +19 -0
- package/src/components/AnalyticsBar/index.tsx +76 -0
- package/src/components/AnalyticsBar/interfaces/analyticsBar.tsx +13 -0
- package/src/components/AnalyticsBar/styles.module.scss +108 -0
- package/src/components/Category/Category.stories.tsx +64 -37
- package/src/components/Category/CategoryContent/index.tsx +9 -9
- package/src/components/CategoryResponse/CategoryResponse.stories.tsx +261 -0
- package/src/components/CategoryResponse/evaluationOptions.tsx +81 -0
- package/src/components/CategoryResponse/index.tsx +279 -0
- package/src/components/CategoryResponse/styles.module.scss +135 -0
- package/src/components/Menu/Menu.stories.tsx +178 -0
- package/src/components/Menu/helpers/codeMutation.tsx +19 -0
- package/src/components/Menu/index.tsx +23 -0
- package/src/components/Menu/styles.module.scss +0 -0
- package/src/components/index.tsx +2 -0
- package/src/constants/translationHelper.ts +7 -0
- package/src/locales/en.json +3 -0
- package/src/locales/es.json +3 -0
- package/src/locales/pt.json +3 -0
package/dist/main.css
CHANGED
|
@@ -709,3 +709,219 @@ Label {
|
|
|
709
709
|
.j8_c3JHTX0JOkT36fF6A .xlaG0XsJDRR9AClqXzzC .anticon-close:hover {
|
|
710
710
|
color: var(--color-black);
|
|
711
711
|
}
|
|
712
|
+
/*!*********************************************************************************************************************************************************************!*\
|
|
713
|
+
!*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[0].use[1]!./node_modules/sass-loader/dist/cjs.js!./src/components/AnalyticsBar/styles.module.scss ***!
|
|
714
|
+
\*********************************************************************************************************************************************************************/
|
|
715
|
+
.BWmwZ5nFKyctBZyOAXzg {
|
|
716
|
+
width: 100%;
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
.GWTSauaAl_v9W8o4YPxW {
|
|
720
|
+
background: rgba(44, 45, 46, 0.0509803922);
|
|
721
|
+
height: 100%;
|
|
722
|
+
position: relative;
|
|
723
|
+
}
|
|
724
|
+
.GWTSauaAl_v9W8o4YPxW .ant-menu-light {
|
|
725
|
+
background-color: transparent !important;
|
|
726
|
+
border-inline-end: none !important;
|
|
727
|
+
}
|
|
728
|
+
.GWTSauaAl_v9W8o4YPxW .ant-menu-title-content {
|
|
729
|
+
font-size: 17px;
|
|
730
|
+
line-height: 20px;
|
|
731
|
+
font-weight: var(--font-weight-semibold);
|
|
732
|
+
}
|
|
733
|
+
.GWTSauaAl_v9W8o4YPxW .ant-menu-title-content:hover {
|
|
734
|
+
color: var(--color-orange);
|
|
735
|
+
}
|
|
736
|
+
.GWTSauaAl_v9W8o4YPxW .ant-menu-sub .ant-menu-title-content {
|
|
737
|
+
font-size: 15px;
|
|
738
|
+
line-height: 18px;
|
|
739
|
+
font-weight: var(--font-weight-medium);
|
|
740
|
+
}
|
|
741
|
+
.GWTSauaAl_v9W8o4YPxW .ant-menu-sub .ant-menu-item {
|
|
742
|
+
height: 30px;
|
|
743
|
+
line-height: 30px;
|
|
744
|
+
}
|
|
745
|
+
.GWTSauaAl_v9W8o4YPxW .ant-menu-sub .ant-menu-item:first-child {
|
|
746
|
+
margin-top: -10px;
|
|
747
|
+
}
|
|
748
|
+
.GWTSauaAl_v9W8o4YPxW .ant-menu-submenu {
|
|
749
|
+
border-top: 1px solid var(--color-orange);
|
|
750
|
+
border-radius: 0;
|
|
751
|
+
}
|
|
752
|
+
.GWTSauaAl_v9W8o4YPxW .ant-menu-item:hover {
|
|
753
|
+
background-color: initial !important;
|
|
754
|
+
}
|
|
755
|
+
.GWTSauaAl_v9W8o4YPxW .ant-menu-item-selected,
|
|
756
|
+
.GWTSauaAl_v9W8o4YPxW .ant-menu-submenu-selected > .ant-menu-submenu-title {
|
|
757
|
+
color: var(--color-orange);
|
|
758
|
+
background-color: initial;
|
|
759
|
+
}
|
|
760
|
+
.GWTSauaAl_v9W8o4YPxW .ant-menu-inline .ant-menu-sub.ant-menu-inline {
|
|
761
|
+
background: initial;
|
|
762
|
+
}
|
|
763
|
+
.GWTSauaAl_v9W8o4YPxW .ant-menu-submenu-title {
|
|
764
|
+
height: 50px !important;
|
|
765
|
+
line-height: 50px !important;
|
|
766
|
+
}
|
|
767
|
+
.GWTSauaAl_v9W8o4YPxW .ant-menu-submenu-title:hover {
|
|
768
|
+
background-color: initial !important;
|
|
769
|
+
}
|
|
770
|
+
.GWTSauaAl_v9W8o4YPxW .ant-menu-submenu-title .anticon {
|
|
771
|
+
color: var(--color-orange);
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
.hWGer1IJ7RdkfQWwYfsw {
|
|
775
|
+
position: absolute;
|
|
776
|
+
top: 24px;
|
|
777
|
+
left: 24px;
|
|
778
|
+
right: 24px;
|
|
779
|
+
height: 144px;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
.MD1FhirslDDwd2izGwai {
|
|
783
|
+
font-size: var(--font-size-body-2);
|
|
784
|
+
line-height: 14px;
|
|
785
|
+
font-weight: var(--font-weight-light);
|
|
786
|
+
display: inline-block;
|
|
787
|
+
padding: 12px;
|
|
788
|
+
cursor: pointer;
|
|
789
|
+
position: absolute;
|
|
790
|
+
right: 0;
|
|
791
|
+
top: 60px;
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
.RxGn4c38kNq8Ai4ypW_x {
|
|
795
|
+
position: absolute;
|
|
796
|
+
top: 144px;
|
|
797
|
+
left: 24px;
|
|
798
|
+
right: 24px;
|
|
799
|
+
bottom: 0;
|
|
800
|
+
overflow-y: auto;
|
|
801
|
+
overflow-x: hidden;
|
|
802
|
+
padding-bottom: 24px;
|
|
803
|
+
}
|
|
804
|
+
/*!*************************************************************************************************************************************************************************!*\
|
|
805
|
+
!*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[0].use[1]!./node_modules/sass-loader/dist/cjs.js!./src/components/CategoryResponse/styles.module.scss ***!
|
|
806
|
+
\*************************************************************************************************************************************************************************/
|
|
807
|
+
.rdjN4ln3xiUoa6Q0NMMm {
|
|
808
|
+
display: grid;
|
|
809
|
+
grid-template-columns: 300px auto;
|
|
810
|
+
gap: 16px;
|
|
811
|
+
height: 100%;
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
.Q4flbvKEPN6Jx9Cob22I {
|
|
815
|
+
background: #EBECED;
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
.hK3soC6m563VuiLnNutq {
|
|
819
|
+
background: var(--color-white);
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
.Q4flbvKEPN6Jx9Cob22I,
|
|
823
|
+
.hK3soC6m563VuiLnNutq {
|
|
824
|
+
padding: 20px;
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
.guqqOMHeZE56Bg2p5Ad8 {
|
|
828
|
+
font-size: var(--font-size-body-4);
|
|
829
|
+
color: var(--color-blue);
|
|
830
|
+
margin-bottom: 36px;
|
|
831
|
+
font-weight: var(--font-weight-semibold);
|
|
832
|
+
text-transform: uppercase;
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
.wRCQxnQc_MZGDeiY1bcL {
|
|
836
|
+
padding-bottom: 15px;
|
|
837
|
+
font-weight: var(--font-weight-bold);
|
|
838
|
+
font-size: var(--font-size-body-4);
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
.JRmeFBsSP1f1HJwarMpc {
|
|
842
|
+
cursor: pointer;
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
.Y6yF3VITdrKdQzDtqTZX {
|
|
846
|
+
padding-left: 16px;
|
|
847
|
+
}
|
|
848
|
+
.Y6yF3VITdrKdQzDtqTZX .wRCQxnQc_MZGDeiY1bcL {
|
|
849
|
+
font-weight: var(--font-weight-medium);
|
|
850
|
+
}
|
|
851
|
+
.Y6yF3VITdrKdQzDtqTZX .aKZCkmPsc0LiPdj3sEeG .Y6yF3VITdrKdQzDtqTZX .wRCQxnQc_MZGDeiY1bcL {
|
|
852
|
+
font-weight: var(--font-weight-light);
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
.aKZCkmPsc0LiPdj3sEeG {
|
|
856
|
+
display: block;
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
.U_3frSKmaOQyTCb9oBkg {
|
|
860
|
+
color: var(--color-orange);
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
.GEZDeWAneRLnZQyf4y9l {
|
|
864
|
+
margin-bottom: 24px;
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
.YcOvMLXE7vKR2Y0_BPRr {
|
|
868
|
+
font-size: var(--font-size-body-4);
|
|
869
|
+
color: var(--color-blue);
|
|
870
|
+
font-weight: var(--font-weight-semibold);
|
|
871
|
+
margin-bottom: 8px;
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
.vlMh_CCr45wbKV4fMhJx {
|
|
875
|
+
font-size: var(--font-size-body-3);
|
|
876
|
+
font-weight: var(--font-weight-light);
|
|
877
|
+
color: var(--color-black);
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
.NZ_ohAxNxhxZsCBr2PRA {
|
|
881
|
+
display: flex;
|
|
882
|
+
flex-direction: row;
|
|
883
|
+
gap: 12px;
|
|
884
|
+
margin-bottom: 36px;
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
.CArVrMs2ac6JvM1VGLSw {
|
|
888
|
+
flex-direction: column;
|
|
889
|
+
border-bottom: 1px solid rgba(var(--color-blue-rgb), 0.2);
|
|
890
|
+
margin-bottom: 24px;
|
|
891
|
+
}
|
|
892
|
+
.CArVrMs2ac6JvM1VGLSw .OpqJ6gab6fPIq3KyckPO {
|
|
893
|
+
width: 100%;
|
|
894
|
+
border-bottom: none;
|
|
895
|
+
}
|
|
896
|
+
.CArVrMs2ac6JvM1VGLSw .E9TXHxbgaI6LGMZHG9bV {
|
|
897
|
+
width: 100%;
|
|
898
|
+
height: auto;
|
|
899
|
+
}
|
|
900
|
+
.CArVrMs2ac6JvM1VGLSw .E9TXHxbgaI6LGMZHG9bV .ant-input {
|
|
901
|
+
min-height: 140px;
|
|
902
|
+
}
|
|
903
|
+
.CArVrMs2ac6JvM1VGLSw .E9TXHxbgaI6LGMZHG9bV .ant-form-item {
|
|
904
|
+
margin-bottom: 16px;
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
.OpqJ6gab6fPIq3KyckPO {
|
|
908
|
+
width: calc(100% - 112px);
|
|
909
|
+
border-bottom: 1px solid rgba(var(--color-blue-rgb), 0.2);
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
.E9TXHxbgaI6LGMZHG9bV {
|
|
913
|
+
width: 100px;
|
|
914
|
+
height: 50px;
|
|
915
|
+
align-self: flex-end;
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
.xdLvKgnXC4tm2aa6tAap {
|
|
919
|
+
font-size: var(--font-size-body-3);
|
|
920
|
+
font-weight: var(--font-weight-medium);
|
|
921
|
+
margin-bottom: 8px;
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
.r5obiTduSUBq1uL7oceW {
|
|
925
|
+
font-weight: var(--font-weight-light);
|
|
926
|
+
margin-bottom: 4px;
|
|
927
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { MenuProps } from 'antd';
|
|
3
|
+
export type MenuItem = Required<MenuProps>['items'][number];
|
|
4
|
+
export declare function getItem(label: React.ReactNode, key: React.Key, icon?: React.ReactNode, children?: MenuItem[], type?: 'group'): MenuItem;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type EvaluationOption = {
|
|
2
|
+
value: string;
|
|
3
|
+
label: string;
|
|
4
|
+
};
|
|
5
|
+
export type EvaluationOptions = {
|
|
6
|
+
scale_0: EvaluationOption[];
|
|
7
|
+
scale_1: EvaluationOption[];
|
|
8
|
+
scale_2: EvaluationOption[];
|
|
9
|
+
};
|
|
10
|
+
export declare const evaluationOptions: EvaluationOptions;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface CategoryResponse {
|
|
3
|
+
data: any;
|
|
4
|
+
serverReadyData: any;
|
|
5
|
+
onNextCategoryAvailabilityChange: (hasNext: boolean) => void;
|
|
6
|
+
onPreviousCategoryAvailabilityChange: (hasPrevious: boolean) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const CategoryResponse: React.ForwardRefExoticComponent<CategoryResponse & React.RefAttributes<unknown>>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { MenuProps } from 'antd';
|
|
3
|
+
export type MenuItem = Required<MenuProps>['items'][number];
|
|
4
|
+
export declare function getItem(label: React.ReactNode, key: React.Key, icon?: React.ReactNode, children?: MenuItem[], type?: 'group'): MenuItem;
|
package/package.json
CHANGED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { Meta, Story } from "@storybook/react";
|
|
2
|
+
import { AnalyticsBar } from '.';
|
|
3
|
+
import { AnalyticsBarProps } from './interfaces/analyticsBar';
|
|
4
|
+
import { getItem } from './helpers/codeMutation';
|
|
5
|
+
import { useMemo, useState } from "react";
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: 'AnalyticsBar',
|
|
9
|
+
component: AnalyticsBar,
|
|
10
|
+
} as Meta;
|
|
11
|
+
|
|
12
|
+
const Template: Story<AnalyticsBarProps> = (args) => {
|
|
13
|
+
const [sortedBy, setSortedBy] = useState<any>('');
|
|
14
|
+
const [optionInUse, setOptionInUse] = useState<any>();
|
|
15
|
+
const [activeListItem, setActiveListItem] = useState<any>();
|
|
16
|
+
|
|
17
|
+
const data = [
|
|
18
|
+
{
|
|
19
|
+
"Label": "PeriodOfExperimentation",
|
|
20
|
+
"Items": [
|
|
21
|
+
{
|
|
22
|
+
"Id": "C446FFA9-329C-4AF3-A81A-080931C6B978",
|
|
23
|
+
"Name": "Name"
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"Label": "PeriodOfExperimentation",
|
|
29
|
+
"Items": [
|
|
30
|
+
{
|
|
31
|
+
"Id": "C446FFA9-329C-4AF3-A81A-080931C6B978",
|
|
32
|
+
"Name": "Name"
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"Label": "PeriodOfExperimentation",
|
|
38
|
+
"Items": [
|
|
39
|
+
{
|
|
40
|
+
"Id": "C446FFA9-329C-4AF3-A81A-080931C6B978",
|
|
41
|
+
"Name": "Name"
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"Label": "PeriodOfExperimentation",
|
|
47
|
+
"Items": [
|
|
48
|
+
{
|
|
49
|
+
"Id": "C446FFA9-329C-4AF3-A81A-080931C6B978",
|
|
50
|
+
"Name": "Name"
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"Label": "PeriodOfExperimentation",
|
|
56
|
+
"Items": [
|
|
57
|
+
{
|
|
58
|
+
"Id": "C446FFA9-329C-4AF3-A81A-080931C6B978",
|
|
59
|
+
"Name": "Name"
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"Label": "PeriodOfExperimentation",
|
|
65
|
+
"Items": [
|
|
66
|
+
{
|
|
67
|
+
"Id": "C446FFA9-329C-4AF3-A81A-080931C6B978",
|
|
68
|
+
"Name": "Name"
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"Label": "PeriodOfExperimentation",
|
|
74
|
+
"Items": [
|
|
75
|
+
{
|
|
76
|
+
"Id": "C446FFA9-329C-4AF3-A81A-080931C6B978",
|
|
77
|
+
"Name": "Name"
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"Label": "PeriodOfExperimentation",
|
|
83
|
+
"Items": [
|
|
84
|
+
{
|
|
85
|
+
"Id": "C446FFA9-329C-4AF3-A81A-080931C6B978",
|
|
86
|
+
"Name": "Name"
|
|
87
|
+
}
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"Label": "PeriodOfExperimentation",
|
|
92
|
+
"Items": [
|
|
93
|
+
{
|
|
94
|
+
"Id": "C446FFA9-329C-4AF3-A81A-080931C6B978",
|
|
95
|
+
"Name": "Name"
|
|
96
|
+
}
|
|
97
|
+
]
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"Label": "PeriodOfExperimentation",
|
|
101
|
+
"Items": [
|
|
102
|
+
{
|
|
103
|
+
"Id": "C446FFA9-329C-4AF3-A81A-080931C6B978",
|
|
104
|
+
"Name": "Name"
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"Label": "Permanent",
|
|
110
|
+
"Items": [
|
|
111
|
+
{
|
|
112
|
+
"Id": "A3FE0C73-E771-40BB-B87D-1E40597841A6",
|
|
113
|
+
"Name": "Evaluation Cycle"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"Id": "05A411CC-4350-4779-93C4-B8A511CBBCCD",
|
|
117
|
+
"Name": "Evaluation Cycle 2"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"Id": "D5A77A3B-1163-4590-9C98-2E6D62442F62",
|
|
121
|
+
"Name": "EV2"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"Id": "42A6EFDD-6D74-4905-94AE-5B5588967BE6",
|
|
125
|
+
"Name": "EV2"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"Id": "E39FE86D-6CE1-400A-8BA2-AE31A8E9D9BE",
|
|
129
|
+
"Name": "Suuuup"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"Id": "7FC59CF0-9478-4705-B1E0-C1B709FFB81B",
|
|
133
|
+
"Name": "CicloParaRespostas1"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"Id": "767DF403-C33D-4074-B7CA-FE3F4E4B41DD",
|
|
137
|
+
"Name": "XPTO"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"Id": "DB821A00-D516-467C-8F22-710EA18BFD23",
|
|
141
|
+
"Name": "EvaluationCycle for Notifications"
|
|
142
|
+
}
|
|
143
|
+
]
|
|
144
|
+
}
|
|
145
|
+
];
|
|
146
|
+
|
|
147
|
+
const selectOptions = [
|
|
148
|
+
{
|
|
149
|
+
value: 'ano',
|
|
150
|
+
label: 'ANO',
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
value: 'tipo_de_ciclo',
|
|
154
|
+
label: 'TIPO DE CICLO',
|
|
155
|
+
},
|
|
156
|
+
];
|
|
157
|
+
|
|
158
|
+
const items = useMemo(() => data.map((el: any, index: any) => {
|
|
159
|
+
return (
|
|
160
|
+
getItem(
|
|
161
|
+
el.Label,
|
|
162
|
+
index,
|
|
163
|
+
null,
|
|
164
|
+
el.Items?.map((item: any, subIndex: any) => {
|
|
165
|
+
return getItem(item.Name, item.Id);
|
|
166
|
+
})
|
|
167
|
+
)
|
|
168
|
+
)
|
|
169
|
+
}), [data]);
|
|
170
|
+
|
|
171
|
+
// console.log('stories:', sortedBy, optionInUse, activeListItem);
|
|
172
|
+
|
|
173
|
+
return <div style={{height: '500px'}}>
|
|
174
|
+
<AnalyticsBar {...args} data={items} selectOptions={selectOptions} selectDefault={selectOptions[0]} sortedBy={setSortedBy} selectUserOption={setOptionInUse} activeListItem={setActiveListItem}></AnalyticsBar>
|
|
175
|
+
</div>;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export const Primary = Template.bind({});
|
|
179
|
+
Primary.args = {
|
|
180
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { MenuProps } from 'antd';
|
|
2
|
+
|
|
3
|
+
export type MenuItem = Required<MenuProps>['items'][number];
|
|
4
|
+
|
|
5
|
+
export function getItem(
|
|
6
|
+
label: React.ReactNode,
|
|
7
|
+
key: React.Key,
|
|
8
|
+
icon?: React.ReactNode,
|
|
9
|
+
children?: MenuItem[],
|
|
10
|
+
type?: 'group',
|
|
11
|
+
): MenuItem {
|
|
12
|
+
return {
|
|
13
|
+
key,
|
|
14
|
+
icon,
|
|
15
|
+
children,
|
|
16
|
+
label,
|
|
17
|
+
type,
|
|
18
|
+
} as MenuItem;
|
|
19
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import styles from './styles.module.scss';
|
|
2
|
+
import { MinusOutlined, PlusOutlined, SortAscendingOutlined, SortDescendingOutlined } from '@ant-design/icons';
|
|
3
|
+
import { Select } from '../Select';
|
|
4
|
+
import type { MenuProps } from 'antd';
|
|
5
|
+
import { Menu } from 'antd';
|
|
6
|
+
import { AnalyticsBarProps, sortBy } from './interfaces/analyticsBar';
|
|
7
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
8
|
+
|
|
9
|
+
export const AnalyticsBar = (props: AnalyticsBarProps) => {
|
|
10
|
+
const {
|
|
11
|
+
data: items = [],
|
|
12
|
+
selectOptions,
|
|
13
|
+
selectDefault,
|
|
14
|
+
selectUserOption,
|
|
15
|
+
sortedBy,
|
|
16
|
+
activeListItem
|
|
17
|
+
} = props;
|
|
18
|
+
|
|
19
|
+
const [selectedKeys, setSelectedKeys] = useState<string[]>([]);
|
|
20
|
+
const [sortInfo, setSortInfo] = useState<any>(sortBy.desc);
|
|
21
|
+
|
|
22
|
+
const selectOnChange = useCallback((value: any) => {
|
|
23
|
+
selectUserOption(value);
|
|
24
|
+
}, [selectUserOption]);
|
|
25
|
+
|
|
26
|
+
const setSorter = useCallback(() => {
|
|
27
|
+
sortInfo === sortBy.desc
|
|
28
|
+
? setSortInfo(sortBy.asc)
|
|
29
|
+
: setSortInfo(sortBy.desc);
|
|
30
|
+
|
|
31
|
+
sortedBy(sortInfo);
|
|
32
|
+
}, [sortInfo]);
|
|
33
|
+
|
|
34
|
+
const onClick: MenuProps['onClick'] = (e: any) => {
|
|
35
|
+
const { key } = e;
|
|
36
|
+
if (selectedKeys.includes(key)) {
|
|
37
|
+
setSelectedKeys([]);
|
|
38
|
+
} else {
|
|
39
|
+
setSelectedKeys([key]);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
activeListItem(key);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
console.log(sortInfo);
|
|
46
|
+
return (
|
|
47
|
+
<div className={styles.analyticsbar}>
|
|
48
|
+
<div className={styles.header}>
|
|
49
|
+
<Select
|
|
50
|
+
options={selectOptions}
|
|
51
|
+
customClass={styles.select}
|
|
52
|
+
onChange={selectOnChange}
|
|
53
|
+
defaultActiveFirstOption
|
|
54
|
+
defaultValue={selectDefault}
|
|
55
|
+
/>
|
|
56
|
+
|
|
57
|
+
<div className={styles.sorterWrapper} onClick={() => setSorter()}>
|
|
58
|
+
{sortInfo === sortBy.desc
|
|
59
|
+
? <>Decrescente <SortDescendingOutlined /></>
|
|
60
|
+
: <>Crescente <SortAscendingOutlined /></>
|
|
61
|
+
}
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
|
|
65
|
+
<div className={styles.content}>
|
|
66
|
+
<Menu
|
|
67
|
+
selectedKeys={selectedKeys}
|
|
68
|
+
onClick={onClick}
|
|
69
|
+
mode="inline"
|
|
70
|
+
items={items}
|
|
71
|
+
expandIcon={({ isOpen }) => (isOpen ? <MinusOutlined /> : <PlusOutlined />)}
|
|
72
|
+
/>
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
);
|
|
76
|
+
};
|