@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
package/dist/index.js
CHANGED
|
@@ -511,31 +511,62 @@ var SearchInput = React2.forwardRef(
|
|
|
511
511
|
);
|
|
512
512
|
SearchInput.displayName = "SearchInput";
|
|
513
513
|
|
|
514
|
-
// src/components/
|
|
514
|
+
// src/components/password-input.tsx
|
|
515
|
+
import { Eye, EyeOff } from "lucide-react";
|
|
516
|
+
import * as React3 from "react";
|
|
515
517
|
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
518
|
+
var PasswordInput = React3.forwardRef(({ containerClassName, className, ...props }, ref) => {
|
|
519
|
+
const [visible, setVisible] = React3.useState(false);
|
|
520
|
+
return /* @__PURE__ */ jsxs13("div", { className: `relative ${containerClassName ?? ""}`, children: [
|
|
521
|
+
/* @__PURE__ */ jsx15(
|
|
522
|
+
"input",
|
|
523
|
+
{
|
|
524
|
+
ref,
|
|
525
|
+
type: visible ? "text" : "password",
|
|
526
|
+
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 ?? ""}`,
|
|
527
|
+
...props
|
|
528
|
+
}
|
|
529
|
+
),
|
|
530
|
+
/* @__PURE__ */ jsx15(
|
|
531
|
+
"button",
|
|
532
|
+
{
|
|
533
|
+
type: "button",
|
|
534
|
+
onClick: () => setVisible((prev) => !prev),
|
|
535
|
+
"aria-label": visible ? "Ocultar senha" : "Mostrar senha",
|
|
536
|
+
tabIndex: -1,
|
|
537
|
+
className: "absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground transition-colors hover:text-foreground",
|
|
538
|
+
children: visible ? /* @__PURE__ */ jsx15(EyeOff, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx15(Eye, { className: "h-4 w-4" })
|
|
539
|
+
}
|
|
540
|
+
)
|
|
541
|
+
] });
|
|
542
|
+
});
|
|
543
|
+
PasswordInput.displayName = "PasswordInput";
|
|
544
|
+
|
|
545
|
+
// src/components/stat-card.tsx
|
|
546
|
+
import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
516
547
|
function StatCard({ label, value, detail, icon, isLoading }) {
|
|
517
548
|
if (isLoading) {
|
|
518
|
-
return /* @__PURE__ */
|
|
519
|
-
/* @__PURE__ */
|
|
520
|
-
/* @__PURE__ */
|
|
521
|
-
/* @__PURE__ */
|
|
549
|
+
return /* @__PURE__ */ jsxs14("div", { className: "rounded-lg border bg-card p-6 shadow-sm", children: [
|
|
550
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex items-center justify-between pb-2", children: [
|
|
551
|
+
/* @__PURE__ */ jsx16("div", { className: "h-4 w-24 animate-pulse rounded bg-muted" }),
|
|
552
|
+
/* @__PURE__ */ jsx16("div", { className: "h-4 w-4 animate-pulse rounded bg-muted" })
|
|
522
553
|
] }),
|
|
523
|
-
/* @__PURE__ */
|
|
524
|
-
/* @__PURE__ */
|
|
554
|
+
/* @__PURE__ */ jsx16("div", { className: "mt-2 h-7 w-16 animate-pulse rounded bg-muted" }),
|
|
555
|
+
/* @__PURE__ */ jsx16("div", { className: "mt-1 h-4 w-20 animate-pulse rounded bg-muted" })
|
|
525
556
|
] });
|
|
526
557
|
}
|
|
527
|
-
return /* @__PURE__ */
|
|
528
|
-
/* @__PURE__ */
|
|
529
|
-
/* @__PURE__ */
|
|
530
|
-
icon && /* @__PURE__ */
|
|
558
|
+
return /* @__PURE__ */ jsxs14("div", { className: "rounded-lg border bg-card p-6 shadow-sm", children: [
|
|
559
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex items-center justify-between pb-2", children: [
|
|
560
|
+
/* @__PURE__ */ jsx16("span", { className: "text-sm font-medium text-muted-foreground", children: label }),
|
|
561
|
+
icon && /* @__PURE__ */ jsx16("span", { className: "text-muted-foreground", children: icon })
|
|
531
562
|
] }),
|
|
532
|
-
/* @__PURE__ */
|
|
533
|
-
detail && /* @__PURE__ */
|
|
563
|
+
/* @__PURE__ */ jsx16("div", { className: "text-2xl font-bold", children: value }),
|
|
564
|
+
detail && /* @__PURE__ */ jsx16("p", { className: "text-xs text-muted-foreground", children: detail })
|
|
534
565
|
] });
|
|
535
566
|
}
|
|
536
567
|
|
|
537
568
|
// src/components/data-table-wrapper.tsx
|
|
538
|
-
import { jsx as
|
|
569
|
+
import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
539
570
|
function DataTableWrapper({
|
|
540
571
|
children,
|
|
541
572
|
isEmpty,
|
|
@@ -548,15 +579,15 @@ function DataTableWrapper({
|
|
|
548
579
|
hasNextPage = false,
|
|
549
580
|
hasPreviousPage = false
|
|
550
581
|
}) {
|
|
551
|
-
return /* @__PURE__ */
|
|
552
|
-
/* @__PURE__ */
|
|
553
|
-
!isLoading && isEmpty && /* @__PURE__ */
|
|
554
|
-
emptyIcon && /* @__PURE__ */
|
|
555
|
-
/* @__PURE__ */
|
|
556
|
-
emptyDescription && /* @__PURE__ */
|
|
582
|
+
return /* @__PURE__ */ jsxs15("div", { className: "space-y-4", children: [
|
|
583
|
+
/* @__PURE__ */ jsx17("div", { className: "overflow-x-auto rounded-md border", children }),
|
|
584
|
+
!isLoading && isEmpty && /* @__PURE__ */ jsxs15("div", { className: "flex flex-col items-center justify-center py-16 text-center", children: [
|
|
585
|
+
emptyIcon && /* @__PURE__ */ jsx17("div", { className: "mb-4 text-muted-foreground", children: emptyIcon }),
|
|
586
|
+
/* @__PURE__ */ jsx17("h3", { className: "text-lg font-semibold tracking-tight", children: emptyTitle }),
|
|
587
|
+
emptyDescription && /* @__PURE__ */ jsx17("p", { className: "mt-1 max-w-sm text-sm text-muted-foreground", children: emptyDescription })
|
|
557
588
|
] }),
|
|
558
|
-
page !== void 0 && onPageChange && /* @__PURE__ */
|
|
559
|
-
/* @__PURE__ */
|
|
589
|
+
page !== void 0 && onPageChange && /* @__PURE__ */ jsxs15("div", { className: "flex items-center justify-end gap-4", children: [
|
|
590
|
+
/* @__PURE__ */ jsx17(
|
|
560
591
|
"button",
|
|
561
592
|
{
|
|
562
593
|
type: "button",
|
|
@@ -566,11 +597,11 @@ function DataTableWrapper({
|
|
|
566
597
|
children: "Anterior"
|
|
567
598
|
}
|
|
568
599
|
),
|
|
569
|
-
/* @__PURE__ */
|
|
600
|
+
/* @__PURE__ */ jsxs15("span", { className: "text-sm text-muted-foreground", children: [
|
|
570
601
|
"P\xE1gina ",
|
|
571
602
|
page
|
|
572
603
|
] }),
|
|
573
|
-
/* @__PURE__ */
|
|
604
|
+
/* @__PURE__ */ jsx17(
|
|
574
605
|
"button",
|
|
575
606
|
{
|
|
576
607
|
type: "button",
|
|
@@ -585,7 +616,9 @@ function DataTableWrapper({
|
|
|
585
616
|
}
|
|
586
617
|
|
|
587
618
|
// src/components/mobile-card-list.tsx
|
|
588
|
-
import {
|
|
619
|
+
import { useRef } from "react";
|
|
620
|
+
import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
621
|
+
var SCROLL_THRESHOLD = 8;
|
|
589
622
|
function MobileCardList({
|
|
590
623
|
data,
|
|
591
624
|
renderCard,
|
|
@@ -594,31 +627,60 @@ function MobileCardList({
|
|
|
594
627
|
loadingCount = 5,
|
|
595
628
|
className
|
|
596
629
|
}) {
|
|
630
|
+
const start = useRef(null);
|
|
631
|
+
const scrolled = useRef(false);
|
|
632
|
+
const onTouchStart = (e) => {
|
|
633
|
+
const t = e.touches[0];
|
|
634
|
+
start.current = { x: t.clientX, y: t.clientY };
|
|
635
|
+
scrolled.current = false;
|
|
636
|
+
};
|
|
637
|
+
const onTouchMove = (e) => {
|
|
638
|
+
if (!start.current) return;
|
|
639
|
+
const t = e.touches[0];
|
|
640
|
+
if (Math.abs(t.clientX - start.current.x) > SCROLL_THRESHOLD || Math.abs(t.clientY - start.current.y) > SCROLL_THRESHOLD) {
|
|
641
|
+
scrolled.current = true;
|
|
642
|
+
}
|
|
643
|
+
};
|
|
644
|
+
const onClickCapture = (e) => {
|
|
645
|
+
if (scrolled.current) {
|
|
646
|
+
e.preventDefault();
|
|
647
|
+
e.stopPropagation();
|
|
648
|
+
}
|
|
649
|
+
};
|
|
597
650
|
if (isLoading) {
|
|
598
|
-
return /* @__PURE__ */
|
|
599
|
-
/* @__PURE__ */
|
|
600
|
-
/* @__PURE__ */
|
|
601
|
-
/* @__PURE__ */
|
|
651
|
+
return /* @__PURE__ */ jsx18("div", { className: `space-y-3 ${className ?? ""}`, children: Array.from({ length: loadingCount }).map((_, i) => /* @__PURE__ */ jsx18("div", { className: "rounded-xl border p-4", children: /* @__PURE__ */ jsxs16("div", { className: "space-y-3", children: [
|
|
652
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex justify-between", children: [
|
|
653
|
+
/* @__PURE__ */ jsx18("div", { className: "h-5 w-32 animate-pulse rounded bg-muted" }),
|
|
654
|
+
/* @__PURE__ */ jsx18("div", { className: "h-5 w-16 animate-pulse rounded bg-muted" })
|
|
602
655
|
] }),
|
|
603
|
-
/* @__PURE__ */
|
|
604
|
-
/* @__PURE__ */
|
|
605
|
-
/* @__PURE__ */
|
|
606
|
-
/* @__PURE__ */
|
|
656
|
+
/* @__PURE__ */ jsx18("div", { className: "h-4 w-48 animate-pulse rounded bg-muted" }),
|
|
657
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex justify-between", children: [
|
|
658
|
+
/* @__PURE__ */ jsx18("div", { className: "h-4 w-24 animate-pulse rounded bg-muted" }),
|
|
659
|
+
/* @__PURE__ */ jsx18("div", { className: "h-4 w-20 animate-pulse rounded bg-muted" })
|
|
607
660
|
] })
|
|
608
661
|
] }) }, i)) });
|
|
609
662
|
}
|
|
610
|
-
return /* @__PURE__ */
|
|
663
|
+
return /* @__PURE__ */ jsx18(
|
|
611
664
|
"div",
|
|
612
665
|
{
|
|
613
|
-
className:
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
666
|
+
className: `space-y-3 ${className ?? ""}`,
|
|
667
|
+
onTouchStart,
|
|
668
|
+
onTouchMove,
|
|
669
|
+
onClickCapture,
|
|
670
|
+
children: data.map((item, index) => /* @__PURE__ */ jsx18(
|
|
671
|
+
"div",
|
|
672
|
+
{
|
|
673
|
+
className: "rounded-xl border p-4 transition-all duration-150 hover:border-foreground/20 active:scale-[0.99]",
|
|
674
|
+
children: renderCard(item, index)
|
|
675
|
+
},
|
|
676
|
+
keyExtractor(item)
|
|
677
|
+
))
|
|
678
|
+
}
|
|
679
|
+
);
|
|
618
680
|
}
|
|
619
681
|
|
|
620
682
|
// src/components/responsive-data-view.tsx
|
|
621
|
-
import { jsx as
|
|
683
|
+
import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
622
684
|
function ResponsiveDataView({
|
|
623
685
|
table,
|
|
624
686
|
cards,
|
|
@@ -629,13 +691,13 @@ function ResponsiveDataView({
|
|
|
629
691
|
emptyDescription,
|
|
630
692
|
pagination
|
|
631
693
|
}) {
|
|
632
|
-
return /* @__PURE__ */
|
|
633
|
-
/* @__PURE__ */
|
|
634
|
-
/* @__PURE__ */
|
|
635
|
-
!isLoading && isEmpty && /* @__PURE__ */
|
|
636
|
-
emptyIcon && /* @__PURE__ */
|
|
637
|
-
/* @__PURE__ */
|
|
638
|
-
emptyDescription && /* @__PURE__ */
|
|
694
|
+
return /* @__PURE__ */ jsxs17("div", { className: "space-y-4", children: [
|
|
695
|
+
/* @__PURE__ */ jsx19("div", { className: "hidden overflow-x-auto rounded-md border md:block", children: table }),
|
|
696
|
+
/* @__PURE__ */ jsx19("div", { className: "md:hidden", children: cards }),
|
|
697
|
+
!isLoading && isEmpty && /* @__PURE__ */ jsxs17("div", { className: "flex flex-col items-center justify-center py-16 text-center", children: [
|
|
698
|
+
emptyIcon && /* @__PURE__ */ jsx19("div", { className: "mb-4 text-muted-foreground", children: emptyIcon }),
|
|
699
|
+
/* @__PURE__ */ jsx19("h3", { className: "text-lg font-semibold tracking-tight", children: emptyTitle }),
|
|
700
|
+
emptyDescription && /* @__PURE__ */ jsx19("p", { className: "mt-1 max-w-sm text-sm text-muted-foreground", children: emptyDescription })
|
|
639
701
|
] }),
|
|
640
702
|
pagination
|
|
641
703
|
] });
|
|
@@ -643,10 +705,10 @@ function ResponsiveDataView({
|
|
|
643
705
|
|
|
644
706
|
// src/components/toaster.tsx
|
|
645
707
|
import { Toaster as Sonner } from "sonner";
|
|
646
|
-
import { jsx as
|
|
708
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
647
709
|
function Toaster(props) {
|
|
648
710
|
const { theme = "system" } = useTheme();
|
|
649
|
-
return /* @__PURE__ */
|
|
711
|
+
return /* @__PURE__ */ jsx20(
|
|
650
712
|
Sonner,
|
|
651
713
|
{
|
|
652
714
|
theme,
|
|
@@ -668,17 +730,17 @@ function Toaster(props) {
|
|
|
668
730
|
|
|
669
731
|
// src/components/app-shell.tsx
|
|
670
732
|
import { ChevronLeft, ChevronRight, Menu } from "lucide-react";
|
|
671
|
-
import { useState as
|
|
733
|
+
import { useState as useState3 } from "react";
|
|
672
734
|
|
|
673
735
|
// src/components/sidebar-nav.tsx
|
|
674
736
|
import { Fragment as Fragment3 } from "react";
|
|
675
737
|
|
|
676
738
|
// src/components/types.tsx
|
|
677
|
-
import { jsx as
|
|
678
|
-
var defaultRenderLink = ({ children, ...props }) => /* @__PURE__ */
|
|
739
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
740
|
+
var defaultRenderLink = ({ children, ...props }) => /* @__PURE__ */ jsx21("a", { ...props, children });
|
|
679
741
|
|
|
680
742
|
// src/components/sidebar-nav.tsx
|
|
681
|
-
import { Fragment as Fragment4, jsx as
|
|
743
|
+
import { Fragment as Fragment4, jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
682
744
|
function defaultIsActive(item, activePath) {
|
|
683
745
|
if (item.href === "/") return activePath === "/";
|
|
684
746
|
return activePath === item.href || activePath.startsWith(item.href + "/");
|
|
@@ -693,7 +755,7 @@ function SidebarNav({
|
|
|
693
755
|
onNavigate
|
|
694
756
|
}) {
|
|
695
757
|
const visible = items.filter((item) => !item.adminOnly || isAdmin);
|
|
696
|
-
return /* @__PURE__ */
|
|
758
|
+
return /* @__PURE__ */ jsx22("nav", { className: "flex flex-col gap-1", children: visible.map((item) => {
|
|
697
759
|
const active = isActive(item, activePath);
|
|
698
760
|
const link = renderLink({
|
|
699
761
|
href: item.href,
|
|
@@ -705,19 +767,19 @@ function SidebarNav({
|
|
|
705
767
|
active ? "bg-accent text-accent-foreground font-semibold" : "text-muted-foreground hover:bg-accent hover:text-accent-foreground",
|
|
706
768
|
isCollapsed && "justify-center px-2"
|
|
707
769
|
),
|
|
708
|
-
children: /* @__PURE__ */
|
|
709
|
-
item.icon && /* @__PURE__ */
|
|
710
|
-
!isCollapsed && /* @__PURE__ */
|
|
770
|
+
children: /* @__PURE__ */ jsxs18(Fragment4, { children: [
|
|
771
|
+
item.icon && /* @__PURE__ */ jsx22("span", { className: "shrink-0", children: item.icon }),
|
|
772
|
+
!isCollapsed && /* @__PURE__ */ jsx22("span", { className: "truncate", children: item.label })
|
|
711
773
|
] })
|
|
712
774
|
});
|
|
713
|
-
return /* @__PURE__ */
|
|
775
|
+
return /* @__PURE__ */ jsx22(Fragment3, { children: link }, item.href);
|
|
714
776
|
}) });
|
|
715
777
|
}
|
|
716
778
|
|
|
717
779
|
// src/components/user-menu.tsx
|
|
718
780
|
import * as DropdownMenu2 from "@radix-ui/react-dropdown-menu";
|
|
719
781
|
import { LogOut, User } from "lucide-react";
|
|
720
|
-
import { Fragment as Fragment5, jsx as
|
|
782
|
+
import { Fragment as Fragment5, jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
721
783
|
function initials(user) {
|
|
722
784
|
const source = user?.name?.trim() || user?.email?.trim();
|
|
723
785
|
if (!source) return "";
|
|
@@ -735,44 +797,44 @@ function UserMenu({
|
|
|
735
797
|
align = "end"
|
|
736
798
|
}) {
|
|
737
799
|
const label = initials(user);
|
|
738
|
-
return /* @__PURE__ */
|
|
739
|
-
/* @__PURE__ */
|
|
800
|
+
return /* @__PURE__ */ jsxs19(DropdownMenu2.Root, { children: [
|
|
801
|
+
/* @__PURE__ */ jsx23(DropdownMenu2.Trigger, { asChild: true, children: /* @__PURE__ */ jsx23(
|
|
740
802
|
"button",
|
|
741
803
|
{
|
|
742
804
|
type: "button",
|
|
743
805
|
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",
|
|
744
806
|
"aria-label": "Menu do usu\xE1rio",
|
|
745
807
|
"data-testid": "user-menu",
|
|
746
|
-
children: user?.avatarUrl ? /* @__PURE__ */
|
|
808
|
+
children: user?.avatarUrl ? /* @__PURE__ */ jsx23("img", { src: user.avatarUrl, alt: user.name ?? user.email ?? "Avatar", className: "h-full w-full object-cover" }) : label ? /* @__PURE__ */ jsx23("span", { children: label }) : /* @__PURE__ */ jsx23(User, { className: "h-4 w-4" })
|
|
747
809
|
}
|
|
748
810
|
) }),
|
|
749
|
-
/* @__PURE__ */
|
|
811
|
+
/* @__PURE__ */ jsx23(DropdownMenu2.Portal, { children: /* @__PURE__ */ jsxs19(
|
|
750
812
|
DropdownMenu2.Content,
|
|
751
813
|
{
|
|
752
814
|
align,
|
|
753
815
|
sideOffset: 6,
|
|
754
816
|
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",
|
|
755
817
|
children: [
|
|
756
|
-
(user?.name || user?.email) && /* @__PURE__ */
|
|
757
|
-
/* @__PURE__ */
|
|
758
|
-
user.name && /* @__PURE__ */
|
|
759
|
-
user.email && /* @__PURE__ */
|
|
818
|
+
(user?.name || user?.email) && /* @__PURE__ */ jsxs19(Fragment5, { children: [
|
|
819
|
+
/* @__PURE__ */ jsxs19("div", { className: "px-2 py-1.5", children: [
|
|
820
|
+
user.name && /* @__PURE__ */ jsx23("p", { className: "truncate text-sm font-medium", children: user.name }),
|
|
821
|
+
user.email && /* @__PURE__ */ jsx23("p", { className: "truncate text-xs text-muted-foreground", children: user.email })
|
|
760
822
|
] }),
|
|
761
|
-
/* @__PURE__ */
|
|
823
|
+
/* @__PURE__ */ jsx23(DropdownMenu2.Separator, { className: "-mx-1 my-1 h-px bg-border" })
|
|
762
824
|
] }),
|
|
763
825
|
items.map(
|
|
764
|
-
(item) => item.href ? /* @__PURE__ */
|
|
826
|
+
(item) => item.href ? /* @__PURE__ */ jsx23(DropdownMenu2.Item, { asChild: true, children: renderLink({ href: item.href, className: itemClass, children: /* @__PURE__ */ jsxs19(Fragment5, { children: [
|
|
765
827
|
item.icon,
|
|
766
828
|
item.label
|
|
767
|
-
] }) }) }, item.label) : /* @__PURE__ */
|
|
829
|
+
] }) }) }, item.label) : /* @__PURE__ */ jsxs19(DropdownMenu2.Item, { className: itemClass, onClick: item.onClick, children: [
|
|
768
830
|
item.icon,
|
|
769
831
|
item.label
|
|
770
832
|
] }, item.label)
|
|
771
833
|
),
|
|
772
|
-
onLogout && /* @__PURE__ */
|
|
773
|
-
items.length > 0 && /* @__PURE__ */
|
|
774
|
-
/* @__PURE__ */
|
|
775
|
-
/* @__PURE__ */
|
|
834
|
+
onLogout && /* @__PURE__ */ jsxs19(Fragment5, { children: [
|
|
835
|
+
items.length > 0 && /* @__PURE__ */ jsx23(DropdownMenu2.Separator, { className: "-mx-1 my-1 h-px bg-border" }),
|
|
836
|
+
/* @__PURE__ */ jsxs19(DropdownMenu2.Item, { className: cn(itemClass, "text-destructive focus:bg-destructive/10"), onClick: onLogout, children: [
|
|
837
|
+
/* @__PURE__ */ jsx23(LogOut, { className: "h-4 w-4" }),
|
|
776
838
|
logoutLabel
|
|
777
839
|
] })
|
|
778
840
|
] })
|
|
@@ -783,7 +845,7 @@ function UserMenu({
|
|
|
783
845
|
}
|
|
784
846
|
|
|
785
847
|
// src/components/app-shell.tsx
|
|
786
|
-
import { jsx as
|
|
848
|
+
import { jsx as jsx24, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
787
849
|
function AppShell({
|
|
788
850
|
brand,
|
|
789
851
|
brandCollapsed,
|
|
@@ -800,9 +862,9 @@ function AppShell({
|
|
|
800
862
|
defaultCollapsed = false,
|
|
801
863
|
children
|
|
802
864
|
}) {
|
|
803
|
-
const [collapsed, setCollapsed] =
|
|
804
|
-
const [mobileOpen, setMobileOpen] =
|
|
805
|
-
const nav = (isCollapsed, onNavigate) => /* @__PURE__ */
|
|
865
|
+
const [collapsed, setCollapsed] = useState3(defaultCollapsed);
|
|
866
|
+
const [mobileOpen, setMobileOpen] = useState3(false);
|
|
867
|
+
const nav = (isCollapsed, onNavigate) => /* @__PURE__ */ jsx24(
|
|
806
868
|
SidebarNav,
|
|
807
869
|
{
|
|
808
870
|
items: navItems,
|
|
@@ -814,8 +876,8 @@ function AppShell({
|
|
|
814
876
|
onNavigate
|
|
815
877
|
}
|
|
816
878
|
);
|
|
817
|
-
return /* @__PURE__ */
|
|
818
|
-
/* @__PURE__ */
|
|
879
|
+
return /* @__PURE__ */ jsxs20("div", { className: "flex h-screen overflow-hidden bg-background", children: [
|
|
880
|
+
/* @__PURE__ */ jsxs20(
|
|
819
881
|
"aside",
|
|
820
882
|
{
|
|
821
883
|
className: cn(
|
|
@@ -823,22 +885,22 @@ function AppShell({
|
|
|
823
885
|
collapsed ? "w-16" : "w-60"
|
|
824
886
|
),
|
|
825
887
|
children: [
|
|
826
|
-
/* @__PURE__ */
|
|
827
|
-
/* @__PURE__ */
|
|
828
|
-
collapsible && /* @__PURE__ */
|
|
888
|
+
/* @__PURE__ */ jsx24("div", { className: "flex h-14 shrink-0 items-center border-b px-4", children: collapsed ? brandCollapsed ?? brand : brand }),
|
|
889
|
+
/* @__PURE__ */ jsx24("div", { className: "flex-1 overflow-y-auto px-2 py-4", children: nav(collapsed) }),
|
|
890
|
+
collapsible && /* @__PURE__ */ jsx24("div", { className: "border-t p-2", children: /* @__PURE__ */ jsx24(
|
|
829
891
|
"button",
|
|
830
892
|
{
|
|
831
893
|
type: "button",
|
|
832
894
|
onClick: () => setCollapsed((v) => !v),
|
|
833
895
|
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",
|
|
834
896
|
"aria-label": collapsed ? "Expandir menu" : "Recolher menu",
|
|
835
|
-
children: collapsed ? /* @__PURE__ */
|
|
897
|
+
children: collapsed ? /* @__PURE__ */ jsx24(ChevronRight, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx24(ChevronLeft, { className: "h-4 w-4" })
|
|
836
898
|
}
|
|
837
899
|
) })
|
|
838
900
|
]
|
|
839
901
|
}
|
|
840
902
|
),
|
|
841
|
-
/* @__PURE__ */
|
|
903
|
+
/* @__PURE__ */ jsxs20(
|
|
842
904
|
"div",
|
|
843
905
|
{
|
|
844
906
|
className: cn(
|
|
@@ -847,8 +909,8 @@ function AppShell({
|
|
|
847
909
|
),
|
|
848
910
|
onClick: () => setMobileOpen(false),
|
|
849
911
|
children: [
|
|
850
|
-
/* @__PURE__ */
|
|
851
|
-
/* @__PURE__ */
|
|
912
|
+
/* @__PURE__ */ jsx24("div", { className: "absolute inset-0 bg-black/50" }),
|
|
913
|
+
/* @__PURE__ */ jsxs20(
|
|
852
914
|
"div",
|
|
853
915
|
{
|
|
854
916
|
className: cn(
|
|
@@ -857,32 +919,32 @@ function AppShell({
|
|
|
857
919
|
),
|
|
858
920
|
onClick: (e) => e.stopPropagation(),
|
|
859
921
|
children: [
|
|
860
|
-
/* @__PURE__ */
|
|
861
|
-
/* @__PURE__ */
|
|
922
|
+
/* @__PURE__ */ jsx24("div", { className: "flex h-14 shrink-0 items-center border-b px-4", children: brand }),
|
|
923
|
+
/* @__PURE__ */ jsx24("div", { className: "flex-1 overflow-y-auto px-2 py-4", children: nav(false, () => setMobileOpen(false)) })
|
|
862
924
|
]
|
|
863
925
|
}
|
|
864
926
|
)
|
|
865
927
|
]
|
|
866
928
|
}
|
|
867
929
|
),
|
|
868
|
-
/* @__PURE__ */
|
|
869
|
-
/* @__PURE__ */
|
|
870
|
-
/* @__PURE__ */
|
|
930
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex flex-1 flex-col overflow-hidden", children: [
|
|
931
|
+
/* @__PURE__ */ jsxs20("header", { className: "flex h-14 shrink-0 items-center gap-2 border-b bg-background px-4", children: [
|
|
932
|
+
/* @__PURE__ */ jsx24(
|
|
871
933
|
"button",
|
|
872
934
|
{
|
|
873
935
|
type: "button",
|
|
874
936
|
onClick: () => setMobileOpen(true),
|
|
875
937
|
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",
|
|
876
938
|
"aria-label": "Abrir menu",
|
|
877
|
-
children: /* @__PURE__ */
|
|
939
|
+
children: /* @__PURE__ */ jsx24(Menu, { className: "h-4 w-4" })
|
|
878
940
|
}
|
|
879
941
|
),
|
|
880
|
-
/* @__PURE__ */
|
|
942
|
+
/* @__PURE__ */ jsxs20("div", { className: "ml-auto flex items-center gap-2", children: [
|
|
881
943
|
headerActions,
|
|
882
|
-
(user || onLogout) && /* @__PURE__ */
|
|
944
|
+
(user || onLogout) && /* @__PURE__ */ jsx24(UserMenu, { user, items: userMenuItems, onLogout, renderLink })
|
|
883
945
|
] })
|
|
884
946
|
] }),
|
|
885
|
-
/* @__PURE__ */
|
|
947
|
+
/* @__PURE__ */ jsx24("main", { className: "flex-1 overflow-y-auto", children })
|
|
886
948
|
] })
|
|
887
949
|
] });
|
|
888
950
|
}
|
|
@@ -890,7 +952,7 @@ function AppShell({
|
|
|
890
952
|
// src/components/row-actions-menu.tsx
|
|
891
953
|
import * as DropdownMenu3 from "@radix-ui/react-dropdown-menu";
|
|
892
954
|
import { MoreVertical } from "lucide-react";
|
|
893
|
-
import { Fragment as Fragment6, jsx as
|
|
955
|
+
import { Fragment as Fragment6, jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
894
956
|
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";
|
|
895
957
|
function RowActionsMenu({
|
|
896
958
|
actions,
|
|
@@ -900,18 +962,18 @@ function RowActionsMenu({
|
|
|
900
962
|
renderLink = defaultRenderLink
|
|
901
963
|
}) {
|
|
902
964
|
if (actions.length === 0) return null;
|
|
903
|
-
return /* @__PURE__ */
|
|
904
|
-
/* @__PURE__ */
|
|
965
|
+
return /* @__PURE__ */ jsxs21(DropdownMenu3.Root, { children: [
|
|
966
|
+
/* @__PURE__ */ jsx25(DropdownMenu3.Trigger, { asChild: true, children: /* @__PURE__ */ jsx25(
|
|
905
967
|
"button",
|
|
906
968
|
{
|
|
907
969
|
type: "button",
|
|
908
970
|
disabled,
|
|
909
971
|
"aria-label": label,
|
|
910
972
|
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",
|
|
911
|
-
children: /* @__PURE__ */
|
|
973
|
+
children: /* @__PURE__ */ jsx25(MoreVertical, { className: "h-4 w-4" })
|
|
912
974
|
}
|
|
913
975
|
) }),
|
|
914
|
-
/* @__PURE__ */
|
|
976
|
+
/* @__PURE__ */ jsx25(DropdownMenu3.Portal, { children: /* @__PURE__ */ jsx25(
|
|
915
977
|
DropdownMenu3.Content,
|
|
916
978
|
{
|
|
917
979
|
align,
|
|
@@ -919,14 +981,14 @@ function RowActionsMenu({
|
|
|
919
981
|
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",
|
|
920
982
|
children: actions.map((action) => {
|
|
921
983
|
const cls = cn(itemClass2, action.destructive && "text-destructive focus:bg-destructive/10");
|
|
922
|
-
return action.href ? /* @__PURE__ */
|
|
984
|
+
return action.href ? /* @__PURE__ */ jsx25(DropdownMenu3.Item, { asChild: true, disabled: action.disabled, children: renderLink({
|
|
923
985
|
href: action.href,
|
|
924
986
|
className: cls,
|
|
925
|
-
children: /* @__PURE__ */
|
|
987
|
+
children: /* @__PURE__ */ jsxs21(Fragment6, { children: [
|
|
926
988
|
action.icon,
|
|
927
989
|
action.label
|
|
928
990
|
] })
|
|
929
|
-
}) }, action.label) : /* @__PURE__ */
|
|
991
|
+
}) }, action.label) : /* @__PURE__ */ jsxs21(
|
|
930
992
|
DropdownMenu3.Item,
|
|
931
993
|
{
|
|
932
994
|
className: cls,
|
|
@@ -955,9 +1017,9 @@ function extractApiError(err, fallbackMessage = "Ocorreu um erro inesperado.") {
|
|
|
955
1017
|
}
|
|
956
1018
|
|
|
957
1019
|
// src/hooks/use-disclosure.ts
|
|
958
|
-
import { useCallback, useState as
|
|
1020
|
+
import { useCallback, useState as useState4 } from "react";
|
|
959
1021
|
function useDisclosure(initial = false) {
|
|
960
|
-
const [open, setOpen] =
|
|
1022
|
+
const [open, setOpen] = useState4(initial);
|
|
961
1023
|
const onOpen = useCallback(() => setOpen(true), []);
|
|
962
1024
|
const onClose = useCallback(() => setOpen(false), []);
|
|
963
1025
|
const onToggle = useCallback(() => setOpen((v) => !v), []);
|
|
@@ -1002,6 +1064,7 @@ export {
|
|
|
1002
1064
|
ModeToggle,
|
|
1003
1065
|
PageHeader,
|
|
1004
1066
|
Pagination,
|
|
1067
|
+
PasswordInput,
|
|
1005
1068
|
ProgressBar,
|
|
1006
1069
|
ResponsiveDataView,
|
|
1007
1070
|
RowActionsMenu,
|