analytica-frontend-lib 1.2.21 → 1.2.23
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/dist/AlertManager/index.css +20 -3
- package/dist/AlertManager/index.css.map +1 -1
- package/dist/AlertManagerView/index.js +382 -159
- package/dist/AlertManagerView/index.js.map +1 -1
- package/dist/AlertManagerView/index.mjs +381 -159
- package/dist/AlertManagerView/index.mjs.map +1 -1
- package/dist/EmptyState/index.d.mts +65 -0
- package/dist/EmptyState/index.d.ts +65 -0
- package/dist/EmptyState/index.js +185 -0
- package/dist/EmptyState/index.js.map +1 -0
- package/dist/EmptyState/index.mjs +162 -0
- package/dist/EmptyState/index.mjs.map +1 -0
- package/dist/Radio/index.d.mts +1 -1
- package/dist/Radio/index.d.ts +1 -1
- package/dist/Table/index.d.mts +23 -24
- package/dist/Table/index.d.ts +23 -24
- package/dist/Table/index.js +363 -140
- package/dist/Table/index.js.map +1 -1
- package/dist/Table/index.mjs +358 -136
- package/dist/Table/index.mjs.map +1 -1
- package/dist/TableProvider/index.css +20 -3
- package/dist/TableProvider/index.css.map +1 -1
- package/dist/TableProvider/index.d.mts +1 -1
- package/dist/TableProvider/index.d.ts +1 -1
- package/dist/TableProvider/index.js +861 -629
- package/dist/TableProvider/index.js.map +1 -1
- package/dist/TableProvider/index.mjs +772 -541
- package/dist/TableProvider/index.mjs.map +1 -1
- package/dist/{TableProvider-CDcL1tDj.d.mts → TableProvider-BnAnv3OV.d.mts} +51 -4
- package/dist/{TableProvider-D4Ak7ofz.d.ts → TableProvider-GfPlLqzg.d.ts} +51 -4
- package/dist/index.css +20 -3
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +1361 -1279
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1318 -1238
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +20 -3
- package/dist/styles.css.map +1 -1
- package/package.json +2 -1
package/dist/Table/index.js
CHANGED
|
@@ -32,7 +32,7 @@ __export(Table_exports, {
|
|
|
32
32
|
useTableSort: () => useTableSort
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(Table_exports);
|
|
35
|
-
var
|
|
35
|
+
var import_react2 = require("react");
|
|
36
36
|
|
|
37
37
|
// src/utils/utils.ts
|
|
38
38
|
var import_clsx = require("clsx");
|
|
@@ -182,9 +182,204 @@ var Button = ({
|
|
|
182
182
|
};
|
|
183
183
|
var Button_default = Button;
|
|
184
184
|
|
|
185
|
+
// src/components/EmptyState/EmptyState.tsx
|
|
186
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
187
|
+
var EmptyState = ({
|
|
188
|
+
image,
|
|
189
|
+
title,
|
|
190
|
+
description,
|
|
191
|
+
buttonText,
|
|
192
|
+
buttonIcon,
|
|
193
|
+
onButtonClick,
|
|
194
|
+
buttonVariant = "solid",
|
|
195
|
+
buttonAction = "primary"
|
|
196
|
+
}) => {
|
|
197
|
+
const displayTitle = title || "Nenhum dado dispon\xEDvel";
|
|
198
|
+
const displayDescription = description || "N\xE3o h\xE1 dados para exibir no momento.";
|
|
199
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex flex-col justify-center items-center gap-6 w-full min-h-[705px] bg-background rounded-xl p-6", children: [
|
|
200
|
+
image && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("img", { src: image, alt: displayTitle, className: "w-[170px] h-[150px]" }),
|
|
201
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex flex-col items-center gap-4 w-full max-w-[600px] px-6", children: [
|
|
202
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
203
|
+
Text_default,
|
|
204
|
+
{
|
|
205
|
+
as: "h2",
|
|
206
|
+
className: "text-text-950 font-semibold text-3xl leading-[35px] text-center",
|
|
207
|
+
children: displayTitle
|
|
208
|
+
}
|
|
209
|
+
),
|
|
210
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text_default, { className: "text-text-600 font-normal text-[18px] leading-[27px] text-center", children: displayDescription })
|
|
211
|
+
] }),
|
|
212
|
+
buttonText && onButtonClick && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
213
|
+
Button_default,
|
|
214
|
+
{
|
|
215
|
+
variant: buttonVariant,
|
|
216
|
+
action: buttonAction,
|
|
217
|
+
size: "large",
|
|
218
|
+
onClick: onButtonClick,
|
|
219
|
+
iconLeft: buttonIcon,
|
|
220
|
+
className: "rounded-full px-5 py-2.5",
|
|
221
|
+
children: buttonText
|
|
222
|
+
}
|
|
223
|
+
)
|
|
224
|
+
] });
|
|
225
|
+
};
|
|
226
|
+
var EmptyState_default = EmptyState;
|
|
227
|
+
|
|
228
|
+
// src/components/Skeleton/Skeleton.tsx
|
|
229
|
+
var import_react = require("react");
|
|
230
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
231
|
+
var SKELETON_ANIMATION_CLASSES = {
|
|
232
|
+
pulse: "animate-pulse",
|
|
233
|
+
none: ""
|
|
234
|
+
};
|
|
235
|
+
var SKELETON_VARIANT_CLASSES = {
|
|
236
|
+
text: "h-4 bg-background-200 rounded",
|
|
237
|
+
circular: "bg-background-200 rounded-full",
|
|
238
|
+
rectangular: "bg-background-200",
|
|
239
|
+
rounded: "bg-background-200 rounded-lg"
|
|
240
|
+
};
|
|
241
|
+
var SPACING_CLASSES = {
|
|
242
|
+
none: "",
|
|
243
|
+
small: "space-y-1",
|
|
244
|
+
medium: "space-y-2",
|
|
245
|
+
large: "space-y-3"
|
|
246
|
+
};
|
|
247
|
+
var Skeleton = (0, import_react.forwardRef)(
|
|
248
|
+
({
|
|
249
|
+
variant = "text",
|
|
250
|
+
width,
|
|
251
|
+
height,
|
|
252
|
+
animation = "pulse",
|
|
253
|
+
lines = 1,
|
|
254
|
+
spacing = "none",
|
|
255
|
+
className = "",
|
|
256
|
+
children,
|
|
257
|
+
...props
|
|
258
|
+
}, ref) => {
|
|
259
|
+
const animationClass = SKELETON_ANIMATION_CLASSES[animation];
|
|
260
|
+
const variantClass = SKELETON_VARIANT_CLASSES[variant];
|
|
261
|
+
const spacingClass = SPACING_CLASSES[spacing];
|
|
262
|
+
const style = {
|
|
263
|
+
width: typeof width === "number" ? `${width}px` : width,
|
|
264
|
+
height: typeof height === "number" ? `${height}px` : height
|
|
265
|
+
};
|
|
266
|
+
if (variant === "text" && lines > 1) {
|
|
267
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
268
|
+
"div",
|
|
269
|
+
{
|
|
270
|
+
ref,
|
|
271
|
+
className: cn("flex flex-col", spacingClass, className),
|
|
272
|
+
...props,
|
|
273
|
+
children: Array.from({ length: lines }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
274
|
+
"div",
|
|
275
|
+
{
|
|
276
|
+
className: cn(variantClass, animationClass),
|
|
277
|
+
style: index === lines - 1 ? { width: "60%" } : void 0
|
|
278
|
+
},
|
|
279
|
+
index
|
|
280
|
+
))
|
|
281
|
+
}
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
285
|
+
"div",
|
|
286
|
+
{
|
|
287
|
+
ref,
|
|
288
|
+
className: cn(variantClass, animationClass, className),
|
|
289
|
+
style,
|
|
290
|
+
...props,
|
|
291
|
+
children
|
|
292
|
+
}
|
|
293
|
+
);
|
|
294
|
+
}
|
|
295
|
+
);
|
|
296
|
+
var SkeletonText = (0, import_react.forwardRef)(
|
|
297
|
+
(props, ref) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Skeleton, { ref, variant: "text", ...props })
|
|
298
|
+
);
|
|
299
|
+
var SkeletonCircle = (0, import_react.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Skeleton, { ref, variant: "circular", ...props }));
|
|
300
|
+
var SkeletonRectangle = (0, import_react.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Skeleton, { ref, variant: "rectangular", ...props }));
|
|
301
|
+
var SkeletonRounded = (0, import_react.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Skeleton, { ref, variant: "rounded", ...props }));
|
|
302
|
+
var SkeletonCard = (0, import_react.forwardRef)(
|
|
303
|
+
({
|
|
304
|
+
showAvatar = true,
|
|
305
|
+
showTitle = true,
|
|
306
|
+
showDescription = true,
|
|
307
|
+
showActions = true,
|
|
308
|
+
lines = 2,
|
|
309
|
+
className = "",
|
|
310
|
+
...props
|
|
311
|
+
}, ref) => {
|
|
312
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
313
|
+
"div",
|
|
314
|
+
{
|
|
315
|
+
ref,
|
|
316
|
+
className: cn(
|
|
317
|
+
"w-full p-4 bg-background border border-border-200 rounded-lg",
|
|
318
|
+
className
|
|
319
|
+
),
|
|
320
|
+
...props,
|
|
321
|
+
children: [
|
|
322
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-start space-x-3", children: [
|
|
323
|
+
showAvatar && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SkeletonCircle, { width: 40, height: 40 }),
|
|
324
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex-1 space-y-2", children: [
|
|
325
|
+
showTitle && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SkeletonText, { width: "60%", height: 20 }),
|
|
326
|
+
showDescription && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SkeletonText, { lines, spacing: "small" })
|
|
327
|
+
] })
|
|
328
|
+
] }),
|
|
329
|
+
showActions && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex justify-end space-x-2 mt-4", children: [
|
|
330
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SkeletonRectangle, { width: 80, height: 32 }),
|
|
331
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SkeletonRectangle, { width: 80, height: 32 })
|
|
332
|
+
] })
|
|
333
|
+
]
|
|
334
|
+
}
|
|
335
|
+
);
|
|
336
|
+
}
|
|
337
|
+
);
|
|
338
|
+
var SkeletonList = (0, import_react.forwardRef)(
|
|
339
|
+
({
|
|
340
|
+
items = 3,
|
|
341
|
+
showAvatar = true,
|
|
342
|
+
showTitle = true,
|
|
343
|
+
showDescription = true,
|
|
344
|
+
lines = 1,
|
|
345
|
+
className = "",
|
|
346
|
+
...props
|
|
347
|
+
}, ref) => {
|
|
348
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { ref, className: cn("space-y-3", className), ...props, children: Array.from({ length: items }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-start space-x-3 p-3", children: [
|
|
349
|
+
showAvatar && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SkeletonCircle, { width: 32, height: 32 }),
|
|
350
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex-1 space-y-2", children: [
|
|
351
|
+
showTitle && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SkeletonText, { width: "40%", height: 16 }),
|
|
352
|
+
showDescription && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SkeletonText, { lines, spacing: "small" })
|
|
353
|
+
] })
|
|
354
|
+
] }, index)) });
|
|
355
|
+
}
|
|
356
|
+
);
|
|
357
|
+
var SkeletonTable = (0, import_react.forwardRef)(
|
|
358
|
+
({ rows = 5, columns = 4, showHeader = true, className = "", ...props }, ref) => {
|
|
359
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { ref, className: cn("w-full", className), ...props, children: [
|
|
360
|
+
showHeader && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "flex space-x-2 mb-3", children: Array.from({ length: columns }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
361
|
+
SkeletonText,
|
|
362
|
+
{
|
|
363
|
+
width: `${100 / columns}%`,
|
|
364
|
+
height: 20
|
|
365
|
+
},
|
|
366
|
+
index
|
|
367
|
+
)) }),
|
|
368
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "space-y-2", children: Array.from({ length: rows }, (_, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "flex space-x-2", children: Array.from({ length: columns }, (_2, colIndex) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
369
|
+
SkeletonText,
|
|
370
|
+
{
|
|
371
|
+
width: `${100 / columns}%`,
|
|
372
|
+
height: 16
|
|
373
|
+
},
|
|
374
|
+
colIndex
|
|
375
|
+
)) }, rowIndex)) })
|
|
376
|
+
] });
|
|
377
|
+
}
|
|
378
|
+
);
|
|
379
|
+
|
|
185
380
|
// src/components/Table/TablePagination.tsx
|
|
186
381
|
var import_phosphor_react = require("phosphor-react");
|
|
187
|
-
var
|
|
382
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
188
383
|
var TablePagination = ({
|
|
189
384
|
totalItems,
|
|
190
385
|
currentPage,
|
|
@@ -215,7 +410,7 @@ var TablePagination = ({
|
|
|
215
410
|
};
|
|
216
411
|
const isFirstPage = currentPage === 1;
|
|
217
412
|
const isLastPage = currentPage === totalPages;
|
|
218
|
-
return /* @__PURE__ */ (0,
|
|
413
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
219
414
|
"div",
|
|
220
415
|
{
|
|
221
416
|
className: cn(
|
|
@@ -225,29 +420,29 @@ var TablePagination = ({
|
|
|
225
420
|
),
|
|
226
421
|
...props,
|
|
227
422
|
children: [
|
|
228
|
-
/* @__PURE__ */ (0,
|
|
423
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "font-normal text-xs leading-[14px] text-text-800", children: [
|
|
229
424
|
startItem,
|
|
230
425
|
" de ",
|
|
231
426
|
totalItems,
|
|
232
427
|
" ",
|
|
233
428
|
itemLabel
|
|
234
429
|
] }),
|
|
235
|
-
/* @__PURE__ */ (0,
|
|
236
|
-
onItemsPerPageChange && /* @__PURE__ */ (0,
|
|
237
|
-
/* @__PURE__ */ (0,
|
|
430
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-wrap sm:flex-nowrap items-center gap-2 sm:gap-4 justify-center sm:justify-start", children: [
|
|
431
|
+
onItemsPerPageChange && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "relative", children: [
|
|
432
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
238
433
|
"select",
|
|
239
434
|
{
|
|
240
435
|
value: itemsPerPage,
|
|
241
436
|
onChange: handleItemsPerPageChange,
|
|
242
437
|
className: "w-24 h-9 py-0 px-3 pr-8 bg-background border border-border-300 rounded appearance-none cursor-pointer font-normal text-sm leading-[21px] text-text-900",
|
|
243
438
|
"aria-label": "Items por p\xE1gina",
|
|
244
|
-
children: itemsPerPageOptions.map((option) => /* @__PURE__ */ (0,
|
|
439
|
+
children: itemsPerPageOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("option", { value: option, children: [
|
|
245
440
|
option,
|
|
246
441
|
" itens"
|
|
247
442
|
] }, option))
|
|
248
443
|
}
|
|
249
444
|
),
|
|
250
|
-
/* @__PURE__ */ (0,
|
|
445
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
251
446
|
import_phosphor_react.CaretDown,
|
|
252
447
|
{
|
|
253
448
|
size: 14,
|
|
@@ -256,13 +451,13 @@ var TablePagination = ({
|
|
|
256
451
|
}
|
|
257
452
|
)
|
|
258
453
|
] }),
|
|
259
|
-
/* @__PURE__ */ (0,
|
|
454
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "font-normal text-xs leading-[14px] text-text-950", children: [
|
|
260
455
|
"P\xE1gina ",
|
|
261
456
|
currentPage,
|
|
262
457
|
" de ",
|
|
263
458
|
totalPages
|
|
264
459
|
] }),
|
|
265
|
-
/* @__PURE__ */ (0,
|
|
460
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
266
461
|
"button",
|
|
267
462
|
{
|
|
268
463
|
onClick: handlePrevious,
|
|
@@ -273,12 +468,12 @@ var TablePagination = ({
|
|
|
273
468
|
),
|
|
274
469
|
"aria-label": "P\xE1gina anterior",
|
|
275
470
|
children: [
|
|
276
|
-
/* @__PURE__ */ (0,
|
|
277
|
-
/* @__PURE__ */ (0,
|
|
471
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_phosphor_react.CaretLeft, { size: 12, weight: "bold", className: "text-primary-950" }),
|
|
472
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "font-medium text-xs leading-[14px] text-primary-950", children: "Anterior" })
|
|
278
473
|
]
|
|
279
474
|
}
|
|
280
475
|
),
|
|
281
|
-
/* @__PURE__ */ (0,
|
|
476
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
282
477
|
"button",
|
|
283
478
|
{
|
|
284
479
|
onClick: handleNext,
|
|
@@ -289,8 +484,8 @@ var TablePagination = ({
|
|
|
289
484
|
),
|
|
290
485
|
"aria-label": "Pr\xF3xima p\xE1gina",
|
|
291
486
|
children: [
|
|
292
|
-
/* @__PURE__ */ (0,
|
|
293
|
-
/* @__PURE__ */ (0,
|
|
487
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "font-medium text-xs leading-[14px] text-primary-950", children: "Pr\xF3xima" }),
|
|
488
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_phosphor_react.CaretRight, { size: 12, weight: "bold", className: "text-primary-950" })
|
|
294
489
|
]
|
|
295
490
|
}
|
|
296
491
|
)
|
|
@@ -303,7 +498,7 @@ TablePagination.displayName = "TablePagination";
|
|
|
303
498
|
var TablePagination_default = TablePagination;
|
|
304
499
|
|
|
305
500
|
// src/components/Table/Table.tsx
|
|
306
|
-
var
|
|
501
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
307
502
|
function useTableSort(data, options = {}) {
|
|
308
503
|
const { syncWithUrl = false } = options;
|
|
309
504
|
const getInitialState = () => {
|
|
@@ -322,13 +517,13 @@ function useTableSort(data, options = {}) {
|
|
|
322
517
|
return { column: null, direction: null };
|
|
323
518
|
};
|
|
324
519
|
const initialState = getInitialState();
|
|
325
|
-
const [sortColumn, setSortColumn] = (0,
|
|
520
|
+
const [sortColumn, setSortColumn] = (0, import_react2.useState)(
|
|
326
521
|
initialState.column
|
|
327
522
|
);
|
|
328
|
-
const [sortDirection, setSortDirection] = (0,
|
|
523
|
+
const [sortDirection, setSortDirection] = (0, import_react2.useState)(
|
|
329
524
|
initialState.direction
|
|
330
525
|
);
|
|
331
|
-
(0,
|
|
526
|
+
(0, import_react2.useEffect)(() => {
|
|
332
527
|
if (!syncWithUrl || globalThis.window === void 0) return;
|
|
333
528
|
const url = new URL(globalThis.location.href);
|
|
334
529
|
const params = url.searchParams;
|
|
@@ -354,7 +549,7 @@ function useTableSort(data, options = {}) {
|
|
|
354
549
|
setSortDirection("asc");
|
|
355
550
|
}
|
|
356
551
|
};
|
|
357
|
-
const sortedData = (0,
|
|
552
|
+
const sortedData = (0, import_react2.useMemo)(() => {
|
|
358
553
|
if (!sortColumn || !sortDirection) {
|
|
359
554
|
return data;
|
|
360
555
|
}
|
|
@@ -373,121 +568,149 @@ function useTableSort(data, options = {}) {
|
|
|
373
568
|
}, [data, sortColumn, sortDirection]);
|
|
374
569
|
return { sortedData, sortColumn, sortDirection, handleSort };
|
|
375
570
|
}
|
|
376
|
-
var
|
|
571
|
+
var renderHeaderElements = (children) => {
|
|
572
|
+
return import_react2.Children.map(children, (child) => {
|
|
573
|
+
if ((0, import_react2.isValidElement)(child) && (child.type === TableCaption || child.type === TableHeader)) {
|
|
574
|
+
return child;
|
|
575
|
+
}
|
|
576
|
+
return null;
|
|
577
|
+
});
|
|
578
|
+
};
|
|
579
|
+
var getNoSearchResultContent = (config, defaultTitle, defaultDescription) => {
|
|
580
|
+
if (config.component) {
|
|
581
|
+
return config.component;
|
|
582
|
+
}
|
|
583
|
+
if (config.image) {
|
|
584
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
585
|
+
NoSearchResult_default,
|
|
586
|
+
{
|
|
587
|
+
image: config.image,
|
|
588
|
+
title: config.title || defaultTitle,
|
|
589
|
+
description: config.description || defaultDescription
|
|
590
|
+
}
|
|
591
|
+
);
|
|
592
|
+
}
|
|
593
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "text-center", children: [
|
|
594
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "text-text-600 text-lg font-semibold mb-2", children: config.title || defaultTitle }),
|
|
595
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "text-text-500 text-sm", children: config.description || defaultDescription })
|
|
596
|
+
] });
|
|
597
|
+
};
|
|
598
|
+
var getEmptyStateContent = (config, defaultTitle, defaultDescription) => {
|
|
599
|
+
if (config?.component) {
|
|
600
|
+
return config.component;
|
|
601
|
+
}
|
|
602
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
603
|
+
EmptyState_default,
|
|
604
|
+
{
|
|
605
|
+
image: config?.image,
|
|
606
|
+
title: config?.title || defaultTitle,
|
|
607
|
+
description: config?.description || defaultDescription,
|
|
608
|
+
buttonText: config?.buttonText,
|
|
609
|
+
buttonIcon: config?.buttonIcon,
|
|
610
|
+
onButtonClick: config?.onButtonClick,
|
|
611
|
+
buttonVariant: config?.buttonVariant,
|
|
612
|
+
buttonAction: config?.buttonAction
|
|
613
|
+
}
|
|
614
|
+
);
|
|
615
|
+
};
|
|
616
|
+
var renderTableWrapper = (variant, tableRef, className, children, stateContent, tableProps) => {
|
|
617
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
618
|
+
"div",
|
|
619
|
+
{
|
|
620
|
+
className: cn(
|
|
621
|
+
"relative w-full overflow-x-auto",
|
|
622
|
+
variant === "default" && "border border-border-200 rounded-xl"
|
|
623
|
+
),
|
|
624
|
+
children: [
|
|
625
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
626
|
+
"table",
|
|
627
|
+
{
|
|
628
|
+
ref: tableRef,
|
|
629
|
+
className: cn(
|
|
630
|
+
"analytica-table w-full caption-bottom text-sm border-separate border-spacing-0",
|
|
631
|
+
className
|
|
632
|
+
),
|
|
633
|
+
...tableProps,
|
|
634
|
+
children: renderHeaderElements(children)
|
|
635
|
+
}
|
|
636
|
+
),
|
|
637
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "py-8 flex justify-center", children: stateContent })
|
|
638
|
+
]
|
|
639
|
+
}
|
|
640
|
+
);
|
|
641
|
+
};
|
|
642
|
+
var Table = (0, import_react2.forwardRef)(
|
|
377
643
|
({
|
|
378
644
|
variant = "default",
|
|
379
645
|
className,
|
|
380
646
|
children,
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
onEmptyStateButtonClick,
|
|
647
|
+
showLoading = false,
|
|
648
|
+
loadingState,
|
|
649
|
+
showNoSearchResult = false,
|
|
650
|
+
noSearchResultState,
|
|
651
|
+
showEmpty = false,
|
|
652
|
+
emptyState,
|
|
388
653
|
...props
|
|
389
654
|
}, ref) => {
|
|
390
|
-
const
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
});
|
|
402
|
-
return
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
const rowProps = row.props;
|
|
412
|
-
count = import_react.Children.count(rowProps.children);
|
|
413
|
-
}
|
|
414
|
-
});
|
|
415
|
-
}
|
|
416
|
-
});
|
|
417
|
-
return count || 1;
|
|
418
|
-
}, [children]);
|
|
419
|
-
const hasSearchTerm = searchTerm && searchTerm.trim() !== "";
|
|
420
|
-
const showNoSearchResult = hasSearchTerm && isTableBodyEmpty;
|
|
421
|
-
const showEmptyState = !hasSearchTerm && isTableBodyEmpty;
|
|
655
|
+
const defaultNoSearchResultState = {
|
|
656
|
+
title: "Nenhum resultado encontrado",
|
|
657
|
+
description: "N\xE3o encontramos nenhum resultado com esse nome. Tente revisar a busca ou usar outra palavra-chave."
|
|
658
|
+
};
|
|
659
|
+
const defaultEmptyState = {
|
|
660
|
+
title: "Nenhum dado dispon\xEDvel",
|
|
661
|
+
description: "N\xE3o h\xE1 dados para exibir no momento."
|
|
662
|
+
};
|
|
663
|
+
const finalNoSearchResultState = noSearchResultState || defaultNoSearchResultState;
|
|
664
|
+
const finalEmptyState = emptyState || defaultEmptyState;
|
|
665
|
+
if (showLoading) {
|
|
666
|
+
const loadingContent = loadingState?.component || /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SkeletonTable, { rows: 5, columns: 4, showHeader: false });
|
|
667
|
+
return renderTableWrapper(
|
|
668
|
+
variant,
|
|
669
|
+
ref,
|
|
670
|
+
className,
|
|
671
|
+
children,
|
|
672
|
+
loadingContent,
|
|
673
|
+
props
|
|
674
|
+
);
|
|
675
|
+
}
|
|
422
676
|
if (showNoSearchResult) {
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
className: cn(
|
|
436
|
-
"analytica-table w-full caption-bottom text-sm border-separate border-spacing-0",
|
|
437
|
-
className
|
|
438
|
-
),
|
|
439
|
-
...props,
|
|
440
|
-
children: import_react.Children.map(children, (child) => {
|
|
441
|
-
if ((0, import_react.isValidElement)(child) && (child.type === TableCaption || child.type === TableHeader)) {
|
|
442
|
-
return child;
|
|
443
|
-
}
|
|
444
|
-
return null;
|
|
445
|
-
})
|
|
446
|
-
}
|
|
447
|
-
),
|
|
448
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "py-8 flex justify-center", children: noSearchResultImage ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
449
|
-
NoSearchResult_default,
|
|
450
|
-
{
|
|
451
|
-
image: noSearchResultImage,
|
|
452
|
-
title: noSearchResultTitle,
|
|
453
|
-
description: noSearchResultDescription
|
|
454
|
-
}
|
|
455
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "text-center", children: [
|
|
456
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-text-600 text-lg font-semibold mb-2", children: noSearchResultTitle }),
|
|
457
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-text-500 text-sm", children: noSearchResultDescription })
|
|
458
|
-
] }) })
|
|
459
|
-
]
|
|
460
|
-
}
|
|
677
|
+
const noSearchContent = getNoSearchResultContent(
|
|
678
|
+
finalNoSearchResultState,
|
|
679
|
+
defaultNoSearchResultState.title || "",
|
|
680
|
+
defaultNoSearchResultState.description || ""
|
|
681
|
+
);
|
|
682
|
+
return renderTableWrapper(
|
|
683
|
+
variant,
|
|
684
|
+
ref,
|
|
685
|
+
className,
|
|
686
|
+
children,
|
|
687
|
+
noSearchContent,
|
|
688
|
+
props
|
|
461
689
|
);
|
|
462
690
|
}
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
});
|
|
480
|
-
}
|
|
481
|
-
return child;
|
|
482
|
-
});
|
|
483
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
691
|
+
if (showEmpty) {
|
|
692
|
+
const emptyContent = getEmptyStateContent(
|
|
693
|
+
finalEmptyState,
|
|
694
|
+
defaultEmptyState.title || "Nenhum dado dispon\xEDvel",
|
|
695
|
+
defaultEmptyState.description || "N\xE3o h\xE1 dados para exibir no momento."
|
|
696
|
+
);
|
|
697
|
+
return renderTableWrapper(
|
|
698
|
+
variant,
|
|
699
|
+
ref,
|
|
700
|
+
className,
|
|
701
|
+
children,
|
|
702
|
+
emptyContent,
|
|
703
|
+
props
|
|
704
|
+
);
|
|
705
|
+
}
|
|
706
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
484
707
|
"div",
|
|
485
708
|
{
|
|
486
709
|
className: cn(
|
|
487
710
|
"relative w-full overflow-x-auto",
|
|
488
711
|
variant === "default" && "border border-border-200 rounded-xl"
|
|
489
712
|
),
|
|
490
|
-
children: /* @__PURE__ */ (0,
|
|
713
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
491
714
|
"table",
|
|
492
715
|
{
|
|
493
716
|
ref,
|
|
@@ -499,10 +722,10 @@ var Table = (0, import_react.forwardRef)(
|
|
|
499
722
|
),
|
|
500
723
|
...props,
|
|
501
724
|
children: [
|
|
502
|
-
!
|
|
503
|
-
(child) => (0,
|
|
504
|
-
) && /* @__PURE__ */ (0,
|
|
505
|
-
|
|
725
|
+
!import_react2.Children.toArray(children).some(
|
|
726
|
+
(child) => (0, import_react2.isValidElement)(child) && child.type === TableCaption
|
|
727
|
+
) && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("caption", { className: "sr-only", children: "My Table" }),
|
|
728
|
+
children
|
|
506
729
|
]
|
|
507
730
|
}
|
|
508
731
|
)
|
|
@@ -511,7 +734,7 @@ var Table = (0, import_react.forwardRef)(
|
|
|
511
734
|
}
|
|
512
735
|
);
|
|
513
736
|
Table.displayName = "Table";
|
|
514
|
-
var TableHeader = (0,
|
|
737
|
+
var TableHeader = (0, import_react2.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
515
738
|
"thead",
|
|
516
739
|
{
|
|
517
740
|
ref,
|
|
@@ -520,8 +743,8 @@ var TableHeader = (0, import_react.forwardRef)(({ className, ...props }, ref) =>
|
|
|
520
743
|
}
|
|
521
744
|
));
|
|
522
745
|
TableHeader.displayName = "TableHeader";
|
|
523
|
-
var TableBody = (0,
|
|
524
|
-
({ className, variant = "default", ...props }, ref) => /* @__PURE__ */ (0,
|
|
746
|
+
var TableBody = (0, import_react2.forwardRef)(
|
|
747
|
+
({ className, variant = "default", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
525
748
|
"tbody",
|
|
526
749
|
{
|
|
527
750
|
ref,
|
|
@@ -535,8 +758,8 @@ var TableBody = (0, import_react.forwardRef)(
|
|
|
535
758
|
)
|
|
536
759
|
);
|
|
537
760
|
TableBody.displayName = "TableBody";
|
|
538
|
-
var TableFooter = (0,
|
|
539
|
-
({ variant = "default", className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
761
|
+
var TableFooter = (0, import_react2.forwardRef)(
|
|
762
|
+
({ variant = "default", className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
540
763
|
"tfoot",
|
|
541
764
|
{
|
|
542
765
|
ref,
|
|
@@ -572,7 +795,7 @@ var VARIANT_STATES_ROW = {
|
|
|
572
795
|
borderless: "bg-background-50 opacity-50 cursor-not-allowed"
|
|
573
796
|
}
|
|
574
797
|
};
|
|
575
|
-
var TableRow = (0,
|
|
798
|
+
var TableRow = (0, import_react2.forwardRef)(
|
|
576
799
|
({
|
|
577
800
|
variant = "default",
|
|
578
801
|
state = "default",
|
|
@@ -580,7 +803,7 @@ var TableRow = (0, import_react.forwardRef)(
|
|
|
580
803
|
className,
|
|
581
804
|
...props
|
|
582
805
|
}, ref) => {
|
|
583
|
-
return /* @__PURE__ */ (0,
|
|
806
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
584
807
|
"tr",
|
|
585
808
|
{
|
|
586
809
|
ref,
|
|
@@ -598,7 +821,7 @@ var TableRow = (0, import_react.forwardRef)(
|
|
|
598
821
|
}
|
|
599
822
|
);
|
|
600
823
|
TableRow.displayName = "TableRow";
|
|
601
|
-
var TableHead = (0,
|
|
824
|
+
var TableHead = (0, import_react2.forwardRef)(
|
|
602
825
|
({
|
|
603
826
|
className,
|
|
604
827
|
sortable = true,
|
|
@@ -612,7 +835,7 @@ var TableHead = (0, import_react.forwardRef)(
|
|
|
612
835
|
onSort();
|
|
613
836
|
}
|
|
614
837
|
};
|
|
615
|
-
return /* @__PURE__ */ (0,
|
|
838
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
616
839
|
"th",
|
|
617
840
|
{
|
|
618
841
|
ref,
|
|
@@ -623,11 +846,11 @@ var TableHead = (0, import_react.forwardRef)(
|
|
|
623
846
|
),
|
|
624
847
|
onClick: handleClick,
|
|
625
848
|
...props,
|
|
626
|
-
children: /* @__PURE__ */ (0,
|
|
849
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
627
850
|
children,
|
|
628
|
-
sortable && /* @__PURE__ */ (0,
|
|
629
|
-
sortDirection === "asc" && /* @__PURE__ */ (0,
|
|
630
|
-
sortDirection === "desc" && /* @__PURE__ */ (0,
|
|
851
|
+
sortable && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-col", children: [
|
|
852
|
+
sortDirection === "asc" && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_phosphor_react2.CaretUp, { size: 16, weight: "fill", className: "text-text-800" }),
|
|
853
|
+
sortDirection === "desc" && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_phosphor_react2.CaretDown, { size: 16, weight: "fill", className: "text-text-800" })
|
|
631
854
|
] })
|
|
632
855
|
] })
|
|
633
856
|
}
|
|
@@ -635,7 +858,7 @@ var TableHead = (0, import_react.forwardRef)(
|
|
|
635
858
|
}
|
|
636
859
|
);
|
|
637
860
|
TableHead.displayName = "TableHead";
|
|
638
|
-
var TableCell = (0,
|
|
861
|
+
var TableCell = (0, import_react2.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
639
862
|
"td",
|
|
640
863
|
{
|
|
641
864
|
ref,
|
|
@@ -647,7 +870,7 @@ var TableCell = (0, import_react.forwardRef)(({ className, ...props }, ref) => /
|
|
|
647
870
|
}
|
|
648
871
|
));
|
|
649
872
|
TableCell.displayName = "TableCell";
|
|
650
|
-
var TableCaption = (0,
|
|
873
|
+
var TableCaption = (0, import_react2.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
651
874
|
"caption",
|
|
652
875
|
{
|
|
653
876
|
ref,
|