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