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
|
@@ -408,7 +408,7 @@ var Divider = ({
|
|
|
408
408
|
var Divider_default = Divider;
|
|
409
409
|
|
|
410
410
|
// src/components/Table/Table.tsx
|
|
411
|
-
var
|
|
411
|
+
var import_react3 = require("react");
|
|
412
412
|
var import_phosphor_react2 = require("phosphor-react");
|
|
413
413
|
|
|
414
414
|
// src/components/NoSearchResult/NoSearchResult.tsx
|
|
@@ -440,123 +440,311 @@ var NoSearchResult = ({ image, title, description }) => {
|
|
|
440
440
|
};
|
|
441
441
|
var NoSearchResult_default = NoSearchResult;
|
|
442
442
|
|
|
443
|
-
// src/components/
|
|
443
|
+
// src/components/Skeleton/Skeleton.tsx
|
|
444
|
+
var import_react2 = require("react");
|
|
444
445
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
445
|
-
var
|
|
446
|
+
var SKELETON_ANIMATION_CLASSES = {
|
|
447
|
+
pulse: "animate-pulse",
|
|
448
|
+
none: ""
|
|
449
|
+
};
|
|
450
|
+
var SKELETON_VARIANT_CLASSES = {
|
|
451
|
+
text: "h-4 bg-background-200 rounded",
|
|
452
|
+
circular: "bg-background-200 rounded-full",
|
|
453
|
+
rectangular: "bg-background-200",
|
|
454
|
+
rounded: "bg-background-200 rounded-lg"
|
|
455
|
+
};
|
|
456
|
+
var SPACING_CLASSES = {
|
|
457
|
+
none: "",
|
|
458
|
+
small: "space-y-1",
|
|
459
|
+
medium: "space-y-2",
|
|
460
|
+
large: "space-y-3"
|
|
461
|
+
};
|
|
462
|
+
var Skeleton = (0, import_react2.forwardRef)(
|
|
446
463
|
({
|
|
447
|
-
variant = "
|
|
448
|
-
|
|
464
|
+
variant = "text",
|
|
465
|
+
width,
|
|
466
|
+
height,
|
|
467
|
+
animation = "pulse",
|
|
468
|
+
lines = 1,
|
|
469
|
+
spacing = "none",
|
|
470
|
+
className = "",
|
|
449
471
|
children,
|
|
450
|
-
searchTerm,
|
|
451
|
-
noSearchResultImage,
|
|
452
|
-
noSearchResultTitle = "Nenhum resultado encontrado",
|
|
453
|
-
noSearchResultDescription = "N\xE3o encontramos nenhum resultado com esse nome. Tente revisar a busca ou usar outra palavra-chave.",
|
|
454
|
-
emptyStateMessage = "Nenhum dado dispon\xEDvel no momento.",
|
|
455
|
-
emptyStateButtonText = "Adicionar item",
|
|
456
|
-
onEmptyStateButtonClick,
|
|
457
472
|
...props
|
|
458
473
|
}, ref) => {
|
|
459
|
-
const
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
});
|
|
471
|
-
return foundBody ? empty : false;
|
|
472
|
-
}, [children]);
|
|
473
|
-
const columnCount = (0, import_react2.useMemo)(() => {
|
|
474
|
-
let count = 0;
|
|
475
|
-
import_react2.Children.forEach(children, (child) => {
|
|
476
|
-
if ((0, import_react2.isValidElement)(child) && child.type === TableHeader) {
|
|
477
|
-
const headerProps = child.props;
|
|
478
|
-
import_react2.Children.forEach(headerProps.children, (row) => {
|
|
479
|
-
if ((0, import_react2.isValidElement)(row) && row.type === TableRow) {
|
|
480
|
-
const rowProps = row.props;
|
|
481
|
-
count = import_react2.Children.count(rowProps.children);
|
|
482
|
-
}
|
|
483
|
-
});
|
|
484
|
-
}
|
|
485
|
-
});
|
|
486
|
-
return count || 1;
|
|
487
|
-
}, [children]);
|
|
488
|
-
const hasSearchTerm = searchTerm && searchTerm.trim() !== "";
|
|
489
|
-
const showNoSearchResult = hasSearchTerm && isTableBodyEmpty;
|
|
490
|
-
const showEmptyState = !hasSearchTerm && isTableBodyEmpty;
|
|
491
|
-
if (showNoSearchResult) {
|
|
492
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
474
|
+
const animationClass = SKELETON_ANIMATION_CLASSES[animation];
|
|
475
|
+
const variantClass = SKELETON_VARIANT_CLASSES[variant];
|
|
476
|
+
const spacingClass = SPACING_CLASSES[spacing];
|
|
477
|
+
const style = {
|
|
478
|
+
width: typeof width === "number" ? `${width}px` : width,
|
|
479
|
+
height: typeof height === "number" ? `${height}px` : height
|
|
480
|
+
};
|
|
481
|
+
if (variant === "text" && lines > 1) {
|
|
482
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
493
483
|
"div",
|
|
494
484
|
{
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
),
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
{
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
className
|
|
507
|
-
),
|
|
508
|
-
...props,
|
|
509
|
-
children: import_react2.Children.map(children, (child) => {
|
|
510
|
-
if ((0, import_react2.isValidElement)(child) && (child.type === TableCaption || child.type === TableHeader)) {
|
|
511
|
-
return child;
|
|
512
|
-
}
|
|
513
|
-
return null;
|
|
514
|
-
})
|
|
515
|
-
}
|
|
516
|
-
),
|
|
517
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "py-8 flex justify-center", children: noSearchResultImage ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
518
|
-
NoSearchResult_default,
|
|
519
|
-
{
|
|
520
|
-
image: noSearchResultImage,
|
|
521
|
-
title: noSearchResultTitle,
|
|
522
|
-
description: noSearchResultDescription
|
|
523
|
-
}
|
|
524
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "text-center", children: [
|
|
525
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "text-text-600 text-lg font-semibold mb-2", children: noSearchResultTitle }),
|
|
526
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "text-text-500 text-sm", children: noSearchResultDescription })
|
|
527
|
-
] }) })
|
|
528
|
-
]
|
|
485
|
+
ref,
|
|
486
|
+
className: cn("flex flex-col", spacingClass, className),
|
|
487
|
+
...props,
|
|
488
|
+
children: Array.from({ length: lines }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
489
|
+
"div",
|
|
490
|
+
{
|
|
491
|
+
className: cn(variantClass, animationClass),
|
|
492
|
+
style: index === lines - 1 ? { width: "60%" } : void 0
|
|
493
|
+
},
|
|
494
|
+
index
|
|
495
|
+
))
|
|
529
496
|
}
|
|
530
497
|
);
|
|
531
498
|
}
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
variant: "solid",
|
|
541
|
-
action: "primary",
|
|
542
|
-
size: "medium",
|
|
543
|
-
onClick: onEmptyStateButtonClick,
|
|
544
|
-
children: emptyStateButtonText
|
|
545
|
-
}
|
|
546
|
-
)
|
|
547
|
-
] }) }) })
|
|
548
|
-
});
|
|
499
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
500
|
+
"div",
|
|
501
|
+
{
|
|
502
|
+
ref,
|
|
503
|
+
className: cn(variantClass, animationClass, className),
|
|
504
|
+
style,
|
|
505
|
+
...props,
|
|
506
|
+
children
|
|
549
507
|
}
|
|
508
|
+
);
|
|
509
|
+
}
|
|
510
|
+
);
|
|
511
|
+
var SkeletonText = (0, import_react2.forwardRef)(
|
|
512
|
+
(props, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Skeleton, { ref, variant: "text", ...props })
|
|
513
|
+
);
|
|
514
|
+
var SkeletonCircle = (0, import_react2.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Skeleton, { ref, variant: "circular", ...props }));
|
|
515
|
+
var SkeletonRectangle = (0, import_react2.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Skeleton, { ref, variant: "rectangular", ...props }));
|
|
516
|
+
var SkeletonRounded = (0, import_react2.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Skeleton, { ref, variant: "rounded", ...props }));
|
|
517
|
+
var SkeletonCard = (0, import_react2.forwardRef)(
|
|
518
|
+
({
|
|
519
|
+
showAvatar = true,
|
|
520
|
+
showTitle = true,
|
|
521
|
+
showDescription = true,
|
|
522
|
+
showActions = true,
|
|
523
|
+
lines = 2,
|
|
524
|
+
className = "",
|
|
525
|
+
...props
|
|
526
|
+
}, ref) => {
|
|
527
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
528
|
+
"div",
|
|
529
|
+
{
|
|
530
|
+
ref,
|
|
531
|
+
className: cn(
|
|
532
|
+
"w-full p-4 bg-background border border-border-200 rounded-lg",
|
|
533
|
+
className
|
|
534
|
+
),
|
|
535
|
+
...props,
|
|
536
|
+
children: [
|
|
537
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-start space-x-3", children: [
|
|
538
|
+
showAvatar && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SkeletonCircle, { width: 40, height: 40 }),
|
|
539
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex-1 space-y-2", children: [
|
|
540
|
+
showTitle && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SkeletonText, { width: "60%", height: 20 }),
|
|
541
|
+
showDescription && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SkeletonText, { lines, spacing: "small" })
|
|
542
|
+
] })
|
|
543
|
+
] }),
|
|
544
|
+
showActions && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex justify-end space-x-2 mt-4", children: [
|
|
545
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SkeletonRectangle, { width: 80, height: 32 }),
|
|
546
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SkeletonRectangle, { width: 80, height: 32 })
|
|
547
|
+
] })
|
|
548
|
+
]
|
|
549
|
+
}
|
|
550
|
+
);
|
|
551
|
+
}
|
|
552
|
+
);
|
|
553
|
+
var SkeletonList = (0, import_react2.forwardRef)(
|
|
554
|
+
({
|
|
555
|
+
items = 3,
|
|
556
|
+
showAvatar = true,
|
|
557
|
+
showTitle = true,
|
|
558
|
+
showDescription = true,
|
|
559
|
+
lines = 1,
|
|
560
|
+
className = "",
|
|
561
|
+
...props
|
|
562
|
+
}, ref) => {
|
|
563
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { ref, className: cn("space-y-3", className), ...props, children: Array.from({ length: items }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-start space-x-3 p-3", children: [
|
|
564
|
+
showAvatar && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SkeletonCircle, { width: 32, height: 32 }),
|
|
565
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex-1 space-y-2", children: [
|
|
566
|
+
showTitle && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SkeletonText, { width: "40%", height: 16 }),
|
|
567
|
+
showDescription && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SkeletonText, { lines, spacing: "small" })
|
|
568
|
+
] })
|
|
569
|
+
] }, index)) });
|
|
570
|
+
}
|
|
571
|
+
);
|
|
572
|
+
var SkeletonTable = (0, import_react2.forwardRef)(
|
|
573
|
+
({ rows = 5, columns = 4, showHeader = true, className = "", ...props }, ref) => {
|
|
574
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { ref, className: cn("w-full", className), ...props, children: [
|
|
575
|
+
showHeader && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex space-x-2 mb-3", children: Array.from({ length: columns }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
576
|
+
SkeletonText,
|
|
577
|
+
{
|
|
578
|
+
width: `${100 / columns}%`,
|
|
579
|
+
height: 20
|
|
580
|
+
},
|
|
581
|
+
index
|
|
582
|
+
)) }),
|
|
583
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "space-y-2", children: Array.from({ length: rows }, (_, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex space-x-2", children: Array.from({ length: columns }, (_2, colIndex) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
584
|
+
SkeletonText,
|
|
585
|
+
{
|
|
586
|
+
width: `${100 / columns}%`,
|
|
587
|
+
height: 16
|
|
588
|
+
},
|
|
589
|
+
colIndex
|
|
590
|
+
)) }, rowIndex)) })
|
|
591
|
+
] });
|
|
592
|
+
}
|
|
593
|
+
);
|
|
594
|
+
|
|
595
|
+
// src/components/Table/Table.tsx
|
|
596
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
597
|
+
var renderHeaderElements = (children) => {
|
|
598
|
+
return import_react3.Children.map(children, (child) => {
|
|
599
|
+
if ((0, import_react3.isValidElement)(child) && (child.type === TableCaption || child.type === TableHeader)) {
|
|
550
600
|
return child;
|
|
551
|
-
}
|
|
552
|
-
return
|
|
601
|
+
}
|
|
602
|
+
return null;
|
|
603
|
+
});
|
|
604
|
+
};
|
|
605
|
+
var getNoSearchResultContent = (config, defaultTitle, defaultDescription) => {
|
|
606
|
+
if (config.component) {
|
|
607
|
+
return config.component;
|
|
608
|
+
}
|
|
609
|
+
if (config.image) {
|
|
610
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
611
|
+
NoSearchResult_default,
|
|
612
|
+
{
|
|
613
|
+
image: config.image,
|
|
614
|
+
title: config.title || defaultTitle,
|
|
615
|
+
description: config.description || defaultDescription
|
|
616
|
+
}
|
|
617
|
+
);
|
|
618
|
+
}
|
|
619
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "text-center", children: [
|
|
620
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "text-text-600 text-lg font-semibold mb-2", children: config.title || defaultTitle }),
|
|
621
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "text-text-500 text-sm", children: config.description || defaultDescription })
|
|
622
|
+
] });
|
|
623
|
+
};
|
|
624
|
+
var getEmptyStateContent = (config, defaultMessage, defaultButtonText, onButtonClick) => {
|
|
625
|
+
if (config?.component) {
|
|
626
|
+
return config.component;
|
|
627
|
+
}
|
|
628
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-col items-center justify-center gap-4", children: [
|
|
629
|
+
config?.image && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
630
|
+
"img",
|
|
631
|
+
{
|
|
632
|
+
src: config.image,
|
|
633
|
+
alt: "Empty state",
|
|
634
|
+
className: "w-auto h-auto max-w-full"
|
|
635
|
+
}
|
|
636
|
+
),
|
|
637
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "text-text-600 text-base font-normal", children: config?.message || defaultMessage }),
|
|
638
|
+
(config?.onButtonClick || onButtonClick) && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
639
|
+
Button_default,
|
|
640
|
+
{
|
|
641
|
+
variant: "solid",
|
|
642
|
+
action: "primary",
|
|
643
|
+
size: "medium",
|
|
644
|
+
onClick: config?.onButtonClick || onButtonClick,
|
|
645
|
+
children: config?.buttonText || defaultButtonText
|
|
646
|
+
}
|
|
647
|
+
)
|
|
648
|
+
] });
|
|
649
|
+
};
|
|
650
|
+
var renderTableWrapper = (variant, tableRef, className, children, stateContent, tableProps) => {
|
|
651
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
652
|
+
"div",
|
|
653
|
+
{
|
|
654
|
+
className: cn(
|
|
655
|
+
"relative w-full overflow-x-auto",
|
|
656
|
+
variant === "default" && "border border-border-200 rounded-xl"
|
|
657
|
+
),
|
|
658
|
+
children: [
|
|
659
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
660
|
+
"table",
|
|
661
|
+
{
|
|
662
|
+
ref: tableRef,
|
|
663
|
+
className: cn(
|
|
664
|
+
"analytica-table w-full caption-bottom text-sm border-separate border-spacing-0",
|
|
665
|
+
className
|
|
666
|
+
),
|
|
667
|
+
...tableProps,
|
|
668
|
+
children: renderHeaderElements(children)
|
|
669
|
+
}
|
|
670
|
+
),
|
|
671
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "py-8 flex justify-center", children: stateContent })
|
|
672
|
+
]
|
|
673
|
+
}
|
|
674
|
+
);
|
|
675
|
+
};
|
|
676
|
+
var Table = (0, import_react3.forwardRef)(
|
|
677
|
+
({
|
|
678
|
+
variant = "default",
|
|
679
|
+
className,
|
|
680
|
+
children,
|
|
681
|
+
showLoading = false,
|
|
682
|
+
loadingState,
|
|
683
|
+
showNoSearchResult = false,
|
|
684
|
+
noSearchResultState,
|
|
685
|
+
showEmpty = false,
|
|
686
|
+
emptyState,
|
|
687
|
+
...props
|
|
688
|
+
}, ref) => {
|
|
689
|
+
const defaultNoSearchResultState = {
|
|
690
|
+
title: "Nenhum resultado encontrado",
|
|
691
|
+
description: "N\xE3o encontramos nenhum resultado com esse nome. Tente revisar a busca ou usar outra palavra-chave."
|
|
692
|
+
};
|
|
693
|
+
const defaultEmptyState = {
|
|
694
|
+
message: "Nenhum dado dispon\xEDvel no momento.",
|
|
695
|
+
buttonText: "Adicionar item"
|
|
696
|
+
};
|
|
697
|
+
const finalNoSearchResultState = noSearchResultState || defaultNoSearchResultState;
|
|
698
|
+
const finalEmptyState = emptyState || defaultEmptyState;
|
|
699
|
+
if (showLoading) {
|
|
700
|
+
const loadingContent = loadingState?.component || /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SkeletonTable, { rows: 5, columns: 4, showHeader: false });
|
|
701
|
+
return renderTableWrapper(
|
|
702
|
+
variant,
|
|
703
|
+
ref,
|
|
704
|
+
className,
|
|
705
|
+
children,
|
|
706
|
+
loadingContent,
|
|
707
|
+
props
|
|
708
|
+
);
|
|
709
|
+
}
|
|
710
|
+
if (showNoSearchResult) {
|
|
711
|
+
const noSearchContent = getNoSearchResultContent(
|
|
712
|
+
finalNoSearchResultState,
|
|
713
|
+
defaultNoSearchResultState.title || "",
|
|
714
|
+
defaultNoSearchResultState.description || ""
|
|
715
|
+
);
|
|
716
|
+
return renderTableWrapper(
|
|
717
|
+
variant,
|
|
718
|
+
ref,
|
|
719
|
+
className,
|
|
720
|
+
children,
|
|
721
|
+
noSearchContent,
|
|
722
|
+
props
|
|
723
|
+
);
|
|
724
|
+
}
|
|
725
|
+
if (showEmpty) {
|
|
726
|
+
const emptyContent = getEmptyStateContent(
|
|
727
|
+
finalEmptyState,
|
|
728
|
+
defaultEmptyState.message || "Nenhum dado dispon\xEDvel no momento.",
|
|
729
|
+
defaultEmptyState.buttonText || "Adicionar item"
|
|
730
|
+
);
|
|
731
|
+
return renderTableWrapper(
|
|
732
|
+
variant,
|
|
733
|
+
ref,
|
|
734
|
+
className,
|
|
735
|
+
children,
|
|
736
|
+
emptyContent,
|
|
737
|
+
props
|
|
738
|
+
);
|
|
739
|
+
}
|
|
740
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
553
741
|
"div",
|
|
554
742
|
{
|
|
555
743
|
className: cn(
|
|
556
744
|
"relative w-full overflow-x-auto",
|
|
557
745
|
variant === "default" && "border border-border-200 rounded-xl"
|
|
558
746
|
),
|
|
559
|
-
children: /* @__PURE__ */ (0,
|
|
747
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
560
748
|
"table",
|
|
561
749
|
{
|
|
562
750
|
ref,
|
|
@@ -568,10 +756,10 @@ var Table = (0, import_react2.forwardRef)(
|
|
|
568
756
|
),
|
|
569
757
|
...props,
|
|
570
758
|
children: [
|
|
571
|
-
!
|
|
572
|
-
(child) => (0,
|
|
573
|
-
) && /* @__PURE__ */ (0,
|
|
574
|
-
|
|
759
|
+
!import_react3.Children.toArray(children).some(
|
|
760
|
+
(child) => (0, import_react3.isValidElement)(child) && child.type === TableCaption
|
|
761
|
+
) && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("caption", { className: "sr-only", children: "My Table" }),
|
|
762
|
+
children
|
|
575
763
|
]
|
|
576
764
|
}
|
|
577
765
|
)
|
|
@@ -580,7 +768,7 @@ var Table = (0, import_react2.forwardRef)(
|
|
|
580
768
|
}
|
|
581
769
|
);
|
|
582
770
|
Table.displayName = "Table";
|
|
583
|
-
var TableHeader = (0,
|
|
771
|
+
var TableHeader = (0, import_react3.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
584
772
|
"thead",
|
|
585
773
|
{
|
|
586
774
|
ref,
|
|
@@ -589,8 +777,8 @@ var TableHeader = (0, import_react2.forwardRef)(({ className, ...props }, ref) =
|
|
|
589
777
|
}
|
|
590
778
|
));
|
|
591
779
|
TableHeader.displayName = "TableHeader";
|
|
592
|
-
var TableBody = (0,
|
|
593
|
-
({ className, variant = "default", ...props }, ref) => /* @__PURE__ */ (0,
|
|
780
|
+
var TableBody = (0, import_react3.forwardRef)(
|
|
781
|
+
({ className, variant = "default", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
594
782
|
"tbody",
|
|
595
783
|
{
|
|
596
784
|
ref,
|
|
@@ -604,8 +792,8 @@ var TableBody = (0, import_react2.forwardRef)(
|
|
|
604
792
|
)
|
|
605
793
|
);
|
|
606
794
|
TableBody.displayName = "TableBody";
|
|
607
|
-
var TableFooter = (0,
|
|
608
|
-
({ variant = "default", className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
795
|
+
var TableFooter = (0, import_react3.forwardRef)(
|
|
796
|
+
({ variant = "default", className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
609
797
|
"tfoot",
|
|
610
798
|
{
|
|
611
799
|
ref,
|
|
@@ -641,7 +829,7 @@ var VARIANT_STATES_ROW = {
|
|
|
641
829
|
borderless: "bg-background-50 opacity-50 cursor-not-allowed"
|
|
642
830
|
}
|
|
643
831
|
};
|
|
644
|
-
var TableRow = (0,
|
|
832
|
+
var TableRow = (0, import_react3.forwardRef)(
|
|
645
833
|
({
|
|
646
834
|
variant = "default",
|
|
647
835
|
state = "default",
|
|
@@ -649,7 +837,7 @@ var TableRow = (0, import_react2.forwardRef)(
|
|
|
649
837
|
className,
|
|
650
838
|
...props
|
|
651
839
|
}, ref) => {
|
|
652
|
-
return /* @__PURE__ */ (0,
|
|
840
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
653
841
|
"tr",
|
|
654
842
|
{
|
|
655
843
|
ref,
|
|
@@ -667,7 +855,7 @@ var TableRow = (0, import_react2.forwardRef)(
|
|
|
667
855
|
}
|
|
668
856
|
);
|
|
669
857
|
TableRow.displayName = "TableRow";
|
|
670
|
-
var TableHead = (0,
|
|
858
|
+
var TableHead = (0, import_react3.forwardRef)(
|
|
671
859
|
({
|
|
672
860
|
className,
|
|
673
861
|
sortable = true,
|
|
@@ -681,7 +869,7 @@ var TableHead = (0, import_react2.forwardRef)(
|
|
|
681
869
|
onSort();
|
|
682
870
|
}
|
|
683
871
|
};
|
|
684
|
-
return /* @__PURE__ */ (0,
|
|
872
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
685
873
|
"th",
|
|
686
874
|
{
|
|
687
875
|
ref,
|
|
@@ -692,11 +880,11 @@ var TableHead = (0, import_react2.forwardRef)(
|
|
|
692
880
|
),
|
|
693
881
|
onClick: handleClick,
|
|
694
882
|
...props,
|
|
695
|
-
children: /* @__PURE__ */ (0,
|
|
883
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
696
884
|
children,
|
|
697
|
-
sortable && /* @__PURE__ */ (0,
|
|
698
|
-
sortDirection === "asc" && /* @__PURE__ */ (0,
|
|
699
|
-
sortDirection === "desc" && /* @__PURE__ */ (0,
|
|
885
|
+
sortable && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-col", children: [
|
|
886
|
+
sortDirection === "asc" && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_phosphor_react2.CaretUp, { size: 16, weight: "fill", className: "text-text-800" }),
|
|
887
|
+
sortDirection === "desc" && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_phosphor_react2.CaretDown, { size: 16, weight: "fill", className: "text-text-800" })
|
|
700
888
|
] })
|
|
701
889
|
] })
|
|
702
890
|
}
|
|
@@ -704,7 +892,7 @@ var TableHead = (0, import_react2.forwardRef)(
|
|
|
704
892
|
}
|
|
705
893
|
);
|
|
706
894
|
TableHead.displayName = "TableHead";
|
|
707
|
-
var TableCell = (0,
|
|
895
|
+
var TableCell = (0, import_react3.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
708
896
|
"td",
|
|
709
897
|
{
|
|
710
898
|
ref,
|
|
@@ -716,7 +904,7 @@ var TableCell = (0, import_react2.forwardRef)(({ className, ...props }, ref) =>
|
|
|
716
904
|
}
|
|
717
905
|
));
|
|
718
906
|
TableCell.displayName = "TableCell";
|
|
719
|
-
var TableCaption = (0,
|
|
907
|
+
var TableCaption = (0, import_react3.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
720
908
|
"caption",
|
|
721
909
|
{
|
|
722
910
|
ref,
|
|
@@ -732,7 +920,7 @@ var Table_default = Table;
|
|
|
732
920
|
|
|
733
921
|
// src/components/Badge/Badge.tsx
|
|
734
922
|
var import_phosphor_react3 = require("phosphor-react");
|
|
735
|
-
var
|
|
923
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
736
924
|
var VARIANT_ACTION_CLASSES2 = {
|
|
737
925
|
solid: {
|
|
738
926
|
error: "bg-error-background text-error-700 focus-visible:outline-none",
|
|
@@ -794,14 +982,14 @@ var Badge = ({
|
|
|
794
982
|
const baseClasses = "inline-flex items-center justify-center rounded-xs font-normal gap-1 relative";
|
|
795
983
|
const baseClassesIcon = "flex items-center";
|
|
796
984
|
if (variant === "notification") {
|
|
797
|
-
return /* @__PURE__ */ (0,
|
|
985
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
798
986
|
"div",
|
|
799
987
|
{
|
|
800
988
|
className: cn(baseClasses, variantClasses, sizeClasses, className),
|
|
801
989
|
...props,
|
|
802
990
|
children: [
|
|
803
|
-
/* @__PURE__ */ (0,
|
|
804
|
-
notificationActive && /* @__PURE__ */ (0,
|
|
991
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_phosphor_react3.Bell, { size: 24, className: "text-current", "aria-hidden": "true" }),
|
|
992
|
+
notificationActive && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
805
993
|
"span",
|
|
806
994
|
{
|
|
807
995
|
"data-testid": "notification-dot",
|
|
@@ -812,15 +1000,15 @@ var Badge = ({
|
|
|
812
1000
|
}
|
|
813
1001
|
);
|
|
814
1002
|
}
|
|
815
|
-
return /* @__PURE__ */ (0,
|
|
1003
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
816
1004
|
"div",
|
|
817
1005
|
{
|
|
818
1006
|
className: cn(baseClasses, variantClasses, sizeClasses, className),
|
|
819
1007
|
...props,
|
|
820
1008
|
children: [
|
|
821
|
-
iconLeft && /* @__PURE__ */ (0,
|
|
1009
|
+
iconLeft && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: cn(baseClassesIcon, sizeClassesIcon), children: iconLeft }),
|
|
822
1010
|
children,
|
|
823
|
-
iconRight && /* @__PURE__ */ (0,
|
|
1011
|
+
iconRight && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: cn(baseClassesIcon, sizeClassesIcon), children: iconRight })
|
|
824
1012
|
]
|
|
825
1013
|
}
|
|
826
1014
|
);
|
|
@@ -829,7 +1017,7 @@ var Badge_default = Badge;
|
|
|
829
1017
|
|
|
830
1018
|
// src/components/AlertManagerView/AlertsManagerView.tsx
|
|
831
1019
|
var import_phosphor_react4 = require("phosphor-react");
|
|
832
|
-
var
|
|
1020
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
833
1021
|
var AlertsManagerView = ({
|
|
834
1022
|
alertData,
|
|
835
1023
|
isOpen = false,
|
|
@@ -858,7 +1046,7 @@ var AlertsManagerView = ({
|
|
|
858
1046
|
year: "numeric"
|
|
859
1047
|
});
|
|
860
1048
|
};
|
|
861
|
-
return /* @__PURE__ */ (0,
|
|
1049
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
862
1050
|
Modal_default,
|
|
863
1051
|
{
|
|
864
1052
|
isOpen,
|
|
@@ -866,59 +1054,59 @@ var AlertsManagerView = ({
|
|
|
866
1054
|
title: alertData.title,
|
|
867
1055
|
size: "md",
|
|
868
1056
|
contentClassName: "p-0",
|
|
869
|
-
children: /* @__PURE__ */ (0,
|
|
870
|
-
/* @__PURE__ */ (0,
|
|
871
|
-
(imageLink || alertData.image || defaultImage) && /* @__PURE__ */ (0,
|
|
1057
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex flex-col h-[calc(100vh-8rem)] max-h-[700px]", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex-1 overflow-y-auto px-6 py-4", children: [
|
|
1058
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "bg-background-50 px-5 py-6 flex flex-col items-center gap-4 rounded-xl mb-4", children: [
|
|
1059
|
+
(imageLink || alertData.image || defaultImage) && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
872
1060
|
"img",
|
|
873
1061
|
{
|
|
874
1062
|
src: imageLink || alertData.image || defaultImage || void 0,
|
|
875
1063
|
alt: alertData.title || "Imagem do alerta"
|
|
876
1064
|
}
|
|
877
1065
|
),
|
|
878
|
-
/* @__PURE__ */ (0,
|
|
879
|
-
/* @__PURE__ */ (0,
|
|
880
|
-
/* @__PURE__ */ (0,
|
|
1066
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-col items-center text-center gap-3", children: [
|
|
1067
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text_default, { size: "lg", weight: "semibold", children: alertData.title || "Sem T\xEDtulo" }),
|
|
1068
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text_default, { size: "sm", weight: "normal", className: "text-text-500", children: alertData.message || "Sem mensagem" })
|
|
881
1069
|
] })
|
|
882
1070
|
] }),
|
|
883
|
-
/* @__PURE__ */ (0,
|
|
884
|
-
/* @__PURE__ */ (0,
|
|
885
|
-
/* @__PURE__ */ (0,
|
|
886
|
-
/* @__PURE__ */ (0,
|
|
1071
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Divider_default, { className: "my-4" }),
|
|
1072
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex justify-between items-center mb-4 px-2", children: [
|
|
1073
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text_default, { size: "sm", weight: "bold", className: "text-text-700", children: "Enviado em" }),
|
|
1074
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text_default, { size: "sm", weight: "medium", className: "text-text-900", children: formatDate(alertData.sentAt) })
|
|
887
1075
|
] }),
|
|
888
|
-
/* @__PURE__ */ (0,
|
|
889
|
-
/* @__PURE__ */ (0,
|
|
890
|
-
/* @__PURE__ */ (0,
|
|
891
|
-
/* @__PURE__ */ (0,
|
|
892
|
-
/* @__PURE__ */ (0,
|
|
1076
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Divider_default, { className: "my-4" }),
|
|
1077
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Table_default, { variant: "borderless", className: "table-fixed", children: [
|
|
1078
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TableHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(TableRow, { variant: "borderless", children: [
|
|
1079
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TableHead, { className: "py-2 px-3.5 text-start", children: "Destinat\xE1rio" }),
|
|
1080
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TableHead, { className: "py-2 px-3.5 w-[120px] text-start", children: "Status" })
|
|
893
1081
|
] }) }),
|
|
894
|
-
/* @__PURE__ */ (0,
|
|
895
|
-
/* @__PURE__ */ (0,
|
|
896
|
-
/* @__PURE__ */ (0,
|
|
1082
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TableBody, { variant: "borderless", children: paginatedRecipients.map((recipient) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(TableRow, { children: [
|
|
1083
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(TableCell, { className: "py-2 px-3.5 flex flex-row gap-2 text-start truncate", children: [
|
|
1084
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "rounded-full size-6 bg-primary-100 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_phosphor_react4.User, { className: "text-primary-950", size: 18 }) }),
|
|
897
1085
|
recipient.name
|
|
898
1086
|
] }),
|
|
899
|
-
/* @__PURE__ */ (0,
|
|
1087
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TableCell, { className: "py-2 px-3.5 text-center", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex justify-center items-center gap-1", children: recipient.status === "viewed" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Badge_default, { variant: "solid", action: "success", children: "Visualizado" }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Badge_default, { variant: "solid", action: "error", children: "Pendente" }) }) })
|
|
900
1088
|
] }, recipient.id)) })
|
|
901
1089
|
] }) }),
|
|
902
|
-
totalPages > 1 && /* @__PURE__ */ (0,
|
|
903
|
-
/* @__PURE__ */ (0,
|
|
1090
|
+
totalPages > 1 && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex justify-end items-center gap-2 bg-background-50 border border-border-200 py-3.5 px-2 rounded-b-2xl", children: [
|
|
1091
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text_default, { size: "sm", className: "text-text-600", children: [
|
|
904
1092
|
"P\xE1gina ",
|
|
905
1093
|
effectiveCurrentPage,
|
|
906
1094
|
" de ",
|
|
907
1095
|
totalPages
|
|
908
1096
|
] }),
|
|
909
|
-
/* @__PURE__ */ (0,
|
|
910
|
-
/* @__PURE__ */ (0,
|
|
1097
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex gap-2", children: onPageChange ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
1098
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
911
1099
|
Button_default,
|
|
912
1100
|
{
|
|
913
1101
|
variant: "link",
|
|
914
1102
|
size: "extra-small",
|
|
915
1103
|
onClick: () => onPageChange(Math.max(1, effectiveCurrentPage - 1)),
|
|
916
1104
|
disabled: effectiveCurrentPage === 1,
|
|
917
|
-
iconLeft: /* @__PURE__ */ (0,
|
|
1105
|
+
iconLeft: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_phosphor_react4.CaretLeft, {}),
|
|
918
1106
|
children: "Anterior"
|
|
919
1107
|
}
|
|
920
1108
|
),
|
|
921
|
-
/* @__PURE__ */ (0,
|
|
1109
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
922
1110
|
Button_default,
|
|
923
1111
|
{
|
|
924
1112
|
variant: "link",
|
|
@@ -927,28 +1115,28 @@ var AlertsManagerView = ({
|
|
|
927
1115
|
Math.min(totalPages, effectiveCurrentPage + 1)
|
|
928
1116
|
),
|
|
929
1117
|
disabled: effectiveCurrentPage === totalPages,
|
|
930
|
-
iconRight: /* @__PURE__ */ (0,
|
|
1118
|
+
iconRight: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_phosphor_react4.CaretRight, {}),
|
|
931
1119
|
children: "Pr\xF3ximo"
|
|
932
1120
|
}
|
|
933
1121
|
)
|
|
934
|
-
] }) : /* @__PURE__ */ (0,
|
|
935
|
-
/* @__PURE__ */ (0,
|
|
1122
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
1123
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
936
1124
|
Button_default,
|
|
937
1125
|
{
|
|
938
1126
|
variant: "link",
|
|
939
1127
|
size: "extra-small",
|
|
940
1128
|
disabled: effectiveCurrentPage === 1,
|
|
941
|
-
iconLeft: /* @__PURE__ */ (0,
|
|
1129
|
+
iconLeft: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_phosphor_react4.CaretLeft, {}),
|
|
942
1130
|
children: "Anterior"
|
|
943
1131
|
}
|
|
944
1132
|
),
|
|
945
|
-
/* @__PURE__ */ (0,
|
|
1133
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
946
1134
|
Button_default,
|
|
947
1135
|
{
|
|
948
1136
|
variant: "link",
|
|
949
1137
|
size: "extra-small",
|
|
950
1138
|
disabled: effectiveCurrentPage === totalPages,
|
|
951
|
-
iconRight: /* @__PURE__ */ (0,
|
|
1139
|
+
iconRight: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_phosphor_react4.CaretRight, {}),
|
|
952
1140
|
children: "Pr\xF3ximo"
|
|
953
1141
|
}
|
|
954
1142
|
)
|