jattac.libs.web.overflow-menu 0.0.20 → 0.0.22
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 o,useRef as
|
|
1
|
+
import e,{useState as o,useRef as r,useEffect as n}from"react";import{createPortal as t}from"react-dom";var a={trigger:"OverflowMenu-module_trigger__imdPK",menu:"OverflowMenu-module_menu__n8uKD"};!function(e,o){void 0===o&&(o={});var r=o.insertAt;if("undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style");t.type="text/css","top"===r&&n.firstChild?n.insertBefore(t,n.firstChild):n.appendChild(t),t.styleSheet?t.styleSheet.cssText=e:t.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;margin-top:.5rem;min-width:180px;padding:.5rem .25rem;position:absolute;right:0;top:100%;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 l=({items:l,icon:u="⋮",className:i="",portal:d=null})=>{const[m,s]=o(!1),c=r(null),p=r(null),f=e=>{c.current&&!c.current.contains(e.target)&&s(!1)};n(()=>(m?document.addEventListener("mousedown",f):document.removeEventListener("mousedown",f),()=>{document.removeEventListener("mousedown",f)}),[m]);const g=e.createElement(e.Fragment,null,m&&e.createElement("div",{ref:c,className:a.menu},l.map((o,r)=>e.createElement("button",{key:r,className:a.menuItem,onClick:()=>{var e;null===(e=o.onClick)||void 0===e||e.call(o),s(!1)}},o.content))));return e.createElement("div",{className:a.overflowMenu},e.createElement("button",{ref:p,onClick:e=>{e.stopPropagation(),s(!m)},className:`${a.trigger} ${i}`,"aria-haspopup":"true","aria-expanded":m},u),d?t(g,d):g)};export{l 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","OverflowMenu","items","icon","className","portal","isOpen","setIsOpen","useState","menuRef","useRef","triggerRef","handleClickOutside","event","current","contains","target","useEffect","addEventListener","removeEventListener","
|
|
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","OverflowMenu","items","icon","className","portal","isOpen","setIsOpen","useState","menuRef","useRef","triggerRef","handleClickOutside","event","current","contains","target","useEffect","addEventListener","removeEventListener","menuContent","React","Fragment","styles","menu","map","item","index","key","menuItem","onClick","_a","call","content","overflowMenu","stopPropagation","trigger","createPortal"],"mappings":"qMAAA,SAAqBA,EAAKC,QACX,IAARA,IAAiBA,EAAM,CAAA,GAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAgC,oBAAbC,SAAnB,CAEA,IAAIC,EAAOD,SAASC,MAAQD,SAASE,qBAAqB,QAAQ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ict";var e=require("react"),r=require("
|
|
1
|
+
"use strict";var e=require("react"),r=require("react-dom");var o={trigger:"OverflowMenu-module_trigger__imdPK",menu:"OverflowMenu-module_menu__n8uKD"};!function(e,r){void 0===r&&(r={});var o=r.insertAt;if("undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style");t.type="text/css","top"===o&&n.firstChild?n.insertBefore(t,n.firstChild):n.appendChild(t),t.styleSheet?t.styleSheet.cssText=e:t.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;margin-top:.5rem;min-width:180px;padding:.5rem .25rem;position:absolute;right:0;top:100%;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}");module.exports=({items:n,icon:t="⋮",className:a="",portal:u=null})=>{const[l,i]=e.useState(!1),d=e.useRef(null),s=e.useRef(null),m=e=>{d.current&&!d.current.contains(e.target)&&i(!1)};e.useEffect(()=>(l?document.addEventListener("mousedown",m):document.removeEventListener("mousedown",m),()=>{document.removeEventListener("mousedown",m)}),[l]);const c=e.createElement(e.Fragment,null,l&&e.createElement("div",{ref:d,className:o.menu},n.map((r,n)=>e.createElement("button",{key:n,className:o.menuItem,onClick:()=>{var e;null===(e=r.onClick)||void 0===e||e.call(r),i(!1)}},r.content))));return e.createElement("div",{className:o.overflowMenu},e.createElement("button",{ref:s,onClick:e=>{e.stopPropagation(),i(!l)},className:`${o.trigger} ${a}`,"aria-haspopup":"true","aria-expanded":l},t),u?r.createPortal(c,u):c)};
|
|
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","items","icon","className","portal","isOpen","setIsOpen","useState","menuRef","useRef","triggerRef","handleClickOutside","event","current","contains","target","useEffect","addEventListener","removeEventListener","
|
|
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","items","icon","className","portal","isOpen","setIsOpen","useState","menuRef","useRef","triggerRef","handleClickOutside","event","current","contains","target","useEffect","addEventListener","removeEventListener","menuContent","React","Fragment","styles","menu","map","item","index","key","menuItem","onClick","_a","call","content","overflowMenu","stopPropagation","trigger","createPortal"],"mappings":"wJAAA,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,+xDCbkD,EAC9Ce,QACAC,OAAO,IACPC,YAAY,GACZC,SAAS,SAET,MAAOC,EAAQC,G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