@motor-hero/ui-kit 0.14.2 → 0.15.0
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/components/mobile-card-list.d.ts +1 -1
- package/dist/components/mobile-card-list.d.ts.map +1 -1
- package/dist/components/password-input.d.ts +7 -0
- package/dist/components/password-input.d.ts.map +1 -0
- package/dist/index.cjs +179 -115
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +169 -106
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/mobile-card-list.tsx +40 -2
- package/src/components/password-input.tsx +35 -0
- package/src/index.ts +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mobile-card-list.d.ts","sourceRoot":"","sources":["../../src/components/mobile-card-list.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"mobile-card-list.d.ts","sourceRoot":"","sources":["../../src/components/mobile-card-list.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,SAAS,EAA2B,MAAM,OAAO,CAAA;AAEhF,UAAU,mBAAmB,CAAC,CAAC;IAC7B,IAAI,EAAE,CAAC,EAAE,CAAA;IACT,UAAU,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,SAAS,CAAA;IACjD,YAAY,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,CAAA;IACjC,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAKD,wBAAgB,cAAc,CAAC,CAAC,EAAE,EAChC,IAAI,EACJ,UAAU,EACV,YAAY,EACZ,SAAiB,EACjB,YAAgB,EAChB,SAAS,GACV,EAAE,mBAAmB,CAAC,CAAC,CAAC,+BAsExB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
interface PasswordInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "type"> {
|
|
3
|
+
containerClassName?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare const PasswordInput: React.ForwardRefExoticComponent<PasswordInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=password-input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"password-input.d.ts","sourceRoot":"","sources":["../../src/components/password-input.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,UAAU,kBACR,SAAQ,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACjE,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC5B;AAED,eAAO,MAAM,aAAa,6FAyBxB,CAAA"}
|
package/dist/index.cjs
CHANGED
|
@@ -42,6 +42,7 @@ __export(index_exports, {
|
|
|
42
42
|
ModeToggle: () => ModeToggle,
|
|
43
43
|
PageHeader: () => PageHeader,
|
|
44
44
|
Pagination: () => Pagination,
|
|
45
|
+
PasswordInput: () => PasswordInput,
|
|
45
46
|
ProgressBar: () => ProgressBar,
|
|
46
47
|
ResponsiveDataView: () => ResponsiveDataView,
|
|
47
48
|
RowActionsMenu: () => RowActionsMenu,
|
|
@@ -577,31 +578,62 @@ var SearchInput = React2.forwardRef(
|
|
|
577
578
|
);
|
|
578
579
|
SearchInput.displayName = "SearchInput";
|
|
579
580
|
|
|
580
|
-
// src/components/
|
|
581
|
+
// src/components/password-input.tsx
|
|
582
|
+
var import_lucide_react3 = require("lucide-react");
|
|
583
|
+
var React3 = __toESM(require("react"), 1);
|
|
581
584
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
585
|
+
var PasswordInput = React3.forwardRef(({ containerClassName, className, ...props }, ref) => {
|
|
586
|
+
const [visible, setVisible] = React3.useState(false);
|
|
587
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: `relative ${containerClassName ?? ""}`, children: [
|
|
588
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
589
|
+
"input",
|
|
590
|
+
{
|
|
591
|
+
ref,
|
|
592
|
+
type: visible ? "text" : "password",
|
|
593
|
+
className: `flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 pr-10 text-base shadow-sm transition-all duration-200 placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:focus-visible:ring-destructive md:text-sm ${className ?? ""}`,
|
|
594
|
+
...props
|
|
595
|
+
}
|
|
596
|
+
),
|
|
597
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
598
|
+
"button",
|
|
599
|
+
{
|
|
600
|
+
type: "button",
|
|
601
|
+
onClick: () => setVisible((prev) => !prev),
|
|
602
|
+
"aria-label": visible ? "Ocultar senha" : "Mostrar senha",
|
|
603
|
+
tabIndex: -1,
|
|
604
|
+
className: "absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground transition-colors hover:text-foreground",
|
|
605
|
+
children: visible ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react3.EyeOff, { className: "h-4 w-4" }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react3.Eye, { className: "h-4 w-4" })
|
|
606
|
+
}
|
|
607
|
+
)
|
|
608
|
+
] });
|
|
609
|
+
});
|
|
610
|
+
PasswordInput.displayName = "PasswordInput";
|
|
611
|
+
|
|
612
|
+
// src/components/stat-card.tsx
|
|
613
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
582
614
|
function StatCard({ label, value, detail, icon, isLoading }) {
|
|
583
615
|
if (isLoading) {
|
|
584
|
-
return /* @__PURE__ */ (0,
|
|
585
|
-
/* @__PURE__ */ (0,
|
|
586
|
-
/* @__PURE__ */ (0,
|
|
587
|
-
/* @__PURE__ */ (0,
|
|
616
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "rounded-lg border bg-card p-6 shadow-sm", children: [
|
|
617
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center justify-between pb-2", children: [
|
|
618
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "h-4 w-24 animate-pulse rounded bg-muted" }),
|
|
619
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "h-4 w-4 animate-pulse rounded bg-muted" })
|
|
588
620
|
] }),
|
|
589
|
-
/* @__PURE__ */ (0,
|
|
590
|
-
/* @__PURE__ */ (0,
|
|
621
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "mt-2 h-7 w-16 animate-pulse rounded bg-muted" }),
|
|
622
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "mt-1 h-4 w-20 animate-pulse rounded bg-muted" })
|
|
591
623
|
] });
|
|
592
624
|
}
|
|
593
|
-
return /* @__PURE__ */ (0,
|
|
594
|
-
/* @__PURE__ */ (0,
|
|
595
|
-
/* @__PURE__ */ (0,
|
|
596
|
-
icon && /* @__PURE__ */ (0,
|
|
625
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "rounded-lg border bg-card p-6 shadow-sm", children: [
|
|
626
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center justify-between pb-2", children: [
|
|
627
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-sm font-medium text-muted-foreground", children: label }),
|
|
628
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-muted-foreground", children: icon })
|
|
597
629
|
] }),
|
|
598
|
-
/* @__PURE__ */ (0,
|
|
599
|
-
detail && /* @__PURE__ */ (0,
|
|
630
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "text-2xl font-bold", children: value }),
|
|
631
|
+
detail && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-xs text-muted-foreground", children: detail })
|
|
600
632
|
] });
|
|
601
633
|
}
|
|
602
634
|
|
|
603
635
|
// src/components/data-table-wrapper.tsx
|
|
604
|
-
var
|
|
636
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
605
637
|
function DataTableWrapper({
|
|
606
638
|
children,
|
|
607
639
|
isEmpty,
|
|
@@ -614,15 +646,15 @@ function DataTableWrapper({
|
|
|
614
646
|
hasNextPage = false,
|
|
615
647
|
hasPreviousPage = false
|
|
616
648
|
}) {
|
|
617
|
-
return /* @__PURE__ */ (0,
|
|
618
|
-
/* @__PURE__ */ (0,
|
|
619
|
-
!isLoading && isEmpty && /* @__PURE__ */ (0,
|
|
620
|
-
emptyIcon && /* @__PURE__ */ (0,
|
|
621
|
-
/* @__PURE__ */ (0,
|
|
622
|
-
emptyDescription && /* @__PURE__ */ (0,
|
|
649
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "space-y-4", children: [
|
|
650
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "overflow-x-auto rounded-md border", children }),
|
|
651
|
+
!isLoading && isEmpty && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-col items-center justify-center py-16 text-center", children: [
|
|
652
|
+
emptyIcon && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "mb-4 text-muted-foreground", children: emptyIcon }),
|
|
653
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("h3", { className: "text-lg font-semibold tracking-tight", children: emptyTitle }),
|
|
654
|
+
emptyDescription && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "mt-1 max-w-sm text-sm text-muted-foreground", children: emptyDescription })
|
|
623
655
|
] }),
|
|
624
|
-
page !== void 0 && onPageChange && /* @__PURE__ */ (0,
|
|
625
|
-
/* @__PURE__ */ (0,
|
|
656
|
+
page !== void 0 && onPageChange && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center justify-end gap-4", children: [
|
|
657
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
626
658
|
"button",
|
|
627
659
|
{
|
|
628
660
|
type: "button",
|
|
@@ -632,11 +664,11 @@ function DataTableWrapper({
|
|
|
632
664
|
children: "Anterior"
|
|
633
665
|
}
|
|
634
666
|
),
|
|
635
|
-
/* @__PURE__ */ (0,
|
|
667
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "text-sm text-muted-foreground", children: [
|
|
636
668
|
"P\xE1gina ",
|
|
637
669
|
page
|
|
638
670
|
] }),
|
|
639
|
-
/* @__PURE__ */ (0,
|
|
671
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
640
672
|
"button",
|
|
641
673
|
{
|
|
642
674
|
type: "button",
|
|
@@ -651,7 +683,9 @@ function DataTableWrapper({
|
|
|
651
683
|
}
|
|
652
684
|
|
|
653
685
|
// src/components/mobile-card-list.tsx
|
|
654
|
-
var
|
|
686
|
+
var import_react3 = require("react");
|
|
687
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
688
|
+
var SCROLL_THRESHOLD = 8;
|
|
655
689
|
function MobileCardList({
|
|
656
690
|
data,
|
|
657
691
|
renderCard,
|
|
@@ -660,31 +694,60 @@ function MobileCardList({
|
|
|
660
694
|
loadingCount = 5,
|
|
661
695
|
className
|
|
662
696
|
}) {
|
|
697
|
+
const start = (0, import_react3.useRef)(null);
|
|
698
|
+
const scrolled = (0, import_react3.useRef)(false);
|
|
699
|
+
const onTouchStart = (e) => {
|
|
700
|
+
const t = e.touches[0];
|
|
701
|
+
start.current = { x: t.clientX, y: t.clientY };
|
|
702
|
+
scrolled.current = false;
|
|
703
|
+
};
|
|
704
|
+
const onTouchMove = (e) => {
|
|
705
|
+
if (!start.current) return;
|
|
706
|
+
const t = e.touches[0];
|
|
707
|
+
if (Math.abs(t.clientX - start.current.x) > SCROLL_THRESHOLD || Math.abs(t.clientY - start.current.y) > SCROLL_THRESHOLD) {
|
|
708
|
+
scrolled.current = true;
|
|
709
|
+
}
|
|
710
|
+
};
|
|
711
|
+
const onClickCapture = (e) => {
|
|
712
|
+
if (scrolled.current) {
|
|
713
|
+
e.preventDefault();
|
|
714
|
+
e.stopPropagation();
|
|
715
|
+
}
|
|
716
|
+
};
|
|
663
717
|
if (isLoading) {
|
|
664
|
-
return /* @__PURE__ */ (0,
|
|
665
|
-
/* @__PURE__ */ (0,
|
|
666
|
-
/* @__PURE__ */ (0,
|
|
667
|
-
/* @__PURE__ */ (0,
|
|
718
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: `space-y-3 ${className ?? ""}`, children: Array.from({ length: loadingCount }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "rounded-xl border p-4", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "space-y-3", children: [
|
|
719
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex justify-between", children: [
|
|
720
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "h-5 w-32 animate-pulse rounded bg-muted" }),
|
|
721
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "h-5 w-16 animate-pulse rounded bg-muted" })
|
|
668
722
|
] }),
|
|
669
|
-
/* @__PURE__ */ (0,
|
|
670
|
-
/* @__PURE__ */ (0,
|
|
671
|
-
/* @__PURE__ */ (0,
|
|
672
|
-
/* @__PURE__ */ (0,
|
|
723
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "h-4 w-48 animate-pulse rounded bg-muted" }),
|
|
724
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex justify-between", children: [
|
|
725
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "h-4 w-24 animate-pulse rounded bg-muted" }),
|
|
726
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "h-4 w-20 animate-pulse rounded bg-muted" })
|
|
673
727
|
] })
|
|
674
728
|
] }) }, i)) });
|
|
675
729
|
}
|
|
676
|
-
return /* @__PURE__ */ (0,
|
|
730
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
677
731
|
"div",
|
|
678
732
|
{
|
|
679
|
-
className:
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
733
|
+
className: `space-y-3 ${className ?? ""}`,
|
|
734
|
+
onTouchStart,
|
|
735
|
+
onTouchMove,
|
|
736
|
+
onClickCapture,
|
|
737
|
+
children: data.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
738
|
+
"div",
|
|
739
|
+
{
|
|
740
|
+
className: "rounded-xl border p-4 transition-all duration-150 hover:border-foreground/20 active:scale-[0.99]",
|
|
741
|
+
children: renderCard(item, index)
|
|
742
|
+
},
|
|
743
|
+
keyExtractor(item)
|
|
744
|
+
))
|
|
745
|
+
}
|
|
746
|
+
);
|
|
684
747
|
}
|
|
685
748
|
|
|
686
749
|
// src/components/responsive-data-view.tsx
|
|
687
|
-
var
|
|
750
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
688
751
|
function ResponsiveDataView({
|
|
689
752
|
table,
|
|
690
753
|
cards,
|
|
@@ -695,13 +758,13 @@ function ResponsiveDataView({
|
|
|
695
758
|
emptyDescription,
|
|
696
759
|
pagination
|
|
697
760
|
}) {
|
|
698
|
-
return /* @__PURE__ */ (0,
|
|
699
|
-
/* @__PURE__ */ (0,
|
|
700
|
-
/* @__PURE__ */ (0,
|
|
701
|
-
!isLoading && isEmpty && /* @__PURE__ */ (0,
|
|
702
|
-
emptyIcon && /* @__PURE__ */ (0,
|
|
703
|
-
/* @__PURE__ */ (0,
|
|
704
|
-
emptyDescription && /* @__PURE__ */ (0,
|
|
761
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "space-y-4", children: [
|
|
762
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "hidden overflow-x-auto rounded-md border md:block", children: table }),
|
|
763
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "md:hidden", children: cards }),
|
|
764
|
+
!isLoading && isEmpty && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-col items-center justify-center py-16 text-center", children: [
|
|
765
|
+
emptyIcon && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "mb-4 text-muted-foreground", children: emptyIcon }),
|
|
766
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("h3", { className: "text-lg font-semibold tracking-tight", children: emptyTitle }),
|
|
767
|
+
emptyDescription && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "mt-1 max-w-sm text-sm text-muted-foreground", children: emptyDescription })
|
|
705
768
|
] }),
|
|
706
769
|
pagination
|
|
707
770
|
] });
|
|
@@ -709,10 +772,10 @@ function ResponsiveDataView({
|
|
|
709
772
|
|
|
710
773
|
// src/components/toaster.tsx
|
|
711
774
|
var import_sonner = require("sonner");
|
|
712
|
-
var
|
|
775
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
713
776
|
function Toaster(props) {
|
|
714
777
|
const { theme = "system" } = useTheme();
|
|
715
|
-
return /* @__PURE__ */ (0,
|
|
778
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
716
779
|
import_sonner.Toaster,
|
|
717
780
|
{
|
|
718
781
|
theme,
|
|
@@ -733,18 +796,18 @@ function Toaster(props) {
|
|
|
733
796
|
}
|
|
734
797
|
|
|
735
798
|
// src/components/app-shell.tsx
|
|
736
|
-
var
|
|
737
|
-
var
|
|
799
|
+
var import_lucide_react5 = require("lucide-react");
|
|
800
|
+
var import_react5 = require("react");
|
|
738
801
|
|
|
739
802
|
// src/components/sidebar-nav.tsx
|
|
740
|
-
var
|
|
803
|
+
var import_react4 = require("react");
|
|
741
804
|
|
|
742
805
|
// src/components/types.tsx
|
|
743
|
-
var
|
|
744
|
-
var defaultRenderLink = ({ children, ...props }) => /* @__PURE__ */ (0,
|
|
806
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
807
|
+
var defaultRenderLink = ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("a", { ...props, children });
|
|
745
808
|
|
|
746
809
|
// src/components/sidebar-nav.tsx
|
|
747
|
-
var
|
|
810
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
748
811
|
function defaultIsActive(item, activePath) {
|
|
749
812
|
if (item.href === "/") return activePath === "/";
|
|
750
813
|
return activePath === item.href || activePath.startsWith(item.href + "/");
|
|
@@ -759,7 +822,7 @@ function SidebarNav({
|
|
|
759
822
|
onNavigate
|
|
760
823
|
}) {
|
|
761
824
|
const visible = items.filter((item) => !item.adminOnly || isAdmin);
|
|
762
|
-
return /* @__PURE__ */ (0,
|
|
825
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("nav", { className: "flex flex-col gap-1", children: visible.map((item) => {
|
|
763
826
|
const active = isActive(item, activePath);
|
|
764
827
|
const link = renderLink({
|
|
765
828
|
href: item.href,
|
|
@@ -771,19 +834,19 @@ function SidebarNav({
|
|
|
771
834
|
active ? "bg-accent text-accent-foreground font-semibold" : "text-muted-foreground hover:bg-accent hover:text-accent-foreground",
|
|
772
835
|
isCollapsed && "justify-center px-2"
|
|
773
836
|
),
|
|
774
|
-
children: /* @__PURE__ */ (0,
|
|
775
|
-
item.icon && /* @__PURE__ */ (0,
|
|
776
|
-
!isCollapsed && /* @__PURE__ */ (0,
|
|
837
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
838
|
+
item.icon && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "shrink-0", children: item.icon }),
|
|
839
|
+
!isCollapsed && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "truncate", children: item.label })
|
|
777
840
|
] })
|
|
778
841
|
});
|
|
779
|
-
return /* @__PURE__ */ (0,
|
|
842
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react4.Fragment, { children: link }, item.href);
|
|
780
843
|
}) });
|
|
781
844
|
}
|
|
782
845
|
|
|
783
846
|
// src/components/user-menu.tsx
|
|
784
847
|
var DropdownMenu2 = __toESM(require("@radix-ui/react-dropdown-menu"), 1);
|
|
785
|
-
var
|
|
786
|
-
var
|
|
848
|
+
var import_lucide_react4 = require("lucide-react");
|
|
849
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
787
850
|
function initials(user) {
|
|
788
851
|
const source = user?.name?.trim() || user?.email?.trim();
|
|
789
852
|
if (!source) return "";
|
|
@@ -801,44 +864,44 @@ function UserMenu({
|
|
|
801
864
|
align = "end"
|
|
802
865
|
}) {
|
|
803
866
|
const label = initials(user);
|
|
804
|
-
return /* @__PURE__ */ (0,
|
|
805
|
-
/* @__PURE__ */ (0,
|
|
867
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(DropdownMenu2.Root, { children: [
|
|
868
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DropdownMenu2.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
806
869
|
"button",
|
|
807
870
|
{
|
|
808
871
|
type: "button",
|
|
809
872
|
className: "inline-flex h-9 w-9 items-center justify-center overflow-hidden rounded-full border border-input bg-background text-xs font-semibold shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
810
873
|
"aria-label": "Menu do usu\xE1rio",
|
|
811
874
|
"data-testid": "user-menu",
|
|
812
|
-
children: user?.avatarUrl ? /* @__PURE__ */ (0,
|
|
875
|
+
children: user?.avatarUrl ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("img", { src: user.avatarUrl, alt: user.name ?? user.email ?? "Avatar", className: "h-full w-full object-cover" }) : label ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: label }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react4.User, { className: "h-4 w-4" })
|
|
813
876
|
}
|
|
814
877
|
) }),
|
|
815
|
-
/* @__PURE__ */ (0,
|
|
878
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DropdownMenu2.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
816
879
|
DropdownMenu2.Content,
|
|
817
880
|
{
|
|
818
881
|
align,
|
|
819
882
|
sideOffset: 6,
|
|
820
883
|
className: "z-50 min-w-[12rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95",
|
|
821
884
|
children: [
|
|
822
|
-
(user?.name || user?.email) && /* @__PURE__ */ (0,
|
|
823
|
-
/* @__PURE__ */ (0,
|
|
824
|
-
user.name && /* @__PURE__ */ (0,
|
|
825
|
-
user.email && /* @__PURE__ */ (0,
|
|
885
|
+
(user?.name || user?.email) && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
886
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "px-2 py-1.5", children: [
|
|
887
|
+
user.name && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "truncate text-sm font-medium", children: user.name }),
|
|
888
|
+
user.email && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "truncate text-xs text-muted-foreground", children: user.email })
|
|
826
889
|
] }),
|
|
827
|
-
/* @__PURE__ */ (0,
|
|
890
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DropdownMenu2.Separator, { className: "-mx-1 my-1 h-px bg-border" })
|
|
828
891
|
] }),
|
|
829
892
|
items.map(
|
|
830
|
-
(item) => item.href ? /* @__PURE__ */ (0,
|
|
893
|
+
(item) => item.href ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DropdownMenu2.Item, { asChild: true, children: renderLink({ href: item.href, className: itemClass, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
831
894
|
item.icon,
|
|
832
895
|
item.label
|
|
833
|
-
] }) }) }, item.label) : /* @__PURE__ */ (0,
|
|
896
|
+
] }) }) }, item.label) : /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(DropdownMenu2.Item, { className: itemClass, onClick: item.onClick, children: [
|
|
834
897
|
item.icon,
|
|
835
898
|
item.label
|
|
836
899
|
] }, item.label)
|
|
837
900
|
),
|
|
838
|
-
onLogout && /* @__PURE__ */ (0,
|
|
839
|
-
items.length > 0 && /* @__PURE__ */ (0,
|
|
840
|
-
/* @__PURE__ */ (0,
|
|
841
|
-
/* @__PURE__ */ (0,
|
|
901
|
+
onLogout && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
902
|
+
items.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DropdownMenu2.Separator, { className: "-mx-1 my-1 h-px bg-border" }),
|
|
903
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(DropdownMenu2.Item, { className: cn(itemClass, "text-destructive focus:bg-destructive/10"), onClick: onLogout, children: [
|
|
904
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react4.LogOut, { className: "h-4 w-4" }),
|
|
842
905
|
logoutLabel
|
|
843
906
|
] })
|
|
844
907
|
] })
|
|
@@ -849,7 +912,7 @@ function UserMenu({
|
|
|
849
912
|
}
|
|
850
913
|
|
|
851
914
|
// src/components/app-shell.tsx
|
|
852
|
-
var
|
|
915
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
853
916
|
function AppShell({
|
|
854
917
|
brand,
|
|
855
918
|
brandCollapsed,
|
|
@@ -866,9 +929,9 @@ function AppShell({
|
|
|
866
929
|
defaultCollapsed = false,
|
|
867
930
|
children
|
|
868
931
|
}) {
|
|
869
|
-
const [collapsed, setCollapsed] = (0,
|
|
870
|
-
const [mobileOpen, setMobileOpen] = (0,
|
|
871
|
-
const nav = (isCollapsed, onNavigate) => /* @__PURE__ */ (0,
|
|
932
|
+
const [collapsed, setCollapsed] = (0, import_react5.useState)(defaultCollapsed);
|
|
933
|
+
const [mobileOpen, setMobileOpen] = (0, import_react5.useState)(false);
|
|
934
|
+
const nav = (isCollapsed, onNavigate) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
872
935
|
SidebarNav,
|
|
873
936
|
{
|
|
874
937
|
items: navItems,
|
|
@@ -880,8 +943,8 @@ function AppShell({
|
|
|
880
943
|
onNavigate
|
|
881
944
|
}
|
|
882
945
|
);
|
|
883
|
-
return /* @__PURE__ */ (0,
|
|
884
|
-
/* @__PURE__ */ (0,
|
|
946
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex h-screen overflow-hidden bg-background", children: [
|
|
947
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
885
948
|
"aside",
|
|
886
949
|
{
|
|
887
950
|
className: cn(
|
|
@@ -889,22 +952,22 @@ function AppShell({
|
|
|
889
952
|
collapsed ? "w-16" : "w-60"
|
|
890
953
|
),
|
|
891
954
|
children: [
|
|
892
|
-
/* @__PURE__ */ (0,
|
|
893
|
-
/* @__PURE__ */ (0,
|
|
894
|
-
collapsible && /* @__PURE__ */ (0,
|
|
955
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex h-14 shrink-0 items-center border-b px-4", children: collapsed ? brandCollapsed ?? brand : brand }),
|
|
956
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex-1 overflow-y-auto px-2 py-4", children: nav(collapsed) }),
|
|
957
|
+
collapsible && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "border-t p-2", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
895
958
|
"button",
|
|
896
959
|
{
|
|
897
960
|
type: "button",
|
|
898
961
|
onClick: () => setCollapsed((v) => !v),
|
|
899
962
|
className: "flex w-full items-center justify-center rounded-md px-2 py-2 text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground",
|
|
900
963
|
"aria-label": collapsed ? "Expandir menu" : "Recolher menu",
|
|
901
|
-
children: collapsed ? /* @__PURE__ */ (0,
|
|
964
|
+
children: collapsed ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react5.ChevronRight, { className: "h-4 w-4" }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react5.ChevronLeft, { className: "h-4 w-4" })
|
|
902
965
|
}
|
|
903
966
|
) })
|
|
904
967
|
]
|
|
905
968
|
}
|
|
906
969
|
),
|
|
907
|
-
/* @__PURE__ */ (0,
|
|
970
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
908
971
|
"div",
|
|
909
972
|
{
|
|
910
973
|
className: cn(
|
|
@@ -913,8 +976,8 @@ function AppShell({
|
|
|
913
976
|
),
|
|
914
977
|
onClick: () => setMobileOpen(false),
|
|
915
978
|
children: [
|
|
916
|
-
/* @__PURE__ */ (0,
|
|
917
|
-
/* @__PURE__ */ (0,
|
|
979
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "absolute inset-0 bg-black/50" }),
|
|
980
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
918
981
|
"div",
|
|
919
982
|
{
|
|
920
983
|
className: cn(
|
|
@@ -923,40 +986,40 @@ function AppShell({
|
|
|
923
986
|
),
|
|
924
987
|
onClick: (e) => e.stopPropagation(),
|
|
925
988
|
children: [
|
|
926
|
-
/* @__PURE__ */ (0,
|
|
927
|
-
/* @__PURE__ */ (0,
|
|
989
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex h-14 shrink-0 items-center border-b px-4", children: brand }),
|
|
990
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex-1 overflow-y-auto px-2 py-4", children: nav(false, () => setMobileOpen(false)) })
|
|
928
991
|
]
|
|
929
992
|
}
|
|
930
993
|
)
|
|
931
994
|
]
|
|
932
995
|
}
|
|
933
996
|
),
|
|
934
|
-
/* @__PURE__ */ (0,
|
|
935
|
-
/* @__PURE__ */ (0,
|
|
936
|
-
/* @__PURE__ */ (0,
|
|
997
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-1 flex-col overflow-hidden", children: [
|
|
998
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("header", { className: "flex h-14 shrink-0 items-center gap-2 border-b bg-background px-4", children: [
|
|
999
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
937
1000
|
"button",
|
|
938
1001
|
{
|
|
939
1002
|
type: "button",
|
|
940
1003
|
onClick: () => setMobileOpen(true),
|
|
941
1004
|
className: "inline-flex h-9 w-9 items-center justify-center rounded-md border border-input bg-background shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground md:hidden",
|
|
942
1005
|
"aria-label": "Abrir menu",
|
|
943
|
-
children: /* @__PURE__ */ (0,
|
|
1006
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react5.Menu, { className: "h-4 w-4" })
|
|
944
1007
|
}
|
|
945
1008
|
),
|
|
946
|
-
/* @__PURE__ */ (0,
|
|
1009
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "ml-auto flex items-center gap-2", children: [
|
|
947
1010
|
headerActions,
|
|
948
|
-
(user || onLogout) && /* @__PURE__ */ (0,
|
|
1011
|
+
(user || onLogout) && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(UserMenu, { user, items: userMenuItems, onLogout, renderLink })
|
|
949
1012
|
] })
|
|
950
1013
|
] }),
|
|
951
|
-
/* @__PURE__ */ (0,
|
|
1014
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("main", { className: "flex-1 overflow-y-auto", children })
|
|
952
1015
|
] })
|
|
953
1016
|
] });
|
|
954
1017
|
}
|
|
955
1018
|
|
|
956
1019
|
// src/components/row-actions-menu.tsx
|
|
957
1020
|
var DropdownMenu3 = __toESM(require("@radix-ui/react-dropdown-menu"), 1);
|
|
958
|
-
var
|
|
959
|
-
var
|
|
1021
|
+
var import_lucide_react6 = require("lucide-react");
|
|
1022
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
960
1023
|
var itemClass2 = "flex w-full cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors hover:bg-accent focus:bg-accent data-[disabled]:pointer-events-none data-[disabled]:opacity-50";
|
|
961
1024
|
function RowActionsMenu({
|
|
962
1025
|
actions,
|
|
@@ -966,18 +1029,18 @@ function RowActionsMenu({
|
|
|
966
1029
|
renderLink = defaultRenderLink
|
|
967
1030
|
}) {
|
|
968
1031
|
if (actions.length === 0) return null;
|
|
969
|
-
return /* @__PURE__ */ (0,
|
|
970
|
-
/* @__PURE__ */ (0,
|
|
1032
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(DropdownMenu3.Root, { children: [
|
|
1033
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropdownMenu3.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
971
1034
|
"button",
|
|
972
1035
|
{
|
|
973
1036
|
type: "button",
|
|
974
1037
|
disabled,
|
|
975
1038
|
"aria-label": label,
|
|
976
1039
|
className: "inline-flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
|
|
977
|
-
children: /* @__PURE__ */ (0,
|
|
1040
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react6.MoreVertical, { className: "h-4 w-4" })
|
|
978
1041
|
}
|
|
979
1042
|
) }),
|
|
980
|
-
/* @__PURE__ */ (0,
|
|
1043
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropdownMenu3.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
981
1044
|
DropdownMenu3.Content,
|
|
982
1045
|
{
|
|
983
1046
|
align,
|
|
@@ -985,14 +1048,14 @@ function RowActionsMenu({
|
|
|
985
1048
|
className: "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95",
|
|
986
1049
|
children: actions.map((action) => {
|
|
987
1050
|
const cls = cn(itemClass2, action.destructive && "text-destructive focus:bg-destructive/10");
|
|
988
|
-
return action.href ? /* @__PURE__ */ (0,
|
|
1051
|
+
return action.href ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropdownMenu3.Item, { asChild: true, disabled: action.disabled, children: renderLink({
|
|
989
1052
|
href: action.href,
|
|
990
1053
|
className: cls,
|
|
991
|
-
children: /* @__PURE__ */ (0,
|
|
1054
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
992
1055
|
action.icon,
|
|
993
1056
|
action.label
|
|
994
1057
|
] })
|
|
995
|
-
}) }, action.label) : /* @__PURE__ */ (0,
|
|
1058
|
+
}) }, action.label) : /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
996
1059
|
DropdownMenu3.Item,
|
|
997
1060
|
{
|
|
998
1061
|
className: cls,
|
|
@@ -1021,20 +1084,20 @@ function extractApiError(err, fallbackMessage = "Ocorreu um erro inesperado.") {
|
|
|
1021
1084
|
}
|
|
1022
1085
|
|
|
1023
1086
|
// src/hooks/use-disclosure.ts
|
|
1024
|
-
var
|
|
1087
|
+
var import_react6 = require("react");
|
|
1025
1088
|
function useDisclosure(initial = false) {
|
|
1026
|
-
const [open, setOpen] = (0,
|
|
1027
|
-
const onOpen = (0,
|
|
1028
|
-
const onClose = (0,
|
|
1029
|
-
const onToggle = (0,
|
|
1089
|
+
const [open, setOpen] = (0, import_react6.useState)(initial);
|
|
1090
|
+
const onOpen = (0, import_react6.useCallback)(() => setOpen(true), []);
|
|
1091
|
+
const onClose = (0, import_react6.useCallback)(() => setOpen(false), []);
|
|
1092
|
+
const onToggle = (0, import_react6.useCallback)(() => setOpen((v) => !v), []);
|
|
1030
1093
|
return { open, onOpen, onClose, onToggle, setOpen };
|
|
1031
1094
|
}
|
|
1032
1095
|
|
|
1033
1096
|
// src/hooks/use-toast.ts
|
|
1034
1097
|
var import_sonner2 = require("sonner");
|
|
1035
|
-
var
|
|
1098
|
+
var import_react7 = require("react");
|
|
1036
1099
|
function useCustomToast() {
|
|
1037
|
-
const showToast = (0,
|
|
1100
|
+
const showToast = (0, import_react7.useCallback)(
|
|
1038
1101
|
(title, description, status = "success") => {
|
|
1039
1102
|
switch (status) {
|
|
1040
1103
|
case "success":
|
|
@@ -1069,6 +1132,7 @@ function useCustomToast() {
|
|
|
1069
1132
|
ModeToggle,
|
|
1070
1133
|
PageHeader,
|
|
1071
1134
|
Pagination,
|
|
1135
|
+
PasswordInput,
|
|
1072
1136
|
ProgressBar,
|
|
1073
1137
|
ResponsiveDataView,
|
|
1074
1138
|
RowActionsMenu,
|