analytica-frontend-lib 1.0.34 → 1.0.36
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/DropdownMenu/index.d.mts +36 -5
- package/dist/DropdownMenu/index.d.ts +36 -5
- package/dist/DropdownMenu/index.js +178 -39
- package/dist/DropdownMenu/index.js.map +1 -1
- package/dist/DropdownMenu/index.mjs +175 -43
- package/dist/DropdownMenu/index.mjs.map +1 -1
- package/dist/ProgressBar/index.d.mts +60 -0
- package/dist/ProgressBar/index.d.ts +60 -0
- package/dist/ProgressBar/index.js +220 -0
- package/dist/ProgressBar/index.js.map +1 -0
- package/dist/ProgressBar/index.mjs +198 -0
- package/dist/ProgressBar/index.mjs.map +1 -0
- package/dist/Radio/index.d.mts +85 -0
- package/dist/Radio/index.d.ts +85 -0
- package/dist/Radio/index.js +299 -0
- package/dist/Radio/index.js.map +1 -0
- package/dist/Radio/index.mjs +283 -0
- package/dist/Radio/index.mjs.map +1 -0
- package/dist/index.css +150 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +49 -61
- package/dist/index.d.ts +49 -61
- package/dist/index.js +618 -49
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +615 -50
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +150 -0
- package/dist/styles.css.map +1 -1
- package/package.json +3 -1
|
@@ -1,21 +1,33 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode, ButtonHTMLAttributes, HTMLAttributes } from 'react';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
import { StoreApi } from 'zustand';
|
|
4
5
|
|
|
6
|
+
interface DropdownStore {
|
|
7
|
+
open: boolean;
|
|
8
|
+
setOpen: (open: boolean) => void;
|
|
9
|
+
}
|
|
10
|
+
type DropdownStoreApi = StoreApi<DropdownStore>;
|
|
11
|
+
declare function createDropdownStore(): DropdownStoreApi;
|
|
12
|
+
declare const useDropdownStore: (externalStore?: DropdownStoreApi) => DropdownStoreApi;
|
|
5
13
|
interface DropdownMenuProps {
|
|
6
14
|
children: ReactNode;
|
|
7
15
|
open?: boolean;
|
|
8
16
|
onOpenChange?: (open: boolean) => void;
|
|
9
17
|
}
|
|
10
18
|
declare const DropdownMenu: ({ children, open, onOpenChange }: DropdownMenuProps) => react_jsx_runtime.JSX.Element;
|
|
11
|
-
declare const DropdownMenuTrigger: react.ForwardRefExoticComponent<ButtonHTMLAttributes<HTMLButtonElement> &
|
|
12
|
-
|
|
19
|
+
declare const DropdownMenuTrigger: react.ForwardRefExoticComponent<ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
20
|
+
store?: DropdownStoreApi;
|
|
21
|
+
} & react.RefAttributes<HTMLButtonElement>>;
|
|
22
|
+
declare const MenuLabel: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
13
23
|
inset?: boolean;
|
|
14
|
-
|
|
24
|
+
store?: DropdownStoreApi;
|
|
25
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
15
26
|
declare const MenuContent: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
16
27
|
align?: "start" | "center" | "end";
|
|
17
28
|
side?: "top" | "right" | "bottom" | "left";
|
|
18
29
|
sideOffset?: number;
|
|
30
|
+
store?: DropdownStoreApi;
|
|
19
31
|
} & react.RefAttributes<HTMLDivElement>>;
|
|
20
32
|
declare const MenuItem: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
21
33
|
inset?: boolean;
|
|
@@ -23,7 +35,26 @@ declare const MenuItem: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivEl
|
|
|
23
35
|
iconLeft?: ReactNode;
|
|
24
36
|
iconRight?: ReactNode;
|
|
25
37
|
disabled?: boolean;
|
|
38
|
+
variant?: "profile" | "menu";
|
|
39
|
+
store?: DropdownStoreApi;
|
|
40
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
41
|
+
declare const MenuSeparator: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
42
|
+
store?: DropdownStoreApi;
|
|
26
43
|
} & react.RefAttributes<HTMLDivElement>>;
|
|
27
|
-
declare const
|
|
44
|
+
declare const ProfileMenuTrigger: react.ForwardRefExoticComponent<ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
45
|
+
store?: DropdownStoreApi;
|
|
46
|
+
} & react.RefAttributes<HTMLButtonElement>>;
|
|
47
|
+
declare const ProfileMenuHeader: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
48
|
+
name: string;
|
|
49
|
+
email: string;
|
|
50
|
+
store?: DropdownStoreApi;
|
|
51
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
52
|
+
declare const ProfileMenuSection: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
53
|
+
store?: DropdownStoreApi;
|
|
54
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
55
|
+
declare const ProfileMenuFooter: react.ForwardRefExoticComponent<HTMLAttributes<HTMLButtonElement> & {
|
|
56
|
+
disabled?: boolean;
|
|
57
|
+
store?: DropdownStoreApi;
|
|
58
|
+
} & react.RefAttributes<HTMLButtonElement>>;
|
|
28
59
|
|
|
29
|
-
export { DropdownMenuTrigger, MenuContent, MenuItem, MenuLabel, MenuSeparator, DropdownMenu as default };
|
|
60
|
+
export { DropdownMenuTrigger, MenuContent, MenuItem, MenuLabel, MenuSeparator, ProfileMenuFooter, ProfileMenuHeader, ProfileMenuSection, ProfileMenuTrigger, createDropdownStore, DropdownMenu as default, useDropdownStore };
|
|
@@ -1,21 +1,33 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode, ButtonHTMLAttributes, HTMLAttributes } from 'react';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
import { StoreApi } from 'zustand';
|
|
4
5
|
|
|
6
|
+
interface DropdownStore {
|
|
7
|
+
open: boolean;
|
|
8
|
+
setOpen: (open: boolean) => void;
|
|
9
|
+
}
|
|
10
|
+
type DropdownStoreApi = StoreApi<DropdownStore>;
|
|
11
|
+
declare function createDropdownStore(): DropdownStoreApi;
|
|
12
|
+
declare const useDropdownStore: (externalStore?: DropdownStoreApi) => DropdownStoreApi;
|
|
5
13
|
interface DropdownMenuProps {
|
|
6
14
|
children: ReactNode;
|
|
7
15
|
open?: boolean;
|
|
8
16
|
onOpenChange?: (open: boolean) => void;
|
|
9
17
|
}
|
|
10
18
|
declare const DropdownMenu: ({ children, open, onOpenChange }: DropdownMenuProps) => react_jsx_runtime.JSX.Element;
|
|
11
|
-
declare const DropdownMenuTrigger: react.ForwardRefExoticComponent<ButtonHTMLAttributes<HTMLButtonElement> &
|
|
12
|
-
|
|
19
|
+
declare const DropdownMenuTrigger: react.ForwardRefExoticComponent<ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
20
|
+
store?: DropdownStoreApi;
|
|
21
|
+
} & react.RefAttributes<HTMLButtonElement>>;
|
|
22
|
+
declare const MenuLabel: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
13
23
|
inset?: boolean;
|
|
14
|
-
|
|
24
|
+
store?: DropdownStoreApi;
|
|
25
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
15
26
|
declare const MenuContent: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
16
27
|
align?: "start" | "center" | "end";
|
|
17
28
|
side?: "top" | "right" | "bottom" | "left";
|
|
18
29
|
sideOffset?: number;
|
|
30
|
+
store?: DropdownStoreApi;
|
|
19
31
|
} & react.RefAttributes<HTMLDivElement>>;
|
|
20
32
|
declare const MenuItem: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
21
33
|
inset?: boolean;
|
|
@@ -23,7 +35,26 @@ declare const MenuItem: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivEl
|
|
|
23
35
|
iconLeft?: ReactNode;
|
|
24
36
|
iconRight?: ReactNode;
|
|
25
37
|
disabled?: boolean;
|
|
38
|
+
variant?: "profile" | "menu";
|
|
39
|
+
store?: DropdownStoreApi;
|
|
40
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
41
|
+
declare const MenuSeparator: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
42
|
+
store?: DropdownStoreApi;
|
|
26
43
|
} & react.RefAttributes<HTMLDivElement>>;
|
|
27
|
-
declare const
|
|
44
|
+
declare const ProfileMenuTrigger: react.ForwardRefExoticComponent<ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
45
|
+
store?: DropdownStoreApi;
|
|
46
|
+
} & react.RefAttributes<HTMLButtonElement>>;
|
|
47
|
+
declare const ProfileMenuHeader: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
48
|
+
name: string;
|
|
49
|
+
email: string;
|
|
50
|
+
store?: DropdownStoreApi;
|
|
51
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
52
|
+
declare const ProfileMenuSection: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
53
|
+
store?: DropdownStoreApi;
|
|
54
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
55
|
+
declare const ProfileMenuFooter: react.ForwardRefExoticComponent<HTMLAttributes<HTMLButtonElement> & {
|
|
56
|
+
disabled?: boolean;
|
|
57
|
+
store?: DropdownStoreApi;
|
|
58
|
+
} & react.RefAttributes<HTMLButtonElement>>;
|
|
28
59
|
|
|
29
|
-
export { DropdownMenuTrigger, MenuContent, MenuItem, MenuLabel, MenuSeparator, DropdownMenu as default };
|
|
60
|
+
export { DropdownMenuTrigger, MenuContent, MenuItem, MenuLabel, MenuSeparator, ProfileMenuFooter, ProfileMenuHeader, ProfileMenuSection, ProfileMenuTrigger, createDropdownStore, DropdownMenu as default, useDropdownStore };
|
|
@@ -26,25 +26,59 @@ __export(DropdownMenu_exports, {
|
|
|
26
26
|
MenuItem: () => MenuItem,
|
|
27
27
|
MenuLabel: () => MenuLabel,
|
|
28
28
|
MenuSeparator: () => MenuSeparator,
|
|
29
|
-
|
|
29
|
+
ProfileMenuFooter: () => ProfileMenuFooter,
|
|
30
|
+
ProfileMenuHeader: () => ProfileMenuHeader,
|
|
31
|
+
ProfileMenuSection: () => ProfileMenuSection,
|
|
32
|
+
ProfileMenuTrigger: () => ProfileMenuTrigger,
|
|
33
|
+
createDropdownStore: () => createDropdownStore,
|
|
34
|
+
default: () => DropdownMenu_default,
|
|
35
|
+
useDropdownStore: () => useDropdownStore
|
|
30
36
|
});
|
|
31
37
|
module.exports = __toCommonJS(DropdownMenu_exports);
|
|
38
|
+
var import_phosphor_react = require("phosphor-react");
|
|
32
39
|
var import_react = require("react");
|
|
40
|
+
var import_zustand = require("zustand");
|
|
33
41
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
42
|
+
function createDropdownStore() {
|
|
43
|
+
return (0, import_zustand.create)((set) => ({
|
|
44
|
+
open: false,
|
|
45
|
+
setOpen: (open) => set({ open })
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
var useDropdownStore = (externalStore) => {
|
|
49
|
+
if (!externalStore) {
|
|
50
|
+
throw new Error(
|
|
51
|
+
"Component must be used within a DropdownMenu (store is missing)"
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
return externalStore;
|
|
55
|
+
};
|
|
56
|
+
var injectStore = (children, store) => {
|
|
57
|
+
return import_react.Children.map(children, (child) => {
|
|
58
|
+
if ((0, import_react.isValidElement)(child)) {
|
|
59
|
+
const typedChild = child;
|
|
60
|
+
const newProps = {
|
|
61
|
+
store
|
|
62
|
+
};
|
|
63
|
+
if (typedChild.props.children) {
|
|
64
|
+
newProps.children = injectStore(typedChild.props.children, store);
|
|
65
|
+
}
|
|
66
|
+
return (0, import_react.cloneElement)(typedChild, newProps);
|
|
67
|
+
}
|
|
68
|
+
return child;
|
|
69
|
+
});
|
|
70
|
+
};
|
|
37
71
|
var DropdownMenu = ({ children, open, onOpenChange }) => {
|
|
38
|
-
const
|
|
72
|
+
const storeRef = (0, import_react.useRef)(null);
|
|
73
|
+
storeRef.current ??= createDropdownStore();
|
|
74
|
+
const store = storeRef.current;
|
|
39
75
|
const isControlled = open !== void 0;
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
[isControlled, onOpenChange]
|
|
47
|
-
);
|
|
76
|
+
const uncontrolledOpen = (0, import_zustand.useStore)(store, (s) => s.open);
|
|
77
|
+
const currentOpen = isControlled ? open : uncontrolledOpen;
|
|
78
|
+
const setOpen = (newOpen) => {
|
|
79
|
+
onOpenChange?.(newOpen);
|
|
80
|
+
if (!isControlled) store.setState({ open: newOpen });
|
|
81
|
+
};
|
|
48
82
|
const menuRef = (0, import_react.useRef)(null);
|
|
49
83
|
const handleArrowDownOrArrowUp = (event) => {
|
|
50
84
|
const menuContent = menuRef.current?.querySelector('[role="menu"]');
|
|
@@ -80,6 +114,7 @@ var DropdownMenu = ({ children, open, onOpenChange }) => {
|
|
|
80
114
|
}
|
|
81
115
|
};
|
|
82
116
|
(0, import_react.useEffect)(() => {
|
|
117
|
+
onOpenChange?.(currentOpen);
|
|
83
118
|
if (currentOpen) {
|
|
84
119
|
document.addEventListener("mousedown", handleClickOutside);
|
|
85
120
|
document.addEventListener("keydown", handleDownkey);
|
|
@@ -89,17 +124,17 @@ var DropdownMenu = ({ children, open, onOpenChange }) => {
|
|
|
89
124
|
document.removeEventListener("keydown", handleDownkey);
|
|
90
125
|
};
|
|
91
126
|
}, [currentOpen]);
|
|
92
|
-
|
|
93
|
-
()
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
127
|
+
(0, import_react.useEffect)(() => {
|
|
128
|
+
if (isControlled) {
|
|
129
|
+
store.setState({ open });
|
|
130
|
+
}
|
|
131
|
+
}, []);
|
|
132
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "relative", ref: menuRef, children: injectStore(children, store) });
|
|
97
133
|
};
|
|
98
|
-
var DropdownMenuTrigger = (0, import_react.forwardRef)(({ className, children, onClick, ...props }, ref) => {
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
const { open, setOpen } = context;
|
|
134
|
+
var DropdownMenuTrigger = (0, import_react.forwardRef)(({ className, children, onClick, store: externalStore, ...props }, ref) => {
|
|
135
|
+
const store = useDropdownStore(externalStore);
|
|
136
|
+
const open = (0, import_zustand.useStore)(store, (s) => s.open);
|
|
137
|
+
const toggleOpen = () => store.setState({ open: !open });
|
|
103
138
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
104
139
|
"button",
|
|
105
140
|
{
|
|
@@ -107,7 +142,7 @@ var DropdownMenuTrigger = (0, import_react.forwardRef)(({ className, children, o
|
|
|
107
142
|
className: `border border-border-200 cursor-pointer bg-background-muted hover:bg-background-200 transition-colors px-4 py-2 rounded-sm ${className}`,
|
|
108
143
|
onClick: (e) => {
|
|
109
144
|
e.stopPropagation();
|
|
110
|
-
|
|
145
|
+
toggleOpen();
|
|
111
146
|
if (onClick) onClick(e);
|
|
112
147
|
},
|
|
113
148
|
"aria-expanded": open,
|
|
@@ -132,15 +167,16 @@ var ALIGN_CLASSES = {
|
|
|
132
167
|
center: "left-1/2 -translate-x-1/2",
|
|
133
168
|
end: "right-0"
|
|
134
169
|
};
|
|
135
|
-
var MenuLabel = (0, import_react.forwardRef)(({ className, inset, ...props }, ref) =>
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
)
|
|
170
|
+
var MenuLabel = (0, import_react.forwardRef)(({ className, inset, store: _store, ...props }, ref) => {
|
|
171
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
172
|
+
"div",
|
|
173
|
+
{
|
|
174
|
+
ref,
|
|
175
|
+
className: `text-sm w-full ${inset ? "pl-8" : ""} ${className ?? ""}`,
|
|
176
|
+
...props
|
|
177
|
+
}
|
|
178
|
+
);
|
|
179
|
+
});
|
|
144
180
|
MenuLabel.displayName = "MenuLabel";
|
|
145
181
|
var MenuContent = (0, import_react.forwardRef)(
|
|
146
182
|
({
|
|
@@ -149,9 +185,11 @@ var MenuContent = (0, import_react.forwardRef)(
|
|
|
149
185
|
side = "bottom",
|
|
150
186
|
sideOffset = 4,
|
|
151
187
|
children,
|
|
188
|
+
store: externalStore,
|
|
152
189
|
...props
|
|
153
190
|
}, ref) => {
|
|
154
|
-
const
|
|
191
|
+
const store = useDropdownStore(externalStore);
|
|
192
|
+
const open = (0, import_zustand.useStore)(store, (s) => s.open);
|
|
155
193
|
const [isVisible, setIsVisible] = (0, import_react.useState)(open);
|
|
156
194
|
(0, import_react.useEffect)(() => {
|
|
157
195
|
if (open) {
|
|
@@ -194,15 +232,18 @@ MenuContent.displayName = "MenuContent";
|
|
|
194
232
|
var MenuItem = (0, import_react.forwardRef)(
|
|
195
233
|
({
|
|
196
234
|
className,
|
|
197
|
-
inset,
|
|
198
235
|
size = "small",
|
|
199
236
|
children,
|
|
200
237
|
iconRight,
|
|
201
238
|
iconLeft,
|
|
202
239
|
disabled = false,
|
|
203
240
|
onClick,
|
|
241
|
+
variant = "menu",
|
|
242
|
+
store: externalStore,
|
|
204
243
|
...props
|
|
205
244
|
}, ref) => {
|
|
245
|
+
const store = useDropdownStore(externalStore);
|
|
246
|
+
const setOpen = (0, import_zustand.useStore)(store, (s) => s.setOpen);
|
|
206
247
|
const sizeClasses = ITEM_SIZE_CLASSES[size];
|
|
207
248
|
const handleClick = (e) => {
|
|
208
249
|
if (disabled) {
|
|
@@ -211,17 +252,27 @@ var MenuItem = (0, import_react.forwardRef)(
|
|
|
211
252
|
return;
|
|
212
253
|
}
|
|
213
254
|
onClick?.(e);
|
|
255
|
+
setOpen(false);
|
|
256
|
+
};
|
|
257
|
+
const getVariantClasses = () => {
|
|
258
|
+
if (variant === "profile") {
|
|
259
|
+
return "relative flex flex-row justify-between select-none items-center gap-2 rounded-sm p-3 text-sm outline-none transition-colors [&>svg]:size-6 [&>svg]:shrink-0";
|
|
260
|
+
}
|
|
261
|
+
return "relative flex select-none items-center gap-2 rounded-sm p-3 text-sm outline-none transition-colors [&>svg]:size-4 [&>svg]:shrink-0";
|
|
262
|
+
};
|
|
263
|
+
const getVariantProps = () => {
|
|
264
|
+
return variant === "profile" ? { "data-variant": "profile" } : {};
|
|
214
265
|
};
|
|
215
266
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
216
267
|
"div",
|
|
217
268
|
{
|
|
218
269
|
ref,
|
|
219
270
|
role: "menuitem",
|
|
271
|
+
...getVariantProps(),
|
|
220
272
|
"aria-disabled": disabled,
|
|
221
273
|
className: `
|
|
222
274
|
focus-visible:bg-background-50
|
|
223
|
-
|
|
224
|
-
${inset && "pl-8"}
|
|
275
|
+
${getVariantClasses()}
|
|
225
276
|
${sizeClasses}
|
|
226
277
|
${className}
|
|
227
278
|
${disabled ? "cursor-not-allowed text-text-400" : "cursor-pointer hover:bg-background-50 text-text-700 focus:bg-accent focus:text-accent-foreground hover:bg-accent hover:text-accent-foreground"}
|
|
@@ -242,7 +293,7 @@ var MenuItem = (0, import_react.forwardRef)(
|
|
|
242
293
|
}
|
|
243
294
|
);
|
|
244
295
|
MenuItem.displayName = "MenuItem";
|
|
245
|
-
var MenuSeparator = (0, import_react.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
296
|
+
var MenuSeparator = (0, import_react.forwardRef)(({ className, store: _store, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
246
297
|
"div",
|
|
247
298
|
{
|
|
248
299
|
ref,
|
|
@@ -251,6 +302,88 @@ var MenuSeparator = (0, import_react.forwardRef)(({ className, ...props }, ref)
|
|
|
251
302
|
}
|
|
252
303
|
));
|
|
253
304
|
MenuSeparator.displayName = "MenuSeparator";
|
|
305
|
+
var ProfileMenuTrigger = (0, import_react.forwardRef)(({ className, onClick, store: externalStore, ...props }, ref) => {
|
|
306
|
+
const store = useDropdownStore(externalStore);
|
|
307
|
+
const open = (0, import_zustand.useStore)(store, (s) => s.open);
|
|
308
|
+
const toggleOpen = () => store.setState({ open: !open });
|
|
309
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
310
|
+
"button",
|
|
311
|
+
{
|
|
312
|
+
ref,
|
|
313
|
+
className: `rounded-lg size-10 bg-background-50 flex items-center justify-center ${className}`,
|
|
314
|
+
onClick: (e) => {
|
|
315
|
+
e.stopPropagation();
|
|
316
|
+
toggleOpen();
|
|
317
|
+
onClick?.(e);
|
|
318
|
+
},
|
|
319
|
+
"aria-expanded": open,
|
|
320
|
+
...props,
|
|
321
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "size-6 rounded-full bg-background-100 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_phosphor_react.User, { className: "text-background-950", size: 18 }) })
|
|
322
|
+
}
|
|
323
|
+
);
|
|
324
|
+
});
|
|
325
|
+
ProfileMenuTrigger.displayName = "ProfileMenuTrigger";
|
|
326
|
+
var ProfileMenuHeader = (0, import_react.forwardRef)(({ className, name, email, store: _store, ...props }, ref) => {
|
|
327
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
328
|
+
"div",
|
|
329
|
+
{
|
|
330
|
+
ref,
|
|
331
|
+
"data-component": "ProfileMenuHeader",
|
|
332
|
+
className: `
|
|
333
|
+
flex flex-row gap-4 items-center
|
|
334
|
+
${className}
|
|
335
|
+
`,
|
|
336
|
+
...props,
|
|
337
|
+
children: [
|
|
338
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "size-16 bg-background-100 rounded-full flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_phosphor_react.User, { size: 34, className: "text-background-950" }) }),
|
|
339
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-col ", children: [
|
|
340
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xl font-bold text-text-950", children: name }),
|
|
341
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-md text-text-600", children: email })
|
|
342
|
+
] })
|
|
343
|
+
]
|
|
344
|
+
}
|
|
345
|
+
);
|
|
346
|
+
});
|
|
347
|
+
ProfileMenuHeader.displayName = "ProfileMenuHeader";
|
|
348
|
+
var ProfileMenuSection = (0, import_react.forwardRef)(({ className, children, store: _store, ...props }, ref) => {
|
|
349
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
350
|
+
"div",
|
|
351
|
+
{
|
|
352
|
+
ref,
|
|
353
|
+
className: `
|
|
354
|
+
flex flex-col p-2
|
|
355
|
+
${className}
|
|
356
|
+
`,
|
|
357
|
+
...props,
|
|
358
|
+
children
|
|
359
|
+
}
|
|
360
|
+
);
|
|
361
|
+
});
|
|
362
|
+
ProfileMenuSection.displayName = "ProfileMenuSection";
|
|
363
|
+
var ProfileMenuFooter = (0, import_react.forwardRef)(
|
|
364
|
+
({ className, disabled = false, onClick, store: externalStore, ...props }, ref) => {
|
|
365
|
+
const store = useDropdownStore(externalStore);
|
|
366
|
+
const setOpen = (0, import_zustand.useStore)(store, (s) => s.setOpen);
|
|
367
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
368
|
+
"button",
|
|
369
|
+
{
|
|
370
|
+
ref,
|
|
371
|
+
className: `inline-flex items-center justify-center rounded-full cursor-pointer font-medium text-md px-5 py-2.5 w-full bg-transparent text-primary-950 border border-primary-950 hover:bg-background-50 hover:text-primary-400 hover:border-primary-400 focus-visible:border-0 focus-visible:outline-none focus-visible:text-primary-600 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:text-primary-700 active:border-primary-700 disabled:opacity-40 disabled:cursor-not-allowed ${className}`,
|
|
372
|
+
disabled,
|
|
373
|
+
onClick: (e) => {
|
|
374
|
+
setOpen(false);
|
|
375
|
+
onClick?.(e);
|
|
376
|
+
},
|
|
377
|
+
...props,
|
|
378
|
+
children: [
|
|
379
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "mr-2 flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_phosphor_react.SignOut, {}) }),
|
|
380
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "Sair" })
|
|
381
|
+
]
|
|
382
|
+
}
|
|
383
|
+
);
|
|
384
|
+
}
|
|
385
|
+
);
|
|
386
|
+
ProfileMenuFooter.displayName = "ProfileMenuFooter";
|
|
254
387
|
var DropdownMenu_default = DropdownMenu;
|
|
255
388
|
// Annotate the CommonJS export names for ESM import in node:
|
|
256
389
|
0 && (module.exports = {
|
|
@@ -258,6 +391,12 @@ var DropdownMenu_default = DropdownMenu;
|
|
|
258
391
|
MenuContent,
|
|
259
392
|
MenuItem,
|
|
260
393
|
MenuLabel,
|
|
261
|
-
MenuSeparator
|
|
394
|
+
MenuSeparator,
|
|
395
|
+
ProfileMenuFooter,
|
|
396
|
+
ProfileMenuHeader,
|
|
397
|
+
ProfileMenuSection,
|
|
398
|
+
ProfileMenuTrigger,
|
|
399
|
+
createDropdownStore,
|
|
400
|
+
useDropdownStore
|
|
262
401
|
});
|
|
263
402
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/DropdownMenu/DropdownMenu.tsx"],"sourcesContent":["'use client';\n\nimport {\n createContext,\n useState,\n useCallback,\n useContext,\n forwardRef,\n ReactNode,\n ButtonHTMLAttributes,\n useEffect,\n useRef,\n HTMLAttributes,\n MouseEvent,\n KeyboardEvent,\n useMemo,\n} from 'react';\n\ntype DropdownMenuContextType = {\n open: boolean;\n setOpen: (open: boolean) => void;\n};\n\nconst DropdownMenuContext = createContext<DropdownMenuContextType | undefined>(\n undefined\n);\n\ninterface DropdownMenuProps {\n children: ReactNode;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n}\n\nconst DropdownMenu = ({ children, open, onOpenChange }: DropdownMenuProps) => {\n const [internalOpen, setInternalOpen] = useState(false);\n const isControlled = open !== undefined;\n const currentOpen = isControlled ? open : internalOpen;\n\n const setOpen = useCallback(\n (newOpen: boolean) => {\n if (onOpenChange) onOpenChange(newOpen);\n if (!isControlled) setInternalOpen(newOpen);\n },\n [isControlled, onOpenChange]\n );\n\n const menuRef = useRef<HTMLDivElement | null>(null);\n\n const handleArrowDownOrArrowUp = (event: globalThis.KeyboardEvent) => {\n const menuContent = menuRef.current?.querySelector('[role=\"menu\"]');\n if (menuContent) {\n event.preventDefault();\n\n const items = Array.from(\n menuContent.querySelectorAll(\n '[role=\"menuitem\"]:not([aria-disabled=\"true\"])'\n )\n ).filter((el): el is HTMLElement => el instanceof HTMLElement);\n\n if (items.length === 0) return;\n\n const focusedItem = document.activeElement as HTMLElement;\n const currentIndex = items.findIndex((item) => item === focusedItem);\n\n let nextIndex;\n if (event.key === 'ArrowDown') {\n nextIndex = currentIndex === -1 ? 0 : (currentIndex + 1) % items.length;\n } else {\n // ArrowUp\n nextIndex =\n currentIndex === -1\n ? items.length - 1\n : (currentIndex - 1 + items.length) % items.length;\n }\n\n items[nextIndex]?.focus();\n }\n };\n\n const handleDownkey = (event: globalThis.KeyboardEvent) => {\n if (event.key === 'Escape') {\n setOpen(false);\n } else if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n handleArrowDownOrArrowUp(event);\n }\n };\n\n const handleClickOutside = (event: globalThis.MouseEvent) => {\n if (menuRef.current && !menuRef.current.contains(event.target as Node)) {\n setOpen(false);\n }\n };\n\n useEffect(() => {\n if (currentOpen) {\n document.addEventListener('mousedown', handleClickOutside);\n document.addEventListener('keydown', handleDownkey);\n }\n\n return () => {\n document.removeEventListener('mousedown', handleClickOutside);\n document.removeEventListener('keydown', handleDownkey);\n };\n }, [currentOpen]);\n\n const value = useMemo(\n () => ({ open: currentOpen, setOpen }),\n [currentOpen, setOpen]\n );\n return (\n <DropdownMenuContext.Provider value={value}>\n <div className=\"relative\" ref={menuRef}>\n {children}\n </div>\n </DropdownMenuContext.Provider>\n );\n};\n\nconst DropdownMenuTrigger = forwardRef<\n HTMLButtonElement,\n ButtonHTMLAttributes<HTMLButtonElement>\n>(({ className, children, onClick, ...props }, ref) => {\n const context = useContext(DropdownMenuContext);\n if (!context)\n throw new Error('DropdownMenuTrigger must be used within a DropdownMenu');\n\n const { open, setOpen } = context;\n\n return (\n <button\n ref={ref}\n className={`border border-border-200 cursor-pointer bg-background-muted hover:bg-background-200 transition-colors px-4 py-2 rounded-sm ${className}`}\n onClick={(e) => {\n e.stopPropagation();\n setOpen(!open);\n if (onClick) onClick(e);\n }}\n aria-expanded={open}\n {...props}\n >\n {children}\n </button>\n );\n});\nDropdownMenuTrigger.displayName = 'DropdownMenuTrigger';\n\nconst ITEM_SIZE_CLASSES = {\n small: 'text-sm',\n medium: 'text-md',\n} as const;\n\nconst SIDE_CLASSES = {\n top: 'bottom-full',\n right: 'top-full',\n bottom: 'top-full',\n left: 'top-full',\n};\n\nconst ALIGN_CLASSES = {\n start: 'left-0',\n center: 'left-1/2 -translate-x-1/2',\n end: 'right-0',\n};\n\nconst MenuLabel = forwardRef<\n HTMLFieldSetElement,\n HTMLAttributes<HTMLFieldSetElement> & { inset?: boolean }\n>(({ className, inset, ...props }, ref) => (\n <fieldset\n ref={ref}\n role=\"group\"\n className={`text-sm w-full ${inset ? 'pl-8' : ''} ${className ?? ''}`}\n {...props}\n />\n));\nMenuLabel.displayName = 'MenuLabel';\n\nconst MenuContent = forwardRef<\n HTMLDivElement,\n HTMLAttributes<HTMLDivElement> & {\n align?: 'start' | 'center' | 'end';\n side?: 'top' | 'right' | 'bottom' | 'left';\n sideOffset?: number;\n }\n>(\n (\n {\n className,\n align = 'start',\n side = 'bottom',\n sideOffset = 4,\n children,\n ...props\n },\n ref\n ) => {\n const { open } = useContext(DropdownMenuContext)!;\n const [isVisible, setIsVisible] = useState(open);\n\n useEffect(() => {\n if (open) {\n setIsVisible(true);\n } else {\n const timer = setTimeout(() => setIsVisible(false), 200);\n return () => clearTimeout(timer);\n }\n }, [open]);\n\n if (!isVisible) return null;\n\n const getPositionClasses = () => {\n const vertical = SIDE_CLASSES[side];\n const horizontal = ALIGN_CLASSES[align];\n\n return `absolute ${vertical} ${horizontal}`;\n };\n\n return (\n <div\n ref={ref}\n role=\"menu\"\n className={`\n bg-background z-50 min-w-[210px] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md border-border-100\n ${open ? 'animate-in fade-in-0 zoom-in-95' : 'animate-out fade-out-0 zoom-out-95'}\n ${getPositionClasses()}\n ${className}\n `}\n style={{\n marginTop: side === 'bottom' ? sideOffset : undefined,\n marginBottom: side === 'top' ? sideOffset : undefined,\n marginLeft: side === 'right' ? sideOffset : undefined,\n marginRight: side === 'left' ? sideOffset : undefined,\n }}\n {...props}\n >\n {children}\n </div>\n );\n }\n);\n\nMenuContent.displayName = 'MenuContent';\n\nconst MenuItem = forwardRef<\n HTMLDivElement,\n HTMLAttributes<HTMLDivElement> & {\n inset?: boolean;\n size?: 'small' | 'medium';\n iconLeft?: ReactNode;\n iconRight?: ReactNode;\n disabled?: boolean;\n }\n>(\n (\n {\n className,\n inset,\n size = 'small',\n children,\n iconRight,\n iconLeft,\n disabled = false,\n onClick,\n ...props\n },\n ref\n ) => {\n const sizeClasses = ITEM_SIZE_CLASSES[size];\n\n const handleClick = (\n e: MouseEvent<HTMLDivElement> | KeyboardEvent<HTMLDivElement>\n ) => {\n if (disabled) {\n e.preventDefault();\n e.stopPropagation();\n return;\n }\n onClick?.(e as MouseEvent<HTMLDivElement>);\n };\n\n return (\n <div\n ref={ref}\n role=\"menuitem\"\n aria-disabled={disabled}\n className={`\n focus-visible:bg-background-50\n relative flex select-none items-center gap-2 rounded-sm p-3 text-sm outline-none transition-colors [&>svg]:size-4 [&>svg]:shrink-0\n ${inset && 'pl-8'}\n ${sizeClasses}\n ${className}\n ${\n disabled\n ? 'cursor-not-allowed text-text-400'\n : 'cursor-pointer hover:bg-background-50 text-text-700 focus:bg-accent focus:text-accent-foreground hover:bg-accent hover:text-accent-foreground'\n }\n `}\n onClick={handleClick}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') handleClick(e);\n }}\n tabIndex={disabled ? -1 : 0}\n {...props}\n >\n {iconLeft}\n {children}\n {iconRight}\n </div>\n );\n }\n);\nMenuItem.displayName = 'MenuItem';\n\nconst MenuSeparator = forwardRef<\n HTMLDivElement,\n HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={`my-1 h-px bg-border-200 ${className}`}\n {...props}\n />\n));\nMenuSeparator.displayName = 'MenuSeparator';\n\nexport default DropdownMenu;\nexport { DropdownMenuTrigger, MenuContent, MenuItem, MenuLabel, MenuSeparator };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAcO;AA+FD;AAxFN,IAAM,0BAAsB;AAAA,EAC1B;AACF;AAQA,IAAM,eAAe,CAAC,EAAE,UAAU,MAAM,aAAa,MAAyB;AAC5E,QAAM,CAAC,cAAc,eAAe,QAAI,uBAAS,KAAK;AACtD,QAAM,eAAe,SAAS;AAC9B,QAAM,cAAc,eAAe,OAAO;AAE1C,QAAM,cAAU;AAAA,IACd,CAAC,YAAqB;AACpB,UAAI,aAAc,cAAa,OAAO;AACtC,UAAI,CAAC,aAAc,iBAAgB,OAAO;AAAA,IAC5C;AAAA,IACA,CAAC,cAAc,YAAY;AAAA,EAC7B;AAEA,QAAM,cAAU,qBAA8B,IAAI;AAElD,QAAM,2BAA2B,CAAC,UAAoC;AACpE,UAAM,cAAc,QA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,QACC;AAAA,QACA,MAAK;AAAA,QACL,iBAAe;AAAA,QACf,WAAW;AAAA;AAAA;AAAA,YAGP,SAAS,MAAM;AAAA,YACf,WAAW;AAAA,YACX,SAAS;AAAA,YAET,WACI,qCACA,+IACN;AAAA;AAAA,QAEF,SAAS;AAAA,QACT,WAAW,CAAC,MAAM;AAChB,cAAI,EAAE,QAAQ,WAAW,EAAE,QAAQ,IAAK,aAAY,CAAC;AAAA,QACvD;AAAA,QACA,UAAU,WAAW,KAAK;AAAA,QACzB,GAAG;AAAA,QAEH;AAAA;AAAA,UACA;AAAA,UACA;AAAA;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AACA,SAAS,cAAc;AAEvB,IAAM,oBAAgB,yBAGpB,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,QAC1B;AAAA,EAAC;AAAA;AAAA,IACC;AAAA,IACA,WAAW,2BAA2B,SAAS;AAAA,IAC9C,GAAG;AAAA;AACN,CACD;AACD,cAAc,cAAc;AAE5B,IAAO,uBAAQ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/DropdownMenu/DropdownMenu.tsx"],"sourcesContent":["'use client';\n\nimport { SignOut, User } from 'phosphor-react';\nimport {\n forwardRef,\n ReactNode,\n ButtonHTMLAttributes,\n useEffect,\n useRef,\n HTMLAttributes,\n MouseEvent,\n KeyboardEvent,\n isValidElement,\n Children,\n cloneElement,\n ReactElement,\n useState,\n} from 'react';\nimport { create, StoreApi, useStore } from 'zustand';\n\ninterface DropdownStore {\n open: boolean;\n setOpen: (open: boolean) => void;\n}\n\ntype DropdownStoreApi = StoreApi<DropdownStore>;\n\nexport function createDropdownStore(): DropdownStoreApi {\n return create<DropdownStore>((set) => ({\n open: false,\n setOpen: (open) => set({ open }),\n }));\n}\n\nexport const useDropdownStore = (externalStore?: DropdownStoreApi) => {\n if (!externalStore) {\n throw new Error(\n 'Component must be used within a DropdownMenu (store is missing)'\n );\n }\n\n return externalStore;\n};\n\nconst injectStore = (\n children: ReactNode,\n store: DropdownStoreApi\n): ReactNode => {\n return Children.map(children, (child) => {\n if (isValidElement(child)) {\n const typedChild = child as ReactElement<{\n store?: DropdownStoreApi;\n children?: ReactNode;\n }>;\n\n const newProps: Partial<{\n store: DropdownStoreApi;\n children: ReactNode;\n }> = {\n store,\n };\n\n if (typedChild.props.children) {\n newProps.children = injectStore(typedChild.props.children, store);\n }\n\n return cloneElement(typedChild, newProps);\n }\n return child;\n });\n};\n\ninterface DropdownMenuProps {\n children: ReactNode;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n}\n\nconst DropdownMenu = ({ children, open, onOpenChange }: DropdownMenuProps) => {\n const storeRef = useRef<DropdownStoreApi | null>(null);\n storeRef.current ??= createDropdownStore();\n const store = storeRef.current;\n const isControlled = open !== undefined;\n const uncontrolledOpen = useStore(store, (s) => s.open);\n const currentOpen = isControlled ? open : uncontrolledOpen;\n\n const setOpen = (newOpen: boolean) => {\n onOpenChange?.(newOpen);\n if (!isControlled) store.setState({ open: newOpen });\n };\n\n const menuRef = useRef<HTMLDivElement | null>(null);\n\n const handleArrowDownOrArrowUp = (event: globalThis.KeyboardEvent) => {\n const menuContent = menuRef.current?.querySelector('[role=\"menu\"]');\n if (menuContent) {\n event.preventDefault();\n\n const items = Array.from(\n menuContent.querySelectorAll(\n '[role=\"menuitem\"]:not([aria-disabled=\"true\"])'\n )\n ).filter((el): el is HTMLElement => el instanceof HTMLElement);\n\n if (items.length === 0) return;\n\n const focusedItem = document.activeElement as HTMLElement;\n const currentIndex = items.findIndex((item) => item === focusedItem);\n\n let nextIndex;\n if (event.key === 'ArrowDown') {\n nextIndex = currentIndex === -1 ? 0 : (currentIndex + 1) % items.length;\n } else {\n // ArrowUp\n nextIndex =\n currentIndex === -1\n ? items.length - 1\n : (currentIndex - 1 + items.length) % items.length;\n }\n\n items[nextIndex]?.focus();\n }\n };\n\n const handleDownkey = (event: globalThis.KeyboardEvent) => {\n if (event.key === 'Escape') {\n setOpen(false);\n } else if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n handleArrowDownOrArrowUp(event);\n }\n };\n\n const handleClickOutside = (event: globalThis.MouseEvent) => {\n if (menuRef.current && !menuRef.current.contains(event.target as Node)) {\n setOpen(false);\n }\n };\n\n useEffect(() => {\n onOpenChange?.(currentOpen);\n if (currentOpen) {\n document.addEventListener('mousedown', handleClickOutside);\n document.addEventListener('keydown', handleDownkey);\n }\n\n return () => {\n document.removeEventListener('mousedown', handleClickOutside);\n document.removeEventListener('keydown', handleDownkey);\n };\n }, [currentOpen]);\n\n useEffect(() => {\n if (isControlled) {\n store.setState({ open: open });\n }\n }, []);\n\n return (\n <div className=\"relative\" ref={menuRef}>\n {injectStore(children, store)}\n </div>\n );\n};\n\n// Componentes genéricos do DropdownMenu\nconst DropdownMenuTrigger = forwardRef<\n HTMLButtonElement,\n ButtonHTMLAttributes<HTMLButtonElement> & { store?: DropdownStoreApi }\n>(({ className, children, onClick, store: externalStore, ...props }, ref) => {\n const store = useDropdownStore(externalStore);\n\n const open = useStore(store, (s) => s.open);\n const toggleOpen = () => store.setState({ open: !open });\n\n return (\n <button\n ref={ref}\n className={`border border-border-200 cursor-pointer bg-background-muted hover:bg-background-200 transition-colors px-4 py-2 rounded-sm ${className}`}\n onClick={(e) => {\n e.stopPropagation();\n toggleOpen();\n if (onClick) onClick(e);\n }}\n aria-expanded={open}\n {...props}\n >\n {children}\n </button>\n );\n});\nDropdownMenuTrigger.displayName = 'DropdownMenuTrigger';\n\nconst ITEM_SIZE_CLASSES = {\n small: 'text-sm',\n medium: 'text-md',\n} as const;\n\nconst SIDE_CLASSES = {\n top: 'bottom-full',\n right: 'top-full',\n bottom: 'top-full',\n left: 'top-full',\n};\n\nconst ALIGN_CLASSES = {\n start: 'left-0',\n center: 'left-1/2 -translate-x-1/2',\n end: 'right-0',\n};\n\nconst MenuLabel = forwardRef<\n HTMLDivElement,\n HTMLAttributes<HTMLDivElement> & {\n inset?: boolean;\n store?: DropdownStoreApi;\n }\n>(({ className, inset, store: _store, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={`text-sm w-full ${inset ? 'pl-8' : ''} ${className ?? ''}`}\n {...props}\n />\n );\n});\nMenuLabel.displayName = 'MenuLabel';\n\nconst MenuContent = forwardRef<\n HTMLDivElement,\n HTMLAttributes<HTMLDivElement> & {\n align?: 'start' | 'center' | 'end';\n side?: 'top' | 'right' | 'bottom' | 'left';\n sideOffset?: number;\n store?: DropdownStoreApi;\n }\n>(\n (\n {\n className,\n align = 'start',\n side = 'bottom',\n sideOffset = 4,\n children,\n store: externalStore,\n ...props\n },\n ref\n ) => {\n const store = useDropdownStore(externalStore);\n const open = useStore(store, (s) => s.open);\n const [isVisible, setIsVisible] = useState(open);\n\n useEffect(() => {\n if (open) {\n setIsVisible(true);\n } else {\n const timer = setTimeout(() => setIsVisible(false), 200);\n return () => clearTimeout(timer);\n }\n }, [open]);\n\n if (!isVisible) return null;\n\n const getPositionClasses = () => {\n const vertical = SIDE_CLASSES[side];\n const horizontal = ALIGN_CLASSES[align];\n\n return `absolute ${vertical} ${horizontal}`;\n };\n\n return (\n <div\n ref={ref}\n role=\"menu\"\n className={`\n bg-background z-50 min-w-[210px] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md border-border-100\n ${open ? 'animate-in fade-in-0 zoom-in-95' : 'animate-out fade-out-0 zoom-out-95'}\n ${getPositionClasses()}\n ${className}\n `}\n style={{\n marginTop: side === 'bottom' ? sideOffset : undefined,\n marginBottom: side === 'top' ? sideOffset : undefined,\n marginLeft: side === 'right' ? sideOffset : undefined,\n marginRight: side === 'left' ? sideOffset : undefined,\n }}\n {...props}\n >\n {children}\n </div>\n );\n }\n);\nMenuContent.displayName = 'MenuContent';\n\nconst MenuItem = forwardRef<\n HTMLDivElement,\n HTMLAttributes<HTMLDivElement> & {\n inset?: boolean;\n size?: 'small' | 'medium';\n iconLeft?: ReactNode;\n iconRight?: ReactNode;\n disabled?: boolean;\n variant?: 'profile' | 'menu';\n store?: DropdownStoreApi;\n }\n>(\n (\n {\n className,\n size = 'small',\n children,\n iconRight,\n iconLeft,\n disabled = false,\n onClick,\n variant = 'menu',\n store: externalStore,\n ...props\n },\n ref\n ) => {\n const store = useDropdownStore(externalStore);\n const setOpen = useStore(store, (s) => s.setOpen);\n const sizeClasses = ITEM_SIZE_CLASSES[size];\n\n const handleClick = (\n e: MouseEvent<HTMLDivElement> | KeyboardEvent<HTMLDivElement>\n ) => {\n if (disabled) {\n e.preventDefault();\n e.stopPropagation();\n return;\n }\n onClick?.(e as MouseEvent<HTMLDivElement>);\n setOpen(false);\n };\n\n const getVariantClasses = () => {\n if (variant === 'profile') {\n return 'relative flex flex-row justify-between select-none items-center gap-2 rounded-sm p-3 text-sm outline-none transition-colors [&>svg]:size-6 [&>svg]:shrink-0';\n }\n return 'relative flex select-none items-center gap-2 rounded-sm p-3 text-sm outline-none transition-colors [&>svg]:size-4 [&>svg]:shrink-0';\n };\n\n const getVariantProps = () => {\n return variant === 'profile' ? { 'data-variant': 'profile' } : {};\n };\n\n return (\n <div\n ref={ref}\n role=\"menuitem\"\n {...getVariantProps()}\n aria-disabled={disabled}\n className={`\n focus-visible:bg-background-50\n ${getVariantClasses()}\n ${sizeClasses}\n ${className}\n ${\n disabled\n ? 'cursor-not-allowed text-text-400'\n : 'cursor-pointer hover:bg-background-50 text-text-700 focus:bg-accent focus:text-accent-foreground hover:bg-accent hover:text-accent-foreground'\n }\n `}\n onClick={handleClick}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') handleClick(e);\n }}\n tabIndex={disabled ? -1 : 0}\n {...props}\n >\n {iconLeft}\n {children}\n {iconRight}\n </div>\n );\n }\n);\nMenuItem.displayName = 'MenuItem';\n\nconst MenuSeparator = forwardRef<\n HTMLDivElement,\n HTMLAttributes<HTMLDivElement> & { store?: DropdownStoreApi }\n>(({ className, store: _store, ...props }, ref) => (\n <div\n ref={ref}\n className={`my-1 h-px bg-border-200 ${className}`}\n {...props}\n />\n));\nMenuSeparator.displayName = 'MenuSeparator';\n\n// Componentes específicos do ProfileMenu\nconst ProfileMenuTrigger = forwardRef<\n HTMLButtonElement,\n ButtonHTMLAttributes<HTMLButtonElement> & { store?: DropdownStoreApi }\n>(({ className, onClick, store: externalStore, ...props }, ref) => {\n const store = useDropdownStore(externalStore);\n const open = useStore(store, (s) => s.open);\n const toggleOpen = () => store.setState({ open: !open });\n\n return (\n <button\n ref={ref}\n className={`rounded-lg size-10 bg-background-50 flex items-center justify-center ${className}`}\n onClick={(e) => {\n e.stopPropagation();\n toggleOpen();\n onClick?.(e);\n }}\n aria-expanded={open}\n {...props}\n >\n <span className=\"size-6 rounded-full bg-background-100 flex items-center justify-center\">\n <User className=\"text-background-950\" size={18} />\n </span>\n </button>\n );\n});\nProfileMenuTrigger.displayName = 'ProfileMenuTrigger';\n\nconst ProfileMenuHeader = forwardRef<\n HTMLDivElement,\n HTMLAttributes<HTMLDivElement> & {\n name: string;\n email: string;\n store?: DropdownStoreApi;\n }\n>(({ className, name, email, store: _store, ...props }, ref) => {\n return (\n <div\n ref={ref}\n data-component=\"ProfileMenuHeader\"\n className={`\n flex flex-row gap-4 items-center\n ${className}\n `}\n {...props}\n >\n <span className=\"size-16 bg-background-100 rounded-full flex items-center justify-center\">\n <User size={34} className=\"text-background-950\" />\n </span>\n <div className=\"flex flex-col \">\n <p className=\"text-xl font-bold text-text-950\">{name}</p>\n <p className=\"text-md text-text-600\">{email}</p>\n </div>\n </div>\n );\n});\nProfileMenuHeader.displayName = 'ProfileMenuHeader';\n\nconst ProfileMenuSection = forwardRef<\n HTMLDivElement,\n HTMLAttributes<HTMLDivElement> & { store?: DropdownStoreApi }\n>(({ className, children, store: _store, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={`\n flex flex-col p-2\n ${className}\n `}\n {...props}\n >\n {children}\n </div>\n );\n});\nProfileMenuSection.displayName = 'ProfileMenuSection';\n\nconst ProfileMenuFooter = forwardRef<\n HTMLButtonElement,\n HTMLAttributes<HTMLButtonElement> & {\n disabled?: boolean;\n store?: DropdownStoreApi;\n }\n>(\n (\n { className, disabled = false, onClick, store: externalStore, ...props },\n ref\n ) => {\n const store = useDropdownStore(externalStore);\n const setOpen = useStore(store, (s) => s.setOpen);\n\n return (\n <button\n ref={ref}\n className={`inline-flex items-center justify-center rounded-full cursor-pointer font-medium text-md px-5 py-2.5 w-full bg-transparent text-primary-950 border border-primary-950 hover:bg-background-50 hover:text-primary-400 hover:border-primary-400 focus-visible:border-0 focus-visible:outline-none focus-visible:text-primary-600 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:text-primary-700 active:border-primary-700 disabled:opacity-40 disabled:cursor-not-allowed ${className}`}\n disabled={disabled}\n onClick={(e) => {\n setOpen(false);\n onClick?.(e);\n }}\n {...props}\n >\n <span className=\"mr-2 flex items-center\">\n <SignOut />\n </span>\n <span>Sair</span>\n </button>\n );\n }\n);\nProfileMenuFooter.displayName = 'ProfileMenuFooter';\n\n// Exportações\nexport default DropdownMenu;\nexport {\n // Componentes genéricos\n DropdownMenuTrigger,\n MenuContent,\n MenuItem,\n MenuLabel,\n MenuSeparator,\n\n // Componentes específicos do ProfileMenu\n ProfileMenuTrigger,\n ProfileMenuHeader,\n ProfileMenuSection,\n ProfileMenuFooter,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,4BAA8B;AAC9B,mBAcO;AACP,qBAA2C;AA4IvC;AAnIG,SAAS,sBAAwC;AACtD,aAAO,uBAAsB,CAAC,SAAS;AAAA,IACrC,MAAM;AAAA,IACN,SAAS,CAAC,SAAS,IAAI,EAAE,KAAK,CAAC;AAAA,EACjC,EAAE;AACJ;AAEO,IAAM,mBAAmB,CAAC,kBAAqC;AACpE,MAAI,CAAC,eAAe;AAClB,UAAM,IAAI;AAAA,MACR;AAAA,IACF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