@sito/dashboard 0.0.72 → 0.0.74
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/README.md +27 -3
- package/dist/{FiltersProvider-DVMj0LV0.cjs → FiltersProvider-CnrF3xWV.cjs} +1 -1
- package/dist/{FiltersProvider-BV023mmu.js → FiltersProvider-iOkSYSFZ.js} +1 -1
- package/dist/FiltersProvider.cjs +1 -1
- package/dist/FiltersProvider.js +1 -1
- package/dist/Form.cjs +1 -1
- package/dist/Form.js +1 -1
- package/dist/SelectInput-Dm7gv03Z.js +521 -0
- package/dist/SelectInput-dYjrdopP.cjs +1 -0
- package/dist/{Table-DYcrwEM-.cjs → Table-C03frnWb.cjs} +1 -1
- package/dist/{Table-ehiZ_7Qa.js → Table-DO7FFraQ.js} +3 -3
- package/dist/Table.cjs +1 -1
- package/dist/Table.js +1 -1
- package/dist/TableOptions.cjs +1 -1
- package/dist/TableOptions.js +1 -1
- package/dist/TableOptionsProvider-Dzq4dOu8.js +157 -0
- package/dist/TableOptionsProvider-bPNtpa4V.cjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +4 -4
- package/dist/providers/TableOptions/TableOptionsProvider.d.ts +2 -2
- package/dist/providers/TableOptions/types.d.ts +9 -0
- package/dist/providers/TableOptions/utils.d.ts +60 -0
- package/package.json +1 -1
- package/dist/SelectInput-B9EEu-h1.cjs +0 -1
- package/dist/SelectInput-H421nC22.js +0 -525
- package/dist/TableOptionsProvider-BgnISoXx.js +0 -120
- package/dist/TableOptionsProvider-i4uVLLwH.cjs +0 -1
|
@@ -1,525 +0,0 @@
|
|
|
1
|
-
import "./SelectInput.css";
|
|
2
|
-
import { jsxs as L, jsx as a, Fragment as Y } from "react/jsx-runtime";
|
|
3
|
-
import { forwardRef as U, useState as F, useEffect as R, useMemo as j, useRef as K, useCallback as A, useLayoutEffect as Z } from "react";
|
|
4
|
-
import { C as M } from "./Chip-C5ogKbFn.js";
|
|
5
|
-
import { I as ee } from "./IconButton-BpsTEj0z.js";
|
|
6
|
-
import { C as te } from "./Close-rKC9AcNX.js";
|
|
7
|
-
const ie = U(function(l, h) {
|
|
8
|
-
const {
|
|
9
|
-
state: p,
|
|
10
|
-
value: t,
|
|
11
|
-
onChange: r,
|
|
12
|
-
options: k = [],
|
|
13
|
-
name: S = "",
|
|
14
|
-
id: $ = "",
|
|
15
|
-
label: x = "",
|
|
16
|
-
containerClassName: D = "",
|
|
17
|
-
inputContainerClassName: w = "",
|
|
18
|
-
helperText: I = "",
|
|
19
|
-
placeholder: B = "",
|
|
20
|
-
multiple: d = !1,
|
|
21
|
-
...E
|
|
22
|
-
} = l, [i, m] = F("");
|
|
23
|
-
R(() => {
|
|
24
|
-
if (!d && t && !Array.isArray(t)) {
|
|
25
|
-
m(String(t.value ?? t.name ?? ""));
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
m("");
|
|
29
|
-
}, [d, t]);
|
|
30
|
-
const [f, g] = F(!1), [C, y] = F(-1), s = j(
|
|
31
|
-
() => k.filter((e) => {
|
|
32
|
-
const n = String(e.value ?? e.name).toLowerCase().includes(i?.toLowerCase());
|
|
33
|
-
return Array.isArray(t) && t.length ? n && !t.some((u) => u.id === e.id) : t && !Array.isArray(t) ? n && t.id !== e.id : n;
|
|
34
|
-
}),
|
|
35
|
-
[k, t, i]
|
|
36
|
-
);
|
|
37
|
-
R(() => {
|
|
38
|
-
if (!f || !s.length) {
|
|
39
|
-
y(-1);
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
y(0);
|
|
43
|
-
}, [f, s]);
|
|
44
|
-
const c = K(null), N = K(null), [T, b] = F(!1), o = K(null);
|
|
45
|
-
R(() => {
|
|
46
|
-
const e = (u) => {
|
|
47
|
-
c.current && !c.current.contains(u.target) && g(!1);
|
|
48
|
-
}, n = (u) => {
|
|
49
|
-
u.key === "Escape" && g(!1);
|
|
50
|
-
};
|
|
51
|
-
return document.addEventListener("mousedown", e), document.addEventListener("keydown", n), () => {
|
|
52
|
-
document.removeEventListener("mousedown", e), document.removeEventListener("keydown", n);
|
|
53
|
-
};
|
|
54
|
-
}, []);
|
|
55
|
-
const v = A((e) => {
|
|
56
|
-
m(e.target.value);
|
|
57
|
-
}, []), H = A(
|
|
58
|
-
(e) => {
|
|
59
|
-
e ? d ? (m(""), Array.isArray(t) && t.length ? r([...t, e]) : r([e])) : (m(String(e.name ?? e.value ?? "")), r(e)) : r(null), g(!1);
|
|
60
|
-
},
|
|
61
|
-
[d, r, t]
|
|
62
|
-
), P = A(
|
|
63
|
-
(e) => {
|
|
64
|
-
if (!s.length) {
|
|
65
|
-
e.key === "Escape" && g(!1);
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
69
|
-
if (e.preventDefault(), !f) {
|
|
70
|
-
g(!0), y(0);
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
y((n) => {
|
|
74
|
-
const u = n >= 0 ? n : 0;
|
|
75
|
-
return e.key === "ArrowDown" ? (u + 1 + s.length) % s.length : (u - 1 + s.length) % s.length;
|
|
76
|
-
});
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
if (e.key === "Enter" && f) {
|
|
80
|
-
e.preventDefault();
|
|
81
|
-
const n = C >= 0 ? C : 0;
|
|
82
|
-
H(s[n]);
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
e.key === "Escape" && f && (e.preventDefault(), g(!1));
|
|
86
|
-
},
|
|
87
|
-
[
|
|
88
|
-
H,
|
|
89
|
-
C,
|
|
90
|
-
f,
|
|
91
|
-
s
|
|
92
|
-
]
|
|
93
|
-
), O = A(
|
|
94
|
-
(e) => {
|
|
95
|
-
if (!Array.isArray(t)) {
|
|
96
|
-
r(null);
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
const n = t.filter((u, z) => z !== e);
|
|
100
|
-
n.length ? r(n) : r(null);
|
|
101
|
-
},
|
|
102
|
-
[r, t]
|
|
103
|
-
), V = A(() => {
|
|
104
|
-
Array.isArray(t) && r([t[0]]);
|
|
105
|
-
}, [r, t]);
|
|
106
|
-
return Z(() => {
|
|
107
|
-
const e = o.current?.offsetWidth ?? 0, n = c.current?.offsetWidth ?? 0;
|
|
108
|
-
b(e > n * 0.4);
|
|
109
|
-
}, [t]), /* @__PURE__ */ L(
|
|
110
|
-
"div",
|
|
111
|
-
{
|
|
112
|
-
className: `autocomplete-input-container ${D}`,
|
|
113
|
-
ref: c,
|
|
114
|
-
children: [
|
|
115
|
-
/* @__PURE__ */ L("div", { className: "autocomplete-value-input-container", children: [
|
|
116
|
-
/* @__PURE__ */ a(
|
|
117
|
-
Q,
|
|
118
|
-
{
|
|
119
|
-
state: p,
|
|
120
|
-
name: S,
|
|
121
|
-
id: $,
|
|
122
|
-
value: i,
|
|
123
|
-
onChange: v,
|
|
124
|
-
placeholder: B,
|
|
125
|
-
helperText: I,
|
|
126
|
-
onFocus: () => g(!0),
|
|
127
|
-
onKeyDown: P,
|
|
128
|
-
label: x,
|
|
129
|
-
containerClassName: `autocomplete-text-input ${w}`,
|
|
130
|
-
ref: h ?? N,
|
|
131
|
-
...E,
|
|
132
|
-
children: !d && t && !Array.isArray(t) && (t.value || t.name) && /* @__PURE__ */ a(
|
|
133
|
-
ee,
|
|
134
|
-
{
|
|
135
|
-
icon: /* @__PURE__ */ a(te, {}),
|
|
136
|
-
className: "autocomplete-delete-button",
|
|
137
|
-
onClick: (e) => {
|
|
138
|
-
H(), e.stopPropagation();
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
)
|
|
142
|
-
}
|
|
143
|
-
),
|
|
144
|
-
d && Array.isArray(t) && t.length ? /* @__PURE__ */ a("ul", { ref: o, className: "autocomplete-value-container", children: T ? /* @__PURE__ */ L(Y, { children: [
|
|
145
|
-
/* @__PURE__ */ a("li", { children: /* @__PURE__ */ a(
|
|
146
|
-
M,
|
|
147
|
-
{
|
|
148
|
-
text: t[0]?.value ?? t[0]?.name,
|
|
149
|
-
onDelete: (e) => {
|
|
150
|
-
O(0), e.stopPropagation();
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
) }),
|
|
154
|
-
t.length > 1 && /* @__PURE__ */ a("li", { children: /* @__PURE__ */ a(
|
|
155
|
-
M,
|
|
156
|
-
{
|
|
157
|
-
text: `+${t.length - 1}`,
|
|
158
|
-
onDelete: (e) => {
|
|
159
|
-
V(), e.stopPropagation();
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
) })
|
|
163
|
-
] }) : t.map((e, n) => /* @__PURE__ */ a("li", { children: /* @__PURE__ */ a(
|
|
164
|
-
M,
|
|
165
|
-
{
|
|
166
|
-
text: String(e.value ?? e.name),
|
|
167
|
-
onDelete: (u) => {
|
|
168
|
-
O(n), u.stopPropagation();
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
) }, e.id ?? e.value ?? e.name)) }) : null
|
|
172
|
-
] }),
|
|
173
|
-
f && /* @__PURE__ */ a(
|
|
174
|
-
"ul",
|
|
175
|
-
{
|
|
176
|
-
className: "autocomplete-suggestions-container",
|
|
177
|
-
style: { width: c.current?.offsetWidth },
|
|
178
|
-
children: s.map((e) => /* @__PURE__ */ a(
|
|
179
|
-
"li",
|
|
180
|
-
{
|
|
181
|
-
className: `autocomplete-suggestion-item ${e.id === s[C]?.id ? "highlighted" : ""}`,
|
|
182
|
-
onMouseEnter: () => y(
|
|
183
|
-
s.findIndex((n) => n.id === e.id)
|
|
184
|
-
),
|
|
185
|
-
onClick: (n) => {
|
|
186
|
-
H(e), n.stopPropagation();
|
|
187
|
-
},
|
|
188
|
-
children: e.value ?? e.name
|
|
189
|
-
},
|
|
190
|
-
e.id ?? e.value ?? e.name
|
|
191
|
-
))
|
|
192
|
-
}
|
|
193
|
-
)
|
|
194
|
-
]
|
|
195
|
-
}
|
|
196
|
-
);
|
|
197
|
-
});
|
|
198
|
-
var W = /* @__PURE__ */ ((l) => (l.error = "error", l.good = "good", l.default = "default", l))(W || {});
|
|
199
|
-
const q = (l) => {
|
|
200
|
-
switch (l) {
|
|
201
|
-
case "error":
|
|
202
|
-
return "input-error";
|
|
203
|
-
case "good":
|
|
204
|
-
return "input-good";
|
|
205
|
-
default:
|
|
206
|
-
return "input-normal";
|
|
207
|
-
}
|
|
208
|
-
}, _ = (l) => {
|
|
209
|
-
switch (l) {
|
|
210
|
-
case "error":
|
|
211
|
-
return "input-label-error";
|
|
212
|
-
case "good":
|
|
213
|
-
return "input-label-good";
|
|
214
|
-
default:
|
|
215
|
-
return "input-label-normal";
|
|
216
|
-
}
|
|
217
|
-
}, J = (l) => {
|
|
218
|
-
switch (l) {
|
|
219
|
-
case "error":
|
|
220
|
-
return "input-helper-text-error";
|
|
221
|
-
case "good":
|
|
222
|
-
return "input-helper-text-good";
|
|
223
|
-
default:
|
|
224
|
-
return "input-helper-text-normal";
|
|
225
|
-
}
|
|
226
|
-
}, ce = U(function(l, h) {
|
|
227
|
-
const {
|
|
228
|
-
checked: p,
|
|
229
|
-
onChange: t,
|
|
230
|
-
name: r = "",
|
|
231
|
-
id: k = "",
|
|
232
|
-
label: S = "",
|
|
233
|
-
state: $ = W.default,
|
|
234
|
-
containerClassName: x = "",
|
|
235
|
-
inputClassName: D = "",
|
|
236
|
-
labelClassName: w = "",
|
|
237
|
-
...I
|
|
238
|
-
} = l;
|
|
239
|
-
return /* @__PURE__ */ L("label", { className: `input-check-container ${x}`, children: [
|
|
240
|
-
/* @__PURE__ */ a(
|
|
241
|
-
"input",
|
|
242
|
-
{
|
|
243
|
-
id: k,
|
|
244
|
-
ref: h,
|
|
245
|
-
name: r,
|
|
246
|
-
type: "checkbox",
|
|
247
|
-
checked: p,
|
|
248
|
-
onChange: t,
|
|
249
|
-
className: `input-check ${q($)} ${D}`,
|
|
250
|
-
...I
|
|
251
|
-
}
|
|
252
|
-
),
|
|
253
|
-
/* @__PURE__ */ a(
|
|
254
|
-
"span",
|
|
255
|
-
{
|
|
256
|
-
className: `input-check-label ${_($)} ${w}`,
|
|
257
|
-
children: S
|
|
258
|
-
}
|
|
259
|
-
)
|
|
260
|
-
] });
|
|
261
|
-
}), G = (l) => l == null ? !1 : Array.isArray(l) ? l.length > 0 : `${l}`.length > 0, Q = U(function(l, h) {
|
|
262
|
-
const {
|
|
263
|
-
children: p,
|
|
264
|
-
state: t = W.default,
|
|
265
|
-
label: r = "",
|
|
266
|
-
containerClassName: k = "",
|
|
267
|
-
inputClassName: S = "",
|
|
268
|
-
labelClassName: $ = "",
|
|
269
|
-
helperText: x = "",
|
|
270
|
-
helperTextClassName: D = "",
|
|
271
|
-
value: w,
|
|
272
|
-
defaultValue: I,
|
|
273
|
-
onChange: B,
|
|
274
|
-
onFocus: d,
|
|
275
|
-
onBlur: E,
|
|
276
|
-
...i
|
|
277
|
-
} = l, m = w !== void 0, [f, g] = F(
|
|
278
|
-
() => G(I)
|
|
279
|
-
), [C, y] = F(!1), s = m ? G(w) : f, c = i.type === "date", N = !!i.placeholder || C || c, T = (v) => {
|
|
280
|
-
m || g(v.currentTarget.value.length > 0), B?.(v);
|
|
281
|
-
}, b = (v) => {
|
|
282
|
-
C || y(!0), d?.(v);
|
|
283
|
-
}, o = (v) => {
|
|
284
|
-
C || y(!0), E?.(v);
|
|
285
|
-
};
|
|
286
|
-
return /* @__PURE__ */ L("div", { className: `text-input-container ${k}`, children: [
|
|
287
|
-
/* @__PURE__ */ a(
|
|
288
|
-
"input",
|
|
289
|
-
{
|
|
290
|
-
ref: h,
|
|
291
|
-
defaultValue: I,
|
|
292
|
-
onChange: T,
|
|
293
|
-
onFocus: b,
|
|
294
|
-
onBlur: o,
|
|
295
|
-
...m ? { value: w } : {},
|
|
296
|
-
className: `text-input ${q(t)} ${S} ${s ? "has-value" : ""} ${i.placeholder ? "has-placeholder" : ""} ${N ? "keep-label-up" : ""}`,
|
|
297
|
-
...i
|
|
298
|
-
}
|
|
299
|
-
),
|
|
300
|
-
!!r && /* @__PURE__ */ L(
|
|
301
|
-
"label",
|
|
302
|
-
{
|
|
303
|
-
htmlFor: i.id,
|
|
304
|
-
className: `text-input-label ${_(t)} ${$}`,
|
|
305
|
-
children: [
|
|
306
|
-
r,
|
|
307
|
-
i.required ? " *" : ""
|
|
308
|
-
]
|
|
309
|
-
}
|
|
310
|
-
),
|
|
311
|
-
p,
|
|
312
|
-
!!x && /* @__PURE__ */ a(
|
|
313
|
-
"p",
|
|
314
|
-
{
|
|
315
|
-
className: `text-input-helper-text ${J(t)} ${D}`,
|
|
316
|
-
children: x
|
|
317
|
-
}
|
|
318
|
-
)
|
|
319
|
-
] });
|
|
320
|
-
}), ue = U(function(l, h) {
|
|
321
|
-
const {
|
|
322
|
-
value: p,
|
|
323
|
-
onChange: t,
|
|
324
|
-
options: r,
|
|
325
|
-
containerClassName: k = "",
|
|
326
|
-
inputClassName: S = "",
|
|
327
|
-
labelClassName: $ = "",
|
|
328
|
-
helperText: x = "",
|
|
329
|
-
helperTextClassName: D = "",
|
|
330
|
-
label: w = "",
|
|
331
|
-
placeholder: I = "",
|
|
332
|
-
name: B = "",
|
|
333
|
-
id: d = "",
|
|
334
|
-
state: E = W.default,
|
|
335
|
-
native: i = !0,
|
|
336
|
-
disabled: m,
|
|
337
|
-
required: f,
|
|
338
|
-
autoFocus: g,
|
|
339
|
-
children: C,
|
|
340
|
-
...y
|
|
341
|
-
} = l, s = K(null), [c, N] = F(!1), [T, b] = F(-1), o = j(
|
|
342
|
-
() => r.findIndex(
|
|
343
|
-
(e) => String(e.id) === String(p ?? r[0]?.id ?? "")
|
|
344
|
-
),
|
|
345
|
-
[r, p]
|
|
346
|
-
), v = j(
|
|
347
|
-
() => o >= 0 ? r[o] : void 0,
|
|
348
|
-
[r, o]
|
|
349
|
-
);
|
|
350
|
-
R(() => {
|
|
351
|
-
if (!(i || !c)) {
|
|
352
|
-
if (!r.length) {
|
|
353
|
-
b(-1);
|
|
354
|
-
return;
|
|
355
|
-
}
|
|
356
|
-
b(o >= 0 ? o : 0);
|
|
357
|
-
}
|
|
358
|
-
}, [i, r.length, o, c]), R(() => {
|
|
359
|
-
if (i) return;
|
|
360
|
-
const e = (n) => {
|
|
361
|
-
s.current && !s.current.contains(n.target) && N(!1);
|
|
362
|
-
};
|
|
363
|
-
return document.addEventListener("mousedown", e), () => {
|
|
364
|
-
document.removeEventListener("mousedown", e);
|
|
365
|
-
};
|
|
366
|
-
}, [i]);
|
|
367
|
-
const H = A(
|
|
368
|
-
(e) => {
|
|
369
|
-
h && (typeof h == "function" ? h(e) : h.current = e);
|
|
370
|
-
},
|
|
371
|
-
[h]
|
|
372
|
-
), P = A(
|
|
373
|
-
(e) => {
|
|
374
|
-
if (!t) return;
|
|
375
|
-
const n = {
|
|
376
|
-
target: { value: String(e) },
|
|
377
|
-
currentTarget: { value: String(e) }
|
|
378
|
-
};
|
|
379
|
-
t(n);
|
|
380
|
-
},
|
|
381
|
-
[t]
|
|
382
|
-
), O = A(
|
|
383
|
-
(e) => {
|
|
384
|
-
const n = r[e];
|
|
385
|
-
n && (P(n.id), N(!1));
|
|
386
|
-
},
|
|
387
|
-
[P, r]
|
|
388
|
-
), V = A(
|
|
389
|
-
(e) => {
|
|
390
|
-
if (r.length) {
|
|
391
|
-
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
392
|
-
if (e.preventDefault(), !c) {
|
|
393
|
-
N(!0);
|
|
394
|
-
const n = o >= 0 ? o : 0;
|
|
395
|
-
b(n);
|
|
396
|
-
return;
|
|
397
|
-
}
|
|
398
|
-
b((n) => {
|
|
399
|
-
const u = n >= 0 ? n : o;
|
|
400
|
-
return e.key === "ArrowDown" ? (u + 1 + r.length) % r.length : (u - 1 + r.length) % r.length;
|
|
401
|
-
});
|
|
402
|
-
return;
|
|
403
|
-
}
|
|
404
|
-
if (e.key === "Enter") {
|
|
405
|
-
if (!c) {
|
|
406
|
-
e.preventDefault(), N(!0), b(o >= 0 ? o : 0);
|
|
407
|
-
return;
|
|
408
|
-
}
|
|
409
|
-
e.preventDefault(), O(T >= 0 ? T : 0);
|
|
410
|
-
return;
|
|
411
|
-
}
|
|
412
|
-
e.key === "Escape" && c && (e.preventDefault(), N(!1));
|
|
413
|
-
}
|
|
414
|
-
},
|
|
415
|
-
[T, r, O, o, c]
|
|
416
|
-
);
|
|
417
|
-
return i ? /* @__PURE__ */ L("div", { className: `select-input-container ${k}`, children: [
|
|
418
|
-
/* @__PURE__ */ a(
|
|
419
|
-
"select",
|
|
420
|
-
{
|
|
421
|
-
...y,
|
|
422
|
-
id: d,
|
|
423
|
-
ref: H,
|
|
424
|
-
name: B,
|
|
425
|
-
value: p,
|
|
426
|
-
onChange: t,
|
|
427
|
-
className: `select-input ${q(E)} peer ${S}`,
|
|
428
|
-
children: r?.map((e) => /* @__PURE__ */ a("option", { value: e.id, children: e.value ?? e.name ?? e.id }, e.id))
|
|
429
|
-
}
|
|
430
|
-
),
|
|
431
|
-
/* @__PURE__ */ a(
|
|
432
|
-
"label",
|
|
433
|
-
{
|
|
434
|
-
htmlFor: d,
|
|
435
|
-
className: `select-input-label ${_(E)} ${$}`,
|
|
436
|
-
children: w
|
|
437
|
-
}
|
|
438
|
-
),
|
|
439
|
-
C,
|
|
440
|
-
x && /* @__PURE__ */ a(
|
|
441
|
-
"p",
|
|
442
|
-
{
|
|
443
|
-
className: `select-input-helper-text ${J(E)} ${D}`,
|
|
444
|
-
children: x
|
|
445
|
-
}
|
|
446
|
-
)
|
|
447
|
-
] }) : /* @__PURE__ */ L(
|
|
448
|
-
"div",
|
|
449
|
-
{
|
|
450
|
-
ref: s,
|
|
451
|
-
className: `select-input-container ${k}`,
|
|
452
|
-
children: [
|
|
453
|
-
/* @__PURE__ */ a(
|
|
454
|
-
"select",
|
|
455
|
-
{
|
|
456
|
-
...y,
|
|
457
|
-
ref: H,
|
|
458
|
-
name: B,
|
|
459
|
-
id: d,
|
|
460
|
-
value: p,
|
|
461
|
-
onChange: t,
|
|
462
|
-
className: "select-input-native-hidden",
|
|
463
|
-
tabIndex: -1,
|
|
464
|
-
"aria-hidden": !0,
|
|
465
|
-
children: r?.map((e) => /* @__PURE__ */ a("option", { value: e.id, children: e.value ?? e.name ?? e.id }, e.id))
|
|
466
|
-
}
|
|
467
|
-
),
|
|
468
|
-
/* @__PURE__ */ a(
|
|
469
|
-
Q,
|
|
470
|
-
{
|
|
471
|
-
id: d,
|
|
472
|
-
name: B,
|
|
473
|
-
state: E,
|
|
474
|
-
value: String(v?.value ?? v?.name ?? ""),
|
|
475
|
-
readOnly: !0,
|
|
476
|
-
label: w,
|
|
477
|
-
helperText: x,
|
|
478
|
-
containerClassName: "select-input-text-container",
|
|
479
|
-
inputClassName: `select-input-text ${S}`,
|
|
480
|
-
labelClassName: $,
|
|
481
|
-
helperTextClassName: D,
|
|
482
|
-
placeholder: I,
|
|
483
|
-
disabled: m,
|
|
484
|
-
required: f,
|
|
485
|
-
autoFocus: g,
|
|
486
|
-
onClick: () => N((e) => !e),
|
|
487
|
-
onKeyDown: V,
|
|
488
|
-
onFocus: () => N(!0),
|
|
489
|
-
role: "combobox",
|
|
490
|
-
"aria-expanded": c,
|
|
491
|
-
"aria-haspopup": "listbox",
|
|
492
|
-
children: C
|
|
493
|
-
}
|
|
494
|
-
),
|
|
495
|
-
c && /* @__PURE__ */ a("ul", { className: "select-input-options-container", role: "listbox", children: r.map((e, n) => {
|
|
496
|
-
const u = String(e.id) === String(p);
|
|
497
|
-
return /* @__PURE__ */ a(
|
|
498
|
-
"li",
|
|
499
|
-
{
|
|
500
|
-
role: "option",
|
|
501
|
-
"aria-selected": u,
|
|
502
|
-
className: `select-input-option-item ${n === T ? "highlighted" : ""}`,
|
|
503
|
-
onMouseEnter: () => b(n),
|
|
504
|
-
onClick: (X) => {
|
|
505
|
-
O(n), X.stopPropagation();
|
|
506
|
-
},
|
|
507
|
-
children: e.value ?? e.name ?? e.id
|
|
508
|
-
},
|
|
509
|
-
e.id
|
|
510
|
-
);
|
|
511
|
-
}) })
|
|
512
|
-
]
|
|
513
|
-
}
|
|
514
|
-
);
|
|
515
|
-
});
|
|
516
|
-
export {
|
|
517
|
-
ie as A,
|
|
518
|
-
ce as C,
|
|
519
|
-
ue as S,
|
|
520
|
-
Q as T,
|
|
521
|
-
W as a,
|
|
522
|
-
J as h,
|
|
523
|
-
q as i,
|
|
524
|
-
_ as l
|
|
525
|
-
};
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import { jsx as I } from "react/jsx-runtime";
|
|
2
|
-
import { S as d } from "./query-CwuehjY1.js";
|
|
3
|
-
import { useState as o, useCallback as s, useMemo as B, createContext as J, useContext as K } from "react";
|
|
4
|
-
const H = [20, 50, 100], V = J(
|
|
5
|
-
void 0
|
|
6
|
-
), F = (n) => {
|
|
7
|
-
if (n === null || typeof n > "u") return !1;
|
|
8
|
-
if (typeof n == "string")
|
|
9
|
-
return n.trim().length > 0;
|
|
10
|
-
if (Array.isArray(n))
|
|
11
|
-
return n.length > 0;
|
|
12
|
-
if (typeof n == "object") {
|
|
13
|
-
const i = n;
|
|
14
|
-
return "start" in i || "end" in i ? F(i.start) || F(i.end) : !0;
|
|
15
|
-
}
|
|
16
|
-
return !0;
|
|
17
|
-
}, U = (n) => {
|
|
18
|
-
const { children: i, defaultHiddenColumns: b = [] } = n, [f, z] = o(0), [a, k] = o(20), [M, c] = o(0), [m, g] = o("id"), [u, p] = o(d.DESC), [h, l] = o({}), [x, S] = o(b), C = s(
|
|
19
|
-
(t, e) => e <= 0 ? 0 : Math.max(0, Math.ceil(t / e) - 1),
|
|
20
|
-
[]
|
|
21
|
-
), T = s(
|
|
22
|
-
(t) => {
|
|
23
|
-
const e = Number.isFinite(t) ? Math.max(0, t) : 0;
|
|
24
|
-
z(e), c(
|
|
25
|
-
(r) => Math.min(r, C(e, a))
|
|
26
|
-
);
|
|
27
|
-
},
|
|
28
|
-
[C, a]
|
|
29
|
-
), y = s((t) => {
|
|
30
|
-
!Number.isFinite(t) || t <= 0 || (k(t), c(0));
|
|
31
|
-
}, []), P = s(
|
|
32
|
-
(t) => {
|
|
33
|
-
if (!Number.isFinite(t)) return;
|
|
34
|
-
const e = Math.max(0, Math.floor(t));
|
|
35
|
-
c(Math.min(e, C(f, a)));
|
|
36
|
-
},
|
|
37
|
-
[C, a, f]
|
|
38
|
-
), A = s(
|
|
39
|
-
(t, e) => {
|
|
40
|
-
let r = u;
|
|
41
|
-
m === t && (u === d.ASC ? r = d.DESC : r = d.ASC), g(t), p(r), e && e(t, r);
|
|
42
|
-
},
|
|
43
|
-
[m, u]
|
|
44
|
-
), j = s((t) => {
|
|
45
|
-
const e = Object.entries(t).reduce(
|
|
46
|
-
(r, [G, O]) => (O && F(O.value) && (r[G] = O.value), r),
|
|
47
|
-
{}
|
|
48
|
-
);
|
|
49
|
-
l(e), c(0);
|
|
50
|
-
}, []), w = s(
|
|
51
|
-
(t) => {
|
|
52
|
-
l(t ? (e) => {
|
|
53
|
-
const r = { ...e };
|
|
54
|
-
return delete r[t], r;
|
|
55
|
-
} : {}), c(0);
|
|
56
|
-
},
|
|
57
|
-
[l]
|
|
58
|
-
), E = B(() => Object.keys(h).length, [h]), D = s((t) => {
|
|
59
|
-
S(
|
|
60
|
-
(e) => e.includes(t) ? e.filter((r) => r !== t) : [...e, t]
|
|
61
|
-
);
|
|
62
|
-
}, []), N = s(() => {
|
|
63
|
-
S(b), g("id"), p(d.DESC), l({}), c(0);
|
|
64
|
-
}, [b]), q = B(
|
|
65
|
-
() => ({
|
|
66
|
-
onSort: A,
|
|
67
|
-
total: f,
|
|
68
|
-
setTotal: T,
|
|
69
|
-
sortingBy: m,
|
|
70
|
-
setSortingBy: g,
|
|
71
|
-
sortingOrder: u,
|
|
72
|
-
setSortingOrder: p,
|
|
73
|
-
pageSize: a,
|
|
74
|
-
pageSizes: H,
|
|
75
|
-
setPageSize: y,
|
|
76
|
-
currentPage: M,
|
|
77
|
-
setCurrentPage: P,
|
|
78
|
-
filters: h,
|
|
79
|
-
onFilterApply: j,
|
|
80
|
-
clearFilters: w,
|
|
81
|
-
countOfFilters: E,
|
|
82
|
-
hiddenColumns: x,
|
|
83
|
-
toggleColumn: D,
|
|
84
|
-
setHiddenColumns: S,
|
|
85
|
-
resetTableOptions: N
|
|
86
|
-
}),
|
|
87
|
-
[
|
|
88
|
-
A,
|
|
89
|
-
f,
|
|
90
|
-
T,
|
|
91
|
-
m,
|
|
92
|
-
g,
|
|
93
|
-
u,
|
|
94
|
-
p,
|
|
95
|
-
a,
|
|
96
|
-
H,
|
|
97
|
-
y,
|
|
98
|
-
M,
|
|
99
|
-
P,
|
|
100
|
-
h,
|
|
101
|
-
j,
|
|
102
|
-
w,
|
|
103
|
-
E,
|
|
104
|
-
x,
|
|
105
|
-
D,
|
|
106
|
-
S,
|
|
107
|
-
N
|
|
108
|
-
]
|
|
109
|
-
);
|
|
110
|
-
return /* @__PURE__ */ I(V.Provider, { value: q, children: i });
|
|
111
|
-
}, W = () => {
|
|
112
|
-
const n = K(V);
|
|
113
|
-
if (!n)
|
|
114
|
-
throw new Error("tableOptionsContext must be used within a Provider");
|
|
115
|
-
return n;
|
|
116
|
-
};
|
|
117
|
-
export {
|
|
118
|
-
U as T,
|
|
119
|
-
W as u
|
|
120
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const z=require("react/jsx-runtime"),l=require("./query-81BrXp3i.cjs"),e=require("react"),E=[20,50,100],D=e.createContext(void 0),p=n=>{if(n===null||typeof n>"u")return!1;if(typeof n=="string")return n.trim().length>0;if(Array.isArray(n))return n.length>0;if(typeof n=="object"){const o=n;return"start"in o||"end"in o?p(o.start)||p(o.end):!0}return!0},R=n=>{const{children:o,defaultHiddenColumns:m=[]}=n,[d,N]=e.useState(0),[i,B]=e.useState(20),[M,a]=e.useState(0),[S,f]=e.useState("id"),[u,b]=e.useState(l.SortOrder.DESC),[C,c]=e.useState({}),[F,g]=e.useState(m),O=e.useCallback((t,r)=>r<=0?0:Math.max(0,Math.ceil(t/r)-1),[]),x=e.useCallback(t=>{const r=Number.isFinite(t)?Math.max(0,t):0;N(r),a(s=>Math.min(s,O(r,i)))},[O,i]),k=e.useCallback(t=>{!Number.isFinite(t)||t<=0||(B(t),a(0))},[]),T=e.useCallback(t=>{if(!Number.isFinite(t))return;const r=Math.max(0,Math.floor(t));a(Math.min(r,O(d,i)))},[O,i,d]),y=e.useCallback((t,r)=>{let s=u;S===t&&(u===l.SortOrder.ASC?s=l.SortOrder.DESC:s=l.SortOrder.ASC),f(t),b(s),r&&r(t,s)},[S,u]),P=e.useCallback(t=>{const r=Object.entries(t).reduce((s,[V,h])=>(h&&p(h.value)&&(s[V]=h.value),s),{});c(r),a(0)},[]),j=e.useCallback(t=>{c(t?r=>{const s={...r};return delete s[t],s}:{}),a(0)},[c]),A=e.useMemo(()=>Object.keys(C).length,[C]),q=e.useCallback(t=>{g(r=>r.includes(t)?r.filter(s=>s!==t):[...r,t])},[]),w=e.useCallback(()=>{g(m),f("id"),b(l.SortOrder.DESC),c({}),a(0)},[m]),H=e.useMemo(()=>({onSort:y,total:d,setTotal:x,sortingBy:S,setSortingBy:f,sortingOrder:u,setSortingOrder:b,pageSize:i,pageSizes:E,setPageSize:k,currentPage:M,setCurrentPage:T,filters:C,onFilterApply:P,clearFilters:j,countOfFilters:A,hiddenColumns:F,toggleColumn:q,setHiddenColumns:g,resetTableOptions:w}),[y,d,x,S,f,u,b,i,E,k,M,T,C,P,j,A,F,q,g,w]);return z.jsx(D.Provider,{value:H,children:o})},G=()=>{const n=e.useContext(D);if(!n)throw new Error("tableOptionsContext must be used within a Provider");return n};exports.TableOptionsProvider=R;exports.useTableOptions=G;
|