@omniumretail/component-library 1.0.74 → 1.0.75
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/.storybook/main.js +16 -16
- package/.storybook/preview-head.html +20 -20
- package/.storybook/preview.js +27 -27
- package/NPMPUBLISH.md +29 -29
- package/README.md +54 -54
- package/bitbucket-pipelines.yml +94 -94
- package/dist/bundle.js +247 -291
- package/dist/types/components/AnalyticsBar/AnalyticsBar.stories.d.ts +5 -5
- package/dist/types/components/AnalyticsBar/helpers/codeMutation.d.ts +4 -4
- package/dist/types/components/AnalyticsBar/index.d.ts +2 -2
- package/dist/types/components/AnalyticsBar/interfaces/analyticsBar.d.ts +12 -12
- package/dist/types/components/Button/Button.stories.d.ts +6 -6
- package/dist/types/components/Button/index.d.ts +7 -7
- package/dist/types/components/Category/Category.stories.d.ts +4 -4
- package/dist/types/components/Category/CategoryContent/index.d.ts +7 -7
- package/dist/types/components/Category/CategorySidebar/index.d.ts +26 -26
- package/dist/types/components/Category/index.d.ts +7 -7
- package/dist/types/components/CategoryReadOnly/CategoryReadOnly.stories.d.ts +4 -4
- package/dist/types/components/CategoryReadOnly/evaluationOptions.d.ts +10 -10
- package/dist/types/components/CategoryReadOnly/index.d.ts +9 -9
- package/dist/types/components/CategoryResponse/CategoryResponse.stories.d.ts +4 -4
- package/dist/types/components/CategoryResponse/evaluationOptions.d.ts +10 -10
- package/dist/types/components/CategoryResponse/index.d.ts +9 -9
- package/dist/types/components/DatePicker/DatePicker.stories.d.ts +5 -5
- package/dist/types/components/DatePicker/index.d.ts +8 -8
- package/dist/types/components/DatePickerTag/DatePickerTag.stories.d.ts +5 -5
- package/dist/types/components/DatePickerTag/index.d.ts +6 -6
- package/dist/types/components/Footer/Footer.stories.d.ts +5 -5
- package/dist/types/components/Footer/index.d.ts +4 -4
- package/dist/types/components/Input/Input.stories.d.ts +5 -5
- package/dist/types/components/Input/index.d.ts +10 -10
- package/dist/types/components/InputCountryCode/index.d.ts +10 -10
- package/dist/types/components/InputCountryCode/inputCountryCode.stories.d.ts +5 -5
- package/dist/types/components/Label/Label.stories.d.ts +6 -6
- package/dist/types/components/Label/index.d.ts +7 -7
- package/dist/types/components/Link/Link.stories.d.ts +7 -7
- package/dist/types/components/Link/index.d.ts +7 -7
- package/dist/types/components/Menu/Menu.stories.d.ts +5 -5
- package/dist/types/components/Menu/helpers/codeMutation.d.ts +4 -4
- package/dist/types/components/Menu/index.d.ts +3 -2
- package/dist/types/components/ModalConfirmation/ModalConfirmation.stories.d.ts +5 -5
- package/dist/types/components/ModalConfirmation/ModalStatusList.d.ts +5 -5
- package/dist/types/components/ModalConfirmation/index.d.ts +9 -9
- package/dist/types/components/ModalWithTable/ModalWithTable.stories.d.ts +5 -5
- package/dist/types/components/ModalWithTable/index.d.ts +13 -13
- package/dist/types/components/Navigation/Navigation.stories.d.ts +5 -5
- package/dist/types/components/Navigation/index.d.ts +10 -10
- package/dist/types/components/Notification/Notification.stories.d.ts +5 -5
- package/dist/types/components/Notification/index.d.ts +9 -9
- package/dist/types/components/Questions/Questions.stories.d.ts +4 -4
- package/dist/types/components/Questions/SingleQuestion/index.d.ts +1 -1
- package/dist/types/components/Questions/index.d.ts +5 -5
- package/dist/types/components/Radio/Radio.stories.d.ts +5 -5
- package/dist/types/components/Radio/index.d.ts +10 -10
- package/dist/types/components/Select/Select.stories.d.ts +6 -6
- package/dist/types/components/Select/index.d.ts +5 -5
- package/dist/types/components/Separator/Separator.stories.d.ts +6 -6
- package/dist/types/components/Separator/index.d.ts +11 -11
- package/dist/types/components/Sidebar/Sidebar.stories.d.ts +6 -6
- package/dist/types/components/Sidebar/index.d.ts +15 -15
- package/dist/types/components/Switch/Switch.stories.d.ts +5 -5
- package/dist/types/components/Switch/index.d.ts +2 -2
- package/dist/types/components/Table/Table.stories.d.ts +9 -9
- package/dist/types/components/Table/index.d.ts +37 -37
- package/dist/types/components/Tag/Tag.stories.d.ts +5 -5
- package/dist/types/components/Tag/index.d.ts +8 -8
- package/dist/types/components/Upload/Upload.stories.d.ts +4 -4
- package/dist/types/components/Upload/index.d.ts +8 -8
- package/dist/types/components/UserInfo/UserInfo.stories.d.ts +4 -4
- package/dist/types/components/UserInfo/index.d.ts +8 -8
- package/dist/types/components/index.d.ts +25 -25
- package/dist/types/constants/i18n.d.ts +1 -1
- package/dist/types/constants/translationHelper.d.ts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/package.json +198 -198
- package/src/assets/scss/_global.scss +89 -89
- package/src/assets/scss/index.scss +2 -2
- package/src/components/AnalyticsBar/AnalyticsBar.stories.tsx +236 -236
- package/src/components/AnalyticsBar/helpers/codeMutation.tsx +19 -19
- package/src/components/AnalyticsBar/index.tsx +76 -76
- package/src/components/AnalyticsBar/interfaces/analyticsBar.tsx +13 -13
- package/src/components/AnalyticsBar/styles.module.scss +108 -108
- package/src/components/Button/Button.stories.tsx +26 -26
- package/src/components/Button/index.tsx +24 -24
- package/src/components/Button/styles.module.scss +65 -65
- package/src/components/Category/Category.stories.tsx +88 -88
- package/src/components/Category/CategoryContent/index.tsx +188 -188
- package/src/components/Category/CategoryContent/styles.module.scss +51 -51
- package/src/components/Category/CategorySidebar/index.tsx +268 -268
- package/src/components/Category/CategorySidebar/styles.module.scss +28 -28
- package/src/components/Category/index.tsx +76 -76
- package/src/components/Category/styles.module.scss +13 -13
- package/src/components/CategoryReadOnly/CategoryReadOnly.stories.tsx +270 -270
- package/src/components/CategoryReadOnly/evaluationOptions.tsx +81 -81
- package/src/components/CategoryReadOnly/index.tsx +254 -254
- package/src/components/CategoryReadOnly/styles.module.scss +184 -184
- package/src/components/CategoryResponse/CategoryResponse.stories.tsx +251 -251
- package/src/components/CategoryResponse/evaluationOptions.tsx +81 -81
- package/src/components/CategoryResponse/index.tsx +277 -277
- package/src/components/CategoryResponse/styles.module.scss +180 -180
- package/src/components/DatePicker/DatePicker.stories.tsx +16 -16
- package/src/components/DatePicker/index.tsx +38 -38
- package/src/components/DatePicker/styles.module.scss +3 -3
- package/src/components/DatePickerTag/DatePickerTag.stories.tsx +19 -19
- package/src/components/DatePickerTag/index.tsx +89 -89
- package/src/components/DatePickerTag/styles.module.scss +31 -31
- package/src/components/Footer/Footer.stories.tsx +14 -14
- package/src/components/Footer/index.tsx +38 -38
- package/src/components/Footer/styles.module.scss +38 -38
- package/src/components/Input/Input.stories.tsx +13 -13
- package/src/components/Input/index.tsx +31 -31
- package/src/components/Input/styles.module.scss +8 -8
- package/src/components/InputCountryCode/index.tsx +75 -75
- package/src/components/InputCountryCode/inputCountryCode.stories.tsx +55 -55
- package/src/components/InputCountryCode/styles.module.scss +3 -3
- package/src/components/Label/Label.stories.tsx +21 -21
- package/src/components/Label/index.tsx +19 -19
- package/src/components/Label/styles.module.scss +16 -16
- package/src/components/Link/Link.stories.tsx +30 -30
- package/src/components/Link/index.tsx +21 -21
- package/src/components/Link/styles.module.scss +24 -24
- package/src/components/Menu/Menu.stories.tsx +178 -178
- package/src/components/Menu/helpers/codeMutation.tsx +19 -19
- package/src/components/Menu/index.tsx +23 -23
- package/src/components/ModalConfirmation/ModalConfirmation.stories.tsx +40 -40
- package/src/components/ModalConfirmation/ModalStatusList.tsx +5 -5
- package/src/components/ModalConfirmation/index.tsx +70 -70
- package/src/components/ModalConfirmation/styles.module.scss +62 -62
- package/src/components/ModalWithTable/ModalWithTable.stories.tsx +96 -96
- package/src/components/ModalWithTable/index.tsx +232 -232
- package/src/components/ModalWithTable/styles.module.scss +77 -77
- package/src/components/Navigation/Navigation.stories.tsx +17 -17
- package/src/components/Navigation/index.tsx +33 -33
- package/src/components/Navigation/styles.module.scss +59 -59
- package/src/components/Notification/Notification.stories.tsx +29 -29
- package/src/components/Notification/index.tsx +21 -21
- package/src/components/Questions/Questions.stories.tsx +37 -37
- package/src/components/Questions/SingleQuestion/index.tsx +84 -84
- package/src/components/Questions/SingleQuestion/styles.module.scss +81 -81
- package/src/components/Questions/index.tsx +78 -78
- package/src/components/Radio/Radio.stories.tsx +43 -43
- package/src/components/Radio/index.tsx +26 -26
- package/src/components/Radio/styles.module.scss +23 -23
- package/src/components/Select/Select.stories.tsx +39 -39
- package/src/components/Select/index.tsx +27 -27
- package/src/components/Select/styles.module.scss +13 -13
- package/src/components/Separator/Separator.stories.tsx +22 -22
- package/src/components/Separator/index.tsx +27 -27
- package/src/components/Separator/styles.module.scss +25 -25
- package/src/components/Sidebar/Sidebar.stories.tsx +85 -85
- package/src/components/Sidebar/index.tsx +103 -103
- package/src/components/Sidebar/styles.module.scss +85 -85
- package/src/components/Switch/Switch.stories.tsx +14 -14
- package/src/components/Switch/index.tsx +8 -8
- package/src/components/Switch/styles.module.scss +7 -7
- package/src/components/Table/Table.stories.tsx +222 -222
- package/src/components/Table/index.tsx +279 -275
- package/src/components/Table/styles.module.scss +75 -75
- package/src/components/Tag/Tag.stories.tsx +22 -22
- package/src/components/Tag/index.tsx +189 -189
- package/src/components/Tag/styles.module.scss +60 -60
- package/src/components/Upload/Upload.stories.tsx +45 -45
- package/src/components/Upload/index.tsx +91 -91
- package/src/components/UserInfo/UserInfo.stories.tsx +37 -37
- package/src/components/UserInfo/index.tsx +62 -62
- package/src/components/UserInfo/styles.module.scss +29 -29
- package/src/components/index.tsx +25 -25
- package/src/constants/i18n.ts +25 -25
- package/src/constants/translationHelper.ts +7 -7
- package/src/index.ts +2 -2
- package/src/locales/en.json +86 -86
- package/src/locales/es.json +86 -86
- package/src/locales/pt.json +86 -86
- package/src/types/Global.d.ts +4 -4
- package/tsconfig.json +29 -29
- package/webpack.config.js +51 -51
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
.sidebar {
|
|
2
|
-
width: 300px;
|
|
3
|
-
max-width: 300px;
|
|
4
|
-
height: 100%;
|
|
5
|
-
background-color: var(--color-white);
|
|
6
|
-
padding: 24px;
|
|
7
|
-
position: relative;
|
|
8
|
-
transition: var(--transition-fast);
|
|
9
|
-
overflow: hidden;
|
|
10
|
-
|
|
11
|
-
&.sidebarClosed {
|
|
12
|
-
max-width: 100px;
|
|
13
|
-
width: 100px;
|
|
14
|
-
overflow: hidden;
|
|
15
|
-
|
|
16
|
-
.sidebarItem {
|
|
17
|
-
font-size: 0;
|
|
18
|
-
transition: 0;
|
|
19
|
-
padding-left: 42px;
|
|
20
|
-
|
|
21
|
-
&:first-letter {
|
|
22
|
-
font-size: var(--font-size-body-4);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.sidebarHasIcon {
|
|
27
|
-
font-size: 24px;
|
|
28
|
-
padding-left: 35px;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.sidebarItem {
|
|
34
|
-
color: var(--color-black);
|
|
35
|
-
padding: 16px;
|
|
36
|
-
font-weight: var(--font-weight-semibold);
|
|
37
|
-
text-transform: uppercase;
|
|
38
|
-
position: relative;
|
|
39
|
-
white-space: nowrap;
|
|
40
|
-
cursor: pointer;
|
|
41
|
-
|
|
42
|
-
&:after {
|
|
43
|
-
content: '';
|
|
44
|
-
position: absolute;
|
|
45
|
-
bottom: 0;
|
|
46
|
-
left: 0;
|
|
47
|
-
height: 1px;
|
|
48
|
-
width: 100%;
|
|
49
|
-
background-color: var(--color-orange);
|
|
50
|
-
transform: scaleY(.5);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.sidebarItemActive {
|
|
55
|
-
color: var(--color-orange) !important;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.toggle {
|
|
59
|
-
position: absolute;
|
|
60
|
-
top: 12px;
|
|
61
|
-
right: 24px;
|
|
62
|
-
width: 24px;
|
|
63
|
-
height: 24px;
|
|
64
|
-
display: flex;
|
|
65
|
-
align-items: center;
|
|
66
|
-
justify-content: center;
|
|
67
|
-
z-index: 1;
|
|
68
|
-
cursor: pointer;
|
|
69
|
-
|
|
70
|
-
> * {
|
|
71
|
-
font-size: var(--font-size-body-5);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
.subMenu {
|
|
76
|
-
margin-top: 8px;
|
|
77
|
-
padding-left: 16px;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.subMenuItem {
|
|
81
|
-
color: var(--color-black);
|
|
82
|
-
padding: 8px;
|
|
83
|
-
margin-top: 8px;
|
|
84
|
-
font-weight: var(--font-weight-semibold);
|
|
85
|
-
cursor: pointer;
|
|
1
|
+
.sidebar {
|
|
2
|
+
width: 300px;
|
|
3
|
+
max-width: 300px;
|
|
4
|
+
height: 100%;
|
|
5
|
+
background-color: var(--color-white);
|
|
6
|
+
padding: 24px;
|
|
7
|
+
position: relative;
|
|
8
|
+
transition: var(--transition-fast);
|
|
9
|
+
overflow: hidden;
|
|
10
|
+
|
|
11
|
+
&.sidebarClosed {
|
|
12
|
+
max-width: 100px;
|
|
13
|
+
width: 100px;
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
|
|
16
|
+
.sidebarItem {
|
|
17
|
+
font-size: 0;
|
|
18
|
+
transition: 0;
|
|
19
|
+
padding-left: 42px;
|
|
20
|
+
|
|
21
|
+
&:first-letter {
|
|
22
|
+
font-size: var(--font-size-body-4);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.sidebarHasIcon {
|
|
27
|
+
font-size: 24px;
|
|
28
|
+
padding-left: 35px;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.sidebarItem {
|
|
34
|
+
color: var(--color-black);
|
|
35
|
+
padding: 16px;
|
|
36
|
+
font-weight: var(--font-weight-semibold);
|
|
37
|
+
text-transform: uppercase;
|
|
38
|
+
position: relative;
|
|
39
|
+
white-space: nowrap;
|
|
40
|
+
cursor: pointer;
|
|
41
|
+
|
|
42
|
+
&:after {
|
|
43
|
+
content: '';
|
|
44
|
+
position: absolute;
|
|
45
|
+
bottom: 0;
|
|
46
|
+
left: 0;
|
|
47
|
+
height: 1px;
|
|
48
|
+
width: 100%;
|
|
49
|
+
background-color: var(--color-orange);
|
|
50
|
+
transform: scaleY(.5);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.sidebarItemActive {
|
|
55
|
+
color: var(--color-orange) !important;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.toggle {
|
|
59
|
+
position: absolute;
|
|
60
|
+
top: 12px;
|
|
61
|
+
right: 24px;
|
|
62
|
+
width: 24px;
|
|
63
|
+
height: 24px;
|
|
64
|
+
display: flex;
|
|
65
|
+
align-items: center;
|
|
66
|
+
justify-content: center;
|
|
67
|
+
z-index: 1;
|
|
68
|
+
cursor: pointer;
|
|
69
|
+
|
|
70
|
+
> * {
|
|
71
|
+
font-size: var(--font-size-body-5);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.subMenu {
|
|
76
|
+
margin-top: 8px;
|
|
77
|
+
padding-left: 16px;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.subMenuItem {
|
|
81
|
+
color: var(--color-black);
|
|
82
|
+
padding: 8px;
|
|
83
|
+
margin-top: 8px;
|
|
84
|
+
font-weight: var(--font-weight-semibold);
|
|
85
|
+
cursor: pointer;
|
|
86
86
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { Meta, Story } from "@storybook/react";
|
|
2
|
-
import { Switch } from '.';
|
|
3
|
-
import { SwitchProps } from 'antd';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
title: 'Switch',
|
|
7
|
-
component: Switch,
|
|
8
|
-
} as Meta;
|
|
9
|
-
|
|
10
|
-
const Template: Story<SwitchProps> = (args) => <Switch {...args}></Switch>;
|
|
11
|
-
|
|
12
|
-
export const Primary = Template.bind({});
|
|
13
|
-
Primary.args = {
|
|
14
|
-
};
|
|
1
|
+
import { Meta, Story } from "@storybook/react";
|
|
2
|
+
import { Switch } from '.';
|
|
3
|
+
import { SwitchProps } from 'antd';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Switch',
|
|
7
|
+
component: Switch,
|
|
8
|
+
} as Meta;
|
|
9
|
+
|
|
10
|
+
const Template: Story<SwitchProps> = (args) => <Switch {...args}></Switch>;
|
|
11
|
+
|
|
12
|
+
export const Primary = Template.bind({});
|
|
13
|
+
Primary.args = {
|
|
14
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Switch as AntdSwitch, SwitchProps } from 'antd';
|
|
2
|
-
import styles from './styles.module.scss';
|
|
3
|
-
|
|
4
|
-
export const Switch = ({...props}: SwitchProps) => {
|
|
5
|
-
return (
|
|
6
|
-
<AntdSwitch { ...props } className={styles.switch}/>
|
|
7
|
-
);
|
|
8
|
-
};
|
|
1
|
+
import { Switch as AntdSwitch, SwitchProps } from 'antd';
|
|
2
|
+
import styles from './styles.module.scss';
|
|
3
|
+
|
|
4
|
+
export const Switch = ({...props}: SwitchProps) => {
|
|
5
|
+
return (
|
|
6
|
+
<AntdSwitch { ...props } className={styles.switch}/>
|
|
7
|
+
);
|
|
8
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
.switch {
|
|
2
|
-
background-color: var(--color-grey) !important;
|
|
3
|
-
|
|
4
|
-
&[aria-checked="true"] {
|
|
5
|
-
background: var(--color-orange) !important;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
1
|
+
.switch {
|
|
2
|
+
background-color: var(--color-grey) !important;
|
|
3
|
+
|
|
4
|
+
&[aria-checked="true"] {
|
|
5
|
+
background: var(--color-orange) !important;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
@@ -1,222 +1,222 @@
|
|
|
1
|
-
import { Meta, Story } from "@storybook/react";
|
|
2
|
-
import { Table, TableCustomProps } from '.';
|
|
3
|
-
import { useState } from "react";
|
|
4
|
-
import { useTranslation } from "react-i18next";
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
title: 'Table',
|
|
8
|
-
component: Table,
|
|
9
|
-
} as Meta;
|
|
10
|
-
|
|
11
|
-
const Template: Story<TableCustomProps> = (args) => {
|
|
12
|
-
const { t } = useTranslation();
|
|
13
|
-
const [pageInfo, setPageInfo] = useState<any>({});
|
|
14
|
-
const [rowSelectionInfo, setRowSelectionInfo] = useState<any>({});
|
|
15
|
-
const [sortBy, setSortBy] = useState<string[]>(['id', 'desc']);
|
|
16
|
-
|
|
17
|
-
const handleSortByColumnChange = (sortState: any) => {
|
|
18
|
-
console.log('handleSortChange called with:', sortState);
|
|
19
|
-
// Do something with the new sort state
|
|
20
|
-
// For example, trigger an API call
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
return <Table columnsSortChange={handleSortByColumnChange} paginationInfo={setPageInfo} headingTranslationsKey={'tableHeadings'} rowSelectionInfo={setRowSelectionInfo} actionsArray={
|
|
24
|
-
[
|
|
25
|
-
{ key: '1', label: `${t('actions.one')}`, onClick: () => {
|
|
26
|
-
console.log('onClick');
|
|
27
|
-
} },
|
|
28
|
-
{ key: '2', label: `${t('actions.two')}` },
|
|
29
|
-
{
|
|
30
|
-
key: '3', label: 'label 3'
|
|
31
|
-
}
|
|
32
|
-
]
|
|
33
|
-
} {...args}></Table>;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export const Primary = Template.bind({});
|
|
37
|
-
Primary.args = {
|
|
38
|
-
selectPlaceholder: 'Order by',
|
|
39
|
-
rowKeyValue: 'mecanographicNumber',
|
|
40
|
-
dataSource: [
|
|
41
|
-
{
|
|
42
|
-
id: `1`,
|
|
43
|
-
name: `João Cachulo`,
|
|
44
|
-
mecanographicNumber: "232",
|
|
45
|
-
store: `Levi's Sta Catarina`,
|
|
46
|
-
role: `Gerente`,
|
|
47
|
-
type: `Efetivo`
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
id: `2`,
|
|
51
|
-
name: `Filipe Martins`,
|
|
52
|
-
mecanographicNumber: "32",
|
|
53
|
-
store: `Levi's Sta Catarina`,
|
|
54
|
-
role: `Comercial`,
|
|
55
|
-
type: `Efetivo`
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
id: `3`,
|
|
59
|
-
name: `Anna Astori`,
|
|
60
|
-
mecanographicNumber: "3212",
|
|
61
|
-
store: `Levi's Sta Catarina`,
|
|
62
|
-
role: `Funcionário`,
|
|
63
|
-
type: `Efetivo`
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
id: `4`,
|
|
67
|
-
name: `Yield Ona`,
|
|
68
|
-
mecanographicNumber: "21232",
|
|
69
|
-
store: `Adidas Restaurantes`,
|
|
70
|
-
role: `Gerente`,
|
|
71
|
-
type: `Efetivo`
|
|
72
|
-
},
|
|
73
|
-
],
|
|
74
|
-
pagination: {
|
|
75
|
-
total: 24,
|
|
76
|
-
pageSize: 4
|
|
77
|
-
},
|
|
78
|
-
hiddenColumns: ['id'],
|
|
79
|
-
sortByColumns: true,
|
|
80
|
-
columnsToSort: ["name", "mecanographicNumber"]
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
export const Secondary = Template.bind({});
|
|
84
|
-
Secondary.args = {
|
|
85
|
-
dataSource: [
|
|
86
|
-
{
|
|
87
|
-
key: `1`,
|
|
88
|
-
name: `as John Brown`,
|
|
89
|
-
mecanographicNumber: 232,
|
|
90
|
-
store: `Levi's Sta Catarina`,
|
|
91
|
-
role: `Gerente`,
|
|
92
|
-
type: `Efetivo`
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
key: `2`,
|
|
96
|
-
name: `bv Mary Brown`,
|
|
97
|
-
mecanographicNumber: 32,
|
|
98
|
-
store: `Levi's Sta Catarina`,
|
|
99
|
-
role: `Comercial`,
|
|
100
|
-
type: `Efetivo`
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
key: `3`,
|
|
104
|
-
name: `as Anna Astori`,
|
|
105
|
-
mecanographicNumber: 3212,
|
|
106
|
-
store: `Levi's Sta Catarina`,
|
|
107
|
-
role: `Funcionário`,
|
|
108
|
-
type: `Efetivo`
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
key: `4`,
|
|
112
|
-
name: `bv Yield Ona`,
|
|
113
|
-
mecanographicNumber: 21232,
|
|
114
|
-
store: `Adidas Restaurantes`,
|
|
115
|
-
role: `Gerente`,
|
|
116
|
-
type: `Efetivo`
|
|
117
|
-
},
|
|
118
|
-
],
|
|
119
|
-
pagination: {
|
|
120
|
-
total: 4,
|
|
121
|
-
pageSize: 10
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
export const WithCheckbox = Template.bind({});
|
|
126
|
-
WithCheckbox.args = {
|
|
127
|
-
dataSource: [
|
|
128
|
-
{
|
|
129
|
-
key: `1`,
|
|
130
|
-
name: `John Brown`,
|
|
131
|
-
mecanographicNumber: 232,
|
|
132
|
-
store: `Levi's Sta Catarina`,
|
|
133
|
-
role: `Gerente`,
|
|
134
|
-
type: `Efetivo`
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
key: `2`,
|
|
138
|
-
name: `Mary Brown`,
|
|
139
|
-
mecanographicNumber: 32,
|
|
140
|
-
store: `Levi's Sta Catarina`,
|
|
141
|
-
role: `Comercial`,
|
|
142
|
-
type: `Efetivo`
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
key: `3`,
|
|
146
|
-
name: `Anna Astori`,
|
|
147
|
-
mecanographicNumber: 3212,
|
|
148
|
-
store: `Levi's Sta Catarina`,
|
|
149
|
-
role: `Funcionário`,
|
|
150
|
-
type: `Efetivo`
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
key: `4`,
|
|
154
|
-
name: `Yield Ona`,
|
|
155
|
-
mecanographicNumber: 21232,
|
|
156
|
-
store: `Adidas Restaurantes`,
|
|
157
|
-
role: `Gerente`,
|
|
158
|
-
type: `Efetivo`
|
|
159
|
-
},
|
|
160
|
-
],
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
export const withActions = Template.bind({});
|
|
164
|
-
withActions.args = {
|
|
165
|
-
fieldsToSort: ['store', 'mecanographicNumber'],
|
|
166
|
-
selectPlaceholder: 'Order by',
|
|
167
|
-
dataSource: [
|
|
168
|
-
{
|
|
169
|
-
key: `1`,
|
|
170
|
-
name: `John Brown`,
|
|
171
|
-
mecanographicNumber: "232",
|
|
172
|
-
store: `Levi's Sta Catarina`,
|
|
173
|
-
role: `Gerente`,
|
|
174
|
-
type: `Efetivo`
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
key: `2`,
|
|
178
|
-
name: `Mary Brown`,
|
|
179
|
-
mecanographicNumber: "32",
|
|
180
|
-
store: `Levi's Sta Catarina`,
|
|
181
|
-
role: `Comercial`,
|
|
182
|
-
type: `Efetivo`
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
key: `3`,
|
|
186
|
-
name: `Anna Astori`,
|
|
187
|
-
mecanographicNumber: "3212",
|
|
188
|
-
store: `Levi's Sta Catarina`,
|
|
189
|
-
role: `Funcionário`,
|
|
190
|
-
type: `Efetivo`
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
key: `4`,
|
|
194
|
-
name: `Yield Ona`,
|
|
195
|
-
mecanographicNumber: "21232",
|
|
196
|
-
store: `Adidas Restaurantes`,
|
|
197
|
-
role: `Gerente`,
|
|
198
|
-
type: `Efetivo`
|
|
199
|
-
},
|
|
200
|
-
],
|
|
201
|
-
pagination: {
|
|
202
|
-
total: 24,
|
|
203
|
-
pageSize: 4
|
|
204
|
-
},
|
|
205
|
-
rowSelection: {
|
|
206
|
-
type: 'checkbox',
|
|
207
|
-
selectedRowKeys: ['1']
|
|
208
|
-
}
|
|
209
|
-
};
|
|
210
|
-
|
|
211
|
-
export const NoData = Template.bind({});
|
|
212
|
-
NoData.args = {
|
|
213
|
-
fieldsToSort: ['store', 'mecanographicNumber'],
|
|
214
|
-
selectPlaceholder: 'Order by',
|
|
215
|
-
rowKeyValue: 'mecanographicNumber',
|
|
216
|
-
dataSource: undefined,
|
|
217
|
-
pagination: {
|
|
218
|
-
total: 24,
|
|
219
|
-
pageSize: 4
|
|
220
|
-
},
|
|
221
|
-
hiddenColumns: ['id']
|
|
222
|
-
};
|
|
1
|
+
import { Meta, Story } from "@storybook/react";
|
|
2
|
+
import { Table, TableCustomProps } from '.';
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { useTranslation } from "react-i18next";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Table',
|
|
8
|
+
component: Table,
|
|
9
|
+
} as Meta;
|
|
10
|
+
|
|
11
|
+
const Template: Story<TableCustomProps> = (args) => {
|
|
12
|
+
const { t } = useTranslation();
|
|
13
|
+
const [pageInfo, setPageInfo] = useState<any>({});
|
|
14
|
+
const [rowSelectionInfo, setRowSelectionInfo] = useState<any>({});
|
|
15
|
+
const [sortBy, setSortBy] = useState<string[]>(['id', 'desc']);
|
|
16
|
+
|
|
17
|
+
const handleSortByColumnChange = (sortState: any) => {
|
|
18
|
+
console.log('handleSortChange called with:', sortState);
|
|
19
|
+
// Do something with the new sort state
|
|
20
|
+
// For example, trigger an API call
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
return <Table columnsSortChange={handleSortByColumnChange} paginationInfo={setPageInfo} headingTranslationsKey={'tableHeadings'} rowSelectionInfo={setRowSelectionInfo} actionsArray={
|
|
24
|
+
[
|
|
25
|
+
{ key: '1', label: `${t('actions.one')}`, onClick: () => {
|
|
26
|
+
console.log('onClick');
|
|
27
|
+
} },
|
|
28
|
+
{ key: '2', label: `${t('actions.two')}` },
|
|
29
|
+
{
|
|
30
|
+
key: '3', label: 'label 3'
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
} {...args}></Table>;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const Primary = Template.bind({});
|
|
37
|
+
Primary.args = {
|
|
38
|
+
selectPlaceholder: 'Order by',
|
|
39
|
+
rowKeyValue: 'mecanographicNumber',
|
|
40
|
+
dataSource: [
|
|
41
|
+
{
|
|
42
|
+
id: `1`,
|
|
43
|
+
name: `João Cachulo`,
|
|
44
|
+
mecanographicNumber: "232",
|
|
45
|
+
store: `Levi's Sta Catarina`,
|
|
46
|
+
role: `Gerente`,
|
|
47
|
+
type: `Efetivo`
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
id: `2`,
|
|
51
|
+
name: `Filipe Martins`,
|
|
52
|
+
mecanographicNumber: "32",
|
|
53
|
+
store: `Levi's Sta Catarina`,
|
|
54
|
+
role: `Comercial`,
|
|
55
|
+
type: `Efetivo`
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
id: `3`,
|
|
59
|
+
name: `Anna Astori`,
|
|
60
|
+
mecanographicNumber: "3212",
|
|
61
|
+
store: `Levi's Sta Catarina`,
|
|
62
|
+
role: `Funcionário`,
|
|
63
|
+
type: `Efetivo`
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
id: `4`,
|
|
67
|
+
name: `Yield Ona`,
|
|
68
|
+
mecanographicNumber: "21232",
|
|
69
|
+
store: `Adidas Restaurantes`,
|
|
70
|
+
role: `Gerente`,
|
|
71
|
+
type: `Efetivo`
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
pagination: {
|
|
75
|
+
total: 24,
|
|
76
|
+
pageSize: 4
|
|
77
|
+
},
|
|
78
|
+
hiddenColumns: ['id'],
|
|
79
|
+
sortByColumns: true,
|
|
80
|
+
columnsToSort: ["name", "mecanographicNumber"]
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export const Secondary = Template.bind({});
|
|
84
|
+
Secondary.args = {
|
|
85
|
+
dataSource: [
|
|
86
|
+
{
|
|
87
|
+
key: `1`,
|
|
88
|
+
name: `as John Brown`,
|
|
89
|
+
mecanographicNumber: 232,
|
|
90
|
+
store: `Levi's Sta Catarina`,
|
|
91
|
+
role: `Gerente`,
|
|
92
|
+
type: `Efetivo`
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
key: `2`,
|
|
96
|
+
name: `bv Mary Brown`,
|
|
97
|
+
mecanographicNumber: 32,
|
|
98
|
+
store: `Levi's Sta Catarina`,
|
|
99
|
+
role: `Comercial`,
|
|
100
|
+
type: `Efetivo`
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
key: `3`,
|
|
104
|
+
name: `as Anna Astori`,
|
|
105
|
+
mecanographicNumber: 3212,
|
|
106
|
+
store: `Levi's Sta Catarina`,
|
|
107
|
+
role: `Funcionário`,
|
|
108
|
+
type: `Efetivo`
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
key: `4`,
|
|
112
|
+
name: `bv Yield Ona`,
|
|
113
|
+
mecanographicNumber: 21232,
|
|
114
|
+
store: `Adidas Restaurantes`,
|
|
115
|
+
role: `Gerente`,
|
|
116
|
+
type: `Efetivo`
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
pagination: {
|
|
120
|
+
total: 4,
|
|
121
|
+
pageSize: 10
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export const WithCheckbox = Template.bind({});
|
|
126
|
+
WithCheckbox.args = {
|
|
127
|
+
dataSource: [
|
|
128
|
+
{
|
|
129
|
+
key: `1`,
|
|
130
|
+
name: `John Brown`,
|
|
131
|
+
mecanographicNumber: 232,
|
|
132
|
+
store: `Levi's Sta Catarina`,
|
|
133
|
+
role: `Gerente`,
|
|
134
|
+
type: `Efetivo`
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
key: `2`,
|
|
138
|
+
name: `Mary Brown`,
|
|
139
|
+
mecanographicNumber: 32,
|
|
140
|
+
store: `Levi's Sta Catarina`,
|
|
141
|
+
role: `Comercial`,
|
|
142
|
+
type: `Efetivo`
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
key: `3`,
|
|
146
|
+
name: `Anna Astori`,
|
|
147
|
+
mecanographicNumber: 3212,
|
|
148
|
+
store: `Levi's Sta Catarina`,
|
|
149
|
+
role: `Funcionário`,
|
|
150
|
+
type: `Efetivo`
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
key: `4`,
|
|
154
|
+
name: `Yield Ona`,
|
|
155
|
+
mecanographicNumber: 21232,
|
|
156
|
+
store: `Adidas Restaurantes`,
|
|
157
|
+
role: `Gerente`,
|
|
158
|
+
type: `Efetivo`
|
|
159
|
+
},
|
|
160
|
+
],
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
export const withActions = Template.bind({});
|
|
164
|
+
withActions.args = {
|
|
165
|
+
fieldsToSort: ['store', 'mecanographicNumber'],
|
|
166
|
+
selectPlaceholder: 'Order by',
|
|
167
|
+
dataSource: [
|
|
168
|
+
{
|
|
169
|
+
key: `1`,
|
|
170
|
+
name: `John Brown`,
|
|
171
|
+
mecanographicNumber: "232",
|
|
172
|
+
store: `Levi's Sta Catarina`,
|
|
173
|
+
role: `Gerente`,
|
|
174
|
+
type: `Efetivo`
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
key: `2`,
|
|
178
|
+
name: `Mary Brown`,
|
|
179
|
+
mecanographicNumber: "32",
|
|
180
|
+
store: `Levi's Sta Catarina`,
|
|
181
|
+
role: `Comercial`,
|
|
182
|
+
type: `Efetivo`
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
key: `3`,
|
|
186
|
+
name: `Anna Astori`,
|
|
187
|
+
mecanographicNumber: "3212",
|
|
188
|
+
store: `Levi's Sta Catarina`,
|
|
189
|
+
role: `Funcionário`,
|
|
190
|
+
type: `Efetivo`
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
key: `4`,
|
|
194
|
+
name: `Yield Ona`,
|
|
195
|
+
mecanographicNumber: "21232",
|
|
196
|
+
store: `Adidas Restaurantes`,
|
|
197
|
+
role: `Gerente`,
|
|
198
|
+
type: `Efetivo`
|
|
199
|
+
},
|
|
200
|
+
],
|
|
201
|
+
pagination: {
|
|
202
|
+
total: 24,
|
|
203
|
+
pageSize: 4
|
|
204
|
+
},
|
|
205
|
+
rowSelection: {
|
|
206
|
+
type: 'checkbox',
|
|
207
|
+
selectedRowKeys: ['1']
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
export const NoData = Template.bind({});
|
|
212
|
+
NoData.args = {
|
|
213
|
+
fieldsToSort: ['store', 'mecanographicNumber'],
|
|
214
|
+
selectPlaceholder: 'Order by',
|
|
215
|
+
rowKeyValue: 'mecanographicNumber',
|
|
216
|
+
dataSource: undefined,
|
|
217
|
+
pagination: {
|
|
218
|
+
total: 24,
|
|
219
|
+
pageSize: 4
|
|
220
|
+
},
|
|
221
|
+
hiddenColumns: ['id']
|
|
222
|
+
};
|