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

@headlessui/vue

Package Overview
Dependencies
Maintainers
2
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.2.0-80402e7 to 0.2.0-da179ca

8

dist/headlessui.cjs.development.js

@@ -457,5 +457,5 @@ 'use strict';

window.addEventListener('click', handler);
window.addEventListener('mousedown', handler);
vue.onUnmounted(function () {
return window.removeEventListener('click', handler);
return window.removeEventListener('mousedown', handler);
});

@@ -973,5 +973,5 @@ }); // @ts-expect-error Types of property 'dataRef' are incompatible.

window.addEventListener('click', handler);
window.addEventListener('mousedown', handler);
vue.onUnmounted(function () {
return window.removeEventListener('click', handler);
return window.removeEventListener('mousedown', handler);
});

@@ -978,0 +978,0 @@ }); // @ts-expect-error Types of property 'dataRef' are incompatible.

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t,n=require("vue");function o(){return(o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}function r(e,t){if(null==e)return{};var n,o,r={},u=Object.keys(e);for(o=0;o<u.length;o++)t.indexOf(n=u[o])>=0||(r[n]=e[n]);return r}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function l(e,t){if(e in t){for(var n=t[e],o=arguments.length,r=new Array(o>2?o-2:0),u=2;u<o;u++)r[u-2]=arguments[u];return"function"==typeof n?n.apply(void 0,r):n}var a=new Error('Tried to handle "'+e+'" but there is no handler defined. Only defined handlers are: '+Object.keys(t).map((function(e){return'"'+e+'"'})).join(", ")+".");throw Error.captureStackTrace&&Error.captureStackTrace(a,l),a}function a(n){var u,a,s=n.visible,c=void 0===s||s,d=n.features,v=void 0===d?e.None:d,p=r(n,["visible","features"]);return c||v&e.Static&&p.props.static?i(p):v&e.RenderStrategy?l(null==(u=p.props.unmount)||u?t.Unmount:t.Hidden,((a={})[t.Unmount]=function(){return null},a[t.Hidden]=function(){return i(o({},p,{props:o({},p.props,{hidden:!0,style:{display:"none"}})}))},a)):i(p)}function i(e){var t=e.attrs,o=e.slots,l=e.slot,a=function(e,t){void 0===t&&(t=[]);for(var n,o=Object.assign({},e),r=function(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return u(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,void 0):void 0}}(e))){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}(t);!(n=r()).done;){var l=n.value;l in o&&delete o[l]}return o}(e.props,["unmount","static"]),i=a.as,s=r(a,["as"]),c=null==o.default?void 0:o.default(l);if("template"===i){if(Object.keys(s).length>0||"class"in t){var d=null!=c?c:[],v=d[0];if(d.slice(1).length>0)throw new Error('You should only render 1 child or use the `as="..."` prop');return n.cloneVNode(v,s)}return c}return n.h(i,s,c)}!function(e){e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static"}(e||(e={})),function(e){e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden"}(t||(t={}));var s,c,d,v=0;function p(){return++v}function f(e,t){var n=t.resolveItems();if(n.length<=0)return null;var o=t.resolveActiveIndex(),r=null!=o?o:-1,u=function(){switch(e.focus){case c.First:return n.findIndex((function(e){return!t.resolveDisabled(e)}));case c.Previous:var o=n.slice().reverse().findIndex((function(e,n,o){return!(-1!==r&&o.length-n-1>=r||t.resolveDisabled(e))}));return-1===o?o:n.length-1-o;case c.Next:return n.findIndex((function(e,n){return!(n<=r||t.resolveDisabled(e))}));case c.Last:var u=n.slice().reverse().findIndex((function(e){return!t.resolveDisabled(e)}));return-1===u?u:n.length-1-u;case c.Specific:return n.findIndex((function(n){return t.resolveId(n)===e.id}));case c.Nothing:return null;default:!function(e){throw new Error("Unexpected object: "+e)}(e)}}();return-1===u?o:u}function b(e,t){if(void 0!==e)return"function"==typeof e?e(t):e}!function(e){e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.ArrowUp="ArrowUp",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab"}(s||(s={})),function(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"}(c||(c={})),function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(d||(d={}));var m=Symbol("MenuContext");function h(e){var t=n.inject(m,null);if(null===t){var o=new Error("<"+e+" /> is missing a parent <Menu /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(o,h),o}return t}var x,y=n.defineComponent({props:{as:{type:[Object,String],default:"template"}},setup:function(e,t){var o=t.slots,r=t.attrs,u=n.ref(d.Closed),l=n.ref(null),i=n.ref(null),s=n.ref([]),v=n.ref(""),p=n.ref(null),b={menuState:u,buttonRef:l,itemsRef:i,items:s,searchQuery:v,activeItemIndex:p,closeMenu:function(){u.value=d.Closed,p.value=null},openMenu:function(){return u.value=d.Open},goToItem:function(e,t){var n=f(e===c.Specific?{focus:c.Specific,id:t}:{focus:e},{resolveItems:function(){return s.value},resolveActiveIndex:function(){return p.value},resolveId:function(e){return e.id},resolveDisabled:function(e){return e.dataRef.disabled}});""===v.value&&p.value===n||(v.value="",p.value=n)},search:function(e){v.value+=e;var t=s.value.findIndex((function(e){return e.dataRef.textValue.startsWith(v.value)&&!e.dataRef.disabled}));-1!==t&&t!==p.value&&(p.value=t)},clearSearch:function(){v.value=""},registerItem:function(e,t){s.value.push({id:e,dataRef:t})},unregisterItem:function(e){var t=s.value.slice(),n=null!==p.value?t[p.value]:null,o=t.findIndex((function(t){return t.id===e}));-1!==o&&t.splice(o,1),s.value=t,p.value=o===p.value||null===n?null:t.indexOf(n)}};return n.onMounted((function(){function e(e){var t,n,o,r=e.target,a=document.activeElement;u.value===d.Open&&((null==(t=l.value)?void 0:t.contains(r))||((null==(n=i.value)?void 0:n.contains(r))||b.closeMenu(),a!==document.body&&(null==a?void 0:a.contains(r))||e.defaultPrevented||null==(o=l.value)||o.focus({preventScroll:!0})))}window.addEventListener("click",e),n.onUnmounted((function(){return window.removeEventListener("click",e)}))})),n.provide(m,b),function(){return a({props:e,slot:{open:u.value===d.Open},slots:o,attrs:r})}}}),S=n.defineComponent({props:{disabled:{type:Boolean,default:!1},as:{type:[Object,String],default:"button"}},render:function(){var e,t=h("MenuButton"),n={open:t.menuState.value===d.Open},r={ref:"el",id:this.id,type:"button","aria-haspopup":!0,"aria-controls":null==(e=t.itemsRef.value)?void 0:e.id,"aria-expanded":t.menuState.value===d.Open||void 0,onKeyDown:this.handleKeyDown,onClick:this.handleClick};return a({props:o({},this.$props,r),slot:n,attrs:this.$attrs,slots:this.$slots})},setup:function(e){var t=h("MenuButton");return{id:"headlessui-menu-button-"+p(),el:t.buttonRef,handleKeyDown:function(e){switch(e.key){case s.Space:case s.Enter:case s.ArrowDown:e.preventDefault(),t.openMenu(),n.nextTick((function(){var e;null==(e=t.itemsRef.value)||e.focus({preventScroll:!0}),t.goToItem(c.First)}));break;case s.ArrowUp:e.preventDefault(),t.openMenu(),n.nextTick((function(){var e;null==(e=t.itemsRef.value)||e.focus({preventScroll:!0}),t.goToItem(c.Last)}))}},handleClick:function(o){var r;e.disabled||(t.menuState.value===d.Open?(t.closeMenu(),n.nextTick((function(){var e;return null==(e=t.buttonRef.value)?void 0:e.focus({preventScroll:!0})}))):(o.preventDefault(),t.openMenu(),r=function(){var e;return null==(e=t.itemsRef.value)?void 0:e.focus({preventScroll:!0})},requestAnimationFrame((function(){return requestAnimationFrame(r)}))))}}}}),g=n.defineComponent({props:{as:{type:[Object,String],default:"div"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0}},render:function(){var t,n,r=h("MenuItems"),u={open:r.menuState.value===d.Open},l={"aria-activedescendant":null===r.activeItemIndex.value||null==(t=r.items.value[r.activeItemIndex.value])?void 0:t.id,"aria-labelledby":null==(n=r.buttonRef.value)?void 0:n.id,id:this.id,onKeyDown:this.handleKeyDown,role:"menu",tabIndex:0,ref:"el"};return a({props:o({},this.$props,l),slot:u,attrs:this.$attrs,slots:this.$slots,features:e.RenderStrategy|e.Static,visible:u.open})},setup:function(){var e=h("MenuItems"),t="headlessui-menu-items-"+p(),o=n.ref(null);return{id:t,el:e.itemsRef,handleKeyDown:function(t){switch(o.value&&clearTimeout(o.value),t.key){case s.Space:if(""!==e.searchQuery.value)return t.preventDefault(),e.search(t.key);case s.Enter:var r;t.preventDefault(),null!==e.activeItemIndex.value&&(null==(r=document.getElementById(e.items.value[e.activeItemIndex.value].id))||r.click()),e.closeMenu(),n.nextTick((function(){var t;return null==(t=e.buttonRef.value)?void 0:t.focus({preventScroll:!0})}));break;case s.ArrowDown:return t.preventDefault(),e.goToItem(c.Next);case s.ArrowUp:return t.preventDefault(),e.goToItem(c.Previous);case s.Home:case s.PageUp:return t.preventDefault(),e.goToItem(c.First);case s.End:case s.PageDown:return t.preventDefault(),e.goToItem(c.Last);case s.Escape:t.preventDefault(),e.closeMenu(),n.nextTick((function(){var t;return null==(t=e.buttonRef.value)?void 0:t.focus({preventScroll:!0})}));break;case s.Tab:return t.preventDefault();default:1===t.key.length&&(e.search(t.key),o.value=setTimeout((function(){return e.clearSearch()}),350))}}}}}),w=n.defineComponent({props:{as:{type:[Object,String],default:"template"},disabled:{type:Boolean,default:!1},class:{type:[String,Function],required:!1},className:{type:[String,Function],required:!1}},setup:function(e,t){var r=t.slots,u=t.attrs,l=h("MenuItem"),i="headlessui-menu-item-"+p(),s=e.disabled,d=e.className,v=void 0===d?e.class:d,f=n.computed((function(){return null!==l.activeItemIndex.value&&l.items.value[l.activeItemIndex.value].id===i})),m=n.ref({disabled:s,textValue:""});function x(e){if(s)return e.preventDefault();l.closeMenu(),n.nextTick((function(){var e;return null==(e=l.buttonRef.value)?void 0:e.focus({preventScroll:!0})}))}function y(){if(s)return l.goToItem(c.Nothing);l.goToItem(c.Specific,i)}function S(){s||f.value||l.goToItem(c.Specific,i)}function g(){s||f.value&&l.goToItem(c.Nothing)}return n.onMounted((function(){var e,t,n=null==(e=document.getElementById(i))||null==(t=e.textContent)?void 0:t.toLowerCase().trim();void 0!==n&&(m.value.textValue=n)})),n.onMounted((function(){return l.registerItem(i,m)})),n.onUnmounted((function(){return l.unregisterItem(i)})),function(){var t={active:f.value,disabled:s},n={id:i,role:"menuitem",tabIndex:-1,class:b(v,t),"aria-disabled":!0===s||void 0,onClick:x,onFocus:y,onPointerMove:S,onMouseMove:S,onPointerLeave:g,onMouseLeave:g};return a({props:o({},e,n),slot:t,attrs:u,slots:r})}}});!function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(x||(x={}));var O=Symbol("ListboxContext");function I(e){var t=n.inject(O,null);if(null===t){var o=new Error("<"+e+" /> is missing a parent <Listbox /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(o,I),o}return t}var k=n.defineComponent({name:"Listbox",emits:["update:modelValue"],props:{as:{type:[Object,String],default:"template"},modelValue:{type:[Object,String,Number,Boolean],default:null}},setup:function(e,t){var o=t.slots,u=t.attrs,l=t.emit,i=r(e,["modelValue"]),s=n.ref(x.Closed),d=n.ref(null),v=n.ref(null),p=n.ref(null),b=n.ref([]),m=n.ref(""),h=n.ref(null),y=n.computed((function(){return e.modelValue})),S={listboxState:s,value:y,labelRef:d,buttonRef:v,optionsRef:p,options:b,searchQuery:m,activeOptionIndex:h,closeListbox:function(){s.value=x.Closed,h.value=null},openListbox:function(){return s.value=x.Open},goToOption:function(e,t){var n=f(e===c.Specific?{focus:c.Specific,id:t}:{focus:e},{resolveItems:function(){return b.value},resolveActiveIndex:function(){return h.value},resolveId:function(e){return e.id},resolveDisabled:function(e){return e.dataRef.disabled}});""===m.value&&h.value===n||(m.value="",h.value=n)},search:function(e){m.value+=e;var t=b.value.findIndex((function(e){return!e.dataRef.disabled&&e.dataRef.textValue.startsWith(m.value)}));-1!==t&&t!==h.value&&(h.value=t)},clearSearch:function(){m.value=""},registerOption:function(e,t){b.value.push({id:e,dataRef:t})},unregisterOption:function(e){var t=b.value.slice(),n=null!==h.value?t[h.value]:null,o=t.findIndex((function(t){return t.id===e}));-1!==o&&t.splice(o,1),b.value=t,h.value=o===h.value||null===n?null:t.indexOf(n)},select:function(e){l("update:modelValue",e)}};return n.onMounted((function(){function e(e){var t,n,o,r=e.target,u=document.activeElement;s.value===x.Open&&((null==(t=v.value)?void 0:t.contains(r))||((null==(n=p.value)?void 0:n.contains(r))||S.closeListbox(),u!==document.body&&(null==u?void 0:u.contains(r))||e.defaultPrevented||null==(o=v.value)||o.focus({preventScroll:!0})))}window.addEventListener("click",e),n.onUnmounted((function(){return window.removeEventListener("click",e)}))})),n.provide(O,S),function(){return a({props:i,slot:{open:s.value===x.Open},slots:o,attrs:u})}}}),R=n.defineComponent({name:"ListboxLabel",props:{as:{type:[Object,String],default:"label"}},render:function(){var e={open:I("ListboxLabel").listboxState.value===x.Open};return a({props:o({},this.$props,{id:this.id,ref:"el",onClick:this.handleClick}),slot:e,attrs:this.$attrs,slots:this.$slots})},setup:function(){var e=I("ListboxLabel");return{id:"headlessui-listbox-label-"+p(),el:e.labelRef,handleClick:function(){var t;null==(t=e.buttonRef.value)||t.focus({preventScroll:!0})}}}}),D=n.defineComponent({name:"ListboxButton",props:{disabled:{type:Boolean,default:!1},as:{type:[Object,String],default:"button"}},render:function(){var e,t=I("ListboxButton"),n={open:t.listboxState.value===x.Open},r={ref:"el",id:this.id,type:"button","aria-haspopup":!0,"aria-controls":null==(e=t.optionsRef.value)?void 0:e.id,"aria-expanded":t.listboxState.value===x.Open||void 0,"aria-labelledby":t.labelRef.value?[t.labelRef.value.id,this.id].join(" "):void 0,onKeyDown:this.handleKeyDown,onClick:this.handleClick};return a({props:o({},this.$props,r),slot:n,attrs:this.$attrs,slots:this.$slots})},setup:function(e){var t=I("ListboxButton");return{id:"headlessui-listbox-button-"+p(),el:t.buttonRef,handleKeyDown:function(e){switch(e.key){case s.Space:case s.Enter:case s.ArrowDown:e.preventDefault(),t.openListbox(),n.nextTick((function(){var e;null==(e=t.optionsRef.value)||e.focus({preventScroll:!0}),t.value.value||t.goToOption(c.First)}));break;case s.ArrowUp:e.preventDefault(),t.openListbox(),n.nextTick((function(){var e;null==(e=t.optionsRef.value)||e.focus({preventScroll:!0}),t.value.value||t.goToOption(c.Last)}))}},handleClick:function(o){var r;e.disabled||(t.listboxState.value===x.Open?(t.closeListbox(),n.nextTick((function(){var e;return null==(e=t.buttonRef.value)?void 0:e.focus({preventScroll:!0})}))):(o.preventDefault(),t.openListbox(),r=function(){var e;return null==(e=t.optionsRef.value)?void 0:e.focus({preventScroll:!0})},requestAnimationFrame((function(){return requestAnimationFrame(r)}))))}}}}),T=n.defineComponent({name:"ListboxOptions",props:{as:{type:[Object,String],default:"ul"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0}},render:function(){var t,n,r,u,l=I("ListboxOptions"),i={open:l.listboxState.value===x.Open},s={"aria-activedescendant":null===l.activeOptionIndex.value||null==(t=l.options.value[l.activeOptionIndex.value])?void 0:t.id,"aria-labelledby":null!=(n=null==(r=l.labelRef.value)?void 0:r.id)?n:null==(u=l.buttonRef.value)?void 0:u.id,id:this.id,onKeyDown:this.handleKeyDown,role:"listbox",tabIndex:0,ref:"el"};return a({props:o({},this.$props,s),slot:i,attrs:this.$attrs,slots:this.$slots,features:e.RenderStrategy|e.Static,visible:i.open})},setup:function(){var e=I("ListboxOptions"),t="headlessui-listbox-options-"+p(),o=n.ref(null);return{id:t,el:e.optionsRef,handleKeyDown:function(t){switch(o.value&&clearTimeout(o.value),t.key){case s.Space:if(""!==e.searchQuery.value)return t.preventDefault(),e.search(t.key);case s.Enter:t.preventDefault(),null!==e.activeOptionIndex.value&&e.select(e.options.value[e.activeOptionIndex.value].dataRef.value),e.closeListbox(),n.nextTick((function(){var t;return null==(t=e.buttonRef.value)?void 0:t.focus({preventScroll:!0})}));break;case s.ArrowDown:return t.preventDefault(),e.goToOption(c.Next);case s.ArrowUp:return t.preventDefault(),e.goToOption(c.Previous);case s.Home:case s.PageUp:return t.preventDefault(),e.goToOption(c.First);case s.End:case s.PageDown:return t.preventDefault(),e.goToOption(c.Last);case s.Escape:t.preventDefault(),e.closeListbox(),n.nextTick((function(){var t;return null==(t=e.buttonRef.value)?void 0:t.focus({preventScroll:!0})}));break;case s.Tab:return t.preventDefault();default:1===t.key.length&&(e.search(t.key),o.value=setTimeout((function(){return e.clearSearch()}),350))}}}}}),L=n.defineComponent({name:"ListboxOption",props:{as:{type:[Object,String],default:"li"},value:{type:[Object,String],default:null},disabled:{type:Boolean,default:!1},class:{type:[String,Function],required:!1},className:{type:[String,Function],required:!1}},setup:function(e,t){var r=t.slots,u=t.attrs,l=I("ListboxOption"),i="headlessui-listbox-option-"+p(),s=e.disabled,d=e.className,v=void 0===d?e.class:d,f=e.value,m=n.computed((function(){return null!==l.activeOptionIndex.value&&l.options.value[l.activeOptionIndex.value].id===i})),h=n.computed((function(){return n.toRaw(l.value.value)===n.toRaw(f)})),y=n.ref({disabled:s,value:f,textValue:""});function S(e){if(s)return e.preventDefault();l.select(f),l.closeListbox(),n.nextTick((function(){var e;return null==(e=l.buttonRef.value)?void 0:e.focus({preventScroll:!0})}))}function g(){if(s)return l.goToOption(c.Nothing);l.goToOption(c.Specific,i)}function w(){s||m.value||l.goToOption(c.Specific,i)}function O(){s||m.value&&l.goToOption(c.Nothing)}return n.onMounted((function(){var e,t,n=null==(e=document.getElementById(i))||null==(t=e.textContent)?void 0:t.toLowerCase().trim();void 0!==n&&(y.value.textValue=n)})),n.onMounted((function(){return l.registerOption(i,y)})),n.onUnmounted((function(){return l.unregisterOption(i)})),n.onMounted((function(){n.watch([l.listboxState,h],(function(){var e;l.listboxState.value===x.Open&&h.value&&(l.goToOption(c.Specific,i),null==(e=document.getElementById(i))||null==e.focus||e.focus())}),{immediate:!0})})),n.watchEffect((function(){l.listboxState.value===x.Open&&m.value&&n.nextTick((function(){var e;return null==(e=document.getElementById(i))||null==e.scrollIntoView?void 0:e.scrollIntoView({block:"nearest"})}))})),function(){var t={active:m.value,selected:h.value,disabled:s},n={id:i,role:"option",tabIndex:-1,class:b(v,t),"aria-disabled":!0===s||void 0,"aria-selected":!0===h.value?h.value:void 0,onClick:S,onFocus:g,onPointerMove:w,onMouseMove:w,onPointerLeave:O,onMouseLeave:O};return a({props:o({},e,n),slot:t,attrs:u,slots:r})}}}),C=Symbol("GroupContext");function E(e){var t=n.inject(C,null);if(null===t){var o=new Error("<"+e+" /> is missing a parent <SwitchGroup /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(o,E),o}return t}var M=n.defineComponent({name:"SwitchGroup",props:{as:{type:[Object,String],default:"template"}},setup:function(e,t){var o=t.slots,r=t.attrs,u=n.ref(null),l=n.ref(null);return n.provide(C,{switchRef:u,labelRef:l}),function(){return a({props:e,slot:{},slots:o,attrs:r})}}}),j=n.defineComponent({name:"Switch",emits:["update:modelValue"],props:{as:{type:[Object,String],default:"button"},modelValue:{type:[Object,Boolean],default:null},class:{type:[String,Function],required:!1},className:{type:[String,Function],required:!1}},render:function(){var e=n.inject(C,null),t=this.$props,r=t.className,u=void 0===r?t.class:r,l=n.computed((function(){var t;return null==e||null==(t=e.labelRef.value)?void 0:t.id})),i={checked:this.$props.modelValue},s={id:this.id,ref:null===e?void 0:e.switchRef,role:"switch",tabIndex:0,class:b(u,i),"aria-checked":this.$props.modelValue,"aria-labelledby":l.value,onClick:this.handleClick,onKeyUp:this.handleKeyUp,onKeyPress:this.handleKeyPress};return"button"===this.$props.as&&Object.assign(s,{type:"button"}),a({props:o({},this.$props,s),slot:i,attrs:this.$attrs,slots:this.$slots})},setup:function(e,t){var o=t.emit,r=n.inject(C,null);function u(){o("update:modelValue",!e.modelValue)}return{id:"headlessui-switch-"+p(),el:null==r?void 0:r.switchRef,handleClick:function(e){e.preventDefault(),u()},handleKeyUp:function(e){e.key!==s.Tab&&e.preventDefault(),e.key===s.Space&&u()},handleKeyPress:function(e){e.preventDefault()}}}}),A=n.defineComponent({name:"SwitchLabel",props:{as:{type:[Object,String],default:"label"}},render:function(){return a({props:o({},this.$props,{id:this.id,ref:"el",onClick:this.handleClick}),slot:{},attrs:this.$attrs,slots:this.$slots})},setup:function(){var e=E("SwitchLabel");return{id:"headlessui-switch-label-"+p(),el:e.labelRef,handleClick:function(){var t,n;null==(t=e.switchRef.value)||t.click(),null==(n=e.switchRef.value)||n.focus({preventScroll:!0})}}}});exports.Listbox=k,exports.ListboxButton=D,exports.ListboxLabel=R,exports.ListboxOption=L,exports.ListboxOptions=T,exports.Menu=y,exports.MenuButton=S,exports.MenuItem=w,exports.MenuItems=g,exports.Switch=j,exports.SwitchGroup=M,exports.SwitchLabel=A;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t,n=require("vue");function o(){return(o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}function r(e,t){if(null==e)return{};var n,o,r={},u=Object.keys(e);for(o=0;o<u.length;o++)t.indexOf(n=u[o])>=0||(r[n]=e[n]);return r}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function l(e,t){if(e in t){for(var n=t[e],o=arguments.length,r=new Array(o>2?o-2:0),u=2;u<o;u++)r[u-2]=arguments[u];return"function"==typeof n?n.apply(void 0,r):n}var a=new Error('Tried to handle "'+e+'" but there is no handler defined. Only defined handlers are: '+Object.keys(t).map((function(e){return'"'+e+'"'})).join(", ")+".");throw Error.captureStackTrace&&Error.captureStackTrace(a,l),a}function a(n){var u,a,s=n.visible,c=void 0===s||s,d=n.features,v=void 0===d?e.None:d,p=r(n,["visible","features"]);return c||v&e.Static&&p.props.static?i(p):v&e.RenderStrategy?l(null==(u=p.props.unmount)||u?t.Unmount:t.Hidden,((a={})[t.Unmount]=function(){return null},a[t.Hidden]=function(){return i(o({},p,{props:o({},p.props,{hidden:!0,style:{display:"none"}})}))},a)):i(p)}function i(e){var t=e.attrs,o=e.slots,l=e.slot,a=function(e,t){void 0===t&&(t=[]);for(var n,o=Object.assign({},e),r=function(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return u(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,void 0):void 0}}(e))){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}(t);!(n=r()).done;){var l=n.value;l in o&&delete o[l]}return o}(e.props,["unmount","static"]),i=a.as,s=r(a,["as"]),c=null==o.default?void 0:o.default(l);if("template"===i){if(Object.keys(s).length>0||"class"in t){var d=null!=c?c:[],v=d[0];if(d.slice(1).length>0)throw new Error('You should only render 1 child or use the `as="..."` prop');return n.cloneVNode(v,s)}return c}return n.h(i,s,c)}!function(e){e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static"}(e||(e={})),function(e){e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden"}(t||(t={}));var s,c,d,v=0;function p(){return++v}function f(e,t){var n=t.resolveItems();if(n.length<=0)return null;var o=t.resolveActiveIndex(),r=null!=o?o:-1,u=function(){switch(e.focus){case c.First:return n.findIndex((function(e){return!t.resolveDisabled(e)}));case c.Previous:var o=n.slice().reverse().findIndex((function(e,n,o){return!(-1!==r&&o.length-n-1>=r||t.resolveDisabled(e))}));return-1===o?o:n.length-1-o;case c.Next:return n.findIndex((function(e,n){return!(n<=r||t.resolveDisabled(e))}));case c.Last:var u=n.slice().reverse().findIndex((function(e){return!t.resolveDisabled(e)}));return-1===u?u:n.length-1-u;case c.Specific:return n.findIndex((function(n){return t.resolveId(n)===e.id}));case c.Nothing:return null;default:!function(e){throw new Error("Unexpected object: "+e)}(e)}}();return-1===u?o:u}function b(e,t){if(void 0!==e)return"function"==typeof e?e(t):e}!function(e){e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.ArrowUp="ArrowUp",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab"}(s||(s={})),function(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"}(c||(c={})),function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(d||(d={}));var m=Symbol("MenuContext");function h(e){var t=n.inject(m,null);if(null===t){var o=new Error("<"+e+" /> is missing a parent <Menu /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(o,h),o}return t}var x,y=n.defineComponent({props:{as:{type:[Object,String],default:"template"}},setup:function(e,t){var o=t.slots,r=t.attrs,u=n.ref(d.Closed),l=n.ref(null),i=n.ref(null),s=n.ref([]),v=n.ref(""),p=n.ref(null),b={menuState:u,buttonRef:l,itemsRef:i,items:s,searchQuery:v,activeItemIndex:p,closeMenu:function(){u.value=d.Closed,p.value=null},openMenu:function(){return u.value=d.Open},goToItem:function(e,t){var n=f(e===c.Specific?{focus:c.Specific,id:t}:{focus:e},{resolveItems:function(){return s.value},resolveActiveIndex:function(){return p.value},resolveId:function(e){return e.id},resolveDisabled:function(e){return e.dataRef.disabled}});""===v.value&&p.value===n||(v.value="",p.value=n)},search:function(e){v.value+=e;var t=s.value.findIndex((function(e){return e.dataRef.textValue.startsWith(v.value)&&!e.dataRef.disabled}));-1!==t&&t!==p.value&&(p.value=t)},clearSearch:function(){v.value=""},registerItem:function(e,t){s.value.push({id:e,dataRef:t})},unregisterItem:function(e){var t=s.value.slice(),n=null!==p.value?t[p.value]:null,o=t.findIndex((function(t){return t.id===e}));-1!==o&&t.splice(o,1),s.value=t,p.value=o===p.value||null===n?null:t.indexOf(n)}};return n.onMounted((function(){function e(e){var t,n,o,r=e.target,a=document.activeElement;u.value===d.Open&&((null==(t=l.value)?void 0:t.contains(r))||((null==(n=i.value)?void 0:n.contains(r))||b.closeMenu(),a!==document.body&&(null==a?void 0:a.contains(r))||e.defaultPrevented||null==(o=l.value)||o.focus({preventScroll:!0})))}window.addEventListener("mousedown",e),n.onUnmounted((function(){return window.removeEventListener("mousedown",e)}))})),n.provide(m,b),function(){return a({props:e,slot:{open:u.value===d.Open},slots:o,attrs:r})}}}),S=n.defineComponent({props:{disabled:{type:Boolean,default:!1},as:{type:[Object,String],default:"button"}},render:function(){var e,t=h("MenuButton"),n={open:t.menuState.value===d.Open},r={ref:"el",id:this.id,type:"button","aria-haspopup":!0,"aria-controls":null==(e=t.itemsRef.value)?void 0:e.id,"aria-expanded":t.menuState.value===d.Open||void 0,onKeyDown:this.handleKeyDown,onClick:this.handleClick};return a({props:o({},this.$props,r),slot:n,attrs:this.$attrs,slots:this.$slots})},setup:function(e){var t=h("MenuButton");return{id:"headlessui-menu-button-"+p(),el:t.buttonRef,handleKeyDown:function(e){switch(e.key){case s.Space:case s.Enter:case s.ArrowDown:e.preventDefault(),t.openMenu(),n.nextTick((function(){var e;null==(e=t.itemsRef.value)||e.focus({preventScroll:!0}),t.goToItem(c.First)}));break;case s.ArrowUp:e.preventDefault(),t.openMenu(),n.nextTick((function(){var e;null==(e=t.itemsRef.value)||e.focus({preventScroll:!0}),t.goToItem(c.Last)}))}},handleClick:function(o){var r;e.disabled||(t.menuState.value===d.Open?(t.closeMenu(),n.nextTick((function(){var e;return null==(e=t.buttonRef.value)?void 0:e.focus({preventScroll:!0})}))):(o.preventDefault(),t.openMenu(),r=function(){var e;return null==(e=t.itemsRef.value)?void 0:e.focus({preventScroll:!0})},requestAnimationFrame((function(){return requestAnimationFrame(r)}))))}}}}),g=n.defineComponent({props:{as:{type:[Object,String],default:"div"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0}},render:function(){var t,n,r=h("MenuItems"),u={open:r.menuState.value===d.Open},l={"aria-activedescendant":null===r.activeItemIndex.value||null==(t=r.items.value[r.activeItemIndex.value])?void 0:t.id,"aria-labelledby":null==(n=r.buttonRef.value)?void 0:n.id,id:this.id,onKeyDown:this.handleKeyDown,role:"menu",tabIndex:0,ref:"el"};return a({props:o({},this.$props,l),slot:u,attrs:this.$attrs,slots:this.$slots,features:e.RenderStrategy|e.Static,visible:u.open})},setup:function(){var e=h("MenuItems"),t="headlessui-menu-items-"+p(),o=n.ref(null);return{id:t,el:e.itemsRef,handleKeyDown:function(t){switch(o.value&&clearTimeout(o.value),t.key){case s.Space:if(""!==e.searchQuery.value)return t.preventDefault(),e.search(t.key);case s.Enter:var r;t.preventDefault(),null!==e.activeItemIndex.value&&(null==(r=document.getElementById(e.items.value[e.activeItemIndex.value].id))||r.click()),e.closeMenu(),n.nextTick((function(){var t;return null==(t=e.buttonRef.value)?void 0:t.focus({preventScroll:!0})}));break;case s.ArrowDown:return t.preventDefault(),e.goToItem(c.Next);case s.ArrowUp:return t.preventDefault(),e.goToItem(c.Previous);case s.Home:case s.PageUp:return t.preventDefault(),e.goToItem(c.First);case s.End:case s.PageDown:return t.preventDefault(),e.goToItem(c.Last);case s.Escape:t.preventDefault(),e.closeMenu(),n.nextTick((function(){var t;return null==(t=e.buttonRef.value)?void 0:t.focus({preventScroll:!0})}));break;case s.Tab:return t.preventDefault();default:1===t.key.length&&(e.search(t.key),o.value=setTimeout((function(){return e.clearSearch()}),350))}}}}}),w=n.defineComponent({props:{as:{type:[Object,String],default:"template"},disabled:{type:Boolean,default:!1},class:{type:[String,Function],required:!1},className:{type:[String,Function],required:!1}},setup:function(e,t){var r=t.slots,u=t.attrs,l=h("MenuItem"),i="headlessui-menu-item-"+p(),s=e.disabled,d=e.className,v=void 0===d?e.class:d,f=n.computed((function(){return null!==l.activeItemIndex.value&&l.items.value[l.activeItemIndex.value].id===i})),m=n.ref({disabled:s,textValue:""});function x(e){if(s)return e.preventDefault();l.closeMenu(),n.nextTick((function(){var e;return null==(e=l.buttonRef.value)?void 0:e.focus({preventScroll:!0})}))}function y(){if(s)return l.goToItem(c.Nothing);l.goToItem(c.Specific,i)}function S(){s||f.value||l.goToItem(c.Specific,i)}function g(){s||f.value&&l.goToItem(c.Nothing)}return n.onMounted((function(){var e,t,n=null==(e=document.getElementById(i))||null==(t=e.textContent)?void 0:t.toLowerCase().trim();void 0!==n&&(m.value.textValue=n)})),n.onMounted((function(){return l.registerItem(i,m)})),n.onUnmounted((function(){return l.unregisterItem(i)})),function(){var t={active:f.value,disabled:s},n={id:i,role:"menuitem",tabIndex:-1,class:b(v,t),"aria-disabled":!0===s||void 0,onClick:x,onFocus:y,onPointerMove:S,onMouseMove:S,onPointerLeave:g,onMouseLeave:g};return a({props:o({},e,n),slot:t,attrs:u,slots:r})}}});!function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(x||(x={}));var O=Symbol("ListboxContext");function I(e){var t=n.inject(O,null);if(null===t){var o=new Error("<"+e+" /> is missing a parent <Listbox /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(o,I),o}return t}var k=n.defineComponent({name:"Listbox",emits:["update:modelValue"],props:{as:{type:[Object,String],default:"template"},modelValue:{type:[Object,String,Number,Boolean],default:null}},setup:function(e,t){var o=t.slots,u=t.attrs,l=t.emit,i=r(e,["modelValue"]),s=n.ref(x.Closed),d=n.ref(null),v=n.ref(null),p=n.ref(null),b=n.ref([]),m=n.ref(""),h=n.ref(null),y=n.computed((function(){return e.modelValue})),S={listboxState:s,value:y,labelRef:d,buttonRef:v,optionsRef:p,options:b,searchQuery:m,activeOptionIndex:h,closeListbox:function(){s.value=x.Closed,h.value=null},openListbox:function(){return s.value=x.Open},goToOption:function(e,t){var n=f(e===c.Specific?{focus:c.Specific,id:t}:{focus:e},{resolveItems:function(){return b.value},resolveActiveIndex:function(){return h.value},resolveId:function(e){return e.id},resolveDisabled:function(e){return e.dataRef.disabled}});""===m.value&&h.value===n||(m.value="",h.value=n)},search:function(e){m.value+=e;var t=b.value.findIndex((function(e){return!e.dataRef.disabled&&e.dataRef.textValue.startsWith(m.value)}));-1!==t&&t!==h.value&&(h.value=t)},clearSearch:function(){m.value=""},registerOption:function(e,t){b.value.push({id:e,dataRef:t})},unregisterOption:function(e){var t=b.value.slice(),n=null!==h.value?t[h.value]:null,o=t.findIndex((function(t){return t.id===e}));-1!==o&&t.splice(o,1),b.value=t,h.value=o===h.value||null===n?null:t.indexOf(n)},select:function(e){l("update:modelValue",e)}};return n.onMounted((function(){function e(e){var t,n,o,r=e.target,u=document.activeElement;s.value===x.Open&&((null==(t=v.value)?void 0:t.contains(r))||((null==(n=p.value)?void 0:n.contains(r))||S.closeListbox(),u!==document.body&&(null==u?void 0:u.contains(r))||e.defaultPrevented||null==(o=v.value)||o.focus({preventScroll:!0})))}window.addEventListener("mousedown",e),n.onUnmounted((function(){return window.removeEventListener("mousedown",e)}))})),n.provide(O,S),function(){return a({props:i,slot:{open:s.value===x.Open},slots:o,attrs:u})}}}),R=n.defineComponent({name:"ListboxLabel",props:{as:{type:[Object,String],default:"label"}},render:function(){var e={open:I("ListboxLabel").listboxState.value===x.Open};return a({props:o({},this.$props,{id:this.id,ref:"el",onClick:this.handleClick}),slot:e,attrs:this.$attrs,slots:this.$slots})},setup:function(){var e=I("ListboxLabel");return{id:"headlessui-listbox-label-"+p(),el:e.labelRef,handleClick:function(){var t;null==(t=e.buttonRef.value)||t.focus({preventScroll:!0})}}}}),D=n.defineComponent({name:"ListboxButton",props:{disabled:{type:Boolean,default:!1},as:{type:[Object,String],default:"button"}},render:function(){var e,t=I("ListboxButton"),n={open:t.listboxState.value===x.Open},r={ref:"el",id:this.id,type:"button","aria-haspopup":!0,"aria-controls":null==(e=t.optionsRef.value)?void 0:e.id,"aria-expanded":t.listboxState.value===x.Open||void 0,"aria-labelledby":t.labelRef.value?[t.labelRef.value.id,this.id].join(" "):void 0,onKeyDown:this.handleKeyDown,onClick:this.handleClick};return a({props:o({},this.$props,r),slot:n,attrs:this.$attrs,slots:this.$slots})},setup:function(e){var t=I("ListboxButton");return{id:"headlessui-listbox-button-"+p(),el:t.buttonRef,handleKeyDown:function(e){switch(e.key){case s.Space:case s.Enter:case s.ArrowDown:e.preventDefault(),t.openListbox(),n.nextTick((function(){var e;null==(e=t.optionsRef.value)||e.focus({preventScroll:!0}),t.value.value||t.goToOption(c.First)}));break;case s.ArrowUp:e.preventDefault(),t.openListbox(),n.nextTick((function(){var e;null==(e=t.optionsRef.value)||e.focus({preventScroll:!0}),t.value.value||t.goToOption(c.Last)}))}},handleClick:function(o){var r;e.disabled||(t.listboxState.value===x.Open?(t.closeListbox(),n.nextTick((function(){var e;return null==(e=t.buttonRef.value)?void 0:e.focus({preventScroll:!0})}))):(o.preventDefault(),t.openListbox(),r=function(){var e;return null==(e=t.optionsRef.value)?void 0:e.focus({preventScroll:!0})},requestAnimationFrame((function(){return requestAnimationFrame(r)}))))}}}}),T=n.defineComponent({name:"ListboxOptions",props:{as:{type:[Object,String],default:"ul"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0}},render:function(){var t,n,r,u,l=I("ListboxOptions"),i={open:l.listboxState.value===x.Open},s={"aria-activedescendant":null===l.activeOptionIndex.value||null==(t=l.options.value[l.activeOptionIndex.value])?void 0:t.id,"aria-labelledby":null!=(n=null==(r=l.labelRef.value)?void 0:r.id)?n:null==(u=l.buttonRef.value)?void 0:u.id,id:this.id,onKeyDown:this.handleKeyDown,role:"listbox",tabIndex:0,ref:"el"};return a({props:o({},this.$props,s),slot:i,attrs:this.$attrs,slots:this.$slots,features:e.RenderStrategy|e.Static,visible:i.open})},setup:function(){var e=I("ListboxOptions"),t="headlessui-listbox-options-"+p(),o=n.ref(null);return{id:t,el:e.optionsRef,handleKeyDown:function(t){switch(o.value&&clearTimeout(o.value),t.key){case s.Space:if(""!==e.searchQuery.value)return t.preventDefault(),e.search(t.key);case s.Enter:t.preventDefault(),null!==e.activeOptionIndex.value&&e.select(e.options.value[e.activeOptionIndex.value].dataRef.value),e.closeListbox(),n.nextTick((function(){var t;return null==(t=e.buttonRef.value)?void 0:t.focus({preventScroll:!0})}));break;case s.ArrowDown:return t.preventDefault(),e.goToOption(c.Next);case s.ArrowUp:return t.preventDefault(),e.goToOption(c.Previous);case s.Home:case s.PageUp:return t.preventDefault(),e.goToOption(c.First);case s.End:case s.PageDown:return t.preventDefault(),e.goToOption(c.Last);case s.Escape:t.preventDefault(),e.closeListbox(),n.nextTick((function(){var t;return null==(t=e.buttonRef.value)?void 0:t.focus({preventScroll:!0})}));break;case s.Tab:return t.preventDefault();default:1===t.key.length&&(e.search(t.key),o.value=setTimeout((function(){return e.clearSearch()}),350))}}}}}),L=n.defineComponent({name:"ListboxOption",props:{as:{type:[Object,String],default:"li"},value:{type:[Object,String],default:null},disabled:{type:Boolean,default:!1},class:{type:[String,Function],required:!1},className:{type:[String,Function],required:!1}},setup:function(e,t){var r=t.slots,u=t.attrs,l=I("ListboxOption"),i="headlessui-listbox-option-"+p(),s=e.disabled,d=e.className,v=void 0===d?e.class:d,f=e.value,m=n.computed((function(){return null!==l.activeOptionIndex.value&&l.options.value[l.activeOptionIndex.value].id===i})),h=n.computed((function(){return n.toRaw(l.value.value)===n.toRaw(f)})),y=n.ref({disabled:s,value:f,textValue:""});function S(e){if(s)return e.preventDefault();l.select(f),l.closeListbox(),n.nextTick((function(){var e;return null==(e=l.buttonRef.value)?void 0:e.focus({preventScroll:!0})}))}function g(){if(s)return l.goToOption(c.Nothing);l.goToOption(c.Specific,i)}function w(){s||m.value||l.goToOption(c.Specific,i)}function O(){s||m.value&&l.goToOption(c.Nothing)}return n.onMounted((function(){var e,t,n=null==(e=document.getElementById(i))||null==(t=e.textContent)?void 0:t.toLowerCase().trim();void 0!==n&&(y.value.textValue=n)})),n.onMounted((function(){return l.registerOption(i,y)})),n.onUnmounted((function(){return l.unregisterOption(i)})),n.onMounted((function(){n.watch([l.listboxState,h],(function(){var e;l.listboxState.value===x.Open&&h.value&&(l.goToOption(c.Specific,i),null==(e=document.getElementById(i))||null==e.focus||e.focus())}),{immediate:!0})})),n.watchEffect((function(){l.listboxState.value===x.Open&&m.value&&n.nextTick((function(){var e;return null==(e=document.getElementById(i))||null==e.scrollIntoView?void 0:e.scrollIntoView({block:"nearest"})}))})),function(){var t={active:m.value,selected:h.value,disabled:s},n={id:i,role:"option",tabIndex:-1,class:b(v,t),"aria-disabled":!0===s||void 0,"aria-selected":!0===h.value?h.value:void 0,onClick:S,onFocus:g,onPointerMove:w,onMouseMove:w,onPointerLeave:O,onMouseLeave:O};return a({props:o({},e,n),slot:t,attrs:u,slots:r})}}}),C=Symbol("GroupContext");function E(e){var t=n.inject(C,null);if(null===t){var o=new Error("<"+e+" /> is missing a parent <SwitchGroup /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(o,E),o}return t}var M=n.defineComponent({name:"SwitchGroup",props:{as:{type:[Object,String],default:"template"}},setup:function(e,t){var o=t.slots,r=t.attrs,u=n.ref(null),l=n.ref(null);return n.provide(C,{switchRef:u,labelRef:l}),function(){return a({props:e,slot:{},slots:o,attrs:r})}}}),j=n.defineComponent({name:"Switch",emits:["update:modelValue"],props:{as:{type:[Object,String],default:"button"},modelValue:{type:[Object,Boolean],default:null},class:{type:[String,Function],required:!1},className:{type:[String,Function],required:!1}},render:function(){var e=n.inject(C,null),t=this.$props,r=t.className,u=void 0===r?t.class:r,l=n.computed((function(){var t;return null==e||null==(t=e.labelRef.value)?void 0:t.id})),i={checked:this.$props.modelValue},s={id:this.id,ref:null===e?void 0:e.switchRef,role:"switch",tabIndex:0,class:b(u,i),"aria-checked":this.$props.modelValue,"aria-labelledby":l.value,onClick:this.handleClick,onKeyUp:this.handleKeyUp,onKeyPress:this.handleKeyPress};return"button"===this.$props.as&&Object.assign(s,{type:"button"}),a({props:o({},this.$props,s),slot:i,attrs:this.$attrs,slots:this.$slots})},setup:function(e,t){var o=t.emit,r=n.inject(C,null);function u(){o("update:modelValue",!e.modelValue)}return{id:"headlessui-switch-"+p(),el:null==r?void 0:r.switchRef,handleClick:function(e){e.preventDefault(),u()},handleKeyUp:function(e){e.key!==s.Tab&&e.preventDefault(),e.key===s.Space&&u()},handleKeyPress:function(e){e.preventDefault()}}}}),A=n.defineComponent({name:"SwitchLabel",props:{as:{type:[Object,String],default:"label"}},render:function(){return a({props:o({},this.$props,{id:this.id,ref:"el",onClick:this.handleClick}),slot:{},attrs:this.$attrs,slots:this.$slots})},setup:function(){var e=E("SwitchLabel");return{id:"headlessui-switch-label-"+p(),el:e.labelRef,handleClick:function(){var t,n;null==(t=e.switchRef.value)||t.click(),null==(n=e.switchRef.value)||n.focus({preventScroll:!0})}}}});exports.Listbox=k,exports.ListboxButton=D,exports.ListboxLabel=R,exports.ListboxOption=L,exports.ListboxOptions=T,exports.Menu=y,exports.MenuButton=S,exports.MenuItem=w,exports.MenuItems=g,exports.Switch=j,exports.SwitchGroup=M,exports.SwitchLabel=A;
//# sourceMappingURL=headlessui.cjs.production.min.js.map

@@ -453,5 +453,5 @@ import { cloneVNode, h, defineComponent, ref, onMounted, onUnmounted, provide, computed, inject, nextTick, toRaw, watch, watchEffect } from 'vue';

window.addEventListener('click', handler);
window.addEventListener('mousedown', handler);
onUnmounted(function () {
return window.removeEventListener('click', handler);
return window.removeEventListener('mousedown', handler);
});

@@ -969,5 +969,5 @@ }); // @ts-expect-error Types of property 'dataRef' are incompatible.

window.addEventListener('click', handler);
window.addEventListener('mousedown', handler);
onUnmounted(function () {
return window.removeEventListener('click', handler);
return window.removeEventListener('mousedown', handler);
});

@@ -974,0 +974,0 @@ }); // @ts-expect-error Types of property 'dataRef' are incompatible.

@@ -457,5 +457,5 @@ (function (global, factory) {

window.addEventListener('click', handler);
window.addEventListener('mousedown', handler);
vue.onUnmounted(function () {
return window.removeEventListener('click', handler);
return window.removeEventListener('mousedown', handler);
});

@@ -973,5 +973,5 @@ }); // @ts-expect-error Types of property 'dataRef' are incompatible.

window.addEventListener('click', handler);
window.addEventListener('mousedown', handler);
vue.onUnmounted(function () {
return window.removeEventListener('click', handler);
return window.removeEventListener('mousedown', handler);
});

@@ -978,0 +978,0 @@ }); // @ts-expect-error Types of property 'dataRef' are incompatible.

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t((e=e||self).headlessui={},e.Vue)}(this,(function(e,t){"use strict";function n(){return(n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}function o(e,t){if(null==e)return{};var n,o,r={},u=Object.keys(e);for(o=0;o<u.length;o++)t.indexOf(n=u[o])>=0||(r[n]=e[n]);return r}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function u(e,t){if(e in t){for(var n=t[e],o=arguments.length,r=new Array(o>2?o-2:0),l=2;l<o;l++)r[l-2]=arguments[l];return"function"==typeof n?n.apply(void 0,r):n}var a=new Error('Tried to handle "'+e+'" but there is no handler defined. Only defined handlers are: '+Object.keys(t).map((function(e){return'"'+e+'"'})).join(", ")+".");throw Error.captureStackTrace&&Error.captureStackTrace(a,u),a}var l,a;function i(e){var t,r,i=e.visible,c=void 0===i||i,d=e.features,v=void 0===d?l.None:d,f=o(e,["visible","features"]);return c||v&l.Static&&f.props.static?s(f):v&l.RenderStrategy?u(null==(t=f.props.unmount)||t?a.Unmount:a.Hidden,((r={})[a.Unmount]=function(){return null},r[a.Hidden]=function(){return s(n({},f,{props:n({},f.props,{hidden:!0,style:{display:"none"}})}))},r)):s(f)}function s(e){var n=e.attrs,u=e.slots,l=e.slot,a=function(e,t){void 0===t&&(t=[]);for(var n,o=Object.assign({},e),u=function(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return r(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,void 0):void 0}}(e))){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}(t);!(n=u()).done;){var l=n.value;l in o&&delete o[l]}return o}(e.props,["unmount","static"]),i=a.as,s=o(a,["as"]),c=null==u.default?void 0:u.default(l);if("template"===i){if(Object.keys(s).length>0||"class"in n){var d=null!=c?c:[],v=d[0];if(d.slice(1).length>0)throw new Error('You should only render 1 child or use the `as="..."` prop');return t.cloneVNode(v,s)}return c}return t.h(i,s,c)}!function(e){e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static"}(l||(l={})),function(e){e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden"}(a||(a={}));var c,d,v,f=0;function p(){return++f}function b(e,t){var n=t.resolveItems();if(n.length<=0)return null;var o=t.resolveActiveIndex(),r=null!=o?o:-1,u=function(){switch(e.focus){case d.First:return n.findIndex((function(e){return!t.resolveDisabled(e)}));case d.Previous:var o=n.slice().reverse().findIndex((function(e,n,o){return!(-1!==r&&o.length-n-1>=r||t.resolveDisabled(e))}));return-1===o?o:n.length-1-o;case d.Next:return n.findIndex((function(e,n){return!(n<=r||t.resolveDisabled(e))}));case d.Last:var u=n.slice().reverse().findIndex((function(e){return!t.resolveDisabled(e)}));return-1===u?u:n.length-1-u;case d.Specific:return n.findIndex((function(n){return t.resolveId(n)===e.id}));case d.Nothing:return null;default:!function(e){throw new Error("Unexpected object: "+e)}(e)}}();return-1===u?o:u}function m(e,t){if(void 0!==e)return"function"==typeof e?e(t):e}!function(e){e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.ArrowUp="ArrowUp",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab"}(c||(c={})),function(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"}(d||(d={})),function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(v||(v={}));var h=Symbol("MenuContext");function y(e){var n=t.inject(h,null);if(null===n){var o=new Error("<"+e+" /> is missing a parent <Menu /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(o,y),o}return n}var x,S=t.defineComponent({props:{as:{type:[Object,String],default:"template"}},setup:function(e,n){var o=n.slots,r=n.attrs,u=t.ref(v.Closed),l=t.ref(null),a=t.ref(null),s=t.ref([]),c=t.ref(""),f=t.ref(null),p={menuState:u,buttonRef:l,itemsRef:a,items:s,searchQuery:c,activeItemIndex:f,closeMenu:function(){u.value=v.Closed,f.value=null},openMenu:function(){return u.value=v.Open},goToItem:function(e,t){var n=b(e===d.Specific?{focus:d.Specific,id:t}:{focus:e},{resolveItems:function(){return s.value},resolveActiveIndex:function(){return f.value},resolveId:function(e){return e.id},resolveDisabled:function(e){return e.dataRef.disabled}});""===c.value&&f.value===n||(c.value="",f.value=n)},search:function(e){c.value+=e;var t=s.value.findIndex((function(e){return e.dataRef.textValue.startsWith(c.value)&&!e.dataRef.disabled}));-1!==t&&t!==f.value&&(f.value=t)},clearSearch:function(){c.value=""},registerItem:function(e,t){s.value.push({id:e,dataRef:t})},unregisterItem:function(e){var t=s.value.slice(),n=null!==f.value?t[f.value]:null,o=t.findIndex((function(t){return t.id===e}));-1!==o&&t.splice(o,1),s.value=t,f.value=o===f.value||null===n?null:t.indexOf(n)}};return t.onMounted((function(){function e(e){var t,n,o,r=e.target,i=document.activeElement;u.value===v.Open&&((null==(t=l.value)?void 0:t.contains(r))||((null==(n=a.value)?void 0:n.contains(r))||p.closeMenu(),i!==document.body&&(null==i?void 0:i.contains(r))||e.defaultPrevented||null==(o=l.value)||o.focus({preventScroll:!0})))}window.addEventListener("click",e),t.onUnmounted((function(){return window.removeEventListener("click",e)}))})),t.provide(h,p),function(){return i({props:e,slot:{open:u.value===v.Open},slots:o,attrs:r})}}}),g=t.defineComponent({props:{disabled:{type:Boolean,default:!1},as:{type:[Object,String],default:"button"}},render:function(){var e,t=y("MenuButton"),o={open:t.menuState.value===v.Open},r={ref:"el",id:this.id,type:"button","aria-haspopup":!0,"aria-controls":null==(e=t.itemsRef.value)?void 0:e.id,"aria-expanded":t.menuState.value===v.Open||void 0,onKeyDown:this.handleKeyDown,onClick:this.handleClick};return i({props:n({},this.$props,r),slot:o,attrs:this.$attrs,slots:this.$slots})},setup:function(e){var n=y("MenuButton");return{id:"headlessui-menu-button-"+p(),el:n.buttonRef,handleKeyDown:function(e){switch(e.key){case c.Space:case c.Enter:case c.ArrowDown:e.preventDefault(),n.openMenu(),t.nextTick((function(){var e;null==(e=n.itemsRef.value)||e.focus({preventScroll:!0}),n.goToItem(d.First)}));break;case c.ArrowUp:e.preventDefault(),n.openMenu(),t.nextTick((function(){var e;null==(e=n.itemsRef.value)||e.focus({preventScroll:!0}),n.goToItem(d.Last)}))}},handleClick:function(o){var r;e.disabled||(n.menuState.value===v.Open?(n.closeMenu(),t.nextTick((function(){var e;return null==(e=n.buttonRef.value)?void 0:e.focus({preventScroll:!0})}))):(o.preventDefault(),n.openMenu(),r=function(){var e;return null==(e=n.itemsRef.value)?void 0:e.focus({preventScroll:!0})},requestAnimationFrame((function(){return requestAnimationFrame(r)}))))}}}}),w=t.defineComponent({props:{as:{type:[Object,String],default:"div"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0}},render:function(){var e,t,o=y("MenuItems"),r={open:o.menuState.value===v.Open},u={"aria-activedescendant":null===o.activeItemIndex.value||null==(e=o.items.value[o.activeItemIndex.value])?void 0:e.id,"aria-labelledby":null==(t=o.buttonRef.value)?void 0:t.id,id:this.id,onKeyDown:this.handleKeyDown,role:"menu",tabIndex:0,ref:"el"};return i({props:n({},this.$props,u),slot:r,attrs:this.$attrs,slots:this.$slots,features:l.RenderStrategy|l.Static,visible:r.open})},setup:function(){var e=y("MenuItems"),n="headlessui-menu-items-"+p(),o=t.ref(null);return{id:n,el:e.itemsRef,handleKeyDown:function(n){switch(o.value&&clearTimeout(o.value),n.key){case c.Space:if(""!==e.searchQuery.value)return n.preventDefault(),e.search(n.key);case c.Enter:var r;n.preventDefault(),null!==e.activeItemIndex.value&&(null==(r=document.getElementById(e.items.value[e.activeItemIndex.value].id))||r.click()),e.closeMenu(),t.nextTick((function(){var t;return null==(t=e.buttonRef.value)?void 0:t.focus({preventScroll:!0})}));break;case c.ArrowDown:return n.preventDefault(),e.goToItem(d.Next);case c.ArrowUp:return n.preventDefault(),e.goToItem(d.Previous);case c.Home:case c.PageUp:return n.preventDefault(),e.goToItem(d.First);case c.End:case c.PageDown:return n.preventDefault(),e.goToItem(d.Last);case c.Escape:n.preventDefault(),e.closeMenu(),t.nextTick((function(){var t;return null==(t=e.buttonRef.value)?void 0:t.focus({preventScroll:!0})}));break;case c.Tab:return n.preventDefault();default:1===n.key.length&&(e.search(n.key),o.value=setTimeout((function(){return e.clearSearch()}),350))}}}}}),O=t.defineComponent({props:{as:{type:[Object,String],default:"template"},disabled:{type:Boolean,default:!1},class:{type:[String,Function],required:!1},className:{type:[String,Function],required:!1}},setup:function(e,o){var r=o.slots,u=o.attrs,l=y("MenuItem"),a="headlessui-menu-item-"+p(),s=e.disabled,c=e.className,v=void 0===c?e.class:c,f=t.computed((function(){return null!==l.activeItemIndex.value&&l.items.value[l.activeItemIndex.value].id===a})),b=t.ref({disabled:s,textValue:""});function h(e){if(s)return e.preventDefault();l.closeMenu(),t.nextTick((function(){var e;return null==(e=l.buttonRef.value)?void 0:e.focus({preventScroll:!0})}))}function x(){if(s)return l.goToItem(d.Nothing);l.goToItem(d.Specific,a)}function S(){s||f.value||l.goToItem(d.Specific,a)}function g(){s||f.value&&l.goToItem(d.Nothing)}return t.onMounted((function(){var e,t,n=null==(e=document.getElementById(a))||null==(t=e.textContent)?void 0:t.toLowerCase().trim();void 0!==n&&(b.value.textValue=n)})),t.onMounted((function(){return l.registerItem(a,b)})),t.onUnmounted((function(){return l.unregisterItem(a)})),function(){var t={active:f.value,disabled:s},o={id:a,role:"menuitem",tabIndex:-1,class:m(v,t),"aria-disabled":!0===s||void 0,onClick:h,onFocus:x,onPointerMove:S,onMouseMove:S,onPointerLeave:g,onMouseLeave:g};return i({props:n({},e,o),slot:t,attrs:u,slots:r})}}});!function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(x||(x={}));var I=Symbol("ListboxContext");function k(e){var n=t.inject(I,null);if(null===n){var o=new Error("<"+e+" /> is missing a parent <Listbox /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(o,k),o}return n}var R=t.defineComponent({name:"Listbox",emits:["update:modelValue"],props:{as:{type:[Object,String],default:"template"},modelValue:{type:[Object,String,Number,Boolean],default:null}},setup:function(e,n){var r=n.slots,u=n.attrs,l=n.emit,a=o(e,["modelValue"]),s=t.ref(x.Closed),c=t.ref(null),v=t.ref(null),f=t.ref(null),p=t.ref([]),m=t.ref(""),h=t.ref(null),y=t.computed((function(){return e.modelValue})),S={listboxState:s,value:y,labelRef:c,buttonRef:v,optionsRef:f,options:p,searchQuery:m,activeOptionIndex:h,closeListbox:function(){s.value=x.Closed,h.value=null},openListbox:function(){return s.value=x.Open},goToOption:function(e,t){var n=b(e===d.Specific?{focus:d.Specific,id:t}:{focus:e},{resolveItems:function(){return p.value},resolveActiveIndex:function(){return h.value},resolveId:function(e){return e.id},resolveDisabled:function(e){return e.dataRef.disabled}});""===m.value&&h.value===n||(m.value="",h.value=n)},search:function(e){m.value+=e;var t=p.value.findIndex((function(e){return!e.dataRef.disabled&&e.dataRef.textValue.startsWith(m.value)}));-1!==t&&t!==h.value&&(h.value=t)},clearSearch:function(){m.value=""},registerOption:function(e,t){p.value.push({id:e,dataRef:t})},unregisterOption:function(e){var t=p.value.slice(),n=null!==h.value?t[h.value]:null,o=t.findIndex((function(t){return t.id===e}));-1!==o&&t.splice(o,1),p.value=t,h.value=o===h.value||null===n?null:t.indexOf(n)},select:function(e){l("update:modelValue",e)}};return t.onMounted((function(){function e(e){var t,n,o,r=e.target,u=document.activeElement;s.value===x.Open&&((null==(t=v.value)?void 0:t.contains(r))||((null==(n=f.value)?void 0:n.contains(r))||S.closeListbox(),u!==document.body&&(null==u?void 0:u.contains(r))||e.defaultPrevented||null==(o=v.value)||o.focus({preventScroll:!0})))}window.addEventListener("click",e),t.onUnmounted((function(){return window.removeEventListener("click",e)}))})),t.provide(I,S),function(){return i({props:a,slot:{open:s.value===x.Open},slots:r,attrs:u})}}}),D=t.defineComponent({name:"ListboxLabel",props:{as:{type:[Object,String],default:"label"}},render:function(){var e={open:k("ListboxLabel").listboxState.value===x.Open};return i({props:n({},this.$props,{id:this.id,ref:"el",onClick:this.handleClick}),slot:e,attrs:this.$attrs,slots:this.$slots})},setup:function(){var e=k("ListboxLabel");return{id:"headlessui-listbox-label-"+p(),el:e.labelRef,handleClick:function(){var t;null==(t=e.buttonRef.value)||t.focus({preventScroll:!0})}}}}),T=t.defineComponent({name:"ListboxButton",props:{disabled:{type:Boolean,default:!1},as:{type:[Object,String],default:"button"}},render:function(){var e,t=k("ListboxButton"),o={open:t.listboxState.value===x.Open},r={ref:"el",id:this.id,type:"button","aria-haspopup":!0,"aria-controls":null==(e=t.optionsRef.value)?void 0:e.id,"aria-expanded":t.listboxState.value===x.Open||void 0,"aria-labelledby":t.labelRef.value?[t.labelRef.value.id,this.id].join(" "):void 0,onKeyDown:this.handleKeyDown,onClick:this.handleClick};return i({props:n({},this.$props,r),slot:o,attrs:this.$attrs,slots:this.$slots})},setup:function(e){var n=k("ListboxButton");return{id:"headlessui-listbox-button-"+p(),el:n.buttonRef,handleKeyDown:function(e){switch(e.key){case c.Space:case c.Enter:case c.ArrowDown:e.preventDefault(),n.openListbox(),t.nextTick((function(){var e;null==(e=n.optionsRef.value)||e.focus({preventScroll:!0}),n.value.value||n.goToOption(d.First)}));break;case c.ArrowUp:e.preventDefault(),n.openListbox(),t.nextTick((function(){var e;null==(e=n.optionsRef.value)||e.focus({preventScroll:!0}),n.value.value||n.goToOption(d.Last)}))}},handleClick:function(o){var r;e.disabled||(n.listboxState.value===x.Open?(n.closeListbox(),t.nextTick((function(){var e;return null==(e=n.buttonRef.value)?void 0:e.focus({preventScroll:!0})}))):(o.preventDefault(),n.openListbox(),r=function(){var e;return null==(e=n.optionsRef.value)?void 0:e.focus({preventScroll:!0})},requestAnimationFrame((function(){return requestAnimationFrame(r)}))))}}}}),L=t.defineComponent({name:"ListboxOptions",props:{as:{type:[Object,String],default:"ul"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0}},render:function(){var e,t,o,r,u=k("ListboxOptions"),a={open:u.listboxState.value===x.Open},s={"aria-activedescendant":null===u.activeOptionIndex.value||null==(e=u.options.value[u.activeOptionIndex.value])?void 0:e.id,"aria-labelledby":null!=(t=null==(o=u.labelRef.value)?void 0:o.id)?t:null==(r=u.buttonRef.value)?void 0:r.id,id:this.id,onKeyDown:this.handleKeyDown,role:"listbox",tabIndex:0,ref:"el"};return i({props:n({},this.$props,s),slot:a,attrs:this.$attrs,slots:this.$slots,features:l.RenderStrategy|l.Static,visible:a.open})},setup:function(){var e=k("ListboxOptions"),n="headlessui-listbox-options-"+p(),o=t.ref(null);return{id:n,el:e.optionsRef,handleKeyDown:function(n){switch(o.value&&clearTimeout(o.value),n.key){case c.Space:if(""!==e.searchQuery.value)return n.preventDefault(),e.search(n.key);case c.Enter:n.preventDefault(),null!==e.activeOptionIndex.value&&e.select(e.options.value[e.activeOptionIndex.value].dataRef.value),e.closeListbox(),t.nextTick((function(){var t;return null==(t=e.buttonRef.value)?void 0:t.focus({preventScroll:!0})}));break;case c.ArrowDown:return n.preventDefault(),e.goToOption(d.Next);case c.ArrowUp:return n.preventDefault(),e.goToOption(d.Previous);case c.Home:case c.PageUp:return n.preventDefault(),e.goToOption(d.First);case c.End:case c.PageDown:return n.preventDefault(),e.goToOption(d.Last);case c.Escape:n.preventDefault(),e.closeListbox(),t.nextTick((function(){var t;return null==(t=e.buttonRef.value)?void 0:t.focus({preventScroll:!0})}));break;case c.Tab:return n.preventDefault();default:1===n.key.length&&(e.search(n.key),o.value=setTimeout((function(){return e.clearSearch()}),350))}}}}}),C=t.defineComponent({name:"ListboxOption",props:{as:{type:[Object,String],default:"li"},value:{type:[Object,String],default:null},disabled:{type:Boolean,default:!1},class:{type:[String,Function],required:!1},className:{type:[String,Function],required:!1}},setup:function(e,o){var r=o.slots,u=o.attrs,l=k("ListboxOption"),a="headlessui-listbox-option-"+p(),s=e.disabled,c=e.className,v=void 0===c?e.class:c,f=e.value,b=t.computed((function(){return null!==l.activeOptionIndex.value&&l.options.value[l.activeOptionIndex.value].id===a})),h=t.computed((function(){return t.toRaw(l.value.value)===t.toRaw(f)})),y=t.ref({disabled:s,value:f,textValue:""});function S(e){if(s)return e.preventDefault();l.select(f),l.closeListbox(),t.nextTick((function(){var e;return null==(e=l.buttonRef.value)?void 0:e.focus({preventScroll:!0})}))}function g(){if(s)return l.goToOption(d.Nothing);l.goToOption(d.Specific,a)}function w(){s||b.value||l.goToOption(d.Specific,a)}function O(){s||b.value&&l.goToOption(d.Nothing)}return t.onMounted((function(){var e,t,n=null==(e=document.getElementById(a))||null==(t=e.textContent)?void 0:t.toLowerCase().trim();void 0!==n&&(y.value.textValue=n)})),t.onMounted((function(){return l.registerOption(a,y)})),t.onUnmounted((function(){return l.unregisterOption(a)})),t.onMounted((function(){t.watch([l.listboxState,h],(function(){var e;l.listboxState.value===x.Open&&h.value&&(l.goToOption(d.Specific,a),null==(e=document.getElementById(a))||null==e.focus||e.focus())}),{immediate:!0})})),t.watchEffect((function(){l.listboxState.value===x.Open&&b.value&&t.nextTick((function(){var e;return null==(e=document.getElementById(a))||null==e.scrollIntoView?void 0:e.scrollIntoView({block:"nearest"})}))})),function(){var t={active:b.value,selected:h.value,disabled:s},o={id:a,role:"option",tabIndex:-1,class:m(v,t),"aria-disabled":!0===s||void 0,"aria-selected":!0===h.value?h.value:void 0,onClick:S,onFocus:g,onPointerMove:w,onMouseMove:w,onPointerLeave:O,onMouseLeave:O};return i({props:n({},e,o),slot:t,attrs:u,slots:r})}}}),E=Symbol("GroupContext");function M(e){var n=t.inject(E,null);if(null===n){var o=new Error("<"+e+" /> is missing a parent <SwitchGroup /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(o,M),o}return n}var j=t.defineComponent({name:"SwitchGroup",props:{as:{type:[Object,String],default:"template"}},setup:function(e,n){var o=n.slots,r=n.attrs,u=t.ref(null),l=t.ref(null);return t.provide(E,{switchRef:u,labelRef:l}),function(){return i({props:e,slot:{},slots:o,attrs:r})}}}),A=t.defineComponent({name:"Switch",emits:["update:modelValue"],props:{as:{type:[Object,String],default:"button"},modelValue:{type:[Object,Boolean],default:null},class:{type:[String,Function],required:!1},className:{type:[String,Function],required:!1}},render:function(){var e=t.inject(E,null),o=this.$props,r=o.className,u=void 0===r?o.class:r,l=t.computed((function(){var t;return null==e||null==(t=e.labelRef.value)?void 0:t.id})),a={checked:this.$props.modelValue},s={id:this.id,ref:null===e?void 0:e.switchRef,role:"switch",tabIndex:0,class:m(u,a),"aria-checked":this.$props.modelValue,"aria-labelledby":l.value,onClick:this.handleClick,onKeyUp:this.handleKeyUp,onKeyPress:this.handleKeyPress};return"button"===this.$props.as&&Object.assign(s,{type:"button"}),i({props:n({},this.$props,s),slot:a,attrs:this.$attrs,slots:this.$slots})},setup:function(e,n){var o=n.emit,r=t.inject(E,null);function u(){o("update:modelValue",!e.modelValue)}return{id:"headlessui-switch-"+p(),el:null==r?void 0:r.switchRef,handleClick:function(e){e.preventDefault(),u()},handleKeyUp:function(e){e.key!==c.Tab&&e.preventDefault(),e.key===c.Space&&u()},handleKeyPress:function(e){e.preventDefault()}}}}),$=t.defineComponent({name:"SwitchLabel",props:{as:{type:[Object,String],default:"label"}},render:function(){return i({props:n({},this.$props,{id:this.id,ref:"el",onClick:this.handleClick}),slot:{},attrs:this.$attrs,slots:this.$slots})},setup:function(){var e=M("SwitchLabel");return{id:"headlessui-switch-label-"+p(),el:e.labelRef,handleClick:function(){var t,n;null==(t=e.switchRef.value)||t.click(),null==(n=e.switchRef.value)||n.focus({preventScroll:!0})}}}});e.Listbox=R,e.ListboxButton=T,e.ListboxLabel=D,e.ListboxOption=C,e.ListboxOptions=L,e.Menu=S,e.MenuButton=g,e.MenuItem=O,e.MenuItems=w,e.Switch=A,e.SwitchGroup=j,e.SwitchLabel=$,Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t((e=e||self).headlessui={},e.Vue)}(this,(function(e,t){"use strict";function n(){return(n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}function o(e,t){if(null==e)return{};var n,o,r={},u=Object.keys(e);for(o=0;o<u.length;o++)t.indexOf(n=u[o])>=0||(r[n]=e[n]);return r}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function u(e,t){if(e in t){for(var n=t[e],o=arguments.length,r=new Array(o>2?o-2:0),l=2;l<o;l++)r[l-2]=arguments[l];return"function"==typeof n?n.apply(void 0,r):n}var a=new Error('Tried to handle "'+e+'" but there is no handler defined. Only defined handlers are: '+Object.keys(t).map((function(e){return'"'+e+'"'})).join(", ")+".");throw Error.captureStackTrace&&Error.captureStackTrace(a,u),a}var l,a;function i(e){var t,r,i=e.visible,c=void 0===i||i,d=e.features,v=void 0===d?l.None:d,f=o(e,["visible","features"]);return c||v&l.Static&&f.props.static?s(f):v&l.RenderStrategy?u(null==(t=f.props.unmount)||t?a.Unmount:a.Hidden,((r={})[a.Unmount]=function(){return null},r[a.Hidden]=function(){return s(n({},f,{props:n({},f.props,{hidden:!0,style:{display:"none"}})}))},r)):s(f)}function s(e){var n=e.attrs,u=e.slots,l=e.slot,a=function(e,t){void 0===t&&(t=[]);for(var n,o=Object.assign({},e),u=function(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return r(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,void 0):void 0}}(e))){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}(t);!(n=u()).done;){var l=n.value;l in o&&delete o[l]}return o}(e.props,["unmount","static"]),i=a.as,s=o(a,["as"]),c=null==u.default?void 0:u.default(l);if("template"===i){if(Object.keys(s).length>0||"class"in n){var d=null!=c?c:[],v=d[0];if(d.slice(1).length>0)throw new Error('You should only render 1 child or use the `as="..."` prop');return t.cloneVNode(v,s)}return c}return t.h(i,s,c)}!function(e){e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static"}(l||(l={})),function(e){e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden"}(a||(a={}));var c,d,v,f=0;function p(){return++f}function b(e,t){var n=t.resolveItems();if(n.length<=0)return null;var o=t.resolveActiveIndex(),r=null!=o?o:-1,u=function(){switch(e.focus){case d.First:return n.findIndex((function(e){return!t.resolveDisabled(e)}));case d.Previous:var o=n.slice().reverse().findIndex((function(e,n,o){return!(-1!==r&&o.length-n-1>=r||t.resolveDisabled(e))}));return-1===o?o:n.length-1-o;case d.Next:return n.findIndex((function(e,n){return!(n<=r||t.resolveDisabled(e))}));case d.Last:var u=n.slice().reverse().findIndex((function(e){return!t.resolveDisabled(e)}));return-1===u?u:n.length-1-u;case d.Specific:return n.findIndex((function(n){return t.resolveId(n)===e.id}));case d.Nothing:return null;default:!function(e){throw new Error("Unexpected object: "+e)}(e)}}();return-1===u?o:u}function m(e,t){if(void 0!==e)return"function"==typeof e?e(t):e}!function(e){e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.ArrowUp="ArrowUp",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab"}(c||(c={})),function(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"}(d||(d={})),function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(v||(v={}));var h=Symbol("MenuContext");function y(e){var n=t.inject(h,null);if(null===n){var o=new Error("<"+e+" /> is missing a parent <Menu /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(o,y),o}return n}var x,S=t.defineComponent({props:{as:{type:[Object,String],default:"template"}},setup:function(e,n){var o=n.slots,r=n.attrs,u=t.ref(v.Closed),l=t.ref(null),a=t.ref(null),s=t.ref([]),c=t.ref(""),f=t.ref(null),p={menuState:u,buttonRef:l,itemsRef:a,items:s,searchQuery:c,activeItemIndex:f,closeMenu:function(){u.value=v.Closed,f.value=null},openMenu:function(){return u.value=v.Open},goToItem:function(e,t){var n=b(e===d.Specific?{focus:d.Specific,id:t}:{focus:e},{resolveItems:function(){return s.value},resolveActiveIndex:function(){return f.value},resolveId:function(e){return e.id},resolveDisabled:function(e){return e.dataRef.disabled}});""===c.value&&f.value===n||(c.value="",f.value=n)},search:function(e){c.value+=e;var t=s.value.findIndex((function(e){return e.dataRef.textValue.startsWith(c.value)&&!e.dataRef.disabled}));-1!==t&&t!==f.value&&(f.value=t)},clearSearch:function(){c.value=""},registerItem:function(e,t){s.value.push({id:e,dataRef:t})},unregisterItem:function(e){var t=s.value.slice(),n=null!==f.value?t[f.value]:null,o=t.findIndex((function(t){return t.id===e}));-1!==o&&t.splice(o,1),s.value=t,f.value=o===f.value||null===n?null:t.indexOf(n)}};return t.onMounted((function(){function e(e){var t,n,o,r=e.target,i=document.activeElement;u.value===v.Open&&((null==(t=l.value)?void 0:t.contains(r))||((null==(n=a.value)?void 0:n.contains(r))||p.closeMenu(),i!==document.body&&(null==i?void 0:i.contains(r))||e.defaultPrevented||null==(o=l.value)||o.focus({preventScroll:!0})))}window.addEventListener("mousedown",e),t.onUnmounted((function(){return window.removeEventListener("mousedown",e)}))})),t.provide(h,p),function(){return i({props:e,slot:{open:u.value===v.Open},slots:o,attrs:r})}}}),g=t.defineComponent({props:{disabled:{type:Boolean,default:!1},as:{type:[Object,String],default:"button"}},render:function(){var e,t=y("MenuButton"),o={open:t.menuState.value===v.Open},r={ref:"el",id:this.id,type:"button","aria-haspopup":!0,"aria-controls":null==(e=t.itemsRef.value)?void 0:e.id,"aria-expanded":t.menuState.value===v.Open||void 0,onKeyDown:this.handleKeyDown,onClick:this.handleClick};return i({props:n({},this.$props,r),slot:o,attrs:this.$attrs,slots:this.$slots})},setup:function(e){var n=y("MenuButton");return{id:"headlessui-menu-button-"+p(),el:n.buttonRef,handleKeyDown:function(e){switch(e.key){case c.Space:case c.Enter:case c.ArrowDown:e.preventDefault(),n.openMenu(),t.nextTick((function(){var e;null==(e=n.itemsRef.value)||e.focus({preventScroll:!0}),n.goToItem(d.First)}));break;case c.ArrowUp:e.preventDefault(),n.openMenu(),t.nextTick((function(){var e;null==(e=n.itemsRef.value)||e.focus({preventScroll:!0}),n.goToItem(d.Last)}))}},handleClick:function(o){var r;e.disabled||(n.menuState.value===v.Open?(n.closeMenu(),t.nextTick((function(){var e;return null==(e=n.buttonRef.value)?void 0:e.focus({preventScroll:!0})}))):(o.preventDefault(),n.openMenu(),r=function(){var e;return null==(e=n.itemsRef.value)?void 0:e.focus({preventScroll:!0})},requestAnimationFrame((function(){return requestAnimationFrame(r)}))))}}}}),w=t.defineComponent({props:{as:{type:[Object,String],default:"div"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0}},render:function(){var e,t,o=y("MenuItems"),r={open:o.menuState.value===v.Open},u={"aria-activedescendant":null===o.activeItemIndex.value||null==(e=o.items.value[o.activeItemIndex.value])?void 0:e.id,"aria-labelledby":null==(t=o.buttonRef.value)?void 0:t.id,id:this.id,onKeyDown:this.handleKeyDown,role:"menu",tabIndex:0,ref:"el"};return i({props:n({},this.$props,u),slot:r,attrs:this.$attrs,slots:this.$slots,features:l.RenderStrategy|l.Static,visible:r.open})},setup:function(){var e=y("MenuItems"),n="headlessui-menu-items-"+p(),o=t.ref(null);return{id:n,el:e.itemsRef,handleKeyDown:function(n){switch(o.value&&clearTimeout(o.value),n.key){case c.Space:if(""!==e.searchQuery.value)return n.preventDefault(),e.search(n.key);case c.Enter:var r;n.preventDefault(),null!==e.activeItemIndex.value&&(null==(r=document.getElementById(e.items.value[e.activeItemIndex.value].id))||r.click()),e.closeMenu(),t.nextTick((function(){var t;return null==(t=e.buttonRef.value)?void 0:t.focus({preventScroll:!0})}));break;case c.ArrowDown:return n.preventDefault(),e.goToItem(d.Next);case c.ArrowUp:return n.preventDefault(),e.goToItem(d.Previous);case c.Home:case c.PageUp:return n.preventDefault(),e.goToItem(d.First);case c.End:case c.PageDown:return n.preventDefault(),e.goToItem(d.Last);case c.Escape:n.preventDefault(),e.closeMenu(),t.nextTick((function(){var t;return null==(t=e.buttonRef.value)?void 0:t.focus({preventScroll:!0})}));break;case c.Tab:return n.preventDefault();default:1===n.key.length&&(e.search(n.key),o.value=setTimeout((function(){return e.clearSearch()}),350))}}}}}),O=t.defineComponent({props:{as:{type:[Object,String],default:"template"},disabled:{type:Boolean,default:!1},class:{type:[String,Function],required:!1},className:{type:[String,Function],required:!1}},setup:function(e,o){var r=o.slots,u=o.attrs,l=y("MenuItem"),a="headlessui-menu-item-"+p(),s=e.disabled,c=e.className,v=void 0===c?e.class:c,f=t.computed((function(){return null!==l.activeItemIndex.value&&l.items.value[l.activeItemIndex.value].id===a})),b=t.ref({disabled:s,textValue:""});function h(e){if(s)return e.preventDefault();l.closeMenu(),t.nextTick((function(){var e;return null==(e=l.buttonRef.value)?void 0:e.focus({preventScroll:!0})}))}function x(){if(s)return l.goToItem(d.Nothing);l.goToItem(d.Specific,a)}function S(){s||f.value||l.goToItem(d.Specific,a)}function g(){s||f.value&&l.goToItem(d.Nothing)}return t.onMounted((function(){var e,t,n=null==(e=document.getElementById(a))||null==(t=e.textContent)?void 0:t.toLowerCase().trim();void 0!==n&&(b.value.textValue=n)})),t.onMounted((function(){return l.registerItem(a,b)})),t.onUnmounted((function(){return l.unregisterItem(a)})),function(){var t={active:f.value,disabled:s},o={id:a,role:"menuitem",tabIndex:-1,class:m(v,t),"aria-disabled":!0===s||void 0,onClick:h,onFocus:x,onPointerMove:S,onMouseMove:S,onPointerLeave:g,onMouseLeave:g};return i({props:n({},e,o),slot:t,attrs:u,slots:r})}}});!function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(x||(x={}));var I=Symbol("ListboxContext");function k(e){var n=t.inject(I,null);if(null===n){var o=new Error("<"+e+" /> is missing a parent <Listbox /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(o,k),o}return n}var R=t.defineComponent({name:"Listbox",emits:["update:modelValue"],props:{as:{type:[Object,String],default:"template"},modelValue:{type:[Object,String,Number,Boolean],default:null}},setup:function(e,n){var r=n.slots,u=n.attrs,l=n.emit,a=o(e,["modelValue"]),s=t.ref(x.Closed),c=t.ref(null),v=t.ref(null),f=t.ref(null),p=t.ref([]),m=t.ref(""),h=t.ref(null),y=t.computed((function(){return e.modelValue})),S={listboxState:s,value:y,labelRef:c,buttonRef:v,optionsRef:f,options:p,searchQuery:m,activeOptionIndex:h,closeListbox:function(){s.value=x.Closed,h.value=null},openListbox:function(){return s.value=x.Open},goToOption:function(e,t){var n=b(e===d.Specific?{focus:d.Specific,id:t}:{focus:e},{resolveItems:function(){return p.value},resolveActiveIndex:function(){return h.value},resolveId:function(e){return e.id},resolveDisabled:function(e){return e.dataRef.disabled}});""===m.value&&h.value===n||(m.value="",h.value=n)},search:function(e){m.value+=e;var t=p.value.findIndex((function(e){return!e.dataRef.disabled&&e.dataRef.textValue.startsWith(m.value)}));-1!==t&&t!==h.value&&(h.value=t)},clearSearch:function(){m.value=""},registerOption:function(e,t){p.value.push({id:e,dataRef:t})},unregisterOption:function(e){var t=p.value.slice(),n=null!==h.value?t[h.value]:null,o=t.findIndex((function(t){return t.id===e}));-1!==o&&t.splice(o,1),p.value=t,h.value=o===h.value||null===n?null:t.indexOf(n)},select:function(e){l("update:modelValue",e)}};return t.onMounted((function(){function e(e){var t,n,o,r=e.target,u=document.activeElement;s.value===x.Open&&((null==(t=v.value)?void 0:t.contains(r))||((null==(n=f.value)?void 0:n.contains(r))||S.closeListbox(),u!==document.body&&(null==u?void 0:u.contains(r))||e.defaultPrevented||null==(o=v.value)||o.focus({preventScroll:!0})))}window.addEventListener("mousedown",e),t.onUnmounted((function(){return window.removeEventListener("mousedown",e)}))})),t.provide(I,S),function(){return i({props:a,slot:{open:s.value===x.Open},slots:r,attrs:u})}}}),D=t.defineComponent({name:"ListboxLabel",props:{as:{type:[Object,String],default:"label"}},render:function(){var e={open:k("ListboxLabel").listboxState.value===x.Open};return i({props:n({},this.$props,{id:this.id,ref:"el",onClick:this.handleClick}),slot:e,attrs:this.$attrs,slots:this.$slots})},setup:function(){var e=k("ListboxLabel");return{id:"headlessui-listbox-label-"+p(),el:e.labelRef,handleClick:function(){var t;null==(t=e.buttonRef.value)||t.focus({preventScroll:!0})}}}}),T=t.defineComponent({name:"ListboxButton",props:{disabled:{type:Boolean,default:!1},as:{type:[Object,String],default:"button"}},render:function(){var e,t=k("ListboxButton"),o={open:t.listboxState.value===x.Open},r={ref:"el",id:this.id,type:"button","aria-haspopup":!0,"aria-controls":null==(e=t.optionsRef.value)?void 0:e.id,"aria-expanded":t.listboxState.value===x.Open||void 0,"aria-labelledby":t.labelRef.value?[t.labelRef.value.id,this.id].join(" "):void 0,onKeyDown:this.handleKeyDown,onClick:this.handleClick};return i({props:n({},this.$props,r),slot:o,attrs:this.$attrs,slots:this.$slots})},setup:function(e){var n=k("ListboxButton");return{id:"headlessui-listbox-button-"+p(),el:n.buttonRef,handleKeyDown:function(e){switch(e.key){case c.Space:case c.Enter:case c.ArrowDown:e.preventDefault(),n.openListbox(),t.nextTick((function(){var e;null==(e=n.optionsRef.value)||e.focus({preventScroll:!0}),n.value.value||n.goToOption(d.First)}));break;case c.ArrowUp:e.preventDefault(),n.openListbox(),t.nextTick((function(){var e;null==(e=n.optionsRef.value)||e.focus({preventScroll:!0}),n.value.value||n.goToOption(d.Last)}))}},handleClick:function(o){var r;e.disabled||(n.listboxState.value===x.Open?(n.closeListbox(),t.nextTick((function(){var e;return null==(e=n.buttonRef.value)?void 0:e.focus({preventScroll:!0})}))):(o.preventDefault(),n.openListbox(),r=function(){var e;return null==(e=n.optionsRef.value)?void 0:e.focus({preventScroll:!0})},requestAnimationFrame((function(){return requestAnimationFrame(r)}))))}}}}),L=t.defineComponent({name:"ListboxOptions",props:{as:{type:[Object,String],default:"ul"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0}},render:function(){var e,t,o,r,u=k("ListboxOptions"),a={open:u.listboxState.value===x.Open},s={"aria-activedescendant":null===u.activeOptionIndex.value||null==(e=u.options.value[u.activeOptionIndex.value])?void 0:e.id,"aria-labelledby":null!=(t=null==(o=u.labelRef.value)?void 0:o.id)?t:null==(r=u.buttonRef.value)?void 0:r.id,id:this.id,onKeyDown:this.handleKeyDown,role:"listbox",tabIndex:0,ref:"el"};return i({props:n({},this.$props,s),slot:a,attrs:this.$attrs,slots:this.$slots,features:l.RenderStrategy|l.Static,visible:a.open})},setup:function(){var e=k("ListboxOptions"),n="headlessui-listbox-options-"+p(),o=t.ref(null);return{id:n,el:e.optionsRef,handleKeyDown:function(n){switch(o.value&&clearTimeout(o.value),n.key){case c.Space:if(""!==e.searchQuery.value)return n.preventDefault(),e.search(n.key);case c.Enter:n.preventDefault(),null!==e.activeOptionIndex.value&&e.select(e.options.value[e.activeOptionIndex.value].dataRef.value),e.closeListbox(),t.nextTick((function(){var t;return null==(t=e.buttonRef.value)?void 0:t.focus({preventScroll:!0})}));break;case c.ArrowDown:return n.preventDefault(),e.goToOption(d.Next);case c.ArrowUp:return n.preventDefault(),e.goToOption(d.Previous);case c.Home:case c.PageUp:return n.preventDefault(),e.goToOption(d.First);case c.End:case c.PageDown:return n.preventDefault(),e.goToOption(d.Last);case c.Escape:n.preventDefault(),e.closeListbox(),t.nextTick((function(){var t;return null==(t=e.buttonRef.value)?void 0:t.focus({preventScroll:!0})}));break;case c.Tab:return n.preventDefault();default:1===n.key.length&&(e.search(n.key),o.value=setTimeout((function(){return e.clearSearch()}),350))}}}}}),C=t.defineComponent({name:"ListboxOption",props:{as:{type:[Object,String],default:"li"},value:{type:[Object,String],default:null},disabled:{type:Boolean,default:!1},class:{type:[String,Function],required:!1},className:{type:[String,Function],required:!1}},setup:function(e,o){var r=o.slots,u=o.attrs,l=k("ListboxOption"),a="headlessui-listbox-option-"+p(),s=e.disabled,c=e.className,v=void 0===c?e.class:c,f=e.value,b=t.computed((function(){return null!==l.activeOptionIndex.value&&l.options.value[l.activeOptionIndex.value].id===a})),h=t.computed((function(){return t.toRaw(l.value.value)===t.toRaw(f)})),y=t.ref({disabled:s,value:f,textValue:""});function S(e){if(s)return e.preventDefault();l.select(f),l.closeListbox(),t.nextTick((function(){var e;return null==(e=l.buttonRef.value)?void 0:e.focus({preventScroll:!0})}))}function g(){if(s)return l.goToOption(d.Nothing);l.goToOption(d.Specific,a)}function w(){s||b.value||l.goToOption(d.Specific,a)}function O(){s||b.value&&l.goToOption(d.Nothing)}return t.onMounted((function(){var e,t,n=null==(e=document.getElementById(a))||null==(t=e.textContent)?void 0:t.toLowerCase().trim();void 0!==n&&(y.value.textValue=n)})),t.onMounted((function(){return l.registerOption(a,y)})),t.onUnmounted((function(){return l.unregisterOption(a)})),t.onMounted((function(){t.watch([l.listboxState,h],(function(){var e;l.listboxState.value===x.Open&&h.value&&(l.goToOption(d.Specific,a),null==(e=document.getElementById(a))||null==e.focus||e.focus())}),{immediate:!0})})),t.watchEffect((function(){l.listboxState.value===x.Open&&b.value&&t.nextTick((function(){var e;return null==(e=document.getElementById(a))||null==e.scrollIntoView?void 0:e.scrollIntoView({block:"nearest"})}))})),function(){var t={active:b.value,selected:h.value,disabled:s},o={id:a,role:"option",tabIndex:-1,class:m(v,t),"aria-disabled":!0===s||void 0,"aria-selected":!0===h.value?h.value:void 0,onClick:S,onFocus:g,onPointerMove:w,onMouseMove:w,onPointerLeave:O,onMouseLeave:O};return i({props:n({},e,o),slot:t,attrs:u,slots:r})}}}),E=Symbol("GroupContext");function M(e){var n=t.inject(E,null);if(null===n){var o=new Error("<"+e+" /> is missing a parent <SwitchGroup /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(o,M),o}return n}var j=t.defineComponent({name:"SwitchGroup",props:{as:{type:[Object,String],default:"template"}},setup:function(e,n){var o=n.slots,r=n.attrs,u=t.ref(null),l=t.ref(null);return t.provide(E,{switchRef:u,labelRef:l}),function(){return i({props:e,slot:{},slots:o,attrs:r})}}}),A=t.defineComponent({name:"Switch",emits:["update:modelValue"],props:{as:{type:[Object,String],default:"button"},modelValue:{type:[Object,Boolean],default:null},class:{type:[String,Function],required:!1},className:{type:[String,Function],required:!1}},render:function(){var e=t.inject(E,null),o=this.$props,r=o.className,u=void 0===r?o.class:r,l=t.computed((function(){var t;return null==e||null==(t=e.labelRef.value)?void 0:t.id})),a={checked:this.$props.modelValue},s={id:this.id,ref:null===e?void 0:e.switchRef,role:"switch",tabIndex:0,class:m(u,a),"aria-checked":this.$props.modelValue,"aria-labelledby":l.value,onClick:this.handleClick,onKeyUp:this.handleKeyUp,onKeyPress:this.handleKeyPress};return"button"===this.$props.as&&Object.assign(s,{type:"button"}),i({props:n({},this.$props,s),slot:a,attrs:this.$attrs,slots:this.$slots})},setup:function(e,n){var o=n.emit,r=t.inject(E,null);function u(){o("update:modelValue",!e.modelValue)}return{id:"headlessui-switch-"+p(),el:null==r?void 0:r.switchRef,handleClick:function(e){e.preventDefault(),u()},handleKeyUp:function(e){e.key!==c.Tab&&e.preventDefault(),e.key===c.Space&&u()},handleKeyPress:function(e){e.preventDefault()}}}}),$=t.defineComponent({name:"SwitchLabel",props:{as:{type:[Object,String],default:"label"}},render:function(){return i({props:n({},this.$props,{id:this.id,ref:"el",onClick:this.handleClick}),slot:{},attrs:this.$attrs,slots:this.$slots})},setup:function(){var e=M("SwitchLabel");return{id:"headlessui-switch-label-"+p(),el:e.labelRef,handleClick:function(){var t,n;null==(t=e.switchRef.value)||t.click(),null==(n=e.switchRef.value)||n.focus({preventScroll:!0})}}}});e.Listbox=R,e.ListboxButton=T,e.ListboxLabel=D,e.ListboxOption=C,e.ListboxOptions=L,e.Menu=S,e.MenuButton=g,e.MenuItem=O,e.MenuItems=w,e.Switch=A,e.SwitchGroup=j,e.SwitchLabel=$,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=headlessui.umd.production.min.js.map
{
"name": "@headlessui/vue",
"version": "0.2.0-80402e7",
"version": "0.2.0-da179ca",
"main": "dist/index.js",

@@ -5,0 +5,0 @@ "typings": "dist/index.d.ts",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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