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.mjs
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
// src/components/Table/Table.tsx
|
|
2
2
|
import {
|
|
3
|
-
forwardRef,
|
|
3
|
+
forwardRef as forwardRef2,
|
|
4
4
|
useState,
|
|
5
5
|
useMemo,
|
|
6
6
|
useEffect,
|
|
7
7
|
Children,
|
|
8
|
-
isValidElement
|
|
9
|
-
cloneElement
|
|
8
|
+
isValidElement
|
|
10
9
|
} from "react";
|
|
11
10
|
|
|
12
11
|
// src/utils/utils.ts
|
|
@@ -157,9 +156,204 @@ var Button = ({
|
|
|
157
156
|
};
|
|
158
157
|
var Button_default = Button;
|
|
159
158
|
|
|
159
|
+
// src/components/EmptyState/EmptyState.tsx
|
|
160
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
161
|
+
var EmptyState = ({
|
|
162
|
+
image,
|
|
163
|
+
title,
|
|
164
|
+
description,
|
|
165
|
+
buttonText,
|
|
166
|
+
buttonIcon,
|
|
167
|
+
onButtonClick,
|
|
168
|
+
buttonVariant = "solid",
|
|
169
|
+
buttonAction = "primary"
|
|
170
|
+
}) => {
|
|
171
|
+
const displayTitle = title || "Nenhum dado dispon\xEDvel";
|
|
172
|
+
const displayDescription = description || "N\xE3o h\xE1 dados para exibir no momento.";
|
|
173
|
+
return /* @__PURE__ */ jsxs3("div", { className: "flex flex-col justify-center items-center gap-6 w-full min-h-[705px] bg-background rounded-xl p-6", children: [
|
|
174
|
+
image && /* @__PURE__ */ jsx4("img", { src: image, alt: displayTitle, className: "w-[170px] h-[150px]" }),
|
|
175
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex flex-col items-center gap-4 w-full max-w-[600px] px-6", children: [
|
|
176
|
+
/* @__PURE__ */ jsx4(
|
|
177
|
+
Text_default,
|
|
178
|
+
{
|
|
179
|
+
as: "h2",
|
|
180
|
+
className: "text-text-950 font-semibold text-3xl leading-[35px] text-center",
|
|
181
|
+
children: displayTitle
|
|
182
|
+
}
|
|
183
|
+
),
|
|
184
|
+
/* @__PURE__ */ jsx4(Text_default, { className: "text-text-600 font-normal text-[18px] leading-[27px] text-center", children: displayDescription })
|
|
185
|
+
] }),
|
|
186
|
+
buttonText && onButtonClick && /* @__PURE__ */ jsx4(
|
|
187
|
+
Button_default,
|
|
188
|
+
{
|
|
189
|
+
variant: buttonVariant,
|
|
190
|
+
action: buttonAction,
|
|
191
|
+
size: "large",
|
|
192
|
+
onClick: onButtonClick,
|
|
193
|
+
iconLeft: buttonIcon,
|
|
194
|
+
className: "rounded-full px-5 py-2.5",
|
|
195
|
+
children: buttonText
|
|
196
|
+
}
|
|
197
|
+
)
|
|
198
|
+
] });
|
|
199
|
+
};
|
|
200
|
+
var EmptyState_default = EmptyState;
|
|
201
|
+
|
|
202
|
+
// src/components/Skeleton/Skeleton.tsx
|
|
203
|
+
import { forwardRef } from "react";
|
|
204
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
205
|
+
var SKELETON_ANIMATION_CLASSES = {
|
|
206
|
+
pulse: "animate-pulse",
|
|
207
|
+
none: ""
|
|
208
|
+
};
|
|
209
|
+
var SKELETON_VARIANT_CLASSES = {
|
|
210
|
+
text: "h-4 bg-background-200 rounded",
|
|
211
|
+
circular: "bg-background-200 rounded-full",
|
|
212
|
+
rectangular: "bg-background-200",
|
|
213
|
+
rounded: "bg-background-200 rounded-lg"
|
|
214
|
+
};
|
|
215
|
+
var SPACING_CLASSES = {
|
|
216
|
+
none: "",
|
|
217
|
+
small: "space-y-1",
|
|
218
|
+
medium: "space-y-2",
|
|
219
|
+
large: "space-y-3"
|
|
220
|
+
};
|
|
221
|
+
var Skeleton = forwardRef(
|
|
222
|
+
({
|
|
223
|
+
variant = "text",
|
|
224
|
+
width,
|
|
225
|
+
height,
|
|
226
|
+
animation = "pulse",
|
|
227
|
+
lines = 1,
|
|
228
|
+
spacing = "none",
|
|
229
|
+
className = "",
|
|
230
|
+
children,
|
|
231
|
+
...props
|
|
232
|
+
}, ref) => {
|
|
233
|
+
const animationClass = SKELETON_ANIMATION_CLASSES[animation];
|
|
234
|
+
const variantClass = SKELETON_VARIANT_CLASSES[variant];
|
|
235
|
+
const spacingClass = SPACING_CLASSES[spacing];
|
|
236
|
+
const style = {
|
|
237
|
+
width: typeof width === "number" ? `${width}px` : width,
|
|
238
|
+
height: typeof height === "number" ? `${height}px` : height
|
|
239
|
+
};
|
|
240
|
+
if (variant === "text" && lines > 1) {
|
|
241
|
+
return /* @__PURE__ */ jsx5(
|
|
242
|
+
"div",
|
|
243
|
+
{
|
|
244
|
+
ref,
|
|
245
|
+
className: cn("flex flex-col", spacingClass, className),
|
|
246
|
+
...props,
|
|
247
|
+
children: Array.from({ length: lines }, (_, index) => /* @__PURE__ */ jsx5(
|
|
248
|
+
"div",
|
|
249
|
+
{
|
|
250
|
+
className: cn(variantClass, animationClass),
|
|
251
|
+
style: index === lines - 1 ? { width: "60%" } : void 0
|
|
252
|
+
},
|
|
253
|
+
index
|
|
254
|
+
))
|
|
255
|
+
}
|
|
256
|
+
);
|
|
257
|
+
}
|
|
258
|
+
return /* @__PURE__ */ jsx5(
|
|
259
|
+
"div",
|
|
260
|
+
{
|
|
261
|
+
ref,
|
|
262
|
+
className: cn(variantClass, animationClass, className),
|
|
263
|
+
style,
|
|
264
|
+
...props,
|
|
265
|
+
children
|
|
266
|
+
}
|
|
267
|
+
);
|
|
268
|
+
}
|
|
269
|
+
);
|
|
270
|
+
var SkeletonText = forwardRef(
|
|
271
|
+
(props, ref) => /* @__PURE__ */ jsx5(Skeleton, { ref, variant: "text", ...props })
|
|
272
|
+
);
|
|
273
|
+
var SkeletonCircle = forwardRef((props, ref) => /* @__PURE__ */ jsx5(Skeleton, { ref, variant: "circular", ...props }));
|
|
274
|
+
var SkeletonRectangle = forwardRef((props, ref) => /* @__PURE__ */ jsx5(Skeleton, { ref, variant: "rectangular", ...props }));
|
|
275
|
+
var SkeletonRounded = forwardRef((props, ref) => /* @__PURE__ */ jsx5(Skeleton, { ref, variant: "rounded", ...props }));
|
|
276
|
+
var SkeletonCard = forwardRef(
|
|
277
|
+
({
|
|
278
|
+
showAvatar = true,
|
|
279
|
+
showTitle = true,
|
|
280
|
+
showDescription = true,
|
|
281
|
+
showActions = true,
|
|
282
|
+
lines = 2,
|
|
283
|
+
className = "",
|
|
284
|
+
...props
|
|
285
|
+
}, ref) => {
|
|
286
|
+
return /* @__PURE__ */ jsxs4(
|
|
287
|
+
"div",
|
|
288
|
+
{
|
|
289
|
+
ref,
|
|
290
|
+
className: cn(
|
|
291
|
+
"w-full p-4 bg-background border border-border-200 rounded-lg",
|
|
292
|
+
className
|
|
293
|
+
),
|
|
294
|
+
...props,
|
|
295
|
+
children: [
|
|
296
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-start space-x-3", children: [
|
|
297
|
+
showAvatar && /* @__PURE__ */ jsx5(SkeletonCircle, { width: 40, height: 40 }),
|
|
298
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex-1 space-y-2", children: [
|
|
299
|
+
showTitle && /* @__PURE__ */ jsx5(SkeletonText, { width: "60%", height: 20 }),
|
|
300
|
+
showDescription && /* @__PURE__ */ jsx5(SkeletonText, { lines, spacing: "small" })
|
|
301
|
+
] })
|
|
302
|
+
] }),
|
|
303
|
+
showActions && /* @__PURE__ */ jsxs4("div", { className: "flex justify-end space-x-2 mt-4", children: [
|
|
304
|
+
/* @__PURE__ */ jsx5(SkeletonRectangle, { width: 80, height: 32 }),
|
|
305
|
+
/* @__PURE__ */ jsx5(SkeletonRectangle, { width: 80, height: 32 })
|
|
306
|
+
] })
|
|
307
|
+
]
|
|
308
|
+
}
|
|
309
|
+
);
|
|
310
|
+
}
|
|
311
|
+
);
|
|
312
|
+
var SkeletonList = forwardRef(
|
|
313
|
+
({
|
|
314
|
+
items = 3,
|
|
315
|
+
showAvatar = true,
|
|
316
|
+
showTitle = true,
|
|
317
|
+
showDescription = true,
|
|
318
|
+
lines = 1,
|
|
319
|
+
className = "",
|
|
320
|
+
...props
|
|
321
|
+
}, ref) => {
|
|
322
|
+
return /* @__PURE__ */ jsx5("div", { ref, className: cn("space-y-3", className), ...props, children: Array.from({ length: items }, (_, index) => /* @__PURE__ */ jsxs4("div", { className: "flex items-start space-x-3 p-3", children: [
|
|
323
|
+
showAvatar && /* @__PURE__ */ jsx5(SkeletonCircle, { width: 32, height: 32 }),
|
|
324
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex-1 space-y-2", children: [
|
|
325
|
+
showTitle && /* @__PURE__ */ jsx5(SkeletonText, { width: "40%", height: 16 }),
|
|
326
|
+
showDescription && /* @__PURE__ */ jsx5(SkeletonText, { lines, spacing: "small" })
|
|
327
|
+
] })
|
|
328
|
+
] }, index)) });
|
|
329
|
+
}
|
|
330
|
+
);
|
|
331
|
+
var SkeletonTable = forwardRef(
|
|
332
|
+
({ rows = 5, columns = 4, showHeader = true, className = "", ...props }, ref) => {
|
|
333
|
+
return /* @__PURE__ */ jsxs4("div", { ref, className: cn("w-full", className), ...props, children: [
|
|
334
|
+
showHeader && /* @__PURE__ */ jsx5("div", { className: "flex space-x-2 mb-3", children: Array.from({ length: columns }, (_, index) => /* @__PURE__ */ jsx5(
|
|
335
|
+
SkeletonText,
|
|
336
|
+
{
|
|
337
|
+
width: `${100 / columns}%`,
|
|
338
|
+
height: 20
|
|
339
|
+
},
|
|
340
|
+
index
|
|
341
|
+
)) }),
|
|
342
|
+
/* @__PURE__ */ jsx5("div", { className: "space-y-2", children: Array.from({ length: rows }, (_, rowIndex) => /* @__PURE__ */ jsx5("div", { className: "flex space-x-2", children: Array.from({ length: columns }, (_2, colIndex) => /* @__PURE__ */ jsx5(
|
|
343
|
+
SkeletonText,
|
|
344
|
+
{
|
|
345
|
+
width: `${100 / columns}%`,
|
|
346
|
+
height: 16
|
|
347
|
+
},
|
|
348
|
+
colIndex
|
|
349
|
+
)) }, rowIndex)) })
|
|
350
|
+
] });
|
|
351
|
+
}
|
|
352
|
+
);
|
|
353
|
+
|
|
160
354
|
// src/components/Table/TablePagination.tsx
|
|
161
355
|
import { CaretLeft, CaretRight, CaretDown } from "phosphor-react";
|
|
162
|
-
import { jsx as
|
|
356
|
+
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
163
357
|
var TablePagination = ({
|
|
164
358
|
totalItems,
|
|
165
359
|
currentPage,
|
|
@@ -190,7 +384,7 @@ var TablePagination = ({
|
|
|
190
384
|
};
|
|
191
385
|
const isFirstPage = currentPage === 1;
|
|
192
386
|
const isLastPage = currentPage === totalPages;
|
|
193
|
-
return /* @__PURE__ */
|
|
387
|
+
return /* @__PURE__ */ jsxs5(
|
|
194
388
|
"div",
|
|
195
389
|
{
|
|
196
390
|
className: cn(
|
|
@@ -200,29 +394,29 @@ var TablePagination = ({
|
|
|
200
394
|
),
|
|
201
395
|
...props,
|
|
202
396
|
children: [
|
|
203
|
-
/* @__PURE__ */
|
|
397
|
+
/* @__PURE__ */ jsxs5("span", { className: "font-normal text-xs leading-[14px] text-text-800", children: [
|
|
204
398
|
startItem,
|
|
205
399
|
" de ",
|
|
206
400
|
totalItems,
|
|
207
401
|
" ",
|
|
208
402
|
itemLabel
|
|
209
403
|
] }),
|
|
210
|
-
/* @__PURE__ */
|
|
211
|
-
onItemsPerPageChange && /* @__PURE__ */
|
|
212
|
-
/* @__PURE__ */
|
|
404
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex flex-wrap sm:flex-nowrap items-center gap-2 sm:gap-4 justify-center sm:justify-start", children: [
|
|
405
|
+
onItemsPerPageChange && /* @__PURE__ */ jsxs5("div", { className: "relative", children: [
|
|
406
|
+
/* @__PURE__ */ jsx6(
|
|
213
407
|
"select",
|
|
214
408
|
{
|
|
215
409
|
value: itemsPerPage,
|
|
216
410
|
onChange: handleItemsPerPageChange,
|
|
217
411
|
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",
|
|
218
412
|
"aria-label": "Items por p\xE1gina",
|
|
219
|
-
children: itemsPerPageOptions.map((option) => /* @__PURE__ */
|
|
413
|
+
children: itemsPerPageOptions.map((option) => /* @__PURE__ */ jsxs5("option", { value: option, children: [
|
|
220
414
|
option,
|
|
221
415
|
" itens"
|
|
222
416
|
] }, option))
|
|
223
417
|
}
|
|
224
418
|
),
|
|
225
|
-
/* @__PURE__ */
|
|
419
|
+
/* @__PURE__ */ jsx6(
|
|
226
420
|
CaretDown,
|
|
227
421
|
{
|
|
228
422
|
size: 14,
|
|
@@ -231,13 +425,13 @@ var TablePagination = ({
|
|
|
231
425
|
}
|
|
232
426
|
)
|
|
233
427
|
] }),
|
|
234
|
-
/* @__PURE__ */
|
|
428
|
+
/* @__PURE__ */ jsxs5("span", { className: "font-normal text-xs leading-[14px] text-text-950", children: [
|
|
235
429
|
"P\xE1gina ",
|
|
236
430
|
currentPage,
|
|
237
431
|
" de ",
|
|
238
432
|
totalPages
|
|
239
433
|
] }),
|
|
240
|
-
/* @__PURE__ */
|
|
434
|
+
/* @__PURE__ */ jsxs5(
|
|
241
435
|
"button",
|
|
242
436
|
{
|
|
243
437
|
onClick: handlePrevious,
|
|
@@ -248,12 +442,12 @@ var TablePagination = ({
|
|
|
248
442
|
),
|
|
249
443
|
"aria-label": "P\xE1gina anterior",
|
|
250
444
|
children: [
|
|
251
|
-
/* @__PURE__ */
|
|
252
|
-
/* @__PURE__ */
|
|
445
|
+
/* @__PURE__ */ jsx6(CaretLeft, { size: 12, weight: "bold", className: "text-primary-950" }),
|
|
446
|
+
/* @__PURE__ */ jsx6("span", { className: "font-medium text-xs leading-[14px] text-primary-950", children: "Anterior" })
|
|
253
447
|
]
|
|
254
448
|
}
|
|
255
449
|
),
|
|
256
|
-
/* @__PURE__ */
|
|
450
|
+
/* @__PURE__ */ jsxs5(
|
|
257
451
|
"button",
|
|
258
452
|
{
|
|
259
453
|
onClick: handleNext,
|
|
@@ -264,8 +458,8 @@ var TablePagination = ({
|
|
|
264
458
|
),
|
|
265
459
|
"aria-label": "Pr\xF3xima p\xE1gina",
|
|
266
460
|
children: [
|
|
267
|
-
/* @__PURE__ */
|
|
268
|
-
/* @__PURE__ */
|
|
461
|
+
/* @__PURE__ */ jsx6("span", { className: "font-medium text-xs leading-[14px] text-primary-950", children: "Pr\xF3xima" }),
|
|
462
|
+
/* @__PURE__ */ jsx6(CaretRight, { size: 12, weight: "bold", className: "text-primary-950" })
|
|
269
463
|
]
|
|
270
464
|
}
|
|
271
465
|
)
|
|
@@ -278,7 +472,7 @@ TablePagination.displayName = "TablePagination";
|
|
|
278
472
|
var TablePagination_default = TablePagination;
|
|
279
473
|
|
|
280
474
|
// src/components/Table/Table.tsx
|
|
281
|
-
import { jsx as
|
|
475
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
282
476
|
function useTableSort(data, options = {}) {
|
|
283
477
|
const { syncWithUrl = false } = options;
|
|
284
478
|
const getInitialState = () => {
|
|
@@ -348,121 +542,149 @@ function useTableSort(data, options = {}) {
|
|
|
348
542
|
}, [data, sortColumn, sortDirection]);
|
|
349
543
|
return { sortedData, sortColumn, sortDirection, handleSort };
|
|
350
544
|
}
|
|
351
|
-
var
|
|
545
|
+
var renderHeaderElements = (children) => {
|
|
546
|
+
return Children.map(children, (child) => {
|
|
547
|
+
if (isValidElement(child) && (child.type === TableCaption || child.type === TableHeader)) {
|
|
548
|
+
return child;
|
|
549
|
+
}
|
|
550
|
+
return null;
|
|
551
|
+
});
|
|
552
|
+
};
|
|
553
|
+
var getNoSearchResultContent = (config, defaultTitle, defaultDescription) => {
|
|
554
|
+
if (config.component) {
|
|
555
|
+
return config.component;
|
|
556
|
+
}
|
|
557
|
+
if (config.image) {
|
|
558
|
+
return /* @__PURE__ */ jsx7(
|
|
559
|
+
NoSearchResult_default,
|
|
560
|
+
{
|
|
561
|
+
image: config.image,
|
|
562
|
+
title: config.title || defaultTitle,
|
|
563
|
+
description: config.description || defaultDescription
|
|
564
|
+
}
|
|
565
|
+
);
|
|
566
|
+
}
|
|
567
|
+
return /* @__PURE__ */ jsxs6("div", { className: "text-center", children: [
|
|
568
|
+
/* @__PURE__ */ jsx7("p", { className: "text-text-600 text-lg font-semibold mb-2", children: config.title || defaultTitle }),
|
|
569
|
+
/* @__PURE__ */ jsx7("p", { className: "text-text-500 text-sm", children: config.description || defaultDescription })
|
|
570
|
+
] });
|
|
571
|
+
};
|
|
572
|
+
var getEmptyStateContent = (config, defaultTitle, defaultDescription) => {
|
|
573
|
+
if (config?.component) {
|
|
574
|
+
return config.component;
|
|
575
|
+
}
|
|
576
|
+
return /* @__PURE__ */ jsx7(
|
|
577
|
+
EmptyState_default,
|
|
578
|
+
{
|
|
579
|
+
image: config?.image,
|
|
580
|
+
title: config?.title || defaultTitle,
|
|
581
|
+
description: config?.description || defaultDescription,
|
|
582
|
+
buttonText: config?.buttonText,
|
|
583
|
+
buttonIcon: config?.buttonIcon,
|
|
584
|
+
onButtonClick: config?.onButtonClick,
|
|
585
|
+
buttonVariant: config?.buttonVariant,
|
|
586
|
+
buttonAction: config?.buttonAction
|
|
587
|
+
}
|
|
588
|
+
);
|
|
589
|
+
};
|
|
590
|
+
var renderTableWrapper = (variant, tableRef, className, children, stateContent, tableProps) => {
|
|
591
|
+
return /* @__PURE__ */ jsxs6(
|
|
592
|
+
"div",
|
|
593
|
+
{
|
|
594
|
+
className: cn(
|
|
595
|
+
"relative w-full overflow-x-auto",
|
|
596
|
+
variant === "default" && "border border-border-200 rounded-xl"
|
|
597
|
+
),
|
|
598
|
+
children: [
|
|
599
|
+
/* @__PURE__ */ jsx7(
|
|
600
|
+
"table",
|
|
601
|
+
{
|
|
602
|
+
ref: tableRef,
|
|
603
|
+
className: cn(
|
|
604
|
+
"analytica-table w-full caption-bottom text-sm border-separate border-spacing-0",
|
|
605
|
+
className
|
|
606
|
+
),
|
|
607
|
+
...tableProps,
|
|
608
|
+
children: renderHeaderElements(children)
|
|
609
|
+
}
|
|
610
|
+
),
|
|
611
|
+
/* @__PURE__ */ jsx7("div", { className: "py-8 flex justify-center", children: stateContent })
|
|
612
|
+
]
|
|
613
|
+
}
|
|
614
|
+
);
|
|
615
|
+
};
|
|
616
|
+
var Table = forwardRef2(
|
|
352
617
|
({
|
|
353
618
|
variant = "default",
|
|
354
619
|
className,
|
|
355
620
|
children,
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
onEmptyStateButtonClick,
|
|
621
|
+
showLoading = false,
|
|
622
|
+
loadingState,
|
|
623
|
+
showNoSearchResult = false,
|
|
624
|
+
noSearchResultState,
|
|
625
|
+
showEmpty = false,
|
|
626
|
+
emptyState,
|
|
363
627
|
...props
|
|
364
628
|
}, ref) => {
|
|
365
|
-
const
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
});
|
|
377
|
-
return
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
const rowProps = row.props;
|
|
387
|
-
count = Children.count(rowProps.children);
|
|
388
|
-
}
|
|
389
|
-
});
|
|
390
|
-
}
|
|
391
|
-
});
|
|
392
|
-
return count || 1;
|
|
393
|
-
}, [children]);
|
|
394
|
-
const hasSearchTerm = searchTerm && searchTerm.trim() !== "";
|
|
395
|
-
const showNoSearchResult = hasSearchTerm && isTableBodyEmpty;
|
|
396
|
-
const showEmptyState = !hasSearchTerm && isTableBodyEmpty;
|
|
629
|
+
const defaultNoSearchResultState = {
|
|
630
|
+
title: "Nenhum resultado encontrado",
|
|
631
|
+
description: "N\xE3o encontramos nenhum resultado com esse nome. Tente revisar a busca ou usar outra palavra-chave."
|
|
632
|
+
};
|
|
633
|
+
const defaultEmptyState = {
|
|
634
|
+
title: "Nenhum dado dispon\xEDvel",
|
|
635
|
+
description: "N\xE3o h\xE1 dados para exibir no momento."
|
|
636
|
+
};
|
|
637
|
+
const finalNoSearchResultState = noSearchResultState || defaultNoSearchResultState;
|
|
638
|
+
const finalEmptyState = emptyState || defaultEmptyState;
|
|
639
|
+
if (showLoading) {
|
|
640
|
+
const loadingContent = loadingState?.component || /* @__PURE__ */ jsx7(SkeletonTable, { rows: 5, columns: 4, showHeader: false });
|
|
641
|
+
return renderTableWrapper(
|
|
642
|
+
variant,
|
|
643
|
+
ref,
|
|
644
|
+
className,
|
|
645
|
+
children,
|
|
646
|
+
loadingContent,
|
|
647
|
+
props
|
|
648
|
+
);
|
|
649
|
+
}
|
|
397
650
|
if (showNoSearchResult) {
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
className: cn(
|
|
411
|
-
"analytica-table w-full caption-bottom text-sm border-separate border-spacing-0",
|
|
412
|
-
className
|
|
413
|
-
),
|
|
414
|
-
...props,
|
|
415
|
-
children: Children.map(children, (child) => {
|
|
416
|
-
if (isValidElement(child) && (child.type === TableCaption || child.type === TableHeader)) {
|
|
417
|
-
return child;
|
|
418
|
-
}
|
|
419
|
-
return null;
|
|
420
|
-
})
|
|
421
|
-
}
|
|
422
|
-
),
|
|
423
|
-
/* @__PURE__ */ jsx5("div", { className: "py-8 flex justify-center", children: noSearchResultImage ? /* @__PURE__ */ jsx5(
|
|
424
|
-
NoSearchResult_default,
|
|
425
|
-
{
|
|
426
|
-
image: noSearchResultImage,
|
|
427
|
-
title: noSearchResultTitle,
|
|
428
|
-
description: noSearchResultDescription
|
|
429
|
-
}
|
|
430
|
-
) : /* @__PURE__ */ jsxs4("div", { className: "text-center", children: [
|
|
431
|
-
/* @__PURE__ */ jsx5("p", { className: "text-text-600 text-lg font-semibold mb-2", children: noSearchResultTitle }),
|
|
432
|
-
/* @__PURE__ */ jsx5("p", { className: "text-text-500 text-sm", children: noSearchResultDescription })
|
|
433
|
-
] }) })
|
|
434
|
-
]
|
|
435
|
-
}
|
|
651
|
+
const noSearchContent = getNoSearchResultContent(
|
|
652
|
+
finalNoSearchResultState,
|
|
653
|
+
defaultNoSearchResultState.title || "",
|
|
654
|
+
defaultNoSearchResultState.description || ""
|
|
655
|
+
);
|
|
656
|
+
return renderTableWrapper(
|
|
657
|
+
variant,
|
|
658
|
+
ref,
|
|
659
|
+
className,
|
|
660
|
+
children,
|
|
661
|
+
noSearchContent,
|
|
662
|
+
props
|
|
436
663
|
);
|
|
437
664
|
}
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
});
|
|
455
|
-
}
|
|
456
|
-
return child;
|
|
457
|
-
});
|
|
458
|
-
return /* @__PURE__ */ jsx5(
|
|
665
|
+
if (showEmpty) {
|
|
666
|
+
const emptyContent = getEmptyStateContent(
|
|
667
|
+
finalEmptyState,
|
|
668
|
+
defaultEmptyState.title || "Nenhum dado dispon\xEDvel",
|
|
669
|
+
defaultEmptyState.description || "N\xE3o h\xE1 dados para exibir no momento."
|
|
670
|
+
);
|
|
671
|
+
return renderTableWrapper(
|
|
672
|
+
variant,
|
|
673
|
+
ref,
|
|
674
|
+
className,
|
|
675
|
+
children,
|
|
676
|
+
emptyContent,
|
|
677
|
+
props
|
|
678
|
+
);
|
|
679
|
+
}
|
|
680
|
+
return /* @__PURE__ */ jsx7(
|
|
459
681
|
"div",
|
|
460
682
|
{
|
|
461
683
|
className: cn(
|
|
462
684
|
"relative w-full overflow-x-auto",
|
|
463
685
|
variant === "default" && "border border-border-200 rounded-xl"
|
|
464
686
|
),
|
|
465
|
-
children: /* @__PURE__ */
|
|
687
|
+
children: /* @__PURE__ */ jsxs6(
|
|
466
688
|
"table",
|
|
467
689
|
{
|
|
468
690
|
ref,
|
|
@@ -476,8 +698,8 @@ var Table = forwardRef(
|
|
|
476
698
|
children: [
|
|
477
699
|
!Children.toArray(children).some(
|
|
478
700
|
(child) => isValidElement(child) && child.type === TableCaption
|
|
479
|
-
) && /* @__PURE__ */
|
|
480
|
-
|
|
701
|
+
) && /* @__PURE__ */ jsx7("caption", { className: "sr-only", children: "My Table" }),
|
|
702
|
+
children
|
|
481
703
|
]
|
|
482
704
|
}
|
|
483
705
|
)
|
|
@@ -486,7 +708,7 @@ var Table = forwardRef(
|
|
|
486
708
|
}
|
|
487
709
|
);
|
|
488
710
|
Table.displayName = "Table";
|
|
489
|
-
var TableHeader =
|
|
711
|
+
var TableHeader = forwardRef2(({ className, ...props }, ref) => /* @__PURE__ */ jsx7(
|
|
490
712
|
"thead",
|
|
491
713
|
{
|
|
492
714
|
ref,
|
|
@@ -495,8 +717,8 @@ var TableHeader = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ j
|
|
|
495
717
|
}
|
|
496
718
|
));
|
|
497
719
|
TableHeader.displayName = "TableHeader";
|
|
498
|
-
var TableBody =
|
|
499
|
-
({ className, variant = "default", ...props }, ref) => /* @__PURE__ */
|
|
720
|
+
var TableBody = forwardRef2(
|
|
721
|
+
({ className, variant = "default", ...props }, ref) => /* @__PURE__ */ jsx7(
|
|
500
722
|
"tbody",
|
|
501
723
|
{
|
|
502
724
|
ref,
|
|
@@ -510,8 +732,8 @@ var TableBody = forwardRef(
|
|
|
510
732
|
)
|
|
511
733
|
);
|
|
512
734
|
TableBody.displayName = "TableBody";
|
|
513
|
-
var TableFooter =
|
|
514
|
-
({ variant = "default", className, ...props }, ref) => /* @__PURE__ */
|
|
735
|
+
var TableFooter = forwardRef2(
|
|
736
|
+
({ variant = "default", className, ...props }, ref) => /* @__PURE__ */ jsx7(
|
|
515
737
|
"tfoot",
|
|
516
738
|
{
|
|
517
739
|
ref,
|
|
@@ -547,7 +769,7 @@ var VARIANT_STATES_ROW = {
|
|
|
547
769
|
borderless: "bg-background-50 opacity-50 cursor-not-allowed"
|
|
548
770
|
}
|
|
549
771
|
};
|
|
550
|
-
var TableRow =
|
|
772
|
+
var TableRow = forwardRef2(
|
|
551
773
|
({
|
|
552
774
|
variant = "default",
|
|
553
775
|
state = "default",
|
|
@@ -555,7 +777,7 @@ var TableRow = forwardRef(
|
|
|
555
777
|
className,
|
|
556
778
|
...props
|
|
557
779
|
}, ref) => {
|
|
558
|
-
return /* @__PURE__ */
|
|
780
|
+
return /* @__PURE__ */ jsx7(
|
|
559
781
|
"tr",
|
|
560
782
|
{
|
|
561
783
|
ref,
|
|
@@ -573,7 +795,7 @@ var TableRow = forwardRef(
|
|
|
573
795
|
}
|
|
574
796
|
);
|
|
575
797
|
TableRow.displayName = "TableRow";
|
|
576
|
-
var TableHead =
|
|
798
|
+
var TableHead = forwardRef2(
|
|
577
799
|
({
|
|
578
800
|
className,
|
|
579
801
|
sortable = true,
|
|
@@ -587,7 +809,7 @@ var TableHead = forwardRef(
|
|
|
587
809
|
onSort();
|
|
588
810
|
}
|
|
589
811
|
};
|
|
590
|
-
return /* @__PURE__ */
|
|
812
|
+
return /* @__PURE__ */ jsx7(
|
|
591
813
|
"th",
|
|
592
814
|
{
|
|
593
815
|
ref,
|
|
@@ -598,11 +820,11 @@ var TableHead = forwardRef(
|
|
|
598
820
|
),
|
|
599
821
|
onClick: handleClick,
|
|
600
822
|
...props,
|
|
601
|
-
children: /* @__PURE__ */
|
|
823
|
+
children: /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2", children: [
|
|
602
824
|
children,
|
|
603
|
-
sortable && /* @__PURE__ */
|
|
604
|
-
sortDirection === "asc" && /* @__PURE__ */
|
|
605
|
-
sortDirection === "desc" && /* @__PURE__ */
|
|
825
|
+
sortable && /* @__PURE__ */ jsxs6("div", { className: "flex flex-col", children: [
|
|
826
|
+
sortDirection === "asc" && /* @__PURE__ */ jsx7(CaretUp, { size: 16, weight: "fill", className: "text-text-800" }),
|
|
827
|
+
sortDirection === "desc" && /* @__PURE__ */ jsx7(CaretDown2, { size: 16, weight: "fill", className: "text-text-800" })
|
|
606
828
|
] })
|
|
607
829
|
] })
|
|
608
830
|
}
|
|
@@ -610,7 +832,7 @@ var TableHead = forwardRef(
|
|
|
610
832
|
}
|
|
611
833
|
);
|
|
612
834
|
TableHead.displayName = "TableHead";
|
|
613
|
-
var TableCell =
|
|
835
|
+
var TableCell = forwardRef2(({ className, ...props }, ref) => /* @__PURE__ */ jsx7(
|
|
614
836
|
"td",
|
|
615
837
|
{
|
|
616
838
|
ref,
|
|
@@ -622,7 +844,7 @@ var TableCell = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx
|
|
|
622
844
|
}
|
|
623
845
|
));
|
|
624
846
|
TableCell.displayName = "TableCell";
|
|
625
|
-
var TableCaption =
|
|
847
|
+
var TableCaption = forwardRef2(({ className, ...props }, ref) => /* @__PURE__ */ jsx7(
|
|
626
848
|
"caption",
|
|
627
849
|
{
|
|
628
850
|
ref,
|