norma-library 0.5.813 → 0.5.815

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.
Files changed (77) hide show
  1. package/dist/esm/components/Table/components/header/index.js +23 -10
  2. package/dist/esm/components/Table/components/header/index.js.map +1 -1
  3. package/dist/esm/components/Table/components/header/styles.d.ts +2 -1
  4. package/dist/esm/components/Table/components/header/styles.js +6 -5
  5. package/dist/esm/components/Table/components/header/styles.js.map +1 -1
  6. package/dist/esm/components/Table/components/pagination/index.js +4 -4
  7. package/dist/esm/components/Table/components/pagination/index.js.map +1 -1
  8. package/dist/esm/components/Table/components/pagination/styles.js +1 -1
  9. package/dist/esm/components/Table/components/pagination/styles.js.map +1 -1
  10. package/dist/esm/components/Table/components/tbody/index.js +7 -2
  11. package/dist/esm/components/Table/components/tbody/index.js.map +1 -1
  12. package/dist/esm/components/Table/components/tbody/styles.d.ts +2 -0
  13. package/dist/esm/components/Table/components/tbody/styles.js +4 -1
  14. package/dist/esm/components/Table/components/tbody/styles.js.map +1 -1
  15. package/dist/esm/components/Table/index.js +113 -112
  16. package/dist/esm/components/Table/index.js.map +1 -1
  17. package/dist/esm/components/Table/interface.d.ts +6 -0
  18. package/dist/esm/components/Table/styles.d.ts +2 -1
  19. package/dist/esm/components/Table/styles.js +11 -10
  20. package/dist/esm/components/Table/styles.js.map +1 -1
  21. package/package.json +2 -4
  22. package/src/components/Table/components/header/index.tsx +39 -14
  23. package/src/components/Table/components/header/styles.tsx +8 -3
  24. package/src/components/Table/components/pagination/index.tsx +6 -6
  25. package/src/components/Table/components/pagination/styles.tsx +12 -0
  26. package/src/components/Table/components/tbody/index.tsx +17 -6
  27. package/src/components/Table/components/tbody/styles.tsx +5 -0
  28. package/src/components/Table/index.tsx +172 -163
  29. package/src/components/Table/interface.ts +6 -0
  30. package/src/components/Table/styles.tsx +6 -1
  31. package/src/stories/Table.stories.tsx +204 -159
  32. package/dist/Button/index.d.ts +0 -9
  33. package/dist/Button/types.d.ts +0 -18
  34. package/dist/Card/Card.d.ts +0 -3
  35. package/dist/Card/CardHeader.d.ts +0 -3
  36. package/dist/Card/index.d.ts +0 -4
  37. package/dist/Card/styles.d.ts +0 -546
  38. package/dist/Card/types.d.ts +0 -8
  39. package/dist/esm/components/DataGrid/base/dropdown.d.ts +0 -4
  40. package/dist/esm/components/DataGrid/base/dropdown.js +0 -126
  41. package/dist/esm/components/DataGrid/base/dropdown.js.map +0 -1
  42. package/dist/esm/components/DataGrid/base/number-filter.d.ts +0 -4
  43. package/dist/esm/components/DataGrid/base/number-filter.js +0 -30
  44. package/dist/esm/components/DataGrid/base/number-filter.js.map +0 -1
  45. package/dist/esm/components/DataGrid/base/sorting.d.ts +0 -5
  46. package/dist/esm/components/DataGrid/base/sorting.js +0 -15
  47. package/dist/esm/components/DataGrid/base/sorting.js.map +0 -1
  48. package/dist/esm/components/DataGrid/icons.d.ts +0 -5
  49. package/dist/esm/components/DataGrid/icons.js +0 -20
  50. package/dist/esm/components/DataGrid/icons.js.map +0 -1
  51. package/dist/esm/components/DataGrid/index.d.ts +0 -3
  52. package/dist/esm/components/DataGrid/index.js +0 -214
  53. package/dist/esm/components/DataGrid/index.js.map +0 -1
  54. package/dist/esm/components/DataGrid/shared.d.ts +0 -20
  55. package/dist/esm/components/DataGrid/shared.js +0 -119
  56. package/dist/esm/components/DataGrid/shared.js.map +0 -1
  57. package/dist/esm/components/DataGrid/styled.d.ts +0 -11
  58. package/dist/esm/components/DataGrid/styled.js +0 -86
  59. package/dist/esm/components/DataGrid/styled.js.map +0 -1
  60. package/dist/esm/components/Table/index-old.d.ts +0 -4
  61. package/dist/esm/components/Table/index-old.js +0 -249
  62. package/dist/esm/components/Table/index-old.js.map +0 -1
  63. package/dist/esm/components/Table-old/index.d.ts +0 -3
  64. package/dist/esm/components/Table-old/index.js +0 -71
  65. package/dist/esm/components/Table-old/index.js.map +0 -1
  66. package/dist/esm/components/Table-old/styles.d.ts +0 -3004
  67. package/dist/esm/components/Table-old/styles.js +0 -15
  68. package/dist/esm/components/Table-old/styles.js.map +0 -1
  69. package/dist/esm/interfaces/DataGrid.d.ts +0 -42
  70. package/dist/esm/interfaces/DataGrid.js +0 -2
  71. package/dist/esm/interfaces/DataGrid.js.map +0 -1
  72. package/dist/index.d.ts +0 -2
  73. package/dist/index.es.js +0 -6992
  74. package/dist/index.es.js.map +0 -1
  75. package/dist/index.umd.js +0 -266
  76. package/dist/index.umd.js.map +0 -1
  77. package/dist/vite.svg +0 -1
@@ -14,7 +14,7 @@ import { Button } from "@mui/material";
14
14
  import { TablePropos } from './interface';
15
15
  import { Pagination, Header, TBody } from "./components"
16
16
 
17
- const Table:React.FC<TablePropos> = ({ data, columns }) => {
17
+ const Table:React.FC<TablePropos> = ({ data, columns, onClick, onMouseOver, onMouseOut, showTotalResults, showSettings }) => {
18
18
  const [openFilterDialog, setOpenFilterDialog] = useState('')
19
19
  const [sorting, setSorting] = useState<any>([])
20
20
  const [openFilterOptions, setOpenFilterOptions] = useState(false)
@@ -117,175 +117,184 @@ const Table:React.FC<TablePropos> = ({ data, columns }) => {
117
117
  globalFilters={globalFilters}
118
118
  orderSmallest={orderSmallest}
119
119
  orderLargest={orderLargest}
120
+ showTotalResults={showTotalResults}
121
+ showSettings={showSettings}
120
122
  setGlobalFilters={setGlobalFilters}
121
123
  setOrderLargest={setOrderLargest}
122
124
  setOrderSmallest={setOrderSmallest}
123
125
  />
124
126
  <S.Content>
125
- <thead>
126
- {table.getHeaderGroups().map((headerGroup: any) => (
127
- <tr key={headerGroup.id}>
128
- {headerGroup.headers.map((header: any) => (
129
- <th key={header.id}>
130
- <div>
131
- <S.ColumnContent>
132
- <S.TextColumn>
133
- {header.isPlaceholder
134
- ? null
135
- : flexRender(
136
- header.column.columnDef.header,
137
- header.getContext()
138
- )}
139
- </S.TextColumn>
140
- <S.IconFilterDialog onClick={() => {
141
- setOpenFilterDialog(header.column.columnDef.accessorKey)
142
- }}>
143
- <svg fill='#666' focusable="false" aria-hidden="true" viewBox="0 0 24 24" data-testid="ArrowDropDownIcon"><path d="m7 10 5 5 5-5z"></path></svg>
144
- </S.IconFilterDialog>
145
- </S.ColumnContent>
146
- { openFilterDialog === header.column.columnDef.accessorKey
147
- ? (
148
- <>
149
- <S.backgroundDialog onClick={() => {
150
- setOpenFilterDialog('')
151
- setOpenFilterOptions(false)
152
- }}></S.backgroundDialog>
153
- <S.FilterDialog>
154
- {
155
- openFilterOptions
156
- ? (
157
- <S.ListFilterDialog>
158
- <p className='label'>Selecione um filtro</p>
159
- <select className='select' value={filterInputSelected} onChange={(event) => {
160
- setFilterInputSelected(event.target.value)
161
- }}>
162
- <option>Selecione...</option>
163
- { header?.headerGroup?.headers[header.index].column.columnDef.type === 'text' ? <option>Igual a</option> : null }
164
- { header?.headerGroup?.headers[header.index].column.columnDef.type === 'text' ? <option>Não é igual a</option> : null }
165
- { header?.headerGroup?.headers[header.index].column.columnDef.type === 'text' ? <option>Contém</option> : null }
166
- { header?.headerGroup?.headers[header.index].column.columnDef.type === 'number' ? <option>Maior que</option> : null }
167
- { header?.headerGroup?.headers[header.index].column.columnDef.type === 'number' ? <option>Menor que</option> : null }
168
- { header?.headerGroup?.headers[header.index].column.columnDef.type === 'number' ? <option>Igual a</option> : null }
169
- { header?.headerGroup?.headers[header.index]. column.columnDef.type === 'date' ? <option>Data Igual a</option> : null }
170
- { header?.headerGroup?.headers[header.index]. column.columnDef.type === 'date' ? <option>Data maior que</option> : null }
171
- { header?.headerGroup?.headers[header.index]. column.columnDef.type === 'date' ? <option>Data menor que</option> : null }
172
- { header?.headerGroup?.headers[header.index]. column.columnDef.type === 'time' ? <option>Horario Igual a</option> : null }
173
- { header?.headerGroup?.headers[header.index]. column.columnDef.type === 'time' ? <option>Horario maior que</option> : null }
174
- { header?.headerGroup?.headers[header.index]. column.columnDef.type === 'time' ? <option>Horario menor que</option> : null }
175
- </select>
176
- <div>
177
- { header.column.getCanFilter()
178
- ? filterInputSelected === 'Igual a' ||
179
- filterInputSelected === 'Não é igual a' ||
180
- filterInputSelected === 'Contém' ||
181
- filterInputSelected === 'Maior que' ||
182
- filterInputSelected === 'Menor que' ||
183
- filterInputSelected === 'Data Igual a' ||
184
- filterInputSelected === 'Data maior que' ||
185
- filterInputSelected === 'Data menor que' ||
186
- filterInputSelected === 'Horario Igual a' ||
187
- filterInputSelected === 'Horario maior que' ||
188
- filterInputSelected === 'Horario menor que'
189
- ? (
190
- <div>
191
- <p className='label' style={{ marginTop: '10px' }}>Valor</p>
192
- <input
193
- type={header?.headerGroup?.headers[header.index].column.columnDef.type}
194
- className='select'
195
- style={{ width: '100%' }}
196
- value={value as any}
197
- onChange={event => {
198
- if (header?.headerGroup?.headers[header.index].column.columnDef.type === 'number') {
199
- setValue(Number(event.target.value))
200
- return
201
- }
202
- if (header?.headerGroup?.headers[header.index].column.columnDef.type === 'date') {
203
- setValue(event.target.value)
204
- return
205
- }
206
- setValue(event.target.value)
207
- }}
208
- />
209
- <Button
210
- color="primary"
211
- type={"submit"}
212
- disableElevation
213
- style={{
214
- marginTop: 8,
215
- width: '100%'
216
- }}
217
- variant="contained"
218
- onClick={() => {
219
- setGlobalFilters((current: any) => [...current,
220
- {
221
- acessor: header.column.columnDef.accessorKey,
222
- type: filterInputSelected,
223
- value: value
127
+ <S.Table>
128
+ <thead>
129
+ {table.getHeaderGroups().map((headerGroup: any) => (
130
+ <tr key={headerGroup.id}>
131
+ {headerGroup.headers.map((header: any) => (
132
+ <th key={header.id}>
133
+ <div>
134
+ <S.ColumnContent>
135
+ <S.TextColumn>
136
+ {header.isPlaceholder
137
+ ? null
138
+ : flexRender(
139
+ header.column.columnDef.header,
140
+ header.getContext()
141
+ )}
142
+ </S.TextColumn>
143
+ <S.IconFilterDialog onClick={() => {
144
+ setOpenFilterDialog(header.column.columnDef.accessorKey)
145
+ }}>
146
+ <svg fill='#666' focusable="false" aria-hidden="true" viewBox="0 0 24 24" data-testid="ArrowDropDownIcon"><path d="m7 10 5 5 5-5z"></path></svg>
147
+ </S.IconFilterDialog>
148
+ </S.ColumnContent>
149
+ { openFilterDialog === header.column.columnDef.accessorKey
150
+ ? (
151
+ <>
152
+ <S.backgroundDialog onClick={() => {
153
+ setOpenFilterDialog('')
154
+ setOpenFilterOptions(false)
155
+ }}></S.backgroundDialog>
156
+ <S.FilterDialog>
157
+ {
158
+ openFilterOptions
159
+ ? (
160
+ <S.ListFilterDialog>
161
+ <p className='label'>Selecione um filtro</p>
162
+ <select className='select' value={filterInputSelected} onChange={(event) => {
163
+ setFilterInputSelected(event.target.value)
164
+ }}>
165
+ <option>Selecione...</option>
166
+ { header?.headerGroup?.headers[header.index].column.columnDef.type === 'text' ? <option>Igual a</option> : null }
167
+ { header?.headerGroup?.headers[header.index].column.columnDef.type === 'text' ? <option>Não é igual a</option> : null }
168
+ { header?.headerGroup?.headers[header.index].column.columnDef.type === 'text' ? <option>Contém</option> : null }
169
+ { header?.headerGroup?.headers[header.index].column.columnDef.type === 'number' ? <option>Maior que</option> : null }
170
+ { header?.headerGroup?.headers[header.index].column.columnDef.type === 'number' ? <option>Menor que</option> : null }
171
+ { header?.headerGroup?.headers[header.index].column.columnDef.type === 'number' ? <option>Igual a</option> : null }
172
+ { header?.headerGroup?.headers[header.index]. column.columnDef.type === 'date' ? <option>Data Igual a</option> : null }
173
+ { header?.headerGroup?.headers[header.index]. column.columnDef.type === 'date' ? <option>Data maior que</option> : null }
174
+ { header?.headerGroup?.headers[header.index]. column.columnDef.type === 'date' ? <option>Data menor que</option> : null }
175
+ { header?.headerGroup?.headers[header.index]. column.columnDef.type === 'time' ? <option>Horario Igual a</option> : null }
176
+ { header?.headerGroup?.headers[header.index]. column.columnDef.type === 'time' ? <option>Horario maior que</option> : null }
177
+ { header?.headerGroup?.headers[header.index]. column.columnDef.type === 'time' ? <option>Horario menor que</option> : null }
178
+ </select>
179
+ <div>
180
+ { header.column.getCanFilter()
181
+ ? filterInputSelected === 'Igual a' ||
182
+ filterInputSelected === 'Não é igual a' ||
183
+ filterInputSelected === 'Contém' ||
184
+ filterInputSelected === 'Maior que' ||
185
+ filterInputSelected === 'Menor que' ||
186
+ filterInputSelected === 'Data Igual a' ||
187
+ filterInputSelected === 'Data maior que' ||
188
+ filterInputSelected === 'Data menor que' ||
189
+ filterInputSelected === 'Horario Igual a' ||
190
+ filterInputSelected === 'Horario maior que' ||
191
+ filterInputSelected === 'Horario menor que'
192
+ ? (
193
+ <div>
194
+ <p className='label' style={{ marginTop: '10px' }}>Valor</p>
195
+ <input
196
+ type={header?.headerGroup?.headers[header.index].column.columnDef.type}
197
+ className='select'
198
+ style={{ width: '100%' }}
199
+ value={value as any}
200
+ onChange={event => {
201
+ if (header?.headerGroup?.headers[header.index].column.columnDef.type === 'number') {
202
+ setValue(Number(event.target.value))
203
+ return
204
+ }
205
+ if (header?.headerGroup?.headers[header.index].column.columnDef.type === 'date') {
206
+ setValue(event.target.value)
207
+ return
224
208
  }
225
- ])
226
- header.column.setFilterValue(value)
227
- setOpenFilterOptions(false)
228
- setOpenFilterDialog('')
229
- setFilterInputSelected(false)
230
- setValue(null)
231
- }}
232
- >
233
- Buscar
234
- </Button>
235
- </div>
236
- )
237
- : null
238
- : null
239
- }
240
- </div>
241
- </S.ListFilterDialog>
242
- )
243
- : (
244
- <S.ListFilterDialog>
245
- <S.OptionFilterDialog style={{
246
- background: orderSmallest ? 'rgba(0, 0, 0, 0.04)' : ''
247
- }}>
248
- <div className='icon'>
249
- <svg fill="#666" stroke="currentColor" strokeWidth="1.5" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="20" height="20"><path strokeLinecap="round" strokeLinejoin="round" d="M12 4.5v15m0 0l6.75-6.75M12 19.5l-6.75-6.75"></path></svg>
250
- </div>
251
- <p onClick={() => {
252
- header.column.toggleSorting()
253
- setOrderSmallest(true)
254
- setOrderLargest(false)
255
- }}>Menor primeiro</p>
256
- </S.OptionFilterDialog>
257
- <S.OptionFilterDialog style={{
258
- background: orderLargest ? 'rgba(0, 0, 0, 0.04)' : ''
259
- }}>
260
- <div className='icon rotate'>
261
- <svg fill="#666" stroke="currentColor" strokeWidth="1.5" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="20" height="20"><path strokeLinecap="round" strokeLinejoin="round" d="M12 4.5v15m0 0l6.75-6.75M12 19.5l-6.75-6.75"></path></svg>
262
- </div>
263
- <p onClick={() => {
264
- header.column.toggleSorting()
265
- setOrderLargest(true)
266
- setOrderSmallest(false)
267
- }}>Maior primeiro</p>
268
- </S.OptionFilterDialog>
269
- <S.OptionFilterDialog>
270
- <div className='icon'>
271
- <svg fill="none" stroke="currentColor" strokeWidth="1.5" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="16" height="16"><path strokeLinecap="round" strokeLinejoin="round" 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"></path></svg>
209
+ setValue(event.target.value)
210
+ }}
211
+ />
212
+ <Button
213
+ color="primary"
214
+ type={"submit"}
215
+ disableElevation
216
+ style={{
217
+ marginTop: 8,
218
+ width: '100%'
219
+ }}
220
+ variant="contained"
221
+ onClick={() => {
222
+ setGlobalFilters((current: any) => [...current,
223
+ {
224
+ acessor: header.column.columnDef.accessorKey,
225
+ type: filterInputSelected,
226
+ value: value
227
+ }
228
+ ])
229
+ header.column.setFilterValue(value)
230
+ setOpenFilterOptions(false)
231
+ setOpenFilterDialog('')
232
+ setFilterInputSelected(false)
233
+ setValue(null)
234
+ }}
235
+ >
236
+ Buscar
237
+ </Button>
238
+ </div>
239
+ )
240
+ : null
241
+ : null
242
+ }
272
243
  </div>
273
- <p onClick={() => setOpenFilterOptions(true)}>Filtrar por</p>
274
- </S.OptionFilterDialog>
275
- </S.ListFilterDialog>
276
- )
277
- }
278
- </S.FilterDialog>
279
- </>
280
- ) : null
281
- }
282
- </div>
283
- </th>
284
- ))}
285
- </tr>
286
- ))}
287
- </thead>
288
- <TBody table={table} />
244
+ </S.ListFilterDialog>
245
+ )
246
+ : (
247
+ <S.ListFilterDialog>
248
+ <S.OptionFilterDialog style={{
249
+ background: orderSmallest ? 'rgba(0, 0, 0, 0.04)' : ''
250
+ }}>
251
+ <div className='icon'>
252
+ <svg fill="#666" stroke="currentColor" strokeWidth="1.5" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="20" height="20"><path strokeLinecap="round" strokeLinejoin="round" d="M12 4.5v15m0 0l6.75-6.75M12 19.5l-6.75-6.75"></path></svg>
253
+ </div>
254
+ <p onClick={() => {
255
+ header.column.toggleSorting()
256
+ setOrderSmallest(true)
257
+ setOrderLargest(false)
258
+ }}>Menor primeiro</p>
259
+ </S.OptionFilterDialog>
260
+ <S.OptionFilterDialog style={{
261
+ background: orderLargest ? 'rgba(0, 0, 0, 0.04)' : ''
262
+ }}>
263
+ <div className='icon rotate'>
264
+ <svg fill="#666" stroke="currentColor" strokeWidth="1.5" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="20" height="20"><path strokeLinecap="round" strokeLinejoin="round" d="M12 4.5v15m0 0l6.75-6.75M12 19.5l-6.75-6.75"></path></svg>
265
+ </div>
266
+ <p onClick={() => {
267
+ header.column.toggleSorting()
268
+ setOrderLargest(true)
269
+ setOrderSmallest(false)
270
+ }}>Maior primeiro</p>
271
+ </S.OptionFilterDialog>
272
+ <S.OptionFilterDialog>
273
+ <div className='icon'>
274
+ <svg fill="none" stroke="currentColor" strokeWidth="1.5" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="16" height="16"><path strokeLinecap="round" strokeLinejoin="round" 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"></path></svg>
275
+ </div>
276
+ <p onClick={() => setOpenFilterOptions(true)}>Filtrar por</p>
277
+ </S.OptionFilterDialog>
278
+ </S.ListFilterDialog>
279
+ )
280
+ }
281
+ </S.FilterDialog>
282
+ </>
283
+ ) : null
284
+ }
285
+ </div>
286
+ </th>
287
+ ))}
288
+ </tr>
289
+ ))}
290
+ </thead>
291
+ <TBody
292
+ table={table}
293
+ onClick={onClick}
294
+ onMouseOver={onMouseOver}
295
+ onMouseOut={onMouseOut}
296
+ />
297
+ </S.Table>
289
298
  </S.Content>
290
299
  <Pagination table={table} />
291
300
  </S.Container>
@@ -3,6 +3,12 @@ import { ColumnDef } from '@tanstack/react-table'
3
3
  export interface TablePropos {
4
4
  data: any
5
5
  columns: ColumnDef<ColumnsTable>[]
6
+ onClick: any
7
+ onMouseOver: any
8
+ onMouseOut: any
9
+ showTotalResults: boolean
10
+ showSettings: boolean
11
+ minHeight: string
6
12
  }
7
13
 
8
14
  export interface ColumnsTable {
@@ -4,9 +4,14 @@ export const Container = styled.div`
4
4
  width: 100%;
5
5
  background: #fff;
6
6
  box-shadow: 0px 2px 6px #0000000A;
7
+ padding: 24px 0;
7
8
  `
8
9
 
9
- export const Content = styled.table`
10
+ export const Content = styled.div<any>`
11
+ min-height: ${props => props.minHeight ? props.minHeight : 'auto'};
12
+ `
13
+
14
+ export const Table = styled.table`
10
15
  border-collapse: collapse;
11
16
  width: 100%;
12
17
  thead {