@etus/ui 0.4.0-beta.14 → 0.4.0-beta.16
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/{chunk-QUENPT24.js → chunk-2NY6DDLO.js} +5 -5
- package/dist/{chunk-QUENPT24.js.map → chunk-2NY6DDLO.js.map} +1 -1
- package/dist/chunk-345S7BBL.js +3 -0
- package/dist/{chunk-IXJHHR3Y.js.map → chunk-345S7BBL.js.map} +1 -1
- package/dist/{chunk-7GCTZEMK.js → chunk-5U5XAOES.js} +68 -47
- package/dist/chunk-5U5XAOES.js.map +1 -0
- package/dist/chunk-COZXTBIU.js +176 -0
- package/dist/chunk-COZXTBIU.js.map +1 -0
- package/dist/{chunk-4KOJTZVU.js → chunk-FCIF6H6E.js} +3 -3
- package/dist/{chunk-4KOJTZVU.js.map → chunk-FCIF6H6E.js.map} +1 -1
- package/dist/{chunk-37IIHQP4.js → chunk-IMUBWKZC.js} +52 -4
- package/dist/chunk-IMUBWKZC.js.map +1 -0
- package/dist/chunk-KDJCZXLB.js +91 -0
- package/dist/chunk-KDJCZXLB.js.map +1 -0
- package/dist/chunk-TP4PDKFE.js +3 -0
- package/dist/{chunk-KRHL3YH2.js.map → chunk-TP4PDKFE.js.map} +1 -1
- package/dist/{chunk-FDES5YDF.js → chunk-WMG2MMJF.js} +3 -3
- package/dist/chunk-WMG2MMJF.js.map +1 -0
- package/dist/{chunk-2Z722V5K.js → chunk-ZPAWUKJI.js} +40 -5
- package/dist/chunk-ZPAWUKJI.js.map +1 -0
- package/dist/components/advanced/ReportBuilder/index.js +2 -2
- package/dist/components/advanced/index.js +9 -9
- package/dist/components/data-display/BarChart/index.js +1 -1
- package/dist/components/data-display/BarList/index.js +1 -1
- package/dist/components/data-display/EmptyState/index.js +1 -1
- package/dist/components/data-display/LineChart/index.js +1 -1
- package/dist/components/data-display/index.js +14 -14
- package/dist/components/feedback/index.js +4 -4
- package/dist/components/forms/index.js +10 -11
- package/dist/components/index.js +97 -97
- package/dist/components/layout/index.js +3 -3
- package/dist/components/navigation/AccountSwitch/index.js +1 -1
- package/dist/components/navigation/Sidebar/index.js +1 -1
- package/dist/components/navigation/index.js +8 -8
- package/dist/components/primitives/ArrowAnimated/index.js +2 -89
- package/dist/components/primitives/ArrowAnimated/index.js.map +1 -1
- package/dist/components/primitives/index.js +11 -10
- package/dist/components/workflow/index.js +5 -5
- package/dist/index.d.ts +902 -867
- package/dist/index.js +97 -97
- package/dist/styles.css +63 -50
- package/package.json +12 -13
- package/dist/chunk-2Z722V5K.js.map +0 -1
- package/dist/chunk-37IIHQP4.js.map +0 -1
- package/dist/chunk-7GCTZEMK.js.map +0 -1
- package/dist/chunk-FDES5YDF.js.map +0 -1
- package/dist/chunk-IXJHHR3Y.js +0 -3
- package/dist/chunk-KRHL3YH2.js +0 -3
- package/dist/chunk-QYWCXM7F.js +0 -96
- package/dist/chunk-QYWCXM7F.js.map +0 -1
- package/dist/chunk-SXJMERQL.js +0 -40
- package/dist/chunk-SXJMERQL.js.map +0 -1
- package/dist/components/data-display/DashboardFilterbar/index.js +0 -111
- package/dist/components/data-display/DashboardFilterbar/index.js.map +0 -1
- package/dist/components/forms/ToggleGroup/index.js +0 -6
- package/dist/components/forms/ToggleGroup/index.js.map +0 -1
- package/dist/components/navigation/MobileSidebar/index.js +0 -190
- package/dist/components/navigation/MobileSidebar/index.js.map +0 -1
- package/dist/components/navigation/UserProfileDropdown/index.js +0 -224
- package/dist/components/navigation/UserProfileDropdown/index.js.map +0 -1
- package/dist/components/navigation/WorkspaceDropdown/index.js +0 -192
- package/dist/components/navigation/WorkspaceDropdown/index.js.map +0 -1
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
import { Drawer, DrawerTrigger, DrawerContent, DrawerHeader, DrawerTitle, DrawerDescription, DrawerClose } from '../../../chunk-HI3T55XK.js';
|
|
2
|
-
import { Button } from '../../../chunk-7TF5PVEU.js';
|
|
3
|
-
import '../../../chunk-TAZPML2P.js';
|
|
4
|
-
import '../../../chunk-4GVOOXYD.js';
|
|
5
|
-
import '../../../chunk-7ZJ32KRQ.js';
|
|
6
|
-
import '../../../chunk-3L5G7VI2.js';
|
|
7
|
-
import { cn } from '../../../chunk-HRNDJU7D.js';
|
|
8
|
-
import '../../../chunk-UP2VWCW5.js';
|
|
9
|
-
import { MenuIcon } from 'lucide-react';
|
|
10
|
-
import { cva } from 'class-variance-authority';
|
|
11
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
12
|
-
|
|
13
|
-
var mobileSidebarVariants = cva(
|
|
14
|
-
// Base styles
|
|
15
|
-
[],
|
|
16
|
-
{
|
|
17
|
-
variants: {
|
|
18
|
-
variant: {
|
|
19
|
-
default: ""
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
defaultVariants: {
|
|
23
|
-
variant: "default"
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
);
|
|
27
|
-
var mobileSidebarTriggerVariants = cva([
|
|
28
|
-
"flex items-center rounded-md p-2",
|
|
29
|
-
"text-foreground",
|
|
30
|
-
"hover:bg-accent hover:text-accent-foreground",
|
|
31
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
32
|
-
"transition-colors",
|
|
33
|
-
"data-[state=open]:bg-accent"
|
|
34
|
-
]);
|
|
35
|
-
var mobileSidebarNavListVariants = cva([
|
|
36
|
-
"space-y-1.5"
|
|
37
|
-
]);
|
|
38
|
-
var mobileSidebarNavItemVariants = cva(
|
|
39
|
-
[
|
|
40
|
-
"flex items-center gap-x-2.5 rounded-md px-2 py-1.5",
|
|
41
|
-
"text-base font-medium sm:text-sm",
|
|
42
|
-
"transition-colors",
|
|
43
|
-
"hover:bg-accent",
|
|
44
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
|
45
|
-
],
|
|
46
|
-
{
|
|
47
|
-
variants: {
|
|
48
|
-
active: {
|
|
49
|
-
true: "text-primary",
|
|
50
|
-
false: "text-muted-foreground hover:text-foreground"
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
defaultVariants: {
|
|
54
|
-
active: false
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
);
|
|
58
|
-
var mobileSidebarShortcutsSectionVariants = cva([
|
|
59
|
-
"mt-8"
|
|
60
|
-
]);
|
|
61
|
-
var mobileSidebarShortcutsLabelVariants = cva([
|
|
62
|
-
"text-sm font-medium leading-6 text-muted-foreground sm:text-xs"
|
|
63
|
-
]);
|
|
64
|
-
var mobileSidebarShortcutsListVariants = cva([
|
|
65
|
-
"mt-2 space-y-0.5"
|
|
66
|
-
]);
|
|
67
|
-
var mobileSidebarShortcutItemVariants = cva([
|
|
68
|
-
"flex items-center gap-x-2.5 rounded-md px-2 py-1.5",
|
|
69
|
-
"font-medium sm:text-sm",
|
|
70
|
-
"text-muted-foreground hover:text-foreground",
|
|
71
|
-
"transition-colors",
|
|
72
|
-
"hover:bg-accent",
|
|
73
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
|
74
|
-
]);
|
|
75
|
-
var fallbackTitle = "Navigation menu";
|
|
76
|
-
var fallbackDescription = "Use os links deste painel para navegar.";
|
|
77
|
-
function MobileSidebar({
|
|
78
|
-
title,
|
|
79
|
-
navItems = [],
|
|
80
|
-
shortcuts = [],
|
|
81
|
-
shortcutsLabel = "Shortcuts",
|
|
82
|
-
trigger,
|
|
83
|
-
onNavItemClick,
|
|
84
|
-
onShortcutClick,
|
|
85
|
-
isActivePath,
|
|
86
|
-
variant,
|
|
87
|
-
className,
|
|
88
|
-
children,
|
|
89
|
-
...props
|
|
90
|
-
}) {
|
|
91
|
-
const defaultTrigger = /* @__PURE__ */ jsx(
|
|
92
|
-
Button,
|
|
93
|
-
{
|
|
94
|
-
"aria-label": "Open sidebar",
|
|
95
|
-
className: cn(mobileSidebarTriggerVariants()),
|
|
96
|
-
variant: "ghost",
|
|
97
|
-
children: /* @__PURE__ */ jsx(MenuIcon, { "aria-hidden": "true", className: "size-6 shrink-0 sm:size-5" })
|
|
98
|
-
}
|
|
99
|
-
);
|
|
100
|
-
return /* @__PURE__ */ jsx(
|
|
101
|
-
"div",
|
|
102
|
-
{
|
|
103
|
-
className: cn(mobileSidebarVariants({ variant }), className),
|
|
104
|
-
"data-slot": "mobile-sidebar",
|
|
105
|
-
...props,
|
|
106
|
-
children: /* @__PURE__ */ jsxs(Drawer, { children: [
|
|
107
|
-
/* @__PURE__ */ jsx(DrawerTrigger, { asChild: true, children: trigger ?? defaultTrigger }),
|
|
108
|
-
/* @__PURE__ */ jsxs(DrawerContent, { className: "sm:max-w-lg", "data-slot": "mobile-sidebar-content", children: [
|
|
109
|
-
title && /* @__PURE__ */ jsxs(DrawerHeader, { children: [
|
|
110
|
-
/* @__PURE__ */ jsx(DrawerTitle, { children: title }),
|
|
111
|
-
/* @__PURE__ */ jsx(DrawerDescription, { className: "sr-only", children: fallbackDescription })
|
|
112
|
-
] }),
|
|
113
|
-
!title && /* @__PURE__ */ jsxs(DrawerHeader, { children: [
|
|
114
|
-
/* @__PURE__ */ jsx(DrawerTitle, { className: "sr-only", children: fallbackTitle }),
|
|
115
|
-
/* @__PURE__ */ jsx(DrawerDescription, { className: "sr-only", children: fallbackDescription })
|
|
116
|
-
] }),
|
|
117
|
-
/* @__PURE__ */ jsxs(
|
|
118
|
-
"nav",
|
|
119
|
-
{
|
|
120
|
-
"aria-label": "Mobile navigation",
|
|
121
|
-
className: "flex flex-1 flex-col space-y-10 px-4 pb-4",
|
|
122
|
-
children: [
|
|
123
|
-
navItems.length > 0 && /* @__PURE__ */ jsx("ul", { className: cn(mobileSidebarNavListVariants()), role: "list", children: navItems.map((item) => {
|
|
124
|
-
const isActive = item.active ?? isActivePath?.(item.href) ?? false;
|
|
125
|
-
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(DrawerClose, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
126
|
-
"a",
|
|
127
|
-
{
|
|
128
|
-
className: cn(
|
|
129
|
-
mobileSidebarNavItemVariants({ active: isActive })
|
|
130
|
-
),
|
|
131
|
-
href: item.href,
|
|
132
|
-
onClick: () => onNavItemClick?.(item),
|
|
133
|
-
children: [
|
|
134
|
-
item.icon && /* @__PURE__ */ jsx(
|
|
135
|
-
"span",
|
|
136
|
-
{
|
|
137
|
-
"aria-hidden": "true",
|
|
138
|
-
className: "size-5 shrink-0",
|
|
139
|
-
children: item.icon
|
|
140
|
-
}
|
|
141
|
-
),
|
|
142
|
-
item.label
|
|
143
|
-
]
|
|
144
|
-
}
|
|
145
|
-
) }) }, item.id);
|
|
146
|
-
}) }),
|
|
147
|
-
shortcuts.length > 0 && /* @__PURE__ */ jsxs("div", { className: cn(mobileSidebarShortcutsSectionVariants()), children: [
|
|
148
|
-
/* @__PURE__ */ jsx("span", { className: cn(mobileSidebarShortcutsLabelVariants()), children: shortcutsLabel }),
|
|
149
|
-
/* @__PURE__ */ jsx(
|
|
150
|
-
"ul",
|
|
151
|
-
{
|
|
152
|
-
"aria-label": shortcutsLabel,
|
|
153
|
-
className: cn(mobileSidebarShortcutsListVariants()),
|
|
154
|
-
role: "list",
|
|
155
|
-
children: shortcuts.map((shortcut) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(DrawerClose, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
156
|
-
"a",
|
|
157
|
-
{
|
|
158
|
-
className: cn(mobileSidebarShortcutItemVariants()),
|
|
159
|
-
href: shortcut.href,
|
|
160
|
-
onClick: () => onShortcutClick?.(shortcut),
|
|
161
|
-
children: [
|
|
162
|
-
shortcut.icon && /* @__PURE__ */ jsx(
|
|
163
|
-
"span",
|
|
164
|
-
{
|
|
165
|
-
"aria-hidden": "true",
|
|
166
|
-
className: "size-4 shrink-0",
|
|
167
|
-
children: shortcut.icon
|
|
168
|
-
}
|
|
169
|
-
),
|
|
170
|
-
shortcut.label
|
|
171
|
-
]
|
|
172
|
-
}
|
|
173
|
-
) }) }, shortcut.id))
|
|
174
|
-
}
|
|
175
|
-
)
|
|
176
|
-
] }),
|
|
177
|
-
children
|
|
178
|
-
]
|
|
179
|
-
}
|
|
180
|
-
)
|
|
181
|
-
] })
|
|
182
|
-
] })
|
|
183
|
-
}
|
|
184
|
-
);
|
|
185
|
-
}
|
|
186
|
-
MobileSidebar.displayName = "MobileSidebar";
|
|
187
|
-
|
|
188
|
-
export { MobileSidebar, mobileSidebarNavItemVariants, mobileSidebarNavListVariants, mobileSidebarShortcutItemVariants, mobileSidebarShortcutsLabelVariants, mobileSidebarShortcutsListVariants, mobileSidebarShortcutsSectionVariants, mobileSidebarTriggerVariants, mobileSidebarVariants };
|
|
189
|
-
//# sourceMappingURL=index.js.map
|
|
190
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/navigation/MobileSidebar/MobileSidebar.variants.ts","../../../../src/components/navigation/MobileSidebar/MobileSidebar.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAMO,IAAM,qBAAA,GAAwB,GAAA;AAAA;AAAA,EAEnC,EAAC;AAAA,EACD;AAAA,IACE,QAAA,EAAU;AAAA,MACR,OAAA,EAAS;AAAA,QACP,OAAA,EAAS;AAAA;AACX,KACF;AAAA,IACA,eAAA,EAAiB;AAAA,MACf,OAAA,EAAS;AAAA;AACX;AAEJ;AAEO,IAAM,+BAA+B,GAAA,CAAI;AAAA,EAC9C,kCAAA;AAAA,EACA,iBAAA;AAAA,EACA,8CAAA;AAAA,EACA,yEAAA;AAAA,EACA,mBAAA;AAAA,EACA;AACF,CAAC;AAEM,IAAM,+BAA+B,GAAA,CAAI;AAAA,EAC9C;AACF,CAAC;AAEM,IAAM,4BAAA,GAA+B,GAAA;AAAA,EAC1C;AAAA,IACE,oDAAA;AAAA,IACA,kCAAA;AAAA,IACA,mBAAA;AAAA,IACA,iBAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AA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,QAAA,kBAAA,GAAA,CAAC,WAAA,EAAA,EAAY,OAAA,EAAO,IAAA,EAClB,QAAA,kBAAA,IAAA;AAAA,wBAAC,GAAA;AAAA,wBAAA;AAAA,0BACC,SAAA,EAAW,EAAA,CAAG,iCAAA,EAAmC,CAAA;AAAA,0BACjD,MAAM,QAAA,CAAS,IAAA;AAAA,0BACf,OAAA,EAAS,MAAM,eAAA,GAAkB,QAAQ,CAAA;AAAA,0BAExC,QAAA,EAAA;AAAA,4BAAA,QAAA,CAAS,IAAA,oBACR,GAAA;AAAA,8BAAC,MAAA;AAAA,8BAAA;AAAA,gCACC,aAAA,EAAY,MAAA;AAAA,gCACZ,SAAA,EAAU,iBAAA;AAAA,gCAET,QAAA,EAAA,QAAA,CAAS;AAAA;AAAA,6BACZ;AAAA,4BAED,QAAA,CAAS;AAAA;AAAA;AAAA,uBACZ,EACF,CAAA,EAAA,EAjBO,QAAA,CAAS,EAkBlB,CACD;AAAA;AAAA;AACH,iBAAA,EACF,CAAA;AAAA,gBAID;AAAA;AAAA;AAAA;AACH,SAAA,EACF;AAAA,OAAA,EACF;AAAA;AAAA,GACF;AAEJ;AAEA,aAAA,CAAc,WAAA,GAAc,eAAA","file":"index.js","sourcesContent":["// MobileSidebar/MobileSidebar.variants.ts\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\n/**\n * MobileSidebar style variants using CVA\n */\nexport const mobileSidebarVariants = cva(\n // Base styles\n [],\n {\n variants: {\n variant: {\n default: \"\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n }\n)\n\nexport const mobileSidebarTriggerVariants = cva([\n \"flex items-center rounded-md p-2\",\n \"text-foreground\",\n \"hover:bg-accent hover:text-accent-foreground\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n \"transition-colors\",\n \"data-[state=open]:bg-accent\",\n])\n\nexport const mobileSidebarNavListVariants = cva([\n \"space-y-1.5\",\n])\n\nexport const mobileSidebarNavItemVariants = cva(\n [\n \"flex items-center gap-x-2.5 rounded-md px-2 py-1.5\",\n \"text-base font-medium sm:text-sm\",\n \"transition-colors\",\n \"hover:bg-accent\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n ],\n {\n variants: {\n active: {\n true: \"text-primary\",\n false: \"text-muted-foreground hover:text-foreground\",\n },\n },\n defaultVariants: {\n active: false,\n },\n }\n)\n\nexport const mobileSidebarShortcutsSectionVariants = cva([\n \"mt-8\",\n])\n\nexport const mobileSidebarShortcutsLabelVariants = cva([\n \"text-sm font-medium leading-6 text-muted-foreground sm:text-xs\",\n])\n\nexport const mobileSidebarShortcutsListVariants = cva([\n \"mt-2 space-y-0.5\",\n])\n\nexport const mobileSidebarShortcutItemVariants = cva([\n \"flex items-center gap-x-2.5 rounded-md px-2 py-1.5\",\n \"font-medium sm:text-sm\",\n \"text-muted-foreground hover:text-foreground\",\n \"transition-colors\",\n \"hover:bg-accent\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n])\n\nexport type MobileSidebarVariantProps = VariantProps<\n typeof mobileSidebarVariants\n>\n","// MobileSidebar/MobileSidebar.tsx\n\"use client\"\n\nimport type { MobileSidebarProps } from \"./MobileSidebar.types\"\n\nimport { MenuIcon } from \"lucide-react\"\n\nimport { cn } from \"../../../lib/utils\"\nimport { Button } from \"../../primitives/Button\"\nimport {\n Drawer,\n DrawerClose,\n DrawerContent,\n DrawerDescription,\n DrawerHeader,\n DrawerTitle,\n DrawerTrigger,\n} from \"../Drawer\"\nimport {\n mobileSidebarNavItemVariants,\n mobileSidebarNavListVariants,\n mobileSidebarShortcutItemVariants,\n mobileSidebarShortcutsLabelVariants,\n mobileSidebarShortcutsListVariants,\n mobileSidebarShortcutsSectionVariants,\n mobileSidebarTriggerVariants,\n mobileSidebarVariants,\n} from \"./MobileSidebar.variants\"\n\nconst fallbackTitle = \"Navigation menu\"\nconst fallbackDescription = \"Use os links deste painel para navegar.\"\n\n/**\n * MobileSidebar - Mobile-optimized navigation drawer\n *\n * A slide-out navigation panel for mobile devices, built on top of the Drawer component.\n * Supports main navigation items and a shortcuts section.\n *\n * @example\n * ```tsx\n * // Basic usage\n * <MobileSidebar\n * title=\"My App\"\n * navItems={[\n * { id: \"home\", label: \"Home\", href: \"/\", icon: <HomeIcon /> },\n * { id: \"settings\", label: \"Settings\", href: \"/settings\", icon: <SettingsIcon /> },\n * ]}\n * />\n *\n * // With shortcuts and active path detection\n * <MobileSidebar\n * title=\"Dashboard\"\n * navItems={navItems}\n * shortcuts={shortcuts}\n * shortcutsLabel=\"Quick Links\"\n * isActivePath={(href) => pathname === href}\n * />\n *\n * // With custom trigger\n * <MobileSidebar\n * title=\"Menu\"\n * navItems={navItems}\n * trigger={<Button variant=\"outline\">Open Menu</Button>}\n * />\n * ```\n */\nfunction MobileSidebar({\n title,\n navItems = [],\n shortcuts = [],\n shortcutsLabel = \"Shortcuts\",\n trigger,\n onNavItemClick,\n onShortcutClick,\n isActivePath,\n variant,\n className,\n children,\n ...props\n}: MobileSidebarProps) {\n // Default trigger button\n const defaultTrigger = (\n <Button\n aria-label=\"Open sidebar\"\n className={cn(mobileSidebarTriggerVariants())}\n variant=\"ghost\"\n >\n <MenuIcon aria-hidden=\"true\" className=\"size-6 shrink-0 sm:size-5\" />\n </Button>\n )\n\n return (\n <div\n className={cn(mobileSidebarVariants({ variant }), className)}\n data-slot=\"mobile-sidebar\"\n {...props}\n >\n <Drawer>\n <DrawerTrigger asChild>{trigger ?? defaultTrigger}</DrawerTrigger>\n <DrawerContent className=\"sm:max-w-lg\" data-slot=\"mobile-sidebar-content\">\n {title && (\n <DrawerHeader>\n <DrawerTitle>{title}</DrawerTitle>\n <DrawerDescription className=\"sr-only\">\n {fallbackDescription}\n </DrawerDescription>\n </DrawerHeader>\n )}\n {!title && (\n <DrawerHeader>\n <DrawerTitle className=\"sr-only\">{fallbackTitle}</DrawerTitle>\n <DrawerDescription className=\"sr-only\">\n {fallbackDescription}\n </DrawerDescription>\n </DrawerHeader>\n )}\n\n <nav\n aria-label=\"Mobile navigation\"\n className=\"flex flex-1 flex-col space-y-10 px-4 pb-4\"\n >\n {/* Main navigation */}\n {navItems.length > 0 && (\n <ul className={cn(mobileSidebarNavListVariants())} role=\"list\">\n {navItems.map((item) => {\n const isActive = item.active ?? isActivePath?.(item.href) ?? false\n\n return (\n <li key={item.id}>\n <DrawerClose asChild>\n <a\n className={cn(\n mobileSidebarNavItemVariants({ active: isActive })\n )}\n href={item.href}\n onClick={() => onNavItemClick?.(item)}\n >\n {item.icon && (\n <span\n aria-hidden=\"true\"\n className=\"size-5 shrink-0\"\n >\n {item.icon}\n </span>\n )}\n {item.label}\n </a>\n </DrawerClose>\n </li>\n )\n })}\n </ul>\n )}\n\n {/* Shortcuts section */}\n {shortcuts.length > 0 && (\n <div className={cn(mobileSidebarShortcutsSectionVariants())}>\n <span className={cn(mobileSidebarShortcutsLabelVariants())}>\n {shortcutsLabel}\n </span>\n <ul\n aria-label={shortcutsLabel}\n className={cn(mobileSidebarShortcutsListVariants())}\n role=\"list\"\n >\n {shortcuts.map((shortcut) => (\n <li key={shortcut.id}>\n <DrawerClose asChild>\n <a\n className={cn(mobileSidebarShortcutItemVariants())}\n href={shortcut.href}\n onClick={() => onShortcutClick?.(shortcut)}\n >\n {shortcut.icon && (\n <span\n aria-hidden=\"true\"\n className=\"size-4 shrink-0\"\n >\n {shortcut.icon}\n </span>\n )}\n {shortcut.label}\n </a>\n </DrawerClose>\n </li>\n ))}\n </ul>\n </div>\n )}\n\n {/* Additional custom content */}\n {children}\n </nav>\n </DrawerContent>\n </Drawer>\n </div>\n )\n}\n\nMobileSidebar.displayName = \"MobileSidebar\"\n\nexport { MobileSidebar }\n"]}
|
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuLabel, DropdownMenuGroup, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuItem } from '../../../chunk-OXDWUKGP.js';
|
|
2
|
-
import { cn } from '../../../chunk-HRNDJU7D.js';
|
|
3
|
-
import '../../../chunk-UP2VWCW5.js';
|
|
4
|
-
import { SunIcon, MoonIcon, ComputerIcon, ExternalLinkIcon, LogOutIcon } from 'lucide-react';
|
|
5
|
-
import { cva } from 'class-variance-authority';
|
|
6
|
-
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
7
|
-
|
|
8
|
-
var userProfileDropdownVariants = cva(
|
|
9
|
-
// Base styles
|
|
10
|
-
[],
|
|
11
|
-
{
|
|
12
|
-
variants: {
|
|
13
|
-
variant: {
|
|
14
|
-
default: "",
|
|
15
|
-
compact: ""
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
defaultVariants: {
|
|
19
|
-
variant: "default"
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
);
|
|
23
|
-
var userProfileTriggerVariants = cva(
|
|
24
|
-
// Base styles
|
|
25
|
-
[
|
|
26
|
-
"flex items-center gap-2 rounded-md p-2",
|
|
27
|
-
"text-sm font-medium",
|
|
28
|
-
"hover:bg-accent hover:text-accent-foreground",
|
|
29
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
30
|
-
"transition-colors"
|
|
31
|
-
],
|
|
32
|
-
{
|
|
33
|
-
variants: {
|
|
34
|
-
variant: {
|
|
35
|
-
default: "gap-3",
|
|
36
|
-
compact: "gap-2"
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
defaultVariants: {
|
|
40
|
-
variant: "default"
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
);
|
|
44
|
-
var userProfileAvatarVariants = cva([
|
|
45
|
-
"flex items-center justify-center",
|
|
46
|
-
"rounded-full bg-primary text-primary-foreground",
|
|
47
|
-
"text-xs font-medium",
|
|
48
|
-
"overflow-hidden"
|
|
49
|
-
], {
|
|
50
|
-
variants: {
|
|
51
|
-
size: {
|
|
52
|
-
sm: "size-7",
|
|
53
|
-
md: "size-8",
|
|
54
|
-
lg: "size-10"
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
defaultVariants: {
|
|
58
|
-
size: "md"
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
var userProfileInfoVariants = cva([
|
|
62
|
-
"flex flex-col items-start text-left"
|
|
63
|
-
]);
|
|
64
|
-
var userProfileNameVariants = cva([
|
|
65
|
-
"text-sm font-medium text-foreground truncate max-w-32"
|
|
66
|
-
]);
|
|
67
|
-
var userProfileEmailVariants = cva([
|
|
68
|
-
"text-xs text-muted-foreground truncate max-w-32"
|
|
69
|
-
]);
|
|
70
|
-
var themeOptions = [
|
|
71
|
-
{ value: "light", label: "Light", icon: SunIcon },
|
|
72
|
-
{ value: "dark", label: "Dark", icon: MoonIcon },
|
|
73
|
-
{ value: "system", label: "System", icon: ComputerIcon }
|
|
74
|
-
];
|
|
75
|
-
function getInitials(name, email) {
|
|
76
|
-
if (name) {
|
|
77
|
-
const parts = name.split(" ").filter(Boolean);
|
|
78
|
-
const first = parts[0];
|
|
79
|
-
const second = parts[1];
|
|
80
|
-
if (first && second && first.length > 0 && second.length > 0) {
|
|
81
|
-
return `${first[0] ?? ""}${second[0] ?? ""}`.toUpperCase();
|
|
82
|
-
}
|
|
83
|
-
return name.slice(0, 2).toUpperCase();
|
|
84
|
-
}
|
|
85
|
-
if (email) {
|
|
86
|
-
return email.slice(0, 2).toUpperCase();
|
|
87
|
-
}
|
|
88
|
-
return "??";
|
|
89
|
-
}
|
|
90
|
-
function UserProfileTrigger({
|
|
91
|
-
user,
|
|
92
|
-
className,
|
|
93
|
-
...props
|
|
94
|
-
}) {
|
|
95
|
-
const initials = user.initials ?? getInitials(user.name, user.email);
|
|
96
|
-
return /* @__PURE__ */ jsxs(
|
|
97
|
-
"button",
|
|
98
|
-
{
|
|
99
|
-
className: cn(userProfileTriggerVariants(), className),
|
|
100
|
-
"data-slot": "user-profile-trigger",
|
|
101
|
-
type: "button",
|
|
102
|
-
...props,
|
|
103
|
-
children: [
|
|
104
|
-
/* @__PURE__ */ jsx("span", { className: cn(userProfileAvatarVariants()), children: user.avatarUrl ? /* @__PURE__ */ jsx(
|
|
105
|
-
"img",
|
|
106
|
-
{
|
|
107
|
-
alt: user.name ?? user.email,
|
|
108
|
-
className: "size-full object-cover",
|
|
109
|
-
src: user.avatarUrl
|
|
110
|
-
}
|
|
111
|
-
) : initials }),
|
|
112
|
-
/* @__PURE__ */ jsxs("span", { className: cn(userProfileInfoVariants()), children: [
|
|
113
|
-
user.name && /* @__PURE__ */ jsx("span", { className: cn(userProfileNameVariants()), children: user.name }),
|
|
114
|
-
/* @__PURE__ */ jsx("span", { className: cn(userProfileEmailVariants()), children: user.email })
|
|
115
|
-
] })
|
|
116
|
-
]
|
|
117
|
-
}
|
|
118
|
-
);
|
|
119
|
-
}
|
|
120
|
-
function UserProfileDropdown({
|
|
121
|
-
user,
|
|
122
|
-
theme = "system",
|
|
123
|
-
onThemeChange,
|
|
124
|
-
showThemeSwitcher = false,
|
|
125
|
-
menuItems = [],
|
|
126
|
-
onSignOut,
|
|
127
|
-
signOutLabel = "Sign out",
|
|
128
|
-
align = "end",
|
|
129
|
-
side = "bottom",
|
|
130
|
-
variant,
|
|
131
|
-
className,
|
|
132
|
-
children,
|
|
133
|
-
...props
|
|
134
|
-
}) {
|
|
135
|
-
return /* @__PURE__ */ jsx(
|
|
136
|
-
"div",
|
|
137
|
-
{
|
|
138
|
-
className: cn(userProfileDropdownVariants({ variant }), className),
|
|
139
|
-
"data-slot": "user-profile-dropdown",
|
|
140
|
-
...props,
|
|
141
|
-
children: /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
142
|
-
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: children ?? /* @__PURE__ */ jsx(UserProfileTrigger, { user }) }),
|
|
143
|
-
/* @__PURE__ */ jsxs(DropdownMenuContent, { align, side, children: [
|
|
144
|
-
/* @__PURE__ */ jsx(DropdownMenuLabel, { children: user.email }),
|
|
145
|
-
showThemeSwitcher && /* @__PURE__ */ jsx(DropdownMenuGroup, { children: /* @__PURE__ */ jsxs(DropdownMenuSub, { children: [
|
|
146
|
-
/* @__PURE__ */ jsx(DropdownMenuSubTrigger, { children: "Theme" }),
|
|
147
|
-
/* @__PURE__ */ jsx(DropdownMenuSubContent, { children: /* @__PURE__ */ jsx(
|
|
148
|
-
DropdownMenuRadioGroup,
|
|
149
|
-
{
|
|
150
|
-
value: theme,
|
|
151
|
-
onValueChange: (value) => onThemeChange?.(value),
|
|
152
|
-
children: themeOptions.map((option) => /* @__PURE__ */ jsxs(
|
|
153
|
-
DropdownMenuRadioItem,
|
|
154
|
-
{
|
|
155
|
-
"aria-label": `Switch to ${option.label} mode`,
|
|
156
|
-
value: option.value,
|
|
157
|
-
children: [
|
|
158
|
-
/* @__PURE__ */ jsx(
|
|
159
|
-
option.icon,
|
|
160
|
-
{
|
|
161
|
-
"aria-hidden": "true",
|
|
162
|
-
className: "mr-2 size-4 shrink-0"
|
|
163
|
-
}
|
|
164
|
-
),
|
|
165
|
-
option.label
|
|
166
|
-
]
|
|
167
|
-
},
|
|
168
|
-
option.value
|
|
169
|
-
))
|
|
170
|
-
}
|
|
171
|
-
) })
|
|
172
|
-
] }) }),
|
|
173
|
-
menuItems.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
174
|
-
/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
175
|
-
/* @__PURE__ */ jsx(DropdownMenuGroup, { children: menuItems.map((item) => /* @__PURE__ */ jsx(
|
|
176
|
-
DropdownMenuItem,
|
|
177
|
-
{
|
|
178
|
-
asChild: !!item.href,
|
|
179
|
-
variant: item.variant,
|
|
180
|
-
onClick: item.onClick,
|
|
181
|
-
children: item.href ? /* @__PURE__ */ jsxs(
|
|
182
|
-
"a",
|
|
183
|
-
{
|
|
184
|
-
href: item.href,
|
|
185
|
-
rel: item.external ? "noopener noreferrer" : void 0,
|
|
186
|
-
target: item.external ? "_blank" : void 0,
|
|
187
|
-
children: [
|
|
188
|
-
item.icon && /* @__PURE__ */ jsx("span", { className: "mr-2 size-4", children: item.icon }),
|
|
189
|
-
item.label,
|
|
190
|
-
item.external && /* @__PURE__ */ jsx(
|
|
191
|
-
ExternalLinkIcon,
|
|
192
|
-
{
|
|
193
|
-
"aria-hidden": "true",
|
|
194
|
-
className: "mb-0.5 ml-1 size-3 text-muted-foreground"
|
|
195
|
-
}
|
|
196
|
-
)
|
|
197
|
-
]
|
|
198
|
-
}
|
|
199
|
-
) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
200
|
-
item.icon && /* @__PURE__ */ jsx("span", { className: "mr-2 size-4", children: item.icon }),
|
|
201
|
-
item.label
|
|
202
|
-
] })
|
|
203
|
-
},
|
|
204
|
-
item.id
|
|
205
|
-
)) })
|
|
206
|
-
] }),
|
|
207
|
-
onSignOut && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
208
|
-
/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
209
|
-
/* @__PURE__ */ jsx(DropdownMenuGroup, { children: /* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: onSignOut, children: [
|
|
210
|
-
/* @__PURE__ */ jsx(LogOutIcon, { "aria-hidden": "true", className: "mr-2 size-4" }),
|
|
211
|
-
signOutLabel
|
|
212
|
-
] }) })
|
|
213
|
-
] })
|
|
214
|
-
] })
|
|
215
|
-
] })
|
|
216
|
-
}
|
|
217
|
-
);
|
|
218
|
-
}
|
|
219
|
-
UserProfileDropdown.displayName = "UserProfileDropdown";
|
|
220
|
-
UserProfileTrigger.displayName = "UserProfileTrigger";
|
|
221
|
-
|
|
222
|
-
export { UserProfileDropdown, UserProfileTrigger, userProfileAvatarVariants, userProfileDropdownVariants, userProfileEmailVariants, userProfileInfoVariants, userProfileNameVariants, userProfileTriggerVariants };
|
|
223
|
-
//# sourceMappingURL=index.js.map
|
|
224
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/navigation/UserProfileDropdown/UserProfileDropdown.variants.ts","../../../../src/components/navigation/UserProfileDropdown/UserProfileDropdown.tsx"],"names":[],"mappings":";;;;;;;AAMO,IAAM,2BAAA,GAA8B,GAAA;AAAA;AAAA,EAEzC,EAAC;AAAA,EACD;AAAA,IACE,QAAA,EAAU;AAAA,MACR,OAAA,EAAS;AAAA,QACP,OAAA,EAAS,EAAA;AAAA,QACT,OAAA,EAAS;AAAA;AACX,KACF;AAAA,IACA,eAAA,EAAiB;AAAA,MACf,OAAA,EAAS;AAAA;AACX;AAEJ;AAEO,IAAM,0BAAA,GAA6B,GAAA;AAAA;AAAA,EAExC;AAAA,IACE,wCAAA;AAAA,IACA,qBAAA;AAAA,IACA,8CAAA;AAAA,IACA,yEAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,OAAA,EAAS;AAAA,QACP,OAAA,EAAS,OAAA;AAAA,QACT,OAAA,EAAS;AAAA;AACX,KACF;AAAA,IACA,eAAA,EAAiB;AAAA,MACf,OAAA,EAAS;AAAA;AACX;AAEJ;AAEO,IAAM,4BAA4B,GAAA,CAAI;AAAA,EAC3C,kCAAA;AAAA,EACA,iDAAA;AAAA,EACA,qBAAA;AAAA,EACA;AACF,CAAA,EAAG;AAAA,EACD,QAAA,EAAU;AAAA,IACR,IAAA,EAAM;AAAA,MACJ,EAAA,EAAI,QAAA;AAAA,MACJ,EAAA,EAAI,QAAA;AAAA,MACJ,EAAA,EAAI;AAAA;AACN,GACF;AAAA,EACA,eAAA,EAAiB;AAAA,IACf,IAAA,EAAM;AAAA;AAEV,CAAC;AAEM,IAAM,0BAA0B,GAAA,CAAI;AAAA,EACzC;AACF,CAAC;AAEM,IAAM,0BAA0B,GAAA,CAAI;AAAA,EACzC;AACF,CAAC;AAEM,IAAM,2BAA2B,GAAA,CAAI;AAAA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A,IAAA,CAAK,wBACJ,GAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,aAAA,EAAe,eAAK,IAAA,EAAK,CAAA;AAAA,kBAE1C,IAAA,CAAK;AAAA,iBAAA,EACR;AAAA,eAAA;AAAA,cA5BG,IAAA,CAAK;AAAA,aA+Bb,CAAA,EACH;AAAA,WAAA,EACF,CAAA;AAAA,UAID,6BACC,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,4BAAA,GAAA,CAAC,qBAAA,EAAA,EAAsB,CAAA;AAAA,4BACvB,GAAA,CAAC,iBAAA,EAAA,EACC,QAAA,kBAAA,IAAA,CAAC,gBAAA,EAAA,EAAiB,SAAS,SAAA,EACzB,QAAA,EAAA;AAAA,8BAAA,GAAA,CAAC,UAAA,EAAA,EAAW,aAAA,EAAY,MAAA,EAAO,SAAA,EAAU,aAAA,EAAc,CAAA;AAAA,cACtD;AAAA,aAAA,EACH,CAAA,EACF;AAAA,WAAA,EACF;AAAA,SAAA,EAEJ;AAAA,OAAA,EACF;AAAA;AAAA,GACF;AAEJ;AAEA,mBAAA,CAAoB,WAAA,GAAc,qBAAA;AAClC,kBAAA,CAAmB,WAAA,GAAc,oBAAA","file":"index.js","sourcesContent":["// UserProfileDropdown/UserProfileDropdown.variants.ts\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\n/**\n * UserProfileDropdown style variants using CVA\n */\nexport const userProfileDropdownVariants = cva(\n // Base styles\n [],\n {\n variants: {\n variant: {\n default: \"\",\n compact: \"\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n }\n)\n\nexport const userProfileTriggerVariants = cva(\n // Base styles\n [\n \"flex items-center gap-2 rounded-md p-2\",\n \"text-sm font-medium\",\n \"hover:bg-accent hover:text-accent-foreground\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n \"transition-colors\",\n ],\n {\n variants: {\n variant: {\n default: \"gap-3\",\n compact: \"gap-2\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n }\n)\n\nexport const userProfileAvatarVariants = cva([\n \"flex items-center justify-center\",\n \"rounded-full bg-primary text-primary-foreground\",\n \"text-xs font-medium\",\n \"overflow-hidden\",\n], {\n variants: {\n size: {\n sm: \"size-7\",\n md: \"size-8\",\n lg: \"size-10\",\n },\n },\n defaultVariants: {\n size: \"md\",\n },\n})\n\nexport const userProfileInfoVariants = cva([\n \"flex flex-col items-start text-left\",\n])\n\nexport const userProfileNameVariants = cva([\n \"text-sm font-medium text-foreground truncate max-w-32\",\n])\n\nexport const userProfileEmailVariants = cva([\n \"text-xs text-muted-foreground truncate max-w-32\",\n])\n\nexport type UserProfileDropdownVariantProps = VariantProps<\n typeof userProfileDropdownVariants\n>\n","// UserProfileDropdown/UserProfileDropdown.tsx\n\"use client\"\n\nimport type {\n ThemeOption,\n UserProfileDropdownProps,\n UserProfileTriggerProps,\n} from \"./UserProfileDropdown.types\"\n\nimport {\n ComputerIcon,\n ExternalLinkIcon,\n LogOutIcon,\n MoonIcon,\n SunIcon,\n} from \"lucide-react\"\n\nimport { cn } from \"../../../lib/utils\"\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuTrigger,\n} from \"../DropdownMenu\"\nimport {\n userProfileAvatarVariants,\n userProfileDropdownVariants,\n userProfileEmailVariants,\n userProfileInfoVariants,\n userProfileNameVariants,\n userProfileTriggerVariants,\n} from \"./UserProfileDropdown.variants\"\n\n/**\n * Theme options for the theme switcher\n */\nconst themeOptions: { icon: typeof SunIcon; label: string; value: ThemeOption; }[] = [\n { value: \"light\", label: \"Light\", icon: SunIcon },\n { value: \"dark\", label: \"Dark\", icon: MoonIcon },\n { value: \"system\", label: \"System\", icon: ComputerIcon },\n]\n\n/**\n * Get user initials from name or email\n */\nfunction getInitials(name?: string, email?: string): string {\n if (name) {\n const parts = name.split(\" \").filter(Boolean)\n const first = parts[0]\n const second = parts[1]\n if (first && second && first.length > 0 && second.length > 0) {\n return `${first[0] ?? \"\"}${second[0] ?? \"\"}`.toUpperCase()\n }\n return name.slice(0, 2).toUpperCase()\n }\n if (email) {\n return email.slice(0, 2).toUpperCase()\n }\n return \"??\"\n}\n\n/**\n * UserProfileTrigger - Default trigger button showing user avatar and info\n */\nfunction UserProfileTrigger({\n user,\n className,\n ...props\n}: UserProfileTriggerProps) {\n const initials = user.initials ?? getInitials(user.name, user.email)\n\n return (\n <button\n className={cn(userProfileTriggerVariants(), className)}\n data-slot=\"user-profile-trigger\"\n type=\"button\"\n {...props}\n >\n <span className={cn(userProfileAvatarVariants())}>\n {user.avatarUrl ? (\n <img\n alt={user.name ?? user.email}\n className=\"size-full object-cover\"\n src={user.avatarUrl}\n />\n ) : (\n initials\n )}\n </span>\n <span className={cn(userProfileInfoVariants())}>\n {user.name && (\n <span className={cn(userProfileNameVariants())}>{user.name}</span>\n )}\n <span className={cn(userProfileEmailVariants())}>{user.email}</span>\n </span>\n </button>\n )\n}\n\n/**\n * UserProfileDropdown - User profile menu with theme switcher and actions\n *\n * A dropdown menu for user account actions including profile info display,\n * theme switching, custom menu items, and sign out.\n *\n * @example\n * ```tsx\n * // Basic usage\n * <UserProfileDropdown\n * user={{ name: \"John Doe\", email: \"john@example.com\" }}\n * onSignOut={() => signOut()}\n * />\n *\n * // With theme switcher and custom items\n * <UserProfileDropdown\n * user={{ name: \"John Doe\", email: \"john@example.com\", avatarUrl: \"/avatar.jpg\" }}\n * showThemeSwitcher\n * theme={theme}\n * onThemeChange={setTheme}\n * menuItems={[\n * { id: \"docs\", label: \"Documentation\", href: \"/docs\", external: true },\n * { id: \"settings\", label: \"Settings\", onClick: () => openSettings() },\n * ]}\n * onSignOut={() => signOut()}\n * />\n *\n * // With custom trigger\n * <UserProfileDropdown user={user}>\n * <Button variant=\"ghost\">\n * <Avatar src={user.avatarUrl} />\n * </Button>\n * </UserProfileDropdown>\n * ```\n */\nfunction UserProfileDropdown({\n user,\n theme = \"system\",\n onThemeChange,\n showThemeSwitcher = false,\n menuItems = [],\n onSignOut,\n signOutLabel = \"Sign out\",\n align = \"end\",\n side = \"bottom\",\n variant,\n className,\n children,\n ...props\n}: UserProfileDropdownProps) {\n return (\n <div\n className={cn(userProfileDropdownVariants({ variant }), className)}\n data-slot=\"user-profile-dropdown\"\n {...props}\n >\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n {children ?? <UserProfileTrigger user={user} />}\n </DropdownMenuTrigger>\n <DropdownMenuContent align={align} side={side}>\n {/* User info label */}\n <DropdownMenuLabel>{user.email}</DropdownMenuLabel>\n\n {/* Theme switcher */}\n {showThemeSwitcher && (\n <DropdownMenuGroup>\n <DropdownMenuSub>\n <DropdownMenuSubTrigger>Theme</DropdownMenuSubTrigger>\n <DropdownMenuSubContent>\n <DropdownMenuRadioGroup\n value={theme}\n onValueChange={(value) =>\n onThemeChange?.(value as ThemeOption)\n }\n >\n {themeOptions.map((option) => (\n <DropdownMenuRadioItem\n key={option.value}\n aria-label={`Switch to ${option.label} mode`}\n value={option.value}\n >\n <option.icon\n aria-hidden=\"true\"\n className=\"mr-2 size-4 shrink-0\"\n />\n {option.label}\n </DropdownMenuRadioItem>\n ))}\n </DropdownMenuRadioGroup>\n </DropdownMenuSubContent>\n </DropdownMenuSub>\n </DropdownMenuGroup>\n )}\n\n {/* Custom menu items */}\n {menuItems.length > 0 && (\n <>\n <DropdownMenuSeparator />\n <DropdownMenuGroup>\n {menuItems.map((item) => (\n <DropdownMenuItem\n key={item.id}\n asChild={!!item.href}\n variant={item.variant}\n onClick={item.onClick}\n >\n {item.href ? (\n <a\n href={item.href}\n rel={item.external ? \"noopener noreferrer\" : undefined}\n target={item.external ? \"_blank\" : undefined}\n >\n {item.icon && (\n <span className=\"mr-2 size-4\">{item.icon}</span>\n )}\n {item.label}\n {item.external && (\n <ExternalLinkIcon\n aria-hidden=\"true\"\n className=\"mb-0.5 ml-1 size-3 text-muted-foreground\"\n />\n )}\n </a>\n ) : (\n <>\n {item.icon && (\n <span className=\"mr-2 size-4\">{item.icon}</span>\n )}\n {item.label}\n </>\n )}\n </DropdownMenuItem>\n ))}\n </DropdownMenuGroup>\n </>\n )}\n\n {/* Sign out */}\n {onSignOut && (\n <>\n <DropdownMenuSeparator />\n <DropdownMenuGroup>\n <DropdownMenuItem onClick={onSignOut}>\n <LogOutIcon aria-hidden=\"true\" className=\"mr-2 size-4\" />\n {signOutLabel}\n </DropdownMenuItem>\n </DropdownMenuGroup>\n </>\n )}\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n )\n}\n\nUserProfileDropdown.displayName = \"UserProfileDropdown\"\nUserProfileTrigger.displayName = \"UserProfileTrigger\"\n\nexport { UserProfileDropdown, UserProfileTrigger }\n"]}
|
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuLabel, DropdownMenuGroup, DropdownMenuItem, DropdownMenuSeparator } from '../../../chunk-OXDWUKGP.js';
|
|
2
|
-
import { cn } from '../../../chunk-HRNDJU7D.js';
|
|
3
|
-
import '../../../chunk-UP2VWCW5.js';
|
|
4
|
-
import { ChevronsUpDownIcon, PlusIcon } from 'lucide-react';
|
|
5
|
-
import { cva } from 'class-variance-authority';
|
|
6
|
-
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
7
|
-
|
|
8
|
-
var workspaceDropdownVariants = cva(
|
|
9
|
-
// Base styles
|
|
10
|
-
[],
|
|
11
|
-
{
|
|
12
|
-
variants: {
|
|
13
|
-
variant: {
|
|
14
|
-
default: "",
|
|
15
|
-
compact: ""
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
defaultVariants: {
|
|
19
|
-
variant: "default"
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
);
|
|
23
|
-
var workspaceTriggerVariants = cva(
|
|
24
|
-
[
|
|
25
|
-
"flex w-full items-center gap-x-2.5 rounded-md",
|
|
26
|
-
"text-sm",
|
|
27
|
-
"border border-input bg-background",
|
|
28
|
-
"shadow-sm",
|
|
29
|
-
"hover:bg-accent hover:text-accent-foreground",
|
|
30
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
31
|
-
"transition-all"
|
|
32
|
-
],
|
|
33
|
-
{
|
|
34
|
-
variants: {
|
|
35
|
-
variant: {
|
|
36
|
-
default: "p-2",
|
|
37
|
-
compact: "p-1.5"
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
defaultVariants: {
|
|
41
|
-
variant: "default"
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
);
|
|
45
|
-
var workspaceAvatarVariants = cva(
|
|
46
|
-
[
|
|
47
|
-
"flex items-center justify-center rounded",
|
|
48
|
-
"text-xs font-medium text-white"
|
|
49
|
-
],
|
|
50
|
-
{
|
|
51
|
-
variants: {
|
|
52
|
-
size: {
|
|
53
|
-
sm: "size-7 p-1.5",
|
|
54
|
-
md: "size-8 p-2"
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
defaultVariants: {
|
|
58
|
-
size: "md"
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
);
|
|
62
|
-
var workspaceInfoVariants = cva([
|
|
63
|
-
"flex w-full items-center justify-between gap-x-4 truncate"
|
|
64
|
-
]);
|
|
65
|
-
var workspaceNameVariants = cva([
|
|
66
|
-
"truncate whitespace-nowrap text-sm font-medium text-foreground"
|
|
67
|
-
]);
|
|
68
|
-
var workspaceRoleVariants = cva([
|
|
69
|
-
"whitespace-nowrap text-left text-xs text-muted-foreground"
|
|
70
|
-
]);
|
|
71
|
-
var workspaceItemVariants = cva([
|
|
72
|
-
"flex w-full items-center gap-x-2.5"
|
|
73
|
-
]);
|
|
74
|
-
function WorkspaceTrigger({
|
|
75
|
-
workspace,
|
|
76
|
-
variant = "default",
|
|
77
|
-
className,
|
|
78
|
-
...props
|
|
79
|
-
}) {
|
|
80
|
-
return /* @__PURE__ */ jsxs(
|
|
81
|
-
"button",
|
|
82
|
-
{
|
|
83
|
-
className: cn(workspaceTriggerVariants({ variant }), className),
|
|
84
|
-
"data-slot": "workspace-trigger",
|
|
85
|
-
type: "button",
|
|
86
|
-
...props,
|
|
87
|
-
children: [
|
|
88
|
-
/* @__PURE__ */ jsx(
|
|
89
|
-
"span",
|
|
90
|
-
{
|
|
91
|
-
className: cn(
|
|
92
|
-
workspaceAvatarVariants({ size: variant === "compact" ? "sm" : "md" }),
|
|
93
|
-
workspace.color ?? "bg-primary"
|
|
94
|
-
),
|
|
95
|
-
"aria-hidden": "true",
|
|
96
|
-
children: workspace.initials
|
|
97
|
-
}
|
|
98
|
-
),
|
|
99
|
-
/* @__PURE__ */ jsxs("div", { className: cn(workspaceInfoVariants()), children: [
|
|
100
|
-
/* @__PURE__ */ jsxs("div", { className: "truncate", children: [
|
|
101
|
-
/* @__PURE__ */ jsx("p", { className: cn(workspaceNameVariants()), children: workspace.name }),
|
|
102
|
-
workspace.role && /* @__PURE__ */ jsx("p", { className: cn(workspaceRoleVariants()), children: workspace.role })
|
|
103
|
-
] }),
|
|
104
|
-
/* @__PURE__ */ jsx(
|
|
105
|
-
ChevronsUpDownIcon,
|
|
106
|
-
{
|
|
107
|
-
"aria-hidden": "true",
|
|
108
|
-
className: "size-5 shrink-0 text-muted-foreground"
|
|
109
|
-
}
|
|
110
|
-
)
|
|
111
|
-
] })
|
|
112
|
-
]
|
|
113
|
-
}
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
function WorkspaceItem({ workspace }) {
|
|
117
|
-
return /* @__PURE__ */ jsxs("div", { className: cn(workspaceItemVariants()), children: [
|
|
118
|
-
/* @__PURE__ */ jsx(
|
|
119
|
-
"span",
|
|
120
|
-
{
|
|
121
|
-
className: cn(
|
|
122
|
-
workspaceAvatarVariants(),
|
|
123
|
-
workspace.color ?? "bg-primary"
|
|
124
|
-
),
|
|
125
|
-
"aria-hidden": "true",
|
|
126
|
-
children: workspace.initials
|
|
127
|
-
}
|
|
128
|
-
),
|
|
129
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
130
|
-
/* @__PURE__ */ jsx("p", { className: cn(workspaceNameVariants()), children: workspace.name }),
|
|
131
|
-
workspace.role && /* @__PURE__ */ jsx("p", { className: cn(workspaceRoleVariants()), children: workspace.role })
|
|
132
|
-
] })
|
|
133
|
-
] });
|
|
134
|
-
}
|
|
135
|
-
function WorkspaceDropdown({
|
|
136
|
-
selectedWorkspace,
|
|
137
|
-
workspaces,
|
|
138
|
-
onWorkspaceSelect,
|
|
139
|
-
onAddWorkspace,
|
|
140
|
-
addWorkspaceLabel = "Add workspace",
|
|
141
|
-
showAddWorkspace = false,
|
|
142
|
-
align = "start",
|
|
143
|
-
variant,
|
|
144
|
-
className,
|
|
145
|
-
...props
|
|
146
|
-
}) {
|
|
147
|
-
return /* @__PURE__ */ jsx(
|
|
148
|
-
"div",
|
|
149
|
-
{
|
|
150
|
-
className: cn(workspaceDropdownVariants({ variant }), className),
|
|
151
|
-
"data-slot": "workspace-dropdown",
|
|
152
|
-
...props,
|
|
153
|
-
children: /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
154
|
-
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
155
|
-
WorkspaceTrigger,
|
|
156
|
-
{
|
|
157
|
-
variant: variant === "compact" ? "compact" : "default",
|
|
158
|
-
workspace: selectedWorkspace
|
|
159
|
-
}
|
|
160
|
-
) }),
|
|
161
|
-
/* @__PURE__ */ jsxs(DropdownMenuContent, { align, className: "min-w-60", children: [
|
|
162
|
-
/* @__PURE__ */ jsxs(DropdownMenuLabel, { children: [
|
|
163
|
-
"Workspaces (",
|
|
164
|
-
workspaces.length,
|
|
165
|
-
")"
|
|
166
|
-
] }),
|
|
167
|
-
/* @__PURE__ */ jsx(DropdownMenuGroup, { children: workspaces.map((workspace) => /* @__PURE__ */ jsx(
|
|
168
|
-
DropdownMenuItem,
|
|
169
|
-
{
|
|
170
|
-
onClick: () => onWorkspaceSelect?.(workspace),
|
|
171
|
-
children: /* @__PURE__ */ jsx(WorkspaceItem, { workspace })
|
|
172
|
-
},
|
|
173
|
-
workspace.id
|
|
174
|
-
)) }),
|
|
175
|
-
showAddWorkspace && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
176
|
-
/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
177
|
-
/* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: onAddWorkspace, children: [
|
|
178
|
-
/* @__PURE__ */ jsx(PlusIcon, { "aria-hidden": "true", className: "mr-2 size-4" }),
|
|
179
|
-
addWorkspaceLabel
|
|
180
|
-
] })
|
|
181
|
-
] })
|
|
182
|
-
] })
|
|
183
|
-
] })
|
|
184
|
-
}
|
|
185
|
-
);
|
|
186
|
-
}
|
|
187
|
-
WorkspaceDropdown.displayName = "WorkspaceDropdown";
|
|
188
|
-
WorkspaceTrigger.displayName = "WorkspaceTrigger";
|
|
189
|
-
|
|
190
|
-
export { WorkspaceDropdown, WorkspaceItem, WorkspaceTrigger, workspaceAvatarVariants, workspaceDropdownVariants, workspaceInfoVariants, workspaceItemVariants, workspaceNameVariants, workspaceRoleVariants, workspaceTriggerVariants };
|
|
191
|
-
//# sourceMappingURL=index.js.map
|
|
192
|
-
//# sourceMappingURL=index.js.map
|