@zanichelli/albe-web-components 6.6.3 → 6.6.4
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/cjs/z-popover.cjs.entry.js +13 -6
- package/dist/collection/components/z-popover/index.js +13 -5
- package/dist/esm/z-popover.entry.js +13 -6
- package/dist/types/components/z-popover/index.d.ts +6 -0
- package/dist/web-components-library/p-32509af7.entry.js +1 -0
- package/dist/web-components-library/web-components-library.css +1 -1
- package/dist/web-components-library/web-components-library.esm.js +1 -1
- package/package.json +2 -2
- package/www/build/p-32509af7.entry.js +1 -0
- package/www/build/{p-4007b6ff.js → p-ada08699.js} +1 -1
- package/www/build/web-components-library.css +1 -1
- package/www/build/web-components-library.esm.js +1 -1
- package/www/index.html +1 -1
- package/CHANGELOG.md +0 -2176
- package/dist/web-components-library/p-dd000757.entry.js +0 -1
- package/src-react/index.ts +0 -1
- package/www/build/p-dd000757.entry.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as o,h as e,g as r}from"./p-d17ebc2f.js";import{P as i,e as s}from"./p-a23e9115.js";import{a as n}from"./p-8ebe4adf.js";import"./p-d69e14fb.js";const a=document.documentElement;function p(t){return t.parentNode.host?t.parentNode.host:t.parentNode}function h(t,o){const e=t.getBoundingClientRect(),r=e.width,i=e.height;let s,n,a=0,p=0,h=t;for(;h&&h!=o;){if(p+=h.offsetLeft,h===document.body?a+=h.getBoundingClientRect().top+window.scrollY:a+=h.offsetTop,window.DOMMatrix){const t=window.getComputedStyle(h),o=new DOMMatrix(t.transform||t.webkitTransform);o&&(p+=o.m41,h!==document.body&&(a+=o.m42))}if(!h.offsetParent)break;h=h.offsetParent}return h===document.body?(s=window.innerWidth,n=window.innerHeight):(s=h.offsetWidth,n=h.offsetHeight),{top:a,right:s-p-e.width,bottom:n-a-e.height,left:p,width:r,height:i}}const c=class{constructor(e){t(this,e),this.positionChange=o(this,"positionChange",7),this.openChange=o(this,"openChange",7),this.position=i.AUTO,this.open=!1,this.showArrow=!1,this.center=!1,this.closable=!0}closePopoverWithKeyboard(t){this.closable&&t.key===s.ESC&&(this.open=!1)}handleOutsideClick(t){this.closable&&(n(t.target).find((t=>"z-popover"===t.nodeName.toLowerCase()))||(this.open=!1,this.positionChange.emit({position:this.currentPosition})))}validatePosition(t){t&&!Object.values(i).includes(t)&&(this.position=i.AUTO),this.currentPosition=this.position,this.positionChange.emit({position:this.currentPosition})}onOpen(){if(cancelAnimationFrame(this.animationFrameRequestId),this.open){const t=()=>{this.open&&(this.setPosition(),this.animationFrameRequestId=requestAnimationFrame(t))};t()}else this.host.hasAttribute("current-position")&&(this.host.removeAttribute("current-position"),this.currentPosition=void 0);this.openChange.emit({open:this.open})}disconnectedCallback(){cancelAnimationFrame(this.animationFrameRequestId)}setPosition(){let t;if(t="string"==typeof this.bindTo?this.host.ownerDocument.querySelector(this.bindTo):this.bindTo?this.bindTo:this.host.parentElement,!t)return;const o=function(t){let o=p(t);for(;o&&o!==a;){const{overflow:t,overflowX:e,overflowY:r}=window.getComputedStyle(o);if("hidden"===t||"hidden"===r||"hidden"===e)return o;if(o.scrollHeight>o.clientHeight&&"visible"!==t&&"visible"!==r||o.scrollWidth>o.clientWidth&&"visible"!==t&&"visible"!==e)return o;o=p(o)}return a}(t),e=o.getBoundingClientRect(),r=this.host.offsetParent,s=r?h(r,o):{top:0,right:0,bottom:0,left:0},n=h(t,o),c=n.top-o.scrollTop,f=e.height-(n.top+n.height)+o.scrollTop,u=n.left-o.scrollLeft,l=e.width-(n.left+n.width)+o.scrollLeft,d=Math.max(0,e.top+e.height-window.innerHeight),b=Math.max(0,e.left+e.width-window.innerWidth),v=Math.min(c,c+e.top),w=Math.min(f,f-d),m=Math.min(u,u+e.left),g=Math.min(l,l-b),x=v+w+n.height,$=m+g+n.width;let z=this.currentPosition;const y=[];this.position===i.AUTO&&(m/$>.6?y.push(i.LEFT):m/$<.4&&y.push(i.RIGHT),v/x>.9?y.unshift(i.TOP):v/x>.6?y.push(i.TOP):v/x<.1?y.unshift(i.BOTTOM):y.push(i.BOTTOM),z=y.join("_"));const _=this.host.style;_.position="absolute";const M=n.top-s.top,j=n.right-s.right,k=n.bottom-s.bottom,O=n.left-s.left,P=this.center?.5:0,C=this.center?.5:0;z===i.TOP||z===i.TOP_RIGHT?(_.top="auto",_.right="auto",_.bottom=`${k+n.height}px`,_.left=`${O+n.width*P}px`,_.maxHeight=`${v}px`,z===i.TOP_RIGHT&&(_.maxWidth=`${g+n.width*C}px`)):z===i.TOP_LEFT?(_.top="auto",_.right=`${j+n.width*P}px`,_.bottom=`${k+n.height}px`,_.left="auto",_.maxWidth=`${m}px`,_.maxHeight=`${v}px`):z===i.BOTTOM||z===i.BOTTOM_RIGHT?(_.top=`${M+n.height}px`,_.right="auto",_.bottom="auto",_.left=`${O+n.width*P}px`,_.maxHeight=`${w}px`,z===i.BOTTOM_RIGHT&&(_.maxWidth=`${g+n.width*C}px`)):z===i.BOTTOM_LEFT?(_.top=`${M+n.height}px`,_.right=`${j+n.width*P}px`,_.bottom="auto",_.left="auto",_.maxWidth=`${m}px`,_.maxHeight=`${w}px`):z===i.RIGHT||z===i.RIGHT_BOTTOM?(_.top=`${M+n.height*P}px`,_.right="auto",_.bottom="auto",_.left=`${O+n.width}px`,_.maxWidth=`${g}px`,_.maxHeight=`${w+n.height*C}px`):z===i.RIGHT_TOP?(_.top="auto",_.right="auto",_.bottom=`${k+n.height*P}px`,_.left=`${O+n.width}px`,_.maxWidth=`${g}px`,_.maxHeight=`${v+n.height*C}px`):z===i.LEFT||z===i.LEFT_BOTTOM?(_.top=`${M+n.height*P}px`,_.right=`${j+n.width}px`,_.bottom="auto",_.left="auto",_.maxWidth=`${m}px`,_.maxHeight=`${w+n.height*C}px`):z===i.LEFT_TOP&&(_.top="auto",_.right=`${j+n.width}px`,_.bottom=`${k+n.height*P}px`,_.left="auto",_.maxWidth=`${m}px`,_.maxHeight=`${v+n.height*C}px`),this.currentPosition=z||this.position,this.host.setAttribute("current-position",this.currentPosition)}componentWillLoad(){this.validatePosition(this.position),this.onOpen()}render(){return e("slot",null)}get host(){return r(this)}static get watchers(){return{position:["validatePosition"],open:["onOpen"]}}};c.style=':host{--z-popover-theme--surface:var(--color-surface01);--z-popover-theme--text:var(--color-text01);--z-popover-padding:0;--z-popover-shadow-filter:drop-shadow(0 1px 2px var(--shadow-color-base));position:relative;display:none;min-width:calc(var(--space-unit) * 8);min-height:calc(var(--space-unit) * 4);align-items:center;justify-content:center;padding:var(--z-popover-padding);background:var(--z-popover-theme--surface);border-radius:var(--border-radius-small);color:var(--z-popover-theme--text);fill:currentcolor;filter:var(--z-popover-shadow-filter);font-family:var(--font-family-sans);text-align:center}:host([open][current-position]),:host([open="true"][current-position]){display:flex}:host([center][current-position="top"]),:host([center][current-position="bottom"]){transform:translateX(-50%)}:host([center][current-position="right"]),:host([center][current-position="left"]){transform:translateY(-50%)}:host([current-position^="top"]){margin:0 0 var(--space-unit)}:host([current-position^="bottom"]){margin:var(--space-unit) 0 0}:host([current-position^="left"]){margin:0 var(--space-unit) 0 0}:host([current-position^="right"]){margin:0 0 0 var(--space-unit)}:host([current-position])::before{--arrow-size:6px;--arrow-edge-offset:calc(100% - var(--space-unit) - (var(--arrow-size) / 2));--arrow-center-x-offset:calc(50% - (var(--arrow-size) / 2));--arrow-center-y-offset:calc(100% - (var(--arrow-size) / 2));position:absolute;display:block;width:var(--arrow-size);height:var(--arrow-size);background:var(--z-popover-theme--surface);content:"";transform:rotate(45deg)}:host([show-arrow="false"])::before,:host(:not([show-arrow]))::before{display:none}:host([current-position^="top"])::before{top:var(--arrow-center-y-offset)}:host([current-position^="bottom"])::before{bottom:var(--arrow-center-y-offset)}:host([current-position="top"])::before,:host([current-position="bottom"])::before{right:var(--arrow-edge-offset)}:host([current-position="right"])::before,:host([current-position="left"])::before{bottom:var(--arrow-edge-offset)}:host([current-position="right"])::before{right:var(--arrow-center-y-offset)}:host([current-position="left"])::before{left:var(--arrow-center-y-offset)}:host([current-position="top_right"])::before,:host([current-position="bottom_right"])::before{right:var(--arrow-edge-offset)}:host([current-position="top_left"])::before,:host([current-position="bottom_left"])::before{left:var(--arrow-edge-offset)}:host([current-position="right_top"])::before,:host([current-position="left_top"])::before{top:var(--arrow-edge-offset)}:host([current-position="right_top"])::before,:host([current-position="right_bottom"])::before{right:var(--arrow-center-y-offset)}:host([current-position="left_top"])::before,:host([current-position="left_bottom"])::before{left:var(--arrow-center-y-offset)}:host([current-position="right_bottom"])::before,:host([current-position="left_bottom"])::before{bottom:var(--arrow-edge-offset)}:host([center][current-position="top"])::before,:host([center][current-position="bottom"])::before{right:auto;left:var(--arrow-center-x-offset)}:host([center][current-position="right"])::before,:host([center][current-position="left"])::before{top:var(--arrow-center-x-offset);bottom:auto}::slotted(*){overflow:auto;flex:1 auto}';export{c as z_popover}
|
package/src-react/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./components";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as o,h as e,g as r}from"./p-d17ebc2f.js";import{P as i,e as s}from"./p-a23e9115.js";import{a as n}from"./p-8ebe4adf.js";import"./p-d69e14fb.js";const a=document.documentElement;function p(t){return t.parentNode.host?t.parentNode.host:t.parentNode}function h(t,o){const e=t.getBoundingClientRect(),r=e.width,i=e.height;let s,n,a=0,p=0,h=t;for(;h&&h!=o;){if(p+=h.offsetLeft,h===document.body?a+=h.getBoundingClientRect().top+window.scrollY:a+=h.offsetTop,window.DOMMatrix){const t=window.getComputedStyle(h),o=new DOMMatrix(t.transform||t.webkitTransform);o&&(p+=o.m41,h!==document.body&&(a+=o.m42))}if(!h.offsetParent)break;h=h.offsetParent}return h===document.body?(s=window.innerWidth,n=window.innerHeight):(s=h.offsetWidth,n=h.offsetHeight),{top:a,right:s-p-e.width,bottom:n-a-e.height,left:p,width:r,height:i}}const c=class{constructor(e){t(this,e),this.positionChange=o(this,"positionChange",7),this.openChange=o(this,"openChange",7),this.position=i.AUTO,this.open=!1,this.showArrow=!1,this.center=!1,this.closable=!0}closePopoverWithKeyboard(t){this.closable&&t.key===s.ESC&&(this.open=!1)}handleOutsideClick(t){this.closable&&(n(t.target).find((t=>"z-popover"===t.nodeName.toLowerCase()))||(this.open=!1,this.positionChange.emit({position:this.currentPosition})))}validatePosition(t){t&&!Object.values(i).includes(t)&&(this.position=i.AUTO),this.currentPosition=this.position,this.positionChange.emit({position:this.currentPosition})}onOpen(){if(cancelAnimationFrame(this.animationFrameRequestId),this.open){const t=()=>{this.open&&(this.setPosition(),this.animationFrameRequestId=requestAnimationFrame(t))};t()}else this.host.hasAttribute("current-position")&&(this.host.removeAttribute("current-position"),this.currentPosition=void 0);this.openChange.emit({open:this.open})}disconnectedCallback(){cancelAnimationFrame(this.animationFrameRequestId)}setPosition(){let t;if(t="string"==typeof this.bindTo?this.host.ownerDocument.querySelector(this.bindTo):this.bindTo?this.bindTo:this.host.parentElement,!t)return;const o=function(t){let o=p(t);for(;o&&o!==a;){const{overflow:t,overflowX:e,overflowY:r}=window.getComputedStyle(o);if("hidden"===t||"hidden"===r||"hidden"===e)return o;if(o.scrollHeight>o.clientHeight&&"visible"!==t&&"visible"!==r||o.scrollWidth>o.clientWidth&&"visible"!==t&&"visible"!==e)return o;o=p(o)}return a}(t),e=o.getBoundingClientRect(),r=this.host.offsetParent,s=r?h(r,o):{top:0,right:0,bottom:0,left:0},n=h(t,o),c=n.top-o.scrollTop,f=e.height-(n.top+n.height)+o.scrollTop,u=n.left-o.scrollLeft,l=e.width-(n.left+n.width)+o.scrollLeft,d=Math.max(0,e.top+e.height-window.innerHeight),b=Math.max(0,e.left+e.width-window.innerWidth),v=Math.min(c,c+e.top),w=Math.min(f,f-d),m=Math.min(u,u+e.left),g=Math.min(l,l-b),x=v+w+n.height,$=m+g+n.width;let z=this.currentPosition;const y=[];this.position===i.AUTO&&(m/$>.6?y.push(i.LEFT):m/$<.4&&y.push(i.RIGHT),v/x>.9?y.unshift(i.TOP):v/x>.6?y.push(i.TOP):v/x<.1?y.unshift(i.BOTTOM):y.push(i.BOTTOM),z=y.join("_"));const _=this.host.style;_.position="absolute";const M=n.top-s.top,j=n.right-s.right,k=n.bottom-s.bottom,O=n.left-s.left,P=this.center?.5:0,C=this.center?.5:0;z===i.TOP||z===i.TOP_RIGHT?(_.top="auto",_.right="auto",_.bottom=`${k+n.height}px`,_.left=`${O+n.width*P}px`,_.maxHeight=`${v}px`,z===i.TOP_RIGHT&&(_.maxWidth=`${g+n.width*C}px`)):z===i.TOP_LEFT?(_.top="auto",_.right=`${j+n.width*P}px`,_.bottom=`${k+n.height}px`,_.left="auto",_.maxWidth=`${m}px`,_.maxHeight=`${v}px`):z===i.BOTTOM||z===i.BOTTOM_RIGHT?(_.top=`${M+n.height}px`,_.right="auto",_.bottom="auto",_.left=`${O+n.width*P}px`,_.maxHeight=`${w}px`,z===i.BOTTOM_RIGHT&&(_.maxWidth=`${g+n.width*C}px`)):z===i.BOTTOM_LEFT?(_.top=`${M+n.height}px`,_.right=`${j+n.width*P}px`,_.bottom="auto",_.left="auto",_.maxWidth=`${m}px`,_.maxHeight=`${w}px`):z===i.RIGHT||z===i.RIGHT_BOTTOM?(_.top=`${M+n.height*P}px`,_.right="auto",_.bottom="auto",_.left=`${O+n.width}px`,_.maxWidth=`${g}px`,_.maxHeight=`${w+n.height*C}px`):z===i.RIGHT_TOP?(_.top="auto",_.right="auto",_.bottom=`${k+n.height*P}px`,_.left=`${O+n.width}px`,_.maxWidth=`${g}px`,_.maxHeight=`${v+n.height*C}px`):z===i.LEFT||z===i.LEFT_BOTTOM?(_.top=`${M+n.height*P}px`,_.right=`${j+n.width}px`,_.bottom="auto",_.left="auto",_.maxWidth=`${m}px`,_.maxHeight=`${w+n.height*C}px`):z===i.LEFT_TOP&&(_.top="auto",_.right=`${j+n.width}px`,_.bottom=`${k+n.height*P}px`,_.left="auto",_.maxWidth=`${m}px`,_.maxHeight=`${v+n.height*C}px`),this.currentPosition=z||this.position,this.host.setAttribute("current-position",this.currentPosition)}componentWillLoad(){this.validatePosition(this.position),this.onOpen()}render(){return e("slot",null)}get host(){return r(this)}static get watchers(){return{position:["validatePosition"],open:["onOpen"]}}};c.style=':host{--z-popover-theme--surface:var(--color-surface01);--z-popover-theme--text:var(--color-text01);--z-popover-padding:0;--z-popover-shadow-filter:drop-shadow(0 1px 2px var(--shadow-color-base));position:relative;display:none;min-width:calc(var(--space-unit) * 8);min-height:calc(var(--space-unit) * 4);align-items:center;justify-content:center;padding:var(--z-popover-padding);background:var(--z-popover-theme--surface);border-radius:var(--border-radius-small);color:var(--z-popover-theme--text);fill:currentcolor;filter:var(--z-popover-shadow-filter);font-family:var(--font-family-sans);text-align:center}:host([open][current-position]),:host([open="true"][current-position]){display:flex}:host([center][current-position="top"]),:host([center][current-position="bottom"]){transform:translateX(-50%)}:host([center][current-position="right"]),:host([center][current-position="left"]){transform:translateY(-50%)}:host([current-position^="top"]){margin:0 0 var(--space-unit)}:host([current-position^="bottom"]){margin:var(--space-unit) 0 0}:host([current-position^="left"]){margin:0 var(--space-unit) 0 0}:host([current-position^="right"]){margin:0 0 0 var(--space-unit)}:host([current-position])::before{--arrow-size:6px;--arrow-edge-offset:calc(100% - var(--space-unit) - (var(--arrow-size) / 2));--arrow-center-x-offset:calc(50% - (var(--arrow-size) / 2));--arrow-center-y-offset:calc(100% - (var(--arrow-size) / 2));position:absolute;display:block;width:var(--arrow-size);height:var(--arrow-size);background:var(--z-popover-theme--surface);content:"";transform:rotate(45deg)}:host([show-arrow="false"])::before,:host(:not([show-arrow]))::before{display:none}:host([current-position^="top"])::before{top:var(--arrow-center-y-offset)}:host([current-position^="bottom"])::before{bottom:var(--arrow-center-y-offset)}:host([current-position="top"])::before,:host([current-position="bottom"])::before{right:var(--arrow-edge-offset)}:host([current-position="right"])::before,:host([current-position="left"])::before{bottom:var(--arrow-edge-offset)}:host([current-position="right"])::before{right:var(--arrow-center-y-offset)}:host([current-position="left"])::before{left:var(--arrow-center-y-offset)}:host([current-position="top_right"])::before,:host([current-position="bottom_right"])::before{right:var(--arrow-edge-offset)}:host([current-position="top_left"])::before,:host([current-position="bottom_left"])::before{left:var(--arrow-edge-offset)}:host([current-position="right_top"])::before,:host([current-position="left_top"])::before{top:var(--arrow-edge-offset)}:host([current-position="right_top"])::before,:host([current-position="right_bottom"])::before{right:var(--arrow-center-y-offset)}:host([current-position="left_top"])::before,:host([current-position="left_bottom"])::before{left:var(--arrow-center-y-offset)}:host([current-position="right_bottom"])::before,:host([current-position="left_bottom"])::before{bottom:var(--arrow-edge-offset)}:host([center][current-position="top"])::before,:host([center][current-position="bottom"])::before{right:auto;left:var(--arrow-center-x-offset)}:host([center][current-position="right"])::before,:host([center][current-position="left"])::before{top:var(--arrow-center-x-offset);bottom:auto}::slotted(*){overflow:auto;flex:1 auto}';export{c as z_popover}
|