ehscan-react-table 0.0.1 → 0.0.2

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.
@@ -1 +1,2 @@
1
1
  export { Table } from './elements/Table';
2
+ export { Pagination } from './elements/Pagination';
@@ -1,2 +1,3 @@
1
1
  // ehscan-react-table entry
2
2
  export { Table } from './elements/Table';
3
+ export { Pagination } from './elements/Pagination';
@@ -6,5 +6,5 @@ interface Props {
6
6
  currentPage: number;
7
7
  onPageChange: (page: number) => void;
8
8
  }
9
- declare const Pagination: React.FC<Props>;
10
- export default Pagination;
9
+ export declare const Pagination: React.FC<Props>;
10
+ export {};
@@ -1,8 +1,8 @@
1
1
  import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useState, useEffect } from "react";
3
3
  import PaginationButton from "./PaginationButton";
4
- import styles from '../style/table.module.css';
5
- const Pagination = ({ totalItems, currentEntries, limit, skip, currentPage, onPageChange }) => {
4
+ import styles from './table.module.css';
5
+ export const Pagination = ({ totalItems, currentEntries, limit, skip, currentPage, onPageChange }) => {
6
6
  const [totalPages, setTotalPages] = useState(0);
7
7
  const handlePrevious = () => {
8
8
  if (currentPage > 1)
@@ -48,4 +48,3 @@ const Pagination = ({ totalItems, currentEntries, limit, skip, currentPage, onPa
48
48
  return (_jsx(PaginationButton, { txt: p, isActive: p === currentPage, disabled: isEllipsis, action: isEllipsis ? undefined : () => handlePageClick(p) }, i));
49
49
  }), _jsx(PaginationButton, { index: 'next', action: handleNext, display: totalPages > 2 && currentPage !== totalPages })] })) }), _jsx(PaginationOutput, {})] }));
50
50
  };
51
- export default Pagination;
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useRef } from 'react';
3
3
  import PaginationRipple from './PaginationRipple';
4
- import styles from '../table.module.css';
4
+ import styles from './table.module.css';
5
5
  const PaginationButton = ({ index, txt, disabled, isActive, action, display }) => {
6
6
  const buttonRef = useRef(null);
7
7
  const handleRipple = PaginationRipple();
@@ -1,5 +1,5 @@
1
1
  import { useCallback } from 'react';
2
- import styles from '../table.module.css';
2
+ import styles from './table.module.css';
3
3
  const PaginationRipple = () => {
4
4
  const handleRipple = useCallback((event, buttonRef) => {
5
5
  const button = buttonRef.current;
@@ -11,7 +11,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
11
11
  import { useEffect, useState, useRef } from "react";
12
12
  import TableCellSelectHeadCol from "./TableCellSelectHeadCol";
13
13
  import { debounce } from "./Debounce";
14
- import styles from '../style/table.module.css';
14
+ import styles from './table.module.css';
15
15
  export const Table = ({ columns, rows, sortOrder, setSortOrder, cellComponents, setSelectedIds, searchTermArraySetter, setSearchTermArraySetter, fallback }) => {
16
16
  const [wrapperBottom, setWrapperBottom] = useState(undefined);
17
17
  const headerRef = useRef(null);
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
11
11
  import { useRef } from 'react';
12
12
  import PaginationRipple from './PaginationRipple';
13
- import styles from '../style/table.module.css';
13
+ import styles from './table.module.css';
14
14
  const TableChecklistItem = ({ checked }) => {
15
15
  const buttonRef = useRef(null);
16
16
  const handleRipple = PaginationRipple();
package/package.json CHANGED
@@ -1,13 +1,11 @@
1
1
  {
2
2
  "name": "ehscan-react-table",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "components",
5
5
  "main": "dist/Components.js",
6
6
  "types": "dist/Components.d.ts",
7
7
  "scripts": {
8
- "build": "tsc && npm run copy-css",
9
- "copy-css": "rsync -a src/style/ dist/style/",
10
- "prepublishOnly": "npm run build"
8
+ "build": "tsc"
11
9
  },
12
10
  "keywords": [
13
11
  "react",
@@ -31,5 +29,8 @@
31
29
  "glob": "8",
32
30
  "minimatch": "5",
33
31
  "typescript": "^5.6.3"
32
+ },
33
+ "dependencies": {
34
+ "vite-plugin-libcss": "^1.1.2"
34
35
  }
35
36
  }
@@ -1,494 +0,0 @@
1
- /* --------------------------
2
- General Settings
3
- -------------------------- */
4
- html,
5
- body,
6
- input,
7
- textarea {
8
- height: 100%;
9
- font-family: Arial, sans-serif;
10
- font-family: Inter, sans-serif;
11
- font-style: 400;
12
- font-optical-sizing: auto;
13
- -webkit-font-smoothing: antialiased;
14
- text-rendering: optimizelegibility;
15
- letter-spacing: 0.072px;
16
- overflow: hidden;
17
- color: #222;
18
- }
19
-
20
- html,
21
- body {
22
- margin: 0;
23
- padding: 0;
24
- width: 100%;
25
- height: 100%;
26
- }
27
-
28
- html,
29
- body {
30
- touch-action: none;
31
- overscroll-behavior: none;
32
- }
33
-
34
- * {
35
- margin: 0;
36
- padding: 0;
37
- box-sizing: border-box;
38
- user-select: none;
39
- }
40
-
41
- /* --------------------------
42
- TableView
43
- -------------------------- */
44
- .tableouterwrapper {
45
- width: 100%;
46
- height: 100vh;
47
- display: flex;
48
- flex-direction: column;
49
- --svg-w-h: 30px;
50
- }
51
-
52
- .tablefooter {
53
- display: flex;
54
- width: 100%;
55
- background-color: var(--ext-table-footer-bck-clr, darkgoldenrod);
56
- height: var(--ext-table-footer-height, 40px);
57
- position: absolute;
58
- bottom: 0;
59
- width: -webkit-fill-available;
60
- display: grid;
61
- align-items: center;
62
- padding: 0 10px;
63
- grid-template-columns: 1fr auto;
64
- }
65
-
66
- /* --------------------------
67
- Table
68
- -------------------------- */
69
- .tablebody{
70
- background-color: var(--ext-table-body-bck-clr, ghostwhite);
71
- }
72
-
73
- .tablebody tr {
74
- width: 100%;
75
- transition: background-color 0.2s;
76
- cursor: pointer;
77
- }
78
-
79
- .tablebody tr:nth-child(even) {
80
- background-color: var(--ext-table-body-bck-clr-even, white);
81
- }
82
-
83
- .tablebody tr:hover {
84
- background-color: #e0e7ff;
85
- }
86
-
87
- .tablewrapper {
88
- font-family: sans-serif;
89
- display: flex;
90
- flex-direction: column;
91
- background-color: var(--ext-new-table-wrapper-bck-clr, transparent);
92
- -webkit-user-select: none;
93
- user-select: none;
94
- height: calc(100% - var(--ext-table-footer-height, 40px) - var(--ext-table-actionbar-height, 50px));
95
- overflow-y: auto;
96
- }
97
-
98
- table.exttable th,
99
- table.exttable td {
100
- text-align: left;
101
- }
102
-
103
- table.exttable td {
104
- padding: var(--ext-table-td-padding, 5px);
105
- border: var(--ext-table-cell-border, 1px dashed lightgrey);
106
- border-top: none;
107
- }
108
-
109
- table.exttable thead {
110
- background-color: var(--ext-table-body-bck-clr, white);
111
- font-weight: bold;
112
- height: var(--ext-table-header-height, 40px);
113
- }
114
-
115
- table.exttable {
116
- width: 100%;
117
- border-collapse: collapse;
118
- table-layout: fixed;
119
- }
120
-
121
- .trstickyhead {
122
- position: sticky;
123
- top: 0;
124
- z-index: 1001;
125
- box-shadow: 0 0 30px #523f690d;
126
- background-color: var(--ext-table-header-bkc-clr, darkgoldenrod);
127
- }
128
-
129
- .thcheckhead {
130
- width: var(--custom-width) !important;
131
- padding: var(--table-th-padding, 5px);
132
- }
133
-
134
- /* --------------------------
135
- Table scrollbar
136
- --------------------------- */
137
- ._tbl {
138
- scrollbar-width: thin;
139
- scrollbar-color: var(--ext-table-body-scrollbar-clr, lightslategray) var(--ext-table-body-bck-clr, white);
140
- }
141
-
142
- ._tbl::-webkit-scrollbar {
143
- width: 6px;
144
- background-color: var(--ext-table-body-bck-clr);
145
- transition: width 0.2s ease;
146
- }
147
-
148
- ._tbl::-webkit-scrollbar-thumb {
149
- background-color: white;
150
- border-radius: 12px;
151
- transition: background-color 0.2s ease;
152
- }
153
-
154
- ._tbl:hover::-webkit-scrollbar-thumb {
155
- background-color: #555;
156
- }
157
-
158
- ._tbl:hover::-webkit-scrollbar {
159
- width: 6px;
160
- }
161
-
162
- /* --------------------------
163
- Searchbar & Input
164
- -------------------------- */
165
- input.headsearch:focus {
166
- outline: none;
167
- box-shadow: none;
168
- border-color: inherit;
169
- }
170
-
171
- input.headsearch {
172
- color: var(--ext-tab-input-clr, white);
173
- }
174
-
175
- input.headsearch::placeholder {
176
- color: var(--ext-tab-input-clr, white);
177
- opacity: 1;
178
- }
179
-
180
- input.headsearch {
181
- color: var(--ext-tab-input-clr, white);
182
- opacity: 1;
183
- }
184
-
185
- svg.removesearchsvg{
186
- fill: var(--ext-tab-input-clr, white);
187
- cursor: pointer;
188
- --svg-w-h: 20px;
189
- }
190
-
191
- .sortsvg{
192
- fill: var(--ext-tab-sort-svg-clr, white);
193
- --svg-w-h: 20px
194
- }
195
-
196
- .searchwrapper{
197
- display: flex;
198
- align-items: center;
199
- justify-content: center;
200
- gap: 3px;
201
- border: 1px solid transparent;
202
- padding-right: 5px;
203
- background: transparent;
204
- border-radius: var(--ext-search-wrapper-padding, 4px);
205
- height: var(--ext-search-wrapper-height, 25px);
206
- }
207
-
208
- .searchwrapper:hover{
209
- background: rgba(0,0,0,0.2);
210
- }
211
-
212
- .focused {
213
- border: var(--ext-search-wrapper-focused-border, 1px dashed white);
214
- color: white;
215
- }
216
-
217
- svg {
218
- width: var(--svg-w-h);
219
- height: var(--svg-w-h);
220
- display: flex;
221
- }
222
-
223
- .actionbar{
224
- background-color: #9ca3af;
225
- height: var(--ext-table-actionbar-height, 50px);
226
- display: flex;
227
- align-items: center;
228
- justify-content: center;
229
- }
230
-
231
- .exttablediv {
232
- display: -webkit-box;
233
- -webkit-line-clamp: 2;
234
- line-clamp: 2;
235
- -webkit-box-orient: vertical;
236
- overflow: hidden;
237
- text-overflow: ellipsis;
238
- white-space: normal;
239
- color: var(--ext-table-cell-clr, lightslategrey);
240
- }
241
-
242
- input.headsearch {
243
- border: none;
244
- border-radius: 4px;
245
- width: 98%;
246
- padding: 1px 6px 3px 6px;
247
- box-sizing: border-box;
248
- background-color: transparent;
249
- }
250
-
251
- input.headsearch:hover {
252
- border: none;
253
- cursor: pointer;
254
- }
255
-
256
- input.headsearch:focus {
257
- border: none;
258
- }
259
-
260
- .headcolcell{
261
- display: flex;
262
- gap: var(--ext-table-head-col-cell-gap, 3px);
263
- align-items: center;
264
- justify-content: center;
265
- }
266
-
267
- .headcolcellmain{
268
- flex: 1;
269
- display: flex;
270
- align-items: center;
271
- justify-content: center;
272
- }
273
-
274
- .deftabletr > td, .trstickyhead > th {
275
- padding: 0;
276
- text-align: left;
277
- color: #374151;
278
- box-sizing: border-box;
279
- font-size: 80%;
280
- padding: 5px;
281
- width: var(--custom-width) !important;
282
- min-width: 30px;
283
- }
284
-
285
- .deftabletr > td:first-child{
286
- border-left: none
287
- }
288
-
289
- .deftabletr > td.end, .deftabletr > th.end {
290
- width: 10px;
291
- max-width: 15px;
292
- border-right: none;
293
- }
294
-
295
- .ext-new-table-header th {
296
- padding: 0 5px 0 0;
297
- position: relative;
298
- }
299
-
300
- .ext-new-table-header th.th-check-head {
301
- padding: 0 0 0 5px;
302
- }
303
-
304
- .ext-new-resize-header-main {
305
- flex: 1;
306
- white-space: nowrap;
307
- overflow: hidden;
308
- text-overflow: ellipsis;
309
- color: #111827;
310
- font-weight: 600;
311
- letter-spacing: 0.5px;
312
- }
313
-
314
- .headsearchwrapper {
315
- position: relative;
316
- }
317
-
318
- .sort-col {
319
- display: flex;
320
- }
321
-
322
- .headsearchlable {
323
- position: fixed;
324
- margin-left: 6px;
325
- margin-top: 0;
326
- font-size: var(--ext-table-header-font-size, 50%);
327
- background-color: var(--ext-table-header-bkc-clr, darkgoldenrod);
328
- color: var(--ext-table-header-clr, darkslategrey);
329
- border-radius: 4px;
330
- padding: 2px 5px;
331
- opacity: 0;
332
- transition: opacity 0.3s ease, margin-top 0.3s ease;
333
- }
334
-
335
- .show {
336
- opacity: 1;
337
- margin-top: -5px;
338
- z-index: 999;
339
- }
340
-
341
- /* --------------------------
342
- Resizable column wrapper
343
- -------------------------- */
344
-
345
- .thheaddef {
346
- position: relative;
347
- padding: 0;
348
- }
349
-
350
- .ext-new-resize-header {
351
- display: flex;
352
- justify-content: left;
353
- align-items: center;
354
- padding: 0;
355
- }
356
-
357
- .ext-new-resize-handle {
358
- width: 5px;
359
- cursor: col-resize;
360
- height: 100%;
361
- position: absolute;
362
- right: 0;
363
- top: 0;
364
- z-index: 5;
365
- }
366
-
367
- /* --------------------------
368
- Resize handle hover effect
369
- --------------------------- */
370
-
371
- .ext-new-resize-handle {
372
- transition: background-color 0.2s ease;
373
- }
374
-
375
- .ext-new-resize-handle:hover {
376
- background-color: rgba(0, 0, 0, 0.1);
377
- }
378
-
379
- .fallbackwrapper {
380
- height: calc(100% - var(--ext-table-footer-height, 40px));
381
- display: flex;
382
- align-items: center;
383
- justify-content: center;
384
- background-color: var(--fallback-wrapper-bck-clr, wheat);
385
- }
386
-
387
- .checkboxtable {
388
- --btn-bck-clr: transparent;
389
- display: flex;
390
- justify-content: center;
391
- width: fit-content;
392
- --btn-padding: 2px;
393
- background-color: var(--btn-bck-clr);
394
- --btn-border-radius: 50px;
395
- --ripple-box-shadow: none;
396
- user-select: none;
397
- --ripple-effect-bck: rgb(0 0 0 / 15%);
398
- --svg-w-h: 20px;
399
- }
400
-
401
- .cbcircle {
402
- fill: var(--ext-table-cb-corpus-fill, red)
403
- }
404
-
405
- .cbpath {
406
- fill: var(--ext-table-cb-path-fill, white)
407
- }
408
-
409
- /* --------------------------
410
- PAGINATION
411
- -------------------------- */
412
- .paginationwrapper {
413
- display: flex;
414
- gap: 5px;
415
- width: 100%;
416
- color: gray;
417
- font-size: 85%;
418
- }
419
-
420
- .paginationend {
421
- color: var(--ext-table-pag-clr, lightslategrey);
422
- font-size: 80%;
423
- font-weight: var(--ext-table-pag-font-weight, 400);
424
- white-space: nowrap;
425
- }
426
-
427
- /* --------------------------
428
- RIPPLE
429
- -------------------------- */
430
- .paginationbutton {
431
- font-size: 90%;
432
- white-space: nowrap;
433
- display: flex;
434
- align-items: center;
435
- justify-content: center;
436
- cursor: pointer;
437
- height: var(--ext-table-pag-h, 30px);
438
- min-width: var(--ext-table-pag-w, 30px);
439
- color: var(--ext-table-pag-btn-clr, darkblue);
440
- line-height: var(--ext-table-btn-line-height, 1.5);
441
- font-weight: var(--ext-table-btn-font-weight, 500);
442
- background-color: var(--ext-table-pag-btn-bck-clr, white);
443
- border-radius: var(--ext-table-pag-btn-border-radius, 12px);
444
- box-shadow: var(--ext-table-pag-ripple-box-shadow, rgb(100 100 111 / 20%) 0px 7px 29px 0px);
445
- position: relative;
446
- overflow: hidden;
447
- user-select: none;
448
- width: fit-content;
449
- }
450
-
451
- .pagbtnsvg{
452
- width: var(--pag-btn-svg-w, 15px);
453
- height: var(--pag-btn-svg-h, 15px);
454
- fill: var(--ext-table-pag-btn-clr)
455
- }
456
-
457
- .pagnumber {
458
- width: var(--ext-table-pag-w);
459
- }
460
-
461
- .paginationbuttonhide{
462
- opacity: .3;
463
- }
464
-
465
- .paginationbuttonactive {
466
- background-color: var(--ext-table-pag-btn-bck-clr-active, darkblue);
467
- color: var(--ext-table-pag-btn-clr-active, yellow);
468
- font-weight: 500;
469
- }
470
-
471
- .pagripple {
472
- background: var(--ripple-effect-bck, rgb(0 0 0 / 15%));
473
- position: absolute;
474
- border-radius: var(--ext-table-pag-btn-border-radius, 12px);
475
- transform: scale(0);
476
- animation: ripple-animation 0.6s linear;
477
- pointer-events: none;
478
- transform-origin: center center;
479
- will-change: transform, opacity;
480
- }
481
-
482
- /* Only devices that can hover (desktop/laptop) */
483
- @media (hover: hover) and (pointer: fine) {
484
- ._ripple {
485
- cursor: pointer;
486
- }
487
- }
488
-
489
- @keyframes ripple-animation {
490
- to {
491
- transform: scale(4);
492
- opacity: 0;
493
- }
494
- }