PageSourceSearch

https://nuxt3-tailwind-kit.vercel.app/_nuxt/popover.CCX8l9IV.js

js nuxt3-tailwind-kit.vercel.app collected 2026-10-03 07:25:10 UTC 9,226 bytes, 1 lines download raw bytes

1import{A as re,N as se,E as ie,n as _,v as pe,d as C}from"./portal.sj3fWLYT.js";import{i as R,o,f as V,u as G,w as ve,h as ce,A as K,I as j,P as A,N,c as Z,a as B,b as W}from"./keyboard.BbDlWrfD.js";import{t as fe,i as M,w as de,l as be}from"./open-closed.D-hF2tcx.js";import{s as Pe}from"./use-resolve-button-type.DHHK_P_j.js";import{f as q,s as z}from"./hidden.C7J68tB-.js";import{f as H,j as $,x as w,A as J,H as Q,N as I,F as U,z as ee,S as te,K as me,I as X}from"./entry.BxrKbY13.js";var Se=(s=>(s[s.Open=0]="Open",s[s.Closed=1]="Closed",s))(Se||{});let le=Symbol("PopoverContext");function Y(s){let m=X(le,null);if(m===null){let g=new Error(`<${s} /> is missing a parent <${ye.name} /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(g,Y),g}return m}let oe=Symbol("PopoverGroupContext");function ne(){return X(oe,null)}let ae=Symbol("PopoverPanelContext");function ge(){return X(ae,null)}let ye=H({name:"Popover",inheritAttrs:!1,props:{as:{type:[Object,String],default:"div"}},setup(s,{slots:m,attrs:g,expose:T}){var S;let f=$(null);T({el:f,$el:f});let l=$(1),t=$(null),h=$(null),y=$(null),b=$(null),d=w(()=>R(f)),i=w(()=>{var e,a;if(!o(t)||!o(b))return!1;for(let L of document.querySelectorAll("body > *"))if(Number(L==null?void 0:L.contains(o(t)))^Number(L==null?void 0:L.contains(o(b))))return!0;let n=V(),c=n.indexOf(o(t)),x=(c+n.length-1)%n.length,O=(c+1)%n.length,D=n[x],ue=n[O];return!((e=o(b))!=null&&e.contains(D))&&!((a=o(b))!=null&&a.contains(ue))}),u={popoverState:l,buttonId:$(null),panelId:$(null),panel:b,button:t,isPortalled:i,beforePanelSentinel:h,afterPanelSentinel:y,togglePopover(){l.value=G(l.value,{0:1,1:0})},closePopover(){l.value!==1&&(l.value=1)},close(e){u.closePopover();let a=e?e instanceof HTMLElement?e:e.value instanceof HTMLElement?o(e):o(u.button):o(u.button);a==null||a.focus()}};J(le,u),fe(w(()=>G(l.value,{0:M.Open,1:M.Closed})));let E={buttonId:u.buttonId,panelId:u.panelId,close(){u.closePopover()}},P=ne(),F=P==null?void 0:P.registerPopover,[k,p]=re(),v=se({mainTreeNodeRef:P==null?void 0:P.mainTreeNodeRef,portals:k,defaultContainers:[t,b]});function r(){var e,a,n,c;return(c=P==null?void 0:P.isFocusWithinPopoverGroup())!=null?c:((e=d.value)==null?void 0:e.activeElement)&&(((a=o(t))==null?void 0:a.contains(d.value.activeElement))||((n=o(b))==null?void 0:n.contains(d.value.activeElement)))}return Q(()=>F==null?void 0:F(E)),ie((S=d.value)==null?void 0:S.defaultView,"focus",e=>{var a,n;e.target!==window&&e.target instanceof HTMLElement&&l.value===0&&(r()||t&&b&&(v.contains(e.target)||(a=o(u.beforePanelSentinel))!=null&&a.contains(e.target)||(n=o(u.afterPanelSentinel))!=null&&n.contains(e.target)||u.closePopover()))},!0),de(v.resolveContainers,(e,a)=>{var n;u.closePopover(),ve(a,ce.Loose)||(e.preventDefault(),(n=o(t))==null||n.focus())},w(()=>l.value===0)),()=>{let e={open:l.value===0,close:u.close};return I(U,[I(p,{},()=>K({theirProps:{...s,...g},ourProps:{ref:f},slot:e,slots:m,attrs:g,name:"Popover"})),I(v.MainTreeNode)])}}}),ke=H({name:"PopoverButton",props:{as:{type:[Object,String],default:"button"},disabled:{type:[Boolean],default:!1},id:{type:String,default:null}},inheritAttrs:!1,setup(s,{attrs:m,slots:g,expose:T}){var S;let f=(S=s.id)!=null?S:`headlessui-popover-button-${j()}`,l=Y("PopoverButton"),t=w(()=>R(l.button));T({el:l.button,$el:l.button}),ee(()=>{l.buttonId.value=f}),te(()=>{l.buttonId.value=null});let h=ne(),y=h==null?void 0:h.closeOthers,b=ge(),d=w(()=>b===null?!1:b.value===l.panelId.value),i=$(null),u=`headlessui-focus-sentinel-${j()}`;d.value||Q(()=>{l.button.value=o(i)});let E=Pe(w(()=>({as:s.as,type:m.type})),i);function P(e){var a,n,c,x,O;if(d.value){if(l.popoverState.value===1)return;switch(e.key){case B.Space:case B.Enter:e.preventDefault(),(n=(a=e.target).click)==null||n.call(a),l.closePopover(),(c=o(l.button))==null||c.focus();break}}else switch(e.key){case B.Space:case B.Enter:e.preventDefault(),e.stopPropagation(),l.popoverState.value===1&&(y==null||y(l.buttonId.value)),l.togglePopover();break;case B.Escape:if(l.popoverState.value!==0)return y==null?void 0:y(l.buttonId.value);if(!o(l.button)||(x=t.value)!=null&&x.activeElement&&!((O=o(l.button))!=null&&O.contains(t.value.activeElement)))return;e.preventDefault(),e.stopPropagation(),l.closePopover();break}}function F(e){d.value||e.key===B.Space&&e.preventDefault()}function k(e){var a,n;s.disabled||(d.value?(l.closePopover(),(a=o(l.button))==null||a.focus()):(e.preventDefault(),e.stopPropagation(),l.popoverState.value===1&&(y==null||y(l.buttonId.value)),l.togglePopover(),(n=o(l.button))==null||n.focus()))}function p(e){e.preventDefault(),e.stopPropagation()}let v=_();function r(){let e=o(l.panel);if(!e)return;function a(){G(v.value,{[C.Forwards]:()=>A(e,N.First),[C.Backwards]:()=>A(e,N.Last)})===W.Error&&A(V().filter(n=>n.dataset.headlessuiFocusGuard!=="true"),G(v.value,{[C.Forwards]:N.Next,[C.Backwards]:N.Previous}),{relativeTo:o(l.button)})}a()}return()=>{let e=l.popoverState.value===0,a={open:e},{...n}=s,c=d.value?{ref:i,type:E.value,onKeydown:P,onClick:k}:{ref:i,id:f,type:E.value,"aria-expanded":l.popoverState.value===0,"aria-controls":o(l.panel)?l.panelId.value:void 0,disabled:s.disabled?!0:void 0,onKeydown:P,onKeyup:F,onClick:k,onMousedown:p};return I(U,[K({ourProps:c,theirProps:{...m,...n},slot:a,attrs:m,slots:g,name:"PopoverButton"}),e&&!d.value&&l.isPortalled.value&&I(q,{id:u,features:z.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:r})])}}}),xe=H({name:"PopoverPanel",props:{as:{type:[Object,String],default:"div"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0},focus:{type:Boolean,default:!1},id:{type:String,default:null}},inheritAttrs:!1,setup(s,{attrs:m,slots:g,expose:T}){var S;let f=(S=s.id)!=null?S:`headlessui-popover-panel-${j()}`,{focus:l}=s,t=Y("PopoverPanel"),h=w(()=>R(t.panel)),y=`headlessui-focus-sentinel-before-${j()}`,b=`headlessui-focus-sentinel-after-${j()}`;T({el:t.panel,$el:t.panel}),ee(()=>{t.panelId.value=f}),te(()=>{t.panelId.value=null}),J(ae,t.panelId),Q(()=>{var p,v;if(!l||t.popoverState.value!==0||!t.panel)return;let r=(p=h.value)==null?void 0:p.activeElement;(v=o(t.panel))!=null&&v.contains(r)||A(o(t.panel),N.First)});let d=be(),i=w(()=>d!==null?(d.value&M.Open)===M.Open:t.popoverState.value===0);function u(p){var v,r;switch(p.key){case B.Escape:if(t.popoverState.value!==0||!o(t.panel)||h.value&&!((v=o(t.panel))!=null&&v.contains(h.value.activeElement)))return;p.preventDefault(),p.stopPropagation(),t.closePopover(),(r=o(t.button))==null||r.focus();break}}function E(p){var v,r,e,a,n;let c=p.relatedTarget;c&&o(t.panel)&&((v=o(t.panel))!=null&&v.contains(c)||(t.closePopover(),((e=(r=o(t.beforePanelSentinel))==null?void 0:r.contains)!=null&&e.call(r,c)||(n=(a=o(t.afterPanelSentinel))==null?void 0:a.contains)!=null&&n.call(a,c))&&c.focus({preventScroll:!0})))}let P=_();function F(){let p=o(t.panel);if(!p)return;function v(){G(P.value,{[C.Forwards]:()=>{var r;A(p,N.First)===W.Error&&((r=o(t.afterPanelSentinel))==null||r.focus())},[C.Backwards]:()=>{var r;(r=o(t.button))==null||r.focus({preventScroll:!0})}})}v()}function k(){let p=o(t.panel);if(!p)return;function v(){G(P.value,{[C.Forwards]:()=>{let r=o(t.button),e=o(t.panel);if(!r)return;let a=V(),n=a.indexOf(r),c=a.slice(0,n+1),x=[...a.slice(n+1),...c];for(let O of x.slice())if(O.dataset.headlessuiFocusGuard==="true"||e!=null&&e.contains(O)){let D=x.indexOf(O);D!==-1&&x.splice(D,1)}A(x,N.First,{sorted:!1})},[C.Backwards]:()=>{var r;A(p,N.Previous)===W.Error&&((r=o(t.button))==null||r.focus())}})}v()}return()=>{let p={open:t.popoverState.value===0,close:t.close},{focus:v,...r}=s,e={ref:t.panel,id:f,onKeydown:u,onFocusout:l&&t.popoverState.value===0?E:void 0,tabIndex:-1};return K({ourProps:e,theirProps:{...m,...r},attrs:m,slot:p,slots:{...g,default:(...a)=>{var n;return[I(U,[i.value&&t.isPortalled.value&&I(q,{id:y,ref:t.beforePanelSentinel,features:z.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:
1F}),(n=g.default)==null?void 0:n.call(g,...a),i.value&&t.isPortalled.value&&I(q,{id:b,ref:t.afterPanelSentinel,features:z.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:k})])]}},features:Z.RenderStrategy|Z.Static,visible:i.value,name:"PopoverPanel"})}}}),Oe=H({name:"PopoverGroup",inheritAttrs:!1,props:{as:{type:[Object,String],default:"div"}},setup(s,{attrs:m,slots:g,expose:T}){let S=$(null),f=me([]),l=w(()=>R(S)),t=pe();T({el:S,$el:S});function h(i){let u=f.value.indexOf(i);u!==-1&&f.value.splice(u,1)}function y(i){return f.value.push(i),()=>{h(i)}}function b(){var i;let u=l.value;if(!u)return!1;let E=u.activeElement;return(i=o(S))!=null&&i.contains(E)?!0:f.value.some(P=>{var F,k;return((F=u.getElementById(P.buttonId.value))==null?void 0:F.contains(E))||((k=u.getElementById(P.panelId.value))==null?void 0:k.contains(E))})}function d(i){for(let u of f.value)u.buttonId.value!==i&&u.close()}return J(oe,{registerPopover:y,unregisterPopover:h,isFocusWithinPopoverGroup:b,closeOthers:d,mainTreeNodeRef:t.mainTreeNodeRef}),()=>I(U,[K({ourProps:{ref:S},theirProps:{...s,...m},slot:{},attrs:m,slots:g,name:"PopoverGroup"}),I(t.MainTreeNode)])}});export{Oe as A,ke as G,xe as j,ye as y};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.