jcicl 0.0.343 → 1.0.1

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.js CHANGED
@@ -1,32 +1,33 @@
1
- import { jsxs as c, jsx as t } from "react/jsx-runtime";
2
- import ve, { useState as x, useMemo as N } from "react";
3
- import o from "../theme.js";
4
- import { c as r } from "../.chunks/emotion-react.browser.esm.js";
5
- import { n as s } from "../.chunks/emotion-styled.browser.esm.js";
6
- import { Button as Ce } from "../Button/Button.js";
7
- import { Flex as Se } from "../Flex/Flex.js";
8
- import { c as C } from "../.chunks/createLucideIcon.js";
1
+ import { jsxs as l, jsx as o } from "react/jsx-runtime";
2
+ import { useState as m, useMemo as T, useEffect as q } from "react";
3
+ import n from "../theme.js";
4
+ import { c as s } from "../.chunks/emotion-react.browser.esm.js";
5
+ import { n as a } from "../.chunks/emotion-styled.browser.esm.js";
6
+ import { Button as ce } from "../Button/Button.js";
7
+ import { Flex as le } from "../Flex/Flex.js";
8
+ import { useThemeColors as de } from "../ThemeContext.js";
9
+ import { c as S } from "../.chunks/createLucideIcon.js";
9
10
  /**
10
11
  * @license lucide-react v0.525.0 - ISC
11
12
  *
12
13
  * This source code is licensed under the ISC license.
13
14
  * See the LICENSE file in the root directory of this source tree.
14
15
  */
15
- const $e = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]], E = C("chevron-down", $e);
16
+ const he = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]], _ = S("chevron-down", he);
16
17
  /**
17
18
  * @license lucide-react v0.525.0 - ISC
18
19
  *
19
20
  * This source code is licensed under the ISC license.
20
21
  * See the LICENSE file in the root directory of this source tree.
21
22
  */
22
- const ze = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]], q = C("chevron-up", ze);
23
+ const pe = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]], W = S("chevron-up", pe);
23
24
  /**
24
25
  * @license lucide-react v0.525.0 - ISC
25
26
  *
26
27
  * This source code is licensed under the ISC license.
27
28
  * See the LICENSE file in the root directory of this source tree.
28
29
  */
29
- const je = [
30
+ const xe = [
30
31
  [
31
32
  "path",
32
33
  {
@@ -43,14 +44,14 @@ const je = [
43
44
  }
44
45
  ],
45
46
  ["path", { d: "m2 2 20 20", key: "1ooewy" }]
46
- ], Te = C("eye-off", je);
47
+ ], ge = S("eye-off", xe);
47
48
  /**
48
49
  * @license lucide-react v0.525.0 - ISC
49
50
  *
50
51
  * This source code is licensed under the ISC license.
51
52
  * See the LICENSE file in the root directory of this source tree.
52
53
  */
53
- const Ne = [
54
+ const ue = [
54
55
  [
55
56
  "path",
56
57
  {
@@ -59,24 +60,24 @@ const Ne = [
59
60
  }
60
61
  ],
61
62
  ["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
62
- ], Ae = C("eye", Ne);
63
+ ], be = S("eye", ue);
63
64
  /**
64
65
  * @license lucide-react v0.525.0 - ISC
65
66
  *
66
67
  * This source code is licensed under the ISC license.
67
68
  * See the LICENSE file in the root directory of this source tree.
68
69
  */
69
- const De = [
70
+ const fe = [
70
71
  ["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
71
72
  ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
72
- ], W = C("search", De);
73
+ ], Q = S("search", fe);
73
74
  /**
74
75
  * @license lucide-react v0.525.0 - ISC
75
76
  *
76
77
  * This source code is licensed under the ISC license.
77
78
  * See the LICENSE file in the root directory of this source tree.
78
79
  */
79
- const Be = [
80
+ const me = [
80
81
  [
81
82
  "path",
82
83
  {
@@ -85,74 +86,272 @@ const Be = [
85
86
  }
86
87
  ],
87
88
  ["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
88
- ], _e = C("settings", Be);
89
- let v = "";
90
- const He = ({
91
- data: f = [],
92
- columnTitles: z = {},
93
- rowsPerPage: b = 19,
94
- title: K = "Data Table",
89
+ ], ye = S("settings", me), we = a("div")(() => ({
90
+ ...s`
91
+ background-color: ${n.colors.white};
92
+ border-radius: 8px;
93
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
94
+ padding: 20px;
95
+ font-family: Arial, sans-serif;
96
+ width: 100%;
97
+ overflow: auto;
98
+ `
99
+ })), Ce = a("div")(() => ({
100
+ ...s`
101
+ display: flex;
102
+ flex-direction: column;
103
+ justify-content: space-between;
104
+ align-items: center;
105
+ margin-bottom: 20px;
106
+ flex-wrap: wrap;
107
+ gap: 9px;
108
+ `
109
+ })), ke = a("div")(() => ({
110
+ ...s`
111
+ display: flex;
112
+ justify-content: space-between;
113
+ width: 100%;
114
+ align-items: center;
115
+ `
116
+ })), ve = a("h2")(() => ({
117
+ ...s`
118
+ font-size: 24px;
119
+ font-weight: bold;
120
+ color: ${n.colors.black};
121
+ margin: 0;
122
+ `
123
+ })), Se = a("div")(() => ({
124
+ ...s`
125
+ display: flex;
126
+ justify-content: flex-end;
127
+ width: 100%;
128
+ gap: 15px;
129
+ align-items: center;
130
+ flex-wrap: wrap;
131
+ `
132
+ })), $e = a("div")(() => ({
133
+ ...s`
134
+ position: relative;
135
+ display: flex;
136
+ align-items: center;
137
+ flex-grow: 1;
138
+ `
139
+ })), ze = a(Q)(({ customTheme: t }) => ({
140
+ ...s`
141
+ position: absolute;
142
+ left: 13px;
143
+ top: 10px;
144
+ color: ${n.colors.gray3};
145
+ width: 19px;
146
+ height: 19px;
147
+ transition: all 313ms ease;
148
+ :focus,
149
+ :hover,
150
+ :focus-within {
151
+ cursor: pointer;
152
+ color: ${t.themeColor};
153
+ }
154
+ `
155
+ })), je = a("input")(({ customTheme: t }) => ({
156
+ ...s`
157
+ padding: 10px 15px 10px 40px;
158
+ border: 2px solid ${n.colors.gray4};
159
+ border-radius: 25px;
160
+ font-size: 14px;
161
+ min-width: 270px;
162
+ width: 100%;
163
+ transition: all 313ms ease;
164
+ outline: none;
165
+ background-color: ${n.colors.white};
166
+ :focus,
167
+ :hover,
168
+ :focus-within {
169
+ border-color: ${t.themeColor};
170
+ /* box-shadow: 0 0 0 3px rgba(0, 146, 0, 0.1); */
171
+ box-shadow: 0 0 0 3px ${t.themeColor}18;
172
+ }
173
+ `
174
+ })), Y = a("button")(({ customTheme: t }) => ({
175
+ ...s`
176
+ padding: 10px 15px;
177
+ border: 2px solid ${t.themeColor};
178
+ border-radius: 6px;
179
+ background-color: ${n.colors.white};
180
+ color: ${t.themeColor};
181
+ cursor: pointer;
182
+ display: flex;
183
+ align-items: center;
184
+ gap: 8px;
185
+ font-size: 14px;
186
+ font-weight: 500;
187
+ transition: all 0.3s ease;
188
+ outline: none;
189
+ :focus,
190
+ :hover,
191
+ :focus-within {
192
+ background-color: ${t.themeColor};
193
+ color: ${n.colors.white};
194
+ transform: translateY(-1px);
195
+ /* box-shadow: 0 4px 12px rgba(0, 146, 0, 0.3); */
196
+ box-shadow: 0 4px 12px ${t.themeColor}4c;
197
+ }
198
+ `
199
+ })), G = a("div")(() => ({
200
+ ...s`
201
+ position: absolute;
202
+ top: 100%;
203
+ right: 0;
204
+ margin-top: 5px;
205
+ background-color: ${n.colors.white};
206
+ border: 1px solid ${n.colors.gray4};
207
+ border-radius: 6px;
208
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
209
+ z-index: 1000;
210
+ min-width: 200px;
211
+ max-height: 300px;
212
+ overflow-y: auto;
213
+ `
214
+ })), L = a("div")(({ customTheme: t }) => ({
215
+ ...s`
216
+ padding: 12px 16px;
217
+ display: flex;
218
+ align-items: center;
219
+ gap: 10px;
220
+ cursor: pointer;
221
+ font-size: 14px;
222
+ color: ${n.colors.slate};
223
+ transition: all 0.2s ease;
224
+ :focus,
225
+ :hover,
226
+ :focus-within {
227
+ background-color: ${t.themeLightB};
228
+ color: ${t.themeDark};
229
+ }
230
+ `
231
+ })), E = a("input")(({ customTheme: t }) => ({
232
+ ...s`
233
+ width: 16px;
234
+ height: 16px;
235
+ accent-color: ${t.themeColor};
236
+ `
237
+ })), De = a("table")(() => ({
238
+ ...s`
239
+ width: 100%;
240
+ border-collapse: collapse;
241
+ background-color: ${n.colors.white};
242
+ border-radius: 8px;
243
+ overflow: hidden;
244
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
245
+ `
246
+ })), Ne = a("th")(({ customTheme: t }) => ({
247
+ ...s`
248
+ background-color: ${n.colors.whiteBlue};
249
+ color: ${n.colors.slate};
250
+ padding: 16px 12px;
251
+ text-align: left;
252
+ font-size: 14px;
253
+ font-weight: 600;
254
+ border-bottom: 2px solid ${n.colors.gray4};
255
+ cursor: pointer;
256
+ user-select: none;
257
+ transition: all 0.2s ease;
258
+ position: relative;
259
+ white-space: nowrap;
260
+ :focus,
261
+ :hover,
262
+ :focus-within {
263
+ background-color: ${t.themeLightC};
264
+ color: ${t.themeDark};
265
+ }
266
+ `
267
+ })), Te = a("td")(() => ({
268
+ ...s`
269
+ padding: 14px 12px;
270
+ border-bottom: 1px solid ${n.colors.almostWhite};
271
+ font-size: 14px;
272
+ color: ${n.colors.slate};
273
+ transition: all 0.2s ease;
274
+ `
275
+ })), Ae = a("span")(() => ({
276
+ ...s`
277
+ margin-left: 8px;
278
+ opacity: 0.6;
279
+ `
280
+ })), J = a("tr")(({ interactableRow: t, customTheme: y }) => ({
281
+ ...s`
282
+ transition: all 0.2s ease;
283
+ ${t && s`
284
+ :focus,
285
+ :hover,
286
+ :focus-within {
287
+ background-color: ${y.themeLightD};
288
+ cursor: pointer;
289
+ }
290
+ `}
291
+ `
292
+ })), Be = a("div")(() => ({
293
+ ...s`
294
+ display: flex;
295
+ justify-content: center;
296
+ align-items: center;
297
+ margin-top: 20px;
298
+ gap: 10px;
299
+ `
300
+ })), v = a("button")(({ customTheme: t }) => ({
301
+ ...s`
302
+ padding: 8px 12px;
303
+ border: 1px solid ${n.colors.gray4};
304
+ border-radius: 4px;
305
+ background-color: ${n.colors.white};
306
+ color: ${n.colors.slate};
307
+ cursor: pointer;
308
+ font-size: 14px;
309
+ transition: all 0.2s ease;
310
+ outline: none;
311
+ :focus,
312
+ :hover,
313
+ :focus-within {
314
+ background-color: ${t.themeColor};
315
+ color: ${n.colors.white};
316
+ border-color: ${t.themeColor};
317
+ }
318
+ :disabled {
319
+ opacity: 0.5;
320
+ cursor: not-allowed;
321
+ }
322
+ `
323
+ })), Me = a("div")(() => ({
324
+ ...s`
325
+ font-size: 14px;
326
+ color: ${n.colors.gray3};
327
+ text-align: center;
328
+ margin-top: 10px;
329
+ `
330
+ })), K = a("span")(() => ({
331
+ ...s`
332
+ padding: 8px 4px;
333
+ color: ${n.colors.gray3};
334
+ font-size: 14px;
335
+ `
336
+ })), Ue = ({
337
+ data: t = [],
338
+ columnTitles: y = {},
339
+ rowsPerPage: w = 19,
340
+ title: X = "Data Table",
95
341
  onRowClick: A,
96
- hiddenColumns: Y = [],
97
- defaultSort: J = { key: "", direction: "asc" },
98
- extraActions: F
342
+ hiddenColumns: Z = [],
343
+ defaultSort: F = { key: "", direction: "asc" },
344
+ extraActions: I
99
345
  }) => {
100
- const [i, y] = x(1), [, Q] = x(""), [p, X] = x(J), [m, j] = x(/* @__PURE__ */ new Set()), [D, I] = x(/* @__PURE__ */ new Set()), [V, Z] = x(!1), [L, P] = x(!1), a = N(() => f.length === 0 ? [] : Object.keys(f[0]).filter((e) => !Y.includes(e)), [f]);
101
- ve.useEffect(() => {
102
- a.length > 0 && (I(new Set(a)), j(new Set(a)));
103
- }, [a]);
104
- const B = N(() => {
105
- if (!v) return f;
106
- const e = m.size > 0 ? m : new Set(a);
107
- return f.filter((n) => Array.from(e).some((l) => {
108
- const h = n[l];
109
- return h && h.toString().toLowerCase().includes(v.toLowerCase());
110
- }));
111
- }, [f, v, m, a]), g = N(() => p.key ? [...B].sort((e, n) => e[p.key] < n[p.key] ? p.direction === "asc" ? -1 : 1 : e[p.key] > n[p.key] ? p.direction === "asc" ? 1 : -1 : 0) : B, [B, p]), T = a.filter((e) => D.has(e)), ee = () => {
112
- if (!Array.isArray(g) || g.length === 0) return;
113
- const e = T.map((k) => z[k] || k), n = (k) => {
114
- const $ = String(k ?? "");
115
- return /[",\n]/.test($) ? `"${$.replace(/"/g, '""')}"` : $;
116
- }, h = [
117
- e.join(","),
118
- // header row
119
- ...g.map((k) => T.map(($) => n(k[$])).join(","))
120
- ].join(`
121
- `), ke = new Blob([h], { type: "text/csv;charset=utf-8;" }), S = document.createElement("a");
122
- S.href = URL.createObjectURL(ke), S.download = "data.csv", document.body.appendChild(S), S.click(), document.body.removeChild(S);
123
- }, oe = N(() => {
124
- const e = (i - 1) * b;
125
- return g.slice(e, e + b);
126
- }, [g, i, b]), d = Math.ceil(g.length / b), te = (e) => {
127
- X((n) => ({
128
- key: e,
129
- direction: n.key === e && n.direction === "asc" ? "desc" : "asc"
130
- }));
131
- }, ne = (e) => {
132
- j((n) => {
133
- const l = new Set(n);
134
- return l.has(e) ? l.delete(e) : l.add(e), l;
135
- });
136
- }, re = () => {
137
- m.size === a.length ? j(/* @__PURE__ */ new Set()) : j(new Set(a));
138
- }, se = (e) => {
139
- I((n) => {
140
- const l = new Set(n);
141
- return l.has(e) ? l.delete(e) : l.add(e), l;
142
- });
143
- }, ie = (e) => {
144
- v = e;
145
- }, G = () => {
146
- Q(v);
147
- }, u = {
346
+ const [c, b] = m(1), [j, V] = m(""), [x, H] = m(F), [C, D] = m(/* @__PURE__ */ new Set()), [B, O] = m(/* @__PURE__ */ new Set()), [R, P] = m(!1), [U, ee] = m(!1), i = de(), f = {
148
347
  thActive: {
149
- backgroundColor: o.colors.green,
150
- color: o.colors.white
348
+ backgroundColor: i.themeColor,
349
+ color: n.colors.white
151
350
  },
152
351
  paginationButtonActive: {
153
- backgroundColor: o.colors.green,
154
- color: o.colors.white,
155
- borderColor: o.colors.green
352
+ backgroundColor: i.themeColor,
353
+ color: n.colors.white,
354
+ borderColor: i.themeColor
156
355
  },
157
356
  paginationButtonDisabled: {
158
357
  opacity: 0.5,
@@ -160,438 +359,287 @@ const He = ({
160
359
  },
161
360
  info: {
162
361
  fontSize: "14px",
163
- color: o.colors.gray3,
362
+ color: n.colors.gray3,
164
363
  textAlign: "center",
165
364
  marginTop: "10px"
166
365
  }
167
- }, ce = s("div")(() => ({
168
- ...r`
169
- background-color: ${o.colors.white};
170
- border-radius: 8px;
171
- box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
172
- padding: 20px;
173
- font-family: Arial, sans-serif;
174
- width: 100%;
175
- overflow: auto;
176
- `
177
- })), le = s("div")(() => ({
178
- ...r`
179
- display: flex;
180
- flex-direction: column;
181
- justify-content: space-between;
182
- align-items: center;
183
- margin-bottom: 20px;
184
- flex-wrap: wrap;
185
- gap: 9px;
186
- `
187
- })), ae = s("div")(() => ({
188
- ...r`
189
- display: flex;
190
- justify-content: space-between;
191
- width: 100%;
192
- align-items: center;
193
- `
194
- })), de = s("h2")(() => ({
195
- ...r`
196
- font-size: 24px;
197
- font-weight: bold;
198
- color: ${o.colors.black};
199
- margin: 0;
200
- `
201
- })), pe = s("div")(() => ({
202
- ...r`
203
- display: flex;
204
- justify-content: flex-end;
205
- width: 100%;
206
- gap: 15px;
207
- align-items: center;
208
- flex-wrap: wrap;
209
- `
210
- })), he = s("div")(() => ({
211
- ...r`
212
- position: relative;
213
- display: flex;
214
- align-items: center;
215
- flex-grow: 1;
216
- `
217
- })), ge = s(W)(() => ({
218
- ...r`
219
- position: absolute;
220
- left: 13px;
221
- top: 10px;
222
- color: ${o.colors.gray3};
223
- width: 19px;
224
- height: 19px;
225
- transition: all 313ms ease;
226
- :focus,
227
- :hover,
228
- :focus-within {
229
- cursor: pointer;
230
- color: ${o.colors.green};
231
- }
232
- `
233
- })), ue = s("input")(() => ({
234
- ...r`
235
- padding: 10px 15px 10px 40px;
236
- border: 2px solid ${o.colors.gray4};
237
- border-radius: 25px;
238
- font-size: 14px;
239
- min-width: 270px;
240
- width: 100%;
241
- transition: all 313ms ease;
242
- outline: none;
243
- background-color: ${o.colors.white};
244
- :focus,
245
- :hover,
246
- :focus-within {
247
- border-color: ${o.colors.green};
248
- box-shadow: 0 0 0 3px rgba(0, 146, 0, 0.1);
249
- }
250
- `
251
- })), R = s("button")(() => ({
252
- ...r`
253
- padding: 10px 15px;
254
- border: 2px solid ${o.colors.green};
255
- border-radius: 6px;
256
- background-color: ${o.colors.white};
257
- color: ${o.colors.green};
258
- cursor: pointer;
259
- display: flex;
260
- align-items: center;
261
- gap: 8px;
262
- font-size: 14px;
263
- font-weight: 500;
264
- transition: all 0.3s ease;
265
- outline: none;
266
- :focus,
267
- :hover,
268
- :focus-within {
269
- background-color: ${o.colors.green};
270
- color: ${o.colors.white};
271
- transform: translateY(-1px);
272
- box-shadow: 0 4px 12px rgba(0, 146, 0, 0.3);
273
- }
274
- `
275
- })), H = s("div")(() => ({
276
- ...r`
277
- position: absolute;
278
- top: 100%;
279
- right: 0;
280
- margin-top: 5px;
281
- background-color: ${o.colors.white};
282
- border: 1px solid ${o.colors.gray4};
283
- border-radius: 6px;
284
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
285
- z-index: 1000;
286
- min-width: 200px;
287
- max-height: 300px;
288
- overflow-y: auto;
289
- `
290
- })), _ = s("div")(() => ({
291
- ...r`
292
- padding: 12px 16px;
293
- display: flex;
294
- align-items: center;
295
- gap: 10px;
296
- cursor: pointer;
297
- font-size: 14px;
298
- color: ${o.colors.slate};
299
- transition: all 0.2s ease;
300
- :focus,
301
- :hover,
302
- :focus-within {
303
- background-color: ${o.colors.whiteGreenB};
304
- color: ${o.colors.darkGreen};
305
- }
306
- `
307
- })), M = s("input")(() => ({
308
- ...r`
309
- width: 16px;
310
- height: 16px;
311
- accent-color: ${o.colors.green};
312
- `
313
- })), xe = s("table")(() => ({
314
- ...r`
315
- width: 100%;
316
- border-collapse: collapse;
317
- background-color: ${o.colors.white};
318
- border-radius: 8px;
319
- overflow: hidden;
320
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
321
- `
322
- })), fe = s("th")(() => ({
323
- ...r`
324
- background-color: ${o.colors.whiteBlue};
325
- color: ${o.colors.slate};
326
- padding: 16px 12px;
327
- text-align: left;
328
- font-size: 14px;
329
- font-weight: 600;
330
- border-bottom: 2px solid ${o.colors.gray4};
331
- cursor: pointer;
332
- user-select: none;
333
- transition: all 0.2s ease;
334
- position: relative;
335
- white-space: nowrap;
336
- :focus,
337
- :hover,
338
- :focus-within {
339
- background-color: ${o.colors.whiteGreenC};
340
- color: ${o.colors.darkGreen};
341
- }
342
- `
343
- })), be = s("td")(() => ({
344
- ...r`
345
- padding: 14px 12px;
346
- border-bottom: 1px solid ${o.colors.almostWhite};
347
- font-size: 14px;
348
- color: ${o.colors.slate};
349
- transition: all 0.2s ease;
350
- `
351
- })), ye = s("span")(() => ({
352
- ...r`
353
- margin-left: 8px;
354
- opacity: 0.6;
355
- `
356
- })), O = s("tr")(({ interactableRow: e }) => ({
357
- ...r`
358
- transition: all 0.2s ease;
359
- ${e && r`
360
- :focus,
361
- :hover,
362
- :focus-within {
363
- background-color: ${o.colors.whiteGreenD};
364
- cursor: pointer;
365
- }
366
- `}
367
- `
368
- })), me = s("div")(() => ({
369
- ...r`
370
- display: flex;
371
- justify-content: center;
372
- align-items: center;
373
- margin-top: 20px;
374
- gap: 10px;
375
- `
376
- })), w = s("button")(() => ({
377
- ...r`
378
- padding: 8px 12px;
379
- border: 1px solid ${o.colors.gray4};
380
- border-radius: 4px;
381
- background-color: ${o.colors.white};
382
- color: ${o.colors.slate};
383
- cursor: pointer;
384
- font-size: 14px;
385
- transition: all 0.2s ease;
386
- outline: none;
387
- :focus,
388
- :hover,
389
- :focus-within {
390
- background-color: ${o.colors.green};
391
- color: ${o.colors.white};
392
- border-color: ${o.colors.green};
393
- }
394
- :disabled {
395
- opacity: 0.5;
396
- cursor: not-allowed;
397
- }
398
- `
399
- })), we = s("div")(() => ({
400
- ...r`
401
- font-size: 14px;
402
- color: ${o.colors.gray3};
403
- text-align: center;
404
- margin-top: 10px;
405
- `
406
- })), U = s("span")(() => ({
407
- ...r`
408
- padding: 8px 4px;
409
- color: ${o.colors.gray3};
410
- font-size: 14px;
411
- `
412
- }));
413
- return /* @__PURE__ */ c(ce, { className: "jcTableContainer", children: [
414
- /* @__PURE__ */ c(le, { className: "jcTableHeader", children: [
415
- /* @__PURE__ */ c(ae, { className: "jcTableTitleAndActions", children: [
416
- /* @__PURE__ */ t(de, { children: K }),
417
- /* @__PURE__ */ c(Se, { className: "jcTableExtraComponentsBox", gap: "9px", children: [
418
- F && F,
419
- /* @__PURE__ */ t(Ce, { onClick: ee, children: "Export to CSV" })
366
+ }, h = T(() => t.length === 0 ? [] : Object.keys(t[0]).filter((e) => !Z.includes(e)), [t]);
367
+ q(() => {
368
+ h.length > 0 && (O(new Set(h)), D(new Set(h)));
369
+ }, [h]), q(() => {
370
+ V(""), H(F), b(1);
371
+ }, []);
372
+ const M = T(() => {
373
+ if (!j) return t;
374
+ const e = C.size > 0 ? C : new Set(h);
375
+ return t.filter((r) => Array.from(e).some((d) => {
376
+ const g = r[d];
377
+ return g && g.toString().toLowerCase().includes(j.toLowerCase());
378
+ }));
379
+ }, [t, j, C, h]), u = T(() => x.key ? [...M].sort((e, r) => e[x.key] < r[x.key] ? x.direction === "asc" ? -1 : 1 : e[x.key] > r[x.key] ? x.direction === "asc" ? 1 : -1 : 0) : M, [M, x]), N = h.filter((e) => B.has(e)), oe = () => {
380
+ if (!Array.isArray(u) || u.length === 0) return;
381
+ const e = N.map((k) => y[k] || k), r = (k) => {
382
+ const z = String(k ?? "");
383
+ return /[",\n]/.test(z) ? `"${z.replace(/"/g, '""')}"` : z;
384
+ }, g = [
385
+ e.join(","),
386
+ // header row
387
+ ...u.map((k) => N.map((z) => r(k[z])).join(","))
388
+ ].join(`
389
+ `), ae = new Blob([g], { type: "text/csv;charset=utf-8;" }), $ = document.createElement("a");
390
+ $.href = URL.createObjectURL(ae), $.download = "data.csv", document.body.appendChild($), $.click(), document.body.removeChild($);
391
+ }, te = T(() => {
392
+ const e = (c - 1) * w;
393
+ return u.slice(e, e + w);
394
+ }, [u, c, w]), p = Math.ceil(u.length / w), ne = (e) => {
395
+ H((r) => ({
396
+ key: e,
397
+ direction: r.key === e && r.direction === "asc" ? "desc" : "asc"
398
+ }));
399
+ }, re = (e) => {
400
+ D((r) => {
401
+ const d = new Set(r);
402
+ return d.has(e) ? d.delete(e) : d.add(e), d;
403
+ });
404
+ }, ie = () => {
405
+ C.size === h.length ? D(/* @__PURE__ */ new Set()) : D(new Set(h));
406
+ }, se = (e) => {
407
+ O((r) => {
408
+ const d = new Set(r);
409
+ return d.has(e) ? d.delete(e) : d.add(e), d;
410
+ });
411
+ };
412
+ return /* @__PURE__ */ l(we, { className: "jcTableContainer", children: [
413
+ /* @__PURE__ */ l(Ce, { className: "jcTableHeader", children: [
414
+ /* @__PURE__ */ l(ke, { className: "jcTableTitleAndActions", children: [
415
+ /* @__PURE__ */ o(ve, { children: X }),
416
+ /* @__PURE__ */ l(le, { className: "jcTableExtraComponentsBox", gap: "9px", children: [
417
+ I && I,
418
+ /* @__PURE__ */ o(ce, { onClick: oe, children: "Export to CSV" })
420
419
  ] })
421
420
  ] }),
422
- /* @__PURE__ */ c(pe, { className: "jcTableControls", children: [
423
- /* @__PURE__ */ c(he, { className: "jcTableSearchContainer", children: [
424
- /* @__PURE__ */ t(ge, { onClick: G }),
425
- /* @__PURE__ */ t(
426
- ue,
421
+ /* @__PURE__ */ l(Se, { className: "jcTableControls", children: [
422
+ /* @__PURE__ */ l($e, { className: "jcTableSearchContainer", children: [
423
+ /* @__PURE__ */ o(ze, { customTheme: i }),
424
+ /* @__PURE__ */ o(
425
+ je,
427
426
  {
427
+ customTheme: i,
428
428
  type: "text",
429
429
  placeholder: "Search...",
430
- defaultValue: v,
431
- onChange: (e) => ie(e.target.value),
432
- onKeyDown: (e) => {
433
- e.key === "Enter" && G();
434
- }
430
+ value: j,
431
+ onChange: (e) => V(e.target.value)
435
432
  }
436
433
  )
437
434
  ] }),
438
- /* @__PURE__ */ c("div", { style: { position: "relative" }, children: [
439
- /* @__PURE__ */ c(
440
- R,
435
+ /* @__PURE__ */ l("div", { style: { position: "relative" }, children: [
436
+ /* @__PURE__ */ l(
437
+ Y,
441
438
  {
439
+ customTheme: i,
442
440
  className: "jcTableSearchFields",
443
- onClick: () => P(!L),
441
+ onClick: () => ee(!U),
444
442
  children: [
445
- /* @__PURE__ */ t(W, { size: 16 }),
443
+ /* @__PURE__ */ o(Q, { size: 16 }),
446
444
  "Fields",
447
- /* @__PURE__ */ t(E, { size: 16 })
445
+ /* @__PURE__ */ o(_, { size: 16 })
448
446
  ]
449
447
  }
450
448
  ),
451
- L && /* @__PURE__ */ c(H, { className: "jcTableSearchFieldsDropdown", children: [
452
- /* @__PURE__ */ c(_, { onClick: re, children: [
453
- /* @__PURE__ */ t(
454
- M,
449
+ U && /* @__PURE__ */ l(G, { className: "jcTableSearchFieldsDropdown", children: [
450
+ /* @__PURE__ */ l(L, { customTheme: i, onClick: ie, children: [
451
+ /* @__PURE__ */ o(
452
+ E,
455
453
  {
454
+ customTheme: i,
456
455
  type: "checkbox",
457
- checked: m.size === a.length,
456
+ checked: C.size === h.length,
458
457
  onChange: () => {
459
458
  }
460
459
  }
461
460
  ),
462
- /* @__PURE__ */ t("span", { style: { fontWeight: "bold" }, children: "All" })
461
+ /* @__PURE__ */ o("span", { style: { fontWeight: "bold" }, children: "All" })
463
462
  ] }),
464
- /* @__PURE__ */ t("div", { style: { height: "1px", backgroundColor: o.colors.gray4, margin: "4px 0" } }),
465
- a.map((e) => /* @__PURE__ */ c(_, { onClick: () => ne(e), children: [
466
- /* @__PURE__ */ t(M, { type: "checkbox", checked: m.has(e), onChange: () => {
467
- } }),
468
- /* @__PURE__ */ t("span", { children: z[e] || e })
469
- ] }, e))
463
+ /* @__PURE__ */ o("div", { style: { height: "1px", backgroundColor: n.colors.gray4, margin: "4px 0" } }),
464
+ h.map((e) => /* @__PURE__ */ l(
465
+ L,
466
+ {
467
+ customTheme: i,
468
+ onClick: () => re(e),
469
+ children: [
470
+ /* @__PURE__ */ o(
471
+ E,
472
+ {
473
+ customTheme: i,
474
+ type: "checkbox",
475
+ checked: C.has(e),
476
+ onChange: () => {
477
+ }
478
+ }
479
+ ),
480
+ /* @__PURE__ */ o("span", { children: y[e] || e })
481
+ ]
482
+ },
483
+ e
484
+ ))
470
485
  ] })
471
486
  ] }),
472
- /* @__PURE__ */ c("div", { style: { position: "relative" }, children: [
473
- /* @__PURE__ */ c(
474
- R,
487
+ /* @__PURE__ */ l("div", { style: { position: "relative" }, children: [
488
+ /* @__PURE__ */ l(
489
+ Y,
475
490
  {
491
+ customTheme: i,
476
492
  className: "jcTableColumnSettings",
477
- onClick: () => Z(!V),
493
+ onClick: () => P(!R),
478
494
  children: [
479
- /* @__PURE__ */ t(_e, { size: 16 }),
495
+ /* @__PURE__ */ o(ye, { size: 16 }),
480
496
  "Columns",
481
- /* @__PURE__ */ t(E, { size: 16 })
497
+ /* @__PURE__ */ o(_, { size: 16 })
482
498
  ]
483
499
  }
484
500
  ),
485
- V && /* @__PURE__ */ t(H, { className: "jcTableColumnSettingsDropdown", children: a.map((e) => /* @__PURE__ */ c(_, { onClick: () => se(e), children: [
486
- /* @__PURE__ */ t(M, { type: "checkbox", checked: D.has(e), onChange: () => {
487
- } }),
488
- D.has(e) ? /* @__PURE__ */ t(Ae, { size: 16 }) : /* @__PURE__ */ t(Te, { size: 16 }),
489
- /* @__PURE__ */ t("span", { children: z[e] || e })
490
- ] }, e)) })
501
+ R && /* @__PURE__ */ o(G, { className: "jcTableColumnSettingsDropdown", children: h.map((e) => /* @__PURE__ */ l(
502
+ L,
503
+ {
504
+ customTheme: i,
505
+ onClick: () => se(e),
506
+ children: [
507
+ /* @__PURE__ */ o(
508
+ E,
509
+ {
510
+ customTheme: i,
511
+ type: "checkbox",
512
+ checked: B.has(e),
513
+ onChange: () => {
514
+ }
515
+ }
516
+ ),
517
+ B.has(e) ? /* @__PURE__ */ o(be, { size: 16 }) : /* @__PURE__ */ o(ge, { size: 16 }),
518
+ /* @__PURE__ */ o("span", { children: y[e] || e })
519
+ ]
520
+ },
521
+ e
522
+ )) })
491
523
  ] })
492
524
  ] })
493
525
  ] }),
494
- /* @__PURE__ */ c(xe, { className: "jcTableContent", children: [
495
- /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ t(O, { interactableRow: !1, children: T.map((e) => /* @__PURE__ */ c(
496
- fe,
526
+ /* @__PURE__ */ l(De, { className: "jcTableContent", children: [
527
+ /* @__PURE__ */ o("thead", { children: /* @__PURE__ */ o(J, { customTheme: i, interactableRow: !1, children: N.map((e) => /* @__PURE__ */ l(
528
+ Ne,
497
529
  {
498
- style: p.key === e ? u.thActive : {},
499
- onClick: () => te(e),
530
+ customTheme: i,
531
+ style: x.key === e ? f.thActive : {},
532
+ onClick: () => ne(e),
500
533
  children: [
501
- z[e] || e,
502
- /* @__PURE__ */ t(ye, { children: p.key === e ? p.direction === "asc" ? /* @__PURE__ */ t(q, { size: 16 }) : /* @__PURE__ */ t(E, { size: 16 }) : /* @__PURE__ */ t(q, { size: 16, style: { opacity: 0.313 } }) })
534
+ y[e] || e,
535
+ /* @__PURE__ */ o(Ae, { children: x.key === e ? x.direction === "asc" ? /* @__PURE__ */ o(W, { size: 16 }) : /* @__PURE__ */ o(_, { size: 16 }) : /* @__PURE__ */ o(W, { size: 16, style: { opacity: 0.313 } }) })
503
536
  ]
504
537
  },
505
538
  e
506
539
  )) }) }),
507
- /* @__PURE__ */ t("tbody", { children: oe.map((e, n) => /* @__PURE__ */ t(O, { onClick: () => A && A(e), interactableRow: !!A, children: T.map((l) => /* @__PURE__ */ t(be, { children: e[l] }, l)) }, n)) })
540
+ /* @__PURE__ */ o("tbody", { children: te.map((e, r) => /* @__PURE__ */ o(
541
+ J,
542
+ {
543
+ customTheme: i,
544
+ onClick: () => A && A(e),
545
+ interactableRow: !!A,
546
+ children: N.map((d) => /* @__PURE__ */ o(Te, { children: e[d] }, d))
547
+ },
548
+ r
549
+ )) })
508
550
  ] }),
509
- /* @__PURE__ */ c(me, { children: [
510
- /* @__PURE__ */ t(
511
- w,
551
+ /* @__PURE__ */ l(Be, { children: [
552
+ /* @__PURE__ */ o(
553
+ v,
512
554
  {
513
- style: i === 1 ? u.paginationButtonDisabled : {},
514
- onClick: () => y(Math.max(1, i - 1)),
515
- disabled: i === 1,
555
+ customTheme: i,
556
+ style: c === 1 ? f.paginationButtonDisabled : {},
557
+ onClick: () => b(Math.max(1, c - 1)),
558
+ disabled: c === 1,
516
559
  children: "Previous"
517
560
  }
518
561
  ),
519
562
  (() => {
520
563
  const e = [];
521
- if (d <= 5)
522
- for (let n = 1; n <= d; n++)
564
+ if (p <= 5)
565
+ for (let r = 1; r <= p; r++)
523
566
  e.push(
524
- /* @__PURE__ */ t(
525
- w,
567
+ /* @__PURE__ */ o(
568
+ v,
526
569
  {
527
- style: i === n ? u.paginationButtonActive : {},
528
- onClick: () => y(n),
529
- children: n
570
+ customTheme: i,
571
+ style: c === r ? f.paginationButtonActive : {},
572
+ onClick: () => b(r),
573
+ children: r
530
574
  },
531
- n
575
+ r
532
576
  )
533
577
  );
534
578
  else {
535
579
  e.push(
536
- /* @__PURE__ */ t(
537
- w,
580
+ /* @__PURE__ */ o(
581
+ v,
538
582
  {
539
- style: i === 1 ? u.paginationButtonActive : {},
540
- onClick: () => y(1),
583
+ customTheme: i,
584
+ style: c === 1 ? f.paginationButtonActive : {},
585
+ onClick: () => b(1),
541
586
  children: "1"
542
587
  },
543
588
  1
544
589
  )
545
- ), i > 3 && e.push(/* @__PURE__ */ t(U, { children: "..." }, "ellipsis1"));
546
- const n = Math.max(2, i - 1), l = Math.min(d - 1, i + 1);
547
- for (let h = n; h <= l; h++)
590
+ ), c > 3 && e.push(/* @__PURE__ */ o(K, { children: "..." }, "ellipsis1"));
591
+ const r = Math.max(2, c - 1), d = Math.min(p - 1, c + 1);
592
+ for (let g = r; g <= d; g++)
548
593
  e.push(
549
- /* @__PURE__ */ t(
550
- w,
594
+ /* @__PURE__ */ o(
595
+ v,
551
596
  {
552
- style: i === h ? u.paginationButtonActive : {},
553
- onClick: () => y(h),
554
- children: h
597
+ customTheme: i,
598
+ style: c === g ? f.paginationButtonActive : {},
599
+ onClick: () => b(g),
600
+ children: g
555
601
  },
556
- h
602
+ g
557
603
  )
558
604
  );
559
- i < d - 2 && e.push(/* @__PURE__ */ t(U, { children: "..." }, "ellipsis2")), d > 1 && e.push(
560
- /* @__PURE__ */ t(
561
- w,
605
+ c < p - 2 && e.push(/* @__PURE__ */ o(K, { children: "..." }, "ellipsis2")), p > 1 && e.push(
606
+ /* @__PURE__ */ o(
607
+ v,
562
608
  {
563
- style: i === d ? u.paginationButtonActive : {},
564
- onClick: () => y(d),
565
- children: d
609
+ customTheme: i,
610
+ style: c === p ? f.paginationButtonActive : {},
611
+ onClick: () => b(p),
612
+ children: p
566
613
  },
567
- d
614
+ p
568
615
  )
569
616
  );
570
617
  }
571
618
  return e;
572
619
  })(),
573
- /* @__PURE__ */ t(
574
- w,
620
+ /* @__PURE__ */ o(
621
+ v,
575
622
  {
576
- style: i === d ? u.paginationButtonDisabled : {},
577
- onClick: () => y(Math.min(d, i + 1)),
578
- disabled: i === d,
623
+ customTheme: i,
624
+ style: c === p ? f.paginationButtonDisabled : {},
625
+ onClick: () => b(Math.min(p, c + 1)),
626
+ disabled: c === p,
579
627
  children: "Next"
580
628
  }
581
629
  )
582
630
  ] }),
583
- /* @__PURE__ */ c(we, { children: [
631
+ /* @__PURE__ */ l(Me, { children: [
584
632
  "Showing ",
585
- Math.min((i - 1) * b + 1, g.length),
633
+ Math.min((c - 1) * w + 1, u.length),
586
634
  " to",
587
635
  " ",
588
- Math.min(i * b, g.length),
636
+ Math.min(c * w, u.length),
589
637
  " of ",
590
- g.length,
638
+ u.length,
591
639
  " entries"
592
640
  ] })
593
641
  ] });
594
642
  };
595
643
  export {
596
- He as default
644
+ Ue as default
597
645
  };