@motor-hero/ui-kit 0.17.0 → 0.18.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/combobox.d.ts.map +1 -1
- package/dist/components/row-actions-menu.d.ts +1 -1
- package/dist/components/row-actions-menu.d.ts.map +1 -1
- package/dist/components/user-menu.d.ts +1 -1
- package/dist/components/user-menu.d.ts.map +1 -1
- package/dist/hooks/use-is-desktop.d.ts +7 -0
- package/dist/hooks/use-is-desktop.d.ts.map +1 -0
- package/dist/index.cjs +266 -90
- 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 +260 -85
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/combobox.tsx +1 -20
- package/src/components/row-actions-menu.tsx +113 -36
- package/src/components/user-menu.tsx +157 -48
- package/src/hooks/use-is-desktop.ts +26 -0
- package/src/index.ts +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox.d.ts","sourceRoot":"","sources":["../../src/components/combobox.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"combobox.d.ts","sourceRoot":"","sources":["../../src/components/combobox.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,cAAc,EAAE,CAAA;IACzB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,oDAAoD;IACpD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,oCAAoC;IACpC,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,+CAA+C;IAC/C,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAA;IAC3C,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC5B;AAED;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,EACvB,OAAO,EACP,KAAK,EACL,QAAQ,EACR,WAA4B,EAC5B,iBAA+B,EAC/B,YAA6C,EAC7C,QAAQ,EACR,EAAE,EACF,SAAS,EACT,cAAc,EAAE,WAAW,EAC3B,kBAAkB,EAAE,eAAe,GACpC,EAAE,aAAa,qBAgGf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"row-actions-menu.d.ts","sourceRoot":"","sources":["../../src/components/row-actions-menu.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"row-actions-menu.d.ts","sourceRoot":"","sources":["../../src/components/row-actions-menu.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,OAAO,CAAA;AAIhD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAGzC,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,SAAS,EAAE,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAA;IAClC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,UAAU,CAAA;CACxB;AAWD,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,QAAgB,EAChB,KAAa,EACb,KAAe,EACf,UAA8B,GAC/B,EAAE,mBAAmB,sCAyHrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-menu.d.ts","sourceRoot":"","sources":["../../src/components/user-menu.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"user-menu.d.ts","sourceRoot":"","sources":["../../src/components/user-menu.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,OAAO,CAAA;AAIhD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAGzC,MAAM,WAAW,OAAO;IACtB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CACrB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,KAAK,CAAC,EAAE,YAAY,EAAE,CAAA;IACtB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAA;CACnC;AAeD,wBAAgB,QAAQ,CAAC,EACvB,IAAI,EACJ,KAAU,EACV,QAAQ,EACR,WAAoB,EACpB,UAA8B,EAC9B,KAAa,GACd,EAAE,aAAa,+BA6Kf"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retorna `true` no desktop (>= 640px, breakpoint `sm`) e `false` no mobile.
|
|
3
|
+
* Usado para alternar Popover/DropdownMenu (desktop) por Drawer/bottom sheet
|
|
4
|
+
* (mobile) em componentes responsivos como Combobox e os menus de ação.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useIsDesktop(): boolean;
|
|
7
|
+
//# sourceMappingURL=use-is-desktop.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-is-desktop.d.ts","sourceRoot":"","sources":["../../src/hooks/use-is-desktop.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAgBtC"}
|
package/dist/index.cjs
CHANGED
|
@@ -62,6 +62,7 @@ __export(index_exports, {
|
|
|
62
62
|
toast: () => import_sonner2.toast,
|
|
63
63
|
useCustomToast: () => useCustomToast,
|
|
64
64
|
useDisclosure: () => useDisclosure,
|
|
65
|
+
useIsDesktop: () => useIsDesktop,
|
|
65
66
|
useTheme: () => useTheme
|
|
66
67
|
});
|
|
67
68
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -614,9 +615,11 @@ PasswordInput.displayName = "PasswordInput";
|
|
|
614
615
|
var PopoverPrimitive = __toESM(require("@radix-ui/react-popover"), 1);
|
|
615
616
|
var import_cmdk = require("cmdk");
|
|
616
617
|
var import_lucide_react4 = require("lucide-react");
|
|
617
|
-
var
|
|
618
|
+
var React5 = __toESM(require("react"), 1);
|
|
618
619
|
var import_vaul = require("vaul");
|
|
619
|
-
|
|
620
|
+
|
|
621
|
+
// src/hooks/use-is-desktop.ts
|
|
622
|
+
var React4 = __toESM(require("react"), 1);
|
|
620
623
|
var DESKTOP_QUERY = "(min-width: 640px)";
|
|
621
624
|
function useIsDesktop() {
|
|
622
625
|
const [isDesktop, setIsDesktop] = React4.useState(
|
|
@@ -631,6 +634,9 @@ function useIsDesktop() {
|
|
|
631
634
|
}, []);
|
|
632
635
|
return isDesktop;
|
|
633
636
|
}
|
|
637
|
+
|
|
638
|
+
// src/components/combobox.tsx
|
|
639
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
634
640
|
function Combobox({
|
|
635
641
|
options,
|
|
636
642
|
value,
|
|
@@ -644,7 +650,7 @@ function Combobox({
|
|
|
644
650
|
"aria-invalid": ariaInvalid,
|
|
645
651
|
"aria-describedby": ariaDescribedby
|
|
646
652
|
}) {
|
|
647
|
-
const [open, setOpen] =
|
|
653
|
+
const [open, setOpen] = React5.useState(false);
|
|
648
654
|
const isDesktop = useIsDesktop();
|
|
649
655
|
const selected = options.find((option) => option.value === value);
|
|
650
656
|
const trigger = /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
@@ -923,7 +929,7 @@ function Toaster(props) {
|
|
|
923
929
|
|
|
924
930
|
// src/components/app-shell.tsx
|
|
925
931
|
var import_lucide_react6 = require("lucide-react");
|
|
926
|
-
var
|
|
932
|
+
var import_react6 = require("react");
|
|
927
933
|
|
|
928
934
|
// src/components/sidebar-nav.tsx
|
|
929
935
|
var import_react4 = require("react");
|
|
@@ -972,6 +978,8 @@ function SidebarNav({
|
|
|
972
978
|
// src/components/user-menu.tsx
|
|
973
979
|
var DropdownMenu2 = __toESM(require("@radix-ui/react-dropdown-menu"), 1);
|
|
974
980
|
var import_lucide_react5 = require("lucide-react");
|
|
981
|
+
var import_react5 = require("react");
|
|
982
|
+
var import_vaul2 = require("vaul");
|
|
975
983
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
976
984
|
function initials(user) {
|
|
977
985
|
const source = user?.name?.trim() || user?.email?.trim();
|
|
@@ -981,6 +989,7 @@ function initials(user) {
|
|
|
981
989
|
return source.slice(0, 2).toUpperCase();
|
|
982
990
|
}
|
|
983
991
|
var itemClass = "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";
|
|
992
|
+
var sheetItemClass = "flex w-full cursor-pointer select-none items-center gap-3 rounded-md px-3 py-3 text-base outline-none transition-colors hover:bg-accent active:bg-accent";
|
|
984
993
|
function UserMenu({
|
|
985
994
|
user,
|
|
986
995
|
items = [],
|
|
@@ -989,51 +998,151 @@ function UserMenu({
|
|
|
989
998
|
renderLink = defaultRenderLink,
|
|
990
999
|
align = "end"
|
|
991
1000
|
}) {
|
|
1001
|
+
const isDesktop = useIsDesktop();
|
|
1002
|
+
const [open, setOpen] = (0, import_react5.useState)(false);
|
|
992
1003
|
const label = initials(user);
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1004
|
+
const trigger = /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1005
|
+
"button",
|
|
1006
|
+
{
|
|
1007
|
+
type: "button",
|
|
1008
|
+
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-2 focus-visible:ring-ring",
|
|
1009
|
+
"aria-label": "Menu do usu\xE1rio",
|
|
1010
|
+
"data-testid": "user-menu",
|
|
1011
|
+
children: user?.avatarUrl ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1012
|
+
"img",
|
|
1013
|
+
{
|
|
1014
|
+
src: user.avatarUrl,
|
|
1015
|
+
alt: user.name ?? user.email ?? "Avatar",
|
|
1016
|
+
className: "h-full w-full object-cover"
|
|
1017
|
+
}
|
|
1018
|
+
) : label ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: label }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react5.User, { className: "h-4 w-4" })
|
|
1019
|
+
}
|
|
1020
|
+
);
|
|
1021
|
+
const userInfo = (user?.name || user?.email) && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "px-2 py-1.5", children: [
|
|
1022
|
+
user.name && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "truncate text-sm font-medium", children: user.name }),
|
|
1023
|
+
user.email && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "truncate text-xs text-muted-foreground", children: user.email })
|
|
1024
|
+
] });
|
|
1025
|
+
if (isDesktop) {
|
|
1026
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(DropdownMenu2.Root, { open, onOpenChange: setOpen, children: [
|
|
1027
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DropdownMenu2.Trigger, { asChild: true, children: trigger }),
|
|
1028
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DropdownMenu2.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
1029
|
+
DropdownMenu2.Content,
|
|
1030
|
+
{
|
|
1031
|
+
align,
|
|
1032
|
+
sideOffset: 6,
|
|
1033
|
+
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",
|
|
1034
|
+
children: [
|
|
1035
|
+
userInfo && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
1036
|
+
userInfo,
|
|
1037
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DropdownMenu2.Separator, { className: "-mx-1 my-1 h-px bg-border" })
|
|
1015
1038
|
] }),
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
item.label
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1039
|
+
items.map(
|
|
1040
|
+
(item) => item.href ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DropdownMenu2.Item, { asChild: true, children: renderLink({
|
|
1041
|
+
href: item.href,
|
|
1042
|
+
className: itemClass,
|
|
1043
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
1044
|
+
item.icon,
|
|
1045
|
+
item.label
|
|
1046
|
+
] })
|
|
1047
|
+
}) }, item.label) : /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
1048
|
+
DropdownMenu2.Item,
|
|
1049
|
+
{
|
|
1050
|
+
className: itemClass,
|
|
1051
|
+
onClick: item.onClick,
|
|
1052
|
+
children: [
|
|
1053
|
+
item.icon,
|
|
1054
|
+
item.label
|
|
1055
|
+
]
|
|
1056
|
+
},
|
|
1057
|
+
item.label
|
|
1058
|
+
)
|
|
1059
|
+
),
|
|
1060
|
+
onLogout && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
1061
|
+
items.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DropdownMenu2.Separator, { className: "-mx-1 my-1 h-px bg-border" }),
|
|
1062
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
1063
|
+
DropdownMenu2.Item,
|
|
1064
|
+
{
|
|
1065
|
+
className: cn(
|
|
1066
|
+
itemClass,
|
|
1067
|
+
"text-destructive focus:bg-destructive/10"
|
|
1068
|
+
),
|
|
1069
|
+
onClick: onLogout,
|
|
1070
|
+
children: [
|
|
1071
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react5.LogOut, { className: "h-4 w-4" }),
|
|
1072
|
+
logoutLabel
|
|
1073
|
+
]
|
|
1074
|
+
}
|
|
1075
|
+
)
|
|
1032
1076
|
] })
|
|
1033
|
-
]
|
|
1034
|
-
|
|
1035
|
-
}
|
|
1036
|
-
|
|
1077
|
+
]
|
|
1078
|
+
}
|
|
1079
|
+
) })
|
|
1080
|
+
] });
|
|
1081
|
+
}
|
|
1082
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_vaul2.Drawer.Root, { open, onOpenChange: setOpen, children: [
|
|
1083
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_vaul2.Drawer.Trigger, { asChild: true, children: trigger }),
|
|
1084
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_vaul2.Drawer.Portal, { children: [
|
|
1085
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_vaul2.Drawer.Overlay, { className: "fixed inset-0 z-50 bg-black/80" }),
|
|
1086
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_vaul2.Drawer.Content, { className: "fixed inset-x-0 bottom-0 z-50 flex flex-col rounded-t-2xl border bg-popover p-2 pb-[max(0.5rem,env(safe-area-inset-bottom))] text-popover-foreground outline-none", children: [
|
|
1087
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_vaul2.Drawer.Title, { className: "sr-only", children: "Menu do usu\xE1rio" }),
|
|
1088
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "mx-auto my-3 h-1.5 w-12 shrink-0 rounded-full bg-muted" }),
|
|
1089
|
+
userInfo && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
1090
|
+
userInfo,
|
|
1091
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "-mx-1 my-1 h-px bg-border" })
|
|
1092
|
+
] }),
|
|
1093
|
+
items.map(
|
|
1094
|
+
(item) => item.href ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1095
|
+
"span",
|
|
1096
|
+
{
|
|
1097
|
+
onClick: () => setOpen(false),
|
|
1098
|
+
onKeyDown: () => setOpen(false),
|
|
1099
|
+
children: renderLink({
|
|
1100
|
+
href: item.href,
|
|
1101
|
+
className: sheetItemClass,
|
|
1102
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
1103
|
+
item.icon,
|
|
1104
|
+
item.label
|
|
1105
|
+
] })
|
|
1106
|
+
})
|
|
1107
|
+
},
|
|
1108
|
+
item.label
|
|
1109
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
1110
|
+
"button",
|
|
1111
|
+
{
|
|
1112
|
+
type: "button",
|
|
1113
|
+
className: sheetItemClass,
|
|
1114
|
+
onClick: () => {
|
|
1115
|
+
item.onClick?.();
|
|
1116
|
+
setOpen(false);
|
|
1117
|
+
},
|
|
1118
|
+
children: [
|
|
1119
|
+
item.icon,
|
|
1120
|
+
item.label
|
|
1121
|
+
]
|
|
1122
|
+
},
|
|
1123
|
+
item.label
|
|
1124
|
+
)
|
|
1125
|
+
),
|
|
1126
|
+
onLogout && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
1127
|
+
items.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "-mx-1 my-1 h-px bg-border" }),
|
|
1128
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
1129
|
+
"button",
|
|
1130
|
+
{
|
|
1131
|
+
type: "button",
|
|
1132
|
+
className: cn(sheetItemClass, "text-destructive"),
|
|
1133
|
+
onClick: () => {
|
|
1134
|
+
onLogout();
|
|
1135
|
+
setOpen(false);
|
|
1136
|
+
},
|
|
1137
|
+
children: [
|
|
1138
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react5.LogOut, { className: "h-4 w-4" }),
|
|
1139
|
+
logoutLabel
|
|
1140
|
+
]
|
|
1141
|
+
}
|
|
1142
|
+
)
|
|
1143
|
+
] })
|
|
1144
|
+
] })
|
|
1145
|
+
] })
|
|
1037
1146
|
] });
|
|
1038
1147
|
}
|
|
1039
1148
|
|
|
@@ -1055,8 +1164,8 @@ function AppShell({
|
|
|
1055
1164
|
defaultCollapsed = false,
|
|
1056
1165
|
children
|
|
1057
1166
|
}) {
|
|
1058
|
-
const [collapsed, setCollapsed] = (0,
|
|
1059
|
-
const [mobileOpen, setMobileOpen] = (0,
|
|
1167
|
+
const [collapsed, setCollapsed] = (0, import_react6.useState)(defaultCollapsed);
|
|
1168
|
+
const [mobileOpen, setMobileOpen] = (0, import_react6.useState)(false);
|
|
1060
1169
|
const nav = (isCollapsed, onNavigate) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1061
1170
|
SidebarNav,
|
|
1062
1171
|
{
|
|
@@ -1145,8 +1254,12 @@ function AppShell({
|
|
|
1145
1254
|
// src/components/row-actions-menu.tsx
|
|
1146
1255
|
var DropdownMenu3 = __toESM(require("@radix-ui/react-dropdown-menu"), 1);
|
|
1147
1256
|
var import_lucide_react7 = require("lucide-react");
|
|
1257
|
+
var import_react7 = require("react");
|
|
1258
|
+
var import_vaul3 = require("vaul");
|
|
1148
1259
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1260
|
+
var triggerClass = "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-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50";
|
|
1149
1261
|
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";
|
|
1262
|
+
var sheetItemClass2 = "flex w-full cursor-pointer select-none items-center gap-3 rounded-md px-3 py-3 text-base outline-none transition-colors hover:bg-accent active:bg-accent disabled:pointer-events-none disabled:opacity-50";
|
|
1150
1263
|
function RowActionsMenu({
|
|
1151
1264
|
actions,
|
|
1152
1265
|
disabled = false,
|
|
@@ -1154,49 +1267,111 @@ function RowActionsMenu({
|
|
|
1154
1267
|
label = "A\xE7\xF5es",
|
|
1155
1268
|
renderLink = defaultRenderLink
|
|
1156
1269
|
}) {
|
|
1270
|
+
const isDesktop = useIsDesktop();
|
|
1271
|
+
const [open, setOpen] = (0, import_react7.useState)(false);
|
|
1157
1272
|
if (actions.length === 0) return null;
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.
|
|
1170
|
-
DropdownMenu3.
|
|
1171
|
-
{
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1273
|
+
const trigger = /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1274
|
+
"button",
|
|
1275
|
+
{
|
|
1276
|
+
type: "button",
|
|
1277
|
+
disabled,
|
|
1278
|
+
"aria-label": label,
|
|
1279
|
+
className: triggerClass,
|
|
1280
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react7.MoreVertical, { className: "h-4 w-4" })
|
|
1281
|
+
}
|
|
1282
|
+
);
|
|
1283
|
+
if (isDesktop) {
|
|
1284
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(DropdownMenu3.Root, { open, onOpenChange: setOpen, children: [
|
|
1285
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DropdownMenu3.Trigger, { asChild: true, children: trigger }),
|
|
1286
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DropdownMenu3.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1287
|
+
DropdownMenu3.Content,
|
|
1288
|
+
{
|
|
1289
|
+
align,
|
|
1290
|
+
sideOffset: 6,
|
|
1291
|
+
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",
|
|
1292
|
+
children: actions.map((action) => {
|
|
1293
|
+
const cls = cn(
|
|
1294
|
+
itemClass2,
|
|
1295
|
+
action.destructive && "text-destructive focus:bg-destructive/10"
|
|
1296
|
+
);
|
|
1297
|
+
return action.href ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1298
|
+
DropdownMenu3.Item,
|
|
1299
|
+
{
|
|
1300
|
+
asChild: true,
|
|
1301
|
+
disabled: action.disabled,
|
|
1302
|
+
children: renderLink({
|
|
1303
|
+
href: action.href,
|
|
1304
|
+
className: cls,
|
|
1305
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
|
|
1306
|
+
action.icon,
|
|
1307
|
+
action.label
|
|
1308
|
+
] })
|
|
1309
|
+
})
|
|
1310
|
+
},
|
|
1182
1311
|
action.label
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1312
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
1313
|
+
DropdownMenu3.Item,
|
|
1314
|
+
{
|
|
1315
|
+
className: cls,
|
|
1316
|
+
disabled: action.disabled,
|
|
1317
|
+
onClick: action.onClick,
|
|
1318
|
+
children: [
|
|
1319
|
+
action.icon,
|
|
1320
|
+
action.label
|
|
1321
|
+
]
|
|
1322
|
+
},
|
|
1323
|
+
action.label
|
|
1324
|
+
);
|
|
1325
|
+
})
|
|
1326
|
+
}
|
|
1327
|
+
) })
|
|
1328
|
+
] });
|
|
1329
|
+
}
|
|
1330
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_vaul3.Drawer.Root, { open, onOpenChange: setOpen, children: [
|
|
1331
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_vaul3.Drawer.Trigger, { asChild: true, children: trigger }),
|
|
1332
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_vaul3.Drawer.Portal, { children: [
|
|
1333
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_vaul3.Drawer.Overlay, { className: "fixed inset-0 z-50 bg-black/80" }),
|
|
1334
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_vaul3.Drawer.Content, { className: "fixed inset-x-0 bottom-0 z-50 flex flex-col rounded-t-2xl border bg-popover p-2 pb-[max(0.5rem,env(safe-area-inset-bottom))] text-popover-foreground outline-none", children: [
|
|
1335
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_vaul3.Drawer.Title, { className: "sr-only", children: label }),
|
|
1336
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "mx-auto my-3 h-1.5 w-12 shrink-0 rounded-full bg-muted" }),
|
|
1337
|
+
actions.map((action) => {
|
|
1338
|
+
const cls = cn(
|
|
1339
|
+
sheetItemClass2,
|
|
1340
|
+
action.destructive && "text-destructive"
|
|
1341
|
+
);
|
|
1342
|
+
const inner = /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
|
|
1343
|
+
action.icon,
|
|
1344
|
+
action.label
|
|
1345
|
+
] });
|
|
1346
|
+
return action.href ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1347
|
+
"span",
|
|
1186
1348
|
{
|
|
1187
|
-
|
|
1349
|
+
onClick: () => setOpen(false),
|
|
1350
|
+
onKeyDown: () => setOpen(false),
|
|
1351
|
+
children: renderLink({
|
|
1352
|
+
href: action.href,
|
|
1353
|
+
className: cls,
|
|
1354
|
+
children: inner
|
|
1355
|
+
})
|
|
1356
|
+
},
|
|
1357
|
+
action.label
|
|
1358
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1359
|
+
"button",
|
|
1360
|
+
{
|
|
1361
|
+
type: "button",
|
|
1188
1362
|
disabled: action.disabled,
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
action.
|
|
1192
|
-
|
|
1193
|
-
|
|
1363
|
+
className: cls,
|
|
1364
|
+
onClick: () => {
|
|
1365
|
+
action.onClick?.();
|
|
1366
|
+
setOpen(false);
|
|
1367
|
+
},
|
|
1368
|
+
children: inner
|
|
1194
1369
|
},
|
|
1195
1370
|
action.label
|
|
1196
1371
|
);
|
|
1197
1372
|
})
|
|
1198
|
-
}
|
|
1199
|
-
|
|
1373
|
+
] })
|
|
1374
|
+
] })
|
|
1200
1375
|
] });
|
|
1201
1376
|
}
|
|
1202
1377
|
|
|
@@ -1210,20 +1385,20 @@ function extractApiError(err, fallbackMessage = "Ocorreu um erro inesperado.") {
|
|
|
1210
1385
|
}
|
|
1211
1386
|
|
|
1212
1387
|
// src/hooks/use-disclosure.ts
|
|
1213
|
-
var
|
|
1388
|
+
var import_react8 = require("react");
|
|
1214
1389
|
function useDisclosure(initial = false) {
|
|
1215
|
-
const [open, setOpen] = (0,
|
|
1216
|
-
const onOpen = (0,
|
|
1217
|
-
const onClose = (0,
|
|
1218
|
-
const onToggle = (0,
|
|
1390
|
+
const [open, setOpen] = (0, import_react8.useState)(initial);
|
|
1391
|
+
const onOpen = (0, import_react8.useCallback)(() => setOpen(true), []);
|
|
1392
|
+
const onClose = (0, import_react8.useCallback)(() => setOpen(false), []);
|
|
1393
|
+
const onToggle = (0, import_react8.useCallback)(() => setOpen((v) => !v), []);
|
|
1219
1394
|
return { open, onOpen, onClose, onToggle, setOpen };
|
|
1220
1395
|
}
|
|
1221
1396
|
|
|
1222
1397
|
// src/hooks/use-toast.ts
|
|
1223
1398
|
var import_sonner2 = require("sonner");
|
|
1224
|
-
var
|
|
1399
|
+
var import_react9 = require("react");
|
|
1225
1400
|
function useCustomToast() {
|
|
1226
|
-
const showToast = (0,
|
|
1401
|
+
const showToast = (0, import_react9.useCallback)(
|
|
1227
1402
|
(title, description, status = "success") => {
|
|
1228
1403
|
switch (status) {
|
|
1229
1404
|
case "success":
|
|
@@ -1278,6 +1453,7 @@ function useCustomToast() {
|
|
|
1278
1453
|
toast,
|
|
1279
1454
|
useCustomToast,
|
|
1280
1455
|
useDisclosure,
|
|
1456
|
+
useIsDesktop,
|
|
1281
1457
|
useTheme
|
|
1282
1458
|
});
|
|
1283
1459
|
//# sourceMappingURL=index.cjs.map
|