norma-library 0.5.813 → 0.5.814

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 (35) hide show
  1. package/dist/esm/components/Table/components/header/index.js +3 -3
  2. package/dist/esm/components/Table/components/header/index.js.map +1 -1
  3. package/dist/esm/components/Table/components/header/styles.d.ts +1 -0
  4. package/dist/esm/components/Table/components/header/styles.js +5 -4
  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/index.js +111 -110
  11. package/dist/esm/components/Table/index.js.map +1 -1
  12. package/dist/esm/components/Table/styles.d.ts +2 -1
  13. package/dist/esm/components/Table/styles.js +11 -10
  14. package/dist/esm/components/Table/styles.js.map +1 -1
  15. package/package.json +1 -1
  16. package/src/components/Table/components/header/index.tsx +10 -8
  17. package/src/components/Table/components/header/styles.tsx +5 -0
  18. package/src/components/Table/components/pagination/index.tsx +6 -6
  19. package/src/components/Table/components/pagination/styles.tsx +12 -0
  20. package/src/components/Table/index.tsx +164 -162
  21. package/src/components/Table/styles.tsx +6 -1
  22. package/src/stories/Table.stories.tsx +105 -105
  23. package/dist/Button/index.d.ts +0 -9
  24. package/dist/Button/types.d.ts +0 -18
  25. package/dist/Card/Card.d.ts +0 -3
  26. package/dist/Card/CardHeader.d.ts +0 -3
  27. package/dist/Card/index.d.ts +0 -4
  28. package/dist/Card/styles.d.ts +0 -546
  29. package/dist/Card/types.d.ts +0 -8
  30. package/dist/index.d.ts +0 -2
  31. package/dist/index.es.js +0 -6992
  32. package/dist/index.es.js.map +0 -1
  33. package/dist/index.umd.js +0 -266
  34. package/dist/index.umd.js.map +0 -1
  35. package/dist/vite.svg +0 -1
@@ -8,20 +8,20 @@ const Pagination:React.FC<any> = ({ table }) => {
8
8
  <button
9
9
  className='button'
10
10
  onClick={() => table.previousPage()}
11
- disabled={!table.getCanPreviousPage()}
11
+ disabled={1 === table.getState().pagination.pageIndex + 1}
12
12
  >
13
13
  {'<'}
14
14
  </button>
15
15
  {
16
16
  table.getPageCount()
17
- ? new Array(table.getPageCount()).fill(0).map((item, index) => {
17
+ ? new Array(Math.ceil(table.getPageCount() / 10)).fill(0).map((item, index) => {
18
18
  return (
19
19
  <button
20
20
  key={item}
21
- className='button'
22
- onClick={() => table.previousPage()}
21
+ className={ table.getState().pagination.pageIndex == index ? 'button-active' : 'button'}
22
+ onClick={() => table.setPageIndex(index)}
23
23
  >
24
- {index}
24
+ {index + 1}
25
25
  </button>
26
26
  )
27
27
  })
@@ -30,7 +30,7 @@ const Pagination:React.FC<any> = ({ table }) => {
30
30
  <button
31
31
  className='button'
32
32
  onClick={() => table.nextPage()}
33
- disabled={!table.getCanNextPage()}
33
+ disabled={Math.ceil(table.getPageCount() / 10) === table.getState().pagination.pageIndex + 1}
34
34
  >
35
35
  {'>'}
36
36
  </button>
@@ -14,6 +14,18 @@ export const Pagination = styled.div`
14
14
  padding: 12px 16px;
15
15
  border-radius: 4px;
16
16
  color: #4D4F5C;
17
+ cursor: pointer;
18
+ &:disabled {
19
+ opacity: 0.4;
20
+ }
21
+ }
22
+ .button-active {
23
+ border: 1px solid #FFDB9F;
24
+ background: #FFDB9F;
25
+ color: #B74616;
26
+ padding: 12px 16px;
27
+ border-radius: 4px;
28
+ cursor: pointer;
17
29
  }
18
30
  }
19
31
  `
@@ -122,170 +122,172 @@ const Table:React.FC<TablePropos> = ({ data, columns }) => {
122
122
  setOrderSmallest={setOrderSmallest}
123
123
  />
124
124
  <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
125
+ <S.Table>
126
+ <thead>
127
+ {table.getHeaderGroups().map((headerGroup: any) => (
128
+ <tr key={headerGroup.id}>
129
+ {headerGroup.headers.map((header: any) => (
130
+ <th key={header.id}>
131
+ <div>
132
+ <S.ColumnContent>
133
+ <S.TextColumn>
134
+ {header.isPlaceholder
135
+ ? null
136
+ : flexRender(
137
+ header.column.columnDef.header,
138
+ header.getContext()
139
+ )}
140
+ </S.TextColumn>
141
+ <S.IconFilterDialog onClick={() => {
142
+ setOpenFilterDialog(header.column.columnDef.accessorKey)
143
+ }}>
144
+ <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>
145
+ </S.IconFilterDialog>
146
+ </S.ColumnContent>
147
+ { openFilterDialog === header.column.columnDef.accessorKey
148
+ ? (
149
+ <>
150
+ <S.backgroundDialog onClick={() => {
151
+ setOpenFilterDialog('')
152
+ setOpenFilterOptions(false)
153
+ }}></S.backgroundDialog>
154
+ <S.FilterDialog>
155
+ {
156
+ openFilterOptions
157
+ ? (
158
+ <S.ListFilterDialog>
159
+ <p className='label'>Selecione um filtro</p>
160
+ <select className='select' value={filterInputSelected} onChange={(event) => {
161
+ setFilterInputSelected(event.target.value)
162
+ }}>
163
+ <option>Selecione...</option>
164
+ { header?.headerGroup?.headers[header.index].column.columnDef.type === 'text' ? <option>Igual a</option> : null }
165
+ { header?.headerGroup?.headers[header.index].column.columnDef.type === 'text' ? <option>Não é igual a</option> : null }
166
+ { header?.headerGroup?.headers[header.index].column.columnDef.type === 'text' ? <option>Contém</option> : null }
167
+ { header?.headerGroup?.headers[header.index].column.columnDef.type === 'number' ? <option>Maior que</option> : null }
168
+ { header?.headerGroup?.headers[header.index].column.columnDef.type === 'number' ? <option>Menor que</option> : null }
169
+ { header?.headerGroup?.headers[header.index].column.columnDef.type === 'number' ? <option>Igual a</option> : null }
170
+ { header?.headerGroup?.headers[header.index]. column.columnDef.type === 'date' ? <option>Data Igual a</option> : null }
171
+ { header?.headerGroup?.headers[header.index]. column.columnDef.type === 'date' ? <option>Data maior que</option> : null }
172
+ { header?.headerGroup?.headers[header.index]. column.columnDef.type === 'date' ? <option>Data menor que</option> : null }
173
+ { header?.headerGroup?.headers[header.index]. column.columnDef.type === 'time' ? <option>Horario Igual a</option> : null }
174
+ { header?.headerGroup?.headers[header.index]. column.columnDef.type === 'time' ? <option>Horario maior que</option> : null }
175
+ { header?.headerGroup?.headers[header.index]. column.columnDef.type === 'time' ? <option>Horario menor que</option> : null }
176
+ </select>
177
+ <div>
178
+ { header.column.getCanFilter()
179
+ ? filterInputSelected === 'Igual a' ||
180
+ filterInputSelected === 'Não é igual a' ||
181
+ filterInputSelected === 'Contém' ||
182
+ filterInputSelected === 'Maior que' ||
183
+ filterInputSelected === 'Menor que' ||
184
+ filterInputSelected === 'Data Igual a' ||
185
+ filterInputSelected === 'Data maior que' ||
186
+ filterInputSelected === 'Data menor que' ||
187
+ filterInputSelected === 'Horario Igual a' ||
188
+ filterInputSelected === 'Horario maior que' ||
189
+ filterInputSelected === 'Horario menor que'
190
+ ? (
191
+ <div>
192
+ <p className='label' style={{ marginTop: '10px' }}>Valor</p>
193
+ <input
194
+ type={header?.headerGroup?.headers[header.index].column.columnDef.type}
195
+ className='select'
196
+ style={{ width: '100%' }}
197
+ value={value as any}
198
+ onChange={event => {
199
+ if (header?.headerGroup?.headers[header.index].column.columnDef.type === 'number') {
200
+ setValue(Number(event.target.value))
201
+ return
202
+ }
203
+ if (header?.headerGroup?.headers[header.index].column.columnDef.type === 'date') {
204
+ setValue(event.target.value)
205
+ return
224
206
  }
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>
207
+ setValue(event.target.value)
208
+ }}
209
+ />
210
+ <Button
211
+ color="primary"
212
+ type={"submit"}
213
+ disableElevation
214
+ style={{
215
+ marginTop: 8,
216
+ width: '100%'
217
+ }}
218
+ variant="contained"
219
+ onClick={() => {
220
+ setGlobalFilters((current: any) => [...current,
221
+ {
222
+ acessor: header.column.columnDef.accessorKey,
223
+ type: filterInputSelected,
224
+ value: value
225
+ }
226
+ ])
227
+ header.column.setFilterValue(value)
228
+ setOpenFilterOptions(false)
229
+ setOpenFilterDialog('')
230
+ setFilterInputSelected(false)
231
+ setValue(null)
232
+ }}
233
+ >
234
+ Buscar
235
+ </Button>
236
+ </div>
237
+ )
238
+ : null
239
+ : null
240
+ }
272
241
  </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} />
242
+ </S.ListFilterDialog>
243
+ )
244
+ : (
245
+ <S.ListFilterDialog>
246
+ <S.OptionFilterDialog style={{
247
+ background: orderSmallest ? 'rgba(0, 0, 0, 0.04)' : ''
248
+ }}>
249
+ <div className='icon'>
250
+ <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>
251
+ </div>
252
+ <p onClick={() => {
253
+ header.column.toggleSorting()
254
+ setOrderSmallest(true)
255
+ setOrderLargest(false)
256
+ }}>Menor primeiro</p>
257
+ </S.OptionFilterDialog>
258
+ <S.OptionFilterDialog style={{
259
+ background: orderLargest ? 'rgba(0, 0, 0, 0.04)' : ''
260
+ }}>
261
+ <div className='icon rotate'>
262
+ <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>
263
+ </div>
264
+ <p onClick={() => {
265
+ header.column.toggleSorting()
266
+ setOrderLargest(true)
267
+ setOrderSmallest(false)
268
+ }}>Maior primeiro</p>
269
+ </S.OptionFilterDialog>
270
+ <S.OptionFilterDialog>
271
+ <div className='icon'>
272
+ <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>
273
+ </div>
274
+ <p onClick={() => setOpenFilterOptions(true)}>Filtrar por</p>
275
+ </S.OptionFilterDialog>
276
+ </S.ListFilterDialog>
277
+ )
278
+ }
279
+ </S.FilterDialog>
280
+ </>
281
+ ) : null
282
+ }
283
+ </div>
284
+ </th>
285
+ ))}
286
+ </tr>
287
+ ))}
288
+ </thead>
289
+ <TBody table={table} />
290
+ </S.Table>
289
291
  </S.Content>
290
292
  <Pagination table={table} />
291
293
  </S.Container>
@@ -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`
11
+ min-height: 535px;
12
+ `
13
+
14
+ export const Table = styled.table`
10
15
  border-collapse: collapse;
11
16
  width: 100%;
12
17
  thead {