@omniumretail/component-library 1.2.54 → 1.2.56
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 +1 -1
- package/dist/types/components/ResponsiveTable/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/assets/scss/a2ai.scss +89 -0
- package/src/assets/scss/index.scss +1 -0
- package/src/components/ResponsiveTable/ResponsiveTable.stories.tsx +16 -6
- package/src/components/ResponsiveTable/index.tsx +5 -3
|
@@ -48,6 +48,6 @@ export interface ResponsiveTableCustomProps extends TableProps<any> {
|
|
|
48
48
|
cleanRowSelection?: boolean;
|
|
49
49
|
getRowActions?: (record: any) => any;
|
|
50
50
|
customSelectAllButton?: string;
|
|
51
|
-
buttonActionIcon?: any;
|
|
51
|
+
buttonActionIcon?: (record: any) => any | null;
|
|
52
52
|
}
|
|
53
53
|
export declare const ResponsiveTable: (props: ResponsiveTableCustomProps) => import("react/jsx-runtime").JSX.Element;
|
package/package.json
CHANGED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
body.a2aiStyle {
|
|
2
|
+
// Primary Colors
|
|
3
|
+
--color-black: #2c2d2e;
|
|
4
|
+
--color-black-rgb: 44, 45, 46;
|
|
5
|
+
--color-white: #FFFFFF;
|
|
6
|
+
--color-white-rgb: 255, 255, 255;
|
|
7
|
+
|
|
8
|
+
--color-orange: purple;
|
|
9
|
+
--color-orange-rgb: 255, 103, 76;
|
|
10
|
+
|
|
11
|
+
--color-blue: #09168B;
|
|
12
|
+
--color-blue-rgb: 9, 22, 139;
|
|
13
|
+
|
|
14
|
+
--color-grey-light: #f0f0f0;
|
|
15
|
+
--color-grey-light-rgb: 240, 240, 240;
|
|
16
|
+
--color-grey: #C7CAC9;
|
|
17
|
+
--color-grey-rgb: 199, 202, 201;
|
|
18
|
+
--color-grey-dark: #797979;
|
|
19
|
+
--color-grey-dark-rgb: 121, 121, 121;
|
|
20
|
+
|
|
21
|
+
// Helper Colors
|
|
22
|
+
--color-warning-400: #E36262;
|
|
23
|
+
--color-warning-500: #E05151;
|
|
24
|
+
|
|
25
|
+
--color-confirmation-400: #73b9a2;
|
|
26
|
+
--color-confirmation-600: #64B298;
|
|
27
|
+
|
|
28
|
+
// Font Family
|
|
29
|
+
--font-family-primary: SF Pro;
|
|
30
|
+
|
|
31
|
+
// Font Weight
|
|
32
|
+
--font-weight-light: 300;
|
|
33
|
+
--font-weight-regular: 400;
|
|
34
|
+
--font-weight-medium: 500;
|
|
35
|
+
--font-weight-semibold: 600;
|
|
36
|
+
--font-weight-bold: 700;
|
|
37
|
+
|
|
38
|
+
// Font Styles
|
|
39
|
+
--font-style-normal: normal;
|
|
40
|
+
--font-style-italic: italic;
|
|
41
|
+
|
|
42
|
+
// Font Sizes
|
|
43
|
+
--font-size-body-1: 10px;
|
|
44
|
+
--font-size-body-2: 12px;
|
|
45
|
+
--font-size-body-3: 14px;
|
|
46
|
+
--font-size-body-4: 16px;
|
|
47
|
+
--font-size-body-5: 18px;
|
|
48
|
+
--font-size-body-6: 20px;
|
|
49
|
+
|
|
50
|
+
--font-size-h1: 46px;
|
|
51
|
+
--font-size-h2: 40px;
|
|
52
|
+
--font-size-h3: 36px;
|
|
53
|
+
--font-size-h4: 30px;
|
|
54
|
+
--font-size-h5: 24px;
|
|
55
|
+
|
|
56
|
+
--font-size-body-base: var(--font-size-body-4);
|
|
57
|
+
--font-size-label: var(--font-size-body-3);
|
|
58
|
+
|
|
59
|
+
// Button Default
|
|
60
|
+
--button-default-background: var(--color-orange);
|
|
61
|
+
--button-default-text-color: var(--color-white);
|
|
62
|
+
--button-default-background-hover-color: rgba(var(--color-orange-rgb), .9);
|
|
63
|
+
--button-default-text-hover-color: var(--color-white);
|
|
64
|
+
--button-default-background-focus-color: var(--color-grey-dark);
|
|
65
|
+
--button-default-text-focus-color: rgba(var(--color-white-rgb), .8);
|
|
66
|
+
|
|
67
|
+
// Button Style 1
|
|
68
|
+
--button-style-1-background: var(--color-black);
|
|
69
|
+
--button-style-1-text-color: var(--color-white);
|
|
70
|
+
--button-style-1-background-hover-color: rgba(var(--color-black-rgb), .9);
|
|
71
|
+
--button-style-1-text-hover-color: var(--color-white);
|
|
72
|
+
--button-style-1-background-focus-color: var(--color-grey-dark);
|
|
73
|
+
--button-style-1-text-focus-color: rgba(var(--color-white-rgb), .8);
|
|
74
|
+
|
|
75
|
+
// Button Disabled
|
|
76
|
+
--button-disabled-background-color: rgba(var(--color-grey));
|
|
77
|
+
--button-disabled-default-text-color: var(--color-white);
|
|
78
|
+
|
|
79
|
+
// Link
|
|
80
|
+
--link-color: var(--color-orange);
|
|
81
|
+
--link-hover-color: var(--color-black);
|
|
82
|
+
--link-focus-color: rgba(var(--color-orange), .9);
|
|
83
|
+
--link-disabled-color: rgba(var(--color-grey), .2);
|
|
84
|
+
|
|
85
|
+
// Transition Speed
|
|
86
|
+
--transition-fast: .2s;
|
|
87
|
+
--transition: .6s;
|
|
88
|
+
--transition-slow: 1s;
|
|
89
|
+
}
|
|
@@ -2,6 +2,7 @@ import { Meta, Story } from "@storybook/react";
|
|
|
2
2
|
import { ResponsiveTable, ResponsiveTableCustomProps } from '.';
|
|
3
3
|
import { useState } from "react";
|
|
4
4
|
import { useTranslation } from "react-i18next";
|
|
5
|
+
import { DownloadOutlined } from "@ant-design/icons";
|
|
5
6
|
|
|
6
7
|
export default {
|
|
7
8
|
title: 'ResponsiveTable',
|
|
@@ -23,10 +24,10 @@ const Template: Story<ResponsiveTableCustomProps> = (args) => {
|
|
|
23
24
|
|
|
24
25
|
const getButtonLabel = (record: any) => {
|
|
25
26
|
return (record as any)?.type === "Efetivo" ? "Pog" : null;
|
|
26
|
-
};
|
|
27
|
+
};
|
|
27
28
|
|
|
28
|
-
const getActionsForRecord = (record: any) => {
|
|
29
|
-
|
|
29
|
+
const getActionsForRecord = (record: any) => {
|
|
30
|
+
return (record as any)?.role === "Gerente"
|
|
30
31
|
? [
|
|
31
32
|
{
|
|
32
33
|
key: '1', label: `${t('actions.one')}`, onClick: () => {
|
|
@@ -52,14 +53,23 @@ const getActionsForRecord = (record: any) => {
|
|
|
52
53
|
key: '4', label: 'label 4'
|
|
53
54
|
}
|
|
54
55
|
];
|
|
55
|
-
};
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const getIcon = (record: any) => {
|
|
59
|
+
return record.id === "1"
|
|
60
|
+
? <DownloadOutlined />
|
|
61
|
+
: record.id === "3"
|
|
62
|
+
? <DownloadOutlined />
|
|
63
|
+
: null;
|
|
64
|
+
};
|
|
56
65
|
|
|
66
|
+
const actionsArray = [{ key: '1', label: `` }];
|
|
57
67
|
|
|
58
68
|
return <ResponsiveTable
|
|
59
69
|
cleanRowSelection={clearRowSelection}
|
|
60
70
|
columnsSortChange={handleSortByColumnChange} paginationInfo={setPageInfo} headingTranslationsKey={'tableHeadings'} rowSelectionInfo={setRowSelectionInfo}
|
|
61
|
-
|
|
62
|
-
fixedColumns={[{ dataIndex: 'action', side: 'right' }]}
|
|
71
|
+
actionsArray={actionsArray}
|
|
72
|
+
fixedColumns={[{ dataIndex: 'action', side: 'right' }]} buttonActionIcon={getIcon} {...args}>
|
|
63
73
|
</ResponsiveTable>;
|
|
64
74
|
};
|
|
65
75
|
|
|
@@ -54,7 +54,7 @@ export interface ResponsiveTableCustomProps extends TableProps<any> {
|
|
|
54
54
|
cleanRowSelection?: boolean;
|
|
55
55
|
getRowActions?: (record: any) => any;
|
|
56
56
|
customSelectAllButton?: string;
|
|
57
|
-
buttonActionIcon?: any;
|
|
57
|
+
buttonActionIcon?: (record: any) => any | null;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
export const ResponsiveTable = (props: ResponsiveTableCustomProps) => {
|
|
@@ -225,18 +225,20 @@ export const ResponsiveTable = (props: ResponsiveTableCustomProps) => {
|
|
|
225
225
|
|
|
226
226
|
const buttonLabel = buttonActionLabel ? buttonActionLabel(record) : null;
|
|
227
227
|
|
|
228
|
+
const icon = buttonActionIcon ? buttonActionIcon(record) : null;
|
|
229
|
+
|
|
228
230
|
const buttonClass = typeof buttonActionStyle === 'function'
|
|
229
231
|
? buttonActionStyle(record) // Se for uma função, chama com o `record`
|
|
230
232
|
: buttonActionStyle || ''; // Se for string, usa diretamente
|
|
231
233
|
|
|
232
234
|
const renderActionElement = () => {
|
|
233
|
-
if (
|
|
235
|
+
if (icon) {
|
|
234
236
|
return (
|
|
235
237
|
<span
|
|
236
238
|
className={buttonClass}
|
|
237
239
|
onClick={() => buttonActionMethod?.()}
|
|
238
240
|
>
|
|
239
|
-
{
|
|
241
|
+
{icon}
|
|
240
242
|
</span>
|
|
241
243
|
);
|
|
242
244
|
}
|