@photon-ai/pho-ui 4.16.2 → 4.17.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/chunks/{basic-page-C0C8NDjG.js → basic-page-DS1YIheB.js} +4 -4
- package/dist/chunks/{basic-page-C0C8NDjG.js.map → basic-page-DS1YIheB.js.map} +1 -1
- package/dist/chunks/{code-block-CbcE994O.js → code-block-DMiZkEWS.js} +2 -2
- package/dist/chunks/{code-block-CbcE994O.js.map → code-block-DMiZkEWS.js.map} +1 -1
- package/dist/chunks/copy-button-CHYc_cvM.js +76 -0
- package/dist/chunks/copy-button-CHYc_cvM.js.map +1 -0
- package/dist/chunks/description-list-SIlI9ZHs.js +60 -0
- package/dist/chunks/description-list-SIlI9ZHs.js.map +1 -0
- package/dist/chunks/{filter-bar-yEcG2pBm.js → filter-bar-BCiaO1gO.js} +2 -2
- package/dist/chunks/{filter-bar-yEcG2pBm.js.map → filter-bar-BCiaO1gO.js.map} +1 -1
- package/dist/chunks/menu-CoMrYnd1.js +264 -0
- package/dist/chunks/menu-CoMrYnd1.js.map +1 -0
- package/dist/components/code-block.js +1 -1
- package/dist/components/context-menu.js +38 -37
- package/dist/components/context-menu.js.map +1 -1
- package/dist/components/copy-button.js +1 -1
- package/dist/components/description-list.js +1 -1
- package/dist/components/filter-bar.js +1 -1
- package/dist/components/menu.js +5 -4
- package/dist/components/scope.js +88 -84
- package/dist/components/scope.js.map +1 -1
- package/dist/index.js +5 -5
- package/dist/sections/basic-page.js +1 -1
- package/dist/src/components/copy-button/copy-button.d.ts +15 -4
- package/dist/src/components/description-list/description-list.d.ts +3 -2
- package/dist/src/components/menu/index.d.ts +1 -1
- package/dist/src/components/menu/menu-pending.d.ts +26 -0
- package/package.json +1 -1
- package/dist/chunks/copy-button-D8XyP0oR.js +0 -56
- package/dist/chunks/copy-button-D8XyP0oR.js.map +0 -1
- package/dist/chunks/description-list-8qm83WZB.js +0 -59
- package/dist/chunks/description-list-8qm83WZB.js.map +0 -1
- package/dist/chunks/menu-BQeprfxB.js +0 -208
- package/dist/chunks/menu-BQeprfxB.js.map +0 -1
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { t as o } from "./cn-ChIgwEl3.js";
|
|
3
|
-
import { t as I } from "./resolve-variant-CcD8iG5l.js";
|
|
4
|
-
import { n as S } from "./spinner-BzLUo4Xk.js";
|
|
5
|
-
import { createContext as E, useCallback as T, useContext as P, useEffect as N, useMemo as G, useRef as b, useState as C } from "react";
|
|
6
|
-
import { Fragment as U, jsx as r, jsxs as x } from "react/jsx-runtime";
|
|
7
|
-
import { Separator as _ } from "@base-ui/react/separator";
|
|
8
|
-
import { Menu as t } from "@base-ui/react/menu";
|
|
9
|
-
var y = E(null);
|
|
10
|
-
function ce() {
|
|
11
|
-
return P(y)?.pending ?? !1;
|
|
12
|
-
}
|
|
13
|
-
function L(e) {
|
|
14
|
-
return e != null && typeof e.then == "function";
|
|
15
|
-
}
|
|
16
|
-
function O(e) {
|
|
17
|
-
function n({ onOpenChange: i, actionsRef: s, ...u }) {
|
|
18
|
-
const [l, d] = C(!1), c = b(!1), a = b(null);
|
|
19
|
-
N(() => {
|
|
20
|
-
if (s)
|
|
21
|
-
return s.current = {
|
|
22
|
-
unmount: () => a.current?.unmount(),
|
|
23
|
-
close: () => a.current?.close()
|
|
24
|
-
}, () => {
|
|
25
|
-
s.current = null;
|
|
26
|
-
};
|
|
27
|
-
}, [s]);
|
|
28
|
-
const p = T((h, m) => {
|
|
29
|
-
if (!h && c.current) {
|
|
30
|
-
m.cancel();
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
i?.(h, m);
|
|
34
|
-
}, [i]), g = G(() => ({
|
|
35
|
-
pending: l,
|
|
36
|
-
beginPending: () => {
|
|
37
|
-
c.current = !0, d(!0);
|
|
38
|
-
},
|
|
39
|
-
endPending: () => {
|
|
40
|
-
c.current = !1, d(!1);
|
|
41
|
-
},
|
|
42
|
-
close: () => a.current?.close()
|
|
43
|
-
}), [l]);
|
|
44
|
-
return /* @__PURE__ */ r(y.Provider, {
|
|
45
|
-
value: g,
|
|
46
|
-
children: /* @__PURE__ */ r(e, {
|
|
47
|
-
...u,
|
|
48
|
-
actionsRef: a,
|
|
49
|
-
onOpenChange: p
|
|
50
|
-
})
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
return n;
|
|
54
|
-
}
|
|
55
|
-
function w({ onClick: e, closeOnClick: n = !0, loading: i = !1, disabled: s = !1 }) {
|
|
56
|
-
const u = P(y), l = u?.pending ?? !1, [d, c] = C(!1), a = b(!0);
|
|
57
|
-
N(() => (a.current = !0, () => {
|
|
58
|
-
a.current = !1;
|
|
59
|
-
}), []);
|
|
60
|
-
const p = d || i, g = s || l && !d;
|
|
61
|
-
function h(m) {
|
|
62
|
-
if (p || l && !d) {
|
|
63
|
-
m.preventBaseUIHandler?.();
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
const v = e?.(m);
|
|
67
|
-
L(v) && (m.preventBaseUIHandler?.(), c(!0), u?.beginPending(), v.then(() => {
|
|
68
|
-
u?.endPending(), a.current && c(!1), n && u?.close();
|
|
69
|
-
}, (k) => {
|
|
70
|
-
u?.endPending(), a.current && c(!1), typeof process < "u" && process.env.NODE_ENV !== "production" && console.error("Menu.Item: async onClick rejected —", k);
|
|
71
|
-
}));
|
|
72
|
-
}
|
|
73
|
-
return {
|
|
74
|
-
inert: p,
|
|
75
|
-
blocked: g,
|
|
76
|
-
handleClick: h
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
function z() {
|
|
80
|
-
return /* @__PURE__ */ r(S, {
|
|
81
|
-
"data-menu-spinner": "",
|
|
82
|
-
size: "md"
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
var j = "bg-pho-primary text-pho-primary shadow-pho-lg ring-pho-secondary origin-[var(--transform-origin)] min-w-44 rounded-base p-1.5 ring-1 ring-inset outline-none transition-[transform,opacity] duration-[330ms] ease-pho-spring data-[ending-style]:duration-150 data-[ending-style]:ease-out data-[starting-style]:scale-95 data-[starting-style]:opacity-0 data-[ending-style]:scale-95 data-[ending-style]:opacity-0", f = "relative flex cursor-pointer items-center gap-2 rounded-[calc(var(--radius-base)-6px)] py-2 pr-2.5 pl-2.5 text-base text-pho-secondary outline-none select-none data-[highlighted]:bg-pho-ghost-hover data-[highlighted]:text-pho-primary data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-loading:data-[disabled]:opacity-100 data-loading:[&>svg:not([data-menu-spinner])]:hidden [&>svg]:size-4 [&>svg]:text-current", R = {
|
|
86
|
-
default: {
|
|
87
|
-
classes: "",
|
|
88
|
-
description: "Secondary → primary on highlight"
|
|
89
|
-
},
|
|
90
|
-
destructive: {
|
|
91
|
-
classes: "text-pho-error data-[highlighted]:bg-pho-error-primary data-[highlighted]:text-pho-error",
|
|
92
|
-
description: "Error ink + error wash on highlight"
|
|
93
|
-
}
|
|
94
|
-
}, A = O(t.Root), B = t.Trigger, H = t.Portal, V = t.Group, $ = t.RadioGroup, F = t.SubmenuRoot;
|
|
95
|
-
function D({ className: e, sideOffset: n = 6, ...i }) {
|
|
96
|
-
return /* @__PURE__ */ r(t.Positioner, {
|
|
97
|
-
sideOffset: n,
|
|
98
|
-
className: o("z-50", e),
|
|
99
|
-
...i
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
function K({ className: e, ...n }) {
|
|
103
|
-
return /* @__PURE__ */ r(t.Popup, {
|
|
104
|
-
className: o(j, e),
|
|
105
|
-
...n
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
function q({ className: e, color: n = "default", onClick: i, closeOnClick: s = !0, loading: u = !1, disabled: l = !1, children: d, ...c }) {
|
|
109
|
-
const { inert: a, blocked: p, handleClick: g } = w({
|
|
110
|
-
onClick: i,
|
|
111
|
-
closeOnClick: s,
|
|
112
|
-
loading: u,
|
|
113
|
-
disabled: l
|
|
114
|
-
});
|
|
115
|
-
return /* @__PURE__ */ x(t.Item, {
|
|
116
|
-
className: o(f, I(R, n), e),
|
|
117
|
-
closeOnClick: s,
|
|
118
|
-
disabled: p,
|
|
119
|
-
"data-loading": a || void 0,
|
|
120
|
-
"aria-busy": a || void 0,
|
|
121
|
-
onClick: g,
|
|
122
|
-
...c,
|
|
123
|
-
children: [a ? /* @__PURE__ */ x(U, { children: [/* @__PURE__ */ r(z, {}), /* @__PURE__ */ r("output", {
|
|
124
|
-
className: "sr-only",
|
|
125
|
-
"aria-live": "polite"
|
|
126
|
-
})] }) : null, d]
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
function J({ className: e, color: n = "default", ...i }) {
|
|
130
|
-
return /* @__PURE__ */ r(t.LinkItem, {
|
|
131
|
-
className: o(f, I(R, n), e),
|
|
132
|
-
...i
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
function Q({ className: e, ...n }) {
|
|
136
|
-
return /* @__PURE__ */ r(t.GroupLabel, {
|
|
137
|
-
className: o("text-pho-secondary px-2.5 py-1.5 text-xs font-medium", e),
|
|
138
|
-
...n
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
function W({ className: e, ...n }) {
|
|
142
|
-
return /* @__PURE__ */ r(_, {
|
|
143
|
-
className: o("-mx-1.5 my-1.5 h-px bg-[var(--border-color-pho-secondary)]", e),
|
|
144
|
-
...n
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
function X({ className: e, ...n }) {
|
|
148
|
-
return /* @__PURE__ */ r(t.SubmenuTrigger, {
|
|
149
|
-
className: o(f, "data-[popup-open]:bg-pho-ghost-hover", e),
|
|
150
|
-
...n
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
function Y({ className: e, ...n }) {
|
|
154
|
-
return /* @__PURE__ */ r(t.CheckboxItem, {
|
|
155
|
-
className: o(f, "pl-8", e),
|
|
156
|
-
...n
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
function Z({ className: e, ...n }) {
|
|
160
|
-
return /* @__PURE__ */ r(t.RadioItem, {
|
|
161
|
-
className: o(f, "pl-8", e),
|
|
162
|
-
...n
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
var M = "text-pho-brand absolute left-2.5 flex items-center [&>svg]:size-4";
|
|
166
|
-
function ee({ className: e, ...n }) {
|
|
167
|
-
return /* @__PURE__ */ r(t.CheckboxItemIndicator, {
|
|
168
|
-
className: o(M, e),
|
|
169
|
-
...n
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
function ne({ className: e, ...n }) {
|
|
173
|
-
return /* @__PURE__ */ r(t.RadioItemIndicator, {
|
|
174
|
-
className: o(M, e),
|
|
175
|
-
...n
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
var de = {
|
|
179
|
-
Root: A,
|
|
180
|
-
Trigger: B,
|
|
181
|
-
Portal: H,
|
|
182
|
-
Positioner: D,
|
|
183
|
-
Popup: K,
|
|
184
|
-
Item: q,
|
|
185
|
-
LinkItem: J,
|
|
186
|
-
Group: V,
|
|
187
|
-
GroupLabel: Q,
|
|
188
|
-
Separator: W,
|
|
189
|
-
SubmenuRoot: F,
|
|
190
|
-
SubmenuTrigger: X,
|
|
191
|
-
CheckboxItem: Y,
|
|
192
|
-
CheckboxItemIndicator: ee,
|
|
193
|
-
RadioGroup: $,
|
|
194
|
-
RadioItem: Z,
|
|
195
|
-
RadioItemIndicator: ne
|
|
196
|
-
};
|
|
197
|
-
export {
|
|
198
|
-
z as a,
|
|
199
|
-
O as c,
|
|
200
|
-
de as i,
|
|
201
|
-
R as n,
|
|
202
|
-
w as o,
|
|
203
|
-
j as r,
|
|
204
|
-
ce as s,
|
|
205
|
-
f as t
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
//# sourceMappingURL=menu-BQeprfxB.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"menu-BQeprfxB.js","names":[],"sources":["../../src/components/menu/menu-pending.tsx","../../src/components/menu/menu.tsx"],"sourcesContent":["import {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ComponentType,\n type MouseEvent as ReactMouseEvent,\n type ReactNode,\n type RefObject,\n} from \"react\";\nimport { Spinner } from \"../spinner/spinner\";\n\n/** Imperative actions exposed by Base UI menu `actionsRef`. */\ninterface RootActions {\n unmount: () => void;\n close: () => void;\n}\n\ninterface MenuPendingContextValue {\n /** True while a menu item promise is in flight. */\n pending: boolean;\n beginPending: () => void;\n endPending: () => void;\n /** Close the menu imperatively (used by async items on resolve). */\n close: () => void;\n}\n\nconst MenuPendingContext = createContext<MenuPendingContextValue | null>(null);\n\n/**\n * Whether the surrounding menu has an async item promise in flight —\n * use it to disable sibling items while work is pending.\n * Returns `false` outside a `Menu.Root` / `ContextMenu.Root`.\n */\nexport function useMenuPending(): boolean {\n return useContext(MenuPendingContext)?.pending ?? false;\n}\n\nexport function isThenable(value: unknown): value is Promise<unknown> {\n return (\n value != null && typeof (value as { then?: unknown }).then === \"function\"\n );\n}\n\ntype PreventableMouseEvent = ReactMouseEvent<HTMLElement> & {\n preventBaseUIHandler?: () => void;\n};\n\ntype RootWithPendingProps = {\n onOpenChange?: (open: boolean, eventDetails: { cancel: () => void }) => void;\n actionsRef?: RefObject<RootActions | null>;\n children?: ReactNode;\n};\n\n/**\n * Wraps a Base UI menu root so async `Menu.Item` clicks can lock dismissal\n * (outside press, Escape) until the promise settles.\n */\nexport function withMenuPendingRoot<P extends RootWithPendingProps>(\n BaseRoot: ComponentType<P>,\n): ComponentType<P> {\n function PendingRoot({ onOpenChange, actionsRef, ...props }: P) {\n const [pending, setPending] = useState(false);\n // Guard reads a ref so a resolve → close() in the same tick isn't blocked\n // by a not-yet-flushed state update.\n const pendingRef = useRef(false);\n const internalActionsRef = useRef<RootActions | null>(null);\n\n useEffect(() => {\n if (!actionsRef) return;\n // Proxy so callers always hit the live Base UI actions, even if the\n // popup remounts after this effect runs.\n actionsRef.current = {\n unmount: () => internalActionsRef.current?.unmount(),\n close: () => internalActionsRef.current?.close(),\n };\n return () => {\n actionsRef.current = null;\n };\n }, [actionsRef]);\n\n const handleOpenChange = useCallback(\n (open: boolean, eventDetails: { cancel: () => void }) => {\n if (!open && pendingRef.current) {\n eventDetails.cancel();\n return;\n }\n onOpenChange?.(open, eventDetails);\n },\n [onOpenChange],\n );\n\n const contextValue = useMemo<MenuPendingContextValue>(\n () => ({\n pending,\n beginPending: () => {\n pendingRef.current = true;\n setPending(true);\n },\n endPending: () => {\n pendingRef.current = false;\n setPending(false);\n },\n close: () => internalActionsRef.current?.close(),\n }),\n [pending],\n );\n\n return (\n <MenuPendingContext.Provider value={contextValue}>\n <BaseRoot\n {...(props as P)}\n actionsRef={internalActionsRef}\n onOpenChange={handleOpenChange}\n />\n </MenuPendingContext.Provider>\n );\n }\n\n return PendingRoot as ComponentType<P>;\n}\n\nexport type AsyncMenuItemClick = (\n event: ReactMouseEvent<HTMLElement>,\n) => void | Promise<unknown>;\n\n/**\n * Shared click handler for `Menu.Item` / `ContextMenu.Item` promise support.\n * Returns whether the item should show its loading state.\n */\nexport function useAsyncMenuItem({\n onClick,\n closeOnClick = true,\n loading = false,\n disabled = false,\n}: {\n onClick?: AsyncMenuItemClick;\n closeOnClick?: boolean;\n loading?: boolean;\n disabled?: boolean;\n}) {\n const pendingContext = useContext(MenuPendingContext);\n const menuPending = pendingContext?.pending ?? false;\n const [busy, setBusy] = useState(false);\n const mountedRef = useRef(true);\n\n useEffect(() => {\n mountedRef.current = true;\n return () => {\n mountedRef.current = false;\n };\n }, []);\n\n const inert = busy || loading;\n // Disable siblings while any item promise is in flight — not the busy item itself.\n const blocked = disabled || (menuPending && !busy);\n\n function handleClick(event: ReactMouseEvent<HTMLElement>) {\n if (inert || (menuPending && !busy)) {\n (event as PreventableMouseEvent).preventBaseUIHandler?.();\n return;\n }\n const result = onClick?.(event);\n if (!isThenable(result)) {\n return;\n }\n // Stop Base UI's closeOnClick for this press; close on resolve instead.\n (event as PreventableMouseEvent).preventBaseUIHandler?.();\n setBusy(true);\n pendingContext?.beginPending();\n result.then(\n () => {\n pendingContext?.endPending();\n if (mountedRef.current) setBusy(false);\n if (closeOnClick) pendingContext?.close();\n },\n (error: unknown) => {\n pendingContext?.endPending();\n if (mountedRef.current) setBusy(false);\n if (\n typeof process !== \"undefined\" &&\n process.env?.NODE_ENV !== \"production\"\n ) {\n console.error(\"Menu.Item: async onClick rejected —\", error);\n }\n },\n );\n }\n\n return { inert, blocked, handleClick };\n}\n\n/** Menu-row spinner — keeps `data-menu-spinner` for the hide-siblings CSS. */\nexport function MenuItemSpinner() {\n return <Spinner data-menu-spinner=\"\" size=\"md\" />;\n}\n","import {\n type ComponentProps,\n type ElementType,\n type MouseEvent as ReactMouseEvent,\n} from \"react\";\nimport { Menu as BaseMenu } from \"@base-ui/react/menu\";\nimport { Separator as BaseSeparator } from \"@base-ui/react/separator\";\nimport { cn } from \"../../utils/cn\";\nimport { resolveVariant, type VariantMap } from \"../../utils/resolve-variant\";\nimport {\n MenuItemSpinner,\n useAsyncMenuItem,\n useMenuPending,\n withMenuPendingRoot,\n type AsyncMenuItemClick,\n} from \"./menu-pending\";\n\nexport { useMenuPending };\n\n/** Override Base UI's `string | (state) => string` className with plain string. */\ntype StyledProps<T extends ElementType> = Omit<\n ComponentProps<T>,\n \"className\" | \"color\"\n> & {\n className?: string;\n};\n\n/** Shared popup + item styles, reused by `ContextMenu` and `Menubar` menus. */\n// Floating layer: keeps its elevation shadow, sits on the primary surface\n// with the site's hairline (ring-pho-secondary, #eee/#202020) as its edge.\n// `base` radius + p-1.5 inset — the highlight floats 6px clear of the edge.\nexport const MENU_POPUP =\n \"bg-pho-primary text-pho-primary shadow-pho-lg ring-pho-secondary origin-[var(--transform-origin)] min-w-44 rounded-base p-1.5 ring-1 ring-inset outline-none transition-[transform,opacity] duration-[330ms] ease-pho-spring data-[ending-style]:duration-150 data-[ending-style]:ease-out data-[starting-style]:scale-95 data-[starting-style]:opacity-0 data-[ending-style]:scale-95 data-[ending-style]:opacity-0\";\n// Rest at secondary; highlighted lifts to primary with the quiet ghost wash.\n// Icons use `text-current` so they follow the row ink (including destructive).\n// While loading, the spinner is first; hide the rest of the leading icons.\n// Concentric correction (see /scale): row radius = popup radius − popup\n// padding (base − 6px). py-2 + 20px line-height lands the 36px row height.\nexport const MENU_ITEM =\n \"relative flex cursor-pointer items-center gap-2 rounded-[calc(var(--radius-base)-6px)] py-2 pr-2.5 pl-2.5 text-base text-pho-secondary outline-none select-none data-[highlighted]:bg-pho-ghost-hover data-[highlighted]:text-pho-primary data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-loading:data-[disabled]:opacity-100 data-loading:[&>svg:not([data-menu-spinner])]:hidden [&>svg]:size-4 [&>svg]:text-current\";\n\n/** Semantic ink for `Menu.Item` / `LinkItem` / `ContextMenu.Item`. */\nexport const MENU_ITEM_COLORS = {\n default: { classes: \"\", description: \"Secondary → primary on highlight\" },\n destructive: {\n classes:\n \"text-pho-error data-[highlighted]:bg-pho-error-primary data-[highlighted]:text-pho-error\",\n description: \"Error ink + error wash on highlight\",\n },\n} satisfies VariantMap;\n\nexport type MenuItemColor = keyof typeof MENU_ITEM_COLORS;\n\ntype ItemColorProps = {\n /** Semantic ink. @default \"default\" */\n color?: MenuItemColor;\n};\n\nexport type MenuItemProps = Omit<StyledProps<typeof BaseMenu.Item>, \"onClick\"> &\n ItemColorProps & {\n /**\n * Action handler. Return a promise to keep the menu open while it runs:\n * the item shows a spinner, dismissal is locked, and the menu closes when\n * the promise resolves (if `closeOnClick`). On rejection the menu stays\n * open — surface errors inside the handler.\n */\n onClick?: AsyncMenuItemClick;\n /**\n * Declarative loading state (same visual as an in-flight promise).\n * @default false\n */\n loading?: boolean;\n };\n\nconst Root = withMenuPendingRoot(BaseMenu.Root);\nconst Trigger = BaseMenu.Trigger;\nconst Portal = BaseMenu.Portal;\nconst Group = BaseMenu.Group;\nconst RadioGroup = BaseMenu.RadioGroup;\n// Don't wrap SubmenuRoot — nested pending context would shadow the parent\n// Root and fail to lock dismissal for async items inside a submenu.\nconst SubmenuRoot = BaseMenu.SubmenuRoot;\n\nfunction Positioner({\n className,\n sideOffset = 6,\n ...props\n}: StyledProps<typeof BaseMenu.Positioner>) {\n return (\n <BaseMenu.Positioner\n sideOffset={sideOffset}\n className={cn(\"z-50\", className)}\n {...props}\n />\n );\n}\n\nfunction Popup({ className, ...props }: StyledProps<typeof BaseMenu.Popup>) {\n return <BaseMenu.Popup className={cn(MENU_POPUP, className)} {...props} />;\n}\n\nfunction Item({\n className,\n color = \"default\",\n onClick,\n closeOnClick = true,\n loading = false,\n disabled = false,\n children,\n ...props\n}: MenuItemProps) {\n const { inert, blocked, handleClick } = useAsyncMenuItem({\n onClick,\n closeOnClick,\n loading,\n disabled,\n });\n\n return (\n <BaseMenu.Item\n className={cn(\n MENU_ITEM,\n resolveVariant(MENU_ITEM_COLORS, color),\n className,\n )}\n closeOnClick={closeOnClick}\n disabled={blocked}\n data-loading={inert || undefined}\n aria-busy={inert || undefined}\n onClick={handleClick as (event: ReactMouseEvent<HTMLElement>) => void}\n {...props}\n >\n {inert ? (\n <>\n <MenuItemSpinner />\n <output className=\"sr-only\" aria-live=\"polite\" />\n </>\n ) : null}\n {children}\n </BaseMenu.Item>\n );\n}\n\nfunction LinkItem({\n className,\n color = \"default\",\n ...props\n}: StyledProps<typeof BaseMenu.LinkItem> & ItemColorProps) {\n return (\n <BaseMenu.LinkItem\n className={cn(\n MENU_ITEM,\n resolveVariant(MENU_ITEM_COLORS, color),\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction GroupLabel({\n className,\n ...props\n}: StyledProps<typeof BaseMenu.GroupLabel>) {\n return (\n <BaseMenu.GroupLabel\n className={cn(\n \"text-pho-secondary px-2.5 py-1.5 text-xs font-medium\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction Separator({ className, ...props }: StyledProps<typeof BaseSeparator>) {\n return (\n <BaseSeparator\n className={cn(\n \"-mx-1.5 my-1.5 h-px bg-[var(--border-color-pho-secondary)]\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction SubmenuTrigger({\n className,\n ...props\n}: StyledProps<typeof BaseMenu.SubmenuTrigger>) {\n return (\n <BaseMenu.SubmenuTrigger\n className={cn(\n MENU_ITEM,\n \"data-[popup-open]:bg-pho-ghost-hover\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction CheckboxItem({\n className,\n ...props\n}: StyledProps<typeof BaseMenu.CheckboxItem>) {\n return (\n <BaseMenu.CheckboxItem\n className={cn(MENU_ITEM, \"pl-8\", className)}\n {...props}\n />\n );\n}\n\nfunction RadioItem({\n className,\n ...props\n}: StyledProps<typeof BaseMenu.RadioItem>) {\n return (\n <BaseMenu.RadioItem\n className={cn(MENU_ITEM, \"pl-8\", className)}\n {...props}\n />\n );\n}\n\nconst CHECK_INDICATOR =\n \"text-pho-brand absolute left-2.5 flex items-center [&>svg]:size-4\";\n\nfunction CheckboxItemIndicator({\n className,\n ...props\n}: StyledProps<typeof BaseMenu.CheckboxItemIndicator>) {\n return (\n <BaseMenu.CheckboxItemIndicator\n className={cn(CHECK_INDICATOR, className)}\n {...props}\n />\n );\n}\n\nfunction RadioItemIndicator({\n className,\n ...props\n}: StyledProps<typeof BaseMenu.RadioItemIndicator>) {\n return (\n <BaseMenu.RadioItemIndicator\n className={cn(CHECK_INDICATOR, className)}\n {...props}\n />\n );\n}\n\n/**\n * Dropdown menu built on Base UI `Menu` — a list of actions opened from a\n * trigger. Supports grouped items, separators, submenus\n * (`SubmenuRoot` + `SubmenuTrigger`), and stateful `CheckboxItem` /\n * `RadioItem`s. `Menu.Item` has native promise support (spinner + locked\n * dismissal while pending). For a right-click menu use `ContextMenu`.\n */\nexport const Menu = {\n Root,\n Trigger,\n Portal,\n Positioner,\n Popup,\n Item,\n LinkItem,\n Group,\n GroupLabel,\n Separator,\n SubmenuRoot,\n SubmenuTrigger,\n CheckboxItem,\n CheckboxItemIndicator,\n RadioGroup,\n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