Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@headlessui/vue

Package Overview
Dependencies
Maintainers
0
Versions
681
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@headlessui/vue - npm Package Compare versions

Comparing version 0.0.0-insiders.9a7dcfc to 0.0.0-insiders.9ae054e

dist/hooks/use-disposables.d.ts

62

dist/components/combobox/combobox.d.ts

@@ -1,3 +0,2 @@

import { PropType } from 'vue';
declare function defaultComparator<T>(a: T, z: T): boolean;
import { type PropType } from 'vue';
export declare let Combobox: import("vue").DefineComponent<{

@@ -14,3 +13,4 @@ as: {

type: (StringConstructor | FunctionConstructor)[];
default: () => typeof defaultComparator;
nullable: boolean;
default: null;
};

@@ -25,4 +25,9 @@ modelValue: {

};
form: {
type: StringConstructor;
optional: boolean;
};
name: {
type: StringConstructor;
optional: boolean;
};

@@ -37,2 +42,13 @@ nullable: {

};
immediate: {
type: BooleanConstructor[];
default: boolean;
};
virtual: {
type: PropType<{
options: unknown[];
disabled?: ((value: unknown) => boolean) | undefined;
} | null>;
default: null;
};
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {

@@ -53,3 +69,4 @@ [key: string]: any;

type: (StringConstructor | FunctionConstructor)[];
default: () => typeof defaultComparator;
nullable: boolean;
default: null;
};

@@ -64,4 +81,9 @@ modelValue: {

};
form: {
type: StringConstructor;
optional: boolean;
};
name: {
type: StringConstructor;
optional: boolean;
};

@@ -76,2 +98,13 @@ nullable: {

};
immediate: {
type: BooleanConstructor[];
default: boolean;
};
virtual: {
type: PropType<{
options: unknown[];
disabled?: ((value: unknown) => boolean) | undefined;
} | null>;
default: null;
};
}>> & {

@@ -87,2 +120,7 @@ "onUpdate:modelValue"?: ((_value: any) => any) | undefined;

multiple: boolean;
immediate: boolean;
virtual: {
options: unknown[];
disabled?: ((value: unknown) => boolean) | undefined;
} | null;
}>;

@@ -112,4 +150,4 @@ export declare let ComboboxLabel: import("vue").DefineComponent<{

}>>, {
id: string;
as: string | Record<string, any>;
id: string;
}>;

@@ -139,4 +177,4 @@ export declare let ComboboxButton: import("vue").DefineComponent<{

}>>, {
id: string;
as: string | Record<string, any>;
id: string;
}>;

@@ -204,6 +242,6 @@ export declare let ComboboxInput: import("vue").DefineComponent<{

}, {
id: string;
as: string | Record<string, any>;
unmount: boolean;
static: boolean;
id: string;
defaultValue: string;

@@ -267,2 +305,6 @@ }>;

};
order: {
type: NumberConstructor[];
default: null;
};
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {

@@ -284,6 +326,10 @@ [key: string]: any;

};
order: {
type: NumberConstructor[];
default: null;
};
}>>, {
as: string | Record<string, any>;
disabled: boolean;
order: number;
}>;
export {};

2

dist/components/combobox/combobox.js

@@ -1,1 +0,1 @@

import{Fragment as Q,computed as C,defineComponent as L,h as J,inject as X,nextTick as A,onMounted as U,onUnmounted as Y,provide as Z,ref as M,toRaw as m,watch as _,watchEffect as q}from"vue";import{Features as K,render as j,omit as W,compact as z}from'../../utils/render.js';import{useId as H}from'../../hooks/use-id.js';import{Keys as V}from'../../keyboard.js';import{calculateActiveIndex as ee,Focus as T}from'../../utils/calculate-active-index.js';import{dom as g}from'../../utils/dom.js';import{useOpenClosed as te,State as $,useOpenClosedProvider as oe}from'../../internal/open-closed.js';import{match as k}from'../../utils/match.js';import{useResolveButtonType as le}from'../../hooks/use-resolve-button-type.js';import{useTreeWalker as ne}from'../../hooks/use-tree-walker.js';import{sortByDomNode as ae}from'../../utils/focus-management.js';import{useOutsideClick as ie}from'../../hooks/use-outside-click.js';import{Hidden as ue,Features as re}from'../../internal/hidden.js';import{objectToFormEntries as se}from'../../utils/form.js';import{useControllable as de}from'../../hooks/use-controllable.js';import{useTrackedPointer as pe}from'../../hooks/use-tracked-pointer.js';import{isMobile as fe}from'../../utils/platform.js';function be(o,O){return o===O}var ve=(s=>(s[s.Open=0]="Open",s[s.Closed=1]="Closed",s))(ve||{}),ce=(s=>(s[s.Single=0]="Single",s[s.Multi=1]="Multi",s))(ce||{}),me=(s=>(s[s.Pointer=0]="Pointer",s[s.Other=1]="Other",s))(me||{});let G=Symbol("ComboboxContext");function B(o){let O=X(G,null);if(O===null){let s=new Error(`<${o} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(s,B),s}return O}let Ne=L({name:"Combobox",emits:{"update:modelValue":o=>!0},props:{as:{type:[Object,String],default:"template"},disabled:{type:[Boolean],default:!1},by:{type:[String,Function],default:()=>be},modelValue:{type:[Object,String,Number,Boolean],default:void 0},defaultValue:{type:[Object,String,Number,Boolean],default:void 0},name:{type:String},nullable:{type:Boolean,default:!1},multiple:{type:[Boolean],default:!1}},inheritAttrs:!1,setup(o,{slots:O,attrs:s,emit:P}){let e=M(1),t=M(null),f=M(null),I=M(null),d=M(null),c=M({static:!1,hold:!1}),x=M([]),S=M(null),R=M(1),y=M(!1);function E(n=r=>r){let r=S.value!==null?x.value[S.value]:null,p=ae(n(x.value.slice()),v=>g(v.dataRef.domRef)),a=r?p.indexOf(r):null;return a===-1&&(a=null),{options:p,activeOptionIndex:a}}let l=C(()=>o.multiple?1:0),i=C(()=>o.nullable),[b,w]=de(C(()=>o.modelValue===void 0?k(l.value,{[1]:[],[0]:void 0}):o.modelValue),n=>P("update:modelValue",n),C(()=>o.defaultValue)),u={comboboxState:e,value:b,mode:l,compare(n,r){if(typeof o.by=="string"){let p=o.by;return(n==null?void 0:n[p])===(r==null?void 0:r[p])}return o.by(n,r)},defaultValue:C(()=>o.defaultValue),nullable:i,inputRef:f,labelRef:t,buttonRef:I,optionsRef:d,disabled:C(()=>o.disabled),options:x,change(n){w(n)},activeOptionIndex:C(()=>{if(y.value&&S.value===null&&x.value.length>0){let n=x.value.findIndex(r=>!r.dataRef.disabled);if(n!==-1)return n}return S.value}),activationTrigger:R,optionsPropsRef:c,closeCombobox(){y.value=!1,!o.disabled&&e.value!==1&&(e.value=1,S.value=null)},openCombobox(){if(y.value=!0,o.disabled||e.value===0)return;let n=x.value.findIndex(r=>{let p=m(r.dataRef.value);return k(l.value,{[0]:()=>u.compare(m(u.value.value),m(p)),[1]:()=>m(u.value.value).some(v=>u.compare(m(v),m(p)))})});n!==-1&&(S.value=n),e.value=0},goToOption(n,r,p){if(y.value=!1,o.disabled||d.value&&!c.value.static&&e.value===1)return;let a=E();if(a.activeOptionIndex===null){let h=a.options.findIndex(N=>!N.dataRef.disabled);h!==-1&&(a.activeOptionIndex=h)}let v=ee(n===T.Specific?{focus:T.Specific,id:r}:{focus:n},{resolveItems:()=>a.options,resolveActiveIndex:()=>a.activeOptionIndex,resolveId:h=>h.id,resolveDisabled:h=>h.dataRef.disabled});S.value=v,R.value=p!=null?p:1,x.value=a.options},selectOption(n){let r=x.value.find(a=>a.id===n);if(!r)return;let{dataRef:p}=r;w(k(l.value,{[0]:()=>p.value,[1]:()=>{let a=m(u.value.value).slice(),v=m(p.value),h=a.findIndex(N=>u.compare(v,m(N)));return h===-1?a.push(v):a.splice(h,1),a}}))},selectActiveOption(){if(u.activeOptionIndex.value===null)return;let{dataRef:n,id:r}=x.value[u.activeOptionIndex.value];w(k(l.value,{[0]:()=>n.value,[1]:()=>{let p=m(u.value.value).slice(),a=m(n.value),v=p.findIndex(h=>u.compare(a,m(h)));return v===-1?p.push(a):p.splice(v,1),p}})),u.goToOption(T.Specific,r)},registerOption(n,r){let p={id:n,dataRef:r},a=E(v=>[...v,p]);if(S.value===null){let v=r.value.value;k(l.value,{[0]:()=>u.compare(m(u.value.value),m(v)),[1]:()=>m(u.value.value).some(N=>u.compare(m(N),m(v)))})&&(a.activeOptionIndex=a.options.indexOf(p))}x.value=a.options,S.value=a.activeOptionIndex,R.value=1},unregisterOption(n){var p;u.activeOptionIndex.value!==null&&((p=u.options.value[u.activeOptionIndex.value])==null?void 0:p.id)===n&&(y.value=!0);let r=E(a=>{let v=a.findIndex(h=>h.id===n);return v!==-1&&a.splice(v,1),a});x.value=r.options,S.value=r.activeOptionIndex,R.value=1}};ie([f,I,d],()=>u.closeCombobox(),C(()=>e.value===0)),Z(G,u),oe(C(()=>k(e.value,{[0]:$.Open,[1]:$.Closed})));let F=C(()=>u.activeOptionIndex.value===null?null:x.value[u.activeOptionIndex.value].dataRef.value),D=C(()=>{var n;return(n=g(f))==null?void 0:n.closest("form")});return U(()=>{_([D],()=>{if(!D.value||o.defaultValue===void 0)return;function n(){u.change(o.defaultValue)}return D.value.addEventListener("reset",n),()=>{var r;(r=D.value)==null||r.removeEventListener("reset",n)}},{immediate:!0})}),()=>{let{name:n,disabled:r,...p}=o,a={open:e.value===0,disabled:r,activeIndex:u.activeOptionIndex.value,activeOption:F.value,value:b.value};return J(Q,[...n!=null&&b.value!=null?se({[n]:b.value}).map(([v,h])=>J(ue,z({features:re.Hidden,key:v,as:"input",type:"hidden",hidden:!0,readOnly:!0,name:v,value:h}))):[],j({theirProps:{...s,...W(p,["modelValue","defaultValue","nullable","multiple","onUpdate:modelValue","by"])},ourProps:{},slot:a,slots:O,attrs:s,name:"Combobox"})])}}}),He=L({name:"ComboboxLabel",props:{as:{type:[Object,String],default:"label"},id:{type:String,default:()=>`headlessui-combobox-label-${H()}`}},setup(o,{attrs:O,slots:s}){let P=B("ComboboxLabel");function e(){var t;(t=g(P.inputRef))==null||t.focus({preventScroll:!0})}return()=>{let t={open:P.comboboxState.value===0,disabled:P.disabled.value},{id:f,...I}=o,d={id:f,ref:P.labelRef,onClick:e};return j({ourProps:d,theirProps:I,slot:t,attrs:O,slots:s,name:"ComboboxLabel"})}}}),Ke=L({name:"ComboboxButton",props:{as:{type:[Object,String],default:"button"},id:{type:String,default:()=>`headlessui-combobox-button-${H()}`}},setup(o,{attrs:O,slots:s,expose:P}){let e=B("ComboboxButton");P({el:e.buttonRef,$el:e.buttonRef});function t(d){e.disabled.value||(e.comboboxState.value===0?e.closeCombobox():(d.preventDefault(),e.openCombobox()),A(()=>{var c;return(c=g(e.inputRef))==null?void 0:c.focus({preventScroll:!0})}))}function f(d){switch(d.key){case V.ArrowDown:d.preventDefault(),d.stopPropagation(),e.comboboxState.value===1&&e.openCombobox(),A(()=>{var c;return(c=e.inputRef.value)==null?void 0:c.focus({preventScroll:!0})});return;case V.ArrowUp:d.preventDefault(),d.stopPropagation(),e.comboboxState.value===1&&(e.openCombobox(),A(()=>{e.value.value||e.goToOption(T.Last)})),A(()=>{var c;return(c=e.inputRef.value)==null?void 0:c.focus({preventScroll:!0})});return;case V.Escape:if(e.comboboxState.value!==0)return;d.preventDefault(),e.optionsRef.value&&!e.optionsPropsRef.value.static&&d.stopPropagation(),e.closeCombobox(),A(()=>{var c;return(c=e.inputRef.value)==null?void 0:c.focus({preventScroll:!0})});return}}let I=le(C(()=>({as:o.as,type:O.type})),e.buttonRef);return()=>{var R,y;let d={open:e.comboboxState.value===0,disabled:e.disabled.value,value:e.value.value},{id:c,...x}=o,S={ref:e.buttonRef,id:c,type:I.value,tabindex:"-1","aria-haspopup":"listbox","aria-controls":(R=g(e.optionsRef))==null?void 0:R.id,"aria-expanded":e.disabled.value?void 0:e.comboboxState.value===0,"aria-labelledby":e.labelRef.value?[(y=g(e.labelRef))==null?void 0:y.id,c].join(" "):void 0,disabled:e.disabled.value===!0?!0:void 0,onKeydown:f,onClick:t};return j({ourProps:S,theirProps:x,slot:d,attrs:O,slots:s,name:"ComboboxButton"})}}}),$e=L({name:"ComboboxInput",props:{as:{type:[Object,String],default:"input"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0},displayValue:{type:Function},defaultValue:{type:String,default:void 0},id:{type:String,default:()=>`headlessui-combobox-input-${H()}`}},emits:{change:o=>!0},setup(o,{emit:O,attrs:s,slots:P,expose:e}){let t=B("ComboboxInput"),f={value:!1};e({el:t.inputRef,$el:t.inputRef});let I=C(()=>{var i;let l=t.value.value;return g(t.inputRef)?typeof o.displayValue!="undefined"&&l!==void 0?(i=o.displayValue(l))!=null?i:"":typeof l=="string"?l:"":""});U(()=>{_([I,t.comboboxState],([l,i],[b,w])=>{if(f.value)return;let u=g(t.inputRef);u&&(w===0&&i===1||l!==b)&&(u.value=l)},{immediate:!0}),_([t.comboboxState],([l],[i])=>{if(l===0&&i===1){let b=g(t.inputRef);if(!b)return;let w=b.value,{selectionStart:u,selectionEnd:F,selectionDirection:D}=b;b.value="",b.value=w,D!==null?b.setSelectionRange(u,F,D):b.setSelectionRange(u,F)}})});let d=M(!1);function c(){d.value=!0}function x(){setTimeout(()=>{d.value=!1})}function S(l){switch(f.value=!0,l.key){case V.Backspace:case V.Delete:if(t.mode.value!==0||!t.nullable.value)return;let i=l.currentTarget;requestAnimationFrame(()=>{if(i.value===""){t.change(null);let b=g(t.optionsRef);b&&(b.scrollTop=0),t.goToOption(T.Nothing)}});break;case V.Enter:if(f.value=!1,t.comboboxState.value!==0||d.value)return;if(l.preventDefault(),l.stopPropagation(),t.activeOptionIndex.value===null){t.closeCombobox();return}t.selectActiveOption(),t.mode.value===0&&t.closeCombobox();break;case V.ArrowDown:return f.value=!1,l.preventDefault(),l.stopPropagation(),k(t.comboboxState.value,{[0]:()=>t.goToOption(T.Next),[1]:()=>t.openCombobox()});case V.ArrowUp:return f.value=!1,l.preventDefault(),l.stopPropagation(),k(t.comboboxState.value,{[0]:()=>t.goToOption(T.Previous),[1]:()=>{t.openCombobox(),A(()=>{t.value.value||t.goToOption(T.Last)})}});case V.Home:if(l.shiftKey)break;return f.value=!1,l.preventDefault(),l.stopPropagation(),t.goToOption(T.First);case V.PageUp:return f.value=!1,l.preventDefault(),l.stopPropagation(),t.goToOption(T.First);case V.End:if(l.shiftKey)break;return f.value=!1,l.preventDefault(),l.stopPropagation(),t.goToOption(T.Last);case V.PageDown:return f.value=!1,l.preventDefault(),l.stopPropagation(),t.goToOption(T.Last);case V.Escape:if(f.value=!1,t.comboboxState.value!==0)return;l.preventDefault(),t.optionsRef.value&&!t.optionsPropsRef.value.static&&l.stopPropagation(),t.closeCombobox();break;case V.Tab:if(f.value=!1,t.comboboxState.value!==0)return;t.mode.value===0&&t.selectActiveOption(),t.closeCombobox();break}}function R(l){t.openCombobox(),O("change",l)}function y(){f.value=!1}let E=C(()=>{var l,i,b,w;return(w=(b=(i=o.defaultValue)!=null?i:t.defaultValue.value!==void 0?(l=o.displayValue)==null?void 0:l.call(o,t.defaultValue.value):null)!=null?b:t.defaultValue.value)!=null?w:""});return()=>{var D,n,r,p,a,v;let l={open:t.comboboxState.value===0},{id:i,displayValue:b,onChange:w,...u}=o,F={"aria-controls":(D=t.optionsRef.value)==null?void 0:D.id,"aria-expanded":t.disabled.value?void 0:t.comboboxState.value===0,"aria-activedescendant":t.activeOptionIndex.value===null||(n=t.options.value[t.activeOptionIndex.value])==null?void 0:n.id,"aria-labelledby":(a=(r=g(t.labelRef))==null?void 0:r.id)!=null?a:(p=g(t.buttonRef))==null?void 0:p.id,"aria-autocomplete":"list",id:i,onCompositionstart:c,onCompositionend:x,onKeydown:S,onInput:R,onBlur:y,role:"combobox",type:(v=s.type)!=null?v:"text",tabIndex:0,ref:t.inputRef,defaultValue:E.value};return j({ourProps:F,theirProps:u,slot:l,attrs:s,slots:P,features:K.RenderStrategy|K.Static,name:"ComboboxInput"})}}}),Ue=L({name:"ComboboxOptions",props:{as:{type:[Object,String],default:"ul"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0},hold:{type:[Boolean],default:!1}},setup(o,{attrs:O,slots:s,expose:P}){let e=B("ComboboxOptions"),t=`headlessui-combobox-options-${H()}`;P({el:e.optionsRef,$el:e.optionsRef}),q(()=>{e.optionsPropsRef.value.static=o.static}),q(()=>{e.optionsPropsRef.value.hold=o.hold});let f=te(),I=C(()=>f!==null?(f.value&$.Open)===$.Open:e.comboboxState.value===0);return ne({container:C(()=>g(e.optionsRef)),enabled:C(()=>e.comboboxState.value===0),accept(d){return d.getAttribute("role")==="option"?NodeFilter.FILTER_REJECT:d.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(d){d.setAttribute("role","none")}}),()=>{var S,R,y;let d={open:e.comboboxState.value===0},c={"aria-labelledby":(y=(S=g(e.labelRef))==null?void 0:S.id)!=null?y:(R=g(e.buttonRef))==null?void 0:R.id,id:t,ref:e.optionsRef,role:"listbox","aria-multiselectable":e.mode.value===1?!0:void 0},x=W(o,["hold"]);return j({ourProps:c,theirProps:x,slot:d,attrs:O,slots:s,features:K.RenderStrategy|K.Static,visible:I.value,name:"ComboboxOptions"})}}}),_e=L({name:"ComboboxOption",props:{as:{type:[Object,String],default:"li"},value:{type:[Object,String,Number,Boolean]},disabled:{type:Boolean,default:!1}},setup(o,{slots:O,attrs:s,expose:P}){let e=B("ComboboxOption"),t=`headlessui-combobox-option-${H()}`,f=M(null);P({el:f,$el:f});let I=C(()=>e.activeOptionIndex.value!==null?e.options.value[e.activeOptionIndex.value].id===t:!1),d=C(()=>k(e.mode.value,{[0]:()=>e.compare(m(e.value.value),m(o.value)),[1]:()=>m(e.value.value).some(i=>e.compare(m(i),m(o.value)))})),c=C(()=>({disabled:o.disabled,value:o.value,domRef:f}));U(()=>e.registerOption(t,c)),Y(()=>e.unregisterOption(t)),q(()=>{e.comboboxState.value===0&&I.value&&e.activationTrigger.value!==0&&A(()=>{var i,b;return(b=(i=g(f))==null?void 0:i.scrollIntoView)==null?void 0:b.call(i,{block:"nearest"})})});function x(i){if(o.disabled)return i.preventDefault();e.selectOption(t),e.mode.value===0&&e.closeCombobox(),fe()||requestAnimationFrame(()=>{var b;return(b=g(e.inputRef))==null?void 0:b.focus()})}function S(){if(o.disabled)return e.goToOption(T.Nothing);e.goToOption(T.Specific,t)}let R=pe();function y(i){R.update(i)}function E(i){R.wasMoved(i)&&(o.disabled||I.value||e.goToOption(T.Specific,t,0))}function l(i){R.wasMoved(i)&&(o.disabled||I.value&&(e.optionsPropsRef.value.hold||e.goToOption(T.Nothing)))}return()=>{let{disabled:i}=o,b={active:I.value,selected:d.value,disabled:i},w={id:t,ref:f,role:"option",tabIndex:i===!0?void 0:-1,"aria-disabled":i===!0?!0:void 0,"aria-selected":d.value,disabled:void 0,onClick:x,onFocus:S,onPointerenter:y,onMouseenter:y,onPointermove:E,onMousemove:E,onPointerleave:l,onMouseleave:l};return j({ourProps:w,theirProps:o,slot:b,attrs:s,slots:O,name:"ComboboxOption"})}}});export{Ne as Combobox,Ke as ComboboxButton,$e as ComboboxInput,He as ComboboxLabel,_e as ComboboxOption,Ue as ComboboxOptions};
import{useVirtualizer as re}from"@tanstack/vue-virtual";import{Fragment as de,cloneVNode as se,computed as b,defineComponent as j,h as z,inject as ee,nextTick as H,onMounted as X,onUnmounted as fe,provide as te,reactive as ve,ref as A,toRaw as L,watch as q,watchEffect as Y}from"vue";import{useControllable as pe}from'../../hooks/use-controllable.js';import{useFrameDebounce as be}from'../../hooks/use-frame-debounce.js';import{useId as J}from'../../hooks/use-id.js';import{useOutsideClick as ce}from'../../hooks/use-outside-click.js';import{useResolveButtonType as me}from'../../hooks/use-resolve-button-type.js';import{useTrackedPointer as xe}from'../../hooks/use-tracked-pointer.js';import{useTreeWalker as ge}from'../../hooks/use-tree-walker.js';import{Hidden as Se,Features as Oe}from'../../internal/hidden.js';import{State as G,useOpenClosed as Ce,useOpenClosedProvider as Re}from'../../internal/open-closed.js';import{Keys as k}from'../../keyboard.js';import{MouseButton as ye}from'../../mouse.js';import{history as oe}from'../../utils/active-element-history.js';import{Focus as w,calculateActiveIndex as le}from'../../utils/calculate-active-index.js';import{disposables as ae}from'../../utils/disposables.js';import{dom as x}from'../../utils/dom.js';import{sortByDomNode as Te}from'../../utils/focus-management.js';import{objectToFormEntries as Ie}from'../../utils/form.js';import{match as $}from'../../utils/match.js';import{getOwnerDocument as he}from'../../utils/owner.js';import{isMobile as Pe}from'../../utils/platform.js';import{Features as Q,compact as we,omit as Z,render as _}from'../../utils/render.js';function De(a,I){return a===I}var Ee=(u=>(u[u.Open=0]="Open",u[u.Closed=1]="Closed",u))(Ee||{}),Ve=(u=>(u[u.Single=0]="Single",u[u.Multi=1]="Multi",u))(Ve||{}),Ae=(O=>(O[O.Pointer=0]="Pointer",O[O.Focus=1]="Focus",O[O.Other=2]="Other",O))(Ae||{});let ne=Symbol("ComboboxContext");function N(a){let I=ee(ne,null);if(I===null){let u=new Error(`<${a} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(u,N),u}return I}let ie=Symbol("VirtualContext"),Fe=j({name:"VirtualProvider",setup(a,{slots:I}){let u=N("VirtualProvider"),O=b(()=>{let r=x(u.optionsRef);if(!r)return{start:0,end:0};let f=window.getComputedStyle(r);return{start:parseFloat(f.paddingBlockStart||f.paddingTop),end:parseFloat(f.paddingBlockEnd||f.paddingBottom)}}),t=re(b(()=>({scrollPaddingStart:O.value.start,scrollPaddingEnd:O.value.end,count:u.virtual.value.options.length,estimateSize(){return 40},getScrollElement(){return x(u.optionsRef)},overscan:12}))),e=b(()=>{var r;return(r=u.virtual.value)==null?void 0:r.options}),C=A(0);return q([e],()=>{C.value+=1}),te(ie,u.virtual.value?t:null),()=>[z("div",{style:{position:"relative",width:"100%",height:`${t.value.getTotalSize()}px`},ref:r=>{if(r){if(typeof process!="undefined"&&process.env.JEST_WORKER_ID!==void 0||u.activationTrigger.value===0)return;u.activeOptionIndex.value!==null&&u.virtual.value.options.length>u.activeOptionIndex.value&&t.value.scrollToIndex(u.activeOptionIndex.value)}}},t.value.getVirtualItems().map(r=>se(I.default({option:u.virtual.value.options[r.index],open:u.comboboxState.value===0})[0],{key:`${C.value}-${r.index}`,"data-index":r.index,"aria-setsize":u.virtual.value.options.length,"aria-posinset":r.index+1,style:{position:"absolute",top:0,left:0,transform:`translateY(${r.start}px)`,overflowAnchor:"none"}})))]}}),lt=j({name:"Combobox",emits:{"update:modelValue":a=>!0},props:{as:{type:[Object,String],default:"template"},disabled:{type:[Boolean],default:!1},by:{type:[String,Function],nullable:!0,default:null},modelValue:{type:[Object,String,Number,Boolean],default:void 0},defaultValue:{type:[Object,String,Number,Boolean],default:void 0},form:{type:String,optional:!0},name:{type:String,optional:!0},nullable:{type:Boolean,default:!1},multiple:{type:[Boolean],default:!1},immediate:{type:[Boolean],default:!1},virtual:{type:Object,default:null}},inheritAttrs:!1,setup(a,{slots:I,attrs:u,emit:O}){let t=A(1),e=A(null),C=A(null),r=A(null),f=A(null),p=A({static:!1,hold:!1}),c=A([]),g=A(null),P=A(2),D=A(!1);function V(l=i=>i){let i=g.value!==null?c.value[g.value]:null,s=l(c.value.slice()),v=s.length>0&&s[0].dataRef.order.value!==null?s.sort((y,F)=>y.dataRef.order.value-F.dataRef.order.value):Te(s,y=>x(y.dataRef.domRef)),R=i?v.indexOf(i):null;return R===-1&&(R=null),{options:v,activeOptionIndex:R}}let M=b(()=>a.multiple?1:0),K=b(()=>a.nullable),[B,d]=pe(b(()=>a.modelValue),l=>O("update:modelValue",l),b(()=>a.defaultValue)),o=b(()=>B.value===void 0?$(M.value,{[1]:[],[0]:void 0}):B.value),m=null,S=null;function h(l){return $(M.value,{[0](){return d==null?void 0:d(l)},[1]:()=>{let i=L(n.value.value).slice(),s=L(l),v=i.findIndex(R=>n.compare(s,L(R)));return v===-1?i.push(s):i.splice(v,1),d==null?void 0:d(i)}})}let T=b(()=>{var l;return(l=a.virtual)==null?void 0:l.options});q([T],([l],[i])=>{if(n.virtual.value&&l&&i&&g.value!==null){let s=l.indexOf(i[g.value]);s!==-1?g.value=s:g.value=null}});let n={comboboxState:t,value:o,mode:M,compare(l,i){if(typeof a.by=="string"){let s=a.by;return(l==null?void 0:l[s])===(i==null?void 0:i[s])}return a.by===null?De(l,i):a.by(l,i)},calculateIndex(l){return n.virtual.value?a.by===null?n.virtual.value.options.indexOf(l):n.virtual.value.options.findIndex(i=>n.compare(i,l)):c.value.findIndex(i=>n.compare(i.dataRef.value,l))},defaultValue:b(()=>a.defaultValue),nullable:K,immediate:b(()=>a.immediate),virtual:b(()=>{var l;return a.virtual?{options:a.virtual.options,disabled:(l=a.virtual.disabled)!=null?l:()=>!1}:null}),inputRef:C,labelRef:e,buttonRef:r,optionsRef:f,disabled:b(()=>a.disabled),options:c,change(l){d(l)},activeOptionIndex:b(()=>{if(D.value&&g.value===null&&(n.virtual.value?n.virtual.value.options.length>0:c.value.length>0)){if(n.virtual.value){let i=n.virtual.value.options.findIndex(s=>{var v;return!((v=n.virtual.value)!=null&&v.disabled(s))});if(i!==-1)return i}let l=c.value.findIndex(i=>!i.dataRef.disabled);if(l!==-1)return l}return g.value}),activationTrigger:P,optionsPropsRef:p,closeCombobox(){D.value=!1,!a.disabled&&t.value!==1&&(t.value=1,g.value=null)},openCombobox(){if(D.value=!0,!a.disabled&&t.value!==0){if(n.value.value){let l=n.calculateIndex(n.value.value);l!==-1&&(g.value=l)}t.value=0}},setActivationTrigger(l){P.value=l},goToOption(l,i,s){D.value=!1,m!==null&&cancelAnimationFrame(m),m=requestAnimationFrame(()=>{if(a.disabled||f.value&&!p.value.static&&t.value===1)return;if(n.virtual.value){g.value=l===w.Specific?i:le({focus:l},{resolveItems:()=>n.virtual.value.options,resolveActiveIndex:()=>{var y,F;return(F=(y=n.activeOptionIndex.value)!=null?y:n.virtual.value.options.findIndex(W=>{var U;return!((U=n.virtual.value)!=null&&U.disabled(W))}))!=null?F:null},resolveDisabled:y=>n.virtual.value.disabled(y),resolveId(){throw new Error("Function not implemented.")}}),P.value=s!=null?s:2;return}let v=V();if(v.activeOptionIndex===null){let y=v.options.findIndex(F=>!F.dataRef.disabled);y!==-1&&(v.activeOptionIndex=y)}let R=l===w.Specific?i:le({focus:l},{resolveItems:()=>v.options,resolveActiveIndex:()=>v.activeOptionIndex,resolveId:y=>y.id,resolveDisabled:y=>y.dataRef.disabled});g.value=R,P.value=s!=null?s:2,c.value=v.options})},selectOption(l){let i=c.value.find(v=>v.id===l);if(!i)return;let{dataRef:s}=i;h(s.value)},selectActiveOption(){if(n.activeOptionIndex.value!==null){if(n.virtual.value)h(n.virtual.value.options[n.activeOptionIndex.value]);else{let{dataRef:l}=c.value[n.activeOptionIndex.value];h(l.value)}n.goToOption(w.Specific,n.activeOptionIndex.value)}},registerOption(l,i){let s=ve({id:l,dataRef:i});if(n.virtual.value){c.value.push(s);return}S&&cancelAnimationFrame(S);let v=V(R=>(R.push(s),R));g.value===null&&n.isSelected(i.value.value)&&(v.activeOptionIndex=v.options.indexOf(s)),c.value=v.options,g.value=v.activeOptionIndex,P.value=2,v.options.some(R=>!x(R.dataRef.domRef))&&(S=requestAnimationFrame(()=>{let R=V();c.value=R.options,g.value=R.activeOptionIndex}))},unregisterOption(l,i){if(m!==null&&cancelAnimationFrame(m),i&&(D.value=!0),n.virtual.value){c.value=c.value.filter(v=>v.id!==l);return}let s=V(v=>{let R=v.findIndex(y=>y.id===l);return R!==-1&&v.splice(R,1),v});c.value=s.options,g.value=s.activeOptionIndex,P.value=2},isSelected(l){return $(M.value,{[0]:()=>n.compare(L(n.value.value),L(l)),[1]:()=>L(n.value.value).some(i=>n.compare(L(i),L(l)))})},isActive(l){return g.value===n.calculateIndex(l)}};ce([C,r,f],()=>n.closeCombobox(),b(()=>t.value===0)),te(ne,n),Re(b(()=>$(t.value,{[0]:G.Open,[1]:G.Closed})));let E=b(()=>{var l;return(l=x(C))==null?void 0:l.closest("form")});return X(()=>{q([E],()=>{if(!E.value||a.defaultValue===void 0)return;function l(){n.change(a.defaultValue)}return E.value.addEventListener("reset",l),()=>{var i;(i=E.value)==null||i.removeEventListener("reset",l)}},{immediate:!0})}),()=>{var y,F,W;let{name:l,disabled:i,form:s,...v}=a,R={open:t.value===0,disabled:i,activeIndex:n.activeOptionIndex.value,activeOption:n.activeOptionIndex.value===null?null:n.virtual.value?n.virtual.value.options[(y=n.activeOptionIndex.value)!=null?y:0]:(W=(F=n.options.value[n.activeOptionIndex.value])==null?void 0:F.dataRef.value)!=null?W:null,value:o.value};return z(de,[...l!=null&&o.value!=null?Ie({[l]:o.value}).map(([U,ue])=>z(Se,we({features:Oe.Hidden,key:U,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:s,disabled:i,name:U,value:ue}))):[],_({theirProps:{...u,...Z(v,["by","defaultValue","immediate","modelValue","multiple","nullable","onUpdate:modelValue","virtual"])},ourProps:{},slot:R,slots:I,attrs:u,name:"Combobox"})])}}}),at=j({name:"ComboboxLabel",props:{as:{type:[Object,String],default:"label"},id:{type:String,default:()=>`headlessui-combobox-label-${J()}`}},setup(a,{attrs:I,slots:u}){let O=N("ComboboxLabel");function t(){var e;(e=x(O.inputRef))==null||e.focus({preventScroll:!0})}return()=>{let e={open:O.comboboxState.value===0,disabled:O.disabled.value},{id:C,...r}=a,f={id:C,ref:O.labelRef,onClick:t};return _({ourProps:f,theirProps:r,slot:e,attrs:I,slots:u,name:"ComboboxLabel"})}}}),nt=j({name:"ComboboxButton",props:{as:{type:[Object,String],default:"button"},id:{type:String,default:()=>`headlessui-combobox-button-${J()}`}},setup(a,{attrs:I,slots:u,expose:O}){let t=N("ComboboxButton");O({el:t.buttonRef,$el:t.buttonRef});function e(f){t.disabled.value||(t.comboboxState.value===0?t.closeCombobox():(f.preventDefault(),t.openCombobox()),H(()=>{var p;return(p=x(t.inputRef))==null?void 0:p.focus({preventScroll:!0})}))}function C(f){switch(f.key){case k.ArrowDown:f.preventDefault(),f.stopPropagation(),t.comboboxState.value===1&&t.openCombobox(),H(()=>{var p;return(p=t.inputRef.value)==null?void 0:p.focus({preventScroll:!0})});return;case k.ArrowUp:f.preventDefault(),f.stopPropagation(),t.comboboxState.value===1&&(t.openCombobox(),H(()=>{t.value.value||t.goToOption(w.Last)})),H(()=>{var p;return(p=t.inputRef.value)==null?void 0:p.focus({preventScroll:!0})});return;case k.Escape:if(t.comboboxState.value!==0)return;f.preventDefault(),t.optionsRef.value&&!t.optionsPropsRef.value.static&&f.stopPropagation(),t.closeCombobox(),H(()=>{var p;return(p=t.inputRef.value)==null?void 0:p.focus({preventScroll:!0})});return}}let r=me(b(()=>({as:a.as,type:I.type})),t.buttonRef);return()=>{var P,D;let f={open:t.comboboxState.value===0,disabled:t.disabled.value,value:t.value.value},{id:p,...c}=a,g={ref:t.buttonRef,id:p,type:r.value,tabindex:"-1","aria-haspopup":"listbox","aria-controls":(P=x(t.optionsRef))==null?void 0:P.id,"aria-expanded":t.comboboxState.value===0,"aria-labelledby":t.labelRef.value?[(D=x(t.labelRef))==null?void 0:D.id,p].join(" "):void 0,disabled:t.disabled.value===!0?!0:void 0,onKeydown:C,onClick:e};return _({ourProps:g,theirProps:c,slot:f,attrs:I,slots:u,name:"ComboboxButton"})}}}),it=j({name:"ComboboxInput",props:{as:{type:[Object,String],default:"input"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0},displayValue:{type:Function},defaultValue:{type:String,default:void 0},id:{type:String,default:()=>`headlessui-combobox-input-${J()}`}},emits:{change:a=>!0},setup(a,{emit:I,attrs:u,slots:O,expose:t}){let e=N("ComboboxInput"),C=b(()=>he(x(e.inputRef))),r={value:!1};t({el:e.inputRef,$el:e.inputRef});function f(){e.change(null);let o=x(e.optionsRef);o&&(o.scrollTop=0),e.goToOption(w.Nothing)}let p=b(()=>{var m;let o=e.value.value;return x(e.inputRef)?typeof a.displayValue!="undefined"&&o!==void 0?(m=a.displayValue(o))!=null?m:"":typeof o=="string"?o:"":""});X(()=>{q([p,e.comboboxState,C],([o,m],[S,h])=>{if(r.value)return;let T=x(e.inputRef);T&&((h===0&&m===1||o!==S)&&(T.value=o),requestAnimationFrame(()=>{var l;if(r.value||!T||((l=C.value)==null?void 0:l.activeElement)!==T)return;let{selectionStart:n,selectionEnd:E}=T;Math.abs((E!=null?E:0)-(n!=null?n:0))===0&&n===0&&T.setSelectionRange(T.value.length,T.value.length)}))},{immediate:!0}),q([e.comboboxState],([o],[m])=>{if(o===0&&m===1){if(r.value)return;let S=x(e.inputRef);if(!S)return;let h=S.value,{selectionStart:T,selectionEnd:n,selectionDirection:E}=S;S.value="",S.value=h,E!==null?S.setSelectionRange(T,n,E):S.setSelectionRange(T,n)}})});let c=A(!1);function g(){c.value=!0}function P(){ae().nextFrame(()=>{c.value=!1})}let D=be();function V(o){switch(r.value=!0,D(()=>{c.value||(r.value=!1)}),o.key){case k.Enter:if(r.value=!1,e.comboboxState.value!==0||c.value)return;if(o.preventDefault(),o.stopPropagation(),e.activeOptionIndex.value===null){e.closeCombobox();return}e.selectActiveOption(),e.mode.value===0&&e.closeCombobox();break;case k.ArrowDown:return r.value=!1,o.preventDefault(),o.stopPropagation(),$(e.comboboxState.value,{[0]:()=>e.goToOption(w.Next),[1]:()=>e.openCombobox()});case k.ArrowUp:return r.value=!1,o.preventDefault(),o.stopPropagation(),$(e.comboboxState.value,{[0]:()=>e.goToOption(w.Previous),[1]:()=>{e.openCombobox(),H(()=>{e.value.value||e.goToOption(w.Last)})}});case k.Home:if(o.shiftKey)break;return r.value=!1,o.preventDefault(),o.stopPropagation(),e.goToOption(w.First);case k.PageUp:return r.value=!1,o.preventDefault(),o.stopPropagation(),e.goToOption(w.First);case k.End:if(o.shiftKey)break;return r.value=!1,o.preventDefault(),o.stopPropagation(),e.goToOption(w.Last);case k.PageDown:return r.value=!1,o.preventDefault(),o.stopPropagation(),e.goToOption(w.Last);case k.Escape:if(r.value=!1,e.comboboxState.value!==0)return;o.preventDefault(),e.optionsRef.value&&!e.optionsPropsRef.value.static&&o.stopPropagation(),e.nullable.value&&e.mode.value===0&&e.value.value===null&&f(),e.closeCombobox();break;case k.Tab:if(r.value=!1,e.comboboxState.value!==0)return;e.mode.value===0&&e.activationTrigger.value!==1&&e.selectActiveOption(),e.closeCombobox();break}}function M(o){I("change",o),e.nullable.value&&e.mode.value===0&&o.target.value===""&&f(),e.openCombobox()}function K(o){var S,h,T;let m=(S=o.relatedTarget)!=null?S:oe.find(n=>n!==o.currentTarget);if(r.value=!1,!((h=x(e.optionsRef))!=null&&h.contains(m))&&!((T=x(e.buttonRef))!=null&&T.contains(m))&&e.comboboxState.value===0)return o.preventDefault(),e.mode.value===0&&(e.nullable.value&&e.value.value===null?f():e.activationTrigger.value!==1&&e.selectActiveOption()),e.closeCombobox()}function B(o){var S,h,T;let m=(S=o.relatedTarget)!=null?S:oe.find(n=>n!==o.currentTarget);(h=x(e.buttonRef))!=null&&h.contains(m)||(T=x(e.optionsRef))!=null&&T.contains(m)||e.disabled.value||e.immediate.value&&e.comboboxState.value!==0&&(e.openCombobox(),ae().nextFrame(()=>{e.setActivationTrigger(1)}))}let d=b(()=>{var o,m,S,h;return(h=(S=(m=a.defaultValue)!=null?m:e.defaultValue.value!==void 0?(o=a.displayValue)==null?void 0:o.call(a,e.defaultValue.value):null)!=null?S:e.defaultValue.value)!=null?h:""});return()=>{var E,l,i,s,v,R,y;let o={open:e.comboboxState.value===0},{id:m,displayValue:S,onChange:h,...T}=a,n={"aria-controls":(E=e.optionsRef.value)==null?void 0:E.id,"aria-expanded":e.comboboxState.value===0,"aria-activedescendant":e.activeOptionIndex.value===null?void 0:e.virtual.value?(l=e.options.value.find(F=>!e.virtual.value.disabled(F.dataRef.value)&&e.compare(F.dataRef.value,e.virtual.value.options[e.activeOptionIndex.value])))==null?void 0:l.id:(i=e.options.value[e.activeOptionIndex.value])==null?void 0:i.id,"aria-labelledby":(R=(s=x(e.labelRef))==null?void 0:s.id)!=null?R:(v=x(e.buttonRef))==null?void 0:v.id,"aria-autocomplete":"list",id:m,onCompositionstart:g,onCompositionend:P,onKeydown:V,onInput:M,onFocus:B,onBlur:K,role:"combobox",type:(y=u.type)!=null?y:"text",tabIndex:0,ref:e.inputRef,defaultValue:d.value,disabled:e.disabled.value===!0?!0:void 0};return _({ourProps:n,theirProps:T,slot:o,attrs:u,slots:O,features:Q.RenderStrategy|Q.Static,name:"ComboboxInput"})}}}),ut=j({name:"ComboboxOptions",props:{as:{type:[Object,String],default:"ul"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0},hold:{type:[Boolean],default:!1}},setup(a,{attrs:I,slots:u,expose:O}){let t=N("ComboboxOptions"),e=`headlessui-combobox-options-${J()}`;O({el:t.optionsRef,$el:t.optionsRef}),Y(()=>{t.optionsPropsRef.value.static=a.static}),Y(()=>{t.optionsPropsRef.value.hold=a.hold});let C=Ce(),r=b(()=>C!==null?(C.value&G.Open)===G.Open:t.comboboxState.value===0);ge({container:b(()=>x(t.optionsRef)),enabled:b(()=>t.comboboxState.value===0),accept(p){return p.getAttribute("role")==="option"?NodeFilter.FILTER_REJECT:p.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(p){p.setAttribute("role","none")}});function f(p){p.preventDefault()}return()=>{var P,D,V;let p={open:t.comboboxState.value===0},c={"aria-labelledby":(V=(P=x(t.labelRef))==null?void 0:P.id)!=null?V:(D=x(t.buttonRef))==null?void 0:D.id,id:e,ref:t.optionsRef,role:"listbox","aria-multiselectable":t.mode.value===1?!0:void 0,onMousedown:f},g=Z(a,["hold"]);return _({ourProps:c,theirProps:g,slot:p,attrs:I,slots:t.virtual.value&&t.comboboxState.value===0?{...u,default:()=>[z(Fe,{},u.default)]}:u,features:Q.RenderStrategy|Q.Static,visible:r.value,name:"ComboboxOptions"})}}}),rt=j({name:"ComboboxOption",props:{as:{type:[Object,String],default:"li"},value:{type:[Object,String,Number,Boolean]},disabled:{type:Boolean,default:!1},order:{type:[Number],default:null}},setup(a,{slots:I,attrs:u,expose:O}){let t=N("ComboboxOption"),e=`headlessui-combobox-option-${J()}`,C=A(null),r=b(()=>{var d;return a.disabled||((d=t.virtual.value)==null?void 0:d.disabled(a.value))});O({el:C,$el:C});let f=b(()=>{var d;return t.virtual.value?t.activeOptionIndex.value===t.calculateIndex(a.value):t.activeOptionIndex.value===null?!1:((d=t.options.value[t.activeOptionIndex.value])==null?void 0:d.id)===e}),p=b(()=>t.isSelected(a.value)),c=ee(ie,null),g=b(()=>({disabled:a.disabled,value:a.value,domRef:C,order:b(()=>a.order)}));X(()=>t.registerOption(e,g)),fe(()=>t.unregisterOption(e,f.value)),Y(()=>{let d=x(C);d&&(c==null||c.value.measureElement(d))}),Y(()=>{t.comboboxState.value===0&&f.value&&(t.virtual.value||t.activationTrigger.value!==0&&H(()=>{var d,o;return(o=(d=x(C))==null?void 0:d.scrollIntoView)==null?void 0:o.call(d,{block:"nearest"})}))});function P(d){d.preventDefault(),d.button===ye.Left&&(r.value||(t.selectOption(e),Pe()||requestAnimationFrame(()=>{var o;return(o=x(t.inputRef))==null?void 0:o.focus({preventScroll:!0})}),t.mode.value===0&&t.closeCombobox()))}function D(){var o;if(a.disabled||(o=t.virtual.value)!=null&&o.disabled(a.value))return t.goToOption(w.Nothing);let d=t.calculateIndex(a.value);t.goToOption(w.Specific,d)}let V=xe();function M(d){V.update(d)}function K(d){var m;if(!V.wasMoved(d)||a.disabled||(m=t.virtual.value)!=null&&m.disabled(a.value)||f.value)return;let o=t.calculateIndex(a.value);t.goToOption(w.Specific,o,0)}function B(d){var o;V.wasMoved(d)&&(a.disabled||(o=t.virtual.value)!=null&&o.disabled(a.value)||f.value&&(t.optionsPropsRef.value.hold||t.goToOption(w.Nothing)))}return()=>{let{disabled:d}=a,o={active:f.value,selected:p.value,disabled:d},m={id:e,ref:C,role:"option",tabIndex:d===!0?void 0:-1,"aria-disabled":d===!0?!0:void 0,"aria-selected":p.value,disabled:void 0,onMousedown:P,onFocus:D,onPointerenter:M,onMouseenter:M,onPointermove:K,onMousemove:K,onPointerleave:B,onMouseleave:B},S=Z(a,["order","value"]);return _({ourProps:m,theirProps:S,slot:o,attrs:u,slots:I,name:"ComboboxOption"})}}});export{lt as Combobox,nt as ComboboxButton,it as ComboboxInput,at as ComboboxLabel,rt as ComboboxOption,ut as ComboboxOptions};

@@ -1,2 +0,2 @@

import { ComputedRef, Ref } from 'vue';
import { type ComputedRef, type Ref } from 'vue';
export declare function useDescriptions({ slot, name, props, }?: {

@@ -30,4 +30,4 @@ slot?: Ref<Record<string, unknown>>;

}>>, {
id: string;
as: string | Record<string, any>;
id: string;
}>;

@@ -1,1 +0,1 @@

import{computed as m,defineComponent as x,inject as R,onMounted as v,onUnmounted as D,provide as j,ref as u,unref as y}from"vue";import{useId as C}from'../../hooks/use-id.js';import{render as h}from'../../utils/render.js';let p=Symbol("DescriptionContext");function b(){let t=R(p,null);if(t===null)throw new Error("Missing parent");return t}function M({slot:t=u({}),name:i="Description",props:o={}}={}){let e=u([]);function s(n){return e.value.push(n),()=>{let r=e.value.indexOf(n);r!==-1&&e.value.splice(r,1)}}return j(p,{register:s,slot:t,name:i,props:o}),m(()=>e.value.length>0?e.value.join(" "):void 0)}let E=x({name:"Description",props:{as:{type:[Object,String],default:"p"},id:{type:String,default:()=>`headlessui-description-${C()}`}},setup(t,{attrs:i,slots:o}){let e=b();return v(()=>D(e.register(t.id))),()=>{let{name:s="Description",slot:n=u({}),props:r={}}=e,{id:d,...l}=t,c={...Object.entries(r).reduce((f,[a,g])=>Object.assign(f,{[a]:y(g)}),{}),id:d};return h({ourProps:c,theirProps:l,slot:n.value,attrs:i,slots:o,name:s})}}});export{E as Description,M as useDescriptions};
import{computed as m,defineComponent as x,inject as y,onMounted as R,onUnmounted as v,provide as D,ref as p,unref as j}from"vue";import{useId as C}from'../../hooks/use-id.js';import{render as h}from'../../utils/render.js';let u=Symbol("DescriptionContext");function b(){let t=y(u,null);if(t===null)throw new Error("Missing parent");return t}function S({slot:t=p({}),name:i="Description",props:o={}}={}){let e=p([]);function s(n){return e.value.push(n),()=>{let r=e.value.indexOf(n);r!==-1&&e.value.splice(r,1)}}return D(u,{register:s,slot:t,name:i,props:o}),m(()=>e.value.length>0?e.value.join(" "):void 0)}let k=x({name:"Description",props:{as:{type:[Object,String],default:"p"},id:{type:String,default:()=>`headlessui-description-${C()}`}},setup(t,{attrs:i,slots:o}){let e=b();return R(()=>v(e.register(t.id))),()=>{let{name:s="Description",slot:n=p({}),props:r={}}=e,{id:d,...l}=t,c={...Object.entries(r).reduce((f,[a,g])=>Object.assign(f,{[a]:j(g)}),{}),id:d};return h({ourProps:c,theirProps:l,slot:n.value,attrs:i,slots:o,name:s})}}});export{k as Description,S as useDescriptions};

@@ -1,2 +0,2 @@

import { PropType } from 'vue';
import { type PropType } from 'vue';
export declare let Dialog: import("vue").DefineComponent<{

@@ -27,2 +27,6 @@ as: {

};
role: {
type: PropType<"dialog" | "alertdialog">;
default: string;
};
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {

@@ -57,9 +61,14 @@ [key: string]: any;

};
role: {
type: PropType<"dialog" | "alertdialog">;
default: string;
};
}>> & {
onClose?: ((_close: boolean) => any) | undefined;
}, {
id: string;
role: "dialog" | "alertdialog";
as: string | Record<string, any>;
unmount: boolean;
static: boolean;
id: string;
open: string | boolean;

@@ -91,4 +100,4 @@ initialFocus: HTMLElement | null;

}>>, {
id: string;
as: string | Record<string, any>;
id: string;
}>;

@@ -116,4 +125,4 @@ export declare let DialogBackdrop: import("vue").DefineComponent<{

}>>, {
id: string;
as: string | Record<string, any>;
id: string;
}>;

@@ -143,4 +152,4 @@ export declare let DialogPanel: import("vue").DefineComponent<{

}>>, {
id: string;
as: string | Record<string, any>;
id: string;
}>;

@@ -170,4 +179,4 @@ export declare let DialogTitle: import("vue").DefineComponent<{

}>>, {
id: string;
as: string | Record<string, any>;
id: string;
}>;

@@ -197,4 +206,4 @@ export declare let DialogDescription: import("vue").DefineComponent<{

}>>, {
id: string;
as: string | Record<string, any>;
id: string;
}>;

@@ -1,1 +0,1 @@

import{computed as o,defineComponent as b,h as D,inject as q,nextTick as le,onMounted as F,onUnmounted as re,provide as ae,ref as S,watchEffect as oe}from"vue";import{render as P,Features as K}from'../../utils/render.js';import{Keys as ne}from'../../keyboard.js';import{useId as T}from'../../hooks/use-id.js';import{FocusTrap as C}from'../../components/focus-trap/focus-trap.js';import{useInert as _}from'../../hooks/use-inert.js';import{Portal as U,PortalGroup as ie}from'../portal/portal.js';import{StackMessage as Y,useStackProvider as ue}from'../../internal/stack-context.js';import{match as z}from'../../utils/match.js';import{ForcePortalRoot as B}from'../../internal/portal-force-root.js';import{Description as se,useDescriptions as pe}from'../description/description.js';import{dom as L}from'../../utils/dom.js';import{useOpenClosed as fe,State as A}from'../../internal/open-closed.js';import{useOutsideClick as de}from'../../hooks/use-outside-click.js';import{getOwnerDocument as ce}from'../../utils/owner.js';import{useEventListener as ge}from'../../hooks/use-event-listener.js';import{Hidden as me,Features as ve}from'../../internal/hidden.js';import{useDocumentOverflowLockedEffect as De}from'../../hooks/document-overflow/use-document-overflow.js';var ye=(l=>(l[l.Open=0]="Open",l[l.Closed=1]="Closed",l))(ye||{});let I=Symbol("DialogContext");function E(r){let n=q(I,null);if(n===null){let l=new Error(`<${r} /> is missing a parent <Dialog /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(l,E),l}return n}let H="DC8F892D-2EBD-447C-A4C8-A03058436FF4",qe=b({name:"Dialog",inheritAttrs:!1,props:{as:{type:[Object,String],default:"div"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0},open:{type:[Boolean,String],default:H},initialFocus:{type:Object,default:null},id:{type:String,default:()=>`headlessui-dialog-${T()}`}},emits:{close:r=>!0},setup(r,{emit:n,attrs:l,slots:p,expose:i}){var N;let a=S(!1);F(()=>{a.value=!0});let f=S(0),d=fe(),m=o(()=>r.open===H&&d!==null?(d.value&A.Open)===A.Open:r.open),v=S(null),R=S(null),O=o(()=>ce(v));if(i({el:v,$el:v}),!(r.open!==H||d!==null))throw new Error("You forgot to provide an `open` prop to the `Dialog`.");if(typeof m.value!="boolean")throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${m.value===H?void 0:r.open}`);let c=o(()=>a.value&&m.value?0:1),k=o(()=>c.value===0),w=o(()=>f.value>1),$=q(I,null)!==null,G=o(()=>w.value?"parent":"leaf"),j=o(()=>d!==null?(d.value&A.Closing)===A.Closing:!1),V=o(()=>$||j.value?!1:k.value),J=o(()=>{var e,t,u;return(u=Array.from((t=(e=O.value)==null?void 0:e.querySelectorAll("body > *"))!=null?t:[]).find(s=>s.id==="headlessui-portal-root"?!1:s.contains(L(R))&&s instanceof HTMLElement))!=null?u:null});_(J,V);let Q=o(()=>w.value?!0:k.value),W=o(()=>{var e,t,u;return(u=Array.from((t=(e=O.value)==null?void 0:e.querySelectorAll("[data-headlessui-portal]"))!=null?t:[]).find(s=>s.contains(L(R))&&s instanceof HTMLElement))!=null?u:null});_(W,Q),ue({type:"Dialog",enabled:o(()=>c.value===0),element:v,onUpdate:(e,t)=>{if(t==="Dialog")return z(e,{[Y.Add]:()=>f.value+=1,[Y.Remove]:()=>f.value-=1})}});let X=pe({name:"DialogDescription",slot:o(()=>({open:m.value}))}),M=S(null),y={titleId:M,panelRef:S(null),dialogState:c,setTitleId(e){M.value!==e&&(M.value=e)},close(){n("close",!1)}};ae(I,y);function x(){var t,u,s;return[...Array.from((u=(t=O.value)==null?void 0:t.querySelectorAll("html > *, body > *, [data-headlessui-portal]"))!=null?u:[]).filter(g=>!(g===document.body||g===document.head||!(g instanceof HTMLElement)||g.contains(L(R))||y.panelRef.value&&g.contains(y.panelRef.value))),(s=y.panelRef.value)!=null?s:v.value]}let Z=o(()=>!(!k.value||w.value));de(()=>x(),(e,t)=>{y.close(),le(()=>t==null?void 0:t.focus())},Z);let ee=o(()=>!(w.value||c.value!==0));ge((N=O.value)==null?void 0:N.defaultView,"keydown",e=>{ee.value&&(e.defaultPrevented||e.key===ne.Escape&&(e.preventDefault(),e.stopPropagation(),y.close()))});let te=o(()=>!(j.value||c.value!==0||$));return De(O,te,e=>{var t;return{containers:[...(t=e.containers)!=null?t:[],x]}}),oe(e=>{if(c.value!==0)return;let t=L(v);if(!t)return;let u=new ResizeObserver(s=>{for(let g of s){let h=g.target.getBoundingClientRect();h.x===0&&h.y===0&&h.width===0&&h.height===0&&y.close()}});u.observe(t),e(()=>u.disconnect())}),()=>{let{id:e,open:t,initialFocus:u,...s}=r,g={...l,ref:v,id:e,role:"dialog","aria-modal":c.value===0?!0:void 0,"aria-labelledby":M.value,"aria-describedby":X.value},h={open:c.value===0};return D(B,{force:!0},()=>[D(U,()=>D(ie,{target:v.value},()=>D(B,{force:!1},()=>D(C,{initialFocus:u,containers:x,features:k.value?z(G.value,{parent:C.features.RestoreFocus,leaf:C.features.All&~C.features.FocusLock}):C.features.None},()=>P({ourProps:g,theirProps:s,slot:h,attrs:l,slots:p,visible:c.value===0,features:K.RenderStrategy|K.Static,name:"Dialog"}))))),D(me,{features:ve.Hidden,ref:R})])}}}),Ke=b({name:"DialogOverlay",props:{as:{type:[Object,String],default:"div"},id:{type:String,default:()=>`headlessui-dialog-overlay-${T()}`}},setup(r,{attrs:n,slots:l}){let p=E("DialogOverlay");function i(a){a.target===a.currentTarget&&(a.preventDefault(),a.stopPropagation(),p.close())}return()=>{let{id:a,...f}=r;return P({ourProps:{id:a,"aria-hidden":!0,onClick:i},theirProps:f,slot:{open:p.dialogState.value===0},attrs:n,slots:l,name:"DialogOverlay"})}}}),_e=b({name:"DialogBackdrop",props:{as:{type:[Object,String],default:"div"},id:{type:String,default:()=>`headlessui-dialog-backdrop-${T()}`}},inheritAttrs:!1,setup(r,{attrs:n,slots:l,expose:p}){let i=E("DialogBackdrop"),a=S(null);return p({el:a,$el:a}),F(()=>{if(i.panelRef.value===null)throw new Error("A <DialogBackdrop /> component is being used, but a <DialogPanel /> component is missing.")}),()=>{let{id:f,...d}=r,m={id:f,ref:a,"aria-hidden":!0};return D(B,{force:!0},()=>D(U,()=>P({ourProps:m,theirProps:{...n,...d},slot:{open:i.dialogState.value===0},attrs:n,slots:l,name:"DialogBackdrop"})))}}}),Ue=b({name:"DialogPanel",props:{as:{type:[Object,String],default:"div"},id:{type:String,default:()=>`headlessui-dialog-panel-${T()}`}},setup(r,{attrs:n,slots:l,expose:p}){let i=E("DialogPanel");p({el:i.panelRef,$el:i.panelRef});function a(f){f.stopPropagation()}return()=>{let{id:f,...d}=r,m={id:f,ref:i.panelRef,onClick:a};return P({ourProps:m,theirProps:d,slot:{open:i.dialogState.value===0},attrs:n,slots:l,name:"DialogPanel"})}}}),Ye=b({name:"DialogTitle",props:{as:{type:[Object,String],default:"h2"},id:{type:String,default:()=>`headlessui-dialog-title-${T()}`}},setup(r,{attrs:n,slots:l}){let p=E("DialogTitle");return F(()=>{p.setTitleId(r.id),re(()=>p.setTitleId(null))}),()=>{let{id:i,...a}=r;return P({ourProps:{id:i},theirProps:a,slot:{open:p.dialogState.value===0},attrs:n,slots:l,name:"DialogTitle"})}}}),ze=se;export{qe as Dialog,_e as DialogBackdrop,ze as DialogDescription,Ke as DialogOverlay,Ue as DialogPanel,Ye as DialogTitle};
import{computed as o,defineComponent as O,h as g,inject as q,nextTick as ie,onMounted as L,onUnmounted as ue,provide as se,ref as y,watchEffect as pe}from"vue";import{FocusTrap as P}from'../../components/focus-trap/focus-trap.js';import{useDocumentOverflowLockedEffect as de}from'../../hooks/document-overflow/use-document-overflow.js';import{useEventListener as fe}from'../../hooks/use-event-listener.js';import{useId as b}from'../../hooks/use-id.js';import{useInert as W}from'../../hooks/use-inert.js';import{useOutsideClick as ge}from'../../hooks/use-outside-click.js';import{useRootContainers as ce}from'../../hooks/use-root-containers.js';import{State as x,useOpenClosed as ve}from'../../internal/open-closed.js';import{ForcePortalRoot as $}from'../../internal/portal-force-root.js';import{StackMessage as Y,useStackProvider as me}from'../../internal/stack-context.js';import{Keys as De}from'../../keyboard.js';import{dom as F}from'../../utils/dom.js';import{match as _}from'../../utils/match.js';import{getOwnerDocument as ye}from'../../utils/owner.js';import{Features as z,render as C}from'../../utils/render.js';import{Description as Se,useDescriptions as he}from'../description/description.js';import{Portal as G,PortalGroup as Oe,useNestedPortals as Pe}from'../portal/portal.js';var be=(l=>(l[l.Open=0]="Open",l[l.Closed=1]="Closed",l))(be||{});let j=Symbol("DialogContext");function T(t){let n=q(j,null);if(n===null){let l=new Error(`<${t} /> is missing a parent <Dialog /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(l,T),l}return n}let I="DC8F892D-2EBD-447C-A4C8-A03058436FF4",qe=O({name:"Dialog",inheritAttrs:!1,props:{as:{type:[Object,String],default:"div"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0},open:{type:[Boolean,String],default:I},initialFocus:{type:Object,default:null},id:{type:String,default:()=>`headlessui-dialog-${b()}`},role:{type:String,default:"dialog"}},emits:{close:t=>!0},setup(t,{emit:n,attrs:l,slots:u,expose:i}){var U;let r=y(!1);L(()=>{r.value=!0});let s=!1,v=o(()=>t.role==="dialog"||t.role==="alertdialog"?t.role:(s||(s=!0,console.warn(`Invalid role [${v}] passed to <Dialog />. Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)),"dialog")),m=y(0),S=ve(),R=o(()=>t.open===I&&S!==null?(S.value&x.Open)===x.Open:t.open),c=y(null),E=o(()=>ye(c));if(i({el:c,$el:c}),!(t.open!==I||S!==null))throw new Error("You forgot to provide an `open` prop to the `Dialog`.");if(typeof R.value!="boolean")throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${R.value===I?void 0:t.open}`);let f=o(()=>r.value&&R.value?0:1),k=o(()=>f.value===0),w=o(()=>m.value>1),H=q(j,null)!==null,[V,J]=Pe(),{resolveContainers:A,mainTreeNodeRef:N,MainTreeNode:Q}=ce({portals:V,defaultContainers:[o(()=>{var e;return(e=h.panelRef.value)!=null?e:c.value})]}),X=o(()=>w.value?"parent":"leaf"),K=o(()=>S!==null?(S.value&x.Closing)===x.Closing:!1),Z=o(()=>H||K.value?!1:k.value),ee=o(()=>{var e,a,p;return(p=Array.from((a=(e=E.value)==null?void 0:e.querySelectorAll("body > *"))!=null?a:[]).find(d=>d.id==="headlessui-portal-root"?!1:d.contains(F(N))&&d instanceof HTMLElement))!=null?p:null});W(ee,Z);let te=o(()=>w.value?!0:k.value),le=o(()=>{var e,a,p;return(p=Array.from((a=(e=E.value)==null?void 0:e.querySelectorAll("[data-headlessui-portal]"))!=null?a:[]).find(d=>d.contains(F(N))&&d instanceof HTMLElement))!=null?p:null});W(le,te),me({type:"Dialog",enabled:o(()=>f.value===0),element:c,onUpdate:(e,a)=>{if(a==="Dialog")return _(e,{[Y.Add]:()=>m.value+=1,[Y.Remove]:()=>m.value-=1})}});let ae=he({name:"DialogDescription",slot:o(()=>({open:R.value}))}),M=y(null),h={titleId:M,panelRef:y(null),dialogState:f,setTitleId(e){M.value!==e&&(M.value=e)},close(){n("close",!1)}};se(j,h);let oe=o(()=>!(!k.value||w.value));ge(A,(e,a)=>{e.preventDefault(),h.close(),ie(()=>a==null?void 0:a.focus())},oe);let re=o(()=>!(w.value||f.value!==0));fe((U=E.value)==null?void 0:U.defaultView,"keydown",e=>{re.value&&(e.defaultPrevented||e.key===De.Escape&&(e.preventDefault(),e.stopPropagation(),h.close()))});let ne=o(()=>!(K.value||f.value!==0||H));return de(E,ne,e=>{var a;return{containers:[...(a=e.containers)!=null?a:[],A]}}),pe(e=>{if(f.value!==0)return;let a=F(c);if(!a)return;let p=new ResizeObserver(d=>{for(let B of d){let D=B.target.getBoundingClientRect();D.x===0&&D.y===0&&D.width===0&&D.height===0&&h.close()}});p.observe(a),e(()=>p.disconnect())}),()=>{let{id:e,open:a,initialFocus:p,...d}=t,B={...l,ref:c,id:e,role:v.value,"aria-modal":f.value===0?!0:void 0,"aria-labelledby":M.value,"aria-describedby":ae.value},D={open:f.value===0};return g($,{force:!0},()=>[g(G,()=>g(Oe,{target:c.value},()=>g($,{force:!1},()=>g(P,{initialFocus:p,containers:A,features:k.value?_(X.value,{parent:P.features.RestoreFocus,leaf:P.features.All&~P.features.FocusLock}):P.features.None},()=>g(J,{},()=>C({ourProps:B,theirProps:{...d,...l},slot:D,attrs:l,slots:u,visible:f.value===0,features:z.RenderStrategy|z.Static,name:"Dialog"})))))),g(Q)])}}}),We=O({name:"DialogOverlay",props:{as:{type:[Object,String],default:"div"},id:{type:String,default:()=>`headlessui-dialog-overlay-${b()}`}},setup(t,{attrs:n,slots:l}){let u=T("DialogOverlay");function i(r){r.target===r.currentTarget&&(r.preventDefault(),r.stopPropagation(),u.close())}return()=>{let{id:r,...s}=t;return C({ourProps:{id:r,"aria-hidden":!0,onClick:i},theirProps:s,slot:{open:u.dialogState.value===0},attrs:n,slots:l,name:"DialogOverlay"})}}}),Ye=O({name:"DialogBackdrop",props:{as:{type:[Object,String],default:"div"},id:{type:String,default:()=>`headlessui-dialog-backdrop-${b()}`}},inheritAttrs:!1,setup(t,{attrs:n,slots:l,expose:u}){let i=T("DialogBackdrop"),r=y(null);return u({el:r,$el:r}),L(()=>{if(i.panelRef.value===null)throw new Error("A <DialogBackdrop /> component is being used, but a <DialogPanel /> component is missing.")}),()=>{let{id:s,...v}=t,m={id:s,ref:r,"aria-hidden":!0};return g($,{force:!0},()=>g(G,()=>C({ourProps:m,theirProps:{...n,...v},slot:{open:i.dialogState.value===0},attrs:n,slots:l,name:"DialogBackdrop"})))}}}),_e=O({name:"DialogPanel",props:{as:{type:[Object,String],default:"div"},id:{type:String,default:()=>`headlessui-dialog-panel-${b()}`}},setup(t,{attrs:n,slots:l,expose:u}){let i=T("DialogPanel");u({el:i.panelRef,$el:i.panelRef});function r(s){s.stopPropagation()}return()=>{let{id:s,...v}=t,m={id:s,ref:i.panelRef,onClick:r};return C({ourProps:m,theirProps:v,slot:{open:i.dialogState.value===0},attrs:n,slots:l,name:"DialogPanel"})}}}),ze=O({name:"DialogTitle",props:{as:{type:[Object,String],default:"h2"},id:{type:String,default:()=>`headlessui-dialog-title-${b()}`}},setup(t,{attrs:n,slots:l}){let u=T("DialogTitle");return L(()=>{u.setTitleId(t.id),ue(()=>u.setTitleId(null))}),()=>{let{id:i,...r}=t;return C({ourProps:{id:i},theirProps:r,slot:{open:u.dialogState.value===0},attrs:n,slots:l,name:"DialogTitle"})}}}),Ge=Se;export{qe as Dialog,Ye as DialogBackdrop,Ge as DialogDescription,We as DialogOverlay,_e as DialogPanel,ze as DialogTitle};

@@ -38,3 +38,3 @@ export declare let Disclosure: import("vue").DefineComponent<{

type: StringConstructor;
default: () => string;
default: null;
};

@@ -56,8 +56,8 @@ }, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {

type: StringConstructor;
default: () => string;
default: null;
};
}>>, {
id: string;
as: string | Record<string, any>;
disabled: boolean;
id: string;
}>;

@@ -79,3 +79,3 @@ export declare let DisclosurePanel: import("vue").DefineComponent<{

type: StringConstructor;
default: () => string;
default: null;
};

@@ -101,9 +101,9 @@ }, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {

type: StringConstructor;
default: () => string;
default: null;
};
}>>, {
id: string;
as: string | Record<string, any>;
unmount: boolean;
static: boolean;
id: string;
}>;

@@ -1,1 +0,1 @@

import{defineComponent as y,ref as d,provide as C,inject as O,computed as m,watchEffect as M,onMounted as P,onUnmounted as h}from"vue";import{Keys as f}from'../../keyboard.js';import{match as I}from'../../utils/match.js';import{render as b,Features as R}from'../../utils/render.js';import{useId as E}from'../../hooks/use-id.js';import{dom as p}from'../../utils/dom.js';import{useOpenClosedProvider as w,State as v,useOpenClosed as H}from'../../internal/open-closed.js';import{useResolveButtonType as L}from'../../hooks/use-resolve-button-type.js';var j=(o=>(o[o.Open=0]="Open",o[o.Closed=1]="Closed",o))(j||{});let x=Symbol("DisclosureContext");function g(t){let r=O(x,null);if(r===null){let o=new Error(`<${t} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(o,g),o}return r}let B=Symbol("DisclosurePanelContext");function $(){return O(B,null)}let Q=y({name:"Disclosure",props:{as:{type:[Object,String],default:"template"},defaultOpen:{type:[Boolean],default:!1}},setup(t,{slots:r,attrs:o}){let u=d(t.defaultOpen?0:1),e=d(null),i=d(null),s={buttonId:d(null),panelId:d(null),disclosureState:u,panel:e,button:i,toggleDisclosure(){u.value=I(u.value,{[0]:1,[1]:0})},closeDisclosure(){u.value!==1&&(u.value=1)},close(l){s.closeDisclosure();let a=(()=>l?l instanceof HTMLElement?l:l.value instanceof HTMLElement?p(l):p(s.button):p(s.button))();a==null||a.focus()}};return C(x,s),w(m(()=>I(u.value,{[0]:v.Open,[1]:v.Closed}))),()=>{let{defaultOpen:l,...a}=t,c={open:u.value===0,close:s.close};return b({theirProps:a,ourProps:{},slot:c,slots:r,attrs:o,name:"Disclosure"})}}}),V=y({name:"DisclosureButton",props:{as:{type:[Object,String],default:"button"},disabled:{type:[Boolean],default:!1},id:{type:String,default:()=>`headlessui-disclosure-button-${E()}`}},setup(t,{attrs:r,slots:o,expose:u}){let e=g("DisclosureButton");P(()=>{e.buttonId.value=t.id}),h(()=>{e.buttonId.value=null});let i=$(),s=m(()=>i===null?!1:i.value===e.panelId.value),l=d(null);u({el:l,$el:l}),s.value||M(()=>{e.button.value=l.value});let a=L(m(()=>({as:t.as,type:r.type})),l);function c(){var n;t.disabled||(s.value?(e.toggleDisclosure(),(n=p(e.button))==null||n.focus()):e.toggleDisclosure())}function D(n){var S;if(!t.disabled)if(s.value)switch(n.key){case f.Space:case f.Enter:n.preventDefault(),n.stopPropagation(),e.toggleDisclosure(),(S=p(e.button))==null||S.focus();break}else switch(n.key){case f.Space:case f.Enter:n.preventDefault(),n.stopPropagation(),e.toggleDisclosure();break}}function T(n){switch(n.key){case f.Space:n.preventDefault();break}}return()=>{let n={open:e.disclosureState.value===0},{id:S,...k}=t,K=s.value?{ref:l,type:a.value,onClick:c,onKeydown:D}:{id:S,ref:l,type:a.value,"aria-expanded":t.disabled?void 0:e.disclosureState.value===0,"aria-controls":p(e.panel)?e.panelId.value:void 0,disabled:t.disabled?!0:void 0,onClick:c,onKeydown:D,onKeyup:T};return b({ourProps:K,theirProps:k,slot:n,attrs:r,slots:o,name:"DisclosureButton"})}}}),X=y({name:"DisclosurePanel",props:{as:{type:[Object,String],default:"div"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0},id:{type:String,default:()=>`headlessui-disclosure-panel-${E()}`}},setup(t,{attrs:r,slots:o,expose:u}){let e=g("DisclosurePanel");P(()=>{e.panelId.value=t.id}),h(()=>{e.panelId.value=null}),u({el:e.panel,$el:e.panel}),C(B,e.panelId);let i=H(),s=m(()=>i!==null?(i.value&v.Open)===v.Open:e.disclosureState.value===0);return()=>{let l={open:e.disclosureState.value===0,close:e.close},{id:a,...c}=t,D={id:a,ref:e.panel};return b({ourProps:D,theirProps:c,slot:l,attrs:r,slots:o,features:R.RenderStrategy|R.Static,visible:s.value,name:"DisclosurePanel"})}}});export{Q as Disclosure,V as DisclosureButton,X as DisclosurePanel};
import{computed as m,defineComponent as b,inject as I,onMounted as P,onUnmounted as h,provide as R,ref as d,watchEffect as w}from"vue";import{useId as E}from'../../hooks/use-id.js';import{useResolveButtonType as H}from'../../hooks/use-resolve-button-type.js';import{State as y,useOpenClosed as L,useOpenClosedProvider as j}from'../../internal/open-closed.js';import{Keys as f}from'../../keyboard.js';import{dom as p}from'../../utils/dom.js';import{match as x}from'../../utils/match.js';import{Features as B,render as g}from'../../utils/render.js';var $=(o=>(o[o.Open=0]="Open",o[o.Closed=1]="Closed",o))($||{});let T=Symbol("DisclosureContext");function O(t){let r=I(T,null);if(r===null){let o=new Error(`<${t} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(o,O),o}return r}let k=Symbol("DisclosurePanelContext");function U(){return I(k,null)}let N=b({name:"Disclosure",props:{as:{type:[Object,String],default:"template"},defaultOpen:{type:[Boolean],default:!1}},setup(t,{slots:r,attrs:o}){let s=d(t.defaultOpen?0:1),e=d(null),i=d(null),n={buttonId:d(`headlessui-disclosure-button-${E()}`),panelId:d(`headlessui-disclosure-panel-${E()}`),disclosureState:s,panel:e,button:i,toggleDisclosure(){s.value=x(s.value,{[0]:1,[1]:0})},closeDisclosure(){s.value!==1&&(s.value=1)},close(l){n.closeDisclosure();let a=(()=>l?l instanceof HTMLElement?l:l.value instanceof HTMLElement?p(l):p(n.button):p(n.button))();a==null||a.focus()}};return R(T,n),j(m(()=>x(s.value,{[0]:y.Open,[1]:y.Closed}))),()=>{let{defaultOpen:l,...a}=t,c={open:s.value===0,close:n.close};return g({theirProps:a,ourProps:{},slot:c,slots:r,attrs:o,name:"Disclosure"})}}}),Q=b({name:"DisclosureButton",props:{as:{type:[Object,String],default:"button"},disabled:{type:[Boolean],default:!1},id:{type:String,default:null}},setup(t,{attrs:r,slots:o,expose:s}){let e=O("DisclosureButton"),i=U(),n=m(()=>i===null?!1:i.value===e.panelId.value);P(()=>{n.value||t.id!==null&&(e.buttonId.value=t.id)}),h(()=>{n.value||(e.buttonId.value=null)});let l=d(null);s({el:l,$el:l}),n.value||w(()=>{e.button.value=l.value});let a=H(m(()=>({as:t.as,type:r.type})),l);function c(){var u;t.disabled||(n.value?(e.toggleDisclosure(),(u=p(e.button))==null||u.focus()):e.toggleDisclosure())}function D(u){var S;if(!t.disabled)if(n.value)switch(u.key){case f.Space:case f.Enter:u.preventDefault(),u.stopPropagation(),e.toggleDisclosure(),(S=p(e.button))==null||S.focus();break}else switch(u.key){case f.Space:case f.Enter:u.preventDefault(),u.stopPropagation(),e.toggleDisclosure();break}}function v(u){switch(u.key){case f.Space:u.preventDefault();break}}return()=>{var C;let u={open:e.disclosureState.value===0},{id:S,...K}=t,M=n.value?{ref:l,type:a.value,onClick:c,onKeydown:D}:{id:(C=e.buttonId.value)!=null?C:S,ref:l,type:a.value,"aria-expanded":e.disclosureState.value===0,"aria-controls":e.disclosureState.value===0||p(e.panel)?e.panelId.value:void 0,disabled:t.disabled?!0:void 0,onClick:c,onKeydown:D,onKeyup:v};return g({ourProps:M,theirProps:K,slot:u,attrs:r,slots:o,name:"DisclosureButton"})}}}),V=b({name:"DisclosurePanel",props:{as:{type:[Object,String],default:"div"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0},id:{type:String,default:null}},setup(t,{attrs:r,slots:o,expose:s}){let e=O("DisclosurePanel");P(()=>{t.id!==null&&(e.panelId.value=t.id)}),h(()=>{e.panelId.value=null}),s({el:e.panel,$el:e.panel}),R(k,e.panelId);let i=L(),n=m(()=>i!==null?(i.value&y.Open)===y.Open:e.disclosureState.value===0);return()=>{var v;let l={open:e.disclosureState.value===0,close:e.close},{id:a,...c}=t,D={id:(v=e.panelId.value)!=null?v:a,ref:e.panel};return g({ourProps:D,theirProps:c,slot:l,attrs:r,slots:o,features:B.RenderStrategy|B.Static,visible:n.value,name:"DisclosurePanel"})}}});export{N as Disclosure,Q as DisclosureButton,V as DisclosurePanel};

@@ -1,2 +0,2 @@

import { PropType, Ref } from 'vue';
import { type PropType, type Ref } from 'vue';
type Containers = (() => Iterable<HTMLElement>) | Ref<Set<Ref<HTMLElement | null>>>;

@@ -120,3 +120,3 @@ declare enum Features {

[key: string]: any;
}>> & {} & {} & import("vue").ComponentCustomProperties;
}>> & {} & import("vue").ComponentCustomProperties;
__isFragment?: undefined;

@@ -123,0 +123,0 @@ __isTeleport?: undefined;

@@ -1,1 +0,1 @@

import{computed as F,defineComponent as I,h as g,onMounted as w,onUnmounted as h,ref as T,watch as k,Fragment as j,watchEffect as K}from"vue";import{render as U}from'../../utils/render.js';import{Hidden as D,Features as C}from'../../internal/hidden.js';import{dom as c}from'../../utils/dom.js';import{focusIn as y,Focus as v,focusElement as p,FocusResult as _}from'../../utils/focus-management.js';import{match as P}from'../../utils/match.js';import{useTabDirection as q,Direction as b}from'../../hooks/use-tab-direction.js';import{getOwnerDocument as G}from'../../utils/owner.js';import{useEventListener as W}from'../../hooks/use-event-listener.js';import{microTask as S}from'../../utils/micro-task.js';function B(e){if(!e)return new Set;if(typeof e=="function")return new Set(e());let t=new Set;for(let l of e.value){let o=c(l);o instanceof HTMLElement&&t.add(o)}return t}var A=(n=>(n[n.None=1]="None",n[n.InitialFocus=2]="InitialFocus",n[n.TabLock=4]="TabLock",n[n.FocusLock=8]="FocusLock",n[n.RestoreFocus=16]="RestoreFocus",n[n.All=30]="All",n))(A||{});let ie=Object.assign(I({name:"FocusTrap",props:{as:{type:[Object,String],default:"div"},initialFocus:{type:Object,default:null},features:{type:Number,default:30},containers:{type:[Object,Function],default:T(new Set)}},inheritAttrs:!1,setup(e,{attrs:t,slots:l,expose:o}){let r=T(null);o({el:r,$el:r});let i=F(()=>G(r)),n=T(!1);w(()=>n.value=!0),h(()=>n.value=!1),x({ownerDocument:i},F(()=>n.value&&Boolean(e.features&16)));let m=z({ownerDocument:i,container:r,initialFocus:F(()=>e.initialFocus)},F(()=>n.value&&Boolean(e.features&2)));J({ownerDocument:i,container:r,containers:e.containers,previousActiveElement:m},F(()=>n.value&&Boolean(e.features&8)));let f=q();function u(a){let d=c(r);if(!d)return;(R=>R())(()=>{P(f.value,{[b.Forwards]:()=>{y(d,v.First,{skipElements:[a.relatedTarget]})},[b.Backwards]:()=>{y(d,v.Last,{skipElements:[a.relatedTarget]})}})})}let s=T(!1);function H(a){a.key==="Tab"&&(s.value=!0,requestAnimationFrame(()=>{s.value=!1}))}function M(a){if(!n.value)return;let d=B(e.containers);c(r)instanceof HTMLElement&&d.add(c(r));let E=a.relatedTarget;E instanceof HTMLElement&&E.dataset.headlessuiFocusGuard!=="true"&&(N(d,E)||(s.value?y(c(r),P(f.value,{[b.Forwards]:()=>v.Next,[b.Backwards]:()=>v.Previous})|v.WrapAround,{relativeTo:a.target}):a.target instanceof HTMLElement&&p(a.target)))}return()=>{let a={},d={ref:r,onKeydown:H,onFocusout:M},{features:E,initialFocus:R,containers:Q,...O}=e;return g(j,[Boolean(E&4)&&g(D,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:u,features:C.Focusable}),U({ourProps:d,theirProps:{...t,...O},slot:a,attrs:t,slots:l,name:"FocusTrap"}),Boolean(E&4)&&g(D,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:u,features:C.Focusable})])}}}),{features:A}),L=[];if(typeof window!="undefined"&&typeof document!="undefined"){let e=function(t){t.target instanceof HTMLElement&&t.target!==document.body&&L[0]!==t.target&&(L.unshift(t.target),L=L.filter(l=>l!=null&&l.isConnected),L.splice(10))};var handle=e;window.addEventListener("click",e,{capture:!0}),window.addEventListener("mousedown",e,{capture:!0}),window.addEventListener("focus",e,{capture:!0}),document.body.addEventListener("click",e,{capture:!0}),document.body.addEventListener("mousedown",e,{capture:!0}),document.body.addEventListener("focus",e,{capture:!0})}function $(e){let t=T(L.slice());return k([e],([l],[o])=>{o===!0&&l===!1?S(()=>{t.value.splice(0)}):o===!1&&l===!0&&(t.value=L.slice())},{flush:"post"}),()=>{var l;return(l=t.value.find(o=>o!=null&&o.isConnected))!=null?l:null}}function x({ownerDocument:e},t){let l=$(t);w(()=>{K(()=>{var o,r;t.value||((o=e.value)==null?void 0:o.activeElement)===((r=e.value)==null?void 0:r.body)&&p(l())},{flush:"post"})}),h(()=>{p(l())})}function z({ownerDocument:e,container:t,initialFocus:l},o){let r=T(null),i=T(!1);return w(()=>i.value=!0),h(()=>i.value=!1),w(()=>{k([t,l,o],(n,m)=>{if(n.every((u,s)=>(m==null?void 0:m[s])===u)||!o.value)return;let f=c(t);f&&S(()=>{var H,M;if(!i.value)return;let u=c(l),s=(H=e.value)==null?void 0:H.activeElement;if(u){if(u===s){r.value=s;return}}else if(f.contains(s)){r.value=s;return}u?p(u):y(f,v.First|v.NoScroll)===_.Error&&console.warn("There are no focusable elements inside the <FocusTrap />"),r.value=(M=e.value)==null?void 0:M.activeElement})},{immediate:!0,flush:"post"})}),r}function J({ownerDocument:e,container:t,containers:l,previousActiveElement:o},r){var i;W((i=e.value)==null?void 0:i.defaultView,"focus",n=>{if(!r.value)return;let m=B(l);c(t)instanceof HTMLElement&&m.add(c(t));let f=o.value;if(!f)return;let u=n.target;u&&u instanceof HTMLElement?N(m,u)?(o.value=u,p(u)):(n.preventDefault(),n.stopPropagation(),p(f)):p(o.value)},!0)}function N(e,t){for(let l of e)if(l.contains(t))return!0;return!1}export{ie as FocusTrap};
import{Fragment as I,computed as L,defineComponent as j,h as R,onMounted as M,onUnmounted as h,ref as E,watch as g,watchEffect as K}from"vue";import{useEventListener as U}from'../../hooks/use-event-listener.js';import{Direction as y,useTabDirection as _}from'../../hooks/use-tab-direction.js';import{Hidden as k,Features as D}from'../../internal/hidden.js';import{history as C}from'../../utils/active-element-history.js';import{dom as c}from'../../utils/dom.js';import{Focus as v,FocusResult as q,focusElement as p,focusIn as b}from'../../utils/focus-management.js';import{match as P}from'../../utils/match.js';import{microTask as S}from'../../utils/micro-task.js';import{getOwnerDocument as x}from'../../utils/owner.js';import{render as G}from'../../utils/render.js';function B(t){if(!t)return new Set;if(typeof t=="function")return new Set(t());let n=new Set;for(let r of t.value){let l=c(r);l instanceof HTMLElement&&n.add(l)}return n}var A=(e=>(e[e.None=1]="None",e[e.InitialFocus=2]="InitialFocus",e[e.TabLock=4]="TabLock",e[e.FocusLock=8]="FocusLock",e[e.RestoreFocus=16]="RestoreFocus",e[e.All=30]="All",e))(A||{});let ue=Object.assign(j({name:"FocusTrap",props:{as:{type:[Object,String],default:"div"},initialFocus:{type:Object,default:null},features:{type:Number,default:30},containers:{type:[Object,Function],default:E(new Set)}},inheritAttrs:!1,setup(t,{attrs:n,slots:r,expose:l}){let o=E(null);l({el:o,$el:o});let i=L(()=>x(o)),e=E(!1);M(()=>e.value=!0),h(()=>e.value=!1),$({ownerDocument:i},L(()=>e.value&&!!(t.features&16)));let m=z({ownerDocument:i,container:o,initialFocus:L(()=>t.initialFocus)},L(()=>e.value&&!!(t.features&2)));J({ownerDocument:i,container:o,containers:t.containers,previousActiveElement:m},L(()=>e.value&&!!(t.features&8)));let f=_();function a(u){let T=c(o);if(!T)return;(w=>w())(()=>{P(f.value,{[y.Forwards]:()=>{b(T,v.First,{skipElements:[u.relatedTarget]})},[y.Backwards]:()=>{b(T,v.Last,{skipElements:[u.relatedTarget]})}})})}let s=E(!1);function F(u){u.key==="Tab"&&(s.value=!0,requestAnimationFrame(()=>{s.value=!1}))}function H(u){if(!e.value)return;let T=B(t.containers);c(o)instanceof HTMLElement&&T.add(c(o));let d=u.relatedTarget;d instanceof HTMLElement&&d.dataset.headlessuiFocusGuard!=="true"&&(N(T,d)||(s.value?b(c(o),P(f.value,{[y.Forwards]:()=>v.Next,[y.Backwards]:()=>v.Previous})|v.WrapAround,{relativeTo:u.target}):u.target instanceof HTMLElement&&p(u.target)))}return()=>{let u={},T={ref:o,onKeydown:F,onFocusout:H},{features:d,initialFocus:w,containers:Q,...O}=t;return R(I,[!!(d&4)&&R(k,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:a,features:D.Focusable}),G({ourProps:T,theirProps:{...n,...O},slot:u,attrs:n,slots:r,name:"FocusTrap"}),!!(d&4)&&R(k,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:a,features:D.Focusable})])}}}),{features:A});function W(t){let n=E(C.slice());return g([t],([r],[l])=>{l===!0&&r===!1?S(()=>{n.value.splice(0)}):l===!1&&r===!0&&(n.value=C.slice())},{flush:"post"}),()=>{var r;return(r=n.value.find(l=>l!=null&&l.isConnected))!=null?r:null}}function $({ownerDocument:t},n){let r=W(n);M(()=>{K(()=>{var l,o;n.value||((l=t.value)==null?void 0:l.activeElement)===((o=t.value)==null?void 0:o.body)&&p(r())},{flush:"post"})}),h(()=>{n.value&&p(r())})}function z({ownerDocument:t,container:n,initialFocus:r},l){let o=E(null),i=E(!1);return M(()=>i.value=!0),h(()=>i.value=!1),M(()=>{g([n,r,l],(e,m)=>{if(e.every((a,s)=>(m==null?void 0:m[s])===a)||!l.value)return;let f=c(n);f&&S(()=>{var F,H;if(!i.value)return;let a=c(r),s=(F=t.value)==null?void 0:F.activeElement;if(a){if(a===s){o.value=s;return}}else if(f.contains(s)){o.value=s;return}a?p(a):b(f,v.First|v.NoScroll)===q.Error&&console.warn("There are no focusable elements inside the <FocusTrap />"),o.value=(H=t.value)==null?void 0:H.activeElement})},{immediate:!0,flush:"post"})}),o}function J({ownerDocument:t,container:n,containers:r,previousActiveElement:l},o){var i;U((i=t.value)==null?void 0:i.defaultView,"focus",e=>{if(!o.value)return;let m=B(r);c(n)instanceof HTMLElement&&m.add(c(n));let f=l.value;if(!f)return;let a=e.target;a&&a instanceof HTMLElement?N(m,a)?(l.value=a,p(a)):(e.preventDefault(),e.stopPropagation(),p(f)):p(l.value)},!0)}function N(t,n){for(let r of t)if(r.contains(n))return!0;return!1}export{ue as FocusTrap};

@@ -1,2 +0,2 @@

import { ComputedRef } from 'vue';
import { type ComputedRef } from 'vue';
export declare function useLabels({ slot, name, props, }?: {

@@ -38,5 +38,5 @@ slot?: Record<string, unknown>;

}>>, {
passive: boolean;
id: string;
as: string | Record<string, any>;
id: string;
passive: boolean;
}>;

@@ -1,1 +0,1 @@

import{computed as m,defineComponent as v,inject as x,onMounted as L,onUnmounted as k,provide as C,ref as j,unref as h}from"vue";import{useId as w}from'../../hooks/use-id.js';import{render as R}from'../../utils/render.js';let a=Symbol("LabelContext");function d(){let t=x(a,null);if(t===null){let n=new Error("You used a <Label /> component, but it is not inside a parent.");throw Error.captureStackTrace&&Error.captureStackTrace(n,d),n}return t}function K({slot:t={},name:n="Label",props:i={}}={}){let e=j([]);function l(r){return e.value.push(r),()=>{let o=e.value.indexOf(r);o!==-1&&e.value.splice(o,1)}}return C(a,{register:l,slot:t,name:n,props:i}),m(()=>e.value.length>0?e.value.join(" "):void 0)}let T=v({name:"Label",props:{as:{type:[Object,String],default:"label"},passive:{type:[Boolean],default:!1},id:{type:String,default:()=>`headlessui-label-${w()}`}},setup(t,{slots:n,attrs:i}){let e=d();return L(()=>k(e.register(t.id))),()=>{let{name:l="Label",slot:r={},props:o={}}=e,{id:p,passive:c,...u}=t,s={...Object.entries(o).reduce((f,[b,g])=>Object.assign(f,{[b]:h(g)}),{}),id:p};return c&&(delete s.onClick,delete s.htmlFor,delete u.onClick),R({ourProps:s,theirProps:u,slot:r,attrs:i,slots:n,name:l})}}});export{T as Label,K as useLabels};
import{computed as m,defineComponent as v,inject as x,onMounted as L,onUnmounted as k,provide as C,ref as j,unref as y}from"vue";import{useId as h}from'../../hooks/use-id.js';import{render as w}from'../../utils/render.js';let a=Symbol("LabelContext");function d(){let t=x(a,null);if(t===null){let n=new Error("You used a <Label /> component, but it is not inside a parent.");throw Error.captureStackTrace&&Error.captureStackTrace(n,d),n}return t}function O({slot:t={},name:n="Label",props:i={}}={}){let e=j([]);function l(r){return e.value.push(r),()=>{let o=e.value.indexOf(r);o!==-1&&e.value.splice(o,1)}}return C(a,{register:l,slot:t,name:n,props:i}),m(()=>e.value.length>0?e.value.join(" "):void 0)}let E=v({name:"Label",props:{as:{type:[Object,String],default:"label"},passive:{type:[Boolean],default:!1},id:{type:String,default:()=>`headlessui-label-${h()}`}},setup(t,{slots:n,attrs:i}){let e=d();return L(()=>k(e.register(t.id))),()=>{let{name:l="Label",slot:r={},props:o={}}=e,{id:p,passive:c,...u}=t,s={...Object.entries(o).reduce((f,[b,g])=>Object.assign(f,{[b]:y(g)}),{}),id:p};return c&&(delete s.onClick,delete s.htmlFor,delete u.onClick),w({ourProps:s,theirProps:u,slot:r,attrs:i,slots:n,name:l})}}});export{E as Label,O as useLabels};

@@ -1,2 +0,2 @@

import { PropType } from 'vue';
import { type PropType } from 'vue';
declare function defaultComparator<T>(a: T, z: T): boolean;

@@ -28,2 +28,6 @@ export declare let Listbox: import("vue").DefineComponent<{

};
form: {
type: StringConstructor;
optional: boolean;
};
name: {

@@ -66,2 +70,6 @@ type: StringConstructor;

};
form: {
type: StringConstructor;
optional: boolean;
};
name: {

@@ -80,2 +88,3 @@ type: StringConstructor;

disabled: boolean;
horizontal: boolean;
by: string | Function;

@@ -85,3 +94,2 @@ modelValue: string | number | boolean | object | null;

multiple: boolean;
horizontal: boolean;
}>;

@@ -111,4 +119,4 @@ export declare let ListboxLabel: import("vue").DefineComponent<{

}>>, {
id: string;
as: string | Record<string, any>;
id: string;
}>;

@@ -138,4 +146,4 @@ export declare let ListboxButton: import("vue").DefineComponent<{

}>>, {
id: string;
as: string | Record<string, any>;
id: string;
}>;

@@ -181,6 +189,6 @@ export declare let ListboxOptions: import("vue").DefineComponent<{

}>>, {
id: string;
as: string | Record<string, any>;
unmount: boolean;
static: boolean;
id: string;
}>;

@@ -224,6 +232,6 @@ export declare let ListboxOption: import("vue").DefineComponent<{

}>>, {
id: string;
as: string | Record<string, any>;
disabled: boolean;
id: string;
}>;
export {};

@@ -1,1 +0,1 @@

import{Fragment as $,computed as O,defineComponent as V,h as K,inject as Q,nextTick as C,onMounted as A,onUnmounted as z,provide as _,ref as k,toRaw as T,watch as N,watchEffect as q}from"vue";import{Features as H,render as I,omit as W,compact as G}from'../../utils/render.js';import{useId as F}from'../../hooks/use-id.js';import{Keys as c}from'../../keyboard.js';import{calculateActiveIndex as J,Focus as g}from'../../utils/calculate-active-index.js';import{dom as v}from'../../utils/dom.js';import{useOpenClosed as X,State as B,useOpenClosedProvider as Y}from'../../internal/open-closed.js';import{match as P}from'../../utils/match.js';import{useResolveButtonType as Z}from'../../hooks/use-resolve-button-type.js';import{FocusableMode as ee,isFocusableElement as te,sortByDomNode as oe}from'../../utils/focus-management.js';import{useOutsideClick as ie}from'../../hooks/use-outside-click.js';import{Hidden as ae,Features as ne}from'../../internal/hidden.js';import{objectToFormEntries as le}from'../../utils/form.js';import{useControllable as ue}from'../../hooks/use-controllable.js';import{useTrackedPointer as re}from'../../hooks/use-tracked-pointer.js';function se(t,b){return t===b}var de=(u=>(u[u.Open=0]="Open",u[u.Closed=1]="Closed",u))(de||{}),fe=(u=>(u[u.Single=0]="Single",u[u.Multi=1]="Multi",u))(fe||{}),pe=(u=>(u[u.Pointer=0]="Pointer",u[u.Other=1]="Other",u))(pe||{});function ce(t){requestAnimationFrame(()=>requestAnimationFrame(t))}let U=Symbol("ListboxContext");function E(t){let b=Q(U,null);if(b===null){let u=new Error(`<${t} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(u,E),u}return b}let Ee=V({name:"Listbox",emits:{"update:modelValue":t=>!0},props:{as:{type:[Object,String],default:"template"},disabled:{type:[Boolean],default:!1},by:{type:[String,Function],default:()=>se},horizontal:{type:[Boolean],default:!1},modelValue:{type:[Object,String,Number,Boolean],default:void 0},defaultValue:{type:[Object,String,Number,Boolean],default:void 0},name:{type:String,optional:!0},multiple:{type:[Boolean],default:!1}},inheritAttrs:!1,setup(t,{slots:b,attrs:u,emit:L}){let e=k(1),d=k(null),m=k(null),x=k(null),f=k([]),o=k(""),i=k(null),w=k(1);function R(a=l=>l){let l=i.value!==null?f.value[i.value]:null,r=oe(a(f.value.slice()),S=>v(S.dataRef.domRef)),s=l?r.indexOf(l):null;return s===-1&&(s=null),{options:r,activeOptionIndex:s}}let h=O(()=>t.multiple?1:0),[y,M]=ue(O(()=>t.modelValue===void 0?P(h.value,{[1]:[],[0]:void 0}):t.modelValue),a=>L("update:modelValue",a),O(()=>t.defaultValue)),n={listboxState:e,value:y,mode:h,compare(a,l){if(typeof t.by=="string"){let r=t.by;return(a==null?void 0:a[r])===(l==null?void 0:l[r])}return t.by(a,l)},orientation:O(()=>t.horizontal?"horizontal":"vertical"),labelRef:d,buttonRef:m,optionsRef:x,disabled:O(()=>t.disabled),options:f,searchQuery:o,activeOptionIndex:i,activationTrigger:w,closeListbox(){t.disabled||e.value!==1&&(e.value=1,i.value=null)},openListbox(){t.disabled||e.value!==0&&(e.value=0)},goToOption(a,l,r){if(t.disabled||e.value===1)return;let s=R(),S=J(a===g.Specific?{focus:g.Specific,id:l}:{focus:a},{resolveItems:()=>s.options,resolveActiveIndex:()=>s.activeOptionIndex,resolveId:D=>D.id,resolveDisabled:D=>D.dataRef.disabled});o.value="",i.value=S,w.value=r!=null?r:1,f.value=s.options},search(a){if(t.disabled||e.value===1)return;let r=o.value!==""?0:1;o.value+=a.toLowerCase();let S=(i.value!==null?f.value.slice(i.value+r).concat(f.value.slice(0,i.value+r)):f.value).find(j=>j.dataRef.textValue.startsWith(o.value)&&!j.dataRef.disabled),D=S?f.value.indexOf(S):-1;D===-1||D===i.value||(i.value=D,w.value=1)},clearSearch(){t.disabled||e.value!==1&&o.value!==""&&(o.value="")},registerOption(a,l){let r=R(s=>[...s,{id:a,dataRef:l}]);f.value=r.options,i.value=r.activeOptionIndex},unregisterOption(a){let l=R(r=>{let s=r.findIndex(S=>S.id===a);return s!==-1&&r.splice(s,1),r});f.value=l.options,i.value=l.activeOptionIndex,w.value=1},select(a){t.disabled||M(P(h.value,{[0]:()=>a,[1]:()=>{let l=T(n.value.value).slice(),r=T(a),s=l.findIndex(S=>n.compare(r,T(S)));return s===-1?l.push(r):l.splice(s,1),l}}))}};ie([m,x],(a,l)=>{var r;n.closeListbox(),te(l,ee.Loose)||(a.preventDefault(),(r=v(m))==null||r.focus())},O(()=>e.value===0)),_(U,n),Y(O(()=>P(e.value,{[0]:B.Open,[1]:B.Closed})));let p=O(()=>{var a;return(a=v(m))==null?void 0:a.closest("form")});return A(()=>{N([p],()=>{if(!p.value||t.defaultValue===void 0)return;function a(){n.select(t.defaultValue)}return p.value.addEventListener("reset",a),()=>{var l;(l=p.value)==null||l.removeEventListener("reset",a)}},{immediate:!0})}),()=>{let{name:a,modelValue:l,disabled:r,...s}=t,S={open:e.value===0,disabled:r,value:y.value};return K($,[...a!=null&&y.value!=null?le({[a]:y.value}).map(([D,j])=>K(ae,G({features:ne.Hidden,key:D,as:"input",type:"hidden",hidden:!0,readOnly:!0,name:D,value:j}))):[],I({ourProps:{},theirProps:{...u,...W(s,["defaultValue","onUpdate:modelValue","horizontal","multiple","by"])},slot:S,slots:b,attrs:u,name:"Listbox"})])}}}),je=V({name:"ListboxLabel",props:{as:{type:[Object,String],default:"label"},id:{type:String,default:()=>`headlessui-listbox-label-${F()}`}},setup(t,{attrs:b,slots:u}){let L=E("ListboxLabel");function e(){var d;(d=v(L.buttonRef))==null||d.focus({preventScroll:!0})}return()=>{let d={open:L.listboxState.value===0,disabled:L.disabled.value},{id:m,...x}=t,f={id:m,ref:L.labelRef,onClick:e};return I({ourProps:f,theirProps:x,slot:d,attrs:b,slots:u,name:"ListboxLabel"})}}}),Ae=V({name:"ListboxButton",props:{as:{type:[Object,String],default:"button"},id:{type:String,default:()=>`headlessui-listbox-button-${F()}`}},setup(t,{attrs:b,slots:u,expose:L}){let e=E("ListboxButton");L({el:e.buttonRef,$el:e.buttonRef});function d(o){switch(o.key){case c.Space:case c.Enter:case c.ArrowDown:o.preventDefault(),e.openListbox(),C(()=>{var i;(i=v(e.optionsRef))==null||i.focus({preventScroll:!0}),e.value.value||e.goToOption(g.First)});break;case c.ArrowUp:o.preventDefault(),e.openListbox(),C(()=>{var i;(i=v(e.optionsRef))==null||i.focus({preventScroll:!0}),e.value.value||e.goToOption(g.Last)});break}}function m(o){switch(o.key){case c.Space:o.preventDefault();break}}function x(o){e.disabled.value||(e.listboxState.value===0?(e.closeListbox(),C(()=>{var i;return(i=v(e.buttonRef))==null?void 0:i.focus({preventScroll:!0})})):(o.preventDefault(),e.openListbox(),ce(()=>{var i;return(i=v(e.optionsRef))==null?void 0:i.focus({preventScroll:!0})})))}let f=Z(O(()=>({as:t.as,type:b.type})),e.buttonRef);return()=>{var h,y;let o={open:e.listboxState.value===0,disabled:e.disabled.value,value:e.value.value},{id:i,...w}=t,R={ref:e.buttonRef,id:i,type:f.value,"aria-haspopup":"listbox","aria-controls":(h=v(e.optionsRef))==null?void 0:h.id,"aria-expanded":e.disabled.value?void 0:e.listboxState.value===0,"aria-labelledby":e.labelRef.value?[(y=v(e.labelRef))==null?void 0:y.id,i].join(" "):void 0,disabled:e.disabled.value===!0?!0:void 0,onKeydown:d,onKeyup:m,onClick:x};return I({ourProps:R,theirProps:w,slot:o,attrs:b,slots:u,name:"ListboxButton"})}}}),Fe=V({name:"ListboxOptions",props:{as:{type:[Object,String],default:"ul"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0},id:{type:String,default:()=>`headlessui-listbox-options-${F()}`}},setup(t,{attrs:b,slots:u,expose:L}){let e=E("ListboxOptions"),d=k(null);L({el:e.optionsRef,$el:e.optionsRef});function m(o){switch(d.value&&clearTimeout(d.value),o.key){case c.Space:if(e.searchQuery.value!=="")return o.preventDefault(),o.stopPropagation(),e.search(o.key);case c.Enter:if(o.preventDefault(),o.stopPropagation(),e.activeOptionIndex.value!==null){let i=e.options.value[e.activeOptionIndex.value];e.select(i.dataRef.value)}e.mode.value===0&&(e.closeListbox(),C(()=>{var i;return(i=v(e.buttonRef))==null?void 0:i.focus({preventScroll:!0})}));break;case P(e.orientation.value,{vertical:c.ArrowDown,horizontal:c.ArrowRight}):return o.preventDefault(),o.stopPropagation(),e.goToOption(g.Next);case P(e.orientation.value,{vertical:c.ArrowUp,horizontal:c.ArrowLeft}):return o.preventDefault(),o.stopPropagation(),e.goToOption(g.Previous);case c.Home:case c.PageUp:return o.preventDefault(),o.stopPropagation(),e.goToOption(g.First);case c.End:case c.PageDown:return o.preventDefault(),o.stopPropagation(),e.goToOption(g.Last);case c.Escape:o.preventDefault(),o.stopPropagation(),e.closeListbox(),C(()=>{var i;return(i=v(e.buttonRef))==null?void 0:i.focus({preventScroll:!0})});break;case c.Tab:o.preventDefault(),o.stopPropagation();break;default:o.key.length===1&&(e.search(o.key),d.value=setTimeout(()=>e.clearSearch(),350));break}}let x=X(),f=O(()=>x!==null?(x.value&B.Open)===B.Open:e.listboxState.value===0);return()=>{var h,y,M,n;let o={open:e.listboxState.value===0},{id:i,...w}=t,R={"aria-activedescendant":e.activeOptionIndex.value===null||(h=e.options.value[e.activeOptionIndex.value])==null?void 0:h.id,"aria-multiselectable":e.mode.value===1?!0:void 0,"aria-labelledby":(n=(y=v(e.labelRef))==null?void 0:y.id)!=null?n:(M=v(e.buttonRef))==null?void 0:M.id,"aria-orientation":e.orientation.value,id:i,onKeydown:m,role:"listbox",tabIndex:0,ref:e.optionsRef};return I({ourProps:R,theirProps:w,slot:o,attrs:b,slots:u,features:H.RenderStrategy|H.Static,visible:f.value,name:"ListboxOptions"})}}}),Be=V({name:"ListboxOption",props:{as:{type:[Object,String],default:"li"},value:{type:[Object,String,Number,Boolean]},disabled:{type:Boolean,default:!1},id:{type:String,default:()=>`headlessui-listbox.option-${F()}`}},setup(t,{slots:b,attrs:u,expose:L}){let e=E("ListboxOption"),d=k(null);L({el:d,$el:d});let m=O(()=>e.activeOptionIndex.value!==null?e.options.value[e.activeOptionIndex.value].id===t.id:!1),x=O(()=>P(e.mode.value,{[0]:()=>e.compare(T(e.value.value),T(t.value)),[1]:()=>T(e.value.value).some(n=>e.compare(T(n),T(t.value)))})),f=O(()=>P(e.mode.value,{[1]:()=>{var p;let n=T(e.value.value);return((p=e.options.value.find(a=>n.some(l=>e.compare(T(l),T(a.dataRef.value)))))==null?void 0:p.id)===t.id},[0]:()=>x.value})),o=O(()=>({disabled:t.disabled,value:t.value,textValue:"",domRef:d}));A(()=>{var p,a;let n=(a=(p=v(d))==null?void 0:p.textContent)==null?void 0:a.toLowerCase().trim();n!==void 0&&(o.value.textValue=n)}),A(()=>e.registerOption(t.id,o)),z(()=>e.unregisterOption(t.id)),A(()=>{N([e.listboxState,x],()=>{e.listboxState.value===0&&x.value&&P(e.mode.value,{[1]:()=>{f.value&&e.goToOption(g.Specific,t.id)},[0]:()=>{e.goToOption(g.Specific,t.id)}})},{immediate:!0})}),q(()=>{e.listboxState.value===0&&m.value&&e.activationTrigger.value!==0&&C(()=>{var n,p;return(p=(n=v(d))==null?void 0:n.scrollIntoView)==null?void 0:p.call(n,{block:"nearest"})})});function i(n){if(t.disabled)return n.preventDefault();e.select(t.value),e.mode.value===0&&(e.closeListbox(),C(()=>{var p;return(p=v(e.buttonRef))==null?void 0:p.focus({preventScroll:!0})}))}function w(){if(t.disabled)return e.goToOption(g.Nothing);e.goToOption(g.Specific,t.id)}let R=re();function h(n){R.update(n)}function y(n){R.wasMoved(n)&&(t.disabled||m.value||e.goToOption(g.Specific,t.id,0))}function M(n){R.wasMoved(n)&&(t.disabled||m.value&&e.goToOption(g.Nothing))}return()=>{let{disabled:n}=t,p={active:m.value,selected:x.value,disabled:n},{id:a,value:l,disabled:r,...s}=t,S={id:a,ref:d,role:"option",tabIndex:n===!0?void 0:-1,"aria-disabled":n===!0?!0:void 0,"aria-selected":x.value,disabled:void 0,onClick:i,onFocus:w,onPointerenter:h,onMouseenter:h,onPointermove:y,onMousemove:y,onPointerleave:M,onMouseleave:M};return I({ourProps:S,theirProps:s,slot:p,attrs:u,slots:b,name:"ListboxOption"})}}});export{Ee as Listbox,Ae as ListboxButton,je as ListboxLabel,Be as ListboxOption,Fe as ListboxOptions};
import{Fragment as z,computed as x,defineComponent as E,h as N,inject as _,nextTick as C,onMounted as K,onUnmounted as q,provide as W,ref as w,toRaw as R,watch as H,watchEffect as G}from"vue";import{useControllable as J}from'../../hooks/use-controllable.js';import{useId as F}from'../../hooks/use-id.js';import{useOutsideClick as X}from'../../hooks/use-outside-click.js';import{useResolveButtonType as Y}from'../../hooks/use-resolve-button-type.js';import{useTextValue as Z}from'../../hooks/use-text-value.js';import{useTrackedPointer as ee}from'../../hooks/use-tracked-pointer.js';import{Hidden as te,Features as oe}from'../../internal/hidden.js';import{State as B,useOpenClosed as ie,useOpenClosedProvider as ae}from'../../internal/open-closed.js';import{Keys as p}from'../../keyboard.js';import{Focus as g,calculateActiveIndex as ne}from'../../utils/calculate-active-index.js';import{dom as S}from'../../utils/dom.js';import{FocusableMode as le,isFocusableElement as ue,sortByDomNode as re}from'../../utils/focus-management.js';import{objectToFormEntries as se}from'../../utils/form.js';import{match as P}from'../../utils/match.js';import{Features as U,compact as de,omit as fe,render as j}from'../../utils/render.js';function pe(t,c){return t===c}var ce=(u=>(u[u.Open=0]="Open",u[u.Closed=1]="Closed",u))(ce||{}),ve=(u=>(u[u.Single=0]="Single",u[u.Multi=1]="Multi",u))(ve||{}),be=(u=>(u[u.Pointer=0]="Pointer",u[u.Other=1]="Other",u))(be||{});function me(t){requestAnimationFrame(()=>requestAnimationFrame(t))}let $=Symbol("ListboxContext");function A(t){let c=_($,null);if(c===null){let u=new Error(`<${t} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(u,A),u}return c}let Ie=E({name:"Listbox",emits:{"update:modelValue":t=>!0},props:{as:{type:[Object,String],default:"template"},disabled:{type:[Boolean],default:!1},by:{type:[String,Function],default:()=>pe},horizontal:{type:[Boolean],default:!1},modelValue:{type:[Object,String,Number,Boolean],default:void 0},defaultValue:{type:[Object,String,Number,Boolean],default:void 0},form:{type:String,optional:!0},name:{type:String,optional:!0},multiple:{type:[Boolean],default:!1}},inheritAttrs:!1,setup(t,{slots:c,attrs:u,emit:L}){let e=w(1),d=w(null),v=w(null),b=w(null),f=w([]),o=w(""),i=w(null),T=w(1);function D(a=n=>n){let n=i.value!==null?f.value[i.value]:null,l=re(a(f.value.slice()),O=>S(O.dataRef.domRef)),s=n?l.indexOf(n):null;return s===-1&&(s=null),{options:l,activeOptionIndex:s}}let y=x(()=>t.multiple?1:0),[h,V]=J(x(()=>t.modelValue),a=>L("update:modelValue",a),x(()=>t.defaultValue)),M=x(()=>h.value===void 0?P(y.value,{[1]:[],[0]:void 0}):h.value),r={listboxState:e,value:M,mode:y,compare(a,n){if(typeof t.by=="string"){let l=t.by;return(a==null?void 0:a[l])===(n==null?void 0:n[l])}return t.by(a,n)},orientation:x(()=>t.horizontal?"horizontal":"vertical"),labelRef:d,buttonRef:v,optionsRef:b,disabled:x(()=>t.disabled),options:f,searchQuery:o,activeOptionIndex:i,activationTrigger:T,closeListbox(){t.disabled||e.value!==1&&(e.value=1,i.value=null)},openListbox(){t.disabled||e.value!==0&&(e.value=0)},goToOption(a,n,l){if(t.disabled||e.value===1)return;let s=D(),O=ne(a===g.Specific?{focus:g.Specific,id:n}:{focus:a},{resolveItems:()=>s.options,resolveActiveIndex:()=>s.activeOptionIndex,resolveId:k=>k.id,resolveDisabled:k=>k.dataRef.disabled});o.value="",i.value=O,T.value=l!=null?l:1,f.value=s.options},search(a){if(t.disabled||e.value===1)return;let l=o.value!==""?0:1;o.value+=a.toLowerCase();let O=(i.value!==null?f.value.slice(i.value+l).concat(f.value.slice(0,i.value+l)):f.value).find(I=>I.dataRef.textValue.startsWith(o.value)&&!I.dataRef.disabled),k=O?f.value.indexOf(O):-1;k===-1||k===i.value||(i.value=k,T.value=1)},clearSearch(){t.disabled||e.value!==1&&o.value!==""&&(o.value="")},registerOption(a,n){let l=D(s=>[...s,{id:a,dataRef:n}]);f.value=l.options,i.value=l.activeOptionIndex},unregisterOption(a){let n=D(l=>{let s=l.findIndex(O=>O.id===a);return s!==-1&&l.splice(s,1),l});f.value=n.options,i.value=n.activeOptionIndex,T.value=1},theirOnChange(a){t.disabled||V(a)},select(a){t.disabled||V(P(y.value,{[0]:()=>a,[1]:()=>{let n=R(r.value.value).slice(),l=R(a),s=n.findIndex(O=>r.compare(l,R(O)));return s===-1?n.push(l):n.splice(s,1),n}}))}};X([v,b],(a,n)=>{var l;r.closeListbox(),ue(n,le.Loose)||(a.preventDefault(),(l=S(v))==null||l.focus())},x(()=>e.value===0)),W($,r),ae(x(()=>P(e.value,{[0]:B.Open,[1]:B.Closed})));let m=x(()=>{var a;return(a=S(v))==null?void 0:a.closest("form")});return K(()=>{H([m],()=>{if(!m.value||t.defaultValue===void 0)return;function a(){r.theirOnChange(t.defaultValue)}return m.value.addEventListener("reset",a),()=>{var n;(n=m.value)==null||n.removeEventListener("reset",a)}},{immediate:!0})}),()=>{let{name:a,modelValue:n,disabled:l,form:s,...O}=t,k={open:e.value===0,disabled:l,value:M.value};return N(z,[...a!=null&&M.value!=null?se({[a]:M.value}).map(([I,Q])=>N(te,de({features:oe.Hidden,key:I,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:s,disabled:l,name:I,value:Q}))):[],j({ourProps:{},theirProps:{...u,...fe(O,["defaultValue","onUpdate:modelValue","horizontal","multiple","by"])},slot:k,slots:c,attrs:u,name:"Listbox"})])}}}),Ee=E({name:"ListboxLabel",props:{as:{type:[Object,String],default:"label"},id:{type:String,default:()=>`headlessui-listbox-label-${F()}`}},setup(t,{attrs:c,slots:u}){let L=A("ListboxLabel");function e(){var d;(d=S(L.buttonRef))==null||d.focus({preventScroll:!0})}return()=>{let d={open:L.listboxState.value===0,disabled:L.disabled.value},{id:v,...b}=t,f={id:v,ref:L.labelRef,onClick:e};return j({ourProps:f,theirProps:b,slot:d,attrs:c,slots:u,name:"ListboxLabel"})}}}),je=E({name:"ListboxButton",props:{as:{type:[Object,String],default:"button"},id:{type:String,default:()=>`headlessui-listbox-button-${F()}`}},setup(t,{attrs:c,slots:u,expose:L}){let e=A("ListboxButton");L({el:e.buttonRef,$el:e.buttonRef});function d(o){switch(o.key){case p.Space:case p.Enter:case p.ArrowDown:o.preventDefault(),e.openListbox(),C(()=>{var i;(i=S(e.optionsRef))==null||i.focus({preventScroll:!0}),e.value.value||e.goToOption(g.First)});break;case p.ArrowUp:o.preventDefault(),e.openListbox(),C(()=>{var i;(i=S(e.optionsRef))==null||i.focus({preventScroll:!0}),e.value.value||e.goToOption(g.Last)});break}}function v(o){switch(o.key){case p.Space:o.preventDefault();break}}function b(o){e.disabled.value||(e.listboxState.value===0?(e.closeListbox(),C(()=>{var i;return(i=S(e.buttonRef))==null?void 0:i.focus({preventScroll:!0})})):(o.preventDefault(),e.openListbox(),me(()=>{var i;return(i=S(e.optionsRef))==null?void 0:i.focus({preventScroll:!0})})))}let f=Y(x(()=>({as:t.as,type:c.type})),e.buttonRef);return()=>{var y,h;let o={open:e.listboxState.value===0,disabled:e.disabled.value,value:e.value.value},{id:i,...T}=t,D={ref:e.buttonRef,id:i,type:f.value,"aria-haspopup":"listbox","aria-controls":(y=S(e.optionsRef))==null?void 0:y.id,"aria-expanded":e.listboxState.value===0,"aria-labelledby":e.labelRef.value?[(h=S(e.labelRef))==null?void 0:h.id,i].join(" "):void 0,disabled:e.disabled.value===!0?!0:void 0,onKeydown:d,onKeyup:v,onClick:b};return j({ourProps:D,theirProps:T,slot:o,attrs:c,slots:u,name:"ListboxButton"})}}}),Ae=E({name:"ListboxOptions",props:{as:{type:[Object,String],default:"ul"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0},id:{type:String,default:()=>`headlessui-listbox-options-${F()}`}},setup(t,{attrs:c,slots:u,expose:L}){let e=A("ListboxOptions"),d=w(null);L({el:e.optionsRef,$el:e.optionsRef});function v(o){switch(d.value&&clearTimeout(d.value),o.key){case p.Space:if(e.searchQuery.value!=="")return o.preventDefault(),o.stopPropagation(),e.search(o.key);case p.Enter:if(o.preventDefault(),o.stopPropagation(),e.activeOptionIndex.value!==null){let i=e.options.value[e.activeOptionIndex.value];e.select(i.dataRef.value)}e.mode.value===0&&(e.closeListbox(),C(()=>{var i;return(i=S(e.buttonRef))==null?void 0:i.focus({preventScroll:!0})}));break;case P(e.orientation.value,{vertical:p.ArrowDown,horizontal:p.ArrowRight}):return o.preventDefault(),o.stopPropagation(),e.goToOption(g.Next);case P(e.orientation.value,{vertical:p.ArrowUp,horizontal:p.ArrowLeft}):return o.preventDefault(),o.stopPropagation(),e.goToOption(g.Previous);case p.Home:case p.PageUp:return o.preventDefault(),o.stopPropagation(),e.goToOption(g.First);case p.End:case p.PageDown:return o.preventDefault(),o.stopPropagation(),e.goToOption(g.Last);case p.Escape:o.preventDefault(),o.stopPropagation(),e.closeListbox(),C(()=>{var i;return(i=S(e.buttonRef))==null?void 0:i.focus({preventScroll:!0})});break;case p.Tab:o.preventDefault(),o.stopPropagation();break;default:o.key.length===1&&(e.search(o.key),d.value=setTimeout(()=>e.clearSearch(),350));break}}let b=ie(),f=x(()=>b!==null?(b.value&B.Open)===B.Open:e.listboxState.value===0);return()=>{var y,h;let o={open:e.listboxState.value===0},{id:i,...T}=t,D={"aria-activedescendant":e.activeOptionIndex.value===null||(y=e.options.value[e.activeOptionIndex.value])==null?void 0:y.id,"aria-multiselectable":e.mode.value===1?!0:void 0,"aria-labelledby":(h=S(e.buttonRef))==null?void 0:h.id,"aria-orientation":e.orientation.value,id:i,onKeydown:v,role:"listbox",tabIndex:0,ref:e.optionsRef};return j({ourProps:D,theirProps:T,slot:o,attrs:c,slots:u,features:U.RenderStrategy|U.Static,visible:f.value,name:"ListboxOptions"})}}}),Fe=E({name:"ListboxOption",props:{as:{type:[Object,String],default:"li"},value:{type:[Object,String,Number,Boolean]},disabled:{type:Boolean,default:!1},id:{type:String,default:()=>`headlessui-listbox.option-${F()}`}},setup(t,{slots:c,attrs:u,expose:L}){let e=A("ListboxOption"),d=w(null);L({el:d,$el:d});let v=x(()=>e.activeOptionIndex.value!==null?e.options.value[e.activeOptionIndex.value].id===t.id:!1),b=x(()=>P(e.mode.value,{[0]:()=>e.compare(R(e.value.value),R(t.value)),[1]:()=>R(e.value.value).some(r=>e.compare(R(r),R(t.value)))})),f=x(()=>P(e.mode.value,{[1]:()=>{var m;let r=R(e.value.value);return((m=e.options.value.find(a=>r.some(n=>e.compare(R(n),R(a.dataRef.value)))))==null?void 0:m.id)===t.id},[0]:()=>b.value})),o=Z(d),i=x(()=>({disabled:t.disabled,value:t.value,get textValue(){return o()},domRef:d}));K(()=>e.registerOption(t.id,i)),q(()=>e.unregisterOption(t.id)),K(()=>{H([e.listboxState,b],()=>{e.listboxState.value===0&&b.value&&P(e.mode.value,{[1]:()=>{f.value&&e.goToOption(g.Specific,t.id)},[0]:()=>{e.goToOption(g.Specific,t.id)}})},{immediate:!0})}),G(()=>{e.listboxState.value===0&&v.value&&e.activationTrigger.value!==0&&C(()=>{var r,m;return(m=(r=S(d))==null?void 0:r.scrollIntoView)==null?void 0:m.call(r,{block:"nearest"})})});function T(r){if(t.disabled)return r.preventDefault();e.select(t.value),e.mode.value===0&&(e.closeListbox(),C(()=>{var m;return(m=S(e.buttonRef))==null?void 0:m.focus({preventScroll:!0})}))}function D(){if(t.disabled)return e.goToOption(g.Nothing);e.goToOption(g.Specific,t.id)}let y=ee();function h(r){y.update(r)}function V(r){y.wasMoved(r)&&(t.disabled||v.value||e.goToOption(g.Specific,t.id,0))}function M(r){y.wasMoved(r)&&(t.disabled||v.value&&e.goToOption(g.Nothing))}return()=>{let{disabled:r}=t,m={active:v.value,selected:b.value,disabled:r},{id:a,value:n,disabled:l,...s}=t,O={id:a,ref:d,role:"option",tabIndex:r===!0?void 0:-1,"aria-disabled":r===!0?!0:void 0,"aria-selected":b.value,disabled:void 0,onClick:T,onFocus:D,onPointerenter:h,onMouseenter:h,onPointermove:V,onMousemove:V,onPointerleave:M,onMouseleave:M};return j({ourProps:O,theirProps:s,slot:m,attrs:u,slots:c,name:"ListboxOption"})}}});export{Ie as Listbox,je as ListboxButton,Ee as ListboxLabel,Fe as ListboxOption,Ae as ListboxOptions};

@@ -49,5 +49,5 @@ export declare let Menu: import("vue").DefineComponent<{

}>>, {
id: string;
as: string | Record<string, any>;
disabled: boolean;
id: string;
}>;

@@ -93,6 +93,6 @@ export declare let MenuItems: import("vue").DefineComponent<{

}>>, {
id: string;
as: string | Record<string, any>;
unmount: boolean;
static: boolean;
id: string;
}>;

@@ -130,5 +130,5 @@ export declare let MenuItem: import("vue").DefineComponent<{

}>>, {
id: string;
as: string | Record<string, any>;
disabled: boolean;
id: string;
}>;

@@ -1,1 +0,1 @@

import{defineComponent as x,ref as R,provide as K,inject as L,onMounted as E,onUnmounted as N,computed as h,nextTick as y,watchEffect as j}from"vue";import{Features as k,render as T}from'../../utils/render.js';import{useId as w}from'../../hooks/use-id.js';import{Keys as c}from'../../keyboard.js';import{Focus as S,calculateActiveIndex as B}from'../../utils/calculate-active-index.js';import{dom as f}from'../../utils/dom.js';import{useTreeWalker as U}from'../../hooks/use-tree-walker.js';import{useOpenClosedProvider as $,State as D,useOpenClosed as V}from'../../internal/open-closed.js';import{match as H}from'../../utils/match.js';import{useResolveButtonType as Q}from'../../hooks/use-resolve-button-type.js';import{FocusableMode as _,isFocusableElement as q,sortByDomNode as W,Focus as C,focusFrom as J,restoreFocusIfNecessary as F}from'../../utils/focus-management.js';import{useOutsideClick as z}from'../../hooks/use-outside-click.js';import{useTrackedPointer as G}from'../../hooks/use-tracked-pointer.js';var X=(l=>(l[l.Open=0]="Open",l[l.Closed=1]="Closed",l))(X||{}),Y=(l=>(l[l.Pointer=0]="Pointer",l[l.Other=1]="Other",l))(Y||{});function Z(a){requestAnimationFrame(()=>requestAnimationFrame(a))}let A=Symbol("MenuContext");function P(a){let b=L(A,null);if(b===null){let l=new Error(`<${a} /> is missing a parent <Menu /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(l,P),l}return b}let ge=x({name:"Menu",props:{as:{type:[Object,String],default:"template"}},setup(a,{slots:b,attrs:l}){let g=R(1),e=R(null),m=R(null),s=R([]),p=R(""),d=R(null),o=R(1);function t(u=r=>r){let r=d.value!==null?s.value[d.value]:null,n=W(u(s.value.slice()),I=>f(I.dataRef.domRef)),i=r?n.indexOf(r):null;return i===-1&&(i=null),{items:n,activeItemIndex:i}}let v={menuState:g,buttonRef:e,itemsRef:m,items:s,searchQuery:p,activeItemIndex:d,activationTrigger:o,closeMenu:()=>{g.value=1,d.value=null},openMenu:()=>g.value=0,goToItem(u,r,n){let i=t(),I=B(u===S.Specific?{focus:S.Specific,id:r}:{focus:u},{resolveItems:()=>i.items,resolveActiveIndex:()=>i.activeItemIndex,resolveId:M=>M.id,resolveDisabled:M=>M.dataRef.disabled});p.value="",d.value=I,o.value=n!=null?n:1,s.value=i.items},search(u){let n=p.value!==""?0:1;p.value+=u.toLowerCase();let I=(d.value!==null?s.value.slice(d.value+n).concat(s.value.slice(0,d.value+n)):s.value).find(O=>O.dataRef.textValue.startsWith(p.value)&&!O.dataRef.disabled),M=I?s.value.indexOf(I):-1;M===-1||M===d.value||(d.value=M,o.value=1)},clearSearch(){p.value=""},registerItem(u,r){let n=t(i=>[...i,{id:u,dataRef:r}]);s.value=n.items,d.value=n.activeItemIndex,o.value=1},unregisterItem(u){let r=t(n=>{let i=n.findIndex(I=>I.id===u);return i!==-1&&n.splice(i,1),n});s.value=r.items,d.value=r.activeItemIndex,o.value=1}};return z([e,m],(u,r)=>{var n;v.closeMenu(),q(r,_.Loose)||(u.preventDefault(),(n=f(e))==null||n.focus())},h(()=>g.value===0)),K(A,v),$(h(()=>H(g.value,{[0]:D.Open,[1]:D.Closed}))),()=>{let u={open:g.value===0,close:v.closeMenu};return T({ourProps:{},theirProps:a,slot:u,slots:b,attrs:l,name:"Menu"})}}}),Se=x({name:"MenuButton",props:{disabled:{type:Boolean,default:!1},as:{type:[Object,String],default:"button"},id:{type:String,default:()=>`headlessui-menu-button-${w()}`}},setup(a,{attrs:b,slots:l,expose:g}){let e=P("MenuButton");g({el:e.buttonRef,$el:e.buttonRef});function m(o){switch(o.key){case c.Space:case c.Enter:case c.ArrowDown:o.preventDefault(),o.stopPropagation(),e.openMenu(),y(()=>{var t;(t=f(e.itemsRef))==null||t.focus({preventScroll:!0}),e.goToItem(S.First)});break;case c.ArrowUp:o.preventDefault(),o.stopPropagation(),e.openMenu(),y(()=>{var t;(t=f(e.itemsRef))==null||t.focus({preventScroll:!0}),e.goToItem(S.Last)});break}}function s(o){switch(o.key){case c.Space:o.preventDefault();break}}function p(o){a.disabled||(e.menuState.value===0?(e.closeMenu(),y(()=>{var t;return(t=f(e.buttonRef))==null?void 0:t.focus({preventScroll:!0})})):(o.preventDefault(),e.openMenu(),Z(()=>{var t;return(t=f(e.itemsRef))==null?void 0:t.focus({preventScroll:!0})})))}let d=Q(h(()=>({as:a.as,type:b.type})),e.buttonRef);return()=>{var r;let o={open:e.menuState.value===0},{id:t,...v}=a,u={ref:e.buttonRef,id:t,type:d.value,"aria-haspopup":"menu","aria-controls":(r=f(e.itemsRef))==null?void 0:r.id,"aria-expanded":a.disabled?void 0:e.menuState.value===0,onKeydown:m,onKeyup:s,onClick:p};return T({ourProps:u,theirProps:v,slot:o,attrs:b,slots:l,name:"MenuButton"})}}}),be=x({name:"MenuItems",props:{as:{type:[Object,String],default:"div"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0},id:{type:String,default:()=>`headlessui-menu-items-${w()}`}},setup(a,{attrs:b,slots:l,expose:g}){let e=P("MenuItems"),m=R(null);g({el:e.itemsRef,$el:e.itemsRef}),U({container:h(()=>f(e.itemsRef)),enabled:h(()=>e.menuState.value===0),accept(t){return t.getAttribute("role")==="menuitem"?NodeFilter.FILTER_REJECT:t.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(t){t.setAttribute("role","none")}});function s(t){var v;switch(m.value&&clearTimeout(m.value),t.key){case c.Space:if(e.searchQuery.value!=="")return t.preventDefault(),t.stopPropagation(),e.search(t.key);case c.Enter:if(t.preventDefault(),t.stopPropagation(),e.activeItemIndex.value!==null){let r=e.items.value[e.activeItemIndex.value];(v=f(r.dataRef.domRef))==null||v.click()}e.closeMenu(),F(f(e.buttonRef));break;case c.ArrowDown:return t.preventDefault(),t.stopPropagation(),e.goToItem(S.Next);case c.ArrowUp:return t.preventDefault(),t.stopPropagation(),e.goToItem(S.Previous);case c.Home:case c.PageUp:return t.preventDefault(),t.stopPropagation(),e.goToItem(S.First);case c.End:case c.PageDown:return t.preventDefault(),t.stopPropagation(),e.goToItem(S.Last);case c.Escape:t.preventDefault(),t.stopPropagation(),e.closeMenu(),y(()=>{var u;return(u=f(e.buttonRef))==null?void 0:u.focus({preventScroll:!0})});break;case c.Tab:t.preventDefault(),t.stopPropagation(),e.closeMenu(),y(()=>J(f(e.buttonRef),t.shiftKey?C.Previous:C.Next));break;default:t.key.length===1&&(e.search(t.key),m.value=setTimeout(()=>e.clearSearch(),350));break}}function p(t){switch(t.key){case c.Space:t.preventDefault();break}}let d=V(),o=h(()=>d!==null?(d.value&D.Open)===D.Open:e.menuState.value===0);return()=>{var n,i;let t={open:e.menuState.value===0},{id:v,...u}=a,r={"aria-activedescendant":e.activeItemIndex.value===null||(n=e.items.value[e.activeItemIndex.value])==null?void 0:n.id,"aria-labelledby":(i=f(e.buttonRef))==null?void 0:i.id,id:v,onKeydown:s,onKeyup:p,role:"menu",tabIndex:0,ref:e.itemsRef};return T({ourProps:r,theirProps:u,slot:t,attrs:b,slots:l,features:k.RenderStrategy|k.Static,visible:o.value,name:"MenuItems"})}}}),Me=x({name:"MenuItem",inheritAttrs:!1,props:{as:{type:[Object,String],default:"template"},disabled:{type:Boolean,default:!1},id:{type:String,default:()=>`headlessui-menu-item-${w()}`}},setup(a,{slots:b,attrs:l,expose:g}){let e=P("MenuItem"),m=R(null);g({el:m,$el:m});let s=h(()=>e.activeItemIndex.value!==null?e.items.value[e.activeItemIndex.value].id===a.id:!1),p=h(()=>({disabled:a.disabled,textValue:"",domRef:m}));E(()=>{var i,I;let n=(I=(i=f(m))==null?void 0:i.textContent)==null?void 0:I.toLowerCase().trim();n!==void 0&&(p.value.textValue=n)}),E(()=>e.registerItem(a.id,p)),N(()=>e.unregisterItem(a.id)),j(()=>{e.menuState.value===0&&s.value&&e.activationTrigger.value!==0&&y(()=>{var n,i;return(i=(n=f(m))==null?void 0:n.scrollIntoView)==null?void 0:i.call(n,{block:"nearest"})})});function d(n){if(a.disabled)return n.preventDefault();e.closeMenu(),F(f(e.buttonRef))}function o(){if(a.disabled)return e.goToItem(S.Nothing);e.goToItem(S.Specific,a.id)}let t=G();function v(n){t.update(n)}function u(n){t.wasMoved(n)&&(a.disabled||s.value||e.goToItem(S.Specific,a.id,0))}function r(n){t.wasMoved(n)&&(a.disabled||s.value&&e.goToItem(S.Nothing))}return()=>{let{disabled:n}=a,i={active:s.value,disabled:n,close:e.closeMenu},{id:I,...M}=a;return T({ourProps:{id:I,ref:m,role:"menuitem",tabIndex:n===!0?void 0:-1,"aria-disabled":n===!0?!0:void 0,disabled:void 0,onClick:d,onFocus:o,onPointerenter:v,onMouseenter:v,onPointermove:u,onMousemove:u,onPointerleave:r,onMouseleave:r},theirProps:{...l,...M},slot:i,attrs:l,slots:b,name:"MenuItem"})}}});export{ge as Menu,Se as MenuButton,Me as MenuItem,be as MenuItems};
import{computed as y,defineComponent as T,inject as C,nextTick as h,onMounted as K,onUnmounted as N,provide as j,ref as R,watchEffect as L}from"vue";import{useId as w}from'../../hooks/use-id.js';import{useOutsideClick as B}from'../../hooks/use-outside-click.js';import{useResolveButtonType as U}from'../../hooks/use-resolve-button-type.js';import{useTextValue as $}from'../../hooks/use-text-value.js';import{useTrackedPointer as V}from'../../hooks/use-tracked-pointer.js';import{useTreeWalker as H}from'../../hooks/use-tree-walker.js';import{State as D,useOpenClosed as Q,useOpenClosedProvider as _}from'../../internal/open-closed.js';import{Keys as c}from'../../keyboard.js';import{Focus as S,calculateActiveIndex as q}from'../../utils/calculate-active-index.js';import{dom as p}from'../../utils/dom.js';import{Focus as E,FocusableMode as W,focusFrom as J,isFocusableElement as z,restoreFocusIfNecessary as k,sortByDomNode as G}from'../../utils/focus-management.js';import{match as X}from'../../utils/match.js';import{Features as F,render as P}from'../../utils/render.js';var Y=(l=>(l[l.Open=0]="Open",l[l.Closed=1]="Closed",l))(Y||{}),Z=(l=>(l[l.Pointer=0]="Pointer",l[l.Other=1]="Other",l))(Z||{});function ee(i){requestAnimationFrame(()=>requestAnimationFrame(i))}let A=Symbol("MenuContext");function O(i){let M=C(A,null);if(M===null){let l=new Error(`<${i} /> is missing a parent <Menu /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(l,O),l}return M}let Ie=T({name:"Menu",props:{as:{type:[Object,String],default:"template"}},setup(i,{slots:M,attrs:l}){let I=R(1),e=R(null),f=R(null),s=R([]),g=R(""),d=R(null),o=R(1);function t(a=r=>r){let r=d.value!==null?s.value[d.value]:null,u=G(a(s.value.slice()),m=>p(m.dataRef.domRef)),n=r?u.indexOf(r):null;return n===-1&&(n=null),{items:u,activeItemIndex:n}}let v={menuState:I,buttonRef:e,itemsRef:f,items:s,searchQuery:g,activeItemIndex:d,activationTrigger:o,closeMenu:()=>{I.value=1,d.value=null},openMenu:()=>I.value=0,goToItem(a,r,u){let n=t(),m=q(a===S.Specific?{focus:S.Specific,id:r}:{focus:a},{resolveItems:()=>n.items,resolveActiveIndex:()=>n.activeItemIndex,resolveId:b=>b.id,resolveDisabled:b=>b.dataRef.disabled});g.value="",d.value=m,o.value=u!=null?u:1,s.value=n.items},search(a){let u=g.value!==""?0:1;g.value+=a.toLowerCase();let m=(d.value!==null?s.value.slice(d.value+u).concat(s.value.slice(0,d.value+u)):s.value).find(x=>x.dataRef.textValue.startsWith(g.value)&&!x.dataRef.disabled),b=m?s.value.indexOf(m):-1;b===-1||b===d.value||(d.value=b,o.value=1)},clearSearch(){g.value=""},registerItem(a,r){let u=t(n=>[...n,{id:a,dataRef:r}]);s.value=u.items,d.value=u.activeItemIndex,o.value=1},unregisterItem(a){let r=t(u=>{let n=u.findIndex(m=>m.id===a);return n!==-1&&u.splice(n,1),u});s.value=r.items,d.value=r.activeItemIndex,o.value=1}};return B([e,f],(a,r)=>{var u;v.closeMenu(),z(r,W.Loose)||(a.preventDefault(),(u=p(e))==null||u.focus())},y(()=>I.value===0)),j(A,v),_(y(()=>X(I.value,{[0]:D.Open,[1]:D.Closed}))),()=>{let a={open:I.value===0,close:v.closeMenu};return P({ourProps:{},theirProps:i,slot:a,slots:M,attrs:l,name:"Menu"})}}}),ge=T({name:"MenuButton",props:{disabled:{type:Boolean,default:!1},as:{type:[Object,String],default:"button"},id:{type:String,default:()=>`headlessui-menu-button-${w()}`}},setup(i,{attrs:M,slots:l,expose:I}){let e=O("MenuButton");I({el:e.buttonRef,$el:e.buttonRef});function f(o){switch(o.key){case c.Space:case c.Enter:case c.ArrowDown:o.preventDefault(),o.stopPropagation(),e.openMenu(),h(()=>{var t;(t=p(e.itemsRef))==null||t.focus({preventScroll:!0}),e.goToItem(S.First)});break;case c.ArrowUp:o.preventDefault(),o.stopPropagation(),e.openMenu(),h(()=>{var t;(t=p(e.itemsRef))==null||t.focus({preventScroll:!0}),e.goToItem(S.Last)});break}}function s(o){switch(o.key){case c.Space:o.preventDefault();break}}function g(o){i.disabled||(e.menuState.value===0?(e.closeMenu(),h(()=>{var t;return(t=p(e.buttonRef))==null?void 0:t.focus({preventScroll:!0})})):(o.preventDefault(),e.openMenu(),ee(()=>{var t;return(t=p(e.itemsRef))==null?void 0:t.focus({preventScroll:!0})})))}let d=U(y(()=>({as:i.as,type:M.type})),e.buttonRef);return()=>{var r;let o={open:e.menuState.value===0},{id:t,...v}=i,a={ref:e.buttonRef,id:t,type:d.value,"aria-haspopup":"menu","aria-controls":(r=p(e.itemsRef))==null?void 0:r.id,"aria-expanded":e.menuState.value===0,onKeydown:f,onKeyup:s,onClick:g};return P({ourProps:a,theirProps:v,slot:o,attrs:M,slots:l,name:"MenuButton"})}}}),Se=T({name:"MenuItems",props:{as:{type:[Object,String],default:"div"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0},id:{type:String,default:()=>`headlessui-menu-items-${w()}`}},setup(i,{attrs:M,slots:l,expose:I}){let e=O("MenuItems"),f=R(null);I({el:e.itemsRef,$el:e.itemsRef}),H({container:y(()=>p(e.itemsRef)),enabled:y(()=>e.menuState.value===0),accept(t){return t.getAttribute("role")==="menuitem"?NodeFilter.FILTER_REJECT:t.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(t){t.setAttribute("role","none")}});function s(t){var v;switch(f.value&&clearTimeout(f.value),t.key){case c.Space:if(e.searchQuery.value!=="")return t.preventDefault(),t.stopPropagation(),e.search(t.key);case c.Enter:if(t.preventDefault(),t.stopPropagation(),e.activeItemIndex.value!==null){let r=e.items.value[e.activeItemIndex.value];(v=p(r.dataRef.domRef))==null||v.click()}e.closeMenu(),k(p(e.buttonRef));break;case c.ArrowDown:return t.preventDefault(),t.stopPropagation(),e.goToItem(S.Next);case c.ArrowUp:return t.preventDefault(),t.stopPropagation(),e.goToItem(S.Previous);case c.Home:case c.PageUp:return t.preventDefault(),t.stopPropagation(),e.goToItem(S.First);case c.End:case c.PageDown:return t.preventDefault(),t.stopPropagation(),e.goToItem(S.Last);case c.Escape:t.preventDefault(),t.stopPropagation(),e.closeMenu(),h(()=>{var a;return(a=p(e.buttonRef))==null?void 0:a.focus({preventScroll:!0})});break;case c.Tab:t.preventDefault(),t.stopPropagation(),e.closeMenu(),h(()=>J(p(e.buttonRef),t.shiftKey?E.Previous:E.Next));break;default:t.key.length===1&&(e.search(t.key),f.value=setTimeout(()=>e.clearSearch(),350));break}}function g(t){switch(t.key){case c.Space:t.preventDefault();break}}let d=Q(),o=y(()=>d!==null?(d.value&D.Open)===D.Open:e.menuState.value===0);return()=>{var u,n;let t={open:e.menuState.value===0},{id:v,...a}=i,r={"aria-activedescendant":e.activeItemIndex.value===null||(u=e.items.value[e.activeItemIndex.value])==null?void 0:u.id,"aria-labelledby":(n=p(e.buttonRef))==null?void 0:n.id,id:v,onKeydown:s,onKeyup:g,role:"menu",tabIndex:0,ref:e.itemsRef};return P({ourProps:r,theirProps:a,slot:t,attrs:M,slots:l,features:F.RenderStrategy|F.Static,visible:o.value,name:"MenuItems"})}}}),Me=T({name:"MenuItem",inheritAttrs:!1,props:{as:{type:[Object,String],default:"template"},disabled:{type:Boolean,default:!1},id:{type:String,default:()=>`headlessui-menu-item-${w()}`}},setup(i,{slots:M,attrs:l,expose:I}){let e=O("MenuItem"),f=R(null);I({el:f,$el:f});let s=y(()=>e.activeItemIndex.value!==null?e.items.value[e.activeItemIndex.value].id===i.id:!1),g=$(f),d=y(()=>({disabled:i.disabled,get textValue(){return g()},domRef:f}));K(()=>e.registerItem(i.id,d)),N(()=>e.unregisterItem(i.id)),L(()=>{e.menuState.value===0&&s.value&&e.activationTrigger.value!==0&&h(()=>{var n,m;return(m=(n=p(f))==null?void 0:n.scrollIntoView)==null?void 0:m.call(n,{block:"nearest"})})});function o(n){if(i.disabled)return n.preventDefault();e.closeMenu(),k(p(e.buttonRef))}function t(){if(i.disabled)return e.goToItem(S.Nothing);e.goToItem(S.Specific,i.id)}let v=V();function a(n){v.update(n)}function r(n){v.wasMoved(n)&&(i.disabled||s.value||e.goToItem(S.Specific,i.id,0))}function u(n){v.wasMoved(n)&&(i.disabled||s.value&&e.goToItem(S.Nothing))}return()=>{let{id:n,disabled:m,...b}=i,x={active:s.value,disabled:m,close:e.closeMenu};return P({ourProps:{id:n,ref:f,role:"menuitem",tabIndex:m===!0?void 0:-1,"aria-disabled":m===!0?!0:void 0,onClick:o,onFocus:t,onPointerenter:a,onMouseenter:a,onPointermove:r,onMousemove:r,onPointerleave:u,onMouseleave:u},theirProps:{...l,...b},slot:x,attrs:l,slots:M,name:"MenuItem"})}}});export{Ie as Menu,ge as MenuButton,Me as MenuItem,Se as MenuItems};

@@ -8,5 +8,3 @@ export declare let Popover: import("vue").DefineComponent<{

[key: string]: any;
}> | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
[key: string]: any;
}>[] | null, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
}>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
as: {

@@ -48,5 +46,5 @@ type: (ObjectConstructor | StringConstructor)[];

}>>, {
id: string;
as: string | Record<string, any>;
disabled: boolean;
id: string;
}>;

@@ -135,7 +133,7 @@ export declare let PopoverOverlay: import("vue").DefineComponent<{

}>>, {
focus: boolean;
id: string;
as: string | Record<string, any>;
unmount: boolean;
static: boolean;
id: string;
focus: boolean;
}>;

@@ -149,5 +147,3 @@ export declare let PopoverGroup: import("vue").DefineComponent<{

[key: string]: any;
}> | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
[key: string]: any;
}>[] | null, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
}>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
as: {

@@ -154,0 +150,0 @@ type: (ObjectConstructor | StringConstructor)[];

@@ -1,1 +0,1 @@

import{Fragment as Q,computed as O,defineComponent as H,h as K,inject as A,provide as V,ref as T,shallowRef as ae,watchEffect as _,onMounted as X,onUnmounted as Y}from"vue";import{match as x}from'../../utils/match.js';import{render as G,Features as j}from'../../utils/render.js';import{useId as B}from'../../hooks/use-id.js';import{Keys as M}from'../../keyboard.js';import{getFocusableElements as U,Focus as C,focusIn as k,isFocusableElement as ue,FocusableMode as ie,FocusResult as q}from'../../utils/focus-management.js';import{dom as l}from'../../utils/dom.js';import{useOpenClosedProvider as se,State as L,useOpenClosed as Z}from'../../internal/open-closed.js';import{useResolveButtonType as pe}from'../../hooks/use-resolve-button-type.js';import{useOutsideClick as fe}from'../../hooks/use-outside-click.js';import{getOwnerDocument as N}from'../../utils/owner.js';import{useEventListener as ve}from'../../hooks/use-event-listener.js';import{Hidden as z,Features as J}from'../../internal/hidden.js';import{useTabDirection as ee,Direction as R}from'../../hooks/use-tab-direction.js';import'../../utils/micro-task.js';var ce=(p=>(p[p.Open=0]="Open",p[p.Closed=1]="Closed",p))(ce||{});let te=Symbol("PopoverContext");function W(c){let m=A(te,null);if(m===null){let p=new Error(`<${c} /> is missing a parent <${Pe.name} /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(p,W),p}return m}let oe=Symbol("PopoverGroupContext");function ne(){return A(oe,null)}let le=Symbol("PopoverPanelContext");function de(){return A(le,null)}let Pe=H({name:"Popover",props:{as:{type:[Object,String],default:"div"}},setup(c,{slots:m,attrs:p,expose:y}){var n;let o=T(null);y({el:o,$el:o});let e=T(1),f=T(null),d=T(null),I=T(null),s=T(null),b=O(()=>N(o)),P=O(()=>{var h,D;if(!l(f)||!l(s))return!1;for(let w of document.querySelectorAll("body > *"))if(Number(w==null?void 0:w.contains(l(f)))^Number(w==null?void 0:w.contains(l(s))))return!0;let t=U(),r=t.indexOf(l(f)),u=(r+t.length-1)%t.length,v=(r+1)%t.length,S=t[u],$=t[v];return!((h=l(s))!=null&&h.contains(S))&&!((D=l(s))!=null&&D.contains($))}),a={popoverState:e,buttonId:T(null),panelId:T(null),panel:s,button:f,isPortalled:P,beforePanelSentinel:d,afterPanelSentinel:I,togglePopover(){e.value=x(e.value,{[0]:1,[1]:0})},closePopover(){e.value!==1&&(e.value=1)},close(t){a.closePopover();let r=(()=>t?t instanceof HTMLElement?t:t.value instanceof HTMLElement?l(t):l(a.button):l(a.button))();r==null||r.focus()}};V(te,a),se(O(()=>x(e.value,{[0]:L.Open,[1]:L.Closed})));let F={buttonId:a.buttonId,panelId:a.panelId,close(){a.closePopover()}},g=ne(),E=g==null?void 0:g.registerPopover;function i(){var t,r,u,v;return(v=g==null?void 0:g.isFocusWithinPopoverGroup())!=null?v:((t=b.value)==null?void 0:t.activeElement)&&(((r=l(f))==null?void 0:r.contains(b.value.activeElement))||((u=l(s))==null?void 0:u.contains(b.value.activeElement)))}return _(()=>E==null?void 0:E(F)),ve((n=b.value)==null?void 0:n.defaultView,"focus",t=>{var r,u;e.value===0&&(i()||f&&s&&t.target!==window&&((r=l(a.beforePanelSentinel))!=null&&r.contains(t.target)||(u=l(a.afterPanelSentinel))!=null&&u.contains(t.target)||a.closePopover()))},!0),fe([f,s],(t,r)=>{var u;a.closePopover(),ue(r,ie.Loose)||(t.preventDefault(),(u=l(f))==null||u.focus())},O(()=>e.value===0)),()=>{let t={open:e.value===0,close:a.close};return G({theirProps:c,ourProps:{ref:o},slot:t,slots:m,attrs:p,name:"Popover"})}}}),Be=H({name:"PopoverButton",props:{as:{type:[Object,String],default:"button"},disabled:{type:[Boolean],default:!1},id:{type:String,default:()=>`headlessui-popover-button-${B()}`}},inheritAttrs:!1,setup(c,{attrs:m,slots:p,expose:y}){let o=W("PopoverButton"),e=O(()=>N(o.button));y({el:o.button,$el:o.button}),X(()=>{o.buttonId.value=c.id}),Y(()=>{o.buttonId.value=null});let f=ne(),d=f==null?void 0:f.closeOthers,I=de(),s=O(()=>I===null?!1:I.value===o.panelId.value),b=T(null),P=`headlessui-focus-sentinel-${B()}`;s.value||_(()=>{o.button.value=b.value});let a=pe(O(()=>({as:c.as,type:m.type})),b);function F(n){var t,r,u,v,S;if(s.value){if(o.popoverState.value===1)return;switch(n.key){case M.Space:case M.Enter:n.preventDefault(),(r=(t=n.target).click)==null||r.call(t),o.closePopover(),(u=l(o.button))==null||u.focus();break}}else switch(n.key){case M.Space:case M.Enter:n.preventDefault(),n.stopPropagation(),o.popoverState.value===1&&(d==null||d(o.buttonId.value)),o.togglePopover();break;case M.Escape:if(o.popoverState.value!==0)return d==null?void 0:d(o.buttonId.value);if(!l(o.button)||(v=e.value)!=null&&v.activeElement&&!((S=l(o.button))!=null&&S.contains(e.value.activeElement)))return;n.preventDefault(),n.stopPropagation(),o.closePopover();break}}function g(n){s.value||n.key===M.Space&&n.preventDefault()}function E(n){var t,r;c.disabled||(s.value?(o.closePopover(),(t=l(o.button))==null||t.focus()):(n.preventDefault(),n.stopPropagation(),o.popoverState.value===1&&(d==null||d(o.buttonId.value)),o.togglePopover(),(r=l(o.button))==null||r.focus()))}function i(n){n.preventDefault(),n.stopPropagation()}return()=>{let n=o.popoverState.value===0,t={open:n},{id:r,...u}=c,v=s.value?{ref:b,type:a.value,onKeydown:F,onClick:E}:{ref:b,id:r,type:a.value,"aria-expanded":c.disabled?void 0:o.popoverState.value===0,"aria-controls":l(o.panel)?o.panelId.value:void 0,disabled:c.disabled?!0:void 0,onKeydown:F,onKeyup:g,onClick:E,onMousedown:i},S=ee();function $(){let h=l(o.panel);if(!h)return;function D(){x(S.value,{[R.Forwards]:()=>k(h,C.First),[R.Backwards]:()=>k(h,C.Last)})===q.Error&&k(U().filter(re=>re.dataset.headlessuiFocusGuard!=="true"),x(S.value,{[R.Forwards]:C.Next,[R.Backwards]:C.Previous}),{relativeTo:l(o.button)})}D()}return K(Q,[G({ourProps:v,theirProps:{...m,...u},slot:t,attrs:m,slots:p,name:"PopoverButton"}),n&&!s.value&&o.isPortalled.value&&K(z,{id:P,features:J.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:$})])}}}),Le=H({name:"PopoverOverlay",props:{as:{type:[Object,String],default:"div"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0}},setup(c,{attrs:m,slots:p}){let y=W("PopoverOverlay"),o=`headlessui-popover-overlay-${B()}`,e=Z(),f=O(()=>e!==null?(e.value&L.Open)===L.Open:y.popoverState.value===0);function d(){y.closePopover()}return()=>{let I={open:y.popoverState.value===0};return G({ourProps:{id:o,"aria-hidden":!0,onClick:d},theirProps:c,slot:I,attrs:m,slots:p,features:j.RenderStrategy|j.Static,visible:f.value,name:"PopoverOverlay"})}}}),He=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:()=>`headlessui-popover-panel-${B()}`}},inheritAttrs:!1,setup(c,{attrs:m,slots:p,expose:y}){let{focus:o}=c,e=W("PopoverPanel"),f=O(()=>N(e.panel)),d=`headlessui-focus-sentinel-before-${B()}`,I=`headlessui-focus-sentinel-after-${B()}`;y({el:e.panel,$el:e.panel}),X(()=>{e.panelId.value=c.id}),Y(()=>{e.panelId.value=null}),V(le,e.panelId),_(()=>{var n,t;if(!o||e.popoverState.value!==0||!e.panel)return;let i=(n=f.value)==null?void 0:n.activeElement;(t=l(e.panel))!=null&&t.contains(i)||k(l(e.panel),C.First)});let s=Z(),b=O(()=>s!==null?(s.value&L.Open)===L.Open:e.popoverState.value===0);function P(i){var n,t;switch(i.key){case M.Escape:if(e.popoverState.value!==0||!l(e.panel)||f.value&&!((n=l(e.panel))!=null&&n.contains(f.value.activeElement)))return;i.preventDefault(),i.stopPropagation(),e.closePopover(),(t=l(e.button))==null||t.focus();break}}function a(i){var t,r,u,v,S;let n=i.relatedTarget;n&&l(e.panel)&&((t=l(e.panel))!=null&&t.contains(n)||(e.closePopover(),((u=(r=l(e.beforePanelSentinel))==null?void 0:r.contains)!=null&&u.call(r,n)||(S=(v=l(e.afterPanelSentinel))==null?void 0:v.contains)!=null&&S.call(v,n))&&n.focus({preventScroll:!0})))}let F=ee();function g(){let i=l(e.panel);if(!i)return;function n(){x(F.value,{[R.Forwards]:()=>{var r;k(i,C.First)===q.Error&&((r=l(e.afterPanelSentinel))==null||r.focus())},[R.Backwards]:()=>{var t;(t=l(e.button))==null||t.focus({preventScroll:!0})}})}n()}function E(){let i=l(e.panel);if(!i)return;function n(){x(F.value,{[R.Forwards]:()=>{let t=l(e.button),r=l(e.panel);if(!t)return;let u=U(),v=u.indexOf(t),S=u.slice(0,v+1),h=[...u.slice(v+1),...S];for(let D of h.slice())if(D.dataset.headlessuiFocusGuard==="true"||r!=null&&r.contains(D)){let w=h.indexOf(D);w!==-1&&h.splice(w,1)}k(h,C.First,{sorted:!1})},[R.Backwards]:()=>{var r;k(i,C.Previous)===q.Error&&((r=l(e.button))==null||r.focus())}})}n()}return()=>{let i={open:e.popoverState.value===0,close:e.close},{id:n,focus:t,...r}=c,u={ref:e.panel,id:n,onKeydown:P,onFocusout:o&&e.popoverState.value===0?a:void 0,tabIndex:-1};return G({ourProps:u,theirProps:{...m,...r},attrs:m,slot:i,slots:{...p,default:(...v)=>{var S;return[K(Q,[b.value&&e.isPortalled.value&&K(z,{id:d,ref:e.beforePanelSentinel,features:J.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:g}),(S=p.default)==null?void 0:S.call(p,...v),b.value&&e.isPortalled.value&&K(z,{id:I,ref:e.afterPanelSentinel,features:J.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:E})])]}},features:j.RenderStrategy|j.Static,visible:b.value,name:"PopoverPanel"})}}}),Ke=H({name:"PopoverGroup",props:{as:{type:[Object,String],default:"div"}},setup(c,{attrs:m,slots:p,expose:y}){let o=T(null),e=ae([]),f=O(()=>N(o));y({el:o,$el:o});function d(P){let a=e.value.indexOf(P);a!==-1&&e.value.splice(a,1)}function I(P){return e.value.push(P),()=>{d(P)}}function s(){var F;let P=f.value;if(!P)return!1;let a=P.activeElement;return(F=l(o))!=null&&F.contains(a)?!0:e.value.some(g=>{var E,i;return((E=P.getElementById(g.buttonId.value))==null?void 0:E.contains(a))||((i=P.getElementById(g.panelId.value))==null?void 0:i.contains(a))})}function b(P){for(let a of e.value)a.buttonId.value!==P&&a.close()}return V(oe,{registerPopover:I,unregisterPopover:d,isFocusWithinPopoverGroup:s,closeOthers:b}),()=>G({ourProps:{ref:o},theirProps:c,slot:{},attrs:m,slots:p,name:"PopoverGroup"})}});export{Pe as Popover,Be as PopoverButton,Ke as PopoverGroup,Le as PopoverOverlay,He as PopoverPanel};
import{Fragment as j,computed as T,defineComponent as K,h as R,inject as _,onMounted as ee,onUnmounted as te,provide as U,ref as F,shallowRef as ie,watchEffect as q}from"vue";import{useNestedPortals as se}from'../../components/portal/portal.js';import{useEventListener as pe}from'../../hooks/use-event-listener.js';import{useId as L}from'../../hooks/use-id.js';import{useOutsideClick as fe}from'../../hooks/use-outside-click.js';import{useResolveButtonType as ve}from'../../hooks/use-resolve-button-type.js';import{useMainTreeNode as ce,useRootContainers as de}from'../../hooks/use-root-containers.js';import{Direction as w,useTabDirection as oe}from'../../hooks/use-tab-direction.js';import{Hidden as z,Features as J}from'../../internal/hidden.js';import{State as x,useOpenClosed as ne,useOpenClosedProvider as Pe}from'../../internal/open-closed.js';import{Keys as D}from'../../keyboard.js';import{dom as r}from'../../utils/dom.js';import{Focus as C,FocusResult as Q,FocusableMode as me,focusIn as B,getFocusableElements as X,isFocusableElement as be}from'../../utils/focus-management.js';import{match as H}from'../../utils/match.js';import'../../utils/micro-task.js';import{getOwnerDocument as A}from'../../utils/owner.js';import{Features as W,render as G}from'../../utils/render.js';var Se=(p=>(p[p.Open=0]="Open",p[p.Closed=1]="Closed",p))(Se||{});let re=Symbol("PopoverContext");function V(P){let b=_(re,null);if(b===null){let p=new Error(`<${P} /> is missing a parent <${ye.name} /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(p,V),p}return b}let le=Symbol("PopoverGroupContext");function ae(){return _(le,null)}let ue=Symbol("PopoverPanelContext");function ge(){return _(ue,null)}let ye=K({name:"Popover",inheritAttrs:!1,props:{as:{type:[Object,String],default:"div"}},setup(P,{slots:b,attrs:p,expose:h}){var v;let t=F(null);h({el:t,$el:t});let e=F(1),c=F(null),d=F(null),O=F(null),f=F(null),y=T(()=>A(t)),M=T(()=>{var Y,Z;if(!r(c)||!r(f))return!1;for(let k of document.querySelectorAll("body > *"))if(Number(k==null?void 0:k.contains(r(c)))^Number(k==null?void 0:k.contains(r(f))))return!0;let o=X(),a=o.indexOf(r(c)),g=(a+o.length-1)%o.length,E=(a+1)%o.length,N=o[g],$=o[E];return!((Y=r(f))!=null&&Y.contains(N))&&!((Z=r(f))!=null&&Z.contains($))}),l={popoverState:e,buttonId:F(null),panelId:F(null),panel:f,button:c,isPortalled:M,beforePanelSentinel:d,afterPanelSentinel:O,togglePopover(){e.value=H(e.value,{[0]:1,[1]:0})},closePopover(){e.value!==1&&(e.value=1)},close(o){l.closePopover();let a=(()=>o?o instanceof HTMLElement?o:o.value instanceof HTMLElement?r(o):r(l.button):r(l.button))();a==null||a.focus()}};U(re,l),Pe(T(()=>H(e.value,{[0]:x.Open,[1]:x.Closed})));let m={buttonId:l.buttonId,panelId:l.panelId,close(){l.closePopover()}},S=ae(),I=S==null?void 0:S.registerPopover,[s,u]=se(),i=de({mainTreeNodeRef:S==null?void 0:S.mainTreeNodeRef,portals:s,defaultContainers:[c,f]});function n(){var o,a,g,E;return(E=S==null?void 0:S.isFocusWithinPopoverGroup())!=null?E:((o=y.value)==null?void 0:o.activeElement)&&(((a=r(c))==null?void 0:a.contains(y.value.activeElement))||((g=r(f))==null?void 0:g.contains(y.value.activeElement)))}return q(()=>I==null?void 0:I(m)),pe((v=y.value)==null?void 0:v.defaultView,"focus",o=>{var a,g;o.target!==window&&o.target instanceof HTMLElement&&e.value===0&&(n()||c&&f&&(i.contains(o.target)||(a=r(l.beforePanelSentinel))!=null&&a.contains(o.target)||(g=r(l.afterPanelSentinel))!=null&&g.contains(o.target)||l.closePopover()))},!0),fe(i.resolveContainers,(o,a)=>{var g;l.closePopover(),be(a,me.Loose)||(o.preventDefault(),(g=r(c))==null||g.focus())},T(()=>e.value===0)),()=>{let o={open:e.value===0,close:l.close};return R(j,[R(u,{},()=>G({theirProps:{...P,...p},ourProps:{ref:t},slot:o,slots:b,attrs:p,name:"Popover"})),R(i.MainTreeNode)])}}}),Ge=K({name:"PopoverButton",props:{as:{type:[Object,String],default:"button"},disabled:{type:[Boolean],default:!1},id:{type:String,default:()=>`headlessui-popover-button-${L()}`}},inheritAttrs:!1,setup(P,{attrs:b,slots:p,expose:h}){let t=V("PopoverButton"),e=T(()=>A(t.button));h({el:t.button,$el:t.button}),ee(()=>{t.buttonId.value=P.id}),te(()=>{t.buttonId.value=null});let c=ae(),d=c==null?void 0:c.closeOthers,O=ge(),f=T(()=>O===null?!1:O.value===t.panelId.value),y=F(null),M=`headlessui-focus-sentinel-${L()}`;f.value||q(()=>{t.button.value=r(y)});let l=ve(T(()=>({as:P.as,type:b.type})),y);function m(n){var v,o,a,g,E;if(f.value){if(t.popoverState.value===1)return;switch(n.key){case D.Space:case D.Enter:n.preventDefault(),(o=(v=n.target).click)==null||o.call(v),t.closePopover(),(a=r(t.button))==null||a.focus();break}}else switch(n.key){case D.Space:case D.Enter:n.preventDefault(),n.stopPropagation(),t.popoverState.value===1&&(d==null||d(t.buttonId.value)),t.togglePopover();break;case D.Escape:if(t.popoverState.value!==0)return d==null?void 0:d(t.buttonId.value);if(!r(t.button)||(g=e.value)!=null&&g.activeElement&&!((E=r(t.button))!=null&&E.contains(e.value.activeElement)))return;n.preventDefault(),n.stopPropagation(),t.closePopover();break}}function S(n){f.value||n.key===D.Space&&n.preventDefault()}function I(n){var v,o;P.disabled||(f.value?(t.closePopover(),(v=r(t.button))==null||v.focus()):(n.preventDefault(),n.stopPropagation(),t.popoverState.value===1&&(d==null||d(t.buttonId.value)),t.togglePopover(),(o=r(t.button))==null||o.focus()))}function s(n){n.preventDefault(),n.stopPropagation()}let u=oe();function i(){let n=r(t.panel);if(!n)return;function v(){H(u.value,{[w.Forwards]:()=>B(n,C.First),[w.Backwards]:()=>B(n,C.Last)})===Q.Error&&B(X().filter(a=>a.dataset.headlessuiFocusGuard!=="true"),H(u.value,{[w.Forwards]:C.Next,[w.Backwards]:C.Previous}),{relativeTo:r(t.button)})}v()}return()=>{let n=t.popoverState.value===0,v={open:n},{id:o,...a}=P,g=f.value?{ref:y,type:l.value,onKeydown:m,onClick:I}:{ref:y,id:o,type:l.value,"aria-expanded":t.popoverState.value===0,"aria-controls":r(t.panel)?t.panelId.value:void 0,disabled:P.disabled?!0:void 0,onKeydown:m,onKeyup:S,onClick:I,onMousedown:s};return R(j,[G({ourProps:g,theirProps:{...b,...a},slot:v,attrs:b,slots:p,name:"PopoverButton"}),n&&!f.value&&t.isPortalled.value&&R(z,{id:M,features:J.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:i})])}}}),$e=K({name:"PopoverOverlay",props:{as:{type:[Object,String],default:"div"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0}},setup(P,{attrs:b,slots:p}){let h=V("PopoverOverlay"),t=`headlessui-popover-overlay-${L()}`,e=ne(),c=T(()=>e!==null?(e.value&x.Open)===x.Open:h.popoverState.value===0);function d(){h.closePopover()}return()=>{let O={open:h.popoverState.value===0};return G({ourProps:{id:t,"aria-hidden":!0,onClick:d},theirProps:P,slot:O,attrs:b,slots:p,features:W.RenderStrategy|W.Static,visible:c.value,name:"PopoverOverlay"})}}}),je=K({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:()=>`headlessui-popover-panel-${L()}`}},inheritAttrs:!1,setup(P,{attrs:b,slots:p,expose:h}){let{focus:t}=P,e=V("PopoverPanel"),c=T(()=>A(e.panel)),d=`headlessui-focus-sentinel-before-${L()}`,O=`headlessui-focus-sentinel-after-${L()}`;h({el:e.panel,$el:e.panel}),ee(()=>{e.panelId.value=P.id}),te(()=>{e.panelId.value=null}),U(ue,e.panelId),q(()=>{var u,i;if(!t||e.popoverState.value!==0||!e.panel)return;let s=(u=c.value)==null?void 0:u.activeElement;(i=r(e.panel))!=null&&i.contains(s)||B(r(e.panel),C.First)});let f=ne(),y=T(()=>f!==null?(f.value&x.Open)===x.Open:e.popoverState.value===0);function M(s){var u,i;switch(s.key){case D.Escape:if(e.popoverState.value!==0||!r(e.panel)||c.value&&!((u=r(e.panel))!=null&&u.contains(c.value.activeElement)))return;s.preventDefault(),s.stopPropagation(),e.closePopover(),(i=r(e.button))==null||i.focus();break}}function l(s){var i,n,v,o,a;let u=s.relatedTarget;u&&r(e.panel)&&((i=r(e.panel))!=null&&i.contains(u)||(e.closePopover(),((v=(n=r(e.beforePanelSentinel))==null?void 0:n.contains)!=null&&v.call(n,u)||(a=(o=r(e.afterPanelSentinel))==null?void 0:o.contains)!=null&&a.call(o,u))&&u.focus({preventScroll:!0})))}let m=oe();function S(){let s=r(e.panel);if(!s)return;function u(){H(m.value,{[w.Forwards]:()=>{var n;B(s,C.First)===Q.Error&&((n=r(e.afterPanelSentinel))==null||n.focus())},[w.Backwards]:()=>{var i;(i=r(e.button))==null||i.focus({preventScroll:!0})}})}u()}function I(){let s=r(e.panel);if(!s)return;function u(){H(m.value,{[w.Forwards]:()=>{let i=r(e.button),n=r(e.panel);if(!i)return;let v=X(),o=v.indexOf(i),a=v.slice(0,o+1),E=[...v.slice(o+1),...a];for(let N of E.slice())if(N.dataset.headlessuiFocusGuard==="true"||n!=null&&n.contains(N)){let $=E.indexOf(N);$!==-1&&E.splice($,1)}B(E,C.First,{sorted:!1})},[w.Backwards]:()=>{var n;B(s,C.Previous)===Q.Error&&((n=r(e.button))==null||n.focus())}})}u()}return()=>{let s={open:e.popoverState.value===0,close:e.close},{id:u,focus:i,...n}=P,v={ref:e.panel,id:u,onKeydown:M,onFocusout:t&&e.popoverState.value===0?l:void 0,tabIndex:-1};return G({ourProps:v,theirProps:{...b,...n},attrs:b,slot:s,slots:{...p,default:(...o)=>{var a;return[R(j,[y.value&&e.isPortalled.value&&R(z,{id:d,ref:e.beforePanelSentinel,features:J.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:S}),(a=p.default)==null?void 0:a.call(p,...o),y.value&&e.isPortalled.value&&R(z,{id:O,ref:e.afterPanelSentinel,features:J.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:I})])]}},features:W.RenderStrategy|W.Static,visible:y.value,name:"PopoverPanel"})}}}),Ae=K({name:"PopoverGroup",inheritAttrs:!1,props:{as:{type:[Object,String],default:"div"}},setup(P,{attrs:b,slots:p,expose:h}){let t=F(null),e=ie([]),c=T(()=>A(t)),d=ce();h({el:t,$el:t});function O(l){let m=e.value.indexOf(l);m!==-1&&e.value.splice(m,1)}function f(l){return e.value.push(l),()=>{O(l)}}function y(){var S;let l=c.value;if(!l)return!1;let m=l.activeElement;return(S=r(t))!=null&&S.contains(m)?!0:e.value.some(I=>{var s,u;return((s=l.getElementById(I.buttonId.value))==null?void 0:s.contains(m))||((u=l.getElementById(I.panelId.value))==null?void 0:u.contains(m))})}function M(l){for(let m of e.value)m.buttonId.value!==l&&m.close()}return U(le,{registerPopover:f,unregisterPopover:O,isFocusWithinPopoverGroup:y,closeOthers:M,mainTreeNodeRef:d.mainTreeNodeRef}),()=>R(j,[G({ourProps:{ref:t},theirProps:{...P,...b},slot:{},attrs:b,slots:p,name:"PopoverGroup"}),R(d.MainTreeNode)])}});export{ye as Popover,Ge as PopoverButton,Ae as PopoverGroup,$e as PopoverOverlay,je as PopoverPanel};

@@ -1,2 +0,2 @@

import { PropType } from 'vue';
import { type PropType, type Ref } from 'vue';
export declare let Portal: import("vue").DefineComponent<{

@@ -17,2 +17,5 @@ as: {

}>;
export declare function useNestedPortals(): readonly [Ref<HTMLElement[]>, import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
[key: string]: any;
}>[] | undefined, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>];
export declare let PortalGroup: import("vue").DefineComponent<{

@@ -19,0 +22,0 @@ as: {

@@ -1,1 +0,1 @@

import{Teleport as P,defineComponent as s,h,inject as y,onUnmounted as T,provide as E,reactive as w,ref as d,watchEffect as C,computed as b}from"vue";import{render as f}from'../../utils/render.js';import{usePortalRoot as j}from'../../internal/portal-force-root.js';import{getOwnerDocument as v}from'../../utils/owner.js';function c(t){let r=v(t);if(!r){if(t===null)return null;throw new Error(`[Headless UI]: Cannot find ownerDocument for contextElement: ${t}`)}let o=r.getElementById("headlessui-portal-root");if(o)return o;let e=r.createElement("div");return e.setAttribute("id","headlessui-portal-root"),r.body.appendChild(e)}let R=s({name:"Portal",props:{as:{type:[Object,String],default:"div"}},setup(t,{slots:r,attrs:o}){let e=d(null),p=b(()=>v(e)),n=j(),u=y(g,null),l=d(n===!0||u==null?c(e.value):u.resolveTarget());return C(()=>{n||u!=null&&(l.value=u.resolveTarget())}),T(()=>{var i,m;let a=(i=p.value)==null?void 0:i.getElementById("headlessui-portal-root");a&&l.value===a&&l.value.children.length<=0&&((m=l.value.parentElement)==null||m.removeChild(l.value))}),()=>{if(l.value===null)return null;let a={ref:e,"data-headlessui-portal":""};return h(P,{to:l.value},f({ourProps:a,theirProps:t,slot:{},attrs:o,slots:r,name:"Portal"}))}}}),g=Symbol("PortalGroupContext"),L=s({name:"PortalGroup",props:{as:{type:[Object,String],default:"template"},target:{type:Object,default:null}},setup(t,{attrs:r,slots:o}){let e=w({resolveTarget(){return t.target}});return E(g,e),()=>{let{target:p,...n}=t;return f({theirProps:n,ourProps:{},slot:{},attrs:r,slots:o,name:"PortalGroup"})}}});export{R as Portal,L as PortalGroup};
import{Teleport as M,computed as L,defineComponent as s,getCurrentInstance as j,h as w,inject as f,onMounted as I,onUnmounted as y,provide as T,reactive as b,ref as p,watch as R,watchEffect as G}from"vue";import{usePortalRoot as O}from'../../internal/portal-force-root.js';import{dom as D}from'../../utils/dom.js';import{getOwnerDocument as E}from'../../utils/owner.js';import{render as h}from'../../utils/render.js';function x(r){let e=E(r);if(!e){if(r===null)return null;throw new Error(`[Headless UI]: Cannot find ownerDocument for contextElement: ${r}`)}let u=e.getElementById("headlessui-portal-root");if(u)return u;let t=e.createElement("div");return t.setAttribute("id","headlessui-portal-root"),e.body.appendChild(t)}let _=s({name:"Portal",props:{as:{type:[Object,String],default:"div"}},setup(r,{slots:e,attrs:u}){let t=p(null),i=L(()=>E(t)),l=O(),n=f(C,null),o=p(l===!0||n==null?x(t.value):n.resolveTarget()),d=p(!1);I(()=>{d.value=!0}),G(()=>{l||n!=null&&(o.value=n.resolveTarget())});let c=f(m,null),v=!1,H=j();return R(t,()=>{if(v||!c)return;let a=D(t);a&&(y(c.register(a),H),v=!0)}),y(()=>{var g,P;let a=(g=i.value)==null?void 0:g.getElementById("headlessui-portal-root");a&&o.value===a&&o.value.children.length<=0&&((P=o.value.parentElement)==null||P.removeChild(o.value))}),()=>{if(!d.value||o.value===null)return null;let a={ref:t,"data-headlessui-portal":""};return w(M,{to:o.value},h({ourProps:a,theirProps:r,slot:{},attrs:u,slots:e,name:"Portal"}))}}}),m=Symbol("PortalParentContext");function A(){let r=f(m,null),e=p([]);function u(l){return e.value.push(l),r&&r.register(l),()=>t(l)}function t(l){let n=e.value.indexOf(l);n!==-1&&e.value.splice(n,1),r&&r.unregister(l)}let i={register:u,unregister:t,portals:e};return[e,s({name:"PortalWrapper",setup(l,{slots:n}){return T(m,i),()=>{var o;return(o=n.default)==null?void 0:o.call(n)}}})]}let C=Symbol("PortalGroupContext"),N=s({name:"PortalGroup",props:{as:{type:[Object,String],default:"template"},target:{type:Object,default:null}},setup(r,{attrs:e,slots:u}){let t=b({resolveTarget(){return r.target}});return T(C,t),()=>{let{target:i,...l}=r;return h({theirProps:l,ourProps:{},slot:{},attrs:e,slots:u,name:"PortalGroup"})}}});export{_ as Portal,N as PortalGroup,A as useNestedPortals};

@@ -16,9 +16,13 @@ declare function defaultComparator<T>(a: T, z: T): boolean;

modelValue: {
type: (ObjectConstructor | BooleanConstructor | NumberConstructor | StringConstructor)[];
type: (ObjectConstructor | NumberConstructor | BooleanConstructor | StringConstructor)[];
default: undefined;
};
defaultValue: {
type: (ObjectConstructor | BooleanConstructor | NumberConstructor | StringConstructor)[];
type: (ObjectConstructor | NumberConstructor | BooleanConstructor | StringConstructor)[];
default: undefined;
};
form: {
type: StringConstructor;
optional: boolean;
};
name: {

@@ -50,9 +54,13 @@ type: StringConstructor;

modelValue: {
type: (ObjectConstructor | BooleanConstructor | NumberConstructor | StringConstructor)[];
type: (ObjectConstructor | NumberConstructor | BooleanConstructor | StringConstructor)[];
default: undefined;
};
defaultValue: {
type: (ObjectConstructor | BooleanConstructor | NumberConstructor | StringConstructor)[];
type: (ObjectConstructor | NumberConstructor | BooleanConstructor | StringConstructor)[];
default: undefined;
};
form: {
type: StringConstructor;
optional: boolean;
};
name: {

@@ -69,5 +77,5 @@ type: StringConstructor;

}, {
id: string;
as: string | Record<string, any>;
disabled: boolean;
id: string;
by: string | Function;

@@ -83,3 +91,3 @@ modelValue: string | number | boolean | Record<string, any>;

value: {
type: (ObjectConstructor | BooleanConstructor | NumberConstructor | StringConstructor)[];
type: (ObjectConstructor | NumberConstructor | BooleanConstructor | StringConstructor)[];
};

@@ -104,3 +112,3 @@ disabled: {

value: {
type: (ObjectConstructor | BooleanConstructor | NumberConstructor | StringConstructor)[];
type: (ObjectConstructor | NumberConstructor | BooleanConstructor | StringConstructor)[];
};

@@ -116,5 +124,5 @@ disabled: {

}>>, {
id: string;
as: string | Record<string, any>;
disabled: boolean;
id: string;
}>;

@@ -152,5 +160,5 @@ export declare let RadioGroupLabel: import("vue").DefineComponent<{

}>>, {
passive: boolean;
id: string;
as: string | Record<string, any>;
id: string;
passive: boolean;
}>;

@@ -180,5 +188,5 @@ export declare let RadioGroupDescription: import("vue").DefineComponent<{

}>>, {
id: string;
as: string | Record<string, any>;
id: string;
}>;
export {};

@@ -1,1 +0,1 @@

import{Fragment as K,computed as u,defineComponent as G,h as L,inject as M,onMounted as A,onUnmounted as _,provide as $,ref as h,toRaw as v,watch as U}from"vue";import{dom as F}from'../../utils/dom.js';import{Keys as y}from'../../keyboard.js';import{focusIn as C,Focus as O,FocusResult as D,sortByDomNode as W}from'../../utils/focus-management.js';import{useId as x}from'../../hooks/use-id.js';import{compact as J,omit as q,render as I}from'../../utils/render.js';import{Label as Q,useLabels as P}from'../label/label.js';import{Description as X,useDescriptions as B}from'../description/description.js';import{useTreeWalker as Y}from'../../hooks/use-tree-walker.js';import{Hidden as Z,Features as z}from'../../internal/hidden.js';import{attemptSubmit as ee,objectToFormEntries as te}from'../../utils/form.js';import{getOwnerDocument as T}from'../../utils/owner.js';import{useControllable as ae}from'../../hooks/use-controllable.js';function ne(t,m){return t===m}let V=Symbol("RadioGroupContext");function j(t){let m=M(V,null);if(m===null){let o=new Error(`<${t} /> is missing a parent <RadioGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(o,j),o}return m}let Oe=G({name:"RadioGroup",emits:{"update:modelValue":t=>!0},props:{as:{type:[Object,String],default:"div"},disabled:{type:[Boolean],default:!1},by:{type:[String,Function],default:()=>ne},modelValue:{type:[Object,String,Number,Boolean],default:void 0},defaultValue:{type:[Object,String,Number,Boolean],default:void 0},name:{type:String,optional:!0},id:{type:String,default:()=>`headlessui-radiogroup-${x()}`}},inheritAttrs:!1,setup(t,{emit:m,attrs:o,slots:k,expose:d}){let s=h(null),i=h([]),b=P({name:"RadioGroupLabel"}),E=B({name:"RadioGroupDescription"});d({el:s,$el:s});let[f,w]=ae(u(()=>t.modelValue),e=>m("update:modelValue",e),u(()=>t.defaultValue)),l={options:i,value:f,disabled:u(()=>t.disabled),firstOption:u(()=>i.value.find(e=>!e.propsRef.disabled)),containsCheckedOption:u(()=>i.value.some(e=>l.compare(v(e.propsRef.value),v(t.modelValue)))),compare(e,a){if(typeof t.by=="string"){let n=t.by;return(e==null?void 0:e[n])===(a==null?void 0:a[n])}return t.by(e,a)},change(e){var n;if(t.disabled||l.compare(v(f.value),v(e)))return!1;let a=(n=i.value.find(r=>l.compare(v(r.propsRef.value),v(e))))==null?void 0:n.propsRef;return a!=null&&a.disabled?!1:(w(e),!0)},registerOption(e){i.value.push(e),i.value=W(i.value,a=>a.element)},unregisterOption(e){let a=i.value.findIndex(n=>n.id===e);a!==-1&&i.value.splice(a,1)}};$(V,l),Y({container:u(()=>F(s)),accept(e){return e.getAttribute("role")==="radio"?NodeFilter.FILTER_REJECT:e.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(e){e.setAttribute("role","none")}});function g(e){if(!s.value||!s.value.contains(e.target))return;let a=i.value.filter(n=>n.propsRef.disabled===!1).map(n=>n.element);switch(e.key){case y.Enter:ee(e.currentTarget);break;case y.ArrowLeft:case y.ArrowUp:if(e.preventDefault(),e.stopPropagation(),C(a,O.Previous|O.WrapAround)===D.Success){let r=i.value.find(p=>{var c;return p.element===((c=T(s))==null?void 0:c.activeElement)});r&&l.change(r.propsRef.value)}break;case y.ArrowRight:case y.ArrowDown:if(e.preventDefault(),e.stopPropagation(),C(a,O.Next|O.WrapAround)===D.Success){let r=i.value.find(p=>{var c;return p.element===((c=T(p.element))==null?void 0:c.activeElement)});r&&l.change(r.propsRef.value)}break;case y.Space:{e.preventDefault(),e.stopPropagation();let n=i.value.find(r=>{var p;return r.element===((p=T(r.element))==null?void 0:p.activeElement)});n&&l.change(n.propsRef.value)}break}}let R=u(()=>{var e;return(e=F(s))==null?void 0:e.closest("form")});return A(()=>{U([R],()=>{if(!R.value||t.defaultValue===void 0)return;function e(){l.change(t.defaultValue)}return R.value.addEventListener("reset",e),()=>{var a;(a=R.value)==null||a.removeEventListener("reset",e)}},{immediate:!0})}),()=>{let{disabled:e,name:a,id:n,...r}=t,p={ref:s,id:n,role:"radiogroup","aria-labelledby":b.value,"aria-describedby":E.value,onKeydown:g};return L(K,[...a!=null&&f.value!=null?te({[a]:f.value}).map(([c,S])=>L(Z,J({features:z.Hidden,key:c,as:"input",type:"hidden",hidden:!0,readOnly:!0,name:c,value:S}))):[],I({ourProps:p,theirProps:{...o,...q(r,["modelValue","defaultValue"])},slot:{},attrs:o,slots:k,name:"RadioGroup"})])}}});var re=(o=>(o[o.Empty=1]="Empty",o[o.Active=2]="Active",o))(re||{});let ke=G({name:"RadioGroupOption",props:{as:{type:[Object,String],default:"div"},value:{type:[Object,String,Number,Boolean]},disabled:{type:Boolean,default:!1},id:{type:String,default:()=>`headlessui-radiogroup-option-${x()}`}},setup(t,{attrs:m,slots:o,expose:k}){let d=j("RadioGroupOption"),s=P({name:"RadioGroupLabel"}),i=B({name:"RadioGroupDescription"}),b=h(null),E=u(()=>({value:t.value,disabled:t.disabled})),f=h(1);k({el:b,$el:b}),A(()=>d.registerOption({id:t.id,element:b,propsRef:E})),_(()=>d.unregisterOption(t.id));let w=u(()=>{var r;return((r=d.firstOption.value)==null?void 0:r.id)===t.id}),l=u(()=>d.disabled.value||t.disabled),g=u(()=>d.compare(v(d.value.value),v(t.value))),R=u(()=>l.value?-1:g.value||!d.containsCheckedOption.value&&w.value?0:-1);function e(){var r;d.change(t.value)&&(f.value|=2,(r=b.value)==null||r.focus())}function a(){f.value|=2}function n(){f.value&=-3}return()=>{let{id:r,value:p,disabled:c,...S}=t,H={checked:g.value,disabled:l.value,active:Boolean(f.value&2)},N={id:r,ref:b,role:"radio","aria-checked":g.value?"true":"false","aria-labelledby":s.value,"aria-describedby":i.value,"aria-disabled":l.value?!0:void 0,tabIndex:R.value,onClick:l.value?void 0:e,onFocus:l.value?void 0:a,onBlur:l.value?void 0:n};return I({ourProps:N,theirProps:S,slot:H,attrs:m,slots:o,name:"RadioGroupOption"})}}}),Ee=Q,we=X;export{Oe as RadioGroup,we as RadioGroupDescription,Ee as RadioGroupLabel,ke as RadioGroupOption};
import{Fragment as M,computed as o,defineComponent as A,h as F,inject as _,onMounted as C,onUnmounted as $,provide as U,ref as h,toRaw as y,watch as W}from"vue";import{useControllable as J}from'../../hooks/use-controllable.js';import{useId as D}from'../../hooks/use-id.js';import{useTreeWalker as q}from'../../hooks/use-tree-walker.js';import{Hidden as Q,Features as X}from'../../internal/hidden.js';import{Keys as g}from'../../keyboard.js';import{dom as O}from'../../utils/dom.js';import{Focus as k,FocusResult as x,focusIn as I,sortByDomNode as Y}from'../../utils/focus-management.js';import{attemptSubmit as Z,objectToFormEntries as z}from'../../utils/form.js';import{getOwnerDocument as L}from'../../utils/owner.js';import{compact as ee,omit as te,render as P}from'../../utils/render.js';import{Description as ae,useDescriptions as B}from'../description/description.js';import{Label as ne,useLabels as V}from'../label/label.js';function re(t,c){return t===c}let j=Symbol("RadioGroupContext");function H(t){let c=_(j,null);if(c===null){let u=new Error(`<${t} /> is missing a parent <RadioGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(u,H),u}return c}let ge=A({name:"RadioGroup",emits:{"update:modelValue":t=>!0},props:{as:{type:[Object,String],default:"div"},disabled:{type:[Boolean],default:!1},by:{type:[String,Function],default:()=>re},modelValue:{type:[Object,String,Number,Boolean],default:void 0},defaultValue:{type:[Object,String,Number,Boolean],default:void 0},form:{type:String,optional:!0},name:{type:String,optional:!0},id:{type:String,default:()=>`headlessui-radiogroup-${D()}`}},inheritAttrs:!1,setup(t,{emit:c,attrs:u,slots:E,expose:d}){let s=h(null),i=h([]),R=V({name:"RadioGroupLabel"}),w=B({name:"RadioGroupDescription"});d({el:s,$el:s});let[f,S]=J(o(()=>t.modelValue),e=>c("update:modelValue",e),o(()=>t.defaultValue)),p={options:i,value:f,disabled:o(()=>t.disabled),firstOption:o(()=>i.value.find(e=>!e.propsRef.disabled)),containsCheckedOption:o(()=>i.value.some(e=>p.compare(y(e.propsRef.value),y(t.modelValue)))),compare(e,a){if(typeof t.by=="string"){let n=t.by;return(e==null?void 0:e[n])===(a==null?void 0:a[n])}return t.by(e,a)},change(e){var n;if(t.disabled||p.compare(y(f.value),y(e)))return!1;let a=(n=i.value.find(l=>p.compare(y(l.propsRef.value),y(e))))==null?void 0:n.propsRef;return a!=null&&a.disabled?!1:(S(e),!0)},registerOption(e){i.value.push(e),i.value=Y(i.value,a=>a.element)},unregisterOption(e){let a=i.value.findIndex(n=>n.id===e);a!==-1&&i.value.splice(a,1)}};U(j,p),q({container:o(()=>O(s)),accept(e){return e.getAttribute("role")==="radio"?NodeFilter.FILTER_REJECT:e.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(e){e.setAttribute("role","none")}});function m(e){if(!s.value||!s.value.contains(e.target))return;let a=i.value.filter(n=>n.propsRef.disabled===!1).map(n=>n.element);switch(e.key){case g.Enter:Z(e.currentTarget);break;case g.ArrowLeft:case g.ArrowUp:if(e.preventDefault(),e.stopPropagation(),I(a,k.Previous|k.WrapAround)===x.Success){let l=i.value.find(r=>{var b;return r.element===((b=L(s))==null?void 0:b.activeElement)});l&&p.change(l.propsRef.value)}break;case g.ArrowRight:case g.ArrowDown:if(e.preventDefault(),e.stopPropagation(),I(a,k.Next|k.WrapAround)===x.Success){let l=i.value.find(r=>{var b;return r.element===((b=L(r.element))==null?void 0:b.activeElement)});l&&p.change(l.propsRef.value)}break;case g.Space:{e.preventDefault(),e.stopPropagation();let n=i.value.find(l=>{var r;return l.element===((r=L(l.element))==null?void 0:r.activeElement)});n&&p.change(n.propsRef.value)}break}}let v=o(()=>{var e;return(e=O(s))==null?void 0:e.closest("form")});return C(()=>{W([v],()=>{if(!v.value||t.defaultValue===void 0)return;function e(){p.change(t.defaultValue)}return v.value.addEventListener("reset",e),()=>{var a;(a=v.value)==null||a.removeEventListener("reset",e)}},{immediate:!0})}),()=>{let{disabled:e,name:a,id:n,form:l,...r}=t,b={ref:s,id:n,role:"radiogroup","aria-labelledby":R.value,"aria-describedby":w.value,onKeydown:m};return F(M,[...a!=null&&f.value!=null?z({[a]:f.value}).map(([T,G])=>F(Q,ee({features:X.Hidden,key:T,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:l,disabled:e,name:T,value:G}))):[],P({ourProps:b,theirProps:{...u,...te(r,["modelValue","defaultValue","by"])},slot:{},attrs:u,slots:E,name:"RadioGroup"})])}}});var ie=(u=>(u[u.Empty=1]="Empty",u[u.Active=2]="Active",u))(ie||{});let he=A({name:"RadioGroupOption",props:{as:{type:[Object,String],default:"div"},value:{type:[Object,String,Number,Boolean]},disabled:{type:Boolean,default:!1},id:{type:String,default:()=>`headlessui-radiogroup-option-${D()}`}},setup(t,{attrs:c,slots:u,expose:E}){let d=H("RadioGroupOption"),s=V({name:"RadioGroupLabel"}),i=B({name:"RadioGroupDescription"}),R=h(null),w=o(()=>({value:t.value,disabled:t.disabled})),f=h(1);E({el:R,$el:R});let S=o(()=>O(R));C(()=>d.registerOption({id:t.id,element:S,propsRef:w})),$(()=>d.unregisterOption(t.id));let p=o(()=>{var r;return((r=d.firstOption.value)==null?void 0:r.id)===t.id}),m=o(()=>d.disabled.value||t.disabled),v=o(()=>d.compare(y(d.value.value),y(t.value))),e=o(()=>m.value?-1:v.value||!d.containsCheckedOption.value&&p.value?0:-1);function a(){var r;d.change(t.value)&&(f.value|=2,(r=O(R))==null||r.focus())}function n(){f.value|=2}function l(){f.value&=-3}return()=>{let{id:r,value:b,disabled:T,...G}=t,N={checked:v.value,disabled:m.value,active:!!(f.value&2)},K={id:r,ref:R,role:"radio","aria-checked":v.value?"true":"false","aria-labelledby":s.value,"aria-describedby":i.value,"aria-disabled":m.value?!0:void 0,tabIndex:e.value,onClick:m.value?void 0:a,onFocus:m.value?void 0:n,onBlur:m.value?void 0:l};return P({ourProps:K,theirProps:G,slot:N,attrs:c,slots:u,name:"RadioGroupOption"})}}}),Oe=ne,ke=ae;export{ge as RadioGroup,ke as RadioGroupDescription,Oe as RadioGroupLabel,he as RadioGroupOption};

@@ -31,2 +31,6 @@ export declare let SwitchGroup: import("vue").DefineComponent<{

};
form: {
type: StringConstructor;
optional: boolean;
};
name: {

@@ -44,2 +48,10 @@ type: StringConstructor;

};
disabled: {
type: BooleanConstructor;
default: boolean;
};
tabIndex: {
type: NumberConstructor;
default: number;
};
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {

@@ -62,2 +74,6 @@ [key: string]: any;

};
form: {
type: StringConstructor;
optional: boolean;
};
name: {

@@ -75,7 +91,17 @@ type: StringConstructor;

};
disabled: {
type: BooleanConstructor;
default: boolean;
};
tabIndex: {
type: NumberConstructor;
default: number;
};
}>> & {
"onUpdate:modelValue"?: ((_value: boolean) => any) | undefined;
}, {
id: string;
tabIndex: number;
as: string | Record<string, any>;
id: string;
disabled: boolean;
modelValue: boolean;

@@ -115,5 +141,5 @@ defaultChecked: boolean;

}>>, {
passive: boolean;
id: string;
as: string | Record<string, any>;
id: string;
passive: boolean;
}>;

@@ -143,4 +169,4 @@ export declare let SwitchDescription: import("vue").DefineComponent<{

}>>, {
id: string;
as: string | Record<string, any>;
id: string;
}>;

@@ -1,1 +0,1 @@

import{Fragment as x,computed as d,defineComponent as m,h,inject as T,provide as H,ref as y,watch as M,onMounted as B}from"vue";import{render as b,compact as P,omit as j}from'../../utils/render.js';import{useId as G}from'../../hooks/use-id.js';import{Keys as v}from'../../keyboard.js';import{Label as V,useLabels as F}from'../label/label.js';import{Description as I,useDescriptions as O}from'../description/description.js';import{useResolveButtonType as A}from'../../hooks/use-resolve-button-type.js';import{Hidden as $,Features as N}from'../../internal/hidden.js';import{attemptSubmit as U}from'../../utils/form.js';import{useControllable as _}from'../../hooks/use-controllable.js';import{dom as q}from'../../utils/dom.js';let S=Symbol("GroupContext"),oe=m({name:"SwitchGroup",props:{as:{type:[Object,String],default:"template"}},setup(l,{slots:p,attrs:a}){let i=y(null),s=F({name:"SwitchLabel",props:{htmlFor:d(()=>{var n;return(n=i.value)==null?void 0:n.id}),onClick(n){i.value&&(n.currentTarget.tagName==="LABEL"&&n.preventDefault(),i.value.click(),i.value.focus({preventScroll:!0}))}}}),t=O({name:"SwitchDescription"});return H(S,{switchRef:i,labelledby:s,describedby:t}),()=>b({theirProps:l,ourProps:{},slot:{},slots:p,attrs:a,name:"SwitchGroup"})}}),ae=m({name:"Switch",emits:{"update:modelValue":l=>!0},props:{as:{type:[Object,String],default:"button"},modelValue:{type:Boolean,default:void 0},defaultChecked:{type:Boolean,optional:!0},name:{type:String,optional:!0},value:{type:String,optional:!0},id:{type:String,default:()=>`headlessui-switch-${G()}`}},inheritAttrs:!1,setup(l,{emit:p,attrs:a,slots:i,expose:s}){let t=T(S,null),[o,n]=_(d(()=>l.modelValue),e=>p("update:modelValue",e),d(()=>l.defaultChecked));function f(){n(!o.value)}let w=y(null),u=t===null?w:t.switchRef,k=A(d(()=>({as:l.as,type:a.type})),u);s({el:u,$el:u});function g(e){e.preventDefault(),f()}function C(e){e.key===v.Space?(e.preventDefault(),f()):e.key===v.Enter&&U(e.currentTarget)}function E(e){e.preventDefault()}let c=d(()=>{var e,r;return(r=(e=q(u))==null?void 0:e.closest)==null?void 0:r.call(e,"form")});return B(()=>{M([c],()=>{if(!c.value||l.defaultChecked===void 0)return;function e(){n(l.defaultChecked)}return c.value.addEventListener("reset",e),()=>{var r;(r=c.value)==null||r.removeEventListener("reset",e)}},{immediate:!0})}),()=>{let{id:e,name:r,value:L,...D}=l,R={checked:o.value},K={id:e,ref:u,role:"switch",type:k.value,tabIndex:0,"aria-checked":o.value,"aria-labelledby":t==null?void 0:t.labelledby.value,"aria-describedby":t==null?void 0:t.describedby.value,onClick:g,onKeyup:C,onKeypress:E};return h(x,[r!=null&&o.value!=null?h($,P({features:N.Hidden,as:"input",type:"checkbox",hidden:!0,readOnly:!0,checked:o.value,name:r,value:L})):null,b({ourProps:K,theirProps:{...a,...j(D,["modelValue","defaultChecked"])},slot:R,attrs:a,slots:i,name:"Switch"})])}}}),ue=V,de=I;export{ae as Switch,de as SwitchDescription,oe as SwitchGroup,ue as SwitchLabel};
import{Fragment as B,computed as d,defineComponent as y,h as b,inject as H,onMounted as M,provide as I,ref as v,watch as P}from"vue";import{useControllable as j}from'../../hooks/use-controllable.js';import{useId as G}from'../../hooks/use-id.js';import{useResolveButtonType as V}from'../../hooks/use-resolve-button-type.js';import{Hidden as F,Features as O}from'../../internal/hidden.js';import{Keys as S}from'../../keyboard.js';import{dom as A}from'../../utils/dom.js';import{attemptSubmit as N}from'../../utils/form.js';import{compact as $,omit as U,render as w}from'../../utils/render.js';import{Description as _,useDescriptions as q}from'../description/description.js';import{Label as z,useLabels as J}from'../label/label.js';let g=Symbol("GroupContext"),ie=y({name:"SwitchGroup",props:{as:{type:[Object,String],default:"template"}},setup(l,{slots:p,attrs:o}){let a=v(null),f=J({name:"SwitchLabel",props:{htmlFor:d(()=>{var n;return(n=a.value)==null?void 0:n.id}),onClick(n){a.value&&(n.currentTarget.tagName==="LABEL"&&n.preventDefault(),a.value.click(),a.value.focus({preventScroll:!0}))}}}),t=q({name:"SwitchDescription"});return I(g,{switchRef:a,labelledby:f,describedby:t}),()=>w({theirProps:l,ourProps:{},slot:{},slots:p,attrs:o,name:"SwitchGroup"})}}),oe=y({name:"Switch",emits:{"update:modelValue":l=>!0},props:{as:{type:[Object,String],default:"button"},modelValue:{type:Boolean,default:void 0},defaultChecked:{type:Boolean,optional:!0},form:{type:String,optional:!0},name:{type:String,optional:!0},value:{type:String,optional:!0},id:{type:String,default:()=>`headlessui-switch-${G()}`},disabled:{type:Boolean,default:!1},tabIndex:{type:Number,default:0}},inheritAttrs:!1,setup(l,{emit:p,attrs:o,slots:a,expose:f}){let t=H(g,null),[i,n]=j(d(()=>l.modelValue),e=>p("update:modelValue",e),d(()=>l.defaultChecked));function s(){n(!i.value)}let k=v(null),u=t===null?k:t.switchRef,C=V(d(()=>({as:l.as,type:o.type})),u);f({el:u,$el:u});function E(e){e.preventDefault(),s()}function L(e){e.key===S.Space?(e.preventDefault(),s()):e.key===S.Enter&&N(e.currentTarget)}function D(e){e.preventDefault()}let c=d(()=>{var e,r;return(r=(e=A(u))==null?void 0:e.closest)==null?void 0:r.call(e,"form")});return M(()=>{P([c],()=>{if(!c.value||l.defaultChecked===void 0)return;function e(){n(l.defaultChecked)}return c.value.addEventListener("reset",e),()=>{var r;(r=c.value)==null||r.removeEventListener("reset",e)}},{immediate:!0})}),()=>{let{id:e,name:r,value:R,form:x,tabIndex:m,...h}=l,K={checked:i.value},T={id:e,ref:u,role:"switch",type:C.value,tabIndex:m===-1?0:m,"aria-checked":i.value,"aria-labelledby":t==null?void 0:t.labelledby.value,"aria-describedby":t==null?void 0:t.describedby.value,onClick:E,onKeyup:L,onKeypress:D};return b(B,[r!=null&&i.value!=null?b(F,$({features:O.Hidden,as:"input",type:"checkbox",hidden:!0,readOnly:!0,checked:i.value,form:x,disabled:h.disabled,name:r,value:R})):null,w({ourProps:T,theirProps:{...o,...U(h,["modelValue","defaultChecked"])},slot:K,attrs:o,slots:a,name:"Switch"})])}}}),ue=z,de=_;export{oe as Switch,de as SwitchDescription,ie as SwitchGroup,ue as SwitchLabel};

@@ -104,5 +104,5 @@ export declare let TabGroup: import("vue").DefineComponent<{

}>>, {
id: string;
as: string | Record<string, any>;
disabled: boolean;
id: string;
}>;

@@ -173,7 +173,7 @@ export declare let TabPanels: import("vue").DefineComponent<{

}>>, {
id: string;
tabIndex: number;
as: string | Record<string, any>;
unmount: boolean;
static: boolean;
id: string;
tabIndex: number;
}>;

@@ -1,1 +0,1 @@

import{Fragment as z,computed as c,defineComponent as D,h as H,inject as A,onMounted as M,onUnmounted as K,provide as N,ref as g,watchEffect as _,watch as J}from"vue";import{Features as $,render as O,omit as Q}from'../../utils/render.js';import{useId as q}from'../../hooks/use-id.js';import{Keys as x}from'../../keyboard.js';import{dom as d}from'../../utils/dom.js';import{match as C}from'../../utils/match.js';import{focusIn as P,Focus as I,FocusResult as F,sortByDomNode as L}from'../../utils/focus-management.js';import{useResolveButtonType as V}from'../../hooks/use-resolve-button-type.js';import{FocusSentinel as X}from'../../internal/focus-sentinel.js';import{microTask as Y}from'../../utils/micro-task.js';import{Hidden as Z}from'../../internal/hidden.js';import{getOwnerDocument as ee}from'../../utils/owner.js';var te=(i=>(i[i.Forwards=0]="Forwards",i[i.Backwards=1]="Backwards",i))(te||{}),le=(s=>(s[s.Less=-1]="Less",s[s.Equal=0]="Equal",s[s.Greater=1]="Greater",s))(le||{});let U=Symbol("TabsContext");function k(a){let v=A(U,null);if(v===null){let i=new Error(`<${a} /> is missing a parent <TabGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(i,k),i}return v}let j=Symbol("TabsSSRContext"),xe=D({name:"TabGroup",emits:{change:a=>!0},props:{as:{type:[Object,String],default:"template"},selectedIndex:{type:[Number],default:null},defaultIndex:{type:[Number],default:0},vertical:{type:[Boolean],default:!1},manual:{type:[Boolean],default:!1}},inheritAttrs:!1,setup(a,{slots:v,attrs:i,emit:s}){var h;let l=g((h=a.selectedIndex)!=null?h:a.defaultIndex),n=g([]),o=g([]),T=c(()=>a.selectedIndex!==null),b=c(()=>T.value?a.selectedIndex:l.value);function m(t){var S;let e=L(r.tabs.value,d),u=L(r.panels.value,d),f=e.filter(p=>{var E;return!((E=d(p))!=null&&E.hasAttribute("disabled"))});if(t<0||t>e.length-1){let p=C(l.value===null?0:Math.sign(t-l.value),{[-1]:()=>1,[0]:()=>C(Math.sign(t),{[-1]:()=>0,[0]:()=>0,[1]:()=>1}),[1]:()=>0});l.value=C(p,{[0]:()=>e.indexOf(f[0]),[1]:()=>e.indexOf(f[f.length-1])}),r.tabs.value=e,r.panels.value=u}else{let p=e.slice(0,t),G=[...e.slice(t),...p].find(W=>f.includes(W));if(!G)return;let B=(S=e.indexOf(G))!=null?S:r.selectedIndex.value;B===-1&&(B=r.selectedIndex.value),l.value=B,r.tabs.value=e,r.panels.value=u}}let r={selectedIndex:c(()=>{var t,e;return(e=(t=l.value)!=null?t:a.defaultIndex)!=null?e:null}),orientation:c(()=>a.vertical?"vertical":"horizontal"),activation:c(()=>a.manual?"manual":"auto"),tabs:n,panels:o,setSelectedIndex(t){b.value!==t&&s("change",t),T.value||m(t)},registerTab(t){var f;if(n.value.includes(t))return;let e=n.value[l.value];n.value.push(t),n.value=L(n.value,d);let u=(f=n.value.indexOf(e))!=null?f:l.value;u!==-1&&(l.value=u)},unregisterTab(t){let e=n.value.indexOf(t);e!==-1&&n.value.splice(e,1)},registerPanel(t){o.value.includes(t)||(o.value.push(t),o.value=L(o.value,d))},unregisterPanel(t){let e=o.value.indexOf(t);e!==-1&&o.value.splice(e,1)}};N(U,r);let R=g({tabs:[],panels:[]}),y=g(!1);M(()=>{y.value=!0}),N(j,c(()=>y.value?null:R.value));let w=c(()=>a.selectedIndex);return M(()=>{J([w],()=>{var t;return m((t=a.selectedIndex)!=null?t:a.defaultIndex)},{immediate:!0})}),_(()=>{if(!T.value||b.value==null||r.tabs.value.length<=0)return;let t=L(r.tabs.value,d);t.some((u,f)=>d(r.tabs.value[f])!==d(u))&&r.setSelectedIndex(t.findIndex(u=>d(u)===d(r.tabs.value[b.value])))}),()=>{let t={selectedIndex:l.value};return H(z,[n.value.length<=0&&H(X,{onFocus:()=>{for(let e of n.value){let u=d(e);if((u==null?void 0:u.tabIndex)===0)return u.focus(),!0}return!1}}),O({theirProps:{...i,...Q(a,["selectedIndex","defaultIndex","manual","vertical","onChange"])},ourProps:{},slot:t,slots:v,attrs:i,name:"TabGroup"})])}}}),Ie=D({name:"TabList",props:{as:{type:[Object,String],default:"div"}},setup(a,{attrs:v,slots:i}){let s=k("TabList");return()=>{let l={selectedIndex:s.selectedIndex.value},n={role:"tablist","aria-orientation":s.orientation.value};return O({ourProps:n,theirProps:a,slot:l,attrs:v,slots:i,name:"TabList"})}}}),ye=D({name:"Tab",props:{as:{type:[Object,String],default:"button"},disabled:{type:[Boolean],default:!1},id:{type:String,default:()=>`headlessui-tabs-tab-${q()}`}},setup(a,{attrs:v,slots:i,expose:s}){let l=k("Tab"),n=g(null);s({el:n,$el:n}),M(()=>l.registerTab(n)),K(()=>l.unregisterTab(n));let o=A(j),T=c(()=>{if(o.value){let e=o.value.tabs.indexOf(a.id);return e===-1?o.value.tabs.push(a.id)-1:e}return-1}),b=c(()=>{let e=l.tabs.value.indexOf(n);return e===-1?T.value:e}),m=c(()=>b.value===l.selectedIndex.value);function r(e){var f;let u=e();if(u===F.Success&&l.activation.value==="auto"){let S=(f=ee(n))==null?void 0:f.activeElement,p=l.tabs.value.findIndex(E=>d(E)===S);p!==-1&&l.setSelectedIndex(p)}return u}function R(e){let u=l.tabs.value.map(S=>d(S)).filter(Boolean);if(e.key===x.Space||e.key===x.Enter){e.preventDefault(),e.stopPropagation(),l.setSelectedIndex(b.value);return}switch(e.key){case x.Home:case x.PageUp:return e.preventDefault(),e.stopPropagation(),r(()=>P(u,I.First));case x.End:case x.PageDown:return e.preventDefault(),e.stopPropagation(),r(()=>P(u,I.Last))}if(r(()=>C(l.orientation.value,{vertical(){return e.key===x.ArrowUp?P(u,I.Previous|I.WrapAround):e.key===x.ArrowDown?P(u,I.Next|I.WrapAround):F.Error},horizontal(){return e.key===x.ArrowLeft?P(u,I.Previous|I.WrapAround):e.key===x.ArrowRight?P(u,I.Next|I.WrapAround):F.Error}}))===F.Success)return e.preventDefault()}let y=g(!1);function w(){var e;y.value||(y.value=!0,!a.disabled&&((e=d(n))==null||e.focus(),l.setSelectedIndex(b.value),Y(()=>{y.value=!1})))}function h(e){e.preventDefault()}let t=V(c(()=>({as:a.as,type:v.type})),n);return()=>{var p;let e={selected:m.value},{id:u,...f}=a,S={ref:n,onKeydown:R,onMousedown:h,onClick:w,id:u,role:"tab",type:t.value,"aria-controls":(p=d(l.panels.value[b.value]))==null?void 0:p.id,"aria-selected":m.value,tabIndex:m.value?0:-1,disabled:a.disabled?!0:void 0};return O({ourProps:S,theirProps:f,slot:e,attrs:v,slots:i,name:"Tab"})}}}),Se=D({name:"TabPanels",props:{as:{type:[Object,String],default:"div"}},setup(a,{slots:v,attrs:i}){let s=k("TabPanels");return()=>{let l={selectedIndex:s.selectedIndex.value};return O({theirProps:a,ourProps:{},slot:l,attrs:i,slots:v,name:"TabPanels"})}}}),ge=D({name:"TabPanel",props:{as:{type:[Object,String],default:"div"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0},id:{type:String,default:()=>`headlessui-tabs-panel-${q()}`},tabIndex:{type:Number,default:0}},setup(a,{attrs:v,slots:i,expose:s}){let l=k("TabPanel"),n=g(null);s({el:n,$el:n}),M(()=>l.registerPanel(n)),K(()=>l.unregisterPanel(n));let o=A(j),T=c(()=>{if(o.value){let r=o.value.panels.indexOf(a.id);return r===-1?o.value.panels.push(a.id)-1:r}return-1}),b=c(()=>{let r=l.panels.value.indexOf(n);return r===-1?T.value:r}),m=c(()=>b.value===l.selectedIndex.value);return()=>{var t;let r={selected:m.value},{id:R,tabIndex:y,...w}=a,h={ref:n,id:R,role:"tabpanel","aria-labelledby":(t=d(l.tabs.value[b.value]))==null?void 0:t.id,tabIndex:m.value?y:-1};return!m.value&&a.unmount&&!a.static?H(Z,{as:"span",...h}):O({ourProps:h,theirProps:w,slot:r,attrs:v,slots:i,features:$.Static|$.RenderStrategy,visible:m.value,name:"TabPanel"})}}});export{ye as Tab,xe as TabGroup,Ie as TabList,ge as TabPanel,Se as TabPanels};
import{Fragment as z,computed as c,defineComponent as D,h as H,inject as A,onMounted as M,onUnmounted as K,provide as N,ref as h,watch as _,watchEffect as J}from"vue";import{useId as $}from'../../hooks/use-id.js';import{useResolveButtonType as Q}from'../../hooks/use-resolve-button-type.js';import{FocusSentinel as V}from'../../internal/focus-sentinel.js';import{Hidden as X}from'../../internal/hidden.js';import{Keys as I}from'../../keyboard.js';import{dom as o}from'../../utils/dom.js';import{Focus as y,FocusResult as C,focusIn as R,sortByDomNode as O}from'../../utils/focus-management.js';import{match as F}from'../../utils/match.js';import{microTask as Y}from'../../utils/micro-task.js';import{getOwnerDocument as Z}from'../../utils/owner.js';import{Features as q,omit as ee,render as L}from'../../utils/render.js';var te=(i=>(i[i.Forwards=0]="Forwards",i[i.Backwards=1]="Backwards",i))(te||{}),le=(s=>(s[s.Less=-1]="Less",s[s.Equal=0]="Equal",s[s.Greater=1]="Greater",s))(le||{});let U=Symbol("TabsContext");function k(a){let v=A(U,null);if(v===null){let i=new Error(`<${a} /> is missing a parent <TabGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(i,k),i}return v}let j=Symbol("TabsSSRContext"),me=D({name:"TabGroup",emits:{change:a=>!0},props:{as:{type:[Object,String],default:"template"},selectedIndex:{type:[Number],default:null},defaultIndex:{type:[Number],default:0},vertical:{type:[Boolean],default:!1},manual:{type:[Boolean],default:!1}},inheritAttrs:!1,setup(a,{slots:v,attrs:i,emit:s}){var P;let l=h((P=a.selectedIndex)!=null?P:a.defaultIndex),n=h([]),d=h([]),S=c(()=>a.selectedIndex!==null),b=c(()=>S.value?a.selectedIndex:l.value);function m(t){var T;let e=O(r.tabs.value,o),u=O(r.panels.value,o),f=e.filter(p=>{var x;return!((x=o(p))!=null&&x.hasAttribute("disabled"))});if(t<0||t>e.length-1){let p=F(l.value===null?0:Math.sign(t-l.value),{[-1]:()=>1,[0]:()=>F(Math.sign(t),{[-1]:()=>0,[0]:()=>0,[1]:()=>1}),[1]:()=>0}),x=F(p,{[0]:()=>e.indexOf(f[0]),[1]:()=>e.indexOf(f[f.length-1])});x!==-1&&(l.value=x),r.tabs.value=e,r.panels.value=u}else{let p=e.slice(0,t),G=[...e.slice(t),...p].find(W=>f.includes(W));if(!G)return;let B=(T=e.indexOf(G))!=null?T:r.selectedIndex.value;B===-1&&(B=r.selectedIndex.value),l.value=B,r.tabs.value=e,r.panels.value=u}}let r={selectedIndex:c(()=>{var t,e;return(e=(t=l.value)!=null?t:a.defaultIndex)!=null?e:null}),orientation:c(()=>a.vertical?"vertical":"horizontal"),activation:c(()=>a.manual?"manual":"auto"),tabs:n,panels:d,setSelectedIndex(t){b.value!==t&&s("change",t),S.value||m(t)},registerTab(t){var u;if(n.value.includes(t))return;let e=n.value[l.value];if(n.value.push(t),n.value=O(n.value,o),!S.value){let f=(u=n.value.indexOf(e))!=null?u:l.value;f!==-1&&(l.value=f)}},unregisterTab(t){let e=n.value.indexOf(t);e!==-1&&n.value.splice(e,1)},registerPanel(t){d.value.includes(t)||(d.value.push(t),d.value=O(d.value,o))},unregisterPanel(t){let e=d.value.indexOf(t);e!==-1&&d.value.splice(e,1)}};N(U,r);let w=h({tabs:[],panels:[]}),g=h(!1);M(()=>{g.value=!0}),N(j,c(()=>g.value?null:w.value));let E=c(()=>a.selectedIndex);return M(()=>{_([E],()=>{var t;return m((t=a.selectedIndex)!=null?t:a.defaultIndex)},{immediate:!0})}),J(()=>{if(!S.value||b.value==null||r.tabs.value.length<=0)return;let t=O(r.tabs.value,o);t.some((u,f)=>o(r.tabs.value[f])!==o(u))&&r.setSelectedIndex(t.findIndex(u=>o(u)===o(r.tabs.value[b.value])))}),()=>{let t={selectedIndex:l.value};return H(z,[n.value.length<=0&&H(V,{onFocus:()=>{for(let e of n.value){let u=o(e);if((u==null?void 0:u.tabIndex)===0)return u.focus(),!0}return!1}}),L({theirProps:{...i,...ee(a,["selectedIndex","defaultIndex","manual","vertical","onChange"])},ourProps:{},slot:t,slots:v,attrs:i,name:"TabGroup"})])}}}),pe=D({name:"TabList",props:{as:{type:[Object,String],default:"div"}},setup(a,{attrs:v,slots:i}){let s=k("TabList");return()=>{let l={selectedIndex:s.selectedIndex.value},n={role:"tablist","aria-orientation":s.orientation.value};return L({ourProps:n,theirProps:a,slot:l,attrs:v,slots:i,name:"TabList"})}}}),xe=D({name:"Tab",props:{as:{type:[Object,String],default:"button"},disabled:{type:[Boolean],default:!1},id:{type:String,default:()=>`headlessui-tabs-tab-${$()}`}},setup(a,{attrs:v,slots:i,expose:s}){let l=k("Tab"),n=h(null);s({el:n,$el:n}),M(()=>l.registerTab(n)),K(()=>l.unregisterTab(n));let d=A(j),S=c(()=>{if(d.value){let e=d.value.tabs.indexOf(a.id);return e===-1?d.value.tabs.push(a.id)-1:e}return-1}),b=c(()=>{let e=l.tabs.value.indexOf(n);return e===-1?S.value:e}),m=c(()=>b.value===l.selectedIndex.value);function r(e){var f;let u=e();if(u===C.Success&&l.activation.value==="auto"){let T=(f=Z(n))==null?void 0:f.activeElement,p=l.tabs.value.findIndex(x=>o(x)===T);p!==-1&&l.setSelectedIndex(p)}return u}function w(e){let u=l.tabs.value.map(T=>o(T)).filter(Boolean);if(e.key===I.Space||e.key===I.Enter){e.preventDefault(),e.stopPropagation(),l.setSelectedIndex(b.value);return}switch(e.key){case I.Home:case I.PageUp:return e.preventDefault(),e.stopPropagation(),r(()=>R(u,y.First));case I.End:case I.PageDown:return e.preventDefault(),e.stopPropagation(),r(()=>R(u,y.Last))}if(r(()=>F(l.orientation.value,{vertical(){return e.key===I.ArrowUp?R(u,y.Previous|y.WrapAround):e.key===I.ArrowDown?R(u,y.Next|y.WrapAround):C.Error},horizontal(){return e.key===I.ArrowLeft?R(u,y.Previous|y.WrapAround):e.key===I.ArrowRight?R(u,y.Next|y.WrapAround):C.Error}}))===C.Success)return e.preventDefault()}let g=h(!1);function E(){var e;g.value||(g.value=!0,!a.disabled&&((e=o(n))==null||e.focus({preventScroll:!0}),l.setSelectedIndex(b.value),Y(()=>{g.value=!1})))}function P(e){e.preventDefault()}let t=Q(c(()=>({as:a.as,type:v.type})),n);return()=>{var p,x;let e={selected:m.value,disabled:(p=a.disabled)!=null?p:!1},{id:u,...f}=a,T={ref:n,onKeydown:w,onMousedown:P,onClick:E,id:u,role:"tab",type:t.value,"aria-controls":(x=o(l.panels.value[b.value]))==null?void 0:x.id,"aria-selected":m.value,tabIndex:m.value?0:-1,disabled:a.disabled?!0:void 0};return L({ourProps:T,theirProps:f,slot:e,attrs:v,slots:i,name:"Tab"})}}}),Ie=D({name:"TabPanels",props:{as:{type:[Object,String],default:"div"}},setup(a,{slots:v,attrs:i}){let s=k("TabPanels");return()=>{let l={selectedIndex:s.selectedIndex.value};return L({theirProps:a,ourProps:{},slot:l,attrs:i,slots:v,name:"TabPanels"})}}}),ye=D({name:"TabPanel",props:{as:{type:[Object,String],default:"div"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0},id:{type:String,default:()=>`headlessui-tabs-panel-${$()}`},tabIndex:{type:Number,default:0}},setup(a,{attrs:v,slots:i,expose:s}){let l=k("TabPanel"),n=h(null);s({el:n,$el:n}),M(()=>l.registerPanel(n)),K(()=>l.unregisterPanel(n));let d=A(j),S=c(()=>{if(d.value){let r=d.value.panels.indexOf(a.id);return r===-1?d.value.panels.push(a.id)-1:r}return-1}),b=c(()=>{let r=l.panels.value.indexOf(n);return r===-1?S.value:r}),m=c(()=>b.value===l.selectedIndex.value);return()=>{var t;let r={selected:m.value},{id:w,tabIndex:g,...E}=a,P={ref:n,id:w,role:"tabpanel","aria-labelledby":(t=o(l.tabs.value[b.value]))==null?void 0:t.id,tabIndex:m.value?g:-1};return!m.value&&a.unmount&&!a.static?H(X,{as:"span","aria-hidden":!0,...P}):L({ourProps:P,theirProps:E,slot:r,attrs:v,slots:i,features:q.Static|q.RenderStrategy,visible:m.value,name:"TabPanel"})}}});export{xe as Tab,me as TabGroup,pe as TabList,ye as TabPanel,Ie as TabPanels};

@@ -1,1 +0,1 @@

import{computed as V,defineComponent as U,h as K,inject as H,onMounted as C,onUnmounted as k,provide as F,ref as p,watch as ae,watchEffect as w,normalizeClass as ie}from"vue";import{useId as le}from'../../hooks/use-id.js';import{match as B}from'../../utils/match.js';import{env as se}from'../../utils/env.js';import{Features as oe,omit as ue,render as z,RenderStrategy as m}from'../../utils/render.js';import{Reason as $,transition as q}from'./utils/transition.js';import{dom as G}from'../../utils/dom.js';import{useOpenClosedProvider as fe,State as u,useOpenClosed as de,hasOpenClosed as ve}from'../../internal/open-closed.js';function T(e=""){return e.split(" ").filter(t=>t.trim().length>1)}let O=Symbol("TransitionContext");var pe=(i=>(i.Visible="visible",i.Hidden="hidden",i))(pe||{});function me(){return H(O,null)!==null}function Te(){let e=H(O,null);if(e===null)throw new Error("A <TransitionChild /> is used but it is missing a parent <TransitionRoot />.");return e}function ge(){let e=H(R,null);if(e===null)throw new Error("A <TransitionChild /> is used but it is missing a parent <TransitionRoot />.");return e}let R=Symbol("NestingContext");function x(e){return"children"in e?x(e.children):e.value.filter(({state:t})=>t==="visible").length>0}function J(e){let t=p([]),i=p(!1);C(()=>i.value=!0),k(()=>i.value=!1);function s(n,r=m.Hidden){let l=t.value.findIndex(({id:f})=>f===n);l!==-1&&(B(r,{[m.Unmount](){t.value.splice(l,1)},[m.Hidden](){t.value[l].state="hidden"}}),!x(t)&&i.value&&(e==null||e()))}function g(n){let r=t.value.find(({id:l})=>l===n);return r?r.state!=="visible"&&(r.state="visible"):t.value.push({id:n,state:"visible"}),()=>s(n,m.Unmount)}return{children:t,register:g,unregister:s}}let Q=oe.RenderStrategy,he=U({props:{as:{type:[Object,String],default:"div"},show:{type:[Boolean],default:null},unmount:{type:[Boolean],default:!0},appear:{type:[Boolean],default:!1},enter:{type:[String],default:""},enterFrom:{type:[String],default:""},enterTo:{type:[String],default:""},entered:{type:[String],default:""},leave:{type:[String],default:""},leaveFrom:{type:[String],default:""},leaveTo:{type:[String],default:""}},emits:{beforeEnter:()=>!0,afterEnter:()=>!0,beforeLeave:()=>!0,afterLeave:()=>!0},setup(e,{emit:t,attrs:i,slots:s,expose:g}){let n=p(0);function r(){n.value|=u.Opening,t("beforeEnter")}function l(){n.value&=~u.Opening,t("afterEnter")}function f(){n.value|=u.Closing,t("beforeLeave")}function S(){n.value&=~u.Closing,t("afterLeave")}if(!me()&&ve())return()=>K(Se,{...e,onBeforeEnter:r,onAfterEnter:l,onBeforeLeave:f,onAfterLeave:S},s);let d=p(null),a=p("visible"),W=V(()=>e.unmount?m.Unmount:m.Hidden);g({el:d,$el:d});let{show:h,appear:N}=Te(),{register:A,unregister:L}=ge(),D={value:!0},c=le(),b={value:!1},I=J(()=>{!b.value&&a.value!=="hidden"&&(a.value="hidden",L(c),S())});C(()=>{let o=A(c);k(o)}),w(()=>{if(W.value===m.Hidden&&c){if(h&&a.value!=="visible"){a.value="visible";return}B(a.value,{["hidden"]:()=>L(c),["visible"]:()=>A(c)})}});let P=T(e.enter),j=T(e.enterFrom),X=T(e.enterTo),M=T(e.entered),Y=T(e.leave),Z=T(e.leaveFrom),ee=T(e.leaveTo);C(()=>{w(()=>{if(a.value==="visible"){let o=G(d);if(o instanceof Comment&&o.data==="")throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")}})});function te(o){let y=D.value&&!N.value,v=G(d);!v||!(v instanceof HTMLElement)||y||(b.value=!0,h.value&&r(),h.value||f(),o(h.value?q(v,P,j,X,M,E=>{b.value=!1,E===$.Finished&&l()}):q(v,Y,Z,ee,M,E=>{b.value=!1,E===$.Finished&&(x(I)||(a.value="hidden",L(c),S()))})))}return C(()=>{ae([h],(o,y,v)=>{te(v),D.value=!1},{immediate:!0})}),F(R,I),fe(V(()=>B(a.value,{["visible"]:u.Open,["hidden"]:u.Closed})|n.value)),()=>{let{appear:o,show:y,enter:v,enterFrom:E,enterTo:Ce,entered:be,leave:ye,leaveFrom:Ee,leaveTo:Ve,..._}=e,ne={ref:d},re={..._,...N&&h&&se.isServer?{class:ie([i.class,_.class,...P,...j])}:{}};return z({theirProps:re,ourProps:ne,slot:{},slots:s,attrs:i,features:Q,visible:a.value==="visible",name:"TransitionChild"})}}}),ce=he,Se=U({inheritAttrs:!1,props:{as:{type:[Object,String],default:"div"},show:{type:[Boolean],default:null},unmount:{type:[Boolean],default:!0},appear:{type:[Boolean],default:!1},enter:{type:[String],default:""},enterFrom:{type:[String],default:""},enterTo:{type:[String],default:""},entered:{type:[String],default:""},leave:{type:[String],default:""},leaveFrom:{type:[String],default:""},leaveTo:{type:[String],default:""}},emits:{beforeEnter:()=>!0,afterEnter:()=>!0,beforeLeave:()=>!0,afterLeave:()=>!0},setup(e,{emit:t,attrs:i,slots:s}){let g=de(),n=V(()=>e.show===null&&g!==null?(g.value&u.Open)===u.Open:e.show);w(()=>{if(![!0,!1].includes(n.value))throw new Error('A <Transition /> is used but it is missing a `:show="true | false"` prop.')});let r=p(n.value?"visible":"hidden"),l=J(()=>{r.value="hidden"}),f=p(!0),S={show:n,appear:V(()=>e.appear||!f.value)};return C(()=>{w(()=>{f.value=!1,n.value?r.value="visible":x(l)||(r.value="hidden")})}),F(R,l),F(O,S),()=>{let d=ue(e,["show","appear","unmount","onBeforeEnter","onBeforeLeave","onAfterEnter","onAfterLeave"]),a={unmount:e.unmount};return z({ourProps:{...a,as:"template"},theirProps:{},slot:{},slots:{...s,default:()=>[K(ce,{onBeforeEnter:()=>t("beforeEnter"),onAfterEnter:()=>t("afterEnter"),onBeforeLeave:()=>t("beforeLeave"),onAfterLeave:()=>t("afterLeave"),...i,...a,...d},s.default)]},attrs:{},features:Q,visible:r.value==="visible",name:"Transition"})}}});export{he as TransitionChild,Se as TransitionRoot};
import{computed as w,defineComponent as K,h as k,inject as F,normalizeClass as ae,onMounted as C,onUnmounted as z,provide as B,ref as m,watch as le,watchEffect as x}from"vue";import{useId as ie}from'../../hooks/use-id.js';import{State as u,hasOpenClosed as se,useOpenClosed as oe,useOpenClosedProvider as ue}from'../../internal/open-closed.js';import{dom as $}from'../../utils/dom.js';import{env as fe}from'../../utils/env.js';import{match as O}from'../../utils/match.js';import{Features as de,RenderStrategy as T,omit as ve,render as q}from'../../utils/render.js';import{Reason as G,transition as J}from'./utils/transition.js';function g(e=""){return e.split(/\s+/).filter(t=>t.length>1)}let R=Symbol("TransitionContext");var pe=(a=>(a.Visible="visible",a.Hidden="hidden",a))(pe||{});function me(){return F(R,null)!==null}function Te(){let e=F(R,null);if(e===null)throw new Error("A <TransitionChild /> is used but it is missing a parent <TransitionRoot />.");return e}function ge(){let e=F(N,null);if(e===null)throw new Error("A <TransitionChild /> is used but it is missing a parent <TransitionRoot />.");return e}let N=Symbol("NestingContext");function L(e){return"children"in e?L(e.children):e.value.filter(({state:t})=>t==="visible").length>0}function Q(e){let t=m([]),a=m(!1);C(()=>a.value=!0),z(()=>a.value=!1);function s(n,r=T.Hidden){let l=t.value.findIndex(({id:f})=>f===n);l!==-1&&(O(r,{[T.Unmount](){t.value.splice(l,1)},[T.Hidden](){t.value[l].state="hidden"}}),!L(t)&&a.value&&(e==null||e()))}function h(n){let r=t.value.find(({id:l})=>l===n);return r?r.state!=="visible"&&(r.state="visible"):t.value.push({id:n,state:"visible"}),()=>s(n,T.Unmount)}return{children:t,register:h,unregister:s}}let W=de.RenderStrategy,he=K({props:{as:{type:[Object,String],default:"div"},show:{type:[Boolean],default:null},unmount:{type:[Boolean],default:!0},appear:{type:[Boolean],default:!1},enter:{type:[String],default:""},enterFrom:{type:[String],default:""},enterTo:{type:[String],default:""},entered:{type:[String],default:""},leave:{type:[String],default:""},leaveFrom:{type:[String],default:""},leaveTo:{type:[String],default:""}},emits:{beforeEnter:()=>!0,afterEnter:()=>!0,beforeLeave:()=>!0,afterLeave:()=>!0},setup(e,{emit:t,attrs:a,slots:s,expose:h}){let n=m(0);function r(){n.value|=u.Opening,t("beforeEnter")}function l(){n.value&=~u.Opening,t("afterEnter")}function f(){n.value|=u.Closing,t("beforeLeave")}function S(){n.value&=~u.Closing,t("afterLeave")}if(!me()&&se())return()=>k(Se,{...e,onBeforeEnter:r,onAfterEnter:l,onBeforeLeave:f,onAfterLeave:S},s);let d=m(null),y=w(()=>e.unmount?T.Unmount:T.Hidden);h({el:d,$el:d});let{show:v,appear:A}=Te(),{register:D,unregister:H}=ge(),i=m(v.value?"visible":"hidden"),I={value:!0},c=ie(),b={value:!1},P=Q(()=>{!b.value&&i.value!=="hidden"&&(i.value="hidden",H(c),S())});C(()=>{let o=D(c);z(o)}),x(()=>{if(y.value===T.Hidden&&c){if(v.value&&i.value!=="visible"){i.value="visible";return}O(i.value,{["hidden"]:()=>H(c),["visible"]:()=>D(c)})}});let j=g(e.enter),M=g(e.enterFrom),X=g(e.enterTo),_=g(e.entered),Y=g(e.leave),Z=g(e.leaveFrom),ee=g(e.leaveTo);C(()=>{x(()=>{if(i.value==="visible"){let o=$(d);if(o instanceof Comment&&o.data==="")throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")}})});function te(o){let E=I.value&&!A.value,p=$(d);!p||!(p instanceof HTMLElement)||E||(b.value=!0,v.value&&r(),v.value||f(),o(v.value?J(p,j,M,X,_,V=>{b.value=!1,V===G.Finished&&l()}):J(p,Y,Z,ee,_,V=>{b.value=!1,V===G.Finished&&(L(P)||(i.value="hidden",H(c),S()))})))}return C(()=>{le([v],(o,E,p)=>{te(p),I.value=!1},{immediate:!0})}),B(N,P),ue(w(()=>O(i.value,{["visible"]:u.Open,["hidden"]:u.Closed})|n.value)),()=>{let{appear:o,show:E,enter:p,enterFrom:V,enterTo:Ce,entered:ye,leave:be,leaveFrom:Ee,leaveTo:Ve,...U}=e,ne={ref:d},re={...U,...A.value&&v.value&&fe.isServer?{class:ae([a.class,U.class,...j,...M])}:{}};return q({theirProps:re,ourProps:ne,slot:{},slots:s,attrs:a,features:W,visible:i.value==="visible",name:"TransitionChild"})}}}),ce=he,Se=K({inheritAttrs:!1,props:{as:{type:[Object,String],default:"div"},show:{type:[Boolean],default:null},unmount:{type:[Boolean],default:!0},appear:{type:[Boolean],default:!1},enter:{type:[String],default:""},enterFrom:{type:[String],default:""},enterTo:{type:[String],default:""},entered:{type:[String],default:""},leave:{type:[String],default:""},leaveFrom:{type:[String],default:""},leaveTo:{type:[String],default:""}},emits:{beforeEnter:()=>!0,afterEnter:()=>!0,beforeLeave:()=>!0,afterLeave:()=>!0},setup(e,{emit:t,attrs:a,slots:s}){let h=oe(),n=w(()=>e.show===null&&h!==null?(h.value&u.Open)===u.Open:e.show);x(()=>{if(![!0,!1].includes(n.value))throw new Error('A <Transition /> is used but it is missing a `:show="true | false"` prop.')});let r=m(n.value?"visible":"hidden"),l=Q(()=>{r.value="hidden"}),f=m(!0),S={show:n,appear:w(()=>e.appear||!f.value)};return C(()=>{x(()=>{f.value=!1,n.value?r.value="visible":L(l)||(r.value="hidden")})}),B(N,l),B(R,S),()=>{let d=ve(e,["show","appear","unmount","onBeforeEnter","onBeforeLeave","onAfterEnter","onAfterLeave"]),y={unmount:e.unmount};return q({ourProps:{...y,as:"template"},theirProps:{},slot:{},slots:{...s,default:()=>[k(ce,{onBeforeEnter:()=>t("beforeEnter"),onAfterEnter:()=>t("afterEnter"),onBeforeLeave:()=>t("beforeLeave"),onAfterLeave:()=>t("afterLeave"),...a,...y,...d},s.default)]},attrs:{},features:W,visible:r.value==="visible",name:"Transition"})}}});export{he as TransitionChild,Se as TransitionRoot};

@@ -1,1 +0,1 @@

import{once as f}from'../../../utils/once.js';import{disposables as p}from'../../../utils/disposables.js';function m(e,...t){e&&t.length>0&&e.classList.add(...t)}function d(e,...t){e&&t.length>0&&e.classList.remove(...t)}var g=(i=>(i.Finished="finished",i.Cancelled="cancelled",i))(g||{});function F(e,t){let i=p();if(!e)return i.dispose;let{transitionDuration:n,transitionDelay:a}=getComputedStyle(e),[l,s]=[n,a].map(o=>{let[u=0]=o.split(",").filter(Boolean).map(r=>r.includes("ms")?parseFloat(r):parseFloat(r)*1e3).sort((r,c)=>c-r);return u});return l!==0?i.setTimeout(()=>t("finished"),l+s):t("finished"),i.add(()=>t("cancelled")),i.dispose}function L(e,t,i,n,a,l){let s=p(),o=l!==void 0?f(l):()=>{};return d(e,...a),m(e,...t,...i),s.nextFrame(()=>{d(e,...i),m(e,...n),s.add(F(e,u=>(d(e,...n,...t),m(e,...a),o(u))))}),s.add(()=>d(e,...t,...i,...n,...a)),s.add(()=>o("cancelled")),s.dispose}export{g as Reason,L as transition};
import{disposables as p}from'../../../utils/disposables.js';import{once as f}from'../../../utils/once.js';function m(e,...t){e&&t.length>0&&e.classList.add(...t)}function d(e,...t){e&&t.length>0&&e.classList.remove(...t)}var g=(i=>(i.Finished="finished",i.Cancelled="cancelled",i))(g||{});function F(e,t){let i=p();if(!e)return i.dispose;let{transitionDuration:n,transitionDelay:a}=getComputedStyle(e),[l,s]=[n,a].map(o=>{let[u=0]=o.split(",").filter(Boolean).map(r=>r.includes("ms")?parseFloat(r):parseFloat(r)*1e3).sort((r,c)=>c-r);return u});return l!==0?i.setTimeout(()=>t("finished"),l+s):t("finished"),i.add(()=>t("cancelled")),i.dispose}function L(e,t,i,n,a,l){let s=p(),o=l!==void 0?f(l):()=>{};return d(e,...a),m(e,...t,...i),s.nextFrame(()=>{d(e,...i),m(e,...n),s.add(F(e,u=>(d(e,...n,...t),m(e,...a),o(u))))}),s.add(()=>d(e,...t,...i,...n,...a)),s.add(()=>o("cancelled")),s.dispose}export{g as Reason,L as transition};

@@ -1,1 +0,1 @@

export*from'./components/combobox/combobox.js';export*from'./components/dialog/dialog.js';export*from'./components/disclosure/disclosure.js';export*from'./components/focus-trap/focus-trap.js';export*from'./components/listbox/listbox.js';export*from'./components/menu/menu.js';export*from'./components/popover/popover.js';export*from'./components/portal/portal.js';export*from'./components/radio-group/radio-group.js';export*from'./components/switch/switch.js';export*from'./components/tabs/tabs.js';export*from'./components/transitions/transition.js';
export*from'./components/combobox/combobox.js';export*from'./components/dialog/dialog.js';export*from'./components/disclosure/disclosure.js';export*from'./components/focus-trap/focus-trap.js';export*from'./components/listbox/listbox.js';export*from'./components/menu/menu.js';export*from'./components/popover/popover.js';import{Portal as l,PortalGroup as P}from'./components/portal/portal.js';export*from'./components/radio-group/radio-group.js';export*from'./components/switch/switch.js';export*from'./components/tabs/tabs.js';export*from'./components/transitions/transition.js';export{l as Portal,P as PortalGroup};

@@ -1,2 +0,2 @@

import { ScrollLockStep } from './overflow-store.js';
import type { ScrollLockStep } from './overflow-store.js';
export declare function adjustScrollbarPadding(): ScrollLockStep;

@@ -1,1 +0,1 @@

function c(){let o;return{before({doc:e}){var l;let n=e.documentElement;o=((l=e.defaultView)!=null?l:window).innerWidth-n.clientWidth},after({doc:e,d:n}){let t=e.documentElement,l=t.clientWidth-t.offsetWidth,r=o-l;n.style(t,"paddingRight",`${r}px`)}}}export{c as adjustScrollbarPadding};
function d(){let r;return{before({doc:e}){var l;let o=e.documentElement,t=(l=e.defaultView)!=null?l:window;r=Math.max(0,t.innerWidth-o.clientWidth)},after({doc:e,d:o}){let t=e.documentElement,l=Math.max(0,t.clientWidth-t.offsetWidth),n=Math.max(0,r-l);o.style(t,"paddingRight",`${n}px`)}}}export{d as adjustScrollbarPadding};

@@ -1,2 +0,2 @@

import { ScrollLockStep } from './overflow-store.js';
import type { ScrollLockStep } from './overflow-store.js';
interface ContainerMetadata {

@@ -3,0 +3,0 @@ containers: (() => HTMLElement[])[];

@@ -1,1 +0,1 @@

import{isIOS as f}from'../../utils/platform.js';function p(){if(!f())return{};let o;return{before(){o=window.pageYOffset},after({doc:r,d:l,meta:s}){function i(e){return s.containers.flatMap(t=>t()).some(t=>t.contains(e))}l.style(r.body,"marginTop",`-${o}px`),window.scrollTo(0,0);let n=null;l.addEventListener(r,"click",e=>{if(e.target instanceof HTMLElement)try{let t=e.target.closest("a");if(!t)return;let{hash:c}=new URL(t.href),a=r.querySelector(c);a&&!i(a)&&(n=a)}catch{}},!0),l.addEventListener(r,"touchmove",e=>{e.target instanceof HTMLElement&&!i(e.target)&&e.preventDefault()},{passive:!1}),l.add(()=>{window.scrollTo(0,window.pageYOffset+o),n&&n.isConnected&&(n.scrollIntoView({block:"nearest"}),n=null)})}}}export{p as handleIOSLocking};
import{disposables as m}from'../../utils/disposables.js';import{isIOS as u}from'../../utils/platform.js';function d(){return u()?{before({doc:r,d:n,meta:c}){function o(a){return c.containers.flatMap(l=>l()).some(l=>l.contains(a))}n.microTask(()=>{var s;if(window.getComputedStyle(r.documentElement).scrollBehavior!=="auto"){let t=m();t.style(r.documentElement,"scrollBehavior","auto"),n.add(()=>n.microTask(()=>t.dispose()))}let a=(s=window.scrollY)!=null?s:window.pageYOffset,l=null;n.addEventListener(r,"click",t=>{if(t.target instanceof HTMLElement)try{let e=t.target.closest("a");if(!e)return;let{hash:f}=new URL(e.href),i=r.querySelector(f);i&&!o(i)&&(l=i)}catch{}},!0),n.addEventListener(r,"touchstart",t=>{if(t.target instanceof HTMLElement)if(o(t.target)){let e=t.target;for(;e.parentElement&&o(e.parentElement);)e=e.parentElement;n.style(e,"overscrollBehavior","contain")}else n.style(t.target,"touchAction","none")}),n.addEventListener(r,"touchmove",t=>{if(t.target instanceof HTMLElement){if(t.target.tagName==="INPUT")return;if(o(t.target)){let e=t.target;for(;e.parentElement&&e.dataset.headlessuiPortal!==""&&!(e.scrollHeight>e.clientHeight||e.scrollWidth>e.clientWidth);)e=e.parentElement;e.dataset.headlessuiPortal===""&&t.preventDefault()}else t.preventDefault()}},{passive:!1}),n.add(()=>{var e;let t=(e=window.scrollY)!=null?e:window.pageYOffset;a!==t&&window.scrollTo(0,a),l&&l.isConnected&&(l.scrollIntoView({block:"nearest"}),l=null)})})}}:{}}export{d as handleIOSLocking};

@@ -1,2 +0,2 @@

import { Disposables } from '../../utils/disposables.js';
import { type Disposables } from '../../utils/disposables.js';
interface DocEntry {

@@ -3,0 +3,0 @@ doc: Document;

@@ -1,2 +0,2 @@

import { ScrollLockStep } from './overflow-store.js';
import type { ScrollLockStep } from './overflow-store.js';
export declare function preventScroll(): ScrollLockStep;

@@ -1,1 +0,1 @@

function l(){return{before({doc:e,d:o}){o.style(e.documentElement,"overflow","hidden")}}}export{l as preventScroll};
function r(){return{before({doc:e,d:o}){o.style(e.documentElement,"overflow","hidden")}}}export{r as preventScroll};

@@ -1,3 +0,3 @@

import { MetaFn } from './overflow-store.js';
import { Ref } from 'vue';
import { type Ref } from 'vue';
import { type MetaFn } from './overflow-store.js';
export declare function useDocumentOverflowLockedEffect(doc: Ref<Document | null>, shouldBeLocked: Ref<boolean>, meta: MetaFn): import("vue").ComputedRef<boolean>;

@@ -1,1 +0,1 @@

import{useStore as p}from'../../hooks/use-store.js';import{overflows as u}from'./overflow-store.js';import{computed as s,watch as v}from"vue";function d(t,a,n){let i=p(u),l=s(()=>{let e=t.value?i.value.get(t.value):void 0;return e?e.count>0:!1});return v([t,a],([e,m],[r],o)=>{if(!e||!m)return;u.dispatch("PUSH",e,n);let f=!1;o(()=>{f||(u.dispatch("POP",r!=null?r:e,n),f=!0)})},{immediate:!0}),l}export{d as useDocumentOverflowLockedEffect};
import{computed as o,watch as s}from"vue";import{useStore as v}from'../../hooks/use-store.js';import{overflows as u}from'./overflow-store.js';function w(t,a,n){let i=v(u),l=o(()=>{let e=t.value?i.value.get(t.value):void 0;return e?e.count>0:!1});return s([t,a],([e,m],[r],p)=>{if(!e||!m)return;u.dispatch("PUSH",e,n);let f=!1;p(()=>{f||(u.dispatch("POP",r!=null?r:e,n),f=!0)})},{immediate:!0}),l}export{w as useDocumentOverflowLockedEffect};

@@ -1,2 +0,2 @@

import { ComputedRef, UnwrapRef } from 'vue';
import { type ComputedRef, type UnwrapRef } from 'vue';
export declare function useControllable<T>(controlledValue: ComputedRef<T | undefined>, onChange?: (value: T) => void, defaultValue?: ComputedRef<T>): readonly [ComputedRef<T | UnwrapRef<T> | undefined>, (value: unknown) => void | undefined];

@@ -1,1 +0,1 @@

import{computed as p,ref as s}from"vue";function d(u,e,r){let i=s(r==null?void 0:r.value),f=p(()=>u.value!==void 0);return[p(()=>f.value?u.value:i.value),function(t){return f.value||(i.value=t),e==null?void 0:e(t)}]}export{d as useControllable};
import{computed as f,ref as s}from"vue";function T(u,e,r){let p=s(r==null?void 0:r.value),i=f(()=>u.value!==void 0);return[f(()=>i.value?u.value:p.value),function(t){return i.value||(p.value=t),e==null?void 0:e(t)}]}export{T as useControllable};

@@ -1,1 +0,2 @@

export declare function useDocumentEvent<TType extends keyof DocumentEventMap>(type: TType, listener: (this: Document, ev: DocumentEventMap[TType]) => any, options?: boolean | AddEventListenerOptions): void;
import { type Ref } from 'vue';
export declare function useDocumentEvent<TType extends keyof DocumentEventMap>(enabled: Ref<boolean>, type: TType, listener: (this: Document, ev: DocumentEventMap[TType]) => any, options?: boolean | AddEventListenerOptions): void;

@@ -1,1 +0,1 @@

import{watchEffect as r}from"vue";import{env as m}from'../utils/env.js';function u(e,t,n){m.isServer||r(o=>{document.addEventListener(e,t,n),o(()=>document.removeEventListener(e,t,n))})}export{u as useDocumentEvent};
import{watchEffect as m}from"vue";import{env as u}from'../utils/env.js';function c(o,e,t,n){u.isServer||m(r=>{o.value&&(document.addEventListener(e,t,n),r(()=>document.removeEventListener(e,t,n)))})}export{c as useDocumentEvent};

@@ -1,2 +0,2 @@

import { Ref } from 'vue';
import { type Ref } from 'vue';
export declare function useInert<TElement extends HTMLElement>(node: Ref<TElement | null>, enabled?: Ref<boolean>): void;

@@ -1,1 +0,1 @@

import{ref as m,watchEffect as s}from"vue";import{dom as h}from'../utils/dom.js';let i=new Map,t=new Map;function E(d,f=m(!0)){s(o=>{var a;if(!f.value)return;let e=h(d);if(!e)return;o(function(){var u;if(!e)return;let r=(u=t.get(e))!=null?u:1;if(r===1?t.delete(e):t.set(e,r-1),r!==1)return;let n=i.get(e);n&&(n["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",n["aria-hidden"]),e.inert=n.inert,i.delete(e))});let l=(a=t.get(e))!=null?a:0;t.set(e,l+1),l===0&&(i.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0)})}export{E as useInert};
import{ref as m,watchEffect as s}from"vue";import{dom as h}from'../utils/dom.js';let i=new Map,t=new Map;function p(d,f=m(!0)){s(o=>{var a;if(!f.value)return;let e=h(d);if(!e)return;o(function(){var u;if(!e)return;let r=(u=t.get(e))!=null?u:1;if(r===1?t.delete(e):t.set(e,r-1),r!==1)return;let n=i.get(e);n&&(n["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",n["aria-hidden"]),e.inert=n.inert,i.delete(e))});let l=(a=t.get(e))!=null?a:0;t.set(e,l+1),l===0&&(i.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0)})}export{p as useInert};

@@ -1,6 +0,6 @@

import { Ref, ComputedRef } from 'vue';
import { type ComputedRef, type Ref } from 'vue';
type Container = Ref<HTMLElement | null> | HTMLElement | null;
type ContainerCollection = Container[] | Set<Container>;
type ContainerInput = Container | ContainerCollection;
export declare function useOutsideClick(containers: ContainerInput | (() => ContainerInput), cb: (event: MouseEvent | PointerEvent | FocusEvent, target: HTMLElement) => void, enabled?: ComputedRef<boolean>): void;
export declare function useOutsideClick(containers: ContainerInput | (() => ContainerInput), cb: (event: MouseEvent | PointerEvent | FocusEvent | TouchEvent, target: HTMLElement) => void, enabled?: ComputedRef<boolean>): void;
export {};

@@ -1,1 +0,1 @@

import{computed as s,ref as E}from"vue";import{FocusableMode as d,isFocusableElement as p}from'../utils/focus-management.js';import{dom as C}from'../utils/dom.js';import{useDocumentEvent as l}from'./use-document-event.js';function y(f,m,i=s(()=>!0)){function a(e,u){if(!i.value||e.defaultPrevented)return;let n=u(e);if(n===null||!n.getRootNode().contains(n))return;let c=function o(t){return typeof t=="function"?o(t()):Array.isArray(t)||t instanceof Set?t:[t]}(f);for(let o of c){if(o===null)continue;let t=o instanceof HTMLElement?o:C(o);if(t!=null&&t.contains(n)||e.composed&&e.composedPath().includes(t))return}return!p(n,d.Loose)&&n.tabIndex!==-1&&e.preventDefault(),m(e,n)}let r=E(null);l("mousedown",e=>{var u,n;i.value&&(r.value=((n=(u=e.composedPath)==null?void 0:u.call(e))==null?void 0:n[0])||e.target)},!0),l("click",e=>{r.value&&(a(e,()=>r.value),r.value=null)},!0),l("blur",e=>a(e,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}export{y as useOutsideClick};
import{computed as p,ref as d}from"vue";import{dom as C}from'../utils/dom.js';import{FocusableMode as h,isFocusableElement as T}from'../utils/focus-management.js';import{isMobile as M}from'../utils/platform.js';import{useDocumentEvent as l}from'./use-document-event.js';import{useWindowEvent as y}from'./use-window-event.js';const f=30;function R(s,m,r=p(()=>!0)){function c(t,o){if(t.defaultPrevented)return;let e=o(t);if(e===null||!e.getRootNode().contains(e))return;let E=function u(n){return typeof n=="function"?u(n()):Array.isArray(n)||n instanceof Set?n:[n]}(s);for(let u of E){if(u===null)continue;let n=u instanceof HTMLElement?u:C(u);if(n!=null&&n.contains(e)||t.composed&&t.composedPath().includes(n))return}return!T(e,h.Loose)&&e.tabIndex!==-1&&t.preventDefault(),m(t,e)}let i=d(null);l(r,"pointerdown",t=>{var o,e;i.value=((e=(o=t.composedPath)==null?void 0:o.call(t))==null?void 0:e[0])||t.target},!0),l(r,"mousedown",t=>{var o,e;i.value=((e=(o=t.composedPath)==null?void 0:o.call(t))==null?void 0:e[0])||t.target},!0),l(r,"click",t=>{M()||i.value&&(c(t,()=>i.value),i.value=null)},!0);let a={x:0,y:0};l(r,"touchstart",t=>{a.x=t.touches[0].clientX,a.y=t.touches[0].clientY},!0),l(r,"touchend",t=>{let o={x:t.changedTouches[0].clientX,y:t.changedTouches[0].clientY};if(!(Math.abs(o.x-a.x)>=f||Math.abs(o.y-a.y)>=f))return c(t,()=>t.target instanceof HTMLElement?t.target:null)},!0),y(r,"blur",t=>c(t,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}export{R as useOutsideClick};

@@ -1,5 +0,5 @@

import { Ref } from 'vue';
import { type ComponentPublicInstance, type Ref } from 'vue';
export declare function useResolveButtonType(data: Ref<{
as: string | object;
type?: unknown;
}>, refElement: Ref<HTMLElement | null>): Ref<{} | undefined>;
}>, refElement: Ref<HTMLElement | ComponentPublicInstance | null>): Ref<{} | undefined>;

@@ -1,1 +0,1 @@

import{ref as f,onMounted as i,watchEffect as l}from"vue";import{dom as u}from'../utils/dom.js';function r(t,e){if(t)return t;let n=e!=null?e:"button";if(typeof n=="string"&&n.toLowerCase()==="button")return"button"}function b(t,e){let n=f(r(t.value.type,t.value.as));return i(()=>{n.value=r(t.value.type,t.value.as)}),l(()=>{var o;n.value||u(e)&&u(e)instanceof HTMLButtonElement&&!((o=u(e))!=null&&o.hasAttribute("type"))&&(n.value="button")}),n}export{b as useResolveButtonType};
import{onMounted as i,ref as f,watchEffect as l}from"vue";import{dom as o}from'../utils/dom.js';function r(t,e){if(t)return t;let n=e!=null?e:"button";if(typeof n=="string"&&n.toLowerCase()==="button")return"button"}function s(t,e){let n=f(r(t.value.type,t.value.as));return i(()=>{n.value=r(t.value.type,t.value.as)}),l(()=>{var u;n.value||o(e)&&o(e)instanceof HTMLButtonElement&&!((u=o(e))!=null&&u.hasAttribute("type"))&&(n.value="button")}),n}export{s as useResolveButtonType};

@@ -1,2 +0,2 @@

import { Store } from '../utils/store.js';
import type { Store } from '../utils/store.js';
export declare function useStore<T>(store: Store<T, any>): import("vue").ShallowRef<T>;

@@ -1,1 +0,1 @@

import{onUnmounted as o,shallowRef as n}from"vue";function m(t){let e=n(t.getSnapshot());return o(t.subscribe(()=>{e.value=t.getSnapshot()})),e}export{m as useStore};
import{onUnmounted as o,shallowRef as r}from"vue";function s(t){let e=r(t.getSnapshot());return o(t.subscribe(()=>{e.value=t.getSnapshot()})),e}export{s as useStore};

@@ -1,1 +0,1 @@

import{ref as a}from"vue";import{useWindowEvent as t}from'./use-window-event.js';var d=(r=>(r[r.Forwards=0]="Forwards",r[r.Backwards=1]="Backwards",r))(d||{});function n(){let o=a(0);return t("keydown",e=>{e.key==="Tab"&&(o.value=e.shiftKey?1:0)}),o}export{d as Direction,n as useTabDirection};
import{ref as o}from"vue";import{useWindowEvent as t}from'./use-window-event.js';var d=(r=>(r[r.Forwards=0]="Forwards",r[r.Backwards=1]="Backwards",r))(d||{});function s(){let e=o(0),a=o(!0);return t(a,"keydown",r=>{r.key==="Tab"&&(e.value=r.shiftKey?1:0)}),e}export{d as Direction,s as useTabDirection};

@@ -1,2 +0,2 @@

import { ComputedRef } from 'vue';
import { type ComputedRef } from 'vue';
type AcceptNode = (node: HTMLElement) => typeof NodeFilter.FILTER_ACCEPT | typeof NodeFilter.FILTER_SKIP | typeof NodeFilter.FILTER_REJECT;

@@ -3,0 +3,0 @@ export declare function useTreeWalker({ container, accept, walk, enabled, }: {

@@ -1,1 +0,1 @@

import{watchEffect as u}from"vue";import{getOwnerDocument as E}from'../utils/owner.js';function p({container:e,accept:t,walk:d,enabled:o}){u(()=>{let r=e.value;if(!r||o!==void 0&&!o.value)return;let l=E(e);if(!l)return;let c=Object.assign(f=>t(f),{acceptNode:t}),n=l.createTreeWalker(r,NodeFilter.SHOW_ELEMENT,c,!1);for(;n.nextNode();)d(n.currentNode)})}export{p as useTreeWalker};
import{watchEffect as p}from"vue";import{getOwnerDocument as u}from'../utils/owner.js';function i({container:e,accept:t,walk:d,enabled:o}){p(()=>{let r=e.value;if(!r||o!==void 0&&!o.value)return;let l=u(e);if(!l)return;let c=Object.assign(f=>t(f),{acceptNode:t}),n=l.createTreeWalker(r,NodeFilter.SHOW_ELEMENT,c,!1);for(;n.nextNode();)d(n.currentNode)})}export{i as useTreeWalker};

@@ -1,1 +0,2 @@

export declare function useWindowEvent<TType extends keyof WindowEventMap>(type: TType, listener: (this: Window, ev: WindowEventMap[TType]) => any, options?: boolean | AddEventListenerOptions): void;
import { type Ref } from 'vue';
export declare function useWindowEvent<TType extends keyof WindowEventMap>(enabled: Ref<boolean>, type: TType, listener: (this: Window, ev: WindowEventMap[TType]) => any, options?: boolean | AddEventListenerOptions): void;

@@ -1,1 +0,1 @@

import{watchEffect as i}from"vue";import{env as r}from'../utils/env.js';function w(e,n,t){r.isServer||i(o=>{window.addEventListener(e,n,t),o(()=>window.removeEventListener(e,n,t))})}export{w as useWindowEvent};
import{watchEffect as r}from"vue";import{env as d}from'../utils/env.js';function w(o,e,n,t){d.isServer||r(i=>{o.value&&(window.addEventListener(e,n,t),i(()=>window.removeEventListener(e,n,t)))})}export{w as useWindowEvent};

@@ -8,3 +8,3 @@ export * from './components/combobox/combobox.js';

export * from './components/popover/popover.js';
export * from './components/portal/portal.js';
export { Portal, PortalGroup } from './components/portal/portal.js';
export * from './components/radio-group/radio-group.js';

@@ -11,0 +11,0 @@ export * from './components/switch/switch.js';

@@ -1,1 +0,1 @@

export*from'./components/combobox/combobox.js';export*from'./components/dialog/dialog.js';export*from'./components/disclosure/disclosure.js';export*from'./components/focus-trap/focus-trap.js';export*from'./components/listbox/listbox.js';export*from'./components/menu/menu.js';export*from'./components/popover/popover.js';export*from'./components/portal/portal.js';export*from'./components/radio-group/radio-group.js';export*from'./components/switch/switch.js';export*from'./components/tabs/tabs.js';export*from'./components/transitions/transition.js';
export*from'./components/combobox/combobox.js';export*from'./components/dialog/dialog.js';export*from'./components/disclosure/disclosure.js';export*from'./components/focus-trap/focus-trap.js';export*from'./components/listbox/listbox.js';export*from'./components/menu/menu.js';export*from'./components/popover/popover.js';import{Portal as l,PortalGroup as P}from'./components/portal/portal.js';export*from'./components/radio-group/radio-group.js';export*from'./components/switch/switch.js';export*from'./components/tabs/tabs.js';export*from'./components/transitions/transition.js';export{l as Portal,P as PortalGroup};

@@ -1,1 +0,1 @@

import{h as i,ref as m,defineComponent as f}from"vue";import{Hidden as l,Features as F}from'./hidden.js';let d=f({props:{onFocus:{type:Function,required:!0}},setup(t){let n=m(!0);return()=>n.value?i(l,{as:"button",type:"button",features:F.Focusable,onFocus(o){o.preventDefault();let e,a=50;function r(){var u;if(a--<=0){e&&cancelAnimationFrame(e);return}if((u=t.onFocus)!=null&&u.call(t)){n.value=!1,cancelAnimationFrame(e);return}e=requestAnimationFrame(r)}e=requestAnimationFrame(r)}}):null}});export{d as FocusSentinel};
import{defineComponent as i,h as m,ref as f}from"vue";import{Features as l,Hidden as F}from'./hidden.js';let d=i({props:{onFocus:{type:Function,required:!0}},setup(t){let n=f(!0);return()=>n.value?m(F,{as:"button",type:"button",features:l.Focusable,onFocus(o){o.preventDefault();let e,a=50;function r(){var u;if(a--<=0){e&&cancelAnimationFrame(e);return}if((u=t.onFocus)!=null&&u.call(t)){n.value=!1,cancelAnimationFrame(e);return}e=requestAnimationFrame(r)}e=requestAnimationFrame(r)}}):null}});export{d as FocusSentinel};

@@ -1,2 +0,2 @@

import { PropType } from 'vue';
import { type PropType } from 'vue';
export declare enum Features {

@@ -3,0 +3,0 @@ None = 1,

@@ -1,1 +0,1 @@

import{defineComponent as i}from"vue";import{render as p}from'../utils/render.js';var a=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(a||{});let f=i({name:"Hidden",props:{as:{type:[Object,String],default:"div"},features:{type:Number,default:1}},setup(r,{slots:t,attrs:d}){return()=>{let{features:e,...o}=r,n={"aria-hidden":(e&2)===2?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(e&4)===4&&(e&2)!==2&&{display:"none"}}};return p({ourProps:n,theirProps:o,slot:{},attrs:d,slots:t,name:"Hidden"})}}});export{a as Features,f as Hidden};
import{defineComponent as a}from"vue";import{render as p}from'../utils/render.js';var u=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(u||{});let f=a({name:"Hidden",props:{as:{type:[Object,String],default:"div"},features:{type:Number,default:1}},setup(t,{slots:n,attrs:i}){return()=>{var r;let{features:e,...d}=t,o={"aria-hidden":(e&2)===2?!0:(r=d["aria-hidden"])!=null?r:void 0,hidden:(e&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(e&4)===4&&(e&2)!==2&&{display:"none"}}};return p({ourProps:o,theirProps:d,slot:{},attrs:i,slots:n,name:"Hidden"})}}});export{u as Features,f as Hidden};

@@ -1,2 +0,2 @@

import { Ref } from 'vue';
import { type Ref } from 'vue';
export declare enum State {

@@ -3,0 +3,0 @@ Open = 1,

@@ -1,1 +0,1 @@

import{inject as r,provide as i}from"vue";let n=Symbol("Context");var l=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(l||{});function C(){return p()!==null}function p(){return r(n,null)}function c(o){i(n,o)}export{l as State,C as hasOpenClosed,p as useOpenClosed,c as useOpenClosedProvider};
import{inject as p,provide as r}from"vue";let n=Symbol("Context");var i=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(i||{});function s(){return l()!==null}function l(){return p(n,null)}function t(o){r(n,o)}export{i as State,s as hasOpenClosed,l as useOpenClosed,t as useOpenClosedProvider};

@@ -1,1 +0,1 @@

import{defineComponent as l,inject as a,provide as c}from"vue";import{render as p}from'../utils/render.js';let e=Symbol("ForcePortalRootContext");function u(){return a(e,!1)}let P=l({name:"ForcePortalRoot",props:{as:{type:[Object,String],default:"template"},force:{type:Boolean,default:!1}},setup(o,{slots:t,attrs:r}){return c(e,o.force),()=>{let{force:f,...n}=o;return p({theirProps:n,ourProps:{},slot:{},slots:t,attrs:r,name:"ForcePortalRoot"})}}});export{P as ForcePortalRoot,u as usePortalRoot};
import{defineComponent as l,inject as a,provide as c}from"vue";import{render as p}from'../utils/render.js';let e=Symbol("ForcePortalRootContext");function s(){return a(e,!1)}let u=l({name:"ForcePortalRoot",props:{as:{type:[Object,String],default:"template"},force:{type:Boolean,default:!1}},setup(o,{slots:t,attrs:r}){return c(e,o.force),()=>{let{force:f,...n}=o;return p({theirProps:n,ourProps:{},slot:{},slots:t,attrs:r,name:"ForcePortalRoot"})}}});export{u as ForcePortalRoot,s as usePortalRoot};

@@ -1,2 +0,2 @@

import { Ref } from 'vue';
import { type Ref } from 'vue';
type OnUpdate = (message: StackMessage, type: string, element: Ref<HTMLElement | null>) => void;

@@ -3,0 +3,0 @@ export declare enum StackMessage {

@@ -1,1 +0,1 @@

import{inject as f,provide as m,onMounted as l,onUnmounted as c,watch as s}from"vue";let u=Symbol("StackContext");var p=(e=>(e[e.Add=0]="Add",e[e.Remove=1]="Remove",e))(p||{});function v(){return f(u,()=>{})}function S({type:o,enabled:r,element:e,onUpdate:i}){let a=v();function t(...n){i==null||i(...n),a(...n)}l(()=>{s(r,(n,d)=>{n?t(0,o,e):d===!0&&t(1,o,e)},{immediate:!0,flush:"sync"})}),c(()=>{r.value&&t(1,o,e)}),m(u,t)}export{p as StackMessage,v as useStackContext,S as useStackProvider};
import{inject as f,onMounted as m,onUnmounted as l,provide as c,watch as p}from"vue";let u=Symbol("StackContext");var s=(e=>(e[e.Add=0]="Add",e[e.Remove=1]="Remove",e))(s||{});function y(){return f(u,()=>{})}function R({type:o,enabled:r,element:e,onUpdate:i}){let a=y();function t(...n){i==null||i(...n),a(...n)}m(()=>{p(r,(n,d)=>{n?t(0,o,e):d===!0&&t(1,o,e)},{immediate:!0,flush:"sync"})}),l(()=>{r.value&&t(1,o,e)}),c(u,t)}export{s as StackMessage,y as useStackContext,R as useStackProvider};

@@ -23,4 +23,4 @@ export declare enum Focus {

resolveActiveIndex(): number | null;
resolveId(item: TItem): string;
resolveDisabled(item: TItem): boolean;
resolveId(item: TItem, index: number, items: TItem[]): string;
resolveDisabled(item: TItem, index: number, items: TItem[]): boolean;
}): number | null;

@@ -1,1 +0,1 @@

function f(r){throw new Error("Unexpected object: "+r)}var a=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(a||{});function x(r,n){let t=n.resolveItems();if(t.length<=0)return null;let l=n.resolveActiveIndex(),s=l!=null?l:-1,d=(()=>{switch(r.focus){case 0:return t.findIndex(e=>!n.resolveDisabled(e));case 1:{let e=t.slice().reverse().findIndex((i,c,u)=>s!==-1&&u.length-c-1>=s?!1:!n.resolveDisabled(i));return e===-1?e:t.length-1-e}case 2:return t.findIndex((e,i)=>i<=s?!1:!n.resolveDisabled(e));case 3:{let e=t.slice().reverse().findIndex(i=>!n.resolveDisabled(i));return e===-1?e:t.length-1-e}case 4:return t.findIndex(e=>n.resolveId(e)===r.id);case 5:return null;default:f(r)}})();return d===-1?l:d}export{a as Focus,x as calculateActiveIndex};
function u(l){throw new Error("Unexpected object: "+l)}var c=(i=>(i[i.First=0]="First",i[i.Previous=1]="Previous",i[i.Next=2]="Next",i[i.Last=3]="Last",i[i.Specific=4]="Specific",i[i.Nothing=5]="Nothing",i))(c||{});function f(l,n){let t=n.resolveItems();if(t.length<=0)return null;let r=n.resolveActiveIndex(),s=r!=null?r:-1;switch(l.focus){case 0:{for(let e=0;e<t.length;++e)if(!n.resolveDisabled(t[e],e,t))return e;return r}case 1:{s===-1&&(s=t.length);for(let e=s-1;e>=0;--e)if(!n.resolveDisabled(t[e],e,t))return e;return r}case 2:{for(let e=s+1;e<t.length;++e)if(!n.resolveDisabled(t[e],e,t))return e;return r}case 3:{for(let e=t.length-1;e>=0;--e)if(!n.resolveDisabled(t[e],e,t))return e;return r}case 4:{for(let e=0;e<t.length;++e)if(n.resolveId(t[e],e,t)===l.id)return e;return r}case 5:return null;default:u(l)}}export{c as Focus,f as calculateActiveIndex};

@@ -7,2 +7,3 @@ export type Disposables = ReturnType<typeof disposables>;

setTimeout(callback: (...args: any[]) => void, ms?: number | undefined, ...args: any[]): void;
microTask(cb: () => void): () => void;
style(node: HTMLElement, property: string, value: string): () => void;

@@ -9,0 +10,0 @@ group(cb: (d: typeof this) => void): () => void;

@@ -1,1 +0,1 @@

function r(){let n=[],s={addEventListener(e,t,i,a){return e.addEventListener(t,i,a),s.add(()=>e.removeEventListener(t,i,a))},requestAnimationFrame(...e){let t=requestAnimationFrame(...e);s.add(()=>cancelAnimationFrame(t))},nextFrame(...e){s.requestAnimationFrame(()=>{s.requestAnimationFrame(...e)})},setTimeout(...e){let t=setTimeout(...e);s.add(()=>clearTimeout(t))},style(e,t,i){let a=e.style.getPropertyValue(t);return Object.assign(e.style,{[t]:i}),this.add(()=>{Object.assign(e.style,{[t]:a})})},group(e){let t=r();return e(t),this.add(()=>t.dispose())},add(e){return n.push(e),()=>{let t=n.indexOf(e);if(t>=0)for(let i of n.splice(t,1))i()}},dispose(){for(let e of n.splice(0))e()}};return s}export{r as disposables};
import{microTask as n}from'./micro-task.js';function o(){let a=[],s={addEventListener(e,t,r,i){return e.addEventListener(t,r,i),s.add(()=>e.removeEventListener(t,r,i))},requestAnimationFrame(...e){let t=requestAnimationFrame(...e);s.add(()=>cancelAnimationFrame(t))},nextFrame(...e){s.requestAnimationFrame(()=>{s.requestAnimationFrame(...e)})},setTimeout(...e){let t=setTimeout(...e);s.add(()=>clearTimeout(t))},microTask(...e){let t={current:!0};return n(()=>{t.current&&e[0]()}),s.add(()=>{t.current=!1})},style(e,t,r){let i=e.style.getPropertyValue(t);return Object.assign(e.style,{[t]:r}),this.add(()=>{Object.assign(e.style,{[t]:i})})},group(e){let t=o();return e(t),this.add(()=>t.dispose())},add(e){return a.push(e),()=>{let t=a.indexOf(e);if(t>=0)for(let r of a.splice(t,1))r()}},dispose(){for(let e of a.splice(0))e()}};return s}export{o as disposables};

@@ -1,2 +0,4 @@

import { Ref, ComponentPublicInstance } from 'vue';
export declare function dom<T extends Element | ComponentPublicInstance>(ref?: Ref<T | null>): T | null;
import type { ComponentPublicInstance, Ref } from 'vue';
type AsElement<T extends HTMLElement | ComponentPublicInstance> = (T extends HTMLElement ? T : HTMLElement) | null;
export declare function dom<T extends HTMLElement | ComponentPublicInstance>(ref?: Ref<T | null>): AsElement<T> | null;
export {};

@@ -1,1 +0,1 @@

function o(n){var l;return n==null||n.value==null?null:(l=n.value.$el)!=null?l:n.value}export{o as dom};
function t(e){var l;if(e==null||e.value==null)return null;let n=(l=e.value.$el)!=null?l:e.value;return n instanceof Node?n:null}export{t as dom};

@@ -1,1 +0,1 @@

import{nextTick as b}from"vue";import{match as L}from'./match.js';import{getOwnerDocument as E}from'./owner.js';let f=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var N=(r=>(r[r.First=1]="First",r[r.Previous=2]="Previous",r[r.Next=4]="Next",r[r.Last=8]="Last",r[r.WrapAround=16]="WrapAround",r[r.NoScroll=32]="NoScroll",r))(N||{}),T=(o=>(o[o.Error=0]="Error",o[o.Overflow=1]="Overflow",o[o.Success=2]="Success",o[o.Underflow=3]="Underflow",o))(T||{}),h=(n=>(n[n.Previous=-1]="Previous",n[n.Next=1]="Next",n))(h||{});function d(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(f)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var F=(n=>(n[n.Strict=0]="Strict",n[n.Loose=1]="Loose",n))(F||{});function S(e,t=0){var n;return e===((n=E(e))==null?void 0:n.body)?!1:L(t,{[0](){return e.matches(f)},[1](){let l=e;for(;l!==null;){if(l.matches(f))return!0;l=l.parentElement}return!1}})}function v(e){let t=E(e);b(()=>{t&&!S(t.activeElement,0)&&H(e)})}function H(e){e==null||e.focus({preventScroll:!0})}let w=["textarea","input"].join(",");function A(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,w))!=null?n:!1}function I(e,t=n=>n){return e.slice().sort((n,l)=>{let o=t(n),i=t(l);if(o===null||i===null)return 0;let r=o.compareDocumentPosition(i);return r&Node.DOCUMENT_POSITION_FOLLOWING?-1:r&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function D(e,t){return O(d(),t,{relativeTo:e})}function O(e,t,{sorted:n=!0,relativeTo:l=null,skipElements:o=[]}={}){var m;let i=(m=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e==null?void 0:e.ownerDocument)!=null?m:document,r=Array.isArray(e)?n?I(e):e:d(e);o.length>0&&r.length>1&&(r=r.filter(s=>!o.includes(s))),l=l!=null?l:i.activeElement;let x=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),p=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,r.indexOf(l))-1;if(t&4)return Math.max(0,r.indexOf(l))+1;if(t&8)return r.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),M=t&32?{preventScroll:!0}:{},c=0,a=r.length,u;do{if(c>=a||c+a<=0)return 0;let s=p+c;if(t&16)s=(s+a)%a;else{if(s<0)return 3;if(s>=a)return 1}u=r[s],u==null||u.focus(M),c+=x}while(u!==i.activeElement);return t&6&&A(u)&&u.select(),u.hasAttribute("tabindex")||u.setAttribute("tabindex","0"),2}export{N as Focus,T as FocusResult,F as FocusableMode,H as focusElement,D as focusFrom,O as focusIn,d as getFocusableElements,S as isFocusableElement,v as restoreFocusIfNecessary,I as sortByDomNode};
import{nextTick as b}from"vue";import{match as M}from'./match.js';import{getOwnerDocument as f}from'./owner.js';let c=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var N=(n=>(n[n.First=1]="First",n[n.Previous=2]="Previous",n[n.Next=4]="Next",n[n.Last=8]="Last",n[n.WrapAround=16]="WrapAround",n[n.NoScroll=32]="NoScroll",n))(N||{}),T=(o=>(o[o.Error=0]="Error",o[o.Overflow=1]="Overflow",o[o.Success=2]="Success",o[o.Underflow=3]="Underflow",o))(T||{}),F=(t=>(t[t.Previous=-1]="Previous",t[t.Next=1]="Next",t))(F||{});function E(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(c)).sort((r,t)=>Math.sign((r.tabIndex||Number.MAX_SAFE_INTEGER)-(t.tabIndex||Number.MAX_SAFE_INTEGER)))}var h=(t=>(t[t.Strict=0]="Strict",t[t.Loose=1]="Loose",t))(h||{});function w(e,r=0){var t;return e===((t=f(e))==null?void 0:t.body)?!1:M(r,{[0](){return e.matches(c)},[1](){let l=e;for(;l!==null;){if(l.matches(c))return!0;l=l.parentElement}return!1}})}function _(e){let r=f(e);b(()=>{r&&!w(r.activeElement,0)&&S(e)})}var y=(t=>(t[t.Keyboard=0]="Keyboard",t[t.Mouse=1]="Mouse",t))(y||{});typeof window!="undefined"&&typeof document!="undefined"&&(document.addEventListener("keydown",e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",e=>{e.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:e.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));function S(e){e==null||e.focus({preventScroll:!0})}let H=["textarea","input"].join(",");function I(e){var r,t;return(t=(r=e==null?void 0:e.matches)==null?void 0:r.call(e,H))!=null?t:!1}function O(e,r=t=>t){return e.slice().sort((t,l)=>{let o=r(t),i=r(l);if(o===null||i===null)return 0;let n=o.compareDocumentPosition(i);return n&Node.DOCUMENT_POSITION_FOLLOWING?-1:n&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function v(e,r){return P(E(),r,{relativeTo:e})}function P(e,r,{sorted:t=!0,relativeTo:l=null,skipElements:o=[]}={}){var m;let i=(m=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e==null?void 0:e.ownerDocument)!=null?m:document,n=Array.isArray(e)?t?O(e):e:E(e);o.length>0&&n.length>1&&(n=n.filter(s=>!o.includes(s))),l=l!=null?l:i.activeElement;let x=(()=>{if(r&5)return 1;if(r&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),p=(()=>{if(r&1)return 0;if(r&2)return Math.max(0,n.indexOf(l))-1;if(r&4)return Math.max(0,n.indexOf(l))+1;if(r&8)return n.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),L=r&32?{preventScroll:!0}:{},a=0,d=n.length,u;do{if(a>=d||a+d<=0)return 0;let s=p+a;if(r&16)s=(s+d)%d;else{if(s<0)return 3;if(s>=d)return 1}u=n[s],u==null||u.focus(L),a+=x}while(u!==i.activeElement);return r&6&&I(u)&&u.select(),2}export{N as Focus,T as FocusResult,h as FocusableMode,S as focusElement,v as focusFrom,P as focusIn,E as getFocusableElements,w as isFocusableElement,_ as restoreFocusIfNecessary,O as sortByDomNode};
type Entries = [string, string][];
export declare function objectToFormEntries(source?: Record<string, any>, parentKey?: string | null, entries?: Entries): Entries;
export declare function attemptSubmit(element: HTMLElement): void;
export declare function attemptSubmit(elementInForm: HTMLElement): void;
export {};

@@ -1,1 +0,1 @@

function e(n={},r=null,t=[]){for(let[i,o]of Object.entries(n))f(t,s(r,i),o);return t}function s(n,r){return n?n+"["+r+"]":r}function f(n,r,t){if(Array.isArray(t))for(let[i,o]of t.entries())f(n,s(r,i.toString()),o);else t instanceof Date?n.push([r,t.toISOString()]):typeof t=="boolean"?n.push([r,t?"1":"0"]):typeof t=="string"?n.push([r,t]):typeof t=="number"?n.push([r,`${t}`]):t==null?n.push([r,""]):e(t,r,n)}function p(n){var t;let r=(t=n==null?void 0:n.form)!=null?t:n.closest("form");if(r){for(let i of r.elements)if(i.tagName==="INPUT"&&i.type==="submit"||i.tagName==="BUTTON"&&i.type==="submit"||i.nodeName==="INPUT"&&i.type==="image"){i.click();return}}}export{p as attemptSubmit,e as objectToFormEntries};
function e(i={},s=null,t=[]){for(let[r,n]of Object.entries(i))o(t,f(s,r),n);return t}function f(i,s){return i?i+"["+s+"]":s}function o(i,s,t){if(Array.isArray(t))for(let[r,n]of t.entries())o(i,f(s,r.toString()),n);else t instanceof Date?i.push([s,t.toISOString()]):typeof t=="boolean"?i.push([s,t?"1":"0"]):typeof t=="string"?i.push([s,t]):typeof t=="number"?i.push([s,`${t}`]):t==null?i.push([s,""]):e(t,s,i)}function p(i){var t,r;let s=(t=i==null?void 0:i.form)!=null?t:i.closest("form");if(s){for(let n of s.elements)if(n!==i&&(n.tagName==="INPUT"&&n.type==="submit"||n.tagName==="BUTTON"&&n.type==="submit"||n.nodeName==="INPUT"&&n.type==="image")){n.click();return}(r=s.requestSubmit)==null||r.call(s)}}export{p as attemptSubmit,e as objectToFormEntries};

@@ -1,2 +0,2 @@

import { Ref } from 'vue';
export declare function getOwnerDocument<T extends Element | Ref<Element | null>>(element: T | null | undefined): Document | null;
import type { Ref } from 'vue';
export declare function getOwnerDocument<T extends HTMLElement | Ref<HTMLElement | null>>(element: T | null | undefined): Document | null;

@@ -1,1 +0,1 @@

import{dom as o}from'./dom.js';import{env as t}from'./env.js';function m(r){if(t.isServer)return null;if(r instanceof Node)return r.ownerDocument;if(r!=null&&r.hasOwnProperty("value")){let n=o(r);if(n)return n.ownerDocument}return document}export{m as getOwnerDocument};
import{dom as o}from'./dom.js';import{env as t}from'./env.js';function f(r){if(t.isServer)return null;if(r instanceof Node)return r.ownerDocument;if(r!=null&&r.hasOwnProperty("value")){let n=o(r);if(n)return n.ownerDocument}return document}export{f as getOwnerDocument};

@@ -1,2 +0,2 @@

import { Slots, VNode } from 'vue';
import { type Slots, type VNode } from 'vue';
export declare enum Features {

@@ -3,0 +3,0 @@ /** No features at all */

@@ -1,4 +0,4 @@

import{h as O,cloneVNode as x,Fragment as k}from"vue";import{match as w}from'./match.js';var N=(o=>(o[o.None=0]="None",o[o.RenderStrategy=1]="RenderStrategy",o[o.Static=2]="Static",o))(N||{}),S=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(S||{});function H({visible:r=!0,features:t=0,ourProps:e,theirProps:o,...i}){var a;let n=j(o,e),l=Object.assign(i,{props:n});if(r||t&2&&n.static)return y(l);if(t&1){let d=(a=n.unmount)==null||a?0:1;return w(d,{[0](){return null},[1](){return y({...i,props:{...n,hidden:!0,style:{display:"none"}}})}})}return y(l)}function y({props:r,attrs:t,slots:e,slot:o,name:i}){var m,h;let{as:n,...l}=T(r,["unmount","static"]),a=(m=e.default)==null?void 0:m.call(e,o),d={};if(o){let u=!1,c=[];for(let[p,f]of Object.entries(o))typeof f=="boolean"&&(u=!0),f===!0&&c.push(p);u&&(d["data-headlessui-state"]=c.join(" "))}if(n==="template"){if(a=b(a!=null?a:[]),Object.keys(l).length>0||Object.keys(t).length>0){let[u,...c]=a!=null?a:[];if(!v(u)||c.length>0)throw new Error(['Passing props on "template"!',"",`The current component <${i} /> is rendering a "template".`,"However we need to passthrough the following props:",Object.keys(l).concat(Object.keys(t)).map(s=>s.trim()).filter((s,g,R)=>R.indexOf(s)===g).sort((s,g)=>s.localeCompare(g)).map(s=>` - ${s}`).join(`
import{cloneVNode as O,Fragment as x,h as k}from"vue";import{match as w}from'./match.js';var N=(o=>(o[o.None=0]="None",o[o.RenderStrategy=1]="RenderStrategy",o[o.Static=2]="Static",o))(N||{}),S=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(S||{});function A({visible:r=!0,features:t=0,ourProps:e,theirProps:o,...i}){var a;let n=j(o,e),l=Object.assign(i,{props:n});if(r||t&2&&n.static)return y(l);if(t&1){let d=(a=n.unmount)==null||a?0:1;return w(d,{[0](){return null},[1](){return y({...i,props:{...n,hidden:!0,style:{display:"none"}}})}})}return y(l)}function y({props:r,attrs:t,slots:e,slot:o,name:i}){var m,h;let{as:n,...l}=T(r,["unmount","static"]),a=(m=e.default)==null?void 0:m.call(e,o),d={};if(o){let u=!1,c=[];for(let[p,f]of Object.entries(o))typeof f=="boolean"&&(u=!0),f===!0&&c.push(p);u&&(d["data-headlessui-state"]=c.join(" "))}if(n==="template"){if(a=b(a!=null?a:[]),Object.keys(l).length>0||Object.keys(t).length>0){let[u,...c]=a!=null?a:[];if(!v(u)||c.length>0)throw new Error(['Passing props on "template"!',"",`The current component <${i} /> is rendering a "template".`,"However we need to passthrough the following props:",Object.keys(l).concat(Object.keys(t)).map(s=>s.trim()).filter((s,g,R)=>R.indexOf(s)===g).sort((s,g)=>s.localeCompare(g)).map(s=>` - ${s}`).join(`
`),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "template".',"Render a single element as the child so that we can forward the props onto that element."].map(s=>` - ${s}`).join(`
`)].join(`
`));let p=j((h=u.props)!=null?h:{},l),f=x(u,p);for(let s in p)s.startsWith("on")&&(f.props||(f.props={}),f.props[s]=p[s]);return f}return Array.isArray(a)&&a.length===1?a[0]:a}return O(n,Object.assign({},l,d),{default:()=>a})}function b(r){return r.flatMap(t=>t.type===k?b(t.children):[t])}function j(...r){var o;if(r.length===0)return{};if(r.length===1)return r[0];let t={},e={};for(let i of r)for(let n in i)n.startsWith("on")&&typeof i[n]=="function"?((o=e[n])!=null||(e[n]=[]),e[n].push(i[n])):t[n]=i[n];if(t.disabled||t["aria-disabled"])return Object.assign(t,Object.fromEntries(Object.keys(e).map(i=>[i,void 0])));for(let i in e)Object.assign(t,{[i](n,...l){let a=e[i];for(let d of a){if(n instanceof Event&&n.defaultPrevented)return;d(n,...l)}}});return t}function K(r){let t=Object.assign({},r);for(let e in t)t[e]===void 0&&delete t[e];return t}function T(r,t=[]){let e=Object.assign({},r);for(let o of t)o in e&&delete e[o];return e}function v(r){return r==null?!1:typeof r.type=="string"||typeof r.type=="object"||typeof r.type=="function"}export{N as Features,S as RenderStrategy,K as compact,T as omit,H as render};
`));let p=j((h=u.props)!=null?h:{},l,d),f=O(u,p,!0);for(let s in p)s.startsWith("on")&&(f.props||(f.props={}),f.props[s]=p[s]);return f}return Array.isArray(a)&&a.length===1?a[0]:a}return k(n,Object.assign({},l,d),{default:()=>a})}function b(r){return r.flatMap(t=>t.type===x?b(t.children):[t])}function j(...r){var o;if(r.length===0)return{};if(r.length===1)return r[0];let t={},e={};for(let i of r)for(let n in i)n.startsWith("on")&&typeof i[n]=="function"?((o=e[n])!=null||(e[n]=[]),e[n].push(i[n])):t[n]=i[n];if(t.disabled||t["aria-disabled"])return Object.assign(t,Object.fromEntries(Object.keys(e).map(i=>[i,void 0])));for(let i in e)Object.assign(t,{[i](n,...l){let a=e[i];for(let d of a){if(n instanceof Event&&n.defaultPrevented)return;d(n,...l)}}});return t}function E(r){let t=Object.assign({},r);for(let e in t)t[e]===void 0&&delete t[e];return t}function T(r,t=[]){let e=Object.assign({},r);for(let o of t)o in e&&delete e[o];return e}function v(r){return r==null?!1:typeof r.type=="string"||typeof r.type=="object"||typeof r.type=="function"}export{N as Features,S as RenderStrategy,E as compact,T as omit,A as render};
{
"name": "@headlessui/vue",
"version": "0.0.0-insiders.9a7dcfc",
"version": "0.0.0-insiders.9ae054e",
"description": "A set of completely unstyled, fully accessible UI components for Vue 3, designed to integrate beautifully with Tailwind CSS.",

@@ -14,5 +14,8 @@ "main": "dist/index.cjs",

"exports": {
"types": {
"import": "./dist/index.d.ts",
"require": "./dist/index.d.cts"
},
"import": "./dist/headlessui.esm.js",
"require": "./dist/index.cjs",
"types": "./dist/index.d.ts"
"require": "./dist/index.cjs"
},

@@ -38,3 +41,4 @@ "type": "module",

"lint": "../../scripts/lint.sh",
"playground": "yarn workspace playground-vue dev",
"lint-types": "npm run attw -P --workspaces --if-present",
"playground": "npm run dev --workspace=playground-vue",
"clean": "rimraf ./dist"

@@ -46,6 +50,9 @@ },

"devDependencies": {
"@testing-library/vue": "^5.8.2",
"@vue/test-utils": "^2.0.0-rc.18",
"vue": "^3.2.29"
"@testing-library/vue": "8.0.0",
"@vue/test-utils": "^2.4.1",
"vue": "3.2.37"
},
"dependencies": {
"@tanstack/vue-virtual": "3.0.0-beta.60"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc