jattac.libs.web.overflow-menu 0.0.25 → 0.0.27
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:u,icon:c,className:m="",portal:p=null})=>{const[f,g]=t(!1),[b,_]=t(!0),[v,h]=t({top:0,left:0}),w=n(null),
|
|
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:u,icon:c,className:m="",portal:p=null})=>{const[f,g]=t(!1),[b,_]=t(!0),[v,h]=t({top:0,left:0}),[w,y]=t({x:0,y:0}),x=n(null),k=n(null);r(()=>{_(!1)},[]);const O=e=>{k.current&&k.current.contains(e.target)||x.current&&!x.current.contains(e.target)&&g(!1)};r(()=>(f?document.addEventListener("mousedown",O):document.removeEventListener("mousedown",O),()=>{document.removeEventListener("mousedown",O)}),[f]),o(()=>{if(f&&x.current){const e=x.current.getBoundingClientRect(),t=window.innerWidth,n=window.innerHeight;let r=w.y,o=w.x;o+e.width>t&&(o=t-e.width-10),r+e.height>n&&(r=n-e.height-10),o<0&&(o=10),r<0&&(r=10),h({top:r,left:o})}},[f,w]);const M={hidden:{opacity:0,y:-10},visible:{opacity:1,y:0}},C=e.createElement(i,null,f&&e.createElement(a.div,{ref:x,className:s.menu,style:{position:"fixed",top:`${v.top}px`,left:`${v.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"},u.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),g(!1)},variants:M,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:k,onClick:e=>{e.stopPropagation(),y({x:e.clientX,y:e.clientY}),g(!f)},className:`${s.trigger} ${m}`,"aria-haspopup":"true","aria-expanded":f,whileHover:{scale:1.1,y:-2,color:"#016a80",backgroundColor:"rgba(2, 75, 89, 0.05)",transition:{type:"spring",stiffness:400,damping:15}}},c||e.createElement(d,null)),p?l(C,p):C)};export{u 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","useEffect","handleClickOutside","event","current","contains","target","addEventListener","removeEventListener","useLayoutEffect","
|
|
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","clickPosition","setClickPosition","x","menuRef","useRef","triggerRef","useEffect","handleClickOutside","event","current","contains","target","addEventListener","removeEventListener","useLayoutEffect","menuRect","getBoundingClientRect","viewportWidth","window","innerWidth","viewportHeight","innerHeight","width","height","itemVariants","hidden","opacity","visible","menuContent","AnimatePresence","menu","position","duration","staggerChildren","exit","item","index","button","menuItem","onClick","_a","call","color","backgroundColor","content","overflowMenu","stopPropagation","clientX","clientY","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,GAAG,EACHC,MAAO,IACPE,WAAY,CACRb,KAAM,SACNc,UAAW,IACXC,QAAS,KAGjBC,KAAM,CACFN,EAAG,EACHC,MAAO,EACPE,WAAY,CACRb,KAAM,SACNc,UAAW,IACXC,QAAS,MAKrB,OACIE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ACH8E,MAAO,UACPC,gBAAiB,wBACjB5E,WAAY,CACRb,KAAM,SACNc,UAAW,IACXC,QAAS,MAIhBoB,GAAQlB,EAAAlB,cAACQ,SAEb6B,EAAS4D,EAAatB,EAAatC,GAAUsC","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:i,icon:a,className:l="",portal:s=null})=>{const[u,d]=e.useState(!1),[c,m]=e.useState(!0),[p,f]=e.useState({top:0,left:0}),g=e.useRef(null),
|
|
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:i,icon:a,className:l="",portal:s=null})=>{const[u,d]=e.useState(!1),[c,m]=e.useState(!0),[p,f]=e.useState({top:0,left:0}),[g,b]=e.useState({x:0,y:0}),v=e.useRef(null),_=e.useRef(null);e.useEffect(()=>{m(!1)},[]);const h=e=>{_.current&&_.current.contains(e.target)||v.current&&!v.current.contains(e.target)&&d(!1)};e.useEffect(()=>(u?document.addEventListener("mousedown",h):document.removeEventListener("mousedown",h),()=>{document.removeEventListener("mousedown",h)}),[u]),e.useLayoutEffect(()=>{if(u&&v.current){const e=v.current.getBoundingClientRect(),t=window.innerWidth,n=window.innerHeight;let r=g.y,o=g.x;o+e.width>t&&(o=t-e.width-10),r+e.height>n&&(r=n-e.height-10),o<0&&(o=10),r<0&&(r=10),f({top:r,left:o})}},[u,g]);const y={hidden:{opacity:0,y:-10},visible:{opacity:1,y:0}},w=e.createElement(t.AnimatePresence,null,u&&e.createElement(t.motion.div,{ref:v,className:r.menu,style:{position:"fixed",top:`${p.top}px`,left:`${p.left}px`},variants:{hidden:{opacity:0,scale:.95,transition:{duration:.1}},visible:{opacity:1,scale:1,transition:{duration:.2,staggerChildren:.05}}},initial:!c&&"hidden",animate:"visible",exit:"hidden"},i.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),d(!1)},variants:y,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:_,onClick:e=>{e.stopPropagation(),b({x:e.clientX,y:e.clientY}),d(!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}}},a||e.createElement(o,null)),s?n.createPortal(w,s):w)};
|
|
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","useEffect","handleClickOutside","event","current","contains","target","addEventListener","removeEventListener","useLayoutEffect","
|
|
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","clickPosition","setClickPosition","x","menuRef","useRef","triggerRef","useEffect","handleClickOutside","event","current","contains","target","addEventListener","removeEventListener","useLayoutEffect","menuRect","getBoundingClientRect","viewportWidth","window","innerWidth","viewportHeight","innerHeight","width","height","itemVariants","hidden","opacity","visible","menuContent","AnimatePresence","menu","position","duration","staggerChildren","exit","item","index","button","menuItem","onClick","_a","call","color","backgroundColor","content","overflowMenu","stopPropagation","clientX","clientY","trigger","createPortal"],"mappings":"6QAAA,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,GAAG,EACHC,MAAO,IACPE,WAAY,CACRb,KAAM,SACNc,UAAW,IACXC,QAAS,KAGjBC,KAAM,CACFN,EAAG,EACHC,MAAO,EACPE,WAAY,CACRb,KAAM,SACNc,UAAW,IACXC,QAAS,MAKrB,OACIE,EAAAlB,cAACmB,SAAOC,KACJC,UAAWC,EAAOC,YAClBb,QAAQ,OACRc,WAAW,QACXC,QA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