jcicl 1.0.23 → 1.0.25
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/Table/Table.d.ts +9 -0
- package/Table/Table.js +309 -250
- package/Timer/Timer.d.ts +15 -0
- package/Timer/Timer.js +85 -0
- package/Timer/index.d.ts +1 -0
- package/Timer/index.js +4 -0
- package/package.json +1 -1
- package/utils.js +13 -12
package/Table/Table.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Interface for components that support table value extraction via ref
|
|
4
|
+
*/
|
|
5
|
+
export interface TableValueHandle {
|
|
6
|
+
getTableValue: () => string | number;
|
|
7
|
+
}
|
|
2
8
|
export interface TableProps {
|
|
3
9
|
data: Record<string, any>[];
|
|
4
10
|
columnTitles?: Record<string, string>;
|
|
@@ -11,6 +17,9 @@ export interface TableProps {
|
|
|
11
17
|
direction: 'asc' | 'desc';
|
|
12
18
|
};
|
|
13
19
|
extraActions?: React.ReactNode;
|
|
20
|
+
notSearchableColumns?: string[];
|
|
21
|
+
notSortableColumns?: string[];
|
|
22
|
+
notExportableColumns?: string[];
|
|
14
23
|
}
|
|
15
24
|
declare const DataTable: React.FC<TableProps>;
|
|
16
25
|
export default DataTable;
|
package/Table/Table.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import
|
|
1
|
+
import { jsxs as h, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import x, { useState as E, useRef as re, useMemo as L, useEffect as _ } from "react";
|
|
3
|
+
import s from "../theme.js";
|
|
4
4
|
import { c } from "../.chunks/emotion-react.browser.esm.js";
|
|
5
|
-
import { n as
|
|
6
|
-
import { Button as
|
|
7
|
-
import { Flex as
|
|
8
|
-
import { useThemeColors as
|
|
9
|
-
import { c as
|
|
5
|
+
import { n as a } from "../.chunks/emotion-styled.browser.esm.js";
|
|
6
|
+
import { Button as ke } from "../Button/Button.js";
|
|
7
|
+
import { Flex as $e } from "../Flex/Flex.js";
|
|
8
|
+
import { useThemeColors as Se } from "../ThemeContext.js";
|
|
9
|
+
import { c as B } from "../.chunks/createLucideIcon.js";
|
|
10
10
|
/**
|
|
11
11
|
* @license lucide-react v0.525.0 - ISC
|
|
12
12
|
*
|
|
13
13
|
* This source code is licensed under the ISC license.
|
|
14
14
|
* See the LICENSE file in the root directory of this source tree.
|
|
15
15
|
*/
|
|
16
|
-
const
|
|
16
|
+
const Te = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]], H = B("chevron-down", Te);
|
|
17
17
|
/**
|
|
18
18
|
* @license lucide-react v0.525.0 - ISC
|
|
19
19
|
*
|
|
20
20
|
* This source code is licensed under the ISC license.
|
|
21
21
|
* See the LICENSE file in the root directory of this source tree.
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
23
|
+
const ze = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]], ie = B("chevron-up", ze);
|
|
24
24
|
/**
|
|
25
25
|
* @license lucide-react v0.525.0 - ISC
|
|
26
26
|
*
|
|
27
27
|
* This source code is licensed under the ISC license.
|
|
28
28
|
* See the LICENSE file in the root directory of this source tree.
|
|
29
29
|
*/
|
|
30
|
-
const
|
|
30
|
+
const Ee = [
|
|
31
31
|
[
|
|
32
32
|
"path",
|
|
33
33
|
{
|
|
@@ -44,14 +44,14 @@ const me = [
|
|
|
44
44
|
}
|
|
45
45
|
],
|
|
46
46
|
["path", { d: "m2 2 20 20", key: "1ooewy" }]
|
|
47
|
-
],
|
|
47
|
+
], je = B("eye-off", Ee);
|
|
48
48
|
/**
|
|
49
49
|
* @license lucide-react v0.525.0 - ISC
|
|
50
50
|
*
|
|
51
51
|
* This source code is licensed under the ISC license.
|
|
52
52
|
* See the LICENSE file in the root directory of this source tree.
|
|
53
53
|
*/
|
|
54
|
-
const
|
|
54
|
+
const Ve = [
|
|
55
55
|
[
|
|
56
56
|
"path",
|
|
57
57
|
{
|
|
@@ -60,24 +60,24 @@ const fe = [
|
|
|
60
60
|
}
|
|
61
61
|
],
|
|
62
62
|
["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
|
|
63
|
-
],
|
|
63
|
+
], Ae = B("eye", Ve);
|
|
64
64
|
/**
|
|
65
65
|
* @license lucide-react v0.525.0 - ISC
|
|
66
66
|
*
|
|
67
67
|
* This source code is licensed under the ISC license.
|
|
68
68
|
* See the LICENSE file in the root directory of this source tree.
|
|
69
69
|
*/
|
|
70
|
-
const
|
|
70
|
+
const Be = [
|
|
71
71
|
["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
|
|
72
72
|
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
|
|
73
|
-
],
|
|
73
|
+
], he = B("search", Be);
|
|
74
74
|
/**
|
|
75
75
|
* @license lucide-react v0.525.0 - ISC
|
|
76
76
|
*
|
|
77
77
|
* This source code is licensed under the ISC license.
|
|
78
78
|
* See the LICENSE file in the root directory of this source tree.
|
|
79
79
|
*/
|
|
80
|
-
const
|
|
80
|
+
const De = [
|
|
81
81
|
[
|
|
82
82
|
"path",
|
|
83
83
|
{
|
|
@@ -86,9 +86,25 @@ const ye = [
|
|
|
86
86
|
}
|
|
87
87
|
],
|
|
88
88
|
["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
|
|
89
|
-
],
|
|
89
|
+
], Ne = B("settings", De);
|
|
90
|
+
function M(o, b) {
|
|
91
|
+
var C;
|
|
92
|
+
if ((C = b == null ? void 0 : b.current) != null && C.getTableValue)
|
|
93
|
+
return b.current.getTableValue();
|
|
94
|
+
if (x.isValidElement(o)) {
|
|
95
|
+
const D = o.type;
|
|
96
|
+
if (typeof D != "string") {
|
|
97
|
+
const j = D;
|
|
98
|
+
if (typeof j.getTableValue == "function")
|
|
99
|
+
return j.getTableValue(o.props);
|
|
100
|
+
}
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
return o;
|
|
104
|
+
}
|
|
105
|
+
const Fe = a("div")(() => ({
|
|
90
106
|
...c`
|
|
91
|
-
background-color: ${
|
|
107
|
+
background-color: ${s.colors.white};
|
|
92
108
|
border-radius: 8px;
|
|
93
109
|
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
|
|
94
110
|
padding: 20px;
|
|
@@ -96,7 +112,7 @@ const ye = [
|
|
|
96
112
|
width: 100%;
|
|
97
113
|
overflow: auto;
|
|
98
114
|
`
|
|
99
|
-
})),
|
|
115
|
+
})), Le = a("div")(() => ({
|
|
100
116
|
...c`
|
|
101
117
|
display: flex;
|
|
102
118
|
flex-direction: column;
|
|
@@ -106,21 +122,21 @@ const ye = [
|
|
|
106
122
|
flex-wrap: wrap;
|
|
107
123
|
gap: 9px;
|
|
108
124
|
`
|
|
109
|
-
})),
|
|
125
|
+
})), _e = a("div")(() => ({
|
|
110
126
|
...c`
|
|
111
127
|
display: flex;
|
|
112
128
|
justify-content: space-between;
|
|
113
129
|
width: 100%;
|
|
114
130
|
align-items: center;
|
|
115
131
|
`
|
|
116
|
-
})),
|
|
132
|
+
})), Me = a("h2")(() => ({
|
|
117
133
|
...c`
|
|
118
134
|
font-size: 24px;
|
|
119
135
|
font-weight: bold;
|
|
120
|
-
color: ${
|
|
136
|
+
color: ${s.colors.black};
|
|
121
137
|
margin: 0;
|
|
122
138
|
`
|
|
123
|
-
})),
|
|
139
|
+
})), Ie = a("div")(() => ({
|
|
124
140
|
...c`
|
|
125
141
|
display: flex;
|
|
126
142
|
justify-content: flex-end;
|
|
@@ -129,21 +145,21 @@ const ye = [
|
|
|
129
145
|
align-items: center;
|
|
130
146
|
flex-wrap: wrap;
|
|
131
147
|
`
|
|
132
|
-
})),
|
|
148
|
+
})), Oe = a("div")(() => ({
|
|
133
149
|
...c`
|
|
134
150
|
position: relative;
|
|
135
151
|
display: flex;
|
|
136
152
|
align-items: center;
|
|
137
153
|
flex-grow: 1;
|
|
138
154
|
`
|
|
139
|
-
})),
|
|
155
|
+
})), Pe = a(he, {
|
|
140
156
|
shouldForwardProp: (o) => !["customTheme"].includes(o)
|
|
141
157
|
})(({ customTheme: o }) => ({
|
|
142
158
|
...c`
|
|
143
159
|
position: absolute;
|
|
144
160
|
left: 13px;
|
|
145
161
|
top: 10px;
|
|
146
|
-
color: ${
|
|
162
|
+
color: ${s.colors.gray3};
|
|
147
163
|
width: 19px;
|
|
148
164
|
height: 19px;
|
|
149
165
|
transition: all 313ms ease;
|
|
@@ -154,19 +170,19 @@ const ye = [
|
|
|
154
170
|
color: ${o.themeColor};
|
|
155
171
|
}
|
|
156
172
|
`
|
|
157
|
-
})),
|
|
173
|
+
})), Re = a("input", {
|
|
158
174
|
shouldForwardProp: (o) => !["customTheme"].includes(o)
|
|
159
175
|
})(({ customTheme: o }) => ({
|
|
160
176
|
...c`
|
|
161
177
|
padding: 10px 15px 10px 40px;
|
|
162
|
-
border: 2px solid ${
|
|
178
|
+
border: 2px solid ${s.colors.gray4};
|
|
163
179
|
border-radius: 25px;
|
|
164
180
|
font-size: 14px;
|
|
165
181
|
min-width: 270px;
|
|
166
182
|
width: 100%;
|
|
167
183
|
transition: all 313ms ease;
|
|
168
184
|
outline: none;
|
|
169
|
-
background-color: ${
|
|
185
|
+
background-color: ${s.colors.white};
|
|
170
186
|
:focus,
|
|
171
187
|
:hover,
|
|
172
188
|
:focus-within {
|
|
@@ -174,14 +190,14 @@ const ye = [
|
|
|
174
190
|
box-shadow: 0 0 0 3px ${o.themeColor}18; // 18 = alpha 0.1
|
|
175
191
|
}
|
|
176
192
|
`
|
|
177
|
-
})),
|
|
193
|
+
})), se = a("button", {
|
|
178
194
|
shouldForwardProp: (o) => !["customTheme"].includes(o)
|
|
179
195
|
})(({ customTheme: o }) => ({
|
|
180
196
|
...c`
|
|
181
197
|
padding: 10px 15px;
|
|
182
198
|
border: 2px solid ${o.themeColor};
|
|
183
199
|
border-radius: 6px;
|
|
184
|
-
background-color: ${
|
|
200
|
+
background-color: ${s.colors.white};
|
|
185
201
|
color: ${o.themeColor};
|
|
186
202
|
cursor: pointer;
|
|
187
203
|
display: flex;
|
|
@@ -195,19 +211,19 @@ const ye = [
|
|
|
195
211
|
:hover,
|
|
196
212
|
:focus-within {
|
|
197
213
|
background-color: ${o.themeColor};
|
|
198
|
-
color: ${
|
|
214
|
+
color: ${s.colors.white};
|
|
199
215
|
transform: translateY(-1px);
|
|
200
216
|
box-shadow: 0 4px 12px ${o.themeColor}4c; // 4c = alpha 0.3
|
|
201
217
|
}
|
|
202
218
|
`
|
|
203
|
-
})),
|
|
219
|
+
})), le = a("div")(() => ({
|
|
204
220
|
...c`
|
|
205
221
|
position: absolute;
|
|
206
222
|
top: 100%;
|
|
207
223
|
right: 0;
|
|
208
224
|
margin-top: 5px;
|
|
209
|
-
background-color: ${
|
|
210
|
-
border: 1px solid ${
|
|
225
|
+
background-color: ${s.colors.white};
|
|
226
|
+
border: 1px solid ${s.colors.gray4};
|
|
211
227
|
border-radius: 6px;
|
|
212
228
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
213
229
|
z-index: 1000;
|
|
@@ -215,7 +231,7 @@ const ye = [
|
|
|
215
231
|
max-height: 300px;
|
|
216
232
|
overflow-y: auto;
|
|
217
233
|
`
|
|
218
|
-
})),
|
|
234
|
+
})), U = a("div", {
|
|
219
235
|
shouldForwardProp: (o) => !["customTheme"].includes(o)
|
|
220
236
|
})(({ customTheme: o }) => ({
|
|
221
237
|
...c`
|
|
@@ -225,7 +241,7 @@ const ye = [
|
|
|
225
241
|
gap: 10px;
|
|
226
242
|
cursor: pointer;
|
|
227
243
|
font-size: 14px;
|
|
228
|
-
color: ${
|
|
244
|
+
color: ${s.colors.slate};
|
|
229
245
|
transition: all 0.2s ease;
|
|
230
246
|
:focus,
|
|
231
247
|
:hover,
|
|
@@ -234,7 +250,7 @@ const ye = [
|
|
|
234
250
|
color: ${o.themeDark};
|
|
235
251
|
}
|
|
236
252
|
`
|
|
237
|
-
})),
|
|
253
|
+
})), q = a("input", {
|
|
238
254
|
shouldForwardProp: (o) => !["customTheme"].includes(o)
|
|
239
255
|
})(({ customTheme: o }) => ({
|
|
240
256
|
...c`
|
|
@@ -242,25 +258,25 @@ const ye = [
|
|
|
242
258
|
height: 16px;
|
|
243
259
|
accent-color: ${o.themeColor};
|
|
244
260
|
`
|
|
245
|
-
})),
|
|
261
|
+
})), He = a("table")(() => ({
|
|
246
262
|
...c`
|
|
247
263
|
width: 100%;
|
|
248
264
|
border-collapse: collapse;
|
|
249
|
-
background-color: ${
|
|
265
|
+
background-color: ${s.colors.white};
|
|
250
266
|
border-radius: 8px;
|
|
251
267
|
overflow: hidden;
|
|
252
268
|
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
253
269
|
`
|
|
254
|
-
})),
|
|
270
|
+
})), Ue = a("th", { shouldForwardProp: (o) => !["customTheme"].includes(o) })(
|
|
255
271
|
({ customTheme: o }) => ({
|
|
256
272
|
...c`
|
|
257
|
-
background-color: ${
|
|
258
|
-
color: ${
|
|
273
|
+
background-color: ${s.colors.whiteBlue};
|
|
274
|
+
color: ${s.colors.slate};
|
|
259
275
|
padding: 16px 12px;
|
|
260
276
|
text-align: left;
|
|
261
277
|
font-size: 14px;
|
|
262
278
|
font-weight: 600;
|
|
263
|
-
border-bottom: 2px solid ${
|
|
279
|
+
border-bottom: 2px solid ${s.colors.gray4};
|
|
264
280
|
cursor: pointer;
|
|
265
281
|
user-select: none;
|
|
266
282
|
transition: all 0.2s ease;
|
|
@@ -274,32 +290,32 @@ const ye = [
|
|
|
274
290
|
}
|
|
275
291
|
`
|
|
276
292
|
})
|
|
277
|
-
),
|
|
293
|
+
), ce = a("td")(() => ({
|
|
278
294
|
...c`
|
|
279
295
|
padding: 14px 12px;
|
|
280
|
-
border-bottom: 1px solid ${
|
|
296
|
+
border-bottom: 1px solid ${s.colors.almostWhite};
|
|
281
297
|
font-size: 14px;
|
|
282
|
-
color: ${
|
|
298
|
+
color: ${s.colors.slate};
|
|
283
299
|
transition: all 0.2s ease;
|
|
284
300
|
`
|
|
285
|
-
})),
|
|
301
|
+
})), qe = a("span")(() => ({
|
|
286
302
|
...c`
|
|
287
303
|
margin-left: 8px;
|
|
288
304
|
opacity: 0.6;
|
|
289
305
|
`
|
|
290
|
-
})),
|
|
306
|
+
})), ae = a("tr", { shouldForwardProp: (o) => !["customTheme"].includes(o) })(({ interactableRow: o, customTheme: b }) => ({
|
|
291
307
|
...c`
|
|
292
308
|
transition: all 0.2s ease;
|
|
293
309
|
${o && c`
|
|
294
310
|
:focus,
|
|
295
311
|
:hover,
|
|
296
312
|
:focus-within {
|
|
297
|
-
background-color: ${
|
|
313
|
+
background-color: ${b.themeLightD};
|
|
298
314
|
cursor: pointer;
|
|
299
315
|
}
|
|
300
316
|
`}
|
|
301
317
|
`
|
|
302
|
-
})),
|
|
318
|
+
})), We = a("div")(() => ({
|
|
303
319
|
...c`
|
|
304
320
|
display: flex;
|
|
305
321
|
justify-content: center;
|
|
@@ -307,15 +323,15 @@ const ye = [
|
|
|
307
323
|
margin-top: 20px;
|
|
308
324
|
gap: 10px;
|
|
309
325
|
`
|
|
310
|
-
})),
|
|
326
|
+
})), A = a("button", {
|
|
311
327
|
shouldForwardProp: (o) => !["customTheme"].includes(o)
|
|
312
328
|
})(({ customTheme: o }) => ({
|
|
313
329
|
...c`
|
|
314
330
|
padding: 8px 12px;
|
|
315
|
-
border: 1px solid ${
|
|
331
|
+
border: 1px solid ${s.colors.gray4};
|
|
316
332
|
border-radius: 4px;
|
|
317
|
-
background-color: ${
|
|
318
|
-
color: ${
|
|
333
|
+
background-color: ${s.colors.white};
|
|
334
|
+
color: ${s.colors.slate};
|
|
319
335
|
cursor: pointer;
|
|
320
336
|
font-size: 14px;
|
|
321
337
|
transition: all 0.2s ease;
|
|
@@ -324,7 +340,7 @@ const ye = [
|
|
|
324
340
|
:hover,
|
|
325
341
|
:focus-within {
|
|
326
342
|
background-color: ${o.themeColor};
|
|
327
|
-
color: ${
|
|
343
|
+
color: ${s.colors.white};
|
|
328
344
|
border-color: ${o.themeColor};
|
|
329
345
|
}
|
|
330
346
|
:disabled {
|
|
@@ -332,38 +348,44 @@ const ye = [
|
|
|
332
348
|
cursor: not-allowed;
|
|
333
349
|
}
|
|
334
350
|
`
|
|
335
|
-
})),
|
|
351
|
+
})), Ke = a("div")(() => ({
|
|
336
352
|
...c`
|
|
337
353
|
font-size: 14px;
|
|
338
|
-
color: ${
|
|
354
|
+
color: ${s.colors.gray3};
|
|
339
355
|
text-align: center;
|
|
340
356
|
margin-top: 10px;
|
|
341
357
|
`
|
|
342
|
-
})),
|
|
358
|
+
})), de = a("span")(() => ({
|
|
343
359
|
...c`
|
|
344
360
|
padding: 8px 4px;
|
|
345
|
-
color: ${
|
|
361
|
+
color: ${s.colors.gray3};
|
|
346
362
|
font-size: 14px;
|
|
347
363
|
`
|
|
348
|
-
})),
|
|
364
|
+
})), no = ({
|
|
349
365
|
data: o = [],
|
|
350
|
-
columnTitles:
|
|
351
|
-
rowsPerPage:
|
|
352
|
-
title:
|
|
353
|
-
onRowClick:
|
|
354
|
-
hiddenColumns:
|
|
355
|
-
defaultSort:
|
|
356
|
-
extraActions:
|
|
366
|
+
columnTitles: b = {},
|
|
367
|
+
rowsPerPage: C = 19,
|
|
368
|
+
title: D = "Data Table",
|
|
369
|
+
onRowClick: j,
|
|
370
|
+
hiddenColumns: pe = [],
|
|
371
|
+
defaultSort: W = { key: "", direction: "asc" },
|
|
372
|
+
extraActions: K,
|
|
373
|
+
notSearchableColumns: ue = [],
|
|
374
|
+
notSortableColumns: I = [],
|
|
375
|
+
notExportableColumns: fe = []
|
|
357
376
|
}) => {
|
|
358
|
-
const [
|
|
377
|
+
const [d, T] = E(1), [N, Y] = E(""), [w, G] = E(W), [V, F] = E(/* @__PURE__ */ new Set()), [O, J] = E(/* @__PURE__ */ new Set()), [Q, X] = E(!1), [Z, ee] = E(!1), v = re(/* @__PURE__ */ new Map()), oe = (e, r) => {
|
|
378
|
+
const t = `${e}-${r}`;
|
|
379
|
+
return v.current.has(t) || v.current.set(t, x.createRef()), v.current.get(t);
|
|
380
|
+
}, l = Se(), z = {
|
|
359
381
|
thActive: {
|
|
360
|
-
backgroundColor:
|
|
361
|
-
color:
|
|
382
|
+
backgroundColor: l.themeColor,
|
|
383
|
+
color: s.colors.white
|
|
362
384
|
},
|
|
363
385
|
paginationButtonActive: {
|
|
364
|
-
backgroundColor:
|
|
365
|
-
color:
|
|
366
|
-
borderColor:
|
|
386
|
+
backgroundColor: l.themeColor,
|
|
387
|
+
color: s.colors.white,
|
|
388
|
+
borderColor: l.themeColor
|
|
367
389
|
},
|
|
368
390
|
paginationButtonDisabled: {
|
|
369
391
|
opacity: 0.5,
|
|
@@ -371,145 +393,161 @@ const ye = [
|
|
|
371
393
|
},
|
|
372
394
|
info: {
|
|
373
395
|
fontSize: "14px",
|
|
374
|
-
color:
|
|
396
|
+
color: s.colors.gray3,
|
|
375
397
|
textAlign: "center",
|
|
376
398
|
marginTop: "10px"
|
|
377
399
|
}
|
|
378
|
-
},
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
}, [
|
|
382
|
-
|
|
383
|
-
}, [])
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
400
|
+
}, p = L(() => o.length === 0 ? [] : Object.keys(o[0]).filter((e) => !pe.includes(e)), [o]);
|
|
401
|
+
_(() => {
|
|
402
|
+
p.length > 0 && (J(new Set(p)), F(new Set(p.filter((e) => !ue.includes(e)))));
|
|
403
|
+
}, [p]), _(() => {
|
|
404
|
+
Y(""), G(W), T(1);
|
|
405
|
+
}, []), _(() => {
|
|
406
|
+
const e = /* @__PURE__ */ new Set();
|
|
407
|
+
o.forEach((r, t) => {
|
|
408
|
+
p.forEach((i) => {
|
|
409
|
+
x.isValidElement(r[i]) && e.add(`${t}-${i}`);
|
|
410
|
+
});
|
|
411
|
+
}), v.current.forEach((r, t) => {
|
|
412
|
+
e.has(t) || v.current.delete(t);
|
|
413
|
+
});
|
|
414
|
+
}, [o, p]);
|
|
415
|
+
const P = L(() => {
|
|
416
|
+
if (!N) return o;
|
|
417
|
+
const e = V.size > 0 ? V : new Set(p), r = N.toLowerCase().replace(/[-()\s]/g, "");
|
|
418
|
+
return o.filter((t, i) => Array.from(e).some((m) => {
|
|
419
|
+
const S = t[m], $ = x.isValidElement(S) ? v.current.get(`${i}-${m}`) : void 0, u = M(S, $);
|
|
420
|
+
return u === null ? !1 : String(u).toLowerCase().replace(/[-()\s]/g, "").includes(r);
|
|
390
421
|
}));
|
|
391
|
-
}, [o,
|
|
392
|
-
const
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
422
|
+
}, [o, N, V, p]), k = L(() => w.key ? [...P].sort((e, r) => {
|
|
423
|
+
const t = e[w.key], i = r[w.key], m = o.indexOf(e), S = o.indexOf(r), $ = x.isValidElement(t) ? v.current.get(`${m}-${w.key}`) : void 0, u = x.isValidElement(i) ? v.current.get(`${S}-${w.key}`) : void 0;
|
|
424
|
+
let f = M(t, $), y = M(i, u);
|
|
425
|
+
return f === null && y === null ? 0 : f === null ? 1 : y === null ? -1 : (typeof f == "string" && (f = f.toLowerCase()), typeof y == "string" && (y = y.toLowerCase()), f < y ? w.direction === "asc" ? -1 : 1 : f > y ? w.direction === "asc" ? 1 : -1 : 0);
|
|
426
|
+
}) : P, [P, w, o]), R = p.filter((e) => O.has(e)), ge = () => {
|
|
427
|
+
if (!Array.isArray(k) || k.length === 0) return;
|
|
428
|
+
const e = R.filter((u) => !fe.includes(u)), r = e.map((u) => b[u] || u), t = (u) => {
|
|
429
|
+
const f = String(u ?? "");
|
|
430
|
+
return /[",\n]/.test(f) ? `"${f.replace(/"/g, '""')}"` : f;
|
|
431
|
+
}, m = [
|
|
432
|
+
r.join(","),
|
|
401
433
|
// header row
|
|
402
|
-
...
|
|
434
|
+
...k.map((u) => {
|
|
435
|
+
const f = o.indexOf(u);
|
|
436
|
+
return e.map((y) => {
|
|
437
|
+
const ne = u[y], Ce = x.isValidElement(ne) ? v.current.get(`${f}-${y}`) : void 0, ve = M(ne, Ce);
|
|
438
|
+
return t(ve ?? "");
|
|
439
|
+
}).join(",");
|
|
440
|
+
})
|
|
403
441
|
].join(`
|
|
404
|
-
`),
|
|
405
|
-
$.href = URL.createObjectURL(
|
|
406
|
-
},
|
|
407
|
-
const e = (
|
|
408
|
-
return
|
|
409
|
-
}, [
|
|
410
|
-
|
|
442
|
+
`), S = new Blob([m], { type: "text/csv;charset=utf-8;" }), $ = document.createElement("a");
|
|
443
|
+
$.href = URL.createObjectURL(S), $.download = "data.csv", document.body.appendChild($), $.click(), document.body.removeChild($);
|
|
444
|
+
}, me = L(() => {
|
|
445
|
+
const e = (d - 1) * C;
|
|
446
|
+
return k.slice(e, e + C);
|
|
447
|
+
}, [k, d, C]), g = Math.ceil(k.length / C), xe = (e) => {
|
|
448
|
+
I.includes(e) || G((r) => ({
|
|
411
449
|
key: e,
|
|
412
|
-
direction:
|
|
450
|
+
direction: r.key === e && r.direction === "asc" ? "desc" : "asc"
|
|
413
451
|
}));
|
|
414
|
-
},
|
|
415
|
-
|
|
416
|
-
const
|
|
417
|
-
return
|
|
452
|
+
}, be = (e) => {
|
|
453
|
+
F((r) => {
|
|
454
|
+
const t = new Set(r);
|
|
455
|
+
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
418
456
|
});
|
|
419
|
-
},
|
|
420
|
-
|
|
421
|
-
},
|
|
422
|
-
|
|
423
|
-
const
|
|
424
|
-
return
|
|
457
|
+
}, we = () => {
|
|
458
|
+
V.size === p.length ? F(/* @__PURE__ */ new Set()) : F(new Set(p));
|
|
459
|
+
}, ye = (e) => {
|
|
460
|
+
J((r) => {
|
|
461
|
+
const t = new Set(r);
|
|
462
|
+
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
425
463
|
});
|
|
426
|
-
},
|
|
427
|
-
const
|
|
428
|
-
return
|
|
429
|
-
const
|
|
430
|
-
!
|
|
464
|
+
}, te = (e) => {
|
|
465
|
+
const r = re(null);
|
|
466
|
+
return _(() => {
|
|
467
|
+
const t = (i) => {
|
|
468
|
+
!r.current || r.current.contains(i.target) || e(i);
|
|
431
469
|
};
|
|
432
|
-
return document.addEventListener("mousedown",
|
|
433
|
-
document.removeEventListener("mousedown",
|
|
470
|
+
return document.addEventListener("mousedown", t), document.addEventListener("touchstart", t), () => {
|
|
471
|
+
document.removeEventListener("mousedown", t), document.removeEventListener("touchstart", t);
|
|
434
472
|
};
|
|
435
|
-
}, [
|
|
473
|
+
}, [r, e]), r;
|
|
436
474
|
};
|
|
437
|
-
return /* @__PURE__ */
|
|
438
|
-
/* @__PURE__ */
|
|
439
|
-
/* @__PURE__ */
|
|
440
|
-
/* @__PURE__ */
|
|
441
|
-
/* @__PURE__ */
|
|
442
|
-
|
|
443
|
-
/* @__PURE__ */
|
|
475
|
+
return /* @__PURE__ */ h(Fe, { className: "jcTableContainer", children: [
|
|
476
|
+
/* @__PURE__ */ h(Le, { className: "jcTableHeader", children: [
|
|
477
|
+
/* @__PURE__ */ h(_e, { className: "jcTableTitleAndActions", children: [
|
|
478
|
+
/* @__PURE__ */ n(Me, { children: D }),
|
|
479
|
+
/* @__PURE__ */ h($e, { className: "jcTableExtraComponentsBox", gap: "9px", children: [
|
|
480
|
+
K && K,
|
|
481
|
+
/* @__PURE__ */ n(ke, { onClick: ge, children: "Export to CSV" })
|
|
444
482
|
] })
|
|
445
483
|
] }),
|
|
446
|
-
/* @__PURE__ */
|
|
447
|
-
/* @__PURE__ */
|
|
448
|
-
/* @__PURE__ */
|
|
449
|
-
/* @__PURE__ */
|
|
450
|
-
|
|
484
|
+
/* @__PURE__ */ h(Ie, { className: "jcTableControls", children: [
|
|
485
|
+
/* @__PURE__ */ h(Oe, { className: "jcTableSearchContainer", children: [
|
|
486
|
+
/* @__PURE__ */ n(Pe, { customTheme: l }),
|
|
487
|
+
/* @__PURE__ */ n(
|
|
488
|
+
Re,
|
|
451
489
|
{
|
|
452
|
-
customTheme:
|
|
490
|
+
customTheme: l,
|
|
453
491
|
type: "text",
|
|
454
492
|
placeholder: "Search...",
|
|
455
|
-
value:
|
|
456
|
-
onChange: (e) =>
|
|
493
|
+
value: N,
|
|
494
|
+
onChange: (e) => Y(e.target.value)
|
|
457
495
|
}
|
|
458
496
|
)
|
|
459
497
|
] }),
|
|
460
|
-
/* @__PURE__ */
|
|
498
|
+
/* @__PURE__ */ h(
|
|
461
499
|
"div",
|
|
462
500
|
{
|
|
463
501
|
style: { position: "relative" },
|
|
464
|
-
ref:
|
|
465
|
-
|
|
502
|
+
ref: te(() => {
|
|
503
|
+
ee(!1);
|
|
466
504
|
}),
|
|
467
505
|
children: [
|
|
468
|
-
/* @__PURE__ */
|
|
469
|
-
|
|
506
|
+
/* @__PURE__ */ h(
|
|
507
|
+
se,
|
|
470
508
|
{
|
|
471
|
-
customTheme:
|
|
509
|
+
customTheme: l,
|
|
472
510
|
className: "jcTableSearchFields",
|
|
473
|
-
onClick: () =>
|
|
511
|
+
onClick: () => ee(!Z),
|
|
474
512
|
children: [
|
|
475
|
-
/* @__PURE__ */
|
|
513
|
+
/* @__PURE__ */ n(he, { size: 16 }),
|
|
476
514
|
"Fields",
|
|
477
|
-
/* @__PURE__ */
|
|
515
|
+
/* @__PURE__ */ n(H, { size: 16 })
|
|
478
516
|
]
|
|
479
517
|
}
|
|
480
518
|
),
|
|
481
|
-
|
|
482
|
-
/* @__PURE__ */
|
|
483
|
-
/* @__PURE__ */
|
|
484
|
-
|
|
519
|
+
Z && /* @__PURE__ */ h(le, { className: "jcTableSearchFieldsDropdown", children: [
|
|
520
|
+
/* @__PURE__ */ h(U, { customTheme: l, onClick: we, children: [
|
|
521
|
+
/* @__PURE__ */ n(
|
|
522
|
+
q,
|
|
485
523
|
{
|
|
486
|
-
customTheme:
|
|
524
|
+
customTheme: l,
|
|
487
525
|
type: "checkbox",
|
|
488
|
-
checked:
|
|
526
|
+
checked: V.size === p.length,
|
|
489
527
|
onChange: () => {
|
|
490
528
|
}
|
|
491
529
|
}
|
|
492
530
|
),
|
|
493
|
-
/* @__PURE__ */
|
|
531
|
+
/* @__PURE__ */ n("span", { style: { fontWeight: "bold" }, children: "All" })
|
|
494
532
|
] }),
|
|
495
|
-
/* @__PURE__ */
|
|
496
|
-
|
|
497
|
-
|
|
533
|
+
/* @__PURE__ */ n("div", { style: { height: "1px", backgroundColor: s.colors.gray4, margin: "4px 0" } }),
|
|
534
|
+
p.map((e) => /* @__PURE__ */ h(
|
|
535
|
+
U,
|
|
498
536
|
{
|
|
499
|
-
customTheme:
|
|
500
|
-
onClick: () =>
|
|
537
|
+
customTheme: l,
|
|
538
|
+
onClick: () => be(e),
|
|
501
539
|
children: [
|
|
502
|
-
/* @__PURE__ */
|
|
503
|
-
|
|
540
|
+
/* @__PURE__ */ n(
|
|
541
|
+
q,
|
|
504
542
|
{
|
|
505
|
-
customTheme:
|
|
543
|
+
customTheme: l,
|
|
506
544
|
type: "checkbox",
|
|
507
|
-
checked:
|
|
545
|
+
checked: V.has(e),
|
|
508
546
|
onChange: () => {
|
|
509
547
|
}
|
|
510
548
|
}
|
|
511
549
|
),
|
|
512
|
-
/* @__PURE__ */
|
|
550
|
+
/* @__PURE__ */ n("span", { children: b[e] || e })
|
|
513
551
|
]
|
|
514
552
|
},
|
|
515
553
|
e
|
|
@@ -518,45 +556,45 @@ const ye = [
|
|
|
518
556
|
]
|
|
519
557
|
}
|
|
520
558
|
),
|
|
521
|
-
/* @__PURE__ */
|
|
559
|
+
/* @__PURE__ */ h(
|
|
522
560
|
"div",
|
|
523
561
|
{
|
|
524
562
|
style: { position: "relative" },
|
|
525
|
-
ref:
|
|
526
|
-
|
|
563
|
+
ref: te(() => {
|
|
564
|
+
X(!1);
|
|
527
565
|
}),
|
|
528
566
|
children: [
|
|
529
|
-
/* @__PURE__ */
|
|
530
|
-
|
|
567
|
+
/* @__PURE__ */ h(
|
|
568
|
+
se,
|
|
531
569
|
{
|
|
532
|
-
customTheme:
|
|
570
|
+
customTheme: l,
|
|
533
571
|
className: "jcTableColumnSettings",
|
|
534
|
-
onClick: () =>
|
|
572
|
+
onClick: () => X(!Q),
|
|
535
573
|
children: [
|
|
536
|
-
/* @__PURE__ */
|
|
574
|
+
/* @__PURE__ */ n(Ne, { size: 16 }),
|
|
537
575
|
"Columns",
|
|
538
|
-
/* @__PURE__ */
|
|
576
|
+
/* @__PURE__ */ n(H, { size: 16 })
|
|
539
577
|
]
|
|
540
578
|
}
|
|
541
579
|
),
|
|
542
|
-
|
|
543
|
-
|
|
580
|
+
Q && /* @__PURE__ */ n(le, { className: "jcTableColumnSettingsDropdown", children: p.map((e) => /* @__PURE__ */ h(
|
|
581
|
+
U,
|
|
544
582
|
{
|
|
545
|
-
customTheme:
|
|
546
|
-
onClick: () =>
|
|
583
|
+
customTheme: l,
|
|
584
|
+
onClick: () => ye(e),
|
|
547
585
|
children: [
|
|
548
|
-
/* @__PURE__ */
|
|
549
|
-
|
|
586
|
+
/* @__PURE__ */ n(
|
|
587
|
+
q,
|
|
550
588
|
{
|
|
551
|
-
customTheme:
|
|
589
|
+
customTheme: l,
|
|
552
590
|
type: "checkbox",
|
|
553
|
-
checked:
|
|
591
|
+
checked: O.has(e),
|
|
554
592
|
onChange: () => {
|
|
555
593
|
}
|
|
556
594
|
}
|
|
557
595
|
),
|
|
558
|
-
|
|
559
|
-
/* @__PURE__ */
|
|
596
|
+
O.has(e) ? /* @__PURE__ */ n(Ae, { size: 16 }) : /* @__PURE__ */ n(je, { size: 16 }),
|
|
597
|
+
/* @__PURE__ */ n("span", { children: b[e] || e })
|
|
560
598
|
]
|
|
561
599
|
},
|
|
562
600
|
e
|
|
@@ -566,92 +604,113 @@ const ye = [
|
|
|
566
604
|
)
|
|
567
605
|
] })
|
|
568
606
|
] }),
|
|
569
|
-
/* @__PURE__ */
|
|
570
|
-
|
|
571
|
-
|
|
607
|
+
/* @__PURE__ */ n("div", { style: { position: "absolute", width: 0, height: 0, overflow: "hidden", pointerEvents: "none" }, children: o.map(
|
|
608
|
+
(e, r) => p.map((t) => {
|
|
609
|
+
const i = e[t];
|
|
610
|
+
if (x.isValidElement(i)) {
|
|
611
|
+
const m = oe(r, t);
|
|
612
|
+
return /* @__PURE__ */ n(x.Fragment, { children: x.cloneElement(i, { ref: m }) }, `${r}-${t}`);
|
|
613
|
+
}
|
|
614
|
+
return null;
|
|
615
|
+
})
|
|
616
|
+
) }),
|
|
617
|
+
/* @__PURE__ */ h(He, { className: "jcTableContent", children: [
|
|
618
|
+
/* @__PURE__ */ n("thead", { children: /* @__PURE__ */ n(ae, { customTheme: l, interactableRow: !1, children: R.map((e) => /* @__PURE__ */ h(
|
|
619
|
+
Ue,
|
|
572
620
|
{
|
|
573
|
-
customTheme:
|
|
574
|
-
style:
|
|
575
|
-
onClick: () =>
|
|
621
|
+
customTheme: l,
|
|
622
|
+
style: w.key === e ? z.thActive : {},
|
|
623
|
+
onClick: () => xe(e),
|
|
624
|
+
title: I.includes(e) ? "This column is not sortable" : void 0,
|
|
576
625
|
children: [
|
|
577
|
-
|
|
578
|
-
/* @__PURE__ */
|
|
626
|
+
b[e] || e,
|
|
627
|
+
!I.includes(e) && /* @__PURE__ */ n(qe, { children: w.key === e ? w.direction === "asc" ? /* @__PURE__ */ n(ie, { size: 16 }) : /* @__PURE__ */ n(H, { size: 16 }) : /* @__PURE__ */ n(ie, { size: 16, style: { opacity: 0.313 } }) })
|
|
579
628
|
]
|
|
580
629
|
},
|
|
581
630
|
e
|
|
582
631
|
)) }) }),
|
|
583
|
-
/* @__PURE__ */
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
632
|
+
/* @__PURE__ */ n("tbody", { children: me.map((e, r) => {
|
|
633
|
+
const t = o.indexOf(e);
|
|
634
|
+
return /* @__PURE__ */ n(
|
|
635
|
+
ae,
|
|
636
|
+
{
|
|
637
|
+
customTheme: l,
|
|
638
|
+
onClick: () => j && j(e),
|
|
639
|
+
interactableRow: !!j,
|
|
640
|
+
children: R.map((i) => {
|
|
641
|
+
const m = e[i];
|
|
642
|
+
if (x.isValidElement(m)) {
|
|
643
|
+
const S = oe(t, i);
|
|
644
|
+
return /* @__PURE__ */ n(ce, { children: x.cloneElement(m, { ref: S }) }, i);
|
|
645
|
+
}
|
|
646
|
+
return /* @__PURE__ */ n(ce, { children: m }, i);
|
|
647
|
+
})
|
|
648
|
+
},
|
|
649
|
+
r
|
|
650
|
+
);
|
|
651
|
+
}) })
|
|
593
652
|
] }),
|
|
594
|
-
/* @__PURE__ */
|
|
595
|
-
/* @__PURE__ */
|
|
596
|
-
|
|
653
|
+
/* @__PURE__ */ h(We, { children: [
|
|
654
|
+
/* @__PURE__ */ n(
|
|
655
|
+
A,
|
|
597
656
|
{
|
|
598
|
-
customTheme:
|
|
599
|
-
style:
|
|
600
|
-
onClick: () =>
|
|
601
|
-
disabled:
|
|
657
|
+
customTheme: l,
|
|
658
|
+
style: d === 1 ? z.paginationButtonDisabled : {},
|
|
659
|
+
onClick: () => T(Math.max(1, d - 1)),
|
|
660
|
+
disabled: d === 1,
|
|
602
661
|
children: "Previous"
|
|
603
662
|
}
|
|
604
663
|
),
|
|
605
664
|
(() => {
|
|
606
665
|
const e = [];
|
|
607
666
|
if (g <= 5)
|
|
608
|
-
for (let
|
|
667
|
+
for (let r = 1; r <= g; r++)
|
|
609
668
|
e.push(
|
|
610
|
-
/* @__PURE__ */
|
|
611
|
-
|
|
669
|
+
/* @__PURE__ */ n(
|
|
670
|
+
A,
|
|
612
671
|
{
|
|
613
|
-
customTheme:
|
|
614
|
-
style:
|
|
615
|
-
onClick: () =>
|
|
616
|
-
children:
|
|
672
|
+
customTheme: l,
|
|
673
|
+
style: d === r ? z.paginationButtonActive : {},
|
|
674
|
+
onClick: () => T(r),
|
|
675
|
+
children: r
|
|
617
676
|
},
|
|
618
|
-
|
|
677
|
+
r
|
|
619
678
|
)
|
|
620
679
|
);
|
|
621
680
|
else {
|
|
622
681
|
e.push(
|
|
623
|
-
/* @__PURE__ */
|
|
624
|
-
|
|
682
|
+
/* @__PURE__ */ n(
|
|
683
|
+
A,
|
|
625
684
|
{
|
|
626
|
-
customTheme:
|
|
627
|
-
style:
|
|
628
|
-
onClick: () =>
|
|
685
|
+
customTheme: l,
|
|
686
|
+
style: d === 1 ? z.paginationButtonActive : {},
|
|
687
|
+
onClick: () => T(1),
|
|
629
688
|
children: "1"
|
|
630
689
|
},
|
|
631
690
|
1
|
|
632
691
|
)
|
|
633
|
-
),
|
|
634
|
-
const
|
|
635
|
-
for (let
|
|
692
|
+
), d > 3 && e.push(/* @__PURE__ */ n(de, { children: "..." }, "ellipsis1"));
|
|
693
|
+
const r = Math.max(2, d - 1), t = Math.min(g - 1, d + 1);
|
|
694
|
+
for (let i = r; i <= t; i++)
|
|
636
695
|
e.push(
|
|
637
|
-
/* @__PURE__ */
|
|
638
|
-
|
|
696
|
+
/* @__PURE__ */ n(
|
|
697
|
+
A,
|
|
639
698
|
{
|
|
640
|
-
customTheme:
|
|
641
|
-
style:
|
|
642
|
-
onClick: () =>
|
|
643
|
-
children:
|
|
699
|
+
customTheme: l,
|
|
700
|
+
style: d === i ? z.paginationButtonActive : {},
|
|
701
|
+
onClick: () => T(i),
|
|
702
|
+
children: i
|
|
644
703
|
},
|
|
645
|
-
|
|
704
|
+
i
|
|
646
705
|
)
|
|
647
706
|
);
|
|
648
|
-
|
|
649
|
-
/* @__PURE__ */
|
|
650
|
-
|
|
707
|
+
d < g - 2 && e.push(/* @__PURE__ */ n(de, { children: "..." }, "ellipsis2")), g > 1 && e.push(
|
|
708
|
+
/* @__PURE__ */ n(
|
|
709
|
+
A,
|
|
651
710
|
{
|
|
652
|
-
customTheme:
|
|
653
|
-
style:
|
|
654
|
-
onClick: () =>
|
|
711
|
+
customTheme: l,
|
|
712
|
+
style: d === g ? z.paginationButtonActive : {},
|
|
713
|
+
onClick: () => T(g),
|
|
655
714
|
children: g
|
|
656
715
|
},
|
|
657
716
|
g
|
|
@@ -660,29 +719,29 @@ const ye = [
|
|
|
660
719
|
}
|
|
661
720
|
return e;
|
|
662
721
|
})(),
|
|
663
|
-
/* @__PURE__ */
|
|
664
|
-
|
|
722
|
+
/* @__PURE__ */ n(
|
|
723
|
+
A,
|
|
665
724
|
{
|
|
666
|
-
customTheme:
|
|
667
|
-
style:
|
|
668
|
-
onClick: () =>
|
|
669
|
-
disabled:
|
|
725
|
+
customTheme: l,
|
|
726
|
+
style: d === g ? z.paginationButtonDisabled : {},
|
|
727
|
+
onClick: () => T(Math.min(g, d + 1)),
|
|
728
|
+
disabled: d === g,
|
|
670
729
|
children: "Next"
|
|
671
730
|
}
|
|
672
731
|
)
|
|
673
732
|
] }),
|
|
674
|
-
/* @__PURE__ */
|
|
733
|
+
/* @__PURE__ */ h(Ke, { children: [
|
|
675
734
|
"Showing ",
|
|
676
|
-
Math.min((
|
|
735
|
+
Math.min((d - 1) * C + 1, k.length),
|
|
677
736
|
" to",
|
|
678
737
|
" ",
|
|
679
|
-
Math.min(
|
|
738
|
+
Math.min(d * C, k.length),
|
|
680
739
|
" of ",
|
|
681
|
-
|
|
740
|
+
k.length,
|
|
682
741
|
" entries"
|
|
683
742
|
] })
|
|
684
743
|
] });
|
|
685
744
|
};
|
|
686
745
|
export {
|
|
687
|
-
|
|
746
|
+
no as default
|
|
688
747
|
};
|
package/Timer/Timer.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface TimerHandle {
|
|
2
|
+
getTableValue: () => number;
|
|
3
|
+
}
|
|
4
|
+
export interface TimerProps {
|
|
5
|
+
timeStart?: string;
|
|
6
|
+
timeEnd?: string;
|
|
7
|
+
duration?: number;
|
|
8
|
+
type?: 'countdown' | 'overdue' | 'elapsed';
|
|
9
|
+
ref?: React.Ref<TimerHandle>;
|
|
10
|
+
}
|
|
11
|
+
export interface TimerComponent extends React.FC<TimerProps> {
|
|
12
|
+
getTableValue: (props: TimerProps) => number;
|
|
13
|
+
}
|
|
14
|
+
export declare const Timer: TimerComponent;
|
|
15
|
+
export default Timer;
|
package/Timer/Timer.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { jsx as a, jsxs as d } from "react/jsx-runtime";
|
|
2
|
+
import { n as g } from "../.chunks/emotion-styled.browser.esm.js";
|
|
3
|
+
import { c as v } from "../.chunks/emotion-react.browser.esm.js";
|
|
4
|
+
import { useState as S, useEffect as m, useImperativeHandle as T } from "react";
|
|
5
|
+
import w from "../theme.js";
|
|
6
|
+
const l = (e) => {
|
|
7
|
+
const n = (/* @__PURE__ */ new Date(e.replace(" ", "T").replace("Z", "") + "Z")).getTime(), t = (/* @__PURE__ */ new Date()).getTime();
|
|
8
|
+
return Math.round((t - n) / 1e3);
|
|
9
|
+
}, f = (e) => {
|
|
10
|
+
const n = Math.floor(e / 60), t = Math.floor(n / 60), r = n - t * 60, i = e % 60;
|
|
11
|
+
return `${t}:${String(r).padStart(2, "0")}:${String(i).padStart(2, "0")}`;
|
|
12
|
+
}, u = g("span")(({ textColor: e }) => ({
|
|
13
|
+
...v`
|
|
14
|
+
color: ${e || "inherit"};
|
|
15
|
+
white-space: nowrap;
|
|
16
|
+
|
|
17
|
+
.blink {
|
|
18
|
+
animation: blinker 1.5s linear infinite;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@keyframes blinker {
|
|
22
|
+
50% {
|
|
23
|
+
opacity: 0;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
`
|
|
27
|
+
})), o = () => /* @__PURE__ */ a("span", { style: { visibility: "hidden" }, children: "− " }), D = ({ timeStart: e, ref: n }) => {
|
|
28
|
+
const [t, r] = S(0);
|
|
29
|
+
return m(() => {
|
|
30
|
+
const i = l(e || (/* @__PURE__ */ new Date()).toISOString());
|
|
31
|
+
r(i >= 0 ? i : 0);
|
|
32
|
+
}, [e]), m(() => {
|
|
33
|
+
const i = setInterval(() => {
|
|
34
|
+
r((s) => s + 1);
|
|
35
|
+
}, 1e3);
|
|
36
|
+
return () => clearInterval(i);
|
|
37
|
+
}, []), T(
|
|
38
|
+
n,
|
|
39
|
+
() => ({
|
|
40
|
+
getTableValue: () => t
|
|
41
|
+
}),
|
|
42
|
+
[t]
|
|
43
|
+
), /* @__PURE__ */ d(u, { children: [
|
|
44
|
+
/* @__PURE__ */ a(o, {}),
|
|
45
|
+
f(t),
|
|
46
|
+
/* @__PURE__ */ a(o, {})
|
|
47
|
+
] });
|
|
48
|
+
}, I = ({ timeStart: e, timeEnd: n, duration: t, type: r, ref: i }) => {
|
|
49
|
+
const [s, h] = S(t || 30);
|
|
50
|
+
return m(() => {
|
|
51
|
+
var c;
|
|
52
|
+
n ? c = l(n) * -1 : e && t ? c = t - l(e) : c = t || 30, h(c);
|
|
53
|
+
}, [t, r, e, n]), m(() => {
|
|
54
|
+
const c = setInterval(() => {
|
|
55
|
+
h((b) => b - 1);
|
|
56
|
+
}, 1e3);
|
|
57
|
+
return () => clearInterval(c);
|
|
58
|
+
}, []), T(
|
|
59
|
+
i,
|
|
60
|
+
() => ({
|
|
61
|
+
getTableValue: () => s
|
|
62
|
+
}),
|
|
63
|
+
[s]
|
|
64
|
+
), r !== "overdue" && s <= 0 ? /* @__PURE__ */ d(u, { children: [
|
|
65
|
+
/* @__PURE__ */ a(o, {}),
|
|
66
|
+
/* @__PURE__ */ a("span", { className: "blink", children: f(0) }),
|
|
67
|
+
/* @__PURE__ */ a(o, {})
|
|
68
|
+
] }) : r === "overdue" && s < 0 ? /* @__PURE__ */ d(u, { textColor: w.colors.qalb, children: [
|
|
69
|
+
"− ",
|
|
70
|
+
f(-s),
|
|
71
|
+
/* @__PURE__ */ a(o, {})
|
|
72
|
+
] }) : /* @__PURE__ */ d(u, { children: [
|
|
73
|
+
/* @__PURE__ */ a(o, {}),
|
|
74
|
+
f(s),
|
|
75
|
+
/* @__PURE__ */ a(o, {})
|
|
76
|
+
] });
|
|
77
|
+
}, k = ({ type: e, timeStart: n, ref: t, ...r }) => {
|
|
78
|
+
const [i] = S((/* @__PURE__ */ new Date()).toISOString());
|
|
79
|
+
return e === "elapsed" ? /* @__PURE__ */ a(D, { ref: t, type: e, timeStart: n || i, ...r }) : /* @__PURE__ */ a(I, { ref: t, type: e, timeStart: n || i, ...r });
|
|
80
|
+
};
|
|
81
|
+
k.getTableValue = (e) => e.type === "elapsed" && e.timeStart ? l(e.timeStart) : e.type === "elapsed" ? 0 : e.timeEnd ? l(e.timeEnd) * -1 : e.timeStart && e.duration ? e.duration - l(e.timeStart) : e.duration ?? 0;
|
|
82
|
+
export {
|
|
83
|
+
k as Timer,
|
|
84
|
+
k as default
|
|
85
|
+
};
|
package/Timer/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default, type TimerProps } from './Timer';
|
package/Timer/index.js
ADDED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jcicl",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.25",
|
|
5
5
|
"description": "Component library for the websites of Johnson County Iowa",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://devops.jc.net/JCIT/Business%20Solutions%20Delivery/_git/JCComponentLibrary?path=%2FREADME.md&version=GBmaster",
|
package/utils.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import s from "./theme.js";
|
|
2
2
|
import { u as m } from "./.chunks/useMediaQuery.js";
|
|
3
|
-
const x = () => m(`(max-width: ${
|
|
3
|
+
const x = () => m(`(max-width: ${s.screenSizes.mobile})`), S = () => m(`(max-width: ${s.screenSizes.tablet})`), b = (r, e = "mmddyyyy") => e === "mmddyyyy" ? (/* @__PURE__ */ new Date(r.replace(" ", "T").replace("Z", "") + "Z")).toLocaleDateString("en-US", {
|
|
4
|
+
timeZone: "America/Chicago",
|
|
4
5
|
month: "numeric",
|
|
5
6
|
day: "numeric",
|
|
6
7
|
year: "numeric"
|
|
7
8
|
}) : r, D = (r) => {
|
|
8
|
-
const { line1: e, line2: i, city: o, state: n, zip:
|
|
9
|
+
const { line1: e, line2: i, city: o, state: n, zip: a } = r;
|
|
9
10
|
let t = e || "";
|
|
10
|
-
return i && (t.length > 0 && (t += ", "), t += i), o && (t.length > 0 && (t += ", "), t += o), n && (t.length > 0 && (t += ", "), t += n),
|
|
11
|
+
return i && (t.length > 0 && (t += ", "), t += i), o && (t.length > 0 && (t += ", "), t += o), n && (t.length > 0 && (t += ", "), t += n), a && (t += ` ${a}`), t;
|
|
11
12
|
}, g = (r) => {
|
|
12
13
|
if (r > 3 && r < 21) return "th";
|
|
13
14
|
switch (r % 10) {
|
|
@@ -31,25 +32,25 @@ const x = () => m(`(max-width: ${c.screenSizes.mobile})`), S = () => m(`(max-wid
|
|
|
31
32
|
minute: "2-digit",
|
|
32
33
|
hour12: !0
|
|
33
34
|
}).formatToParts(e), n = (y) => {
|
|
34
|
-
var
|
|
35
|
-
return ((
|
|
36
|
-
},
|
|
37
|
-
return `${
|
|
35
|
+
var c;
|
|
36
|
+
return ((c = o.find(($) => $.type === y)) == null ? void 0 : c.value) ?? "";
|
|
37
|
+
}, a = n("month") + ".", t = Number(n("day")), u = n("year"), l = n("hour"), d = n("minute"), f = n("dayPeriod").toLowerCase(), h = g(t);
|
|
38
|
+
return `${a} ${t}${h}, ${u}, ${l}:${d}${f}`;
|
|
38
39
|
} catch {
|
|
39
40
|
return r;
|
|
40
41
|
}
|
|
41
|
-
},
|
|
42
|
+
}, Z = (r) => {
|
|
42
43
|
if (r == null) return ["", void 0];
|
|
43
44
|
let e = r.replace(/\D/g, "") || "";
|
|
44
45
|
e.at(0) == "1" && (e = e.slice(1));
|
|
45
|
-
const i = e.slice(0, 3), o = e.slice(3, 6), n = e.slice(6, 10),
|
|
46
|
+
const i = e.slice(0, 3), o = e.slice(3, 6), n = e.slice(6, 10), a = e.slice(10);
|
|
46
47
|
let t = e;
|
|
47
|
-
return e.length >= 4 && (t = `(${i}) ${e.slice(3)}`), e.length >= 7 && (t = `(${i}) ${o}-${e.slice(6)}`), e.length > 10 && (t = `(${i}) ${o}-${n} ext. ${
|
|
48
|
+
return e.length >= 4 && (t = `(${i}) ${e.slice(3)}`), e.length >= 7 && (t = `(${i}) ${o}-${e.slice(6)}`), e.length > 10 && (t = `(${i}) ${o}-${n} ext. ${a}`), [t, e];
|
|
48
49
|
};
|
|
49
50
|
export {
|
|
50
51
|
D as formatAddress,
|
|
51
52
|
b as formatDate,
|
|
52
|
-
|
|
53
|
+
Z as formatPhoneNumber,
|
|
53
54
|
T as formatTimestamp,
|
|
54
55
|
x as isMobile,
|
|
55
56
|
S as isTablet
|