analytica-frontend-lib 1.2.21 → 1.2.22
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 +0 -3
- package/dist/AlertManager/index.css.map +1 -1
- package/dist/AlertManagerView/index.js +347 -159
- package/dist/AlertManagerView/index.js.map +1 -1
- package/dist/AlertManagerView/index.mjs +346 -159
- package/dist/AlertManagerView/index.mjs.map +1 -1
- 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 +328 -140
- package/dist/Table/index.js.map +1 -1
- package/dist/Table/index.mjs +323 -136
- package/dist/Table/index.mjs.map +1 -1
- package/dist/TableProvider/index.css +0 -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 +826 -629
- package/dist/TableProvider/index.js.map +1 -1
- package/dist/TableProvider/index.mjs +737 -541
- package/dist/TableProvider/index.mjs.map +1 -1
- package/dist/{TableProvider-D4Ak7ofz.d.ts → TableProvider-48a6wb7j.d.ts} +43 -4
- package/dist/{TableProvider-CDcL1tDj.d.mts → TableProvider-DyhwEkPT.d.mts} +43 -4
- package/dist/index.css +0 -3
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +643 -598
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +601 -557
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +0 -3
- package/dist/styles.css.map +1 -1
- package/package.json +1 -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,161 @@ var Button = ({
|
|
|
182
182
|
};
|
|
183
183
|
var Button_default = Button;
|
|
184
184
|
|
|
185
|
+
// src/components/Skeleton/Skeleton.tsx
|
|
186
|
+
var import_react = require("react");
|
|
187
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
188
|
+
var SKELETON_ANIMATION_CLASSES = {
|
|
189
|
+
pulse: "animate-pulse",
|
|
190
|
+
none: ""
|
|
191
|
+
};
|
|
192
|
+
var SKELETON_VARIANT_CLASSES = {
|
|
193
|
+
text: "h-4 bg-background-200 rounded",
|
|
194
|
+
circular: "bg-background-200 rounded-full",
|
|
195
|
+
rectangular: "bg-background-200",
|
|
196
|
+
rounded: "bg-background-200 rounded-lg"
|
|
197
|
+
};
|
|
198
|
+
var SPACING_CLASSES = {
|
|
199
|
+
none: "",
|
|
200
|
+
small: "space-y-1",
|
|
201
|
+
medium: "space-y-2",
|
|
202
|
+
large: "space-y-3"
|
|
203
|
+
};
|
|
204
|
+
var Skeleton = (0, import_react.forwardRef)(
|
|
205
|
+
({
|
|
206
|
+
variant = "text",
|
|
207
|
+
width,
|
|
208
|
+
height,
|
|
209
|
+
animation = "pulse",
|
|
210
|
+
lines = 1,
|
|
211
|
+
spacing = "none",
|
|
212
|
+
className = "",
|
|
213
|
+
children,
|
|
214
|
+
...props
|
|
215
|
+
}, ref) => {
|
|
216
|
+
const animationClass = SKELETON_ANIMATION_CLASSES[animation];
|
|
217
|
+
const variantClass = SKELETON_VARIANT_CLASSES[variant];
|
|
218
|
+
const spacingClass = SPACING_CLASSES[spacing];
|
|
219
|
+
const style = {
|
|
220
|
+
width: typeof width === "number" ? `${width}px` : width,
|
|
221
|
+
height: typeof height === "number" ? `${height}px` : height
|
|
222
|
+
};
|
|
223
|
+
if (variant === "text" && lines > 1) {
|
|
224
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
225
|
+
"div",
|
|
226
|
+
{
|
|
227
|
+
ref,
|
|
228
|
+
className: cn("flex flex-col", spacingClass, className),
|
|
229
|
+
...props,
|
|
230
|
+
children: Array.from({ length: lines }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
231
|
+
"div",
|
|
232
|
+
{
|
|
233
|
+
className: cn(variantClass, animationClass),
|
|
234
|
+
style: index === lines - 1 ? { width: "60%" } : void 0
|
|
235
|
+
},
|
|
236
|
+
index
|
|
237
|
+
))
|
|
238
|
+
}
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
242
|
+
"div",
|
|
243
|
+
{
|
|
244
|
+
ref,
|
|
245
|
+
className: cn(variantClass, animationClass, className),
|
|
246
|
+
style,
|
|
247
|
+
...props,
|
|
248
|
+
children
|
|
249
|
+
}
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
);
|
|
253
|
+
var SkeletonText = (0, import_react.forwardRef)(
|
|
254
|
+
(props, ref) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Skeleton, { ref, variant: "text", ...props })
|
|
255
|
+
);
|
|
256
|
+
var SkeletonCircle = (0, import_react.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Skeleton, { ref, variant: "circular", ...props }));
|
|
257
|
+
var SkeletonRectangle = (0, import_react.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Skeleton, { ref, variant: "rectangular", ...props }));
|
|
258
|
+
var SkeletonRounded = (0, import_react.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Skeleton, { ref, variant: "rounded", ...props }));
|
|
259
|
+
var SkeletonCard = (0, import_react.forwardRef)(
|
|
260
|
+
({
|
|
261
|
+
showAvatar = true,
|
|
262
|
+
showTitle = true,
|
|
263
|
+
showDescription = true,
|
|
264
|
+
showActions = true,
|
|
265
|
+
lines = 2,
|
|
266
|
+
className = "",
|
|
267
|
+
...props
|
|
268
|
+
}, ref) => {
|
|
269
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
270
|
+
"div",
|
|
271
|
+
{
|
|
272
|
+
ref,
|
|
273
|
+
className: cn(
|
|
274
|
+
"w-full p-4 bg-background border border-border-200 rounded-lg",
|
|
275
|
+
className
|
|
276
|
+
),
|
|
277
|
+
...props,
|
|
278
|
+
children: [
|
|
279
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex items-start space-x-3", children: [
|
|
280
|
+
showAvatar && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SkeletonCircle, { width: 40, height: 40 }),
|
|
281
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex-1 space-y-2", children: [
|
|
282
|
+
showTitle && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SkeletonText, { width: "60%", height: 20 }),
|
|
283
|
+
showDescription && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SkeletonText, { lines, spacing: "small" })
|
|
284
|
+
] })
|
|
285
|
+
] }),
|
|
286
|
+
showActions && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex justify-end space-x-2 mt-4", children: [
|
|
287
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SkeletonRectangle, { width: 80, height: 32 }),
|
|
288
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SkeletonRectangle, { width: 80, height: 32 })
|
|
289
|
+
] })
|
|
290
|
+
]
|
|
291
|
+
}
|
|
292
|
+
);
|
|
293
|
+
}
|
|
294
|
+
);
|
|
295
|
+
var SkeletonList = (0, import_react.forwardRef)(
|
|
296
|
+
({
|
|
297
|
+
items = 3,
|
|
298
|
+
showAvatar = true,
|
|
299
|
+
showTitle = true,
|
|
300
|
+
showDescription = true,
|
|
301
|
+
lines = 1,
|
|
302
|
+
className = "",
|
|
303
|
+
...props
|
|
304
|
+
}, ref) => {
|
|
305
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { ref, className: cn("space-y-3", className), ...props, children: Array.from({ length: items }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex items-start space-x-3 p-3", children: [
|
|
306
|
+
showAvatar && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SkeletonCircle, { width: 32, height: 32 }),
|
|
307
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex-1 space-y-2", children: [
|
|
308
|
+
showTitle && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SkeletonText, { width: "40%", height: 16 }),
|
|
309
|
+
showDescription && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SkeletonText, { lines, spacing: "small" })
|
|
310
|
+
] })
|
|
311
|
+
] }, index)) });
|
|
312
|
+
}
|
|
313
|
+
);
|
|
314
|
+
var SkeletonTable = (0, import_react.forwardRef)(
|
|
315
|
+
({ rows = 5, columns = 4, showHeader = true, className = "", ...props }, ref) => {
|
|
316
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { ref, className: cn("w-full", className), ...props, children: [
|
|
317
|
+
showHeader && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "flex space-x-2 mb-3", children: Array.from({ length: columns }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
318
|
+
SkeletonText,
|
|
319
|
+
{
|
|
320
|
+
width: `${100 / columns}%`,
|
|
321
|
+
height: 20
|
|
322
|
+
},
|
|
323
|
+
index
|
|
324
|
+
)) }),
|
|
325
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "space-y-2", children: Array.from({ length: rows }, (_, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "flex space-x-2", children: Array.from({ length: columns }, (_2, colIndex) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
326
|
+
SkeletonText,
|
|
327
|
+
{
|
|
328
|
+
width: `${100 / columns}%`,
|
|
329
|
+
height: 16
|
|
330
|
+
},
|
|
331
|
+
colIndex
|
|
332
|
+
)) }, rowIndex)) })
|
|
333
|
+
] });
|
|
334
|
+
}
|
|
335
|
+
);
|
|
336
|
+
|
|
185
337
|
// src/components/Table/TablePagination.tsx
|
|
186
338
|
var import_phosphor_react = require("phosphor-react");
|
|
187
|
-
var
|
|
339
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
188
340
|
var TablePagination = ({
|
|
189
341
|
totalItems,
|
|
190
342
|
currentPage,
|
|
@@ -215,7 +367,7 @@ var TablePagination = ({
|
|
|
215
367
|
};
|
|
216
368
|
const isFirstPage = currentPage === 1;
|
|
217
369
|
const isLastPage = currentPage === totalPages;
|
|
218
|
-
return /* @__PURE__ */ (0,
|
|
370
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
219
371
|
"div",
|
|
220
372
|
{
|
|
221
373
|
className: cn(
|
|
@@ -225,29 +377,29 @@ var TablePagination = ({
|
|
|
225
377
|
),
|
|
226
378
|
...props,
|
|
227
379
|
children: [
|
|
228
|
-
/* @__PURE__ */ (0,
|
|
380
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "font-normal text-xs leading-[14px] text-text-800", children: [
|
|
229
381
|
startItem,
|
|
230
382
|
" de ",
|
|
231
383
|
totalItems,
|
|
232
384
|
" ",
|
|
233
385
|
itemLabel
|
|
234
386
|
] }),
|
|
235
|
-
/* @__PURE__ */ (0,
|
|
236
|
-
onItemsPerPageChange && /* @__PURE__ */ (0,
|
|
237
|
-
/* @__PURE__ */ (0,
|
|
387
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex flex-wrap sm:flex-nowrap items-center gap-2 sm:gap-4 justify-center sm:justify-start", children: [
|
|
388
|
+
onItemsPerPageChange && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "relative", children: [
|
|
389
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
238
390
|
"select",
|
|
239
391
|
{
|
|
240
392
|
value: itemsPerPage,
|
|
241
393
|
onChange: handleItemsPerPageChange,
|
|
242
394
|
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
395
|
"aria-label": "Items por p\xE1gina",
|
|
244
|
-
children: itemsPerPageOptions.map((option) => /* @__PURE__ */ (0,
|
|
396
|
+
children: itemsPerPageOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("option", { value: option, children: [
|
|
245
397
|
option,
|
|
246
398
|
" itens"
|
|
247
399
|
] }, option))
|
|
248
400
|
}
|
|
249
401
|
),
|
|
250
|
-
/* @__PURE__ */ (0,
|
|
402
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
251
403
|
import_phosphor_react.CaretDown,
|
|
252
404
|
{
|
|
253
405
|
size: 14,
|
|
@@ -256,13 +408,13 @@ var TablePagination = ({
|
|
|
256
408
|
}
|
|
257
409
|
)
|
|
258
410
|
] }),
|
|
259
|
-
/* @__PURE__ */ (0,
|
|
411
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "font-normal text-xs leading-[14px] text-text-950", children: [
|
|
260
412
|
"P\xE1gina ",
|
|
261
413
|
currentPage,
|
|
262
414
|
" de ",
|
|
263
415
|
totalPages
|
|
264
416
|
] }),
|
|
265
|
-
/* @__PURE__ */ (0,
|
|
417
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
266
418
|
"button",
|
|
267
419
|
{
|
|
268
420
|
onClick: handlePrevious,
|
|
@@ -273,12 +425,12 @@ var TablePagination = ({
|
|
|
273
425
|
),
|
|
274
426
|
"aria-label": "P\xE1gina anterior",
|
|
275
427
|
children: [
|
|
276
|
-
/* @__PURE__ */ (0,
|
|
277
|
-
/* @__PURE__ */ (0,
|
|
428
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_phosphor_react.CaretLeft, { size: 12, weight: "bold", className: "text-primary-950" }),
|
|
429
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "font-medium text-xs leading-[14px] text-primary-950", children: "Anterior" })
|
|
278
430
|
]
|
|
279
431
|
}
|
|
280
432
|
),
|
|
281
|
-
/* @__PURE__ */ (0,
|
|
433
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
282
434
|
"button",
|
|
283
435
|
{
|
|
284
436
|
onClick: handleNext,
|
|
@@ -289,8 +441,8 @@ var TablePagination = ({
|
|
|
289
441
|
),
|
|
290
442
|
"aria-label": "Pr\xF3xima p\xE1gina",
|
|
291
443
|
children: [
|
|
292
|
-
/* @__PURE__ */ (0,
|
|
293
|
-
/* @__PURE__ */ (0,
|
|
444
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "font-medium text-xs leading-[14px] text-primary-950", children: "Pr\xF3xima" }),
|
|
445
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_phosphor_react.CaretRight, { size: 12, weight: "bold", className: "text-primary-950" })
|
|
294
446
|
]
|
|
295
447
|
}
|
|
296
448
|
)
|
|
@@ -303,7 +455,7 @@ TablePagination.displayName = "TablePagination";
|
|
|
303
455
|
var TablePagination_default = TablePagination;
|
|
304
456
|
|
|
305
457
|
// src/components/Table/Table.tsx
|
|
306
|
-
var
|
|
458
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
307
459
|
function useTableSort(data, options = {}) {
|
|
308
460
|
const { syncWithUrl = false } = options;
|
|
309
461
|
const getInitialState = () => {
|
|
@@ -322,13 +474,13 @@ function useTableSort(data, options = {}) {
|
|
|
322
474
|
return { column: null, direction: null };
|
|
323
475
|
};
|
|
324
476
|
const initialState = getInitialState();
|
|
325
|
-
const [sortColumn, setSortColumn] = (0,
|
|
477
|
+
const [sortColumn, setSortColumn] = (0, import_react2.useState)(
|
|
326
478
|
initialState.column
|
|
327
479
|
);
|
|
328
|
-
const [sortDirection, setSortDirection] = (0,
|
|
480
|
+
const [sortDirection, setSortDirection] = (0, import_react2.useState)(
|
|
329
481
|
initialState.direction
|
|
330
482
|
);
|
|
331
|
-
(0,
|
|
483
|
+
(0, import_react2.useEffect)(() => {
|
|
332
484
|
if (!syncWithUrl || globalThis.window === void 0) return;
|
|
333
485
|
const url = new URL(globalThis.location.href);
|
|
334
486
|
const params = url.searchParams;
|
|
@@ -354,7 +506,7 @@ function useTableSort(data, options = {}) {
|
|
|
354
506
|
setSortDirection("asc");
|
|
355
507
|
}
|
|
356
508
|
};
|
|
357
|
-
const sortedData = (0,
|
|
509
|
+
const sortedData = (0, import_react2.useMemo)(() => {
|
|
358
510
|
if (!sortColumn || !sortDirection) {
|
|
359
511
|
return data;
|
|
360
512
|
}
|
|
@@ -373,121 +525,157 @@ function useTableSort(data, options = {}) {
|
|
|
373
525
|
}, [data, sortColumn, sortDirection]);
|
|
374
526
|
return { sortedData, sortColumn, sortDirection, handleSort };
|
|
375
527
|
}
|
|
376
|
-
var
|
|
528
|
+
var renderHeaderElements = (children) => {
|
|
529
|
+
return import_react2.Children.map(children, (child) => {
|
|
530
|
+
if ((0, import_react2.isValidElement)(child) && (child.type === TableCaption || child.type === TableHeader)) {
|
|
531
|
+
return child;
|
|
532
|
+
}
|
|
533
|
+
return null;
|
|
534
|
+
});
|
|
535
|
+
};
|
|
536
|
+
var getNoSearchResultContent = (config, defaultTitle, defaultDescription) => {
|
|
537
|
+
if (config.component) {
|
|
538
|
+
return config.component;
|
|
539
|
+
}
|
|
540
|
+
if (config.image) {
|
|
541
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
542
|
+
NoSearchResult_default,
|
|
543
|
+
{
|
|
544
|
+
image: config.image,
|
|
545
|
+
title: config.title || defaultTitle,
|
|
546
|
+
description: config.description || defaultDescription
|
|
547
|
+
}
|
|
548
|
+
);
|
|
549
|
+
}
|
|
550
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "text-center", children: [
|
|
551
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "text-text-600 text-lg font-semibold mb-2", children: config.title || defaultTitle }),
|
|
552
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "text-text-500 text-sm", children: config.description || defaultDescription })
|
|
553
|
+
] });
|
|
554
|
+
};
|
|
555
|
+
var getEmptyStateContent = (config, defaultMessage, defaultButtonText, onButtonClick) => {
|
|
556
|
+
if (config?.component) {
|
|
557
|
+
return config.component;
|
|
558
|
+
}
|
|
559
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-col items-center justify-center gap-4", children: [
|
|
560
|
+
config?.image && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
561
|
+
"img",
|
|
562
|
+
{
|
|
563
|
+
src: config.image,
|
|
564
|
+
alt: "Empty state",
|
|
565
|
+
className: "w-auto h-auto max-w-full"
|
|
566
|
+
}
|
|
567
|
+
),
|
|
568
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "text-text-600 text-base font-normal", children: config?.message || defaultMessage }),
|
|
569
|
+
(config?.onButtonClick || onButtonClick) && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
570
|
+
Button_default,
|
|
571
|
+
{
|
|
572
|
+
variant: "solid",
|
|
573
|
+
action: "primary",
|
|
574
|
+
size: "medium",
|
|
575
|
+
onClick: config?.onButtonClick || onButtonClick,
|
|
576
|
+
children: config?.buttonText || defaultButtonText
|
|
577
|
+
}
|
|
578
|
+
)
|
|
579
|
+
] });
|
|
580
|
+
};
|
|
581
|
+
var renderTableWrapper = (variant, tableRef, className, children, stateContent, tableProps) => {
|
|
582
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
583
|
+
"div",
|
|
584
|
+
{
|
|
585
|
+
className: cn(
|
|
586
|
+
"relative w-full overflow-x-auto",
|
|
587
|
+
variant === "default" && "border border-border-200 rounded-xl"
|
|
588
|
+
),
|
|
589
|
+
children: [
|
|
590
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
591
|
+
"table",
|
|
592
|
+
{
|
|
593
|
+
ref: tableRef,
|
|
594
|
+
className: cn(
|
|
595
|
+
"analytica-table w-full caption-bottom text-sm border-separate border-spacing-0",
|
|
596
|
+
className
|
|
597
|
+
),
|
|
598
|
+
...tableProps,
|
|
599
|
+
children: renderHeaderElements(children)
|
|
600
|
+
}
|
|
601
|
+
),
|
|
602
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "py-8 flex justify-center", children: stateContent })
|
|
603
|
+
]
|
|
604
|
+
}
|
|
605
|
+
);
|
|
606
|
+
};
|
|
607
|
+
var Table = (0, import_react2.forwardRef)(
|
|
377
608
|
({
|
|
378
609
|
variant = "default",
|
|
379
610
|
className,
|
|
380
611
|
children,
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
onEmptyStateButtonClick,
|
|
612
|
+
showLoading = false,
|
|
613
|
+
loadingState,
|
|
614
|
+
showNoSearchResult = false,
|
|
615
|
+
noSearchResultState,
|
|
616
|
+
showEmpty = false,
|
|
617
|
+
emptyState,
|
|
388
618
|
...props
|
|
389
619
|
}, 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;
|
|
620
|
+
const defaultNoSearchResultState = {
|
|
621
|
+
title: "Nenhum resultado encontrado",
|
|
622
|
+
description: "N\xE3o encontramos nenhum resultado com esse nome. Tente revisar a busca ou usar outra palavra-chave."
|
|
623
|
+
};
|
|
624
|
+
const defaultEmptyState = {
|
|
625
|
+
message: "Nenhum dado dispon\xEDvel no momento.",
|
|
626
|
+
buttonText: "Adicionar item"
|
|
627
|
+
};
|
|
628
|
+
const finalNoSearchResultState = noSearchResultState || defaultNoSearchResultState;
|
|
629
|
+
const finalEmptyState = emptyState || defaultEmptyState;
|
|
630
|
+
if (showLoading) {
|
|
631
|
+
const loadingContent = loadingState?.component || /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SkeletonTable, { rows: 5, columns: 4, showHeader: false });
|
|
632
|
+
return renderTableWrapper(
|
|
633
|
+
variant,
|
|
634
|
+
ref,
|
|
635
|
+
className,
|
|
636
|
+
children,
|
|
637
|
+
loadingContent,
|
|
638
|
+
props
|
|
639
|
+
);
|
|
640
|
+
}
|
|
422
641
|
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
|
-
}
|
|
642
|
+
const noSearchContent = getNoSearchResultContent(
|
|
643
|
+
finalNoSearchResultState,
|
|
644
|
+
defaultNoSearchResultState.title || "",
|
|
645
|
+
defaultNoSearchResultState.description || ""
|
|
646
|
+
);
|
|
647
|
+
return renderTableWrapper(
|
|
648
|
+
variant,
|
|
649
|
+
ref,
|
|
650
|
+
className,
|
|
651
|
+
children,
|
|
652
|
+
noSearchContent,
|
|
653
|
+
props
|
|
461
654
|
);
|
|
462
655
|
}
|
|
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)(
|
|
656
|
+
if (showEmpty) {
|
|
657
|
+
const emptyContent = getEmptyStateContent(
|
|
658
|
+
finalEmptyState,
|
|
659
|
+
defaultEmptyState.message || "Nenhum dado dispon\xEDvel no momento.",
|
|
660
|
+
defaultEmptyState.buttonText || "Adicionar item"
|
|
661
|
+
);
|
|
662
|
+
return renderTableWrapper(
|
|
663
|
+
variant,
|
|
664
|
+
ref,
|
|
665
|
+
className,
|
|
666
|
+
children,
|
|
667
|
+
emptyContent,
|
|
668
|
+
props
|
|
669
|
+
);
|
|
670
|
+
}
|
|
671
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
484
672
|
"div",
|
|
485
673
|
{
|
|
486
674
|
className: cn(
|
|
487
675
|
"relative w-full overflow-x-auto",
|
|
488
676
|
variant === "default" && "border border-border-200 rounded-xl"
|
|
489
677
|
),
|
|
490
|
-
children: /* @__PURE__ */ (0,
|
|
678
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
491
679
|
"table",
|
|
492
680
|
{
|
|
493
681
|
ref,
|
|
@@ -499,10 +687,10 @@ var Table = (0, import_react.forwardRef)(
|
|
|
499
687
|
),
|
|
500
688
|
...props,
|
|
501
689
|
children: [
|
|
502
|
-
!
|
|
503
|
-
(child) => (0,
|
|
504
|
-
) && /* @__PURE__ */ (0,
|
|
505
|
-
|
|
690
|
+
!import_react2.Children.toArray(children).some(
|
|
691
|
+
(child) => (0, import_react2.isValidElement)(child) && child.type === TableCaption
|
|
692
|
+
) && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("caption", { className: "sr-only", children: "My Table" }),
|
|
693
|
+
children
|
|
506
694
|
]
|
|
507
695
|
}
|
|
508
696
|
)
|
|
@@ -511,7 +699,7 @@ var Table = (0, import_react.forwardRef)(
|
|
|
511
699
|
}
|
|
512
700
|
);
|
|
513
701
|
Table.displayName = "Table";
|
|
514
|
-
var TableHeader = (0,
|
|
702
|
+
var TableHeader = (0, import_react2.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
515
703
|
"thead",
|
|
516
704
|
{
|
|
517
705
|
ref,
|
|
@@ -520,8 +708,8 @@ var TableHeader = (0, import_react.forwardRef)(({ className, ...props }, ref) =>
|
|
|
520
708
|
}
|
|
521
709
|
));
|
|
522
710
|
TableHeader.displayName = "TableHeader";
|
|
523
|
-
var TableBody = (0,
|
|
524
|
-
({ className, variant = "default", ...props }, ref) => /* @__PURE__ */ (0,
|
|
711
|
+
var TableBody = (0, import_react2.forwardRef)(
|
|
712
|
+
({ className, variant = "default", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
525
713
|
"tbody",
|
|
526
714
|
{
|
|
527
715
|
ref,
|
|
@@ -535,8 +723,8 @@ var TableBody = (0, import_react.forwardRef)(
|
|
|
535
723
|
)
|
|
536
724
|
);
|
|
537
725
|
TableBody.displayName = "TableBody";
|
|
538
|
-
var TableFooter = (0,
|
|
539
|
-
({ variant = "default", className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
726
|
+
var TableFooter = (0, import_react2.forwardRef)(
|
|
727
|
+
({ variant = "default", className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
540
728
|
"tfoot",
|
|
541
729
|
{
|
|
542
730
|
ref,
|
|
@@ -572,7 +760,7 @@ var VARIANT_STATES_ROW = {
|
|
|
572
760
|
borderless: "bg-background-50 opacity-50 cursor-not-allowed"
|
|
573
761
|
}
|
|
574
762
|
};
|
|
575
|
-
var TableRow = (0,
|
|
763
|
+
var TableRow = (0, import_react2.forwardRef)(
|
|
576
764
|
({
|
|
577
765
|
variant = "default",
|
|
578
766
|
state = "default",
|
|
@@ -580,7 +768,7 @@ var TableRow = (0, import_react.forwardRef)(
|
|
|
580
768
|
className,
|
|
581
769
|
...props
|
|
582
770
|
}, ref) => {
|
|
583
|
-
return /* @__PURE__ */ (0,
|
|
771
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
584
772
|
"tr",
|
|
585
773
|
{
|
|
586
774
|
ref,
|
|
@@ -598,7 +786,7 @@ var TableRow = (0, import_react.forwardRef)(
|
|
|
598
786
|
}
|
|
599
787
|
);
|
|
600
788
|
TableRow.displayName = "TableRow";
|
|
601
|
-
var TableHead = (0,
|
|
789
|
+
var TableHead = (0, import_react2.forwardRef)(
|
|
602
790
|
({
|
|
603
791
|
className,
|
|
604
792
|
sortable = true,
|
|
@@ -612,7 +800,7 @@ var TableHead = (0, import_react.forwardRef)(
|
|
|
612
800
|
onSort();
|
|
613
801
|
}
|
|
614
802
|
};
|
|
615
|
-
return /* @__PURE__ */ (0,
|
|
803
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
616
804
|
"th",
|
|
617
805
|
{
|
|
618
806
|
ref,
|
|
@@ -623,11 +811,11 @@ var TableHead = (0, import_react.forwardRef)(
|
|
|
623
811
|
),
|
|
624
812
|
onClick: handleClick,
|
|
625
813
|
...props,
|
|
626
|
-
children: /* @__PURE__ */ (0,
|
|
814
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
627
815
|
children,
|
|
628
|
-
sortable && /* @__PURE__ */ (0,
|
|
629
|
-
sortDirection === "asc" && /* @__PURE__ */ (0,
|
|
630
|
-
sortDirection === "desc" && /* @__PURE__ */ (0,
|
|
816
|
+
sortable && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-col", children: [
|
|
817
|
+
sortDirection === "asc" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_phosphor_react2.CaretUp, { size: 16, weight: "fill", className: "text-text-800" }),
|
|
818
|
+
sortDirection === "desc" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_phosphor_react2.CaretDown, { size: 16, weight: "fill", className: "text-text-800" })
|
|
631
819
|
] })
|
|
632
820
|
] })
|
|
633
821
|
}
|
|
@@ -635,7 +823,7 @@ var TableHead = (0, import_react.forwardRef)(
|
|
|
635
823
|
}
|
|
636
824
|
);
|
|
637
825
|
TableHead.displayName = "TableHead";
|
|
638
|
-
var TableCell = (0,
|
|
826
|
+
var TableCell = (0, import_react2.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
639
827
|
"td",
|
|
640
828
|
{
|
|
641
829
|
ref,
|
|
@@ -647,7 +835,7 @@ var TableCell = (0, import_react.forwardRef)(({ className, ...props }, ref) => /
|
|
|
647
835
|
}
|
|
648
836
|
));
|
|
649
837
|
TableCell.displayName = "TableCell";
|
|
650
|
-
var TableCaption = (0,
|
|
838
|
+
var TableCaption = (0, import_react2.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
651
839
|
"caption",
|
|
652
840
|
{
|
|
653
841
|
ref,
|