fintech-component-library 3.2.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,149 +1,149 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
function
|
|
6
|
-
if (
|
|
7
|
-
|
|
8
|
-
var
|
|
9
|
-
function
|
|
10
|
-
var
|
|
11
|
-
if (
|
|
12
|
-
|
|
13
|
-
for (var
|
|
14
|
-
|
|
15
|
-
} else
|
|
16
|
-
return
|
|
17
|
-
$$typeof:
|
|
18
|
-
type:
|
|
19
|
-
key:
|
|
20
|
-
ref:
|
|
21
|
-
props:
|
|
1
|
+
import * as m from "react";
|
|
2
|
+
import oe from "react";
|
|
3
|
+
var q = { exports: {} }, $ = {};
|
|
4
|
+
var ee;
|
|
5
|
+
function le() {
|
|
6
|
+
if (ee) return $;
|
|
7
|
+
ee = 1;
|
|
8
|
+
var c = /* @__PURE__ */ Symbol.for("react.transitional.element"), d = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
9
|
+
function w(N, x, y) {
|
|
10
|
+
var E = null;
|
|
11
|
+
if (y !== void 0 && (E = "" + y), x.key !== void 0 && (E = "" + x.key), "key" in x) {
|
|
12
|
+
y = {};
|
|
13
|
+
for (var _ in x)
|
|
14
|
+
_ !== "key" && (y[_] = x[_]);
|
|
15
|
+
} else y = x;
|
|
16
|
+
return x = y.ref, {
|
|
17
|
+
$$typeof: c,
|
|
18
|
+
type: N,
|
|
19
|
+
key: E,
|
|
20
|
+
ref: x !== void 0 ? x : null,
|
|
21
|
+
props: y
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
return
|
|
24
|
+
return $.Fragment = d, $.jsx = w, $.jsxs = w, $;
|
|
25
25
|
}
|
|
26
|
-
var
|
|
27
|
-
var
|
|
28
|
-
function
|
|
29
|
-
return
|
|
30
|
-
function
|
|
26
|
+
var Y = {};
|
|
27
|
+
var te;
|
|
28
|
+
function ce() {
|
|
29
|
+
return te || (te = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
30
|
+
function c(e) {
|
|
31
31
|
if (e == null) return null;
|
|
32
32
|
if (typeof e == "function")
|
|
33
|
-
return e.$$typeof ===
|
|
33
|
+
return e.$$typeof === u ? null : e.displayName || e.name || null;
|
|
34
34
|
if (typeof e == "string") return e;
|
|
35
35
|
switch (e) {
|
|
36
|
-
case
|
|
36
|
+
case h:
|
|
37
37
|
return "Fragment";
|
|
38
|
-
case
|
|
38
|
+
case j:
|
|
39
39
|
return "Profiler";
|
|
40
|
-
case
|
|
40
|
+
case p:
|
|
41
41
|
return "StrictMode";
|
|
42
|
-
case
|
|
42
|
+
case A:
|
|
43
43
|
return "Suspense";
|
|
44
|
-
case
|
|
44
|
+
case t:
|
|
45
45
|
return "SuspenseList";
|
|
46
|
-
case
|
|
46
|
+
case i:
|
|
47
47
|
return "Activity";
|
|
48
48
|
}
|
|
49
49
|
if (typeof e == "object")
|
|
50
50
|
switch (typeof e.tag == "number" && console.error(
|
|
51
51
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
52
52
|
), e.$$typeof) {
|
|
53
|
-
case
|
|
53
|
+
case s:
|
|
54
54
|
return "Portal";
|
|
55
|
-
case
|
|
55
|
+
case O:
|
|
56
56
|
return e.displayName || "Context";
|
|
57
|
-
case
|
|
57
|
+
case C:
|
|
58
58
|
return (e._context.displayName || "Context") + ".Consumer";
|
|
59
|
-
case
|
|
60
|
-
var
|
|
61
|
-
return e = e.displayName, e || (e =
|
|
62
|
-
case
|
|
63
|
-
return
|
|
64
|
-
case
|
|
65
|
-
|
|
59
|
+
case F:
|
|
60
|
+
var l = e.render;
|
|
61
|
+
return e = e.displayName, e || (e = l.displayName || l.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
62
|
+
case o:
|
|
63
|
+
return l = e.displayName || null, l !== null ? l : c(e.type) || "Memo";
|
|
64
|
+
case a:
|
|
65
|
+
l = e._payload, e = e._init;
|
|
66
66
|
try {
|
|
67
|
-
return
|
|
67
|
+
return c(e(l));
|
|
68
68
|
} catch {
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
return null;
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function d(e) {
|
|
74
74
|
return "" + e;
|
|
75
75
|
}
|
|
76
|
-
function
|
|
76
|
+
function w(e) {
|
|
77
77
|
try {
|
|
78
|
-
|
|
79
|
-
var
|
|
78
|
+
d(e);
|
|
79
|
+
var l = !1;
|
|
80
80
|
} catch {
|
|
81
|
-
|
|
81
|
+
l = !0;
|
|
82
82
|
}
|
|
83
|
-
if (
|
|
84
|
-
|
|
85
|
-
var
|
|
86
|
-
return
|
|
87
|
-
|
|
83
|
+
if (l) {
|
|
84
|
+
l = console;
|
|
85
|
+
var f = l.error, g = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
86
|
+
return f.call(
|
|
87
|
+
l,
|
|
88
88
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
89
|
-
|
|
90
|
-
),
|
|
89
|
+
g
|
|
90
|
+
), d(e);
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
function
|
|
94
|
-
if (e ===
|
|
95
|
-
if (typeof e == "object" && e !== null && e.$$typeof ===
|
|
93
|
+
function N(e) {
|
|
94
|
+
if (e === h) return "<>";
|
|
95
|
+
if (typeof e == "object" && e !== null && e.$$typeof === a)
|
|
96
96
|
return "<...>";
|
|
97
97
|
try {
|
|
98
|
-
var
|
|
99
|
-
return
|
|
98
|
+
var l = c(e);
|
|
99
|
+
return l ? "<" + l + ">" : "<...>";
|
|
100
100
|
} catch {
|
|
101
101
|
return "<...>";
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
-
function
|
|
105
|
-
var e =
|
|
104
|
+
function x() {
|
|
105
|
+
var e = D.A;
|
|
106
106
|
return e === null ? null : e.getOwner();
|
|
107
107
|
}
|
|
108
|
-
function
|
|
108
|
+
function y() {
|
|
109
109
|
return Error("react-stack-top-frame");
|
|
110
110
|
}
|
|
111
|
-
function
|
|
112
|
-
if (
|
|
113
|
-
var
|
|
114
|
-
if (
|
|
111
|
+
function E(e) {
|
|
112
|
+
if (B.call(e, "key")) {
|
|
113
|
+
var l = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
114
|
+
if (l && l.isReactWarning) return !1;
|
|
115
115
|
}
|
|
116
116
|
return e.key !== void 0;
|
|
117
117
|
}
|
|
118
|
-
function
|
|
119
|
-
function
|
|
120
|
-
|
|
118
|
+
function _(e, l) {
|
|
119
|
+
function f() {
|
|
120
|
+
W || (W = !0, console.error(
|
|
121
121
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
122
|
-
|
|
122
|
+
l
|
|
123
123
|
));
|
|
124
124
|
}
|
|
125
|
-
|
|
126
|
-
get:
|
|
125
|
+
f.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
126
|
+
get: f,
|
|
127
127
|
configurable: !0
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
|
-
function
|
|
131
|
-
var e =
|
|
132
|
-
return
|
|
130
|
+
function T() {
|
|
131
|
+
var e = c(this.type);
|
|
132
|
+
return I[e] || (I[e] = !0, console.error(
|
|
133
133
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
134
134
|
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
135
135
|
}
|
|
136
|
-
function
|
|
137
|
-
var
|
|
136
|
+
function k(e, l, f, g, U, J) {
|
|
137
|
+
var v = f.ref;
|
|
138
138
|
return e = {
|
|
139
|
-
$$typeof:
|
|
139
|
+
$$typeof: P,
|
|
140
140
|
type: e,
|
|
141
|
-
key:
|
|
142
|
-
props:
|
|
143
|
-
_owner:
|
|
144
|
-
}, (
|
|
141
|
+
key: l,
|
|
142
|
+
props: f,
|
|
143
|
+
_owner: g
|
|
144
|
+
}, (v !== void 0 ? v : null) !== null ? Object.defineProperty(e, "ref", {
|
|
145
145
|
enumerable: !1,
|
|
146
|
-
get:
|
|
146
|
+
get: T
|
|
147
147
|
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
148
148
|
configurable: !1,
|
|
149
149
|
enumerable: !1,
|
|
@@ -158,109 +158,109 @@ function oe() {
|
|
|
158
158
|
configurable: !1,
|
|
159
159
|
enumerable: !1,
|
|
160
160
|
writable: !0,
|
|
161
|
-
value:
|
|
161
|
+
value: U
|
|
162
162
|
}), Object.defineProperty(e, "_debugTask", {
|
|
163
163
|
configurable: !1,
|
|
164
164
|
enumerable: !1,
|
|
165
165
|
writable: !0,
|
|
166
|
-
value:
|
|
166
|
+
value: J
|
|
167
167
|
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
168
168
|
}
|
|
169
|
-
function
|
|
170
|
-
var
|
|
171
|
-
if (
|
|
172
|
-
if (
|
|
173
|
-
if (
|
|
174
|
-
for (
|
|
175
|
-
|
|
176
|
-
Object.freeze && Object.freeze(
|
|
169
|
+
function n(e, l, f, g, U, J) {
|
|
170
|
+
var v = l.children;
|
|
171
|
+
if (v !== void 0)
|
|
172
|
+
if (g)
|
|
173
|
+
if (L(v)) {
|
|
174
|
+
for (g = 0; g < v.length; g++)
|
|
175
|
+
R(v[g]);
|
|
176
|
+
Object.freeze && Object.freeze(v);
|
|
177
177
|
} else
|
|
178
178
|
console.error(
|
|
179
179
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
180
180
|
);
|
|
181
|
-
else
|
|
182
|
-
if (
|
|
183
|
-
|
|
184
|
-
var
|
|
181
|
+
else R(v);
|
|
182
|
+
if (B.call(l, "key")) {
|
|
183
|
+
v = c(e);
|
|
184
|
+
var z = Object.keys(l).filter(function(ne) {
|
|
185
185
|
return ne !== "key";
|
|
186
186
|
});
|
|
187
|
-
|
|
187
|
+
g = 0 < z.length ? "{key: someKey, " + z.join(": ..., ") + ": ...}" : "{key: someKey}", K[v + g] || (z = 0 < z.length ? "{" + z.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
188
188
|
`A props object containing a "key" prop is being spread into JSX:
|
|
189
189
|
let props = %s;
|
|
190
190
|
<%s {...props} />
|
|
191
191
|
React keys must be passed directly to JSX without using spread:
|
|
192
192
|
let props = %s;
|
|
193
193
|
<%s key={someKey} {...props} />`,
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
),
|
|
194
|
+
g,
|
|
195
|
+
v,
|
|
196
|
+
z,
|
|
197
|
+
v
|
|
198
|
+
), K[v + g] = !0);
|
|
199
199
|
}
|
|
200
|
-
if (
|
|
201
|
-
|
|
202
|
-
for (var
|
|
203
|
-
|
|
204
|
-
} else
|
|
205
|
-
return
|
|
206
|
-
|
|
200
|
+
if (v = null, f !== void 0 && (w(f), v = "" + f), E(l) && (w(l.key), v = "" + l.key), "key" in l) {
|
|
201
|
+
f = {};
|
|
202
|
+
for (var G in l)
|
|
203
|
+
G !== "key" && (f[G] = l[G]);
|
|
204
|
+
} else f = l;
|
|
205
|
+
return v && _(
|
|
206
|
+
f,
|
|
207
207
|
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
208
|
-
),
|
|
208
|
+
), k(
|
|
209
209
|
e,
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
210
|
+
v,
|
|
211
|
+
f,
|
|
212
|
+
x(),
|
|
213
|
+
U,
|
|
214
|
+
J
|
|
215
215
|
);
|
|
216
216
|
}
|
|
217
|
-
function j(e) {
|
|
218
|
-
R(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === c && (e._payload.status === "fulfilled" ? R(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
219
|
-
}
|
|
220
217
|
function R(e) {
|
|
221
|
-
|
|
218
|
+
S(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === a && (e._payload.status === "fulfilled" ? S(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
219
|
+
}
|
|
220
|
+
function S(e) {
|
|
221
|
+
return typeof e == "object" && e !== null && e.$$typeof === P;
|
|
222
222
|
}
|
|
223
|
-
var
|
|
223
|
+
var b = oe, P = /* @__PURE__ */ Symbol.for("react.transitional.element"), s = /* @__PURE__ */ Symbol.for("react.portal"), h = /* @__PURE__ */ Symbol.for("react.fragment"), p = /* @__PURE__ */ Symbol.for("react.strict_mode"), j = /* @__PURE__ */ Symbol.for("react.profiler"), C = /* @__PURE__ */ Symbol.for("react.consumer"), O = /* @__PURE__ */ Symbol.for("react.context"), F = /* @__PURE__ */ Symbol.for("react.forward_ref"), A = /* @__PURE__ */ Symbol.for("react.suspense"), t = /* @__PURE__ */ Symbol.for("react.suspense_list"), o = /* @__PURE__ */ Symbol.for("react.memo"), a = /* @__PURE__ */ Symbol.for("react.lazy"), i = /* @__PURE__ */ Symbol.for("react.activity"), u = /* @__PURE__ */ Symbol.for("react.client.reference"), D = b.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, B = Object.prototype.hasOwnProperty, L = Array.isArray, M = console.createTask ? console.createTask : function() {
|
|
224
224
|
return null;
|
|
225
225
|
};
|
|
226
|
-
|
|
226
|
+
b = {
|
|
227
227
|
react_stack_bottom_frame: function(e) {
|
|
228
228
|
return e();
|
|
229
229
|
}
|
|
230
230
|
};
|
|
231
|
-
var
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
)(),
|
|
235
|
-
|
|
236
|
-
var
|
|
237
|
-
return
|
|
231
|
+
var W, I = {}, Z = b.react_stack_bottom_frame.bind(
|
|
232
|
+
b,
|
|
233
|
+
y
|
|
234
|
+
)(), Q = M(N(y)), K = {};
|
|
235
|
+
Y.Fragment = h, Y.jsx = function(e, l, f) {
|
|
236
|
+
var g = 1e4 > D.recentlyCreatedOwnerStacks++;
|
|
237
|
+
return n(
|
|
238
238
|
e,
|
|
239
|
-
|
|
240
|
-
|
|
239
|
+
l,
|
|
240
|
+
f,
|
|
241
241
|
!1,
|
|
242
|
-
|
|
243
|
-
|
|
242
|
+
g ? Error("react-stack-top-frame") : Z,
|
|
243
|
+
g ? M(N(e)) : Q
|
|
244
244
|
);
|
|
245
|
-
},
|
|
246
|
-
var
|
|
247
|
-
return
|
|
245
|
+
}, Y.jsxs = function(e, l, f) {
|
|
246
|
+
var g = 1e4 > D.recentlyCreatedOwnerStacks++;
|
|
247
|
+
return n(
|
|
248
248
|
e,
|
|
249
|
-
|
|
250
|
-
|
|
249
|
+
l,
|
|
250
|
+
f,
|
|
251
251
|
!0,
|
|
252
|
-
|
|
253
|
-
|
|
252
|
+
g ? Error("react-stack-top-frame") : Z,
|
|
253
|
+
g ? M(N(e)) : Q
|
|
254
254
|
);
|
|
255
255
|
};
|
|
256
|
-
})()),
|
|
256
|
+
})()), Y;
|
|
257
257
|
}
|
|
258
|
-
var
|
|
259
|
-
function
|
|
260
|
-
return
|
|
258
|
+
var re;
|
|
259
|
+
function ie() {
|
|
260
|
+
return re || (re = 1, process.env.NODE_ENV === "production" ? q.exports = le() : q.exports = ce()), q.exports;
|
|
261
261
|
}
|
|
262
|
-
var
|
|
263
|
-
const
|
|
262
|
+
var r = ie();
|
|
263
|
+
const ue = {
|
|
264
264
|
baseClasses: "inline-flex items-center justify-center font-medium rounded-md transition-colors duration-200 gap-2",
|
|
265
265
|
focusRing: "focus:outline-none focus:ring-2 focus:ring-offset-2",
|
|
266
266
|
variants: {
|
|
@@ -276,7 +276,7 @@ const le = {
|
|
|
276
276
|
md: "px-4 py-2 text-base",
|
|
277
277
|
lg: "px-6 py-3 text-lg"
|
|
278
278
|
}
|
|
279
|
-
},
|
|
279
|
+
}, de = m.createContext(ue), me = () => m.useContext(de), xe = (...c) => c.filter(Boolean).join(" "), pe = () => /* @__PURE__ */ r.jsxs(
|
|
280
280
|
"svg",
|
|
281
281
|
{
|
|
282
282
|
className: "animate-spin h-4 w-4 text-current",
|
|
@@ -284,7 +284,7 @@ const le = {
|
|
|
284
284
|
role: "presentation",
|
|
285
285
|
"aria-hidden": "true",
|
|
286
286
|
children: [
|
|
287
|
-
/* @__PURE__ */
|
|
287
|
+
/* @__PURE__ */ r.jsx(
|
|
288
288
|
"circle",
|
|
289
289
|
{
|
|
290
290
|
className: "opacity-25",
|
|
@@ -296,7 +296,7 @@ const le = {
|
|
|
296
296
|
fill: "none"
|
|
297
297
|
}
|
|
298
298
|
),
|
|
299
|
-
/* @__PURE__ */
|
|
299
|
+
/* @__PURE__ */ r.jsx(
|
|
300
300
|
"path",
|
|
301
301
|
{
|
|
302
302
|
className: "opacity-75",
|
|
@@ -306,204 +306,204 @@ const le = {
|
|
|
306
306
|
)
|
|
307
307
|
]
|
|
308
308
|
}
|
|
309
|
-
),
|
|
309
|
+
), X = m.forwardRef(
|
|
310
310
|
({
|
|
311
|
-
children:
|
|
312
|
-
variant:
|
|
313
|
-
size:
|
|
314
|
-
disabled:
|
|
315
|
-
className:
|
|
316
|
-
type:
|
|
317
|
-
iconLeft:
|
|
318
|
-
iconRight:
|
|
319
|
-
isLoading:
|
|
320
|
-
loadingText:
|
|
321
|
-
fullWidth:
|
|
322
|
-
as:
|
|
323
|
-
...
|
|
324
|
-
},
|
|
325
|
-
const
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
),
|
|
334
|
-
/* @__PURE__ */
|
|
335
|
-
|
|
336
|
-
] }) : /* @__PURE__ */
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
] }),
|
|
341
|
-
className:
|
|
342
|
-
"aria-busy":
|
|
343
|
-
"aria-disabled": !
|
|
344
|
-
...
|
|
311
|
+
children: c,
|
|
312
|
+
variant: d = "primary",
|
|
313
|
+
size: w = "md",
|
|
314
|
+
disabled: N = !1,
|
|
315
|
+
className: x = "",
|
|
316
|
+
type: y = "button",
|
|
317
|
+
iconLeft: E,
|
|
318
|
+
iconRight: _,
|
|
319
|
+
isLoading: T = !1,
|
|
320
|
+
loadingText: k,
|
|
321
|
+
fullWidth: n = !1,
|
|
322
|
+
as: R,
|
|
323
|
+
...S
|
|
324
|
+
}, b) => {
|
|
325
|
+
const P = R || "button", s = me(), h = s.variants[d] ?? s.variants.primary ?? "", p = s.sizes[w] ?? s.sizes.md ?? "", j = s.focusRing ?? "", C = N || T, O = P === "button" || !R, F = xe(
|
|
326
|
+
s.baseClasses,
|
|
327
|
+
j,
|
|
328
|
+
h,
|
|
329
|
+
p,
|
|
330
|
+
n && "w-full",
|
|
331
|
+
C && "opacity-50 cursor-not-allowed",
|
|
332
|
+
x
|
|
333
|
+
), A = k ?? (typeof c == "string" ? c : "Loading..."), t = () => T ? /* @__PURE__ */ r.jsxs("span", { className: "inline-flex items-center gap-2", children: [
|
|
334
|
+
/* @__PURE__ */ r.jsx(pe, {}),
|
|
335
|
+
A && /* @__PURE__ */ r.jsx("span", { children: A })
|
|
336
|
+
] }) : /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
|
|
337
|
+
E && /* @__PURE__ */ r.jsx("span", { className: "inline-flex items-center", children: E }),
|
|
338
|
+
c && /* @__PURE__ */ r.jsx("span", { children: c }),
|
|
339
|
+
_ && /* @__PURE__ */ r.jsx("span", { className: "inline-flex items-center", children: _ })
|
|
340
|
+
] }), o = {
|
|
341
|
+
className: F,
|
|
342
|
+
"aria-busy": T || void 0,
|
|
343
|
+
"aria-disabled": !O && C ? !0 : void 0,
|
|
344
|
+
...S
|
|
345
345
|
};
|
|
346
|
-
if (
|
|
347
|
-
return /* @__PURE__ */
|
|
346
|
+
if (O)
|
|
347
|
+
return /* @__PURE__ */ r.jsx(
|
|
348
348
|
"button",
|
|
349
349
|
{
|
|
350
|
-
type:
|
|
351
|
-
disabled:
|
|
352
|
-
ref:
|
|
353
|
-
...
|
|
354
|
-
children:
|
|
350
|
+
type: y,
|
|
351
|
+
disabled: C,
|
|
352
|
+
ref: b,
|
|
353
|
+
...o,
|
|
354
|
+
children: t()
|
|
355
355
|
}
|
|
356
356
|
);
|
|
357
|
-
const
|
|
358
|
-
role:
|
|
359
|
-
tabIndex:
|
|
360
|
-
onClick:
|
|
361
|
-
...
|
|
357
|
+
const a = {
|
|
358
|
+
role: o.role ?? "button",
|
|
359
|
+
tabIndex: o.tabIndex ?? 0,
|
|
360
|
+
onClick: C ? void 0 : o.onClick,
|
|
361
|
+
...o
|
|
362
362
|
};
|
|
363
|
-
return /* @__PURE__ */
|
|
363
|
+
return /* @__PURE__ */ r.jsx(P, { ref: b, ...a, children: t() });
|
|
364
364
|
}
|
|
365
365
|
);
|
|
366
|
-
|
|
367
|
-
const
|
|
368
|
-
fields:
|
|
369
|
-
initialValues:
|
|
370
|
-
onSubmit:
|
|
371
|
-
onChange:
|
|
372
|
-
submitLabel:
|
|
373
|
-
className:
|
|
374
|
-
layout:
|
|
375
|
-
submitButtonProps:
|
|
376
|
-
actions:
|
|
377
|
-
disabled:
|
|
366
|
+
X.displayName = "Button";
|
|
367
|
+
const H = "block w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-sm text-slate-900 placeholder-slate-400 shadow-sm focus:border-primary focus:ring-primary", se = (c, d) => typeof d < "u" ? d : c.type === "checkbox" ? !1 : "", fe = ({
|
|
368
|
+
fields: c,
|
|
369
|
+
initialValues: d,
|
|
370
|
+
onSubmit: w,
|
|
371
|
+
onChange: N,
|
|
372
|
+
submitLabel: x = "Submit",
|
|
373
|
+
className: y = "",
|
|
374
|
+
layout: E = "vertical",
|
|
375
|
+
submitButtonProps: _,
|
|
376
|
+
actions: T,
|
|
377
|
+
disabled: k = !1
|
|
378
378
|
}) => {
|
|
379
|
-
const [
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
),
|
|
383
|
-
}, [
|
|
384
|
-
(
|
|
385
|
-
if (
|
|
386
|
-
return `${
|
|
387
|
-
if (
|
|
388
|
-
return
|
|
379
|
+
const [n, R] = m.useState(() => c.reduce((t, o) => (t[o.name] = se(o, d?.[o.name]), t), {})), [S, b] = m.useState({}), [P, s] = m.useState(!1), h = E === "horizontal" ? "grid gap-6 md:grid-cols-2" : "flex flex-col gap-6", p = m.useCallback(() => {
|
|
380
|
+
R(
|
|
381
|
+
c.reduce((t, o) => (t[o.name] = se(o, d?.[o.name]), t), {})
|
|
382
|
+
), b({});
|
|
383
|
+
}, [c, d]), j = m.useCallback(
|
|
384
|
+
(t, o) => {
|
|
385
|
+
if (t.required && (t.type === "checkbox" ? o !== !0 : o === "" || o === void 0))
|
|
386
|
+
return `${t.label} is required.`;
|
|
387
|
+
if (t.validate)
|
|
388
|
+
return t.validate(o, n);
|
|
389
389
|
},
|
|
390
|
-
[
|
|
391
|
-
),
|
|
392
|
-
|
|
393
|
-
const
|
|
394
|
-
return
|
|
390
|
+
[n]
|
|
391
|
+
), C = (t, o) => {
|
|
392
|
+
R((a) => {
|
|
393
|
+
const i = { ...a, [t]: o };
|
|
394
|
+
return N?.(i), i;
|
|
395
395
|
});
|
|
396
|
-
},
|
|
397
|
-
const
|
|
398
|
-
|
|
399
|
-
},
|
|
400
|
-
|
|
401
|
-
const
|
|
402
|
-
(
|
|
396
|
+
}, O = (t) => {
|
|
397
|
+
const o = j(t, n[t.name]);
|
|
398
|
+
b((a) => ({ ...a, [t.name]: o }));
|
|
399
|
+
}, F = async (t) => {
|
|
400
|
+
t.preventDefault();
|
|
401
|
+
const o = c.reduce(
|
|
402
|
+
(i, u) => (i[u.name] = j(u, n[u.name]), i),
|
|
403
403
|
{}
|
|
404
404
|
);
|
|
405
|
-
if (
|
|
405
|
+
if (b(o), !Object.values(o).some(Boolean))
|
|
406
406
|
try {
|
|
407
|
-
|
|
407
|
+
s(!0), await Promise.resolve(w(n, { reset: p }));
|
|
408
408
|
} finally {
|
|
409
|
-
|
|
409
|
+
s(!1);
|
|
410
410
|
}
|
|
411
|
-
},
|
|
412
|
-
if (
|
|
413
|
-
return
|
|
414
|
-
field:
|
|
415
|
-
value:
|
|
416
|
-
error:
|
|
417
|
-
id:
|
|
418
|
-
onChange: (
|
|
419
|
-
onBlur: () =>
|
|
411
|
+
}, A = (t, o, a) => {
|
|
412
|
+
if (t.component)
|
|
413
|
+
return t.component({
|
|
414
|
+
field: t,
|
|
415
|
+
value: o,
|
|
416
|
+
error: S[t.name],
|
|
417
|
+
id: a,
|
|
418
|
+
onChange: (u) => C(t.name, u),
|
|
419
|
+
onBlur: () => O(t)
|
|
420
420
|
});
|
|
421
|
-
const
|
|
422
|
-
id:
|
|
423
|
-
name:
|
|
424
|
-
onBlur: () =>
|
|
425
|
-
disabled:
|
|
426
|
-
"aria-invalid":
|
|
427
|
-
"aria-describedby":
|
|
421
|
+
const i = {
|
|
422
|
+
id: a,
|
|
423
|
+
name: t.name,
|
|
424
|
+
onBlur: () => O(t),
|
|
425
|
+
disabled: k,
|
|
426
|
+
"aria-invalid": S[t.name] ? "true" : void 0,
|
|
427
|
+
"aria-describedby": S[t.name] ? `${a}-error` : t.helperText ? `${a}-helper` : void 0
|
|
428
428
|
};
|
|
429
|
-
return
|
|
429
|
+
return t.type === "textarea" ? /* @__PURE__ */ r.jsx(
|
|
430
430
|
"textarea",
|
|
431
431
|
{
|
|
432
|
-
...
|
|
433
|
-
className:
|
|
434
|
-
placeholder:
|
|
435
|
-
value:
|
|
436
|
-
onChange: (
|
|
432
|
+
...i,
|
|
433
|
+
className: H,
|
|
434
|
+
placeholder: t.placeholder,
|
|
435
|
+
value: o ?? "",
|
|
436
|
+
onChange: (u) => C(t.name, u.target.value),
|
|
437
437
|
rows: 4
|
|
438
438
|
}
|
|
439
|
-
) :
|
|
439
|
+
) : t.type === "select" ? /* @__PURE__ */ r.jsxs(
|
|
440
440
|
"select",
|
|
441
441
|
{
|
|
442
|
-
...
|
|
443
|
-
className:
|
|
444
|
-
value:
|
|
445
|
-
onChange: (
|
|
442
|
+
...i,
|
|
443
|
+
className: H,
|
|
444
|
+
value: o ?? "",
|
|
445
|
+
onChange: (u) => C(t.name, u.target.value),
|
|
446
446
|
children: [
|
|
447
|
-
/* @__PURE__ */
|
|
448
|
-
|
|
447
|
+
/* @__PURE__ */ r.jsx("option", { value: "", disabled: !0, children: t.placeholder ?? "Select an option" }),
|
|
448
|
+
t.options?.map((u) => /* @__PURE__ */ r.jsx("option", { value: u.value, children: u.label }, u.value))
|
|
449
449
|
]
|
|
450
450
|
}
|
|
451
|
-
) :
|
|
452
|
-
/* @__PURE__ */
|
|
451
|
+
) : t.type === "checkbox" ? /* @__PURE__ */ r.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
452
|
+
/* @__PURE__ */ r.jsx(
|
|
453
453
|
"input",
|
|
454
454
|
{
|
|
455
|
-
...
|
|
455
|
+
...i,
|
|
456
456
|
type: "checkbox",
|
|
457
|
-
checked: !!
|
|
458
|
-
onChange: (
|
|
457
|
+
checked: !!o,
|
|
458
|
+
onChange: (u) => C(t.name, u.target.checked),
|
|
459
459
|
className: "h-4 w-4 rounded border-slate-300 text-primary focus:ring-primary"
|
|
460
460
|
}
|
|
461
461
|
),
|
|
462
|
-
/* @__PURE__ */
|
|
463
|
-
] }) : /* @__PURE__ */
|
|
462
|
+
/* @__PURE__ */ r.jsx("label", { htmlFor: a, className: "text-sm text-slate-700 font-medium", children: t.label })
|
|
463
|
+
] }) : /* @__PURE__ */ r.jsx(
|
|
464
464
|
"input",
|
|
465
465
|
{
|
|
466
|
-
...
|
|
467
|
-
type:
|
|
468
|
-
className:
|
|
469
|
-
placeholder:
|
|
470
|
-
value:
|
|
471
|
-
onChange: (
|
|
466
|
+
...i,
|
|
467
|
+
type: t.type,
|
|
468
|
+
className: H,
|
|
469
|
+
placeholder: t.placeholder,
|
|
470
|
+
value: o ?? "",
|
|
471
|
+
onChange: (u) => C(t.name, u.target.value)
|
|
472
472
|
}
|
|
473
473
|
);
|
|
474
474
|
};
|
|
475
|
-
return /* @__PURE__ */
|
|
475
|
+
return /* @__PURE__ */ r.jsxs(
|
|
476
476
|
"form",
|
|
477
477
|
{
|
|
478
|
-
className: `rounded-xl border border-slate-200 bg-white p-6 shadow-sm ${
|
|
479
|
-
onSubmit:
|
|
478
|
+
className: `rounded-xl border border-slate-200 bg-white p-6 shadow-sm ${y}`,
|
|
479
|
+
onSubmit: F,
|
|
480
480
|
noValidate: !0,
|
|
481
481
|
children: [
|
|
482
|
-
/* @__PURE__ */
|
|
483
|
-
const
|
|
484
|
-
return /* @__PURE__ */
|
|
485
|
-
|
|
486
|
-
/* @__PURE__ */
|
|
487
|
-
|
|
488
|
-
|
|
482
|
+
/* @__PURE__ */ r.jsx("div", { className: h, children: c.map((t) => {
|
|
483
|
+
const o = `form-${t.name}`, a = n[t.name], i = S[t.name];
|
|
484
|
+
return /* @__PURE__ */ r.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
485
|
+
t.type !== "checkbox" && /* @__PURE__ */ r.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
486
|
+
/* @__PURE__ */ r.jsxs("label", { htmlFor: o, className: "text-sm font-medium text-slate-700", children: [
|
|
487
|
+
t.label,
|
|
488
|
+
t.required && /* @__PURE__ */ r.jsx("span", { className: "text-danger", children: "*" })
|
|
489
489
|
] }),
|
|
490
|
-
|
|
490
|
+
t.description && /* @__PURE__ */ r.jsx("p", { className: "text-xs text-slate-500", children: t.description })
|
|
491
491
|
] }),
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
] },
|
|
492
|
+
A(t, a, o),
|
|
493
|
+
t.helperText && !i && t.type !== "checkbox" && /* @__PURE__ */ r.jsx("p", { id: `${o}-helper`, className: "text-xs text-slate-500", children: t.helperText }),
|
|
494
|
+
i && /* @__PURE__ */ r.jsx("p", { id: `${o}-error`, className: "text-xs text-danger", children: i })
|
|
495
|
+
] }, t.name);
|
|
496
496
|
}) }),
|
|
497
|
-
/* @__PURE__ */
|
|
498
|
-
|
|
499
|
-
/* @__PURE__ */
|
|
500
|
-
|
|
497
|
+
/* @__PURE__ */ r.jsxs("div", { className: "mt-6 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between", children: [
|
|
498
|
+
T,
|
|
499
|
+
/* @__PURE__ */ r.jsx(
|
|
500
|
+
X,
|
|
501
501
|
{
|
|
502
502
|
type: "submit",
|
|
503
|
-
isLoading:
|
|
504
|
-
disabled:
|
|
505
|
-
...
|
|
506
|
-
children:
|
|
503
|
+
isLoading: P,
|
|
504
|
+
disabled: k,
|
|
505
|
+
..._,
|
|
506
|
+
children: x
|
|
507
507
|
}
|
|
508
508
|
)
|
|
509
509
|
] })
|
|
@@ -511,8 +511,274 @@ const q = "block w-full rounded-md border border-slate-300 bg-white px-3 py-2 te
|
|
|
511
511
|
}
|
|
512
512
|
);
|
|
513
513
|
};
|
|
514
|
-
|
|
514
|
+
fe.displayName = "Form";
|
|
515
|
+
const he = (c, d) => {
|
|
516
|
+
if (!d) return !0;
|
|
517
|
+
const w = d.toLowerCase();
|
|
518
|
+
return Object.values(c ?? {}).some(
|
|
519
|
+
(N) => String(N ?? "").toLowerCase().includes(w)
|
|
520
|
+
);
|
|
521
|
+
};
|
|
522
|
+
function be({
|
|
523
|
+
data: c,
|
|
524
|
+
columns: d,
|
|
525
|
+
initialPageSize: w,
|
|
526
|
+
globalFilter: N
|
|
527
|
+
}) {
|
|
528
|
+
const [x, y] = m.useState(void 0), [E, _] = m.useState(""), [T, k] = m.useState(0), [n, R] = m.useState(w), [S, b] = m.useState(
|
|
529
|
+
() => d.reduce((a, i) => (a[i.id] = i.width, a), {})
|
|
530
|
+
), P = N ?? he, s = m.useMemo(() => E ? c.filter((a) => P(a, E)) : c, [c, P, E]), h = m.useMemo(() => {
|
|
531
|
+
if (!x) return s;
|
|
532
|
+
const a = d.find((D) => D.id === x.columnId);
|
|
533
|
+
if (!a) return s;
|
|
534
|
+
const i = a.accessor, u = x.direction === "asc" ? 1 : -1;
|
|
535
|
+
return [...s].sort((D, B) => {
|
|
536
|
+
const L = (I) => typeof i == "function" ? i(I) : I[i], M = L(D), W = L(B);
|
|
537
|
+
return M === W ? 0 : M == null ? -1 * u : W == null ? 1 * u : M > W ? u : -u;
|
|
538
|
+
});
|
|
539
|
+
}, [s, x, d]), p = h.length, j = Math.max(1, Math.ceil(p / n)), C = m.useMemo(() => {
|
|
540
|
+
const a = T * n;
|
|
541
|
+
return h.slice(a, a + n);
|
|
542
|
+
}, [T, n, h]), O = m.useCallback(
|
|
543
|
+
(a) => {
|
|
544
|
+
y((i) => {
|
|
545
|
+
if (i?.columnId === a) {
|
|
546
|
+
const u = i.direction === "asc" ? "desc" : "asc";
|
|
547
|
+
return { columnId: a, direction: u };
|
|
548
|
+
}
|
|
549
|
+
return { columnId: a, direction: "asc" };
|
|
550
|
+
});
|
|
551
|
+
},
|
|
552
|
+
[]
|
|
553
|
+
), F = m.useCallback((a) => {
|
|
554
|
+
R(a), k(0);
|
|
555
|
+
}, []), A = m.useCallback((a, i) => {
|
|
556
|
+
b((u) => ({
|
|
557
|
+
...u,
|
|
558
|
+
[a]: Math.max(i, 64)
|
|
559
|
+
}));
|
|
560
|
+
}, []), t = m.useCallback(() => {
|
|
561
|
+
k((a) => Math.min(a + 1, j - 1));
|
|
562
|
+
}, [j]), o = m.useCallback(() => {
|
|
563
|
+
k((a) => Math.max(a - 1, 0));
|
|
564
|
+
}, []);
|
|
565
|
+
return {
|
|
566
|
+
sort: x,
|
|
567
|
+
filterValue: E,
|
|
568
|
+
pageIndex: T,
|
|
569
|
+
pageSize: n,
|
|
570
|
+
columnWidths: S,
|
|
571
|
+
paginatedData: C,
|
|
572
|
+
totalRows: p,
|
|
573
|
+
pageCount: j,
|
|
574
|
+
setSort: O,
|
|
575
|
+
setFilterValue: (a) => {
|
|
576
|
+
_(a), k(0);
|
|
577
|
+
},
|
|
578
|
+
setPageIndex: k,
|
|
579
|
+
setPageSize: F,
|
|
580
|
+
setColumnWidth: A,
|
|
581
|
+
nextPage: t,
|
|
582
|
+
previousPage: o
|
|
583
|
+
};
|
|
584
|
+
}
|
|
585
|
+
const V = (...c) => c.filter(Boolean).join(" "), ae = {
|
|
586
|
+
left: "text-left",
|
|
587
|
+
center: "text-center",
|
|
588
|
+
right: "text-right"
|
|
589
|
+
}, ge = ({
|
|
590
|
+
data: c,
|
|
591
|
+
columns: d,
|
|
592
|
+
pageSizeOptions: w = [10, 25, 50],
|
|
593
|
+
initialPageSize: N = w[0] ?? 10,
|
|
594
|
+
globalFilter: x,
|
|
595
|
+
stickyHeader: y = !0,
|
|
596
|
+
className: E,
|
|
597
|
+
emptyMessage: _ = "No data to display.",
|
|
598
|
+
renderToolbar: T,
|
|
599
|
+
rowKey: k
|
|
600
|
+
}) => {
|
|
601
|
+
const n = be({
|
|
602
|
+
data: c,
|
|
603
|
+
columns: d,
|
|
604
|
+
initialPageSize: N,
|
|
605
|
+
globalFilter: x
|
|
606
|
+
}), [R, S] = m.useState(null), b = m.useRef(null);
|
|
607
|
+
m.useEffect(() => {
|
|
608
|
+
if (!R) return;
|
|
609
|
+
const s = (p) => {
|
|
610
|
+
if (b.current == null) {
|
|
611
|
+
b.current = p.clientX;
|
|
612
|
+
return;
|
|
613
|
+
}
|
|
614
|
+
const j = p.clientX - b.current;
|
|
615
|
+
b.current = p.clientX, n.setColumnWidth(
|
|
616
|
+
R,
|
|
617
|
+
(n.columnWidths[R] ?? 0) + j
|
|
618
|
+
);
|
|
619
|
+
}, h = () => {
|
|
620
|
+
S(null), b.current = null;
|
|
621
|
+
};
|
|
622
|
+
return window.addEventListener("mousemove", s), window.addEventListener("mouseup", h), () => {
|
|
623
|
+
window.removeEventListener("mousemove", s), window.removeEventListener("mouseup", h);
|
|
624
|
+
};
|
|
625
|
+
}, [R, n]);
|
|
626
|
+
const P = T?.({
|
|
627
|
+
filterValue: n.filterValue,
|
|
628
|
+
setFilterValue: n.setFilterValue
|
|
629
|
+
}) ?? /* @__PURE__ */ r.jsxs("div", { className: "flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between", children: [
|
|
630
|
+
/* @__PURE__ */ r.jsx(
|
|
631
|
+
"input",
|
|
632
|
+
{
|
|
633
|
+
type: "search",
|
|
634
|
+
placeholder: "Filter rows...",
|
|
635
|
+
value: n.filterValue,
|
|
636
|
+
onChange: (s) => n.setFilterValue(s.target.value),
|
|
637
|
+
className: "w-full max-w-sm rounded-md border border-slate-300 px-3 py-2 text-sm focus:border-primary focus:ring-primary"
|
|
638
|
+
}
|
|
639
|
+
),
|
|
640
|
+
/* @__PURE__ */ r.jsxs("div", { className: "flex items-center gap-2 text-sm text-slate-500", children: [
|
|
641
|
+
"Showing ",
|
|
642
|
+
n.paginatedData.length,
|
|
643
|
+
" of ",
|
|
644
|
+
n.totalRows,
|
|
645
|
+
" rows"
|
|
646
|
+
] })
|
|
647
|
+
] });
|
|
648
|
+
return /* @__PURE__ */ r.jsxs("div", { className: V("flex flex-col gap-4", E), children: [
|
|
649
|
+
P,
|
|
650
|
+
/* @__PURE__ */ r.jsx("div", { className: "relative", children: /* @__PURE__ */ r.jsx("div", { className: "overflow-auto rounded-xl border border-slate-200 shadow-sm", children: /* @__PURE__ */ r.jsxs("table", { className: "min-w-full border-collapse", role: "grid", children: [
|
|
651
|
+
/* @__PURE__ */ r.jsx(
|
|
652
|
+
"thead",
|
|
653
|
+
{
|
|
654
|
+
className: V(
|
|
655
|
+
"bg-slate-50 text-left text-xs font-semibold uppercase text-slate-500",
|
|
656
|
+
y && "sticky top-0 z-10"
|
|
657
|
+
),
|
|
658
|
+
children: /* @__PURE__ */ r.jsx("tr", { children: d.map((s) => {
|
|
659
|
+
const h = n.sort?.columnId === s.id, p = h ? n.sort?.direction === "asc" ? "ascending" : "descending" : "none", j = n.columnWidths[s.id];
|
|
660
|
+
return /* @__PURE__ */ r.jsxs(
|
|
661
|
+
"th",
|
|
662
|
+
{
|
|
663
|
+
scope: "col",
|
|
664
|
+
"aria-sort": p,
|
|
665
|
+
style: j ? { width: j, minWidth: s.minWidth, maxWidth: s.maxWidth } : {
|
|
666
|
+
minWidth: s.minWidth,
|
|
667
|
+
maxWidth: s.maxWidth
|
|
668
|
+
},
|
|
669
|
+
className: V(
|
|
670
|
+
"group relative select-none border-b border-slate-200 px-4 py-3 text-sm font-semibold text-slate-600",
|
|
671
|
+
s.align ? ae[s.align] : "text-left",
|
|
672
|
+
s.sticky && "sticky left-0 bg-slate-50"
|
|
673
|
+
),
|
|
674
|
+
children: [
|
|
675
|
+
/* @__PURE__ */ r.jsxs(
|
|
676
|
+
"button",
|
|
677
|
+
{
|
|
678
|
+
type: "button",
|
|
679
|
+
className: V(
|
|
680
|
+
"inline-flex items-center gap-1 text-inherit",
|
|
681
|
+
s.sortable && "cursor-pointer"
|
|
682
|
+
),
|
|
683
|
+
onClick: () => s.sortable && n.setSort(s.id),
|
|
684
|
+
"aria-label": s.sortable ? `Sort by ${s.id}` : void 0,
|
|
685
|
+
children: [
|
|
686
|
+
s.header,
|
|
687
|
+
s.sortable && /* @__PURE__ */ r.jsx("span", { className: "text-xs text-slate-400", children: h ? n.sort?.direction === "asc" ? "▲" : "▼" : "⇅" })
|
|
688
|
+
]
|
|
689
|
+
}
|
|
690
|
+
),
|
|
691
|
+
/* @__PURE__ */ r.jsx(
|
|
692
|
+
"span",
|
|
693
|
+
{
|
|
694
|
+
role: "separator",
|
|
695
|
+
className: "absolute right-0 top-0 h-full w-1 cursor-col-resize opacity-0 transition group-hover:opacity-100",
|
|
696
|
+
onMouseDown: () => S(s.id)
|
|
697
|
+
}
|
|
698
|
+
)
|
|
699
|
+
]
|
|
700
|
+
},
|
|
701
|
+
s.id
|
|
702
|
+
);
|
|
703
|
+
}) })
|
|
704
|
+
}
|
|
705
|
+
),
|
|
706
|
+
/* @__PURE__ */ r.jsx("tbody", { className: "bg-white text-sm text-slate-700", children: n.paginatedData.length === 0 ? /* @__PURE__ */ r.jsx("tr", { children: /* @__PURE__ */ r.jsx(
|
|
707
|
+
"td",
|
|
708
|
+
{
|
|
709
|
+
className: "px-4 py-6 text-center text-slate-500",
|
|
710
|
+
colSpan: d.length,
|
|
711
|
+
children: _
|
|
712
|
+
}
|
|
713
|
+
) }) : n.paginatedData.map((s, h) => /* @__PURE__ */ r.jsx(
|
|
714
|
+
"tr",
|
|
715
|
+
{
|
|
716
|
+
className: "border-b border-slate-100 last:border-0 odd:bg-white even:bg-slate-50/30",
|
|
717
|
+
children: d.map((p) => {
|
|
718
|
+
const j = typeof p.accessor == "function" ? p.accessor(s) : s[p.accessor];
|
|
719
|
+
return /* @__PURE__ */ r.jsx(
|
|
720
|
+
"td",
|
|
721
|
+
{
|
|
722
|
+
className: V(
|
|
723
|
+
"px-4 py-3 align-middle",
|
|
724
|
+
p.align ? ae[p.align] : "text-left"
|
|
725
|
+
),
|
|
726
|
+
children: p.cell ? p.cell({ value: j, row: s, rowIndex: h }) : String(j ?? "—")
|
|
727
|
+
},
|
|
728
|
+
p.id
|
|
729
|
+
);
|
|
730
|
+
})
|
|
731
|
+
},
|
|
732
|
+
k?.(s, h) ?? h
|
|
733
|
+
)) })
|
|
734
|
+
] }) }) }),
|
|
735
|
+
/* @__PURE__ */ r.jsxs("div", { className: "flex flex-col gap-3 border-t border-slate-200 pt-4 text-sm text-slate-600 sm:flex-row sm:items-center sm:justify-between", children: [
|
|
736
|
+
/* @__PURE__ */ r.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
737
|
+
/* @__PURE__ */ r.jsx("span", { children: "Rows per page" }),
|
|
738
|
+
/* @__PURE__ */ r.jsx(
|
|
739
|
+
"select",
|
|
740
|
+
{
|
|
741
|
+
value: n.pageSize,
|
|
742
|
+
onChange: (s) => n.setPageSize(Number(s.target.value)),
|
|
743
|
+
className: "rounded-md border border-slate-300 px-2 py-1 text-sm",
|
|
744
|
+
children: w.map((s) => /* @__PURE__ */ r.jsx("option", { value: s, children: s }, s))
|
|
745
|
+
}
|
|
746
|
+
)
|
|
747
|
+
] }),
|
|
748
|
+
/* @__PURE__ */ r.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
749
|
+
/* @__PURE__ */ r.jsx(
|
|
750
|
+
X,
|
|
751
|
+
{
|
|
752
|
+
variant: "secondary",
|
|
753
|
+
size: "sm",
|
|
754
|
+
onClick: n.previousPage,
|
|
755
|
+
disabled: n.pageIndex === 0,
|
|
756
|
+
children: "Previous"
|
|
757
|
+
}
|
|
758
|
+
),
|
|
759
|
+
/* @__PURE__ */ r.jsxs("span", { className: "px-2 text-xs font-medium", children: [
|
|
760
|
+
"Page ",
|
|
761
|
+
n.pageIndex + 1,
|
|
762
|
+
" of ",
|
|
763
|
+
n.pageCount
|
|
764
|
+
] }),
|
|
765
|
+
/* @__PURE__ */ r.jsx(
|
|
766
|
+
X,
|
|
767
|
+
{
|
|
768
|
+
variant: "secondary",
|
|
769
|
+
size: "sm",
|
|
770
|
+
onClick: n.nextPage,
|
|
771
|
+
disabled: n.pageIndex + 1 >= n.pageCount,
|
|
772
|
+
children: "Next"
|
|
773
|
+
}
|
|
774
|
+
)
|
|
775
|
+
] })
|
|
776
|
+
] })
|
|
777
|
+
] });
|
|
778
|
+
};
|
|
779
|
+
ge.displayName = "DataTable";
|
|
515
780
|
export {
|
|
516
|
-
|
|
517
|
-
|
|
781
|
+
X as Button,
|
|
782
|
+
ge as DataTable,
|
|
783
|
+
fe as Form
|
|
518
784
|
};
|