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

@headlessui/vue

Package Overview
Dependencies
Maintainers
4
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.46a7ab6 to 0.0.0-insiders.4737c6d

dist/hooks/document-overflow/adjust-scrollbar-padding.d.ts

108

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,14 +13,20 @@ as: {

type: (StringConstructor | FunctionConstructor)[];
default: () => typeof defaultComparator;
nullable: boolean;
default: null;
};
modelValue: {
type: (ObjectConstructor | BooleanConstructor | StringConstructor | NumberConstructor)[];
type: PropType<string | number | boolean | object | null>;
default: undefined;
};
defaultValue: {
type: (ObjectConstructor | BooleanConstructor | StringConstructor | NumberConstructor)[];
type: PropType<string | number | boolean | object | null>;
default: undefined;
};
form: {
type: StringConstructor;
optional: boolean;
};
name: {
type: StringConstructor;
optional: boolean;
};

@@ -36,2 +41,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, {

@@ -52,14 +68,20 @@ [key: string]: any;

type: (StringConstructor | FunctionConstructor)[];
default: () => typeof defaultComparator;
nullable: boolean;
default: null;
};
modelValue: {
type: (ObjectConstructor | BooleanConstructor | StringConstructor | NumberConstructor)[];
type: PropType<string | number | boolean | object | null>;
default: undefined;
};
defaultValue: {
type: (ObjectConstructor | BooleanConstructor | StringConstructor | NumberConstructor)[];
type: PropType<string | number | boolean | object | null>;
default: undefined;
};
form: {
type: StringConstructor;
optional: boolean;
};
name: {
type: StringConstructor;
optional: boolean;
};

@@ -74,2 +96,13 @@ nullable: {

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

@@ -81,6 +114,11 @@ "onUpdate:modelValue"?: ((_value: any) => any) | undefined;

by: string | Function;
modelValue: string | number | boolean | Record<string, any>;
defaultValue: string | number | boolean | Record<string, any>;
modelValue: string | number | boolean | object | null;
defaultValue: string | number | boolean | object | null;
nullable: boolean;
multiple: boolean;
immediate: boolean;
virtual: {
options: unknown[];
disabled?: ((value: unknown) => boolean) | undefined;
} | null;
}>;

@@ -92,2 +130,6 @@ export declare let ComboboxLabel: import("vue").DefineComponent<{

};
id: {
type: StringConstructor;
default: () => string;
};
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {

@@ -102,3 +144,8 @@ [key: string]: any;

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

@@ -111,2 +158,6 @@ }>;

};
id: {
type: StringConstructor;
default: () => string;
};
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {

@@ -121,3 +172,8 @@ [key: string]: any;

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

@@ -141,2 +197,10 @@ }>;

};
defaultValue: {
type: StringConstructor;
default: undefined;
};
id: {
type: StringConstructor;
default: () => string;
};
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {

@@ -166,2 +230,10 @@ [key: string]: any;

};
defaultValue: {
type: StringConstructor;
default: undefined;
};
id: {
type: StringConstructor;
default: () => string;
};
}>> & {

@@ -172,5 +244,7 @@ onChange?: ((_value: Event & {

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

@@ -227,3 +301,3 @@ export declare let ComboboxOptions: import("vue").DefineComponent<{

value: {
type: (ObjectConstructor | BooleanConstructor | StringConstructor | NumberConstructor)[];
type: PropType<string | number | boolean | object | null>;
};

@@ -234,2 +308,6 @@ disabled: {

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

@@ -245,3 +323,3 @@ [key: string]: any;

value: {
type: (ObjectConstructor | BooleanConstructor | StringConstructor | NumberConstructor)[];
type: PropType<string | number | boolean | object | null>;
};

@@ -252,6 +330,10 @@ disabled: {

};
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 G,computed as g,defineComponent as A,h as _,inject as Q,nextTick as E,onMounted as q,onUnmounted as X,provide as Y,ref as w,toRaw as f,watch as J,watchEffect as K}from"vue";import{Features as N,render as F,omit as $,compact as Z}from'../../utils/render.js';import{useId as j}from'../../hooks/use-id.js';import{Keys as I}from'../../keyboard.js';import{calculateActiveIndex as z,Focus as T}from'../../utils/calculate-active-index.js';import{dom as P}from'../../utils/dom.js';import{useOpenClosed as ee,State as U,useOpenClosedProvider as te}from'../../internal/open-closed.js';import{match as M}from'../../utils/match.js';import{useResolveButtonType as oe}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 le}from'../../hooks/use-outside-click.js';import{Hidden as ie,Features as ue}from'../../internal/hidden.js';import{objectToFormEntries as re}from'../../utils/form.js';import{useControllable as se}from'../../hooks/use-controllable.js';function de(o,x){return o===x}var pe=(l=>(l[l.Open=0]="Open",l[l.Closed=1]="Closed",l))(pe||{}),be=(l=>(l[l.Single=0]="Single",l[l.Multi=1]="Multi",l))(be||{}),fe=(l=>(l[l.Pointer=0]="Pointer",l[l.Other=1]="Other",l))(fe||{});let W=Symbol("ComboboxContext");function L(o){let x=Q(W,null);if(x===null){let l=new Error(`<${o} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(l,L),l}return x}let Ae=A({name:"Combobox",emits:{"update:modelValue":o=>!0},props:{as:{type:[Object,String],default:"template"},disabled:{type:[Boolean],default:!1},by:{type:[String,Function],default:()=>de},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:x,attrs:l,emit:y}){let e=w(1),t=w(null),c=w(null),S=w(null),O=w(null),m=w({static:!1,hold:!1}),a=w([]),C=w(null),n=w(1),b=w(!1);function d(i=s=>s){let s=C.value!==null?a.value[C.value]:null,r=ae(i(a.value.slice()),v=>P(v.dataRef.domRef)),u=s?r.indexOf(s):null;return u===-1&&(u=null),{options:r,activeOptionIndex:u}}let R=g(()=>o.multiple?1:0),D=g(()=>o.nullable),[k,V]=se(g(()=>o.modelValue),i=>y("update:modelValue",i),g(()=>o.defaultValue)),p={comboboxState:e,value:k,mode:R,compare(i,s){if(typeof o.by=="string"){let r=o.by;return(i==null?void 0:i[r])===(s==null?void 0:s[r])}return o.by(i,s)},nullable:D,inputRef:c,labelRef:t,buttonRef:S,optionsRef:O,disabled:g(()=>o.disabled),options:a,change(i){V(i)},activeOptionIndex:g(()=>{if(b.value&&C.value===null&&a.value.length>0){let i=a.value.findIndex(s=>!s.dataRef.disabled);if(i!==-1)return i}return C.value}),activationTrigger:n,optionsPropsRef:m,closeCombobox(){b.value=!1,!o.disabled&&e.value!==1&&(e.value=1,C.value=null)},openCombobox(){if(b.value=!0,o.disabled||e.value===0)return;let i=a.value.findIndex(s=>{let r=f(s.dataRef.value);return M(R.value,{[0]:()=>p.compare(f(p.value.value),f(r)),[1]:()=>f(p.value.value).some(v=>p.compare(f(v),f(r)))})});i!==-1&&(C.value=i),e.value=0},goToOption(i,s,r){if(b.value=!1,o.disabled||O.value&&!m.value.static&&e.value===1)return;let u=d();if(u.activeOptionIndex===null){let h=u.options.findIndex(B=>!B.dataRef.disabled);h!==-1&&(u.activeOptionIndex=h)}let v=z(i===T.Specific?{focus:T.Specific,id:s}:{focus:i},{resolveItems:()=>u.options,resolveActiveIndex:()=>u.activeOptionIndex,resolveId:h=>h.id,resolveDisabled:h=>h.dataRef.disabled});C.value=v,n.value=r!=null?r:1,a.value=u.options},selectOption(i){let s=a.value.find(u=>u.id===i);if(!s)return;let{dataRef:r}=s;V(M(R.value,{[0]:()=>r.value,[1]:()=>{let u=f(p.value.value).slice(),v=f(r.value),h=u.findIndex(B=>p.compare(v,f(B)));return h===-1?u.push(v):u.splice(h,1),u}}))},selectActiveOption(){if(p.activeOptionIndex.value===null)return;let{dataRef:i,id:s}=a.value[p.activeOptionIndex.value];V(M(R.value,{[0]:()=>i.value,[1]:()=>{let r=f(p.value.value).slice(),u=f(i.value),v=r.findIndex(h=>p.compare(u,f(h)));return v===-1?r.push(u):r.splice(v,1),r}})),p.goToOption(T.Specific,s)},registerOption(i,s){let r={id:i,dataRef:s},u=d(v=>[...v,r]);if(C.value===null){let v=s.value.value;M(R.value,{[0]:()=>p.compare(f(p.value.value),f(v)),[1]:()=>f(p.value.value).some(B=>p.compare(f(B),f(v)))})&&(u.activeOptionIndex=u.options.indexOf(r))}a.value=u.options,C.value=u.activeOptionIndex,n.value=1},unregisterOption(i){let s=d(r=>{let u=r.findIndex(v=>v.id===i);return u!==-1&&r.splice(u,1),r});a.value=s.options,C.value=s.activeOptionIndex,n.value=1}};le([c,S,O],()=>p.closeCombobox(),g(()=>e.value===0)),Y(W,p),te(g(()=>M(e.value,{[0]:U.Open,[1]:U.Closed})));let H=g(()=>p.activeOptionIndex.value===null?null:a.value[p.activeOptionIndex.value].dataRef.value);return()=>{let{name:i,disabled:s,...r}=o,u={open:e.value===0,disabled:s,activeIndex:p.activeOptionIndex.value,activeOption:H.value,value:k.value};return _(G,[...i!=null&&k.value!=null?re({[i]:k.value}).map(([v,h])=>_(ie,Z({features:ue.Hidden,key:v,as:"input",type:"hidden",hidden:!0,readOnly:!0,name:v,value:h}))):[],F({theirProps:{...l,...$(r,["modelValue","defaultValue","nullable","multiple","onUpdate:modelValue","by"])},ourProps:{},slot:u,slots:x,attrs:l,name:"Combobox"})])}}}),Fe=A({name:"ComboboxLabel",props:{as:{type:[Object,String],default:"label"}},setup(o,{attrs:x,slots:l}){let y=L("ComboboxLabel"),e=`headlessui-combobox-label-${j()}`;function t(){var c;(c=P(y.inputRef))==null||c.focus({preventScroll:!0})}return()=>{let c={open:y.comboboxState.value===0,disabled:y.disabled.value},S={id:e,ref:y.labelRef,onClick:t};return F({ourProps:S,theirProps:o,slot:c,attrs:x,slots:l,name:"ComboboxLabel"})}}}),Le=A({name:"ComboboxButton",props:{as:{type:[Object,String],default:"button"}},setup(o,{attrs:x,slots:l,expose:y}){let e=L("ComboboxButton"),t=`headlessui-combobox-button-${j()}`;y({el:e.buttonRef,$el:e.buttonRef});function c(m){e.disabled.value||(e.comboboxState.value===0?e.closeCombobox():(m.preventDefault(),e.openCombobox()),E(()=>{var a;return(a=P(e.inputRef))==null?void 0:a.focus({preventScroll:!0})}))}function S(m){switch(m.key){case I.ArrowDown:m.preventDefault(),m.stopPropagation(),e.comboboxState.value===1&&e.openCombobox(),E(()=>{var a;return(a=e.inputRef.value)==null?void 0:a.focus({preventScroll:!0})});return;case I.ArrowUp:m.preventDefault(),m.stopPropagation(),e.comboboxState.value===1&&(e.openCombobox(),E(()=>{e.value.value||e.goToOption(T.Last)})),E(()=>{var a;return(a=e.inputRef.value)==null?void 0:a.focus({preventScroll:!0})});return;case I.Escape:if(e.comboboxState.value!==0)return;m.preventDefault(),e.optionsRef.value&&!e.optionsPropsRef.value.static&&m.stopPropagation(),e.closeCombobox(),E(()=>{var a;return(a=e.inputRef.value)==null?void 0:a.focus({preventScroll:!0})});return}}let O=oe(g(()=>({as:o.as,type:x.type})),e.buttonRef);return()=>{var n,b;let m={open:e.comboboxState.value===0,disabled:e.disabled.value,value:e.value.value},a={ref:e.buttonRef,id:t,type:O.value,tabindex:"-1","aria-haspopup":!0,"aria-controls":(n=P(e.optionsRef))==null?void 0:n.id,"aria-expanded":e.disabled.value?void 0:e.comboboxState.value===0,"aria-labelledby":e.labelRef.value?[(b=P(e.labelRef))==null?void 0:b.id,t].join(" "):void 0,disabled:e.disabled.value===!0?!0:void 0,onKeydown:S,onClick:c};return F({ourProps:a,theirProps:o,slot:m,attrs:x,slots:l,name:"ComboboxButton"})}}}),Be=A({name:"ComboboxInput",props:{as:{type:[Object,String],default:"input"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0},displayValue:{type:Function}},emits:{change:o=>!0},setup(o,{emit:x,attrs:l,slots:y,expose:e}){let t=L("ComboboxInput"),c=`headlessui-combobox-input-${j()}`;e({el:t.inputRef,$el:t.inputRef});let S=w(t.value.value),O=()=>{var b;let n=t.value.value;return P(t.inputRef)?typeof o.displayValue!="undefined"?(b=o.displayValue(n))!=null?b:"":typeof n=="string"?n:"":""};q(()=>{J([t.value],()=>S.value=O(),{flush:"sync",immediate:!0}),J([S,t.comboboxState],([n,b],[d,R])=>{let D=P(t.inputRef);!D||(R===0&&b===1||n!==d)&&(D.value=n)},{immediate:!0})});function m(n){switch(n.key){case I.Backspace:case I.Delete:if(t.mode.value!==0||!t.nullable.value)return;let b=n.currentTarget;requestAnimationFrame(()=>{if(b.value===""){t.change(null);let d=P(t.optionsRef);d&&(d.scrollTop=0),t.goToOption(T.Nothing)}});break;case I.Enter:if(t.comboboxState.value!==0)return;if(n.preventDefault(),n.stopPropagation(),t.activeOptionIndex.value===null){t.closeCombobox();return}t.selectActiveOption(),t.mode.value===0&&t.closeCombobox();break;case I.ArrowDown:return n.preventDefault(),n.stopPropagation(),M(t.comboboxState.value,{[0]:()=>t.goToOption(T.Next),[1]:()=>t.openCombobox()});case I.ArrowUp:return n.preventDefault(),n.stopPropagation(),M(t.comboboxState.value,{[0]:()=>t.goToOption(T.Previous),[1]:()=>{t.openCombobox(),E(()=>{t.value.value||t.goToOption(T.Last)})}});case I.Home:case I.PageUp:return n.preventDefault(),n.stopPropagation(),t.goToOption(T.First);case I.End:case I.PageDown:return n.preventDefault(),n.stopPropagation(),t.goToOption(T.Last);case I.Escape:if(t.comboboxState.value!==0)return;n.preventDefault(),t.optionsRef.value&&!t.optionsPropsRef.value.static&&n.stopPropagation(),t.closeCombobox();break;case I.Tab:if(t.comboboxState.value!==0)return;t.mode.value===0&&t.selectActiveOption(),t.closeCombobox();break}}function a(n){x("change",n)}function C(n){t.openCombobox(),x("change",n)}return()=>{var R,D,k,V,p,H;let n={open:t.comboboxState.value===0},b={"aria-controls":(R=t.optionsRef.value)==null?void 0:R.id,"aria-expanded":t.disabled.value?void 0:t.comboboxState.value===0,"aria-activedescendant":t.activeOptionIndex.value===null||(D=t.options.value[t.activeOptionIndex.value])==null?void 0:D.id,"aria-multiselectable":t.mode.value===1?!0:void 0,"aria-labelledby":(p=(k=P(t.labelRef))==null?void 0:k.id)!=null?p:(V=P(t.buttonRef))==null?void 0:V.id,id:c,onKeydown:m,onChange:a,onInput:C,role:"combobox",type:(H=l.type)!=null?H:"text",tabIndex:0,ref:t.inputRef},d=$(o,["displayValue"]);return F({ourProps:b,theirProps:d,slot:n,attrs:l,slots:y,features:N.RenderStrategy|N.Static,name:"ComboboxInput"})}}}),je=A({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:x,slots:l,expose:y}){let e=L("ComboboxOptions"),t=`headlessui-combobox-options-${j()}`;y({el:e.optionsRef,$el:e.optionsRef}),K(()=>{e.optionsPropsRef.value.static=o.static}),K(()=>{e.optionsPropsRef.value.hold=o.hold});let c=ee(),S=g(()=>c!==null?c.value===U.Open:e.comboboxState.value===0);return ne({container:g(()=>P(e.optionsRef)),enabled:g(()=>e.comboboxState.value===0),accept(O){return O.getAttribute("role")==="option"?NodeFilter.FILTER_REJECT:O.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(O){O.setAttribute("role","none")}}),()=>{var C,n,b,d;let O={open:e.comboboxState.value===0},m={"aria-activedescendant":e.activeOptionIndex.value===null||(C=e.options.value[e.activeOptionIndex.value])==null?void 0:C.id,"aria-labelledby":(d=(n=P(e.labelRef))==null?void 0:n.id)!=null?d:(b=P(e.buttonRef))==null?void 0:b.id,id:t,ref:e.optionsRef,role:"listbox"},a=$(o,["hold"]);return F({ourProps:m,theirProps:a,slot:O,attrs:x,slots:l,features:N.RenderStrategy|N.Static,visible:S.value,name:"ComboboxOptions"})}}}),He=A({name:"ComboboxOption",props:{as:{type:[Object,String],default:"li"},value:{type:[Object,String,Number,Boolean]},disabled:{type:Boolean,default:!1}},setup(o,{slots:x,attrs:l,expose:y}){let e=L("ComboboxOption"),t=`headlessui-combobox-option-${j()}`,c=w(null);y({el:c,$el:c});let S=g(()=>e.activeOptionIndex.value!==null?e.options.value[e.activeOptionIndex.value].id===t:!1),O=g(()=>M(e.mode.value,{[0]:()=>e.compare(f(e.value.value),f(o.value)),[1]:()=>f(e.value.value).some(d=>e.compare(f(d),f(o.value)))})),m=g(()=>({disabled:o.disabled,value:o.value,domRef:c}));q(()=>e.registerOption(t,m)),X(()=>e.unregisterOption(t)),K(()=>{e.comboboxState.value===0&&(!S.value||e.activationTrigger.value!==0&&E(()=>{var d,R;return(R=(d=P(c))==null?void 0:d.scrollIntoView)==null?void 0:R.call(d,{block:"nearest"})}))});function a(d){if(o.disabled)return d.preventDefault();e.selectOption(t),e.mode.value===0&&e.closeCombobox()}function C(){if(o.disabled)return e.goToOption(T.Nothing);e.goToOption(T.Specific,t)}function n(){o.disabled||S.value||e.goToOption(T.Specific,t,0)}function b(){o.disabled||!S.value||e.optionsPropsRef.value.hold||e.goToOption(T.Nothing)}return()=>{let{disabled:d}=o,R={active:S.value,selected:O.value,disabled:d},D={id:t,ref:c,role:"option",tabIndex:d===!0?void 0:-1,"aria-disabled":d===!0?!0:void 0,"aria-selected":O.value,disabled:void 0,onClick:a,onFocus:C,onPointermove:n,onMousemove:n,onPointerleave:b,onMouseleave:b};return F({ourProps:D,theirProps:o,slot:R,attrs:l,slots:x,name:"ComboboxOption"})}}});export{Ae as Combobox,Le as ComboboxButton,Be as ComboboxInput,Fe as ComboboxLabel,He as ComboboxOption,je 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, }?: {

@@ -12,2 +12,6 @@ slot?: Ref<Record<string, unknown>>;

};
id: {
type: StringConstructor;
default: () => string;
};
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {

@@ -22,4 +26,9 @@ [key: string]: any;

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

@@ -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 p,unref as y}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=R(u,null);if(t===null)throw new Error("Missing parent");return t}function P({slot:t=p({}),name:o="Description",props:s={}}={}){let e=p([]);function n(r){return e.value.push(r),()=>{let i=e.value.indexOf(r);i!==-1&&e.value.splice(i,1)}}return j(u,{register:n,slot:t,name:o,props:s}),m(()=>e.value.length>0?e.value.join(" "):void 0)}let S=x({name:"Description",props:{as:{type:[Object,String],default:"p"}},setup(t,{attrs:o,slots:s}){let e=b(),n=`headlessui-description-${C()}`;return v(()=>D(e.register(n))),()=>{let{name:r="Description",slot:i=p({}),props:l={}}=e,c=t,d={...Object.entries(l).reduce((f,[a,g])=>Object.assign(f,{[a]:y(g)}),{}),id:n};return h({ourProps:d,theirProps:c,slot:i.value,attrs:o,slots:s,name:r})}}});export{S as Description,P 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<{

@@ -23,2 +23,10 @@ as: {

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

@@ -49,5 +57,15 @@ [key: string]: any;

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

@@ -64,2 +82,6 @@ unmount: boolean;

};
id: {
type: StringConstructor;
default: () => string;
};
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {

@@ -74,3 +96,8 @@ [key: string]: any;

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

@@ -83,2 +110,6 @@ }>;

};
id: {
type: StringConstructor;
default: () => string;
};
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {

@@ -91,3 +122,8 @@ [key: string]: any;

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

@@ -100,2 +136,6 @@ }>;

};
id: {
type: StringConstructor;
default: () => string;
};
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {

@@ -110,3 +150,8 @@ [key: string]: any;

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

@@ -119,2 +164,6 @@ }>;

};
id: {
type: StringConstructor;
default: () => string;
};
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {

@@ -129,3 +178,8 @@ [key: string]: any;

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

@@ -138,2 +192,6 @@ }>;

};
id: {
type: StringConstructor;
default: () => string;
};
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {

@@ -148,4 +206,9 @@ [key: string]: any;

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

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

import{computed as c,defineComponent as y,h as D,inject as K,nextTick as ee,onMounted as M,onUnmounted as te,provide as le,ref as h,watchEffect as N}from"vue";import{render as P,Features as V}from'../../utils/render.js';import{Keys as oe}from'../../keyboard.js';import{useId as w}from'../../hooks/use-id.js';import{FocusTrap as R}from'../../components/focus-trap/focus-trap.js';import{useInertOthers as ae}from'../../hooks/use-inert-others.js';import{Portal as Y,PortalGroup as re}from'../portal/portal.js';import{StackMessage as _,useStackProvider as ie}from'../../internal/stack-context.js';import{match as F}from'../../utils/match.js';import{ForcePortalRoot as $}from'../../internal/portal-force-root.js';import{Description as ne,useDescriptions as ue}from'../description/description.js';import{dom as U}from'../../utils/dom.js';import{useOpenClosed as se,State as q}from'../../internal/open-closed.js';import{useOutsideClick as pe}from'../../hooks/use-outside-click.js';import{getOwnerDocument as de}from'../../utils/owner.js';import{useEventListener as fe}from'../../hooks/use-event-listener.js';import{Hidden as ce,Features as ge}from'../../internal/hidden.js';import{disposables as me}from'../../utils/disposables.js';import{isIOS as ve}from'../../utils/platform.js';var De=(t=>(t[t.Open=0]="Open",t[t.Closed=1]="Closed",t))(De||{});let j=Symbol("DialogContext");function T(a){let u=K(j,null);if(u===null){let t=new Error(`<${a} /> is missing a parent <Dialog /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,T),t}return u}let k="DC8F892D-2EBD-447C-A4C8-A03058436FF4",Ne=y({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:k},initialFocus:{type:Object,default:null}},emits:{close:a=>!0},setup(a,{emit:u,attrs:t,slots:s,expose:i}){var A;let g=h(!1);M(()=>{g.value=!0});let r=h(0),d=se(),S=c(()=>a.open===k&&d!==null?F(d.value,{[q.Open]:!0,[q.Closed]:!1}):a.open),x=h(new Set),m=h(null),B=h(null),I=c(()=>de(m));if(i({el:m,$el:m}),!(a.open!==k||d!==null))throw new Error("You forgot to provide an `open` prop to the `Dialog`.");if(typeof S.value!="boolean")throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${S.value===k?void 0:a.open}`);let f=c(()=>g.value&&S.value?0:1),H=c(()=>f.value===0),C=c(()=>r.value>1),G=K(j,null)!==null,z=c(()=>C.value?"parent":"leaf");ae(m,c(()=>C.value?H.value:!1)),ie({type:"Dialog",enabled:c(()=>f.value===0),element:m,onUpdate:(o,l,n)=>{if(l==="Dialog")return F(o,{[_.Add](){x.value.add(n),r.value+=1},[_.Remove](){x.value.delete(n),r.value-=1}})}});let J=ue({name:"DialogDescription",slot:c(()=>({open:S.value}))}),Q=`headlessui-dialog-${w()}`,E=h(null),O={titleId:E,panelRef:h(null),dialogState:f,setTitleId(o){E.value!==o&&(E.value=o)},close(){u("close",!1)}};return le(j,O),pe(()=>{var l,n,p;return[...Array.from((n=(l=I.value)==null?void 0:l.querySelectorAll("body > *, [data-headlessui-portal]"))!=null?n:[]).filter(e=>!(!(e instanceof HTMLElement)||e.contains(U(B))||O.panelRef.value&&e.contains(O.panelRef.value))),(p=O.panelRef.value)!=null?p:m.value]},(o,l)=>{O.close(),ee(()=>l==null?void 0:l.focus())},c(()=>f.value===0&&!C.value)),fe((A=I.value)==null?void 0:A.defaultView,"keydown",o=>{o.defaultPrevented||o.key===oe.Escape&&f.value===0&&(C.value||(o.preventDefault(),o.stopPropagation(),O.close()))}),N(o=>{var W;if(f.value!==0||G)return;let l=I.value;if(!l)return;let n=me();function p(v,b,X){let Z=v.style.getPropertyValue(b);return Object.assign(v.style,{[b]:X}),n.add(()=>{Object.assign(v.style,{[b]:Z})})}let e=l==null?void 0:l.documentElement,L=((W=l.defaultView)!=null?W:window).innerWidth-e.clientWidth;if(p(e,"overflow","hidden"),L>0){let v=e.clientWidth-e.offsetWidth,b=L-v;p(e,"paddingRight",`${b}px`)}if(ve()){let v=window.pageYOffset;p(e,"position","fixed"),p(e,"marginTop",`-${v}px`),p(e,"width","100%"),n.add(()=>window.scrollTo(0,v))}o(n.dispose)}),N(o=>{if(f.value!==0)return;let l=U(m);if(!l)return;let n=new IntersectionObserver(p=>{for(let e of p)e.boundingClientRect.x===0&&e.boundingClientRect.y===0&&e.boundingClientRect.width===0&&e.boundingClientRect.height===0&&O.close()});n.observe(l),o(()=>n.disconnect())}),()=>{let o={...t,ref:m,id:Q,role:"dialog","aria-modal":f.value===0?!0:void 0,"aria-labelledby":E.value,"aria-describedby":J.value},{open:l,initialFocus:n,...p}=a,e={open:f.value===0};return D($,{force:!0},()=>[D(Y,()=>D(re,{target:m.value},()=>D($,{force:!1},()=>D(R,{initialFocus:n,containers:x,features:H.value?F(z.value,{parent:R.features.RestoreFocus,leaf:R.features.All&~R.features.FocusLock}):R.features.None},()=>P({ourProps:o,theirProps:p,slot:e,attrs:t,slots:s,visible:f.value===0,features:V.RenderStrategy|V.Static,name:"Dialog"}))))),D(ce,{features:ge.Hidden,ref:B})])}}}),Ve=y({name:"DialogOverlay",props:{as:{type:[Object,String],default:"div"}},setup(a,{attrs:u,slots:t}){let s=T("DialogOverlay"),i=`headlessui-dialog-overlay-${w()}`;function g(r){r.target===r.currentTarget&&(r.preventDefault(),r.stopPropagation(),s.close())}return()=>P({ourProps:{id:i,"aria-hidden":!0,onClick:g},theirProps:a,slot:{open:s.dialogState.value===0},attrs:u,slots:t,name:"DialogOverlay"})}}),Ye=y({name:"DialogBackdrop",props:{as:{type:[Object,String],default:"div"}},inheritAttrs:!1,setup(a,{attrs:u,slots:t,expose:s}){let i=T("DialogBackdrop"),g=`headlessui-dialog-backdrop-${w()}`,r=h(null);return s({el:r,$el:r}),M(()=>{if(i.panelRef.value===null)throw new Error("A <DialogBackdrop /> component is being used, but a <DialogPanel /> component is missing.")}),()=>{let d=a,S={id:g,ref:r,"aria-hidden":!0};return D($,{force:!0},()=>D(Y,()=>P({ourProps:S,theirProps:{...u,...d},slot:{open:i.dialogState.value===0},attrs:u,slots:t,name:"DialogBackdrop"})))}}}),_e=y({name:"DialogPanel",props:{as:{type:[Object,String],default:"div"}},setup(a,{attrs:u,slots:t,expose:s}){let i=T("DialogPanel"),g=`headlessui-dialog-panel-${w()}`;s({el:i.panelRef,$el:i.panelRef});function r(d){d.stopPropagation()}return()=>{let d={id:g,ref:i.panelRef,onClick:r};return P({ourProps:d,theirProps:a,slot:{open:i.dialogState.value===0},attrs:u,slots:t,name:"DialogPanel"})}}}),Ue=y({name:"DialogTitle",props:{as:{type:[Object,String],default:"h2"}},setup(a,{attrs:u,slots:t}){let s=T("DialogTitle"),i=`headlessui-dialog-title-${w()}`;return M(()=>{s.setTitleId(i),te(()=>s.setTitleId(null))}),()=>P({ourProps:{id:i},theirProps:a,slot:{open:s.dialogState.value===0},attrs:u,slots:t,name:"DialogTitle"})}}),qe=ne;export{Ne as Dialog,Ye as DialogBackdrop,qe as DialogDescription,Ve as DialogOverlay,_e as DialogPanel,Ue 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};

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

};
id: {
type: StringConstructor;
default: null;
};
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {

@@ -50,3 +54,8 @@ [key: string]: any;

};
id: {
type: StringConstructor;
default: null;
};
}>>, {
id: string;
as: string | Record<string, any>;

@@ -68,2 +77,6 @@ disabled: boolean;

};
id: {
type: StringConstructor;
default: null;
};
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {

@@ -86,3 +99,8 @@ [key: string]: any;

};
id: {
type: StringConstructor;
default: null;
};
}>>, {
id: string;
as: string | Record<string, any>;

@@ -89,0 +107,0 @@ unmount: boolean;

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

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

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

@@ -24,3 +25,3 @@ /** No features enabled for the focus trap. */

initialFocus: HTMLElement | null;
containers: Ref<Set<Ref<HTMLElement | null>>>;
containers: Containers;
}> & Omit<Readonly<import("vue").ExtractPropTypes<{

@@ -40,3 +41,3 @@ as: {

containers: {
type: PropType<Ref<Set<Ref<HTMLElement | null>>>>;
type: PropType<Containers>;
default: Ref<Set<unknown>>;

@@ -72,3 +73,3 @@ };

containers: {
type: PropType<Ref<Set<Ref<HTMLElement | null>>>>;
type: PropType<Containers>;
default: Ref<Set<unknown>>;

@@ -82,3 +83,3 @@ };

initialFocus: HTMLElement | null;
containers: Ref<Set<Ref<HTMLElement | null>>>;
containers: Containers;
}> & {

@@ -118,3 +119,3 @@ beforeCreate?: ((() => void) | (() => void)[]) | undefined;

containers: {
type: PropType<Ref<Set<Ref<HTMLElement | null>>>>;
type: PropType<Containers>;
default: Ref<Set<unknown>>;

@@ -124,3 +125,3 @@ };

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

@@ -143,3 +144,3 @@ __isTeleport?: undefined;

containers: {
type: PropType<Ref<Set<Ref<HTMLElement | null>>>>;
type: PropType<Containers>;
default: Ref<Set<unknown>>;

@@ -153,3 +154,3 @@ };

initialFocus: HTMLElement | null;
containers: Ref<Set<Ref<HTMLElement | null>>>;
containers: Containers;
}> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & {

@@ -156,0 +157,0 @@ features: typeof Features;

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

import{computed as m,defineComponent as k,h as d,onMounted as v,onUnmounted as H,ref as T,watch as R,Fragment as P}from"vue";import{render as B}from'../../utils/render.js';import{Hidden as M,Features as D}from'../../internal/hidden.js';import{dom as L}from'../../utils/dom.js';import{focusIn as b,Focus as F,focusElement as E,FocusResult as I}from'../../utils/focus-management.js';import{match as S}from'../../utils/match.js';import{useTabDirection as g,Direction as w}from'../../hooks/use-tab-direction.js';import{getOwnerDocument as N}from'../../utils/owner.js';import{useEventListener as O}from'../../hooks/use-event-listener.js';import{microTask as j}from'../../utils/micro-task.js';var h=(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))(h||{});let ee=Object.assign(k({name:"FocusTrap",props:{as:{type:[Object,String],default:"div"},initialFocus:{type:Object,default:null},features:{type:Number,default:30},containers:{type:Object,default:T(new Set)}},inheritAttrs:!1,setup(u,{attrs:a,slots:t,expose:r}){let n=T(null);r({el:n,$el:n});let o=m(()=>N(n));A({ownerDocument:o},m(()=>Boolean(u.features&16)));let e=C({ownerDocument:o,container:n,initialFocus:m(()=>u.initialFocus)},m(()=>Boolean(u.features&2)));_({ownerDocument:o,container:n,containers:u.containers,previousActiveElement:e},m(()=>Boolean(u.features&8)));let s=g();function i(){let l=L(n);!l||S(s.value,{[w.Forwards]:()=>b(l,F.First),[w.Backwards]:()=>b(l,F.Last)})}return()=>{let l={},c={ref:n},{features:f,initialFocus:p,containers:U,...y}=u;return d(P,[Boolean(f&4)&&d(M,{as:"button",type:"button",onFocus:i,features:D.Focusable}),B({ourProps:c,theirProps:{...a,...y},slot:l,attrs:a,slots:t,name:"FocusTrap"}),Boolean(f&4)&&d(M,{as:"button",type:"button",onFocus:i,features:D.Focusable})])}}}),{features:h});function A({ownerDocument:u},a){let t=T(null);function r(){var o;t.value||(t.value=(o=u.value)==null?void 0:o.activeElement)}function n(){!t.value||(E(t.value),t.value=null)}v(()=>{R(a,(o,e)=>{o!==e&&(o?r():n())},{immediate:!0})}),H(n)}function C({ownerDocument:u,container:a,initialFocus:t},r){let n=T(null),o=T(!1);return v(()=>o.value=!0),H(()=>o.value=!1),v(()=>{R([a,t,r],(e,s)=>{if(e.every((l,c)=>(s==null?void 0:s[c])===l)||!r.value)return;let i=L(a);!i||j(()=>{var f,p;if(!o.value)return;let l=L(t),c=(f=u.value)==null?void 0:f.activeElement;if(l){if(l===c){n.value=c;return}}else if(i.contains(c)){n.value=c;return}l?E(l):b(i,F.First|F.NoScroll)===I.Error&&console.warn("There are no focusable elements inside the <FocusTrap />"),n.value=(p=u.value)==null?void 0:p.activeElement})},{immediate:!0,flush:"post"})}),n}function _({ownerDocument:u,container:a,containers:t,previousActiveElement:r},n){var o;O((o=u.value)==null?void 0:o.defaultView,"focus",e=>{if(!n.value)return;let s=new Set(t==null?void 0:t.value);s.add(a);let i=r.value;if(!i)return;let l=e.target;l&&l instanceof HTMLElement?x(s,l)?(r.value=l,E(l)):(e.preventDefault(),e.stopPropagation(),E(i)):E(r.value)},!0)}function x(u,a){var t;for(let r of u)if((t=r.value)!=null&&t.contains(a))return!0;return!1}export{ee 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, }?: {

@@ -16,2 +16,6 @@ slot?: Record<string, unknown>;

};
id: {
type: StringConstructor;
default: () => string;
};
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {

@@ -30,5 +34,10 @@ [key: string]: any;

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

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

import{computed as g,defineComponent as v,inject as x,onMounted as L,onUnmounted as k,provide as C,ref as j,unref as w}from"vue";import{useId as R}from'../../hooks/use-id.js';import{render as h}from'../../utils/render.js';let a=Symbol("LabelContext");function p(){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,p),n}return t}function K({slot:t={},name:n="Label",props:i={}}={}){let e=j([]);function r(o){return e.value.push(o),()=>{let l=e.value.indexOf(o);l!==-1&&e.value.splice(l,1)}}return C(a,{register:r,slot:t,name:n,props:i}),g(()=>e.value.length>0?e.value.join(" "):void 0)}let P=v({name:"Label",props:{as:{type:[Object,String],default:"label"},passive:{type:[Boolean],default:!1}},setup(t,{slots:n,attrs:i}){let e=p(),r=`headlessui-label-${R()}`;return L(()=>k(e.register(r))),()=>{let{name:o="Label",slot:l={},props:d={}}=e,{passive:c,...s}=t,u={...Object.entries(d).reduce((f,[b,m])=>Object.assign(f,{[b]:w(m)}),{}),id:r};return c&&(delete u.onClick,delete s.onClick),h({ourProps:u,theirProps:s,slot:l,attrs:i,slots:n,name:o})}}});export{P 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};

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

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

@@ -20,9 +21,13 @@ export declare let Listbox: import("vue").DefineComponent<{

modelValue: {
type: (ObjectConstructor | BooleanConstructor | StringConstructor | NumberConstructor)[];
type: PropType<string | number | boolean | object | null>;
default: undefined;
};
defaultValue: {
type: (ObjectConstructor | BooleanConstructor | StringConstructor | NumberConstructor)[];
type: PropType<string | number | boolean | object | null>;
default: undefined;
};
form: {
type: StringConstructor;
optional: boolean;
};
name: {

@@ -58,9 +63,13 @@ type: StringConstructor;

modelValue: {
type: (ObjectConstructor | BooleanConstructor | StringConstructor | NumberConstructor)[];
type: PropType<string | number | boolean | object | null>;
default: undefined;
};
defaultValue: {
type: (ObjectConstructor | BooleanConstructor | StringConstructor | NumberConstructor)[];
type: PropType<string | number | boolean | object | null>;
default: undefined;
};
form: {
type: StringConstructor;
optional: boolean;
};
name: {

@@ -79,7 +88,7 @@ type: StringConstructor;

disabled: boolean;
horizontal: boolean;
by: string | Function;
modelValue: string | number | boolean | Record<string, any>;
defaultValue: string | number | boolean | Record<string, any>;
modelValue: string | number | boolean | object | null;
defaultValue: string | number | boolean | object | null;
multiple: boolean;
horizontal: boolean;
}>;

@@ -91,2 +100,6 @@ export declare let ListboxLabel: import("vue").DefineComponent<{

};
id: {
type: StringConstructor;
default: () => string;
};
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {

@@ -101,3 +114,8 @@ [key: string]: any;

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

@@ -110,2 +128,6 @@ }>;

};
id: {
type: StringConstructor;
default: () => string;
};
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {

@@ -120,3 +142,8 @@ [key: string]: any;

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

@@ -137,2 +164,6 @@ }>;

};
id: {
type: StringConstructor;
default: () => string;
};
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {

@@ -155,3 +186,8 @@ [key: string]: any;

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

@@ -167,3 +203,3 @@ unmount: boolean;

value: {
type: (ObjectConstructor | BooleanConstructor | StringConstructor | NumberConstructor)[];
type: PropType<string | number | boolean | object | null>;
};

@@ -174,2 +210,6 @@ disabled: {

};
id: {
type: StringConstructor;
default: () => string;
};
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {

@@ -185,3 +225,3 @@ [key: string]: any;

value: {
type: (ObjectConstructor | BooleanConstructor | StringConstructor | NumberConstructor)[];
type: PropType<string | number | boolean | object | null>;
};

@@ -192,3 +232,8 @@ disabled: {

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

@@ -195,0 +240,0 @@ disabled: boolean;

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

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

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

};
id: {
type: StringConstructor;
default: () => string;
};
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {

@@ -41,3 +45,8 @@ [key: string]: any;

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

@@ -59,2 +68,6 @@ disabled: boolean;

};
id: {
type: StringConstructor;
default: () => string;
};
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {

@@ -77,3 +90,8 @@ [key: string]: any;

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

@@ -92,2 +110,6 @@ unmount: boolean;

};
id: {
type: StringConstructor;
default: () => string;
};
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {

@@ -106,5 +128,10 @@ [key: string]: any;

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

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

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

@@ -28,2 +26,6 @@ type: (ObjectConstructor | StringConstructor)[];

};
id: {
type: StringConstructor;
default: () => string;
};
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {

@@ -40,3 +42,8 @@ [key: string]: any;

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

@@ -97,2 +104,6 @@ disabled: boolean;

};
id: {
type: StringConstructor;
default: () => string;
};
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {

@@ -119,7 +130,12 @@ [key: string]: any;

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

@@ -133,5 +149,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: {

@@ -138,0 +152,0 @@ type: (ObjectConstructor | StringConstructor)[];

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

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

@@ -28,2 +32,6 @@ type: StringConstructor;

};
id: {
type: StringConstructor;
default: () => string;
};
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {

@@ -47,9 +55,13 @@ [key: string]: any;

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

@@ -59,5 +71,10 @@ type: StringConstructor;

};
id: {
type: StringConstructor;
default: () => string;
};
}>> & {
"onUpdate:modelValue"?: ((_value: any) => any) | undefined;
}, {
id: string;
as: string | Record<string, any>;

@@ -75,3 +92,3 @@ disabled: boolean;

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

@@ -82,2 +99,6 @@ disabled: {

};
id: {
type: StringConstructor;
default: () => string;
};
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {

@@ -93,3 +114,3 @@ [key: string]: any;

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

@@ -100,3 +121,8 @@ disabled: {

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

@@ -114,2 +140,6 @@ disabled: boolean;

};
id: {
type: StringConstructor;
default: () => string;
};
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {

@@ -128,5 +158,10 @@ [key: string]: any;

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

@@ -138,2 +173,6 @@ export declare let RadioGroupDescription: import("vue").DefineComponent<{

};
id: {
type: StringConstructor;
default: () => string;
};
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {

@@ -148,5 +187,10 @@ [key: string]: any;

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

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

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

@@ -29,4 +29,8 @@ export declare let SwitchGroup: import("vue").DefineComponent<{

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

@@ -40,2 +44,14 @@ type: StringConstructor;

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

@@ -56,4 +72,8 @@ [key: string]: any;

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

@@ -67,6 +87,21 @@ type: StringConstructor;

};
id: {
type: StringConstructor;
default: () => string;
};
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>;
disabled: boolean;
modelValue: boolean;

@@ -84,2 +119,6 @@ defaultChecked: boolean;

};
id: {
type: StringConstructor;
default: () => string;
};
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {

@@ -98,5 +137,10 @@ [key: string]: any;

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

@@ -108,2 +152,6 @@ export declare let SwitchDescription: import("vue").DefineComponent<{

};
id: {
type: StringConstructor;
default: () => string;
};
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {

@@ -118,4 +166,9 @@ [key: string]: any;

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

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

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

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

};
id: {
type: StringConstructor;
default: () => string;
};
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {

@@ -96,3 +100,8 @@ [key: string]: any;

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

@@ -131,2 +140,10 @@ disabled: boolean;

};
id: {
type: StringConstructor;
default: () => string;
};
tabIndex: {
type: NumberConstructor;
default: number;
};
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {

@@ -149,3 +166,13 @@ [key: string]: any;

};
id: {
type: StringConstructor;
default: () => string;
};
tabIndex: {
type: NumberConstructor;
default: number;
};
}>>, {
id: string;
tabIndex: number;
as: string | Record<string, any>;

@@ -152,0 +179,0 @@ unmount: boolean;

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

import{Fragment as k,computed as v,defineComponent as h,h as L,inject as A,onMounted as w,onUnmounted as D,provide as j,ref as I,watchEffect as B}from"vue";import{Features as M,render as S,omit as F}from'../../utils/render.js';import{useId as H}from'../../hooks/use-id.js';import{Keys as b}from'../../keyboard.js';import{dom as y}from'../../utils/dom.js';import{match as C}from'../../utils/match.js';import{focusIn as P,Focus as m}from'../../utils/focus-management.js';import{useResolveButtonType as K}from'../../hooks/use-resolve-button-type.js';import{FocusSentinel as $}from'../../internal/focus-sentinel.js';import{microTask as G}from'../../utils/micro-task.js';import{Hidden as N}from'../../internal/hidden.js';let O=Symbol("TabsContext");function E(a){let u=A(O,null);if(u===null){let i=new Error(`<${a} /> is missing a parent <TabGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(i,E),i}return u}let le=h({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:u,attrs:i,emit:f}){let e=I(null),o=I([]),n=I([]),p=v(()=>a.selectedIndex!==null),c=v(()=>p.value?a.selectedIndex:e.value),x={selectedIndex:e,orientation:v(()=>a.vertical?"vertical":"horizontal"),activation:v(()=>a.manual?"manual":"auto"),tabs:o,panels:n,setSelectedIndex(t){c.value!==t&&f("change",t),p.value||(e.value=t)},registerTab(t){o.value.includes(t)||o.value.push(t)},unregisterTab(t){let r=o.value.indexOf(t);r!==-1&&o.value.splice(r,1)},registerPanel(t){n.value.includes(t)||n.value.push(t)},unregisterPanel(t){let r=n.value.indexOf(t);r!==-1&&n.value.splice(r,1)}};return j(O,x),B(()=>{var R;if(x.tabs.value.length<=0||a.selectedIndex===null&&e.value!==null)return;let t=x.tabs.value.map(T=>y(T)).filter(Boolean),r=t.filter(T=>!T.hasAttribute("disabled")),s=(R=a.selectedIndex)!=null?R:a.defaultIndex;if(s<0)e.value=t.indexOf(r[0]);else if(s>x.tabs.value.length)e.value=t.indexOf(r[r.length-1]);else{let T=t.slice(0,s),d=[...t.slice(s),...T].find(g=>r.includes(g));if(!d)return;e.value=t.indexOf(d)}}),()=>{let t={selectedIndex:e.value};return L(k,[o.value.length<=0&&L($,{onFocus:()=>{for(let r of o.value){let s=y(r);if((s==null?void 0:s.tabIndex)===0)return s.focus(),!0}return!1}}),S({theirProps:{...i,...F(a,["selectedIndex","defaultIndex","manual","vertical","onChange"])},ourProps:{},slot:t,slots:u,attrs:i,name:"TabGroup"})])}}}),ae=h({name:"TabList",props:{as:{type:[Object,String],default:"div"}},setup(a,{attrs:u,slots:i}){let f=E("TabList");return()=>{let e={selectedIndex:f.selectedIndex.value},o={role:"tablist","aria-orientation":f.orientation.value};return S({ourProps:o,theirProps:a,slot:e,attrs:u,slots:i,name:"TabList"})}}}),ne=h({name:"Tab",props:{as:{type:[Object,String],default:"button"},disabled:{type:[Boolean],default:!1}},setup(a,{attrs:u,slots:i,expose:f}){let e=E("Tab"),o=`headlessui-tabs-tab-${H()}`,n=I(null);f({el:n,$el:n}),w(()=>e.registerTab(n)),D(()=>e.unregisterTab(n));let p=v(()=>e.tabs.value.indexOf(n)),c=v(()=>p.value===e.selectedIndex.value);function x(l){let d=e.tabs.value.map(g=>y(g)).filter(Boolean);if(l.key===b.Space||l.key===b.Enter){l.preventDefault(),l.stopPropagation(),e.setSelectedIndex(p.value);return}switch(l.key){case b.Home:case b.PageUp:return l.preventDefault(),l.stopPropagation(),P(d,m.First);case b.End:case b.PageDown:return l.preventDefault(),l.stopPropagation(),P(d,m.Last)}if(C(e.orientation.value,{vertical(){if(l.key===b.ArrowUp)return P(d,m.Previous|m.WrapAround);if(l.key===b.ArrowDown)return P(d,m.Next|m.WrapAround)},horizontal(){if(l.key===b.ArrowLeft)return P(d,m.Previous|m.WrapAround);if(l.key===b.ArrowRight)return P(d,m.Next|m.WrapAround)}}))return l.preventDefault()}function t(){var l;(l=y(n))==null||l.focus()}let r=I(!1);function s(){var l;r.value||(r.value=!0,!a.disabled&&((l=y(n))==null||l.focus(),e.setSelectedIndex(p.value),G(()=>{r.value=!1})))}function R(l){l.preventDefault()}let T=K(v(()=>({as:a.as,type:u.type})),n);return()=>{var g;let l={selected:c.value},d={ref:n,onKeydown:x,onFocus:e.activation.value==="manual"?t:s,onMousedown:R,onClick:s,id:o,role:"tab",type:T.value,"aria-controls":(g=y(e.panels.value[p.value]))==null?void 0:g.id,"aria-selected":c.value,tabIndex:c.value?0:-1,disabled:a.disabled?!0:void 0};return S({ourProps:d,theirProps:a,slot:l,attrs:u,slots:i,name:"Tab"})}}}),re=h({name:"TabPanels",props:{as:{type:[Object,String],default:"div"}},setup(a,{slots:u,attrs:i}){let f=E("TabPanels");return()=>{let e={selectedIndex:f.selectedIndex.value};return S({theirProps:a,ourProps:{},slot:e,attrs:i,slots:u,name:"TabPanels"})}}}),ue=h({name:"TabPanel",props:{as:{type:[Object,String],default:"div"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0}},setup(a,{attrs:u,slots:i,expose:f}){let e=E("TabPanel"),o=`headlessui-tabs-panel-${H()}`,n=I(null);f({el:n,$el:n}),w(()=>e.registerPanel(n)),D(()=>e.unregisterPanel(n));let p=v(()=>e.panels.value.indexOf(n)),c=v(()=>p.value===e.selectedIndex.value);return()=>{var r;let x={selected:c.value},t={ref:n,id:o,role:"tabpanel","aria-labelledby":(r=y(e.tabs.value[p.value]))==null?void 0:r.id,tabIndex:c.value?0:-1};return!c.value&&a.unmount?L(N,{as:"span",...t}):S({ourProps:t,theirProps:a,slot:x,attrs:u,slots:i,features:M.Static|M.RenderStrategy,visible:c.value,name:"TabPanel"})}}});export{ne as Tab,le as TabGroup,ae as TabList,ue as TabPanel,re 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 b,defineComponent as A,h as D,inject as L,onMounted as h,onUnmounted as I,provide as H,ref as T,watch as X,watchEffect as y}from"vue";import{useId as Y}from'../../hooks/use-id.js';import{match as E}from'../../utils/match.js';import{Features as Z,omit as ee,render as P,RenderStrategy as f}from'../../utils/render.js';import{Reason as j,transition as M}from'./utils/transition.js';import{dom as U}from'../../utils/dom.js';import{useOpenClosedProvider as te,State as V,useOpenClosed as ne,hasOpenClosed as re}from'../../internal/open-closed.js';function d(e=""){return e.split(" ").filter(t=>t.trim().length>1)}let B=Symbol("TransitionContext");var ae=(a=>(a.Visible="visible",a.Hidden="hidden",a))(ae||{});function le(){return L(B,null)!==null}function ie(){let e=L(B,null);if(e===null)throw new Error("A <TransitionChild /> is used but it is missing a parent <TransitionRoot />.");return e}function se(){let e=L(F,null);if(e===null)throw new Error("A <TransitionChild /> is used but it is missing a parent <TransitionRoot />.");return e}let F=Symbol("NestingContext");function w(e){return"children"in e?w(e.children):e.value.filter(({state:t})=>t==="visible").length>0}function K(e){let t=T([]),a=T(!1);h(()=>a.value=!0),I(()=>a.value=!1);function s(r,n=f.Hidden){let l=t.value.findIndex(({id:i})=>i===r);l!==-1&&(E(n,{[f.Unmount](){t.value.splice(l,1)},[f.Hidden](){t.value[l].state="hidden"}}),!w(t)&&a.value&&(e==null||e()))}function v(r){let n=t.value.find(({id:l})=>l===r);return n?n.state!=="visible"&&(n.state="visible"):t.value.push({id:r,state:"visible"}),()=>s(r,f.Unmount)}return{children:t,register:v,unregister:s}}let _=Z.RenderStrategy,oe=A({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:v}){if(!le()&&re())return()=>D(fe,{...e,onBeforeEnter:()=>t("beforeEnter"),onAfterEnter:()=>t("afterEnter"),onBeforeLeave:()=>t("beforeLeave"),onAfterLeave:()=>t("afterLeave")},s);let r=T(null),n=T("visible"),l=b(()=>e.unmount?f.Unmount:f.Hidden);v({el:r,$el:r});let{show:i,appear:x}=ie(),{register:g,unregister:p}=se(),R={value:!0},m=Y(),S={value:!1},N=K(()=>{S.value||(n.value="hidden",p(m),t("afterLeave"))});h(()=>{let o=g(m);I(o)}),y(()=>{if(l.value===f.Hidden&&!!m){if(i&&n.value!=="visible"){n.value="visible";return}E(n.value,{["hidden"]:()=>p(m),["visible"]:()=>g(m)})}});let k=d(e.enter),$=d(e.enterFrom),q=d(e.enterTo),O=d(e.entered),z=d(e.leave),G=d(e.leaveFrom),J=d(e.leaveTo);h(()=>{y(()=>{if(n.value==="visible"){let o=U(r);if(o instanceof Comment&&o.data==="")throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")}})});function Q(o){let c=R.value&&!x.value,u=U(r);!u||!(u instanceof HTMLElement)||c||(S.value=!0,i.value&&t("beforeEnter"),i.value||t("beforeLeave"),o(i.value?M(u,k,$,q,O,C=>{S.value=!1,C===j.Finished&&t("afterEnter")}):M(u,z,G,J,O,C=>{S.value=!1,C===j.Finished&&(w(N)||(n.value="hidden",p(m),t("afterLeave")))})))}return h(()=>{X([i],(o,c,u)=>{Q(u),R.value=!1},{immediate:!0})}),H(F,N),te(b(()=>E(n.value,{["visible"]:V.Open,["hidden"]:V.Closed}))),()=>{let{appear:o,show:c,enter:u,enterFrom:C,enterTo:de,entered:ve,leave:pe,leaveFrom:me,leaveTo:Te,...W}=e;return P({theirProps:W,ourProps:{ref:r},slot:{},slots:s,attrs:a,features:_,visible:n.value==="visible",name:"TransitionChild"})}}}),ue=oe,fe=A({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 v=ne(),r=b(()=>e.show===null&&v!==null?E(v.value,{[V.Open]:!0,[V.Closed]:!1}):e.show);y(()=>{if(![!0,!1].includes(r.value))throw new Error('A <Transition /> is used but it is missing a `:show="true | false"` prop.')});let n=T(r.value?"visible":"hidden"),l=K(()=>{n.value="hidden"}),i=T(!0),x={show:r,appear:b(()=>e.appear||!i.value)};return h(()=>{y(()=>{i.value=!1,r.value?n.value="visible":w(l)||(n.value="hidden")})}),H(F,l),H(B,x),()=>{let g=ee(e,["show","appear","unmount","onBeforeEnter","onBeforeLeave","onAfterEnter","onAfterLeave"]),p={unmount:e.unmount};return P({ourProps:{...p,as:"template"},theirProps:{},slot:{},slots:{...s,default:()=>[D(ue,{onBeforeEnter:()=>t("beforeEnter"),onAfterEnter:()=>t("afterEnter"),onBeforeLeave:()=>t("beforeLeave"),onAfterLeave:()=>t("afterLeave"),...a,...p,...g},s.default)]},attrs:{},features:_,visible:n.value==="visible",name:"Transition"})}}});export{oe as TransitionChild,fe 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 { 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{isServer as m}from'../utils/ssr.js';function v(e,t,n){m||r(o=>{document.addEventListener(e,t,n),o(()=>document.removeEventListener(e,t,n))})}export{v 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,1 +0,1 @@

import{watchEffect as i}from"vue";import{isServer as a}from'../utils/ssr.js';function E(n,e,o,r){a||i(t=>{n=n!=null?n:window,n.addEventListener(e,o,r),t(()=>n.removeEventListener(e,o,r))})}export{E as useEventListener};
import{watchEffect as i}from"vue";import{env as a}from'../utils/env.js';function E(n,e,o,r){a.isServer||i(t=>{n=n!=null?n:window,n.addEventListener(e,o,r),t(()=>n.removeEventListener(e,o,r))})}export{E as useEventListener};

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

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

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

import{computed as E,ref as v}from"vue";import{FocusableMode as C,isFocusableElement as s}from'../utils/focus-management.js';import{dom as d}from'../utils/dom.js';import{useDocumentEvent as u}from'./use-document-event.js';function y(a,f,l=E(()=>!0)){function i(t,m){if(!l.value||t.defaultPrevented)return;let n=m(t);if(n===null||!n.ownerDocument.documentElement.contains(n))return;let c=function r(e){return typeof e=="function"?r(e()):Array.isArray(e)||e instanceof Set?e:[e]}(a);for(let r of c){if(r===null)continue;let e=r instanceof HTMLElement?r:d(r);if(e!=null&&e.contains(n))return}return!s(n,C.Loose)&&n.tabIndex!==-1&&t.preventDefault(),f(t,n)}let o=v(null);u("mousedown",t=>{l.value&&(o.value=t.target)},!0),u("click",t=>{!o.value||(i(t,()=>o.value),o.value=null)},!0),u("blur",t=>i(t,()=>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<unknown>;
}>, 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,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,3 +0,3 @@

import { ComputedRef } from 'vue';
declare type AcceptNode = (node: HTMLElement) => typeof NodeFilter.FILTER_ACCEPT | typeof NodeFilter.FILTER_SKIP | typeof NodeFilter.FILTER_REJECT;
import { type ComputedRef } from 'vue';
type AcceptNode = (node: HTMLElement) => typeof NodeFilter.FILTER_ACCEPT | typeof NodeFilter.FILTER_SKIP | typeof NodeFilter.FILTER_REJECT;
export declare function useTreeWalker({ container, accept, walk, enabled, }: {

@@ -4,0 +4,0 @@ container: ComputedRef<HTMLElement | null>;

@@ -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{isServer as r}from'../utils/ssr.js';function w(e,n,t){r||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,5 +0,7 @@

import { Ref } from 'vue';
import { type Ref } from 'vue';
export declare enum State {
Open = 0,
Closed = 1
Open = 1,
Closed = 2,
Closing = 4,
Opening = 8
}

@@ -6,0 +8,0 @@ export declare function hasOpenClosed(): boolean;

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

import{inject as t,provide as r}from"vue";let n=Symbol("Context");var l=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(l||{});function f(){return p()!==null}function p(){return t(n,null)}function c(o){r(n,o)}export{l as State,f 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,3 +0,3 @@

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

@@ -4,0 +4,0 @@ Add = 0,

@@ -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};

@@ -0,10 +1,12 @@

export type Disposables = ReturnType<typeof disposables>;
export declare function disposables(): {
enqueue(fn: Function): void;
addEventListener<TEventName extends keyof WindowEventMap>(element: HTMLElement | Document, name: TEventName, listener: (event: WindowEventMap[TEventName]) => any, options?: boolean | AddEventListenerOptions | undefined): void;
addEventListener<TEventName extends keyof WindowEventMap>(element: HTMLElement | Window | Document, name: TEventName, listener: (event: WindowEventMap[TEventName]) => any, options?: boolean | AddEventListenerOptions): () => void;
requestAnimationFrame(callback: FrameRequestCallback): void;
nextFrame(callback: FrameRequestCallback): void;
setTimeout(callback: (...args: any[]) => void, ms?: number | undefined, ...args: any[]): void;
add(cb: () => void): void;
microTask(cb: () => void): () => void;
style(node: HTMLElement, property: string, value: string): () => void;
group(cb: (d: typeof this) => void): () => void;
add(cb: () => void): () => void;
dispose(): void;
workQueue(): Promise<void>;
};

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

function s(){let a=[],i=[],t={enqueue(e){i.push(e)},addEventListener(e,n,o,r){return e.addEventListener(n,o,r),t.add(()=>e.removeEventListener(n,o,r))},requestAnimationFrame(...e){let n=requestAnimationFrame(...e);t.add(()=>cancelAnimationFrame(n))},nextFrame(...e){t.requestAnimationFrame(()=>{t.requestAnimationFrame(...e)})},setTimeout(...e){let n=setTimeout(...e);t.add(()=>clearTimeout(n))},add(e){a.push(e)},dispose(){for(let e of a.splice(0))e()},async workQueue(){for(let e of i.splice(0))await e()}};return t}export{s 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};

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

export declare let focusableSelector: string;
export declare enum Focus {

@@ -33,2 +34,6 @@ /** Focus the first non-disabled element */

export declare function focusFrom(current: HTMLElement | null, focus: Focus): FocusResult;
export declare function focusIn(container: HTMLElement | HTMLElement[], focus: Focus, sorted?: boolean, active?: HTMLElement | null): FocusResult;
export declare function focusIn(container: HTMLElement | HTMLElement[], focus: Focus, { sorted, relativeTo, skipElements, }?: Partial<{
sorted: boolean;
relativeTo: HTMLElement | null;
skipElements: HTMLElement[];
}>): FocusResult;

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

import{nextTick as T}from"vue";import{match as L}from'./match.js';import{getOwnerDocument as d}from'./owner.js';let m=["[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 M=(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))(M||{}),N=(o=>(o[o.Error=0]="Error",o[o.Overflow=1]="Overflow",o[o.Success=2]="Success",o[o.Underflow=3]="Underflow",o))(N||{}),b=(r=>(r[r.Previous=-1]="Previous",r[r.Next=1]="Next",r))(b||{});function E(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(m))}var F=(r=>(r[r.Strict=0]="Strict",r[r.Loose=1]="Loose",r))(F||{});function h(e,t=0){var r;return e===((r=d(e))==null?void 0:r.body)?!1:L(t,{[0](){return e.matches(m)},[1](){let l=e;for(;l!==null;){if(l.matches(m))return!0;l=l.parentElement}return!1}})}function D(e){let t=d(e);T(()=>{t&&!h(t.activeElement,0)&&w(e)})}function w(e){e==null||e.focus({preventScroll:!0})}let H=["textarea","input"].join(",");function S(e){var t,r;return(r=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,H))!=null?r:!1}function O(e,t=r=>r){return e.slice().sort((r,l)=>{let o=t(r),s=t(l);if(o===null||s===null)return 0;let n=o.compareDocumentPosition(s);return n&Node.DOCUMENT_POSITION_FOLLOWING?-1:n&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function v(e,t){return P(E(),t,!0,e)}function P(e,t,r=!0,l=null){var c;let o=(c=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e==null?void 0:e.ownerDocument)!=null?c:document,s=Array.isArray(e)?r?O(e):e:E(e);l=l!=null?l:o.activeElement;let n=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),x=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,s.indexOf(l))-1;if(t&4)return Math.max(0,s.indexOf(l))+1;if(t&8)return s.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),p=t&32?{preventScroll:!0}:{},a=0,i=s.length,u;do{if(a>=i||a+i<=0)return 0;let f=x+a;if(t&16)f=(f+i)%i;else{if(f<0)return 3;if(f>=i)return 1}u=s[f],u==null||u.focus(p),a+=n}while(u!==o.activeElement);return t&6&&S(u)&&u.select(),u.hasAttribute("tabindex")||u.setAttribute("tabindex","0"),2}export{M as Focus,N as FocusResult,F as FocusableMode,w as focusElement,v as focusFrom,P as focusIn,E as getFocusableElements,h as isFocusableElement,D as restoreFocusIfNecessary,O 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,c as focusableSelector,E as getFocusableElements,w as isFocusableElement,_ as restoreFocusIfNecessary,O as sortByDomNode};

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

declare type Entries = [string, string][];
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 n}from'./dom.js';import{isServer as t}from'./ssr.js';function m(r){if(t)return null;if(r instanceof Node)return r.ownerDocument;if(r!=null&&r.hasOwnProperty("value")){let o=n(r);if(o)return o.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};
export declare function isIOS(): boolean;
export declare function isAndroid(): boolean;
export declare function isMobile(): boolean;

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

function o(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}export{o as isIOS};
function t(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function i(){return/Android/gi.test(window.navigator.userAgent)}function n(){return t()||i()}export{i as isAndroid,t as isIOS,n as isMobile};

@@ -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 m,cloneVNode as h,Fragment as b}from"vue";import{match as j}from'./match.js';var R=(o=>(o[o.None=0]="None",o[o.RenderStrategy=1]="RenderStrategy",o[o.Static=2]="Static",o))(R||{}),O=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(O||{});function V({visible:r=!0,features:t=0,ourProps:e,theirProps:o,...i}){var a;let n=k(o,e),s=Object.assign(i,{props:n});if(r||t&2&&n.static)return p(s);if(t&1){let l=(a=n.unmount)==null||a?0:1;return j(l,{[0](){return null},[1](){return p({...i,props:{...n,hidden:!0,style:{display:"none"}}})}})}return p(s)}function p({props:r,attrs:t,slots:e,slot:o,name:i}){var y;let{as:n,...s}=w(r,["unmount","static"]),a=(y=e.default)==null?void 0:y.call(e,o),l={};if(o){let f=!1,u=[];for(let[d,c]of Object.entries(o))typeof c=="boolean"&&(f=!0),c===!0&&u.push(d);f&&(l["data-headlessui-state"]=u.join(" "))}if(n==="template"){if(a=g(a),Object.keys(s).length>0||Object.keys(t).length>0){let[f,...u]=a!=null?a:[];if(!x(f)||u.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(s).concat(Object.keys(t)).sort((d,c)=>d.localeCompare(c)).map(d=>` - ${d}`).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(d=>` - ${d}`).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(`
`));return h(f,Object.assign({},s,l))}return Array.isArray(a)&&a.length===1?a[0]:a}return m(n,Object.assign({},s,l),a)}function g(r){return r.flatMap(t=>t.type===b?g(t.children):[t])}function k(...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,...s){let a=e[i];for(let l of a){if(n instanceof Event&&n.defaultPrevented)return;l(n,...s)}}});return t}function P(r){let t=Object.assign({},r);for(let e in t)t[e]===void 0&&delete t[e];return t}function w(r,t=[]){let e=Object.assign({},r);for(let o of t)o in e&&delete e[o];return e}function x(r){return r==null?!1:typeof r.type=="string"||typeof r.type=="object"||typeof r.type=="function"}export{R as Features,O as RenderStrategy,P as compact,w as omit,V 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.46a7ab6",
"version": "0.0.0-insiders.4737c6d",
"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"
}
}

@@ -26,3 +26,3 @@ <h3 align="center">

For full documentation, visit [headlessui.dev](https://headlessui.dev/vue/menu).
For full documentation, visit [headlessui.com](https://headlessui.com/v1/vue).

@@ -29,0 +29,0 @@ ## Community

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