norma-library 0.6.5 → 0.6.61
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/.babelrc.json +18 -18
- package/.prettierignore +10 -10
- package/.prettierrc.json +20 -20
- package/.storybook/main.ts +20 -20
- package/.storybook/preview.ts +15 -15
- package/README.md +43 -43
- package/commitlint.config.js +1 -1
- package/dist/esm/components/UncontrolledTable/index.js +2 -2
- package/dist/esm/components/UncontrolledTable/index.js.map +1 -1
- package/dist/esm/components/UncontrolledTable/interface.d.ts +1 -0
- package/dist/esm/components/UncontrolledTable/styles.d.ts +1 -0
- package/dist/esm/components/UncontrolledTable/styles.js +2 -2
- package/dist/esm/components/UncontrolledTable/styles.js.map +1 -1
- package/dist/esm/helpers/colors.d.ts +72 -0
- package/dist/esm/helpers/colors.js +66 -27
- package/dist/esm/helpers/colors.js.map +1 -1
- package/docs/index.md +118 -118
- package/package.json +136 -136
- package/src/components/Accordion.tsx +39 -39
- package/src/components/Avatar.tsx +17 -17
- package/src/components/Badge.tsx +14 -14
- package/src/components/Box/index.tsx +12 -12
- package/src/components/Box/interfaces.ts +3 -3
- package/src/components/Box/styles.tsx +22 -22
- package/src/components/Breadcrumb/index.tsx +27 -27
- package/src/components/Breadcrumb/interface.ts +8 -8
- package/src/components/Breadcrumb/styles.tsx +32 -32
- package/src/components/Button.tsx +26 -26
- package/src/components/Card.tsx +37 -37
- package/src/components/ChatMessage.tsx +87 -87
- package/src/components/ChatMessageBalloon/ChatMessageBalloon.style.ts +56 -56
- package/src/components/ChatMessageBalloon/ChatMessageBalloon.tsx +55 -55
- package/src/components/CheckBox.tsx +21 -21
- package/src/components/DateInput/index.tsx +34 -34
- package/src/components/DateInput/interface.ts +13 -13
- package/src/components/DateInput/styles.tsx +27 -27
- package/src/components/DatePicker.tsx +67 -67
- package/src/components/DropDown.tsx +24 -24
- package/src/components/IconButton.tsx +37 -37
- package/src/components/Icons.tsx +82 -82
- package/src/components/Modal.tsx +103 -103
- package/src/components/MultiSelectInput/components/MultiValue/index.tsx +44 -44
- package/src/components/MultiSelectInput/components/Option/index.tsx +62 -62
- package/src/components/MultiSelectInput/components/Option/styles.tsx +8 -8
- package/src/components/MultiSelectInput/index.tsx +60 -60
- package/src/components/MultiSelectInput/interfaces.ts +15 -15
- package/src/components/MultiSelectInput/styles.tsx +43 -43
- package/src/components/Paper.tsx +12 -12
- package/src/components/ProgressBar.tsx +71 -71
- package/src/components/RadioGroup.tsx +43 -43
- package/src/components/RangerSlider.tsx +65 -65
- package/src/components/Select.tsx +74 -74
- package/src/components/SelectInput/components/Option/index.tsx +61 -61
- package/src/components/SelectInput/components/Option/styles.tsx +8 -8
- package/src/components/SelectInput/index.tsx +45 -45
- package/src/components/SelectInput/interfaces.ts +15 -15
- package/src/components/SelectInput/styles.tsx +31 -31
- package/src/components/StatusModal/StatusModal.style.tsx +75 -75
- package/src/components/StatusModal/StatusModal.tsx +58 -58
- package/src/components/Svgs.tsx +506 -506
- package/src/components/Table/components/header/index.tsx +86 -86
- package/src/components/Table/components/header/styles.tsx +59 -59
- package/src/components/Table/components/index.tsx +8 -8
- package/src/components/Table/components/pagination/index.tsx +39 -39
- package/src/components/Table/components/pagination/styles.tsx +28 -28
- package/src/components/Table/components/tbody/index.tsx +30 -30
- package/src/components/Table/components/tbody/styles.tsx +4 -4
- package/src/components/Table/index.tsx +317 -317
- package/src/components/Table/interface.ts +23 -23
- package/src/components/Table/styles.tsx +117 -117
- package/src/components/Tabs.tsx +105 -105
- package/src/components/Tag.tsx +33 -33
- package/src/components/TextField.tsx +19 -19
- package/src/components/TextInput/index.tsx +37 -37
- package/src/components/TextInput/interface.ts +9 -9
- package/src/components/TextInput/styles.tsx +23 -23
- package/src/components/TimeLine.tsx +89 -89
- package/src/components/TimePicker.tsx +78 -78
- package/src/components/Typography/Text/index.tsx +20 -20
- package/src/components/Typography/Text/interfaces.ts +5 -5
- package/src/components/Typography/Text/styles.tsx +40 -40
- package/src/components/Typography/Title/index.tsx +22 -22
- package/src/components/Typography/Title/interfaces.ts +6 -6
- package/src/components/Typography/Title/styles.tsx +40 -40
- package/src/components/Typography/index.tsx +6 -6
- package/src/components/UncontrolledTable/components/header/index.tsx +72 -72
- package/src/components/UncontrolledTable/components/header/styles.tsx +66 -66
- package/src/components/UncontrolledTable/components/index.tsx +8 -8
- package/src/components/UncontrolledTable/components/pagination/index.tsx +43 -43
- package/src/components/UncontrolledTable/components/pagination/styles.tsx +28 -28
- package/src/components/UncontrolledTable/components/tbody/index.tsx +33 -33
- package/src/components/UncontrolledTable/components/tbody/styles.tsx +32 -32
- package/src/components/UncontrolledTable/index.tsx +223 -222
- package/src/components/UncontrolledTable/interface.ts +46 -44
- package/src/components/UncontrolledTable/styles.tsx +123 -123
- package/src/components/UncontrolledTabs/UncontrolledTabs.style.tsx +58 -58
- package/src/components/UncontrolledTabs/UncontrolledTabs.tsx +71 -71
- package/src/components/UncontrolledTabs/UncontrolledTabsInfo.style.ts +8 -8
- package/src/components/index.ts +24 -24
- package/src/helpers/alignments.ts +14 -14
- package/src/helpers/borders.ts +18 -18
- package/src/helpers/colors.ts +298 -258
- package/src/helpers/index.ts +5 -5
- package/src/helpers/radios.ts +24 -24
- package/src/helpers/sizes.ts +72 -72
- package/src/hooks/useClickOutside.tsx +18 -18
- package/src/index.ts +70 -70
- package/src/interfaces/Accordion.ts +12 -12
- package/src/interfaces/Avatar.tsx +15 -15
- package/src/interfaces/Badge.ts +19 -19
- package/src/interfaces/Button.ts +22 -22
- package/src/interfaces/Card.ts +11 -11
- package/src/interfaces/ChatMessage.ts +12 -12
- package/src/interfaces/ChatMessageBalloon.ts +17 -17
- package/src/interfaces/CheckBox.ts +27 -27
- package/src/interfaces/DatePicker.ts +13 -13
- package/src/interfaces/DropDown.ts +14 -14
- package/src/interfaces/IconButton.ts +22 -22
- package/src/interfaces/Icons.ts +17 -17
- package/src/interfaces/Modal.ts +18 -18
- package/src/interfaces/Paper.ts +12 -12
- package/src/interfaces/ProgressBar.ts +29 -29
- package/src/interfaces/RadioGroup.ts +23 -23
- package/src/interfaces/RangerSlider.ts +21 -21
- package/src/interfaces/Select.ts +17 -17
- package/src/interfaces/Tabs.ts +19 -19
- package/src/interfaces/Tag.ts +17 -17
- package/src/interfaces/TextField.ts +44 -44
- package/src/interfaces/TimeLine.ts +11 -11
- package/src/interfaces/TimePicker.ts +13 -13
- package/src/interfaces/index.ts +23 -23
- package/src/providers/NormaProvider.tsx +13 -13
- package/src/sample-data-2.json +178 -178
- package/src/sample-data.json +177 -177
- package/src/stories/Accordion.stories.tsx +65 -65
- package/src/stories/Avatar.stories.tsx +123 -123
- package/src/stories/Badge.stories.tsx +39 -39
- package/src/stories/Box.stories.tsx +35 -35
- package/src/stories/Breadcrumb.stories.tsx +44 -44
- package/src/stories/Button.stories.tsx +93 -93
- package/src/stories/Card.stories.tsx +39 -39
- package/src/stories/ChatMessage.stories.tsx +84 -84
- package/src/stories/ChatMessageBalloon.stories.tsx +108 -108
- package/src/stories/CheckBox.stories.tsx +88 -88
- package/src/stories/DateInput.stories.tsx +51 -51
- package/src/stories/DatePicker.stories.tsx +50 -50
- package/src/stories/DropDown.stories.tsx +57 -57
- package/src/stories/IconButton.stories.tsx +78 -78
- package/src/stories/Modal.stories.tsx +246 -246
- package/src/stories/ModalStatus.stories.tsx +46 -46
- package/src/stories/MultiSelectInput.stories.tsx +90 -90
- package/src/stories/Paper.stories.tsx +53 -53
- package/src/stories/ProgressBar.stories.tsx +116 -116
- package/src/stories/RadioGroup.stories.tsx +87 -87
- package/src/stories/RangerSlider.stories.tsx +149 -149
- package/src/stories/Select.stories.tsx +100 -100
- package/src/stories/SelectInput.stories.tsx +78 -78
- package/src/stories/Table.stories.tsx +372 -372
- package/src/stories/Tabs.stories.tsx +61 -61
- package/src/stories/Tag.stories.tsx +56 -56
- package/src/stories/Text.stories.tsx +37 -37
- package/src/stories/TextField.stories.tsx +310 -310
- package/src/stories/TextInput.stories.tsx +52 -52
- package/src/stories/TimeLine.stories.tsx +35 -35
- package/src/stories/TimePicker.stories.tsx +87 -87
- package/src/stories/Title.stories.tsx +43 -43
- package/src/stories/UncontrolledTable.stories.tsx +315 -315
- package/src/stories/UncontrolledTabs.stories.tsx +74 -74
- package/src/styles/globals.scss +17 -17
- package/src/types/index.ts +207 -207
- package/src/utils/styledBreakpoints.ts +25 -25
- package/vite.config.ts +15 -15
|
@@ -1,222 +1,223 @@
|
|
|
1
|
-
import React, { useState, useMemo, useRef } from 'react';
|
|
2
|
-
import * as S from './styles';
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
flexRender,
|
|
6
|
-
getCoreRowModel,
|
|
7
|
-
getSortedRowModel,
|
|
8
|
-
useReactTable,
|
|
9
|
-
ColumnFiltersState,
|
|
10
|
-
TableOptions,
|
|
11
|
-
} from '@tanstack/react-table';
|
|
12
|
-
|
|
13
|
-
import { Pagination, Header, TBody } from './components';
|
|
14
|
-
import { UncontrolledTableProps } from './interface';
|
|
15
|
-
import useClickOutside from '../../hooks/useClickOutside';
|
|
16
|
-
|
|
17
|
-
const UncontrolledTable = (props: UncontrolledTableProps) => {
|
|
18
|
-
const {
|
|
19
|
-
data,
|
|
20
|
-
columns,
|
|
21
|
-
onClick,
|
|
22
|
-
onMouseOver,
|
|
23
|
-
onMouseOut,
|
|
24
|
-
showTotalResults,
|
|
25
|
-
showSettings,
|
|
26
|
-
onChangePage,
|
|
27
|
-
pagination,
|
|
28
|
-
totalPages,
|
|
29
|
-
showClearFields,
|
|
30
|
-
onClearFieldsClick,
|
|
31
|
-
onFilterClick,
|
|
32
|
-
onSortClick,
|
|
33
|
-
customTotalResults,
|
|
34
|
-
labels,
|
|
35
|
-
tableClassName,
|
|
36
|
-
stickyHeader,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const [
|
|
41
|
-
const [
|
|
42
|
-
const [
|
|
43
|
-
const [
|
|
44
|
-
const [
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
1
|
+
import React, { useState, useMemo, useRef } from 'react';
|
|
2
|
+
import * as S from './styles';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
flexRender,
|
|
6
|
+
getCoreRowModel,
|
|
7
|
+
getSortedRowModel,
|
|
8
|
+
useReactTable,
|
|
9
|
+
ColumnFiltersState,
|
|
10
|
+
TableOptions,
|
|
11
|
+
} from '@tanstack/react-table';
|
|
12
|
+
|
|
13
|
+
import { Pagination, Header, TBody } from './components';
|
|
14
|
+
import { UncontrolledTableProps } from './interface';
|
|
15
|
+
import useClickOutside from '../../hooks/useClickOutside';
|
|
16
|
+
|
|
17
|
+
const UncontrolledTable = (props: UncontrolledTableProps) => {
|
|
18
|
+
const {
|
|
19
|
+
data,
|
|
20
|
+
columns,
|
|
21
|
+
onClick,
|
|
22
|
+
onMouseOver,
|
|
23
|
+
onMouseOut,
|
|
24
|
+
showTotalResults,
|
|
25
|
+
showSettings,
|
|
26
|
+
onChangePage,
|
|
27
|
+
pagination,
|
|
28
|
+
totalPages,
|
|
29
|
+
showClearFields,
|
|
30
|
+
onClearFieldsClick,
|
|
31
|
+
onFilterClick,
|
|
32
|
+
onSortClick,
|
|
33
|
+
customTotalResults,
|
|
34
|
+
labels,
|
|
35
|
+
tableClassName,
|
|
36
|
+
stickyHeader,
|
|
37
|
+
stickyHeaderP,
|
|
38
|
+
} = props;
|
|
39
|
+
|
|
40
|
+
const [openFilterDialog, setOpenFilterDialog] = useState('');
|
|
41
|
+
const [sorting, setSorting] = useState<any>([]);
|
|
42
|
+
const [filterByColumn, setFilterByColumn] = useState<ColumnFiltersState>([]);
|
|
43
|
+
const [globalFilters, setGlobalFilters] = useState<any>([]);
|
|
44
|
+
const [orderSmallest, setOrderSmallest] = useState(false);
|
|
45
|
+
const [orderLargest, setOrderLargest] = useState(false);
|
|
46
|
+
|
|
47
|
+
const reactTableConfig = useMemo(() => {
|
|
48
|
+
const config: TableOptions<unknown> = {
|
|
49
|
+
columns: columns as any,
|
|
50
|
+
data,
|
|
51
|
+
state: {
|
|
52
|
+
sorting: sorting,
|
|
53
|
+
columnFilters: filterByColumn,
|
|
54
|
+
pagination: pagination,
|
|
55
|
+
},
|
|
56
|
+
rowCount: totalPages,
|
|
57
|
+
getCoreRowModel: getCoreRowModel(),
|
|
58
|
+
getSortedRowModel: getSortedRowModel(),
|
|
59
|
+
onSortingChange: setSorting,
|
|
60
|
+
onColumnFiltersChange: setFilterByColumn,
|
|
61
|
+
manualPagination: true,
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
return config;
|
|
65
|
+
}, [data, sorting, filterByColumn, columns, pagination]);
|
|
66
|
+
|
|
67
|
+
const table = useReactTable(reactTableConfig);
|
|
68
|
+
const filterRef = useRef<HTMLDivElement>(null);
|
|
69
|
+
|
|
70
|
+
useClickOutside(filterRef, () => setOpenFilterDialog(''));
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<S.Container>
|
|
74
|
+
<Header
|
|
75
|
+
table={table}
|
|
76
|
+
globalFilters={globalFilters}
|
|
77
|
+
orderSmallest={orderSmallest}
|
|
78
|
+
orderLargest={orderLargest}
|
|
79
|
+
showTotalResults={showTotalResults}
|
|
80
|
+
showSettings={showSettings}
|
|
81
|
+
setGlobalFilters={setGlobalFilters}
|
|
82
|
+
setOrderLargest={setOrderLargest}
|
|
83
|
+
setOrderSmallest={setOrderSmallest}
|
|
84
|
+
showClearFiels={showClearFields}
|
|
85
|
+
customTotalResults={customTotalResults}
|
|
86
|
+
clearLabel={labels?.clearFilter}
|
|
87
|
+
onClearFieldsClick={() => onClearFieldsClick && onClearFieldsClick()}
|
|
88
|
+
customIcons={props.customIcons}
|
|
89
|
+
/>
|
|
90
|
+
<S.Table className={tableClassName || ''}>
|
|
91
|
+
<S.Thead $sticky={stickyHeader} $stickyTopP={stickyHeaderP}>
|
|
92
|
+
{table.getHeaderGroups().map((headerGroup: any) => (
|
|
93
|
+
<S.TableRow key={headerGroup.id}>
|
|
94
|
+
{headerGroup.headers.map((header: any) => (
|
|
95
|
+
<S.Th key={header.id}>
|
|
96
|
+
<S.ColumnContent
|
|
97
|
+
onClick={() => {
|
|
98
|
+
if (!header?.column?.columnDef?.disableMenu)
|
|
99
|
+
setOpenFilterDialog(header.column.columnDef.accessorKey);
|
|
100
|
+
}}
|
|
101
|
+
>
|
|
102
|
+
<S.TextColumn>
|
|
103
|
+
{!header.isPlaceholder && flexRender(header.column.columnDef.header, header.getContext())}
|
|
104
|
+
</S.TextColumn>
|
|
105
|
+
{!header?.column?.columnDef?.disableMenu && (
|
|
106
|
+
<S.IconFilterDialog>
|
|
107
|
+
<svg fill="#666" focusable="false" aria-hidden="true" viewBox="0 0 24 24">
|
|
108
|
+
<path d="m7 10 5 5 5-5z" />
|
|
109
|
+
</svg>
|
|
110
|
+
</S.IconFilterDialog>
|
|
111
|
+
)}
|
|
112
|
+
</S.ColumnContent>
|
|
113
|
+
{openFilterDialog === header.column.columnDef.accessorKey && (
|
|
114
|
+
<S.FilterDialog ref={filterRef}>
|
|
115
|
+
<S.ListFilterDialog>
|
|
116
|
+
<S.OptionFilterDialog
|
|
117
|
+
style={{
|
|
118
|
+
background: orderSmallest ? 'rgba(0, 0, 0, 0.04)' : '',
|
|
119
|
+
}}
|
|
120
|
+
onClick={() => {
|
|
121
|
+
onSortClick && onSortClick(header.column.columnDef.accessorKey, 'asc');
|
|
122
|
+
setOpenFilterDialog('');
|
|
123
|
+
}}
|
|
124
|
+
>
|
|
125
|
+
<div className="icon">
|
|
126
|
+
<svg
|
|
127
|
+
fill="#666"
|
|
128
|
+
stroke="currentColor"
|
|
129
|
+
strokeWidth="1.5"
|
|
130
|
+
viewBox="0 0 24 24"
|
|
131
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
132
|
+
aria-hidden="true"
|
|
133
|
+
width="20"
|
|
134
|
+
height="20"
|
|
135
|
+
>
|
|
136
|
+
<path
|
|
137
|
+
strokeLinecap="round"
|
|
138
|
+
strokeLinejoin="round"
|
|
139
|
+
d="M12 4.5v15m0 0l6.75-6.75M12 19.5l-6.75-6.75"
|
|
140
|
+
/>
|
|
141
|
+
</svg>
|
|
142
|
+
</div>
|
|
143
|
+
<p>{labels?.orderAsc || 'Menor primeiro'}</p>
|
|
144
|
+
</S.OptionFilterDialog>
|
|
145
|
+
<S.OptionFilterDialog
|
|
146
|
+
style={{
|
|
147
|
+
background: orderLargest ? 'rgba(0, 0, 0, 0.04)' : '',
|
|
148
|
+
}}
|
|
149
|
+
onClick={() => {
|
|
150
|
+
onSortClick && onSortClick(header.column.columnDef.accessorKey, 'desc');
|
|
151
|
+
setOpenFilterDialog('');
|
|
152
|
+
}}
|
|
153
|
+
>
|
|
154
|
+
<div className="icon rotate">
|
|
155
|
+
<svg
|
|
156
|
+
fill="#666"
|
|
157
|
+
stroke="currentColor"
|
|
158
|
+
strokeWidth="1.5"
|
|
159
|
+
viewBox="0 0 24 24"
|
|
160
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
161
|
+
aria-hidden="true"
|
|
162
|
+
width="20"
|
|
163
|
+
height="20"
|
|
164
|
+
>
|
|
165
|
+
<path
|
|
166
|
+
strokeLinecap="round"
|
|
167
|
+
strokeLinejoin="round"
|
|
168
|
+
d="M12 4.5v15m0 0l6.75-6.75M12 19.5l-6.75-6.75"
|
|
169
|
+
></path>
|
|
170
|
+
</svg>
|
|
171
|
+
</div>
|
|
172
|
+
<p>{labels?.orderDesc || 'Maior primeiro'}</p>
|
|
173
|
+
</S.OptionFilterDialog>
|
|
174
|
+
{!header?.column?.columnDef?.nofilter && (
|
|
175
|
+
<S.OptionFilterDialog
|
|
176
|
+
onClick={() => {
|
|
177
|
+
onFilterClick && onFilterClick(header.column.columnDef.accessorKey);
|
|
178
|
+
setOpenFilterDialog('');
|
|
179
|
+
}}
|
|
180
|
+
>
|
|
181
|
+
<div className="icon">
|
|
182
|
+
<svg
|
|
183
|
+
fill="none"
|
|
184
|
+
stroke="currentColor"
|
|
185
|
+
strokeWidth="1.5"
|
|
186
|
+
viewBox="0 0 24 24"
|
|
187
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
188
|
+
aria-hidden="true"
|
|
189
|
+
width="16"
|
|
190
|
+
height="16"
|
|
191
|
+
>
|
|
192
|
+
<path
|
|
193
|
+
strokeLinecap="round"
|
|
194
|
+
strokeLinejoin="round"
|
|
195
|
+
d="M12 3c2.755 0 5.455.232 8.083.678.533.09.917.556.917 1.096v1.044a2.25 2.25 0 01-.659 1.591l-5.432 5.432a2.25 2.25 0 00-.659 1.591v2.927a2.25 2.25 0 01-1.244 2.013L9.75 21v-6.568a2.25 2.25 0 00-.659-1.591L3.659 7.409A2.25 2.25 0 013 5.818V4.774c0-.54.384-1.006.917-1.096A48.32 48.32 0 0112 3z"
|
|
196
|
+
></path>
|
|
197
|
+
</svg>
|
|
198
|
+
</div>
|
|
199
|
+
<p>{labels?.filter || 'Filtrar por'}</p>
|
|
200
|
+
</S.OptionFilterDialog>
|
|
201
|
+
)}
|
|
202
|
+
</S.ListFilterDialog>
|
|
203
|
+
</S.FilterDialog>
|
|
204
|
+
)}
|
|
205
|
+
</S.Th>
|
|
206
|
+
))}
|
|
207
|
+
</S.TableRow>
|
|
208
|
+
))}
|
|
209
|
+
</S.Thead>
|
|
210
|
+
<TBody table={table} onClick={onClick} onMouseOver={onMouseOver} onMouseOut={onMouseOut} />
|
|
211
|
+
</S.Table>
|
|
212
|
+
{pagination && (
|
|
213
|
+
<Pagination
|
|
214
|
+
pagination={pagination}
|
|
215
|
+
count={totalPages}
|
|
216
|
+
onChangePage={(page: number) => onChangePage({ ...pagination, pageIndex: page })}
|
|
217
|
+
/>
|
|
218
|
+
)}
|
|
219
|
+
</S.Container>
|
|
220
|
+
);
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
export default UncontrolledTable;
|
|
@@ -1,44 +1,46 @@
|
|
|
1
|
-
import { ColumnDef } from '@tanstack/react-table';
|
|
2
|
-
|
|
3
|
-
type Labels = {
|
|
4
|
-
orderAsc: string;
|
|
5
|
-
orderDesc: string;
|
|
6
|
-
filter: string;
|
|
7
|
-
clearFilter: string;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
interface Pagination {
|
|
11
|
-
pageIndex: number;
|
|
12
|
-
pageSize: number;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface UncontrolledTableProps {
|
|
16
|
-
data: any;
|
|
17
|
-
columns: ColumnDef<ColumnsTable>[];
|
|
18
|
-
onClick: any;
|
|
19
|
-
onMouseOver: any;
|
|
20
|
-
onMouseOut: any;
|
|
21
|
-
showTotalResults: boolean;
|
|
22
|
-
showSettings: boolean;
|
|
23
|
-
pagination?: Pagination;
|
|
24
|
-
totalPages: number;
|
|
25
|
-
showClearFields?: boolean;
|
|
26
|
-
customTotalResults?: string;
|
|
27
|
-
onChangePage: (pagination: Pagination) => void;
|
|
28
|
-
onClearFieldsClick?: () => void;
|
|
29
|
-
onFilterClick?: (column: string) => void;
|
|
30
|
-
onSortClick?: (column: string, direction: string) => void;
|
|
31
|
-
labels?: Labels;
|
|
32
|
-
tableClassName?: string;
|
|
33
|
-
stickyHeader?: boolean;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
1
|
+
import { ColumnDef } from '@tanstack/react-table';
|
|
2
|
+
|
|
3
|
+
type Labels = {
|
|
4
|
+
orderAsc: string;
|
|
5
|
+
orderDesc: string;
|
|
6
|
+
filter: string;
|
|
7
|
+
clearFilter: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
interface Pagination {
|
|
11
|
+
pageIndex: number;
|
|
12
|
+
pageSize: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface UncontrolledTableProps {
|
|
16
|
+
data: any;
|
|
17
|
+
columns: ColumnDef<ColumnsTable>[];
|
|
18
|
+
onClick: any;
|
|
19
|
+
onMouseOver: any;
|
|
20
|
+
onMouseOut: any;
|
|
21
|
+
showTotalResults: boolean;
|
|
22
|
+
showSettings: boolean;
|
|
23
|
+
pagination?: Pagination;
|
|
24
|
+
totalPages: number;
|
|
25
|
+
showClearFields?: boolean;
|
|
26
|
+
customTotalResults?: string;
|
|
27
|
+
onChangePage: (pagination: Pagination) => void;
|
|
28
|
+
onClearFieldsClick?: () => void;
|
|
29
|
+
onFilterClick?: (column: string) => void;
|
|
30
|
+
onSortClick?: (column: string, direction: string) => void;
|
|
31
|
+
labels?: Labels;
|
|
32
|
+
tableClassName?: string;
|
|
33
|
+
stickyHeader?: boolean;
|
|
34
|
+
stickyHeaderP?: number;
|
|
35
|
+
customIcons?: React.ReactNode[];
|
|
36
|
+
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface ColumnsTable {
|
|
40
|
+
header: string;
|
|
41
|
+
accessorKey: string;
|
|
42
|
+
type: string;
|
|
43
|
+
enableColumnFilter: boolean;
|
|
44
|
+
filterFn: string;
|
|
45
|
+
nofilter?: boolean;
|
|
46
|
+
}
|