UEA-PRODEM

This commit is contained in:
2026-06-10 12:14:46 -03:00
parent f54126b9d8
commit 9947565694
5319 changed files with 148520 additions and 129332 deletions
+26 -23
View File
@@ -7,7 +7,6 @@ import { createContextScope } from "@radix-ui/react-context";
import { Primitive } from "@radix-ui/react-primitive";
import * as MenuPrimitive from "@radix-ui/react-menu";
import { createMenuScope } from "@radix-ui/react-menu";
import { useCallbackRef } from "@radix-ui/react-use-callback-ref";
import { useControllableState } from "@radix-ui/react-use-controllable-state";
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
var CONTEXT_MENU_NAME = "ContextMenu";
@@ -17,35 +16,35 @@ var [createContextMenuContext, createContextMenuScope] = createContextScope(CONT
var useMenuScope = createMenuScope();
var [ContextMenuProvider, useContextMenuContext] = createContextMenuContext(CONTEXT_MENU_NAME);
var ContextMenu = (props) => {
const { __scopeContextMenu, children, onOpenChange, dir, modal = true } = props;
const [open, setOpen] = React.useState(false);
const { __scopeContextMenu, children, onOpenChange, open: openProp, dir, modal = true } = props;
const hasInteractedRef = React.useRef(false);
if (true) {
const hasWarnedRef = React.useRef(false);
React.useEffect(() => {
if (openProp === true && !hasInteractedRef.current && !hasWarnedRef.current) {
hasWarnedRef.current = true;
console.warn(
"ContextMenu: The `open` prop has been set to `true` before the user has interacted with the trigger, so its position is indeterminate. This is likely unintended and will result in the menu being anchored to the top-left corner of the viewport."
);
}
}, [openProp]);
}
const [open, setOpen] = useControllableState({
prop: openProp,
defaultProp: false,
onChange: onOpenChange,
caller: CONTEXT_MENU_NAME
});
const menuScope = useMenuScope(__scopeContextMenu);
const handleOpenChangeProp = useCallbackRef(onOpenChange);
const handleOpenChange = React.useCallback(
(open2) => {
setOpen(open2);
handleOpenChangeProp(open2);
},
[handleOpenChangeProp]
);
return /* @__PURE__ */ jsx(
ContextMenuProvider,
{
scope: __scopeContextMenu,
open,
onOpenChange: handleOpenChange,
onOpenChange: setOpen,
modal,
children: /* @__PURE__ */ jsx(
MenuPrimitive.Root,
{
...menuScope,
dir,
open,
onOpenChange: handleOpenChange,
modal,
children
}
)
hasInteractedRef,
children: /* @__PURE__ */ jsx(MenuPrimitive.Root, { ...menuScope, dir, open, onOpenChange: setOpen, modal, children })
}
);
};
@@ -66,6 +65,7 @@ var ContextMenuTrigger = React.forwardRef(
[]
);
const handleOpen = (event) => {
context.hasInteractedRef.current = true;
pointRef.current = { x: event.clientX, y: event.clientY };
context.onOpenChange(true);
};
@@ -90,6 +90,9 @@ var ContextMenuTrigger = React.forwardRef(
props.onPointerDown,
whenTouchOrPen((event) => {
clearLongPress();
if (context.open) {
context.onOpenChange(false);
}
longPressTimerRef.current = window.setTimeout(() => handleOpen(event), 700);
})
),