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.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,161 @@ var Button = ({
|
|
|
157
156
|
};
|
|
158
157
|
var Button_default = Button;
|
|
159
158
|
|
|
159
|
+
// src/components/Skeleton/Skeleton.tsx
|
|
160
|
+
import { forwardRef } from "react";
|
|
161
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
162
|
+
var SKELETON_ANIMATION_CLASSES = {
|
|
163
|
+
pulse: "animate-pulse",
|
|
164
|
+
none: ""
|
|
165
|
+
};
|
|
166
|
+
var SKELETON_VARIANT_CLASSES = {
|
|
167
|
+
text: "h-4 bg-background-200 rounded",
|
|
168
|
+
circular: "bg-background-200 rounded-full",
|
|
169
|
+
rectangular: "bg-background-200",
|
|
170
|
+
rounded: "bg-background-200 rounded-lg"
|
|
171
|
+
};
|
|
172
|
+
var SPACING_CLASSES = {
|
|
173
|
+
none: "",
|
|
174
|
+
small: "space-y-1",
|
|
175
|
+
medium: "space-y-2",
|
|
176
|
+
large: "space-y-3"
|
|
177
|
+
};
|
|
178
|
+
var Skeleton = forwardRef(
|
|
179
|
+
({
|
|
180
|
+
variant = "text",
|
|
181
|
+
width,
|
|
182
|
+
height,
|
|
183
|
+
animation = "pulse",
|
|
184
|
+
lines = 1,
|
|
185
|
+
spacing = "none",
|
|
186
|
+
className = "",
|
|
187
|
+
children,
|
|
188
|
+
...props
|
|
189
|
+
}, ref) => {
|
|
190
|
+
const animationClass = SKELETON_ANIMATION_CLASSES[animation];
|
|
191
|
+
const variantClass = SKELETON_VARIANT_CLASSES[variant];
|
|
192
|
+
const spacingClass = SPACING_CLASSES[spacing];
|
|
193
|
+
const style = {
|
|
194
|
+
width: typeof width === "number" ? `${width}px` : width,
|
|
195
|
+
height: typeof height === "number" ? `${height}px` : height
|
|
196
|
+
};
|
|
197
|
+
if (variant === "text" && lines > 1) {
|
|
198
|
+
return /* @__PURE__ */ jsx4(
|
|
199
|
+
"div",
|
|
200
|
+
{
|
|
201
|
+
ref,
|
|
202
|
+
className: cn("flex flex-col", spacingClass, className),
|
|
203
|
+
...props,
|
|
204
|
+
children: Array.from({ length: lines }, (_, index) => /* @__PURE__ */ jsx4(
|
|
205
|
+
"div",
|
|
206
|
+
{
|
|
207
|
+
className: cn(variantClass, animationClass),
|
|
208
|
+
style: index === lines - 1 ? { width: "60%" } : void 0
|
|
209
|
+
},
|
|
210
|
+
index
|
|
211
|
+
))
|
|
212
|
+
}
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
return /* @__PURE__ */ jsx4(
|
|
216
|
+
"div",
|
|
217
|
+
{
|
|
218
|
+
ref,
|
|
219
|
+
className: cn(variantClass, animationClass, className),
|
|
220
|
+
style,
|
|
221
|
+
...props,
|
|
222
|
+
children
|
|
223
|
+
}
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
);
|
|
227
|
+
var SkeletonText = forwardRef(
|
|
228
|
+
(props, ref) => /* @__PURE__ */ jsx4(Skeleton, { ref, variant: "text", ...props })
|
|
229
|
+
);
|
|
230
|
+
var SkeletonCircle = forwardRef((props, ref) => /* @__PURE__ */ jsx4(Skeleton, { ref, variant: "circular", ...props }));
|
|
231
|
+
var SkeletonRectangle = forwardRef((props, ref) => /* @__PURE__ */ jsx4(Skeleton, { ref, variant: "rectangular", ...props }));
|
|
232
|
+
var SkeletonRounded = forwardRef((props, ref) => /* @__PURE__ */ jsx4(Skeleton, { ref, variant: "rounded", ...props }));
|
|
233
|
+
var SkeletonCard = forwardRef(
|
|
234
|
+
({
|
|
235
|
+
showAvatar = true,
|
|
236
|
+
showTitle = true,
|
|
237
|
+
showDescription = true,
|
|
238
|
+
showActions = true,
|
|
239
|
+
lines = 2,
|
|
240
|
+
className = "",
|
|
241
|
+
...props
|
|
242
|
+
}, ref) => {
|
|
243
|
+
return /* @__PURE__ */ jsxs3(
|
|
244
|
+
"div",
|
|
245
|
+
{
|
|
246
|
+
ref,
|
|
247
|
+
className: cn(
|
|
248
|
+
"w-full p-4 bg-background border border-border-200 rounded-lg",
|
|
249
|
+
className
|
|
250
|
+
),
|
|
251
|
+
...props,
|
|
252
|
+
children: [
|
|
253
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex items-start space-x-3", children: [
|
|
254
|
+
showAvatar && /* @__PURE__ */ jsx4(SkeletonCircle, { width: 40, height: 40 }),
|
|
255
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex-1 space-y-2", children: [
|
|
256
|
+
showTitle && /* @__PURE__ */ jsx4(SkeletonText, { width: "60%", height: 20 }),
|
|
257
|
+
showDescription && /* @__PURE__ */ jsx4(SkeletonText, { lines, spacing: "small" })
|
|
258
|
+
] })
|
|
259
|
+
] }),
|
|
260
|
+
showActions && /* @__PURE__ */ jsxs3("div", { className: "flex justify-end space-x-2 mt-4", children: [
|
|
261
|
+
/* @__PURE__ */ jsx4(SkeletonRectangle, { width: 80, height: 32 }),
|
|
262
|
+
/* @__PURE__ */ jsx4(SkeletonRectangle, { width: 80, height: 32 })
|
|
263
|
+
] })
|
|
264
|
+
]
|
|
265
|
+
}
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
);
|
|
269
|
+
var SkeletonList = forwardRef(
|
|
270
|
+
({
|
|
271
|
+
items = 3,
|
|
272
|
+
showAvatar = true,
|
|
273
|
+
showTitle = true,
|
|
274
|
+
showDescription = true,
|
|
275
|
+
lines = 1,
|
|
276
|
+
className = "",
|
|
277
|
+
...props
|
|
278
|
+
}, ref) => {
|
|
279
|
+
return /* @__PURE__ */ jsx4("div", { ref, className: cn("space-y-3", className), ...props, children: Array.from({ length: items }, (_, index) => /* @__PURE__ */ jsxs3("div", { className: "flex items-start space-x-3 p-3", children: [
|
|
280
|
+
showAvatar && /* @__PURE__ */ jsx4(SkeletonCircle, { width: 32, height: 32 }),
|
|
281
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex-1 space-y-2", children: [
|
|
282
|
+
showTitle && /* @__PURE__ */ jsx4(SkeletonText, { width: "40%", height: 16 }),
|
|
283
|
+
showDescription && /* @__PURE__ */ jsx4(SkeletonText, { lines, spacing: "small" })
|
|
284
|
+
] })
|
|
285
|
+
] }, index)) });
|
|
286
|
+
}
|
|
287
|
+
);
|
|
288
|
+
var SkeletonTable = forwardRef(
|
|
289
|
+
({ rows = 5, columns = 4, showHeader = true, className = "", ...props }, ref) => {
|
|
290
|
+
return /* @__PURE__ */ jsxs3("div", { ref, className: cn("w-full", className), ...props, children: [
|
|
291
|
+
showHeader && /* @__PURE__ */ jsx4("div", { className: "flex space-x-2 mb-3", children: Array.from({ length: columns }, (_, index) => /* @__PURE__ */ jsx4(
|
|
292
|
+
SkeletonText,
|
|
293
|
+
{
|
|
294
|
+
width: `${100 / columns}%`,
|
|
295
|
+
height: 20
|
|
296
|
+
},
|
|
297
|
+
index
|
|
298
|
+
)) }),
|
|
299
|
+
/* @__PURE__ */ jsx4("div", { className: "space-y-2", children: Array.from({ length: rows }, (_, rowIndex) => /* @__PURE__ */ jsx4("div", { className: "flex space-x-2", children: Array.from({ length: columns }, (_2, colIndex) => /* @__PURE__ */ jsx4(
|
|
300
|
+
SkeletonText,
|
|
301
|
+
{
|
|
302
|
+
width: `${100 / columns}%`,
|
|
303
|
+
height: 16
|
|
304
|
+
},
|
|
305
|
+
colIndex
|
|
306
|
+
)) }, rowIndex)) })
|
|
307
|
+
] });
|
|
308
|
+
}
|
|
309
|
+
);
|
|
310
|
+
|
|
160
311
|
// src/components/Table/TablePagination.tsx
|
|
161
312
|
import { CaretLeft, CaretRight, CaretDown } from "phosphor-react";
|
|
162
|
-
import { jsx as
|
|
313
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
163
314
|
var TablePagination = ({
|
|
164
315
|
totalItems,
|
|
165
316
|
currentPage,
|
|
@@ -190,7 +341,7 @@ var TablePagination = ({
|
|
|
190
341
|
};
|
|
191
342
|
const isFirstPage = currentPage === 1;
|
|
192
343
|
const isLastPage = currentPage === totalPages;
|
|
193
|
-
return /* @__PURE__ */
|
|
344
|
+
return /* @__PURE__ */ jsxs4(
|
|
194
345
|
"div",
|
|
195
346
|
{
|
|
196
347
|
className: cn(
|
|
@@ -200,29 +351,29 @@ var TablePagination = ({
|
|
|
200
351
|
),
|
|
201
352
|
...props,
|
|
202
353
|
children: [
|
|
203
|
-
/* @__PURE__ */
|
|
354
|
+
/* @__PURE__ */ jsxs4("span", { className: "font-normal text-xs leading-[14px] text-text-800", children: [
|
|
204
355
|
startItem,
|
|
205
356
|
" de ",
|
|
206
357
|
totalItems,
|
|
207
358
|
" ",
|
|
208
359
|
itemLabel
|
|
209
360
|
] }),
|
|
210
|
-
/* @__PURE__ */
|
|
211
|
-
onItemsPerPageChange && /* @__PURE__ */
|
|
212
|
-
/* @__PURE__ */
|
|
361
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex flex-wrap sm:flex-nowrap items-center gap-2 sm:gap-4 justify-center sm:justify-start", children: [
|
|
362
|
+
onItemsPerPageChange && /* @__PURE__ */ jsxs4("div", { className: "relative", children: [
|
|
363
|
+
/* @__PURE__ */ jsx5(
|
|
213
364
|
"select",
|
|
214
365
|
{
|
|
215
366
|
value: itemsPerPage,
|
|
216
367
|
onChange: handleItemsPerPageChange,
|
|
217
368
|
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
369
|
"aria-label": "Items por p\xE1gina",
|
|
219
|
-
children: itemsPerPageOptions.map((option) => /* @__PURE__ */
|
|
370
|
+
children: itemsPerPageOptions.map((option) => /* @__PURE__ */ jsxs4("option", { value: option, children: [
|
|
220
371
|
option,
|
|
221
372
|
" itens"
|
|
222
373
|
] }, option))
|
|
223
374
|
}
|
|
224
375
|
),
|
|
225
|
-
/* @__PURE__ */
|
|
376
|
+
/* @__PURE__ */ jsx5(
|
|
226
377
|
CaretDown,
|
|
227
378
|
{
|
|
228
379
|
size: 14,
|
|
@@ -231,13 +382,13 @@ var TablePagination = ({
|
|
|
231
382
|
}
|
|
232
383
|
)
|
|
233
384
|
] }),
|
|
234
|
-
/* @__PURE__ */
|
|
385
|
+
/* @__PURE__ */ jsxs4("span", { className: "font-normal text-xs leading-[14px] text-text-950", children: [
|
|
235
386
|
"P\xE1gina ",
|
|
236
387
|
currentPage,
|
|
237
388
|
" de ",
|
|
238
389
|
totalPages
|
|
239
390
|
] }),
|
|
240
|
-
/* @__PURE__ */
|
|
391
|
+
/* @__PURE__ */ jsxs4(
|
|
241
392
|
"button",
|
|
242
393
|
{
|
|
243
394
|
onClick: handlePrevious,
|
|
@@ -248,12 +399,12 @@ var TablePagination = ({
|
|
|
248
399
|
),
|
|
249
400
|
"aria-label": "P\xE1gina anterior",
|
|
250
401
|
children: [
|
|
251
|
-
/* @__PURE__ */
|
|
252
|
-
/* @__PURE__ */
|
|
402
|
+
/* @__PURE__ */ jsx5(CaretLeft, { size: 12, weight: "bold", className: "text-primary-950" }),
|
|
403
|
+
/* @__PURE__ */ jsx5("span", { className: "font-medium text-xs leading-[14px] text-primary-950", children: "Anterior" })
|
|
253
404
|
]
|
|
254
405
|
}
|
|
255
406
|
),
|
|
256
|
-
/* @__PURE__ */
|
|
407
|
+
/* @__PURE__ */ jsxs4(
|
|
257
408
|
"button",
|
|
258
409
|
{
|
|
259
410
|
onClick: handleNext,
|
|
@@ -264,8 +415,8 @@ var TablePagination = ({
|
|
|
264
415
|
),
|
|
265
416
|
"aria-label": "Pr\xF3xima p\xE1gina",
|
|
266
417
|
children: [
|
|
267
|
-
/* @__PURE__ */
|
|
268
|
-
/* @__PURE__ */
|
|
418
|
+
/* @__PURE__ */ jsx5("span", { className: "font-medium text-xs leading-[14px] text-primary-950", children: "Pr\xF3xima" }),
|
|
419
|
+
/* @__PURE__ */ jsx5(CaretRight, { size: 12, weight: "bold", className: "text-primary-950" })
|
|
269
420
|
]
|
|
270
421
|
}
|
|
271
422
|
)
|
|
@@ -278,7 +429,7 @@ TablePagination.displayName = "TablePagination";
|
|
|
278
429
|
var TablePagination_default = TablePagination;
|
|
279
430
|
|
|
280
431
|
// src/components/Table/Table.tsx
|
|
281
|
-
import { jsx as
|
|
432
|
+
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
282
433
|
function useTableSort(data, options = {}) {
|
|
283
434
|
const { syncWithUrl = false } = options;
|
|
284
435
|
const getInitialState = () => {
|
|
@@ -348,121 +499,157 @@ function useTableSort(data, options = {}) {
|
|
|
348
499
|
}, [data, sortColumn, sortDirection]);
|
|
349
500
|
return { sortedData, sortColumn, sortDirection, handleSort };
|
|
350
501
|
}
|
|
351
|
-
var
|
|
502
|
+
var renderHeaderElements = (children) => {
|
|
503
|
+
return Children.map(children, (child) => {
|
|
504
|
+
if (isValidElement(child) && (child.type === TableCaption || child.type === TableHeader)) {
|
|
505
|
+
return child;
|
|
506
|
+
}
|
|
507
|
+
return null;
|
|
508
|
+
});
|
|
509
|
+
};
|
|
510
|
+
var getNoSearchResultContent = (config, defaultTitle, defaultDescription) => {
|
|
511
|
+
if (config.component) {
|
|
512
|
+
return config.component;
|
|
513
|
+
}
|
|
514
|
+
if (config.image) {
|
|
515
|
+
return /* @__PURE__ */ jsx6(
|
|
516
|
+
NoSearchResult_default,
|
|
517
|
+
{
|
|
518
|
+
image: config.image,
|
|
519
|
+
title: config.title || defaultTitle,
|
|
520
|
+
description: config.description || defaultDescription
|
|
521
|
+
}
|
|
522
|
+
);
|
|
523
|
+
}
|
|
524
|
+
return /* @__PURE__ */ jsxs5("div", { className: "text-center", children: [
|
|
525
|
+
/* @__PURE__ */ jsx6("p", { className: "text-text-600 text-lg font-semibold mb-2", children: config.title || defaultTitle }),
|
|
526
|
+
/* @__PURE__ */ jsx6("p", { className: "text-text-500 text-sm", children: config.description || defaultDescription })
|
|
527
|
+
] });
|
|
528
|
+
};
|
|
529
|
+
var getEmptyStateContent = (config, defaultMessage, defaultButtonText, onButtonClick) => {
|
|
530
|
+
if (config?.component) {
|
|
531
|
+
return config.component;
|
|
532
|
+
}
|
|
533
|
+
return /* @__PURE__ */ jsxs5("div", { className: "flex flex-col items-center justify-center gap-4", children: [
|
|
534
|
+
config?.image && /* @__PURE__ */ jsx6(
|
|
535
|
+
"img",
|
|
536
|
+
{
|
|
537
|
+
src: config.image,
|
|
538
|
+
alt: "Empty state",
|
|
539
|
+
className: "w-auto h-auto max-w-full"
|
|
540
|
+
}
|
|
541
|
+
),
|
|
542
|
+
/* @__PURE__ */ jsx6("p", { className: "text-text-600 text-base font-normal", children: config?.message || defaultMessage }),
|
|
543
|
+
(config?.onButtonClick || onButtonClick) && /* @__PURE__ */ jsx6(
|
|
544
|
+
Button_default,
|
|
545
|
+
{
|
|
546
|
+
variant: "solid",
|
|
547
|
+
action: "primary",
|
|
548
|
+
size: "medium",
|
|
549
|
+
onClick: config?.onButtonClick || onButtonClick,
|
|
550
|
+
children: config?.buttonText || defaultButtonText
|
|
551
|
+
}
|
|
552
|
+
)
|
|
553
|
+
] });
|
|
554
|
+
};
|
|
555
|
+
var renderTableWrapper = (variant, tableRef, className, children, stateContent, tableProps) => {
|
|
556
|
+
return /* @__PURE__ */ jsxs5(
|
|
557
|
+
"div",
|
|
558
|
+
{
|
|
559
|
+
className: cn(
|
|
560
|
+
"relative w-full overflow-x-auto",
|
|
561
|
+
variant === "default" && "border border-border-200 rounded-xl"
|
|
562
|
+
),
|
|
563
|
+
children: [
|
|
564
|
+
/* @__PURE__ */ jsx6(
|
|
565
|
+
"table",
|
|
566
|
+
{
|
|
567
|
+
ref: tableRef,
|
|
568
|
+
className: cn(
|
|
569
|
+
"analytica-table w-full caption-bottom text-sm border-separate border-spacing-0",
|
|
570
|
+
className
|
|
571
|
+
),
|
|
572
|
+
...tableProps,
|
|
573
|
+
children: renderHeaderElements(children)
|
|
574
|
+
}
|
|
575
|
+
),
|
|
576
|
+
/* @__PURE__ */ jsx6("div", { className: "py-8 flex justify-center", children: stateContent })
|
|
577
|
+
]
|
|
578
|
+
}
|
|
579
|
+
);
|
|
580
|
+
};
|
|
581
|
+
var Table = forwardRef2(
|
|
352
582
|
({
|
|
353
583
|
variant = "default",
|
|
354
584
|
className,
|
|
355
585
|
children,
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
onEmptyStateButtonClick,
|
|
586
|
+
showLoading = false,
|
|
587
|
+
loadingState,
|
|
588
|
+
showNoSearchResult = false,
|
|
589
|
+
noSearchResultState,
|
|
590
|
+
showEmpty = false,
|
|
591
|
+
emptyState,
|
|
363
592
|
...props
|
|
364
593
|
}, 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;
|
|
594
|
+
const defaultNoSearchResultState = {
|
|
595
|
+
title: "Nenhum resultado encontrado",
|
|
596
|
+
description: "N\xE3o encontramos nenhum resultado com esse nome. Tente revisar a busca ou usar outra palavra-chave."
|
|
597
|
+
};
|
|
598
|
+
const defaultEmptyState = {
|
|
599
|
+
message: "Nenhum dado dispon\xEDvel no momento.",
|
|
600
|
+
buttonText: "Adicionar item"
|
|
601
|
+
};
|
|
602
|
+
const finalNoSearchResultState = noSearchResultState || defaultNoSearchResultState;
|
|
603
|
+
const finalEmptyState = emptyState || defaultEmptyState;
|
|
604
|
+
if (showLoading) {
|
|
605
|
+
const loadingContent = loadingState?.component || /* @__PURE__ */ jsx6(SkeletonTable, { rows: 5, columns: 4, showHeader: false });
|
|
606
|
+
return renderTableWrapper(
|
|
607
|
+
variant,
|
|
608
|
+
ref,
|
|
609
|
+
className,
|
|
610
|
+
children,
|
|
611
|
+
loadingContent,
|
|
612
|
+
props
|
|
613
|
+
);
|
|
614
|
+
}
|
|
397
615
|
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
|
-
}
|
|
616
|
+
const noSearchContent = getNoSearchResultContent(
|
|
617
|
+
finalNoSearchResultState,
|
|
618
|
+
defaultNoSearchResultState.title || "",
|
|
619
|
+
defaultNoSearchResultState.description || ""
|
|
620
|
+
);
|
|
621
|
+
return renderTableWrapper(
|
|
622
|
+
variant,
|
|
623
|
+
ref,
|
|
624
|
+
className,
|
|
625
|
+
children,
|
|
626
|
+
noSearchContent,
|
|
627
|
+
props
|
|
436
628
|
);
|
|
437
629
|
}
|
|
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(
|
|
630
|
+
if (showEmpty) {
|
|
631
|
+
const emptyContent = getEmptyStateContent(
|
|
632
|
+
finalEmptyState,
|
|
633
|
+
defaultEmptyState.message || "Nenhum dado dispon\xEDvel no momento.",
|
|
634
|
+
defaultEmptyState.buttonText || "Adicionar item"
|
|
635
|
+
);
|
|
636
|
+
return renderTableWrapper(
|
|
637
|
+
variant,
|
|
638
|
+
ref,
|
|
639
|
+
className,
|
|
640
|
+
children,
|
|
641
|
+
emptyContent,
|
|
642
|
+
props
|
|
643
|
+
);
|
|
644
|
+
}
|
|
645
|
+
return /* @__PURE__ */ jsx6(
|
|
459
646
|
"div",
|
|
460
647
|
{
|
|
461
648
|
className: cn(
|
|
462
649
|
"relative w-full overflow-x-auto",
|
|
463
650
|
variant === "default" && "border border-border-200 rounded-xl"
|
|
464
651
|
),
|
|
465
|
-
children: /* @__PURE__ */
|
|
652
|
+
children: /* @__PURE__ */ jsxs5(
|
|
466
653
|
"table",
|
|
467
654
|
{
|
|
468
655
|
ref,
|
|
@@ -476,8 +663,8 @@ var Table = forwardRef(
|
|
|
476
663
|
children: [
|
|
477
664
|
!Children.toArray(children).some(
|
|
478
665
|
(child) => isValidElement(child) && child.type === TableCaption
|
|
479
|
-
) && /* @__PURE__ */
|
|
480
|
-
|
|
666
|
+
) && /* @__PURE__ */ jsx6("caption", { className: "sr-only", children: "My Table" }),
|
|
667
|
+
children
|
|
481
668
|
]
|
|
482
669
|
}
|
|
483
670
|
)
|
|
@@ -486,7 +673,7 @@ var Table = forwardRef(
|
|
|
486
673
|
}
|
|
487
674
|
);
|
|
488
675
|
Table.displayName = "Table";
|
|
489
|
-
var TableHeader =
|
|
676
|
+
var TableHeader = forwardRef2(({ className, ...props }, ref) => /* @__PURE__ */ jsx6(
|
|
490
677
|
"thead",
|
|
491
678
|
{
|
|
492
679
|
ref,
|
|
@@ -495,8 +682,8 @@ var TableHeader = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ j
|
|
|
495
682
|
}
|
|
496
683
|
));
|
|
497
684
|
TableHeader.displayName = "TableHeader";
|
|
498
|
-
var TableBody =
|
|
499
|
-
({ className, variant = "default", ...props }, ref) => /* @__PURE__ */
|
|
685
|
+
var TableBody = forwardRef2(
|
|
686
|
+
({ className, variant = "default", ...props }, ref) => /* @__PURE__ */ jsx6(
|
|
500
687
|
"tbody",
|
|
501
688
|
{
|
|
502
689
|
ref,
|
|
@@ -510,8 +697,8 @@ var TableBody = forwardRef(
|
|
|
510
697
|
)
|
|
511
698
|
);
|
|
512
699
|
TableBody.displayName = "TableBody";
|
|
513
|
-
var TableFooter =
|
|
514
|
-
({ variant = "default", className, ...props }, ref) => /* @__PURE__ */
|
|
700
|
+
var TableFooter = forwardRef2(
|
|
701
|
+
({ variant = "default", className, ...props }, ref) => /* @__PURE__ */ jsx6(
|
|
515
702
|
"tfoot",
|
|
516
703
|
{
|
|
517
704
|
ref,
|
|
@@ -547,7 +734,7 @@ var VARIANT_STATES_ROW = {
|
|
|
547
734
|
borderless: "bg-background-50 opacity-50 cursor-not-allowed"
|
|
548
735
|
}
|
|
549
736
|
};
|
|
550
|
-
var TableRow =
|
|
737
|
+
var TableRow = forwardRef2(
|
|
551
738
|
({
|
|
552
739
|
variant = "default",
|
|
553
740
|
state = "default",
|
|
@@ -555,7 +742,7 @@ var TableRow = forwardRef(
|
|
|
555
742
|
className,
|
|
556
743
|
...props
|
|
557
744
|
}, ref) => {
|
|
558
|
-
return /* @__PURE__ */
|
|
745
|
+
return /* @__PURE__ */ jsx6(
|
|
559
746
|
"tr",
|
|
560
747
|
{
|
|
561
748
|
ref,
|
|
@@ -573,7 +760,7 @@ var TableRow = forwardRef(
|
|
|
573
760
|
}
|
|
574
761
|
);
|
|
575
762
|
TableRow.displayName = "TableRow";
|
|
576
|
-
var TableHead =
|
|
763
|
+
var TableHead = forwardRef2(
|
|
577
764
|
({
|
|
578
765
|
className,
|
|
579
766
|
sortable = true,
|
|
@@ -587,7 +774,7 @@ var TableHead = forwardRef(
|
|
|
587
774
|
onSort();
|
|
588
775
|
}
|
|
589
776
|
};
|
|
590
|
-
return /* @__PURE__ */
|
|
777
|
+
return /* @__PURE__ */ jsx6(
|
|
591
778
|
"th",
|
|
592
779
|
{
|
|
593
780
|
ref,
|
|
@@ -598,11 +785,11 @@ var TableHead = forwardRef(
|
|
|
598
785
|
),
|
|
599
786
|
onClick: handleClick,
|
|
600
787
|
...props,
|
|
601
|
-
children: /* @__PURE__ */
|
|
788
|
+
children: /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-2", children: [
|
|
602
789
|
children,
|
|
603
|
-
sortable && /* @__PURE__ */
|
|
604
|
-
sortDirection === "asc" && /* @__PURE__ */
|
|
605
|
-
sortDirection === "desc" && /* @__PURE__ */
|
|
790
|
+
sortable && /* @__PURE__ */ jsxs5("div", { className: "flex flex-col", children: [
|
|
791
|
+
sortDirection === "asc" && /* @__PURE__ */ jsx6(CaretUp, { size: 16, weight: "fill", className: "text-text-800" }),
|
|
792
|
+
sortDirection === "desc" && /* @__PURE__ */ jsx6(CaretDown2, { size: 16, weight: "fill", className: "text-text-800" })
|
|
606
793
|
] })
|
|
607
794
|
] })
|
|
608
795
|
}
|
|
@@ -610,7 +797,7 @@ var TableHead = forwardRef(
|
|
|
610
797
|
}
|
|
611
798
|
);
|
|
612
799
|
TableHead.displayName = "TableHead";
|
|
613
|
-
var TableCell =
|
|
800
|
+
var TableCell = forwardRef2(({ className, ...props }, ref) => /* @__PURE__ */ jsx6(
|
|
614
801
|
"td",
|
|
615
802
|
{
|
|
616
803
|
ref,
|
|
@@ -622,7 +809,7 @@ var TableCell = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx
|
|
|
622
809
|
}
|
|
623
810
|
));
|
|
624
811
|
TableCell.displayName = "TableCell";
|
|
625
|
-
var TableCaption =
|
|
812
|
+
var TableCaption = forwardRef2(({ className, ...props }, ref) => /* @__PURE__ */ jsx6(
|
|
626
813
|
"caption",
|
|
627
814
|
{
|
|
628
815
|
ref,
|