@zag-js/tooltip
Advanced tools
Comparing version 0.0.0-dev-20220407084218 to 0.0.0-dev-20220408111010
@@ -1,2 +0,2 @@ | ||
var y=Object.defineProperty,Z=Object.defineProperties,J=Object.getOwnPropertyDescriptor,Q=Object.getOwnPropertyDescriptors,ee=Object.getOwnPropertyNames,I=Object.getOwnPropertySymbols;var S=Object.prototype.hasOwnProperty,te=Object.prototype.propertyIsEnumerable;var x=(e,t,n)=>t in e?y(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,A=(e,t)=>{for(var n in t||(t={}))S.call(t,n)&&x(e,n,t[n]);if(I)for(var n of I(t))te.call(t,n)&&x(e,n,t[n]);return e},C=(e,t)=>Z(e,Q(t)),ne=e=>y(e,"__esModule",{value:!0});var oe=(e,t)=>{for(var n in t)y(e,n,{get:t[n],enumerable:!0})},re=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ee(t))!S.call(e,r)&&(n||r!=="default")&&y(e,r,{get:()=>t[r],enumerable:!(o=J(t,r))||o.enumerable});return e};var ie=(e=>(t,n)=>e&&e.get(t)||(n=re(ne({}),t,1),e&&e.set(t,n),n))(typeof WeakMap!="undefined"?new WeakMap:0);var Oe={};oe(Oe,{connect:()=>z,machine:()=>G});var D=e=>e?"":void 0;var R=new WeakMap;function le(e){var t;if(!e)return{};let n=R.get(e);return n||(n=((t=e==null?void 0:e.ownerDocument.defaultView)!=null?t:window).getComputedStyle(e),R.set(e,n)),n}function N(e){let t=globalThis.requestAnimationFrame(e);return function(){globalThis.cancelAnimationFrame(t)}}var ae=()=>{};var Se=(()=>{let e=0;return()=>(e++,e.toString(36))})();var m=new Map,p=new Map;function se(e,t,n,o){var r;if(!e)return ae;let i=JSON.stringify({type:t,options:o}),c=m.get(e);if(m.has(e))(c==null?void 0:c.has(i))?(r=c==null?void 0:c.get(i))==null||r.add(n):c==null||c.set(i,new Set([n]));else{let a=new Map([[i,new Set([n])]]);m.set(e,a)}function h(a){var g,f;function u(d){var E;let O=m.get(a);(E=O==null?void 0:O.get(i))==null||E.forEach(X=>X(d))}if(!(p==null?void 0:p.has(a))){p.set(a,new Map([[i,u]])),a.addEventListener(t,u,o);return}((g=p==null?void 0:p.get(a))==null?void 0:g.has(i))||((f=p.get(a))==null||f.set(i,u),a.addEventListener(t,u,o))}return h(e),function(){var a,g,f,u;if(!m.has(e))return;let d=m.get(e);if((a=d==null?void 0:d.get(i))==null||a.delete(n),((g=d==null?void 0:d.get(i))==null?void 0:g.size)===0){let E=(f=p.get(e))==null?void 0:f.get(i);e.removeEventListener(t,E,o),d==null||d.delete(i),(u=p.get(e))==null||u.delete(i),(d==null?void 0:d.size)===0&&(m.delete(e),p.delete(e))}}}var P=e=>Object.prototype.toString.call(e).slice(8,-1),ce=e=>P(e)==="Object"&&"current"in e,ue=e=>P(e)==="Function"?e():e,de=e=>P(e)==="Object"&&!!e.touches,pe={pageX:0,pageY:0,clientX:0,clientY:0};function fe(e,t="page"){let n=de(e)?e.touches[0]||e.changedTouches[0]||pe:e;return{point:{x:n[`${t}X`],y:n[`${t}Y`]}}}function w(e,t,n,o){let r=ce(e)?e.current:ue(e);return se(r,t,n,o)}function _(e,t,n,o){var r;let i=(r=be(t))!=null?r:t;return w(e,i,ge(n,t==="pointerdown"),o)}function ge(e,t=!1){let n=o=>{e(o,fe(o))};return t?me(n):n}function me(e){return t=>{var n;let o=(n=t.view)!=null?n:window,r=t instanceof o.MouseEvent;(!r||r&&t.button===0)&&e(t)}}var ve=()=>typeof window!="undefined"&&window.onpointerdown===null,he=()=>typeof window!="undefined"&&window.ontouchstart===null,Ee=()=>typeof window!="undefined"&&window.onmousedown===null,ye={pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointercancel:"mousecancel",pointerover:"mouseover",pointerout:"mouseout",pointerenter:"mouseenter",pointerleave:"mouseleave"},we={pointerdown:"touchstart",pointermove:"touchmove",pointerup:"touchend",pointercancel:"touchcancel"};function be(e){return ve()?e:he()?we[e]:Ee()?ye[e]:e}function L(e){var t;return F(e)?e.document:(t=e==null?void 0:e.ownerDocument)!=null?t:document}function Pe(e){var t;return(t=e==null?void 0:e.ownerDocument.defaultView)!=null?t:window}function M(e){return F(e)?"":e&&e.localName||""}function V(e){let t=L(e);return M(e)==="html"?e:e.assignedSlot||e.parentElement||t.documentElement}function T(e){return typeof e=="object"&&(e==null?void 0:e.nodeType)===Node.ELEMENT_NODE&&typeof(e==null?void 0:e.nodeName)=="string"}function F(e){return(e==null?void 0:e.toString())==="[object Window]"}function H(e){let{overflow:t,overflowX:n,overflowY:o}=le(e);return/auto|scroll|overlay|hidden/.test(t+o+n)}function b(e){return["html","body","#document"].includes(M(e))?L(e).body:T(e)&&H(e)?e:b(V(e))}function k(e,t=[]){let n=b(e),o=n===L(e).body,r=Pe(n),i=o?[r].concat(r.visualViewport||[],H(n)?n:[]):n,c=t.concat(i);return o?c:c.concat(k(V(i)))}var xe=["input:not([disabled]):not([type=hidden])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","embed","iframe","object","a[href]","area[href]","[tabindex]","audio[controls]","video[controls]","*[tabindex]:not([aria-disabled])","[contenteditable]:not([contenteditable=false])","details > summary:first-of-type"].join(",");var B={border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"};function K(e,t){return e.addEventListener("webkitpointerlockchange",t,!1),e.addEventListener("mozpointerlockchange",t,!1),e.addEventListener("pointerlockchange",t,!1),function(){e.removeEventListener("mozpointerlockchange",t,!1),e.removeEventListener("pointerlockchange",t,!1)}}var j=require("@zag-js/popper");function Le(e){return{button:e,label:e,input:e,output:e,element:e}}var W=Le(e=>e);var l={getDoc:e=>e.doc||document,getWin:e=>{var t;return((t=e.doc)==null?void 0:t.defaultView)||window},getTriggerId:e=>`tooltip-${e.id}--trigger`,getContentId:e=>`tooltip-${e.id}--content`,getArrowId:e=>`tooltip-${e.id}--arrow`,getPositionerId:e=>`tooltip-${e.id}--popper`,portalId:"tooltip-portal",getTriggerEl:e=>l.getDoc(e).getElementById(l.getTriggerId(e)),getContentEl:e=>l.getDoc(e).getElementById(l.getContentId(e)),getPositionerEl:e=>l.getDoc(e).getElementById(l.getPositionerId(e)),getArrowEl:e=>l.getDoc(e).getElementById(l.getArrowId(e)),getScrollParent:e=>b(l.getTriggerEl(e)),getPortalEl:e=>l.getDoc(e).getElementById(l.portalId),createPortalEl:e=>{let t=l.getDoc(e).createElement("tooltip-portal");return t.id=l.portalId,t}};var q=require("@zag-js/core"),s=(0,q.proxy)({id:null,prevId:null,setId(e){this.prevId=this.id,this.id=e}});function z(e,t,n=W){let o=e.context.id,r=e.context.hasAriaLabel,i=e.hasTag("open"),c=l.getTriggerId(e.context),h=l.getContentId(e.context),a=(0,j.getPlacementStyles)({measured:!!e.context.isPlacementComplete});return{isOpen:i,open(){t("OPEN")},close(){t("CLOSE")},getAnimationState(){return{enter:s.prevId===null&&o===s.id,exit:s.id===null}},triggerProps:n.button({"data-part":"trigger",id:c,"data-expanded":D(i),"aria-describedby":i?h:void 0,onClick(){t("CLICK")},onFocus(){t("FOCUS")},onBlur(){o===s.id&&t("BLUR")},onPointerDown(){o===s.id&&t("POINTER_DOWN")},onPointerMove(){t("POINTER_ENTER")},onPointerLeave(){t("POINTER_LEAVE")},onPointerCancel(){t("POINTER_LEAVE")}}),arrowProps:n.element({id:l.getArrowId(e.context),"data-part":"arrow",style:a.arrow}),innerArrowProps:n.element({"data-part":"arrow-inner",style:a.innerArrow}),positionerProps:n.element({id:l.getPositionerId(e.context),"data-part":"positioner",style:a.floating}),contentProps:n.element({"data-part":"content",role:r?void 0:"tooltip",id:r?void 0:h,"data-placement":e.context.currentPlacement,onPointerEnter(){t("TOOLTIP_POINTER_ENTER")},onPointerLeave(){t("TOOLTIP_POINTER_LEAVE")},style:{pointerEvents:e.context.interactive?"auto":"none"}}),labelProps:n.element({"data-part":"label",id:h,role:"tooltip",style:B,children:e.context["aria-label"]}),createPortal(){let g=l.getDoc(e.context),f=l.getPortalEl(e.context);if(f)return f;let u=l.createPortalEl(e.context);return g.body.appendChild(u),u}}}var v=require("@zag-js/core");var $=require("@zag-js/popper");var U=()=>{};var We=(()=>{let e=0;return()=>(e++,e.toString(36))})();var Te=e=>ke()&&e.test(navigator.userAgent);var ke=()=>typeof window!="undefined";var Y=()=>Te(/^((?!chrome|android).)*safari/i);var G=(0,v.createMachine)({id:"tooltip",initial:"unknown",context:{id:"",openDelay:1e3,closeDelay:500,closeOnPointerDown:!0,closeOnEsc:!0,interactive:!0,positioning:{placement:"bottom"},currentPlacement:void 0},computed:{hasAriaLabel:e=>!!e["aria-label"],isPlacementComplete:e=>!!e.currentPlacement},on:{OPEN:"open",CLOSE:"closed"},states:{unknown:{on:{SETUP:{target:"closed",actions:"setupDocument"}}},closed:{tags:["closed"],entry:["clearGlobalId","invokeOnClose"],on:{FOCUS:"open",POINTER_ENTER:[{guard:"noVisibleTooltip",target:"opening"},{target:"open"}]}},opening:{tags:["closed"],activities:["trackScroll","trackPointerlockChange"],after:{OPEN_DELAY:"open"},on:{POINTER_LEAVE:"closed",BLUR:"closed",SCROLL:"closed",POINTER_LOCK_CHANGE:"closed",POINTER_DOWN:{guard:"closeOnPointerDown",target:"closed"}}},open:{tags:["open"],activities:["trackEscapeKey","trackDisabledTriggerOnSafari","trackScroll","trackPointerlockChange","computePlacement"],entry:["setGlobalId","invokeOnOpen"],on:{POINTER_LEAVE:[{guard:"isVisible",target:"closing"},{target:"closed"}],BLUR:"closed",ESCAPE:"closed",SCROLL:"closed",POINTER_LOCK_CHANGE:"closed",TOOLTIP_POINTER_LEAVE:{guard:"isInteractive",target:"closing"},POINTER_DOWN:{guard:"closeOnPointerDown",target:"closed"},CLICK:"closed"}},closing:{tags:["open"],activities:["trackStore","computePlacement"],after:{CLOSE_DELAY:"closed"},on:{FORCE_CLOSE:"closed",POINTER_ENTER:"open",TOOLTIP_POINTER_ENTER:{guard:"isInteractive",target:"open"}}}}},{activities:{computePlacement(e){e.currentPlacement=e.positioning.placement;let t;return N(()=>{t=(0,$.getPlacement)(l.getTriggerEl(e),l.getPositionerEl(e),C(A({},e.positioning),{onComplete(n){e.currentPlacement=n.placement},onCleanup(){e.currentPlacement=void 0}}))}),()=>t==null?void 0:t()},trackPointerlockChange(e,t,{send:n}){return K(l.getDoc(e),()=>{n("POINTER_LOCK_CHANGE")})},trackScroll(e,t,{send:n}){let o=l.getTriggerEl(e);if(!o)return;let r=k(o).map(i=>w(i,"scroll",()=>n("SCROLL"),{passive:!0,capture:!0}));return()=>{r.forEach(i=>i==null?void 0:i())}},trackStore(e,t,{send:n}){return(0,v.subscribe)(s,()=>{s.id!==e.id&&n("FORCE_CLOSE")})},trackDisabledTriggerOnSafari(e,t,{send:n}){if(!Y())return U;let o=l.getDoc(e);return _(o,"pointermove",r=>{let i="[data-part=trigger][data-expanded]";T(r.target)&&r.target.closest(i)||n("POINTER_LEAVE")})},trackEscapeKey(e,t,{send:n}){if(!e.closeOnEsc)return;let o=l.getDoc(e);return w(o,"keydown",r=>{(r.key==="Escape"||r.key==="Esc")&&n("ESCAPE")})}},actions:{setupDocument(e,t){e.id=t.id,t.doc&&(e.doc=(0,v.ref)(t.doc))},setGlobalId(e){s.setId(e.id)},clearGlobalId(e){e.id===s.id&&s.setId(null)},invokeOnOpen(e,t){var o;["TOOLTIP_POINTER_ENTER","POINTER_ENTER"].includes(t.type)||(o=e.onOpen)==null||o.call(e)},invokeOnClose(e,t){var o;["SETUP"].includes(t.type)||(o=e.onClose)==null||o.call(e)}},guards:{closeOnPointerDown:e=>e.closeOnPointerDown,noVisibleTooltip:()=>s.id===null,isVisible:e=>e.id===s.id,isInteractive:e=>e.interactive},delays:{OPEN_DELAY:e=>e.openDelay,CLOSE_DELAY:e=>e.closeDelay}});module.exports=ie(Oe); | ||
var y=Object.defineProperty,Z=Object.defineProperties,J=Object.getOwnPropertyDescriptor,Q=Object.getOwnPropertyDescriptors,ee=Object.getOwnPropertyNames,O=Object.getOwnPropertySymbols;var S=Object.prototype.hasOwnProperty,te=Object.prototype.propertyIsEnumerable;var C=(e,t,n)=>t in e?y(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,x=(e,t)=>{for(var n in t||(t={}))S.call(t,n)&&C(e,n,t[n]);if(O)for(var n of O(t))te.call(t,n)&&C(e,n,t[n]);return e},A=(e,t)=>Z(e,Q(t)),ne=e=>y(e,"__esModule",{value:!0});var oe=(e,t)=>{for(var n in t)y(e,n,{get:t[n],enumerable:!0})},re=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ee(t))!S.call(e,r)&&(n||r!=="default")&&y(e,r,{get:()=>t[r],enumerable:!(o=J(t,r))||o.enumerable});return e};var ie=(e=>(t,n)=>e&&e.get(t)||(n=re(ne({}),t,1),e&&e.set(t,n),n))(typeof WeakMap!="undefined"?new WeakMap:0);var Ie={};oe(Ie,{connect:()=>z,machine:()=>X});var D=e=>e?"":void 0;var N=new WeakMap;function le(e){var t;if(!e)return{};let n=N.get(e);return n||(n=((t=e==null?void 0:e.ownerDocument.defaultView)!=null?t:window).getComputedStyle(e),N.set(e,n)),n}function R(e){let t=globalThis.requestAnimationFrame(e);return function(){globalThis.cancelAnimationFrame(t)}}var ae=()=>{};var Se=(()=>{let e=0;return()=>(e++,e.toString(36))})();var g=new Map,p=new Map;function se(e,t,n,o){var r;if(!e)return ae;let i=JSON.stringify({type:t,options:o}),c=g.get(e);if(g.has(e))(c==null?void 0:c.has(i))?(r=c==null?void 0:c.get(i))==null||r.add(n):c==null||c.set(i,new Set([n]));else{let a=new Map([[i,new Set([n])]]);g.set(e,a)}function E(a){var m,f;function u(d){var h;let I=g.get(a);(h=I==null?void 0:I.get(i))==null||h.forEach(G=>G(d))}if(!(p==null?void 0:p.has(a))){p.set(a,new Map([[i,u]])),a.addEventListener(t,u,o);return}((m=p==null?void 0:p.get(a))==null?void 0:m.has(i))||((f=p.get(a))==null||f.set(i,u),a.addEventListener(t,u,o))}return E(e),function(){var a,m,f,u;if(!g.has(e))return;let d=g.get(e);if((a=d==null?void 0:d.get(i))==null||a.delete(n),((m=d==null?void 0:d.get(i))==null?void 0:m.size)===0){let h=(f=p.get(e))==null?void 0:f.get(i);e.removeEventListener(t,h,o),d==null||d.delete(i),(u=p.get(e))==null||u.delete(i),(d==null?void 0:d.size)===0&&(g.delete(e),p.delete(e))}}}var P=e=>Object.prototype.toString.call(e).slice(8,-1),ce=e=>P(e)==="Object"&&"current"in e,ue=e=>P(e)==="Function"?e():e,de=e=>P(e)==="Object"&&!!e.touches,pe={pageX:0,pageY:0,clientX:0,clientY:0};function fe(e,t="page"){let n=de(e)?e.touches[0]||e.changedTouches[0]||pe:e;return{point:{x:n[`${t}X`],y:n[`${t}Y`]}}}function w(e,t,n,o){let r=ce(e)?e.current:ue(e);return se(r,t,n,o)}function M(e,t,n,o){var r;let i=(r=be(t))!=null?r:t;return w(e,i,me(n,t==="pointerdown"),o)}function me(e,t=!1){let n=o=>{e(o,fe(o))};return t?ge(n):n}function ge(e){return t=>{var n;let o=(n=t.view)!=null?n:window,r=t instanceof o.MouseEvent;(!r||r&&t.button===0)&&e(t)}}var ve=()=>typeof window!="undefined"&&window.onpointerdown===null,Ee=()=>typeof window!="undefined"&&window.ontouchstart===null,he=()=>typeof window!="undefined"&&window.onmousedown===null,ye={pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointercancel:"mousecancel",pointerover:"mouseover",pointerout:"mouseout",pointerenter:"mouseenter",pointerleave:"mouseleave"},we={pointerdown:"touchstart",pointermove:"touchmove",pointerup:"touchend",pointercancel:"touchcancel"};function be(e){return ve()?e:Ee()?we[e]:he()?ye[e]:e}function L(e){var t;return F(e)?e.document:(t=e==null?void 0:e.ownerDocument)!=null?t:document}function Pe(e){var t;return(t=e==null?void 0:e.ownerDocument.defaultView)!=null?t:window}function _(e){return F(e)?"":e&&e.localName||""}function V(e){let t=L(e);return _(e)==="html"?e:e.assignedSlot||e.parentElement||t.documentElement}function T(e){return typeof e=="object"&&(e==null?void 0:e.nodeType)===Node.ELEMENT_NODE&&typeof(e==null?void 0:e.nodeName)=="string"}function F(e){return(e==null?void 0:e.toString())==="[object Window]"}function H(e){let{overflow:t,overflowX:n,overflowY:o}=le(e);return/auto|scroll|overlay|hidden/.test(t+o+n)}function b(e){return["html","body","#document"].includes(_(e))?L(e).body:T(e)&&H(e)?e:b(V(e))}function k(e,t=[]){let n=b(e),o=n===L(e).body,r=Pe(n),i=o?[r].concat(r.visualViewport||[],H(n)?n:[]):n,c=t.concat(i);return o?c:c.concat(k(V(i)))}var Ce=["input:not([disabled]):not([type=hidden])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","embed","iframe","object","a[href]","area[href]","[tabindex]","audio[controls]","video[controls]","*[tabindex]:not([aria-disabled])","[contenteditable]:not([contenteditable=false])","details > summary:first-of-type"].join(",");var B={border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"};function K(e,t){return e.addEventListener("webkitpointerlockchange",t,!1),e.addEventListener("mozpointerlockchange",t,!1),e.addEventListener("pointerlockchange",t,!1),function(){e.removeEventListener("mozpointerlockchange",t,!1),e.removeEventListener("pointerlockchange",t,!1)}}var j=require("@zag-js/popper");function Le(e){return{button:e,label:e,input:e,output:e,element:e}}var W=Le(e=>e);var l={getDoc:e=>e.doc||document,getWin:e=>{var t;return((t=e.doc)==null?void 0:t.defaultView)||window},getTriggerId:e=>`tooltip-${e.id}--trigger`,getContentId:e=>`tooltip-${e.id}--content`,getArrowId:e=>`tooltip-${e.id}--arrow`,getPositionerId:e=>`tooltip-${e.id}--popper`,portalId:"tooltip-portal",getTriggerEl:e=>l.getDoc(e).getElementById(l.getTriggerId(e)),getContentEl:e=>l.getDoc(e).getElementById(l.getContentId(e)),getPositionerEl:e=>l.getDoc(e).getElementById(l.getPositionerId(e)),getArrowEl:e=>l.getDoc(e).getElementById(l.getArrowId(e)),getScrollParent:e=>b(l.getTriggerEl(e)),getPortalEl:e=>l.getDoc(e).getElementById(l.portalId),createPortalEl:e=>{let t=l.getDoc(e).createElement("tooltip-portal");return t.id=l.portalId,t}};var q=require("@zag-js/core"),s=(0,q.proxy)({id:null,prevId:null,setId(e){this.prevId=this.id,this.id=e}});function z(e,t,n=W){let o=e.context.id,r=e.context.hasAriaLabel,i=e.hasTag("open"),c=l.getTriggerId(e.context),E=l.getContentId(e.context),a=(0,j.getPlacementStyles)({measured:!!e.context.isPlacementComplete});return{isOpen:i,open(){t("OPEN")},close(){t("CLOSE")},getAnimationState(){return{enter:s.prevId===null&&o===s.id,exit:s.id===null}},triggerProps:n.button({"data-part":"trigger",id:c,"data-expanded":D(i),"aria-describedby":i?E:void 0,onClick(){t("CLICK")},onFocus(){t("FOCUS")},onBlur(){o===s.id&&t("BLUR")},onPointerDown(){o===s.id&&t("POINTER_DOWN")},onPointerMove(){t("POINTER_ENTER")},onPointerLeave(){t("POINTER_LEAVE")},onPointerCancel(){t("POINTER_LEAVE")}}),arrowProps:n.element({id:l.getArrowId(e.context),"data-part":"arrow",style:a.arrow}),innerArrowProps:n.element({"data-part":"arrow-inner",style:a.innerArrow}),positionerProps:n.element({id:l.getPositionerId(e.context),"data-part":"positioner",style:a.floating}),contentProps:n.element({"data-part":"content",role:r?void 0:"tooltip",id:r?void 0:E,"data-placement":e.context.currentPlacement,onPointerEnter(){t("TOOLTIP_POINTER_ENTER")},onPointerLeave(){t("TOOLTIP_POINTER_LEAVE")},style:{pointerEvents:e.context.interactive?"auto":"none"}}),labelProps:n.element({"data-part":"label",id:E,role:"tooltip",style:B,children:e.context["aria-label"]}),createPortal(){let m=l.getDoc(e.context),f=l.getPortalEl(e.context);if(f)return f;let u=l.createPortalEl(e.context);return m.body.appendChild(u),u}}}var v=require("@zag-js/core");var $=require("@zag-js/popper");var U=()=>{};var We=(()=>{let e=0;return()=>(e++,e.toString(36))})();var Te=e=>ke()&&e.test(navigator.userAgent);var ke=()=>typeof window!="undefined";var Y=()=>Te(/^((?!chrome|android).)*safari/i);var X=(0,v.createMachine)({id:"tooltip",initial:"unknown",context:{id:"",openDelay:1e3,closeDelay:500,closeOnPointerDown:!0,closeOnEsc:!0,interactive:!0,positioning:{placement:"bottom"},currentPlacement:void 0},computed:{hasAriaLabel:e=>!!e["aria-label"],isPlacementComplete:e=>!!e.currentPlacement},on:{OPEN:"open",CLOSE:"closed"},states:{unknown:{on:{SETUP:{target:"closed",actions:"setupDocument"}}},closed:{tags:["closed"],entry:["clearGlobalId","invokeOnClose"],on:{FOCUS:"open",POINTER_ENTER:[{guard:"noVisibleTooltip",target:"opening"},{target:"open"}]}},opening:{tags:["closed"],activities:["trackScroll","trackPointerlockChange"],after:{OPEN_DELAY:"open"},on:{POINTER_LEAVE:"closed",BLUR:"closed",SCROLL:"closed",POINTER_LOCK_CHANGE:"closed",POINTER_DOWN:{guard:"closeOnPointerDown",target:"closed"}}},open:{tags:["open"],activities:["trackEscapeKey","trackDisabledTriggerOnSafari","trackScroll","trackPointerlockChange","computePlacement"],entry:["setGlobalId","invokeOnOpen"],on:{POINTER_LEAVE:[{guard:"isVisible",target:"closing"},{target:"closed"}],BLUR:"closed",ESCAPE:"closed",SCROLL:"closed",POINTER_LOCK_CHANGE:"closed",TOOLTIP_POINTER_LEAVE:{guard:"isInteractive",target:"closing"},POINTER_DOWN:{guard:"closeOnPointerDown",target:"closed"},CLICK:"closed"}},closing:{tags:["open"],activities:["trackStore","computePlacement"],after:{CLOSE_DELAY:"closed"},on:{FORCE_CLOSE:"closed",POINTER_ENTER:"open",TOOLTIP_POINTER_ENTER:{guard:"isInteractive",target:"open"}}}}},{activities:{computePlacement(e){e.currentPlacement=e.positioning.placement;let t;return R(()=>{t=(0,$.getPlacement)(l.getTriggerEl(e),l.getPositionerEl(e),A(x({},e.positioning),{onComplete(n){e.currentPlacement=n.placement},onCleanup(){e.currentPlacement=void 0}}))}),()=>t==null?void 0:t()},trackPointerlockChange(e,t,{send:n}){return K(l.getDoc(e),()=>{n("POINTER_LOCK_CHANGE")})},trackScroll(e,t,{send:n}){let o=l.getTriggerEl(e);if(!o)return;let r=k(o).map(i=>w(i,"scroll",()=>n("SCROLL"),{passive:!0,capture:!0}));return()=>{r.forEach(i=>i==null?void 0:i())}},trackStore(e,t,{send:n}){return(0,v.subscribe)(s,()=>{s.id!==e.id&&n("FORCE_CLOSE")})},trackDisabledTriggerOnSafari(e,t,{send:n}){if(!Y())return U;let o=l.getDoc(e);return M(o,"pointermove",r=>{let i="[data-part=trigger][data-expanded]";T(r.target)&&r.target.closest(i)||n("POINTER_LEAVE")})},trackEscapeKey(e,t,{send:n}){if(!e.closeOnEsc)return;let o=l.getDoc(e);return w(o,"keydown",r=>{(r.key==="Escape"||r.key==="Esc")&&n("ESCAPE")})}},actions:{setupDocument(e,t){e.id=t.id,t.doc&&(e.doc=(0,v.ref)(t.doc))},setGlobalId(e){s.setId(e.id)},clearGlobalId(e){e.id===s.id&&s.setId(null)},invokeOnOpen(e,t){var o;["TOOLTIP_POINTER_ENTER","POINTER_ENTER"].includes(t.type)||(o=e.onOpen)==null||o.call(e)},invokeOnClose(e,t){var o;["SETUP"].includes(t.type)||(o=e.onClose)==null||o.call(e)}},guards:{closeOnPointerDown:e=>e.closeOnPointerDown,noVisibleTooltip:()=>s.id===null,isVisible:e=>e.id===s.id,isInteractive:e=>e.interactive},delays:{OPEN_DELAY:e=>e.openDelay,CLOSE_DELAY:e=>e.closeDelay}});module.exports=ie(Ie); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@zag-js/tooltip", | ||
"version": "0.0.0-dev-20220407084218", | ||
"version": "0.0.0-dev-20220408111010", | ||
"description": "Core logic for the tooltip widget implemented as a state machine", | ||
@@ -32,7 +32,7 @@ "keywords": [ | ||
"dependencies": { | ||
"@zag-js/core": "^0.0.0-dev-20220407084218", | ||
"@zag-js/popper": "^0.0.0-dev-20220407084218", | ||
"@zag-js/dom-utils": "^0.0.0-dev-20220407084218", | ||
"@zag-js/types": "^0.0.0-dev-20220407084218" | ||
"@zag-js/core": "^0.0.0-dev-20220408111010", | ||
"@zag-js/popper": "^0.0.0-dev-20220408111010", | ||
"@zag-js/dom-utils": "^0.0.0-dev-20220408111010", | ||
"@zag-js/types": "^0.0.0-dev-20220408111010" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
184494