mantine-contextmenu 1.3.13 → 1.3.15
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/ContextMenu.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +2 -2
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +3 -3
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenu.d.ts","sourceRoot":"","sources":["../ContextMenu.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AActE,MAAM,MAAM,0BAA0B,GAAG;IACvC,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,OAAO,EAAE,kBAAkB,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,kBAAkB,GAC/C,0BAA0B,GAAG;IAC3B,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB,CAAC;AAEJ,wBAAgB,WAAW,CAAC,EAC1B,CAAC,EACD,CAAC,EACD,OAAO,EACP,MAAM,EACN,MAAM,EACN,YAAY,EACZ,MAAM,EACN,SAAS,EACT,KAAK,EACL,EAAE,EACF,UAAU,EACV,MAAM,GACP,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"ContextMenu.d.ts","sourceRoot":"","sources":["../ContextMenu.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AActE,MAAM,MAAM,0BAA0B,GAAG;IACvC,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,OAAO,EAAE,kBAAkB,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,kBAAkB,GAC/C,0BAA0B,GAAG;IAC3B,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB,CAAC;AAEJ,wBAAgB,WAAW,CAAC,EAC1B,CAAC,EACD,CAAC,EACD,OAAO,EACP,MAAM,EACN,MAAM,EACN,YAAY,EACZ,MAAM,EACN,SAAS,EACT,KAAK,EACL,EAAE,EACF,UAAU,EACV,MAAM,GACP,EAAE,gBAAgB,2CA6ElB"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var ee=Object.create;var v=Object.defineProperty;var te=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var
|
|
1
|
+
"use strict";var ee=Object.create;var v=Object.defineProperty;var te=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var ne=Object.getPrototypeOf,re=Object.prototype.hasOwnProperty;var se=(e,t)=>{for(var o in t)v(e,o,{get:t[o],enumerable:!0})},q=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of oe(t))!re.call(e,n)&&n!==o&&v(e,n,{get:()=>t[n],enumerable:!(r=te(t,n))||r.enumerable});return e};var ie=(e,t,o)=>(o=e!=null?ee(ne(e)):{},q(t||!e||!e.__esModule?v(o,"default",{value:e,enumerable:!0}):o,e)),ae=e=>q(v({},"__esModule",{value:!0}),e);var xe={};se(xe,{ContextMenu:()=>N,ContextMenuDivider:()=>I,ContextMenuItem:()=>B,ContextMenuProvider:()=>pe,humanize:()=>h,useContextMenu:()=>ue});module.exports=ae(xe);var m=ie(require("react"),1);var a=require("@mantine/core"),d=require("@mantine/hooks"),b=require("react");var w=require("@mantine/core"),F=require("react/jsx-runtime"),ce=(0,w.createStyles)(e=>({root:{height:1,background:e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[1]}}));function I({className:e,sx:t,style:o}){let{cx:r,classes:n}=ce();return(0,F.jsx)(w.Box,{className:r(n.root,e),sx:t,style:o})}var i=require("@mantine/core"),M=require("react/jsx-runtime"),de=(0,i.createStyles)((e,{color:t})=>{let o=(0,i.px)(e.spacing.sm)/2;return{root:{width:"100%",display:"flex",alignItems:"center",paddingTop:o,paddingBottom:o,paddingLeft:e.spacing.sm,paddingRight:e.spacing.sm,color:t&&e.colors[t][6],transition:"background .15s ease","&[disabled]":{cursor:"not-allowed",color:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[5]},"&:hover:not([disabled])":{background:e.fn.rgba(t?e.colors[t][6]:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[4],t?e.colorScheme==="dark"?.15:.08:.25)},"&:active:not([disabled])":{background:e.fn.rgba(t?e.colors[t][6]:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[4],t?e.colorScheme==="dark"?.3:.2:.5)}},icon:{fontSize:0,marginRight:e.spacing.xs},title:{whiteSpace:"nowrap"}}});function B({className:e,style:t,icon:o,title:r,color:n,disabled:x,onClick:c}){let{cx:C,classes:p}=de({color:n});return(0,M.jsxs)(i.UnstyledButton,{className:C(p.root,e),style:t,disabled:x,onClick:c,children:[o&&(0,M.jsx)(i.Box,{className:p.icon,children:o}),(0,M.jsx)(i.Text,{className:p.title,size:"sm",children:r})]})}function h(e){let t=e.replace(/([a-z\d])([A-Z]+)/g,"$1 $2").replace(/\W|_/g," ").trim().toLowerCase();return`${t.charAt(0).toUpperCase()}${t.slice(1)}`}var g=require("react/jsx-runtime"),U={},le=(0,a.createStyles)(e=>({root:{position:"fixed",border:`1px solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[3]}`,overflow:"hidden",transition:"all .15s ease"}}));function N({x:e,y:t,content:o,zIndex:r,shadow:n,borderRadius:x,onHide:c,className:C,style:p,sx:s,classNames:l,styles:R}){(0,d.useWindowEvent)("resize",c),(0,d.useWindowEvent)("scroll",c);let Y=(0,d.useClickOutside)(c),[D]=(0,d.useResizeObserver)(),{width:S,height:H}=D.current?.getBoundingClientRect()||{width:0,height:0},_=(0,d.useMergedRef)(Y,D),P=0,T=0;typeof window<"u"&&({innerWidth:P,innerHeight:T}=window);let[,J]=(0,b.useState)(!1);(0,b.useEffect)(()=>{J(!0)},[]);let X=y=>k=>{c(),y(k)},{cx:z,classes:Z,theme:W}=le(),{dir:G,spacing:Q}=W,E=typeof R=="function"?R(W,U,U):R,u=(0,a.px)(Q.md);return(0,g.jsx)(a.Portal,{children:(0,g.jsx)(a.Paper,{ref:_,shadow:n,radius:x,className:z(Z.root,C,l?.root),style:{...E?.root,...p},sx:[{zIndex:r,top:t+H+u>T?T-H-u:t,left:G==="ltr"?e+S+u>P?P-S-u:e:P-u-(e-S-u<0?S+u:e)},...(0,a.packSx)(s)],children:Array.isArray(o)?o.map(({key:y,className:k,sx:L,style:$,onClick:A,title:V,...j})=>A?(0,g.jsx)(B,{className:z(l?.item,k),sx:L,style:{...E?.item,...$},title:V??h(y),onClick:X(A),...j},y):(0,g.jsx)(I,{className:z(l?.divider,k),sx:L,style:{...E?.divider,...$}},y)):o(c)})})}var f=require("react");var O=require("react/jsx-runtime"),K=(0,f.createContext)(()=>()=>{});function pe({zIndex:e=9999,shadow:t="sm",borderRadius:o="xs",children:r}){let[n,x]=(0,f.useState)(null),c=()=>{x(null)},C=(p,s)=>l=>{l.preventDefault(),l.stopPropagation(),x({x:l.clientX,y:l.clientY,content:p,zIndex:s?.zIndex||e,shadow:s?.shadow||t,borderRadius:s?.borderRadius||o,className:s?.className,style:s?.style,sx:s?.sx,classNames:s?.classNames,styles:s?.styles})};return(0,O.jsxs)(K.Provider,{value:C,children:[r,n&&(0,O.jsx)(N,{onHide:c,...n})]})}function ue(){return(0,f.useContext)(K)}
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../index.ts", "../react-shim.mjs", "../ContextMenu.tsx", "../ContextMenuDivider.tsx", "../ContextMenuItem.tsx", "../utils.ts", "../ContextMenuProvider.tsx"],
|
|
4
|
-
"sourcesContent": ["export * from './ContextMenu';\nexport * from './ContextMenuDivider';\nexport * from './ContextMenuItem';\nexport * from './ContextMenuProvider';\nexport { humanize } from './utils';\n", "import * as React from 'react';\nexport { React };\n", "import { Paper, Portal, createStyles, packSx, px } from '@mantine/core';\nimport { useClickOutside,
|
|
5
|
-
"mappings": "ukBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,iBAAAE,EAAA,uBAAAC,EAAA,oBAAAC,EAAA,wBAAAC,GAAA,aAAAC,EAAA,mBAAAC,KAAA,eAAAC,GAAAR,ICAA,IAAAS,EAAuB,uBCAvB,IAAAC,EAAwD,yBACxDC,
|
|
4
|
+
"sourcesContent": ["export * from './ContextMenu';\nexport * from './ContextMenuDivider';\nexport * from './ContextMenuItem';\nexport * from './ContextMenuProvider';\nexport { humanize } from './utils';\n", "import * as React from 'react';\nexport { React };\n", "import { Paper, Portal, createStyles, packSx, px } from '@mantine/core';\nimport { useClickOutside, useMergedRef, useResizeObserver, useWindowEvent } from '@mantine/hooks';\nimport { CSSProperties, MouseEventHandler, useEffect, useState } from 'react';\nimport { ContextMenuDivider } from './ContextMenuDivider';\nimport { ContextMenuItem } from './ContextMenuItem';\nimport type { ContextMenuContent, ContextMenuOptions } from './types';\nimport { humanize } from './utils';\n\nconst EMPTY_OBJECT = {};\n\nconst useStyles = createStyles((theme) => ({\n root: {\n position: 'fixed',\n border: `1px solid ${theme.colorScheme === 'dark' ? theme.colors.dark[4] : theme.colors.gray[3]}`,\n overflow: 'hidden',\n transition: 'all .15s ease',\n },\n}));\n\nexport type ContextMenuInstanceOptions = {\n x: number;\n y: number;\n content: ContextMenuContent;\n};\n\nexport type ContextMenuProps = ContextMenuOptions &\n ContextMenuInstanceOptions & {\n onHide: () => void;\n };\n\nexport function ContextMenu({\n x,\n y,\n content,\n zIndex,\n shadow,\n borderRadius,\n onHide,\n className,\n style,\n sx,\n classNames,\n styles,\n}: ContextMenuProps) {\n useWindowEvent('resize', onHide);\n useWindowEvent('scroll', onHide);\n\n const clickOutsideRef = useClickOutside<HTMLDivElement>(onHide);\n const [sizeRef] = useResizeObserver<HTMLDivElement>();\n const { width, height } = sizeRef.current?.getBoundingClientRect() || { width: 0, height: 0 };\n const ref = useMergedRef(clickOutsideRef, sizeRef);\n\n let windowWidth = 0;\n let windowHeight = 0;\n if (typeof window !== 'undefined') ({ innerWidth: windowWidth, innerHeight: windowHeight } = window);\n\n // trigger a rerender to make sure that context menu is positioned correctly\n const [, setRendered] = useState(false);\n useEffect(() => {\n setRendered(true);\n }, []);\n\n const handleClick: (onClick: MouseEventHandler<HTMLButtonElement>) => MouseEventHandler<HTMLButtonElement> =\n (onClick) => (e) => {\n onHide();\n onClick(e);\n };\n\n const { cx, classes, theme } = useStyles();\n const { dir, spacing } = theme;\n const styleProperties = typeof styles === 'function' ? styles(theme, EMPTY_OBJECT, EMPTY_OBJECT) : styles;\n const mdSpacing = px(spacing.md);\n\n return (\n <Portal>\n <Paper\n ref={ref}\n shadow={shadow}\n radius={borderRadius}\n className={cx(classes.root, className, classNames?.root)}\n style={{ ...styleProperties?.root, ...style } as CSSProperties}\n sx={[\n {\n zIndex,\n top: y + height + mdSpacing > windowHeight ? windowHeight - height - mdSpacing : y,\n left:\n dir === 'ltr'\n ? x + width + mdSpacing > windowWidth\n ? windowWidth - width - mdSpacing\n : x\n : windowWidth - mdSpacing - (x - width - mdSpacing < 0 ? width + mdSpacing : x),\n },\n ...packSx(sx),\n ]}\n >\n {Array.isArray(content)\n ? content.map(({ key, className, sx, style, onClick, title, ...otherOptions }) =>\n onClick ? (\n <ContextMenuItem\n key={key}\n className={cx(classNames?.item, className)}\n sx={sx}\n style={{ ...styleProperties?.item, ...style } as CSSProperties}\n title={title ?? humanize(key)}\n onClick={handleClick(onClick)}\n {...otherOptions}\n />\n ) : (\n <ContextMenuDivider\n key={key}\n className={cx(classNames?.divider, className)}\n sx={sx}\n style={{ ...styleProperties?.divider, ...style } as CSSProperties}\n />\n )\n )\n : content(onHide)}\n </Paper>\n </Portal>\n );\n}\n", "import { Box, createStyles, type Sx } from '@mantine/core';\nimport type { CSSProperties } from 'react';\n\nconst useStyles = createStyles((theme) => ({\n root: {\n height: 1,\n background: theme.colorScheme === 'dark' ? theme.colors.dark[5] : theme.colors.gray[1],\n },\n}));\n\nexport type ContextMenuDividerProps = {\n className: string;\n sx: Sx | (Sx | undefined)[] | undefined;\n style: CSSProperties;\n};\n\nexport function ContextMenuDivider({ className, sx, style }: ContextMenuDividerProps) {\n const { cx, classes } = useStyles();\n return <Box className={cx(classes.root, className)} sx={sx} style={style} />;\n}\n", "import { Box, Text, UnstyledButton, createStyles, px, type MantineColor } from '@mantine/core';\nimport { ContextMenuItemOptions } from './types';\nimport { WithRequiredProperty } from './utils';\n\nconst useStyles = createStyles((theme, { color }: { color?: MantineColor }) => {\n const verticalPadding = px(theme.spacing.sm) / 2;\n return {\n root: {\n width: '100%',\n display: 'flex',\n alignItems: 'center',\n paddingTop: verticalPadding,\n paddingBottom: verticalPadding,\n paddingLeft: theme.spacing.sm,\n paddingRight: theme.spacing.sm,\n color: color && theme.colors[color][6],\n transition: 'background .15s ease',\n '&[disabled]': {\n cursor: 'not-allowed',\n color: theme.colorScheme === 'dark' ? theme.colors.dark[3] : theme.colors.gray[5],\n },\n '&:hover:not([disabled])': {\n background: theme.fn.rgba(\n color ? theme.colors[color][6] : theme.colorScheme === 'dark' ? theme.colors.dark[3] : theme.colors.gray[4],\n color ? (theme.colorScheme === 'dark' ? 0.15 : 0.08) : 0.25\n ),\n },\n '&:active:not([disabled])': {\n background: theme.fn.rgba(\n color ? theme.colors[color][6] : theme.colorScheme === 'dark' ? theme.colors.dark[3] : theme.colors.gray[4],\n color ? (theme.colorScheme === 'dark' ? 0.3 : 0.2) : 0.5\n ),\n },\n },\n icon: {\n fontSize: 0,\n marginRight: theme.spacing.xs,\n },\n title: {\n whiteSpace: 'nowrap',\n },\n };\n});\n\nexport function ContextMenuItem({\n className,\n style,\n icon,\n title,\n color,\n disabled,\n onClick,\n}: WithRequiredProperty<Omit<ContextMenuItemOptions, 'key'>, 'title' | 'onClick'>) {\n const { cx, classes } = useStyles({ color });\n return (\n <UnstyledButton className={cx(classes.root, className)} style={style} disabled={disabled} onClick={onClick}>\n {icon && <Box className={classes.icon}>{icon}</Box>}\n <Text className={classes.title} size=\"sm\">\n {title}\n </Text>\n </UnstyledButton>\n );\n}\n", "export type WithRequiredProperty<Type, Key extends keyof Type> = Type & {\n [Property in Key]-?: Type[Property];\n};\n\n/**\n * Utility function that returns a humanized version of a string, e.g. \"camelCase\" -> \"Camel Case\"\n */\nexport function humanize(value: string) {\n const str = value\n .replace(/([a-z\\d])([A-Z]+)/g, '$1 $2')\n .replace(/\\W|_/g, ' ')\n .trim()\n .toLowerCase();\n return `${str.charAt(0).toUpperCase()}${str.slice(1)}`;\n}\n", "import { createContext, useContext, useState } from 'react';\nimport { ContextMenu, ContextMenuInstanceOptions } from './ContextMenu';\nimport type { ContextMenuOptions, ContextMenuProviderProps, ShowContextMenuFunction } from './types';\n\nconst MenuContext = createContext<ShowContextMenuFunction>(() => () => undefined);\n\n/**\n * Provider that allows to show a context menu anywhere in your application.\n * If you wrap your application with this provider, you can use the `useContextMenu` hook\n * anywhere in the component tree to access a function that shows the context menu.\n */\nexport function ContextMenuProvider({\n zIndex = 9999,\n shadow = 'sm',\n borderRadius = 'xs',\n children,\n}: ContextMenuProviderProps) {\n const [data, setData] = useState<(ContextMenuInstanceOptions & ContextMenuOptions) | null>(null);\n\n const destroy = () => {\n setData(null);\n };\n\n const showContextMenu: ShowContextMenuFunction = (content, options) => (e) => {\n e.preventDefault();\n e.stopPropagation();\n setData({\n x: e.clientX,\n y: e.clientY,\n content,\n zIndex: options?.zIndex || zIndex,\n shadow: options?.shadow || shadow,\n borderRadius: options?.borderRadius || borderRadius,\n className: options?.className,\n style: options?.style,\n sx: options?.sx,\n classNames: options?.classNames,\n styles: options?.styles,\n });\n };\n\n return (\n <MenuContext.Provider value={showContextMenu}>\n {children}\n {data && <ContextMenu onHide={destroy} {...data} />}\n </MenuContext.Provider>\n );\n}\n\n/**\n * Hook returning a function that shows a context menu.\n */\nexport function useContextMenu() {\n return useContext(MenuContext);\n}\n"],
|
|
5
|
+
"mappings": "ukBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,iBAAAE,EAAA,uBAAAC,EAAA,oBAAAC,EAAA,wBAAAC,GAAA,aAAAC,EAAA,mBAAAC,KAAA,eAAAC,GAAAR,ICAA,IAAAS,EAAuB,uBCAvB,IAAAC,EAAwD,yBACxDC,EAAiF,0BACjFC,EAAsE,iBCFtE,IAAAC,EAA2C,yBAkBlCC,EAAA,6BAfHC,MAAY,gBAAcC,IAAW,CACzC,KAAM,CACJ,OAAQ,EACR,WAAYA,EAAM,cAAgB,OAASA,EAAM,OAAO,KAAK,CAAC,EAAIA,EAAM,OAAO,KAAK,CAAC,CACvF,CACF,EAAE,EAQK,SAASC,EAAmB,CAAE,UAAAC,EAAW,GAAAC,EAAI,MAAAC,CAAM,EAA4B,CACpF,GAAM,CAAE,GAAAC,EAAI,QAAAC,CAAQ,EAAIP,GAAU,EAClC,SAAO,OAAC,OAAI,UAAWM,EAAGC,EAAQ,KAAMJ,CAAS,EAAG,GAAIC,EAAI,MAAOC,EAAO,CAC5E,CCnBA,IAAAG,EAA+E,yBAuD3EC,EAAA,6BAnDEC,MAAY,gBAAa,CAACC,EAAO,CAAE,MAAAC,CAAM,IAAgC,CAC7E,IAAMC,KAAkB,MAAGF,EAAM,QAAQ,EAAE,EAAI,EAC/C,MAAO,CACL,KAAM,CACJ,MAAO,OACP,QAAS,OACT,WAAY,SACZ,WAAYE,EACZ,cAAeA,EACf,YAAaF,EAAM,QAAQ,GAC3B,aAAcA,EAAM,QAAQ,GAC5B,MAAOC,GAASD,EAAM,OAAOC,CAAK,EAAE,CAAC,EACrC,WAAY,uBACZ,cAAe,CACb,OAAQ,cACR,MAAOD,EAAM,cAAgB,OAASA,EAAM,OAAO,KAAK,CAAC,EAAIA,EAAM,OAAO,KAAK,CAAC,CAClF,EACA,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AAM,CAC5EA,EAAE,eAAe,EACjBA,EAAE,gBAAgB,EAClBL,EAAQ,CACN,EAAGK,EAAE,QACL,EAAGA,EAAE,QACL,QAAAF,EACA,OAAQC,GAAS,QAAUT,EAC3B,OAAQS,GAAS,QAAUR,EAC3B,aAAcQ,GAAS,cAAgBP,EACvC,UAAWO,GAAS,UACpB,MAAOA,GAAS,MAChB,GAAIA,GAAS,GACb,WAAYA,GAAS,WACrB,OAAQA,GAAS,MACnB,CAAC,CACH,EAEA,SACE,QAACX,EAAY,SAAZ,CAAqB,MAAOS,EAC1B,UAAAJ,EACAC,MAAQ,OAACO,EAAA,CAAY,OAAQL,EAAU,GAAGF,EAAM,GACnD,CAEJ,CAKO,SAASQ,IAAiB,CAC/B,SAAO,cAAWd,CAAW,CAC/B",
|
|
6
6
|
"names": ["package_exports", "__export", "ContextMenu", "ContextMenuDivider", "ContextMenuItem", "ContextMenuProvider", "humanize", "useContextMenu", "__toCommonJS", "React", "import_core", "import_hooks", "import_react", "import_core", "import_jsx_runtime", "useStyles", "theme", "ContextMenuDivider", "className", "sx", "style", "cx", "classes", "import_core", "import_jsx_runtime", "useStyles", "theme", "color", "verticalPadding", "ContextMenuItem", "className", "style", "icon", "title", "disabled", "onClick", "cx", "classes", "humanize", "value", "str", "import_jsx_runtime", "EMPTY_OBJECT", "useStyles", "theme", "ContextMenu", "x", "y", "content", "zIndex", "shadow", "borderRadius", "onHide", "className", "style", "sx", "classNames", "styles", "clickOutsideRef", "sizeRef", "width", "height", "ref", "windowWidth", "windowHeight", "setRendered", "handleClick", "onClick", "e", "cx", "classes", "dir", "spacing", "styleProperties", "mdSpacing", "key", "title", "otherOptions", "ContextMenuItem", "humanize", "ContextMenuDivider", "import_react", "import_jsx_runtime", "MenuContext", "ContextMenuProvider", "zIndex", "shadow", "borderRadius", "children", "data", "setData", "destroy", "showContextMenu", "content", "options", "e", "ContextMenu", "useContextMenu"]
|
|
7
7
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import*as p from"react";import{Paper as oe,Portal as
|
|
1
|
+
import*as p from"react";import{Paper as oe,Portal as ne,createStyles as re,packSx as se,px as ie}from"@mantine/core";import{useClickOutside as ae,useMergedRef as ce,useResizeObserver as de,useWindowEvent as I}from"@mantine/hooks";import{useEffect as le,useState as pe}from"react";import{Box as Y,createStyles as _}from"@mantine/core";import{jsx as X}from"react/jsx-runtime";var J=_(e=>({root:{height:1,background:e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[1]}}));function T({className:e,sx:t,style:o}){let{cx:a,classes:s}=J();return X(Y,{className:a(s.root,e),sx:t,style:o})}import{Box as Z,Text as G,UnstyledButton as Q,createStyles as V,px as j}from"@mantine/core";import{jsx as z,jsxs as te}from"react/jsx-runtime";var ee=V((e,{color:t})=>{let o=j(e.spacing.sm)/2;return{root:{width:"100%",display:"flex",alignItems:"center",paddingTop:o,paddingBottom:o,paddingLeft:e.spacing.sm,paddingRight:e.spacing.sm,color:t&&e.colors[t][6],transition:"background .15s ease","&[disabled]":{cursor:"not-allowed",color:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[5]},"&:hover:not([disabled])":{background:e.fn.rgba(t?e.colors[t][6]:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[4],t?e.colorScheme==="dark"?.15:.08:.25)},"&:active:not([disabled])":{background:e.fn.rgba(t?e.colors[t][6]:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[4],t?e.colorScheme==="dark"?.3:.2:.5)}},icon:{fontSize:0,marginRight:e.spacing.xs},title:{whiteSpace:"nowrap"}}});function E({className:e,style:t,icon:o,title:a,color:s,disabled:l,onClick:r}){let{cx:u,classes:c}=ee({color:s});return te(Q,{className:u(c.root,e),style:t,disabled:l,onClick:r,children:[o&&z(Z,{className:c.icon,children:o}),z(G,{className:c.title,size:"sm",children:a})]})}function k(e){let t=e.replace(/([a-z\d])([A-Z]+)/g,"$1 $2").replace(/\W|_/g," ").trim().toLowerCase();return`${t.charAt(0).toUpperCase()}${t.slice(1)}`}import{jsx as y}from"react/jsx-runtime";var B={},ue=re(e=>({root:{position:"fixed",border:`1px solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[3]}`,overflow:"hidden",transition:"all .15s ease"}}));function N({x:e,y:t,content:o,zIndex:a,shadow:s,borderRadius:l,onHide:r,className:u,style:c,sx:n,classNames:i,styles:M}){I("resize",r),I("scroll",r);let H=ae(r),[v]=de(),{width:m,height:w}=v.current?.getBoundingClientRect()||{width:0,height:0},W=ce(H,v),f=0,g=0;typeof window<"u"&&({innerWidth:f,innerHeight:g}=window);let[,L]=pe(!1);le(()=>{L(!0)},[]);let $=x=>C=>{r(),x(C)},{cx:S,classes:A,theme:h}=ue(),{dir:q,spacing:F}=h,P=typeof M=="function"?M(h,B,B):M,d=ie(F.md);return y(ne,{children:y(oe,{ref:W,shadow:s,radius:l,className:S(A.root,u,i?.root),style:{...P?.root,...c},sx:[{zIndex:a,top:t+w+d>g?g-w-d:t,left:q==="ltr"?e+m+d>f?f-m-d:e:f-d-(e-m-d<0?m+d:e)},...se(n)],children:Array.isArray(o)?o.map(({key:x,className:C,sx:b,style:O,onClick:R,title:U,...K})=>R?y(E,{className:S(i?.item,C),sx:b,style:{...P?.item,...O},title:U??k(x),onClick:$(R),...K},x):y(T,{className:S(i?.divider,C),sx:b,style:{...P?.divider,...O}},x)):o(r)})})}import{createContext as xe,useContext as me,useState as fe}from"react";import{jsx as Ce,jsxs as ye}from"react/jsx-runtime";var D=xe(()=>()=>{});function Ue({zIndex:e=9999,shadow:t="sm",borderRadius:o="xs",children:a}){let[s,l]=fe(null),r=()=>{l(null)},u=(c,n)=>i=>{i.preventDefault(),i.stopPropagation(),l({x:i.clientX,y:i.clientY,content:c,zIndex:n?.zIndex||e,shadow:n?.shadow||t,borderRadius:n?.borderRadius||o,className:n?.className,style:n?.style,sx:n?.sx,classNames:n?.classNames,styles:n?.styles})};return ye(D.Provider,{value:u,children:[a,s&&Ce(N,{onHide:r,...s})]})}function Ke(){return me(D)}export{N as ContextMenu,T as ContextMenuDivider,E as ContextMenuItem,Ue as ContextMenuProvider,k as humanize,Ke as useContextMenu};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../react-shim.mjs", "../ContextMenu.tsx", "../ContextMenuDivider.tsx", "../ContextMenuItem.tsx", "../utils.ts", "../ContextMenuProvider.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { Paper, Portal, createStyles, packSx, px } from '@mantine/core';\nimport { useClickOutside,
|
|
5
|
-
"mappings": "AAAA,UAAYA,MAAW,QCAvB,OAAS,SAAAC,GAAO,UAAAC,GAAQ,gBAAAC,GAAc,UAAAC,GAAQ,MAAAC,OAAU,gBACxD,OAAS,mBAAAC,GAAiB,
|
|
6
|
-
"names": ["React", "Paper", "Portal", "createStyles", "packSx", "px", "useClickOutside", "
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { Paper, Portal, createStyles, packSx, px } from '@mantine/core';\nimport { useClickOutside, useMergedRef, useResizeObserver, useWindowEvent } from '@mantine/hooks';\nimport { CSSProperties, MouseEventHandler, useEffect, useState } from 'react';\nimport { ContextMenuDivider } from './ContextMenuDivider';\nimport { ContextMenuItem } from './ContextMenuItem';\nimport type { ContextMenuContent, ContextMenuOptions } from './types';\nimport { humanize } from './utils';\n\nconst EMPTY_OBJECT = {};\n\nconst useStyles = createStyles((theme) => ({\n root: {\n position: 'fixed',\n border: `1px solid ${theme.colorScheme === 'dark' ? theme.colors.dark[4] : theme.colors.gray[3]}`,\n overflow: 'hidden',\n transition: 'all .15s ease',\n },\n}));\n\nexport type ContextMenuInstanceOptions = {\n x: number;\n y: number;\n content: ContextMenuContent;\n};\n\nexport type ContextMenuProps = ContextMenuOptions &\n ContextMenuInstanceOptions & {\n onHide: () => void;\n };\n\nexport function ContextMenu({\n x,\n y,\n content,\n zIndex,\n shadow,\n borderRadius,\n onHide,\n className,\n style,\n sx,\n classNames,\n styles,\n}: ContextMenuProps) {\n useWindowEvent('resize', onHide);\n useWindowEvent('scroll', onHide);\n\n const clickOutsideRef = useClickOutside<HTMLDivElement>(onHide);\n const [sizeRef] = useResizeObserver<HTMLDivElement>();\n const { width, height } = sizeRef.current?.getBoundingClientRect() || { width: 0, height: 0 };\n const ref = useMergedRef(clickOutsideRef, sizeRef);\n\n let windowWidth = 0;\n let windowHeight = 0;\n if (typeof window !== 'undefined') ({ innerWidth: windowWidth, innerHeight: windowHeight } = window);\n\n // trigger a rerender to make sure that context menu is positioned correctly\n const [, setRendered] = useState(false);\n useEffect(() => {\n setRendered(true);\n }, []);\n\n const handleClick: (onClick: MouseEventHandler<HTMLButtonElement>) => MouseEventHandler<HTMLButtonElement> =\n (onClick) => (e) => {\n onHide();\n onClick(e);\n };\n\n const { cx, classes, theme } = useStyles();\n const { dir, spacing } = theme;\n const styleProperties = typeof styles === 'function' ? styles(theme, EMPTY_OBJECT, EMPTY_OBJECT) : styles;\n const mdSpacing = px(spacing.md);\n\n return (\n <Portal>\n <Paper\n ref={ref}\n shadow={shadow}\n radius={borderRadius}\n className={cx(classes.root, className, classNames?.root)}\n style={{ ...styleProperties?.root, ...style } as CSSProperties}\n sx={[\n {\n zIndex,\n top: y + height + mdSpacing > windowHeight ? windowHeight - height - mdSpacing : y,\n left:\n dir === 'ltr'\n ? x + width + mdSpacing > windowWidth\n ? windowWidth - width - mdSpacing\n : x\n : windowWidth - mdSpacing - (x - width - mdSpacing < 0 ? width + mdSpacing : x),\n },\n ...packSx(sx),\n ]}\n >\n {Array.isArray(content)\n ? content.map(({ key, className, sx, style, onClick, title, ...otherOptions }) =>\n onClick ? (\n <ContextMenuItem\n key={key}\n className={cx(classNames?.item, className)}\n sx={sx}\n style={{ ...styleProperties?.item, ...style } as CSSProperties}\n title={title ?? humanize(key)}\n onClick={handleClick(onClick)}\n {...otherOptions}\n />\n ) : (\n <ContextMenuDivider\n key={key}\n className={cx(classNames?.divider, className)}\n sx={sx}\n style={{ ...styleProperties?.divider, ...style } as CSSProperties}\n />\n )\n )\n : content(onHide)}\n </Paper>\n </Portal>\n );\n}\n", "import { Box, createStyles, type Sx } from '@mantine/core';\nimport type { CSSProperties } from 'react';\n\nconst useStyles = createStyles((theme) => ({\n root: {\n height: 1,\n background: theme.colorScheme === 'dark' ? theme.colors.dark[5] : theme.colors.gray[1],\n },\n}));\n\nexport type ContextMenuDividerProps = {\n className: string;\n sx: Sx | (Sx | undefined)[] | undefined;\n style: CSSProperties;\n};\n\nexport function ContextMenuDivider({ className, sx, style }: ContextMenuDividerProps) {\n const { cx, classes } = useStyles();\n return <Box className={cx(classes.root, className)} sx={sx} style={style} />;\n}\n", "import { Box, Text, UnstyledButton, createStyles, px, type MantineColor } from '@mantine/core';\nimport { ContextMenuItemOptions } from './types';\nimport { WithRequiredProperty } from './utils';\n\nconst useStyles = createStyles((theme, { color }: { color?: MantineColor }) => {\n const verticalPadding = px(theme.spacing.sm) / 2;\n return {\n root: {\n width: '100%',\n display: 'flex',\n alignItems: 'center',\n paddingTop: verticalPadding,\n paddingBottom: verticalPadding,\n paddingLeft: theme.spacing.sm,\n paddingRight: theme.spacing.sm,\n color: color && theme.colors[color][6],\n transition: 'background .15s ease',\n '&[disabled]': {\n cursor: 'not-allowed',\n color: theme.colorScheme === 'dark' ? theme.colors.dark[3] : theme.colors.gray[5],\n },\n '&:hover:not([disabled])': {\n background: theme.fn.rgba(\n color ? theme.colors[color][6] : theme.colorScheme === 'dark' ? theme.colors.dark[3] : theme.colors.gray[4],\n color ? (theme.colorScheme === 'dark' ? 0.15 : 0.08) : 0.25\n ),\n },\n '&:active:not([disabled])': {\n background: theme.fn.rgba(\n color ? theme.colors[color][6] : theme.colorScheme === 'dark' ? theme.colors.dark[3] : theme.colors.gray[4],\n color ? (theme.colorScheme === 'dark' ? 0.3 : 0.2) : 0.5\n ),\n },\n },\n icon: {\n fontSize: 0,\n marginRight: theme.spacing.xs,\n },\n title: {\n whiteSpace: 'nowrap',\n },\n };\n});\n\nexport function ContextMenuItem({\n className,\n style,\n icon,\n title,\n color,\n disabled,\n onClick,\n}: WithRequiredProperty<Omit<ContextMenuItemOptions, 'key'>, 'title' | 'onClick'>) {\n const { cx, classes } = useStyles({ color });\n return (\n <UnstyledButton className={cx(classes.root, className)} style={style} disabled={disabled} onClick={onClick}>\n {icon && <Box className={classes.icon}>{icon}</Box>}\n <Text className={classes.title} size=\"sm\">\n {title}\n </Text>\n </UnstyledButton>\n );\n}\n", "export type WithRequiredProperty<Type, Key extends keyof Type> = Type & {\n [Property in Key]-?: Type[Property];\n};\n\n/**\n * Utility function that returns a humanized version of a string, e.g. \"camelCase\" -> \"Camel Case\"\n */\nexport function humanize(value: string) {\n const str = value\n .replace(/([a-z\\d])([A-Z]+)/g, '$1 $2')\n .replace(/\\W|_/g, ' ')\n .trim()\n .toLowerCase();\n return `${str.charAt(0).toUpperCase()}${str.slice(1)}`;\n}\n", "import { createContext, useContext, useState } from 'react';\nimport { ContextMenu, ContextMenuInstanceOptions } from './ContextMenu';\nimport type { ContextMenuOptions, ContextMenuProviderProps, ShowContextMenuFunction } from './types';\n\nconst MenuContext = createContext<ShowContextMenuFunction>(() => () => undefined);\n\n/**\n * Provider that allows to show a context menu anywhere in your application.\n * If you wrap your application with this provider, you can use the `useContextMenu` hook\n * anywhere in the component tree to access a function that shows the context menu.\n */\nexport function ContextMenuProvider({\n zIndex = 9999,\n shadow = 'sm',\n borderRadius = 'xs',\n children,\n}: ContextMenuProviderProps) {\n const [data, setData] = useState<(ContextMenuInstanceOptions & ContextMenuOptions) | null>(null);\n\n const destroy = () => {\n setData(null);\n };\n\n const showContextMenu: ShowContextMenuFunction = (content, options) => (e) => {\n e.preventDefault();\n e.stopPropagation();\n setData({\n x: e.clientX,\n y: e.clientY,\n content,\n zIndex: options?.zIndex || zIndex,\n shadow: options?.shadow || shadow,\n borderRadius: options?.borderRadius || borderRadius,\n className: options?.className,\n style: options?.style,\n sx: options?.sx,\n classNames: options?.classNames,\n styles: options?.styles,\n });\n };\n\n return (\n <MenuContext.Provider value={showContextMenu}>\n {children}\n {data && <ContextMenu onHide={destroy} {...data} />}\n </MenuContext.Provider>\n );\n}\n\n/**\n * Hook returning a function that shows a context menu.\n */\nexport function useContextMenu() {\n return useContext(MenuContext);\n}\n"],
|
|
5
|
+
"mappings": "AAAA,UAAYA,MAAW,QCAvB,OAAS,SAAAC,GAAO,UAAAC,GAAQ,gBAAAC,GAAc,UAAAC,GAAQ,MAAAC,OAAU,gBACxD,OAAS,mBAAAC,GAAiB,gBAAAC,GAAc,qBAAAC,GAAmB,kBAAAC,MAAsB,iBACjF,OAA2C,aAAAC,GAAW,YAAAC,OAAgB,QCFtE,OAAS,OAAAC,EAAK,gBAAAC,MAA6B,gBAkBlC,cAAAC,MAAA,oBAfT,IAAMC,EAAYF,EAAcG,IAAW,CACzC,KAAM,CACJ,OAAQ,EACR,WAAYA,EAAM,cAAgB,OAASA,EAAM,OAAO,KAAK,CAAC,EAAIA,EAAM,OAAO,KAAK,CAAC,CACvF,CACF,EAAE,EAQK,SAASC,EAAmB,CAAE,UAAAC,EAAW,GAAAC,EAAI,MAAAC,CAAM,EAA4B,CACpF,GAAM,CAAE,GAAAC,EAAI,QAAAC,CAAQ,EAAIP,EAAU,EAClC,OAAOD,EAACF,EAAA,CAAI,UAAWS,EAAGC,EAAQ,KAAMJ,CAAS,EAAG,GAAIC,EAAI,MAAOC,EAAO,CAC5E,CCnBA,OAAS,OAAAG,EAAK,QAAAC,EAAM,kBAAAC,EAAgB,gBAAAC,EAAc,MAAAC,MAA6B,gBAuD3E,OACW,OAAAC,EADX,QAAAC,OAAA,oBAnDJ,IAAMC,GAAYJ,EAAa,CAACK,EAAO,CAAE,MAAAC,CAAM,IAAgC,CAC7E,IAAMC,EAAkBN,EAAGI,EA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GAAIE,EACJ,MAAO,CAAE,GAAGwB,GAAiB,QAAS,GAAGzB,CAAM,GAH1C+B,CAIP,CAEJ,EACArC,EAAQI,CAAM,EACpB,EACF,CAEJ,CIxHA,OAAS,iBAAAuC,GAAe,cAAAC,GAAY,YAAAC,OAAgB,QA0ChD,OAEW,OAAAC,GAFX,QAAAC,OAAA,oBAtCJ,IAAMC,EAAcC,GAAuC,IAAM,IAAG,EAAY,EAOzE,SAASC,GAAoB,CAClC,OAAAC,EAAS,KACT,OAAAC,EAAS,KACT,aAAAC,EAAe,KACf,SAAAC,CACF,EAA6B,CAC3B,GAAM,CAACC,EAAMC,CAAO,EAAIC,GAAmE,IAAI,EAEzFC,EAAU,IAAM,CACpBF,EAAQ,IAAI,CACd,EAEMG,EAA2C,CAACC,EAASC,IAAaC,GAAM,CAC5EA,EAAE,eAAe,EACjBA,EAAE,gBAAgB,EAClBN,EAAQ,CACN,EAAGM,EAAE,QACL,EAAGA,EAAE,QACL,QAAAF,EACA,OAAQC,GAAS,QAAUV,EAC3B,OAAQU,GAAS,QAAUT,EAC3B,aAAcS,GAAS,cAAgBR,EACvC,UAAWQ,GAAS,UACpB,MAAOA,GAAS,MAChB,GAAIA,GAAS,GACb,WAAYA,GAAS,WACrB,OAAQA,GAAS,MACnB,CAAC,CACH,EAEA,OACEd,GAACC,EAAY,SAAZ,CAAqB,MAAOW,EAC1B,UAAAL,EACAC,GAAQT,GAACiB,EAAA,CAAY,OAAQL,EAAU,GAAGH,EAAM,GACnD,CAEJ,CAKO,SAASS,IAAiB,CAC/B,OAAOC,GAAWjB,CAAW,CAC/B",
|
|
6
|
+
"names": ["React", "Paper", "Portal", "createStyles", "packSx", "px", "useClickOutside", "useMergedRef", "useResizeObserver", "useWindowEvent", "useEffect", "useState", "Box", "createStyles", "jsx", "useStyles", "theme", "ContextMenuDivider", "className", "sx", "style", "cx", "classes", "Box", "Text", "UnstyledButton", "createStyles", "px", "jsx", "jsxs", "useStyles", "theme", "color", "verticalPadding", "ContextMenuItem", "className", "style", "icon", "title", "disabled", "onClick", "cx", "classes", "humanize", "value", "str", "jsx", "EMPTY_OBJECT", "useStyles", "createStyles", "theme", "ContextMenu", "x", "y", "content", "zIndex", "shadow", "borderRadius", "onHide", "className", "style", "sx", "classNames", "styles", "useWindowEvent", "clickOutsideRef", "useClickOutside", "sizeRef", "useResizeObserver", "width", "height", "ref", "useMergedRef", "windowWidth", "windowHeight", "setRendered", "useState", "useEffect", "handleClick", "onClick", "e", "cx", "classes", "dir", "spacing", "styleProperties", "mdSpacing", "px", "Portal", "Paper", "packSx", "key", "title", "otherOptions", "ContextMenuItem", "humanize", "ContextMenuDivider", "createContext", "useContext", "useState", "jsx", "jsxs", "MenuContext", "createContext", "ContextMenuProvider", "zIndex", "shadow", "borderRadius", "children", "data", "setData", "useState", "destroy", "showContextMenu", "content", "options", "e", "ContextMenu", "useContextMenu", "useContext"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mantine-contextmenu",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.15",
|
|
4
4
|
"description": "Enhance your Mantine UI applications usability with customizable context menus",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ui",
|
|
@@ -54,11 +54,11 @@
|
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@mantine/core": "^6.0.19",
|
|
56
56
|
"@mantine/hooks": "^6.0.19",
|
|
57
|
-
"@types/react": "^18.2.
|
|
57
|
+
"@types/react": "^18.2.21",
|
|
58
58
|
"@types/react-dom": "^18.2.7",
|
|
59
|
-
"esbuild": "^0.19.
|
|
59
|
+
"esbuild": "^0.19.2",
|
|
60
60
|
"react": "^18.2.0",
|
|
61
|
-
"typescript": "^5.
|
|
61
|
+
"typescript": "^5.2.2"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
64
|
"@mantine/core": ">=6 <=6.0.17 || >=6.0.19",
|