@radix-ui/react-context-menu 0.1.7-rc.2 → 0.1.7-rc.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.module.js.map +1 -1
- package/package.json +7 -7
package/dist/index.d.ts
CHANGED
|
@@ -5,10 +5,10 @@ import * as MenuPrimitive from "@radix-ui/react-menu";
|
|
|
5
5
|
type Direction = 'ltr' | 'rtl';
|
|
6
6
|
export const createContextMenuScope: import("@radix-ui/react-context").CreateScope;
|
|
7
7
|
export interface ContextMenuProps {
|
|
8
|
+
children?: React.ReactNode;
|
|
8
9
|
onOpenChange?(open: boolean): void;
|
|
9
10
|
dir?: Direction;
|
|
10
11
|
modal?: boolean;
|
|
11
|
-
children?: React.ReactNode;
|
|
12
12
|
}
|
|
13
13
|
export const ContextMenu: React.FC<ContextMenuProps>;
|
|
14
14
|
type PrimitiveSpanProps = Radix.ComponentPropsWithoutRef<typeof Primitive.span>;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"A;A;A;A;AAWA,iBAAiB,KAAK,GAAG,KAAK,CAAC;AAU/B,OAAA,6FAEE,CAAC;AAaH;IACE,YAAY,CAAC,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAAC;IACnC,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"mappings":"A;A;A;A;AAWA,iBAAiB,KAAK,GAAG,KAAK,CAAC;AAU/B,OAAA,6FAEE,CAAC;AAaH;IACE,QAAQ,CAAC,EAAE,MAAM,SAAS,CAAC;IAC3B,YAAY,CAAC,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAAC;IACnC,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;CACj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AAc,SAAS,CAAC,CAAC;AACzF,0CAAoC,SAAQ,kBAAkB;CAAG;AAEjE,OAAA,MAAM,sHAOJ,CAAC;AAWH,8BAA8B,MAAM,wBAAwB,CAAC,OAAO,cAAc,aAAa,CAAC,CAAC;AACjG,8CAAwC,SAAQ,sBAAsB;CAAG;AAEzE,OAAA,MAAM,+HAOJ,CAAC;AAWH,0BAA0B,MAAM,wBAAwB,CAAC,OAAO,cAAc,SAAS,CAAC,CAAC;AACzF,0CAAoC,SAAQ,kBAAkB;CAAG;AAEjE,OAAA,MAAM,sHAOJ,CAAC;AAWH,sBAAsB,MAAM,wBAAwB,CAAC,OAAO,cAAc,KAAK,CAAC,CAAC;AACjF,sCAAgC,SAAQ,cAAc;CAAG;AAEzD,OAAA,MAAM,6GAML,CAAC;AAUF,OAAA,MAAM,gCAAkB,CAAC;AACzB,OAAA,MAAM,wGAA4B,CAAC;AACnC,OAAA,MAAM,uGAA4B,CAAC;AACnC,OAAA,MAAM,mGAAwB,CAAC;AAC/B,OAAA,MAAM,mGAAwB,CAAC;AAC/B,OAAA,MAAM,iGAAsB,CAAC;AAC7B,OAAA,MAAM,+GAAoC,CAAC;AAC3C,OAAA,MAAM,iHAAsC,CAAC;AAC7C,OAAA,MAAM,6GAAkC,CAAC;AACzC,OAAA,MAAM,2GAAgC,CAAC;AACvC,OAAA,MAAM,oHAAwC,CAAC;AAC/C,OAAA,MAAM,2GAAgC,CAAC;AACvC,OAAA,MAAM,kGAAwB,CAAC","sources":["./packages/react/context-menu/src/packages/react/context-menu/src/ContextMenu.tsx","./packages/react/context-menu/src/packages/react/context-menu/src/index.ts"],"sourcesContent":[null,null],"names":[],"version":3,"file":"index.d.ts.map"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"IAAgCA,0TAAAA,8CAClBA,EAAEC,WAAaD,EAAEE,QAAUF,EAWzC,SAASG,EAAuBC,EAAMC,GAcpC,OAbAC,OAAOC,KAAKF,GAAQ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MoB,YAGrC,CAAC5B,EAAmD6B,KACpD,MAAM5B,mBAAEA,KAAuB2G,GAAuB5G,EAChDY,EAAYhB,EAAaK,gBAC/B,OAAOiB,EAAAC,cAACI,EAAcsF,cAAfpF,EAAA,GAAiCb,EAAegG,EAAhD,CAAoEpD,IAAK3B,2CASlF,MAMMiF,eAAuBtG,EAAMoB,YAGjC,CAAC5B,EAA+C6B,KAChD,MAAM5B,mBAAEA,KAAuB8G,GAAmB/G,EAC5CY,EAAYhB,EAAaK,gBAC/B,OAAOiB,EAAAC,cAACI,EAAcyF,UAAfvF,EAAA,GAA6Bb,EAAemG,EAA5C,CAA4DvD,IAAK3B,uCAS1E,MAMMoF,eAAmBzG,EAAMoB,YAC7B,CAAC5B,EAA2C6B,KAC1C,MAAM5B,mBAAEA,KAAuBiH,GAAelH,EACxCY,EAAYhB,EAAaK,gBAC/B,OAAOiB,EAAAC,cAACI,EAAc4F,MAAf1F,EAAA,GAAyBb,EAAesG,EAAxC,CAAoD1D,IAAK3B,QAQpE,SAASkC,EAAkBqD,GACzB,OAAQpE,GAAiC,UAAtBA,EAAMqE,YAA0BD,EAAQpE,QAASsE,6BAGtE,MAAM5F,EAAO3B,iBACb,MAAMwH,EAAU5F,oBAChB,MAAM8C,EAAUJ,oBAChB,MAAMmB,EAAQF,kBACd,MAAMK,EAAQF,kBACd,MAAMK,EAAOF,iBACb,MAAM4B,EAAczB,wBACpB,MAAMK,EAAeF,yBACrB,MAAMK,EAAaF,uBACnB,MAAMK,EAAYF,sBAClB,MAAMK,EAAgBF,0BACtB,MAAMK,EAAYF,sBAClB,MAAMK,EAAQF","sources":["./node_modules/@parcel/scope-hoisting/lib/helpers.js","./packages/react/context-menu/src/ContextMenu.tsx"],"sourcesContent":["function $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\n\nfunction $parcel$defineInteropFlag(a) {\n Object.defineProperty(a, '__esModule', {value: true});\n}\n\nfunction $parcel$reexport(e, n, v) {\n Object.defineProperty(e, n, {get: v, enumerable: true});\n}\n\nfunction $parcel$exportWildcard(dest, source) {\n Object.keys(source).forEach(function(key) {\n if (key === 'default' || key === '__esModule') {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function get() {\n return source[key];\n },\n });\n });\n\n return dest;\n}\n\nfunction $parcel$missingModule(name) {\n var err = new Error(\"Cannot find module '\" + name + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n}\n\nvar $parcel$global =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\n","import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport * as MenuPrimitive from '@radix-ui/react-menu';\nimport { createMenuScope } from '@radix-ui/react-menu';\nimport { useCallbackRef } from '@radix-ui/react-use-callback-ref';\n\nimport type * as Radix from '@radix-ui/react-primitive';\nimport type { Scope } from '@radix-ui/react-context';\n\ntype Direction = 'ltr' | 'rtl';\ntype Point = { x: number; y: number };\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenu\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTEXT_MENU_NAME = 'ContextMenu';\n\ntype ScopedProps<P> = P & { __scopeContextMenu?: Scope };\nconst [createContextMenuContext, createContextMenuScope] = createContextScope(CONTEXT_MENU_NAME, [\n createMenuScope,\n]);\nconst useMenuScope = createMenuScope();\n\ntype ContextMenuContextValue = {\n isRootMenu: boolean;\n open: boolean;\n onOpenChange(open: boolean): void;\n modal: boolean;\n};\n\nconst [ContextMenuProvider, useContextMenuContext] =\n createContextMenuContext<ContextMenuContextValue>(CONTEXT_MENU_NAME);\n\ninterface ContextMenuProps {\n onOpenChange?(open: boolean): void;\n dir?: Direction;\n modal?: boolean;\n children?: React.ReactNode;\n}\n\nconst ContextMenu: React.FC<ContextMenuProps> = (props: ScopedProps<ContextMenuProps>) => {\n const { __scopeContextMenu, children, onOpenChange, dir, modal = true } = props;\n const [open, setOpen] = React.useState(false);\n const contentContext = useContentContext(CONTEXT_MENU_NAME, __scopeContextMenu);\n const menuScope = useMenuScope(__scopeContextMenu);\n const handleOpenChangeProp = useCallbackRef(onOpenChange);\n\n const handleOpenChange = React.useCallback(\n (open) => {\n setOpen(open);\n handleOpenChangeProp(open);\n },\n [handleOpenChangeProp]\n );\n\n return contentContext.isInsideContent ? (\n <ContextMenuProvider\n scope={__scopeContextMenu}\n isRootMenu={false}\n open={open}\n onOpenChange={handleOpenChange}\n modal={modal}\n >\n <MenuPrimitive.Sub {...menuScope} open={open} onOpenChange={handleOpenChange}>\n {children}\n </MenuPrimitive.Sub>\n </ContextMenuProvider>\n ) : (\n <ContextMenuProvider\n scope={__scopeContextMenu}\n isRootMenu={true}\n open={open}\n onOpenChange={handleOpenChange}\n modal={modal}\n >\n <MenuPrimitive.Root\n {...menuScope}\n dir={dir}\n open={open}\n onOpenChange={handleOpenChange}\n modal={modal}\n >\n {children}\n </MenuPrimitive.Root>\n </ContextMenuProvider>\n );\n};\n\nContextMenu.displayName = CONTEXT_MENU_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'ContextMenuTrigger';\n\ntype ContextMenuTriggerElement = React.ElementRef<typeof Primitive.span>;\ntype PrimitiveSpanProps = Radix.ComponentPropsWithoutRef<typeof Primitive.span>;\ninterface ContextMenuTriggerProps extends PrimitiveSpanProps {}\n\nconst ContextMenuTrigger = React.forwardRef<ContextMenuTriggerElement, ContextMenuTriggerProps>(\n (props: ScopedProps<ContextMenuTriggerProps>, forwardedRef) => {\n const { __scopeContextMenu, ...triggerProps } = props;\n const context = useContextMenuContext(TRIGGER_NAME, __scopeContextMenu);\n const menuScope = useMenuScope(__scopeContextMenu);\n const pointRef = React.useRef<Point>({ x: 0, y: 0 });\n const virtualRef = React.useRef({\n getBoundingClientRect: () => DOMRect.fromRect({ width: 0, height: 0, ...pointRef.current }),\n });\n const longPressTimerRef = React.useRef(0);\n const clearLongPress = React.useCallback(\n () => window.clearTimeout(longPressTimerRef.current),\n []\n );\n const handleOpen = (event: React.MouseEvent | React.PointerEvent) => {\n pointRef.current = { x: event.clientX, y: event.clientY };\n context.onOpenChange(true);\n };\n\n React.useEffect(() => clearLongPress, [clearLongPress]);\n\n return (\n <ContentProvider scope={__scopeContextMenu} isInsideContent={false}>\n <MenuPrimitive.Anchor {...menuScope} virtualRef={virtualRef} />\n <Primitive.span\n {...triggerProps}\n ref={forwardedRef}\n // prevent iOS context menu from appearing\n style={{ WebkitTouchCallout: 'none', ...props.style }}\n onContextMenu={composeEventHandlers(props.onContextMenu, (event) => {\n // clearing the long press here because some platforms already support\n // long press to trigger a `contextmenu` event\n clearLongPress();\n event.preventDefault();\n handleOpen(event);\n })}\n onPointerDown={composeEventHandlers(\n props.onPointerDown,\n whenTouchOrPen((event) => {\n // clear the long press here in case there's multiple touch points\n clearLongPress();\n longPressTimerRef.current = window.setTimeout(() => handleOpen(event), 700);\n })\n )}\n onPointerMove={composeEventHandlers(props.onPointerMove, whenTouchOrPen(clearLongPress))}\n onPointerCancel={composeEventHandlers(\n props.onPointerCancel,\n whenTouchOrPen(clearLongPress)\n )}\n onPointerUp={composeEventHandlers(props.onPointerUp, whenTouchOrPen(clearLongPress))}\n />\n </ContentProvider>\n );\n }\n);\n\nContextMenuTrigger.displayName = TRIGGER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'ContextMenuContent';\n\nconst [ContentProvider, useContentContext] = createContextMenuContext(CONTENT_NAME, {\n isInsideContent: false,\n});\n\ntype ContextMenuContentElement = React.ElementRef<typeof MenuPrimitive.Content>;\ntype MenuContentProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Content>;\ninterface ContextMenuContentProps extends Omit<MenuContentProps, 'portalled' | 'side' | 'align'> {}\n\nconst ContextMenuContent = React.forwardRef<ContextMenuContentElement, ContextMenuContentProps>(\n (props: ScopedProps<ContextMenuContentProps>, forwardedRef) => {\n const { __scopeContextMenu, ...contentProps } = props;\n const context = useContextMenuContext(CONTENT_NAME, __scopeContextMenu);\n const menuScope = useMenuScope(__scopeContextMenu);\n\n const commonProps = {\n ...contentProps,\n style: {\n ...props.style,\n // re-namespace exposed content custom property\n ['--radix-context-menu-content-transform-origin' as any]:\n 'var(--radix-popper-transform-origin)',\n },\n };\n\n return (\n <ContentProvider scope={__scopeContextMenu} isInsideContent={true}>\n {context.isRootMenu ? (\n <ContextMenuRootContent\n __scopeContextMenu={__scopeContextMenu}\n {...commonProps}\n ref={forwardedRef}\n />\n ) : (\n <MenuPrimitive.Content {...menuScope} {...commonProps} ref={forwardedRef} />\n )}\n </ContentProvider>\n );\n }\n);\n\nContextMenuContent.displayName = CONTENT_NAME;\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype ContextMenuRootContentElement = React.ElementRef<typeof MenuPrimitive.Content>;\ninterface ContextMenuRootContentProps extends ScopedProps<MenuContentProps> {}\n\nconst ContextMenuRootContent = React.forwardRef<\n ContextMenuRootContentElement,\n ContextMenuRootContentProps\n>((props, forwardedRef) => {\n const { __scopeContextMenu, ...contentProps } = props;\n const context = useContextMenuContext(CONTENT_NAME, __scopeContextMenu);\n const menuScope = useMenuScope(__scopeContextMenu);\n const hasInteractedOutsideRef = React.useRef(false);\n return (\n <MenuPrimitive.Content\n {...menuScope}\n {...contentProps}\n ref={forwardedRef}\n portalled\n side=\"right\"\n sideOffset={2}\n align=\"start\"\n onCloseAutoFocus={(event) => {\n props.onCloseAutoFocus?.(event);\n\n if (!event.defaultPrevented && hasInteractedOutsideRef.current) {\n event.preventDefault();\n }\n\n hasInteractedOutsideRef.current = false;\n }}\n onInteractOutside={(event) => {\n props.onInteractOutside?.(event);\n\n if (!event.defaultPrevented && !context.modal) hasInteractedOutsideRef.current = true;\n }}\n />\n );\n});\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuGroup\n * -----------------------------------------------------------------------------------------------*/\n\nconst GROUP_NAME = 'ContextMenuGroup';\n\ntype ContextMenuGroupElement = React.ElementRef<typeof MenuPrimitive.Group>;\ntype MenuGroupProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Group>;\ninterface ContextMenuGroupProps extends MenuGroupProps {}\n\nconst ContextMenuGroup = React.forwardRef<ContextMenuGroupElement, ContextMenuGroupProps>(\n (props: ScopedProps<ContextMenuGroupProps>, forwardedRef) => {\n const { __scopeContextMenu, ...groupProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.Group {...menuScope} {...groupProps} ref={forwardedRef} />;\n }\n);\n\nContextMenuGroup.displayName = GROUP_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuLabel\n * -----------------------------------------------------------------------------------------------*/\n\nconst LABEL_NAME = 'ContextMenuLabel';\n\ntype ContextMenuLabelElement = React.ElementRef<typeof MenuPrimitive.Label>;\ntype MenuLabelProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Label>;\ninterface ContextMenuLabelProps extends MenuLabelProps {}\n\nconst ContextMenuLabel = React.forwardRef<ContextMenuLabelElement, ContextMenuLabelProps>(\n (props: ScopedProps<ContextMenuLabelProps>, forwardedRef) => {\n const { __scopeContextMenu, ...labelProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.Label {...menuScope} {...labelProps} ref={forwardedRef} />;\n }\n);\n\nContextMenuLabel.displayName = LABEL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_NAME = 'ContextMenuItem';\n\ntype ContextMenuItemElement = React.ElementRef<typeof MenuPrimitive.Item>;\ntype MenuItemProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Item>;\ninterface ContextMenuItemProps extends MenuItemProps {}\n\nconst ContextMenuItem = React.forwardRef<ContextMenuItemElement, ContextMenuItemProps>(\n (props: ScopedProps<ContextMenuItemProps>, forwardedRef) => {\n const { __scopeContextMenu, ...itemProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.Item {...menuScope} {...itemProps} ref={forwardedRef} />;\n }\n);\n\nContextMenuItem.displayName = ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuTriggerItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_ITEM_NAME = 'ContextMenuTriggerItem';\n\ntype ContextMenuTriggerItemElement = React.ElementRef<typeof MenuPrimitive.SubTrigger>;\ntype MenuSubTriggerProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.SubTrigger>;\ninterface ContextMenuTriggerItemProps extends MenuSubTriggerProps {}\n\nconst ContextMenuTriggerItem = React.forwardRef<\n ContextMenuTriggerItemElement,\n ContextMenuTriggerItemProps\n>((props: ScopedProps<ContextMenuTriggerItemProps>, forwardedRef) => {\n const { __scopeContextMenu, ...triggerItemProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.SubTrigger {...menuScope} {...triggerItemProps} ref={forwardedRef} />;\n});\n\nContextMenuTriggerItem.displayName = TRIGGER_ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuCheckboxItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst CHECKBOX_ITEM_NAME = 'ContextMenuCheckboxItem';\n\ntype ContextMenuCheckboxItemElement = React.ElementRef<typeof MenuPrimitive.CheckboxItem>;\ntype MenuCheckboxItemProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.CheckboxItem>;\ninterface ContextMenuCheckboxItemProps extends MenuCheckboxItemProps {}\n\nconst ContextMenuCheckboxItem = React.forwardRef<\n ContextMenuCheckboxItemElement,\n ContextMenuCheckboxItemProps\n>((props: ScopedProps<ContextMenuCheckboxItemProps>, forwardedRef) => {\n const { __scopeContextMenu, ...checkboxItemProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.CheckboxItem {...menuScope} {...checkboxItemProps} ref={forwardedRef} />;\n});\n\nContextMenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuRadioGroup\n * -----------------------------------------------------------------------------------------------*/\n\nconst RADIO_GROUP_NAME = 'ContextMenuRadioGroup';\n\ntype ContextMenuRadioGroupElement = React.ElementRef<typeof MenuPrimitive.RadioGroup>;\ntype MenuRadioGroupProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.RadioGroup>;\ninterface ContextMenuRadioGroupProps extends MenuRadioGroupProps {}\n\nconst ContextMenuRadioGroup = React.forwardRef<\n ContextMenuRadioGroupElement,\n ContextMenuRadioGroupProps\n>((props: ScopedProps<ContextMenuRadioGroupProps>, forwardedRef) => {\n const { __scopeContextMenu, ...radioGroupProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.RadioGroup {...menuScope} {...radioGroupProps} ref={forwardedRef} />;\n});\n\nContextMenuRadioGroup.displayName = RADIO_GROUP_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuRadioItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst RADIO_ITEM_NAME = 'ContextMenuRadioItem';\n\ntype ContextMenuRadioItemElement = React.ElementRef<typeof MenuPrimitive.RadioItem>;\ntype MenuRadioItemProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.RadioItem>;\ninterface ContextMenuRadioItemProps extends MenuRadioItemProps {}\n\nconst ContextMenuRadioItem = React.forwardRef<\n ContextMenuRadioItemElement,\n ContextMenuRadioItemProps\n>((props: ScopedProps<ContextMenuRadioItemProps>, forwardedRef) => {\n const { __scopeContextMenu, ...radioItemProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.RadioItem {...menuScope} {...radioItemProps} ref={forwardedRef} />;\n});\n\nContextMenuRadioItem.displayName = RADIO_ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuItemIndicator\n * -----------------------------------------------------------------------------------------------*/\n\nconst INDICATOR_NAME = 'ContextMenuItemIndicator';\n\ntype ContextMenuItemIndicatorElement = React.ElementRef<typeof MenuPrimitive.ItemIndicator>;\ntype MenuItemIndicatorProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.ItemIndicator>;\ninterface ContextMenuItemIndicatorProps extends MenuItemIndicatorProps {}\n\nconst ContextMenuItemIndicator = React.forwardRef<\n ContextMenuItemIndicatorElement,\n ContextMenuItemIndicatorProps\n>((props: ScopedProps<ContextMenuItemIndicatorProps>, forwardedRef) => {\n const { __scopeContextMenu, ...itemIndicatorProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.ItemIndicator {...menuScope} {...itemIndicatorProps} ref={forwardedRef} />;\n});\n\nContextMenuItemIndicator.displayName = INDICATOR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuSeparator\n * -----------------------------------------------------------------------------------------------*/\n\nconst SEPARATOR_NAME = 'ContextMenuSeparator';\n\ntype ContextMenuSeparatorElement = React.ElementRef<typeof MenuPrimitive.Separator>;\ntype MenuSeparatorProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Separator>;\ninterface ContextMenuSeparatorProps extends MenuSeparatorProps {}\n\nconst ContextMenuSeparator = React.forwardRef<\n ContextMenuSeparatorElement,\n ContextMenuSeparatorProps\n>((props: ScopedProps<ContextMenuSeparatorProps>, forwardedRef) => {\n const { __scopeContextMenu, ...separatorProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.Separator {...menuScope} {...separatorProps} ref={forwardedRef} />;\n});\n\nContextMenuSeparator.displayName = SEPARATOR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuArrow\n * -----------------------------------------------------------------------------------------------*/\n\nconst ARROW_NAME = 'ContextMenuArrow';\n\ntype ContextMenuArrowElement = React.ElementRef<typeof MenuPrimitive.Arrow>;\ntype MenuArrowProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Arrow>;\ninterface ContextMenuArrowProps extends MenuArrowProps {}\n\nconst ContextMenuArrow = React.forwardRef<ContextMenuArrowElement, ContextMenuArrowProps>(\n (props: ScopedProps<ContextMenuArrowProps>, forwardedRef) => {\n const { __scopeContextMenu, ...arrowProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.Arrow {...menuScope} {...arrowProps} ref={forwardedRef} />;\n }\n);\n\nContextMenuArrow.displayName = ARROW_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction whenTouchOrPen<E>(handler: React.PointerEventHandler<E>): React.PointerEventHandler<E> {\n return (event) => (event.pointerType !== 'mouse' ? handler(event) : undefined);\n}\n\nconst Root = ContextMenu;\nconst Trigger = ContextMenuTrigger;\nconst Content = ContextMenuContent;\nconst Group = ContextMenuGroup;\nconst Label = ContextMenuLabel;\nconst Item = ContextMenuItem;\nconst TriggerItem = ContextMenuTriggerItem;\nconst CheckboxItem = ContextMenuCheckboxItem;\nconst RadioGroup = ContextMenuRadioGroup;\nconst RadioItem = ContextMenuRadioItem;\nconst ItemIndicator = ContextMenuItemIndicator;\nconst Separator = ContextMenuSeparator;\nconst Arrow = ContextMenuArrow;\n\nexport {\n createContextMenuScope,\n //\n ContextMenu,\n ContextMenuTrigger,\n ContextMenuContent,\n ContextMenuGroup,\n ContextMenuLabel,\n ContextMenuItem,\n ContextMenuTriggerItem,\n ContextMenuCheckboxItem,\n ContextMenuRadioGroup,\n ContextMenuRadioItem,\n ContextMenuItemIndicator,\n ContextMenuSeparator,\n ContextMenuArrow,\n //\n Root,\n Trigger,\n Content,\n Group,\n Label,\n Item,\n TriggerItem,\n CheckboxItem,\n RadioGroup,\n RadioItem,\n ItemIndicator,\n Separator,\n Arrow,\n};\nexport type {\n ContextMenuProps,\n ContextMenuTriggerProps,\n ContextMenuContentProps,\n ContextMenuGroupProps,\n ContextMenuLabelProps,\n ContextMenuItemProps,\n ContextMenuTriggerItemProps,\n ContextMenuCheckboxItemProps,\n ContextMenuRadioGroupProps,\n ContextMenuRadioItemProps,\n ContextMenuItemIndicatorProps,\n ContextMenuSeparatorProps,\n ContextMenuArrowProps,\n};\n"],"names":["a","__esModule","default","$parcel$exportWildcard","dest","source","Object","keys","forEach","key","defineProperty","enumerable","get","createContextMenuContext","createContextMenuScope","createContextScope","createMenuScope","useMenuScope","ContextMenuProvider","useContextMenuContext","ContextMenu","props","__scopeContextMenu","children","onOpenChange","dir","modal","open","setOpen","React","useState","contentContext","useContentContext","menuScope","handleOpenChangeProp","useCallbackRef","handleOpenChange","useCallback","isInsideContent","_react","createElement","$ffc34e43379ee114b0300eebc3d396c$var$ContextMenuProvider","scope","isRootMenu","_radixUiReactMenu","Sub","_babelRuntimeHelpersExtends","Root","ContextMenuTrigger","forwardRef","forwardedRef","triggerProps","context","pointRef","useRef","x","y","virtualRef","getBoundingClientRect","DOMRect","fromRect","width","height","current","longPressTimerRef","clearLongPress","window","clearTimeout","handleOpen","event","clientX","clientY","useEffect","$ffc34e43379ee114b0300eebc3d396c$var$ContentProvider","Anchor","Primitive","span","ref","style","WebkitTouchCallout","onContextMenu","composeEventHandlers","preventDefault","onPointerDown","whenTouchOrPen","setTimeout","onPointerMove","onPointerCancel","onPointerUp","ContentProvider","ContextMenuContent","contentProps","commonProps","$ffc34e43379ee114b0300eebc3d396c$var$ContextMenuRootContent","Content","ContextMenuRootContent","hasInteractedOutsideRef","portalled","side","sideOffset","align","onCloseAutoFocus","_props$onCloseAutoFoc","call","defaultPrevented","onInteractOutside","_props$onInteractOuts","ContextMenuGroup","groupProps","Group","ContextMenuLabel","labelProps","Label","ContextMenuItem","itemProps","Item","ContextMenuTriggerItem","triggerItemProps","SubTrigger","ContextMenuCheckboxItem","checkboxItemProps","CheckboxItem","ContextMenuRadioGroup","radioGroupProps","RadioGroup","ContextMenuRadioItem","radioItemProps","RadioItem","ContextMenuItemIndicator","itemIndicatorProps","ItemIndicator","ContextMenuSeparator","separatorProps","Separator","ContextMenuArrow","arrowProps","Arrow","handler","pointerType","undefined","Trigger","TriggerItem"],"version":3,"file":"index.js.map"}
|
|
1
|
+
{"mappings":"IAAgCA,0TAAAA,8CAClBA,EAAEC,WAAaD,EAAEE,QAAUF,EAWzC,SAASG,EAAuBC,EAAMC,GAcpC,OAbAC,OAAOC,KAAKF,GAAQG,SAAQ,SAASC,GACvB,YAARA,GAA6B,eAARA,GAIzBH,OAAOI,eAAeN,EAAMK,EAAK,CAC/BE,YAAY,EACZC,IAAK,WACH,OAAOP,EAAOI,SAKbL,ECRT,MAGOS,EAA0BC,GAA0BC,EAHjC,cAGuE,CAC/FC,qCAEF,MAAMC,EAAeD,KASdE,EAAqBC,GAC1BN,EAhBwB,eAyBpBO,EAA2CC,IAC/C,MAAMC,mBAAEA,EAAFC,SAAsBA,EAAtBC,aAAgCA,EAAhCC,IAA8CA,EAA9CC,MAAmDA,GAAQ,GAASL,GACnEM,EAAMC,GAAWC,EAAMC,UAAS,GACjCC,EAAiBC,EA5BC,cA4BoCV,GACtDW,EAAYhB,EAAaK,GACzBY,EAAuBC,EAAeX,GAEtCY,EAAmBP,EAAMQ,aAC5BV,IACCC,EAAQD,GACRO,EAAqBP,KAEvB,CAACO,IAGH,OAAOH,EAAeO,6BACpBC,EAAAC,cAACC,EAAD,CACEC,MAAOpB,EACPqB,YAAY,EACZhB,KAAMA,EACNH,aAAcY,EACdV,MAAOA,gBAEPa,EAAAC,cAACI,EAAcC,IAAfC,EAAA,GAAuBb,EAAvB,CAAkCN,KAAMA,EAAMH,aAAcY,IACzDb,iBAILgB,EAAAC,cAACC,EAAD,CACEC,MAAOpB,EACPqB,YAAY,EACZhB,KAAMA,EACNH,aAAcY,EACdV,MAAOA,gBAEPa,EAAAC,cAACI,EAAcG,KAAfD,EAAA,GACMb,EADN,CAEER,IAAK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BACnB,MAAMK,EAAYF,sBAClB,MAAMK,EAAgBF,0BACtB,MAAMK,EAAYF,sBAClB,MAAMK,EAAQF","sources":["./node_modules/@parcel/scope-hoisting/lib/helpers.js","./packages/react/context-menu/src/ContextMenu.tsx"],"sourcesContent":["function $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\n\nfunction $parcel$defineInteropFlag(a) {\n Object.defineProperty(a, '__esModule', {value: true});\n}\n\nfunction $parcel$reexport(e, n, v) {\n Object.defineProperty(e, n, {get: v, enumerable: true});\n}\n\nfunction $parcel$exportWildcard(dest, source) {\n Object.keys(source).forEach(function(key) {\n if (key === 'default' || key === '__esModule') {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function get() {\n return source[key];\n },\n });\n });\n\n return dest;\n}\n\nfunction $parcel$missingModule(name) {\n var err = new Error(\"Cannot find module '\" + name + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n}\n\nvar $parcel$global =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\n","import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport * as MenuPrimitive from '@radix-ui/react-menu';\nimport { createMenuScope } from '@radix-ui/react-menu';\nimport { useCallbackRef } from '@radix-ui/react-use-callback-ref';\n\nimport type * as Radix from '@radix-ui/react-primitive';\nimport type { Scope } from '@radix-ui/react-context';\n\ntype Direction = 'ltr' | 'rtl';\ntype Point = { x: number; y: number };\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenu\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTEXT_MENU_NAME = 'ContextMenu';\n\ntype ScopedProps<P> = P & { __scopeContextMenu?: Scope };\nconst [createContextMenuContext, createContextMenuScope] = createContextScope(CONTEXT_MENU_NAME, [\n createMenuScope,\n]);\nconst useMenuScope = createMenuScope();\n\ntype ContextMenuContextValue = {\n isRootMenu: boolean;\n open: boolean;\n onOpenChange(open: boolean): void;\n modal: boolean;\n};\n\nconst [ContextMenuProvider, useContextMenuContext] =\n createContextMenuContext<ContextMenuContextValue>(CONTEXT_MENU_NAME);\n\ninterface ContextMenuProps {\n children?: React.ReactNode;\n onOpenChange?(open: boolean): void;\n dir?: Direction;\n modal?: boolean;\n}\n\nconst ContextMenu: React.FC<ContextMenuProps> = (props: ScopedProps<ContextMenuProps>) => {\n const { __scopeContextMenu, children, onOpenChange, dir, modal = true } = props;\n const [open, setOpen] = React.useState(false);\n const contentContext = useContentContext(CONTEXT_MENU_NAME, __scopeContextMenu);\n const menuScope = useMenuScope(__scopeContextMenu);\n const handleOpenChangeProp = useCallbackRef(onOpenChange);\n\n const handleOpenChange = React.useCallback(\n (open: boolean) => {\n setOpen(open);\n handleOpenChangeProp(open);\n },\n [handleOpenChangeProp]\n );\n\n return contentContext.isInsideContent ? (\n <ContextMenuProvider\n scope={__scopeContextMenu}\n isRootMenu={false}\n open={open}\n onOpenChange={handleOpenChange}\n modal={modal}\n >\n <MenuPrimitive.Sub {...menuScope} open={open} onOpenChange={handleOpenChange}>\n {children}\n </MenuPrimitive.Sub>\n </ContextMenuProvider>\n ) : (\n <ContextMenuProvider\n scope={__scopeContextMenu}\n isRootMenu={true}\n open={open}\n onOpenChange={handleOpenChange}\n modal={modal}\n >\n <MenuPrimitive.Root\n {...menuScope}\n dir={dir}\n open={open}\n onOpenChange={handleOpenChange}\n modal={modal}\n >\n {children}\n </MenuPrimitive.Root>\n </ContextMenuProvider>\n );\n};\n\nContextMenu.displayName = CONTEXT_MENU_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'ContextMenuTrigger';\n\ntype ContextMenuTriggerElement = React.ElementRef<typeof Primitive.span>;\ntype PrimitiveSpanProps = Radix.ComponentPropsWithoutRef<typeof Primitive.span>;\ninterface ContextMenuTriggerProps extends PrimitiveSpanProps {}\n\nconst ContextMenuTrigger = React.forwardRef<ContextMenuTriggerElement, ContextMenuTriggerProps>(\n (props: ScopedProps<ContextMenuTriggerProps>, forwardedRef) => {\n const { __scopeContextMenu, ...triggerProps } = props;\n const context = useContextMenuContext(TRIGGER_NAME, __scopeContextMenu);\n const menuScope = useMenuScope(__scopeContextMenu);\n const pointRef = React.useRef<Point>({ x: 0, y: 0 });\n const virtualRef = React.useRef({\n getBoundingClientRect: () => DOMRect.fromRect({ width: 0, height: 0, ...pointRef.current }),\n });\n const longPressTimerRef = React.useRef(0);\n const clearLongPress = React.useCallback(\n () => window.clearTimeout(longPressTimerRef.current),\n []\n );\n const handleOpen = (event: React.MouseEvent | React.PointerEvent) => {\n pointRef.current = { x: event.clientX, y: event.clientY };\n context.onOpenChange(true);\n };\n\n React.useEffect(() => clearLongPress, [clearLongPress]);\n\n return (\n <ContentProvider scope={__scopeContextMenu} isInsideContent={false}>\n <MenuPrimitive.Anchor {...menuScope} virtualRef={virtualRef} />\n <Primitive.span\n {...triggerProps}\n ref={forwardedRef}\n // prevent iOS context menu from appearing\n style={{ WebkitTouchCallout: 'none', ...props.style }}\n onContextMenu={composeEventHandlers(props.onContextMenu, (event) => {\n // clearing the long press here because some platforms already support\n // long press to trigger a `contextmenu` event\n clearLongPress();\n event.preventDefault();\n handleOpen(event);\n })}\n onPointerDown={composeEventHandlers(\n props.onPointerDown,\n whenTouchOrPen((event) => {\n // clear the long press here in case there's multiple touch points\n clearLongPress();\n longPressTimerRef.current = window.setTimeout(() => handleOpen(event), 700);\n })\n )}\n onPointerMove={composeEventHandlers(props.onPointerMove, whenTouchOrPen(clearLongPress))}\n onPointerCancel={composeEventHandlers(\n props.onPointerCancel,\n whenTouchOrPen(clearLongPress)\n )}\n onPointerUp={composeEventHandlers(props.onPointerUp, whenTouchOrPen(clearLongPress))}\n />\n </ContentProvider>\n );\n }\n);\n\nContextMenuTrigger.displayName = TRIGGER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'ContextMenuContent';\n\nconst [ContentProvider, useContentContext] = createContextMenuContext(CONTENT_NAME, {\n isInsideContent: false,\n});\n\ntype ContextMenuContentElement = React.ElementRef<typeof MenuPrimitive.Content>;\ntype MenuContentProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Content>;\ninterface ContextMenuContentProps extends Omit<MenuContentProps, 'portalled' | 'side' | 'align'> {}\n\nconst ContextMenuContent = React.forwardRef<ContextMenuContentElement, ContextMenuContentProps>(\n (props: ScopedProps<ContextMenuContentProps>, forwardedRef) => {\n const { __scopeContextMenu, ...contentProps } = props;\n const context = useContextMenuContext(CONTENT_NAME, __scopeContextMenu);\n const menuScope = useMenuScope(__scopeContextMenu);\n\n const commonProps = {\n ...contentProps,\n style: {\n ...props.style,\n // re-namespace exposed content custom property\n ['--radix-context-menu-content-transform-origin' as any]:\n 'var(--radix-popper-transform-origin)',\n },\n };\n\n return (\n <ContentProvider scope={__scopeContextMenu} isInsideContent={true}>\n {context.isRootMenu ? (\n <ContextMenuRootContent\n __scopeContextMenu={__scopeContextMenu}\n {...commonProps}\n ref={forwardedRef}\n />\n ) : (\n <MenuPrimitive.Content {...menuScope} {...commonProps} ref={forwardedRef} />\n )}\n </ContentProvider>\n );\n }\n);\n\nContextMenuContent.displayName = CONTENT_NAME;\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype ContextMenuRootContentElement = React.ElementRef<typeof MenuPrimitive.Content>;\ninterface ContextMenuRootContentProps extends ScopedProps<MenuContentProps> {}\n\nconst ContextMenuRootContent = React.forwardRef<\n ContextMenuRootContentElement,\n ContextMenuRootContentProps\n>((props, forwardedRef) => {\n const { __scopeContextMenu, ...contentProps } = props;\n const context = useContextMenuContext(CONTENT_NAME, __scopeContextMenu);\n const menuScope = useMenuScope(__scopeContextMenu);\n const hasInteractedOutsideRef = React.useRef(false);\n return (\n <MenuPrimitive.Content\n {...menuScope}\n {...contentProps}\n ref={forwardedRef}\n portalled\n side=\"right\"\n sideOffset={2}\n align=\"start\"\n onCloseAutoFocus={(event) => {\n props.onCloseAutoFocus?.(event);\n\n if (!event.defaultPrevented && hasInteractedOutsideRef.current) {\n event.preventDefault();\n }\n\n hasInteractedOutsideRef.current = false;\n }}\n onInteractOutside={(event) => {\n props.onInteractOutside?.(event);\n\n if (!event.defaultPrevented && !context.modal) hasInteractedOutsideRef.current = true;\n }}\n />\n );\n});\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuGroup\n * -----------------------------------------------------------------------------------------------*/\n\nconst GROUP_NAME = 'ContextMenuGroup';\n\ntype ContextMenuGroupElement = React.ElementRef<typeof MenuPrimitive.Group>;\ntype MenuGroupProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Group>;\ninterface ContextMenuGroupProps extends MenuGroupProps {}\n\nconst ContextMenuGroup = React.forwardRef<ContextMenuGroupElement, ContextMenuGroupProps>(\n (props: ScopedProps<ContextMenuGroupProps>, forwardedRef) => {\n const { __scopeContextMenu, ...groupProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.Group {...menuScope} {...groupProps} ref={forwardedRef} />;\n }\n);\n\nContextMenuGroup.displayName = GROUP_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuLabel\n * -----------------------------------------------------------------------------------------------*/\n\nconst LABEL_NAME = 'ContextMenuLabel';\n\ntype ContextMenuLabelElement = React.ElementRef<typeof MenuPrimitive.Label>;\ntype MenuLabelProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Label>;\ninterface ContextMenuLabelProps extends MenuLabelProps {}\n\nconst ContextMenuLabel = React.forwardRef<ContextMenuLabelElement, ContextMenuLabelProps>(\n (props: ScopedProps<ContextMenuLabelProps>, forwardedRef) => {\n const { __scopeContextMenu, ...labelProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.Label {...menuScope} {...labelProps} ref={forwardedRef} />;\n }\n);\n\nContextMenuLabel.displayName = LABEL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_NAME = 'ContextMenuItem';\n\ntype ContextMenuItemElement = React.ElementRef<typeof MenuPrimitive.Item>;\ntype MenuItemProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Item>;\ninterface ContextMenuItemProps extends MenuItemProps {}\n\nconst ContextMenuItem = React.forwardRef<ContextMenuItemElement, ContextMenuItemProps>(\n (props: ScopedProps<ContextMenuItemProps>, forwardedRef) => {\n const { __scopeContextMenu, ...itemProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.Item {...menuScope} {...itemProps} ref={forwardedRef} />;\n }\n);\n\nContextMenuItem.displayName = ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuTriggerItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_ITEM_NAME = 'ContextMenuTriggerItem';\n\ntype ContextMenuTriggerItemElement = React.ElementRef<typeof MenuPrimitive.SubTrigger>;\ntype MenuSubTriggerProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.SubTrigger>;\ninterface ContextMenuTriggerItemProps extends MenuSubTriggerProps {}\n\nconst ContextMenuTriggerItem = React.forwardRef<\n ContextMenuTriggerItemElement,\n ContextMenuTriggerItemProps\n>((props: ScopedProps<ContextMenuTriggerItemProps>, forwardedRef) => {\n const { __scopeContextMenu, ...triggerItemProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.SubTrigger {...menuScope} {...triggerItemProps} ref={forwardedRef} />;\n});\n\nContextMenuTriggerItem.displayName = TRIGGER_ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuCheckboxItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst CHECKBOX_ITEM_NAME = 'ContextMenuCheckboxItem';\n\ntype ContextMenuCheckboxItemElement = React.ElementRef<typeof MenuPrimitive.CheckboxItem>;\ntype MenuCheckboxItemProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.CheckboxItem>;\ninterface ContextMenuCheckboxItemProps extends MenuCheckboxItemProps {}\n\nconst ContextMenuCheckboxItem = React.forwardRef<\n ContextMenuCheckboxItemElement,\n ContextMenuCheckboxItemProps\n>((props: ScopedProps<ContextMenuCheckboxItemProps>, forwardedRef) => {\n const { __scopeContextMenu, ...checkboxItemProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.CheckboxItem {...menuScope} {...checkboxItemProps} ref={forwardedRef} />;\n});\n\nContextMenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuRadioGroup\n * -----------------------------------------------------------------------------------------------*/\n\nconst RADIO_GROUP_NAME = 'ContextMenuRadioGroup';\n\ntype ContextMenuRadioGroupElement = React.ElementRef<typeof MenuPrimitive.RadioGroup>;\ntype MenuRadioGroupProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.RadioGroup>;\ninterface ContextMenuRadioGroupProps extends MenuRadioGroupProps {}\n\nconst ContextMenuRadioGroup = React.forwardRef<\n ContextMenuRadioGroupElement,\n ContextMenuRadioGroupProps\n>((props: ScopedProps<ContextMenuRadioGroupProps>, forwardedRef) => {\n const { __scopeContextMenu, ...radioGroupProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.RadioGroup {...menuScope} {...radioGroupProps} ref={forwardedRef} />;\n});\n\nContextMenuRadioGroup.displayName = RADIO_GROUP_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuRadioItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst RADIO_ITEM_NAME = 'ContextMenuRadioItem';\n\ntype ContextMenuRadioItemElement = React.ElementRef<typeof MenuPrimitive.RadioItem>;\ntype MenuRadioItemProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.RadioItem>;\ninterface ContextMenuRadioItemProps extends MenuRadioItemProps {}\n\nconst ContextMenuRadioItem = React.forwardRef<\n ContextMenuRadioItemElement,\n ContextMenuRadioItemProps\n>((props: ScopedProps<ContextMenuRadioItemProps>, forwardedRef) => {\n const { __scopeContextMenu, ...radioItemProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.RadioItem {...menuScope} {...radioItemProps} ref={forwardedRef} />;\n});\n\nContextMenuRadioItem.displayName = RADIO_ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuItemIndicator\n * -----------------------------------------------------------------------------------------------*/\n\nconst INDICATOR_NAME = 'ContextMenuItemIndicator';\n\ntype ContextMenuItemIndicatorElement = React.ElementRef<typeof MenuPrimitive.ItemIndicator>;\ntype MenuItemIndicatorProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.ItemIndicator>;\ninterface ContextMenuItemIndicatorProps extends MenuItemIndicatorProps {}\n\nconst ContextMenuItemIndicator = React.forwardRef<\n ContextMenuItemIndicatorElement,\n ContextMenuItemIndicatorProps\n>((props: ScopedProps<ContextMenuItemIndicatorProps>, forwardedRef) => {\n const { __scopeContextMenu, ...itemIndicatorProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.ItemIndicator {...menuScope} {...itemIndicatorProps} ref={forwardedRef} />;\n});\n\nContextMenuItemIndicator.displayName = INDICATOR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuSeparator\n * -----------------------------------------------------------------------------------------------*/\n\nconst SEPARATOR_NAME = 'ContextMenuSeparator';\n\ntype ContextMenuSeparatorElement = React.ElementRef<typeof MenuPrimitive.Separator>;\ntype MenuSeparatorProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Separator>;\ninterface ContextMenuSeparatorProps extends MenuSeparatorProps {}\n\nconst ContextMenuSeparator = React.forwardRef<\n ContextMenuSeparatorElement,\n ContextMenuSeparatorProps\n>((props: ScopedProps<ContextMenuSeparatorProps>, forwardedRef) => {\n const { __scopeContextMenu, ...separatorProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.Separator {...menuScope} {...separatorProps} ref={forwardedRef} />;\n});\n\nContextMenuSeparator.displayName = SEPARATOR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuArrow\n * -----------------------------------------------------------------------------------------------*/\n\nconst ARROW_NAME = 'ContextMenuArrow';\n\ntype ContextMenuArrowElement = React.ElementRef<typeof MenuPrimitive.Arrow>;\ntype MenuArrowProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Arrow>;\ninterface ContextMenuArrowProps extends MenuArrowProps {}\n\nconst ContextMenuArrow = React.forwardRef<ContextMenuArrowElement, ContextMenuArrowProps>(\n (props: ScopedProps<ContextMenuArrowProps>, forwardedRef) => {\n const { __scopeContextMenu, ...arrowProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.Arrow {...menuScope} {...arrowProps} ref={forwardedRef} />;\n }\n);\n\nContextMenuArrow.displayName = ARROW_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction whenTouchOrPen<E>(handler: React.PointerEventHandler<E>): React.PointerEventHandler<E> {\n return (event) => (event.pointerType !== 'mouse' ? handler(event) : undefined);\n}\n\nconst Root = ContextMenu;\nconst Trigger = ContextMenuTrigger;\nconst Content = ContextMenuContent;\nconst Group = ContextMenuGroup;\nconst Label = ContextMenuLabel;\nconst Item = ContextMenuItem;\nconst TriggerItem = ContextMenuTriggerItem;\nconst CheckboxItem = ContextMenuCheckboxItem;\nconst RadioGroup = ContextMenuRadioGroup;\nconst RadioItem = ContextMenuRadioItem;\nconst ItemIndicator = ContextMenuItemIndicator;\nconst Separator = ContextMenuSeparator;\nconst Arrow = ContextMenuArrow;\n\nexport {\n createContextMenuScope,\n //\n ContextMenu,\n ContextMenuTrigger,\n ContextMenuContent,\n ContextMenuGroup,\n ContextMenuLabel,\n ContextMenuItem,\n ContextMenuTriggerItem,\n ContextMenuCheckboxItem,\n ContextMenuRadioGroup,\n ContextMenuRadioItem,\n ContextMenuItemIndicator,\n ContextMenuSeparator,\n ContextMenuArrow,\n //\n Root,\n Trigger,\n Content,\n Group,\n Label,\n Item,\n TriggerItem,\n CheckboxItem,\n RadioGroup,\n RadioItem,\n ItemIndicator,\n Separator,\n Arrow,\n};\nexport type {\n ContextMenuProps,\n ContextMenuTriggerProps,\n ContextMenuContentProps,\n ContextMenuGroupProps,\n ContextMenuLabelProps,\n ContextMenuItemProps,\n ContextMenuTriggerItemProps,\n ContextMenuCheckboxItemProps,\n ContextMenuRadioGroupProps,\n ContextMenuRadioItemProps,\n ContextMenuItemIndicatorProps,\n ContextMenuSeparatorProps,\n ContextMenuArrowProps,\n};\n"],"names":["a","__esModule","default","$parcel$exportWildcard","dest","source","Object","keys","forEach","key","defineProperty","enumerable","get","createContextMenuContext","createContextMenuScope","createContextScope","createMenuScope","useMenuScope","ContextMenuProvider","useContextMenuContext","ContextMenu","props","__scopeContextMenu","children","onOpenChange","dir","modal","open","setOpen","React","useState","contentContext","useContentContext","menuScope","handleOpenChangeProp","useCallbackRef","handleOpenChange","useCallback","isInsideContent","_react","createElement","$ffc34e43379ee114b0300eebc3d396c$var$ContextMenuProvider","scope","isRootMenu","_radixUiReactMenu","Sub","_babelRuntimeHelpersExtends","Root","ContextMenuTrigger","forwardRef","forwardedRef","triggerProps","context","pointRef","useRef","x","y","virtualRef","getBoundingClientRect","DOMRect","fromRect","width","height","current","longPressTimerRef","clearLongPress","window","clearTimeout","handleOpen","event","clientX","clientY","useEffect","$ffc34e43379ee114b0300eebc3d396c$var$ContentProvider","Anchor","Primitive","span","ref","style","WebkitTouchCallout","onContextMenu","composeEventHandlers","preventDefault","onPointerDown","whenTouchOrPen","setTimeout","onPointerMove","onPointerCancel","onPointerUp","ContentProvider","ContextMenuContent","contentProps","commonProps","$ffc34e43379ee114b0300eebc3d396c$var$ContextMenuRootContent","Content","ContextMenuRootContent","hasInteractedOutsideRef","portalled","side","sideOffset","align","onCloseAutoFocus","_props$onCloseAutoFoc","call","defaultPrevented","onInteractOutside","_props$onInteractOuts","ContextMenuGroup","groupProps","Group","ContextMenuLabel","labelProps","Label","ContextMenuItem","itemProps","Item","ContextMenuTriggerItem","triggerItemProps","SubTrigger","ContextMenuCheckboxItem","checkboxItemProps","CheckboxItem","ContextMenuRadioGroup","radioGroupProps","RadioGroup","ContextMenuRadioItem","radioItemProps","RadioItem","ContextMenuItemIndicator","itemIndicatorProps","ItemIndicator","ContextMenuSeparator","separatorProps","Separator","ContextMenuArrow","arrowProps","Arrow","handler","pointerType","undefined","Trigger","TriggerItem"],"version":3,"file":"index.js.map"}
|
package/dist/index.module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"wZAkBA,MAGOA,EAA0BC,GAA0BC,EAHjC,cAGuE,CAC/FC,wCAEF,MAAMC,EAAeD,KASdE,EAAqBC,GAC1BN,EAhBwB,sBAyB1B,MAAMO,YAA2CC,IAC/C,MAAMC,mBAAEA,EAAFC,SAAsBA,EAAtBC,aAAgCA,EAAhCC,IAA8CA,EAA9CC,MAAmDA,GAAQ,GAASL,GACnEM,EAAMC,GAAWC,EAAMC,UAAS,GACjCC,EAAiBC,EA5BC,cA4BoCV,GACtDW,EAAYhB,EAAaK,GACzBY,EAAuBC,EAAeX,GAEtCY,EAAmBP,EAAMQ,aAC5BV,IACCC,EAAQD,GACRO,EAAqBP,KAEvB,CAACO,IAGH,OAAOH,EAAeO,6BACpBC,EAAAC,cAACC,EAAD,CACEC,MAAOpB,EACPqB,YAAY,EACZhB,KAAMA,EACNH,aAAcY,EACdV,MAAOA,gBAEPa,EAAAC,cAACI,EAAcC,IAAfC,EAAA,GAAuBb,EAAvB,CAAkCN,KAAMA,EAAMH,aAAcY,IACzDb,iBAILgB,EAAAC,cAACC,EAAD,CACE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,QAAU5F,0BAChB,MAAM8C,QAAUJ,0BAChB,MAAMmB,MAAQF,wBACd,MAAMK,MAAQF,wBACd,MAAMK,KAAOF,uBACb,MAAM4B,YAAczB,8BACpB,MAAMK,aAAeF,+BACrB,MAAMK,WAAaF,6BACnB,MAAMK,UAAYF,4BAClB,MAAMK,cAAgBF,gCACtB,MAAMK,UAAYF,4BAClB,MAAMK,MAAQF","sources":["./packages/react/context-menu/src/ContextMenu.tsx"],"sourcesContent":["import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport * as MenuPrimitive from '@radix-ui/react-menu';\nimport { createMenuScope } from '@radix-ui/react-menu';\nimport { useCallbackRef } from '@radix-ui/react-use-callback-ref';\n\nimport type * as Radix from '@radix-ui/react-primitive';\nimport type { Scope } from '@radix-ui/react-context';\n\ntype Direction = 'ltr' | 'rtl';\ntype Point = { x: number; y: number };\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenu\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTEXT_MENU_NAME = 'ContextMenu';\n\ntype ScopedProps<P> = P & { __scopeContextMenu?: Scope };\nconst [createContextMenuContext, createContextMenuScope] = createContextScope(CONTEXT_MENU_NAME, [\n createMenuScope,\n]);\nconst useMenuScope = createMenuScope();\n\ntype ContextMenuContextValue = {\n isRootMenu: boolean;\n open: boolean;\n onOpenChange(open: boolean): void;\n modal: boolean;\n};\n\nconst [ContextMenuProvider, useContextMenuContext] =\n createContextMenuContext<ContextMenuContextValue>(CONTEXT_MENU_NAME);\n\ninterface ContextMenuProps {\n onOpenChange?(open: boolean): void;\n dir?: Direction;\n modal?: boolean;\n children?: React.ReactNode;\n}\n\nconst ContextMenu: React.FC<ContextMenuProps> = (props: ScopedProps<ContextMenuProps>) => {\n const { __scopeContextMenu, children, onOpenChange, dir, modal = true } = props;\n const [open, setOpen] = React.useState(false);\n const contentContext = useContentContext(CONTEXT_MENU_NAME, __scopeContextMenu);\n const menuScope = useMenuScope(__scopeContextMenu);\n const handleOpenChangeProp = useCallbackRef(onOpenChange);\n\n const handleOpenChange = React.useCallback(\n (open) => {\n setOpen(open);\n handleOpenChangeProp(open);\n },\n [handleOpenChangeProp]\n );\n\n return contentContext.isInsideContent ? (\n <ContextMenuProvider\n scope={__scopeContextMenu}\n isRootMenu={false}\n open={open}\n onOpenChange={handleOpenChange}\n modal={modal}\n >\n <MenuPrimitive.Sub {...menuScope} open={open} onOpenChange={handleOpenChange}>\n {children}\n </MenuPrimitive.Sub>\n </ContextMenuProvider>\n ) : (\n <ContextMenuProvider\n scope={__scopeContextMenu}\n isRootMenu={true}\n open={open}\n onOpenChange={handleOpenChange}\n modal={modal}\n >\n <MenuPrimitive.Root\n {...menuScope}\n dir={dir}\n open={open}\n onOpenChange={handleOpenChange}\n modal={modal}\n >\n {children}\n </MenuPrimitive.Root>\n </ContextMenuProvider>\n );\n};\n\nContextMenu.displayName = CONTEXT_MENU_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'ContextMenuTrigger';\n\ntype ContextMenuTriggerElement = React.ElementRef<typeof Primitive.span>;\ntype PrimitiveSpanProps = Radix.ComponentPropsWithoutRef<typeof Primitive.span>;\ninterface ContextMenuTriggerProps extends PrimitiveSpanProps {}\n\nconst ContextMenuTrigger = React.forwardRef<ContextMenuTriggerElement, ContextMenuTriggerProps>(\n (props: ScopedProps<ContextMenuTriggerProps>, forwardedRef) => {\n const { __scopeContextMenu, ...triggerProps } = props;\n const context = useContextMenuContext(TRIGGER_NAME, __scopeContextMenu);\n const menuScope = useMenuScope(__scopeContextMenu);\n const pointRef = React.useRef<Point>({ x: 0, y: 0 });\n const virtualRef = React.useRef({\n getBoundingClientRect: () => DOMRect.fromRect({ width: 0, height: 0, ...pointRef.current }),\n });\n const longPressTimerRef = React.useRef(0);\n const clearLongPress = React.useCallback(\n () => window.clearTimeout(longPressTimerRef.current),\n []\n );\n const handleOpen = (event: React.MouseEvent | React.PointerEvent) => {\n pointRef.current = { x: event.clientX, y: event.clientY };\n context.onOpenChange(true);\n };\n\n React.useEffect(() => clearLongPress, [clearLongPress]);\n\n return (\n <ContentProvider scope={__scopeContextMenu} isInsideContent={false}>\n <MenuPrimitive.Anchor {...menuScope} virtualRef={virtualRef} />\n <Primitive.span\n {...triggerProps}\n ref={forwardedRef}\n // prevent iOS context menu from appearing\n style={{ WebkitTouchCallout: 'none', ...props.style }}\n onContextMenu={composeEventHandlers(props.onContextMenu, (event) => {\n // clearing the long press here because some platforms already support\n // long press to trigger a `contextmenu` event\n clearLongPress();\n event.preventDefault();\n handleOpen(event);\n })}\n onPointerDown={composeEventHandlers(\n props.onPointerDown,\n whenTouchOrPen((event) => {\n // clear the long press here in case there's multiple touch points\n clearLongPress();\n longPressTimerRef.current = window.setTimeout(() => handleOpen(event), 700);\n })\n )}\n onPointerMove={composeEventHandlers(props.onPointerMove, whenTouchOrPen(clearLongPress))}\n onPointerCancel={composeEventHandlers(\n props.onPointerCancel,\n whenTouchOrPen(clearLongPress)\n )}\n onPointerUp={composeEventHandlers(props.onPointerUp, whenTouchOrPen(clearLongPress))}\n />\n </ContentProvider>\n );\n }\n);\n\nContextMenuTrigger.displayName = TRIGGER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'ContextMenuContent';\n\nconst [ContentProvider, useContentContext] = createContextMenuContext(CONTENT_NAME, {\n isInsideContent: false,\n});\n\ntype ContextMenuContentElement = React.ElementRef<typeof MenuPrimitive.Content>;\ntype MenuContentProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Content>;\ninterface ContextMenuContentProps extends Omit<MenuContentProps, 'portalled' | 'side' | 'align'> {}\n\nconst ContextMenuContent = React.forwardRef<ContextMenuContentElement, ContextMenuContentProps>(\n (props: ScopedProps<ContextMenuContentProps>, forwardedRef) => {\n const { __scopeContextMenu, ...contentProps } = props;\n const context = useContextMenuContext(CONTENT_NAME, __scopeContextMenu);\n const menuScope = useMenuScope(__scopeContextMenu);\n\n const commonProps = {\n ...contentProps,\n style: {\n ...props.style,\n // re-namespace exposed content custom property\n ['--radix-context-menu-content-transform-origin' as any]:\n 'var(--radix-popper-transform-origin)',\n },\n };\n\n return (\n <ContentProvider scope={__scopeContextMenu} isInsideContent={true}>\n {context.isRootMenu ? (\n <ContextMenuRootContent\n __scopeContextMenu={__scopeContextMenu}\n {...commonProps}\n ref={forwardedRef}\n />\n ) : (\n <MenuPrimitive.Content {...menuScope} {...commonProps} ref={forwardedRef} />\n )}\n </ContentProvider>\n );\n }\n);\n\nContextMenuContent.displayName = CONTENT_NAME;\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype ContextMenuRootContentElement = React.ElementRef<typeof MenuPrimitive.Content>;\ninterface ContextMenuRootContentProps extends ScopedProps<MenuContentProps> {}\n\nconst ContextMenuRootContent = React.forwardRef<\n ContextMenuRootContentElement,\n ContextMenuRootContentProps\n>((props, forwardedRef) => {\n const { __scopeContextMenu, ...contentProps } = props;\n const context = useContextMenuContext(CONTENT_NAME, __scopeContextMenu);\n const menuScope = useMenuScope(__scopeContextMenu);\n const hasInteractedOutsideRef = React.useRef(false);\n return (\n <MenuPrimitive.Content\n {...menuScope}\n {...contentProps}\n ref={forwardedRef}\n portalled\n side=\"right\"\n sideOffset={2}\n align=\"start\"\n onCloseAutoFocus={(event) => {\n props.onCloseAutoFocus?.(event);\n\n if (!event.defaultPrevented && hasInteractedOutsideRef.current) {\n event.preventDefault();\n }\n\n hasInteractedOutsideRef.current = false;\n }}\n onInteractOutside={(event) => {\n props.onInteractOutside?.(event);\n\n if (!event.defaultPrevented && !context.modal) hasInteractedOutsideRef.current = true;\n }}\n />\n );\n});\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuGroup\n * -----------------------------------------------------------------------------------------------*/\n\nconst GROUP_NAME = 'ContextMenuGroup';\n\ntype ContextMenuGroupElement = React.ElementRef<typeof MenuPrimitive.Group>;\ntype MenuGroupProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Group>;\ninterface ContextMenuGroupProps extends MenuGroupProps {}\n\nconst ContextMenuGroup = React.forwardRef<ContextMenuGroupElement, ContextMenuGroupProps>(\n (props: ScopedProps<ContextMenuGroupProps>, forwardedRef) => {\n const { __scopeContextMenu, ...groupProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.Group {...menuScope} {...groupProps} ref={forwardedRef} />;\n }\n);\n\nContextMenuGroup.displayName = GROUP_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuLabel\n * -----------------------------------------------------------------------------------------------*/\n\nconst LABEL_NAME = 'ContextMenuLabel';\n\ntype ContextMenuLabelElement = React.ElementRef<typeof MenuPrimitive.Label>;\ntype MenuLabelProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Label>;\ninterface ContextMenuLabelProps extends MenuLabelProps {}\n\nconst ContextMenuLabel = React.forwardRef<ContextMenuLabelElement, ContextMenuLabelProps>(\n (props: ScopedProps<ContextMenuLabelProps>, forwardedRef) => {\n const { __scopeContextMenu, ...labelProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.Label {...menuScope} {...labelProps} ref={forwardedRef} />;\n }\n);\n\nContextMenuLabel.displayName = LABEL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_NAME = 'ContextMenuItem';\n\ntype ContextMenuItemElement = React.ElementRef<typeof MenuPrimitive.Item>;\ntype MenuItemProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Item>;\ninterface ContextMenuItemProps extends MenuItemProps {}\n\nconst ContextMenuItem = React.forwardRef<ContextMenuItemElement, ContextMenuItemProps>(\n (props: ScopedProps<ContextMenuItemProps>, forwardedRef) => {\n const { __scopeContextMenu, ...itemProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.Item {...menuScope} {...itemProps} ref={forwardedRef} />;\n }\n);\n\nContextMenuItem.displayName = ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuTriggerItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_ITEM_NAME = 'ContextMenuTriggerItem';\n\ntype ContextMenuTriggerItemElement = React.ElementRef<typeof MenuPrimitive.SubTrigger>;\ntype MenuSubTriggerProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.SubTrigger>;\ninterface ContextMenuTriggerItemProps extends MenuSubTriggerProps {}\n\nconst ContextMenuTriggerItem = React.forwardRef<\n ContextMenuTriggerItemElement,\n ContextMenuTriggerItemProps\n>((props: ScopedProps<ContextMenuTriggerItemProps>, forwardedRef) => {\n const { __scopeContextMenu, ...triggerItemProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.SubTrigger {...menuScope} {...triggerItemProps} ref={forwardedRef} />;\n});\n\nContextMenuTriggerItem.displayName = TRIGGER_ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuCheckboxItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst CHECKBOX_ITEM_NAME = 'ContextMenuCheckboxItem';\n\ntype ContextMenuCheckboxItemElement = React.ElementRef<typeof MenuPrimitive.CheckboxItem>;\ntype MenuCheckboxItemProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.CheckboxItem>;\ninterface ContextMenuCheckboxItemProps extends MenuCheckboxItemProps {}\n\nconst ContextMenuCheckboxItem = React.forwardRef<\n ContextMenuCheckboxItemElement,\n ContextMenuCheckboxItemProps\n>((props: ScopedProps<ContextMenuCheckboxItemProps>, forwardedRef) => {\n const { __scopeContextMenu, ...checkboxItemProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.CheckboxItem {...menuScope} {...checkboxItemProps} ref={forwardedRef} />;\n});\n\nContextMenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuRadioGroup\n * -----------------------------------------------------------------------------------------------*/\n\nconst RADIO_GROUP_NAME = 'ContextMenuRadioGroup';\n\ntype ContextMenuRadioGroupElement = React.ElementRef<typeof MenuPrimitive.RadioGroup>;\ntype MenuRadioGroupProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.RadioGroup>;\ninterface ContextMenuRadioGroupProps extends MenuRadioGroupProps {}\n\nconst ContextMenuRadioGroup = React.forwardRef<\n ContextMenuRadioGroupElement,\n ContextMenuRadioGroupProps\n>((props: ScopedProps<ContextMenuRadioGroupProps>, forwardedRef) => {\n const { __scopeContextMenu, ...radioGroupProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.RadioGroup {...menuScope} {...radioGroupProps} ref={forwardedRef} />;\n});\n\nContextMenuRadioGroup.displayName = RADIO_GROUP_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuRadioItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst RADIO_ITEM_NAME = 'ContextMenuRadioItem';\n\ntype ContextMenuRadioItemElement = React.ElementRef<typeof MenuPrimitive.RadioItem>;\ntype MenuRadioItemProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.RadioItem>;\ninterface ContextMenuRadioItemProps extends MenuRadioItemProps {}\n\nconst ContextMenuRadioItem = React.forwardRef<\n ContextMenuRadioItemElement,\n ContextMenuRadioItemProps\n>((props: ScopedProps<ContextMenuRadioItemProps>, forwardedRef) => {\n const { __scopeContextMenu, ...radioItemProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.RadioItem {...menuScope} {...radioItemProps} ref={forwardedRef} />;\n});\n\nContextMenuRadioItem.displayName = RADIO_ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuItemIndicator\n * -----------------------------------------------------------------------------------------------*/\n\nconst INDICATOR_NAME = 'ContextMenuItemIndicator';\n\ntype ContextMenuItemIndicatorElement = React.ElementRef<typeof MenuPrimitive.ItemIndicator>;\ntype MenuItemIndicatorProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.ItemIndicator>;\ninterface ContextMenuItemIndicatorProps extends MenuItemIndicatorProps {}\n\nconst ContextMenuItemIndicator = React.forwardRef<\n ContextMenuItemIndicatorElement,\n ContextMenuItemIndicatorProps\n>((props: ScopedProps<ContextMenuItemIndicatorProps>, forwardedRef) => {\n const { __scopeContextMenu, ...itemIndicatorProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.ItemIndicator {...menuScope} {...itemIndicatorProps} ref={forwardedRef} />;\n});\n\nContextMenuItemIndicator.displayName = INDICATOR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuSeparator\n * -----------------------------------------------------------------------------------------------*/\n\nconst SEPARATOR_NAME = 'ContextMenuSeparator';\n\ntype ContextMenuSeparatorElement = React.ElementRef<typeof MenuPrimitive.Separator>;\ntype MenuSeparatorProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Separator>;\ninterface ContextMenuSeparatorProps extends MenuSeparatorProps {}\n\nconst ContextMenuSeparator = React.forwardRef<\n ContextMenuSeparatorElement,\n ContextMenuSeparatorProps\n>((props: ScopedProps<ContextMenuSeparatorProps>, forwardedRef) => {\n const { __scopeContextMenu, ...separatorProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.Separator {...menuScope} {...separatorProps} ref={forwardedRef} />;\n});\n\nContextMenuSeparator.displayName = SEPARATOR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuArrow\n * -----------------------------------------------------------------------------------------------*/\n\nconst ARROW_NAME = 'ContextMenuArrow';\n\ntype ContextMenuArrowElement = React.ElementRef<typeof MenuPrimitive.Arrow>;\ntype MenuArrowProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Arrow>;\ninterface ContextMenuArrowProps extends MenuArrowProps {}\n\nconst ContextMenuArrow = React.forwardRef<ContextMenuArrowElement, ContextMenuArrowProps>(\n (props: ScopedProps<ContextMenuArrowProps>, forwardedRef) => {\n const { __scopeContextMenu, ...arrowProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.Arrow {...menuScope} {...arrowProps} ref={forwardedRef} />;\n }\n);\n\nContextMenuArrow.displayName = ARROW_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction whenTouchOrPen<E>(handler: React.PointerEventHandler<E>): React.PointerEventHandler<E> {\n return (event) => (event.pointerType !== 'mouse' ? handler(event) : undefined);\n}\n\nconst Root = ContextMenu;\nconst Trigger = ContextMenuTrigger;\nconst Content = ContextMenuContent;\nconst Group = ContextMenuGroup;\nconst Label = ContextMenuLabel;\nconst Item = ContextMenuItem;\nconst TriggerItem = ContextMenuTriggerItem;\nconst CheckboxItem = ContextMenuCheckboxItem;\nconst RadioGroup = ContextMenuRadioGroup;\nconst RadioItem = ContextMenuRadioItem;\nconst ItemIndicator = ContextMenuItemIndicator;\nconst Separator = ContextMenuSeparator;\nconst Arrow = ContextMenuArrow;\n\nexport {\n createContextMenuScope,\n //\n ContextMenu,\n ContextMenuTrigger,\n ContextMenuContent,\n ContextMenuGroup,\n ContextMenuLabel,\n ContextMenuItem,\n ContextMenuTriggerItem,\n ContextMenuCheckboxItem,\n ContextMenuRadioGroup,\n ContextMenuRadioItem,\n ContextMenuItemIndicator,\n ContextMenuSeparator,\n ContextMenuArrow,\n //\n Root,\n Trigger,\n Content,\n Group,\n Label,\n Item,\n TriggerItem,\n CheckboxItem,\n RadioGroup,\n RadioItem,\n ItemIndicator,\n Separator,\n Arrow,\n};\nexport type {\n ContextMenuProps,\n ContextMenuTriggerProps,\n ContextMenuContentProps,\n ContextMenuGroupProps,\n ContextMenuLabelProps,\n ContextMenuItemProps,\n ContextMenuTriggerItemProps,\n ContextMenuCheckboxItemProps,\n ContextMenuRadioGroupProps,\n ContextMenuRadioItemProps,\n ContextMenuItemIndicatorProps,\n ContextMenuSeparatorProps,\n ContextMenuArrowProps,\n};\n"],"names":["createContextMenuContext","createContextMenuScope","createContextScope","createMenuScope","useMenuScope","ContextMenuProvider","useContextMenuContext","ContextMenu","props","__scopeContextMenu","children","onOpenChange","dir","modal","open","setOpen","React","useState","contentContext","useContentContext","menuScope","handleOpenChangeProp","useCallbackRef","handleOpenChange","useCallback","isInsideContent","_react","createElement","$b55f3d34bcc87b2d9b0bc87c90588a09$var$ContextMenuProvider","scope","isRootMenu","_radixUiReactMenu","Sub","_babelRuntimeHelpersEsmExtends","Root","ContextMenuTrigger","forwardRef","forwardedRef","triggerProps","context","pointRef","useRef","x","y","virtualRef","getBoundingClientRect","DOMRect","fromRect","width","height","current","longPressTimerRef","clearLongPress","window","clearTimeout","handleOpen","event","clientX","clientY","useEffect","$b55f3d34bcc87b2d9b0bc87c90588a09$var$ContentProvider","Anchor","Primitive","span","ref","style","WebkitTouchCallout","onContextMenu","composeEventHandlers","preventDefault","onPointerDown","whenTouchOrPen","setTimeout","onPointerMove","onPointerCancel","onPointerUp","ContentProvider","ContextMenuContent","contentProps","commonProps","$b55f3d34bcc87b2d9b0bc87c90588a09$var$ContextMenuRootContent","Content","ContextMenuRootContent","hasInteractedOutsideRef","portalled","side","sideOffset","align","onCloseAutoFocus","_props$onCloseAutoFoc","call","defaultPrevented","onInteractOutside","_props$onInteractOuts","ContextMenuGroup","groupProps","Group","ContextMenuLabel","labelProps","Label","ContextMenuItem","itemProps","Item","ContextMenuTriggerItem","triggerItemProps","SubTrigger","ContextMenuCheckboxItem","checkboxItemProps","CheckboxItem","ContextMenuRadioGroup","radioGroupProps","RadioGroup","ContextMenuRadioItem","radioItemProps","RadioItem","ContextMenuItemIndicator","itemIndicatorProps","ItemIndicator","ContextMenuSeparator","separatorProps","Separator","ContextMenuArrow","arrowProps","Arrow","handler","pointerType","undefined","Trigger","T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MAAM5B,mBAAEA,KAAuB2G,GAAuB5G,EAChDY,EAAYhB,EAAaK,gBAC/B,OAAOiB,EAAAC,cAACI,EAAcsF,cAAfpF,EAAA,GAAiCb,EAAegG,EAAhD,CAAoEpD,IAAK3B,4BAelF,MAAMiF,kCAAuBtG,EAAMoB,YAGjC,CAAC5B,EAA+C6B,KAChD,MAAM5B,mBAAEA,KAAuB8G,GAAmB/G,EAC5CY,EAAYhB,EAAaK,gBAC/B,OAAOiB,EAAAC,cAACI,EAAcyF,UAAfvF,EAAA,GAA6Bb,EAAemG,EAA5C,CAA4DvD,IAAK3B,4BAe1E,MAAMoF,8BAAmBzG,EAAMoB,YAC7B,CAAC5B,EAA2C6B,KAC1C,MAAM5B,mBAAEA,KAAuBiH,GAAelH,EACxCY,EAAYhB,EAAaK,gBAC/B,OAAOiB,EAAAC,cAACI,EAAc4F,MAAf1F,EAAA,GAAyBb,EAAesG,EAAxC,CAAoD1D,IAAK3B,qBAQpE,SAASkC,EAAkBqD,GACzB,OAAQpE,GAAiC,UAAtBA,EAAMqE,YAA0BD,EAAQpE,QAASsE,SAGtE,MAAM5F,KAAO3B,mBACb,MAAMwH,QAAU5F,0BAChB,MAAM8C,QAAUJ,0BAChB,MAAMmB,MAAQF,wBACd,MAAMK,MAAQF,wBACd,MAAMK,KAAOF,uBACb,MAAM4B,YAAczB,8BACpB,MAAMK,aAAeF,+BACrB,MAAMK,WAAaF,6BACnB,MAAMK,UAAYF,4BAClB,MAAMK,cAAgBF,gCACtB,MAAMK,UAAYF,4BAClB,MAAMK,MAAQF","sources":["./packages/react/context-menu/src/ContextMenu.tsx"],"sourcesContent":["import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport * as MenuPrimitive from '@radix-ui/react-menu';\nimport { createMenuScope } from '@radix-ui/react-menu';\nimport { useCallbackRef } from '@radix-ui/react-use-callback-ref';\n\nimport type * as Radix from '@radix-ui/react-primitive';\nimport type { Scope } from '@radix-ui/react-context';\n\ntype Direction = 'ltr' | 'rtl';\ntype Point = { x: number; y: number };\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenu\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTEXT_MENU_NAME = 'ContextMenu';\n\ntype ScopedProps<P> = P & { __scopeContextMenu?: Scope };\nconst [createContextMenuContext, createContextMenuScope] = createContextScope(CONTEXT_MENU_NAME, [\n createMenuScope,\n]);\nconst useMenuScope = createMenuScope();\n\ntype ContextMenuContextValue = {\n isRootMenu: boolean;\n open: boolean;\n onOpenChange(open: boolean): void;\n modal: boolean;\n};\n\nconst [ContextMenuProvider, useContextMenuContext] =\n createContextMenuContext<ContextMenuContextValue>(CONTEXT_MENU_NAME);\n\ninterface ContextMenuProps {\n children?: React.ReactNode;\n onOpenChange?(open: boolean): void;\n dir?: Direction;\n modal?: boolean;\n}\n\nconst ContextMenu: React.FC<ContextMenuProps> = (props: ScopedProps<ContextMenuProps>) => {\n const { __scopeContextMenu, children, onOpenChange, dir, modal = true } = props;\n const [open, setOpen] = React.useState(false);\n const contentContext = useContentContext(CONTEXT_MENU_NAME, __scopeContextMenu);\n const menuScope = useMenuScope(__scopeContextMenu);\n const handleOpenChangeProp = useCallbackRef(onOpenChange);\n\n const handleOpenChange = React.useCallback(\n (open: boolean) => {\n setOpen(open);\n handleOpenChangeProp(open);\n },\n [handleOpenChangeProp]\n );\n\n return contentContext.isInsideContent ? (\n <ContextMenuProvider\n scope={__scopeContextMenu}\n isRootMenu={false}\n open={open}\n onOpenChange={handleOpenChange}\n modal={modal}\n >\n <MenuPrimitive.Sub {...menuScope} open={open} onOpenChange={handleOpenChange}>\n {children}\n </MenuPrimitive.Sub>\n </ContextMenuProvider>\n ) : (\n <ContextMenuProvider\n scope={__scopeContextMenu}\n isRootMenu={true}\n open={open}\n onOpenChange={handleOpenChange}\n modal={modal}\n >\n <MenuPrimitive.Root\n {...menuScope}\n dir={dir}\n open={open}\n onOpenChange={handleOpenChange}\n modal={modal}\n >\n {children}\n </MenuPrimitive.Root>\n </ContextMenuProvider>\n );\n};\n\nContextMenu.displayName = CONTEXT_MENU_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'ContextMenuTrigger';\n\ntype ContextMenuTriggerElement = React.ElementRef<typeof Primitive.span>;\ntype PrimitiveSpanProps = Radix.ComponentPropsWithoutRef<typeof Primitive.span>;\ninterface ContextMenuTriggerProps extends PrimitiveSpanProps {}\n\nconst ContextMenuTrigger = React.forwardRef<ContextMenuTriggerElement, ContextMenuTriggerProps>(\n (props: ScopedProps<ContextMenuTriggerProps>, forwardedRef) => {\n const { __scopeContextMenu, ...triggerProps } = props;\n const context = useContextMenuContext(TRIGGER_NAME, __scopeContextMenu);\n const menuScope = useMenuScope(__scopeContextMenu);\n const pointRef = React.useRef<Point>({ x: 0, y: 0 });\n const virtualRef = React.useRef({\n getBoundingClientRect: () => DOMRect.fromRect({ width: 0, height: 0, ...pointRef.current }),\n });\n const longPressTimerRef = React.useRef(0);\n const clearLongPress = React.useCallback(\n () => window.clearTimeout(longPressTimerRef.current),\n []\n );\n const handleOpen = (event: React.MouseEvent | React.PointerEvent) => {\n pointRef.current = { x: event.clientX, y: event.clientY };\n context.onOpenChange(true);\n };\n\n React.useEffect(() => clearLongPress, [clearLongPress]);\n\n return (\n <ContentProvider scope={__scopeContextMenu} isInsideContent={false}>\n <MenuPrimitive.Anchor {...menuScope} virtualRef={virtualRef} />\n <Primitive.span\n {...triggerProps}\n ref={forwardedRef}\n // prevent iOS context menu from appearing\n style={{ WebkitTouchCallout: 'none', ...props.style }}\n onContextMenu={composeEventHandlers(props.onContextMenu, (event) => {\n // clearing the long press here because some platforms already support\n // long press to trigger a `contextmenu` event\n clearLongPress();\n event.preventDefault();\n handleOpen(event);\n })}\n onPointerDown={composeEventHandlers(\n props.onPointerDown,\n whenTouchOrPen((event) => {\n // clear the long press here in case there's multiple touch points\n clearLongPress();\n longPressTimerRef.current = window.setTimeout(() => handleOpen(event), 700);\n })\n )}\n onPointerMove={composeEventHandlers(props.onPointerMove, whenTouchOrPen(clearLongPress))}\n onPointerCancel={composeEventHandlers(\n props.onPointerCancel,\n whenTouchOrPen(clearLongPress)\n )}\n onPointerUp={composeEventHandlers(props.onPointerUp, whenTouchOrPen(clearLongPress))}\n />\n </ContentProvider>\n );\n }\n);\n\nContextMenuTrigger.displayName = TRIGGER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'ContextMenuContent';\n\nconst [ContentProvider, useContentContext] = createContextMenuContext(CONTENT_NAME, {\n isInsideContent: false,\n});\n\ntype ContextMenuContentElement = React.ElementRef<typeof MenuPrimitive.Content>;\ntype MenuContentProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Content>;\ninterface ContextMenuContentProps extends Omit<MenuContentProps, 'portalled' | 'side' | 'align'> {}\n\nconst ContextMenuContent = React.forwardRef<ContextMenuContentElement, ContextMenuContentProps>(\n (props: ScopedProps<ContextMenuContentProps>, forwardedRef) => {\n const { __scopeContextMenu, ...contentProps } = props;\n const context = useContextMenuContext(CONTENT_NAME, __scopeContextMenu);\n const menuScope = useMenuScope(__scopeContextMenu);\n\n const commonProps = {\n ...contentProps,\n style: {\n ...props.style,\n // re-namespace exposed content custom property\n ['--radix-context-menu-content-transform-origin' as any]:\n 'var(--radix-popper-transform-origin)',\n },\n };\n\n return (\n <ContentProvider scope={__scopeContextMenu} isInsideContent={true}>\n {context.isRootMenu ? (\n <ContextMenuRootContent\n __scopeContextMenu={__scopeContextMenu}\n {...commonProps}\n ref={forwardedRef}\n />\n ) : (\n <MenuPrimitive.Content {...menuScope} {...commonProps} ref={forwardedRef} />\n )}\n </ContentProvider>\n );\n }\n);\n\nContextMenuContent.displayName = CONTENT_NAME;\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype ContextMenuRootContentElement = React.ElementRef<typeof MenuPrimitive.Content>;\ninterface ContextMenuRootContentProps extends ScopedProps<MenuContentProps> {}\n\nconst ContextMenuRootContent = React.forwardRef<\n ContextMenuRootContentElement,\n ContextMenuRootContentProps\n>((props, forwardedRef) => {\n const { __scopeContextMenu, ...contentProps } = props;\n const context = useContextMenuContext(CONTENT_NAME, __scopeContextMenu);\n const menuScope = useMenuScope(__scopeContextMenu);\n const hasInteractedOutsideRef = React.useRef(false);\n return (\n <MenuPrimitive.Content\n {...menuScope}\n {...contentProps}\n ref={forwardedRef}\n portalled\n side=\"right\"\n sideOffset={2}\n align=\"start\"\n onCloseAutoFocus={(event) => {\n props.onCloseAutoFocus?.(event);\n\n if (!event.defaultPrevented && hasInteractedOutsideRef.current) {\n event.preventDefault();\n }\n\n hasInteractedOutsideRef.current = false;\n }}\n onInteractOutside={(event) => {\n props.onInteractOutside?.(event);\n\n if (!event.defaultPrevented && !context.modal) hasInteractedOutsideRef.current = true;\n }}\n />\n );\n});\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuGroup\n * -----------------------------------------------------------------------------------------------*/\n\nconst GROUP_NAME = 'ContextMenuGroup';\n\ntype ContextMenuGroupElement = React.ElementRef<typeof MenuPrimitive.Group>;\ntype MenuGroupProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Group>;\ninterface ContextMenuGroupProps extends MenuGroupProps {}\n\nconst ContextMenuGroup = React.forwardRef<ContextMenuGroupElement, ContextMenuGroupProps>(\n (props: ScopedProps<ContextMenuGroupProps>, forwardedRef) => {\n const { __scopeContextMenu, ...groupProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.Group {...menuScope} {...groupProps} ref={forwardedRef} />;\n }\n);\n\nContextMenuGroup.displayName = GROUP_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuLabel\n * -----------------------------------------------------------------------------------------------*/\n\nconst LABEL_NAME = 'ContextMenuLabel';\n\ntype ContextMenuLabelElement = React.ElementRef<typeof MenuPrimitive.Label>;\ntype MenuLabelProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Label>;\ninterface ContextMenuLabelProps extends MenuLabelProps {}\n\nconst ContextMenuLabel = React.forwardRef<ContextMenuLabelElement, ContextMenuLabelProps>(\n (props: ScopedProps<ContextMenuLabelProps>, forwardedRef) => {\n const { __scopeContextMenu, ...labelProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.Label {...menuScope} {...labelProps} ref={forwardedRef} />;\n }\n);\n\nContextMenuLabel.displayName = LABEL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_NAME = 'ContextMenuItem';\n\ntype ContextMenuItemElement = React.ElementRef<typeof MenuPrimitive.Item>;\ntype MenuItemProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Item>;\ninterface ContextMenuItemProps extends MenuItemProps {}\n\nconst ContextMenuItem = React.forwardRef<ContextMenuItemElement, ContextMenuItemProps>(\n (props: ScopedProps<ContextMenuItemProps>, forwardedRef) => {\n const { __scopeContextMenu, ...itemProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.Item {...menuScope} {...itemProps} ref={forwardedRef} />;\n }\n);\n\nContextMenuItem.displayName = ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuTriggerItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_ITEM_NAME = 'ContextMenuTriggerItem';\n\ntype ContextMenuTriggerItemElement = React.ElementRef<typeof MenuPrimitive.SubTrigger>;\ntype MenuSubTriggerProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.SubTrigger>;\ninterface ContextMenuTriggerItemProps extends MenuSubTriggerProps {}\n\nconst ContextMenuTriggerItem = React.forwardRef<\n ContextMenuTriggerItemElement,\n ContextMenuTriggerItemProps\n>((props: ScopedProps<ContextMenuTriggerItemProps>, forwardedRef) => {\n const { __scopeContextMenu, ...triggerItemProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.SubTrigger {...menuScope} {...triggerItemProps} ref={forwardedRef} />;\n});\n\nContextMenuTriggerItem.displayName = TRIGGER_ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuCheckboxItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst CHECKBOX_ITEM_NAME = 'ContextMenuCheckboxItem';\n\ntype ContextMenuCheckboxItemElement = React.ElementRef<typeof MenuPrimitive.CheckboxItem>;\ntype MenuCheckboxItemProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.CheckboxItem>;\ninterface ContextMenuCheckboxItemProps extends MenuCheckboxItemProps {}\n\nconst ContextMenuCheckboxItem = React.forwardRef<\n ContextMenuCheckboxItemElement,\n ContextMenuCheckboxItemProps\n>((props: ScopedProps<ContextMenuCheckboxItemProps>, forwardedRef) => {\n const { __scopeContextMenu, ...checkboxItemProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.CheckboxItem {...menuScope} {...checkboxItemProps} ref={forwardedRef} />;\n});\n\nContextMenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuRadioGroup\n * -----------------------------------------------------------------------------------------------*/\n\nconst RADIO_GROUP_NAME = 'ContextMenuRadioGroup';\n\ntype ContextMenuRadioGroupElement = React.ElementRef<typeof MenuPrimitive.RadioGroup>;\ntype MenuRadioGroupProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.RadioGroup>;\ninterface ContextMenuRadioGroupProps extends MenuRadioGroupProps {}\n\nconst ContextMenuRadioGroup = React.forwardRef<\n ContextMenuRadioGroupElement,\n ContextMenuRadioGroupProps\n>((props: ScopedProps<ContextMenuRadioGroupProps>, forwardedRef) => {\n const { __scopeContextMenu, ...radioGroupProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.RadioGroup {...menuScope} {...radioGroupProps} ref={forwardedRef} />;\n});\n\nContextMenuRadioGroup.displayName = RADIO_GROUP_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuRadioItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst RADIO_ITEM_NAME = 'ContextMenuRadioItem';\n\ntype ContextMenuRadioItemElement = React.ElementRef<typeof MenuPrimitive.RadioItem>;\ntype MenuRadioItemProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.RadioItem>;\ninterface ContextMenuRadioItemProps extends MenuRadioItemProps {}\n\nconst ContextMenuRadioItem = React.forwardRef<\n ContextMenuRadioItemElement,\n ContextMenuRadioItemProps\n>((props: ScopedProps<ContextMenuRadioItemProps>, forwardedRef) => {\n const { __scopeContextMenu, ...radioItemProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.RadioItem {...menuScope} {...radioItemProps} ref={forwardedRef} />;\n});\n\nContextMenuRadioItem.displayName = RADIO_ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuItemIndicator\n * -----------------------------------------------------------------------------------------------*/\n\nconst INDICATOR_NAME = 'ContextMenuItemIndicator';\n\ntype ContextMenuItemIndicatorElement = React.ElementRef<typeof MenuPrimitive.ItemIndicator>;\ntype MenuItemIndicatorProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.ItemIndicator>;\ninterface ContextMenuItemIndicatorProps extends MenuItemIndicatorProps {}\n\nconst ContextMenuItemIndicator = React.forwardRef<\n ContextMenuItemIndicatorElement,\n ContextMenuItemIndicatorProps\n>((props: ScopedProps<ContextMenuItemIndicatorProps>, forwardedRef) => {\n const { __scopeContextMenu, ...itemIndicatorProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.ItemIndicator {...menuScope} {...itemIndicatorProps} ref={forwardedRef} />;\n});\n\nContextMenuItemIndicator.displayName = INDICATOR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuSeparator\n * -----------------------------------------------------------------------------------------------*/\n\nconst SEPARATOR_NAME = 'ContextMenuSeparator';\n\ntype ContextMenuSeparatorElement = React.ElementRef<typeof MenuPrimitive.Separator>;\ntype MenuSeparatorProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Separator>;\ninterface ContextMenuSeparatorProps extends MenuSeparatorProps {}\n\nconst ContextMenuSeparator = React.forwardRef<\n ContextMenuSeparatorElement,\n ContextMenuSeparatorProps\n>((props: ScopedProps<ContextMenuSeparatorProps>, forwardedRef) => {\n const { __scopeContextMenu, ...separatorProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.Separator {...menuScope} {...separatorProps} ref={forwardedRef} />;\n});\n\nContextMenuSeparator.displayName = SEPARATOR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuArrow\n * -----------------------------------------------------------------------------------------------*/\n\nconst ARROW_NAME = 'ContextMenuArrow';\n\ntype ContextMenuArrowElement = React.ElementRef<typeof MenuPrimitive.Arrow>;\ntype MenuArrowProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Arrow>;\ninterface ContextMenuArrowProps extends MenuArrowProps {}\n\nconst ContextMenuArrow = React.forwardRef<ContextMenuArrowElement, ContextMenuArrowProps>(\n (props: ScopedProps<ContextMenuArrowProps>, forwardedRef) => {\n const { __scopeContextMenu, ...arrowProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.Arrow {...menuScope} {...arrowProps} ref={forwardedRef} />;\n }\n);\n\nContextMenuArrow.displayName = ARROW_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction whenTouchOrPen<E>(handler: React.PointerEventHandler<E>): React.PointerEventHandler<E> {\n return (event) => (event.pointerType !== 'mouse' ? handler(event) : undefined);\n}\n\nconst Root = ContextMenu;\nconst Trigger = ContextMenuTrigger;\nconst Content = ContextMenuContent;\nconst Group = ContextMenuGroup;\nconst Label = ContextMenuLabel;\nconst Item = ContextMenuItem;\nconst TriggerItem = ContextMenuTriggerItem;\nconst CheckboxItem = ContextMenuCheckboxItem;\nconst RadioGroup = ContextMenuRadioGroup;\nconst RadioItem = ContextMenuRadioItem;\nconst ItemIndicator = ContextMenuItemIndicator;\nconst Separator = ContextMenuSeparator;\nconst Arrow = ContextMenuArrow;\n\nexport {\n createContextMenuScope,\n //\n ContextMenu,\n ContextMenuTrigger,\n ContextMenuContent,\n ContextMenuGroup,\n ContextMenuLabel,\n ContextMenuItem,\n ContextMenuTriggerItem,\n ContextMenuCheckboxItem,\n ContextMenuRadioGroup,\n ContextMenuRadioItem,\n ContextMenuItemIndicator,\n ContextMenuSeparator,\n ContextMenuArrow,\n //\n Root,\n Trigger,\n Content,\n Group,\n Label,\n Item,\n TriggerItem,\n CheckboxItem,\n RadioGroup,\n RadioItem,\n ItemIndicator,\n Separator,\n Arrow,\n};\nexport type {\n ContextMenuProps,\n ContextMenuTriggerProps,\n ContextMenuContentProps,\n ContextMenuGroupProps,\n ContextMenuLabelProps,\n ContextMenuItemProps,\n ContextMenuTriggerItemProps,\n ContextMenuCheckboxItemProps,\n ContextMenuRadioGroupProps,\n ContextMenuRadioItemProps,\n ContextMenuItemIndicatorProps,\n ContextMenuSeparatorProps,\n ContextMenuArrowProps,\n};\n"],"names":["createContextMenuContext","createContextMenuScope","createContextScope","createMenuScope","useMenuScope","ContextMenuProvider","useContextMenuContext","ContextMenu","props","__scopeContextMenu","children","onOpenChange","dir","modal","open","setOpen","React","useState","contentContext","useContentContext","menuScope","handleOpenChangeProp","useCallbackRef","handleOpenChange","useCallback","isInsideContent","_react","createElement","$b55f3d34bcc87b2d9b0bc87c90588a09$var$ContextMenuProvider","scope","isRootMenu","_radixUiReactMenu","Sub","_babelRuntimeHelpersEsmExtends","Root","ContextMenuTrigger","forwardRef","forwardedRef","triggerProps","context","pointRef","useRef","x","y","virtualRef","getBoundingClientRect","DOMRect","fromRect","width","height","current","longPressTimerRef","clearLongPress","window","clearTimeout","handleOpen","event","clientX","clientY","useEffect","$b55f3d34bcc87b2d9b0bc87c90588a09$var$ContentProvider","Anchor","Primitive","span","ref","style","WebkitTouchCallout","onContextMenu","composeEventHandlers","preventDefault","onPointerDown","whenTouchOrPen","setTimeout","onPointerMove","onPointerCancel","onPointerUp","ContentProvider","ContextMenuContent","contentProps","commonProps","$b55f3d34bcc87b2d9b0bc87c90588a09$var$ContextMenuRootContent","Content","ContextMenuRootContent","hasInteractedOutsideRef","portalled","side","sideOffset","align","onCloseAutoFocus","_props$onCloseAutoFoc","call","defaultPrevented","onInteractOutside","_props$onInteractOuts","ContextMenuGroup","groupProps","Group","ContextMenuLabel","labelProps","Label","ContextMenuItem","itemProps","Item","ContextMenuTriggerItem","triggerItemProps","SubTrigger","ContextMenuCheckboxItem","checkboxItemProps","CheckboxItem","ContextMenuRadioGroup","radioGroupProps","RadioGroup","ContextMenuRadioItem","radioItemProps","RadioItem","ContextMenuItemIndicator","itemIndicatorProps","ItemIndicator","ContextMenuSeparator","separatorProps","Separator","ContextMenuArrow","arrowProps","Arrow","handler","pointerType","undefined","Trigger","TriggerItem"],"version":3,"file":"index.module.js.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@radix-ui/react-context-menu",
|
|
3
|
-
"version": "0.1.7-rc.
|
|
3
|
+
"version": "0.1.7-rc.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -18,14 +18,14 @@
|
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@babel/runtime": "^7.13.10",
|
|
20
20
|
"@radix-ui/primitive": "0.1.0",
|
|
21
|
-
"@radix-ui/react-context": "0.1.
|
|
22
|
-
"@radix-ui/react-menu": "0.1.7-rc.
|
|
23
|
-
"@radix-ui/react-primitive": "0.1.
|
|
24
|
-
"@radix-ui/react-use-callback-ref": "0.1.
|
|
21
|
+
"@radix-ui/react-context": "0.1.2-rc.2",
|
|
22
|
+
"@radix-ui/react-menu": "0.1.7-rc.5",
|
|
23
|
+
"@radix-ui/react-primitive": "0.1.5-rc.2",
|
|
24
|
+
"@radix-ui/react-use-callback-ref": "0.1.1-rc.2"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
|
-
"react": "^16.8 || ^17.0",
|
|
28
|
-
"react-dom": "^16.8 || ^17.0"
|
|
27
|
+
"react": "^16.8 || ^17.0 || ^18.0",
|
|
28
|
+
"react-dom": "^16.8 || ^17.0 || ^18.0"
|
|
29
29
|
},
|
|
30
30
|
"homepage": "https://radix-ui.com/primitives",
|
|
31
31
|
"repository": {
|