@propellerads/table 2.1.0 → 4.3.0

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/src/style.tsx CHANGED
@@ -1,12 +1,14 @@
1
- import styled, {createGlobalStyle, keyframes} from 'styled-components';
1
+ /* eslint max-len: off */
2
+ import styled, {
3
+ keyframes, css, CSSObject,
4
+ } from 'styled-components';
2
5
  import {
3
- fontNormal,
4
- white,
5
- black,
6
- spacing,
7
- gray80,
8
- gray95,
9
- semiWhite,
6
+ fontNormal,
7
+ white,
8
+ black,
9
+ spacing,
10
+ gray80,
11
+ gray95,
10
12
  } from '@propellerads/stylevariables';
11
13
 
12
14
  const loadingAnimation = keyframes`
@@ -21,433 +23,182 @@ const loadingAnimation = keyframes`
21
23
  }
22
24
  `;
23
25
 
24
- export const EmptyStateCell = styled.div`
25
- width: 100%;
26
- height: ${spacing * 4}px;
27
- background: linear-gradient(to left, ${gray95}, ${white}, ${gray95});
28
- background-size: 200% 200%;
29
- animation: ${loadingAnimation} 1.6s linear infinite;
26
+ export const TableLoading = styled.div`
27
+ display: block;
28
+ position: absolute;
29
+ left: 0;
30
+ right: 0;
31
+ top: 0;
32
+ bottom: 0;
33
+ background: rgba(255, 255, 255, 0.8);
34
+ transition: all 0.3s ease;
35
+ z-index: -1;
36
+ opacity: 0;
37
+ pointer-events: none;
38
+
39
+ ${(props: { isLoading: boolean }) => props.isLoading && css`
40
+ opacity: 1;
41
+ z-index: 2;
42
+ pointer-events: all;
43
+ `}
30
44
  `;
31
45
 
32
- const CommonStyles = createGlobalStyle`
33
-
34
- .ReactTable {
35
- font-size: ${fontNormal}px;
36
- position: relative;
37
- display: flex;
38
- flex-direction: column;
39
- border: 0;
40
-
41
- .pagination-bottom {
42
- padding: 24px 0;
43
- }
44
-
45
- &__header-cell_right {
46
- text-align: right !important;
47
- flex-direction: row !important;
48
- justify-content: flex-end !important;
49
-
50
- &:before {
51
- margin-left: 0 !important;
52
- margin-right: 4px !important;
53
- }
54
- }
55
-
56
- .rt-thead {
57
- flex: 1 0 auto;
58
- display: flex;
59
- flex-direction: column;
60
- user-select: none;
61
- }
62
-
63
- .rt-table {
64
- flex: auto 1;
65
- display: flex;
66
- flex-direction: column;
67
- align-items: stretch;
68
- width: 100%;
69
- border-collapse: collapse;
70
- overflow: auto;
71
- }
72
- }
73
-
74
- .ReactTable .rt-thead.-filters input,
75
- .ReactTable .rt-thead.-filters select {
76
- border: 1px solid rgba(0, 0, 0, 0.1);
77
- background: ${white};
78
- padding: 2px 7px;
79
- margin: 4px 0;
80
- font-size: inherit;
81
- border-radius: 3px;
82
- font-weight: normal;
83
- outline: none;
84
- }
85
-
86
- .ReactTable .rt-thead .rt-th,
87
- .ReactTable .rt-thead .rt-td {
88
- padding: 0 4px;
89
- line-height: normal;
90
- position: relative;
91
- transition: box-shadow 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
92
- color: ${black};
93
- font-weight: 500;
94
- outline: none;
95
- }
96
-
97
- .ReactTable .rt-thead .rt-th {
98
- display: flex;
99
- }
100
-
101
- .ReactTable .rt-thead .rt-th.-cursor-pointer,
102
- .ReactTable .rt-thead .rt-td.-cursor-pointer {
103
- cursor: pointer;
104
- transition: 220ms ease;
105
- display: flex;
106
- flex-direction: row-reverse;
107
- justify-content: flex-end;
108
- align-items: center;
109
-
110
-
111
- &:before {
112
- transition: 220ms ease;
113
- content: '';
114
- min-width: 12px;
115
- width: 12px;
116
- height: 12px;
117
- background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAAEEfUpiAAAABGdBTUEAALGPC/xhBQAAAlZJREFUWAntVklSwzAQtJ1ck/AYtpA78COKLEWoLHe+wx3C8hggOSehW7iNrMgb5gIVVblmNOrpGWuksYMgHv1+f0s1kkEyGg6HY00SSaNcEmO2YkMTnUoycX3dhZ28XAcD8KXlMhlHHzDF6PMql0OKxpkUMjQZNwzD3mw2e7SdB4PB23a7PQhpjEFdGBbz+TzE/B3mDnUDEIgSbEsA21zkPDXIxCdlzJuUcSh8y7wAXKtN0CQLU/VtJdeyBrcZPneGIIqi281m8wCioNFonE0mk0WWIzCmBNjpALUbp7aapw1EN3QGu6kbdbt2mlNypAi+TEFgE8lG6a2tDXD1wvPvOrjzv3EOah+k/0AQ13rpljBvjntwyBITE8VHtwVDKZLRaHSEe/BKZwaPrONZSILIx+v1+sVExgWcTqdjUwWbBKAPAtxBZ0R+pp23l85QvxuKSNgQXRKkfeJzJsHObdTmqLsSpGFHlm2HgAsiEYjS50y7l4ALNkmWM3G5gyQsVR4oM4M8J67ZGXKuIlCvMmpfxirBfNh9AvsdSHYAp/oaLaPnOyi/aUObYiu+EmfIe6q/idi4Qhu6dH8Z5SBZ9RqyjSPOPXrigTjYYCLTkqHICNkCiP9JSzh1LfuPVAYG1zs/A25wxk41Is9uMOgKP2wX7g9b0Q7En497+HdIouG21VQCAvkS4dcB6xcozRNxWQmUDaxY3gS0mJUI3uIcW2oSERa7dBrXuC0bpfvG9hr13AQE9iWitSxZFFh+pRIQuEwiZQOLs1ICcvIlUjWwuGpJJsKnDskn5F1o5Z7NGz4AAAAASUVORK5CYII=');
118
- background-size: contain;
119
- opacity: 0;
120
- margin-left: 4px;
121
- }
122
- }
46
+ export const TableLoadingInner = styled.div`
47
+ position: absolute;
48
+ display: block;
49
+ text-align: center;
50
+ width: 100%;
51
+ top: 50%;
52
+ left: 0;
53
+ color: rgba(0, 0, 0, 0.6);
54
+ transform: translateY(-52%);
55
+ transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
56
+ `;
123
57
 
124
- .ReactTable .rt-thead .rt-th.-sort-asc,
125
- .ReactTable .rt-thead .rt-td.-sort-asc {
126
- padding-left: 4px;
58
+ export const TableWrapper = styled.div`
59
+ position: relative;
60
+ overflow: hidden;
61
+
62
+ &::before {
63
+ bottom: 10px;
64
+ content: '';
65
+ opacity: 0;
66
+ pointer-events: none;
67
+ position: absolute;
68
+ width: 10px;
69
+ height: 100%;
70
+ top: 0;
71
+ left: -10px;
72
+ box-shadow: 0 3px 6px 0 rgba(0,0,0,0.2);
73
+ transition: 0.3s opacity;
74
+ }
127
75
 
128
- &:before {
129
- transform: rotate(180deg);
130
- opacity: 1;
76
+ &::after {
77
+ bottom: 10px;
78
+ content: '';
79
+ opacity: 0;
80
+ pointer-events: none;
81
+ width: 10px;
82
+ height: 100%;
83
+ position: absolute;
84
+ top: 0;
85
+ right: -10px;
86
+ box-shadow: 0 3px 6px 0 rgba(0,0,0,0.2);
87
+ transition: 0.3s opacity;
88
+ }
89
+
90
+ &.shadow_left {
91
+ &::before {
92
+ opacity: 1 !important;
131
93
  }
132
- }
133
-
134
- .ReactTable .rt-thead .rt-th.-sort-desc,
135
- .ReactTable .rt-thead .rt-td.-sort-desc {
136
- padding-left: 4px;
137
-
138
- &:before {
139
- opacity: 1;
94
+ }
95
+
96
+ &.shadow_right {
97
+ &::after {
98
+ opacity: 1 !important;
140
99
  }
141
- }
142
-
143
- .ReactTable .rt-thead .rt-th:last-child,
144
- .ReactTable .rt-thead .rt-td:last-child {
145
- border-right: 0;
146
- }
147
-
148
- .ReactTable .rt-thead .rt-resizable-header {
149
- overflow: visible;
150
- display: flex;
151
- align-items: center;
152
- }
153
-
154
- .ReactTable .rt-thead .rt-resizable-header:last-child {
155
- overflow: hidden;
156
- }
157
-
158
- .ReactTable .rt-thead .rt-resizable-header-content {
159
- overflow: hidden;
160
- text-overflow: ellipsis;
161
- }
162
-
163
- .ReactTable .rt-thead .rt-header-pivot {
164
- border-right-color: #f7f7f7;
165
- }
166
-
167
- .ReactTable .rt-thead .rt-header-pivot:after,
168
- .ReactTable .rt-thead .rt-header-pivot:before {
169
- left: 100%;
170
- top: 50%;
171
- border: solid transparent;
172
- content: ' ';
173
- height: 0;
174
- width: 0;
175
- position: absolute;
176
- pointer-events: none;
177
- }
178
-
179
- .ReactTable .rt-thead .rt-header-pivot:after {
180
- border-color: rgba(255, 255, 255, 0);
181
- border-left-color: ${white};
182
- border-width: 8px;
183
- margin-top: -8px;
184
- }
185
-
186
- .ReactTable .rt-thead .rt-header-pivot:before {
187
- border-color: rgba(102, 102, 102, 0);
188
- border-left-color: #f7f7f7;
189
- border-width: 10px;
190
- margin-top: -10px;
191
- }
192
-
193
- .ReactTable .rt-tbody {
194
- flex: 99999 1 auto;
195
- display: flex;
196
- flex-direction: column;
197
- overflow: auto;
198
- border-top: 1px solid ${gray80};
199
- margin-top: ${spacing * 2}px;
200
- }
201
-
202
- .ReactTable .rt-tbody .rt-tr-group {
203
- box-shadow: inset 0 -1px 0 0 ${gray95};
204
- }
205
-
206
- .ReactTable .rt-tbody .rt-tr-group:hover {
207
- background-color: ${semiWhite};
208
- transition: 0.2s ease-in-out;
209
- }
100
+ }
101
+ `;
210
102
 
211
- .ReactTable .rt-tbody .rt-td:last-child {
212
- border-right: 0;
213
- }
103
+ export const TableRoot = styled.div`
104
+ font-size: ${fontNormal}px;
105
+ position: relative;
106
+ display: flex;
107
+ flex-direction: column;
108
+ border: 0;
109
+ `;
214
110
 
215
- .ReactTable .rt-tbody .rt-expandable {
216
- cursor: pointer;
217
- text-overflow: clip;
218
- }
111
+ export const TableContent = styled.div`
112
+ display: block;
113
+ max-width: 100%;
114
+ overflow-x: scroll;
115
+ overflow-y: hidden;
116
+ `;
219
117
 
220
- .ReactTable .rt-tr-group {
221
- flex: 1 0 auto;
222
- display: flex;
223
- flex-direction: column;
224
- align-items: stretch;
225
- }
118
+ export const TableCore = styled.div`
119
+ flex: auto 1;
120
+ display: flex;
121
+ flex-direction: column;
122
+ align-items: stretch;
123
+ border-collapse: collapse;
124
+ `;
226
125
 
227
- .ReactTable .rt-tr {
228
- flex: 1 0 auto;
229
- display: inline-flex;
230
- padding: 0;
231
- align-items: center;
232
- }
126
+ export const HeadCell = styled.div`
127
+ display: inline-flex;
128
+ `;
233
129
 
234
- .ReactTable .rt-th,
235
- .ReactTable .rt-td {
236
- flex: 1 0 0;
130
+ export const TD = styled.div`
237
131
  white-space: nowrap;
238
132
  text-overflow: ellipsis;
133
+ line-height: 1.3rem;
239
134
  padding: 7px 4px;
240
135
  overflow: hidden;
241
- transition: 0.3s ease;
242
- transition-property: width, min-width, padding, opacity;
243
- line-height: 1.3rem;
244
- }
245
-
246
- .ReactTable .rt-th.-hidden,
247
- .ReactTable .rt-td.-hidden {
248
- width: 0 !important;
249
- min-width: 0 !important;
250
- padding: 0 !important;
251
- border: 0 !important;
252
- opacity: 0 !important;
253
- }
254
-
255
- .ReactTable .rt-expander {
256
- display: inline-block;
257
- position: relative;
258
- color: transparent;
259
- margin: 0 10px;
260
- }
261
-
262
- .ReactTable .rt-expander:after {
263
- content: '';
264
- position: absolute;
265
- width: 0;
266
- height: 0;
267
- top: 50%;
268
- left: 50%;
269
- transform: translate(-50%, -50%) rotate(-90deg);
270
- border-left: 5.04px solid transparent;
271
- border-right: 5.04px solid transparent;
272
- border-top: 7px solid rgba(0, 0, 0, 0.8);
273
- transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
274
- cursor: pointer;
275
- }
276
-
277
- .ReactTable .rt-expander.-open:after {
278
- transform: translate(-50%, -50%) rotate(0);
279
- }
280
-
281
- .ReactTable .rt-resizer {
282
- display: inline-block;
283
- position: absolute;
284
- width: 36px;
285
- top: 0;
286
- bottom: 0;
287
- right: -18px;
288
- cursor: col-resize;
289
- z-index: 10;
290
- }
291
-
292
- .ReactTable .rt-tfoot {
293
- background: ${gray95};
294
- flex: 1 0 auto;
295
- display: flex;
296
- flex-direction: column;
297
- }
298
-
299
- .ReactTable .rt-tfoot .rt-td {
300
- }
301
-
302
- .ReactTable .rt-tfoot .rt-td:last-child {
303
- border-right: 0;
304
- }
305
-
306
- .ReactTable.-striped .rt-tr.-odd {
307
- background: rgba(0, 0, 0, 0.03);
308
- }
309
-
310
- .ReactTable.-highlight .rt-tbody .rt-tr:not(.-padRow):hover {
311
- background: rgba(0, 0, 0, 0.05);
136
+ transition: width 0.3s ease 0s, min-width, padding, opacity;
137
+
138
+ ${({align}: { align?: CSSObject, colSpan?: number }) => align && css`
139
+ text-align: ${align}`
312
140
  }
141
+ `;
313
142
 
314
- .ReactTable .-pagination {
315
- z-index: 1;
316
- display: flex;
317
- justify-content: space-between;
318
- align-items: stretch;
319
- flex-wrap: wrap;
320
- padding: 3px;
321
- }
143
+ export const EmptyStateCell = styled.div`
144
+ width: 100%;
145
+ height: ${spacing * 4}px;
146
+ background: linear-gradient(to left, ${gray95}, ${white}, ${gray95});
147
+ background-size: 200% 200%;
148
+ animation: ${loadingAnimation} 1.6s linear infinite;
149
+ `;
322
150
 
323
- .ReactTable .-pagination input,
324
- .ReactTable .-pagination select {
325
- border: 1px solid rgba(0, 0, 0, 0.1);
326
- background: ${white};
327
- padding: 5px 7px;
328
- font-size: inherit;
329
- border-radius: 3px;
330
- font-weight: normal;
331
- outline: none;
332
- }
151
+ export const TH = styled.div`
152
+ padding: 0 4px;
153
+ line-height: normal;
154
+ position: relative;
155
+ transition: box-shadow 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0s;
156
+ color: rgb(0, 0, 0);
157
+ font-weight: 500;
158
+ outline: none;
159
+ `;
333
160
 
334
- .ReactTable .-pagination .-btn {
335
- appearance: none;
336
- display: block;
337
- width: 100%;
338
- height: 100%;
339
- border: 0;
340
- border-radius: 3px;
341
- padding: 6px;
342
- font-size: 1em;
343
- color: rgba(0, 0, 0, 0.6);
344
- transition: all 0.1s ease;
345
- cursor: pointer;
161
+ export const THead = styled.div`
162
+ flex: 1 0 auto;
163
+ display: flex;
164
+ flex-direction: column;
165
+ user-select: none;
166
+
167
+ ${TH}, ${TD} {
168
+ padding: 0 4px;
169
+ line-height: normal;
170
+ position: relative;
171
+ transition: box-shadow 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
172
+ color: ${black};
173
+ font-weight: 500;
346
174
  outline: none;
347
- background-color: white;
348
- color: #0080ff;
349
- box-shadow: inset 0 0 0 1px #0080ff;
350
- }
351
-
352
- .ReactTable .-pagination .-btn[disabled] {
353
- opacity: 0;
354
- cursor: default;
355
- }
356
-
357
- .ReactTable .-pagination .-btn:not([disabled]):hover {
358
- }
359
-
360
- .ReactTable .-pagination .-previous,
361
- .ReactTable .-pagination .-next {
362
- flex: 1;
363
- text-align: center;
364
- }
365
-
366
- .ReactTable .-pagination .-center {
367
- flex: 1.5;
368
- text-align: center;
369
- margin-bottom: 0;
370
- display: -webkit-box;
371
- display: -ms-flexbox;
372
- display: flex;
373
- flex-direction: row;
374
- flex-wrap: wrap;
375
- align-items: center;
376
- justify-content: space-around;
377
- }
378
-
379
- .ReactTable .-pagination .-pageInfo {
380
- display: inline-block;
381
- margin: 3px 10px;
382
- white-space: nowrap;
383
- }
384
-
385
- .ReactTable .-pagination .-pageJump {
386
- display: inline-block;
387
- }
388
-
389
- .ReactTable .-pagination .-pageJump input {
390
- width: 70px;
391
- text-align: center;
392
- }
393
-
394
- .ReactTable .-pagination .-pageSizeOptions {
395
- margin: 3px 10px;
396
- }
397
-
398
- .ReactTable .rt-noData {
399
- display: flex;
400
- justify-content: center;
401
- background: transparent;
402
- transition: all 0.3s ease;
403
- z-index: 1;
404
- pointer-events: none;
405
- color: rgba(0, 0, 0, 0.5);
406
- }
407
-
408
- .ReactTable .-loading {
409
- display: block;
410
- position: absolute;
411
- left: 0;
412
- right: 0;
413
- top: 0;
414
- bottom: 0;
415
- background: rgba(255, 255, 255, 0.8);
416
- transition: all 0.3s ease;
417
- z-index: -1;
418
- opacity: 0;
419
- pointer-events: none;
420
- }
421
-
422
- .ReactTable .-loading > div {
423
- position: absolute;
424
- display: block;
425
- text-align: center;
426
- width: 100%;
427
- top: 50%;
428
- left: 0;
429
- font-size: 15px;
430
- color: rgba(0, 0, 0, 0.6);
431
- transform: translateY(-52%);
432
- transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
433
- }
175
+ }
176
+ `;
434
177
 
435
- .ReactTable .-loading.-active {
436
- opacity: 1;
437
- z-index: 2;
438
- pointer-events: all;
439
- }
178
+ export const TRGroup = styled.div`
179
+ display: flex;
180
+ flex: 1 0 auto;
181
+ box-shadow: inset 0 -1px 0 0 ${gray95};
182
+ min-width: 100%;
183
+ width: max-content;
184
+ `;
440
185
 
441
- .ReactTable .-loading.-active > div {
442
- transform: translateY(50%);
443
- }
186
+ export const TR = styled.div`
187
+ padding: 0;
188
+ -webkit-box-align: center;
189
+ align-items: center;
190
+ `;
444
191
 
445
- .ReactTable .rt-resizing .rt-th,
446
- .ReactTable .rt-resizing .rt-td {
447
- transition: none !important;
448
- cursor: col-resize;
449
- user-select: none;
450
- }
192
+ export const TBody = styled.div`
193
+ border-top: 1px solid ${gray80};
194
+ margin-top: ${spacing * 2}px;
195
+ min-width: 100%;
196
+ width: max-content;
451
197
  `;
452
198
 
453
- export {CommonStyles};
199
+ export const TFoot = styled.div`
200
+ background: ${gray95};
201
+ flex: 1 0 auto;
202
+ display: flex;
203
+ flex-direction: column;
204
+ `;