jattac.libs.web.overflow-menu 0.0.25 → 0.0.26
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.es.js +1 -1
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e,{useState as t,useRef as n,useEffect as r,useLayoutEffect as o}from"react";import{AnimatePresence as i,motion as a}from"framer-motion";import{createPortal as l}from"react-dom";var s={trigger:"OverflowMenu-module_trigger__imdPK",menu:"OverflowMenu-module_menu__n8uKD",dotsWrapper:"OverflowMenu-module_dotsWrapper__CHO9Q",dot:"OverflowMenu-module_dot__g5Rgi"};!function(e,t){void 0===t&&(t={});var n=t.insertAt;if("undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".OverflowMenu-module_menuWrapper__psD7a{display:inline-block;position:relative;z-index:0}.OverflowMenu-module_trigger__imdPK{align-items:center;background:transparent;border:none;border-radius:50%;color:#024b59;cursor:pointer;display:flex;font-size:1.8rem;height:3rem;justify-content:center;transition:color .2s ease,background-color .2s ease;width:3rem}.OverflowMenu-module_trigger__imdPK:focus,.OverflowMenu-module_trigger__imdPK:hover{background-color:rgba(2,75,89,.05);color:#016a80;outline:none}.OverflowMenu-module_menu__n8uKD{backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);background:hsla(0,0%,100%,.75);border:1px solid #016a80;border-radius:12px;box-shadow:0 8px 24px rgba(0,0,0,.12);color:#024b59;display:flex;flex-direction:column;font-family:Segoe UI,Tahoma,Geneva,Verdana,sans-serif;font-weight:500;gap:.35rem;min-width:180px;padding:.5rem .25rem;width:max-content;z-index:9999}.OverflowMenu-module_menu__n8uKD button{background:transparent;border:none;border-bottom:1px solid rgba(2,75,89,.1);border-radius:8px;color:#024b59;cursor:pointer;font-size:1rem;padding:.6rem 1rem;text-align:left;transition:background .25s ease,transform .12s ease;user-select:none}.OverflowMenu-module_menu__n8uKD button:last-child{border-bottom:none}.OverflowMenu-module_menu__n8uKD button:focus,.OverflowMenu-module_menu__n8uKD button:hover{background:rgba(2,75,89,.05);outline:none;transform:scale(1.03)}.OverflowMenu-module_menu__n8uKD button:active{background:rgba(2,75,89,.1);transform:scale(.98)}.OverflowMenu-module_dotsWrapper__CHO9Q{align-items:center;display:flex;flex-direction:column;gap:3px;justify-content:center}.OverflowMenu-module_dot__g5Rgi{background-color:currentColor;border-radius:50%;display:block;height:5px;width:5px}");const d=()=>{const t={initial:{y:0,scale:1},hover:{y:-4,scale:1.2,transition:{type:"spring",stiffness:500,damping:20}},rest:{y:0,scale:1,transition:{type:"spring",stiffness:500,damping:20}}};return e.createElement(a.div,{className:s.dotsWrapper,initial:"rest",whileHover:"hover",animate:"rest"},[0,1,2].map(n=>e.createElement(a.span,{key:n,className:s.dot,variants:t,custom:n,transition:{delay:.05*n}})))},u=({items:
|
|
1
|
+
import e,{useState as t,useRef as n,useEffect as r,useLayoutEffect as o}from"react";import{AnimatePresence as i,motion as a}from"framer-motion";import{createPortal as l}from"react-dom";var s={trigger:"OverflowMenu-module_trigger__imdPK",menu:"OverflowMenu-module_menu__n8uKD",dotsWrapper:"OverflowMenu-module_dotsWrapper__CHO9Q",dot:"OverflowMenu-module_dot__g5Rgi"};!function(e,t){void 0===t&&(t={});var n=t.insertAt;if("undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".OverflowMenu-module_menuWrapper__psD7a{display:inline-block;position:relative;z-index:0}.OverflowMenu-module_trigger__imdPK{align-items:center;background:transparent;border:none;border-radius:50%;color:#024b59;cursor:pointer;display:flex;font-size:1.8rem;height:3rem;justify-content:center;transition:color .2s ease,background-color .2s ease;width:3rem}.OverflowMenu-module_trigger__imdPK:focus,.OverflowMenu-module_trigger__imdPK:hover{background-color:rgba(2,75,89,.05);color:#016a80;outline:none}.OverflowMenu-module_menu__n8uKD{backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);background:hsla(0,0%,100%,.75);border:1px solid #016a80;border-radius:12px;box-shadow:0 8px 24px rgba(0,0,0,.12);color:#024b59;display:flex;flex-direction:column;font-family:Segoe UI,Tahoma,Geneva,Verdana,sans-serif;font-weight:500;gap:.35rem;min-width:180px;padding:.5rem .25rem;width:max-content;z-index:9999}.OverflowMenu-module_menu__n8uKD button{background:transparent;border:none;border-bottom:1px solid rgba(2,75,89,.1);border-radius:8px;color:#024b59;cursor:pointer;font-size:1rem;padding:.6rem 1rem;text-align:left;transition:background .25s ease,transform .12s ease;user-select:none}.OverflowMenu-module_menu__n8uKD button:last-child{border-bottom:none}.OverflowMenu-module_menu__n8uKD button:focus,.OverflowMenu-module_menu__n8uKD button:hover{background:rgba(2,75,89,.05);outline:none;transform:scale(1.03)}.OverflowMenu-module_menu__n8uKD button:active{background:rgba(2,75,89,.1);transform:scale(.98)}.OverflowMenu-module_dotsWrapper__CHO9Q{align-items:center;display:flex;flex-direction:column;gap:3px;justify-content:center}.OverflowMenu-module_dot__g5Rgi{background-color:currentColor;border-radius:50%;display:block;height:5px;width:5px}");const d=()=>{const t={initial:{y:0,scale:1},hover:{y:-4,scale:1.2,transition:{type:"spring",stiffness:500,damping:20}},rest:{y:0,scale:1,transition:{type:"spring",stiffness:500,damping:20}}};return e.createElement(a.div,{className:s.dotsWrapper,initial:"rest",whileHover:"hover",animate:"rest"},[0,1,2].map(n=>e.createElement(a.span,{key:n,className:s.dot,variants:t,custom:n,transition:{delay:.05*n}})))},u=e=>{if(null==e)return window;const t=e.parentNode;if(t===document.body)return window;const n=window.getComputedStyle(t).overflowY;return"visible"!==n&&"hidden"!==n&&t.scrollHeight>t.clientHeight?t:u(t)},c=({items:c,icon:m,className:p="",portal:f=null})=>{const[g,v]=t(!1),[b,_]=t(!0),[w,h]=t({top:0,left:0}),y=n(null),x=n(null),k=()=>{if(x.current&&y.current){const e=x.current.getBoundingClientRect(),t=y.current.getBoundingClientRect(),n=window.innerWidth,r=window.innerHeight;let o=e.bottom,i=e.left;i+t.width>n&&(i=n-t.width-10,i<0&&(i=10)),o+t.height>r&&(o=e.top-t.height-10,o<0&&(o=10)),h({top:o,left:i})}};r(()=>{_(!1)},[]);const O=e=>{x.current&&x.current.contains(e.target)||y.current&&!y.current.contains(e.target)&&v(!1)};r(()=>(g?document.addEventListener("mousedown",O):document.removeEventListener("mousedown",O),()=>{document.removeEventListener("mousedown",O)}),[g]),o(()=>{g&&k()},[g]),r(()=>{if(!g)return;const e=u(x.current),t=()=>{k()};return e.addEventListener("scroll",t),window.addEventListener("resize",t),()=>{e.removeEventListener("scroll",t),window.removeEventListener("resize",t)}},[g]);const E={hidden:{opacity:0,y:-10},visible:{opacity:1,y:0}},M=e.createElement(i,null,g&&e.createElement(a.div,{ref:y,className:s.menu,style:{position:"fixed",top:`${w.top}px`,left:`${w.left}px`},variants:{hidden:{opacity:0,scale:.95,transition:{duration:.1}},visible:{opacity:1,scale:1,transition:{duration:.2,staggerChildren:.05}}},initial:!b&&"hidden",animate:"visible",exit:"hidden"},c.map((t,n)=>e.createElement(a.button,{key:n,className:s.menuItem,onClick:()=>{var e;null===(e=t.onClick)||void 0===e||e.call(t),v(!1)},variants:E,whileHover:{scale:1.05,y:-2,color:"#016a80",backgroundColor:"rgba(2, 75, 89, 0.05)",transition:{type:"spring",stiffness:400,damping:15}}},t.content))));return e.createElement("div",{className:s.overflowMenu},e.createElement(a.button,{ref:x,onClick:e=>{e.stopPropagation(),v(!g)},className:`${s.trigger} ${p}`,"aria-haspopup":"true","aria-expanded":g,whileHover:{scale:1.1,y:-2,color:"#016a80",backgroundColor:"rgba(2, 75, 89, 0.05)",transition:{type:"spring",stiffness:400,damping:15}}},m||e.createElement(d,null)),f?l(M,f):M)};export{c as default};
|
|
2
2
|
//# sourceMappingURL=index.es.js.map
|
package/dist/index.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.js","sources":["../node_modules/style-inject/dist/style-inject.es.js","../src/UI/OverflowMenu.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n",null],"names":["css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","DefaultIcon","dotVariants","initial","y","scale","hover","transition","stiffness","damping","rest","React","motion","div","className","styles","dotsWrapper","whileHover","animate","map","i","span","key","dot","variants","custom","delay","OverflowMenu","items","icon","portal","isOpen","setIsOpen","useState","isInitialRender","setIsInitialRender","menuPosition","setMenuPosition","top","left","menuRef","useRef","triggerRef","
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../node_modules/style-inject/dist/style-inject.es.js","../src/UI/OverflowMenu.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n",null],"names":["css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","DefaultIcon","dotVariants","initial","y","scale","hover","transition","stiffness","damping","rest","React","motion","div","className","styles","dotsWrapper","whileHover","animate","map","i","span","key","dot","variants","custom","delay","getScrollableParent","node","window","parent","parentNode","body","overflowY","getComputedStyle","scrollHeight","clientHeight","OverflowMenu","items","icon","portal","isOpen","setIsOpen","useState","isInitialRender","setIsInitialRender","menuPosition","setMenuPosition","top","left","menuRef","useRef","triggerRef","calculatePosition","current","triggerRect","getBoundingClientRect","menuRect","viewportWidth","innerWidth","viewportHeight","innerHeight","bottom","width","height","useEffect","handleClickOutside","event","contains","target","addEventListener","removeEventListener","useLayoutEffect","scrollableParent","handleScroll","itemVariants","hidden","opacity","visible","menuContent","AnimatePresence","menu","position","duration","staggerChildren","exit","item","index","button","menuItem","onClick","_a","call","color","backgroundColor","content","overflowMenu","stopPropagation","trigger","createPortal"],"mappings":"gXAAA,SAAqBA,EAAKC,QACX,IAARA,IAAiBA,EAAM,CAAA,GAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAgC,oBAAbC,SAAnB,CAEA,IAAIC,EAAOD,SAASC,MAAQD,SAASE,qBAAqB,QAAQ,GAC9DC,EAAQH,SAASI,cAAc,SACnCD,EAAME,KAAO,WAEI,QAAbN,GACEE,EAAKK,WACPL,EAAKM,aAAaJ,EAAOF,EAAKK,YAKhCL,EAAKO,YAAYL,GAGfA,EAAMM,WACRN,EAAMM,WAAWC,QAAUb,EAE3BM,EAAMK,YAAYR,SAASW,eAAed,GAnBU,CAqBxD,4tDClBA,MAAMe,EAAc,KAChB,MAAMC,EAAwB,CAC1BC,QAAS,CAAEC,EAAG,EAAGC,MAAO,GACxBC,MAAO,CACHF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AEJ/C,EAAMnB,IAAI,CAACmE,EAAMC,IACd5E,EAAAlB,cAACmB,EAAO4E,OAAM,CACVlE,IAAKiE,EACLzE,UAAWC,EAAO0E,SAClBC,QAAS,WACO,QAAZC,EAAAL,EAAKI,eAAO,IAAAC,GAAAA,EAAAC,KAAAN,GACZ5C,GAAU,IAEdlB,SAAUmD,EACV1D,WAAY,CACRZ,MAAO,KACPD,GAAG,EACHyF,MAAO,UACPC,gBAAiB,wBACjBvF,WAAY,CACRb,KAAM,SACNc,UAAW,IACXC,QAAS,MAIhB6E,EAAKS,YAQ9B,OACIpF,EAAAlB,cAAA,MAAA,CAAKqB,UAAWC,EAAOiF,cACnBrF,EAAAlB,cAACmB,EAAO4E,OAAM,CACVrG,IAAKiE,EACLsC,QA1HQvB,IAChBA,EAAM8B,kBACNvD,GAAWD,IAyHH3B,UAAW,GAAGC,EAAOmF,WAAWpF,IAAW,gBAC7B,OAAM,gBACL2B,EACfxB,WAAY,CACRZ,MAAO,IACPD,GAAG,EACHyF,MAAO,UACPC,gBAAiB,wBACjBvF,WAAY,CACRb,KAAM,SACNc,UAAW,IACXC,QAAS,MAIhB8B,GAAQ5B,EAAAlB,cAACQ,SAEbuC,EAAS2D,EAAapB,EAAavC,GAAUuC","x_google_ignoreList":[0]}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("react"),t=require("framer-motion"),n=require("react-dom");var r={trigger:"OverflowMenu-module_trigger__imdPK",menu:"OverflowMenu-module_menu__n8uKD",dotsWrapper:"OverflowMenu-module_dotsWrapper__CHO9Q",dot:"OverflowMenu-module_dot__g5Rgi"};!function(e,t){void 0===t&&(t={});var n=t.insertAt;if("undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".OverflowMenu-module_menuWrapper__psD7a{display:inline-block;position:relative;z-index:0}.OverflowMenu-module_trigger__imdPK{align-items:center;background:transparent;border:none;border-radius:50%;color:#024b59;cursor:pointer;display:flex;font-size:1.8rem;height:3rem;justify-content:center;transition:color .2s ease,background-color .2s ease;width:3rem}.OverflowMenu-module_trigger__imdPK:focus,.OverflowMenu-module_trigger__imdPK:hover{background-color:rgba(2,75,89,.05);color:#016a80;outline:none}.OverflowMenu-module_menu__n8uKD{backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);background:hsla(0,0%,100%,.75);border:1px solid #016a80;border-radius:12px;box-shadow:0 8px 24px rgba(0,0,0,.12);color:#024b59;display:flex;flex-direction:column;font-family:Segoe UI,Tahoma,Geneva,Verdana,sans-serif;font-weight:500;gap:.35rem;min-width:180px;padding:.5rem .25rem;width:max-content;z-index:9999}.OverflowMenu-module_menu__n8uKD button{background:transparent;border:none;border-bottom:1px solid rgba(2,75,89,.1);border-radius:8px;color:#024b59;cursor:pointer;font-size:1rem;padding:.6rem 1rem;text-align:left;transition:background .25s ease,transform .12s ease;user-select:none}.OverflowMenu-module_menu__n8uKD button:last-child{border-bottom:none}.OverflowMenu-module_menu__n8uKD button:focus,.OverflowMenu-module_menu__n8uKD button:hover{background:rgba(2,75,89,.05);outline:none;transform:scale(1.03)}.OverflowMenu-module_menu__n8uKD button:active{background:rgba(2,75,89,.1);transform:scale(.98)}.OverflowMenu-module_dotsWrapper__CHO9Q{align-items:center;display:flex;flex-direction:column;gap:3px;justify-content:center}.OverflowMenu-module_dot__g5Rgi{background-color:currentColor;border-radius:50%;display:block;height:5px;width:5px}");const o=()=>{const n={initial:{y:0,scale:1},hover:{y:-4,scale:1.2,transition:{type:"spring",stiffness:500,damping:20}},rest:{y:0,scale:1,transition:{type:"spring",stiffness:500,damping:20}}};return e.createElement(t.motion.div,{className:r.dotsWrapper,initial:"rest",whileHover:"hover",animate:"rest"},[0,1,2].map(o=>e.createElement(t.motion.span,{key:o,className:r.dot,variants:n,custom:o,transition:{delay:.05*o}})))};module.exports=({items:
|
|
1
|
+
"use strict";var e=require("react"),t=require("framer-motion"),n=require("react-dom");var r={trigger:"OverflowMenu-module_trigger__imdPK",menu:"OverflowMenu-module_menu__n8uKD",dotsWrapper:"OverflowMenu-module_dotsWrapper__CHO9Q",dot:"OverflowMenu-module_dot__g5Rgi"};!function(e,t){void 0===t&&(t={});var n=t.insertAt;if("undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".OverflowMenu-module_menuWrapper__psD7a{display:inline-block;position:relative;z-index:0}.OverflowMenu-module_trigger__imdPK{align-items:center;background:transparent;border:none;border-radius:50%;color:#024b59;cursor:pointer;display:flex;font-size:1.8rem;height:3rem;justify-content:center;transition:color .2s ease,background-color .2s ease;width:3rem}.OverflowMenu-module_trigger__imdPK:focus,.OverflowMenu-module_trigger__imdPK:hover{background-color:rgba(2,75,89,.05);color:#016a80;outline:none}.OverflowMenu-module_menu__n8uKD{backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);background:hsla(0,0%,100%,.75);border:1px solid #016a80;border-radius:12px;box-shadow:0 8px 24px rgba(0,0,0,.12);color:#024b59;display:flex;flex-direction:column;font-family:Segoe UI,Tahoma,Geneva,Verdana,sans-serif;font-weight:500;gap:.35rem;min-width:180px;padding:.5rem .25rem;width:max-content;z-index:9999}.OverflowMenu-module_menu__n8uKD button{background:transparent;border:none;border-bottom:1px solid rgba(2,75,89,.1);border-radius:8px;color:#024b59;cursor:pointer;font-size:1rem;padding:.6rem 1rem;text-align:left;transition:background .25s ease,transform .12s ease;user-select:none}.OverflowMenu-module_menu__n8uKD button:last-child{border-bottom:none}.OverflowMenu-module_menu__n8uKD button:focus,.OverflowMenu-module_menu__n8uKD button:hover{background:rgba(2,75,89,.05);outline:none;transform:scale(1.03)}.OverflowMenu-module_menu__n8uKD button:active{background:rgba(2,75,89,.1);transform:scale(.98)}.OverflowMenu-module_dotsWrapper__CHO9Q{align-items:center;display:flex;flex-direction:column;gap:3px;justify-content:center}.OverflowMenu-module_dot__g5Rgi{background-color:currentColor;border-radius:50%;display:block;height:5px;width:5px}");const o=()=>{const n={initial:{y:0,scale:1},hover:{y:-4,scale:1.2,transition:{type:"spring",stiffness:500,damping:20}},rest:{y:0,scale:1,transition:{type:"spring",stiffness:500,damping:20}}};return e.createElement(t.motion.div,{className:r.dotsWrapper,initial:"rest",whileHover:"hover",animate:"rest"},[0,1,2].map(o=>e.createElement(t.motion.span,{key:o,className:r.dot,variants:n,custom:o,transition:{delay:.05*o}})))},i=e=>{if(null==e)return window;const t=e.parentNode;if(t===document.body)return window;const n=window.getComputedStyle(t).overflowY;return"visible"!==n&&"hidden"!==n&&t.scrollHeight>t.clientHeight?t:i(t)};module.exports=({items:a,icon:s,className:l="",portal:d=null})=>{const[u,c]=e.useState(!1),[m,p]=e.useState(!0),[f,g]=e.useState({top:0,left:0}),v=e.useRef(null),b=e.useRef(null),_=()=>{if(b.current&&v.current){const e=b.current.getBoundingClientRect(),t=v.current.getBoundingClientRect(),n=window.innerWidth,r=window.innerHeight;let o=e.bottom,i=e.left;i+t.width>n&&(i=n-t.width-10,i<0&&(i=10)),o+t.height>r&&(o=e.top-t.height-10,o<0&&(o=10)),g({top:o,left:i})}};e.useEffect(()=>{p(!1)},[]);const w=e=>{b.current&&b.current.contains(e.target)||v.current&&!v.current.contains(e.target)&&c(!1)};e.useEffect(()=>(u?document.addEventListener("mousedown",w):document.removeEventListener("mousedown",w),()=>{document.removeEventListener("mousedown",w)}),[u]),e.useLayoutEffect(()=>{u&&_()},[u]),e.useEffect(()=>{if(!u)return;const e=i(b.current),t=()=>{_()};return e.addEventListener("scroll",t),window.addEventListener("resize",t),()=>{e.removeEventListener("scroll",t),window.removeEventListener("resize",t)}},[u]);const h={hidden:{opacity:0,y:-10},visible:{opacity:1,y:0}},y=e.createElement(t.AnimatePresence,null,u&&e.createElement(t.motion.div,{ref:v,className:r.menu,style:{position:"fixed",top:`${f.top}px`,left:`${f.left}px`},variants:{hidden:{opacity:0,scale:.95,transition:{duration:.1}},visible:{opacity:1,scale:1,transition:{duration:.2,staggerChildren:.05}}},initial:!m&&"hidden",animate:"visible",exit:"hidden"},a.map((n,o)=>e.createElement(t.motion.button,{key:o,className:r.menuItem,onClick:()=>{var e;null===(e=n.onClick)||void 0===e||e.call(n),c(!1)},variants:h,whileHover:{scale:1.05,y:-2,color:"#016a80",backgroundColor:"rgba(2, 75, 89, 0.05)",transition:{type:"spring",stiffness:400,damping:15}}},n.content))));return e.createElement("div",{className:r.overflowMenu},e.createElement(t.motion.button,{ref:b,onClick:e=>{e.stopPropagation(),c(!u)},className:`${r.trigger} ${l}`,"aria-haspopup":"true","aria-expanded":u,whileHover:{scale:1.1,y:-2,color:"#016a80",backgroundColor:"rgba(2, 75, 89, 0.05)",transition:{type:"spring",stiffness:400,damping:15}}},s||e.createElement(o,null)),d?n.createPortal(y,d):y)};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../node_modules/style-inject/dist/style-inject.es.js","../src/UI/OverflowMenu.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n",null],"names":["css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","DefaultIcon","dotVariants","initial","y","scale","hover","transition","stiffness","damping","rest","React","motion","div","className","styles","dotsWrapper","whileHover","animate","map","i","span","key","dot","variants","custom","delay","items","icon","portal","isOpen","setIsOpen","useState","isInitialRender","setIsInitialRender","menuPosition","setMenuPosition","top","left","menuRef","useRef","triggerRef","
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../node_modules/style-inject/dist/style-inject.es.js","../src/UI/OverflowMenu.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n",null],"names":["css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","DefaultIcon","dotVariants","initial","y","scale","hover","transition","stiffness","damping","rest","React","motion","div","className","styles","dotsWrapper","whileHover","animate","map","i","span","key","dot","variants","custom","delay","getScrollableParent","node","window","parent","parentNode","body","overflowY","getComputedStyle","scrollHeight","clientHeight","items","icon","portal","isOpen","setIsOpen","useState","isInitialRender","setIsInitialRender","menuPosition","setMenuPosition","top","left","menuRef","useRef","triggerRef","calculatePosition","current","triggerRect","getBoundingClientRect","menuRect","viewportWidth","innerWidth","viewportHeight","innerHeight","bottom","width","height","useEffect","handleClickOutside","event","contains","target","addEventListener","removeEventListener","useLayoutEffect","scrollableParent","handleScroll","itemVariants","hidden","opacity","visible","menuContent","AnimatePresence","menu","position","duration","staggerChildren","exit","item","index","button","menuItem","onClick","_a","call","color","backgroundColor","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