@motor-hero/ui-kit 0.17.0 → 0.19.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/index.js CHANGED
@@ -1,5 +1,26 @@
1
1
  // src/components/theme-provider.tsx
2
2
  import { createContext, useContext, useEffect, useState } from "react";
3
+
4
+ // src/lib/tenant-theme.ts
5
+ var VAR_MAP = {
6
+ primary: "--color-primary",
7
+ primaryForeground: "--color-primary-foreground",
8
+ secondary: "--color-secondary",
9
+ secondaryForeground: "--color-secondary-foreground",
10
+ accent: "--color-accent",
11
+ accentForeground: "--color-accent-foreground",
12
+ ring: "--color-ring"
13
+ };
14
+ function applyTenantTheme(root, tenantTheme, mode) {
15
+ const tokens = tenantTheme ? mode === "dark" ? { ...tenantTheme.light, ...tenantTheme.dark } : tenantTheme.light : {};
16
+ for (const key of Object.keys(VAR_MAP)) {
17
+ const value = tokens[key];
18
+ if (value) root.style.setProperty(VAR_MAP[key], value);
19
+ else root.style.removeProperty(VAR_MAP[key]);
20
+ }
21
+ }
22
+
23
+ // src/components/theme-provider.tsx
3
24
  import { jsx } from "react/jsx-runtime";
4
25
  var initialState = {
5
26
  theme: "system",
@@ -10,6 +31,7 @@ function ThemeProvider({
10
31
  children,
11
32
  defaultTheme = "system",
12
33
  storageKey = "ui-theme",
34
+ tenantTheme,
13
35
  ...props
14
36
  }) {
15
37
  const [theme, setTheme] = useState(
@@ -17,14 +39,20 @@ function ThemeProvider({
17
39
  );
18
40
  useEffect(() => {
19
41
  const root = window.document.documentElement;
20
- root.classList.remove("light", "dark");
42
+ const applyResolved = (resolved) => {
43
+ root.classList.remove("light", "dark");
44
+ root.classList.add(resolved);
45
+ applyTenantTheme(root, tenantTheme, resolved);
46
+ };
21
47
  if (theme === "system") {
22
- const systemTheme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
23
- root.classList.add(systemTheme);
24
- return;
48
+ const mql = window.matchMedia("(prefers-color-scheme: dark)");
49
+ applyResolved(mql.matches ? "dark" : "light");
50
+ const onChange = (e) => applyResolved(e.matches ? "dark" : "light");
51
+ mql.addEventListener("change", onChange);
52
+ return () => mql.removeEventListener("change", onChange);
25
53
  }
26
- root.classList.add(theme);
27
- }, [theme]);
54
+ applyResolved(theme);
55
+ }, [theme, tenantTheme]);
28
56
  const value = {
29
57
  theme,
30
58
  setTheme: (theme2) => {
@@ -546,9 +574,11 @@ PasswordInput.displayName = "PasswordInput";
546
574
  import * as PopoverPrimitive from "@radix-ui/react-popover";
547
575
  import { Command as CommandPrimitive } from "cmdk";
548
576
  import { Check, ChevronsUpDown, Search } from "lucide-react";
549
- import * as React4 from "react";
577
+ import * as React5 from "react";
550
578
  import { Drawer as DrawerPrimitive } from "vaul";
551
- import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
579
+
580
+ // src/hooks/use-is-desktop.ts
581
+ import * as React4 from "react";
552
582
  var DESKTOP_QUERY = "(min-width: 640px)";
553
583
  function useIsDesktop() {
554
584
  const [isDesktop, setIsDesktop] = React4.useState(
@@ -563,6 +593,9 @@ function useIsDesktop() {
563
593
  }, []);
564
594
  return isDesktop;
565
595
  }
596
+
597
+ // src/components/combobox.tsx
598
+ import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
566
599
  function Combobox({
567
600
  options,
568
601
  value,
@@ -576,7 +609,7 @@ function Combobox({
576
609
  "aria-invalid": ariaInvalid,
577
610
  "aria-describedby": ariaDescribedby
578
611
  }) {
579
- const [open, setOpen] = React4.useState(false);
612
+ const [open, setOpen] = React5.useState(false);
580
613
  const isDesktop = useIsDesktop();
581
614
  const selected = options.find((option) => option.value === value);
582
615
  const trigger = /* @__PURE__ */ jsxs14(
@@ -855,7 +888,7 @@ function Toaster(props) {
855
888
 
856
889
  // src/components/app-shell.tsx
857
890
  import { ChevronLeft, ChevronRight, Menu } from "lucide-react";
858
- import { useState as useState4 } from "react";
891
+ import { useState as useState6 } from "react";
859
892
 
860
893
  // src/components/sidebar-nav.tsx
861
894
  import { Fragment as Fragment3 } from "react";
@@ -904,6 +937,8 @@ function SidebarNav({
904
937
  // src/components/user-menu.tsx
905
938
  import * as DropdownMenu2 from "@radix-ui/react-dropdown-menu";
906
939
  import { LogOut, User } from "lucide-react";
940
+ import { useState as useState5 } from "react";
941
+ import { Drawer as DrawerPrimitive2 } from "vaul";
907
942
  import { Fragment as Fragment5, jsx as jsx24, jsxs as jsxs20 } from "react/jsx-runtime";
908
943
  function initials(user) {
909
944
  const source = user?.name?.trim() || user?.email?.trim();
@@ -913,6 +948,7 @@ function initials(user) {
913
948
  return source.slice(0, 2).toUpperCase();
914
949
  }
915
950
  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";
951
+ 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";
916
952
  function UserMenu({
917
953
  user,
918
954
  items = [],
@@ -921,51 +957,151 @@ function UserMenu({
921
957
  renderLink = defaultRenderLink,
922
958
  align = "end"
923
959
  }) {
960
+ const isDesktop = useIsDesktop();
961
+ const [open, setOpen] = useState5(false);
924
962
  const label = initials(user);
925
- return /* @__PURE__ */ jsxs20(DropdownMenu2.Root, { children: [
926
- /* @__PURE__ */ jsx24(DropdownMenu2.Trigger, { asChild: true, children: /* @__PURE__ */ jsx24(
927
- "button",
928
- {
929
- type: "button",
930
- 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",
931
- "aria-label": "Menu do usu\xE1rio",
932
- "data-testid": "user-menu",
933
- 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" })
934
- }
935
- ) }),
936
- /* @__PURE__ */ jsx24(DropdownMenu2.Portal, { children: /* @__PURE__ */ jsxs20(
937
- DropdownMenu2.Content,
938
- {
939
- align,
940
- sideOffset: 6,
941
- 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",
942
- children: [
943
- (user?.name || user?.email) && /* @__PURE__ */ jsxs20(Fragment5, { children: [
944
- /* @__PURE__ */ jsxs20("div", { className: "px-2 py-1.5", children: [
945
- user.name && /* @__PURE__ */ jsx24("p", { className: "truncate text-sm font-medium", children: user.name }),
946
- user.email && /* @__PURE__ */ jsx24("p", { className: "truncate text-xs text-muted-foreground", children: user.email })
963
+ const trigger = /* @__PURE__ */ jsx24(
964
+ "button",
965
+ {
966
+ type: "button",
967
+ 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",
968
+ "aria-label": "Menu do usu\xE1rio",
969
+ "data-testid": "user-menu",
970
+ children: user?.avatarUrl ? /* @__PURE__ */ jsx24(
971
+ "img",
972
+ {
973
+ src: user.avatarUrl,
974
+ alt: user.name ?? user.email ?? "Avatar",
975
+ className: "h-full w-full object-cover"
976
+ }
977
+ ) : label ? /* @__PURE__ */ jsx24("span", { children: label }) : /* @__PURE__ */ jsx24(User, { className: "h-4 w-4" })
978
+ }
979
+ );
980
+ const userInfo = (user?.name || user?.email) && /* @__PURE__ */ jsxs20("div", { className: "px-2 py-1.5", children: [
981
+ user.name && /* @__PURE__ */ jsx24("p", { className: "truncate text-sm font-medium", children: user.name }),
982
+ user.email && /* @__PURE__ */ jsx24("p", { className: "truncate text-xs text-muted-foreground", children: user.email })
983
+ ] });
984
+ if (isDesktop) {
985
+ return /* @__PURE__ */ jsxs20(DropdownMenu2.Root, { open, onOpenChange: setOpen, children: [
986
+ /* @__PURE__ */ jsx24(DropdownMenu2.Trigger, { asChild: true, children: trigger }),
987
+ /* @__PURE__ */ jsx24(DropdownMenu2.Portal, { children: /* @__PURE__ */ jsxs20(
988
+ DropdownMenu2.Content,
989
+ {
990
+ align,
991
+ sideOffset: 6,
992
+ 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",
993
+ children: [
994
+ userInfo && /* @__PURE__ */ jsxs20(Fragment5, { children: [
995
+ userInfo,
996
+ /* @__PURE__ */ jsx24(DropdownMenu2.Separator, { className: "-mx-1 my-1 h-px bg-border" })
947
997
  ] }),
948
- /* @__PURE__ */ jsx24(DropdownMenu2.Separator, { className: "-mx-1 my-1 h-px bg-border" })
949
- ] }),
950
- items.map(
951
- (item) => item.href ? /* @__PURE__ */ jsx24(DropdownMenu2.Item, { asChild: true, children: renderLink({ href: item.href, className: itemClass, children: /* @__PURE__ */ jsxs20(Fragment5, { children: [
952
- item.icon,
953
- item.label
954
- ] }) }) }, item.label) : /* @__PURE__ */ jsxs20(DropdownMenu2.Item, { className: itemClass, onClick: item.onClick, children: [
955
- item.icon,
956
- item.label
957
- ] }, item.label)
958
- ),
959
- onLogout && /* @__PURE__ */ jsxs20(Fragment5, { children: [
960
- items.length > 0 && /* @__PURE__ */ jsx24(DropdownMenu2.Separator, { className: "-mx-1 my-1 h-px bg-border" }),
961
- /* @__PURE__ */ jsxs20(DropdownMenu2.Item, { className: cn(itemClass, "text-destructive focus:bg-destructive/10"), onClick: onLogout, children: [
962
- /* @__PURE__ */ jsx24(LogOut, { className: "h-4 w-4" }),
963
- logoutLabel
998
+ items.map(
999
+ (item) => item.href ? /* @__PURE__ */ jsx24(DropdownMenu2.Item, { asChild: true, children: renderLink({
1000
+ href: item.href,
1001
+ className: itemClass,
1002
+ children: /* @__PURE__ */ jsxs20(Fragment5, { children: [
1003
+ item.icon,
1004
+ item.label
1005
+ ] })
1006
+ }) }, item.label) : /* @__PURE__ */ jsxs20(
1007
+ DropdownMenu2.Item,
1008
+ {
1009
+ className: itemClass,
1010
+ onClick: item.onClick,
1011
+ children: [
1012
+ item.icon,
1013
+ item.label
1014
+ ]
1015
+ },
1016
+ item.label
1017
+ )
1018
+ ),
1019
+ onLogout && /* @__PURE__ */ jsxs20(Fragment5, { children: [
1020
+ items.length > 0 && /* @__PURE__ */ jsx24(DropdownMenu2.Separator, { className: "-mx-1 my-1 h-px bg-border" }),
1021
+ /* @__PURE__ */ jsxs20(
1022
+ DropdownMenu2.Item,
1023
+ {
1024
+ className: cn(
1025
+ itemClass,
1026
+ "text-destructive focus:bg-destructive/10"
1027
+ ),
1028
+ onClick: onLogout,
1029
+ children: [
1030
+ /* @__PURE__ */ jsx24(LogOut, { className: "h-4 w-4" }),
1031
+ logoutLabel
1032
+ ]
1033
+ }
1034
+ )
964
1035
  ] })
965
- ] })
966
- ]
967
- }
968
- ) })
1036
+ ]
1037
+ }
1038
+ ) })
1039
+ ] });
1040
+ }
1041
+ return /* @__PURE__ */ jsxs20(DrawerPrimitive2.Root, { open, onOpenChange: setOpen, children: [
1042
+ /* @__PURE__ */ jsx24(DrawerPrimitive2.Trigger, { asChild: true, children: trigger }),
1043
+ /* @__PURE__ */ jsxs20(DrawerPrimitive2.Portal, { children: [
1044
+ /* @__PURE__ */ jsx24(DrawerPrimitive2.Overlay, { className: "fixed inset-0 z-50 bg-black/80" }),
1045
+ /* @__PURE__ */ jsxs20(DrawerPrimitive2.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: [
1046
+ /* @__PURE__ */ jsx24(DrawerPrimitive2.Title, { className: "sr-only", children: "Menu do usu\xE1rio" }),
1047
+ /* @__PURE__ */ jsx24("div", { className: "mx-auto my-3 h-1.5 w-12 shrink-0 rounded-full bg-muted" }),
1048
+ userInfo && /* @__PURE__ */ jsxs20(Fragment5, { children: [
1049
+ userInfo,
1050
+ /* @__PURE__ */ jsx24("div", { className: "-mx-1 my-1 h-px bg-border" })
1051
+ ] }),
1052
+ items.map(
1053
+ (item) => item.href ? /* @__PURE__ */ jsx24(
1054
+ "span",
1055
+ {
1056
+ onClick: () => setOpen(false),
1057
+ onKeyDown: () => setOpen(false),
1058
+ children: renderLink({
1059
+ href: item.href,
1060
+ className: sheetItemClass,
1061
+ children: /* @__PURE__ */ jsxs20(Fragment5, { children: [
1062
+ item.icon,
1063
+ item.label
1064
+ ] })
1065
+ })
1066
+ },
1067
+ item.label
1068
+ ) : /* @__PURE__ */ jsxs20(
1069
+ "button",
1070
+ {
1071
+ type: "button",
1072
+ className: sheetItemClass,
1073
+ onClick: () => {
1074
+ item.onClick?.();
1075
+ setOpen(false);
1076
+ },
1077
+ children: [
1078
+ item.icon,
1079
+ item.label
1080
+ ]
1081
+ },
1082
+ item.label
1083
+ )
1084
+ ),
1085
+ onLogout && /* @__PURE__ */ jsxs20(Fragment5, { children: [
1086
+ items.length > 0 && /* @__PURE__ */ jsx24("div", { className: "-mx-1 my-1 h-px bg-border" }),
1087
+ /* @__PURE__ */ jsxs20(
1088
+ "button",
1089
+ {
1090
+ type: "button",
1091
+ className: cn(sheetItemClass, "text-destructive"),
1092
+ onClick: () => {
1093
+ onLogout();
1094
+ setOpen(false);
1095
+ },
1096
+ children: [
1097
+ /* @__PURE__ */ jsx24(LogOut, { className: "h-4 w-4" }),
1098
+ logoutLabel
1099
+ ]
1100
+ }
1101
+ )
1102
+ ] })
1103
+ ] })
1104
+ ] })
969
1105
  ] });
970
1106
  }
971
1107
 
@@ -987,8 +1123,8 @@ function AppShell({
987
1123
  defaultCollapsed = false,
988
1124
  children
989
1125
  }) {
990
- const [collapsed, setCollapsed] = useState4(defaultCollapsed);
991
- const [mobileOpen, setMobileOpen] = useState4(false);
1126
+ const [collapsed, setCollapsed] = useState6(defaultCollapsed);
1127
+ const [mobileOpen, setMobileOpen] = useState6(false);
992
1128
  const nav = (isCollapsed, onNavigate) => /* @__PURE__ */ jsx25(
993
1129
  SidebarNav,
994
1130
  {
@@ -1077,8 +1213,12 @@ function AppShell({
1077
1213
  // src/components/row-actions-menu.tsx
1078
1214
  import * as DropdownMenu3 from "@radix-ui/react-dropdown-menu";
1079
1215
  import { MoreVertical } from "lucide-react";
1216
+ import { useState as useState7 } from "react";
1217
+ import { Drawer as DrawerPrimitive3 } from "vaul";
1080
1218
  import { Fragment as Fragment6, jsx as jsx26, jsxs as jsxs22 } from "react/jsx-runtime";
1219
+ 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";
1081
1220
  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";
1221
+ 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";
1082
1222
  function RowActionsMenu({
1083
1223
  actions,
1084
1224
  disabled = false,
@@ -1086,49 +1226,111 @@ function RowActionsMenu({
1086
1226
  label = "A\xE7\xF5es",
1087
1227
  renderLink = defaultRenderLink
1088
1228
  }) {
1229
+ const isDesktop = useIsDesktop();
1230
+ const [open, setOpen] = useState7(false);
1089
1231
  if (actions.length === 0) return null;
1090
- return /* @__PURE__ */ jsxs22(DropdownMenu3.Root, { children: [
1091
- /* @__PURE__ */ jsx26(DropdownMenu3.Trigger, { asChild: true, children: /* @__PURE__ */ jsx26(
1092
- "button",
1093
- {
1094
- type: "button",
1095
- disabled,
1096
- "aria-label": label,
1097
- 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",
1098
- children: /* @__PURE__ */ jsx26(MoreVertical, { className: "h-4 w-4" })
1099
- }
1100
- ) }),
1101
- /* @__PURE__ */ jsx26(DropdownMenu3.Portal, { children: /* @__PURE__ */ jsx26(
1102
- DropdownMenu3.Content,
1103
- {
1104
- align,
1105
- sideOffset: 6,
1106
- 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",
1107
- children: actions.map((action) => {
1108
- const cls = cn(itemClass2, action.destructive && "text-destructive focus:bg-destructive/10");
1109
- return action.href ? /* @__PURE__ */ jsx26(DropdownMenu3.Item, { asChild: true, disabled: action.disabled, children: renderLink({
1110
- href: action.href,
1111
- className: cls,
1112
- children: /* @__PURE__ */ jsxs22(Fragment6, { children: [
1113
- action.icon,
1232
+ const trigger = /* @__PURE__ */ jsx26(
1233
+ "button",
1234
+ {
1235
+ type: "button",
1236
+ disabled,
1237
+ "aria-label": label,
1238
+ className: triggerClass,
1239
+ children: /* @__PURE__ */ jsx26(MoreVertical, { className: "h-4 w-4" })
1240
+ }
1241
+ );
1242
+ if (isDesktop) {
1243
+ return /* @__PURE__ */ jsxs22(DropdownMenu3.Root, { open, onOpenChange: setOpen, children: [
1244
+ /* @__PURE__ */ jsx26(DropdownMenu3.Trigger, { asChild: true, children: trigger }),
1245
+ /* @__PURE__ */ jsx26(DropdownMenu3.Portal, { children: /* @__PURE__ */ jsx26(
1246
+ DropdownMenu3.Content,
1247
+ {
1248
+ align,
1249
+ sideOffset: 6,
1250
+ 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",
1251
+ children: actions.map((action) => {
1252
+ const cls = cn(
1253
+ itemClass2,
1254
+ action.destructive && "text-destructive focus:bg-destructive/10"
1255
+ );
1256
+ return action.href ? /* @__PURE__ */ jsx26(
1257
+ DropdownMenu3.Item,
1258
+ {
1259
+ asChild: true,
1260
+ disabled: action.disabled,
1261
+ children: renderLink({
1262
+ href: action.href,
1263
+ className: cls,
1264
+ children: /* @__PURE__ */ jsxs22(Fragment6, { children: [
1265
+ action.icon,
1266
+ action.label
1267
+ ] })
1268
+ })
1269
+ },
1114
1270
  action.label
1115
- ] })
1116
- }) }, action.label) : /* @__PURE__ */ jsxs22(
1117
- DropdownMenu3.Item,
1271
+ ) : /* @__PURE__ */ jsxs22(
1272
+ DropdownMenu3.Item,
1273
+ {
1274
+ className: cls,
1275
+ disabled: action.disabled,
1276
+ onClick: action.onClick,
1277
+ children: [
1278
+ action.icon,
1279
+ action.label
1280
+ ]
1281
+ },
1282
+ action.label
1283
+ );
1284
+ })
1285
+ }
1286
+ ) })
1287
+ ] });
1288
+ }
1289
+ return /* @__PURE__ */ jsxs22(DrawerPrimitive3.Root, { open, onOpenChange: setOpen, children: [
1290
+ /* @__PURE__ */ jsx26(DrawerPrimitive3.Trigger, { asChild: true, children: trigger }),
1291
+ /* @__PURE__ */ jsxs22(DrawerPrimitive3.Portal, { children: [
1292
+ /* @__PURE__ */ jsx26(DrawerPrimitive3.Overlay, { className: "fixed inset-0 z-50 bg-black/80" }),
1293
+ /* @__PURE__ */ jsxs22(DrawerPrimitive3.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: [
1294
+ /* @__PURE__ */ jsx26(DrawerPrimitive3.Title, { className: "sr-only", children: label }),
1295
+ /* @__PURE__ */ jsx26("div", { className: "mx-auto my-3 h-1.5 w-12 shrink-0 rounded-full bg-muted" }),
1296
+ actions.map((action) => {
1297
+ const cls = cn(
1298
+ sheetItemClass2,
1299
+ action.destructive && "text-destructive"
1300
+ );
1301
+ const inner = /* @__PURE__ */ jsxs22(Fragment6, { children: [
1302
+ action.icon,
1303
+ action.label
1304
+ ] });
1305
+ return action.href ? /* @__PURE__ */ jsx26(
1306
+ "span",
1118
1307
  {
1119
- className: cls,
1308
+ onClick: () => setOpen(false),
1309
+ onKeyDown: () => setOpen(false),
1310
+ children: renderLink({
1311
+ href: action.href,
1312
+ className: cls,
1313
+ children: inner
1314
+ })
1315
+ },
1316
+ action.label
1317
+ ) : /* @__PURE__ */ jsx26(
1318
+ "button",
1319
+ {
1320
+ type: "button",
1120
1321
  disabled: action.disabled,
1121
- onClick: action.onClick,
1122
- children: [
1123
- action.icon,
1124
- action.label
1125
- ]
1322
+ className: cls,
1323
+ onClick: () => {
1324
+ action.onClick?.();
1325
+ setOpen(false);
1326
+ },
1327
+ children: inner
1126
1328
  },
1127
1329
  action.label
1128
1330
  );
1129
1331
  })
1130
- }
1131
- ) })
1332
+ ] })
1333
+ ] })
1132
1334
  ] });
1133
1335
  }
1134
1336
 
@@ -1142,9 +1344,9 @@ function extractApiError(err, fallbackMessage = "Ocorreu um erro inesperado.") {
1142
1344
  }
1143
1345
 
1144
1346
  // src/hooks/use-disclosure.ts
1145
- import { useCallback, useState as useState5 } from "react";
1347
+ import { useCallback, useState as useState8 } from "react";
1146
1348
  function useDisclosure(initial = false) {
1147
- const [open, setOpen] = useState5(initial);
1349
+ const [open, setOpen] = useState8(initial);
1148
1350
  const onOpen = useCallback(() => setOpen(true), []);
1149
1351
  const onClose = useCallback(() => setOpen(false), []);
1150
1352
  const onToggle = useCallback(() => setOpen((v) => !v), []);
@@ -1203,12 +1405,14 @@ export {
1203
1405
  ThemeProvider,
1204
1406
  Toaster,
1205
1407
  UserMenu,
1408
+ applyTenantTheme,
1206
1409
  cn,
1207
1410
  defaultRenderLink,
1208
1411
  extractApiError,
1209
1412
  toast,
1210
1413
  useCustomToast,
1211
1414
  useDisclosure,
1415
+ useIsDesktop,
1212
1416
  useTheme
1213
1417
  };
1214
1418
  //# sourceMappingURL=index.js.map