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 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 d, jsx as t } from "react/jsx-runtime";
2
- import { useState as b, useMemo as N, useEffect as L, useRef as ae } from "react";
3
- import r from "../theme.js";
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 l } from "../.chunks/emotion-styled.browser.esm.js";
6
- import { Button as de } from "../Button/Button.js";
7
- import { Flex as he } from "../Flex/Flex.js";
8
- import { useThemeColors as pe } from "../ThemeContext.js";
9
- import { c as S } from "../.chunks/createLucideIcon.js";
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 ue = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]], M = S("chevron-down", ue);
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 ge = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]], G = S("chevron-up", ge);
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 me = [
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
- ], xe = S("eye-off", me);
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 fe = [
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
- ], be = S("eye", fe);
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 we = [
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
- ], Z = S("search", we);
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 ye = [
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
- ], Ce = S("settings", ye), ke = l("div")(() => ({
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: ${r.colors.white};
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
- })), ve = l("div")(() => ({
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
- })), Se = l("div")(() => ({
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
- })), $e = l("h2")(() => ({
132
+ })), Me = a("h2")(() => ({
117
133
  ...c`
118
134
  font-size: 24px;
119
135
  font-weight: bold;
120
- color: ${r.colors.black};
136
+ color: ${s.colors.black};
121
137
  margin: 0;
122
138
  `
123
- })), ze = l("div")(() => ({
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
- })), je = l("div")(() => ({
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
- })), Te = l(Z, {
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: ${r.colors.gray3};
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
- })), De = l("input", {
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 ${r.colors.gray4};
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: ${r.colors.white};
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
- })), J = l("button", {
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: ${r.colors.white};
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: ${r.colors.white};
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
- })), K = l("div")(() => ({
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: ${r.colors.white};
210
- border: 1px solid ${r.colors.gray4};
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
- })), E = l("div", {
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: ${r.colors.slate};
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
- })), _ = l("input", {
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
- })), Ne = l("table")(() => ({
261
+ })), He = a("table")(() => ({
246
262
  ...c`
247
263
  width: 100%;
248
264
  border-collapse: collapse;
249
- background-color: ${r.colors.white};
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
- })), Ae = l("th", { shouldForwardProp: (o) => !["customTheme"].includes(o) })(
270
+ })), Ue = a("th", { shouldForwardProp: (o) => !["customTheme"].includes(o) })(
255
271
  ({ customTheme: o }) => ({
256
272
  ...c`
257
- background-color: ${r.colors.whiteBlue};
258
- color: ${r.colors.slate};
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 ${r.colors.gray4};
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
- ), Be = l("td")(() => ({
293
+ ), ce = a("td")(() => ({
278
294
  ...c`
279
295
  padding: 14px 12px;
280
- border-bottom: 1px solid ${r.colors.almostWhite};
296
+ border-bottom: 1px solid ${s.colors.almostWhite};
281
297
  font-size: 14px;
282
- color: ${r.colors.slate};
298
+ color: ${s.colors.slate};
283
299
  transition: all 0.2s ease;
284
300
  `
285
- })), Fe = l("span")(() => ({
301
+ })), qe = a("span")(() => ({
286
302
  ...c`
287
303
  margin-left: 8px;
288
304
  opacity: 0.6;
289
305
  `
290
- })), Q = l("tr", { shouldForwardProp: (o) => !["customTheme"].includes(o) })(({ interactableRow: o, customTheme: w }) => ({
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: ${w.themeLightD};
313
+ background-color: ${b.themeLightD};
298
314
  cursor: pointer;
299
315
  }
300
316
  `}
301
317
  `
302
- })), Le = l("div")(() => ({
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
- })), v = l("button", {
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 ${r.colors.gray4};
331
+ border: 1px solid ${s.colors.gray4};
316
332
  border-radius: 4px;
317
- background-color: ${r.colors.white};
318
- color: ${r.colors.slate};
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: ${r.colors.white};
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
- })), Me = l("div")(() => ({
351
+ })), Ke = a("div")(() => ({
336
352
  ...c`
337
353
  font-size: 14px;
338
- color: ${r.colors.gray3};
354
+ color: ${s.colors.gray3};
339
355
  text-align: center;
340
356
  margin-top: 10px;
341
357
  `
342
- })), X = l("span")(() => ({
358
+ })), de = a("span")(() => ({
343
359
  ...c`
344
360
  padding: 8px 4px;
345
- color: ${r.colors.gray3};
361
+ color: ${s.colors.gray3};
346
362
  font-size: 14px;
347
363
  `
348
- })), qe = ({
364
+ })), no = ({
349
365
  data: o = [],
350
- columnTitles: w = {},
351
- rowsPerPage: y = 19,
352
- title: ee = "Data Table",
353
- onRowClick: A,
354
- hiddenColumns: oe = [],
355
- defaultSort: I = { key: "", direction: "asc" },
356
- extraActions: V
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 [a, x] = b(1), [j, O] = b(""), [p, P] = b(I), [C, T] = b(/* @__PURE__ */ new Set()), [B, R] = b(/* @__PURE__ */ new Set()), [H, U] = b(!1), [q, W] = b(!1), i = pe(), f = {
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: i.themeColor,
361
- color: r.colors.white
382
+ backgroundColor: l.themeColor,
383
+ color: s.colors.white
362
384
  },
363
385
  paginationButtonActive: {
364
- backgroundColor: i.themeColor,
365
- color: r.colors.white,
366
- borderColor: i.themeColor
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: r.colors.gray3,
396
+ color: s.colors.gray3,
375
397
  textAlign: "center",
376
398
  marginTop: "10px"
377
399
  }
378
- }, u = N(() => o.length === 0 ? [] : Object.keys(o[0]).filter((e) => !oe.includes(e)), [o]);
379
- L(() => {
380
- u.length > 0 && (R(new Set(u)), T(new Set(u)));
381
- }, [u]), L(() => {
382
- O(""), P(I), x(1);
383
- }, []);
384
- const F = N(() => {
385
- if (!j) return o;
386
- const e = C.size > 0 ? C : new Set(u);
387
- return o.filter((n) => Array.from(e).some((s) => {
388
- const h = n[s];
389
- return h && h.toString().toLowerCase().replace(/[-()\s]/g, "").includes(j.toLowerCase().replace(/[-()\s]/g, ""));
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, j, C, u]), m = N(() => p.key ? [...F].sort((e, n) => {
392
- const s = typeof e[p.key] == "string" ? e[p.key].toLowerCase() : e[p.key], h = typeof n[p.key] == "string" ? n[p.key].toLowerCase() : n[p.key];
393
- return s < h ? p.direction === "asc" ? -1 : 1 : s > h ? p.direction === "asc" ? 1 : -1 : 0;
394
- }) : F, [F, p]), D = u.filter((e) => B.has(e)), te = () => {
395
- if (!Array.isArray(m) || m.length === 0) return;
396
- const e = D.map((k) => w[k] || k), n = (k) => {
397
- const z = String(k ?? "");
398
- return /[",\n]/.test(z) ? `"${z.replace(/"/g, '""')}"` : z;
399
- }, h = [
400
- e.join(","),
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
- ...m.map((k) => D.map((z) => n(k[z])).join(","))
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
- `), le = new Blob([h], { type: "text/csv;charset=utf-8;" }), $ = document.createElement("a");
405
- $.href = URL.createObjectURL(le), $.download = "data.csv", document.body.appendChild($), $.click(), document.body.removeChild($);
406
- }, ne = N(() => {
407
- const e = (a - 1) * y;
408
- return m.slice(e, e + y);
409
- }, [m, a, y]), g = Math.ceil(m.length / y), re = (e) => {
410
- P((n) => ({
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: n.key === e && n.direction === "asc" ? "desc" : "asc"
450
+ direction: r.key === e && r.direction === "asc" ? "desc" : "asc"
413
451
  }));
414
- }, se = (e) => {
415
- T((n) => {
416
- const s = new Set(n);
417
- return s.has(e) ? s.delete(e) : s.add(e), s;
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
- }, ie = () => {
420
- C.size === u.length ? T(/* @__PURE__ */ new Set()) : T(new Set(u));
421
- }, ce = (e) => {
422
- R((n) => {
423
- const s = new Set(n);
424
- return s.has(e) ? s.delete(e) : s.add(e), s;
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
- }, Y = (e) => {
427
- const n = ae(null);
428
- return L(() => {
429
- const s = (h) => {
430
- !n.current || n.current.contains(h.target) || e(h);
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", s), document.addEventListener("touchstart", s), () => {
433
- document.removeEventListener("mousedown", s), document.removeEventListener("touchstart", s);
470
+ return document.addEventListener("mousedown", t), document.addEventListener("touchstart", t), () => {
471
+ document.removeEventListener("mousedown", t), document.removeEventListener("touchstart", t);
434
472
  };
435
- }, [n, e]), n;
473
+ }, [r, e]), r;
436
474
  };
437
- return /* @__PURE__ */ d(ke, { className: "jcTableContainer", children: [
438
- /* @__PURE__ */ d(ve, { className: "jcTableHeader", children: [
439
- /* @__PURE__ */ d(Se, { className: "jcTableTitleAndActions", children: [
440
- /* @__PURE__ */ t($e, { children: ee }),
441
- /* @__PURE__ */ d(he, { className: "jcTableExtraComponentsBox", gap: "9px", children: [
442
- V && V,
443
- /* @__PURE__ */ t(de, { onClick: te, children: "Export to CSV" })
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__ */ d(ze, { className: "jcTableControls", children: [
447
- /* @__PURE__ */ d(je, { className: "jcTableSearchContainer", children: [
448
- /* @__PURE__ */ t(Te, { customTheme: i }),
449
- /* @__PURE__ */ t(
450
- De,
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: i,
490
+ customTheme: l,
453
491
  type: "text",
454
492
  placeholder: "Search...",
455
- value: j,
456
- onChange: (e) => O(e.target.value)
493
+ value: N,
494
+ onChange: (e) => Y(e.target.value)
457
495
  }
458
496
  )
459
497
  ] }),
460
- /* @__PURE__ */ d(
498
+ /* @__PURE__ */ h(
461
499
  "div",
462
500
  {
463
501
  style: { position: "relative" },
464
- ref: Y(() => {
465
- W(!1);
502
+ ref: te(() => {
503
+ ee(!1);
466
504
  }),
467
505
  children: [
468
- /* @__PURE__ */ d(
469
- J,
506
+ /* @__PURE__ */ h(
507
+ se,
470
508
  {
471
- customTheme: i,
509
+ customTheme: l,
472
510
  className: "jcTableSearchFields",
473
- onClick: () => W(!q),
511
+ onClick: () => ee(!Z),
474
512
  children: [
475
- /* @__PURE__ */ t(Z, { size: 16 }),
513
+ /* @__PURE__ */ n(he, { size: 16 }),
476
514
  "Fields",
477
- /* @__PURE__ */ t(M, { size: 16 })
515
+ /* @__PURE__ */ n(H, { size: 16 })
478
516
  ]
479
517
  }
480
518
  ),
481
- q && /* @__PURE__ */ d(K, { className: "jcTableSearchFieldsDropdown", children: [
482
- /* @__PURE__ */ d(E, { customTheme: i, onClick: ie, children: [
483
- /* @__PURE__ */ t(
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: i,
524
+ customTheme: l,
487
525
  type: "checkbox",
488
- checked: C.size === u.length,
526
+ checked: V.size === p.length,
489
527
  onChange: () => {
490
528
  }
491
529
  }
492
530
  ),
493
- /* @__PURE__ */ t("span", { style: { fontWeight: "bold" }, children: "All" })
531
+ /* @__PURE__ */ n("span", { style: { fontWeight: "bold" }, children: "All" })
494
532
  ] }),
495
- /* @__PURE__ */ t("div", { style: { height: "1px", backgroundColor: r.colors.gray4, margin: "4px 0" } }),
496
- u.map((e) => /* @__PURE__ */ d(
497
- E,
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: i,
500
- onClick: () => se(e),
537
+ customTheme: l,
538
+ onClick: () => be(e),
501
539
  children: [
502
- /* @__PURE__ */ t(
503
- _,
540
+ /* @__PURE__ */ n(
541
+ q,
504
542
  {
505
- customTheme: i,
543
+ customTheme: l,
506
544
  type: "checkbox",
507
- checked: C.has(e),
545
+ checked: V.has(e),
508
546
  onChange: () => {
509
547
  }
510
548
  }
511
549
  ),
512
- /* @__PURE__ */ t("span", { children: w[e] || e })
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__ */ d(
559
+ /* @__PURE__ */ h(
522
560
  "div",
523
561
  {
524
562
  style: { position: "relative" },
525
- ref: Y(() => {
526
- U(!1);
563
+ ref: te(() => {
564
+ X(!1);
527
565
  }),
528
566
  children: [
529
- /* @__PURE__ */ d(
530
- J,
567
+ /* @__PURE__ */ h(
568
+ se,
531
569
  {
532
- customTheme: i,
570
+ customTheme: l,
533
571
  className: "jcTableColumnSettings",
534
- onClick: () => U(!H),
572
+ onClick: () => X(!Q),
535
573
  children: [
536
- /* @__PURE__ */ t(Ce, { size: 16 }),
574
+ /* @__PURE__ */ n(Ne, { size: 16 }),
537
575
  "Columns",
538
- /* @__PURE__ */ t(M, { size: 16 })
576
+ /* @__PURE__ */ n(H, { size: 16 })
539
577
  ]
540
578
  }
541
579
  ),
542
- H && /* @__PURE__ */ t(K, { className: "jcTableColumnSettingsDropdown", children: u.map((e) => /* @__PURE__ */ d(
543
- E,
580
+ Q && /* @__PURE__ */ n(le, { className: "jcTableColumnSettingsDropdown", children: p.map((e) => /* @__PURE__ */ h(
581
+ U,
544
582
  {
545
- customTheme: i,
546
- onClick: () => ce(e),
583
+ customTheme: l,
584
+ onClick: () => ye(e),
547
585
  children: [
548
- /* @__PURE__ */ t(
549
- _,
586
+ /* @__PURE__ */ n(
587
+ q,
550
588
  {
551
- customTheme: i,
589
+ customTheme: l,
552
590
  type: "checkbox",
553
- checked: B.has(e),
591
+ checked: O.has(e),
554
592
  onChange: () => {
555
593
  }
556
594
  }
557
595
  ),
558
- B.has(e) ? /* @__PURE__ */ t(be, { size: 16 }) : /* @__PURE__ */ t(xe, { size: 16 }),
559
- /* @__PURE__ */ t("span", { children: w[e] || e })
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__ */ d(Ne, { className: "jcTableContent", children: [
570
- /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ t(Q, { customTheme: i, interactableRow: !1, children: D.map((e) => /* @__PURE__ */ d(
571
- Ae,
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: i,
574
- style: p.key === e ? f.thActive : {},
575
- onClick: () => re(e),
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
- w[e] || e,
578
- /* @__PURE__ */ t(Fe, { children: p.key === e ? p.direction === "asc" ? /* @__PURE__ */ t(G, { size: 16 }) : /* @__PURE__ */ t(M, { size: 16 }) : /* @__PURE__ */ t(G, { size: 16, style: { opacity: 0.313 } }) })
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__ */ t("tbody", { children: ne.map((e, n) => /* @__PURE__ */ t(
584
- Q,
585
- {
586
- customTheme: i,
587
- onClick: () => A && A(e),
588
- interactableRow: !!A,
589
- children: D.map((s) => /* @__PURE__ */ t(Be, { children: e[s] }, s))
590
- },
591
- n
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__ */ d(Le, { children: [
595
- /* @__PURE__ */ t(
596
- v,
653
+ /* @__PURE__ */ h(We, { children: [
654
+ /* @__PURE__ */ n(
655
+ A,
597
656
  {
598
- customTheme: i,
599
- style: a === 1 ? f.paginationButtonDisabled : {},
600
- onClick: () => x(Math.max(1, a - 1)),
601
- disabled: a === 1,
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 n = 1; n <= g; n++)
667
+ for (let r = 1; r <= g; r++)
609
668
  e.push(
610
- /* @__PURE__ */ t(
611
- v,
669
+ /* @__PURE__ */ n(
670
+ A,
612
671
  {
613
- customTheme: i,
614
- style: a === n ? f.paginationButtonActive : {},
615
- onClick: () => x(n),
616
- children: n
672
+ customTheme: l,
673
+ style: d === r ? z.paginationButtonActive : {},
674
+ onClick: () => T(r),
675
+ children: r
617
676
  },
618
- n
677
+ r
619
678
  )
620
679
  );
621
680
  else {
622
681
  e.push(
623
- /* @__PURE__ */ t(
624
- v,
682
+ /* @__PURE__ */ n(
683
+ A,
625
684
  {
626
- customTheme: i,
627
- style: a === 1 ? f.paginationButtonActive : {},
628
- onClick: () => x(1),
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
- ), a > 3 && e.push(/* @__PURE__ */ t(X, { children: "..." }, "ellipsis1"));
634
- const n = Math.max(2, a - 1), s = Math.min(g - 1, a + 1);
635
- for (let h = n; h <= s; h++)
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__ */ t(
638
- v,
696
+ /* @__PURE__ */ n(
697
+ A,
639
698
  {
640
- customTheme: i,
641
- style: a === h ? f.paginationButtonActive : {},
642
- onClick: () => x(h),
643
- children: h
699
+ customTheme: l,
700
+ style: d === i ? z.paginationButtonActive : {},
701
+ onClick: () => T(i),
702
+ children: i
644
703
  },
645
- h
704
+ i
646
705
  )
647
706
  );
648
- a < g - 2 && e.push(/* @__PURE__ */ t(X, { children: "..." }, "ellipsis2")), g > 1 && e.push(
649
- /* @__PURE__ */ t(
650
- v,
707
+ d < g - 2 && e.push(/* @__PURE__ */ n(de, { children: "..." }, "ellipsis2")), g > 1 && e.push(
708
+ /* @__PURE__ */ n(
709
+ A,
651
710
  {
652
- customTheme: i,
653
- style: a === g ? f.paginationButtonActive : {},
654
- onClick: () => x(g),
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__ */ t(
664
- v,
722
+ /* @__PURE__ */ n(
723
+ A,
665
724
  {
666
- customTheme: i,
667
- style: a === g ? f.paginationButtonDisabled : {},
668
- onClick: () => x(Math.min(g, a + 1)),
669
- disabled: a === g,
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__ */ d(Me, { children: [
733
+ /* @__PURE__ */ h(Ke, { children: [
675
734
  "Showing ",
676
- Math.min((a - 1) * y + 1, m.length),
735
+ Math.min((d - 1) * C + 1, k.length),
677
736
  " to",
678
737
  " ",
679
- Math.min(a * y, m.length),
738
+ Math.min(d * C, k.length),
680
739
  " of ",
681
- m.length,
740
+ k.length,
682
741
  " entries"
683
742
  ] })
684
743
  ] });
685
744
  };
686
745
  export {
687
- qe as default
746
+ no as default
688
747
  };
@@ -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
+ };
@@ -0,0 +1 @@
1
+ export { default, type TimerProps } from './Timer';
package/Timer/index.js ADDED
@@ -0,0 +1,4 @@
1
+ import { Timer as a } from "./Timer.js";
2
+ export {
3
+ a as default
4
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "jcicl",
3
3
  "private": false,
4
- "version": "1.0.23",
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 c from "./theme.js";
1
+ import s from "./theme.js";
2
2
  import { u as m } from "./.chunks/useMediaQuery.js";
3
- const x = () => m(`(max-width: ${c.screenSizes.mobile})`), S = () => m(`(max-width: ${c.screenSizes.tablet})`), b = (r, e = "mmddyyyy") => e === "mmddyyyy" ? new Date(r).toLocaleDateString("en-US", {
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: s } = r;
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), s && (t += ` ${s}`), t;
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 a;
35
- return ((a = o.find(($) => $.type === y)) == null ? void 0 : a.value) ?? "";
36
- }, s = n("month") + ".", t = Number(n("day")), u = n("year"), l = n("hour"), d = n("minute"), f = n("dayPeriod").toLowerCase(), h = g(t);
37
- return `${s} ${t}${h}, ${u}, ${l}:${d}${f}`;
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
- }, P = (r) => {
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), s = e.slice(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. ${s}`), [t, e];
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
- P as formatPhoneNumber,
53
+ Z as formatPhoneNumber,
53
54
  T as formatTimestamp,
54
55
  x as isMobile,
55
56
  S as isTablet