@motor-hero/ui-kit 0.15.1 → 0.16.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/combobox.d.ts +21 -0
- package/dist/components/combobox.d.ts.map +1 -0
- package/dist/index.cjs +202 -100
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +203 -102
- package/dist/index.js.map +1 -1
- package/package.json +3 -1
- package/src/components/combobox.tsx +112 -0
- package/src/index.ts +2 -0
package/dist/index.js
CHANGED
|
@@ -542,31 +542,131 @@ var PasswordInput = React3.forwardRef(({ containerClassName, className, ...props
|
|
|
542
542
|
});
|
|
543
543
|
PasswordInput.displayName = "PasswordInput";
|
|
544
544
|
|
|
545
|
-
// src/components/
|
|
545
|
+
// src/components/combobox.tsx
|
|
546
|
+
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
547
|
+
import { Command as CommandPrimitive } from "cmdk";
|
|
548
|
+
import { Check, ChevronsUpDown, Search } from "lucide-react";
|
|
549
|
+
import * as React4 from "react";
|
|
546
550
|
import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
551
|
+
function Combobox({
|
|
552
|
+
options,
|
|
553
|
+
value,
|
|
554
|
+
onChange,
|
|
555
|
+
placeholder = "Selecione...",
|
|
556
|
+
searchPlaceholder = "Buscar...",
|
|
557
|
+
emptyMessage = "Nenhum resultado encontrado.",
|
|
558
|
+
disabled,
|
|
559
|
+
id,
|
|
560
|
+
className,
|
|
561
|
+
"aria-invalid": ariaInvalid,
|
|
562
|
+
"aria-describedby": ariaDescribedby
|
|
563
|
+
}) {
|
|
564
|
+
const [open, setOpen] = React4.useState(false);
|
|
565
|
+
const selected = options.find((option) => option.value === value);
|
|
566
|
+
return /* @__PURE__ */ jsxs14(PopoverPrimitive.Root, { open, onOpenChange: setOpen, modal: true, children: [
|
|
567
|
+
/* @__PURE__ */ jsx16(PopoverPrimitive.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs14(
|
|
568
|
+
"button",
|
|
569
|
+
{
|
|
570
|
+
type: "button",
|
|
571
|
+
id,
|
|
572
|
+
role: "combobox",
|
|
573
|
+
"aria-expanded": open,
|
|
574
|
+
"aria-invalid": ariaInvalid,
|
|
575
|
+
"aria-describedby": ariaDescribedby,
|
|
576
|
+
disabled,
|
|
577
|
+
className: cn(
|
|
578
|
+
"flex h-9 w-full cursor-pointer items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm transition-colors 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",
|
|
579
|
+
className
|
|
580
|
+
),
|
|
581
|
+
children: [
|
|
582
|
+
/* @__PURE__ */ jsx16(
|
|
583
|
+
"span",
|
|
584
|
+
{
|
|
585
|
+
className: cn("truncate", !selected && "text-muted-foreground"),
|
|
586
|
+
children: selected ? selected.label : placeholder
|
|
587
|
+
}
|
|
588
|
+
),
|
|
589
|
+
/* @__PURE__ */ jsx16(ChevronsUpDown, { className: "h-4 w-4 shrink-0 opacity-50" })
|
|
590
|
+
]
|
|
591
|
+
}
|
|
592
|
+
) }),
|
|
593
|
+
/* @__PURE__ */ jsx16(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx16(
|
|
594
|
+
PopoverPrimitive.Content,
|
|
595
|
+
{
|
|
596
|
+
align: "start",
|
|
597
|
+
sideOffset: 4,
|
|
598
|
+
className: "z-50 overflow-hidden rounded-md border bg-popover p-0 text-popover-foreground shadow-md",
|
|
599
|
+
style: { width: "var(--radix-popover-trigger-width)" },
|
|
600
|
+
children: /* @__PURE__ */ jsxs14(CommandPrimitive, { className: "flex h-full w-full flex-col overflow-hidden", children: [
|
|
601
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex items-center border-b px-3", children: [
|
|
602
|
+
/* @__PURE__ */ jsx16(Search, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
|
|
603
|
+
/* @__PURE__ */ jsx16(
|
|
604
|
+
CommandPrimitive.Input,
|
|
605
|
+
{
|
|
606
|
+
placeholder: searchPlaceholder,
|
|
607
|
+
className: "flex h-9 w-full bg-transparent py-2 text-sm outline-none placeholder:text-muted-foreground"
|
|
608
|
+
}
|
|
609
|
+
)
|
|
610
|
+
] }),
|
|
611
|
+
/* @__PURE__ */ jsxs14(CommandPrimitive.List, { className: "max-h-60 overflow-y-auto overflow-x-hidden p-1", children: [
|
|
612
|
+
/* @__PURE__ */ jsx16(CommandPrimitive.Empty, { className: "py-6 text-center text-sm text-muted-foreground", children: emptyMessage }),
|
|
613
|
+
options.map((option) => /* @__PURE__ */ jsxs14(
|
|
614
|
+
CommandPrimitive.Item,
|
|
615
|
+
{
|
|
616
|
+
value: option.label,
|
|
617
|
+
disabled: option.disabled,
|
|
618
|
+
onSelect: () => {
|
|
619
|
+
onChange(option.value);
|
|
620
|
+
setOpen(false);
|
|
621
|
+
},
|
|
622
|
+
className: "relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50",
|
|
623
|
+
children: [
|
|
624
|
+
/* @__PURE__ */ jsx16(
|
|
625
|
+
Check,
|
|
626
|
+
{
|
|
627
|
+
className: cn(
|
|
628
|
+
"h-4 w-4 shrink-0",
|
|
629
|
+
value === option.value ? "opacity-100" : "opacity-0"
|
|
630
|
+
)
|
|
631
|
+
}
|
|
632
|
+
),
|
|
633
|
+
/* @__PURE__ */ jsx16("span", { className: "truncate", children: option.label })
|
|
634
|
+
]
|
|
635
|
+
},
|
|
636
|
+
option.value
|
|
637
|
+
))
|
|
638
|
+
] })
|
|
639
|
+
] })
|
|
640
|
+
}
|
|
641
|
+
) })
|
|
642
|
+
] });
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
// src/components/stat-card.tsx
|
|
646
|
+
import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
547
647
|
function StatCard({ label, value, detail, icon, isLoading }) {
|
|
548
648
|
if (isLoading) {
|
|
549
|
-
return /* @__PURE__ */
|
|
550
|
-
/* @__PURE__ */
|
|
551
|
-
/* @__PURE__ */
|
|
552
|
-
/* @__PURE__ */
|
|
649
|
+
return /* @__PURE__ */ jsxs15("div", { className: "rounded-lg border bg-card p-6 shadow-sm", children: [
|
|
650
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex items-center justify-between pb-2", children: [
|
|
651
|
+
/* @__PURE__ */ jsx17("div", { className: "h-4 w-24 animate-pulse rounded bg-muted" }),
|
|
652
|
+
/* @__PURE__ */ jsx17("div", { className: "h-4 w-4 animate-pulse rounded bg-muted" })
|
|
553
653
|
] }),
|
|
554
|
-
/* @__PURE__ */
|
|
555
|
-
/* @__PURE__ */
|
|
654
|
+
/* @__PURE__ */ jsx17("div", { className: "mt-2 h-7 w-16 animate-pulse rounded bg-muted" }),
|
|
655
|
+
/* @__PURE__ */ jsx17("div", { className: "mt-1 h-4 w-20 animate-pulse rounded bg-muted" })
|
|
556
656
|
] });
|
|
557
657
|
}
|
|
558
|
-
return /* @__PURE__ */
|
|
559
|
-
/* @__PURE__ */
|
|
560
|
-
/* @__PURE__ */
|
|
561
|
-
icon && /* @__PURE__ */
|
|
658
|
+
return /* @__PURE__ */ jsxs15("div", { className: "rounded-lg border bg-card p-6 shadow-sm", children: [
|
|
659
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex items-center justify-between pb-2", children: [
|
|
660
|
+
/* @__PURE__ */ jsx17("span", { className: "text-sm font-medium text-muted-foreground", children: label }),
|
|
661
|
+
icon && /* @__PURE__ */ jsx17("span", { className: "text-muted-foreground", children: icon })
|
|
562
662
|
] }),
|
|
563
|
-
/* @__PURE__ */
|
|
564
|
-
detail && /* @__PURE__ */
|
|
663
|
+
/* @__PURE__ */ jsx17("div", { className: "text-2xl font-bold", children: value }),
|
|
664
|
+
detail && /* @__PURE__ */ jsx17("p", { className: "text-xs text-muted-foreground", children: detail })
|
|
565
665
|
] });
|
|
566
666
|
}
|
|
567
667
|
|
|
568
668
|
// src/components/data-table-wrapper.tsx
|
|
569
|
-
import { jsx as
|
|
669
|
+
import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
570
670
|
function DataTableWrapper({
|
|
571
671
|
children,
|
|
572
672
|
isEmpty,
|
|
@@ -579,15 +679,15 @@ function DataTableWrapper({
|
|
|
579
679
|
hasNextPage = false,
|
|
580
680
|
hasPreviousPage = false
|
|
581
681
|
}) {
|
|
582
|
-
return /* @__PURE__ */
|
|
583
|
-
/* @__PURE__ */
|
|
584
|
-
!isLoading && isEmpty && /* @__PURE__ */
|
|
585
|
-
emptyIcon && /* @__PURE__ */
|
|
586
|
-
/* @__PURE__ */
|
|
587
|
-
emptyDescription && /* @__PURE__ */
|
|
682
|
+
return /* @__PURE__ */ jsxs16("div", { className: "space-y-4", children: [
|
|
683
|
+
/* @__PURE__ */ jsx18("div", { className: "overflow-x-auto rounded-md border", children }),
|
|
684
|
+
!isLoading && isEmpty && /* @__PURE__ */ jsxs16("div", { className: "flex flex-col items-center justify-center py-16 text-center", children: [
|
|
685
|
+
emptyIcon && /* @__PURE__ */ jsx18("div", { className: "mb-4 text-muted-foreground", children: emptyIcon }),
|
|
686
|
+
/* @__PURE__ */ jsx18("h3", { className: "text-lg font-semibold tracking-tight", children: emptyTitle }),
|
|
687
|
+
emptyDescription && /* @__PURE__ */ jsx18("p", { className: "mt-1 max-w-sm text-sm text-muted-foreground", children: emptyDescription })
|
|
588
688
|
] }),
|
|
589
|
-
page !== void 0 && onPageChange && /* @__PURE__ */
|
|
590
|
-
/* @__PURE__ */
|
|
689
|
+
page !== void 0 && onPageChange && /* @__PURE__ */ jsxs16("div", { className: "flex items-center justify-end gap-4", children: [
|
|
690
|
+
/* @__PURE__ */ jsx18(
|
|
591
691
|
"button",
|
|
592
692
|
{
|
|
593
693
|
type: "button",
|
|
@@ -597,11 +697,11 @@ function DataTableWrapper({
|
|
|
597
697
|
children: "Anterior"
|
|
598
698
|
}
|
|
599
699
|
),
|
|
600
|
-
/* @__PURE__ */
|
|
700
|
+
/* @__PURE__ */ jsxs16("span", { className: "text-sm text-muted-foreground", children: [
|
|
601
701
|
"P\xE1gina ",
|
|
602
702
|
page
|
|
603
703
|
] }),
|
|
604
|
-
/* @__PURE__ */
|
|
704
|
+
/* @__PURE__ */ jsx18(
|
|
605
705
|
"button",
|
|
606
706
|
{
|
|
607
707
|
type: "button",
|
|
@@ -617,7 +717,7 @@ function DataTableWrapper({
|
|
|
617
717
|
|
|
618
718
|
// src/components/mobile-card-list.tsx
|
|
619
719
|
import { useRef } from "react";
|
|
620
|
-
import { jsx as
|
|
720
|
+
import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
621
721
|
var SCROLL_THRESHOLD = 8;
|
|
622
722
|
function MobileCardList({
|
|
623
723
|
data,
|
|
@@ -648,26 +748,26 @@ function MobileCardList({
|
|
|
648
748
|
}
|
|
649
749
|
};
|
|
650
750
|
if (isLoading) {
|
|
651
|
-
return /* @__PURE__ */
|
|
652
|
-
/* @__PURE__ */
|
|
653
|
-
/* @__PURE__ */
|
|
654
|
-
/* @__PURE__ */
|
|
751
|
+
return /* @__PURE__ */ jsx19("div", { className: `space-y-3 ${className ?? ""}`, children: Array.from({ length: loadingCount }).map((_, i) => /* @__PURE__ */ jsx19("div", { className: "rounded-xl border p-4", children: /* @__PURE__ */ jsxs17("div", { className: "space-y-3", children: [
|
|
752
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex justify-between", children: [
|
|
753
|
+
/* @__PURE__ */ jsx19("div", { className: "h-5 w-32 animate-pulse rounded bg-muted" }),
|
|
754
|
+
/* @__PURE__ */ jsx19("div", { className: "h-5 w-16 animate-pulse rounded bg-muted" })
|
|
655
755
|
] }),
|
|
656
|
-
/* @__PURE__ */
|
|
657
|
-
/* @__PURE__ */
|
|
658
|
-
/* @__PURE__ */
|
|
659
|
-
/* @__PURE__ */
|
|
756
|
+
/* @__PURE__ */ jsx19("div", { className: "h-4 w-48 animate-pulse rounded bg-muted" }),
|
|
757
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex justify-between", children: [
|
|
758
|
+
/* @__PURE__ */ jsx19("div", { className: "h-4 w-24 animate-pulse rounded bg-muted" }),
|
|
759
|
+
/* @__PURE__ */ jsx19("div", { className: "h-4 w-20 animate-pulse rounded bg-muted" })
|
|
660
760
|
] })
|
|
661
761
|
] }) }, i)) });
|
|
662
762
|
}
|
|
663
|
-
return /* @__PURE__ */
|
|
763
|
+
return /* @__PURE__ */ jsx19(
|
|
664
764
|
"div",
|
|
665
765
|
{
|
|
666
766
|
className: `space-y-3 ${className ?? ""}`,
|
|
667
767
|
onTouchStart,
|
|
668
768
|
onTouchMove,
|
|
669
769
|
onClickCapture,
|
|
670
|
-
children: data.map((item, index) => /* @__PURE__ */
|
|
770
|
+
children: data.map((item, index) => /* @__PURE__ */ jsx19(
|
|
671
771
|
"div",
|
|
672
772
|
{
|
|
673
773
|
className: "rounded-xl border p-4 transition-all duration-150 hover:border-foreground/20 active:scale-[0.99]",
|
|
@@ -680,7 +780,7 @@ function MobileCardList({
|
|
|
680
780
|
}
|
|
681
781
|
|
|
682
782
|
// src/components/responsive-data-view.tsx
|
|
683
|
-
import { jsx as
|
|
783
|
+
import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
684
784
|
function ResponsiveDataView({
|
|
685
785
|
table,
|
|
686
786
|
cards,
|
|
@@ -691,13 +791,13 @@ function ResponsiveDataView({
|
|
|
691
791
|
emptyDescription,
|
|
692
792
|
pagination
|
|
693
793
|
}) {
|
|
694
|
-
return /* @__PURE__ */
|
|
695
|
-
/* @__PURE__ */
|
|
696
|
-
/* @__PURE__ */
|
|
697
|
-
!isLoading && isEmpty && /* @__PURE__ */
|
|
698
|
-
emptyIcon && /* @__PURE__ */
|
|
699
|
-
/* @__PURE__ */
|
|
700
|
-
emptyDescription && /* @__PURE__ */
|
|
794
|
+
return /* @__PURE__ */ jsxs18("div", { className: "space-y-4", children: [
|
|
795
|
+
/* @__PURE__ */ jsx20("div", { className: "hidden overflow-x-auto rounded-md border md:block", children: table }),
|
|
796
|
+
/* @__PURE__ */ jsx20("div", { className: "md:hidden", children: cards }),
|
|
797
|
+
!isLoading && isEmpty && /* @__PURE__ */ jsxs18("div", { className: "flex flex-col items-center justify-center py-16 text-center", children: [
|
|
798
|
+
emptyIcon && /* @__PURE__ */ jsx20("div", { className: "mb-4 text-muted-foreground", children: emptyIcon }),
|
|
799
|
+
/* @__PURE__ */ jsx20("h3", { className: "text-lg font-semibold tracking-tight", children: emptyTitle }),
|
|
800
|
+
emptyDescription && /* @__PURE__ */ jsx20("p", { className: "mt-1 max-w-sm text-sm text-muted-foreground", children: emptyDescription })
|
|
701
801
|
] }),
|
|
702
802
|
pagination
|
|
703
803
|
] });
|
|
@@ -705,10 +805,10 @@ function ResponsiveDataView({
|
|
|
705
805
|
|
|
706
806
|
// src/components/toaster.tsx
|
|
707
807
|
import { Toaster as Sonner } from "sonner";
|
|
708
|
-
import { jsx as
|
|
808
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
709
809
|
function Toaster(props) {
|
|
710
810
|
const { theme = "system" } = useTheme();
|
|
711
|
-
return /* @__PURE__ */
|
|
811
|
+
return /* @__PURE__ */ jsx21(
|
|
712
812
|
Sonner,
|
|
713
813
|
{
|
|
714
814
|
theme,
|
|
@@ -730,17 +830,17 @@ function Toaster(props) {
|
|
|
730
830
|
|
|
731
831
|
// src/components/app-shell.tsx
|
|
732
832
|
import { ChevronLeft, ChevronRight, Menu } from "lucide-react";
|
|
733
|
-
import { useState as
|
|
833
|
+
import { useState as useState4 } from "react";
|
|
734
834
|
|
|
735
835
|
// src/components/sidebar-nav.tsx
|
|
736
836
|
import { Fragment as Fragment3 } from "react";
|
|
737
837
|
|
|
738
838
|
// src/components/types.tsx
|
|
739
|
-
import { jsx as
|
|
740
|
-
var defaultRenderLink = ({ children, ...props }) => /* @__PURE__ */
|
|
839
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
840
|
+
var defaultRenderLink = ({ children, ...props }) => /* @__PURE__ */ jsx22("a", { ...props, children });
|
|
741
841
|
|
|
742
842
|
// src/components/sidebar-nav.tsx
|
|
743
|
-
import { Fragment as Fragment4, jsx as
|
|
843
|
+
import { Fragment as Fragment4, jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
744
844
|
function defaultIsActive(item, activePath) {
|
|
745
845
|
if (item.href === "/") return activePath === "/";
|
|
746
846
|
return activePath === item.href || activePath.startsWith(item.href + "/");
|
|
@@ -755,7 +855,7 @@ function SidebarNav({
|
|
|
755
855
|
onNavigate
|
|
756
856
|
}) {
|
|
757
857
|
const visible = items.filter((item) => !item.adminOnly || isAdmin);
|
|
758
|
-
return /* @__PURE__ */
|
|
858
|
+
return /* @__PURE__ */ jsx23("nav", { className: "flex flex-col gap-1", children: visible.map((item) => {
|
|
759
859
|
const active = isActive(item, activePath);
|
|
760
860
|
const link = renderLink({
|
|
761
861
|
href: item.href,
|
|
@@ -767,19 +867,19 @@ function SidebarNav({
|
|
|
767
867
|
active ? "bg-accent text-accent-foreground font-semibold" : "text-muted-foreground hover:bg-accent hover:text-accent-foreground",
|
|
768
868
|
isCollapsed && "justify-center px-2"
|
|
769
869
|
),
|
|
770
|
-
children: /* @__PURE__ */
|
|
771
|
-
item.icon && /* @__PURE__ */
|
|
772
|
-
!isCollapsed && /* @__PURE__ */
|
|
870
|
+
children: /* @__PURE__ */ jsxs19(Fragment4, { children: [
|
|
871
|
+
item.icon && /* @__PURE__ */ jsx23("span", { className: "shrink-0", children: item.icon }),
|
|
872
|
+
!isCollapsed && /* @__PURE__ */ jsx23("span", { className: "truncate", children: item.label })
|
|
773
873
|
] })
|
|
774
874
|
});
|
|
775
|
-
return /* @__PURE__ */
|
|
875
|
+
return /* @__PURE__ */ jsx23(Fragment3, { children: link }, item.href);
|
|
776
876
|
}) });
|
|
777
877
|
}
|
|
778
878
|
|
|
779
879
|
// src/components/user-menu.tsx
|
|
780
880
|
import * as DropdownMenu2 from "@radix-ui/react-dropdown-menu";
|
|
781
881
|
import { LogOut, User } from "lucide-react";
|
|
782
|
-
import { Fragment as Fragment5, jsx as
|
|
882
|
+
import { Fragment as Fragment5, jsx as jsx24, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
783
883
|
function initials(user) {
|
|
784
884
|
const source = user?.name?.trim() || user?.email?.trim();
|
|
785
885
|
if (!source) return "";
|
|
@@ -797,44 +897,44 @@ function UserMenu({
|
|
|
797
897
|
align = "end"
|
|
798
898
|
}) {
|
|
799
899
|
const label = initials(user);
|
|
800
|
-
return /* @__PURE__ */
|
|
801
|
-
/* @__PURE__ */
|
|
900
|
+
return /* @__PURE__ */ jsxs20(DropdownMenu2.Root, { children: [
|
|
901
|
+
/* @__PURE__ */ jsx24(DropdownMenu2.Trigger, { asChild: true, children: /* @__PURE__ */ jsx24(
|
|
802
902
|
"button",
|
|
803
903
|
{
|
|
804
904
|
type: "button",
|
|
805
905
|
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",
|
|
806
906
|
"aria-label": "Menu do usu\xE1rio",
|
|
807
907
|
"data-testid": "user-menu",
|
|
808
|
-
children: user?.avatarUrl ? /* @__PURE__ */
|
|
908
|
+
children: user?.avatarUrl ? /* @__PURE__ */ jsx24("img", { src: user.avatarUrl, alt: user.name ?? user.email ?? "Avatar", className: "h-full w-full object-cover" }) : label ? /* @__PURE__ */ jsx24("span", { children: label }) : /* @__PURE__ */ jsx24(User, { className: "h-4 w-4" })
|
|
809
909
|
}
|
|
810
910
|
) }),
|
|
811
|
-
/* @__PURE__ */
|
|
911
|
+
/* @__PURE__ */ jsx24(DropdownMenu2.Portal, { children: /* @__PURE__ */ jsxs20(
|
|
812
912
|
DropdownMenu2.Content,
|
|
813
913
|
{
|
|
814
914
|
align,
|
|
815
915
|
sideOffset: 6,
|
|
816
916
|
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",
|
|
817
917
|
children: [
|
|
818
|
-
(user?.name || user?.email) && /* @__PURE__ */
|
|
819
|
-
/* @__PURE__ */
|
|
820
|
-
user.name && /* @__PURE__ */
|
|
821
|
-
user.email && /* @__PURE__ */
|
|
918
|
+
(user?.name || user?.email) && /* @__PURE__ */ jsxs20(Fragment5, { children: [
|
|
919
|
+
/* @__PURE__ */ jsxs20("div", { className: "px-2 py-1.5", children: [
|
|
920
|
+
user.name && /* @__PURE__ */ jsx24("p", { className: "truncate text-sm font-medium", children: user.name }),
|
|
921
|
+
user.email && /* @__PURE__ */ jsx24("p", { className: "truncate text-xs text-muted-foreground", children: user.email })
|
|
822
922
|
] }),
|
|
823
|
-
/* @__PURE__ */
|
|
923
|
+
/* @__PURE__ */ jsx24(DropdownMenu2.Separator, { className: "-mx-1 my-1 h-px bg-border" })
|
|
824
924
|
] }),
|
|
825
925
|
items.map(
|
|
826
|
-
(item) => item.href ? /* @__PURE__ */
|
|
926
|
+
(item) => item.href ? /* @__PURE__ */ jsx24(DropdownMenu2.Item, { asChild: true, children: renderLink({ href: item.href, className: itemClass, children: /* @__PURE__ */ jsxs20(Fragment5, { children: [
|
|
827
927
|
item.icon,
|
|
828
928
|
item.label
|
|
829
|
-
] }) }) }, item.label) : /* @__PURE__ */
|
|
929
|
+
] }) }) }, item.label) : /* @__PURE__ */ jsxs20(DropdownMenu2.Item, { className: itemClass, onClick: item.onClick, children: [
|
|
830
930
|
item.icon,
|
|
831
931
|
item.label
|
|
832
932
|
] }, item.label)
|
|
833
933
|
),
|
|
834
|
-
onLogout && /* @__PURE__ */
|
|
835
|
-
items.length > 0 && /* @__PURE__ */
|
|
836
|
-
/* @__PURE__ */
|
|
837
|
-
/* @__PURE__ */
|
|
934
|
+
onLogout && /* @__PURE__ */ jsxs20(Fragment5, { children: [
|
|
935
|
+
items.length > 0 && /* @__PURE__ */ jsx24(DropdownMenu2.Separator, { className: "-mx-1 my-1 h-px bg-border" }),
|
|
936
|
+
/* @__PURE__ */ jsxs20(DropdownMenu2.Item, { className: cn(itemClass, "text-destructive focus:bg-destructive/10"), onClick: onLogout, children: [
|
|
937
|
+
/* @__PURE__ */ jsx24(LogOut, { className: "h-4 w-4" }),
|
|
838
938
|
logoutLabel
|
|
839
939
|
] })
|
|
840
940
|
] })
|
|
@@ -845,7 +945,7 @@ function UserMenu({
|
|
|
845
945
|
}
|
|
846
946
|
|
|
847
947
|
// src/components/app-shell.tsx
|
|
848
|
-
import { jsx as
|
|
948
|
+
import { jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
849
949
|
function AppShell({
|
|
850
950
|
brand,
|
|
851
951
|
brandCollapsed,
|
|
@@ -862,9 +962,9 @@ function AppShell({
|
|
|
862
962
|
defaultCollapsed = false,
|
|
863
963
|
children
|
|
864
964
|
}) {
|
|
865
|
-
const [collapsed, setCollapsed] =
|
|
866
|
-
const [mobileOpen, setMobileOpen] =
|
|
867
|
-
const nav = (isCollapsed, onNavigate) => /* @__PURE__ */
|
|
965
|
+
const [collapsed, setCollapsed] = useState4(defaultCollapsed);
|
|
966
|
+
const [mobileOpen, setMobileOpen] = useState4(false);
|
|
967
|
+
const nav = (isCollapsed, onNavigate) => /* @__PURE__ */ jsx25(
|
|
868
968
|
SidebarNav,
|
|
869
969
|
{
|
|
870
970
|
items: navItems,
|
|
@@ -876,8 +976,8 @@ function AppShell({
|
|
|
876
976
|
onNavigate
|
|
877
977
|
}
|
|
878
978
|
);
|
|
879
|
-
return /* @__PURE__ */
|
|
880
|
-
/* @__PURE__ */
|
|
979
|
+
return /* @__PURE__ */ jsxs21("div", { className: "flex h-screen overflow-hidden bg-background", children: [
|
|
980
|
+
/* @__PURE__ */ jsxs21(
|
|
881
981
|
"aside",
|
|
882
982
|
{
|
|
883
983
|
className: cn(
|
|
@@ -885,22 +985,22 @@ function AppShell({
|
|
|
885
985
|
collapsed ? "w-16" : "w-60"
|
|
886
986
|
),
|
|
887
987
|
children: [
|
|
888
|
-
/* @__PURE__ */
|
|
889
|
-
/* @__PURE__ */
|
|
890
|
-
collapsible && /* @__PURE__ */
|
|
988
|
+
/* @__PURE__ */ jsx25("div", { className: "flex h-14 shrink-0 items-center border-b px-4", children: collapsed ? brandCollapsed ?? brand : brand }),
|
|
989
|
+
/* @__PURE__ */ jsx25("div", { className: "flex-1 overflow-y-auto px-2 py-4", children: nav(collapsed) }),
|
|
990
|
+
collapsible && /* @__PURE__ */ jsx25("div", { className: "border-t p-2", children: /* @__PURE__ */ jsx25(
|
|
891
991
|
"button",
|
|
892
992
|
{
|
|
893
993
|
type: "button",
|
|
894
994
|
onClick: () => setCollapsed((v) => !v),
|
|
895
995
|
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",
|
|
896
996
|
"aria-label": collapsed ? "Expandir menu" : "Recolher menu",
|
|
897
|
-
children: collapsed ? /* @__PURE__ */
|
|
997
|
+
children: collapsed ? /* @__PURE__ */ jsx25(ChevronRight, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx25(ChevronLeft, { className: "h-4 w-4" })
|
|
898
998
|
}
|
|
899
999
|
) })
|
|
900
1000
|
]
|
|
901
1001
|
}
|
|
902
1002
|
),
|
|
903
|
-
/* @__PURE__ */
|
|
1003
|
+
/* @__PURE__ */ jsxs21(
|
|
904
1004
|
"div",
|
|
905
1005
|
{
|
|
906
1006
|
className: cn(
|
|
@@ -909,8 +1009,8 @@ function AppShell({
|
|
|
909
1009
|
),
|
|
910
1010
|
onClick: () => setMobileOpen(false),
|
|
911
1011
|
children: [
|
|
912
|
-
/* @__PURE__ */
|
|
913
|
-
/* @__PURE__ */
|
|
1012
|
+
/* @__PURE__ */ jsx25("div", { className: "absolute inset-0 bg-black/50" }),
|
|
1013
|
+
/* @__PURE__ */ jsxs21(
|
|
914
1014
|
"div",
|
|
915
1015
|
{
|
|
916
1016
|
className: cn(
|
|
@@ -919,32 +1019,32 @@ function AppShell({
|
|
|
919
1019
|
),
|
|
920
1020
|
onClick: (e) => e.stopPropagation(),
|
|
921
1021
|
children: [
|
|
922
|
-
/* @__PURE__ */
|
|
923
|
-
/* @__PURE__ */
|
|
1022
|
+
/* @__PURE__ */ jsx25("div", { className: "flex h-14 shrink-0 items-center border-b px-4", children: brand }),
|
|
1023
|
+
/* @__PURE__ */ jsx25("div", { className: "flex-1 overflow-y-auto px-2 py-4", children: nav(false, () => setMobileOpen(false)) })
|
|
924
1024
|
]
|
|
925
1025
|
}
|
|
926
1026
|
)
|
|
927
1027
|
]
|
|
928
1028
|
}
|
|
929
1029
|
),
|
|
930
|
-
/* @__PURE__ */
|
|
931
|
-
/* @__PURE__ */
|
|
932
|
-
/* @__PURE__ */
|
|
1030
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex flex-1 flex-col overflow-hidden", children: [
|
|
1031
|
+
/* @__PURE__ */ jsxs21("header", { className: "flex h-14 shrink-0 items-center gap-2 border-b bg-background px-4", children: [
|
|
1032
|
+
/* @__PURE__ */ jsx25(
|
|
933
1033
|
"button",
|
|
934
1034
|
{
|
|
935
1035
|
type: "button",
|
|
936
1036
|
onClick: () => setMobileOpen(true),
|
|
937
1037
|
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",
|
|
938
1038
|
"aria-label": "Abrir menu",
|
|
939
|
-
children: /* @__PURE__ */
|
|
1039
|
+
children: /* @__PURE__ */ jsx25(Menu, { className: "h-4 w-4" })
|
|
940
1040
|
}
|
|
941
1041
|
),
|
|
942
|
-
/* @__PURE__ */
|
|
1042
|
+
/* @__PURE__ */ jsxs21("div", { className: "ml-auto flex items-center gap-2", children: [
|
|
943
1043
|
headerActions,
|
|
944
|
-
(user || onLogout) && /* @__PURE__ */
|
|
1044
|
+
(user || onLogout) && /* @__PURE__ */ jsx25(UserMenu, { user, items: userMenuItems, onLogout, renderLink })
|
|
945
1045
|
] })
|
|
946
1046
|
] }),
|
|
947
|
-
/* @__PURE__ */
|
|
1047
|
+
/* @__PURE__ */ jsx25("main", { className: "flex-1 overflow-y-auto", children })
|
|
948
1048
|
] })
|
|
949
1049
|
] });
|
|
950
1050
|
}
|
|
@@ -952,7 +1052,7 @@ function AppShell({
|
|
|
952
1052
|
// src/components/row-actions-menu.tsx
|
|
953
1053
|
import * as DropdownMenu3 from "@radix-ui/react-dropdown-menu";
|
|
954
1054
|
import { MoreVertical } from "lucide-react";
|
|
955
|
-
import { Fragment as Fragment6, jsx as
|
|
1055
|
+
import { Fragment as Fragment6, jsx as jsx26, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
956
1056
|
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";
|
|
957
1057
|
function RowActionsMenu({
|
|
958
1058
|
actions,
|
|
@@ -962,18 +1062,18 @@ function RowActionsMenu({
|
|
|
962
1062
|
renderLink = defaultRenderLink
|
|
963
1063
|
}) {
|
|
964
1064
|
if (actions.length === 0) return null;
|
|
965
|
-
return /* @__PURE__ */
|
|
966
|
-
/* @__PURE__ */
|
|
1065
|
+
return /* @__PURE__ */ jsxs22(DropdownMenu3.Root, { children: [
|
|
1066
|
+
/* @__PURE__ */ jsx26(DropdownMenu3.Trigger, { asChild: true, children: /* @__PURE__ */ jsx26(
|
|
967
1067
|
"button",
|
|
968
1068
|
{
|
|
969
1069
|
type: "button",
|
|
970
1070
|
disabled,
|
|
971
1071
|
"aria-label": label,
|
|
972
1072
|
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",
|
|
973
|
-
children: /* @__PURE__ */
|
|
1073
|
+
children: /* @__PURE__ */ jsx26(MoreVertical, { className: "h-4 w-4" })
|
|
974
1074
|
}
|
|
975
1075
|
) }),
|
|
976
|
-
/* @__PURE__ */
|
|
1076
|
+
/* @__PURE__ */ jsx26(DropdownMenu3.Portal, { children: /* @__PURE__ */ jsx26(
|
|
977
1077
|
DropdownMenu3.Content,
|
|
978
1078
|
{
|
|
979
1079
|
align,
|
|
@@ -981,14 +1081,14 @@ function RowActionsMenu({
|
|
|
981
1081
|
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",
|
|
982
1082
|
children: actions.map((action) => {
|
|
983
1083
|
const cls = cn(itemClass2, action.destructive && "text-destructive focus:bg-destructive/10");
|
|
984
|
-
return action.href ? /* @__PURE__ */
|
|
1084
|
+
return action.href ? /* @__PURE__ */ jsx26(DropdownMenu3.Item, { asChild: true, disabled: action.disabled, children: renderLink({
|
|
985
1085
|
href: action.href,
|
|
986
1086
|
className: cls,
|
|
987
|
-
children: /* @__PURE__ */
|
|
1087
|
+
children: /* @__PURE__ */ jsxs22(Fragment6, { children: [
|
|
988
1088
|
action.icon,
|
|
989
1089
|
action.label
|
|
990
1090
|
] })
|
|
991
|
-
}) }, action.label) : /* @__PURE__ */
|
|
1091
|
+
}) }, action.label) : /* @__PURE__ */ jsxs22(
|
|
992
1092
|
DropdownMenu3.Item,
|
|
993
1093
|
{
|
|
994
1094
|
className: cls,
|
|
@@ -1017,9 +1117,9 @@ function extractApiError(err, fallbackMessage = "Ocorreu um erro inesperado.") {
|
|
|
1017
1117
|
}
|
|
1018
1118
|
|
|
1019
1119
|
// src/hooks/use-disclosure.ts
|
|
1020
|
-
import { useCallback, useState as
|
|
1120
|
+
import { useCallback, useState as useState5 } from "react";
|
|
1021
1121
|
function useDisclosure(initial = false) {
|
|
1022
|
-
const [open, setOpen] =
|
|
1122
|
+
const [open, setOpen] = useState5(initial);
|
|
1023
1123
|
const onOpen = useCallback(() => setOpen(true), []);
|
|
1024
1124
|
const onClose = useCallback(() => setOpen(false), []);
|
|
1025
1125
|
const onToggle = useCallback(() => setOpen((v) => !v), []);
|
|
@@ -1054,6 +1154,7 @@ function useCustomToast() {
|
|
|
1054
1154
|
export {
|
|
1055
1155
|
AppShell,
|
|
1056
1156
|
AuthCard,
|
|
1157
|
+
Combobox,
|
|
1057
1158
|
ConfirmDialog,
|
|
1058
1159
|
DataTableWrapper,
|
|
1059
1160
|
EmptyState,
|