@motor-hero/ui-kit 0.14.3 → 0.15.1
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/password-input.d.ts +7 -0
- package/dist/components/password-input.d.ts.map +1 -0
- package/dist/index.cjs +133 -100
- 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 +134 -102
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- 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",
|
|
@@ -586,7 +617,7 @@ function DataTableWrapper({
|
|
|
586
617
|
|
|
587
618
|
// src/components/mobile-card-list.tsx
|
|
588
619
|
import { useRef } from "react";
|
|
589
|
-
import { jsx as
|
|
620
|
+
import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
590
621
|
var SCROLL_THRESHOLD = 8;
|
|
591
622
|
function MobileCardList({
|
|
592
623
|
data,
|
|
@@ -617,26 +648,26 @@ function MobileCardList({
|
|
|
617
648
|
}
|
|
618
649
|
};
|
|
619
650
|
if (isLoading) {
|
|
620
|
-
return /* @__PURE__ */
|
|
621
|
-
/* @__PURE__ */
|
|
622
|
-
/* @__PURE__ */
|
|
623
|
-
/* @__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" })
|
|
624
655
|
] }),
|
|
625
|
-
/* @__PURE__ */
|
|
626
|
-
/* @__PURE__ */
|
|
627
|
-
/* @__PURE__ */
|
|
628
|
-
/* @__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" })
|
|
629
660
|
] })
|
|
630
661
|
] }) }, i)) });
|
|
631
662
|
}
|
|
632
|
-
return /* @__PURE__ */
|
|
663
|
+
return /* @__PURE__ */ jsx18(
|
|
633
664
|
"div",
|
|
634
665
|
{
|
|
635
666
|
className: `space-y-3 ${className ?? ""}`,
|
|
636
667
|
onTouchStart,
|
|
637
668
|
onTouchMove,
|
|
638
669
|
onClickCapture,
|
|
639
|
-
children: data.map((item, index) => /* @__PURE__ */
|
|
670
|
+
children: data.map((item, index) => /* @__PURE__ */ jsx18(
|
|
640
671
|
"div",
|
|
641
672
|
{
|
|
642
673
|
className: "rounded-xl border p-4 transition-all duration-150 hover:border-foreground/20 active:scale-[0.99]",
|
|
@@ -649,7 +680,7 @@ function MobileCardList({
|
|
|
649
680
|
}
|
|
650
681
|
|
|
651
682
|
// src/components/responsive-data-view.tsx
|
|
652
|
-
import { jsx as
|
|
683
|
+
import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
653
684
|
function ResponsiveDataView({
|
|
654
685
|
table,
|
|
655
686
|
cards,
|
|
@@ -660,13 +691,13 @@ function ResponsiveDataView({
|
|
|
660
691
|
emptyDescription,
|
|
661
692
|
pagination
|
|
662
693
|
}) {
|
|
663
|
-
return /* @__PURE__ */
|
|
664
|
-
/* @__PURE__ */
|
|
665
|
-
/* @__PURE__ */
|
|
666
|
-
!isLoading && isEmpty && /* @__PURE__ */
|
|
667
|
-
emptyIcon && /* @__PURE__ */
|
|
668
|
-
/* @__PURE__ */
|
|
669
|
-
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 })
|
|
670
701
|
] }),
|
|
671
702
|
pagination
|
|
672
703
|
] });
|
|
@@ -674,10 +705,10 @@ function ResponsiveDataView({
|
|
|
674
705
|
|
|
675
706
|
// src/components/toaster.tsx
|
|
676
707
|
import { Toaster as Sonner } from "sonner";
|
|
677
|
-
import { jsx as
|
|
708
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
678
709
|
function Toaster(props) {
|
|
679
710
|
const { theme = "system" } = useTheme();
|
|
680
|
-
return /* @__PURE__ */
|
|
711
|
+
return /* @__PURE__ */ jsx20(
|
|
681
712
|
Sonner,
|
|
682
713
|
{
|
|
683
714
|
theme,
|
|
@@ -699,17 +730,17 @@ function Toaster(props) {
|
|
|
699
730
|
|
|
700
731
|
// src/components/app-shell.tsx
|
|
701
732
|
import { ChevronLeft, ChevronRight, Menu } from "lucide-react";
|
|
702
|
-
import { useState as
|
|
733
|
+
import { useState as useState3 } from "react";
|
|
703
734
|
|
|
704
735
|
// src/components/sidebar-nav.tsx
|
|
705
736
|
import { Fragment as Fragment3 } from "react";
|
|
706
737
|
|
|
707
738
|
// src/components/types.tsx
|
|
708
|
-
import { jsx as
|
|
709
|
-
var defaultRenderLink = ({ children, ...props }) => /* @__PURE__ */
|
|
739
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
740
|
+
var defaultRenderLink = ({ children, ...props }) => /* @__PURE__ */ jsx21("a", { ...props, children });
|
|
710
741
|
|
|
711
742
|
// src/components/sidebar-nav.tsx
|
|
712
|
-
import { Fragment as Fragment4, jsx as
|
|
743
|
+
import { Fragment as Fragment4, jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
713
744
|
function defaultIsActive(item, activePath) {
|
|
714
745
|
if (item.href === "/") return activePath === "/";
|
|
715
746
|
return activePath === item.href || activePath.startsWith(item.href + "/");
|
|
@@ -724,7 +755,7 @@ function SidebarNav({
|
|
|
724
755
|
onNavigate
|
|
725
756
|
}) {
|
|
726
757
|
const visible = items.filter((item) => !item.adminOnly || isAdmin);
|
|
727
|
-
return /* @__PURE__ */
|
|
758
|
+
return /* @__PURE__ */ jsx22("nav", { className: "flex flex-col gap-1", children: visible.map((item) => {
|
|
728
759
|
const active = isActive(item, activePath);
|
|
729
760
|
const link = renderLink({
|
|
730
761
|
href: item.href,
|
|
@@ -736,19 +767,19 @@ function SidebarNav({
|
|
|
736
767
|
active ? "bg-accent text-accent-foreground font-semibold" : "text-muted-foreground hover:bg-accent hover:text-accent-foreground",
|
|
737
768
|
isCollapsed && "justify-center px-2"
|
|
738
769
|
),
|
|
739
|
-
children: /* @__PURE__ */
|
|
740
|
-
item.icon && /* @__PURE__ */
|
|
741
|
-
!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 })
|
|
742
773
|
] })
|
|
743
774
|
});
|
|
744
|
-
return /* @__PURE__ */
|
|
775
|
+
return /* @__PURE__ */ jsx22(Fragment3, { children: link }, item.href);
|
|
745
776
|
}) });
|
|
746
777
|
}
|
|
747
778
|
|
|
748
779
|
// src/components/user-menu.tsx
|
|
749
780
|
import * as DropdownMenu2 from "@radix-ui/react-dropdown-menu";
|
|
750
781
|
import { LogOut, User } from "lucide-react";
|
|
751
|
-
import { Fragment as Fragment5, jsx as
|
|
782
|
+
import { Fragment as Fragment5, jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
752
783
|
function initials(user) {
|
|
753
784
|
const source = user?.name?.trim() || user?.email?.trim();
|
|
754
785
|
if (!source) return "";
|
|
@@ -766,44 +797,44 @@ function UserMenu({
|
|
|
766
797
|
align = "end"
|
|
767
798
|
}) {
|
|
768
799
|
const label = initials(user);
|
|
769
|
-
return /* @__PURE__ */
|
|
770
|
-
/* @__PURE__ */
|
|
800
|
+
return /* @__PURE__ */ jsxs19(DropdownMenu2.Root, { children: [
|
|
801
|
+
/* @__PURE__ */ jsx23(DropdownMenu2.Trigger, { asChild: true, children: /* @__PURE__ */ jsx23(
|
|
771
802
|
"button",
|
|
772
803
|
{
|
|
773
804
|
type: "button",
|
|
774
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",
|
|
775
806
|
"aria-label": "Menu do usu\xE1rio",
|
|
776
807
|
"data-testid": "user-menu",
|
|
777
|
-
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" })
|
|
778
809
|
}
|
|
779
810
|
) }),
|
|
780
|
-
/* @__PURE__ */
|
|
811
|
+
/* @__PURE__ */ jsx23(DropdownMenu2.Portal, { children: /* @__PURE__ */ jsxs19(
|
|
781
812
|
DropdownMenu2.Content,
|
|
782
813
|
{
|
|
783
814
|
align,
|
|
784
815
|
sideOffset: 6,
|
|
785
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",
|
|
786
817
|
children: [
|
|
787
|
-
(user?.name || user?.email) && /* @__PURE__ */
|
|
788
|
-
/* @__PURE__ */
|
|
789
|
-
user.name && /* @__PURE__ */
|
|
790
|
-
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 })
|
|
791
822
|
] }),
|
|
792
|
-
/* @__PURE__ */
|
|
823
|
+
/* @__PURE__ */ jsx23(DropdownMenu2.Separator, { className: "-mx-1 my-1 h-px bg-border" })
|
|
793
824
|
] }),
|
|
794
825
|
items.map(
|
|
795
|
-
(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: [
|
|
796
827
|
item.icon,
|
|
797
828
|
item.label
|
|
798
|
-
] }) }) }, item.label) : /* @__PURE__ */
|
|
829
|
+
] }) }) }, item.label) : /* @__PURE__ */ jsxs19(DropdownMenu2.Item, { className: itemClass, onClick: item.onClick, children: [
|
|
799
830
|
item.icon,
|
|
800
831
|
item.label
|
|
801
832
|
] }, item.label)
|
|
802
833
|
),
|
|
803
|
-
onLogout && /* @__PURE__ */
|
|
804
|
-
items.length > 0 && /* @__PURE__ */
|
|
805
|
-
/* @__PURE__ */
|
|
806
|
-
/* @__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" }),
|
|
807
838
|
logoutLabel
|
|
808
839
|
] })
|
|
809
840
|
] })
|
|
@@ -814,7 +845,7 @@ function UserMenu({
|
|
|
814
845
|
}
|
|
815
846
|
|
|
816
847
|
// src/components/app-shell.tsx
|
|
817
|
-
import { jsx as
|
|
848
|
+
import { jsx as jsx24, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
818
849
|
function AppShell({
|
|
819
850
|
brand,
|
|
820
851
|
brandCollapsed,
|
|
@@ -831,9 +862,9 @@ function AppShell({
|
|
|
831
862
|
defaultCollapsed = false,
|
|
832
863
|
children
|
|
833
864
|
}) {
|
|
834
|
-
const [collapsed, setCollapsed] =
|
|
835
|
-
const [mobileOpen, setMobileOpen] =
|
|
836
|
-
const nav = (isCollapsed, onNavigate) => /* @__PURE__ */
|
|
865
|
+
const [collapsed, setCollapsed] = useState3(defaultCollapsed);
|
|
866
|
+
const [mobileOpen, setMobileOpen] = useState3(false);
|
|
867
|
+
const nav = (isCollapsed, onNavigate) => /* @__PURE__ */ jsx24(
|
|
837
868
|
SidebarNav,
|
|
838
869
|
{
|
|
839
870
|
items: navItems,
|
|
@@ -845,8 +876,8 @@ function AppShell({
|
|
|
845
876
|
onNavigate
|
|
846
877
|
}
|
|
847
878
|
);
|
|
848
|
-
return /* @__PURE__ */
|
|
849
|
-
/* @__PURE__ */
|
|
879
|
+
return /* @__PURE__ */ jsxs20("div", { className: "flex h-screen overflow-hidden bg-background", children: [
|
|
880
|
+
/* @__PURE__ */ jsxs20(
|
|
850
881
|
"aside",
|
|
851
882
|
{
|
|
852
883
|
className: cn(
|
|
@@ -854,22 +885,22 @@ function AppShell({
|
|
|
854
885
|
collapsed ? "w-16" : "w-60"
|
|
855
886
|
),
|
|
856
887
|
children: [
|
|
857
|
-
/* @__PURE__ */
|
|
858
|
-
/* @__PURE__ */
|
|
859
|
-
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(
|
|
860
891
|
"button",
|
|
861
892
|
{
|
|
862
893
|
type: "button",
|
|
863
894
|
onClick: () => setCollapsed((v) => !v),
|
|
864
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",
|
|
865
896
|
"aria-label": collapsed ? "Expandir menu" : "Recolher menu",
|
|
866
|
-
children: collapsed ? /* @__PURE__ */
|
|
897
|
+
children: collapsed ? /* @__PURE__ */ jsx24(ChevronRight, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx24(ChevronLeft, { className: "h-4 w-4" })
|
|
867
898
|
}
|
|
868
899
|
) })
|
|
869
900
|
]
|
|
870
901
|
}
|
|
871
902
|
),
|
|
872
|
-
/* @__PURE__ */
|
|
903
|
+
/* @__PURE__ */ jsxs20(
|
|
873
904
|
"div",
|
|
874
905
|
{
|
|
875
906
|
className: cn(
|
|
@@ -878,8 +909,8 @@ function AppShell({
|
|
|
878
909
|
),
|
|
879
910
|
onClick: () => setMobileOpen(false),
|
|
880
911
|
children: [
|
|
881
|
-
/* @__PURE__ */
|
|
882
|
-
/* @__PURE__ */
|
|
912
|
+
/* @__PURE__ */ jsx24("div", { className: "absolute inset-0 bg-black/50" }),
|
|
913
|
+
/* @__PURE__ */ jsxs20(
|
|
883
914
|
"div",
|
|
884
915
|
{
|
|
885
916
|
className: cn(
|
|
@@ -888,32 +919,32 @@ function AppShell({
|
|
|
888
919
|
),
|
|
889
920
|
onClick: (e) => e.stopPropagation(),
|
|
890
921
|
children: [
|
|
891
|
-
/* @__PURE__ */
|
|
892
|
-
/* @__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)) })
|
|
893
924
|
]
|
|
894
925
|
}
|
|
895
926
|
)
|
|
896
927
|
]
|
|
897
928
|
}
|
|
898
929
|
),
|
|
899
|
-
/* @__PURE__ */
|
|
900
|
-
/* @__PURE__ */
|
|
901
|
-
/* @__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(
|
|
902
933
|
"button",
|
|
903
934
|
{
|
|
904
935
|
type: "button",
|
|
905
936
|
onClick: () => setMobileOpen(true),
|
|
906
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",
|
|
907
938
|
"aria-label": "Abrir menu",
|
|
908
|
-
children: /* @__PURE__ */
|
|
939
|
+
children: /* @__PURE__ */ jsx24(Menu, { className: "h-4 w-4" })
|
|
909
940
|
}
|
|
910
941
|
),
|
|
911
|
-
/* @__PURE__ */
|
|
942
|
+
/* @__PURE__ */ jsxs20("div", { className: "ml-auto flex items-center gap-2", children: [
|
|
912
943
|
headerActions,
|
|
913
|
-
(user || onLogout) && /* @__PURE__ */
|
|
944
|
+
(user || onLogout) && /* @__PURE__ */ jsx24(UserMenu, { user, items: userMenuItems, onLogout, renderLink })
|
|
914
945
|
] })
|
|
915
946
|
] }),
|
|
916
|
-
/* @__PURE__ */
|
|
947
|
+
/* @__PURE__ */ jsx24("main", { className: "flex-1 overflow-y-auto", children })
|
|
917
948
|
] })
|
|
918
949
|
] });
|
|
919
950
|
}
|
|
@@ -921,7 +952,7 @@ function AppShell({
|
|
|
921
952
|
// src/components/row-actions-menu.tsx
|
|
922
953
|
import * as DropdownMenu3 from "@radix-ui/react-dropdown-menu";
|
|
923
954
|
import { MoreVertical } from "lucide-react";
|
|
924
|
-
import { Fragment as Fragment6, jsx as
|
|
955
|
+
import { Fragment as Fragment6, jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
925
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";
|
|
926
957
|
function RowActionsMenu({
|
|
927
958
|
actions,
|
|
@@ -931,18 +962,18 @@ function RowActionsMenu({
|
|
|
931
962
|
renderLink = defaultRenderLink
|
|
932
963
|
}) {
|
|
933
964
|
if (actions.length === 0) return null;
|
|
934
|
-
return /* @__PURE__ */
|
|
935
|
-
/* @__PURE__ */
|
|
965
|
+
return /* @__PURE__ */ jsxs21(DropdownMenu3.Root, { children: [
|
|
966
|
+
/* @__PURE__ */ jsx25(DropdownMenu3.Trigger, { asChild: true, children: /* @__PURE__ */ jsx25(
|
|
936
967
|
"button",
|
|
937
968
|
{
|
|
938
969
|
type: "button",
|
|
939
970
|
disabled,
|
|
940
971
|
"aria-label": label,
|
|
941
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",
|
|
942
|
-
children: /* @__PURE__ */
|
|
973
|
+
children: /* @__PURE__ */ jsx25(MoreVertical, { className: "h-4 w-4" })
|
|
943
974
|
}
|
|
944
975
|
) }),
|
|
945
|
-
/* @__PURE__ */
|
|
976
|
+
/* @__PURE__ */ jsx25(DropdownMenu3.Portal, { children: /* @__PURE__ */ jsx25(
|
|
946
977
|
DropdownMenu3.Content,
|
|
947
978
|
{
|
|
948
979
|
align,
|
|
@@ -950,14 +981,14 @@ function RowActionsMenu({
|
|
|
950
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",
|
|
951
982
|
children: actions.map((action) => {
|
|
952
983
|
const cls = cn(itemClass2, action.destructive && "text-destructive focus:bg-destructive/10");
|
|
953
|
-
return action.href ? /* @__PURE__ */
|
|
984
|
+
return action.href ? /* @__PURE__ */ jsx25(DropdownMenu3.Item, { asChild: true, disabled: action.disabled, children: renderLink({
|
|
954
985
|
href: action.href,
|
|
955
986
|
className: cls,
|
|
956
|
-
children: /* @__PURE__ */
|
|
987
|
+
children: /* @__PURE__ */ jsxs21(Fragment6, { children: [
|
|
957
988
|
action.icon,
|
|
958
989
|
action.label
|
|
959
990
|
] })
|
|
960
|
-
}) }, action.label) : /* @__PURE__ */
|
|
991
|
+
}) }, action.label) : /* @__PURE__ */ jsxs21(
|
|
961
992
|
DropdownMenu3.Item,
|
|
962
993
|
{
|
|
963
994
|
className: cls,
|
|
@@ -986,9 +1017,9 @@ function extractApiError(err, fallbackMessage = "Ocorreu um erro inesperado.") {
|
|
|
986
1017
|
}
|
|
987
1018
|
|
|
988
1019
|
// src/hooks/use-disclosure.ts
|
|
989
|
-
import { useCallback, useState as
|
|
1020
|
+
import { useCallback, useState as useState4 } from "react";
|
|
990
1021
|
function useDisclosure(initial = false) {
|
|
991
|
-
const [open, setOpen] =
|
|
1022
|
+
const [open, setOpen] = useState4(initial);
|
|
992
1023
|
const onOpen = useCallback(() => setOpen(true), []);
|
|
993
1024
|
const onClose = useCallback(() => setOpen(false), []);
|
|
994
1025
|
const onToggle = useCallback(() => setOpen((v) => !v), []);
|
|
@@ -1033,6 +1064,7 @@ export {
|
|
|
1033
1064
|
ModeToggle,
|
|
1034
1065
|
PageHeader,
|
|
1035
1066
|
Pagination,
|
|
1067
|
+
PasswordInput,
|
|
1036
1068
|
ProgressBar,
|
|
1037
1069
|
ResponsiveDataView,
|
|
1038
1070
|
RowActionsMenu,
|